@liip/liipgpt 3.10.0-rc.2 → 3.10.0

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.
Files changed (30) hide show
  1. package/chat/liipgpt-chat.iife.js +14 -14
  2. package/chat/liipgpt-chat.js +19 -19
  3. package/configurator/_app/env.js +1 -1
  4. package/configurator/_app/immutable/chunks/BE15eIcX.js +61 -0
  5. package/configurator/_app/immutable/chunks/{CgnKIljY.js → Bp2fQKa2.js} +1 -1
  6. package/configurator/_app/immutable/chunks/{DOmHuVAd.js → C3nFRFkd.js} +1 -1
  7. package/configurator/_app/immutable/chunks/CQKQgM16.js +1 -0
  8. package/configurator/_app/immutable/chunks/{Dojw3mHu.js → DGoyvn3J.js} +1 -1
  9. package/configurator/_app/immutable/chunks/{CiRZ9UnK.js → DoB1D_8H.js} +1 -1
  10. package/configurator/_app/immutable/chunks/{DAKT0Hmi.js → N6jOC-pH.js} +1 -1
  11. package/configurator/_app/immutable/chunks/{k0QB3my2.js → cTsTcg30.js} +1 -1
  12. package/configurator/_app/immutable/chunks/{DUEYj7Tq.js → cZD35eXJ.js} +1 -1
  13. package/configurator/_app/immutable/entry/{app.FlyB4DsO.js → app.C8tlSXPA.js} +2 -2
  14. package/configurator/_app/immutable/entry/start.CuNeX-jt.js +1 -0
  15. package/configurator/_app/immutable/nodes/{0.CTF3xmQA.js → 0.DCB0I300.js} +1 -1
  16. package/configurator/_app/immutable/nodes/{1.BSQ6HX7R.js → 1.B1zFGe7K.js} +1 -1
  17. package/configurator/_app/immutable/nodes/{2.C6z1AFjm.js → 2.CrdD7F_a.js} +3 -3
  18. package/configurator/_app/immutable/nodes/{3.D5oG7yIJ.js → 3.W2IWRGSL.js} +1 -1
  19. package/configurator/_app/version.json +1 -1
  20. package/configurator/index.html +6 -6
  21. package/configurator/sidebar.html +6 -6
  22. package/index.cjs +39 -0
  23. package/index.d.ts +11 -0
  24. package/index.js +39 -0
  25. package/package.json +1 -1
  26. package/search-summary/liipgpt-search-summary.iife.js +3 -3
  27. package/search-summary/liipgpt-search-summary.js +1 -1
  28. package/configurator/_app/immutable/chunks/DZ7HiB-Q.js +0 -61
  29. package/configurator/_app/immutable/chunks/g-mSZff4.js +0 -1
  30. package/configurator/_app/immutable/entry/start.DGSyFGK8.js +0 -1
@@ -60,4 +60,4 @@ Please report this to https://github.com/markedjs/marked.`,e){let e=`<p>An error
60
60
  `+i:t[r]=i)}.bind(this)),t.id!==null&&t.id.indexOf(`\0`)===-1&&(this.lastEventId=t.id),t.retry!==null&&/^[0-9]+$/.test(t.retry)&&(this.reconnectDelay=parseInt(t.retry,10)),t.data===null)return null;let n=new CustomEvent(t.event||`message`);return n.id=t.id,n.data=t.data||``,n.lastEventId=this.lastEventId,n},this._onReadyStateChange=function(){if(this.xhr&&this.xhr.readyState===XMLHttpRequest.HEADERS_RECEIVED){let e={},t=this.xhr.getAllResponseHeaders().trim().split(`\r
61
61
  `);for(let n of t){let[t,...r]=n.split(`:`),i=r.join(`:`).trim();e[t.trim().toLowerCase()]=e[t.trim().toLowerCase()]||[],e[t.trim().toLowerCase()].push(i)}let n=new CustomEvent(`open`);n.responseCode=this.xhr.status,n.headers=e,this.dispatchEvent(n),this._setReadyState(Rf.OPEN)}},this.stream=function(){if(!this.xhr){this._setReadyState(Rf.CONNECTING),this.xhr=new XMLHttpRequest,this.xhr.addEventListener(`progress`,this._onStreamProgress.bind(this)),this.xhr.addEventListener(`load`,this._onStreamLoaded.bind(this)),this.xhr.addEventListener(`readystatechange`,this._onReadyStateChange.bind(this)),this.xhr.addEventListener(`error`,this._onStreamFailure.bind(this)),this.xhr.addEventListener(`abort`,this._onStreamAbort.bind(this)),this.xhr.open(this.method,this.url);for(let e in this.headers)this.xhr.setRequestHeader(e,this.headers[e]);this.useLastEventId&&this.lastEventId.length>0&&this.xhr.setRequestHeader(`Last-Event-ID`,this.lastEventId),this.xhr.withCredentials=this.withCredentials,this.xhr.send(this.payload)}},this.close=function(){this.reconnectTimer&&=(clearTimeout(this.reconnectTimer),null),this.autoReconnect=!1,this.xhr&&this.xhr.abort()},(t.start===void 0||t.start)&&this.stream()};Rf.INITIALIZING=-1,Rf.CONNECTING=0,Rf.OPEN=1,Rf.CLOSED=2;var zf=class{eventSource;triggeredOnClose=!1;constructor(e,t,n){this.options=t,this.payload=n;let r={headers:{"content-type":`application/json`}};n&&(r.payload=JSON.stringify(n)),t.apiKey&&(r.headers[`api-key`]=t.apiKey),this.eventSource=new(t.EventSource??Rf)(e,r),this.eventSource.onmessage=e=>{try{let n=JSON.parse(e.data);t.onMessage(n)}catch(e){t.onError(new CustomEvent(`parse-error`,{detail:e}))}},this.eventSource.onerror=e=>{t.onError(e),this.isClosed()&&this.close()}}isClosed(){return this.eventSource.readyState===EventSource.CLOSED}close(){this.isClosed()||this.eventSource.close(),this.triggeredOnClose||(this.triggeredOnClose=!0,this.options.onClose())}},Bf=e=>Object.fromEntries(Object.entries(e).filter(([e,t])=>t!=null)),Vf=class{constructor(e){this.options=e}getDefaultHeaders(e={}){let t={"Content-Type":`application/json`,...e};return this.options.apiKey&&(t[`api-key`]=this.options.apiKey),t}get speechRecognitionApiKey(){return this.options.speechRecognitionApiKey}async subscribeSse(e,t={},n){let r=Bf(t);return this.options.apiKey&&(n.apiKey=this.options.apiKey),new zf(`${this.options.apiUrl}${e}`,n,r)}async fetchData(e,t,n={},r={}){let i=`${this.options.apiUrl}${e}?${new URLSearchParams(Bf(n)).toString()}`,a={...r,headers:this.getDefaultHeaders(r?.headers)},o=await fetch(i,a);if(!o.ok){let e=await o.text();throw Error(`API request failed: ${o.status} - ${e}`)}let s=await o.json(),{success:c,data:l,error:u}=t.safeParse(s);if(this.options.strict){if(!c)throw console.error(`Server response has wrong type:
62
62
  `,{error:u,url:i,opts:a,data:s}),Error(`Server response has wrong type: ${u.message}`);return l}else return c||console.warn(`Server response has wrong type:
63
- `,{error:u,url:i,opts:a,data:s}),s}async postData(e,t){let n=await fetch(`${this.options.apiUrl}${e}`,{method:`POST`,headers:this.getDefaultHeaders(),body:JSON.stringify(t)});if(!n.ok){let e=await n.text();throw Error(`${n.status} - ${e}`)}return n}async postFormData(e,t){let n=await fetch(`${this.options.apiUrl}${e}`,{method:`POST`,body:t});if(!n.ok){let e=await n.text();throw Error(`${n.status} - ${e}`)}return n}},Hf=Q({links:Z(wd([Q({url:$(dd()),title:$(Y()),considered:$(X()),orgMetadata:$(Q({authors:$(Z(Y()))})),type:$(Y()),date:$(Hd()),similarity:$(pd()),content:$(Y()),fromFullTextSearch:$(X()),rerank:$(Q({index:$(hd()),adjustment:$(pd()),score:$(pd()),similarityOld:$(pd())}))}),Zd]))}),Uf=e=>{if(`metadata`in e)return e;console.warn(`Please upgrade your backend you are currently using an old api feature.`);let t=e.orgMetadata??{};e?.fromFullTextSearch&&(t.fromFullTextSearch=e?.fromFullTextSearch),e?.rerank&&(t.rerank=e?.rerank);let n=[],r=e.title??``;if(e.title&&e.title.includes(` > `)){let t=e.title.split(` > `);r=t.pop()??``,n=t}return{url:e.url??``,title:r,score:e.similarity||0,breadcrumbs:n,metadata:t,description:e.content,date:e.date}},Wf=7,Gf=8,Kf=160,qf=e=>{let t=[],n=0;for(;n<e.length;){let r=e[n];if(r===`<`){let r=e.indexOf(`>`,n);if(r!==-1){t.push({type:`tag`,value:e.slice(n,r+1)}),n=r+1;continue}}if(/\s/.test(r)){let r=n;for(;r<e.length&&/\s/.test(e[r]);)r++;t.push({type:`space`,value:e.slice(n,r)}),n=r;continue}let i=n;for(;i<e.length&&!/\s/.test(e[i])&&e[i]!==`<`;)i++;t.push({type:`word`,value:e.slice(n,i)}),n=i}return t},Jf=e=>{let t=qf(e),n=[],r=``,i=!1;for(let e of t)e.type===`space`&&i?(n.push(r),r=e.value,i=!1):(r+=e.value,e.type===`word`&&(i=!0));return r&&n.push(r),n},Yf=e=>Math.max(Gf,Math.min(Kf,e.length*Wf)),Xf=class{queue=[];timeoutId=null;isProcessing=!1;constructor(e){this.onText=e}ingestText(e){let t=Jf(e);if(t.length>=5){for(let e of t)this.queue.push({kind:`text`,chunk:e,delayMs:Yf(e)});this.kickoff();return}this.runAfterTyping(()=>this.onText(e))}runAfterTyping(e){if(this.queue.length===0&&!this.isProcessing){e();return}this.queue.push({kind:`fn`,fn:e}),this.kickoff()}runWithWarmup(e){this.queue.push({kind:`fn`,fn:e}),this.kickoff()}clear(){this.timeoutId!==null&&(clearTimeout(this.timeoutId),this.timeoutId=null),this.queue=[],this.isProcessing=!1}kickoff(){this.isProcessing||this.timeoutId!==null||(this.timeoutId=setTimeout(()=>{this.timeoutId=null,this.processNext()},750))}processNext(){let e=this.queue.shift();if(!e){this.isProcessing=!1;return}this.isProcessing=!0,e.kind===`text`?(this.onText(e.chunk),this.timeoutId=setTimeout(()=>{this.timeoutId=null,this.processNext()},e.delayMs)):(e.fn(),this.processNext())}},Zf=class{constructor(e){this.results=e}},Qf=class{internalData;renderers=new Map;markedExtensions=[];_newTabSrText;constructor(e){let t=new Vf({apiUrl:e.apiUrl,apiKey:e.apiKey,speechRecognitionApiKey:e.speechRecognitionApiKey,strict:e.strict??!1,EventSource:e.EventSource??EventSource});this.internalData={restClient:t,metadata:Lf(t,e.startParameters),searchResponseMap:new Map,chatResponseMap:new Map,conversationMap:new Map}}setMarkedExtensions(...e){this.markedExtensions=e}setNewTabSrText(e){this._newTabSrText=e}getMetadata(){return this.internalData.metadata}createConversationId(){let e=jf();return this.renderers.set(e,new Sl({extensions:this.markedExtensions,newTabSrText:this._newTabSrText})),e}chat(e,t,n={}){let r=new Tl,i=jf(),a=new wl,o=new kl({id:i,onError:e=>{n.onError?.(e)},onFinish:e=>{r.setValue(e)},markdownRenderer:this.renderers.get(e)??new Sl({extensions:this.markedExtensions,newTabSrText:this._newTabSrText}),userQuestion:t}),s=async()=>{await a,(await c).close()},c=new Tl,l=new Xf(e=>o.updateText(e));(async()=>{let s=await this.internalData.metadata;if(s.mode===`maintenance`)throw Error(`Can not chat in maintenance mode`);let u=await this.internalData.restClient.subscribeSse(`/assistant/sse`,{query:t,uID:s.userId,cID:e,rID:i,lang:n.lang,feature:n.features?.join(`,`),referrer:n.referrer,source:n.source,...n.selectorValues??{},...n.mode?{mode:n.mode}:{},...n.cache?{cache:!0}:{},...n.predefinedQuestionId?{predefinedQuestionId:n.predefinedQuestionId}:{},...n.switchQuestionId?{switchQuestionId:n.switchQuestionId}:{},chat:`true`,version:`2`},{onClose:()=>{l.clear(),o.finishMessage(),a.resolve(),r.cleanup()},onMessage:t=>{let r=t;switch(r.type){case`error`:l.runAfterTyping(()=>o.pushError(r.error));break;case`id`:r.for===`request`&&i!==r.id&&console.warn(`Unexpected request id "${r.id}" expected "${i}"`),r.for===`conversation`&&e!==r.id&&console.warn(`Unexpected conversation id "${r.id}" expected "${e}"`);break;case`state`:r.state===`history-entry-initialized`&&a.resolve();break;case`text`:l.ingestText(r.text);break;case`done`:case`answer-done`:l.runAfterTyping(()=>{o.finishMessage(),a.resolve(),c.then(e=>e.close())});break;case`unexpected-call`:l.runAfterTyping(()=>{console.error(`unexpected-call:`,r),o.pushError(`unexpected-call`)});break;case`jsonld-component`:case`mapped-reference`:l.runAfterTyping(()=>o.addMappedReference(r.reference));break;case`reference`:l.runAfterTyping(()=>o.addOldReference(r.reference));break;case`retrieval-question`:l.runAfterTyping(()=>o.updateRetrievalQuestion(r.question));break;case`no-feedback`:l.runAfterTyping(()=>o.setNoFeedback());break;case`component`:l.runWithWarmup(()=>n.onEmbed?.(r));break}l.runAfterTyping(()=>n.onMessage?.(r))},onError:e=>{console.error(` sse-error:`,e),!(`data`in e&&!e.data&&`responseCode`in e&&e.responseCode===0)&&o.pushError(`sse-error`)}});c.setValue(u)})();let u=new Cf({question:t,id:i,content:r,readableStore:o.getReadableStore(),readyForFeedback:a,abort:s,liipgptClientPrimitive:this});return this.internalData.chatResponseMap.set(u.id,u),u}async thumbs(e,t,n){if((await this.internalData.metadata).mode!==`ready`)throw Error(`Can not post feedback unless we are in ready mode`);let r={feedback:n,rID:e,query:t};await this.internalData.restClient.postData(`/quickfeedback`,r)}thumbsUp(e,t){return this.thumbs(e,t,`positive`)}thumbsDown(e,t){return this.thumbs(e,t,`negative`)}async feedback(e,t,n){let r=await this.internalData.metadata;if(r.mode!==`ready`)throw Error(`Can not post feedback unless we are in ready mode`);if(n.message){let i={body:n.message,email:n.email,rID:e,uID:r.userId,query:t};await this.internalData.restClient.postData(`/feedback`,i)}n.classification&&await this.internalData.restClient.postData(`/classification`,{impact:n.classification.impact,quality:n.classification.quality,rID:e})}async submitAnswerForm(e){let t=await this.internalData.metadata;if(t.mode!==`ready`)throw Error(`Can not submit the answer form unless we are in ready mode`);let n={receiverEmail:e.receiverEmail,fields:e.fields,query:e.question,answer:e.answer,rID:e.requestId,uID:t.userId,lang:e.lang};await this.internalData.restClient.postData(`/customform`,n)}async userAction(e,t={}){let n=await this.internalData.metadata;if(n.mode!==`ready`)throw Error(`Can not post user action unless we are in ready mode`);let r={uID:n.userId,cID:t.conversationId,lang:t.lang,userAction:e};await this.internalData.restClient.postData(`/assistant/userAction`,r)}async search(e,t={}){let n=await this.internalData.metadata,r=n.mode===`ready`?n.userId:void 0,{links:i}=await this.internalData.restClient.fetchData(`/assistant/search`,Hf,{modelId:t.model,lang:t.language,query:e,mapResults:`true`,uID:r});return new Zf(i.map(Uf))}async getChatConfig(){return this.internalData.restClient.fetchData(`/chatconfig`,Sf)}async getChatHistory(e,t){try{let n=await this.internalData.restClient.postData(`/chathistory`,{cID:e,uID:t}),r=nf.safeParse(await n.json());return r.success?r.data:[]}catch(e){return console.error(`Failed to load chat history:`,e),[]}}async getPredefinedQuestions(e){return(await this.internalData.restClient.fetchData(`/topics/questions`,_f,e)).predefinedQuestions}async transcribeAudio(e,t={}){let n=await this.internalData.metadata,r=t.lang||`de-CH`;if(n.mode===`maintenance`)throw Error(`Can not transcribe audio in maintenance mode`);try{let t=(e=>e.includes(`mp4`)?`mp4`:e.includes(`webm`)?`webm`:(e.includes(`wav`),`wav`))(e.type),n=new FormData;return n.append(`file`,e,`audio.${t}`),n.append(`lang`,r),n.append(`type`,e.type),{transcript:await(await this.internalData.restClient.postFormData(`/speech?key=${this.internalData.restClient.speechRecognitionApiKey||``}&lang=${r}`,n)).text()||``,error:void 0}}catch(e){return console.error(`Error transcribing audio:`,e),{transcript:``,error:e instanceof Error?e.message:`Unknown error`}}}},$f=class{clientPrimitive;constructor(e){this.clientPrimitive=new Qf(e)}getMetadata(){return this.clientPrimitive.getMetadata()}createConversation(){return new wf(this.clientPrimitive)}search(e,t={}){return this.clientPrimitive.search(e,t)}getChatConfig(){return this.clientPrimitive.getChatConfig()}getPredefinedQuestions(e){return this.clientPrimitive.getPredefinedQuestions(e)}},ep={de:{searchSummaryExpand:`Gesamte Antwort`,searchSummaryCollapse:`Weniger anzeigen`,searchSummaryOptInDefault:`KI-Suche aktivieren`,searchSummaryOptOut:`KI-Suche deaktivieren`,searchSummaryError:`Etwas ist schiefgelaufen.`,searchSummaryLoading:`Antwort wird generiert…`,searchSummaryDisclaimer:`<p><strong>Ich bin ein KI-Assistent.</strong></p><p>Meine Antworten werden von einer künstlichen Intelligenz generiert und sind deshalb nicht immer korrekt. Wenn Sie mich aktivieren, unterstütze ich Sie bei der Suche nach den richtigen Informationen.</p>`,ariaSearchSummaryExpand:`Vollständige Antwort anzeigen`,ariaSearchSummaryCollapse:`Antwort einklappen`,ariaSearchSummaryOptOut:`KI-Suche deaktivieren`,referencesTitle:`Quellen`,searchSummaryFollowUpPlaceholder:`Stellen Sie eine Folgefrage…`,searchSummaryFollowUpSubmit:`Im Chat fortfahren`,ariaSearchSummaryFollowUpInput:`Frage stellen`},en:{searchSummaryExpand:`Full answer`,searchSummaryCollapse:`Show less`,searchSummaryOptInDefault:`Enable AI search`,searchSummaryOptOut:`Disable AI search`,searchSummaryError:`Something went wrong.`,searchSummaryLoading:`Generating answer…`,searchSummaryDisclaimer:`<p><strong>I am an AI assistant.</strong></p><p>My answers are generated by artificial intelligence and may not always be correct. If you activate me, I will help you find the right information.</p>`,ariaSearchSummaryExpand:`Show full answer`,ariaSearchSummaryCollapse:`Collapse answer`,ariaSearchSummaryOptOut:`Disable AI search`,referencesTitle:`References`,searchSummaryFollowUpPlaceholder:`Ask a follow-up question…`,searchSummaryFollowUpSubmit:`Continue in chat`,ariaSearchSummaryFollowUpInput:`Ask a follow-up question`},it:{searchSummaryExpand:`Risposta completa`,searchSummaryCollapse:`Mostra meno`,searchSummaryOptInDefault:`Attiva la ricerca IA`,searchSummaryOptOut:`Disattiva la ricerca IA`,searchSummaryError:`Si è verificato un errore.`,searchSummaryLoading:`Generazione della risposta…`,searchSummaryDisclaimer:`<p><strong>Sono un assistente IA.</strong></p><p>Le mie risposte sono generate da un'intelligenza artificiale e potrebbero non essere sempre corrette. Se mi attivi, ti aiuto a trovare le informazioni giuste.</p>`,ariaSearchSummaryExpand:`Mostra la risposta completa`,ariaSearchSummaryCollapse:`Comprimi la risposta`,ariaSearchSummaryOptOut:`Disattiva la ricerca IA`,referencesTitle:`Riferimenti`,searchSummaryFollowUpPlaceholder:`Fai una domanda di approfondimento…`,searchSummaryFollowUpSubmit:`Continua nella chat`,ariaSearchSummaryFollowUpInput:`Fai una domanda di approfondimento`},fr:{searchSummaryExpand:`Réponse complète`,searchSummaryCollapse:`Afficher moins`,searchSummaryOptInDefault:`Activer la recherche IA`,searchSummaryOptOut:`Désactiver la recherche IA`,searchSummaryError:`Une erreur s'est produite.`,searchSummaryLoading:`Génération de la réponse…`,searchSummaryDisclaimer:`<p><strong>Je suis un assistant IA.</strong></p><p>Mes réponses sont générées par une intelligence artificielle et peuvent ne pas toujours être correctes. Si vous m'activez, je vous aide à trouver les bonnes informations.</p>`,ariaSearchSummaryExpand:`Afficher la réponse complète`,ariaSearchSummaryCollapse:`Réduire la réponse`,ariaSearchSummaryOptOut:`Désactiver la recherche IA`,referencesTitle:`Références`,searchSummaryFollowUpPlaceholder:`Posez une question de suivi…`,searchSummaryFollowUpSubmit:`Continuer dans le chat`,ariaSearchSummaryFollowUpInput:`Poser une question de suivi`}},tp=`liipgpt-search-summary>[slot]{display:none}@layer components{@keyframes search-summary-spin{to{transform:rotate(360deg)}}@keyframes search-summary-content-appear{0%{opacity:0}}@keyframes search-summary-content-disappear{to{opacity:0}}@keyframes search-summary-action-appear{0%{opacity:0;transform:translateY(12px)}}@keyframes search-summary-action-disappear{to{opacity:0;transform:translateY(12px)}}.search-summary{box-sizing:border-box;padding:var(--search-summary-padding,0);border-width:var(--search-summary-border-width,0);border-style:var(--search-summary-border-style,solid);border-radius:var(--search-summary-border-radius,0);border-color:var(--search-summary-border-color,transparent);background:var(--search-summary-background,transparent);box-shadow:var(--search-summary-box-shadow,none);color:var(--search-summary-color,var(--body-color,inherit));font-weight:var(--base-font-weight-normal,inherit);font-size:var(--base-font-size-body,inherit);line-height:var(--base-line-height-default,inherit);font-family:var(--search-summary-font-family,var(--font-family,inherit));font-optical-sizing:auto;transition:opacity var(--search-summary-fade-duration,.2s) ease-out;flex-direction:column;padding-bottom:0;display:flex;position:relative;overflow:hidden}.search-summary :where(button){cursor:pointer;font-family:inherit}.search-summary :where(.search-summary__sr-only){clip:rect(0, 0, 0, 0);white-space:nowrap;border-width:0;width:1px;height:1px;margin:-1px;padding:0;position:absolute;overflow:hidden}.search-summary:where(.search-summary--ready[data-state=loading]),.search-summary:where(.search-summary--ready[data-state=answering]){opacity:var(--search-summary-loading-opacity,1)}.search-summary:where([data-state=error]){border-color:var(--search-summary-error-border-color,inherit)}.search-summary :where(.search-summary__content){min-height:0;padding-bottom:var(--search-summary-padding,0);flex:1;animation:.35s ease-out both search-summary-content-appear;display:block;position:relative;overflow:hidden}.search-summary :where(.search-summary__content--with-follow-up){flex-direction:column;display:flex}.search-summary:where([data-capped=true]) :where(.search-summary__content){overflow-y:auto}.search-summary :where(.search-summary__content--leaving),.search-summary :where(.search-summary__footer--leaving){pointer-events:none;animation:.25s ease-in both search-summary-content-disappear}.search-summary :where(.search-summary__answer-wrap){display:block;position:relative}.search-summary :where(.search-summary__answer){margin-bottom:var(--spacer-16,1rem);line-height:var(--search-summary-answer-line-height,1.5)}.search-summary :where(.search-summary__answer a){color:var(--search-summary-link-color,LinkText);text-decoration:underline}.search-summary :where(.search-summary__answer p){margin-top:0}.search-summary :where(.search-summary__answer--themed){font-size:var(--base-font-size-body,inherit);line-height:var(--search-summary-answer-line-height,var(--base-line-height-default,1.5))}.search-summary :where(.search-summary__answer--themed>:first-child){margin-top:0}.search-summary :where(.search-summary__answer--themed>:last-child){margin-bottom:0}.search-summary :where(.search-summary__answer--themed p,.search-summary__answer--themed ul,.search-summary__answer--themed ol){margin-top:0;margin-bottom:var(--spacer-r-16,1rem)}.search-summary :where(.search-summary__answer--themed h1,.search-summary__answer--themed h2,.search-summary__answer--themed h3,.search-summary__answer--themed h4,.search-summary__answer--themed h5,.search-summary__answer--themed h6){margin-top:var(--spacer-r-24,1.5rem);margin-bottom:var(--spacer-r-12,.75rem);font-weight:var(--base-font-weight-title,700);line-height:var(--base-line-height-tight,1.2)}.search-summary :where(.search-summary__answer--themed ul,.search-summary__answer--themed ol){padding-left:1.5em;list-style-position:outside}.search-summary :where(.search-summary__answer--themed ul){list-style-type:disc}.search-summary :where(.search-summary__answer--themed ol){list-style-type:decimal}.search-summary :where(.search-summary__answer--themed li){margin-bottom:var(--spacer-8,.5rem)}.search-summary :where(.search-summary__answer--themed li:last-child){margin-bottom:0}.search-summary :where(.search-summary__answer--themed b,.search-summary__answer--themed strong){font-weight:var(--base-font-weight-bold,700)}.search-summary :where(.search-summary__answer--themed a){color:var(--search-summary-link-color,var(--anchor-color,LinkText))}.search-summary :where(.search-summary__loading){margin-bottom:var(--spacer-16,1rem);align-items:center;gap:var(--spacer-8,.5rem);display:flex}.search-summary :where(.search-summary__loading-spinner){border:1.5px solid var(--anchor-color,currentColor);border-top-color:#0000;border-radius:50%;flex-shrink:0;width:.5em;height:.5em;animation:.4s linear infinite search-summary-spin;display:inline-block}.search-summary :where(.search-summary__loading-text){font-size:var(--base-font-size-default,inherit)}.search-summary :where(.search-summary__references){padding:0;padding-bottom:var(--spacer-32,2rem);color:var(--search-summary-reference-list-color,inherit);font-size:var(--search-summary-reference-list-font-size,inherit);font-size:var(--base-font-size-sm,inherit);margin:0;list-style-type:none}.search-summary :where(.search-summary__references-title){padding:var(--spacer-2,2px) 0;font-weight:var(--base-font-weight-bold,500);font-size:var(--base-font-size-sm,inherit)}.search-summary :where(.search-summary__reference){display:list-item}.search-summary :where(.search-summary__reference a){padding:var(--spacer-2,2px) 0;color:var(--search-summary-reference-list-color,var(--search-summary-link-color,LinkText));display:block}.search-summary :where(.search-summary__follow-up){padding-top:var(--spacer-12,.75rem);flex-shrink:0;margin-top:auto}.search-summary :where(.search-summary__follow-up-field){align-items:center;gap:var(--spacer-8,.5rem);display:flex}.search-summary :where(.search-summary__follow-up-input){border-width:var(--search-summary-follow-up-border-width,revert);border-style:var(--search-summary-follow-up-border-style,revert);border-radius:var(--search-summary-follow-up-border-radius,revert);border-color:var(--search-summary-follow-up-border-color,revert);background:var(--search-summary-follow-up-background,revert);min-width:0;color:var(--search-summary-follow-up-color,revert);font:inherit;flex:auto}.search-summary :where(.search-summary__follow-up-submit){border-width:var(--search-summary-follow-up-submit-border-width,revert);border-style:var(--search-summary-follow-up-submit-border-style,revert);border-radius:var(--search-summary-follow-up-submit-border-radius,revert);border-color:var(--search-summary-follow-up-submit-border-color,revert);background:var(--search-summary-follow-up-submit-background,revert);color:var(--search-summary-follow-up-submit-color,revert);font:inherit;flex-shrink:0;justify-content:center;align-items:center;display:inline-flex}.search-summary :where(.search-summary__follow-up-submit-icon){width:var(--spacer-20,1.25rem);height:var(--spacer-20,1.25rem);pointer-events:none}.search-summary :where(.search-summary__follow-up-submit-icon) :where(svg){width:100%;height:100%;display:block}.search-summary :where(.search-summary__follow-up--themed .search-summary__follow-up-field){padding:var(--spacer-4,.25rem) var(--spacer-8,.5rem) var(--spacer-4,.25rem) var(--spacer-16,1rem);border-width:var(--chat-input-border-width,var(--spacer-1,1px));border-radius:var(--chat-input-border-radius,1.75rem);border-style:solid;border-color:var(--chat-input-border-color,currentColor);background:var(--chat-input-background,transparent);box-shadow:var(--chat-input-box-shadow,none);transition:background .2s,border-color .2s,border-width .2s,border-radius .2s,box-shadow .2s}.search-summary :where(.search-summary__follow-up--themed .search-summary__follow-up-field):hover{background:var(--chat-input-hover-background,var(--chat-input-background,transparent));box-shadow:var(--chat-input-hover-box-shadow,var(--chat-input-box-shadow,none))}.search-summary :where(.search-summary__follow-up--themed .search-summary__follow-up-field):has(.search-summary__follow-up-input:focus-visible){border-width:var(--chat-input-focus-border-width,var(--chat-input-border-width,var(--spacer-1,1px)));border-radius:var(--chat-input-focus-border-radius,var(--chat-input-border-radius,1.75rem));border-color:var(--chat-input-focus-border-color,var(--chat-input-border-color,currentColor));background:var(--chat-input-focus-background,var(--chat-input-background,transparent));box-shadow:var(--chat-input-focus-box-shadow,var(--chat-input-box-shadow,none))}.search-summary :where(.search-summary__follow-up--themed .search-summary__follow-up-input){color:var(--chat-input-color,inherit);background:0 0;border:0;padding:0}.search-summary :where(.search-summary__follow-up--themed .search-summary__follow-up-input):focus,.search-summary :where(.search-summary__follow-up--themed .search-summary__follow-up-input):focus-visible{outline:none}.search-summary :where(.search-summary__follow-up--themed .search-summary__follow-up-submit){width:var(--btn-submit-size,2.25rem);height:var(--btn-submit-size,2.25rem);padding:0;border-width:var(--chat-input-submit-border-width,0);border-radius:var(--chat-input-submit-border-radius,50%);border-style:solid;border-color:var(--chat-input-submit-border-color,transparent);background:var(--chat-input-submit-background,var(--search-summary-link-color,LinkText));box-shadow:var(--chat-input-submit-box-shadow,none);color:var(--chat-input-submit-color,Canvas);padding-inline:0;transition:background .2s,border-color .2s,border-width .2s,border-radius .2s,box-shadow .2s,color .2s,transform .2s}.search-summary :where(.search-summary__follow-up--themed .search-summary__follow-up-submit):hover{border-width:var(--chat-input-submit-hover-border-width,var(--chat-input-submit-border-width,0));border-radius:var(--chat-input-submit-hover-border-radius,var(--chat-input-submit-border-radius,50%));border-color:var(--chat-input-submit-hover-border-color,var(--chat-input-submit-border-color,transparent));background:var(--chat-input-submit-hover-background,var(--chat-input-submit-background,var(--search-summary-link-color,LinkText)));box-shadow:var(--chat-input-submit-hover-box-shadow,var(--chat-input-submit-box-shadow,none));color:var(--chat-input-submit-hover-color,var(--chat-input-submit-color,Canvas))}.search-summary :where(.search-summary__follow-up--themed .search-summary__follow-up-submit-icon--fallback path){stroke:currentColor;stroke-width:var(--chat-input-submit-stroke-width,2px)}.search-summary :where(.search-summary__disclaimer){margin-bottom:var(--spacer-16,1rem);line-height:var(--base-line-height-default,1.5)}.search-summary :where(.search-summary__disclaimer a){color:var(--search-summary-disclaimer-link-color,var(--search-summary-link-color,LinkText));text-decoration:underline}.search-summary :where(.search-summary__disclaimer p){margin-top:0}.search-summary :where(.search-summary__opt-in-panel){flex-direction:column;flex:1;min-height:0;display:flex}.search-summary :where(.search-summary__opt-in-body){min-height:0;margin-top:var(--spacer-4,.25rem);margin-bottom:var(--spacer-16,1rem);flex:1;position:relative;overflow-y:auto}.search-summary :where(.search-summary__error){color:var(--search-summary-error-color,inherit)}.search-summary :where(.search-summary__footer){margin-right:calc(-1 * var(--search-summary-padding,0));margin-left:calc(-1 * var(--search-summary-padding,0));padding:0 var(--search-summary-padding,0) calc(var(--search-summary-padding,0));justify-content:space-between;align-items:center;gap:var(--spacer-12,.75rem);background:var(--search-summary-footer-background,var(--search-summary-background,white));flex-wrap:wrap;flex-shrink:0;display:flex;position:relative}.search-summary :where(.search-summary__footer):after{height:var(--spacer-48,3rem);background:linear-gradient(to bottom, transparent, var(--search-summary-footer-background,var(--search-summary-background,white)));content:"";pointer-events:none;position:absolute;top:0;left:0;right:0;transform:translateY(-100%)}.search-summary :where(.search-summary__footer--overlay){margin:0;position:absolute;bottom:0;left:0;right:0}.search-summary :where(.search-summary__footer-actions){align-items:center;gap:var(--spacer-8,.5rem);flex-wrap:wrap;display:flex}.search-summary :where(.search-summary__expand,.search-summary__expand-slot-mount,.search-summary__opt-in,.search-summary__opt-in-slot-mount,.search-summary__opt-out,.search-summary__opt-out-slot-mount){animation:.3s cubic-bezier(.25,.46,.45,.94) both search-summary-action-appear}.search-summary :where(.search-summary__opt-in,.search-summary__opt-in-slot-mount){animation-delay:.3s}.search-summary :where(.search-summary__btn--leaving){pointer-events:none;animation:.2s cubic-bezier(.55,0,1,.45) both search-summary-action-disappear}.search-summary :where(.search-summary__expand,.search-summary__opt-in,.search-summary__opt-out):not(:where(.search-summary__btn)){font:inherit;padding:0;padding-inline:0}.search-summary :where(.search-summary__expand,.search-summary__opt-in):not(:where(.search-summary__btn)){border-width:var(--search-summary-action-border-width,0);border-style:var(--search-summary-action-border-style,solid);border-radius:var(--search-summary-action-primary-border-radius,0);border-color:var(--search-summary-action-primary-border-color,transparent);background:var(--search-summary-action-primary-background,transparent);color:var(--search-summary-action-primary-color,var(--search-summary-link-color,LinkText));text-decoration:underline}.search-summary :where(.search-summary__opt-out):not(:where(.search-summary__btn)){border-width:var(--search-summary-action-border-width,0);border-style:var(--search-summary-action-border-style,solid);border-radius:var(--search-summary-action-secondary-border-radius,0);border-color:var(--search-summary-action-secondary-border-color,transparent);background:var(--search-summary-action-secondary-background,transparent);color:var(--search-summary-action-secondary-color,var(--search-summary-link-color,LinkText));text-decoration:underline}.search-summary :where(.search-summary__btn){padding:var(--btn-padding-y,var(--spacer-8,.5rem)) var(--btn-padding-x,var(--spacer-20,1.25rem));align-items:center;gap:var(--spacer-8,.5rem);border-width:var(--spacer-1,1px);font-size:var(--base-font-size-sm,inherit);cursor:pointer;border-style:solid;font-family:inherit;line-height:1.25;text-decoration:none;display:inline-flex}.search-summary :where(.search-summary__btn--primary){border-radius:var(--btn-primary-border-radius);border-color:var(--btn-primary-border-color,transparent);background:var(--btn-primary-background);color:var(--btn-primary-color);font-weight:var(--btn-primary-font-weight,700)}.search-summary :where(.search-summary__btn--primary):hover{background:var(--btn-primary-hover-background,var(--btn-primary-background));color:var(--btn-primary-hover-color,var(--btn-primary-color))}.search-summary :where(.search-summary__btn--secondary){border-radius:var(--btn-secondary-border-radius);border-color:var(--btn-secondary-border-color,var(--btn-secondary-background));background:var(--btn-secondary-background);color:var(--btn-secondary-color);font-weight:var(--btn-secondary-font-weight,700)}.search-summary :where(.search-summary__btn--secondary):hover{background:var(--btn-secondary-hover-background,var(--btn-secondary-background));color:var(--btn-secondary-hover-color,var(--btn-secondary-color))}@media (prefers-reduced-motion:reduce){.search-summary{transition:none}.search-summary :where(.search-summary__content),.search-summary :where(.search-summary__content--leaving),.search-summary :where(.search-summary__footer--leaving),.search-summary :where(.search-summary__expand,.search-summary__expand-slot-mount,.search-summary__opt-in,.search-summary__opt-in-slot-mount,.search-summary__opt-out,.search-summary__opt-out-slot-mount),.search-summary :where(.search-summary__btn--leaving),.search-summary :where(.search-summary__loading-spinner){animation:none!important}}}`;function np(e,t){Ue(t,!0);let n=W(t,`css`,7),r=ya(t,[`$$slots`,`$$events`,`$$legacy`,`$$host`,`css`]),i=e=>{En(()=>{n()&&(e.innerHTML=n())})};var a={get css(){return n()},set css(e){n(e),I()}},o=Vr(),s=un(o),c=e=>{var t=Vr();Mi(un(t),()=>`style`,!1,(e,t)=>{Ni(e,e=>i?.(e)),la(e,()=>({...r}))}),U(e,t)};return di(s,e=>{n()&&e(c)}),U(e,o),We(a)}Da(np,{css:{}},[],[],{mode:`open`});var rp=`liipgpt:search-summary:opt-in:`;function ip(e){let t=5381;for(let n=0;n<e.length;n++)t=t*33^e.charCodeAt(n);return(t>>>0).toString(36)}function ap(e){return`${rp}${ip(e??``)}`}function op(){try{return typeof window<`u`&&window.localStorage!==void 0}catch{return!1}}function sp(e){if(!op())return!1;try{return window.localStorage.getItem(ap(e))===`1`}catch{return!1}}function cp(e){if(op())try{window.localStorage.setItem(ap(e),`1`)}catch{}}function lp(e){if(op())try{window.localStorage.removeItem(ap(e))}catch{}}var up=new WeakMap;function dp(e,t,n){if(!t)return null;let r=up.get(t);return r&&t.removeEventListener(`click`,r),t.removeAttribute(`slot`),t.type=`button`,t.addEventListener(`click`,n),up.set(t,n),e.appendChild(t),({label:e,ariaLabel:n,ariaExpanded:r})=>{e!==void 0&&(t.textContent=e),n!==void 0&&t.setAttribute(`aria-label`,n),r===void 0?t.removeAttribute(`aria-expanded`):t.setAttribute(`aria-expanded`,String(r))}}function fp(e,t){if(!t)return;let n=up.get(t);n&&(t.removeEventListener(`click`,n),up.delete(t)),e.contains(t)&&e.removeChild(t)}function pp(e){let t=String(e).trim();return/^\d+(\.\d+)?$/.test(t)?`${t}px`:t}function mp(e){let t=e.match(/^(\d+(?:\.\d+)?)px$/);return t?Number.parseFloat(t[1]):null}function hp(e,t){let n=e.style.height;e.style.height=t;let r=e.offsetHeight;return e.style.height=n,r}var gp=mp(pp(`280`));function _p(e,t=`.search-summary`){return e.replaceAll(`.chat-app`,t)}var vp=`(prefers-reduced-motion: reduce)`;function yp(e){if(typeof window>`u`)return e(!1),()=>{};let t=window.matchMedia(vp);e(t.matches);let n=()=>e(t.matches);return t.addEventListener(`change`,n),()=>t.removeEventListener(`change`,n)}var bp=Rr(`<!> <!> <!>`,1),xp=Rr(`<div class="search-summary__disclaimer-text"></div>`),Sp=Rr(`<div class="search-summary__opt-in-slot-mount"></div>`),Cp=Rr(`<button type="button"> </button>`),wp=Rr(`<div class="search-summary__opt-in-panel"><div class="search-summary__opt-in-body"><div class="search-summary__disclaimer"><!></div></div> <div class="search-summary__footer"><!></div></div>`),Tp=Rr(`<div class="search-summary__loading" aria-live="polite"><span class="search-summary__loading-spinner" aria-hidden="true"></span> <span class="search-summary__loading-text"> </span></div>`),Ep=Rr(`<div class="search-summary__error" role="alert"> </div>`),Dp=Rr(`<li class="search-summary__reference"><a target="_blank" rel="noopener noreferrer"> </a></li>`),Op=Rr(`<div class="search-summary__references-title"> </div> <ol class="search-summary__references"></ol>`,1),kp=Rr(`<div class="search-summary__follow-up-submit-icon"></div>`),Ap=Br(`<svg class="search-summary__follow-up-submit-icon search-summary__follow-up-submit-icon--fallback" viewBox="0 0 24 24" aria-hidden="true" focusable="false"><g fill="none" stroke="currentColor" stroke-width="1.5" stroke-linecap="round" stroke-linejoin="round"><path d="m12 1v22"></path><path d="m4 9 8-8 8 8"></path></g></svg>`),jp=Rr(`<form><label class="search-summary__sr-only" for="search-summary-follow-up-input"> </label> <div class="search-summary__follow-up-field"><input id="search-summary-follow-up-input" class="search-summary__follow-up-input" type="text"/> <button type="submit" class="search-summary__follow-up-submit"><span class="search-summary__sr-only"> </span> <!></button></div></form>`),Mp=Rr(`<div class="search-summary__expand-slot-mount"></div>`),Np=Rr(`<button type="button"> </button>`),Pp=Rr(`<div class="search-summary__opt-out-slot-mount"></div>`),Fp=Rr(`<button type="button"> </button>`),Ip=Rr(`<div><div class="search-summary__footer-actions"><!></div> <!></div>`),Lp=Rr(`<div><div class="search-summary__answer-wrap"><!> <div aria-live="polite"></div></div> <!> <!> <!></div> <!>`,1),Rp=Rr(`<!> <!> <div><!></div>`,1);function zp(e,n){Ue(n,!0);function r(e){let t=e.trim();return!(!t||/^[a-zA-Z][a-zA-Z\d+.-]*:/.test(t)||t.startsWith(`//`))}let i=W(n,`lang`,7,`de`),a=W(n,`apiUrl`,7),o=W(n,`apiKey`,7,``),s=W(n,`question`,7),c=W(n,`height`,7,`280`),l=W(n,`maxHeight`,7),u=W(n,`optIn`,7,!1),d=W(n,`optInLabel`,7),f=W(n,`expandLabel`,7),p=W(n,`collapseLabel`,7),m=W(n,`optOutLabel`,7),h=W(n,`useChatConfig`,7,!1),g=W(n,`forceTheme`,7),_=W(n,`disclaimerHtml`,7,``),v=W(n,`labelledBy`,7),y=W(n,`chatUrl`,7),b=W(n,`mode`,7,`search`),ee=W(n,`source`,7,`search-summary`),te=W(n,`cache`,7,!1),ne=W(n,`activateAiButtonSlot`,7,null),x=W(n,`expandAnswerButtonSlot`,7,null),re=W(n,`deactivateAiButtonSlot`,7,null),ie=R(null),S=R(null),ae=R(!1),oe=[`de`,`en`,`fr`,`it`],se=L(()=>H(S)?.language??t(i(),oe)),C=L(()=>({...ep[H(se)],...H(ie)})),w=R(`loading`),ce=R(null),le=R(null),ue=R(null),de=R(null),fe=R(!1),T=R(!1),E=R(!1),pe=R(Zt(gp)),D=L(()=>pp(c())),me=L(()=>mp(H(D))),he=L(()=>H(me)===null),ge=L(()=>H(me)??gp),_e=L(()=>l()===void 0?``:pp(l()));function ve(){if(!H(_e))return null;let e=mp(H(_e));return e===null?H(ce)?hp(H(ce),H(_e)):null:e}let ye=R(!1);En(()=>yp(e=>z(ye,e,!0)));function be(e){return H(ye)?0:e}let xe=new Ma(Sr(()=>H(ge)),{duration:400,easing:ka}),Se=R(!1);En(()=>{if(!H(Se)){if(H(T)){xe.set(H(pe),{duration:be(400)});return}!H(he)&&H(me)!==null&&xe.set(H(me),{duration:be(400)})}});function Ce(){return H(ce)?H(me)===null?hp(H(ce),H(D)):H(me):H(ge)}async function we(e){z(Se,!0),await xe.set(e,{duration:be(400)}),z(Se,!1)}function Te(){if(!H(ce))return Ce();if(H(ce).offsetHeight>0)return H(ce).offsetHeight;let e=H(ce).style.height;if(!e)return Ce();let t=mp(e);return t===null?hp(H(ce),e):t}let Ee=R(``),De=R(Zt([])),Oe=R(``),ke=R(null),Ae=R(!1),je=R(``),O=L(()=>y()&&r(y())?y():void 0),Me=L(()=>!!H(O)&&!!H(ke)),k=L(()=>H(Me)&&H(Ae)),A=L(()=>!H(T)&&H(fe)),Ne=L(()=>H(w)!==`opt-in`&&H(w)!==`loading`&&H(w)!==`error`&&(H(fe)||H(T))&&!(H(T)&&H(Me))),Pe=L(()=>u()&&H(w)!==`opt-in`),Fe=L(()=>H(T)?p()||H(C).searchSummaryCollapse:f()||H(C).searchSummaryExpand),Ie=L(()=>H(T)?H(C).ariaSearchSummaryCollapse:H(C).ariaSearchSummaryExpand),Le=R(``),Re=R(``),ze=null,Be=L(()=>H(T)?H(Re)||p()||H(C).searchSummaryCollapse:f()||H(Le)||H(C).searchSummaryExpand),Ve=L(()=>H(T)?H(Re)||p()||H(C).ariaSearchSummaryCollapse:f()||H(Le)||H(C).ariaSearchSummaryExpand),M=L(()=>H(S)?Ko(H(S).chatConfig.fullTheme[H(S).colorScheme].tokens,{root:`.search-summary`}):``),He=L(()=>H(S)?.chatConfig.fullTheme[H(S).colorScheme]?.customCSS?_p(H(S).chatConfig.fullTheme[H(S).colorScheme].customCSS):``),Ge=L(()=>H(S)?.chatConfig.fullTheme[H(S).colorScheme]?.fontCSS??``),Ke=L(()=>H(S)?.chatConfig.fullTheme[H(S).colorScheme]?.tokens?.svgs?.submit??``),N=L(()=>H(S)!==null),qe=L(()=>H(N)?` search-summary__btn`:``),Je=L(()=>H(N)?` search-summary__follow-up--themed`:``);function Ye(){if(!H(ce))return H(ge);let e=H(ce).style.height;H(ce).style.height=`auto`;let t=H(le)?.style.flex??``;H(le)&&(H(le).style.flex=`none`);let n=H(ce).scrollHeight;return H(le)&&(H(le).style.flex=t),H(ce).style.height=e,n}function Xe(){z(fe,(H(le)?.scrollHeight??0)>(H(le)?.offsetHeight??0)+1)}function Ze(){let e=Ye(),t=ve();z(pe,t===null?e:Math.min(e,t),!0),z(E,t!==null&&e>t,!0)}async function P(){if(H(ce))if(!H(T))Ze(),xe.set(Te(),{duration:0}),z(T,!0),z(w,`expanded`),await yr(),Xe(),Ze(),await we(H(pe));else{xe.set(Te(),{duration:0});let e=Ce();z(T,!1),z(w,H(Ee)?`done`:`loading`,!0),await yr(),Xe(),await we(e)}}let Qe=R(!1);On(()=>{H(Qe)||a()&&(z(w,u()&&!sp(a())?`opt-in`:`loading`,!0),z(Qe,!0))}),En(()=>{if(!a()||!h()){z(S,null),z(ie,null),z(ae,!0);return}let e=!1;return z(ae,!1),import(`./load-chat-config-D1K0jXrB.js`).then(({loadChatConfig:e})=>e({apiUrl:a(),lang:i(),forceTheme:g()})).then(t=>{e||(z(S,t,!0),z(ie,t.chatConfig.translations[t.language]??null,!0))}).catch(()=>{e||(z(S,null),z(ie,null))}).finally(()=>{e||z(ae,!0)}),()=>{e=!0}});let $e=L(()=>H(Qe)&&H(ae)),et=R(!1);En(()=>{if(!H($e)||H(et))return;let e=requestAnimationFrame(()=>z(et,!0));return()=>cancelAnimationFrame(e)}),En(()=>{if(!H(ce))return;H(Ee),H(De).length,H(D),Ze(),Xe();let e=new ResizeObserver(()=>{Ze(),Xe()});return e.observe(H(ce)),H(le)&&e.observe(H(le)),()=>e.disconnect()});function tt(e){return e.classList.add(`search-summary__btn--leaving`),{duration:be(200)}}function nt(e,t){if(H(ye)){t();return}let n=e.currentTarget;n.classList.add(`search-summary__btn--leaving`),n.addEventListener(`animationend`,t,{once:!0})}function rt(e=null){if(H(ye)){F();return}e?.classList.add(`search-summary__btn--leaving`),H(le)?.classList.add(`search-summary__content--leaving`),H(ue)?.classList.add(`search-summary__footer--leaving`),H(ue)?.querySelector(`.search-summary__expand, .search-summary__expand-slot-mount`)?.classList.add(`search-summary__btn--leaving`);let t=H(le)??e;t?t.addEventListener(`animationend`,F,{once:!0}):F()}function it(e){rt(e.currentTarget)}function at(){cp(a()),z(w,`loading`)}function ot(){lt?.(),ut&&ut.abort().catch(()=>{}),lt=void 0,ut=void 0,z(ke,null),z(Ae,!1),z(je,``),st=!1,z(Ee,``),z(De,[],!0),z(Oe,``),z(T,!1),z(fe,!1)}function F(){lp(a()),ot(),z(w,`opt-in`)}let st=!1,ct,lt,ut;function dt(){if(st)return;st=!0,ct=s();let e=new $f({apiUrl:a(),apiKey:o()});try{let t=e.createConversation();z(ke,t.id,!0),ut=t.chat(s(),{lang:H(se),mode:b()||void 0,source:ee()||void 0,cache:te()||void 0})}catch(e){z(Oe,e instanceof Error&&e.message?e.message:H(C).searchSummaryError,!0),z(w,`error`);return}lt=ut.subscribe(e=>{if(e.errors.length>0){z(Oe,e.errors.join(`, `)||H(C).searchSummaryError,!0),z(w,`error`);return}if(e.state===`loading`){z(w,`loading`);return}z(Ee,e.message.html,!0),z(De,e.references.used.slice().sort((e,t)=>(e.referenceIndex.used??0)-(t.referenceIndex.used??0)),!0),e.state===`streaming`?H(T)||z(w,`answering`):e.state===`done`&&(z(Ae,!0),H(T)||z(w,`done`),queueMicrotask(Xe))})}En(()=>{!s()||!a()||H(w)!==`loading`||dt()});function ft(){if(ot(),u()&&!sp(a())){z(w,`opt-in`);return}z(w,`loading`),dt()}En(()=>{let e=s();!e||!st||e===ct||Sr(()=>ft())}),li(()=>{lt?.(),ut&&ut.abort().catch(()=>{})}),En(()=>{H(de)&&(H(de).innerHTML=H(Ee),H(de).querySelectorAll(`liipgpt-reference-number`).forEach(e=>e.remove()),queueMicrotask(Xe))});function pt(e){e.preventDefault();let t=H(je).trim();if(!t||!H(O)||!H(ke))return;let n=new URL(H(O),window.location.href);if(n.pathname===window.location.pathname){let e=new URLSearchParams(window.location.search);for(let[t,r]of n.searchParams)e.set(t,r);n.search=e.toString()}n.searchParams.set(`follow-up-q`,t),n.hash=`cID=${H(ke)}`,window.location.assign(n.toString())}let mt=R(null),ht=R(null),gt=R(null);En(()=>{let e=H(mt),t=ne();if(!(!e||!t))return dp(e,t,at)?.({label:d()||void 0}),()=>fp(e,t)}),En(()=>{let e=H(ht),t=x();if(!(!e||!t||!H(Ne)))return ze!==t&&(ze=t,z(Le,t.textContent?.trim()??``,!0),z(Re,t.dataset.collapseLabel?.trim()??``,!0)),dp(e,t,P)?.({label:H(Be),ariaLabel:H(Ve),ariaExpanded:H(T)}),()=>fp(e,t)}),En(()=>{!x()||!H(Ne)||(x().textContent=H(Be),x().setAttribute(`aria-label`,H(Ve)),x().setAttribute(`aria-expanded`,String(H(T))))}),En(()=>{let e=H(gt),t=re();if(!(!e||!t||!H(Pe)))return dp(e,t,()=>rt(e))?.({label:m()||void 0,ariaLabel:H(C).ariaSearchSummaryOptOut}),()=>fp(e,t)});var _t={reload:ft,get lang(){return i()},set lang(e=`de`){i(e),I()},get apiUrl(){return a()},set apiUrl(e){a(e),I()},get apiKey(){return o()},set apiKey(e=``){o(e),I()},get question(){return s()},set question(e){s(e),I()},get height(){return c()},set height(e=`280`){c(e),I()},get maxHeight(){return l()},set maxHeight(e){l(e),I()},get optIn(){return u()},set optIn(e=!1){u(e),I()},get optInLabel(){return d()},set optInLabel(e){d(e),I()},get expandLabel(){return f()},set expandLabel(e){f(e),I()},get collapseLabel(){return p()},set collapseLabel(e){p(e),I()},get optOutLabel(){return m()},set optOutLabel(e){m(e),I()},get useChatConfig(){return h()},set useChatConfig(e=!1){h(e),I()},get forceTheme(){return g()},set forceTheme(e){g(e),I()},get disclaimerHtml(){return _()},set disclaimerHtml(e=``){_(e),I()},get labelledBy(){return v()},set labelledBy(e){v(e),I()},get chatUrl(){return y()},set chatUrl(e){y(e),I()},get mode(){return b()},set mode(e=`search`){b(e),I()},get source(){return ee()},set source(e=`search-summary`){ee(e),I()},get cache(){return te()},set cache(e=!1){te(e),I()},get activateAiButtonSlot(){return ne()},set activateAiButtonSlot(e=null){ne(e),I()},get expandAnswerButtonSlot(){return x()},set expandAnswerButtonSlot(e=null){x(e),I()},get deactivateAiButtonSlot(){return re()},set deactivateAiButtonSlot(e=null){re(e),I()}},vt=Rp(),yt=un(vt);np(yt,{id:`search-summary-css`,get css(){return tp}});var bt=dn(yt,2),xt=e=>{var t=bp(),n=un(t);np(n,{id:`search-summary-font-css`,get css(){return H(Ge)}});var r=dn(n,2);np(r,{id:`search-summary-theme-css`,get css(){return H(M)}});var i=dn(r,2),a=e=>{np(e,{id:`search-summary-custom-css`,get css(){return H(He)}})};di(i,e=>{H(He)&&e(a)}),U(e,t)};di(bt,e=>{H(N)&&H(M)&&e(xt)});var St=dn(bt,2);let Ct,wt;var Tt=ln(St),Et=e=>{var t=wp(),n=ln(t),r=ln(n),i=ln(r),a=e=>{var t=Vr(),n=un(t),r=e=>{var t=xp();xi(t,()=>H(C).searchSummaryDisclaimer,!0),j(t),U(e,t)};di(n,e=>{H(C).searchSummaryDisclaimer&&e(r)}),U(e,t)},o=e=>{var t=Vr();xi(un(t),_),U(e,t)};di(i,e=>{h()?e(a):e(o,-1)}),j(r),j(n);var s=dn(n,2),c=ln(s),l=e=>{var t=Sp();_a(t,e=>z(mt,e),()=>H(mt)),U(e,t)},u=e=>{var t=Cp(),n=ln(t,!0);j(t),Pn(()=>{Ui(t,1,`search-summary__opt-in${H(qe)??``}${H(N)?` search-summary__btn--secondary`:``}`),ei(n,d()||H(C).searchSummaryOptInDefault)}),Ar(`click`,t,e=>nt(e,at)),U(e,t)};di(c,e=>{ne()?e(l):e(u,-1)}),j(s),j(t),U(e,t)},Dt=e=>{var t=Lp(),n=un(t);let r;var i=ln(n),a=ln(i),o=e=>{var t=Tp(),n=dn(ln(t),2),r=ln(n,!0);j(n),j(t),Pn(()=>ei(r,H(C).searchSummaryLoading)),U(e,t)};di(a,e=>{H(w)===`loading`&&e(o)});var s=dn(a,2);let c;_a(s,e=>z(de,e),()=>H(de)),j(i);var l=dn(i,2),u=e=>{var t=Ep(),n=ln(t,!0);j(t),Pn(()=>ei(n,H(Oe)||H(C).searchSummaryError)),U(e,t)};di(l,e=>{H(w)===`error`&&e(u)});var d=dn(l,2),f=e=>{var t=Op(),n=un(t),r=ln(n,!0);j(n);var i=dn(n,2);hi(i,21,()=>H(De),e=>e.referenceIndex.used??e.url,(e,t)=>{var n=Dp(),r=ln(n),i=ln(r,!0);j(r),j(n),Pn(()=>{aa(n,H(t).referenceIndex.used??void 0),sa(r,`href`,H(t).url),sa(r,`tabindex`,H(A)?-1:void 0),ei(i,H(t).display.listItem.title||H(t).display.card.title||H(t).url)}),U(e,n)}),j(i),Pn(()=>ei(r,H(C).referencesTitle)),U(e,t)};di(d,e=>{H(De).length>0&&e(f)});var p=dn(d,2),h=e=>{var t=jp(),n=ln(t),r=ln(n,!0);j(n);var i=dn(n,2),a=ln(i);ia(a);var o=dn(a,2),s=ln(o),c=ln(s,!0);j(s);var l=dn(s,2),u=e=>{var t=kp();xi(t,()=>H(Ke),!0),j(t),U(e,t)},d=e=>{U(e,Ap())};di(l,e=>{H(Ke)?e(u):e(d,-1)}),j(o),j(i),j(t),Pn(()=>{Ui(t,1,`search-summary__follow-up${H(Je)??``}`),t.inert=H(A),ei(r,H(C).ariaSearchSummaryFollowUpInput),sa(a,`placeholder`,H(C).searchSummaryFollowUpPlaceholder),sa(a,`aria-label`,H(C).ariaSearchSummaryFollowUpInput),sa(o,`aria-label`,H(C).searchSummaryFollowUpSubmit),ei(c,H(C).searchSummaryFollowUpSubmit)}),kr(`submit`,t,pt),pa(a,()=>H(je),e=>z(je,e)),U(e,t)};di(p,e=>{H(k)&&e(h)}),j(n),_a(n,e=>z(le,e),()=>H(le));var g=dn(n,2),_=e=>{var t=Ip();let n;var r=ln(t),i=ln(r),a=e=>{var t=Vr(),n=un(t),r=e=>{var t=Mp();_a(t,e=>z(ht,e),()=>H(ht)),Ai(2,t,()=>tt),U(e,t)},i=e=>{var t=Np(),n=ln(t,!0);j(t),Pn(()=>{Ui(t,1,`search-summary__expand${H(qe)??``}${H(N)?` search-summary__btn--primary`:``}`),sa(t,`aria-expanded`,H(T)),sa(t,`aria-label`,H(Ie)),ei(n,H(Fe))}),Ar(`click`,t,P),Ai(2,t,()=>tt),U(e,t)};di(n,e=>{x()?e(r):e(i,-1)}),U(e,t)};di(i,e=>{H(Ne)&&e(a)}),j(r);var o=dn(r,2),s=e=>{var t=Vr(),n=un(t),r=e=>{var t=Pp();_a(t,e=>z(gt,e),()=>H(gt)),U(e,t)},i=e=>{var t=Fp(),n=ln(t,!0);j(t),Pn(()=>{Ui(t,1,`search-summary__opt-out${H(qe)??``}${H(N)?` search-summary__btn--secondary`:``}`),sa(t,`aria-label`,H(C).ariaSearchSummaryOptOut),ei(n,m()||H(C).searchSummaryOptOut)}),Ar(`click`,t,it),U(e,t)};di(n,e=>{re()?e(r):e(i,-1)}),U(e,t)};di(o,e=>{H(Pe)&&e(s)}),j(t),_a(t,e=>z(ue,e),()=>H(ue)),Pn(()=>n=Ui(t,1,`search-summary__footer`,null,n,{"search-summary__footer--overlay":H(k)})),U(e,t)};di(g,e=>{(!H(k)||H(Ne)||H(Pe))&&e(_)}),Pn(()=>{r=Ui(n,1,`search-summary__content`,null,r,{"search-summary__content--with-follow-up":H(k)}),c=Ui(s,1,`search-summary__answer`,null,c,{"search-summary__answer--themed":H(N)})}),U(e,t)};return di(Tt,e=>{H(w)===`opt-in`?e(Et):e(Dt,-1)}),j(St),_a(St,e=>z(ce,e),()=>H(ce)),Pn(()=>{Ct=Ui(St,1,`search-summary`,null,Ct,{"search-summary--ready":H(et)}),sa(St,`data-state`,H(w)),sa(St,`data-expanded`,H(T)?`true`:`false`),sa(St,`data-capped`,H(T)&&H(E)?`true`:void 0),sa(St,`role`,v()?`region`:void 0),sa(St,`aria-labelledby`,v()),wt=Gi(St,``,wt,{height:H(T)||H(Se)||!H(he)?`${xe.current}px`:H(D),"max-height":H(_e)||null})}),U(e,vt),We(_t)}jr([`click`]),Da(zp,{lang:{},apiUrl:{},apiKey:{},question:{},height:{},maxHeight:{},optIn:{},optInLabel:{},expandLabel:{},collapseLabel:{},optOutLabel:{},useChatConfig:{},forceTheme:{},disclaimerHtml:{},labelledBy:{},chatUrl:{},mode:{},source:{},cache:{},activateAiButtonSlot:{},expandAnswerButtonSlot:{},deactivateAiButtonSlot:{}},[],[`reload`],{mode:`open`});function Bp(e,t){Ue(t,!0);let n=W(t,`lang`,7),r=W(t,`apiUrl`,7),i=W(t,`apiKey`,7),a=W(t,`question`,7),o=W(t,`height`,7),s=W(t,`maxHeight`,7),c=W(t,`optIn`,7),l=W(t,`optInLabel`,7),u=W(t,`expandLabel`,7),d=W(t,`collapseLabel`,7),f=W(t,`optOutLabel`,7),p=W(t,`useChatConfig`,7),m=W(t,`forceTheme`,7),h=W(t,`wrapperClass`,7),g=W(t,`labelledBy`,7),_=W(t,`chatUrl`,7),v=W(t,`mode`,7),y=W(t,`source`,7),b=W(t,`cache`,7),ee=L(()=>({lang:n(),apiUrl:r(),apiKey:i(),question:a(),height:o(),maxHeight:s(),optIn:c(),optInLabel:l(),expandLabel:u(),collapseLabel:d(),optOutLabel:f(),useChatConfig:p(),forceTheme:m(),labelledBy:g(),chatUrl:_(),mode:v(),source:y(),cache:b()})),te=R(void 0),ne=t.$$host;En(()=>{ne&&h()&&(ne.className=h())}),En(()=>{if(!ne||!H(te))return;let e=ne;return e.reload=()=>H(te)?.reload(),()=>{delete e.reload}});let x=L(()=>ne?.querySelector(`[slot="disclaimer"]`)?.innerHTML??``),re=R(null),ie=R(null),S=R(null);return On(()=>{if(p()){z(re,null),z(ie,null),z(S,null);return}z(re,ne?.querySelector(`[slot="activate-ai-button"]`)??null,!0),z(ie,ne?.querySelector(`[slot="expand-answer-button"]`)??null,!0),z(S,ne?.querySelector(`[slot="deactivate-ai-button"]`)??null,!0)}),_a(zp(e,xa(()=>H(ee),{get disclaimerHtml(){return H(x)},get activateAiButtonSlot(){return H(re)},get expandAnswerButtonSlot(){return H(ie)},get deactivateAiButtonSlot(){return H(S)}})),e=>z(te,e,!0),()=>H(te)),We({get lang(){return n()},set lang(e){n(e),I()},get apiUrl(){return r()},set apiUrl(e){r(e),I()},get apiKey(){return i()},set apiKey(e){i(e),I()},get question(){return a()},set question(e){a(e),I()},get height(){return o()},set height(e){o(e),I()},get maxHeight(){return s()},set maxHeight(e){s(e),I()},get optIn(){return c()},set optIn(e){c(e),I()},get optInLabel(){return l()},set optInLabel(e){l(e),I()},get expandLabel(){return u()},set expandLabel(e){u(e),I()},get collapseLabel(){return d()},set collapseLabel(e){d(e),I()},get optOutLabel(){return f()},set optOutLabel(e){f(e),I()},get useChatConfig(){return p()},set useChatConfig(e){p(e),I()},get forceTheme(){return m()},set forceTheme(e){m(e),I()},get wrapperClass(){return h()},set wrapperClass(e){h(e),I()},get labelledBy(){return g()},set labelledBy(e){g(e),I()},get chatUrl(){return _()},set chatUrl(e){_(e),I()},get mode(){return v()},set mode(e){v(e),I()},get source(){return y()},set source(e){y(e),I()},get cache(){return b()},set cache(e){b(e),I()}})}customElements.define(`liipgpt-search-summary`,Da(Bp,{lang:{attribute:`lang`,type:`String`},apiUrl:{attribute:`api-url`,type:`String`},apiKey:{attribute:`api-key`,type:`String`},question:{attribute:`question`,type:`String`},height:{attribute:`height`,type:`String`},maxHeight:{attribute:`max-height`,type:`String`},optIn:{attribute:`opt-in`,type:`Boolean`},optInLabel:{attribute:`opt-in-label`,type:`String`},expandLabel:{attribute:`expand-label`,type:`String`},collapseLabel:{attribute:`collapse-label`,type:`String`},optOutLabel:{attribute:`opt-out-label`,type:`String`},useChatConfig:{attribute:`use-chat-config`,type:`Boolean`},forceTheme:{attribute:`force-theme`,type:`String`},wrapperClass:{attribute:`wrapper-class`,type:`String`},labelledBy:{attribute:`labelled-by`,type:`String`},chatUrl:{attribute:`chat-url`,type:`String`},mode:{attribute:`mode`,type:`String`},source:{attribute:`source`,type:`String`},cache:{attribute:`cache`,type:`Boolean`}},[],[]));export{Bp as LiipGPTSearchSummary,Al as PiiChecks};
63
+ `,{error:u,url:i,opts:a,data:s}),s}async postData(e,t){let n=await fetch(`${this.options.apiUrl}${e}`,{method:`POST`,headers:this.getDefaultHeaders(),body:JSON.stringify(t)});if(!n.ok){let e=await n.text();throw Error(`${n.status} - ${e}`)}return n}async postFormData(e,t){let n=await fetch(`${this.options.apiUrl}${e}`,{method:`POST`,body:t});if(!n.ok){let e=await n.text();throw Error(`${n.status} - ${e}`)}return n}},Hf=Q({links:Z(wd([Q({url:$(dd()),title:$(Y()),considered:$(X()),orgMetadata:$(Q({authors:$(Z(Y()))})),type:$(Y()),date:$(Hd()),similarity:$(pd()),content:$(Y()),fromFullTextSearch:$(X()),rerank:$(Q({index:$(hd()),adjustment:$(pd()),score:$(pd()),similarityOld:$(pd())}))}),Zd]))}),Uf=e=>{if(`metadata`in e)return e;console.warn(`Please upgrade your backend you are currently using an old api feature.`);let t=e.orgMetadata??{};e?.fromFullTextSearch&&(t.fromFullTextSearch=e?.fromFullTextSearch),e?.rerank&&(t.rerank=e?.rerank);let n=[],r=e.title??``;if(e.title&&e.title.includes(` > `)){let t=e.title.split(` > `);r=t.pop()??``,n=t}return{url:e.url??``,title:r,score:e.similarity||0,breadcrumbs:n,metadata:t,description:e.content,date:e.date}},Wf=7,Gf=8,Kf=160,qf=e=>{let t=[],n=0;for(;n<e.length;){let r=e[n];if(r===`<`){let r=e.indexOf(`>`,n);if(r!==-1){t.push({type:`tag`,value:e.slice(n,r+1)}),n=r+1;continue}}if(/\s/.test(r)){let r=n;for(;r<e.length&&/\s/.test(e[r]);)r++;t.push({type:`space`,value:e.slice(n,r)}),n=r;continue}let i=n;for(;i<e.length&&!/\s/.test(e[i])&&e[i]!==`<`;)i++;t.push({type:`word`,value:e.slice(n,i)}),n=i}return t},Jf=e=>{let t=qf(e),n=[],r=``,i=!1;for(let e of t)e.type===`space`&&i?(n.push(r),r=e.value,i=!1):(r+=e.value,e.type===`word`&&(i=!0));return r&&n.push(r),n},Yf=e=>Math.max(Gf,Math.min(Kf,e.length*Wf)),Xf=class{queue=[];timeoutId=null;isProcessing=!1;constructor(e){this.onText=e}ingestText(e){let t=Jf(e);if(t.length>=5){for(let e of t)this.queue.push({kind:`text`,chunk:e,delayMs:Yf(e)});this.kickoff();return}this.runAfterTyping(()=>this.onText(e))}runAfterTyping(e){if(this.queue.length===0&&!this.isProcessing){e();return}this.queue.push({kind:`fn`,fn:e}),this.kickoff()}runWithWarmup(e){this.queue.push({kind:`fn`,fn:e}),this.kickoff()}clear(){this.timeoutId!==null&&(clearTimeout(this.timeoutId),this.timeoutId=null),this.queue=[],this.isProcessing=!1}kickoff(){this.isProcessing||this.timeoutId!==null||(this.timeoutId=setTimeout(()=>{this.timeoutId=null,this.processNext()},750))}processNext(){let e=this.queue.shift();if(!e){this.isProcessing=!1;return}this.isProcessing=!0,e.kind===`text`?(this.onText(e.chunk),this.timeoutId=setTimeout(()=>{this.timeoutId=null,this.processNext()},e.delayMs)):(e.fn(),this.processNext())}},Zf=class{constructor(e){this.results=e}},Qf=45e3,$f=class{internalData;renderers=new Map;markedExtensions=[];_newTabSrText;chatTimeout;constructor(e){this.chatTimeout=e.chatTimeout??Qf;let t=new Vf({apiUrl:e.apiUrl,apiKey:e.apiKey,speechRecognitionApiKey:e.speechRecognitionApiKey,strict:e.strict??!1,EventSource:e.EventSource??EventSource});this.internalData={restClient:t,metadata:Lf(t,e.startParameters),searchResponseMap:new Map,chatResponseMap:new Map,conversationMap:new Map}}setMarkedExtensions(...e){this.markedExtensions=e}setNewTabSrText(e){this._newTabSrText=e}getMetadata(){return this.internalData.metadata}createConversationId(){let e=jf();return this.renderers.set(e,new Sl({extensions:this.markedExtensions,newTabSrText:this._newTabSrText})),e}chat(e,t,n={}){let r=new Tl,i=jf(),a=new wl,o=new kl({id:i,onError:e=>{n.onError?.(e)},onFinish:e=>{r.setValue(e)},markdownRenderer:this.renderers.get(e)??new Sl({extensions:this.markedExtensions,newTabSrText:this._newTabSrText}),userQuestion:t}),s=async()=>{await a,!(f&&!c.getCurrentValue())&&(await c).close()},c=new Tl,l=new Xf(e=>o.updateText(e)),u=n.timeout??this.chatTimeout,d,f=!1,p=()=>{d!==void 0&&clearTimeout(d),d=void 0},m=()=>{f=!0,d=void 0,console.error(`No SSE activity for ${u}ms, giving up on chat request ${i}`),l.clear(),o.pushError(`sse-error`);let e=c.getCurrentValue();if(e){e.close();return}o.finishMessage(),a.resolve()},h=()=>{p(),u>0&&!f&&(d=setTimeout(m,u))};h(),(async()=>{let s=await this.internalData.metadata;if(s.mode===`maintenance`)throw Error(`Can not chat in maintenance mode`);let u=await this.internalData.restClient.subscribeSse(`/assistant/sse`,{query:t,uID:s.userId,cID:e,rID:i,lang:n.lang,feature:n.features?.join(`,`),referrer:n.referrer,source:n.source,...n.selectorValues??{},...n.mode?{mode:n.mode}:{},...n.cache?{cache:!0}:{},...n.predefinedQuestionId?{predefinedQuestionId:n.predefinedQuestionId}:{},...n.switchQuestionId?{switchQuestionId:n.switchQuestionId}:{},chat:`true`,version:`2`},{onClose:()=>{p(),l.clear(),o.finishMessage(),a.resolve(),r.cleanup()},onMessage:t=>{let r=t;switch(h(),r.type){case`error`:l.runAfterTyping(()=>o.pushError(r.error));break;case`id`:r.for===`request`&&i!==r.id&&console.warn(`Unexpected request id "${r.id}" expected "${i}"`),r.for===`conversation`&&e!==r.id&&console.warn(`Unexpected conversation id "${r.id}" expected "${e}"`);break;case`state`:r.state===`history-entry-initialized`&&a.resolve();break;case`text`:l.ingestText(r.text);break;case`done`:case`answer-done`:p(),l.runAfterTyping(()=>{o.finishMessage(),a.resolve(),c.then(e=>e.close())});break;case`unexpected-call`:l.runAfterTyping(()=>{console.error(`unexpected-call:`,r),o.pushError(`unexpected-call`)});break;case`jsonld-component`:case`mapped-reference`:l.runAfterTyping(()=>o.addMappedReference(r.reference));break;case`reference`:l.runAfterTyping(()=>o.addOldReference(r.reference));break;case`retrieval-question`:l.runAfterTyping(()=>o.updateRetrievalQuestion(r.question));break;case`no-feedback`:l.runAfterTyping(()=>o.setNoFeedback());break;case`component`:l.runWithWarmup(()=>n.onEmbed?.(r));break}l.runAfterTyping(()=>n.onMessage?.(r))},onError:e=>{console.error(` sse-error:`,e),!(`data`in e&&!e.data&&`responseCode`in e&&e.responseCode===0)&&o.pushError(`sse-error`)}});c.setValue(u),f&&u.close()})();let g=new Cf({question:t,id:i,content:r,readableStore:o.getReadableStore(),readyForFeedback:a,abort:s,liipgptClientPrimitive:this});return this.internalData.chatResponseMap.set(g.id,g),g}async thumbs(e,t,n){if((await this.internalData.metadata).mode!==`ready`)throw Error(`Can not post feedback unless we are in ready mode`);let r={feedback:n,rID:e,query:t};await this.internalData.restClient.postData(`/quickfeedback`,r)}thumbsUp(e,t){return this.thumbs(e,t,`positive`)}thumbsDown(e,t){return this.thumbs(e,t,`negative`)}async feedback(e,t,n){let r=await this.internalData.metadata;if(r.mode!==`ready`)throw Error(`Can not post feedback unless we are in ready mode`);if(n.message){let i={body:n.message,email:n.email,rID:e,uID:r.userId,query:t};await this.internalData.restClient.postData(`/feedback`,i)}n.classification&&await this.internalData.restClient.postData(`/classification`,{impact:n.classification.impact,quality:n.classification.quality,rID:e})}async submitAnswerForm(e){let t=await this.internalData.metadata;if(t.mode!==`ready`)throw Error(`Can not submit the answer form unless we are in ready mode`);let n={receiverEmail:e.receiverEmail,fields:e.fields,query:e.question,answer:e.answer,rID:e.requestId,uID:t.userId,lang:e.lang};await this.internalData.restClient.postData(`/customform`,n)}async userAction(e,t={}){let n=await this.internalData.metadata;if(n.mode!==`ready`)throw Error(`Can not post user action unless we are in ready mode`);let r={uID:n.userId,cID:t.conversationId,lang:t.lang,userAction:e};await this.internalData.restClient.postData(`/assistant/userAction`,r)}async search(e,t={}){let n=await this.internalData.metadata,r=n.mode===`ready`?n.userId:void 0,{links:i}=await this.internalData.restClient.fetchData(`/assistant/search`,Hf,{modelId:t.model,lang:t.language,query:e,mapResults:`true`,uID:r});return new Zf(i.map(Uf))}async getChatConfig(){return this.internalData.restClient.fetchData(`/chatconfig`,Sf)}async getChatHistory(e,t){try{let n=await this.internalData.restClient.postData(`/chathistory`,{cID:e,uID:t}),r=nf.safeParse(await n.json());return r.success?r.data:[]}catch(e){return console.error(`Failed to load chat history:`,e),[]}}async getPredefinedQuestions(e){return(await this.internalData.restClient.fetchData(`/topics/questions`,_f,e)).predefinedQuestions}async transcribeAudio(e,t={}){let n=await this.internalData.metadata,r=t.lang||`de-CH`;if(n.mode===`maintenance`)throw Error(`Can not transcribe audio in maintenance mode`);try{let t=(e=>e.includes(`mp4`)?`mp4`:e.includes(`webm`)?`webm`:(e.includes(`wav`),`wav`))(e.type),n=new FormData;return n.append(`file`,e,`audio.${t}`),n.append(`lang`,r),n.append(`type`,e.type),{transcript:await(await this.internalData.restClient.postFormData(`/speech?key=${this.internalData.restClient.speechRecognitionApiKey||``}&lang=${r}`,n)).text()||``,error:void 0}}catch(e){return console.error(`Error transcribing audio:`,e),{transcript:``,error:e instanceof Error?e.message:`Unknown error`}}}},ep=class{clientPrimitive;constructor(e){this.clientPrimitive=new $f(e)}getMetadata(){return this.clientPrimitive.getMetadata()}createConversation(){return new wf(this.clientPrimitive)}search(e,t={}){return this.clientPrimitive.search(e,t)}getChatConfig(){return this.clientPrimitive.getChatConfig()}getPredefinedQuestions(e){return this.clientPrimitive.getPredefinedQuestions(e)}},tp={de:{searchSummaryExpand:`Gesamte Antwort`,searchSummaryCollapse:`Weniger anzeigen`,searchSummaryOptInDefault:`KI-Suche aktivieren`,searchSummaryOptOut:`KI-Suche deaktivieren`,searchSummaryError:`Etwas ist schiefgelaufen.`,searchSummaryLoading:`Antwort wird generiert…`,searchSummaryDisclaimer:`<p><strong>Ich bin ein KI-Assistent.</strong></p><p>Meine Antworten werden von einer künstlichen Intelligenz generiert und sind deshalb nicht immer korrekt. Wenn Sie mich aktivieren, unterstütze ich Sie bei der Suche nach den richtigen Informationen.</p>`,ariaSearchSummaryExpand:`Vollständige Antwort anzeigen`,ariaSearchSummaryCollapse:`Antwort einklappen`,ariaSearchSummaryOptOut:`KI-Suche deaktivieren`,referencesTitle:`Quellen`,searchSummaryFollowUpPlaceholder:`Stellen Sie eine Folgefrage…`,searchSummaryFollowUpSubmit:`Im Chat fortfahren`,ariaSearchSummaryFollowUpInput:`Frage stellen`},en:{searchSummaryExpand:`Full answer`,searchSummaryCollapse:`Show less`,searchSummaryOptInDefault:`Enable AI search`,searchSummaryOptOut:`Disable AI search`,searchSummaryError:`Something went wrong.`,searchSummaryLoading:`Generating answer…`,searchSummaryDisclaimer:`<p><strong>I am an AI assistant.</strong></p><p>My answers are generated by artificial intelligence and may not always be correct. If you activate me, I will help you find the right information.</p>`,ariaSearchSummaryExpand:`Show full answer`,ariaSearchSummaryCollapse:`Collapse answer`,ariaSearchSummaryOptOut:`Disable AI search`,referencesTitle:`References`,searchSummaryFollowUpPlaceholder:`Ask a follow-up question…`,searchSummaryFollowUpSubmit:`Continue in chat`,ariaSearchSummaryFollowUpInput:`Ask a follow-up question`},it:{searchSummaryExpand:`Risposta completa`,searchSummaryCollapse:`Mostra meno`,searchSummaryOptInDefault:`Attiva la ricerca IA`,searchSummaryOptOut:`Disattiva la ricerca IA`,searchSummaryError:`Si è verificato un errore.`,searchSummaryLoading:`Generazione della risposta…`,searchSummaryDisclaimer:`<p><strong>Sono un assistente IA.</strong></p><p>Le mie risposte sono generate da un'intelligenza artificiale e potrebbero non essere sempre corrette. Se mi attivi, ti aiuto a trovare le informazioni giuste.</p>`,ariaSearchSummaryExpand:`Mostra la risposta completa`,ariaSearchSummaryCollapse:`Comprimi la risposta`,ariaSearchSummaryOptOut:`Disattiva la ricerca IA`,referencesTitle:`Riferimenti`,searchSummaryFollowUpPlaceholder:`Fai una domanda di approfondimento…`,searchSummaryFollowUpSubmit:`Continua nella chat`,ariaSearchSummaryFollowUpInput:`Fai una domanda di approfondimento`},fr:{searchSummaryExpand:`Réponse complète`,searchSummaryCollapse:`Afficher moins`,searchSummaryOptInDefault:`Activer la recherche IA`,searchSummaryOptOut:`Désactiver la recherche IA`,searchSummaryError:`Une erreur s'est produite.`,searchSummaryLoading:`Génération de la réponse…`,searchSummaryDisclaimer:`<p><strong>Je suis un assistant IA.</strong></p><p>Mes réponses sont générées par une intelligence artificielle et peuvent ne pas toujours être correctes. Si vous m'activez, je vous aide à trouver les bonnes informations.</p>`,ariaSearchSummaryExpand:`Afficher la réponse complète`,ariaSearchSummaryCollapse:`Réduire la réponse`,ariaSearchSummaryOptOut:`Désactiver la recherche IA`,referencesTitle:`Références`,searchSummaryFollowUpPlaceholder:`Posez une question de suivi…`,searchSummaryFollowUpSubmit:`Continuer dans le chat`,ariaSearchSummaryFollowUpInput:`Poser une question de suivi`}},np=`liipgpt-search-summary>[slot]{display:none}@layer components{@keyframes search-summary-spin{to{transform:rotate(360deg)}}@keyframes search-summary-content-appear{0%{opacity:0}}@keyframes search-summary-content-disappear{to{opacity:0}}@keyframes search-summary-action-appear{0%{opacity:0;transform:translateY(12px)}}@keyframes search-summary-action-disappear{to{opacity:0;transform:translateY(12px)}}.search-summary{box-sizing:border-box;padding:var(--search-summary-padding,0);border-width:var(--search-summary-border-width,0);border-style:var(--search-summary-border-style,solid);border-radius:var(--search-summary-border-radius,0);border-color:var(--search-summary-border-color,transparent);background:var(--search-summary-background,transparent);box-shadow:var(--search-summary-box-shadow,none);color:var(--search-summary-color,var(--body-color,inherit));font-weight:var(--base-font-weight-normal,inherit);font-size:var(--base-font-size-body,inherit);line-height:var(--base-line-height-default,inherit);font-family:var(--search-summary-font-family,var(--font-family,inherit));font-optical-sizing:auto;transition:opacity var(--search-summary-fade-duration,.2s) ease-out;flex-direction:column;padding-bottom:0;display:flex;position:relative;overflow:hidden}.search-summary :where(button){cursor:pointer;font-family:inherit}.search-summary :where(.search-summary__sr-only){clip:rect(0, 0, 0, 0);white-space:nowrap;border-width:0;width:1px;height:1px;margin:-1px;padding:0;position:absolute;overflow:hidden}.search-summary:where(.search-summary--ready[data-state=loading]),.search-summary:where(.search-summary--ready[data-state=answering]){opacity:var(--search-summary-loading-opacity,1)}.search-summary:where([data-state=error]){border-color:var(--search-summary-error-border-color,inherit)}.search-summary :where(.search-summary__content){min-height:0;padding-bottom:var(--search-summary-padding,0);flex:1;animation:.35s ease-out both search-summary-content-appear;display:block;position:relative;overflow:hidden}.search-summary :where(.search-summary__content--with-follow-up){flex-direction:column;display:flex}.search-summary:where([data-capped=true]) :where(.search-summary__content){overflow-y:auto}.search-summary :where(.search-summary__content--leaving),.search-summary :where(.search-summary__footer--leaving){pointer-events:none;animation:.25s ease-in both search-summary-content-disappear}.search-summary :where(.search-summary__answer-wrap){display:block;position:relative}.search-summary :where(.search-summary__answer){margin-bottom:var(--spacer-16,1rem);line-height:var(--search-summary-answer-line-height,1.5)}.search-summary :where(.search-summary__answer a){color:var(--search-summary-link-color,LinkText);text-decoration:underline}.search-summary :where(.search-summary__answer p){margin-top:0}.search-summary :where(.search-summary__answer--themed){font-size:var(--base-font-size-body,inherit);line-height:var(--search-summary-answer-line-height,var(--base-line-height-default,1.5))}.search-summary :where(.search-summary__answer--themed>:first-child){margin-top:0}.search-summary :where(.search-summary__answer--themed>:last-child){margin-bottom:0}.search-summary :where(.search-summary__answer--themed p,.search-summary__answer--themed ul,.search-summary__answer--themed ol){margin-top:0;margin-bottom:var(--spacer-r-16,1rem)}.search-summary :where(.search-summary__answer--themed h1,.search-summary__answer--themed h2,.search-summary__answer--themed h3,.search-summary__answer--themed h4,.search-summary__answer--themed h5,.search-summary__answer--themed h6){margin-top:var(--spacer-r-24,1.5rem);margin-bottom:var(--spacer-r-12,.75rem);font-weight:var(--base-font-weight-title,700);line-height:var(--base-line-height-tight,1.2)}.search-summary :where(.search-summary__answer--themed ul,.search-summary__answer--themed ol){padding-left:1.5em;list-style-position:outside}.search-summary :where(.search-summary__answer--themed ul){list-style-type:disc}.search-summary :where(.search-summary__answer--themed ol){list-style-type:decimal}.search-summary :where(.search-summary__answer--themed li){margin-bottom:var(--spacer-8,.5rem)}.search-summary :where(.search-summary__answer--themed li:last-child){margin-bottom:0}.search-summary :where(.search-summary__answer--themed b,.search-summary__answer--themed strong){font-weight:var(--base-font-weight-bold,700)}.search-summary :where(.search-summary__answer--themed a){color:var(--search-summary-link-color,var(--anchor-color,LinkText))}.search-summary :where(.search-summary__loading){margin-bottom:var(--spacer-16,1rem);align-items:center;gap:var(--spacer-8,.5rem);display:flex}.search-summary :where(.search-summary__loading-spinner){border:1.5px solid var(--anchor-color,currentColor);border-top-color:#0000;border-radius:50%;flex-shrink:0;width:.5em;height:.5em;animation:.4s linear infinite search-summary-spin;display:inline-block}.search-summary :where(.search-summary__loading-text){font-size:var(--base-font-size-default,inherit)}.search-summary :where(.search-summary__references){padding:0;padding-bottom:var(--spacer-32,2rem);color:var(--search-summary-reference-list-color,inherit);font-size:var(--search-summary-reference-list-font-size,inherit);font-size:var(--base-font-size-sm,inherit);margin:0;list-style-type:none}.search-summary :where(.search-summary__references-title){padding:var(--spacer-2,2px) 0;font-weight:var(--base-font-weight-bold,500);font-size:var(--base-font-size-sm,inherit)}.search-summary :where(.search-summary__reference){display:list-item}.search-summary :where(.search-summary__reference a){padding:var(--spacer-2,2px) 0;color:var(--search-summary-reference-list-color,var(--search-summary-link-color,LinkText));display:block}.search-summary :where(.search-summary__follow-up){padding-top:var(--spacer-12,.75rem);flex-shrink:0;margin-top:auto}.search-summary :where(.search-summary__follow-up-field){align-items:center;gap:var(--spacer-8,.5rem);display:flex}.search-summary :where(.search-summary__follow-up-input){border-width:var(--search-summary-follow-up-border-width,revert);border-style:var(--search-summary-follow-up-border-style,revert);border-radius:var(--search-summary-follow-up-border-radius,revert);border-color:var(--search-summary-follow-up-border-color,revert);background:var(--search-summary-follow-up-background,revert);min-width:0;color:var(--search-summary-follow-up-color,revert);font:inherit;flex:auto}.search-summary :where(.search-summary__follow-up-submit){border-width:var(--search-summary-follow-up-submit-border-width,revert);border-style:var(--search-summary-follow-up-submit-border-style,revert);border-radius:var(--search-summary-follow-up-submit-border-radius,revert);border-color:var(--search-summary-follow-up-submit-border-color,revert);background:var(--search-summary-follow-up-submit-background,revert);color:var(--search-summary-follow-up-submit-color,revert);font:inherit;flex-shrink:0;justify-content:center;align-items:center;display:inline-flex}.search-summary :where(.search-summary__follow-up-submit-icon){width:var(--spacer-20,1.25rem);height:var(--spacer-20,1.25rem);pointer-events:none}.search-summary :where(.search-summary__follow-up-submit-icon) :where(svg){width:100%;height:100%;display:block}.search-summary :where(.search-summary__follow-up--themed .search-summary__follow-up-field){padding:var(--spacer-4,.25rem) var(--spacer-8,.5rem) var(--spacer-4,.25rem) var(--spacer-16,1rem);border-width:var(--chat-input-border-width,var(--spacer-1,1px));border-radius:var(--chat-input-border-radius,1.75rem);border-style:solid;border-color:var(--chat-input-border-color,currentColor);background:var(--chat-input-background,transparent);box-shadow:var(--chat-input-box-shadow,none);transition:background .2s,border-color .2s,border-width .2s,border-radius .2s,box-shadow .2s}.search-summary :where(.search-summary__follow-up--themed .search-summary__follow-up-field):hover{background:var(--chat-input-hover-background,var(--chat-input-background,transparent));box-shadow:var(--chat-input-hover-box-shadow,var(--chat-input-box-shadow,none))}.search-summary :where(.search-summary__follow-up--themed .search-summary__follow-up-field):has(.search-summary__follow-up-input:focus-visible){border-width:var(--chat-input-focus-border-width,var(--chat-input-border-width,var(--spacer-1,1px)));border-radius:var(--chat-input-focus-border-radius,var(--chat-input-border-radius,1.75rem));border-color:var(--chat-input-focus-border-color,var(--chat-input-border-color,currentColor));background:var(--chat-input-focus-background,var(--chat-input-background,transparent));box-shadow:var(--chat-input-focus-box-shadow,var(--chat-input-box-shadow,none))}.search-summary :where(.search-summary__follow-up--themed .search-summary__follow-up-input){color:var(--chat-input-color,inherit);background:0 0;border:0;padding:0}.search-summary :where(.search-summary__follow-up--themed .search-summary__follow-up-input):focus,.search-summary :where(.search-summary__follow-up--themed .search-summary__follow-up-input):focus-visible{outline:none}.search-summary :where(.search-summary__follow-up--themed .search-summary__follow-up-submit){width:var(--btn-submit-size,2.25rem);height:var(--btn-submit-size,2.25rem);padding:0;border-width:var(--chat-input-submit-border-width,0);border-radius:var(--chat-input-submit-border-radius,50%);border-style:solid;border-color:var(--chat-input-submit-border-color,transparent);background:var(--chat-input-submit-background,var(--search-summary-link-color,LinkText));box-shadow:var(--chat-input-submit-box-shadow,none);color:var(--chat-input-submit-color,Canvas);padding-inline:0;transition:background .2s,border-color .2s,border-width .2s,border-radius .2s,box-shadow .2s,color .2s,transform .2s}.search-summary :where(.search-summary__follow-up--themed .search-summary__follow-up-submit):hover{border-width:var(--chat-input-submit-hover-border-width,var(--chat-input-submit-border-width,0));border-radius:var(--chat-input-submit-hover-border-radius,var(--chat-input-submit-border-radius,50%));border-color:var(--chat-input-submit-hover-border-color,var(--chat-input-submit-border-color,transparent));background:var(--chat-input-submit-hover-background,var(--chat-input-submit-background,var(--search-summary-link-color,LinkText)));box-shadow:var(--chat-input-submit-hover-box-shadow,var(--chat-input-submit-box-shadow,none));color:var(--chat-input-submit-hover-color,var(--chat-input-submit-color,Canvas))}.search-summary :where(.search-summary__follow-up--themed .search-summary__follow-up-submit-icon--fallback path){stroke:currentColor;stroke-width:var(--chat-input-submit-stroke-width,2px)}.search-summary :where(.search-summary__disclaimer){margin-bottom:var(--spacer-16,1rem);line-height:var(--base-line-height-default,1.5)}.search-summary :where(.search-summary__disclaimer a){color:var(--search-summary-disclaimer-link-color,var(--search-summary-link-color,LinkText));text-decoration:underline}.search-summary :where(.search-summary__disclaimer p){margin-top:0}.search-summary :where(.search-summary__opt-in-panel){flex-direction:column;flex:1;min-height:0;display:flex}.search-summary :where(.search-summary__opt-in-body){min-height:0;margin-top:var(--spacer-4,.25rem);margin-bottom:var(--spacer-16,1rem);flex:1;position:relative;overflow-y:auto}.search-summary :where(.search-summary__error){color:var(--search-summary-error-color,inherit)}.search-summary :where(.search-summary__footer){margin-right:calc(-1 * var(--search-summary-padding,0));margin-left:calc(-1 * var(--search-summary-padding,0));padding:0 var(--search-summary-padding,0) calc(var(--search-summary-padding,0));justify-content:space-between;align-items:center;gap:var(--spacer-12,.75rem);background:var(--search-summary-footer-background,var(--search-summary-background,white));flex-wrap:wrap;flex-shrink:0;display:flex;position:relative}.search-summary :where(.search-summary__footer):after{height:var(--spacer-48,3rem);background:linear-gradient(to bottom, transparent, var(--search-summary-footer-background,var(--search-summary-background,white)));content:"";pointer-events:none;position:absolute;top:0;left:0;right:0;transform:translateY(-100%)}.search-summary :where(.search-summary__footer--overlay){margin:0;position:absolute;bottom:0;left:0;right:0}.search-summary :where(.search-summary__footer-actions){align-items:center;gap:var(--spacer-8,.5rem);flex-wrap:wrap;display:flex}.search-summary :where(.search-summary__expand,.search-summary__expand-slot-mount,.search-summary__opt-in,.search-summary__opt-in-slot-mount,.search-summary__opt-out,.search-summary__opt-out-slot-mount){animation:.3s cubic-bezier(.25,.46,.45,.94) both search-summary-action-appear}.search-summary :where(.search-summary__opt-in,.search-summary__opt-in-slot-mount){animation-delay:.3s}.search-summary :where(.search-summary__btn--leaving){pointer-events:none;animation:.2s cubic-bezier(.55,0,1,.45) both search-summary-action-disappear}.search-summary :where(.search-summary__expand,.search-summary__opt-in,.search-summary__opt-out):not(:where(.search-summary__btn)){font:inherit;padding:0;padding-inline:0}.search-summary :where(.search-summary__expand,.search-summary__opt-in):not(:where(.search-summary__btn)){border-width:var(--search-summary-action-border-width,0);border-style:var(--search-summary-action-border-style,solid);border-radius:var(--search-summary-action-primary-border-radius,0);border-color:var(--search-summary-action-primary-border-color,transparent);background:var(--search-summary-action-primary-background,transparent);color:var(--search-summary-action-primary-color,var(--search-summary-link-color,LinkText));text-decoration:underline}.search-summary :where(.search-summary__opt-out):not(:where(.search-summary__btn)){border-width:var(--search-summary-action-border-width,0);border-style:var(--search-summary-action-border-style,solid);border-radius:var(--search-summary-action-secondary-border-radius,0);border-color:var(--search-summary-action-secondary-border-color,transparent);background:var(--search-summary-action-secondary-background,transparent);color:var(--search-summary-action-secondary-color,var(--search-summary-link-color,LinkText));text-decoration:underline}.search-summary :where(.search-summary__btn){padding:var(--btn-padding-y,var(--spacer-8,.5rem)) var(--btn-padding-x,var(--spacer-20,1.25rem));align-items:center;gap:var(--spacer-8,.5rem);border-width:var(--spacer-1,1px);font-size:var(--base-font-size-sm,inherit);cursor:pointer;border-style:solid;font-family:inherit;line-height:1.25;text-decoration:none;display:inline-flex}.search-summary :where(.search-summary__btn--primary){border-radius:var(--btn-primary-border-radius);border-color:var(--btn-primary-border-color,transparent);background:var(--btn-primary-background);color:var(--btn-primary-color);font-weight:var(--btn-primary-font-weight,700)}.search-summary :where(.search-summary__btn--primary):hover{background:var(--btn-primary-hover-background,var(--btn-primary-background));color:var(--btn-primary-hover-color,var(--btn-primary-color))}.search-summary :where(.search-summary__btn--secondary){border-radius:var(--btn-secondary-border-radius);border-color:var(--btn-secondary-border-color,var(--btn-secondary-background));background:var(--btn-secondary-background);color:var(--btn-secondary-color);font-weight:var(--btn-secondary-font-weight,700)}.search-summary :where(.search-summary__btn--secondary):hover{background:var(--btn-secondary-hover-background,var(--btn-secondary-background));color:var(--btn-secondary-hover-color,var(--btn-secondary-color))}@media (prefers-reduced-motion:reduce){.search-summary{transition:none}.search-summary :where(.search-summary__content),.search-summary :where(.search-summary__content--leaving),.search-summary :where(.search-summary__footer--leaving),.search-summary :where(.search-summary__expand,.search-summary__expand-slot-mount,.search-summary__opt-in,.search-summary__opt-in-slot-mount,.search-summary__opt-out,.search-summary__opt-out-slot-mount),.search-summary :where(.search-summary__btn--leaving),.search-summary :where(.search-summary__loading-spinner){animation:none!important}}}`;function rp(e,t){Ue(t,!0);let n=W(t,`css`,7),r=ya(t,[`$$slots`,`$$events`,`$$legacy`,`$$host`,`css`]),i=e=>{En(()=>{n()&&(e.innerHTML=n())})};var a={get css(){return n()},set css(e){n(e),I()}},o=Vr(),s=un(o),c=e=>{var t=Vr();Mi(un(t),()=>`style`,!1,(e,t)=>{Ni(e,e=>i?.(e)),la(e,()=>({...r}))}),U(e,t)};return di(s,e=>{n()&&e(c)}),U(e,o),We(a)}Da(rp,{css:{}},[],[],{mode:`open`});var ip=`liipgpt:search-summary:opt-in:`;function ap(e){let t=5381;for(let n=0;n<e.length;n++)t=t*33^e.charCodeAt(n);return(t>>>0).toString(36)}function op(e){return`${ip}${ap(e??``)}`}function sp(){try{return typeof window<`u`&&window.localStorage!==void 0}catch{return!1}}function cp(e){if(!sp())return!1;try{return window.localStorage.getItem(op(e))===`1`}catch{return!1}}function lp(e){if(sp())try{window.localStorage.setItem(op(e),`1`)}catch{}}function up(e){if(sp())try{window.localStorage.removeItem(op(e))}catch{}}var dp=new WeakMap;function fp(e,t,n){if(!t)return null;let r=dp.get(t);return r&&t.removeEventListener(`click`,r),t.removeAttribute(`slot`),t.type=`button`,t.addEventListener(`click`,n),dp.set(t,n),e.appendChild(t),({label:e,ariaLabel:n,ariaExpanded:r})=>{e!==void 0&&(t.textContent=e),n!==void 0&&t.setAttribute(`aria-label`,n),r===void 0?t.removeAttribute(`aria-expanded`):t.setAttribute(`aria-expanded`,String(r))}}function pp(e,t){if(!t)return;let n=dp.get(t);n&&(t.removeEventListener(`click`,n),dp.delete(t)),e.contains(t)&&e.removeChild(t)}function mp(e){let t=String(e).trim();return/^\d+(\.\d+)?$/.test(t)?`${t}px`:t}function hp(e){let t=e.match(/^(\d+(?:\.\d+)?)px$/);return t?Number.parseFloat(t[1]):null}function gp(e,t){let n=e.style.height;e.style.height=t;let r=e.offsetHeight;return e.style.height=n,r}var _p=hp(mp(`280`));function vp(e,t=`.search-summary`){return e.replaceAll(`.chat-app`,t)}var yp=`(prefers-reduced-motion: reduce)`;function bp(e){if(typeof window>`u`)return e(!1),()=>{};let t=window.matchMedia(yp);e(t.matches);let n=()=>e(t.matches);return t.addEventListener(`change`,n),()=>t.removeEventListener(`change`,n)}var xp=Rr(`<!> <!> <!>`,1),Sp=Rr(`<div class="search-summary__disclaimer-text"></div>`),Cp=Rr(`<div class="search-summary__opt-in-slot-mount"></div>`),wp=Rr(`<button type="button"> </button>`),Tp=Rr(`<div class="search-summary__opt-in-panel"><div class="search-summary__opt-in-body"><div class="search-summary__disclaimer"><!></div></div> <div class="search-summary__footer"><!></div></div>`),Ep=Rr(`<div class="search-summary__loading" aria-live="polite"><span class="search-summary__loading-spinner" aria-hidden="true"></span> <span class="search-summary__loading-text"> </span></div>`),Dp=Rr(`<div class="search-summary__error" role="alert"> </div>`),Op=Rr(`<li class="search-summary__reference"><a target="_blank" rel="noopener noreferrer"> </a></li>`),kp=Rr(`<div class="search-summary__references-title"> </div> <ol class="search-summary__references"></ol>`,1),Ap=Rr(`<div class="search-summary__follow-up-submit-icon"></div>`),jp=Br(`<svg class="search-summary__follow-up-submit-icon search-summary__follow-up-submit-icon--fallback" viewBox="0 0 24 24" aria-hidden="true" focusable="false"><g fill="none" stroke="currentColor" stroke-width="1.5" stroke-linecap="round" stroke-linejoin="round"><path d="m12 1v22"></path><path d="m4 9 8-8 8 8"></path></g></svg>`),Mp=Rr(`<form><label class="search-summary__sr-only" for="search-summary-follow-up-input"> </label> <div class="search-summary__follow-up-field"><input id="search-summary-follow-up-input" class="search-summary__follow-up-input" type="text"/> <button type="submit" class="search-summary__follow-up-submit"><span class="search-summary__sr-only"> </span> <!></button></div></form>`),Np=Rr(`<div class="search-summary__expand-slot-mount"></div>`),Pp=Rr(`<button type="button"> </button>`),Fp=Rr(`<div class="search-summary__opt-out-slot-mount"></div>`),Ip=Rr(`<button type="button"> </button>`),Lp=Rr(`<div><div class="search-summary__footer-actions"><!></div> <!></div>`),Rp=Rr(`<div><div class="search-summary__answer-wrap"><!> <div aria-live="polite"></div></div> <!> <!> <!></div> <!>`,1),zp=Rr(`<!> <!> <div><!></div>`,1);function Bp(e,n){Ue(n,!0);function r(e){let t=e.trim();return!(!t||/^[a-zA-Z][a-zA-Z\d+.-]*:/.test(t)||t.startsWith(`//`))}let i=W(n,`lang`,7,`de`),a=W(n,`apiUrl`,7),o=W(n,`apiKey`,7,``),s=W(n,`question`,7),c=W(n,`height`,7,`280`),l=W(n,`maxHeight`,7),u=W(n,`optIn`,7,!1),d=W(n,`optInLabel`,7),f=W(n,`expandLabel`,7),p=W(n,`collapseLabel`,7),m=W(n,`optOutLabel`,7),h=W(n,`useChatConfig`,7,!1),g=W(n,`forceTheme`,7),_=W(n,`disclaimerHtml`,7,``),v=W(n,`labelledBy`,7),y=W(n,`chatUrl`,7),b=W(n,`mode`,7,`search`),ee=W(n,`source`,7,`search-summary`),te=W(n,`cache`,7,!1),ne=W(n,`activateAiButtonSlot`,7,null),x=W(n,`expandAnswerButtonSlot`,7,null),re=W(n,`deactivateAiButtonSlot`,7,null),ie=R(null),S=R(null),ae=R(!1),oe=[`de`,`en`,`fr`,`it`],se=L(()=>H(S)?.language??t(i(),oe)),C=L(()=>({...tp[H(se)],...H(ie)})),w=R(`loading`),ce=R(null),le=R(null),ue=R(null),de=R(null),fe=R(!1),T=R(!1),E=R(!1),pe=R(Zt(_p)),D=L(()=>mp(c())),me=L(()=>hp(H(D))),he=L(()=>H(me)===null),ge=L(()=>H(me)??_p),_e=L(()=>l()===void 0?``:mp(l()));function ve(){if(!H(_e))return null;let e=hp(H(_e));return e===null?H(ce)?gp(H(ce),H(_e)):null:e}let ye=R(!1);En(()=>bp(e=>z(ye,e,!0)));function be(e){return H(ye)?0:e}let xe=new Ma(Sr(()=>H(ge)),{duration:400,easing:ka}),Se=R(!1);En(()=>{if(!H(Se)){if(H(T)){xe.set(H(pe),{duration:be(400)});return}!H(he)&&H(me)!==null&&xe.set(H(me),{duration:be(400)})}});function Ce(){return H(ce)?H(me)===null?gp(H(ce),H(D)):H(me):H(ge)}async function we(e){z(Se,!0),await xe.set(e,{duration:be(400)}),z(Se,!1)}function Te(){if(!H(ce))return Ce();if(H(ce).offsetHeight>0)return H(ce).offsetHeight;let e=H(ce).style.height;if(!e)return Ce();let t=hp(e);return t===null?gp(H(ce),e):t}let Ee=R(``),De=R(Zt([])),Oe=R(``),ke=R(null),Ae=R(!1),je=R(``),O=L(()=>y()&&r(y())?y():void 0),Me=L(()=>!!H(O)&&!!H(ke)),k=L(()=>H(Me)&&H(Ae)),A=L(()=>!H(T)&&H(fe)),Ne=L(()=>H(w)!==`opt-in`&&H(w)!==`loading`&&H(w)!==`error`&&(H(fe)||H(T))&&!(H(T)&&H(Me))),Pe=L(()=>u()&&H(w)!==`opt-in`),Fe=L(()=>H(T)?p()||H(C).searchSummaryCollapse:f()||H(C).searchSummaryExpand),Ie=L(()=>H(T)?H(C).ariaSearchSummaryCollapse:H(C).ariaSearchSummaryExpand),Le=R(``),Re=R(``),ze=null,Be=L(()=>H(T)?H(Re)||p()||H(C).searchSummaryCollapse:f()||H(Le)||H(C).searchSummaryExpand),Ve=L(()=>H(T)?H(Re)||p()||H(C).ariaSearchSummaryCollapse:f()||H(Le)||H(C).ariaSearchSummaryExpand),M=L(()=>H(S)?Ko(H(S).chatConfig.fullTheme[H(S).colorScheme].tokens,{root:`.search-summary`}):``),He=L(()=>H(S)?.chatConfig.fullTheme[H(S).colorScheme]?.customCSS?vp(H(S).chatConfig.fullTheme[H(S).colorScheme].customCSS):``),Ge=L(()=>H(S)?.chatConfig.fullTheme[H(S).colorScheme]?.fontCSS??``),Ke=L(()=>H(S)?.chatConfig.fullTheme[H(S).colorScheme]?.tokens?.svgs?.submit??``),N=L(()=>H(S)!==null),qe=L(()=>H(N)?` search-summary__btn`:``),Je=L(()=>H(N)?` search-summary__follow-up--themed`:``);function Ye(){if(!H(ce))return H(ge);let e=H(ce).style.height;H(ce).style.height=`auto`;let t=H(le)?.style.flex??``;H(le)&&(H(le).style.flex=`none`);let n=H(ce).scrollHeight;return H(le)&&(H(le).style.flex=t),H(ce).style.height=e,n}function Xe(){z(fe,(H(le)?.scrollHeight??0)>(H(le)?.offsetHeight??0)+1)}function Ze(){let e=Ye(),t=ve();z(pe,t===null?e:Math.min(e,t),!0),z(E,t!==null&&e>t,!0)}async function P(){if(H(ce))if(!H(T))Ze(),xe.set(Te(),{duration:0}),z(T,!0),z(w,`expanded`),await yr(),Xe(),Ze(),await we(H(pe));else{xe.set(Te(),{duration:0});let e=Ce();z(T,!1),z(w,H(Ee)?`done`:`loading`,!0),await yr(),Xe(),await we(e)}}let Qe=R(!1);On(()=>{H(Qe)||a()&&(z(w,u()&&!cp(a())?`opt-in`:`loading`,!0),z(Qe,!0))}),En(()=>{if(!a()||!h()){z(S,null),z(ie,null),z(ae,!0);return}let e=!1;return z(ae,!1),import(`./load-chat-config-D1K0jXrB.js`).then(({loadChatConfig:e})=>e({apiUrl:a(),lang:i(),forceTheme:g()})).then(t=>{e||(z(S,t,!0),z(ie,t.chatConfig.translations[t.language]??null,!0))}).catch(()=>{e||(z(S,null),z(ie,null))}).finally(()=>{e||z(ae,!0)}),()=>{e=!0}});let $e=L(()=>H(Qe)&&H(ae)),et=R(!1);En(()=>{if(!H($e)||H(et))return;let e=requestAnimationFrame(()=>z(et,!0));return()=>cancelAnimationFrame(e)}),En(()=>{if(!H(ce))return;H(Ee),H(De).length,H(D),Ze(),Xe();let e=new ResizeObserver(()=>{Ze(),Xe()});return e.observe(H(ce)),H(le)&&e.observe(H(le)),()=>e.disconnect()});function tt(e){return e.classList.add(`search-summary__btn--leaving`),{duration:be(200)}}function nt(e,t){if(H(ye)){t();return}let n=e.currentTarget;n.classList.add(`search-summary__btn--leaving`),n.addEventListener(`animationend`,t,{once:!0})}function rt(e=null){if(H(ye)){F();return}e?.classList.add(`search-summary__btn--leaving`),H(le)?.classList.add(`search-summary__content--leaving`),H(ue)?.classList.add(`search-summary__footer--leaving`),H(ue)?.querySelector(`.search-summary__expand, .search-summary__expand-slot-mount`)?.classList.add(`search-summary__btn--leaving`);let t=H(le)??e;t?t.addEventListener(`animationend`,F,{once:!0}):F()}function it(e){rt(e.currentTarget)}function at(){lp(a()),z(w,`loading`)}function ot(){lt?.(),ut&&ut.abort().catch(()=>{}),lt=void 0,ut=void 0,z(ke,null),z(Ae,!1),z(je,``),st=!1,z(Ee,``),z(De,[],!0),z(Oe,``),z(T,!1),z(fe,!1)}function F(){up(a()),ot(),z(w,`opt-in`)}let st=!1,ct,lt,ut;function dt(){if(st)return;st=!0,ct=s();let e=new ep({apiUrl:a(),apiKey:o()});try{let t=e.createConversation();z(ke,t.id,!0),ut=t.chat(s(),{lang:H(se),mode:b()||void 0,source:ee()||void 0,cache:te()||void 0})}catch(e){z(Oe,e instanceof Error&&e.message?e.message:H(C).searchSummaryError,!0),z(w,`error`);return}lt=ut.subscribe(e=>{if(e.errors.length>0){z(Oe,e.errors.join(`, `)||H(C).searchSummaryError,!0),z(w,`error`);return}if(e.state===`loading`){z(w,`loading`);return}z(Ee,e.message.html,!0),z(De,e.references.used.slice().sort((e,t)=>(e.referenceIndex.used??0)-(t.referenceIndex.used??0)),!0),e.state===`streaming`?H(T)||z(w,`answering`):e.state===`done`&&(z(Ae,!0),H(T)||z(w,`done`),queueMicrotask(Xe))})}En(()=>{!s()||!a()||H(w)!==`loading`||dt()});function ft(){if(ot(),u()&&!cp(a())){z(w,`opt-in`);return}z(w,`loading`),dt()}En(()=>{let e=s();!e||!st||e===ct||Sr(()=>ft())}),li(()=>{lt?.(),ut&&ut.abort().catch(()=>{})}),En(()=>{H(de)&&(H(de).innerHTML=H(Ee),H(de).querySelectorAll(`liipgpt-reference-number`).forEach(e=>e.remove()),queueMicrotask(Xe))});function pt(e){e.preventDefault();let t=H(je).trim();if(!t||!H(O)||!H(ke))return;let n=new URL(H(O),window.location.href);if(n.pathname===window.location.pathname){let e=new URLSearchParams(window.location.search);for(let[t,r]of n.searchParams)e.set(t,r);n.search=e.toString()}n.searchParams.set(`follow-up-q`,t),n.hash=`cID=${H(ke)}`,window.location.assign(n.toString())}let mt=R(null),ht=R(null),gt=R(null);En(()=>{let e=H(mt),t=ne();if(!(!e||!t))return fp(e,t,at)?.({label:d()||void 0}),()=>pp(e,t)}),En(()=>{let e=H(ht),t=x();if(!(!e||!t||!H(Ne)))return ze!==t&&(ze=t,z(Le,t.textContent?.trim()??``,!0),z(Re,t.dataset.collapseLabel?.trim()??``,!0)),fp(e,t,P)?.({label:H(Be),ariaLabel:H(Ve),ariaExpanded:H(T)}),()=>pp(e,t)}),En(()=>{!x()||!H(Ne)||(x().textContent=H(Be),x().setAttribute(`aria-label`,H(Ve)),x().setAttribute(`aria-expanded`,String(H(T))))}),En(()=>{let e=H(gt),t=re();if(!(!e||!t||!H(Pe)))return fp(e,t,()=>rt(e))?.({label:m()||void 0,ariaLabel:H(C).ariaSearchSummaryOptOut}),()=>pp(e,t)});var _t={reload:ft,get lang(){return i()},set lang(e=`de`){i(e),I()},get apiUrl(){return a()},set apiUrl(e){a(e),I()},get apiKey(){return o()},set apiKey(e=``){o(e),I()},get question(){return s()},set question(e){s(e),I()},get height(){return c()},set height(e=`280`){c(e),I()},get maxHeight(){return l()},set maxHeight(e){l(e),I()},get optIn(){return u()},set optIn(e=!1){u(e),I()},get optInLabel(){return d()},set optInLabel(e){d(e),I()},get expandLabel(){return f()},set expandLabel(e){f(e),I()},get collapseLabel(){return p()},set collapseLabel(e){p(e),I()},get optOutLabel(){return m()},set optOutLabel(e){m(e),I()},get useChatConfig(){return h()},set useChatConfig(e=!1){h(e),I()},get forceTheme(){return g()},set forceTheme(e){g(e),I()},get disclaimerHtml(){return _()},set disclaimerHtml(e=``){_(e),I()},get labelledBy(){return v()},set labelledBy(e){v(e),I()},get chatUrl(){return y()},set chatUrl(e){y(e),I()},get mode(){return b()},set mode(e=`search`){b(e),I()},get source(){return ee()},set source(e=`search-summary`){ee(e),I()},get cache(){return te()},set cache(e=!1){te(e),I()},get activateAiButtonSlot(){return ne()},set activateAiButtonSlot(e=null){ne(e),I()},get expandAnswerButtonSlot(){return x()},set expandAnswerButtonSlot(e=null){x(e),I()},get deactivateAiButtonSlot(){return re()},set deactivateAiButtonSlot(e=null){re(e),I()}},vt=zp(),yt=un(vt);rp(yt,{id:`search-summary-css`,get css(){return np}});var bt=dn(yt,2),xt=e=>{var t=xp(),n=un(t);rp(n,{id:`search-summary-font-css`,get css(){return H(Ge)}});var r=dn(n,2);rp(r,{id:`search-summary-theme-css`,get css(){return H(M)}});var i=dn(r,2),a=e=>{rp(e,{id:`search-summary-custom-css`,get css(){return H(He)}})};di(i,e=>{H(He)&&e(a)}),U(e,t)};di(bt,e=>{H(N)&&H(M)&&e(xt)});var St=dn(bt,2);let Ct,wt;var Tt=ln(St),Et=e=>{var t=Tp(),n=ln(t),r=ln(n),i=ln(r),a=e=>{var t=Vr(),n=un(t),r=e=>{var t=Sp();xi(t,()=>H(C).searchSummaryDisclaimer,!0),j(t),U(e,t)};di(n,e=>{H(C).searchSummaryDisclaimer&&e(r)}),U(e,t)},o=e=>{var t=Vr();xi(un(t),_),U(e,t)};di(i,e=>{h()?e(a):e(o,-1)}),j(r),j(n);var s=dn(n,2),c=ln(s),l=e=>{var t=Cp();_a(t,e=>z(mt,e),()=>H(mt)),U(e,t)},u=e=>{var t=wp(),n=ln(t,!0);j(t),Pn(()=>{Ui(t,1,`search-summary__opt-in${H(qe)??``}${H(N)?` search-summary__btn--secondary`:``}`),ei(n,d()||H(C).searchSummaryOptInDefault)}),Ar(`click`,t,e=>nt(e,at)),U(e,t)};di(c,e=>{ne()?e(l):e(u,-1)}),j(s),j(t),U(e,t)},Dt=e=>{var t=Rp(),n=un(t);let r;var i=ln(n),a=ln(i),o=e=>{var t=Ep(),n=dn(ln(t),2),r=ln(n,!0);j(n),j(t),Pn(()=>ei(r,H(C).searchSummaryLoading)),U(e,t)};di(a,e=>{H(w)===`loading`&&e(o)});var s=dn(a,2);let c;_a(s,e=>z(de,e),()=>H(de)),j(i);var l=dn(i,2),u=e=>{var t=Dp(),n=ln(t,!0);j(t),Pn(()=>ei(n,H(Oe)||H(C).searchSummaryError)),U(e,t)};di(l,e=>{H(w)===`error`&&e(u)});var d=dn(l,2),f=e=>{var t=kp(),n=un(t),r=ln(n,!0);j(n);var i=dn(n,2);hi(i,21,()=>H(De),e=>e.referenceIndex.used??e.url,(e,t)=>{var n=Op(),r=ln(n),i=ln(r,!0);j(r),j(n),Pn(()=>{aa(n,H(t).referenceIndex.used??void 0),sa(r,`href`,H(t).url),sa(r,`tabindex`,H(A)?-1:void 0),ei(i,H(t).display.listItem.title||H(t).display.card.title||H(t).url)}),U(e,n)}),j(i),Pn(()=>ei(r,H(C).referencesTitle)),U(e,t)};di(d,e=>{H(De).length>0&&e(f)});var p=dn(d,2),h=e=>{var t=Mp(),n=ln(t),r=ln(n,!0);j(n);var i=dn(n,2),a=ln(i);ia(a);var o=dn(a,2),s=ln(o),c=ln(s,!0);j(s);var l=dn(s,2),u=e=>{var t=Ap();xi(t,()=>H(Ke),!0),j(t),U(e,t)},d=e=>{U(e,jp())};di(l,e=>{H(Ke)?e(u):e(d,-1)}),j(o),j(i),j(t),Pn(()=>{Ui(t,1,`search-summary__follow-up${H(Je)??``}`),t.inert=H(A),ei(r,H(C).ariaSearchSummaryFollowUpInput),sa(a,`placeholder`,H(C).searchSummaryFollowUpPlaceholder),sa(a,`aria-label`,H(C).ariaSearchSummaryFollowUpInput),sa(o,`aria-label`,H(C).searchSummaryFollowUpSubmit),ei(c,H(C).searchSummaryFollowUpSubmit)}),kr(`submit`,t,pt),pa(a,()=>H(je),e=>z(je,e)),U(e,t)};di(p,e=>{H(k)&&e(h)}),j(n),_a(n,e=>z(le,e),()=>H(le));var g=dn(n,2),_=e=>{var t=Lp();let n;var r=ln(t),i=ln(r),a=e=>{var t=Vr(),n=un(t),r=e=>{var t=Np();_a(t,e=>z(ht,e),()=>H(ht)),Ai(2,t,()=>tt),U(e,t)},i=e=>{var t=Pp(),n=ln(t,!0);j(t),Pn(()=>{Ui(t,1,`search-summary__expand${H(qe)??``}${H(N)?` search-summary__btn--primary`:``}`),sa(t,`aria-expanded`,H(T)),sa(t,`aria-label`,H(Ie)),ei(n,H(Fe))}),Ar(`click`,t,P),Ai(2,t,()=>tt),U(e,t)};di(n,e=>{x()?e(r):e(i,-1)}),U(e,t)};di(i,e=>{H(Ne)&&e(a)}),j(r);var o=dn(r,2),s=e=>{var t=Vr(),n=un(t),r=e=>{var t=Fp();_a(t,e=>z(gt,e),()=>H(gt)),U(e,t)},i=e=>{var t=Ip(),n=ln(t,!0);j(t),Pn(()=>{Ui(t,1,`search-summary__opt-out${H(qe)??``}${H(N)?` search-summary__btn--secondary`:``}`),sa(t,`aria-label`,H(C).ariaSearchSummaryOptOut),ei(n,m()||H(C).searchSummaryOptOut)}),Ar(`click`,t,it),U(e,t)};di(n,e=>{re()?e(r):e(i,-1)}),U(e,t)};di(o,e=>{H(Pe)&&e(s)}),j(t),_a(t,e=>z(ue,e),()=>H(ue)),Pn(()=>n=Ui(t,1,`search-summary__footer`,null,n,{"search-summary__footer--overlay":H(k)})),U(e,t)};di(g,e=>{(!H(k)||H(Ne)||H(Pe))&&e(_)}),Pn(()=>{r=Ui(n,1,`search-summary__content`,null,r,{"search-summary__content--with-follow-up":H(k)}),c=Ui(s,1,`search-summary__answer`,null,c,{"search-summary__answer--themed":H(N)})}),U(e,t)};return di(Tt,e=>{H(w)===`opt-in`?e(Et):e(Dt,-1)}),j(St),_a(St,e=>z(ce,e),()=>H(ce)),Pn(()=>{Ct=Ui(St,1,`search-summary`,null,Ct,{"search-summary--ready":H(et)}),sa(St,`data-state`,H(w)),sa(St,`data-expanded`,H(T)?`true`:`false`),sa(St,`data-capped`,H(T)&&H(E)?`true`:void 0),sa(St,`role`,v()?`region`:void 0),sa(St,`aria-labelledby`,v()),wt=Gi(St,``,wt,{height:H(T)||H(Se)||!H(he)?`${xe.current}px`:H(D),"max-height":H(_e)||null})}),U(e,vt),We(_t)}jr([`click`]),Da(Bp,{lang:{},apiUrl:{},apiKey:{},question:{},height:{},maxHeight:{},optIn:{},optInLabel:{},expandLabel:{},collapseLabel:{},optOutLabel:{},useChatConfig:{},forceTheme:{},disclaimerHtml:{},labelledBy:{},chatUrl:{},mode:{},source:{},cache:{},activateAiButtonSlot:{},expandAnswerButtonSlot:{},deactivateAiButtonSlot:{}},[],[`reload`],{mode:`open`});function Vp(e,t){Ue(t,!0);let n=W(t,`lang`,7),r=W(t,`apiUrl`,7),i=W(t,`apiKey`,7),a=W(t,`question`,7),o=W(t,`height`,7),s=W(t,`maxHeight`,7),c=W(t,`optIn`,7),l=W(t,`optInLabel`,7),u=W(t,`expandLabel`,7),d=W(t,`collapseLabel`,7),f=W(t,`optOutLabel`,7),p=W(t,`useChatConfig`,7),m=W(t,`forceTheme`,7),h=W(t,`wrapperClass`,7),g=W(t,`labelledBy`,7),_=W(t,`chatUrl`,7),v=W(t,`mode`,7),y=W(t,`source`,7),b=W(t,`cache`,7),ee=L(()=>({lang:n(),apiUrl:r(),apiKey:i(),question:a(),height:o(),maxHeight:s(),optIn:c(),optInLabel:l(),expandLabel:u(),collapseLabel:d(),optOutLabel:f(),useChatConfig:p(),forceTheme:m(),labelledBy:g(),chatUrl:_(),mode:v(),source:y(),cache:b()})),te=R(void 0),ne=t.$$host;En(()=>{ne&&h()&&(ne.className=h())}),En(()=>{if(!ne||!H(te))return;let e=ne;return e.reload=()=>H(te)?.reload(),()=>{delete e.reload}});let x=L(()=>ne?.querySelector(`[slot="disclaimer"]`)?.innerHTML??``),re=R(null),ie=R(null),S=R(null);return On(()=>{if(p()){z(re,null),z(ie,null),z(S,null);return}z(re,ne?.querySelector(`[slot="activate-ai-button"]`)??null,!0),z(ie,ne?.querySelector(`[slot="expand-answer-button"]`)??null,!0),z(S,ne?.querySelector(`[slot="deactivate-ai-button"]`)??null,!0)}),_a(Bp(e,xa(()=>H(ee),{get disclaimerHtml(){return H(x)},get activateAiButtonSlot(){return H(re)},get expandAnswerButtonSlot(){return H(ie)},get deactivateAiButtonSlot(){return H(S)}})),e=>z(te,e,!0),()=>H(te)),We({get lang(){return n()},set lang(e){n(e),I()},get apiUrl(){return r()},set apiUrl(e){r(e),I()},get apiKey(){return i()},set apiKey(e){i(e),I()},get question(){return a()},set question(e){a(e),I()},get height(){return o()},set height(e){o(e),I()},get maxHeight(){return s()},set maxHeight(e){s(e),I()},get optIn(){return c()},set optIn(e){c(e),I()},get optInLabel(){return l()},set optInLabel(e){l(e),I()},get expandLabel(){return u()},set expandLabel(e){u(e),I()},get collapseLabel(){return d()},set collapseLabel(e){d(e),I()},get optOutLabel(){return f()},set optOutLabel(e){f(e),I()},get useChatConfig(){return p()},set useChatConfig(e){p(e),I()},get forceTheme(){return m()},set forceTheme(e){m(e),I()},get wrapperClass(){return h()},set wrapperClass(e){h(e),I()},get labelledBy(){return g()},set labelledBy(e){g(e),I()},get chatUrl(){return _()},set chatUrl(e){_(e),I()},get mode(){return v()},set mode(e){v(e),I()},get source(){return y()},set source(e){y(e),I()},get cache(){return b()},set cache(e){b(e),I()}})}customElements.define(`liipgpt-search-summary`,Da(Vp,{lang:{attribute:`lang`,type:`String`},apiUrl:{attribute:`api-url`,type:`String`},apiKey:{attribute:`api-key`,type:`String`},question:{attribute:`question`,type:`String`},height:{attribute:`height`,type:`String`},maxHeight:{attribute:`max-height`,type:`String`},optIn:{attribute:`opt-in`,type:`Boolean`},optInLabel:{attribute:`opt-in-label`,type:`String`},expandLabel:{attribute:`expand-label`,type:`String`},collapseLabel:{attribute:`collapse-label`,type:`String`},optOutLabel:{attribute:`opt-out-label`,type:`String`},useChatConfig:{attribute:`use-chat-config`,type:`Boolean`},forceTheme:{attribute:`force-theme`,type:`String`},wrapperClass:{attribute:`wrapper-class`,type:`String`},labelledBy:{attribute:`labelled-by`,type:`String`},chatUrl:{attribute:`chat-url`,type:`String`},mode:{attribute:`mode`,type:`String`},source:{attribute:`source`,type:`String`},cache:{attribute:`cache`,type:`Boolean`}},[],[]));export{Vp as LiipGPTSearchSummary,Al as PiiChecks};
@@ -1,61 +0,0 @@
1
- import{Dt as e,Et as t,Nt as n,Tt as r,it as i,jt as a,ot as o,ut as s,wt as c}from"./rEsbAd0y.js";import{S as l,a as u,b as d,h as f,l as p,m,o as ee,p as te,y as ne}from"./BaFk5JeE.js";import{c as re,f as ie,l as h,o as ae,s as oe,u as se}from"./CehiXGW0.js";var{entries:ce,setPrototypeOf:le,isFrozen:ue,getPrototypeOf:de,getOwnPropertyDescriptor:g}=Object,{freeze:_,seal:v,create:fe}=Object,{apply:pe,construct:me}=typeof Reflect<`u`&&Reflect;_||=function(e){return e},v||=function(e){return e},pe||=function(e,t){var n=[...arguments].slice(2);return e.apply(t,n)},me||=function(e){return new e(...[...arguments].slice(1))};var he=x(Array.prototype.forEach),ge=x(Array.prototype.lastIndexOf),_e=x(Array.prototype.pop),ve=x(Array.prototype.push),ye=x(Array.prototype.splice),be=x(String.prototype.toLowerCase),xe=x(String.prototype.toString),Se=x(String.prototype.match),Ce=x(String.prototype.replace),we=x(String.prototype.indexOf),Te=x(String.prototype.trim),y=x(Object.prototype.hasOwnProperty),b=x(RegExp.prototype.test),Ee=De(TypeError);function x(e){return function(t){t instanceof RegExp&&(t.lastIndex=0);var n=[...arguments].slice(1);return pe(e,t,n)}}function De(e){return function(){return me(e,[...arguments])}}function S(e,t){let n=arguments.length>2&&arguments[2]!==void 0?arguments[2]:be;le&&le(e,null);let r=t.length;for(;r--;){let i=t[r];if(typeof i==`string`){let e=n(i);e!==i&&(ue(t)||(t[r]=e),i=e)}e[i]=!0}return e}function Oe(e){for(let t=0;t<e.length;t++)y(e,t)||(e[t]=null);return e}function C(e){let t=fe(null);for(let[n,r]of ce(e))y(e,n)&&(Array.isArray(r)?t[n]=Oe(r):r&&typeof r==`object`&&r.constructor===Object?t[n]=C(r):t[n]=r);return t}function ke(e,t){for(;e!==null;){let n=g(e,t);if(n){if(n.get)return x(n.get);if(typeof n.value==`function`)return x(n.value)}e=de(e)}function n(){return null}return n}var Ae=_(`a.abbr.acronym.address.area.article.aside.audio.b.bdi.bdo.big.blink.blockquote.body.br.button.canvas.caption.center.cite.code.col.colgroup.content.data.datalist.dd.decorator.del.details.dfn.dialog.dir.div.dl.dt.element.em.fieldset.figcaption.figure.font.footer.form.h1.h2.h3.h4.h5.h6.head.header.hgroup.hr.html.i.img.input.ins.kbd.label.legend.li.main.map.mark.marquee.menu.menuitem.meter.nav.nobr.ol.optgroup.option.output.p.picture.pre.progress.q.rp.rt.ruby.s.samp.search.section.select.shadow.slot.small.source.spacer.span.strike.strong.style.sub.summary.sup.table.tbody.td.template.textarea.tfoot.th.thead.time.tr.track.tt.u.ul.var.video.wbr`.split(`.`)),je=_(`svg.a.altglyph.altglyphdef.altglyphitem.animatecolor.animatemotion.animatetransform.circle.clippath.defs.desc.ellipse.enterkeyhint.exportparts.filter.font.g.glyph.glyphref.hkern.image.inputmode.line.lineargradient.marker.mask.metadata.mpath.part.path.pattern.polygon.polyline.radialgradient.rect.stop.style.switch.symbol.text.textpath.title.tref.tspan.view.vkern`.split(`.`)),Me=_([`feBlend`,`feColorMatrix`,`feComponentTransfer`,`feComposite`,`feConvolveMatrix`,`feDiffuseLighting`,`feDisplacementMap`,`feDistantLight`,`feDropShadow`,`feFlood`,`feFuncA`,`feFuncB`,`feFuncG`,`feFuncR`,`feGaussianBlur`,`feImage`,`feMerge`,`feMergeNode`,`feMorphology`,`feOffset`,`fePointLight`,`feSpecularLighting`,`feSpotLight`,`feTile`,`feTurbulence`]),Ne=_([`animate`,`color-profile`,`cursor`,`discard`,`font-face`,`font-face-format`,`font-face-name`,`font-face-src`,`font-face-uri`,`foreignobject`,`hatch`,`hatchpath`,`mesh`,`meshgradient`,`meshpatch`,`meshrow`,`missing-glyph`,`script`,`set`,`solidcolor`,`unknown`,`use`]),Pe=_(`math.menclose.merror.mfenced.mfrac.mglyph.mi.mlabeledtr.mmultiscripts.mn.mo.mover.mpadded.mphantom.mroot.mrow.ms.mspace.msqrt.mstyle.msub.msup.msubsup.mtable.mtd.mtext.mtr.munder.munderover.mprescripts`.split(`.`)),Fe=_([`maction`,`maligngroup`,`malignmark`,`mlongdiv`,`mscarries`,`mscarry`,`msgroup`,`mstack`,`msline`,`msrow`,`semantics`,`annotation`,`annotation-xml`,`mprescripts`,`none`]),Ie=_([`#text`]),Le=_(`accept.action.align.alt.autocapitalize.autocomplete.autopictureinpicture.autoplay.background.bgcolor.border.capture.cellpadding.cellspacing.checked.cite.class.clear.color.cols.colspan.controls.controlslist.coords.crossorigin.datetime.decoding.default.dir.disabled.disablepictureinpicture.disableremoteplayback.download.draggable.enctype.enterkeyhint.exportparts.face.for.headers.height.hidden.high.href.hreflang.id.inert.inputmode.integrity.ismap.kind.label.lang.list.loading.loop.low.max.maxlength.media.method.min.minlength.multiple.muted.name.nonce.noshade.novalidate.nowrap.open.optimum.part.pattern.placeholder.playsinline.popover.popovertarget.popovertargetaction.poster.preload.pubdate.radiogroup.readonly.rel.required.rev.reversed.role.rows.rowspan.spellcheck.scope.selected.shape.size.sizes.slot.span.srclang.start.src.srcset.step.style.summary.tabindex.title.translate.type.usemap.valign.value.width.wrap.xmlns.slot`.split(`.`)),Re=_(`accent-height.accumulate.additive.alignment-baseline.amplitude.ascent.attributename.attributetype.azimuth.basefrequency.baseline-shift.begin.bias.by.class.clip.clippathunits.clip-path.clip-rule.color.color-interpolation.color-interpolation-filters.color-profile.color-rendering.cx.cy.d.dx.dy.diffuseconstant.direction.display.divisor.dur.edgemode.elevation.end.exponent.fill.fill-opacity.fill-rule.filter.filterunits.flood-color.flood-opacity.font-family.font-size.font-size-adjust.font-stretch.font-style.font-variant.font-weight.fx.fy.g1.g2.glyph-name.glyphref.gradientunits.gradienttransform.height.href.id.image-rendering.in.in2.intercept.k.k1.k2.k3.k4.kerning.keypoints.keysplines.keytimes.lang.lengthadjust.letter-spacing.kernelmatrix.kernelunitlength.lighting-color.local.marker-end.marker-mid.marker-start.markerheight.markerunits.markerwidth.maskcontentunits.maskunits.max.mask.mask-type.media.method.mode.min.name.numoctaves.offset.operator.opacity.order.orient.orientation.origin.overflow.paint-order.path.pathlength.patterncontentunits.patterntransform.patternunits.points.preservealpha.preserveaspectratio.primitiveunits.r.rx.ry.radius.refx.refy.repeatcount.repeatdur.restart.result.rotate.scale.seed.shape-rendering.slope.specularconstant.specularexponent.spreadmethod.startoffset.stddeviation.stitchtiles.stop-color.stop-opacity.stroke-dasharray.stroke-dashoffset.stroke-linecap.stroke-linejoin.stroke-miterlimit.stroke-opacity.stroke.stroke-width.style.surfacescale.systemlanguage.tabindex.tablevalues.targetx.targety.transform.transform-origin.text-anchor.text-decoration.text-rendering.textlength.type.u1.u2.unicode.values.viewbox.visibility.version.vert-adv-y.vert-origin-x.vert-origin-y.width.word-spacing.wrap.writing-mode.xchannelselector.ychannelselector.x.x1.x2.xmlns.y.y1.y2.z.zoomandpan`.split(`.`)),ze=_(`accent.accentunder.align.bevelled.close.columnsalign.columnlines.columnspan.denomalign.depth.dir.display.displaystyle.encoding.fence.frame.height.href.id.largeop.length.linethickness.lspace.lquote.mathbackground.mathcolor.mathsize.mathvariant.maxsize.minsize.movablelimits.notation.numalign.open.rowalign.rowlines.rowspacing.rowspan.rspace.rquote.scriptlevel.scriptminsize.scriptsizemultiplier.selection.separator.separators.stretchy.subscriptshift.supscriptshift.symmetric.voffset.width.xmlns`.split(`.`)),Be=_([`xlink:href`,`xml:id`,`xlink:title`,`xml:space`,`xmlns:xlink`]),Ve=v(/\{\{[\w\W]*|[\w\W]*\}\}/gm),He=v(/<%[\w\W]*|[\w\W]*%>/gm),Ue=v(/\$\{[\w\W]*/gm),w=v(/^data-[\-\w.\u00B7-\uFFFF]+$/),We=v(/^aria-[\-\w]+$/),Ge=v(/^(?:(?:(?:f|ht)tps?|mailto|tel|callto|sms|cid|xmpp|matrix):|[^a-z]|[a-z+.\-]+(?:[^a-z+.\-:]|$))/i),T=v(/^(?:\w+script|data):/i),Ke=v(/[\u0000-\u0020\u00A0\u1680\u180E\u2000-\u2029\u205F\u3000]/g),qe=v(/^html$/i),E=v(/^[a-z][.\w]*(-[.\w]+)+$/i),Je=Object.freeze({__proto__:null,ARIA_ATTR:We,ATTR_WHITESPACE:Ke,CUSTOM_ELEMENT:E,DATA_ATTR:w,DOCTYPE_NAME:qe,ERB_EXPR:He,IS_ALLOWED_URI:Ge,IS_SCRIPT_OR_DATA:T,MUSTACHE_EXPR:Ve,TMPLIT_EXPR:Ue}),Ye={element:1,attribute:2,text:3,cdataSection:4,entityReference:5,entityNode:6,progressingInstruction:7,comment:8,document:9,documentType:10,documentFragment:11,notation:12},Xe=function(){return typeof window>`u`?null:window},Ze=function(e,t){if(typeof e!=`object`||typeof e.createPolicy!=`function`)return null;let n=null,r=`data-tt-policy-suffix`;t&&t.hasAttribute(r)&&(n=t.getAttribute(r));let i=`dompurify`+(n?`#`+n:``);try{return e.createPolicy(i,{createHTML(e){return e},createScriptURL(e){return e}})}catch{return console.warn(`TrustedTypes policy `+i+` could not be created.`),null}},Qe=function(){return{afterSanitizeAttributes:[],afterSanitizeElements:[],afterSanitizeShadowDOM:[],beforeSanitizeAttributes:[],beforeSanitizeElements:[],beforeSanitizeShadowDOM:[],uponSanitizeAttribute:[],uponSanitizeElement:[],uponSanitizeShadowNode:[]}};function $e(){let e=arguments.length>0&&arguments[0]!==void 0?arguments[0]:Xe(),t=e=>$e(e);if(t.version=`3.3.3`,t.removed=[],!e||!e.document||e.document.nodeType!==Ye.document||!e.Element)return t.isSupported=!1,t;let{document:n}=e,r=n,i=r.currentScript,{DocumentFragment:a,HTMLTemplateElement:o,Node:s,Element:c,NodeFilter:l,NamedNodeMap:u=e.NamedNodeMap||e.MozNamedAttrMap,HTMLFormElement:d,DOMParser:f,trustedTypes:p}=e,m=c.prototype,ee=ke(m,`cloneNode`),te=ke(m,`remove`),ne=ke(m,`nextSibling`),re=ke(m,`childNodes`),ie=ke(m,`parentNode`);if(typeof o==`function`){let e=n.createElement(`template`);e.content&&e.content.ownerDocument&&(n=e.content.ownerDocument)}let h,ae=``,{implementation:oe,createNodeIterator:se,createDocumentFragment:le,getElementsByTagName:ue}=n,{importNode:de}=r,g=Qe();t.isSupported=typeof ce==`function`&&typeof ie==`function`&&oe&&oe.createHTMLDocument!==void 0;let{MUSTACHE_EXPR:v,ERB_EXPR:pe,TMPLIT_EXPR:me,DATA_ATTR:x,ARIA_ATTR:De,IS_SCRIPT_OR_DATA:Oe,ATTR_WHITESPACE:Ve,CUSTOM_ELEMENT:He}=Je,{IS_ALLOWED_URI:Ue}=Je,w=null,We=S({},[...Ae,...je,...Me,...Pe,...Ie]),T=null,Ke=S({},[...Le,...Re,...ze,...Be]),E=Object.seal(fe(null,{tagNameCheck:{writable:!0,configurable:!1,enumerable:!0,value:null},attributeNameCheck:{writable:!0,configurable:!1,enumerable:!0,value:null},allowCustomizedBuiltInElements:{writable:!0,configurable:!1,enumerable:!0,value:!1}})),D=null,O=null,k=Object.seal(fe(null,{tagCheck:{writable:!0,configurable:!1,enumerable:!0,value:null},attributeCheck:{writable:!0,configurable:!1,enumerable:!0,value:null}})),et=!0,A=!0,j=!1,M=!0,N=!1,tt=!0,P=!1,F=!1,nt=!1,I=!1,rt=!1,it=!1,at=!0,ot=!1,st=!0,L=!1,R={},z=null,B=S({},[`annotation-xml`,`audio`,`colgroup`,`desc`,`foreignobject`,`head`,`iframe`,`math`,`mi`,`mn`,`mo`,`ms`,`mtext`,`noembed`,`noframes`,`noscript`,`plaintext`,`script`,`style`,`svg`,`template`,`thead`,`title`,`video`,`xmp`]),ct=null,lt=S({},[`audio`,`video`,`img`,`source`,`image`,`track`]),ut=null,dt=S({},[`alt`,`class`,`for`,`id`,`label`,`name`,`pattern`,`placeholder`,`role`,`summary`,`title`,`value`,`style`,`xmlns`]),ft=`http://www.w3.org/1998/Math/MathML`,pt=`http://www.w3.org/2000/svg`,V=`http://www.w3.org/1999/xhtml`,mt=V,ht=!1,gt=null,_t=S({},[ft,pt,V],xe),H=S({},[`mi`,`mo`,`mn`,`ms`,`mtext`]),vt=S({},[`annotation-xml`]),yt=S({},[`title`,`style`,`font`,`a`,`script`]),bt=null,xt=[`application/xhtml+xml`,`text/html`],U=null,W=null,St=n.createElement(`form`),Ct=function(e){return e instanceof RegExp||e instanceof Function},wt=function(){let e=arguments.length>0&&arguments[0]!==void 0?arguments[0]:{};if(!(W&&W===e)){if((!e||typeof e!=`object`)&&(e={}),e=C(e),bt=xt.indexOf(e.PARSER_MEDIA_TYPE)===-1?`text/html`:e.PARSER_MEDIA_TYPE,U=bt===`application/xhtml+xml`?xe:be,w=y(e,`ALLOWED_TAGS`)?S({},e.ALLOWED_TAGS,U):We,T=y(e,`ALLOWED_ATTR`)?S({},e.ALLOWED_ATTR,U):Ke,gt=y(e,`ALLOWED_NAMESPACES`)?S({},e.ALLOWED_NAMESPACES,xe):_t,ut=y(e,`ADD_URI_SAFE_ATTR`)?S(C(dt),e.ADD_URI_SAFE_ATTR,U):dt,ct=y(e,`ADD_DATA_URI_TAGS`)?S(C(lt),e.ADD_DATA_URI_TAGS,U):lt,z=y(e,`FORBID_CONTENTS`)?S({},e.FORBID_CONTENTS,U):B,D=y(e,`FORBID_TAGS`)?S({},e.FORBID_TAGS,U):C({}),O=y(e,`FORBID_ATTR`)?S({},e.FORBID_ATTR,U):C({}),R=y(e,`USE_PROFILES`)?e.USE_PROFILES:!1,et=e.ALLOW_ARIA_ATTR!==!1,A=e.ALLOW_DATA_ATTR!==!1,j=e.ALLOW_UNKNOWN_PROTOCOLS||!1,M=e.ALLOW_SELF_CLOSE_IN_ATTR!==!1,N=e.SAFE_FOR_TEMPLATES||!1,tt=e.SAFE_FOR_XML!==!1,P=e.WHOLE_DOCUMENT||!1,I=e.RETURN_DOM||!1,rt=e.RETURN_DOM_FRAGMENT||!1,it=e.RETURN_TRUSTED_TYPE||!1,nt=e.FORCE_BODY||!1,at=e.SANITIZE_DOM!==!1,ot=e.SANITIZE_NAMED_PROPS||!1,st=e.KEEP_CONTENT!==!1,L=e.IN_PLACE||!1,Ue=e.ALLOWED_URI_REGEXP||Ge,mt=e.NAMESPACE||V,H=e.MATHML_TEXT_INTEGRATION_POINTS||H,vt=e.HTML_INTEGRATION_POINTS||vt,E=e.CUSTOM_ELEMENT_HANDLING||{},e.CUSTOM_ELEMENT_HANDLING&&Ct(e.CUSTOM_ELEMENT_HANDLING.tagNameCheck)&&(E.tagNameCheck=e.CUSTOM_ELEMENT_HANDLING.tagNameCheck),e.CUSTOM_ELEMENT_HANDLING&&Ct(e.CUSTOM_ELEMENT_HANDLING.attributeNameCheck)&&(E.attributeNameCheck=e.CUSTOM_ELEMENT_HANDLING.attributeNameCheck),e.CUSTOM_ELEMENT_HANDLING&&typeof e.CUSTOM_ELEMENT_HANDLING.allowCustomizedBuiltInElements==`boolean`&&(E.allowCustomizedBuiltInElements=e.CUSTOM_ELEMENT_HANDLING.allowCustomizedBuiltInElements),N&&(A=!1),rt&&(I=!0),R&&(w=S({},Ie),T=fe(null),R.html===!0&&(S(w,Ae),S(T,Le)),R.svg===!0&&(S(w,je),S(T,Re),S(T,Be)),R.svgFilters===!0&&(S(w,Me),S(T,Re),S(T,Be)),R.mathMl===!0&&(S(w,Pe),S(T,ze),S(T,Be))),y(e,`ADD_TAGS`)||(k.tagCheck=null),y(e,`ADD_ATTR`)||(k.attributeCheck=null),e.ADD_TAGS&&(typeof e.ADD_TAGS==`function`?k.tagCheck=e.ADD_TAGS:(w===We&&(w=C(w)),S(w,e.ADD_TAGS,U))),e.ADD_ATTR&&(typeof e.ADD_ATTR==`function`?k.attributeCheck=e.ADD_ATTR:(T===Ke&&(T=C(T)),S(T,e.ADD_ATTR,U))),e.ADD_URI_SAFE_ATTR&&S(ut,e.ADD_URI_SAFE_ATTR,U),e.FORBID_CONTENTS&&(z===B&&(z=C(z)),S(z,e.FORBID_CONTENTS,U)),e.ADD_FORBID_CONTENTS&&(z===B&&(z=C(z)),S(z,e.ADD_FORBID_CONTENTS,U)),st&&(w[`#text`]=!0),P&&S(w,[`html`,`head`,`body`]),w.table&&(S(w,[`tbody`]),delete D.tbody),e.TRUSTED_TYPES_POLICY){if(typeof e.TRUSTED_TYPES_POLICY.createHTML!=`function`)throw Ee(`TRUSTED_TYPES_POLICY configuration option must provide a "createHTML" hook.`);if(typeof e.TRUSTED_TYPES_POLICY.createScriptURL!=`function`)throw Ee(`TRUSTED_TYPES_POLICY configuration option must provide a "createScriptURL" hook.`);h=e.TRUSTED_TYPES_POLICY,ae=h.createHTML(``)}else h===void 0&&(h=Ze(p,i)),h!==null&&typeof ae==`string`&&(ae=h.createHTML(``));_&&_(e),W=e}},Tt=S({},[...je,...Me,...Ne]),Et=S({},[...Pe,...Fe]),Dt=function(e){let t=ie(e);(!t||!t.tagName)&&(t={namespaceURI:mt,tagName:`template`});let n=be(e.tagName),r=be(t.tagName);return gt[e.namespaceURI]?e.namespaceURI===pt?t.namespaceURI===V?n===`svg`:t.namespaceURI===ft?n===`svg`&&(r===`annotation-xml`||H[r]):!!Tt[n]:e.namespaceURI===ft?t.namespaceURI===V?n===`math`:t.namespaceURI===pt?n===`math`&&vt[r]:!!Et[n]:e.namespaceURI===V?t.namespaceURI===pt&&!vt[r]||t.namespaceURI===ft&&!H[r]?!1:!Et[n]&&(yt[n]||!Tt[n]):!!(bt===`application/xhtml+xml`&&gt[e.namespaceURI]):!1},G=function(e){ve(t.removed,{element:e});try{ie(e).removeChild(e)}catch{te(e)}},K=function(e,n){try{ve(t.removed,{attribute:n.getAttributeNode(e),from:n})}catch{ve(t.removed,{attribute:null,from:n})}if(n.removeAttribute(e),e===`is`)if(I||rt)try{G(n)}catch{}else try{n.setAttribute(e,``)}catch{}},Ot=function(e){let t=null,r=null;if(nt)e=`<remove></remove>`+e;else{let t=Se(e,/^[\r\n\t ]+/);r=t&&t[0]}bt===`application/xhtml+xml`&&mt===V&&(e=`<html xmlns="http://www.w3.org/1999/xhtml"><head></head><body>`+e+`</body></html>`);let i=h?h.createHTML(e):e;if(mt===V)try{t=new f().parseFromString(i,bt)}catch{}if(!t||!t.documentElement){t=oe.createDocument(mt,`template`,null);try{t.documentElement.innerHTML=ht?ae:i}catch{}}let a=t.body||t.documentElement;return e&&r&&a.insertBefore(n.createTextNode(r),a.childNodes[0]||null),mt===V?ue.call(t,P?`html`:`body`)[0]:P?t.documentElement:a},kt=function(e){return se.call(e.ownerDocument||e,e,l.SHOW_ELEMENT|l.SHOW_COMMENT|l.SHOW_TEXT|l.SHOW_PROCESSING_INSTRUCTION|l.SHOW_CDATA_SECTION,null)},At=function(e){return e instanceof d&&(typeof e.nodeName!=`string`||typeof e.textContent!=`string`||typeof e.removeChild!=`function`||!(e.attributes instanceof u)||typeof e.removeAttribute!=`function`||typeof e.setAttribute!=`function`||typeof e.namespaceURI!=`string`||typeof e.insertBefore!=`function`||typeof e.hasChildNodes!=`function`)},jt=function(e){return typeof s==`function`&&e instanceof s};function q(e,n,r){he(e,e=>{e.call(t,n,r,W)})}let Mt=function(e){let n=null;if(q(g.beforeSanitizeElements,e,null),At(e))return G(e),!0;let r=U(e.nodeName);if(q(g.uponSanitizeElement,e,{tagName:r,allowedTags:w}),tt&&e.hasChildNodes()&&!jt(e.firstElementChild)&&b(/<[/\w!]/g,e.innerHTML)&&b(/<[/\w!]/g,e.textContent)||e.nodeType===Ye.progressingInstruction||tt&&e.nodeType===Ye.comment&&b(/<[/\w]/g,e.data))return G(e),!0;if(!(k.tagCheck instanceof Function&&k.tagCheck(r))&&(!w[r]||D[r])){if(!D[r]&&Pt(r)&&(E.tagNameCheck instanceof RegExp&&b(E.tagNameCheck,r)||E.tagNameCheck instanceof Function&&E.tagNameCheck(r)))return!1;if(st&&!z[r]){let t=ie(e)||e.parentNode,n=re(e)||e.childNodes;if(n&&t){let r=n.length;for(let i=r-1;i>=0;--i){let r=ee(n[i],!0);r.__removalCount=(e.__removalCount||0)+1,t.insertBefore(r,ne(e))}}}return G(e),!0}return e instanceof c&&!Dt(e)||(r===`noscript`||r===`noembed`||r===`noframes`)&&b(/<\/no(script|embed|frames)/i,e.innerHTML)?(G(e),!0):(N&&e.nodeType===Ye.text&&(n=e.textContent,he([v,pe,me],e=>{n=Ce(n,e,` `)}),e.textContent!==n&&(ve(t.removed,{element:e.cloneNode()}),e.textContent=n)),q(g.afterSanitizeElements,e,null),!1)},Nt=function(e,t,r){if(O[t]||at&&(t===`id`||t===`name`)&&(r in n||r in St))return!1;if(!(A&&!O[t]&&b(x,t))&&!(et&&b(De,t))&&!(k.attributeCheck instanceof Function&&k.attributeCheck(t,e))){if(!T[t]||O[t]){if(!(Pt(e)&&(E.tagNameCheck instanceof RegExp&&b(E.tagNameCheck,e)||E.tagNameCheck instanceof Function&&E.tagNameCheck(e))&&(E.attributeNameCheck instanceof RegExp&&b(E.attributeNameCheck,t)||E.attributeNameCheck instanceof Function&&E.attributeNameCheck(t,e))||t===`is`&&E.allowCustomizedBuiltInElements&&(E.tagNameCheck instanceof RegExp&&b(E.tagNameCheck,r)||E.tagNameCheck instanceof Function&&E.tagNameCheck(r))))return!1}else if(!ut[t]&&!b(Ue,Ce(r,Ve,``))&&!((t===`src`||t===`xlink:href`||t===`href`)&&e!==`script`&&we(r,`data:`)===0&&ct[e])&&!(j&&!b(Oe,Ce(r,Ve,``)))&&r)return!1}return!0},Pt=function(e){return e!==`annotation-xml`&&Se(e,He)},Ft=function(e){q(g.beforeSanitizeAttributes,e,null);let{attributes:n}=e;if(!n||At(e))return;let r={attrName:``,attrValue:``,keepAttr:!0,allowedAttributes:T,forceKeepAttr:void 0},i=n.length;for(;i--;){let{name:a,namespaceURI:o,value:s}=n[i],c=U(a),l=s,u=a===`value`?l:Te(l);if(r.attrName=c,r.attrValue=u,r.keepAttr=!0,r.forceKeepAttr=void 0,q(g.uponSanitizeAttribute,e,r),u=r.attrValue,ot&&(c===`id`||c===`name`)&&(K(a,e),u=`user-content-`+u),tt&&b(/((--!?|])>)|<\/(style|script|title|xmp|textarea|noscript|iframe|noembed|noframes)/i,u)){K(a,e);continue}if(c===`attributename`&&Se(u,`href`)){K(a,e);continue}if(r.forceKeepAttr)continue;if(!r.keepAttr){K(a,e);continue}if(!M&&b(/\/>/i,u)){K(a,e);continue}N&&he([v,pe,me],e=>{u=Ce(u,e,` `)});let d=U(e.nodeName);if(!Nt(d,c,u)){K(a,e);continue}if(h&&typeof p==`object`&&typeof p.getAttributeType==`function`&&!o)switch(p.getAttributeType(d,c)){case`TrustedHTML`:u=h.createHTML(u);break;case`TrustedScriptURL`:u=h.createScriptURL(u);break}if(u!==l)try{o?e.setAttributeNS(o,a,u):e.setAttribute(a,u),At(e)?G(e):_e(t.removed)}catch{K(a,e)}}q(g.afterSanitizeAttributes,e,null)},It=function e(t){let n=null,r=kt(t);for(q(g.beforeSanitizeShadowDOM,t,null);n=r.nextNode();)q(g.uponSanitizeShadowNode,n,null),Mt(n),Ft(n),n.content instanceof a&&e(n.content);q(g.afterSanitizeShadowDOM,t,null)};return t.sanitize=function(e){let n=arguments.length>1&&arguments[1]!==void 0?arguments[1]:{},i=null,o=null,c=null,l=null;if(ht=!e,ht&&(e=`<!-->`),typeof e!=`string`&&!jt(e))if(typeof e.toString==`function`){if(e=e.toString(),typeof e!=`string`)throw Ee(`dirty is not a string, aborting`)}else throw Ee(`toString is not a function`);if(!t.isSupported)return e;if(F||wt(n),t.removed=[],typeof e==`string`&&(L=!1),L){if(e.nodeName){let t=U(e.nodeName);if(!w[t]||D[t])throw Ee(`root node is forbidden and cannot be sanitized in-place`)}}else if(e instanceof s)i=Ot(`<!---->`),o=i.ownerDocument.importNode(e,!0),o.nodeType===Ye.element&&o.nodeName===`BODY`||o.nodeName===`HTML`?i=o:i.appendChild(o);else{if(!I&&!N&&!P&&e.indexOf(`<`)===-1)return h&&it?h.createHTML(e):e;if(i=Ot(e),!i)return I?null:it?ae:``}i&&nt&&G(i.firstChild);let u=kt(L?e:i);for(;c=u.nextNode();)Mt(c),Ft(c),c.content instanceof a&&It(c.content);if(L)return e;if(I){if(rt)for(l=le.call(i.ownerDocument);i.firstChild;)l.appendChild(i.firstChild);else l=i;return(T.shadowroot||T.shadowrootmode)&&(l=de.call(r,l,!0)),l}let d=P?i.outerHTML:i.innerHTML;return P&&w[`!doctype`]&&i.ownerDocument&&i.ownerDocument.doctype&&i.ownerDocument.doctype.name&&b(qe,i.ownerDocument.doctype.name)&&(d=`<!DOCTYPE `+i.ownerDocument.doctype.name+`>
2
- `+d),N&&he([v,pe,me],e=>{d=Ce(d,e,` `)}),h&&it?h.createHTML(d):d},t.setConfig=function(){wt(arguments.length>0&&arguments[0]!==void 0?arguments[0]:{}),F=!0},t.clearConfig=function(){W=null,F=!1},t.isValidAttribute=function(e,t,n){return W||wt({}),Nt(U(e),U(t),n)},t.addHook=function(e,t){typeof t==`function`&&ve(g[e],t)},t.removeHook=function(e,t){if(t!==void 0){let n=ge(g[e],t);return n===-1?void 0:ye(g[e],n,1)[0]}return _e(g[e])},t.removeHooks=function(e){g[e]=[]},t.removeAllHooks=function(){g=Qe()},t}var D=$e();function O(){return{async:!1,breaks:!1,extensions:null,gfm:!0,hooks:null,pedantic:!1,renderer:null,silent:!1,tokenizer:null,walkTokens:null}}var k=O();function et(e){k=e}var A={exec:()=>null};function j(e,t=``){let n=typeof e==`string`?e:e.source,r={replace:(e,t)=>{let i=typeof t==`string`?t:t.source;return i=i.replace(M.caret,`$1`),n=n.replace(e,i),r},getRegex:()=>new RegExp(n,t)};return r}var M={codeRemoveIndent:/^(?: {1,4}| {0,3}\t)/gm,outputLinkReplace:/\\([\[\]])/g,indentCodeCompensation:/^(\s+)(?:```)/,beginningSpace:/^\s+/,endingHash:/#$/,startingSpaceChar:/^ /,endingSpaceChar:/ $/,nonSpaceChar:/[^ ]/,newLineCharGlobal:/\n/g,tabCharGlobal:/\t/g,multipleSpaceGlobal:/\s+/g,blankLine:/^[ \t]*$/,doubleBlankLine:/\n[ \t]*\n[ \t]*$/,blockquoteStart:/^ {0,3}>/,blockquoteSetextReplace:/\n {0,3}((?:=+|-+) *)(?=\n|$)/g,blockquoteSetextReplace2:/^ {0,3}>[ \t]?/gm,listReplaceTabs:/^\t+/,listReplaceNesting:/^ {1,4}(?=( {4})*[^ ])/g,listIsTask:/^\[[ xX]\] /,listReplaceTask:/^\[[ xX]\] +/,anyLine:/\n.*\n/,hrefBrackets:/^<(.*)>$/,tableDelimiter:/[:|]/,tableAlignChars:/^\||\| *$/g,tableRowBlankLine:/\n[ \t]*$/,tableAlignRight:/^ *-+: *$/,tableAlignCenter:/^ *:-+: *$/,tableAlignLeft:/^ *:-+ *$/,startATag:/^<a /i,endATag:/^<\/a>/i,startPreScriptTag:/^<(pre|code|kbd|script)(\s|>)/i,endPreScriptTag:/^<\/(pre|code|kbd|script)(\s|>)/i,startAngleBracket:/^</,endAngleBracket:/>$/,pedanticHrefTitle:/^([^'"]*[^\s])\s+(['"])(.*)\2/,unicodeAlphaNumeric:/[\p{L}\p{N}]/u,escapeTest:/[&<>"']/,escapeReplace:/[&<>"']/g,escapeTestNoEncode:/[<>"']|&(?!(#\d{1,7}|#[Xx][a-fA-F0-9]{1,6}|\w+);)/,escapeReplaceNoEncode:/[<>"']|&(?!(#\d{1,7}|#[Xx][a-fA-F0-9]{1,6}|\w+);)/g,unescapeTest:/&(#(?:\d+)|(?:#x[0-9A-Fa-f]+)|(?:\w+));?/gi,caret:/(^|[^\[])\^/g,percentDecode:/%25/g,findPipe:/\|/g,splitPipe:/ \|/,slashPipe:/\\\|/g,carriageReturn:/\r\n|\r/g,spaceLine:/^ +$/gm,notSpaceStart:/^\S*/,endingNewline:/\n$/,listItemRegex:e=>RegExp(`^( {0,3}${e})((?:[ ][^\\n]*)?(?:\\n|$))`),nextBulletRegex:e=>RegExp(`^ {0,${Math.min(3,e-1)}}(?:[*+-]|\\d{1,9}[.)])((?:[ ][^\\n]*)?(?:\\n|$))`),hrRegex:e=>RegExp(`^ {0,${Math.min(3,e-1)}}((?:- *){3,}|(?:_ *){3,}|(?:\\* *){3,})(?:\\n+|$)`),fencesBeginRegex:e=>RegExp(`^ {0,${Math.min(3,e-1)}}(?:\`\`\`|~~~)`),headingBeginRegex:e=>RegExp(`^ {0,${Math.min(3,e-1)}}#`),htmlBeginRegex:e=>RegExp(`^ {0,${Math.min(3,e-1)}}<(?:[a-z].*>|!--)`,`i`)},N=/^(?:[ \t]*(?:\n|$))+/,tt=/^((?: {4}| {0,3}\t)[^\n]+(?:\n(?:[ \t]*(?:\n|$))*)?)+/,P=/^ {0,3}(`{3,}(?=[^`\n]*(?:\n|$))|~{3,})([^\n]*)(?:\n|$)(?:|([\s\S]*?)(?:\n|$))(?: {0,3}\1[~`]* *(?=\n|$)|$)/,F=/^ {0,3}((?:-[\t ]*){3,}|(?:_[ \t]*){3,}|(?:\*[ \t]*){3,})(?:\n+|$)/,nt=/^ {0,3}(#{1,6})(?=\s|$)(.*)(?:\n+|$)/,I=/(?:[*+-]|\d{1,9}[.)])/,rt=/^(?!bull |blockCode|fences|blockquote|heading|html|table)((?:.|\n(?!\s*?\n|bull |blockCode|fences|blockquote|heading|html|table))+?)\n {0,3}(=+|-+) *(?:\n+|$)/,it=j(rt).replace(/bull/g,I).replace(/blockCode/g,/(?: {4}| {0,3}\t)/).replace(/fences/g,/ {0,3}(?:`{3,}|~{3,})/).replace(/blockquote/g,/ {0,3}>/).replace(/heading/g,/ {0,3}#{1,6}/).replace(/html/g,/ {0,3}<[^\n>]+>\n/).replace(/\|table/g,``).getRegex(),at=j(rt).replace(/bull/g,I).replace(/blockCode/g,/(?: {4}| {0,3}\t)/).replace(/fences/g,/ {0,3}(?:`{3,}|~{3,})/).replace(/blockquote/g,/ {0,3}>/).replace(/heading/g,/ {0,3}#{1,6}/).replace(/html/g,/ {0,3}<[^\n>]+>\n/).replace(/table/g,/ {0,3}\|?(?:[:\- ]*\|)+[\:\- ]*\n/).getRegex(),ot=/^([^\n]+(?:\n(?!hr|heading|lheading|blockquote|fences|list|html|table| +\n)[^\n]+)*)/,st=/^[^\n]+/,L=/(?!\s*\])(?:\\.|[^\[\]\\])+/,R=j(/^ {0,3}\[(label)\]: *(?:\n[ \t]*)?([^<\s][^\s]*|<.*?>)(?:(?: +(?:\n[ \t]*)?| *\n[ \t]*)(title))? *(?:\n+|$)/).replace(`label`,L).replace(`title`,/(?:"(?:\\"?|[^"\\])*"|'[^'\n]*(?:\n[^'\n]+)*\n?'|\([^()]*\))/).getRegex(),z=j(/^( {0,3}bull)([ \t][^\n]+?)?(?:\n|$)/).replace(/bull/g,I).getRegex(),B=`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|h[1-6]|head|header|hr|html|iframe|legend|li|link|main|menu|menuitem|meta|nav|noframes|ol|optgroup|option|p|param|search|section|summary|table|tbody|td|tfoot|th|thead|title|tr|track|ul`,ct=/<!--(?:-?>|[\s\S]*?(?:-->|$))/,lt=j(`^ {0,3}(?:<(script|pre|style|textarea)[\\s>][\\s\\S]*?(?:</\\1>[^\\n]*\\n+|$)|comment[^\\n]*(\\n+|$)|<\\?[\\s\\S]*?(?:\\?>\\n*|$)|<![A-Z][\\s\\S]*?(?:>\\n*|$)|<!\\[CDATA\\[[\\s\\S]*?(?:\\]\\]>\\n*|$)|</?(tag)(?: +|\\n|/?>)[\\s\\S]*?(?:(?:\\n[ ]*)+\\n|$)|<(?!script|pre|style|textarea)([a-z][\\w-]*)(?:attribute)*? */?>(?=[ \\t]*(?:\\n|$))[\\s\\S]*?(?:(?:\\n[ ]*)+\\n|$)|</(?!script|pre|style|textarea)[a-z][\\w-]*\\s*>(?=[ \\t]*(?:\\n|$))[\\s\\S]*?(?:(?:\\n[ ]*)+\\n|$))`,`i`).replace(`comment`,ct).replace(`tag`,B).replace(`attribute`,/ +[a-zA-Z:_][\w.:-]*(?: *= *"[^"\n]*"| *= *'[^'\n]*'| *= *[^\s"'=<>`]+)?/).getRegex(),ut=j(ot).replace(`hr`,F).replace(`heading`,` {0,3}#{1,6}(?:\\s|$)`).replace(`|lheading`,``).replace(`|table`,``).replace(`blockquote`,` {0,3}>`).replace(`fences`," {0,3}(?:`{3,}(?=[^`\\n]*\\n)|~{3,})[^\\n]*\\n").replace(`list`,` {0,3}(?:[*+-]|1[.)]) `).replace(`html`,`</?(?:tag)(?: +|\\n|/?>)|<(?:script|pre|style|textarea|!--)`).replace(`tag`,B).getRegex(),dt={blockquote:j(/^( {0,3}> ?(paragraph|[^\n]*)(?:\n|$))+/).replace(`paragraph`,ut).getRegex(),code:tt,def:R,fences:P,heading:nt,hr:F,html:lt,lheading:it,list:z,newline:N,paragraph:ut,table:A,text:st},ft=j(`^ *([^\\n ].*)\\n {0,3}((?:\\| *)?:?-+:? *(?:\\| *:?-+:? *)*(?:\\| *)?)(?:\\n((?:(?! *\\n|hr|heading|blockquote|code|fences|list|html).*(?:\\n|$))*)\\n*|$)`).replace(`hr`,F).replace(`heading`,` {0,3}#{1,6}(?:\\s|$)`).replace(`blockquote`,` {0,3}>`).replace(`code`,`(?: {4}| {0,3} )[^\\n]`).replace(`fences`," {0,3}(?:`{3,}(?=[^`\\n]*\\n)|~{3,})[^\\n]*\\n").replace(`list`,` {0,3}(?:[*+-]|1[.)]) `).replace(`html`,`</?(?:tag)(?: +|\\n|/?>)|<(?:script|pre|style|textarea|!--)`).replace(`tag`,B).getRegex(),pt={...dt,lheading:at,table:ft,paragraph:j(ot).replace(`hr`,F).replace(`heading`,` {0,3}#{1,6}(?:\\s|$)`).replace(`|lheading`,``).replace(`table`,ft).replace(`blockquote`,` {0,3}>`).replace(`fences`," {0,3}(?:`{3,}(?=[^`\\n]*\\n)|~{3,})[^\\n]*\\n").replace(`list`,` {0,3}(?:[*+-]|1[.)]) `).replace(`html`,`</?(?:tag)(?: +|\\n|/?>)|<(?:script|pre|style|textarea|!--)`).replace(`tag`,B).getRegex()},V={...dt,html:j(`^ *(?:comment *(?:\\n|\\s*$)|<(tag)[\\s\\S]+?</\\1> *(?:\\n{2,}|\\s*$)|<tag(?:"[^"]*"|'[^']*'|\\s[^'"/>\\s]*)*?/?> *(?:\\n{2,}|\\s*$))`).replace(`comment`,ct).replace(/tag/g,`(?!(?:a|em|strong|small|s|cite|q|dfn|abbr|data|time|code|var|samp|kbd|sub|sup|i|b|u|mark|ruby|rt|rp|bdi|bdo|span|br|wbr|ins|del|img)\\b)\\w+(?!:|[^\\w\\s@]*@)\\b`).getRegex(),def:/^ *\[([^\]]+)\]: *<?([^\s>]+)>?(?: +(["(][^\n]+[")]))? *(?:\n+|$)/,heading:/^(#{1,6})(.*)(?:\n+|$)/,fences:A,lheading:/^(.+?)\n {0,3}(=+|-+) *(?:\n+|$)/,paragraph:j(ot).replace(`hr`,F).replace(`heading`,` *#{1,6} *[^
3
- ]`).replace(`lheading`,it).replace(`|table`,``).replace(`blockquote`,` {0,3}>`).replace(`|fences`,``).replace(`|list`,``).replace(`|html`,``).replace(`|tag`,``).getRegex()},mt=/^\\([!"#$%&'()*+,\-./:;<=>?@\[\]\\^_`{|}~])/,ht=/^(`+)([^`]|[^`][\s\S]*?[^`])\1(?!`)/,gt=/^( {2,}|\\)\n(?!\s*$)/,_t=/^(`+|[^`])(?:(?= {2,}\n)|[\s\S]*?(?:(?=[\\<!\[`*_]|\b_|$)|[^ ](?= {2,}\n)))/,H=/[\p{P}\p{S}]/u,vt=/[\s\p{P}\p{S}]/u,yt=/[^\s\p{P}\p{S}]/u,bt=j(/^((?![*_])punctSpace)/,`u`).replace(/punctSpace/g,vt).getRegex(),xt=/(?!~)[\p{P}\p{S}]/u,U=/(?!~)[\s\p{P}\p{S}]/u,W=/(?:[^\s\p{P}\p{S}]|~)/u,St=/\[[^[\]]*?\]\((?:\\.|[^\\\(\)]|\((?:\\.|[^\\\(\)])*\))*\)|`[^`]*?`|<[^<>]*?>/g,Ct=/^(?:\*+(?:((?!\*)punct)|[^\s*]))|^_+(?:((?!_)punct)|([^\s_]))/,wt=j(Ct,`u`).replace(/punct/g,H).getRegex(),Tt=j(Ct,`u`).replace(/punct/g,xt).getRegex(),Et=`^[^_*]*?__[^_*]*?\\*[^_*]*?(?=__)|[^*]+(?=[^*])|(?!\\*)punct(\\*+)(?=[\\s]|$)|notPunctSpace(\\*+)(?!\\*)(?=punctSpace|$)|(?!\\*)punctSpace(\\*+)(?=notPunctSpace)|[\\s](\\*+)(?!\\*)(?=punct)|(?!\\*)punct(\\*+)(?!\\*)(?=punct)|notPunctSpace(\\*+)(?=notPunctSpace)`,Dt=j(Et,`gu`).replace(/notPunctSpace/g,yt).replace(/punctSpace/g,vt).replace(/punct/g,H).getRegex(),G=j(Et,`gu`).replace(/notPunctSpace/g,W).replace(/punctSpace/g,U).replace(/punct/g,xt).getRegex(),K=j(`^[^_*]*?\\*\\*[^_*]*?_[^_*]*?(?=\\*\\*)|[^_]+(?=[^_])|(?!_)punct(_+)(?=[\\s]|$)|notPunctSpace(_+)(?!_)(?=punctSpace|$)|(?!_)punctSpace(_+)(?=notPunctSpace)|[\\s](_+)(?!_)(?=punct)|(?!_)punct(_+)(?!_)(?=punct)`,`gu`).replace(/notPunctSpace/g,yt).replace(/punctSpace/g,vt).replace(/punct/g,H).getRegex(),Ot=j(/\\(punct)/,`gu`).replace(/punct/g,H).getRegex(),kt=j(/^<(scheme:[^\s\x00-\x1f<>]*|email)>/).replace(`scheme`,/[a-zA-Z][a-zA-Z0-9+.-]{1,31}/).replace(`email`,/[a-zA-Z0-9.!#$%&'*+/=?^_`{|}~-]+(@)[a-zA-Z0-9](?:[a-zA-Z0-9-]{0,61}[a-zA-Z0-9])?(?:\.[a-zA-Z0-9](?:[a-zA-Z0-9-]{0,61}[a-zA-Z0-9])?)+(?![-_])/).getRegex(),At=j(ct).replace(`(?:-->|$)`,`-->`).getRegex(),jt=j(`^comment|^</[a-zA-Z][\\w:-]*\\s*>|^<[a-zA-Z][\\w-]*(?:attribute)*?\\s*/?>|^<\\?[\\s\\S]*?\\?>|^<![a-zA-Z]+\\s[\\s\\S]*?>|^<!\\[CDATA\\[[\\s\\S]*?\\]\\]>`).replace(`comment`,At).replace(`attribute`,/\s+[a-zA-Z:_][\w.:-]*(?:\s*=\s*"[^"]*"|\s*=\s*'[^']*'|\s*=\s*[^\s"'=<>`]+)?/).getRegex(),q=/(?:\[(?:\\.|[^\[\]\\])*\]|\\.|`[^`]*`|[^\[\]\\`])*?/,Mt=j(/^!?\[(label)\]\(\s*(href)(?:(?:[ \t]*(?:\n[ \t]*)?)(title))?\s*\)/).replace(`label`,q).replace(`href`,/<(?:\\.|[^\n<>\\])+>|[^ \t\n\x00-\x1f]*/).replace(`title`,/"(?:\\"?|[^"\\])*"|'(?:\\'?|[^'\\])*'|\((?:\\\)?|[^)\\])*\)/).getRegex(),Nt=j(/^!?\[(label)\]\[(ref)\]/).replace(`label`,q).replace(`ref`,L).getRegex(),Pt=j(/^!?\[(ref)\](?:\[\])?/).replace(`ref`,L).getRegex(),Ft={_backpedal:A,anyPunctuation:Ot,autolink:kt,blockSkip:St,br:gt,code:ht,del:A,emStrongLDelim:wt,emStrongRDelimAst:Dt,emStrongRDelimUnd:K,escape:mt,link:Mt,nolink:Pt,punctuation:bt,reflink:Nt,reflinkSearch:j(`reflink|nolink(?!\\()`,`g`).replace(`reflink`,Nt).replace(`nolink`,Pt).getRegex(),tag:jt,text:_t,url:A},It={...Ft,link:j(/^!?\[(label)\]\((.*?)\)/).replace(`label`,q).getRegex(),reflink:j(/^!?\[(label)\]\s*\[([^\]]*)\]/).replace(`label`,q).getRegex()},Lt={...Ft,emStrongRDelimAst:G,emStrongLDelim:Tt,url:j(/^((?:ftp|https?):\/\/|www\.)(?:[a-zA-Z0-9\-]+\.?)+[^\s<]*|^email/,`i`).replace(`email`,/[A-Za-z0-9._+-]+(@)[a-zA-Z0-9-_]+(?:\.[a-zA-Z0-9-_]*[a-zA-Z0-9])+(?![-_])/).getRegex(),_backpedal:/(?:[^?!.,:;*_'"~()&]+|\([^)]*\)|&(?![a-zA-Z0-9]+;$)|[?!.,:;*_'"~)]+(?!$))+/,del:/^(~~?)(?=[^\s~])((?:\\.|[^\\])*?(?:\\.|[^\s~\\]))\1(?=[^~]|$)/,text:/^([`~]+|[^`~])(?:(?= {2,}\n)|(?=[a-zA-Z0-9.!#$%&'*+\/=?_`{\|}~-]+@)|[\s\S]*?(?:(?=[\\<!\[`*~_]|\b_|https?:\/\/|ftp:\/\/|www\.|$)|[^ ](?= {2,}\n)|[^a-zA-Z0-9.!#$%&'*+\/=?_`{\|}~-](?=[a-zA-Z0-9.!#$%&'*+\/=?_`{\|}~-]+@)))/},Rt={...Lt,br:j(gt).replace(`{2,}`,`*`).getRegex(),text:j(Lt.text).replace(`\\b_`,`\\b_| {2,}\\n`).replace(/\{2,\}/g,`*`).getRegex()},zt={normal:dt,gfm:pt,pedantic:V},Bt={normal:Ft,gfm:Lt,breaks:Rt,pedantic:It},Vt={"&":`&amp;`,"<":`&lt;`,">":`&gt;`,'"':`&quot;`,"'":`&#39;`},Ht=e=>Vt[e];function J(e,t){if(t){if(M.escapeTest.test(e))return e.replace(M.escapeReplace,Ht)}else if(M.escapeTestNoEncode.test(e))return e.replace(M.escapeReplaceNoEncode,Ht);return e}function Ut(e){try{e=encodeURI(e).replace(M.percentDecode,`%`)}catch{return null}return e}function Wt(e,t){let n=e.replace(M.findPipe,(e,t,n)=>{let r=!1,i=t;for(;--i>=0&&n[i]===`\\`;)r=!r;return r?`|`:` |`}).split(M.splitPipe),r=0;if(n[0].trim()||n.shift(),n.length>0&&!n.at(-1)?.trim()&&n.pop(),t)if(n.length>t)n.splice(t);else for(;n.length<t;)n.push(``);for(;r<n.length;r++)n[r]=n[r].trim().replace(M.slashPipe,`|`);return n}function Gt(e,t,n){let r=e.length;if(r===0)return``;let i=0;for(;i<r;){let a=e.charAt(r-i-1);if(a===t&&!n)i++;else if(a!==t&&n)i++;else break}return e.slice(0,r-i)}function Kt(e,t){if(e.indexOf(t[1])===-1)return-1;let n=0;for(let r=0;r<e.length;r++)if(e[r]===`\\`)r++;else if(e[r]===t[0])n++;else if(e[r]===t[1]&&(n--,n<0))return r;return n>0?-2:-1}function qt(e,t,n,r,i){let a=t.href,o=t.title||null,s=e[1].replace(i.other.outputLinkReplace,`$1`);r.state.inLink=!0;let c={type:e[0].charAt(0)===`!`?`image`:`link`,raw:n,href:a,title:o,text:s,tokens:r.inlineTokens(s)};return r.state.inLink=!1,c}function Jt(e,t,n){let r=e.match(n.other.indentCodeCompensation);if(r===null)return t;let i=r[1];return t.split(`
4
- `).map(e=>{let t=e.match(n.other.beginningSpace);if(t===null)return e;let[r]=t;return r.length>=i.length?e.slice(i.length):e}).join(`
5
- `)}var Yt=class{options;rules;lexer;constructor(e){this.options=e||k}space(e){let t=this.rules.block.newline.exec(e);if(t&&t[0].length>0)return{type:`space`,raw:t[0]}}code(e){let t=this.rules.block.code.exec(e);if(t){let e=t[0].replace(this.rules.other.codeRemoveIndent,``);return{type:`code`,raw:t[0],codeBlockStyle:`indented`,text:this.options.pedantic?e:Gt(e,`
6
- `)}}}fences(e){let t=this.rules.block.fences.exec(e);if(t){let e=t[0],n=Jt(e,t[3]||``,this.rules);return{type:`code`,raw:e,lang:t[2]?t[2].trim().replace(this.rules.inline.anyPunctuation,`$1`):t[2],text:n}}}heading(e){let t=this.rules.block.heading.exec(e);if(t){let e=t[2].trim();if(this.rules.other.endingHash.test(e)){let t=Gt(e,`#`);(this.options.pedantic||!t||this.rules.other.endingSpaceChar.test(t))&&(e=t.trim())}return{type:`heading`,raw:t[0],depth:t[1].length,text:e,tokens:this.lexer.inline(e)}}}hr(e){let t=this.rules.block.hr.exec(e);if(t)return{type:`hr`,raw:Gt(t[0],`
7
- `)}}blockquote(e){let t=this.rules.block.blockquote.exec(e);if(t){let e=Gt(t[0],`
8
- `).split(`
9
- `),n=``,r=``,i=[];for(;e.length>0;){let t=!1,a=[],o;for(o=0;o<e.length;o++)if(this.rules.other.blockquoteStart.test(e[o]))a.push(e[o]),t=!0;else if(!t)a.push(e[o]);else break;e=e.slice(o);let s=a.join(`
10
- `),c=s.replace(this.rules.other.blockquoteSetextReplace,`
11
- $1`).replace(this.rules.other.blockquoteSetextReplace2,``);n=n?`${n}
12
- ${s}`:s,r=r?`${r}
13
- ${c}`:c;let l=this.lexer.state.top;if(this.lexer.state.top=!0,this.lexer.blockTokens(c,i,!0),this.lexer.state.top=l,e.length===0)break;let u=i.at(-1);if(u?.type===`code`)break;if(u?.type===`blockquote`){let t=u,a=t.raw+`
14
- `+e.join(`
15
- `),o=this.blockquote(a);i[i.length-1]=o,n=n.substring(0,n.length-t.raw.length)+o.raw,r=r.substring(0,r.length-t.text.length)+o.text;break}else if(u?.type===`list`){let t=u,a=t.raw+`
16
- `+e.join(`
17
- `),o=this.list(a);i[i.length-1]=o,n=n.substring(0,n.length-u.raw.length)+o.raw,r=r.substring(0,r.length-t.raw.length)+o.raw,e=a.substring(i.at(-1).raw.length).split(`
18
- `);continue}}return{type:`blockquote`,raw:n,tokens:i,text:r}}}list(e){let t=this.rules.block.list.exec(e);if(t){let n=t[1].trim(),r=n.length>1,i={type:`list`,raw:``,ordered:r,start:r?+n.slice(0,-1):``,loose:!1,items:[]};n=r?`\\d{1,9}\\${n.slice(-1)}`:`\\${n}`,this.options.pedantic&&(n=r?n:`[*+-]`);let a=this.rules.other.listItemRegex(n),o=!1;for(;e;){let n=!1,r=``,s=``;if(!(t=a.exec(e))||this.rules.block.hr.test(e))break;r=t[0],e=e.substring(r.length);let c=t[2].split(`
19
- `,1)[0].replace(this.rules.other.listReplaceTabs,e=>` `.repeat(3*e.length)),l=e.split(`
20
- `,1)[0],u=!c.trim(),d=0;if(this.options.pedantic?(d=2,s=c.trimStart()):u?d=t[1].length+1:(d=t[2].search(this.rules.other.nonSpaceChar),d=d>4?1:d,s=c.slice(d),d+=t[1].length),u&&this.rules.other.blankLine.test(l)&&(r+=l+`
21
- `,e=e.substring(l.length+1),n=!0),!n){let t=this.rules.other.nextBulletRegex(d),n=this.rules.other.hrRegex(d),i=this.rules.other.fencesBeginRegex(d),a=this.rules.other.headingBeginRegex(d),o=this.rules.other.htmlBeginRegex(d);for(;e;){let f=e.split(`
22
- `,1)[0],p;if(l=f,this.options.pedantic?(l=l.replace(this.rules.other.listReplaceNesting,` `),p=l):p=l.replace(this.rules.other.tabCharGlobal,` `),i.test(l)||a.test(l)||o.test(l)||t.test(l)||n.test(l))break;if(p.search(this.rules.other.nonSpaceChar)>=d||!l.trim())s+=`
23
- `+p.slice(d);else{if(u||c.replace(this.rules.other.tabCharGlobal,` `).search(this.rules.other.nonSpaceChar)>=4||i.test(c)||a.test(c)||n.test(c))break;s+=`
24
- `+l}!u&&!l.trim()&&(u=!0),r+=f+`
25
- `,e=e.substring(f.length+1),c=p.slice(d)}}i.loose||(o?i.loose=!0:this.rules.other.doubleBlankLine.test(r)&&(o=!0));let f=null,p;this.options.gfm&&(f=this.rules.other.listIsTask.exec(s),f&&(p=f[0]!==`[ ] `,s=s.replace(this.rules.other.listReplaceTask,``))),i.items.push({type:`list_item`,raw:r,task:!!f,checked:p,loose:!1,text:s,tokens:[]}),i.raw+=r}let s=i.items.at(-1);if(s)s.raw=s.raw.trimEnd(),s.text=s.text.trimEnd();else return;i.raw=i.raw.trimEnd();for(let e=0;e<i.items.length;e++)if(this.lexer.state.top=!1,i.items[e].tokens=this.lexer.blockTokens(i.items[e].text,[]),!i.loose){let t=i.items[e].tokens.filter(e=>e.type===`space`);i.loose=t.length>0&&t.some(e=>this.rules.other.anyLine.test(e.raw))}if(i.loose)for(let e=0;e<i.items.length;e++)i.items[e].loose=!0;return i}}html(e){let t=this.rules.block.html.exec(e);if(t)return{type:`html`,block:!0,raw:t[0],pre:t[1]===`pre`||t[1]===`script`||t[1]===`style`,text:t[0]}}def(e){let t=this.rules.block.def.exec(e);if(t){let e=t[1].toLowerCase().replace(this.rules.other.multipleSpaceGlobal,` `),n=t[2]?t[2].replace(this.rules.other.hrefBrackets,`$1`).replace(this.rules.inline.anyPunctuation,`$1`):``,r=t[3]?t[3].substring(1,t[3].length-1).replace(this.rules.inline.anyPunctuation,`$1`):t[3];return{type:`def`,tag:e,raw:t[0],href:n,title:r}}}table(e){let t=this.rules.block.table.exec(e);if(!t||!this.rules.other.tableDelimiter.test(t[2]))return;let n=Wt(t[1]),r=t[2].replace(this.rules.other.tableAlignChars,``).split(`|`),i=t[3]?.trim()?t[3].replace(this.rules.other.tableRowBlankLine,``).split(`
26
- `):[],a={type:`table`,raw:t[0],header:[],align:[],rows:[]};if(n.length===r.length){for(let e of r)this.rules.other.tableAlignRight.test(e)?a.align.push(`right`):this.rules.other.tableAlignCenter.test(e)?a.align.push(`center`):this.rules.other.tableAlignLeft.test(e)?a.align.push(`left`):a.align.push(null);for(let e=0;e<n.length;e++)a.header.push({text:n[e],tokens:this.lexer.inline(n[e]),header:!0,align:a.align[e]});for(let e of i)a.rows.push(Wt(e,a.header.length).map((e,t)=>({text:e,tokens:this.lexer.inline(e),header:!1,align:a.align[t]})));return a}}lheading(e){let t=this.rules.block.lheading.exec(e);if(t)return{type:`heading`,raw:t[0],depth:t[2].charAt(0)===`=`?1:2,text:t[1],tokens:this.lexer.inline(t[1])}}paragraph(e){let t=this.rules.block.paragraph.exec(e);if(t){let e=t[1].charAt(t[1].length-1)===`
27
- `?t[1].slice(0,-1):t[1];return{type:`paragraph`,raw:t[0],text:e,tokens:this.lexer.inline(e)}}}text(e){let t=this.rules.block.text.exec(e);if(t)return{type:`text`,raw:t[0],text:t[0],tokens:this.lexer.inline(t[0])}}escape(e){let t=this.rules.inline.escape.exec(e);if(t)return{type:`escape`,raw:t[0],text:t[1]}}tag(e){let t=this.rules.inline.tag.exec(e);if(t)return!this.lexer.state.inLink&&this.rules.other.startATag.test(t[0])?this.lexer.state.inLink=!0:this.lexer.state.inLink&&this.rules.other.endATag.test(t[0])&&(this.lexer.state.inLink=!1),!this.lexer.state.inRawBlock&&this.rules.other.startPreScriptTag.test(t[0])?this.lexer.state.inRawBlock=!0:this.lexer.state.inRawBlock&&this.rules.other.endPreScriptTag.test(t[0])&&(this.lexer.state.inRawBlock=!1),{type:`html`,raw:t[0],inLink:this.lexer.state.inLink,inRawBlock:this.lexer.state.inRawBlock,block:!1,text:t[0]}}link(e){let t=this.rules.inline.link.exec(e);if(t){let e=t[2].trim();if(!this.options.pedantic&&this.rules.other.startAngleBracket.test(e)){if(!this.rules.other.endAngleBracket.test(e))return;let t=Gt(e.slice(0,-1),`\\`);if((e.length-t.length)%2==0)return}else{let e=Kt(t[2],`()`);if(e===-2)return;if(e>-1){let n=(t[0].indexOf(`!`)===0?5:4)+t[1].length+e;t[2]=t[2].substring(0,e),t[0]=t[0].substring(0,n).trim(),t[3]=``}}let n=t[2],r=``;if(this.options.pedantic){let e=this.rules.other.pedanticHrefTitle.exec(n);e&&(n=e[1],r=e[3])}else r=t[3]?t[3].slice(1,-1):``;return n=n.trim(),this.rules.other.startAngleBracket.test(n)&&(n=this.options.pedantic&&!this.rules.other.endAngleBracket.test(e)?n.slice(1):n.slice(1,-1)),qt(t,{href:n&&n.replace(this.rules.inline.anyPunctuation,`$1`),title:r&&r.replace(this.rules.inline.anyPunctuation,`$1`)},t[0],this.lexer,this.rules)}}reflink(e,t){let n;if((n=this.rules.inline.reflink.exec(e))||(n=this.rules.inline.nolink.exec(e))){let e=t[(n[2]||n[1]).replace(this.rules.other.multipleSpaceGlobal,` `).toLowerCase()];if(!e){let e=n[0].charAt(0);return{type:`text`,raw:e,text:e}}return qt(n,e,n[0],this.lexer,this.rules)}}emStrong(e,t,n=``){let r=this.rules.inline.emStrongLDelim.exec(e);if(r&&!(r[3]&&n.match(this.rules.other.unicodeAlphaNumeric))&&(!(r[1]||r[2])||!n||this.rules.inline.punctuation.exec(n))){let n=[...r[0]].length-1,i,a,o=n,s=0,c=r[0][0]===`*`?this.rules.inline.emStrongRDelimAst:this.rules.inline.emStrongRDelimUnd;for(c.lastIndex=0,t=t.slice(-1*e.length+n);(r=c.exec(t))!=null;){if(i=r[1]||r[2]||r[3]||r[4]||r[5]||r[6],!i)continue;if(a=[...i].length,r[3]||r[4]){o+=a;continue}else if((r[5]||r[6])&&n%3&&!((n+a)%3)){s+=a;continue}if(o-=a,o>0)continue;a=Math.min(a,a+o+s);let t=[...r[0]][0].length,c=e.slice(0,n+r.index+t+a);if(Math.min(n,a)%2){let e=c.slice(1,-1);return{type:`em`,raw:c,text:e,tokens:this.lexer.inlineTokens(e)}}let l=c.slice(2,-2);return{type:`strong`,raw:c,text:l,tokens:this.lexer.inlineTokens(l)}}}}codespan(e){let t=this.rules.inline.code.exec(e);if(t){let e=t[2].replace(this.rules.other.newLineCharGlobal,` `),n=this.rules.other.nonSpaceChar.test(e),r=this.rules.other.startingSpaceChar.test(e)&&this.rules.other.endingSpaceChar.test(e);return n&&r&&(e=e.substring(1,e.length-1)),{type:`codespan`,raw:t[0],text:e}}}br(e){let t=this.rules.inline.br.exec(e);if(t)return{type:`br`,raw:t[0]}}del(e){let t=this.rules.inline.del.exec(e);if(t)return{type:`del`,raw:t[0],text:t[2],tokens:this.lexer.inlineTokens(t[2])}}autolink(e){let t=this.rules.inline.autolink.exec(e);if(t){let e,n;return t[2]===`@`?(e=t[1],n=`mailto:`+e):(e=t[1],n=e),{type:`link`,raw:t[0],text:e,href:n,tokens:[{type:`text`,raw:e,text:e}]}}}url(e){let t;if(t=this.rules.inline.url.exec(e)){let e,n;if(t[2]===`@`)e=t[0],n=`mailto:`+e;else{let r;do r=t[0],t[0]=this.rules.inline._backpedal.exec(t[0])?.[0]??``;while(r!==t[0]);e=t[0],n=t[1]===`www.`?`http://`+t[0]:t[0]}return{type:`link`,raw:t[0],text:e,href:n,tokens:[{type:`text`,raw:e,text:e}]}}}inlineText(e){let t=this.rules.inline.text.exec(e);if(t){let e=this.lexer.state.inRawBlock;return{type:`text`,raw:t[0],text:t[0],escaped:e}}}},Y=class e{tokens;options;state;tokenizer;inlineQueue;constructor(e){this.tokens=[],this.tokens.links=Object.create(null),this.options=e||k,this.options.tokenizer=this.options.tokenizer||new Yt,this.tokenizer=this.options.tokenizer,this.tokenizer.options=this.options,this.tokenizer.lexer=this,this.inlineQueue=[],this.state={inLink:!1,inRawBlock:!1,top:!0};let t={other:M,block:zt.normal,inline:Bt.normal};this.options.pedantic?(t.block=zt.pedantic,t.inline=Bt.pedantic):this.options.gfm&&(t.block=zt.gfm,this.options.breaks?t.inline=Bt.breaks:t.inline=Bt.gfm),this.tokenizer.rules=t}static get rules(){return{block:zt,inline:Bt}}static lex(t,n){return new e(n).lex(t)}static lexInline(t,n){return new e(n).inlineTokens(t)}lex(e){e=e.replace(M.carriageReturn,`
28
- `),this.blockTokens(e,this.tokens);for(let e=0;e<this.inlineQueue.length;e++){let t=this.inlineQueue[e];this.inlineTokens(t.src,t.tokens)}return this.inlineQueue=[],this.tokens}blockTokens(e,t=[],n=!1){for(this.options.pedantic&&(e=e.replace(M.tabCharGlobal,` `).replace(M.spaceLine,``));e;){let r;if(this.options.extensions?.block?.some(n=>(r=n.call({lexer:this},e,t))?(e=e.substring(r.raw.length),t.push(r),!0):!1))continue;if(r=this.tokenizer.space(e)){e=e.substring(r.raw.length);let n=t.at(-1);r.raw.length===1&&n!==void 0?n.raw+=`
29
- `:t.push(r);continue}if(r=this.tokenizer.code(e)){e=e.substring(r.raw.length);let n=t.at(-1);n?.type===`paragraph`||n?.type===`text`?(n.raw+=`
30
- `+r.raw,n.text+=`
31
- `+r.text,this.inlineQueue.at(-1).src=n.text):t.push(r);continue}if(r=this.tokenizer.fences(e)){e=e.substring(r.raw.length),t.push(r);continue}if(r=this.tokenizer.heading(e)){e=e.substring(r.raw.length),t.push(r);continue}if(r=this.tokenizer.hr(e)){e=e.substring(r.raw.length),t.push(r);continue}if(r=this.tokenizer.blockquote(e)){e=e.substring(r.raw.length),t.push(r);continue}if(r=this.tokenizer.list(e)){e=e.substring(r.raw.length),t.push(r);continue}if(r=this.tokenizer.html(e)){e=e.substring(r.raw.length),t.push(r);continue}if(r=this.tokenizer.def(e)){e=e.substring(r.raw.length);let n=t.at(-1);n?.type===`paragraph`||n?.type===`text`?(n.raw+=`
32
- `+r.raw,n.text+=`
33
- `+r.raw,this.inlineQueue.at(-1).src=n.text):this.tokens.links[r.tag]||(this.tokens.links[r.tag]={href:r.href,title:r.title});continue}if(r=this.tokenizer.table(e)){e=e.substring(r.raw.length),t.push(r);continue}if(r=this.tokenizer.lheading(e)){e=e.substring(r.raw.length),t.push(r);continue}let i=e;if(this.options.extensions?.startBlock){let t=1/0,n=e.slice(1),r;this.options.extensions.startBlock.forEach(e=>{r=e.call({lexer:this},n),typeof r==`number`&&r>=0&&(t=Math.min(t,r))}),t<1/0&&t>=0&&(i=e.substring(0,t+1))}if(this.state.top&&(r=this.tokenizer.paragraph(i))){let a=t.at(-1);n&&a?.type===`paragraph`?(a.raw+=`
34
- `+r.raw,a.text+=`
35
- `+r.text,this.inlineQueue.pop(),this.inlineQueue.at(-1).src=a.text):t.push(r),n=i.length!==e.length,e=e.substring(r.raw.length);continue}if(r=this.tokenizer.text(e)){e=e.substring(r.raw.length);let n=t.at(-1);n?.type===`text`?(n.raw+=`
36
- `+r.raw,n.text+=`
37
- `+r.text,this.inlineQueue.pop(),this.inlineQueue.at(-1).src=n.text):t.push(r);continue}if(e){let t=`Infinite loop on byte: `+e.charCodeAt(0);if(this.options.silent){console.error(t);break}else throw Error(t)}}return this.state.top=!0,t}inline(e,t=[]){return this.inlineQueue.push({src:e,tokens:t}),t}inlineTokens(e,t=[]){let n=e,r=null;if(this.tokens.links){let e=Object.keys(this.tokens.links);if(e.length>0)for(;(r=this.tokenizer.rules.inline.reflinkSearch.exec(n))!=null;)e.includes(r[0].slice(r[0].lastIndexOf(`[`)+1,-1))&&(n=n.slice(0,r.index)+`[`+`a`.repeat(r[0].length-2)+`]`+n.slice(this.tokenizer.rules.inline.reflinkSearch.lastIndex))}for(;(r=this.tokenizer.rules.inline.anyPunctuation.exec(n))!=null;)n=n.slice(0,r.index)+`++`+n.slice(this.tokenizer.rules.inline.anyPunctuation.lastIndex);for(;(r=this.tokenizer.rules.inline.blockSkip.exec(n))!=null;)n=n.slice(0,r.index)+`[`+`a`.repeat(r[0].length-2)+`]`+n.slice(this.tokenizer.rules.inline.blockSkip.lastIndex);let i=!1,a=``;for(;e;){i||(a=``),i=!1;let r;if(this.options.extensions?.inline?.some(n=>(r=n.call({lexer:this},e,t))?(e=e.substring(r.raw.length),t.push(r),!0):!1))continue;if(r=this.tokenizer.escape(e)){e=e.substring(r.raw.length),t.push(r);continue}if(r=this.tokenizer.tag(e)){e=e.substring(r.raw.length),t.push(r);continue}if(r=this.tokenizer.link(e)){e=e.substring(r.raw.length),t.push(r);continue}if(r=this.tokenizer.reflink(e,this.tokens.links)){e=e.substring(r.raw.length);let n=t.at(-1);r.type===`text`&&n?.type===`text`?(n.raw+=r.raw,n.text+=r.text):t.push(r);continue}if(r=this.tokenizer.emStrong(e,n,a)){e=e.substring(r.raw.length),t.push(r);continue}if(r=this.tokenizer.codespan(e)){e=e.substring(r.raw.length),t.push(r);continue}if(r=this.tokenizer.br(e)){e=e.substring(r.raw.length),t.push(r);continue}if(r=this.tokenizer.del(e)){e=e.substring(r.raw.length),t.push(r);continue}if(r=this.tokenizer.autolink(e)){e=e.substring(r.raw.length),t.push(r);continue}if(!this.state.inLink&&(r=this.tokenizer.url(e))){e=e.substring(r.raw.length),t.push(r);continue}let o=e;if(this.options.extensions?.startInline){let t=1/0,n=e.slice(1),r;this.options.extensions.startInline.forEach(e=>{r=e.call({lexer:this},n),typeof r==`number`&&r>=0&&(t=Math.min(t,r))}),t<1/0&&t>=0&&(o=e.substring(0,t+1))}if(r=this.tokenizer.inlineText(o)){e=e.substring(r.raw.length),r.raw.slice(-1)!==`_`&&(a=r.raw.slice(-1)),i=!0;let n=t.at(-1);n?.type===`text`?(n.raw+=r.raw,n.text+=r.text):t.push(r);continue}if(e){let t=`Infinite loop on byte: `+e.charCodeAt(0);if(this.options.silent){console.error(t);break}else throw Error(t)}}return t}},Xt=class{options;parser;constructor(e){this.options=e||k}space(e){return``}code({text:e,lang:t,escaped:n}){let r=(t||``).match(M.notSpaceStart)?.[0],i=e.replace(M.endingNewline,``)+`
38
- `;return r?`<pre><code class="language-`+J(r)+`">`+(n?i:J(i,!0))+`</code></pre>
39
- `:`<pre><code>`+(n?i:J(i,!0))+`</code></pre>
40
- `}blockquote({tokens:e}){return`<blockquote>
41
- ${this.parser.parse(e)}</blockquote>
42
- `}html({text:e}){return e}heading({tokens:e,depth:t}){return`<h${t}>${this.parser.parseInline(e)}</h${t}>
43
- `}hr(e){return`<hr>
44
- `}list(e){let t=e.ordered,n=e.start,r=``;for(let t=0;t<e.items.length;t++){let n=e.items[t];r+=this.listitem(n)}let i=t?`ol`:`ul`,a=t&&n!==1?` start="`+n+`"`:``;return`<`+i+a+`>
45
- `+r+`</`+i+`>
46
- `}listitem(e){let t=``;if(e.task){let n=this.checkbox({checked:!!e.checked});e.loose?e.tokens[0]?.type===`paragraph`?(e.tokens[0].text=n+` `+e.tokens[0].text,e.tokens[0].tokens&&e.tokens[0].tokens.length>0&&e.tokens[0].tokens[0].type===`text`&&(e.tokens[0].tokens[0].text=n+` `+J(e.tokens[0].tokens[0].text),e.tokens[0].tokens[0].escaped=!0)):e.tokens.unshift({type:`text`,raw:n+` `,text:n+` `,escaped:!0}):t+=n+` `}return t+=this.parser.parse(e.tokens,!!e.loose),`<li>${t}</li>
47
- `}checkbox({checked:e}){return`<input `+(e?`checked="" `:``)+`disabled="" type="checkbox">`}paragraph({tokens:e}){return`<p>${this.parser.parseInline(e)}</p>
48
- `}table(e){let t=``,n=``;for(let t=0;t<e.header.length;t++)n+=this.tablecell(e.header[t]);t+=this.tablerow({text:n});let r=``;for(let t=0;t<e.rows.length;t++){let i=e.rows[t];n=``;for(let e=0;e<i.length;e++)n+=this.tablecell(i[e]);r+=this.tablerow({text:n})}return r&&=`<tbody>${r}</tbody>`,`<table>
49
- <thead>
50
- `+t+`</thead>
51
- `+r+`</table>
52
- `}tablerow({text:e}){return`<tr>
53
- ${e}</tr>
54
- `}tablecell(e){let t=this.parser.parseInline(e.tokens),n=e.header?`th`:`td`;return(e.align?`<${n} align="${e.align}">`:`<${n}>`)+t+`</${n}>
55
- `}strong({tokens:e}){return`<strong>${this.parser.parseInline(e)}</strong>`}em({tokens:e}){return`<em>${this.parser.parseInline(e)}</em>`}codespan({text:e}){return`<code>${J(e,!0)}</code>`}br(e){return`<br>`}del({tokens:e}){return`<del>${this.parser.parseInline(e)}</del>`}link({href:e,title:t,tokens:n}){let r=this.parser.parseInline(n),i=Ut(e);if(i===null)return r;e=i;let a=`<a href="`+e+`"`;return t&&(a+=` title="`+J(t)+`"`),a+=`>`+r+`</a>`,a}image({href:e,title:t,text:n,tokens:r}){r&&(n=this.parser.parseInline(r,this.parser.textRenderer));let i=Ut(e);if(i===null)return J(n);e=i;let a=`<img src="${e}" alt="${n}"`;return t&&(a+=` title="${J(t)}"`),a+=`>`,a}text(e){return`tokens`in e&&e.tokens?this.parser.parseInline(e.tokens):`escaped`in e&&e.escaped?e.text:J(e.text)}},Zt=class{strong({text:e}){return e}em({text:e}){return e}codespan({text:e}){return e}del({text:e}){return e}html({text:e}){return e}text({text:e}){return e}link({text:e}){return``+e}image({text:e}){return``+e}br(){return``}},X=class e{options;renderer;textRenderer;constructor(e){this.options=e||k,this.options.renderer=this.options.renderer||new Xt,this.renderer=this.options.renderer,this.renderer.options=this.options,this.renderer.parser=this,this.textRenderer=new Zt}static parse(t,n){return new e(n).parse(t)}static parseInline(t,n){return new e(n).parseInline(t)}parse(e,t=!0){let n=``;for(let r=0;r<e.length;r++){let i=e[r];if(this.options.extensions?.renderers?.[i.type]){let e=i,t=this.options.extensions.renderers[e.type].call({parser:this},e);if(t!==!1||![`space`,`hr`,`heading`,`code`,`table`,`blockquote`,`list`,`html`,`paragraph`,`text`].includes(e.type)){n+=t||``;continue}}let a=i;switch(a.type){case`space`:n+=this.renderer.space(a);continue;case`hr`:n+=this.renderer.hr(a);continue;case`heading`:n+=this.renderer.heading(a);continue;case`code`:n+=this.renderer.code(a);continue;case`table`:n+=this.renderer.table(a);continue;case`blockquote`:n+=this.renderer.blockquote(a);continue;case`list`:n+=this.renderer.list(a);continue;case`html`:n+=this.renderer.html(a);continue;case`paragraph`:n+=this.renderer.paragraph(a);continue;case`text`:{let i=a,o=this.renderer.text(i);for(;r+1<e.length&&e[r+1].type===`text`;)i=e[++r],o+=`
56
- `+this.renderer.text(i);t?n+=this.renderer.paragraph({type:`paragraph`,raw:o,text:o,tokens:[{type:`text`,raw:o,text:o,escaped:!0}]}):n+=o;continue}default:{let e=`Token with "`+a.type+`" type was not found.`;if(this.options.silent)return console.error(e),``;throw Error(e)}}}return n}parseInline(e,t=this.renderer){let n=``;for(let r=0;r<e.length;r++){let i=e[r];if(this.options.extensions?.renderers?.[i.type]){let e=this.options.extensions.renderers[i.type].call({parser:this},i);if(e!==!1||![`escape`,`html`,`link`,`image`,`strong`,`em`,`codespan`,`br`,`del`,`text`].includes(i.type)){n+=e||``;continue}}let a=i;switch(a.type){case`escape`:n+=t.text(a);break;case`html`:n+=t.html(a);break;case`link`:n+=t.link(a);break;case`image`:n+=t.image(a);break;case`strong`:n+=t.strong(a);break;case`em`:n+=t.em(a);break;case`codespan`:n+=t.codespan(a);break;case`br`:n+=t.br(a);break;case`del`:n+=t.del(a);break;case`text`:n+=t.text(a);break;default:{let e=`Token with "`+a.type+`" type was not found.`;if(this.options.silent)return console.error(e),``;throw Error(e)}}}return n}},Qt=class{options;block;constructor(e){this.options=e||k}static passThroughHooks=new Set([`preprocess`,`postprocess`,`processAllTokens`]);preprocess(e){return e}postprocess(e){return e}processAllTokens(e){return e}provideLexer(){return this.block?Y.lex:Y.lexInline}provideParser(){return this.block?X.parse:X.parseInline}},$t=class{defaults=O();options=this.setOptions;parse=this.parseMarkdown(!0);parseInline=this.parseMarkdown(!1);Parser=X;Renderer=Xt;TextRenderer=Zt;Lexer=Y;Tokenizer=Yt;Hooks=Qt;constructor(...e){this.use(...e)}walkTokens(e,t){let n=[];for(let r of e)switch(n=n.concat(t.call(this,r)),r.type){case`table`:{let e=r;for(let r of e.header)n=n.concat(this.walkTokens(r.tokens,t));for(let r of e.rows)for(let e of r)n=n.concat(this.walkTokens(e.tokens,t));break}case`list`:{let e=r;n=n.concat(this.walkTokens(e.items,t));break}default:{let e=r;this.defaults.extensions?.childTokens?.[e.type]?this.defaults.extensions.childTokens[e.type].forEach(r=>{let i=e[r].flat(1/0);n=n.concat(this.walkTokens(i,t))}):e.tokens&&(n=n.concat(this.walkTokens(e.tokens,t)))}}return n}use(...e){let t=this.defaults.extensions||{renderers:{},childTokens:{}};return e.forEach(e=>{let n={...e};if(n.async=this.defaults.async||n.async||!1,e.extensions&&(e.extensions.forEach(e=>{if(!e.name)throw Error(`extension name required`);if(`renderer`in e){let n=t.renderers[e.name];n?t.renderers[e.name]=function(...t){let r=e.renderer.apply(this,t);return r===!1&&(r=n.apply(this,t)),r}:t.renderers[e.name]=e.renderer}if(`tokenizer`in e){if(!e.level||e.level!==`block`&&e.level!==`inline`)throw Error(`extension level must be 'block' or 'inline'`);let n=t[e.level];n?n.unshift(e.tokenizer):t[e.level]=[e.tokenizer],e.start&&(e.level===`block`?t.startBlock?t.startBlock.push(e.start):t.startBlock=[e.start]:e.level===`inline`&&(t.startInline?t.startInline.push(e.start):t.startInline=[e.start]))}`childTokens`in e&&e.childTokens&&(t.childTokens[e.name]=e.childTokens)}),n.extensions=t),e.renderer){let t=this.defaults.renderer||new Xt(this.defaults);for(let n in e.renderer){if(!(n in t))throw Error(`renderer '${n}' does not exist`);if([`options`,`parser`].includes(n))continue;let r=n,i=e.renderer[r],a=t[r];t[r]=(...e)=>{let n=i.apply(t,e);return n===!1&&(n=a.apply(t,e)),n||``}}n.renderer=t}if(e.tokenizer){let t=this.defaults.tokenizer||new Yt(this.defaults);for(let n in e.tokenizer){if(!(n in t))throw Error(`tokenizer '${n}' does not exist`);if([`options`,`rules`,`lexer`].includes(n))continue;let r=n,i=e.tokenizer[r],a=t[r];t[r]=(...e)=>{let n=i.apply(t,e);return n===!1&&(n=a.apply(t,e)),n}}n.tokenizer=t}if(e.hooks){let t=this.defaults.hooks||new Qt;for(let n in e.hooks){if(!(n in t))throw Error(`hook '${n}' does not exist`);if([`options`,`block`].includes(n))continue;let r=n,i=e.hooks[r],a=t[r];Qt.passThroughHooks.has(n)?t[r]=e=>{if(this.defaults.async)return Promise.resolve(i.call(t,e)).then(e=>a.call(t,e));let n=i.call(t,e);return a.call(t,n)}:t[r]=(...e)=>{let n=i.apply(t,e);return n===!1&&(n=a.apply(t,e)),n}}n.hooks=t}if(e.walkTokens){let t=this.defaults.walkTokens,r=e.walkTokens;n.walkTokens=function(e){let n=[];return n.push(r.call(this,e)),t&&(n=n.concat(t.call(this,e))),n}}this.defaults={...this.defaults,...n}}),this}setOptions(e){return this.defaults={...this.defaults,...e},this}lexer(e,t){return Y.lex(e,t??this.defaults)}parser(e,t){return X.parse(e,t??this.defaults)}parseMarkdown(e){return(t,n)=>{let r={...n},i={...this.defaults,...r},a=this.onError(!!i.silent,!!i.async);if(this.defaults.async===!0&&r.async===!1)return a(Error(`marked(): The async option was set to true by an extension. Remove async: false from the parse options object to return a Promise.`));if(t==null)return a(Error(`marked(): input parameter is undefined or null`));if(typeof t!=`string`)return a(Error(`marked(): input parameter is of type `+Object.prototype.toString.call(t)+`, string expected`));i.hooks&&(i.hooks.options=i,i.hooks.block=e);let o=i.hooks?i.hooks.provideLexer():e?Y.lex:Y.lexInline,s=i.hooks?i.hooks.provideParser():e?X.parse:X.parseInline;if(i.async)return Promise.resolve(i.hooks?i.hooks.preprocess(t):t).then(e=>o(e,i)).then(e=>i.hooks?i.hooks.processAllTokens(e):e).then(e=>i.walkTokens?Promise.all(this.walkTokens(e,i.walkTokens)).then(()=>e):e).then(e=>s(e,i)).then(e=>i.hooks?i.hooks.postprocess(e):e).catch(a);try{i.hooks&&(t=i.hooks.preprocess(t));let e=o(t,i);i.hooks&&(e=i.hooks.processAllTokens(e)),i.walkTokens&&this.walkTokens(e,i.walkTokens);let n=s(e,i);return i.hooks&&(n=i.hooks.postprocess(n)),n}catch(e){return a(e)}}}onError(e,t){return n=>{if(n.message+=`
57
- Please report this to https://github.com/markedjs/marked.`,e){let e=`<p>An error occurred:</p><pre>`+J(n.message+``,!0)+`</pre>`;return t?Promise.resolve(e):e}if(t)return Promise.reject(n);throw n}}},en=new $t;function Z(e,t){return en.parse(e,t)}Z.options=Z.setOptions=function(e){return en.setOptions(e),Z.defaults=en.defaults,et(Z.defaults),Z},Z.getDefaults=O,Z.defaults=k,Z.use=function(...e){return en.use(...e),Z.defaults=en.defaults,et(Z.defaults),Z},Z.walkTokens=function(e,t){return en.walkTokens(e,t)},Z.parseInline=en.parseInline,Z.Parser=X,Z.parser=X.parse,Z.Renderer=Xt,Z.TextRenderer=Zt,Z.Lexer=Y,Z.lexer=Y.lex,Z.Tokenizer=Yt,Z.Hooks=Qt,Z.parse=Z,Z.options,Z.setOptions,Z.use,Z.walkTokens,Z.parseInline,X.parse,Y.lex;var tn=e=>(Object.getOwnPropertyNames(e).forEach(t=>{let n=e[t];n&&typeof n==`object`&&tn(n)}),Object.freeze(e)),nn=tn({all:[],used:[],unused:[]}),rn=(e,t)=>{let n=D(e);return n.addHook(`uponSanitizeElement`,function(e,t){let n=t.tagName||e.nodeName.toLowerCase();n.startsWith(`liipgpt-`)&&(t.allowedTags[n]=!0)}),n.addHook(`afterSanitizeAttributes`,function(e){if(e.tagName!==`A`||!e.getAttribute(`href`)?.startsWith(`http`)||(e.setAttribute(`target`,`_blank`),e.setAttribute(`rel`,`noopener noreferrer`),!t||e.querySelector(`.sr-only`)))return;let n=e.ownerDocument.createElement(`span`);n.className=`sr-only`,n.textContent=` ${t}`,e.appendChild(n)}),n},an=class{marked;currentReferences=nn;lastUsedIndex=0;DomPurity;constructor(e={}){this.marked=new $t({async:!1,breaks:!0}).use(this.createFootnoteExtension(),...e.extensions??[]),this.DomPurity=rn(e.window,e.newTabSrText)}createFootnoteExtension=()=>{let e=this;return{extensions:[{name:`footnote`,level:`inline`,start(e){return e.match(/\[\^(\d+)\]/)?.index},tokenizer(e){let t=/^\[\^(\d+)\]/.exec(e);if(t){let[e,n]=t;return{type:`footnote`,raw:e,refNumber:n}}},renderer(t){if(t.type===`footnote`){let n=parseInt(t.refNumber)-1,r=e.currentReferences.all[n];if(!r)return console.error(`Could not find ref with index:`,n),``;let i;return r?.referenceIndex.used?i=r.referenceIndex.used:(e.currentReferences.used.push(r),e.lastUsedIndex++,i=e.lastUsedIndex,r.referenceIndex.used=i),` <liipgpt-reference-number data-all-index="${n}" data-used-index="${i}" data-source="${JSON.stringify(r).replace(/"/g,`&quot;`)}"></liipgpt-reference-number>`}}}]}};parse(e){return this.DomPurity.sanitize(this.marked.parse(e),{USE_PROFILES:{html:!0,svg:!0,svgFilters:!0,mathMl:!0},FORBID_TAGS:[`hr`],ADD_ATTR:[`target`]})}toHTML(e,t){this.currentReferences=t;let n=this.parse(e);return this.currentReferences=nn,n}};function on(){let e,t;return{promise:new Promise((n,r)=>{t=n,e=r}),reject:e,resolve:t}}var sn=class{promise;resolve;reject;constructor(){let{promise:e,resolve:t,reject:n}=on();this.promise=e,this.resolve=t,this.reject=n}then(e,t){return this.promise.then(e,t)}catch(e){return this.promise.catch(e)}finally(e){return this.promise.finally(e)}toPromise(){return this.promise}[Symbol.toStringTag]=`Flag`},cn=class{hasValue=new sn;currentValue;setValue(e){this.currentValue=e,this.hasValue.resolve()}cleanup(e){this.hasValue.reject(e)}getCurrentValue(){return this.currentValue}async toPromise(){return await this.hasValue,this.currentValue}then(e,t){return this.toPromise().then(e,t)}catch(e){return this.toPromise().catch(e)}finally(e){return this.toPromise().finally(e)}[Symbol.toStringTag]=`FutureValue`},ln=e=>{try{return new URL(e).hostname}catch{return e}};function un(e){return e.replace(/<[^>]*>/g,``).replace(/&nbsp;/g,` `).replace(/&amp;/g,`&`).replace(/&lt;/g,`<`).replace(/&gt;/g,`>`).replace(/&quot;/g,`"`)}var dn=({url:e,considered:t,title:n,description:r,summary:i})=>{let a=ln(e);return{url:e,considered:t,referenceIndex:{},score:0,metadata:{},display:{card:{title:n,description:r||i,badge:e},listItem:{title:n,badge:a}}}},fn=class{store;content=new cn;backendSendsMappedRefs=!1;constructor(e){this.options=e,this.store=n({id:e.id,state:`loading`,errors:[],type:`bot`,time:new Date().toISOString(),message:{markdown:``,html:``,text:``},references:{all:[],used:[],unused:[]},retrievalQuestion:e.userQuestion})}pushError(e){this.options.onError?.(e),this.store.update(t=>({...t,errors:[...t.errors,e]}))}updateRequestId(e){this.store.update(t=>({...t,id:e}))}updateText(e){this.store.update(t=>{let n=t.message.markdown+e,r=this.options.markdownRenderer.toHTML(n,t.references);return{...t,state:`streaming`,message:{markdown:n,html:r,text:``}}})}finishMessage(){this.store.update(e=>{let t={...e,state:`done`};return t.references.unused=t.references.all.filter(e=>e.referenceIndex.used===void 0),t.message.text=un(t.message.html),this.options?.onFinish?.(t),this.content.setValue(t),t})}addReference(e){this.store.update(t=>{let n=t.references.all,r=n.length,i=[...n,{...e,referenceIndex:{all:r}}];return{...t,references:{used:t.references.used,all:i}}})}addMappedReference(e){this.backendSendsMappedRefs=!0,this.addReference(e)}addOldReference(e){this.backendSendsMappedRefs||this.addReference(dn(e))}updateRetrievalQuestion(e){this.store.update(t=>({...t,retrievalQuestion:e}))}setNoFeedback(){this.store.update(e=>({...e,noFeedback:!0}))}getReadableStore(){return{subscribe:this.store.subscribe}}getPromise(){return this.content.toPromise()}},pn=[{type:`email`,check:e=>/\b[a-zA-Z0-9._%+-]+@[a-zA-Z0-9.-]+\.[a-zA-Z]{2,}\b/.test(e)},{type:`creditCard`,check:e=>/\b(?:\d[ -]*?){13,16}\b/.test(e)},{type:`ahv`,check:e=>/\b756\.\d{4}\.\d{4}\.\d{2}\b/.test(e)},{type:`phoneSwiss`,check:e=>/\b0(?:\s*\d){2}(?:\s*\/\s*)?(?:\s*\d){7,}\b/.test(e)},{type:`phoneInternational`,check:e=>/(?:\+|00)(?:\s*\d){10,}\b/.test(e)},{type:`swissPassport`,check:e=>/\b[A-HJ-NP-Z](?=.*\d)[A-HJ-NP-Z0-9]{7}\b/.test(e)},{type:`longNumber`,check:e=>/\b\d{9,}\b/.test(e)}],mn=e=>{for(let t of pn)if(t.check(e))return t.type},hn=class{id;constructor(e){this.chatResponseData=e,this.id=this.chatResponseData.id}async isReadyForFeedback(){return await this.chatResponseData.readyForFeedback.toPromise(),!0}subscribe(e,t){return this.chatResponseData.readableStore.subscribe(e,t)}getContent(){return this.chatResponseData.content.toPromise()}abort(){return this.chatResponseData.abort()}async thumbsUp(){await this.isReadyForFeedback(),await this.chatResponseData.liipgptClientPrimitive.thumbsUp(this.id,this.chatResponseData.question)}async thumbsDown(){await this.isReadyForFeedback(),await this.chatResponseData.liipgptClientPrimitive.thumbsDown(this.id,this.chatResponseData.question)}async feedback(e){await this.isReadyForFeedback(),await this.chatResponseData.liipgptClientPrimitive.feedback(this.id,this.chatResponseData.question,e)}},gn=class{latestRequest=new cn;state=n({state:`idle`});id;history=[];constructor(e){this.clientPrimitive=e,this.id=e.createConversationId()}subscribe(e){return this.state.subscribe(e)}chat(e,t={}){let n=this.clientPrimitive.chat(this.id,e,t);return this.history.push(n),this.latestRequest.setValue({question:e,response:n}),n}async abort(){let e=this.history.map(e=>e.abort());await Promise.all(e)}async thumbsUp(){let{question:e,response:t}=await this.latestRequest;await t.isReadyForFeedback(),await this.clientPrimitive.thumbsUp(t.id,e)}async thumbsDown(){let{question:e,response:t}=await this.latestRequest;await t.isReadyForFeedback(),await this.clientPrimitive.thumbsDown(t.id,e)}async feedback(e){let{question:t,response:n}=await this.latestRequest;await n.isReadyForFeedback(),await this.clientPrimitive.feedback(n.id,t,e)}},Q=[];for(let e=0;e<256;++e)Q.push((e+256).toString(16).slice(1));function _n(e,t=0){return(Q[e[t+0]]+Q[e[t+1]]+Q[e[t+2]]+Q[e[t+3]]+`-`+Q[e[t+4]]+Q[e[t+5]]+`-`+Q[e[t+6]]+Q[e[t+7]]+`-`+Q[e[t+8]]+Q[e[t+9]]+`-`+Q[e[t+10]]+Q[e[t+11]]+Q[e[t+12]]+Q[e[t+13]]+Q[e[t+14]]+Q[e[t+15]]).toLowerCase()}var vn,yn=new Uint8Array(16);function bn(){if(!vn){if(typeof crypto>`u`||!crypto.getRandomValues)throw Error(`crypto.getRandomValues() not supported. See https://github.com/uuidjs/uuid#getrandomvalues-not-supported`);vn=crypto.getRandomValues.bind(crypto)}return vn(yn)}var xn={};function Sn(e,t,n){let r;if(e)r=wn(e.random??e.rng?.()??bn(),e.msecs,e.seq,t,n);else{let e=Date.now(),i=bn();Cn(xn,e,i),r=wn(i,xn.msecs,xn.seq,t,n)}return t??_n(r)}function Cn(e,t,n){return e.msecs??=-1/0,e.seq??=0,t>e.msecs?(e.seq=n[6]<<23|n[7]<<16|n[8]<<8|n[9],e.msecs=t):(e.seq=e.seq+1|0,e.seq===0&&e.msecs++),e}function wn(e,t,n,r,i=0){if(e.length<16)throw Error(`Random bytes length must be >= 16`);if(!r)r=new Uint8Array(16),i=0;else if(i<0||i+16>r.length)throw RangeError(`UUID byte range ${i}:${i+15} is out of buffer bounds`);return t??=Date.now(),n??=e[6]*127<<24|e[7]<<16|e[8]<<8|e[9],r[i++]=t/1099511627776&255,r[i++]=t/4294967296&255,r[i++]=t/16777216&255,r[i++]=t/65536&255,r[i++]=t/256&255,r[i++]=t&255,r[i++]=112|n>>>28&15,r[i++]=n>>>20&255,r[i++]=128|n>>>14&63,r[i++]=n>>>6&255,r[i++]=n<<2&255|e[10]&3,r[i++]=e[11],r[i++]=e[12],r[i++]=e[13],r[i++]=e[14],r[i++]=e[15],r}var Tn=new Map,En=class{get length(){return Tn.size}clear(){Tn.clear()}getItem(e){return Tn.get(e)||null}key(e){return Array.from(Tn.keys())[e]||null}removeItem(e){Tn.delete(e)}setItem(e,t){Tn.set(e,String(t))}},Dn=globalThis.localStorage??new En,On=async(e,t)=>{try{let n=Dn.getItem(`liipgpt:uID`)||Dn.getItem(`uID`),r={method:`POST`,headers:{Accept:`application/json`,"Content-Type":`application/json`},body:JSON.stringify({referrer:globalThis?.document?.referrer||null,uID:n,...t?{startParameters:t}:{}})},i=await e.fetchData(`/login`,re,{},r).catch(t=>(console.log(`Failed to /login use /log`,t),e.fetchData(`/log`,re,{},r)));if(`maintenance`in i&&i.maintenance)return{mode:`maintenance`};if(!(`id`in i))throw Error(`Invalid response format: missing user id`);return Dn.setItem(`liipgpt:uID`,i.id),{mode:`ready`,userId:i.id}}catch(e){throw console.error(`Failed to fetch user data:`,e),e}},$=function(e,t){if(!(this instanceof $))return new $(e,t);this.url=e,t||={},this.headers=t.headers||{},this.payload=t.payload===void 0?``:t.payload,this.method=t.method||this.payload&&`POST`||`GET`,this.withCredentials=!!t.withCredentials,this.debug=!!t.debug,this.autoReconnect=t.autoReconnect===void 0?!1:t.autoReconnect,this.reconnectDelay=t.reconnectDelay===void 0?3e3:t.reconnectDelay,this.maxRetries=t.maxRetries===void 0?null:t.maxRetries,this.retryCount=0,this.reconnectTimer=null,this.useLastEventId=t.useLastEventId===void 0?!0:t.useLastEventId,this.FIELD_SEPARATOR=`:`,this.listeners={},this.xhr=null,this.readyState=$.INITIALIZING,this.progress=0,this.chunk=``,this.lastEventId=``,this._hasParsedBom=!1,this.addEventListener=function(e,t){this.listeners[e]===void 0&&(this.listeners[e]=[]),this.listeners[e].indexOf(t)===-1&&this.listeners[e].push(t)},this.removeEventListener=function(e,t){if(this.listeners[e]===void 0)return;let n=[];this.listeners[e].forEach(function(e){e!==t&&n.push(e)}),n.length===0?delete this.listeners[e]:this.listeners[e]=n},this.dispatchEvent=function(e){if(!e)return!0;this.debug&&console.debug(e),e.source=this;let t=`on`+e.type;return this.hasOwnProperty(t)&&(this[t].call(this,e),e.defaultPrevented)?!1:this.listeners[e.type]?this.listeners[e.type].every(function(t){return t(e),!e.defaultPrevented}):!0},this._markClosed=function(){if(this.xhr=null,this.progress=0,this.chunk=``,this._setReadyState($.CLOSED),this.autoReconnect){if(this.maxRetries!==null&&this.retryCount>=this.maxRetries){this.debug&&console.debug(`SSE max retries (${this.maxRetries}) reached, stopping reconnection attempts`),this.autoReconnect=!1,this.close();return}this.reconnectTimer&&clearTimeout(this.reconnectTimer),this.debug&&console.debug(`SSE will attempt to reconnect in ${this.reconnectDelay}ms (attempt ${this.retryCount+1}${this.maxRetries?`/`+this.maxRetries:``})`),this.reconnectTimer=setTimeout(()=>{this.reconnectTimer=null,this.retryCount++,this.stream()},this.reconnectDelay)}},this._setReadyState=function(e){let t=new CustomEvent(`readystatechange`);t.readyState=e,this.readyState=e,this.dispatchEvent(t)},this._onStreamFailure=function(e){let t=new CustomEvent(`error`);t.responseCode=e.currentTarget.status,t.data=e.currentTarget.response,this.dispatchEvent(t),this._markClosed()},this._onStreamAbort=function(){this.dispatchEvent(new CustomEvent(`abort`)),this._markClosed()},this._onStreamProgress=function(e){if(!this.xhr)return;if(this.xhr.status<200||this.xhr.status>=300){this._onStreamFailure(e);return}this.retryCount=0;let t=this.xhr.responseText.substring(this.progress);this.progress+=t.length,!this._hasParsedBom&&this.chunk.length===0&&(t.charCodeAt(0)===65279&&(t=t.substring(1)),this._hasParsedBom=!0);let n=(this.chunk+t).split(/(\r\n\r\n|\r\r|\n\n)/g),r=n.pop();n.forEach(function(e){e.trim().length>0&&this.dispatchEvent(this._parseEventChunk(e))}.bind(this)),this.chunk=r},this._onStreamLoaded=function(e){this._onStreamProgress(e),this.dispatchEvent(this._parseEventChunk(this.chunk)),this.chunk=``,this._markClosed()},this._parseEventChunk=function(e){if(!e||e.length===0)return null;this.debug&&console.debug(e);let t={id:null,retry:null,data:null,event:null};if(e.split(/\n|\r\n|\r/).forEach(function(e){let n=e.indexOf(this.FIELD_SEPARATOR),r,i;if(n>0){let t=e[n+1]===` `?2:1;r=e.substring(0,n),i=e.substring(n+t)}else if(n<0)r=e,i=``;else return;r in t&&(r===`data`&&t[r]!==null?t.data+=`
58
- `+i:t[r]=i)}.bind(this)),t.id!==null&&t.id.indexOf(`\0`)===-1&&(this.lastEventId=t.id),t.retry!==null&&/^[0-9]+$/.test(t.retry)&&(this.reconnectDelay=parseInt(t.retry,10)),t.data===null)return null;let n=new CustomEvent(t.event||`message`);return n.id=t.id,n.data=t.data||``,n.lastEventId=this.lastEventId,n},this._onReadyStateChange=function(){if(this.xhr&&this.xhr.readyState===XMLHttpRequest.HEADERS_RECEIVED){let e={},t=this.xhr.getAllResponseHeaders().trim().split(`\r
59
- `);for(let n of t){let[t,...r]=n.split(`:`),i=r.join(`:`).trim();e[t.trim().toLowerCase()]=e[t.trim().toLowerCase()]||[],e[t.trim().toLowerCase()].push(i)}let n=new CustomEvent(`open`);n.responseCode=this.xhr.status,n.headers=e,this.dispatchEvent(n),this._setReadyState($.OPEN)}},this.stream=function(){if(!this.xhr){this._setReadyState($.CONNECTING),this.xhr=new XMLHttpRequest,this.xhr.addEventListener(`progress`,this._onStreamProgress.bind(this)),this.xhr.addEventListener(`load`,this._onStreamLoaded.bind(this)),this.xhr.addEventListener(`readystatechange`,this._onReadyStateChange.bind(this)),this.xhr.addEventListener(`error`,this._onStreamFailure.bind(this)),this.xhr.addEventListener(`abort`,this._onStreamAbort.bind(this)),this.xhr.open(this.method,this.url);for(let e in this.headers)this.xhr.setRequestHeader(e,this.headers[e]);this.useLastEventId&&this.lastEventId.length>0&&this.xhr.setRequestHeader(`Last-Event-ID`,this.lastEventId),this.xhr.withCredentials=this.withCredentials,this.xhr.send(this.payload)}},this.close=function(){this.reconnectTimer&&=(clearTimeout(this.reconnectTimer),null),this.autoReconnect=!1,this.xhr&&this.xhr.abort()},(t.start===void 0||t.start)&&this.stream()};$.INITIALIZING=-1,$.CONNECTING=0,$.OPEN=1,$.CLOSED=2;var kn=class{eventSource;triggeredOnClose=!1;constructor(e,t,n){this.options=t,this.payload=n;let r={headers:{"content-type":`application/json`}};n&&(r.payload=JSON.stringify(n)),t.apiKey&&(r.headers[`api-key`]=t.apiKey),this.eventSource=new(t.EventSource??$)(e,r),this.eventSource.onmessage=e=>{try{let n=JSON.parse(e.data);t.onMessage(n)}catch(e){t.onError(new CustomEvent(`parse-error`,{detail:e}))}},this.eventSource.onerror=e=>{t.onError(e),this.isClosed()&&this.close()}}isClosed(){return this.eventSource.readyState===EventSource.CLOSED}close(){this.isClosed()||this.eventSource.close(),this.triggeredOnClose||(this.triggeredOnClose=!0,this.options.onClose())}},An=e=>Object.fromEntries(Object.entries(e).filter(([e,t])=>t!=null)),jn=class{constructor(e){this.options=e}getDefaultHeaders(e={}){let t={"Content-Type":`application/json`,...e};return this.options.apiKey&&(t[`api-key`]=this.options.apiKey),t}get speechRecognitionApiKey(){return this.options.speechRecognitionApiKey}async subscribeSse(e,t={},n){let r=An(t);return this.options.apiKey&&(n.apiKey=this.options.apiKey),new kn(`${this.options.apiUrl}${e}`,n,r)}async fetchData(e,t,n={},r={}){let i=`${this.options.apiUrl}${e}?${new URLSearchParams(An(n)).toString()}`,a={...r,headers:this.getDefaultHeaders(r?.headers)},o=await fetch(i,a);if(!o.ok){let e=await o.text();throw Error(`API request failed: ${o.status} - ${e}`)}let s=await o.json(),{success:c,data:l,error:u}=t.safeParse(s);if(this.options.strict){if(!c)throw console.error(`Server response has wrong type:
60
- `,{error:u,url:i,opts:a,data:s}),Error(`Server response has wrong type: ${u.message}`);return l}else return c||console.warn(`Server response has wrong type:
61
- `,{error:u,url:i,opts:a,data:s}),s}async postData(e,t){let n=await fetch(`${this.options.apiUrl}${e}`,{method:`POST`,headers:this.getDefaultHeaders(),body:JSON.stringify(t)});if(!n.ok){let e=await n.text();throw Error(`${n.status} - ${e}`)}return n}async postFormData(e,t){let n=await fetch(`${this.options.apiUrl}${e}`,{method:`POST`,body:t});if(!n.ok){let e=await n.text();throw Error(`${n.status} - ${e}`)}return n}},Mn=m({links:u(d([m({url:f(l()),title:f(ne()),considered:f(ee()),orgMetadata:f(m({authors:f(u(ne()))})),type:f(ne()),date:f(ie()),similarity:f(te()),content:f(ne()),fromFullTextSearch:f(ee()),rerank:f(m({index:f(p()),adjustment:f(te()),score:f(te()),similarityOld:f(te())}))}),se]))}),Nn=e=>{if(`metadata`in e)return e;console.warn(`Please upgrade your backend you are currently using an old api feature.`);let t=e.orgMetadata??{};e?.fromFullTextSearch&&(t.fromFullTextSearch=e?.fromFullTextSearch),e?.rerank&&(t.rerank=e?.rerank);let n=[],r=e.title??``;if(e.title&&e.title.includes(` > `)){let t=e.title.split(` > `);r=t.pop()??``,n=t}return{url:e.url??``,title:r,score:e.similarity||0,breadcrumbs:n,metadata:t,description:e.content,date:e.date}},Pn=7,Fn=8,In=160,Ln=e=>{let t=[],n=0;for(;n<e.length;){let r=e[n];if(r===`<`){let r=e.indexOf(`>`,n);if(r!==-1){t.push({type:`tag`,value:e.slice(n,r+1)}),n=r+1;continue}}if(/\s/.test(r)){let r=n;for(;r<e.length&&/\s/.test(e[r]);)r++;t.push({type:`space`,value:e.slice(n,r)}),n=r;continue}let i=n;for(;i<e.length&&!/\s/.test(e[i])&&e[i]!==`<`;)i++;t.push({type:`word`,value:e.slice(n,i)}),n=i}return t},Rn=e=>{let t=Ln(e),n=[],r=``,i=!1;for(let e of t)e.type===`space`&&i?(n.push(r),r=e.value,i=!1):(r+=e.value,e.type===`word`&&(i=!0));return r&&n.push(r),n},zn=e=>Math.max(Fn,Math.min(In,e.length*Pn)),Bn=class{queue=[];timeoutId=null;isProcessing=!1;constructor(e){this.onText=e}ingestText(e){let t=Rn(e);if(t.length>=5){for(let e of t)this.queue.push({kind:`text`,chunk:e,delayMs:zn(e)});this.kickoff();return}this.runAfterTyping(()=>this.onText(e))}runAfterTyping(e){if(this.queue.length===0&&!this.isProcessing){e();return}this.queue.push({kind:`fn`,fn:e}),this.kickoff()}runWithWarmup(e){this.queue.push({kind:`fn`,fn:e}),this.kickoff()}clear(){this.timeoutId!==null&&(clearTimeout(this.timeoutId),this.timeoutId=null),this.queue=[],this.isProcessing=!1}kickoff(){this.isProcessing||this.timeoutId!==null||(this.timeoutId=setTimeout(()=>{this.timeoutId=null,this.processNext()},750))}processNext(){let e=this.queue.shift();if(!e){this.isProcessing=!1;return}this.isProcessing=!0,e.kind===`text`?(this.onText(e.chunk),this.timeoutId=setTimeout(()=>{this.timeoutId=null,this.processNext()},e.delayMs)):(e.fn(),this.processNext())}},Vn=class{constructor(e){this.results=e}},Hn=class{internalData;renderers=new Map;markedExtensions=[];_newTabSrText;constructor(e){let t=new jn({apiUrl:e.apiUrl,apiKey:e.apiKey,speechRecognitionApiKey:e.speechRecognitionApiKey,strict:e.strict??!1,EventSource:e.EventSource??EventSource});this.internalData={restClient:t,metadata:On(t,e.startParameters),searchResponseMap:new Map,chatResponseMap:new Map,conversationMap:new Map}}setMarkedExtensions(...e){this.markedExtensions=e}setNewTabSrText(e){this._newTabSrText=e}getMetadata(){return this.internalData.metadata}createConversationId(){let e=Sn();return this.renderers.set(e,new an({extensions:this.markedExtensions,newTabSrText:this._newTabSrText})),e}chat(e,t,n={}){let r=new cn,i=Sn(),a=new sn,o=new fn({id:i,onError:e=>{n.onError?.(e)},onFinish:e=>{r.setValue(e)},markdownRenderer:this.renderers.get(e)??new an({extensions:this.markedExtensions,newTabSrText:this._newTabSrText}),userQuestion:t}),s=async()=>{await a,(await c).close()},c=new cn,l=new Bn(e=>o.updateText(e));(async()=>{let s=await this.internalData.metadata;if(s.mode===`maintenance`)throw Error(`Can not chat in maintenance mode`);let u=await this.internalData.restClient.subscribeSse(`/assistant/sse`,{query:t,uID:s.userId,cID:e,rID:i,lang:n.lang,feature:n.features?.join(`,`),referrer:n.referrer,source:n.source,...n.selectorValues??{},...n.mode?{mode:n.mode}:{},...n.cache?{cache:!0}:{},...n.predefinedQuestionId?{predefinedQuestionId:n.predefinedQuestionId}:{},...n.switchQuestionId?{switchQuestionId:n.switchQuestionId}:{},chat:`true`,version:`2`},{onClose:()=>{l.clear(),o.finishMessage(),a.resolve(),r.cleanup()},onMessage:t=>{let r=t;switch(r.type){case`error`:l.runAfterTyping(()=>o.pushError(r.error));break;case`id`:r.for===`request`&&i!==r.id&&console.warn(`Unexpected request id "${r.id}" expected "${i}"`),r.for===`conversation`&&e!==r.id&&console.warn(`Unexpected conversation id "${r.id}" expected "${e}"`);break;case`state`:r.state===`history-entry-initialized`&&a.resolve();break;case`text`:l.ingestText(r.text);break;case`done`:case`answer-done`:l.runAfterTyping(()=>{o.finishMessage(),a.resolve(),c.then(e=>e.close())});break;case`unexpected-call`:l.runAfterTyping(()=>{console.error(`unexpected-call:`,r),o.pushError(`unexpected-call`)});break;case`jsonld-component`:case`mapped-reference`:l.runAfterTyping(()=>o.addMappedReference(r.reference));break;case`reference`:l.runAfterTyping(()=>o.addOldReference(r.reference));break;case`retrieval-question`:l.runAfterTyping(()=>o.updateRetrievalQuestion(r.question));break;case`no-feedback`:l.runAfterTyping(()=>o.setNoFeedback());break;case`component`:l.runWithWarmup(()=>n.onEmbed?.(r));break}l.runAfterTyping(()=>n.onMessage?.(r))},onError:e=>{console.error(` sse-error:`,e),!(`data`in e&&!e.data&&`responseCode`in e&&e.responseCode===0)&&o.pushError(`sse-error`)}});c.setValue(u)})();let u=new hn({question:t,id:i,content:r,readableStore:o.getReadableStore(),readyForFeedback:a,abort:s,liipgptClientPrimitive:this});return this.internalData.chatResponseMap.set(u.id,u),u}async thumbs(e,t,n){if((await this.internalData.metadata).mode!==`ready`)throw Error(`Can not post feedback unless we are in ready mode`);let r={feedback:n,rID:e,query:t};await this.internalData.restClient.postData(`/quickfeedback`,r)}thumbsUp(e,t){return this.thumbs(e,t,`positive`)}thumbsDown(e,t){return this.thumbs(e,t,`negative`)}async feedback(e,t,n){let r=await this.internalData.metadata;if(r.mode!==`ready`)throw Error(`Can not post feedback unless we are in ready mode`);if(n.message){let i={body:n.message,email:n.email,rID:e,uID:r.userId,query:t};await this.internalData.restClient.postData(`/feedback`,i)}n.classification&&await this.internalData.restClient.postData(`/classification`,{impact:n.classification.impact,quality:n.classification.quality,rID:e})}async submitAnswerForm(e){let t=await this.internalData.metadata;if(t.mode!==`ready`)throw Error(`Can not submit the answer form unless we are in ready mode`);let n={receiverEmail:e.receiverEmail,fields:e.fields,query:e.question,answer:e.answer,rID:e.requestId,uID:t.userId,lang:e.lang};await this.internalData.restClient.postData(`/customform`,n)}async userAction(e,t={}){let n=await this.internalData.metadata;if(n.mode!==`ready`)throw Error(`Can not post user action unless we are in ready mode`);let r={uID:n.userId,cID:t.conversationId,lang:t.lang,userAction:e};await this.internalData.restClient.postData(`/assistant/userAction`,r)}async search(e,t={}){let n=await this.internalData.metadata,r=n.mode===`ready`?n.userId:void 0,{links:i}=await this.internalData.restClient.fetchData(`/assistant/search`,Mn,{modelId:t.model,lang:t.language,query:e,mapResults:`true`,uID:r});return new Vn(i.map(Nn))}async getChatConfig(){return this.internalData.restClient.fetchData(`/chatconfig`,ae)}async getChatHistory(e,t){try{let n=await this.internalData.restClient.postData(`/chathistory`,{cID:e,uID:t}),r=h.safeParse(await n.json());return r.success?r.data:[]}catch(e){return console.error(`Failed to load chat history:`,e),[]}}async getPredefinedQuestions(e){return(await this.internalData.restClient.fetchData(`/topics/questions`,oe,e)).predefinedQuestions}async transcribeAudio(e,t={}){let n=await this.internalData.metadata,r=t.lang||`de-CH`;if(n.mode===`maintenance`)throw Error(`Can not transcribe audio in maintenance mode`);try{let t=(e=>e.includes(`mp4`)?`mp4`:e.includes(`webm`)?`webm`:(e.includes(`wav`),`wav`))(e.type),n=new FormData;return n.append(`file`,e,`audio.${t}`),n.append(`lang`,r),n.append(`type`,e.type),{transcript:await(await this.internalData.restClient.postFormData(`/speech?key=${this.internalData.restClient.speechRecognitionApiKey||``}&lang=${r}`,n)).text()||``,error:void 0}}catch(e){return console.error(`Error transcribing audio:`,e),{transcript:``,error:e instanceof Error?e.message:`Unknown error`}}}},Un=class{clientPrimitive;constructor(e){this.clientPrimitive=new Hn(e)}getMetadata(){return this.clientPrimitive.getMetadata()}createConversation(){return new gn(this.clientPrimitive)}search(e,t={}){return this.clientPrimitive.search(e,t)}getChatConfig(){return this.clientPrimitive.getChatConfig()}getPredefinedQuestions(e){return this.clientPrimitive.getPredefinedQuestions(e)}},Wn=class extends Map{#e=new Map;#t=e(0);#n=e(0);#r=s||-1;constructor(e){if(super(),e){for(var[t,n]of e)super.set(t,n);this.#n.v=super.size}}#i(n){return s===this.#r?e(n):t(n)}has(e){var t=this.#e,n=t.get(e);if(n===void 0)if(super.has(e))n=this.#i(0),t.set(e,n);else return o(this.#t),!1;return o(n),!0}forEach(e,t){this.#a(),super.forEach(e,t)}get(e){var t=this.#e,n=t.get(e);if(n===void 0)if(super.has(e))n=this.#i(0),t.set(e,n);else{o(this.#t);return}return o(n),super.get(e)}set(e,t){var n=this.#e,i=n.get(e),a=super.get(e),o=super.set(e,t),s=this.#t;if(i===void 0)i=this.#i(0),n.set(e,i),r(this.#n,super.size),c(s);else if(a!==t){c(i);var l=s.reactions===null?null:new Set(s.reactions);(l===null||!i.reactions?.every(e=>l.has(e)))&&c(s)}return o}delete(e){var t=this.#e,n=t.get(e),i=super.delete(e);return n!==void 0&&(t.delete(e),r(n,-1)),i&&(r(this.#n,super.size),c(this.#t)),i}clear(){if(super.size!==0){super.clear();var e=this.#e;r(this.#n,0);for(var t of e.values())r(t,-1);c(this.#t),e.clear()}}#a(){o(this.#t);var e=this.#e;if(this.#n.v!==e.size){for(var t of super.keys())if(!e.has(t)){var n=this.#i(0);e.set(t,n)}}for([,n]of this.#e)o(n)}keys(){return o(this.#t),super.keys()}values(){return this.#a(),super.values()}entries(){return this.#a(),super.entries()}[Symbol.iterator](){return this.entries()}get size(){return o(this.#n),super.size}},Gn=class{#e;#t;constructor(e,t){this.#e=e,this.#t=a(t)}get current(){return this.#t(),this.#e()}},Kn=/\(.+\)/,qn=new Set([`all`,`print`,`screen`,`and`,`or`,`not`,`only`]),Jn=class extends Gn{constructor(e,t){let n=Kn.test(e)||e.split(/[\s,]+/).some(e=>qn.has(e.trim()))?e:`(${e})`,r=window.matchMedia(n);super(()=>r.matches,e=>i(r,`change`,e))}};function Yn(e){return e}function Xn(e){return e<.5?4*e*e*e:.5*(2*e-2)**3+1}function Zn(e){return e<.5?8*e**4:-8*(e-1)**4+1}function Qn(e){return e**4}function $n(e){return(e-1)**3*(1-e)+1}function er(e){return--e*e*e*e*e+1}export{mn as _,$n as a,D as b,Wn as c,zn as d,Rn as f,pn as g,_n as h,Zn as i,Un as l,bn as m,Yn as n,er as o,Dn as p,Qn as r,Jn as s,Xn as t,Hn as u,un as v,an as y};
@@ -1 +0,0 @@
1
- import{Dt as e,Nt as t,Tt as n,ct as r,ot as i,r as a,st as o,t as s}from"./rEsbAd0y.js";var c=class{constructor(e,t){this.status=e,typeof t==`string`?this.body={message:t}:t?this.body=t:this.body={message:`Error: ${e}`}}toString(){return JSON.stringify(this.body)}},l=class{constructor(e,t){this.status=e,this.location=t}},u=class extends Error{constructor(e,t,n){super(n),this.status=e,this.text=t}};new URL(`sveltekit-internal://`);function d(e,t){return e===`/`||t===`ignore`?e:t===`never`?e.endsWith(`/`)?e.slice(0,-1):e:t===`always`&&!e.endsWith(`/`)?e+`/`:e}function f(e){return e.split(`%25`).map(decodeURI).join(`%25`)}function p(e){for(let t in e)e[t]=decodeURIComponent(e[t]);return e}function m({href:e}){return e.split(`#`)[0]}function h(e,t,n,r=!1){let i=new URL(e);Object.defineProperty(i,`searchParams`,{value:new Proxy(i.searchParams,{get(e,r){if(r===`get`||r===`getAll`||r===`has`)return(t,...i)=>(n(t),e[r](t,...i));t();let i=Reflect.get(e,r);return typeof i==`function`?i.bind(e):i}}),enumerable:!0,configurable:!0});let a=[`href`,`pathname`,`search`,`toString`,`toJSON`];r&&a.push(`hash`);for(let n of a)Object.defineProperty(i,n,{get(){return t(),e[n]},enumerable:!0,configurable:!0});return i}function g(...e){let t=5381;for(let n of e)if(typeof n==`string`){let e=n.length;for(;e;)t=t*33^n.charCodeAt(--e)}else if(ArrayBuffer.isView(n)){let e=new Uint8Array(n.buffer,n.byteOffset,n.byteLength),r=e.length;for(;r;)t=t*33^e[--r]}else throw TypeError(`value must be a string or TypedArray`);return(t>>>0).toString(36)}new TextEncoder,new TextDecoder;function _(e){let t=atob(e),n=new Uint8Array(t.length);for(let e=0;e<t.length;e++)n[e]=t.charCodeAt(e);return n}var ee=window.fetch;window.fetch=(e,t)=>((e instanceof Request?e.method:t?.method||`GET`)!==`GET`&&v.delete(b(e)),ee(e,t));var v=new Map;function y(e,t){let n=b(e,t),r=document.querySelector(n);if(r?.textContent){r.remove();let{body:e,...t}=JSON.parse(r.textContent),i=r.getAttribute(`data-ttl`);return i&&v.set(n,{body:e,init:t,ttl:1e3*Number(i)}),r.getAttribute(`data-b64`)!==null&&(e=_(e)),Promise.resolve(new Response(e,t))}return window.fetch(e,t)}function te(e,t,n){if(v.size>0){let t=b(e,n),r=v.get(t);if(r){if(performance.now()<r.ttl&&[`default`,`force-cache`,`only-if-cached`,void 0].includes(n?.cache))return new Response(r.body,r.init);v.delete(t)}}return window.fetch(t,n)}function b(e,t){let n=`script[data-sveltekit-fetched][data-url=${JSON.stringify(e instanceof Request?e.url:e)}]`;if(t?.headers||t?.body){let e=[];t.headers&&e.push([...new Headers(t.headers)].join(`,`)),t.body&&(typeof t.body==`string`||ArrayBuffer.isView(t.body))&&e.push(t.body),n+=`[data-hash="${g(...e)}"]`}return n}var ne=/^(\[)?(\.\.\.)?(\w+)(?:=(\w+))?(\])?$/;function re(e){let t=[];return{pattern:e===`/`?/^\/$/:RegExp(`^${ae(e).map(e=>{let n=/^\[\.\.\.(\w+)(?:=(\w+))?\]$/.exec(e);if(n)return t.push({name:n[1],matcher:n[2],optional:!1,rest:!0,chained:!0}),`(?:/([^]*))?`;let r=/^\[\[(\w+)(?:=(\w+))?\]\]$/.exec(e);if(r)return t.push({name:r[1],matcher:r[2],optional:!0,rest:!1,chained:!0}),`(?:/([^/]+))?`;if(!e)return;let i=e.split(/\[(.+?)\](?!\])/);return`/`+i.map((e,n)=>{if(n%2){if(e.startsWith(`x+`))return se(String.fromCharCode(parseInt(e.slice(2),16)));if(e.startsWith(`u+`))return se(String.fromCharCode(...e.slice(2).split(`-`).map(e=>parseInt(e,16))));let[,r,a,o,s]=ne.exec(e);return t.push({name:o,matcher:s,optional:!!r,rest:!!a,chained:a?n===1&&i[0]===``:!1}),a?`([^]*?)`:r?`([^/]*)?`:`([^/]+?)`}return se(e)}).join(``)}).join(``)}/?$`),params:t}}function ie(e){return e!==``&&!/^\([^)]+\)$/.test(e)}function ae(e){return e.slice(1).split(`/`).filter(ie)}function oe(e,t,n){let r={},i=e.slice(1),a=i.filter(e=>e!==void 0),o=0;for(let e=0;e<t.length;e+=1){let s=t[e],c=i[e-o];if(s.chained&&s.rest&&o&&(c=i.slice(e-o,e+1).filter(e=>e).join(`/`),o=0),c===void 0)if(s.rest)c=``;else continue;if(!s.matcher||n[s.matcher](c)){r[s.name]=c;let n=t[e+1],l=i[e+1];n&&!n.rest&&n.optional&&l&&s.chained&&(o=0),!n&&!l&&Object.keys(r).length===a.length&&(o=0);continue}if(s.optional&&s.chained){o++;continue}return}if(!o)return r}function se(e){return e.normalize().replace(/[[\]]/g,`\\$&`).replace(/%/g,`%25`).replace(/\//g,`%2[Ff]`).replace(/\?/g,`%3[Ff]`).replace(/#/g,`%23`).replace(/[.*+?^${}()|\\]/g,`\\$&`)}function ce({nodes:e,server_loads:t,dictionary:n,matchers:r}){let i=new Set(t);return Object.entries(n).map(([t,[n,i,s]])=>{let{pattern:c,params:l}=re(t),u={id:t,exec:e=>{let t=c.exec(e);if(t)return oe(t,l,r)},errors:[1,...s||[]].map(t=>e[t]),layouts:[0,...i||[]].map(o),leaf:a(n)};return u.errors.length=u.layouts.length=Math.max(u.errors.length,u.layouts.length),u});function a(t){let n=t<0;return n&&(t=~t),[n,e[t]]}function o(t){return t===void 0?t:[i.has(t),e[t]]}}function le(e,t=JSON.parse){try{return t(sessionStorage[e])}catch{}}function ue(e,t,n=JSON.stringify){let r=n(t);try{sessionStorage[e]=r}catch{}}var x=globalThis.__sveltekit_bk2eo?.base??`/configurator`,de=globalThis.__sveltekit_bk2eo?.assets??x??``,fe=`1788260101465`,pe=`sveltekit:snapshot`,me=`sveltekit:scroll`,he=`sveltekit:states`,S=`sveltekit:history`,C=`sveltekit:navigation`,w={tap:1,hover:2,viewport:3,eager:4,off:-1,false:-1},ge=location.origin;function _e(e){if(e instanceof URL)return e;let t=document.baseURI;if(!t){let e=document.getElementsByTagName(`base`);t=e.length?e[0].href:document.URL}return new URL(e,t)}function T(){return{x:pageXOffset,y:pageYOffset}}function E(e,t){return e.getAttribute(`data-sveltekit-${t}`)}var ve={...w,"":w.hover};function ye(e){let t=e.assignedSlot??e.parentNode;return t?.nodeType===11&&(t=t.host),t}function be(e,t){for(;e&&e!==t;){if(e.nodeName.toUpperCase()===`A`&&e.hasAttribute(`href`))return e;e=ye(e)}}function xe(e,t,n){let r;try{if(r=new URL(e instanceof SVGAElement?e.href.baseVal:e.href,document.baseURI),n&&r.hash.match(/^#[^/]/)){let e=location.hash.split(`#`)[1]||`/`;r.hash=`#${e}${r.hash}`}}catch{}let i=e instanceof SVGAElement?e.target.baseVal:e.target,a=!r||!!i||O(r,t,n)||(e.getAttribute(`rel`)||``).split(/\s+/).includes(`external`),o=r?.origin===ge&&e.hasAttribute(`download`);return{url:r,external:a,target:i,download:o}}function D(e){let t=null,n=null,r=null,i=null,a=null,o=null,s=e;for(;s&&s!==document.documentElement;)r===null&&(r=E(s,`preload-code`)),i===null&&(i=E(s,`preload-data`)),t===null&&(t=E(s,`keepfocus`)),n===null&&(n=E(s,`noscroll`)),a===null&&(a=E(s,`reload`)),o===null&&(o=E(s,`replacestate`)),s=ye(s);function c(e){switch(e){case``:case`true`:return!0;case`off`:case`false`:return!1;default:return}}return{preload_code:ve[r??`off`],preload_data:ve[i??`off`],keepfocus:c(t),noscroll:c(n),reload:c(a),replace_state:c(o)}}function Se(e){let n=t(e),r=!0;function i(){r=!0,n.update(e=>e)}function a(e){r=!1,n.set(e)}function o(e){let t;return n.subscribe(n=>{(t===void 0||r&&n!==t)&&e(t=n)})}return{notify:i,set:a,subscribe:o}}var Ce={v:()=>{}};function we(){let{set:e,subscribe:n}=t(!1);async function r(){clearTimeout(void 0);try{let t=await fetch(`${de}/_app/version.json`,{headers:{pragma:`no-cache`,"cache-control":`no-cache`}});if(!t.ok)return!1;let n=(await t.json()).version!==fe;return n&&(e(!0),Ce.v(),clearTimeout(void 0)),n}catch{return!1}}return{subscribe:n,check:r}}function O(e,t,n){return e.origin!==ge||!e.pathname.startsWith(t)?!0:n?e.pathname!==location.pathname:!1}function Te(e){}var Ee=new Set([`load`,`prerender`,`csr`,`ssr`,`trailingSlash`,`config`]);new Set([...Ee,`entries`]);var De=new Set([...Ee]);new Set([...De,`actions`,`entries`]);function Oe(e){return e.filter(e=>e!=null)}function ke(e){return e instanceof c||e instanceof u?e.status:500}function Ae(e){return e instanceof u?e.text:`Internal Error`}var k,A,j,je=a.toString().includes(`$$`)||/function \w+\(\) \{\}/.test(a.toString()),Me=`a:`;je?(k={data:{},form:null,error:null,params:{},route:{id:null},state:{},status:-1,url:new URL(Me)},A={current:null},j={current:!1}):(k=new class{#e=e({});get data(){return i(this.#e)}set data(e){n(this.#e,e)}#t=e(null);get form(){return i(this.#t)}set form(e){n(this.#t,e)}#n=e(null);get error(){return i(this.#n)}set error(e){n(this.#n,e)}#r=e({});get params(){return i(this.#r)}set params(e){n(this.#r,e)}#i=e({id:null});get route(){return i(this.#i)}set route(e){n(this.#i,e)}#a=e({});get state(){return i(this.#a)}set state(e){n(this.#a,e)}#o=e(-1);get status(){return i(this.#o)}set status(e){n(this.#o,e)}#s=e(new URL(Me));get url(){return i(this.#s)}set url(e){n(this.#s,e)}},A=new class{#e=e(null);get current(){return i(this.#e)}set current(e){n(this.#e,e)}},j=new class{#e=e(!1);get current(){return i(this.#e)}set current(e){n(this.#e,e)}},Ce.v=()=>j.current=!0);function Ne(e){Object.assign(k,e)}var Pe={spanContext(){return Fe},setAttribute(){return this},setAttributes(){return this},addEvent(){return this},setStatus(){return this},updateName(){return this},end(){return this},isRecording(){return!1},recordException(){return this},addLink(){return this},addLinks(){return this}},Fe={traceId:``,spanId:``,traceFlags:0},{onMount:Ie,tick:Le}=s,Re=new Set([`icon`,`shortcut icon`,`apple-touch-icon`]),M=null,N=le(`sveltekit:scroll`)??{},P=le(`sveltekit:snapshot`)??{},F={url:Se({}),page:Se({}),navigating:t(null),updated:we()};function ze(e){N[e]=T()}function Be(e,t){let n=e+1;for(;N[n];)delete N[n],n+=1;for(n=t+1;P[n];)delete P[n],n+=1}function I(e,t=!1){return t?location.replace(e.href):location.href=e.href,new Promise(()=>{})}async function Ve(){if(`serviceWorker`in navigator){let e=await navigator.serviceWorker.getRegistration(x||`/`);e&&await e.update()}}function He(){}var Ue,We,L,R,Ge,z,B=[],V=[],H=null;function Ke(){H?.fork?.then(e=>e?.discard()),H=null}var U=new Map,qe=new Set,Je=new Set,W=new Set,G={branch:[],error:null,url:null,nav:null},Ye=!1,K=!1,Xe=!0,q=!1,J=!1,Ze=!1,Qe=!1,$e,Y,X,Z,et=new Set,tt=new Map;async function nt(e,t,n){globalThis.__sveltekit_bk2eo?.data&&globalThis.__sveltekit_bk2eo.data,document.URL!==location.href&&(location.href=location.href),z=e,await e.hooks.init?.(),Ue=ce(e),R=document.documentElement,Ge=t,We=e.nodes[0],L=e.nodes[1],We(),L(),Y=history.state?.[S],X=history.state?.[C],Y||(Y=X=Date.now(),history.replaceState({...history.state,[S]:Y,[C]:X},``));let r=N[Y];function i(){r&&(history.scrollRestoration=`manual`,scrollTo(r.x,r.y))}n?(i(),await jt(Ge,n)):(await Q({type:`enter`,url:_e(z.hash?Lt(new URL(location.href)):location.href),replace_state:!0}),i()),At()}function rt(){B.length=0,Qe=!1}function it(e){V.some(e=>e?.snapshot)&&(P[e]=V.map(e=>e?.snapshot?.capture()))}function at(e){P[e]?.forEach((e,t)=>{V[t]?.snapshot?.restore(e)})}function ot(){ze(Y),ue(me,N),it(X),ue(pe,P)}async function st(e,t,n,i){let a;t.invalidateAll&&Ke(),await Q({type:`goto`,url:_e(e),keepfocus:t.keepFocus,noscroll:t.noScroll,replace_state:t.replaceState,state:t.state,redirect_count:n,nav_token:i,accept:()=>{t.invalidateAll&&(Qe=!0,a=[...tt.keys()]),t.invalidate&&t.invalidate.forEach(kt)}}),t.invalidateAll&&r().then(r).then(()=>{tt.forEach(({resource:e},t)=>{a?.includes(t)&&e.refresh?.()})})}async function ct(e){if(e.id!==H?.id){Ke();let t={};et.add(t),H={id:e.id,token:t,promise:vt({...e,preload:t}).then(e=>(et.delete(t),e.type===`loaded`&&e.state.error&&Ke(),e)),fork:null}}return H.promise}async function lt(e){let t=(await St(e,!1))?.route;t&&await Promise.all([...t.layouts,t.leaf].filter(Boolean).map(e=>e[1]()))}async function ut(e,t,n){let r={params:G.params,route:{id:G.route?.id??null},url:new URL(location.href)};G={...e.state,nav:r};let i=document.querySelector(`style[data-sveltekit]`);if(i&&i.remove(),Object.assign(k,e.props.page),$e=new z.root({target:t,props:{...e.props,stores:F,components:V},hydrate:n,sync:!1,transformError:void 0}),await Promise.resolve(),at(X),n){let e={from:null,to:{...r,scroll:N[Y]??T()},willUnload:!1,type:`enter`,complete:Promise.resolve()};W.forEach(t=>t(e))}K=!0}async function dt({url:e,params:t,branch:n,errors:r,status:i,error:a,route:o,form:s}){let c=`never`;if(x&&(e.pathname===x||e.pathname===x+`/`))c=`always`;else for(let e of n)e?.slash!==void 0&&(c=e.slash);e.pathname=d(e.pathname,c),e.search=e.search;let l={type:`loaded`,state:{url:e,params:t,branch:n,error:a,route:o},props:{constructors:Oe(n).map(e=>e.node.component),page:It(k)}};s!==void 0&&(l.props.form=s);let u={},f=!k,p=0;for(let e=0;e<Math.max(n.length,G.branch.length);e+=1){let t=n[e],r=G.branch[e];t?.data!==r?.data&&(f=!0),t&&(u={...u,...t.data},f&&(l.props[`data_${p}`]=u),p+=1)}return(!G.url||e.href!==G.url.href||G.error!==a||s!==void 0&&s!==k.form||f)&&(l.props.page={error:a,params:t,route:{id:o?.id??null},state:{},status:i,url:new URL(e),form:s??null,data:f?u:k.data}),l}async function ft({loader:e,parent:t,url:n,params:r,route:i,server_data_node:a}){let o=null,s=!0,c={dependencies:new Set,params:new Set,parent:!1,route:!1,url:!1,search_params:new Set},l=await e();if(l.universal?.load){function e(...e){for(let t of e){let{href:e}=new URL(t,n);c.dependencies.add(e)}}let u={tracing:{enabled:!1,root:Pe,current:Pe},route:new Proxy(i,{get:(e,t)=>(s&&(c.route=!0),e[t])}),params:new Proxy(r,{get:(e,t)=>(s&&c.params.add(t),e[t])}),data:a?.data??null,url:h(n,()=>{s&&(c.url=!0)},e=>{s&&c.search_params.add(e)},z.hash),async fetch(t,r){t instanceof Request&&(r={body:t.method===`GET`||t.method===`HEAD`?void 0:await t.blob(),cache:t.cache,credentials:t.credentials,headers:[...t.headers].length>0?t?.headers:void 0,integrity:t.integrity,keepalive:t.keepalive,method:t.method,mode:t.mode,redirect:t.redirect,referrer:t.referrer,referrerPolicy:t.referrerPolicy,signal:t.signal,...r});let{resolved:i,promise:a}=pt(t,r,n);return s&&e(i.href),a},setHeaders:()=>{},depends:e,parent(){return s&&(c.parent=!0),t()},untrack(e){s=!1;try{return e()}finally{s=!0}}};o=await l.universal.load.call(null,u)??null}return{node:l,loader:e,server:a,universal:l.universal?.load?{type:`data`,data:o,uses:c}:null,data:o??a?.data??null,slash:l.universal?.trailingSlash??a?.slash}}function pt(e,t,n){let r=e instanceof Request?e.url:e,i=new URL(r,n);return i.origin===n.origin&&(r=i.href.slice(n.origin.length)),{resolved:i,promise:K?te(r,i.href,t):y(r,t)}}function mt(e,t,n,r,i,a){if(Qe)return!0;if(!i)return!1;if(i.parent&&e||i.route&&t||i.url&&n)return!0;for(let e of i.search_params)if(r.has(e))return!0;for(let e of i.params)if(a[e]!==G.params[e])return!0;for(let e of i.dependencies)if(B.some(t=>t(new URL(e))))return!0;return!1}function ht(e,t){return e?.type===`data`?e:e?.type===`skip`?t??null:null}function gt(e,t){if(!e)return new Set(t.searchParams.keys());let n=new Set([...e.searchParams.keys(),...t.searchParams.keys()]);for(let r of n){let i=e.searchParams.getAll(r),a=t.searchParams.getAll(r);i.every(e=>a.includes(e))&&a.every(e=>i.includes(e))&&n.delete(r)}return n}function _t({error:e,url:t,route:n,params:r}){return{type:`loaded`,state:{error:e,url:t,route:n,params:r,branch:[]},props:{page:It(k),constructors:[]}}}async function vt({id:e,invalidating:t,url:n,params:r,route:i,preload:a}){if(H?.id===e)return et.delete(H.token),H.promise;let{errors:o,layouts:s,leaf:u}=i,d=[...s,u];o.forEach(e=>e?.().catch(()=>{})),d.forEach(e=>e?.[1]().catch(()=>{}));let f=G.url?e!==wt(G.url):!1,p=G.route?i.id!==G.route.id:!1,m=gt(G.url,n),h=!1,g=d.map(async(e,t)=>{if(!e)return;let a=G.branch[t];return e[1]===a?.loader&&!mt(h,p,f,m,a.universal?.uses,r)?a:(h=!0,ft({loader:e[1],url:n,params:r,route:i,parent:async()=>{let e={};for(let n=0;n<t;n+=1)Object.assign(e,(await g[n])?.data);return e},server_data_node:ht(e[0]?{type:`skip`}:null,e[0]?a?.server:void 0)}))});for(let e of g)e.catch(()=>{});let _=[];for(let e=0;e<d.length;e+=1)if(d[e])try{_.push(await g[e])}catch(t){if(t instanceof l)return{type:`redirect`,location:t.location};if(et.has(a))return _t({error:await $(t,{params:r,url:n,route:{id:i.id}}),url:n,params:r,route:i});let s=ke(t),u;if((void 0)?.includes(t))s=t.status??s,u=t.error;else if(t instanceof c)u=t.body;else{if(await F.updated.check())return await Ve(),await I(n);u=await $(t,{params:r,url:n,route:{id:i.id}})}let d=await yt(e,_,o);return d?dt({url:n,params:r,branch:_.slice(0,d.idx).concat(d.node),errors:o,status:s,error:u,route:i}):await Et(n,{id:i.id},u,s)}else _.push(void 0);return dt({url:n,params:r,branch:_,errors:o,status:200,error:null,route:i,form:t?void 0:null})}async function yt(e,t,n){for(;e--;)if(n[e]){let r=e;for(;!t[r];)--r;try{return{idx:r+1,node:{node:await n[e](),loader:n[e],data:{},server:null,universal:null}}}catch{continue}}}async function bt({status:e,error:t,url:n,route:r}){let i={};try{return dt({url:n,params:i,branch:[await ft({loader:We,url:n,params:i,route:r,parent:()=>Promise.resolve({}),server_data_node:ht(null)}),{node:await L(),loader:L,universal:null,server:null,data:null}],status:e,error:t,errors:[],route:null})}catch(e){if(e instanceof l)return st(new URL(e.location,location.href),{},0);throw e}}async function xt(e){let t=e.href;if(U.has(t))return U.get(t);let n;try{let r=(async()=>{let t=await z.hooks.reroute({url:new URL(e),fetch:async(t,n)=>pt(t,n,e).promise})??e;if(typeof t==`string`){let n=new URL(e);z.hash?n.hash=t:n.pathname=t,t=n}return t})();U.set(t,r),n=await r}catch{U.delete(t);return}return n}async function St(e,t){if(e&&!O(e,x,z.hash)){let n=await xt(e);if(!n)return;let r=Ct(n);for(let n of Ue){let i=n.exec(r);if(i)return{id:wt(e),invalidating:t,route:n,params:p(i),url:e}}}}function Ct(e){return f(z.hash?e.hash.replace(/^#/,``).replace(/[?#].+/,``):e.pathname.slice(x.length))||`/`}function wt(e){return(z.hash?e.hash.replace(/^#/,``):e.pathname)+e.search}function Tt({url:e,type:t,intent:n,delta:r,event:i,scroll:a}){let o=!1,s=Ft(G,n,e,t,a??null);r!==void 0&&(s.navigation.delta=r),i!==void 0&&(s.navigation.event=i);let c={...s.navigation,cancel:()=>{o=!0,s.reject(Error(`navigation cancelled`))}};return q||qe.forEach(e=>e(c)),o?null:s}async function Q({type:e,url:t,popped:n,keepfocus:i,noscroll:a,replace_state:s,state:c={},redirect_count:l=0,nav_token:d={},accept:f=He,block:p=He,event:m}){let h=Z;Z=d;let g=await St(t,!1),_=e===`enter`?Ft(G,g,t,e):Tt({url:t,type:e,delta:n?.delta,intent:g,scroll:n?.scroll,event:m});if(!_){p(),Z===d&&(Z=h);return}let ee=Y,v=X;f(),q=!0,K&&_.navigation.type!==`enter`&&F.navigating.set(A.current=_.navigation);let y=g&&await vt(g);if(!y){if(O(t,x,z.hash))return await I(t,s);y=await Et(t,{id:null},await $(new u(404,`Not Found`,`Not found: ${t.pathname}`),{url:t,params:{},route:{id:null}}),404,s)}if(t=g?.url||t,Z!==d)return _.reject(Error(`navigation aborted`)),!1;if(y.type===`redirect`){if(l<20){await Q({type:e,url:new URL(y.location,t),popped:n,keepfocus:i,noscroll:a,replace_state:s,state:c,redirect_count:l+1,nav_token:d}),_.fulfil(void 0);return}y=await bt({status:500,error:await $(Error(`Redirect loop`),{url:t,params:{},route:{id:null}}),url:t,route:{id:null}})}else y.props.page.status>=400&&await F.updated.check()&&(await Ve(),await I(t,s));if(rt(),ze(ee),it(v),y.props.page.url.pathname!==t.pathname&&(t.pathname=y.props.page.url.pathname),c=n?n.state:c,!n){let e=s?0:1,n={[S]:Y+=e,[C]:X+=e,[he]:c};(s?history.replaceState:history.pushState).call(history,n,``,t),s||Be(Y,X)}let te=g&&H?.id===g.id?H.fork:null;H=null,y.props.page.state=c;let b;if(K){let e=(await Promise.all(Array.from(Je,e=>e(_.navigation)))).filter(e=>typeof e==`function`);if(e.length>0){function t(){e.forEach(e=>{W.delete(e)})}e.push(t),e.forEach(e=>{W.add(e)})}let n=_.navigation.to;G={...y.state,nav:{params:n.params,route:n.route,url:n.url}},y.props.page&&(y.props.page.url=t);let r=te&&await te;r?b=r.commit():(M=null,$e.$set(y.props),M&&Object.assign(y.props.page,M),Ne(y.props.page),b=o?.()),Ze=!0}else await ut(y,Ge,!1);let{activeElement:ne}=document;await b,await r(),await r();let re=null;if(Xe){let e=n?n.scroll:a?T():null;e?scrollTo(e.x,e.y):(re=t.hash&&document.getElementById(Rt(t)))?re.scrollIntoView():scrollTo(0,0)}let ie=document.activeElement!==ne&&document.activeElement!==document.body;!i&&!ie&&Pt(t,!re),Xe=!0,y.props.page&&(M&&Object.assign(y.props.page,M),Object.assign(k,y.props.page)),q=!1,e===`popstate`&&at(X),_.fulfil(void 0),_.navigation.to&&(_.navigation.to.scroll=T()),W.forEach(e=>e(_.navigation)),F.navigating.set(A.current=null)}async function Et(e,t,n,r,i){return e.origin===ge&&e.pathname===location.pathname&&!Ye?await bt({status:r,error:n,url:e,route:t}):await I(e,i)}function Dt(){let e,t={element:void 0,href:void 0},n;R.addEventListener(`mousemove`,t=>{let n=t.target;clearTimeout(e),e=setTimeout(()=>{a(n,w.hover)},20)});function r(e){e.defaultPrevented||a(e.composedPath()[0],w.tap)}R.addEventListener(`mousedown`,r),R.addEventListener(`touchstart`,r,{passive:!0});let i=new IntersectionObserver(e=>{for(let t of e)t.isIntersecting&&(lt(new URL(t.target.href)),i.unobserve(t.target))},{threshold:0});async function a(e,r){let i=be(e,R),a=i===t.element&&i?.href===t.href&&r>=n;if(!i||a)return;let{url:o,external:s,download:c}=xe(i,x,z.hash);if(s||c)return;let l=D(i),u=o&&wt(G.url)===wt(o);if(!(l.reload||u))if(r<=l.preload_data){t={element:i,href:i.href},n=w.tap;let e=await St(o,!1);if(!e)return;ct(e)}else r<=l.preload_code&&(t={element:i,href:i.href},n=r,lt(o))}function o(){i.disconnect();for(let e of R.querySelectorAll(`a`)){let{url:t,external:n,download:r}=xe(e,x,z.hash);if(n||r)continue;let a=D(e);a.reload||(a.preload_code===w.viewport&&i.observe(e),a.preload_code===w.eager&&lt(t))}}W.add(o),o()}function $(e,t){if(e instanceof c)return e.body;let n=ke(e),r=Ae(e);return z.hooks.handleError({error:e,event:t,status:n,message:r})??{message:r}}function Ot(e,t={}){return e=new URL(_e(e)),e.origin===ge?st(e,t,0):Promise.reject(Error(`goto: invalid URL`))}function kt(e){if(typeof e==`function`)B.push(e);else{let{href:t}=new URL(e,location.href);B.push(e=>e.href===t)}}function At(){history.scrollRestoration=`manual`,addEventListener(`beforeunload`,e=>{let t=!1;if(ot(),!q){let e=Ft(G,void 0,null,`leave`),n={...e.navigation,cancel:()=>{t=!0,e.reject(Error(`navigation cancelled`))}};qe.forEach(e=>e(n))}t?(e.preventDefault(),e.returnValue=``):history.scrollRestoration=`auto`}),addEventListener(`visibilitychange`,()=>{document.visibilityState===`hidden`&&ot()}),navigator.connection?.saveData||Dt(),R.addEventListener(`click`,async t=>{if(t.button||t.which!==1||t.metaKey||t.ctrlKey||t.shiftKey||t.altKey||t.defaultPrevented)return;let n=be(t.composedPath()[0],R);if(!n)return;let{url:r,external:i,target:a,download:o}=xe(n,x,z.hash);if(!r)return;if(a===`_parent`||a===`_top`){if(window.parent!==window)return}else if(a&&a!==`_self`)return;let s=D(n);if(!(n instanceof SVGAElement)&&r.protocol!==location.protocol&&!(r.protocol===`https:`||r.protocol===`http:`)||o)return;let[c,l]=(z.hash?r.hash.replace(/^#/,``):r.href).split(`#`),u=c===m(location);if(i||s.reload&&(!u||!l)){Tt({url:r,type:`link`,event:t})?q=!0:t.preventDefault();return}if(l!==void 0&&u){let[,i]=G.url.href.split(`#`);if(i===l){if(t.preventDefault(),l===``||l===`top`&&n.ownerDocument.getElementById(`top`)===null)scrollTo({top:0});else{let e=n.ownerDocument.getElementById(decodeURIComponent(l));e&&(e.scrollIntoView(),e.focus())}return}if(J=!0,ze(Y),e(r),!s.replace_state)return;J=!1}t.preventDefault(),await new Promise(e=>{requestAnimationFrame(()=>{setTimeout(e,0)}),setTimeout(e,100)}),await Q({type:`link`,url:r,keepfocus:s.keepfocus,noscroll:s.noscroll,replace_state:s.replace_state??r.href===location.href,event:t})}),R.addEventListener(`submit`,e=>{if(e.defaultPrevented)return;let t=HTMLFormElement.prototype.cloneNode.call(e.target),n=e.submitter;if((n?.formTarget||t.target)===`_blank`||(n?.formMethod||t.method)!==`get`)return;let r=new URL(n?.hasAttribute(`formaction`)&&n?.formAction||t.action);if(O(r,x,!1))return;let i=e.target,a=D(i);if(a.reload)return;e.preventDefault(),e.stopPropagation();let o=new FormData(i,n);r.search=new URLSearchParams(o).toString(),Q({type:`form`,url:r,keepfocus:a.keepfocus,noscroll:a.noscroll,replace_state:a.replace_state??r.href===location.href,event:e})}),addEventListener(`popstate`,async t=>{if(!Nt)if(t.state?.[`sveltekit:history`]){let n=t.state[S];if(Z={},n===Y)return;let r=N[n],i=t.state[`sveltekit:states`]??{},a=new URL(t.state[`sveltekit:pageurl`]??location.href),o=t.state[C],s=G.url?m(location)===m(G.url):!1;if(o===X&&(Ze||s)){i!==k.state&&(k.state=i),e(a),N[Y]=T(),r&&scrollTo(r.x,r.y),Y=n;return}let c=n-Y;await Q({type:`popstate`,url:a,popped:{state:i,scroll:r,delta:c},accept:()=>{Y=n,X=o},block:()=>{history.go(-c)},nav_token:Z,event:t})}else J||(e(new URL(location.href)),z.hash&&location.reload())}),addEventListener(`hashchange`,()=>{J&&(J=!1,history.replaceState({...history.state,[S]:++Y,[C]:X},``,location.href))});for(let e of document.querySelectorAll(`link`))Re.has(e.rel)&&(e.href=e.href);addEventListener(`pageshow`,e=>{e.persisted&&F.navigating.set(A.current=null)});function e(e){G.url=k.url=e,F.page.set(It(k)),F.page.notify()}}async function jt(e,{status:t=200,error:n,node_ids:r,params:i,route:a,server_route:o,data:s,form:c}){Ye=!0;let u=new URL(location.href),d;({params:i={},route:a={id:null}}=await St(u,!1)||{}),d=Ue.find(({id:e})=>e===a.id);let f,p=!0;try{let e=r.map(async(t,n)=>{let r=s[n];return r?.uses&&(r.uses=Mt(r.uses)),ft({loader:z.nodes[t],url:u,params:i,route:a,parent:async()=>{let t={};for(let r=0;r<n;r+=1)Object.assign(t,(await e[r]).data);return t},server_data_node:ht(r)})}),o=await Promise.all(e);if(d){let e=d.layouts;for(let t=0;t<e.length;t++)e[t]||o.splice(t,0,void 0)}f=await dt({url:u,params:i,branch:o,status:t,error:n,errors:d?.errors,form:c,route:d??null})}catch(t){if(t instanceof l){await I(new URL(t.location,location.href));return}f=await bt({status:ke(t),error:await $(t,{url:u,params:i,route:a}),url:u,route:a}),e.textContent=``,p=!1}f.props.page&&(f.props.page.state={}),await ut(f,e,p)}function Mt(e){return{dependencies:new Set(e?.dependencies??[]),params:new Set(e?.params??[]),parent:!!e?.parent,route:!!e?.route,url:!!e?.url,search_params:new Set(e?.search_params??[])}}var Nt=!1;function Pt(e,t=!0){let n=document.querySelector(`[autofocus]`);if(n)n.focus();else{let n=Rt(e);if(n&&document.getElementById(n)){let{x:r,y:i}=T();setTimeout(()=>{let a=history.state;Nt=!0,location.replace(new URL(`#${n}`,location.href)),history.replaceState(a,``,e),t&&scrollTo(r,i),Nt=!1})}else{let e=document.body,t=e.getAttribute(`tabindex`);e.tabIndex=-1,e.focus({preventScroll:!0,focusVisible:!1}),t===null?e.removeAttribute(`tabindex`):e.setAttribute(`tabindex`,t)}let r=getSelection();if(r&&r.type!==`None`){let e=[];for(let t=0;t<r.rangeCount;t+=1)e.push(r.getRangeAt(t));setTimeout(()=>{if(r.rangeCount===e.length){for(let t=0;t<r.rangeCount;t+=1){let n=e[t],i=r.getRangeAt(t);if(n.commonAncestorContainer!==i.commonAncestorContainer||n.startContainer!==i.startContainer||n.endContainer!==i.endContainer||n.startOffset!==i.startOffset||n.endOffset!==i.endOffset)return}r.removeAllRanges()}})}}}function Ft(e,t,n,r,i=null){let a,o,s=new Promise((e,t)=>{a=e,o=t});return s.catch(()=>{}),{navigation:{from:{params:e.params,route:{id:e.route?.id??null},url:e.url,scroll:T()},to:n&&{params:t?.params??null,route:{id:t?.route?.id??null},url:n,scroll:i},willUnload:!t,type:r,complete:s},fulfil:a,reject:o}}function It(e){return{data:e.data,error:e.error,form:e.form,params:e.params,route:e.route,state:e.state,status:e.status,url:e.url}}function Lt(e){let t=new URL(e);return t.hash=decodeURIComponent(e.hash),t}function Rt(e){let t;if(z.hash){let[,,n]=e.hash.split(`#`,3);t=n??``}else t=e.hash.slice(1);return decodeURIComponent(t)}export{k as a,A as i,nt as n,j as o,F as r,Te as s,Ot as t};
@@ -1 +0,0 @@
1
- import"../chunks/rEsbAd0y.js";import{n as e,s as t}from"../chunks/g-mSZff4.js";import"../chunks/Bo0U8J3e.js";export{t as load_css,e as start};