{
  "version": 3,
  "sources": ["../../upload/upload.ts"],
  "sourcesContent": ["import {i18n} from \"@cling/lib.web.i18n\"\nimport {Snackbar} from \"@cling/lib.web.mdc\"\nimport {report_error} from \"@cling/lib.shared.debug\"\nimport {Limit, LIMIT_BLOB_SIZE, LIMIT_USER_UPLOAD_SIZE} from \"@cling/lib.shared.limits\"\nimport {log} from \"@cling/lib.shared.logging\"\nimport type {CancelablePromise} from \"@cling/lib.shared.utils\"\nimport {current_user, ui_actions, upload_state} from \"../state/index\"\nimport {BlobUID, ClingErrorCode, Plan} from \"@cling/lib.shared.model\"\nimport {board_resource} from \"@cling/lib.web.resources\"\nimport {CallFunctionFailed} from \"@cling/lib.shared.error\"\nimport {Buffer} from \"buffer\"\nimport {board_quota_limits} from \"@cling/lib.shared.model/quota\"\nimport {open_intercom} from \"../misc/intercom\"\nimport axios_, {AxiosProgressEvent} from \"axios\"\n\ndeclare const test_helper: any\nconst axios = axios_.create({\n    // Axios' default is 10Mb.\n    maxContentLength: LIMIT_USER_UPLOAD_SIZE.upper_bound,\n    maxBodyLength: Number.POSITIVE_INFINITY,\n})\nlet upload_queue = Promise.resolve()\nlet uploads_canceled = false\nlet current_upload: null | CancelablePromise<any> = null\nlet add_provisional_thumbnail: (args: {\n    blob_uid: BlobUID\n    mime_type: string\n    image_file: File\n    image_width: number\n    image_height: number\n}) => Promise<void>\n\n/**\n * Open a file-chooser.\n */\nexport function let_user_select_files({\n    accept,\n    multiple,\n    capture,\n}: {\n    accept?: string\n    multiple?: boolean\n    capture?: \"user\" | \"environment\"\n} = {}): Promise<Array<File>> {\n    // For testing (see custom_commands.ts and playwright_commands.ts).\n    if ((window as any).test_helper && test_helper.let_user_select_files) {\n        return test_helper.let_user_select_files()\n    }\n    return new Promise((resolve) => {\n        // Delete <input id=\"upload-input\" ... /> if present ...\n        let input = document.getElementById(\"upload-input\")\n        if (input) {\n            input.remove()\n        }\n        input = document.createElement(\"input\")\n        input.setAttribute(\"id\", \"upload-input\")\n        input.setAttribute(\"type\", \"file\")\n        if (capture) {\n            input.setAttribute(\"capture\", capture)\n        }\n        if (accept) {\n            input.setAttribute(\"accept\", accept)\n        }\n        if (multiple) {\n            input.setAttribute(\"multiple\", \"\")\n        }\n        // Note: We cannot not use the style display:none because calling\n        // `input.click()` does not open the select file dialog in certain\n        // browsers if the <input> element is hidden. Therefore we move it\n        // outside the visible area.\n        input.setAttribute(\"style\", \"position:absolute;top:-100px\")\n        // Note: We cannot use the onChange property, but must use\n        // `addEventListener(\"change\", ...)` here, because in some browsers\n        // the onChange handler is not called for <input type=\"file\"> elements.\n        input.addEventListener(\"change\", async (event: any) => {\n            try {\n                const files = await get_files_from_event(event)\n                const n = files.length\n                log.debug((n === 1 ? \"1 file\" : n + \" files\") + \" selected for upload\")\n                resolve(files)\n            } catch (error) {\n                report_error(\"Selecting files for upload failed\", error)\n                Snackbar.show_message(i18n.sorry_something_went_wrong)\n                resolve([])\n            }\n        })\n        document.body.appendChild(input)\n        // This should open the select files dialog ...\n        input.click()\n    })\n}\n\nasync function get_files_from_event(event: any): Promise<File[]> {\n    if (event.dataTransfer) {\n        return await files_from_data_transfer(event.dataTransfer)\n    } else if (event.target && event.target.files) {\n        return Array.prototype.slice.call(event.target.files)\n    }\n    return []\n}\n\nexport function upload_files<R extends {upload_url: string}, UploadFile extends {file: File}>({\n    files,\n    get_upload_url,\n    on_progress,\n    on_file_uploaded,\n    on_cancel,\n    file_size_limit,\n}: {\n    files: UploadFile[]\n    get_upload_url: (o: {mime_type: string; md5_base64: string; size: number}) => Promise<R>\n    on_file_uploaded: (\n        o: R & {\n            file: UploadFile\n            mime_type: string\n            md5_base64: string\n        },\n    ) => void | Promise<void>\n    on_progress?: () => void\n    on_cancel?: () => void\n    file_size_limit?: Limit\n}) {\n    file_size_limit = file_size_limit || LIMIT_BLOB_SIZE\n    for (const file of files) {\n        if (file.file.size > file_size_limit.upper_bound) {\n            Snackbar.show_message(i18n.upload_file_limit_exceeded(file_size_limit.upper_bound))\n            return\n        }\n    }\n    upload_state.uploads_pending({\n        num_files_total: files.length,\n        num_bytes_total: files.reduce((sum, file) => sum + file.file.size, 0),\n        cancel_uploads: () => {\n            on_cancel?.()\n            uploads_canceled = true\n            upload_queue = upload_queue.then(() => {\n                uploads_canceled = false\n            })\n            if (current_upload) {\n                current_upload.cancel()\n                current_upload = null\n            }\n        },\n    })\n    upload_queue = upload_queue.then(async function () {\n        for (const file of files) {\n            if (uploads_canceled) {\n                return\n            }\n            // Some browsers (namely Safari) don't report any MIME type on unknown file types.\n            // Other browsers (namely Firefox) don't report a MIME type if the file belongs to\n            // a folder.\n            let mime_type = file.file.type\n            if (!mime_type) {\n                const ext = file.file.name.toLowerCase().split(\".\").pop()\n                mime_type = file_ext_mime_types[ext || \"\"] || \"application/octet-stream\"\n            }\n            const file_name = (file as any).file_name || file.file.name\n            upload_state.file_upload_starts(file_name)\n            try {\n                log.debug(`Calculating MD5 of ${file_name} ...`)\n                const md5_base64 = (await calculate_md5(file.file)).toString(\"base64\")\n                const get_upload_url_response = await get_upload_url({\n                    mime_type,\n                    md5_base64,\n                    size: file.file.size,\n                })\n                log.debug(`Uploading ${file_name} ...`)\n                current_upload = _upload_file(\n                    get_upload_url_response.upload_url,\n                    file.file,\n                    mime_type,\n                    md5_base64,\n                    /* on_progress: */ (e) => {\n                        upload_state.file_upload_progress(e.loaded)\n                        on_progress?.()\n                    },\n                )\n                await current_upload\n                current_upload = null\n                log.debug(`${file_name} successfully uploaded.`)\n                upload_state.file_upload_done(file.file.size)\n                try {\n                    await on_file_uploaded({\n                        ...get_upload_url_response,\n                        file,\n                        mime_type,\n                        md5_base64,\n                    })\n                } catch (error) {\n                    Snackbar.show_message(i18n.sorry_something_went_wrong, i18n.contact_us, () =>\n                        open_intercom(\"new_message\"),\n                    )\n                    report_error(\"upload_files callback failed\", error)\n                    upload_state.cancel_uploads()\n                    return\n                }\n            } catch (error) {\n                if (!axios_.isCancel(error)) {\n                    upload_state.cancel_uploads()\n                    let do_report_error = true\n                    if (error instanceof CallFunctionFailed) {\n                        const snackbar_message = i18n.cling_error_code_msg(\n                            error.cling_error_code || ClingErrorCode.unknown,\n                            i18n.upload_failed,\n                        )\n                        if (error.cling_error_code === ClingErrorCode.quota_exceeded) {\n                            do_report_error = false\n                            Snackbar.show_message(\n                                snackbar_message,\n                                i18n.upgrade,\n                                ui_actions.open_checkout_dialog,\n                            )\n                        } else {\n                            Snackbar.show_message(snackbar_message, i18n.contact_us, () =>\n                                open_intercom(\"new_message\"),\n                            )\n                        }\n                    } else {\n                        Snackbar.show_message(i18n.upload_failed)\n                    }\n                    if (do_report_error) {\n                        report_error(\"Upload failed\", error)\n                    }\n                }\n                return\n            }\n        }\n    })\n}\n\nexport function cancel_uploads() {\n    upload_state.cancel_uploads()\n    log.debug(\"Upload(s) canceled\")\n}\n\nasync function calculate_md5(file: File): Promise<Buffer> {\n    const spark_md5_ = await import(\"spark-md5\")\n    const spark_md5 = (spark_md5_ as any).default as typeof spark_md5_\n    return new Promise<Buffer>((resolve, reject) => {\n        const slice =\n            File.prototype.slice ||\n            (File as any).prototype.mozSlice ||\n            (File as any).prototype.webkitSlice\n        let num_bytes_processed = 0\n        let chunk_size = 4 * 1024 * 1024\n        const spark = new spark_md5.ArrayBuffer()\n        const file_reader = new FileReader()\n        file_reader.onload = (e) => {\n            const a: any = (e.target as FileReader).result\n            const t0 = performance.now()\n            spark.append(a)\n            num_bytes_processed += a.byteLength\n            if (num_bytes_processed < file.size) {\n                const dt = performance.now() - t0\n                if (dt > 500 && chunk_size > 4096) {\n                    chunk_size /= 2\n                } else if (dt < 250) {\n                    chunk_size *= 2\n                }\n                load_next_chunk()\n            } else {\n                resolve(Buffer.from(spark.end(), \"hex\"))\n            }\n        }\n        file_reader.onerror = () => {\n            reject(new Error(\"Failed to read file\"))\n        }\n        function load_next_chunk() {\n            const start = num_bytes_processed\n            const end = Math.min(start + chunk_size, file.size)\n            file_reader.readAsArrayBuffer(slice.call(file, start, end))\n        }\n        load_next_chunk()\n    })\n}\n\nexport function _upload_file(\n    upload_url: string,\n    file: File,\n    mime_type: string,\n    md5_base64: string,\n    on_progress: (e: AxiosProgressEvent) => void,\n): CancelablePromise<any> {\n    const cancel_token_source = axios_.CancelToken.source()\n    const promise = axios.put(upload_url, file, {\n        headers: {\n            \"Content-Type\": mime_type,\n            \"Content-MD5\": md5_base64,\n            \"x-goog-content-length-range\": `${file.size},${file.size}`,\n        },\n        onUploadProgress: on_progress,\n        cancelToken: cancel_token_source.token,\n    }) as CancelablePromise<any>\n    promise.cancel = () => {\n        cancel_token_source.cancel()\n    }\n    return promise\n}\n\n/**\n * Check the given files against quota limits and show the user a snackbar if the limit is exceeded.\n */\nexport function check_blob_quota_limits(files: Array<{size: number}>): boolean {\n    const limits = board_quota_limits(current_user.account_attributes)\n    for (const file of files) {\n        if (file.size > limits.max_blob_size) {\n            if (current_user.account_attributes.plan === Plan.free) {\n                Snackbar.show_message(\n                    i18n.upload_max_file_size_quota_exceeded(limits.max_blob_size),\n                    i18n.upgrade,\n                    ui_actions.open_checkout_dialog,\n                )\n            } else {\n                Snackbar.show_message(\n                    i18n.upload_max_file_size_quota_exceeded(limits.max_blob_size),\n                )\n            }\n            return false\n        }\n    }\n    const usage = board_resource.board_quota_usage\n    if (usage.sum_blob_size + files.reduce((sum, x) => sum + x.size, 0) > limits.sum_blob_size) {\n        Snackbar.show_message(\n            i18n.you_have_used_up_all_the_storage,\n            i18n.upgrade,\n            ui_actions.open_checkout_dialog,\n        )\n        return false\n    }\n    return true\n}\n\n/**\n * Note: The returned `Promise` will always resolve and never be rejected,\n *       even if the provisional thumbnail could not be added.\n */\nexport function add_provisional_thumbnail_for_uploaded_file({\n    file,\n    blob_uid,\n}: {\n    file: File\n    blob_uid: BlobUID\n}): Promise<void> {\n    return new Promise((resolve) => {\n        const img = new Image()\n        const url = URL.createObjectURL(file)\n        img.onload = async () => {\n            try {\n                try {\n                    // Note: This does not respect Exif image orientation. This means that\n                    //       right after uploading a rotated image it might be displayed\n                    //       with the wrong orientation.\n                    //       Modern browsers (at least the Chromium based ones) respect image\n                    //       rotation, though.\n                    const {naturalWidth: width, naturalHeight: height} = img\n                    await add_provisional_thumbnail({\n                        blob_uid,\n                        mime_type: file.type,\n                        image_file: file,\n                        image_width: width,\n                        image_height: height,\n                    })\n                } finally {\n                    URL.revokeObjectURL(url)\n                }\n            } catch (error) {\n                report_error(error)\n            } finally {\n                resolve()\n            }\n        }\n        img.onerror = () => {\n            try {\n                URL.revokeObjectURL(url)\n            } catch (error) {\n                report_error(error)\n            } finally {\n                resolve()\n            }\n        }\n        img.src = url\n    })\n}\n\nexport async function files_from_data_transfer(dt: DataTransfer) {\n    const files: File[] = []\n    for (let i = 0; i < dt.items.length; i++) {\n        const item = dt.items[i]\n        let entry\n        if (typeof item.webkitGetAsEntry === \"function\" && (entry = item.webkitGetAsEntry())) {\n            if (entry.isFile) {\n                const file = item.getAsFile()\n                if (file) {\n                    files.push(file)\n                }\n            } else if (entry.isDirectory) {\n                // Append all files from that directory to files.\n                await _addFilesFromDirectory(entry)\n            }\n        } else if (typeof item.getAsFile === \"function\") {\n            if (item.kind == null || item.kind === \"file\") {\n                const file = item.getAsFile()\n                if (file) {\n                    files.push(file)\n                }\n            }\n        }\n    }\n    return files\n\n    // Goes through the directory, and adds each file it finds recursively.\n    async function _addFilesFromDirectory(directory: any) {\n        return new Promise<void>((resolve) => {\n            let reading = 0\n            function readsome(reader: any) {\n                reading += 1\n                reader.readEntries((entries: any[]) => {\n                    reading -= 1\n                    for (const entry of entries) {\n                        if (entry.isDirectory) {\n                            readsome(entry.createReader())\n                        } else if (entry.isFile) {\n                            reading += 1\n                            entry.file((file: File) => {\n                                reading -= 1\n                                if (file) {\n                                    files.push(file)\n                                }\n                                if (reading === 0) {\n                                    resolve()\n                                }\n                            })\n                        }\n                    }\n                    if (entries.length) {\n                        readsome(reader)\n                    } else if (reading == 0) {\n                        resolve()\n                    }\n                })\n            }\n\n            readsome(directory.createReader())\n        })\n    }\n}\n\n// Just the most common file-types.\nconst file_ext_mime_types: Record<string, string> = {\n    aac: \"audio/aac\",\n    avif: \"image/avif\",\n    abw: \"application/x-abiword\",\n    arc: \"application/x-freearc\",\n    avi: \"video/x-msvideo\",\n    azw: \"application/vndamazonebook\",\n    bin: \"application/octet-stream\",\n    bmp: \"image/bmp\",\n    bz: \"application/x-bzip\",\n    bz2: \"application/x-bzip2\",\n    csh: \"application/x-csh\",\n    css: \"text/css\",\n    csv: \"text/csv\",\n    doc: \"application/msword\",\n    docx: \"application/vndopenxmlformats-officedocumentwordprocessingmldocument\",\n    eot: \"application/vndms-fontobject\",\n    epub: \"application/epub+zip\",\n    gz: \"application/gzip\",\n    gif: \"image/gif\",\n    htm: \"text/html\",\n    html: \"text/html\",\n    ico: \"image/vndmicrosofticon\",\n    ics: \"text/calendar\",\n    jar: \"application/java-archive\",\n    jpeg: \"image/jpeg\",\n    jpg: \"image/jpeg\",\n    js: \"text/javascript\",\n    json: \"application/json\",\n    jsonld: \"application/ld+json\",\n    mid: \"audio/midi audio/x-midi\",\n    midi: \"audio/midi audio/x-midi\",\n    mjs: \"text/javascript\",\n    mp3: \"audio/mpeg\",\n    cda: \"application/x-cdf\",\n    mp4: \"video/mp4\",\n    m4a: \"audio/x-m4a\",\n    mpeg: \"video/mpeg\",\n    mpkg: \"application/vndappleinstaller+xml\",\n    mov: \"video/quicktime\",\n    odp: \"application/vndoasisopendocumentpresentation\",\n    ods: \"application/vndoasisopendocumentspreadsheet\",\n    odt: \"application/vndoasisopendocumenttext\",\n    oga: \"audio/ogg\",\n    ogv: \"video/ogg\",\n    ogx: \"application/ogg\",\n    opus: \"audio/opus\",\n    otf: \"font/otf\",\n    png: \"image/png\",\n    pdf: \"application/pdf\",\n    php: \"application/x-httpd-php\",\n    ppt: \"application/vndms-powerpoint\",\n    pptx: \"application/vndopenxmlformats-officedocumentpresentationmlpresentation\",\n    rar: \"application/vndrar\",\n    rtf: \"application/rtf\",\n    sh: \"application/x-sh\",\n    svg: \"image/svg+xml\",\n    swf: \"application/x-shockwave-flash\",\n    tar: \"application/x-tar\",\n    tif: \"image/tiff\",\n    tiff: \"image/tiff\",\n    ts: \"video/mp2t\",\n    ttf: \"font/ttf\",\n    txt: \"text/plain\",\n    vsd: \"application/vndvisio\",\n    wav: \"audio/wav\",\n    weba: \"audio/webm\",\n    webm: \"video/webm\",\n    webp: \"image/webp\",\n    woff: \"font/woff\",\n    woff2: \"font/woff2\",\n    xhtml: \"application/xhtml+xml\",\n    xls: \"application/vndms-excel\",\n    xlsx: \"application/vndopenxmlformats-officedocumentspreadsheetmlsheet\",\n    xml: \"application/xml\",\n    xul: \"application/vndmozillaxul+xml\",\n    zip: \"application/zip\",\n    \"3gp\": \"video/3gpp\",\n    \"3g2\": \"video/3gpp2\",\n    \"7z\": \"application/x-7z-compressed\",\n}\n\nexport function file_extension_by_mime_type(mime_type: string): string | undefined {\n    const search = mime_type.replace(/[\\s?;].*$/, \"\")\n    if (search === \"audio/mp4\") {\n        return \"m4a\"\n    }\n    for (const [ext, s] of Object.entries(file_ext_mime_types)) {\n        if (s.startsWith(search)) {\n            return ext\n        }\n    }\n    return undefined\n}\n\nexport function init({\n    add_provisional_thumbnail: add_provisional_thumbnail_,\n}: {\n    add_provisional_thumbnail: typeof add_provisional_thumbnail\n}) {\n    add_provisional_thumbnail = add_provisional_thumbnail_\n}\n"],
  "mappings": "+XAUA,IAAAA,EAAqB,SAMrB,IAAMC,EAAQC,EAAO,OAAO,CAExB,iBAAkBC,EAAuB,YACzC,cAAe,OAAO,iBAC1B,CAAC,EACGC,EAAe,QAAQ,QAAQ,EAC/BC,EAAmB,GACnBC,EAAgD,KAChDC,EAWG,SAASC,GAAsB,CAClC,OAAAC,EACA,SAAAC,EACA,QAAAC,CACJ,EAII,CAAC,EAAyB,CAE1B,OAAK,OAAe,aAAe,YAAY,sBACpC,YAAY,sBAAsB,EAEtC,IAAI,QAASC,GAAY,CAE5B,IAAIC,EAAQ,SAAS,eAAe,cAA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,IAAK,kBACL,IAAK,0BACL,IAAK,+BACL,KAAM,yEACN,IAAK,qBACL,IAAK,kBACL,GAAI,mBACJ,IAAK,gBACL,IAAK,gCACL,IAAK,oBACL,IAAK,aACL,KAAM,aACN,GAAI,aACJ,IAAK,WACL,IAAK,aACL,IAAK,uBACL,IAAK,YACL,KAAM,aACN,KAAM,aACN,KAAM,aACN,KAAM,YACN,MAAO,aACP,MAAO,wBACP,IAAK,0BACL,KAAM,iEACN,IAAK,kBACL,IAAK,gCACL,IAAK,kBACL,MAAO,aACP,MAAO,cACP,KAAM,6BACV,EAEO,SAASkD,GAA4BpD,EAAuC,CAC/E,IAAMqD,EAASrD,EAAU,QAAQ,YAAa,EAAE,EAChD,GAAIqD,IAAW,YACX,MAAO,MAEX,OAAW,CAACpD,EAAKqD,CAAC,IAAK,OAAO,QAAQpD,CAAmB,EACrD,GAAIoD,EAAE,WAAWD,CAAM,EACnB,OAAOpD,CAInB,CAXgBb,EAAAgE,GAAA,+BAaT,SAASG,GAAK,CACjB,0BAA2BC,CAC/B,EAEG,CACCpF,EAA4BoF,CAChC,CANgBpE,EAAAmE,GAAA",
  "names": ["import_buffer", "axios", "axios_default", "LIMIT_USER_UPLOAD_SIZE", "upload_queue", "uploads_canceled", "current_upload", "add_provisional_thumbnail", "let_user_select_files", "accept", "multiple", "capture", "resolve", "input", "event", "files", "get_files_from_event", "n", "log", "error", "report_error", "Snackbar", "i18n", "__name", "files_from_data_transfer", "upload_files", "get_upload_url", "on_progress", "on_file_uploaded", "on_cancel", "file_size_limit", "LIMIT_BLOB_SIZE", "file", "upload_state", "sum", "mime_type", "ext", "file_ext_mime_types", "file_name", "md5_base64", "calculate_md5", "get_upload_url_response", "_upload_file", "e", "open_intercom", "do_report_error", "CallFunctionFailed", "snackbar_message", "ui_actions", "cancel_uploads", "spark_md5", "reject", "slice", "num_bytes_processed", "chunk_size", "spark", "file_reader", "a", "t0", "dt", "load_next_chunk", "start", "end", "upload_url", "cancel_token_source", "promise", "check_blob_quota_limits", "limits", "board_quota_limits", "current_user", "board_resource", "x", "add_provisional_thumbnail_for_uploaded_file", "blob_uid", "img", "url", "width", "height", "i", "item", "entry", "_addFilesFromDirectory", "directory", "reading", "readsome", "reader", "entries", "file_extension_by_mime_type", "search", "s", "init", "add_provisional_thumbnail_"]
}