1import { 2 environment 3} from "./chunk-2WSU6ASU.js"; 4import { 5 ANIMATION_MODULE_TYPE, 6 API_RESERVATION_URL, 7 API_URL, 8 ASSISTANTS_URL, 9 AUTO_STYLE, 10 AnimationGroupPlayer, 11 AnimationMetadataType, 12 BrowserModule, 13 Component, 14 DOCUMENT, 15 DomRendererFactory2, 16 FirebaseApp, 17 HttpClient, 18 Inject, 19 Injectable, 20 MENU_UPLOADER_URL, 21 NgModule, 22 NgZone, 23 NoopAnimationPlayer, 24 OnboardingStore, 25 RendererFactory2, 26 RouterModule, 27 RouterOutlet, 28 RuntimeError, 29 TranslateLoader, 30 TranslateModule, 31 TranslateService, 32 __objRest, 33 __spreadValues, 34 bootstrapApplication, 35 effect, 36 getActualLan, 37 getAuth, 38 getDatabase, 39 getFirestore, 40 getStorage, 41 importProvidersFrom, 42 initializeApp, 43 inject, 44 languagesStore, 45 performanceMarkFeature, 46 provideAuth, 47 provideDatabase, 48 provideFirebaseApp, 49 provideFirestore, 50 provideHttpClient, 51 provideRouter, 52 provideStorage, 53 provideStore, 54 provideZoneChangeDetection, 55 sequence, 56 setClassMetadata, 57 style, 58 ɵPRE_STYLE, 59 ɵsetClassDebugInfo, 60 ɵɵdefineComponent, 61 ɵɵdefineInjectable, 62 ɵɵdefineInjector, 63 ɵɵdefineNgModule, 64 ɵɵelement, 65 ɵɵinject 66} from "./chunk-5ZP4VOAA.js"; 67
68// apps/onboarding-ai/src/app/app.component.ts 69var AppComponent = class _AppComponent { 70 store = inject(OnboardingStore); 71 languageStore = inject(languagesStore); 72 translateService = inject(TranslateService); 73 title = "onboarding-ai"; 74 constructor() { 75 effect(() => { 76 const actualLanguage = this.languageStore.actualLanguage(); 77 if (actualLanguage) { 78 localStorage.setItem("lan", actualLanguage.prefix); 79 const formattedLang = actualLanguage?.prefix.replace("-", "_"); 80 this.translateService.use(formattedLang); 81 } 82 }); 83 effect(() => { 84 const fullData = this.store.fullData(); 85 if (fullData) { 86 localStorage.setItem("onboarding-data", JSON.stringify(fullData)); 87 } 88 }); 89 } 90 static \u0275fac = function AppComponent_Factory(__ngFactoryType__) { 91 return new (__ngFactoryType__ || _AppComponent)(); 92 }; 93 static \u0275cmp = /* @__PURE__ */ \u0275\u0275defineComponent({ type: _AppComponent, selectors: [["ctr-root"]], decls: 1, vars: 0, template: function AppComponent_Template(rf, ctx) { 94 if (rf & 1) { 95 \u0275\u0275element(0, "router-outlet"); 96 } 97 }, dependencies: [RouterModule, RouterOutlet], encapsulation: 2 }); 98}; 99(() => { 100 (typeof ngDevMode === "undefined" || ngDevMode) && setClassMetadata(AppComponent, [{ 101 type: Component, 102 args: [{ imports: [RouterModule], selector: "ctr-root", template: "<router-outlet></router-outlet>\n" }] 103 }], () => [], null); 104})(); 105(() => { 106 (typeof ngDevMode === "undefined" || ngDevMode) && \u0275setClassDebugInfo(AppComponent, { className: "AppComponent", filePath: "apps/onboarding-ai/src/app/app.component.ts", lineNumber: 14 }); 107})(); 108
vendor: 20,824 bytes, lines 109-751
109// node_modules/@angular/animations/fesm2022/util.mjs 110var LINE_START = "\n - "; 111function invalidTimingValue(exp) { 112 return new RuntimeError(3e3, ngDevMode && `The provided timing value "${exp}" is invalid.`); 113} 114function negativeStepValue() { 115 return new RuntimeError(3100, ngDevMode && "Duration values below 0 are not allowed for this animation step."); 116} 117function negativeDelayValue() { 118 return new RuntimeError(3101, ngDevMode && "Delay values below 0 are not allowed for this animation step."); 119} 120function invalidStyleParams(varName) { 121 return new RuntimeError(3001, ngDevMode && `Unable to resolve the local animation param ${varName} in the given list of values`); 122} 123function invalidParamValue(varName) { 124 return new RuntimeError(3003, ngDevMode && `Please provide a value for the animation param ${varName}`); 125} 126function invalidNodeType(nodeType) { 127 return new RuntimeError(3004, ngDevMode && `Unable to resolve animation metadata node #${nodeType}`); 128} 129function invalidCssUnitValue(userProvidedProperty, value) { 130 return new RuntimeError(3005, ngDevMode && `Please provide a CSS unit value for ${userProvidedProperty}:${value}`); 131} 132function invalidTrigger() { 133 return new RuntimeError(3006, ngDevMode && "animation triggers cannot be prefixed with an `@` sign (e.g. trigger('@foo', [...]))"); 134} 135function invalidDefinition() { 136 return new RuntimeError(3007, ngDevMode && "only state() and transition() definitions can sit inside of a trigger()"); 137} 138function invalidState(metadataName, missingSubs) { 139 return new RuntimeError(3008, ngDevMode && `state("${metadataName}", ...) must define default values for all the following style substitutions: ${missingSubs.join(", ")}`); 140} 141function invalidStyleValue(value) { 142 return new RuntimeError(3002, ngDevMode && `The provided style string value ${value} is not allowed.`); 143} 144function invalidParallelAnimation(prop, firstStart, firstEnd, secondStart, secondEnd) { 145 return new RuntimeError(3010, ngDevMode && `The CSS property "${prop}" that exists between the times of "${firstStart}ms" and "${firstEnd}ms" is also being animated in a parallel animation between the times of "${secondStart}ms" and "${secondEnd}ms"`); 146} 147function invalidKeyframes() { 148 return new RuntimeError(3011, ngDevMode && `keyframes() must be placed inside of a call to animate()`); 149} 150function invalidOffset() { 151 return new RuntimeError(3012, ngDevMode && `Please ensure that all keyframe offsets are between 0 and 1`); 152} 153function keyframeOffsetsOutOfOrder() { 154 return new RuntimeError(3200, ngDevMode && `Please ensure that all keyframe offsets are in order`); 155} 156function keyframesMissingOffsets() { 157 return new RuntimeError(3202, ngDevMode && `Not all style() steps within the declared keyframes() contain offsets`); 158} 159function invalidStagger() { 160 return new RuntimeError(3013, ngDevMode && `stagger() can only be used inside of query()`); 161} 162function invalidQuery(selector) { 163 return new RuntimeError(3014, ngDevMode && `\`query("${selector}")\` returned zero elements. (Use \`query("${selector}", { optional: true })\` if you wish to allow this.)`); 164} 165function invalidExpression(expr) { 166 return new RuntimeError(3015, ngDevMode && `The provided transition expression "${expr}" is not supported`); 167} 168function invalidTransitionAlias(alias) { 169 return new RuntimeError(3016, ngDevMode && `The transition alias value "${alias}" is not supported`); 170} 171function triggerBuildFailed(name, errors) { 172 return new RuntimeError(3404, ngDevMode && `The animation trigger "${name}" has failed to build due to the following errors: 173 - ${errors.map((err) => err.message).join("\n - ")}`); 174} 175function animationFailed(errors) { 176 return new RuntimeError(3502, ngDevMode && `Unable to animate due to the following errors:${LINE_START}${errors.map((err) => err.message).join(LINE_START)}`); 177} 178function registerFailed(errors) { 179 return new RuntimeError(3503, ngDevMode && `Unable to build the animation due to the following errors: ${errors.map((err) => err.message).join("\n")}`); 180} 181function missingOrDestroyedAnimation() { 182 return new RuntimeError(3300, ngDevMode && "The requested animation doesn't exist or has already been destroyed"); 183} 184function createAnimationFailed(errors) { 185 return new RuntimeError(3504, ngDevMode && `Unable to create the animation due to the following errors:${errors.map((err) => err.message).join("\n")}`); 186} 187function missingPlayer(id) { 188 return new RuntimeError(3301, ngDevMode && `Unable to find the timeline player referenced by ${id}`); 189} 190function missingTrigger(phase, name) { 191 return new RuntimeError(3302, ngDevMode && `Unable to listen on the animation trigger event "${phase}" because the animation trigger "${name}" doesn't exist!`); 192} 193function missingEvent(name) { 194 return new RuntimeError(3303, ngDevMode && `Unable to listen on the animation trigger "${name}" because the provided event is undefined!`); 195} 196function unsupportedTriggerEvent(phase, name) { 197 return new RuntimeError(3400, ngDevMode && `The provided animation trigger event "${phase}" for the animation trigger "${name}" is not supported!`); 198} 199function unregisteredTrigger(name) { 200 return new RuntimeError(3401, ngDevMode && `The provided animation trigger "${name}" has not been registered!`); 201} 202function triggerTransitionsFailed(errors) { 203 return new RuntimeError(3402, ngDevMode && `Unable to process animations due to the following failed trigger transitions 204 ${errors.map((err) => err.message).join("\n")}`); 205} 206function transitionFailed(name, errors) { 207 return new RuntimeError(3505, ngDevMode && `@${name} has failed due to: 208 ${errors.map((err) => err.message).join("\n- ")}`); 209} 210var ANIMATABLE_PROP_SET = /* @__PURE__ */ new Set([ 211 "-moz-outline-radius", 212 "-moz-outline-radius-bottomleft", 213 "-moz-outline-radius-bottomright", 214 "-moz-outline-radius-topleft", 215 "-moz-outline-radius-topright", 216 "-ms-grid-columns", 217 "-ms-grid-rows", 218 "-webkit-line-clamp", 219 "-webkit-text-fill-color", 220 "-webkit-text-stroke", 221 "-webkit-text-stroke-color", 222 "accent-color", 223 "all", 224 "backdrop-filter", 225 "background", 226 "background-color", 227 "background-position", 228 "background-size", 229 "block-size", 230 "border", 231 "border-block-end", 232 "border-block-end-color", 233 "border-block-end-width", 234 "border-block-start", 235 "border-block-start-color", 236 "border-block-start-width", 237 "border-bottom", 238 "border-bottom-color", 239 "border-bottom-left-radius", 240 "border-bottom-right-radius", 241 "border-bottom-width", 242 "border-color", 243 "border-end-end-radius", 244 "border-end-start-radius", 245 "border-image-outset", 246 "border-image-slice", 247 "border-image-width", 248 "border-inline-end", 249 "border-inline-end-color", 250 "border-inline-end-width", 251 "border-inline-start", 252 "border-inline-start-color", 253 "border-inline-start-width", 254 "border-left", 255 "border-left-color", 256 "border-left-width", 257 "border-radius", 258 "border-right", 259 "border-right-color", 260 "border-right-width", 261 "border-start-end-radius", 262 "border-start-start-radius", 263 "border-top", 264 "border-top-color", 265 "border-top-left-radius", 266 "border-top-right-radius", 267 "border-top-width", 268 "border-width", 269 "bottom", 270 "box-shadow", 271 "caret-color", 272 "clip", 273 "clip-path", 274 "color", 275 "column-count", 276 "column-gap", 277 "column-rule", 278 "column-rule-color", 279 "column-rule-width", 280 "column-width", 281 "columns", 282 "filter", 283 "flex", 284 "flex-basis", 285 "flex-grow", 286 "flex-shrink", 287 "font", 288 "font-size", 289 "font-size-adjust", 290 "font-stretch", 291 "font-variation-settings", 292 "font-weight", 293 "gap", 294 "grid-column-gap", 295 "grid-gap", 296 "grid-row-gap", 297 "grid-template-columns", 298 "grid-template-rows", 299 "height", 300 "inline-size", 301 "input-security", 302 "inset", 303 "inset-block", 304 "inset-block-end", 305 "inset-block-start", 306 "inset-inline", 307 "inset-inline-end", 308 "inset-inline-start", 309 "left", 310 "letter-spacing", 311 "line-clamp", 312 "line-height", 313 "margin", 314 "margin-block-end", 315 "margin-block-start", 316 "margin-bottom", 317 "margin-inline-end", 318 "margin-inline-start", 319 "margin-left", 320 "margin-right", 321 "margin-top", 322 "mask", 323 "mask-border", 324 "mask-position", 325 "mask-size", 326 "max-block-size", 327 "max-height", 328 "max-inline-size", 329 "max-lines", 330 "max-width", 331 "min-block-size", 332 "min-height", 333 "min-inline-size", 334 "min-width", 335 "object-position", 336 "offset", 337 "offset-anchor", 338 "offset-distance", 339 "offset-path", 340 "offset-position", 341 "offset-rotate", 342 "opacity", 343 "order", 344 "outline", 345 "outline-color", 346 "outline-offset", 347 "outline-width", 348 "padding", 349 "padding-block-end", 350 "padding-block-start", 351 "padding-bottom", 352 "padding-inline-end", 353 "padding-inline-start", 354 "padding-left", 355 "padding-right", 356 "padding-top", 357 "perspective", 358 "perspective-origin", 359 "right", 360 "rotate", 361 "row-gap", 362 "scale", 363 "scroll-margin", 364 "scroll-margin-block", 365 "scroll-margin-block-end", 366 "scroll-margin-block-start", 367 "scroll-margin-bottom", 368 "scroll-margin-inline", 369 "scroll-margin-inline-end", 370 "scroll-margin-inline-start", 371 "scroll-margin-left", 372 "scroll-margin-right", 373 "scroll-margin-top", 374 "scroll-padding", 375 "scroll-padding-block", 376 "scroll-padding-block-end", 377 "scroll-padding-block-start", 378 "scroll-padding-bottom", 379 "scroll-padding-inline", 380 "scroll-padding-inline-end", 381 "scroll-padding-inline-start", 382 "scroll-padding-left", 383 "scroll-padding-right", 384 "scroll-padding-top", 385 "scroll-snap-coordinate", 386 "scroll-snap-destination", 387 "scrollbar-color", 388 "shape-image-threshold", 389 "shape-margin", 390 "shape-outside", 391 "tab-size", 392 "text-decoration", 393 "text-decoration-color", 394 "text-decoration-thickness", 395 "text-emphasis", 396 "text-emphasis-color", 397 "text-indent", 398 "text-shadow", 399 "text-underline-offset", 400 "top", 401 "transform", 402 "transform-origin", 403 "translate", 404 "vertical-align", 405 "visibility", 406 "width", 407 "word-spacing", 408 "z-index", 409 "zoom" 410]); 411function optimizeGroupPlayer(players) { 412 switch (players.length) { 413 case 0: 414 return new NoopAnimationPlayer(); 415 case 1: 416 return players[0]; 417 default: 418 return new AnimationGroupPlayer(players); 419 } 420} 421function normalizeKeyframes$1(normalizer, keyframes, preStyles = /* @__PURE__ */ new Map(), postStyles = /* @__PURE__ */ new Map()) { 422 const errors = []; 423 const normalizedKeyframes = []; 424 let previousOffset = -1; 425 let previousKeyframe = null; 426 keyframes.forEach((kf) => { 427 const offset = kf.get("offset"); 428 const isSameOffset = offset == previousOffset; 429 const normalizedKeyframe = isSameOffset && previousKeyframe || /* @__PURE__ */ new Map(); 430 kf.forEach((val, prop) => { 431 let normalizedProp = prop; 432 let normalizedValue = val; 433 if (prop !== "offset") { 434 normalizedProp = normalizer.normalizePropertyName(normalizedProp, errors); 435 switch (normalizedValue) { 436 case \u0275PRE_STYLE: 437 normalizedValue = preStyles.get(prop); 438 break; 439 case AUTO_STYLE: 440 normalizedValue = postStyles.get(prop); 441 break; 442 default: 443 normalizedValue = normalizer.normalizeStyleValue(prop, normalizedProp, normalizedValue, errors); 444 break; 445 } 446 } 447 normalizedKeyframe.set(normalizedProp, normalizedValue); 448 }); 449 if (!isSameOffset) { 450 normalizedKeyframes.push(normalizedKeyframe); 451 } 452 previousKeyframe = normalizedKeyframe; 453 previousOffset = offset; 454 }); 455 if (errors.length) { 456 throw animationFailed(errors); 457 } 458 return normalizedKeyframes; 459} 460function listenOnPlayer(player, eventName, event, callback) { 461 switch (eventName) { 462 case "start": 463 player.onStart(() => callback(event && copyAnimationEvent(event, "start", player))); 464 break; 465 case "done": 466 player.onDone(() => callback(event && copyAnimationEvent(event, "done", player))); 467 break; 468 case "destroy": 469 player.onDestroy(() => callback(event && copyAnimationEvent(event, "destroy", player))); 470 break; 471 } 472} 473function copyAnimationEvent(e, phaseName, player) { 474 const totalTime = player.totalTime; 475 const disabled = player.disabled ? true : false; 476 const event = makeAnimationEvent(e.element, e.triggerName, e.fromState, e.toState, phaseName || e.phaseName, totalTime == void 0 ? e.totalTime : totalTime, disabled); 477 const data = e["_data"]; 478 if (data != null) { 479 event["_data"] = data; 480 } 481 return event; 482} 483function makeAnimationEvent(element, triggerName, fromState, toState, phaseName = "", totalTime = 0, disabled) { 484 return { element, triggerName, fromState, toState, phaseName, totalTime, disabled: !!disabled }; 485} 486function getOrSetDefaultValue(map, key, defaultValue) { 487 let value = map.get(key); 488 if (!value) { 489 map.set(key, value = defaultValue); 490 } 491 return value; 492} 493function parseTimelineCommand(command) { 494 const separatorPos = command.indexOf(":"); 495 const id = command.substring(1, separatorPos); 496 const action = command.slice(separatorPos + 1); 497 return [id, action]; 498} 499var documentElement = /* @__PURE__ */ (() => typeof document === "undefined" ? null : document.documentElement)(); 500function getParentElement(element) { 501 const parent = element.parentNode || element.host || null; 502 if (parent === documentElement) { 503 return null; 504 } 505 return parent; 506} 507function containsVendorPrefix(prop) { 508 return prop.substring(1, 6) == "ebkit"; 509} 510var _CACHED_BODY = null; 511var _IS_WEBKIT = false; 512function validateStyleProperty(prop) { 513 if (!_CACHED_BODY) { 514 _CACHED_BODY = getBodyNode() || {}; 515 _IS_WEBKIT = _CACHED_BODY.style ? "WebkitAppearance" in _CACHED_BODY.style : false; 516 } 517 let result = true; 518 if (_CACHED_BODY.style && !containsVendorPrefix(prop)) { 519 result = prop in _CACHED_BODY.style; 520 if (!result && _IS_WEBKIT) { 521 const camelProp = "Webkit" + prop.charAt(0).toUpperCase() + prop.slice(1); 522 result = camelProp in _CACHED_BODY.style; 523 } 524 } 525 return result; 526} 527function validateWebAnimatableStyleProperty(prop) { 528 return ANIMATABLE_PROP_SET.has(prop); 529} 530function getBodyNode() { 531 if (typeof document != "undefined") { 532 return document.body; 533 } 534 return null; 535} 536function containsElement(elm1, elm2) { 537 while (elm2) { 538 if (elm2 === elm1) { 539 return true; 540 } 541 elm2 = getParentElement(elm2); 542 } 543 return false; 544} 545function invokeQuery(element, selector, multi) { 546 if (multi) { 547 return Array.from(element.querySelectorAll(selector)); 548 } 549 const elem = element.querySelector(selector); 550 return elem ? [elem] : []; 551} 552var ONE_SECOND = 1e3; 553var SUBSTITUTION_EXPR_START = "{{"; 554var SUBSTITUTION_EXPR_END = "}}"; 555var ENTER_CLASSNAME = "ng-enter"; 556var LEAVE_CLASSNAME = "ng-leave"; 557var NG_TRIGGER_CLASSNAME = "ng-trigger"; 558var NG_TRIGGER_SELECTOR = ".ng-trigger"; 559var NG_ANIMATING_CLASSNAME = "ng-animating"; 560var NG_ANIMATING_SELECTOR = ".ng-animating"; 561function resolveTimingValue(value) { 562 if (typeof value == "number") 563 return value; 564 const matches = value.match(/^(-?[\.\d]+)(m?s)/); 565 if (!matches || matches.length < 2) 566 return 0; 567 return _convertTimeValueToMS(parseFloat(matches[1]), matches[2]); 568} 569function _convertTimeValueToMS(value, unit) { 570 switch (unit) { 571 case "s": 572 return value * ONE_SECOND; 573 default: 574 return value; 575 } 576} 577function resolveTiming(timings, errors, allowNegativeValues) { 578 return timings.hasOwnProperty("duration") ? timings : parseTimeExpression(timings, errors, allowNegativeValues); 579} 580var PARSE_TIME_EXPRESSION_REGEX = /^(-?[\.\d]+)(m?s)(?:\s+(-?[\.\d]+)(m?s))?(?:\s+([-a-z]+(?:\(.+?\))?))?$/i; 581function parseTimeExpression(exp, errors, allowNegativeValues) { 582 let duration; 583 let delay = 0; 584 let easing = ""; 585 if (typeof exp === "string") { 586 const matches = exp.match(PARSE_TIME_EXPRESSION_REGEX); 587 if (matches === null) { 588 errors.push(invalidTimingValue(exp)); 589 return { duration: 0, delay: 0, easing: "" }; 590 } 591 duration = _convertTimeValueToMS(parseFloat(matches[1]), matches[2]); 592 const delayMatch = matches[3]; 593 if (delayMatch != null) { 594 delay = _convertTimeValueToMS(parseFloat(delayMatch), matches[4]); 595 } 596 const easingVal = matches[5]; 597 if (easingVal) { 598 easing = easingVal; 599 } 600 } else { 601 duration = exp; 602 } 603 if (!allowNegativeValues) { 604 let containsErrors = false; 605 let startIndex = errors.length; 606 if (duration < 0) { 607 errors.push(negativeStepValue()); 608 containsErrors = true; 609 } 610 if (delay < 0) { 611 errors.push(negativeDelayValue()); 612 containsErrors = true; 613 } 614 if (containsErrors) { 615 errors.splice(startIndex, 0, invalidTimingValue(exp)); 616 } 617 } 618 return { duration, delay, easing }; 619} 620function normalizeKeyframes(keyframes) { 621 if (!keyframes.length) { 622 return []; 623 } 624 if (keyframes[0] instanceof Map) { 625 return keyframes; 626 } 627 return keyframes.map((kf) => new Map(Object.entries(kf))); 628} 629function setStyles(element, styles, formerStyles) { 630 styles.forEach((val, prop) => { 631 const camelProp = dashCaseToCamelCase(prop); 632 if (formerStyles && !formerStyles.has(prop)) { 633 formerStyles.set(prop, element.style[camelProp]); 634 } 635 element.style[camelProp] = val; 636 }); 637} 638function eraseStyles(element, styles) { 639 styles.forEach((_, prop) => { 640 const camelProp = dashCaseToCamelCase(prop); 641 element.style[camelProp] = ""; 642 }); 643} 644function normalizeAnimationEntry(steps) { 645 if (Array.isArray(steps)) { 646 if (steps.length == 1) 647 return steps[0]; 648 return sequence(steps); 649 } 650 return steps; 651} 652function validateStyleParams(value, options, errors) { 653 const params = options.params || {}; 654 const matches = extractStyleParams(value); 655 if (matches.length) { 656 matches.forEach((varName) => { 657 if (!params.hasOwnProperty(varName)) { 658 errors.push(invalidStyleParams(varName)); 659 } 660 }); 661 } 662} 663var PARAM_REGEX = /* @__PURE__ */ new RegExp(`${SUBSTITUTION_EXPR_START}\\s*(.+?)\\s*${SUBSTITUTION_EXPR_END}`, "g"); 664function extractStyleParams(value) { 665 let params = []; 666 if (typeof value === "string") { 667 let match; 668 while (match = PARAM_REGEX.exec(value)) { 669 params.push(match[1]); 670 } 671 PARAM_REGEX.lastIndex = 0; 672 } 673 return params; 674} 675function interpolateParams(value, params, errors) { 676 const original = `${value}`; 677 const str = original.replace(PARAM_REGEX, (_, varName) => { 678 let localVal = params[varName]; 679 if (localVal == null) { 680 errors.push(invalidParamValue(varName)); 681 localVal = ""; 682 } 683 return localVal.toString(); 684 }); 685 return str == original ? value : str; 686} 687var DASH_CASE_REGEXP = /-+([a-z0-9])/g; 688function dashCaseToCamelCase(input) { 689 return input.replace(DASH_CASE_REGEXP, (...m) => m[1].toUpperCase()); 690} 691function camelCaseToDashCase(input) { 692 return input.replace(/([a-z])([A-Z])/g, "$1-$2").toLowerCase(); 693} 694function allowPreviousPlayerStylesMerge(duration, delay) { 695 return duration === 0 || delay === 0; 696} 697function balancePreviousStylesIntoKeyframes(element, keyframes, previousStyles) { 698 if (previousStyles.size && keyframes.length) { 699 let startingKeyframe = keyframes[0]; 700 let missingStyleProps = []; 701 previousStyles.forEach((val, prop) => { 702 if (!startingKeyframe.has(prop)) { 703 missingStyleProps.push(prop); 704 } 705 startingKeyframe.set(prop, val); 706 }); 707 if (missingStyleProps.length) { 708 for (let i = 1; i < keyframes.length; i++) { 709 let kf = keyframes[i]; 710 missingStyleProps.forEach((prop) => kf.set(prop, computeStyle(element, prop))); 711 } 712 } 713 } 714 return keyframes; 715} 716function visitDslNode(visitor, node, context) { 717 switch (node.type) { 718 case AnimationMetadataType.Trigger: 719 return visitor.visitTrigger(node, context); 720 case AnimationMetadataType.State: 721 return visitor.visitState(node, context); 722 case AnimationMetadataType.Transition: 723 return visitor.visitTransition(node, context); 724 case AnimationMetadataType.Sequence: 725 return visitor.visitSequence(node, context); 726 case AnimationMetadataType.Group: 727 return visitor.visitGroup(node, context); 728 case AnimationMetadataType.Animate: 729 return visitor.visitAnimate(node, context); 730 case AnimationMetadataType.Keyframes: 731 return visitor.visitKeyframes(node, context); 732 case AnimationMetadataType.Style: 733 return visitor.visitStyle(node, context); 734 case AnimationMetadataType.Reference: 735 return visitor.visitReference(node, context); 736 case AnimationMetadataType.AnimateChild: 737 return visitor.visitAnimateChild(node, context); 738 case AnimationMetadataType.AnimateRef: 739 return visitor.visitAnimateRef(node, context); 740 case AnimationMetadataType.Query: 741 return visitor.visitQuery(node, context); 742 case AnimationMetadataType.Stagger: 743 return visitor.visitStagger(node, context); 744 default: 745 throw invalidNodeType(node.type); 746 } 747} 748function computeStyle(element, prop) { 749 return window.getComputedStyle(element)[prop]; 750} 751
vendor: 124,328 bytes, lines 752-4325
752// node_modules/@angular/animations/fesm2022/browser.mjs 753var NoopAnimationDriver = class _NoopAnimationDriver { 754 /** 755 * @returns Whether `prop` is a valid CSS property 756 */ 757 validateStyleProperty(prop) { 758 return validateStyleProperty(prop); 759 } 760 /** 761 * 762 * @returns Whether elm1 contains elm2. 763 */ 764 containsElement(elm1, elm2) { 765 return containsElement(elm1, elm2); 766 } 767 /** 768 * @returns Rhe parent of the given element or `null` if the element is the `document` 769 */ 770 getParentElement(element) { 771 return getParentElement(element); 772 } 773 /** 774 * @returns The result of the query selector on the element. The array will contain up to 1 item 775 * if `multi` is `false`. 776 */ 777 query(element, selector, multi) { 778 return invokeQuery(element, selector, multi); 779 } 780 /** 781 * @returns The `defaultValue` or empty string 782 */ 783 computeStyle(element, prop, defaultValue) { 784 return defaultValue || ""; 785 } 786 /** 787 * @returns An `NoopAnimationPlayer` 788 */ 789 animate(element, keyframes, duration, delay, easing, previousPlayers = [], scrubberAccessRequested) { 790 return new NoopAnimationPlayer(duration, delay); 791 } 792 static \u0275fac = function NoopAnimationDriver_Factory(__ngFactoryType__) { 793 return new (__ngFactoryType__ || _NoopAnimationDriver)(); 794 }; 795 static \u0275prov = /* @__PURE__ */ \u0275\u0275defineInjectable({ 796 token: _NoopAnimationDriver, 797 factory: _NoopAnimationDriver.\u0275fac 798 }); 799}; 800(() => { 801 (typeof ngDevMode === "undefined" || ngDevMode) && setClassMetadata(NoopAnimationDriver, [{ 802 type: Injectable 803 }], null, null); 804})(); 805var AnimationDriver = class { 806 /** 807 * @deprecated Use the NoopAnimationDriver class. 808 */ 809 static NOOP = new NoopAnimationDriver(); 810}; 811var AnimationStyleNormalizer = class { 812}; 813var DIMENSIONAL_PROP_SET = /* @__PURE__ */ new Set(["width", "height", "minWidth", "minHeight", "maxWidth", "maxHeight", "left", "top", "bottom", "right", "fontSize", "outlineWidth", "outlineOffset", "paddingTop", "paddingLeft", "paddingBottom", "paddingRight", "marginTop", "marginLeft", "marginBottom", "marginRight", "borderRadius", "borderWidth", "borderTopWidth", "borderLeftWidth", "borderRightWidth", "borderBottomWidth", "textIndent", "perspective"]); 814var WebAnimationsStyleNormalizer = class extends AnimationStyleNormalizer { 815 normalizePropertyName(propertyName, errors) { 816 return dashCaseToCamelCase(propertyName); 817 } 818 normalizeStyleValue(userProvidedProperty, normalizedProperty, value, errors) { 819 let unit = ""; 820 const strVal = value.toString().trim(); 821 if (DIMENSIONAL_PROP_SET.has(normalizedProperty) && value !== 0 && value !== "0") { 822 if (typeof value === "number") { 823 unit = "px"; 824 } else { 825 const valAndSuffixMatch = value.match(/^[+-]?[\d\.]+([a-z]*)$/); 826 if (valAndSuffixMatch && valAndSuffixMatch[1].length == 0) { 827 errors.push(invalidCssUnitValue(userProvidedProperty, value)); 828 } 829 } 830 } 831 return strVal + unit; 832 } 833}; 834function createListOfWarnings(warnings) { 835 const LINE_START2 = "\n - "; 836 return `${LINE_START2}${warnings.filter(Boolean).map((warning) => warning).join(LINE_START2)}`; 837} 838function warnTriggerBuild(name, warnings) { 839 console.warn(`The animation trigger "${name}" has built with the following warnings:${createListOfWarnings(warnings)}`); 840} 841function warnRegister(warnings) { 842 console.warn(`Animation built with the following warnings:${createListOfWarnings(warnings)}`); 843} 844function pushUnrecognizedPropertiesWarning(warnings, props) { 845 if (props.length) { 846 warnings.push(`The following provided properties are not recognized: ${props.join(", ")}`); 847 } 848} 849var ANY_STATE = "*"; 850function parseTransitionExpr(transitionValue, errors) { 851 const expressions = []; 852 if (typeof transitionValue == "string") { 853 transitionValue.split(/\s*,\s*/).forEach((str) => parseInnerTransitionStr(str, expressions, errors)); 854 } else { 855 expressions.push(transitionValue); 856 } 857 return expressions; 858} 859function parseInnerTransitionStr(eventStr, expressions, errors) { 860 if (eventStr[0] == ":") { 861 const result = parseAnimationAlias(eventStr, errors); 862 if (typeof result == "function") { 863 expressions.push(result); 864 return; 865 } 866 eventStr = result; 867 } 868 const match = eventStr.match(/^(\*|[-\w]+)\s*(<?[=-]>)\s*(\*|[-\w]+)$/); 869 if (match == null || match.length < 4) { 870 errors.push(invalidExpression(eventStr)); 871 return expressions; 872 } 873 const fromState = match[1]; 874 const separator = match[2]; 875 const toState = match[3]; 876 expressions.push(makeLambdaFromStates(fromState, toState)); 877 const isFullAnyStateExpr = fromState == ANY_STATE && toState == ANY_STATE; 878 if (separator[0] == "<" && !isFullAnyStateExpr) { 879 expressions.push(makeLambdaFromStates(toState, fromState)); 880 } 881 return; 882} 883function parseAnimationAlias(alias, errors) { 884 switch (alias) { 885 case ":enter": 886 return "void => *"; 887 case ":leave": 888 return "* => void"; 889 case ":increment": 890 return (fromState, toState) => parseFloat(toState) > parseFloat(fromState); 891 case ":decrement": 892 return (fromState, toState) => parseFloat(toState) < parseFloat(fromState); 893 default: 894 errors.push(invalidTransitionAlias(alias)); 895 return "* => *"; 896 } 897} 898var TRUE_BOOLEAN_VALUES = /* @__PURE__ */ new Set(["true", "1"]); 899var FALSE_BOOLEAN_VALUES = /* @__PURE__ */ new Set(["false", "0"]); 900function makeLambdaFromStates(lhs, rhs) { 901 const LHS_MATCH_BOOLEAN = TRUE_BOOLEAN_VALUES.has(lhs) || FALSE_BOOLEAN_VALUES.has(lhs); 902 const RHS_MATCH_BOOLEAN = TRUE_BOOLEAN_VALUES.has(rhs) || FALSE_BOOLEAN_VALUES.has(rhs); 903 return (fromState, toState) => { 904 let lhsMatch = lhs == ANY_STATE || lhs == fromState; 905 let rhsMatch = rhs == ANY_STATE || rhs == toState; 906 if (!lhsMatch && LHS_MATCH_BOOLEAN && typeof fromState === "boolean") { 907 lhsMatch = fromState ? TRUE_BOOLEAN_VALUES.has(lhs) : FALSE_BOOLEAN_VALUES.has(lhs); 908 } 909 if (!rhsMatch && RHS_MATCH_BOOLEAN && typeof toState === "boolean") { 910 rhsMatch = toState ? TRUE_BOOLEAN_VALUES.has(rhs) : FALSE_BOOLEAN_VALUES.has(rhs); 911 } 912 return lhsMatch && rhsMatch; 913 }; 914} 915var SELF_TOKEN = ":self"; 916var SELF_TOKEN_REGEX = /* @__PURE__ */ new RegExp(`s*${SELF_TOKEN}s*,?`, "g"); 917function buildAnimationAst(driver, metadata, errors, warnings) { 918 return new AnimationAstBuilderVisitor(driver).build(metadata, errors, warnings); 919} 920var ROOT_SELECTOR = ""; 921var AnimationAstBuilderVisitor = class { 922 _driver; 923 constructor(_driver) { 924 this._driver = _driver; 925 } 926 build(metadata, errors, warnings) { 927 const context = new AnimationAstBuilderContext(errors); 928 this._resetContextStyleTimingState(context); 929 const ast = visitDslNode(this, normalizeAnimationEntry(metadata), context); 930 if (typeof ngDevMode === "undefined" || ngDevMode) { 931 if (context.unsupportedCSSPropertiesFound.size) { 932 pushUnrecognizedPropertiesWarning(warnings, [...context.unsupportedCSSPropertiesFound.keys()]); 933 } 934 } 935 return ast; 936 } 937 _resetContextStyleTimingState(context) { 938 context.currentQuerySelector = ROOT_SELECTOR; 939 context.collectedStyles = /* @__PURE__ */ new Map(); 940 context.collectedStyles.set(ROOT_SELECTOR, /* @__PURE__ */ new Map()); 941 context.currentTime = 0; 942 } 943 visitTrigger(metadata, context) { 944 let queryCount = context.queryCount = 0; 945 let depCount = context.depCount = 0; 946 const states = []; 947 const transitions = []; 948 if (metadata.name.charAt(0) == "@") { 949 context.errors.push(invalidTrigger()); 950 } 951 metadata.definitions.forEach((def) => { 952 this._resetContextStyleTimingState(context); 953 if (def.type == AnimationMetadataType.State) { 954 const stateDef = def; 955 const name = stateDef.name; 956 name.toString().split(/\s*,\s*/).forEach((n) => { 957 stateDef.name = n; 958 states.push(this.visitState(stateDef, context)); 959 }); 960 stateDef.name = name; 961 } else if (def.type == AnimationMetadataType.Transition) { 962 const transition = this.visitTransition(def, context); 963 queryCount += transition.queryCount; 964 depCount += transition.depCount; 965 transitions.push(transition); 966 } else { 967 context.errors.push(invalidDefinition()); 968 } 969 }); 970 return { 971 type: AnimationMetadataType.Trigger, 972 name: metadata.name, 973 states, 974 transitions, 975 queryCount, 976 depCount, 977 options: null 978 }; 979 } 980 visitState(metadata, context) { 981 const styleAst = this.visitStyle(metadata.styles, context); 982 const astParams = metadata.options && metadata.options.params || null; 983 if (styleAst.containsDynamicStyles) { 984 const missingSubs = /* @__PURE__ */ new Set(); 985 const params = astParams || {}; 986 styleAst.styles.forEach((style2) => { 987 if (style2 instanceof Map) { 988 style2.forEach((value) => { 989 extractStyleParams(value).forEach((sub) => { 990 if (!params.hasOwnProperty(sub)) { 991 missingSubs.add(sub); 992 } 993 }); 994 }); 995 } 996 }); 997 if (missingSubs.size) { 998 context.errors.push(invalidState(metadata.name, [...missingSubs.values()])); 999 } 1000 } 1001 return { 1002 type: AnimationMetadataType.State, 1003 name: metadata.name, 1004 style: styleAst, 1005 options: astParams ? { 1006 params: astParams 1007 } : null 1008 }; 1009 } 1010 visitTransition(metadata, context) { 1011 context.queryCount = 0; 1012 context.depCount = 0; 1013 const animation = visitDslNode(this, normalizeAnimationEntry(metadata.animation), context); 1014 const matchers = parseTransitionExpr(metadata.expr, context.errors); 1015 return { 1016 type: AnimationMetadataType.Transition, 1017 matchers, 1018 animation, 1019 queryCount: context.queryCount, 1020 depCount: context.depCount, 1021 options: normalizeAnimationOptions(metadata.options) 1022 }; 1023 } 1024 visitSequence(metadata, context) { 1025 return { 1026 type: AnimationMetadataType.Sequence, 1027 steps: metadata.steps.map((s) => visitDslNode(this, s, context)), 1028 options: normalizeAnimationOptions(metadata.options) 1029 }; 1030 } 1031 visitGroup(metadata, context) { 1032 const currentTime = context.currentTime; 1033 let furthestTime = 0; 1034 const steps = metadata.steps.map((step) => { 1035 context.currentTime = currentTime; 1036 const innerAst = visitDslNode(this, step, context); 1037 furthestTime = Math.max(furthestTime, context.currentTime); 1038 return innerAst; 1039 }); 1040 context.currentTime = furthestTime; 1041 return { 1042 type: AnimationMetadataType.Group, 1043 steps, 1044 options: normalizeAnimationOptions(metadata.options) 1045 }; 1046 } 1047 visitAnimate(metadata, context) { 1048 const timingAst = constructTimingAst(metadata.timings, context.errors); 1049 context.currentAnimateTimings = timingAst; 1050 let styleAst; 1051 let styleMetadata = metadata.styles ? metadata.styles : style({}); 1052 if (styleMetadata.type == AnimationMetadataType.Keyframes) { 1053 styleAst = this.visitKeyframes(styleMetadata, context); 1054 } else { 1055 let styleMetadata2 = metadata.styles; 1056 let isEmpty = false; 1057 if (!styleMetadata2) { 1058 isEmpty = true; 1059 const newStyleData = {}; 1060 if (timingAst.easing) { 1061 newStyleData["easing"] = timingAst.easing; 1062 } 1063 styleMetadata2 = style(newStyleData); 1064 } 1065 context.currentTime += timingAst.duration + timingAst.delay; 1066 const _styleAst = this.visitStyle(styleMetadata2, context); 1067 _styleAst.isEmptyStep = isEmpty; 1068 styleAst = _styleAst; 1069 } 1070 context.currentAnimateTimings = null; 1071 return { 1072 type: AnimationMetadataType.Animate, 1073 timings: timingAst, 1074 style: styleAst, 1075 options: null 1076 }; 1077 } 1078 visitStyle(metadata, context) { 1079 const ast = this._makeStyleAst(metadata, context); 1080 this._validateStyleAst(ast, context); 1081 return ast; 1082 } 1083 _makeStyleAst(metadata, context) { 1084 const styles = []; 1085 const metadataStyles = Array.isArray(metadata.styles) ? metadata.styles : [metadata.styles]; 1086 for (let styleTuple of metadataStyles) { 1087 if (typeof styleTuple === "string") { 1088 if (styleTuple === AUTO_STYLE) { 1089 styles.push(styleTuple); 1090 } else { 1091 context.errors.push(invalidStyleValue(styleTuple)); 1092 } 1093 } else { 1094 styles.push(new Map(Object.entries(styleTuple))); 1095 } 1096 } 1097 let containsDynamicStyles = false; 1098 let collectedEasing = null; 1099 styles.forEach((styleData) => { 1100 if (styleData instanceof Map) { 1101 if (styleData.has("easing")) { 1102 collectedEasing = styleData.get("easing"); 1103 styleData.delete("easing"); 1104 } 1105 if (!containsDynamicStyles) { 1106 for (let value of styleData.values()) { 1107 if (value.toString().indexOf(SUBSTITUTION_EXPR_START) >= 0) { 1108 containsDynamicStyles = true; 1109 break; 1110 } 1111 } 1112 } 1113 } 1114 }); 1115 return { 1116 type: AnimationMetadataType.Style, 1117 styles, 1118 easing: collectedEasing, 1119 offset: metadata.offset, 1120 containsDynamicStyles, 1121 options: null 1122 }; 1123 } 1124 _validateStyleAst(ast, context) { 1125 const timings = context.currentAnimateTimings; 1126 let endTime = context.currentTime; 1127 let startTime = context.currentTime; 1128 if (timings && startTime > 0) { 1129 startTime -= timings.duration + timings.delay; 1130 } 1131 ast.styles.forEach((tuple) => { 1132 if (typeof tuple === "string") return; 1133 tuple.forEach((value, prop) => { 1134 if (typeof ngDevMode === "undefined" || ngDevMode) { 1135 if (!this._driver.validateStyleProperty(prop)) { 1136 tuple.delete(prop); 1137 context.unsupportedCSSPropertiesFound.add(prop); 1138 return; 1139 } 1140 } 1141 const collectedStyles = context.collectedStyles.get(context.currentQuerySelector); 1142 const collectedEntry = collectedStyles.get(prop); 1143 let updateCollectedStyle = true; 1144 if (collectedEntry) { 1145 if (startTime != endTime && startTime >= collectedEntry.startTime && endTime <= collectedEntry.endTime) { 1146 context.errors.push(invalidParallelAnimation(prop, collectedEntry.startTime, collectedEntry.endTime, startTime, endTime)); 1147 updateCollectedStyle = false; 1148 } 1149 startTime = collectedEntry.startTime; 1150 } 1151 if (updateCollectedStyle) { 1152 collectedStyles.set(prop, { 1153 startTime, 1154 endTime 1155 }); 1156 } 1157 if (context.options) { 1158 validateStyleParams(value, context.options, context.errors); 1159 } 1160 }); 1161 }); 1162 } 1163 visitKeyframes(metadata, context) { 1164 const ast = { 1165 type: AnimationMetadataType.Keyframes, 1166 styles: [], 1167 options: null 1168 }; 1169 if (!context.currentAnimateTimings) { 1170 context.errors.push(invalidKeyframes()); 1171 return ast; 1172 } 1173 const MAX_KEYFRAME_OFFSET = 1; 1174 let totalKeyframesWithOffsets = 0; 1175 const offsets = []; 1176 let offsetsOutOfOrder = false; 1177 let keyframesOutOfRange = false; 1178 let previousOffset = 0; 1179 const keyframes = metadata.steps.map((styles) => { 1180 const style2 = this._makeStyleAst(styles, context); 1181 let offsetVal = style2.offset != null ? style2.offset : consumeOffset(style2.styles); 1182 let offset = 0; 1183 if (offsetVal != null) { 1184 totalKeyframesWithOffsets++; 1185 offset = style2.offset = offsetVal; 1186 } 1187 keyframesOutOfRange = keyframesOutOfRange || offset < 0 || offset > 1; 1188 offsetsOutOfOrder = offsetsOutOfOrder || offset < previousOffset; 1189 previousOffset = offset; 1190 offsets.push(offset); 1191 return style2; 1192 }); 1193 if (keyframesOutOfRange) { 1194 context.errors.push(invalidOffset()); 1195 } 1196 if (offsetsOutOfOrder) { 1197 context.errors.push(keyframeOffsetsOutOfOrder()); 1198 } 1199 const length = metadata.steps.length; 1200 let generatedOffset = 0; 1201 if (totalKeyframesWithOffsets > 0 && totalKeyframesWithOffsets < length) { 1202 context.errors.push(keyframesMissingOffsets()); 1203 } else if (totalKeyframesWithOffsets == 0) { 1204 generatedOffset = MAX_KEYFRAME_OFFSET / (length - 1); 1205 } 1206 const limit = length - 1; 1207 const currentTime = context.currentTime; 1208 const currentAnimateTimings = context.currentAnimateTimings; 1209 const animateDuration = currentAnimateTimings.duration; 1210 keyframes.forEach((kf, i) => { 1211 const offset = generatedOffset > 0 ? i == limit ? 1 : generatedOffset * i : offsets[i]; 1212 const durationUpToThisFrame = offset * animateDuration; 1213 context.currentTime = currentTime + currentAnimateTimings.delay + durationUpToThisFrame; 1214 currentAnimateTimings.duration = durationUpToThisFrame; 1215 this._validateStyleAst(kf, context); 1216 kf.offset = offset; 1217 ast.styles.push(kf); 1218 }); 1219 return ast; 1220 } 1221 visitReference(metadata, context) { 1222 return { 1223 type: AnimationMetadataType.Reference, 1224 animation: visitDslNode(this, normalizeAnimationEntry(metadata.animation), context), 1225 options: normalizeAnimationOptions(metadata.options) 1226 }; 1227 } 1228 visitAnimateChild(metadata, context) { 1229 context.depCount++; 1230 return { 1231 type: AnimationMetadataType.AnimateChild, 1232 options: normalizeAnimationOptions(metadata.options) 1233 }; 1234 } 1235 visitAnimateRef(metadata, context) { 1236 return { 1237 type: AnimationMetadataType.AnimateRef, 1238 animation: this.visitReference(metadata.animation, context), 1239 options: normalizeAnimationOptions(metadata.options) 1240 }; 1241 } 1242 visitQuery(metadata, context) { 1243 const parentSelector = context.currentQuerySelector; 1244 const options = metadata.options || {}; 1245 context.queryCount++; 1246 context.currentQuery = metadata; 1247 const [selector, includeSelf] = normalizeSelector(metadata.selector); 1248 context.currentQuerySelector = parentSelector.length ? parentSelector + " " + selector : selector; 1249 getOrSetDefaultValue(context.collectedStyles, context.currentQuerySelector, /* @__PURE__ */ new Map()); 1250 const animation = visitDslNode(this, normalizeAnimationEntry(metadata.animation), context); 1251 context.currentQuery = null; 1252 context.currentQuerySelector = parentSelector; 1253 return { 1254 type: AnimationMetadataType.Query, 1255 selector, 1256 limit: options.limit || 0, 1257 optional: !!options.optional, 1258 includeSelf, 1259 animation, 1260 originalSelector: metadata.selector, 1261 options: normalizeAnimationOptions(metadata.options) 1262 }; 1263 } 1264 visitStagger(metadata, context) { 1265 if (!context.currentQuery) { 1266 context.errors.push(invalidStagger()); 1267 } 1268 const timings = metadata.timings === "full" ? { 1269 duration: 0, 1270 delay: 0, 1271 easing: "full" 1272 } : resolveTiming(metadata.timings, context.errors, true); 1273 return { 1274 type: AnimationMetadataType.Stagger, 1275 animation: visitDslNode(this, normalizeAnimationEntry(metadata.animation), context), 1276 timings, 1277 options: null 1278 }; 1279 } 1280}; 1281function normalizeSelector(selector) { 1282 const hasAmpersand = selector.split(/\s*,\s*/).find((token) => token == SELF_TOKEN) ? true : false; 1283 if (hasAmpersand) { 1284 selector = selector.replace(SELF_TOKEN_REGEX, ""); 1285 } 1286 selector = selector.replace(/@\*/g, NG_TRIGGER_SELECTOR).replace(/@\w+/g, (match) => NG_TRIGGER_SELECTOR + "-" + match.slice(1)).replace(/:animating/g, NG_ANIMATING_SELECTOR); 1287 return [selector, hasAmpersand]; 1288} 1289function normalizeParams(obj) { 1290 return obj ? __spreadValues({}, obj) : null; 1291} 1292var AnimationAstBuilderContext = class { 1293 errors; 1294 queryCount = 0; 1295 depCount = 0; 1296 currentTransition = null; 1297 currentQuery = null; 1298 currentQuerySelector = null; 1299 currentAnimateTimings = null; 1300 currentTime = 0; 1301 collectedStyles = /* @__PURE__ */ new Map(); 1302 options = null; 1303 unsupportedCSSPropertiesFound = /* @__PURE__ */ new Set(); 1304 constructor(errors) { 1305 this.errors = errors; 1306 } 1307}; 1308function consumeOffset(styles) { 1309 if (typeof styles == "string") return null; 1310 let offset = null; 1311 if (Array.isArray(styles)) { 1312 styles.forEach((styleTuple) => { 1313 if (styleTuple instanceof Map && styleTuple.has("offset")) { 1314 const obj = styleTuple; 1315 offset = parseFloat(obj.get("offset")); 1316 obj.delete("offset"); 1317 } 1318 }); 1319 } else if (styles instanceof Map && styles.has("offset")) { 1320 const obj = styles; 1321 offset = parseFloat(obj.get("offset")); 1322 obj.delete("offset"); 1323 } 1324 return offset; 1325} 1326function constructTimingAst(value, errors) { 1327 if (value.hasOwnProperty("duration")) { 1328 return value; 1329 } 1330 if (typeof value == "number") { 1331 const duration = resolveTiming(value, errors).duration; 1332 return makeTimingAst(duration, 0, ""); 1333 } 1334 const strValue = value; 1335 const isDynamic = strValue.split(/\s+/).some((v) => v.charAt(0) == "{" && v.charAt(1) == "{"); 1336 if (isDynamic) { 1337 const ast = makeTimingAst(0, 0, ""); 1338 ast.dynamic = true; 1339 ast.strValue = strValue; 1340 return ast; 1341 } 1342 const timings = resolveTiming(strValue, errors); 1343 return makeTimingAst(timings.duration, timings.delay, timings.easing); 1344} 1345function normalizeAnimationOptions(options) { 1346 if (options) { 1347 options = __spreadValues({}, options); 1348 if (options["params"]) { 1349 options["params"] = normalizeParams(options["params"]); 1350 } 1351 } else { 1352 options = {}; 1353 } 1354 return options; 1355} 1356function makeTimingAst(duration, delay, easing) { 1357 return { 1358 duration, 1359 delay, 1360 easing 1361 }; 1362} 1363function createTimelineInstruction(element, keyframes, preStyleProps, postStyleProps, duration, delay, easing = null, subTimeline = false) { 1364 return { 1365 type: 1, 1366 element, 1367 keyframes, 1368 preStyleProps, 1369 postStyleProps, 1370 duration, 1371 delay, 1372 totalTime: duration + delay, 1373 easing, 1374 subTimeline 1375 }; 1376} 1377var ElementInstructionMap = class { 1378 _map = /* @__PURE__ */ new Map(); 1379 get(element) { 1380 return this._map.get(element) || []; 1381 } 1382 append(element, instructions) { 1383 let existingInstructions = this._map.get(element); 1384 if (!existingInstructions) { 1385 this._map.set(element, existingInstructions = []); 1386 } 1387 existingInstructions.push(...instructions); 1388 } 1389 has(element) { 1390 return this._map.has(element); 1391 } 1392 clear() { 1393 this._map.clear(); 1394 } 1395}; 1396var ONE_FRAME_IN_MILLISECONDS = 1; 1397var ENTER_TOKEN = ":enter"; 1398var ENTER_TOKEN_REGEX = /* @__PURE__ */ new RegExp(ENTER_TOKEN, "g"); 1399var LEAVE_TOKEN = ":leave"; 1400var LEAVE_TOKEN_REGEX = /* @__PURE__ */ new RegExp(LEAVE_TOKEN, "g"); 1401function buildAnimationTimelines(driver, rootElement, ast, enterClassName, leaveClassName, startingStyles = /* @__PURE__ */ new Map(), finalStyles = /* @__PURE__ */ new Map(), options, subInstructions, errors = []) { 1402 return new AnimationTimelineBuilderVisitor().buildKeyframes(driver, rootElement, ast, enterClassName, leaveClassName, startingStyles, finalStyles, options, subInstructions, errors); 1403} 1404var AnimationTimelineBuilderVisitor = class { 1405 buildKeyframes(driver, rootElement, ast, enterClassName, leaveClassName, startingStyles, finalStyles, options, subInstructions, errors = []) { 1406 subInstructions = subInstructions || new ElementInstructionMap(); 1407 const context = new AnimationTimelineContext(driver, rootElement, subInstructions, enterClassName, leaveClassName, errors, []); 1408 context.options = options; 1409 const delay = options.delay ? resolveTimingValue(options.delay) : 0; 1410 context.currentTimeline.delayNextStep(delay); 1411 context.currentTimeline.setStyles([startingStyles], null, context.errors, options); 1412 visitDslNode(this, ast, context); 1413 const timelines = context.timelines.filter((timeline) => timeline.containsAnimation()); 1414 if (timelines.length && finalStyles.size) { 1415 let lastRootTimeline; 1416 for (let i = timelines.length - 1; i >= 0; i--) { 1417 const timeline = timelines[i]; 1418 if (timeline.element === rootElement) { 1419 lastRootTimeline = timeline; 1420 break; 1421 } 1422 } 1423 if (lastRootTimeline && !lastRootTimeline.allowOnlyTimelineStyles()) { 1424 lastRootTimeline.setStyles([finalStyles], null, context.errors, options); 1425 } 1426 } 1427 return timelines.length ? timelines.map((timeline) => timeline.buildKeyframes()) : [createTimelineInstruction(rootElement, [], [], [], 0, delay, "", false)]; 1428 } 1429 visitTrigger(ast, context) { 1430 } 1431 visitState(ast, context) { 1432 } 1433 visitTransition(ast, context) { 1434 } 1435 visitAnimateChild(ast, context) { 1436 const elementInstructions = context.subInstructions.get(context.element); 1437 if (elementInstructions) { 1438 const innerContext = context.createSubContext(ast.options); 1439 const startTime = context.currentTimeline.currentTime; 1440 const endTime = this._visitSubInstructions(elementInstructions, innerContext, innerContext.options); 1441 if (startTime != endTime) { 1442 context.transformIntoNewTimeline(endTime); 1443 } 1444 } 1445 context.previousNode = ast; 1446 } 1447 visitAnimateRef(ast, context) { 1448 const innerContext = context.createSubContext(ast.options); 1449 innerContext.transformIntoNewTimeline(); 1450 this._applyAnimationRefDelays([ast.options, ast.animation.options], context, innerContext); 1451 this.visitReference(ast.animation, innerContext); 1452 context.transformIntoNewTimeline(innerContext.currentTimeline.currentTime); 1453 context.previousNode = ast; 1454 } 1455 _applyAnimationRefDelays(animationsRefsOptions, context, innerContext) { 1456 for (const animationRefOptions of animationsRefsOptions) { 1457 const animationDelay = animationRefOptions?.delay; 1458 if (animationDelay) { 1459 const animationDelayValue = typeof animationDelay === "number" ? animationDelay : resolveTimingValue(interpolateParams(animationDelay, animationRefOptions?.params ?? {}, context.errors)); 1460 innerContext.delayNextStep(animationDelayValue); 1461 } 1462 } 1463 } 1464 _visitSubInstructions(instructions, context, options) { 1465 const startTime = context.currentTimeline.currentTime; 1466 let furthestTime = startTime; 1467 const duration = options.duration != null ? resolveTimingValue(options.duration) : null; 1468 const delay = options.delay != null ? resolveTimingValue(options.delay) : null; 1469 if (duration !== 0) { 1470 instructions.forEach((instruction) => { 1471 const instructionTimings = context.appendInstructionToTimeline(instruction, duration, delay); 1472 furthestTime = Math.max(furthestTime, instructionTimings.duration + instructionTimings.delay); 1473 }); 1474 } 1475 return furthestTime; 1476 } 1477 visitReference(ast, context) { 1478 context.updateOptions(ast.options, true); 1479 visitDslNode(this, ast.animation, context); 1480 context.previousNode = ast; 1481 } 1482 visitSequence(ast, context) { 1483 const subContextCount = context.subContextCount; 1484 let ctx = context; 1485 const options = ast.options; 1486 if (options && (options.params || options.delay)) { 1487 ctx = context.createSubContext(options); 1488 ctx.transformIntoNewTimeline(); 1489 if (options.delay != null) { 1490 if (ctx.previousNode.type == AnimationMetadataType.Style) { 1491 ctx.currentTimeline.snapshotCurrentStyles(); 1492 ctx.previousNode = DEFAULT_NOOP_PREVIOUS_NODE; 1493 } 1494 const delay = resolveTimingValue(options.delay); 1495 ctx.delayNextStep(delay); 1496 } 1497 } 1498 if (ast.steps.length) { 1499 ast.steps.forEach((s) => visitDslNode(this, s, ctx)); 1500 ctx.currentTimeline.applyStylesToKeyframe(); 1501 if (ctx.subContextCount > subContextCount) { 1502 ctx.transformIntoNewTimeline(); 1503 } 1504 } 1505 context.previousNode = ast; 1506 } 1507 visitGroup(ast, context) { 1508 const innerTimelines = []; 1509 let furthestTime = context.currentTimeline.currentTime; 1510 const delay = ast.options && ast.options.delay ? resolveTimingValue(ast.options.delay) : 0; 1511 ast.steps.forEach((s) => { 1512 const innerContext = context.createSubContext(ast.options); 1513 if (delay) { 1514 innerContext.delayNextStep(delay); 1515 } 1516 visitDslNode(this, s, innerContext); 1517 furthestTime = Math.max(furthestTime, innerContext.currentTimeline.currentTime); 1518 innerTimelines.push(innerContext.currentTimeline); 1519 }); 1520 innerTimelines.forEach((timeline) => context.currentTimeline.mergeTimelineCollectedStyles(timeline)); 1521 context.transformIntoNewTimeline(furthestTime); 1522 context.previousNode = ast; 1523 } 1524 _visitTiming(ast, context) { 1525 if (ast.dynamic) { 1526 const strValue = ast.strValue; 1527 const timingValue = context.params ? interpolateParams(strValue, context.params, context.errors) : strValue; 1528 return resolveTiming(timingValue, context.errors); 1529 } else { 1530 return { 1531 duration: ast.duration, 1532 delay: ast.delay, 1533 easing: ast.easing 1534 }; 1535 } 1536 } 1537 visitAnimate(ast, context) { 1538 const timings = context.currentAnimateTimings = this._visitTiming(ast.timings, context); 1539 const timeline = context.currentTimeline; 1540 if (timings.delay) { 1541 context.incrementTime(timings.delay); 1542 timeline.snapshotCurrentStyles(); 1543 } 1544 const style2 = ast.style; 1545 if (style2.type == AnimationMetadataType.Keyframes) { 1546 this.visitKeyframes(style2, context); 1547 } else { 1548 context.incrementTime(timings.duration); 1549 this.visitStyle(style2, context); 1550 timeline.applyStylesToKeyframe(); 1551 } 1552 context.currentAnimateTimings = null; 1553 context.previousNode = ast; 1554 } 1555 visitStyle(ast, context) { 1556 const timeline = context.currentTimeline; 1557 const timings = context.currentAnimateTimings; 1558 if (!timings && timeline.hasCurrentStyleProperties()) { 1559 timeline.forwardFrame(); 1560 } 1561 const easing = timings && timings.easing || ast.easing; 1562 if (ast.isEmptyStep) { 1563 timeline.applyEmptyStep(easing); 1564 } else { 1565 timeline.setStyles(ast.styles, easing, context.errors, context.options); 1566 } 1567 context.previousNode = ast; 1568 } 1569 visitKeyframes(ast, context) { 1570 const currentAnimateTimings = context.currentAnimateTimings; 1571 const startTime = context.currentTimeline.duration; 1572 const duration = currentAnimateTimings.duration; 1573 const innerContext = context.createSubContext(); 1574 const innerTimeline = innerContext.currentTimeline; 1575 innerTimeline.easing = currentAnimateTimings.easing; 1576 ast.styles.forEach((step) => { 1577 const offset = step.offset || 0; 1578 innerTimeline.forwardTime(offset * duration); 1579 innerTimeline.setStyles(step.styles, step.easing, context.errors, context.options); 1580 innerTimeline.applyStylesToKeyframe(); 1581 }); 1582 context.currentTimeline.mergeTimelineCollectedStyles(innerTimeline); 1583 context.transformIntoNewTimeline(startTime + duration); 1584 context.previousNode = ast; 1585 } 1586 visitQuery(ast, context) { 1587 const startTime = context.currentTimeline.currentTime; 1588 const options = ast.options || {}; 1589 const delay = options.delay ? resolveTimingValue(options.delay) : 0; 1590 if (delay && (context.previousNode.type === AnimationMetadataType.Style || startTime == 0 && context.currentTimeline.hasCurrentStyleProperties())) { 1591 context.currentTimeline.snapshotCurrentStyles(); 1592 context.previousNode = DEFAULT_NOOP_PREVIOUS_NODE; 1593 } 1594 let furthestTime = startTime; 1595 const elms = context.invokeQuery(ast.selector, ast.originalSelector, ast.limit, ast.includeSelf, options.optional ? true : false, context.errors); 1596 context.currentQueryTotal = elms.length; 1597 let sameElementTimeline = null; 1598 elms.forEach((element, i) => { 1599 context.currentQueryIndex = i; 1600 const innerContext = context.createSubContext(ast.options, element); 1601 if (delay) { 1602 innerContext.delayNextStep(delay); 1603 } 1604 if (element === context.element) { 1605 sameElementTimeline = innerContext.currentTimeline; 1606 } 1607 visitDslNode(this, ast.animation, innerContext); 1608 innerContext.currentTimeline.applyStylesToKeyframe(); 1609 const endTime = innerContext.currentTimeline.currentTime; 1610 furthestTime = Math.max(furthestTime, endTime); 1611 }); 1612 context.currentQueryIndex = 0; 1613 context.currentQueryTotal = 0; 1614 context.transformIntoNewTimeline(furthestTime); 1615 if (sameElementTimeline) { 1616 context.currentTimeline.mergeTimelineCollectedStyles(sameElementTimeline); 1617 context.currentTimeline.snapshotCurrentStyles(); 1618 } 1619 context.previousNode = ast; 1620 } 1621 visitStagger(ast, context) { 1622 const parentContext = context.parentContext; 1623 const tl = context.currentTimeline; 1624 const timings = ast.timings; 1625 const duration = Math.abs(timings.duration); 1626 const maxTime = duration * (context.currentQueryTotal - 1); 1627 let delay = duration * context.currentQueryIndex; 1628 let staggerTransformer = timings.duration < 0 ? "reverse" : timings.easing; 1629 switch (staggerTransformer) { 1630 case "reverse": 1631 delay = maxTime - delay; 1632 break; 1633 case "full": 1634 delay = parentContext.currentStaggerTime; 1635 break; 1636 } 1637 const timeline = context.currentTimeline; 1638 if (delay) { 1639 timeline.delayNextStep(delay); 1640 } 1641 const startingTime = timeline.currentTime; 1642 visitDslNode(this, ast.animation, context); 1643 context.previousNode = ast; 1644 parentContext.currentStaggerTime = tl.currentTime - startingTime + (tl.startTime - parentContext.currentTimeline.startTime); 1645 } 1646}; 1647var DEFAULT_NOOP_PREVIOUS_NODE = {}; 1648var AnimationTimelineContext = class _AnimationTimelineContext { 1649 _driver; 1650 element; 1651 subInstructions; 1652 _enterClassName; 1653 _leaveClassName; 1654 errors; 1655 timelines; 1656 parentContext = null; 1657 currentTimeline; 1658 currentAnimateTimings = null; 1659 previousNode = DEFAULT_NOOP_PREVIOUS_NODE; 1660 subContextCount = 0; 1661 options = {}; 1662 currentQueryIndex = 0; 1663 currentQueryTotal = 0; 1664 currentStaggerTime = 0; 1665 constructor(_driver, element, subInstructions, _enterClassName, _leaveClassName, errors, timelines, initialTimeline) { 1666 this._driver = _driver; 1667 this.element = element; 1668 this.subInstructions = subInstructions; 1669 this._enterClassName = _enterClassName; 1670 this._leaveClassName = _leaveClassName; 1671 this.errors = errors; 1672 this.timelines = timelines; 1673 this.currentTimeline = initialTimeline || new TimelineBuilder(this._driver, element, 0); 1674 timelines.push(this.currentTimeline); 1675 } 1676 get params() { 1677 return this.options.params; 1678 } 1679 updateOptions(options, skipIfExists) { 1680 if (!options) return; 1681 const newOptions = options; 1682 let optionsToUpdate = this.options; 1683 if (newOptions.duration != null) { 1684 optionsToUpdate.duration = resolveTimingValue(newOptions.duration); 1685 } 1686 if (newOptions.delay != null) { 1687 optionsToUpdate.delay = resolveTimingValue(newOptions.delay); 1688 } 1689 const newParams = newOptions.params; 1690 if (newParams) { 1691 let paramsToUpdate = optionsToUpdate.params; 1692 if (!paramsToUpdate) { 1693 paramsToUpdate = this.options.params = {}; 1694 } 1695 Object.keys(newParams).forEach((name) => { 1696 if (!skipIfExists || !paramsToUpdate.hasOwnProperty(name)) { 1697 paramsToUpdate[name] = interpolateParams(newParams[name], paramsToUpdate, this.errors); 1698 } 1699 }); 1700 } 1701 } 1702 _copyOptions() { 1703 const options = {}; 1704 if (this.options) { 1705 const oldParams = this.options.params; 1706 if (oldParams) { 1707 const params = options["params"] = {}; 1708 Object.keys(oldParams).forEach((name) => { 1709 params[name] = oldParams[name]; 1710 }); 1711 } 1712 } 1713 return options; 1714 } 1715 createSubContext(options = null, element, newTime) { 1716 const target = element || this.element; 1717 const context = new _AnimationTimelineContext(this._driver, target, this.subInstructions, this._enterClassName, this._leaveClassName, this.errors, this.timelines, this.currentTimeline.fork(target, newTime || 0)); 1718 context.previousNode = this.previousNode; 1719 context.currentAnimateTimings = this.currentAnimateTimings; 1720 context.options = this._copyOptions(); 1721 context.updateOptions(options); 1722 context.currentQueryIndex = this.currentQueryIndex; 1723 context.currentQueryTotal = this.currentQueryTotal; 1724 context.parentContext = this; 1725 this.subContextCount++; 1726 return context; 1727 } 1728 transformIntoNewTimeline(newTime) { 1729 this.previousNode = DEFAULT_NOOP_PREVIOUS_NODE; 1730 this.currentTimeline = this.currentTimeline.fork(this.element, newTime); 1731 this.timelines.push(this.currentTimeline); 1732 return this.currentTimeline; 1733 } 1734 appendInstructionToTimeline(instruction, duration, delay) { 1735 const updatedTimings = { 1736 duration: duration != null ? duration : instruction.duration, 1737 delay: this.currentTimeline.currentTime + (delay != null ? delay : 0) + instruction.delay, 1738 easing: "" 1739 }; 1740 const builder = new SubTimelineBuilder(this._driver, instruction.element, instruction.keyframes, instruction.preStyleProps, instruction.postStyleProps, updatedTimings, instruction.stretchStartingKeyframe); 1741 this.timelines.push(builder); 1742 return updatedTimings; 1743 } 1744 incrementTime(time) { 1745 this.currentTimeline.forwardTime(this.currentTimeline.duration + time); 1746 } 1747 delayNextStep(delay) { 1748 if (delay > 0) { 1749 this.currentTimeline.delayNextStep(delay); 1750 } 1751 } 1752 invokeQuery(selector, originalSelector, limit, includeSelf, optional, errors) { 1753 let results = []; 1754 if (includeSelf) { 1755 results.push(this.element); 1756 } 1757 if (selector.length > 0) { 1758 selector = selector.replace(ENTER_TOKEN_REGEX, "." + this._enterClassName); 1759 selector = selector.replace(LEAVE_TOKEN_REGEX, "." + this._leaveClassName); 1760 const multi = limit != 1; 1761 let elements = this._driver.query(this.element, selector, multi); 1762 if (limit !== 0) { 1763 elements = limit < 0 ? elements.slice(elements.length + limit, elements.length) : elements.slice(0, limit); 1764 } 1765 results.push(...elements); 1766 } 1767 if (!optional && results.length == 0) { 1768 errors.push(invalidQuery(originalSelector)); 1769 } 1770 return results; 1771 } 1772}; 1773var TimelineBuilder = class _TimelineBuilder { 1774 _driver; 1775 element; 1776 startTime; 1777 _elementTimelineStylesLookup; 1778 duration = 0; 1779 easing = null; 1780 _previousKeyframe = /* @__PURE__ */ new Map(); 1781 _currentKeyframe = /* @__PURE__ */ new Map(); 1782 _keyframes = /* @__PURE__ */ new Map(); 1783 _styleSummary = /* @__PURE__ */ new Map(); 1784 _localTimelineStyles = /* @__PURE__ */ new Map(); 1785 _globalTimelineStyles; 1786 _pendingStyles = /* @__PURE__ */ new Map(); 1787 _backFill = /* @__PURE__ */ new Map(); 1788 _currentEmptyStepKeyframe = null; 1789 constructor(_driver, element, startTime, _elementTimelineStylesLookup) { 1790 this._driver = _driver; 1791 this.element = element; 1792 this.startTime = startTime; 1793 this._elementTimelineStylesLookup = _elementTimelineStylesLookup; 1794 if (!this._elementTimelineStylesLookup) { 1795 this._elementTimelineStylesLookup = /* @__PURE__ */ new Map(); 1796 } 1797 this._globalTimelineStyles = this._elementTimelineStylesLookup.get(element); 1798 if (!this._globalTimelineStyles) { 1799 this._globalTimelineStyles = this._localTimelineStyles; 1800 this._elementTimelineStylesLookup.set(element, this._localTimelineStyles); 1801 } 1802 this._loadKeyframe(); 1803 } 1804 containsAnimation() { 1805 switch (this._keyframes.size) { 1806 case 0: 1807 return false; 1808 case 1: 1809 return this.hasCurrentStyleProperties(); 1810 default: 1811 return true; 1812 } 1813 } 1814 hasCurrentStyleProperties() { 1815 return this._currentKeyframe.size > 0; 1816 } 1817 get currentTime() { 1818 return this.startTime + this.duration; 1819 } 1820 delayNextStep(delay) { 1821 const hasPreStyleStep = this._keyframes.size === 1 && this._pendingStyles.size; 1822 if (this.duration || hasPreStyleStep) { 1823 this.forwardTime(this.currentTime + delay); 1824 if (hasPreStyleStep) { 1825 this.snapshotCurrentStyles(); 1826 } 1827 } else { 1828 this.startTime += delay; 1829 } 1830 } 1831 fork(element, currentTime) { 1832 this.applyStylesToKeyframe(); 1833 return new _TimelineBuilder(this._driver, element, currentTime || this.currentTime, this._elementTimelineStylesLookup); 1834 } 1835 _loadKeyframe() { 1836 if (this._currentKeyframe) { 1837 this._previousKeyframe = this._currentKeyframe; 1838 } 1839 this._currentKeyframe = this._keyframes.get(this.duration); 1840 if (!this._currentKeyframe) { 1841 this._currentKeyframe = /* @__PURE__ */ new Map(); 1842 this._keyframes.set(this.duration, this._currentKeyframe); 1843 } 1844 } 1845 forwardFrame() { 1846 this.duration += ONE_FRAME_IN_MILLISECONDS; 1847 this._loadKeyframe(); 1848 } 1849 forwardTime(time) { 1850 this.applyStylesToKeyframe(); 1851 this.duration = time; 1852 this._loadKeyframe(); 1853 } 1854 _updateStyle(prop, value) { 1855 this._localTimelineStyles.set(prop, value); 1856 this._globalTimelineStyles.set(prop, value); 1857 this._styleSummary.set(prop, { 1858 time: this.currentTime, 1859 value 1860 }); 1861 } 1862 allowOnlyTimelineStyles() { 1863 return this._currentEmptyStepKeyframe !== this._currentKeyframe; 1864 } 1865 applyEmptyStep(easing) { 1866 if (easing) { 1867 this._previousKeyframe.set("easing", easing); 1868 } 1869 for (let [prop, value] of this._globalTimelineStyles) { 1870 this._backFill.set(prop, value || AUTO_STYLE); 1871 this._currentKeyframe.set(prop, AUTO_STYLE); 1872 } 1873 this._currentEmptyStepKeyframe = this._currentKeyframe; 1874 } 1875 setStyles(input, easing, errors, options) { 1876 if (easing) { 1877 this._previousKeyframe.set("easing", easing); 1878 } 1879 const params = options && options.params || {}; 1880 const styles = flattenStyles(input, this._globalTimelineStyles); 1881 for (let [prop, value] of styles) { 1882 const val = interpolateParams(value, params, errors); 1883 this._pendingStyles.set(prop, val); 1884 if (!this._localTimelineStyles.has(prop)) { 1885 this._backFill.set(prop, this._globalTimelineStyles.get(prop) ?? AUTO_STYLE); 1886 } 1887 this._updateStyle(prop, val); 1888 } 1889 } 1890 applyStylesToKeyframe() { 1891 if (this._pendingStyles.size == 0) return; 1892 this._pendingStyles.forEach((val, prop) => { 1893 this._currentKeyframe.set(prop, val); 1894 }); 1895 this._pendingStyles.clear(); 1896 this._localTimelineStyles.forEach((val, prop) => { 1897 if (!this._currentKeyframe.has(prop)) { 1898 this._currentKeyframe.set(prop, val); 1899 } 1900 }); 1901 } 1902 snapshotCurrentStyles() { 1903 for (let [prop, val] of this._localTimelineStyles) { 1904 this._pendingStyles.set(prop, val); 1905 this._updateStyle(prop, val); 1906 } 1907 } 1908 getFinalKeyframe() { 1909 return this._keyframes.get(this.duration); 1910 } 1911 get properties() { 1912 const properties = []; 1913 for (let prop in this._currentKeyframe) { 1914 properties.push(prop); 1915 } 1916 return properties; 1917 } 1918 mergeTimelineCollectedStyles(timeline) { 1919 timeline._styleSummary.forEach((details1, prop) => { 1920 const details0 = this._styleSummary.get(prop); 1921 if (!details0 || details1.time > details0.time) { 1922 this._updateStyle(prop, details1.value); 1923 } 1924 }); 1925 } 1926 buildKeyframes() { 1927 this.applyStylesToKeyframe(); 1928 const preStyleProps = /* @__PURE__ */ new Set(); 1929 const postStyleProps = /* @__PURE__ */ new Set(); 1930 const isEmpty = this._keyframes.size === 1 && this.duration === 0; 1931 let finalKeyframes = []; 1932 this._keyframes.forEach((keyframe, time) => { 1933 const finalKeyframe = new Map([...this._backFill, ...keyframe]); 1934 finalKeyframe.forEach((value, prop) => { 1935 if (value === \u0275PRE_STYLE) { 1936 preStyleProps.add(prop); 1937 } else if (value === AUTO_STYLE) { 1938 postStyleProps.add(prop); 1939 } 1940 }); 1941 if (!isEmpty) { 1942 finalKeyframe.set("offset", time / this.duration); 1943 } 1944 finalKeyframes.push(finalKeyframe); 1945 }); 1946 const preProps = [...preStyleProps.values()]; 1947 const postProps = [...postStyleProps.values()]; 1948 if (isEmpty) { 1949 const kf0 = finalKeyframes[0]; 1950 const kf1 = new Map(kf0); 1951 kf0.set("offset", 0); 1952 kf1.set("offset", 1); 1953 finalKeyframes = [kf0, kf1]; 1954 } 1955 return createTimelineInstruction(this.element, finalKeyframes, preProps, postProps, this.duration, this.startTime, this.easing, false); 1956 } 1957}; 1958var SubTimelineBuilder = class extends TimelineBuilder { 1959 keyframes; 1960 preStyleProps; 1961 postStyleProps; 1962 _stretchStartingKeyframe; 1963 timings; 1964 constructor(driver, element, keyframes, preStyleProps, postStyleProps, timings, _stretchStartingKeyframe = false) { 1965 super(driver, element, timings.delay); 1966 this.keyframes = keyframes; 1967 this.preStyleProps = preStyleProps; 1968 this.postStyleProps = postStyleProps; 1969 this._stretchStartingKeyframe = _stretchStartingKeyframe; 1970 this.timings = { 1971 duration: timings.duration, 1972 delay: timings.delay, 1973 easing: timings.easing 1974 }; 1975 } 1976 containsAnimation() { 1977 return this.keyframes.length > 1; 1978 } 1979 buildKeyframes() { 1980 let keyframes = this.keyframes; 1981 let { 1982 delay, 1983 duration, 1984 easing 1985 } = this.timings; 1986 if (this._stretchStartingKeyframe && delay) { 1987 const newKeyframes = []; 1988 const totalTime = duration + delay; 1989 const startingGap = delay / totalTime; 1990 const newFirstKeyframe = new Map(keyframes[0]); 1991 newFirstKeyframe.set("offset", 0); 1992 newKeyframes.push(newFirstKeyframe); 1993 const oldFirstKeyframe = new Map(keyframes[0]); 1994 oldFirstKeyframe.set("offset", roundOffset(startingGap)); 1995 newKeyframes.push(oldFirstKeyframe); 1996 const limit = keyframes.length - 1; 1997 for (let i = 1; i <= limit; i++) { 1998 let kf = new Map(keyframes[i]); 1999 const oldOffset = kf.get("offset"); 2000 const timeAtKeyframe = delay + oldOffset * duration; 2001 kf.set("offset", roundOffset(timeAtKeyframe / totalTime)); 2002 newKeyframes.push(kf); 2003 } 2004 duration = totalTime; 2005 delay = 0; 2006 easing = ""; 2007 keyframes = newKeyframes; 2008 } 2009 return createTimelineInstruction(this.element, keyframes, this.preStyleProps, this.postStyleProps, duration, delay, easing, true); 2010 } 2011}; 2012function roundOffset(offset, decimalPoints = 3) { 2013 const mult = Math.pow(10, decimalPoints - 1); 2014 return Math.round(offset * mult) / mult; 2015} 2016function flattenStyles(input, allStyles) { 2017 const styles = /* @__PURE__ */ new Map(); 2018 let allProperties; 2019 input.forEach((token) => { 2020 if (token === "*") { 2021 allProperties ??= allStyles.keys(); 2022 for (let prop of allProperties) { 2023 styles.set(prop, AUTO_STYLE); 2024 } 2025 } else { 2026 for (let [prop, val] of token) { 2027 styles.set(prop, val); 2028 } 2029 } 2030 }); 2031 return styles; 2032} 2033function createTransitionInstruction(element, triggerName, fromState, toState, isRemovalTransition, fromStyles, toStyles, timelines, queriedElements, preStyleProps, postStyleProps, totalTime, errors) { 2034 return { 2035 type: 0, 2036 element, 2037 triggerName, 2038 isRemovalTransition, 2039 fromState, 2040 fromStyles, 2041 toState, 2042 toStyles, 2043 timelines, 2044 queriedElements, 2045 preStyleProps, 2046 postStyleProps, 2047 totalTime, 2048 errors 2049 }; 2050} 2051var EMPTY_OBJECT = {}; 2052var AnimationTransitionFactory = class { 2053 _triggerName; 2054 ast; 2055 _stateStyles; 2056 constructor(_triggerName, ast, _stateStyles) { 2057 this._triggerName = _triggerName; 2058 this.ast = ast; 2059 this._stateStyles = _stateStyles; 2060 } 2061 match(currentState, nextState, element, params) { 2062 return oneOrMoreTransitionsMatch(this.ast.matchers, currentState, nextState, element, params); 2063 } 2064 buildStyles(stateName, params, errors) { 2065 let styler = this._stateStyles.get("*"); 2066 if (stateName !== void 0) { 2067 styler = this._stateStyles.get(stateName?.toString()) || styler; 2068 } 2069 return styler ? styler.buildStyles(params, errors) : /* @__PURE__ */ new Map(); 2070 } 2071 build(driver, element, currentState, nextState, enterClassName, leaveClassName, currentOptions, nextOptions, subInstructions, skipAstBuild) { 2072 const errors = []; 2073 const transitionAnimationParams = this.ast.options && this.ast.options.params || EMPTY_OBJECT; 2074 const currentAnimationParams = currentOptions && currentOptions.params || EMPTY_OBJECT; 2075 const currentStateStyles = this.buildStyles(currentState, currentAnimationParams, errors); 2076 const nextAnimationParams = nextOptions && nextOptions.params || EMPTY_OBJECT; 2077 const nextStateStyles = this.buildStyles(nextState, nextAnimationParams, errors); 2078 const queriedElements = /* @__PURE__ */ new Set(); 2079 const preStyleMap = /* @__PURE__ */ new Map(); 2080 const postStyleMap = /* @__PURE__ */ new Map(); 2081 const isRemoval = nextState === "void"; 2082 const animationOptions = { 2083 params: applyParamDefaults(nextAnimationParams, transitionAnimationParams), 2084 delay: this.ast.options?.delay 2085 }; 2086 const timelines = skipAstBuild ? [] : buildAnimationTimelines(driver, element, this.ast.animation, enterClassName, leaveClassName, currentStateStyles, nextStateStyles, animationOptions, subInstructions, errors); 2087 let totalTime = 0; 2088 timelines.forEach((tl) => { 2089 totalTime = Math.max(tl.duration + tl.delay, totalTime); 2090 }); 2091 if (errors.length) { 2092 return createTransitionInstruction(element, this._triggerName, currentState, nextState, isRemoval, currentStateStyles, nextStateStyles, [], [], preStyleMap, postStyleMap, totalTime, errors); 2093 } 2094 timelines.forEach((tl) => { 2095 const elm = tl.element; 2096 const preProps = getOrSetDefaultValue(preStyleMap, elm, /* @__PURE__ */ new Set()); 2097 tl.preStyleProps.forEach((prop) => preProps.add(prop)); 2098 const postProps = getOrSetDefaultValue(postStyleMap, elm, /* @__PURE__ */ new Set()); 2099 tl.postStyleProps.forEach((prop) => postProps.add(prop)); 2100 if (elm !== element) { 2101 queriedElements.add(elm); 2102 } 2103 }); 2104 if (typeof ngDevMode === "undefined" || ngDevMode) { 2105 checkNonAnimatableInTimelines(timelines, this._triggerName, driver); 2106 } 2107 return createTransitionInstruction(element, this._triggerName, currentState, nextState, isRemoval, currentStateStyles, nextStateStyles, timelines, [...queriedElements.values()], preStyleMap, postStyleMap, totalTime); 2108 } 2109}; 2110function checkNonAnimatableInTimelines(timelines, triggerName, driver) { 2111 if (!driver.validateAnimatableStyleProperty) { 2112 return; 2113 } 2114 const allowedNonAnimatableProps = /* @__PURE__ */ new Set([ 2115 // 'easing' is a utility/synthetic prop we use to represent 2116 // easing functions, it represents a property of the animation 2117 // which is not animatable but different values can be used 2118 // in different steps 2119 "easing" 2120 ]); 2121 const invalidNonAnimatableProps = /* @__PURE__ */ new Set(); 2122 timelines.forEach(({ 2123 keyframes 2124 }) => { 2125 const nonAnimatablePropsInitialValues = /* @__PURE__ */ new Map(); 2126 keyframes.forEach((keyframe) => { 2127 const entriesToCheck = Array.from(keyframe.entries()).filter(([prop]) => !allowedNonAnimatableProps.has(prop)); 2128 for (const [prop, value] of entriesToCheck) { 2129 if (!driver.validateAnimatableStyleProperty(prop)) { 2130 if (nonAnimatablePropsInitialValues.has(prop) && !invalidNonAnimatableProps.has(prop)) { 2131 const propInitialValue = nonAnimatablePropsInitialValues.get(prop); 2132 if (propInitialValue !== value) { 2133 invalidNonAnimatableProps.add(prop); 2134 } 2135 } else { 2136 nonAnimatablePropsInitialValues.set(prop, value); 2137 } 2138 } 2139 } 2140 }); 2141 }); 2142 if (invalidNonAnimatableProps.size > 0) { 2143 console.warn(`Warning: The animation trigger "${triggerName}" is attempting to animate the following not animatable properties: ` + Array.from(invalidNonAnimatableProps).join(", ") + "\n(to check the list of all animatable properties visit https://developer.mozilla.org/en-US/docs/Web/CSS/CSS_animated_properties)"); 2144 } 2145} 2146function oneOrMoreTransitionsMatch(matchFns, currentState, nextState, element, params) { 2147 return matchFns.some((fn) => fn(currentState, nextState, element, params)); 2148} 2149function applyParamDefaults(userParams, defaults) { 2150 const result = __spreadValues({}, defaults); 2151 Object.entries(userParams).forEach(([key, value]) => { 2152 if (value != null) { 2153 result[key] = value; 2154 } 2155 }); 2156 return result; 2157} 2158var AnimationStateStyles = class { 2159 styles; 2160 defaultParams; 2161 normalizer; 2162 constructor(styles, defaultParams, normalizer) { 2163 this.styles = styles; 2164 this.defaultParams = defaultParams; 2165 this.normalizer = normalizer; 2166 } 2167 buildStyles(params, errors) { 2168 const finalStyles = /* @__PURE__ */ new Map(); 2169 const combinedParams = applyParamDefaults(params, this.defaultParams); 2170 this.styles.styles.forEach((value) => { 2171 if (typeof value !== "string") { 2172 value.forEach((val, prop) => { 2173 if (val) { 2174 val = interpolateParams(val, combinedParams, errors); 2175 } 2176 const normalizedProp = this.normalizer.normalizePropertyName(prop, errors); 2177 val = this.normalizer.normalizeStyleValue(prop, normalizedProp, val, errors); 2178 finalStyles.set(prop, val); 2179 }); 2180 } 2181 }); 2182 return finalStyles; 2183 } 2184}; 2185function buildTrigger(name, ast, normalizer) { 2186 return new AnimationTrigger(name, ast, normalizer); 2187} 2188var AnimationTrigger = class { 2189 name; 2190 ast; 2191 _normalizer; 2192 transitionFactories = []; 2193 fallbackTransition; 2194 states = /* @__PURE__ */ new Map(); 2195 constructor(name, ast, _normalizer) { 2196 this.name = name; 2197 this.ast = ast; 2198 this._normalizer = _normalizer; 2199 ast.states.forEach((ast2) => { 2200 const defaultParams = ast2.options && ast2.options.params || {}; 2201 this.states.set(ast2.name, new AnimationStateStyles(ast2.style, defaultParams, _normalizer)); 2202 }); 2203 balanceProperties(this.states, "true", "1"); 2204 balanceProperties(this.states, "false", "0"); 2205 ast.transitions.forEach((ast2) => { 2206 this.transitionFactories.push(new AnimationTransitionFactory(name, ast2, this.states)); 2207 }); 2208 this.fallbackTransition = createFallbackTransition(name, this.states); 2209 } 2210 get containsQueries() { 2211 return this.ast.queryCount > 0; 2212 } 2213 matchTransition(currentState, nextState, element, params) { 2214 const entry = this.transitionFactories.find((f) => f.match(currentState, nextState, element, params)); 2215 return entry || null; 2216 } 2217 matchStyles(currentState, params, errors) { 2218 return this.fallbackTransition.buildStyles(currentState, params, errors); 2219 } 2220}; 2221function createFallbackTransition(triggerName, states, normalizer) { 2222 const matchers = [(fromState, toState) => true]; 2223 const animation = { 2224 type: AnimationMetadataType.Sequence, 2225 steps: [], 2226 options: null 2227 }; 2228 const transition = { 2229 type: AnimationMetadataType.Transition, 2230 animation, 2231 matchers, 2232 options: null, 2233 queryCount: 0, 2234 depCount: 0 2235 }; 2236 return new AnimationTransitionFactory(triggerName, transition, states); 2237} 2238function balanceProperties(stateMap, key1, key2) { 2239 if (stateMap.has(key1)) { 2240 if (!stateMap.has(key2)) { 2241 stateMap.set(key2, stateMap.get(key1)); 2242 } 2243 } else if (stateMap.has(key2)) { 2244 stateMap.set(key1, stateMap.get(key2)); 2245 } 2246} 2247var EMPTY_INSTRUCTION_MAP = /* @__PURE__ */ new ElementInstructionMap(); 2248var TimelineAnimationEngine = class { 2249 bodyNode; 2250 _driver; 2251 _normalizer; 2252 _animations = /* @__PURE__ */ new Map(); 2253 _playersById = /* @__PURE__ */ new Map(); 2254 players = []; 2255 constructor(bodyNode, _driver, _normalizer) { 2256 this.bodyNode = bodyNode; 2257 this._driver = _driver; 2258 this._normalizer = _normalizer; 2259 } 2260 register(id, metadata) { 2261 const errors = []; 2262 const warnings = []; 2263 const ast = buildAnimationAst(this._driver, metadata, errors, warnings); 2264 if (errors.length) { 2265 throw registerFailed(errors); 2266 } else { 2267 if (typeof ngDevMode === "undefined" || ngDevMode) { 2268 if (warnings.length) { 2269 warnRegister(warnings); 2270 } 2271 } 2272 this._animations.set(id, ast); 2273 } 2274 } 2275 _buildPlayer(i, preStyles, postStyles) { 2276 const element = i.element; 2277 const keyframes = normalizeKeyframes$1(this._normalizer, i.keyframes, preStyles, postStyles); 2278 return this._driver.animate(element, keyframes, i.duration, i.delay, i.easing, [], true); 2279 } 2280 create(id, element, options = {}) { 2281 const errors = []; 2282 const ast = this._animations.get(id); 2283 let instructions; 2284 const autoStylesMap = /* @__PURE__ */ new Map(); 2285 if (ast) { 2286 instructions = buildAnimationTimelines(this._driver, element, ast, ENTER_CLASSNAME, LEAVE_CLASSNAME, /* @__PURE__ */ new Map(), /* @__PURE__ */ new Map(), options, EMPTY_INSTRUCTION_MAP, errors); 2287 instructions.forEach((inst) => { 2288 const styles = getOrSetDefaultValue(autoStylesMap, inst.element, /* @__PURE__ */ new Map()); 2289 inst.postStyleProps.forEach((prop) => styles.set(prop, null)); 2290 }); 2291 } else { 2292 errors.push(missingOrDestroyedAnimation()); 2293 instructions = []; 2294 } 2295 if (errors.length) { 2296 throw createAnimationFailed(errors); 2297 } 2298 autoStylesMap.forEach((styles, element2) => { 2299 styles.forEach((_, prop) => { 2300 styles.set(prop, this._driver.computeStyle(element2, prop, AUTO_STYLE)); 2301 }); 2302 }); 2303 const players = instructions.map((i) => { 2304 const styles = autoStylesMap.get(i.element); 2305 return this._buildPlayer(i, /* @__PURE__ */ new Map(), styles); 2306 }); 2307 const player = optimizeGroupPlayer(players); 2308 this._playersById.set(id, player); 2309 player.onDestroy(() => this.destroy(id)); 2310 this.players.push(player); 2311 return player; 2312 } 2313 destroy(id) { 2314 const player = this._getPlayer(id); 2315 player.destroy(); 2316 this._playersById.delete(id); 2317 const index = this.players.indexOf(player); 2318 if (index >= 0) { 2319 this.players.splice(index, 1); 2320 } 2321 } 2322 _getPlayer(id) { 2323 const player = this._playersById.get(id); 2324 if (!player) { 2325 throw missingPlayer(id); 2326 } 2327 return player; 2328 } 2329 listen(id, element, eventName, callback) { 2330 const baseEvent = makeAnimationEvent(element, "", "", ""); 2331 listenOnPlayer(this._getPlayer(id), eventName, baseEvent, callback); 2332 return () => { 2333 }; 2334 } 2335 command(id, element, command, args) { 2336 if (command == "register") { 2337 this.register(id, args[0]); 2338 return; 2339 } 2340 if (command == "create") { 2341 const options = args[0] || {}; 2342 this.create(id, element, options); 2343 return; 2344 } 2345 const player = this._getPlayer(id); 2346 switch (command) { 2347 case "play": 2348 player.play(); 2349 break; 2350 case "pause": 2351 player.pause(); 2352 break; 2353 case "reset": 2354 player.reset(); 2355 break; 2356 case "restart": 2357 player.restart(); 2358 break; 2359 case "finish": 2360 player.finish(); 2361 break; 2362 case "init": 2363 player.init(); 2364 break; 2365 case "setPosition": 2366 player.setPosition(parseFloat(args[0])); 2367 break; 2368 case "destroy": 2369 this.destroy(id); 2370 break; 2371 } 2372 } 2373}; 2374var QUEUED_CLASSNAME = "ng-animate-queued"; 2375var QUEUED_SELECTOR = ".ng-animate-queued"; 2376var DISABLED_CLASSNAME = "ng-animate-disabled"; 2377var DISABLED_SELECTOR = ".ng-animate-disabled"; 2378var STAR_CLASSNAME = "ng-star-inserted"; 2379var STAR_SELECTOR = ".ng-star-inserted"; 2380var EMPTY_PLAYER_ARRAY = []; 2381var NULL_REMOVAL_STATE = { 2382 namespaceId: "", 2383 setForRemoval: false, 2384 setForMove: false, 2385 hasAnimation: false, 2386 removedBeforeQueried: false 2387}; 2388var NULL_REMOVED_QUERIED_STATE = { 2389 namespaceId: "", 2390 setForMove: false, 2391 setForRemoval: false, 2392 hasAnimation: false, 2393 removedBeforeQueried: true 2394}; 2395var REMOVAL_FLAG = "__ng_removed"; 2396var StateValue = class { 2397 namespaceId; 2398 value; 2399 options; 2400 get params() { 2401 return this.options.params; 2402 } 2403 constructor(input, namespaceId = "") { 2404 this.namespaceId = namespaceId; 2405 const isObj = input && input.hasOwnProperty("value"); 2406 const value = isObj ? input["value"] : input; 2407 this.value = normalizeTriggerValue(value); 2408 if (isObj) { 2409 const _a = input, { 2410 value: value2 2411 } = _a, options = __objRest(_a, [ 2412 "value" 2413 ]); 2414 this.options = options; 2415 } else { 2416 this.options = {}; 2417 } 2418 if (!this.options.params) { 2419 this.options.params = {}; 2420 } 2421 } 2422 absorbOptions(options) { 2423 const newParams = options.params; 2424 if (newParams) { 2425 const oldParams = this.options.params; 2426 Object.keys(newParams).forEach((prop) => { 2427 if (oldParams[prop] == null) { 2428 oldParams[prop] = newParams[prop]; 2429 } 2430 }); 2431 } 2432 } 2433}; 2434var VOID_VALUE = "void"; 2435var DEFAULT_STATE_VALUE = /* @__PURE__ */ new StateValue(VOID_VALUE); 2436var AnimationTransitionNamespace = class { 2437 id; 2438 hostElement; 2439 _engine; 2440 players = []; 2441 _triggers = /* @__PURE__ */ new Map(); 2442 _queue = []; 2443 _elementListeners = /* @__PURE__ */ new Map(); 2444 _hostClassName; 2445 constructor(id, hostElement, _engine) { 2446 this.id = id; 2447 this.hostElement = hostElement; 2448 this._engine = _engine; 2449 this._hostClassName = "ng-tns-" + id; 2450 addClass(hostElement, this._hostClassName); 2451 } 2452 listen(element, name, phase, callback) { 2453 if (!this._triggers.has(name)) { 2454 throw missingTrigger(phase, name); 2455 } 2456 if (phase == null || phase.length == 0) { 2457 throw missingEvent(name); 2458 } 2459 if (!isTriggerEventValid(phase)) { 2460 throw unsupportedTriggerEvent(phase, name); 2461 } 2462 const listeners = getOrSetDefaultValue(this._elementListeners, element, []); 2463 const data = { 2464 name, 2465 phase, 2466 callback 2467 }; 2468 listeners.push(data); 2469 const triggersWithStates = getOrSetDefaultValue(this._engine.statesByElement, element, /* @__PURE__ */ new Map()); 2470 if (!triggersWithStates.has(name)) { 2471 addClass(element, NG_TRIGGER_CLASSNAME); 2472 addClass(element, NG_TRIGGER_CLASSNAME + "-" + name); 2473 triggersWithStates.set(name, DEFAULT_STATE_VALUE); 2474 } 2475 return () => { 2476 this._engine.afterFlush(() => { 2477 const index = listeners.indexOf(data); 2478 if (index >= 0) { 2479 listeners.splice(index, 1); 2480 } 2481 if (!this._triggers.has(name)) { 2482 triggersWithStates.delete(name); 2483 } 2484 }); 2485 }; 2486 } 2487 register(name, ast) { 2488 if (this._triggers.has(name)) { 2489 return false; 2490 } else { 2491 this._triggers.set(name, ast); 2492 return true; 2493 } 2494 } 2495 _getTrigger(name) { 2496 const trigger = this._triggers.get(name); 2497 if (!trigger) { 2498 throw unregisteredTrigger(name); 2499 } 2500 return trigger; 2501 } 2502 trigger(element, triggerName, value, defaultToFallback = true) { 2503 const trigger = this._getTrigger(triggerName); 2504 const player = new TransitionAnimationPlayer(this.id, triggerName, element); 2505 let triggersWithStates = this._engine.statesByElement.get(element); 2506 if (!triggersWithStates) { 2507 addClass(element, NG_TRIGGER_CLASSNAME); 2508 addClass(element, NG_TRIGGER_CLASSNAME + "-" + triggerName); 2509 this._engine.statesByElement.set(element, triggersWithStates = /* @__PURE__ */ new Map()); 2510 } 2511 let fromState = triggersWithStates.get(triggerName); 2512 const toState = new StateValue(value, this.id); 2513 const isObj = value && value.hasOwnProperty("value"); 2514 if (!isObj && fromState) { 2515 toState.absorbOptions(fromState.options); 2516 } 2517 triggersWithStates.set(triggerName, toState); 2518 if (!fromState) { 2519 fromState = DEFAULT_STATE_VALUE; 2520 } 2521 const isRemoval = toState.value === VOID_VALUE; 2522 if (!isRemoval && fromState.value === toState.value) { 2523 if (!objEquals(fromState.params, toState.params)) { 2524 const errors = []; 2525 const fromStyles = trigger.matchStyles(fromState.value, fromState.params, errors); 2526 const toStyles = trigger.matchStyles(toState.value, toState.params, errors); 2527 if (errors.length) { 2528 this._engine.reportError(errors); 2529 } else { 2530 this._engine.afterFlush(() => { 2531 eraseStyles(element, fromStyles); 2532 setStyles(element, toStyles); 2533 }); 2534 } 2535 } 2536 return; 2537 } 2538 const playersOnElement = getOrSetDefaultValue(this._engine.playersByElement, element, []); 2539 playersOnElement.forEach((player2) => { 2540 if (player2.namespaceId == this.id && player2.triggerName == triggerName && player2.queued) { 2541 player2.destroy(); 2542 } 2543 }); 2544 let transition = trigger.matchTransition(fromState.value, toState.value, element, toState.params); 2545 let isFallbackTransition = false; 2546 if (!transition) { 2547 if (!defaultToFallback) return; 2548 transition = trigger.fallbackTransition; 2549 isFallbackTransition = true; 2550 } 2551 this._engine.totalQueuedPlayers++; 2552 this._queue.push({ 2553 element, 2554 triggerName, 2555 transition, 2556 fromState, 2557 toState, 2558 player, 2559 isFallbackTransition 2560 }); 2561 if (!isFallbackTransition) { 2562 addClass(element, QUEUED_CLASSNAME); 2563 player.onStart(() => { 2564 removeClass(element, QUEUED_CLASSNAME); 2565 }); 2566 } 2567 player.onDone(() => { 2568 let index = this.players.indexOf(player); 2569 if (index >= 0) { 2570 this.players.splice(index, 1); 2571 } 2572 const players = this._engine.playersByElement.get(element); 2573 if (players) { 2574 let index2 = players.indexOf(player); 2575 if (index2 >= 0) { 2576 players.splice(index2, 1); 2577 } 2578 } 2579 }); 2580 this.players.push(player); 2581 playersOnElement.push(player); 2582 return player; 2583 } 2584 deregister(name) { 2585 this._triggers.delete(name); 2586 this._engine.statesByElement.forEach((stateMap) => stateMap.delete(name)); 2587 this._elementListeners.forEach((listeners, element) => { 2588 this._elementListeners.set(element, listeners.filter((entry) => { 2589 return entry.name != name; 2590 })); 2591 }); 2592 } 2593 clearElementCache(element) { 2594 this._engine.statesByElement.delete(element); 2595 this._elementListeners.delete(element); 2596 const elementPlayers = this._engine.playersByElement.get(element); 2597 if (elementPlayers) { 2598 elementPlayers.forEach((player) => player.destroy()); 2599 this._engine.playersByElement.delete(element); 2600 } 2601 } 2602 _signalRemovalForInnerTriggers(rootElement, context) { 2603 const elements = this._engine.driver.query(rootElement, NG_TRIGGER_SELECTOR, true); 2604 elements.forEach((elm) => { 2605 if (elm[REMOVAL_FLAG]) return; 2606 const namespaces = this._engine.fetchNamespacesByElement(elm); 2607 if (namespaces.size) { 2608 namespaces.forEach((ns) => ns.triggerLeaveAnimation(elm, context, false, true)); 2609 } else { 2610 this.clearElementCache(elm); 2611 } 2612 }); 2613 this._engine.afterFlushAnimationsDone(() => elements.forEach((elm) => this.clearElementCache(elm))); 2614 } 2615 triggerLeaveAnimation(element, context, destroyAfterComplete, defaultToFallback) { 2616 const triggerStates = this._engine.statesByElement.get(element); 2617 const previousTriggersValues = /* @__PURE__ */ new Map(); 2618 if (triggerStates) { 2619 const players = []; 2620 triggerStates.forEach((state, triggerName) => { 2621 previousTriggersValues.set(triggerName, state.value); 2622 if (this._triggers.has(triggerName)) { 2623 const player = this.trigger(element, triggerName, VOID_VALUE, defaultToFallback); 2624 if (player) { 2625 players.push(player); 2626 } 2627 } 2628 }); 2629 if (players.length) { 2630 this._engine.markElementAsRemoved(this.id, element, true, context, previousTriggersValues); 2631 if (destroyAfterComplete) { 2632 optimizeGroupPlayer(players).onDone(() => this._engine.processLeaveNode(element)); 2633 } 2634 return true; 2635 } 2636 } 2637 return false; 2638 } 2639 prepareLeaveAnimationListeners(element) { 2640 const listeners = this._elementListeners.get(element); 2641 const elementStates = this._engine.statesByElement.get(element); 2642 if (listeners && elementStates) { 2643 const visitedTriggers = /* @__PURE__ */ new Set(); 2644 listeners.forEach((listener) => { 2645 const triggerName = listener.name; 2646 if (visitedTriggers.has(triggerName)) return; 2647 visitedTriggers.add(triggerName); 2648 const trigger = this._triggers.get(triggerName); 2649 const transition = trigger.fallbackTransition; 2650 const fromState = elementStates.get(triggerName) || DEFAULT_STATE_VALUE; 2651 const toState = new StateValue(VOID_VALUE); 2652 const player = new TransitionAnimationPlayer(this.id, triggerName, element); 2653 this._engine.totalQueuedPlayers++; 2654 this._queue.push({ 2655 element, 2656 triggerName, 2657 transition, 2658 fromState, 2659 toState, 2660 player, 2661 isFallbackTransition: true 2662 }); 2663 }); 2664 } 2665 } 2666 removeNode(element, context) { 2667 const engine = this._engine; 2668 if (element.childElementCount) { 2669 this._signalRemovalForInnerTriggers(element, context); 2670 } 2671 if (this.triggerLeaveAnimation(element, context, true)) return; 2672 let containsPotentialParentTransition = false; 2673 if (engine.totalAnimations) { 2674 const currentPlayers = engine.players.length ? engine.playersByQueriedElement.get(element) : []; 2675 if (currentPlayers && currentPlayers.length) { 2676 containsPotentialParentTransition = true; 2677 } else { 2678 let parent = element; 2679 while (parent = parent.parentNode) { 2680 const triggers = engine.statesByElement.get(parent); 2681 if (triggers) { 2682 containsPotentialParentTransition = true; 2683 break; 2684 } 2685 } 2686 } 2687 } 2688 this.prepareLeaveAnimationListeners(element); 2689 if (containsPotentialParentTransition) { 2690 engine.markElementAsRemoved(this.id, element, false, context); 2691 } else { 2692 const removalFlag = element[REMOVAL_FLAG]; 2693 if (!removalFlag || removalFlag === NULL_REMOVAL_STATE) { 2694 engine.afterFlush(() => this.clearElementCache(element)); 2695 engine.destroyInnerAnimations(element); 2696 engine._onRemovalComplete(element, context); 2697 } 2698 } 2699 } 2700 insertNode(element, parent) { 2701 addClass(element, this._hostClassName); 2702 } 2703 drainQueuedTransitions(microtaskId) { 2704 const instructions = []; 2705 this._queue.forEach((entry) => { 2706 const player = entry.player; 2707 if (player.destroyed) return; 2708 const element = entry.element; 2709 const listeners = this._elementListeners.get(element); 2710 if (listeners) { 2711 listeners.forEach((listener) => { 2712 if (listener.name == entry.triggerName) { 2713 const baseEvent = makeAnimationEvent(element, entry.triggerName, entry.fromState.value, entry.toState.value); 2714 baseEvent["_data"] = microtaskId; 2715 listenOnPlayer(entry.player, listener.phase, baseEvent, listener.callback); 2716 } 2717 }); 2718 } 2719 if (player.markedForDestroy) { 2720 this._engine.afterFlush(() => { 2721 player.destroy(); 2722 }); 2723 } else { 2724 instructions.push(entry); 2725 } 2726 }); 2727 this._queue = []; 2728 return instructions.sort((a, b) => { 2729 const d0 = a.transition.ast.depCount; 2730 const d1 = b.transition.ast.depCount; 2731 if (d0 == 0 || d1 == 0) { 2732 return d0 - d1; 2733 } 2734 return this._engine.driver.containsElement(a.element, b.element) ? 1 : -1; 2735 }); 2736 } 2737 destroy(context) { 2738 this.players.forEach((p) => p.destroy()); 2739 this._signalRemovalForInnerTriggers(this.hostElement, context); 2740 } 2741}; 2742var TransitionAnimationEngine = class { 2743 bodyNode; 2744 driver; 2745 _normalizer; 2746 players = []; 2747 newHostElements = /* @__PURE__ */ new Map(); 2748 playersByElement = /* @__PURE__ */ new Map(); 2749 playersByQueriedElement = /* @__PURE__ */ new Map(); 2750 statesByElement = /* @__PURE__ */ new Map(); 2751 disabledNodes = /* @__PURE__ */ new Set(); 2752 totalAnimations = 0; 2753 totalQueuedPlayers = 0; 2754 _namespaceLookup = {}; 2755 _namespaceList = []; 2756 _flushFns = []; 2757 _whenQuietFns = []; 2758 namespacesByHostElement = /* @__PURE__ */ new Map(); 2759 collectedEnterElements = []; 2760 collectedLeaveElements = []; 2761 // this method is designed to be overridden by the code that uses this engine 2762 onRemovalComplete = (element, context) => { 2763 }; 2764 /** @internal */ 2765 _onRemovalComplete(element, context) { 2766 this.onRemovalComplete(element, context); 2767 } 2768 constructor(bodyNode, driver, _normalizer) { 2769 this.bodyNode = bodyNode; 2770 this.driver = driver; 2771 this._normalizer = _normalizer; 2772 } 2773 get queuedPlayers() { 2774 const players = []; 2775 this._namespaceList.forEach((ns) => { 2776 ns.players.forEach((player) => { 2777 if (player.queued) { 2778 players.push(player); 2779 } 2780 }); 2781 }); 2782 return players; 2783 } 2784 createNamespace(namespaceId, hostElement) { 2785 const ns = new AnimationTransitionNamespace(namespaceId, hostElement, this); 2786 if (this.bodyNode && this.driver.containsElement(this.bodyNode, hostElement)) { 2787 this._balanceNamespaceList(ns, hostElement); 2788 } else { 2789 this.newHostElements.set(hostElement, ns); 2790 this.collectEnterElement(hostElement); 2791 } 2792 return this._namespaceLookup[namespaceId] = ns; 2793 } 2794 _balanceNamespaceList(ns, hostElement) { 2795 const namespaceList = this._namespaceList; 2796 const namespacesByHostElement = this.namespacesByHostElement; 2797 const limit = namespaceList.length - 1; 2798 if (limit >= 0) { 2799 let found = false; 2800 let ancestor = this.driver.getParentElement(hostElement); 2801 while (ancestor) { 2802 const ancestorNs = namespacesByHostElement.get(ancestor); 2803 if (ancestorNs) { 2804 const index = namespaceList.indexOf(ancestorNs); 2805 namespaceList.splice(index + 1, 0, ns); 2806 found = true; 2807 break; 2808 } 2809 ancestor = this.driver.getParentElement(ancestor); 2810 } 2811 if (!found) { 2812 namespaceList.unshift(ns); 2813 } 2814 } else { 2815 namespaceList.push(ns); 2816 } 2817 namespacesByHostElement.set(hostElement, ns); 2818 return ns; 2819 } 2820 register(namespaceId, hostElement) { 2821 let ns = this._namespaceLookup[namespaceId]; 2822 if (!ns) { 2823 ns = this.createNamespace(namespaceId, hostElement); 2824 } 2825 return ns; 2826 } 2827 registerTrigger(namespaceId, name, trigger) { 2828 let ns = this._namespaceLookup[namespaceId]; 2829 if (ns && ns.register(name, trigger)) { 2830 this.totalAnimations++; 2831 } 2832 } 2833 destroy(namespaceId, context) { 2834 if (!namespaceId) return; 2835 this.afterFlush(() => { 2836 }); 2837 this.afterFlushAnimationsDone(() => { 2838 const ns = this._fetchNamespace(namespaceId); 2839 this.namespacesByHostElement.delete(ns.hostElement); 2840 const index = this._namespaceList.indexOf(ns); 2841 if (index >= 0) { 2842 this._namespaceList.splice(index, 1); 2843 } 2844 ns.destroy(context); 2845 delete this._namespaceLookup[namespaceId]; 2846 }); 2847 } 2848 _fetchNamespace(id) { 2849 return this._namespaceLookup[id]; 2850 } 2851 fetchNamespacesByElement(element) { 2852 const namespaces = /* @__PURE__ */ new Set(); 2853 const elementStates = this.statesByElement.get(element); 2854 if (elementStates) { 2855 for (let stateValue of elementStates.values()) { 2856 if (stateValue.namespaceId) { 2857 const ns = this._fetchNamespace(stateValue.namespaceId); 2858 if (ns) { 2859 namespaces.add(ns); 2860 } 2861 } 2862 } 2863 } 2864 return namespaces; 2865 } 2866 trigger(namespaceId, element, name, value) { 2867 if (isElementNode(element)) { 2868 const ns = this._fetchNamespace(namespaceId); 2869 if (ns) { 2870 ns.trigger(element, name, value); 2871 return true; 2872 } 2873 } 2874 return false; 2875 } 2876 insertNode(namespaceId, element, parent, insertBefore) { 2877 if (!isElementNode(element)) return; 2878 const details = element[REMOVAL_FLAG]; 2879 if (details && details.setForRemoval) { 2880 details.setForRemoval = false; 2881 details.setForMove = true; 2882 const index = this.collectedLeaveElements.indexOf(element); 2883 if (index >= 0) { 2884 this.collectedLeaveElements.splice(index, 1); 2885 } 2886 } 2887 if (namespaceId) { 2888 const ns = this._fetchNamespace(namespaceId); 2889 if (ns) { 2890 ns.insertNode(element, parent); 2891 } 2892 } 2893 if (insertBefore) { 2894 this.collectEnterElement(element); 2895 } 2896 } 2897 collectEnterElement(element) { 2898 this.collectedEnterElements.push(element); 2899 } 2900 markElementAsDisabled(element, value) { 2901 if (value) { 2902 if (!this.disabledNodes.has(element)) { 2903 this.disabledNodes.add(element); 2904 addClass(element, DISABLED_CLASSNAME); 2905 } 2906 } else if (this.disabledNodes.has(element)) { 2907 this.disabledNodes.delete(element); 2908 removeClass(element, DISABLED_CLASSNAME); 2909 } 2910 } 2911 removeNode(namespaceId, element, context) { 2912 if (isElementNode(element)) { 2913 const ns = namespaceId ? this._fetchNamespace(namespaceId) : null; 2914 if (ns) { 2915 ns.removeNode(element, context); 2916 } else { 2917 this.markElementAsRemoved(namespaceId, element, false, context); 2918 } 2919 const hostNS = this.namespacesByHostElement.get(element); 2920 if (hostNS && hostNS.id !== namespaceId) { 2921 hostNS.removeNode(element, context); 2922 } 2923 } else { 2924 this._onRemovalComplete(element, context); 2925 } 2926 } 2927 markElementAsRemoved(namespaceId, element, hasAnimation, context, previousTriggersValues) { 2928 this.collectedLeaveElements.push(element); 2929 element[REMOVAL_FLAG] = { 2930 namespaceId, 2931 setForRemoval: context, 2932 hasAnimation, 2933 removedBeforeQueried: false, 2934 previousTriggersValues 2935 }; 2936 } 2937 listen(namespaceId, element, name, phase, callback) { 2938 if (isElementNode(element)) { 2939 return this._fetchNamespace(namespaceId).listen(element, name, phase, callback); 2940 } 2941 return () => { 2942 }; 2943 } 2944 _buildInstruction(entry, subTimelines, enterClassName, leaveClassName, skipBuildAst) { 2945 return entry.transition.build(this.driver, entry.element, entry.fromState.value, entry.toState.value, enterClassName, leaveClassName, entry.fromState.options, entry.toState.options, subTimelines, skipBuildAst); 2946 } 2947 destroyInnerAnimations(containerElement) { 2948 let elements = this.driver.query(containerElement, NG_TRIGGER_SELECTOR, true); 2949 elements.forEach((element) => this.destroyActiveAnimationsForElement(element)); 2950 if (this.playersByQueriedElement.size == 0) return; 2951 elements = this.driver.query(containerElement, NG_ANIMATING_SELECTOR, true); 2952 elements.forEach((element) => this.finishActiveQueriedAnimationOnElement(element)); 2953 } 2954 destroyActiveAnimationsForElement(element) { 2955 const players = this.playersByElement.get(element); 2956 if (players) { 2957 players.forEach((player) => { 2958 if (player.queued) { 2959 player.markedForDestroy = true; 2960 } else { 2961 player.destroy(); 2962 } 2963 }); 2964 } 2965 } 2966 finishActiveQueriedAnimationOnElement(element) { 2967 const players = this.playersByQueriedElement.get(element); 2968 if (players) { 2969 players.forEach((player) => player.finish()); 2970 } 2971 } 2972 whenRenderingDone() { 2973 return new Promise((resolve) => { 2974 if (this.players.length) { 2975 return optimizeGroupPlayer(this.players).onDone(() => resolve()); 2976 } else { 2977 resolve(); 2978 } 2979 }); 2980 } 2981 processLeaveNode(element) { 2982 const details = element[REMOVAL_FLAG]; 2983 if (details && details.setForRemoval) { 2984 element[REMOVAL_FLAG] = NULL_REMOVAL_STATE; 2985 if (details.namespaceId) { 2986 this.destroyInnerAnimations(element); 2987 const ns = this._fetchNamespace(details.namespaceId); 2988 if (ns) { 2989 ns.clearElementCache(element); 2990 } 2991 } 2992 this._onRemovalComplete(element, details.setForRemoval); 2993 } 2994 if (element.classList?.contains(DISABLED_CLASSNAME)) { 2995 this.markElementAsDisabled(element, false); 2996 } 2997 this.driver.query(element, DISABLED_SELECTOR, true).forEach((node) => { 2998 this.markElementAsDisabled(node, false); 2999 }); 3000 } 3001 flush(microtaskId = -1) { 3002 let players = []; 3003 if (this.newHostElements.size) { 3004 this.newHostElements.forEach((ns, element) => this._balanceNamespaceList(ns, element)); 3005 this.newHostElements.clear(); 3006 } 3007 if (this.totalAnimations && this.collectedEnterElements.length) { 3008 for (let i = 0; i < this.collectedEnterElements.length; i++) { 3009 const elm = this.collectedEnterElements[i]; 3010 addClass(elm, STAR_CLASSNAME); 3011 } 3012 } 3013 if (this._namespaceList.length && (this.totalQueuedPlayers || this.collectedLeaveElements.length)) { 3014 const cleanupFns = []; 3015 try { 3016 players = this._flushAnimations(cleanupFns, microtaskId); 3017 } finally { 3018 for (let i = 0; i < cleanupFns.length; i++) { 3019 cleanupFns[i](); 3020 } 3021 } 3022 } else { 3023 for (let i = 0; i < this.collectedLeaveElements.length; i++) { 3024 const element = this.collectedLeaveElements[i]; 3025 this.processLeaveNode(element); 3026 } 3027 } 3028 this.totalQueuedPlayers = 0; 3029 this.collectedEnterElements.length = 0; 3030 this.collectedLeaveElements.length = 0; 3031 this._flushFns.forEach((fn) => fn()); 3032 this._flushFns = []; 3033 if (this._whenQuietFns.length) { 3034 const quietFns = this._whenQuietFns; 3035 this._whenQuietFns = []; 3036 if (players.length) { 3037 optimizeGroupPlayer(players).onDone(() => { 3038 quietFns.forEach((fn) => fn()); 3039 }); 3040 } else { 3041 quietFns.forEach((fn) => fn()); 3042 } 3043 } 3044 } 3045 reportError(errors) { 3046 throw triggerTransitionsFailed(errors); 3047 } 3048 _flushAnimations(cleanupFns, microtaskId) { 3049 const subTimelines = new ElementInstructionMap(); 3050 const skippedPlayers = []; 3051 const skippedPlayersMap = /* @__PURE__ */ new Map(); 3052 const queuedInstructions = []; 3053 const queriedElements = /* @__PURE__ */ new Map(); 3054 const allPreStyleElements = /* @__PURE__ */ new Map(); 3055 const allPostStyleElements = /* @__PURE__ */ new Map(); 3056 const disabledElementsSet = /* @__PURE__ */ new Set(); 3057 this.disabledNodes.forEach((node) => { 3058 disabledElementsSet.add(node); 3059 const nodesThatAreDisabled = this.driver.query(node, QUEUED_SELECTOR, true); 3060 for (let i2 = 0; i2 < nodesThatAreDisabled.length; i2++) { 3061 disabledElementsSet.add(nodesThatAreDisabled[i2]); 3062 } 3063 }); 3064 const bodyNode = this.bodyNode; 3065 const allTriggerElements = Array.from(this.statesByElement.keys()); 3066 const enterNodeMap = buildRootMap(allTriggerElements, this.collectedEnterElements); 3067 const enterNodeMapIds = /* @__PURE__ */ new Map(); 3068 let i = 0; 3069 enterNodeMap.forEach((nodes, root) => { 3070 const className = ENTER_CLASSNAME + i++; 3071 enterNodeMapIds.set(root, className); 3072 nodes.forEach((node) => addClass(node, className)); 3073 }); 3074 const allLeaveNodes = []; 3075 const mergedLeaveNodes = /* @__PURE__ */ new Set(); 3076 const leaveNodesWithoutAnimations = /* @__PURE__ */ new Set(); 3077 for (let i2 = 0; i2 < this.collectedLeaveElements.length; i2++) { 3078 const element = this.collectedLeaveElements[i2]; 3079 const details = element[REMOVAL_FLAG]; 3080 if (details && details.setForRemoval) { 3081 allLeaveNodes.push(element); 3082 mergedLeaveNodes.add(element); 3083 if (details.hasAnimation) { 3084 this.driver.query(element, STAR_SELECTOR, true).forEach((elm) => mergedLeaveNodes.add(elm)); 3085 } else { 3086 leaveNodesWithoutAnimations.add(element); 3087 } 3088 } 3089 } 3090 const leaveNodeMapIds = /* @__PURE__ */ new Map(); 3091 const leaveNodeMap = buildRootMap(allTriggerElements, Array.from(mergedLeaveNodes)); 3092 leaveNodeMap.forEach((nodes, root) => { 3093 const className = LEAVE_CLASSNAME + i++; 3094 leaveNodeMapIds.set(root, className); 3095 nodes.forEach((node) => addClass(node, className)); 3096 }); 3097 cleanupFns.push(() => { 3098 enterNodeMap.forEach((nodes, root) => { 3099 const className = enterNodeMapIds.get(root); 3100 nodes.forEach((node) => removeClass(node, className)); 3101 }); 3102 leaveNodeMap.forEach((nodes, root) => { 3103 const className = leaveNodeMapIds.get(root); 3104 nodes.forEach((node) => removeClass(node, className)); 3105 }); 3106 allLeaveNodes.forEach((element) => { 3107 this.processLeaveNode(element); 3108 }); 3109 }); 3110 const allPlayers = []; 3111 const erroneousTransitions = []; 3112 for (let i2 = this._namespaceList.length - 1; i2 >= 0; i2--) { 3113 const ns = this._namespaceList[i2]; 3114 ns.drainQueuedTransitions(microtaskId).forEach((entry) => { 3115 const player = entry.player; 3116 const element = entry.element; 3117 allPlayers.push(player); 3118 if (this.collectedEnterElements.length) { 3119 const details = element[REMOVAL_FLAG]; 3120 if (details && details.setForMove) { 3121 if (details.previousTriggersValues && details.previousTriggersValues.has(entry.triggerName)) { 3122 const previousValue = details.previousTriggersValues.get(entry.triggerName); 3123 const triggersWithStates = this.statesByElement.get(entry.element); 3124 if (triggersWithStates && triggersWithStates.has(entry.triggerName)) { 3125 const state = triggersWithStates.get(entry.triggerName); 3126 state.value = previousValue; 3127 triggersWithStates.set(entry.triggerName, state); 3128 } 3129 } 3130 player.destroy(); 3131 return; 3132 } 3133 } 3134 const nodeIsOrphaned = !bodyNode || !this.driver.containsElement(bodyNode, element); 3135 const leaveClassName = leaveNodeMapIds.get(element); 3136 const enterClassName = enterNodeMapIds.get(element); 3137 const instruction = this._buildInstruction(entry, subTimelines, enterClassName, leaveClassName, nodeIsOrphaned); 3138 if (instruction.errors && instruction.errors.length) { 3139 erroneousTransitions.push(instruction); 3140 return; 3141 } 3142 if (nodeIsOrphaned) { 3143 player.onStart(() => eraseStyles(element, instruction.fromStyles)); 3144 player.onDestroy(() => setStyles(element, instruction.toStyles)); 3145 skippedPlayers.push(player); 3146 return; 3147 } 3148 if (entry.isFallbackTransition) { 3149 player.onStart(() => eraseStyles(element, instruction.fromStyles)); 3150 player.onDestroy(() => setStyles(element, instruction.toStyles)); 3151 skippedPlayers.push(player); 3152 return; 3153 } 3154 const timelines = []; 3155 instruction.timelines.forEach((tl) => { 3156 tl.stretchStartingKeyframe = true; 3157 if (!this.disabledNodes.has(tl.element)) { 3158 timelines.push(tl); 3159 } 3160 }); 3161 instruction.timelines = timelines; 3162 subTimelines.append(element, instruction.timelines); 3163 const tuple = { 3164 instruction, 3165 player, 3166 element 3167 }; 3168 queuedInstructions.push(tuple); 3169 instruction.queriedElements.forEach((element2) => getOrSetDefaultValue(queriedElements, element2, []).push(player)); 3170 instruction.preStyleProps.forEach((stringMap, element2) => { 3171 if (stringMap.size) { 3172 let setVal = allPreStyleElements.get(element2); 3173 if (!setVal) { 3174 allPreStyleElements.set(element2, setVal = /* @__PURE__ */ new Set()); 3175 } 3176 stringMap.forEach((_, prop) => setVal.add(prop)); 3177 } 3178 }); 3179 instruction.postStyleProps.forEach((stringMap, element2) => { 3180 let setVal = allPostStyleElements.get(element2); 3181 if (!setVal) { 3182 allPostStyleElements.set(element2, setVal = /* @__PURE__ */ new Set()); 3183 } 3184 stringMap.forEach((_, prop) => setVal.add(prop)); 3185 }); 3186 }); 3187 } 3188 if (erroneousTransitions.length) { 3189 const errors = []; 3190 erroneousTransitions.forEach((instruction) => { 3191 errors.push(transitionFailed(instruction.triggerName, instruction.errors)); 3192 }); 3193 allPlayers.forEach((player) => player.destroy()); 3194 this.reportError(errors); 3195 } 3196 const allPreviousPlayersMap = /* @__PURE__ */ new Map(); 3197 const animationElementMap = /* @__PURE__ */ new Map(); 3198 queuedInstructions.forEach((entry) => { 3199 const element = entry.element; 3200 if (subTimelines.has(element)) { 3201 animationElementMap.set(element, element); 3202 this._beforeAnimationBuild(entry.player.namespaceId, entry.instruction, allPreviousPlayersMap); 3203 } 3204 }); 3205 skippedPlayers.forEach((player) => { 3206 const element = player.element; 3207 const previousPlayers = this._getPreviousPlayers(element, false, player.namespaceId, player.triggerName, null); 3208 previousPlayers.forEach((prevPlayer) => { 3209 getOrSetDefaultValue(allPreviousPlayersMap, element, []).push(prevPlayer); 3210 prevPlayer.destroy(); 3211 }); 3212 }); 3213 const replaceNodes = allLeaveNodes.filter((node) => { 3214 return replacePostStylesAsPre(node, allPreStyleElements, allPostStyleElements); 3215 }); 3216 const postStylesMap = /* @__PURE__ */ new Map(); 3217 const allLeaveQueriedNodes = cloakAndComputeStyles(postStylesMap, this.driver, leaveNodesWithoutAnimations, allPostStyleElements, AUTO_STYLE); 3218 allLeaveQueriedNodes.forEach((node) => { 3219 if (replacePostStylesAsPre(node, allPreStyleElements, allPostStyleElements)) { 3220 replaceNodes.push(node); 3221 } 3222 }); 3223 const preStylesMap = /* @__PURE__ */ new Map(); 3224 enterNodeMap.forEach((nodes, root) => { 3225 cloakAndComputeStyles(preStylesMap, this.driver, new Set(nodes), allPreStyleElements, \u0275PRE_STYLE); 3226 }); 3227 replaceNodes.forEach((node) => { 3228 const post = postStylesMap.get(node); 3229 const pre = preStylesMap.get(node); 3230 postStylesMap.set(node, new Map([...post?.entries() ?? [], ...pre?.entries() ?? []])); 3231 }); 3232 const rootPlayers = []; 3233 const subPlayers = []; 3234 const NO_PARENT_ANIMATION_ELEMENT_DETECTED = {}; 3235 queuedInstructions.forEach((entry) => { 3236 const { 3237 element, 3238 player, 3239 instruction 3240 } = entry; 3241 if (subTimelines.has(element)) { 3242 if (disabledElementsSet.has(element)) { 3243 player.onDestroy(() => setStyles(element, instruction.toStyles)); 3244 player.disabled = true; 3245 player.overrideTotalTime(instruction.totalTime); 3246 skippedPlayers.push(player); 3247 return; 3248 } 3249 let parentWithAnimation = NO_PARENT_ANIMATION_ELEMENT_DETECTED; 3250 if (animationElementMap.size > 1) { 3251 let elm = element; 3252 const parentsToAdd = []; 3253 while (elm = elm.parentNode) { 3254 const detectedParent = animationElementMap.get(elm); 3255 if (detectedParent) { 3256 parentWithAnimation = detectedParent; 3257 break; 3258 } 3259 parentsToAdd.push(elm); 3260 } 3261 parentsToAdd.forEach((parent) => animationElementMap.set(parent, parentWithAnimation)); 3262 } 3263 const innerPlayer = this._buildAnimation(player.namespaceId, instruction, allPreviousPlayersMap, skippedPlayersMap, preStylesMap, postStylesMap); 3264 player.setRealPlayer(innerPlayer); 3265 if (parentWithAnimation === NO_PARENT_ANIMATION_ELEMENT_DETECTED) { 3266 rootPlayers.push(player); 3267 } else { 3268 const parentPlayers = this.playersByElement.get(parentWithAnimation); 3269 if (parentPlayers && parentPlayers.length) { 3270 player.parentPlayer = optimizeGroupPlayer(parentPlayers); 3271 } 3272 skippedPlayers.push(player); 3273 } 3274 } else { 3275 eraseStyles(element, instruction.fromStyles); 3276 player.onDestroy(() => setStyles(element, instruction.toStyles)); 3277 subPlayers.push(player); 3278 if (disabledElementsSet.has(element)) { 3279 skippedPlayers.push(player); 3280 } 3281 } 3282 }); 3283 subPlayers.forEach((player) => { 3284 const playersForElement = skippedPlayersMap.get(player.element); 3285 if (playersForElement && playersForElement.length) { 3286 const innerPlayer = optimizeGroupPlayer(playersForElement); 3287 player.setRealPlayer(innerPlayer); 3288 } 3289 }); 3290 skippedPlayers.forEach((player) => { 3291 if (player.parentPlayer) { 3292 player.syncPlayerEvents(player.parentPlayer); 3293 } else { 3294 player.destroy(); 3295 } 3296 }); 3297 for (let i2 = 0; i2 < allLeaveNodes.length; i2++) { 3298 const element = allLeaveNodes[i2]; 3299 const details = element[REMOVAL_FLAG]; 3300 removeClass(element, LEAVE_CLASSNAME); 3301 if (details && details.hasAnimation) continue; 3302 let players = []; 3303 if (queriedElements.size) { 3304 let queriedPlayerResults = queriedElements.get(element); 3305 if (queriedPlayerResults && queriedPlayerResults.length) { 3306 players.push(...queriedPlayerResults); 3307 } 3308 let queriedInnerElements = this.driver.query(element, NG_ANIMATING_SELECTOR, true); 3309 for (let j = 0; j < queriedInnerElements.length; j++) { 3310 let queriedPlayers = queriedElements.get(queriedInnerElements[j]); 3311 if (queriedPlayers && queriedPlayers.length) { 3312 players.push(...queriedPlayers); 3313 } 3314 } 3315 } 3316 const activePlayers = players.filter((p) => !p.destroyed); 3317 if (activePlayers.length) { 3318 removeNodesAfterAnimationDone(this, element, activePlayers); 3319 } else { 3320 this.processLeaveNode(element); 3321 } 3322 } 3323 allLeaveNodes.length = 0; 3324 rootPlayers.forEach((player) => { 3325 this.players.push(player); 3326 player.onDone(() => { 3327 player.destroy(); 3328 const index = this.players.indexOf(player); 3329 this.players.splice(index, 1); 3330 }); 3331 player.play(); 3332 }); 3333 return rootPlayers; 3334 } 3335 afterFlush(callback) { 3336 this._flushFns.push(callback); 3337 } 3338 afterFlushAnimationsDone(callback) { 3339 this._whenQuietFns.push(callback); 3340 } 3341 _getPreviousPlayers(element, isQueriedElement, namespaceId, triggerName, toStateValue) { 3342 let players = []; 3343 if (isQueriedElement) { 3344 const queriedElementPlayers = this.playersByQueriedElement.get(element); 3345 if (queriedElementPlayers) { 3346 players = queriedElementPlayers; 3347 } 3348 } else { 3349 const elementPlayers = this.playersByElement.get(element); 3350 if (elementPlayers) { 3351 const isRemovalAnimation = !toStateValue || toStateValue == VOID_VALUE; 3352 elementPlayers.forEach((player) => { 3353 if (player.queued) return; 3354 if (!isRemovalAnimation && player.triggerName != triggerName) return; 3355 players.push(player); 3356 }); 3357 } 3358 } 3359 if (namespaceId || triggerName) { 3360 players = players.filter((player) => { 3361 if (namespaceId && namespaceId != player.namespaceId) return false; 3362 if (triggerName && triggerName != player.triggerName) return false; 3363 return true; 3364 }); 3365 } 3366 return players; 3367 } 3368 _beforeAnimationBuild(namespaceId, instruction, allPreviousPlayersMap) { 3369 const triggerName = instruction.triggerName; 3370 const rootElement = instruction.element; 3371 const targetNameSpaceId = instruction.isRemovalTransition ? void 0 : namespaceId; 3372 const targetTriggerName = instruction.isRemovalTransition ? void 0 : triggerName; 3373 for (const timelineInstruction of instruction.timelines) { 3374 const element = timelineInstruction.element; 3375 const isQueriedElement = element !== rootElement; 3376 const players = getOrSetDefaultValue(allPreviousPlayersMap, element, []); 3377 const previousPlayers = this._getPreviousPlayers(element, isQueriedElement, targetNameSpaceId, targetTriggerName, instruction.toState); 3378 previousPlayers.forEach((player) => { 3379 const realPlayer = player.getRealPlayer(); 3380 if (realPlayer.beforeDestroy) { 3381 realPlayer.beforeDestroy(); 3382 } 3383 player.destroy(); 3384 players.push(player); 3385 }); 3386 } 3387 eraseStyles(rootElement, instruction.fromStyles); 3388 } 3389 _buildAnimation(namespaceId, instruction, allPreviousPlayersMap, skippedPlayersMap, preStylesMap, postStylesMap) { 3390 const triggerName = instruction.triggerName; 3391 const rootElement = instruction.element; 3392 const allQueriedPlayers = []; 3393 const allConsumedElements = /* @__PURE__ */ new Set(); 3394 const allSubElements = /* @__PURE__ */ new Set(); 3395 const allNewPlayers = instruction.timelines.map((timelineInstruction) => { 3396 const element = timelineInstruction.element; 3397 allConsumedElements.add(element); 3398 const details = element[REMOVAL_FLAG]; 3399 if (details && details.removedBeforeQueried) return new NoopAnimationPlayer(timelineInstruction.duration, timelineInstruction.delay); 3400 const isQueriedElement = element !== rootElement; 3401 const previousPlayers = flattenGroupPlayers((allPreviousPlayersMap.get(element) || EMPTY_PLAYER_ARRAY).map((p) => p.getRealPlayer())).filter((p) => { 3402 const pp = p; 3403 return pp.element ? pp.element === element : false; 3404 }); 3405 const preStyles = preStylesMap.get(element); 3406 const postStyles = postStylesMap.get(element); 3407 const keyframes = normalizeKeyframes$1(this._normalizer, timelineInstruction.keyframes, preStyles, postStyles); 3408 const player2 = this._buildPlayer(timelineInstruction, keyframes, previousPlayers); 3409 if (timelineInstruction.subTimeline && skippedPlayersMap) { 3410 allSubElements.add(element); 3411 } 3412 if (isQueriedElement) { 3413 const wrappedPlayer = new TransitionAnimationPlayer(namespaceId, triggerName, element); 3414 wrappedPlayer.setRealPlayer(player2); 3415 allQueriedPlayers.push(wrappedPlayer); 3416 } 3417 return player2; 3418 }); 3419 allQueriedPlayers.forEach((player2) => { 3420 getOrSetDefaultValue(this.playersByQueriedElement, player2.element, []).push(player2); 3421 player2.onDone(() => deleteOrUnsetInMap(this.playersByQueriedElement, player2.element, player2)); 3422 }); 3423 allConsumedElements.forEach((element) => addClass(element, NG_ANIMATING_CLASSNAME)); 3424 const player = optimizeGroupPlayer(allNewPlayers); 3425 player.onDestroy(() => { 3426 allConsumedElements.forEach((element) => removeClass(element, NG_ANIMATING_CLASSNAME)); 3427 setStyles(rootElement, instruction.toStyles); 3428 }); 3429 allSubElements.forEach((element) => { 3430 getOrSetDefaultValue(skippedPlayersMap, element, []).push(player); 3431 }); 3432 return player; 3433 } 3434 _buildPlayer(instruction, keyframes, previousPlayers) { 3435 if (keyframes.length > 0) { 3436 return this.driver.animate(instruction.element, keyframes, instruction.duration, instruction.delay, instruction.easing, previousPlayers); 3437 } 3438 return new NoopAnimationPlayer(instruction.duration, instruction.delay); 3439 } 3440}; 3441var TransitionAnimationPlayer = class { 3442 namespaceId; 3443 triggerName; 3444 element; 3445 _player = new NoopAnimationPlayer(); 3446 _containsRealPlayer = false; 3447 _queuedCallbacks = /* @__PURE__ */ new Map(); 3448 destroyed = false; 3449 parentPlayer = null; 3450 markedForDestroy = false; 3451 disabled = false; 3452 queued = true; 3453 totalTime = 0; 3454 constructor(namespaceId, triggerName, element) { 3455 this.namespaceId = namespaceId; 3456 this.triggerName = triggerName; 3457 this.element = element; 3458 } 3459 setRealPlayer(player) { 3460 if (this._containsRealPlayer) return; 3461 this._player = player; 3462 this._queuedCallbacks.forEach((callbacks, phase) => { 3463 callbacks.forEach((callback) => listenOnPlayer(player, phase, void 0, callback)); 3464 }); 3465 this._queuedCallbacks.clear(); 3466 this._containsRealPlayer = true; 3467 this.overrideTotalTime(player.totalTime); 3468 this.queued = false; 3469 } 3470 getRealPlayer() { 3471 return this._player; 3472 } 3473 overrideTotalTime(totalTime) { 3474 this.totalTime = totalTime; 3475 } 3476 syncPlayerEvents(player) { 3477 const p = this._player; 3478 if (p.triggerCallback) { 3479 player.onStart(() => p.triggerCallback("start")); 3480 } 3481 player.onDone(() => this.finish()); 3482 player.onDestroy(() => this.destroy()); 3483 } 3484 _queueEvent(name, callback) { 3485 getOrSetDefaultValue(this._queuedCallbacks, name, []).push(callback); 3486 } 3487 onDone(fn) { 3488 if (this.queued) { 3489 this._queueEvent("done", fn); 3490 } 3491 this._player.onDone(fn); 3492 } 3493 onStart(fn) { 3494 if (this.queued) { 3495 this._queueEvent("start", fn); 3496 } 3497 this._player.onStart(fn); 3498 } 3499 onDestroy(fn) { 3500 if (this.queued) { 3501 this._queueEvent("destroy", fn); 3502 } 3503 this._player.onDestroy(fn); 3504 } 3505 init() { 3506 this._player.init(); 3507 } 3508 hasStarted() { 3509 return this.queued ? false : this._player.hasStarted(); 3510 } 3511 play() { 3512 !this.queued && this._player.play(); 3513 } 3514 pause() { 3515 !this.queued && this._player.pause(); 3516 } 3517 restart() { 3518 !this.queued && this._player.restart(); 3519 } 3520 finish() { 3521 this._player.finish(); 3522 } 3523 destroy() { 3524 this.destroyed = true; 3525 this._player.destroy(); 3526 } 3527 reset() { 3528 !this.queued && this._player.reset(); 3529 } 3530 setPosition(p) { 3531 if (!this.queued) { 3532 this._player.setPosition(p); 3533 } 3534 } 3535 getPosition() { 3536 return this.queued ? 0 : this._player.getPosition(); 3537 } 3538 /** @internal */ 3539 triggerCallback(phaseName) { 3540 const p = this._player; 3541 if (p.triggerCallback) { 3542 p.triggerCallback(phaseName); 3543 } 3544 } 3545}; 3546function deleteOrUnsetInMap(map, key, value) { 3547 let currentValues = map.get(key); 3548 if (currentValues) { 3549 if (currentValues.length) { 3550 const index = currentValues.indexOf(value); 3551 currentValues.splice(index, 1); 3552 } 3553 if (currentValues.length == 0) { 3554 map.delete(key); 3555 } 3556 } 3557 return currentValues; 3558} 3559function normalizeTriggerValue(value) { 3560 return value != null ? value : null; 3561} 3562function isElementNode(node) { 3563 return node && node["nodeType"] === 1; 3564} 3565function isTriggerEventValid(eventName) { 3566 return eventName == "start" || eventName == "done"; 3567} 3568function cloakElement(element, value) { 3569 const oldValue = element.style.display; 3570 element.style.display = value != null ? value : "none"; 3571 return oldValue; 3572} 3573function cloakAndComputeStyles(valuesMap, driver, elements, elementPropsMap, defaultStyle) { 3574 const cloakVals = []; 3575 elements.forEach((element) => cloakVals.push(cloakElement(element))); 3576 const failedElements = []; 3577 elementPropsMap.forEach((props, element) => { 3578 const styles = /* @__PURE__ */ new Map(); 3579 props.forEach((prop) => { 3580 const value = driver.computeStyle(element, prop, defaultStyle); 3581 styles.set(prop, value); 3582 if (!value || value.length == 0) { 3583 element[REMOVAL_FLAG] = NULL_REMOVED_QUERIED_STATE; 3584 failedElements.push(element); 3585 } 3586 }); 3587 valuesMap.set(element, styles); 3588 }); 3589 let i = 0; 3590 elements.forEach((element) => cloakElement(element, cloakVals[i++])); 3591 return failedElements; 3592} 3593function buildRootMap(roots, nodes) { 3594 const rootMap = /* @__PURE__ */ new Map(); 3595 roots.forEach((root) => rootMap.set(root, [])); 3596 if (nodes.length == 0) return rootMap; 3597 const NULL_NODE = 1; 3598 const nodeSet = new Set(nodes); 3599 const localRootMap = /* @__PURE__ */ new Map(); 3600 function getRoot(node) { 3601 if (!node) return NULL_NODE; 3602 let root = localRootMap.get(node); 3603 if (root) return root; 3604 const parent = node.parentNode; 3605 if (rootMap.has(parent)) { 3606 root = parent; 3607 } else if (nodeSet.has(parent)) { 3608 root = NULL_NODE; 3609 } else { 3610 root = getRoot(parent); 3611 } 3612 localRootMap.set(node, root); 3613 return root; 3614 } 3615 nodes.forEach((node) => { 3616 const root = getRoot(node); 3617 if (root !== NULL_NODE) { 3618 rootMap.get(root).push(node); 3619 } 3620 }); 3621 return rootMap; 3622} 3623function addClass(element, className) { 3624 element.classList?.add(className); 3625} 3626function removeClass(element, className) { 3627 element.classList?.remove(className); 3628} 3629function removeNodesAfterAnimationDone(engine, element, players) { 3630 optimizeGroupPlayer(players).onDone(() => engine.processLeaveNode(element)); 3631} 3632function flattenGroupPlayers(players) { 3633 const finalPlayers = []; 3634 _flattenGroupPlayersRecur(players, finalPlayers); 3635 return finalPlayers; 3636} 3637function _flattenGroupPlayersRecur(players, finalPlayers) { 3638 for (let i = 0; i < players.length; i++) { 3639 const player = players[i]; 3640 if (player instanceof AnimationGroupPlayer) { 3641 _flattenGroupPlayersRecur(player.players, finalPlayers); 3642 } else { 3643 finalPlayers.push(player); 3644 } 3645 } 3646} 3647function objEquals(a, b) { 3648 const k1 = Object.keys(a); 3649 const k2 = Object.keys(b); 3650 if (k1.length != k2.length) return false; 3651 for (let i = 0; i < k1.length; i++) { 3652 const prop = k1[i]; 3653 if (!b.hasOwnProperty(prop) || a[prop] !== b[prop]) return false; 3654 } 3655 return true; 3656} 3657function replacePostStylesAsPre(element, allPreStyleElements, allPostStyleElements) { 3658 const postEntry = allPostStyleElements.get(element); 3659 if (!postEntry) return false; 3660 let preEntry = allPreStyleElements.get(element); 3661 if (preEntry) { 3662 postEntry.forEach((data) => preEntry.add(data)); 3663 } else { 3664 allPreStyleElements.set(element, postEntry); 3665 } 3666 allPostStyleElements.delete(element); 3667 return true; 3668} 3669var AnimationEngine = class { 3670 _driver; 3671 _normalizer; 3672 _transitionEngine; 3673 _timelineEngine; 3674 _triggerCache = {}; 3675 // this method is designed to be overridden by the code that uses this engine 3676 onRemovalComplete = (element, context) => { 3677 }; 3678 constructor(doc, _driver, _normalizer) { 3679 this._driver = _driver; 3680 this._normalizer = _normalizer; 3681 this._transitionEngine = new TransitionAnimationEngine(doc.body, _driver, _normalizer); 3682 this._timelineEngine = new TimelineAnimationEngine(doc.body, _driver, _normalizer); 3683 this._transitionEngine.onRemovalComplete = (element, context) => this.onRemovalComplete(element, context); 3684 } 3685 registerTrigger(componentId, namespaceId, hostElement, name, metadata) { 3686 const cacheKey = componentId + "-" + name; 3687 let trigger = this._triggerCache[cacheKey]; 3688 if (!trigger) { 3689 const errors = []; 3690 const warnings = []; 3691 const ast = buildAnimationAst(this._driver, metadata, errors, warnings); 3692 if (errors.length) { 3693 throw triggerBuildFailed(name, errors); 3694 } 3695 if (typeof ngDevMode === "undefined" || ngDevMode) { 3696 if (warnings.length) { 3697 warnTriggerBuild(name, warnings); 3698 } 3699 } 3700 trigger = buildTrigger(name, ast, this._normalizer); 3701 this._triggerCache[cacheKey] = trigger; 3702 } 3703 this._transitionEngine.registerTrigger(namespaceId, name, trigger); 3704 } 3705 register(namespaceId, hostElement) { 3706 this._transitionEngine.register(namespaceId, hostElement); 3707 } 3708 destroy(namespaceId, context) { 3709 this._transitionEngine.destroy(namespaceId, context); 3710 } 3711 onInsert(namespaceId, element, parent, insertBefore) { 3712 this._transitionEngine.insertNode(namespaceId, element, parent, insertBefore); 3713 } 3714 onRemove(namespaceId, element, context) { 3715 this._transitionEngine.removeNode(namespaceId, element, context); 3716 } 3717 disableAnimations(element, disable) { 3718 this._transitionEngine.markElementAsDisabled(element, disable); 3719 } 3720 process(namespaceId, element, property, value) { 3721 if (property.charAt(0) == "@") { 3722 const [id, action] = parseTimelineCommand(property); 3723 const args = value; 3724 this._timelineEngine.command(id, element, action, args); 3725 } else { 3726 this._transitionEngine.trigger(namespaceId, element, property, value); 3727 } 3728 } 3729 listen(namespaceId, element, eventName, eventPhase, callback) { 3730 if (eventName.charAt(0) == "@") { 3731 const [id, action] = parseTimelineCommand(eventName); 3732 return this._timelineEngine.listen(id, element, action, callback); 3733 } 3734 return this._transitionEngine.listen(namespaceId, element, eventName, eventPhase, callback); 3735 } 3736 flush(microtaskId = -1) { 3737 this._transitionEngine.flush(microtaskId); 3738 } 3739 get players() { 3740 return [...this._transitionEngine.players, ...this._timelineEngine.players]; 3741 } 3742 whenRenderingDone() { 3743 return this._transitionEngine.whenRenderingDone(); 3744 } 3745 afterFlushAnimationsDone(cb) { 3746 this._transitionEngine.afterFlushAnimationsDone(cb); 3747 } 3748}; 3749function packageNonAnimatableStyles(element, styles) { 3750 let startStyles = null; 3751 let endStyles = null; 3752 if (Array.isArray(styles) && styles.length) { 3753 startStyles = filterNonAnimatableStyles(styles[0]); 3754 if (styles.length > 1) { 3755 endStyles = filterNonAnimatableStyles(styles[styles.length - 1]); 3756 } 3757 } else if (styles instanceof Map) { 3758 startStyles = filterNonAnimatableStyles(styles); 3759 } 3760 return startStyles || endStyles ? new SpecialCasedStyles(element, startStyles, endStyles) : null; 3761} 3762var SpecialCasedStyles = class _SpecialCasedStyles { 3763 _element; 3764 _startStyles; 3765 _endStyles; 3766 static initialStylesByElement = /* @__PURE__ */ new WeakMap(); 3767 _state = 0; 3768 _initialStyles; 3769 constructor(_element, _startStyles, _endStyles) { 3770 this._element = _element; 3771 this._startStyles = _startStyles; 3772 this._endStyles = _endStyles; 3773 let initialStyles = _SpecialCasedStyles.initialStylesByElement.get(_element); 3774 if (!initialStyles) { 3775 _SpecialCasedStyles.initialStylesByElement.set(_element, initialStyles = /* @__PURE__ */ new Map()); 3776 } 3777 this._initialStyles = initialStyles; 3778 } 3779 start() { 3780 if (this._state < 1) { 3781 if (this._startStyles) { 3782 setStyles(this._element, this._startStyles, this._initialStyles); 3783 } 3784 this._state = 1; 3785 } 3786 } 3787 finish() { 3788 this.start(); 3789 if (this._state < 2) { 3790 setStyles(this._element, this._initialStyles); 3791 if (this._endStyles) { 3792 setStyles(this._element, this._endStyles); 3793 this._endStyles = null; 3794 } 3795 this._state = 1; 3796 } 3797 } 3798 destroy() { 3799 this.finish(); 3800 if (this._state < 3) { 3801 _SpecialCasedStyles.initialStylesByElement.delete(this._element); 3802 if (this._startStyles) { 3803 eraseStyles(this._element, this._startStyles); 3804 this._endStyles = null; 3805 } 3806 if (this._endStyles) { 3807 eraseStyles(this._element, this._endStyles); 3808 this._endStyles = null; 3809 } 3810 setStyles(this._element, this._initialStyles); 3811 this._state = 3; 3812 } 3813 } 3814}; 3815function filterNonAnimatableStyles(styles) { 3816 let result = null; 3817 styles.forEach((val, prop) => { 3818 if (isNonAnimatableStyle(prop)) { 3819 result = result || /* @__PURE__ */ new Map(); 3820 result.set(prop, val); 3821 } 3822 }); 3823 return result; 3824} 3825function isNonAnimatableStyle(prop) { 3826 return prop === "display" || prop === "position"; 3827} 3828var WebAnimationsPlayer = class { 3829 element; 3830 keyframes; 3831 options; 3832 _specialStyles; 3833 _onDoneFns = []; 3834 _onStartFns = []; 3835 _onDestroyFns = []; 3836 _duration; 3837 _delay; 3838 _initialized = false; 3839 _finished = false; 3840 _started = false; 3841 _destroyed = false; 3842 _finalKeyframe; 3843 // the following original fns are persistent copies of the _onStartFns and _onDoneFns 3844 // and are used to reset the fns to their original values upon reset() 3845 // (since the _onStartFns and _onDoneFns get deleted after they are called) 3846 _originalOnDoneFns = []; 3847 _originalOnStartFns = []; 3848 domPlayer = null; 3849 time = 0; 3850 parentPlayer = null; 3851 currentSnapshot = /* @__PURE__ */ new Map(); 3852 constructor(element, keyframes, options, _specialStyles) { 3853 this.element = element; 3854 this.keyframes = keyframes; 3855 this.options = options; 3856 this._specialStyles = _specialStyles; 3857 this._duration = options["duration"]; 3858 this._delay = options["delay"] || 0; 3859 this.time = this._duration + this._delay; 3860 } 3861 _onFinish() { 3862 if (!this._finished) { 3863 this._finished = true; 3864 this._onDoneFns.forEach((fn) => fn()); 3865 this._onDoneFns = []; 3866 } 3867 } 3868 init() { 3869 if (!this._buildPlayer()) { 3870 return; 3871 } 3872 this._preparePlayerBeforeStart(); 3873 } 3874 _buildPlayer() { 3875 if (this._initialized) return this.domPlayer; 3876 this._initialized = true; 3877 const keyframes = this.keyframes; 3878 const animation = this._triggerWebAnimation(this.element, keyframes, this.options); 3879 if (!animation) { 3880 this._onFinish(); 3881 return null; 3882 } 3883 this.domPlayer = animation; 3884 this._finalKeyframe = keyframes.length ? keyframes[keyframes.length - 1] : /* @__PURE__ */ new Map(); 3885 const onFinish = () => this._onFinish(); 3886 animation.addEventListener("finish", onFinish); 3887 this.onDestroy(() => { 3888 animation.removeEventListener("finish", onFinish); 3889 }); 3890 return animation; 3891 } 3892 _preparePlayerBeforeStart() { 3893 if (this._delay) { 3894 this._resetDomPlayerState(); 3895 } else { 3896 this.domPlayer?.pause(); 3897 } 3898 } 3899 _convertKeyframesToObject(keyframes) { 3900 const kfs = []; 3901 keyframes.forEach((frame) => { 3902 kfs.push(Object.fromEntries(frame)); 3903 }); 3904 return kfs; 3905 } 3906 /** @internal */ 3907 _triggerWebAnimation(element, keyframes, options) { 3908 const keyframesObject = this._convertKeyframesToObject(keyframes); 3909 try { 3910 return element.animate(keyframesObject, options); 3911 } catch { 3912 return null; 3913 } 3914 } 3915 onStart(fn) { 3916 this._originalOnStartFns.push(fn); 3917 this._onStartFns.push(fn); 3918 } 3919 onDone(fn) { 3920 this._originalOnDoneFns.push(fn); 3921 this._onDoneFns.push(fn); 3922 } 3923 onDestroy(fn) { 3924 this._onDestroyFns.push(fn); 3925 } 3926 play() { 3927 const player = this._buildPlayer(); 3928 if (!player) { 3929 return; 3930 } 3931 if (!this.hasStarted()) { 3932 this._onStartFns.forEach((fn) => fn()); 3933 this._onStartFns = []; 3934 this._started = true; 3935 if (this._specialStyles) { 3936 this._specialStyles.start(); 3937 } 3938 } 3939 player.play(); 3940 } 3941 pause() { 3942 this.init(); 3943 this.domPlayer?.pause(); 3944 } 3945 finish() { 3946 this.init(); 3947 if (!this.domPlayer) return; 3948 if (this._specialStyles) { 3949 this._specialStyles.finish(); 3950 } 3951 this._onFinish(); 3952 this.domPlayer.finish(); 3953 } 3954 reset() { 3955 this._resetDomPlayerState(); 3956 this._destroyed = false; 3957 this._finished = false; 3958 this._started = false; 3959 this._onStartFns = this._originalOnStartFns; 3960 this._onDoneFns = this._originalOnDoneFns; 3961 } 3962 _resetDomPlayerState() { 3963 this.domPlayer?.cancel(); 3964 } 3965 restart() { 3966 this.reset(); 3967 this.play(); 3968 } 3969 hasStarted() { 3970 return this._started; 3971 } 3972 destroy() { 3973 if (!this._destroyed) { 3974 this._destroyed = true; 3975 this._resetDomPlayerState(); 3976 this._onFinish(); 3977 if (this._specialStyles) { 3978 this._specialStyles.destroy(); 3979 } 3980 this._onDestroyFns.forEach((fn) => fn()); 3981 this._onDestroyFns = []; 3982 } 3983 } 3984 setPosition(p) { 3985 if (!this.domPlayer) { 3986 this.init(); 3987 } 3988 if (this.domPlayer) { 3989 this.domPlayer.currentTime = p * this.time; 3990 } 3991 } 3992 getPosition() { 3993 if (!this.domPlayer) { 3994 return this._initialized ? 1 : 0; 3995 } 3996 return +(this.domPlayer.currentTime ?? 0) / this.time; 3997 } 3998 get totalTime() { 3999 return this._delay + this._duration; 4000 } 4001 beforeDestroy() { 4002 const styles = /* @__PURE__ */ new Map(); 4003 if (this.hasStarted()) { 4004 const finalKeyframe = this._finalKeyframe; 4005 finalKeyframe.forEach((val, prop) => { 4006 if (prop !== "offset") { 4007 styles.set(prop, this._finished ? val : computeStyle(this.element, prop)); 4008 } 4009 }); 4010 } 4011 this.currentSnapshot = styles; 4012 } 4013 /** @internal */ 4014 triggerCallback(phaseName) { 4015 const methods = phaseName === "start" ? this._onStartFns : this._onDoneFns; 4016 methods.forEach((fn) => fn()); 4017 methods.length = 0; 4018 } 4019}; 4020var WebAnimationsDriver = class { 4021 validateStyleProperty(prop) { 4022 if (typeof ngDevMode === "undefined" || ngDevMode) { 4023 return validateStyleProperty(prop); 4024 } 4025 return true; 4026 } 4027 validateAnimatableStyleProperty(prop) { 4028 if (typeof ngDevMode === "undefined" || ngDevMode) { 4029 const cssProp = camelCaseToDashCase(prop); 4030 return validateWebAnimatableStyleProperty(cssProp); 4031 } 4032 return true; 4033 } 4034 containsElement(elm1, elm2) { 4035 return containsElement(elm1, elm2); 4036 } 4037 getParentElement(element) { 4038 return getParentElement(element); 4039 } 4040 query(element, selector, multi) { 4041 return invokeQuery(element, selector, multi); 4042 } 4043 computeStyle(element, prop, defaultValue) { 4044 return computeStyle(element, prop); 4045 } 4046 animate(element, keyframes, duration, delay, easing, previousPlayers = []) { 4047 const fill = delay == 0 ? "both" : "forwards"; 4048 const playerOptions = { 4049 duration, 4050 delay, 4051 fill 4052 }; 4053 if (easing) { 4054 playerOptions["easing"] = easing; 4055 } 4056 const previousStyles = /* @__PURE__ */ new Map(); 4057 const previousWebAnimationPlayers = previousPlayers.filter((player) => player instanceof WebAnimationsPlayer); 4058 if (allowPreviousPlayerStylesMerge(duration, delay)) { 4059 previousWebAnimationPlayers.forEach((player) => { 4060 player.currentSnapshot.forEach((val, prop) => previousStyles.set(prop, val)); 4061 }); 4062 } 4063 let _keyframes = normalizeKeyframes(keyframes).map((styles) => new Map(styles)); 4064 _keyframes = balancePreviousStylesIntoKeyframes(element, _keyframes, previousStyles); 4065 const specialStyles = packageNonAnimatableStyles(element, _keyframes); 4066 return new WebAnimationsPlayer(element, _keyframes, playerOptions, specialStyles); 4067 } 4068}; 4069var ANIMATION_PREFIX = "@"; 4070var DISABLE_ANIMATIONS_FLAG = "@.disabled"; 4071var BaseAnimationRenderer = class { 4072 namespaceId; 4073 delegate; 4074 engine; 4075 _onDestroy; 4076 // We need to explicitly type this property because of an api-extractor bug 4077 // See https://github.com/microsoft/rushstack/issues/4390 4078 \u0275type = 0; 4079 constructor(namespaceId, delegate, engine, _onDestroy) { 4080 this.namespaceId = namespaceId; 4081 this.delegate = delegate; 4082 this.engine = engine; 4083 this._onDestroy = _onDestroy; 4084 } 4085 get data() { 4086 return this.delegate.data; 4087 } 4088 destroyNode(node) { 4089 this.delegate.destroyNode?.(node); 4090 } 4091 destroy() { 4092 this.engine.destroy(this.namespaceId, this.delegate); 4093 this.engine.afterFlushAnimationsDone(() => { 4094 queueMicrotask(() => { 4095 this.delegate.destroy(); 4096 }); 4097 }); 4098 this._onDestroy?.(); 4099 } 4100 createElement(name, namespace) { 4101 return this.delegate.createElement(name, namespace); 4102 } 4103 createComment(value) { 4104 return this.delegate.createComment(value); 4105 } 4106 createText(value) { 4107 return this.delegate.createText(value); 4108 } 4109 appendChild(parent, newChild) { 4110 this.delegate.appendChild(parent, newChild); 4111 this.engine.onInsert(this.namespaceId, newChild, parent, false); 4112 } 4113 insertBefore(parent, newChild, refChild, isMove = true) { 4114 this.delegate.insertBefore(parent, newChild, refChild); 4115 this.engine.onInsert(this.namespaceId, newChild, parent, isMove); 4116 } 4117 // TODO(thePunderWoman): remove the requireSynchronousElementRemoval flag after the 4118 // animations package has been fully deleted post v23. 4119 removeChild(parent, oldChild, isHostElement, requireSynchronousElementRemoval) { 4120 if (requireSynchronousElementRemoval) { 4121 this.delegate.removeChild(parent, oldChild, isHostElement, requireSynchronousElementRemoval); 4122 return; 4123 } 4124 if (this.parentNode(oldChild)) { 4125 this.engine.onRemove(this.namespaceId, oldChild, this.delegate); 4126 } 4127 } 4128 selectRootElement(selectorOrNode, preserveContent) { 4129 return this.delegate.selectRootElement(selectorOrNode, preserveContent); 4130 } 4131 parentNode(node) { 4132 return this.delegate.parentNode(node); 4133 } 4134 nextSibling(node) { 4135 return this.delegate.nextSibling(node); 4136 } 4137 setAttribute(el, name, value, namespace) { 4138 this.delegate.setAttribute(el, name, value, namespace); 4139 } 4140 removeAttribute(el, name, namespace) { 4141 this.delegate.removeAttribute(el, name, namespace); 4142 } 4143 addClass(el, name) { 4144 this.delegate.addClass(el, name); 4145 } 4146 removeClass(el, name) { 4147 this.delegate.removeClass(el, name); 4148 } 4149 setStyle(el, style2, value, flags) { 4150 this.delegate.setStyle(el, style2, value, flags); 4151 } 4152 removeStyle(el, style2, flags) { 4153 this.delegate.removeStyle(el, style2, flags); 4154 } 4155 setProperty(el, name, value) { 4156 if (name.charAt(0) == ANIMATION_PREFIX && name == DISABLE_ANIMATIONS_FLAG) { 4157 this.disableAnimations(el, !!value); 4158 } else { 4159 this.delegate.setProperty(el, name, value); 4160 } 4161 } 4162 setValue(node, value) { 4163 this.delegate.setValue(node, value); 4164 } 4165 listen(target, eventName, callback, options) { 4166 return this.delegate.listen(target, eventName, callback, options); 4167 } 4168 disableAnimations(element, value) { 4169 this.engine.disableAnimations(element, value); 4170 } 4171}; 4172var AnimationRenderer = class extends BaseAnimationRenderer { 4173 factory; 4174 constructor(factory, namespaceId, delegate, engine, onDestroy) { 4175 super(namespaceId, delegate, engine, onDestroy); 4176 this.factory = factory; 4177 this.namespaceId = namespaceId; 4178 } 4179 setProperty(el, name, value) { 4180 if (name.charAt(0) == ANIMATION_PREFIX) { 4181 if (name.charAt(1) == "." && name == DISABLE_ANIMATIONS_FLAG) { 4182 value = value === void 0 ? true : !!value; 4183 this.disableAnimations(el, value); 4184 } else { 4185 this.engine.process(this.namespaceId, el, name.slice(1), value); 4186 } 4187 } else { 4188 this.delegate.setProperty(el, name, value); 4189 } 4190 } 4191 listen(target, eventName, callback, options) { 4192 if (eventName.charAt(0) == ANIMATION_PREFIX) { 4193 const element = resolveElementFromTarget(target); 4194 let name = eventName.slice(1); 4195 let phase = ""; 4196 if (name.charAt(0) != ANIMATION_PREFIX) { 4197 [name, phase] = parseTriggerCallbackName(name); 4198 } 4199 return this.engine.listen(this.namespaceId, element, name, phase, (event) => { 4200 const countId = event["_data"] || -1; 4201 this.factory.scheduleListenerCallback(countId, callback, event); 4202 }); 4203 } 4204 return this.delegate.listen(target, eventName, callback, options); 4205 } 4206}; 4207function resolveElementFromTarget(target) { 4208 switch (target) { 4209 case "body": 4210 return document.body; 4211 case "document": 4212 return document; 4213 case "window": 4214 return window; 4215 default: 4216 return target; 4217 } 4218} 4219function parseTriggerCallbackName(triggerName) { 4220 const dotIndex = triggerName.indexOf("."); 4221 const trigger = triggerName.substring(0, dotIndex); 4222 const phase = triggerName.slice(dotIndex + 1); 4223 return [trigger, phase]; 4224} 4225var AnimationRendererFactory = class { 4226 delegate; 4227 engine; 4228 _zone; 4229 _currentId = 0; 4230 _microtaskId = 1; 4231 _animationCallbacksBuffer = []; 4232 _rendererCache = /* @__PURE__ */ new Map(); 4233 _cdRecurDepth = 0; 4234 constructor(delegate, engine, _zone) { 4235 this.delegate = delegate; 4236 this.engine = engine; 4237 this._zone = _zone; 4238 engine.onRemovalComplete = (element, delegate2) => { 4239 delegate2?.removeChild(null, element); 4240 }; 4241 } 4242 createRenderer(hostElement, type) { 4243 const EMPTY_NAMESPACE_ID = ""; 4244 const delegate = this.delegate.createRenderer(hostElement, type); 4245 if (!hostElement || !type?.data?.["animation"]) { 4246 const cache = this._rendererCache; 4247 let renderer = cache.get(delegate); 4248 if (!renderer) { 4249 const onRendererDestroy = () => cache.delete(delegate); 4250 renderer = new BaseAnimationRenderer(EMPTY_NAMESPACE_ID, delegate, this.engine, onRendererDestroy); 4251 cache.set(delegate, renderer); 4252 } 4253 return renderer; 4254 } 4255 const componentId = type.id; 4256 const namespaceId = type.id + "-" + this._currentId; 4257 this._currentId++; 4258 this.engine.register(namespaceId, hostElement); 4259 const registerTrigger = (trigger) => { 4260 if (Array.isArray(trigger)) { 4261 trigger.forEach(registerTrigger); 4262 } else { 4263 this.engine.registerTrigger(componentId, namespaceId, hostElement, trigger.name, trigger); 4264 } 4265 }; 4266 const animationTriggers = type.data["animation"]; 4267 animationTriggers.forEach(registerTrigger); 4268 return new AnimationRenderer(this, namespaceId, delegate, this.engine); 4269 } 4270 begin() { 4271 this._cdRecurDepth++; 4272 if (this.delegate.begin) { 4273 this.delegate.begin(); 4274 } 4275 } 4276 _scheduleCountTask() { 4277 queueMicrotask(() => { 4278 this._microtaskId++; 4279 }); 4280 } 4281 /** @internal */ 4282 scheduleListenerCallback(count, fn, data) { 4283 if (count >= 0 && count < this._microtaskId) { 4284 this._zone.run(() => fn(data)); 4285 return; 4286 } 4287 const animationCallbacksBuffer = this._animationCallbacksBuffer; 4288 if (animationCallbacksBuffer.length == 0) { 4289 queueMicrotask(() => { 4290 this._zone.run(() => { 4291 animationCallbacksBuffer.forEach((tuple) => { 4292 const [fn2, data2] = tuple; 4293 fn2(data2); 4294 }); 4295 this._animationCallbacksBuffer = []; 4296 }); 4297 }); 4298 } 4299 animationCallbacksBuffer.push([fn, data]); 4300 } 4301 end() { 4302 this._cdRecurDepth--; 4303 if (this._cdRecurDepth == 0) { 4304 this._zone.runOutsideAngular(() => { 4305 this._scheduleCountTask(); 4306 this.engine.flush(this._microtaskId); 4307 }); 4308 } 4309 if (this.delegate.end) { 4310 this.delegate.end(); 4311 } 4312 } 4313 whenRenderingDone() { 4314 return this.engine.whenRenderingDone(); 4315 } 4316 /** 4317 * Used during HMR to clear any cached data about a component. 4318 * @param componentId ID of the component that is being replaced. 4319 */ 4320 componentReplaced(componentId) { 4321 this.engine.flush(); 4322 this.delegate.componentReplaced?.(componentId); 4323 } 4324}; 4325
vendor: 4,779 bytes, lines 4326-4466
4326// node_modules/@angular/platform-browser/fesm2022/animations.mjs 4327var InjectableAnimationEngine = class _InjectableAnimationEngine extends AnimationEngine { 4328 // The `ApplicationRef` is injected here explicitly to force the dependency ordering. 4329 // Since the `ApplicationRef` should be created earlier before the `AnimationEngine`, they 4330 // both have `ngOnDestroy` hooks and `flush()` must be called after all views are destroyed. 4331 constructor(doc, driver, normalizer) { 4332 super(doc, driver, normalizer); 4333 } 4334 ngOnDestroy() { 4335 this.flush(); 4336 } 4337 static \u0275fac = function InjectableAnimationEngine_Factory(__ngFactoryType__) { 4338 return new (__ngFactoryType__ || _InjectableAnimationEngine)(\u0275\u0275inject(DOCUMENT), \u0275\u0275inject(AnimationDriver), \u0275\u0275inject(AnimationStyleNormalizer)); 4339 }; 4340 static \u0275prov = /* @__PURE__ */ \u0275\u0275defineInjectable({ 4341 token: _InjectableAnimationEngine, 4342 factory: _InjectableAnimationEngine.\u0275fac 4343 }); 4344}; 4345(() => { 4346 (typeof ngDevMode === "undefined" || ngDevMode) && setClassMetadata(InjectableAnimationEngine, [{ 4347 type: Injectable 4348 }], () => [{ 4349 type: Document, 4350 decorators: [{ 4351 type: Inject, 4352 args: [DOCUMENT] 4353 }] 4354 }, { 4355 type: AnimationDriver 4356 }, { 4357 type: AnimationStyleNormalizer 4358 }], null); 4359})(); 4360function instantiateDefaultStyleNormalizer() { 4361 return new WebAnimationsStyleNormalizer(); 4362} 4363function instantiateRendererFactory(renderer, engine, zone) { 4364 return new AnimationRendererFactory(renderer, engine, zone); 4365} 4366var SHARED_ANIMATION_PROVIDERS = [{ 4367 provide: AnimationStyleNormalizer, 4368 useFactory: instantiateDefaultStyleNormalizer 4369}, { 4370 provide: AnimationEngine, 4371 useClass: InjectableAnimationEngine 4372}, { 4373 provide: RendererFactory2, 4374 useFactory: instantiateRendererFactory, 4375 deps: [DomRendererFactory2, AnimationEngine, NgZone] 4376}]; 4377var BROWSER_NOOP_ANIMATIONS_PROVIDERS = [{ 4378 provide: AnimationDriver, 4379 useClass: NoopAnimationDriver 4380}, { 4381 provide: ANIMATION_MODULE_TYPE, 4382 useValue: "NoopAnimations" 4383}, ...SHARED_ANIMATION_PROVIDERS]; 4384var BROWSER_ANIMATIONS_PROVIDERS = [ 4385 // Note: the `ngServerMode` happen inside factories to give the variable time to initialize. 4386 { 4387 provide: AnimationDriver, 4388 useFactory: () => false ? new NoopAnimationDriver() : new WebAnimationsDriver() 4389 }, 4390 { 4391 provide: ANIMATION_MODULE_TYPE, 4392 useFactory: () => false ? "NoopAnimations" : "BrowserAnimations" 4393 }, 4394 ...SHARED_ANIMATION_PROVIDERS 4395]; 4396var BrowserAnimationsModule = class _BrowserAnimationsModule { 4397 /** 4398 * Configures the module based on the specified object. 4399 * 4400 * @param config Object used to configure the behavior of the `BrowserAnimationsModule`. 4401 * @see {@link BrowserAnimationsModuleConfig} 4402 * 4403 * @usageNotes 4404 * When registering the `BrowserAnimationsModule`, you can use the `withConfig` 4405 * function as follows: 4406 * ```ts 4407 * @NgModule({ 4408 * imports: [BrowserAnimationsModule.withConfig(config)] 4409 * }) 4410 * class MyNgModule {} 4411 * ``` 4412 */ 4413 static withConfig(config) { 4414 return { 4415 ngModule: _BrowserAnimationsModule, 4416 providers: config.disableAnimations ? BROWSER_NOOP_ANIMATIONS_PROVIDERS : BROWSER_ANIMATIONS_PROVIDERS 4417 }; 4418 } 4419 static \u0275fac = function BrowserAnimationsModule_Factory(__ngFactoryType__) { 4420 return new (__ngFactoryType__ || _BrowserAnimationsModule)(); 4421 }; 4422 static \u0275mod = /* @__PURE__ */ \u0275\u0275defineNgModule({ 4423 type: _BrowserAnimationsModule, 4424 exports: [BrowserModule] 4425 }); 4426 static \u0275inj = /* @__PURE__ */ \u0275\u0275defineInjector({ 4427 providers: BROWSER_ANIMATIONS_PROVIDERS, 4428 imports: [BrowserModule] 4429 }); 4430}; 4431(() => { 4432 (typeof ngDevMode === "undefined" || ngDevMode) && setClassMetadata(BrowserAnimationsModule, [{ 4433 type: NgModule, 4434 args: [{ 4435 exports: [BrowserModule], 4436 providers: BROWSER_ANIMATIONS_PROVIDERS 4437 }] 4438 }], null, null); 4439})(); 4440function provideAnimations() { 4441 performanceMarkFeature("NgEagerAnimations"); 4442 return [...BROWSER_ANIMATIONS_PROVIDERS]; 4443} 4444var NoopAnimationsModule = class _NoopAnimationsModule { 4445 static \u0275fac = function NoopAnimationsModule_Factory(__ngFactoryType__) { 4446 return new (__ngFactoryType__ || _NoopAnimationsModule)(); 4447 }; 4448 static \u0275mod = /* @__PURE__ */ \u0275\u0275defineNgModule({ 4449 type: _NoopAnimationsModule, 4450 exports: [BrowserModule] 4451 }); 4452 static \u0275inj = /* @__PURE__ */ \u0275\u0275defineInjector({ 4453 providers: BROWSER_NOOP_ANIMATIONS_PROVIDERS, 4454 imports: [BrowserModule] 4455 }); 4456}; 4457(() => { 4458 (typeof ngDevMode === "undefined" || ngDevMode) && setClassMetadata(NoopAnimationsModule, [{ 4459 type: NgModule, 4460 args: [{ 4461 exports: [BrowserModule], 4462 providers: BROWSER_NOOP_ANIMATIONS_PROVIDERS 4463 }] 4464 }], null, null); 4465})(); 4466
4467// libs/share/translate/src/services/simple-localize-http-loader.service.ts 4468var SimpleLocalizeHttpLoaderService = class { 4469 http; 4470 nameSpace; 4471 constructor(http, nameSpace) { 4472 this.http = http; 4473 this.nameSpace = nameSpace; 4474 } 4475 getTranslation(lang) { 4476 const projectToken = "86356ef03af844568958848219888ebe"; 4477 const version = "_latest"; 4478 lang = lang.replace("-", "_"); 4479 if (lang === "pt_PT") { 4480 lang = "pt_BR"; 4481 } 4482 return this.http.get(`https://cdn.simplelocalize.io/${projectToken}/${version}/${lang}/${this.nameSpace}`); 4483 } 4484}; 4485
4486// apps/onboarding-ai/src/app/app.routes.ts 4487var appRoutes = [ 4488 { 4489 path: "", 4490 loadComponent: () => import("./chunk-WTY7DBXL.js").then((m) => m.OnboardingComponent) 4491 }, 4492 { 4493 path: "results", 4494 loadComponent: () => import("./chunk-3YQ52EXM.js").then((m) => m.ResultsComponent) 4495 }, 4496 { 4497 path: "create-hotel", 4498 loadComponent: () => import("./chunk-AEJW4TZM.js").then((m) => m.CreateHotelComponent) 4499 }, 4500 { 4501 path: "app-ready", 4502 loadComponent: () => import("./chunk-E3NL74QW.js").then((m) => m.AppReadyComponent) 4503 }, 4504 { 4505 path: "try-assistant", 4506 loadComponent: () => import("./chunk-VLLHJTQS.js").then((m) => m.TryAssistantComponent) 4507 }, 4508 { 4509 path: "**", 4510 redirectTo: "" 4511 } 4512]; 4513
4514// apps/onboarding-ai/src/app/app.config.ts 4515function HttpLoaderFactory(http) { 4516 return new SimpleLocalizeHttpLoaderService(http, "onboarding"); 4517} 4518var appConfig = { 4519 providers: [ 4520 provideZoneChangeDetection({ eventCoalescing: true }), 4521 provideRouter(appRoutes), 4522 provideStore(), 4523 provideHttpClient(), 4524 importProvidersFrom(TranslateModule.forRoot({ 4525 loader: { provide: TranslateLoader, useFactory: HttpLoaderFactory, deps: [HttpClient] }, 4526 defaultLanguage: getActualLan().replace("-", "_"), 4527 useDefaultLang: true 4528 })), 4529 { provide: API_URL, useValue: environment.apiUrl }, 4530 { 4531 provide: ASSISTANTS_URL, 4532 useValue: environment.assistantUrl 4533 }, 4534 { 4535 provide: MENU_UPLOADER_URL, 4536 useValue: "" 4537 }, 4538 { 4539 provide: API_RESERVATION_URL, 4540 useValue: environment.apiReservation 4541 }, 4542 provideFirebaseApp(() => initializeApp(environment.firebase)), 4543 provideAuth((injector) => { 4544 const app = injector.get(FirebaseApp); 4545 const auth = getAuth(app); 4546 return auth; 4547 }), 4548 provideFirestore((injector) => { 4549 const app = injector.get(FirebaseApp); 4550 const firestore = getFirestore(app); 4551 return firestore; 4552 }), 4553 provideDatabase((injector) => { 4554 const app = injector.get(FirebaseApp); 4555 const database = getDatabase(app); 4556 return database; 4557 }), 4558 provideStorage((injector) => { 4559 const app = injector.get(FirebaseApp); 4560 const storage = getStorage(app); 4561 return storage; 4562 }), 4563 provideAnimations() 4564 ] 4565}; 4566
4567// apps/onboarding-ai/src/main.ts 4568bootstrapApplication(AppComponent, appConfig).catch((err) => console.error(err)); 4569/*! Bundled license information: 4570 4571@angular/animations/fesm2022/util.mjs: 4572@angular/animations/fesm2022/browser.mjs: 4573@angular/platform-browser/fesm2022/animations.mjs: 4574 (** 4575 * @license Angular v20.3.9 4576 * (c) 2010-2025 Google LLC. https://angular.dev/ 4577 * License: MIT 4578 *) 4579*/ 4580//# sourceMappingURL=main.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.