stream-chat 9.13.0 → 9.14.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/cjs/index.browser.cjs +412 -182
- package/dist/cjs/index.browser.cjs.map +4 -4
- package/dist/cjs/index.node.cjs +1846 -439
- package/dist/cjs/index.node.cjs.map +4 -4
- package/dist/esm/index.js +412 -182
- package/dist/esm/index.js.map +4 -4
- package/dist/types/messageComposer/attachmentManager.d.ts +11 -3
- package/dist/types/messageComposer/configuration/types.d.ts +1 -1
- package/dist/types/messageComposer/middleware/attachmentManager/index.d.ts +3 -0
- package/dist/types/messageComposer/middleware/attachmentManager/postUpload/AttachmentPostUploadMiddlewareExecutor.d.ts +5 -0
- package/dist/types/messageComposer/middleware/attachmentManager/postUpload/attachmentEnrichment.d.ts +2 -0
- package/dist/types/messageComposer/middleware/attachmentManager/postUpload/index.d.ts +3 -0
- package/dist/types/messageComposer/middleware/attachmentManager/postUpload/uploadErrorHandler.d.ts +3 -0
- package/dist/types/messageComposer/middleware/attachmentManager/preUpload/AttachmentPreUploadMiddlewareExecutor.d.ts +5 -0
- package/dist/types/messageComposer/middleware/attachmentManager/preUpload/blockedUploadNotification.d.ts +3 -0
- package/dist/types/messageComposer/middleware/attachmentManager/preUpload/index.d.ts +3 -0
- package/dist/types/messageComposer/middleware/attachmentManager/preUpload/serverUploadConfigCheck.d.ts +3 -0
- package/dist/types/messageComposer/middleware/attachmentManager/types.d.ts +20 -0
- package/dist/types/messageComposer/types.d.ts +1 -0
- package/dist/types/middleware.d.ts +3 -2
- package/package.json +2 -2
- package/src/messageComposer/attachmentManager.ts +116 -25
- package/src/messageComposer/configuration/types.ts +3 -2
- package/src/messageComposer/messageComposer.ts +1 -1
- package/src/messageComposer/middleware/attachmentManager/index.ts +3 -0
- package/src/messageComposer/middleware/attachmentManager/postUpload/AttachmentPostUploadMiddlewareExecutor.ts +20 -0
- package/src/messageComposer/middleware/attachmentManager/postUpload/attachmentEnrichment.ts +43 -0
- package/src/messageComposer/middleware/attachmentManager/postUpload/index.ts +3 -0
- package/src/messageComposer/middleware/attachmentManager/postUpload/uploadErrorHandler.ts +39 -0
- package/src/messageComposer/middleware/attachmentManager/preUpload/AttachmentPreUploadMiddlewareExecutor.ts +20 -0
- package/src/messageComposer/middleware/attachmentManager/preUpload/blockedUploadNotification.ts +38 -0
- package/src/messageComposer/middleware/attachmentManager/preUpload/index.ts +3 -0
- package/src/messageComposer/middleware/attachmentManager/preUpload/serverUploadConfigCheck.ts +40 -0
- package/src/messageComposer/middleware/attachmentManager/types.ts +32 -0
- package/src/messageComposer/types.ts +6 -0
- package/src/middleware.ts +22 -10
- package/src/utils.ts +5 -1
package/dist/cjs/index.node.cjs
CHANGED
|
@@ -9016,9 +9016,9 @@ var require_asynckit = __commonJS({
|
|
|
9016
9016
|
}
|
|
9017
9017
|
});
|
|
9018
9018
|
|
|
9019
|
-
// node_modules/form-data/lib/populate.js
|
|
9019
|
+
// node_modules/axios/node_modules/form-data/lib/populate.js
|
|
9020
9020
|
var require_populate = __commonJS({
|
|
9021
|
-
"node_modules/form-data/lib/populate.js"(exports2, module2) {
|
|
9021
|
+
"node_modules/axios/node_modules/form-data/lib/populate.js"(exports2, module2) {
|
|
9022
9022
|
module2.exports = function(dst, src) {
|
|
9023
9023
|
Object.keys(src).forEach(function(prop) {
|
|
9024
9024
|
dst[prop] = dst[prop] || src[prop];
|
|
@@ -9028,9 +9028,9 @@ var require_populate = __commonJS({
|
|
|
9028
9028
|
}
|
|
9029
9029
|
});
|
|
9030
9030
|
|
|
9031
|
-
// node_modules/form-data/lib/form_data.js
|
|
9031
|
+
// node_modules/axios/node_modules/form-data/lib/form_data.js
|
|
9032
9032
|
var require_form_data = __commonJS({
|
|
9033
|
-
"node_modules/form-data/lib/form_data.js"(exports2, module2) {
|
|
9033
|
+
"node_modules/axios/node_modules/form-data/lib/form_data.js"(exports2, module2) {
|
|
9034
9034
|
var CombinedStream = require_combined_stream();
|
|
9035
9035
|
var util2 = require("util");
|
|
9036
9036
|
var path = require("path");
|
|
@@ -10653,258 +10653,1436 @@ var require_follow_redirects = __commonJS({
|
|
|
10653
10653
|
}
|
|
10654
10654
|
});
|
|
10655
10655
|
|
|
10656
|
-
// node_modules/
|
|
10657
|
-
var
|
|
10658
|
-
"node_modules/
|
|
10656
|
+
// node_modules/es-object-atoms/index.js
|
|
10657
|
+
var require_es_object_atoms = __commonJS({
|
|
10658
|
+
"node_modules/es-object-atoms/index.js"(exports2, module2) {
|
|
10659
10659
|
"use strict";
|
|
10660
|
-
module2.exports =
|
|
10660
|
+
module2.exports = Object;
|
|
10661
10661
|
}
|
|
10662
10662
|
});
|
|
10663
10663
|
|
|
10664
|
-
//
|
|
10665
|
-
var
|
|
10666
|
-
|
|
10667
|
-
|
|
10668
|
-
|
|
10669
|
-
|
|
10670
|
-
AnyResource: () => AnyResource,
|
|
10671
|
-
AnyRole: () => AnyRole,
|
|
10672
|
-
AttachmentManager: () => AttachmentManager,
|
|
10673
|
-
BasePaginator: () => BasePaginator,
|
|
10674
|
-
BaseSearchSource: () => BaseSearchSource,
|
|
10675
|
-
BaseSearchSourceSync: () => BaseSearchSourceSync,
|
|
10676
|
-
BuiltinPermissions: () => BuiltinPermissions,
|
|
10677
|
-
BuiltinRoles: () => BuiltinRoles,
|
|
10678
|
-
Campaign: () => Campaign,
|
|
10679
|
-
Channel: () => Channel,
|
|
10680
|
-
ChannelManager: () => ChannelManager,
|
|
10681
|
-
ChannelSearchSource: () => ChannelSearchSource,
|
|
10682
|
-
ChannelState: () => ChannelState,
|
|
10683
|
-
CheckSignature: () => CheckSignature,
|
|
10684
|
-
ClientState: () => ClientState,
|
|
10685
|
-
CommandSearchSource: () => CommandSearchSource,
|
|
10686
|
-
CustomDataManager: () => CustomDataManager,
|
|
10687
|
-
DEFAULT_ATTACHMENT_MANAGER_CONFIG: () => DEFAULT_ATTACHMENT_MANAGER_CONFIG,
|
|
10688
|
-
DEFAULT_CHANNEL_MANAGER_OPTIONS: () => DEFAULT_CHANNEL_MANAGER_OPTIONS,
|
|
10689
|
-
DEFAULT_CHANNEL_MANAGER_PAGINATION_OPTIONS: () => DEFAULT_CHANNEL_MANAGER_PAGINATION_OPTIONS,
|
|
10690
|
-
DEFAULT_COMPOSER_CONFIG: () => DEFAULT_COMPOSER_CONFIG,
|
|
10691
|
-
DEFAULT_LINK_PREVIEW_MANAGER_CONFIG: () => DEFAULT_LINK_PREVIEW_MANAGER_CONFIG,
|
|
10692
|
-
DEFAULT_LOCATION_COMPOSER_CONFIG: () => DEFAULT_LOCATION_COMPOSER_CONFIG,
|
|
10693
|
-
DEFAULT_PAGINATION_OPTIONS: () => DEFAULT_PAGINATION_OPTIONS,
|
|
10694
|
-
DEFAULT_REMINDER_MANAGER_CONFIG: () => DEFAULT_REMINDER_MANAGER_CONFIG,
|
|
10695
|
-
DEFAULT_STOP_REFRESH_BOUNDARY_MS: () => DEFAULT_STOP_REFRESH_BOUNDARY_MS,
|
|
10696
|
-
DEFAULT_TEXT_COMPOSER_CONFIG: () => DEFAULT_TEXT_COMPOSER_CONFIG,
|
|
10697
|
-
Deny: () => Deny,
|
|
10698
|
-
DenyAll: () => DenyAll,
|
|
10699
|
-
DevToken: () => DevToken,
|
|
10700
|
-
EVENT_MAP: () => EVENT_MAP,
|
|
10701
|
-
ErrorFromResponse: () => ErrorFromResponse,
|
|
10702
|
-
FixedSizeQueueCache: () => FixedSizeQueueCache,
|
|
10703
|
-
InsightMetrics: () => InsightMetrics,
|
|
10704
|
-
JWTServerToken: () => JWTServerToken,
|
|
10705
|
-
JWTUserToken: () => JWTUserToken,
|
|
10706
|
-
LinkPreviewStatus: () => LinkPreviewStatus,
|
|
10707
|
-
LinkPreviewsManager: () => LinkPreviewsManager,
|
|
10708
|
-
LiveLocationManager: () => LiveLocationManager,
|
|
10709
|
-
LocationComposer: () => LocationComposer,
|
|
10710
|
-
MAX_POLL_OPTIONS: () => MAX_POLL_OPTIONS,
|
|
10711
|
-
MODERATION_ENTITY_TYPES: () => MODERATION_ENTITY_TYPES,
|
|
10712
|
-
MaxPriority: () => MaxPriority,
|
|
10713
|
-
MentionsSearchSource: () => MentionsSearchSource,
|
|
10714
|
-
MergedStateStore: () => MergedStateStore,
|
|
10715
|
-
MessageComposer: () => MessageComposer,
|
|
10716
|
-
MessageComposerMiddlewareExecutor: () => MessageComposerMiddlewareExecutor,
|
|
10717
|
-
MessageDraftComposerMiddlewareExecutor: () => MessageDraftComposerMiddlewareExecutor,
|
|
10718
|
-
MessageSearchSource: () => MessageSearchSource,
|
|
10719
|
-
MiddlewareExecutor: () => MiddlewareExecutor,
|
|
10720
|
-
MinPriority: () => MinPriority,
|
|
10721
|
-
Moderation: () => Moderation,
|
|
10722
|
-
NotificationManager: () => NotificationManager,
|
|
10723
|
-
OfflineDBSyncManager: () => OfflineDBSyncManager,
|
|
10724
|
-
OfflineError: () => OfflineError,
|
|
10725
|
-
Permission: () => Permission,
|
|
10726
|
-
Poll: () => Poll,
|
|
10727
|
-
PollComposer: () => PollComposer,
|
|
10728
|
-
PollComposerCompositionMiddlewareExecutor: () => PollComposerCompositionMiddlewareExecutor,
|
|
10729
|
-
PollComposerStateMiddlewareExecutor: () => PollComposerStateMiddlewareExecutor,
|
|
10730
|
-
PollManager: () => PollManager,
|
|
10731
|
-
Product: () => Product,
|
|
10732
|
-
Reminder: () => Reminder,
|
|
10733
|
-
ReminderManager: () => ReminderManager,
|
|
10734
|
-
ReminderPaginator: () => ReminderPaginator,
|
|
10735
|
-
ReminderTimer: () => ReminderTimer,
|
|
10736
|
-
SearchController: () => SearchController,
|
|
10737
|
-
Segment: () => Segment,
|
|
10738
|
-
StableWSConnection: () => StableWSConnection,
|
|
10739
|
-
StateStore: () => StateStore,
|
|
10740
|
-
StreamChat: () => StreamChat,
|
|
10741
|
-
THREAD_MANAGER_INITIAL_STATE: () => THREAD_MANAGER_INITIAL_STATE,
|
|
10742
|
-
TextComposer: () => TextComposer,
|
|
10743
|
-
TextComposerMiddlewareExecutor: () => TextComposerMiddlewareExecutor,
|
|
10744
|
-
Thread: () => Thread,
|
|
10745
|
-
ThreadManager: () => ThreadManager,
|
|
10746
|
-
TokenManager: () => TokenManager,
|
|
10747
|
-
UPDATE_LIVE_LOCATION_REQUEST_MIN_THROTTLE_TIMEOUT: () => UPDATE_LIVE_LOCATION_REQUEST_MIN_THROTTLE_TIMEOUT,
|
|
10748
|
-
UserFromToken: () => UserFromToken,
|
|
10749
|
-
UserSearchSource: () => UserSearchSource,
|
|
10750
|
-
VALID_MAX_VOTES_VALUE_REGEX: () => VALID_MAX_VOTES_VALUE_REGEX,
|
|
10751
|
-
VotingVisibility: () => VotingVisibility,
|
|
10752
|
-
accentsMap: () => accentsMap,
|
|
10753
|
-
buildWsFatalInsight: () => buildWsFatalInsight,
|
|
10754
|
-
buildWsSuccessAfterFailureInsight: () => buildWsSuccessAfterFailureInsight,
|
|
10755
|
-
calculateLevenshtein: () => calculateLevenshtein,
|
|
10756
|
-
channelManagerEventToHandlerMapping: () => channelManagerEventToHandlerMapping,
|
|
10757
|
-
chatCodes: () => chatCodes,
|
|
10758
|
-
createActiveCommandGuardMiddleware: () => createActiveCommandGuardMiddleware,
|
|
10759
|
-
createAttachmentsCompositionMiddleware: () => createAttachmentsCompositionMiddleware,
|
|
10760
|
-
createCommandInjectionMiddleware: () => createCommandInjectionMiddleware,
|
|
10761
|
-
createCommandStringExtractionMiddleware: () => createCommandStringExtractionMiddleware,
|
|
10762
|
-
createCommandsMiddleware: () => createCommandsMiddleware,
|
|
10763
|
-
createCompositionDataCleanupMiddleware: () => createCompositionDataCleanupMiddleware,
|
|
10764
|
-
createCompositionValidationMiddleware: () => createCompositionValidationMiddleware,
|
|
10765
|
-
createCustomDataCompositionMiddleware: () => createCustomDataCompositionMiddleware,
|
|
10766
|
-
createDraftAttachmentsCompositionMiddleware: () => createDraftAttachmentsCompositionMiddleware,
|
|
10767
|
-
createDraftCommandInjectionMiddleware: () => createDraftCommandInjectionMiddleware,
|
|
10768
|
-
createDraftCompositionValidationMiddleware: () => createDraftCompositionValidationMiddleware,
|
|
10769
|
-
createDraftCustomDataCompositionMiddleware: () => createDraftCustomDataCompositionMiddleware,
|
|
10770
|
-
createDraftLinkPreviewsCompositionMiddleware: () => createDraftLinkPreviewsCompositionMiddleware,
|
|
10771
|
-
createDraftMessageComposerStateCompositionMiddleware: () => createDraftMessageComposerStateCompositionMiddleware,
|
|
10772
|
-
createDraftTextComposerCompositionMiddleware: () => createDraftTextComposerCompositionMiddleware,
|
|
10773
|
-
createFileFromBlobs: () => createFileFromBlobs,
|
|
10774
|
-
createLinkPreviewsCompositionMiddleware: () => createLinkPreviewsCompositionMiddleware,
|
|
10775
|
-
createMentionsMiddleware: () => createMentionsMiddleware,
|
|
10776
|
-
createMessageComposerStateCompositionMiddleware: () => createMessageComposerStateCompositionMiddleware,
|
|
10777
|
-
createPollComposerStateMiddleware: () => createPollComposerStateMiddleware,
|
|
10778
|
-
createSharedLocationCompositionMiddleware: () => createSharedLocationCompositionMiddleware,
|
|
10779
|
-
createTextComposerCompositionMiddleware: () => createTextComposerCompositionMiddleware,
|
|
10780
|
-
createTextComposerPreValidationMiddleware: () => createTextComposerPreValidationMiddleware,
|
|
10781
|
-
decodeBase64: () => decodeBase64,
|
|
10782
|
-
defaultPollFieldBlurEventValidators: () => defaultPollFieldBlurEventValidators,
|
|
10783
|
-
defaultPollFieldChangeEventValidators: () => defaultPollFieldChangeEventValidators,
|
|
10784
|
-
encodeBase64: () => encodeBase64,
|
|
10785
|
-
ensureIsLocalAttachment: () => ensureIsLocalAttachment,
|
|
10786
|
-
escapeRegExp: () => escapeRegExp,
|
|
10787
|
-
extractPollData: () => extractPollData,
|
|
10788
|
-
extractPollEnrichedData: () => extractPollEnrichedData,
|
|
10789
|
-
formatMessage: () => formatMessage,
|
|
10790
|
-
generateFileName: () => generateFileName,
|
|
10791
|
-
getAttachmentTypeFromMimeType: () => getAttachmentTypeFromMimeType,
|
|
10792
|
-
getCompleteCommandInString: () => getCompleteCommandInString,
|
|
10793
|
-
getExtensionFromMimeType: () => getExtensionFromMimeType,
|
|
10794
|
-
getTokenizedSuggestionDisplayName: () => getTokenizedSuggestionDisplayName,
|
|
10795
|
-
getTriggerCharWithToken: () => getTriggerCharWithToken,
|
|
10796
|
-
insertItemWithTrigger: () => insertItemWithTrigger,
|
|
10797
|
-
isAudioAttachment: () => isAudioAttachment,
|
|
10798
|
-
isBlobButNotFile: () => isBlobButNotFile,
|
|
10799
|
-
isFile: () => isFile2,
|
|
10800
|
-
isFileAttachment: () => isFileAttachment,
|
|
10801
|
-
isFileList: () => isFileList2,
|
|
10802
|
-
isFileReference: () => isFileReference,
|
|
10803
|
-
isImageAttachment: () => isImageAttachment,
|
|
10804
|
-
isImageFile: () => isImageFile,
|
|
10805
|
-
isLocalAttachment: () => isLocalAttachment,
|
|
10806
|
-
isLocalAudioAttachment: () => isLocalAudioAttachment,
|
|
10807
|
-
isLocalFileAttachment: () => isLocalFileAttachment,
|
|
10808
|
-
isLocalImageAttachment: () => isLocalImageAttachment,
|
|
10809
|
-
isLocalUploadAttachment: () => isLocalUploadAttachment,
|
|
10810
|
-
isLocalVideoAttachment: () => isLocalVideoAttachment,
|
|
10811
|
-
isLocalVoiceRecordingAttachment: () => isLocalVoiceRecordingAttachment,
|
|
10812
|
-
isOwnUser: () => isOwnUser,
|
|
10813
|
-
isPatch: () => isPatch,
|
|
10814
|
-
isScrapedContent: () => isScrapedContent,
|
|
10815
|
-
isSharedLocationResponse: () => isSharedLocationResponse,
|
|
10816
|
-
isTargetedOptionTextUpdate: () => isTargetedOptionTextUpdate,
|
|
10817
|
-
isUploadedAttachment: () => isUploadedAttachment,
|
|
10818
|
-
isVideoAttachment: () => isVideoAttachment,
|
|
10819
|
-
isVoiceRecordingAttachment: () => isVoiceRecordingAttachment,
|
|
10820
|
-
isVoteAnswer: () => isVoteAnswer,
|
|
10821
|
-
localMessageToNewMessagePayload: () => localMessageToNewMessagePayload,
|
|
10822
|
-
logChatPromiseExecution: () => logChatPromiseExecution,
|
|
10823
|
-
mapPollStateToResponse: () => mapPollStateToResponse,
|
|
10824
|
-
pollCompositionStateProcessors: () => pollCompositionStateProcessors,
|
|
10825
|
-
pollStateChangeValidators: () => pollStateChangeValidators,
|
|
10826
|
-
postInsights: () => postInsights,
|
|
10827
|
-
promoteChannel: () => promoteChannel,
|
|
10828
|
-
readFileAsArrayBuffer: () => readFileAsArrayBuffer,
|
|
10829
|
-
removeDiacritics: () => removeDiacritics,
|
|
10830
|
-
replaceWordWithEntity: () => replaceWordWithEntity,
|
|
10831
|
-
textIsEmpty: () => textIsEmpty,
|
|
10832
|
-
timeLeftMs: () => timeLeftMs
|
|
10664
|
+
// node_modules/es-errors/index.js
|
|
10665
|
+
var require_es_errors = __commonJS({
|
|
10666
|
+
"node_modules/es-errors/index.js"(exports2, module2) {
|
|
10667
|
+
"use strict";
|
|
10668
|
+
module2.exports = Error;
|
|
10669
|
+
}
|
|
10833
10670
|
});
|
|
10834
|
-
module.exports = __toCommonJS(index_exports);
|
|
10835
10671
|
|
|
10836
|
-
//
|
|
10837
|
-
var
|
|
10838
|
-
|
|
10839
|
-
|
|
10840
|
-
|
|
10841
|
-
function isMapStringCallback(arrayOrString, callback) {
|
|
10842
|
-
return !!callback && isString(arrayOrString);
|
|
10843
|
-
}
|
|
10844
|
-
function map(arrayOrString, callback) {
|
|
10845
|
-
const res = [];
|
|
10846
|
-
if (isString(arrayOrString) && isMapStringCallback(arrayOrString, callback)) {
|
|
10847
|
-
for (let k = 0, len = arrayOrString.length; k < len; k++) {
|
|
10848
|
-
if (arrayOrString.charAt(k)) {
|
|
10849
|
-
const kValue = arrayOrString.charAt(k);
|
|
10850
|
-
const mappedValue = callback(kValue, k, arrayOrString);
|
|
10851
|
-
res[k] = mappedValue;
|
|
10852
|
-
}
|
|
10853
|
-
}
|
|
10854
|
-
} else if (!isString(arrayOrString) && !isMapStringCallback(arrayOrString, callback)) {
|
|
10855
|
-
for (let k = 0, len = arrayOrString.length; k < len; k++) {
|
|
10856
|
-
if (k in arrayOrString) {
|
|
10857
|
-
const kValue = arrayOrString[k];
|
|
10858
|
-
const mappedValue = callback(kValue, k, arrayOrString);
|
|
10859
|
-
res[k] = mappedValue;
|
|
10860
|
-
}
|
|
10861
|
-
}
|
|
10672
|
+
// node_modules/es-errors/eval.js
|
|
10673
|
+
var require_eval = __commonJS({
|
|
10674
|
+
"node_modules/es-errors/eval.js"(exports2, module2) {
|
|
10675
|
+
"use strict";
|
|
10676
|
+
module2.exports = EvalError;
|
|
10862
10677
|
}
|
|
10863
|
-
|
|
10864
|
-
|
|
10865
|
-
|
|
10866
|
-
var
|
|
10867
|
-
|
|
10868
|
-
|
|
10869
|
-
|
|
10870
|
-
for (i = 0; i < 64; i++) {
|
|
10871
|
-
e[A.charAt(i)] = i;
|
|
10678
|
+
});
|
|
10679
|
+
|
|
10680
|
+
// node_modules/es-errors/range.js
|
|
10681
|
+
var require_range = __commonJS({
|
|
10682
|
+
"node_modules/es-errors/range.js"(exports2, module2) {
|
|
10683
|
+
"use strict";
|
|
10684
|
+
module2.exports = RangeError;
|
|
10872
10685
|
}
|
|
10873
|
-
|
|
10874
|
-
|
|
10875
|
-
|
|
10876
|
-
|
|
10877
|
-
|
|
10878
|
-
|
|
10879
|
-
|
|
10686
|
+
});
|
|
10687
|
+
|
|
10688
|
+
// node_modules/es-errors/ref.js
|
|
10689
|
+
var require_ref = __commonJS({
|
|
10690
|
+
"node_modules/es-errors/ref.js"(exports2, module2) {
|
|
10691
|
+
"use strict";
|
|
10692
|
+
module2.exports = ReferenceError;
|
|
10880
10693
|
}
|
|
10881
|
-
|
|
10882
|
-
};
|
|
10694
|
+
});
|
|
10883
10695
|
|
|
10884
|
-
//
|
|
10885
|
-
var
|
|
10886
|
-
|
|
10887
|
-
|
|
10888
|
-
|
|
10889
|
-
this.data = data;
|
|
10696
|
+
// node_modules/es-errors/syntax.js
|
|
10697
|
+
var require_syntax = __commonJS({
|
|
10698
|
+
"node_modules/es-errors/syntax.js"(exports2, module2) {
|
|
10699
|
+
"use strict";
|
|
10700
|
+
module2.exports = SyntaxError;
|
|
10890
10701
|
}
|
|
10891
|
-
|
|
10892
|
-
|
|
10893
|
-
|
|
10894
|
-
|
|
10895
|
-
|
|
10896
|
-
|
|
10897
|
-
|
|
10898
|
-
|
|
10899
|
-
|
|
10900
|
-
|
|
10901
|
-
|
|
10902
|
-
|
|
10903
|
-
|
|
10904
|
-
|
|
10905
|
-
|
|
10906
|
-
|
|
10907
|
-
|
|
10702
|
+
});
|
|
10703
|
+
|
|
10704
|
+
// node_modules/es-errors/type.js
|
|
10705
|
+
var require_type = __commonJS({
|
|
10706
|
+
"node_modules/es-errors/type.js"(exports2, module2) {
|
|
10707
|
+
"use strict";
|
|
10708
|
+
module2.exports = TypeError;
|
|
10709
|
+
}
|
|
10710
|
+
});
|
|
10711
|
+
|
|
10712
|
+
// node_modules/es-errors/uri.js
|
|
10713
|
+
var require_uri = __commonJS({
|
|
10714
|
+
"node_modules/es-errors/uri.js"(exports2, module2) {
|
|
10715
|
+
"use strict";
|
|
10716
|
+
module2.exports = URIError;
|
|
10717
|
+
}
|
|
10718
|
+
});
|
|
10719
|
+
|
|
10720
|
+
// node_modules/math-intrinsics/abs.js
|
|
10721
|
+
var require_abs = __commonJS({
|
|
10722
|
+
"node_modules/math-intrinsics/abs.js"(exports2, module2) {
|
|
10723
|
+
"use strict";
|
|
10724
|
+
module2.exports = Math.abs;
|
|
10725
|
+
}
|
|
10726
|
+
});
|
|
10727
|
+
|
|
10728
|
+
// node_modules/math-intrinsics/floor.js
|
|
10729
|
+
var require_floor = __commonJS({
|
|
10730
|
+
"node_modules/math-intrinsics/floor.js"(exports2, module2) {
|
|
10731
|
+
"use strict";
|
|
10732
|
+
module2.exports = Math.floor;
|
|
10733
|
+
}
|
|
10734
|
+
});
|
|
10735
|
+
|
|
10736
|
+
// node_modules/math-intrinsics/max.js
|
|
10737
|
+
var require_max = __commonJS({
|
|
10738
|
+
"node_modules/math-intrinsics/max.js"(exports2, module2) {
|
|
10739
|
+
"use strict";
|
|
10740
|
+
module2.exports = Math.max;
|
|
10741
|
+
}
|
|
10742
|
+
});
|
|
10743
|
+
|
|
10744
|
+
// node_modules/math-intrinsics/min.js
|
|
10745
|
+
var require_min = __commonJS({
|
|
10746
|
+
"node_modules/math-intrinsics/min.js"(exports2, module2) {
|
|
10747
|
+
"use strict";
|
|
10748
|
+
module2.exports = Math.min;
|
|
10749
|
+
}
|
|
10750
|
+
});
|
|
10751
|
+
|
|
10752
|
+
// node_modules/math-intrinsics/pow.js
|
|
10753
|
+
var require_pow = __commonJS({
|
|
10754
|
+
"node_modules/math-intrinsics/pow.js"(exports2, module2) {
|
|
10755
|
+
"use strict";
|
|
10756
|
+
module2.exports = Math.pow;
|
|
10757
|
+
}
|
|
10758
|
+
});
|
|
10759
|
+
|
|
10760
|
+
// node_modules/math-intrinsics/round.js
|
|
10761
|
+
var require_round = __commonJS({
|
|
10762
|
+
"node_modules/math-intrinsics/round.js"(exports2, module2) {
|
|
10763
|
+
"use strict";
|
|
10764
|
+
module2.exports = Math.round;
|
|
10765
|
+
}
|
|
10766
|
+
});
|
|
10767
|
+
|
|
10768
|
+
// node_modules/math-intrinsics/isNaN.js
|
|
10769
|
+
var require_isNaN = __commonJS({
|
|
10770
|
+
"node_modules/math-intrinsics/isNaN.js"(exports2, module2) {
|
|
10771
|
+
"use strict";
|
|
10772
|
+
module2.exports = Number.isNaN || function isNaN2(a) {
|
|
10773
|
+
return a !== a;
|
|
10774
|
+
};
|
|
10775
|
+
}
|
|
10776
|
+
});
|
|
10777
|
+
|
|
10778
|
+
// node_modules/math-intrinsics/sign.js
|
|
10779
|
+
var require_sign = __commonJS({
|
|
10780
|
+
"node_modules/math-intrinsics/sign.js"(exports2, module2) {
|
|
10781
|
+
"use strict";
|
|
10782
|
+
var $isNaN = require_isNaN();
|
|
10783
|
+
module2.exports = function sign(number) {
|
|
10784
|
+
if ($isNaN(number) || number === 0) {
|
|
10785
|
+
return number;
|
|
10786
|
+
}
|
|
10787
|
+
return number < 0 ? -1 : 1;
|
|
10788
|
+
};
|
|
10789
|
+
}
|
|
10790
|
+
});
|
|
10791
|
+
|
|
10792
|
+
// node_modules/gopd/gOPD.js
|
|
10793
|
+
var require_gOPD = __commonJS({
|
|
10794
|
+
"node_modules/gopd/gOPD.js"(exports2, module2) {
|
|
10795
|
+
"use strict";
|
|
10796
|
+
module2.exports = Object.getOwnPropertyDescriptor;
|
|
10797
|
+
}
|
|
10798
|
+
});
|
|
10799
|
+
|
|
10800
|
+
// node_modules/gopd/index.js
|
|
10801
|
+
var require_gopd = __commonJS({
|
|
10802
|
+
"node_modules/gopd/index.js"(exports2, module2) {
|
|
10803
|
+
"use strict";
|
|
10804
|
+
var $gOPD = require_gOPD();
|
|
10805
|
+
if ($gOPD) {
|
|
10806
|
+
try {
|
|
10807
|
+
$gOPD([], "length");
|
|
10808
|
+
} catch (e) {
|
|
10809
|
+
$gOPD = null;
|
|
10810
|
+
}
|
|
10811
|
+
}
|
|
10812
|
+
module2.exports = $gOPD;
|
|
10813
|
+
}
|
|
10814
|
+
});
|
|
10815
|
+
|
|
10816
|
+
// node_modules/es-define-property/index.js
|
|
10817
|
+
var require_es_define_property = __commonJS({
|
|
10818
|
+
"node_modules/es-define-property/index.js"(exports2, module2) {
|
|
10819
|
+
"use strict";
|
|
10820
|
+
var $defineProperty = Object.defineProperty || false;
|
|
10821
|
+
if ($defineProperty) {
|
|
10822
|
+
try {
|
|
10823
|
+
$defineProperty({}, "a", { value: 1 });
|
|
10824
|
+
} catch (e) {
|
|
10825
|
+
$defineProperty = false;
|
|
10826
|
+
}
|
|
10827
|
+
}
|
|
10828
|
+
module2.exports = $defineProperty;
|
|
10829
|
+
}
|
|
10830
|
+
});
|
|
10831
|
+
|
|
10832
|
+
// node_modules/has-symbols/shams.js
|
|
10833
|
+
var require_shams = __commonJS({
|
|
10834
|
+
"node_modules/has-symbols/shams.js"(exports2, module2) {
|
|
10835
|
+
"use strict";
|
|
10836
|
+
module2.exports = function hasSymbols() {
|
|
10837
|
+
if (typeof Symbol !== "function" || typeof Object.getOwnPropertySymbols !== "function") {
|
|
10838
|
+
return false;
|
|
10839
|
+
}
|
|
10840
|
+
if (typeof Symbol.iterator === "symbol") {
|
|
10841
|
+
return true;
|
|
10842
|
+
}
|
|
10843
|
+
var obj = {};
|
|
10844
|
+
var sym = Symbol("test");
|
|
10845
|
+
var symObj = Object(sym);
|
|
10846
|
+
if (typeof sym === "string") {
|
|
10847
|
+
return false;
|
|
10848
|
+
}
|
|
10849
|
+
if (Object.prototype.toString.call(sym) !== "[object Symbol]") {
|
|
10850
|
+
return false;
|
|
10851
|
+
}
|
|
10852
|
+
if (Object.prototype.toString.call(symObj) !== "[object Symbol]") {
|
|
10853
|
+
return false;
|
|
10854
|
+
}
|
|
10855
|
+
var symVal = 42;
|
|
10856
|
+
obj[sym] = symVal;
|
|
10857
|
+
for (var _ in obj) {
|
|
10858
|
+
return false;
|
|
10859
|
+
}
|
|
10860
|
+
if (typeof Object.keys === "function" && Object.keys(obj).length !== 0) {
|
|
10861
|
+
return false;
|
|
10862
|
+
}
|
|
10863
|
+
if (typeof Object.getOwnPropertyNames === "function" && Object.getOwnPropertyNames(obj).length !== 0) {
|
|
10864
|
+
return false;
|
|
10865
|
+
}
|
|
10866
|
+
var syms = Object.getOwnPropertySymbols(obj);
|
|
10867
|
+
if (syms.length !== 1 || syms[0] !== sym) {
|
|
10868
|
+
return false;
|
|
10869
|
+
}
|
|
10870
|
+
if (!Object.prototype.propertyIsEnumerable.call(obj, sym)) {
|
|
10871
|
+
return false;
|
|
10872
|
+
}
|
|
10873
|
+
if (typeof Object.getOwnPropertyDescriptor === "function") {
|
|
10874
|
+
var descriptor = (
|
|
10875
|
+
/** @type {PropertyDescriptor} */
|
|
10876
|
+
Object.getOwnPropertyDescriptor(obj, sym)
|
|
10877
|
+
);
|
|
10878
|
+
if (descriptor.value !== symVal || descriptor.enumerable !== true) {
|
|
10879
|
+
return false;
|
|
10880
|
+
}
|
|
10881
|
+
}
|
|
10882
|
+
return true;
|
|
10883
|
+
};
|
|
10884
|
+
}
|
|
10885
|
+
});
|
|
10886
|
+
|
|
10887
|
+
// node_modules/has-symbols/index.js
|
|
10888
|
+
var require_has_symbols = __commonJS({
|
|
10889
|
+
"node_modules/has-symbols/index.js"(exports2, module2) {
|
|
10890
|
+
"use strict";
|
|
10891
|
+
var origSymbol = typeof Symbol !== "undefined" && Symbol;
|
|
10892
|
+
var hasSymbolSham = require_shams();
|
|
10893
|
+
module2.exports = function hasNativeSymbols() {
|
|
10894
|
+
if (typeof origSymbol !== "function") {
|
|
10895
|
+
return false;
|
|
10896
|
+
}
|
|
10897
|
+
if (typeof Symbol !== "function") {
|
|
10898
|
+
return false;
|
|
10899
|
+
}
|
|
10900
|
+
if (typeof origSymbol("foo") !== "symbol") {
|
|
10901
|
+
return false;
|
|
10902
|
+
}
|
|
10903
|
+
if (typeof Symbol("bar") !== "symbol") {
|
|
10904
|
+
return false;
|
|
10905
|
+
}
|
|
10906
|
+
return hasSymbolSham();
|
|
10907
|
+
};
|
|
10908
|
+
}
|
|
10909
|
+
});
|
|
10910
|
+
|
|
10911
|
+
// node_modules/get-proto/Reflect.getPrototypeOf.js
|
|
10912
|
+
var require_Reflect_getPrototypeOf = __commonJS({
|
|
10913
|
+
"node_modules/get-proto/Reflect.getPrototypeOf.js"(exports2, module2) {
|
|
10914
|
+
"use strict";
|
|
10915
|
+
module2.exports = typeof Reflect !== "undefined" && Reflect.getPrototypeOf || null;
|
|
10916
|
+
}
|
|
10917
|
+
});
|
|
10918
|
+
|
|
10919
|
+
// node_modules/get-proto/Object.getPrototypeOf.js
|
|
10920
|
+
var require_Object_getPrototypeOf = __commonJS({
|
|
10921
|
+
"node_modules/get-proto/Object.getPrototypeOf.js"(exports2, module2) {
|
|
10922
|
+
"use strict";
|
|
10923
|
+
var $Object = require_es_object_atoms();
|
|
10924
|
+
module2.exports = $Object.getPrototypeOf || null;
|
|
10925
|
+
}
|
|
10926
|
+
});
|
|
10927
|
+
|
|
10928
|
+
// node_modules/function-bind/implementation.js
|
|
10929
|
+
var require_implementation = __commonJS({
|
|
10930
|
+
"node_modules/function-bind/implementation.js"(exports2, module2) {
|
|
10931
|
+
"use strict";
|
|
10932
|
+
var ERROR_MESSAGE = "Function.prototype.bind called on incompatible ";
|
|
10933
|
+
var toStr = Object.prototype.toString;
|
|
10934
|
+
var max = Math.max;
|
|
10935
|
+
var funcType = "[object Function]";
|
|
10936
|
+
var concatty = function concatty2(a, b) {
|
|
10937
|
+
var arr = [];
|
|
10938
|
+
for (var i = 0; i < a.length; i += 1) {
|
|
10939
|
+
arr[i] = a[i];
|
|
10940
|
+
}
|
|
10941
|
+
for (var j = 0; j < b.length; j += 1) {
|
|
10942
|
+
arr[j + a.length] = b[j];
|
|
10943
|
+
}
|
|
10944
|
+
return arr;
|
|
10945
|
+
};
|
|
10946
|
+
var slicy = function slicy2(arrLike, offset) {
|
|
10947
|
+
var arr = [];
|
|
10948
|
+
for (var i = offset || 0, j = 0; i < arrLike.length; i += 1, j += 1) {
|
|
10949
|
+
arr[j] = arrLike[i];
|
|
10950
|
+
}
|
|
10951
|
+
return arr;
|
|
10952
|
+
};
|
|
10953
|
+
var joiny = function(arr, joiner) {
|
|
10954
|
+
var str = "";
|
|
10955
|
+
for (var i = 0; i < arr.length; i += 1) {
|
|
10956
|
+
str += arr[i];
|
|
10957
|
+
if (i + 1 < arr.length) {
|
|
10958
|
+
str += joiner;
|
|
10959
|
+
}
|
|
10960
|
+
}
|
|
10961
|
+
return str;
|
|
10962
|
+
};
|
|
10963
|
+
module2.exports = function bind2(that) {
|
|
10964
|
+
var target = this;
|
|
10965
|
+
if (typeof target !== "function" || toStr.apply(target) !== funcType) {
|
|
10966
|
+
throw new TypeError(ERROR_MESSAGE + target);
|
|
10967
|
+
}
|
|
10968
|
+
var args = slicy(arguments, 1);
|
|
10969
|
+
var bound;
|
|
10970
|
+
var binder = function() {
|
|
10971
|
+
if (this instanceof bound) {
|
|
10972
|
+
var result = target.apply(
|
|
10973
|
+
this,
|
|
10974
|
+
concatty(args, arguments)
|
|
10975
|
+
);
|
|
10976
|
+
if (Object(result) === result) {
|
|
10977
|
+
return result;
|
|
10978
|
+
}
|
|
10979
|
+
return this;
|
|
10980
|
+
}
|
|
10981
|
+
return target.apply(
|
|
10982
|
+
that,
|
|
10983
|
+
concatty(args, arguments)
|
|
10984
|
+
);
|
|
10985
|
+
};
|
|
10986
|
+
var boundLength = max(0, target.length - args.length);
|
|
10987
|
+
var boundArgs = [];
|
|
10988
|
+
for (var i = 0; i < boundLength; i++) {
|
|
10989
|
+
boundArgs[i] = "$" + i;
|
|
10990
|
+
}
|
|
10991
|
+
bound = Function("binder", "return function (" + joiny(boundArgs, ",") + "){ return binder.apply(this,arguments); }")(binder);
|
|
10992
|
+
if (target.prototype) {
|
|
10993
|
+
var Empty = function Empty2() {
|
|
10994
|
+
};
|
|
10995
|
+
Empty.prototype = target.prototype;
|
|
10996
|
+
bound.prototype = new Empty();
|
|
10997
|
+
Empty.prototype = null;
|
|
10998
|
+
}
|
|
10999
|
+
return bound;
|
|
11000
|
+
};
|
|
11001
|
+
}
|
|
11002
|
+
});
|
|
11003
|
+
|
|
11004
|
+
// node_modules/function-bind/index.js
|
|
11005
|
+
var require_function_bind = __commonJS({
|
|
11006
|
+
"node_modules/function-bind/index.js"(exports2, module2) {
|
|
11007
|
+
"use strict";
|
|
11008
|
+
var implementation = require_implementation();
|
|
11009
|
+
module2.exports = Function.prototype.bind || implementation;
|
|
11010
|
+
}
|
|
11011
|
+
});
|
|
11012
|
+
|
|
11013
|
+
// node_modules/call-bind-apply-helpers/functionCall.js
|
|
11014
|
+
var require_functionCall = __commonJS({
|
|
11015
|
+
"node_modules/call-bind-apply-helpers/functionCall.js"(exports2, module2) {
|
|
11016
|
+
"use strict";
|
|
11017
|
+
module2.exports = Function.prototype.call;
|
|
11018
|
+
}
|
|
11019
|
+
});
|
|
11020
|
+
|
|
11021
|
+
// node_modules/call-bind-apply-helpers/functionApply.js
|
|
11022
|
+
var require_functionApply = __commonJS({
|
|
11023
|
+
"node_modules/call-bind-apply-helpers/functionApply.js"(exports2, module2) {
|
|
11024
|
+
"use strict";
|
|
11025
|
+
module2.exports = Function.prototype.apply;
|
|
11026
|
+
}
|
|
11027
|
+
});
|
|
11028
|
+
|
|
11029
|
+
// node_modules/call-bind-apply-helpers/reflectApply.js
|
|
11030
|
+
var require_reflectApply = __commonJS({
|
|
11031
|
+
"node_modules/call-bind-apply-helpers/reflectApply.js"(exports2, module2) {
|
|
11032
|
+
"use strict";
|
|
11033
|
+
module2.exports = typeof Reflect !== "undefined" && Reflect && Reflect.apply;
|
|
11034
|
+
}
|
|
11035
|
+
});
|
|
11036
|
+
|
|
11037
|
+
// node_modules/call-bind-apply-helpers/actualApply.js
|
|
11038
|
+
var require_actualApply = __commonJS({
|
|
11039
|
+
"node_modules/call-bind-apply-helpers/actualApply.js"(exports2, module2) {
|
|
11040
|
+
"use strict";
|
|
11041
|
+
var bind2 = require_function_bind();
|
|
11042
|
+
var $apply = require_functionApply();
|
|
11043
|
+
var $call = require_functionCall();
|
|
11044
|
+
var $reflectApply = require_reflectApply();
|
|
11045
|
+
module2.exports = $reflectApply || bind2.call($call, $apply);
|
|
11046
|
+
}
|
|
11047
|
+
});
|
|
11048
|
+
|
|
11049
|
+
// node_modules/call-bind-apply-helpers/index.js
|
|
11050
|
+
var require_call_bind_apply_helpers = __commonJS({
|
|
11051
|
+
"node_modules/call-bind-apply-helpers/index.js"(exports2, module2) {
|
|
11052
|
+
"use strict";
|
|
11053
|
+
var bind2 = require_function_bind();
|
|
11054
|
+
var $TypeError = require_type();
|
|
11055
|
+
var $call = require_functionCall();
|
|
11056
|
+
var $actualApply = require_actualApply();
|
|
11057
|
+
module2.exports = function callBindBasic(args) {
|
|
11058
|
+
if (args.length < 1 || typeof args[0] !== "function") {
|
|
11059
|
+
throw new $TypeError("a function is required");
|
|
11060
|
+
}
|
|
11061
|
+
return $actualApply(bind2, $call, args);
|
|
11062
|
+
};
|
|
11063
|
+
}
|
|
11064
|
+
});
|
|
11065
|
+
|
|
11066
|
+
// node_modules/dunder-proto/get.js
|
|
11067
|
+
var require_get = __commonJS({
|
|
11068
|
+
"node_modules/dunder-proto/get.js"(exports2, module2) {
|
|
11069
|
+
"use strict";
|
|
11070
|
+
var callBind = require_call_bind_apply_helpers();
|
|
11071
|
+
var gOPD = require_gopd();
|
|
11072
|
+
var hasProtoAccessor;
|
|
11073
|
+
try {
|
|
11074
|
+
hasProtoAccessor = /** @type {{ __proto__?: typeof Array.prototype }} */
|
|
11075
|
+
[].__proto__ === Array.prototype;
|
|
11076
|
+
} catch (e) {
|
|
11077
|
+
if (!e || typeof e !== "object" || !("code" in e) || e.code !== "ERR_PROTO_ACCESS") {
|
|
11078
|
+
throw e;
|
|
11079
|
+
}
|
|
11080
|
+
}
|
|
11081
|
+
var desc = !!hasProtoAccessor && gOPD && gOPD(
|
|
11082
|
+
Object.prototype,
|
|
11083
|
+
/** @type {keyof typeof Object.prototype} */
|
|
11084
|
+
"__proto__"
|
|
11085
|
+
);
|
|
11086
|
+
var $Object = Object;
|
|
11087
|
+
var $getPrototypeOf = $Object.getPrototypeOf;
|
|
11088
|
+
module2.exports = desc && typeof desc.get === "function" ? callBind([desc.get]) : typeof $getPrototypeOf === "function" ? (
|
|
11089
|
+
/** @type {import('./get')} */
|
|
11090
|
+
function getDunder(value) {
|
|
11091
|
+
return $getPrototypeOf(value == null ? value : $Object(value));
|
|
11092
|
+
}
|
|
11093
|
+
) : false;
|
|
11094
|
+
}
|
|
11095
|
+
});
|
|
11096
|
+
|
|
11097
|
+
// node_modules/get-proto/index.js
|
|
11098
|
+
var require_get_proto = __commonJS({
|
|
11099
|
+
"node_modules/get-proto/index.js"(exports2, module2) {
|
|
11100
|
+
"use strict";
|
|
11101
|
+
var reflectGetProto = require_Reflect_getPrototypeOf();
|
|
11102
|
+
var originalGetProto = require_Object_getPrototypeOf();
|
|
11103
|
+
var getDunderProto = require_get();
|
|
11104
|
+
module2.exports = reflectGetProto ? function getProto(O) {
|
|
11105
|
+
return reflectGetProto(O);
|
|
11106
|
+
} : originalGetProto ? function getProto(O) {
|
|
11107
|
+
if (!O || typeof O !== "object" && typeof O !== "function") {
|
|
11108
|
+
throw new TypeError("getProto: not an object");
|
|
11109
|
+
}
|
|
11110
|
+
return originalGetProto(O);
|
|
11111
|
+
} : getDunderProto ? function getProto(O) {
|
|
11112
|
+
return getDunderProto(O);
|
|
11113
|
+
} : null;
|
|
11114
|
+
}
|
|
11115
|
+
});
|
|
11116
|
+
|
|
11117
|
+
// node_modules/hasown/index.js
|
|
11118
|
+
var require_hasown = __commonJS({
|
|
11119
|
+
"node_modules/hasown/index.js"(exports2, module2) {
|
|
11120
|
+
"use strict";
|
|
11121
|
+
var call = Function.prototype.call;
|
|
11122
|
+
var $hasOwn = Object.prototype.hasOwnProperty;
|
|
11123
|
+
var bind2 = require_function_bind();
|
|
11124
|
+
module2.exports = bind2.call(call, $hasOwn);
|
|
11125
|
+
}
|
|
11126
|
+
});
|
|
11127
|
+
|
|
11128
|
+
// node_modules/get-intrinsic/index.js
|
|
11129
|
+
var require_get_intrinsic = __commonJS({
|
|
11130
|
+
"node_modules/get-intrinsic/index.js"(exports2, module2) {
|
|
11131
|
+
"use strict";
|
|
11132
|
+
var undefined2;
|
|
11133
|
+
var $Object = require_es_object_atoms();
|
|
11134
|
+
var $Error = require_es_errors();
|
|
11135
|
+
var $EvalError = require_eval();
|
|
11136
|
+
var $RangeError = require_range();
|
|
11137
|
+
var $ReferenceError = require_ref();
|
|
11138
|
+
var $SyntaxError = require_syntax();
|
|
11139
|
+
var $TypeError = require_type();
|
|
11140
|
+
var $URIError = require_uri();
|
|
11141
|
+
var abs = require_abs();
|
|
11142
|
+
var floor = require_floor();
|
|
11143
|
+
var max = require_max();
|
|
11144
|
+
var min = require_min();
|
|
11145
|
+
var pow = require_pow();
|
|
11146
|
+
var round = require_round();
|
|
11147
|
+
var sign = require_sign();
|
|
11148
|
+
var $Function = Function;
|
|
11149
|
+
var getEvalledConstructor = function(expressionSyntax) {
|
|
11150
|
+
try {
|
|
11151
|
+
return $Function('"use strict"; return (' + expressionSyntax + ").constructor;")();
|
|
11152
|
+
} catch (e) {
|
|
11153
|
+
}
|
|
11154
|
+
};
|
|
11155
|
+
var $gOPD = require_gopd();
|
|
11156
|
+
var $defineProperty = require_es_define_property();
|
|
11157
|
+
var throwTypeError = function() {
|
|
11158
|
+
throw new $TypeError();
|
|
11159
|
+
};
|
|
11160
|
+
var ThrowTypeError = $gOPD ? function() {
|
|
11161
|
+
try {
|
|
11162
|
+
arguments.callee;
|
|
11163
|
+
return throwTypeError;
|
|
11164
|
+
} catch (calleeThrows) {
|
|
11165
|
+
try {
|
|
11166
|
+
return $gOPD(arguments, "callee").get;
|
|
11167
|
+
} catch (gOPDthrows) {
|
|
11168
|
+
return throwTypeError;
|
|
11169
|
+
}
|
|
11170
|
+
}
|
|
11171
|
+
}() : throwTypeError;
|
|
11172
|
+
var hasSymbols = require_has_symbols()();
|
|
11173
|
+
var getProto = require_get_proto();
|
|
11174
|
+
var $ObjectGPO = require_Object_getPrototypeOf();
|
|
11175
|
+
var $ReflectGPO = require_Reflect_getPrototypeOf();
|
|
11176
|
+
var $apply = require_functionApply();
|
|
11177
|
+
var $call = require_functionCall();
|
|
11178
|
+
var needsEval = {};
|
|
11179
|
+
var TypedArray = typeof Uint8Array === "undefined" || !getProto ? undefined2 : getProto(Uint8Array);
|
|
11180
|
+
var INTRINSICS = {
|
|
11181
|
+
__proto__: null,
|
|
11182
|
+
"%AggregateError%": typeof AggregateError === "undefined" ? undefined2 : AggregateError,
|
|
11183
|
+
"%Array%": Array,
|
|
11184
|
+
"%ArrayBuffer%": typeof ArrayBuffer === "undefined" ? undefined2 : ArrayBuffer,
|
|
11185
|
+
"%ArrayIteratorPrototype%": hasSymbols && getProto ? getProto([][Symbol.iterator]()) : undefined2,
|
|
11186
|
+
"%AsyncFromSyncIteratorPrototype%": undefined2,
|
|
11187
|
+
"%AsyncFunction%": needsEval,
|
|
11188
|
+
"%AsyncGenerator%": needsEval,
|
|
11189
|
+
"%AsyncGeneratorFunction%": needsEval,
|
|
11190
|
+
"%AsyncIteratorPrototype%": needsEval,
|
|
11191
|
+
"%Atomics%": typeof Atomics === "undefined" ? undefined2 : Atomics,
|
|
11192
|
+
"%BigInt%": typeof BigInt === "undefined" ? undefined2 : BigInt,
|
|
11193
|
+
"%BigInt64Array%": typeof BigInt64Array === "undefined" ? undefined2 : BigInt64Array,
|
|
11194
|
+
"%BigUint64Array%": typeof BigUint64Array === "undefined" ? undefined2 : BigUint64Array,
|
|
11195
|
+
"%Boolean%": Boolean,
|
|
11196
|
+
"%DataView%": typeof DataView === "undefined" ? undefined2 : DataView,
|
|
11197
|
+
"%Date%": Date,
|
|
11198
|
+
"%decodeURI%": decodeURI,
|
|
11199
|
+
"%decodeURIComponent%": decodeURIComponent,
|
|
11200
|
+
"%encodeURI%": encodeURI,
|
|
11201
|
+
"%encodeURIComponent%": encodeURIComponent,
|
|
11202
|
+
"%Error%": $Error,
|
|
11203
|
+
"%eval%": eval,
|
|
11204
|
+
// eslint-disable-line no-eval
|
|
11205
|
+
"%EvalError%": $EvalError,
|
|
11206
|
+
"%Float16Array%": typeof Float16Array === "undefined" ? undefined2 : Float16Array,
|
|
11207
|
+
"%Float32Array%": typeof Float32Array === "undefined" ? undefined2 : Float32Array,
|
|
11208
|
+
"%Float64Array%": typeof Float64Array === "undefined" ? undefined2 : Float64Array,
|
|
11209
|
+
"%FinalizationRegistry%": typeof FinalizationRegistry === "undefined" ? undefined2 : FinalizationRegistry,
|
|
11210
|
+
"%Function%": $Function,
|
|
11211
|
+
"%GeneratorFunction%": needsEval,
|
|
11212
|
+
"%Int8Array%": typeof Int8Array === "undefined" ? undefined2 : Int8Array,
|
|
11213
|
+
"%Int16Array%": typeof Int16Array === "undefined" ? undefined2 : Int16Array,
|
|
11214
|
+
"%Int32Array%": typeof Int32Array === "undefined" ? undefined2 : Int32Array,
|
|
11215
|
+
"%isFinite%": isFinite,
|
|
11216
|
+
"%isNaN%": isNaN,
|
|
11217
|
+
"%IteratorPrototype%": hasSymbols && getProto ? getProto(getProto([][Symbol.iterator]())) : undefined2,
|
|
11218
|
+
"%JSON%": typeof JSON === "object" ? JSON : undefined2,
|
|
11219
|
+
"%Map%": typeof Map === "undefined" ? undefined2 : Map,
|
|
11220
|
+
"%MapIteratorPrototype%": typeof Map === "undefined" || !hasSymbols || !getProto ? undefined2 : getProto((/* @__PURE__ */ new Map())[Symbol.iterator]()),
|
|
11221
|
+
"%Math%": Math,
|
|
11222
|
+
"%Number%": Number,
|
|
11223
|
+
"%Object%": $Object,
|
|
11224
|
+
"%Object.getOwnPropertyDescriptor%": $gOPD,
|
|
11225
|
+
"%parseFloat%": parseFloat,
|
|
11226
|
+
"%parseInt%": parseInt,
|
|
11227
|
+
"%Promise%": typeof Promise === "undefined" ? undefined2 : Promise,
|
|
11228
|
+
"%Proxy%": typeof Proxy === "undefined" ? undefined2 : Proxy,
|
|
11229
|
+
"%RangeError%": $RangeError,
|
|
11230
|
+
"%ReferenceError%": $ReferenceError,
|
|
11231
|
+
"%Reflect%": typeof Reflect === "undefined" ? undefined2 : Reflect,
|
|
11232
|
+
"%RegExp%": RegExp,
|
|
11233
|
+
"%Set%": typeof Set === "undefined" ? undefined2 : Set,
|
|
11234
|
+
"%SetIteratorPrototype%": typeof Set === "undefined" || !hasSymbols || !getProto ? undefined2 : getProto((/* @__PURE__ */ new Set())[Symbol.iterator]()),
|
|
11235
|
+
"%SharedArrayBuffer%": typeof SharedArrayBuffer === "undefined" ? undefined2 : SharedArrayBuffer,
|
|
11236
|
+
"%String%": String,
|
|
11237
|
+
"%StringIteratorPrototype%": hasSymbols && getProto ? getProto(""[Symbol.iterator]()) : undefined2,
|
|
11238
|
+
"%Symbol%": hasSymbols ? Symbol : undefined2,
|
|
11239
|
+
"%SyntaxError%": $SyntaxError,
|
|
11240
|
+
"%ThrowTypeError%": ThrowTypeError,
|
|
11241
|
+
"%TypedArray%": TypedArray,
|
|
11242
|
+
"%TypeError%": $TypeError,
|
|
11243
|
+
"%Uint8Array%": typeof Uint8Array === "undefined" ? undefined2 : Uint8Array,
|
|
11244
|
+
"%Uint8ClampedArray%": typeof Uint8ClampedArray === "undefined" ? undefined2 : Uint8ClampedArray,
|
|
11245
|
+
"%Uint16Array%": typeof Uint16Array === "undefined" ? undefined2 : Uint16Array,
|
|
11246
|
+
"%Uint32Array%": typeof Uint32Array === "undefined" ? undefined2 : Uint32Array,
|
|
11247
|
+
"%URIError%": $URIError,
|
|
11248
|
+
"%WeakMap%": typeof WeakMap === "undefined" ? undefined2 : WeakMap,
|
|
11249
|
+
"%WeakRef%": typeof WeakRef === "undefined" ? undefined2 : WeakRef,
|
|
11250
|
+
"%WeakSet%": typeof WeakSet === "undefined" ? undefined2 : WeakSet,
|
|
11251
|
+
"%Function.prototype.call%": $call,
|
|
11252
|
+
"%Function.prototype.apply%": $apply,
|
|
11253
|
+
"%Object.defineProperty%": $defineProperty,
|
|
11254
|
+
"%Object.getPrototypeOf%": $ObjectGPO,
|
|
11255
|
+
"%Math.abs%": abs,
|
|
11256
|
+
"%Math.floor%": floor,
|
|
11257
|
+
"%Math.max%": max,
|
|
11258
|
+
"%Math.min%": min,
|
|
11259
|
+
"%Math.pow%": pow,
|
|
11260
|
+
"%Math.round%": round,
|
|
11261
|
+
"%Math.sign%": sign,
|
|
11262
|
+
"%Reflect.getPrototypeOf%": $ReflectGPO
|
|
11263
|
+
};
|
|
11264
|
+
if (getProto) {
|
|
11265
|
+
try {
|
|
11266
|
+
null.error;
|
|
11267
|
+
} catch (e) {
|
|
11268
|
+
errorProto = getProto(getProto(e));
|
|
11269
|
+
INTRINSICS["%Error.prototype%"] = errorProto;
|
|
11270
|
+
}
|
|
11271
|
+
}
|
|
11272
|
+
var errorProto;
|
|
11273
|
+
var doEval = function doEval2(name) {
|
|
11274
|
+
var value;
|
|
11275
|
+
if (name === "%AsyncFunction%") {
|
|
11276
|
+
value = getEvalledConstructor("async function () {}");
|
|
11277
|
+
} else if (name === "%GeneratorFunction%") {
|
|
11278
|
+
value = getEvalledConstructor("function* () {}");
|
|
11279
|
+
} else if (name === "%AsyncGeneratorFunction%") {
|
|
11280
|
+
value = getEvalledConstructor("async function* () {}");
|
|
11281
|
+
} else if (name === "%AsyncGenerator%") {
|
|
11282
|
+
var fn = doEval2("%AsyncGeneratorFunction%");
|
|
11283
|
+
if (fn) {
|
|
11284
|
+
value = fn.prototype;
|
|
11285
|
+
}
|
|
11286
|
+
} else if (name === "%AsyncIteratorPrototype%") {
|
|
11287
|
+
var gen = doEval2("%AsyncGenerator%");
|
|
11288
|
+
if (gen && getProto) {
|
|
11289
|
+
value = getProto(gen.prototype);
|
|
11290
|
+
}
|
|
11291
|
+
}
|
|
11292
|
+
INTRINSICS[name] = value;
|
|
11293
|
+
return value;
|
|
11294
|
+
};
|
|
11295
|
+
var LEGACY_ALIASES = {
|
|
11296
|
+
__proto__: null,
|
|
11297
|
+
"%ArrayBufferPrototype%": ["ArrayBuffer", "prototype"],
|
|
11298
|
+
"%ArrayPrototype%": ["Array", "prototype"],
|
|
11299
|
+
"%ArrayProto_entries%": ["Array", "prototype", "entries"],
|
|
11300
|
+
"%ArrayProto_forEach%": ["Array", "prototype", "forEach"],
|
|
11301
|
+
"%ArrayProto_keys%": ["Array", "prototype", "keys"],
|
|
11302
|
+
"%ArrayProto_values%": ["Array", "prototype", "values"],
|
|
11303
|
+
"%AsyncFunctionPrototype%": ["AsyncFunction", "prototype"],
|
|
11304
|
+
"%AsyncGenerator%": ["AsyncGeneratorFunction", "prototype"],
|
|
11305
|
+
"%AsyncGeneratorPrototype%": ["AsyncGeneratorFunction", "prototype", "prototype"],
|
|
11306
|
+
"%BooleanPrototype%": ["Boolean", "prototype"],
|
|
11307
|
+
"%DataViewPrototype%": ["DataView", "prototype"],
|
|
11308
|
+
"%DatePrototype%": ["Date", "prototype"],
|
|
11309
|
+
"%ErrorPrototype%": ["Error", "prototype"],
|
|
11310
|
+
"%EvalErrorPrototype%": ["EvalError", "prototype"],
|
|
11311
|
+
"%Float32ArrayPrototype%": ["Float32Array", "prototype"],
|
|
11312
|
+
"%Float64ArrayPrototype%": ["Float64Array", "prototype"],
|
|
11313
|
+
"%FunctionPrototype%": ["Function", "prototype"],
|
|
11314
|
+
"%Generator%": ["GeneratorFunction", "prototype"],
|
|
11315
|
+
"%GeneratorPrototype%": ["GeneratorFunction", "prototype", "prototype"],
|
|
11316
|
+
"%Int8ArrayPrototype%": ["Int8Array", "prototype"],
|
|
11317
|
+
"%Int16ArrayPrototype%": ["Int16Array", "prototype"],
|
|
11318
|
+
"%Int32ArrayPrototype%": ["Int32Array", "prototype"],
|
|
11319
|
+
"%JSONParse%": ["JSON", "parse"],
|
|
11320
|
+
"%JSONStringify%": ["JSON", "stringify"],
|
|
11321
|
+
"%MapPrototype%": ["Map", "prototype"],
|
|
11322
|
+
"%NumberPrototype%": ["Number", "prototype"],
|
|
11323
|
+
"%ObjectPrototype%": ["Object", "prototype"],
|
|
11324
|
+
"%ObjProto_toString%": ["Object", "prototype", "toString"],
|
|
11325
|
+
"%ObjProto_valueOf%": ["Object", "prototype", "valueOf"],
|
|
11326
|
+
"%PromisePrototype%": ["Promise", "prototype"],
|
|
11327
|
+
"%PromiseProto_then%": ["Promise", "prototype", "then"],
|
|
11328
|
+
"%Promise_all%": ["Promise", "all"],
|
|
11329
|
+
"%Promise_reject%": ["Promise", "reject"],
|
|
11330
|
+
"%Promise_resolve%": ["Promise", "resolve"],
|
|
11331
|
+
"%RangeErrorPrototype%": ["RangeError", "prototype"],
|
|
11332
|
+
"%ReferenceErrorPrototype%": ["ReferenceError", "prototype"],
|
|
11333
|
+
"%RegExpPrototype%": ["RegExp", "prototype"],
|
|
11334
|
+
"%SetPrototype%": ["Set", "prototype"],
|
|
11335
|
+
"%SharedArrayBufferPrototype%": ["SharedArrayBuffer", "prototype"],
|
|
11336
|
+
"%StringPrototype%": ["String", "prototype"],
|
|
11337
|
+
"%SymbolPrototype%": ["Symbol", "prototype"],
|
|
11338
|
+
"%SyntaxErrorPrototype%": ["SyntaxError", "prototype"],
|
|
11339
|
+
"%TypedArrayPrototype%": ["TypedArray", "prototype"],
|
|
11340
|
+
"%TypeErrorPrototype%": ["TypeError", "prototype"],
|
|
11341
|
+
"%Uint8ArrayPrototype%": ["Uint8Array", "prototype"],
|
|
11342
|
+
"%Uint8ClampedArrayPrototype%": ["Uint8ClampedArray", "prototype"],
|
|
11343
|
+
"%Uint16ArrayPrototype%": ["Uint16Array", "prototype"],
|
|
11344
|
+
"%Uint32ArrayPrototype%": ["Uint32Array", "prototype"],
|
|
11345
|
+
"%URIErrorPrototype%": ["URIError", "prototype"],
|
|
11346
|
+
"%WeakMapPrototype%": ["WeakMap", "prototype"],
|
|
11347
|
+
"%WeakSetPrototype%": ["WeakSet", "prototype"]
|
|
11348
|
+
};
|
|
11349
|
+
var bind2 = require_function_bind();
|
|
11350
|
+
var hasOwn = require_hasown();
|
|
11351
|
+
var $concat = bind2.call($call, Array.prototype.concat);
|
|
11352
|
+
var $spliceApply = bind2.call($apply, Array.prototype.splice);
|
|
11353
|
+
var $replace = bind2.call($call, String.prototype.replace);
|
|
11354
|
+
var $strSlice = bind2.call($call, String.prototype.slice);
|
|
11355
|
+
var $exec = bind2.call($call, RegExp.prototype.exec);
|
|
11356
|
+
var rePropName = /[^%.[\]]+|\[(?:(-?\d+(?:\.\d+)?)|(["'])((?:(?!\2)[^\\]|\\.)*?)\2)\]|(?=(?:\.|\[\])(?:\.|\[\]|%$))/g;
|
|
11357
|
+
var reEscapeChar = /\\(\\)?/g;
|
|
11358
|
+
var stringToPath = function stringToPath2(string) {
|
|
11359
|
+
var first = $strSlice(string, 0, 1);
|
|
11360
|
+
var last = $strSlice(string, -1);
|
|
11361
|
+
if (first === "%" && last !== "%") {
|
|
11362
|
+
throw new $SyntaxError("invalid intrinsic syntax, expected closing `%`");
|
|
11363
|
+
} else if (last === "%" && first !== "%") {
|
|
11364
|
+
throw new $SyntaxError("invalid intrinsic syntax, expected opening `%`");
|
|
11365
|
+
}
|
|
11366
|
+
var result = [];
|
|
11367
|
+
$replace(string, rePropName, function(match, number, quote, subString) {
|
|
11368
|
+
result[result.length] = quote ? $replace(subString, reEscapeChar, "$1") : number || match;
|
|
11369
|
+
});
|
|
11370
|
+
return result;
|
|
11371
|
+
};
|
|
11372
|
+
var getBaseIntrinsic = function getBaseIntrinsic2(name, allowMissing) {
|
|
11373
|
+
var intrinsicName = name;
|
|
11374
|
+
var alias;
|
|
11375
|
+
if (hasOwn(LEGACY_ALIASES, intrinsicName)) {
|
|
11376
|
+
alias = LEGACY_ALIASES[intrinsicName];
|
|
11377
|
+
intrinsicName = "%" + alias[0] + "%";
|
|
11378
|
+
}
|
|
11379
|
+
if (hasOwn(INTRINSICS, intrinsicName)) {
|
|
11380
|
+
var value = INTRINSICS[intrinsicName];
|
|
11381
|
+
if (value === needsEval) {
|
|
11382
|
+
value = doEval(intrinsicName);
|
|
11383
|
+
}
|
|
11384
|
+
if (typeof value === "undefined" && !allowMissing) {
|
|
11385
|
+
throw new $TypeError("intrinsic " + name + " exists, but is not available. Please file an issue!");
|
|
11386
|
+
}
|
|
11387
|
+
return {
|
|
11388
|
+
alias,
|
|
11389
|
+
name: intrinsicName,
|
|
11390
|
+
value
|
|
11391
|
+
};
|
|
11392
|
+
}
|
|
11393
|
+
throw new $SyntaxError("intrinsic " + name + " does not exist!");
|
|
11394
|
+
};
|
|
11395
|
+
module2.exports = function GetIntrinsic(name, allowMissing) {
|
|
11396
|
+
if (typeof name !== "string" || name.length === 0) {
|
|
11397
|
+
throw new $TypeError("intrinsic name must be a non-empty string");
|
|
11398
|
+
}
|
|
11399
|
+
if (arguments.length > 1 && typeof allowMissing !== "boolean") {
|
|
11400
|
+
throw new $TypeError('"allowMissing" argument must be a boolean');
|
|
11401
|
+
}
|
|
11402
|
+
if ($exec(/^%?[^%]*%?$/, name) === null) {
|
|
11403
|
+
throw new $SyntaxError("`%` may not be present anywhere but at the beginning and end of the intrinsic name");
|
|
11404
|
+
}
|
|
11405
|
+
var parts = stringToPath(name);
|
|
11406
|
+
var intrinsicBaseName = parts.length > 0 ? parts[0] : "";
|
|
11407
|
+
var intrinsic = getBaseIntrinsic("%" + intrinsicBaseName + "%", allowMissing);
|
|
11408
|
+
var intrinsicRealName = intrinsic.name;
|
|
11409
|
+
var value = intrinsic.value;
|
|
11410
|
+
var skipFurtherCaching = false;
|
|
11411
|
+
var alias = intrinsic.alias;
|
|
11412
|
+
if (alias) {
|
|
11413
|
+
intrinsicBaseName = alias[0];
|
|
11414
|
+
$spliceApply(parts, $concat([0, 1], alias));
|
|
11415
|
+
}
|
|
11416
|
+
for (var i = 1, isOwn = true; i < parts.length; i += 1) {
|
|
11417
|
+
var part = parts[i];
|
|
11418
|
+
var first = $strSlice(part, 0, 1);
|
|
11419
|
+
var last = $strSlice(part, -1);
|
|
11420
|
+
if ((first === '"' || first === "'" || first === "`" || (last === '"' || last === "'" || last === "`")) && first !== last) {
|
|
11421
|
+
throw new $SyntaxError("property names with quotes must have matching quotes");
|
|
11422
|
+
}
|
|
11423
|
+
if (part === "constructor" || !isOwn) {
|
|
11424
|
+
skipFurtherCaching = true;
|
|
11425
|
+
}
|
|
11426
|
+
intrinsicBaseName += "." + part;
|
|
11427
|
+
intrinsicRealName = "%" + intrinsicBaseName + "%";
|
|
11428
|
+
if (hasOwn(INTRINSICS, intrinsicRealName)) {
|
|
11429
|
+
value = INTRINSICS[intrinsicRealName];
|
|
11430
|
+
} else if (value != null) {
|
|
11431
|
+
if (!(part in value)) {
|
|
11432
|
+
if (!allowMissing) {
|
|
11433
|
+
throw new $TypeError("base intrinsic for " + name + " exists, but the property is not available.");
|
|
11434
|
+
}
|
|
11435
|
+
return void undefined2;
|
|
11436
|
+
}
|
|
11437
|
+
if ($gOPD && i + 1 >= parts.length) {
|
|
11438
|
+
var desc = $gOPD(value, part);
|
|
11439
|
+
isOwn = !!desc;
|
|
11440
|
+
if (isOwn && "get" in desc && !("originalValue" in desc.get)) {
|
|
11441
|
+
value = desc.get;
|
|
11442
|
+
} else {
|
|
11443
|
+
value = value[part];
|
|
11444
|
+
}
|
|
11445
|
+
} else {
|
|
11446
|
+
isOwn = hasOwn(value, part);
|
|
11447
|
+
value = value[part];
|
|
11448
|
+
}
|
|
11449
|
+
if (isOwn && !skipFurtherCaching) {
|
|
11450
|
+
INTRINSICS[intrinsicRealName] = value;
|
|
11451
|
+
}
|
|
11452
|
+
}
|
|
11453
|
+
}
|
|
11454
|
+
return value;
|
|
11455
|
+
};
|
|
11456
|
+
}
|
|
11457
|
+
});
|
|
11458
|
+
|
|
11459
|
+
// node_modules/has-tostringtag/shams.js
|
|
11460
|
+
var require_shams2 = __commonJS({
|
|
11461
|
+
"node_modules/has-tostringtag/shams.js"(exports2, module2) {
|
|
11462
|
+
"use strict";
|
|
11463
|
+
var hasSymbols = require_shams();
|
|
11464
|
+
module2.exports = function hasToStringTagShams() {
|
|
11465
|
+
return hasSymbols() && !!Symbol.toStringTag;
|
|
11466
|
+
};
|
|
11467
|
+
}
|
|
11468
|
+
});
|
|
11469
|
+
|
|
11470
|
+
// node_modules/es-set-tostringtag/index.js
|
|
11471
|
+
var require_es_set_tostringtag = __commonJS({
|
|
11472
|
+
"node_modules/es-set-tostringtag/index.js"(exports2, module2) {
|
|
11473
|
+
"use strict";
|
|
11474
|
+
var GetIntrinsic = require_get_intrinsic();
|
|
11475
|
+
var $defineProperty = GetIntrinsic("%Object.defineProperty%", true);
|
|
11476
|
+
var hasToStringTag = require_shams2()();
|
|
11477
|
+
var hasOwn = require_hasown();
|
|
11478
|
+
var $TypeError = require_type();
|
|
11479
|
+
var toStringTag = hasToStringTag ? Symbol.toStringTag : null;
|
|
11480
|
+
module2.exports = function setToStringTag(object, value) {
|
|
11481
|
+
var overrideIfSet = arguments.length > 2 && !!arguments[2] && arguments[2].force;
|
|
11482
|
+
var nonConfigurable = arguments.length > 2 && !!arguments[2] && arguments[2].nonConfigurable;
|
|
11483
|
+
if (typeof overrideIfSet !== "undefined" && typeof overrideIfSet !== "boolean" || typeof nonConfigurable !== "undefined" && typeof nonConfigurable !== "boolean") {
|
|
11484
|
+
throw new $TypeError("if provided, the `overrideIfSet` and `nonConfigurable` options must be booleans");
|
|
11485
|
+
}
|
|
11486
|
+
if (toStringTag && (overrideIfSet || !hasOwn(object, toStringTag))) {
|
|
11487
|
+
if ($defineProperty) {
|
|
11488
|
+
$defineProperty(object, toStringTag, {
|
|
11489
|
+
configurable: !nonConfigurable,
|
|
11490
|
+
enumerable: false,
|
|
11491
|
+
value,
|
|
11492
|
+
writable: false
|
|
11493
|
+
});
|
|
11494
|
+
} else {
|
|
11495
|
+
object[toStringTag] = value;
|
|
11496
|
+
}
|
|
11497
|
+
}
|
|
11498
|
+
};
|
|
11499
|
+
}
|
|
11500
|
+
});
|
|
11501
|
+
|
|
11502
|
+
// node_modules/form-data/lib/populate.js
|
|
11503
|
+
var require_populate2 = __commonJS({
|
|
11504
|
+
"node_modules/form-data/lib/populate.js"(exports2, module2) {
|
|
11505
|
+
"use strict";
|
|
11506
|
+
module2.exports = function(dst, src) {
|
|
11507
|
+
Object.keys(src).forEach(function(prop) {
|
|
11508
|
+
dst[prop] = dst[prop] || src[prop];
|
|
11509
|
+
});
|
|
11510
|
+
return dst;
|
|
11511
|
+
};
|
|
11512
|
+
}
|
|
11513
|
+
});
|
|
11514
|
+
|
|
11515
|
+
// node_modules/form-data/lib/form_data.js
|
|
11516
|
+
var require_form_data2 = __commonJS({
|
|
11517
|
+
"node_modules/form-data/lib/form_data.js"(exports2, module2) {
|
|
11518
|
+
"use strict";
|
|
11519
|
+
var CombinedStream = require_combined_stream();
|
|
11520
|
+
var util2 = require("util");
|
|
11521
|
+
var path = require("path");
|
|
11522
|
+
var http2 = require("http");
|
|
11523
|
+
var https3 = require("https");
|
|
11524
|
+
var parseUrl = require("url").parse;
|
|
11525
|
+
var fs = require("fs");
|
|
11526
|
+
var Stream = require("stream").Stream;
|
|
11527
|
+
var crypto3 = require("crypto");
|
|
11528
|
+
var mime = require_mime_types();
|
|
11529
|
+
var asynckit = require_asynckit();
|
|
11530
|
+
var setToStringTag = require_es_set_tostringtag();
|
|
11531
|
+
var hasOwn = require_hasown();
|
|
11532
|
+
var populate = require_populate2();
|
|
11533
|
+
function FormData4(options) {
|
|
11534
|
+
if (!(this instanceof FormData4)) {
|
|
11535
|
+
return new FormData4(options);
|
|
11536
|
+
}
|
|
11537
|
+
this._overheadLength = 0;
|
|
11538
|
+
this._valueLength = 0;
|
|
11539
|
+
this._valuesToMeasure = [];
|
|
11540
|
+
CombinedStream.call(this);
|
|
11541
|
+
options = options || {};
|
|
11542
|
+
for (var option in options) {
|
|
11543
|
+
this[option] = options[option];
|
|
11544
|
+
}
|
|
11545
|
+
}
|
|
11546
|
+
util2.inherits(FormData4, CombinedStream);
|
|
11547
|
+
FormData4.LINE_BREAK = "\r\n";
|
|
11548
|
+
FormData4.DEFAULT_CONTENT_TYPE = "application/octet-stream";
|
|
11549
|
+
FormData4.prototype.append = function(field, value, options) {
|
|
11550
|
+
options = options || {};
|
|
11551
|
+
if (typeof options === "string") {
|
|
11552
|
+
options = { filename: options };
|
|
11553
|
+
}
|
|
11554
|
+
var append2 = CombinedStream.prototype.append.bind(this);
|
|
11555
|
+
if (typeof value === "number" || value == null) {
|
|
11556
|
+
value = String(value);
|
|
11557
|
+
}
|
|
11558
|
+
if (Array.isArray(value)) {
|
|
11559
|
+
this._error(new Error("Arrays are not supported."));
|
|
11560
|
+
return;
|
|
11561
|
+
}
|
|
11562
|
+
var header = this._multiPartHeader(field, value, options);
|
|
11563
|
+
var footer = this._multiPartFooter();
|
|
11564
|
+
append2(header);
|
|
11565
|
+
append2(value);
|
|
11566
|
+
append2(footer);
|
|
11567
|
+
this._trackLength(header, value, options);
|
|
11568
|
+
};
|
|
11569
|
+
FormData4.prototype._trackLength = function(header, value, options) {
|
|
11570
|
+
var valueLength = 0;
|
|
11571
|
+
if (options.knownLength != null) {
|
|
11572
|
+
valueLength += Number(options.knownLength);
|
|
11573
|
+
} else if (Buffer.isBuffer(value)) {
|
|
11574
|
+
valueLength = value.length;
|
|
11575
|
+
} else if (typeof value === "string") {
|
|
11576
|
+
valueLength = Buffer.byteLength(value);
|
|
11577
|
+
}
|
|
11578
|
+
this._valueLength += valueLength;
|
|
11579
|
+
this._overheadLength += Buffer.byteLength(header) + FormData4.LINE_BREAK.length;
|
|
11580
|
+
if (!value || !value.path && !(value.readable && hasOwn(value, "httpVersion")) && !(value instanceof Stream)) {
|
|
11581
|
+
return;
|
|
11582
|
+
}
|
|
11583
|
+
if (!options.knownLength) {
|
|
11584
|
+
this._valuesToMeasure.push(value);
|
|
11585
|
+
}
|
|
11586
|
+
};
|
|
11587
|
+
FormData4.prototype._lengthRetriever = function(value, callback) {
|
|
11588
|
+
if (hasOwn(value, "fd")) {
|
|
11589
|
+
if (value.end != void 0 && value.end != Infinity && value.start != void 0) {
|
|
11590
|
+
callback(null, value.end + 1 - (value.start ? value.start : 0));
|
|
11591
|
+
} else {
|
|
11592
|
+
fs.stat(value.path, function(err, stat) {
|
|
11593
|
+
if (err) {
|
|
11594
|
+
callback(err);
|
|
11595
|
+
return;
|
|
11596
|
+
}
|
|
11597
|
+
var fileSize = stat.size - (value.start ? value.start : 0);
|
|
11598
|
+
callback(null, fileSize);
|
|
11599
|
+
});
|
|
11600
|
+
}
|
|
11601
|
+
} else if (hasOwn(value, "httpVersion")) {
|
|
11602
|
+
callback(null, Number(value.headers["content-length"]));
|
|
11603
|
+
} else if (hasOwn(value, "httpModule")) {
|
|
11604
|
+
value.on("response", function(response) {
|
|
11605
|
+
value.pause();
|
|
11606
|
+
callback(null, Number(response.headers["content-length"]));
|
|
11607
|
+
});
|
|
11608
|
+
value.resume();
|
|
11609
|
+
} else {
|
|
11610
|
+
callback("Unknown stream");
|
|
11611
|
+
}
|
|
11612
|
+
};
|
|
11613
|
+
FormData4.prototype._multiPartHeader = function(field, value, options) {
|
|
11614
|
+
if (typeof options.header === "string") {
|
|
11615
|
+
return options.header;
|
|
11616
|
+
}
|
|
11617
|
+
var contentDisposition = this._getContentDisposition(value, options);
|
|
11618
|
+
var contentType = this._getContentType(value, options);
|
|
11619
|
+
var contents = "";
|
|
11620
|
+
var headers = {
|
|
11621
|
+
// add custom disposition as third element or keep it two elements if not
|
|
11622
|
+
"Content-Disposition": ["form-data", 'name="' + field + '"'].concat(contentDisposition || []),
|
|
11623
|
+
// if no content type. allow it to be empty array
|
|
11624
|
+
"Content-Type": [].concat(contentType || [])
|
|
11625
|
+
};
|
|
11626
|
+
if (typeof options.header === "object") {
|
|
11627
|
+
populate(headers, options.header);
|
|
11628
|
+
}
|
|
11629
|
+
var header;
|
|
11630
|
+
for (var prop in headers) {
|
|
11631
|
+
if (hasOwn(headers, prop)) {
|
|
11632
|
+
header = headers[prop];
|
|
11633
|
+
if (header == null) {
|
|
11634
|
+
continue;
|
|
11635
|
+
}
|
|
11636
|
+
if (!Array.isArray(header)) {
|
|
11637
|
+
header = [header];
|
|
11638
|
+
}
|
|
11639
|
+
if (header.length) {
|
|
11640
|
+
contents += prop + ": " + header.join("; ") + FormData4.LINE_BREAK;
|
|
11641
|
+
}
|
|
11642
|
+
}
|
|
11643
|
+
}
|
|
11644
|
+
return "--" + this.getBoundary() + FormData4.LINE_BREAK + contents + FormData4.LINE_BREAK;
|
|
11645
|
+
};
|
|
11646
|
+
FormData4.prototype._getContentDisposition = function(value, options) {
|
|
11647
|
+
var filename;
|
|
11648
|
+
if (typeof options.filepath === "string") {
|
|
11649
|
+
filename = path.normalize(options.filepath).replace(/\\/g, "/");
|
|
11650
|
+
} else if (options.filename || value && (value.name || value.path)) {
|
|
11651
|
+
filename = path.basename(options.filename || value && (value.name || value.path));
|
|
11652
|
+
} else if (value && value.readable && hasOwn(value, "httpVersion")) {
|
|
11653
|
+
filename = path.basename(value.client._httpMessage.path || "");
|
|
11654
|
+
}
|
|
11655
|
+
if (filename) {
|
|
11656
|
+
return 'filename="' + filename + '"';
|
|
11657
|
+
}
|
|
11658
|
+
};
|
|
11659
|
+
FormData4.prototype._getContentType = function(value, options) {
|
|
11660
|
+
var contentType = options.contentType;
|
|
11661
|
+
if (!contentType && value && value.name) {
|
|
11662
|
+
contentType = mime.lookup(value.name);
|
|
11663
|
+
}
|
|
11664
|
+
if (!contentType && value && value.path) {
|
|
11665
|
+
contentType = mime.lookup(value.path);
|
|
11666
|
+
}
|
|
11667
|
+
if (!contentType && value && value.readable && hasOwn(value, "httpVersion")) {
|
|
11668
|
+
contentType = value.headers["content-type"];
|
|
11669
|
+
}
|
|
11670
|
+
if (!contentType && (options.filepath || options.filename)) {
|
|
11671
|
+
contentType = mime.lookup(options.filepath || options.filename);
|
|
11672
|
+
}
|
|
11673
|
+
if (!contentType && value && typeof value === "object") {
|
|
11674
|
+
contentType = FormData4.DEFAULT_CONTENT_TYPE;
|
|
11675
|
+
}
|
|
11676
|
+
return contentType;
|
|
11677
|
+
};
|
|
11678
|
+
FormData4.prototype._multiPartFooter = function() {
|
|
11679
|
+
return function(next) {
|
|
11680
|
+
var footer = FormData4.LINE_BREAK;
|
|
11681
|
+
var lastPart = this._streams.length === 0;
|
|
11682
|
+
if (lastPart) {
|
|
11683
|
+
footer += this._lastBoundary();
|
|
11684
|
+
}
|
|
11685
|
+
next(footer);
|
|
11686
|
+
}.bind(this);
|
|
11687
|
+
};
|
|
11688
|
+
FormData4.prototype._lastBoundary = function() {
|
|
11689
|
+
return "--" + this.getBoundary() + "--" + FormData4.LINE_BREAK;
|
|
11690
|
+
};
|
|
11691
|
+
FormData4.prototype.getHeaders = function(userHeaders) {
|
|
11692
|
+
var header;
|
|
11693
|
+
var formHeaders = {
|
|
11694
|
+
"content-type": "multipart/form-data; boundary=" + this.getBoundary()
|
|
11695
|
+
};
|
|
11696
|
+
for (header in userHeaders) {
|
|
11697
|
+
if (hasOwn(userHeaders, header)) {
|
|
11698
|
+
formHeaders[header.toLowerCase()] = userHeaders[header];
|
|
11699
|
+
}
|
|
11700
|
+
}
|
|
11701
|
+
return formHeaders;
|
|
11702
|
+
};
|
|
11703
|
+
FormData4.prototype.setBoundary = function(boundary) {
|
|
11704
|
+
if (typeof boundary !== "string") {
|
|
11705
|
+
throw new TypeError("FormData boundary must be a string");
|
|
11706
|
+
}
|
|
11707
|
+
this._boundary = boundary;
|
|
11708
|
+
};
|
|
11709
|
+
FormData4.prototype.getBoundary = function() {
|
|
11710
|
+
if (!this._boundary) {
|
|
11711
|
+
this._generateBoundary();
|
|
11712
|
+
}
|
|
11713
|
+
return this._boundary;
|
|
11714
|
+
};
|
|
11715
|
+
FormData4.prototype.getBuffer = function() {
|
|
11716
|
+
var dataBuffer = new Buffer.alloc(0);
|
|
11717
|
+
var boundary = this.getBoundary();
|
|
11718
|
+
for (var i = 0, len = this._streams.length; i < len; i++) {
|
|
11719
|
+
if (typeof this._streams[i] !== "function") {
|
|
11720
|
+
if (Buffer.isBuffer(this._streams[i])) {
|
|
11721
|
+
dataBuffer = Buffer.concat([dataBuffer, this._streams[i]]);
|
|
11722
|
+
} else {
|
|
11723
|
+
dataBuffer = Buffer.concat([dataBuffer, Buffer.from(this._streams[i])]);
|
|
11724
|
+
}
|
|
11725
|
+
if (typeof this._streams[i] !== "string" || this._streams[i].substring(2, boundary.length + 2) !== boundary) {
|
|
11726
|
+
dataBuffer = Buffer.concat([dataBuffer, Buffer.from(FormData4.LINE_BREAK)]);
|
|
11727
|
+
}
|
|
11728
|
+
}
|
|
11729
|
+
}
|
|
11730
|
+
return Buffer.concat([dataBuffer, Buffer.from(this._lastBoundary())]);
|
|
11731
|
+
};
|
|
11732
|
+
FormData4.prototype._generateBoundary = function() {
|
|
11733
|
+
this._boundary = "--------------------------" + crypto3.randomBytes(12).toString("hex");
|
|
11734
|
+
};
|
|
11735
|
+
FormData4.prototype.getLengthSync = function() {
|
|
11736
|
+
var knownLength = this._overheadLength + this._valueLength;
|
|
11737
|
+
if (this._streams.length) {
|
|
11738
|
+
knownLength += this._lastBoundary().length;
|
|
11739
|
+
}
|
|
11740
|
+
if (!this.hasKnownLength()) {
|
|
11741
|
+
this._error(new Error("Cannot calculate proper length in synchronous way."));
|
|
11742
|
+
}
|
|
11743
|
+
return knownLength;
|
|
11744
|
+
};
|
|
11745
|
+
FormData4.prototype.hasKnownLength = function() {
|
|
11746
|
+
var hasKnownLength = true;
|
|
11747
|
+
if (this._valuesToMeasure.length) {
|
|
11748
|
+
hasKnownLength = false;
|
|
11749
|
+
}
|
|
11750
|
+
return hasKnownLength;
|
|
11751
|
+
};
|
|
11752
|
+
FormData4.prototype.getLength = function(cb) {
|
|
11753
|
+
var knownLength = this._overheadLength + this._valueLength;
|
|
11754
|
+
if (this._streams.length) {
|
|
11755
|
+
knownLength += this._lastBoundary().length;
|
|
11756
|
+
}
|
|
11757
|
+
if (!this._valuesToMeasure.length) {
|
|
11758
|
+
process.nextTick(cb.bind(this, null, knownLength));
|
|
11759
|
+
return;
|
|
11760
|
+
}
|
|
11761
|
+
asynckit.parallel(this._valuesToMeasure, this._lengthRetriever, function(err, values) {
|
|
11762
|
+
if (err) {
|
|
11763
|
+
cb(err);
|
|
11764
|
+
return;
|
|
11765
|
+
}
|
|
11766
|
+
values.forEach(function(length) {
|
|
11767
|
+
knownLength += length;
|
|
11768
|
+
});
|
|
11769
|
+
cb(null, knownLength);
|
|
11770
|
+
});
|
|
11771
|
+
};
|
|
11772
|
+
FormData4.prototype.submit = function(params, cb) {
|
|
11773
|
+
var request;
|
|
11774
|
+
var options;
|
|
11775
|
+
var defaults2 = { method: "post" };
|
|
11776
|
+
if (typeof params === "string") {
|
|
11777
|
+
params = parseUrl(params);
|
|
11778
|
+
options = populate({
|
|
11779
|
+
port: params.port,
|
|
11780
|
+
path: params.pathname,
|
|
11781
|
+
host: params.hostname,
|
|
11782
|
+
protocol: params.protocol
|
|
11783
|
+
}, defaults2);
|
|
11784
|
+
} else {
|
|
11785
|
+
options = populate(params, defaults2);
|
|
11786
|
+
if (!options.port) {
|
|
11787
|
+
options.port = options.protocol === "https:" ? 443 : 80;
|
|
11788
|
+
}
|
|
11789
|
+
}
|
|
11790
|
+
options.headers = this.getHeaders(params.headers);
|
|
11791
|
+
if (options.protocol === "https:") {
|
|
11792
|
+
request = https3.request(options);
|
|
11793
|
+
} else {
|
|
11794
|
+
request = http2.request(options);
|
|
11795
|
+
}
|
|
11796
|
+
this.getLength(function(err, length) {
|
|
11797
|
+
if (err && err !== "Unknown stream") {
|
|
11798
|
+
this._error(err);
|
|
11799
|
+
return;
|
|
11800
|
+
}
|
|
11801
|
+
if (length) {
|
|
11802
|
+
request.setHeader("Content-Length", length);
|
|
11803
|
+
}
|
|
11804
|
+
this.pipe(request);
|
|
11805
|
+
if (cb) {
|
|
11806
|
+
var onResponse;
|
|
11807
|
+
var callback = function(error, responce) {
|
|
11808
|
+
request.removeListener("error", callback);
|
|
11809
|
+
request.removeListener("response", onResponse);
|
|
11810
|
+
return cb.call(this, error, responce);
|
|
11811
|
+
};
|
|
11812
|
+
onResponse = callback.bind(this, null);
|
|
11813
|
+
request.on("error", callback);
|
|
11814
|
+
request.on("response", onResponse);
|
|
11815
|
+
}
|
|
11816
|
+
}.bind(this));
|
|
11817
|
+
return request;
|
|
11818
|
+
};
|
|
11819
|
+
FormData4.prototype._error = function(err) {
|
|
11820
|
+
if (!this.error) {
|
|
11821
|
+
this.error = err;
|
|
11822
|
+
this.pause();
|
|
11823
|
+
this.emit("error", err);
|
|
11824
|
+
}
|
|
11825
|
+
};
|
|
11826
|
+
FormData4.prototype.toString = function() {
|
|
11827
|
+
return "[object FormData]";
|
|
11828
|
+
};
|
|
11829
|
+
setToStringTag(FormData4, "FormData");
|
|
11830
|
+
module2.exports = FormData4;
|
|
11831
|
+
}
|
|
11832
|
+
});
|
|
11833
|
+
|
|
11834
|
+
// node_modules/isomorphic-ws/node.js
|
|
11835
|
+
var require_node2 = __commonJS({
|
|
11836
|
+
"node_modules/isomorphic-ws/node.js"(exports2, module2) {
|
|
11837
|
+
"use strict";
|
|
11838
|
+
module2.exports = require("ws");
|
|
11839
|
+
}
|
|
11840
|
+
});
|
|
11841
|
+
|
|
11842
|
+
// src/index.ts
|
|
11843
|
+
var index_exports = {};
|
|
11844
|
+
__export(index_exports, {
|
|
11845
|
+
AbstractOfflineDB: () => AbstractOfflineDB,
|
|
11846
|
+
Allow: () => Allow,
|
|
11847
|
+
AllowAll: () => AllowAll,
|
|
11848
|
+
AnyResource: () => AnyResource,
|
|
11849
|
+
AnyRole: () => AnyRole,
|
|
11850
|
+
AttachmentManager: () => AttachmentManager,
|
|
11851
|
+
BasePaginator: () => BasePaginator,
|
|
11852
|
+
BaseSearchSource: () => BaseSearchSource,
|
|
11853
|
+
BaseSearchSourceSync: () => BaseSearchSourceSync,
|
|
11854
|
+
BuiltinPermissions: () => BuiltinPermissions,
|
|
11855
|
+
BuiltinRoles: () => BuiltinRoles,
|
|
11856
|
+
Campaign: () => Campaign,
|
|
11857
|
+
Channel: () => Channel,
|
|
11858
|
+
ChannelManager: () => ChannelManager,
|
|
11859
|
+
ChannelSearchSource: () => ChannelSearchSource,
|
|
11860
|
+
ChannelState: () => ChannelState,
|
|
11861
|
+
CheckSignature: () => CheckSignature,
|
|
11862
|
+
ClientState: () => ClientState,
|
|
11863
|
+
CommandSearchSource: () => CommandSearchSource,
|
|
11864
|
+
CustomDataManager: () => CustomDataManager,
|
|
11865
|
+
DEFAULT_ATTACHMENT_MANAGER_CONFIG: () => DEFAULT_ATTACHMENT_MANAGER_CONFIG,
|
|
11866
|
+
DEFAULT_CHANNEL_MANAGER_OPTIONS: () => DEFAULT_CHANNEL_MANAGER_OPTIONS,
|
|
11867
|
+
DEFAULT_CHANNEL_MANAGER_PAGINATION_OPTIONS: () => DEFAULT_CHANNEL_MANAGER_PAGINATION_OPTIONS,
|
|
11868
|
+
DEFAULT_COMPOSER_CONFIG: () => DEFAULT_COMPOSER_CONFIG,
|
|
11869
|
+
DEFAULT_LINK_PREVIEW_MANAGER_CONFIG: () => DEFAULT_LINK_PREVIEW_MANAGER_CONFIG,
|
|
11870
|
+
DEFAULT_LOCATION_COMPOSER_CONFIG: () => DEFAULT_LOCATION_COMPOSER_CONFIG,
|
|
11871
|
+
DEFAULT_PAGINATION_OPTIONS: () => DEFAULT_PAGINATION_OPTIONS,
|
|
11872
|
+
DEFAULT_REMINDER_MANAGER_CONFIG: () => DEFAULT_REMINDER_MANAGER_CONFIG,
|
|
11873
|
+
DEFAULT_STOP_REFRESH_BOUNDARY_MS: () => DEFAULT_STOP_REFRESH_BOUNDARY_MS,
|
|
11874
|
+
DEFAULT_TEXT_COMPOSER_CONFIG: () => DEFAULT_TEXT_COMPOSER_CONFIG,
|
|
11875
|
+
Deny: () => Deny,
|
|
11876
|
+
DenyAll: () => DenyAll,
|
|
11877
|
+
DevToken: () => DevToken,
|
|
11878
|
+
EVENT_MAP: () => EVENT_MAP,
|
|
11879
|
+
ErrorFromResponse: () => ErrorFromResponse,
|
|
11880
|
+
FixedSizeQueueCache: () => FixedSizeQueueCache,
|
|
11881
|
+
InsightMetrics: () => InsightMetrics,
|
|
11882
|
+
JWTServerToken: () => JWTServerToken,
|
|
11883
|
+
JWTUserToken: () => JWTUserToken,
|
|
11884
|
+
LinkPreviewStatus: () => LinkPreviewStatus,
|
|
11885
|
+
LinkPreviewsManager: () => LinkPreviewsManager,
|
|
11886
|
+
LiveLocationManager: () => LiveLocationManager,
|
|
11887
|
+
LocationComposer: () => LocationComposer,
|
|
11888
|
+
MAX_POLL_OPTIONS: () => MAX_POLL_OPTIONS,
|
|
11889
|
+
MODERATION_ENTITY_TYPES: () => MODERATION_ENTITY_TYPES,
|
|
11890
|
+
MaxPriority: () => MaxPriority,
|
|
11891
|
+
MentionsSearchSource: () => MentionsSearchSource,
|
|
11892
|
+
MergedStateStore: () => MergedStateStore,
|
|
11893
|
+
MessageComposer: () => MessageComposer,
|
|
11894
|
+
MessageComposerMiddlewareExecutor: () => MessageComposerMiddlewareExecutor,
|
|
11895
|
+
MessageDraftComposerMiddlewareExecutor: () => MessageDraftComposerMiddlewareExecutor,
|
|
11896
|
+
MessageSearchSource: () => MessageSearchSource,
|
|
11897
|
+
MiddlewareExecutor: () => MiddlewareExecutor,
|
|
11898
|
+
MinPriority: () => MinPriority,
|
|
11899
|
+
Moderation: () => Moderation,
|
|
11900
|
+
NotificationManager: () => NotificationManager,
|
|
11901
|
+
OfflineDBSyncManager: () => OfflineDBSyncManager,
|
|
11902
|
+
OfflineError: () => OfflineError,
|
|
11903
|
+
Permission: () => Permission,
|
|
11904
|
+
Poll: () => Poll,
|
|
11905
|
+
PollComposer: () => PollComposer,
|
|
11906
|
+
PollComposerCompositionMiddlewareExecutor: () => PollComposerCompositionMiddlewareExecutor,
|
|
11907
|
+
PollComposerStateMiddlewareExecutor: () => PollComposerStateMiddlewareExecutor,
|
|
11908
|
+
PollManager: () => PollManager,
|
|
11909
|
+
Product: () => Product,
|
|
11910
|
+
Reminder: () => Reminder,
|
|
11911
|
+
ReminderManager: () => ReminderManager,
|
|
11912
|
+
ReminderPaginator: () => ReminderPaginator,
|
|
11913
|
+
ReminderTimer: () => ReminderTimer,
|
|
11914
|
+
SearchController: () => SearchController,
|
|
11915
|
+
Segment: () => Segment,
|
|
11916
|
+
StableWSConnection: () => StableWSConnection,
|
|
11917
|
+
StateStore: () => StateStore,
|
|
11918
|
+
StreamChat: () => StreamChat,
|
|
11919
|
+
THREAD_MANAGER_INITIAL_STATE: () => THREAD_MANAGER_INITIAL_STATE,
|
|
11920
|
+
TextComposer: () => TextComposer,
|
|
11921
|
+
TextComposerMiddlewareExecutor: () => TextComposerMiddlewareExecutor,
|
|
11922
|
+
Thread: () => Thread,
|
|
11923
|
+
ThreadManager: () => ThreadManager,
|
|
11924
|
+
TokenManager: () => TokenManager,
|
|
11925
|
+
UPDATE_LIVE_LOCATION_REQUEST_MIN_THROTTLE_TIMEOUT: () => UPDATE_LIVE_LOCATION_REQUEST_MIN_THROTTLE_TIMEOUT,
|
|
11926
|
+
UserFromToken: () => UserFromToken,
|
|
11927
|
+
UserSearchSource: () => UserSearchSource,
|
|
11928
|
+
VALID_MAX_VOTES_VALUE_REGEX: () => VALID_MAX_VOTES_VALUE_REGEX,
|
|
11929
|
+
VotingVisibility: () => VotingVisibility,
|
|
11930
|
+
accentsMap: () => accentsMap,
|
|
11931
|
+
buildWsFatalInsight: () => buildWsFatalInsight,
|
|
11932
|
+
buildWsSuccessAfterFailureInsight: () => buildWsSuccessAfterFailureInsight,
|
|
11933
|
+
calculateLevenshtein: () => calculateLevenshtein,
|
|
11934
|
+
channelManagerEventToHandlerMapping: () => channelManagerEventToHandlerMapping,
|
|
11935
|
+
chatCodes: () => chatCodes,
|
|
11936
|
+
createActiveCommandGuardMiddleware: () => createActiveCommandGuardMiddleware,
|
|
11937
|
+
createAttachmentsCompositionMiddleware: () => createAttachmentsCompositionMiddleware,
|
|
11938
|
+
createCommandInjectionMiddleware: () => createCommandInjectionMiddleware,
|
|
11939
|
+
createCommandStringExtractionMiddleware: () => createCommandStringExtractionMiddleware,
|
|
11940
|
+
createCommandsMiddleware: () => createCommandsMiddleware,
|
|
11941
|
+
createCompositionDataCleanupMiddleware: () => createCompositionDataCleanupMiddleware,
|
|
11942
|
+
createCompositionValidationMiddleware: () => createCompositionValidationMiddleware,
|
|
11943
|
+
createCustomDataCompositionMiddleware: () => createCustomDataCompositionMiddleware,
|
|
11944
|
+
createDraftAttachmentsCompositionMiddleware: () => createDraftAttachmentsCompositionMiddleware,
|
|
11945
|
+
createDraftCommandInjectionMiddleware: () => createDraftCommandInjectionMiddleware,
|
|
11946
|
+
createDraftCompositionValidationMiddleware: () => createDraftCompositionValidationMiddleware,
|
|
11947
|
+
createDraftCustomDataCompositionMiddleware: () => createDraftCustomDataCompositionMiddleware,
|
|
11948
|
+
createDraftLinkPreviewsCompositionMiddleware: () => createDraftLinkPreviewsCompositionMiddleware,
|
|
11949
|
+
createDraftMessageComposerStateCompositionMiddleware: () => createDraftMessageComposerStateCompositionMiddleware,
|
|
11950
|
+
createDraftTextComposerCompositionMiddleware: () => createDraftTextComposerCompositionMiddleware,
|
|
11951
|
+
createFileFromBlobs: () => createFileFromBlobs,
|
|
11952
|
+
createLinkPreviewsCompositionMiddleware: () => createLinkPreviewsCompositionMiddleware,
|
|
11953
|
+
createMentionsMiddleware: () => createMentionsMiddleware,
|
|
11954
|
+
createMessageComposerStateCompositionMiddleware: () => createMessageComposerStateCompositionMiddleware,
|
|
11955
|
+
createPollComposerStateMiddleware: () => createPollComposerStateMiddleware,
|
|
11956
|
+
createSharedLocationCompositionMiddleware: () => createSharedLocationCompositionMiddleware,
|
|
11957
|
+
createTextComposerCompositionMiddleware: () => createTextComposerCompositionMiddleware,
|
|
11958
|
+
createTextComposerPreValidationMiddleware: () => createTextComposerPreValidationMiddleware,
|
|
11959
|
+
decodeBase64: () => decodeBase64,
|
|
11960
|
+
defaultPollFieldBlurEventValidators: () => defaultPollFieldBlurEventValidators,
|
|
11961
|
+
defaultPollFieldChangeEventValidators: () => defaultPollFieldChangeEventValidators,
|
|
11962
|
+
encodeBase64: () => encodeBase64,
|
|
11963
|
+
ensureIsLocalAttachment: () => ensureIsLocalAttachment,
|
|
11964
|
+
escapeRegExp: () => escapeRegExp,
|
|
11965
|
+
extractPollData: () => extractPollData,
|
|
11966
|
+
extractPollEnrichedData: () => extractPollEnrichedData,
|
|
11967
|
+
formatMessage: () => formatMessage,
|
|
11968
|
+
generateFileName: () => generateFileName,
|
|
11969
|
+
getAttachmentTypeFromMimeType: () => getAttachmentTypeFromMimeType,
|
|
11970
|
+
getCompleteCommandInString: () => getCompleteCommandInString,
|
|
11971
|
+
getExtensionFromMimeType: () => getExtensionFromMimeType,
|
|
11972
|
+
getTokenizedSuggestionDisplayName: () => getTokenizedSuggestionDisplayName,
|
|
11973
|
+
getTriggerCharWithToken: () => getTriggerCharWithToken,
|
|
11974
|
+
insertItemWithTrigger: () => insertItemWithTrigger,
|
|
11975
|
+
isAudioAttachment: () => isAudioAttachment,
|
|
11976
|
+
isBlobButNotFile: () => isBlobButNotFile,
|
|
11977
|
+
isFile: () => isFile2,
|
|
11978
|
+
isFileAttachment: () => isFileAttachment,
|
|
11979
|
+
isFileList: () => isFileList2,
|
|
11980
|
+
isFileReference: () => isFileReference,
|
|
11981
|
+
isImageAttachment: () => isImageAttachment,
|
|
11982
|
+
isImageFile: () => isImageFile,
|
|
11983
|
+
isLocalAttachment: () => isLocalAttachment,
|
|
11984
|
+
isLocalAudioAttachment: () => isLocalAudioAttachment,
|
|
11985
|
+
isLocalFileAttachment: () => isLocalFileAttachment,
|
|
11986
|
+
isLocalImageAttachment: () => isLocalImageAttachment,
|
|
11987
|
+
isLocalUploadAttachment: () => isLocalUploadAttachment,
|
|
11988
|
+
isLocalVideoAttachment: () => isLocalVideoAttachment,
|
|
11989
|
+
isLocalVoiceRecordingAttachment: () => isLocalVoiceRecordingAttachment,
|
|
11990
|
+
isOwnUser: () => isOwnUser,
|
|
11991
|
+
isPatch: () => isPatch,
|
|
11992
|
+
isScrapedContent: () => isScrapedContent,
|
|
11993
|
+
isSharedLocationResponse: () => isSharedLocationResponse,
|
|
11994
|
+
isTargetedOptionTextUpdate: () => isTargetedOptionTextUpdate,
|
|
11995
|
+
isUploadedAttachment: () => isUploadedAttachment,
|
|
11996
|
+
isVideoAttachment: () => isVideoAttachment,
|
|
11997
|
+
isVoiceRecordingAttachment: () => isVoiceRecordingAttachment,
|
|
11998
|
+
isVoteAnswer: () => isVoteAnswer,
|
|
11999
|
+
localMessageToNewMessagePayload: () => localMessageToNewMessagePayload,
|
|
12000
|
+
logChatPromiseExecution: () => logChatPromiseExecution,
|
|
12001
|
+
mapPollStateToResponse: () => mapPollStateToResponse,
|
|
12002
|
+
pollCompositionStateProcessors: () => pollCompositionStateProcessors,
|
|
12003
|
+
pollStateChangeValidators: () => pollStateChangeValidators,
|
|
12004
|
+
postInsights: () => postInsights,
|
|
12005
|
+
promoteChannel: () => promoteChannel,
|
|
12006
|
+
readFileAsArrayBuffer: () => readFileAsArrayBuffer,
|
|
12007
|
+
removeDiacritics: () => removeDiacritics,
|
|
12008
|
+
replaceWordWithEntity: () => replaceWordWithEntity,
|
|
12009
|
+
textIsEmpty: () => textIsEmpty,
|
|
12010
|
+
timeLeftMs: () => timeLeftMs
|
|
12011
|
+
});
|
|
12012
|
+
module.exports = __toCommonJS(index_exports);
|
|
12013
|
+
|
|
12014
|
+
// src/base64.ts
|
|
12015
|
+
var import_base64_js = __toESM(require_base64_js());
|
|
12016
|
+
function isString(arrayOrString) {
|
|
12017
|
+
return typeof arrayOrString === "string";
|
|
12018
|
+
}
|
|
12019
|
+
function isMapStringCallback(arrayOrString, callback) {
|
|
12020
|
+
return !!callback && isString(arrayOrString);
|
|
12021
|
+
}
|
|
12022
|
+
function map(arrayOrString, callback) {
|
|
12023
|
+
const res = [];
|
|
12024
|
+
if (isString(arrayOrString) && isMapStringCallback(arrayOrString, callback)) {
|
|
12025
|
+
for (let k = 0, len = arrayOrString.length; k < len; k++) {
|
|
12026
|
+
if (arrayOrString.charAt(k)) {
|
|
12027
|
+
const kValue = arrayOrString.charAt(k);
|
|
12028
|
+
const mappedValue = callback(kValue, k, arrayOrString);
|
|
12029
|
+
res[k] = mappedValue;
|
|
12030
|
+
}
|
|
12031
|
+
}
|
|
12032
|
+
} else if (!isString(arrayOrString) && !isMapStringCallback(arrayOrString, callback)) {
|
|
12033
|
+
for (let k = 0, len = arrayOrString.length; k < len; k++) {
|
|
12034
|
+
if (k in arrayOrString) {
|
|
12035
|
+
const kValue = arrayOrString[k];
|
|
12036
|
+
const mappedValue = callback(kValue, k, arrayOrString);
|
|
12037
|
+
res[k] = mappedValue;
|
|
12038
|
+
}
|
|
12039
|
+
}
|
|
12040
|
+
}
|
|
12041
|
+
return res;
|
|
12042
|
+
}
|
|
12043
|
+
var encodeBase64 = (data) => (0, import_base64_js.fromByteArray)(new Uint8Array(map(data, (char) => char.charCodeAt(0))));
|
|
12044
|
+
var decodeBase64 = (s) => {
|
|
12045
|
+
const e = {}, w = String.fromCharCode, L = s.length;
|
|
12046
|
+
let i, b = 0, c, x, l = 0, a, r = "";
|
|
12047
|
+
const A = "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/";
|
|
12048
|
+
for (i = 0; i < 64; i++) {
|
|
12049
|
+
e[A.charAt(i)] = i;
|
|
12050
|
+
}
|
|
12051
|
+
for (x = 0; x < L; x++) {
|
|
12052
|
+
c = e[s.charAt(x)];
|
|
12053
|
+
b = (b << 6) + c;
|
|
12054
|
+
l += 6;
|
|
12055
|
+
while (l >= 8) {
|
|
12056
|
+
((a = b >>> (l -= 8) & 255) || x < L - 2) && (r += w(a));
|
|
12057
|
+
}
|
|
12058
|
+
}
|
|
12059
|
+
return r;
|
|
12060
|
+
};
|
|
12061
|
+
|
|
12062
|
+
// src/campaign.ts
|
|
12063
|
+
var Campaign = class {
|
|
12064
|
+
constructor(client, id, data) {
|
|
12065
|
+
this.client = client;
|
|
12066
|
+
this.id = id;
|
|
12067
|
+
this.data = data;
|
|
12068
|
+
}
|
|
12069
|
+
async create() {
|
|
12070
|
+
const body = {
|
|
12071
|
+
id: this.id,
|
|
12072
|
+
message_template: this.data?.message_template,
|
|
12073
|
+
segment_ids: this.data?.segment_ids,
|
|
12074
|
+
sender_id: this.data?.sender_id,
|
|
12075
|
+
sender_mode: this.data?.sender_mode,
|
|
12076
|
+
channel_template: this.data?.channel_template,
|
|
12077
|
+
create_channels: this.data?.create_channels,
|
|
12078
|
+
show_channels: this.data?.show_channels,
|
|
12079
|
+
description: this.data?.description,
|
|
12080
|
+
name: this.data?.name,
|
|
12081
|
+
skip_push: this.data?.skip_push,
|
|
12082
|
+
skip_webhook: this.data?.skip_webhook,
|
|
12083
|
+
user_ids: this.data?.user_ids
|
|
12084
|
+
};
|
|
12085
|
+
const result = await this.client.createCampaign(body);
|
|
10908
12086
|
this.id = result.campaign.id;
|
|
10909
12087
|
this.data = result.campaign;
|
|
10910
12088
|
return result;
|
|
@@ -13885,7 +15063,7 @@ var {
|
|
|
13885
15063
|
var import_https2 = __toESM(require("https"));
|
|
13886
15064
|
|
|
13887
15065
|
// src/utils.ts
|
|
13888
|
-
var import_form_data2 = __toESM(
|
|
15066
|
+
var import_form_data2 = __toESM(require_form_data2());
|
|
13889
15067
|
|
|
13890
15068
|
// src/constants.ts
|
|
13891
15069
|
var DEFAULT_QUERY_CHANNELS_MESSAGE_LIST_PAGE_SIZE = 25;
|
|
@@ -14494,7 +15672,8 @@ var messagePaginationLinear = ({
|
|
|
14494
15672
|
return newPagination;
|
|
14495
15673
|
};
|
|
14496
15674
|
var messageSetPagination = (params) => {
|
|
14497
|
-
|
|
15675
|
+
const messagesFilteredLocally = params.returnedPage.filter(({ shadowed }) => shadowed);
|
|
15676
|
+
if (params.parentSet.messages.length + messagesFilteredLocally.length < params.returnedPage.length) {
|
|
14498
15677
|
params.logger?.(
|
|
14499
15678
|
"error",
|
|
14500
15679
|
"Corrupted message set state: parent set size < returned page size"
|
|
@@ -15416,19 +16595,307 @@ var getAttachmentTypeFromMimeType = (mimeType) => {
|
|
|
15416
16595
|
if (mimeType.includes("audio/")) return "audio";
|
|
15417
16596
|
return "file";
|
|
15418
16597
|
};
|
|
15419
|
-
var ensureIsLocalAttachment = (attachment) => {
|
|
15420
|
-
if (!attachment) return null;
|
|
15421
|
-
if (isLocalAttachment(attachment)) {
|
|
15422
|
-
return attachment;
|
|
16598
|
+
var ensureIsLocalAttachment = (attachment) => {
|
|
16599
|
+
if (!attachment) return null;
|
|
16600
|
+
if (isLocalAttachment(attachment)) {
|
|
16601
|
+
return attachment;
|
|
16602
|
+
}
|
|
16603
|
+
const { localMetadata, ...rest } = attachment;
|
|
16604
|
+
return {
|
|
16605
|
+
localMetadata: {
|
|
16606
|
+
...localMetadata ?? {},
|
|
16607
|
+
id: localMetadata?.id || generateUUIDv4()
|
|
16608
|
+
},
|
|
16609
|
+
...rest
|
|
16610
|
+
};
|
|
16611
|
+
};
|
|
16612
|
+
|
|
16613
|
+
// src/messageComposer/middleware/attachmentManager/postUpload/attachmentEnrichment.ts
|
|
16614
|
+
var createPostUploadAttachmentEnrichmentMiddleware = () => ({
|
|
16615
|
+
id: "stream-io/attachment-manager-middleware/post-upload-enrichment",
|
|
16616
|
+
handlers: {
|
|
16617
|
+
postProcess: ({
|
|
16618
|
+
state,
|
|
16619
|
+
discard,
|
|
16620
|
+
forward,
|
|
16621
|
+
next
|
|
16622
|
+
}) => {
|
|
16623
|
+
const { attachment, error, response } = state;
|
|
16624
|
+
if (error) return forward();
|
|
16625
|
+
if (!attachment || !response) return discard();
|
|
16626
|
+
const enrichedAttachment = { ...attachment };
|
|
16627
|
+
if (isLocalImageAttachment(attachment)) {
|
|
16628
|
+
if (attachment.localMetadata.previewUri) {
|
|
16629
|
+
URL.revokeObjectURL(attachment.localMetadata.previewUri);
|
|
16630
|
+
delete enrichedAttachment.localMetadata.previewUri;
|
|
16631
|
+
}
|
|
16632
|
+
enrichedAttachment.image_url = response.file;
|
|
16633
|
+
} else {
|
|
16634
|
+
enrichedAttachment.asset_url = response.file;
|
|
16635
|
+
}
|
|
16636
|
+
if (response.thumb_url) {
|
|
16637
|
+
enrichedAttachment.thumb_url = response.thumb_url;
|
|
16638
|
+
}
|
|
16639
|
+
return next({
|
|
16640
|
+
...state,
|
|
16641
|
+
attachment: enrichedAttachment
|
|
16642
|
+
});
|
|
16643
|
+
}
|
|
16644
|
+
}
|
|
16645
|
+
});
|
|
16646
|
+
|
|
16647
|
+
// src/utils/concurrency.ts
|
|
16648
|
+
var withoutConcurrency = createRunner(wrapWithContinuationTracking);
|
|
16649
|
+
var withCancellation = createRunner(wrapWithCancellation);
|
|
16650
|
+
var pendingPromises = /* @__PURE__ */ new Map();
|
|
16651
|
+
function createRunner(wrapper) {
|
|
16652
|
+
return function run(tag, cb) {
|
|
16653
|
+
const { cb: wrapped, onContinued } = wrapper(tag, cb);
|
|
16654
|
+
const pending = pendingPromises.get(tag);
|
|
16655
|
+
pending?.onContinued();
|
|
16656
|
+
const promise = pending ? pending.promise.then(wrapped, wrapped) : wrapped();
|
|
16657
|
+
pendingPromises.set(tag, { promise, onContinued });
|
|
16658
|
+
return promise;
|
|
16659
|
+
};
|
|
16660
|
+
}
|
|
16661
|
+
function wrapWithContinuationTracking(tag, cb) {
|
|
16662
|
+
let hasContinuation = false;
|
|
16663
|
+
const wrapped = () => cb().finally(() => {
|
|
16664
|
+
if (!hasContinuation) {
|
|
16665
|
+
pendingPromises.delete(tag);
|
|
16666
|
+
}
|
|
16667
|
+
});
|
|
16668
|
+
const onContinued = () => hasContinuation = true;
|
|
16669
|
+
return { cb: wrapped, onContinued };
|
|
16670
|
+
}
|
|
16671
|
+
function wrapWithCancellation(tag, cb) {
|
|
16672
|
+
const ac = new AbortController();
|
|
16673
|
+
const wrapped = () => {
|
|
16674
|
+
if (ac.signal.aborted) {
|
|
16675
|
+
return Promise.resolve("canceled");
|
|
16676
|
+
}
|
|
16677
|
+
return cb(ac.signal).finally(() => {
|
|
16678
|
+
if (!ac.signal.aborted) {
|
|
16679
|
+
pendingPromises.delete(tag);
|
|
16680
|
+
}
|
|
16681
|
+
});
|
|
16682
|
+
};
|
|
16683
|
+
const onContinued = () => ac.abort();
|
|
16684
|
+
return { cb: wrapped, onContinued };
|
|
16685
|
+
}
|
|
16686
|
+
|
|
16687
|
+
// src/middleware.ts
|
|
16688
|
+
var MiddlewareExecutor = class {
|
|
16689
|
+
constructor() {
|
|
16690
|
+
this.middleware = [];
|
|
16691
|
+
this.id = generateUUIDv4();
|
|
16692
|
+
}
|
|
16693
|
+
use(middleware) {
|
|
16694
|
+
this.middleware = this.middleware.concat(middleware);
|
|
16695
|
+
return this;
|
|
16696
|
+
}
|
|
16697
|
+
// todo: document how to re-arrange the order of middleware using replace
|
|
16698
|
+
replace(middleware) {
|
|
16699
|
+
const newMiddleware = [...this.middleware];
|
|
16700
|
+
middleware.forEach((upserted) => {
|
|
16701
|
+
const existingIndex = this.middleware.findIndex(
|
|
16702
|
+
(existing) => existing.id === upserted.id
|
|
16703
|
+
);
|
|
16704
|
+
if (existingIndex >= 0) {
|
|
16705
|
+
newMiddleware.splice(existingIndex, 1, upserted);
|
|
16706
|
+
} else {
|
|
16707
|
+
newMiddleware.push(upserted);
|
|
16708
|
+
}
|
|
16709
|
+
});
|
|
16710
|
+
this.middleware = newMiddleware;
|
|
16711
|
+
return this;
|
|
16712
|
+
}
|
|
16713
|
+
insert({
|
|
16714
|
+
middleware,
|
|
16715
|
+
position,
|
|
16716
|
+
unique
|
|
16717
|
+
}) {
|
|
16718
|
+
if (unique) {
|
|
16719
|
+
middleware.forEach((md) => {
|
|
16720
|
+
const existingMiddlewareIndex = this.middleware.findIndex((m) => m.id === md.id);
|
|
16721
|
+
if (existingMiddlewareIndex >= 0) {
|
|
16722
|
+
this.middleware.splice(existingMiddlewareIndex, 1);
|
|
16723
|
+
}
|
|
16724
|
+
});
|
|
16725
|
+
}
|
|
16726
|
+
const targetId = position.after || position.before;
|
|
16727
|
+
const targetIndex = this.middleware.findIndex((m) => m.id === targetId);
|
|
16728
|
+
const insertionIndex = position.after ? targetIndex + 1 : targetIndex;
|
|
16729
|
+
this.middleware.splice(insertionIndex, 0, ...middleware);
|
|
16730
|
+
return this;
|
|
16731
|
+
}
|
|
16732
|
+
setOrder(order) {
|
|
16733
|
+
this.middleware = order.map((id) => this.middleware.find((middleware) => middleware.id === id)).filter(Boolean);
|
|
16734
|
+
}
|
|
16735
|
+
async executeMiddlewareChain({
|
|
16736
|
+
eventName,
|
|
16737
|
+
initialValue,
|
|
16738
|
+
mode = "cancelable"
|
|
16739
|
+
}) {
|
|
16740
|
+
let index = -1;
|
|
16741
|
+
const execute = async (i, state, status) => {
|
|
16742
|
+
if (i <= index) {
|
|
16743
|
+
throw new Error("next() called multiple times");
|
|
16744
|
+
}
|
|
16745
|
+
index = i;
|
|
16746
|
+
const returnFromChain = i === this.middleware.length || status && ["complete", "discard"].includes(status);
|
|
16747
|
+
if (returnFromChain) return { state, status };
|
|
16748
|
+
const middleware = this.middleware[i];
|
|
16749
|
+
const handler = middleware.handlers[eventName];
|
|
16750
|
+
if (!handler) {
|
|
16751
|
+
return execute(i + 1, state, status);
|
|
16752
|
+
}
|
|
16753
|
+
const next = (adjustedState) => execute(i + 1, adjustedState);
|
|
16754
|
+
const complete = (adjustedState) => execute(i + 1, adjustedState, "complete");
|
|
16755
|
+
const discard = () => execute(i + 1, state, "discard");
|
|
16756
|
+
const forward = () => execute(i + 1, state);
|
|
16757
|
+
return await handler({
|
|
16758
|
+
state,
|
|
16759
|
+
next,
|
|
16760
|
+
complete,
|
|
16761
|
+
discard,
|
|
16762
|
+
forward
|
|
16763
|
+
});
|
|
16764
|
+
};
|
|
16765
|
+
const result = mode === "cancelable" ? await withCancellation(
|
|
16766
|
+
`middleware-execution-${this.id}-${eventName}`,
|
|
16767
|
+
async (abortSignal) => {
|
|
16768
|
+
const result2 = await execute(0, initialValue);
|
|
16769
|
+
if (abortSignal.aborted) {
|
|
16770
|
+
return "canceled";
|
|
16771
|
+
}
|
|
16772
|
+
return result2;
|
|
16773
|
+
}
|
|
16774
|
+
) : await execute(0, initialValue);
|
|
16775
|
+
return result === "canceled" ? { state: initialValue, status: "discard" } : result;
|
|
16776
|
+
}
|
|
16777
|
+
async execute({
|
|
16778
|
+
eventName,
|
|
16779
|
+
initialValue: initialState,
|
|
16780
|
+
mode
|
|
16781
|
+
}) {
|
|
16782
|
+
return await this.executeMiddlewareChain({
|
|
16783
|
+
eventName,
|
|
16784
|
+
initialValue: initialState,
|
|
16785
|
+
mode
|
|
16786
|
+
});
|
|
16787
|
+
}
|
|
16788
|
+
};
|
|
16789
|
+
|
|
16790
|
+
// src/messageComposer/middleware/attachmentManager/postUpload/uploadErrorHandler.ts
|
|
16791
|
+
var createUploadErrorHandlerMiddleware = (composer) => ({
|
|
16792
|
+
id: "stream-io/attachment-manager-middleware/upload-error",
|
|
16793
|
+
handlers: {
|
|
16794
|
+
postProcess: ({
|
|
16795
|
+
state,
|
|
16796
|
+
discard,
|
|
16797
|
+
forward
|
|
16798
|
+
}) => {
|
|
16799
|
+
const { attachment, error } = state;
|
|
16800
|
+
if (!error) return forward();
|
|
16801
|
+
if (!attachment) return discard();
|
|
16802
|
+
const reason = error instanceof Error ? error.message : "unknown error";
|
|
16803
|
+
composer.client.notifications.addError({
|
|
16804
|
+
message: "Error uploading attachment",
|
|
16805
|
+
origin: {
|
|
16806
|
+
emitter: "AttachmentManager",
|
|
16807
|
+
context: { attachment }
|
|
16808
|
+
},
|
|
16809
|
+
options: {
|
|
16810
|
+
type: "api:attachment:upload:failed",
|
|
16811
|
+
metadata: { reason },
|
|
16812
|
+
originalError: error
|
|
16813
|
+
}
|
|
16814
|
+
});
|
|
16815
|
+
return forward();
|
|
16816
|
+
}
|
|
16817
|
+
}
|
|
16818
|
+
});
|
|
16819
|
+
|
|
16820
|
+
// src/messageComposer/middleware/attachmentManager/postUpload/AttachmentPostUploadMiddlewareExecutor.ts
|
|
16821
|
+
var AttachmentPostUploadMiddlewareExecutor = class extends MiddlewareExecutor {
|
|
16822
|
+
constructor({ composer }) {
|
|
16823
|
+
super();
|
|
16824
|
+
this.use([
|
|
16825
|
+
createUploadErrorHandlerMiddleware(composer),
|
|
16826
|
+
createPostUploadAttachmentEnrichmentMiddleware()
|
|
16827
|
+
]);
|
|
16828
|
+
}
|
|
16829
|
+
};
|
|
16830
|
+
|
|
16831
|
+
// src/messageComposer/middleware/attachmentManager/preUpload/serverUploadConfigCheck.ts
|
|
16832
|
+
var createUploadConfigCheckMiddleware = (composer) => ({
|
|
16833
|
+
id: "stream-io/attachment-manager-middleware/file-upload-config-check",
|
|
16834
|
+
handlers: {
|
|
16835
|
+
prepare: async ({
|
|
16836
|
+
state,
|
|
16837
|
+
next,
|
|
16838
|
+
discard
|
|
16839
|
+
}) => {
|
|
16840
|
+
const { attachmentManager } = composer;
|
|
16841
|
+
if (!attachmentManager || !state.attachment) return discard();
|
|
16842
|
+
const uploadPermissionCheck = await attachmentManager.getUploadConfigCheck(
|
|
16843
|
+
state.attachment.localMetadata.file
|
|
16844
|
+
);
|
|
16845
|
+
const attachment = {
|
|
16846
|
+
...state.attachment,
|
|
16847
|
+
localMetadata: {
|
|
16848
|
+
...state.attachment.localMetadata,
|
|
16849
|
+
uploadPermissionCheck,
|
|
16850
|
+
uploadState: uploadPermissionCheck.uploadBlocked ? "blocked" : "pending"
|
|
16851
|
+
}
|
|
16852
|
+
};
|
|
16853
|
+
return next({
|
|
16854
|
+
...state,
|
|
16855
|
+
attachment
|
|
16856
|
+
});
|
|
16857
|
+
}
|
|
16858
|
+
}
|
|
16859
|
+
});
|
|
16860
|
+
|
|
16861
|
+
// src/messageComposer/middleware/attachmentManager/preUpload/blockedUploadNotification.ts
|
|
16862
|
+
var createBlockedAttachmentUploadNotificationMiddleware = (composer) => ({
|
|
16863
|
+
id: "stream-io/attachment-manager-middleware/blocked-upload-notification",
|
|
16864
|
+
handlers: {
|
|
16865
|
+
prepare: ({
|
|
16866
|
+
state: { attachment },
|
|
16867
|
+
forward
|
|
16868
|
+
}) => {
|
|
16869
|
+
if (!attachment) return forward();
|
|
16870
|
+
if (attachment.localMetadata.uploadPermissionCheck?.uploadBlocked) {
|
|
16871
|
+
composer.client.notifications.addError({
|
|
16872
|
+
message: `The attachment upload was blocked`,
|
|
16873
|
+
origin: {
|
|
16874
|
+
emitter: "AttachmentManager",
|
|
16875
|
+
context: { blockedAttachment: attachment }
|
|
16876
|
+
},
|
|
16877
|
+
options: {
|
|
16878
|
+
type: "validation:attachment:upload:blocked",
|
|
16879
|
+
metadata: {
|
|
16880
|
+
reason: attachment.localMetadata.uploadPermissionCheck?.reason
|
|
16881
|
+
}
|
|
16882
|
+
}
|
|
16883
|
+
});
|
|
16884
|
+
}
|
|
16885
|
+
return forward();
|
|
16886
|
+
}
|
|
16887
|
+
}
|
|
16888
|
+
});
|
|
16889
|
+
|
|
16890
|
+
// src/messageComposer/middleware/attachmentManager/preUpload/AttachmentPreUploadMiddlewareExecutor.ts
|
|
16891
|
+
var AttachmentPreUploadMiddlewareExecutor = class extends MiddlewareExecutor {
|
|
16892
|
+
constructor({ composer }) {
|
|
16893
|
+
super();
|
|
16894
|
+
this.use([
|
|
16895
|
+
createUploadConfigCheckMiddleware(composer),
|
|
16896
|
+
createBlockedAttachmentUploadNotificationMiddleware(composer)
|
|
16897
|
+
]);
|
|
15423
16898
|
}
|
|
15424
|
-
const { localMetadata, ...rest } = attachment;
|
|
15425
|
-
return {
|
|
15426
|
-
localMetadata: {
|
|
15427
|
-
...localMetadata ?? {},
|
|
15428
|
-
id: localMetadata?.id || generateUUIDv4()
|
|
15429
|
-
},
|
|
15430
|
-
...rest
|
|
15431
|
-
};
|
|
15432
16899
|
};
|
|
15433
16900
|
|
|
15434
16901
|
// src/store.ts
|
|
@@ -16022,7 +17489,7 @@ var initState = ({
|
|
|
16022
17489
|
};
|
|
16023
17490
|
})
|
|
16024
17491
|
});
|
|
16025
|
-
var
|
|
17492
|
+
var _AttachmentManager = class _AttachmentManager {
|
|
16026
17493
|
constructor({ composer, message }) {
|
|
16027
17494
|
this.setCustomUploadFn = (doUploadRequest) => {
|
|
16028
17495
|
this.composer.updateConfig({ attachments: { doUploadRequest } });
|
|
@@ -16129,42 +17596,18 @@ var AttachmentManager = class {
|
|
|
16129
17596
|
}
|
|
16130
17597
|
return { uploadBlocked: false };
|
|
16131
17598
|
};
|
|
17599
|
+
// @deprecated use AttachmentManager.toLocalUploadAttachment(file)
|
|
16132
17600
|
this.fileToLocalUploadAttachment = async (fileLike) => {
|
|
16133
|
-
const
|
|
16134
|
-
|
|
16135
|
-
|
|
16136
|
-
|
|
16137
|
-
|
|
16138
|
-
|
|
16139
|
-
const localAttachment = {
|
|
16140
|
-
file_size: file.size,
|
|
16141
|
-
mime_type: file.type,
|
|
16142
|
-
localMetadata: {
|
|
16143
|
-
file,
|
|
16144
|
-
id: generateUUIDv4(),
|
|
16145
|
-
uploadPermissionCheck,
|
|
16146
|
-
uploadState: uploadPermissionCheck.uploadBlocked ? "blocked" : "pending"
|
|
16147
|
-
},
|
|
16148
|
-
type: getAttachmentTypeFromMimeType(file.type)
|
|
16149
|
-
};
|
|
16150
|
-
localAttachment[isImageFile(file) ? "fallback" : "title"] = file.name;
|
|
16151
|
-
if (isImageFile(file)) {
|
|
16152
|
-
localAttachment.localMetadata.previewUri = isFileReference(fileLike) ? fileLike.uri : URL.createObjectURL?.(fileLike);
|
|
16153
|
-
if (isFileReference(fileLike) && fileLike.height && fileLike.width) {
|
|
16154
|
-
localAttachment.original_height = fileLike.height;
|
|
16155
|
-
localAttachment.original_width = fileLike.width;
|
|
16156
|
-
}
|
|
16157
|
-
}
|
|
16158
|
-
if (isFileReference(fileLike) && fileLike.thumb_url) {
|
|
16159
|
-
localAttachment.thumb_url = fileLike.thumb_url;
|
|
16160
|
-
}
|
|
16161
|
-
if (isFileReference(fileLike) && fileLike.duration) {
|
|
16162
|
-
localAttachment.duration = fileLike.duration;
|
|
16163
|
-
}
|
|
17601
|
+
const localAttachment = _AttachmentManager.toLocalUploadAttachment(fileLike);
|
|
17602
|
+
const uploadPermissionCheck = await this.getUploadConfigCheck(
|
|
17603
|
+
localAttachment.localMetadata.file
|
|
17604
|
+
);
|
|
17605
|
+
localAttachment.localMetadata.uploadPermissionCheck = uploadPermissionCheck;
|
|
17606
|
+
localAttachment.localMetadata.uploadState = uploadPermissionCheck.uploadBlocked ? "blocked" : "pending";
|
|
16164
17607
|
return localAttachment;
|
|
16165
17608
|
};
|
|
16166
17609
|
this.ensureLocalUploadAttachment = async (attachment) => {
|
|
16167
|
-
if (!attachment.localMetadata?.file
|
|
17610
|
+
if (!attachment.localMetadata?.file) {
|
|
16168
17611
|
this.client.notifications.addError({
|
|
16169
17612
|
message: "File is required for upload attachment",
|
|
16170
17613
|
origin: { emitter: "AttachmentManager", context: { attachment } },
|
|
@@ -16172,6 +17615,14 @@ var AttachmentManager = class {
|
|
|
16172
17615
|
});
|
|
16173
17616
|
return;
|
|
16174
17617
|
}
|
|
17618
|
+
if (!attachment.localMetadata.id) {
|
|
17619
|
+
this.client.notifications.addError({
|
|
17620
|
+
message: "Local upload attachment missing local id",
|
|
17621
|
+
origin: { emitter: "AttachmentManager", context: { attachment } },
|
|
17622
|
+
options: { type: "validation:attachment:id:missing" }
|
|
17623
|
+
});
|
|
17624
|
+
return;
|
|
17625
|
+
}
|
|
16175
17626
|
if (!this.fileUploadFilter(attachment)) return;
|
|
16176
17627
|
const newAttachment = await this.fileToLocalUploadAttachment(
|
|
16177
17628
|
attachment.localMetadata.file
|
|
@@ -16211,6 +17662,7 @@ var AttachmentManager = class {
|
|
|
16211
17662
|
}
|
|
16212
17663
|
return this.doDefaultUploadRequest(fileLike);
|
|
16213
17664
|
};
|
|
17665
|
+
// @deprecated use attachmentManager.uploadFile(file)
|
|
16214
17666
|
this.uploadAttachment = async (attachment) => {
|
|
16215
17667
|
if (!this.isUploadEnabled) return;
|
|
16216
17668
|
const localAttachment = await this.ensureLocalUploadAttachment(attachment);
|
|
@@ -16294,19 +17746,75 @@ var AttachmentManager = class {
|
|
|
16294
17746
|
this.updateAttachment(uploadedAttachment);
|
|
16295
17747
|
return uploadedAttachment;
|
|
16296
17748
|
};
|
|
17749
|
+
this.uploadFile = async (file) => {
|
|
17750
|
+
const preUpload = await this.preUploadMiddlewareExecutor.execute({
|
|
17751
|
+
eventName: "prepare",
|
|
17752
|
+
initialValue: {
|
|
17753
|
+
attachment: _AttachmentManager.toLocalUploadAttachment(file)
|
|
17754
|
+
},
|
|
17755
|
+
mode: "concurrent"
|
|
17756
|
+
});
|
|
17757
|
+
let attachment = preUpload.state.attachment;
|
|
17758
|
+
if (preUpload.status === "discard") return attachment;
|
|
17759
|
+
if (!this.fileUploadFilter(attachment)) return attachment;
|
|
17760
|
+
if (attachment.localMetadata.uploadState === "blocked") {
|
|
17761
|
+
this.upsertAttachments([attachment]);
|
|
17762
|
+
return preUpload.state.attachment;
|
|
17763
|
+
}
|
|
17764
|
+
attachment = {
|
|
17765
|
+
...attachment,
|
|
17766
|
+
localMetadata: {
|
|
17767
|
+
...attachment.localMetadata,
|
|
17768
|
+
uploadState: "uploading"
|
|
17769
|
+
}
|
|
17770
|
+
};
|
|
17771
|
+
this.upsertAttachments([attachment]);
|
|
17772
|
+
let response;
|
|
17773
|
+
let error;
|
|
17774
|
+
try {
|
|
17775
|
+
response = await this.doUploadRequest(file);
|
|
17776
|
+
} catch (err) {
|
|
17777
|
+
error = err instanceof Error ? err : void 0;
|
|
17778
|
+
}
|
|
17779
|
+
const postUpload = await this.postUploadMiddlewareExecutor.execute({
|
|
17780
|
+
eventName: "postProcess",
|
|
17781
|
+
initialValue: {
|
|
17782
|
+
attachment: {
|
|
17783
|
+
...attachment,
|
|
17784
|
+
localMetadata: {
|
|
17785
|
+
...attachment.localMetadata,
|
|
17786
|
+
uploadState: error ? "failed" : "finished"
|
|
17787
|
+
}
|
|
17788
|
+
},
|
|
17789
|
+
error,
|
|
17790
|
+
response
|
|
17791
|
+
},
|
|
17792
|
+
mode: "concurrent"
|
|
17793
|
+
});
|
|
17794
|
+
attachment = postUpload.state.attachment;
|
|
17795
|
+
if (postUpload.status === "discard") {
|
|
17796
|
+
this.removeAttachments([attachment.localMetadata.id]);
|
|
17797
|
+
return attachment;
|
|
17798
|
+
}
|
|
17799
|
+
this.updateAttachment(attachment);
|
|
17800
|
+
return attachment;
|
|
17801
|
+
};
|
|
16297
17802
|
this.uploadFiles = async (files) => {
|
|
16298
17803
|
if (!this.isUploadEnabled) return;
|
|
16299
17804
|
const iterableFiles = isFileList2(files) ? Array.from(files) : files;
|
|
16300
|
-
|
|
16301
|
-
iterableFiles.map(this.
|
|
16302
|
-
);
|
|
16303
|
-
return Promise.all(
|
|
16304
|
-
attachments.filter(this.fileUploadFilter).slice(0, this.availableUploadSlots).map(this.uploadAttachment)
|
|
17805
|
+
return await Promise.all(
|
|
17806
|
+
iterableFiles.slice(0, this.availableUploadSlots).map(this.uploadFile)
|
|
16305
17807
|
);
|
|
16306
17808
|
};
|
|
16307
17809
|
this.composer = composer;
|
|
16308
17810
|
this.state = new StateStore(initState({ message }));
|
|
16309
17811
|
this.attachmentsByIdGetterCache = { attachmentsById: {}, attachments: [] };
|
|
17812
|
+
this.preUploadMiddlewareExecutor = new AttachmentPreUploadMiddlewareExecutor({
|
|
17813
|
+
composer
|
|
17814
|
+
});
|
|
17815
|
+
this.postUploadMiddlewareExecutor = new AttachmentPostUploadMiddlewareExecutor({
|
|
17816
|
+
composer
|
|
17817
|
+
});
|
|
16310
17818
|
}
|
|
16311
17819
|
get attachmentsById() {
|
|
16312
17820
|
const { attachments } = this.state.getLatestValue();
|
|
@@ -16336,9 +17844,15 @@ var AttachmentManager = class {
|
|
|
16336
17844
|
set acceptedFiles(acceptedFiles) {
|
|
16337
17845
|
this.composer.updateConfig({ attachments: { acceptedFiles } });
|
|
16338
17846
|
}
|
|
17847
|
+
/*
|
|
17848
|
+
@deprecated attachments can be filtered using injecting pre-upload middleware
|
|
17849
|
+
*/
|
|
16339
17850
|
get fileUploadFilter() {
|
|
16340
17851
|
return this.config.fileUploadFilter;
|
|
16341
17852
|
}
|
|
17853
|
+
/*
|
|
17854
|
+
@deprecated attachments can be filtered using injecting pre-upload middleware
|
|
17855
|
+
*/
|
|
16342
17856
|
set fileUploadFilter(fileUploadFilter) {
|
|
16343
17857
|
this.composer.updateConfig({ attachments: { fileUploadFilter } });
|
|
16344
17858
|
}
|
|
@@ -16385,6 +17899,39 @@ var AttachmentManager = class {
|
|
|
16385
17899
|
);
|
|
16386
17900
|
}
|
|
16387
17901
|
};
|
|
17902
|
+
_AttachmentManager.toLocalUploadAttachment = (fileLike) => {
|
|
17903
|
+
const file = isFileReference(fileLike) || isFile2(fileLike) ? fileLike : createFileFromBlobs({
|
|
17904
|
+
blobsArray: [fileLike],
|
|
17905
|
+
fileName: generateFileName(fileLike.type),
|
|
17906
|
+
mimeType: fileLike.type
|
|
17907
|
+
});
|
|
17908
|
+
const localAttachment = {
|
|
17909
|
+
file_size: file.size,
|
|
17910
|
+
mime_type: file.type,
|
|
17911
|
+
localMetadata: {
|
|
17912
|
+
file,
|
|
17913
|
+
id: generateUUIDv4(),
|
|
17914
|
+
uploadState: "pending"
|
|
17915
|
+
},
|
|
17916
|
+
type: getAttachmentTypeFromMimeType(file.type)
|
|
17917
|
+
};
|
|
17918
|
+
localAttachment[isImageFile(file) ? "fallback" : "title"] = file.name;
|
|
17919
|
+
if (isImageFile(file)) {
|
|
17920
|
+
localAttachment.localMetadata.previewUri = isFileReference(fileLike) ? fileLike.uri : URL.createObjectURL?.(fileLike);
|
|
17921
|
+
if (isFileReference(fileLike) && fileLike.height && fileLike.width) {
|
|
17922
|
+
localAttachment.original_height = fileLike.height;
|
|
17923
|
+
localAttachment.original_width = fileLike.width;
|
|
17924
|
+
}
|
|
17925
|
+
}
|
|
17926
|
+
if (isFileReference(fileLike) && fileLike.thumb_url) {
|
|
17927
|
+
localAttachment.thumb_url = fileLike.thumb_url;
|
|
17928
|
+
}
|
|
17929
|
+
if (isFileReference(fileLike) && fileLike.duration) {
|
|
17930
|
+
localAttachment.duration = fileLike.duration;
|
|
17931
|
+
}
|
|
17932
|
+
return localAttachment;
|
|
17933
|
+
};
|
|
17934
|
+
var AttachmentManager = _AttachmentManager;
|
|
16388
17935
|
|
|
16389
17936
|
// src/messageComposer/configuration/configuration.ts
|
|
16390
17937
|
var import_linkifyjs = require("linkifyjs");
|
|
@@ -16724,146 +18271,6 @@ var LocationComposer = class {
|
|
|
16724
18271
|
}
|
|
16725
18272
|
};
|
|
16726
18273
|
|
|
16727
|
-
// src/utils/concurrency.ts
|
|
16728
|
-
var withoutConcurrency = createRunner(wrapWithContinuationTracking);
|
|
16729
|
-
var withCancellation = createRunner(wrapWithCancellation);
|
|
16730
|
-
var pendingPromises = /* @__PURE__ */ new Map();
|
|
16731
|
-
function createRunner(wrapper) {
|
|
16732
|
-
return function run(tag, cb) {
|
|
16733
|
-
const { cb: wrapped, onContinued } = wrapper(tag, cb);
|
|
16734
|
-
const pending = pendingPromises.get(tag);
|
|
16735
|
-
pending?.onContinued();
|
|
16736
|
-
const promise = pending ? pending.promise.then(wrapped, wrapped) : wrapped();
|
|
16737
|
-
pendingPromises.set(tag, { promise, onContinued });
|
|
16738
|
-
return promise;
|
|
16739
|
-
};
|
|
16740
|
-
}
|
|
16741
|
-
function wrapWithContinuationTracking(tag, cb) {
|
|
16742
|
-
let hasContinuation = false;
|
|
16743
|
-
const wrapped = () => cb().finally(() => {
|
|
16744
|
-
if (!hasContinuation) {
|
|
16745
|
-
pendingPromises.delete(tag);
|
|
16746
|
-
}
|
|
16747
|
-
});
|
|
16748
|
-
const onContinued = () => hasContinuation = true;
|
|
16749
|
-
return { cb: wrapped, onContinued };
|
|
16750
|
-
}
|
|
16751
|
-
function wrapWithCancellation(tag, cb) {
|
|
16752
|
-
const ac = new AbortController();
|
|
16753
|
-
const wrapped = () => {
|
|
16754
|
-
if (ac.signal.aborted) {
|
|
16755
|
-
return Promise.resolve("canceled");
|
|
16756
|
-
}
|
|
16757
|
-
return cb(ac.signal).finally(() => {
|
|
16758
|
-
if (!ac.signal.aborted) {
|
|
16759
|
-
pendingPromises.delete(tag);
|
|
16760
|
-
}
|
|
16761
|
-
});
|
|
16762
|
-
};
|
|
16763
|
-
const onContinued = () => ac.abort();
|
|
16764
|
-
return { cb: wrapped, onContinued };
|
|
16765
|
-
}
|
|
16766
|
-
|
|
16767
|
-
// src/middleware.ts
|
|
16768
|
-
var MiddlewareExecutor = class {
|
|
16769
|
-
constructor() {
|
|
16770
|
-
this.middleware = [];
|
|
16771
|
-
this.id = generateUUIDv4();
|
|
16772
|
-
}
|
|
16773
|
-
use(middleware) {
|
|
16774
|
-
this.middleware = this.middleware.concat(middleware);
|
|
16775
|
-
return this;
|
|
16776
|
-
}
|
|
16777
|
-
// todo: document how to re-arrange the order of middleware using replace
|
|
16778
|
-
replace(middleware) {
|
|
16779
|
-
const newMiddleware = [...this.middleware];
|
|
16780
|
-
middleware.forEach((upserted) => {
|
|
16781
|
-
const existingIndex = this.middleware.findIndex(
|
|
16782
|
-
(existing) => existing.id === upserted.id
|
|
16783
|
-
);
|
|
16784
|
-
if (existingIndex >= 0) {
|
|
16785
|
-
newMiddleware.splice(existingIndex, 1, upserted);
|
|
16786
|
-
} else {
|
|
16787
|
-
newMiddleware.push(upserted);
|
|
16788
|
-
}
|
|
16789
|
-
});
|
|
16790
|
-
this.middleware = newMiddleware;
|
|
16791
|
-
return this;
|
|
16792
|
-
}
|
|
16793
|
-
insert({
|
|
16794
|
-
middleware,
|
|
16795
|
-
position,
|
|
16796
|
-
unique
|
|
16797
|
-
}) {
|
|
16798
|
-
if (unique) {
|
|
16799
|
-
middleware.forEach((md) => {
|
|
16800
|
-
const existingMiddlewareIndex = this.middleware.findIndex((m) => m.id === md.id);
|
|
16801
|
-
if (existingMiddlewareIndex >= 0) {
|
|
16802
|
-
this.middleware.splice(existingMiddlewareIndex, 1);
|
|
16803
|
-
}
|
|
16804
|
-
});
|
|
16805
|
-
}
|
|
16806
|
-
const targetId = position.after || position.before;
|
|
16807
|
-
const targetIndex = this.middleware.findIndex((m) => m.id === targetId);
|
|
16808
|
-
const insertionIndex = position.after ? targetIndex + 1 : targetIndex;
|
|
16809
|
-
this.middleware.splice(insertionIndex, 0, ...middleware);
|
|
16810
|
-
return this;
|
|
16811
|
-
}
|
|
16812
|
-
setOrder(order) {
|
|
16813
|
-
this.middleware = order.map((id) => this.middleware.find((middleware) => middleware.id === id)).filter(Boolean);
|
|
16814
|
-
}
|
|
16815
|
-
async executeMiddlewareChain({
|
|
16816
|
-
eventName,
|
|
16817
|
-
initialValue
|
|
16818
|
-
}) {
|
|
16819
|
-
let index = -1;
|
|
16820
|
-
const execute = async (i, state, status) => {
|
|
16821
|
-
if (i <= index) {
|
|
16822
|
-
throw new Error("next() called multiple times");
|
|
16823
|
-
}
|
|
16824
|
-
index = i;
|
|
16825
|
-
const returnFromChain = i === this.middleware.length || status && ["complete", "discard"].includes(status);
|
|
16826
|
-
if (returnFromChain) return { state, status };
|
|
16827
|
-
const middleware = this.middleware[i];
|
|
16828
|
-
const handler = middleware.handlers[eventName];
|
|
16829
|
-
if (!handler) {
|
|
16830
|
-
return execute(i + 1, state, status);
|
|
16831
|
-
}
|
|
16832
|
-
const next = (adjustedState) => execute(i + 1, adjustedState);
|
|
16833
|
-
const complete = (adjustedState) => execute(i + 1, adjustedState, "complete");
|
|
16834
|
-
const discard = () => execute(i + 1, state, "discard");
|
|
16835
|
-
const forward = () => execute(i + 1, state);
|
|
16836
|
-
return await handler({
|
|
16837
|
-
state,
|
|
16838
|
-
next,
|
|
16839
|
-
complete,
|
|
16840
|
-
discard,
|
|
16841
|
-
forward
|
|
16842
|
-
});
|
|
16843
|
-
};
|
|
16844
|
-
const result = await withCancellation(
|
|
16845
|
-
`middleware-execution-${this.id}-${eventName}`,
|
|
16846
|
-
async (abortSignal) => {
|
|
16847
|
-
const result2 = await execute(0, initialValue);
|
|
16848
|
-
if (abortSignal.aborted) {
|
|
16849
|
-
return "canceled";
|
|
16850
|
-
}
|
|
16851
|
-
return result2;
|
|
16852
|
-
}
|
|
16853
|
-
);
|
|
16854
|
-
return result === "canceled" ? { state: initialValue, status: "discard" } : result;
|
|
16855
|
-
}
|
|
16856
|
-
async execute({
|
|
16857
|
-
eventName,
|
|
16858
|
-
initialValue: initialState
|
|
16859
|
-
}) {
|
|
16860
|
-
return await this.executeMiddlewareChain({
|
|
16861
|
-
eventName,
|
|
16862
|
-
initialValue: initialState
|
|
16863
|
-
});
|
|
16864
|
-
}
|
|
16865
|
-
};
|
|
16866
|
-
|
|
16867
18274
|
// src/messageComposer/middleware/pollComposer/state.ts
|
|
16868
18275
|
var VALID_MAX_VOTES_VALUE_REGEX = /^([2-9]|10)$/;
|
|
16869
18276
|
var MAX_POLL_OPTIONS = 100;
|
|
@@ -19798,7 +21205,7 @@ var _MessageComposer = class _MessageComposer extends WithSubscriptions {
|
|
|
19798
21205
|
id: this.id,
|
|
19799
21206
|
mentioned_users: [],
|
|
19800
21207
|
parent_id: this.threadId ?? void 0,
|
|
19801
|
-
pinned_at: null,
|
|
21208
|
+
pinned_at: this.editedMessage?.pinned_at || null,
|
|
19802
21209
|
reaction_groups: null,
|
|
19803
21210
|
status: this.editedMessage ? this.editedMessage.status : "sending",
|
|
19804
21211
|
text,
|
|
@@ -27105,7 +28512,7 @@ var StreamChat = class _StreamChat {
|
|
|
27105
28512
|
if (this.userAgent) {
|
|
27106
28513
|
return this.userAgent;
|
|
27107
28514
|
}
|
|
27108
|
-
const version = "9.
|
|
28515
|
+
const version = "9.14.0";
|
|
27109
28516
|
const clientBundle = "node-cjs";
|
|
27110
28517
|
let userAgentString = "";
|
|
27111
28518
|
if (this.sdkIdentifier) {
|