@oneuptime/common 14.0.108 → 14.0.110
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/Models/AnalyticsModels/AuditLog.js +1 -1
- package/Models/AnalyticsModels/SecurityEvent.js +1 -1
- package/Models/DatabaseModels/AIInsight.js +2 -2
- package/Models/DatabaseModels/Alert.js +2 -2
- package/Models/DatabaseModels/AlertEpisode.js +2 -2
- package/Models/DatabaseModels/AlertEpisodeOnCallRule.js +3 -3
- package/Models/DatabaseModels/AlertGroupingRule.d.mts +1 -0
- package/Models/DatabaseModels/AlertGroupingRule.d.ts +1 -0
- package/Models/DatabaseModels/AlertGroupingRule.js +48 -2
- package/Models/DatabaseModels/AlertOnCallRule.js +3 -3
- package/Models/DatabaseModels/AlertSeverity.js +13 -4
- package/Models/DatabaseModels/AlertState.js +1 -1
- package/Models/DatabaseModels/CallLog.js +12 -12
- package/Models/DatabaseModels/CloudApp.d.mts +5 -0
- package/Models/DatabaseModels/CloudApp.d.ts +5 -0
- package/Models/DatabaseModels/CloudApp.js +112 -0
- package/Models/DatabaseModels/DatabaseBaseModel/DatabaseBaseModel.d.mts +2 -0
- package/Models/DatabaseModels/DatabaseBaseModel/DatabaseBaseModel.d.ts +2 -0
- package/Models/DatabaseModels/EmailLog.js +12 -12
- package/Models/DatabaseModels/FormSubmission.js +2 -2
- package/Models/DatabaseModels/GlobalConfig.d.mts +6 -0
- package/Models/DatabaseModels/GlobalConfig.d.ts +6 -0
- package/Models/DatabaseModels/GlobalConfig.js +139 -0
- package/Models/DatabaseModels/Incident.js +2 -2
- package/Models/DatabaseModels/IncidentEpisode.js +2 -2
- package/Models/DatabaseModels/IncidentEpisodeOnCallRule.js +3 -3
- package/Models/DatabaseModels/IncidentGroupingRule.d.mts +1 -0
- package/Models/DatabaseModels/IncidentGroupingRule.d.ts +1 -0
- package/Models/DatabaseModels/IncidentGroupingRule.js +48 -2
- package/Models/DatabaseModels/IncidentOnCallRule.js +3 -3
- package/Models/DatabaseModels/IncidentSeverity.js +13 -4
- package/Models/DatabaseModels/IncidentState.js +1 -1
- package/Models/DatabaseModels/IncidentTemplate.js +2 -2
- package/Models/DatabaseModels/Index.js +7 -0
- package/Models/DatabaseModels/Monitor.js +17 -3
- package/Models/DatabaseModels/MonitorStatusTimeline.d.mts +1 -0
- package/Models/DatabaseModels/MonitorStatusTimeline.d.ts +1 -0
- package/Models/DatabaseModels/MonitorStatusTimeline.js +43 -0
- package/Models/DatabaseModels/NetworkDevice.d.mts +1 -0
- package/Models/DatabaseModels/NetworkDevice.d.ts +1 -0
- package/Models/DatabaseModels/NetworkDevice.js +41 -0
- package/Models/DatabaseModels/OnCallDutyPolicy.js +4 -2
- package/Models/DatabaseModels/OnCallDutyPolicyEscalationRule.js +1 -1
- package/Models/DatabaseModels/OnCallDutyPolicyEscalationRuleSchedule.js +8 -5
- package/Models/DatabaseModels/OnCallDutyPolicyEscalationRuleTeam.js +5 -2
- package/Models/DatabaseModels/OnCallDutyPolicyEscalationRuleUser.js +5 -2
- package/Models/DatabaseModels/OnCallDutyPolicyExecutionLog.d.mts +4 -0
- package/Models/DatabaseModels/OnCallDutyPolicyExecutionLog.d.ts +4 -0
- package/Models/DatabaseModels/OnCallDutyPolicyExecutionLog.js +141 -8
- package/Models/DatabaseModels/OnCallDutyPolicyExecutionLogTimeline.js +10 -7
- package/Models/DatabaseModels/OnCallDutyPolicyFeed.js +14 -11
- package/Models/DatabaseModels/OnCallDutyPolicyOwnerTeam.js +7 -4
- package/Models/DatabaseModels/OnCallDutyPolicyOwnerUser.js +7 -4
- package/Models/DatabaseModels/OnCallDutyPolicySchedule.js +6 -3
- package/Models/DatabaseModels/OnCallDutyPolicyScheduleCalendarFeed.js +4 -4
- package/Models/DatabaseModels/OnCallDutyPolicyScheduleLayer.js +3 -3
- package/Models/DatabaseModels/OnCallDutyPolicyScheduleLayerUser.js +6 -6
- package/Models/DatabaseModels/OnCallDutyPolicyTimeLog.js +9 -6
- package/Models/DatabaseModels/ProductFeedback.d.mts +11 -0
- package/Models/DatabaseModels/ProductFeedback.d.ts +11 -0
- package/Models/DatabaseModels/ProductFeedback.js +203 -0
- package/Models/DatabaseModels/ProductFeedback.mjs +2 -0
- package/Models/DatabaseModels/Project.d.mts +8 -0
- package/Models/DatabaseModels/Project.d.ts +8 -0
- package/Models/DatabaseModels/Project.js +333 -2
- package/Models/DatabaseModels/ProjectMilestone.d.mts +11 -0
- package/Models/DatabaseModels/ProjectMilestone.d.ts +11 -0
- package/Models/DatabaseModels/ProjectMilestone.js +207 -0
- package/Models/DatabaseModels/ProjectMilestone.mjs +2 -0
- package/Models/DatabaseModels/ProjectUserPreference.d.mts +11 -0
- package/Models/DatabaseModels/ProjectUserPreference.d.ts +11 -0
- package/Models/DatabaseModels/ProjectUserPreference.js +194 -0
- package/Models/DatabaseModels/ProjectUserPreference.mjs +2 -0
- package/Models/DatabaseModels/ProxmoxCluster.d.mts +1 -0
- package/Models/DatabaseModels/ProxmoxCluster.d.ts +1 -0
- package/Models/DatabaseModels/ProxmoxCluster.js +52 -3
- package/Models/DatabaseModels/PushNotificationLog.js +12 -12
- package/Models/DatabaseModels/Reseller.js +8 -2
- package/Models/DatabaseModels/ResellerPlan.js +8 -2
- package/Models/DatabaseModels/RumSessionPin.js +16 -2
- package/Models/DatabaseModels/RumSessionReplayView.js +8 -1
- package/Models/DatabaseModels/ScheduledMaintenance.js +6 -3
- package/Models/DatabaseModels/ScheduledMaintenanceInternalNote.js +7 -4
- package/Models/DatabaseModels/ScheduledMaintenanceMeasurementValue.js +2 -2
- package/Models/DatabaseModels/ScheduledMaintenancePublicNote.js +7 -4
- package/Models/DatabaseModels/ScheduledMaintenanceStateTimeline.js +1 -1
- package/Models/DatabaseModels/SecurityCase.js +8 -1
- package/Models/DatabaseModels/Service.js +1 -1
- package/Models/DatabaseModels/ServiceLevelObjectiveBurnRateRule.js +4 -4
- package/Models/DatabaseModels/ServiceLevelObjectiveErrorBudgetPolicyTier.js +4 -4
- package/Models/DatabaseModels/SmsLog.js +12 -12
- package/Models/DatabaseModels/StatusPage.js +5 -5
- package/Models/DatabaseModels/StatusPageSubscriber.js +2 -2
- package/Models/DatabaseModels/TelegramLog.js +12 -12
- package/Models/DatabaseModels/TelemetryIngestionKey.js +8 -5
- package/Models/DatabaseModels/TelemetryIngestionKeyRefusal.js +7 -4
- package/Models/DatabaseModels/User.d.mts +6 -0
- package/Models/DatabaseModels/User.d.ts +6 -0
- package/Models/DatabaseModels/User.js +152 -0
- package/Models/DatabaseModels/UserOnCallLog.js +38 -10
- package/Models/DatabaseModels/UserOnCallLogTimeline.js +13 -3
- package/Models/DatabaseModels/UserOnCallShiftReminderLog.js +2 -2
- package/Models/DatabaseModels/WebhookLog.js +12 -12
- package/Models/DatabaseModels/WhatsAppLog.js +12 -12
- package/Models/DatabaseModels/WorkspaceNotificationLog.js +12 -12
- package/Models/DatabaseModels/WorkspaceNotificationSummary.js +1 -1
- package/Models/DatabaseModels/WorkspaceProjectAuthToken.d.mts +9 -0
- package/Models/DatabaseModels/WorkspaceProjectAuthToken.d.ts +9 -0
- package/Server/Services/DatabaseService.d.mts +1 -0
- package/Server/Services/DatabaseService.d.ts +1 -0
- package/Server/Utils/Telemetry/NotificationDeliveryMetrics.d.mts +2 -1
- package/Server/Utils/Telemetry/NotificationDeliveryMetrics.d.ts +2 -1
- package/Server/Utils/Workspace/WorkspaceBase.d.mts +1 -0
- package/Server/Utils/Workspace/WorkspaceBase.d.ts +1 -0
- package/Types/AI/AIActionWords.d.mts +167 -7
- package/Types/AI/AIActionWords.d.ts +167 -7
- package/Types/AI/AIActionWords.js +474 -17
- package/Types/AI/AIActionWords.mjs +22 -0
- package/Types/AI/AIChatMessageStatus.js +3 -2
- package/Types/AI/AIChatRecordSeen.d.mts +6 -2
- package/Types/AI/AIChatRecordSeen.d.ts +6 -2
- package/Types/AI/AIChatRecordSeen.js +48 -9
- package/Types/AI/AIChatRecordSeen.mjs +2 -0
- package/Types/AI/AIChatTypes.d.mts +21 -2
- package/Types/AI/AIChatTypes.d.ts +21 -2
- package/Types/AI/AIChatTypes.js +49 -1
- package/Types/AI/AIChatTypes.mjs +3 -0
- package/Types/AI/AIRunAttempt.d.mts +8 -0
- package/Types/AI/AIRunAttempt.d.ts +8 -0
- package/Types/AI/AIRunAttempt.js +60 -6
- package/Types/AI/AIRunAttempt.mjs +3 -0
- package/Types/AI/AISetupActions.d.mts +9 -0
- package/Types/AI/AISetupActions.d.ts +9 -0
- package/Types/AI/AISetupActions.js +56 -0
- package/Types/AI/AISetupActions.mjs +10 -0
- package/Types/AI/CodeTask.d.mts +14 -0
- package/Types/AI/CodeTask.d.ts +14 -0
- package/Types/AI/RecordAiTokenLimit.d.mts +24 -0
- package/Types/AI/RecordAiTokenLimit.d.ts +24 -0
- package/Types/AI/RecordAiTokenLimit.js +153 -0
- package/Types/AI/RecordAiTokenLimit.mjs +8 -0
- package/Types/Accounts/SignInMessages.d.mts +8 -0
- package/Types/Accounts/SignInMessages.d.ts +8 -0
- package/Types/Accounts/SignInMessages.js +28 -0
- package/Types/Accounts/SignInMessages.mjs +5 -0
- package/Types/Analytics/ActivationMilestone.d.mts +48 -0
- package/Types/Analytics/ActivationMilestone.d.ts +48 -0
- package/Types/Analytics/ActivationMilestone.js +247 -0
- package/Types/Analytics/ActivationMilestone.mjs +16 -0
- package/Types/Analytics/ChecklistProgress.d.mts +11 -0
- package/Types/Analytics/ChecklistProgress.d.ts +11 -0
- package/Types/Analytics/ChecklistProgress.js +32 -0
- package/Types/Analytics/ChecklistProgress.mjs +2 -0
- package/Types/Analytics/ProductEvent.d.mts +66 -0
- package/Types/Analytics/ProductEvent.d.ts +66 -0
- package/Types/Analytics/ProductEvent.js +471 -0
- package/Types/Analytics/ProductEvent.mjs +14 -0
- package/Types/AuditLog/AuditLogAction.d.mts +5 -1
- package/Types/AuditLog/AuditLogAction.d.ts +5 -1
- package/Types/AuditLog/AuditLogAction.js +11 -0
- package/Types/AuditLog/AuditLogActionLabel.d.mts +3 -0
- package/Types/AuditLog/AuditLogActionLabel.d.ts +3 -0
- package/Types/AuditLog/AuditLogActionLabel.js +30 -0
- package/Types/AuditLog/AuditLogActionLabel.mjs +3 -0
- package/Types/AuditLog/AuditLogCoverage.d.mts +3 -1
- package/Types/AuditLog/AuditLogCoverage.d.ts +3 -1
- package/Types/AuditLog/AuditLogCoverage.js +12 -3
- package/Types/AuditLog/AuditLogRetention.js +7 -4
- package/Types/AuditLog/AuditLogSessionEvent.d.mts +45 -0
- package/Types/AuditLog/AuditLogSessionEvent.d.ts +45 -0
- package/Types/AuditLog/AuditLogSessionEvent.js +210 -0
- package/Types/AuditLog/AuditLogSessionEvent.mjs +14 -0
- package/Types/AutoRemediation/RemediationRound.d.mts +4 -0
- package/Types/AutoRemediation/RemediationRound.d.ts +4 -0
- package/Types/AutoRemediation/RemediationRound.js +19 -2
- package/Types/AutoRemediation/RemediationRoundName.d.mts +1 -0
- package/Types/AutoRemediation/RemediationRoundName.d.ts +1 -0
- package/Types/AutoRemediation/RemediationRoundName.js +5 -0
- package/Types/AutoRemediation/RemediationRoundName.mjs +1 -0
- package/Types/Cloud/CloudAppTelemetrySignal.d.mts +9 -0
- package/Types/Cloud/CloudAppTelemetrySignal.d.ts +9 -0
- package/Types/Cloud/CloudAppTelemetrySignal.js +41 -0
- package/Types/Cloud/CloudAppTelemetrySignal.mjs +4 -0
- package/Types/Cloud/CloudPlatform.js +7 -1
- package/Types/Cloud/CloudResourceCatalog.d.mts +2 -0
- package/Types/Cloud/CloudResourceCatalog.d.ts +2 -0
- package/Types/Cloud/CloudResourceCatalog.js +33 -3
- package/Types/Cloud/CloudResourceCatalog.mjs +1 -0
- package/Types/CodeRepository/CodeFileSeen.d.mts +5 -0
- package/Types/CodeRepository/CodeFileSeen.d.ts +5 -0
- package/Types/CodeRepository/CodeFileSeen.js +142 -27
- package/Types/CustomDomain/CustomDomainDnsCheckResult.d.mts +13 -0
- package/Types/CustomDomain/CustomDomainDnsCheckResult.d.ts +13 -0
- package/Types/CustomDomain/CustomDomainDnsCheckResult.js +80 -0
- package/Types/CustomDomain/CustomDomainDnsCheckResult.mjs +2 -0
- package/Types/CustomDomain/CustomDomainServerReadiness.d.mts +55 -0
- package/Types/CustomDomain/CustomDomainServerReadiness.d.ts +55 -0
- package/Types/CustomDomain/CustomDomainServerReadiness.js +199 -0
- package/Types/CustomDomain/CustomDomainServerReadiness.mjs +8 -0
- package/Types/CustomDomain/DnsRecordCheck.d.mts +34 -0
- package/Types/CustomDomain/DnsRecordCheck.d.ts +34 -0
- package/Types/CustomDomain/DnsRecordCheck.js +175 -0
- package/Types/CustomDomain/DnsRecordCheck.mjs +6 -0
- package/Types/CustomDomain/DnsRecordCheckWords.d.mts +35 -0
- package/Types/CustomDomain/DnsRecordCheckWords.d.ts +35 -0
- package/Types/CustomDomain/DnsRecordCheckWords.js +151 -0
- package/Types/CustomDomain/DnsRecordCheckWords.mjs +5 -0
- package/Types/CustomNotificationChannel/CustomNotificationChannelPayload.d.mts +1 -0
- package/Types/CustomNotificationChannel/CustomNotificationChannelPayload.d.ts +1 -0
- package/Types/CustomNotificationChannel/CustomNotificationChannelPayload.js +11 -1
- package/Types/CustomNotificationChannel/CustomNotificationChannelPayload.mjs +1 -0
- package/Types/DataObservability/DataCheckSuggestions.d.mts +25 -0
- package/Types/DataObservability/DataCheckSuggestions.d.ts +25 -0
- package/Types/DataObservability/DataCheckSuggestions.js +102 -65
- package/Types/DataObservability/DataCheckSuggestions.mjs +1 -0
- package/Types/DataObservability/DataCheckType.d.mts +4 -0
- package/Types/DataObservability/DataCheckType.d.ts +4 -0
- package/Types/DataObservability/DataCheckType.js +17 -0
- package/Types/DataObservability/DataCheckType.mjs +1 -0
- package/Types/DataObservability/DataLineageColumnTrail.d.mts +10 -0
- package/Types/DataObservability/DataLineageColumnTrail.d.ts +10 -0
- package/Types/DataObservability/DataLineageColumnTrail.js +152 -0
- package/Types/DataObservability/DataLineageColumnTrail.mjs +4 -0
- package/Types/DataObservability/DataLineageExpansion.d.mts +29 -0
- package/Types/DataObservability/DataLineageExpansion.d.ts +29 -0
- package/Types/DataObservability/DataLineageExpansion.js +166 -0
- package/Types/DataObservability/DataLineageExpansion.mjs +4 -0
- package/Types/DataObservability/DataObservabilityApiTypes.d.mts +1 -0
- package/Types/DataObservability/DataObservabilityApiTypes.d.ts +1 -0
- package/Types/DataObservability/DataObservabilityApiTypes.js +2 -0
- package/Types/DataObservability/DataTableLineage.d.mts +7 -0
- package/Types/DataObservability/DataTableLineage.d.ts +7 -0
- package/Types/DataObservability/DataTableLineage.js +15 -3
- package/Types/DataObservability/DataTableLineage.mjs +1 -0
- package/Types/Database/TableMetadata.d.mts +2 -0
- package/Types/Database/TableMetadata.d.ts +2 -0
- package/Types/Database/TableMetadata.js +6 -0
- package/Types/Date.d.mts +42 -1
- package/Types/Date.d.ts +42 -1
- package/Types/Date.js +114 -5
- package/Types/DateLanguage.d.mts +9 -0
- package/Types/DateLanguage.d.ts +9 -0
- package/Types/DateLanguage.js +87 -2
- package/Types/DateLanguage.mjs +3 -0
- package/Types/DirectionArrow.d.mts +7 -0
- package/Types/DirectionArrow.d.ts +7 -0
- package/Types/DirectionArrow.js +88 -0
- package/Types/DirectionArrow.mjs +7 -0
- package/Types/Docs/DocsLanguage.d.mts +2 -0
- package/Types/Docs/DocsLanguage.d.ts +2 -0
- package/Types/Docs/DocsLanguage.js +23 -1
- package/Types/Docs/DocsLanguage.mjs +2 -0
- package/Types/Docs/GlossaryTerm.d.mts +83 -0
- package/Types/Docs/GlossaryTerm.d.ts +83 -0
- package/Types/Docs/GlossaryTerm.js +128 -0
- package/Types/Docs/GlossaryTerm.mjs +5 -0
- package/Types/Docs/RetiredNames.d.mts +11 -0
- package/Types/Docs/RetiredNames.d.ts +11 -0
- package/Types/Docs/RetiredNames.js +139 -0
- package/Types/Docs/RetiredNames.mjs +3 -0
- package/Types/Email/AmazonSesAuthenticationType.d.mts +23 -0
- package/Types/Email/AmazonSesAuthenticationType.d.ts +23 -0
- package/Types/Email/AmazonSesAuthenticationType.js +40 -0
- package/Types/Email/AmazonSesAuthenticationType.mjs +4 -0
- package/Types/Email/EmailServer.d.mts +2 -0
- package/Types/Email/EmailServer.d.ts +2 -0
- package/Types/Email/EmailTemplateType.d.mts +1 -0
- package/Types/Email/EmailTemplateType.d.ts +1 -0
- package/Types/Email/EmailTemplateType.js +2 -0
- package/Types/Exception/BadDataExceptionWithDetails.d.mts +6 -0
- package/Types/Exception/BadDataExceptionWithDetails.d.ts +6 -0
- package/Types/Exception/BadDataExceptionWithDetails.js +20 -0
- package/Types/Exception/BadDataExceptionWithDetails.mjs +2 -0
- package/Types/Exception/ErrorMessageRule.d.mts +4 -0
- package/Types/Exception/ErrorMessageRule.d.ts +4 -0
- package/Types/Exception/ErrorMessageRule.js +143 -0
- package/Types/Exception/ErrorMessageRule.mjs +5 -0
- package/Types/Exception/RefusalWithValues.d.mts +7 -0
- package/Types/Exception/RefusalWithValues.d.ts +7 -0
- package/Types/Exception/RefusalWithValues.js +76 -0
- package/Types/Exception/RefusalWithValues.mjs +3 -0
- package/Types/Exception/UnexplainedError.d.mts +58 -0
- package/Types/Exception/UnexplainedError.d.ts +58 -0
- package/Types/Exception/UnexplainedError.js +231 -0
- package/Types/Exception/UnexplainedError.mjs +12 -0
- package/Types/File/FileSize.d.mts +4 -1
- package/Types/File/FileSize.d.ts +4 -1
- package/Types/File/FileSize.js +18 -17
- package/Types/HostCollector/HostCollector.d.mts +1 -0
- package/Types/HostCollector/HostCollector.d.ts +1 -0
- package/Types/HostCollector/HostCollector.js +26 -10
- package/Types/HostCollector/HostCollector.mjs +1 -0
- package/Types/Icon/IconProp.d.mts +4 -1
- package/Types/Icon/IconProp.d.ts +4 -1
- package/Types/Icon/IconProp.js +6 -0
- package/Types/InstallationHealth/InstallationHealth.d.mts +122 -0
- package/Types/InstallationHealth/InstallationHealth.d.ts +122 -0
- package/Types/InstallationHealth/InstallationHealth.js +513 -0
- package/Types/InstallationHealth/InstallationHealth.mjs +13 -0
- package/Types/LLM/LLMProviderExchange.d.mts +17 -0
- package/Types/LLM/LLMProviderExchange.d.ts +17 -0
- package/Types/LLM/LLMProviderExchange.js +70 -0
- package/Types/LLM/LLMProviderExchange.mjs +5 -0
- package/Types/Monitor/CriteriaFilter.d.mts +1 -0
- package/Types/Monitor/CriteriaFilter.d.ts +1 -0
- package/Types/Monitor/CriteriaFilter.js +3 -1
- package/Types/Monitor/CriteriaFilterTerms.js +1 -0
- package/Types/Monitor/CriteriaFilterValues.d.mts +2 -0
- package/Types/Monitor/CriteriaFilterValues.d.ts +2 -0
- package/Types/Monitor/CriteriaFilterValues.js +22 -0
- package/Types/Monitor/EvaluationSentence.d.mts +1 -0
- package/Types/Monitor/EvaluationSentence.d.ts +1 -0
- package/Types/Monitor/EvaluationSentence.js +34 -3
- package/Types/Monitor/EvaluationSentence.mjs +1 -0
- package/Types/Monitor/MonitorCriteria.js +2 -2
- package/Types/Monitor/MonitorStep.js +1 -1
- package/Types/Monitor/MonitorTemplateSyncField.d.mts +6 -0
- package/Types/Monitor/MonitorTemplateSyncField.d.ts +6 -0
- package/Types/Monitor/MonitorTemplateSyncField.js +106 -64
- package/Types/Monitor/NtpMonitor/NtpMonitorUtil.d.mts +1 -0
- package/Types/Monitor/NtpMonitor/NtpMonitorUtil.d.ts +1 -0
- package/Types/Monitor/NtpMonitor/NtpMonitorUtil.js +11 -3
- package/Types/Monitor/RetiredEvaluationTemplates.d.mts +2 -0
- package/Types/Monitor/RetiredEvaluationTemplates.d.ts +2 -0
- package/Types/Monitor/RetiredEvaluationTemplates.js +95 -0
- package/Types/Monitor/RetiredEvaluationTemplates.mjs +3 -0
- package/Types/Monitor/SSLMonitor/CertificateRevocationCheckMethod.d.mts +6 -0
- package/Types/Monitor/SSLMonitor/CertificateRevocationCheckMethod.d.ts +6 -0
- package/Types/Monitor/SSLMonitor/CertificateRevocationCheckMethod.js +20 -0
- package/Types/Monitor/SSLMonitor/CertificateRevocationCheckMethod.mjs +2 -0
- package/Types/Monitor/SSLMonitor/CertificateRevocationStatus.d.mts +6 -0
- package/Types/Monitor/SSLMonitor/CertificateRevocationStatus.d.ts +6 -0
- package/Types/Monitor/SSLMonitor/CertificateRevocationStatus.js +29 -0
- package/Types/Monitor/SSLMonitor/CertificateRevocationStatus.mjs +2 -0
- package/Types/Monitor/SSLMonitor/SslMonitorResponse.d.mts +7 -0
- package/Types/Monitor/SSLMonitor/SslMonitorResponse.d.ts +7 -0
- package/Types/Monitor/WhoIsTold.d.mts +167 -0
- package/Types/Monitor/WhoIsTold.d.ts +167 -0
- package/Types/Monitor/WhoIsTold.js +583 -0
- package/Types/Monitor/WhoIsTold.mjs +17 -0
- package/Types/NotificationRule/PagingLadder.d.mts +137 -0
- package/Types/NotificationRule/PagingLadder.d.ts +137 -0
- package/Types/NotificationRule/PagingLadder.js +682 -0
- package/Types/NotificationRule/PagingLadder.mjs +28 -0
- package/Types/NotificationSetting/NotificationEmailRollupCategory.js +1 -1
- package/Types/OnCallDutyPolicy/OnCallDutyPolicyRunWait.d.mts +6 -0
- package/Types/OnCallDutyPolicy/OnCallDutyPolicyRunWait.d.ts +6 -0
- package/Types/OnCallDutyPolicy/OnCallDutyPolicyRunWait.js +34 -0
- package/Types/OnCallDutyPolicy/OnCallDutyPolicyRunWait.mjs +2 -0
- package/Types/OnCallDutyPolicy/OnCallPageLine.d.mts +26 -0
- package/Types/OnCallDutyPolicy/OnCallPageLine.d.ts +26 -0
- package/Types/OnCallDutyPolicy/OnCallPageLine.js +136 -0
- package/Types/OnCallDutyPolicy/OnCallPageLine.mjs +18 -0
- package/Types/OnCallDutyPolicy/OnCallTestPage.d.mts +284 -0
- package/Types/OnCallDutyPolicy/OnCallTestPage.d.ts +284 -0
- package/Types/OnCallDutyPolicy/OnCallTestPage.js +665 -0
- package/Types/OnCallDutyPolicy/OnCallTestPage.mjs +53 -0
- package/Types/OnCallDutyPolicy/OnCallTestPageLine.d.mts +19 -0
- package/Types/OnCallDutyPolicy/OnCallTestPageLine.d.ts +19 -0
- package/Types/OnCallDutyPolicy/OnCallTestPageLine.js +222 -0
- package/Types/OnCallDutyPolicy/OnCallTestPageLine.mjs +6 -0
- package/Types/OnCallDutyPolicy/OnCallTestPageWords.d.mts +31 -0
- package/Types/OnCallDutyPolicy/OnCallTestPageWords.d.ts +31 -0
- package/Types/OnCallDutyPolicy/OnCallTestPageWords.js +105 -0
- package/Types/OnCallDutyPolicy/OnCallTestPageWords.mjs +14 -0
- package/Types/OnCallDutyPolicy/ScheduleLayerDefaults.js +5 -2
- package/Types/OnCallDutyPolicy/UserOverrideCoverRequest.js +9 -1
- package/Types/Permission.d.mts +2 -2
- package/Types/Permission.d.ts +2 -2
- package/Types/Permission.js +194 -193
- package/Types/PhoneNumberDirection.d.mts +6 -0
- package/Types/PhoneNumberDirection.d.ts +6 -0
- package/Types/PhoneNumberDirection.js +123 -0
- package/Types/PhoneNumberDirection.mjs +6 -0
- package/Types/Product/ProductCatalog.d.mts +10 -0
- package/Types/Product/ProductCatalog.d.ts +10 -0
- package/Types/Product/ProductCatalog.js +208 -0
- package/Types/Product/ProductCatalog.mjs +6 -0
- package/Types/Product/ProductKey.d.mts +58 -0
- package/Types/Product/ProductKey.d.ts +58 -0
- package/Types/Product/ProductKey.js +175 -0
- package/Types/Product/ProductKey.mjs +8 -0
- package/Types/Product/ProductOfTable.d.mts +3 -0
- package/Types/Product/ProductOfTable.d.ts +3 -0
- package/Types/Product/ProductOfTable.js +68 -0
- package/Types/Product/ProductOfTable.mjs +3 -0
- package/Types/Product/ProductPins.d.mts +10 -0
- package/Types/Product/ProductPins.d.ts +10 -0
- package/Types/Product/ProductPins.js +65 -0
- package/Types/Product/ProductPins.mjs +6 -0
- package/Types/Product/ProductUsage.d.mts +21 -0
- package/Types/Product/ProductUsage.d.ts +21 -0
- package/Types/Product/ProductUsage.js +175 -0
- package/Types/Product/ProductUsage.mjs +10 -0
- package/Types/Product/ProjectProducts.d.mts +60 -0
- package/Types/Product/ProjectProducts.d.ts +60 -0
- package/Types/Product/ProjectProducts.js +336 -0
- package/Types/Product/ProjectProducts.mjs +19 -0
- package/Types/Product/ProjectProductsAnswer.d.mts +23 -0
- package/Types/Product/ProjectProductsAnswer.d.ts +23 -0
- package/Types/Product/ProjectProductsAnswer.js +172 -0
- package/Types/Product/ProjectProductsAnswer.mjs +8 -0
- package/Types/Product/ServerProducts.d.mts +65 -0
- package/Types/Product/ServerProducts.d.ts +65 -0
- package/Types/Product/ServerProducts.js +383 -0
- package/Types/Product/ServerProducts.mjs +26 -0
- package/Types/Product/ServerProductsAnswer.d.mts +21 -0
- package/Types/Product/ServerProductsAnswer.d.ts +21 -0
- package/Types/Product/ServerProductsAnswer.js +78 -0
- package/Types/Product/ServerProductsAnswer.mjs +5 -0
- package/Types/ProductFeedback/NewGitHubIssue.d.mts +12 -0
- package/Types/ProductFeedback/NewGitHubIssue.d.ts +12 -0
- package/Types/ProductFeedback/NewGitHubIssue.js +64 -0
- package/Types/ProductFeedback/NewGitHubIssue.mjs +5 -0
- package/Types/ProductFeedback/ProductFeedback.d.mts +142 -0
- package/Types/ProductFeedback/ProductFeedback.d.ts +142 -0
- package/Types/ProductFeedback/ProductFeedback.js +525 -0
- package/Types/ProductFeedback/ProductFeedback.mjs +49 -0
- package/Types/ReadingDirection.d.mts +2 -0
- package/Types/ReadingDirection.d.ts +2 -0
- package/Types/ReadingDirection.js +83 -2
- package/Types/ReadingDirection.mjs +2 -0
- package/Types/Recommendation/RecommendationType.d.mts +2 -1
- package/Types/Recommendation/RecommendationType.d.ts +2 -1
- package/Types/Recommendation/RecommendationType.js +6 -0
- package/Types/Reminder/ReminderInterval.d.mts +7 -0
- package/Types/Reminder/ReminderInterval.d.ts +7 -0
- package/Types/Reminder/ReminderInterval.js +110 -0
- package/Types/Reminder/ReminderInterval.mjs +8 -0
- package/Types/Retention/ResolvedRecordRetention.d.mts +19 -0
- package/Types/Retention/ResolvedRecordRetention.d.ts +19 -0
- package/Types/Retention/ResolvedRecordRetention.js +124 -0
- package/Types/Retention/ResolvedRecordRetention.mjs +14 -0
- package/Types/RollingTime/RollingTimeUtil.d.mts +1 -0
- package/Types/RollingTime/RollingTimeUtil.d.ts +1 -0
- package/Types/RollingTime/RollingTimeUtil.js +9 -0
- package/Types/Rum/SessionReplayCustomEvents.d.mts +1 -0
- package/Types/Rum/SessionReplayCustomEvents.d.ts +1 -0
- package/Types/SampleProject/SampleProject.d.mts +54 -0
- package/Types/SampleProject/SampleProject.d.ts +54 -0
- package/Types/SampleProject/SampleProject.js +177 -0
- package/Types/SampleProject/SampleProject.mjs +22 -0
- package/Types/SampleProject/SampleProjectContent.d.mts +127 -0
- package/Types/SampleProject/SampleProjectContent.d.ts +127 -0
- package/Types/SampleProject/SampleProjectContent.js +397 -0
- package/Types/SampleProject/SampleProjectContent.mjs +18 -0
- package/Types/SecurityEvent/Connectors/SecurityEventConnectorCatalog.js +108 -101
- package/Types/ServerSending/ServerSendingStatus.d.mts +69 -0
- package/Types/ServerSending/ServerSendingStatus.d.ts +69 -0
- package/Types/ServerSending/ServerSendingStatus.js +281 -0
- package/Types/ServerSending/ServerSendingStatus.mjs +7 -0
- package/Types/ServerSending/ServerSendingWords.d.mts +9 -0
- package/Types/ServerSending/ServerSendingWords.d.ts +9 -0
- package/Types/ServerSending/ServerSendingWords.js +95 -0
- package/Types/ServerSending/ServerSendingWords.mjs +7 -0
- package/Types/ServerSetup/ServerSetupChecklist.d.mts +172 -0
- package/Types/ServerSetup/ServerSetupChecklist.d.ts +172 -0
- package/Types/ServerSetup/ServerSetupChecklist.js +735 -0
- package/Types/ServerSetup/ServerSetupChecklist.mjs +12 -0
- package/Types/ServerSetup/ServerTestSend.d.mts +35 -0
- package/Types/ServerSetup/ServerTestSend.d.ts +35 -0
- package/Types/ServerSetup/ServerTestSend.js +160 -0
- package/Types/ServerSetup/ServerTestSend.mjs +10 -0
- package/Types/SetupHealth/SetupHealth.d.mts +283 -0
- package/Types/SetupHealth/SetupHealth.d.ts +283 -0
- package/Types/SetupHealth/SetupHealth.js +1047 -0
- package/Types/SetupHealth/SetupHealth.mjs +46 -0
- package/Types/StatusPage/StatusPageSummary.d.mts +1 -0
- package/Types/StatusPage/StatusPageSummary.d.ts +1 -0
- package/Types/StatusPage/StatusPageSummary.js +3 -0
- package/Types/StatusPage/UptimeDailyAggregate.d.mts +25 -0
- package/Types/StatusPage/UptimeDailyAggregate.d.ts +25 -0
- package/Types/Telemetry/LlmCallKind.js +1 -1
- package/Types/Telemetry/TelemetryIngestSurface.js +6 -5
- package/Types/Telemetry/TelemetryIngestionBudget.d.mts +1 -0
- package/Types/Telemetry/TelemetryIngestionBudget.d.ts +1 -0
- package/Types/Telemetry/TelemetryIngestionBudget.js +135 -2
- package/Types/Telemetry/TelemetryIngestionBudget.mjs +1 -0
- package/Types/ToolImport/ToolImportCatalog.d.mts +1 -0
- package/Types/ToolImport/ToolImportCatalog.d.ts +1 -0
- package/Types/ToolImport/ToolImportCatalog.js +54 -1
- package/Types/ToolImport/ToolImportCatalog.mjs +1 -0
- package/Types/Translator.d.mts +1 -0
- package/Types/Translator.d.ts +1 -0
- package/Types/Translator.js +104 -33
- package/Types/Translator.mjs +1 -0
- package/Types/UsedBy/UsedBy.d.mts +103 -0
- package/Types/UsedBy/UsedBy.d.ts +103 -0
- package/Types/UsedBy/UsedBy.js +389 -0
- package/Types/UsedBy/UsedBy.mjs +20 -0
- package/Types/UsedBy/UsedByServerProducts.d.mts +4 -0
- package/Types/UsedBy/UsedByServerProducts.d.ts +4 -0
- package/Types/UsedBy/UsedByServerProducts.js +48 -0
- package/Types/UsedBy/UsedByServerProducts.mjs +3 -0
- package/Types/UserNotification/UserNotificationEventType.d.mts +2 -1
- package/Types/UserNotification/UserNotificationEventType.d.ts +2 -1
- package/Types/UserNotification/UserNotificationEventType.js +7 -0
- package/Types/UserSession/SessionEndCause.d.mts +17 -0
- package/Types/UserSession/SessionEndCause.d.ts +17 -0
- package/Types/UserSession/SessionEndCause.js +79 -0
- package/Types/UserSession/SessionEndCause.mjs +6 -0
- package/Types/UserSession/SessionSignIn.d.mts +44 -0
- package/Types/UserSession/SessionSignIn.d.ts +44 -0
- package/Types/UserSession/SessionSignIn.js +174 -0
- package/Types/UserSession/SessionSignIn.mjs +17 -0
- package/Types/WelcomeChecklist/ProjectGoal.d.mts +16 -0
- package/Types/WelcomeChecklist/ProjectGoal.d.ts +16 -0
- package/Types/WelcomeChecklist/ProjectGoal.js +94 -0
- package/Types/WelcomeChecklist/ProjectGoal.mjs +8 -0
- package/Types/WelcomeChecklist/WelcomeChecklist.d.mts +82 -0
- package/Types/WelcomeChecklist/WelcomeChecklist.d.ts +82 -0
- package/Types/WelcomeChecklist/WelcomeChecklist.js +396 -0
- package/Types/WelcomeChecklist/WelcomeChecklist.mjs +23 -0
- package/Types/WelcomeChecklist/WelcomeChecklistAnswer.d.mts +25 -0
- package/Types/WelcomeChecklist/WelcomeChecklistAnswer.d.ts +25 -0
- package/Types/WelcomeChecklist/WelcomeChecklistAnswer.js +139 -0
- package/Types/WelcomeChecklist/WelcomeChecklistAnswer.mjs +9 -0
- package/Types/WelcomeChecklist/WelcomeChecklistState.d.mts +27 -0
- package/Types/WelcomeChecklist/WelcomeChecklistState.d.ts +27 -0
- package/Types/WelcomeChecklist/WelcomeChecklistState.js +183 -0
- package/Types/WelcomeChecklist/WelcomeChecklistState.mjs +13 -0
- package/Types/Workflow/Documentation/AIDocumentation.js +1 -1
- package/Types/Workflow/PassedOnFields.js +2 -1
- package/Types/Workflow/Templates.js +1 -1
- package/Types/Workspace/NotificationRules/NotificationRuleCondition.d.mts +2 -0
- package/Types/Workspace/NotificationRules/NotificationRuleCondition.d.ts +2 -0
- package/Types/Workspace/NotificationSummary/WorkspaceSummaryTestChannel.d.mts +7 -0
- package/Types/Workspace/NotificationSummary/WorkspaceSummaryTestChannel.d.ts +7 -0
- package/Types/Workspace/NotificationSummary/WorkspaceSummaryTestChannel.js +40 -0
- package/Types/Workspace/NotificationSummary/WorkspaceSummaryTestChannel.mjs +3 -0
- package/Types/Workspace/WorkspaceChannelMembers.d.mts +1 -0
- package/Types/Workspace/WorkspaceChannelMembers.d.ts +1 -0
- package/Types/Workspace/WorkspaceChannelMembers.js +9 -2
- package/UI/Components/Dropdown/Dropdown.d.mts +1 -0
- package/UI/Components/Dropdown/Dropdown.d.ts +1 -0
- package/Utils/AI/MeaningMatch.d.mts +36 -0
- package/Utils/AI/MeaningMatch.d.ts +36 -0
- package/Utils/AI/MeaningMatch.js +535 -0
- package/Utils/AI/MeaningMatch.mjs +7 -0
- package/Utils/API.js +10 -0
- package/Utils/ArchivableValues.js +1 -1
- package/Utils/AuditLog/AuditLogValues.js +2 -2
- package/Utils/Dashboard/ClockWidgetFormat.d.mts +14 -2
- package/Utils/Dashboard/ClockWidgetFormat.d.ts +14 -2
- package/Utils/Dashboard/ClockWidgetFormat.js +105 -2
- package/Utils/Dashboard/DashboardViewConfigSignature.d.mts +3 -0
- package/Utils/Dashboard/DashboardViewConfigSignature.d.ts +3 -0
- package/Utils/Dashboard/DashboardViewConfigSignature.js +45 -0
- package/Utils/Dashboard/DashboardViewConfigSignature.mjs +3 -0
- package/Utils/Dashboard/DashboardWidgetSorts.js +25 -4
- package/Utils/Dashboard/MonitorListWidgetFormat.d.mts +37 -0
- package/Utils/Dashboard/MonitorListWidgetFormat.d.ts +37 -0
- package/Utils/Dashboard/MonitorListWidgetFormat.js +86 -0
- package/Utils/Dashboard/MonitorListWidgetFormat.mjs +10 -0
- package/Utils/DataSecurity/TextScanner.js +2 -2
- package/Utils/DeveloperDocs/AiAssistantExamples.js +4 -4
- package/Utils/DeveloperDocs/CliCommands.d.mts +1 -0
- package/Utils/DeveloperDocs/CliCommands.d.ts +1 -0
- package/Utils/DeveloperDocs/CliCommands.js +2 -1
- package/Utils/DeveloperDocs/CliResources.js +2 -1
- package/Utils/DeveloperDocs/TerraformSchema.js +3 -1
- package/Utils/GuidedSetup/OnCallPolicyRecords.d.mts +31 -0
- package/Utils/GuidedSetup/OnCallPolicyRecords.d.ts +31 -0
- package/Utils/GuidedSetup/OnCallPolicyRecords.js +89 -0
- package/Utils/GuidedSetup/OnCallPolicyRecords.mjs +6 -0
- package/Utils/GuidedSetup/StatusPageRecords.d.mts +36 -0
- package/Utils/GuidedSetup/StatusPageRecords.d.ts +36 -0
- package/Utils/GuidedSetup/StatusPageRecords.js +105 -0
- package/Utils/GuidedSetup/StatusPageRecords.mjs +6 -0
- package/Utils/GuidedSetup/WebsiteMonitorRecords.d.mts +41 -0
- package/Utils/GuidedSetup/WebsiteMonitorRecords.d.ts +41 -0
- package/Utils/GuidedSetup/WebsiteMonitorRecords.js +204 -0
- package/Utils/GuidedSetup/WebsiteMonitorRecords.mjs +9 -0
- package/Utils/Markdown/InlineImageDataUri.d.mts +9 -0
- package/Utils/Markdown/InlineImageDataUri.d.ts +9 -0
- package/Utils/Markdown/InlineImageDataUri.js +17 -1
- package/Utils/Markdown/InlineImageDataUri.mjs +1 -0
- package/Utils/Markdown/LinkReferenceDefinitions.d.mts +20 -0
- package/Utils/Markdown/LinkReferenceDefinitions.d.ts +20 -0
- package/Utils/Markdown/LinkReferenceDefinitions.js +1901 -0
- package/Utils/Markdown/LinkReferenceDefinitions.mjs +5 -0
- package/Utils/Markdown/MarkdownTableCell.js +2 -1
- package/Utils/Markdown/OverLongText.js +523 -5
- package/Utils/Markdown/SlowMarkdown.d.mts +14 -0
- package/Utils/Markdown/SlowMarkdown.d.ts +14 -0
- package/Utils/Markdown/SlowMarkdown.js +595 -11
- package/Utils/Markdown/SlowMarkdown.mjs +6 -0
- package/Utils/ModelApiName.d.mts +11 -0
- package/Utils/ModelApiName.d.ts +11 -0
- package/Utils/ModelApiName.js +72 -0
- package/Utils/ModelApiName.mjs +5 -0
- package/Utils/Monitor/DeviceMacLearningUtil.d.mts +2 -1
- package/Utils/Monitor/DeviceMacLearningUtil.d.ts +2 -1
- package/Utils/Monitor/DeviceMacLearningUtil.js +26 -0
- package/Utils/Monitor/EndpointAttachmentUtil.js +8 -3
- package/Utils/Monitor/ExternalStatusPageReading.d.mts +12 -0
- package/Utils/Monitor/ExternalStatusPageReading.d.ts +12 -0
- package/Utils/Monitor/ExternalStatusPageReading.js +111 -8
- package/Utils/Monitor/ExternalStatusPageReading.mjs +5 -0
- package/Utils/Monitor/ExternalStatusPageScope.js +17 -1
- package/Utils/Monitor/MonitorDestinationUtil.js +2 -1
- package/Utils/Monitor/MonitorOverviewPresentationUtil.d.mts +2 -1
- package/Utils/Monitor/MonitorOverviewPresentationUtil.d.ts +2 -1
- package/Utils/Monitor/MonitorOverviewPresentationUtil.js +10 -1
- package/Utils/Monitor/MonitorStatusHistoryUtil.d.mts +1 -0
- package/Utils/Monitor/MonitorStatusHistoryUtil.d.ts +1 -0
- package/Utils/Monitor/MonitorStatusHistoryUtil.js +1 -0
- package/Utils/Monitor/MonitorSummaryProbeUtil.d.mts +2 -0
- package/Utils/Monitor/MonitorSummaryProbeUtil.d.ts +2 -0
- package/Utils/Monitor/MonitorSummaryProbeUtil.js +13 -17
- package/Utils/Monitor/MonitorSummarySnapshotUtil.js +5 -3
- package/Utils/Monitor/MonitorTemplateLinkRefusal.d.mts +9 -0
- package/Utils/Monitor/MonitorTemplateLinkRefusal.d.ts +9 -0
- package/Utils/Monitor/MonitorTemplateLinkRefusal.js +45 -0
- package/Utils/Monitor/MonitorTemplateLinkRefusal.mjs +6 -0
- package/Utils/Monitor/MonitorUptimeSummaryUtil.d.mts +1 -1
- package/Utils/Monitor/MonitorUptimeSummaryUtil.d.ts +1 -1
- package/Utils/Monitor/MonitorUptimeSummaryUtil.js +1 -0
- package/Utils/Monitor/MonitoringOff.d.mts +20 -0
- package/Utils/Monitor/MonitoringOff.d.ts +20 -0
- package/Utils/Monitor/MonitoringOff.js +81 -0
- package/Utils/Monitor/MonitoringOff.mjs +4 -0
- package/Utils/Monitor/NotOperationalMonitorQuery.js +9 -7
- package/Utils/Monitor/StateChangeLogScreenshots.d.mts +8 -0
- package/Utils/Monitor/StateChangeLogScreenshots.d.ts +8 -0
- package/Utils/Monitor/StateChangeLogScreenshots.js +116 -0
- package/Utils/Monitor/StateChangeLogScreenshots.mjs +3 -0
- package/Utils/NetworkDevice/Naming/NamingLookup.d.mts +1 -1
- package/Utils/NetworkDevice/Naming/NamingLookup.d.ts +1 -1
- package/Utils/NetworkDevice/Naming/NamingLookup.js +14 -4
- package/Utils/NetworkDevice/Naming/NamingLookup.mjs +1 -0
- package/Utils/OpenStack/OpenStackCheckName.js +2 -1
- package/Utils/OpenStack/OpenStackLogScrub.js +1 -1
- package/Utils/OpenStack/OpenStackLogs.js +3 -2
- package/Utils/OpenStack/OpenStackTraces.js +2 -1
- package/Utils/Project/NotificationChannels.js +5 -5
- package/Utils/Project/ProjectBalance.js +2 -2
- package/Utils/Project/TwilioAccount.js +2 -2
- package/Utils/ScheduledMaintenanceStart.d.mts +3 -0
- package/Utils/ScheduledMaintenanceStart.d.ts +3 -0
- package/Utils/ScheduledMaintenanceStart.js +9 -0
- package/Utils/Schema/ModelSchema.js +10 -1
- package/Utils/Slo/SloErrorBudgetPolicy.d.mts +2 -1
- package/Utils/Slo/SloErrorBudgetPolicy.d.ts +2 -1
- package/Utils/Slo/SloErrorBudgetPolicy.js +8 -2
- package/Utils/Slo/SloListWidgetFormat.d.mts +7 -1
- package/Utils/Slo/SloListWidgetFormat.d.ts +7 -1
- package/Utils/Slo/SloListWidgetFormat.js +20 -26
- package/Utils/Slo/SloOverviewText.d.mts +6 -1
- package/Utils/Slo/SloOverviewText.d.ts +6 -1
- package/Utils/Slo/SloOverviewText.js +3 -3
- package/Utils/Slo/SloUtil.d.mts +18 -9
- package/Utils/Slo/SloUtil.d.ts +18 -9
- package/Utils/Slo/SloUtil.js +47 -10
- package/Utils/Slo/SloWidgetFormat.d.mts +69 -11
- package/Utils/Slo/SloWidgetFormat.d.ts +69 -11
- package/Utils/Slo/SloWidgetFormat.js +198 -50
- package/Utils/Slo/SloWidgetFormat.mjs +7 -0
- package/Utils/StatusPage/FrozenMonitorResources.d.mts +41 -0
- package/Utils/StatusPage/FrozenMonitorResources.d.ts +41 -0
- package/Utils/StatusPage/FrozenMonitorResources.js +155 -0
- package/Utils/StatusPage/FrozenMonitorResources.mjs +4 -0
- package/Utils/StatusPage/GroupNestingLayout.d.mts +2 -0
- package/Utils/StatusPage/GroupNestingLayout.d.ts +2 -0
- package/Utils/StatusPage/GroupNestingLayout.js +12 -0
- package/Utils/StatusPage/MonitorGroupUptimeDailyAggregateUtil.d.mts +48 -0
- package/Utils/StatusPage/MonitorGroupUptimeDailyAggregateUtil.d.ts +48 -0
- package/Utils/StatusPage/MonitorGroupUptimeDailyAggregateUtil.js +181 -0
- package/Utils/StatusPage/MonitorGroupUptimeDailyAggregateUtil.mjs +2 -0
- package/Utils/StatusPage/ResourceExplorer.d.mts +1 -0
- package/Utils/StatusPage/ResourceExplorer.d.ts +1 -0
- package/Utils/StatusPage/ResourceExplorer.js +11 -1
- package/Utils/StatusPage/ResourceUptime.d.mts +6 -1
- package/Utils/StatusPage/ResourceUptime.d.ts +6 -1
- package/Utils/StatusPage/ResourceUptime.js +31 -6
- package/Utils/StatusPage/StatusPageSummaryBuilder.d.mts +1 -0
- package/Utils/StatusPage/StatusPageSummaryBuilder.d.ts +1 -0
- package/Utils/StatusPage/StatusPageSummaryBuilder.js +12 -1
- package/Utils/StatusPage/StatusPageUptimeTimezone.d.mts +41 -0
- package/Utils/StatusPage/StatusPageUptimeTimezone.d.ts +41 -0
- package/Utils/StatusPage/StatusPageUptimeTimezone.js +114 -0
- package/Utils/StatusPage/StatusPageUptimeTimezone.mjs +2 -0
- package/Utils/StatusPage/UptimeDailyAggregateUtil.d.mts +3 -1
- package/Utils/StatusPage/UptimeDailyAggregateUtil.d.ts +3 -1
- package/Utils/StatusPage/UptimeDailyAggregateUtil.js +69 -50
- package/Utils/Telemetry/CloudInstanceIdentity.js +12 -7
- package/Utils/Uptime/DayUptimeGraphUtil.d.mts +8 -0
- package/Utils/Uptime/DayUptimeGraphUtil.d.ts +8 -0
- package/Utils/Uptime/DayUptimeGraphUtil.js +41 -6
- package/Utils/Uptime/UptimeMaintenanceUtil.d.mts +3 -0
- package/Utils/Uptime/UptimeMaintenanceUtil.d.ts +3 -0
- package/Utils/Uptime/UptimeMaintenanceUtil.js +51 -1
- package/Utils/Uptime/UptimeUtil.d.mts +38 -1
- package/Utils/Uptime/UptimeUtil.d.ts +38 -1
- package/Utils/Uptime/UptimeUtil.js +270 -75
- package/Utils/Uptime/WorstStatusTimeline.d.mts +31 -0
- package/Utils/Uptime/WorstStatusTimeline.d.ts +31 -0
- package/Utils/Uptime/WorstStatusTimeline.js +190 -0
- package/Utils/Uptime/WorstStatusTimeline.mjs +2 -0
- package/Utils/ValueFormatter.d.mts +8 -6
- package/Utils/ValueFormatter.d.ts +8 -6
- package/Utils/ValueFormatter.js +145 -0
- package/Utils/Workspace/WorkspaceSummarySetup.d.mts +25 -0
- package/Utils/Workspace/WorkspaceSummarySetup.d.ts +25 -0
- package/Utils/Workspace/WorkspaceSummarySetup.js +215 -0
- package/Utils/Workspace/WorkspaceSummarySetup.mjs +11 -0
- package/package.json +1 -1
- package/Utils/StatusPage/ArchivedMonitorResources.d.mts +0 -10
- package/Utils/StatusPage/ArchivedMonitorResources.d.ts +0 -10
- package/Utils/StatusPage/ArchivedMonitorResources.js +0 -33
- package/Utils/StatusPage/ArchivedMonitorResources.mjs +0 -2
|
@@ -0,0 +1,1901 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.forEachBracketedLabel = exports.getLinkReferenceDefinitions = exports.normalizeLinkLabel = exports.MAX_DEFINITION_NESTING_DEPTH = void 0;
|
|
4
|
+
const RegExpCharacterClasses_1 = require("../RegExpCharacterClasses");
|
|
5
|
+
/*
|
|
6
|
+
* How many block quotes and list items deep a definition is still found:
|
|
7
|
+
* the depth past which an email holds Markdown back from marked
|
|
8
|
+
* (SLOW_MARKDOWN_MAX_NESTING_DEPTH, Utils/Markdown/SlowMarkdown), where a
|
|
9
|
+
* definition is text.
|
|
10
|
+
*/
|
|
11
|
+
exports.MAX_DEFINITION_NESTING_DEPTH = 16;
|
|
12
|
+
const SPACE = 0x20;
|
|
13
|
+
const TAB = 0x09;
|
|
14
|
+
const LINE_FEED = 0x0a;
|
|
15
|
+
const EXCLAMATION_MARK = 0x21;
|
|
16
|
+
const DOUBLE_QUOTE = 0x22;
|
|
17
|
+
const HASH = 0x23;
|
|
18
|
+
const SINGLE_QUOTE = 0x27;
|
|
19
|
+
const OPEN_PARENTHESIS = 0x28;
|
|
20
|
+
const CLOSE_PARENTHESIS = 0x29;
|
|
21
|
+
const ASTERISK = 0x2a;
|
|
22
|
+
const PLUS = 0x2b;
|
|
23
|
+
const DASH = 0x2d;
|
|
24
|
+
const DOT = 0x2e;
|
|
25
|
+
const SLASH = 0x2f;
|
|
26
|
+
const DIGIT_ONE = 0x31;
|
|
27
|
+
const COLON = 0x3a;
|
|
28
|
+
const LESS_THAN = 0x3c;
|
|
29
|
+
const EQUALS = 0x3d;
|
|
30
|
+
const GREATER_THAN = 0x3e;
|
|
31
|
+
const QUESTION_MARK = 0x3f;
|
|
32
|
+
const OPEN_BRACKET = 0x5b;
|
|
33
|
+
const BACKSLASH = 0x5c;
|
|
34
|
+
const CLOSE_BRACKET = 0x5d;
|
|
35
|
+
const UNDERSCORE = 0x5f;
|
|
36
|
+
const BACKTICK = 0x60;
|
|
37
|
+
const PIPE = 0x7c;
|
|
38
|
+
const TILDE = 0x7e;
|
|
39
|
+
const LOWER_X = 0x78;
|
|
40
|
+
const UPPER_X = 0x58;
|
|
41
|
+
const LINE_SEPARATOR = String.fromCharCode(0x2028);
|
|
42
|
+
const PARAGRAPH_SEPARATOR = String.fromCharCode(0x2029);
|
|
43
|
+
/*
|
|
44
|
+
* The tags an HTML block of marked's sixth kind opens with (its "html"
|
|
45
|
+
* rule, which reads them whatever their case). Written in lower case, they
|
|
46
|
+
* also end a paragraph.
|
|
47
|
+
*/
|
|
48
|
+
const BLOCK_TAG_NAMES = new Set([
|
|
49
|
+
"address",
|
|
50
|
+
"article",
|
|
51
|
+
"aside",
|
|
52
|
+
"base",
|
|
53
|
+
"basefont",
|
|
54
|
+
"blockquote",
|
|
55
|
+
"body",
|
|
56
|
+
"caption",
|
|
57
|
+
"center",
|
|
58
|
+
"col",
|
|
59
|
+
"colgroup",
|
|
60
|
+
"dd",
|
|
61
|
+
"details",
|
|
62
|
+
"dialog",
|
|
63
|
+
"dir",
|
|
64
|
+
"div",
|
|
65
|
+
"dl",
|
|
66
|
+
"dt",
|
|
67
|
+
"fieldset",
|
|
68
|
+
"figcaption",
|
|
69
|
+
"figure",
|
|
70
|
+
"footer",
|
|
71
|
+
"form",
|
|
72
|
+
"frame",
|
|
73
|
+
"frameset",
|
|
74
|
+
"h1",
|
|
75
|
+
"h2",
|
|
76
|
+
"h3",
|
|
77
|
+
"h4",
|
|
78
|
+
"h5",
|
|
79
|
+
"h6",
|
|
80
|
+
"head",
|
|
81
|
+
"header",
|
|
82
|
+
"hr",
|
|
83
|
+
"html",
|
|
84
|
+
"iframe",
|
|
85
|
+
"legend",
|
|
86
|
+
"li",
|
|
87
|
+
"link",
|
|
88
|
+
"main",
|
|
89
|
+
"menu",
|
|
90
|
+
"menuitem",
|
|
91
|
+
"meta",
|
|
92
|
+
"nav",
|
|
93
|
+
"noframes",
|
|
94
|
+
"ol",
|
|
95
|
+
"optgroup",
|
|
96
|
+
"option",
|
|
97
|
+
"p",
|
|
98
|
+
"param",
|
|
99
|
+
"search",
|
|
100
|
+
"section",
|
|
101
|
+
"summary",
|
|
102
|
+
"table",
|
|
103
|
+
"tbody",
|
|
104
|
+
"td",
|
|
105
|
+
"tfoot",
|
|
106
|
+
"th",
|
|
107
|
+
"thead",
|
|
108
|
+
"title",
|
|
109
|
+
"tr",
|
|
110
|
+
"track",
|
|
111
|
+
"ul",
|
|
112
|
+
]);
|
|
113
|
+
const LONGEST_BLOCK_TAG_NAME = 10;
|
|
114
|
+
/*
|
|
115
|
+
* The tags an HTML block of the first kind opens with, which runs to the
|
|
116
|
+
* line of its closing tag. Written in lower case, they end a paragraph too.
|
|
117
|
+
*/
|
|
118
|
+
const RAW_TEXT_TAG_NAMES = [
|
|
119
|
+
"script",
|
|
120
|
+
"pre",
|
|
121
|
+
"style",
|
|
122
|
+
"textarea",
|
|
123
|
+
];
|
|
124
|
+
/*
|
|
125
|
+
* A label as marked matches it: in lower case, each run of white space one
|
|
126
|
+
* space. Not trimmed - "[ home ]" is not "[home]" to marked - and escapes
|
|
127
|
+
* stay as written. Read with a loop: a label can be as long as its text.
|
|
128
|
+
*/
|
|
129
|
+
const normalizeLinkLabel = (label) => {
|
|
130
|
+
const lowered = label.toLowerCase();
|
|
131
|
+
let normalized = "";
|
|
132
|
+
let copiedUpTo = 0;
|
|
133
|
+
let index = 0;
|
|
134
|
+
while (index < lowered.length) {
|
|
135
|
+
if (!(0, RegExpCharacterClasses_1.isWhiteSpaceCode)(lowered.charCodeAt(index))) {
|
|
136
|
+
index++;
|
|
137
|
+
continue;
|
|
138
|
+
}
|
|
139
|
+
let runEnd = index + 1;
|
|
140
|
+
while (runEnd < lowered.length &&
|
|
141
|
+
(0, RegExpCharacterClasses_1.isWhiteSpaceCode)(lowered.charCodeAt(runEnd))) {
|
|
142
|
+
runEnd++;
|
|
143
|
+
}
|
|
144
|
+
// One space is already as marked makes it.
|
|
145
|
+
if (runEnd - index > 1 || lowered.charCodeAt(index) !== SPACE) {
|
|
146
|
+
normalized += `${lowered.slice(copiedUpTo, index)} `;
|
|
147
|
+
copiedUpTo = runEnd;
|
|
148
|
+
}
|
|
149
|
+
index = runEnd;
|
|
150
|
+
}
|
|
151
|
+
return copiedUpTo === 0 ? lowered : normalized + lowered.slice(copiedUpTo);
|
|
152
|
+
};
|
|
153
|
+
exports.normalizeLinkLabel = normalizeLinkLabel;
|
|
154
|
+
// Whether text[start, end) is all white space, as \s reads it: true when empty.
|
|
155
|
+
const isAllWhiteSpace = (text, start, end) => {
|
|
156
|
+
for (let index = start; index < end; index++) {
|
|
157
|
+
if (!(0, RegExpCharacterClasses_1.isWhiteSpaceCode)(text.charCodeAt(index))) {
|
|
158
|
+
return false;
|
|
159
|
+
}
|
|
160
|
+
}
|
|
161
|
+
return true;
|
|
162
|
+
};
|
|
163
|
+
// After the spaces - only spaces - from `index`.
|
|
164
|
+
const skipSpaces = (text, index) => {
|
|
165
|
+
let at = index;
|
|
166
|
+
while (text.charCodeAt(at) === SPACE) {
|
|
167
|
+
at++;
|
|
168
|
+
}
|
|
169
|
+
return at;
|
|
170
|
+
};
|
|
171
|
+
// After the up to three spaces from `index`.
|
|
172
|
+
const skipUpToThreeSpaces = (text, index) => {
|
|
173
|
+
let at = index;
|
|
174
|
+
while (at - index < 3 && text.charCodeAt(at) === SPACE) {
|
|
175
|
+
at++;
|
|
176
|
+
}
|
|
177
|
+
return at;
|
|
178
|
+
};
|
|
179
|
+
// After the line breaks from `index`.
|
|
180
|
+
const skipLineBreaks = (text, index) => {
|
|
181
|
+
let at = index;
|
|
182
|
+
while (text.charCodeAt(at) === LINE_FEED) {
|
|
183
|
+
at++;
|
|
184
|
+
}
|
|
185
|
+
return at;
|
|
186
|
+
};
|
|
187
|
+
const isSpaceOrTab = (code) => {
|
|
188
|
+
return code === SPACE || code === TAB;
|
|
189
|
+
};
|
|
190
|
+
// Where the line `from` is on ends: at its line break, or the end of the text.
|
|
191
|
+
const getLineEnd = (text, from) => {
|
|
192
|
+
const lineBreak = text.indexOf("\n", from);
|
|
193
|
+
return lineBreak === -1 ? text.length : lineBreak;
|
|
194
|
+
};
|
|
195
|
+
/*
|
|
196
|
+
* Where the line ends if only spaces come after `index` on it: its line
|
|
197
|
+
* break, or the end of the text. -1 when anything else does.
|
|
198
|
+
*/
|
|
199
|
+
const lineEndAfterSpaces = (text, index) => {
|
|
200
|
+
const at = skipSpaces(text, index);
|
|
201
|
+
if (at >= text.length || text.charCodeAt(at) === LINE_FEED) {
|
|
202
|
+
return Math.min(at, text.length);
|
|
203
|
+
}
|
|
204
|
+
return -1;
|
|
205
|
+
};
|
|
206
|
+
// The start of the line after the one whose line break, or end, is `lineEnd`.
|
|
207
|
+
const nextLineStart = (text, lineEnd) => {
|
|
208
|
+
return lineEnd >= text.length ? text.length : lineEnd + 1;
|
|
209
|
+
};
|
|
210
|
+
const remembered = (find) => {
|
|
211
|
+
let askedFrom = Number.POSITIVE_INFINITY;
|
|
212
|
+
let found = -1;
|
|
213
|
+
return (from) => {
|
|
214
|
+
if (from < askedFrom || (found !== -1 && from > found)) {
|
|
215
|
+
askedFrom = from;
|
|
216
|
+
found = find(from);
|
|
217
|
+
}
|
|
218
|
+
return found;
|
|
219
|
+
};
|
|
220
|
+
};
|
|
221
|
+
const getTitleFinders = (text) => {
|
|
222
|
+
const indexOf = (part) => {
|
|
223
|
+
return remembered((from) => {
|
|
224
|
+
return text.indexOf(part, from);
|
|
225
|
+
});
|
|
226
|
+
};
|
|
227
|
+
// Made the first time a title asks: most texts never do.
|
|
228
|
+
let escapedQuotesEndingLines = null;
|
|
229
|
+
return {
|
|
230
|
+
freeDoubleQuote: remembered((from) => {
|
|
231
|
+
let quote = text.indexOf('"', from);
|
|
232
|
+
while (quote > 0 && text.charCodeAt(quote - 1) === BACKSLASH) {
|
|
233
|
+
quote = text.indexOf('"', quote + 1);
|
|
234
|
+
}
|
|
235
|
+
return quote;
|
|
236
|
+
}),
|
|
237
|
+
singleQuote: indexOf("'"),
|
|
238
|
+
blankLine: indexOf("\n\n"),
|
|
239
|
+
openParenthesis: indexOf("("),
|
|
240
|
+
closeParenthesis: indexOf(")"),
|
|
241
|
+
lastEscapedQuoteEndingLine: (from, before) => {
|
|
242
|
+
if (escapedQuotesEndingLines === null) {
|
|
243
|
+
escapedQuotesEndingLines = [];
|
|
244
|
+
for (let quote = text.indexOf('"'); quote !== -1; quote = text.indexOf('"', quote + 1)) {
|
|
245
|
+
if (quote > 0 &&
|
|
246
|
+
text.charCodeAt(quote - 1) === BACKSLASH &&
|
|
247
|
+
lineEndAfterSpaces(text, quote + 1) !== -1) {
|
|
248
|
+
escapedQuotesEndingLines.push(quote);
|
|
249
|
+
}
|
|
250
|
+
}
|
|
251
|
+
}
|
|
252
|
+
// The last one before `before`, by halves.
|
|
253
|
+
let low = 0;
|
|
254
|
+
let high = escapedQuotesEndingLines.length;
|
|
255
|
+
while (low < high) {
|
|
256
|
+
const middle = Math.floor((low + high) / 2);
|
|
257
|
+
if (escapedQuotesEndingLines[middle] < before) {
|
|
258
|
+
low = middle + 1;
|
|
259
|
+
}
|
|
260
|
+
else {
|
|
261
|
+
high = middle;
|
|
262
|
+
}
|
|
263
|
+
}
|
|
264
|
+
const last = escapedQuotesEndingLines[low - 1];
|
|
265
|
+
return last !== undefined && last >= from ? last : -1;
|
|
266
|
+
},
|
|
267
|
+
};
|
|
268
|
+
};
|
|
269
|
+
/*
|
|
270
|
+
* After the title that opens at `titleStart`, where only spaces follow it on
|
|
271
|
+
* its line; -1 when no title opens there that its line ends after.
|
|
272
|
+
*/
|
|
273
|
+
const readTitle = (text, titleStart, finders) => {
|
|
274
|
+
const opening = text.charCodeAt(titleStart);
|
|
275
|
+
if (opening === DOUBLE_QUOTE) {
|
|
276
|
+
/*
|
|
277
|
+
* marked's title runs to the first quote no backslash keeps; when its
|
|
278
|
+
* line does not end there, it takes a quote a backslash kept as the
|
|
279
|
+
* closing one, the last first.
|
|
280
|
+
*/
|
|
281
|
+
const free = finders.freeDoubleQuote(titleStart + 1);
|
|
282
|
+
if (free !== -1 && lineEndAfterSpaces(text, free + 1) !== -1) {
|
|
283
|
+
return free + 1;
|
|
284
|
+
}
|
|
285
|
+
const escaped = finders.lastEscapedQuoteEndingLine(titleStart + 2, free === -1 ? text.length : free);
|
|
286
|
+
return escaped === -1 ? -1 : escaped + 1;
|
|
287
|
+
}
|
|
288
|
+
if (opening === SINGLE_QUOTE) {
|
|
289
|
+
const close = finders.singleQuote(titleStart + 1);
|
|
290
|
+
if (close === -1) {
|
|
291
|
+
return -1;
|
|
292
|
+
}
|
|
293
|
+
const blankLine = finders.blankLine(titleStart + 1);
|
|
294
|
+
if (blankLine !== -1 && blankLine + 2 <= close) {
|
|
295
|
+
return -1;
|
|
296
|
+
}
|
|
297
|
+
return lineEndAfterSpaces(text, close + 1) === -1 ? -1 : close + 1;
|
|
298
|
+
}
|
|
299
|
+
if (opening === OPEN_PARENTHESIS) {
|
|
300
|
+
const close = finders.closeParenthesis(titleStart + 1);
|
|
301
|
+
if (close === -1) {
|
|
302
|
+
return -1;
|
|
303
|
+
}
|
|
304
|
+
const open = finders.openParenthesis(titleStart + 1);
|
|
305
|
+
if (open !== -1 && open < close) {
|
|
306
|
+
return -1;
|
|
307
|
+
}
|
|
308
|
+
return lineEndAfterSpaces(text, close + 1) === -1 ? -1 : close + 1;
|
|
309
|
+
}
|
|
310
|
+
return -1;
|
|
311
|
+
};
|
|
312
|
+
/*
|
|
313
|
+
* The rest of a definition whose address ends at `destinationEnd`: its
|
|
314
|
+
* title if it has one its line ends after, else nothing but spaces to the
|
|
315
|
+
* end of the address's line. null when neither.
|
|
316
|
+
*/
|
|
317
|
+
const readAfterDestination = (text, definition, destinationEnd, finders) => {
|
|
318
|
+
const afterSpaces = skipSpaces(text, destinationEnd);
|
|
319
|
+
// A title comes after spaces, a line break, or both.
|
|
320
|
+
if (afterSpaces > destinationEnd ||
|
|
321
|
+
text.charCodeAt(afterSpaces) === LINE_FEED) {
|
|
322
|
+
const titleStart = text.charCodeAt(afterSpaces) === LINE_FEED
|
|
323
|
+
? skipSpaces(text, afterSpaces + 1)
|
|
324
|
+
: afterSpaces;
|
|
325
|
+
const titleEnd = readTitle(text, titleStart, finders);
|
|
326
|
+
if (titleEnd !== -1) {
|
|
327
|
+
return {
|
|
328
|
+
definition: Object.assign(Object.assign({}, definition), { destinationEnd: destinationEnd, end: titleEnd }),
|
|
329
|
+
next: skipLineBreaks(text, nextLineStart(text, lineEndAfterSpaces(text, titleEnd))),
|
|
330
|
+
};
|
|
331
|
+
}
|
|
332
|
+
}
|
|
333
|
+
const lineEnd = lineEndAfterSpaces(text, destinationEnd);
|
|
334
|
+
if (lineEnd === -1) {
|
|
335
|
+
return null;
|
|
336
|
+
}
|
|
337
|
+
return {
|
|
338
|
+
definition: Object.assign(Object.assign({}, definition), { destinationEnd: destinationEnd, end: destinationEnd }),
|
|
339
|
+
next: skipLineBreaks(text, nextLineStart(text, lineEnd)),
|
|
340
|
+
};
|
|
341
|
+
};
|
|
342
|
+
/*
|
|
343
|
+
* After the label that starts at `labelStart` - at its "]" - or -1 when the
|
|
344
|
+
* brackets close on no label: a "[" comes first, or a backslash before a
|
|
345
|
+
* line break or the end of the text.
|
|
346
|
+
*/
|
|
347
|
+
const findLabelEnd = (text, labelStart) => {
|
|
348
|
+
for (let at = labelStart; at < text.length; at++) {
|
|
349
|
+
const code = text.charCodeAt(at);
|
|
350
|
+
if (code === BACKSLASH) {
|
|
351
|
+
if (at + 1 >= text.length ||
|
|
352
|
+
(0, RegExpCharacterClasses_1.isLineTerminatorCode)(text.charCodeAt(at + 1))) {
|
|
353
|
+
return -1;
|
|
354
|
+
}
|
|
355
|
+
at++;
|
|
356
|
+
continue;
|
|
357
|
+
}
|
|
358
|
+
if (code === OPEN_BRACKET) {
|
|
359
|
+
return -1;
|
|
360
|
+
}
|
|
361
|
+
if (code === CLOSE_BRACKET) {
|
|
362
|
+
return at;
|
|
363
|
+
}
|
|
364
|
+
}
|
|
365
|
+
return -1;
|
|
366
|
+
};
|
|
367
|
+
/*
|
|
368
|
+
* The definition that starts at `blockStart` of a text whose lines start
|
|
369
|
+
* with spaces, never tabs (a BlockLevel's text), if one starts there.
|
|
370
|
+
*/
|
|
371
|
+
const readDefinition = (text, blockStart, finders) => {
|
|
372
|
+
const at = skipUpToThreeSpaces(text, blockStart);
|
|
373
|
+
if (text.charCodeAt(at) !== OPEN_BRACKET) {
|
|
374
|
+
return null;
|
|
375
|
+
}
|
|
376
|
+
const labelStart = at + 1;
|
|
377
|
+
const labelEnd = findLabelEnd(text, labelStart);
|
|
378
|
+
if (labelEnd === -1 ||
|
|
379
|
+
text.charCodeAt(labelEnd + 1) !== COLON ||
|
|
380
|
+
isAllWhiteSpace(text, labelStart, labelEnd)) {
|
|
381
|
+
return null;
|
|
382
|
+
}
|
|
383
|
+
let destinationStart = skipSpaces(text, labelEnd + 2);
|
|
384
|
+
if (text.charCodeAt(destinationStart) === LINE_FEED) {
|
|
385
|
+
destinationStart = skipSpaces(text, destinationStart + 1);
|
|
386
|
+
}
|
|
387
|
+
if (destinationStart >= text.length) {
|
|
388
|
+
return null;
|
|
389
|
+
}
|
|
390
|
+
const definition = {
|
|
391
|
+
start: blockStart,
|
|
392
|
+
labelStart: labelStart,
|
|
393
|
+
labelEnd: labelEnd,
|
|
394
|
+
label: (0, exports.normalizeLinkLabel)(text.slice(labelStart, labelEnd)),
|
|
395
|
+
destinationStart: destinationStart,
|
|
396
|
+
};
|
|
397
|
+
if (text.charCodeAt(destinationStart) === LESS_THAN) {
|
|
398
|
+
// Each ">" on the line, the first first, until the rest reads.
|
|
399
|
+
for (let close = destinationStart + 1; close < text.length; close++) {
|
|
400
|
+
const code = text.charCodeAt(close);
|
|
401
|
+
if ((0, RegExpCharacterClasses_1.isLineTerminatorCode)(code)) {
|
|
402
|
+
return null;
|
|
403
|
+
}
|
|
404
|
+
if (code === GREATER_THAN) {
|
|
405
|
+
const reading = readAfterDestination(text, definition, close + 1, finders);
|
|
406
|
+
if (reading !== null) {
|
|
407
|
+
return reading;
|
|
408
|
+
}
|
|
409
|
+
}
|
|
410
|
+
}
|
|
411
|
+
return null;
|
|
412
|
+
}
|
|
413
|
+
if ((0, RegExpCharacterClasses_1.isWhiteSpaceCode)(text.charCodeAt(destinationStart))) {
|
|
414
|
+
return null;
|
|
415
|
+
}
|
|
416
|
+
let destinationEnd = destinationStart + 1;
|
|
417
|
+
while (destinationEnd < text.length &&
|
|
418
|
+
!(0, RegExpCharacterClasses_1.isWhiteSpaceCode)(text.charCodeAt(destinationEnd))) {
|
|
419
|
+
destinationEnd++;
|
|
420
|
+
}
|
|
421
|
+
return readAfterDestination(text, definition, destinationEnd, finders);
|
|
422
|
+
};
|
|
423
|
+
// Where `part` is in `text`, in order.
|
|
424
|
+
const findEvery = (text, part) => {
|
|
425
|
+
const found = [];
|
|
426
|
+
for (let at = text.indexOf(part); at !== -1; at = text.indexOf(part, at + 1)) {
|
|
427
|
+
found.push(at);
|
|
428
|
+
}
|
|
429
|
+
return found;
|
|
430
|
+
};
|
|
431
|
+
/*
|
|
432
|
+
* Where the line and paragraph separators (U+2028, U+2029) of a level's
|
|
433
|
+
* text are, in order: found the first time they are asked.
|
|
434
|
+
*/
|
|
435
|
+
const NO_POSITIONS = [];
|
|
436
|
+
const getSeparators = (level) => {
|
|
437
|
+
if (level.separators === null) {
|
|
438
|
+
const text = level.text;
|
|
439
|
+
// Most texts have none: a level of each list item is made.
|
|
440
|
+
level.separators =
|
|
441
|
+
text.indexOf(LINE_SEPARATOR) === -1 &&
|
|
442
|
+
text.indexOf(PARAGRAPH_SEPARATOR) === -1
|
|
443
|
+
? NO_POSITIONS
|
|
444
|
+
: findEvery(text, LINE_SEPARATOR)
|
|
445
|
+
.concat(findEvery(text, PARAGRAPH_SEPARATOR))
|
|
446
|
+
.sort((one, other) => {
|
|
447
|
+
return one - other;
|
|
448
|
+
});
|
|
449
|
+
}
|
|
450
|
+
return level.separators;
|
|
451
|
+
};
|
|
452
|
+
// The index of the first of the ordered `positions` at or after `from`, by halves.
|
|
453
|
+
const firstAtOrAfter = (positions, from) => {
|
|
454
|
+
let low = 0;
|
|
455
|
+
let high = positions.length;
|
|
456
|
+
while (low < high) {
|
|
457
|
+
const middle = Math.floor((low + high) / 2);
|
|
458
|
+
if (positions[middle] < from) {
|
|
459
|
+
low = middle + 1;
|
|
460
|
+
}
|
|
461
|
+
else {
|
|
462
|
+
high = middle;
|
|
463
|
+
}
|
|
464
|
+
}
|
|
465
|
+
return low;
|
|
466
|
+
};
|
|
467
|
+
// The piece of `lines` that `position` is in: the last to start at or before it.
|
|
468
|
+
const getLevelLine = (lines, position) => {
|
|
469
|
+
const starts = lines.starts;
|
|
470
|
+
for (let line = lines.cursor; line < Math.min(lines.cursor + 2, starts.length); line++) {
|
|
471
|
+
if (starts[line] <= position &&
|
|
472
|
+
(line + 1 >= starts.length || starts[line + 1] > position)) {
|
|
473
|
+
lines.cursor = line;
|
|
474
|
+
return line;
|
|
475
|
+
}
|
|
476
|
+
}
|
|
477
|
+
// By halves, when it is further on or back.
|
|
478
|
+
let low = 0;
|
|
479
|
+
let high = starts.length - 1;
|
|
480
|
+
while (low < high) {
|
|
481
|
+
const middle = Math.ceil((low + high) / 2);
|
|
482
|
+
if (starts[middle] <= position) {
|
|
483
|
+
low = middle;
|
|
484
|
+
}
|
|
485
|
+
else {
|
|
486
|
+
high = middle - 1;
|
|
487
|
+
}
|
|
488
|
+
}
|
|
489
|
+
lines.cursor = low;
|
|
490
|
+
return low;
|
|
491
|
+
};
|
|
492
|
+
/*
|
|
493
|
+
* Where a position of the level's text is in the whole text: one at or
|
|
494
|
+
* after the first character of its line that is neither a space nor a tab,
|
|
495
|
+
* and not among the spaces marked makes of tabs after a separator.
|
|
496
|
+
*/
|
|
497
|
+
const toWhole = (level, position) => {
|
|
498
|
+
if (level.lines === null) {
|
|
499
|
+
return position;
|
|
500
|
+
}
|
|
501
|
+
const line = getLevelLine(level.lines, position);
|
|
502
|
+
return (level.lines.wholeSolidStarts[line] +
|
|
503
|
+
(position - level.lines.solidStarts[line]));
|
|
504
|
+
};
|
|
505
|
+
// Where the line of the whole text that `position` is on starts.
|
|
506
|
+
const getWholeLineStart = (level, position) => {
|
|
507
|
+
if (level.lines === null) {
|
|
508
|
+
return level.text.lastIndexOf("\n", position - 1) + 1;
|
|
509
|
+
}
|
|
510
|
+
return level.lines.wholeLineStarts[getLevelLine(level.lines, position)];
|
|
511
|
+
};
|
|
512
|
+
/*
|
|
513
|
+
* After the run of `code` in text[at, to): where the first other character
|
|
514
|
+
* is, or `to`.
|
|
515
|
+
*/
|
|
516
|
+
const skipRun = (text, at, to, code) => {
|
|
517
|
+
let end = at;
|
|
518
|
+
while (end < to && text.charCodeAt(end) === code) {
|
|
519
|
+
end++;
|
|
520
|
+
}
|
|
521
|
+
return end;
|
|
522
|
+
};
|
|
523
|
+
/*
|
|
524
|
+
* Adds to `made`, the lines of a level made from `source`, a piece that
|
|
525
|
+
* starts at `start` and is the whole text's from `solid` - `sourceSolid` in
|
|
526
|
+
* the source - on.
|
|
527
|
+
*/
|
|
528
|
+
const addPiece = (made, source, start, wholeLineStart, solid, sourceSolid) => {
|
|
529
|
+
made.starts.push(start);
|
|
530
|
+
made.wholeLineStarts.push(wholeLineStart);
|
|
531
|
+
made.solidStarts.push(solid);
|
|
532
|
+
made.wholeSolidStarts.push(toWhole(source, sourceSolid));
|
|
533
|
+
};
|
|
534
|
+
/*
|
|
535
|
+
* The level of `lines` of `source`, as blockTokens makes it: the tabs that
|
|
536
|
+
* start each line made four spaces each, and so the tabs that come right
|
|
537
|
+
* after a line or paragraph separator, spaces before them or none - and, in
|
|
538
|
+
* a block quote (`stripsQuoteMarkers`), a quote's marker right after such a
|
|
539
|
+
* separator stripped first, spaces before it and a space or a tab after it,
|
|
540
|
+
* as marked strips each line's.
|
|
541
|
+
*/
|
|
542
|
+
const makeLevel = (source, lines, depth, stripsQuoteMarkers) => {
|
|
543
|
+
const text = source.text;
|
|
544
|
+
const separators = getSeparators(source);
|
|
545
|
+
let separator = lines.length > 0 ? firstAtOrAfter(separators, lines[0].from) : 0;
|
|
546
|
+
const pieces = [];
|
|
547
|
+
const made = {
|
|
548
|
+
starts: [],
|
|
549
|
+
wholeLineStarts: [],
|
|
550
|
+
solidStarts: [],
|
|
551
|
+
wholeSolidStarts: [],
|
|
552
|
+
cursor: 0,
|
|
553
|
+
};
|
|
554
|
+
let length = 0;
|
|
555
|
+
for (let index = 0; index < lines.length; index++) {
|
|
556
|
+
const line = lines[index];
|
|
557
|
+
if (index > 0) {
|
|
558
|
+
pieces.push("\n");
|
|
559
|
+
length++;
|
|
560
|
+
}
|
|
561
|
+
let spacesEnd = line.from;
|
|
562
|
+
while (spacesEnd < line.to && text.charCodeAt(spacesEnd) === SPACE) {
|
|
563
|
+
spacesEnd++;
|
|
564
|
+
}
|
|
565
|
+
let tabsEnd = spacesEnd;
|
|
566
|
+
while (tabsEnd < line.to && text.charCodeAt(tabsEnd) === TAB) {
|
|
567
|
+
tabsEnd++;
|
|
568
|
+
}
|
|
569
|
+
let spaces = line.lead;
|
|
570
|
+
let copiedFrom = line.from;
|
|
571
|
+
if (tabsEnd > spacesEnd) {
|
|
572
|
+
spaces += spacesEnd - line.from + 4 * (tabsEnd - spacesEnd);
|
|
573
|
+
copiedFrom = tabsEnd;
|
|
574
|
+
}
|
|
575
|
+
let solid = copiedFrom;
|
|
576
|
+
while (solid < line.to && isSpaceOrTab(text.charCodeAt(solid))) {
|
|
577
|
+
solid++;
|
|
578
|
+
}
|
|
579
|
+
const wholeLineStart = getWholeLineStart(source, line.from);
|
|
580
|
+
addPiece(made, source, length, wholeLineStart, length + spaces + (solid - copiedFrom), solid);
|
|
581
|
+
if (spaces > 0) {
|
|
582
|
+
pieces.push(" ".repeat(spaces));
|
|
583
|
+
length += spaces;
|
|
584
|
+
}
|
|
585
|
+
// The rest of the line, and what marked makes of it after a separator.
|
|
586
|
+
let copyFrom = copiedFrom;
|
|
587
|
+
while (separator < separators.length &&
|
|
588
|
+
separators[separator] < copiedFrom) {
|
|
589
|
+
separator++;
|
|
590
|
+
}
|
|
591
|
+
for (; separator < separators.length && separators[separator] < line.to; separator++) {
|
|
592
|
+
const after = separators[separator] + 1;
|
|
593
|
+
let rest = after;
|
|
594
|
+
if (stripsQuoteMarkers) {
|
|
595
|
+
const marker = skipRun(text, after, line.to, SPACE);
|
|
596
|
+
if (marker < line.to && text.charCodeAt(marker) === GREATER_THAN) {
|
|
597
|
+
rest = marker + 1;
|
|
598
|
+
if (rest < line.to && isSpaceOrTab(text.charCodeAt(rest))) {
|
|
599
|
+
rest++;
|
|
600
|
+
}
|
|
601
|
+
}
|
|
602
|
+
}
|
|
603
|
+
const restSpacesEnd = skipRun(text, rest, line.to, SPACE);
|
|
604
|
+
const restTabsEnd = skipRun(text, restSpacesEnd, line.to, TAB);
|
|
605
|
+
const restSpaces = restSpacesEnd - rest + 4 * (restTabsEnd - restSpacesEnd);
|
|
606
|
+
/*
|
|
607
|
+
* Up to the separator's end as it is, then its spaces and its tabs as
|
|
608
|
+
* spaces, and a piece from the first character after them: from there
|
|
609
|
+
* the line is the whole text's again - after the spaces of tabs the
|
|
610
|
+
* level it is made from made spaces too, which this piece reads past.
|
|
611
|
+
*/
|
|
612
|
+
pieces.push(text.slice(copyFrom, after));
|
|
613
|
+
length += after - copyFrom;
|
|
614
|
+
if (restSpaces > 0) {
|
|
615
|
+
pieces.push(" ".repeat(restSpaces));
|
|
616
|
+
length += restSpaces;
|
|
617
|
+
}
|
|
618
|
+
copyFrom = restTabsEnd;
|
|
619
|
+
addPiece(made, source, length, wholeLineStart, length, copyFrom);
|
|
620
|
+
}
|
|
621
|
+
if (line.to > copyFrom) {
|
|
622
|
+
pieces.push(text.slice(copyFrom, line.to));
|
|
623
|
+
length += line.to - copyFrom;
|
|
624
|
+
}
|
|
625
|
+
}
|
|
626
|
+
return {
|
|
627
|
+
text: pieces.join(""),
|
|
628
|
+
depth: depth,
|
|
629
|
+
lines: made,
|
|
630
|
+
separators: null,
|
|
631
|
+
};
|
|
632
|
+
};
|
|
633
|
+
/*
|
|
634
|
+
* The whole text as a level: a copy only when a line of it starts with a
|
|
635
|
+
* tab, or a separator comes right before tabs, spaces before them or none.
|
|
636
|
+
*/
|
|
637
|
+
const getWholeLevel = (text) => {
|
|
638
|
+
const whole = {
|
|
639
|
+
text: text,
|
|
640
|
+
depth: 0,
|
|
641
|
+
lines: null,
|
|
642
|
+
separators: null,
|
|
643
|
+
};
|
|
644
|
+
if (text.indexOf("\t") === -1) {
|
|
645
|
+
return whole;
|
|
646
|
+
}
|
|
647
|
+
const lines = [];
|
|
648
|
+
let startsWithTab = false;
|
|
649
|
+
for (let lineStart = 0; lineStart <= text.length;) {
|
|
650
|
+
const lineEnd = getLineEnd(text, lineStart);
|
|
651
|
+
startsWithTab =
|
|
652
|
+
startsWithTab || text.charCodeAt(skipSpaces(text, lineStart)) === TAB;
|
|
653
|
+
lines.push({ lead: 0, from: lineStart, to: lineEnd });
|
|
654
|
+
lineStart = lineEnd + 1;
|
|
655
|
+
}
|
|
656
|
+
for (const separator of getSeparators(whole)) {
|
|
657
|
+
startsWithTab =
|
|
658
|
+
startsWithTab || text.charCodeAt(skipSpaces(text, separator + 1)) === TAB;
|
|
659
|
+
}
|
|
660
|
+
return startsWithTab ? makeLevel(whole, lines, 0, false) : whole;
|
|
661
|
+
};
|
|
662
|
+
const startReading = (level, definitions) => {
|
|
663
|
+
const text = level.text;
|
|
664
|
+
return {
|
|
665
|
+
level: level,
|
|
666
|
+
definitions: definitions,
|
|
667
|
+
finders: null,
|
|
668
|
+
nextDefinitionColon: remembered((from) => {
|
|
669
|
+
return text.indexOf("]:", from);
|
|
670
|
+
}),
|
|
671
|
+
nextBlankLineBreak: remembered((from) => {
|
|
672
|
+
for (let lineBreak = text.indexOf("\n", from); lineBreak !== -1; lineBreak = text.indexOf("\n", lineBreak + 1)) {
|
|
673
|
+
if (text.charCodeAt(skipSpaces(text, lineBreak + 1)) === LINE_FEED) {
|
|
674
|
+
return lineBreak;
|
|
675
|
+
}
|
|
676
|
+
}
|
|
677
|
+
return -1;
|
|
678
|
+
}),
|
|
679
|
+
setextFrom: -1,
|
|
680
|
+
setextStop: -1,
|
|
681
|
+
};
|
|
682
|
+
};
|
|
683
|
+
const getFinders = (reading) => {
|
|
684
|
+
var _a;
|
|
685
|
+
reading.finders = (_a = reading.finders) !== null && _a !== void 0 ? _a : getTitleFinders(reading.level.text);
|
|
686
|
+
return reading.finders;
|
|
687
|
+
};
|
|
688
|
+
/*
|
|
689
|
+
* The first line or paragraph separator (U+2028, U+2029) in text[from,
|
|
690
|
+
* to), or -1: what "." does not match either, so a line that holds one is
|
|
691
|
+
* no heading, table row or setext heading's line to marked.
|
|
692
|
+
*/
|
|
693
|
+
const findSeparator = (reading, from, to) => {
|
|
694
|
+
const separators = getSeparators(reading.level);
|
|
695
|
+
const first = separators[firstAtOrAfter(separators, from)];
|
|
696
|
+
return first !== undefined && first < to ? first : -1;
|
|
697
|
+
};
|
|
698
|
+
/*
|
|
699
|
+
* Whether a definition's "]:" is in text[from, to): what a quote or a list
|
|
700
|
+
* item must hold to define anything.
|
|
701
|
+
*/
|
|
702
|
+
const holdsDefinitionColon = (reading, from, to) => {
|
|
703
|
+
const colon = reading.nextDefinitionColon(from);
|
|
704
|
+
return colon !== -1 && colon < to;
|
|
705
|
+
};
|
|
706
|
+
/*
|
|
707
|
+
* THE SHAPES OF LINES MARKED'S BLOCK RULES READ.
|
|
708
|
+
*
|
|
709
|
+
* Each is asked of a line of a level, from `at` - a line's start, or where
|
|
710
|
+
* an HTML block of the third to fifth kind ended on its line.
|
|
711
|
+
*/
|
|
712
|
+
/*
|
|
713
|
+
* Whether the line is a thematic break: up to three spaces, then three or
|
|
714
|
+
* more of one of "-", "_" and "*", with nothing but spaces and tabs between
|
|
715
|
+
* and after them.
|
|
716
|
+
*/
|
|
717
|
+
const isThematicBreak = (text, lineStart, lineEnd) => {
|
|
718
|
+
const at = skipUpToThreeSpaces(text, lineStart);
|
|
719
|
+
const mark = text.charCodeAt(at);
|
|
720
|
+
if (mark !== DASH && mark !== UNDERSCORE && mark !== ASTERISK) {
|
|
721
|
+
return false;
|
|
722
|
+
}
|
|
723
|
+
let marks = 0;
|
|
724
|
+
for (let index = at; index < lineEnd; index++) {
|
|
725
|
+
const code = text.charCodeAt(index);
|
|
726
|
+
if (code === mark) {
|
|
727
|
+
marks++;
|
|
728
|
+
}
|
|
729
|
+
else if (!isSpaceOrTab(code)) {
|
|
730
|
+
return false;
|
|
731
|
+
}
|
|
732
|
+
}
|
|
733
|
+
return marks >= 3;
|
|
734
|
+
};
|
|
735
|
+
/*
|
|
736
|
+
* Whether an ATX heading starts the line: up to three spaces, one to six
|
|
737
|
+
* "#", then white space or the end of the text. What ends a paragraph.
|
|
738
|
+
*/
|
|
739
|
+
const startsAtxHeading = (text, at) => {
|
|
740
|
+
const hashes = skipUpToThreeSpaces(text, at);
|
|
741
|
+
let end = hashes;
|
|
742
|
+
while (text.charCodeAt(end) === HASH) {
|
|
743
|
+
end++;
|
|
744
|
+
}
|
|
745
|
+
return (end - hashes >= 1 &&
|
|
746
|
+
end - hashes <= 6 &&
|
|
747
|
+
(end >= text.length || (0, RegExpCharacterClasses_1.isWhiteSpaceCode)(text.charCodeAt(end))));
|
|
748
|
+
};
|
|
749
|
+
/*
|
|
750
|
+
* Whether the line is an ATX heading: one starts it, and no line or
|
|
751
|
+
* paragraph separator is on it - marked's heading rule reads the line with
|
|
752
|
+
* ".", and such a line is text.
|
|
753
|
+
*/
|
|
754
|
+
const isAtxHeading = (reading, at, lineEnd) => {
|
|
755
|
+
return (startsAtxHeading(reading.level.text, at) &&
|
|
756
|
+
findSeparator(reading, at, lineEnd) === -1);
|
|
757
|
+
};
|
|
758
|
+
// Whether a block quote starts the line: up to three spaces, then ">".
|
|
759
|
+
const startsBlockQuote = (text, at) => {
|
|
760
|
+
return text.charCodeAt(skipUpToThreeSpaces(text, at)) === GREATER_THAN;
|
|
761
|
+
};
|
|
762
|
+
/*
|
|
763
|
+
* The fence the line opens, as marked's "fences" rule reads it: up to three
|
|
764
|
+
* spaces, then three or more backticks with no backtick after them on the
|
|
765
|
+
* line, or three or more tildes. null when it opens none.
|
|
766
|
+
*/
|
|
767
|
+
const getOpeningFence = (text, lineStart, lineEnd) => {
|
|
768
|
+
const at = skipUpToThreeSpaces(text, lineStart);
|
|
769
|
+
const code = text.charCodeAt(at);
|
|
770
|
+
if (code !== BACKTICK && code !== TILDE) {
|
|
771
|
+
return null;
|
|
772
|
+
}
|
|
773
|
+
let runEnd = at;
|
|
774
|
+
while (runEnd < lineEnd && text.charCodeAt(runEnd) === code) {
|
|
775
|
+
runEnd++;
|
|
776
|
+
}
|
|
777
|
+
if (runEnd - at < 3) {
|
|
778
|
+
return null;
|
|
779
|
+
}
|
|
780
|
+
if (code === BACKTICK) {
|
|
781
|
+
for (let index = runEnd; index < lineEnd; index++) {
|
|
782
|
+
if (text.charCodeAt(index) === BACKTICK) {
|
|
783
|
+
return null;
|
|
784
|
+
}
|
|
785
|
+
}
|
|
786
|
+
}
|
|
787
|
+
return { code: code, length: runEnd - at };
|
|
788
|
+
};
|
|
789
|
+
/*
|
|
790
|
+
* Whether the line closes `fence`: up to three spaces, the fence's run, any
|
|
791
|
+
* more backticks or tildes, then spaces alone.
|
|
792
|
+
*/
|
|
793
|
+
const closesFence = (text, lineStart, lineEnd, fence) => {
|
|
794
|
+
let at = skipUpToThreeSpaces(text, lineStart);
|
|
795
|
+
for (let index = 0; index < fence.length; index++) {
|
|
796
|
+
if (text.charCodeAt(at + index) !== fence.code) {
|
|
797
|
+
return false;
|
|
798
|
+
}
|
|
799
|
+
}
|
|
800
|
+
at += fence.length;
|
|
801
|
+
while (at < lineEnd &&
|
|
802
|
+
(text.charCodeAt(at) === BACKTICK || text.charCodeAt(at) === TILDE)) {
|
|
803
|
+
at++;
|
|
804
|
+
}
|
|
805
|
+
return skipSpaces(text, at) >= lineEnd;
|
|
806
|
+
};
|
|
807
|
+
/*
|
|
808
|
+
* Whether a list's bullet that ends a paragraph starts the line: up to three
|
|
809
|
+
* spaces, "*", "+", "-", "1." or "1)", then a space.
|
|
810
|
+
*/
|
|
811
|
+
const startsListInParagraph = (text, at) => {
|
|
812
|
+
const bullet = skipUpToThreeSpaces(text, at);
|
|
813
|
+
const code = text.charCodeAt(bullet);
|
|
814
|
+
let after = bullet + 1;
|
|
815
|
+
if (code === DIGIT_ONE) {
|
|
816
|
+
const delimiter = text.charCodeAt(bullet + 1);
|
|
817
|
+
if (delimiter !== DOT && delimiter !== CLOSE_PARENTHESIS) {
|
|
818
|
+
return false;
|
|
819
|
+
}
|
|
820
|
+
after = bullet + 2;
|
|
821
|
+
}
|
|
822
|
+
else if (code !== ASTERISK && code !== PLUS && code !== DASH) {
|
|
823
|
+
return false;
|
|
824
|
+
}
|
|
825
|
+
return text.charCodeAt(after) === SPACE;
|
|
826
|
+
};
|
|
827
|
+
/*
|
|
828
|
+
* Which of the lower case `names` the text at `at` starts with - in any
|
|
829
|
+
* case when `anyCase` - or null when none.
|
|
830
|
+
*/
|
|
831
|
+
const startsWithAny = (text, at, names, anyCase) => {
|
|
832
|
+
for (const name of names) {
|
|
833
|
+
const written = text.slice(at, at + name.length);
|
|
834
|
+
if ((anyCase ? written.toLowerCase() : written) === name) {
|
|
835
|
+
return name;
|
|
836
|
+
}
|
|
837
|
+
}
|
|
838
|
+
return null;
|
|
839
|
+
};
|
|
840
|
+
/*
|
|
841
|
+
* After a block tag opening or closing at "<" - `</?(tag)(?: +|\n|\/?>)` of
|
|
842
|
+
* marked's "html" rule, which reads it whatever its case, and of its
|
|
843
|
+
* paragraph rule, which reads it in lower case alone (`anyCase` false). -1
|
|
844
|
+
* when none is there.
|
|
845
|
+
*/
|
|
846
|
+
const readBlockTag = (text, open, anyCase) => {
|
|
847
|
+
let name = open + 1;
|
|
848
|
+
if (text.charCodeAt(name) === SLASH) {
|
|
849
|
+
name++;
|
|
850
|
+
}
|
|
851
|
+
let nameEnd = name;
|
|
852
|
+
while (nameEnd - name <= LONGEST_BLOCK_TAG_NAME &&
|
|
853
|
+
((0, RegExpCharacterClasses_1.isAsciiLetterCode)(text.charCodeAt(nameEnd)) ||
|
|
854
|
+
(0, RegExpCharacterClasses_1.isDigitCode)(text.charCodeAt(nameEnd)))) {
|
|
855
|
+
nameEnd++;
|
|
856
|
+
}
|
|
857
|
+
const written = text.slice(name, nameEnd);
|
|
858
|
+
if (nameEnd - name > LONGEST_BLOCK_TAG_NAME ||
|
|
859
|
+
!BLOCK_TAG_NAMES.has(anyCase ? written.toLowerCase() : written)) {
|
|
860
|
+
return -1;
|
|
861
|
+
}
|
|
862
|
+
const after = text.charCodeAt(nameEnd);
|
|
863
|
+
if (after === SPACE) {
|
|
864
|
+
return skipSpaces(text, nameEnd);
|
|
865
|
+
}
|
|
866
|
+
if (after === LINE_FEED || after === GREATER_THAN) {
|
|
867
|
+
return nameEnd + 1;
|
|
868
|
+
}
|
|
869
|
+
if (after === SLASH && text.charCodeAt(nameEnd + 1) === GREATER_THAN) {
|
|
870
|
+
return nameEnd + 2;
|
|
871
|
+
}
|
|
872
|
+
return -1;
|
|
873
|
+
};
|
|
874
|
+
/*
|
|
875
|
+
* Whether HTML that ends a paragraph starts the line - right at its start,
|
|
876
|
+
* in lower case: a block tag, or "<script", "<pre", "<style", "<textarea"
|
|
877
|
+
* or "<!--".
|
|
878
|
+
*/
|
|
879
|
+
const startsHtmlInParagraph = (text, at) => {
|
|
880
|
+
if (text.charCodeAt(at) !== LESS_THAN) {
|
|
881
|
+
return false;
|
|
882
|
+
}
|
|
883
|
+
return (startsWithAny(text, at + 1, RAW_TEXT_TAG_NAMES, false) !== null ||
|
|
884
|
+
text.startsWith("!--", at + 1) ||
|
|
885
|
+
readBlockTag(text, at, false) !== -1);
|
|
886
|
+
};
|
|
887
|
+
/*
|
|
888
|
+
* After a cell of a table's delimiter row at `at` - ":?-+:? *" - or -1
|
|
889
|
+
* when none is there.
|
|
890
|
+
*/
|
|
891
|
+
const readDelimiterCell = (text, at) => {
|
|
892
|
+
let end = at;
|
|
893
|
+
if (text.charCodeAt(end) === COLON) {
|
|
894
|
+
end++;
|
|
895
|
+
}
|
|
896
|
+
const dashes = end;
|
|
897
|
+
while (text.charCodeAt(end) === DASH) {
|
|
898
|
+
end++;
|
|
899
|
+
}
|
|
900
|
+
if (end === dashes) {
|
|
901
|
+
return -1;
|
|
902
|
+
}
|
|
903
|
+
if (text.charCodeAt(end) === COLON) {
|
|
904
|
+
end++;
|
|
905
|
+
}
|
|
906
|
+
return skipSpaces(text, end);
|
|
907
|
+
};
|
|
908
|
+
const readDelimiterRow = (text, lineStart, lineEnd) => {
|
|
909
|
+
const rowStart = skipUpToThreeSpaces(text, lineStart);
|
|
910
|
+
let end = readDelimiterCell(text, text.charCodeAt(rowStart) === PIPE
|
|
911
|
+
? skipSpaces(text, rowStart + 1)
|
|
912
|
+
: rowStart);
|
|
913
|
+
if (end === -1) {
|
|
914
|
+
return null;
|
|
915
|
+
}
|
|
916
|
+
let cells = 1;
|
|
917
|
+
while (text.charCodeAt(end) === PIPE) {
|
|
918
|
+
const next = skipSpaces(text, end + 1);
|
|
919
|
+
const cellEnd = readDelimiterCell(text, next);
|
|
920
|
+
// A last pipe, with no cell after it.
|
|
921
|
+
if (cellEnd === -1) {
|
|
922
|
+
end = next;
|
|
923
|
+
break;
|
|
924
|
+
}
|
|
925
|
+
cells++;
|
|
926
|
+
end = cellEnd;
|
|
927
|
+
}
|
|
928
|
+
if (end !== lineEnd) {
|
|
929
|
+
return null;
|
|
930
|
+
}
|
|
931
|
+
let holdsPipeOrColon = false;
|
|
932
|
+
for (let index = rowStart; index < end; index++) {
|
|
933
|
+
const code = text.charCodeAt(index);
|
|
934
|
+
if (code === PIPE || code === COLON) {
|
|
935
|
+
holdsPipeOrColon = true;
|
|
936
|
+
break;
|
|
937
|
+
}
|
|
938
|
+
}
|
|
939
|
+
return { cells: cells, holdsPipeOrColon: holdsPipeOrColon };
|
|
940
|
+
};
|
|
941
|
+
/*
|
|
942
|
+
* How many cells marked splits a table's header row into (splitCells):
|
|
943
|
+
* one more than the pipes no backslash escapes, less a first or last cell
|
|
944
|
+
* of white space alone.
|
|
945
|
+
*/
|
|
946
|
+
const countHeaderCells = (text, from, to) => {
|
|
947
|
+
let pipes = 0;
|
|
948
|
+
let firstPipe = -1;
|
|
949
|
+
let lastPipe = -1;
|
|
950
|
+
let backslashes = 0;
|
|
951
|
+
for (let index = from; index < to; index++) {
|
|
952
|
+
const code = text.charCodeAt(index);
|
|
953
|
+
if (code === PIPE && backslashes % 2 === 0) {
|
|
954
|
+
pipes++;
|
|
955
|
+
firstPipe = firstPipe === -1 ? index : firstPipe;
|
|
956
|
+
lastPipe = index;
|
|
957
|
+
}
|
|
958
|
+
backslashes = code === BACKSLASH ? backslashes + 1 : 0;
|
|
959
|
+
}
|
|
960
|
+
let cells = pipes + 1;
|
|
961
|
+
if (isAllWhiteSpace(text, from, firstPipe === -1 ? to : firstPipe)) {
|
|
962
|
+
cells--;
|
|
963
|
+
}
|
|
964
|
+
if (pipes > 0 && cells > 0 && isAllWhiteSpace(text, lastPipe + 1, to)) {
|
|
965
|
+
cells--;
|
|
966
|
+
}
|
|
967
|
+
return cells;
|
|
968
|
+
};
|
|
969
|
+
/*
|
|
970
|
+
* Whether a table's header row starts the line - the line after it a
|
|
971
|
+
* delimiter row - as marked's GFM paragraph rule reads one, which ends a
|
|
972
|
+
* paragraph there: spaces, then a character that is no space, and no line
|
|
973
|
+
* or paragraph separator after it on the line.
|
|
974
|
+
*/
|
|
975
|
+
const startsTable = (reading, at, lineEnd) => {
|
|
976
|
+
const text = reading.level.text;
|
|
977
|
+
const header = skipSpaces(text, at);
|
|
978
|
+
return (lineEnd < text.length &&
|
|
979
|
+
header < lineEnd &&
|
|
980
|
+
findSeparator(reading, header + 1, lineEnd) === -1 &&
|
|
981
|
+
readDelimiterRow(text, lineEnd + 1, getLineEnd(text, lineEnd + 1)) !== null);
|
|
982
|
+
};
|
|
983
|
+
/*
|
|
984
|
+
* Whether the line at `at` - not empty - ends a paragraph before it:
|
|
985
|
+
* marked's paragraph rule, without the GFM tables when `withTables` is
|
|
986
|
+
* false (a block quote's paragraph, whose lazy lines it ends).
|
|
987
|
+
*/
|
|
988
|
+
const endsParagraph = (reading, at, withTables) => {
|
|
989
|
+
const text = reading.level.text;
|
|
990
|
+
const lineEnd = getLineEnd(text, at);
|
|
991
|
+
return (isThematicBreak(text, at, lineEnd) ||
|
|
992
|
+
startsAtxHeading(text, at) ||
|
|
993
|
+
startsBlockQuote(text, at) ||
|
|
994
|
+
// A fence, its line ending in a line break.
|
|
995
|
+
(lineEnd < text.length && getOpeningFence(text, at, lineEnd) !== null) ||
|
|
996
|
+
startsListInParagraph(text, at) ||
|
|
997
|
+
startsHtmlInParagraph(text, at) ||
|
|
998
|
+
// Spaces alone, a line break after them.
|
|
999
|
+
(lineEnd < text.length && skipSpaces(text, at) >= lineEnd) ||
|
|
1000
|
+
(withTables && startsTable(reading, at, lineEnd)));
|
|
1001
|
+
};
|
|
1002
|
+
/*
|
|
1003
|
+
* Whether the line, from `at`, is a setext heading's underline: up to three
|
|
1004
|
+
* spaces, a run of "=" or of "-", then spaces alone.
|
|
1005
|
+
*/
|
|
1006
|
+
const isSetextUnderline = (text, at) => {
|
|
1007
|
+
const mark = skipUpToThreeSpaces(text, at);
|
|
1008
|
+
const code = text.charCodeAt(mark);
|
|
1009
|
+
if (code !== EQUALS && code !== DASH) {
|
|
1010
|
+
return false;
|
|
1011
|
+
}
|
|
1012
|
+
let end = mark;
|
|
1013
|
+
while (text.charCodeAt(end) === code) {
|
|
1014
|
+
end++;
|
|
1015
|
+
}
|
|
1016
|
+
end = skipSpaces(text, end);
|
|
1017
|
+
return end >= text.length || text.charCodeAt(end) === LINE_FEED;
|
|
1018
|
+
};
|
|
1019
|
+
/*
|
|
1020
|
+
* Whether the line at `at` is one a setext heading cannot run over (its
|
|
1021
|
+
* "lheading" rule): a bullet and a space at the very start, four spaces, a
|
|
1022
|
+
* fence, ">", "#", or an HTML tag that ends its line, a line break after it
|
|
1023
|
+
* - and, past its first line, white space alone, a line break after it.
|
|
1024
|
+
*/
|
|
1025
|
+
const breaksSetextHeading = (text, at, isFirstLine) => {
|
|
1026
|
+
if (!isFirstLine) {
|
|
1027
|
+
let end = at;
|
|
1028
|
+
while (end < text.length &&
|
|
1029
|
+
text.charCodeAt(end) !== LINE_FEED &&
|
|
1030
|
+
(0, RegExpCharacterClasses_1.isWhiteSpaceCode)(text.charCodeAt(end))) {
|
|
1031
|
+
end++;
|
|
1032
|
+
}
|
|
1033
|
+
if (text.charCodeAt(end) === LINE_FEED) {
|
|
1034
|
+
return true;
|
|
1035
|
+
}
|
|
1036
|
+
}
|
|
1037
|
+
const code = text.charCodeAt(at);
|
|
1038
|
+
if ((code === ASTERISK || code === PLUS || code === DASH) &&
|
|
1039
|
+
text.charCodeAt(at + 1) === SPACE) {
|
|
1040
|
+
return true;
|
|
1041
|
+
}
|
|
1042
|
+
let digitsEnd = at;
|
|
1043
|
+
while (digitsEnd - at < 10 && (0, RegExpCharacterClasses_1.isDigitCode)(text.charCodeAt(digitsEnd))) {
|
|
1044
|
+
digitsEnd++;
|
|
1045
|
+
}
|
|
1046
|
+
const delimiter = text.charCodeAt(digitsEnd);
|
|
1047
|
+
if (digitsEnd > at &&
|
|
1048
|
+
digitsEnd - at <= 9 &&
|
|
1049
|
+
(delimiter === DOT || delimiter === CLOSE_PARENTHESIS) &&
|
|
1050
|
+
text.charCodeAt(digitsEnd + 1) === SPACE) {
|
|
1051
|
+
return true;
|
|
1052
|
+
}
|
|
1053
|
+
if (skipSpaces(text, at) - at >= 4) {
|
|
1054
|
+
return true;
|
|
1055
|
+
}
|
|
1056
|
+
const first = skipUpToThreeSpaces(text, at);
|
|
1057
|
+
const firstCode = text.charCodeAt(first);
|
|
1058
|
+
if ((firstCode === BACKTICK || firstCode === TILDE) &&
|
|
1059
|
+
text.charCodeAt(first + 1) === firstCode &&
|
|
1060
|
+
text.charCodeAt(first + 2) === firstCode) {
|
|
1061
|
+
return true;
|
|
1062
|
+
}
|
|
1063
|
+
if (firstCode === GREATER_THAN || firstCode === HASH) {
|
|
1064
|
+
return true;
|
|
1065
|
+
}
|
|
1066
|
+
if (firstCode === LESS_THAN) {
|
|
1067
|
+
let end = first + 1;
|
|
1068
|
+
while (end < text.length &&
|
|
1069
|
+
text.charCodeAt(end) !== GREATER_THAN &&
|
|
1070
|
+
text.charCodeAt(end) !== LINE_FEED) {
|
|
1071
|
+
end++;
|
|
1072
|
+
}
|
|
1073
|
+
return (end > first + 1 &&
|
|
1074
|
+
text.charCodeAt(end) === GREATER_THAN &&
|
|
1075
|
+
text.charCodeAt(end + 1) === LINE_FEED);
|
|
1076
|
+
}
|
|
1077
|
+
return false;
|
|
1078
|
+
};
|
|
1079
|
+
/*
|
|
1080
|
+
* THE BLOCKS, AS MARKED'S TOKENIZERS READ THEM.
|
|
1081
|
+
*
|
|
1082
|
+
* Each reads its block from `at` of a level and returns where the next
|
|
1083
|
+
* block starts - or -1, or `at`, when its block is not there.
|
|
1084
|
+
*/
|
|
1085
|
+
// Lines of spaces alone, and the line breaks after them.
|
|
1086
|
+
const readSpace = (text, at) => {
|
|
1087
|
+
let end = at;
|
|
1088
|
+
for (;;) {
|
|
1089
|
+
const spacesEnd = skipSpaces(text, end);
|
|
1090
|
+
if (spacesEnd >= text.length) {
|
|
1091
|
+
return text.length;
|
|
1092
|
+
}
|
|
1093
|
+
if (text.charCodeAt(spacesEnd) !== LINE_FEED) {
|
|
1094
|
+
return end;
|
|
1095
|
+
}
|
|
1096
|
+
end = spacesEnd + 1;
|
|
1097
|
+
}
|
|
1098
|
+
};
|
|
1099
|
+
/*
|
|
1100
|
+
* Indented code: lines of four spaces and something more, the lines of
|
|
1101
|
+
* spaces alone between and after them.
|
|
1102
|
+
*/
|
|
1103
|
+
const readIndentedCode = (text, at) => {
|
|
1104
|
+
let end = at;
|
|
1105
|
+
while (end + 4 < text.length &&
|
|
1106
|
+
text.charCodeAt(end) === SPACE &&
|
|
1107
|
+
text.charCodeAt(end + 1) === SPACE &&
|
|
1108
|
+
text.charCodeAt(end + 2) === SPACE &&
|
|
1109
|
+
text.charCodeAt(end + 3) === SPACE &&
|
|
1110
|
+
text.charCodeAt(end + 4) !== LINE_FEED) {
|
|
1111
|
+
end = getLineEnd(text, end + 4);
|
|
1112
|
+
if (end >= text.length) {
|
|
1113
|
+
break;
|
|
1114
|
+
}
|
|
1115
|
+
end++;
|
|
1116
|
+
for (;;) {
|
|
1117
|
+
const spacesEnd = skipSpaces(text, end);
|
|
1118
|
+
if (spacesEnd >= text.length) {
|
|
1119
|
+
end = text.length;
|
|
1120
|
+
break;
|
|
1121
|
+
}
|
|
1122
|
+
if (text.charCodeAt(spacesEnd) !== LINE_FEED) {
|
|
1123
|
+
break;
|
|
1124
|
+
}
|
|
1125
|
+
end = spacesEnd + 1;
|
|
1126
|
+
}
|
|
1127
|
+
}
|
|
1128
|
+
return end;
|
|
1129
|
+
};
|
|
1130
|
+
// A fenced code block, to its closing fence's line or the end of the text.
|
|
1131
|
+
const readFencedCode = (text, at, lineEnd) => {
|
|
1132
|
+
const fence = getOpeningFence(text, at, lineEnd);
|
|
1133
|
+
if (fence === null) {
|
|
1134
|
+
return -1;
|
|
1135
|
+
}
|
|
1136
|
+
for (let lineStart = nextLineStart(text, lineEnd); lineStart < text.length;) {
|
|
1137
|
+
const closeEnd = getLineEnd(text, lineStart);
|
|
1138
|
+
if (closesFence(text, lineStart, closeEnd, fence)) {
|
|
1139
|
+
return closeEnd;
|
|
1140
|
+
}
|
|
1141
|
+
lineStart = nextLineStart(text, closeEnd);
|
|
1142
|
+
}
|
|
1143
|
+
return text.length;
|
|
1144
|
+
};
|
|
1145
|
+
/*
|
|
1146
|
+
* A block quote: lines that start with up to three spaces and ">", each
|
|
1147
|
+
* carried on - when anything follows its ">" - by the lazy lines of a
|
|
1148
|
+
* paragraph, which only what ends a paragraph ends (blockquote rule). Its
|
|
1149
|
+
* lines are read again, as marked reads them, without their markers.
|
|
1150
|
+
*/
|
|
1151
|
+
const readBlockQuote = (reading, at) => {
|
|
1152
|
+
const text = reading.level.text;
|
|
1153
|
+
if (!startsBlockQuote(text, at)) {
|
|
1154
|
+
return -1;
|
|
1155
|
+
}
|
|
1156
|
+
let end = at;
|
|
1157
|
+
while (end < text.length && startsBlockQuote(text, end)) {
|
|
1158
|
+
const marker = skipUpToThreeSpaces(text, end);
|
|
1159
|
+
let groupEnd = getLineEnd(text, end);
|
|
1160
|
+
/*
|
|
1161
|
+
* Lazy lines carry on what follows the ">" and a space after it: none
|
|
1162
|
+
* when nothing does - marked reads "> " alone as a line of its own.
|
|
1163
|
+
*/
|
|
1164
|
+
const afterMarker = marker + (text.charCodeAt(marker + 1) === SPACE ? 2 : 1);
|
|
1165
|
+
if (afterMarker < groupEnd) {
|
|
1166
|
+
while (groupEnd < text.length) {
|
|
1167
|
+
const next = groupEnd + 1;
|
|
1168
|
+
if (next >= text.length ||
|
|
1169
|
+
text.charCodeAt(next) === LINE_FEED ||
|
|
1170
|
+
endsParagraph(reading, next, false)) {
|
|
1171
|
+
break;
|
|
1172
|
+
}
|
|
1173
|
+
groupEnd = getLineEnd(text, next);
|
|
1174
|
+
}
|
|
1175
|
+
}
|
|
1176
|
+
end = nextLineStart(text, groupEnd);
|
|
1177
|
+
}
|
|
1178
|
+
if (reading.level.depth < exports.MAX_DEFINITION_NESTING_DEPTH &&
|
|
1179
|
+
holdsDefinitionColon(reading, at, end)) {
|
|
1180
|
+
const lines = [];
|
|
1181
|
+
for (let lineStart = at; lineStart < end;) {
|
|
1182
|
+
const lineEnd = getLineEnd(text, lineStart);
|
|
1183
|
+
/*
|
|
1184
|
+
* A lazy line that would underline a setext heading gets four spaces
|
|
1185
|
+
* first, so it does not; every line loses spaces, a ">" and the space
|
|
1186
|
+
* or tab after it.
|
|
1187
|
+
*/
|
|
1188
|
+
if (lineStart > at && isSetextUnderline(text, lineStart)) {
|
|
1189
|
+
lines.push({
|
|
1190
|
+
lead: 4,
|
|
1191
|
+
from: skipSpaces(text, lineStart),
|
|
1192
|
+
to: lineEnd,
|
|
1193
|
+
});
|
|
1194
|
+
}
|
|
1195
|
+
else {
|
|
1196
|
+
const marker = skipSpaces(text, lineStart);
|
|
1197
|
+
let from = lineStart;
|
|
1198
|
+
if (text.charCodeAt(marker) === GREATER_THAN) {
|
|
1199
|
+
from = marker + 1;
|
|
1200
|
+
if (from < lineEnd && isSpaceOrTab(text.charCodeAt(from))) {
|
|
1201
|
+
from++;
|
|
1202
|
+
}
|
|
1203
|
+
}
|
|
1204
|
+
lines.push({ lead: 0, from: from, to: lineEnd });
|
|
1205
|
+
}
|
|
1206
|
+
lineStart = lineEnd + 1;
|
|
1207
|
+
}
|
|
1208
|
+
// No line breaks at its end.
|
|
1209
|
+
while (lines.length > 0 &&
|
|
1210
|
+
lines[lines.length - 1].lead === 0 &&
|
|
1211
|
+
lines[lines.length - 1].from >= lines[lines.length - 1].to) {
|
|
1212
|
+
lines.pop();
|
|
1213
|
+
}
|
|
1214
|
+
readBlocks(makeLevel(reading.level, lines, reading.level.depth + 1, true), true, reading.definitions);
|
|
1215
|
+
}
|
|
1216
|
+
return end;
|
|
1217
|
+
};
|
|
1218
|
+
const readBullet = (text, at) => {
|
|
1219
|
+
const code = text.charCodeAt(at);
|
|
1220
|
+
if (code === ASTERISK || code === PLUS || code === DASH) {
|
|
1221
|
+
return { end: at + 1, mark: code, isOrdered: false };
|
|
1222
|
+
}
|
|
1223
|
+
let digitsEnd = at;
|
|
1224
|
+
while (digitsEnd - at < 10 && (0, RegExpCharacterClasses_1.isDigitCode)(text.charCodeAt(digitsEnd))) {
|
|
1225
|
+
digitsEnd++;
|
|
1226
|
+
}
|
|
1227
|
+
const delimiter = text.charCodeAt(digitsEnd);
|
|
1228
|
+
if (digitsEnd === at ||
|
|
1229
|
+
digitsEnd - at > 9 ||
|
|
1230
|
+
(delimiter !== DOT && delimiter !== CLOSE_PARENTHESIS)) {
|
|
1231
|
+
return null;
|
|
1232
|
+
}
|
|
1233
|
+
return { end: digitsEnd + 1, mark: delimiter, isOrdered: true };
|
|
1234
|
+
};
|
|
1235
|
+
/*
|
|
1236
|
+
* Where the line text[from, to), after `lead` spaces, has its first
|
|
1237
|
+
* character that is no space - -1 when it has none - and the shapes of it
|
|
1238
|
+
* that end a list item, as its list tokenizer reads them with up to
|
|
1239
|
+
* `maxSpaces` spaces before them.
|
|
1240
|
+
*/
|
|
1241
|
+
const getFirstNonSpace = (text, line) => {
|
|
1242
|
+
let at = line.from;
|
|
1243
|
+
while (at < line.to && text.charCodeAt(at) === SPACE) {
|
|
1244
|
+
at++;
|
|
1245
|
+
}
|
|
1246
|
+
return { index: at < line.to ? line.lead + (at - line.from) : -1, at: at };
|
|
1247
|
+
};
|
|
1248
|
+
const beginsItemBreak = (text, line, maxSpaces, withBullets) => {
|
|
1249
|
+
const first = getFirstNonSpace(text, line);
|
|
1250
|
+
if (first.index === -1 || first.index > maxSpaces) {
|
|
1251
|
+
return false;
|
|
1252
|
+
}
|
|
1253
|
+
const at = first.at;
|
|
1254
|
+
const code = text.charCodeAt(at);
|
|
1255
|
+
// A fence: "```" or "~~~".
|
|
1256
|
+
if ((code === BACKTICK || code === TILDE) &&
|
|
1257
|
+
at + 2 < line.to &&
|
|
1258
|
+
text.charCodeAt(at + 1) === code &&
|
|
1259
|
+
text.charCodeAt(at + 2) === code) {
|
|
1260
|
+
return true;
|
|
1261
|
+
}
|
|
1262
|
+
// A heading: "#".
|
|
1263
|
+
if (code === HASH) {
|
|
1264
|
+
return true;
|
|
1265
|
+
}
|
|
1266
|
+
// A thematic break of spaces and three or more of one mark.
|
|
1267
|
+
if (code === DASH || code === UNDERSCORE || code === ASTERISK) {
|
|
1268
|
+
let marks = 0;
|
|
1269
|
+
let isBreak = true;
|
|
1270
|
+
for (let index = at; index < line.to && isBreak; index++) {
|
|
1271
|
+
const next = text.charCodeAt(index);
|
|
1272
|
+
if (next === code) {
|
|
1273
|
+
marks++;
|
|
1274
|
+
}
|
|
1275
|
+
else if (next !== SPACE) {
|
|
1276
|
+
isBreak = false;
|
|
1277
|
+
}
|
|
1278
|
+
}
|
|
1279
|
+
if (isBreak && marks >= 3) {
|
|
1280
|
+
return true;
|
|
1281
|
+
}
|
|
1282
|
+
}
|
|
1283
|
+
// A bullet, then a space, a tab or the end of the line.
|
|
1284
|
+
if (withBullets) {
|
|
1285
|
+
const bullet = readBullet(text, at);
|
|
1286
|
+
return (bullet !== null &&
|
|
1287
|
+
(bullet.end >= line.to || isSpaceOrTab(text.charCodeAt(bullet.end))));
|
|
1288
|
+
}
|
|
1289
|
+
return false;
|
|
1290
|
+
};
|
|
1291
|
+
const readListItem = (text, at, bullet) => {
|
|
1292
|
+
const lineEnd = getLineEnd(text, at);
|
|
1293
|
+
const itemBullet = readBullet(text, skipUpToThreeSpaces(text, at));
|
|
1294
|
+
if (itemBullet === null ||
|
|
1295
|
+
itemBullet.isOrdered !== bullet.isOrdered ||
|
|
1296
|
+
itemBullet.mark !== bullet.mark ||
|
|
1297
|
+
(itemBullet.end < lineEnd &&
|
|
1298
|
+
!isSpaceOrTab(text.charCodeAt(itemBullet.end))) ||
|
|
1299
|
+
isThematicBreak(text, at, lineEnd)) {
|
|
1300
|
+
return null;
|
|
1301
|
+
}
|
|
1302
|
+
// The first line after the bullet, its first tabs three spaces each.
|
|
1303
|
+
const contentStart = itemBullet.end;
|
|
1304
|
+
let tabsEnd = contentStart;
|
|
1305
|
+
while (tabsEnd < lineEnd && text.charCodeAt(tabsEnd) === TAB) {
|
|
1306
|
+
tabsEnd++;
|
|
1307
|
+
}
|
|
1308
|
+
const firstLine = {
|
|
1309
|
+
lead: 3 * (tabsEnd - contentStart),
|
|
1310
|
+
from: tabsEnd,
|
|
1311
|
+
to: lineEnd,
|
|
1312
|
+
};
|
|
1313
|
+
/*
|
|
1314
|
+
* How far the item's lines are indented: to the first character after
|
|
1315
|
+
* the bullet that is no space - its line break too - or one space past it
|
|
1316
|
+
* when that is more than four.
|
|
1317
|
+
*/
|
|
1318
|
+
const firstNonSpace = skipSpaces(text, contentStart);
|
|
1319
|
+
let indent = firstNonSpace < text.length ? firstNonSpace - contentStart : -1;
|
|
1320
|
+
indent = indent > 4 ? 1 : indent;
|
|
1321
|
+
/*
|
|
1322
|
+
* What the item holds of its first line: from its indent - all of it
|
|
1323
|
+
* when a tab starts it, and the last of the spaces up to the end of the
|
|
1324
|
+
* text when they are all it has.
|
|
1325
|
+
*/
|
|
1326
|
+
let head = firstLine;
|
|
1327
|
+
if (firstLine.lead === 0) {
|
|
1328
|
+
head = {
|
|
1329
|
+
lead: 0,
|
|
1330
|
+
from: indent >= 0
|
|
1331
|
+
? Math.min(contentStart + indent, lineEnd)
|
|
1332
|
+
: Math.max(contentStart, lineEnd - 1),
|
|
1333
|
+
to: lineEnd,
|
|
1334
|
+
};
|
|
1335
|
+
}
|
|
1336
|
+
indent += contentStart - at;
|
|
1337
|
+
const lines = [head];
|
|
1338
|
+
let end = nextLineStart(text, lineEnd);
|
|
1339
|
+
// An item that is no more than its bullet ends at a blank line after it.
|
|
1340
|
+
const isEmpty = firstLine.lead === 0 && contentStart === lineEnd;
|
|
1341
|
+
if (isEmpty && skipSpaces(text, end) >= getLineEnd(text, end)) {
|
|
1342
|
+
return {
|
|
1343
|
+
lines: lines,
|
|
1344
|
+
end: nextLineStart(text, getLineEnd(text, end)),
|
|
1345
|
+
};
|
|
1346
|
+
}
|
|
1347
|
+
const maxSpaces = Math.min(3, indent - 1);
|
|
1348
|
+
let hasBlankLine = false;
|
|
1349
|
+
let previous = firstLine;
|
|
1350
|
+
while (end < text.length) {
|
|
1351
|
+
const nextEnd = getLineEnd(text, end);
|
|
1352
|
+
const next = { lead: 0, from: end, to: nextEnd };
|
|
1353
|
+
if (beginsItemBreak(text, next, maxSpaces, true)) {
|
|
1354
|
+
break;
|
|
1355
|
+
}
|
|
1356
|
+
const isBlank = isAllWhiteSpace(text, end, nextEnd);
|
|
1357
|
+
const nextFirst = getFirstNonSpace(text, next).index;
|
|
1358
|
+
const dedented = {
|
|
1359
|
+
lead: 0,
|
|
1360
|
+
from: Math.min(end + indent, nextEnd),
|
|
1361
|
+
to: nextEnd,
|
|
1362
|
+
};
|
|
1363
|
+
if (nextFirst >= indent || isBlank) {
|
|
1364
|
+
lines.push(dedented);
|
|
1365
|
+
}
|
|
1366
|
+
else {
|
|
1367
|
+
// A lazy line carries on a paragraph alone.
|
|
1368
|
+
if (hasBlankLine ||
|
|
1369
|
+
getFirstNonSpace(text, previous).index >= 4 ||
|
|
1370
|
+
beginsItemBreak(text, previous, maxSpaces, false)) {
|
|
1371
|
+
break;
|
|
1372
|
+
}
|
|
1373
|
+
lines.push(next);
|
|
1374
|
+
}
|
|
1375
|
+
hasBlankLine = hasBlankLine || isBlank;
|
|
1376
|
+
end = nextLineStart(text, nextEnd);
|
|
1377
|
+
previous = dedented;
|
|
1378
|
+
}
|
|
1379
|
+
// A task's "[ ] " or "[x] ", and the spaces after it, are no content.
|
|
1380
|
+
const content = lines[0];
|
|
1381
|
+
if (content.lead === 0 &&
|
|
1382
|
+
content.from + 3 < content.to &&
|
|
1383
|
+
text.charCodeAt(content.from) === OPEN_BRACKET &&
|
|
1384
|
+
(text.charCodeAt(content.from + 1) === SPACE ||
|
|
1385
|
+
text.charCodeAt(content.from + 1) === LOWER_X ||
|
|
1386
|
+
text.charCodeAt(content.from + 1) === UPPER_X) &&
|
|
1387
|
+
text.charCodeAt(content.from + 2) === CLOSE_BRACKET &&
|
|
1388
|
+
text.charCodeAt(content.from + 3) === SPACE) {
|
|
1389
|
+
lines[0] = {
|
|
1390
|
+
lead: 0,
|
|
1391
|
+
from: Math.min(skipSpaces(text, content.from + 3), content.to),
|
|
1392
|
+
to: content.to,
|
|
1393
|
+
};
|
|
1394
|
+
}
|
|
1395
|
+
return { lines: lines, end: end };
|
|
1396
|
+
};
|
|
1397
|
+
/*
|
|
1398
|
+
* A list: its items, each up to the next item of the same list (list
|
|
1399
|
+
* rule) - the last without the white space at its end, which the blocks
|
|
1400
|
+
* after the list read. Each item's lines are read again, as marked reads
|
|
1401
|
+
* them, without the bullet and indentation.
|
|
1402
|
+
*/
|
|
1403
|
+
const readList = (reading, at) => {
|
|
1404
|
+
const text = reading.level.text;
|
|
1405
|
+
const lineEnd = getLineEnd(text, at);
|
|
1406
|
+
const bullet = readBullet(text, skipUpToThreeSpaces(text, at));
|
|
1407
|
+
/*
|
|
1408
|
+
* The first item's bullet ends its line, or a space or a tab and more
|
|
1409
|
+
* come after it.
|
|
1410
|
+
*/
|
|
1411
|
+
if (bullet === null ||
|
|
1412
|
+
(bullet.end < lineEnd &&
|
|
1413
|
+
(!isSpaceOrTab(text.charCodeAt(bullet.end)) || bullet.end + 1 >= lineEnd))) {
|
|
1414
|
+
return -1;
|
|
1415
|
+
}
|
|
1416
|
+
const items = [];
|
|
1417
|
+
let itemsEnd = at;
|
|
1418
|
+
while (itemsEnd < text.length) {
|
|
1419
|
+
const item = readListItem(text, itemsEnd, bullet);
|
|
1420
|
+
if (item === null) {
|
|
1421
|
+
break;
|
|
1422
|
+
}
|
|
1423
|
+
items.push(item.lines);
|
|
1424
|
+
itemsEnd = item.end;
|
|
1425
|
+
}
|
|
1426
|
+
let end = itemsEnd;
|
|
1427
|
+
while (end > at && (0, RegExpCharacterClasses_1.isWhiteSpaceCode)(text.charCodeAt(end - 1))) {
|
|
1428
|
+
end--;
|
|
1429
|
+
}
|
|
1430
|
+
// The last item without the white space at its end.
|
|
1431
|
+
const last = items[items.length - 1];
|
|
1432
|
+
while (last.length > 0) {
|
|
1433
|
+
const line = last[last.length - 1];
|
|
1434
|
+
let to = line.to;
|
|
1435
|
+
while (to > line.from && (0, RegExpCharacterClasses_1.isWhiteSpaceCode)(text.charCodeAt(to - 1))) {
|
|
1436
|
+
to--;
|
|
1437
|
+
}
|
|
1438
|
+
if (to > line.from) {
|
|
1439
|
+
last[last.length - 1] = { lead: line.lead, from: line.from, to: to };
|
|
1440
|
+
break;
|
|
1441
|
+
}
|
|
1442
|
+
last.pop();
|
|
1443
|
+
}
|
|
1444
|
+
if (reading.level.depth < exports.MAX_DEFINITION_NESTING_DEPTH) {
|
|
1445
|
+
for (const lines of items) {
|
|
1446
|
+
if (lines.length > 0 &&
|
|
1447
|
+
holdsDefinitionColon(reading, lines[0].from, lines[lines.length - 1].to)) {
|
|
1448
|
+
readBlocks(makeLevel(reading.level, lines, reading.level.depth + 1, false), false, reading.definitions);
|
|
1449
|
+
}
|
|
1450
|
+
}
|
|
1451
|
+
}
|
|
1452
|
+
return end;
|
|
1453
|
+
};
|
|
1454
|
+
/*
|
|
1455
|
+
* After the line breaks after text[found, found + length), or the end of
|
|
1456
|
+
* the text when `found` is -1: the end of an HTML block of the third to
|
|
1457
|
+
* fifth kind, which can end inside its line.
|
|
1458
|
+
*/
|
|
1459
|
+
const afterAndLineBreaks = (text, found, length) => {
|
|
1460
|
+
return found === -1 ? text.length : skipLineBreaks(text, found + length);
|
|
1461
|
+
};
|
|
1462
|
+
// After a line of the text from `at` that is spaces and tabs alone.
|
|
1463
|
+
const isRestOfLineBlank = (text, at) => {
|
|
1464
|
+
let end = at;
|
|
1465
|
+
while (isSpaceOrTab(text.charCodeAt(end))) {
|
|
1466
|
+
end++;
|
|
1467
|
+
}
|
|
1468
|
+
return end >= text.length || text.charCodeAt(end) === LINE_FEED;
|
|
1469
|
+
};
|
|
1470
|
+
/*
|
|
1471
|
+
* After a tag's name - a letter, then letters, digits, "_" and "-" - at
|
|
1472
|
+
* `at`, or -1 when no name starts there.
|
|
1473
|
+
*/
|
|
1474
|
+
const readTagName = (text, at) => {
|
|
1475
|
+
if (!(0, RegExpCharacterClasses_1.isAsciiLetterCode)(text.charCodeAt(at))) {
|
|
1476
|
+
return -1;
|
|
1477
|
+
}
|
|
1478
|
+
let end = at + 1;
|
|
1479
|
+
while ((0, RegExpCharacterClasses_1.isWordCode)(text.charCodeAt(end)) || text.charCodeAt(end) === DASH) {
|
|
1480
|
+
end++;
|
|
1481
|
+
}
|
|
1482
|
+
return end;
|
|
1483
|
+
};
|
|
1484
|
+
/*
|
|
1485
|
+
* After an attribute's value at `at` - in double quotes, in single quotes,
|
|
1486
|
+
* on its line, or characters that are none of white space, quotes, "=",
|
|
1487
|
+
* "<", ">" and "`" - or -1 when none is there.
|
|
1488
|
+
*/
|
|
1489
|
+
const readAttributeValue = (text, at) => {
|
|
1490
|
+
const opening = text.charCodeAt(at);
|
|
1491
|
+
if (opening === DOUBLE_QUOTE || opening === SINGLE_QUOTE) {
|
|
1492
|
+
for (let index = at + 1; index < text.length; index++) {
|
|
1493
|
+
const code = text.charCodeAt(index);
|
|
1494
|
+
if (code === opening) {
|
|
1495
|
+
return index + 1;
|
|
1496
|
+
}
|
|
1497
|
+
if (code === LINE_FEED) {
|
|
1498
|
+
return -1;
|
|
1499
|
+
}
|
|
1500
|
+
}
|
|
1501
|
+
return -1;
|
|
1502
|
+
}
|
|
1503
|
+
let end = at;
|
|
1504
|
+
while (end < text.length) {
|
|
1505
|
+
const code = text.charCodeAt(end);
|
|
1506
|
+
if ((0, RegExpCharacterClasses_1.isWhiteSpaceCode)(code) ||
|
|
1507
|
+
code === DOUBLE_QUOTE ||
|
|
1508
|
+
code === SINGLE_QUOTE ||
|
|
1509
|
+
code === EQUALS ||
|
|
1510
|
+
code === LESS_THAN ||
|
|
1511
|
+
code === GREATER_THAN ||
|
|
1512
|
+
code === BACKTICK) {
|
|
1513
|
+
break;
|
|
1514
|
+
}
|
|
1515
|
+
end++;
|
|
1516
|
+
}
|
|
1517
|
+
return end > at ? end : -1;
|
|
1518
|
+
};
|
|
1519
|
+
/*
|
|
1520
|
+
* After a whole open or closing tag at "<" that only spaces and tabs
|
|
1521
|
+
* follow on its line - an HTML block of marked's seventh kind - or -1. Its
|
|
1522
|
+
* name starts with none of "script", "pre", "style" and "textarea".
|
|
1523
|
+
*/
|
|
1524
|
+
const readWholeTag = (text, open) => {
|
|
1525
|
+
const isClosing = text.charCodeAt(open + 1) === SLASH;
|
|
1526
|
+
const name = open + (isClosing ? 2 : 1);
|
|
1527
|
+
if (startsWithAny(text, name, RAW_TEXT_TAG_NAMES, true) !== null) {
|
|
1528
|
+
return -1;
|
|
1529
|
+
}
|
|
1530
|
+
let end = readTagName(text, name);
|
|
1531
|
+
if (end === -1) {
|
|
1532
|
+
return -1;
|
|
1533
|
+
}
|
|
1534
|
+
if (isClosing) {
|
|
1535
|
+
while (end < text.length && (0, RegExpCharacterClasses_1.isWhiteSpaceCode)(text.charCodeAt(end))) {
|
|
1536
|
+
end++;
|
|
1537
|
+
}
|
|
1538
|
+
return text.charCodeAt(end) === GREATER_THAN &&
|
|
1539
|
+
isRestOfLineBlank(text, end + 1)
|
|
1540
|
+
? end + 1
|
|
1541
|
+
: -1;
|
|
1542
|
+
}
|
|
1543
|
+
// Attributes: spaces, a name, and perhaps "=" and a value.
|
|
1544
|
+
for (;;) {
|
|
1545
|
+
const attribute = skipSpaces(text, end);
|
|
1546
|
+
const code = text.charCodeAt(attribute);
|
|
1547
|
+
if (attribute === end ||
|
|
1548
|
+
!((0, RegExpCharacterClasses_1.isAsciiLetterCode)(code) || code === COLON || code === UNDERSCORE)) {
|
|
1549
|
+
break;
|
|
1550
|
+
}
|
|
1551
|
+
end = attribute + 1;
|
|
1552
|
+
while ((0, RegExpCharacterClasses_1.isWordCode)(text.charCodeAt(end)) ||
|
|
1553
|
+
text.charCodeAt(end) === DOT ||
|
|
1554
|
+
text.charCodeAt(end) === COLON ||
|
|
1555
|
+
text.charCodeAt(end) === DASH) {
|
|
1556
|
+
end++;
|
|
1557
|
+
}
|
|
1558
|
+
const equals = skipSpaces(text, end);
|
|
1559
|
+
if (text.charCodeAt(equals) === EQUALS) {
|
|
1560
|
+
// An "=" no value follows can be read no other way.
|
|
1561
|
+
end = readAttributeValue(text, skipSpaces(text, equals + 1));
|
|
1562
|
+
if (end === -1) {
|
|
1563
|
+
return -1;
|
|
1564
|
+
}
|
|
1565
|
+
}
|
|
1566
|
+
}
|
|
1567
|
+
let close = skipSpaces(text, end);
|
|
1568
|
+
if (text.charCodeAt(close) === SLASH) {
|
|
1569
|
+
close++;
|
|
1570
|
+
}
|
|
1571
|
+
return text.charCodeAt(close) === GREATER_THAN &&
|
|
1572
|
+
isRestOfLineBlank(text, close + 1)
|
|
1573
|
+
? close + 1
|
|
1574
|
+
: -1;
|
|
1575
|
+
};
|
|
1576
|
+
/*
|
|
1577
|
+
* After the blank line that ends an HTML block of the sixth or seventh kind
|
|
1578
|
+
* from `from` - and the lines of spaces alone after it - or the end of the
|
|
1579
|
+
* text.
|
|
1580
|
+
*/
|
|
1581
|
+
const readHtmlBlockEnd = (reading, from) => {
|
|
1582
|
+
const text = reading.level.text;
|
|
1583
|
+
let end = reading.nextBlankLineBreak(from);
|
|
1584
|
+
if (end === -1) {
|
|
1585
|
+
return text.length;
|
|
1586
|
+
}
|
|
1587
|
+
for (;;) {
|
|
1588
|
+
const next = skipSpaces(text, end + 1);
|
|
1589
|
+
if (text.charCodeAt(next) !== LINE_FEED) {
|
|
1590
|
+
return end + 1;
|
|
1591
|
+
}
|
|
1592
|
+
end = next;
|
|
1593
|
+
}
|
|
1594
|
+
};
|
|
1595
|
+
/*
|
|
1596
|
+
* An HTML block (html rule), of the first of its kinds that starts at
|
|
1597
|
+
* `at`: <script>, <pre>, <style> or <textarea> to the line of its closing
|
|
1598
|
+
* tag; a comment, to the line of its "-->"; "<?" to "?>"; "<!" and a letter
|
|
1599
|
+
* to ">"; "<![CDATA[" to "]]>"; a block tag, or a whole tag alone on its
|
|
1600
|
+
* line, to a blank line. Each runs to the end of the text when what ends it
|
|
1601
|
+
* is not there.
|
|
1602
|
+
*/
|
|
1603
|
+
const readHtml = (reading, at) => {
|
|
1604
|
+
const text = reading.level.text;
|
|
1605
|
+
const open = skipUpToThreeSpaces(text, at);
|
|
1606
|
+
if (text.charCodeAt(open) !== LESS_THAN) {
|
|
1607
|
+
return -1;
|
|
1608
|
+
}
|
|
1609
|
+
const name = open + 1;
|
|
1610
|
+
const rawTextTag = startsWithAny(text, name, RAW_TEXT_TAG_NAMES, true);
|
|
1611
|
+
const afterRawTextTag = rawTextTag === null ? -1 : text.charCodeAt(name + rawTextTag.length);
|
|
1612
|
+
if (rawTextTag !== null &&
|
|
1613
|
+
(afterRawTextTag === GREATER_THAN || (0, RegExpCharacterClasses_1.isWhiteSpaceCode)(afterRawTextTag))) {
|
|
1614
|
+
// The first closing tag on a line a line break ends.
|
|
1615
|
+
for (let close = text.indexOf("</", name + rawTextTag.length + 1); close !== -1; close = text.indexOf("</", close + 1)) {
|
|
1616
|
+
const tagEnd = close + 2 + rawTextTag.length;
|
|
1617
|
+
if (text.slice(close + 2, tagEnd).toLowerCase() === rawTextTag &&
|
|
1618
|
+
text.charCodeAt(tagEnd) === GREATER_THAN) {
|
|
1619
|
+
const lineEnd = getLineEnd(text, tagEnd);
|
|
1620
|
+
return lineEnd >= text.length
|
|
1621
|
+
? text.length
|
|
1622
|
+
: skipLineBreaks(text, lineEnd);
|
|
1623
|
+
}
|
|
1624
|
+
}
|
|
1625
|
+
return text.length;
|
|
1626
|
+
}
|
|
1627
|
+
if (text.startsWith("!--", name)) {
|
|
1628
|
+
const afterOpening = name + 3;
|
|
1629
|
+
let close = afterOpening + 1;
|
|
1630
|
+
if (text.charCodeAt(afterOpening) === DASH) {
|
|
1631
|
+
close = afterOpening + 2;
|
|
1632
|
+
}
|
|
1633
|
+
if (text.charCodeAt(close - 1) !== GREATER_THAN) {
|
|
1634
|
+
const found = text.indexOf("-->", afterOpening);
|
|
1635
|
+
close = found === -1 ? text.length : found + 3;
|
|
1636
|
+
}
|
|
1637
|
+
const lineEnd = getLineEnd(text, close);
|
|
1638
|
+
return lineEnd >= text.length ? text.length : skipLineBreaks(text, lineEnd);
|
|
1639
|
+
}
|
|
1640
|
+
if (text.charCodeAt(name) === QUESTION_MARK) {
|
|
1641
|
+
return afterAndLineBreaks(text, text.indexOf("?>", name + 1), 2);
|
|
1642
|
+
}
|
|
1643
|
+
if (text.charCodeAt(name) === EXCLAMATION_MARK &&
|
|
1644
|
+
(0, RegExpCharacterClasses_1.isAsciiLetterCode)(text.charCodeAt(name + 1))) {
|
|
1645
|
+
return afterAndLineBreaks(text, text.indexOf(">", name + 2), 1);
|
|
1646
|
+
}
|
|
1647
|
+
if (text.slice(name, name + 8).toUpperCase() === "![CDATA[") {
|
|
1648
|
+
return afterAndLineBreaks(text, text.indexOf("]]>", name + 8), 3);
|
|
1649
|
+
}
|
|
1650
|
+
const afterBlockTag = readBlockTag(text, open, true);
|
|
1651
|
+
if (afterBlockTag !== -1) {
|
|
1652
|
+
return readHtmlBlockEnd(reading, afterBlockTag);
|
|
1653
|
+
}
|
|
1654
|
+
const afterWholeTag = readWholeTag(text, open);
|
|
1655
|
+
return afterWholeTag === -1 ? -1 : readHtmlBlockEnd(reading, afterWholeTag);
|
|
1656
|
+
};
|
|
1657
|
+
/*
|
|
1658
|
+
* A GFM table (table rule): a header row, a delimiter row with a pipe or a
|
|
1659
|
+
* colon and as many cells, then the rows up to a line that is none -
|
|
1660
|
+
* blank, or what starts another block - and the line breaks after them.
|
|
1661
|
+
*/
|
|
1662
|
+
const readTable = (reading, at, lineEnd) => {
|
|
1663
|
+
const text = reading.level.text;
|
|
1664
|
+
if (!startsTable(reading, at, lineEnd)) {
|
|
1665
|
+
return -1;
|
|
1666
|
+
}
|
|
1667
|
+
const delimiterEnd = getLineEnd(text, lineEnd + 1);
|
|
1668
|
+
const delimiter = readDelimiterRow(text, lineEnd + 1, delimiterEnd);
|
|
1669
|
+
if (!delimiter.holdsPipeOrColon ||
|
|
1670
|
+
delimiter.cells !== countHeaderCells(text, skipSpaces(text, at), lineEnd)) {
|
|
1671
|
+
return -1;
|
|
1672
|
+
}
|
|
1673
|
+
let rowStart = nextLineStart(text, delimiterEnd);
|
|
1674
|
+
while (rowStart < text.length) {
|
|
1675
|
+
const rowEnd = getLineEnd(text, rowStart);
|
|
1676
|
+
const first = skipSpaces(text, rowStart);
|
|
1677
|
+
if (
|
|
1678
|
+
// Spaces alone, a line break after them.
|
|
1679
|
+
(first === rowEnd && rowEnd < text.length) ||
|
|
1680
|
+
isThematicBreak(text, rowStart, rowEnd) ||
|
|
1681
|
+
startsAtxHeading(text, rowStart) ||
|
|
1682
|
+
startsBlockQuote(text, rowStart) ||
|
|
1683
|
+
// Four spaces, and anything after them.
|
|
1684
|
+
(first - rowStart >= 4 && rowStart + 4 < rowEnd) ||
|
|
1685
|
+
(rowEnd < text.length &&
|
|
1686
|
+
getOpeningFence(text, rowStart, rowEnd) !== null) ||
|
|
1687
|
+
startsListInParagraph(text, rowStart) ||
|
|
1688
|
+
startsHtmlInParagraph(text, rowStart) ||
|
|
1689
|
+
findSeparator(reading, rowStart, rowEnd) !== -1) {
|
|
1690
|
+
break;
|
|
1691
|
+
}
|
|
1692
|
+
rowStart = nextLineStart(text, rowEnd);
|
|
1693
|
+
}
|
|
1694
|
+
return skipLineBreaks(text, rowStart);
|
|
1695
|
+
};
|
|
1696
|
+
/*
|
|
1697
|
+
* A setext heading (lheading rule): lines up to the first underline of "="
|
|
1698
|
+
* or "-" - unless a line it cannot run over, or a line or paragraph
|
|
1699
|
+
* separator, comes first.
|
|
1700
|
+
*/
|
|
1701
|
+
const readSetextHeading = (reading, at) => {
|
|
1702
|
+
if (reading.setextFrom < at && at <= reading.setextStop) {
|
|
1703
|
+
return -1;
|
|
1704
|
+
}
|
|
1705
|
+
const text = reading.level.text;
|
|
1706
|
+
if (breaksSetextHeading(text, at, true)) {
|
|
1707
|
+
return -1;
|
|
1708
|
+
}
|
|
1709
|
+
for (let lineStart = at;;) {
|
|
1710
|
+
const lineEnd = getLineEnd(text, lineStart);
|
|
1711
|
+
const separator = findSeparator(reading, lineStart, lineEnd);
|
|
1712
|
+
if (separator !== -1 || lineEnd >= text.length) {
|
|
1713
|
+
reading.setextFrom = at;
|
|
1714
|
+
reading.setextStop = separator === -1 ? text.length : separator;
|
|
1715
|
+
return -1;
|
|
1716
|
+
}
|
|
1717
|
+
if (isSetextUnderline(text, lineEnd + 1)) {
|
|
1718
|
+
return skipLineBreaks(text, getLineEnd(text, lineEnd + 1));
|
|
1719
|
+
}
|
|
1720
|
+
if (breaksSetextHeading(text, lineEnd + 1, false)) {
|
|
1721
|
+
reading.setextFrom = at;
|
|
1722
|
+
reading.setextStop = lineEnd;
|
|
1723
|
+
return -1;
|
|
1724
|
+
}
|
|
1725
|
+
lineStart = lineEnd + 1;
|
|
1726
|
+
}
|
|
1727
|
+
};
|
|
1728
|
+
/*
|
|
1729
|
+
* A paragraph whose first line ends at `lineEnd`: lines up to one that is
|
|
1730
|
+
* empty or ends it.
|
|
1731
|
+
*/
|
|
1732
|
+
const readParagraph = (reading, lineEnd) => {
|
|
1733
|
+
const text = reading.level.text;
|
|
1734
|
+
let end = lineEnd;
|
|
1735
|
+
while (end + 1 < text.length) {
|
|
1736
|
+
const next = end + 1;
|
|
1737
|
+
if (text.charCodeAt(next) === LINE_FEED ||
|
|
1738
|
+
endsParagraph(reading, next, true)) {
|
|
1739
|
+
break;
|
|
1740
|
+
}
|
|
1741
|
+
end = getLineEnd(text, next);
|
|
1742
|
+
}
|
|
1743
|
+
return end;
|
|
1744
|
+
};
|
|
1745
|
+
/*
|
|
1746
|
+
* A definition read at `blockStart` of a level, where it is in the whole
|
|
1747
|
+
* text: in a quote or a list item, with what marked reads of it there.
|
|
1748
|
+
*/
|
|
1749
|
+
const toWholeDefinition = (level, definition) => {
|
|
1750
|
+
const blockStart = definition.start;
|
|
1751
|
+
const startsLine = blockStart === 0 || level.text.charCodeAt(blockStart - 1) === LINE_FEED;
|
|
1752
|
+
const whole = {
|
|
1753
|
+
start: startsLine
|
|
1754
|
+
? getWholeLineStart(level, blockStart)
|
|
1755
|
+
: toWhole(level, blockStart),
|
|
1756
|
+
labelStart: toWhole(level, definition.labelStart),
|
|
1757
|
+
labelEnd: toWhole(level, definition.labelEnd),
|
|
1758
|
+
label: definition.label,
|
|
1759
|
+
destinationStart: toWhole(level, definition.destinationStart),
|
|
1760
|
+
destinationEnd: toWhole(level, definition.destinationEnd),
|
|
1761
|
+
end: toWhole(level, definition.end),
|
|
1762
|
+
};
|
|
1763
|
+
if (level.depth > 0) {
|
|
1764
|
+
whole.nested = {
|
|
1765
|
+
text: level.text.slice(blockStart, definition.end),
|
|
1766
|
+
labelStart: definition.labelStart - blockStart,
|
|
1767
|
+
labelEnd: definition.labelEnd - blockStart,
|
|
1768
|
+
destinationEnd: definition.destinationEnd - blockStart,
|
|
1769
|
+
};
|
|
1770
|
+
}
|
|
1771
|
+
return whole;
|
|
1772
|
+
};
|
|
1773
|
+
/*
|
|
1774
|
+
* Every definition marked reads in a level, read as its lexer reads the
|
|
1775
|
+
* level's blocks (blockTokens): `top` when its paragraphs run over lines -
|
|
1776
|
+
* the whole text, a quote, and a list item's lines after a list in it -
|
|
1777
|
+
* and not when each line is text of its own, as in a list item.
|
|
1778
|
+
*/
|
|
1779
|
+
const readBlocks = (level, top, definitions) => {
|
|
1780
|
+
const reading = startReading(level, definitions);
|
|
1781
|
+
const text = level.text;
|
|
1782
|
+
let isTop = top;
|
|
1783
|
+
// Whether the block before is a paragraph or text: a definition carries it on.
|
|
1784
|
+
let carriesOn = false;
|
|
1785
|
+
let at = 0;
|
|
1786
|
+
while (at < text.length) {
|
|
1787
|
+
// One line break joins the block before it; more end a paragraph.
|
|
1788
|
+
const spaceEnd = readSpace(text, at);
|
|
1789
|
+
if (spaceEnd > at) {
|
|
1790
|
+
carriesOn = carriesOn && spaceEnd - at === 1;
|
|
1791
|
+
at = spaceEnd;
|
|
1792
|
+
continue;
|
|
1793
|
+
}
|
|
1794
|
+
// Indented code carries on a paragraph, as a definition would.
|
|
1795
|
+
const codeEnd = readIndentedCode(text, at);
|
|
1796
|
+
if (codeEnd > at) {
|
|
1797
|
+
at = codeEnd;
|
|
1798
|
+
continue;
|
|
1799
|
+
}
|
|
1800
|
+
const lineEnd = getLineEnd(text, at);
|
|
1801
|
+
const fenceEnd = readFencedCode(text, at, lineEnd);
|
|
1802
|
+
if (fenceEnd !== -1) {
|
|
1803
|
+
carriesOn = false;
|
|
1804
|
+
at = fenceEnd;
|
|
1805
|
+
continue;
|
|
1806
|
+
}
|
|
1807
|
+
if (isAtxHeading(reading, at, lineEnd) ||
|
|
1808
|
+
isThematicBreak(text, at, lineEnd)) {
|
|
1809
|
+
carriesOn = false;
|
|
1810
|
+
at = nextLineStart(text, lineEnd);
|
|
1811
|
+
continue;
|
|
1812
|
+
}
|
|
1813
|
+
const quoteEnd = readBlockQuote(reading, at);
|
|
1814
|
+
if (quoteEnd !== -1) {
|
|
1815
|
+
carriesOn = false;
|
|
1816
|
+
at = quoteEnd;
|
|
1817
|
+
continue;
|
|
1818
|
+
}
|
|
1819
|
+
// After a list, marked reads paragraphs over lines (its items set "top").
|
|
1820
|
+
const listEnd = readList(reading, at);
|
|
1821
|
+
if (listEnd !== -1) {
|
|
1822
|
+
carriesOn = false;
|
|
1823
|
+
isTop = true;
|
|
1824
|
+
at = listEnd;
|
|
1825
|
+
continue;
|
|
1826
|
+
}
|
|
1827
|
+
const htmlEnd = readHtml(reading, at);
|
|
1828
|
+
if (htmlEnd !== -1) {
|
|
1829
|
+
carriesOn = false;
|
|
1830
|
+
at = htmlEnd;
|
|
1831
|
+
continue;
|
|
1832
|
+
}
|
|
1833
|
+
const definition = readDefinition(text, at, getFinders(reading));
|
|
1834
|
+
if (definition !== null) {
|
|
1835
|
+
if (!carriesOn) {
|
|
1836
|
+
definitions.push(toWholeDefinition(level, definition.definition));
|
|
1837
|
+
}
|
|
1838
|
+
at = definition.next;
|
|
1839
|
+
continue;
|
|
1840
|
+
}
|
|
1841
|
+
const tableEnd = readTable(reading, at, lineEnd);
|
|
1842
|
+
if (tableEnd !== -1) {
|
|
1843
|
+
carriesOn = false;
|
|
1844
|
+
at = tableEnd;
|
|
1845
|
+
continue;
|
|
1846
|
+
}
|
|
1847
|
+
const headingEnd = readSetextHeading(reading, at);
|
|
1848
|
+
if (headingEnd !== -1) {
|
|
1849
|
+
carriesOn = false;
|
|
1850
|
+
at = headingEnd;
|
|
1851
|
+
continue;
|
|
1852
|
+
}
|
|
1853
|
+
at = isTop ? readParagraph(reading, lineEnd) : lineEnd;
|
|
1854
|
+
carriesOn = true;
|
|
1855
|
+
}
|
|
1856
|
+
};
|
|
1857
|
+
/*
|
|
1858
|
+
* Every link reference definition marked reads in `text` (see the top of
|
|
1859
|
+
* this file), in the order of the text: a label defined twice, twice.
|
|
1860
|
+
*/
|
|
1861
|
+
const getLinkReferenceDefinitions = (text) => {
|
|
1862
|
+
const definitions = [];
|
|
1863
|
+
if (typeof text !== "string" || text.indexOf("]:") === -1) {
|
|
1864
|
+
return definitions;
|
|
1865
|
+
}
|
|
1866
|
+
readBlocks(getWholeLevel(text), true, definitions);
|
|
1867
|
+
return definitions;
|
|
1868
|
+
};
|
|
1869
|
+
exports.getLinkReferenceDefinitions = getLinkReferenceDefinitions;
|
|
1870
|
+
/*
|
|
1871
|
+
* Calls `found` with the label of every pair of brackets in text[start,
|
|
1872
|
+
* end) that holds no other, as a reference to a definition is written -
|
|
1873
|
+
* "[text][label]", "[label][]", "[label]", "![alt][label]" - normalized as
|
|
1874
|
+
* marked matches it (normalizeLinkLabel). More than the references marked
|
|
1875
|
+
* reads: a link's text, a bracket in code, a definition's own label. One
|
|
1876
|
+
* pass, whatever the text holds.
|
|
1877
|
+
*/
|
|
1878
|
+
const forEachBracketedLabel = (text, start, end, found) => {
|
|
1879
|
+
let open = -1;
|
|
1880
|
+
for (let index = start; index < end; index++) {
|
|
1881
|
+
const code = text.charCodeAt(index);
|
|
1882
|
+
if (code === BACKSLASH) {
|
|
1883
|
+
if (index + 1 < end &&
|
|
1884
|
+
!(0, RegExpCharacterClasses_1.isLineTerminatorCode)(text.charCodeAt(index + 1))) {
|
|
1885
|
+
index++;
|
|
1886
|
+
}
|
|
1887
|
+
continue;
|
|
1888
|
+
}
|
|
1889
|
+
if (code === OPEN_BRACKET) {
|
|
1890
|
+
open = index;
|
|
1891
|
+
continue;
|
|
1892
|
+
}
|
|
1893
|
+
if (code === CLOSE_BRACKET && open !== -1) {
|
|
1894
|
+
if (!isAllWhiteSpace(text, open + 1, index)) {
|
|
1895
|
+
found((0, exports.normalizeLinkLabel)(text.slice(open + 1, index)));
|
|
1896
|
+
}
|
|
1897
|
+
open = -1;
|
|
1898
|
+
}
|
|
1899
|
+
}
|
|
1900
|
+
};
|
|
1901
|
+
exports.forEachBracketedLabel = forEachBracketedLabel;
|