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AI,4CAA8C,CAAA,GAAA,wCAAa,EAAE,IAAI;AACrE,SAAS,0CAA+B,CAAiB;IAC9D,4CAA8B;AAChC","sources":["packages/react-aria/src/dnd/utils.ts"],"sourcesContent":["/*\n * Copyright 2020 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 {CUSTOM_DRAG_TYPE, DROP_OPERATION, GENERIC_TYPE, NATIVE_DRAG_TYPES} from './constants';\nimport {DirectoryDropItem, DragItem, DropItem, FileDropItem, DragTypes as IDragTypes, Key, RefObject, TextDropItem} from '@react-types/shared';\nimport {DroppableCollectionState} from 'react-stately/useDroppableCollectionState';\nimport {getInteractionModality, useInteractionModality} from '../interactions/useFocusVisible';\n\ninterface DroppableCollectionMap {\n  id: string,\n  ref: RefObject<HTMLElement | null>\n}\n\nexport const droppableCollectionMap: WeakMap<DroppableCollectionState, DroppableCollectionMap> = new WeakMap<DroppableCollectionState, DroppableCollectionMap>();\nexport const DIRECTORY_DRAG_TYPE: symbol = Symbol();\n\nexport function getDroppableCollectionId(state: DroppableCollectionState): string {\n  let {id} = droppableCollectionMap.get(state) || {};\n  if (!id) {\n    throw new Error('Droppable item outside a droppable collection');\n  }\n\n  return id;\n}\n\nexport function getDroppableCollectionRef(state: DroppableCollectionState): RefObject<HTMLElement | null> {\n  let {ref} = droppableCollectionMap.get(state) || {};\n  if (!ref) {\n    throw new Error('Droppable item outside a droppable collection');\n  }\n\n  return ref;\n}\n\nexport function getTypes(items: DragItem[]): Set<string> {\n  let types = new Set<string>();\n  for (let item of items) {\n    for (let type of Object.keys(item)) {\n      types.add(type);\n    }\n  }\n\n  return types;\n}\n\nfunction mapModality(modality: string | null) {\n  if (!modality) {\n    modality = 'virtual';\n  }\n\n  if (modality === 'pointer') {\n    modality = 'virtual';\n  }\n\n  if (modality === 'virtual' &&  (typeof window !== 'undefined' && 'ontouchstart' in window)) {\n    modality = 'touch';\n  }\n\n  return modality;\n}\n\nexport function useDragModality(): string {\n  return mapModality(useInteractionModality());\n}\n\nexport function getDragModality(): string {\n  return mapModality(getInteractionModality());\n}\n\nexport function writeToDataTransfer(dataTransfer: DataTransfer, items: DragItem[]): void {\n  // The data transfer API doesn't support more than one item of a given type at once.\n  // In addition, only a small set of types are supported natively for transfer between applications.\n  // We allow for both multiple items, as well as multiple representations of a single item.\n  // In order to make our API work with the native API, we serialize all items to JSON and\n  // store as a single native item. We only need to do this if there is more than one item\n  // of the same type, or if an item has more than one representation. Otherwise the native\n  // API is sufficient.\n  //\n  // The DataTransferItemList API also theoretically supports adding files, which would enable\n  // dragging binary data out of the browser onto the user's desktop for example. Unfortunately,\n  // this does not currently work in any browser, so it is not currently supported by our API.\n  // See e.g. https://bugs.chromium.org/p/chromium/issues/detail?id=438479.\n  let groupedByType = new Map<string, string[]>();\n  let needsCustomData = false;\n  let customData: Array<{}> = [];\n  for (let item of items) {\n    let types = Object.keys(item);\n    if (types.length > 1) {\n      needsCustomData = true;\n    }\n\n    let dataByType = {};\n    for (let type of types) {\n      let typeItems = groupedByType.get(type);\n      if (!typeItems) {\n        typeItems = [];\n        groupedByType.set(type, typeItems);\n      } else {\n        needsCustomData = true;\n      }\n\n      let data = item[type];\n      dataByType[type] = data;\n      typeItems.push(data);\n    }\n\n    customData.push(dataByType);\n  }\n\n  for (let [type, items] of groupedByType) {\n    if (NATIVE_DRAG_TYPES.has(type)) {\n      // Only one item of a given type can be set on a data transfer.\n      // Join all of the items together separated by newlines.\n      let data = items.join('\\n');\n      dataTransfer.items.add(data, type);\n    } else {\n      // Set data to the first item so we have access to the list of types.\n      dataTransfer.items.add(items[0], type);\n    }\n  }\n\n  if (needsCustomData) {\n    let data = JSON.stringify(customData);\n    dataTransfer.items.add(data, CUSTOM_DRAG_TYPE);\n  }\n}\n\nexport class DragTypes implements IDragTypes {\n  private types: Set<string>;\n  private includesUnknownTypes: boolean;\n\n  constructor(dataTransfer: DataTransfer) {\n    this.types = new Set<string>();\n\n    let hasFiles = false;\n    for (let item of dataTransfer.items) {\n      if (item.type !== CUSTOM_DRAG_TYPE) {\n        if (item.kind === 'file') {\n          hasFiles = true;\n        }\n\n        if (item.type) {\n          this.types.add(item.type);\n        } else {\n          // Files with unknown types or extensions that don't map to a known mime type\n          // are sometimes exposed as an empty string by the browser. Map to a generic\n          // mime type instead. Note that this could also be a directory as there's no\n          // way to determine if something is a file or directory until drop.\n          this.types.add(GENERIC_TYPE);\n        }\n      }\n    }\n\n    // In Safari, when dragging files, the dataTransfer.items list is empty, but dataTransfer.types contains \"Files\".\n    // Unfortunately, this doesn't tell us what types of files the user is dragging, so we need to assume that any\n    // type the user checks for is included. See https://bugs.webkit.org/show_bug.cgi?id=223517.\n    this.includesUnknownTypes = !hasFiles && dataTransfer.types.includes('Files');\n  }\n\n  has(type: string | symbol): boolean {\n    if (this.includesUnknownTypes || (type === DIRECTORY_DRAG_TYPE && this.types.has(GENERIC_TYPE))) {\n      return true;\n    }\n\n    return typeof type === 'string' && this.types.has(type);\n  }\n}\n\nexport function readFromDataTransfer(dataTransfer: DataTransfer): DropItem[] {\n  let items: DropItem[] = [];\n  if (!dataTransfer) {\n    return items;\n  }\n\n  // If our custom drag type is available, use that. This is a JSON serialized\n  // representation of all items in the drag, set when there are multiple items\n  // of the same type, or an individual item has multiple representations.\n  let hasCustomType = false;\n  if (dataTransfer.types.includes(CUSTOM_DRAG_TYPE)) {\n    try {\n      let data = dataTransfer.getData(CUSTOM_DRAG_TYPE);\n      let parsed = JSON.parse(data);\n      for (let item of parsed) {\n        items.push({\n          kind: 'text',\n          types: new Set(Object.keys(item)),\n          getText: (type) => Promise.resolve(item[type])\n        });\n      }\n\n      hasCustomType = true;\n    } catch {\n      // ignore\n    }\n  }\n\n  // Otherwise, map native drag items to items of a single representation.\n  if (!hasCustomType) {\n    let stringItems = new Map();\n    for (let item of dataTransfer.items) {\n      if (item.kind === 'string') {\n        // The data for all formats must be read here because the data transfer gets\n        // cleared out after the event handler finishes. If the item has an empty string\n        // as a type, the mime type is unknown. Map to a generic mime type instead.\n        stringItems.set(item.type || GENERIC_TYPE, dataTransfer.getData(item.type));\n      } else if (item.kind === 'file') {\n        // Despite the name, webkitGetAsEntry is also implemented in Firefox and Edge.\n        // In the future, we may use getAsFileSystemHandle instead, but that's currently\n        // only implemented in Chrome.\n        if (typeof item.webkitGetAsEntry === 'function') {\n          let entry: FileSystemEntry | null = item.webkitGetAsEntry();\n          // eslint-disable-next-line max-depth\n          if (!entry) {\n            // For some reason, Firefox includes an item with type image/png when copy\n            // and pasting any file or directory (no matter the type), but returns `null` for both\n            // item.getAsFile() and item.webkitGetAsEntry(). Safari works as expected. Ignore this\n            // item if this happens. See https://bugzilla.mozilla.org/show_bug.cgi?id=1699743.\n            // This was recently fixed in Chrome Canary: https://bugs.chromium.org/p/chromium/issues/detail?id=1175483.\n            continue;\n          }\n\n          // eslint-disable-next-line max-depth\n          if (entry.isFile) {\n            items.push(createFileItem(item.getAsFile()));\n          } else if (entry.isDirectory) {\n            items.push(createDirectoryItem(entry));\n          }\n        } else {\n          // Assume it's a file.\n          items.push(createFileItem(item.getAsFile()));\n        }\n      }\n    }\n\n    // All string items are different representations of the same item. There's no way to have\n    // multiple string items at once in the current DataTransfer API.\n    if (stringItems.size > 0) {\n      items.push({\n        kind: 'text',\n        types: new Set(stringItems.keys()),\n        getText: (type) => Promise.resolve(stringItems.get(type))\n      });\n    }\n  }\n\n  return items;\n}\n\nfunction blobToString(blob: Blob): Promise<string> {\n  if (typeof blob.text === 'function') {\n    return blob.text();\n  }\n\n  // Safari doesn't have the Blob#text() method yet...\n  return new Promise((resolve, reject) => {\n    let reader = new FileReader;\n    reader.onload = () => {\n      resolve(reader.result as string);\n    };\n\n    reader.onerror = reject;\n    reader.readAsText(blob);\n  });\n}\n\nfunction createFileItem(file: File | null): FileDropItem {\n  if (!file) {\n    throw new Error('No file provided');\n  }\n  return {\n    kind: 'file',\n    type: file.type || GENERIC_TYPE,\n    name: file.name,\n    getText: () => blobToString(file),\n    getFile: () => Promise.resolve(file)\n  };\n}\n\nfunction createDirectoryItem(entry: any): DirectoryDropItem {\n  return {\n    kind: 'directory',\n    name: entry.name,\n    getEntries: () => getEntries(entry)\n  };\n}\n\nasync function *getEntries(item: FileSystemDirectoryEntry): AsyncIterable<FileDropItem | DirectoryDropItem> {\n  let reader = item.createReader();\n\n  // We must call readEntries repeatedly because there may be a limit to the\n  // number of entries that are returned at once.\n  let entries: FileSystemEntry[];\n  do {\n    entries = await new Promise((resolve, reject) => {\n      reader.readEntries(resolve, reject);\n    });\n\n    for (let entry of entries) {\n      if (entry.isFile) {\n        let file = await getEntryFile(entry as FileSystemFileEntry);\n        yield createFileItem(file);\n      } else if (entry.isDirectory) {\n        yield createDirectoryItem(entry);\n      }\n    }\n  } while (entries.length > 0);\n}\n\nfunction getEntryFile(entry: FileSystemFileEntry): Promise<File> {\n  return new Promise((resolve, reject) => entry.file(resolve, reject));\n}\n\n/** Returns whether a drop item contains text data. */\nexport function isTextDropItem(dropItem: DropItem): dropItem is TextDropItem {\n  return dropItem.kind === 'text';\n}\n\n/** Returns whether a drop item is a file. */\nexport function isFileDropItem(dropItem: DropItem): dropItem is FileDropItem {\n  return dropItem.kind === 'file';\n}\n\n/** Returns whether a drop item is a directory. */\nexport function isDirectoryDropItem(dropItem: DropItem): dropItem is DirectoryDropItem {\n  return dropItem.kind === 'directory';\n}\n\n// Global DnD collection state tracker.\nexport interface DnDState {\n  /** A ref for the  of the drag items in the current drag session if any. */\n  draggingCollectionRef?: RefObject<HTMLElement | null>,\n  /** The set of currently dragged keys. */\n  draggingKeys: Set<Key>,\n  /** A ref for the collection that is targeted for a drop operation, if any. */\n  dropCollectionRef?: RefObject<HTMLElement | null>\n}\n\nexport let globalDndState: DnDState = {draggingKeys: new Set()};\n\nexport function setDraggingCollectionRef(ref: RefObject<HTMLElement | null>): void {\n  globalDndState.draggingCollectionRef = ref;\n}\n\nexport function setDraggingKeys(keys: Set<Key>): void {\n  globalDndState.draggingKeys = keys;\n}\n\nexport function setDropCollectionRef(ref?: RefObject<HTMLElement | null>): void {\n  globalDndState.dropCollectionRef = ref;\n}\n\nexport function clearGlobalDnDState(): void {\n  globalDndState = {draggingKeys: new Set()};\n}\n\nexport function setGlobalDnDState(state: DnDState): void {\n  globalDndState = state;\n}\n\n// Util function to check if the current dragging collection ref is the same as the current targeted droppable collection ref.\n// Allows a droppable ref arg in case the global drop collection ref hasn't been set\nexport function isInternalDropOperation(ref?: RefObject<HTMLElement | null>): boolean {\n  let {draggingCollectionRef, dropCollectionRef} = globalDndState;\n  return draggingCollectionRef?.current != null && draggingCollectionRef.current === (ref?.current || dropCollectionRef?.current);\n}\n\ntype DropEffect = 'none' | 'copy' | 'link' | 'move';\nexport let globalDropEffect: DropEffect | undefined;\nexport function setGlobalDropEffect(dropEffect: DropEffect | undefined): void {\n  globalDropEffect = dropEffect;\n}\n\nexport let globalAllowedDropOperations: DROP_OPERATION = DROP_OPERATION.none;\nexport function setGlobalAllowedDropOperations(o: DROP_OPERATION): void {\n  globalAllowedDropOperations = o;\n}\n"],"names":[],"version":3,"file":"utils.cjs.map"}