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Ae;QACtH,IAAI,WAAW,MAAM;YACnB,QAAQ,OAAO,GAAG;YAClB,IAAI,UAAU;gBACZ,QAAQ,OAAO,GAAG,SAAS,GAAG;gBAC9B,SAAS,OAAO,GAAG,QAAQ,GAAG;YAChC;YAEA,IAAI,aAAa,MACf,YAAY;YAGd,cAAc,OAAO,CAAC;YACtB,WAAW;QACb;QAEA,cAAc,YAAY,OAAO,GAAG,WAAW,OAAO,CAAC,YAAY,OAAO,IAAI;IAChF;IAEA,8HAA8H;IAC9H,oHAAoH;IACpH,+GAA+G;IAC/G,IAAI,YAAY,SAAS,IAAI,KAAK,aAAa;QAC7C,IAAI,UAAU,SAAS,OAAO;QAC9B,cAAc,UAAU,CAAC,SAAS,GAAG;QAErC,IAAI,SAAS;YACX,WAAW,cAAc,OAAO,CAAC;YACjC,SAAS,OAAO,GAAG;QACrB,OACE,WAAW;IAEf;IAEA,OAAO;QAAC,WAAW,OAAO;QAAM,UAAU,OAAO;KAAK;AACxD","sources":["packages/react-aria/src/collections/BaseCollection.ts"],"sourcesContent":["/*\n * Copyright 2024 Adobe. All rights reserved.\n * This file is licensed to you under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License. You may obtain a copy\n * of the License at http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software distributed under\n * the License is distributed on an \"AS IS\" BASIS, WITHOUT WARRANTIES OR REPRESENTATIONS\n * OF ANY KIND, either express or implied. See the License for the specific language\n * governing permissions and limitations under the License.\n */\n\nimport {Collection as ICollection, Key, Node} from '@react-types/shared';\nimport {ReactElement, ReactNode} from 'react';\n\nexport type Mutable<T> = {\n  -readonly[P in keyof T]: T[P]\n}\n\ntype FilterFn<T> = (textValue: string, node: Node<T>) => boolean;\n\n/** An immutable object representing a Node in a Collection. */\nexport class CollectionNode<T> implements Node<T> {\n  static readonly type: string;\n  readonly type: string;\n  readonly key: Key;\n  readonly value: T | null = null;\n  readonly level: number = 0;\n  readonly hasChildNodes: boolean = false;\n  readonly rendered: ReactNode = null;\n  readonly textValue: string = '';\n  readonly 'aria-label'?: string = undefined;\n  readonly index: number = 0;\n  readonly parentKey: Key | null = null;\n  readonly prevKey: Key | null = null;\n  readonly nextKey: Key | null = null;\n  readonly firstChildKey: Key | null = null;\n  readonly lastChildKey: Key | null = null;\n  readonly props: any = {};\n  readonly render?: (node: Node<any>) => ReactElement;\n  readonly colSpan: number | null = null;\n  readonly colIndex: number | null = null;\n\n  constructor(key: Key) {\n    this.type = (this.constructor as typeof CollectionNode).type;\n    this.key = key;\n  }\n\n  get childNodes(): Iterable<Node<T>> {\n    throw new Error('childNodes is not supported');\n  }\n\n  clone(): this {\n    let node: Mutable<this> = new (this.constructor as any)(this.key);\n    node.value = this.value;\n    node.level = this.level;\n    node.hasChildNodes = this.hasChildNodes;\n    node.rendered = this.rendered;\n    node.textValue = this.textValue;\n    node['aria-label'] = this['aria-label'];\n    node.index = this.index;\n    node.parentKey = this.parentKey;\n    node.prevKey = this.prevKey;\n    node.nextKey = this.nextKey;\n    node.firstChildKey = this.firstChildKey;\n    node.lastChildKey = this.lastChildKey;\n    node.props = this.props;\n    node.render = this.render;\n    node.colSpan = this.colSpan;\n    node.colIndex = this.colIndex;\n    return node;\n  }\n\n  // eslint-disable-next-line @typescript-eslint/no-unused-vars\n  filter(collection: BaseCollection<T>, newCollection: BaseCollection<T>, filterFn: FilterFn<T>): CollectionNode<T> | null {\n    let clone = this.clone();\n    newCollection.addDescendants(clone, collection);\n    return clone;\n  }\n}\n\nexport class FilterableNode<T> extends CollectionNode<T> {\n  filter(collection: BaseCollection<T>, newCollection: BaseCollection<T>, filterFn: FilterFn<T>): CollectionNode<T> | null {\n    let [firstKey, lastKey] = filterChildren(collection, newCollection, this.firstChildKey, filterFn);\n    let newNode: Mutable<CollectionNode<T>> = this.clone();\n    newNode.firstChildKey = firstKey;\n    newNode.lastChildKey = lastKey;\n    return newNode;\n  }\n}\n\nexport class HeaderNode extends CollectionNode<unknown> {\n  static readonly type = 'header';\n}\n\nexport class LoaderNode extends CollectionNode<unknown> {\n  static readonly type = 'loader';\n}\n\nexport class ItemNode<T> extends FilterableNode<T> {\n  static readonly type = 'item';\n\n  filter(collection: BaseCollection<T>, newCollection: BaseCollection<T>, filterFn: FilterFn<T>): ItemNode<T> | null {\n    if (filterFn(this.textValue, this)) {\n      let clone = this.clone();\n      newCollection.addDescendants(clone, collection);\n      return clone;\n    }\n\n    return null;\n  }\n}\n\nexport class SectionNode<T> extends FilterableNode<T> {\n  static readonly type = 'section';\n\n  filter(collection: BaseCollection<T>, newCollection: BaseCollection<T>, filterFn: FilterFn<T>): SectionNode<T> | null {\n    let filteredSection = super.filter(collection, newCollection, filterFn);\n    if (filteredSection) {\n      if (filteredSection.lastChildKey !== null) {\n        let lastChild = collection.getItem(filteredSection.lastChildKey);\n        if (lastChild && lastChild.type !== 'header') {\n          return filteredSection;\n        }\n      }\n    }\n\n    return null;\n  }\n}\n\n/**\n * An immutable Collection implementation. Updates are only allowed\n * when it is not marked as frozen. This can be subclassed to implement\n * custom collection behaviors.\n */\nexport class BaseCollection<T> implements ICollection<Node<T>> {\n  protected keyMap: Map<Key, CollectionNode<T>> = new Map();\n  protected firstKey: Key | null = null;\n  protected lastKey: Key | null = null;\n  protected frozen = false;\n  protected itemCount: number = 0;\n\n  get size(): number {\n    return this.itemCount;\n  }\n\n  getKeys(): IterableIterator<Key> {\n    return this.keyMap.keys();\n  }\n\n  *[Symbol.iterator](): IterableIterator<Node<T>> {\n    let node: Node<T> | undefined = this.firstKey != null ? this.keyMap.get(this.firstKey) : undefined;\n    while (node) {\n      yield node;\n      node = node.nextKey != null ? this.keyMap.get(node.nextKey) : undefined;\n    }\n  }\n\n  getChildren(key: Key): Iterable<Node<T>> {\n    let keyMap = this.keyMap;\n    return {\n      *[Symbol.iterator]() {\n        let parent = keyMap.get(key);\n        let node = parent?.firstChildKey != null ? keyMap.get(parent.firstChildKey) : null;\n        while (node) {\n          yield node as Node<T>;\n          node = node.nextKey != null ? keyMap.get(node.nextKey) : undefined;\n        }\n      }\n    };\n  }\n\n  getKeyBefore(key: Key): Key | null {\n    let node = this.keyMap.get(key);\n    if (!node) {\n      return null;\n    }\n\n    if (node.prevKey != null) {\n      node = this.keyMap.get(node.prevKey);\n\n      while (node && node.type !== 'item' && node.lastChildKey != null) {\n        node = this.keyMap.get(node.lastChildKey);\n      }\n\n      return node?.key ?? null;\n    }\n\n    return node.parentKey;\n  }\n\n  getKeyAfter(key: Key): Key | null {\n    let node = this.keyMap.get(key);\n    if (!node) {\n      return null;\n    }\n\n    if (node.type !== 'item' && node.firstChildKey != null) {\n      return node.firstChildKey;\n    }\n\n    while (node) {\n      if (node.nextKey != null) {\n        return node.nextKey;\n      }\n\n      if (node.parentKey != null) {\n        node = this.keyMap.get(node.parentKey);\n      } else {\n        return null;\n      }\n    }\n\n    return null;\n  }\n\n  getFirstKey(): Key | null {\n    return this.firstKey;\n  }\n\n  getLastKey(): Key | null {\n    let node = this.lastKey != null ? this.keyMap.get(this.lastKey) : null;\n    while (node?.lastChildKey != null) {\n      node = this.keyMap.get(node.lastChildKey);\n    }\n\n    return node?.key ?? null;\n  }\n\n  getItem(key: Key): Node<T> | null {\n    return this.keyMap.get(key) ?? null;\n  }\n\n  at(): Node<T> {\n    throw new Error('Not implemented');\n  }\n\n  clone(): this {\n    // We need to clone using this.constructor so that subclasses have the right prototype.\n    // TypeScript isn't happy about this yet.\n    // https://github.com/microsoft/TypeScript/issues/3841\n    let Constructor: any = this.constructor;\n    let collection: this = new Constructor();\n    collection.keyMap = new Map(this.keyMap);\n    collection.firstKey = this.firstKey;\n    collection.lastKey = this.lastKey;\n    collection.itemCount = this.itemCount;\n    return collection;\n  }\n\n  addNode(node: CollectionNode<T>): void {\n    if (this.frozen) {\n      throw new Error('Cannot add a node to a frozen collection');\n    }\n\n    if (node.type === 'item' && this.keyMap.get(node.key) == null) {\n      this.itemCount++;\n    }\n\n    this.keyMap.set(node.key, node);\n  }\n\n  // Deeply add a node and its children to the collection from another collection, primarily used when filtering a collection\n  addDescendants(node: CollectionNode<T>, oldCollection: BaseCollection<T>): void {\n    this.addNode(node);\n    let children = oldCollection.getChildren(node.key);\n    for (let child of children) {\n      this.addDescendants(child as CollectionNode<T>, oldCollection);\n    }\n  }\n\n  removeNode(key: Key): void {\n    if (this.frozen) {\n      throw new Error('Cannot remove a node to a frozen collection');\n    }\n\n    let node = this.keyMap.get(key);\n    if (node != null && node.type === 'item') {\n      this.itemCount--;\n    }\n\n    this.keyMap.delete(key);\n  }\n\n  commit(firstKey: Key | null, lastKey: Key | null, isSSR = false): void {\n    if (this.frozen) {\n      throw new Error('Cannot commit a frozen collection');\n    }\n\n    this.firstKey = firstKey;\n    this.lastKey = lastKey;\n    this.frozen = !isSSR;\n  }\n\n  filter(filterFn: FilterFn<T>): this {\n    let newCollection = new (this.constructor as any)();\n    let [firstKey, lastKey] = filterChildren(this, newCollection, this.firstKey, filterFn);\n    newCollection?.commit(firstKey, lastKey);\n    return newCollection;\n  }\n}\n\nfunction filterChildren<T>(collection: BaseCollection<T>, newCollection: BaseCollection<T>, firstChildKey: Key | null, filterFn: FilterFn<T>): [Key | null, Key | null] {\n  // loop over the siblings for firstChildKey\n  // create new nodes based on calling node.filter for each child\n  // if it returns null then don't include it, otherwise update its prev/next keys\n  // add them to the newCollection\n  if (firstChildKey == null) {\n    return [null, null];\n  }\n\n  let firstNode: Node<T> | null = null;\n  let lastNode: Node<T> | null = null;\n  let currentNode = collection.getItem(firstChildKey);\n\n  while (currentNode != null) {\n    let newNode: Mutable<CollectionNode<T>> | null = (currentNode as CollectionNode<T>).filter(collection, newCollection, filterFn);\n    if (newNode != null) {\n      newNode.nextKey = null;\n      if (lastNode) {\n        newNode.prevKey = lastNode.key;\n        lastNode.nextKey = newNode.key;\n      }\n\n      if (firstNode == null) {\n        firstNode = newNode;\n      }\n\n      newCollection.addNode(newNode);\n      lastNode = newNode;\n    }\n\n    currentNode = currentNode.nextKey ? collection.getItem(currentNode.nextKey) : null;\n  }\n\n  // TODO: this is pretty specific to dividers but doesn't feel like there is a good way to get around it since we only can know\n  // to filter the last separator in a collection only after performing a filter for the rest of the contents after it\n  // Its gross that it needs to live here, might be nice if somehow we could have this live in the separator code\n  if (lastNode && lastNode.type === 'separator') {\n    let prevKey = lastNode.prevKey;\n    newCollection.removeNode(lastNode.key);\n\n    if (prevKey) {\n      lastNode = newCollection.getItem(prevKey) as Mutable<CollectionNode<T>>;\n      lastNode.nextKey = null;\n    } else {\n      lastNode = null;\n    }\n  }\n\n  return [firstNode?.key ?? null, lastNode?.key ?? null];\n}\n"],"names":[],"version":3,"file":"BaseCollection.cjs.map"}