{
  "version": 3,
  "sources": ["../../../../../../node_modules/.pnpm/http-cache-semantics@4.1.1/node_modules/http-cache-semantics/index.js", "../../../../src/workers/cache/cache.worker.ts", "../../../../src/workers/kv/constants.ts", "../../../../src/workers/cache/errors.worker.ts", "../../../../src/workers/cache/constants.ts"],
  "sourcesContent": ["'use strict';\n// rfc7231 6.1\nconst statusCodeCacheableByDefault = new Set([\n    200,\n    203,\n    204,\n    206,\n    300,\n    301,\n    308,\n    404,\n    405,\n    410,\n    414,\n    501,\n]);\n\n// This implementation does not understand partial responses (206)\nconst understoodStatuses = new Set([\n    200,\n    203,\n    204,\n    300,\n    301,\n    302,\n    303,\n    307,\n    308,\n    404,\n    405,\n    410,\n    414,\n    501,\n]);\n\nconst errorStatusCodes = new Set([\n    500,\n    502,\n    503, \n    504,\n]);\n\nconst hopByHopHeaders = {\n    date: true, // included, because we add Age update Date\n    connection: true,\n    'keep-alive': true,\n    'proxy-authenticate': true,\n    'proxy-authorization': true,\n    te: true,\n    trailer: true,\n    'transfer-encoding': true,\n    upgrade: true,\n};\n\nconst excludedFromRevalidationUpdate = {\n    // Since the old body is reused, it doesn't make sense to change properties of the body\n    'content-length': true,\n    'content-encoding': true,\n    'transfer-encoding': true,\n    'content-range': true,\n};\n\nfunction toNumberOrZero(s) {\n    const n = parseInt(s, 10);\n    return isFinite(n) ? n : 0;\n}\n\n// RFC 5861\nfunction isErrorResponse(response) {\n    // consider undefined response as faulty\n    if(!response) {\n        return true\n    }\n    return errorStatusCodes.has(response.status);\n}\n\nfunction parseCacheControl(header) {\n    const cc = {};\n    if (!header) return cc;\n\n    // TODO: When there is more than one value present for a given directive (e.g., two Expires header fields, multiple Cache-Control: max-age directives),\n    // the directive's value is considered invalid. Caches are encouraged to consider responses that have invalid freshness information to be stale\n    const parts = header.trim().split(/,/);\n    for (const part of parts) {\n        const [k, v] = part.split(/=/, 2);\n        cc[k.trim()] = v === undefined ? true : v.trim().replace(/^\"|\"$/g, '');\n    }\n\n    return cc;\n}\n\nfunction formatCacheControl(cc) {\n    let parts = [];\n    for (const k in cc) {\n        const v = cc[k];\n        parts.push(v === true ? k : k + '=' + v);\n    }\n    if (!parts.length) {\n        return undefined;\n    }\n    return parts.join(', ');\n}\n\nmodule.exports = class CachePolicy {\n    constructor(\n        req,\n        res,\n        {\n            shared,\n            cacheHeuristic,\n            immutableMinTimeToLive,\n            ignoreCargoCult,\n            _fromObject,\n        } = {}\n    ) {\n        if (_fromObject) {\n            this._fromObject(_fromObject);\n            return;\n        }\n\n        if (!res || !res.headers) {\n            throw Error('Response headers missing');\n        }\n        this._assertRequestHasHeaders(req);\n\n        this._responseTime = this.now();\n        this._isShared = shared !== false;\n        this._cacheHeuristic =\n            undefined !== cacheHeuristic ? cacheHeuristic : 0.1; // 10% matches IE\n        this._immutableMinTtl =\n            undefined !== immutableMinTimeToLive\n                ? immutableMinTimeToLive\n                : 24 * 3600 * 1000;\n\n        this._status = 'status' in res ? res.status : 200;\n        this._resHeaders = res.headers;\n        this._rescc = parseCacheControl(res.headers['cache-control']);\n        this._method = 'method' in req ? req.method : 'GET';\n        this._url = req.url;\n        this._host = req.headers.host;\n        this._noAuthorization = !req.headers.authorization;\n        this._reqHeaders = res.headers.vary ? req.headers : null; // Don't keep all request headers if they won't be used\n        this._reqcc = parseCacheControl(req.headers['cache-control']);\n\n        // Assume that if someone uses legacy, non-standard uncecessary options they don't understand caching,\n        // so there's no point stricly adhering to the blindly copy&pasted directives.\n        if (\n            ignoreCargoCult &&\n            'pre-check' in this._rescc &&\n            'post-check' in this._rescc\n        ) {\n            delete this._rescc['pre-check'];\n            delete this._rescc['post-check'];\n            delete this._rescc['no-cache'];\n            delete this._rescc['no-store'];\n            delete this._rescc['must-revalidate'];\n            this._resHeaders = Object.assign({}, this._resHeaders, {\n                'cache-control': formatCacheControl(this._rescc),\n            });\n            delete this._resHeaders.expires;\n            delete this._resHeaders.pragma;\n        }\n\n        // When the Cache-Control header field is not present in a request, caches MUST consider the no-cache request pragma-directive\n        // as having the same effect as if \"Cache-Control: no-cache\" were present (see Section 5.2.1).\n        if (\n            res.headers['cache-control'] == null &&\n            /no-cache/.test(res.headers.pragma)\n        ) {\n            this._rescc['no-cache'] = true;\n        }\n    }\n\n    now() {\n        return Date.now();\n    }\n\n    storable() {\n        // The \"no-store\" request directive indicates that a cache MUST NOT store any part of either this request or any response to it.\n        return !!(\n            !this._reqcc['no-store'] &&\n            // A cache MUST NOT store a response to any request, unless:\n            // The request method is understood by the cache and defined as being cacheable, and\n            ('GET' === this._method ||\n                'HEAD' === this._method ||\n                ('POST' === this._method && this._hasExplicitExpiration())) &&\n            // the response status code is understood by the cache, and\n            understoodStatuses.has(this._status) &&\n            // the \"no-store\" cache directive does not appear in request or response header fields, and\n            !this._rescc['no-store'] &&\n            // the \"private\" response directive does not appear in the response, if the cache is shared, and\n            (!this._isShared || !this._rescc.private) &&\n            // the Authorization header field does not appear in the request, if the cache is shared,\n            (!this._isShared ||\n                this._noAuthorization ||\n                this._allowsStoringAuthenticated()) &&\n            // the response either:\n            // contains an Expires header field, or\n            (this._resHeaders.expires ||\n                // contains a max-age response directive, or\n                // contains a s-maxage response directive and the cache is shared, or\n                // contains a public response directive.\n                this._rescc['max-age'] ||\n                (this._isShared && this._rescc['s-maxage']) ||\n                this._rescc.public ||\n                // has a status code that is defined as cacheable by default\n                statusCodeCacheableByDefault.has(this._status))\n        );\n    }\n\n    _hasExplicitExpiration() {\n        // 4.2.1 Calculating Freshness Lifetime\n        return (\n            (this._isShared && this._rescc['s-maxage']) ||\n            this._rescc['max-age'] ||\n            this._resHeaders.expires\n        );\n    }\n\n    _assertRequestHasHeaders(req) {\n        if (!req || !req.headers) {\n            throw Error('Request headers missing');\n        }\n    }\n\n    satisfiesWithoutRevalidation(req) {\n        this._assertRequestHasHeaders(req);\n\n        // When presented with a request, a cache MUST NOT reuse a stored response, unless:\n        // the presented request does not contain the no-cache pragma (Section 5.4), nor the no-cache cache directive,\n        // unless the stored response is successfully validated (Section 4.3), and\n        const requestCC = parseCacheControl(req.headers['cache-control']);\n        if (requestCC['no-cache'] || /no-cache/.test(req.headers.pragma)) {\n            return false;\n        }\n\n        if (requestCC['max-age'] && this.age() > requestCC['max-age']) {\n            return false;\n        }\n\n        if (\n            requestCC['min-fresh'] &&\n            this.timeToLive() < 1000 * requestCC['min-fresh']\n        ) {\n            return false;\n        }\n\n        // the stored response is either:\n        // fresh, or allowed to be served stale\n        if (this.stale()) {\n            const allowsStale =\n                requestCC['max-stale'] &&\n                !this._rescc['must-revalidate'] &&\n                (true === requestCC['max-stale'] ||\n                    requestCC['max-stale'] > this.age() - this.maxAge());\n            if (!allowsStale) {\n                return false;\n            }\n        }\n\n        return this._requestMatches(req, false);\n    }\n\n    _requestMatches(req, allowHeadMethod) {\n        // The presented effective request URI and that of the stored response match, and\n        return (\n            (!this._url || this._url === req.url) &&\n            this._host === req.headers.host &&\n            // the request method associated with the stored response allows it to be used for the presented request, and\n            (!req.method ||\n                this._method === req.method ||\n                (allowHeadMethod && 'HEAD' === req.method)) &&\n            // selecting header fields nominated by the stored response (if any) match those presented, and\n            this._varyMatches(req)\n        );\n    }\n\n    _allowsStoringAuthenticated() {\n        //  following Cache-Control response directives (Section 5.2.2) have such an effect: must-revalidate, public, and s-maxage.\n        return (\n            this._rescc['must-revalidate'] ||\n            this._rescc.public ||\n            this._rescc['s-maxage']\n        );\n    }\n\n    _varyMatches(req) {\n        if (!this._resHeaders.vary) {\n            return true;\n        }\n\n        // A Vary header field-value of \"*\" always fails to match\n        if (this._resHeaders.vary === '*') {\n            return false;\n        }\n\n        const fields = this._resHeaders.vary\n            .trim()\n            .toLowerCase()\n            .split(/\\s*,\\s*/);\n        for (const name of fields) {\n            if (req.headers[name] !== this._reqHeaders[name]) return false;\n        }\n        return true;\n    }\n\n    _copyWithoutHopByHopHeaders(inHeaders) {\n        const headers = {};\n        for (const name in inHeaders) {\n            if (hopByHopHeaders[name]) continue;\n            headers[name] = inHeaders[name];\n        }\n        // 9.1.  Connection\n        if (inHeaders.connection) {\n            const tokens = inHeaders.connection.trim().split(/\\s*,\\s*/);\n            for (const name of tokens) {\n                delete headers[name];\n            }\n        }\n        if (headers.warning) {\n            const warnings = headers.warning.split(/,/).filter(warning => {\n                return !/^\\s*1[0-9][0-9]/.test(warning);\n            });\n            if (!warnings.length) {\n                delete headers.warning;\n            } else {\n                headers.warning = warnings.join(',').trim();\n            }\n        }\n        return headers;\n    }\n\n    responseHeaders() {\n        const headers = this._copyWithoutHopByHopHeaders(this._resHeaders);\n        const age = this.age();\n\n        // A cache SHOULD generate 113 warning if it heuristically chose a freshness\n        // lifetime greater than 24 hours and the response's age is greater than 24 hours.\n        if (\n            age > 3600 * 24 &&\n            !this._hasExplicitExpiration() &&\n            this.maxAge() > 3600 * 24\n        ) {\n            headers.warning =\n                (headers.warning ? `${headers.warning}, ` : '') +\n                '113 - \"rfc7234 5.5.4\"';\n        }\n        headers.age = `${Math.round(age)}`;\n        headers.date = new Date(this.now()).toUTCString();\n        return headers;\n    }\n\n    /**\n     * Value of the Date response header or current time if Date was invalid\n     * @return timestamp\n     */\n    date() {\n        const serverDate = Date.parse(this._resHeaders.date);\n        if (isFinite(serverDate)) {\n            return serverDate;\n        }\n        return this._responseTime;\n    }\n\n    /**\n     * Value of the Age header, in seconds, updated for the current time.\n     * May be fractional.\n     *\n     * @return Number\n     */\n    age() {\n        let age = this._ageValue();\n\n        const residentTime = (this.now() - this._responseTime) / 1000;\n        return age + residentTime;\n    }\n\n    _ageValue() {\n        return toNumberOrZero(this._resHeaders.age);\n    }\n\n    /**\n     * Value of applicable max-age (or heuristic equivalent) in seconds. This counts since response's `Date`.\n     *\n     * For an up-to-date value, see `timeToLive()`.\n     *\n     * @return Number\n     */\n    maxAge() {\n        if (!this.storable() || this._rescc['no-cache']) {\n            return 0;\n        }\n\n        // Shared responses with cookies are cacheable according to the RFC, but IMHO it'd be unwise to do so by default\n        // so this implementation requires explicit opt-in via public header\n        if (\n            this._isShared &&\n            (this._resHeaders['set-cookie'] &&\n                !this._rescc.public &&\n                !this._rescc.immutable)\n        ) {\n            return 0;\n        }\n\n        if (this._resHeaders.vary === '*') {\n            return 0;\n        }\n\n        if (this._isShared) {\n            if (this._rescc['proxy-revalidate']) {\n                return 0;\n            }\n            // if a response includes the s-maxage directive, a shared cache recipient MUST ignore the Expires field.\n            if (this._rescc['s-maxage']) {\n                return toNumberOrZero(this._rescc['s-maxage']);\n            }\n        }\n\n        // If a response includes a Cache-Control field with the max-age directive, a recipient MUST ignore the Expires field.\n        if (this._rescc['max-age']) {\n            return toNumberOrZero(this._rescc['max-age']);\n        }\n\n        const defaultMinTtl = this._rescc.immutable ? this._immutableMinTtl : 0;\n\n        const serverDate = this.date();\n        if (this._resHeaders.expires) {\n            const expires = Date.parse(this._resHeaders.expires);\n            // A cache recipient MUST interpret invalid date formats, especially the value \"0\", as representing a time in the past (i.e., \"already expired\").\n            if (Number.isNaN(expires) || expires < serverDate) {\n                return 0;\n            }\n            return Math.max(defaultMinTtl, (expires - serverDate) / 1000);\n        }\n\n        if (this._resHeaders['last-modified']) {\n            const lastModified = Date.parse(this._resHeaders['last-modified']);\n            if (isFinite(lastModified) && serverDate > lastModified) {\n                return Math.max(\n                    defaultMinTtl,\n                    ((serverDate - lastModified) / 1000) * this._cacheHeuristic\n                );\n            }\n        }\n\n        return defaultMinTtl;\n    }\n\n    timeToLive() {\n        const age = this.maxAge() - this.age();\n        const staleIfErrorAge = age + toNumberOrZero(this._rescc['stale-if-error']);\n        const staleWhileRevalidateAge = age + toNumberOrZero(this._rescc['stale-while-revalidate']);\n        return Math.max(0, age, staleIfErrorAge, staleWhileRevalidateAge) * 1000;\n    }\n\n    stale() {\n        return this.maxAge() <= this.age();\n    }\n\n    _useStaleIfError() {\n        return this.maxAge() + toNumberOrZero(this._rescc['stale-if-error']) > this.age();\n    }\n\n    useStaleWhileRevalidate() {\n        return this.maxAge() + toNumberOrZero(this._rescc['stale-while-revalidate']) > this.age();\n    }\n\n    static fromObject(obj) {\n        return new this(undefined, undefined, { _fromObject: obj });\n    }\n\n    _fromObject(obj) {\n        if (this._responseTime) throw Error('Reinitialized');\n        if (!obj || obj.v !== 1) throw Error('Invalid serialization');\n\n        this._responseTime = obj.t;\n        this._isShared = obj.sh;\n        this._cacheHeuristic = obj.ch;\n        this._immutableMinTtl =\n            obj.imm !== undefined ? obj.imm : 24 * 3600 * 1000;\n        this._status = obj.st;\n        this._resHeaders = obj.resh;\n        this._rescc = obj.rescc;\n        this._method = obj.m;\n        this._url = obj.u;\n        this._host = obj.h;\n        this._noAuthorization = obj.a;\n        this._reqHeaders = obj.reqh;\n        this._reqcc = obj.reqcc;\n    }\n\n    toObject() {\n        return {\n            v: 1,\n            t: this._responseTime,\n            sh: this._isShared,\n            ch: this._cacheHeuristic,\n            imm: this._immutableMinTtl,\n            st: this._status,\n            resh: this._resHeaders,\n            rescc: this._rescc,\n            m: this._method,\n            u: this._url,\n            h: this._host,\n            a: this._noAuthorization,\n            reqh: this._reqHeaders,\n            reqcc: this._reqcc,\n        };\n    }\n\n    /**\n     * Headers for sending to the origin server to revalidate stale response.\n     * Allows server to return 304 to allow reuse of the previous response.\n     *\n     * Hop by hop headers are always stripped.\n     * Revalidation headers may be added or removed, depending on request.\n     */\n    revalidationHeaders(incomingReq) {\n        this._assertRequestHasHeaders(incomingReq);\n        const headers = this._copyWithoutHopByHopHeaders(incomingReq.headers);\n\n        // This implementation does not understand range requests\n        delete headers['if-range'];\n\n        if (!this._requestMatches(incomingReq, true) || !this.storable()) {\n            // revalidation allowed via HEAD\n            // not for the same resource, or wasn't allowed to be cached anyway\n            delete headers['if-none-match'];\n            delete headers['if-modified-since'];\n            return headers;\n        }\n\n        /* MUST send that entity-tag in any cache validation request (using If-Match or If-None-Match) if an entity-tag has been provided by the origin server. */\n        if (this._resHeaders.etag) {\n            headers['if-none-match'] = headers['if-none-match']\n                ? `${headers['if-none-match']}, ${this._resHeaders.etag}`\n                : this._resHeaders.etag;\n        }\n\n        // Clients MAY issue simple (non-subrange) GET requests with either weak validators or strong validators. Clients MUST NOT use weak validators in other forms of request.\n        const forbidsWeakValidators =\n            headers['accept-ranges'] ||\n            headers['if-match'] ||\n            headers['if-unmodified-since'] ||\n            (this._method && this._method != 'GET');\n\n        /* SHOULD send the Last-Modified value in non-subrange cache validation requests (using If-Modified-Since) if only a Last-Modified value has been provided by the origin server.\n        Note: This implementation does not understand partial responses (206) */\n        if (forbidsWeakValidators) {\n            delete headers['if-modified-since'];\n\n            if (headers['if-none-match']) {\n                const etags = headers['if-none-match']\n                    .split(/,/)\n                    .filter(etag => {\n                        return !/^\\s*W\\//.test(etag);\n                    });\n                if (!etags.length) {\n                    delete headers['if-none-match'];\n                } else {\n                    headers['if-none-match'] = etags.join(',').trim();\n                }\n            }\n        } else if (\n            this._resHeaders['last-modified'] &&\n            !headers['if-modified-since']\n        ) {\n            headers['if-modified-since'] = this._resHeaders['last-modified'];\n        }\n\n        return headers;\n    }\n\n    /**\n     * Creates new CachePolicy with information combined from the previews response,\n     * and the new revalidation response.\n     *\n     * Returns {policy, modified} where modified is a boolean indicating\n     * whether the response body has been modified, and old cached body can't be used.\n     *\n     * @return {Object} {policy: CachePolicy, modified: Boolean}\n     */\n    revalidatedPolicy(request, response) {\n        this._assertRequestHasHeaders(request);\n        if(this._useStaleIfError() && isErrorResponse(response)) {  // I consider the revalidation request unsuccessful\n          return {\n            modified: false,\n            matches: false,\n            policy: this,\n          };\n        }\n        if (!response || !response.headers) {\n            throw Error('Response headers missing');\n        }\n\n        // These aren't going to be supported exactly, since one CachePolicy object\n        // doesn't know about all the other cached objects.\n        let matches = false;\n        if (response.status !== undefined && response.status != 304) {\n            matches = false;\n        } else if (\n            response.headers.etag &&\n            !/^\\s*W\\//.test(response.headers.etag)\n        ) {\n            // \"All of the stored responses with the same strong validator are selected.\n            // If none of the stored responses contain the same strong validator,\n            // then the cache MUST NOT use the new response to update any stored responses.\"\n            matches =\n                this._resHeaders.etag &&\n                this._resHeaders.etag.replace(/^\\s*W\\//, '') ===\n                    response.headers.etag;\n        } else if (this._resHeaders.etag && response.headers.etag) {\n            // \"If the new response contains a weak validator and that validator corresponds\n            // to one of the cache's stored responses,\n            // then the most recent of those matching stored responses is selected for update.\"\n            matches =\n                this._resHeaders.etag.replace(/^\\s*W\\//, '') ===\n                response.headers.etag.replace(/^\\s*W\\//, '');\n        } else if (this._resHeaders['last-modified']) {\n            matches =\n                this._resHeaders['last-modified'] ===\n                response.headers['last-modified'];\n        } else {\n            // If the new response does not include any form of validator (such as in the case where\n            // a client generates an If-Modified-Since request from a source other than the Last-Modified\n            // response header field), and there is only one stored response, and that stored response also\n            // lacks a validator, then that stored response is selected for update.\n            if (\n                !this._resHeaders.etag &&\n                !this._resHeaders['last-modified'] &&\n                !response.headers.etag &&\n                !response.headers['last-modified']\n            ) {\n                matches = true;\n            }\n        }\n\n        if (!matches) {\n            return {\n                policy: new this.constructor(request, response),\n                // Client receiving 304 without body, even if it's invalid/mismatched has no option\n                // but to reuse a cached body. We don't have a good way to tell clients to do\n                // error recovery in such case.\n                modified: response.status != 304,\n                matches: false,\n            };\n        }\n\n        // use other header fields provided in the 304 (Not Modified) response to replace all instances\n        // of the corresponding header fields in the stored response.\n        const headers = {};\n        for (const k in this._resHeaders) {\n            headers[k] =\n                k in response.headers && !excludedFromRevalidationUpdate[k]\n                    ? response.headers[k]\n                    : this._resHeaders[k];\n        }\n\n        const newResponse = Object.assign({}, response, {\n            status: this._status,\n            method: this._method,\n            headers,\n        });\n        return {\n            policy: new this.constructor(request, newResponse, {\n                shared: this._isShared,\n                cacheHeuristic: this._cacheHeuristic,\n                immutableMinTimeToLive: this._immutableMinTtl,\n            }),\n            modified: false,\n            matches: true,\n        };\n    }\n};\n", "import assert from \"node:assert\";\nimport { Buffer } from \"node:buffer\";\nimport CachePolicy from \"http-cache-semantics\";\nimport {\n\tDeferredPromise,\n\tDELETE,\n\tGET,\n\tKeyValueStorage,\n\tLogLevel,\n\tMiniflareDurableObject,\n\tparseRanges,\n\tPURGE,\n\tPUT,\n} from \"miniflare:shared\";\nimport { isSitesRequest } from \"../kv\";\nimport {\n\tCacheMiss,\n\tPurgeFailure,\n\tRangeNotSatisfiable,\n\tStorageFailure,\n} from \"./errors.worker\";\nimport type { CacheObjectCf } from \"./constants\";\nimport type {\n\tInclusiveRange,\n\tMiniflareDurableObjectCf,\n\tMultipartReadableStream,\n\tRouteHandler,\n\tTimers,\n} from \"miniflare:shared\";\n\ninterface CacheMetadata {\n\theaders: string[][];\n\tstatus: number;\n\tsize: number;\n}\n\ntype CacheRouteHandler = RouteHandler<\n\tunknown,\n\tRequestInitCfProperties & MiniflareDurableObjectCf & CacheObjectCf\n>;\n\nfunction getCacheKey(req: Request<unknown, RequestInitCfProperties>) {\n\treturn req.cf?.cacheKey ? String(req.cf?.cacheKey) : req.url;\n}\n\nfunction getExpiration(timers: Timers, req: Request, res: Response) {\n\t// Cloudflare ignores request Cache-Control\n\tconst reqHeaders = normaliseHeaders(req.headers);\n\tdelete reqHeaders[\"cache-control\"];\n\n\t// Cloudflare never caches responses with Set-Cookie headers\n\t// If Cache-Control contains private=set-cookie, Cloudflare will remove\n\t// the Set-Cookie header automatically\n\tconst resHeaders = normaliseHeaders(res.headers);\n\tif (\n\t\tresHeaders[\"cache-control\"]?.toLowerCase().includes(\"private=set-cookie\")\n\t) {\n\t\tresHeaders[\"cache-control\"] = resHeaders[\"cache-control\"]\n\t\t\t?.toLowerCase()\n\t\t\t.replace(/private=set-cookie;?/i, \"\");\n\t\tdelete resHeaders[\"set-cookie\"];\n\t}\n\n\t// Build request and responses suitable for CachePolicy\n\tconst cacheReq: CachePolicy.Request = {\n\t\turl: req.url,\n\t\t// If a request gets to the Cache service, it's method will be GET. See README.md for details\n\t\tmethod: \"GET\",\n\t\theaders: reqHeaders,\n\t};\n\tconst cacheRes: CachePolicy.Response = {\n\t\tstatus: res.status,\n\t\theaders: resHeaders,\n\t};\n\n\t// @ts-expect-error `now` isn't included in CachePolicy's type definitions\n\tconst originalNow = CachePolicy.prototype.now;\n\t// @ts-expect-error `now` isn't included in CachePolicy's type definitions\n\tCachePolicy.prototype.now = timers.now;\n\ttry {\n\t\tconst policy = new CachePolicy(cacheReq, cacheRes, { shared: true });\n\n\t\treturn {\n\t\t\t// Check if the request & response is cacheable\n\t\t\tstorable: policy.storable() && !(\"set-cookie\" in resHeaders),\n\t\t\texpiration: policy.timeToLive(),\n\t\t\t// Cache Policy Headers is typed as [header: string]: string | string[] | undefined\n\t\t\t// It's safe to ignore the undefined here, which is what casting to HeadersInit does\n\t\t\theaders: policy.responseHeaders() as HeadersInit,\n\t\t};\n\t} finally {\n\t\t// @ts-expect-error `now` isn't included in CachePolicy's type definitions\n\t\tCachePolicy.prototype.now = originalNow;\n\t}\n}\n\n// Normalises headers to object mapping lower-case names to single values.\n// Single values are OK here as the headers we care about for determining\n// cache-ability are all single-valued, and we store the raw, multi-valued\n// headers in KV once this has been determined.\nfunction normaliseHeaders(headers: Headers): Record<string, string> {\n\tconst result: Record<string, string> = {};\n\tfor (const [key, value] of headers) result[key.toLowerCase()] = value;\n\treturn result;\n}\n\n// https://developer.mozilla.org/en-US/docs/Web/HTTP/Headers/ETag#syntax\nconst etagRegexp = /^(W\\/)?\"(.+)\"$/;\nfunction parseETag(value: string): string | undefined {\n\t// As we only use this for `If-None-Match` handling, which always uses the\n\t// weak comparison algorithm, ignore \"W/\" directives:\n\t// https://developer.mozilla.org/en-US/docs/Web/HTTP/Headers/If-None-Match\n\treturn etagRegexp.exec(value.trim())?.[2] ?? undefined;\n}\n\n// https://datatracker.ietf.org/doc/html/rfc7231#section-7.1.1.1\nconst utcDateRegexp =\n\t/^(Mon|Tue|Wed|Thu|Fri|Sat|Sun), \\d\\d (Jan|Feb|Mar|Apr|May|Jun|Jul|Aug|Sep|Oct|Nov|Dec) \\d\\d\\d\\d \\d\\d:\\d\\d:\\d\\d GMT$/;\nfunction parseUTCDate(value: string): number {\n\treturn utcDateRegexp.test(value) ? Date.parse(value) : NaN;\n}\n\ninterface CachedResponse {\n\tstatus: number;\n\theaders: Headers;\n\tranges: InclusiveRange[];\n\tbody: ReadableStream<Uint8Array> | MultipartReadableStream;\n\ttotalSize: number;\n}\nfunction getMatchResponse(reqHeaders: Headers, res: CachedResponse): Response {\n\t// If `If-None-Match` is set, perform a conditional request:\n\t// https://developer.mozilla.org/en-US/docs/Web/HTTP/Headers/If-None-Match\n\tconst reqIfNoneMatchHeader = reqHeaders.get(\"If-None-Match\");\n\tconst resETagHeader = res.headers.get(\"ETag\");\n\tif (reqIfNoneMatchHeader !== null && resETagHeader !== null) {\n\t\tconst resETag = parseETag(resETagHeader);\n\t\tif (resETag !== undefined) {\n\t\t\tif (reqIfNoneMatchHeader.trim() === \"*\") {\n\t\t\t\treturn new Response(null, { status: 304, headers: res.headers });\n\t\t\t}\n\t\t\tfor (const reqIfNoneMatch of reqIfNoneMatchHeader.split(\",\")) {\n\t\t\t\tif (resETag === parseETag(reqIfNoneMatch)) {\n\t\t\t\t\treturn new Response(null, { status: 304, headers: res.headers });\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\t}\n\n\t// If `If-Modified-Since` is set, perform a conditional request:\n\t// https://developer.mozilla.org/en-US/docs/Web/HTTP/Headers/If-Modified-Since\n\tconst reqIfModifiedSinceHeader = reqHeaders.get(\"If-Modified-Since\");\n\tconst resLastModifiedHeader = res.headers.get(\"Last-Modified\");\n\tif (reqIfModifiedSinceHeader !== null && resLastModifiedHeader !== null) {\n\t\tconst reqIfModifiedSince = parseUTCDate(reqIfModifiedSinceHeader);\n\t\tconst resLastModified = parseUTCDate(resLastModifiedHeader);\n\t\t// Comparison of NaN's (invalid dates), will always result in `false`\n\t\tif (resLastModified <= reqIfModifiedSince) {\n\t\t\treturn new Response(null, { status: 304, headers: res.headers });\n\t\t}\n\t}\n\n\t// If `Range` was set, return a partial response:\n\t// https://developer.mozilla.org/en-US/docs/Web/HTTP/Headers/Range\n\tif (res.ranges.length > 0) {\n\t\tres.status = 206; // Partial Content\n\t\tif (res.ranges.length > 1) {\n\t\t\tassert(!(res.body instanceof ReadableStream)); // assert(isMultipart)\n\t\t\tres.headers.set(\"Content-Type\", res.body.multipartContentType);\n\t\t} else {\n\t\t\tconst { start, end } = res.ranges[0];\n\t\t\tres.headers.set(\n\t\t\t\t\"Content-Range\",\n\t\t\t\t`bytes ${start}-${end}/${res.totalSize}`\n\t\t\t);\n\t\t\tres.headers.set(\"Content-Length\", `${end - start + 1}`);\n\t\t}\n\t}\n\n\tif (!(res.body instanceof ReadableStream)) res.body = res.body.body;\n\treturn new Response(res.body, { status: res.status, headers: res.headers });\n}\n\nconst CR = \"\\r\".charCodeAt(0);\nconst LF = \"\\n\".charCodeAt(0);\nconst STATUS_REGEXP =\n\t/^HTTP\\/\\d(?:\\.\\d)? (?<rawStatusCode>\\d+) (?<statusText>.*)$/;\nexport async function parseHttpResponse(\n\tstream: ReadableStream\n): Promise<Response> {\n\t// Buffer until first \"\\r\\n\\r\\n\"\n\tlet buffer = Buffer.alloc(0);\n\tlet blankLineIndex = -1;\n\tfor await (const chunk of stream.values({ preventCancel: true })) {\n\t\t// TODO(perf): make this more efficient, we should be able to do something\n\t\t//  like a \"rope-string\" of chunks for finding the index, recording where we\n\t\t//  last got to when looking and starting there\n\t\tbuffer = Buffer.concat([buffer, chunk]);\n\t\tblankLineIndex = buffer.findIndex(\n\t\t\t(_value, index) =>\n\t\t\t\tbuffer[index] === CR &&\n\t\t\t\tbuffer[index + 1] === LF &&\n\t\t\t\tbuffer[index + 2] === CR &&\n\t\t\t\tbuffer[index + 3] === LF\n\t\t);\n\t\tif (blankLineIndex !== -1) break;\n\t}\n\tassert(blankLineIndex !== -1, \"Expected to find blank line in HTTP message\");\n\n\t// Parse status and headers\n\tconst rawStatusHeaders = buffer.subarray(0, blankLineIndex).toString();\n\tconst [rawStatus, ...rawHeaders] = rawStatusHeaders.split(\"\\r\\n\");\n\t// https://www.rfc-editor.org/rfc/rfc7230#section-3.1.2\n\tconst statusMatch = rawStatus.match(STATUS_REGEXP);\n\tassert(\n\t\tstatusMatch?.groups != null,\n\t\t`Expected first line ${JSON.stringify(rawStatus)} to be HTTP status line`\n\t);\n\tconst { rawStatusCode, statusText } = statusMatch.groups;\n\tconst statusCode = parseInt(rawStatusCode);\n\t// https://www.rfc-editor.org/rfc/rfc7230#section-3.2\n\tconst headers = rawHeaders.map((rawHeader) => {\n\t\tconst index = rawHeader.indexOf(\":\");\n\t\treturn [\n\t\t\trawHeader.substring(0, index),\n\t\t\trawHeader.substring(index + 1).trim(),\n\t\t];\n\t});\n\n\t// Construct body, by concatenating prefix (what we read over from headers)\n\t// with the rest of the stream\n\tconst prefix = buffer.subarray(blankLineIndex + 4 /* \"\\r\\n\\r\\n\" */);\n\t// Even if `prefix.length === 0` here, we need to construct a new stream.\n\t// Otherwise, we'll get a `TypeError: This ReadableStream is disturbed...`\n\t// when constructing the `Response` below.\n\tconst { readable, writable } = new IdentityTransformStream();\n\tconst writer = writable.getWriter();\n\tvoid writer\n\t\t.write(prefix)\n\t\t.then(() => {\n\t\t\twriter.releaseLock();\n\t\t\treturn stream.pipeTo(writable);\n\t\t})\n\t\t.catch((e) => console.error(\"Error writing HTTP body:\", e));\n\n\treturn new Response(readable, { status: statusCode, statusText, headers });\n}\n\nclass SizingStream extends TransformStream<Uint8Array, Uint8Array> {\n\treadonly size: Promise<number>;\n\n\tconstructor() {\n\t\tconst sizePromise = new DeferredPromise<number>();\n\t\tlet size = 0;\n\t\tsuper({\n\t\t\ttransform(chunk, controller) {\n\t\t\t\tsize += chunk.byteLength;\n\t\t\t\tcontroller.enqueue(chunk);\n\t\t\t},\n\t\t\tflush() {\n\t\t\t\tsizePromise.resolve(size);\n\t\t\t},\n\t\t});\n\t\tthis.size = sizePromise;\n\t}\n}\n\nexport class CacheObject extends MiniflareDurableObject {\n\t#warnedUsage = false;\n\tasync #maybeWarnUsage(request: Request<unknown, CacheObjectCf>) {\n\t\tif (!this.#warnedUsage && request.cf?.miniflare?.cacheWarnUsage === true) {\n\t\t\tthis.#warnedUsage = true;\n\t\t\tawait this.logWithLevel(\n\t\t\t\tLogLevel.WARN,\n\t\t\t\t\"Cache operations will have no impact if you deploy to a workers.dev subdomain!\"\n\t\t\t);\n\t\t}\n\t}\n\n\t#storage?: KeyValueStorage<CacheMetadata>;\n\tget storage() {\n\t\t// `KeyValueStorage` can only be constructed once `this.blob` is initialised\n\t\treturn (this.#storage ??= new KeyValueStorage(this));\n\t}\n\n\t@GET()\n\tmatch: CacheRouteHandler = async (req) => {\n\t\tawait this.#maybeWarnUsage(req);\n\t\tconst cacheKey = getCacheKey(req);\n\n\t\t// Never cache Workers Sites requests, so we always return on-disk files\n\t\tif (isSitesRequest(req)) throw new CacheMiss();\n\n\t\tlet resHeaders: Headers | undefined;\n\t\tlet resRanges: InclusiveRange[] | undefined;\n\n\t\tconst cached = await this.storage.get(cacheKey, ({ size, headers }) => {\n\t\t\tresHeaders = new Headers(headers);\n\t\t\tconst contentType = resHeaders.get(\"Content-Type\");\n\n\t\t\t// Need size from metadata to parse `Range` header\n\t\t\tconst rangeHeader = req.headers.get(\"Range\");\n\t\t\tif (rangeHeader !== null) {\n\t\t\t\tresRanges = parseRanges(rangeHeader, size);\n\t\t\t\tif (resRanges === undefined) throw new RangeNotSatisfiable(size);\n\t\t\t}\n\n\t\t\treturn {\n\t\t\t\tranges: resRanges,\n\t\t\t\tcontentLength: size,\n\t\t\t\tcontentType: contentType ?? undefined,\n\t\t\t};\n\t\t});\n\t\tif (cached?.metadata === undefined) throw new CacheMiss();\n\n\t\t// Should've constructed headers when we extracted range options (the only\n\t\t// time we don't do this is when the entry isn't found, or expired, in which\n\t\t// case, we just threw a `CacheMiss`)\n\t\tassert(resHeaders !== undefined);\n\t\tresHeaders.set(\"CF-Cache-Status\", \"HIT\");\n\t\tresRanges ??= [];\n\n\t\treturn getMatchResponse(req.headers, {\n\t\t\tstatus: cached.metadata.status,\n\t\t\theaders: resHeaders,\n\t\t\tranges: resRanges,\n\t\t\tbody: cached.value,\n\t\t\ttotalSize: cached.metadata.size,\n\t\t});\n\t};\n\n\t@PUT()\n\tput: CacheRouteHandler = async (req) => {\n\t\tawait this.#maybeWarnUsage(req);\n\t\tconst cacheKey = getCacheKey(req);\n\n\t\t// Never cache Workers Sites requests, so we always return on-disk files\n\t\tif (isSitesRequest(req)) throw new CacheMiss();\n\n\t\tassert(req.body !== null);\n\t\tconst res = await parseHttpResponse(req.body);\n\t\tlet body = res.body;\n\t\tassert(body !== null);\n\n\t\tconst { storable, expiration, headers } = getExpiration(\n\t\t\tthis.timers,\n\t\t\treq,\n\t\t\tres\n\t\t);\n\t\tif (!storable) {\n\t\t\t// Make sure `body` is consumed to avoid `TypeError: Can't read from\n\t\t\t// request stream after response has been sent.`\n\t\t\ttry {\n\t\t\t\tawait body.pipeTo(new WritableStream());\n\t\t\t} catch {}\n\t\t\tthrow new StorageFailure();\n\t\t}\n\n\t\t// If we know the size, avoid passing the body through a transform stream to\n\t\t// count it (trusting `workerd` to send correct value here).\n\t\tconst contentLength = parseInt(res.headers.get(\"Content-Length\") ?? \"NaN\");\n\t\tlet sizePromise: Promise<number>;\n\t\tif (Number.isNaN(contentLength)) {\n\t\t\tconst stream = new SizingStream();\n\t\t\tbody = body.pipeThrough(stream);\n\t\t\tsizePromise = stream.size;\n\t\t} else {\n\t\t\tsizePromise = Promise.resolve(contentLength);\n\t\t}\n\n\t\tconst metadata: Promise<CacheMetadata> = sizePromise.then((size) => ({\n\t\t\theaders: Object.entries(headers),\n\t\t\tstatus: res.status,\n\t\t\tsize,\n\t\t}));\n\n\t\tawait this.storage.put({\n\t\t\tkey: cacheKey,\n\t\t\tvalue: body,\n\t\t\texpiration: this.timers.now() + expiration,\n\t\t\tmetadata,\n\t\t});\n\t\treturn new Response(null, { status: 204 });\n\t};\n\n\t@PURGE()\n\tdelete: CacheRouteHandler = async (req) => {\n\t\tawait this.#maybeWarnUsage(req);\n\t\tconst cacheKey = getCacheKey(req);\n\n\t\tconst deleted = await this.storage.delete(cacheKey);\n\t\t// This is an extremely vague error, but it fits with what the cache API in workerd expects\n\t\tif (!deleted) throw new PurgeFailure();\n\t\treturn new Response(null);\n\t};\n\n\t@DELETE(\"/purge-all\")\n\tpurgeAll: CacheRouteHandler = async () => {\n\t\tconst deletedCount = this.storage.deleteAll();\n\t\treturn Response.json({ deleted: deletedCount });\n\t};\n}\n", "import { testRegExps } from \"miniflare:shared\";\nimport type { MatcherRegExps } from \"miniflare:shared\";\n\nexport const KVLimits = {\n\tMIN_CACHE_TTL_SECONDS: 30,\n\tMIN_EXPIRATION_TTL_SECONDS: 60,\n\tMAX_LIST_KEYS: 1000,\n\tMAX_KEY_SIZE_BYTES: 512,\n\tMAX_VALUE_SIZE_BYTES: 25 * 1024 * 1024 /* 25MiB */,\n\tMAX_VALUE_SIZE_TEST_BYTES: 1024 /* 1KiB */,\n\tMAX_METADATA_SIZE_BYTES: 1024 /* 1KiB */,\n\tMAX_BULK_SIZE_BYTES: 25 * 1024 * 1024 /* 25MiB */,\n} as const;\n\nexport const KVParams = {\n\tURL_ENCODED: \"urlencoded\",\n\tCACHE_TTL: \"cache_ttl\",\n\tEXPIRATION: \"expiration\",\n\tEXPIRATION_TTL: \"expiration_ttl\",\n\tLIST_LIMIT: \"key_count_limit\",\n\tLIST_PREFIX: \"prefix\",\n\tLIST_CURSOR: \"cursor\",\n} as const;\n\nexport const KVHeaders = {\n\tEXPIRATION: \"CF-Expiration\",\n\tMETADATA: \"CF-KV-Metadata\",\n} as const;\n\nexport const SiteBindings = {\n\tKV_NAMESPACE_SITE: \"__STATIC_CONTENT\",\n\tJSON_SITE_MANIFEST: \"__STATIC_CONTENT_MANIFEST\",\n\tJSON_SITE_FILTER: \"MINIFLARE_SITE_FILTER\",\n} as const;\n\n// Magic prefix: if a URLs pathname starts with this, it shouldn't be cached.\n// This ensures edge caching of Workers Sites files is disabled, and the latest\n// local version is always served.\nexport const SITES_NO_CACHE_PREFIX = \"$__MINIFLARE_SITES__$/\";\nexport const MAX_BULK_GET_KEYS = 100;\n\nexport function encodeSitesKey(key: string): string {\n\t// `encodeURIComponent()` ensures `ETag`s used by `@cloudflare/kv-asset-handler`\n\t// are always byte strings.\n\treturn SITES_NO_CACHE_PREFIX + encodeURIComponent(key);\n}\nexport function decodeSitesKey(key: string): string {\n\treturn key.startsWith(SITES_NO_CACHE_PREFIX)\n\t\t? decodeURIComponent(key.substring(SITES_NO_CACHE_PREFIX.length))\n\t\t: key;\n}\n\nexport function isSitesRequest(request: { url: string }) {\n\tconst url = new URL(request.url);\n\treturn url.pathname.startsWith(`/${SITES_NO_CACHE_PREFIX}`);\n}\n\nexport interface SiteMatcherRegExps {\n\tinclude?: MatcherRegExps;\n\texclude?: MatcherRegExps;\n}\n\nexport interface SerialisableMatcherRegExps {\n\tinclude: string[];\n\texclude: string[];\n}\n\nexport interface SerialisableSiteMatcherRegExps {\n\tinclude?: SerialisableMatcherRegExps;\n\texclude?: SerialisableMatcherRegExps;\n}\n\nfunction serialiseRegExp(regExp: RegExp): string {\n\tconst str = regExp.toString();\n\treturn str.substring(str.indexOf(\"/\") + 1, str.lastIndexOf(\"/\"));\n}\n\nexport function serialiseRegExps(\n\tmatcher: MatcherRegExps\n): SerialisableMatcherRegExps {\n\treturn {\n\t\tinclude: matcher.include.map(serialiseRegExp),\n\t\texclude: matcher.exclude.map(serialiseRegExp),\n\t};\n}\n\nexport function deserialiseRegExps(\n\tmatcher: SerialisableMatcherRegExps\n): MatcherRegExps {\n\treturn {\n\t\tinclude: matcher.include.map((regExp) => new RegExp(regExp)),\n\t\texclude: matcher.exclude.map((regExp) => new RegExp(regExp)),\n\t};\n}\n\nexport function serialiseSiteRegExps(\n\tsiteRegExps: SiteMatcherRegExps\n): SerialisableSiteMatcherRegExps {\n\treturn {\n\t\tinclude: siteRegExps.include && serialiseRegExps(siteRegExps.include),\n\t\texclude: siteRegExps.exclude && serialiseRegExps(siteRegExps.exclude),\n\t};\n}\n\nexport function deserialiseSiteRegExps(\n\tsiteRegExps: SerialisableSiteMatcherRegExps\n): SiteMatcherRegExps {\n\treturn {\n\t\tinclude: siteRegExps.include && deserialiseRegExps(siteRegExps.include),\n\t\texclude: siteRegExps.exclude && deserialiseRegExps(siteRegExps.exclude),\n\t};\n}\n\nexport function testSiteRegExps(\n\tregExps: SiteMatcherRegExps,\n\tkey: string\n): boolean {\n\t// Either include globs undefined, or name matches them\n\tif (regExps.include !== undefined) return testRegExps(regExps.include, key);\n\t// Either exclude globs undefined, or name doesn't match them\n\tif (regExps.exclude !== undefined) return !testRegExps(regExps.exclude, key);\n\treturn true;\n}\n\nexport function getAssetsBindingsNames(\n\t// __STATIC_CONTENT and __STATIC_CONTENT_MANIFEST binding names are\n\t// reserved for Workers Sites. Since we want to allow both sites and\n\t// assets to work side by side, we cannot use the same binding name\n\t// for assets. Therefore deferring to a different default naming here.\n\tassetsKVBindingName = \"__STATIC_ASSETS_CONTENT\",\n\tassetsManifestBindingName = \"__STATIC_ASSETS_CONTENT_MANIFEST\"\n) {\n\treturn {\n\t\tASSETS_KV_NAMESPACE: assetsKVBindingName,\n\t\tASSETS_MANIFEST: assetsManifestBindingName,\n\t} as const;\n}\n", "import { HttpError } from \"miniflare:shared\";\nimport { CacheHeaders } from \"./constants\";\n\nexport class CacheError extends HttpError {\n\tconstructor(\n\t\tcode: number,\n\t\tmessage: string,\n\t\treadonly headers: HeadersInit = []\n\t) {\n\t\tsuper(code, message);\n\t}\n\n\ttoResponse() {\n\t\treturn new Response(null, {\n\t\t\tstatus: this.code,\n\t\t\theaders: this.headers,\n\t\t});\n\t}\n\n\tcontext(info: string) {\n\t\tthis.message += ` (${info})`;\n\t\treturn this;\n\t}\n}\n\nexport class StorageFailure extends CacheError {\n\tconstructor() {\n\t\tsuper(413, \"Cache storage failed\");\n\t}\n}\n\nexport class PurgeFailure extends CacheError {\n\tconstructor() {\n\t\tsuper(404, \"Couldn't find asset to purge\");\n\t}\n}\n\nexport class CacheMiss extends CacheError {\n\tconstructor() {\n\t\tsuper(\n\t\t\t// workerd ignores this, but it's the correct status code\n\t\t\t504,\n\t\t\t\"Asset not found in cache\",\n\t\t\t[[CacheHeaders.STATUS, \"MISS\"]]\n\t\t);\n\t}\n}\n\nexport class RangeNotSatisfiable extends CacheError {\n\tconstructor(size: number) {\n\t\tsuper(416, \"Range not satisfiable\", [\n\t\t\t[\"Content-Range\", `bytes */${size}`],\n\t\t\t[CacheHeaders.STATUS, \"HIT\"],\n\t\t]);\n\t}\n}\n", "export const CacheHeaders = {\n\tNAMESPACE: \"cf-cache-namespace\",\n\tSTATUS: \"cf-cache-status\",\n} as const;\n\nexport const CacheBindings = {\n\tMAYBE_JSON_CACHE_WARN_USAGE: \"MINIFLARE_CACHE_WARN_USAGE\",\n} as const;\n\nexport interface CacheObjectCf {\n\tminiflare?: { cacheWarnUsage?: boolean };\n}\n"],
  "mappings": ";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAEA,QAAM,+BAA+B,oBAAI,IAAI;AAAA,MACzC;AAAA,MACA;AAAA,MACA;AAAA,MACA;AAAA,MACA;AAAA,MACA;AAAA,MACA;AAAA,MACA;AAAA,MACA;AAAA,MACA;AAAA,MACA;AAAA,MACA;AAAA,IACJ,CAAC,GAGK,qBAAqB,oBAAI,IAAI;AAAA,MAC/B;AAAA,MACA;AAAA,MACA;AAAA,MACA;AAAA,MACA;AAAA,MACA;AAAA,MACA;AAAA,MACA;AAAA,MACA;AAAA,MACA;AAAA,MACA;AAAA,MACA;AAAA,MACA;AAAA,MACA;AAAA,IACJ,CAAC,GAEK,mBAAmB,oBAAI,IAAI;AAAA,MAC7B;AAAA,MACA;AAAA,MACA;AAAA,MACA;AAAA,IACJ,CAAC,GAEK,kBAAkB;AAAA,MACpB,MAAM;AAAA;AAAA,MACN,YAAY;AAAA,MACZ,cAAc;AAAA,MACd,sBAAsB;AAAA,MACtB,uBAAuB;AAAA,MACvB,IAAI;AAAA,MACJ,SAAS;AAAA,MACT,qBAAqB;AA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