import { createRequire as _createRequire } from 'node:module';
const require = _createRequire(import.meta.url);
import {
  useHttpClient
} from "./chunk-BRX4HWJE.js";
import {
  usePanoramaMethodLogger
} from "./chunk-ZBFOAJ5H.js";
import {
  resolveUrl,
  serializer,
  toURLSearchParams,
  useBiLogger
} from "./chunk-YHFCDWGT.js";
import {
  wixCliAction,
  wixCliAppFlowFileUploadStarted,
  wixCliAppFlowStepsAnswers,
  wixCliAppFlowUploadEnded,
  wixCliAppsFlowDeploymentStatusSrc11Evid5232
} from "./chunk-IVQPYJ5M.js";
import {
  require_react
} from "./chunk-TODKQSCF.js";
import {
  external_exports
} from "./chunk-SDLCFZRL.js";
import {
  CliError,
  CliErrorCode
} from "./chunk-WGV2XQSB.js";
import {
  __toESM,
  init_esm_shims
} from "./chunk-EXLZF52D.js";

// ../metasite-manager-client/src/useMetasiteManagerClient.ts
init_esm_shims();
var import_react = __toESM(require_react(), 1);

// ../metasite-manager-client/src/metasite-manager-client.ts
init_esm_shims();

// ../../node_modules/@wix/ambassador-metasite-api-v1-meta-site/build/es/http.impl.js
init_esm_shims();
var _createMetaSiteFromTemplateRequest = {};
var _createMetaSiteFromTemplateResponse = { metaSite: "_metaSite" };
var _getUrlRequest = {};
var _getUrlResponse = {};
var _metaSite = {
  dateCreated: "google.protobuf.Timestamp",
  dateUpdated: "google.protobuf.Timestamp",
  accountCreatedDate: "google.protobuf.Timestamp"
};
function resolveComWixpressMetasiteApiV1MetaSiteReadApiUrl(opts) {
  var domainToMappings = {
    "www._base_domain_": [
      {
        srcPath: "/_api/msm-server",
        destPath: ""
      },
      {
        srcPath: "/_api/msm/v1/meta-site/get",
        destPath: "/v1/meta-site/get"
      },
      {
        srcPath: "/_api/msm/v1/meta-site/is-site-name-free",
        destPath: "/v1/meta-site/is-site-name-free"
      },
      {
        srcPath: "/_api/msm/v1/meta-site/has-sites",
        destPath: "/v1/meta-site/has-sites"
      },
      {
        srcPath: "/_api/msm/v1/meta-site/get-url",
        destPath: "/v1/meta-site/get-url"
      }
    ],
    "manage._base_domain_": [
      {
        srcPath: "/_api/msm-server",
        destPath: ""
      },
      {
        srcPath: "/_api/msm/v1/meta-site/is-site-name-free",
        destPath: "/v1/meta-site/is-site-name-free"
      },
      {
        srcPath: "/_api/msm/v1/meta-site/has-sites",
        destPath: "/v1/meta-site/has-sites"
      },
      {
        srcPath: "/_api/msm/v1/meta-site/get-url",
        destPath: "/v1/meta-site/get-url"
      },
      {
        srcPath: "/_api/msm/v1/meta-site/get",
        destPath: "/v1/meta-site/get"
      }
    ],
    "editor-flow.wixapps.net": [
      {
        srcPath: "/_api/msm/v1/meta-site/get",
        destPath: "/v1/meta-site/get"
      }
    ],
    "editor._base_domain_": [
      {
        srcPath: "/_api/msm/v1/meta-site/get",
        destPath: "/v1/meta-site/get"
      },
      {
        srcPath: "/_api/msm/v1/meta-site/get-url",
        destPath: "/v1/meta-site/get-url"
      },
      {
        srcPath: "/_api/msm/v1/meta-site/has-sites",
        destPath: "/v1/meta-site/has-sites"
      },
      {
        srcPath: "/_api/msm/v1/meta-site/is-site-name-free",
        destPath: "/v1/meta-site/is-site-name-free"
      }
    ],
    "blocks._base_domain_": [
      {
        srcPath: "/_api/msm/v1/meta-site/get",
        destPath: "/v1/meta-site/get"
      },
      {
        srcPath: "/_api/msm/v1/meta-site/get-url",
        destPath: "/v1/meta-site/get-url"
      },
      {
        srcPath: "/_api/msm/v1/meta-site/has-sites",
        destPath: "/v1/meta-site/has-sites"
      },
      {
        srcPath: "/_api/msm/v1/meta-site/is-site-name-free",
        destPath: "/v1/meta-site/is-site-name-free"
      }
    ],
    "create.editorx": [
      {
        srcPath: "/_api/msm/v1/meta-site/get",
        destPath: "/v1/meta-site/get"
      },
      {
        srcPath: "/_api/msm/v1/meta-site/get-url",
        destPath: "/v1/meta-site/get-url"
      },
      {
        srcPath: "/_api/msm/v1/meta-site/has-sites",
        destPath: "/v1/meta-site/has-sites"
      },
      {
        srcPath: "/_api/msm/v1/meta-site/is-site-name-free",
        destPath: "/v1/meta-site/is-site-name-free"
      }
    ],
    "www.wixgateway.com": [
      {
        srcPath: "/v1/meta-site/session-token",
        destPath: "/v1/meta-site/session-token"
      }
    ],
    "api._api_base_domain_": [
      {
        srcPath: "/msm-server",
        destPath: ""
      }
    ],
    "dev._base_domain_": [
      {
        srcPath: "/_api/msm/v1/meta-site/has-sites",
        destPath: "/v1/meta-site/has-sites"
      }
    ],
    "online.codux.com": [
      {
        srcPath: "/_api/msm/v1/meta-site",
        destPath: "/v1/meta-site"
      }
    ]
  };
  return resolveUrl(Object.assign(opts, { domainToMappings }));
}
function resolveComWixpressMetasiteApiV1MetaSiteLifecycleUrl(opts) {
  var domainToMappings = {
    "www._base_domain_": [
      {
        srcPath: "/_api/msm-writer",
        destPath: ""
      },
      {
        srcPath: "/_api/msm",
        destPath: ""
      }
    ],
    "manage._base_domain_": [
      {
        srcPath: "/_api/msm-writer",
        destPath: ""
      },
      {
        srcPath: "/_api/msm",
        destPath: ""
      }
    ],
    "www.wixapis.com": [
      {
        srcPath: "/msm",
        destPath: ""
      }
    ],
    "editor._base_domain_": [
      {
        srcPath: "/_api/msm-writer",
        destPath: ""
      }
    ],
    "blocks._base_domain_": [
      {
        srcPath: "/_api/msm-writer",
        destPath: ""
      }
    ],
    "create.editorx": [
      {
        srcPath: "/_api/msm-writer",
        destPath: ""
      }
    ]
  };
  return resolveUrl(Object.assign(opts, { domainToMappings }));
}
function createMetaSiteFromTemplate(payload) {
  var _a = serializer(_createMetaSiteFromTemplateRequest, {}), toReq = _a.toJSON, fromReq = _a.fromJSON;
  var fromRes = serializer(_createMetaSiteFromTemplateResponse, { _metaSite }).fromJSON;
  function __createMetaSiteFromTemplate(_a2) {
    var host = _a2.host;
    var serializedData = toReq(payload);
    var metadata = {
      entityFqdn: "wix.metasite.api.v1.meta_site",
      method: "POST",
      methodFqn: "com.wixpress.metasite.api.v1.MetaSiteLifecycle.CreateMetaSiteFromTemplate",
      url: resolveComWixpressMetasiteApiV1MetaSiteLifecycleUrl({
        protoPath: "/v1/meta-site/create-from-template",
        data: serializedData,
        host
      }),
      data: serializedData,
      transformResponse: fromRes
    };
    return metadata;
  }
  __createMetaSiteFromTemplate.fromReq = fromReq;
  __createMetaSiteFromTemplate.__isAmbassador = true;
  return __createMetaSiteFromTemplate;
}
function getUrl(payload) {
  var _a = serializer(_getUrlRequest, {}), toReq = _a.toJSON, fromReq = _a.fromJSON;
  var fromRes = serializer(_getUrlResponse, {}).fromJSON;
  function __getUrl(_a2) {
    var host = _a2.host;
    var serializedData = toReq(payload);
    var metadata = {
      entityFqdn: "wix.metasite.api.v1.meta_site",
      method: "GET",
      methodFqn: "com.wixpress.metasite.api.v1.MetaSiteReadApi.GetUrl",
      url: resolveComWixpressMetasiteApiV1MetaSiteReadApiUrl({
        protoPath: "/v1/meta-site/get-url",
        data: serializedData,
        host
      }),
      params: toURLSearchParams(serializedData),
      transformResponse: fromRes,
      fallback: [
        {
          method: "GET",
          url: resolveComWixpressMetasiteApiV1MetaSiteReadApiUrl({
            protoPath: "/v1/meta-site/get-url",
            data: serializedData,
            host
          }),
          params: toURLSearchParams(serializedData)
        }
      ]
    };
    return metadata;
  }
  __getUrl.fromReq = fromReq;
  __getUrl.__isAmbassador = true;
  return __getUrl;
}

// ../../node_modules/@wix/ambassador-metasite-api-v1-meta-site/build/es/types.impl.js
init_esm_shims();
var State;
(function(State2) {
  State2["UNKNOWN"] = "UNKNOWN";
  State2["ENABLED"] = "ENABLED";
  State2["DISABLED"] = "DISABLED";
  State2["TEMPLATE"] = "TEMPLATE";
  State2["PENDING"] = "PENDING";
})(State || (State = {}));
var Namespace;
(function(Namespace2) {
  Namespace2["UNKNOWN_NAMESPACE"] = "UNKNOWN_NAMESPACE";
  Namespace2["WIX"] = "WIX";
  Namespace2["SHOUT_OUT"] = "SHOUT_OUT";
  Namespace2["ALBUMS"] = "ALBUMS";
  Namespace2["WIX_STORES_TEST_DRIVE"] = "WIX_STORES_TEST_DRIVE";
  Namespace2["HOTELS"] = "HOTELS";
  Namespace2["CLUBS"] = "CLUBS";
  Namespace2["ONBOARDING_DRAFT"] = "ONBOARDING_DRAFT";
  Namespace2["DEV_SITE"] = "DEV_SITE";
  Namespace2["LOGOS"] = "LOGOS";
  Namespace2["VIDEO_MAKER"] = "VIDEO_MAKER";
  Namespace2["PARTNER_DASHBOARD"] = "PARTNER_DASHBOARD";
  Namespace2["DEV_CENTER_COMPANY"] = "DEV_CENTER_COMPANY";
  Namespace2["HTML_DRAFT"] = "HTML_DRAFT";
  Namespace2["SITELESS_BUSINESS"] = "SITELESS_BUSINESS";
  Namespace2["CREATOR_ECONOMY"] = "CREATOR_ECONOMY";
  Namespace2["DASHBOARD_FIRST"] = "DASHBOARD_FIRST";
  Namespace2["ANYWHERE"] = "ANYWHERE";
  Namespace2["HEADLESS"] = "HEADLESS";
  Namespace2["ACCOUNT_MASTER_CMS"] = "ACCOUNT_MASTER_CMS";
  Namespace2["RISE"] = "RISE";
  Namespace2["BRANDED_FIRST"] = "BRANDED_FIRST";
  Namespace2["NOWNIA"] = "NOWNIA";
  Namespace2["UGC_TEMPLATE"] = "UGC_TEMPLATE";
  Namespace2["CODUX"] = "CODUX";
  Namespace2["MEDIA_DESIGN_CREATOR"] = "MEDIA_DESIGN_CREATOR";
  Namespace2["SHARED_BLOG_ENTERPRISE"] = "SHARED_BLOG_ENTERPRISE";
  Namespace2["STANDALONE_FORMS"] = "STANDALONE_FORMS";
  Namespace2["STANDALONE_EVENTS"] = "STANDALONE_EVENTS";
  Namespace2["MIMIR"] = "MIMIR";
  Namespace2["TWINS"] = "TWINS";
  Namespace2["NANO"] = "NANO";
})(Namespace || (Namespace = {}));
var DocumentType;
(function(DocumentType2) {
  DocumentType2["UNKNOWN_DOCUMENT_TYPE"] = "UNKNOWN_DOCUMENT_TYPE";
  DocumentType2["UGC"] = "UGC";
  DocumentType2["TEMPLATE"] = "TEMPLATE";
  DocumentType2["WIX_SITE"] = "WIX_SITE";
})(DocumentType || (DocumentType = {}));
var PremiumFeature;
(function(PremiumFeature2) {
  PremiumFeature2["UNKNOWN_PREMIUM_FEATURE"] = "UNKNOWN_PREMIUM_FEATURE";
  PremiumFeature2["SHOW_WIX_WHILE_LOADING"] = "SHOW_WIX_WHILE_LOADING";
  PremiumFeature2["ADS_FREE"] = "ADS_FREE";
  PremiumFeature2["HAS_ECOMMERCE"] = "HAS_ECOMMERCE";
  PremiumFeature2["HAS_DOMAIN"] = "HAS_DOMAIN";
  PremiumFeature2["ALWAYS_SHOW_FOOTER"] = "ALWAYS_SHOW_FOOTER";
  PremiumFeature2["NO_ADS_IN_SOCIAL_SITES"] = "NO_ADS_IN_SOCIAL_SITES";
})(PremiumFeature || (PremiumFeature = {}));
var ApplicationType;
(function(ApplicationType2) {
  ApplicationType2["UNKNOWN_APPLICATION_TYPE"] = "UNKNOWN_APPLICATION_TYPE";
  ApplicationType2["FLASH"] = "FLASH";
  ApplicationType2["FLASH_FACEBOOK"] = "FLASH_FACEBOOK";
  ApplicationType2["FLASH_WIDGET"] = "FLASH_WIDGET";
  ApplicationType2["FLASH_BANNER"] = "FLASH_BANNER";
  ApplicationType2["HTML_MOBILE"] = "HTML_MOBILE";
  ApplicationType2["HTML_WEB"] = "HTML_WEB";
  ApplicationType2["HTML_FACEBOOK"] = "HTML_FACEBOOK";
  ApplicationType2["BLOG"] = "BLOG";
  ApplicationType2["WIX_LISTS"] = "WIX_LISTS";
  ApplicationType2["STATIC_MOUNT"] = "STATIC_MOUNT";
  ApplicationType2["STATIC_MOUNT_REDIRECT"] = "STATIC_MOUNT_REDIRECT";
  ApplicationType2["AMP_BLOG"] = "AMP_BLOG";
  ApplicationType2["COMMUNITIES_AMP_BLOG"] = "COMMUNITIES_AMP_BLOG";
  ApplicationType2["HTML_ANYWHERE"] = "HTML_ANYWHERE";
  ApplicationType2["HOPP"] = "HOPP";
})(ApplicationType || (ApplicationType = {}));
var Compatibility;
(function(Compatibility2) {
  Compatibility2["UNKNOWN_COMPATIBILITY"] = "UNKNOWN_COMPATIBILITY";
  Compatibility2["WEB"] = "WEB";
  Compatibility2["MOBILE"] = "MOBILE";
  Compatibility2["ALL"] = "ALL";
})(Compatibility || (Compatibility = {}));
var ApiState;
(function(ApiState2) {
  ApiState2["UNKNOWN_STATE"] = "UNKNOWN_STATE";
  ApiState2["TEMPLATE"] = "TEMPLATE";
  ApiState2["STUB"] = "STUB";
  ApiState2["INITIALIZED"] = "INITIALIZED";
})(ApiState || (ApiState = {}));
var Kind;
(function(Kind2) {
  Kind2["OPEN"] = "OPEN";
  Kind2["CLOSED"] = "CLOSED";
  Kind2["APPLY_FOR_MEMBERSHIP"] = "APPLY_FOR_MEMBERSHIP";
})(Kind || (Kind = {}));
var FormFace;
(function(FormFace2) {
  FormFace2["REGISTER"] = "REGISTER";
  FormFace2["LOGIN"] = "LOGIN";
})(FormFace || (FormFace = {}));
var CollectionExposure;
(function(CollectionExposure2) {
  CollectionExposure2["PUBLIC"] = "PUBLIC";
  CollectionExposure2["WIX_INTERNAL"] = "WIX_INTERNAL";
})(CollectionExposure || (CollectionExposure = {}));
var HttpsPolicy;
(function(HttpsPolicy2) {
  HttpsPolicy2["UNKNOWN_HTTPS_POLICY"] = "UNKNOWN_HTTPS_POLICY";
  HttpsPolicy2["DISALLOW"] = "DISALLOW";
  HttpsPolicy2["ALLOW"] = "ALLOW";
  HttpsPolicy2["ENFORCE"] = "ENFORCE";
})(HttpsPolicy || (HttpsPolicy = {}));
var Flag;
(function(Flag2) {
  Flag2["UNKNOWN_FLAG"] = "UNKNOWN_FLAG";
  Flag2["URL_MIGRATED"] = "URL_MIGRATED";
  Flag2["USE_HTTPS"] = "USE_HTTPS";
  Flag2["EDITOR_X"] = "EDITOR_X";
  Flag2["BLOCKED"] = "BLOCKED";
  Flag2["DONT_USE_DEFAULT_ROUTING"] = "DONT_USE_DEFAULT_ROUTING";
  Flag2["STUDIO"] = "STUDIO";
  Flag2["CRITICAL_ASSET"] = "CRITICAL_ASSET";
  Flag2["ODEDITOR"] = "ODEDITOR";
  Flag2["PICASSO"] = "PICASSO";
})(Flag || (Flag = {}));
var PendingReason;
(function(PendingReason2) {
  PendingReason2["UNKNOWN"] = "UNKNOWN";
  PendingReason2["PREMIUM"] = "PREMIUM";
  PendingReason2["APP_MARKET"] = "APP_MARKET";
})(PendingReason || (PendingReason = {}));
var ResolutionMethod;
(function(ResolutionMethod2) {
  ResolutionMethod2["QUERY_PARAM"] = "QUERY_PARAM";
  ResolutionMethod2["SUBDOMAIN"] = "SUBDOMAIN";
  ResolutionMethod2["SUBDIRECTORY"] = "SUBDIRECTORY";
})(ResolutionMethod || (ResolutionMethod = {}));
var DeleteStatus;
(function(DeleteStatus2) {
  DeleteStatus2["UNKNOWN"] = "UNKNOWN";
  DeleteStatus2["TRASH"] = "TRASH";
  DeleteStatus2["DELETED"] = "DELETED";
  DeleteStatus2["PENDING_PURGE"] = "PENDING_PURGE";
  DeleteStatus2["PURGED_EXTERNALLY"] = "PURGED_EXTERNALLY";
})(DeleteStatus || (DeleteStatus = {}));
var Context;
(function(Context2) {
  Context2["UNKNOWN"] = "UNKNOWN";
  Context2["CREATE"] = "CREATE";
  Context2["UPDATE"] = "UPDATE";
  Context2["HARD_DELETE"] = "HARD_DELETE";
  Context2["ARCHIVE"] = "ARCHIVE";
  Context2["RESTORE"] = "RESTORE";
  Context2["UPDATE_DELETED"] = "UPDATE_DELETED";
  Context2["PURGED_EXTERNALLY"] = "PURGED_EXTERNALLY";
})(Context || (Context = {}));
var SiteCreatedContext;
(function(SiteCreatedContext2) {
  SiteCreatedContext2["OTHER"] = "OTHER";
  SiteCreatedContext2["FROM_TEMPLATE"] = "FROM_TEMPLATE";
  SiteCreatedContext2["DUPLICATE_BY_SITE_TRANSFER"] = "DUPLICATE_BY_SITE_TRANSFER";
  SiteCreatedContext2["DUPLICATE"] = "DUPLICATE";
  SiteCreatedContext2["OLD_SITE_TRANSFER"] = "OLD_SITE_TRANSFER";
  SiteCreatedContext2["FLASH"] = "FLASH";
})(SiteCreatedContext || (SiteCreatedContext = {}));
var AssetState;
(function(AssetState2) {
  AssetState2["UNKNOWN"] = "UNKNOWN";
  AssetState2["ENABLED"] = "ENABLED";
  AssetState2["DISABLED"] = "DISABLED";
  AssetState2["PENDING"] = "PENDING";
  AssetState2["DEMO"] = "DEMO";
})(AssetState || (AssetState = {}));
var PlacementType;
(function(PlacementType2) {
  PlacementType2["BEFORE"] = "BEFORE";
  PlacementType2["AFTER"] = "AFTER";
  PlacementType2["REPLACE"] = "REPLACE";
})(PlacementType || (PlacementType = {}));
var DayOfWeek;
(function(DayOfWeek2) {
  DayOfWeek2["MONDAY"] = "MONDAY";
  DayOfWeek2["TUESDAY"] = "TUESDAY";
  DayOfWeek2["WEDNESDAY"] = "WEDNESDAY";
  DayOfWeek2["THURSDAY"] = "THURSDAY";
  DayOfWeek2["FRIDAY"] = "FRIDAY";
  DayOfWeek2["SATURDAY"] = "SATURDAY";
  DayOfWeek2["SUNDAY"] = "SUNDAY";
})(DayOfWeek || (DayOfWeek = {}));
var V4ResolutionMethod;
(function(V4ResolutionMethod2) {
  V4ResolutionMethod2["QUERY_PARAM"] = "QUERY_PARAM";
  V4ResolutionMethod2["SUBDOMAIN"] = "SUBDOMAIN";
  V4ResolutionMethod2["SUBDIRECTORY"] = "SUBDIRECTORY";
})(V4ResolutionMethod || (V4ResolutionMethod = {}));
var WebhookIdentityType;
(function(WebhookIdentityType2) {
  WebhookIdentityType2["UNKNOWN"] = "UNKNOWN";
  WebhookIdentityType2["ANONYMOUS_VISITOR"] = "ANONYMOUS_VISITOR";
  WebhookIdentityType2["MEMBER"] = "MEMBER";
  WebhookIdentityType2["WIX_USER"] = "WIX_USER";
  WebhookIdentityType2["APP"] = "APP";
})(WebhookIdentityType || (WebhookIdentityType = {}));
var Cause;
(function(Cause2) {
  Cause2["EMPTY"] = "EMPTY";
  Cause2["NAMESPACE_LIMIT_REACHED"] = "NAMESPACE_LIMIT_REACHED";
  Cause2["AUTOMATION_USER_LIMIT_REACHED"] = "AUTOMATION_USER_LIMIT_REACHED";
  Cause2["WIX_EMPLOYEE_LIMIT_REACHED"] = "WIX_EMPLOYEE_LIMIT_REACHED";
})(Cause || (Cause = {}));
var UrlFilter;
(function(UrlFilter2) {
  UrlFilter2["NO_URL_TYPE_FILTER"] = "NO_URL_TYPE_FILTER";
  UrlFilter2["FREE"] = "FREE";
})(UrlFilter || (UrlFilter = {}));
var MigrationResult;
(function(MigrationResult2) {
  MigrationResult2["UNKNOWN_FORMAT"] = "UNKNOWN_FORMAT";
  MigrationResult2["OK"] = "OK";
  MigrationResult2["SKIP"] = "SKIP";
})(MigrationResult || (MigrationResult = {}));
var MigrateEmbeddedServiceToTpaResponseMigrationResult;
(function(MigrateEmbeddedServiceToTpaResponseMigrationResult2) {
  MigrateEmbeddedServiceToTpaResponseMigrationResult2["UNKNOWN_FORMAT"] = "UNKNOWN_FORMAT";
  MigrateEmbeddedServiceToTpaResponseMigrationResult2["OK"] = "OK";
  MigrateEmbeddedServiceToTpaResponseMigrationResult2["SKIP"] = "SKIP";
})(MigrateEmbeddedServiceToTpaResponseMigrationResult || (MigrateEmbeddedServiceToTpaResponseMigrationResult = {}));

// ../../node_modules/@wix/ambassador-document-management-document-store-v1-transaction/build/es/http.impl.js
init_esm_shims();
var _distributeRequest = {};
var _distributeResponse = {};
function resolveComWixpressEditorApiDocumentStoreServiceUrl(opts) {
  var domainToMappings = {
    "api._api_base_domain_": [
      {
        srcPath: "/editor-document-store",
        destPath: ""
      }
    ],
    "www._base_domain_": [
      {
        srcPath: "/_api/editor-document-store",
        destPath: ""
      }
    ],
    "editor._base_domain_": [
      {
        srcPath: "/_api/editor-document-store",
        destPath: ""
      }
    ],
    "blocks._base_domain_": [
      {
        srcPath: "/_api/editor-document-store",
        destPath: ""
      }
    ],
    "create.editorx": [
      {
        srcPath: "/_api/editor-document-store",
        destPath: ""
      }
    ]
  };
  return resolveUrl(Object.assign(opts, { domainToMappings }));
}
function distribute(payload) {
  var _a = serializer(_distributeRequest, {}), toReq = _a.toJSON, fromReq = _a.fromJSON;
  var fromRes = serializer(_distributeResponse, {}).fromJSON;
  function __distribute(_a2) {
    var host = _a2.host;
    var serializedData = toReq(payload);
    var metadata = {
      entityFqdn: "wix.document_management.document_store.v1.transaction",
      method: "POST",
      methodFqn: "com.wixpress.editor.api.DocumentStoreService.Distribute",
      migrationOptions: {
        optInTransformResponse: true
      },
      url: resolveComWixpressEditorApiDocumentStoreServiceUrl({
        protoPath: "/v1/distribute",
        data: serializedData,
        host
      }),
      data: serializedData,
      transformResponse: fromRes
    };
    return metadata;
  }
  __distribute.fromReq = fromReq;
  __distribute.__isAmbassador = true;
  return __distribute;
}

// ../../node_modules/@wix/ambassador-siteproperties-v4-properties/es/build/http.impl.js
init_esm_shims();
var _address = { coordinates: "_geoCoordinates" };
var _geoCoordinates = { latitude: "DOUBLE", longitude: "DOUBLE" };
var _properties = { address: "_address" };
var _propertiesUpdateRequest = {
  fields: "google.protobuf.FieldMask",
  properties: "_properties"
};
var _propertiesUpdateResponse = {};
function resolveComWixpressSitepropertiesApiV4SitePropertiesV4Url(opts) {
  var domainToMappings = {
    "api._api_base_domain_": [
      {
        srcPath: "/site-properties-service",
        destPath: ""
      }
    ],
    "www._base_domain_": [
      {
        srcPath: "/_api/site-properties-service",
        destPath: ""
      }
    ],
    "editor._base_domain_": [
      {
        srcPath: "/_api/site-properties-service",
        destPath: ""
      }
    ],
    "blocks._base_domain_": [
      {
        srcPath: "/_api/site-properties-service",
        destPath: ""
      }
    ],
    "create.editorx": [
      {
        srcPath: "/_api/site-properties-service",
        destPath: ""
      }
    ],
    "manage._base_domain_": [
      {
        srcPath: "/_api/site-properties-service",
        destPath: ""
      }
    ],
    "www.wixapis.com": [
      {
        srcPath: "/site-properties/v4/properties",
        destPath: "/v4/properties"
      },
      {
        srcPath: "/site-properties",
        destPath: ""
      }
    ],
    "platform.rise.ai": [
      {
        srcPath: "/v4/properties",
        destPath: "/v4/properties"
      }
    ],
    "vibe._base_domain_": [
      {
        srcPath: "/_api/site-properties-service",
        destPath: ""
      }
    ],
    "*.dev.wix-code.com": [
      {
        srcPath: "/site-properties/v4/properties",
        destPath: ""
      }
    ],
    "manage.base44.com": [
      {
        srcPath: "/_api/site-properties-service",
        destPath: ""
      }
    ],
    "payments.base44.com": [
      {
        srcPath: "/_api/site-properties-service",
        destPath: ""
      }
    ]
  };
  return resolveUrl(Object.assign(opts, { domainToMappings }));
}
function update(payload) {
  var _a = serializer(_propertiesUpdateRequest, { _address, _geoCoordinates, _properties }), toReq = _a.toJSON, fromReq = _a.fromJSON;
  var fromRes = serializer(_propertiesUpdateResponse, {}).fromJSON;
  function __update(_a2) {
    var host = _a2.host;
    var serializedData = toReq(payload);
    var metadata = {
      entityFqdn: "wix.siteproperties.v4.properties",
      method: "PATCH",
      methodFqn: "com.wixpress.siteproperties.api.v4.SitePropertiesV4.Update",
      migrationOptions: {
        optInTransformResponse: true
      },
      url: resolveComWixpressSitepropertiesApiV4SitePropertiesV4Url({
        protoPath: "/properties",
        data: serializedData,
        host
      }),
      data: serializedData,
      transformResponse: fromRes
    };
    return metadata;
  }
  __update.fromReq = fromReq;
  __update.__isAmbassador = true;
  return __update;
}

// ../metasite-manager-client/src/schemas.ts
init_esm_shims();
var clientSpecMapSchema = external_exports.record(
  external_exports.object({
    appDefinitionId: external_exports.string().optional(),
    permissions: external_exports.object({ revoked: external_exports.boolean() }).optional(),
    instanceId: external_exports.string().optional()
  })
);
var createMetaSiteFromTemplateSchema = external_exports.object({
  metaSite: external_exports.object({
    metaSiteId: external_exports.string()
  })
});
var getMetaSiteUrlSchema = external_exports.object({
  url: external_exports.string(),
  published: external_exports.boolean()
});

// ../metasite-manager-client/src/metasite-manager-client.ts
var MetasiteManagerClient = class {
  constructor(httpClient) {
    this.httpClient = httpClient;
  }
  getClientSpecMap = async (metaSiteId) => {
    try {
      const { data } = await this.httpClient.request({
        url: `/_api/msm/v1/meta-site/editor-client-spec-map/${metaSiteId}`
      });
      return clientSpecMapSchema.parse(data);
    } catch (e) {
      throw new CliError({
        code: CliErrorCode.FailedToGetClientSpecMap(),
        cause: e
      });
    }
  };
  createMetaSiteFromTemplate = async (request) => {
    try {
      const { data } = await this.httpClient.request(
        createMetaSiteFromTemplate(request)
      );
      return createMetaSiteFromTemplateSchema.parse(data).metaSite;
    } catch (e) {
      throw new CliError({
        code: CliErrorCode.FailedToCreateMetaSiteFromTemplate(),
        cause: e
      });
    }
  };
  getSiteInstalledApps = async (metaSiteId) => {
    try {
      const clientSpecMap = await this.getClientSpecMap(metaSiteId);
      return Object.values(clientSpecMap).filter((spec) => spec.appDefinitionId && !spec.permissions?.revoked).map((spec) => spec.appDefinitionId);
    } catch (e) {
      throw new CliError({
        code: CliErrorCode.FailedToGetSiteInstalledApps(),
        cause: e
      });
    }
  };
  getInstalledAppInstanceId = async ({
    metaSiteId,
    appId
  }) => {
    try {
      const clientSpecMap = await this.getClientSpecMap(metaSiteId);
      const installedApp = Object.values(clientSpecMap).find(
        (spec) => spec.appDefinitionId === appId
      );
      return installedApp?.instanceId ?? "";
    } catch (e) {
      throw new CliError({
        code: CliErrorCode.FailedToGetSiteInstalledAppInstanceId(),
        cause: e
      });
    }
  };
  updateExternalSiteUrl = async (siteUrl) => {
    try {
      await this.httpClient.request(
        update({
          properties: { externalSiteUrl: siteUrl },
          fields: ["externalSiteUrl"]
        })
      );
    } catch (e) {
      throw new CliError({
        code: CliErrorCode.FailedToUpdateExternalSiteUrl(),
        cause: e
      });
    }
  };
  getMetaSiteUrl = async () => {
    try {
      const { data } = await this.httpClient.request(
        getUrl({ urlFilter: UrlFilter.NO_URL_TYPE_FILTER })
      );
      return getMetaSiteUrlSchema.parse(data);
    } catch (e) {
      throw new CliError({
        code: CliErrorCode.FailedToGetUrl(),
        cause: e
      });
    }
  };
  distributeClientUpdate = async (appId) => {
    try {
      await this.httpClient.request(
        distribute({
          payloads: [
            {
              id: appId,
              messageType: "MANIFEST_UPDATE",
              data: {
                appId
              }
            }
          ],
          branchId: "00000000-0000-0000-0000-000000000000"
        })
      );
    } catch (e) {
      throw new CliError({
        code: CliErrorCode.FailedToDistributeClientManifestUpdate(),
        cause: e
      });
    }
  };
};

// ../metasite-manager-client/src/useMetasiteManagerClient.ts
function useMetasiteManagerClient({
  siteId
} = {}) {
  const httpClient = useHttpClient({ type: "general", siteId });
  const client = (0, import_react.useMemo)(
    () => new MetasiteManagerClient(httpClient),
    [httpClient]
  );
  return usePanoramaMethodLogger(client);
}

// ../metasite-manager-client/src/index.ts
init_esm_shims();

// ../cli-astro-commands/src/bi-app/useWixCliAppBi.ts
init_esm_shims();
var import_react2 = __toESM(require_react(), 1);

// ../cli-astro-commands/src/bi-app/events.ts
init_esm_shims();
var wixCliAppBiEvents = (biLogger) => ({
  cliAction: ({
    questionKey,
    question,
    action,
    key,
    additionalInfo
  }) => {
    void biLogger.report(
      wixCliAction({
        questionKey,
        question,
        action,
        key,
        additionalInfo: JSON.stringify(additionalInfo)
      })
    );
  },
  cliStepBack: ({
    additionalInfo
  }) => {
    void biLogger.report(
      wixCliAction({
        action: "goToPreviousStep",
        key: "Esc",
        additionalInfo: JSON.stringify(additionalInfo)
      })
    );
  },
  cliFlowStepAnswered: ({
    question,
    questionKey,
    answer,
    additionalInfo
  }) => {
    void biLogger.report(
      wixCliAppFlowStepsAnswers({
        questionKey,
        question,
        answer,
        additionalInfo: JSON.stringify(additionalInfo)
      })
    );
  },
  fileUpload({
    provider,
    fileCount,
    totalSizeInKb,
    cliVersion
  }) {
    const startTimestamp = Date.now();
    void biLogger.report(
      wixCliAppFlowFileUploadStarted({
        timestampMs: startTimestamp,
        hostingProvider: provider,
        numFiles: fileCount,
        fileSizeCompressed: 0,
        fileSizeNotCompressed: totalSizeInKb,
        cliVersion
      })
    );
    return {
      finished() {
        void biLogger.report(
          wixCliAppFlowUploadEnded({
            duration: Date.now() - startTimestamp
          })
        );
      }
    };
  },
  cliDeployment: ({
    appId,
    deploymentId,
    files
  }) => {
    const startTimestamp = Date.now();
    const fileDetails = files ? files.filter((f) => f.filePath).map((file) => ({
      filePath: file.filePath,
      fileSizeKb: file.content ? file.content.length / 1024 : 0
    })) : [];
    return {
      finish: ({
        isSuccess,
        failureReason
      }) => {
        void biLogger.report(
          wixCliAppsFlowDeploymentStatusSrc11Evid5232({
            isSuccess,
            failureReason,
            filesDetails: JSON.stringify(fileDetails),
            filesSize: Math.round(
              fileDetails.reduce((acc, { fileSizeKb }) => acc + fileSizeKb, 0)
            ),
            uploadSource: "backend",
            appId,
            deploymentId,
            filesUploadTime: Date.now() - startTimestamp
          })
        );
      }
    };
  }
});

// ../cli-astro-commands/src/bi-app/useWixCliAppBi.ts
function useWixCliAppBi() {
  const biLogger = useBiLogger();
  return (0, import_react2.useMemo)(() => wixCliAppBiEvents(biLogger), [biLogger]);
}

// ../cli-astro-commands/src/bi-app/index.ts
init_esm_shims();

export {
  useMetasiteManagerClient,
  useWixCliAppBi
};
//# sourceMappingURL=chunk-UU7YVCK5.js.map