1var Ct = Object.defineProperty; 2var tt = (e) => { 3 throw TypeError(e); 4}; 5var xt = (e, t, i) => t in e ? Ct(e, t, { enumerable: !0, configurable: !0, writable: !0, value: i }) : e[t] = i; 6var U = (e, t, i) => xt(e, typeof t != "symbol" ? t + "" : t, i), I = (e, t, i) => t.has(e) || tt("Cannot " + i); 7var s = (e, t, i) => (I(e, t, "read from private field"), i ? i.call(e) : t.get(e)), f = (e, t, i) => t.has(e) ? tt("Cannot add the same private member more than once") : t instanceof WeakSet ? t.add(e) : t.set(e, i), c = (e, t, i, r) => (I(e, t, "write to private field"), r ? r.call(e, i) : t.set(e, i), i), v = (e, t, i) => (I(e, t, "access private method"), i); 8import { i as kt, t as $t, e as St, E as et, x as $, o as At, B as _t } from "./unsafe-html-B1yMZI_M.js"; 9import Kt from "./purify.es-Q3IQ-fe5.js"; 10import { marked as it } from "./marked.esm-CtDyvN5z.js"; 11import { c as Lt } from "./theme-ehL-TQzv.js"; 12import { d as Ht } from "./jwt-CBQwn05Y.js"; 13import { g as nt } from "./main-CuJH686S.js"; 14import { g as Et } from "./get-random-string-CK0Qtika.js"; 15/** 16 * @license 17 * Copyright 2020 Google LLC 18 * SPDX-License-Identifier: BSD-3-Clause 19 */ 20const Mt = (e) => e.strings === void 0; 21/** 22 * @license 23 * Copyright 2017 Google LLC 24 * SPDX-License-Identifier: BSD-3-Clause 25 */ 26const Z = (e, t) => { 27 var r; 28 const i = e._$AN; 29 if (i === void 0) return !1; 30 for (const n of i) (r = n._$AO) == null || r.call(n, t, !1), Z(n, t); 31 return !0; 32}, G = (e) => { 33 let t, i; 34 do { 35 if ((t = e._$AM) === void 0) break; 36 i = t._$AN, i.delete(e), e = t; 37 } while ((i == null ? void 0 : i.size) === 0); 38}, ot = (e) => { 39 for (let t; t = e._$AM; e = t) { 40 let i = t._$AN; 41 if (i === void 0) t._$AN = i = /* @__PURE__ */ new Set(); 42 else if (i.has(e)) break; 43 i.add(e), qt(t); 44 } 45}; 46function Zt(e) { 47 this._$AN !== void 0 ? (G(this), this._$AM = e, ot(this)) : this._$AM = e; 48} 49function Tt(e, t = !1, i = 0) { 50 const r = this._$AH, n = this._$AN; 51 if (n !== void 0 && n.size !== 0) if (t) if (Array.isArray(r)) for (let d = i; d < r.length; d++) Z(r[d], !1), G(r[d]); 52 else r != null && (Z(r, !1), G(r)); 53 else Z(this, e); 54} 55const qt = (e) => { 56 e.type == $t.CHILD && (e._$AP ?? (e._$AP = Tt), e._$AQ ?? (e._$AQ = Zt)); 57}; 58let Rt = class extends kt { 59 constructor() { 60 super(...arguments), this._$AN = void 0; 61 } 62 _$AT(t, i, r) { 63 super._$AT(t, i, r), ot(this), this.isConnected = t._$AU; 64 } 65 _$AO(t, i = !0) { 66 var r, n; 67 t !== this.isConnected && (this.isConnected = t, t ? (r = this.reconnected) == null || r.call(this) : (n = this.disconnected) == null || n.call(this)), i && (Z(this, t), G(this)); 68 } 69 setValue(t) { 70 if (Mt(this._$Ct)) this._$Ct._$AI(t, this); 71 else { 72 const i = [...this._$Ct._$AH]; 73 i[this._$Ci] = t, this._$Ct._$AI(i, this, 0); 74 } 75 } 76 disconnected() { 77 } 78 reconnected() { 79 } 80}; 81/** 82 * @license 83 * Copyright 2020 Google LLC 84 * SPDX-License-Identifier: BSD-3-Clause 85 */ 86const zt = () => new Nt(); 87let Nt = class { 88}; 89const O = /* @__PURE__ */ new WeakMap(), Ut = St(class extends Rt { 90 render(e) { 91 return et; 92 } 93 update(e, [t]) { 94 var r; 95 const i = t !== this.G; 96 return i && this.G !== void 0 && this.rt(void 0), (i || this.lt !== this.ct) && (this.G = t, this.ht = (r = e.options) == null ? void 0 : r.host, this.rt(this.ct = e.element)), et; 97 } 98 rt(e) { 99 if (this.isConnected || (e = void 0), typeof this.G == "function") { 100 const t = this.ht ?? globalThis; 101 let i = O.get(t); 102 i === void 0 && (i = /* @__PURE__ */ new WeakMap(), O.set(t, i)), i.get(this.G) !== void 0 && this.G.call(this.ht, void 0), i.set(this.G, e), e !== void 0 && this.G.call(this.ht, e); 103 } else this.G.value = e; 104 } 105 get lt() { 106 var e, t; 107 return typeof this.G == "function" ? (e = O.get(this.ht ?? globalThis)) == null ? void 0 : e.get(this.G) : (t = this.G) == null ? void 0 : t.value; 108 } 109 disconnected() { 110 this.lt === this.ct && this.rt(void 0); 111 } 112 reconnected() { 113 this.rt(this.ct); 114 } 115}); 116var Gt = Symbol.for("preact-signals"); 117function P() { 118 if (w > 1) 119 w--; 120 else { 121 for (var e, t = !1; T !== void 0; ) { 122 var i = T; 123 for (T = void 0, j++; i !== void 0; ) { 124 var r = i.o; 125 if (i.o = void 0, i.f &= -3, !(8 & i.f) && lt(i)) try { 126 i.c(); 127 } catch (n) { 128 t || (e = n, t = !0); 129 } 130 i = r; 131 } 132 } 133 if (j = 0, w--, t) throw e; 134 } 135} 136function Bt(e) { 137 if (w > 0) return e(); 138 w++; 139 try { 140 return e(); 141 } finally { 142 P(); 143 } 144} 145var a = void 0; 146function st(e) { 147 var t = a; 148 a = void 0; 149 try { 150 return e(); 151 } finally { 152 a = t; 153 } 154} 155var T = void 0, w = 0, j = 0, B = 0; 156function at(e) { 157 if (a !== void 0) { 158 var t = e.n; 159 if (t === void 0 || t.t !== a) 160 return t = { i: 0, S: e, p: a.s, n: void 0, t: a, e: void 0, x: void 0, r: t }, a.s !== void 0 && (a.s.n = t), a.s = t, e.n = t, 32 & a.f && e.S(t), t; 161 if (t.i === -1) 162 return t.i = 0, t.n !== void 0 && (t.n.p = t.p, t.p !== void 0 && (t.p.n = t.n), t.p = a.s, t.n = void 0, a.s.n = t, a.s = t), t; 163 } 164} 165function h(e, t) { 166 this.v = e, this.i = 0, this.n = void 0, this.t = void 0, this.W = t == null ? void 0 : t.watched, this.Z = t == null ? void 0 : t.unwatched; 167} 168h.prototype.brand = Gt; 169h.prototype.h = function() { 170 return !0; 171}; 172h.prototype.S = function(e) { 173 var t = this, i = this.t; 174 i !== e && e.e === void 0 && (e.x = i, this.t = e, i !== void 0 ? i.e = e : st(function() { 175 var r; 176 (r = t.W) == null || r.call(t); 177 })); 178}; 179h.prototype.U = function(e) { 180 var t = this; 181 if (this.t !== void 0) { 182 var i = e.e, r = e.x; 183 i !== void 0 && (i.x = r, e.e = void 0), r !== void 0 && (r.e = i, e.x = void 0), e === this.t && (this.t = r, r === void 0 && st(function() { 184 var n; 185 (n = t.Z) == null || n.call(t); 186 })); 187 } 188}; 189h.prototype.subscribe = function(e) { 190 var t = this; 191 return ut(function() { 192 var i = t.value, r = a; 193 a = void 0; 194 try { 195 e(i); 196 } finally { 197 a = r; 198 } 199 }); 200}; 201h.prototype.valueOf = function() { 202 return this.value; 203}; 204h.prototype.toString = function() { 205 return this.value + ""; 206}; 207h.prototype.toJSON = function() { 208 return this.value; 209}; 210h.prototype.peek = function() { 211 var e = a; 212 a = void 0; 213 try { 214 return this.value; 215 } finally { 216 a = e; 217 } 218}; 219Object.defineProperty(h.prototype, "value", { get: function() { 220 var e = at(this); 221 return e !== void 0 && (e.i = this.i), this.v; 222}, set: function(e) { 223 if (e !== this.v) { 224 if (j > 100) throw new Error("Cycle detected"); 225 this.v = e, this.i++, B++, w++; 226 try { 227 for (var t = this.t; t !== void 0; t = t.x) t.t.N(); 228 } finally { 229 P(); 230 } 231 } 232} }); 233function Pt(e, t) { 234 return new h(e, t); 235} 236function lt(e) { 237 for (var t = e.s; t !== void 0; t = t.n) if (t.S.i !== t.i || !t.S.h() || t.S.i !== t.i) return !0; 238 return !1; 239} 240function dt(e) { 241 for (var t = e.s; t !== void 0; t = t.n) { 242 var i = t.S.n; 243 if (i !== void 0 && (t.r = i), t.S.n = t, t.i = -1, t.n === void 0) { 244 e.s = t; 245 break; 246 } 247 } 248} 249function ct(e) { 250 for (var t = e.s, i = void 0; t !== void 0; ) { 251 var r = t.p; 252 t.i === -1 ? (t.S.U(t), r !== void 0 && (r.n = t.n), t.n !== void 0 && (t.n.p = r)) : i = t, t.S.n = t.r, t.r !== void 0 && (t.r = void 0), t = r; 253 } 254 e.s = i; 255} 256function L(e, t) { 257 h.call(this, void 0), this.x = e, this.s = void 0, this.g = B - 1, this.f = 4, this.W = t == null ? void 0 : t.watched, this.Z = t == null ? void 0 : t.unwatched; 258} 259L.prototype = new h(); 260L.prototype.h = function() { 261 if (this.f &= -3, 1 & this.f) return !1; 262 if ((36 & this.f) == 32 || (this.f &= -5, this.g === B)) return !0; 263 if (this.g = B, this.f |= 1, this.i > 0 && !lt(this)) 264 return this.f &= -2, !0; 265 var e = a; 266 try { 267 dt(this), a = this; 268 var t = this.x(); 269 (16 & this.f || this.v !== t || this.i === 0) && (this.v = t, this.f &= -17, this.i++); 270 } catch (i) { 271 this.v = i, this.f |= 16, this.i++; 272 } 273 return a = e, ct(this), this.f &= -2, !0; 274}; 275L.prototype.S = function(e) { 276 if (this.t === void 0) { 277 this.f |= 36; 278 for (var t = this.s; t !== void 0; t = t.n) t.S.S(t); 279 } 280 h.prototype.S.call(this, e); 281}; 282L.prototype.U = function(e) { 283 if (this.t !== void 0 && (h.prototype.U.call(this, e), this.t === void 0)) { 284 this.f &= -33; 285 for (var t = this.s; t !== void 0; t = t.n) t.S.U(t); 286 } 287}; 288L.prototype.N = function() { 289 if (!(2 & this.f)) { 290 this.f |= 6; 291 for (var e = this.t; e !== void 0; e = e.x) e.t.N(); 292 } 293}; 294Object.defineProperty(L.prototype, "value", { get: function() { 295 if (1 & this.f) throw new Error("Cycle detected"); 296 var e = at(this); 297 if (this.h(), e !== void 0 && (e.i = this.i), 16 & this.f) throw this.v; 298 return this.v; 299} }); 300function ht(e) { 301 var t = e.u; 302 if (e.u = void 0, typeof t == "function") { 303 w++; 304 var i = a; 305 a = void 0; 306 try { 307 t(); 308 } catch (r) { 309 throw e.f &= -2, e.f |= 8, Y(e), r; 310 } finally { 311 a = i, P(); 312 } 313 } 314} 315function Y(e) { 316 for (var t = e.s; t !== void 0; t = t.n) t.S.U(t); 317 e.x = void 0, e.s = void 0, ht(e); 318} 319function It(e) { 320 if (a !== this) throw new Error("Out-of-order effect"); 321 ct(this), a = e, this.f &= -2, 8 & this.f && Y(this), P(); 322} 323function H(e) { 324 this.x = e, this.u = void 0, this.s = void 0, this.o = void 0, this.f = 32; 325} 326H.prototype.c = function() { 327 var e = this.S(); 328 try { 329 if (8 & this.f || this.x === void 0) return; 330 var t = this.x(); 331 typeof t == "function" && (this.u = t); 332 } finally { 333 e(); 334 } 335}; 336H.prototype.S = function() { 337 if (1 & this.f) throw new Error("Cycle detected"); 338 this.f |= 1, this.f &= -9, ht(this), dt(this), w++; 339 var e = a; 340 return a = this, It.bind(this, e); 341}; 342H.prototype.N = function() { 343 2 & this.f || (this.f |= 2, this.o = T, T = this); 344}; 345H.prototype.d = function() { 346 this.f |= 8, 1 & this.f || Y(this); 347}; 348H.prototype.dispose = function() { 349 this.d(); 350}; 351function ut(e) { 352 var t = new H(e); 353 try { 354 t.c(); 355 } catch (r) { 356 throw t.d(), r; 357 } 358 var i = t.d.bind(t); 359 return i[Symbol.dispose] = i, i; 360} 361const Ot = { label: "AI Search" }, jt = { label: "Ask AI" }, Dt = { label: "Was this information helpful?" }, Wt = { general: { label: "Something went wrong. Please try again later." } }, Ft = { group: { label: "Actions" }, copy: { label: "Copy Answer" }, rate: { positive: { label: "Rate answer positively" }, negative: { label: "Rate answer negatively" } } }, Jt = { general: { label: "Auto-generated based on site content. Responses may contain inaccuracies." } }, Xt = { 362 title: Ot, 363 cta: jt, 364 feedback: Dt, 365 error: Wt, 366 actions: Ft, 367 disclaimer: Jt 368}, ft = self.i18n || {}, vt = "ai-search"; 369ft.addResourceBundle("en", vt, Xt, !0); 370const g = ft.getFixedT(null, vt); 371var m, k, K, pt, gt; 372class Qt { 373 constructor() { 374 f(this, K); 375 /** @type {string} */ 376 U(this, "id"); 377 /** @type {AbortController} */ 378 f(this, m); 379 /** @type {string | undefined} */ 380 f(this, k); 381 c(this, m, new AbortController()); 382 } 383 abort() { 384 s(this, m).abort(), c(this, m, new AbortController()); 385 } 386 disconnect() { 387 s(this, m).abort(); 388 } 389 /** 390 * @param {Object} params 391 * @param {string | null} params.query 392 * @param {string | null} params.contentSource 393 * @param {string | null} params.version 394 * @param {string | null} params.variant 395 * @param {string | null} params.language 396 */ 397 async ask({ 398 query: t, 399 contentSource: i, 400 version: r, 401 variant: n, 402 language: d 403 }) { 404 let l = 0; 405 const y = async () => {
406 try { 407 if (s(this, k) && Vt(s(this, k))) 408 return v(this, K, gt).call(this, { 409 query: t, 410 contentSource: i, 411 version: r, 412 variant: n, 413 authToken: s(this, k), 414 language: d 415 }); 416 throw new Error("Invalid token"); 417 } catch (C) { 418 if (C.message === "Invalid token") { 419 if (l < 3) 420 return l++, c(this, k, await v(this, K, pt).call(this)), y(); 421 throw C; 422 } else 423 throw C; 424 } 425 }; 426 return y(); 427 } 428} 429m = new WeakMap(), k = new WeakMap(), K = new WeakSet(), pt = async function() { 430 return (await (await fetch(new URL("__token/crag", Lt()), { 431 signal: s(this, m).signal 432 })).json()).token; 433}, gt = async function({ 434 query: t, 435 contentSource: i, 436 version: r, 437 variant: n, 438 language: d, 439 authToken: l 440}) { 441 var V; 442 const y = nt(), C = new URL("/api/query", y.apiBaseUrl), p = await fetch(C.toString(), { 443 method: "POST", 444 mode: "cors", 445 headers: { 446 "Content-Type": "application/json;charset=utf-8" 447 }, 448 body: JSON.stringify({ 449 query: t, 450 content_source: i, 451 version: r, 452 variant: n, 453 jwt: l, 454 language: d 455 }), 456 signal: s(this, m).signal 457 }); 458 if (!p.ok || p.status !== 200) 459 throw new Error("Something went wrong"); 460 if (!p.body) 461 throw new Error("Empty response"); 462 this.id = p.headers.get("k15t-ai-search-response-id"); 463 const N = (V = p.headers.get("Date")) != null && V.length ? p.headers.get("Date") : (/* @__PURE__ */ new Date()).toUTCString(); 464 return { 465 id: this.id, 466 date: N, 467 content: p.body.pipeThrough(new TextDecoderStream()) 468 }; 469}; 470const Yt = 300 * 1e3; 471function Vt(e) { 472 var i; 473 const t = (i = Ht(e)) == null ? void 0 : i.exp; 474 return !!t && t * 1e3 - Date.now() >= Yt; 475} 476var q, D, u, R, S, z, A, _, o, x, E, bt, W, F, mt, M, J, X, yt, wt, Q; 477const b = class b extends HTMLElement { 478 constructor() { 479 super(); 480 f(this, o); 481 f(this, u, Pt(s(b, q, D))); 482 /** @type {function(): void} */ 483 f(this, R); 484 f(this, S, zt()); 485 f(this, z, ""); 486 f(this, A, ""); 487 f(this, _, ""); 488 const i = this.attachShadow({ 489 mode: "open", 490 delegatesFocus: !0 491 }); 492 i.adoptedStyleSheets = [b.styles], this.service = new Qt(); 493 } 494 static get styles() { 495 const i = new CSSStyleSheet(); 496 return i.replaceSync(` 497 *, *::before, *::after { 498 box-sizing: border-box; 499 } 500 501 :host { 502 --_border-width: var(--border-width, 1px); 503 504 display: flex; 505 flex-direction: column; 506 row-gap: 12px; 507 text-align: start; 508 font: var(--K15t-font-body-medium); 509 color: var(--K15t-foreground); 510 } 511 512 a { 513 color: var(--K15t-link); 514 } 515 516 a:visited { 517 color: var(--K15t-link-visited); 518 } 519 520 svg { 521 display: block; 522 max-inline-size: 100%; 523 block-size: auto; 524 } 525 526 :where(header, main, footer) { 527 :first-child { 528 margin-block-start: 0; 529 } 530 :last-child { 531 margin-block-end: 0; 532 } 533 } 534 535 header { 536 display: flex; 537 flex-wrap: wrap; 538 justify-content: space-between; 539 gap: 16px; 540 align-items: center; 541 font: var(--K15t-font-body-small); 542 543 p { 544 display: flex; 545 align-items: center; 546 column-gap: 0.5ch; 547 margin-block: 0; 548 } 549 } 550 551 [part="container"] { 552 display: flex; 553 flex-direction: column; 554 padding: 16px; 555 border: var(--_border-width) solid var(--K15t-border-neutral); 556 border-radius: var(--K15t-radius-medium); 557 min-height: 100%; 558 background-color: var(--K15t-surface-raised); 559 560 &:has(main:focus-visible) { 561 outline-style: auto; 562 outline-color: Highlight; 563 outline-color: -webkit-focus-ring-color; 564 } 565 566 &:not([data-status="idle"]) { 567 row-gap: 16px; 568 } 569 } 570 571 main { 572 font: var(--K15t-font-body-medium); 573 outline: none; 574 } 575 576 main :first-child { 577 margin-block-start: 0; 578 } 579 580 main :last-child { 581 margin-block-end: 0; 582 } 583 584 main :is(ul, ol) { 585 padding-inline-start: 2ch; 586 } 587 588 main li > :where(:first-child, :last-child) { 589 margin-block: 0; 590 } 591 592 main :is(pre, table) { 593 overflow-x: auto; 594 scrollbar-width: thin; 595 } 596 597 main pre { 598 background-color: var(--K15t-background-neutral); 599 border-radius: var(--K15t-radius-medium); 600 padding: 12px; 601 font: var(--K15t-font-code-medium); 602 font-size: var(--K15t-font-size-body-small); 603 } 604 605 footer { 606 display: flex; 607 flex-direction: column; 608 column-gap: 0.5rem; 609 row-gap: 16px; 610 margin-block-start: 12px; 611 flex: 1; 612 } 613 614 fieldset { 615 margin: 0; 616 padding: 0; 617 border: 0; 618 align-items: end; 619 display: flex; 620 column-gap: 0.5rem; 621 align-items: center; 622 } 623 624 :where(#legend) { 625 margin: 0; 626 padding: 0; 627 font: var(--K15t-font-body-small); 628 } 629 630 button { 631 padding: 0; 632 background: none; 633 border: 0; 634 border-radius: var(--K15t-radius-small); 635 display: inline-flex; 636 align-items: center; 637 justify-content: center; 638 cursor: pointer; 639 color: var(--K15t-foreground); 640 background-color: var(--K15t-background-neutral); 641 block-size: 24px; 642 min-inline-size: 24px; 643 644 display: inline-flex; 645 align-items: center; 646 justify-content: center; 647 648 svg { 649 aspect-ratio: 1/1; 650 } 651 } 652 653 button:disabled {
654 cursor: not-allowed; 655 color: var(--K15t-foreground-subtle); 656 } 657 658 button:is(:hover, :focus-visible) { 659 background-color: var(--K15t-background-neutral-hovered); 660 } 661 662 button:focus-visible { 663 isolation: isolate; 664 } 665 666 button:active { 667 background-color: var(--K15t-background-neutral-pressed); 668 } 669 670 button[aria-pressed="true"] { 671 color: var(--K15t-foreground-on-strong); 672 background-color: var(--K15t-background-neutral-strong-selected); 673 } 674 675 button svg { 676 display: block; 677 inline-size: 16px; 678 aspect-ratio: 1 / 1; 679 } 680 681 button[data-appearance="subtle"] { 682 background-color: var(--K15t-background-neutral-subtle); 683 } 684 685 button[data-appearance="subtle"]:is(:hover, :focus-visible) { 686 background-color: var(--K15t-background-neutral-subtle-hovered); 687 } 688 689 button[data-appearance="subtle"]:active { 690 background-color: var(--K15t-background-neutral-subtle-pressed); 691 } 692 693 #rating { 694 gap: 1px; 695 696 button:nth-child(1) { 697 border-start-end-radius: 0; 698 border-end-end-radius: 0; 699 } 700 button:nth-child(2) { 701 border-start-start-radius: 0; 702 border-end-start-radius: 0; 703 } 704 } 705 706 .disclaimer { 707 margin-block-start: auto; 708 font: var(--K15t-font-body-small); 709 color: var(--K15t-color-neutral-300); 710 711 p { 712 margin-block-end: 0; 713 } 714 715 hr { 716 margin: 0; 717 border: 0; 718 border-block-end: 1px solid var(--K15t-border-neutral); 719 } 720 } 721 722 .loading-skeleton { 723 position: relative; 724 overflow: clip; 725 background-color: var(--K15t-surface-raised); 726 } 727 728 .loading-gradient { 729 position: absolute; 730 inset: 0; 731 background-image: linear-gradient( 732 to right, 733 transparent, 734 var(--K15t-surface-raised), 735 transparent 736 ); 737 width: 300%; 738 margin-inline: auto; 739 z-index: 2; 740 mix-blend-mode: lighten; 741 animation: slidyGradient; 742 animation-play-state: paused; 743 animation-fill-mode: both; 744 animation-duration: 3s; 745 animation-iteration-count: infinite; 746 animation-direction: alternate; 747 animation-timing-function: ease-in-out; 748 } 749 750 [data-status="pending"] .loading-gradient { 751 animation-play-state: running; 752 } 753 754 .loading-indicator { 755 z-index: 1; 756 background-color: var(--K15t-background-neutral); 757 height: 0.5rem; 758 border-radius: 3px; 759 animation: slideIn; 760 animation-fill-mode: both; 761 animation-duration: 1s; 762 763 &:not(:last-child) { 764 margin-block-end: 0.5rem; 765 } 766 767 &:nth-child(2) { 768 animation-delay: 150ms; 769 } 770 &:nth-child(3) { 771 animation-delay: 350ms; 772 } 773 &:nth-child(4) { 774 animation-delay: 550ms; 775 } 776 &:nth-child(5) { 777 animation-delay: 750ms; 778 max-width: 80%; 779 } 780 } 781 782 @keyframes slideIn { 783 from { 784 transform: translateX(-100%); 785 } 786 to { 787 transform: translatex(0%); 788 } 789 } 790 791 @keyframes slidyGradient { 792 100% { 793 transform: translateX(-60%); 794 } 795 } 796 797 #actions { 798 display: flex; 799 flex-wrap: wrap; 800 gap: 0.5rem; 801 } 802 803 #buttons { 804 display: flex; 805 gap: 0.5rem; 806 } 807 808 #cta { 809 padding-inline-start: 0.9ch; 810 padding-inline-end: 1.5ch; 811 gap: 0.35ch; 812 font-size: 12px; 813 814 svg { 815 display: block; 816 max-block-size: 100%; 817 block-size: 2.5ex; 818 inline-size: auto; 819 } 820 } 821 822 .sr-only { 823 position: absolute; 824 width: 1px; 825 height: 1px; 826 padding: 0; 827 margin: -1px; 828 overflow: hidden; 829 clip: rect(0, 0, 0, 0); 830 white-space: nowrap; 831 border: 0; 832 } 833 `), i; 834 } 835 connectedCallback() { 836 v(this, o, Q).call(this), c(this, R, ut(() => { 837 v(this, o, Q).call(this); 838 })), s(this, o, M) === "auto" && s(this, o, E) === "idle" && this.getAttribute("query") && v(this, o, X).call(this); 839 } 840 attributeChangedCallback(i, r, n) { 841 s(this, o, M) === "manual" && /** @type {Status[]} */ 842 ["pending", "writing"].includes(s(this, o, E)) && n !== r && this.service.abort(), s(this, o, M) === "manual" && /** @type {Status[]} */ 843 ["success", "success_retry", "error"].includes(s(this, o, E)) && n !== r && v(this, o, J).call(this); 844 } 845 disconnectedCallback() { 846 s(this, R).call(this), this.service.disconnect(); 847 } 848}; 849q = new WeakSet(), D = function() { 850 return { 851 /** @type {Status} */ 852 status: "idle", 853 /** @type {Rating} */ 854 rating: 0, 855 /** @type {string} */ 856 answer: "" 857 }; 858}, u = new WeakMap(), R = new WeakMap(), S = new WeakMap(), z = new WeakMap(), A = new WeakMap(), _ = new WeakMap(), o = new WeakSet(), x = function(i) { 859 s(this, u).value = { 860 ...s(this, u).value, 861 status: i 862 }; 863}, E = function() { 864 return s(this, u).value.status; 865}, bt = function(i) { 866 s(this, u).value = { 867 ...s(this, u).value, 868 rating: i 869 }; 870}, W = function() { 871 return s(this, u).value.rating; 872}, F = function(i) { 873 s(this, u).value = { 874 ...s(this, u).value, 875 answer: i 876 }; 877}, mt = function() { 878 return s(this, u).value.answer; 879}, M = function() { 880 const i = this.getAttribute("mode"); 881 return i === "manual" ? i : "auto"; 882}, J = function() { 883 s(this, u).value = s(b, q, D); 884}, X = async function() { 885 Bt(() => { 886 c(this, o, "pending", x), c(this, o, "", F); 887 }), this.focus(); 888 let i; 889 try { 890 i = await this.service.ask({ 891 query: this.getAttribute("query") || null, 892 contentSource: this.getAttribute("contentsource") || null, 893 version: this.getAttribute("version") || null, 894 variant: this.getAttribute("variant") || null, 895 language: nt().siteLanguage 896 }); 897 } catch (n) { 898 if (n.name === "AbortError") { 899 v(this, o, J).call(this); 900 return; 901 } else { 902 console.error(n), c(this, o, "error", x); 903 return; 904 } 905 } 906 if (!((i == null ? void 0 : i.content) instanceof ReadableStream)) { 907 c(this, o, "error", x); 908 return; 909 } 910 c(this, o, "writing", x), it.use({ 911 async: !0, 912 walkTokens: (n) => { 913 if (n.type === "link" && URL.canParse(n.href)) { 914 const d = new URL(n.href); 915 d.hostname === location.hostname && (d.searchParams.set("utm_source", "ai_search"), d.searchParams.set("ai_search", "true"), n.href = d.href); 916 } 917 }, 918 hooks: { 919 postprocess: (n) => Kt.sanitize(n) 920 } 921 }); 922 const r = []; 923 try { 924 for await (const n of i.content) 925 r.push(n), c(this, o, await it.parse(r.join("")), F); 926 c(this, z, r.join("")), c(this, A, i.date), c(this, _, i.id), c(this, o, "success", x), this.dispatchEvent(new CustomEvent("ai_search_response", { 927 detail: { 928 id: s(this, _), 929 date: s(this, A), 930 query: this.getAttribute("query"), 931 response: s(this, z) 932 }, 933 bubbles: !0, 934 cancelable: !1, 935 composed: !0 936 })); 937 } catch (n) { 938 console.error(n), c(this, o, "error", x); 939 } 940}, yt = async function() { 941 var n, d, l; 942 const i = (n = s(this, S).value) == null ? void 0 : n.innerHTML, r = (l = (d = s(this, S).value) == null ? void 0 : d.textContent) == null ? void 0 : l.trim(); 943 if (!(!i || !r)) 944 try { 945 await navigator.clipboard.write([new ClipboardItem({ 946 "text/html": new Blob([i], { 947 type: "text/html" 948 }), 949 "text/plain": new Blob([r], { 950 type: "text/plain" 951 }) 952 })]); 953 } catch (y) { 954 console.error(y.message); 955 } 956}, wt = async function(i) { 957 const n = ( 958 /** @type {HTMLButtonElement} */ 959 i.composedPath().find((d) => d instanceof HTMLButtonElement) 960 ); 961 !n || (n == null ? void 0 : n.getAttribute("aria-pressed")) === "true" || (c(this, o, Number(n.value), bt), this.dispatchEvent(new CustomEvent("ai_search_user_feedback", { 962 detail: { 963 id: s(this, _), 964 date: s(this, A), 965 rating: s(this, o, W), 966 query: this.getAttribute("query") 967 }, 968 bubbles: !0, 969 cancelable: !1, 970 composed: !0 971 }))); 972}, Q = function() { 973 this.shadowRoot && _t(b.template({ 974 status: s(this, o, E), 975 answer: s(this, o, mt), 976 rating: s(this, o, W), 977 mode: s(this, o, M), 978 answerRef: s(this, S), 979 onAsk: v(this, o, X).bind(this), 980 onCopy: v(this, o, yt).bind(this), 981 onRate: v(this, o, wt).bind(this) 982 }), this.shadowRoot); 983}, f(b, q), U(b, "observedAttributes", ["query", "contentsource", "version", "variant"]), /** 984 * @param {Object} options 985 * @param {Rating} options.rating 986 * @param {string} options.answer 987 * @param {Mode} options.mode 988 * @param {any} options.answerRef 989 * @param {Status} options.status 990 * @param {() => {}} options.onCopy 991 * @param {() => {}} options.onRate 992 * @param {() => {}} options.onAsk 993 */ 994U(b, "template", ({ 995 rating: i, 996 answer: r, 997 mode: n, 998 answerRef: d, 999 status: l, 1000 onAsk: y, 1001 onCopy: C, 1002 onRate: p 1003}
1003) => { 1004 const N = Et(); 1005 return $` 1006 <section aria-label=${g("title.label")} part="container" data-status=${l} aria-errormessage=${N} tabindex="-1"> 1007 <header> 1008 <p> 1009 <svg role="img" aria-hidden="true" width="20" height="20" viewBox="0 0 20 20" fill="currentColor" xmlns="http://www.w3.org/2000/svg"> 1010 <path fill-rule="evenodd" clip-rule="evenodd" d="M7.28081 5.51147L8.769 5.46533C8.9226 6.46368 9.35644 7.87098 10.1986 9.0578C11.0294 10.2285 12.2344 11.1594 13.9709 11.333L13.8963 12.8293C13.1395 12.8293 11.8409 13.3406 10.7053 14.3318C9.5887 15.3066 8.77773 16.6171 8.77773 18.0793H7.27773C7.27773 17.2883 6.82991 15.9506 5.89393 14.8034C4.97622 13.6786 3.66616 12.8293 2.00006 12.8293L2 11.3293C3.53581 11.3293 4.73219 10.86 5.59661 9.95985C6.47348 9.04678 7.09046 7.60526 7.28081 5.51147ZM5.09423 12.161C5.87292 12.612 6.52881 13.2088 7.05618 13.8552C7.42989 14.3132 7.74789 14.8067 8.00506 15.3061C8.45055 14.486 9.06045 13.7766 9.71887 13.2018C10.2251 12.7599 10.7825 12.378 11.3479 12.0765C10.3512 11.5355 9.57088 10.7651 8.97536 9.92589C8.65649 9.47654 8.38841 9.00509 8.16519 8.53351C7.8097 9.51141 7.31415 10.337 6.6785 10.9988C6.21042 11.4863 5.67889 11.8719 5.09423 12.161Z" /> 1011 <path fill-rule="evenodd" clip-rule="evenodd" d="M13.9456 2.03225L14.9369 2C15.0253 2.54673 15.2758 3.32024 15.7617 3.9719C16.239 4.61209 16.934 5.12591 17.9439 5.22202L17.8965 6.21977C17.4621 6.21977 16.7082 6.50104 16.0482 7.04939C15.3978 7.58971 14.9433 8.30173 14.9433 9.07979H13.9433C13.9433 8.66673 13.6926 7.93796 13.1501 7.30519C12.6218 6.68897 11.8648 6.21974 10.8965 6.21977L10.8965 5.21977C11.7947 5.21977 12.4851 4.95822 12.9792 4.46864C13.4787 3.97356 13.8352 3.18812 13.9456 2.03225ZM12.8758 5.77105C13.2799 6.01568 13.6254 6.32313 13.9093 6.65434C14.1106 6.88912 14.2855 7.14113 14.4313 7.39809C14.6948 6.96222 15.0411 6.58596 15.4091 6.2802C15.6682 6.06495 15.9499 5.87478 16.2378 5.71709C15.7099 5.41604 15.2886 5.0103 14.96 4.56967C14.7948 4.34815 14.6524 4.11722 14.5305 3.88496C14.3214 4.39266 14.0391 4.82613 13.6831 5.17894C13.4403 5.41952 13.1698 5.61611 12.8758 5.77105Z" /> 1012 </svg> 1013 ${g("title.label")} 1014 </p> 1015 ${n === "manual" && l === "idle" ? $` 1016 <button type="button" id="cta" @click=${() => { 1017 y(); 1018 }}> 1019 <svg role="img" aria-hidden="true" width="20" height="20" viewBox="0 0 20 20" fill="currentColor" xmlns="http://www.w3.org/2000/svg"> 1020 <path fill-rule="evenodd" clip-rule="evenodd" d="M7.28081 5.51147L8.769 5.46533C8.9226 6.46368 9.35644 7.87098 10.1986 9.0578C11.0294 10.2285 12.2344 11.1594 13.9709 11.333L13.8963 12.8293C13.1395 12.8293 11.8409 13.3406 10.7053 14.3318C9.5887 15.3066 8.77773 16.6171 8.77773 18.0793H7.27773C7.27773 17.2883 6.82991 15.9506 5.89393 14.8034C4.97622 13.6786 3.66616 12.8293 2.00006 12.8293L2 11.3293C3.53581 11.3293 4.73219 10.86 5.59661 9.95985C6.47348 9.04678 7.09046 7.60526 7.28081 5.51147ZM5.09423 12.161C5.87292 12.612 6.52881 13.2088 7.05618 13.8552C7.42989 14.3132 7.74789 14.8067 8.00506 15.3061C8.45055 14.486 9.06045 13.7766 9.71887 13.2018C10.2251 12.7599 10.7825 12.378 11.3479 12.0765C10.3512 11.5355 9.57088 10.7651 8.97536 9.92589C8.65649 9.47654 8.38841 9.00509 8.16519 8.53351C7.8097 9.51141 7.31415 10.337 6.6785 10.9988C6.21042 11.4863 5.67889 11.8719 5.09423 12.161Z" /> 1021 <path fill-rule="evenodd" clip-rule="evenodd" d="M13.9456 2.03225L14.9369 2C15.0253 2.54673 15.2758 3.32024 15.7617 3.9719C16.239 4.61209 16.934 5.12591 17.9439 5.22202L17.8965 6.21977C17.4621 6.21977 16.7082 6.50104 16.0482 7.04939C15.3978 7.58971 14.9433 8.30173 14.9433 9.07979H13.9433C13.9433 8.66673 13.6926 7.93796 13.1501 7.30519C12.6218 6.68897 11.8648 6.21974 10.8965 6.21977L10.8965 5.21977C11.7947 5.21977 12.4851 4.95822 12.9792 4.46864C13.4787 3.97356 13.8352 3.18812 13.9456 2.03225ZM12.8758 5.77105C13.2799 6.01568 13.6254 6.32313 13.9093 6.65434C14.1106 6.88912 14.2855 7.14113 14.4313 7.39809C14.6948 6.96222 15.0411 6.58596 15.4091 6.2802C15.6682 6.06495 15.9499 5.87478 16.2378 5.71709C15.7099 5.41604 15.2886 5.0103 14.96 4.56967C14.7948 4.34815 14.6524 4.11722 14.5305 3.88496C14.3214 4.39266 14.0391 4.82613 13.6831 5.17894C13.4403 5.41952 13.1698 5.61611 12.8758 5.77105Z" /> 1022 </svg> 1023 ${g("cta.label")} 1024 </button> 1025 ` : null} 1026 </header> 1027 <main ${Ut(d)} aria-live="assertive" aria-atomic="true" aria-relevant="additions" aria-busy=${l === "writing"}> 1028 ${l === "writing" || l === "pending" || l === "success" || l === "success_retry" || l === "error" ? $` 1029 ${l === "pending" ? $` 1030 <div class="loading-skeleton"> 1031 <div class="loading-gradient"></div> 1032 <div class="loading-indicator"></div> 1033 <div class="loading-indicator"></div> 1034 <div class="loading-indicator"></div> 1035 <div class="loading-indicator"></div> 1036 </div> 1037 <div class="sr-only">AI Search is looking for an answerâ¦</div> 1038 ` : null} 1039 ${l === "error" ? $` 1040 <p id=${N}>${g("error.general.label")}</p> 1041 ` : null} 1042 ${l === "writing" || l === "success" || l === "success_retry" ? At(r) : null} 1043 ` : null} 1044 </main> 1045 ${l === "success" || l === "success_retry" ? $` 1046 <footer> 1047 <div id="actions" aria-label="${g("actions.group.label")}"> 1048 <fieldset id="buttons"> 1049 <button type="button" name="copy" aria-label="${g("actions.copy.label")}" @click=${C}> 1050 <svg xmlns="http://www.w3.org/2000/svg" aria-hidden="true" viewBox="0 -960 960 960" fill="currentColor"><path d="M280-240v-640h520v640H280Zm80-80h360v-480H360v480ZM120-80v-640h80v560h440v80H120Zm240-240v-480 480Z"/></svg> 1051 </button> 1052 </fieldset> 1053 <fieldset id="rating" aria-labelledby="legend"> 1054 <button type="button" name="vote" value="1" aria-label="${g("actions.rate.positive.label")}" @click=${p} aria-pressed=${i === 1}> 1055 <svg xmlns="http://www.w3.org/2000/svg" role="img" aria-hidden="true" viewBox="0 -960 960 960" fill="currentColor"><path d="M720-120H280v-520l280-280 50 50q7 7 11.5 19t4.5 23v14l-44 174h258q32 0 56 24t24 56v80q0 7-2 15t-4 15L794-168q-9 20-30 34t-44 14Zm-360-80h360l120-280v-80H480l54-220-174 174v406Zm0-406v406-406Zm-80-34v80H160v360h120v80H80v-520h200Z"/></svg> 1056 </button> 1057 <button type="button" name="vote" value="-1" aria-label="${g("actions.rate.negative.label")}" @click=${p} aria-pressed=${i === -1}> 1058 <svg xmlns="http://www.w3.org/2000/svg" role="img" aria-hidden="true" viewBox="0 -960 960 960" fill="currentColor"><path d="M240-840h440v520L400-40l-50-50q-7-7-11.5-19t-4.5-23v-14l44-174H120q-32 0-56-24t-24-56v-80q0-7 2-15t4-15l120-282q9-20 30-34t44-14Zm360 80H240L120-480v80h360l-54 220 174-174v-406Zm0 406v-406 406Zm80 34v-80h120v-360H680v-80h200v520H680Z"/></svg> 1059 </button> 1060 </fieldset> 1061 </div> 1062 <div class="disclaimer"> 1063 <hr> 1064 <p>${g("disclaimer.general.label")}</p> 1065 </div> 1066 </footer> 1067 ` : null} 1068 </section> 1069 `; 1070}); 1071let rt = b; 1072export { 1073 rt as AiSearch 1074};
Line numbers count LF bytes from the start of the resource, as the search results do. Vendor segments are library code the classifier recognised; they are stored but not indexed. Bytes are shown as Latin1 characters, one per byte.