File: /www/wwwroot/www.waciwang.com/wp-content/plugins/gutenberg/build/scripts/blob/index.min.js.map
{
"version": 3,
"sources": ["../../../packages/blob/src/index.ts"],
"sourcesContent": ["const cache: Record< string, File > = {};\n\n/**\n * Create a blob URL from a file.\n *\n * @param file The file to create a blob URL for.\n *\n * @return The blob URL.\n */\nexport function createBlobURL( file: File ): string {\n\tconst url = window.URL.createObjectURL( file );\n\n\tcache[ url ] = file;\n\n\treturn url;\n}\n\n/**\n * Retrieve a file based on a blob URL. The file must have been created by\n * `createBlobURL` and not removed by `revokeBlobURL`, otherwise it will return\n * `undefined`.\n *\n * @param url The blob URL.\n *\n * @return The file for the blob URL.\n */\nexport function getBlobByURL( url: string ): File | undefined {\n\treturn cache[ url ];\n}\n\n/**\n * Retrieve a blob type based on URL. The file must have been created by\n * `createBlobURL` and not removed by `revokeBlobURL`, otherwise it will return\n * `undefined`.\n *\n * @param url The blob URL.\n *\n * @return The blob type.\n */\nexport function getBlobTypeByURL( url: string ): string | undefined {\n\treturn getBlobByURL( url )?.type.split( '/' )[ 0 ]; // 0: media type , 1: file extension eg ( type: 'image/jpeg' ).\n}\n\n/**\n * Remove the resource and file cache from memory.\n *\n * @param url The blob URL.\n */\nexport function revokeBlobURL( url: string ): void {\n\tif ( cache[ url ] ) {\n\t\twindow.URL.revokeObjectURL( url );\n\t}\n\n\tdelete cache[ url ];\n}\n\n/**\n * Check whether a url is a blob url.\n *\n * @param url The URL.\n *\n * @return Is the url a blob url?\n */\nexport function isBlobURL( url: string | undefined ): boolean {\n\tif ( ! url || ! url.indexOf ) {\n\t\treturn false;\n\t}\n\treturn url.indexOf( 'blob:' ) === 0;\n}\n\n/**\n * Downloads a file, e.g., a text or readable stream, in the browser.\n * Appropriate for downloading smaller file sizes, e.g., < 5 MB.\n *\n * Example usage:\n *\n * ```js\n * \tconst fileContent = JSON.stringify(\n * \t\t{\n * \t\t\t\"title\": \"My Post\",\n * \t\t},\n * \t\tnull,\n * \t\t2\n * \t);\n * \tconst filename = 'file.json';\n *\n * \tdownloadBlob( filename, fileContent, 'application/json' );\n * ```\n *\n * @param filename File name.\n * @param content File content (BufferSource | Blob | string).\n * @param contentType (Optional) File mime type. Default is `''`.\n */\nexport function downloadBlob(\n\tfilename: string,\n\tcontent: BlobPart,\n\tcontentType: string = ''\n): void {\n\tif ( ! filename || ! content ) {\n\t\treturn;\n\t}\n\n\tconst file = new window.Blob( [ content ], { type: contentType } );\n\tconst url = window.URL.createObjectURL( file );\n\tconst anchorElement = document.createElement( 'a' );\n\tanchorElement.href = url;\n\tanchorElement.download = filename;\n\tanchorElement.style.display = 'none';\n\tdocument.body.appendChild( anchorElement );\n\tanchorElement.click();\n\tdocument.body.removeChild( anchorElement );\n\twindow.URL.revokeObjectURL( url );\n}\n"],
"mappings": "0kBAAA,IAAMA,EAAgC,CAAC,EAShC,SAASC,EAAeC,EAAqB,CACnD,IAAMC,EAAM,OAAO,IAAI,gBAAiBD,CAAK,EAE7C,OAAAF,EAAOG,CAAI,EAAID,EAERC,CACR,CAWO,SAASC,EAAcD,EAAgC,CAC7D,OAAOH,EAAOG,CAAI,CACnB,CAWO,SAASE,EAAkBF,EAAkC,CACnE,OAAOC,EAAcD,CAAI,GAAG,KAAK,MAAO,GAAI,EAAG,CAAE,CAClD,CAOO,SAASG,EAAeH,EAAoB,CAC7CH,EAAOG,CAAI,GACf,OAAO,IAAI,gBAAiBA,CAAI,EAGjC,OAAOH,EAAOG,CAAI,CACnB,CASO,SAASI,EAAWJ,EAAmC,CAC7D,MAAK,CAAEA,GAAO,CAAEA,EAAI,QACZ,GAEDA,EAAI,QAAS,OAAQ,IAAM,CACnC,CAyBO,SAASK,EACfC,EACAC,EACAC,EAAsB,GACf,CACP,GAAK,CAAEF,GAAY,CAAEC,EACpB,OAGD,IAAMR,EAAO,IAAI,OAAO,KAAM,CAAEQ,CAAQ,EAAG,CAAE,KAAMC,CAAY,CAAE,EAC3DR,EAAM,OAAO,IAAI,gBAAiBD,CAAK,EACvCU,EAAgB,SAAS,cAAe,GAAI,EAClDA,EAAc,KAAOT,EACrBS,EAAc,SAAWH,EACzBG,EAAc,MAAM,QAAU,OAC9B,SAAS,KAAK,YAAaA,CAAc,EACzCA,EAAc,MAAM,EACpB,SAAS,KAAK,YAAaA,CAAc,EACzC,OAAO,IAAI,gBAAiBT,CAAI,CACjC",
"names": ["cache", "createBlobURL", "file", "url", "getBlobByURL", "getBlobTypeByURL", "revokeBlobURL", "isBlobURL", "downloadBlob", "filename", "content", "contentType", "anchorElement"]
}