'use strict';

var OT5L7ME6_cjs = require('./OT5L7ME6.cjs');
var U7VZULNU_cjs = require('./U7VZULNU.cjs');

// ../../node_modules/.pnpm/@smithy+core@3.9.1/node_modules/@smithy/core/dist-es/submodules/protocols/requestBuilder.js
U7VZULNU_cjs.init_cjs_shims();
function requestBuilder(input, context) {
  return new RequestBuilder(input, context);
}
U7VZULNU_cjs.__name(requestBuilder, "requestBuilder");
var RequestBuilder = class {
  static {
    U7VZULNU_cjs.__name(this, "RequestBuilder");
  }
  constructor(input, context) {
    this.input = input;
    this.context = context;
    this.query = {};
    this.method = "";
    this.headers = {};
    this.path = "";
    this.body = null;
    this.hostname = "";
    this.resolvePathStack = [];
  }
  async build() {
    const { hostname, protocol = "https", port, path: basePath } = await this.context.endpoint();
    this.path = basePath;
    for (const resolvePath of this.resolvePathStack) {
      resolvePath(this.path);
    }
    return new OT5L7ME6_cjs.HttpRequest({
      protocol,
      hostname: this.hostname || hostname,
      port,
      method: this.method,
      path: this.path,
      query: this.query,
      body: this.body,
      headers: this.headers
    });
  }
  hn(hostname) {
    this.hostname = hostname;
    return this;
  }
  bp(uriLabel) {
    this.resolvePathStack.push((basePath) => {
      this.path = `${basePath?.endsWith("/") ? basePath.slice(0, -1) : basePath || ""}` + uriLabel;
    });
    return this;
  }
  p(memberName, labelValueProvider, uriLabel, isGreedyLabel) {
    this.resolvePathStack.push((path) => {
      this.path = OT5L7ME6_cjs.resolvedPath(path, this.input, memberName, labelValueProvider, uriLabel, isGreedyLabel);
    });
    return this;
  }
  h(headers) {
    this.headers = headers;
    return this;
  }
  q(query) {
    this.query = query;
    return this;
  }
  b(body) {
    this.body = body;
    return this;
  }
  m(method) {
    this.method = method;
    return this;
  }
};

// ../../node_modules/.pnpm/@smithy+core@3.9.1/node_modules/@smithy/core/dist-es/protocols/requestBuilder.js
U7VZULNU_cjs.init_cjs_shims();

exports.requestBuilder = requestBuilder;
//# sourceMappingURL=WH45T4LS.cjs.map
//# sourceMappingURL=WH45T4LS.cjs.map