UNPKG

85.4 kBJavaScriptView Raw
1/**
2 * @license
3 * Copyright Google LLC All Rights Reserved.
4 *
5 * Use of this source code is governed by an MIT-style license that can be
6 * found in the LICENSE file at https://angular.io/license
7 */
8import { coerceElement } from '@angular/cdk/coercion';
9import { _getShadowRoot } from '@angular/cdk/platform';
10import { Subject, Subscription, interval, animationFrameScheduler } from 'rxjs';
11import { takeUntil } from 'rxjs/operators';
12import { isPointerNearClientRect, isInsideClientRect } from './dom/client-rect';
13import { ParentPositionTracker } from './dom/parent-position-tracker';
14import { SingleAxisSortStrategy } from './sorting/single-axis-sort-strategy';
15/**
16 * Proximity, as a ratio to width/height, at which a
17 * dragged item will affect the drop container.
18 */
19const DROP_PROXIMITY_THRESHOLD = 0.05;
20/**
21 * Proximity, as a ratio to width/height at which to start auto-scrolling the drop list or the
22 * viewport. The value comes from trying it out manually until it feels right.
23 */
24const SCROLL_PROXIMITY_THRESHOLD = 0.05;
25/**
26 * Reference to a drop list. Used to manipulate or dispose of the container.
27 */
28export class DropListRef {
29 constructor(element, _dragDropRegistry, _document, _ngZone, _viewportRuler) {
30 this._dragDropRegistry = _dragDropRegistry;
31 this._ngZone = _ngZone;
32 this._viewportRuler = _viewportRuler;
33 /** Whether starting a dragging sequence from this container is disabled. */
34 this.disabled = false;
35 /** Whether sorting items within the list is disabled. */
36 this.sortingDisabled = false;
37 /**
38 * Whether auto-scrolling the view when the user
39 * moves their pointer close to the edges is disabled.
40 */
41 this.autoScrollDisabled = false;
42 /** Number of pixels to scroll for each frame when auto-scrolling an element. */
43 this.autoScrollStep = 2;
44 /**
45 * Function that is used to determine whether an item
46 * is allowed to be moved into a drop container.
47 */
48 this.enterPredicate = () => true;
49 /** Function that is used to determine whether an item can be sorted into a particular index. */
50 this.sortPredicate = () => true;
51 /** Emits right before dragging has started. */
52 this.beforeStarted = new Subject();
53 /**
54 * Emits when the user has moved a new drag item into this container.
55 */
56 this.entered = new Subject();
57 /**
58 * Emits when the user removes an item from the container
59 * by dragging it into another container.
60 */
61 this.exited = new Subject();
62 /** Emits when the user drops an item inside the container. */
63 this.dropped = new Subject();
64 /** Emits as the user is swapping items while actively dragging. */
65 this.sorted = new Subject();
66 /** Emits when a dragging sequence is started in a list connected to the current one. */
67 this.receivingStarted = new Subject();
68 /** Emits when a dragging sequence is stopped from a list connected to the current one. */
69 this.receivingStopped = new Subject();
70 /** Whether an item in the list is being dragged. */
71 this._isDragging = false;
72 /** Draggable items in the container. */
73 this._draggables = [];
74 /** Drop lists that are connected to the current one. */
75 this._siblings = [];
76 /** Connected siblings that currently have a dragged item. */
77 this._activeSiblings = new Set();
78 /** Subscription to the window being scrolled. */
79 this._viewportScrollSubscription = Subscription.EMPTY;
80 /** Vertical direction in which the list is currently scrolling. */
81 this._verticalScrollDirection = 0 /* AutoScrollVerticalDirection.NONE */;
82 /** Horizontal direction in which the list is currently scrolling. */
83 this._horizontalScrollDirection = 0 /* AutoScrollHorizontalDirection.NONE */;
84 /** Used to signal to the current auto-scroll sequence when to stop. */
85 this._stopScrollTimers = new Subject();
86 /** Shadow root of the current element. Necessary for `elementFromPoint` to resolve correctly. */
87 this._cachedShadowRoot = null;
88 /** Starts the interval that'll auto-scroll the element. */
89 this._startScrollInterval = () => {
90 this._stopScrolling();
91 interval(0, animationFrameScheduler)
92 .pipe(takeUntil(this._stopScrollTimers))
93 .subscribe(() => {
94 const node = this._scrollNode;
95 const scrollStep = this.autoScrollStep;
96 if (this._verticalScrollDirection === 1 /* AutoScrollVerticalDirection.UP */) {
97 node.scrollBy(0, -scrollStep);
98 }
99 else if (this._verticalScrollDirection === 2 /* AutoScrollVerticalDirection.DOWN */) {
100 node.scrollBy(0, scrollStep);
101 }
102 if (this._horizontalScrollDirection === 1 /* AutoScrollHorizontalDirection.LEFT */) {
103 node.scrollBy(-scrollStep, 0);
104 }
105 else if (this._horizontalScrollDirection === 2 /* AutoScrollHorizontalDirection.RIGHT */) {
106 node.scrollBy(scrollStep, 0);
107 }
108 });
109 };
110 this.element = coerceElement(element);
111 this._document = _document;
112 this.withScrollableParents([this.element]);
113 _dragDropRegistry.registerDropContainer(this);
114 this._parentPositions = new ParentPositionTracker(_document);
115 this._sortStrategy = new SingleAxisSortStrategy(this.element, _dragDropRegistry);
116 this._sortStrategy.withSortPredicate((index, item) => this.sortPredicate(index, item, this));
117 }
118 /** Removes the drop list functionality from the DOM element. */
119 dispose() {
120 this._stopScrolling();
121 this._stopScrollTimers.complete();
122 this._viewportScrollSubscription.unsubscribe();
123 this.beforeStarted.complete();
124 this.entered.complete();
125 this.exited.complete();
126 this.dropped.complete();
127 this.sorted.complete();
128 this.receivingStarted.complete();
129 this.receivingStopped.complete();
130 this._activeSiblings.clear();
131 this._scrollNode = null;
132 this._parentPositions.clear();
133 this._dragDropRegistry.removeDropContainer(this);
134 }
135 /** Whether an item from this list is currently being dragged. */
136 isDragging() {
137 return this._isDragging;
138 }
139 /** Starts dragging an item. */
140 start() {
141 this._draggingStarted();
142 this._notifyReceivingSiblings();
143 }
144 /**
145 * Attempts to move an item into the container.
146 * @param item Item that was moved into the container.
147 * @param pointerX Position of the item along the X axis.
148 * @param pointerY Position of the item along the Y axis.
149 * @param index Index at which the item entered. If omitted, the container will try to figure it
150 * out automatically.
151 */
152 enter(item, pointerX, pointerY, index) {
153 this._draggingStarted();
154 // If sorting is disabled, we want the item to return to its starting
155 // position if the user is returning it to its initial container.
156 if (index == null && this.sortingDisabled) {
157 index = this._draggables.indexOf(item);
158 }
159 this._sortStrategy.enter(item, pointerX, pointerY, index);
160 // Note that this usually happens inside `_draggingStarted` as well, but the dimensions
161 // can change when the sort strategy moves the item around inside `enter`.
162 this._cacheParentPositions();
163 // Notify siblings at the end so that the item has been inserted into the `activeDraggables`.
164 this._notifyReceivingSiblings();
165 this.entered.next({ item, container: this, currentIndex: this.getItemIndex(item) });
166 }
167 /**
168 * Removes an item from the container after it was dragged into another container by the user.
169 * @param item Item that was dragged out.
170 */
171 exit(item) {
172 this._reset();
173 this.exited.next({ item, container: this });
174 }
175 /**
176 * Drops an item into this container.
177 * @param item Item being dropped into the container.
178 * @param currentIndex Index at which the item should be inserted.
179 * @param previousIndex Index of the item when dragging started.
180 * @param previousContainer Container from which the item got dragged in.
181 * @param isPointerOverContainer Whether the user's pointer was over the
182 * container when the item was dropped.
183 * @param distance Distance the user has dragged since the start of the dragging sequence.
184 * @param event Event that triggered the dropping sequence.
185 *
186 * @breaking-change 15.0.0 `previousIndex` and `event` parameters to become required.
187 */
188 drop(item, currentIndex, previousIndex, previousContainer, isPointerOverContainer, distance, dropPoint, event = {}) {
189 this._reset();
190 this.dropped.next({
191 item,
192 currentIndex,
193 previousIndex,
194 container: this,
195 previousContainer,
196 isPointerOverContainer,
197 distance,
198 dropPoint,
199 event,
200 });
201 }
202 /**
203 * Sets the draggable items that are a part of this list.
204 * @param items Items that are a part of this list.
205 */
206 withItems(items) {
207 const previousItems = this._draggables;
208 this._draggables = items;
209 items.forEach(item => item._withDropContainer(this));
210 if (this.isDragging()) {
211 const draggedItems = previousItems.filter(item => item.isDragging());
212 // If all of the items being dragged were removed
213 // from the list, abort the current drag sequence.
214 if (draggedItems.every(item => items.indexOf(item) === -1)) {
215 this._reset();
216 }
217 else {
218 this._sortStrategy.withItems(this._draggables);
219 }
220 }
221 return this;
222 }
223 /** Sets the layout direction of the drop list. */
224 withDirection(direction) {
225 this._sortStrategy.direction = direction;
226 return this;
227 }
228 /**
229 * Sets the containers that are connected to this one. When two or more containers are
230 * connected, the user will be allowed to transfer items between them.
231 * @param connectedTo Other containers that the current containers should be connected to.
232 */
233 connectedTo(connectedTo) {
234 this._siblings = connectedTo.slice();
235 return this;
236 }
237 /**
238 * Sets the orientation of the container.
239 * @param orientation New orientation for the container.
240 */
241 withOrientation(orientation) {
242 // TODO(crisbeto): eventually we should be constructing the new sort strategy here based on
243 // the new orientation. For now we can assume that it'll always be `SingleAxisSortStrategy`.
244 this._sortStrategy.orientation = orientation;
245 return this;
246 }
247 /**
248 * Sets which parent elements are can be scrolled while the user is dragging.
249 * @param elements Elements that can be scrolled.
250 */
251 withScrollableParents(elements) {
252 const element = coerceElement(this.element);
253 // We always allow the current element to be scrollable
254 // so we need to ensure that it's in the array.
255 this._scrollableElements =
256 elements.indexOf(element) === -1 ? [element, ...elements] : elements.slice();
257 return this;
258 }
259 /** Gets the scrollable parents that are registered with this drop container. */
260 getScrollableParents() {
261 return this._scrollableElements;
262 }
263 /**
264 * Figures out the index of an item in the container.
265 * @param item Item whose index should be determined.
266 */
267 getItemIndex(item) {
268 return this._isDragging
269 ? this._sortStrategy.getItemIndex(item)
270 : this._draggables.indexOf(item);
271 }
272 /**
273 * Whether the list is able to receive the item that
274 * is currently being dragged inside a connected drop list.
275 */
276 isReceiving() {
277 return this._activeSiblings.size > 0;
278 }
279 /**
280 * Sorts an item inside the container based on its position.
281 * @param item Item to be sorted.
282 * @param pointerX Position of the item along the X axis.
283 * @param pointerY Position of the item along the Y axis.
284 * @param pointerDelta Direction in which the pointer is moving along each axis.
285 */
286 _sortItem(item, pointerX, pointerY, pointerDelta) {
287 // Don't sort the item if sorting is disabled or it's out of range.
288 if (this.sortingDisabled ||
289 !this._clientRect ||
290 !isPointerNearClientRect(this._clientRect, DROP_PROXIMITY_THRESHOLD, pointerX, pointerY)) {
291 return;
292 }
293 const result = this._sortStrategy.sort(item, pointerX, pointerY, pointerDelta);
294 if (result) {
295 this.sorted.next({
296 previousIndex: result.previousIndex,
297 currentIndex: result.currentIndex,
298 container: this,
299 item,
300 });
301 }
302 }
303 /**
304 * Checks whether the user's pointer is close to the edges of either the
305 * viewport or the drop list and starts the auto-scroll sequence.
306 * @param pointerX User's pointer position along the x axis.
307 * @param pointerY User's pointer position along the y axis.
308 */
309 _startScrollingIfNecessary(pointerX, pointerY) {
310 if (this.autoScrollDisabled) {
311 return;
312 }
313 let scrollNode;
314 let verticalScrollDirection = 0 /* AutoScrollVerticalDirection.NONE */;
315 let horizontalScrollDirection = 0 /* AutoScrollHorizontalDirection.NONE */;
316 // Check whether we should start scrolling any of the parent containers.
317 this._parentPositions.positions.forEach((position, element) => {
318 // We have special handling for the `document` below. Also this would be
319 // nicer with a for...of loop, but it requires changing a compiler flag.
320 if (element === this._document || !position.clientRect || scrollNode) {
321 return;
322 }
323 if (isPointerNearClientRect(position.clientRect, DROP_PROXIMITY_THRESHOLD, pointerX, pointerY)) {
324 [verticalScrollDirection, horizontalScrollDirection] = getElementScrollDirections(element, position.clientRect, pointerX, pointerY);
325 if (verticalScrollDirection || horizontalScrollDirection) {
326 scrollNode = element;
327 }
328 }
329 });
330 // Otherwise check if we can start scrolling the viewport.
331 if (!verticalScrollDirection && !horizontalScrollDirection) {
332 const { width, height } = this._viewportRuler.getViewportSize();
333 const clientRect = {
334 width,
335 height,
336 top: 0,
337 right: width,
338 bottom: height,
339 left: 0,
340 };
341 verticalScrollDirection = getVerticalScrollDirection(clientRect, pointerY);
342 horizontalScrollDirection = getHorizontalScrollDirection(clientRect, pointerX);
343 scrollNode = window;
344 }
345 if (scrollNode &&
346 (verticalScrollDirection !== this._verticalScrollDirection ||
347 horizontalScrollDirection !== this._horizontalScrollDirection ||
348 scrollNode !== this._scrollNode)) {
349 this._verticalScrollDirection = verticalScrollDirection;
350 this._horizontalScrollDirection = horizontalScrollDirection;
351 this._scrollNode = scrollNode;
352 if ((verticalScrollDirection || horizontalScrollDirection) && scrollNode) {
353 this._ngZone.runOutsideAngular(this._startScrollInterval);
354 }
355 else {
356 this._stopScrolling();
357 }
358 }
359 }
360 /** Stops any currently-running auto-scroll sequences. */
361 _stopScrolling() {
362 this._stopScrollTimers.next();
363 }
364 /** Starts the dragging sequence within the list. */
365 _draggingStarted() {
366 const styles = coerceElement(this.element).style;
367 this.beforeStarted.next();
368 this._isDragging = true;
369 // We need to disable scroll snapping while the user is dragging, because it breaks automatic
370 // scrolling. The browser seems to round the value based on the snapping points which means
371 // that we can't increment/decrement the scroll position.
372 this._initialScrollSnap = styles.msScrollSnapType || styles.scrollSnapType || '';
373 styles.scrollSnapType = styles.msScrollSnapType = 'none';
374 this._sortStrategy.start(this._draggables);
375 this._cacheParentPositions();
376 this._viewportScrollSubscription.unsubscribe();
377 this._listenToScrollEvents();
378 }
379 /** Caches the positions of the configured scrollable parents. */
380 _cacheParentPositions() {
381 const element = coerceElement(this.element);
382 this._parentPositions.cache(this._scrollableElements);
383 // The list element is always in the `scrollableElements`
384 // so we can take advantage of the cached `ClientRect`.
385 this._clientRect = this._parentPositions.positions.get(element).clientRect;
386 }
387 /** Resets the container to its initial state. */
388 _reset() {
389 this._isDragging = false;
390 const styles = coerceElement(this.element).style;
391 styles.scrollSnapType = styles.msScrollSnapType = this._initialScrollSnap;
392 this._siblings.forEach(sibling => sibling._stopReceiving(this));
393 this._sortStrategy.reset();
394 this._stopScrolling();
395 this._viewportScrollSubscription.unsubscribe();
396 this._parentPositions.clear();
397 }
398 /**
399 * Checks whether the user's pointer is positioned over the container.
400 * @param x Pointer position along the X axis.
401 * @param y Pointer position along the Y axis.
402 */
403 _isOverContainer(x, y) {
404 return this._clientRect != null && isInsideClientRect(this._clientRect, x, y);
405 }
406 /**
407 * Figures out whether an item should be moved into a sibling
408 * drop container, based on its current position.
409 * @param item Drag item that is being moved.
410 * @param x Position of the item along the X axis.
411 * @param y Position of the item along the Y axis.
412 */
413 _getSiblingContainerFromPosition(item, x, y) {
414 return this._siblings.find(sibling => sibling._canReceive(item, x, y));
415 }
416 /**
417 * Checks whether the drop list can receive the passed-in item.
418 * @param item Item that is being dragged into the list.
419 * @param x Position of the item along the X axis.
420 * @param y Position of the item along the Y axis.
421 */
422 _canReceive(item, x, y) {
423 if (!this._clientRect ||
424 !isInsideClientRect(this._clientRect, x, y) ||
425 !this.enterPredicate(item, this)) {
426 return false;
427 }
428 const elementFromPoint = this._getShadowRoot().elementFromPoint(x, y);
429 // If there's no element at the pointer position, then
430 // the client rect is probably scrolled out of the view.
431 if (!elementFromPoint) {
432 return false;
433 }
434 const nativeElement = coerceElement(this.element);
435 // The `ClientRect`, that we're using to find the container over which the user is
436 // hovering, doesn't give us any information on whether the element has been scrolled
437 // out of the view or whether it's overlapping with other containers. This means that
438 // we could end up transferring the item into a container that's invisible or is positioned
439 // below another one. We use the result from `elementFromPoint` to get the top-most element
440 // at the pointer position and to find whether it's one of the intersecting drop containers.
441 return elementFromPoint === nativeElement || nativeElement.contains(elementFromPoint);
442 }
443 /**
444 * Called by one of the connected drop lists when a dragging sequence has started.
445 * @param sibling Sibling in which dragging has started.
446 */
447 _startReceiving(sibling, items) {
448 const activeSiblings = this._activeSiblings;
449 if (!activeSiblings.has(sibling) &&
450 items.every(item => {
451 // Note that we have to add an exception to the `enterPredicate` for items that started off
452 // in this drop list. The drag ref has logic that allows an item to return to its initial
453 // container, if it has left the initial container and none of the connected containers
454 // allow it to enter. See `DragRef._updateActiveDropContainer` for more context.
455 return this.enterPredicate(item, this) || this._draggables.indexOf(item) > -1;
456 })) {
457 activeSiblings.add(sibling);
458 this._cacheParentPositions();
459 this._listenToScrollEvents();
460 this.receivingStarted.next({
461 initiator: sibling,
462 receiver: this,
463 items,
464 });
465 }
466 }
467 /**
468 * Called by a connected drop list when dragging has stopped.
469 * @param sibling Sibling whose dragging has stopped.
470 */
471 _stopReceiving(sibling) {
472 this._activeSiblings.delete(sibling);
473 this._viewportScrollSubscription.unsubscribe();
474 this.receivingStopped.next({ initiator: sibling, receiver: this });
475 }
476 /**
477 * Starts listening to scroll events on the viewport.
478 * Used for updating the internal state of the list.
479 */
480 _listenToScrollEvents() {
481 this._viewportScrollSubscription = this._dragDropRegistry
482 .scrolled(this._getShadowRoot())
483 .subscribe(event => {
484 if (this.isDragging()) {
485 const scrollDifference = this._parentPositions.handleScroll(event);
486 if (scrollDifference) {
487 this._sortStrategy.updateOnScroll(scrollDifference.top, scrollDifference.left);
488 }
489 }
490 else if (this.isReceiving()) {
491 this._cacheParentPositions();
492 }
493 });
494 }
495 /**
496 * Lazily resolves and returns the shadow root of the element. We do this in a function, rather
497 * than saving it in property directly on init, because we want to resolve it as late as possible
498 * in order to ensure that the element has been moved into the shadow DOM. Doing it inside the
499 * constructor might be too early if the element is inside of something like `ngFor` or `ngIf`.
500 */
501 _getShadowRoot() {
502 if (!this._cachedShadowRoot) {
503 const shadowRoot = _getShadowRoot(coerceElement(this.element));
504 this._cachedShadowRoot = (shadowRoot || this._document);
505 }
506 return this._cachedShadowRoot;
507 }
508 /** Notifies any siblings that may potentially receive the item. */
509 _notifyReceivingSiblings() {
510 const draggedItems = this._sortStrategy
511 .getActiveItemsSnapshot()
512 .filter(item => item.isDragging());
513 this._siblings.forEach(sibling => sibling._startReceiving(this, draggedItems));
514 }
515}
516/**
517 * Gets whether the vertical auto-scroll direction of a node.
518 * @param clientRect Dimensions of the node.
519 * @param pointerY Position of the user's pointer along the y axis.
520 */
521function getVerticalScrollDirection(clientRect, pointerY) {
522 const { top, bottom, height } = clientRect;
523 const yThreshold = height * SCROLL_PROXIMITY_THRESHOLD;
524 if (pointerY >= top - yThreshold && pointerY <= top + yThreshold) {
525 return 1 /* AutoScrollVerticalDirection.UP */;
526 }
527 else if (pointerY >= bottom - yThreshold && pointerY <= bottom + yThreshold) {
528 return 2 /* AutoScrollVerticalDirection.DOWN */;
529 }
530 return 0 /* AutoScrollVerticalDirection.NONE */;
531}
532/**
533 * Gets whether the horizontal auto-scroll direction of a node.
534 * @param clientRect Dimensions of the node.
535 * @param pointerX Position of the user's pointer along the x axis.
536 */
537function getHorizontalScrollDirection(clientRect, pointerX) {
538 const { left, right, width } = clientRect;
539 const xThreshold = width * SCROLL_PROXIMITY_THRESHOLD;
540 if (pointerX >= left - xThreshold && pointerX <= left + xThreshold) {
541 return 1 /* AutoScrollHorizontalDirection.LEFT */;
542 }
543 else if (pointerX >= right - xThreshold && pointerX <= right + xThreshold) {
544 return 2 /* AutoScrollHorizontalDirection.RIGHT */;
545 }
546 return 0 /* AutoScrollHorizontalDirection.NONE */;
547}
548/**
549 * Gets the directions in which an element node should be scrolled,
550 * assuming that the user's pointer is already within it scrollable region.
551 * @param element Element for which we should calculate the scroll direction.
552 * @param clientRect Bounding client rectangle of the element.
553 * @param pointerX Position of the user's pointer along the x axis.
554 * @param pointerY Position of the user's pointer along the y axis.
555 */
556function getElementScrollDirections(element, clientRect, pointerX, pointerY) {
557 const computedVertical = getVerticalScrollDirection(clientRect, pointerY);
558 const computedHorizontal = getHorizontalScrollDirection(clientRect, pointerX);
559 let verticalScrollDirection = 0 /* AutoScrollVerticalDirection.NONE */;
560 let horizontalScrollDirection = 0 /* AutoScrollHorizontalDirection.NONE */;
561 // Note that we here we do some extra checks for whether the element is actually scrollable in
562 // a certain direction and we only assign the scroll direction if it is. We do this so that we
563 // can allow other elements to be scrolled, if the current element can't be scrolled anymore.
564 // This allows us to handle cases where the scroll regions of two scrollable elements overlap.
565 if (computedVertical) {
566 const scrollTop = element.scrollTop;
567 if (computedVertical === 1 /* AutoScrollVerticalDirection.UP */) {
568 if (scrollTop > 0) {
569 verticalScrollDirection = 1 /* AutoScrollVerticalDirection.UP */;
570 }
571 }
572 else if (element.scrollHeight - scrollTop > element.clientHeight) {
573 verticalScrollDirection = 2 /* AutoScrollVerticalDirection.DOWN */;
574 }
575 }
576 if (computedHorizontal) {
577 const scrollLeft = element.scrollLeft;
578 if (computedHorizontal === 1 /* AutoScrollHorizontalDirection.LEFT */) {
579 if (scrollLeft > 0) {
580 horizontalScrollDirection = 1 /* AutoScrollHorizontalDirection.LEFT */;
581 }
582 }
583 else if (element.scrollWidth - scrollLeft > element.clientWidth) {
584 horizontalScrollDirection = 2 /* AutoScrollHorizontalDirection.RIGHT */;
585 }
586 }
587 return [verticalScrollDirection, horizontalScrollDirection];
588}
589//# sourceMappingURL=data:application/json;base64,eyJ2ZXJzaW9uIjozLCJmaWxlIjoiZHJvcC1saXN0LXJlZi5qcyIsInNvdXJjZVJvb3QiOiIiLCJzb3VyY2VzIjpbIi4uLy4uLy4uLy4uLy4uLy4uL3NyYy9jZGsvZHJhZy1kcm9wL2Ryb3AtbGlzdC1yZWYudHMiXSwibmFtZX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