@liip/liipgpt 3.12.0 → 3.12.1

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 +3 -3
  2. package/chat/liipgpt-chat.js +3 -3
  3. package/config/index.d.ts +7 -1
  4. package/configurator/_app/env.js +1 -1
  5. package/configurator/_app/immutable/chunks/{qdgQQPPN.js → BGriYQSA.js} +1 -1
  6. package/configurator/_app/immutable/chunks/BOogcmRI.js +1 -0
  7. package/configurator/_app/immutable/chunks/{DWQwd7UL.js → BgPvdYLz.js} +1 -1
  8. package/configurator/_app/immutable/chunks/{DS0EeZTa.js → BzwH5m-K.js} +1 -1
  9. package/configurator/_app/immutable/chunks/{o5n3JJnR.js → C7SVO0yB.js} +1 -1
  10. package/configurator/_app/immutable/chunks/{IVrT20gg.js → CrAgD5Zd.js} +1 -1
  11. package/configurator/_app/immutable/chunks/{B4lUgYsH.js → CxsmcPPu.js} +1 -1
  12. package/configurator/_app/immutable/chunks/{BTdvPkyd.js → DmafQ_KV.js} +1 -1
  13. package/configurator/_app/immutable/chunks/{BAn02Khb.js → lj2Jt22R.js} +2 -2
  14. package/configurator/_app/immutable/entry/{app.CFzWtUmE.js → app.CFqiYWk3.js} +2 -2
  15. package/configurator/_app/immutable/entry/start.CT4FgDr_.js +1 -0
  16. package/configurator/_app/immutable/nodes/{0.C5XdevBn.js → 0.DwmuWxZI.js} +1 -1
  17. package/configurator/_app/immutable/nodes/{1.SYxOPfTY.js → 1.Bjv1gqx4.js} +1 -1
  18. package/configurator/_app/immutable/nodes/{2.Bldafw2d.js → 2.CyWhas6h.js} +3 -3
  19. package/configurator/_app/immutable/nodes/{3.DamO4w17.js → 3.BlXQFvKY.js} +1 -1
  20. package/configurator/_app/version.json +1 -1
  21. package/configurator/index.html +6 -6
  22. package/configurator/sidebar.html +6 -6
  23. package/index.cjs +5 -5
  24. package/index.d.ts +12 -2
  25. package/index.js +5 -5
  26. package/package.json +1 -1
  27. package/search-summary/liipgpt-search-summary.iife.js +2 -2
  28. package/search-summary/liipgpt-search-summary.js +2 -2
  29. package/configurator/_app/immutable/chunks/z-U4HNd3.js +0 -1
  30. package/configurator/_app/immutable/entry/start.CmVJPKRp.js +0 -1
@@ -1,4 +1,4 @@
1
- import{r as e,t}from"./CibALFW0.js";import{$ as n,A as r,B as i,Ct as a,D as o,Dt as s,E as c,Ft as l,G as u,Gt as d,H as f,Ht as p,I as m,It as h,J as g,K as _,L as v,Lt as y,M as b,Mt as x,N as S,O as C,Pt as w,Q as T,Rt as E,St as D,T as O,Tt as k,U as A,V as j,Wt as ee,X as M,Y as N,Z as te,_ as ne,_t as re,at as ie,bt as P,c as ae,ct as oe,d as se,f as ce,ft as le,g as F,gt as ue,ht as I,i as L,it as de,jt as fe,k as pe,kt as R,lt as me,mt as z,nt as he,o as B,ot as V,p as ge,q as _e,qt as H,r as ve,rt as ye,s as U,tt as be,u as xe,v as W,x as Se,xt as G,yt as Ce,z as we,zt as Te}from"./DK3lEKRX.js";import{t as Ee}from"./DjVmpym-.js";import{i as De,n as Oe,r as ke,t as Ae}from"./hJTLHSgs.js";import{a as je,i as Me,n as Ne,t as Pe}from"./BJVrdkuG.js";import{_ as Fe,a as Ie,b as Le,c as Re,d as ze,f as Be,h as Ve,i as He,m as Ue,p as We,r as Ge,s as Ke,u as qe,y as Je}from"./BAn02Khb.js";import{n as K,t as Ye}from"./DHHLckcz.js";var Xe={randomUUID:typeof crypto<`u`&&crypto.randomUUID&&crypto.randomUUID.bind(crypto)};function Ze(e,t,n){e||={};let r=e.random??e.rng?.()??Ue();if(r.length<16)throw Error(`Random bytes length must be >= 16`);if(r[6]=r[6]&15|64,r[8]=r[8]&63|128,t){if(n||=0,n<0||n+16>t.length)throw RangeError(`UUID byte range ${n}:${n+15} is out of buffer bounds`);for(let e=0;e<16;++e)t[n+e]=r[e];return t}return Ve(r)}function Qe(e,t,n){return Xe.randomUUID&&!t&&!e?Xe.randomUUID():Ze(e,t,n)}var $e=t(((e,t)=>{t.exports=function e(t,n){if(t===n)return!0;if(t&&n&&typeof t==`object`&&typeof n==`object`){if(t.constructor!==n.constructor)return!1;var r,i,a;if(Array.isArray(t)){if(r=t.length,r!=n.length)return!1;for(i=r;i--!==0;)if(!e(t[i],n[i]))return!1;return!0}if(t.constructor===RegExp)return t.source===n.source&&t.flags===n.flags;if(t.valueOf!==Object.prototype.valueOf)return t.valueOf()===n.valueOf();if(t.toString!==Object.prototype.toString)return t.toString()===n.toString();if(a=Object.keys(t),r=a.length,r!==Object.keys(n).length)return!1;for(i=r;i--!==0;)if(!Object.prototype.hasOwnProperty.call(n,a[i]))return!1;for(i=r;i--!==0;){var o=a[i];if(!e(t[o],n[o]))return!1}return!0}return t!==t&&n!==n}}));function et(...e){return e.filter(Boolean).join(` `)}var tt=typeof document<`u`,nt=typeof window<`u`?window:void 0;typeof window<`u`&&window.document,typeof window<`u`&&window.navigator,typeof window<`u`&&window.location;function rt(e){let t=e.activeElement;for(;t?.shadowRoot;){let e=t.shadowRoot.activeElement;if(e===t)break;t=e}return t}new class{#e;#t;constructor(e={}){let{window:t=nt,document:n=t?.document}=e;t!==void 0&&(this.#e=n,this.#t=fe(e=>{let n=de(t,`focusin`,e),r=de(t,`focusout`,e);return()=>{n(),r()}}))}get current(){return this.#t?.(),this.#e?rt(this.#e):null}};var it=class{#e;#t;constructor(e){this.#e=e,this.#t=Symbol(e)}get key(){return this.#t}exists(){return h(this.#t)}get(){let e=l(this.#t);if(e===void 0)throw Error(`Context "${this.#e}" not found`);return e}getOr(e){let t=l(this.#t);return t===void 0?e:t}set(e){return Te(this.#t,e)}};function at(e,t){switch(e){case`post`:I(t);break;case`pre`:ue(t);break}}function ot(e,t,n,r={}){let{lazy:i=!1}=r,a=!i,o=Array.isArray(e)?[]:void 0;at(t,()=>{let t=Array.isArray(e)?e.map(e=>e()):e();if(!a){a=!0,o=t;return}let r=me(()=>n(t,o));return o=t,r})}function st(e,t,n){let r=le(()=>{let i=!1;ot(e,t,(e,t)=>{if(i){r();return}let a=n(e,t);return i=!0,a},{lazy:!0})});I(()=>r)}function ct(e,t,n){ot(e,`post`,t,n)}function lt(e,t,n){ot(e,`pre`,t,n)}ct.pre=lt;function ut(e,t){st(e,`post`,t)}function dt(e,t){st(e,`pre`,t)}ut.pre=dt;function ft(e,t){let n,r=null;return(...i)=>new Promise(a=>{r&&r(void 0),r=a,clearTimeout(n),n=setTimeout(async()=>{let t=await e(...i);r&&=(r(t),null)},t)})}function pt(e,t){let n=0,r=null;return(...i)=>{let a=Date.now();return n&&a-n<t?r??Promise.resolve(void 0):(n=a,r=e(...i),r)}}function mt(e,t,n={},r){let{lazy:i=!1,once:o=!1,initialValue:c,debounce:l,throttle:u}=n,d=s(a(c)),f=s(!1),p=s(void 0),m=s(a([])),h=()=>{V(m).forEach(e=>e()),k(m,[],!0)},g=e=>{k(m,[...V(m),e],!0)},_=async(e,n,r=!1)=>{try{k(f,!0),k(p,void 0),h();let i=new AbortController;g(()=>i.abort());let a=await t(e,n,{data:V(d),refetching:r,onCleanup:g,signal:i.signal});return k(d,a,!0),a}catch(e){e instanceof DOMException&&e.name===`AbortError`||k(p,e,!0);return}finally{k(f,!1)}},v=l?ft(_,l):u?pt(_,u):_,y=Array.isArray(e)?e:[e],b;return r((t,n)=>{o&&b||(b=t,v(Array.isArray(e)?t:t[0],Array.isArray(e)?n:n?.[0]))},{lazy:i}),{get current(){return V(d)},get loading(){return V(f)},get error(){return V(p)},mutate:e=>{k(d,e,!0)},refetch:t=>{let n=y.map(e=>e());return v(Array.isArray(e)?n:n[0],Array.isArray(e)?n:n[0],t??!0)}}}function ht(e,t,n){return mt(e,t,n,(t,n)=>{let r=Array.isArray(e)?e:[e];ct(()=>r.map(e=>e()),(e,n)=>{t(e,n??[])},n)})}function gt(e,t,n){return mt(e,t,n,(t,n)=>{let r=Array.isArray(e)?e:[e];ct.pre(()=>r.map(e=>e()),(e,n)=>{t(e,n??[])},n)})}ht.pre=gt,new it(`richColorsContext`);var _t=new it(`<Toaster/>`),vt=0,yt=class{#e=s(a([]));get toasts(){return V(this.#e)}set toasts(e){k(this.#e,e,!0)}#t=s(a([]));get heights(){return V(this.#t)}set heights(e){k(this.#t,e,!0)}#n=e=>{let t=this.toasts.findIndex(t=>t.id===e);return t===-1?null:t};addToast=e=>{tt&&this.toasts.unshift(e)};updateToast=({id:e,data:t,type:n,message:r})=>{let i=this.toasts.findIndex(t=>t.id===e),a=this.toasts[i];this.toasts[i]={...a,...t,id:e,title:r,type:n,updated:!0}};create=e=>{let{message:t,...n}=e,r=typeof e?.id==`number`||e.id&&e.id?.length>0?e.id:vt++,i=e.dismissible===void 0?e.dismissable===void 0?!0:e.dismissable:e.dismissible,a=e.type===void 0?`default`:e.type;return me(()=>{this.toasts.find(e=>e.id===r)?this.updateToast({id:r,data:e,type:a,message:t,dismissible:i}):this.addToast({...n,id:r,title:t,dismissible:i,type:a})}),r};dismiss=e=>(me(()=>{if(e===void 0){this.toasts=this.toasts.map(e=>({...e,dismiss:!0}));return}let t=this.toasts.findIndex(t=>t.id===e);this.toasts[t]&&(this.toasts[t]={...this.toasts[t],dismiss:!0})}),e);remove=e=>{if(e===void 0){this.toasts=[];return}let t=this.#n(e);if(t!==null)return this.toasts.splice(t,1),e};message=(e,t)=>this.create({...t,type:`default`,message:e});error=(e,t)=>this.create({...t,type:`error`,message:e});success=(e,t)=>this.create({...t,type:`success`,message:e});info=(e,t)=>this.create({...t,type:`info`,message:e});warning=(e,t)=>this.create({...t,type:`warning`,message:e});loading=(e,t)=>this.create({...t,type:`loading`,message:e});promise=(e,t)=>{if(!t)return;let n;t.loading!==void 0&&(n=this.create({...t,promise:e,type:`loading`,message:typeof t.loading==`string`?t.loading:t.loading()}));let r=e instanceof Promise?e:e(),i=n!==void 0;return r.then(e=>{if(typeof e==`object`&&e&&`ok`in e&&typeof e.ok==`boolean`&&!e.ok){i=!1;let t=bt(e);this.create({id:n,type:`error`,message:t})}else if(t.success!==void 0){i=!1;let r=typeof t.success==`function`?t.success(e):t.success;this.create({id:n,type:`success`,message:r})}}).catch(e=>{if(t.error!==void 0){i=!1;let r=typeof t.error==`function`?t.error(e):t.error;this.create({id:n,type:`error`,message:r})}}).finally(()=>{i&&(this.dismiss(n),n=void 0),t.finally?.()}),n};custom=(e,t)=>{let n=t?.id||vt++;return this.create({component:e,id:n,...t}),n};removeHeight=e=>{this.heights=this.heights.filter(t=>t.toastId!==e)};setHeight=e=>{let t=this.#n(e.toastId);if(t===null){this.heights.push(e);return}this.heights[t]=e};reset=()=>{this.toasts=[],this.heights=[]}};function bt(e){return e&&typeof e==`object`&&`status`in e?`HTTP error! Status: ${e.status}`:`Error! ${e}`}var xt=new yt;function St(e,t){return xt.create({message:e,...t})}var Ct=class{#e=R(()=>xt.toasts.filter(e=>!e.dismiss));get toasts(){return V(this.#e)}},wt=Object.assign(St,{success:xt.success,info:xt.info,warning:xt.warning,error:xt.error,custom:xt.custom,message:xt.message,promise:xt.promise,dismiss:xt.dismiss,loading:xt.loading,getActiveToasts:()=>xt.toasts.filter(e=>!e.dismiss)}),Tt=e=>{let t=new Set;Object.getOwnPropertyNames(e).forEach(e=>t.add(e));let n=Object.getPrototypeOf(e);for(;n&&n!==Object.prototype;)Object.getOwnPropertyNames(n).forEach(e=>t.add(e)),n=Object.getPrototypeOf(n);return Array.from(t)},Et=(e,t)=>{let n={};return t.forEach(t=>{n[t]=e[t]}),n},Dt=console.warn,Ot=()=>{},kt=(e,t)=>me(()=>{console.warn=Ot;let n=p(t?Et(e,t):e);return console.warn=Dt,n}),At=e=>e&&typeof e.then==`function`,jt=class{config;self;devtools;stateKeys;constructor(e,t){this.config=e,this.self=t,typeof window<`u`&&window.__REDUX_DEVTOOLS_EXTENSION__&&(this.stateKeys=Tt(this.config.state),this.devtools=window.__REDUX_DEVTOOLS_EXTENSION__.connect({name:this.config.name??`updatelogic`}),this.devtools.init(this.createStateSnapshot()),this.devtools.subscribe(e=>{e.type===`DISPATCH`&&e.state}))}createStateSnapshot(){return kt(this.config.state,this.stateKeys)}sendStart(e,t){this.devtools.send({type:`→ ${e}`,args:t},this.createStateSnapshot())}sendError(e,t,n){this.devtools.send({type:`❌ ${e}`,args:t,error:n},this.createStateSnapshot())}sendSuccess(e,t,n){this.devtools.send({type:`✓ ${e}`,args:t,return:n},this.createStateSnapshot())}isIncluded(e){return this.config.excludeInDevTools?!this.config.excludeInDevTools.includes(e):!0}createProxyFunction(e,t){let n=this.devtools&&this.isIncluded(e);return typeof t==`function`?(...r)=>{if(!n)return me(()=>t.call(this.self,...r));let i=kt(r);this.sendStart(e,i);try{let n=me(()=>t.call(this.self,...r));return At(n)?n.then(t=>(this.sendSuccess(e,i,t),t),t=>{throw this.sendError(e,i,t),t}):(this.sendSuccess(e,i,n),n)}catch(t){throw this.sendError(e,i,t),t}}:t}},Mt=(e,t)=>{let n={},r=new jt(e,n);return Object.keys(t).forEach(e=>{if(e===`state`||e===`name`)return;let i=t[e];n[e]=r.createProxyFunction(e,i)}),n};async function Nt(){if(typeof navigator>`u`||!navigator.mediaDevices||!navigator.mediaDevices.enumerateDevices)return!1;try{return(await navigator.mediaDevices.enumerateDevices()).some(e=>e.kind===`audioinput`)}catch(e){return console.error(`Error checking for microphone:`,e),!1}}function Pt(){return typeof window>`u`||!window.MediaRecorder?null:MediaRecorder.isTypeSupported(`audio/mp4`)?`audio/mp4`:MediaRecorder.isTypeSupported(`audio/webm`)?`audio/webm`:MediaRecorder.isTypeSupported(`audio/wav`)?`audio/wav`:null}function Ft(){return typeof window>`u`?!1:!!(window.MediaRecorder&&Pt())}function It(){if(typeof window>`u`)return!1;if(`ontouchstart`in window||navigator.maxTouchPoints>0)return!0;let e=navigator.msMaxTouchPoints;return!!(`msMaxTouchPoints`in navigator&&e&&e>0)}function Lt(){return typeof window>`u`?!1:!!(/Android|webOS|iPhone|iPad|iPod|BlackBerry|IEMobile|Opera Mini/i.test(navigator.userAgent)||It())}var Rt=class{mediaRecorder=null;audioChunks=[];started=!1;starting=!1;stream=null;options;audioContext=null;analyser=null;dataArray=null;volumeUpdateInterval=null;constructor(e={}){this.options=e}async start(){if(this.started||this.starting){console.warn(`AudioRecorder: Start already in progress or already started`);return}if(!Ft()||!navigator.mediaDevices){let e=Error(`MediaRecorder not supported or no microphone access`);throw this.options.onError?.(e),e}try{if(this.starting=!0,this.stream=await navigator.mediaDevices.getUserMedia({audio:{echoCancellation:!0,noiseSuppression:!0,autoGainControl:!0},video:!1}),!this.starting){this.stopStream(this.stream);return}this.mediaRecorder&&this.mediaRecorder.state!==`inactive`&&(console.warn(`AudioRecorder: MediaRecorder already active, stopping previous recording`),this.mediaRecorder.stop(),this.cleanup()),this.started=!0,this.starting=!1;let e=Pt();if(!e)throw Error(`No supported media type found`);let t={mimeType:e};this.mediaRecorder=new MediaRecorder(this.stream,t),this.audioChunks=[],this.mediaRecorder.ondataavailable=e=>{e.data.size>0&&this.audioChunks.push(e.data)},this.mediaRecorder.onstop=async()=>{let t=this.audioChunks.length>0?new Blob(this.audioChunks,{type:e}):null;await this.options.onDataAvailable?.(t),this.options.onStop?.(),this.cleanup()},this.mediaRecorder.onerror=e=>{let t=Error(`MediaRecorder error: ${e}`);this.options.onError?.(t),this.cleanup()},this.mediaRecorder.start(),this.setupVolumeAnalysis(this.stream),this.options.onStart?.()}catch(e){this.started=!1,this.starting=!1;let t=e instanceof Error?e:Error(String(e));throw this.options.onError?.(t),t}}stop(){this.started=!1,this.starting=!1,this.volumeUpdateInterval&&=(clearInterval(this.volumeUpdateInterval),null),this.mediaRecorder&&this.mediaRecorder.state!==`inactive`?this.mediaRecorder.stop():(this.stream&&this.stopStream(this.stream),this.cleanup())}setupVolumeAnalysis(e){if(this.options.onVolumeChange)try{this.audioContext=new AudioContext,this.analyser=this.audioContext.createAnalyser(),this.analyser.fftSize=256,this.analyser.smoothingTimeConstant=.8;let t=this.analyser.frequencyBinCount;this.dataArray=new Uint8Array(t),this.audioContext.createMediaStreamSource(e).connect(this.analyser),this.startVolumeMonitoring()}catch(e){console.warn(`Failed to set up volume analysis:`,e)}}startVolumeMonitoring(){!this.analyser||!this.dataArray||!this.options.onVolumeChange||(this.volumeUpdateInterval=window.setInterval(()=>{if(!this.analyser||!this.dataArray||!this.started)return;this.analyser.getByteFrequencyData(this.dataArray);let e=0;for(let t=0;t<this.dataArray.length;t++)e+=this.dataArray[t]*this.dataArray[t];let t=Math.sqrt(e/this.dataArray.length)/255;t=(t*3)**.7;let n=Math.min(100,Math.max(0,Math.round(t*100)));this.options.onVolumeChange?.(n)},100))}get recording(){return this.started&&this.mediaRecorder?.state===`recording`}get isStarting(){return this.starting}stopStream(e){e.getTracks().forEach(e=>e.stop())}cleanup(){this.volumeUpdateInterval&&=(clearInterval(this.volumeUpdateInterval),null),this.audioContext&&=(this.audioContext.close().catch(console.warn),null),this.analyser=null,this.dataArray=null,this.stream&&=(this.stopStream(this.stream),null),this.mediaRecorder=null,this.audioChunks=[],this.started=!1,this.starting=!1}static isSupported(){return Ft()}static getSupportedMediaType(){return Pt()}},zt=Le(),Bt=(e,t)=>{if(e instanceof HTMLTextAreaElement&&t instanceof HTMLTextAreaElement){t.textContent=e.value;return}if(e instanceof HTMLSelectElement&&t instanceof HTMLSelectElement){Array.from(e.options).forEach((e,n)=>{t.options[n]&&(t.options[n].selected=e.selected)});return}e instanceof HTMLInputElement&&t instanceof HTMLInputElement&&(t.setAttribute(`value`,e.value),(e.type===`checkbox`||e.type===`radio`)&&(e.checked?t.setAttribute(`checked`,`checked`):t.removeAttribute(`checked`)))},Vt=e=>{let t=e.cloneNode(!0);if(!(t instanceof Element))return``;let n=`input, textarea, select`,r=e.querySelectorAll(n),i=t.querySelectorAll(n);return r.forEach((e,t)=>{let n=i[t];n&&Bt(e,n)}),zt.sanitize(t.outerHTML,{FORBID_TAGS:[`style`,`script`],FORBID_ATTR:[`style`,`class`]})},Ht=e=>{if(!e?.length)return[];let t=e.join(`,`),n=document.querySelectorAll(t);return Array.from(n,Vt)},Ut=`liipgpt:context`,Wt=class{contextVersion=0;#e=s();get currentContext(){return V(this.#e)}set currentContext(e){k(this.#e,e,!0)}getFromLocalStorage(){let e=localStorage.getItem(Ut);if(e){let t;try{if(t=JSON.parse(e),t.version!==this.contextVersion){localStorage.removeItem(Ut);return}else return t.context}catch(e){console.error(`Failed to parse liipgpt:context`,e);return}}}storeToLocalStorage(){localStorage.setItem(`liipgpt:context`,JSON.stringify({version:K.data.chatConfig.contextVersion,context:this.currentContext}))}constructor(e){this.init=e,this.currentContext=this.getFromLocalStorage()??e.initialValue}getContext(){return p(this.currentContext)}setContextVersion(e){this.contextVersion=e}setContext(e){this.currentContext=e,this.storeToLocalStorage()}resetContext(){this.currentContext=this.init.initialValue,this.storeToLocalStorage()}updateContext(e){this.setContext(e(this.currentContext))}},Gt=()=>localStorage.getItem(Ut),Kt=`liipgpt:selectorValues`,qt=`liipgpt:selectorKnownDefaults`,Jt=()=>{try{let e=We.getItem(Kt),t=We.getItem(qt);return e?{values:JSON.parse(e),knownDefaults:t?JSON.parse(t):{}}:null}catch{return null}},Yt=e=>{let t={};for(let n of e)t[n.settingName]=n.defaultValues??(n.allowEmpty?[]:[n.values[0]]).filter(Boolean);return t},Xt=(e,t)=>{try{let n=Yt(t);We.setItem(Kt,JSON.stringify(e)),We.setItem(qt,JSON.stringify(n))}catch(e){console.error(`Failed to save selector values:`,e)}},Zt=e=>{try{let t=Jt();if(!t)return;delete t.values[e],delete t.knownDefaults[e],We.setItem(Kt,JSON.stringify(t.values)),We.setItem(qt,JSON.stringify(t.knownDefaults))}catch(e){console.error(`Failed to clear selector saved state:`,e)}},Qt=e=>{let t=Jt(),n=e.map(e=>{let n=e.defaultValues??(e.allowEmpty?[]:[e.values[0]]).filter(Boolean);if(!t?.values[e.settingName])return[e.settingName,n];let r=t.values[e.settingName],i=t.knownDefaults[e.settingName]||[],a=r.filter(t=>e.values.includes(t)),o=i.filter(e=>!n.includes(e)),s=a.filter(e=>!o.includes(e)),c=n.filter(e=>!i.includes(e)&&!s.includes(e)),l=[...s,...c];return l.length===0&&!e.allowEmpty?[e.settingName,n]:[e.settingName,l]});return Object.fromEntries(n)},$t=class extends Error{constructor(e){super(e),this.name=`UnreachableError`}},en=e($e(),1),tn=(e,t)=>{if(!e)return;let n=t.find(t=>t.id===e);return n||console.warn(`autofire-predefined-question-id="${e}" did not match any loaded predefined question. Falling back to default routing.`),n},nn=(e,t,n,r,i)=>{if(e&&!t)return{name:`consent-page`};let a=new URLSearchParams(window.location.search),o=a.get(`q`),s=a.get(`id`)??void 0,c=a.get(`sid`)??void 0;return o?{name:`chat-page`,query:o,predefinedQuestionId:s,switchQuestionId:c}:i?{name:`chat-page`,query:i}:r?{name:`chat-page`,query:r.question,predefinedQuestionId:r.id}:n?{name:`chat-page`}:{name:`start-page`}},rn=`follow-up-q`,an=e=>/^[0-9a-f]{8}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{12}$/i.test(e),on=()=>{let e=new URLSearchParams(window.location.hash.replace(/^#/,``)).get(`cID`)??void 0;return{cID:e&&an(e)?e:void 0,followUpQuestion:new URLSearchParams(window.location.search).get(rn)?.trim()||void 0}},sn=()=>{let e=new URLSearchParams(window.location.search);if(!e.has(rn))return;e.delete(rn);let t=e.toString();history.replaceState(null,``,`${window.location.pathname}${t?`?${t}`:``}${window.location.hash}`)},cn=e=>{if(e)try{let t=JSON.parse(e);if(t&&typeof t==`object`&&!Array.isArray(t))return t;console.warn(`additional-start-parameters must be a JSON object. Received: ${e}`);return}catch(t){console.warn(`Failed to parse additional-start-parameters as JSON: ${e}`,t);return}},ln=e=>{let t=cn(e);return t?(e=>Array.isArray(e)?e.map(String):typeof e==`string`?e.split(`,`).map(e=>e.trim()).filter(Boolean):[])(t.scopeAvailableSlugs).length===1:!1},un=e=>e?e.map(e=>({id:Qe(),...e})):[],dn,fn,pn,q=Mt({name:`chat-logic`,state:K,excludeInDevTools:[`onInput`]},{async init(e){fn=e;let t=fn.speechRecognitionApiKey||void 0;dn=new qe({apiUrl:fn.apiUrl,apiKey:fn.apiKey,speechRecognitionApiKey:t,strict:!0,startParameters:cn(fn.additionalStartParameters)});try{let e=await dn.getChatConfig();window.CHAT_CONFIG_OVERRIDE&&Object.assign(e,window.CHAT_CONFIG_OVERRIDE);let t=(await dn.getMetadata()).mode===`maintenance`;t&&this.showErrorToast(`maintenance`);let n=De(e);fn.inlineLayout!==void 0&&(n.inlineLayout=fn.inlineLayout),fn.forceChatPage!==void 0&&(n.forceChatPage=fn.forceChatPage);let r;r=fn.lang?Ne(fn.lang,n.supportedLanguages):Pe(n.supportedLanguages),je(r,K.targets.mainElement);let i=await this.getPredefinedQuestions(r),a=n.translations[r]?.ariaOpensInNewTab;a&&dn.setNewTabSrText(a);let o=[];if(n.renderKatex){let e=await Ee(()=>import(`https://esm.sh/marked-katex-extension@5.1.5`),[],import.meta.url).catch(e=>{console.error(`Couldn't load marked-katex-extension:`,e)});e&&(dn.setMarkedExtensions(e.default({nonStandard:!0,output:`mathml`})),o.push(`https://cdn.jsdelivr.net/npm/katex@0.16.22/dist/katex.min.css`))}let s=Object.keys(n.fullTheme),c=!1;if(n.forceConsent)try{c=We.getItem(`liipgpt:termsAccepted`)===`true`}catch(e){console.warn(`Failed to load terms acceptance from storage:`,e)}let l=tn(fn.autofirePredefinedQuestionId,i);K.data={currentConversationState:`idle`,chatConfig:n,language:r,predefinedQuestions:i,isInMaintenance:t,history:un(n.messageAdditions.init),selectedColorScheme:Oe(),has2ColorSchemes:s.length===2,currentColorScheme:Ae(s),conversationFeedbackId:void 0,conversationFeedbackIsOpen:!1,answerFormMessageId:void 0,openedPopup:void 0,props:fn,flyoutIsOpen:!1,questionHasPii:void 0,chatInputValue:``,selectorValues:Qt(n.selectorsConfig),selectorsIsOpen:!1,predefinedQuestionId:void 0,switchQuestionId:void 0,currentReferencesAsideId:void 0,ariaLiveStatusMessage:void 0,ariaLiveStatusMessageClearingTimeout:void 0,wasReferencesAsideClosed:!1,isAsideMobile:!0,route:nn(n.forceConsent??!1,c,n.forceChatPage??!1,l,fn.question),additionalStylesheets:o,hasOpenedOverlays:!1,isInlineLayoutContained:!1,termsAccepted:c,selectedTopic:void 0},window.LIIPGPT_LISTENERS?.route?.(K.data.route),window.LIIPGPT_LISTENERS?.conversation?.(K.data.currentConversationState),K.data.selectorsIsOpen=K.data.chatConfig.showExpandedSelectors??!1,K.initialized=!0,this.checkForOpenedPopup(),window.addEventListener(`hashchange`,()=>{this.checkForOpenedPopup()}),await this.startFromHandoverOrRoute(()=>this.goto(nn(n.forceConsent??!1,c,n.forceChatPage??!1,l,fn.question),!0))}catch(e){throw wt.error(e instanceof Error?e.message:`Failed to load the chatbot. Please reload the page.`,{duration:1e4,unstyled:!0,classes:{toast:`toast`}}),e}},setTarget(e,t){K.targets[e]=t},goto(e,t=!1){if(!(!t&&(0,en.default)(K.data.route,e)))switch(K.data.route=e,window.LIIPGPT_LISTENERS?.route?.(e),e.name){case`consent-page`:break;case`start-page`:e.prefill&&(K.data.chatInputValue=e.prefill);break;case`chat-page`:if(K.data.chatInputValue=e.query??``,K.data.predefinedQuestionId=e.predefinedQuestionId,K.data.switchQuestionId=e.switchQuestionId,e.query&&(this.onSubmit(),K.data.chatConfig.addQueryToUrlParams)){let t=new URLSearchParams(window.location.search);t.set(`q`,e.query),e.predefinedQuestionId?t.set(`id`,e.predefinedQuestionId):t.delete(`id`),e.switchQuestionId?t.set(`sid`,e.switchQuestionId):t.delete(`sid`),history.pushState(null,``,`?${t.toString()}${window.location.hash}`)}break}},getSelectorConfig(e){let t=K.data.chatConfig.selectorsConfig.find(t=>t.settingName===e);if(!t)throw Error(`Setting ${e} not found`);return t},getPrettifiedSelectorValues(){let e=Object.entries(K.data.selectorValues).map(([e,t])=>{let n;try{n=this.getSelectorConfig(e)}catch(t){console.error(`Error getting selector config for ${e}: ${t}`);return}return n.type===`single-select`?[e,t[0]]:[e,t]}).filter(e=>!!e);return Object.fromEntries(e)},setSelectorValue(e,t){let n=this.getSelectorConfig(e);if(!n){console.warn(`Trying to set setting ${e} but it is not defined in the chat config`);return}if(n.type===`single-select`&&t.length>1){console.warn(`Trying to set multiple values for single-select setting ${e}`);return}K.data.selectorValues[e]=t,Xt(K.data.selectorValues,K.data.chatConfig.selectorsConfig)},resetSelectorToDefaults(e){let t=this.getSelectorConfig(e);if(!t){console.warn(`Trying to reset setting ${e} but it is not defined in the chat config`);return}let n=t.defaultValues??(t.allowEmpty?[]:[t.values[0]]).filter(Boolean);return Zt(e),K.data.selectorValues[e]=n,Xt(K.data.selectorValues,K.data.chatConfig.selectorsConfig),n},async getPredefinedQuestions(e){if(fn?.hidePredefinedQuestions)return[];try{return dn.getPredefinedQuestions({url:window.location.origin+window.location.pathname,language:e})}catch(e){return console.warn(`Failed to load predefined questions:`,e),[]}},setColorScheme(e){K.data.selectedColorScheme=e,K.data.currentColorScheme=ke(e),this.setAriaLiveStatusMessage(e===`dark`?K.t.ariaDarkSelected:K.t.ariaLightSelected)},async abort(){await pn?.abort()},changeConversationState(e){K.data.currentConversationState=e,window.LIIPGPT_LISTENERS?.conversation?.(e)},onInput(e){K.data.chatConfig.blockPII&&(K.data.questionHasPii=Fe(e)),K.data.chatInputValue=e,K.data.predefinedQuestionId=void 0,K.data.switchQuestionId=void 0},onSubmit(e=!1,t,n=!1){let r=Ht(K.data.chatConfig.parentPageContext?.extractSelectors);if(K.data.questionHasPii){console.warn(`Question contains PII, not submitting:`,K.data.questionHasPii);return}let i=K.data.chatConfig.questionPrefix?`${K.data.chatConfig.questionPrefix} ${K.data.chatInputValue}`:K.data.chatInputValue;n||(K.data.history.push(...un(K.data.chatConfig.messageAdditions.user.before)),K.data.history.push({type:`user`,time:new Date().toISOString(),message:K.data.chatInputValue}),K.data.history.push(...un(K.data.chatConfig.messageAdditions.user.after)));let a=K.data.history.push(...un(K.data.chatConfig.messageAdditions.bot.before));K.data.history.push({id:`UNRESOLVED`,state:`loading`,errors:[],type:`bot`,time:new Date().toISOString(),message:{markdown:``,html:``,text:``},references:{all:[],used:[],unused:[]}});let o=!1,s=!1,c={features:fn.features?fn.features.trim().split(`,`):[`formatting`],mode:fn.mode||void 0,cache:fn.cache||void 0,onError:e=>{this.showErrorToast(e),window.LIIPGPT_LISTENERS?.error?.(e),(e===`pii-detected`||e===`blocked`)&&this.editLatestQuestion()},onMessage:e=>{e.type===`topic-selected`&&(K.data.selectedTopic={label:e.label,placeholder:e.placeholder,locked:ln(fn.additionalStartParameters)}),e.type===`state`&&e.state!==`history-entry-initialized`&&!s&&(s=!0,this.setAriaLiveStatusMessage(K.t.ariaQuestionSent))},lang:K.data.language,selectorValues:{...this.getPrettifiedSelectorValues(),context:Gt(),...t},predefinedQuestionId:K.data.predefinedQuestionId,switchQuestionId:K.data.switchQuestionId,onEmbed:e=>{let t=K.data.history[a];t&&t.type===`bot`&&!t.message.markdown?(K.data.history[a]={...e,id:t.id??Qe()},o=!0):K.data.history.push({...e,id:Qe()})}};K.data.predefinedQuestionId=void 0,K.data.switchQuestionId=void 0,r.length&&(c.selectorValues.parentPageContextHtml=r);let l=(e,t)=>{try{let n=new URL(e),r=new URL(t);return n.origin===r.origin&&n.pathname===r.pathname}catch{return!1}},u=K.data.chatConfig.sendReferrer??`all`;if([`all`,`own`,`location`].includes(u)){let e=u===`location`||K.data.props.flyout,t;t=e?`${window.location.protocol}//${window.location.host}${window.location.pathname}`:l(document.referrer,window.location.href)?null:document.referrer;let n=u===`own`&&!K.data.props.flyout&&t&&!t.startsWith(window.location.origin);c.referrer=t&&!n?t:void 0}K.data.props.source?c.source=K.data.props.source:K.data.props.flyout&&(c.source=`flyout`),K.data.currentConversationId||(K.data.currentConversationId=dn.createConversationId());let d=dn.chat(K.data.currentConversationId,i,c);pn=d,K.data.lastChatResponseId=d.id,K.data.currentConversationState!==`searching`&&this.changeConversationState(`searching`);let f=!1,p,m=!!K.data.currentReferencesAsideId;(e&&m||!e&&K.data.chatConfig.showReferencesByDefault)&&(K.data.isAsideMobile||this.openReferencesAside(d.id)),d.subscribe(e=>{if(!o&&K.data.history[a]&&(K.data.history[a]={question:K.data.chatInputValue,...e}),K.data.chatConfig.addRetrievalQuestionToUrlParams&&e.retrievalQuestion){let t=new URLSearchParams(window.location.search);t.get(`search`)!==e.retrievalQuestion&&(t.set(`search`,e.retrievalQuestion),history.replaceState(null,``,`?${t.toString()}${window.location.hash}`))}K.data.chatConfig.showReferencesByDefault&&!K.data.wasReferencesAsideClosed&&K.data.currentReferencesAsideId!==e.id&&!K.data.isAsideMobile&&this.openReferencesAside(e.id),e.state===`streaming`&&K.data.currentConversationState!==`answering`&&this.changeConversationState(`answering`),e.state===`done`&&(this.changeConversationState(`idle`),f||(f=!0,this.setAriaLiveStatusMessage(`${K.t.ariaAnswerReady} ... ${e.message.text} ... ${K.data.selectedTopic?K.t.ariaAnswerFinishedWithSelectedTopic:K.t.ariaAnswerFinished}`),K.data.history.push(...un(K.data.chatConfig.messageAdditions.bot.after))),K.data.currentReferencesAsideId&&e.references.used.length>0?(clearTimeout(p),p=setTimeout(()=>{this.openReferencesAside(e.id)},100)):this.closeReferencesAside())}),K.data.chatInputValue=``},async onStartSpeechRecognition(){try{if(!await Nt()){this.showErrorToast(`speech-not-supported`);return}if(await navigator.mediaDevices.getUserMedia({audio:!0}),Rt.isSupported())K.data.chatInputValue=``,K.currentAudioRecorder=new Rt({onDataAvailable:async e=>{K.isTranscribing=!0,await this.handleTranscription(e)},onError:()=>{this.showErrorToast(`speech-microphone-access-denied`),K.currentAudioRecorder=null,K.isTranscribing=!1},onVolumeChange:e=>{K.currentAudioVolume=e}}),K.currentAudioRecorder.start();else{this.showErrorToast(`speech-not-supported`);return}}catch(e){throw this.showErrorToast(`speech-microphone-access-denied`),K.currentAudioRecorder=null,K.isTranscribing=!1,e}},editLatestQuestion(){let e=K.data.history.findLastIndex(e=>e?.type===`user`);if(e===-1){console.error(`No last user question, available`);return}let t=K.data.history.splice(e)[0];K.data.chatInputValue=t.message},onStopSpeechRecognition(){if(K.currentAudioRecorder){let e=K.currentAudioRecorder;K.currentAudioRecorder=null,e.stop()}K.currentAudioVolume=0},async handleTranscription(e){if(!e){console.warn(`No audio data received`);return}try{let t=await dn.transcribeAudio(e,{lang:K.data.language});if(t.error){this.showErrorToast(`speech-transcription-failed`);return}if(t.transcript.trim()){if(K.data.chatConfig.blockPII&&(K.data.questionHasPii=Fe(t.transcript.trim()),K.data.questionHasPii))return;K.data.chatInputValue=t.transcript.trim()}else this.showErrorToast(`speech-no-text-detected`)}catch(e){console.error(`Speech transcription error:`,e),this.showErrorToast(`speech-transcription-failed`)}finally{K.currentAudioRecorder=null,K.isTranscribing=!1,K.currentAudioVolume=0}},async startFromHandoverOrRoute(e){let{cID:t,followUpQuestion:n}=on();if(!t){e();return}let r=await this.rehydrateFromSearchSummaryHandover(t);n?(K.data.route={name:`chat-page`},K.data.chatInputValue=n,this.onSubmit(!0)):r||e(),sn()},async rehydrateFromSearchSummaryHandover(e){K.data.currentConversationId=e;let t=await dn.getMetadata(),n=t.mode===`ready`?t.userId:void 0,r=n?await dn.getChatHistory(e,n):[];if(r.length===0)return K.data.currentConversationId=void 0,!1;let i={all:[],used:[],unused:[]},a=new Je({newTabSrText:K.t.ariaOpensInNewTab}),o=[];for(let{question:e,answer:t}of r)o.push({type:`user`,time:new Date().toISOString(),message:e,id:Qe()}),o.push({id:Qe(),state:`done`,errors:[],type:`bot`,time:new Date().toISOString(),message:{markdown:t,html:a.toHTML(t,i),text:t},references:{all:[],used:[],unused:[]}});return K.data.history=[...un(K.data.chatConfig.messageAdditions.init),...o],K.data.route={name:`chat-page`},!0},async onStartConversation(e,t,n){await this.abort(),K.data.history=un(K.data.chatConfig.messageAdditions.init),K.data.currentConversationId=dn.createConversationId(),this.goto({name:`chat-page`,query:e,predefinedQuestionId:t,switchQuestionId:n})},async onNewConversation(){await this.abort();let e=K.data.currentConversationId;if(K.data.currentConversationId=void 0,K.data.currentReferencesAsideId=void 0,K.data.history=un(K.data.chatConfig.messageAdditions.init),K.data.predefinedQuestionId=void 0,K.data.switchQuestionId=void 0,K.data.selectedTopic=void 0,K.data.chatConfig.addQueryToUrlParams){let e=new URLSearchParams(window.location.search);e.delete(`q`),e.delete(`id`),e.delete(`sid`),history.pushState(null,``,`?${e.toString()}${window.location.hash}`)}this.goto({name:`start-page`}),e&&dn.userAction(`newDiscussion`,{conversationId:e,lang:K.data.language}).catch(e=>{console.error(`Failed to notify backend of new discussion:`,e)})},async onChangeTopic(){let e=K.data.chatConfig.selectedTopicResetPredefinedQuestionId;if(!e){console.warn("No selectedTopicResetPredefinedQuestionId available to reset the selected topic. Set it in the `Config DB` in the backend, in a `generalConfig` default set.");return}await this.abort(),K.data.selectedTopic=void 0,K.data.predefinedQuestionId=e,K.data.switchQuestionId=void 0,K.data.chatInputValue=``,this.onSubmit(!0,void 0,!0)},showSuccessToast(e){wt.success(K.t[e],{unstyled:!0,duration:3e3,classes:{toast:`toast`}})},showErrorToast(e){wt.error(K.errorTranslations[e],{unstyled:!0,duration:3e3,classes:{toast:`toast`}})},async submitFeedback(e){try{let t=K.data.conversationFeedbackId||K.data.lastChatResponseId;if(!t)throw new $t(`Tried to give feedback with no id.`);let n=K.data.history.find(e=>e.type===`bot`&&e.id===t);await dn.feedback(t,n?.question??``,e),setTimeout(()=>{this.showSuccessToast(`thankYouForFeedback`)},500)}catch(e){console.error(`Feedback failed:`,e),this.showErrorToast(`feedback-failed`)}},toggleReferencesAside(e){K.data.currentReferencesAsideId===e?this.closeReferencesAside():this.openReferencesAside(e)},openReferencesAside(e){K.data.chatConfig.referencesLayout!==`inline`&&(K.data.currentReferencesAsideId=e,this.setOpenOverlay(!0))},closeReferencesAside(){K.data.currentReferencesAsideId=void 0,K.data.wasReferencesAsideClosed=!0,this.setOpenOverlay(!1)},setAsideMobile(e){K.data.isAsideMobile=e},openFlyout(){K.data.flyoutIsOpen=!0},closeFlyout(){K.data.flyoutIsOpen=!1},openConversationFeedback(){K.data.conversationFeedbackIsOpen=!0,this.setOpenOverlay(!0)},openMessageFeedback(e){K.data.conversationFeedbackId=e},closeFeedback(){K.data.conversationFeedbackIsOpen=!1,K.data.conversationFeedbackId=void 0,this.setOpenOverlay(!1)},openAnswerForm(e){K.data.answerFormMessageId=e,this.setOpenOverlay(!0)},closeAnswerForm(){K.data.answerFormMessageId=void 0,this.setOpenOverlay(!1)},async submitAnswerForm(e){try{let t=K.data.chatConfig.answerForm,n=K.data.answerFormMessageId;if(!t)throw new $t(`Tried to submit the answer form with no answerForm config.`);if(!n)throw new $t(`Tried to submit the answer form with no message id.`);let r=K.data.history.findIndex(e=>e.type===`bot`&&e.id===n),i=r===-1?void 0:K.data.history[r],a=K.data.history.slice(0,r===-1?void 0:r).findLast(e=>e.type===`user`)?.message,o=i?.question||a||(i?.type===`bot`?i.retrievalQuestion??``:``);await dn.submitAnswerForm({receiverEmail:t.receiverEmail,fields:t.fields.map(t=>({name:t.name,value:e[t.name]??``})),question:o,answer:i?.type===`bot`?i.message.text:``,requestId:n,lang:K.data.language}),setTimeout(()=>{this.showSuccessToast(`answerFormThankYou`)},500)}catch(e){console.error(`Answer form submission failed:`,e),this.showErrorToast(`answer-form-failed`)}},setOpenOverlay(e){K.data.hasOpenedOverlays=e},setAriaLiveStatusMessage(e){K.data.ariaLiveStatusMessage=e,clearTimeout(K.data.ariaLiveStatusMessageClearingTimeout),K.data.ariaLiveStatusMessageClearingTimeout=setTimeout(()=>{K.data.ariaLiveStatusMessage=``},K.ariaLiveMessagesClearingTimeoutDuration)},closePopup(){window.location.hash=``},checkForOpenedPopup(){let e=window.location.hash.slice(1),t=K.t.popups?.find(t=>t.hash===e);t?K.data.openedPopup=t:K.data.openedPopup=void 0},async thumbs(e,t){try{let n=K.data.history.find(t=>t.type===`bot`&&t.id===e),r=n?.type===`bot`?n:void 0;if(r?.feedback===t)return;t===`up`?await dn.thumbsUp(e,n?.question??``):await dn.thumbsDown(e,n?.question??``);let i=!r?.feedback;r&&(r.feedback=t),i&&this.showSuccessToast(`thankYouForFeedback`)}catch(e){console.error(`Feedback failed:`,e),this.showErrorToast(`feedback-failed`)}},async onLanguageChange(e){if(K.data.language=Ne(e,K.data.chatConfig.supportedLanguages),je(K.data.language,K.targets.mainElement),K.data.predefinedQuestions=await this.getPredefinedQuestions(K.data.language),this.setAriaLiveStatusMessage(K.t.ariaLanguageChanged),K.data.chatConfig.reflectLanguageInPath){let e=new URL(window.location.href);e.pathname=`/${K.data.language}`,window.history.replaceState({},``,e.toString())}},async acceptTerms(){K.data.termsAccepted=!0;try{We.setItem(`liipgpt:termsAccepted`,`true`)}catch(e){console.warn(`Failed to save terms acceptance to storage:`,e)}this.closePopup(),await oe(),this.goto(nn(K.data.chatConfig.forceConsent??!1,!0,K.data.chatConfig.forceChatPage??!1,tn(K.data.props.autofirePredefinedQuestionId,K.data.predefinedQuestions),K.data.props.question))},updateChatInput(e){K.data.chatInputValue=e}}),mn=(e,t)=>{let n=window.LIIPGPT_LISTENERS?.elements?.[t];if(!n)return;let r=Object.entries(n).filter(([e,t])=>typeof t==`function`&&![`init`,`destroy`].includes(e));I(()=>(n.init?.(e),r.forEach(([t,n])=>{e.addEventListener(t,n)}),()=>{r.forEach(([t,n])=>{e.removeEventListener(t,n)}),n.destroy?.(e)}))},hn=(e,t)=>{t&&q.setTarget(t,e)},gn=M(`<div aria-hidden="true"></div>`);function J(e,t){E(t,!0);let n=B(t,`name`,7),r=B(t,`class`,7);var i={get name(){return n()},set name(e){n(e),x()},get class(){return r()},set class(e){r(e),x()}},a=gn();return we(a,()=>K.theme.svgs[n()],!0),d(a),z(()=>c(a,1,`svg svg--${n()??``} ${r()??``}`)),g(e,a),y(i)}L(J,{name:{},class:{}},[],[],{mode:`open`});var _n=`data-disable-tooltip-on-focus`;function vn(e,t){let n=null,r;function i(){t.text&&(n||(n=document.createElement(`span`),n.ariaHidden=`true`,n.textContent=t.text,n.className=`tooltip tooltip-${t.position||`top`} tooltip-hidden`,e.appendChild(n),n.getBoundingClientRect()),n.classList.remove(`tooltip-hidden`),a())}function a(){if(!n)return;let r=e.getBoundingClientRect(),i=n.getBoundingClientRect(),a,o;switch(t.position){case`bottom`:a=r.height+5,o=r.width/2-i.width/2;break;case`bottom-right`:a=r.height+5,o=r.width-i.width;break;case`bottom-left`:a=r.height+5,o=0;break;case`left`:a=r.height/2-i.height/2,o=-i.width-5;break;case`right`:a=r.height/2-i.height/2,o=r.width+5;break;default:a=-i.height-5,o=r.width/2-i.width/2;break}let s=r.left+o,c=s+i.width,l=window.innerWidth;if(c>l){let e=c-l;if(o-=e+10,t.position===`top`||t.position===`bottom`){let t=e+10;n.style.setProperty(`--tooltip-arrow-offset`,`${t}px`)}}if(s<0&&(o-=s-10,t.position===`top`||t.position===`bottom`)){let e=s-10;n.style.setProperty(`--tooltip-arrow-offset`,`${e}px`)}n.style.top=`${a}px`,n.style.left=`${o}px`}function o(){r=window.setTimeout(()=>{i()},t.delay||200)}function s(e){let t=e.target;t&&!t.hasAttribute(`data-disable-tooltip-on-focus`)?o():t.removeAttribute(_n)}function c(){clearTimeout(r),n&&(n.classList.add(`tooltip-hidden`),n.addEventListener(`transitionend`,()=>{n?.remove(),n=null},{once:!0}))}return e.classList.add(`tooltip-container`),e.setAttribute(`tabindex`,`0`),e.addEventListener(`mouseenter`,o),e.addEventListener(`focus`,s),e.addEventListener(`mouseleave`,c),e.addEventListener(`blur`,c),e.addEventListener(`click`,c),{update(e){t=e},destroy(){c(),e.classList.remove(`tooltip-container`),e.removeEventListener(`mouseenter`,o),e.removeEventListener(`focus`,s),e.removeEventListener(`mouseleave`,c),e.removeEventListener(`blur`,c),e.removeEventListener(`click`,c)}}}var yn=M(`<button><span class="sr-only"> </span> <span><!></span></button>`);function bn(e,t){E(t,!0);let n=B(t,`class`,7),r=B(t,`tooltip`,7),i=B(t,`label`,7),a=B(t,`onclick`,7),s=B(t,`icon`,7),l=U(t,[`$$slots`,`$$events`,`$$legacy`,`$$host`,`class`,`tooltip`,`label`,`onclick`,`icon`]);var u={get class(){return n()},set class(e){n(e),x()},get tooltip(){return r()},set tooltip(e){r(e),x()},get label(){return i()},set label(e){i(e),x()},get onclick(){return a()},set onclick(e){a(e),x()},get icon(){return s()},set icon(e){s(e),x()}},f=yn();F(f,()=>({onclick:a(),...l}));var p=P(f),m=P(p,!0);d(p);var h=D(p,2);return J(P(h),{get name(){return s()}}),d(h),d(f),pe(f,(e,t)=>vn?.(e,t),()=>({text:r(),position:`top`,delay:300})),z(()=>{_(m,i()),c(h,1,o(n()))}),g(e,f),y(u)}L(bn,{class:{},tooltip:{},label:{},onclick:{},icon:{}},[],[],{mode:`open`});var xn=M(`<p class="jsonld-card__description"> </p>`),Sn=M(`<article class="jsonld-card jsonld-card--cta"><header class="jsonld-card__header"><h3 class="jsonld-card__title"> </h3></header> <!> <a class="jsonld-card__cta btn" target="_blank" rel="noopener noreferrer"><span> </span> <!></a></article>`);function Cn(e,t){E(t,!0);let n=B(t,`data`,7);var r={get data(){return n()},set data(e){n(e),x()}},i=Sn(),a=P(i),o=P(a),s=P(o,!0);d(o),d(a);var c=D(a,2),l=e=>{var t=xn(),r=P(t,!0);d(t),z(()=>_(r,n().description)),g(e,t)};A(c,e=>{n().description&&e(l)});var u=D(c,2),f=P(u),p=P(f,!0);return d(f),J(D(f,2),{name:`externalLink`,class:`jsonld-card__cta-icon`}),d(u),d(i),z(()=>{W(i,`aria-label`,`${K.t.ariaJsonLdCtaCard??``}: ${n().title??``}`),_(s,n().title),W(u,`href`,n().url),_(p,n().label??K.t.jsonLdCtaLabel)}),g(e,i),y(r)}L(Cn,{data:{}},[],[],{mode:`open`});var wn=M(`<span class="jsonld-card__event-time"> </span>`),Tn=M(`<dt class="jsonld-card__meta-label"> </dt> <dd class="jsonld-card__meta-value"><time class="jsonld-card__event-date"><span> </span> <!></time></dd>`,1),En=M(`<dt class="jsonld-card__meta-label"> </dt> <dd class="jsonld-card__meta-value"> </dd>`,1),Dn=M(`<dt class="jsonld-card__meta-label"> </dt> <dd class="jsonld-card__meta-value"> </dd>`,1),On=M(`<article class="jsonld-card jsonld-card--event"><header class="jsonld-card__header"><h3 class="jsonld-card__title"> </h3></header> <dl class="jsonld-card__meta"><!> <!> <!></dl> <a class="jsonld-card__cta btn" target="_blank" rel="noopener noreferrer"><span> </span> <!></a></article>`);function kn(e,t){E(t,!0);let n=B(t,`data`,7),r=R(()=>{if(!n().date)return;let e=new Date(n().date);if(Number.isNaN(e.getTime()))return{day:n().date,time:void 0};let t=K.data.language||`de`;try{return{day:e.toLocaleDateString(t,{weekday:`long`,day:`numeric`,month:`long`,year:`numeric`}),time:e.getHours()!==0||e.getMinutes()!==0?e.toLocaleTimeString(t,{hour:`2-digit`,minute:`2-digit`}):void 0}}catch{return{day:e.toLocaleString(),time:void 0}}});var i={get data(){return n()},set data(e){n(e),x()}},a=On(),o=P(a),s=P(o),c=P(s,!0);d(s),d(o);var l=D(o,2),u=P(l),f=e=>{var t=Tn(),i=G(t),a=P(i,!0);d(i);var o=D(i,2),s=P(o),c=P(s),l=P(c,!0);d(c);var u=D(c,2),f=e=>{var t=wn(),n=P(t,!0);d(t),z(()=>_(n,V(r).time)),g(e,t)};A(u,e=>{V(r).time&&e(f)}),d(s),d(o),z(()=>{_(a,K.t.jsonLdEventDate),W(s,`datetime`,n().date),_(l,V(r).day)}),g(e,t)};A(u,e=>{V(r)&&e(f)});var p=D(u,2),m=e=>{var t=En(),r=G(t),i=P(r,!0);d(r);var a=D(r,2),o=P(a,!0);d(a),z(()=>{_(i,K.t.jsonLdEventLocation),_(o,n().location)}),g(e,t)};A(p,e=>{n().location&&e(m)});var h=D(p,2),v=e=>{var t=Dn(),r=G(t),i=P(r,!0);d(r);var a=D(r,2),o=P(a,!0);d(a),z(()=>{_(i,K.t.jsonLdEventDescription),_(o,n().description)}),g(e,t)};A(h,e=>{n().description&&e(v)}),d(l);var b=D(l,2),S=P(b),C=P(S,!0);return d(S),J(D(S,2),{name:`externalLink`,class:`jsonld-card__cta-icon`}),d(b),d(a),z(()=>{W(a,`aria-label`,`${K.t.ariaJsonLdEventCard??``}: ${n().title??``}`),_(c,n().title),W(b,`href`,n().ctaUrl),_(C,n().ctaLabel??K.t.jsonLdEventCtaLabel)}),g(e,a),y(i)}L(kn,{data:{}},[],[],{mode:`open`});var An=M(`<p class="jsonld-card__description"> </p>`),jn=M(`<div class="jsonld-card__map-frame"><div class="jsonld-card__map-canvas"></div></div>`),Mn=M(`<p class="jsonld-card__address"> </p>`),Nn=M(`<a class="jsonld-card__contact btn btn--secondary"><!> <span> </span></a>`),Pn=M(`<a class="jsonld-card__contact btn btn--secondary"><!> <span> </span></a>`),Fn=M(`<article class="jsonld-card jsonld-card--map"><header class="jsonld-card__header"><h3 class="jsonld-card__title"> </h3></header> <!> <!> <!> <div class="jsonld-card__actions"><!> <!> <a class="jsonld-card__cta btn" target="_blank" rel="noopener noreferrer"><span> </span> <!></a></div></article>`);function In(e,t){E(t,!0);let n=`5.24.0`,r=[`https://cdn.jsdelivr.net/npm/maplibre-gl@${n}/+esm`,`https://unpkg.com/maplibre-gl@${n}/dist/maplibre-gl.js?module`],i=`https://cdn.jsdelivr.net/npm/maplibre-gl@${n}/dist/maplibre-gl.css`,a=B(t,`data`,7),o=s(void 0),c=R(()=>{if(a().directionsUrl)return a().directionsUrl;if(!a().coords)return a().fallbackUrl;let e=String(K.theme.components.messageJsonLdMap?.custom?.directionsProvider||``)||`google`,{lat:t,lng:n}=a().coords;return e===`osm`?`https://www.openstreetmap.org/directions?to=${t},${n}`:`https://www.google.com/maps/dir/?api=1&destination=${t},${n}`}),l=e=>new Promise(t=>{let n=`jsonld-map-maplibre-style`,r=e.getRootNode(),a=r instanceof ShadowRoot?r:document.head,o=a.querySelector(`#${n}`);if(o instanceof HTMLLinkElement&&o.sheet){t();return}if(o){o.addEventListener(`load`,()=>t(),{once:!0});return}let s=document.createElement(`link`);s.id=n,s.rel=`stylesheet`,s.href=i,s.onload=()=>t(),s.onerror=()=>t(),a.appendChild(s)}),u=e=>{let t=e;return t.Map?t:t.default??t},f=async e=>{await l(e);let t;for(let e of r)try{return u(await Ee(()=>import(e),[],import.meta.url))}catch(e){t=e}throw t};ve(()=>{let e=a().coords;if(!e)return;let t=String(K.theme.components.messageJsonLdMap?.custom?.tileUrl||``)||`https://tile.openstreetmap.org/{z}/{x}/{y}.png`,n=String(K.theme.components.messageJsonLdMap?.custom?.markerColor||``)||`#3fb1ce`,r=String(K.theme.components.messageJsonLdMap?.custom?.mapStyleUrl||``),i,s,c,l,u=0,d=0,p=!1;return(async()=>{await oe();let m=V(o);if(!m||p)return;let h=await f(m);if(p)return;let g=(e=>{if(e.trim().startsWith(`{`))try{return JSON.parse(e)}catch{return null}return e||null})(r)??{version:8,sources:{"osm-tiles":{type:`raster`,tiles:[t],tileSize:256}},layers:[{id:`osm-tiles`,type:`raster`,source:`osm-tiles`,minzoom:0,maxzoom:19}]};if(i=new h.Map({container:m,style:g,center:[e.lng,e.lat],zoom:a().zoom,attributionControl:!1,scrollZoom:!1,touchZoomRotate:!0,touchPitch:!1,doubleClickZoom:!0}),p){i.remove();return}i.once(`style.load`,()=>{let t=()=>{if(p||!i)return;i.resize();let r=i.getCanvas();r.width>0&&r.height>0?s=new h.Marker({color:n}).setLngLat([e.lng,e.lat]).addTo(i):requestAnimationFrame(t)};t()}),l=new ResizeObserver(e=>{let t=e[0];if(!t||!i)return;let{width:n,height:r}=t.contentRect;n===u&&r===d||(u=n,d=r,cancelAnimationFrame(c??0),c=requestAnimationFrame(()=>i?.resize()))}),l.observe(m)})(),()=>{p=!0,cancelAnimationFrame(c??0),l?.disconnect(),s?.remove(),i?.remove()}});var p={get data(){return a()},set data(e){a(e),x()}},m=Fn(),h=P(m),v=P(h),b=P(v,!0);d(v),d(h);var S=D(h,2),C=e=>{var t=An(),n=P(t,!0);d(t),z(()=>_(n,a().description)),g(e,t)};A(S,e=>{a().description&&e(C)});var w=D(S,2),T=e=>{var t=jn(),n=P(t);xe(n,e=>k(o,e),()=>V(o)),d(t),z(()=>W(n,`aria-label`,`${K.t.ariaJsonLdMapCanvas??``}: ${a().title??``}`)),g(e,t)};A(w,e=>{a().coords&&e(T)});var O=D(w,2),j=e=>{var t=Mn(),n=P(t,!0);d(t),z(()=>_(n,a().address)),g(e,t)};A(O,e=>{a().address&&e(j)});var ee=D(O,2),M=P(ee),N=e=>{var t=Nn(),n=P(t);J(n,{name:`phone`,class:`jsonld-card__cta-icon`});var r=D(n,2),i=P(r,!0);d(r),d(t),z(()=>{W(t,`href`,`tel:${a().phone??``}`),_(i,a().phone)}),g(e,t)};A(M,e=>{a().phone&&e(N)});var te=D(M,2),ne=e=>{var t=Pn(),n=P(t);J(n,{name:`email`,class:`jsonld-card__cta-icon`});var r=D(n,2),i=P(r,!0);d(r),d(t),z(()=>{W(t,`href`,`mailto:${a().email??``}`),_(i,a().email)}),g(e,t)};A(te,e=>{a().email&&e(ne)});var re=D(te,2),ie=P(re),ae=P(ie,!0);return d(ie),J(D(ie,2),{name:`externalLink`,class:`jsonld-card__cta-icon`}),d(re),d(ee),d(m),z(()=>{W(m,`aria-label`,`${K.t.ariaJsonLdMapCard??``}: ${a().title??``}`),_(b,a().title),W(re,`href`,V(c)),_(ae,K.t.jsonLdMapOpenMap)}),g(e,m),y(p)}L(In,{data:{}},[],[],{mode:`open`});var Ln=(e,t)=>{let n=e[t];return typeof n==`string`&&n.length>0?n:void 0},Rn=(e,t)=>{let n=e[t];return typeof n==`number`&&Number.isFinite(n)?n:void 0},zn=e=>e.display.card.title||e.display.listItem.title,Bn=e=>{let t=e.metadata;if(t.jsonLdBlock===`event-card`)return{block:`event-card`,data:{title:zn(e),description:e.display.card.description,date:Ln(t,`jsonLdEventStartDate`),location:Ln(t,`jsonLdEventLocation`),ctaLabel:Ln(t,`jsonLdEventCtaLabel`),ctaUrl:Ln(t,`jsonLdEventCtaUrl`)??e.url}};if(t.jsonLdBlock===`map`){let n=Rn(t,`jsonLdMapLat`),r=Rn(t,`jsonLdMapLng`);return{block:`map`,data:{title:Ln(t,`jsonLdMapLabel`)??zn(e),description:Ln(t,`jsonLdMapDescription`)??e.display.card.description,address:Ln(t,`jsonLdMapAddress`),url:Ln(t,`jsonLdMapUrl`),phone:Ln(t,`jsonLdMapPhone`),email:Ln(t,`jsonLdMapEmail`),coords:n!==void 0&&r!==void 0?{lat:n,lng:r}:void 0,zoom:Rn(t,`jsonLdMapZoom`)??15,fallbackUrl:e.url,directionsUrl:Ln(t,`jsonLdMapDirectionsUrl`)}}}if(t.jsonLdBlock===`cta`)return{block:`cta`,data:{title:zn(e),description:e.display.card.description,label:Ln(t,`jsonLdCtaLabel`),url:Ln(t,`jsonLdCtaUrl`)??e.url}}},Vn=M(`<div role="listitem"><!></div>`),Hn=M(`<div class="jsonld-references" role="list"></div>`);function Un(e,t){E(t,!0);let n=B(t,`references`,7),r=B(t,`ready`,7,!1),a=R(()=>n().flatMap(e=>{let t=Bn(e);return t?[{key:e.url+e.referenceIndex.all,display:t}]:[]})),o=R(()=>K.theme?.components?.messageOptions?.custom),s=R(()=>Number(V(o)?.transitionDuration)||300),l=R(()=>Number(V(o)?.transitionDelay)||0),u=R(()=>Number(V(o)?.transitionY)||30);var f={get references(){return n()},set references(e){n(e),x()},get ready(){return r()},set ready(e=!1){r(e),x()}},p=N(),m=G(p),h=e=>{var t=Hn();i(t,23,()=>V(a),({key:e,display:t})=>e,(e,t,n)=>{let i=()=>V(t).display;var a=Vn();let o,f;var p=P(a),m=e=>{kn(e,{get data(){return i().data}})},h=e=>{In(e,{get data(){return i().data}})},_=e=>{Cn(e,{get data(){return i().data}})};A(p,e=>{i().block===`event-card`?e(m):i().block===`map`?e(h,1):i().block===`cta`&&e(_,2)}),d(a),z(()=>{o=c(a,1,`jsonld-references__item`,null,o,{"jsonld-references__item--preloading":!r()}),f=O(a,``,f,{"--jsonld-item-duration":`${V(s)??``}ms`,"--jsonld-item-delay":`${V(l)+V(n)*V(s)}ms`,"--jsonld-item-y":`${V(u)??``}px`})}),g(e,a)}),d(t),g(e,t)};return A(m,e=>{V(a).length>0&&e(h)}),g(e,p),y(f)}L(Un,{references:{},ready:{}},[],[],{mode:`open`});var Wn=M(`<div><div><!></div></div>`);function Gn(e,t){E(t,!0);let n=B(t,`class`,7),r=B(t,`children`,7),i=s(void 0);var a={get class(){return n()},set class(e){n(e),x()},get children(){return r()},set children(e){r(e),x()}},l=Wn();let u;var f=P(l);return v(P(f),()=>r()??H),d(f),d(l),z(()=>{c(l,1,o([`animated-height`,n()])),u=O(l,``,u,{height:V(i)?`${V(i)}px`:`auto`})}),se(f,`clientHeight`,e=>k(i,e)),g(e,l),y(a)}L(Gn,{class:{},children:{}},[],[],{mode:`open`});var Kn=M(`<span class="reference__number transition-colors"> </span>`),qn=M(`<span class="reference__description transition-colors line-clamp line-clamp--6"> </span>`),Jn=M(`<span class="reference__breadcrumb transition-colors"> </span>`),Yn=M(`<div class="reference__footer"><span class="reference__domain transition-colors"><span class="truncate"> </span></span> <!></div>`),Xn=M(`<a target="_blank" rel="noopener noreferrer" class="reference transition-colors"><!> <span class="reference__body transition-colors"><span class="reference__header"><span class="reference__title line-clamp line-clamp--2 h4"> </span> <!></span> <!> <!></span></a>`);function Zn(e,t){E(t,!0);let n=B(t,`reference`,7),r=R(()=>`${n().display.listItem.title}. ${n().display.card.description}. ${K.t.ariaReferenceSource} ${n().display.listItem.badge}${n().display.listItem.breadcrumbs?` / `+n().display.listItem.breadcrumbs.join(` / `):``}`);var a={get reference(){return n()},set reference(e){n(e),x()}},o=Xn(),s=P(o),c=e=>{var t=Kn(),r=P(t,!0);d(t),z(()=>_(r,n().referenceIndex.used)),g(e,t)};A(s,e=>{n().referenceIndex.used&&e(c)});var l=D(s,2),u=P(l),f=P(u),p=P(f,!0);d(f),J(D(f,2),{name:`externalLink`,class:`reference__icon transition-colors`}),d(u);var m=D(u,2),h=e=>{var t=qn(),r=P(t,!0);d(t),z(()=>_(r,n().display.card.description)),g(e,t)};A(m,e=>{n().display.card.description&&e(h)});var v=D(m,2),b=e=>{var t=Yn(),r=P(t),a=P(r),o=P(a,!0);d(a),d(r);var s=D(r,2),c=e=>{var t=N();i(G(t),17,()=>n().display.listItem.breadcrumbs,j,(e,t)=>{var n=Jn(),r=P(n,!0);d(n),z(()=>_(r,V(t))),g(e,n)}),g(e,t)};A(s,e=>{n().display.listItem.breadcrumbs&&e(c)}),d(t),z(()=>_(o,n().display.listItem.badge)),g(e,t)};return A(v,e=>{n().display.listItem.badge&&e(b)}),d(l),d(o),z(()=>{W(o,`href`,n().url),W(o,`aria-label`,V(r)),_(p,n().display.listItem.title)}),g(e,o),y(a)}L(Zn,{reference:{}},[],[],{mode:`open`});function Qn(e,{delay:t=0,duration:n=500,resetTop:r=!0}){let i=+getComputedStyle(e).opacity;return e.style.position=`absolute`,r&&(e.style.top=`0px`),{delay:t,duration:n,css:e=>`opacity: ${e*i};`}}function $n(e){return typeof e==`function`}function er(e){return typeof e==`object`&&!!e}var tr=[`string`,`number`,`bigint`,`boolean`];function nr(e){return e==null||tr.includes(typeof e)?!0:Array.isArray(e)?e.every(e=>nr(e)):typeof e==`object`?Object.getPrototypeOf(e)===Object.prototype:!1}var rr=Symbol(`box`),ir=Symbol(`is-writable`);function Y(e,t){let n=R(e);return t?{[rr]:!0,[ir]:!0,get current(){return V(n)},set current(e){t(e)}}:{[rr]:!0,get current(){return e()}}}function ar(e){return er(e)&&rr in e}function or(e){return ar(e)&&ir in e}function sr(e){return ar(e)?e:$n(e)?Y(e):ur(e)}function cr(e){return Object.entries(e).reduce((e,[t,n])=>ar(n)?(or(n)?Object.defineProperty(e,t,{get(){return n.current},set(e){n.current=e}}):Object.defineProperty(e,t,{get(){return n.current}}),e):Object.assign(e,{[t]:n}),{})}function lr(e){return or(e)?{[rr]:!0,get current(){return e.current}}:e}function ur(e){let t=s(a(e));return{[rr]:!0,[ir]:!0,get current(){return V(t)},set current(e){k(t,e,!0)}}}function dr(e){let t=s(a(e));return{[rr]:!0,[ir]:!0,get current(){return V(t)},set current(e){k(t,e,!0)}}}dr.from=sr,dr.with=Y,dr.flatten=cr,dr.readonly=lr,dr.isBox=ar,dr.isWritableBox=or;function fr(...e){return function(t){for(let n of e)if(n){if(t.defaultPrevented)return;typeof n==`function`?n.call(this,t):n.current?.call(this,t)}}}var pr=/\/\*[^*]*\*+([^/*][^*]*\*+)*\//g,mr=/\n/g,hr=/^\s*/,gr=/^(\*?[-#/*\\\w]+(\[[0-9a-z_-]+\])?)\s*/,_r=/^:\s*/,vr=/^((?:'(?:\\'|.)*?'|"(?:\\"|.)*?"|\([^)]*?\)|[^};])+)/,yr=/^[;\s]*/,br=/^\s+|\s+$/g,xr=`
1
+ import{r as e,t}from"./CibALFW0.js";import{$ as n,A as r,B as i,Ct as a,D as o,Dt as s,E as c,Ft as l,G as u,Gt as d,H as f,Ht as p,I as m,It as h,J as g,K as _,L as v,Lt as y,M as b,Mt as x,N as S,O as C,Pt as w,Q as T,Rt as E,St as D,T as O,Tt as k,U as A,V as j,Wt as ee,X as M,Y as N,Z as te,_ as ne,_t as re,at as ie,bt as P,c as ae,ct as oe,d as se,f as ce,ft as le,g as F,gt as ue,ht as I,i as L,it as de,jt as fe,k as pe,kt as R,lt as me,mt as z,nt as he,o as B,ot as V,p as ge,q as _e,qt as H,r as ve,rt as ye,s as U,tt as be,u as xe,v as W,x as Se,xt as G,yt as Ce,z as we,zt as Te}from"./DK3lEKRX.js";import{t as Ee}from"./DjVmpym-.js";import{i as De,n as Oe,r as ke,t as Ae}from"./hJTLHSgs.js";import{a as je,i as Me,n as Ne,t as Pe}from"./BJVrdkuG.js";import{_ as Fe,a as Ie,b as Le,c as Re,d as ze,f as Be,h as Ve,i as He,m as Ue,p as We,r as Ge,s as Ke,u as qe,y as Je}from"./lj2Jt22R.js";import{n as K,t as Ye}from"./DHHLckcz.js";var Xe={randomUUID:typeof crypto<`u`&&crypto.randomUUID&&crypto.randomUUID.bind(crypto)};function Ze(e,t,n){e||={};let r=e.random??e.rng?.()??Ue();if(r.length<16)throw Error(`Random bytes length must be >= 16`);if(r[6]=r[6]&15|64,r[8]=r[8]&63|128,t){if(n||=0,n<0||n+16>t.length)throw RangeError(`UUID byte range ${n}:${n+15} is out of buffer bounds`);for(let e=0;e<16;++e)t[n+e]=r[e];return t}return Ve(r)}function Qe(e,t,n){return Xe.randomUUID&&!t&&!e?Xe.randomUUID():Ze(e,t,n)}var $e=t(((e,t)=>{t.exports=function e(t,n){if(t===n)return!0;if(t&&n&&typeof t==`object`&&typeof n==`object`){if(t.constructor!==n.constructor)return!1;var r,i,a;if(Array.isArray(t)){if(r=t.length,r!=n.length)return!1;for(i=r;i--!==0;)if(!e(t[i],n[i]))return!1;return!0}if(t.constructor===RegExp)return t.source===n.source&&t.flags===n.flags;if(t.valueOf!==Object.prototype.valueOf)return t.valueOf()===n.valueOf();if(t.toString!==Object.prototype.toString)return t.toString()===n.toString();if(a=Object.keys(t),r=a.length,r!==Object.keys(n).length)return!1;for(i=r;i--!==0;)if(!Object.prototype.hasOwnProperty.call(n,a[i]))return!1;for(i=r;i--!==0;){var o=a[i];if(!e(t[o],n[o]))return!1}return!0}return t!==t&&n!==n}}));function et(...e){return e.filter(Boolean).join(` `)}var tt=typeof document<`u`,nt=typeof window<`u`?window:void 0;typeof window<`u`&&window.document,typeof window<`u`&&window.navigator,typeof window<`u`&&window.location;function rt(e){let t=e.activeElement;for(;t?.shadowRoot;){let e=t.shadowRoot.activeElement;if(e===t)break;t=e}return t}new class{#e;#t;constructor(e={}){let{window:t=nt,document:n=t?.document}=e;t!==void 0&&(this.#e=n,this.#t=fe(e=>{let n=de(t,`focusin`,e),r=de(t,`focusout`,e);return()=>{n(),r()}}))}get current(){return this.#t?.(),this.#e?rt(this.#e):null}};var it=class{#e;#t;constructor(e){this.#e=e,this.#t=Symbol(e)}get key(){return this.#t}exists(){return h(this.#t)}get(){let e=l(this.#t);if(e===void 0)throw Error(`Context "${this.#e}" not found`);return e}getOr(e){let t=l(this.#t);return t===void 0?e:t}set(e){return Te(this.#t,e)}};function at(e,t){switch(e){case`post`:I(t);break;case`pre`:ue(t);break}}function ot(e,t,n,r={}){let{lazy:i=!1}=r,a=!i,o=Array.isArray(e)?[]:void 0;at(t,()=>{let t=Array.isArray(e)?e.map(e=>e()):e();if(!a){a=!0,o=t;return}let r=me(()=>n(t,o));return o=t,r})}function st(e,t,n){let r=le(()=>{let i=!1;ot(e,t,(e,t)=>{if(i){r();return}let a=n(e,t);return i=!0,a},{lazy:!0})});I(()=>r)}function ct(e,t,n){ot(e,`post`,t,n)}function lt(e,t,n){ot(e,`pre`,t,n)}ct.pre=lt;function ut(e,t){st(e,`post`,t)}function dt(e,t){st(e,`pre`,t)}ut.pre=dt;function ft(e,t){let n,r=null;return(...i)=>new Promise(a=>{r&&r(void 0),r=a,clearTimeout(n),n=setTimeout(async()=>{let t=await e(...i);r&&=(r(t),null)},t)})}function pt(e,t){let n=0,r=null;return(...i)=>{let a=Date.now();return n&&a-n<t?r??Promise.resolve(void 0):(n=a,r=e(...i),r)}}function mt(e,t,n={},r){let{lazy:i=!1,once:o=!1,initialValue:c,debounce:l,throttle:u}=n,d=s(a(c)),f=s(!1),p=s(void 0),m=s(a([])),h=()=>{V(m).forEach(e=>e()),k(m,[],!0)},g=e=>{k(m,[...V(m),e],!0)},_=async(e,n,r=!1)=>{try{k(f,!0),k(p,void 0),h();let i=new AbortController;g(()=>i.abort());let a=await t(e,n,{data:V(d),refetching:r,onCleanup:g,signal:i.signal});return k(d,a,!0),a}catch(e){e instanceof DOMException&&e.name===`AbortError`||k(p,e,!0);return}finally{k(f,!1)}},v=l?ft(_,l):u?pt(_,u):_,y=Array.isArray(e)?e:[e],b;return r((t,n)=>{o&&b||(b=t,v(Array.isArray(e)?t:t[0],Array.isArray(e)?n:n?.[0]))},{lazy:i}),{get current(){return V(d)},get loading(){return V(f)},get error(){return V(p)},mutate:e=>{k(d,e,!0)},refetch:t=>{let n=y.map(e=>e());return v(Array.isArray(e)?n:n[0],Array.isArray(e)?n:n[0],t??!0)}}}function ht(e,t,n){return mt(e,t,n,(t,n)=>{let r=Array.isArray(e)?e:[e];ct(()=>r.map(e=>e()),(e,n)=>{t(e,n??[])},n)})}function gt(e,t,n){return mt(e,t,n,(t,n)=>{let r=Array.isArray(e)?e:[e];ct.pre(()=>r.map(e=>e()),(e,n)=>{t(e,n??[])},n)})}ht.pre=gt,new it(`richColorsContext`);var _t=new it(`<Toaster/>`),vt=0,yt=class{#e=s(a([]));get toasts(){return V(this.#e)}set toasts(e){k(this.#e,e,!0)}#t=s(a([]));get heights(){return V(this.#t)}set heights(e){k(this.#t,e,!0)}#n=e=>{let t=this.toasts.findIndex(t=>t.id===e);return t===-1?null:t};addToast=e=>{tt&&this.toasts.unshift(e)};updateToast=({id:e,data:t,type:n,message:r})=>{let i=this.toasts.findIndex(t=>t.id===e),a=this.toasts[i];this.toasts[i]={...a,...t,id:e,title:r,type:n,updated:!0}};create=e=>{let{message:t,...n}=e,r=typeof e?.id==`number`||e.id&&e.id?.length>0?e.id:vt++,i=e.dismissible===void 0?e.dismissable===void 0?!0:e.dismissable:e.dismissible,a=e.type===void 0?`default`:e.type;return me(()=>{this.toasts.find(e=>e.id===r)?this.updateToast({id:r,data:e,type:a,message:t,dismissible:i}):this.addToast({...n,id:r,title:t,dismissible:i,type:a})}),r};dismiss=e=>(me(()=>{if(e===void 0){this.toasts=this.toasts.map(e=>({...e,dismiss:!0}));return}let t=this.toasts.findIndex(t=>t.id===e);this.toasts[t]&&(this.toasts[t]={...this.toasts[t],dismiss:!0})}),e);remove=e=>{if(e===void 0){this.toasts=[];return}let t=this.#n(e);if(t!==null)return this.toasts.splice(t,1),e};message=(e,t)=>this.create({...t,type:`default`,message:e});error=(e,t)=>this.create({...t,type:`error`,message:e});success=(e,t)=>this.create({...t,type:`success`,message:e});info=(e,t)=>this.create({...t,type:`info`,message:e});warning=(e,t)=>this.create({...t,type:`warning`,message:e});loading=(e,t)=>this.create({...t,type:`loading`,message:e});promise=(e,t)=>{if(!t)return;let n;t.loading!==void 0&&(n=this.create({...t,promise:e,type:`loading`,message:typeof t.loading==`string`?t.loading:t.loading()}));let r=e instanceof Promise?e:e(),i=n!==void 0;return r.then(e=>{if(typeof e==`object`&&e&&`ok`in e&&typeof e.ok==`boolean`&&!e.ok){i=!1;let t=bt(e);this.create({id:n,type:`error`,message:t})}else if(t.success!==void 0){i=!1;let r=typeof t.success==`function`?t.success(e):t.success;this.create({id:n,type:`success`,message:r})}}).catch(e=>{if(t.error!==void 0){i=!1;let r=typeof t.error==`function`?t.error(e):t.error;this.create({id:n,type:`error`,message:r})}}).finally(()=>{i&&(this.dismiss(n),n=void 0),t.finally?.()}),n};custom=(e,t)=>{let n=t?.id||vt++;return this.create({component:e,id:n,...t}),n};removeHeight=e=>{this.heights=this.heights.filter(t=>t.toastId!==e)};setHeight=e=>{let t=this.#n(e.toastId);if(t===null){this.heights.push(e);return}this.heights[t]=e};reset=()=>{this.toasts=[],this.heights=[]}};function bt(e){return e&&typeof e==`object`&&`status`in e?`HTTP error! Status: ${e.status}`:`Error! ${e}`}var xt=new yt;function St(e,t){return xt.create({message:e,...t})}var Ct=class{#e=R(()=>xt.toasts.filter(e=>!e.dismiss));get toasts(){return V(this.#e)}},wt=Object.assign(St,{success:xt.success,info:xt.info,warning:xt.warning,error:xt.error,custom:xt.custom,message:xt.message,promise:xt.promise,dismiss:xt.dismiss,loading:xt.loading,getActiveToasts:()=>xt.toasts.filter(e=>!e.dismiss)}),Tt=e=>{let t=new Set;Object.getOwnPropertyNames(e).forEach(e=>t.add(e));let n=Object.getPrototypeOf(e);for(;n&&n!==Object.prototype;)Object.getOwnPropertyNames(n).forEach(e=>t.add(e)),n=Object.getPrototypeOf(n);return Array.from(t)},Et=(e,t)=>{let n={};return t.forEach(t=>{n[t]=e[t]}),n},Dt=console.warn,Ot=()=>{},kt=(e,t)=>me(()=>{console.warn=Ot;let n=p(t?Et(e,t):e);return console.warn=Dt,n}),At=e=>e&&typeof e.then==`function`,jt=class{config;self;devtools;stateKeys;constructor(e,t){this.config=e,this.self=t,typeof window<`u`&&window.__REDUX_DEVTOOLS_EXTENSION__&&(this.stateKeys=Tt(this.config.state),this.devtools=window.__REDUX_DEVTOOLS_EXTENSION__.connect({name:this.config.name??`updatelogic`}),this.devtools.init(this.createStateSnapshot()),this.devtools.subscribe(e=>{e.type===`DISPATCH`&&e.state}))}createStateSnapshot(){return kt(this.config.state,this.stateKeys)}sendStart(e,t){this.devtools.send({type:`→ ${e}`,args:t},this.createStateSnapshot())}sendError(e,t,n){this.devtools.send({type:`❌ ${e}`,args:t,error:n},this.createStateSnapshot())}sendSuccess(e,t,n){this.devtools.send({type:`✓ ${e}`,args:t,return:n},this.createStateSnapshot())}isIncluded(e){return this.config.excludeInDevTools?!this.config.excludeInDevTools.includes(e):!0}createProxyFunction(e,t){let n=this.devtools&&this.isIncluded(e);return typeof t==`function`?(...r)=>{if(!n)return me(()=>t.call(this.self,...r));let i=kt(r);this.sendStart(e,i);try{let n=me(()=>t.call(this.self,...r));return At(n)?n.then(t=>(this.sendSuccess(e,i,t),t),t=>{throw this.sendError(e,i,t),t}):(this.sendSuccess(e,i,n),n)}catch(t){throw this.sendError(e,i,t),t}}:t}},Mt=(e,t)=>{let n={},r=new jt(e,n);return Object.keys(t).forEach(e=>{if(e===`state`||e===`name`)return;let i=t[e];n[e]=r.createProxyFunction(e,i)}),n};async function Nt(){if(typeof navigator>`u`||!navigator.mediaDevices||!navigator.mediaDevices.enumerateDevices)return!1;try{return(await navigator.mediaDevices.enumerateDevices()).some(e=>e.kind===`audioinput`)}catch(e){return console.error(`Error checking for microphone:`,e),!1}}function Pt(){return typeof window>`u`||!window.MediaRecorder?null:MediaRecorder.isTypeSupported(`audio/mp4`)?`audio/mp4`:MediaRecorder.isTypeSupported(`audio/webm`)?`audio/webm`:MediaRecorder.isTypeSupported(`audio/wav`)?`audio/wav`:null}function Ft(){return typeof window>`u`?!1:!!(window.MediaRecorder&&Pt())}function It(){if(typeof window>`u`)return!1;if(`ontouchstart`in window||navigator.maxTouchPoints>0)return!0;let e=navigator.msMaxTouchPoints;return!!(`msMaxTouchPoints`in navigator&&e&&e>0)}function Lt(){return typeof window>`u`?!1:!!(/Android|webOS|iPhone|iPad|iPod|BlackBerry|IEMobile|Opera Mini/i.test(navigator.userAgent)||It())}var Rt=class{mediaRecorder=null;audioChunks=[];started=!1;starting=!1;stream=null;options;audioContext=null;analyser=null;dataArray=null;volumeUpdateInterval=null;constructor(e={}){this.options=e}async start(){if(this.started||this.starting){console.warn(`AudioRecorder: Start already in progress or already started`);return}if(!Ft()||!navigator.mediaDevices){let e=Error(`MediaRecorder not supported or no microphone access`);throw this.options.onError?.(e),e}try{if(this.starting=!0,this.stream=await navigator.mediaDevices.getUserMedia({audio:{echoCancellation:!0,noiseSuppression:!0,autoGainControl:!0},video:!1}),!this.starting){this.stopStream(this.stream);return}this.mediaRecorder&&this.mediaRecorder.state!==`inactive`&&(console.warn(`AudioRecorder: MediaRecorder already active, stopping previous recording`),this.mediaRecorder.stop(),this.cleanup()),this.started=!0,this.starting=!1;let e=Pt();if(!e)throw Error(`No supported media type found`);let t={mimeType:e};this.mediaRecorder=new MediaRecorder(this.stream,t),this.audioChunks=[],this.mediaRecorder.ondataavailable=e=>{e.data.size>0&&this.audioChunks.push(e.data)},this.mediaRecorder.onstop=async()=>{let t=this.audioChunks.length>0?new Blob(this.audioChunks,{type:e}):null;await this.options.onDataAvailable?.(t),this.options.onStop?.(),this.cleanup()},this.mediaRecorder.onerror=e=>{let t=Error(`MediaRecorder error: ${e}`);this.options.onError?.(t),this.cleanup()},this.mediaRecorder.start(),this.setupVolumeAnalysis(this.stream),this.options.onStart?.()}catch(e){this.started=!1,this.starting=!1;let t=e instanceof Error?e:Error(String(e));throw this.options.onError?.(t),t}}stop(){this.started=!1,this.starting=!1,this.volumeUpdateInterval&&=(clearInterval(this.volumeUpdateInterval),null),this.mediaRecorder&&this.mediaRecorder.state!==`inactive`?this.mediaRecorder.stop():(this.stream&&this.stopStream(this.stream),this.cleanup())}setupVolumeAnalysis(e){if(this.options.onVolumeChange)try{this.audioContext=new AudioContext,this.analyser=this.audioContext.createAnalyser(),this.analyser.fftSize=256,this.analyser.smoothingTimeConstant=.8;let t=this.analyser.frequencyBinCount;this.dataArray=new Uint8Array(t),this.audioContext.createMediaStreamSource(e).connect(this.analyser),this.startVolumeMonitoring()}catch(e){console.warn(`Failed to set up volume analysis:`,e)}}startVolumeMonitoring(){!this.analyser||!this.dataArray||!this.options.onVolumeChange||(this.volumeUpdateInterval=window.setInterval(()=>{if(!this.analyser||!this.dataArray||!this.started)return;this.analyser.getByteFrequencyData(this.dataArray);let e=0;for(let t=0;t<this.dataArray.length;t++)e+=this.dataArray[t]*this.dataArray[t];let t=Math.sqrt(e/this.dataArray.length)/255;t=(t*3)**.7;let n=Math.min(100,Math.max(0,Math.round(t*100)));this.options.onVolumeChange?.(n)},100))}get recording(){return this.started&&this.mediaRecorder?.state===`recording`}get isStarting(){return this.starting}stopStream(e){e.getTracks().forEach(e=>e.stop())}cleanup(){this.volumeUpdateInterval&&=(clearInterval(this.volumeUpdateInterval),null),this.audioContext&&=(this.audioContext.close().catch(console.warn),null),this.analyser=null,this.dataArray=null,this.stream&&=(this.stopStream(this.stream),null),this.mediaRecorder=null,this.audioChunks=[],this.started=!1,this.starting=!1}static isSupported(){return Ft()}static getSupportedMediaType(){return Pt()}},zt=Le(),Bt=(e,t)=>{if(e instanceof HTMLTextAreaElement&&t instanceof HTMLTextAreaElement){t.textContent=e.value;return}if(e instanceof HTMLSelectElement&&t instanceof HTMLSelectElement){Array.from(e.options).forEach((e,n)=>{t.options[n]&&(t.options[n].selected=e.selected)});return}e instanceof HTMLInputElement&&t instanceof HTMLInputElement&&(t.setAttribute(`value`,e.value),(e.type===`checkbox`||e.type===`radio`)&&(e.checked?t.setAttribute(`checked`,`checked`):t.removeAttribute(`checked`)))},Vt=e=>{let t=e.cloneNode(!0);if(!(t instanceof Element))return``;let n=`input, textarea, select`,r=e.querySelectorAll(n),i=t.querySelectorAll(n);return r.forEach((e,t)=>{let n=i[t];n&&Bt(e,n)}),zt.sanitize(t.outerHTML,{FORBID_TAGS:[`style`,`script`],FORBID_ATTR:[`style`,`class`]})},Ht=e=>{if(!e?.length)return[];let t=e.join(`,`),n=document.querySelectorAll(t);return Array.from(n,Vt)},Ut=`liipgpt:context`,Wt=class{contextVersion=0;#e=s();get currentContext(){return V(this.#e)}set currentContext(e){k(this.#e,e,!0)}getFromLocalStorage(){let e=localStorage.getItem(Ut);if(e){let t;try{if(t=JSON.parse(e),t.version!==this.contextVersion){localStorage.removeItem(Ut);return}else return t.context}catch(e){console.error(`Failed to parse liipgpt:context`,e);return}}}storeToLocalStorage(){localStorage.setItem(`liipgpt:context`,JSON.stringify({version:K.data.chatConfig.contextVersion,context:this.currentContext}))}constructor(e){this.init=e,this.currentContext=this.getFromLocalStorage()??e.initialValue}getContext(){return p(this.currentContext)}setContextVersion(e){this.contextVersion=e}setContext(e){this.currentContext=e,this.storeToLocalStorage()}resetContext(){this.currentContext=this.init.initialValue,this.storeToLocalStorage()}updateContext(e){this.setContext(e(this.currentContext))}},Gt=()=>localStorage.getItem(Ut),Kt=`liipgpt:selectorValues`,qt=`liipgpt:selectorKnownDefaults`,Jt=()=>{try{let e=We.getItem(Kt),t=We.getItem(qt);return e?{values:JSON.parse(e),knownDefaults:t?JSON.parse(t):{}}:null}catch{return null}},Yt=e=>{let t={};for(let n of e)t[n.settingName]=n.defaultValues??(n.allowEmpty?[]:[n.values[0]]).filter(Boolean);return t},Xt=(e,t)=>{try{let n=Yt(t);We.setItem(Kt,JSON.stringify(e)),We.setItem(qt,JSON.stringify(n))}catch(e){console.error(`Failed to save selector values:`,e)}},Zt=e=>{try{let t=Jt();if(!t)return;delete t.values[e],delete t.knownDefaults[e],We.setItem(Kt,JSON.stringify(t.values)),We.setItem(qt,JSON.stringify(t.knownDefaults))}catch(e){console.error(`Failed to clear selector saved state:`,e)}},Qt=e=>{let t=Jt(),n=e.map(e=>{let n=e.defaultValues??(e.allowEmpty?[]:[e.values[0]]).filter(Boolean);if(!t?.values[e.settingName])return[e.settingName,n];let r=t.values[e.settingName],i=t.knownDefaults[e.settingName]||[],a=r.filter(t=>e.values.includes(t)),o=i.filter(e=>!n.includes(e)),s=a.filter(e=>!o.includes(e)),c=n.filter(e=>!i.includes(e)&&!s.includes(e)),l=[...s,...c];return l.length===0&&!e.allowEmpty?[e.settingName,n]:[e.settingName,l]});return Object.fromEntries(n)},$t=class extends Error{constructor(e){super(e),this.name=`UnreachableError`}},en=e($e(),1),tn=(e,t)=>{if(!e)return;let n=t.find(t=>t.id===e);return n||console.warn(`autofire-predefined-question-id="${e}" did not match any loaded predefined question. Falling back to default routing.`),n},nn=(e,t,n,r,i)=>{if(e&&!t)return{name:`consent-page`};let a=new URLSearchParams(window.location.search),o=a.get(`q`),s=a.get(`id`)??void 0,c=a.get(`sid`)??void 0;return o?{name:`chat-page`,query:o,predefinedQuestionId:s,switchQuestionId:c}:i?{name:`chat-page`,query:i}:r?{name:`chat-page`,query:r.question,predefinedQuestionId:r.id}:n?{name:`chat-page`}:{name:`start-page`}},rn=`follow-up-q`,an=e=>/^[0-9a-f]{8}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{12}$/i.test(e),on=()=>{let e=new URLSearchParams(window.location.hash.replace(/^#/,``)).get(`cID`)??void 0;return{cID:e&&an(e)?e:void 0,followUpQuestion:new URLSearchParams(window.location.search).get(rn)?.trim()||void 0}},sn=()=>{let e=new URLSearchParams(window.location.search);if(!e.has(rn))return;e.delete(rn);let t=e.toString();history.replaceState(null,``,`${window.location.pathname}${t?`?${t}`:``}${window.location.hash}`)},cn=e=>{if(e)try{let t=JSON.parse(e);if(t&&typeof t==`object`&&!Array.isArray(t))return t;console.warn(`additional-start-parameters must be a JSON object. Received: ${e}`);return}catch(t){console.warn(`Failed to parse additional-start-parameters as JSON: ${e}`,t);return}},ln=e=>{let t=cn(e);return t?(e=>Array.isArray(e)?e.map(String):typeof e==`string`?e.split(`,`).map(e=>e.trim()).filter(Boolean):[])(t.scopeAvailableSlugs).length===1:!1},un=e=>e?e.map(e=>({id:Qe(),...e})):[],dn,fn,pn,q=Mt({name:`chat-logic`,state:K,excludeInDevTools:[`onInput`]},{async init(e){fn=e;let t=fn.speechRecognitionApiKey||void 0;dn=new qe({apiUrl:fn.apiUrl,apiKey:fn.apiKey,speechRecognitionApiKey:t,strict:!0,startParameters:cn(fn.additionalStartParameters)});try{let e=await dn.getChatConfig();window.CHAT_CONFIG_OVERRIDE&&Object.assign(e,window.CHAT_CONFIG_OVERRIDE);let t=(await dn.getMetadata()).mode===`maintenance`;t&&this.showErrorToast(`maintenance`);let n=De(e);fn.inlineLayout!==void 0&&(n.inlineLayout=fn.inlineLayout),fn.forceChatPage!==void 0&&(n.forceChatPage=fn.forceChatPage);let r;r=fn.lang?Ne(fn.lang,n.supportedLanguages):Pe(n.supportedLanguages),je(r,K.targets.mainElement);let i=await this.getPredefinedQuestions(r),a=n.translations[r]?.ariaOpensInNewTab;a&&dn.setNewTabSrText(a);let o=[];if(n.renderKatex){let e=await Ee(()=>import(`https://esm.sh/marked-katex-extension@5.1.5`),[],import.meta.url).catch(e=>{console.error(`Couldn't load marked-katex-extension:`,e)});e&&(dn.setMarkedExtensions(e.default({nonStandard:!0,output:`mathml`})),o.push(`https://cdn.jsdelivr.net/npm/katex@0.16.22/dist/katex.min.css`))}let s=Object.keys(n.fullTheme),c=!1;if(n.forceConsent)try{c=We.getItem(`liipgpt:termsAccepted`)===`true`}catch(e){console.warn(`Failed to load terms acceptance from storage:`,e)}let l=tn(fn.autofirePredefinedQuestionId,i);K.data={currentConversationState:`idle`,chatConfig:n,language:r,predefinedQuestions:i,isInMaintenance:t,history:un(n.messageAdditions.init),selectedColorScheme:Oe(),has2ColorSchemes:s.length===2,currentColorScheme:Ae(s),conversationFeedbackId:void 0,conversationFeedbackIsOpen:!1,answerFormMessageId:void 0,openedPopup:void 0,props:fn,flyoutIsOpen:!1,questionHasPii:void 0,chatInputValue:``,selectorValues:Qt(n.selectorsConfig),selectorsIsOpen:!1,predefinedQuestionId:void 0,switchQuestionId:void 0,currentReferencesAsideId:void 0,ariaLiveStatusMessage:void 0,ariaLiveStatusMessageClearingTimeout:void 0,wasReferencesAsideClosed:!1,isAsideMobile:!0,route:nn(n.forceConsent??!1,c,n.forceChatPage??!1,l,fn.question),additionalStylesheets:o,hasOpenedOverlays:!1,isInlineLayoutContained:!1,termsAccepted:c,selectedTopic:void 0},window.LIIPGPT_LISTENERS?.route?.(K.data.route),window.LIIPGPT_LISTENERS?.conversation?.(K.data.currentConversationState),K.data.selectorsIsOpen=K.data.chatConfig.showExpandedSelectors??!1,K.initialized=!0,this.checkForOpenedPopup(),window.addEventListener(`hashchange`,()=>{this.checkForOpenedPopup()}),await this.startFromHandoverOrRoute(()=>this.goto(nn(n.forceConsent??!1,c,n.forceChatPage??!1,l,fn.question),!0))}catch(e){throw wt.error(e instanceof Error?e.message:`Failed to load the chatbot. Please reload the page.`,{duration:1e4,unstyled:!0,classes:{toast:`toast`}}),e}},setTarget(e,t){K.targets[e]=t},goto(e,t=!1){if(!(!t&&(0,en.default)(K.data.route,e)))switch(K.data.route=e,window.LIIPGPT_LISTENERS?.route?.(e),e.name){case`consent-page`:break;case`start-page`:e.prefill&&(K.data.chatInputValue=e.prefill);break;case`chat-page`:if(K.data.chatInputValue=e.query??``,K.data.predefinedQuestionId=e.predefinedQuestionId,K.data.switchQuestionId=e.switchQuestionId,e.query&&(this.onSubmit(),K.data.chatConfig.addQueryToUrlParams)){let t=new URLSearchParams(window.location.search);t.set(`q`,e.query),e.predefinedQuestionId?t.set(`id`,e.predefinedQuestionId):t.delete(`id`),e.switchQuestionId?t.set(`sid`,e.switchQuestionId):t.delete(`sid`),history.pushState(null,``,`?${t.toString()}${window.location.hash}`)}break}},getSelectorConfig(e){let t=K.data.chatConfig.selectorsConfig.find(t=>t.settingName===e);if(!t)throw Error(`Setting ${e} not found`);return t},getPrettifiedSelectorValues(){let e=Object.entries(K.data.selectorValues).map(([e,t])=>{let n;try{n=this.getSelectorConfig(e)}catch(t){console.error(`Error getting selector config for ${e}: ${t}`);return}return n.type===`single-select`?[e,t[0]]:[e,t]}).filter(e=>!!e);return Object.fromEntries(e)},setSelectorValue(e,t){let n=this.getSelectorConfig(e);if(!n){console.warn(`Trying to set setting ${e} but it is not defined in the chat config`);return}if(n.type===`single-select`&&t.length>1){console.warn(`Trying to set multiple values for single-select setting ${e}`);return}K.data.selectorValues[e]=t,Xt(K.data.selectorValues,K.data.chatConfig.selectorsConfig)},resetSelectorToDefaults(e){let t=this.getSelectorConfig(e);if(!t){console.warn(`Trying to reset setting ${e} but it is not defined in the chat config`);return}let n=t.defaultValues??(t.allowEmpty?[]:[t.values[0]]).filter(Boolean);return Zt(e),K.data.selectorValues[e]=n,Xt(K.data.selectorValues,K.data.chatConfig.selectorsConfig),n},async getPredefinedQuestions(e){if(fn?.hidePredefinedQuestions)return[];try{return dn.getPredefinedQuestions({url:window.location.origin+window.location.pathname,language:e})}catch(e){return console.warn(`Failed to load predefined questions:`,e),[]}},setColorScheme(e){K.data.selectedColorScheme=e,K.data.currentColorScheme=ke(e),this.setAriaLiveStatusMessage(e===`dark`?K.t.ariaDarkSelected:K.t.ariaLightSelected)},async abort(){await pn?.abort()},changeConversationState(e){K.data.currentConversationState=e,window.LIIPGPT_LISTENERS?.conversation?.(e)},onInput(e){K.data.chatConfig.blockPII&&(K.data.questionHasPii=Fe(e)),K.data.chatInputValue=e,K.data.predefinedQuestionId=void 0,K.data.switchQuestionId=void 0},onSubmit(e=!1,t,n=!1){let r=Ht(K.data.chatConfig.parentPageContext?.extractSelectors);if(K.data.questionHasPii){console.warn(`Question contains PII, not submitting:`,K.data.questionHasPii);return}let i=K.data.chatConfig.questionPrefix?`${K.data.chatConfig.questionPrefix} ${K.data.chatInputValue}`:K.data.chatInputValue;n||(K.data.history.push(...un(K.data.chatConfig.messageAdditions.user.before)),K.data.history.push({type:`user`,time:new Date().toISOString(),message:K.data.chatInputValue}),K.data.history.push(...un(K.data.chatConfig.messageAdditions.user.after)));let a=K.data.history.push(...un(K.data.chatConfig.messageAdditions.bot.before));K.data.history.push({id:`UNRESOLVED`,state:`loading`,errors:[],type:`bot`,time:new Date().toISOString(),message:{markdown:``,html:``,text:``},references:{all:[],used:[],unused:[]}});let o=!1,s=!1,c={features:fn.features?fn.features.trim().split(`,`):[`formatting`],mode:fn.mode||void 0,cache:fn.cache||void 0,onError:(e,t)=>{this.showErrorToast(e,t),window.LIIPGPT_LISTENERS?.error?.(e,t),(e===`pii-detected`||e===`blocked`)&&this.editLatestQuestion()},onMessage:e=>{e.type===`topic-selected`&&(K.data.selectedTopic={label:e.label,placeholder:e.placeholder,locked:ln(fn.additionalStartParameters)}),e.type===`state`&&e.state!==`history-entry-initialized`&&!s&&(s=!0,this.setAriaLiveStatusMessage(K.t.ariaQuestionSent))},lang:K.data.language,selectorValues:{...this.getPrettifiedSelectorValues(),context:Gt(),...t},predefinedQuestionId:K.data.predefinedQuestionId,switchQuestionId:K.data.switchQuestionId,onEmbed:e=>{let t=K.data.history[a];t&&t.type===`bot`&&!t.message.markdown?(K.data.history[a]={...e,id:t.id??Qe()},o=!0):K.data.history.push({...e,id:Qe()})}};K.data.predefinedQuestionId=void 0,K.data.switchQuestionId=void 0,r.length&&(c.selectorValues.parentPageContextHtml=r);let l=(e,t)=>{try{let n=new URL(e),r=new URL(t);return n.origin===r.origin&&n.pathname===r.pathname}catch{return!1}},u=K.data.chatConfig.sendReferrer??`all`;if([`all`,`own`,`location`].includes(u)){let e=u===`location`||K.data.props.flyout,t;t=e?`${window.location.protocol}//${window.location.host}${window.location.pathname}`:l(document.referrer,window.location.href)?null:document.referrer;let n=u===`own`&&!K.data.props.flyout&&t&&!t.startsWith(window.location.origin);c.referrer=t&&!n?t:void 0}K.data.props.source?c.source=K.data.props.source:K.data.props.flyout&&(c.source=`flyout`),K.data.currentConversationId||(K.data.currentConversationId=dn.createConversationId());let d=dn.chat(K.data.currentConversationId,i,c);pn=d,K.data.lastChatResponseId=d.id,K.data.currentConversationState!==`searching`&&this.changeConversationState(`searching`);let f=!1,p,m=!!K.data.currentReferencesAsideId;(e&&m||!e&&K.data.chatConfig.showReferencesByDefault)&&(K.data.isAsideMobile||this.openReferencesAside(d.id)),d.subscribe(e=>{if(!o&&K.data.history[a]&&(K.data.history[a]={question:K.data.chatInputValue,...e}),K.data.chatConfig.addRetrievalQuestionToUrlParams&&e.retrievalQuestion){let t=new URLSearchParams(window.location.search);t.get(`search`)!==e.retrievalQuestion&&(t.set(`search`,e.retrievalQuestion),history.replaceState(null,``,`?${t.toString()}${window.location.hash}`))}K.data.chatConfig.showReferencesByDefault&&!K.data.wasReferencesAsideClosed&&K.data.currentReferencesAsideId!==e.id&&!K.data.isAsideMobile&&this.openReferencesAside(e.id),e.state===`streaming`&&K.data.currentConversationState!==`answering`&&this.changeConversationState(`answering`),e.state===`done`&&(this.changeConversationState(`idle`),f||(f=!0,this.setAriaLiveStatusMessage(`${K.t.ariaAnswerReady} ... ${e.message.text} ... ${K.data.selectedTopic?K.t.ariaAnswerFinishedWithSelectedTopic:K.t.ariaAnswerFinished}`),K.data.history.push(...un(K.data.chatConfig.messageAdditions.bot.after))),K.data.currentReferencesAsideId&&e.references.used.length>0?(clearTimeout(p),p=setTimeout(()=>{this.openReferencesAside(e.id)},100)):this.closeReferencesAside())}),K.data.chatInputValue=``},async onStartSpeechRecognition(){try{if(!await Nt()){this.showErrorToast(`speech-not-supported`);return}if(await navigator.mediaDevices.getUserMedia({audio:!0}),Rt.isSupported())K.data.chatInputValue=``,K.currentAudioRecorder=new Rt({onDataAvailable:async e=>{K.isTranscribing=!0,await this.handleTranscription(e)},onError:()=>{this.showErrorToast(`speech-microphone-access-denied`),K.currentAudioRecorder=null,K.isTranscribing=!1},onVolumeChange:e=>{K.currentAudioVolume=e}}),K.currentAudioRecorder.start();else{this.showErrorToast(`speech-not-supported`);return}}catch(e){throw this.showErrorToast(`speech-microphone-access-denied`),K.currentAudioRecorder=null,K.isTranscribing=!1,e}},editLatestQuestion(){let e=K.data.history.findLastIndex(e=>e?.type===`user`);if(e===-1){console.error(`No last user question, available`);return}let t=K.data.history.splice(e)[0];K.data.chatInputValue=t.message},onStopSpeechRecognition(){if(K.currentAudioRecorder){let e=K.currentAudioRecorder;K.currentAudioRecorder=null,e.stop()}K.currentAudioVolume=0},async handleTranscription(e){if(!e){console.warn(`No audio data received`);return}try{let t=await dn.transcribeAudio(e,{lang:K.data.language});if(t.error){this.showErrorToast(`speech-transcription-failed`);return}if(t.transcript.trim()){if(K.data.chatConfig.blockPII&&(K.data.questionHasPii=Fe(t.transcript.trim()),K.data.questionHasPii))return;K.data.chatInputValue=t.transcript.trim()}else this.showErrorToast(`speech-no-text-detected`)}catch(e){console.error(`Speech transcription error:`,e),this.showErrorToast(`speech-transcription-failed`)}finally{K.currentAudioRecorder=null,K.isTranscribing=!1,K.currentAudioVolume=0}},async startFromHandoverOrRoute(e){let{cID:t,followUpQuestion:n}=on();if(!t){e();return}let r=await this.rehydrateFromSearchSummaryHandover(t);n?(K.data.route={name:`chat-page`},K.data.chatInputValue=n,this.onSubmit(!0)):r||e(),sn()},async rehydrateFromSearchSummaryHandover(e){K.data.currentConversationId=e;let t=await dn.getMetadata(),n=t.mode===`ready`?t.userId:void 0,r=n?await dn.getChatHistory(e,n):[];if(r.length===0)return K.data.currentConversationId=void 0,!1;let i={all:[],used:[],unused:[]},a=new Je({newTabSrText:K.t.ariaOpensInNewTab}),o=[];for(let{question:e,answer:t}of r)o.push({type:`user`,time:new Date().toISOString(),message:e,id:Qe()}),o.push({id:Qe(),state:`done`,errors:[],type:`bot`,time:new Date().toISOString(),message:{markdown:t,html:a.toHTML(t,i),text:t},references:{all:[],used:[],unused:[]}});return K.data.history=[...un(K.data.chatConfig.messageAdditions.init),...o],K.data.route={name:`chat-page`},!0},async onStartConversation(e,t,n){await this.abort(),K.data.history=un(K.data.chatConfig.messageAdditions.init),K.data.currentConversationId=dn.createConversationId(),this.goto({name:`chat-page`,query:e,predefinedQuestionId:t,switchQuestionId:n})},async onNewConversation(){await this.abort();let e=K.data.currentConversationId;if(K.data.currentConversationId=void 0,K.data.currentReferencesAsideId=void 0,K.data.history=un(K.data.chatConfig.messageAdditions.init),K.data.predefinedQuestionId=void 0,K.data.switchQuestionId=void 0,K.data.selectedTopic=void 0,K.data.chatConfig.addQueryToUrlParams){let e=new URLSearchParams(window.location.search);e.delete(`q`),e.delete(`id`),e.delete(`sid`),history.pushState(null,``,`?${e.toString()}${window.location.hash}`)}this.goto({name:`start-page`}),e&&dn.userAction(`newDiscussion`,{conversationId:e,lang:K.data.language}).catch(e=>{console.error(`Failed to notify backend of new discussion:`,e)})},async onChangeTopic(){let e=K.data.chatConfig.selectedTopicResetPredefinedQuestionId;if(!e){console.warn("No selectedTopicResetPredefinedQuestionId available to reset the selected topic. Set it in the `Config DB` in the backend, in a `generalConfig` default set.");return}await this.abort(),K.data.selectedTopic=void 0,K.data.predefinedQuestionId=e,K.data.switchQuestionId=void 0,K.data.chatInputValue=``,this.onSubmit(!0,void 0,!0)},showSuccessToast(e){wt.success(K.t[e],{unstyled:!0,duration:3e3,classes:{toast:`toast`}})},showErrorToast(e,t){let n=t?.trim()?t:K.errorTranslations[e];wt.error(n,{unstyled:!0,duration:3e3,classes:{toast:`toast`}})},async submitFeedback(e){try{let t=K.data.conversationFeedbackId||K.data.lastChatResponseId;if(!t)throw new $t(`Tried to give feedback with no id.`);let n=K.data.history.find(e=>e.type===`bot`&&e.id===t);await dn.feedback(t,n?.question??``,e),setTimeout(()=>{this.showSuccessToast(`thankYouForFeedback`)},500)}catch(e){console.error(`Feedback failed:`,e),this.showErrorToast(`feedback-failed`)}},toggleReferencesAside(e){K.data.currentReferencesAsideId===e?this.closeReferencesAside():this.openReferencesAside(e)},openReferencesAside(e){K.data.chatConfig.referencesLayout!==`inline`&&(K.data.currentReferencesAsideId=e,this.setOpenOverlay(!0))},closeReferencesAside(){K.data.currentReferencesAsideId=void 0,K.data.wasReferencesAsideClosed=!0,this.setOpenOverlay(!1)},setAsideMobile(e){K.data.isAsideMobile=e},openFlyout(){K.data.flyoutIsOpen=!0},closeFlyout(){K.data.flyoutIsOpen=!1},openConversationFeedback(){K.data.conversationFeedbackIsOpen=!0,this.setOpenOverlay(!0)},openMessageFeedback(e){K.data.conversationFeedbackId=e},closeFeedback(){K.data.conversationFeedbackIsOpen=!1,K.data.conversationFeedbackId=void 0,this.setOpenOverlay(!1)},openAnswerForm(e){K.data.answerFormMessageId=e,this.setOpenOverlay(!0)},closeAnswerForm(){K.data.answerFormMessageId=void 0,this.setOpenOverlay(!1)},async submitAnswerForm(e){try{let t=K.data.chatConfig.answerForm,n=K.data.answerFormMessageId;if(!t)throw new $t(`Tried to submit the answer form with no answerForm config.`);if(!n)throw new $t(`Tried to submit the answer form with no message id.`);let r=K.data.history.findIndex(e=>e.type===`bot`&&e.id===n),i=r===-1?void 0:K.data.history[r],a=K.data.history.slice(0,r===-1?void 0:r).findLast(e=>e.type===`user`)?.message,o=i?.question||a||(i?.type===`bot`?i.retrievalQuestion??``:``);await dn.submitAnswerForm({receiverEmail:t.receiverEmail,fields:t.fields.map(t=>({name:t.name,value:e[t.name]??``})),question:o,answer:i?.type===`bot`?i.message.text:``,requestId:n,lang:K.data.language}),setTimeout(()=>{this.showSuccessToast(`answerFormThankYou`)},500)}catch(e){console.error(`Answer form submission failed:`,e),this.showErrorToast(`answer-form-failed`)}},setOpenOverlay(e){K.data.hasOpenedOverlays=e},setAriaLiveStatusMessage(e){K.data.ariaLiveStatusMessage=e,clearTimeout(K.data.ariaLiveStatusMessageClearingTimeout),K.data.ariaLiveStatusMessageClearingTimeout=setTimeout(()=>{K.data.ariaLiveStatusMessage=``},K.ariaLiveMessagesClearingTimeoutDuration)},closePopup(){window.location.hash=``},checkForOpenedPopup(){let e=window.location.hash.slice(1),t=K.t.popups?.find(t=>t.hash===e);t?K.data.openedPopup=t:K.data.openedPopup=void 0},async thumbs(e,t){try{let n=K.data.history.find(t=>t.type===`bot`&&t.id===e),r=n?.type===`bot`?n:void 0;if(r?.feedback===t)return;t===`up`?await dn.thumbsUp(e,n?.question??``):await dn.thumbsDown(e,n?.question??``);let i=!r?.feedback;r&&(r.feedback=t),i&&this.showSuccessToast(`thankYouForFeedback`)}catch(e){console.error(`Feedback failed:`,e),this.showErrorToast(`feedback-failed`)}},async onLanguageChange(e){if(K.data.language=Ne(e,K.data.chatConfig.supportedLanguages),je(K.data.language,K.targets.mainElement),K.data.predefinedQuestions=await this.getPredefinedQuestions(K.data.language),this.setAriaLiveStatusMessage(K.t.ariaLanguageChanged),K.data.chatConfig.reflectLanguageInPath){let e=new URL(window.location.href);e.pathname=`/${K.data.language}`,window.history.replaceState({},``,e.toString())}},async acceptTerms(){K.data.termsAccepted=!0;try{We.setItem(`liipgpt:termsAccepted`,`true`)}catch(e){console.warn(`Failed to save terms acceptance to storage:`,e)}this.closePopup(),await oe(),this.goto(nn(K.data.chatConfig.forceConsent??!1,!0,K.data.chatConfig.forceChatPage??!1,tn(K.data.props.autofirePredefinedQuestionId,K.data.predefinedQuestions),K.data.props.question))},updateChatInput(e){K.data.chatInputValue=e}}),mn=(e,t)=>{let n=window.LIIPGPT_LISTENERS?.elements?.[t];if(!n)return;let r=Object.entries(n).filter(([e,t])=>typeof t==`function`&&![`init`,`destroy`].includes(e));I(()=>(n.init?.(e),r.forEach(([t,n])=>{e.addEventListener(t,n)}),()=>{r.forEach(([t,n])=>{e.removeEventListener(t,n)}),n.destroy?.(e)}))},hn=(e,t)=>{t&&q.setTarget(t,e)},gn=M(`<div aria-hidden="true"></div>`);function J(e,t){E(t,!0);let n=B(t,`name`,7),r=B(t,`class`,7);var i={get name(){return n()},set name(e){n(e),x()},get class(){return r()},set class(e){r(e),x()}},a=gn();return we(a,()=>K.theme.svgs[n()],!0),d(a),z(()=>c(a,1,`svg svg--${n()??``} ${r()??``}`)),g(e,a),y(i)}L(J,{name:{},class:{}},[],[],{mode:`open`});var _n=`data-disable-tooltip-on-focus`;function vn(e,t){let n=null,r;function i(){t.text&&(n||(n=document.createElement(`span`),n.ariaHidden=`true`,n.textContent=t.text,n.className=`tooltip tooltip-${t.position||`top`} tooltip-hidden`,e.appendChild(n),n.getBoundingClientRect()),n.classList.remove(`tooltip-hidden`),a())}function a(){if(!n)return;let r=e.getBoundingClientRect(),i=n.getBoundingClientRect(),a,o;switch(t.position){case`bottom`:a=r.height+5,o=r.width/2-i.width/2;break;case`bottom-right`:a=r.height+5,o=r.width-i.width;break;case`bottom-left`:a=r.height+5,o=0;break;case`left`:a=r.height/2-i.height/2,o=-i.width-5;break;case`right`:a=r.height/2-i.height/2,o=r.width+5;break;default:a=-i.height-5,o=r.width/2-i.width/2;break}let s=r.left+o,c=s+i.width,l=window.innerWidth;if(c>l){let e=c-l;if(o-=e+10,t.position===`top`||t.position===`bottom`){let t=e+10;n.style.setProperty(`--tooltip-arrow-offset`,`${t}px`)}}if(s<0&&(o-=s-10,t.position===`top`||t.position===`bottom`)){let e=s-10;n.style.setProperty(`--tooltip-arrow-offset`,`${e}px`)}n.style.top=`${a}px`,n.style.left=`${o}px`}function o(){r=window.setTimeout(()=>{i()},t.delay||200)}function s(e){let t=e.target;t&&!t.hasAttribute(`data-disable-tooltip-on-focus`)?o():t.removeAttribute(_n)}function c(){clearTimeout(r),n&&(n.classList.add(`tooltip-hidden`),n.addEventListener(`transitionend`,()=>{n?.remove(),n=null},{once:!0}))}return e.classList.add(`tooltip-container`),e.setAttribute(`tabindex`,`0`),e.addEventListener(`mouseenter`,o),e.addEventListener(`focus`,s),e.addEventListener(`mouseleave`,c),e.addEventListener(`blur`,c),e.addEventListener(`click`,c),{update(e){t=e},destroy(){c(),e.classList.remove(`tooltip-container`),e.removeEventListener(`mouseenter`,o),e.removeEventListener(`focus`,s),e.removeEventListener(`mouseleave`,c),e.removeEventListener(`blur`,c),e.removeEventListener(`click`,c)}}}var yn=M(`<button><span class="sr-only"> </span> <span><!></span></button>`);function bn(e,t){E(t,!0);let n=B(t,`class`,7),r=B(t,`tooltip`,7),i=B(t,`label`,7),a=B(t,`onclick`,7),s=B(t,`icon`,7),l=U(t,[`$$slots`,`$$events`,`$$legacy`,`$$host`,`class`,`tooltip`,`label`,`onclick`,`icon`]);var u={get class(){return n()},set class(e){n(e),x()},get tooltip(){return r()},set tooltip(e){r(e),x()},get label(){return i()},set label(e){i(e),x()},get onclick(){return a()},set onclick(e){a(e),x()},get icon(){return s()},set icon(e){s(e),x()}},f=yn();F(f,()=>({onclick:a(),...l}));var p=P(f),m=P(p,!0);d(p);var h=D(p,2);return J(P(h),{get name(){return s()}}),d(h),d(f),pe(f,(e,t)=>vn?.(e,t),()=>({text:r(),position:`top`,delay:300})),z(()=>{_(m,i()),c(h,1,o(n()))}),g(e,f),y(u)}L(bn,{class:{},tooltip:{},label:{},onclick:{},icon:{}},[],[],{mode:`open`});var xn=M(`<p class="jsonld-card__description"> </p>`),Sn=M(`<article class="jsonld-card jsonld-card--cta"><header class="jsonld-card__header"><h3 class="jsonld-card__title"> </h3></header> <!> <a class="jsonld-card__cta btn" target="_blank" rel="noopener noreferrer"><span> </span> <!></a></article>`);function Cn(e,t){E(t,!0);let n=B(t,`data`,7);var r={get data(){return n()},set data(e){n(e),x()}},i=Sn(),a=P(i),o=P(a),s=P(o,!0);d(o),d(a);var c=D(a,2),l=e=>{var t=xn(),r=P(t,!0);d(t),z(()=>_(r,n().description)),g(e,t)};A(c,e=>{n().description&&e(l)});var u=D(c,2),f=P(u),p=P(f,!0);return d(f),J(D(f,2),{name:`externalLink`,class:`jsonld-card__cta-icon`}),d(u),d(i),z(()=>{W(i,`aria-label`,`${K.t.ariaJsonLdCtaCard??``}: ${n().title??``}`),_(s,n().title),W(u,`href`,n().url),_(p,n().label??K.t.jsonLdCtaLabel)}),g(e,i),y(r)}L(Cn,{data:{}},[],[],{mode:`open`});var wn=M(`<span class="jsonld-card__event-time"> </span>`),Tn=M(`<dt class="jsonld-card__meta-label"> </dt> <dd class="jsonld-card__meta-value"><time class="jsonld-card__event-date"><span> </span> <!></time></dd>`,1),En=M(`<dt class="jsonld-card__meta-label"> </dt> <dd class="jsonld-card__meta-value"> </dd>`,1),Dn=M(`<dt class="jsonld-card__meta-label"> </dt> <dd class="jsonld-card__meta-value"> </dd>`,1),On=M(`<article class="jsonld-card jsonld-card--event"><header class="jsonld-card__header"><h3 class="jsonld-card__title"> </h3></header> <dl class="jsonld-card__meta"><!> <!> <!></dl> <a class="jsonld-card__cta btn" target="_blank" rel="noopener noreferrer"><span> </span> <!></a></article>`);function kn(e,t){E(t,!0);let n=B(t,`data`,7),r=R(()=>{if(!n().date)return;let e=new Date(n().date);if(Number.isNaN(e.getTime()))return{day:n().date,time:void 0};let t=K.data.language||`de`;try{return{day:e.toLocaleDateString(t,{weekday:`long`,day:`numeric`,month:`long`,year:`numeric`}),time:e.getHours()!==0||e.getMinutes()!==0?e.toLocaleTimeString(t,{hour:`2-digit`,minute:`2-digit`}):void 0}}catch{return{day:e.toLocaleString(),time:void 0}}});var i={get data(){return n()},set data(e){n(e),x()}},a=On(),o=P(a),s=P(o),c=P(s,!0);d(s),d(o);var l=D(o,2),u=P(l),f=e=>{var t=Tn(),i=G(t),a=P(i,!0);d(i);var o=D(i,2),s=P(o),c=P(s),l=P(c,!0);d(c);var u=D(c,2),f=e=>{var t=wn(),n=P(t,!0);d(t),z(()=>_(n,V(r).time)),g(e,t)};A(u,e=>{V(r).time&&e(f)}),d(s),d(o),z(()=>{_(a,K.t.jsonLdEventDate),W(s,`datetime`,n().date),_(l,V(r).day)}),g(e,t)};A(u,e=>{V(r)&&e(f)});var p=D(u,2),m=e=>{var t=En(),r=G(t),i=P(r,!0);d(r);var a=D(r,2),o=P(a,!0);d(a),z(()=>{_(i,K.t.jsonLdEventLocation),_(o,n().location)}),g(e,t)};A(p,e=>{n().location&&e(m)});var h=D(p,2),v=e=>{var t=Dn(),r=G(t),i=P(r,!0);d(r);var a=D(r,2),o=P(a,!0);d(a),z(()=>{_(i,K.t.jsonLdEventDescription),_(o,n().description)}),g(e,t)};A(h,e=>{n().description&&e(v)}),d(l);var b=D(l,2),S=P(b),C=P(S,!0);return d(S),J(D(S,2),{name:`externalLink`,class:`jsonld-card__cta-icon`}),d(b),d(a),z(()=>{W(a,`aria-label`,`${K.t.ariaJsonLdEventCard??``}: ${n().title??``}`),_(c,n().title),W(b,`href`,n().ctaUrl),_(C,n().ctaLabel??K.t.jsonLdEventCtaLabel)}),g(e,a),y(i)}L(kn,{data:{}},[],[],{mode:`open`});var An=M(`<p class="jsonld-card__description"> </p>`),jn=M(`<div class="jsonld-card__map-frame"><div class="jsonld-card__map-canvas"></div></div>`),Mn=M(`<p class="jsonld-card__address"> </p>`),Nn=M(`<a class="jsonld-card__contact btn btn--secondary"><!> <span> </span></a>`),Pn=M(`<a class="jsonld-card__contact btn btn--secondary"><!> <span> </span></a>`),Fn=M(`<article class="jsonld-card jsonld-card--map"><header class="jsonld-card__header"><h3 class="jsonld-card__title"> </h3></header> <!> <!> <!> <div class="jsonld-card__actions"><!> <!> <a class="jsonld-card__cta btn" target="_blank" rel="noopener noreferrer"><span> </span> <!></a></div></article>`);function In(e,t){E(t,!0);let n=`5.24.0`,r=[`https://cdn.jsdelivr.net/npm/maplibre-gl@${n}/+esm`,`https://unpkg.com/maplibre-gl@${n}/dist/maplibre-gl.js?module`],i=`https://cdn.jsdelivr.net/npm/maplibre-gl@${n}/dist/maplibre-gl.css`,a=B(t,`data`,7),o=s(void 0),c=R(()=>{if(a().directionsUrl)return a().directionsUrl;if(!a().coords)return a().fallbackUrl;let e=String(K.theme.components.messageJsonLdMap?.custom?.directionsProvider||``)||`google`,{lat:t,lng:n}=a().coords;return e===`osm`?`https://www.openstreetmap.org/directions?to=${t},${n}`:`https://www.google.com/maps/dir/?api=1&destination=${t},${n}`}),l=e=>new Promise(t=>{let n=`jsonld-map-maplibre-style`,r=e.getRootNode(),a=r instanceof ShadowRoot?r:document.head,o=a.querySelector(`#${n}`);if(o instanceof HTMLLinkElement&&o.sheet){t();return}if(o){o.addEventListener(`load`,()=>t(),{once:!0});return}let s=document.createElement(`link`);s.id=n,s.rel=`stylesheet`,s.href=i,s.onload=()=>t(),s.onerror=()=>t(),a.appendChild(s)}),u=e=>{let t=e;return t.Map?t:t.default??t},f=async e=>{await l(e);let t;for(let e of r)try{return u(await Ee(()=>import(e),[],import.meta.url))}catch(e){t=e}throw t};ve(()=>{let e=a().coords;if(!e)return;let t=String(K.theme.components.messageJsonLdMap?.custom?.tileUrl||``)||`https://tile.openstreetmap.org/{z}/{x}/{y}.png`,n=String(K.theme.components.messageJsonLdMap?.custom?.markerColor||``)||`#3fb1ce`,r=String(K.theme.components.messageJsonLdMap?.custom?.mapStyleUrl||``),i,s,c,l,u=0,d=0,p=!1;return(async()=>{await oe();let m=V(o);if(!m||p)return;let h=await f(m);if(p)return;let g=(e=>{if(e.trim().startsWith(`{`))try{return JSON.parse(e)}catch{return null}return e||null})(r)??{version:8,sources:{"osm-tiles":{type:`raster`,tiles:[t],tileSize:256}},layers:[{id:`osm-tiles`,type:`raster`,source:`osm-tiles`,minzoom:0,maxzoom:19}]};if(i=new h.Map({container:m,style:g,center:[e.lng,e.lat],zoom:a().zoom,attributionControl:!1,scrollZoom:!1,touchZoomRotate:!0,touchPitch:!1,doubleClickZoom:!0}),p){i.remove();return}i.once(`style.load`,()=>{let t=()=>{if(p||!i)return;i.resize();let r=i.getCanvas();r.width>0&&r.height>0?s=new h.Marker({color:n}).setLngLat([e.lng,e.lat]).addTo(i):requestAnimationFrame(t)};t()}),l=new ResizeObserver(e=>{let t=e[0];if(!t||!i)return;let{width:n,height:r}=t.contentRect;n===u&&r===d||(u=n,d=r,cancelAnimationFrame(c??0),c=requestAnimationFrame(()=>i?.resize()))}),l.observe(m)})(),()=>{p=!0,cancelAnimationFrame(c??0),l?.disconnect(),s?.remove(),i?.remove()}});var p={get data(){return a()},set data(e){a(e),x()}},m=Fn(),h=P(m),v=P(h),b=P(v,!0);d(v),d(h);var S=D(h,2),C=e=>{var t=An(),n=P(t,!0);d(t),z(()=>_(n,a().description)),g(e,t)};A(S,e=>{a().description&&e(C)});var w=D(S,2),T=e=>{var t=jn(),n=P(t);xe(n,e=>k(o,e),()=>V(o)),d(t),z(()=>W(n,`aria-label`,`${K.t.ariaJsonLdMapCanvas??``}: ${a().title??``}`)),g(e,t)};A(w,e=>{a().coords&&e(T)});var O=D(w,2),j=e=>{var t=Mn(),n=P(t,!0);d(t),z(()=>_(n,a().address)),g(e,t)};A(O,e=>{a().address&&e(j)});var ee=D(O,2),M=P(ee),N=e=>{var t=Nn(),n=P(t);J(n,{name:`phone`,class:`jsonld-card__cta-icon`});var r=D(n,2),i=P(r,!0);d(r),d(t),z(()=>{W(t,`href`,`tel:${a().phone??``}`),_(i,a().phone)}),g(e,t)};A(M,e=>{a().phone&&e(N)});var te=D(M,2),ne=e=>{var t=Pn(),n=P(t);J(n,{name:`email`,class:`jsonld-card__cta-icon`});var r=D(n,2),i=P(r,!0);d(r),d(t),z(()=>{W(t,`href`,`mailto:${a().email??``}`),_(i,a().email)}),g(e,t)};A(te,e=>{a().email&&e(ne)});var re=D(te,2),ie=P(re),ae=P(ie,!0);return d(ie),J(D(ie,2),{name:`externalLink`,class:`jsonld-card__cta-icon`}),d(re),d(ee),d(m),z(()=>{W(m,`aria-label`,`${K.t.ariaJsonLdMapCard??``}: ${a().title??``}`),_(b,a().title),W(re,`href`,V(c)),_(ae,K.t.jsonLdMapOpenMap)}),g(e,m),y(p)}L(In,{data:{}},[],[],{mode:`open`});var Ln=(e,t)=>{let n=e[t];return typeof n==`string`&&n.length>0?n:void 0},Rn=(e,t)=>{let n=e[t];return typeof n==`number`&&Number.isFinite(n)?n:void 0},zn=e=>e.display.card.title||e.display.listItem.title,Bn=e=>{let t=e.metadata;if(t.jsonLdBlock===`event-card`)return{block:`event-card`,data:{title:zn(e),description:e.display.card.description,date:Ln(t,`jsonLdEventStartDate`),location:Ln(t,`jsonLdEventLocation`),ctaLabel:Ln(t,`jsonLdEventCtaLabel`),ctaUrl:Ln(t,`jsonLdEventCtaUrl`)??e.url}};if(t.jsonLdBlock===`map`){let n=Rn(t,`jsonLdMapLat`),r=Rn(t,`jsonLdMapLng`);return{block:`map`,data:{title:Ln(t,`jsonLdMapLabel`)??zn(e),description:Ln(t,`jsonLdMapDescription`)??e.display.card.description,address:Ln(t,`jsonLdMapAddress`),url:Ln(t,`jsonLdMapUrl`),phone:Ln(t,`jsonLdMapPhone`),email:Ln(t,`jsonLdMapEmail`),coords:n!==void 0&&r!==void 0?{lat:n,lng:r}:void 0,zoom:Rn(t,`jsonLdMapZoom`)??15,fallbackUrl:e.url,directionsUrl:Ln(t,`jsonLdMapDirectionsUrl`)}}}if(t.jsonLdBlock===`cta`)return{block:`cta`,data:{title:zn(e),description:e.display.card.description,label:Ln(t,`jsonLdCtaLabel`),url:Ln(t,`jsonLdCtaUrl`)??e.url}}},Vn=M(`<div role="listitem"><!></div>`),Hn=M(`<div class="jsonld-references" role="list"></div>`);function Un(e,t){E(t,!0);let n=B(t,`references`,7),r=B(t,`ready`,7,!1),a=R(()=>n().flatMap(e=>{let t=Bn(e);return t?[{key:e.url+e.referenceIndex.all,display:t}]:[]})),o=R(()=>K.theme?.components?.messageOptions?.custom),s=R(()=>Number(V(o)?.transitionDuration)||300),l=R(()=>Number(V(o)?.transitionDelay)||0),u=R(()=>Number(V(o)?.transitionY)||30);var f={get references(){return n()},set references(e){n(e),x()},get ready(){return r()},set ready(e=!1){r(e),x()}},p=N(),m=G(p),h=e=>{var t=Hn();i(t,23,()=>V(a),({key:e,display:t})=>e,(e,t,n)=>{let i=()=>V(t).display;var a=Vn();let o,f;var p=P(a),m=e=>{kn(e,{get data(){return i().data}})},h=e=>{In(e,{get data(){return i().data}})},_=e=>{Cn(e,{get data(){return i().data}})};A(p,e=>{i().block===`event-card`?e(m):i().block===`map`?e(h,1):i().block===`cta`&&e(_,2)}),d(a),z(()=>{o=c(a,1,`jsonld-references__item`,null,o,{"jsonld-references__item--preloading":!r()}),f=O(a,``,f,{"--jsonld-item-duration":`${V(s)??``}ms`,"--jsonld-item-delay":`${V(l)+V(n)*V(s)}ms`,"--jsonld-item-y":`${V(u)??``}px`})}),g(e,a)}),d(t),g(e,t)};return A(m,e=>{V(a).length>0&&e(h)}),g(e,p),y(f)}L(Un,{references:{},ready:{}},[],[],{mode:`open`});var Wn=M(`<div><div><!></div></div>`);function Gn(e,t){E(t,!0);let n=B(t,`class`,7),r=B(t,`children`,7),i=s(void 0);var a={get class(){return n()},set class(e){n(e),x()},get children(){return r()},set children(e){r(e),x()}},l=Wn();let u;var f=P(l);return v(P(f),()=>r()??H),d(f),d(l),z(()=>{c(l,1,o([`animated-height`,n()])),u=O(l,``,u,{height:V(i)?`${V(i)}px`:`auto`})}),se(f,`clientHeight`,e=>k(i,e)),g(e,l),y(a)}L(Gn,{class:{},children:{}},[],[],{mode:`open`});var Kn=M(`<span class="reference__number transition-colors"> </span>`),qn=M(`<span class="reference__description transition-colors line-clamp line-clamp--6"> </span>`),Jn=M(`<span class="reference__breadcrumb transition-colors"> </span>`),Yn=M(`<div class="reference__footer"><span class="reference__domain transition-colors"><span class="truncate"> </span></span> <!></div>`),Xn=M(`<a target="_blank" rel="noopener noreferrer" class="reference transition-colors"><!> <span class="reference__body transition-colors"><span class="reference__header"><span class="reference__title line-clamp line-clamp--2 h4"> </span> <!></span> <!> <!></span></a>`);function Zn(e,t){E(t,!0);let n=B(t,`reference`,7),r=R(()=>`${n().display.listItem.title}. ${n().display.card.description}. ${K.t.ariaReferenceSource} ${n().display.listItem.badge}${n().display.listItem.breadcrumbs?` / `+n().display.listItem.breadcrumbs.join(` / `):``}`);var a={get reference(){return n()},set reference(e){n(e),x()}},o=Xn(),s=P(o),c=e=>{var t=Kn(),r=P(t,!0);d(t),z(()=>_(r,n().referenceIndex.used)),g(e,t)};A(s,e=>{n().referenceIndex.used&&e(c)});var l=D(s,2),u=P(l),f=P(u),p=P(f,!0);d(f),J(D(f,2),{name:`externalLink`,class:`reference__icon transition-colors`}),d(u);var m=D(u,2),h=e=>{var t=qn(),r=P(t,!0);d(t),z(()=>_(r,n().display.card.description)),g(e,t)};A(m,e=>{n().display.card.description&&e(h)});var v=D(m,2),b=e=>{var t=Yn(),r=P(t),a=P(r),o=P(a,!0);d(a),d(r);var s=D(r,2),c=e=>{var t=N();i(G(t),17,()=>n().display.listItem.breadcrumbs,j,(e,t)=>{var n=Jn(),r=P(n,!0);d(n),z(()=>_(r,V(t))),g(e,n)}),g(e,t)};A(s,e=>{n().display.listItem.breadcrumbs&&e(c)}),d(t),z(()=>_(o,n().display.listItem.badge)),g(e,t)};return A(v,e=>{n().display.listItem.badge&&e(b)}),d(l),d(o),z(()=>{W(o,`href`,n().url),W(o,`aria-label`,V(r)),_(p,n().display.listItem.title)}),g(e,o),y(a)}L(Zn,{reference:{}},[],[],{mode:`open`});function Qn(e,{delay:t=0,duration:n=500,resetTop:r=!0}){let i=+getComputedStyle(e).opacity;return e.style.position=`absolute`,r&&(e.style.top=`0px`),{delay:t,duration:n,css:e=>`opacity: ${e*i};`}}function $n(e){return typeof e==`function`}function er(e){return typeof e==`object`&&!!e}var tr=[`string`,`number`,`bigint`,`boolean`];function nr(e){return e==null||tr.includes(typeof e)?!0:Array.isArray(e)?e.every(e=>nr(e)):typeof e==`object`?Object.getPrototypeOf(e)===Object.prototype:!1}var rr=Symbol(`box`),ir=Symbol(`is-writable`);function Y(e,t){let n=R(e);return t?{[rr]:!0,[ir]:!0,get current(){return V(n)},set current(e){t(e)}}:{[rr]:!0,get current(){return e()}}}function ar(e){return er(e)&&rr in e}function or(e){return ar(e)&&ir in e}function sr(e){return ar(e)?e:$n(e)?Y(e):ur(e)}function cr(e){return Object.entries(e).reduce((e,[t,n])=>ar(n)?(or(n)?Object.defineProperty(e,t,{get(){return n.current},set(e){n.current=e}}):Object.defineProperty(e,t,{get(){return n.current}}),e):Object.assign(e,{[t]:n}),{})}function lr(e){return or(e)?{[rr]:!0,get current(){return e.current}}:e}function ur(e){let t=s(a(e));return{[rr]:!0,[ir]:!0,get current(){return V(t)},set current(e){k(t,e,!0)}}}function dr(e){let t=s(a(e));return{[rr]:!0,[ir]:!0,get current(){return V(t)},set current(e){k(t,e,!0)}}}dr.from=sr,dr.with=Y,dr.flatten=cr,dr.readonly=lr,dr.isBox=ar,dr.isWritableBox=or;function fr(...e){return function(t){for(let n of e)if(n){if(t.defaultPrevented)return;typeof n==`function`?n.call(this,t):n.current?.call(this,t)}}}var pr=/\/\*[^*]*\*+([^/*][^*]*\*+)*\//g,mr=/\n/g,hr=/^\s*/,gr=/^(\*?[-#/*\\\w]+(\[[0-9a-z_-]+\])?)\s*/,_r=/^:\s*/,vr=/^((?:'(?:\\'|.)*?'|"(?:\\"|.)*?"|\([^)]*?\)|[^};])+)/,yr=/^[;\s]*/,br=/^\s+|\s+$/g,xr=`
2
2
  `,Sr=`/`,Cr=`*`,wr=``,Tr=`comment`,Er=`declaration`;function Dr(e,t){if(typeof e!=`string`)throw TypeError(`First argument must be a string`);if(!e)return[];t||={};var n=1,r=1;function i(e){var t=e.match(mr);t&&(n+=t.length);var i=e.lastIndexOf(xr);r=~i?e.length-i:r+e.length}function a(){var e={line:n,column:r};return function(t){return t.position=new o(e),l(),t}}function o(e){this.start=e,this.end={line:n,column:r},this.source=t.source}o.prototype.content=e;function s(i){var a=Error(t.source+`:`+n+`:`+r+`: `+i);if(a.reason=i,a.filename=t.source,a.line=n,a.column=r,a.source=e,!t.silent)throw a}function c(t){var n=t.exec(e);if(n){var r=n[0];return i(r),e=e.slice(r.length),n}}function l(){c(hr)}function u(e){var t;for(e||=[];t=d();)t!==!1&&e.push(t);return e}function d(){var t=a();if(!(Sr!=e.charAt(0)||Cr!=e.charAt(1))){for(var n=2;wr!=e.charAt(n)&&(Cr!=e.charAt(n)||Sr!=e.charAt(n+1));)++n;if(n+=2,wr===e.charAt(n-1))return s(`End of comment missing`);var o=e.slice(2,n-2);return r+=2,i(o),e=e.slice(n),r+=2,t({type:Tr,comment:o})}}function f(){var e=a(),t=c(gr);if(t){if(d(),!c(_r))return s(`property missing ':'`);var n=c(vr),r=e({type:Er,property:Or(t[0].replace(pr,wr)),value:n?Or(n[0].replace(pr,wr)):wr});return c(yr),r}}function p(){var e=[];u(e);for(var t;t=f();)t!==!1&&(e.push(t),u(e));return e}return l(),p()}function Or(e){return e?e.replace(br,wr):wr}function kr(e,t){let n=null;if(!e||typeof e!=`string`)return n;let r=Dr(e),i=typeof t==`function`;return r.forEach(e=>{if(e.type!==`declaration`)return;let{property:r,value:a}=e;i?t(r,a,e):a&&(n||={},n[r]=a)}),n}var Ar=/\d/,jr=[`-`,`_`,`/`,`.`];function Mr(e=``){if(!Ar.test(e))return e!==e.toLowerCase()}function Nr(e){let t=[],n=``,r,i;for(let a of e){let e=jr.includes(a);if(e===!0){t.push(n),n=``,r=void 0;continue}let o=Mr(a);if(i===!1){if(r===!1&&o===!0){t.push(n),n=a,r=o;continue}if(r===!0&&o===!1&&n.length>1){let e=n.at(-1);t.push(n.slice(0,Math.max(0,n.length-1))),n=e+a,r=o;continue}}n+=a,r=o,i=e}return t.push(n),t}function Pr(e){return e?Nr(e).map(e=>Ir(e)).join(``):``}function Fr(e){return Lr(Pr(e||``))}function Ir(e){return e?e[0].toUpperCase()+e.slice(1):``}function Lr(e){return e?e[0].toLowerCase()+e.slice(1):``}function Rr(e){if(!e)return{};let t={};function n(e,n){if(e.startsWith(`-moz-`)||e.startsWith(`-webkit-`)||e.startsWith(`-ms-`)||e.startsWith(`-o-`)){t[Pr(e)]=n;return}if(e.startsWith(`--`)){t[e]=n;return}t[Fr(e)]=n}return kr(e,n),t}function zr(...e){return(...t)=>{for(let n of e)typeof n==`function`&&n(...t)}}function Br(e,t){let n=RegExp(e,`g`);return e=>{if(typeof e!=`string`)throw TypeError(`expected an argument of type string, but got ${typeof e}`);return e.match(n)?e.replace(n,t):e}}var Vr=Br(/[A-Z]/,e=>`-${e.toLowerCase()}`);function Hr(e){if(!e||typeof e!=`object`||Array.isArray(e))throw TypeError(`expected an argument of type object, but got ${typeof e}`);return Object.keys(e).map(t=>`${Vr(t)}: ${e[t]};`).join(`
3
3
  `)}function Ur(e={}){return Hr(e).replace(`
4
4
  `,` `)}var Wr=new Set(`onabort.onanimationcancel.onanimationend.onanimationiteration.onanimationstart.onauxclick.onbeforeinput.onbeforetoggle.onblur.oncancel.oncanplay.oncanplaythrough.onchange.onclick.onclose.oncompositionend.oncompositionstart.oncompositionupdate.oncontextlost.oncontextmenu.oncontextrestored.oncopy.oncuechange.oncut.ondblclick.ondrag.ondragend.ondragenter.ondragleave.ondragover.ondragstart.ondrop.ondurationchange.onemptied.onended.onerror.onfocus.onfocusin.onfocusout.onformdata.ongotpointercapture.oninput.oninvalid.onkeydown.onkeypress.onkeyup.onload.onloadeddata.onloadedmetadata.onloadstart.onlostpointercapture.onmousedown.onmouseenter.onmouseleave.onmousemove.onmouseout.onmouseover.onmouseup.onpaste.onpause.onplay.onplaying.onpointercancel.onpointerdown.onpointerenter.onpointerleave.onpointermove.onpointerout.onpointerover.onpointerup.onprogress.onratechange.onreset.onresize.onscroll.onscrollend.onsecuritypolicyviolation.onseeked.onseeking.onselect.onselectionchange.onselectstart.onslotchange.onstalled.onsubmit.onsuspend.ontimeupdate.ontoggle.ontouchcancel.ontouchend.ontouchmove.ontouchstart.ontransitioncancel.ontransitionend.ontransitionrun.ontransitionstart.onvolumechange.onwaiting.onwebkitanimationend.onwebkitanimationiteration.onwebkitanimationstart.onwebkittransitionend.onwheel`.split(`.`));function Gr(e){return Wr.has(e)}function X(...e){let t={...e[0]};for(let n=1;n<e.length;n++){let r=e[n];if(r){for(let e of Object.keys(r)){let n=t[e],i=r[e],a=typeof n==`function`,o=typeof i==`function`;if(a&&typeof o&&Gr(e))t[e]=fr(n,i);else if(a&&o)t[e]=zr(n,i);else if(e===`class`){let r=nr(n),a=nr(i);r&&a?t[e]=C(n,i):r?t[e]=C(n):a&&(t[e]=C(i))}else if(e===`style`){let r=typeof n==`object`,a=typeof i==`object`,o=typeof n==`string`,s=typeof i==`string`;if(r&&a)t[e]={...n,...i};else if(r&&s){let r=Rr(i);t[e]={...n,...r}}else if(o&&a)t[e]={...Rr(n),...i};else if(o&&s){let r=Rr(n),a=Rr(i);t[e]={...r,...a}}else r?t[e]=n:a?t[e]=i:o?t[e]=n:s&&(t[e]=i)}else t[e]=i===void 0?n:i}for(let e of Object.getOwnPropertySymbols(r)){let n=t[e],i=r[e];t[e]=i===void 0?n:i}}}return typeof t.style==`object`&&(t.style=Ur(t.style).replaceAll(`
@@ -1 +1 @@
1
- import"./DK3lEKRX.js";import{a as e,i as t,r as n}from"./z-U4HNd3.js";var r={get data(){return e.data},get error(){return e.error},get form(){return e.form},get params(){return e.params},get route(){return e.route},get state(){return e.state},get status(){return e.status},get url(){return e.url}};Object.defineProperty({get from(){return t.current?t.current.from:null},get to(){return t.current?t.current.to:null},get type(){return t.current?t.current.type:null},get willUnload(){return t.current?t.current.willUnload:null},get delta(){return t.current?t.current.delta:null},get complete(){return t.current?t.current.complete:null}},`current`,{get(){throw Error(`Replace navigating.current.<prop> with navigating.<prop>`)}}),n.updated.check;var i=r;export{i as t};
1
+ import"./DK3lEKRX.js";import{a as e,i as t,r as n}from"./BOogcmRI.js";var r={get data(){return e.data},get error(){return e.error},get form(){return e.form},get params(){return e.params},get route(){return e.route},get state(){return e.state},get status(){return e.status},get url(){return e.url}};Object.defineProperty({get from(){return t.current?t.current.from:null},get to(){return t.current?t.current.to:null},get type(){return t.current?t.current.type:null},get willUnload(){return t.current?t.current.willUnload:null},get delta(){return t.current?t.current.delta:null},get complete(){return t.current?t.current.complete:null}},`current`,{get(){throw Error(`Replace navigating.current.<prop> with navigating.<prop>`)}}),n.updated.check;var i=r;export{i as t};
@@ -1 +1 @@
1
- import{Lt as e,Mt as t,Rt as n,c as r,i,kt as a,o,ot as s,qt as c}from"./DK3lEKRX.js";import"./Bo0U8J3e.js";import"./CFKVnMbq.js";import"./CsGLkWF6.js";import"./hJTLHSgs.js";import"./BaFk5JeE.js";import"./BJVrdkuG.js";import"./DUHuqsF-.js";import"./BAn02Khb.js";import"./IVrT20gg.js";import{t as l}from"./qdgQQPPN.js";import"./DHHLckcz.js";import"./I5DxyXWx.js";import"./DmZKIk3Y.js";import"./MqTIsSeD.js";import{t as u}from"./CNNudH1c.js";function d(i,d){n(d,!0);let f=o(d,`forceTheme`,7),p=o(d,`apiUrl`,7),m=o(d,`apiKey`,7),h=o(d,`speechRecognitionApiKey`,7),g=o(d,`lang`,7),_=o(d,`features`,7),v=o(d,`loaderBackground`,7),y=o(d,`loaderColor`,7),b=o(d,`flyout`,7),x=o(d,`flyoutStyle`,7),S=o(d,`flyoutClass`,7),C=o(d,`chatClass`,7),w=o(d,`inlineLayout`,7),T=o(d,`forceChatPage`,7),E=o(d,`hidePredefinedQuestions`,7),D=o(d,`autofirePredefinedQuestionId`,7),O=o(d,`additionalStartParameters`,7),k=o(d,`question`,7),A=o(d,`mode`,7),j=o(d,`source`,7),M=o(d,`cache`,7),N=a(()=>({forceTheme:f(),apiUrl:p(),apiKey:m(),speechRecognitionApiKey:h(),lang:g(),features:_(),loaderBackground:v(),loaderColor:y(),flyout:b(),flyoutStyle:x(),flyoutClass:S(),chatClass:C(),inlineLayout:w(),forceChatPage:T(),hidePredefinedQuestions:E(),autofirePredefinedQuestionId:D(),additionalStartParameters:O(),question:k(),mode:A(),source:j(),cache:M()}));var P={get forceTheme(){return f()},set forceTheme(e){f(e),t()},get apiUrl(){return p()},set apiUrl(e){p(e),t()},get apiKey(){return m()},set apiKey(e){m(e),t()},get speechRecognitionApiKey(){return h()},set speechRecognitionApiKey(e){h(e),t()},get lang(){return g()},set lang(e){g(e),t()},get features(){return _()},set features(e){_(e),t()},get loaderBackground(){return v()},set loaderBackground(e){v(e),t()},get loaderColor(){return y()},set loaderColor(e){y(e),t()},get flyout(){return b()},set flyout(e){b(e),t()},get flyoutStyle(){return x()},set flyoutStyle(e){x(e),t()},get flyoutClass(){return S()},set flyoutClass(e){S(e),t()},get chatClass(){return C()},set chatClass(e){C(e),t()},get inlineLayout(){return w()},set inlineLayout(e){w(e),t()},get forceChatPage(){return T()},set forceChatPage(e){T(e),t()},get hidePredefinedQuestions(){return E()},set hidePredefinedQuestions(e){E(e),t()},get autofirePredefinedQuestionId(){return D()},set autofirePredefinedQuestionId(e){D(e),t()},get additionalStartParameters(){return O()},set additionalStartParameters(e){O(e),t()},get question(){return k()},set question(e){k(e),t()},get mode(){return A()},set mode(e){A(e),t()},get source(){return j()},set source(e){j(e),t()},get cache(){return M()},set cache(e){M(e),t()}};{let e=(e,t=c)=>{l(e,r({host:d.$$host,get onError(){return t()}},()=>s(N)))},t=a(()=>s(N).flyout??!1);u(i,{get silent(){return s(t)},body:e,$$slots:{body:!0}})}return e(P)}customElements.define(`liipgpt-chat`,i(d,{forceTheme:{attribute:`force-theme`,type:`String`},apiUrl:{attribute:`api-url`,type:`String`},apiKey:{attribute:`api-key`,type:`String`},speechRecognitionApiKey:{attribute:`speech-recognition-api-key`,type:`String`},lang:{attribute:`lang`,type:`String`},features:{attribute:`features`,type:`String`},loaderBackground:{attribute:`loader-background`,type:`String`},loaderColor:{attribute:`loader-color`,type:`String`},flyout:{attribute:`flyout`,type:`Boolean`},flyoutStyle:{attribute:`flyout-style`,type:`String`},flyoutClass:{attribute:`flyout-class`,type:`String`},chatClass:{attribute:`chat-class`,type:`String`},inlineLayout:{attribute:`inline-layout`,type:`Boolean`},forceChatPage:{attribute:`force-chat-page`,type:`Boolean`},hidePredefinedQuestions:{attribute:`hide-predefined-questions`,type:`Boolean`},autofirePredefinedQuestionId:{attribute:`autofire-predefined-question-id`,type:`String`},additionalStartParameters:{attribute:`additional-start-parameters`,type:`String`},question:{attribute:`question`,type:`String`},mode:{attribute:`mode`,type:`String`},source:{attribute:`source`,type:`String`},cache:{attribute:`cache`,type:`Boolean`}},[],[],{mode:`open`}));export{d as LiipGPTChat};
1
+ import{Lt as e,Mt as t,Rt as n,c as r,i,kt as a,o,ot as s,qt as c}from"./DK3lEKRX.js";import"./Bo0U8J3e.js";import"./CFKVnMbq.js";import"./CsGLkWF6.js";import"./hJTLHSgs.js";import"./BaFk5JeE.js";import"./BJVrdkuG.js";import"./DUHuqsF-.js";import"./lj2Jt22R.js";import"./CrAgD5Zd.js";import{t as l}from"./BGriYQSA.js";import"./DHHLckcz.js";import"./I5DxyXWx.js";import"./DmZKIk3Y.js";import"./MqTIsSeD.js";import{t as u}from"./CNNudH1c.js";function d(i,d){n(d,!0);let f=o(d,`forceTheme`,7),p=o(d,`apiUrl`,7),m=o(d,`apiKey`,7),h=o(d,`speechRecognitionApiKey`,7),g=o(d,`lang`,7),_=o(d,`features`,7),v=o(d,`loaderBackground`,7),y=o(d,`loaderColor`,7),b=o(d,`flyout`,7),x=o(d,`flyoutStyle`,7),S=o(d,`flyoutClass`,7),C=o(d,`chatClass`,7),w=o(d,`inlineLayout`,7),T=o(d,`forceChatPage`,7),E=o(d,`hidePredefinedQuestions`,7),D=o(d,`autofirePredefinedQuestionId`,7),O=o(d,`additionalStartParameters`,7),k=o(d,`question`,7),A=o(d,`mode`,7),j=o(d,`source`,7),M=o(d,`cache`,7),N=a(()=>({forceTheme:f(),apiUrl:p(),apiKey:m(),speechRecognitionApiKey:h(),lang:g(),features:_(),loaderBackground:v(),loaderColor:y(),flyout:b(),flyoutStyle:x(),flyoutClass:S(),chatClass:C(),inlineLayout:w(),forceChatPage:T(),hidePredefinedQuestions:E(),autofirePredefinedQuestionId:D(),additionalStartParameters:O(),question:k(),mode:A(),source:j(),cache:M()}));var P={get forceTheme(){return f()},set forceTheme(e){f(e),t()},get apiUrl(){return p()},set apiUrl(e){p(e),t()},get apiKey(){return m()},set apiKey(e){m(e),t()},get speechRecognitionApiKey(){return h()},set speechRecognitionApiKey(e){h(e),t()},get lang(){return g()},set lang(e){g(e),t()},get features(){return _()},set features(e){_(e),t()},get loaderBackground(){return v()},set loaderBackground(e){v(e),t()},get loaderColor(){return y()},set loaderColor(e){y(e),t()},get flyout(){return b()},set flyout(e){b(e),t()},get flyoutStyle(){return x()},set flyoutStyle(e){x(e),t()},get flyoutClass(){return S()},set flyoutClass(e){S(e),t()},get chatClass(){return C()},set chatClass(e){C(e),t()},get inlineLayout(){return w()},set inlineLayout(e){w(e),t()},get forceChatPage(){return T()},set forceChatPage(e){T(e),t()},get hidePredefinedQuestions(){return E()},set hidePredefinedQuestions(e){E(e),t()},get autofirePredefinedQuestionId(){return D()},set autofirePredefinedQuestionId(e){D(e),t()},get additionalStartParameters(){return O()},set additionalStartParameters(e){O(e),t()},get question(){return k()},set question(e){k(e),t()},get mode(){return A()},set mode(e){A(e),t()},get source(){return j()},set source(e){j(e),t()},get cache(){return M()},set cache(e){M(e),t()}};{let e=(e,t=c)=>{l(e,r({host:d.$$host,get onError(){return t()}},()=>s(N)))},t=a(()=>s(N).flyout??!1);u(i,{get silent(){return s(t)},body:e,$$slots:{body:!0}})}return e(P)}customElements.define(`liipgpt-chat`,i(d,{forceTheme:{attribute:`force-theme`,type:`String`},apiUrl:{attribute:`api-url`,type:`String`},apiKey:{attribute:`api-key`,type:`String`},speechRecognitionApiKey:{attribute:`speech-recognition-api-key`,type:`String`},lang:{attribute:`lang`,type:`String`},features:{attribute:`features`,type:`String`},loaderBackground:{attribute:`loader-background`,type:`String`},loaderColor:{attribute:`loader-color`,type:`String`},flyout:{attribute:`flyout`,type:`Boolean`},flyoutStyle:{attribute:`flyout-style`,type:`String`},flyoutClass:{attribute:`flyout-class`,type:`String`},chatClass:{attribute:`chat-class`,type:`String`},inlineLayout:{attribute:`inline-layout`,type:`Boolean`},forceChatPage:{attribute:`force-chat-page`,type:`Boolean`},hidePredefinedQuestions:{attribute:`hide-predefined-questions`,type:`Boolean`},autofirePredefinedQuestionId:{attribute:`autofire-predefined-question-id`,type:`String`},additionalStartParameters:{attribute:`additional-start-parameters`,type:`String`},question:{attribute:`question`,type:`String`},mode:{attribute:`mode`,type:`String`},source:{attribute:`source`,type:`String`},cache:{attribute:`cache`,type:`Boolean`}},[],[],{mode:`open`}));export{d as LiipGPTChat};
@@ -54,8 +54,8 @@ ${e}</tr>
54
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
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||O,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
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||O}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=et();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,tt(Z.defaults),Z},Z.getDefaults=et,Z.defaults=O,Z.use=function(...e){return en.use(...e),Z.defaults=en.defaults,tt(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=$e(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+(?:\.\d+)?)\]/)?.index},tokenizer(e){let t=/^\[\^(\d+(?:\.\d+)?)\]/.exec(e);if(t){let[e,n]=t;return{type:`footnote`,raw:e,refNumber:n}}},renderer(t){if(t.type===`footnote`){let n=e.currentReferences.all,r=n.some(e=>e.citationId!==void 0)?n.findIndex(e=>e.citationId===t.refNumber):/^\d+$/.test(t.refNumber)?Number(t.refNumber)-1:-1,i=e.currentReferences.all[r];if(!i)return console.error(`Could not find ref for citation:`,t.refNumber),``;let a;return i?.referenceIndex.used?a=i.referenceIndex.used:(e.currentReferences.used.push(i),e.lastUsedIndex++,a=e.lastUsedIndex,i.referenceIndex.used=a),` <liipgpt-reference-number data-all-index="${r}" data-used-index="${a}" data-source="${JSON.stringify(i).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=({citationId:e,url:t,considered:n,title:r,description:i,summary:a})=>{let o=ln(t),s=i||a;return{...e?{citationId:e}:{},url:t,considered:n,referenceIndex:{},score:0,metadata:{},display:{card:{title:r,description:s,badge:t},listItem:{title:r,badge:o}}}},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`,ne,{},r).catch(t=>(console.log(`Failed to /login use /log`,t),e.fetchData(`/log`,ne,{},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+=`
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,tt(Z.defaults),Z},Z.getDefaults=et,Z.defaults=O,Z.use=function(...e){return en.use(...e),Z.defaults=en.defaults,tt(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=$e(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+(?:\.\d+)?)\]/)?.index},tokenizer(e){let t=/^\[\^(\d+(?:\.\d+)?)\]/.exec(e);if(t){let[e,n]=t;return{type:`footnote`,raw:e,refNumber:n}}},renderer(t){if(t.type===`footnote`){let n=e.currentReferences.all,r=n.some(e=>e.citationId!==void 0)?n.findIndex(e=>e.citationId===t.refNumber):/^\d+$/.test(t.refNumber)?Number(t.refNumber)-1:-1,i=e.currentReferences.all[r];if(!i)return console.error(`Could not find ref for citation:`,t.refNumber),``;let a;return i?.referenceIndex.used?a=i.referenceIndex.used:(e.currentReferences.used.push(i),e.lastUsedIndex++,a=e.lastUsedIndex,i.referenceIndex.used=a),` <liipgpt-reference-number data-all-index="${r}" data-used-index="${a}" data-source="${JSON.stringify(i).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=({citationId:e,url:t,considered:n,title:r,description:i,summary:a})=>{let o=ln(t),s=i||a;return{...e?{citationId:e}:{},url:t,considered:n,referenceIndex:{},score:0,metadata:{},display:{card:{title:r,description:s,badge:t},listItem:{title:r,badge:o}}}},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,t){this.options.onError?.(e,t),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`,ne,{},r).catch(t=>(console.log(`Failed to /login use /log`,t),e.fetchData(`/log`,ne,{},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
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
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
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(te()),considered:f(ee()),orgMetadata:f(m({authors:f(u(te()))})),type:f(te()),date:f(re()),similarity:f(h()),content:f(te()),fromFullTextSearch:f(ee()),rerank:f(m({index:f(p()),adjustment:f(h()),score:f(h()),similarityOld:f(h())}))}),oe]))}),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=45e3,Un=class{internalData;renderers=new Map;markedExtensions=[];_newTabSrText;chatTimeout;constructor(e){this.chatTimeout=e.chatTimeout??Hn;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,!(f&&!c.getCurrentValue())&&(await c).close()},c=new cn,l=new Bn(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()},ee=()=>{p(),u>0&&!f&&(d=setTimeout(m,u))};ee(),(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(ee(),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 h=new hn({question:t,id:i,content:r,readableStore:o.getReadableStore(),readyForFeedback:a,abort:s,liipgptClientPrimitive:this});return this.internalData.chatResponseMap.set(h.id,h),h}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`,ie)}async getChatHistory(e,t){try{let n=await this.internalData.restClient.postData(`/chathistory`,{cID:e,uID:t}),r=g.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`,ae,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`}}}},Wn=class{clientPrimitive;constructor(e){this.clientPrimitive=new Un(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)}},Gn=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}},Kn=class{#e;#t;constructor(e,t){this.#e=e,this.#t=a(t)}get current(){return this.#t(),this.#e()}},qn=/\(.+\)/,Jn=new Set([`all`,`print`,`screen`,`and`,`or`,`not`,`only`]),Yn=class extends Kn{constructor(e,t){let n=qn.test(e)||e.split(/[\s,]+/).some(e=>Jn.has(e.trim()))?e:`(${e})`,r=window.matchMedia(n);super(()=>r.matches,e=>i(r,`change`,e))}};function Xn(e){return e}function Zn(e){return e<.5?4*e*e*e:.5*(2*e-2)**3+1}function Qn(e){return e<.5?8*e**4:-8*(e-1)**4+1}function $n(e){return e**4}function er(e){return(e-1)**3*(1-e)+1}function tr(e){return--e*e*e*e*e+1}export{mn as _,er as a,$e as b,Gn as c,zn as d,Rn as f,pn as g,_n as h,Qn as i,Wn as l,bn as m,Xn as n,tr as o,Dn as p,$n as r,Yn as s,Zn as t,Un as u,un as v,an as y};
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(te()),considered:f(ee()),orgMetadata:f(m({authors:f(u(te()))})),type:f(te()),date:f(re()),similarity:f(h()),content:f(te()),fromFullTextSearch:f(ee()),rerank:f(m({index:f(p()),adjustment:f(h()),score:f(h()),similarityOld:f(h())}))}),oe]))}),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=45e3,Un=class{internalData;renderers=new Map;markedExtensions=[];_newTabSrText;chatTimeout;constructor(e){this.chatTimeout=e.chatTimeout??Hn;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,t)=>{n.onError?.(e,t)},onFinish:e=>{r.setValue(e)},markdownRenderer:this.renderers.get(e)??new an({extensions:this.markedExtensions,newTabSrText:this._newTabSrText}),userQuestion:t}),s=async()=>{await a,!(f&&!c.getCurrentValue())&&(await c).close()},c=new cn,l=new Bn(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()},ee=()=>{p(),u>0&&!f&&(d=setTimeout(m,u))};ee(),(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(ee(),r.type){case`error`:l.runAfterTyping(()=>o.pushError(r.error,r.message));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 h=new hn({question:t,id:i,content:r,readableStore:o.getReadableStore(),readyForFeedback:a,abort:s,liipgptClientPrimitive:this});return this.internalData.chatResponseMap.set(h.id,h),h}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`,ie)}async getChatHistory(e,t){try{let n=await this.internalData.restClient.postData(`/chathistory`,{cID:e,uID:t}),r=g.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`,ae,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`}}}},Wn=class{clientPrimitive;constructor(e){this.clientPrimitive=new Un(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)}},Gn=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}},Kn=class{#e;#t;constructor(e,t){this.#e=e,this.#t=a(t)}get current(){return this.#t(),this.#e()}},qn=/\(.+\)/,Jn=new Set([`all`,`print`,`screen`,`and`,`or`,`not`,`only`]),Yn=class extends Kn{constructor(e,t){let n=qn.test(e)||e.split(/[\s,]+/).some(e=>Jn.has(e.trim()))?e:`(${e})`,r=window.matchMedia(n);super(()=>r.matches,e=>i(r,`change`,e))}};function Xn(e){return e}function Zn(e){return e<.5?4*e*e*e:.5*(2*e-2)**3+1}function Qn(e){return e<.5?8*e**4:-8*(e-1)**4+1}function $n(e){return e**4}function er(e){return(e-1)**3*(1-e)+1}function tr(e){return--e*e*e*e*e+1}export{mn as _,er as a,$e as b,Gn as c,zn as d,Rn as f,pn as g,_n as h,Qn as i,Wn as l,bn as m,Xn as n,tr as o,Dn as p,$n as r,Yn as s,Zn as t,Un as u,un as v,an as y};
@@ -1,2 +1,2 @@
1
- const __vite__mapDeps=(i,m=__vite__mapDeps,d=(m.f||(m.f=["../nodes/0.C5XdevBn.js","../chunks/CibALFW0.js","../chunks/o5n3JJnR.js","../chunks/DK3lEKRX.js","../chunks/CsGLkWF6.js","../chunks/BaFk5JeE.js","../chunks/CFKVnMbq.js","../chunks/CLWqXHLZ.js","../chunks/BFwiU0IZ.js","../nodes/1.SYxOPfTY.js","../chunks/z-U4HNd3.js","../chunks/B4lUgYsH.js","../chunks/DUHuqsF-.js","../chunks/Bo0U8J3e.js","../nodes/2.Bldafw2d.js","../chunks/DjVmpym-.js","../chunks/IVrT20gg.js","../chunks/BAn02Khb.js","../chunks/BJVrdkuG.js","../chunks/hJTLHSgs.js","../chunks/DHHLckcz.js","../chunks/DS0EeZTa.js","../chunks/I5DxyXWx.js","../nodes/3.DamO4w17.js","../chunks/qdgQQPPN.js","../chunks/DmZKIk3Y.js","../chunks/MqTIsSeD.js"])))=>i.map(i=>d[i]);
2
- import{$ as e,Dt as t,Gt as n,I as r,J as i,K as a,Lt as o,Mt as s,Rt as c,St as l,Tt as u,U as d,X as f,Y as p,a as m,bt as h,ct as g,gt as _,ht as v,i as y,kt as b,mt as x,o as S,ot as C,r as w,u as T,xt as E}from"../chunks/DK3lEKRX.js";import{t as D}from"../chunks/DjVmpym-.js";import"../chunks/CFKVnMbq.js";var O={},k=f(`<div id="svelte-announcer" aria-live="assertive" aria-atomic="true" style="position: absolute; left: 0; top: 0; clip: rect(0 0 0 0); clip-path: inset(50%); overflow: hidden; white-space: nowrap; width: 1px; height: 1px"><!></div>`),A=f(`<!> <!>`,1);function j(f,m){c(m,!0);let y=S(m,`stores`,7),D=S(m,`page`,7),O=S(m,`constructors`,7),j=S(m,`components`,23,()=>[]),M=S(m,`form`,7),N=S(m,`data_0`,7,null),P=S(m,`data_1`,7,null);_(()=>y().page.set(D())),v(()=>{y(),D(),O(),j(),M(),N(),P(),y().page.notify()});let F=t(!1),I=t(!1),L=t(null);w(()=>{let e=y().page.subscribe(()=>{C(F)&&(u(I,!0),g().then(()=>{u(L,document.title||`untitled page`,!0)}))});return u(F,!0),e});let R=b(()=>O()[1]);var z={get stores(){return y()},set stores(e){y(e),s()},get page(){return D()},set page(e){D(e),s()},get constructors(){return O()},set constructors(e){O(e),s()},get components(){return j()},set components(e=[]){j(e),s()},get form(){return M()},set form(e){M(e),s()},get data_0(){return N()},set data_0(e=null){N(e),s()},get data_1(){return P()},set data_1(e=null){P(e),s()}},B=A(),V=E(B),H=e=>{let t=b(()=>O()[0]);var n=p();r(E(n),()=>C(t),(e,t)=>{T(t(e,{get data(){return N()},get form(){return M()},get params(){return D().params},children:(e,t)=>{var n=p();r(E(n),()=>C(R),(e,t)=>{T(t(e,{get data(){return P()},get form(){return M()},get params(){return D().params}}),e=>j()[1]=e,()=>j()?.[1])}),i(e,n)},$$slots:{default:!0}}),e=>j()[0]=e,()=>j()?.[0])}),i(e,n)},U=e=>{let t=b(()=>O()[0]);var n=p();r(E(n),()=>C(t),(e,t)=>{T(t(e,{get data(){return N()},get form(){return M()},get params(){return D().params}}),e=>j()[0]=e,()=>j()?.[0])}),i(e,n)};d(V,e=>{O()[1]?e(H):e(U,-1)});var W=l(V,2),G=t=>{var r=k(),o=h(r),s=t=>{var n=e();x(()=>a(n,C(L))),i(t,n)};d(o,e=>{C(I)&&e(s)}),n(r),i(t,r)};return d(W,e=>{C(F)&&e(G)}),i(f,B),o(z)}y(j,{stores:{},page:{},constructors:{},components:{},form:{},data_0:{},data_1:{}},[],[],{mode:`open`});var M=m(j),N=[()=>D(()=>import(`../nodes/0.C5XdevBn.js`),__vite__mapDeps([0,1,2,3,4,5,6,7,8]),import.meta.url),()=>D(()=>import(`../nodes/1.SYxOPfTY.js`),__vite__mapDeps([9,10,3,1,11,6,12,13]),import.meta.url),()=>D(()=>import(`../nodes/2.Bldafw2d.js`),__vite__mapDeps([14,10,3,1,2,15,16,17,5,18,19,4,20,21,11,22,6,12,13,8]),import.meta.url),()=>D(()=>import(`../nodes/3.DamO4w17.js`),__vite__mapDeps([23,10,3,1,2,16,15,17,5,18,19,4,20,21,11,24,22,25,26,6,12,13,7,8]),import.meta.url)],P=[],F={"/":[2],"/sidebar":[3]},I={handleError:(({error:e})=>{console.error(e)}),reroute:(()=>{}),transport:{}},L=Object.fromEntries(Object.entries(I.transport).map(([e,t])=>[e,t.decode])),R=Object.fromEntries(Object.entries(I.transport).map(([e,t])=>[e,t.encode])),z=!1,B=(e,t)=>L[e](t);export{B as decode,L as decoders,F as dictionary,R as encoders,z as hash,I as hooks,O as matchers,N as nodes,M as root,P as server_loads};
1
+ const __vite__mapDeps=(i,m=__vite__mapDeps,d=(m.f||(m.f=["../nodes/0.DwmuWxZI.js","../chunks/CibALFW0.js","../chunks/C7SVO0yB.js","../chunks/DK3lEKRX.js","../chunks/CsGLkWF6.js","../chunks/BaFk5JeE.js","../chunks/CFKVnMbq.js","../chunks/CLWqXHLZ.js","../chunks/BFwiU0IZ.js","../nodes/1.Bjv1gqx4.js","../chunks/BOogcmRI.js","../chunks/CxsmcPPu.js","../chunks/DUHuqsF-.js","../chunks/Bo0U8J3e.js","../nodes/2.CyWhas6h.js","../chunks/DjVmpym-.js","../chunks/CrAgD5Zd.js","../chunks/lj2Jt22R.js","../chunks/BJVrdkuG.js","../chunks/hJTLHSgs.js","../chunks/DHHLckcz.js","../chunks/BzwH5m-K.js","../chunks/I5DxyXWx.js","../nodes/3.BlXQFvKY.js","../chunks/BGriYQSA.js","../chunks/DmZKIk3Y.js","../chunks/MqTIsSeD.js"])))=>i.map(i=>d[i]);
2
+ import{$ as e,Dt as t,Gt as n,I as r,J as i,K as a,Lt as o,Mt as s,Rt as c,St as l,Tt as u,U as d,X as f,Y as p,a as m,bt as h,ct as g,gt as _,ht as v,i as y,kt as b,mt as x,o as S,ot as C,r as w,u as T,xt as E}from"../chunks/DK3lEKRX.js";import{t as D}from"../chunks/DjVmpym-.js";import"../chunks/CFKVnMbq.js";var O={},k=f(`<div id="svelte-announcer" aria-live="assertive" aria-atomic="true" style="position: absolute; left: 0; top: 0; clip: rect(0 0 0 0); clip-path: inset(50%); overflow: hidden; white-space: nowrap; width: 1px; height: 1px"><!></div>`),A=f(`<!> <!>`,1);function j(f,m){c(m,!0);let y=S(m,`stores`,7),D=S(m,`page`,7),O=S(m,`constructors`,7),j=S(m,`components`,23,()=>[]),M=S(m,`form`,7),N=S(m,`data_0`,7,null),P=S(m,`data_1`,7,null);_(()=>y().page.set(D())),v(()=>{y(),D(),O(),j(),M(),N(),P(),y().page.notify()});let F=t(!1),I=t(!1),L=t(null);w(()=>{let e=y().page.subscribe(()=>{C(F)&&(u(I,!0),g().then(()=>{u(L,document.title||`untitled page`,!0)}))});return u(F,!0),e});let R=b(()=>O()[1]);var z={get stores(){return y()},set stores(e){y(e),s()},get page(){return D()},set page(e){D(e),s()},get constructors(){return O()},set constructors(e){O(e),s()},get components(){return j()},set components(e=[]){j(e),s()},get form(){return M()},set form(e){M(e),s()},get data_0(){return N()},set data_0(e=null){N(e),s()},get data_1(){return P()},set data_1(e=null){P(e),s()}},B=A(),V=E(B),H=e=>{let t=b(()=>O()[0]);var n=p();r(E(n),()=>C(t),(e,t)=>{T(t(e,{get data(){return N()},get form(){return M()},get params(){return D().params},children:(e,t)=>{var n=p();r(E(n),()=>C(R),(e,t)=>{T(t(e,{get data(){return P()},get form(){return M()},get params(){return D().params}}),e=>j()[1]=e,()=>j()?.[1])}),i(e,n)},$$slots:{default:!0}}),e=>j()[0]=e,()=>j()?.[0])}),i(e,n)},U=e=>{let t=b(()=>O()[0]);var n=p();r(E(n),()=>C(t),(e,t)=>{T(t(e,{get data(){return N()},get form(){return M()},get params(){return D().params}}),e=>j()[0]=e,()=>j()?.[0])}),i(e,n)};d(V,e=>{O()[1]?e(H):e(U,-1)});var W=l(V,2),G=t=>{var r=k(),o=h(r),s=t=>{var n=e();x(()=>a(n,C(L))),i(t,n)};d(o,e=>{C(I)&&e(s)}),n(r),i(t,r)};return d(W,e=>{C(F)&&e(G)}),i(f,B),o(z)}y(j,{stores:{},page:{},constructors:{},components:{},form:{},data_0:{},data_1:{}},[],[],{mode:`open`});var M=m(j),N=[()=>D(()=>import(`../nodes/0.DwmuWxZI.js`),__vite__mapDeps([0,1,2,3,4,5,6,7,8]),import.meta.url),()=>D(()=>import(`../nodes/1.Bjv1gqx4.js`),__vite__mapDeps([9,10,3,1,11,6,12,13]),import.meta.url),()=>D(()=>import(`../nodes/2.CyWhas6h.js`),__vite__mapDeps([14,10,3,1,2,15,16,17,5,18,19,4,20,21,11,22,6,12,13,8]),import.meta.url),()=>D(()=>import(`../nodes/3.BlXQFvKY.js`),__vite__mapDeps([23,10,3,1,2,16,15,17,5,18,19,4,20,21,11,24,22,25,26,6,12,13,7,8]),import.meta.url)],P=[],F={"/":[2],"/sidebar":[3]},I={handleError:(({error:e})=>{console.error(e)}),reroute:(()=>{}),transport:{}},L=Object.fromEntries(Object.entries(I.transport).map(([e,t])=>[e,t.decode])),R=Object.fromEntries(Object.entries(I.transport).map(([e,t])=>[e,t.encode])),z=!1,B=(e,t)=>L[e](t);export{B as decode,L as decoders,F as dictionary,R as encoders,z as hash,I as hooks,O as matchers,N as nodes,M as root,P as server_loads};
@@ -0,0 +1 @@
1
+ import"../chunks/DK3lEKRX.js";import{n as e,s as t}from"../chunks/BOogcmRI.js";import"../chunks/Bo0U8J3e.js";export{t as load_css,e as start};
@@ -1,4 +1,4 @@
1
- import{n as e}from"../chunks/CibALFW0.js";import{J as t,L as n,Lt as r,Mt as i,Rt as a,Y as o,i as s,o as c,xt as l}from"../chunks/DK3lEKRX.js";import"../chunks/CFKVnMbq.js";import{r as u}from"../chunks/CLWqXHLZ.js";import{n as d,r as f,s as p,t as m,u as h}from"../chunks/o5n3JJnR.js";import"../chunks/CsGLkWF6.js";import"../chunks/BaFk5JeE.js";import"../chunks/BFwiU0IZ.js";var g=async e=>await(await e(`https://liipgpt.dev.cluster.liipgpt.ch/configurator/api/all-org-names`)).json(),_=[`baselcitygpt`],v=async e=>{let t=await g(e).catch(e=>(console.error(`Error fetching org names:`,e),[]));t.push(`liipgpt`);let n=t.map(e=>_.includes(e)?[e,{dev:`https://${e}-dev-api.gpt.liip.ch/${e}`,prod:`https://${e}-api.gpt.liip.ch/${e}`}]:[e,{dev:`https://${e}.dev.cluster.liipgpt.ch/${e}`,prod:`https://${e}.prod.cluster.liipgpt.ch/${e}`}]);return Object.fromEntries(n)},y=`/**
1
+ import{n as e}from"../chunks/CibALFW0.js";import{J as t,L as n,Lt as r,Mt as i,Rt as a,Y as o,i as s,o as c,xt as l}from"../chunks/DK3lEKRX.js";import"../chunks/CFKVnMbq.js";import{r as u}from"../chunks/CLWqXHLZ.js";import{n as d,r as f,s as p,t as m,u as h}from"../chunks/C7SVO0yB.js";import"../chunks/CsGLkWF6.js";import"../chunks/BaFk5JeE.js";import"../chunks/BFwiU0IZ.js";var g=async e=>await(await e(`https://liipgpt.dev.cluster.liipgpt.ch/configurator/api/all-org-names`)).json(),_=[`baselcitygpt`],v=async e=>{let t=await g(e).catch(e=>(console.error(`Error fetching org names:`,e),[]));t.push(`liipgpt`);let n=t.map(e=>_.includes(e)?[e,{dev:`https://${e}-dev-api.gpt.liip.ch/${e}`,prod:`https://${e}-api.gpt.liip.ch/${e}`}]:[e,{dev:`https://${e}.dev.cluster.liipgpt.ch/${e}`,prod:`https://${e}.prod.cluster.liipgpt.ch/${e}`}]);return Object.fromEntries(n)},y=`/**
2
2
  * @type {import('@liip/liipgpt/config').ChatConfig} ChatConfig
3
3
  */
4
4
  const CHAT_CONFIG_OVERRIDE = {
@@ -1 +1 @@
1
- import{Gt as e,J as t,K as n,Lt as r,Rt as i,St as a,X as o,bt as s,i as c,l,mt as u,xt as d}from"../chunks/DK3lEKRX.js";import"../chunks/z-U4HNd3.js";import"../chunks/Bo0U8J3e.js";import"../chunks/CFKVnMbq.js";import"../chunks/DUHuqsF-.js";import{t as f}from"../chunks/B4lUgYsH.js";var p=o(`<h1> </h1> <p> </p>`,1);function m(o,c){i(c,!1),l();var m=p(),h=d(m),g=s(h,!0);e(h);var _=a(h,2),v=s(_,!0);e(_),u(()=>{n(g,f.status),n(v,f.error?.message)}),t(o,m),r()}c(m,{},[],[],{mode:`open`});export{m as component};
1
+ import{Gt as e,J as t,K as n,Lt as r,Rt as i,St as a,X as o,bt as s,i as c,l,mt as u,xt as d}from"../chunks/DK3lEKRX.js";import"../chunks/BOogcmRI.js";import"../chunks/Bo0U8J3e.js";import"../chunks/CFKVnMbq.js";import"../chunks/DUHuqsF-.js";import{t as f}from"../chunks/CxsmcPPu.js";var p=o(`<h1> </h1> <p> </p>`,1);function m(o,c){i(c,!1),l();var m=p(),h=d(m),g=s(h,!0);e(h);var _=a(h,2),v=s(_,!0);e(_),u(()=>{n(g,f.status),n(v,f.error?.message)}),t(o,m),r()}c(m,{},[],[],{mode:`open`});export{m as component};
@@ -1,5 +1,5 @@
1
- const __vite__mapDeps=(i,m=__vite__mapDeps,d=(m.f||(m.f=["../chunks/BTdvPkyd.js","../chunks/IVrT20gg.js","../chunks/CibALFW0.js","../chunks/DjVmpym-.js","../chunks/DK3lEKRX.js","../chunks/BAn02Khb.js","../chunks/BaFk5JeE.js","../chunks/BJVrdkuG.js","../chunks/hJTLHSgs.js","../chunks/CsGLkWF6.js","../chunks/DHHLckcz.js","../chunks/qdgQQPPN.js","../chunks/I5DxyXWx.js","../chunks/DmZKIk3Y.js","../chunks/MqTIsSeD.js","../chunks/CFKVnMbq.js","../chunks/DUHuqsF-.js","../chunks/Bo0U8J3e.js","../chunks/CNNudH1c.js","../chunks/BndQp4ie.js","../chunks/DWQwd7UL.js","../chunks/BFwiU0IZ.js"])))=>i.map(i=>d[i]);
2
- import{A as e,At as t,B as n,D as r,Dt as i,E as a,Gt as o,H as s,J as c,Jt as l,K as u,Lt as d,Mt as f,N as p,Rt as m,St as h,T as g,Tt as _,U as v,V as y,Wt as b,X as x,Y as S,b as C,bt as w,c as ee,dt as T,ht as E,i as D,j as te,k as O,kt as k,lt as A,mt as j,o as M,ot as N,rt as ne,s as P,u as F,v as I,vt as L,xt as R,z as re}from"../chunks/DK3lEKRX.js";import{t as z}from"../chunks/z-U4HNd3.js";import"../chunks/Bo0U8J3e.js";import{t as B}from"../chunks/DjVmpym-.js";import"../chunks/CFKVnMbq.js";import{c as ie,i as V,l as H,o as U}from"../chunks/o5n3JJnR.js";import"../chunks/CsGLkWF6.js";import"../chunks/hJTLHSgs.js";import"../chunks/BaFk5JeE.js";import"../chunks/BJVrdkuG.js";import"../chunks/BFwiU0IZ.js";import"../chunks/DUHuqsF-.js";import{t as ae}from"../chunks/B4lUgYsH.js";import{t as oe}from"../chunks/DS0EeZTa.js";import"../chunks/BAn02Khb.js";import{B as se,H as W,I as G,L as K,R as ce,U as q,V as J,a as le,d as ue,h as de,i as fe,n as pe,o as me,r as he,s as ge,t as _e,u as ve,z as ye}from"../chunks/IVrT20gg.js";import{n as Y}from"../chunks/DHHLckcz.js";import{n as X,t as be}from"../chunks/I5DxyXWx.js";var Z=x(`<div class="swatch svelte-1inuijp"><div class="swatch__color svelte-1inuijp"></div> <div class="swatch__label svelte-1inuijp"> </div></div>`),xe={hash:`svelte-1inuijp`,code:`.swatch {display:flex;flex-direction:column;align-items:flex-start;justify-content:flex-start;width:100%;overflow:hidden;border:1px solid var(--base-line-color);border-radius:var(--card-border-radius);&:hover .swatch__label.svelte-1inuijp {opacity:1;}}.swatch__color.svelte-1inuijp {aspect-ratio:1;width:100%;}.swatch__label.svelte-1inuijp {display:none;width:100%;padding:6px;background:white;color:black;font-size:10px;transition:opacity 0.2s ease;
1
+ const __vite__mapDeps=(i,m=__vite__mapDeps,d=(m.f||(m.f=["../chunks/DmafQ_KV.js","../chunks/CrAgD5Zd.js","../chunks/CibALFW0.js","../chunks/DjVmpym-.js","../chunks/DK3lEKRX.js","../chunks/lj2Jt22R.js","../chunks/BaFk5JeE.js","../chunks/BJVrdkuG.js","../chunks/hJTLHSgs.js","../chunks/CsGLkWF6.js","../chunks/DHHLckcz.js","../chunks/BGriYQSA.js","../chunks/I5DxyXWx.js","../chunks/DmZKIk3Y.js","../chunks/MqTIsSeD.js","../chunks/CFKVnMbq.js","../chunks/DUHuqsF-.js","../chunks/Bo0U8J3e.js","../chunks/CNNudH1c.js","../chunks/BndQp4ie.js","../chunks/BgPvdYLz.js","../chunks/BFwiU0IZ.js"])))=>i.map(i=>d[i]);
2
+ import{A as e,At as t,B as n,D as r,Dt as i,E as a,Gt as o,H as s,J as c,Jt as l,K as u,Lt as d,Mt as f,N as p,Rt as m,St as h,T as g,Tt as _,U as v,V as y,Wt as b,X as x,Y as S,b as C,bt as w,c as ee,dt as T,ht as E,i as D,j as te,k as O,kt as k,lt as A,mt as j,o as M,ot as N,rt as ne,s as P,u as F,v as I,vt as L,xt as R,z as re}from"../chunks/DK3lEKRX.js";import{t as z}from"../chunks/BOogcmRI.js";import"../chunks/Bo0U8J3e.js";import{t as B}from"../chunks/DjVmpym-.js";import"../chunks/CFKVnMbq.js";import{c as ie,i as V,l as H,o as U}from"../chunks/C7SVO0yB.js";import"../chunks/CsGLkWF6.js";import"../chunks/hJTLHSgs.js";import"../chunks/BaFk5JeE.js";import"../chunks/BJVrdkuG.js";import"../chunks/BFwiU0IZ.js";import"../chunks/DUHuqsF-.js";import{t as ae}from"../chunks/CxsmcPPu.js";import{t as oe}from"../chunks/BzwH5m-K.js";import"../chunks/lj2Jt22R.js";import{B as se,H as W,I as G,L as K,R as ce,U as q,V as J,a as le,d as ue,h as de,i as fe,n as pe,o as me,r as he,s as ge,t as _e,u as ve,z as ye}from"../chunks/CrAgD5Zd.js";import{n as Y}from"../chunks/DHHLckcz.js";import{n as X,t as be}from"../chunks/I5DxyXWx.js";var Z=x(`<div class="swatch svelte-1inuijp"><div class="swatch__color svelte-1inuijp"></div> <div class="swatch__label svelte-1inuijp"> </div></div>`),xe={hash:`svelte-1inuijp`,code:`.swatch {display:flex;flex-direction:column;align-items:flex-start;justify-content:flex-start;width:100%;overflow:hidden;border:1px solid var(--base-line-color);border-radius:var(--card-border-radius);&:hover .swatch__label.svelte-1inuijp {opacity:1;}}.swatch__color.svelte-1inuijp {aspect-ratio:1;width:100%;}.swatch__label.svelte-1inuijp {display:none;width:100%;padding:6px;background:white;color:black;font-size:10px;transition:opacity 0.2s ease;
3
3
 
4
4
  @media (min-width: 768px) {display:block;
5
5
  }}`};function Se(t,n){m(n,!1),e(t,xe);let r=M(n,`name`,12),i=M(n,`key`,12),a=M(n,`value`,12);var s={get name(){return r()},set name(e){r(e),f()},get key(){return i()},set key(e){i(e),f()},get value(){return a()},set value(e){a(e),f()}},l=Z(),p=w(l),_=h(p,2),v=w(_,!0);return o(_),o(l),j(()=>{I(l,`title`,`Color ${i()}: ${a()}`),g(p,`background-color: var(--color-${r()??``}-${i()??``});`),u(v,i())}),c(t,l),d(s)}D(Se,{name:{},key:{},value:{}},[],[],{mode:`open`});var Ce=x(`<ol><li class="toast" data-type="error"><div data-icon=""><svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 20 20" fill="currentColor" height="20" width="20" aria-hidden="true"><path fill-rule="evenodd" d="M10 18a8 8 0 100-16 8 8 0 000 16zm3.857-9.809a.75.75 0 00-1.214-.882l-3.483 4.79-1.88-1.88a.75.75 0 10-1.06 1.061l2.5 2.5a.75.75 0 001.137-.089l4-5.5z" clip-rule="evenodd"></path></svg></div> <div data-content=""><div data-title="">Error notification</div></div></li> <li class="toast" data-type="warning"><div data-icon=""><svg viewBox="0 0 64 64" fill="currentColor" height="20" width="20" xmlns="http://www.w3.org/2000/svg" aria-hidden="true"><path d="M32.427,7.987c2.183,0.124 4,1.165 5.096,3.281l17.936,36.208c1.739,3.66 -0.954,8.585 -5.373,8.656l-36.119,0c-4.022,-0.064 -7.322,-4.631 -5.352,-8.696l18.271,-36.207c0.342,-0.65 0.498,-0.838 0.793,-1.179c1.186,-1.375 2.483,-2.111 4.748,-2.063Zm-0.295,3.997c-0.687,0.034 -1.316,0.419 -1.659,1.017c-6.312,11.979 -12.397,24.081 -18.301,36.267c-0.546,1.225 0.391,2.797 1.762,2.863c12.06,0.195 24.125,0.195 36.185,0c1.325,-0.064 2.321,-1.584 1.769,-2.85c-5.793,-12.184 -11.765,-24.286 -17.966,-36.267c-0.366,-0.651 -0.903,-1.042 -1.79,-1.03Z"></path><path d="M33.631,40.581l-3.348,0l-0.368,-16.449l4.1,0l-0.384,16.449Zm-3.828,5.03c0,-0.609 0.197,-1.113 0.592,-1.514c0.396,-0.4 0.935,-0.601 1.618,-0.601c0.684,0 1.223,0.201 1.618,0.601c0.395,0.401 0.593,0.905 0.593,1.514c0,0.587 -0.193,1.078 -0.577,1.473c-0.385,0.395 -0.929,0.593 -1.634,0.593c-0.705,0 -1.249,-0.198 -1.634,-0.593c-0.384,-0.395 -0.576,-0.886 -0.576,-1.473Z"></path></svg></div> <div data-content=""><div data-title="">Warning notification</div></div></li> <li class="toast" data-type="success"><div data-icon=""><svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 20 20" fill="currentColor" height="20" width="20" data-sonner-error-icon="" aria-hidden="true"><path fill-rule="evenodd" d="M18 10a8 8 0 11-16 0 8 8 0 0116 0zm-8-5a.75.75 0 01.75.75v4.5a.75.75 0 01-1.5 0v-4.5A.75.75 0 0110 5zm0 10a1 1 0 100-2 1 1 0 000 2z" clip-rule="evenodd"></path></svg></div> <div data-content=""><div data-title="">Success notification</div></div></li> <li class="toast" data-type="info"><div data-icon=""><svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 20 20" fill="currentColor" height="20" width="20" aria-hidden="true"><path fill-rule="evenodd" d="M18 10a8 8 0 11-16 0 8 8 0 0116 0zm-7-4a1 1 0 11-2 0 1 1 0 012 0zM9 9a.75.75 0 000 1.5h.253a.25.25 0 01.244.304l-.459 2.066A1.75 1.75 0 0010.747 15H11a.75.75 0 000-1.5h-.253a.25.25 0 01-.244-.304l.459-2.066A1.75 1.75 0 009.253 9H9z" clip-rule="evenodd"></path></svg></div> <div data-content=""><div data-title="">Info notification</div></div></li></ol>`);function we(e){c(e,Ce())}D(we,{},[],[],{mode:`open`});var Te=x(`<h1>Title h1</h1> <p>Lorem ipsum dolor sit amet, consectetur adipiscing elit. <em>Morbi sagittis suscipit nisl at varius. Fusce vitae pellentesque lacus.</em> <strong>Sed sed enim in elit vulputate finibus ac in arcu. Donec venenatis tempus facilisis.</strong></p> <p>Lorem ipsum dolor sit amet, consectetur adipiscing elit. Morbi sagittis suscipit nisl at varius. Fusce vitae pellentesque lacus. <a href="https://www.google.com">Check it on google</a> . Sed sed enim in elit vulputate finibus ac in arcu. Donec venenatis tempus facilisis.</p> <p class="text-sm svelte-4x0tmq">Text-sm: Lorem ipsum dolor sit amet, consectetur adipiscing elit. Morbi sagittis suscipit nisl at varius. Fusce vitae pellentesque
@@ -47,4 +47,4 @@ CH-4001 Basel`,phone:`+41 61 200 20 20`,email:`rathaus@bs.ch`,coords:{lat:47.559
47
47
 
48
48
  /* Keep widget hidden until the component marks itself ready (avoids barebone/unthemed flash) */liipgpt-search-summary .search-summary:not(.search-summary--ready) {opacity:0;}#chat-wrapper.has-bg-image.svelte-1uha8ag,
49
49
  #chat-wrapper.svelte-1uha8ag:has(#preview-form:where(.svelte-1uha8ag)) {
50
- /* stylelint-disable-next-line property-disallowed-list */container-type:inline-size;height:auto;min-height:100%;}.preview-bg-image.svelte-1uha8ag {display:block;width:100%;height:auto;pointer-events:none;user-select:none;}`};function $(n,l){m(l,!0),e(n,We);let u=P(l,[`$$slots`,`$$events`,`$$legacy`,`$$host`]),f=k(()=>l.data);E(()=>{window.onmessage=function(e){typeof e.data==`string`&&e.data.startsWith(`liipgpt-url:`)&&z(`?`+new URLSearchParams(e.data.replace(`liipgpt-url:`,``)).toString(),{replaceState:!0})}});let p=e=>N(f).options?.esm?.value?`/build/${e}/liipgpt-${e}.js`:`/build/${e}/liipgpt-${e}.iife.js`,g=e=>/\.(png|jpe?g|gif|webp|svg|bmp|ico)(\?.*)?$/i.test(e),y=async e=>{e===`build`&&(await B(()=>import(p(`chat`)),[],import.meta.url),await B(()=>import(p(`button`)),[],import.meta.url),await B(()=>import(p(`search-summary`)),[],import.meta.url)),e===`dev`&&(await B(()=>import(`../chunks/BTdvPkyd.js`),__vite__mapDeps([0,1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,16,17,18]),import.meta.url),await B(()=>import(`../chunks/BndQp4ie.js`),__vite__mapDeps([19,12,4,2,9,6,13,8,7,10,14,15,18]),import.meta.url),await B(()=>import(`../chunks/DWQwd7UL.js`),__vite__mapDeps([20,3,12,4,2,5,6,7,15,17,21]),import.meta.url)),e===`server`&&(B(()=>import(U(l.data.options,`chat`)),[],import.meta.url),B(()=>import(U(l.data.options,`button`)),[],import.meta.url),B(()=>import(U(l.data.options,`search-summary`)),[],import.meta.url))},x=k(()=>l.data.options?.[`preview-mode`]?.value??`server`);E(()=>{y(N(x))});let C=`./sidebar${ae.url.search}`,D=i(void 0),O=i(void 0),A=(e,t)=>{let n=document.createElement(`script`),r=document.createTextNode(`{${t}}`);n.appendChild(r),e.replaceChildren(n)};E(()=>{N(D)&&A(N(D),N(f).options.CHAT_CONFIG_OVERRIDE.value||``)}),E(()=>{N(O)&&N(f).embedTab===`chat`?A(N(O),N(f).options.onclosechat.value||``):N(O)&&N(O).replaceChildren()});let M=k(()=>N(f)&&N(f).options[`preview-components`].value),ne=k(()=>N(f).embedTab===`chat`),se=k(()=>N(f).embedTab===`search-summary`);E(()=>{if(!N(se)){H();return}let e=N(f).options[`use-chat-config`]?.value?``:N(f).options[`host-css`]?.value??``;e?ie(e):H()});var W=Ue();te(`1uha8ag`,e=>{var t=S(),n=R(t),r=e=>{T(()=>{L.title=`LiipGPT Configurator | Components`})},i=e=>{T(()=>{L.title=`LiipGPT Configurator`})};v(n,e=>{N(f).options[`preview-components`].value?e(r,1):e(i,-1)}),c(e,t)});var G=w(W);let K;var ce=w(G),q=e=>{var t=ze();j(()=>I(t,`src`,C)),c(e,t)};v(ce,e=>{N(f).options[`hide-sidebar`].value||e(q)}),o(G);var J=h(G,2),le=e=>{oe(e,{mode:`show`})};v(J,e=>{N(f).options[`hide-sidebar`].value&&e(le)}),s(h(J,2),()=>N(f),e=>{var n=S(),r=R(n),i=e=>{var n=S();t(R(n),{onerror:e=>console.error(`Rendering error of components`,e)},e=>{Q(e,ee(()=>u))}),c(e,n)},s=e=>{var t=He();let n;var r=w(t),i=e=>{var t=Be(),n=h(w(t),6),r=w(n),i=h(w(r),6),a=h(w(i),2),s=h(w(a),14),l=h(w(s),2),u=w(l);u.value=u.__value=``;var d=h(u);d.value=d.__value=`ch`;var f=h(d);f.value=f.__value=`de`;var p=h(f);p.value=p.__value=`at`,o(l),o(s);var m=h(s,12),g=h(w(m),2),_=w(g);_.value=_.__value=``;var v=h(_);v.value=v.__value=`a`;var y=h(v);y.value=y.__value=`b`;var x=h(y);x.value=x.__value=`c`,o(g),o(m),b(2),o(a),o(i),b(16),o(r),b(2),o(n),o(t),c(e,t)};v(r,e=>{N(ne)&&N(f).options.flyout.value&&N(f).options[`preview-form`].value&&e(i)});var s=h(r,2),l=e=>{var t=S(),n=R(t),r=e=>{var t=Ve();j(()=>I(t,`src`,N(f).options[`preview-background`].value)),c(e,t)},i=k(()=>g(N(f).options[`preview-background`].value));v(n,e=>{N(i)&&e(r)}),c(e,t)};v(s,e=>{N(ne)&&N(f).options.flyout.value&&N(f).options[`preview-background`].value&&e(l)});var u=h(s,2);F(u,e=>_(D,e),()=>N(D));var d=h(u,2);re(d,()=>V(N(f).options,N(f).embedTab,!1,!0)),F(h(d,2),e=>_(O,e),()=>N(O)),o(t),j(e=>n=a(t,1,`svelte-1uha8ag`,null,n,e),[()=>({"has-bg-image":N(f).options.flyout.value&&N(f).options[`preview-background`].value&&g(N(f).options[`preview-background`].value),"search-summary-preview":N(se)})]),c(e,t)};v(r,e=>{N(M)?e(i):e(s,-1)}),c(e,n)}),o(W),j(()=>{a(W,1,r([{"components-preview":N(M)}]),`svelte-1uha8ag`),K=a(G,1,`sidebar-slot svelte-1uha8ag`,null,K,{"sidebar-slot--hidden":N(f).options[`hide-sidebar`].value})}),c(n,W),d()}D($,{},[],[],{mode:`open`});export{$ as component};
50
+ /* stylelint-disable-next-line property-disallowed-list */container-type:inline-size;height:auto;min-height:100%;}.preview-bg-image.svelte-1uha8ag {display:block;width:100%;height:auto;pointer-events:none;user-select:none;}`};function $(n,l){m(l,!0),e(n,We);let u=P(l,[`$$slots`,`$$events`,`$$legacy`,`$$host`]),f=k(()=>l.data);E(()=>{window.onmessage=function(e){typeof e.data==`string`&&e.data.startsWith(`liipgpt-url:`)&&z(`?`+new URLSearchParams(e.data.replace(`liipgpt-url:`,``)).toString(),{replaceState:!0})}});let p=e=>N(f).options?.esm?.value?`/build/${e}/liipgpt-${e}.js`:`/build/${e}/liipgpt-${e}.iife.js`,g=e=>/\.(png|jpe?g|gif|webp|svg|bmp|ico)(\?.*)?$/i.test(e),y=async e=>{e===`build`&&(await B(()=>import(p(`chat`)),[],import.meta.url),await B(()=>import(p(`button`)),[],import.meta.url),await B(()=>import(p(`search-summary`)),[],import.meta.url)),e===`dev`&&(await B(()=>import(`../chunks/DmafQ_KV.js`),__vite__mapDeps([0,1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,16,17,18]),import.meta.url),await B(()=>import(`../chunks/BndQp4ie.js`),__vite__mapDeps([19,12,4,2,9,6,13,8,7,10,14,15,18]),import.meta.url),await B(()=>import(`../chunks/BgPvdYLz.js`),__vite__mapDeps([20,3,12,4,2,5,6,7,15,17,21]),import.meta.url)),e===`server`&&(B(()=>import(U(l.data.options,`chat`)),[],import.meta.url),B(()=>import(U(l.data.options,`button`)),[],import.meta.url),B(()=>import(U(l.data.options,`search-summary`)),[],import.meta.url))},x=k(()=>l.data.options?.[`preview-mode`]?.value??`server`);E(()=>{y(N(x))});let C=`./sidebar${ae.url.search}`,D=i(void 0),O=i(void 0),A=(e,t)=>{let n=document.createElement(`script`),r=document.createTextNode(`{${t}}`);n.appendChild(r),e.replaceChildren(n)};E(()=>{N(D)&&A(N(D),N(f).options.CHAT_CONFIG_OVERRIDE.value||``)}),E(()=>{N(O)&&N(f).embedTab===`chat`?A(N(O),N(f).options.onclosechat.value||``):N(O)&&N(O).replaceChildren()});let M=k(()=>N(f)&&N(f).options[`preview-components`].value),ne=k(()=>N(f).embedTab===`chat`),se=k(()=>N(f).embedTab===`search-summary`);E(()=>{if(!N(se)){H();return}let e=N(f).options[`use-chat-config`]?.value?``:N(f).options[`host-css`]?.value??``;e?ie(e):H()});var W=Ue();te(`1uha8ag`,e=>{var t=S(),n=R(t),r=e=>{T(()=>{L.title=`LiipGPT Configurator | Components`})},i=e=>{T(()=>{L.title=`LiipGPT Configurator`})};v(n,e=>{N(f).options[`preview-components`].value?e(r,1):e(i,-1)}),c(e,t)});var G=w(W);let K;var ce=w(G),q=e=>{var t=ze();j(()=>I(t,`src`,C)),c(e,t)};v(ce,e=>{N(f).options[`hide-sidebar`].value||e(q)}),o(G);var J=h(G,2),le=e=>{oe(e,{mode:`show`})};v(J,e=>{N(f).options[`hide-sidebar`].value&&e(le)}),s(h(J,2),()=>N(f),e=>{var n=S(),r=R(n),i=e=>{var n=S();t(R(n),{onerror:e=>console.error(`Rendering error of components`,e)},e=>{Q(e,ee(()=>u))}),c(e,n)},s=e=>{var t=He();let n;var r=w(t),i=e=>{var t=Be(),n=h(w(t),6),r=w(n),i=h(w(r),6),a=h(w(i),2),s=h(w(a),14),l=h(w(s),2),u=w(l);u.value=u.__value=``;var d=h(u);d.value=d.__value=`ch`;var f=h(d);f.value=f.__value=`de`;var p=h(f);p.value=p.__value=`at`,o(l),o(s);var m=h(s,12),g=h(w(m),2),_=w(g);_.value=_.__value=``;var v=h(_);v.value=v.__value=`a`;var y=h(v);y.value=y.__value=`b`;var x=h(y);x.value=x.__value=`c`,o(g),o(m),b(2),o(a),o(i),b(16),o(r),b(2),o(n),o(t),c(e,t)};v(r,e=>{N(ne)&&N(f).options.flyout.value&&N(f).options[`preview-form`].value&&e(i)});var s=h(r,2),l=e=>{var t=S(),n=R(t),r=e=>{var t=Ve();j(()=>I(t,`src`,N(f).options[`preview-background`].value)),c(e,t)},i=k(()=>g(N(f).options[`preview-background`].value));v(n,e=>{N(i)&&e(r)}),c(e,t)};v(s,e=>{N(ne)&&N(f).options.flyout.value&&N(f).options[`preview-background`].value&&e(l)});var u=h(s,2);F(u,e=>_(D,e),()=>N(D));var d=h(u,2);re(d,()=>V(N(f).options,N(f).embedTab,!1,!0)),F(h(d,2),e=>_(O,e),()=>N(O)),o(t),j(e=>n=a(t,1,`svelte-1uha8ag`,null,n,e),[()=>({"has-bg-image":N(f).options.flyout.value&&N(f).options[`preview-background`].value&&g(N(f).options[`preview-background`].value),"search-summary-preview":N(se)})]),c(e,t)};v(r,e=>{N(M)?e(i):e(s,-1)}),c(e,n)}),o(W),j(()=>{a(W,1,r([{"components-preview":N(M)}]),`svelte-1uha8ag`),K=a(G,1,`sidebar-slot svelte-1uha8ag`,null,K,{"sidebar-slot--hidden":N(f).options[`hide-sidebar`].value})}),c(n,W),d()}D($,{},[],[],{mode:`open`});export{$ as component};