converse.js
Version:
Browser based XMPP chat client
1,360 lines (1,257 loc) • 3.86 MB
JavaScript
/******/ (() => { // webpackBootstrap
/******/ var __webpack_modules__ = ({
/***/ 33:
/***/ ((module, __webpack_exports__, __webpack_require__) => {
"use strict";
/* harmony export */ __webpack_require__.d(__webpack_exports__, {
/* harmony export */ A: () => (__WEBPACK_DEFAULT_EXPORT__)
/* harmony export */ });
/* harmony import */ var _node_modules_css_loader_dist_runtime_sourceMaps_js__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(5307);
/* harmony import */ var _node_modules_css_loader_dist_runtime_sourceMaps_js__WEBPACK_IMPORTED_MODULE_0___default = /*#__PURE__*/__webpack_require__.n(_node_modules_css_loader_dist_runtime_sourceMaps_js__WEBPACK_IMPORTED_MODULE_0__);
/* harmony import */ var _node_modules_css_loader_dist_runtime_api_js__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(3241);
/* harmony import */ var _node_modules_css_loader_dist_runtime_api_js__WEBPACK_IMPORTED_MODULE_1___default = /*#__PURE__*/__webpack_require__.n(_node_modules_css_loader_dist_runtime_api_js__WEBPACK_IMPORTED_MODULE_1__);
// Imports
var ___CSS_LOADER_EXPORT___ = _node_modules_css_loader_dist_runtime_api_js__WEBPACK_IMPORTED_MODULE_1___default()((_node_modules_css_loader_dist_runtime_sourceMaps_js__WEBPACK_IMPORTED_MODULE_0___default()));
// Module
___CSS_LOADER_EXPORT___.push([module.id, ``, "",{"version":3,"sources":[],"names":[],"mappings":"","sourceRoot":""}]);
// Exports
/* harmony default export */ const __WEBPACK_DEFAULT_EXPORT__ = (___CSS_LOADER_EXPORT___);
/***/ }),
/***/ 134:
/***/ ((module, __unused_webpack_exports, __webpack_require__) => {
var regenerator = __webpack_require__(4776);
var regeneratorAsyncIterator = __webpack_require__(3884);
function _regeneratorAsyncGen(r, e, t, o, n) {
return new regeneratorAsyncIterator(regenerator().w(r, e, t, o), n || Promise);
}
module.exports = _regeneratorAsyncGen, module.exports.__esModule = true, module.exports["default"] = module.exports;
/***/ }),
/***/ 152:
/***/ ((module) => {
function _regeneratorKeys(e) {
var n = Object(e), r = [];
for(var t in n)r.unshift(t);
return function e() {
for(; r.length;)if ((t = r.pop()) in n) return e.value = t, e.done = !1, e;
return e.done = !0, e;
};
}
module.exports = _regeneratorKeys, module.exports.__esModule = true, module.exports["default"] = module.exports;
/***/ }),
/***/ 182:
/***/ ((module, __unused_webpack_exports, __webpack_require__) => {
var toPropertyKey = __webpack_require__(5361);
function _defineProperty(e, r, t) {
return (r = toPropertyKey(r)) in e ? Object.defineProperty(e, r, {
value: t,
enumerable: !0,
configurable: !0,
writable: !0
}) : e[r] = t, e;
}
module.exports = _defineProperty, module.exports.__esModule = true, module.exports["default"] = module.exports;
/***/ }),
/***/ 216:
/***/ ((__unused_webpack_module, __webpack_exports__, __webpack_require__) => {
"use strict";
// ESM COMPAT FLAG
__webpack_require__.r(__webpack_exports__);
// EXPORTS
__webpack_require__.d(__webpack_exports__, {
"default": () => (/* binding */ src)
});
// NAMESPACE OBJECT: ./src/headless/utils/object.js
var object_namespaceObject = {};
__webpack_require__.r(object_namespaceObject);
__webpack_require__.d(object_namespaceObject, {
isError: () => (isError),
isErrorObject: () => (isErrorObject),
isFunction: () => (object_isFunction),
isPersistableModel: () => (isPersistableModel),
isUndefined: () => (isUndefined),
merge: () => (merge)
});
// NAMESPACE OBJECT: ./src/headless/utils/session.js
var session_namespaceObject = {};
__webpack_require__.r(session_namespaceObject);
__webpack_require__.d(session_namespaceObject, {
clearSession: () => (clearSession),
getUnloadEvent: () => (getUnloadEvent),
isTestEnv: () => (isTestEnv),
isUniView: () => (isUniView),
replacePromise: () => (replacePromise),
shouldClearCache: () => (shouldClearCache),
tearDown: () => (tearDown)
});
// NAMESPACE OBJECT: ./src/headless/shared/constants.js
var shared_constants_namespaceObject = {};
__webpack_require__.r(shared_constants_namespaceObject);
__webpack_require__.d(shared_constants_namespaceObject, {
ACTIVE: () => (ACTIVE),
ANONYMOUS: () => (ANONYMOUS),
BOSH_WAIT: () => (BOSH_WAIT),
CHATROOMS_TYPE: () => (CHATROOMS_TYPE),
CHAT_STATES: () => (CHAT_STATES),
CLOSED: () => (CLOSED),
COMPOSING: () => (COMPOSING),
CONNECTION_STATUS: () => (CONNECTION_STATUS),
CONTROLBOX_TYPE: () => (CONTROLBOX_TYPE),
CORE_PLUGINS: () => (CORE_PLUGINS),
EXTERNAL: () => (EXTERNAL),
FAILURE: () => (FAILURE),
GONE: () => (GONE),
HEADLINES_TYPE: () => (HEADLINES_TYPE),
INACTIVE: () => (INACTIVE),
KEYCODES: () => (KEYCODES),
LOGIN: () => (LOGIN),
LOGOUT: () => (LOGOUT),
MARKER_TYPES: () => (MARKER_TYPES),
METADATA_ATTRIBUTES: () => (METADATA_ATTRIBUTES),
OPENED: () => (OPENED),
PAUSED: () => (PAUSED),
PREBIND: () => (PREBIND),
PRES_SHOW_VALUES: () => (PRES_SHOW_VALUES),
PRES_TYPE_VALUES: () => (PRES_TYPE_VALUES),
PRIVATE_CHAT_TYPE: () => (PRIVATE_CHAT_TYPE),
STATUS_WEIGHTS: () => (STATUS_WEIGHTS),
SUCCESS: () => (SUCCESS),
VERSION_NAME: () => (VERSION_NAME),
XFORM_TYPE_MAP: () => (XFORM_TYPE_MAP),
XFORM_VALIDATE_TYPE_MAP: () => (XFORM_VALIDATE_TYPE_MAP)
});
// NAMESPACE OBJECT: ./src/headless/utils/storage.js
var utils_storage_namespaceObject = {};
__webpack_require__.r(utils_storage_namespaceObject);
__webpack_require__.d(utils_storage_namespaceObject, {
createStore: () => (createStore),
getDefaultStore: () => (getDefaultStore),
initStorage: () => (initStorage)
});
// NAMESPACE OBJECT: ./src/headless/utils/jid.js
var jid_namespaceObject = {};
__webpack_require__.r(jid_namespaceObject);
__webpack_require__.d(jid_namespaceObject, {
getJIDFromURI: () => (getJIDFromURI),
isOwnJID: () => (isOwnJID),
isSameBareJID: () => (isSameBareJID),
isSameDomain: () => (isSameDomain),
isValidJID: () => (isValidJID),
isValidMUCJID: () => (isValidMUCJID)
});
// NAMESPACE OBJECT: ./src/headless/utils/init.js
var init_namespaceObject = {};
__webpack_require__.r(init_namespaceObject);
__webpack_require__.d(init_namespaceObject, {
attemptNonPreboundSession: () => (attemptNonPreboundSession),
cleanup: () => (cleanup),
initClientConfig: () => (initClientConfig),
initPersistentStorage: () => (initPersistentStorage),
initPlugins: () => (initPlugins),
initSession: () => (initSession),
initSessionStorage: () => (initSessionStorage),
registerGlobalEventHandlers: () => (registerGlobalEventHandlers),
safeSave: () => (safeSave),
savedLoginInfo: () => (savedLoginInfo),
setUserJID: () => (setUserJID)
});
// NAMESPACE OBJECT: ./src/headless/utils/promise.js
var promise_namespaceObject = {};
__webpack_require__.r(promise_namespaceObject);
__webpack_require__.d(promise_namespaceObject, {
debounce: () => (promise_debounce),
getOpenPromise: () => (getOpenPromise),
waitUntil: () => (waitUntil)
});
// NAMESPACE OBJECT: ./src/headless/shared/errors.js
var errors_namespaceObject = {};
__webpack_require__.r(errors_namespaceObject);
__webpack_require__.d(errors_namespaceObject, {
BadRequestError: () => (BadRequestError),
ConflictError: () => (ConflictError),
FeatureNotImplementedError: () => (FeatureNotImplementedError),
ForbiddenError: () => (ForbiddenError),
GoneError: () => (GoneError),
InternalServerError: () => (InternalServerError),
ItemNotFoundError: () => (ItemNotFoundError),
JIDMalformedError: () => (JIDMalformedError),
MethodNotImplementedError: () => (MethodNotImplementedError),
NotAcceptableError: () => (NotAcceptableError),
NotAllowedError: () => (NotAllowedError),
NotAuthorizedError: () => (NotAuthorizedError),
PaymentRequiredError: () => (PaymentRequiredError),
RecipientUnavailableError: () => (RecipientUnavailableError),
RedirectError: () => (RedirectError),
RegistrationRequiredError: () => (RegistrationRequiredError),
RemoteServerNotFoundError: () => (RemoteServerNotFoundError),
RemoteServerTimeoutError: () => (RemoteServerTimeoutError),
ResourceConstraintError: () => (ResourceConstraintError),
ServiceUnavailableError: () => (ServiceUnavailableError),
StanzaError: () => (StanzaError),
StanzaParseError: () => (StanzaParseError),
SubscriptionRequiredError: () => (SubscriptionRequiredError),
TimeoutError: () => (TimeoutError),
UndefinedConditionError: () => (UndefinedConditionError),
UnexpectedRequestError: () => (UnexpectedRequestError)
});
// NAMESPACE OBJECT: ./src/headless/utils/html.js
var html_namespaceObject = {};
__webpack_require__.r(html_namespaceObject);
__webpack_require__.d(html_namespaceObject, {
decodeHTMLEntities: () => (decodeHTMLEntities),
isElement: () => (html_isElement),
isTagEqual: () => (html_isTagEqual),
queryChildren: () => (queryChildren),
siblingIndex: () => (siblingIndex),
stringToElement: () => (stringToElement)
});
// NAMESPACE OBJECT: ./src/headless/utils/stanza.js
var stanza_namespaceObject = {};
__webpack_require__.r(stanza_namespaceObject);
__webpack_require__.d(stanza_namespaceObject, {
getAttributes: () => (getAttributes),
isErrorStanza: () => (isErrorStanza),
isForbiddenError: () => (isForbiddenError),
isServiceUnavailableError: () => (isServiceUnavailableError),
toStanza: () => (toStanza)
});
// NAMESPACE OBJECT: ./src/headless/utils/array.js
var array_namespaceObject = {};
__webpack_require__.r(array_namespaceObject);
__webpack_require__.d(array_namespaceObject, {
unique: () => (unique)
});
// NAMESPACE OBJECT: ./src/headless/utils/arraybuffer.js
var arraybuffer_namespaceObject = {};
__webpack_require__.r(arraybuffer_namespaceObject);
__webpack_require__.d(arraybuffer_namespaceObject, {
appendArrayBuffer: () => (appendArrayBuffer),
arrayBufferToBase64: () => (arrayBufferToBase64),
arrayBufferToHex: () => (arrayBufferToHex),
arrayBufferToString: () => (arrayBufferToString),
base64ToArrayBuffer: () => (base64ToArrayBuffer),
hexToArrayBuffer: () => (hexToArrayBuffer),
stringToArrayBuffer: () => (stringToArrayBuffer)
});
// NAMESPACE OBJECT: ./src/headless/utils/color.js
var color_namespaceObject = {};
__webpack_require__.r(color_namespaceObject);
__webpack_require__.d(color_namespaceObject, {
colorize: () => (colorize)
});
// NAMESPACE OBJECT: ./src/headless/utils/form.js
var form_namespaceObject = {};
__webpack_require__.r(form_namespaceObject);
__webpack_require__.d(form_namespaceObject, {
getCurrentWord: () => (getCurrentWord),
getSelectValues: () => (getSelectValues),
isMentionBoundary: () => (isMentionBoundary),
placeCaretAtEnd: () => (placeCaretAtEnd),
replaceCurrentWord: () => (replaceCurrentWord),
webForm2xForm: () => (webForm2xForm)
});
// NAMESPACE OBJECT: ./src/headless/utils/text.js
var text_namespaceObject = {};
__webpack_require__.r(text_namespaceObject);
__webpack_require__.d(text_namespaceObject, {
firstCharToUpperCase: () => (firstCharToUpperCase),
getLongestSubstring: () => (getLongestSubstring),
isString: () => (text_isString)
});
// NAMESPACE OBJECT: ./src/headless/utils/url.js
var url_namespaceObject = {};
__webpack_require__.r(url_namespaceObject);
__webpack_require__.d(url_namespaceObject, {
addMediaURLsOffset: () => (addMediaURLsOffset),
checkFileTypes: () => (checkFileTypes),
getHeaders: () => (getHeaders),
getMediaURLs: () => (getMediaURLs),
getMediaURLsMetadata: () => (getMediaURLsMetadata),
getMetadataForURL: () => (getMetadataForURL),
getURL: () => (getURL),
isAudioURL: () => (isAudioURL),
isEncryptedFileURL: () => (isEncryptedFileURL),
isGIFURL: () => (isGIFURL),
isImageURL: () => (isImageURL),
isURLWithImageExtension: () => (isURLWithImageExtension),
isValidURL: () => (isValidURL),
isVideoURL: () => (isVideoURL),
withinString: () => (withinString)
});
// NAMESPACE OBJECT: ./src/headless/plugins/muc/constants.js
var muc_constants_namespaceObject = {};
__webpack_require__.r(muc_constants_namespaceObject);
__webpack_require__.d(muc_constants_namespaceObject, {
ACTION_INFO_CODES: () => (ACTION_INFO_CODES),
ADMIN_COMMANDS: () => (ADMIN_COMMANDS),
AFFILIATIONS: () => (AFFILIATIONS),
AFFILIATION_CHANGES: () => (AFFILIATION_CHANGES),
AFFILIATION_CHANGES_LIST: () => (AFFILIATION_CHANGES_LIST),
DISCONNECT_CODES: () => (DISCONNECT_CODES),
INFO_CODES: () => (INFO_CODES),
MODERATOR_COMMANDS: () => (MODERATOR_COMMANDS),
MUC_NICK_CHANGED_CODE: () => (MUC_NICK_CHANGED_CODE),
MUC_ROLE_CHANGES: () => (MUC_ROLE_CHANGES),
MUC_ROLE_CHANGES_LIST: () => (MUC_ROLE_CHANGES_LIST),
MUC_ROLE_WEIGHTS: () => (MUC_ROLE_WEIGHTS),
MUC_TRAFFIC_STATES: () => (MUC_TRAFFIC_STATES),
MUC_TRAFFIC_STATES_LIST: () => (MUC_TRAFFIC_STATES_LIST),
NEW_NICK_CODES: () => (NEW_NICK_CODES),
OWNER_COMMANDS: () => (OWNER_COMMANDS),
ROLES: () => (ROLES),
ROOMSTATUS: () => (ROOMSTATUS),
ROOM_FEATURES: () => (ROOM_FEATURES),
STATUS_CODE_STANZAS: () => (STATUS_CODE_STANZAS),
VISITOR_COMMANDS: () => (VISITOR_COMMANDS)
});
// NAMESPACE OBJECT: ./src/utils/html.js
var utils_html_namespaceObject = {};
__webpack_require__.r(utils_html_namespaceObject);
__webpack_require__.d(utils_html_namespaceObject, {
addClass: () => (addClass),
ancestor: () => (ancestor),
"default": () => (utils_html),
getFileName: () => (getFileName),
getHyperlinkTemplate: () => (getHyperlinkTemplate),
getNameAndValue: () => (getNameAndValue),
getOuterWidth: () => (getOuterWidth),
getRootElement: () => (getRootElement),
hasClass: () => (hasClass),
removeClass: () => (removeClass),
removeElement: () => (removeElement),
slideIn: () => (slideIn),
slideOut: () => (slideOut),
xFormField2TemplateResult: () => (xFormField2TemplateResult)
});
// NAMESPACE OBJECT: ./node_modules/@popperjs/core/lib/index.js
var lib_namespaceObject = {};
__webpack_require__.r(lib_namespaceObject);
__webpack_require__.d(lib_namespaceObject, {
afterMain: () => (afterMain),
afterRead: () => (afterRead),
afterWrite: () => (afterWrite),
applyStyles: () => (modifiers_applyStyles),
arrow: () => (modifiers_arrow),
auto: () => (auto),
basePlacements: () => (basePlacements),
beforeMain: () => (beforeMain),
beforeRead: () => (beforeRead),
beforeWrite: () => (beforeWrite),
bottom: () => (bottom),
clippingParents: () => (clippingParents),
computeStyles: () => (modifiers_computeStyles),
createPopper: () => (popper_createPopper),
createPopperBase: () => (createPopper),
createPopperLite: () => (popper_lite_createPopper),
detectOverflow: () => (detectOverflow),
end: () => (end),
eventListeners: () => (eventListeners),
flip: () => (modifiers_flip),
hide: () => (modifiers_hide),
left: () => (left),
main: () => (main),
modifierPhases: () => (modifierPhases),
offset: () => (modifiers_offset),
placements: () => (enums_placements),
popper: () => (popper),
popperGenerator: () => (popperGenerator),
popperOffsets: () => (modifiers_popperOffsets),
preventOverflow: () => (modifiers_preventOverflow),
read: () => (read),
reference: () => (reference),
right: () => (right),
start: () => (start),
top: () => (enums_top),
variationPlacements: () => (variationPlacements),
viewport: () => (viewport),
write: () => (write)
});
// NAMESPACE OBJECT: ./src/utils/color.js
var utils_color_namespaceObject = {};
__webpack_require__.r(utils_color_namespaceObject);
__webpack_require__.d(utils_color_namespaceObject, {
getAuthorStyle: () => (getAuthorStyle)
});
// NAMESPACE OBJECT: ./src/utils/file.js
var file_namespaceObject = {};
__webpack_require__.r(file_namespaceObject);
__webpack_require__.d(file_namespaceObject, {
MIMETYPES_MAP: () => (MIMETYPES_MAP),
compressImage: () => (compressImage),
isImageWithAlphaChannel: () => (isImageWithAlphaChannel)
});
// NAMESPACE OBJECT: ./src/utils/url.js
var utils_url_namespaceObject = {};
__webpack_require__.r(utils_url_namespaceObject);
__webpack_require__.d(utils_url_namespaceObject, {
filterQueryParamsFromURL: () => (filterQueryParamsFromURL),
isDomainAllowed: () => (isDomainAllowed),
isDomainWhitelisted: () => (isDomainWhitelisted),
isMediaURLDomainAllowed: () => (isMediaURLDomainAllowed),
shouldRenderMediaFromURL: () => (shouldRenderMediaFromURL)
});
// EXTERNAL MODULE: ./node_modules/style-loader/dist/runtime/injectStylesIntoStyleTag.js
var injectStylesIntoStyleTag = __webpack_require__(5072);
var injectStylesIntoStyleTag_default = /*#__PURE__*/__webpack_require__.n(injectStylesIntoStyleTag);
// EXTERNAL MODULE: ./node_modules/style-loader/dist/runtime/styleDomAPI.js
var styleDomAPI = __webpack_require__(7825);
var styleDomAPI_default = /*#__PURE__*/__webpack_require__.n(styleDomAPI);
// EXTERNAL MODULE: ./node_modules/style-loader/dist/runtime/insertBySelector.js
var insertBySelector = __webpack_require__(7659);
var insertBySelector_default = /*#__PURE__*/__webpack_require__.n(insertBySelector);
// EXTERNAL MODULE: ./node_modules/style-loader/dist/runtime/setAttributesWithoutAttributes.js
var setAttributesWithoutAttributes = __webpack_require__(5056);
var setAttributesWithoutAttributes_default = /*#__PURE__*/__webpack_require__.n(setAttributesWithoutAttributes);
// EXTERNAL MODULE: ./node_modules/style-loader/dist/runtime/insertStyleElement.js
var insertStyleElement = __webpack_require__(540);
var insertStyleElement_default = /*#__PURE__*/__webpack_require__.n(insertStyleElement);
// EXTERNAL MODULE: ./node_modules/style-loader/dist/runtime/styleTagTransform.js
var styleTagTransform = __webpack_require__(1113);
var styleTagTransform_default = /*#__PURE__*/__webpack_require__.n(styleTagTransform);
// EXTERNAL MODULE: ./node_modules/css-loader/dist/cjs.js??ruleSet[1].rules[2].use[1]!./node_modules/postcss-loader/dist/cjs.js??ruleSet[1].rules[2].use[2]!./node_modules/sass-loader/dist/cjs.js??ruleSet[1].rules[2].use[3]!./node_modules/mini-css-extract-plugin/dist/loader.js!./node_modules/css-loader/dist/cjs.js??ruleSet[1].rules[5].use[1]!./node_modules/postcss-loader/dist/cjs.js??ruleSet[1].rules[5].use[2]!./node_modules/sass-loader/dist/cjs.js??ruleSet[1].rules[5].use[3]!./src/shared/styles/index.scss
var styles = __webpack_require__(845);
;// ./src/shared/styles/index.scss
var options = {};
options.styleTagTransform = (styleTagTransform_default());
options.setAttributes = (setAttributesWithoutAttributes_default());
options.insert = insertBySelector_default().bind(null, "head");
options.domAPI = (styleDomAPI_default());
options.insertStyleElement = (insertStyleElement_default());
var update = injectStylesIntoStyleTag_default()(styles/* default */.A, options);
/* harmony default export */ const shared_styles = (styles/* default */.A && styles/* default */.A.locals ? styles/* default */.A.locals : undefined);
// EXTERNAL MODULE: ./node_modules/jed/jed.js
var jed = __webpack_require__(3968);
var jed_default = /*#__PURE__*/__webpack_require__.n(jed);
// EXTERNAL MODULE: ./node_modules/dayjs/dayjs.min.js
var dayjs_min = __webpack_require__(2978);
var dayjs_min_default = /*#__PURE__*/__webpack_require__.n(dayjs_min);
// EXTERNAL MODULE: ./node_modules/dayjs/plugin/advancedFormat.js
var advancedFormat = __webpack_require__(9144);
var advancedFormat_default = /*#__PURE__*/__webpack_require__.n(advancedFormat);
;// ./src/log/index.js
/**
* @type {Object.<string, number>}
*/ var _console, _console1, _console2, _console3;
const LEVELS = {
debug: 0,
info: 1,
warn: 2,
error: 3,
fatal: 4
};
const logger = Object.assign({
debug: ((_console = console) === null || _console === void 0 ? void 0 : _console.log) ? console.log.bind(console) : function noop() {},
error: ((_console1 = console) === null || _console1 === void 0 ? void 0 : _console1.log) ? console.log.bind(console) : function noop() {},
info: ((_console2 = console) === null || _console2 === void 0 ? void 0 : _console2.log) ? console.log.bind(console) : function noop() {},
warn: ((_console3 = console) === null || _console3 === void 0 ? void 0 : _console3.log) ? console.log.bind(console) : function noop() {}
}, console);
/**
* Logs messages to the console.
* Available loglevels are:
* - 0: 'debug'
* - 1: 'info'
* - 2: 'warn',
* - 3: 'error'
* - 4: 'fatal'.
* When using the 'error' or 'warn' loglevels, a full stacktrace will be logged as well.
* @namespace log
*/ const log_log = {
/** @type {keyof LEVELS} The current log level */ loglevel: "info",
/**
* Sets the current log level which determines which messages are logged
* @param {keyof LEVELS} level - The log level to set
* @throws {Error} If an invalid log level is provided
*/ setLogLevel (level) {
if (![
"debug",
"info",
"warn",
"error",
"fatal"
].includes(/** @type {string} */ level)) {
throw new Error(`Invalid loglevel: ${level}`);
}
this.loglevel = level;
},
/**
* Logs a message at the specified level with optional CSS styling
* @param {any} message - The message to log
* @param {keyof LEVELS} level - The log level to use
* @param {string} [style=""] - Optional CSS styles to apply to the log message
*/ log (message, level, style = "") {
if (LEVELS[level] < LEVELS[this.loglevel]) {
return;
}
if (level === "error" || level === "fatal") {
style = style || "color: maroon";
} else if (level === "debug") {
style = style || "color: green";
}
if (message instanceof Error) {
message = message.stack;
} else if (isElement(message)) {
message = /** @type {Element} */ message.outerHTML;
}
const prefix = style ? "%c" : "";
if (level === "error") {
logger.error(`${prefix} ERROR: ${message}`, style);
} else if (level === "warn") {
logger.warn(`${prefix} ${new Date().toISOString()} WARNING: ${message}`, style);
} else if (level === "fatal") {
logger.error(`${prefix} FATAL: ${message}`, style);
} else if (level === "debug") {
logger.debug(`${prefix} ${new Date().toISOString()} DEBUG: ${message}`, style);
} else {
logger.info(`${prefix} ${new Date().toISOString()} INFO: ${message}`, style);
}
},
/**
* @param {any} message - The message to log
* @param {string} [style=""] - Optional CSS styles to apply to the log message
*/ debug (message, style) {
this.log(message, "debug", style);
},
/**
* @param {any} message - The message to log
* @param {string} [style=""] - Optional CSS styles to apply to the log message
*/ error (message, style) {
this.log(message, "error", style);
},
/**
* @param {any} message - The message to log
* @param {string} [style=""] - Optional CSS styles to apply to the log message
*/ info (message, style) {
this.log(message, "info", style);
},
/**
* @param {any} message - The message to log
* @param {string} [style=""] - Optional CSS styles to apply to the log message
*/ warn (message, style) {
this.log(message, "warn", style);
},
/**
* @param {any} message - The message to log
* @param {string} [style=""] - Optional CSS styles to apply to the log message
*/ fatal (message, style) {
this.log(message, "fatal", style);
}
};
/**
* @param {unknown} el - The value to check
* @returns {boolean} True if the value is an Element or Document
*/ function isElement(el) {
return el instanceof Element || el instanceof Document;
}
/* harmony default export */ const src_log = (log_log);
// EXTERNAL MODULE: ./node_modules/sizzle/dist/sizzle.js
var sizzle = __webpack_require__(5357);
var sizzle_default = /*#__PURE__*/__webpack_require__.n(sizzle);
// EXTERNAL MODULE: ./node_modules/sprintf-js/src/sprintf.js
var sprintf = __webpack_require__(7181);
;// ./src/headless/shared/i18n.js
function asyncGeneratorStep(gen, resolve, reject, _next, _throw, key, arg) {
try {
var info = gen[key](arg);
var value = info.value;
} catch (error) {
reject(error);
return;
}
if (info.done) {
resolve(value);
} else {
Promise.resolve(value).then(_next, _throw);
}
}
function _async_to_generator(fn) {
return function() {
var self = this, args = arguments;
return new Promise(function(resolve, reject) {
var gen = fn.apply(self, args);
function _next(value) {
asyncGeneratorStep(gen, resolve, reject, _next, _throw, "next", value);
}
function _throw(err) {
asyncGeneratorStep(gen, resolve, reject, _next, _throw, "throw", err);
}
_next(undefined);
});
};
}
/**
* @namespace i18n
*/ const i18nStub = {
// eslint-disable-next-line @typescript-eslint/no-empty-function
initialize () {
return _async_to_generator(function*() {})();
},
/**
* Overridable string wrapper method which can be used to provide i18n
* support.
*
* The default implementation in @converse/headless simply calls sprintf
* with the passed in arguments.
*
* If you install the full version of Converse, then this method gets
* overwritten in src/i18n/index.js to return a translated string.
* @method __
* @private
* @memberOf i18n
*/ __ (...args) {
return (0,sprintf.sprintf)(...args);
}
};
/* harmony default export */ const i18n = (i18nStub);
;// ./node_modules/pluggable.js/src/pluggable.js
/*
____ __ __ __ _
/ __ \/ /_ __ ___ ___ ____ _/ /_ / /__ (_)____
/ /_/ / / / / / __ \/ __ \/ __/ / __ \/ / _ \ / / ___/
/ ____/ / /_/ / /_/ / /_/ / /_/ / /_/ / / __/ / (__ )
/_/ /_/\__,_/\__, /\__, /\__/_/_.___/_/\___(_)_/ /____/
/____//____/ /___/
*/ // Pluggable.js lets you to make your Javascript code pluggable while still
// keeping sensitive objects and data private through closures.
// `wrappedOverride` creates a partially applied wrapper function
// that makes sure to set the proper super method when the
// overriding method is called. This is done to enable
// chaining of plugin methods, all the way up to the
// original method.
function wrappedOverride(key, value, super_method, default_super, ...args) {
if (typeof super_method === "function") {
if (typeof this.__super__ === "undefined") {
/* We're not on the context of the plugged object.
* This can happen when the overridden method is called via
* an event handler or when it's a constructor.
*
* In this case, we simply tack on the __super__ obj.
*/ this.__super__ = default_super;
}
this.__super__[key] = super_method.bind(this);
}
return value.apply(this, args);
}
// The `PluginSocket` class contains the plugin architecture, and gets
// created whenever `pluggable.enable(obj);` is called on the object
// that you want to make pluggable.
// You can also see it as the thing into which the plugins are plugged.
// It takes two parameters, first, the object being made pluggable, and
// then the name by which the pluggable object may be referenced on the
// __super__ object (inside overrides).
class PluginSocket {
// `_overrideAttribute` overrides an attribute on the original object
// (the thing being plugged into).
//
// If the attribute being overridden is a function, then the original
// function will still be available via the `__super__` attribute.
//
// If the same function is being overridden multiple times, then
// the original function will be available at the end of a chain of
// functions, starting from the most recent override, all the way
// back to the original function, each being referenced by the
// previous' __super__ attribute.
//
// For example:
//
// `plugin2.MyFunc.__super__.myFunc => plugin1.MyFunc.__super__.myFunc => original.myFunc`
_overrideAttribute(key, plugin) {
const value = plugin.overrides[key];
if (typeof value === "function") {
const default_super = {};
default_super[this.name] = this.plugged;
const super_method = this.plugged[key];
this.plugged[key] = function(...args) {
return wrappedOverride.apply(this, [
key,
value,
super_method,
default_super,
...args
]);
};
} else {
this.plugged[key] = value;
}
}
_extendObject(obj, attributes) {
if (!obj.prototype.__super__) {
obj.prototype.__super__ = {};
obj.prototype.__super__[this.name] = this.plugged;
}
for (const [key, value] of Object.entries(attributes)){
if (key === 'events') {
obj.prototype[key] = Object.assign(value, obj.prototype[key]);
} else if (typeof value === 'function') {
// We create a partially applied wrapper function, that
// makes sure to set the proper super method when the
// overriding method is called. This is done to enable
// chaining of plugin methods, all the way up to the
// original method.
const default_super = {};
default_super[this.name] = this.plugged;
const super_method = obj.prototype[key];
obj.prototype[key] = function(...args) {
return wrappedOverride.apply(this, [
key,
value,
super_method,
default_super,
...args
]);
};
} else {
obj.prototype[key] = value;
}
}
}
// Plugins can specify dependencies (by means of the
// `dependencies` list attribute) which refers to dependencies
// which will be initialized first, before the plugin itself gets initialized.
//
// If `strict_plugin_dependencies` is set to `false` (on the object being
// made pluggable), then no error will be thrown if any of these plugins aren't
// available.
loadPluginDependencies(plugin) {
var _plugin_dependencies;
(_plugin_dependencies = plugin.dependencies) === null || _plugin_dependencies === void 0 ? void 0 : _plugin_dependencies.forEach((name)=>{
const dep = this.plugins[name];
if (dep) {
var _dep_dependencies;
if ((_dep_dependencies = dep.dependencies) === null || _dep_dependencies === void 0 ? void 0 : _dep_dependencies.includes(plugin.__name__)) {
/* FIXME: circular dependency checking is only one level deep. */ throw "Found a circular dependency between the plugins \"" + plugin.__name__ + "\" and \"" + name + "\"";
}
this.initializePlugin(dep);
} else {
this.throwUndefinedDependencyError("Could not find dependency \"" + name + "\" " + "for the plugin \"" + plugin.__name__ + "\". " + "If it's needed, make sure it's loaded by require.js");
}
});
}
throwUndefinedDependencyError(msg) {
if (this.plugged.strict_plugin_dependencies) {
throw msg;
} else {
if (console.warn) {
console.warn(msg);
} else {
console.log(msg);
}
}
}
// `applyOverrides` is called by initializePlugin. It applies any
// and all overrides of methods or Backbone views and models that
// are defined on any of the plugins.
applyOverrides(plugin) {
Object.keys(plugin.overrides || {}).forEach((key)=>{
const override = plugin.overrides[key];
if (typeof override === "object") {
if (typeof this.plugged[key] === 'undefined') {
this.throwUndefinedDependencyError(`Plugin "${plugin.__name__}" tried to override "${key}" but it's not found.`);
} else {
this._extendObject(this.plugged[key], override);
}
} else {
this._overrideAttribute(key, plugin);
}
});
}
// `initializePlugin` applies the overrides (if any) defined on all
// the registered plugins and then calls the initialize method of the plugin
initializePlugin(plugin) {
var _plugin_enabled;
if (!Object.keys(this.allowed_plugins).includes(plugin.__name__)) {
/* Don't initialize disallowed plugins. */ return;
}
if (this.initialized_plugins.includes(plugin.__name__)) {
/* Don't initialize plugins twice, otherwise we get
* infinite recursion in overridden methods.
*/ return;
}
if (typeof plugin.enabled === 'boolean' && plugin.enabled || ((_plugin_enabled = plugin.enabled) === null || _plugin_enabled === void 0 ? void 0 : _plugin_enabled.call(plugin, this.plugged)) || plugin.enabled == null) {
Object.assign(plugin, this.properties);
if (plugin.dependencies) {
this.loadPluginDependencies(plugin);
}
this.applyOverrides(plugin);
if (typeof plugin.initialize === "function") {
plugin.initialize.bind(plugin)(this);
}
this.initialized_plugins.push(plugin.__name__);
}
}
// `registerPlugin` registers (or inserts, if you'd like) a plugin,
// by adding it to the `plugins` map on the PluginSocket instance.
registerPlugin(name, plugin) {
if (name in this.plugins) {
throw new Error('Error: Plugin name ' + name + ' is already taken');
}
plugin.__name__ = name;
this.plugins[name] = plugin;
}
// `initializePlugins` should get called once all plugins have been
// registered. It will then iterate through all the plugins, calling
// `initializePlugin` for each.
// The passed in properties variable is an object with attributes and methods
// which will be attached to the plugins.
initializePlugins(properties = {}, whitelist = [], blacklist = []) {
if (!Object.keys(this.plugins).length) {
return;
}
this.properties = properties;
this.allowed_plugins = {};
for (const [key, plugin] of Object.entries(this.plugins)){
if ((!whitelist.length || whitelist.includes(key)) && !blacklist.includes(key)) {
this.allowed_plugins[key] = plugin;
}
}
Object.values(this.allowed_plugins).forEach((o)=>this.initializePlugin(o));
}
constructor(plugged, name){
this.name = name;
this.plugged = plugged;
if (typeof this.plugged.__super__ === 'undefined') {
this.plugged.__super__ = {};
} else if (typeof this.plugged.__super__ === 'string') {
this.plugged.__super__ = {
'__string__': this.plugged.__super__
};
}
this.plugged.__super__[name] = this.plugged;
this.plugins = {};
this.initialized_plugins = [];
}
}
function enable(object, name, attrname) {
// Call the `enable` method to make an object pluggable
//
// It takes three parameters:
// - `object`: The object that gets made pluggable.
// - `name`: The string name by which the now pluggable object
// may be referenced on the __super__ obj (in overrides).
// The default value is "plugged".
// - `attrname`: The string name of the attribute on the now
// pluggable object, which refers to the PluginSocket instance
// that gets created.
if (typeof attrname === "undefined") {
attrname = "pluginSocket";
}
if (typeof name === 'undefined') {
name = 'plugged';
}
object[attrname] = new PluginSocket(object, name);
return object;
}
/* harmony default export */ const pluggable = ({
enable
});
// EXTERNAL MODULE: ./node_modules/@converse/skeletor/dist/skeletor.js
var skeletor = __webpack_require__(1263);
;// ./node_modules/@converse/openpromise/dist/openpromise.js
function _define_property(obj, key, value) {
if (key in obj) {
Object.defineProperty(obj, key, {
value: value,
enumerable: true,
configurable: true,
writable: true
});
} else {
obj[key] = value;
}
return obj;
}
function _object_spread(target) {
for(var i = 1; i < arguments.length; i++){
var source = arguments[i] != null ? arguments[i] : {};
var ownKeys = Object.keys(source);
if (typeof Object.getOwnPropertySymbols === "function") {
ownKeys = ownKeys.concat(Object.getOwnPropertySymbols(source).filter(function(sym) {
return Object.getOwnPropertyDescriptor(source, sym).enumerable;
}));
}
ownKeys.forEach(function(key) {
_define_property(target, key, source[key]);
});
}
return target;
}
function ownKeys(object, enumerableOnly) {
var keys = Object.keys(object);
if (Object.getOwnPropertySymbols) {
var symbols = Object.getOwnPropertySymbols(object);
if (enumerableOnly) {
symbols = symbols.filter(function(sym) {
return Object.getOwnPropertyDescriptor(object, sym).enumerable;
});
}
keys.push.apply(keys, symbols);
}
return keys;
}
function _object_spread_props(target, source) {
source = source != null ? source : {};
if (Object.getOwnPropertyDescriptors) {
Object.defineProperties(target, Object.getOwnPropertyDescriptors(source));
} else {
ownKeys(Object(source)).forEach(function(key) {
Object.defineProperty(target, key, Object.getOwnPropertyDescriptor(source, key));
});
}
return target;
}
function getOpenPromise() {
const wrapper = {
isResolved: false,
isPending: true,
isRejected: false
};
let promise;
let resolve = ()=>{};
let reject = ()=>{};
if (typeof Promise.withResolvers === 'function') {
const { promise: p, resolve: r, reject: j } = Promise.withResolvers();
promise = p;
resolve = r;
reject = j;
} else {
promise = new Promise((r, j)=>{
resolve = r;
reject = j;
});
}
Object.assign(promise, _object_spread_props(_object_spread({}, wrapper), {
resolve,
reject
}));
promise.then((v)=>{
promise.isResolved = true;
promise.isPending = false;
promise.isRejected = false;
return v;
}, (e)=>{
promise.isResolved = false;
promise.isPending = false;
promise.isRejected = true;
throw e;
});
return promise;
} //# sourceMappingURL=openpromise.js.map
;// ./node_modules/lodash-es/_listCacheClear.js
/**
* Removes all key-value entries from the list cache.
*
* @private
* @name clear
* @memberOf ListCache
*/ function listCacheClear() {
this.__data__ = [];
this.size = 0;
}
/* harmony default export */ const _listCacheClear = (listCacheClear);
;// ./node_modules/lodash-es/eq.js
/**
* Performs a
* [`SameValueZero`](http://ecma-international.org/ecma-262/7.0/#sec-samevaluezero)
* comparison between two values to determine if they are equivalent.
*
* @static
* @memberOf _
* @since 4.0.0
* @category Lang
* @param {*} value The value to compare.
* @param {*} other The other value to compare.
* @returns {boolean} Returns `true` if the values are equivalent, else `false`.
* @example
*
* var object = { 'a': 1 };
* var other = { 'a': 1 };
*
* _.eq(object, object);
* // => true
*
* _.eq(object, other);
* // => false
*
* _.eq('a', 'a');
* // => true
*
* _.eq('a', Object('a'));
* // => false
*
* _.eq(NaN, NaN);
* // => true
*/ function eq(value, other) {
return value === other || value !== value && other !== other;
}
/* harmony default export */ const lodash_es_eq = (eq);
;// ./node_modules/lodash-es/_assocIndexOf.js
/**
* Gets the index at which the `key` is found in `array` of key-value pairs.
*
* @private
* @param {Array} array The array to inspect.
* @param {*} key The key to search for.
* @returns {number} Returns the index of the matched value, else `-1`.
*/ function assocIndexOf(array, key) {
var length = array.length;
while(length--){
if (lodash_es_eq(array[length][0], key)) {
return length;
}
}
return -1;
}
/* harmony default export */ const _assocIndexOf = (assocIndexOf);
;// ./node_modules/lodash-es/_listCacheDelete.js
/** Used for built-in method references. */ var arrayProto = Array.prototype;
/** Built-in value references. */ var splice = arrayProto.splice;
/**
* Removes `key` and its value from the list cache.
*
* @private
* @name delete
* @memberOf ListCache
* @param {string} key The key of the value to remove.
* @returns {boolean} Returns `true` if the entry was removed, else `false`.
*/ function listCacheDelete(key) {
var data = this.__data__, index = _assocIndexOf(data, key);
if (index < 0) {
return false;
}
var lastIndex = data.length - 1;
if (index == lastIndex) {
data.pop();
} else {
splice.call(data, index, 1);
}
--this.size;
return true;
}
/* harmony default export */ const _listCacheDelete = (listCacheDelete);
;// ./node_modules/lodash-es/_listCacheGet.js
/**
* Gets the list cache value for `key`.
*
* @private
* @name get
* @memberOf ListCache
* @param {string} key The key of the value to get.
* @returns {*} Returns the entry value.
*/ function listCacheGet(key) {
var data = this.__data__, index = _assocIndexOf(data, key);
return index < 0 ? undefined : data[index][1];
}
/* harmony default export */ const _listCacheGet = (listCacheGet);
;// ./node_modules/lodash-es/_listCacheHas.js
/**
* Checks if a list cache value for `key` exists.
*
* @private
* @name has
* @memberOf ListCache
* @param {string} key The key of the entry to check.
* @returns {boolean} Returns `true` if an entry for `key` exists, else `false`.
*/ function listCacheHas(key) {
return _assocIndexOf(this.__data__, key) > -1;
}
/* harmony default export */ const _listCacheHas = (listCacheHas);
;// ./node_modules/lodash-es/_listCacheSet.js
/**
* Sets the list cache `key` to `value`.
*
* @private
* @name set
* @memberOf ListCache
* @param {string} key The key of the value to set.
* @param {*} value The value to set.
* @returns {Object} Returns the list cache instance.
*/ function listCacheSet(key, value) {
var data = this.__data__, index = _assocIndexOf(data, key);
if (index < 0) {
++this.size;
data.push([
key,
value
]);
} else {
data[index][1] = value;
}
return this;
}
/* harmony default export */ const _listCacheSet = (listCacheSet);
;// ./node_modules/lodash-es/_ListCache.js
/**
* Creates an list cache object.
*
* @private
* @constructor
* @param {Array} [entries] The key-value pairs to cache.
*/ function ListCache(entries) {
var index = -1, length = entries == null ? 0 : entries.length;
this.clear();
while(++index < length){
var entry = entries[index];
this.set(entry[0], entry[1]);
}
}
// Add methods to `ListCache`.
ListCache.prototype.clear = _listCacheClear;
ListCache.prototype['delete'] = _listCacheDelete;
ListCache.prototype.get = _listCacheGet;
ListCache.prototype.has = _listCacheHas;
ListCache.prototype.set = _listCacheSet;
/* harmony default export */ const _ListCache = (ListCache);
;// ./node_modules/lodash-es/_stackClear.js
/**
* Removes all key-value entries from the stack.
*
* @private
* @name clear
* @memberOf Stack
*/ function stackClear() {
this.__data__ = new _ListCache;
this.size = 0;
}
/* harmony default export */ const _stackClear = (stackClear);
;// ./node_modules/lodash-es/_stackDelete.js
/**
* Removes `key` and its value from the stack.
*
* @private
* @name delete
* @memberOf Stack
* @param {string} key The key of the value to remove.
* @returns {boolean} Returns `true` if the entry was removed, else `false`.
*/ function stackDelete(key) {
var data = this.__data__, result = data['delete'](key);
this.size = data.size;
return result;
}
/* harmony default export */ const _stackDelete = (stackDelete);
;// ./node_modules/lodash-es/_stackGet.js
/**
* Gets the stack value for `key`.
*
* @private
* @name get
* @memberOf Stack
* @param {string} key The key of the value to get.
* @returns {*} Returns the entry value.
*/ function stackGet(key) {
return this.__data__.get(key);
}
/* harmony default export */ const _stackGet = (stackGet);
;// ./node_modules/lodash-es/_stackHas.js
/**
* Checks if a stack value for `key` exists.
*
* @private
* @name has
* @memberOf Stack
* @param {string} key The key of the entry to check.
* @returns {boolean} Returns `true` if an entry for `key` exists, else `false`.
*/ function stackHas(key) {
return this.__data__.has(key);
}
/* harmony default export */ const _stackHas = (stackHas);
;// ./node_modules/lodash-es/_freeGlobal.js
/** Detect free variable `global` from Node.js. */ var freeGlobal = typeof global == 'object' && global && global.Object === Object && global;
/* harmony default export */ const _freeGlobal = (freeGlobal);
;// ./node_modules/lodash-es/_root.js
/** Detect free variable `self`. */ var freeSelf = typeof self == 'object' && self && self.Object === Object && self;
/** Used as a reference to the global object. */ var root = _freeGlobal || freeSelf || Function('return this')();
/* harmony default export */ const _root = (root);
;// ./node_modules/lodash-es/_Symbol.js
/** Built-in value references. */ var _Symbol_Symbol = _root.Symbol;
/* harmony default export */ const _Symbol = (_Symbol_Symbol);
;// ./node_modules/lodash-es/_getRawTag.js
/** Used for built-in method references. */ var objectProto = Object.prototype;
/** Used to check objects for own properties. */ var _getRawTag_hasOwnProperty = objectProto.hasOwnProperty;
/**
* Used to resolve the
* [`toStringTag`](http://ecma-international.org/ecma-262/7.0/#sec-object.prototype.tostring)
* of values.
*/ var nativeObjectToString = objectProto.toString;
/** Built-in value references. */ var symToStringTag = _Symbol ? _Symbol.toStringTag : undefined;
/**
* A specialized version of `baseGetTag` which ignores `Symbol.toStringTag` values.
*
* @private
* @param {*} value The value to query.
* @returns {string} Returns the raw `toStringTag`.
*/ function getRawTag(value) {
var isOwn = _getRawTag_hasOwnProperty.call(value, symToStringTag), tag = value[symToStringTag];
try {
value[symToStringTag] = undefined;
var unmasked = true;
} catch (e) {}
var result = nativeObjectToString.call(value);
if (unmasked) {
if (isOwn) {
value[symToStringTag] = tag;
} else {
delete value[symToStringTag];
}
}
return result;
}
/* harmony default export */ const _getRawTag = (getRawTag);
;// ./node_modules/lodash-es/_objectToString.js
/** Used for built-in method references. */ var _objectToString_objectProto = Object.prototype;
/**
* Used to resolve the
* [`toStringTag`](http://ecma-international.org/ecma-262/7.0/#sec-object.prototype.tostring)
* of values.
*/ var _objectToString_nativeObjectToString = _objectToString_objectProto.toString;
/**
* Converts `value` to a string using `Object.prototype.toString`.
*
* @private
* @param {*} value The value to convert.
* @returns {string} Returns the converted string.
*/ function objectToString(value) {
return _objectToString_nativeObjectToString.call(value);
}
/* harmony default export */ const _objectToString = (objectToString);
;// ./node_modules/lodash-es/_baseGetTag.js
/** `Object#toString` result references. */ var nullTag = '[object Null]', undefinedTag = '[object Undefined]';
/** Built-in value references. */ var _baseGetTag_symToStringTag = _Symbol ? _Symbol.toStringTag : undefined;
/**
* The base implementation of `getTag` without fallbacks for buggy environments.
*
* @private
* @param {*} value The value to query.
* @returns {string} Returns the `toStringTag`.
*/ function baseGetTag(value) {
if (value == null) {
return value === undefined ? undefinedTag : nullTag;
}
return _baseGetTag_symToStringTag && _baseGetTag_symToStringTag in Object(value) ? _getRawTag(value) : _objectToString(value);
}
/* harmony default export */ const _baseGetTag = (baseGetTag);
;// ./node_modules/lodash-es/isObject.js
/**
* Checks if `value` is the
* [language type](http://www.ecma-international.org/ecma-262/7.0/#sec-ecmascript-language-types)
* of `Object`. (e.g. arrays, functions, objects, regexes, `new Number(0)`, and `new String('')`)
*
* @static
* @memberOf _
* @since 0.1.0
* @category Lang
* @param {*} value The value to check.
* @returns {boolean} Returns `true` if `value` is an object, else `false`.
* @example
*
* _.isObject({});
* // => true
*
* _.isObject([1, 2, 3]);
* // => true
*
* _.isObject(_.noop);
* // => true
*
* _.isObject(null);
* // => false
*/ function isObject(value) {
var type = typeof value;
return value != null