@andersbakken/fisk-scheduler-ui 0.0.55 → 0.0.57

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (79) hide show
  1. package/.angular/cache/18.2.21/ui/.tsbuildinfo +1 -1
  2. package/.angular/cache/18.2.21/ui/angular-compiler.db +0 -0
  3. package/.angular/cache/18.2.21/ui/angular-compiler.db-lock +0 -0
  4. package/.angular/cache/18.2.21/ui/vite/deps/@angular_common.js +201 -0
  5. package/.angular/cache/18.2.21/ui/vite/deps/@angular_common.js.map +7 -0
  6. package/.angular/cache/18.2.21/ui/vite/deps/@angular_common_http.js +85 -0
  7. package/.angular/cache/18.2.21/ui/vite/deps/@angular_common_http.js.map +7 -0
  8. package/.angular/cache/18.2.21/ui/vite/deps/@angular_core.js +932 -0
  9. package/.angular/cache/18.2.21/ui/vite/deps/@angular_core.js.map +7 -0
  10. package/.angular/cache/18.2.21/ui/vite/deps/@angular_forms.js +134 -0
  11. package/.angular/cache/18.2.21/ui/vite/deps/@angular_forms.js.map +7 -0
  12. package/.angular/cache/18.2.21/ui/vite/deps/@angular_material_button.js +33 -0
  13. package/.angular/cache/18.2.21/ui/vite/deps/@angular_material_button.js.map +7 -0
  14. package/.angular/cache/18.2.21/ui/vite/deps/@angular_material_card.js +567 -0
  15. package/.angular/cache/18.2.21/ui/vite/deps/@angular_material_card.js.map +7 -0
  16. package/.angular/cache/18.2.21/ui/vite/deps/@angular_material_checkbox.js +782 -0
  17. package/.angular/cache/18.2.21/ui/vite/deps/@angular_material_checkbox.js.map +7 -0
  18. package/.angular/cache/18.2.21/ui/vite/deps/@angular_material_core.js +98 -0
  19. package/.angular/cache/18.2.21/ui/vite/deps/@angular_material_core.js.map +7 -0
  20. package/.angular/cache/18.2.21/ui/vite/deps/@angular_material_dialog.js +1829 -0
  21. package/.angular/cache/18.2.21/ui/vite/deps/@angular_material_dialog.js.map +7 -0
  22. package/.angular/cache/18.2.21/ui/vite/deps/@angular_material_form-field.js +45 -0
  23. package/.angular/cache/18.2.21/ui/vite/deps/@angular_material_form-field.js.map +7 -0
  24. package/.angular/cache/18.2.21/ui/vite/deps/@angular_material_input.js +1014 -0
  25. package/.angular/cache/18.2.21/ui/vite/deps/@angular_material_input.js.map +7 -0
  26. package/.angular/cache/18.2.21/ui/vite/deps/@angular_material_list.js +2169 -0
  27. package/.angular/cache/18.2.21/ui/vite/deps/@angular_material_list.js.map +7 -0
  28. package/.angular/cache/18.2.21/ui/vite/deps/@angular_material_select.js +1529 -0
  29. package/.angular/cache/18.2.21/ui/vite/deps/@angular_material_select.js.map +7 -0
  30. package/.angular/cache/18.2.21/ui/vite/deps/@angular_material_snack-bar.js +940 -0
  31. package/.angular/cache/18.2.21/ui/vite/deps/@angular_material_snack-bar.js.map +7 -0
  32. package/.angular/cache/18.2.21/ui/vite/deps/@angular_material_tabs.js +2962 -0
  33. package/.angular/cache/18.2.21/ui/vite/deps/@angular_material_tabs.js.map +7 -0
  34. package/.angular/cache/18.2.21/ui/vite/deps/@angular_platform-browser.js +84 -0
  35. package/.angular/cache/18.2.21/ui/vite/deps/@angular_platform-browser.js.map +7 -0
  36. package/.angular/cache/18.2.21/ui/vite/deps/@angular_platform-browser_animations.js +4136 -0
  37. package/.angular/cache/18.2.21/ui/vite/deps/@angular_platform-browser_animations.js.map +7 -0
  38. package/.angular/cache/18.2.21/ui/vite/deps/@angular_router.js +5700 -0
  39. package/.angular/cache/18.2.21/ui/vite/deps/@angular_router.js.map +7 -0
  40. package/.angular/cache/18.2.21/ui/vite/deps/_metadata.json +172 -0
  41. package/.angular/cache/18.2.21/ui/vite/deps/chunk-2ZKE2YDD.js +1222 -0
  42. package/.angular/cache/18.2.21/ui/vite/deps/chunk-2ZKE2YDD.js.map +7 -0
  43. package/.angular/cache/18.2.21/ui/vite/deps/chunk-3OV72XIM.js +64 -0
  44. package/.angular/cache/18.2.21/ui/vite/deps/chunk-3OV72XIM.js.map +7 -0
  45. package/.angular/cache/18.2.21/ui/vite/deps/chunk-57TVY4HY.js +2218 -0
  46. package/.angular/cache/18.2.21/ui/vite/deps/chunk-57TVY4HY.js.map +7 -0
  47. package/.angular/cache/18.2.21/ui/vite/deps/chunk-A5IWFVHJ.js +2374 -0
  48. package/.angular/cache/18.2.21/ui/vite/deps/chunk-A5IWFVHJ.js.map +7 -0
  49. package/.angular/cache/18.2.21/ui/vite/deps/chunk-DJ6HHZ3S.js +1940 -0
  50. package/.angular/cache/18.2.21/ui/vite/deps/chunk-DJ6HHZ3S.js.map +7 -0
  51. package/.angular/cache/18.2.21/ui/vite/deps/chunk-FE6XYTIJ.js +126 -0
  52. package/.angular/cache/18.2.21/ui/vite/deps/chunk-FE6XYTIJ.js.map +7 -0
  53. package/.angular/cache/18.2.21/ui/vite/deps/chunk-ITHJLHIY.js +5795 -0
  54. package/.angular/cache/18.2.21/ui/vite/deps/chunk-ITHJLHIY.js.map +7 -0
  55. package/.angular/cache/18.2.21/ui/vite/deps/chunk-MFI342ZJ.js +512 -0
  56. package/.angular/cache/18.2.21/ui/vite/deps/chunk-MFI342ZJ.js.map +7 -0
  57. package/.angular/cache/18.2.21/ui/vite/deps/chunk-NPVZU53R.js +6511 -0
  58. package/.angular/cache/18.2.21/ui/vite/deps/chunk-NPVZU53R.js.map +7 -0
  59. package/.angular/cache/18.2.21/ui/vite/deps/chunk-NSRJEU3V.js +27918 -0
  60. package/.angular/cache/18.2.21/ui/vite/deps/chunk-NSRJEU3V.js.map +7 -0
  61. package/.angular/cache/18.2.21/ui/vite/deps/chunk-R2N6IWJV.js +5116 -0
  62. package/.angular/cache/18.2.21/ui/vite/deps/chunk-R2N6IWJV.js.map +7 -0
  63. package/.angular/cache/18.2.21/ui/vite/deps/chunk-TO3SXVFJ.js +2840 -0
  64. package/.angular/cache/18.2.21/ui/vite/deps/chunk-TO3SXVFJ.js.map +7 -0
  65. package/.angular/cache/18.2.21/ui/vite/deps/chunk-WFLMTRZP.js +379 -0
  66. package/.angular/cache/18.2.21/ui/vite/deps/chunk-WFLMTRZP.js.map +7 -0
  67. package/.angular/cache/18.2.21/ui/vite/deps/chunk-WQ5YUVUS.js +1534 -0
  68. package/.angular/cache/18.2.21/ui/vite/deps/chunk-WQ5YUVUS.js.map +7 -0
  69. package/.angular/cache/18.2.21/ui/vite/deps/ngx-color-picker.js +2925 -0
  70. package/.angular/cache/18.2.21/ui/vite/deps/ngx-color-picker.js.map +7 -0
  71. package/.angular/cache/18.2.21/ui/vite/deps/seedrandom.js +703 -0
  72. package/.angular/cache/18.2.21/ui/vite/deps/seedrandom.js.map +7 -0
  73. package/README.md +16 -0
  74. package/dist/ui/browser/index.html +1 -1
  75. package/dist/ui/browser/main-6SIZHY3G.js +17 -0
  76. package/package.json +3 -1
  77. package/scripts/mock-scheduler.js +350 -0
  78. package/scripts/test-live-model.js +286 -0
  79. package/dist/ui/browser/main-WR7FX6UH.js +0 -16
@@ -0,0 +1,2218 @@
1
+ import {
2
+ ArrayDataSource,
3
+ _RecycleViewRepeaterStrategy,
4
+ _VIEW_REPEATER_STRATEGY,
5
+ isDataSource
6
+ } from "./chunk-WFLMTRZP.js";
7
+ import {
8
+ BidiModule,
9
+ Directionality,
10
+ Platform,
11
+ RtlScrollAxisType,
12
+ coerceElement,
13
+ coerceNumberProperty,
14
+ getRtlScrollAxisType,
15
+ supportsScrollBehavior
16
+ } from "./chunk-ITHJLHIY.js";
17
+ import {
18
+ DOCUMENT
19
+ } from "./chunk-R2N6IWJV.js";
20
+ import {
21
+ ChangeDetectionStrategy,
22
+ ChangeDetectorRef,
23
+ Component,
24
+ ComponentFactoryResolver$1,
25
+ Directive,
26
+ ElementRef,
27
+ EventEmitter,
28
+ Inject,
29
+ Injectable,
30
+ InjectionToken,
31
+ Injector,
32
+ Input,
33
+ IterableDiffers,
34
+ NgModule,
35
+ NgZone,
36
+ Observable,
37
+ Optional,
38
+ Output,
39
+ SkipSelf,
40
+ Subject,
41
+ Subscription,
42
+ TemplateRef,
43
+ ViewChild,
44
+ ViewContainerRef,
45
+ ViewEncapsulation$1,
46
+ afterNextRender,
47
+ animationFrameScheduler,
48
+ asapScheduler,
49
+ auditTime,
50
+ booleanAttribute,
51
+ distinctUntilChanged,
52
+ filter,
53
+ forwardRef,
54
+ fromEvent,
55
+ inject,
56
+ isObservable,
57
+ of,
58
+ pairwise,
59
+ setClassMetadata,
60
+ shareReplay,
61
+ startWith,
62
+ switchMap,
63
+ takeUntil,
64
+ ɵɵInheritDefinitionFeature,
65
+ ɵɵInputTransformsFeature,
66
+ ɵɵNgOnChangesFeature,
67
+ ɵɵProvidersFeature,
68
+ ɵɵStandaloneFeature,
69
+ ɵɵadvance,
70
+ ɵɵclassProp,
71
+ ɵɵdefineComponent,
72
+ ɵɵdefineDirective,
73
+ ɵɵdefineInjectable,
74
+ ɵɵdefineInjector,
75
+ ɵɵdefineNgModule,
76
+ ɵɵdirectiveInject,
77
+ ɵɵelement,
78
+ ɵɵelementEnd,
79
+ ɵɵelementStart,
80
+ ɵɵgetInheritedFactory,
81
+ ɵɵinject,
82
+ ɵɵloadQuery,
83
+ ɵɵprojection,
84
+ ɵɵprojectionDef,
85
+ ɵɵqueryRefresh,
86
+ ɵɵstyleProp,
87
+ ɵɵviewQuery
88
+ } from "./chunk-NSRJEU3V.js";
89
+
90
+ // node_modules/@angular/cdk/fesm2022/scrolling.mjs
91
+ var _c0 = ["contentWrapper"];
92
+ var _c1 = ["*"];
93
+ var VIRTUAL_SCROLL_STRATEGY = new InjectionToken("VIRTUAL_SCROLL_STRATEGY");
94
+ var FixedSizeVirtualScrollStrategy = class {
95
+ /**
96
+ * @param itemSize The size of the items in the virtually scrolling list.
97
+ * @param minBufferPx The minimum amount of buffer (in pixels) before needing to render more
98
+ * @param maxBufferPx The amount of buffer (in pixels) to render when rendering more.
99
+ */
100
+ constructor(itemSize, minBufferPx, maxBufferPx) {
101
+ this._scrolledIndexChange = new Subject();
102
+ this.scrolledIndexChange = this._scrolledIndexChange.pipe(distinctUntilChanged());
103
+ this._viewport = null;
104
+ this._itemSize = itemSize;
105
+ this._minBufferPx = minBufferPx;
106
+ this._maxBufferPx = maxBufferPx;
107
+ }
108
+ /**
109
+ * Attaches this scroll strategy to a viewport.
110
+ * @param viewport The viewport to attach this strategy to.
111
+ */
112
+ attach(viewport) {
113
+ this._viewport = viewport;
114
+ this._updateTotalContentSize();
115
+ this._updateRenderedRange();
116
+ }
117
+ /** Detaches this scroll strategy from the currently attached viewport. */
118
+ detach() {
119
+ this._scrolledIndexChange.complete();
120
+ this._viewport = null;
121
+ }
122
+ /**
123
+ * Update the item size and buffer size.
124
+ * @param itemSize The size of the items in the virtually scrolling list.
125
+ * @param minBufferPx The minimum amount of buffer (in pixels) before needing to render more
126
+ * @param maxBufferPx The amount of buffer (in pixels) to render when rendering more.
127
+ */
128
+ updateItemAndBufferSize(itemSize, minBufferPx, maxBufferPx) {
129
+ if (maxBufferPx < minBufferPx && (typeof ngDevMode === "undefined" || ngDevMode)) {
130
+ throw Error("CDK virtual scroll: maxBufferPx must be greater than or equal to minBufferPx");
131
+ }
132
+ this._itemSize = itemSize;
133
+ this._minBufferPx = minBufferPx;
134
+ this._maxBufferPx = maxBufferPx;
135
+ this._updateTotalContentSize();
136
+ this._updateRenderedRange();
137
+ }
138
+ /** @docs-private Implemented as part of VirtualScrollStrategy. */
139
+ onContentScrolled() {
140
+ this._updateRenderedRange();
141
+ }
142
+ /** @docs-private Implemented as part of VirtualScrollStrategy. */
143
+ onDataLengthChanged() {
144
+ this._updateTotalContentSize();
145
+ this._updateRenderedRange();
146
+ }
147
+ /** @docs-private Implemented as part of VirtualScrollStrategy. */
148
+ onContentRendered() {
149
+ }
150
+ /** @docs-private Implemented as part of VirtualScrollStrategy. */
151
+ onRenderedOffsetChanged() {
152
+ }
153
+ /**
154
+ * Scroll to the offset for the given index.
155
+ * @param index The index of the element to scroll to.
156
+ * @param behavior The ScrollBehavior to use when scrolling.
157
+ */
158
+ scrollToIndex(index, behavior) {
159
+ if (this._viewport) {
160
+ this._viewport.scrollToOffset(index * this._itemSize, behavior);
161
+ }
162
+ }
163
+ /** Update the viewport's total content size. */
164
+ _updateTotalContentSize() {
165
+ if (!this._viewport) {
166
+ return;
167
+ }
168
+ this._viewport.setTotalContentSize(this._viewport.getDataLength() * this._itemSize);
169
+ }
170
+ /** Update the viewport's rendered range. */
171
+ _updateRenderedRange() {
172
+ if (!this._viewport) {
173
+ return;
174
+ }
175
+ const renderedRange = this._viewport.getRenderedRange();
176
+ const newRange = {
177
+ start: renderedRange.start,
178
+ end: renderedRange.end
179
+ };
180
+ const viewportSize = this._viewport.getViewportSize();
181
+ const dataLength = this._viewport.getDataLength();
182
+ let scrollOffset = this._viewport.measureScrollOffset();
183
+ let firstVisibleIndex = this._itemSize > 0 ? scrollOffset / this._itemSize : 0;
184
+ if (newRange.end > dataLength) {
185
+ const maxVisibleItems = Math.ceil(viewportSize / this._itemSize);
186
+ const newVisibleIndex = Math.max(0, Math.min(firstVisibleIndex, dataLength - maxVisibleItems));
187
+ if (firstVisibleIndex != newVisibleIndex) {
188
+ firstVisibleIndex = newVisibleIndex;
189
+ scrollOffset = newVisibleIndex * this._itemSize;
190
+ newRange.start = Math.floor(firstVisibleIndex);
191
+ }
192
+ newRange.end = Math.max(0, Math.min(dataLength, newRange.start + maxVisibleItems));
193
+ }
194
+ const startBuffer = scrollOffset - newRange.start * this._itemSize;
195
+ if (startBuffer < this._minBufferPx && newRange.start != 0) {
196
+ const expandStart = Math.ceil((this._maxBufferPx - startBuffer) / this._itemSize);
197
+ newRange.start = Math.max(0, newRange.start - expandStart);
198
+ newRange.end = Math.min(dataLength, Math.ceil(firstVisibleIndex + (viewportSize + this._minBufferPx) / this._itemSize));
199
+ } else {
200
+ const endBuffer = newRange.end * this._itemSize - (scrollOffset + viewportSize);
201
+ if (endBuffer < this._minBufferPx && newRange.end != dataLength) {
202
+ const expandEnd = Math.ceil((this._maxBufferPx - endBuffer) / this._itemSize);
203
+ if (expandEnd > 0) {
204
+ newRange.end = Math.min(dataLength, newRange.end + expandEnd);
205
+ newRange.start = Math.max(0, Math.floor(firstVisibleIndex - this._minBufferPx / this._itemSize));
206
+ }
207
+ }
208
+ }
209
+ this._viewport.setRenderedRange(newRange);
210
+ this._viewport.setRenderedContentOffset(this._itemSize * newRange.start);
211
+ this._scrolledIndexChange.next(Math.floor(firstVisibleIndex));
212
+ }
213
+ };
214
+ function _fixedSizeVirtualScrollStrategyFactory(fixedSizeDir) {
215
+ return fixedSizeDir._scrollStrategy;
216
+ }
217
+ var CdkFixedSizeVirtualScroll = class _CdkFixedSizeVirtualScroll {
218
+ constructor() {
219
+ this._itemSize = 20;
220
+ this._minBufferPx = 100;
221
+ this._maxBufferPx = 200;
222
+ this._scrollStrategy = new FixedSizeVirtualScrollStrategy(this.itemSize, this.minBufferPx, this.maxBufferPx);
223
+ }
224
+ /** The size of the items in the list (in pixels). */
225
+ get itemSize() {
226
+ return this._itemSize;
227
+ }
228
+ set itemSize(value) {
229
+ this._itemSize = coerceNumberProperty(value);
230
+ }
231
+ /**
232
+ * The minimum amount of buffer rendered beyond the viewport (in pixels).
233
+ * If the amount of buffer dips below this number, more items will be rendered. Defaults to 100px.
234
+ */
235
+ get minBufferPx() {
236
+ return this._minBufferPx;
237
+ }
238
+ set minBufferPx(value) {
239
+ this._minBufferPx = coerceNumberProperty(value);
240
+ }
241
+ /**
242
+ * The number of pixels worth of buffer to render for when rendering new items. Defaults to 200px.
243
+ */
244
+ get maxBufferPx() {
245
+ return this._maxBufferPx;
246
+ }
247
+ set maxBufferPx(value) {
248
+ this._maxBufferPx = coerceNumberProperty(value);
249
+ }
250
+ ngOnChanges() {
251
+ this._scrollStrategy.updateItemAndBufferSize(this.itemSize, this.minBufferPx, this.maxBufferPx);
252
+ }
253
+ static {
254
+ this.ɵfac = function CdkFixedSizeVirtualScroll_Factory(__ngFactoryType__) {
255
+ return new (__ngFactoryType__ || _CdkFixedSizeVirtualScroll)();
256
+ };
257
+ }
258
+ static {
259
+ this.ɵdir = ɵɵdefineDirective({
260
+ type: _CdkFixedSizeVirtualScroll,
261
+ selectors: [["cdk-virtual-scroll-viewport", "itemSize", ""]],
262
+ inputs: {
263
+ itemSize: "itemSize",
264
+ minBufferPx: "minBufferPx",
265
+ maxBufferPx: "maxBufferPx"
266
+ },
267
+ standalone: true,
268
+ features: [ɵɵProvidersFeature([{
269
+ provide: VIRTUAL_SCROLL_STRATEGY,
270
+ useFactory: _fixedSizeVirtualScrollStrategyFactory,
271
+ deps: [forwardRef(() => _CdkFixedSizeVirtualScroll)]
272
+ }]), ɵɵNgOnChangesFeature]
273
+ });
274
+ }
275
+ };
276
+ (() => {
277
+ (typeof ngDevMode === "undefined" || ngDevMode) && setClassMetadata(CdkFixedSizeVirtualScroll, [{
278
+ type: Directive,
279
+ args: [{
280
+ selector: "cdk-virtual-scroll-viewport[itemSize]",
281
+ standalone: true,
282
+ providers: [{
283
+ provide: VIRTUAL_SCROLL_STRATEGY,
284
+ useFactory: _fixedSizeVirtualScrollStrategyFactory,
285
+ deps: [forwardRef(() => CdkFixedSizeVirtualScroll)]
286
+ }]
287
+ }]
288
+ }], null, {
289
+ itemSize: [{
290
+ type: Input
291
+ }],
292
+ minBufferPx: [{
293
+ type: Input
294
+ }],
295
+ maxBufferPx: [{
296
+ type: Input
297
+ }]
298
+ });
299
+ })();
300
+ var DEFAULT_SCROLL_TIME = 20;
301
+ var ScrollDispatcher = class _ScrollDispatcher {
302
+ constructor(_ngZone, _platform, document2) {
303
+ this._ngZone = _ngZone;
304
+ this._platform = _platform;
305
+ this._scrolled = new Subject();
306
+ this._globalSubscription = null;
307
+ this._scrolledCount = 0;
308
+ this.scrollContainers = /* @__PURE__ */ new Map();
309
+ this._document = document2;
310
+ }
311
+ /**
312
+ * Registers a scrollable instance with the service and listens for its scrolled events. When the
313
+ * scrollable is scrolled, the service emits the event to its scrolled observable.
314
+ * @param scrollable Scrollable instance to be registered.
315
+ */
316
+ register(scrollable) {
317
+ if (!this.scrollContainers.has(scrollable)) {
318
+ this.scrollContainers.set(scrollable, scrollable.elementScrolled().subscribe(() => this._scrolled.next(scrollable)));
319
+ }
320
+ }
321
+ /**
322
+ * De-registers a Scrollable reference and unsubscribes from its scroll event observable.
323
+ * @param scrollable Scrollable instance to be deregistered.
324
+ */
325
+ deregister(scrollable) {
326
+ const scrollableReference = this.scrollContainers.get(scrollable);
327
+ if (scrollableReference) {
328
+ scrollableReference.unsubscribe();
329
+ this.scrollContainers.delete(scrollable);
330
+ }
331
+ }
332
+ /**
333
+ * Returns an observable that emits an event whenever any of the registered Scrollable
334
+ * references (or window, document, or body) fire a scrolled event. Can provide a time in ms
335
+ * to override the default "throttle" time.
336
+ *
337
+ * **Note:** in order to avoid hitting change detection for every scroll event,
338
+ * all of the events emitted from this stream will be run outside the Angular zone.
339
+ * If you need to update any data bindings as a result of a scroll event, you have
340
+ * to run the callback using `NgZone.run`.
341
+ */
342
+ scrolled(auditTimeInMs = DEFAULT_SCROLL_TIME) {
343
+ if (!this._platform.isBrowser) {
344
+ return of();
345
+ }
346
+ return new Observable((observer) => {
347
+ if (!this._globalSubscription) {
348
+ this._addGlobalListener();
349
+ }
350
+ const subscription = auditTimeInMs > 0 ? this._scrolled.pipe(auditTime(auditTimeInMs)).subscribe(observer) : this._scrolled.subscribe(observer);
351
+ this._scrolledCount++;
352
+ return () => {
353
+ subscription.unsubscribe();
354
+ this._scrolledCount--;
355
+ if (!this._scrolledCount) {
356
+ this._removeGlobalListener();
357
+ }
358
+ };
359
+ });
360
+ }
361
+ ngOnDestroy() {
362
+ this._removeGlobalListener();
363
+ this.scrollContainers.forEach((_, container) => this.deregister(container));
364
+ this._scrolled.complete();
365
+ }
366
+ /**
367
+ * Returns an observable that emits whenever any of the
368
+ * scrollable ancestors of an element are scrolled.
369
+ * @param elementOrElementRef Element whose ancestors to listen for.
370
+ * @param auditTimeInMs Time to throttle the scroll events.
371
+ */
372
+ ancestorScrolled(elementOrElementRef, auditTimeInMs) {
373
+ const ancestors = this.getAncestorScrollContainers(elementOrElementRef);
374
+ return this.scrolled(auditTimeInMs).pipe(filter((target) => {
375
+ return !target || ancestors.indexOf(target) > -1;
376
+ }));
377
+ }
378
+ /** Returns all registered Scrollables that contain the provided element. */
379
+ getAncestorScrollContainers(elementOrElementRef) {
380
+ const scrollingContainers = [];
381
+ this.scrollContainers.forEach((_subscription, scrollable) => {
382
+ if (this._scrollableContainsElement(scrollable, elementOrElementRef)) {
383
+ scrollingContainers.push(scrollable);
384
+ }
385
+ });
386
+ return scrollingContainers;
387
+ }
388
+ /** Use defaultView of injected document if available or fallback to global window reference */
389
+ _getWindow() {
390
+ return this._document.defaultView || window;
391
+ }
392
+ /** Returns true if the element is contained within the provided Scrollable. */
393
+ _scrollableContainsElement(scrollable, elementOrElementRef) {
394
+ let element = coerceElement(elementOrElementRef);
395
+ let scrollableElement = scrollable.getElementRef().nativeElement;
396
+ do {
397
+ if (element == scrollableElement) {
398
+ return true;
399
+ }
400
+ } while (element = element.parentElement);
401
+ return false;
402
+ }
403
+ /** Sets up the global scroll listeners. */
404
+ _addGlobalListener() {
405
+ this._globalSubscription = this._ngZone.runOutsideAngular(() => {
406
+ const window2 = this._getWindow();
407
+ return fromEvent(window2.document, "scroll").subscribe(() => this._scrolled.next());
408
+ });
409
+ }
410
+ /** Cleans up the global scroll listener. */
411
+ _removeGlobalListener() {
412
+ if (this._globalSubscription) {
413
+ this._globalSubscription.unsubscribe();
414
+ this._globalSubscription = null;
415
+ }
416
+ }
417
+ static {
418
+ this.ɵfac = function ScrollDispatcher_Factory(__ngFactoryType__) {
419
+ return new (__ngFactoryType__ || _ScrollDispatcher)(ɵɵinject(NgZone), ɵɵinject(Platform), ɵɵinject(DOCUMENT, 8));
420
+ };
421
+ }
422
+ static {
423
+ this.ɵprov = ɵɵdefineInjectable({
424
+ token: _ScrollDispatcher,
425
+ factory: _ScrollDispatcher.ɵfac,
426
+ providedIn: "root"
427
+ });
428
+ }
429
+ };
430
+ (() => {
431
+ (typeof ngDevMode === "undefined" || ngDevMode) && setClassMetadata(ScrollDispatcher, [{
432
+ type: Injectable,
433
+ args: [{
434
+ providedIn: "root"
435
+ }]
436
+ }], () => [{
437
+ type: NgZone
438
+ }, {
439
+ type: Platform
440
+ }, {
441
+ type: void 0,
442
+ decorators: [{
443
+ type: Optional
444
+ }, {
445
+ type: Inject,
446
+ args: [DOCUMENT]
447
+ }]
448
+ }], null);
449
+ })();
450
+ var CdkScrollable = class _CdkScrollable {
451
+ constructor(elementRef, scrollDispatcher, ngZone, dir) {
452
+ this.elementRef = elementRef;
453
+ this.scrollDispatcher = scrollDispatcher;
454
+ this.ngZone = ngZone;
455
+ this.dir = dir;
456
+ this._destroyed = new Subject();
457
+ this._elementScrolled = new Observable((observer) => this.ngZone.runOutsideAngular(() => fromEvent(this.elementRef.nativeElement, "scroll").pipe(takeUntil(this._destroyed)).subscribe(observer)));
458
+ }
459
+ ngOnInit() {
460
+ this.scrollDispatcher.register(this);
461
+ }
462
+ ngOnDestroy() {
463
+ this.scrollDispatcher.deregister(this);
464
+ this._destroyed.next();
465
+ this._destroyed.complete();
466
+ }
467
+ /** Returns observable that emits when a scroll event is fired on the host element. */
468
+ elementScrolled() {
469
+ return this._elementScrolled;
470
+ }
471
+ /** Gets the ElementRef for the viewport. */
472
+ getElementRef() {
473
+ return this.elementRef;
474
+ }
475
+ /**
476
+ * Scrolls to the specified offsets. This is a normalized version of the browser's native scrollTo
477
+ * method, since browsers are not consistent about what scrollLeft means in RTL. For this method
478
+ * left and right always refer to the left and right side of the scrolling container irrespective
479
+ * of the layout direction. start and end refer to left and right in an LTR context and vice-versa
480
+ * in an RTL context.
481
+ * @param options specified the offsets to scroll to.
482
+ */
483
+ scrollTo(options) {
484
+ const el = this.elementRef.nativeElement;
485
+ const isRtl = this.dir && this.dir.value == "rtl";
486
+ if (options.left == null) {
487
+ options.left = isRtl ? options.end : options.start;
488
+ }
489
+ if (options.right == null) {
490
+ options.right = isRtl ? options.start : options.end;
491
+ }
492
+ if (options.bottom != null) {
493
+ options.top = el.scrollHeight - el.clientHeight - options.bottom;
494
+ }
495
+ if (isRtl && getRtlScrollAxisType() != RtlScrollAxisType.NORMAL) {
496
+ if (options.left != null) {
497
+ options.right = el.scrollWidth - el.clientWidth - options.left;
498
+ }
499
+ if (getRtlScrollAxisType() == RtlScrollAxisType.INVERTED) {
500
+ options.left = options.right;
501
+ } else if (getRtlScrollAxisType() == RtlScrollAxisType.NEGATED) {
502
+ options.left = options.right ? -options.right : options.right;
503
+ }
504
+ } else {
505
+ if (options.right != null) {
506
+ options.left = el.scrollWidth - el.clientWidth - options.right;
507
+ }
508
+ }
509
+ this._applyScrollToOptions(options);
510
+ }
511
+ _applyScrollToOptions(options) {
512
+ const el = this.elementRef.nativeElement;
513
+ if (supportsScrollBehavior()) {
514
+ el.scrollTo(options);
515
+ } else {
516
+ if (options.top != null) {
517
+ el.scrollTop = options.top;
518
+ }
519
+ if (options.left != null) {
520
+ el.scrollLeft = options.left;
521
+ }
522
+ }
523
+ }
524
+ /**
525
+ * Measures the scroll offset relative to the specified edge of the viewport. This method can be
526
+ * used instead of directly checking scrollLeft or scrollTop, since browsers are not consistent
527
+ * about what scrollLeft means in RTL. The values returned by this method are normalized such that
528
+ * left and right always refer to the left and right side of the scrolling container irrespective
529
+ * of the layout direction. start and end refer to left and right in an LTR context and vice-versa
530
+ * in an RTL context.
531
+ * @param from The edge to measure from.
532
+ */
533
+ measureScrollOffset(from) {
534
+ const LEFT = "left";
535
+ const RIGHT = "right";
536
+ const el = this.elementRef.nativeElement;
537
+ if (from == "top") {
538
+ return el.scrollTop;
539
+ }
540
+ if (from == "bottom") {
541
+ return el.scrollHeight - el.clientHeight - el.scrollTop;
542
+ }
543
+ const isRtl = this.dir && this.dir.value == "rtl";
544
+ if (from == "start") {
545
+ from = isRtl ? RIGHT : LEFT;
546
+ } else if (from == "end") {
547
+ from = isRtl ? LEFT : RIGHT;
548
+ }
549
+ if (isRtl && getRtlScrollAxisType() == RtlScrollAxisType.INVERTED) {
550
+ if (from == LEFT) {
551
+ return el.scrollWidth - el.clientWidth - el.scrollLeft;
552
+ } else {
553
+ return el.scrollLeft;
554
+ }
555
+ } else if (isRtl && getRtlScrollAxisType() == RtlScrollAxisType.NEGATED) {
556
+ if (from == LEFT) {
557
+ return el.scrollLeft + el.scrollWidth - el.clientWidth;
558
+ } else {
559
+ return -el.scrollLeft;
560
+ }
561
+ } else {
562
+ if (from == LEFT) {
563
+ return el.scrollLeft;
564
+ } else {
565
+ return el.scrollWidth - el.clientWidth - el.scrollLeft;
566
+ }
567
+ }
568
+ }
569
+ static {
570
+ this.ɵfac = function CdkScrollable_Factory(__ngFactoryType__) {
571
+ return new (__ngFactoryType__ || _CdkScrollable)(ɵɵdirectiveInject(ElementRef), ɵɵdirectiveInject(ScrollDispatcher), ɵɵdirectiveInject(NgZone), ɵɵdirectiveInject(Directionality, 8));
572
+ };
573
+ }
574
+ static {
575
+ this.ɵdir = ɵɵdefineDirective({
576
+ type: _CdkScrollable,
577
+ selectors: [["", "cdk-scrollable", ""], ["", "cdkScrollable", ""]],
578
+ standalone: true
579
+ });
580
+ }
581
+ };
582
+ (() => {
583
+ (typeof ngDevMode === "undefined" || ngDevMode) && setClassMetadata(CdkScrollable, [{
584
+ type: Directive,
585
+ args: [{
586
+ selector: "[cdk-scrollable], [cdkScrollable]",
587
+ standalone: true
588
+ }]
589
+ }], () => [{
590
+ type: ElementRef
591
+ }, {
592
+ type: ScrollDispatcher
593
+ }, {
594
+ type: NgZone
595
+ }, {
596
+ type: Directionality,
597
+ decorators: [{
598
+ type: Optional
599
+ }]
600
+ }], null);
601
+ })();
602
+ var DEFAULT_RESIZE_TIME = 20;
603
+ var ViewportRuler = class _ViewportRuler {
604
+ constructor(_platform, ngZone, document2) {
605
+ this._platform = _platform;
606
+ this._change = new Subject();
607
+ this._changeListener = (event) => {
608
+ this._change.next(event);
609
+ };
610
+ this._document = document2;
611
+ ngZone.runOutsideAngular(() => {
612
+ if (_platform.isBrowser) {
613
+ const window2 = this._getWindow();
614
+ window2.addEventListener("resize", this._changeListener);
615
+ window2.addEventListener("orientationchange", this._changeListener);
616
+ }
617
+ this.change().subscribe(() => this._viewportSize = null);
618
+ });
619
+ }
620
+ ngOnDestroy() {
621
+ if (this._platform.isBrowser) {
622
+ const window2 = this._getWindow();
623
+ window2.removeEventListener("resize", this._changeListener);
624
+ window2.removeEventListener("orientationchange", this._changeListener);
625
+ }
626
+ this._change.complete();
627
+ }
628
+ /** Returns the viewport's width and height. */
629
+ getViewportSize() {
630
+ if (!this._viewportSize) {
631
+ this._updateViewportSize();
632
+ }
633
+ const output = {
634
+ width: this._viewportSize.width,
635
+ height: this._viewportSize.height
636
+ };
637
+ if (!this._platform.isBrowser) {
638
+ this._viewportSize = null;
639
+ }
640
+ return output;
641
+ }
642
+ /** Gets a DOMRect for the viewport's bounds. */
643
+ getViewportRect() {
644
+ const scrollPosition = this.getViewportScrollPosition();
645
+ const {
646
+ width,
647
+ height
648
+ } = this.getViewportSize();
649
+ return {
650
+ top: scrollPosition.top,
651
+ left: scrollPosition.left,
652
+ bottom: scrollPosition.top + height,
653
+ right: scrollPosition.left + width,
654
+ height,
655
+ width
656
+ };
657
+ }
658
+ /** Gets the (top, left) scroll position of the viewport. */
659
+ getViewportScrollPosition() {
660
+ if (!this._platform.isBrowser) {
661
+ return {
662
+ top: 0,
663
+ left: 0
664
+ };
665
+ }
666
+ const document2 = this._document;
667
+ const window2 = this._getWindow();
668
+ const documentElement = document2.documentElement;
669
+ const documentRect = documentElement.getBoundingClientRect();
670
+ const top = -documentRect.top || document2.body.scrollTop || window2.scrollY || documentElement.scrollTop || 0;
671
+ const left = -documentRect.left || document2.body.scrollLeft || window2.scrollX || documentElement.scrollLeft || 0;
672
+ return {
673
+ top,
674
+ left
675
+ };
676
+ }
677
+ /**
678
+ * Returns a stream that emits whenever the size of the viewport changes.
679
+ * This stream emits outside of the Angular zone.
680
+ * @param throttleTime Time in milliseconds to throttle the stream.
681
+ */
682
+ change(throttleTime = DEFAULT_RESIZE_TIME) {
683
+ return throttleTime > 0 ? this._change.pipe(auditTime(throttleTime)) : this._change;
684
+ }
685
+ /** Use defaultView of injected document if available or fallback to global window reference */
686
+ _getWindow() {
687
+ return this._document.defaultView || window;
688
+ }
689
+ /** Updates the cached viewport size. */
690
+ _updateViewportSize() {
691
+ const window2 = this._getWindow();
692
+ this._viewportSize = this._platform.isBrowser ? {
693
+ width: window2.innerWidth,
694
+ height: window2.innerHeight
695
+ } : {
696
+ width: 0,
697
+ height: 0
698
+ };
699
+ }
700
+ static {
701
+ this.ɵfac = function ViewportRuler_Factory(__ngFactoryType__) {
702
+ return new (__ngFactoryType__ || _ViewportRuler)(ɵɵinject(Platform), ɵɵinject(NgZone), ɵɵinject(DOCUMENT, 8));
703
+ };
704
+ }
705
+ static {
706
+ this.ɵprov = ɵɵdefineInjectable({
707
+ token: _ViewportRuler,
708
+ factory: _ViewportRuler.ɵfac,
709
+ providedIn: "root"
710
+ });
711
+ }
712
+ };
713
+ (() => {
714
+ (typeof ngDevMode === "undefined" || ngDevMode) && setClassMetadata(ViewportRuler, [{
715
+ type: Injectable,
716
+ args: [{
717
+ providedIn: "root"
718
+ }]
719
+ }], () => [{
720
+ type: Platform
721
+ }, {
722
+ type: NgZone
723
+ }, {
724
+ type: void 0,
725
+ decorators: [{
726
+ type: Optional
727
+ }, {
728
+ type: Inject,
729
+ args: [DOCUMENT]
730
+ }]
731
+ }], null);
732
+ })();
733
+ var VIRTUAL_SCROLLABLE = new InjectionToken("VIRTUAL_SCROLLABLE");
734
+ var CdkVirtualScrollable = class _CdkVirtualScrollable extends CdkScrollable {
735
+ constructor(elementRef, scrollDispatcher, ngZone, dir) {
736
+ super(elementRef, scrollDispatcher, ngZone, dir);
737
+ }
738
+ /**
739
+ * Measure the viewport size for the provided orientation.
740
+ *
741
+ * @param orientation The orientation to measure the size from.
742
+ */
743
+ measureViewportSize(orientation) {
744
+ const viewportEl = this.elementRef.nativeElement;
745
+ return orientation === "horizontal" ? viewportEl.clientWidth : viewportEl.clientHeight;
746
+ }
747
+ static {
748
+ this.ɵfac = function CdkVirtualScrollable_Factory(__ngFactoryType__) {
749
+ return new (__ngFactoryType__ || _CdkVirtualScrollable)(ɵɵdirectiveInject(ElementRef), ɵɵdirectiveInject(ScrollDispatcher), ɵɵdirectiveInject(NgZone), ɵɵdirectiveInject(Directionality, 8));
750
+ };
751
+ }
752
+ static {
753
+ this.ɵdir = ɵɵdefineDirective({
754
+ type: _CdkVirtualScrollable,
755
+ features: [ɵɵInheritDefinitionFeature]
756
+ });
757
+ }
758
+ };
759
+ (() => {
760
+ (typeof ngDevMode === "undefined" || ngDevMode) && setClassMetadata(CdkVirtualScrollable, [{
761
+ type: Directive
762
+ }], () => [{
763
+ type: ElementRef
764
+ }, {
765
+ type: ScrollDispatcher
766
+ }, {
767
+ type: NgZone
768
+ }, {
769
+ type: Directionality,
770
+ decorators: [{
771
+ type: Optional
772
+ }]
773
+ }], null);
774
+ })();
775
+ function rangesEqual(r1, r2) {
776
+ return r1.start == r2.start && r1.end == r2.end;
777
+ }
778
+ var SCROLL_SCHEDULER = typeof requestAnimationFrame !== "undefined" ? animationFrameScheduler : asapScheduler;
779
+ var CdkVirtualScrollViewport = class _CdkVirtualScrollViewport extends CdkVirtualScrollable {
780
+ /** The direction the viewport scrolls. */
781
+ get orientation() {
782
+ return this._orientation;
783
+ }
784
+ set orientation(orientation) {
785
+ if (this._orientation !== orientation) {
786
+ this._orientation = orientation;
787
+ this._calculateSpacerSize();
788
+ }
789
+ }
790
+ constructor(elementRef, _changeDetectorRef, ngZone, _scrollStrategy, dir, scrollDispatcher, viewportRuler, scrollable) {
791
+ super(elementRef, scrollDispatcher, ngZone, dir);
792
+ this.elementRef = elementRef;
793
+ this._changeDetectorRef = _changeDetectorRef;
794
+ this._scrollStrategy = _scrollStrategy;
795
+ this.scrollable = scrollable;
796
+ this._platform = inject(Platform);
797
+ this._detachedSubject = new Subject();
798
+ this._renderedRangeSubject = new Subject();
799
+ this._orientation = "vertical";
800
+ this.appendOnly = false;
801
+ this.scrolledIndexChange = new Observable((observer) => this._scrollStrategy.scrolledIndexChange.subscribe((index) => Promise.resolve().then(() => this.ngZone.run(() => observer.next(index)))));
802
+ this.renderedRangeStream = this._renderedRangeSubject;
803
+ this._totalContentSize = 0;
804
+ this._totalContentWidth = "";
805
+ this._totalContentHeight = "";
806
+ this._renderedRange = {
807
+ start: 0,
808
+ end: 0
809
+ };
810
+ this._dataLength = 0;
811
+ this._viewportSize = 0;
812
+ this._renderedContentOffset = 0;
813
+ this._renderedContentOffsetNeedsRewrite = false;
814
+ this._isChangeDetectionPending = false;
815
+ this._runAfterChangeDetection = [];
816
+ this._viewportChanges = Subscription.EMPTY;
817
+ this._injector = inject(Injector);
818
+ this._isDestroyed = false;
819
+ if (!_scrollStrategy && (typeof ngDevMode === "undefined" || ngDevMode)) {
820
+ throw Error('Error: cdk-virtual-scroll-viewport requires the "itemSize" property to be set.');
821
+ }
822
+ this._viewportChanges = viewportRuler.change().subscribe(() => {
823
+ this.checkViewportSize();
824
+ });
825
+ if (!this.scrollable) {
826
+ this.elementRef.nativeElement.classList.add("cdk-virtual-scrollable");
827
+ this.scrollable = this;
828
+ }
829
+ }
830
+ ngOnInit() {
831
+ if (!this._platform.isBrowser) {
832
+ return;
833
+ }
834
+ if (this.scrollable === this) {
835
+ super.ngOnInit();
836
+ }
837
+ this.ngZone.runOutsideAngular(() => Promise.resolve().then(() => {
838
+ this._measureViewportSize();
839
+ this._scrollStrategy.attach(this);
840
+ this.scrollable.elementScrolled().pipe(
841
+ // Start off with a fake scroll event so we properly detect our initial position.
842
+ startWith(null),
843
+ // Collect multiple events into one until the next animation frame. This way if
844
+ // there are multiple scroll events in the same frame we only need to recheck
845
+ // our layout once.
846
+ auditTime(0, SCROLL_SCHEDULER),
847
+ // Usually `elementScrolled` is completed when the scrollable is destroyed, but
848
+ // that may not be the case if a `CdkVirtualScrollableElement` is used so we have
849
+ // to unsubscribe here just in case.
850
+ takeUntil(this._destroyed)
851
+ ).subscribe(() => this._scrollStrategy.onContentScrolled());
852
+ this._markChangeDetectionNeeded();
853
+ }));
854
+ }
855
+ ngOnDestroy() {
856
+ this.detach();
857
+ this._scrollStrategy.detach();
858
+ this._renderedRangeSubject.complete();
859
+ this._detachedSubject.complete();
860
+ this._viewportChanges.unsubscribe();
861
+ this._isDestroyed = true;
862
+ super.ngOnDestroy();
863
+ }
864
+ /** Attaches a `CdkVirtualScrollRepeater` to this viewport. */
865
+ attach(forOf) {
866
+ if (this._forOf && (typeof ngDevMode === "undefined" || ngDevMode)) {
867
+ throw Error("CdkVirtualScrollViewport is already attached.");
868
+ }
869
+ this.ngZone.runOutsideAngular(() => {
870
+ this._forOf = forOf;
871
+ this._forOf.dataStream.pipe(takeUntil(this._detachedSubject)).subscribe((data) => {
872
+ const newLength = data.length;
873
+ if (newLength !== this._dataLength) {
874
+ this._dataLength = newLength;
875
+ this._scrollStrategy.onDataLengthChanged();
876
+ }
877
+ this._doChangeDetection();
878
+ });
879
+ });
880
+ }
881
+ /** Detaches the current `CdkVirtualForOf`. */
882
+ detach() {
883
+ this._forOf = null;
884
+ this._detachedSubject.next();
885
+ }
886
+ /** Gets the length of the data bound to this viewport (in number of items). */
887
+ getDataLength() {
888
+ return this._dataLength;
889
+ }
890
+ /** Gets the size of the viewport (in pixels). */
891
+ getViewportSize() {
892
+ return this._viewportSize;
893
+ }
894
+ // TODO(mmalerba): This is technically out of sync with what's really rendered until a render
895
+ // cycle happens. I'm being careful to only call it after the render cycle is complete and before
896
+ // setting it to something else, but its error prone and should probably be split into
897
+ // `pendingRange` and `renderedRange`, the latter reflecting whats actually in the DOM.
898
+ /** Get the current rendered range of items. */
899
+ getRenderedRange() {
900
+ return this._renderedRange;
901
+ }
902
+ measureBoundingClientRectWithScrollOffset(from) {
903
+ return this.getElementRef().nativeElement.getBoundingClientRect()[from];
904
+ }
905
+ /**
906
+ * Sets the total size of all content (in pixels), including content that is not currently
907
+ * rendered.
908
+ */
909
+ setTotalContentSize(size) {
910
+ if (this._totalContentSize !== size) {
911
+ this._totalContentSize = size;
912
+ this._calculateSpacerSize();
913
+ this._markChangeDetectionNeeded();
914
+ }
915
+ }
916
+ /** Sets the currently rendered range of indices. */
917
+ setRenderedRange(range) {
918
+ if (!rangesEqual(this._renderedRange, range)) {
919
+ if (this.appendOnly) {
920
+ range = {
921
+ start: 0,
922
+ end: Math.max(this._renderedRange.end, range.end)
923
+ };
924
+ }
925
+ this._renderedRangeSubject.next(this._renderedRange = range);
926
+ this._markChangeDetectionNeeded(() => this._scrollStrategy.onContentRendered());
927
+ }
928
+ }
929
+ /**
930
+ * Gets the offset from the start of the viewport to the start of the rendered data (in pixels).
931
+ */
932
+ getOffsetToRenderedContentStart() {
933
+ return this._renderedContentOffsetNeedsRewrite ? null : this._renderedContentOffset;
934
+ }
935
+ /**
936
+ * Sets the offset from the start of the viewport to either the start or end of the rendered data
937
+ * (in pixels).
938
+ */
939
+ setRenderedContentOffset(offset, to = "to-start") {
940
+ offset = this.appendOnly && to === "to-start" ? 0 : offset;
941
+ const isRtl = this.dir && this.dir.value == "rtl";
942
+ const isHorizontal = this.orientation == "horizontal";
943
+ const axis = isHorizontal ? "X" : "Y";
944
+ const axisDirection = isHorizontal && isRtl ? -1 : 1;
945
+ let transform = `translate${axis}(${Number(axisDirection * offset)}px)`;
946
+ this._renderedContentOffset = offset;
947
+ if (to === "to-end") {
948
+ transform += ` translate${axis}(-100%)`;
949
+ this._renderedContentOffsetNeedsRewrite = true;
950
+ }
951
+ if (this._renderedContentTransform != transform) {
952
+ this._renderedContentTransform = transform;
953
+ this._markChangeDetectionNeeded(() => {
954
+ if (this._renderedContentOffsetNeedsRewrite) {
955
+ this._renderedContentOffset -= this.measureRenderedContentSize();
956
+ this._renderedContentOffsetNeedsRewrite = false;
957
+ this.setRenderedContentOffset(this._renderedContentOffset);
958
+ } else {
959
+ this._scrollStrategy.onRenderedOffsetChanged();
960
+ }
961
+ });
962
+ }
963
+ }
964
+ /**
965
+ * Scrolls to the given offset from the start of the viewport. Please note that this is not always
966
+ * the same as setting `scrollTop` or `scrollLeft`. In a horizontal viewport with right-to-left
967
+ * direction, this would be the equivalent of setting a fictional `scrollRight` property.
968
+ * @param offset The offset to scroll to.
969
+ * @param behavior The ScrollBehavior to use when scrolling. Default is behavior is `auto`.
970
+ */
971
+ scrollToOffset(offset, behavior = "auto") {
972
+ const options = {
973
+ behavior
974
+ };
975
+ if (this.orientation === "horizontal") {
976
+ options.start = offset;
977
+ } else {
978
+ options.top = offset;
979
+ }
980
+ this.scrollable.scrollTo(options);
981
+ }
982
+ /**
983
+ * Scrolls to the offset for the given index.
984
+ * @param index The index of the element to scroll to.
985
+ * @param behavior The ScrollBehavior to use when scrolling. Default is behavior is `auto`.
986
+ */
987
+ scrollToIndex(index, behavior = "auto") {
988
+ this._scrollStrategy.scrollToIndex(index, behavior);
989
+ }
990
+ /**
991
+ * Gets the current scroll offset from the start of the scrollable (in pixels).
992
+ * @param from The edge to measure the offset from. Defaults to 'top' in vertical mode and 'start'
993
+ * in horizontal mode.
994
+ */
995
+ measureScrollOffset(from) {
996
+ let measureScrollOffset;
997
+ if (this.scrollable == this) {
998
+ measureScrollOffset = (_from) => super.measureScrollOffset(_from);
999
+ } else {
1000
+ measureScrollOffset = (_from) => this.scrollable.measureScrollOffset(_from);
1001
+ }
1002
+ return Math.max(0, measureScrollOffset(from ?? (this.orientation === "horizontal" ? "start" : "top")) - this.measureViewportOffset());
1003
+ }
1004
+ /**
1005
+ * Measures the offset of the viewport from the scrolling container
1006
+ * @param from The edge to measure from.
1007
+ */
1008
+ measureViewportOffset(from) {
1009
+ let fromRect;
1010
+ const LEFT = "left";
1011
+ const RIGHT = "right";
1012
+ const isRtl = this.dir?.value == "rtl";
1013
+ if (from == "start") {
1014
+ fromRect = isRtl ? RIGHT : LEFT;
1015
+ } else if (from == "end") {
1016
+ fromRect = isRtl ? LEFT : RIGHT;
1017
+ } else if (from) {
1018
+ fromRect = from;
1019
+ } else {
1020
+ fromRect = this.orientation === "horizontal" ? "left" : "top";
1021
+ }
1022
+ const scrollerClientRect = this.scrollable.measureBoundingClientRectWithScrollOffset(fromRect);
1023
+ const viewportClientRect = this.elementRef.nativeElement.getBoundingClientRect()[fromRect];
1024
+ return viewportClientRect - scrollerClientRect;
1025
+ }
1026
+ /** Measure the combined size of all of the rendered items. */
1027
+ measureRenderedContentSize() {
1028
+ const contentEl = this._contentWrapper.nativeElement;
1029
+ return this.orientation === "horizontal" ? contentEl.offsetWidth : contentEl.offsetHeight;
1030
+ }
1031
+ /**
1032
+ * Measure the total combined size of the given range. Throws if the range includes items that are
1033
+ * not rendered.
1034
+ */
1035
+ measureRangeSize(range) {
1036
+ if (!this._forOf) {
1037
+ return 0;
1038
+ }
1039
+ return this._forOf.measureRangeSize(range, this.orientation);
1040
+ }
1041
+ /** Update the viewport dimensions and re-render. */
1042
+ checkViewportSize() {
1043
+ this._measureViewportSize();
1044
+ this._scrollStrategy.onDataLengthChanged();
1045
+ }
1046
+ /** Measure the viewport size. */
1047
+ _measureViewportSize() {
1048
+ this._viewportSize = this.scrollable.measureViewportSize(this.orientation);
1049
+ }
1050
+ /** Queue up change detection to run. */
1051
+ _markChangeDetectionNeeded(runAfter) {
1052
+ if (runAfter) {
1053
+ this._runAfterChangeDetection.push(runAfter);
1054
+ }
1055
+ if (!this._isChangeDetectionPending) {
1056
+ this._isChangeDetectionPending = true;
1057
+ this.ngZone.runOutsideAngular(() => Promise.resolve().then(() => {
1058
+ this._doChangeDetection();
1059
+ }));
1060
+ }
1061
+ }
1062
+ /** Run change detection. */
1063
+ _doChangeDetection() {
1064
+ if (this._isDestroyed) {
1065
+ return;
1066
+ }
1067
+ this.ngZone.run(() => {
1068
+ this._changeDetectorRef.markForCheck();
1069
+ this._contentWrapper.nativeElement.style.transform = this._renderedContentTransform;
1070
+ afterNextRender(() => {
1071
+ this._isChangeDetectionPending = false;
1072
+ const runAfterChangeDetection = this._runAfterChangeDetection;
1073
+ this._runAfterChangeDetection = [];
1074
+ for (const fn of runAfterChangeDetection) {
1075
+ fn();
1076
+ }
1077
+ }, {
1078
+ injector: this._injector
1079
+ });
1080
+ });
1081
+ }
1082
+ /** Calculates the `style.width` and `style.height` for the spacer element. */
1083
+ _calculateSpacerSize() {
1084
+ this._totalContentHeight = this.orientation === "horizontal" ? "" : `${this._totalContentSize}px`;
1085
+ this._totalContentWidth = this.orientation === "horizontal" ? `${this._totalContentSize}px` : "";
1086
+ }
1087
+ static {
1088
+ this.ɵfac = function CdkVirtualScrollViewport_Factory(__ngFactoryType__) {
1089
+ return new (__ngFactoryType__ || _CdkVirtualScrollViewport)(ɵɵdirectiveInject(ElementRef), ɵɵdirectiveInject(ChangeDetectorRef), ɵɵdirectiveInject(NgZone), ɵɵdirectiveInject(VIRTUAL_SCROLL_STRATEGY, 8), ɵɵdirectiveInject(Directionality, 8), ɵɵdirectiveInject(ScrollDispatcher), ɵɵdirectiveInject(ViewportRuler), ɵɵdirectiveInject(VIRTUAL_SCROLLABLE, 8));
1090
+ };
1091
+ }
1092
+ static {
1093
+ this.ɵcmp = ɵɵdefineComponent({
1094
+ type: _CdkVirtualScrollViewport,
1095
+ selectors: [["cdk-virtual-scroll-viewport"]],
1096
+ viewQuery: function CdkVirtualScrollViewport_Query(rf, ctx) {
1097
+ if (rf & 1) {
1098
+ ɵɵviewQuery(_c0, 7);
1099
+ }
1100
+ if (rf & 2) {
1101
+ let _t;
1102
+ ɵɵqueryRefresh(_t = ɵɵloadQuery()) && (ctx._contentWrapper = _t.first);
1103
+ }
1104
+ },
1105
+ hostAttrs: [1, "cdk-virtual-scroll-viewport"],
1106
+ hostVars: 4,
1107
+ hostBindings: function CdkVirtualScrollViewport_HostBindings(rf, ctx) {
1108
+ if (rf & 2) {
1109
+ ɵɵclassProp("cdk-virtual-scroll-orientation-horizontal", ctx.orientation === "horizontal")("cdk-virtual-scroll-orientation-vertical", ctx.orientation !== "horizontal");
1110
+ }
1111
+ },
1112
+ inputs: {
1113
+ orientation: "orientation",
1114
+ appendOnly: [2, "appendOnly", "appendOnly", booleanAttribute]
1115
+ },
1116
+ outputs: {
1117
+ scrolledIndexChange: "scrolledIndexChange"
1118
+ },
1119
+ standalone: true,
1120
+ features: [ɵɵProvidersFeature([{
1121
+ provide: CdkScrollable,
1122
+ useFactory: (virtualScrollable, viewport) => virtualScrollable || viewport,
1123
+ deps: [[new Optional(), new Inject(VIRTUAL_SCROLLABLE)], _CdkVirtualScrollViewport]
1124
+ }]), ɵɵInputTransformsFeature, ɵɵInheritDefinitionFeature, ɵɵStandaloneFeature],
1125
+ ngContentSelectors: _c1,
1126
+ decls: 4,
1127
+ vars: 4,
1128
+ consts: [["contentWrapper", ""], [1, "cdk-virtual-scroll-content-wrapper"], [1, "cdk-virtual-scroll-spacer"]],
1129
+ template: function CdkVirtualScrollViewport_Template(rf, ctx) {
1130
+ if (rf & 1) {
1131
+ ɵɵprojectionDef();
1132
+ ɵɵelementStart(0, "div", 1, 0);
1133
+ ɵɵprojection(2);
1134
+ ɵɵelementEnd();
1135
+ ɵɵelement(3, "div", 2);
1136
+ }
1137
+ if (rf & 2) {
1138
+ ɵɵadvance(3);
1139
+ ɵɵstyleProp("width", ctx._totalContentWidth)("height", ctx._totalContentHeight);
1140
+ }
1141
+ },
1142
+ styles: ["cdk-virtual-scroll-viewport{display:block;position:relative;transform:translateZ(0)}.cdk-virtual-scrollable{overflow:auto;will-change:scroll-position;contain:strict;-webkit-overflow-scrolling:touch}.cdk-virtual-scroll-content-wrapper{position:absolute;top:0;left:0;contain:content}[dir=rtl] .cdk-virtual-scroll-content-wrapper{right:0;left:auto}.cdk-virtual-scroll-orientation-horizontal .cdk-virtual-scroll-content-wrapper{min-height:100%}.cdk-virtual-scroll-orientation-horizontal .cdk-virtual-scroll-content-wrapper>dl:not([cdkVirtualFor]),.cdk-virtual-scroll-orientation-horizontal .cdk-virtual-scroll-content-wrapper>ol:not([cdkVirtualFor]),.cdk-virtual-scroll-orientation-horizontal .cdk-virtual-scroll-content-wrapper>table:not([cdkVirtualFor]),.cdk-virtual-scroll-orientation-horizontal .cdk-virtual-scroll-content-wrapper>ul:not([cdkVirtualFor]){padding-left:0;padding-right:0;margin-left:0;margin-right:0;border-left-width:0;border-right-width:0;outline:none}.cdk-virtual-scroll-orientation-vertical .cdk-virtual-scroll-content-wrapper{min-width:100%}.cdk-virtual-scroll-orientation-vertical .cdk-virtual-scroll-content-wrapper>dl:not([cdkVirtualFor]),.cdk-virtual-scroll-orientation-vertical .cdk-virtual-scroll-content-wrapper>ol:not([cdkVirtualFor]),.cdk-virtual-scroll-orientation-vertical .cdk-virtual-scroll-content-wrapper>table:not([cdkVirtualFor]),.cdk-virtual-scroll-orientation-vertical .cdk-virtual-scroll-content-wrapper>ul:not([cdkVirtualFor]){padding-top:0;padding-bottom:0;margin-top:0;margin-bottom:0;border-top-width:0;border-bottom-width:0;outline:none}.cdk-virtual-scroll-spacer{height:1px;transform-origin:0 0;flex:0 0 auto}[dir=rtl] .cdk-virtual-scroll-spacer{transform-origin:100% 0}"],
1143
+ encapsulation: 2,
1144
+ changeDetection: 0
1145
+ });
1146
+ }
1147
+ };
1148
+ (() => {
1149
+ (typeof ngDevMode === "undefined" || ngDevMode) && setClassMetadata(CdkVirtualScrollViewport, [{
1150
+ type: Component,
1151
+ args: [{
1152
+ selector: "cdk-virtual-scroll-viewport",
1153
+ host: {
1154
+ "class": "cdk-virtual-scroll-viewport",
1155
+ "[class.cdk-virtual-scroll-orientation-horizontal]": 'orientation === "horizontal"',
1156
+ "[class.cdk-virtual-scroll-orientation-vertical]": 'orientation !== "horizontal"'
1157
+ },
1158
+ encapsulation: ViewEncapsulation$1.None,
1159
+ changeDetection: ChangeDetectionStrategy.OnPush,
1160
+ standalone: true,
1161
+ providers: [{
1162
+ provide: CdkScrollable,
1163
+ useFactory: (virtualScrollable, viewport) => virtualScrollable || viewport,
1164
+ deps: [[new Optional(), new Inject(VIRTUAL_SCROLLABLE)], CdkVirtualScrollViewport]
1165
+ }],
1166
+ template: '<!--\n Wrap the rendered content in an element that will be used to offset it based on the scroll\n position.\n-->\n<div #contentWrapper class="cdk-virtual-scroll-content-wrapper">\n <ng-content></ng-content>\n</div>\n<!--\n Spacer used to force the scrolling container to the correct size for the *total* number of items\n so that the scrollbar captures the size of the entire data set.\n-->\n<div class="cdk-virtual-scroll-spacer"\n [style.width]="_totalContentWidth" [style.height]="_totalContentHeight"></div>\n',
1167
+ styles: ["cdk-virtual-scroll-viewport{display:block;position:relative;transform:translateZ(0)}.cdk-virtual-scrollable{overflow:auto;will-change:scroll-position;contain:strict;-webkit-overflow-scrolling:touch}.cdk-virtual-scroll-content-wrapper{position:absolute;top:0;left:0;contain:content}[dir=rtl] .cdk-virtual-scroll-content-wrapper{right:0;left:auto}.cdk-virtual-scroll-orientation-horizontal .cdk-virtual-scroll-content-wrapper{min-height:100%}.cdk-virtual-scroll-orientation-horizontal .cdk-virtual-scroll-content-wrapper>dl:not([cdkVirtualFor]),.cdk-virtual-scroll-orientation-horizontal .cdk-virtual-scroll-content-wrapper>ol:not([cdkVirtualFor]),.cdk-virtual-scroll-orientation-horizontal .cdk-virtual-scroll-content-wrapper>table:not([cdkVirtualFor]),.cdk-virtual-scroll-orientation-horizontal .cdk-virtual-scroll-content-wrapper>ul:not([cdkVirtualFor]){padding-left:0;padding-right:0;margin-left:0;margin-right:0;border-left-width:0;border-right-width:0;outline:none}.cdk-virtual-scroll-orientation-vertical .cdk-virtual-scroll-content-wrapper{min-width:100%}.cdk-virtual-scroll-orientation-vertical .cdk-virtual-scroll-content-wrapper>dl:not([cdkVirtualFor]),.cdk-virtual-scroll-orientation-vertical .cdk-virtual-scroll-content-wrapper>ol:not([cdkVirtualFor]),.cdk-virtual-scroll-orientation-vertical .cdk-virtual-scroll-content-wrapper>table:not([cdkVirtualFor]),.cdk-virtual-scroll-orientation-vertical .cdk-virtual-scroll-content-wrapper>ul:not([cdkVirtualFor]){padding-top:0;padding-bottom:0;margin-top:0;margin-bottom:0;border-top-width:0;border-bottom-width:0;outline:none}.cdk-virtual-scroll-spacer{height:1px;transform-origin:0 0;flex:0 0 auto}[dir=rtl] .cdk-virtual-scroll-spacer{transform-origin:100% 0}"]
1168
+ }]
1169
+ }], () => [{
1170
+ type: ElementRef
1171
+ }, {
1172
+ type: ChangeDetectorRef
1173
+ }, {
1174
+ type: NgZone
1175
+ }, {
1176
+ type: void 0,
1177
+ decorators: [{
1178
+ type: Optional
1179
+ }, {
1180
+ type: Inject,
1181
+ args: [VIRTUAL_SCROLL_STRATEGY]
1182
+ }]
1183
+ }, {
1184
+ type: Directionality,
1185
+ decorators: [{
1186
+ type: Optional
1187
+ }]
1188
+ }, {
1189
+ type: ScrollDispatcher
1190
+ }, {
1191
+ type: ViewportRuler
1192
+ }, {
1193
+ type: CdkVirtualScrollable,
1194
+ decorators: [{
1195
+ type: Optional
1196
+ }, {
1197
+ type: Inject,
1198
+ args: [VIRTUAL_SCROLLABLE]
1199
+ }]
1200
+ }], {
1201
+ orientation: [{
1202
+ type: Input
1203
+ }],
1204
+ appendOnly: [{
1205
+ type: Input,
1206
+ args: [{
1207
+ transform: booleanAttribute
1208
+ }]
1209
+ }],
1210
+ scrolledIndexChange: [{
1211
+ type: Output
1212
+ }],
1213
+ _contentWrapper: [{
1214
+ type: ViewChild,
1215
+ args: ["contentWrapper", {
1216
+ static: true
1217
+ }]
1218
+ }]
1219
+ });
1220
+ })();
1221
+ function getOffset(orientation, direction, node) {
1222
+ const el = node;
1223
+ if (!el.getBoundingClientRect) {
1224
+ return 0;
1225
+ }
1226
+ const rect = el.getBoundingClientRect();
1227
+ if (orientation === "horizontal") {
1228
+ return direction === "start" ? rect.left : rect.right;
1229
+ }
1230
+ return direction === "start" ? rect.top : rect.bottom;
1231
+ }
1232
+ var CdkVirtualForOf = class _CdkVirtualForOf {
1233
+ /** The DataSource to display. */
1234
+ get cdkVirtualForOf() {
1235
+ return this._cdkVirtualForOf;
1236
+ }
1237
+ set cdkVirtualForOf(value) {
1238
+ this._cdkVirtualForOf = value;
1239
+ if (isDataSource(value)) {
1240
+ this._dataSourceChanges.next(value);
1241
+ } else {
1242
+ this._dataSourceChanges.next(new ArrayDataSource(isObservable(value) ? value : Array.from(value || [])));
1243
+ }
1244
+ }
1245
+ /**
1246
+ * The `TrackByFunction` to use for tracking changes. The `TrackByFunction` takes the index and
1247
+ * the item and produces a value to be used as the item's identity when tracking changes.
1248
+ */
1249
+ get cdkVirtualForTrackBy() {
1250
+ return this._cdkVirtualForTrackBy;
1251
+ }
1252
+ set cdkVirtualForTrackBy(fn) {
1253
+ this._needsUpdate = true;
1254
+ this._cdkVirtualForTrackBy = fn ? (index, item) => fn(index + (this._renderedRange ? this._renderedRange.start : 0), item) : void 0;
1255
+ }
1256
+ /** The template used to stamp out new elements. */
1257
+ set cdkVirtualForTemplate(value) {
1258
+ if (value) {
1259
+ this._needsUpdate = true;
1260
+ this._template = value;
1261
+ }
1262
+ }
1263
+ /**
1264
+ * The size of the cache used to store templates that are not being used for re-use later.
1265
+ * Setting the cache size to `0` will disable caching. Defaults to 20 templates.
1266
+ */
1267
+ get cdkVirtualForTemplateCacheSize() {
1268
+ return this._viewRepeater.viewCacheSize;
1269
+ }
1270
+ set cdkVirtualForTemplateCacheSize(size) {
1271
+ this._viewRepeater.viewCacheSize = coerceNumberProperty(size);
1272
+ }
1273
+ constructor(_viewContainerRef, _template, _differs, _viewRepeater, _viewport, ngZone) {
1274
+ this._viewContainerRef = _viewContainerRef;
1275
+ this._template = _template;
1276
+ this._differs = _differs;
1277
+ this._viewRepeater = _viewRepeater;
1278
+ this._viewport = _viewport;
1279
+ this.viewChange = new Subject();
1280
+ this._dataSourceChanges = new Subject();
1281
+ this.dataStream = this._dataSourceChanges.pipe(
1282
+ // Start off with null `DataSource`.
1283
+ startWith(null),
1284
+ // Bundle up the previous and current data sources so we can work with both.
1285
+ pairwise(),
1286
+ // Use `_changeDataSource` to disconnect from the previous data source and connect to the
1287
+ // new one, passing back a stream of data changes which we run through `switchMap` to give
1288
+ // us a data stream that emits the latest data from whatever the current `DataSource` is.
1289
+ switchMap(([prev, cur]) => this._changeDataSource(prev, cur)),
1290
+ // Replay the last emitted data when someone subscribes.
1291
+ shareReplay(1)
1292
+ );
1293
+ this._differ = null;
1294
+ this._needsUpdate = false;
1295
+ this._destroyed = new Subject();
1296
+ this.dataStream.subscribe((data) => {
1297
+ this._data = data;
1298
+ this._onRenderedDataChange();
1299
+ });
1300
+ this._viewport.renderedRangeStream.pipe(takeUntil(this._destroyed)).subscribe((range) => {
1301
+ this._renderedRange = range;
1302
+ if (this.viewChange.observers.length) {
1303
+ ngZone.run(() => this.viewChange.next(this._renderedRange));
1304
+ }
1305
+ this._onRenderedDataChange();
1306
+ });
1307
+ this._viewport.attach(this);
1308
+ }
1309
+ /**
1310
+ * Measures the combined size (width for horizontal orientation, height for vertical) of all items
1311
+ * in the specified range. Throws an error if the range includes items that are not currently
1312
+ * rendered.
1313
+ */
1314
+ measureRangeSize(range, orientation) {
1315
+ if (range.start >= range.end) {
1316
+ return 0;
1317
+ }
1318
+ if ((range.start < this._renderedRange.start || range.end > this._renderedRange.end) && (typeof ngDevMode === "undefined" || ngDevMode)) {
1319
+ throw Error(`Error: attempted to measure an item that isn't rendered.`);
1320
+ }
1321
+ const renderedStartIndex = range.start - this._renderedRange.start;
1322
+ const rangeLen = range.end - range.start;
1323
+ let firstNode;
1324
+ let lastNode;
1325
+ for (let i = 0; i < rangeLen; i++) {
1326
+ const view = this._viewContainerRef.get(i + renderedStartIndex);
1327
+ if (view && view.rootNodes.length) {
1328
+ firstNode = lastNode = view.rootNodes[0];
1329
+ break;
1330
+ }
1331
+ }
1332
+ for (let i = rangeLen - 1; i > -1; i--) {
1333
+ const view = this._viewContainerRef.get(i + renderedStartIndex);
1334
+ if (view && view.rootNodes.length) {
1335
+ lastNode = view.rootNodes[view.rootNodes.length - 1];
1336
+ break;
1337
+ }
1338
+ }
1339
+ return firstNode && lastNode ? getOffset(orientation, "end", lastNode) - getOffset(orientation, "start", firstNode) : 0;
1340
+ }
1341
+ ngDoCheck() {
1342
+ if (this._differ && this._needsUpdate) {
1343
+ const changes = this._differ.diff(this._renderedItems);
1344
+ if (!changes) {
1345
+ this._updateContext();
1346
+ } else {
1347
+ this._applyChanges(changes);
1348
+ }
1349
+ this._needsUpdate = false;
1350
+ }
1351
+ }
1352
+ ngOnDestroy() {
1353
+ this._viewport.detach();
1354
+ this._dataSourceChanges.next(void 0);
1355
+ this._dataSourceChanges.complete();
1356
+ this.viewChange.complete();
1357
+ this._destroyed.next();
1358
+ this._destroyed.complete();
1359
+ this._viewRepeater.detach();
1360
+ }
1361
+ /** React to scroll state changes in the viewport. */
1362
+ _onRenderedDataChange() {
1363
+ if (!this._renderedRange) {
1364
+ return;
1365
+ }
1366
+ this._renderedItems = this._data.slice(this._renderedRange.start, this._renderedRange.end);
1367
+ if (!this._differ) {
1368
+ this._differ = this._differs.find(this._renderedItems).create((index, item) => {
1369
+ return this.cdkVirtualForTrackBy ? this.cdkVirtualForTrackBy(index, item) : item;
1370
+ });
1371
+ }
1372
+ this._needsUpdate = true;
1373
+ }
1374
+ /** Swap out one `DataSource` for another. */
1375
+ _changeDataSource(oldDs, newDs) {
1376
+ if (oldDs) {
1377
+ oldDs.disconnect(this);
1378
+ }
1379
+ this._needsUpdate = true;
1380
+ return newDs ? newDs.connect(this) : of();
1381
+ }
1382
+ /** Update the `CdkVirtualForOfContext` for all views. */
1383
+ _updateContext() {
1384
+ const count = this._data.length;
1385
+ let i = this._viewContainerRef.length;
1386
+ while (i--) {
1387
+ const view = this._viewContainerRef.get(i);
1388
+ view.context.index = this._renderedRange.start + i;
1389
+ view.context.count = count;
1390
+ this._updateComputedContextProperties(view.context);
1391
+ view.detectChanges();
1392
+ }
1393
+ }
1394
+ /** Apply changes to the DOM. */
1395
+ _applyChanges(changes) {
1396
+ this._viewRepeater.applyChanges(changes, this._viewContainerRef, (record, _adjustedPreviousIndex, currentIndex) => this._getEmbeddedViewArgs(record, currentIndex), (record) => record.item);
1397
+ changes.forEachIdentityChange((record) => {
1398
+ const view = this._viewContainerRef.get(record.currentIndex);
1399
+ view.context.$implicit = record.item;
1400
+ });
1401
+ const count = this._data.length;
1402
+ let i = this._viewContainerRef.length;
1403
+ while (i--) {
1404
+ const view = this._viewContainerRef.get(i);
1405
+ view.context.index = this._renderedRange.start + i;
1406
+ view.context.count = count;
1407
+ this._updateComputedContextProperties(view.context);
1408
+ }
1409
+ }
1410
+ /** Update the computed properties on the `CdkVirtualForOfContext`. */
1411
+ _updateComputedContextProperties(context) {
1412
+ context.first = context.index === 0;
1413
+ context.last = context.index === context.count - 1;
1414
+ context.even = context.index % 2 === 0;
1415
+ context.odd = !context.even;
1416
+ }
1417
+ _getEmbeddedViewArgs(record, index) {
1418
+ return {
1419
+ templateRef: this._template,
1420
+ context: {
1421
+ $implicit: record.item,
1422
+ // It's guaranteed that the iterable is not "undefined" or "null" because we only
1423
+ // generate views for elements if the "cdkVirtualForOf" iterable has elements.
1424
+ cdkVirtualForOf: this._cdkVirtualForOf,
1425
+ index: -1,
1426
+ count: -1,
1427
+ first: false,
1428
+ last: false,
1429
+ odd: false,
1430
+ even: false
1431
+ },
1432
+ index
1433
+ };
1434
+ }
1435
+ static {
1436
+ this.ɵfac = function CdkVirtualForOf_Factory(__ngFactoryType__) {
1437
+ return new (__ngFactoryType__ || _CdkVirtualForOf)(ɵɵdirectiveInject(ViewContainerRef), ɵɵdirectiveInject(TemplateRef), ɵɵdirectiveInject(IterableDiffers), ɵɵdirectiveInject(_VIEW_REPEATER_STRATEGY), ɵɵdirectiveInject(CdkVirtualScrollViewport, 4), ɵɵdirectiveInject(NgZone));
1438
+ };
1439
+ }
1440
+ static {
1441
+ this.ɵdir = ɵɵdefineDirective({
1442
+ type: _CdkVirtualForOf,
1443
+ selectors: [["", "cdkVirtualFor", "", "cdkVirtualForOf", ""]],
1444
+ inputs: {
1445
+ cdkVirtualForOf: "cdkVirtualForOf",
1446
+ cdkVirtualForTrackBy: "cdkVirtualForTrackBy",
1447
+ cdkVirtualForTemplate: "cdkVirtualForTemplate",
1448
+ cdkVirtualForTemplateCacheSize: "cdkVirtualForTemplateCacheSize"
1449
+ },
1450
+ standalone: true,
1451
+ features: [ɵɵProvidersFeature([{
1452
+ provide: _VIEW_REPEATER_STRATEGY,
1453
+ useClass: _RecycleViewRepeaterStrategy
1454
+ }])]
1455
+ });
1456
+ }
1457
+ };
1458
+ (() => {
1459
+ (typeof ngDevMode === "undefined" || ngDevMode) && setClassMetadata(CdkVirtualForOf, [{
1460
+ type: Directive,
1461
+ args: [{
1462
+ selector: "[cdkVirtualFor][cdkVirtualForOf]",
1463
+ providers: [{
1464
+ provide: _VIEW_REPEATER_STRATEGY,
1465
+ useClass: _RecycleViewRepeaterStrategy
1466
+ }],
1467
+ standalone: true
1468
+ }]
1469
+ }], () => [{
1470
+ type: ViewContainerRef
1471
+ }, {
1472
+ type: TemplateRef
1473
+ }, {
1474
+ type: IterableDiffers
1475
+ }, {
1476
+ type: _RecycleViewRepeaterStrategy,
1477
+ decorators: [{
1478
+ type: Inject,
1479
+ args: [_VIEW_REPEATER_STRATEGY]
1480
+ }]
1481
+ }, {
1482
+ type: CdkVirtualScrollViewport,
1483
+ decorators: [{
1484
+ type: SkipSelf
1485
+ }]
1486
+ }, {
1487
+ type: NgZone
1488
+ }], {
1489
+ cdkVirtualForOf: [{
1490
+ type: Input
1491
+ }],
1492
+ cdkVirtualForTrackBy: [{
1493
+ type: Input
1494
+ }],
1495
+ cdkVirtualForTemplate: [{
1496
+ type: Input
1497
+ }],
1498
+ cdkVirtualForTemplateCacheSize: [{
1499
+ type: Input
1500
+ }]
1501
+ });
1502
+ })();
1503
+ var CdkVirtualScrollableElement = class _CdkVirtualScrollableElement extends CdkVirtualScrollable {
1504
+ constructor(elementRef, scrollDispatcher, ngZone, dir) {
1505
+ super(elementRef, scrollDispatcher, ngZone, dir);
1506
+ }
1507
+ measureBoundingClientRectWithScrollOffset(from) {
1508
+ return this.getElementRef().nativeElement.getBoundingClientRect()[from] - this.measureScrollOffset(from);
1509
+ }
1510
+ static {
1511
+ this.ɵfac = function CdkVirtualScrollableElement_Factory(__ngFactoryType__) {
1512
+ return new (__ngFactoryType__ || _CdkVirtualScrollableElement)(ɵɵdirectiveInject(ElementRef), ɵɵdirectiveInject(ScrollDispatcher), ɵɵdirectiveInject(NgZone), ɵɵdirectiveInject(Directionality, 8));
1513
+ };
1514
+ }
1515
+ static {
1516
+ this.ɵdir = ɵɵdefineDirective({
1517
+ type: _CdkVirtualScrollableElement,
1518
+ selectors: [["", "cdkVirtualScrollingElement", ""]],
1519
+ hostAttrs: [1, "cdk-virtual-scrollable"],
1520
+ standalone: true,
1521
+ features: [ɵɵProvidersFeature([{
1522
+ provide: VIRTUAL_SCROLLABLE,
1523
+ useExisting: _CdkVirtualScrollableElement
1524
+ }]), ɵɵInheritDefinitionFeature]
1525
+ });
1526
+ }
1527
+ };
1528
+ (() => {
1529
+ (typeof ngDevMode === "undefined" || ngDevMode) && setClassMetadata(CdkVirtualScrollableElement, [{
1530
+ type: Directive,
1531
+ args: [{
1532
+ selector: "[cdkVirtualScrollingElement]",
1533
+ providers: [{
1534
+ provide: VIRTUAL_SCROLLABLE,
1535
+ useExisting: CdkVirtualScrollableElement
1536
+ }],
1537
+ standalone: true,
1538
+ host: {
1539
+ "class": "cdk-virtual-scrollable"
1540
+ }
1541
+ }]
1542
+ }], () => [{
1543
+ type: ElementRef
1544
+ }, {
1545
+ type: ScrollDispatcher
1546
+ }, {
1547
+ type: NgZone
1548
+ }, {
1549
+ type: Directionality,
1550
+ decorators: [{
1551
+ type: Optional
1552
+ }]
1553
+ }], null);
1554
+ })();
1555
+ var CdkVirtualScrollableWindow = class _CdkVirtualScrollableWindow extends CdkVirtualScrollable {
1556
+ constructor(scrollDispatcher, ngZone, dir) {
1557
+ super(new ElementRef(document.documentElement), scrollDispatcher, ngZone, dir);
1558
+ this._elementScrolled = new Observable((observer) => this.ngZone.runOutsideAngular(() => fromEvent(document, "scroll").pipe(takeUntil(this._destroyed)).subscribe(observer)));
1559
+ }
1560
+ measureBoundingClientRectWithScrollOffset(from) {
1561
+ return this.getElementRef().nativeElement.getBoundingClientRect()[from];
1562
+ }
1563
+ static {
1564
+ this.ɵfac = function CdkVirtualScrollableWindow_Factory(__ngFactoryType__) {
1565
+ return new (__ngFactoryType__ || _CdkVirtualScrollableWindow)(ɵɵdirectiveInject(ScrollDispatcher), ɵɵdirectiveInject(NgZone), ɵɵdirectiveInject(Directionality, 8));
1566
+ };
1567
+ }
1568
+ static {
1569
+ this.ɵdir = ɵɵdefineDirective({
1570
+ type: _CdkVirtualScrollableWindow,
1571
+ selectors: [["cdk-virtual-scroll-viewport", "scrollWindow", ""]],
1572
+ standalone: true,
1573
+ features: [ɵɵProvidersFeature([{
1574
+ provide: VIRTUAL_SCROLLABLE,
1575
+ useExisting: _CdkVirtualScrollableWindow
1576
+ }]), ɵɵInheritDefinitionFeature]
1577
+ });
1578
+ }
1579
+ };
1580
+ (() => {
1581
+ (typeof ngDevMode === "undefined" || ngDevMode) && setClassMetadata(CdkVirtualScrollableWindow, [{
1582
+ type: Directive,
1583
+ args: [{
1584
+ selector: "cdk-virtual-scroll-viewport[scrollWindow]",
1585
+ providers: [{
1586
+ provide: VIRTUAL_SCROLLABLE,
1587
+ useExisting: CdkVirtualScrollableWindow
1588
+ }],
1589
+ standalone: true
1590
+ }]
1591
+ }], () => [{
1592
+ type: ScrollDispatcher
1593
+ }, {
1594
+ type: NgZone
1595
+ }, {
1596
+ type: Directionality,
1597
+ decorators: [{
1598
+ type: Optional
1599
+ }]
1600
+ }], null);
1601
+ })();
1602
+ var CdkScrollableModule = class _CdkScrollableModule {
1603
+ static {
1604
+ this.ɵfac = function CdkScrollableModule_Factory(__ngFactoryType__) {
1605
+ return new (__ngFactoryType__ || _CdkScrollableModule)();
1606
+ };
1607
+ }
1608
+ static {
1609
+ this.ɵmod = ɵɵdefineNgModule({
1610
+ type: _CdkScrollableModule,
1611
+ imports: [CdkScrollable],
1612
+ exports: [CdkScrollable]
1613
+ });
1614
+ }
1615
+ static {
1616
+ this.ɵinj = ɵɵdefineInjector({});
1617
+ }
1618
+ };
1619
+ (() => {
1620
+ (typeof ngDevMode === "undefined" || ngDevMode) && setClassMetadata(CdkScrollableModule, [{
1621
+ type: NgModule,
1622
+ args: [{
1623
+ exports: [CdkScrollable],
1624
+ imports: [CdkScrollable]
1625
+ }]
1626
+ }], null, null);
1627
+ })();
1628
+ var ScrollingModule = class _ScrollingModule {
1629
+ static {
1630
+ this.ɵfac = function ScrollingModule_Factory(__ngFactoryType__) {
1631
+ return new (__ngFactoryType__ || _ScrollingModule)();
1632
+ };
1633
+ }
1634
+ static {
1635
+ this.ɵmod = ɵɵdefineNgModule({
1636
+ type: _ScrollingModule,
1637
+ imports: [BidiModule, CdkScrollableModule, CdkVirtualScrollViewport, CdkFixedSizeVirtualScroll, CdkVirtualForOf, CdkVirtualScrollableWindow, CdkVirtualScrollableElement],
1638
+ exports: [BidiModule, CdkScrollableModule, CdkFixedSizeVirtualScroll, CdkVirtualForOf, CdkVirtualScrollViewport, CdkVirtualScrollableWindow, CdkVirtualScrollableElement]
1639
+ });
1640
+ }
1641
+ static {
1642
+ this.ɵinj = ɵɵdefineInjector({
1643
+ imports: [BidiModule, CdkScrollableModule, BidiModule, CdkScrollableModule]
1644
+ });
1645
+ }
1646
+ };
1647
+ (() => {
1648
+ (typeof ngDevMode === "undefined" || ngDevMode) && setClassMetadata(ScrollingModule, [{
1649
+ type: NgModule,
1650
+ args: [{
1651
+ imports: [BidiModule, CdkScrollableModule, CdkVirtualScrollViewport, CdkFixedSizeVirtualScroll, CdkVirtualForOf, CdkVirtualScrollableWindow, CdkVirtualScrollableElement],
1652
+ exports: [BidiModule, CdkScrollableModule, CdkFixedSizeVirtualScroll, CdkVirtualForOf, CdkVirtualScrollViewport, CdkVirtualScrollableWindow, CdkVirtualScrollableElement]
1653
+ }]
1654
+ }], null, null);
1655
+ })();
1656
+
1657
+ // node_modules/@angular/cdk/fesm2022/portal.mjs
1658
+ function throwNullPortalError() {
1659
+ throw Error("Must provide a portal to attach");
1660
+ }
1661
+ function throwPortalAlreadyAttachedError() {
1662
+ throw Error("Host already has a portal attached");
1663
+ }
1664
+ function throwPortalOutletAlreadyDisposedError() {
1665
+ throw Error("This PortalOutlet has already been disposed");
1666
+ }
1667
+ function throwUnknownPortalTypeError() {
1668
+ throw Error("Attempting to attach an unknown Portal type. BasePortalOutlet accepts either a ComponentPortal or a TemplatePortal.");
1669
+ }
1670
+ function throwNullPortalOutletError() {
1671
+ throw Error("Attempting to attach a portal to a null PortalOutlet");
1672
+ }
1673
+ function throwNoPortalAttachedError() {
1674
+ throw Error("Attempting to detach a portal that is not attached to a host");
1675
+ }
1676
+ var Portal = class {
1677
+ /** Attach this portal to a host. */
1678
+ attach(host) {
1679
+ if (typeof ngDevMode === "undefined" || ngDevMode) {
1680
+ if (host == null) {
1681
+ throwNullPortalOutletError();
1682
+ }
1683
+ if (host.hasAttached()) {
1684
+ throwPortalAlreadyAttachedError();
1685
+ }
1686
+ }
1687
+ this._attachedHost = host;
1688
+ return host.attach(this);
1689
+ }
1690
+ /** Detach this portal from its host */
1691
+ detach() {
1692
+ let host = this._attachedHost;
1693
+ if (host != null) {
1694
+ this._attachedHost = null;
1695
+ host.detach();
1696
+ } else if (typeof ngDevMode === "undefined" || ngDevMode) {
1697
+ throwNoPortalAttachedError();
1698
+ }
1699
+ }
1700
+ /** Whether this portal is attached to a host. */
1701
+ get isAttached() {
1702
+ return this._attachedHost != null;
1703
+ }
1704
+ /**
1705
+ * Sets the PortalOutlet reference without performing `attach()`. This is used directly by
1706
+ * the PortalOutlet when it is performing an `attach()` or `detach()`.
1707
+ */
1708
+ setAttachedHost(host) {
1709
+ this._attachedHost = host;
1710
+ }
1711
+ };
1712
+ var ComponentPortal = class extends Portal {
1713
+ constructor(component, viewContainerRef, injector, componentFactoryResolver, projectableNodes) {
1714
+ super();
1715
+ this.component = component;
1716
+ this.viewContainerRef = viewContainerRef;
1717
+ this.injector = injector;
1718
+ this.componentFactoryResolver = componentFactoryResolver;
1719
+ this.projectableNodes = projectableNodes;
1720
+ }
1721
+ };
1722
+ var TemplatePortal = class extends Portal {
1723
+ constructor(templateRef, viewContainerRef, context, injector) {
1724
+ super();
1725
+ this.templateRef = templateRef;
1726
+ this.viewContainerRef = viewContainerRef;
1727
+ this.context = context;
1728
+ this.injector = injector;
1729
+ }
1730
+ get origin() {
1731
+ return this.templateRef.elementRef;
1732
+ }
1733
+ /**
1734
+ * Attach the portal to the provided `PortalOutlet`.
1735
+ * When a context is provided it will override the `context` property of the `TemplatePortal`
1736
+ * instance.
1737
+ */
1738
+ attach(host, context = this.context) {
1739
+ this.context = context;
1740
+ return super.attach(host);
1741
+ }
1742
+ detach() {
1743
+ this.context = void 0;
1744
+ return super.detach();
1745
+ }
1746
+ };
1747
+ var DomPortal = class extends Portal {
1748
+ constructor(element) {
1749
+ super();
1750
+ this.element = element instanceof ElementRef ? element.nativeElement : element;
1751
+ }
1752
+ };
1753
+ var BasePortalOutlet = class {
1754
+ constructor() {
1755
+ this._isDisposed = false;
1756
+ this.attachDomPortal = null;
1757
+ }
1758
+ /** Whether this host has an attached portal. */
1759
+ hasAttached() {
1760
+ return !!this._attachedPortal;
1761
+ }
1762
+ /** Attaches a portal. */
1763
+ attach(portal) {
1764
+ if (typeof ngDevMode === "undefined" || ngDevMode) {
1765
+ if (!portal) {
1766
+ throwNullPortalError();
1767
+ }
1768
+ if (this.hasAttached()) {
1769
+ throwPortalAlreadyAttachedError();
1770
+ }
1771
+ if (this._isDisposed) {
1772
+ throwPortalOutletAlreadyDisposedError();
1773
+ }
1774
+ }
1775
+ if (portal instanceof ComponentPortal) {
1776
+ this._attachedPortal = portal;
1777
+ return this.attachComponentPortal(portal);
1778
+ } else if (portal instanceof TemplatePortal) {
1779
+ this._attachedPortal = portal;
1780
+ return this.attachTemplatePortal(portal);
1781
+ } else if (this.attachDomPortal && portal instanceof DomPortal) {
1782
+ this._attachedPortal = portal;
1783
+ return this.attachDomPortal(portal);
1784
+ }
1785
+ if (typeof ngDevMode === "undefined" || ngDevMode) {
1786
+ throwUnknownPortalTypeError();
1787
+ }
1788
+ }
1789
+ /** Detaches a previously attached portal. */
1790
+ detach() {
1791
+ if (this._attachedPortal) {
1792
+ this._attachedPortal.setAttachedHost(null);
1793
+ this._attachedPortal = null;
1794
+ }
1795
+ this._invokeDisposeFn();
1796
+ }
1797
+ /** Permanently dispose of this portal host. */
1798
+ dispose() {
1799
+ if (this.hasAttached()) {
1800
+ this.detach();
1801
+ }
1802
+ this._invokeDisposeFn();
1803
+ this._isDisposed = true;
1804
+ }
1805
+ /** @docs-private */
1806
+ setDisposeFn(fn) {
1807
+ this._disposeFn = fn;
1808
+ }
1809
+ _invokeDisposeFn() {
1810
+ if (this._disposeFn) {
1811
+ this._disposeFn();
1812
+ this._disposeFn = null;
1813
+ }
1814
+ }
1815
+ };
1816
+ var DomPortalOutlet = class extends BasePortalOutlet {
1817
+ /**
1818
+ * @param outletElement Element into which the content is projected.
1819
+ * @param _componentFactoryResolver Used to resolve the component factory.
1820
+ * Only required when attaching component portals.
1821
+ * @param _appRef Reference to the application. Only used in component portals when there
1822
+ * is no `ViewContainerRef` available.
1823
+ * @param _defaultInjector Injector to use as a fallback when the portal being attached doesn't
1824
+ * have one. Only used for component portals.
1825
+ * @param _document Reference to the document. Used when attaching a DOM portal. Will eventually
1826
+ * become a required parameter.
1827
+ */
1828
+ constructor(outletElement, _componentFactoryResolver, _appRef, _defaultInjector, _document) {
1829
+ super();
1830
+ this.outletElement = outletElement;
1831
+ this._componentFactoryResolver = _componentFactoryResolver;
1832
+ this._appRef = _appRef;
1833
+ this._defaultInjector = _defaultInjector;
1834
+ this.attachDomPortal = (portal) => {
1835
+ if (!this._document && (typeof ngDevMode === "undefined" || ngDevMode)) {
1836
+ throw Error("Cannot attach DOM portal without _document constructor parameter");
1837
+ }
1838
+ const element = portal.element;
1839
+ if (!element.parentNode && (typeof ngDevMode === "undefined" || ngDevMode)) {
1840
+ throw Error("DOM portal content must be attached to a parent node.");
1841
+ }
1842
+ const anchorNode = this._document.createComment("dom-portal");
1843
+ element.parentNode.insertBefore(anchorNode, element);
1844
+ this.outletElement.appendChild(element);
1845
+ this._attachedPortal = portal;
1846
+ super.setDisposeFn(() => {
1847
+ if (anchorNode.parentNode) {
1848
+ anchorNode.parentNode.replaceChild(element, anchorNode);
1849
+ }
1850
+ });
1851
+ };
1852
+ this._document = _document;
1853
+ }
1854
+ /**
1855
+ * Attach the given ComponentPortal to DOM element using the ComponentFactoryResolver.
1856
+ * @param portal Portal to be attached
1857
+ * @returns Reference to the created component.
1858
+ */
1859
+ attachComponentPortal(portal) {
1860
+ const resolver = portal.componentFactoryResolver || this._componentFactoryResolver;
1861
+ if ((typeof ngDevMode === "undefined" || ngDevMode) && !resolver) {
1862
+ throw Error("Cannot attach component portal to outlet without a ComponentFactoryResolver.");
1863
+ }
1864
+ const componentFactory = resolver.resolveComponentFactory(portal.component);
1865
+ let componentRef;
1866
+ if (portal.viewContainerRef) {
1867
+ componentRef = portal.viewContainerRef.createComponent(componentFactory, portal.viewContainerRef.length, portal.injector || portal.viewContainerRef.injector, portal.projectableNodes || void 0);
1868
+ this.setDisposeFn(() => componentRef.destroy());
1869
+ } else {
1870
+ if ((typeof ngDevMode === "undefined" || ngDevMode) && !this._appRef) {
1871
+ throw Error("Cannot attach component portal to outlet without an ApplicationRef.");
1872
+ }
1873
+ componentRef = componentFactory.create(portal.injector || this._defaultInjector || Injector.NULL);
1874
+ this._appRef.attachView(componentRef.hostView);
1875
+ this.setDisposeFn(() => {
1876
+ if (this._appRef.viewCount > 0) {
1877
+ this._appRef.detachView(componentRef.hostView);
1878
+ }
1879
+ componentRef.destroy();
1880
+ });
1881
+ }
1882
+ this.outletElement.appendChild(this._getComponentRootNode(componentRef));
1883
+ this._attachedPortal = portal;
1884
+ return componentRef;
1885
+ }
1886
+ /**
1887
+ * Attaches a template portal to the DOM as an embedded view.
1888
+ * @param portal Portal to be attached.
1889
+ * @returns Reference to the created embedded view.
1890
+ */
1891
+ attachTemplatePortal(portal) {
1892
+ let viewContainer = portal.viewContainerRef;
1893
+ let viewRef = viewContainer.createEmbeddedView(portal.templateRef, portal.context, {
1894
+ injector: portal.injector
1895
+ });
1896
+ viewRef.rootNodes.forEach((rootNode) => this.outletElement.appendChild(rootNode));
1897
+ viewRef.detectChanges();
1898
+ this.setDisposeFn(() => {
1899
+ let index = viewContainer.indexOf(viewRef);
1900
+ if (index !== -1) {
1901
+ viewContainer.remove(index);
1902
+ }
1903
+ });
1904
+ this._attachedPortal = portal;
1905
+ return viewRef;
1906
+ }
1907
+ /**
1908
+ * Clears out a portal from the DOM.
1909
+ */
1910
+ dispose() {
1911
+ super.dispose();
1912
+ this.outletElement.remove();
1913
+ }
1914
+ /** Gets the root HTMLElement for an instantiated component. */
1915
+ _getComponentRootNode(componentRef) {
1916
+ return componentRef.hostView.rootNodes[0];
1917
+ }
1918
+ };
1919
+ var CdkPortal = class _CdkPortal extends TemplatePortal {
1920
+ constructor(templateRef, viewContainerRef) {
1921
+ super(templateRef, viewContainerRef);
1922
+ }
1923
+ static {
1924
+ this.ɵfac = function CdkPortal_Factory(__ngFactoryType__) {
1925
+ return new (__ngFactoryType__ || _CdkPortal)(ɵɵdirectiveInject(TemplateRef), ɵɵdirectiveInject(ViewContainerRef));
1926
+ };
1927
+ }
1928
+ static {
1929
+ this.ɵdir = ɵɵdefineDirective({
1930
+ type: _CdkPortal,
1931
+ selectors: [["", "cdkPortal", ""]],
1932
+ exportAs: ["cdkPortal"],
1933
+ standalone: true,
1934
+ features: [ɵɵInheritDefinitionFeature]
1935
+ });
1936
+ }
1937
+ };
1938
+ (() => {
1939
+ (typeof ngDevMode === "undefined" || ngDevMode) && setClassMetadata(CdkPortal, [{
1940
+ type: Directive,
1941
+ args: [{
1942
+ selector: "[cdkPortal]",
1943
+ exportAs: "cdkPortal",
1944
+ standalone: true
1945
+ }]
1946
+ }], () => [{
1947
+ type: TemplateRef
1948
+ }, {
1949
+ type: ViewContainerRef
1950
+ }], null);
1951
+ })();
1952
+ var TemplatePortalDirective = class _TemplatePortalDirective extends CdkPortal {
1953
+ static {
1954
+ this.ɵfac = /* @__PURE__ */ (() => {
1955
+ let ɵTemplatePortalDirective_BaseFactory;
1956
+ return function TemplatePortalDirective_Factory(__ngFactoryType__) {
1957
+ return (ɵTemplatePortalDirective_BaseFactory || (ɵTemplatePortalDirective_BaseFactory = ɵɵgetInheritedFactory(_TemplatePortalDirective)))(__ngFactoryType__ || _TemplatePortalDirective);
1958
+ };
1959
+ })();
1960
+ }
1961
+ static {
1962
+ this.ɵdir = ɵɵdefineDirective({
1963
+ type: _TemplatePortalDirective,
1964
+ selectors: [["", "cdk-portal", ""], ["", "portal", ""]],
1965
+ exportAs: ["cdkPortal"],
1966
+ standalone: true,
1967
+ features: [ɵɵProvidersFeature([{
1968
+ provide: CdkPortal,
1969
+ useExisting: _TemplatePortalDirective
1970
+ }]), ɵɵInheritDefinitionFeature]
1971
+ });
1972
+ }
1973
+ };
1974
+ (() => {
1975
+ (typeof ngDevMode === "undefined" || ngDevMode) && setClassMetadata(TemplatePortalDirective, [{
1976
+ type: Directive,
1977
+ args: [{
1978
+ selector: "[cdk-portal], [portal]",
1979
+ exportAs: "cdkPortal",
1980
+ providers: [{
1981
+ provide: CdkPortal,
1982
+ useExisting: TemplatePortalDirective
1983
+ }],
1984
+ standalone: true
1985
+ }]
1986
+ }], null, null);
1987
+ })();
1988
+ var CdkPortalOutlet = class _CdkPortalOutlet extends BasePortalOutlet {
1989
+ constructor(_componentFactoryResolver, _viewContainerRef, _document) {
1990
+ super();
1991
+ this._componentFactoryResolver = _componentFactoryResolver;
1992
+ this._viewContainerRef = _viewContainerRef;
1993
+ this._isInitialized = false;
1994
+ this.attached = new EventEmitter();
1995
+ this.attachDomPortal = (portal) => {
1996
+ if (!this._document && (typeof ngDevMode === "undefined" || ngDevMode)) {
1997
+ throw Error("Cannot attach DOM portal without _document constructor parameter");
1998
+ }
1999
+ const element = portal.element;
2000
+ if (!element.parentNode && (typeof ngDevMode === "undefined" || ngDevMode)) {
2001
+ throw Error("DOM portal content must be attached to a parent node.");
2002
+ }
2003
+ const anchorNode = this._document.createComment("dom-portal");
2004
+ portal.setAttachedHost(this);
2005
+ element.parentNode.insertBefore(anchorNode, element);
2006
+ this._getRootNode().appendChild(element);
2007
+ this._attachedPortal = portal;
2008
+ super.setDisposeFn(() => {
2009
+ if (anchorNode.parentNode) {
2010
+ anchorNode.parentNode.replaceChild(element, anchorNode);
2011
+ }
2012
+ });
2013
+ };
2014
+ this._document = _document;
2015
+ }
2016
+ /** Portal associated with the Portal outlet. */
2017
+ get portal() {
2018
+ return this._attachedPortal;
2019
+ }
2020
+ set portal(portal) {
2021
+ if (this.hasAttached() && !portal && !this._isInitialized) {
2022
+ return;
2023
+ }
2024
+ if (this.hasAttached()) {
2025
+ super.detach();
2026
+ }
2027
+ if (portal) {
2028
+ super.attach(portal);
2029
+ }
2030
+ this._attachedPortal = portal || null;
2031
+ }
2032
+ /** Component or view reference that is attached to the portal. */
2033
+ get attachedRef() {
2034
+ return this._attachedRef;
2035
+ }
2036
+ ngOnInit() {
2037
+ this._isInitialized = true;
2038
+ }
2039
+ ngOnDestroy() {
2040
+ super.dispose();
2041
+ this._attachedRef = this._attachedPortal = null;
2042
+ }
2043
+ /**
2044
+ * Attach the given ComponentPortal to this PortalOutlet using the ComponentFactoryResolver.
2045
+ *
2046
+ * @param portal Portal to be attached to the portal outlet.
2047
+ * @returns Reference to the created component.
2048
+ */
2049
+ attachComponentPortal(portal) {
2050
+ portal.setAttachedHost(this);
2051
+ const viewContainerRef = portal.viewContainerRef != null ? portal.viewContainerRef : this._viewContainerRef;
2052
+ const resolver = portal.componentFactoryResolver || this._componentFactoryResolver;
2053
+ const componentFactory = resolver.resolveComponentFactory(portal.component);
2054
+ const ref = viewContainerRef.createComponent(componentFactory, viewContainerRef.length, portal.injector || viewContainerRef.injector, portal.projectableNodes || void 0);
2055
+ if (viewContainerRef !== this._viewContainerRef) {
2056
+ this._getRootNode().appendChild(ref.hostView.rootNodes[0]);
2057
+ }
2058
+ super.setDisposeFn(() => ref.destroy());
2059
+ this._attachedPortal = portal;
2060
+ this._attachedRef = ref;
2061
+ this.attached.emit(ref);
2062
+ return ref;
2063
+ }
2064
+ /**
2065
+ * Attach the given TemplatePortal to this PortalHost as an embedded View.
2066
+ * @param portal Portal to be attached.
2067
+ * @returns Reference to the created embedded view.
2068
+ */
2069
+ attachTemplatePortal(portal) {
2070
+ portal.setAttachedHost(this);
2071
+ const viewRef = this._viewContainerRef.createEmbeddedView(portal.templateRef, portal.context, {
2072
+ injector: portal.injector
2073
+ });
2074
+ super.setDisposeFn(() => this._viewContainerRef.clear());
2075
+ this._attachedPortal = portal;
2076
+ this._attachedRef = viewRef;
2077
+ this.attached.emit(viewRef);
2078
+ return viewRef;
2079
+ }
2080
+ /** Gets the root node of the portal outlet. */
2081
+ _getRootNode() {
2082
+ const nativeElement = this._viewContainerRef.element.nativeElement;
2083
+ return nativeElement.nodeType === nativeElement.ELEMENT_NODE ? nativeElement : nativeElement.parentNode;
2084
+ }
2085
+ static {
2086
+ this.ɵfac = function CdkPortalOutlet_Factory(__ngFactoryType__) {
2087
+ return new (__ngFactoryType__ || _CdkPortalOutlet)(ɵɵdirectiveInject(ComponentFactoryResolver$1), ɵɵdirectiveInject(ViewContainerRef), ɵɵdirectiveInject(DOCUMENT));
2088
+ };
2089
+ }
2090
+ static {
2091
+ this.ɵdir = ɵɵdefineDirective({
2092
+ type: _CdkPortalOutlet,
2093
+ selectors: [["", "cdkPortalOutlet", ""]],
2094
+ inputs: {
2095
+ portal: [0, "cdkPortalOutlet", "portal"]
2096
+ },
2097
+ outputs: {
2098
+ attached: "attached"
2099
+ },
2100
+ exportAs: ["cdkPortalOutlet"],
2101
+ standalone: true,
2102
+ features: [ɵɵInheritDefinitionFeature]
2103
+ });
2104
+ }
2105
+ };
2106
+ (() => {
2107
+ (typeof ngDevMode === "undefined" || ngDevMode) && setClassMetadata(CdkPortalOutlet, [{
2108
+ type: Directive,
2109
+ args: [{
2110
+ selector: "[cdkPortalOutlet]",
2111
+ exportAs: "cdkPortalOutlet",
2112
+ standalone: true
2113
+ }]
2114
+ }], () => [{
2115
+ type: ComponentFactoryResolver$1
2116
+ }, {
2117
+ type: ViewContainerRef
2118
+ }, {
2119
+ type: void 0,
2120
+ decorators: [{
2121
+ type: Inject,
2122
+ args: [DOCUMENT]
2123
+ }]
2124
+ }], {
2125
+ portal: [{
2126
+ type: Input,
2127
+ args: ["cdkPortalOutlet"]
2128
+ }],
2129
+ attached: [{
2130
+ type: Output
2131
+ }]
2132
+ });
2133
+ })();
2134
+ var PortalHostDirective = class _PortalHostDirective extends CdkPortalOutlet {
2135
+ static {
2136
+ this.ɵfac = /* @__PURE__ */ (() => {
2137
+ let ɵPortalHostDirective_BaseFactory;
2138
+ return function PortalHostDirective_Factory(__ngFactoryType__) {
2139
+ return (ɵPortalHostDirective_BaseFactory || (ɵPortalHostDirective_BaseFactory = ɵɵgetInheritedFactory(_PortalHostDirective)))(__ngFactoryType__ || _PortalHostDirective);
2140
+ };
2141
+ })();
2142
+ }
2143
+ static {
2144
+ this.ɵdir = ɵɵdefineDirective({
2145
+ type: _PortalHostDirective,
2146
+ selectors: [["", "cdkPortalHost", ""], ["", "portalHost", ""]],
2147
+ inputs: {
2148
+ portal: [0, "cdkPortalHost", "portal"]
2149
+ },
2150
+ exportAs: ["cdkPortalHost"],
2151
+ standalone: true,
2152
+ features: [ɵɵProvidersFeature([{
2153
+ provide: CdkPortalOutlet,
2154
+ useExisting: _PortalHostDirective
2155
+ }]), ɵɵInheritDefinitionFeature]
2156
+ });
2157
+ }
2158
+ };
2159
+ (() => {
2160
+ (typeof ngDevMode === "undefined" || ngDevMode) && setClassMetadata(PortalHostDirective, [{
2161
+ type: Directive,
2162
+ args: [{
2163
+ selector: "[cdkPortalHost], [portalHost]",
2164
+ exportAs: "cdkPortalHost",
2165
+ inputs: [{
2166
+ name: "portal",
2167
+ alias: "cdkPortalHost"
2168
+ }],
2169
+ providers: [{
2170
+ provide: CdkPortalOutlet,
2171
+ useExisting: PortalHostDirective
2172
+ }],
2173
+ standalone: true
2174
+ }]
2175
+ }], null, null);
2176
+ })();
2177
+ var PortalModule = class _PortalModule {
2178
+ static {
2179
+ this.ɵfac = function PortalModule_Factory(__ngFactoryType__) {
2180
+ return new (__ngFactoryType__ || _PortalModule)();
2181
+ };
2182
+ }
2183
+ static {
2184
+ this.ɵmod = ɵɵdefineNgModule({
2185
+ type: _PortalModule,
2186
+ imports: [CdkPortal, CdkPortalOutlet, TemplatePortalDirective, PortalHostDirective],
2187
+ exports: [CdkPortal, CdkPortalOutlet, TemplatePortalDirective, PortalHostDirective]
2188
+ });
2189
+ }
2190
+ static {
2191
+ this.ɵinj = ɵɵdefineInjector({});
2192
+ }
2193
+ };
2194
+ (() => {
2195
+ (typeof ngDevMode === "undefined" || ngDevMode) && setClassMetadata(PortalModule, [{
2196
+ type: NgModule,
2197
+ args: [{
2198
+ imports: [CdkPortal, CdkPortalOutlet, TemplatePortalDirective, PortalHostDirective],
2199
+ exports: [CdkPortal, CdkPortalOutlet, TemplatePortalDirective, PortalHostDirective]
2200
+ }]
2201
+ }], null, null);
2202
+ })();
2203
+
2204
+ export {
2205
+ ScrollDispatcher,
2206
+ CdkScrollable,
2207
+ ViewportRuler,
2208
+ CdkScrollableModule,
2209
+ ScrollingModule,
2210
+ ComponentPortal,
2211
+ TemplatePortal,
2212
+ BasePortalOutlet,
2213
+ DomPortalOutlet,
2214
+ CdkPortal,
2215
+ CdkPortalOutlet,
2216
+ PortalModule
2217
+ };
2218
+ //# sourceMappingURL=chunk-57TVY4HY.js.map