1import { p as prop, i as if_block, d as bind_this, b as set_class, f as set_style, k as each } from './i18n-CMo5lpzy.js'; 2import { b as active_effect, aW as should_intro, E as EFFECT_TRANSPARENT, aX as BLOCK_EFFECT, aY as EFFECT_RAN, A as effect, z as untrack, aZ as TRANSITION_GLOBAL, a_ as TRANSITION_IN, a$ as TRANSITION_OUT, ac as without_reactive_context, b0 as is_function, O as queue_micro_task, b1 as noop, a as append, f as from_svg, D as DEV, b2 as transition_slide_display, aj as delegate, R as push, y as user_effect, w as get, X as sibling, t as template_effect, a0 as set_text, T as pop, u as state, a5 as user_derived, x as set, V as child, a6 as comment, S as first_child, W as from_html, Y as reset } from './index-BvBk1Iap.js'; 3import { h as html } from './html-CdUEtR5E.js'; 4import './ScrollFade.svelte_svelte_type_style_lang-Xm-PLg9E.js'; 5import { A as Amuchina } from './index-C7e-J7CF.js'; 6 7/** @import { Raf } from '#client' */ 8 9const now = () => performance.now() ; 10 11/** @type {Raf} */ 12const raf = { 13 // don't access requestAnimationFrame eagerly outside method 14 // this allows basic testing of user code without JSDOM 15 // bunder will eval and remove ternary when the user's app is built 16 tick: /** @param {any} _ */ (_) => (requestAnimationFrame )(_), 17 now: () => now(), 18 tasks: new Set() 19}; 20 21/** @import { TaskCallback, Task, TaskEntry } from '#client' */ 22 23// TODO move this into timing.js where it probably belongs 24 25/** 26 * @returns {void} 27 */ 28function run_tasks() { 29 // use `raf.now()` instead of the `requestAnimationFrame` callback argument, because 30 // otherwise things can get wonky https://github.com/sveltejs/svelte/pull/14541 31 const now = raf.now(); 32 33 raf.tasks.forEach((task) => { 34 if (!task.c(now)) { 35 raf.tasks.delete(task); 36 task.f(); 37 } 38 }); 39 40 if (raf.tasks.size !== 0) { 41 raf.tick(run_tasks); 42 } 43} 44 45/** 46 * Creates a new task that runs on each raf frame 47 * until it returns a falsy value or is aborted 48 * @param {TaskCallback} callback 49 * @returns {Task} 50 */ 51function loop(callback) { 52 /** @type {TaskEntry} */ 53 let task; 54 55 if (raf.tasks.size === 0) { 56 raf.tick(run_tasks); 57 } 58 59 return { 60 promise: new Promise((fulfill) => { 61 raf.tasks.add((task = { c: callback, f: fulfill })); 62 }), 63 abort() { 64 raf.tasks.delete(task); 65 } 66 }; 67} 68 69/** @import { AnimateFn, Animation, AnimationConfig, EachItem, Effect, EffectNodes, TransitionFn, TransitionManager } from '#client' */ 70 71/** 72 * @param {Element} element 73 * @param {'introstart' | 'introend' | 'outrostart' | 'outroend'} type 74 * @returns {void} 75 */ 76function dispatch_event(element, type) { 77 without_reactive_context(() => { 78 element.dispatchEvent(new CustomEvent(type)); 79 }); 80} 81 82/** 83 * Converts a property to the camel-case format expected by Element.animate(), KeyframeEffect(), and KeyframeEffect.setKeyframes(). 84 * @param {string} style 85 * @returns {string} 86 */ 87function css_property_to_camelcase(style) { 88 // in compliance with spec 89 if (style === 'float') return 'cssFloat'; 90 if (style === 'offset') return 'cssOffset'; 91 92 // do not rename custom @properties 93 if (style.startsWith('--')) return style; 94 95 const parts = style.split('-'); 96 if (parts.length === 1) return parts[0]; 97 return ( 98 parts[0] + 99 parts 100 .slice(1) 101 .map(/** @param {any} word */ (word) => word[0].toUpperCase() + word.slice(1)) 102 .join('') 103 ); 104} 105 106/** 107 * @param {string} css 108 * @returns {Keyframe} 109 */ 110function css_to_keyframe(css) { 111 /** @type {Keyframe} */ 112 const keyframe = {}; 113 const parts = css.split(';'); 114 for (const part of parts) { 115 const [property, value] = part.split(':'); 116 if (!property || value === undefined) break; 117 118 const formatted_property = css_property_to_camelcase(property.trim()); 119 keyframe[formatted_property] = value.trim(); 120 } 121 return keyframe; 122} 123 124/** @param {number} t */ 125const linear$1 = (t) => t; 126 127/** 128 * Called inside block effects as `$.transition(...)`. This creates a transition manager and 129 * attaches it to the current effect â later, inside `pause_effect` and `resume_effect`, we 130 * use this to create `intro` and `outro` transitions. 131 * @template P 132 * @param {number} flags 133 * @param {HTMLElement} element 134 * @param {() => TransitionFn<P | undefined>} get_fn 135 * @param {(() => P) | null} get_params 136 * @returns {void} 137 */ 138function transition(flags, element, get_fn, get_params) {
139 var is_intro = (flags & TRANSITION_IN) !== 0; 140 var is_outro = (flags & TRANSITION_OUT) !== 0; 141 var is_both = is_intro && is_outro; 142 var is_global = (flags & TRANSITION_GLOBAL) !== 0; 143 144 /** @type {'in' | 'out' | 'both'} */ 145 var direction = is_both ? 'both' : is_intro ? 'in' : 'out'; 146 147 /** @type {AnimationConfig | ((opts: { direction: 'in' | 'out' }) => AnimationConfig) | undefined} */ 148 var current_options; 149 150 var inert = element.inert; 151 152 /** 153 * The default overflow style, stashed so we can revert changes during the transition 154 * that are necessary to work around a Safari <18 bug 155 * TODO 6.0 remove this, if older versions of Safari have died out enough 156 */ 157 var overflow = element.style.overflow; 158 159 /** @type {Animation | undefined} */ 160 var intro; 161 162 /** @type {Animation | undefined} */ 163 var outro; 164 165 function get_options() { 166 return without_reactive_context(() => { 167 // If a transition is still ongoing, we use the existing options rather than generating 168 // new ones. This ensures that reversible transitions reverse smoothly, rather than 169 // jumping to a new spot because (for example) a different `duration` was used 170 return (current_options ??= get_fn()(element, get_params?.() ?? /** @type {P} */ ({}), { 171 direction 172 })); 173 }); 174 } 175 176 /** @type {TransitionManager} */ 177 var transition = { 178 is_global, 179 in() { 180 element.inert = inert; 181 182 if (!is_intro) { 183 outro?.abort(); 184 outro?.reset?.(); 185 return; 186 } 187 188 if (!is_outro) { 189 // if we intro then outro then intro again, we want to abort the first intro, 190 // if it's not a bidirectional transition 191 intro?.abort(); 192 } 193 194 dispatch_event(element, 'introstart'); 195 196 intro = animate(element, get_options(), outro, 1, () => { 197 dispatch_event(element, 'introend'); 198 199 // Ensure we cancel the animation to prevent leaking 200 intro?.abort(); 201 intro = current_options = undefined; 202 203 element.style.overflow = overflow; 204 }); 205 }, 206 out(fn) { 207 if (!is_outro) { 208 fn?.(); 209 current_options = undefined; 210 return; 211 } 212 213 element.inert = true; 214 215 dispatch_event(element, 'outrostart'); 216 217 outro = animate(element, get_options(), intro, 0, () => { 218 dispatch_event(element, 'outroend'); 219 fn?.(); 220 }); 221 }, 222 stop: () => { 223 intro?.abort(); 224 outro?.abort(); 225 } 226 }; 227 228 var e = /** @type {Effect & { nodes: EffectNodes }} */ (active_effect); 229 230 (e.nodes.t ??= []).push(transition); 231 232 // if this is a local transition, we only want to run it if the parent (branch) effect's 233 // parent (block) effect is where the state change happened. we can determine that by 234 // looking at whether the block effect is currently initializing 235 if (is_intro && should_intro) { 236 var run = is_global; 237 238 if (!run) { 239 var block = /** @type {Effect | null} */ (e.parent); 240 241 // skip over transparent blocks (e.g. snippets, else-if blocks) 242 while (block && (block.f & EFFECT_TRANSPARENT) !== 0) { 243 while ((block = block.parent)) { 244 if ((block.f & BLOCK_EFFECT) !== 0) break; 245 } 246 } 247 248 run = !block || (block.f & EFFECT_RAN) !== 0; 249 } 250 251 if (run) { 252 effect(() => { 253 untrack(() => transition.in()); 254 }); 255 } 256 } 257} 258 259/** 260 * Animates an element, according to the provided configuration 261 * @param {Element} element 262 * @param {AnimationConfig | ((opts: { direction: 'in' | 'out' }) => AnimationConfig)} options 263 * @param {Animation | undefined} counterpart The corresponding intro/outro to this outro/intro 264 * @param {number} t2 The target `t` value â `1` for intro, `0` for outro 265 * @param {(() => void)} on_finish Called after successfully completing the animation 266 * @returns {Animation} 267 */ 268function animate(element, options, counterpart, t2, on_finish) { 269 var is_intro = t2 === 1; 270 271 if (is_function(options)) { 272 // In the case of a deferred transition (such as `crossfade`), `option` will be 273 // a function rather than an `AnimationConfig`. We need to call this function 274 // once the DOM has been updated... 275 /** @type {Animation} */ 276 var a; 277 var aborted = false; 278 279 queue_micro_task(() => { 280 if (aborted) return; 281 var o = options({ direction: is_intro ? 'in' : 'out' }); 282 a = animate(element, o, counterpart, t2, on_finish); 283 }); 284 285 // ...but we want to do so without using `async`/`await` everywhere, so 286 // we return a facade that allows everything to remain synchronous 287 return { 288 abort: () => { 289 aborted = true; 290 a?.abort(); 291 }, 292 deactivate: () => a.deactivate(), 293 reset: () => a.reset(), 294 t: () => a.t() 295 }; 296 } 297 298 counterpart?.deactivate(); 299 300 if (!options?.duration) { 301 on_finish(); 302 303 return { 304 abort: noop, 305 deactivate: noop, 306 reset: noop, 307 t: () => t2 308 }; 309 } 310
311 const { delay = 0, css, tick, easing = linear$1 } = options; 312 313 var keyframes = []; 314 315 if (is_intro && counterpart === undefined) { 316 if (tick) { 317 tick(0, 1); // TODO put in nested effect, to avoid interleaved reads/writes? 318 } 319 320 if (css) { 321 var styles = css_to_keyframe(css(0, 1)); 322 keyframes.push(styles, styles); 323 } 324 } 325 326 var get_t = () => 1 - t2; 327 328 // create a dummy animation that lasts as long as the delay (but with whatever devtools 329 // multiplier is in effect). in the common case that it is `0`, we keep it anyway so that 330 // the CSS keyframes aren't created until the DOM is updated 331 // 332 // fill forwards to prevent the element from rendering without styles applied 333 // see https://github.com/sveltejs/svelte/issues/14732 334 var animation = element.animate(keyframes, { duration: delay, fill: 'forwards' }); 335 336 animation.onfinish = () => { 337 // remove dummy animation from the stack to prevent conflict with main animation 338 animation.cancel(); 339 340 // for bidirectional transitions, we start from the current position, 341 // rather than doing a full intro/outro 342 var t1 = counterpart?.t() ?? 1 - t2; 343 counterpart?.abort(); 344 345 var delta = t2 - t1; 346 var duration = /** @type {number} */ (options.duration) * Math.abs(delta); 347 var keyframes = []; 348 349 if (duration > 0) { 350 /** 351 * Whether or not the CSS includes `overflow: hidden`, in which case we need to 352 * add it as an inline style to work around a Safari <18 bug 353 * TODO 6.0 remove this, if possible 354 */ 355 var needs_overflow_hidden = false; 356 357 if (css) { 358 var n = Math.ceil(duration / (1000 / 60)); // `n` must be an integer, or we risk missing the `t2` value 359 360 for (var i = 0; i <= n; i += 1) { 361 var t = t1 + delta * easing(i / n); 362 var styles = css_to_keyframe(css(t, 1 - t)); 363 keyframes.push(styles); 364 365 needs_overflow_hidden ||= styles.overflow === 'hidden'; 366 } 367 } 368 369 if (needs_overflow_hidden) { 370 /** @type {HTMLElement} */ (element).style.overflow = 'hidden'; 371 } 372 373 get_t = () => { 374 var time = /** @type {number} */ ( 375 /** @type {globalThis.Animation} */ (animation).currentTime 376 ); 377 378 return t1 + delta * easing(time / duration); 379 }; 380 381 if (tick) { 382 loop(() => { 383 if (animation.playState !== 'running') return false; 384 385 var t = get_t(); 386 tick(t, 1 - t); 387 388 return true; 389 }); 390 } 391 } 392 393 animation = element.animate(keyframes, { duration, fill: 'forwards' }); 394 395 animation.onfinish = () => { 396 get_t = () => t2; 397 tick?.(t2, 1 - t2); 398 on_finish(); 399 }; 400 }; 401 402 return { 403 abort: () => { 404 if (animation) { 405 animation.cancel(); 406 // This prevents memory leaks in Chromium 407 animation.effect = null; 408 // This prevents onfinish to be launched after cancel(), 409 // which can happen in some rare cases 410 // see https://github.com/sveltejs/svelte/issues/13681 411 animation.onfinish = noop; 412 } 413 }, 414 deactivate: () => { 415 on_finish = noop; 416 }, 417 reset: () => { 418 if (t2 === 0) { 419 tick?.(1, 0); 420 } 421 }, 422 t: () => get_t() 423 }; 424} 425 426var root$5 = from_svg(`<svg xmlns="http://www.w3.org/2000/svg" width="100%" height="100%" viewBox="0 0 16 16" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round"><path d="M4 6L8 10L12 6"></path></svg>`); 427 428function ChevronDown($$anchor) { 429 var svg = root$5(); 430 431 append($$anchor, svg); 432} 433 434var root$4 = from_svg(`<svg fill="none" stroke="currentColor" viewBox="0 0 24 24" width="100%" height="100%" xmlns="http://www.w3.org/2000/svg" aria-hidden="true" stroke-width="2" stroke-linecap="round" stroke-linejoin="round"><path stroke-linecap="round" stroke-linejoin="round" d="M12 9v3.75m9-.75a9 9 0 11-18 0 9 9 0 0118 0zm-9 3.75h.008v.008H12v-.008z"></path></svg>`); 435 436function Error($$anchor) { 437 var svg = root$4(); 438 439 append($$anchor, svg); 440} 441 442var root$3 = from_svg(`<svg fill="none" stroke="currentColor" viewBox="0 0 24 24" width="100%" height="100%" xmlns="http://www.w3.org/2000/svg" aria-hidden="true" stroke-width="2" stroke-linecap="round" stroke-linejoin="round"><path stroke-linecap="round" stroke-linejoin="round" d="M11.25 11.25l.041-.02a.75.75 0 011.063.852l-.708 2.836a.75.75 0 001.063.853l.041-.021M21 12a9 9 0 11-18 0 9 9 0 0118 0zm-9-3.75h.008v.008H12V8.25z"></path></svg>`); 443 444function Info($$anchor) { 445 var svg = root$3(); 446 447 append($$anchor, svg); 448} 449 450var root$2 = from_svg(`<svg fill="none" stroke="currentColor" viewBox="0 0 24 24" width="100%" height="100%" xmlns="http://www.w3.org/2000/svg" aria-hidden="true" stroke-width="2" stroke-linecap="round" stroke-linejoin="round"><path stroke-linecap="round" stroke-linejoin="round" d="M9 12.75L11.25 15 15 9.75M21 12a9 9 0 11-18 0 9 9 0 0118 0z"></path></svg>`); 451 452function Success($$anchor) { 453 var svg = root$2(); 454 455 append($$anchor, svg); 456} 457 458var root$1 = from_svg(`<svg fill="none" stroke="currentColor" stroke-width="2" viewBox="0 0 24 24" width="100%" height="100%" xmlns="http://www.w3.org/2000/svg" aria-hidden="true" stroke-linecap="round" stroke-linejoin="round"><path stroke-linecap="round" stroke-linejoin="round" d="M12 9v3.75m-9.303 3.376c-.866 1.5.217 3.374 1.948 3.374h14.71c1.73 0 2.813-1.874 1.948-3.374L13.949 3.378c-.866-1.5-3.032-1.5-3.898 0L2.697 16.126zM12 15.75h.007v.008H12v-.008z"></path></svg>`); 459 460function Warning($$anchor) { 461 var svg = root$1(); 462 463 append($$anchor, svg); 464} 465 466const is_external_url = (link, root = location.href) => { 467 try { 468 return !!link && new URL(link).origin !== new URL(root).origin; 469 } catch (e) { 470 return false;
471 } 472}; 473function sanitize(source) { 474 const amuchina = new Amuchina(); 475 const node = new DOMParser().parseFromString(source, "text/html"); 476 walk_nodes(node.body, "A", (node2) => { 477 if (node2 instanceof HTMLElement && "target" in node2) { 478 if (is_external_url(node2.getAttribute("href"), location.href)) { 479 node2.setAttribute("target", "_blank"); 480 node2.setAttribute("rel", "noopener noreferrer"); 481 } 482 } 483 }); 484 return amuchina.sanitize(node).body.innerHTML; 485} 486function walk_nodes(node, test, callback) { 487 if (node && (node.nodeName === test || typeof test === "function")) { 488 callback(node); 489 } 490 const children = node?.childNodes || []; 491 for (let i = 0; i < children.length; i++) { 492 walk_nodes(children[i], test, callback); 493 } 494} 495 496/** @import { BlurParams, CrossfadeParams, DrawParams, FadeParams, FlyParams, ScaleParams, SlideParams, TransitionConfig } from './public' */ 497 498 499/** @param {number} x */ 500const linear = (x) => x; 501 502/** @param {number} t */ 503function cubic_out(t) { 504 const f = t - 1.0; 505 return f * f * f + 1.0; 506} 507 508/** @param {number | string} value 509 * @returns {[number, string]} 510 */ 511function split_css_unit(value) { 512 const split = typeof value === 'string' && value.match(/^\s*(-?[\d.]+)([^\s]*)\s*$/); 513 return split ? [parseFloat(split[1]), split[2] || 'px'] : [/** @type {number} */ (value), 'px']; 514} 515 516/** 517 * Animates the opacity of an element from 0 to the current opacity for `in` transitions and from the current opacity to 0 for `out` transitions. 518 * 519 * @param {Element} node 520 * @param {FadeParams} [params] 521 * @returns {TransitionConfig} 522 */ 523function fade(node, { delay = 0, duration = 400, easing = linear } = {}) { 524 const o = +getComputedStyle(node).opacity; 525 return { 526 delay, 527 duration, 528 easing, 529 css: (t) => `opacity: ${t * o}` 530 }; 531} 532 533/** 534 * Animates the x and y positions and the opacity of an element. `in` transitions animate from the provided values, passed as parameters to the element's default values. `out` transitions animate from the element's default values to the provided values. 535 * 536 * @param {Element} node 537 * @param {FlyParams} [params] 538 * @returns {TransitionConfig} 539 */ 540function fly( 541 node, 542 { delay = 0, duration = 400, easing = cubic_out, x = 0, y = 0, opacity = 0 } = {} 543) { 544 const style = getComputedStyle(node); 545 const target_opacity = +style.opacity; 546 const transform = style.transform === 'none' ? '' : style.transform; 547 const od = target_opacity * (1 - opacity); 548 const [x_value, x_unit] = split_css_unit(x); 549 const [y_value, y_unit] = split_css_unit(y); 550 return { 551 delay, 552 duration, 553 easing, 554 css: (t, u) => ` 555 transform: ${transform} translate(${(1 - t) * x_value}${x_unit}, ${(1 - t) * y_value}${y_unit}); 556 opacity: ${target_opacity - od * u}` 557 }; 558} 559 560var slide_warning = false; 561 562/** 563 * Slides an element in and out. 564 * 565 * @param {Element} node 566 * @param {SlideParams} [params] 567 * @returns {TransitionConfig} 568 */ 569function slide(node, { delay = 0, duration = 400, easing = cubic_out, axis = 'y' } = {}) { 570 const style = getComputedStyle(node); 571 572 if (DEV && !slide_warning && /(contents|inline|table)/.test(style.display)) { 573 slide_warning = true; 574 Promise.resolve().then(() => (slide_warning = false)); 575 transition_slide_display(style.display); 576 } 577 578 const opacity = +style.opacity; 579 const primary_property = axis === 'y' ? 'height' : 'width'; 580 const primary_property_value = parseFloat(style[primary_property]); 581 const secondary_properties = axis === 'y' ? ['top', 'bottom'] : ['left', 'right']; 582 const capitalized_secondary_properties = secondary_properties.map( 583 (e) => /** @type {'Left' | 'Right' | 'Top' | 'Bottom'} */ (`${e[0].toUpperCase()}${e.slice(1)}`) 584 ); 585 const padding_start_value = parseFloat(style[`padding${capitalized_secondary_properties[0]}`]); 586 const padding_end_value = parseFloat(style[`padding${capitalized_secondary_properties[1]}`]); 587 const margin_start_value = parseFloat(style[`margin${capitalized_secondary_properties[0]}`]); 588 const margin_end_value = parseFloat(style[`margin${capitalized_secondary_properties[1]}`]); 589 const border_width_start_value = parseFloat( 590 style[`border${capitalized_secondary_properties[0]}Width`] 591 ); 592 const border_width_end_value = parseFloat( 593 style[`border${capitalized_secondary_properties[1]}Width`] 594 ); 595 return { 596 delay, 597 duration, 598 easing,
599 css: (t) => 600 'overflow: hidden;' + 601 `opacity: ${Math.min(t * 20, 1) * opacity};` + 602 `${primary_property}: ${t * primary_property_value}px;` + 603 `padding-${secondary_properties[0]}: ${t * padding_start_value}px;` + 604 `padding-${secondary_properties[1]}: ${t * padding_end_value}px;` + 605 `margin-${secondary_properties[0]}: ${t * margin_start_value}px;` + 606 `margin-${secondary_properties[1]}: ${t * margin_end_value}px;` + 607 `border-${secondary_properties[0]}-width: ${t * border_width_start_value}px;` + 608 `border-${secondary_properties[1]}-width: ${t * border_width_end_value}px;` + 609 `min-${primary_property}: 0` 610 }; 611} 612 613var root_8 = from_html(`<span class="toast-count svelte-irmu64"> </span>`); 614var root_11 = from_html(`<div class="toast-separator svelte-irmu64"></div>`); 615var root_10 = from_html(`<div><div data-testid="toast-text"><!></div></div> <!>`, 1); 616var root_9 = from_html(`<div class="toast-messages svelte-irmu64"></div>`); 617var root_12 = from_html(`<div></div>`); 618var root = from_html(`<div role="status" aria-live="polite" data-testid="toast-body"><div class="toast-header svelte-irmu64" role="button" tabindex="0"><div><!></div> <div class="toast-title-row svelte-irmu64"><span> <!></span> <div><!></div></div> <button type="button" aria-label="Close" data-testid="toast-close"><span aria-hidden="true">×</span></button></div> <!> <!></div>`); 619 620function ToastContent($$anchor, $$props) { 621 push($$props, true); 622 623 let messages = prop($$props, 'messages', 19, () => []), 624 expanded = prop($$props, 'expanded', 3, true); 625 626 let touch_start_x = state(0); 627 let touch_start_y = state(0); 628 let offset_x = state(0); 629 let is_dragging = state(false); 630 let toast_element; 631 632 const default_messages = { 633 error: "An error occurred.", 634 warning: "Warning.", 635 success: "Success.", 636 info: "Info." 637 }; 638 639 let count = user_derived(() => messages().length); 640 let first_message = user_derived(() => messages()[0]); 641 let type_label = user_derived(() => $$props.type.charAt(0).toUpperCase() + $$props.type.slice(1)); 642 let has_duration = user_derived(() => get(first_message)?.duration !== null); 643 let timer_duration = user_derived(() => get(has_duration) ? `${get(first_message).duration}s` : "0s"); 644 645 function handle_toggle() { 646 $$props.ontoggle?.(); 647 } 648 649 function close_all() {
650 messages().forEach((msg) => { 651 $$props.onclose?.(msg.id); 652 }); 653 } 654 655 function handle_touch_start(e) { 656 set(touch_start_x, e.touches[0].clientX, true); 657 set(touch_start_y, e.touches[0].clientY, true); 658 set(is_dragging, true); 659 } 660 661 function handle_touch_move(e) { 662 if (!get(is_dragging)) return; 663 664 const touch_x = e.touches[0].clientX; 665 const touch_y = e.touches[0].clientY; 666 const delta_x = touch_x - get(touch_start_x); 667 const delta_y = touch_y - get(touch_start_y); 668 669 if (Math.abs(delta_x) > Math.abs(delta_y) && Math.abs(delta_x) > 10) { 670 e.preventDefault(); 671 set(offset_x, delta_x); 672 } 673 } 674 675 function handle_touch_end() { 676 if (!get(is_dragging)) return; 677 678 if (Math.abs(get(offset_x)) > 100) { 679 close_all(); 680 } else { 681 set(offset_x, 0); 682 } 683 684 set(is_dragging, false); 685 } 686 687 user_effect(() => { 688 if (get(has_duration) && messages().length === 1) { 689 setTimeout(close_all, get(first_message).duration * 1000); 690 } 691 }); 692 693 var div = root(); 694 695 div.__touchstart = handle_touch_start; 696 div.__touchmove = handle_touch_move; 697 div.__touchend = handle_touch_end; 698 699 var div_1 = child(div); 700 701 div_1.__click = handle_toggle; 702 703 div_1.__keydown = (e) => { 704 if (e.key === "Enter" || e.key === " ") { 705 handle_toggle(); 706 } 707 }; 708 709 var div_2 = child(div_1); 710 var node = child(div_2); 711 712 { 713 var consequent = ($$anchor) => { 714 Warning($$anchor); 715 }; 716 717 var alternate_2 = ($$anchor) => { 718 var fragment_1 = comment(); 719 var node_1 = first_child(fragment_1); 720 721 { 722 var consequent_1 = ($$anchor) => { 723 Info($$anchor); 724 }; 725 726 var alternate_1 = ($$anchor) => { 727 var fragment_3 = comment(); 728 var node_2 = first_child(fragment_3); 729 730 { 731 var consequent_2 = ($$anchor) => { 732 Success($$anchor); 733 }; 734 735 var alternate = ($$anchor) => { 736 var fragment_5 = comment(); 737 var node_3 = first_child(fragment_5); 738 739 { 740 var consequent_3 = ($$anchor) => { 741 Error($$anchor); 742 }; 743 744 if_block( 745 node_3, 746 ($$render) => { 747 if ($$props.type === "error") $$render(consequent_3); 748 }, 749 true 750 ); 751 } 752 753 append($$anchor, fragment_5); 754 }; 755 756 if_block( 757 node_2, 758 ($$render) => { 759 if ($$props.type === "success") $$render(consequent_2); else $$render(alternate, false); 760 }, 761 true 762 ); 763 } 764 765 append($$anchor, fragment_3); 766 }; 767 768 if_block( 769 node_1, 770 ($$render) => { 771 if ($$props.type === "info") $$render(consequent_1); else $$render(alternate_1, false); 772 }, 773 true 774 ); 775 } 776 777 append($$anchor, fragment_1); 778 }; 779 780 if_block(node, ($$render) => { 781 if ($$props.type === "warning") $$render(consequent); else $$render(alternate_2, false); 782 }); 783 } 784 785 reset(div_2); 786 787 var div_3 = sibling(div_2, 2); 788 var span = child(div_3); 789 var text = child(span); 790 var node_4 = sibling(text); 791 792 { 793 var consequent_4 = ($$anchor) => { 794 var span_1 = root_8(); 795 var text_1 = child(span_1); 796 797 reset(span_1); 798 template_effect(() => set_text(text_1, `(${get(count) ?? ''})`)); 799 append($$anchor, span_1); 800 }; 801 802 if_block(node_4, ($$render) => { 803 if (get(count) > 1) $$render(consequent_4); 804 }); 805 } 806 807 reset(span); 808 809 var div_4 = sibling(span, 2); 810 let classes; 811 var node_5 = child(div_4); 812 813 ChevronDown(node_5); 814 reset(div_4); 815 reset(div_3); 816 817 var button = sibling(div_3, 2); 818 819 button.__click = (e) => { 820 e.stopPropagation(); 821 close_all(); 822 }; 823 824 reset(div_1); 825 826 var node_6 = sibling(div_1, 2); 827 828 { 829 var consequent_6 = ($$anchor) => { 830 var div_5 = root_9(); 831 832 each(div_5, 23, messages, (message) => message.id, ($$anchor, message, i) => { 833 var fragment_7 = root_10(); 834 var div_6 = first_child(fragment_7); 835 var div_7 = child(div_6); 836 var node_7 = child(div_7); 837 838 html(node_7, () => sanitize(get(message).message || default_messages[$$props.type])); 839 reset(div_7); 840 reset(div_6); 841 842 var node_8 = sibling(div_6, 2); 843 844 { 845 var consequent_5 = ($$anchor) => { 846 var div_8 = root_11(); 847 848 append($$anchor, div_8); 849 }; 850 851 if_block(node_8, ($$render) => { 852 if (get(i) < messages().length - 1) $$render(consequent_5); 853 }); 854 } 855 856 template_effect(() => { 857 set_class(div_6, 1, `toast-message-item ${$$props.type ?? ''}`, 'svelte-irmu64'); 858 set_class(div_7, 1, `toast-message-text ${$$props.type ?? ''}`, 'svelte-irmu64'); 859 }); 860 861 append($$anchor, fragment_7); 862 }); 863 864 reset(div_5); 865 transition(3, div_5, () => slide, () => ({ duration: 200 })); 866 append($$anchor, div_5); 867 }; 868 869 if_block(node_6, ($$render) => { 870 if (expanded()) $$render(consequent_6); 871 }); 872 } 873 874 var node_9 = sibling(node_6, 2); 875 876 { 877 var consequent_7 = ($$anchor) => { 878 var div_9 = root_12(); 879 880 template_effect(() => { 881 set_class(div_9, 1, `timer ${$$props.type ?? ''}`, 'svelte-irmu64'); 882 set_style(div_9, `animation-duration: ${get(timer_duration) ?? ''}`); 883 }); 884 885 append($$anchor, div_9); 886 }; 887 888 if_block(node_9, ($$render) => { 889 if (get(has_duration)) $$render(consequent_7); 890 }); 891 } 892 893 reset(div); 894 bind_this(div, ($$value) => toast_element = $$value, () => toast_element); 895 896 template_effect( 897 ($0) => { 898 set_class(div, 1, `toast-body ${$$props.type ?? ''}`, 'svelte-irmu64'); 899 set_style(div, `transform: translateX(${get(offset_x) ?? ''}px); opacity: ${$0 ?? ''};`); 900 set_class(div_2, 1, `toast-icon ${$$props.type ?? ''}`, 'svelte-irmu64'); 901 set_class(span, 1, `toast-title ${$$props.type ?? ''}`, 'svelte-irmu64'); 902 set_text(text, `${get(type_label) ?? ''} `); 903 classes = set_class(div_4, 1, 'chevron svelte-irmu64', null, classes, { expanded: expanded(), visible: get(count) > 0 }); 904 set_class(button, 1, `toast-close ${$$props.type ?? ''}`, 'svelte-irmu64'); 905 }, 906 [() => 1 - Math.abs(get(offset_x)) / 300] 907 ); 908 909 transition(1, div, () => fade, () => ({ duration: 200, delay: 100 })); 910 transition(2, div, () => fade, () => ({ duration: 200 })); 911 append($$anchor, div); 912 pop(); 913} 914 915delegate(['touchstart', 'touchmove', 'touchend', 'click', 'keydown']); 916 917export { ToastContent as T, fly as a, fade as f, loop as l, raf as r, slide as s, transition as t }; 918//# sourceMappingURL=StreamingBar.svelte_svelte_type_style_lang-CdFIGsJa.js.map
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.