@cimulate/copilot-widget 1.7.5 → 1.7.6
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.
|
@@ -7263,16 +7263,10 @@ const Et = new GN(), XN = (e) => {
|
|
|
7263
7263
|
z.useEffect(() => {
|
|
7264
7264
|
if (!ne) return;
|
|
7265
7265
|
const Ae = (Le) => {
|
|
7266
|
-
|
|
7267
|
-
|
|
7268
|
-
|
|
7269
|
-
|
|
7270
|
-
message: Le
|
|
7271
|
-
});
|
|
7272
|
-
return;
|
|
7273
|
-
}
|
|
7274
|
-
N(Le);
|
|
7275
|
-
}
|
|
7266
|
+
ue || (!Le.message && Le.eventSourceId && Le.eventSourceId === Te.requestId && ae({
|
|
7267
|
+
requestId: Le.eventSourceId,
|
|
7268
|
+
message: Le
|
|
7269
|
+
}), N(Le));
|
|
7276
7270
|
};
|
|
7277
7271
|
return ne.on("follow_up", Ae), () => {
|
|
7278
7272
|
ne.off("follow_up", Ae);
|
|
@@ -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=Zi(this.defaults,n);const{transitional:r,paramsSerializer:s,headers:a}=n;r!==void 0&&nl.assertOptions(r,{silentJSONParsing:Wn.transitional(Wn.boolean),forcedJSONParsing:Wn.transitional(Wn.boolean),clarifyTimeoutError:Wn.transitional(Wn.boolean),legacyInterceptorReqResOrdering:Wn.transitional(Wn.boolean)},!1),s!=null&&(K.isFunction(s)?n.paramsSerializer={serialize:s}:nl.assertOptions(s,{encode:Wn.function,serialize:Wn.function},!0)),n.allowAbsoluteUrls!==void 0||(this.defaults.allowAbsoluteUrls!==void 0?n.allowAbsoluteUrls=this.defaults.allowAbsoluteUrls:n.allowAbsoluteUrls=!0),nl.assertOptions(n,{baseUrl:Wn.spelling("baseURL"),withXsrfToken:Wn.spelling("withXSRFToken")},!0),n.method=(n.method||this.defaults.method||"get").toLowerCase();let u=a&&K.merge(a.common,a[n.method]);a&&K.forEach(["delete","get","head","post","put","patch","common"],_=>{delete a[_]}),n.headers=xn.concat(u,a);const c=[];let d=!0;this.interceptors.request.forEach(function(S){if(typeof S.runWhen=="function"&&S.runWhen(n)===!1)return;d=d&&S.synchronous;const C=n.transitional||Zd;C&&C.legacyInterceptorReqResOrdering?c.unshift(S.fulfilled,S.rejected):c.push(S.fulfilled,S.rejected)});const f=[];this.interceptors.response.forEach(function(S){f.push(S.fulfilled,S.rejected)});let p,g=0,b;if(!d){const _=[yg.bind(this),void 0];for(_.unshift(...c),_.push(...f),b=_.length,p=Promise.resolve(n);g<b;)p=p.then(_[g++],_[g++]);return p}b=c.length;let T=n;for(;g<b;){const _=c[g++],S=c[g++];try{T=_(T)}catch(C){S.call(this,C);break}}try{p=yg.call(this,T)}catch(_){return Promise.reject(_)}for(g=0,b=f.length;g<b;)p=p.then(f[g++],f[g++]);return p}getUri(t){t=Zi(this.defaults,t);const n=ag(t.baseURL,t.url,t.allowAbsoluteUrls);return Z0(n,t.params,t.paramsSerializer)}};K.forEach(["delete","get","head","options"],function(t){es.prototype[t]=function(n,r){return this.request(Zi(r||{},{method:t,url:n,data:(r||{}).data}))}}),K.forEach(["post","put","patch"],function(t){function n(r){return function(a,u,c){return this.request(Zi(c||{},{method:t,headers:r?{"Content-Type":"multipart/form-data"}:{},url:a,data:u}))}}es.prototype[t]=n(),es.prototype[t+"Form"]=n(!0)});let sA=class nx{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 oa(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 nx(function(s){t=s}),cancel:t}}};function oA(e){return function(n){return e.apply(null,n)}}function aA(e){return K.isObject(e)&&e.isAxiosError===!0}const af={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(af).forEach(([e,t])=>{af[t]=e});function _g(e){const t=new es(e),n=U0(es.prototype.request,t);return K.extend(n,es.prototype,t,{allOwnKeys:!0}),K.extend(n,t,null,{allOwnKeys:!0}),n.create=function(s){return _g(Zi(e,s))},n}const Lt=_g(ia);Lt.Axios=es,Lt.CanceledError=oa,Lt.CancelToken=sA,Lt.isCancel=rg,Lt.VERSION=Tg,Lt.toFormData=Qu,Lt.AxiosError=He,Lt.Cancel=Lt.CanceledError,Lt.all=function(t){return Promise.all(t)},Lt.spread=oA,Lt.isAxiosError=aA,Lt.mergeConfig=Zi,Lt.AxiosHeaders=xn,Lt.formToJSON=e=>tg(K.isHTMLForm(e)?new FormData(e):e),Lt.getAdapter=Eg.getAdapter,Lt.HttpStatusCode=af,Lt.default=Lt;const{Axios:X9,AxiosError:K9,CanceledError:Q9,isCancel:J9,CancelToken:Z9,VERSION:eB,all:tB,Cancel:nB,isAxiosError:rB,spread:iB,toFormData:sB,AxiosHeaders:oB,HttpStatusCode:aB,formToJSON:uB,getAdapter:lB,mergeConfig:cB}=Lt;class uA{constructor(t,n,r,s=!1){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",()=>Ze(this,null,function*(){try{const t=yield Lt.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}`),this.baseApiUrl=this._mapCopilotUrlToSearchUrl(t,s)}get apiUrl(){return`${this.baseApiUrl}/${this.CIMULATE_SEARCH_API_PATH}`}}class lA{constructor(t,n,r,s=!1){Se(this,"apiService");Se(this,"config",null);Se(this,"getConfig",()=>Ze(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 uA(t,n,r,s)}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 js=(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 cA{constructor(t=!1){Se(this,"isDevelopment");Se(this,"_log",(t,n,...r)=>{js(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 Sg=z.createContext(null),dA=({logoUrl:e,headerText:t="Your Search Assistant",globalClassName:n="",entryMessage:r,openLinksInNewTab:s=!1,disclaimerText:a,disclaimerMarkdown:u,searchPlaceholder:c,searchButtonLabel:d,searchConfig:f,componentConfig:p,conversationHistory:g,resetConversationMessage:b="",apiKey:T,apiToken:_,baseUrl:S,theme:C,isDevelopment:N,__features:D,children:k})=>{const M=z.useMemo(()=>new lA(S,T,_,N),[S,T,_,N]),Y=z.useMemo(()=>new cA(N),[N]);z.useEffect(()=>{M.config||M.getConfig()},[M]);const B=z.useMemo(()=>Iw(C),[C]),te=z.useMemo(()=>{const ye=(f==null?void 0:f.placeholder)||c,$=(f==null?void 0:f.buttonLabel)||d;let ne="icon";return f!=null&&f.buttonType?ne=f.buttonType:d&&(ne="text"),be(U({},f||{}),{placeholder:ye,buttonLabel:$,buttonType:ne})},[f,c,d]),ae=z.useMemo(()=>({configModule:M,logoUrl:e,headerText:t,entryMessage:r,globalClassName:n,openLinksInNewTab:s,disclaimerText:a,disclaimerMarkdown:u,themeVariables:B,logger:Y,searchConfig:te,enableMinimize:!!(p!=null&&p.enableMinimize),resetConversationMessage:b,conversationHistory:{sinceHours:typeof(g==null?void 0:g.sinceHours)=="number"?g.sinceHours:1,limit:g==null?void 0:g.limit},features:D}),[M,e,t,r,n,a,u,s,te,p,b,Y,B,g,D]);return w.jsx(Sg.Provider,{value:ae,children:k})},ht=()=>{const e=z.useContext(Sg);if(!e)throw new Error("useConfig must be used within a ConfigProvider");return e};class fA{constructor(){Se(this,"initialState",{connected:!1,mode:"embedded",entryType:"search",status:{type:"dialog",isOpen:!1,isMinimized:!1},dialog:{position:"bottom-left"},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 mA(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},{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},modal:{isFullscreen:this.modalProxy.isFullscreen}}}}const at=new fA,ts=()=>at.connected,aa=()=>at.isOpen,hA=e=>{window.addEventListener(Yd,e)},pA=e=>{window.removeEventListener(Yd,e)},mA=(e,t)=>{const n=new CustomEvent(Yd,{detail:{property:e,value:t}});window.dispatchEvent(n)},gA=e=>{at.connectedProxy.connected=e},ua=e=>{if(!["ask_cim","search","browse","pdp"].includes(e))throw new Error(`Invalid entryType: "${e}". Must be 'ask_cim', 'search', 'browse', or 'pdp'.`);at.entryTypeProxy.entryType=e},gi=e=>{const t=at.statusProxy.isOpen,n=typeof e=="boolean"?e:!t;at.statusProxy.isOpen=n,n&&(at.statusProxy.isMinimized=!1)},rl=e=>{const t=at.statusProxy.isMinimized,n=typeof e=="boolean"?e:!t;at.statusProxy.isMinimized=n,n&&(at.statusProxy.isOpen=!1)},uf=e=>{at.modalProxy.isFullscreen=e},il=e=>{if(!["chat","dialog","modal"].includes(e))throw new Error(`Invalid type: ${e}. Must be 'chat', 'dialog', or 'modal'.`);at.statusProxy.type=e,e==="dialog"||e==="chat"?at.modeProxy.mode="embedded":at.modeProxy.mode="standalone"},lf=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(", ")}.`);at.dialogProxy.position=e},EA=({onCopilotEvent:e,children:t,dispatch:n})=>{const{logger:r}=ht(),s=z.useCallback(M=>{n({type:dt.SET_COPILOT,payload:M})},[n]),a=z.useCallback(M=>{gA(M),n({type:dt.SET_CONNECTED,payload:M})},[n]),u=z.useCallback(M=>{n({type:dt.SET_ENTRY_TYPE,payload:M})},[n]),c=z.useCallback(()=>{n({type:dt.RESET_COPILOT,payload:{}})},[n]),d=z.useCallback(()=>{n({type:dt.RESET_STATE,payload:{}})},[n]),f=z.useCallback(M=>{r==null||r.log(`${M.name} event received`,M),n({type:dt.ADD_MESSAGE,payload:M}),M.bypassHandlers||e==null||e(M)},[e,r,n]),p=z.useCallback(M=>{n({type:dt.ADD_LOADING_MESSAGE,payload:M})},[n]),g=z.useCallback(M=>{n({type:dt.REMOVE_LOADING_MESSAGE,payload:M})},[n]),b=z.useCallback(M=>{f(M),p(M.id)},[f,p]),T=z.useCallback(M=>{n({type:dt.SET_ACTIVE_CONVERSATION_ID,payload:M})},[n]),_=z.useCallback(M=>{n({type:dt.ADD_CONVERSATION_ID,payload:M})},[n]),S=z.useCallback(M=>{n({type:dt.SET_CONVERSATION_IDS,payload:M})},[n]),C=z.useCallback(M=>{n({type:dt.SET_IMAGE_FILE,payload:M})},[n]),N=z.useCallback(M=>{n({type:dt.SET_ASK_CIM_PROMPTS,payload:M})},[n]),D=z.useCallback(M=>{n({type:dt.SET_CONVERSATION_HISTORY_LOADED,payload:M})},[n]),k=z.useMemo(()=>({setCopilot:s,setConnected:a,setEntryType:u,resetCopilot:c,resetCopilotState:d,addCopilotEvent:f,addLoadingMessage:p,removeLoadingMessage:g,handleCopilotRequestAck:b,setActiveConversationId:T,addConversationId:_,setConversationIds:S,setImageFile:C,setAskCimPrompts:N,setConversationHistoryLoaded:D}),[s,a,u,c,d,f,p,g,b,T,_,S,C,N,D]);return w.jsx(B0.Provider,{value:k,children:t})};vw();const yA=(e,t)=>{const{type:n,payload:r}=t;if(n===dt.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 dt.RESET_STATE:e.messages=pi.messages,e.groupedMessages=pi.groupedMessages,e.loadingMessages=pi.loadingMessages,e.imageFile=pi.imageFile,e.askCimPrompts=pi.askCimPrompts,e.conversationHistoryLoaded=pi.conversationHistoryLoaded;break;case dt.RESET_COPILOT:e.copilot=null;break;case dt.SET_COPILOT:e.copilot=r;break;case dt.SET_CONNECTED:e.connected=r;break;case dt.SET_ENTRY_TYPE:e.entryType=r;break;case dt.ADD_LOADING_MESSAGE:e.loadingMessages.add(r);break;case dt.REMOVE_LOADING_MESSAGE:e.loadingMessages.delete(r);break;case dt.SET_ACTIVE_CONVERSATION_ID:e.activeConversationId=r;break;case dt.ADD_CONVERSATION_ID:{const s=r;e.conversationIds.includes(s)||e.conversationIds.push(s)}break;case dt.SET_CONVERSATION_IDS:e.conversationIds=r;break;case dt.SET_IMAGE_FILE:e.imageFile=r;break;case dt.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 dt.SET_CONVERSATION_HISTORY_LOADED:e.conversationHistoryLoaded=r;break}},TA=({entryType:e,onCopilotEvent:t,children:n})=>{const r=e?be(U({},pi),{entryType:e}):pi,[s,a]=D0(yA,r);return w.jsx(F0.Provider,{value:s,children:w.jsx(EA,{onCopilotEvent:t,dispatch:a,children:n})})};function bA(){var e=z.useRef(!0);return e.current?(e.current=!1,!0):e.current}var sl=function(e){z.useEffect(e,[])},_A=function(e,t){return e===t};function SA(e,t){t===void 0&&(t=_A);var n=z.useRef(),r=z.useRef(e),s=bA();return!s&&!t(r.current,e)&&(n.current=r.current,r.current=e),n.current}class xA{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(an.size).fill(1).forEach(()=>{const r=an.first();r&&(t(r),an.remove())})})}get size(){return this.items.length}}const an=new xA,xg=e=>{window.addEventListener(qd,e)},wg=e=>{window.removeEventListener(qd,e)},wA=(e,t,n)=>{const r=new CustomEvent(qd,{detail:{event:e,property:t,value:n}});window.dispatchEvent(r)},Cg=e=>{window.addEventListener(Vd,e)},Ag=e=>{window.removeEventListener(Vd,e)},CA=(e,t,n)=>{const r=new CustomEvent(Vd,{detail:{event:e,property:t,value:n}});window.dispatchEvent(r)},vg=e=>{window.addEventListener($d,e)},kg=e=>{window.removeEventListener($d,e)},Ng=(e,t,n)=>{const r=new CustomEvent($d,{detail:{property:e,value:t,event:n}});window.dispatchEvent(r)},AA=e=>{window.addEventListener(Gd,e)},vA=e=>{window.removeEventListener(Gd,e)},ol=(e,t,n)=>{const r=new CustomEvent(Gd,{detail:{property:e,value:t,event:n}});window.dispatchEvent(r)};class kA{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=Ow[n];return CA(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 kA,Og=(e,t)=>{const n=t.updateFacetFiltersProxy(e);t.facetFiltersProxy.facetFilters=n.facetFilters},Pg=(e,t,n)=>{var u,c;const r=U({},((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},Ig=(e,t)=>{const n=t.updateRangeFiltersProxy(e);t.rangeFiltersProxy.rangeFilters=n.rangeFilters},Rg=({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},Lg=(e,t)=>{t.catalogSegmentProxy.catalogSegment=e},Dg=(e,t)=>{const n=t.updatePricebooksProxy(e);t.pricebooksProxy.pricebooks=n.pricebooks},NA=e=>{if(!ts()||!aa()){ts()&&an.clear(),an.add({context:"browse",payload:be(U({},ut.state),{categoryId:e})});return}ut.categoryIdProxy.categoryId=e},Mg=e=>{Og(e,ut)},OA=(e,t)=>{Pg(e,t,ut)},Fg=e=>{Ig(e,ut)},PA=({field:e,value:t})=>{Rg({field:e,value:t},ut)},IA=e=>{Lg(e,ut)},Bg=e=>{Dg(e,ut)},Ug=e=>{if(!e||!("categoryId"in e))throw new Error("Browse context must include a categoryId");const t=ts(),n=aa();if(!t||!n){t&&an.clear(),an.add({context:"browse",payload:U({},e)});return}"facetFilters"in e&&Mg(e.facetFilters||{}),"rangeFilters"in e&&Fg(e.rangeFilters||[]),"catalogSegment"in e&&(ut.catalogSegmentProxy.catalogSegment=e.catalogSegment||null),"pricebooks"in e&&Bg(e.pricebooks||[]),"categoryName"in e&&(ut.categoryIdProxy.categoryName=e.categoryName||""),ut.categoryIdProxy.categoryId=e.categoryId},RA=Object.freeze(Object.defineProperty({__proto__:null,setBrowseContext:Ug,updateBrowseCategoryId:NA,updateCatalogSegment:IA,updateFacetFilter:OA,updateFacetFilters:Mg,updatePricebooks:Bg,updateRangeFilter:PA,updateRangeFilters:Fg},Symbol.toStringTag,{value:"Module"}));class LA{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)=>(Ng(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 cr=new LA,Hg=e=>{if(!e||!e.productId)throw new Error("PDP context must include a productId");const t=ts(),n=aa();if(!t||!n){t&&an.clear(),an.add({context:"pdp",payload:U({},e)});return}cr.updateProxy(e),Ng("pdp-context",e)},DA=e=>{cr.proxy.productId=e,ts()||an.add({context:"pdp",payload:U({},cr.state)})},MA=e=>{cr.proxy.pdpLink=e},mt={SET_PROMPTS_EXTENSION_INITIALIZED:"SET_PROMPTS_EXTENSION_INITIALIZED",SET_PROMPTS_EXTENSION_OPEN:"SET_PROMPTS_EXTENSION_OPEN",SET_PROMPTS_EXTENSION_INLINE:"SET_PROMPTS_EXTENSION_INLINE",SET_PROMPTS_EXTENSION_ELEMENT_ID:"SET_PROMPTS_EXTENSION_ELEMENT_ID",SET_PROMPTS_EXTENSION_ENTRY_TYPE:"SET_PROMPTS_EXTENSION_ENTRY_TYPE",SET_PROMPTS_EXTENSION_PARAMS:"SET_PROMPTS_EXTENSION_PARAMS",RESET_PROMPTS_EXTENSION_PARAMS:"RESET_PROMPTS_EXTENSION_PARAMS",SET_PROMPTS_EXTENSION_ACTIVE_PROMPTS_ID:"SET_PROMPTS_EXTENSION_ACTIVE_PROMPTS_ID",RESET_PROMPTS_EXTENSION_ACTIVE_PROMPTS_ID:"RESET_PROMPTS_EXTENSION_ACTIVE_PROMPTS_ID",SET_PROMPTS_EXTENSION_USER_PROMPT:"SET_PROMPTS_EXTENSION_USER_PROMPT",SET_PROMPTS_EXTENSION_PROMPTS_MESSAGE:"SET_PROMPTS_EXTENSION_PROMPTS_MESSAGE",RESET_PROMPTS_EXTENSION_PROMPTS_MESSAGE:"RESET_PROMPTS_EXTENSION_PROMPTS_MESSAGE",SET_PROMPTS_EXTENSION_RESPONSE_MESSAGE:"SET_PROMPTS_EXTENSION_RESPONSE_MESSAGE",RESET_PROMPTS_EXTENSION_RESPONSE_MESSAGE:"RESET_PROMPTS_EXTENSION_RESPONSE_MESSAGE",SET_PROMPTS_EXTENSION_RESPONSE_LOADING:"SET_PROMPTS_EXTENSION_RESPONSE_LOADING"},zg={isInitialized:!1,isOpen:!1,isInline:!1,elementId:null,placeholder:null,entryType:null,params:null,activePromptsId:null,userPrompt:null,promptsMessage:null,isResponseLoading:!1,responseMessage:null};class FA{constructor(){Se(this,"initialState",zg);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 la(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(U({},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 Ut=new FA,BA=e=>{window.addEventListener(Wd,e)},UA=e=>{window.removeEventListener(Wd,e)},la=(e,t)=>{const n=new CustomEvent(Wd,{detail:{property:e,value:t}});window.dispatchEvent(n)},jg=e=>{const t=Ut.isOpen,n=typeof e=="boolean"?e:!t;Ut.promptsStateProxy.isOpen=n},$g=e=>{const t=Ut.isInline,n=typeof e=="boolean"?e:!t;Ut.promptsStateProxy.isInline=n},HA=e=>{Ut.promptsParamsProxy=Ut.updatePromptsParamsProxy(e),la("params",e),Ut.promptsStateProxy.entryType="ask_cim"},zA=e=>{Ut.promptsParamsProxy=Ut.updatePromptsParamsProxy(e),la("params",e),Ut.promptsStateProxy.entryType="search"},jA=e=>{Ut.promptsParamsProxy=Ut.updatePromptsParamsProxy(e),la("params",e),Ut.promptsStateProxy.entryType="browse"},$A=e=>{Ut.promptsParamsProxy=Ut.updatePromptsParamsProxy(e),la("params",e),Ut.promptsStateProxy.entryType="pdp"},VA=({elementId:e,entryType:t,params:n,isInline:r})=>{Ut.promptsStateProxy.elementId=e,t&&(Ut.promptsStateProxy.entryType=t),typeof r=="boolean"&&$g(r),n&&Ut.updatePromptsParamsProxy(n),Ut.isOpen||jg(!0)},qA=Object.freeze(Object.defineProperty({__proto__:null,getConversationMessages:({payload:e,callback:t})=>{ol("getConversationMessages",{payload:e,callback:t},mi.GET_CONVERSATION_MESSAGES)},getSessionInformation:e=>{ol("getSessionInformation",{callback:e},mi.GET_SESSION_INFORMATION)},loadConversation:e=>{ol("loadConversation",e,mi.LOAD_CONVERSATION)},resetConversation:()=>{ol("resetConversation",!0,mi.RESET_CONVERSATION)}},Symbol.toStringTag,{value:"Module"}));class YA{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=Pw[n];return wA(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 YA,WA=e=>{const t=aa(),n=ts();if(!n||!t){n&&an.clear(),an.add({context:"search",payload:be(U({},Tt.state),{query:e})});return}Tt.queryProxy.query=e},Vg=e=>{Og(e,Tt)},GA=(e,t)=>{Pg(e,t,Tt)},qg=e=>{Ig(e,Tt)},XA=({field:e,value:t})=>{Rg({field:e,value:t},Tt)},KA=e=>{Lg(e,Tt)},Yg=e=>{Dg(e,Tt)},Wg=e=>{if(!e||!e.query)throw new Error("Search context must include a query");const t=aa(),n=ts();if(!n||!t){n&&an.clear(),an.add({context:"search",payload:U({},e)});return}"facetFilters"in e&&Vg(e.facetFilters||{}),"rangeFilters"in e&&qg(e.rangeFilters||[]),"catalogSegment"in e&&(Tt.catalogSegmentProxy.catalogSegment=e.catalogSegment||null),"pricebooks"in e&&Yg(e.pricebooks||[]),Tt.queryProxy.query=e.query},QA=Object.freeze(Object.defineProperty({__proto__:null,setSearchContext:Wg,updateCatalogSegment:KA,updateFacetFilter:GA,updateFacetFilters:Vg,updatePricebooks:Yg,updateRangeFilter:XA,updateRangeFilters:qg,updateSearchQuery:WA},Symbol.toStringTag,{value:"Module"})),JA={categoryId:ut.categoryId,categoryName:ut.categoryIdProxy.categoryName||"",facetFilters:ut.facetFilters,rangeFilters:ut.rangeFilters,catalogSegment:ut.catalogSegment,pricebooks:ut.pricebooks},Gg=z.createContext(JA),ZA=({children:e})=>{const[t,n]=z.useState(ut.categoryId),[r,s]=z.useState(ut.categoryIdProxy.categoryName||""),[a,u]=z.useState(ut.facetFilters||{}),[c,d]=z.useState(ut.rangeFilters||[]),[f,p]=z.useState(ut.catalogSegment||null),[g,b]=z.useState(ut.pricebooks||null);z.useEffect(()=>{const _=({detail:S})=>{(S==null?void 0:S.property)==="categoryId"&&n(S.value),(S==null?void 0:S.property)==="categoryName"&&s(S.value),(S==null?void 0:S.property)==="facetFilters"&&u(S.value),(S==null?void 0:S.property)==="rangeFilters"&&d(S.value),(S==null?void 0:S.property)==="catalogSegment"&&p(S.value),(S==null?void 0:S.property)==="pricebooks"&&b(S.value)};return Cg(_),()=>{Ag(_)}},[]);const T=z.useMemo(()=>({categoryId:t,categoryName:r,facetFilters:a,rangeFilters:c,catalogSegment:f,pricebooks:g}),[t,r,a,c,f,g]);return w.jsx(Gg.Provider,{value:T,children:e})},ev=()=>{const e=z.useContext(Gg);if(!e)throw new Error("useBrowse must be used within a BrowseProvider");return e},tv={searchQuery:Tt.query,facetFilters:Tt.facetFilters,rangeFilters:Tt.rangeFilters,catalogSegment:Tt.catalogSegment,pricebooks:Tt.pricebooks},Xg=z.createContext(tv),nv=({children:e})=>{const[t,n]=z.useState(Tt.query),[r,s]=z.useState(Tt.facetFilters),[a,u]=z.useState(Tt.rangeFilters),[c,d]=z.useState(Tt.catalogSegment),[f,p]=z.useState(Tt.pricebooks);z.useEffect(()=>{const b=({detail:T})=>{(T==null?void 0:T.property)==="query"&&n(T.value),(T==null?void 0:T.property)==="facetFilters"&&s(T.value),(T==null?void 0:T.property)==="rangeFilters"&&u(T.value),(T==null?void 0:T.property)==="catalogSegment"&&d(T.value),(T==null?void 0:T.property)==="pricebooks"&&p(T.value)};return xg(b),()=>{wg(b)}},[]);const g=z.useMemo(()=>({searchQuery:t,facetFilters:r,rangeFilters:a,catalogSegment:c,pricebooks:f}),[t,r,a,c,f]);return w.jsx(Xg.Provider,{value:g,children:e})},rv=()=>{const e=z.useContext(Xg);if(!e)throw new Error("useSearch must be used within a SearchProvider");return e},iv={productId:cr.productId,pdpLink:cr.pdpLink},Kg=z.createContext(iv),sv=({children:e})=>{const[t,n]=z.useState(cr.productId),[r,s]=z.useState(cr.pdpLink);z.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 vg(u),()=>{kg(u)}},[]);const a=z.useMemo(()=>({productId:t,pdpLink:r}),[t,r]);return w.jsx(Kg.Provider,{value:a,children:e})},ov=()=>{const e=z.useContext(Kg);if(!e)throw new Error("usePdp must be used within a PdpProvider");return e},ns=()=>{const e=z.useContext(B0);if(!e)throw new Error("useCopilotDispatch must be used within a CopilotProvider");return e},Gn=()=>{const e=z.useContext(F0);if(!e)throw new Error("useCopilotState must be used within a CopilotProvider");return e},dr=()=>{const e=z.useContext(t1);if(!e)throw new Error("useCopilot must be used within a CopilotProvider");return e},cf=()=>{const{status:e}=Xr(),{entryType:t,messages:n}=Gn(),r=t==="ask_cim",s=!!(n&&n.length>0),a=!!e.isOpen;return r&&a||!r&&a&&s},Qg=z.createContext({mode:at.modeProxy.mode,status:at.statusProxy,dialogPosition:at.dialogProxy.position,isModalFullscreen:at.modalProxy.isFullscreen,previousComponentType:at.statusProxy.type}),av=({entryType:e,componentConfig:t,componentType:n,children:r})=>{const{setEntryType:s}=ns(),[a,u]=z.useState(at.modeProxy.mode),[c,d]=z.useState({type:n||at.statusProxy.type,isOpen:at.statusProxy.isOpen,isMinimized:at.statusProxy.isMinimized}),[f,p]=z.useState(at.dialogProxy.position),[g,b]=z.useState(at.modalProxy.isFullscreen),T=SA(c.type);z.useEffect(()=>{const S=C=>{const{property:N,value:D}=C.detail||{};if(!(!N||D===void 0)){if(N==="mode"){u(D);return}if(N==="entryType"){s(D);return}if(N==="isMinimized"){d(k=>be(U({},k),{isMinimized:D}));return}if(N==="isOpen"){d(k=>be(U({},k),{isOpen:D}));return}if(N==="type"){d(k=>be(U({},k),{type:D}));return}if(N==="position"){p(D);return}if(N==="isFullscreen"){b(D);return}}};return hA(S),()=>{pA(S)}},[s]),sl(()=>{e&&ua(e)}),sl(()=>{const S=n||(t==null?void 0:t.type);S&&il(S),t&&"isOpen"in t&&gi(!!t.isOpen),t&&"isMinimized"in t&&rl(!!t.isMinimized)}),sl(()=>{if(!(t!=null&&t.options))return;const{dialogPosition:S}=t.options;S&&lf(S),"isModalFullscreen"in t.options&&uf(!!t.options.isModalFullscreen)});const _=z.useMemo(()=>({mode:a,status:c,previousComponentType:T||"dialog",dialogPosition:f,isModalFullscreen:g}),[a,c,T,f,g]);return w.jsx(Qg.Provider,{value:_,children:r})},Xr=()=>{const e=z.useContext(Qg);if(!e)throw new Error("useUIState must be used within a UIStateProvider");return e},Jg=z.createContext(null),Zg=z.createContext(null),e1=()=>{const e=z.useContext(Zg);if(!e)throw new Error("usePromptsExtensionDispatch must be used within a PromptsExtensionProvider");return e},Ei=()=>{const e=z.useContext(Jg);if(!e)throw new Error("usePromptsExtensionState must be used within a PromptsExtensionProvider");return e},uv=({copilot:e})=>{const{logger:t,conversationHistory:n}=ht(),{isInline:r}=Ei(),{addCopilotEvent:s,setEntryType:a,setConversationHistoryLoaded:u}=ns(),{activeConversationId:c}=Gn(),d=z.useCallback(p=>{e&&e.requestSessionInformation(g=>{t==null||t.log("Retrieved session information: ",g),p==null||p(g)})},[e,t]),f=z.useCallback((p,g)=>{e&&p.conversationId&&e.getConversationEvents(p,b=>{t==null||t.log("Retrieved conversation messages: ",b),g==null||g(b)})},[e,t]);return z.useEffect(()=>{if(r||!c)return;if(n.sinceHours===0||(n==null?void 0:n.limit)===0){u(!0);return}const p=3600*1e3*n.sinceHours,g=new Date(Date.now()-p).toISOString(),b={conversationId:c,since:g,excludeEvents:["done","error","connection_error","refined_browse","refined_search","conversation_reset"]};typeof n.limit=="number"&&(b.limit=n.limit),f(b,T=>{T.forEach(_=>{var C;const S=T.find(N=>N.id===_.eventSourceId);(C=S==null?void 0:S.name)!=null&&C.endsWith("_suggestions")||(_.bypassHandlers=!0,s(_))}),u(!0)})},[t,r,c,f,s,a,u,n]),{getSessionInformation:d,getConversationMessages:f}},t1=z.createContext({copilot:null,messages:[],groupedMessages:[],isLoading:!1,isResponseLoading:()=>!1,handleAskCim:()=>{},handleSearch:()=>{},handleBrowse:()=>{},handlePdp:()=>{},handleSuggestion:()=>{},handleUserInput:()=>{},handleCancel:()=>{},resetConversation:()=>{},getSessionInformation:()=>{},getConversationMessages:()=>{}}),lv=({apiKey:e,apiToken:t,baseUrl:n,isDevelopment:r,onConnect:s,onRefinedSearch:a,onRefinedBrowse:u,children:c})=>{const{logger:d}=ht(),vi=rv(),{searchQuery:f}=vi,p=sn(vi,["searchQuery"]),ki=ev(),{categoryId:g}=ki,b=sn(ki,["categoryId"]),{productId:T,pdpLink:_}=ov(),{setCopilot:S,setConnected:C,resetCopilot:N,resetCopilotState:D,addCopilotEvent:k,removeLoadingMessage:M,handleCopilotRequestAck:Y,setActiveConversationId:B,setConversationIds:te,setAskCimPrompts:ae}=ns(),{connected:ye,entryType:$,copilot:ne,messages:pe,groupedMessages:fe,loadingMessages:le,askCimPrompts:Te}=Gn(),{status:we}=Xr(),{isInline:ue}=Ei(),{getConversationMessages:G,getSessionInformation:re}=uv({copilot:ne}),A=z.useMemo(()=>le.size>0,[le]),L=z.useCallback(Ce=>le.has(Ce),[le]),Z=z.useCallback(({query:Ce,facetFilters:Fe,rangeFilters:Re,catalogSegment:Ke,pricebooks:st,userPrompt:ft,imageFile:yn})=>{if(!ne){d==null||d.error("Copilot is not initialized");return}if(!Ce)return;const kt={searchParams:{query:Ce}};ft&&(kt.userPrompt=ft),yn&&(kt.attachments={image:yn}),Fe&&Object.keys(Fe).length>0&&(kt.searchParams.facetFilters=Fe),Re&&Re.length>0&&(kt.searchParams.rangeFilters=Re),Ke&&(kt.searchParams.catalogSegment=Ke),st&&(kt.searchParams.pricebooks=st),ua("search"),ne.search(kt,dn=>{const Q=U({},dn);Y(Q)})},[d,Y,ne]),P=z.useCallback(({categoryId:Ce,categoryName:Fe,facetFilters:Re,rangeFilters:Ke,catalogSegment:st,pricebooks:ft,userPrompt:yn,imageFile:kt})=>{if(!ne){d==null||d.error("Copilot is not initialized");return}const dn=Re&&Object.keys(Re).length>0;if(Ce===""&&!dn){d==null||d.error("Browse event must include facetFilters when categoryId is empty");return}const Q={browseParams:{categoryId:Ce||""}};yn&&(Q.userPrompt=yn),kt&&(Q.attachments={image:kt}),dn&&(Q.browseParams.facetFilters=Re),Ke&&Ke.length>0&&(Q.browseParams.rangeFilters=Ke),st&&(Q.browseParams.catalogSegment=st),Array.isArray(ft)&&ft.length>0&&(Q.browseParams.pricebooks=ft),Fe&&(Q.clientContext={label:Fe}),ua("browse"),ne.browse(Q,he=>{var jt;const Oe=U({},he),$e=((jt=Oe.request)==null?void 0:jt.clientContext)||{},qe=($e==null?void 0:$e.label)||Fe;qe&&Oe.request&&(Oe.request.label=qe),Y(Oe)})},[d,Y,ne]),_e=z.useCallback(({productId:Ce,productName:Fe,pdpLink:Re,userPrompt:Ke,imageFile:st})=>{if(!ne){d==null||d.error("Copilot is not initialized");return}if(!Ce)return;const ft={productId:Ce};Ke&&(ft.userPrompt=Ke),Re&&(ft.pdpLink=Re),st&&(ft.attachments={image:st}),Fe&&(ft.clientContext={label:Fe}),ua("pdp"),ne.productView(ft,yn=>{var he;const kt=U({},yn),dn=((he=kt.request)==null?void 0:he.clientContext)||{},Q=(dn==null?void 0:dn.label)||Fe;Q&&kt.request&&(kt.request.label=Q),Y(kt)})},[d,ne,Y]),De=z.useCallback(({userPrompt:Ce,imageFile:Fe})=>{if(!ne){d==null||d.error("Copilot is not initialized");return}if(!Ce)return;const Re={userPrompt:Ce};Fe&&(Re.attachments={image:Fe}),ne.askCim(Re,Ke=>{const st=U({},Ke);Y(st)})},[d,ne,Y]),Ie=z.useCallback(Ce=>{k(Ce),a==null||a(Ce)},[k,a]),Xe=z.useCallback(Ce=>{k(Ce),u==null||u(Ce)},[k,u]),We=z.useCallback(Ce=>{s==null||s(Ce),C(!0)},[s,C]);z.useEffect(()=>{!ne||!ye||!we.isOpen||an.size>0&&an.processQueue(Ce=>{if(Ce.context==="search"){const Fe=U({},Ce.payload);Wg(Fe)}if(Ce.context==="browse"){const Fe=U({},Ce.payload);Ug(Fe)}if(Ce.context==="pdp"){const Fe=U({},Ce.payload);Hg(Fe)}})},[we.isOpen,ne,ye]);const nt=z.useCallback(Ce=>{const Fe=Re=>{const Ke=be(U({},Re),{id:Re.inquiryLinkId||Re.id});k(Ke)};Ce.on("connect_ack",We),Ce.on("partial_inquiry",Fe),Ce.on("display_products",k),Ce.on("progress",k),Ce.on("refined_search",Ie),Ce.on("refined_browse",Xe),Ce.on("done",Re=>{M(Re.eventSourceId)}),Ce.on("error",Re=>{k(Re),M(Re.eventSourceId)}),Ce.onDisconnect(Re=>{const Ke=["io server disconnect","transport error","server shutting down"];if(d==null||d.log("Connection disconnected with reason: ",Re),!Ke.includes(Re)){C(!1);return}d==null||d.log("De-registering event listeners");const st=new Date().toISOString();k({name:"error",message:"Connection was lost. Please try again.",createdAt:st,id:`error-${st}`,sessionId:"session"}),Ce.off()})},[d,C,M,Ie,Xe,k,We]);z.useEffect(()=>{if(!ne)return;const Ce=Fe=>{if(!ue){if(!Fe.message&&Fe.eventSourceId){Fe.eventSourceId===Te.requestId&&ae({requestId:Fe.eventSourceId,message:Fe});return}k(Fe)}};return ne.on("follow_up",Ce),()=>{ne.off("follow_up",Ce)}},[ne,Te.requestId,ue,k,ae]),z.useEffect(()=>{if(!ne)return;const Ce=Fe=>{if(ue)return;const Re=be(U({},Fe),{id:Fe.inquiryLinkId||Fe.id});k(Re)};return ne.on("inquiry",Ce),()=>{ne.off("inquiry",Ce)}},[ne,ue,k]),sl(()=>{let Ce;n?Ce=n:Ce=r?"https://staging.copilot.search.cimulate.ai":"https://prod.copilot.search.cimulate.ai";const Fe={baseUrl:Ce};e?Fe.apiKey=e:t&&(Fe.apiToken=t);const Re=new gw(Fe);return S(Re),nt(Re),Re.connect(),Re.requestSessionInformation(Ke=>{d==null||d.log("Session Information: ",Ke);const{activeConversationId:st,conversationIds:ft}=Ke.data||{};st&&B(st),ft!=null&&ft.length&&te(ft)}),()=>{Re.disconnect(),Re.off(),N()}});const vt=z.useCallback(Ce=>{if(!ne)return;const Fe={eventId:Ce,reason:"User cancelled the request"};ne.cancelRequest(Fe,Re=>{k(Re),M(Ce)})},[k,M,ne]),Zn=z.useCallback(()=>{ne&&ne.conversationReset({},Ce=>{D(),k(Ce),ne.requestSessionInformation(Fe=>{d==null||d.log("Session Information: ",Fe);const{activeConversationId:Re,conversationIds:Ke}=Fe.data||{};Re&&B(Re),Ke!=null&&Ke.length&&te(Ke)})})},[ne,d,k,D,B,te]),gs=z.useCallback((Ce,Fe)=>{if(!Ce)return;const Re={userPrompt:Ce};switch(Fe&&(Re.imageFile=Fe),$){case"ask_cim":De(Re);return;case"search":f?Z(U(U({query:f},p),Re)):De(Re);return;case"browse":P(U(U({categoryId:g},b),Re));return;case"pdp":T?_e(U({productId:T,pdpLink:_||""},Re)):De(Re);return}},[$,f,p,Z,De,g,b,P,_e,T,_]),ri=z.useCallback((Ce,Fe)=>{var yn,kt,dn;const Ke=Ce.params.userPrompt||"";if(!Ke)return;const st=pe.find(Q=>Q.id===Fe);if(!st)return;const ft=st.name.replace("_suggestions","");if(ft==="ask_cim"){De({userPrompt:Ke});return}if(ft==="copilot_search"){const Q=((yn=st.request)==null?void 0:yn.searchParams)||{},Oe=Q.query===f;Z(be(U({query:Q.query||f},Oe?p:{}),{userPrompt:Ke}));return}if(ft==="copilot_browse"){const Q=st.request,he=Q.browseParams||{},$e=he.categoryId===g,qe=((kt=Q.clientContext)==null?void 0:kt.label)||"";P(be(U({categoryId:he.categoryId||g||""},$e?b:{}),{categoryName:qe,userPrompt:Ke}));return}if(ft==="product_view"){const Q=st.request||{},he=Q.productId,Oe=he===T,$e=((dn=Q.clientContext)==null?void 0:dn.label)||"";let qe="";Oe?qe=_||"":qe=Q.pdpLink||"",_e({productId:he||T,pdpLink:qe,productName:$e,userPrompt:Ke})}},[pe,f,p,Z,De,g,b,P,_e,T,_]),Es=z.useMemo(()=>({copilot:ne,messages:pe,groupedMessages:fe,isLoading:A,isResponseLoading:L,handleAskCim:De,handleSearch:Z,handleBrowse:P,handlePdp:_e,handleUserInput:gs,handleSuggestion:ri,handleCancel:vt,resetConversation:Zn,getSessionInformation:re,getConversationMessages:G}),[ne,pe,fe,A,L,De,Z,P,_e,gs,ri,vt,Zn,re,G]);return w.jsx(t1.Provider,{value:Es,children:c})},n1=()=>{const{copilot:e}=Gn(),{addCopilotEvent:t}=ns();return{getCopilotSuggestions:z.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])}},cv=()=>{const{copilot:e,entryType:t,activeConversationId:n,askCimPrompts:r,conversationHistoryLoaded:s}=Gn(),{resetCopilotState:a,addCopilotEvent:u,setAskCimPrompts:c}=ns(),{handleSearch:d,handleBrowse:f,handlePdp:p,resetConversation:g,getSessionInformation:b,getConversationMessages:T}=dr(),{getCopilotSuggestions:_}=n1();z.useEffect(()=>{!e||!t||!n||!s||r.requestId||t==="ask_cim"&&_({},t,D=>{c({requestId:D.id,message:null})})},[e,n,r.requestId,t,s,_,c]);const S=z.useCallback(({query:D})=>{if(!e||!D)return;const{facetFilters:k}=Tt.facetFiltersProxy,{rangeFilters:M}=Tt.rangeFiltersProxy,{catalogSegment:Y}=Tt.catalogSegmentProxy,{pricebooks:B}=Tt.pricebooksProxy,te={query:D};te.facetFilters=k||{},te.rangeFilters=M||[],te.catalogSegment=Y||"",te.pricebooks=B||[],d(U({},te))},[e,d]),C=z.useCallback(({categoryId:D})=>{if(!e)return;const k=ut.categoryIdProxy.categoryName,{facetFilters:M}=ut.facetFiltersProxy,{rangeFilters:Y}=ut.rangeFiltersProxy,{catalogSegment:B}=ut.catalogSegmentProxy,{pricebooks:te}=ut.pricebooksProxy,ae={categoryId:D};ae.categoryName=k||"",ae.facetFilters=M||{},ae.rangeFilters=Y||[],ae.catalogSegment=B||"",ae.pricebooks=te||[],f(U({},ae))},[e,f]),N=z.useCallback(({productId:D})=>{if(!e||!D)return;const k={productId:D,pdpLink:cr.pdpLink,productName:cr.proxy.productName||""};p(k)},[e,p]);return z.useEffect(()=>{const D=({detail:k})=>{(k==null?void 0:k.property)==="query"&&S({query:k.value})};return xg(D),()=>{wg(D)}},[S]),z.useEffect(()=>{const D=({detail:k})=>{if((k==null?void 0:k.property)==="pdp-context"){const M=k.value;N({productId:M.productId});return}(k==null?void 0:k.property)==="productId"&&N({productId:k.value})};return vg(D),()=>{kg(D)}},[N]),z.useEffect(()=>{const D=({detail:k})=>{(k==null?void 0:k.property)==="categoryId"&&C({categoryId:k.value})};return Cg(D),()=>{Ag(D)}},[C]),z.useEffect(()=>{const D=({detail:k})=>{if((k==null?void 0:k.event)==mi.RESET_CONVERSATION&&g(),(k==null?void 0:k.event)==mi.GET_SESSION_INFORMATION){const M=k.value.callback;b(M)}if((k==null?void 0:k.event)==mi.GET_CONVERSATION_MESSAGES){const{payload:M,callback:Y}=k.value;if(!M.conversationId||typeof Y!="function")return;T(M,Y)}if((k==null?void 0:k.event)==mi.LOAD_CONVERSATION){const M=k.value;if(!M.conversationId)return;T(M,B=>{a(),B.forEach(te=>{u(te)})})}};return AA(D),()=>{vA(D)}},[g,b,T,a,u]),null},dv=({apiKey:e,apiToken:t,baseUrl:n,isDevelopment:r,onConnect:s,onRefinedSearch:a,onRefinedBrowse:u,children:c})=>w.jsxs(lv,{apiKey:e,apiToken:t,baseUrl:n,isDevelopment:r,onConnect:s,onRefinedSearch:a,onRefinedBrowse:u,children:[w.jsx(cv,{}),c]}),fv=({children:e,dispatch:t})=>{const n=z.useCallback(_=>{t({type:mt.SET_PROMPTS_EXTENSION_INITIALIZED,payload:_})},[t]),r=z.useCallback(_=>{t({type:mt.SET_PROMPTS_EXTENSION_OPEN,payload:_})},[t]),s=z.useCallback(_=>{t({type:mt.SET_PROMPTS_EXTENSION_INLINE,payload:_})},[t]),a=z.useCallback(_=>{t({type:mt.SET_PROMPTS_EXTENSION_ELEMENT_ID,payload:_})},[t]),u=z.useCallback(_=>{t({type:mt.SET_PROMPTS_EXTENSION_ENTRY_TYPE,payload:_})},[t]),c=z.useCallback(_=>{t({type:mt.SET_PROMPTS_EXTENSION_ACTIVE_PROMPTS_ID,payload:_})},[t]),d=z.useCallback(_=>{t({type:mt.SET_PROMPTS_EXTENSION_USER_PROMPT,payload:_})},[t]),f=z.useCallback(_=>{t({type:mt.SET_PROMPTS_EXTENSION_PARAMS,payload:_})},[t]),p=z.useCallback(_=>{t({type:mt.SET_PROMPTS_EXTENSION_PROMPTS_MESSAGE,payload:_})},[t]),g=z.useCallback(_=>{t({type:mt.SET_PROMPTS_EXTENSION_RESPONSE_MESSAGE,payload:_})},[t]),b=z.useCallback(_=>{t({type:mt.SET_PROMPTS_EXTENSION_RESPONSE_LOADING,payload:_})},[t]),T=z.useMemo(()=>({setIsInitialized:n,setIsOpen:r,setIsInline:s,setElementId:a,setEntryType:u,setActivePromptsId:c,setUserPrompt:d,setParams:f,setPromptsMessage:p,setResponseMessage:g,setIsResponseLoading:b}),[n,r,s,a,u,c,d,f,p,g,b]);return w.jsx(Zg.Provider,{value:T,children:e})},hv=(e,t)=>{const{type:n,payload:r}=t;switch(n){case mt.SET_PROMPTS_EXTENSION_INITIALIZED:e.isInitialized=r;break;case mt.SET_PROMPTS_EXTENSION_OPEN:e.isOpen=r;break;case mt.SET_PROMPTS_EXTENSION_INLINE:e.isInline=r;break;case mt.SET_PROMPTS_EXTENSION_ELEMENT_ID:e.elementId=r;break;case mt.SET_PROMPTS_EXTENSION_ENTRY_TYPE:e.entryType=r;break;case mt.SET_PROMPTS_EXTENSION_PARAMS:e.params=r;break;case mt.RESET_PROMPTS_EXTENSION_PARAMS:e.params=null;break;case mt.SET_PROMPTS_EXTENSION_USER_PROMPT:e.userPrompt=r;break;case mt.SET_PROMPTS_EXTENSION_ACTIVE_PROMPTS_ID:e.activePromptsId=r;break;case mt.RESET_PROMPTS_EXTENSION_ACTIVE_PROMPTS_ID:e.activePromptsId=null;break;case mt.SET_PROMPTS_EXTENSION_PROMPTS_MESSAGE:e.promptsMessage=r;break;case mt.RESET_PROMPTS_EXTENSION_PROMPTS_MESSAGE:e.promptsMessage=null;break;case mt.SET_PROMPTS_EXTENSION_RESPONSE_MESSAGE:e.responseMessage=r;break;case mt.RESET_PROMPTS_EXTENSION_RESPONSE_MESSAGE:e.responseMessage=null;break;case mt.SET_PROMPTS_EXTENSION_RESPONSE_LOADING:e.isResponseLoading=r;break}},pv=({promptsConfig:e,children:t})=>{const[n,r]=D0(hv,U(U({},zg),e||{}));return w.jsx(Jg.Provider,{value:n,children:w.jsx(fv,{dispatch:r,children:t})})},r1=({apiKey:e,apiToken:t,baseUrl:n,logoUrl:r,headerText:s,theme:a,openLinksInNewTab:u,globalClassName:c,isDevelopment:d=!1,componentType:f,componentConfig:p,entryType:g,entryMessage:b,disclaimerText:T,disclaimerMarkdown:_,searchPlaceholder:S,searchButtonLabel:C,searchConfig:N,promptsConfig:D,resetConversationMessage:k,conversationHistory:M,onConnect:Y,onCopilotEvent:B,onRefinedSearch:te,onRefinedBrowse:ae,__features:ye,children:$})=>w.jsx(dA,{baseUrl:n,apiKey:e,apiToken:t,logoUrl:r,headerText:s,entryMessage:b,theme:a,globalClassName:c,openLinksInNewTab:u,searchPlaceholder:S,searchButtonLabel:C,searchConfig:N,componentConfig:p,disclaimerMarkdown:_,disclaimerText:T,resetConversationMessage:k,conversationHistory:M,isDevelopment:d,__features:ye,children:w.jsx(TA,{entryType:g,onCopilotEvent:B,children:w.jsx(sv,{children:w.jsx(ZA,{children:w.jsx(nv,{children:w.jsx(av,{entryType:g,componentConfig:p,componentType:f,children:w.jsx(pv,{promptsConfig:D,children:w.jsx(dv,{apiKey:e,apiToken:t,baseUrl:n,isDevelopment:d,entryType:g,onConnect:Y,onRefinedSearch:te,onRefinedBrowse:ae,onCopilotEvent:B,children:$})})})})})})})});function i1(e){var t,n,r="";if(typeof e=="string"||typeof e=="number")r+=e;else if(typeof e=="object")if(Array.isArray(e)){var s=e.length;for(t=0;t<s;t++)e[t]&&(n=i1(e[t]))&&(r&&(r+=" "),r+=n)}else for(n in e)e[n]&&(r&&(r+=" "),r+=n);return r}function X(){for(var e,t,n=0,r="",s=arguments.length;n<s;n++)(e=arguments[n])&&(t=i1(e))&&(r&&(r+=" "),r+=t);return r}var s1={color:void 0,size:void 0,className:void 0,style:void 0,attr:void 0},o1=Xi.createContext&&Xi.createContext(s1),mv=["attr","size","title"];function gv(e,t){if(e==null)return{};var n=Ev(e,t),r,s;if(Object.getOwnPropertySymbols){var a=Object.getOwnPropertySymbols(e);for(s=0;s<a.length;s++)r=a[s],!(t.indexOf(r)>=0)&&Object.prototype.propertyIsEnumerable.call(e,r)&&(n[r]=e[r])}return n}function Ev(e,t){if(e==null)return{};var n={};for(var r in e)if(Object.prototype.hasOwnProperty.call(e,r)){if(t.indexOf(r)>=0)continue;n[r]=e[r]}return n}function al(){return al=Object.assign?Object.assign.bind():function(e){for(var t=1;t<arguments.length;t++){var n=arguments[t];for(var r in n)Object.prototype.hasOwnProperty.call(n,r)&&(e[r]=n[r])}return e},al.apply(this,arguments)}function a1(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(e);t&&(r=r.filter(function(s){return Object.getOwnPropertyDescriptor(e,s).enumerable})),n.push.apply(n,r)}return n}function ul(e){for(var t=1;t<arguments.length;t++){var n=arguments[t]!=null?arguments[t]:{};t%2?a1(Object(n),!0).forEach(function(r){yv(e,r,n[r])}):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(n)):a1(Object(n)).forEach(function(r){Object.defineProperty(e,r,Object.getOwnPropertyDescriptor(n,r))})}return e}function yv(e,t,n){return t=Tv(t),t in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}function Tv(e){var t=bv(e,"string");return typeof t=="symbol"?t:t+""}function bv(e,t){if(typeof e!="object"||!e)return e;var n=e[Symbol.toPrimitive];if(n!==void 0){var r=n.call(e,t);if(typeof r!="object")return r;throw new TypeError("@@toPrimitive must return a primitive value.")}return(t==="string"?String:Number)(e)}function u1(e){return e&&e.map((t,n)=>Xi.createElement(t.tag,ul({key:n},t.attr),u1(t.child)))}function Vt(e){return t=>Xi.createElement(_v,al({attr:ul({},e.attr)},t),u1(e.child))}function _v(e){var t=n=>{var{attr:r,size:s,title:a}=e,u=gv(e,mv),c=s||n.size||"1em",d;return n.className&&(d=n.className),e.className&&(d=(d?d+" ":"")+e.className),Xi.createElement("svg",al({stroke:"currentColor",fill:"currentColor",strokeWidth:"0"},n.attr,r,u,{className:d,style:ul(ul({color:e.color||n.color},n.style),e.style),height:c,width:c,xmlns:"http://www.w3.org/2000/svg"}),a&&Xi.createElement("title",null,a),e.children)};return o1!==void 0?Xi.createElement(o1.Consumer,null,n=>t(n)):t(s1)}function l1(e){return Vt({attr:{viewBox:"0 0 24 24"},child:[{tag:"path",attr:{fill:"none",d:"M0 0h24v24H0z"},child:[]},{tag:"path",attr:{d:"M12 2C6.48 2 2 6.48 2 12s4.48 10 10 10 10-4.48 10-10S17.52 2 12 2zm1 15h-2v-6h2v6zm0-8h-2V7h2v2z"},child:[]}]})(e)}function c1(e){return Vt({attr:{viewBox:"0 0 24 24"},child:[{tag:"path",attr:{fill:"none",d:"M0 0h24v24H0V0z"},child:[]},{tag:"path",attr:{d:"M6 19h12v2H6z"},child:[]}]})(e)}function $s(e){return Vt({attr:{viewBox:"0 0 24 24"},child:[{tag:"path",attr:{fill:"none",d:"M0 0h24v24H0z"},child:[]},{tag:"path",attr:{d:"M15.5 14h-.79l-.28-.27A6.471 6.471 0 0 0 16 9.5 6.5 6.5 0 1 0 9.5 16c1.61 0 3.09-.59 4.23-1.57l.27.28v.79l5 4.99L20.49 19l-4.99-5zm-6 0C7.01 14 5 11.99 5 9.5S7.01 5 9.5 5 14 7.01 14 9.5 11.99 14 9.5 14z"},child:[]}]})(e)}function Sv(e){return Vt({attr:{viewBox:"0 0 24 24"},child:[{tag:"path",attr:{fill:"none",d:"M0 0h24v24H0V0z"},child:[]},{tag:"path",attr:{d:"M11 15h2v2h-2zm0-8h2v6h-2zm.99-5C6.47 2 2 6.48 2 12s4.47 10 9.99 10C17.52 22 22 17.52 22 12S17.52 2 11.99 2zM12 20c-4.42 0-8-3.58-8-8s3.58-8 8-8 8 3.58 8 8-3.58 8-8 8z"},child:[]}]})(e)}function d1(e){return Vt({attr:{viewBox:"0 0 24 24"},child:[{tag:"path",attr:{fill:"none",d:"M0 0h24v24H0z"},child:[]},{tag:"path",attr:{d:"M20 2H4c-1.1 0-1.99.9-1.99 2L2 22l4-4h14c1.1 0 2-.9 2-2V4c0-1.1-.9-2-2-2zM6 9h12v2H6V9zm8 5H6v-2h8v2zm4-6H6V6h12v2z"},child:[]}]})(e)}function xv(e){return Vt({attr:{viewBox:"0 0 24 24"},child:[{tag:"path",attr:{fill:"none",d:"M0 0h24v24H0z"},child:[]},{tag:"path",attr:{d:"m12 8-6 6 1.41 1.41L12 10.83l4.59 4.58L18 14z"},child:[]}]})(e)}function wv(e){return Vt({attr:{viewBox:"0 0 24 24"},child:[{tag:"path",attr:{fill:"none",d:"M0 0h24v24H0z"},child:[]},{tag:"path",attr:{d:"M16.59 8.59 12 13.17 7.41 8.59 6 10l6 6 6-6z"},child:[]}]})(e)}function Cv(e){return Vt({attr:{viewBox:"0 0 24 24"},child:[{tag:"path",attr:{fill:"none",d:"M0 0h24v24H0z"},child:[]},{tag:"path",attr:{d:"M5 16h3v3h2v-5H5v2zm3-8H5v2h5V5H8v3zm6 11h2v-3h3v-2h-5v5zm2-11V5h-2v5h5V8h-3z"},child:[]}]})(e)}function Av(e){return Vt({attr:{viewBox:"0 0 24 24"},child:[{tag:"path",attr:{fill:"none",d:"M0 0h24v24H0z"},child:[]},{tag:"path",attr:{d:"M7 14H5v5h5v-2H7v-3zm-2-4h2V7h3V5H5v5zm12 7h-3v2h5v-5h-2v3zM14 5v2h3v3h2V5h-5z"},child:[]}]})(e)}function vv(e){return Vt({attr:{viewBox:"0 0 24 24"},child:[{tag:"path",attr:{fill:"none",d:"M0 0h24v24H0V0z"},child:[]},{tag:"path",attr:{d:"m14.12 4 1.83 2H20v12H4V6h4.05l1.83-2h4.24M15 2H9L7.17 4H4c-1.1 0-2 .9-2 2v12c0 1.1.9 2 2 2h16c1.1 0 2-.9 2-2V6c0-1.1-.9-2-2-2h-3.17L15 2zm-3 7c1.65 0 3 1.35 3 3s-1.35 3-3 3-3-1.35-3-3 1.35-3 3-3m0-2c-2.76 0-5 2.24-5 5s2.24 5 5 5 5-2.24 5-5-2.24-5-5-5z"},child:[]}]})(e)}const df=({className:e,label:t="Close",onClick:n,disabled:r=!1})=>w.jsx("button",{"aria-label":t,className:X(e,`${j}-close-button`),disabled:r,onClick:n,children:w.jsx("svg",{role:"img",xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 24 20",width:"16",height:"16",fill:"currentColor",children:w.jsx("path",{d:"M18.3 5.7a1 1 0 0 0-1.4-1.4L12 9.6 7.1 4.7a1 1 0 1 0-1.4 1.4l4.9 4.9-4.9 4.9a1 1 0 1 0 1.4 1.4l4.9-4.9 4.9 4.9a1 1 0 0 0 1.4-1.4l-4.9-4.9 4.9-4.9z"})})}),ll=({className:e,children:t,type:n,disabled:r=!1,onClick:s})=>w.jsx("button",{className:X(`${j}-button`,e,{disabled:r}),type:n||"button",disabled:r,onClick:s,children:t}),kr=({className:e,iconUrl:t,icon:n,type:r="button",ariaLabel:s,title:a,disabled:u=!1,onClick:c})=>!n&&!t?null:w.jsx("button",{className:X(e,`${j}-icon-button`),type:r,"aria-label":s,title:a,onClick:c,disabled:u,children:t?w.jsx("img",{className:X(`${j}-icon-image`),src:t,alt:s,loading:"lazy"}):n}),kv=({searchConfig:e,globalClassName:t})=>{const n=e.buttonIconUrl;return n?w.jsx("img",{className:X(`${j}-search-button-icon-image`,t),src:n,alt:"",loading:"lazy"}):w.jsx($s,{size:"16px"})},Nv=({className:e,searchConfig:t,globalClassName:n,componentType:r,isLoading:s})=>{if((t==null?void 0:t.buttonType)==="icon")return w.jsx(kr,{className:X(e,n,r,`${j}-search-button-icon`),type:"submit",disabled:s,ariaLabel:(t==null?void 0:t.buttonAriaLabel)||(t==null?void 0:t.buttonLabel)||"Search Copilot",icon:t!=null&&t.buttonIconUrl?null:w.jsx($s,{size:"16px"}),iconUrl:t==null?void 0:t.buttonIconUrl});const a=(t==null?void 0:t.buttonType)==="icon-text";return w.jsxs(ll,{className:X(e,n,r,`${j}-search-button`),type:"submit","aria-label":(t==null?void 0:t.buttonAriaLabel)||"",disabled:s,children:[a&&w.jsx(kv,{globalClassName:n,searchConfig:t}),(t==null?void 0:t.buttonLabel)||"Search"]})};function Ov(e){return Vt({attr:{viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round"},child:[{tag:"path",attr:{d:"M8 9h8"},child:[]},{tag:"path",attr:{d:"M8 13h6"},child:[]},{tag:"path",attr:{d:"M13 18l-5 3v-3h-2a3 3 0 0 1 -3 -3v-8a3 3 0 0 1 3 -3h12a3 3 0 0 1 3 3v6"},child:[]},{tag:"path",attr:{d:"M17 17v5"},child:[]},{tag:"path",attr:{d:"M21 17v5"},child:[]}]})(e)}const Pv=()=>{const{messages:e}=Gn(),{handleCancel:t}=dr();return{cancelRequest:z.useCallback(()=>{if(!(e!=null&&e.length))return null;const r=e[e.length-1],s=r.eventSourceId||r.id;t(s)},[t,e])}},Iv=({isLoading:e})=>{const{globalClassName:t,searchConfig:n}=ht(),{cancelRequest:r}=Pv();return n!=null&&n.enableCancelSearch?w.jsx(kr,{className:X(t,`${j}-cancel-button`),ariaLabel:"Cancel Copilot chat processing",title:"Cancel Copilot request",icon:w.jsx(Ov,{}),disabled:!e,onClick:r}):null};function mB(){}function gB(){}function f1(e){const t=[],n=String(e||"");let r=n.indexOf(","),s=0,a=!1;for(;!a;){r===-1&&(r=n.length,a=!0);const u=n.slice(s,r).trim();(u||!a)&&t.push(u),s=r+1,r=n.indexOf(",",s)}return t}function h1(e,t){const n={};return(e[e.length-1]===""?[...e,""]:e).join((n.padRight?" ":"")+","+(n.padLeft===!1?"":" ")).trim()}const Rv=/^[$_\p{ID_Start}][$_\u{200C}\u{200D}\p{ID_Continue}]*$/u,Lv=/^[$_\p{ID_Start}][-$_\u{200C}\u{200D}\p{ID_Continue}]*$/u,Dv={};function p1(e,t){return(Dv.jsx?Lv:Rv).test(e)}const Mv=/[ \t\n\f\r]/g;function Fv(e){return typeof e=="object"?e.type==="text"?m1(e.value):!1:m1(e)}function m1(e){return e.replace(Mv,"")===""}let ca=class{constructor(t,n,r){this.normal=n,this.property=t,r&&(this.space=r)}};ca.prototype.normal={},ca.prototype.property={},ca.prototype.space=void 0;function g1(e,t){const n={},r={};for(const s of e)Object.assign(n,s.property),Object.assign(r,s.normal);return new ca(n,r,t)}function da(e){return e.toLowerCase()}let wn=class{constructor(t,n){this.attribute=n,this.property=t}};wn.prototype.attribute="",wn.prototype.booleanish=!1,wn.prototype.boolean=!1,wn.prototype.commaOrSpaceSeparated=!1,wn.prototype.commaSeparated=!1,wn.prototype.defined=!1,wn.prototype.mustUseProperty=!1,wn.prototype.number=!1,wn.prototype.overloadedBoolean=!1,wn.prototype.property="",wn.prototype.spaceSeparated=!1,wn.prototype.space=void 0;let Bv=0;const Ye=rs(),Ht=rs(),ff=rs(),me=rs(),gt=rs(),Vs=rs(),Dn=rs();function rs(){return hd(2,++Bv)}const hf=Object.freeze(Object.defineProperty({__proto__:null,boolean:Ye,booleanish:Ht,commaOrSpaceSeparated:Dn,commaSeparated:Vs,number:me,overloadedBoolean:ff,spaceSeparated:gt},Symbol.toStringTag,{value:"Module"})),pf=Object.keys(hf);let mf=class extends wn{constructor(t,n,r,s){let a=-1;if(super(t,n),E1(this,"space",s),typeof r=="number")for(;++a<pf.length;){const u=pf[a];E1(this,pf[a],(r&hf[u])===hf[u])}}};mf.prototype.defined=!0;function E1(e,t,n){n&&(e[t]=n)}function qs(e){const t={},n={};for(const[r,s]of Object.entries(e.properties)){const a=new mf(r,e.transform(e.attributes||{},r),s,e.space);e.mustUseProperty&&e.mustUseProperty.includes(r)&&(a.mustUseProperty=!0),t[r]=a,n[da(r)]=r,n[da(a.attribute)]=r}return new ca(t,n,e.space)}const y1=qs({properties:{ariaActiveDescendant:null,ariaAtomic:Ht,ariaAutoComplete:null,ariaBusy:Ht,ariaChecked:Ht,ariaColCount:me,ariaColIndex:me,ariaColSpan:me,ariaControls:gt,ariaCurrent:null,ariaDescribedBy:gt,ariaDetails:null,ariaDisabled:Ht,ariaDropEffect:gt,ariaErrorMessage:null,ariaExpanded:Ht,ariaFlowTo:gt,ariaGrabbed:Ht,ariaHasPopup:null,ariaHidden:Ht,ariaInvalid:null,ariaKeyShortcuts:null,ariaLabel:null,ariaLabelledBy:gt,ariaLevel:me,ariaLive:null,ariaModal:Ht,ariaMultiLine:Ht,ariaMultiSelectable:Ht,ariaOrientation:null,ariaOwns:gt,ariaPlaceholder:null,ariaPosInSet:me,ariaPressed:Ht,ariaReadOnly:Ht,ariaRelevant:null,ariaRequired:Ht,ariaRoleDescription:gt,ariaRowCount:me,ariaRowIndex:me,ariaRowSpan:me,ariaSelected:Ht,ariaSetSize:me,ariaSort:null,ariaValueMax:me,ariaValueMin:me,ariaValueNow:me,ariaValueText:null,role:null},transform(e,t){return t==="role"?t:"aria-"+t.slice(4).toLowerCase()}});function T1(e,t){return t in e?e[t]:t}function b1(e,t){return T1(e,t.toLowerCase())}const Uv=qs({attributes:{acceptcharset:"accept-charset",classname:"class",htmlfor:"for",httpequiv:"http-equiv"},mustUseProperty:["checked","multiple","muted","selected"],properties:{abbr:null,accept:Vs,acceptCharset:gt,accessKey:gt,action:null,allow:null,allowFullScreen:Ye,allowPaymentRequest:Ye,allowUserMedia:Ye,alt:null,as:null,async:Ye,autoCapitalize:null,autoComplete:gt,autoFocus:Ye,autoPlay:Ye,blocking:gt,capture:null,charSet:null,checked:Ye,cite:null,className:gt,cols:me,colSpan:null,content:null,contentEditable:Ht,controls:Ye,controlsList:gt,coords:me|Vs,crossOrigin:null,data:null,dateTime:null,decoding:null,default:Ye,defer:Ye,dir:null,dirName:null,disabled:Ye,download:ff,draggable:Ht,encType:null,enterKeyHint:null,fetchPriority:null,form:null,formAction:null,formEncType:null,formMethod:null,formNoValidate:Ye,formTarget:null,headers:gt,height:me,hidden:ff,high:me,href:null,hrefLang:null,htmlFor:gt,httpEquiv:gt,id:null,imageSizes:null,imageSrcSet:null,inert:Ye,inputMode:null,integrity:null,is:null,isMap:Ye,itemId:null,itemProp:gt,itemRef:gt,itemScope:Ye,itemType:gt,kind:null,label:null,lang:null,language:null,list:null,loading:null,loop:Ye,low:me,manifest:null,max:null,maxLength:me,media:null,method:null,min:null,minLength:me,multiple:Ye,muted:Ye,name:null,nonce:null,noModule:Ye,noValidate:Ye,onAbort:null,onAfterPrint:null,onAuxClick:null,onBeforeMatch:null,onBeforePrint:null,onBeforeToggle:null,onBeforeUnload:null,onBlur:null,onCancel:null,onCanPlay:null,onCanPlayThrough:null,onChange:null,onClick:null,onClose:null,onContextLost:null,onContextMenu:null,onContextRestored:null,onCopy:null,onCueChange:null,onCut:null,onDblClick:null,onDrag:null,onDragEnd:null,onDragEnter:null,onDragExit:null,onDragLeave:null,onDragOver:null,onDragStart:null,onDrop:null,onDurationChange:null,onEmptied:null,onEnded:null,onError:null,onFocus:null,onFormData:null,onHashChange:null,onInput:null,onInvalid:null,onKeyDown:null,onKeyPress:null,onKeyUp:null,onLanguageChange:null,onLoad:null,onLoadedData:null,onLoadedMetadata:null,onLoadEnd:null,onLoadStart:null,onMessage:null,onMessageError:null,onMouseDown:null,onMouseEnter:null,onMouseLeave:null,onMouseMove:null,onMouseOut:null,onMouseOver:null,onMouseUp:null,onOffline:null,onOnline:null,onPageHide:null,onPageShow:null,onPaste:null,onPause:null,onPlay:null,onPlaying:null,onPopState:null,onProgress:null,onRateChange:null,onRejectionHandled:null,onReset:null,onResize:null,onScroll:null,onScrollEnd:null,onSecurityPolicyViolation:null,onSeeked:null,onSeeking:null,onSelect:null,onSlotChange:null,onStalled:null,onStorage:null,onSubmit:null,onSuspend:null,onTimeUpdate:null,onToggle:null,onUnhandledRejection:null,onUnload:null,onVolumeChange:null,onWaiting:null,onWheel:null,open:Ye,optimum:me,pattern:null,ping:gt,placeholder:null,playsInline:Ye,popover:null,popoverTarget:null,popoverTargetAction:null,poster:null,preload:null,readOnly:Ye,referrerPolicy:null,rel:gt,required:Ye,reversed:Ye,rows:me,rowSpan:me,sandbox:gt,scope:null,scoped:Ye,seamless:Ye,selected:Ye,shadowRootClonable:Ye,shadowRootDelegatesFocus:Ye,shadowRootMode:null,shape:null,size:me,sizes:null,slot:null,span:me,spellCheck:Ht,src:null,srcDoc:null,srcLang:null,srcSet:null,start:me,step:null,style:null,tabIndex:me,target:null,title:null,translate:null,type:null,typeMustMatch:Ye,useMap:null,value:Ht,width:me,wrap:null,writingSuggestions:null,align:null,aLink:null,archive:gt,axis:null,background:null,bgColor:null,border:me,borderColor:null,bottomMargin:me,cellPadding:null,cellSpacing:null,char:null,charOff:null,classId:null,clear:null,code:null,codeBase:null,codeType:null,color:null,compact:Ye,declare:Ye,event:null,face:null,frame:null,frameBorder:null,hSpace:me,leftMargin:me,link:null,longDesc:null,lowSrc:null,marginHeight:me,marginWidth:me,noResize:Ye,noHref:Ye,noShade:Ye,noWrap:Ye,object:null,profile:null,prompt:null,rev:null,rightMargin:me,rules:null,scheme:null,scrolling:Ht,standby:null,summary:null,text:null,topMargin:me,valueType:null,version:null,vAlign:null,vLink:null,vSpace:me,allowTransparency:null,autoCorrect:null,autoSave:null,disablePictureInPicture:Ye,disableRemotePlayback:Ye,prefix:null,property:null,results:me,security:null,unselectable:null},space:"html",transform:b1}),Hv=qs({attributes:{accentHeight:"accent-height",alignmentBaseline:"alignment-baseline",arabicForm:"arabic-form",baselineShift:"baseline-shift",capHeight:"cap-height",className:"class",clipPath:"clip-path",clipRule:"clip-rule",colorInterpolation:"color-interpolation",colorInterpolationFilters:"color-interpolation-filters",colorProfile:"color-profile",colorRendering:"color-rendering",crossOrigin:"crossorigin",dataType:"datatype",dominantBaseline:"dominant-baseline",enableBackground:"enable-background",fillOpacity:"fill-opacity",fillRule:"fill-rule",floodColor:"flood-color",floodOpacity:"flood-opacity",fontFamily:"font-family",fontSize:"font-size",fontSizeAdjust:"font-size-adjust",fontStretch:"font-stretch",fontStyle:"font-style",fontVariant:"font-variant",fontWeight:"font-weight",glyphName:"glyph-name",glyphOrientationHorizontal:"glyph-orientation-horizontal",glyphOrientationVertical:"glyph-orientation-vertical",hrefLang:"hreflang",horizAdvX:"horiz-adv-x",horizOriginX:"horiz-origin-x",horizOriginY:"horiz-origin-y",imageRendering:"image-rendering",letterSpacing:"letter-spacing",lightingColor:"lighting-color",markerEnd:"marker-end",markerMid:"marker-mid",markerStart:"marker-start",navDown:"nav-down",navDownLeft:"nav-down-left",navDownRight:"nav-down-right",navLeft:"nav-left",navNext:"nav-next",navPrev:"nav-prev",navRight:"nav-right",navUp:"nav-up",navUpLeft:"nav-up-left",navUpRight:"nav-up-right",onAbort:"onabort",onActivate:"onactivate",onAfterPrint:"onafterprint",onBeforePrint:"onbeforeprint",onBegin:"onbegin",onCancel:"oncancel",onCanPlay:"oncanplay",onCanPlayThrough:"oncanplaythrough",onChange:"onchange",onClick:"onclick",onClose:"onclose",onCopy:"oncopy",onCueChange:"oncuechange",onCut:"oncut",onDblClick:"ondblclick",onDrag:"ondrag",onDragEnd:"ondragend",onDragEnter:"ondragenter",onDragExit:"ondragexit",onDragLeave:"ondragleave",onDragOver:"ondragover",onDragStart:"ondragstart",onDrop:"ondrop",onDurationChange:"ondurationchange",onEmptied:"onemptied",onEnd:"onend",onEnded:"onended",onError:"onerror",onFocus:"onfocus",onFocusIn:"onfocusin",onFocusOut:"onfocusout",onHashChange:"onhashchange",onInput:"oninput",onInvalid:"oninvalid",onKeyDown:"onkeydown",onKeyPress:"onkeypress",onKeyUp:"onkeyup",onLoad:"onload",onLoadedData:"onloadeddata",onLoadedMetadata:"onloadedmetadata",onLoadStart:"onloadstart",onMessage:"onmessage",onMouseDown:"onmousedown",onMouseEnter:"onmouseenter",onMouseLeave:"onmouseleave",onMouseMove:"onmousemove",onMouseOut:"onmouseout",onMouseOver:"onmouseover",onMouseUp:"onmouseup",onMouseWheel:"onmousewheel",onOffline:"onoffline",onOnline:"ononline",onPageHide:"onpagehide",onPageShow:"onpageshow",onPaste:"onpaste",onPause:"onpause",onPlay:"onplay",onPlaying:"onplaying",onPopState:"onpopstate",onProgress:"onprogress",onRateChange:"onratechange",onRepeat:"onrepeat",onReset:"onreset",onResize:"onresize",onScroll:"onscroll",onSeeked:"onseeked",onSeeking:"onseeking",onSelect:"onselect",onShow:"onshow",onStalled:"onstalled",onStorage:"onstorage",onSubmit:"onsubmit",onSuspend:"onsuspend",onTimeUpdate:"ontimeupdate",onToggle:"ontoggle",onUnload:"onunload",onVolumeChange:"onvolumechange",onWaiting:"onwaiting",onZoom:"onzoom",overlinePosition:"overline-position",overlineThickness:"overline-thickness",paintOrder:"paint-order",panose1:"panose-1",pointerEvents:"pointer-events",referrerPolicy:"referrerpolicy",renderingIntent:"rendering-intent",shapeRendering:"shape-rendering",stopColor:"stop-color",stopOpacity:"stop-opacity",strikethroughPosition:"strikethrough-position",strikethroughThickness:"strikethrough-thickness",strokeDashArray:"stroke-dasharray",strokeDashOffset:"stroke-dashoffset",strokeLineCap:"stroke-linecap",strokeLineJoin:"stroke-linejoin",strokeMiterLimit:"stroke-miterlimit",strokeOpacity:"stroke-opacity",strokeWidth:"stroke-width",tabIndex:"tabindex",textAnchor:"text-anchor",textDecoration:"text-decoration",textRendering:"text-rendering",transformOrigin:"transform-origin",typeOf:"typeof",underlinePosition:"underline-position",underlineThickness:"underline-thickness",unicodeBidi:"unicode-bidi",unicodeRange:"unicode-range",unitsPerEm:"units-per-em",vAlphabetic:"v-alphabetic",vHanging:"v-hanging",vIdeographic:"v-ideographic",vMathematical:"v-mathematical",vectorEffect:"vector-effect",vertAdvY:"vert-adv-y",vertOriginX:"vert-origin-x",vertOriginY:"vert-origin-y",wordSpacing:"word-spacing",writingMode:"writing-mode",xHeight:"x-height",playbackOrder:"playbackorder",timelineBegin:"timelinebegin"},properties:{about:Dn,accentHeight:me,accumulate:null,additive:null,alignmentBaseline:null,alphabetic:me,amplitude:me,arabicForm:null,ascent:me,attributeName:null,attributeType:null,azimuth:me,bandwidth:null,baselineShift:null,baseFrequency:null,baseProfile:null,bbox:null,begin:null,bias:me,by:null,calcMode:null,capHeight:me,className:gt,clip:null,clipPath:null,clipPathUnits:null,clipRule:null,color:null,colorInterpolation:null,colorInterpolationFilters:null,colorProfile:null,colorRendering:null,content:null,contentScriptType:null,contentStyleType:null,crossOrigin:null,cursor:null,cx:null,cy:null,d:null,dataType:null,defaultAction:null,descent:me,diffuseConstant:me,direction:null,display:null,dur:null,divisor:me,dominantBaseline:null,download:Ye,dx:null,dy:null,edgeMode:null,editable:null,elevation:me,enableBackground:null,end:null,event:null,exponent:me,externalResourcesRequired:null,fill:null,fillOpacity:me,fillRule:null,filter:null,filterRes:null,filterUnits:null,floodColor:null,floodOpacity:null,focusable:null,focusHighlight:null,fontFamily:null,fontSize:null,fontSizeAdjust:null,fontStretch:null,fontStyle:null,fontVariant:null,fontWeight:null,format:null,fr:null,from:null,fx:null,fy:null,g1:Vs,g2:Vs,glyphName:Vs,glyphOrientationHorizontal:null,glyphOrientationVertical:null,glyphRef:null,gradientTransform:null,gradientUnits:null,handler:null,hanging:me,hatchContentUnits:null,hatchUnits:null,height:null,href:null,hrefLang:null,horizAdvX:me,horizOriginX:me,horizOriginY:me,id:null,ideographic:me,imageRendering:null,initialVisibility:null,in:null,in2:null,intercept:me,k:me,k1:me,k2:me,k3:me,k4:me,kernelMatrix:Dn,kernelUnitLength:null,keyPoints:null,keySplines:null,keyTimes:null,kerning:null,lang:null,lengthAdjust:null,letterSpacing:null,lightingColor:null,limitingConeAngle:me,local:null,markerEnd:null,markerMid:null,markerStart:null,markerHeight:null,markerUnits:null,markerWidth:null,mask:null,maskContentUnits:null,maskUnits:null,mathematical:null,max:null,media:null,mediaCharacterEncoding:null,mediaContentEncodings:null,mediaSize:me,mediaTime:null,method:null,min:null,mode:null,name:null,navDown:null,navDownLeft:null,navDownRight:null,navLeft:null,navNext:null,navPrev:null,navRight:null,navUp:null,navUpLeft:null,navUpRight:null,numOctaves:null,observer:null,offset:null,onAbort:null,onActivate:null,onAfterPrint:null,onBeforePrint:null,onBegin:null,onCancel:null,onCanPlay:null,onCanPlayThrough:null,onChange:null,onClick:null,onClose:null,onCopy:null,onCueChange:null,onCut:null,onDblClick:null,onDrag:null,onDragEnd:null,onDragEnter:null,onDragExit:null,onDragLeave:null,onDragOver:null,onDragStart:null,onDrop:null,onDurationChange:null,onEmptied:null,onEnd:null,onEnded:null,onError:null,onFocus:null,onFocusIn:null,onFocusOut:null,onHashChange:null,onInput:null,onInvalid:null,onKeyDown:null,onKeyPress:null,onKeyUp:null,onLoad:null,onLoadedData:null,onLoadedMetadata:null,onLoadStart:null,onMessage:null,onMouseDown:null,onMouseEnter:null,onMouseLeave:null,onMouseMove:null,onMouseOut:null,onMouseOver:null,onMouseUp:null,onMouseWheel:null,onOffline:null,onOnline:null,onPageHide:null,onPageShow:null,onPaste:null,onPause:null,onPlay:null,onPlaying:null,onPopState:null,onProgress:null,onRateChange:null,onRepeat:null,onReset:null,onResize:null,onScroll:null,onSeeked:null,onSeeking:null,onSelect:null,onShow:null,onStalled:null,onStorage:null,onSubmit:null,onSuspend:null,onTimeUpdate:null,onToggle:null,onUnload:null,onVolumeChange:null,onWaiting:null,onZoom:null,opacity:null,operator:null,order:null,orient:null,orientation:null,origin:null,overflow:null,overlay:null,overlinePosition:me,overlineThickness:me,paintOrder:null,panose1:null,path:null,pathLength:me,patternContentUnits:null,patternTransform:null,patternUnits:null,phase:null,ping:gt,pitch:null,playbackOrder:null,pointerEvents:null,points:null,pointsAtX:me,pointsAtY:me,pointsAtZ:me,preserveAlpha:null,preserveAspectRatio:null,primitiveUnits:null,propagate:null,property:Dn,r:null,radius:null,referrerPolicy:null,refX:null,refY:null,rel:Dn,rev:Dn,renderingIntent:null,repeatCount:null,repeatDur:null,requiredExtensions:Dn,requiredFeatures:Dn,requiredFonts:Dn,requiredFormats:Dn,resource:null,restart:null,result:null,rotate:null,rx:null,ry:null,scale:null,seed:null,shapeRendering:null,side:null,slope:null,snapshotTime:null,specularConstant:me,specularExponent:me,spreadMethod:null,spacing:null,startOffset:null,stdDeviation:null,stemh:null,stemv:null,stitchTiles:null,stopColor:null,stopOpacity:null,strikethroughPosition:me,strikethroughThickness:me,string:null,stroke:null,strokeDashArray:Dn,strokeDashOffset:null,strokeLineCap:null,strokeLineJoin:null,strokeMiterLimit:me,strokeOpacity:me,strokeWidth:null,style:null,surfaceScale:me,syncBehavior:null,syncBehaviorDefault:null,syncMaster:null,syncTolerance:null,syncToleranceDefault:null,systemLanguage:Dn,tabIndex:me,tableValues:null,target:null,targetX:me,targetY:me,textAnchor:null,textDecoration:null,textRendering:null,textLength:null,timelineBegin:null,title:null,transformBehavior:null,type:null,typeOf:Dn,to:null,transform:null,transformOrigin:null,u1:null,u2:null,underlinePosition:me,underlineThickness:me,unicode:null,unicodeBidi:null,unicodeRange:null,unitsPerEm:me,values:null,vAlphabetic:me,vMathematical:me,vectorEffect:null,vHanging:me,vIdeographic:me,version:null,vertAdvY:me,vertOriginX:me,vertOriginY:me,viewBox:null,viewTarget:null,visibility:null,width:null,widths:null,wordSpacing:null,writingMode:null,x:null,x1:null,x2:null,xChannelSelector:null,xHeight:me,y:null,y1:null,y2:null,yChannelSelector:null,z:null,zoomAndPan:null},space:"svg",transform:T1}),_1=qs({properties:{xLinkActuate:null,xLinkArcRole:null,xLinkHref:null,xLinkRole:null,xLinkShow:null,xLinkTitle:null,xLinkType:null},space:"xlink",transform(e,t){return"xlink:"+t.slice(5).toLowerCase()}}),S1=qs({attributes:{xmlnsxlink:"xmlns:xlink"},properties:{xmlnsXLink:null,xmlns:null},space:"xmlns",transform:b1}),x1=qs({properties:{xmlBase:null,xmlLang:null,xmlSpace:null},space:"xml",transform(e,t){return"xml:"+t.slice(3).toLowerCase()}}),zv={classId:"classID",dataType:"datatype",itemId:"itemID",strokeDashArray:"strokeDasharray",strokeDashOffset:"strokeDashoffset",strokeLineCap:"strokeLinecap",strokeLineJoin:"strokeLinejoin",strokeMiterLimit:"strokeMiterlimit",typeOf:"typeof",xLinkActuate:"xlinkActuate",xLinkArcRole:"xlinkArcrole",xLinkHref:"xlinkHref",xLinkRole:"xlinkRole",xLinkShow:"xlinkShow",xLinkTitle:"xlinkTitle",xLinkType:"xlinkType",xmlnsXLink:"xmlnsXlink"},jv=/[A-Z]/g,w1=/-[a-z]/g,$v=/^data[-\w.:]+$/i;function gf(e,t){const n=da(t);let r=t,s=wn;if(n in e.normal)return e.property[e.normal[n]];if(n.length>4&&n.slice(0,4)==="data"&&$v.test(t)){if(t.charAt(4)==="-"){const a=t.slice(5).replace(w1,qv);r="data"+a.charAt(0).toUpperCase()+a.slice(1)}else{const a=t.slice(4);if(!w1.test(a)){let u=a.replace(jv,Vv);u.charAt(0)!=="-"&&(u="-"+u),t="data"+u}}s=mf}return new s(r,t)}function Vv(e){return"-"+e.toLowerCase()}function qv(e){return e.charAt(1).toUpperCase()}const cl=g1([y1,Uv,_1,S1,x1],"html"),Ys=g1([y1,Hv,_1,S1,x1],"svg");function C1(e){const t=String(e||"").trim();return t?t.split(/[ \t\n\r\f]+/g):[]}function A1(e){return e.join(" ").trim()}var Ws={},Ef,v1;function Yv(){if(v1)return Ef;v1=1;var e=/\/\*[^*]*\*+([^/*][^*]*\*+)*\//g,t=/\n/g,n=/^\s*/,r=/^(\*?[-#/*\\\w]+(\[[0-9a-z_-]+\])?)\s*/,s=/^:\s*/,a=/^((?:'(?:\\'|.)*?'|"(?:\\"|.)*?"|\([^)]*?\)|[^};])+)/,u=/^[;\s]*/,c=/^\s+|\s+$/g,d=`
|
|
10
|
+
`+a)}}catch(u){}}throw r}})}_request(t,n){typeof t=="string"?(n=n||{},n.url=t):n=t||{},n=Zi(this.defaults,n);const{transitional:r,paramsSerializer:s,headers:a}=n;r!==void 0&&nl.assertOptions(r,{silentJSONParsing:Wn.transitional(Wn.boolean),forcedJSONParsing:Wn.transitional(Wn.boolean),clarifyTimeoutError:Wn.transitional(Wn.boolean),legacyInterceptorReqResOrdering:Wn.transitional(Wn.boolean)},!1),s!=null&&(K.isFunction(s)?n.paramsSerializer={serialize:s}:nl.assertOptions(s,{encode:Wn.function,serialize:Wn.function},!0)),n.allowAbsoluteUrls!==void 0||(this.defaults.allowAbsoluteUrls!==void 0?n.allowAbsoluteUrls=this.defaults.allowAbsoluteUrls:n.allowAbsoluteUrls=!0),nl.assertOptions(n,{baseUrl:Wn.spelling("baseURL"),withXsrfToken:Wn.spelling("withXSRFToken")},!0),n.method=(n.method||this.defaults.method||"get").toLowerCase();let u=a&&K.merge(a.common,a[n.method]);a&&K.forEach(["delete","get","head","post","put","patch","common"],_=>{delete a[_]}),n.headers=xn.concat(u,a);const c=[];let d=!0;this.interceptors.request.forEach(function(S){if(typeof S.runWhen=="function"&&S.runWhen(n)===!1)return;d=d&&S.synchronous;const C=n.transitional||Zd;C&&C.legacyInterceptorReqResOrdering?c.unshift(S.fulfilled,S.rejected):c.push(S.fulfilled,S.rejected)});const f=[];this.interceptors.response.forEach(function(S){f.push(S.fulfilled,S.rejected)});let p,g=0,b;if(!d){const _=[yg.bind(this),void 0];for(_.unshift(...c),_.push(...f),b=_.length,p=Promise.resolve(n);g<b;)p=p.then(_[g++],_[g++]);return p}b=c.length;let T=n;for(;g<b;){const _=c[g++],S=c[g++];try{T=_(T)}catch(C){S.call(this,C);break}}try{p=yg.call(this,T)}catch(_){return Promise.reject(_)}for(g=0,b=f.length;g<b;)p=p.then(f[g++],f[g++]);return p}getUri(t){t=Zi(this.defaults,t);const n=ag(t.baseURL,t.url,t.allowAbsoluteUrls);return Z0(n,t.params,t.paramsSerializer)}};K.forEach(["delete","get","head","options"],function(t){es.prototype[t]=function(n,r){return this.request(Zi(r||{},{method:t,url:n,data:(r||{}).data}))}}),K.forEach(["post","put","patch"],function(t){function n(r){return function(a,u,c){return this.request(Zi(c||{},{method:t,headers:r?{"Content-Type":"multipart/form-data"}:{},url:a,data:u}))}}es.prototype[t]=n(),es.prototype[t+"Form"]=n(!0)});let sA=class nx{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 oa(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 nx(function(s){t=s}),cancel:t}}};function oA(e){return function(n){return e.apply(null,n)}}function aA(e){return K.isObject(e)&&e.isAxiosError===!0}const af={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(af).forEach(([e,t])=>{af[t]=e});function _g(e){const t=new es(e),n=U0(es.prototype.request,t);return K.extend(n,es.prototype,t,{allOwnKeys:!0}),K.extend(n,t,null,{allOwnKeys:!0}),n.create=function(s){return _g(Zi(e,s))},n}const Lt=_g(ia);Lt.Axios=es,Lt.CanceledError=oa,Lt.CancelToken=sA,Lt.isCancel=rg,Lt.VERSION=Tg,Lt.toFormData=Qu,Lt.AxiosError=He,Lt.Cancel=Lt.CanceledError,Lt.all=function(t){return Promise.all(t)},Lt.spread=oA,Lt.isAxiosError=aA,Lt.mergeConfig=Zi,Lt.AxiosHeaders=xn,Lt.formToJSON=e=>tg(K.isHTMLForm(e)?new FormData(e):e),Lt.getAdapter=Eg.getAdapter,Lt.HttpStatusCode=af,Lt.default=Lt;const{Axios:X9,AxiosError:K9,CanceledError:Q9,isCancel:J9,CancelToken:Z9,VERSION:eB,all:tB,Cancel:nB,isAxiosError:rB,spread:iB,toFormData:sB,AxiosHeaders:oB,HttpStatusCode:aB,formToJSON:uB,getAdapter:lB,mergeConfig:cB}=Lt;class uA{constructor(t,n,r,s=!1){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",()=>Ze(this,null,function*(){try{const t=yield Lt.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}`),this.baseApiUrl=this._mapCopilotUrlToSearchUrl(t,s)}get apiUrl(){return`${this.baseApiUrl}/${this.CIMULATE_SEARCH_API_PATH}`}}class lA{constructor(t,n,r,s=!1){Se(this,"apiService");Se(this,"config",null);Se(this,"getConfig",()=>Ze(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 uA(t,n,r,s)}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 js=(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 cA{constructor(t=!1){Se(this,"isDevelopment");Se(this,"_log",(t,n,...r)=>{js(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 Sg=z.createContext(null),dA=({logoUrl:e,headerText:t="Your Search Assistant",globalClassName:n="",entryMessage:r,openLinksInNewTab:s=!1,disclaimerText:a,disclaimerMarkdown:u,searchPlaceholder:c,searchButtonLabel:d,searchConfig:f,componentConfig:p,conversationHistory:g,resetConversationMessage:b="",apiKey:T,apiToken:_,baseUrl:S,theme:C,isDevelopment:N,__features:D,children:k})=>{const M=z.useMemo(()=>new lA(S,T,_,N),[S,T,_,N]),Y=z.useMemo(()=>new cA(N),[N]);z.useEffect(()=>{M.config||M.getConfig()},[M]);const B=z.useMemo(()=>Iw(C),[C]),te=z.useMemo(()=>{const ye=(f==null?void 0:f.placeholder)||c,$=(f==null?void 0:f.buttonLabel)||d;let ne="icon";return f!=null&&f.buttonType?ne=f.buttonType:d&&(ne="text"),be(U({},f||{}),{placeholder:ye,buttonLabel:$,buttonType:ne})},[f,c,d]),ae=z.useMemo(()=>({configModule:M,logoUrl:e,headerText:t,entryMessage:r,globalClassName:n,openLinksInNewTab:s,disclaimerText:a,disclaimerMarkdown:u,themeVariables:B,logger:Y,searchConfig:te,enableMinimize:!!(p!=null&&p.enableMinimize),resetConversationMessage:b,conversationHistory:{sinceHours:typeof(g==null?void 0:g.sinceHours)=="number"?g.sinceHours:1,limit:g==null?void 0:g.limit},features:D}),[M,e,t,r,n,a,u,s,te,p,b,Y,B,g,D]);return w.jsx(Sg.Provider,{value:ae,children:k})},ht=()=>{const e=z.useContext(Sg);if(!e)throw new Error("useConfig must be used within a ConfigProvider");return e};class fA{constructor(){Se(this,"initialState",{connected:!1,mode:"embedded",entryType:"search",status:{type:"dialog",isOpen:!1,isMinimized:!1},dialog:{position:"bottom-left"},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 mA(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},{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},modal:{isFullscreen:this.modalProxy.isFullscreen}}}}const at=new fA,ts=()=>at.connected,aa=()=>at.isOpen,hA=e=>{window.addEventListener(Yd,e)},pA=e=>{window.removeEventListener(Yd,e)},mA=(e,t)=>{const n=new CustomEvent(Yd,{detail:{property:e,value:t}});window.dispatchEvent(n)},gA=e=>{at.connectedProxy.connected=e},ua=e=>{if(!["ask_cim","search","browse","pdp"].includes(e))throw new Error(`Invalid entryType: "${e}". Must be 'ask_cim', 'search', 'browse', or 'pdp'.`);at.entryTypeProxy.entryType=e},gi=e=>{const t=at.statusProxy.isOpen,n=typeof e=="boolean"?e:!t;at.statusProxy.isOpen=n,n&&(at.statusProxy.isMinimized=!1)},rl=e=>{const t=at.statusProxy.isMinimized,n=typeof e=="boolean"?e:!t;at.statusProxy.isMinimized=n,n&&(at.statusProxy.isOpen=!1)},uf=e=>{at.modalProxy.isFullscreen=e},il=e=>{if(!["chat","dialog","modal"].includes(e))throw new Error(`Invalid type: ${e}. Must be 'chat', 'dialog', or 'modal'.`);at.statusProxy.type=e,e==="dialog"||e==="chat"?at.modeProxy.mode="embedded":at.modeProxy.mode="standalone"},lf=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(", ")}.`);at.dialogProxy.position=e},EA=({onCopilotEvent:e,children:t,dispatch:n})=>{const{logger:r}=ht(),s=z.useCallback(M=>{n({type:dt.SET_COPILOT,payload:M})},[n]),a=z.useCallback(M=>{gA(M),n({type:dt.SET_CONNECTED,payload:M})},[n]),u=z.useCallback(M=>{n({type:dt.SET_ENTRY_TYPE,payload:M})},[n]),c=z.useCallback(()=>{n({type:dt.RESET_COPILOT,payload:{}})},[n]),d=z.useCallback(()=>{n({type:dt.RESET_STATE,payload:{}})},[n]),f=z.useCallback(M=>{r==null||r.log(`${M.name} event received`,M),n({type:dt.ADD_MESSAGE,payload:M}),M.bypassHandlers||e==null||e(M)},[e,r,n]),p=z.useCallback(M=>{n({type:dt.ADD_LOADING_MESSAGE,payload:M})},[n]),g=z.useCallback(M=>{n({type:dt.REMOVE_LOADING_MESSAGE,payload:M})},[n]),b=z.useCallback(M=>{f(M),p(M.id)},[f,p]),T=z.useCallback(M=>{n({type:dt.SET_ACTIVE_CONVERSATION_ID,payload:M})},[n]),_=z.useCallback(M=>{n({type:dt.ADD_CONVERSATION_ID,payload:M})},[n]),S=z.useCallback(M=>{n({type:dt.SET_CONVERSATION_IDS,payload:M})},[n]),C=z.useCallback(M=>{n({type:dt.SET_IMAGE_FILE,payload:M})},[n]),N=z.useCallback(M=>{n({type:dt.SET_ASK_CIM_PROMPTS,payload:M})},[n]),D=z.useCallback(M=>{n({type:dt.SET_CONVERSATION_HISTORY_LOADED,payload:M})},[n]),k=z.useMemo(()=>({setCopilot:s,setConnected:a,setEntryType:u,resetCopilot:c,resetCopilotState:d,addCopilotEvent:f,addLoadingMessage:p,removeLoadingMessage:g,handleCopilotRequestAck:b,setActiveConversationId:T,addConversationId:_,setConversationIds:S,setImageFile:C,setAskCimPrompts:N,setConversationHistoryLoaded:D}),[s,a,u,c,d,f,p,g,b,T,_,S,C,N,D]);return w.jsx(B0.Provider,{value:k,children:t})};vw();const yA=(e,t)=>{const{type:n,payload:r}=t;if(n===dt.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 dt.RESET_STATE:e.messages=pi.messages,e.groupedMessages=pi.groupedMessages,e.loadingMessages=pi.loadingMessages,e.imageFile=pi.imageFile,e.askCimPrompts=pi.askCimPrompts,e.conversationHistoryLoaded=pi.conversationHistoryLoaded;break;case dt.RESET_COPILOT:e.copilot=null;break;case dt.SET_COPILOT:e.copilot=r;break;case dt.SET_CONNECTED:e.connected=r;break;case dt.SET_ENTRY_TYPE:e.entryType=r;break;case dt.ADD_LOADING_MESSAGE:e.loadingMessages.add(r);break;case dt.REMOVE_LOADING_MESSAGE:e.loadingMessages.delete(r);break;case dt.SET_ACTIVE_CONVERSATION_ID:e.activeConversationId=r;break;case dt.ADD_CONVERSATION_ID:{const s=r;e.conversationIds.includes(s)||e.conversationIds.push(s)}break;case dt.SET_CONVERSATION_IDS:e.conversationIds=r;break;case dt.SET_IMAGE_FILE:e.imageFile=r;break;case dt.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 dt.SET_CONVERSATION_HISTORY_LOADED:e.conversationHistoryLoaded=r;break}},TA=({entryType:e,onCopilotEvent:t,children:n})=>{const r=e?be(U({},pi),{entryType:e}):pi,[s,a]=D0(yA,r);return w.jsx(F0.Provider,{value:s,children:w.jsx(EA,{onCopilotEvent:t,dispatch:a,children:n})})};function bA(){var e=z.useRef(!0);return e.current?(e.current=!1,!0):e.current}var sl=function(e){z.useEffect(e,[])},_A=function(e,t){return e===t};function SA(e,t){t===void 0&&(t=_A);var n=z.useRef(),r=z.useRef(e),s=bA();return!s&&!t(r.current,e)&&(n.current=r.current,r.current=e),n.current}class xA{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(an.size).fill(1).forEach(()=>{const r=an.first();r&&(t(r),an.remove())})})}get size(){return this.items.length}}const an=new xA,xg=e=>{window.addEventListener(qd,e)},wg=e=>{window.removeEventListener(qd,e)},wA=(e,t,n)=>{const r=new CustomEvent(qd,{detail:{event:e,property:t,value:n}});window.dispatchEvent(r)},Cg=e=>{window.addEventListener(Vd,e)},Ag=e=>{window.removeEventListener(Vd,e)},CA=(e,t,n)=>{const r=new CustomEvent(Vd,{detail:{event:e,property:t,value:n}});window.dispatchEvent(r)},vg=e=>{window.addEventListener($d,e)},kg=e=>{window.removeEventListener($d,e)},Ng=(e,t,n)=>{const r=new CustomEvent($d,{detail:{property:e,value:t,event:n}});window.dispatchEvent(r)},AA=e=>{window.addEventListener(Gd,e)},vA=e=>{window.removeEventListener(Gd,e)},ol=(e,t,n)=>{const r=new CustomEvent(Gd,{detail:{property:e,value:t,event:n}});window.dispatchEvent(r)};class kA{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=Ow[n];return CA(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 kA,Og=(e,t)=>{const n=t.updateFacetFiltersProxy(e);t.facetFiltersProxy.facetFilters=n.facetFilters},Pg=(e,t,n)=>{var u,c;const r=U({},((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},Ig=(e,t)=>{const n=t.updateRangeFiltersProxy(e);t.rangeFiltersProxy.rangeFilters=n.rangeFilters},Rg=({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},Lg=(e,t)=>{t.catalogSegmentProxy.catalogSegment=e},Dg=(e,t)=>{const n=t.updatePricebooksProxy(e);t.pricebooksProxy.pricebooks=n.pricebooks},NA=e=>{if(!ts()||!aa()){ts()&&an.clear(),an.add({context:"browse",payload:be(U({},ut.state),{categoryId:e})});return}ut.categoryIdProxy.categoryId=e},Mg=e=>{Og(e,ut)},OA=(e,t)=>{Pg(e,t,ut)},Fg=e=>{Ig(e,ut)},PA=({field:e,value:t})=>{Rg({field:e,value:t},ut)},IA=e=>{Lg(e,ut)},Bg=e=>{Dg(e,ut)},Ug=e=>{if(!e||!("categoryId"in e))throw new Error("Browse context must include a categoryId");const t=ts(),n=aa();if(!t||!n){t&&an.clear(),an.add({context:"browse",payload:U({},e)});return}"facetFilters"in e&&Mg(e.facetFilters||{}),"rangeFilters"in e&&Fg(e.rangeFilters||[]),"catalogSegment"in e&&(ut.catalogSegmentProxy.catalogSegment=e.catalogSegment||null),"pricebooks"in e&&Bg(e.pricebooks||[]),"categoryName"in e&&(ut.categoryIdProxy.categoryName=e.categoryName||""),ut.categoryIdProxy.categoryId=e.categoryId},RA=Object.freeze(Object.defineProperty({__proto__:null,setBrowseContext:Ug,updateBrowseCategoryId:NA,updateCatalogSegment:IA,updateFacetFilter:OA,updateFacetFilters:Mg,updatePricebooks:Bg,updateRangeFilter:PA,updateRangeFilters:Fg},Symbol.toStringTag,{value:"Module"}));class LA{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)=>(Ng(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 cr=new LA,Hg=e=>{if(!e||!e.productId)throw new Error("PDP context must include a productId");const t=ts(),n=aa();if(!t||!n){t&&an.clear(),an.add({context:"pdp",payload:U({},e)});return}cr.updateProxy(e),Ng("pdp-context",e)},DA=e=>{cr.proxy.productId=e,ts()||an.add({context:"pdp",payload:U({},cr.state)})},MA=e=>{cr.proxy.pdpLink=e},mt={SET_PROMPTS_EXTENSION_INITIALIZED:"SET_PROMPTS_EXTENSION_INITIALIZED",SET_PROMPTS_EXTENSION_OPEN:"SET_PROMPTS_EXTENSION_OPEN",SET_PROMPTS_EXTENSION_INLINE:"SET_PROMPTS_EXTENSION_INLINE",SET_PROMPTS_EXTENSION_ELEMENT_ID:"SET_PROMPTS_EXTENSION_ELEMENT_ID",SET_PROMPTS_EXTENSION_ENTRY_TYPE:"SET_PROMPTS_EXTENSION_ENTRY_TYPE",SET_PROMPTS_EXTENSION_PARAMS:"SET_PROMPTS_EXTENSION_PARAMS",RESET_PROMPTS_EXTENSION_PARAMS:"RESET_PROMPTS_EXTENSION_PARAMS",SET_PROMPTS_EXTENSION_ACTIVE_PROMPTS_ID:"SET_PROMPTS_EXTENSION_ACTIVE_PROMPTS_ID",RESET_PROMPTS_EXTENSION_ACTIVE_PROMPTS_ID:"RESET_PROMPTS_EXTENSION_ACTIVE_PROMPTS_ID",SET_PROMPTS_EXTENSION_USER_PROMPT:"SET_PROMPTS_EXTENSION_USER_PROMPT",SET_PROMPTS_EXTENSION_PROMPTS_MESSAGE:"SET_PROMPTS_EXTENSION_PROMPTS_MESSAGE",RESET_PROMPTS_EXTENSION_PROMPTS_MESSAGE:"RESET_PROMPTS_EXTENSION_PROMPTS_MESSAGE",SET_PROMPTS_EXTENSION_RESPONSE_MESSAGE:"SET_PROMPTS_EXTENSION_RESPONSE_MESSAGE",RESET_PROMPTS_EXTENSION_RESPONSE_MESSAGE:"RESET_PROMPTS_EXTENSION_RESPONSE_MESSAGE",SET_PROMPTS_EXTENSION_RESPONSE_LOADING:"SET_PROMPTS_EXTENSION_RESPONSE_LOADING"},zg={isInitialized:!1,isOpen:!1,isInline:!1,elementId:null,placeholder:null,entryType:null,params:null,activePromptsId:null,userPrompt:null,promptsMessage:null,isResponseLoading:!1,responseMessage:null};class FA{constructor(){Se(this,"initialState",zg);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 la(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(U({},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 Ut=new FA,BA=e=>{window.addEventListener(Wd,e)},UA=e=>{window.removeEventListener(Wd,e)},la=(e,t)=>{const n=new CustomEvent(Wd,{detail:{property:e,value:t}});window.dispatchEvent(n)},jg=e=>{const t=Ut.isOpen,n=typeof e=="boolean"?e:!t;Ut.promptsStateProxy.isOpen=n},$g=e=>{const t=Ut.isInline,n=typeof e=="boolean"?e:!t;Ut.promptsStateProxy.isInline=n},HA=e=>{Ut.promptsParamsProxy=Ut.updatePromptsParamsProxy(e),la("params",e),Ut.promptsStateProxy.entryType="ask_cim"},zA=e=>{Ut.promptsParamsProxy=Ut.updatePromptsParamsProxy(e),la("params",e),Ut.promptsStateProxy.entryType="search"},jA=e=>{Ut.promptsParamsProxy=Ut.updatePromptsParamsProxy(e),la("params",e),Ut.promptsStateProxy.entryType="browse"},$A=e=>{Ut.promptsParamsProxy=Ut.updatePromptsParamsProxy(e),la("params",e),Ut.promptsStateProxy.entryType="pdp"},VA=({elementId:e,entryType:t,params:n,isInline:r})=>{Ut.promptsStateProxy.elementId=e,t&&(Ut.promptsStateProxy.entryType=t),typeof r=="boolean"&&$g(r),n&&Ut.updatePromptsParamsProxy(n),Ut.isOpen||jg(!0)},qA=Object.freeze(Object.defineProperty({__proto__:null,getConversationMessages:({payload:e,callback:t})=>{ol("getConversationMessages",{payload:e,callback:t},mi.GET_CONVERSATION_MESSAGES)},getSessionInformation:e=>{ol("getSessionInformation",{callback:e},mi.GET_SESSION_INFORMATION)},loadConversation:e=>{ol("loadConversation",e,mi.LOAD_CONVERSATION)},resetConversation:()=>{ol("resetConversation",!0,mi.RESET_CONVERSATION)}},Symbol.toStringTag,{value:"Module"}));class YA{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=Pw[n];return wA(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 YA,WA=e=>{const t=aa(),n=ts();if(!n||!t){n&&an.clear(),an.add({context:"search",payload:be(U({},Tt.state),{query:e})});return}Tt.queryProxy.query=e},Vg=e=>{Og(e,Tt)},GA=(e,t)=>{Pg(e,t,Tt)},qg=e=>{Ig(e,Tt)},XA=({field:e,value:t})=>{Rg({field:e,value:t},Tt)},KA=e=>{Lg(e,Tt)},Yg=e=>{Dg(e,Tt)},Wg=e=>{if(!e||!e.query)throw new Error("Search context must include a query");const t=aa(),n=ts();if(!n||!t){n&&an.clear(),an.add({context:"search",payload:U({},e)});return}"facetFilters"in e&&Vg(e.facetFilters||{}),"rangeFilters"in e&&qg(e.rangeFilters||[]),"catalogSegment"in e&&(Tt.catalogSegmentProxy.catalogSegment=e.catalogSegment||null),"pricebooks"in e&&Yg(e.pricebooks||[]),Tt.queryProxy.query=e.query},QA=Object.freeze(Object.defineProperty({__proto__:null,setSearchContext:Wg,updateCatalogSegment:KA,updateFacetFilter:GA,updateFacetFilters:Vg,updatePricebooks:Yg,updateRangeFilter:XA,updateRangeFilters:qg,updateSearchQuery:WA},Symbol.toStringTag,{value:"Module"})),JA={categoryId:ut.categoryId,categoryName:ut.categoryIdProxy.categoryName||"",facetFilters:ut.facetFilters,rangeFilters:ut.rangeFilters,catalogSegment:ut.catalogSegment,pricebooks:ut.pricebooks},Gg=z.createContext(JA),ZA=({children:e})=>{const[t,n]=z.useState(ut.categoryId),[r,s]=z.useState(ut.categoryIdProxy.categoryName||""),[a,u]=z.useState(ut.facetFilters||{}),[c,d]=z.useState(ut.rangeFilters||[]),[f,p]=z.useState(ut.catalogSegment||null),[g,b]=z.useState(ut.pricebooks||null);z.useEffect(()=>{const _=({detail:S})=>{(S==null?void 0:S.property)==="categoryId"&&n(S.value),(S==null?void 0:S.property)==="categoryName"&&s(S.value),(S==null?void 0:S.property)==="facetFilters"&&u(S.value),(S==null?void 0:S.property)==="rangeFilters"&&d(S.value),(S==null?void 0:S.property)==="catalogSegment"&&p(S.value),(S==null?void 0:S.property)==="pricebooks"&&b(S.value)};return Cg(_),()=>{Ag(_)}},[]);const T=z.useMemo(()=>({categoryId:t,categoryName:r,facetFilters:a,rangeFilters:c,catalogSegment:f,pricebooks:g}),[t,r,a,c,f,g]);return w.jsx(Gg.Provider,{value:T,children:e})},ev=()=>{const e=z.useContext(Gg);if(!e)throw new Error("useBrowse must be used within a BrowseProvider");return e},tv={searchQuery:Tt.query,facetFilters:Tt.facetFilters,rangeFilters:Tt.rangeFilters,catalogSegment:Tt.catalogSegment,pricebooks:Tt.pricebooks},Xg=z.createContext(tv),nv=({children:e})=>{const[t,n]=z.useState(Tt.query),[r,s]=z.useState(Tt.facetFilters),[a,u]=z.useState(Tt.rangeFilters),[c,d]=z.useState(Tt.catalogSegment),[f,p]=z.useState(Tt.pricebooks);z.useEffect(()=>{const b=({detail:T})=>{(T==null?void 0:T.property)==="query"&&n(T.value),(T==null?void 0:T.property)==="facetFilters"&&s(T.value),(T==null?void 0:T.property)==="rangeFilters"&&u(T.value),(T==null?void 0:T.property)==="catalogSegment"&&d(T.value),(T==null?void 0:T.property)==="pricebooks"&&p(T.value)};return xg(b),()=>{wg(b)}},[]);const g=z.useMemo(()=>({searchQuery:t,facetFilters:r,rangeFilters:a,catalogSegment:c,pricebooks:f}),[t,r,a,c,f]);return w.jsx(Xg.Provider,{value:g,children:e})},rv=()=>{const e=z.useContext(Xg);if(!e)throw new Error("useSearch must be used within a SearchProvider");return e},iv={productId:cr.productId,pdpLink:cr.pdpLink},Kg=z.createContext(iv),sv=({children:e})=>{const[t,n]=z.useState(cr.productId),[r,s]=z.useState(cr.pdpLink);z.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 vg(u),()=>{kg(u)}},[]);const a=z.useMemo(()=>({productId:t,pdpLink:r}),[t,r]);return w.jsx(Kg.Provider,{value:a,children:e})},ov=()=>{const e=z.useContext(Kg);if(!e)throw new Error("usePdp must be used within a PdpProvider");return e},ns=()=>{const e=z.useContext(B0);if(!e)throw new Error("useCopilotDispatch must be used within a CopilotProvider");return e},Gn=()=>{const e=z.useContext(F0);if(!e)throw new Error("useCopilotState must be used within a CopilotProvider");return e},dr=()=>{const e=z.useContext(t1);if(!e)throw new Error("useCopilot must be used within a CopilotProvider");return e},cf=()=>{const{status:e}=Xr(),{entryType:t,messages:n}=Gn(),r=t==="ask_cim",s=!!(n&&n.length>0),a=!!e.isOpen;return r&&a||!r&&a&&s},Qg=z.createContext({mode:at.modeProxy.mode,status:at.statusProxy,dialogPosition:at.dialogProxy.position,isModalFullscreen:at.modalProxy.isFullscreen,previousComponentType:at.statusProxy.type}),av=({entryType:e,componentConfig:t,componentType:n,children:r})=>{const{setEntryType:s}=ns(),[a,u]=z.useState(at.modeProxy.mode),[c,d]=z.useState({type:n||at.statusProxy.type,isOpen:at.statusProxy.isOpen,isMinimized:at.statusProxy.isMinimized}),[f,p]=z.useState(at.dialogProxy.position),[g,b]=z.useState(at.modalProxy.isFullscreen),T=SA(c.type);z.useEffect(()=>{const S=C=>{const{property:N,value:D}=C.detail||{};if(!(!N||D===void 0)){if(N==="mode"){u(D);return}if(N==="entryType"){s(D);return}if(N==="isMinimized"){d(k=>be(U({},k),{isMinimized:D}));return}if(N==="isOpen"){d(k=>be(U({},k),{isOpen:D}));return}if(N==="type"){d(k=>be(U({},k),{type:D}));return}if(N==="position"){p(D);return}if(N==="isFullscreen"){b(D);return}}};return hA(S),()=>{pA(S)}},[s]),sl(()=>{e&&ua(e)}),sl(()=>{const S=n||(t==null?void 0:t.type);S&&il(S),t&&"isOpen"in t&&gi(!!t.isOpen),t&&"isMinimized"in t&&rl(!!t.isMinimized)}),sl(()=>{if(!(t!=null&&t.options))return;const{dialogPosition:S}=t.options;S&&lf(S),"isModalFullscreen"in t.options&&uf(!!t.options.isModalFullscreen)});const _=z.useMemo(()=>({mode:a,status:c,previousComponentType:T||"dialog",dialogPosition:f,isModalFullscreen:g}),[a,c,T,f,g]);return w.jsx(Qg.Provider,{value:_,children:r})},Xr=()=>{const e=z.useContext(Qg);if(!e)throw new Error("useUIState must be used within a UIStateProvider");return e},Jg=z.createContext(null),Zg=z.createContext(null),e1=()=>{const e=z.useContext(Zg);if(!e)throw new Error("usePromptsExtensionDispatch must be used within a PromptsExtensionProvider");return e},Ei=()=>{const e=z.useContext(Jg);if(!e)throw new Error("usePromptsExtensionState must be used within a PromptsExtensionProvider");return e},uv=({copilot:e})=>{const{logger:t,conversationHistory:n}=ht(),{isInline:r}=Ei(),{addCopilotEvent:s,setEntryType:a,setConversationHistoryLoaded:u}=ns(),{activeConversationId:c}=Gn(),d=z.useCallback(p=>{e&&e.requestSessionInformation(g=>{t==null||t.log("Retrieved session information: ",g),p==null||p(g)})},[e,t]),f=z.useCallback((p,g)=>{e&&p.conversationId&&e.getConversationEvents(p,b=>{t==null||t.log("Retrieved conversation messages: ",b),g==null||g(b)})},[e,t]);return z.useEffect(()=>{if(r||!c)return;if(n.sinceHours===0||(n==null?void 0:n.limit)===0){u(!0);return}const p=3600*1e3*n.sinceHours,g=new Date(Date.now()-p).toISOString(),b={conversationId:c,since:g,excludeEvents:["done","error","connection_error","refined_browse","refined_search","conversation_reset"]};typeof n.limit=="number"&&(b.limit=n.limit),f(b,T=>{T.forEach(_=>{var C;const S=T.find(N=>N.id===_.eventSourceId);(C=S==null?void 0:S.name)!=null&&C.endsWith("_suggestions")||(_.bypassHandlers=!0,s(_))}),u(!0)})},[t,r,c,f,s,a,u,n]),{getSessionInformation:d,getConversationMessages:f}},t1=z.createContext({copilot:null,messages:[],groupedMessages:[],isLoading:!1,isResponseLoading:()=>!1,handleAskCim:()=>{},handleSearch:()=>{},handleBrowse:()=>{},handlePdp:()=>{},handleSuggestion:()=>{},handleUserInput:()=>{},handleCancel:()=>{},resetConversation:()=>{},getSessionInformation:()=>{},getConversationMessages:()=>{}}),lv=({apiKey:e,apiToken:t,baseUrl:n,isDevelopment:r,onConnect:s,onRefinedSearch:a,onRefinedBrowse:u,children:c})=>{const{logger:d}=ht(),vi=rv(),{searchQuery:f}=vi,p=sn(vi,["searchQuery"]),ki=ev(),{categoryId:g}=ki,b=sn(ki,["categoryId"]),{productId:T,pdpLink:_}=ov(),{setCopilot:S,setConnected:C,resetCopilot:N,resetCopilotState:D,addCopilotEvent:k,removeLoadingMessage:M,handleCopilotRequestAck:Y,setActiveConversationId:B,setConversationIds:te,setAskCimPrompts:ae}=ns(),{connected:ye,entryType:$,copilot:ne,messages:pe,groupedMessages:fe,loadingMessages:le,askCimPrompts:Te}=Gn(),{status:we}=Xr(),{isInline:ue}=Ei(),{getConversationMessages:G,getSessionInformation:re}=uv({copilot:ne}),A=z.useMemo(()=>le.size>0,[le]),L=z.useCallback(Ce=>le.has(Ce),[le]),Z=z.useCallback(({query:Ce,facetFilters:Fe,rangeFilters:Re,catalogSegment:Ke,pricebooks:st,userPrompt:ft,imageFile:yn})=>{if(!ne){d==null||d.error("Copilot is not initialized");return}if(!Ce)return;const kt={searchParams:{query:Ce}};ft&&(kt.userPrompt=ft),yn&&(kt.attachments={image:yn}),Fe&&Object.keys(Fe).length>0&&(kt.searchParams.facetFilters=Fe),Re&&Re.length>0&&(kt.searchParams.rangeFilters=Re),Ke&&(kt.searchParams.catalogSegment=Ke),st&&(kt.searchParams.pricebooks=st),ua("search"),ne.search(kt,dn=>{const Q=U({},dn);Y(Q)})},[d,Y,ne]),P=z.useCallback(({categoryId:Ce,categoryName:Fe,facetFilters:Re,rangeFilters:Ke,catalogSegment:st,pricebooks:ft,userPrompt:yn,imageFile:kt})=>{if(!ne){d==null||d.error("Copilot is not initialized");return}const dn=Re&&Object.keys(Re).length>0;if(Ce===""&&!dn){d==null||d.error("Browse event must include facetFilters when categoryId is empty");return}const Q={browseParams:{categoryId:Ce||""}};yn&&(Q.userPrompt=yn),kt&&(Q.attachments={image:kt}),dn&&(Q.browseParams.facetFilters=Re),Ke&&Ke.length>0&&(Q.browseParams.rangeFilters=Ke),st&&(Q.browseParams.catalogSegment=st),Array.isArray(ft)&&ft.length>0&&(Q.browseParams.pricebooks=ft),Fe&&(Q.clientContext={label:Fe}),ua("browse"),ne.browse(Q,he=>{var jt;const Oe=U({},he),$e=((jt=Oe.request)==null?void 0:jt.clientContext)||{},qe=($e==null?void 0:$e.label)||Fe;qe&&Oe.request&&(Oe.request.label=qe),Y(Oe)})},[d,Y,ne]),_e=z.useCallback(({productId:Ce,productName:Fe,pdpLink:Re,userPrompt:Ke,imageFile:st})=>{if(!ne){d==null||d.error("Copilot is not initialized");return}if(!Ce)return;const ft={productId:Ce};Ke&&(ft.userPrompt=Ke),Re&&(ft.pdpLink=Re),st&&(ft.attachments={image:st}),Fe&&(ft.clientContext={label:Fe}),ua("pdp"),ne.productView(ft,yn=>{var he;const kt=U({},yn),dn=((he=kt.request)==null?void 0:he.clientContext)||{},Q=(dn==null?void 0:dn.label)||Fe;Q&&kt.request&&(kt.request.label=Q),Y(kt)})},[d,ne,Y]),De=z.useCallback(({userPrompt:Ce,imageFile:Fe})=>{if(!ne){d==null||d.error("Copilot is not initialized");return}if(!Ce)return;const Re={userPrompt:Ce};Fe&&(Re.attachments={image:Fe}),ne.askCim(Re,Ke=>{const st=U({},Ke);Y(st)})},[d,ne,Y]),Ie=z.useCallback(Ce=>{k(Ce),a==null||a(Ce)},[k,a]),Xe=z.useCallback(Ce=>{k(Ce),u==null||u(Ce)},[k,u]),We=z.useCallback(Ce=>{s==null||s(Ce),C(!0)},[s,C]);z.useEffect(()=>{!ne||!ye||!we.isOpen||an.size>0&&an.processQueue(Ce=>{if(Ce.context==="search"){const Fe=U({},Ce.payload);Wg(Fe)}if(Ce.context==="browse"){const Fe=U({},Ce.payload);Ug(Fe)}if(Ce.context==="pdp"){const Fe=U({},Ce.payload);Hg(Fe)}})},[we.isOpen,ne,ye]);const nt=z.useCallback(Ce=>{const Fe=Re=>{const Ke=be(U({},Re),{id:Re.inquiryLinkId||Re.id});k(Ke)};Ce.on("connect_ack",We),Ce.on("partial_inquiry",Fe),Ce.on("display_products",k),Ce.on("progress",k),Ce.on("refined_search",Ie),Ce.on("refined_browse",Xe),Ce.on("done",Re=>{M(Re.eventSourceId)}),Ce.on("error",Re=>{k(Re),M(Re.eventSourceId)}),Ce.onDisconnect(Re=>{const Ke=["io server disconnect","transport error","server shutting down"];if(d==null||d.log("Connection disconnected with reason: ",Re),!Ke.includes(Re)){C(!1);return}d==null||d.log("De-registering event listeners");const st=new Date().toISOString();k({name:"error",message:"Connection was lost. Please try again.",createdAt:st,id:`error-${st}`,sessionId:"session"}),Ce.off()})},[d,C,M,Ie,Xe,k,We]);z.useEffect(()=>{if(!ne)return;const Ce=Fe=>{ue||(!Fe.message&&Fe.eventSourceId&&Fe.eventSourceId===Te.requestId&&ae({requestId:Fe.eventSourceId,message:Fe}),k(Fe))};return ne.on("follow_up",Ce),()=>{ne.off("follow_up",Ce)}},[ne,Te.requestId,ue,k,ae]),z.useEffect(()=>{if(!ne)return;const Ce=Fe=>{if(ue)return;const Re=be(U({},Fe),{id:Fe.inquiryLinkId||Fe.id});k(Re)};return ne.on("inquiry",Ce),()=>{ne.off("inquiry",Ce)}},[ne,ue,k]),sl(()=>{let Ce;n?Ce=n:Ce=r?"https://staging.copilot.search.cimulate.ai":"https://prod.copilot.search.cimulate.ai";const Fe={baseUrl:Ce};e?Fe.apiKey=e:t&&(Fe.apiToken=t);const Re=new gw(Fe);return S(Re),nt(Re),Re.connect(),Re.requestSessionInformation(Ke=>{d==null||d.log("Session Information: ",Ke);const{activeConversationId:st,conversationIds:ft}=Ke.data||{};st&&B(st),ft!=null&&ft.length&&te(ft)}),()=>{Re.disconnect(),Re.off(),N()}});const vt=z.useCallback(Ce=>{if(!ne)return;const Fe={eventId:Ce,reason:"User cancelled the request"};ne.cancelRequest(Fe,Re=>{k(Re),M(Ce)})},[k,M,ne]),Zn=z.useCallback(()=>{ne&&ne.conversationReset({},Ce=>{D(),k(Ce),ne.requestSessionInformation(Fe=>{d==null||d.log("Session Information: ",Fe);const{activeConversationId:Re,conversationIds:Ke}=Fe.data||{};Re&&B(Re),Ke!=null&&Ke.length&&te(Ke)})})},[ne,d,k,D,B,te]),gs=z.useCallback((Ce,Fe)=>{if(!Ce)return;const Re={userPrompt:Ce};switch(Fe&&(Re.imageFile=Fe),$){case"ask_cim":De(Re);return;case"search":f?Z(U(U({query:f},p),Re)):De(Re);return;case"browse":P(U(U({categoryId:g},b),Re));return;case"pdp":T?_e(U({productId:T,pdpLink:_||""},Re)):De(Re);return}},[$,f,p,Z,De,g,b,P,_e,T,_]),ri=z.useCallback((Ce,Fe)=>{var yn,kt,dn;const Ke=Ce.params.userPrompt||"";if(!Ke)return;const st=pe.find(Q=>Q.id===Fe);if(!st)return;const ft=st.name.replace("_suggestions","");if(ft==="ask_cim"){De({userPrompt:Ke});return}if(ft==="copilot_search"){const Q=((yn=st.request)==null?void 0:yn.searchParams)||{},Oe=Q.query===f;Z(be(U({query:Q.query||f},Oe?p:{}),{userPrompt:Ke}));return}if(ft==="copilot_browse"){const Q=st.request,he=Q.browseParams||{},$e=he.categoryId===g,qe=((kt=Q.clientContext)==null?void 0:kt.label)||"";P(be(U({categoryId:he.categoryId||g||""},$e?b:{}),{categoryName:qe,userPrompt:Ke}));return}if(ft==="product_view"){const Q=st.request||{},he=Q.productId,Oe=he===T,$e=((dn=Q.clientContext)==null?void 0:dn.label)||"";let qe="";Oe?qe=_||"":qe=Q.pdpLink||"",_e({productId:he||T,pdpLink:qe,productName:$e,userPrompt:Ke})}},[pe,f,p,Z,De,g,b,P,_e,T,_]),Es=z.useMemo(()=>({copilot:ne,messages:pe,groupedMessages:fe,isLoading:A,isResponseLoading:L,handleAskCim:De,handleSearch:Z,handleBrowse:P,handlePdp:_e,handleUserInput:gs,handleSuggestion:ri,handleCancel:vt,resetConversation:Zn,getSessionInformation:re,getConversationMessages:G}),[ne,pe,fe,A,L,De,Z,P,_e,gs,ri,vt,Zn,re,G]);return w.jsx(t1.Provider,{value:Es,children:c})},n1=()=>{const{copilot:e}=Gn(),{addCopilotEvent:t}=ns();return{getCopilotSuggestions:z.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])}},cv=()=>{const{copilot:e,entryType:t,activeConversationId:n,askCimPrompts:r,conversationHistoryLoaded:s}=Gn(),{resetCopilotState:a,addCopilotEvent:u,setAskCimPrompts:c}=ns(),{handleSearch:d,handleBrowse:f,handlePdp:p,resetConversation:g,getSessionInformation:b,getConversationMessages:T}=dr(),{getCopilotSuggestions:_}=n1();z.useEffect(()=>{!e||!t||!n||!s||r.requestId||t==="ask_cim"&&_({},t,D=>{c({requestId:D.id,message:null})})},[e,n,r.requestId,t,s,_,c]);const S=z.useCallback(({query:D})=>{if(!e||!D)return;const{facetFilters:k}=Tt.facetFiltersProxy,{rangeFilters:M}=Tt.rangeFiltersProxy,{catalogSegment:Y}=Tt.catalogSegmentProxy,{pricebooks:B}=Tt.pricebooksProxy,te={query:D};te.facetFilters=k||{},te.rangeFilters=M||[],te.catalogSegment=Y||"",te.pricebooks=B||[],d(U({},te))},[e,d]),C=z.useCallback(({categoryId:D})=>{if(!e)return;const k=ut.categoryIdProxy.categoryName,{facetFilters:M}=ut.facetFiltersProxy,{rangeFilters:Y}=ut.rangeFiltersProxy,{catalogSegment:B}=ut.catalogSegmentProxy,{pricebooks:te}=ut.pricebooksProxy,ae={categoryId:D};ae.categoryName=k||"",ae.facetFilters=M||{},ae.rangeFilters=Y||[],ae.catalogSegment=B||"",ae.pricebooks=te||[],f(U({},ae))},[e,f]),N=z.useCallback(({productId:D})=>{if(!e||!D)return;const k={productId:D,pdpLink:cr.pdpLink,productName:cr.proxy.productName||""};p(k)},[e,p]);return z.useEffect(()=>{const D=({detail:k})=>{(k==null?void 0:k.property)==="query"&&S({query:k.value})};return xg(D),()=>{wg(D)}},[S]),z.useEffect(()=>{const D=({detail:k})=>{if((k==null?void 0:k.property)==="pdp-context"){const M=k.value;N({productId:M.productId});return}(k==null?void 0:k.property)==="productId"&&N({productId:k.value})};return vg(D),()=>{kg(D)}},[N]),z.useEffect(()=>{const D=({detail:k})=>{(k==null?void 0:k.property)==="categoryId"&&C({categoryId:k.value})};return Cg(D),()=>{Ag(D)}},[C]),z.useEffect(()=>{const D=({detail:k})=>{if((k==null?void 0:k.event)==mi.RESET_CONVERSATION&&g(),(k==null?void 0:k.event)==mi.GET_SESSION_INFORMATION){const M=k.value.callback;b(M)}if((k==null?void 0:k.event)==mi.GET_CONVERSATION_MESSAGES){const{payload:M,callback:Y}=k.value;if(!M.conversationId||typeof Y!="function")return;T(M,Y)}if((k==null?void 0:k.event)==mi.LOAD_CONVERSATION){const M=k.value;if(!M.conversationId)return;T(M,B=>{a(),B.forEach(te=>{u(te)})})}};return AA(D),()=>{vA(D)}},[g,b,T,a,u]),null},dv=({apiKey:e,apiToken:t,baseUrl:n,isDevelopment:r,onConnect:s,onRefinedSearch:a,onRefinedBrowse:u,children:c})=>w.jsxs(lv,{apiKey:e,apiToken:t,baseUrl:n,isDevelopment:r,onConnect:s,onRefinedSearch:a,onRefinedBrowse:u,children:[w.jsx(cv,{}),c]}),fv=({children:e,dispatch:t})=>{const n=z.useCallback(_=>{t({type:mt.SET_PROMPTS_EXTENSION_INITIALIZED,payload:_})},[t]),r=z.useCallback(_=>{t({type:mt.SET_PROMPTS_EXTENSION_OPEN,payload:_})},[t]),s=z.useCallback(_=>{t({type:mt.SET_PROMPTS_EXTENSION_INLINE,payload:_})},[t]),a=z.useCallback(_=>{t({type:mt.SET_PROMPTS_EXTENSION_ELEMENT_ID,payload:_})},[t]),u=z.useCallback(_=>{t({type:mt.SET_PROMPTS_EXTENSION_ENTRY_TYPE,payload:_})},[t]),c=z.useCallback(_=>{t({type:mt.SET_PROMPTS_EXTENSION_ACTIVE_PROMPTS_ID,payload:_})},[t]),d=z.useCallback(_=>{t({type:mt.SET_PROMPTS_EXTENSION_USER_PROMPT,payload:_})},[t]),f=z.useCallback(_=>{t({type:mt.SET_PROMPTS_EXTENSION_PARAMS,payload:_})},[t]),p=z.useCallback(_=>{t({type:mt.SET_PROMPTS_EXTENSION_PROMPTS_MESSAGE,payload:_})},[t]),g=z.useCallback(_=>{t({type:mt.SET_PROMPTS_EXTENSION_RESPONSE_MESSAGE,payload:_})},[t]),b=z.useCallback(_=>{t({type:mt.SET_PROMPTS_EXTENSION_RESPONSE_LOADING,payload:_})},[t]),T=z.useMemo(()=>({setIsInitialized:n,setIsOpen:r,setIsInline:s,setElementId:a,setEntryType:u,setActivePromptsId:c,setUserPrompt:d,setParams:f,setPromptsMessage:p,setResponseMessage:g,setIsResponseLoading:b}),[n,r,s,a,u,c,d,f,p,g,b]);return w.jsx(Zg.Provider,{value:T,children:e})},hv=(e,t)=>{const{type:n,payload:r}=t;switch(n){case mt.SET_PROMPTS_EXTENSION_INITIALIZED:e.isInitialized=r;break;case mt.SET_PROMPTS_EXTENSION_OPEN:e.isOpen=r;break;case mt.SET_PROMPTS_EXTENSION_INLINE:e.isInline=r;break;case mt.SET_PROMPTS_EXTENSION_ELEMENT_ID:e.elementId=r;break;case mt.SET_PROMPTS_EXTENSION_ENTRY_TYPE:e.entryType=r;break;case mt.SET_PROMPTS_EXTENSION_PARAMS:e.params=r;break;case mt.RESET_PROMPTS_EXTENSION_PARAMS:e.params=null;break;case mt.SET_PROMPTS_EXTENSION_USER_PROMPT:e.userPrompt=r;break;case mt.SET_PROMPTS_EXTENSION_ACTIVE_PROMPTS_ID:e.activePromptsId=r;break;case mt.RESET_PROMPTS_EXTENSION_ACTIVE_PROMPTS_ID:e.activePromptsId=null;break;case mt.SET_PROMPTS_EXTENSION_PROMPTS_MESSAGE:e.promptsMessage=r;break;case mt.RESET_PROMPTS_EXTENSION_PROMPTS_MESSAGE:e.promptsMessage=null;break;case mt.SET_PROMPTS_EXTENSION_RESPONSE_MESSAGE:e.responseMessage=r;break;case mt.RESET_PROMPTS_EXTENSION_RESPONSE_MESSAGE:e.responseMessage=null;break;case mt.SET_PROMPTS_EXTENSION_RESPONSE_LOADING:e.isResponseLoading=r;break}},pv=({promptsConfig:e,children:t})=>{const[n,r]=D0(hv,U(U({},zg),e||{}));return w.jsx(Jg.Provider,{value:n,children:w.jsx(fv,{dispatch:r,children:t})})},r1=({apiKey:e,apiToken:t,baseUrl:n,logoUrl:r,headerText:s,theme:a,openLinksInNewTab:u,globalClassName:c,isDevelopment:d=!1,componentType:f,componentConfig:p,entryType:g,entryMessage:b,disclaimerText:T,disclaimerMarkdown:_,searchPlaceholder:S,searchButtonLabel:C,searchConfig:N,promptsConfig:D,resetConversationMessage:k,conversationHistory:M,onConnect:Y,onCopilotEvent:B,onRefinedSearch:te,onRefinedBrowse:ae,__features:ye,children:$})=>w.jsx(dA,{baseUrl:n,apiKey:e,apiToken:t,logoUrl:r,headerText:s,entryMessage:b,theme:a,globalClassName:c,openLinksInNewTab:u,searchPlaceholder:S,searchButtonLabel:C,searchConfig:N,componentConfig:p,disclaimerMarkdown:_,disclaimerText:T,resetConversationMessage:k,conversationHistory:M,isDevelopment:d,__features:ye,children:w.jsx(TA,{entryType:g,onCopilotEvent:B,children:w.jsx(sv,{children:w.jsx(ZA,{children:w.jsx(nv,{children:w.jsx(av,{entryType:g,componentConfig:p,componentType:f,children:w.jsx(pv,{promptsConfig:D,children:w.jsx(dv,{apiKey:e,apiToken:t,baseUrl:n,isDevelopment:d,entryType:g,onConnect:Y,onRefinedSearch:te,onRefinedBrowse:ae,onCopilotEvent:B,children:$})})})})})})})});function i1(e){var t,n,r="";if(typeof e=="string"||typeof e=="number")r+=e;else if(typeof e=="object")if(Array.isArray(e)){var s=e.length;for(t=0;t<s;t++)e[t]&&(n=i1(e[t]))&&(r&&(r+=" "),r+=n)}else for(n in e)e[n]&&(r&&(r+=" "),r+=n);return r}function X(){for(var e,t,n=0,r="",s=arguments.length;n<s;n++)(e=arguments[n])&&(t=i1(e))&&(r&&(r+=" "),r+=t);return r}var s1={color:void 0,size:void 0,className:void 0,style:void 0,attr:void 0},o1=Xi.createContext&&Xi.createContext(s1),mv=["attr","size","title"];function gv(e,t){if(e==null)return{};var n=Ev(e,t),r,s;if(Object.getOwnPropertySymbols){var a=Object.getOwnPropertySymbols(e);for(s=0;s<a.length;s++)r=a[s],!(t.indexOf(r)>=0)&&Object.prototype.propertyIsEnumerable.call(e,r)&&(n[r]=e[r])}return n}function Ev(e,t){if(e==null)return{};var n={};for(var r in e)if(Object.prototype.hasOwnProperty.call(e,r)){if(t.indexOf(r)>=0)continue;n[r]=e[r]}return n}function al(){return al=Object.assign?Object.assign.bind():function(e){for(var t=1;t<arguments.length;t++){var n=arguments[t];for(var r in n)Object.prototype.hasOwnProperty.call(n,r)&&(e[r]=n[r])}return e},al.apply(this,arguments)}function a1(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(e);t&&(r=r.filter(function(s){return Object.getOwnPropertyDescriptor(e,s).enumerable})),n.push.apply(n,r)}return n}function ul(e){for(var t=1;t<arguments.length;t++){var n=arguments[t]!=null?arguments[t]:{};t%2?a1(Object(n),!0).forEach(function(r){yv(e,r,n[r])}):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(n)):a1(Object(n)).forEach(function(r){Object.defineProperty(e,r,Object.getOwnPropertyDescriptor(n,r))})}return e}function yv(e,t,n){return t=Tv(t),t in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}function Tv(e){var t=bv(e,"string");return typeof t=="symbol"?t:t+""}function bv(e,t){if(typeof e!="object"||!e)return e;var n=e[Symbol.toPrimitive];if(n!==void 0){var r=n.call(e,t);if(typeof r!="object")return r;throw new TypeError("@@toPrimitive must return a primitive value.")}return(t==="string"?String:Number)(e)}function u1(e){return e&&e.map((t,n)=>Xi.createElement(t.tag,ul({key:n},t.attr),u1(t.child)))}function Vt(e){return t=>Xi.createElement(_v,al({attr:ul({},e.attr)},t),u1(e.child))}function _v(e){var t=n=>{var{attr:r,size:s,title:a}=e,u=gv(e,mv),c=s||n.size||"1em",d;return n.className&&(d=n.className),e.className&&(d=(d?d+" ":"")+e.className),Xi.createElement("svg",al({stroke:"currentColor",fill:"currentColor",strokeWidth:"0"},n.attr,r,u,{className:d,style:ul(ul({color:e.color||n.color},n.style),e.style),height:c,width:c,xmlns:"http://www.w3.org/2000/svg"}),a&&Xi.createElement("title",null,a),e.children)};return o1!==void 0?Xi.createElement(o1.Consumer,null,n=>t(n)):t(s1)}function l1(e){return Vt({attr:{viewBox:"0 0 24 24"},child:[{tag:"path",attr:{fill:"none",d:"M0 0h24v24H0z"},child:[]},{tag:"path",attr:{d:"M12 2C6.48 2 2 6.48 2 12s4.48 10 10 10 10-4.48 10-10S17.52 2 12 2zm1 15h-2v-6h2v6zm0-8h-2V7h2v2z"},child:[]}]})(e)}function c1(e){return Vt({attr:{viewBox:"0 0 24 24"},child:[{tag:"path",attr:{fill:"none",d:"M0 0h24v24H0V0z"},child:[]},{tag:"path",attr:{d:"M6 19h12v2H6z"},child:[]}]})(e)}function $s(e){return Vt({attr:{viewBox:"0 0 24 24"},child:[{tag:"path",attr:{fill:"none",d:"M0 0h24v24H0z"},child:[]},{tag:"path",attr:{d:"M15.5 14h-.79l-.28-.27A6.471 6.471 0 0 0 16 9.5 6.5 6.5 0 1 0 9.5 16c1.61 0 3.09-.59 4.23-1.57l.27.28v.79l5 4.99L20.49 19l-4.99-5zm-6 0C7.01 14 5 11.99 5 9.5S7.01 5 9.5 5 14 7.01 14 9.5 11.99 14 9.5 14z"},child:[]}]})(e)}function Sv(e){return Vt({attr:{viewBox:"0 0 24 24"},child:[{tag:"path",attr:{fill:"none",d:"M0 0h24v24H0V0z"},child:[]},{tag:"path",attr:{d:"M11 15h2v2h-2zm0-8h2v6h-2zm.99-5C6.47 2 2 6.48 2 12s4.47 10 9.99 10C17.52 22 22 17.52 22 12S17.52 2 11.99 2zM12 20c-4.42 0-8-3.58-8-8s3.58-8 8-8 8 3.58 8 8-3.58 8-8 8z"},child:[]}]})(e)}function d1(e){return Vt({attr:{viewBox:"0 0 24 24"},child:[{tag:"path",attr:{fill:"none",d:"M0 0h24v24H0z"},child:[]},{tag:"path",attr:{d:"M20 2H4c-1.1 0-1.99.9-1.99 2L2 22l4-4h14c1.1 0 2-.9 2-2V4c0-1.1-.9-2-2-2zM6 9h12v2H6V9zm8 5H6v-2h8v2zm4-6H6V6h12v2z"},child:[]}]})(e)}function xv(e){return Vt({attr:{viewBox:"0 0 24 24"},child:[{tag:"path",attr:{fill:"none",d:"M0 0h24v24H0z"},child:[]},{tag:"path",attr:{d:"m12 8-6 6 1.41 1.41L12 10.83l4.59 4.58L18 14z"},child:[]}]})(e)}function wv(e){return Vt({attr:{viewBox:"0 0 24 24"},child:[{tag:"path",attr:{fill:"none",d:"M0 0h24v24H0z"},child:[]},{tag:"path",attr:{d:"M16.59 8.59 12 13.17 7.41 8.59 6 10l6 6 6-6z"},child:[]}]})(e)}function Cv(e){return Vt({attr:{viewBox:"0 0 24 24"},child:[{tag:"path",attr:{fill:"none",d:"M0 0h24v24H0z"},child:[]},{tag:"path",attr:{d:"M5 16h3v3h2v-5H5v2zm3-8H5v2h5V5H8v3zm6 11h2v-3h3v-2h-5v5zm2-11V5h-2v5h5V8h-3z"},child:[]}]})(e)}function Av(e){return Vt({attr:{viewBox:"0 0 24 24"},child:[{tag:"path",attr:{fill:"none",d:"M0 0h24v24H0z"},child:[]},{tag:"path",attr:{d:"M7 14H5v5h5v-2H7v-3zm-2-4h2V7h3V5H5v5zm12 7h-3v2h5v-5h-2v3zM14 5v2h3v3h2V5h-5z"},child:[]}]})(e)}function vv(e){return Vt({attr:{viewBox:"0 0 24 24"},child:[{tag:"path",attr:{fill:"none",d:"M0 0h24v24H0V0z"},child:[]},{tag:"path",attr:{d:"m14.12 4 1.83 2H20v12H4V6h4.05l1.83-2h4.24M15 2H9L7.17 4H4c-1.1 0-2 .9-2 2v12c0 1.1.9 2 2 2h16c1.1 0 2-.9 2-2V6c0-1.1-.9-2-2-2h-3.17L15 2zm-3 7c1.65 0 3 1.35 3 3s-1.35 3-3 3-3-1.35-3-3 1.35-3 3-3m0-2c-2.76 0-5 2.24-5 5s2.24 5 5 5 5-2.24 5-5-2.24-5-5-5z"},child:[]}]})(e)}const df=({className:e,label:t="Close",onClick:n,disabled:r=!1})=>w.jsx("button",{"aria-label":t,className:X(e,`${j}-close-button`),disabled:r,onClick:n,children:w.jsx("svg",{role:"img",xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 24 20",width:"16",height:"16",fill:"currentColor",children:w.jsx("path",{d:"M18.3 5.7a1 1 0 0 0-1.4-1.4L12 9.6 7.1 4.7a1 1 0 1 0-1.4 1.4l4.9 4.9-4.9 4.9a1 1 0 1 0 1.4 1.4l4.9-4.9 4.9 4.9a1 1 0 0 0 1.4-1.4l-4.9-4.9 4.9-4.9z"})})}),ll=({className:e,children:t,type:n,disabled:r=!1,onClick:s})=>w.jsx("button",{className:X(`${j}-button`,e,{disabled:r}),type:n||"button",disabled:r,onClick:s,children:t}),kr=({className:e,iconUrl:t,icon:n,type:r="button",ariaLabel:s,title:a,disabled:u=!1,onClick:c})=>!n&&!t?null:w.jsx("button",{className:X(e,`${j}-icon-button`),type:r,"aria-label":s,title:a,onClick:c,disabled:u,children:t?w.jsx("img",{className:X(`${j}-icon-image`),src:t,alt:s,loading:"lazy"}):n}),kv=({searchConfig:e,globalClassName:t})=>{const n=e.buttonIconUrl;return n?w.jsx("img",{className:X(`${j}-search-button-icon-image`,t),src:n,alt:"",loading:"lazy"}):w.jsx($s,{size:"16px"})},Nv=({className:e,searchConfig:t,globalClassName:n,componentType:r,isLoading:s})=>{if((t==null?void 0:t.buttonType)==="icon")return w.jsx(kr,{className:X(e,n,r,`${j}-search-button-icon`),type:"submit",disabled:s,ariaLabel:(t==null?void 0:t.buttonAriaLabel)||(t==null?void 0:t.buttonLabel)||"Search Copilot",icon:t!=null&&t.buttonIconUrl?null:w.jsx($s,{size:"16px"}),iconUrl:t==null?void 0:t.buttonIconUrl});const a=(t==null?void 0:t.buttonType)==="icon-text";return w.jsxs(ll,{className:X(e,n,r,`${j}-search-button`),type:"submit","aria-label":(t==null?void 0:t.buttonAriaLabel)||"",disabled:s,children:[a&&w.jsx(kv,{globalClassName:n,searchConfig:t}),(t==null?void 0:t.buttonLabel)||"Search"]})};function Ov(e){return Vt({attr:{viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round"},child:[{tag:"path",attr:{d:"M8 9h8"},child:[]},{tag:"path",attr:{d:"M8 13h6"},child:[]},{tag:"path",attr:{d:"M13 18l-5 3v-3h-2a3 3 0 0 1 -3 -3v-8a3 3 0 0 1 3 -3h12a3 3 0 0 1 3 3v6"},child:[]},{tag:"path",attr:{d:"M17 17v5"},child:[]},{tag:"path",attr:{d:"M21 17v5"},child:[]}]})(e)}const Pv=()=>{const{messages:e}=Gn(),{handleCancel:t}=dr();return{cancelRequest:z.useCallback(()=>{if(!(e!=null&&e.length))return null;const r=e[e.length-1],s=r.eventSourceId||r.id;t(s)},[t,e])}},Iv=({isLoading:e})=>{const{globalClassName:t,searchConfig:n}=ht(),{cancelRequest:r}=Pv();return n!=null&&n.enableCancelSearch?w.jsx(kr,{className:X(t,`${j}-cancel-button`),ariaLabel:"Cancel Copilot chat processing",title:"Cancel Copilot request",icon:w.jsx(Ov,{}),disabled:!e,onClick:r}):null};function mB(){}function gB(){}function f1(e){const t=[],n=String(e||"");let r=n.indexOf(","),s=0,a=!1;for(;!a;){r===-1&&(r=n.length,a=!0);const u=n.slice(s,r).trim();(u||!a)&&t.push(u),s=r+1,r=n.indexOf(",",s)}return t}function h1(e,t){const n={};return(e[e.length-1]===""?[...e,""]:e).join((n.padRight?" ":"")+","+(n.padLeft===!1?"":" ")).trim()}const Rv=/^[$_\p{ID_Start}][$_\u{200C}\u{200D}\p{ID_Continue}]*$/u,Lv=/^[$_\p{ID_Start}][-$_\u{200C}\u{200D}\p{ID_Continue}]*$/u,Dv={};function p1(e,t){return(Dv.jsx?Lv:Rv).test(e)}const Mv=/[ \t\n\f\r]/g;function Fv(e){return typeof e=="object"?e.type==="text"?m1(e.value):!1:m1(e)}function m1(e){return e.replace(Mv,"")===""}let ca=class{constructor(t,n,r){this.normal=n,this.property=t,r&&(this.space=r)}};ca.prototype.normal={},ca.prototype.property={},ca.prototype.space=void 0;function g1(e,t){const n={},r={};for(const s of e)Object.assign(n,s.property),Object.assign(r,s.normal);return new ca(n,r,t)}function da(e){return e.toLowerCase()}let wn=class{constructor(t,n){this.attribute=n,this.property=t}};wn.prototype.attribute="",wn.prototype.booleanish=!1,wn.prototype.boolean=!1,wn.prototype.commaOrSpaceSeparated=!1,wn.prototype.commaSeparated=!1,wn.prototype.defined=!1,wn.prototype.mustUseProperty=!1,wn.prototype.number=!1,wn.prototype.overloadedBoolean=!1,wn.prototype.property="",wn.prototype.spaceSeparated=!1,wn.prototype.space=void 0;let Bv=0;const Ye=rs(),Ht=rs(),ff=rs(),me=rs(),gt=rs(),Vs=rs(),Dn=rs();function rs(){return hd(2,++Bv)}const hf=Object.freeze(Object.defineProperty({__proto__:null,boolean:Ye,booleanish:Ht,commaOrSpaceSeparated:Dn,commaSeparated:Vs,number:me,overloadedBoolean:ff,spaceSeparated:gt},Symbol.toStringTag,{value:"Module"})),pf=Object.keys(hf);let mf=class extends wn{constructor(t,n,r,s){let a=-1;if(super(t,n),E1(this,"space",s),typeof r=="number")for(;++a<pf.length;){const u=pf[a];E1(this,pf[a],(r&hf[u])===hf[u])}}};mf.prototype.defined=!0;function E1(e,t,n){n&&(e[t]=n)}function qs(e){const t={},n={};for(const[r,s]of Object.entries(e.properties)){const a=new mf(r,e.transform(e.attributes||{},r),s,e.space);e.mustUseProperty&&e.mustUseProperty.includes(r)&&(a.mustUseProperty=!0),t[r]=a,n[da(r)]=r,n[da(a.attribute)]=r}return new ca(t,n,e.space)}const y1=qs({properties:{ariaActiveDescendant:null,ariaAtomic:Ht,ariaAutoComplete:null,ariaBusy:Ht,ariaChecked:Ht,ariaColCount:me,ariaColIndex:me,ariaColSpan:me,ariaControls:gt,ariaCurrent:null,ariaDescribedBy:gt,ariaDetails:null,ariaDisabled:Ht,ariaDropEffect:gt,ariaErrorMessage:null,ariaExpanded:Ht,ariaFlowTo:gt,ariaGrabbed:Ht,ariaHasPopup:null,ariaHidden:Ht,ariaInvalid:null,ariaKeyShortcuts:null,ariaLabel:null,ariaLabelledBy:gt,ariaLevel:me,ariaLive:null,ariaModal:Ht,ariaMultiLine:Ht,ariaMultiSelectable:Ht,ariaOrientation:null,ariaOwns:gt,ariaPlaceholder:null,ariaPosInSet:me,ariaPressed:Ht,ariaReadOnly:Ht,ariaRelevant:null,ariaRequired:Ht,ariaRoleDescription:gt,ariaRowCount:me,ariaRowIndex:me,ariaRowSpan:me,ariaSelected:Ht,ariaSetSize:me,ariaSort:null,ariaValueMax:me,ariaValueMin:me,ariaValueNow:me,ariaValueText:null,role:null},transform(e,t){return t==="role"?t:"aria-"+t.slice(4).toLowerCase()}});function T1(e,t){return t in e?e[t]:t}function b1(e,t){return T1(e,t.toLowerCase())}const Uv=qs({attributes:{acceptcharset:"accept-charset",classname:"class",htmlfor:"for",httpequiv:"http-equiv"},mustUseProperty:["checked","multiple","muted","selected"],properties:{abbr:null,accept:Vs,acceptCharset:gt,accessKey:gt,action:null,allow:null,allowFullScreen:Ye,allowPaymentRequest:Ye,allowUserMedia:Ye,alt:null,as:null,async:Ye,autoCapitalize:null,autoComplete:gt,autoFocus:Ye,autoPlay:Ye,blocking:gt,capture:null,charSet:null,checked:Ye,cite:null,className:gt,cols:me,colSpan:null,content:null,contentEditable:Ht,controls:Ye,controlsList:gt,coords:me|Vs,crossOrigin:null,data:null,dateTime:null,decoding:null,default:Ye,defer:Ye,dir:null,dirName:null,disabled:Ye,download:ff,draggable:Ht,encType:null,enterKeyHint:null,fetchPriority:null,form:null,formAction:null,formEncType:null,formMethod:null,formNoValidate:Ye,formTarget:null,headers:gt,height:me,hidden:ff,high:me,href:null,hrefLang:null,htmlFor:gt,httpEquiv:gt,id:null,imageSizes:null,imageSrcSet:null,inert:Ye,inputMode:null,integrity:null,is:null,isMap:Ye,itemId:null,itemProp:gt,itemRef:gt,itemScope:Ye,itemType:gt,kind:null,label:null,lang:null,language:null,list:null,loading:null,loop:Ye,low:me,manifest:null,max:null,maxLength:me,media:null,method:null,min:null,minLength:me,multiple:Ye,muted:Ye,name:null,nonce:null,noModule:Ye,noValidate:Ye,onAbort:null,onAfterPrint:null,onAuxClick:null,onBeforeMatch:null,onBeforePrint:null,onBeforeToggle:null,onBeforeUnload:null,onBlur:null,onCancel:null,onCanPlay:null,onCanPlayThrough:null,onChange:null,onClick:null,onClose:null,onContextLost:null,onContextMenu:null,onContextRestored:null,onCopy:null,onCueChange:null,onCut:null,onDblClick:null,onDrag:null,onDragEnd:null,onDragEnter:null,onDragExit:null,onDragLeave:null,onDragOver:null,onDragStart:null,onDrop:null,onDurationChange:null,onEmptied:null,onEnded:null,onError:null,onFocus:null,onFormData:null,onHashChange:null,onInput:null,onInvalid:null,onKeyDown:null,onKeyPress:null,onKeyUp:null,onLanguageChange:null,onLoad:null,onLoadedData:null,onLoadedMetadata:null,onLoadEnd:null,onLoadStart:null,onMessage:null,onMessageError:null,onMouseDown:null,onMouseEnter:null,onMouseLeave:null,onMouseMove:null,onMouseOut:null,onMouseOver:null,onMouseUp:null,onOffline:null,onOnline:null,onPageHide:null,onPageShow:null,onPaste:null,onPause:null,onPlay:null,onPlaying:null,onPopState:null,onProgress:null,onRateChange:null,onRejectionHandled:null,onReset:null,onResize:null,onScroll:null,onScrollEnd:null,onSecurityPolicyViolation:null,onSeeked:null,onSeeking:null,onSelect:null,onSlotChange:null,onStalled:null,onStorage:null,onSubmit:null,onSuspend:null,onTimeUpdate:null,onToggle:null,onUnhandledRejection:null,onUnload:null,onVolumeChange:null,onWaiting:null,onWheel:null,open:Ye,optimum:me,pattern:null,ping:gt,placeholder:null,playsInline:Ye,popover:null,popoverTarget:null,popoverTargetAction:null,poster:null,preload:null,readOnly:Ye,referrerPolicy:null,rel:gt,required:Ye,reversed:Ye,rows:me,rowSpan:me,sandbox:gt,scope:null,scoped:Ye,seamless:Ye,selected:Ye,shadowRootClonable:Ye,shadowRootDelegatesFocus:Ye,shadowRootMode:null,shape:null,size:me,sizes:null,slot:null,span:me,spellCheck:Ht,src:null,srcDoc:null,srcLang:null,srcSet:null,start:me,step:null,style:null,tabIndex:me,target:null,title:null,translate:null,type:null,typeMustMatch:Ye,useMap:null,value:Ht,width:me,wrap:null,writingSuggestions:null,align:null,aLink:null,archive:gt,axis:null,background:null,bgColor:null,border:me,borderColor:null,bottomMargin:me,cellPadding:null,cellSpacing:null,char:null,charOff:null,classId:null,clear:null,code:null,codeBase:null,codeType:null,color:null,compact:Ye,declare:Ye,event:null,face:null,frame:null,frameBorder:null,hSpace:me,leftMargin:me,link:null,longDesc:null,lowSrc:null,marginHeight:me,marginWidth:me,noResize:Ye,noHref:Ye,noShade:Ye,noWrap:Ye,object:null,profile:null,prompt:null,rev:null,rightMargin:me,rules:null,scheme:null,scrolling:Ht,standby:null,summary:null,text:null,topMargin:me,valueType:null,version:null,vAlign:null,vLink:null,vSpace:me,allowTransparency:null,autoCorrect:null,autoSave:null,disablePictureInPicture:Ye,disableRemotePlayback:Ye,prefix:null,property:null,results:me,security:null,unselectable:null},space:"html",transform:b1}),Hv=qs({attributes:{accentHeight:"accent-height",alignmentBaseline:"alignment-baseline",arabicForm:"arabic-form",baselineShift:"baseline-shift",capHeight:"cap-height",className:"class",clipPath:"clip-path",clipRule:"clip-rule",colorInterpolation:"color-interpolation",colorInterpolationFilters:"color-interpolation-filters",colorProfile:"color-profile",colorRendering:"color-rendering",crossOrigin:"crossorigin",dataType:"datatype",dominantBaseline:"dominant-baseline",enableBackground:"enable-background",fillOpacity:"fill-opacity",fillRule:"fill-rule",floodColor:"flood-color",floodOpacity:"flood-opacity",fontFamily:"font-family",fontSize:"font-size",fontSizeAdjust:"font-size-adjust",fontStretch:"font-stretch",fontStyle:"font-style",fontVariant:"font-variant",fontWeight:"font-weight",glyphName:"glyph-name",glyphOrientationHorizontal:"glyph-orientation-horizontal",glyphOrientationVertical:"glyph-orientation-vertical",hrefLang:"hreflang",horizAdvX:"horiz-adv-x",horizOriginX:"horiz-origin-x",horizOriginY:"horiz-origin-y",imageRendering:"image-rendering",letterSpacing:"letter-spacing",lightingColor:"lighting-color",markerEnd:"marker-end",markerMid:"marker-mid",markerStart:"marker-start",navDown:"nav-down",navDownLeft:"nav-down-left",navDownRight:"nav-down-right",navLeft:"nav-left",navNext:"nav-next",navPrev:"nav-prev",navRight:"nav-right",navUp:"nav-up",navUpLeft:"nav-up-left",navUpRight:"nav-up-right",onAbort:"onabort",onActivate:"onactivate",onAfterPrint:"onafterprint",onBeforePrint:"onbeforeprint",onBegin:"onbegin",onCancel:"oncancel",onCanPlay:"oncanplay",onCanPlayThrough:"oncanplaythrough",onChange:"onchange",onClick:"onclick",onClose:"onclose",onCopy:"oncopy",onCueChange:"oncuechange",onCut:"oncut",onDblClick:"ondblclick",onDrag:"ondrag",onDragEnd:"ondragend",onDragEnter:"ondragenter",onDragExit:"ondragexit",onDragLeave:"ondragleave",onDragOver:"ondragover",onDragStart:"ondragstart",onDrop:"ondrop",onDurationChange:"ondurationchange",onEmptied:"onemptied",onEnd:"onend",onEnded:"onended",onError:"onerror",onFocus:"onfocus",onFocusIn:"onfocusin",onFocusOut:"onfocusout",onHashChange:"onhashchange",onInput:"oninput",onInvalid:"oninvalid",onKeyDown:"onkeydown",onKeyPress:"onkeypress",onKeyUp:"onkeyup",onLoad:"onload",onLoadedData:"onloadeddata",onLoadedMetadata:"onloadedmetadata",onLoadStart:"onloadstart",onMessage:"onmessage",onMouseDown:"onmousedown",onMouseEnter:"onmouseenter",onMouseLeave:"onmouseleave",onMouseMove:"onmousemove",onMouseOut:"onmouseout",onMouseOver:"onmouseover",onMouseUp:"onmouseup",onMouseWheel:"onmousewheel",onOffline:"onoffline",onOnline:"ononline",onPageHide:"onpagehide",onPageShow:"onpageshow",onPaste:"onpaste",onPause:"onpause",onPlay:"onplay",onPlaying:"onplaying",onPopState:"onpopstate",onProgress:"onprogress",onRateChange:"onratechange",onRepeat:"onrepeat",onReset:"onreset",onResize:"onresize",onScroll:"onscroll",onSeeked:"onseeked",onSeeking:"onseeking",onSelect:"onselect",onShow:"onshow",onStalled:"onstalled",onStorage:"onstorage",onSubmit:"onsubmit",onSuspend:"onsuspend",onTimeUpdate:"ontimeupdate",onToggle:"ontoggle",onUnload:"onunload",onVolumeChange:"onvolumechange",onWaiting:"onwaiting",onZoom:"onzoom",overlinePosition:"overline-position",overlineThickness:"overline-thickness",paintOrder:"paint-order",panose1:"panose-1",pointerEvents:"pointer-events",referrerPolicy:"referrerpolicy",renderingIntent:"rendering-intent",shapeRendering:"shape-rendering",stopColor:"stop-color",stopOpacity:"stop-opacity",strikethroughPosition:"strikethrough-position",strikethroughThickness:"strikethrough-thickness",strokeDashArray:"stroke-dasharray",strokeDashOffset:"stroke-dashoffset",strokeLineCap:"stroke-linecap",strokeLineJoin:"stroke-linejoin",strokeMiterLimit:"stroke-miterlimit",strokeOpacity:"stroke-opacity",strokeWidth:"stroke-width",tabIndex:"tabindex",textAnchor:"text-anchor",textDecoration:"text-decoration",textRendering:"text-rendering",transformOrigin:"transform-origin",typeOf:"typeof",underlinePosition:"underline-position",underlineThickness:"underline-thickness",unicodeBidi:"unicode-bidi",unicodeRange:"unicode-range",unitsPerEm:"units-per-em",vAlphabetic:"v-alphabetic",vHanging:"v-hanging",vIdeographic:"v-ideographic",vMathematical:"v-mathematical",vectorEffect:"vector-effect",vertAdvY:"vert-adv-y",vertOriginX:"vert-origin-x",vertOriginY:"vert-origin-y",wordSpacing:"word-spacing",writingMode:"writing-mode",xHeight:"x-height",playbackOrder:"playbackorder",timelineBegin:"timelinebegin"},properties:{about:Dn,accentHeight:me,accumulate:null,additive:null,alignmentBaseline:null,alphabetic:me,amplitude:me,arabicForm:null,ascent:me,attributeName:null,attributeType:null,azimuth:me,bandwidth:null,baselineShift:null,baseFrequency:null,baseProfile:null,bbox:null,begin:null,bias:me,by:null,calcMode:null,capHeight:me,className:gt,clip:null,clipPath:null,clipPathUnits:null,clipRule:null,color:null,colorInterpolation:null,colorInterpolationFilters:null,colorProfile:null,colorRendering:null,content:null,contentScriptType:null,contentStyleType:null,crossOrigin:null,cursor:null,cx:null,cy:null,d:null,dataType:null,defaultAction:null,descent:me,diffuseConstant:me,direction:null,display:null,dur:null,divisor:me,dominantBaseline:null,download:Ye,dx:null,dy:null,edgeMode:null,editable:null,elevation:me,enableBackground:null,end:null,event:null,exponent:me,externalResourcesRequired:null,fill:null,fillOpacity:me,fillRule:null,filter:null,filterRes:null,filterUnits:null,floodColor:null,floodOpacity:null,focusable:null,focusHighlight:null,fontFamily:null,fontSize:null,fontSizeAdjust:null,fontStretch:null,fontStyle:null,fontVariant:null,fontWeight:null,format:null,fr:null,from:null,fx:null,fy:null,g1:Vs,g2:Vs,glyphName:Vs,glyphOrientationHorizontal:null,glyphOrientationVertical:null,glyphRef:null,gradientTransform:null,gradientUnits:null,handler:null,hanging:me,hatchContentUnits:null,hatchUnits:null,height:null,href:null,hrefLang:null,horizAdvX:me,horizOriginX:me,horizOriginY:me,id:null,ideographic:me,imageRendering:null,initialVisibility:null,in:null,in2:null,intercept:me,k:me,k1:me,k2:me,k3:me,k4:me,kernelMatrix:Dn,kernelUnitLength:null,keyPoints:null,keySplines:null,keyTimes:null,kerning:null,lang:null,lengthAdjust:null,letterSpacing:null,lightingColor:null,limitingConeAngle:me,local:null,markerEnd:null,markerMid:null,markerStart:null,markerHeight:null,markerUnits:null,markerWidth:null,mask:null,maskContentUnits:null,maskUnits:null,mathematical:null,max:null,media:null,mediaCharacterEncoding:null,mediaContentEncodings:null,mediaSize:me,mediaTime:null,method:null,min:null,mode:null,name:null,navDown:null,navDownLeft:null,navDownRight:null,navLeft:null,navNext:null,navPrev:null,navRight:null,navUp:null,navUpLeft:null,navUpRight:null,numOctaves:null,observer:null,offset:null,onAbort:null,onActivate:null,onAfterPrint:null,onBeforePrint:null,onBegin:null,onCancel:null,onCanPlay:null,onCanPlayThrough:null,onChange:null,onClick:null,onClose:null,onCopy:null,onCueChange:null,onCut:null,onDblClick:null,onDrag:null,onDragEnd:null,onDragEnter:null,onDragExit:null,onDragLeave:null,onDragOver:null,onDragStart:null,onDrop:null,onDurationChange:null,onEmptied:null,onEnd:null,onEnded:null,onError:null,onFocus:null,onFocusIn:null,onFocusOut:null,onHashChange:null,onInput:null,onInvalid:null,onKeyDown:null,onKeyPress:null,onKeyUp:null,onLoad:null,onLoadedData:null,onLoadedMetadata:null,onLoadStart:null,onMessage:null,onMouseDown:null,onMouseEnter:null,onMouseLeave:null,onMouseMove:null,onMouseOut:null,onMouseOver:null,onMouseUp:null,onMouseWheel:null,onOffline:null,onOnline:null,onPageHide:null,onPageShow:null,onPaste:null,onPause:null,onPlay:null,onPlaying:null,onPopState:null,onProgress:null,onRateChange:null,onRepeat:null,onReset:null,onResize:null,onScroll:null,onSeeked:null,onSeeking:null,onSelect:null,onShow:null,onStalled:null,onStorage:null,onSubmit:null,onSuspend:null,onTimeUpdate:null,onToggle:null,onUnload:null,onVolumeChange:null,onWaiting:null,onZoom:null,opacity:null,operator:null,order:null,orient:null,orientation:null,origin:null,overflow:null,overlay:null,overlinePosition:me,overlineThickness:me,paintOrder:null,panose1:null,path:null,pathLength:me,patternContentUnits:null,patternTransform:null,patternUnits:null,phase:null,ping:gt,pitch:null,playbackOrder:null,pointerEvents:null,points:null,pointsAtX:me,pointsAtY:me,pointsAtZ:me,preserveAlpha:null,preserveAspectRatio:null,primitiveUnits:null,propagate:null,property:Dn,r:null,radius:null,referrerPolicy:null,refX:null,refY:null,rel:Dn,rev:Dn,renderingIntent:null,repeatCount:null,repeatDur:null,requiredExtensions:Dn,requiredFeatures:Dn,requiredFonts:Dn,requiredFormats:Dn,resource:null,restart:null,result:null,rotate:null,rx:null,ry:null,scale:null,seed:null,shapeRendering:null,side:null,slope:null,snapshotTime:null,specularConstant:me,specularExponent:me,spreadMethod:null,spacing:null,startOffset:null,stdDeviation:null,stemh:null,stemv:null,stitchTiles:null,stopColor:null,stopOpacity:null,strikethroughPosition:me,strikethroughThickness:me,string:null,stroke:null,strokeDashArray:Dn,strokeDashOffset:null,strokeLineCap:null,strokeLineJoin:null,strokeMiterLimit:me,strokeOpacity:me,strokeWidth:null,style:null,surfaceScale:me,syncBehavior:null,syncBehaviorDefault:null,syncMaster:null,syncTolerance:null,syncToleranceDefault:null,systemLanguage:Dn,tabIndex:me,tableValues:null,target:null,targetX:me,targetY:me,textAnchor:null,textDecoration:null,textRendering:null,textLength:null,timelineBegin:null,title:null,transformBehavior:null,type:null,typeOf:Dn,to:null,transform:null,transformOrigin:null,u1:null,u2:null,underlinePosition:me,underlineThickness:me,unicode:null,unicodeBidi:null,unicodeRange:null,unitsPerEm:me,values:null,vAlphabetic:me,vMathematical:me,vectorEffect:null,vHanging:me,vIdeographic:me,version:null,vertAdvY:me,vertOriginX:me,vertOriginY:me,viewBox:null,viewTarget:null,visibility:null,width:null,widths:null,wordSpacing:null,writingMode:null,x:null,x1:null,x2:null,xChannelSelector:null,xHeight:me,y:null,y1:null,y2:null,yChannelSelector:null,z:null,zoomAndPan:null},space:"svg",transform:T1}),_1=qs({properties:{xLinkActuate:null,xLinkArcRole:null,xLinkHref:null,xLinkRole:null,xLinkShow:null,xLinkTitle:null,xLinkType:null},space:"xlink",transform(e,t){return"xlink:"+t.slice(5).toLowerCase()}}),S1=qs({attributes:{xmlnsxlink:"xmlns:xlink"},properties:{xmlnsXLink:null,xmlns:null},space:"xmlns",transform:b1}),x1=qs({properties:{xmlBase:null,xmlLang:null,xmlSpace:null},space:"xml",transform(e,t){return"xml:"+t.slice(3).toLowerCase()}}),zv={classId:"classID",dataType:"datatype",itemId:"itemID",strokeDashArray:"strokeDasharray",strokeDashOffset:"strokeDashoffset",strokeLineCap:"strokeLinecap",strokeLineJoin:"strokeLinejoin",strokeMiterLimit:"strokeMiterlimit",typeOf:"typeof",xLinkActuate:"xlinkActuate",xLinkArcRole:"xlinkArcrole",xLinkHref:"xlinkHref",xLinkRole:"xlinkRole",xLinkShow:"xlinkShow",xLinkTitle:"xlinkTitle",xLinkType:"xlinkType",xmlnsXLink:"xmlnsXlink"},jv=/[A-Z]/g,w1=/-[a-z]/g,$v=/^data[-\w.:]+$/i;function gf(e,t){const n=da(t);let r=t,s=wn;if(n in e.normal)return e.property[e.normal[n]];if(n.length>4&&n.slice(0,4)==="data"&&$v.test(t)){if(t.charAt(4)==="-"){const a=t.slice(5).replace(w1,qv);r="data"+a.charAt(0).toUpperCase()+a.slice(1)}else{const a=t.slice(4);if(!w1.test(a)){let u=a.replace(jv,Vv);u.charAt(0)!=="-"&&(u="-"+u),t="data"+u}}s=mf}return new s(r,t)}function Vv(e){return"-"+e.toLowerCase()}function qv(e){return e.charAt(1).toUpperCase()}const cl=g1([y1,Uv,_1,S1,x1],"html"),Ys=g1([y1,Hv,_1,S1,x1],"svg");function C1(e){const t=String(e||"").trim();return t?t.split(/[ \t\n\r\f]+/g):[]}function A1(e){return e.join(" ").trim()}var Ws={},Ef,v1;function Yv(){if(v1)return Ef;v1=1;var e=/\/\*[^*]*\*+([^/*][^*]*\*+)*\//g,t=/\n/g,n=/^\s*/,r=/^(\*?[-#/*\\\w]+(\[[0-9a-z_-]+\])?)\s*/,s=/^:\s*/,a=/^((?:'(?:\\'|.)*?'|"(?:\\"|.)*?"|\([^)]*?\)|[^};])+)/,u=/^[;\s]*/,c=/^\s+|\s+$/g,d=`
|
|
11
11
|
`,f="/",p="*",g="",b="comment",T="declaration";Ef=function(S,C){if(typeof S!="string")throw new TypeError("First argument must be a string");if(!S)return[];C=C||{};var N=1,D=1;function k(fe){var le=fe.match(t);le&&(N+=le.length);var Te=fe.lastIndexOf(d);D=~Te?fe.length-Te:D+fe.length}function M(){var fe={line:N,column:D};return function(le){return le.position=new Y(fe),ae(),le}}function Y(fe){this.start=fe,this.end={line:N,column:D},this.source=C.source}Y.prototype.content=S;function B(fe){var le=new Error(C.source+":"+N+":"+D+": "+fe);if(le.reason=fe,le.filename=C.source,le.line=N,le.column=D,le.source=S,!C.silent)throw le}function te(fe){var le=fe.exec(S);if(le){var Te=le[0];return k(Te),S=S.slice(Te.length),le}}function ae(){te(n)}function ye(fe){var le;for(fe=fe||[];le=$();)le!==!1&&fe.push(le);return fe}function $(){var fe=M();if(!(f!=S.charAt(0)||p!=S.charAt(1))){for(var le=2;g!=S.charAt(le)&&(p!=S.charAt(le)||f!=S.charAt(le+1));)++le;if(le+=2,g===S.charAt(le-1))return B("End of comment missing");var Te=S.slice(2,le-2);return D+=2,k(Te),S=S.slice(le),D+=2,fe({type:b,comment:Te})}}function ne(){var fe=M(),le=te(r);if(le){if($(),!te(s))return B("property missing ':'");var Te=te(a),we=fe({type:T,property:_(le[0].replace(e,g)),value:Te?_(Te[0].replace(e,g)):g});return te(u),we}}function pe(){var fe=[];ye(fe);for(var le;le=ne();)le!==!1&&(fe.push(le),ye(fe));return fe}return ae(),pe()};function _(S){return S?S.replace(c,g):g}return Ef}var k1;function Wv(){if(k1)return Ws;k1=1;var e=Ws&&Ws.__importDefault||function(r){return r&&r.__esModule?r:{default:r}};Object.defineProperty(Ws,"__esModule",{value:!0}),Ws.default=n;var t=e(Yv());function n(r,s){var a=null;if(!r||typeof r!="string")return a;var u=(0,t.default)(r),c=typeof s=="function";return u.forEach(function(d){if(d.type==="declaration"){var f=d.property,p=d.value;c?s(f,p,d):p&&(a=a||{},a[f]=p)}}),a}return Ws}var fa={},N1;function Gv(){if(N1)return fa;N1=1,Object.defineProperty(fa,"__esModule",{value:!0}),fa.camelCase=void 0;var e=/^--[a-zA-Z0-9_-]+$/,t=/-([a-z])/g,n=/^[^-]+$/,r=/^-(webkit|moz|ms|o|khtml)-/,s=/^-(ms)-/,a=function(f){return!f||n.test(f)||e.test(f)},u=function(f,p){return p.toUpperCase()},c=function(f,p){return"".concat(p,"-")},d=function(f,p){return p===void 0&&(p={}),a(f)?f:(f=f.toLowerCase(),p.reactCompat?f=f.replace(s,c):f=f.replace(r,c),f.replace(t,u))};return fa.camelCase=d,fa}var ha,O1;function Xv(){if(O1)return ha;O1=1;var e=ha&&ha.__importDefault||function(s){return s&&s.__esModule?s:{default:s}},t=e(Wv()),n=Gv();function r(s,a){var u={};return!s||typeof s!="string"||(0,t.default)(s,function(c,d){c&&d&&(u[(0,n.camelCase)(c,a)]=d)}),u}return r.default=r,ha=r,ha}var Kv=Xv();const Qv=Qe(Kv),dl=P1("end"),Nr=P1("start");function P1(e){return t;function t(n){const r=n&&n.position&&n.position[e]||{};if(typeof r.line=="number"&&r.line>0&&typeof r.column=="number"&&r.column>0)return{line:r.line,column:r.column,offset:typeof r.offset=="number"&&r.offset>-1?r.offset:void 0}}}function I1(e){const t=Nr(e),n=dl(e);if(t&&n)return{start:t,end:n}}function pa(e){return!e||typeof e!="object"?"":"position"in e||"type"in e?R1(e.position):"start"in e||"end"in e?R1(e):"line"in e||"column"in e?yf(e):""}function yf(e){return L1(e&&e.line)+":"+L1(e&&e.column)}function R1(e){return yf(e&&e.start)+"-"+yf(e&&e.end)}function L1(e){return e&&typeof e=="number"?e:1}class un extends Error{constructor(t,n,r){super(),typeof n=="string"&&(r=n,n=void 0);let s="",a={},u=!1;if(n&&("line"in n&&"column"in n?a={place:n}:"start"in n&&"end"in n?a={place:n}:"type"in n?a={ancestors:[n],place:n.position}:a=U({},n)),typeof t=="string"?s=t:!a.cause&&t&&(u=!0,s=t.message,a.cause=t),!a.ruleId&&!a.source&&typeof r=="string"){const d=r.indexOf(":");d===-1?a.ruleId=r:(a.source=r.slice(0,d),a.ruleId=r.slice(d+1))}if(!a.place&&a.ancestors&&a.ancestors){const d=a.ancestors[a.ancestors.length-1];d&&(a.place=d.position)}const c=a.place&&"start"in a.place?a.place.start:a.place;this.ancestors=a.ancestors||void 0,this.cause=a.cause||void 0,this.column=c?c.column:void 0,this.fatal=void 0,this.file,this.message=s,this.line=c?c.line:void 0,this.name=pa(a.place)||"1:1",this.place=a.place||void 0,this.reason=this.message,this.ruleId=a.ruleId||void 0,this.source=a.source||void 0,this.stack=u&&a.cause&&typeof a.cause.stack=="string"?a.cause.stack:"",this.actual,this.expected,this.note,this.url}}un.prototype.file="",un.prototype.name="",un.prototype.reason="",un.prototype.message="",un.prototype.stack="",un.prototype.column=void 0,un.prototype.line=void 0,un.prototype.ancestors=void 0,un.prototype.cause=void 0,un.prototype.fatal=void 0,un.prototype.place=void 0,un.prototype.ruleId=void 0,un.prototype.source=void 0;const Tf={}.hasOwnProperty,Jv=new Map,Zv=/[A-Z]/g,ek=new Set(["table","tbody","thead","tfoot","tr"]),tk=new Set(["td","th"]),D1="https://github.com/syntax-tree/hast-util-to-jsx-runtime";function nk(e,t){if(!t||t.Fragment===void 0)throw new TypeError("Expected `Fragment` in options");const n=t.filePath||void 0;let r;if(t.development){if(typeof t.jsxDEV!="function")throw new TypeError("Expected `jsxDEV` in options when `development: true`");r=ck(n,t.jsxDEV)}else{if(typeof t.jsx!="function")throw new TypeError("Expected `jsx` in production options");if(typeof t.jsxs!="function")throw new TypeError("Expected `jsxs` in production options");r=lk(n,t.jsx,t.jsxs)}const s={Fragment:t.Fragment,ancestors:[],components:t.components||{},create:r,elementAttributeNameCase:t.elementAttributeNameCase||"react",evaluater:t.createEvaluater?t.createEvaluater():void 0,filePath:n,ignoreInvalidStyle:t.ignoreInvalidStyle||!1,passKeys:t.passKeys!==!1,passNode:t.passNode||!1,schema:t.space==="svg"?Ys:cl,stylePropertyNameCase:t.stylePropertyNameCase||"dom",tableCellAlignToStyle:t.tableCellAlignToStyle!==!1},a=M1(s,e,void 0);return a&&typeof a!="string"?a:s.create(e,s.Fragment,{children:a||void 0},void 0)}function M1(e,t,n){if(t.type==="element")return rk(e,t,n);if(t.type==="mdxFlowExpression"||t.type==="mdxTextExpression")return ik(e,t);if(t.type==="mdxJsxFlowElement"||t.type==="mdxJsxTextElement")return ok(e,t,n);if(t.type==="mdxjsEsm")return sk(e,t);if(t.type==="root")return ak(e,t,n);if(t.type==="text")return uk(e,t)}function rk(e,t,n){const r=e.schema;let s=r;t.tagName.toLowerCase()==="svg"&&r.space==="html"&&(s=Ys,e.schema=s),e.ancestors.push(t);const a=B1(e,t.tagName,!1),u=dk(e,t);let c=_f(e,t);return ek.has(t.tagName)&&(c=c.filter(function(d){return typeof d=="string"?!Fv(d):!0})),F1(e,u,a,t),bf(u,c),e.ancestors.pop(),e.schema=r,e.create(t,a,u,n)}function ik(e,t){if(t.data&&t.data.estree&&e.evaluater){const r=t.data.estree.body[0];return r.type,e.evaluater.evaluateExpression(r.expression)}ma(e,t.position)}function sk(e,t){if(t.data&&t.data.estree&&e.evaluater)return e.evaluater.evaluateProgram(t.data.estree);ma(e,t.position)}function ok(e,t,n){const r=e.schema;let s=r;t.name==="svg"&&r.space==="html"&&(s=Ys,e.schema=s),e.ancestors.push(t);const a=t.name===null?e.Fragment:B1(e,t.name,!0),u=fk(e,t),c=_f(e,t);return F1(e,u,a,t),bf(u,c),e.ancestors.pop(),e.schema=r,e.create(t,a,u,n)}function ak(e,t,n){const r={};return bf(r,_f(e,t)),e.create(t,e.Fragment,r,n)}function uk(e,t){return t.value}function F1(e,t,n,r){typeof n!="string"&&n!==e.Fragment&&e.passNode&&(t.node=r)}function bf(e,t){if(t.length>0){const n=t.length>1?t:t[0];n&&(e.children=n)}}function lk(e,t,n){return r;function r(s,a,u,c){const f=Array.isArray(u.children)?n:t;return c?f(a,u,c):f(a,u)}}function ck(e,t){return n;function n(r,s,a,u){const c=Array.isArray(a.children),d=Nr(r);return t(s,a,u,c,{columnNumber:d?d.column-1:void 0,fileName:e,lineNumber:d?d.line:void 0},void 0)}}function dk(e,t){const n={};let r,s;for(s in t.properties)if(s!=="children"&&Tf.call(t.properties,s)){const a=hk(e,s,t.properties[s]);if(a){const[u,c]=a;e.tableCellAlignToStyle&&u==="align"&&typeof c=="string"&&tk.has(t.tagName)?r=c:n[u]=c}}if(r){const a=n.style||(n.style={});a[e.stylePropertyNameCase==="css"?"text-align":"textAlign"]=r}return n}function fk(e,t){const n={};for(const r of t.attributes)if(r.type==="mdxJsxExpressionAttribute")if(r.data&&r.data.estree&&e.evaluater){const a=r.data.estree.body[0];a.type;const u=a.expression;u.type;const c=u.properties[0];c.type,Object.assign(n,e.evaluater.evaluateExpression(c.argument))}else ma(e,t.position);else{const s=r.name;let a;if(r.value&&typeof r.value=="object")if(r.value.data&&r.value.data.estree&&e.evaluater){const c=r.value.data.estree.body[0];c.type,a=e.evaluater.evaluateExpression(c.expression)}else ma(e,t.position);else a=r.value===null?!0:r.value;n[s]=a}return n}function _f(e,t){const n=[];let r=-1;const s=e.passKeys?new Map:Jv;for(;++r<t.children.length;){const a=t.children[r];let u;if(e.passKeys){const d=a.type==="element"?a.tagName:a.type==="mdxJsxFlowElement"||a.type==="mdxJsxTextElement"?a.name:void 0;if(d){const f=s.get(d)||0;u=d+"-"+f,s.set(d,f+1)}}const c=M1(e,a,u);c!==void 0&&n.push(c)}return n}function hk(e,t,n){const r=gf(e.schema,t);if(!(n==null||typeof n=="number"&&Number.isNaN(n))){if(Array.isArray(n)&&(n=r.commaSeparated?h1(n):A1(n)),r.property==="style"){let s=typeof n=="object"?n:pk(e,String(n));return e.stylePropertyNameCase==="css"&&(s=mk(s)),["style",s]}return[e.elementAttributeNameCase==="react"&&r.space?zv[r.property]||r.property:r.attribute,n]}}function pk(e,t){try{return Qv(t,{reactCompat:!0})}catch(n){if(e.ignoreInvalidStyle)return{};const r=n,s=new un("Cannot parse `style` attribute",{ancestors:e.ancestors,cause:r,ruleId:"style",source:"hast-util-to-jsx-runtime"});throw s.file=e.filePath||void 0,s.url=D1+"#cannot-parse-style-attribute",s}}function B1(e,t,n){let r;if(!n)r={type:"Literal",value:t};else if(t.includes(".")){const s=t.split(".");let a=-1,u;for(;++a<s.length;){const c=p1(s[a])?{type:"Identifier",name:s[a]}:{type:"Literal",value:s[a]};u=u?{type:"MemberExpression",object:u,property:c,computed:!!(a&&c.type==="Literal"),optional:!1}:c}r=u}else r=p1(t)&&!/^[a-z]/.test(t)?{type:"Identifier",name:t}:{type:"Literal",value:t};if(r.type==="Literal"){const s=r.value;return Tf.call(e.components,s)?e.components[s]:s}if(e.evaluater)return e.evaluater.evaluateExpression(r);ma(e)}function ma(e,t){const n=new un("Cannot handle MDX estrees without `createEvaluater`",{ancestors:e.ancestors,place:t,ruleId:"mdx-estree",source:"hast-util-to-jsx-runtime"});throw n.file=e.filePath||void 0,n.url=D1+"#cannot-handle-mdx-estrees-without-createevaluater",n}function mk(e){const t={};let n;for(n in e)Tf.call(e,n)&&(t[gk(n)]=e[n]);return t}function gk(e){let t=e.replace(Zv,Ek);return t.slice(0,3)==="ms-"&&(t="-"+t),t}function Ek(e){return"-"+e.toLowerCase()}const Sf={action:["form"],cite:["blockquote","del","ins","q"],data:["object"],formAction:["button","input"],href:["a","area","base","link"],icon:["menuitem"],itemId:null,manifest:["html"],ping:["a","area"],poster:["video"],src:["audio","embed","iframe","img","input","script","source","track","video"]},yk={};function xf(e,t){const n=yk,r=typeof n.includeImageAlt=="boolean"?n.includeImageAlt:!0,s=typeof n.includeHtml=="boolean"?n.includeHtml:!0;return U1(e,r,s)}function U1(e,t,n){if(Tk(e)){if("value"in e)return e.type==="html"&&!n?"":e.value;if(t&&"alt"in e&&e.alt)return e.alt;if("children"in e)return H1(e.children,t,n)}return Array.isArray(e)?H1(e,t,n):""}function H1(e,t,n){const r=[];let s=-1;for(;++s<e.length;)r[s]=U1(e[s],t,n);return r.join("")}function Tk(e){return!!(e&&typeof e=="object")}const z1=document.createElement("i");function wf(e){const t="&"+e+";";z1.innerHTML=t;const n=z1.textContent;return n.charCodeAt(n.length-1)===59&&e!=="semi"||n===t?!1:n}function Mn(e,t,n,r){const s=e.length;let a=0,u;if(t<0?t=-t>s?0:s+t:t=t>s?s:t,n=n>0?n:0,r.length<1e4)u=Array.from(r),u.unshift(t,n),e.splice(...u);else for(n&&e.splice(t,n);a<r.length;)u=r.slice(a,a+1e4),u.unshift(t,0),e.splice(...u),a+=1e4,t+=1e4}function Xn(e,t){return e.length>0?(Mn(e,e.length,0,t),e):t}const j1={}.hasOwnProperty;function $1(e){const t={};let n=-1;for(;++n<e.length;)bk(t,e[n]);return t}function bk(e,t){let n;for(n in t){const s=(j1.call(e,n)?e[n]:void 0)||(e[n]={}),a=t[n];let u;if(a)for(u in a){j1.call(s,u)||(s[u]=[]);const c=a[u];_k(s[u],Array.isArray(c)?c:c?[c]:[])}}}function _k(e,t){let n=-1;const r=[];for(;++n<t.length;)(t[n].add==="after"?e:r).push(t[n]);Mn(e,0,0,r)}function V1(e,t){const n=Number.parseInt(e,t);return n<9||n===11||n>13&&n<32||n>126&&n<160||n>55295&&n<57344||n>64975&&n<65008||(n&65535)===65535||(n&65535)===65534||n>1114111?"�":String.fromCodePoint(n)}function fr(e){return e.replace(/[\t\n\r ]+/g," ").replace(/^ | $/g,"").toLowerCase().toUpperCase()}const En=yi(/[A-Za-z]/),ln=yi(/[\dA-Za-z]/),Sk=yi(/[#-'*+\--9=?A-Z^-~]/);function fl(e){return e!==null&&(e<32||e===127)}const Cf=yi(/\d/),xk=yi(/[\dA-Fa-f]/),wk=yi(/[!-/:-@[-`{-~]/);function Me(e){return e!==null&&e<-2}function pt(e){return e!==null&&(e<0||e===32)}function Je(e){return e===-2||e===-1||e===32}const hl=yi(new RegExp("\\p{P}|\\p{S}","u")),is=yi(/\s/);function yi(e){return t;function t(n){return n!==null&&n>-1&&e.test(String.fromCharCode(n))}}function Gs(e){const t=[];let n=-1,r=0,s=0;for(;++n<e.length;){const a=e.charCodeAt(n);let u="";if(a===37&&ln(e.charCodeAt(n+1))&&ln(e.charCodeAt(n+2)))s=2;else if(a<128)/[!#$&-;=?-Z_a-z~]/.test(String.fromCharCode(a))||(u=String.fromCharCode(a));else if(a>55295&&a<57344){const c=e.charCodeAt(n+1);a<56320&&c>56319&&c<57344?(u=String.fromCharCode(a,c),s=1):u="�"}else u=String.fromCharCode(a);u&&(t.push(e.slice(r,n),encodeURIComponent(u)),r=n+s+1,u=""),s&&(n+=s,s=0)}return t.join("")+e.slice(r)}function tt(e,t,n,r){const s=r?r-1:Number.POSITIVE_INFINITY;let a=0;return u;function u(d){return Je(d)?(e.enter(n),c(d)):t(d)}function c(d){return Je(d)&&a++<s?(e.consume(d),c):(e.exit(n),t(d))}}const Ck={tokenize:Ak};function Ak(e){const t=e.attempt(this.parser.constructs.contentInitial,r,s);let n;return t;function r(c){if(c===null){e.consume(c);return}return e.enter("lineEnding"),e.consume(c),e.exit("lineEnding"),tt(e,t,"linePrefix")}function s(c){return e.enter("paragraph"),a(c)}function a(c){const d=e.enter("chunkText",{contentType:"text",previous:n});return n&&(n.next=d),n=d,u(c)}function u(c){if(c===null){e.exit("chunkText"),e.exit("paragraph"),e.consume(c);return}return Me(c)?(e.consume(c),e.exit("chunkText"),a):(e.consume(c),u)}}const vk={tokenize:kk},q1={tokenize:Nk};function kk(e){const t=this,n=[];let r=0,s,a,u;return c;function c(k){if(r<n.length){const M=n[r];return t.containerState=M[1],e.attempt(M[0].continuation,d,f)(k)}return f(k)}function d(k){if(r++,t.containerState._closeFlow){t.containerState._closeFlow=void 0,s&&D();const M=t.events.length;let Y=M,B;for(;Y--;)if(t.events[Y][0]==="exit"&&t.events[Y][1].type==="chunkFlow"){B=t.events[Y][1].end;break}N(r);let te=M;for(;te<t.events.length;)t.events[te][1].end=U({},B),te++;return Mn(t.events,Y+1,0,t.events.slice(M)),t.events.length=te,f(k)}return c(k)}function f(k){if(r===n.length){if(!s)return b(k);if(s.currentConstruct&&s.currentConstruct.concrete)return _(k);t.interrupt=!!(s.currentConstruct&&!s._gfmTableDynamicInterruptHack)}return t.containerState={},e.check(q1,p,g)(k)}function p(k){return s&&D(),N(r),b(k)}function g(k){return t.parser.lazy[t.now().line]=r!==n.length,u=t.now().offset,_(k)}function b(k){return t.containerState={},e.attempt(q1,T,_)(k)}function T(k){return r++,n.push([t.currentConstruct,t.containerState]),b(k)}function _(k){if(k===null){s&&D(),N(0),e.consume(k);return}return s=s||t.parser.flow(t.now()),e.enter("chunkFlow",{_tokenizer:s,contentType:"flow",previous:a}),S(k)}function S(k){if(k===null){C(e.exit("chunkFlow"),!0),N(0),e.consume(k);return}return Me(k)?(e.consume(k),C(e.exit("chunkFlow")),r=0,t.interrupt=void 0,c):(e.consume(k),S)}function C(k,M){const Y=t.sliceStream(k);if(M&&Y.push(null),k.previous=a,a&&(a.next=k),a=k,s.defineSkip(k.start),s.write(Y),t.parser.lazy[k.start.line]){let B=s.events.length;for(;B--;)if(s.events[B][1].start.offset<u&&(!s.events[B][1].end||s.events[B][1].end.offset>u))return;const te=t.events.length;let ae=te,ye,$;for(;ae--;)if(t.events[ae][0]==="exit"&&t.events[ae][1].type==="chunkFlow"){if(ye){$=t.events[ae][1].end;break}ye=!0}for(N(r),B=te;B<t.events.length;)t.events[B][1].end=U({},$),B++;Mn(t.events,ae+1,0,t.events.slice(te)),t.events.length=B}}function N(k){let M=n.length;for(;M-- >k;){const Y=n[M];t.containerState=Y[1],Y[0].exit.call(t,e)}n.length=k}function D(){s.write([null]),a=void 0,s=void 0,t.containerState._closeFlow=void 0}}function Nk(e,t,n){return tt(e,e.attempt(this.parser.constructs.document,t,n),"linePrefix",this.parser.constructs.disable.null.includes("codeIndented")?void 0:4)}function Xs(e){if(e===null||pt(e)||is(e))return 1;if(hl(e))return 2}function pl(e,t,n){const r=[];let s=-1;for(;++s<e.length;){const a=e[s].resolveAll;a&&!r.includes(a)&&(t=a(t,n),r.push(a))}return t}const Af={name:"attention",resolveAll:Ok,tokenize:Pk};function Ok(e,t){let n=-1,r,s,a,u,c,d,f,p;for(;++n<e.length;)if(e[n][0]==="enter"&&e[n][1].type==="attentionSequence"&&e[n][1]._close){for(r=n;r--;)if(e[r][0]==="exit"&&e[r][1].type==="attentionSequence"&&e[r][1]._open&&t.sliceSerialize(e[r][1]).charCodeAt(0)===t.sliceSerialize(e[n][1]).charCodeAt(0)){if((e[r][1]._close||e[n][1]._open)&&(e[n][1].end.offset-e[n][1].start.offset)%3&&!((e[r][1].end.offset-e[r][1].start.offset+e[n][1].end.offset-e[n][1].start.offset)%3))continue;d=e[r][1].end.offset-e[r][1].start.offset>1&&e[n][1].end.offset-e[n][1].start.offset>1?2:1;const g=U({},e[r][1].end),b=U({},e[n][1].start);Y1(g,-d),Y1(b,d),u={type:d>1?"strongSequence":"emphasisSequence",start:g,end:U({},e[r][1].end)},c={type:d>1?"strongSequence":"emphasisSequence",start:U({},e[n][1].start),end:b},a={type:d>1?"strongText":"emphasisText",start:U({},e[r][1].end),end:U({},e[n][1].start)},s={type:d>1?"strong":"emphasis",start:U({},u.start),end:U({},c.end)},e[r][1].end=U({},u.start),e[n][1].start=U({},c.end),f=[],e[r][1].end.offset-e[r][1].start.offset&&(f=Xn(f,[["enter",e[r][1],t],["exit",e[r][1],t]])),f=Xn(f,[["enter",s,t],["enter",u,t],["exit",u,t],["enter",a,t]]),f=Xn(f,pl(t.parser.constructs.insideSpan.null,e.slice(r+1,n),t)),f=Xn(f,[["exit",a,t],["enter",c,t],["exit",c,t],["exit",s,t]]),e[n][1].end.offset-e[n][1].start.offset?(p=2,f=Xn(f,[["enter",e[n][1],t],["exit",e[n][1],t]])):p=0,Mn(e,r-1,n-r+3,f),n=r+f.length-p-2;break}}for(n=-1;++n<e.length;)e[n][1].type==="attentionSequence"&&(e[n][1].type="data");return e}function Pk(e,t){const n=this.parser.constructs.attentionMarkers.null,r=this.previous,s=Xs(r);let a;return u;function u(d){return a=d,e.enter("attentionSequence"),c(d)}function c(d){if(d===a)return e.consume(d),c;const f=e.exit("attentionSequence"),p=Xs(d),g=!p||p===2&&s||n.includes(d),b=!s||s===2&&p||n.includes(r);return f._open=!!(a===42?g:g&&(s||!b)),f._close=!!(a===42?b:b&&(p||!g)),t(d)}}function Y1(e,t){e.column+=t,e.offset+=t,e._bufferIndex+=t}const Ik={name:"autolink",tokenize:Rk};function Rk(e,t,n){let r=0;return s;function s(T){return e.enter("autolink"),e.enter("autolinkMarker"),e.consume(T),e.exit("autolinkMarker"),e.enter("autolinkProtocol"),a}function a(T){return En(T)?(e.consume(T),u):T===64?n(T):f(T)}function u(T){return T===43||T===45||T===46||ln(T)?(r=1,c(T)):f(T)}function c(T){return T===58?(e.consume(T),r=0,d):(T===43||T===45||T===46||ln(T))&&r++<32?(e.consume(T),c):(r=0,f(T))}function d(T){return T===62?(e.exit("autolinkProtocol"),e.enter("autolinkMarker"),e.consume(T),e.exit("autolinkMarker"),e.exit("autolink"),t):T===null||T===32||T===60||fl(T)?n(T):(e.consume(T),d)}function f(T){return T===64?(e.consume(T),p):Sk(T)?(e.consume(T),f):n(T)}function p(T){return ln(T)?g(T):n(T)}function g(T){return T===46?(e.consume(T),r=0,p):T===62?(e.exit("autolinkProtocol").type="autolinkEmail",e.enter("autolinkMarker"),e.consume(T),e.exit("autolinkMarker"),e.exit("autolink"),t):b(T)}function b(T){if((T===45||ln(T))&&r++<63){const _=T===45?b:g;return e.consume(T),_}return n(T)}}const ga={partial:!0,tokenize:Lk};function Lk(e,t,n){return r;function r(a){return Je(a)?tt(e,s,"linePrefix")(a):s(a)}function s(a){return a===null||Me(a)?t(a):n(a)}}const W1={continuation:{tokenize:Mk},exit:Fk,name:"blockQuote",tokenize:Dk};function Dk(e,t,n){const r=this;return s;function s(u){if(u===62){const c=r.containerState;return c.open||(e.enter("blockQuote",{_container:!0}),c.open=!0),e.enter("blockQuotePrefix"),e.enter("blockQuoteMarker"),e.consume(u),e.exit("blockQuoteMarker"),a}return n(u)}function a(u){return Je(u)?(e.enter("blockQuotePrefixWhitespace"),e.consume(u),e.exit("blockQuotePrefixWhitespace"),e.exit("blockQuotePrefix"),t):(e.exit("blockQuotePrefix"),t(u))}}function Mk(e,t,n){const r=this;return s;function s(u){return Je(u)?tt(e,a,"linePrefix",r.parser.constructs.disable.null.includes("codeIndented")?void 0:4)(u):a(u)}function a(u){return e.attempt(W1,t,n)(u)}}function Fk(e){e.exit("blockQuote")}const G1={name:"characterEscape",tokenize:Bk};function Bk(e,t,n){return r;function r(a){return e.enter("characterEscape"),e.enter("escapeMarker"),e.consume(a),e.exit("escapeMarker"),s}function s(a){return wk(a)?(e.enter("characterEscapeValue"),e.consume(a),e.exit("characterEscapeValue"),e.exit("characterEscape"),t):n(a)}}const X1={name:"characterReference",tokenize:Uk};function Uk(e,t,n){const r=this;let s=0,a,u;return c;function c(g){return e.enter("characterReference"),e.enter("characterReferenceMarker"),e.consume(g),e.exit("characterReferenceMarker"),d}function d(g){return g===35?(e.enter("characterReferenceMarkerNumeric"),e.consume(g),e.exit("characterReferenceMarkerNumeric"),f):(e.enter("characterReferenceValue"),a=31,u=ln,p(g))}function f(g){return g===88||g===120?(e.enter("characterReferenceMarkerHexadecimal"),e.consume(g),e.exit("characterReferenceMarkerHexadecimal"),e.enter("characterReferenceValue"),a=6,u=xk,p):(e.enter("characterReferenceValue"),a=7,u=Cf,p(g))}function p(g){if(g===59&&s){const b=e.exit("characterReferenceValue");return u===ln&&!wf(r.sliceSerialize(b))?n(g):(e.enter("characterReferenceMarker"),e.consume(g),e.exit("characterReferenceMarker"),e.exit("characterReference"),t)}return u(g)&&s++<a?(e.consume(g),p):n(g)}}const K1={partial:!0,tokenize:zk},Q1={concrete:!0,name:"codeFenced",tokenize:Hk};function Hk(e,t,n){const r=this,s={partial:!0,tokenize:Y};let a=0,u=0,c;return d;function d(B){return f(B)}function f(B){const te=r.events[r.events.length-1];return a=te&&te[1].type==="linePrefix"?te[2].sliceSerialize(te[1],!0).length:0,c=B,e.enter("codeFenced"),e.enter("codeFencedFence"),e.enter("codeFencedFenceSequence"),p(B)}function p(B){return B===c?(u++,e.consume(B),p):u<3?n(B):(e.exit("codeFencedFenceSequence"),Je(B)?tt(e,g,"whitespace")(B):g(B))}function g(B){return B===null||Me(B)?(e.exit("codeFencedFence"),r.interrupt?t(B):e.check(K1,S,M)(B)):(e.enter("codeFencedFenceInfo"),e.enter("chunkString",{contentType:"string"}),b(B))}function b(B){return B===null||Me(B)?(e.exit("chunkString"),e.exit("codeFencedFenceInfo"),g(B)):Je(B)?(e.exit("chunkString"),e.exit("codeFencedFenceInfo"),tt(e,T,"whitespace")(B)):B===96&&B===c?n(B):(e.consume(B),b)}function T(B){return B===null||Me(B)?g(B):(e.enter("codeFencedFenceMeta"),e.enter("chunkString",{contentType:"string"}),_(B))}function _(B){return B===null||Me(B)?(e.exit("chunkString"),e.exit("codeFencedFenceMeta"),g(B)):B===96&&B===c?n(B):(e.consume(B),_)}function S(B){return e.attempt(s,M,C)(B)}function C(B){return e.enter("lineEnding"),e.consume(B),e.exit("lineEnding"),N}function N(B){return a>0&&Je(B)?tt(e,D,"linePrefix",a+1)(B):D(B)}function D(B){return B===null||Me(B)?e.check(K1,S,M)(B):(e.enter("codeFlowValue"),k(B))}function k(B){return B===null||Me(B)?(e.exit("codeFlowValue"),D(B)):(e.consume(B),k)}function M(B){return e.exit("codeFenced"),t(B)}function Y(B,te,ae){let ye=0;return $;function $(Te){return B.enter("lineEnding"),B.consume(Te),B.exit("lineEnding"),ne}function ne(Te){return B.enter("codeFencedFence"),Je(Te)?tt(B,pe,"linePrefix",r.parser.constructs.disable.null.includes("codeIndented")?void 0:4)(Te):pe(Te)}function pe(Te){return Te===c?(B.enter("codeFencedFenceSequence"),fe(Te)):ae(Te)}function fe(Te){return Te===c?(ye++,B.consume(Te),fe):ye>=u?(B.exit("codeFencedFenceSequence"),Je(Te)?tt(B,le,"whitespace")(Te):le(Te)):ae(Te)}function le(Te){return Te===null||Me(Te)?(B.exit("codeFencedFence"),te(Te)):ae(Te)}}}function zk(e,t,n){const r=this;return s;function s(u){return u===null?n(u):(e.enter("lineEnding"),e.consume(u),e.exit("lineEnding"),a)}function a(u){return r.parser.lazy[r.now().line]?n(u):t(u)}}const vf={name:"codeIndented",tokenize:$k},jk={partial:!0,tokenize:Vk};function $k(e,t,n){const r=this;return s;function s(f){return e.enter("codeIndented"),tt(e,a,"linePrefix",5)(f)}function a(f){const p=r.events[r.events.length-1];return p&&p[1].type==="linePrefix"&&p[2].sliceSerialize(p[1],!0).length>=4?u(f):n(f)}function u(f){return f===null?d(f):Me(f)?e.attempt(jk,u,d)(f):(e.enter("codeFlowValue"),c(f))}function c(f){return f===null||Me(f)?(e.exit("codeFlowValue"),u(f)):(e.consume(f),c)}function d(f){return e.exit("codeIndented"),t(f)}}function Vk(e,t,n){const r=this;return s;function s(u){return r.parser.lazy[r.now().line]?n(u):Me(u)?(e.enter("lineEnding"),e.consume(u),e.exit("lineEnding"),s):tt(e,a,"linePrefix",5)(u)}function a(u){const c=r.events[r.events.length-1];return c&&c[1].type==="linePrefix"&&c[2].sliceSerialize(c[1],!0).length>=4?t(u):Me(u)?s(u):n(u)}}const qk={name:"codeText",previous:Wk,resolve:Yk,tokenize:Gk};function Yk(e){let t=e.length-4,n=3,r,s;if((e[n][1].type==="lineEnding"||e[n][1].type==="space")&&(e[t][1].type==="lineEnding"||e[t][1].type==="space")){for(r=n;++r<t;)if(e[r][1].type==="codeTextData"){e[n][1].type="codeTextPadding",e[t][1].type="codeTextPadding",n+=2,t-=2;break}}for(r=n-1,t++;++r<=t;)s===void 0?r!==t&&e[r][1].type!=="lineEnding"&&(s=r):(r===t||e[r][1].type==="lineEnding")&&(e[s][1].type="codeTextData",r!==s+2&&(e[s][1].end=e[r-1][1].end,e.splice(s+2,r-s-2),t-=r-s-2,r=s+2),s=void 0);return e}function Wk(e){return e!==96||this.events[this.events.length-1][1].type==="characterEscape"}function Gk(e,t,n){let r=0,s,a;return u;function u(g){return e.enter("codeText"),e.enter("codeTextSequence"),c(g)}function c(g){return g===96?(e.consume(g),r++,c):(e.exit("codeTextSequence"),d(g))}function d(g){return g===null?n(g):g===32?(e.enter("space"),e.consume(g),e.exit("space"),d):g===96?(a=e.enter("codeTextSequence"),s=0,p(g)):Me(g)?(e.enter("lineEnding"),e.consume(g),e.exit("lineEnding"),d):(e.enter("codeTextData"),f(g))}function f(g){return g===null||g===32||g===96||Me(g)?(e.exit("codeTextData"),d(g)):(e.consume(g),f)}function p(g){return g===96?(e.consume(g),s++,p):s===r?(e.exit("codeTextSequence"),e.exit("codeText"),t(g)):(a.type="codeTextData",f(g))}}class Xk{constructor(t){this.left=t?[...t]:[],this.right=[]}get(t){if(t<0||t>=this.left.length+this.right.length)throw new RangeError("Cannot access index `"+t+"` in a splice buffer of size `"+(this.left.length+this.right.length)+"`");return t<this.left.length?this.left[t]:this.right[this.right.length-t+this.left.length-1]}get length(){return this.left.length+this.right.length}shift(){return this.setCursor(0),this.right.pop()}slice(t,n){const r=n==null?Number.POSITIVE_INFINITY:n;return r<this.left.length?this.left.slice(t,r):t>this.left.length?this.right.slice(this.right.length-r+this.left.length,this.right.length-t+this.left.length).reverse():this.left.slice(t).concat(this.right.slice(this.right.length-r+this.left.length).reverse())}splice(t,n,r){const s=n||0;this.setCursor(Math.trunc(t));const a=this.right.splice(this.right.length-s,Number.POSITIVE_INFINITY);return r&&Ea(this.left,r),a.reverse()}pop(){return this.setCursor(Number.POSITIVE_INFINITY),this.left.pop()}push(t){this.setCursor(Number.POSITIVE_INFINITY),this.left.push(t)}pushMany(t){this.setCursor(Number.POSITIVE_INFINITY),Ea(this.left,t)}unshift(t){this.setCursor(0),this.right.push(t)}unshiftMany(t){this.setCursor(0),Ea(this.right,t.reverse())}setCursor(t){if(!(t===this.left.length||t>this.left.length&&this.right.length===0||t<0&&this.left.length===0))if(t<this.left.length){const n=this.left.splice(t,Number.POSITIVE_INFINITY);Ea(this.right,n.reverse())}else{const n=this.right.splice(this.left.length+this.right.length-t,Number.POSITIVE_INFINITY);Ea(this.left,n.reverse())}}}function Ea(e,t){let n=0;if(t.length<1e4)e.push(...t);else for(;n<t.length;)e.push(...t.slice(n,n+1e4)),n+=1e4}function J1(e){const t={};let n=-1,r,s,a,u,c,d,f;const p=new Xk(e);for(;++n<p.length;){for(;n in t;)n=t[n];if(r=p.get(n),n&&r[1].type==="chunkFlow"&&p.get(n-1)[1].type==="listItemPrefix"&&(d=r[1]._tokenizer.events,a=0,a<d.length&&d[a][1].type==="lineEndingBlank"&&(a+=2),a<d.length&&d[a][1].type==="content"))for(;++a<d.length&&d[a][1].type!=="content";)d[a][1].type==="chunkText"&&(d[a][1]._isInFirstContentOfListItem=!0,a++);if(r[0]==="enter")r[1].contentType&&(Object.assign(t,Kk(p,n)),n=t[n],f=!0);else if(r[1]._container){for(a=n,s=void 0;a--;)if(u=p.get(a),u[1].type==="lineEnding"||u[1].type==="lineEndingBlank")u[0]==="enter"&&(s&&(p.get(s)[1].type="lineEndingBlank"),u[1].type="lineEnding",s=a);else if(!(u[1].type==="linePrefix"||u[1].type==="listItemIndent"))break;s&&(r[1].end=U({},p.get(s)[1].start),c=p.slice(s,n),c.unshift(r),p.splice(s,n-s+1,c))}}return Mn(e,0,Number.POSITIVE_INFINITY,p.slice(0)),!f}function Kk(e,t){const n=e.get(t)[1],r=e.get(t)[2];let s=t-1;const a=[];let u=n._tokenizer;u||(u=r.parser[n.contentType](n.start),n._contentTypeTextTrailing&&(u._contentTypeTextTrailing=!0));const c=u.events,d=[],f={};let p,g,b=-1,T=n,_=0,S=0;const C=[S];for(;T;){for(;e.get(++s)[1]!==T;);a.push(s),T._tokenizer||(p=r.sliceStream(T),T.next||p.push(null),g&&u.defineSkip(T.start),T._isInFirstContentOfListItem&&(u._gfmTasklistFirstContentOfListItem=!0),u.write(p),T._isInFirstContentOfListItem&&(u._gfmTasklistFirstContentOfListItem=void 0)),g=T,T=T.next}for(T=n;++b<c.length;)c[b][0]==="exit"&&c[b-1][0]==="enter"&&c[b][1].type===c[b-1][1].type&&c[b][1].start.line!==c[b][1].end.line&&(S=b+1,C.push(S),T._tokenizer=void 0,T.previous=void 0,T=T.next);for(u.events=[],T?(T._tokenizer=void 0,T.previous=void 0):C.pop(),b=C.length;b--;){const N=c.slice(C[b],C[b+1]),D=a.pop();d.push([D,D+N.length-1]),e.splice(D,2,N)}for(d.reverse(),b=-1;++b<d.length;)f[_+d[b][0]]=_+d[b][1],_+=d[b][1]-d[b][0]-1;return f}const Qk={resolve:Zk,tokenize:eN},Jk={partial:!0,tokenize:tN};function Zk(e){return J1(e),e}function eN(e,t){let n;return r;function r(c){return e.enter("content"),n=e.enter("chunkContent",{contentType:"content"}),s(c)}function s(c){return c===null?a(c):Me(c)?e.check(Jk,u,a)(c):(e.consume(c),s)}function a(c){return e.exit("chunkContent"),e.exit("content"),t(c)}function u(c){return e.consume(c),e.exit("chunkContent"),n.next=e.enter("chunkContent",{contentType:"content",previous:n}),n=n.next,s}}function tN(e,t,n){const r=this;return s;function s(u){return e.exit("chunkContent"),e.enter("lineEnding"),e.consume(u),e.exit("lineEnding"),tt(e,a,"linePrefix")}function a(u){if(u===null||Me(u))return n(u);const c=r.events[r.events.length-1];return!r.parser.constructs.disable.null.includes("codeIndented")&&c&&c[1].type==="linePrefix"&&c[2].sliceSerialize(c[1],!0).length>=4?t(u):e.interrupt(r.parser.constructs.flow,n,t)(u)}}function Z1(e,t,n,r,s,a,u,c,d){const f=d||Number.POSITIVE_INFINITY;let p=0;return g;function g(N){return N===60?(e.enter(r),e.enter(s),e.enter(a),e.consume(N),e.exit(a),b):N===null||N===32||N===41||fl(N)?n(N):(e.enter(r),e.enter(u),e.enter(c),e.enter("chunkString",{contentType:"string"}),S(N))}function b(N){return N===62?(e.enter(a),e.consume(N),e.exit(a),e.exit(s),e.exit(r),t):(e.enter(c),e.enter("chunkString",{contentType:"string"}),T(N))}function T(N){return N===62?(e.exit("chunkString"),e.exit(c),b(N)):N===null||N===60||Me(N)?n(N):(e.consume(N),N===92?_:T)}function _(N){return N===60||N===62||N===92?(e.consume(N),T):T(N)}function S(N){return!p&&(N===null||N===41||pt(N))?(e.exit("chunkString"),e.exit(c),e.exit(u),e.exit(r),t(N)):p<f&&N===40?(e.consume(N),p++,S):N===41?(e.consume(N),p--,S):N===null||N===32||N===40||fl(N)?n(N):(e.consume(N),N===92?C:S)}function C(N){return N===40||N===41||N===92?(e.consume(N),S):S(N)}}function eE(e,t,n,r,s,a){const u=this;let c=0,d;return f;function f(T){return e.enter(r),e.enter(s),e.consume(T),e.exit(s),e.enter(a),p}function p(T){return c>999||T===null||T===91||T===93&&!d||T===94&&!c&&"_hiddenFootnoteSupport"in u.parser.constructs?n(T):T===93?(e.exit(a),e.enter(s),e.consume(T),e.exit(s),e.exit(r),t):Me(T)?(e.enter("lineEnding"),e.consume(T),e.exit("lineEnding"),p):(e.enter("chunkString",{contentType:"string"}),g(T))}function g(T){return T===null||T===91||T===93||Me(T)||c++>999?(e.exit("chunkString"),p(T)):(e.consume(T),d||(d=!Je(T)),T===92?b:g)}function b(T){return T===91||T===92||T===93?(e.consume(T),c++,g):g(T)}}function tE(e,t,n,r,s,a){let u;return c;function c(b){return b===34||b===39||b===40?(e.enter(r),e.enter(s),e.consume(b),e.exit(s),u=b===40?41:b,d):n(b)}function d(b){return b===u?(e.enter(s),e.consume(b),e.exit(s),e.exit(r),t):(e.enter(a),f(b))}function f(b){return b===u?(e.exit(a),d(u)):b===null?n(b):Me(b)?(e.enter("lineEnding"),e.consume(b),e.exit("lineEnding"),tt(e,f,"linePrefix")):(e.enter("chunkString",{contentType:"string"}),p(b))}function p(b){return b===u||b===null||Me(b)?(e.exit("chunkString"),f(b)):(e.consume(b),b===92?g:p)}function g(b){return b===u||b===92?(e.consume(b),p):p(b)}}function ya(e,t){let n;return r;function r(s){return Me(s)?(e.enter("lineEnding"),e.consume(s),e.exit("lineEnding"),n=!0,r):Je(s)?tt(e,r,n?"linePrefix":"lineSuffix")(s):t(s)}}const nN={name:"definition",tokenize:iN},rN={partial:!0,tokenize:sN};function iN(e,t,n){const r=this;let s;return a;function a(T){return e.enter("definition"),u(T)}function u(T){return eE.call(r,e,c,n,"definitionLabel","definitionLabelMarker","definitionLabelString")(T)}function c(T){return s=fr(r.sliceSerialize(r.events[r.events.length-1][1]).slice(1,-1)),T===58?(e.enter("definitionMarker"),e.consume(T),e.exit("definitionMarker"),d):n(T)}function d(T){return pt(T)?ya(e,f)(T):f(T)}function f(T){return Z1(e,p,n,"definitionDestination","definitionDestinationLiteral","definitionDestinationLiteralMarker","definitionDestinationRaw","definitionDestinationString")(T)}function p(T){return e.attempt(rN,g,g)(T)}function g(T){return Je(T)?tt(e,b,"whitespace")(T):b(T)}function b(T){return T===null||Me(T)?(e.exit("definition"),r.parser.defined.push(s),t(T)):n(T)}}function sN(e,t,n){return r;function r(c){return pt(c)?ya(e,s)(c):n(c)}function s(c){return tE(e,a,n,"definitionTitle","definitionTitleMarker","definitionTitleString")(c)}function a(c){return Je(c)?tt(e,u,"whitespace")(c):u(c)}function u(c){return c===null||Me(c)?t(c):n(c)}}const oN={name:"hardBreakEscape",tokenize:aN};function aN(e,t,n){return r;function r(a){return e.enter("hardBreakEscape"),e.consume(a),s}function s(a){return Me(a)?(e.exit("hardBreakEscape"),t(a)):n(a)}}const uN={name:"headingAtx",resolve:lN,tokenize:cN};function lN(e,t){let n=e.length-2,r=3,s,a;return e[r][1].type==="whitespace"&&(r+=2),n-2>r&&e[n][1].type==="whitespace"&&(n-=2),e[n][1].type==="atxHeadingSequence"&&(r===n-1||n-4>r&&e[n-2][1].type==="whitespace")&&(n-=r+1===n?2:4),n>r&&(s={type:"atxHeadingText",start:e[r][1].start,end:e[n][1].end},a={type:"chunkText",start:e[r][1].start,end:e[n][1].end,contentType:"text"},Mn(e,r,n-r+1,[["enter",s,t],["enter",a,t],["exit",a,t],["exit",s,t]])),e}function cN(e,t,n){let r=0;return s;function s(p){return e.enter("atxHeading"),a(p)}function a(p){return e.enter("atxHeadingSequence"),u(p)}function u(p){return p===35&&r++<6?(e.consume(p),u):p===null||pt(p)?(e.exit("atxHeadingSequence"),c(p)):n(p)}function c(p){return p===35?(e.enter("atxHeadingSequence"),d(p)):p===null||Me(p)?(e.exit("atxHeading"),t(p)):Je(p)?tt(e,c,"whitespace")(p):(e.enter("atxHeadingText"),f(p))}function d(p){return p===35?(e.consume(p),d):(e.exit("atxHeadingSequence"),c(p))}function f(p){return p===null||p===35||pt(p)?(e.exit("atxHeadingText"),c(p)):(e.consume(p),f)}}const dN=["address","article","aside","base","basefont","blockquote","body","caption","center","col","colgroup","dd","details","dialog","dir","div","dl","dt","fieldset","figcaption","figure","footer","form","frame","frameset","h1","h2","h3","h4","h5","h6","head","header","hr","html","iframe","legend","li","link","main","menu","menuitem","nav","noframes","ol","optgroup","option","p","param","search","section","summary","table","tbody","td","tfoot","th","thead","title","tr","track","ul"],nE=["pre","script","style","textarea"],fN={concrete:!0,name:"htmlFlow",resolveTo:mN,tokenize:gN},hN={partial:!0,tokenize:yN},pN={partial:!0,tokenize:EN};function mN(e){let t=e.length;for(;t--&&!(e[t][0]==="enter"&&e[t][1].type==="htmlFlow"););return t>1&&e[t-2][1].type==="linePrefix"&&(e[t][1].start=e[t-2][1].start,e[t+1][1].start=e[t-2][1].start,e.splice(t-2,2)),e}function gN(e,t,n){const r=this;let s,a,u,c,d;return f;function f(P){return p(P)}function p(P){return e.enter("htmlFlow"),e.enter("htmlFlowData"),e.consume(P),g}function g(P){return P===33?(e.consume(P),b):P===47?(e.consume(P),a=!0,S):P===63?(e.consume(P),s=3,r.interrupt?t:A):En(P)?(e.consume(P),u=String.fromCharCode(P),C):n(P)}function b(P){return P===45?(e.consume(P),s=2,T):P===91?(e.consume(P),s=5,c=0,_):En(P)?(e.consume(P),s=4,r.interrupt?t:A):n(P)}function T(P){return P===45?(e.consume(P),r.interrupt?t:A):n(P)}function _(P){const _e="CDATA[";return P===_e.charCodeAt(c++)?(e.consume(P),c===_e.length?r.interrupt?t:pe:_):n(P)}function S(P){return En(P)?(e.consume(P),u=String.fromCharCode(P),C):n(P)}function C(P){if(P===null||P===47||P===62||pt(P)){const _e=P===47,De=u.toLowerCase();return!_e&&!a&&nE.includes(De)?(s=1,r.interrupt?t(P):pe(P)):dN.includes(u.toLowerCase())?(s=6,_e?(e.consume(P),N):r.interrupt?t(P):pe(P)):(s=7,r.interrupt&&!r.parser.lazy[r.now().line]?n(P):a?D(P):k(P))}return P===45||ln(P)?(e.consume(P),u+=String.fromCharCode(P),C):n(P)}function N(P){return P===62?(e.consume(P),r.interrupt?t:pe):n(P)}function D(P){return Je(P)?(e.consume(P),D):$(P)}function k(P){return P===47?(e.consume(P),$):P===58||P===95||En(P)?(e.consume(P),M):Je(P)?(e.consume(P),k):$(P)}function M(P){return P===45||P===46||P===58||P===95||ln(P)?(e.consume(P),M):Y(P)}function Y(P){return P===61?(e.consume(P),B):Je(P)?(e.consume(P),Y):k(P)}function B(P){return P===null||P===60||P===61||P===62||P===96?n(P):P===34||P===39?(e.consume(P),d=P,te):Je(P)?(e.consume(P),B):ae(P)}function te(P){return P===d?(e.consume(P),d=null,ye):P===null||Me(P)?n(P):(e.consume(P),te)}function ae(P){return P===null||P===34||P===39||P===47||P===60||P===61||P===62||P===96||pt(P)?Y(P):(e.consume(P),ae)}function ye(P){return P===47||P===62||Je(P)?k(P):n(P)}function $(P){return P===62?(e.consume(P),ne):n(P)}function ne(P){return P===null||Me(P)?pe(P):Je(P)?(e.consume(P),ne):n(P)}function pe(P){return P===45&&s===2?(e.consume(P),we):P===60&&s===1?(e.consume(P),ue):P===62&&s===4?(e.consume(P),L):P===63&&s===3?(e.consume(P),A):P===93&&s===5?(e.consume(P),re):Me(P)&&(s===6||s===7)?(e.exit("htmlFlowData"),e.check(hN,Z,fe)(P)):P===null||Me(P)?(e.exit("htmlFlowData"),fe(P)):(e.consume(P),pe)}function fe(P){return e.check(pN,le,Z)(P)}function le(P){return e.enter("lineEnding"),e.consume(P),e.exit("lineEnding"),Te}function Te(P){return P===null||Me(P)?fe(P):(e.enter("htmlFlowData"),pe(P))}function we(P){return P===45?(e.consume(P),A):pe(P)}function ue(P){return P===47?(e.consume(P),u="",G):pe(P)}function G(P){if(P===62){const _e=u.toLowerCase();return nE.includes(_e)?(e.consume(P),L):pe(P)}return En(P)&&u.length<8?(e.consume(P),u+=String.fromCharCode(P),G):pe(P)}function re(P){return P===93?(e.consume(P),A):pe(P)}function A(P){return P===62?(e.consume(P),L):P===45&&s===2?(e.consume(P),A):pe(P)}function L(P){return P===null||Me(P)?(e.exit("htmlFlowData"),Z(P)):(e.consume(P),L)}function Z(P){return e.exit("htmlFlow"),t(P)}}function EN(e,t,n){const r=this;return s;function s(u){return Me(u)?(e.enter("lineEnding"),e.consume(u),e.exit("lineEnding"),a):n(u)}function a(u){return r.parser.lazy[r.now().line]?n(u):t(u)}}function yN(e,t,n){return r;function r(s){return e.enter("lineEnding"),e.consume(s),e.exit("lineEnding"),e.attempt(ga,t,n)}}const TN={name:"htmlText",tokenize:bN};function bN(e,t,n){const r=this;let s,a,u;return c;function c(A){return e.enter("htmlText"),e.enter("htmlTextData"),e.consume(A),d}function d(A){return A===33?(e.consume(A),f):A===47?(e.consume(A),Y):A===63?(e.consume(A),k):En(A)?(e.consume(A),ae):n(A)}function f(A){return A===45?(e.consume(A),p):A===91?(e.consume(A),a=0,_):En(A)?(e.consume(A),D):n(A)}function p(A){return A===45?(e.consume(A),T):n(A)}function g(A){return A===null?n(A):A===45?(e.consume(A),b):Me(A)?(u=g,ue(A)):(e.consume(A),g)}function b(A){return A===45?(e.consume(A),T):g(A)}function T(A){return A===62?we(A):A===45?b(A):g(A)}function _(A){const L="CDATA[";return A===L.charCodeAt(a++)?(e.consume(A),a===L.length?S:_):n(A)}function S(A){return A===null?n(A):A===93?(e.consume(A),C):Me(A)?(u=S,ue(A)):(e.consume(A),S)}function C(A){return A===93?(e.consume(A),N):S(A)}function N(A){return A===62?we(A):A===93?(e.consume(A),N):S(A)}function D(A){return A===null||A===62?we(A):Me(A)?(u=D,ue(A)):(e.consume(A),D)}function k(A){return A===null?n(A):A===63?(e.consume(A),M):Me(A)?(u=k,ue(A)):(e.consume(A),k)}function M(A){return A===62?we(A):k(A)}function Y(A){return En(A)?(e.consume(A),B):n(A)}function B(A){return A===45||ln(A)?(e.consume(A),B):te(A)}function te(A){return Me(A)?(u=te,ue(A)):Je(A)?(e.consume(A),te):we(A)}function ae(A){return A===45||ln(A)?(e.consume(A),ae):A===47||A===62||pt(A)?ye(A):n(A)}function ye(A){return A===47?(e.consume(A),we):A===58||A===95||En(A)?(e.consume(A),$):Me(A)?(u=ye,ue(A)):Je(A)?(e.consume(A),ye):we(A)}function $(A){return A===45||A===46||A===58||A===95||ln(A)?(e.consume(A),$):ne(A)}function ne(A){return A===61?(e.consume(A),pe):Me(A)?(u=ne,ue(A)):Je(A)?(e.consume(A),ne):ye(A)}function pe(A){return A===null||A===60||A===61||A===62||A===96?n(A):A===34||A===39?(e.consume(A),s=A,fe):Me(A)?(u=pe,ue(A)):Je(A)?(e.consume(A),pe):(e.consume(A),le)}function fe(A){return A===s?(e.consume(A),s=void 0,Te):A===null?n(A):Me(A)?(u=fe,ue(A)):(e.consume(A),fe)}function le(A){return A===null||A===34||A===39||A===60||A===61||A===96?n(A):A===47||A===62||pt(A)?ye(A):(e.consume(A),le)}function Te(A){return A===47||A===62||pt(A)?ye(A):n(A)}function we(A){return A===62?(e.consume(A),e.exit("htmlTextData"),e.exit("htmlText"),t):n(A)}function ue(A){return e.exit("htmlTextData"),e.enter("lineEnding"),e.consume(A),e.exit("lineEnding"),G}function G(A){return Je(A)?tt(e,re,"linePrefix",r.parser.constructs.disable.null.includes("codeIndented")?void 0:4)(A):re(A)}function re(A){return e.enter("htmlTextData"),u(A)}}const kf={name:"labelEnd",resolveAll:wN,resolveTo:CN,tokenize:AN},_N={tokenize:vN},SN={tokenize:kN},xN={tokenize:NN};function wN(e){let t=-1;const n=[];for(;++t<e.length;){const r=e[t][1];if(n.push(e[t]),r.type==="labelImage"||r.type==="labelLink"||r.type==="labelEnd"){const s=r.type==="labelImage"?4:2;r.type="data",t+=s}}return e.length!==n.length&&Mn(e,0,e.length,n),e}function CN(e,t){let n=e.length,r=0,s,a,u,c;for(;n--;)if(s=e[n][1],a){if(s.type==="link"||s.type==="labelLink"&&s._inactive)break;e[n][0]==="enter"&&s.type==="labelLink"&&(s._inactive=!0)}else if(u){if(e[n][0]==="enter"&&(s.type==="labelImage"||s.type==="labelLink")&&!s._balanced&&(a=n,s.type!=="labelLink")){r=2;break}}else s.type==="labelEnd"&&(u=n);const d={type:e[a][1].type==="labelLink"?"link":"image",start:U({},e[a][1].start),end:U({},e[e.length-1][1].end)},f={type:"label",start:U({},e[a][1].start),end:U({},e[u][1].end)},p={type:"labelText",start:U({},e[a+r+2][1].end),end:U({},e[u-2][1].start)};return c=[["enter",d,t],["enter",f,t]],c=Xn(c,e.slice(a+1,a+r+3)),c=Xn(c,[["enter",p,t]]),c=Xn(c,pl(t.parser.constructs.insideSpan.null,e.slice(a+r+4,u-3),t)),c=Xn(c,[["exit",p,t],e[u-2],e[u-1],["exit",f,t]]),c=Xn(c,e.slice(u+1)),c=Xn(c,[["exit",d,t]]),Mn(e,a,e.length,c),e}function AN(e,t,n){const r=this;let s=r.events.length,a,u;for(;s--;)if((r.events[s][1].type==="labelImage"||r.events[s][1].type==="labelLink")&&!r.events[s][1]._balanced){a=r.events[s][1];break}return c;function c(b){return a?a._inactive?g(b):(u=r.parser.defined.includes(fr(r.sliceSerialize({start:a.end,end:r.now()}))),e.enter("labelEnd"),e.enter("labelMarker"),e.consume(b),e.exit("labelMarker"),e.exit("labelEnd"),d):n(b)}function d(b){return b===40?e.attempt(_N,p,u?p:g)(b):b===91?e.attempt(SN,p,u?f:g)(b):u?p(b):g(b)}function f(b){return e.attempt(xN,p,g)(b)}function p(b){return t(b)}function g(b){return a._balanced=!0,n(b)}}function vN(e,t,n){return r;function r(g){return e.enter("resource"),e.enter("resourceMarker"),e.consume(g),e.exit("resourceMarker"),s}function s(g){return pt(g)?ya(e,a)(g):a(g)}function a(g){return g===41?p(g):Z1(e,u,c,"resourceDestination","resourceDestinationLiteral","resourceDestinationLiteralMarker","resourceDestinationRaw","resourceDestinationString",32)(g)}function u(g){return pt(g)?ya(e,d)(g):p(g)}function c(g){return n(g)}function d(g){return g===34||g===39||g===40?tE(e,f,n,"resourceTitle","resourceTitleMarker","resourceTitleString")(g):p(g)}function f(g){return pt(g)?ya(e,p)(g):p(g)}function p(g){return g===41?(e.enter("resourceMarker"),e.consume(g),e.exit("resourceMarker"),e.exit("resource"),t):n(g)}}function kN(e,t,n){const r=this;return s;function s(c){return eE.call(r,e,a,u,"reference","referenceMarker","referenceString")(c)}function a(c){return r.parser.defined.includes(fr(r.sliceSerialize(r.events[r.events.length-1][1]).slice(1,-1)))?t(c):n(c)}function u(c){return n(c)}}function NN(e,t,n){return r;function r(a){return e.enter("reference"),e.enter("referenceMarker"),e.consume(a),e.exit("referenceMarker"),s}function s(a){return a===93?(e.enter("referenceMarker"),e.consume(a),e.exit("referenceMarker"),e.exit("reference"),t):n(a)}}const ON={name:"labelStartImage",resolveAll:kf.resolveAll,tokenize:PN};function PN(e,t,n){const r=this;return s;function s(c){return e.enter("labelImage"),e.enter("labelImageMarker"),e.consume(c),e.exit("labelImageMarker"),a}function a(c){return c===91?(e.enter("labelMarker"),e.consume(c),e.exit("labelMarker"),e.exit("labelImage"),u):n(c)}function u(c){return c===94&&"_hiddenFootnoteSupport"in r.parser.constructs?n(c):t(c)}}const IN={name:"labelStartLink",resolveAll:kf.resolveAll,tokenize:RN};function RN(e,t,n){const r=this;return s;function s(u){return e.enter("labelLink"),e.enter("labelMarker"),e.consume(u),e.exit("labelMarker"),e.exit("labelLink"),a}function a(u){return u===94&&"_hiddenFootnoteSupport"in r.parser.constructs?n(u):t(u)}}const Nf={name:"lineEnding",tokenize:LN};function LN(e,t){return n;function n(r){return e.enter("lineEnding"),e.consume(r),e.exit("lineEnding"),tt(e,t,"linePrefix")}}const ml={name:"thematicBreak",tokenize:DN};function DN(e,t,n){let r=0,s;return a;function a(f){return e.enter("thematicBreak"),u(f)}function u(f){return s=f,c(f)}function c(f){return f===s?(e.enter("thematicBreakSequence"),d(f)):r>=3&&(f===null||Me(f))?(e.exit("thematicBreak"),t(f)):n(f)}function d(f){return f===s?(e.consume(f),r++,d):(e.exit("thematicBreakSequence"),Je(f)?tt(e,c,"whitespace")(f):c(f))}}const Cn={continuation:{tokenize:UN},exit:zN,name:"list",tokenize:BN},MN={partial:!0,tokenize:jN},FN={partial:!0,tokenize:HN};function BN(e,t,n){const r=this,s=r.events[r.events.length-1];let a=s&&s[1].type==="linePrefix"?s[2].sliceSerialize(s[1],!0).length:0,u=0;return c;function c(T){const _=r.containerState.type||(T===42||T===43||T===45?"listUnordered":"listOrdered");if(_==="listUnordered"?!r.containerState.marker||T===r.containerState.marker:Cf(T)){if(r.containerState.type||(r.containerState.type=_,e.enter(_,{_container:!0})),_==="listUnordered")return e.enter("listItemPrefix"),T===42||T===45?e.check(ml,n,f)(T):f(T);if(!r.interrupt||T===49)return e.enter("listItemPrefix"),e.enter("listItemValue"),d(T)}return n(T)}function d(T){return Cf(T)&&++u<10?(e.consume(T),d):(!r.interrupt||u<2)&&(r.containerState.marker?T===r.containerState.marker:T===41||T===46)?(e.exit("listItemValue"),f(T)):n(T)}function f(T){return e.enter("listItemMarker"),e.consume(T),e.exit("listItemMarker"),r.containerState.marker=r.containerState.marker||T,e.check(ga,r.interrupt?n:p,e.attempt(MN,b,g))}function p(T){return r.containerState.initialBlankLine=!0,a++,b(T)}function g(T){return Je(T)?(e.enter("listItemPrefixWhitespace"),e.consume(T),e.exit("listItemPrefixWhitespace"),b):n(T)}function b(T){return r.containerState.size=a+r.sliceSerialize(e.exit("listItemPrefix"),!0).length,t(T)}}function UN(e,t,n){const r=this;return r.containerState._closeFlow=void 0,e.check(ga,s,a);function s(c){return r.containerState.furtherBlankLines=r.containerState.furtherBlankLines||r.containerState.initialBlankLine,tt(e,t,"listItemIndent",r.containerState.size+1)(c)}function a(c){return r.containerState.furtherBlankLines||!Je(c)?(r.containerState.furtherBlankLines=void 0,r.containerState.initialBlankLine=void 0,u(c)):(r.containerState.furtherBlankLines=void 0,r.containerState.initialBlankLine=void 0,e.attempt(FN,t,u)(c))}function u(c){return r.containerState._closeFlow=!0,r.interrupt=void 0,tt(e,e.attempt(Cn,t,n),"linePrefix",r.parser.constructs.disable.null.includes("codeIndented")?void 0:4)(c)}}function HN(e,t,n){const r=this;return tt(e,s,"listItemIndent",r.containerState.size+1);function s(a){const u=r.events[r.events.length-1];return u&&u[1].type==="listItemIndent"&&u[2].sliceSerialize(u[1],!0).length===r.containerState.size?t(a):n(a)}}function zN(e){e.exit(this.containerState.type)}function jN(e,t,n){const r=this;return tt(e,s,"listItemPrefixWhitespace",r.parser.constructs.disable.null.includes("codeIndented")?void 0:5);function s(a){const u=r.events[r.events.length-1];return!Je(a)&&u&&u[1].type==="listItemPrefixWhitespace"?t(a):n(a)}}const rE={name:"setextUnderline",resolveTo:$N,tokenize:VN};function $N(e,t){let n=e.length,r,s,a;for(;n--;)if(e[n][0]==="enter"){if(e[n][1].type==="content"){r=n;break}e[n][1].type==="paragraph"&&(s=n)}else e[n][1].type==="content"&&e.splice(n,1),!a&&e[n][1].type==="definition"&&(a=n);const u={type:"setextHeading",start:U({},e[r][1].start),end:U({},e[e.length-1][1].end)};return e[s][1].type="setextHeadingText",a?(e.splice(s,0,["enter",u,t]),e.splice(a+1,0,["exit",e[r][1],t]),e[r][1].end=U({},e[a][1].end)):e[r][1]=u,e.push(["exit",u,t]),e}function VN(e,t,n){const r=this;let s;return a;function a(f){let p=r.events.length,g;for(;p--;)if(r.events[p][1].type!=="lineEnding"&&r.events[p][1].type!=="linePrefix"&&r.events[p][1].type!=="content"){g=r.events[p][1].type==="paragraph";break}return!r.parser.lazy[r.now().line]&&(r.interrupt||g)?(e.enter("setextHeadingLine"),s=f,u(f)):n(f)}function u(f){return e.enter("setextHeadingLineSequence"),c(f)}function c(f){return f===s?(e.consume(f),c):(e.exit("setextHeadingLineSequence"),Je(f)?tt(e,d,"lineSuffix")(f):d(f))}function d(f){return f===null||Me(f)?(e.exit("setextHeadingLine"),t(f)):n(f)}}const qN={tokenize:YN};function YN(e){const t=this,n=e.attempt(ga,r,e.attempt(this.parser.constructs.flowInitial,s,tt(e,e.attempt(this.parser.constructs.flow,s,e.attempt(Qk,s)),"linePrefix")));return n;function r(a){if(a===null){e.consume(a);return}return e.enter("lineEndingBlank"),e.consume(a),e.exit("lineEndingBlank"),t.currentConstruct=void 0,n}function s(a){if(a===null){e.consume(a);return}return e.enter("lineEnding"),e.consume(a),e.exit("lineEnding"),t.currentConstruct=void 0,n}}const WN={resolveAll:sE()},GN=iE("string"),XN=iE("text");function iE(e){return{resolveAll:sE(e==="text"?KN:void 0),tokenize:t};function t(n){const r=this,s=this.parser.constructs[e],a=n.attempt(s,u,c);return u;function u(p){return f(p)?a(p):c(p)}function c(p){if(p===null){n.consume(p);return}return n.enter("data"),n.consume(p),d}function d(p){return f(p)?(n.exit("data"),a(p)):(n.consume(p),d)}function f(p){if(p===null)return!0;const g=s[p];let b=-1;if(g)for(;++b<g.length;){const T=g[b];if(!T.previous||T.previous.call(r,r.previous))return!0}return!1}}}function sE(e){return t;function t(n,r){let s=-1,a;for(;++s<=n.length;)a===void 0?n[s]&&n[s][1].type==="data"&&(a=s,s++):(!n[s]||n[s][1].type!=="data")&&(s!==a+2&&(n[a][1].end=n[s-1][1].end,n.splice(a+2,s-a-2),s=a+2),a=void 0);return e?e(n,r):n}}function KN(e,t){let n=0;for(;++n<=e.length;)if((n===e.length||e[n][1].type==="lineEnding")&&e[n-1][1].type==="data"){const r=e[n-1][1],s=t.sliceStream(r);let a=s.length,u=-1,c=0,d;for(;a--;){const f=s[a];if(typeof f=="string"){for(u=f.length;f.charCodeAt(u-1)===32;)c++,u--;if(u)break;u=-1}else if(f===-2)d=!0,c++;else if(f!==-1){a++;break}}if(t._contentTypeTextTrailing&&n===e.length&&(c=0),c){const f={type:n===e.length||d||c<2?"lineSuffix":"hardBreakTrailing",start:{_bufferIndex:a?u:r.start._bufferIndex+u,_index:r.start._index+a,line:r.end.line,column:r.end.column-c,offset:r.end.offset-c},end:U({},r.end)};r.end=U({},f.start),r.start.offset===r.end.offset?Object.assign(r,f):(e.splice(n,0,["enter",f,t],["exit",f,t]),n+=2)}n++}return e}const QN=Object.freeze(Object.defineProperty({__proto__:null,attentionMarkers:{null:[42,95]},contentInitial:{91:nN},disable:{null:[]},document:{42:Cn,43:Cn,45:Cn,48:Cn,49:Cn,50:Cn,51:Cn,52:Cn,53:Cn,54:Cn,55:Cn,56:Cn,57:Cn,62:W1},flow:{35:uN,42:ml,45:[rE,ml],60:fN,61:rE,95:ml,96:Q1,126:Q1},flowInitial:{[-2]:vf,[-1]:vf,32:vf},insideSpan:{null:[Af,WN]},string:{38:X1,92:G1},text:{[-5]:Nf,[-4]:Nf,[-3]:Nf,33:ON,38:X1,42:Af,60:[Ik,TN],91:IN,92:[oN,G1],93:kf,95:Af,96:qk}},Symbol.toStringTag,{value:"Module"}));function JN(e,t,n){let r={_bufferIndex:-1,_index:0,line:n&&n.line||1,column:n&&n.column||1,offset:n&&n.offset||0};const s={},a=[];let u=[],c=[];const d={attempt:te(Y),check:te(B),consume:D,enter:k,exit:M,interrupt:te(B,{interrupt:!0})},f={code:null,containerState:{},defineSkip:S,events:[],now:_,parser:e,previous:null,sliceSerialize:b,sliceStream:T,write:g};let p=t.tokenize.call(f,d);return t.resolveAll&&a.push(t),f;function g(ne){return u=Xn(u,ne),C(),u[u.length-1]!==null?[]:(ae(t,0),f.events=pl(a,f.events,f),f.events)}function b(ne,pe){return eO(T(ne),pe)}function T(ne){return ZN(u,ne)}function _(){const{_bufferIndex:ne,_index:pe,line:fe,column:le,offset:Te}=r;return{_bufferIndex:ne,_index:pe,line:fe,column:le,offset:Te}}function S(ne){s[ne.line]=ne.column,$()}function C(){let ne;for(;r._index<u.length;){const pe=u[r._index];if(typeof pe=="string")for(ne=r._index,r._bufferIndex<0&&(r._bufferIndex=0);r._index===ne&&r._bufferIndex<pe.length;)N(pe.charCodeAt(r._bufferIndex));else N(pe)}}function N(ne){p=p(ne)}function D(ne){Me(ne)?(r.line++,r.column=1,r.offset+=ne===-3?2:1,$()):ne!==-1&&(r.column++,r.offset++),r._bufferIndex<0?r._index++:(r._bufferIndex++,r._bufferIndex===u[r._index].length&&(r._bufferIndex=-1,r._index++)),f.previous=ne}function k(ne,pe){const fe=pe||{};return fe.type=ne,fe.start=_(),f.events.push(["enter",fe,f]),c.push(fe),fe}function M(ne){const pe=c.pop();return pe.end=_(),f.events.push(["exit",pe,f]),pe}function Y(ne,pe){ae(ne,pe.from)}function B(ne,pe){pe.restore()}function te(ne,pe){return fe;function fe(le,Te,we){let ue,G,re,A;return Array.isArray(le)?Z(le):"tokenize"in le?Z([le]):L(le);function L(Ie){return Xe;function Xe(We){const nt=We!==null&&Ie[We],vt=We!==null&&Ie.null,Zn=[...Array.isArray(nt)?nt:nt?[nt]:[],...Array.isArray(vt)?vt:vt?[vt]:[]];return Z(Zn)(We)}}function Z(Ie){return ue=Ie,G=0,Ie.length===0?we:P(Ie[G])}function P(Ie){return Xe;function Xe(We){return A=ye(),re=Ie,Ie.partial||(f.currentConstruct=Ie),Ie.name&&f.parser.constructs.disable.null.includes(Ie.name)?De():Ie.tokenize.call(pe?Object.assign(Object.create(f),pe):f,d,_e,De)(We)}}function _e(Ie){return ne(re,A),Te}function De(Ie){return A.restore(),++G<ue.length?P(ue[G]):we}}}function ae(ne,pe){ne.resolveAll&&!a.includes(ne)&&a.push(ne),ne.resolve&&Mn(f.events,pe,f.events.length-pe,ne.resolve(f.events.slice(pe),f)),ne.resolveTo&&(f.events=ne.resolveTo(f.events,f))}function ye(){const ne=_(),pe=f.previous,fe=f.currentConstruct,le=f.events.length,Te=Array.from(c);return{from:le,restore:we};function we(){r=ne,f.previous=pe,f.currentConstruct=fe,f.events.length=le,c=Te,$()}}function $(){r.line in s&&r.column<2&&(r.column=s[r.line],r.offset+=s[r.line]-1)}}function ZN(e,t){const n=t.start._index,r=t.start._bufferIndex,s=t.end._index,a=t.end._bufferIndex;let u;if(n===s)u=[e[n].slice(r,a)];else{if(u=e.slice(n,s),r>-1){const c=u[0];typeof c=="string"?u[0]=c.slice(r):u.shift()}a>0&&u.push(e[s].slice(0,a))}return u}function eO(e,t){let n=-1;const r=[];let s;for(;++n<e.length;){const a=e[n];let u;if(typeof a=="string")u=a;else switch(a){case-5:{u="\r";break}case-4:{u=`
|
|
12
12
|
`;break}case-3:{u=`\r
|
|
13
13
|
`;break}case-2:{u=t?" ":" ";break}case-1:{if(!t&&s)continue;u=" ";break}default:u=String.fromCharCode(a)}s=a===-2,r.push(u)}return r.join("")}function tO(e){const r={constructs:$1([QN,...(e||{}).extensions||[]]),content:s(Ck),defined:[],document:s(vk),flow:s(qN),lazy:{},string:s(GN),text:s(XN)};return r;function s(a){return u;function u(c){return JN(r,a,c)}}}function nO(e){for(;!J1(e););return e}const oE=/[\0\t\n\r]/g;function rO(){let e=1,t="",n=!0,r;return s;function s(a,u,c){const d=[];let f,p,g,b,T;for(a=t+(typeof a=="string"?a.toString():new TextDecoder(u||void 0).decode(a)),g=0,t="",n&&(a.charCodeAt(0)===65279&&g++,n=void 0);g<a.length;){if(oE.lastIndex=g,f=oE.exec(a),b=f&&f.index!==void 0?f.index:a.length,T=a.charCodeAt(b),!f){t=a.slice(g);break}if(T===10&&g===b&&r)d.push(-3),r=void 0;else switch(r&&(d.push(-5),r=void 0),g<b&&(d.push(a.slice(g,b)),e+=b-g),T){case 0:{d.push(65533),e++;break}case 9:{for(p=Math.ceil(e/4)*4,d.push(-2);e++<p;)d.push(-1);break}case 10:{d.push(-4),e=1;break}default:r=!0,e=1}g=b+1}return c&&(r&&d.push(-5),t&&d.push(t),d.push(null)),d}}const iO=/\\([!-/:-@[-`{-~])|&(#(?:\d{1,7}|x[\da-f]{1,6})|[\da-z]{1,31});/gi;function sO(e){return e.replace(iO,oO)}function oO(e,t,n){if(t)return t;if(n.charCodeAt(0)===35){const s=n.charCodeAt(1),a=s===120||s===88;return V1(n.slice(a?2:1),a?16:10)}return wf(n)||e}const aE={}.hasOwnProperty;function aO(e,t,n){return typeof t!="string"&&(n=t,t=void 0),uO(n)(nO(tO(n).document().write(rO()(e,t,!0))))}function uO(e){const t={transforms:[],canContainEols:["emphasis","fragment","heading","paragraph","strong"],enter:{autolink:a(Re),autolinkProtocol:ye,autolinkEmail:ye,atxHeading:a(vi),blockQuote:a(vt),characterEscape:ye,characterReference:ye,codeFenced:a(Zn),codeFencedFenceInfo:u,codeFencedFenceMeta:u,codeIndented:a(Zn,u),codeText:a(gs,u),codeTextData:ye,data:ye,codeFlowValue:ye,definition:a(ri),definitionDestinationString:u,definitionLabelString:u,definitionTitleString:u,emphasis:a(Es),hardBreakEscape:a(ki),hardBreakTrailing:a(ki),htmlFlow:a(Ce,u),htmlFlowData:ye,htmlText:a(Ce,u),htmlTextData:ye,image:a(Fe),label:u,link:a(Re),listItem:a(st),listItemValue:b,listOrdered:a(Ke,g),listUnordered:a(Ke),paragraph:a(ft),reference:P,referenceString:u,resourceDestinationString:u,resourceTitleString:u,setextHeading:a(vi),strong:a(yn),thematicBreak:a(dn)},exit:{atxHeading:d(),atxHeadingSequence:Y,autolink:d(),autolinkEmail:nt,autolinkProtocol:We,blockQuote:d(),characterEscapeValue:$,characterReferenceMarkerHexadecimal:De,characterReferenceMarkerNumeric:De,characterReferenceValue:Ie,characterReference:Xe,codeFenced:d(C),codeFencedFence:S,codeFencedFenceInfo:T,codeFencedFenceMeta:_,codeFlowValue:$,codeIndented:d(N),codeText:d(Te),codeTextData:$,data:$,definition:d(),definitionDestinationString:M,definitionLabelString:D,definitionTitleString:k,emphasis:d(),hardBreakEscape:d(pe),hardBreakTrailing:d(pe),htmlFlow:d(fe),htmlFlowData:$,htmlText:d(le),htmlTextData:$,image:d(ue),label:re,labelText:G,lineEnding:ne,link:d(we),listItem:d(),listOrdered:d(),listUnordered:d(),paragraph:d(),referenceString:_e,resourceDestinationString:A,resourceTitleString:L,resource:Z,setextHeading:d(ae),setextHeadingLineSequence:te,setextHeadingText:B,strong:d(),thematicBreak:d()}};uE(t,(e||{}).mdastExtensions||[]);const n={};return r;function r(Q){let he={type:"root",children:[]};const Oe={stack:[he],tokenStack:[],config:t,enter:c,exit:f,buffer:u,resume:p,data:n},$e=[];let qe=-1;for(;++qe<Q.length;)if(Q[qe][1].type==="listOrdered"||Q[qe][1].type==="listUnordered")if(Q[qe][0]==="enter")$e.push(qe);else{const jt=$e.pop();qe=s(Q,jt,qe)}for(qe=-1;++qe<Q.length;){const jt=t[Q[qe][0]];aE.call(jt,Q[qe][1].type)&&jt[Q[qe][1].type].call(Object.assign({sliceSerialize:Q[qe][2].sliceSerialize},Oe),Q[qe][1])}if(Oe.tokenStack.length>0){const jt=Oe.tokenStack[Oe.tokenStack.length-1];(jt[1]||lE).call(Oe,void 0,jt[0])}for(he.position={start:Ti(Q.length>0?Q[0][1].start:{line:1,column:1,offset:0}),end:Ti(Q.length>0?Q[Q.length-2][1].end:{line:1,column:1,offset:0})},qe=-1;++qe<t.transforms.length;)he=t.transforms[qe](he)||he;return he}function s(Q,he,Oe){let $e=he-1,qe=-1,jt=!1,ii,er,Ni,ys;for(;++$e<=Oe;){const tn=Q[$e];switch(tn[1].type){case"listUnordered":case"listOrdered":case"blockQuote":{tn[0]==="enter"?qe++:qe--,ys=void 0;break}case"lineEndingBlank":{tn[0]==="enter"&&(ii&&!ys&&!qe&&!Ni&&(Ni=$e),ys=void 0);break}case"linePrefix":case"listItemValue":case"listItemMarker":case"listItemPrefix":case"listItemPrefixWhitespace":break;default:ys=void 0}if(!qe&&tn[0]==="enter"&&tn[1].type==="listItemPrefix"||qe===-1&&tn[0]==="exit"&&(tn[1].type==="listUnordered"||tn[1].type==="listOrdered")){if(ii){let Ur=$e;for(er=void 0;Ur--;){const Hn=Q[Ur];if(Hn[1].type==="lineEnding"||Hn[1].type==="lineEndingBlank"){if(Hn[0]==="exit")continue;er&&(Q[er][1].type="lineEndingBlank",jt=!0),Hn[1].type="lineEnding",er=Ur}else if(!(Hn[1].type==="linePrefix"||Hn[1].type==="blockQuotePrefix"||Hn[1].type==="blockQuotePrefixWhitespace"||Hn[1].type==="blockQuoteMarker"||Hn[1].type==="listItemIndent"))break}Ni&&(!er||Ni<er)&&(ii._spread=!0),ii.end=Object.assign({},er?Q[er][1].start:tn[1].end),Q.splice(er||$e,0,["exit",ii,tn[2]]),$e++,Oe++}if(tn[1].type==="listItemPrefix"){const Ur={type:"listItem",_spread:!1,start:Object.assign({},tn[1].start),end:void 0};ii=Ur,Q.splice($e,0,["enter",Ur,tn[2]]),$e++,Oe++,Ni=void 0,ys=!0}}}return Q[he][1]._spread=jt,Oe}function a(Q,he){return Oe;function Oe($e){c.call(this,Q($e),$e),he&&he.call(this,$e)}}function u(){this.stack.push({type:"fragment",children:[]})}function c(Q,he,Oe){this.stack[this.stack.length-1].children.push(Q),this.stack.push(Q),this.tokenStack.push([he,Oe||void 0]),Q.position={start:Ti(he.start),end:void 0}}function d(Q){return he;function he(Oe){Q&&Q.call(this,Oe),f.call(this,Oe)}}function f(Q,he){const Oe=this.stack.pop(),$e=this.tokenStack.pop();if($e)$e[0].type!==Q.type&&(he?he.call(this,Q,$e[0]):($e[1]||lE).call(this,Q,$e[0]));else throw new Error("Cannot close `"+Q.type+"` ("+pa({start:Q.start,end:Q.end})+"): it’s not open");Oe.position.end=Ti(Q.end)}function p(){return xf(this.stack.pop())}function g(){this.data.expectingFirstListItemValue=!0}function b(Q){if(this.data.expectingFirstListItemValue){const he=this.stack[this.stack.length-2];he.start=Number.parseInt(this.sliceSerialize(Q),10),this.data.expectingFirstListItemValue=void 0}}function T(){const Q=this.resume(),he=this.stack[this.stack.length-1];he.lang=Q}function _(){const Q=this.resume(),he=this.stack[this.stack.length-1];he.meta=Q}function S(){this.data.flowCodeInside||(this.buffer(),this.data.flowCodeInside=!0)}function C(){const Q=this.resume(),he=this.stack[this.stack.length-1];he.value=Q.replace(/^(\r?\n|\r)|(\r?\n|\r)$/g,""),this.data.flowCodeInside=void 0}function N(){const Q=this.resume(),he=this.stack[this.stack.length-1];he.value=Q.replace(/(\r?\n|\r)$/g,"")}function D(Q){const he=this.resume(),Oe=this.stack[this.stack.length-1];Oe.label=he,Oe.identifier=fr(this.sliceSerialize(Q)).toLowerCase()}function k(){const Q=this.resume(),he=this.stack[this.stack.length-1];he.title=Q}function M(){const Q=this.resume(),he=this.stack[this.stack.length-1];he.url=Q}function Y(Q){const he=this.stack[this.stack.length-1];if(!he.depth){const Oe=this.sliceSerialize(Q).length;he.depth=Oe}}function B(){this.data.setextHeadingSlurpLineEnding=!0}function te(Q){const he=this.stack[this.stack.length-1];he.depth=this.sliceSerialize(Q).codePointAt(0)===61?1:2}function ae(){this.data.setextHeadingSlurpLineEnding=void 0}function ye(Q){const Oe=this.stack[this.stack.length-1].children;let $e=Oe[Oe.length-1];(!$e||$e.type!=="text")&&($e=kt(),$e.position={start:Ti(Q.start),end:void 0},Oe.push($e)),this.stack.push($e)}function $(Q){const he=this.stack.pop();he.value+=this.sliceSerialize(Q),he.position.end=Ti(Q.end)}function ne(Q){const he=this.stack[this.stack.length-1];if(this.data.atHardBreak){const Oe=he.children[he.children.length-1];Oe.position.end=Ti(Q.end),this.data.atHardBreak=void 0;return}!this.data.setextHeadingSlurpLineEnding&&t.canContainEols.includes(he.type)&&(ye.call(this,Q),$.call(this,Q))}function pe(){this.data.atHardBreak=!0}function fe(){const Q=this.resume(),he=this.stack[this.stack.length-1];he.value=Q}function le(){const Q=this.resume(),he=this.stack[this.stack.length-1];he.value=Q}function Te(){const Q=this.resume(),he=this.stack[this.stack.length-1];he.value=Q}function we(){const Q=this.stack[this.stack.length-1];if(this.data.inReference){const he=this.data.referenceType||"shortcut";Q.type+="Reference",Q.referenceType=he,delete Q.url,delete Q.title}else delete Q.identifier,delete Q.label;this.data.referenceType=void 0}function ue(){const Q=this.stack[this.stack.length-1];if(this.data.inReference){const he=this.data.referenceType||"shortcut";Q.type+="Reference",Q.referenceType=he,delete Q.url,delete Q.title}else delete Q.identifier,delete Q.label;this.data.referenceType=void 0}function G(Q){const he=this.sliceSerialize(Q),Oe=this.stack[this.stack.length-2];Oe.label=sO(he),Oe.identifier=fr(he).toLowerCase()}function re(){const Q=this.stack[this.stack.length-1],he=this.resume(),Oe=this.stack[this.stack.length-1];if(this.data.inReference=!0,Oe.type==="link"){const $e=Q.children;Oe.children=$e}else Oe.alt=he}function A(){const Q=this.resume(),he=this.stack[this.stack.length-1];he.url=Q}function L(){const Q=this.resume(),he=this.stack[this.stack.length-1];he.title=Q}function Z(){this.data.inReference=void 0}function P(){this.data.referenceType="collapsed"}function _e(Q){const he=this.resume(),Oe=this.stack[this.stack.length-1];Oe.label=he,Oe.identifier=fr(this.sliceSerialize(Q)).toLowerCase(),this.data.referenceType="full"}function De(Q){this.data.characterReferenceType=Q.type}function Ie(Q){const he=this.sliceSerialize(Q),Oe=this.data.characterReferenceType;let $e;Oe?($e=V1(he,Oe==="characterReferenceMarkerNumeric"?10:16),this.data.characterReferenceType=void 0):$e=wf(he);const qe=this.stack[this.stack.length-1];qe.value+=$e}function Xe(Q){const he=this.stack.pop();he.position.end=Ti(Q.end)}function We(Q){$.call(this,Q);const he=this.stack[this.stack.length-1];he.url=this.sliceSerialize(Q)}function nt(Q){$.call(this,Q);const he=this.stack[this.stack.length-1];he.url="mailto:"+this.sliceSerialize(Q)}function vt(){return{type:"blockquote",children:[]}}function Zn(){return{type:"code",lang:null,meta:null,value:""}}function gs(){return{type:"inlineCode",value:""}}function ri(){return{type:"definition",identifier:"",label:null,title:null,url:""}}function Es(){return{type:"emphasis",children:[]}}function vi(){return{type:"heading",depth:0,children:[]}}function ki(){return{type:"break"}}function Ce(){return{type:"html",value:""}}function Fe(){return{type:"image",title:null,url:"",alt:null}}function Re(){return{type:"link",title:null,url:"",children:[]}}function Ke(Q){return{type:"list",ordered:Q.type==="listOrdered",start:null,spread:Q._spread,children:[]}}function st(Q){return{type:"listItem",spread:Q._spread,checked:null,children:[]}}function ft(){return{type:"paragraph",children:[]}}function yn(){return{type:"strong",children:[]}}function kt(){return{type:"text",value:""}}function dn(){return{type:"thematicBreak"}}}function Ti(e){return{line:e.line,column:e.column,offset:e.offset}}function uE(e,t){let n=-1;for(;++n<t.length;){const r=t[n];Array.isArray(r)?uE(e,r):lO(e,r)}}function lO(e,t){let n;for(n in t)if(aE.call(t,n))switch(n){case"canContainEols":{const r=t[n];r&&e[n].push(...r);break}case"transforms":{const r=t[n];r&&e[n].push(...r);break}case"enter":case"exit":{const r=t[n];r&&Object.assign(e[n],r);break}}}function lE(e,t){throw e?new Error("Cannot close `"+e.type+"` ("+pa({start:e.start,end:e.end})+"): a different token (`"+t.type+"`, "+pa({start:t.start,end:t.end})+") is open"):new Error("Cannot close document, a token (`"+t.type+"`, "+pa({start:t.start,end:t.end})+") is still open")}function cO(e){const t=this;t.parser=n;function n(r){return aO(r,be(U(U({},t.data("settings")),e),{extensions:t.data("micromarkExtensions")||[],mdastExtensions:t.data("fromMarkdownExtensions")||[]}))}}function dO(e,t){const n={type:"element",tagName:"blockquote",properties:{},children:e.wrap(e.all(t),!0)};return e.patch(t,n),e.applyData(t,n)}function fO(e,t){const n={type:"element",tagName:"br",properties:{},children:[]};return e.patch(t,n),[e.applyData(t,n),{type:"text",value:`
|