@cratis/screenplay-language 5.3.0 → 5.3.2

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.
Files changed (395) hide show
  1. package/dist/bundles/TypeReferenceSymbol.js.map +1 -1
  2. package/dist/bundles/action-subject-authoring.js.map +1 -1
  3. package/dist/bundles/bmp-word-characters.js.map +1 -1
  4. package/dist/bundles/case-authoring.js +1 -1
  5. package/dist/bundles/case-authoring.js.map +1 -1
  6. package/dist/bundles/code-actions.js.map +1 -1
  7. package/dist/bundles/command-read-completions.js.map +1 -1
  8. package/dist/bundles/compiler/Authoring/ActionSubjectQuickFixes.js +3 -3
  9. package/dist/bundles/compiler/Authoring/ActionSubjectQuickFixes.js.map +1 -1
  10. package/dist/bundles/compiler/Authoring/QuickFixes.js +4 -4
  11. package/dist/bundles/compiler/Authoring/QuickFixes.js.map +1 -1
  12. package/dist/bundles/compiler/Authoring/StructuredValueQuickFix.js +1 -1
  13. package/dist/bundles/compiler/Authoring/StructuredValueQuickFix.js.map +1 -1
  14. package/dist/bundles/compiler/Authoring/TimelineQuickFixContext.js +4 -4
  15. package/dist/bundles/compiler/Authoring/TimelineQuickFixContext.js.map +1 -1
  16. package/dist/bundles/compiler/Authoring/TimelineQuickFixImports.js +2 -2
  17. package/dist/bundles/compiler/Authoring/TimelineQuickFixImports.js.map +1 -1
  18. package/dist/bundles/compiler/Authoring/TimelineQuickFixes.js +1 -1
  19. package/dist/bundles/compiler/Authoring/TimelineQuickFixes.js.map +1 -1
  20. package/dist/bundles/compiler/Dependencies/DeclaredDependencies.js.map +1 -1
  21. package/dist/bundles/compiler/Dependencies/DeclaredDependencyTargets.js.map +1 -1
  22. package/dist/bundles/compiler/Dependencies/DependencyGraph.js +1 -1
  23. package/dist/bundles/compiler/Dependencies/DependencyGraph.js.map +1 -1
  24. package/dist/bundles/compiler/Dependencies/DependencyKind.js.map +1 -1
  25. package/dist/bundles/compiler/Dependencies/InvalidDependencyQuery.js.map +1 -1
  26. package/dist/bundles/compiler/Dependencies/SliceReferences.js.map +1 -1
  27. package/dist/bundles/compiler/Dependencies/StronglyConnectedGroups.js.map +1 -1
  28. package/dist/bundles/compiler/Diagnostics/DiagnosticArgument.js.map +1 -1
  29. package/dist/bundles/compiler/Diagnostics/DiagnosticCodes.js +1 -1
  30. package/dist/bundles/compiler/Diagnostics/DiagnosticCodes.js.map +1 -1
  31. package/dist/bundles/compiler/Diagnostics/ProductionDestinationDiagnostics.js +1 -1
  32. package/dist/bundles/compiler/Diagnostics/ProductionDestinationDiagnostics.js.map +1 -1
  33. package/dist/bundles/compiler/Diagnostics/SourceLocation.js.map +1 -1
  34. package/dist/bundles/compiler/Files/AuthoredOrder.js +1 -1
  35. package/dist/bundles/compiler/Files/AuthoredOrder.js.map +1 -1
  36. package/dist/bundles/compiler/Files/OrderingRoot.js +1 -1
  37. package/dist/bundles/compiler/Files/OrderingRoot.js.map +1 -1
  38. package/dist/bundles/compiler/Files/PlayApplicationAssembly.js +1 -1
  39. package/dist/bundles/compiler/Files/PlayApplicationAssembly.js.map +1 -1
  40. package/dist/bundles/compiler/Files/PlayDocumentSource.js.map +1 -1
  41. package/dist/bundles/compiler/Files/PlayFolderMerge.js +1 -1
  42. package/dist/bundles/compiler/Files/PlayFolderMerge.js.map +1 -1
  43. package/dist/bundles/compiler/Files/PlayGlob.js +2 -1
  44. package/dist/bundles/compiler/Files/PlayGlob.js.map +1 -1
  45. package/dist/bundles/compiler/Files/PlayImports.js +1 -1
  46. package/dist/bundles/compiler/Files/PlayImports.js.map +1 -1
  47. package/dist/bundles/compiler/Files/PlayPlacement.js.map +1 -1
  48. package/dist/bundles/compiler/Files/TimelineOrder.js +1 -1
  49. package/dist/bundles/compiler/Files/TimelineOrder.js.map +1 -1
  50. package/dist/bundles/compiler/Generation/FiniteGenerationRules.js +1 -1
  51. package/dist/bundles/compiler/Generation/GenerationAssessmentCache.js.map +1 -1
  52. package/dist/bundles/compiler/Generation/GenerationChecksum.js.map +1 -1
  53. package/dist/bundles/compiler/Generation/GenerationPattern.js +1 -1
  54. package/dist/bundles/compiler/Generation/GenerationPattern.js.map +1 -1
  55. package/dist/bundles/compiler/Generation/GenerationPatternAssessment.js.map +1 -1
  56. package/dist/bundles/compiler/Generation/GenerationPatternParser.js.map +1 -1
  57. package/dist/bundles/compiler/Generation/GenerationPatternToken.js.map +1 -1
  58. package/dist/bundles/compiler/Generation/GenerationRuleProof.js +1 -1
  59. package/dist/bundles/compiler/Generation/InvalidGenerationPattern.js.map +1 -1
  60. package/dist/bundles/compiler/Generation/RegexCharacters.js.map +1 -1
  61. package/dist/bundles/compiler/Generation/RegexExpression.js.map +1 -1
  62. package/dist/bundles/compiler/Generation/RuleConsistency.js +1 -1
  63. package/dist/bundles/compiler/Parsing/ActionSubjectClause.js.map +1 -1
  64. package/dist/bundles/compiler/Parsing/ActionSubjectInputs.js.map +1 -1
  65. package/dist/bundles/compiler/Parsing/ActionSubjectResolution.js.map +1 -1
  66. package/dist/bundles/compiler/Parsing/ApplicationContextParser.js +1 -1
  67. package/dist/bundles/compiler/Parsing/ApplicationContextParser.js.map +1 -1
  68. package/dist/bundles/compiler/Parsing/AuthorizeParser.js +1 -1
  69. package/dist/bundles/compiler/Parsing/AuthorizeParser.js.map +1 -1
  70. package/dist/bundles/compiler/Parsing/CanvasPlacement.js.map +1 -1
  71. package/dist/bundles/compiler/Parsing/CaptureEventFixturesValidator.js.map +1 -1
  72. package/dist/bundles/compiler/Parsing/CaptureParser.js +1 -1
  73. package/dist/bundles/compiler/Parsing/CaptureParser.js.map +1 -1
  74. package/dist/bundles/compiler/Parsing/ClockOperandParser.js.map +1 -1
  75. package/dist/bundles/compiler/Parsing/CodeBlockParser.js.map +1 -1
  76. package/dist/bundles/compiler/Parsing/CommandDestinationTypes.js.map +1 -1
  77. package/dist/bundles/compiler/Parsing/CommandHandlerValidator.js.map +1 -1
  78. package/dist/bundles/compiler/Parsing/CommandParser.js +1 -1
  79. package/dist/bundles/compiler/Parsing/CommandParser.js.map +1 -1
  80. package/dist/bundles/compiler/Parsing/CommandReadSources.js.map +1 -1
  81. package/dist/bundles/compiler/Parsing/CommandResponseParser.js +1 -1
  82. package/dist/bundles/compiler/Parsing/CommandResponseParser.js.map +1 -1
  83. package/dist/bundles/compiler/Parsing/CommandStreamCandidates.js.map +1 -1
  84. package/dist/bundles/compiler/Parsing/CompositeStreamIdValidator.js.map +1 -1
  85. package/dist/bundles/compiler/Parsing/CompositionParser.js +1 -1
  86. package/dist/bundles/compiler/Parsing/CompositionParser.js.map +1 -1
  87. package/dist/bundles/compiler/Parsing/ConceptComplianceParser.js +1 -1
  88. package/dist/bundles/compiler/Parsing/ConceptComplianceParser.js.map +1 -1
  89. package/dist/bundles/compiler/Parsing/ConditionDepthBudget.js +2 -0
  90. package/dist/bundles/compiler/Parsing/ConditionDepthBudget.js.map +1 -0
  91. package/dist/bundles/compiler/Parsing/ConditionParser.js +1 -1
  92. package/dist/bundles/compiler/Parsing/ConditionParser.js.map +1 -1
  93. package/dist/bundles/compiler/Parsing/ConstraintParser.js +1 -1
  94. package/dist/bundles/compiler/Parsing/ConstraintParser.js.map +1 -1
  95. package/dist/bundles/compiler/Parsing/ConstraintPropertyValidator.js +1 -1
  96. package/dist/bundles/compiler/Parsing/ConstraintPropertyValidator.js.map +1 -1
  97. package/dist/bundles/compiler/Parsing/ContinuationValues.js.map +1 -1
  98. package/dist/bundles/compiler/Parsing/DeclarationParsers.js +1 -1
  99. package/dist/bundles/compiler/Parsing/DeclarationParsers.js.map +1 -1
  100. package/dist/bundles/compiler/Parsing/DependencySourceParser.js +1 -1
  101. package/dist/bundles/compiler/Parsing/DependencySourceParser.js.map +1 -1
  102. package/dist/bundles/compiler/Parsing/DependsOnParser.js.map +1 -1
  103. package/dist/bundles/compiler/Parsing/DescriptionParser.js +1 -1
  104. package/dist/bundles/compiler/Parsing/DescriptionParser.js.map +1 -1
  105. package/dist/bundles/compiler/Parsing/DocumentationParser.js +1 -1
  106. package/dist/bundles/compiler/Parsing/DocumentationParser.js.map +1 -1
  107. package/dist/bundles/compiler/Parsing/EnumerationMembers.js +1 -1
  108. package/dist/bundles/compiler/Parsing/EnumerationMembers.js.map +1 -1
  109. package/dist/bundles/compiler/Parsing/EventMetadataParser.js +1 -1
  110. package/dist/bundles/compiler/Parsing/EventMetadataParser.js.map +1 -1
  111. package/dist/bundles/compiler/Parsing/EventSourceParser.js +1 -1
  112. package/dist/bundles/compiler/Parsing/EventSourceParser.js.map +1 -1
  113. package/dist/bundles/compiler/Parsing/EventSourceValidator.js +1 -1
  114. package/dist/bundles/compiler/Parsing/EventSourceValidator.js.map +1 -1
  115. package/dist/bundles/compiler/Parsing/EventSubjectValidator.js +1 -1
  116. package/dist/bundles/compiler/Parsing/EventSubjectValidator.js.map +1 -1
  117. package/dist/bundles/compiler/Parsing/ExpressionParser.js +1 -1
  118. package/dist/bundles/compiler/Parsing/ExpressionParser.js.map +1 -1
  119. package/dist/bundles/compiler/Parsing/FeatureBody.js +1 -1
  120. package/dist/bundles/compiler/Parsing/FeatureBody.js.map +1 -1
  121. package/dist/bundles/compiler/Parsing/FileImportParser.js.map +1 -1
  122. package/dist/bundles/compiler/Parsing/FileReferences.js.map +1 -1
  123. package/dist/bundles/compiler/Parsing/FoldedEventSources.js.map +1 -1
  124. package/dist/bundles/compiler/Parsing/GenerationBodyParser.js +1 -1
  125. package/dist/bundles/compiler/Parsing/GenerationBodyParser.js.map +1 -1
  126. package/dist/bundles/compiler/Parsing/GenerationParser.js +1 -1
  127. package/dist/bundles/compiler/Parsing/GenerationParser.js.map +1 -1
  128. package/dist/bundles/compiler/Parsing/GuardedActionInputs.js.map +1 -1
  129. package/dist/bundles/compiler/Parsing/GuardedActionParser.js +1 -1
  130. package/dist/bundles/compiler/Parsing/GuardedActionParser.js.map +1 -1
  131. package/dist/bundles/compiler/Parsing/GuardedActionShadowing.js.map +1 -1
  132. package/dist/bundles/compiler/Parsing/GuardedActionValidator.js +1 -1
  133. package/dist/bundles/compiler/Parsing/GuardedActionValidator.js.map +1 -1
  134. package/dist/bundles/compiler/Parsing/GuardedInteractions.js +1 -1
  135. package/dist/bundles/compiler/Parsing/GuardedInteractions.js.map +1 -1
  136. package/dist/bundles/compiler/Parsing/IdentifierComplianceValidator.js +1 -1
  137. package/dist/bundles/compiler/Parsing/IdentifierComplianceValidator.js.map +1 -1
  138. package/dist/bundles/compiler/Parsing/IdentityParser.js +1 -1
  139. package/dist/bundles/compiler/Parsing/IdentityParser.js.map +1 -1
  140. package/dist/bundles/compiler/Parsing/IdentityValidator.js.map +1 -1
  141. package/dist/bundles/compiler/Parsing/ImplementationParser.js +2 -2
  142. package/dist/bundles/compiler/Parsing/ImplementationParser.js.map +1 -1
  143. package/dist/bundles/compiler/Parsing/ImportDiscovery.js +1 -1
  144. package/dist/bundles/compiler/Parsing/ImportDiscovery.js.map +1 -1
  145. package/dist/bundles/compiler/Parsing/InlineEventValidator.js.map +1 -1
  146. package/dist/bundles/compiler/Parsing/InputUses.js +1 -1
  147. package/dist/bundles/compiler/Parsing/InputUses.js.map +1 -1
  148. package/dist/bundles/compiler/Parsing/InteractionAlternatives.js +1 -1
  149. package/dist/bundles/compiler/Parsing/InteractionAlternatives.js.map +1 -1
  150. package/dist/bundles/compiler/Parsing/InteractionExecutions.js +1 -1
  151. package/dist/bundles/compiler/Parsing/InteractionExecutions.js.map +1 -1
  152. package/dist/bundles/compiler/Parsing/LegacyTextRulePatterns.js.map +1 -1
  153. package/dist/bundles/compiler/Parsing/LineReader.js.map +1 -1
  154. package/dist/bundles/compiler/Parsing/LineText.js.map +1 -1
  155. package/dist/bundles/compiler/Parsing/MatchAmbiguity.js +1 -1
  156. package/dist/bundles/compiler/Parsing/MatchAmbiguity.js.map +1 -1
  157. package/dist/bundles/compiler/Parsing/MatchAmbiguityCharacters.js.map +1 -1
  158. package/dist/bundles/compiler/Parsing/MatchAmbiguityGraph.js.map +1 -1
  159. package/dist/bundles/compiler/Parsing/MatchAmbiguityParser.js.map +1 -1
  160. package/dist/bundles/compiler/Parsing/MatchOperandValidation.js +1 -1
  161. package/dist/bundles/compiler/Parsing/MatchOperandValidation.js.map +1 -1
  162. package/dist/bundles/compiler/Parsing/ModuleBody.js +1 -1
  163. package/dist/bundles/compiler/Parsing/ModuleBody.js.map +1 -1
  164. package/dist/bundles/compiler/Parsing/ObserverFilterParser.js +1 -1
  165. package/dist/bundles/compiler/Parsing/ObserverFilterParser.js.map +1 -1
  166. package/dist/bundles/compiler/Parsing/ObserverFilterValidator.js.map +1 -1
  167. package/dist/bundles/compiler/Parsing/OperationParser.js +1 -1
  168. package/dist/bundles/compiler/Parsing/OperationParser.js.map +1 -1
  169. package/dist/bundles/compiler/Parsing/OperationValidator.js +1 -1
  170. package/dist/bundles/compiler/Parsing/OperationValidator.js.map +1 -1
  171. package/dist/bundles/compiler/Parsing/ParserContext.js.map +1 -1
  172. package/dist/bundles/compiler/Parsing/PersonaCallerValidator.js.map +1 -1
  173. package/dist/bundles/compiler/Parsing/PolicyParser.js +1 -1
  174. package/dist/bundles/compiler/Parsing/PolicyParser.js.map +1 -1
  175. package/dist/bundles/compiler/Parsing/PortableMatchGroupName.js.map +1 -1
  176. package/dist/bundles/compiler/Parsing/PortableMatchPattern.js.map +1 -1
  177. package/dist/bundles/compiler/Parsing/PortableMatchSuggestions.js.map +1 -1
  178. package/dist/bundles/compiler/Parsing/PossibleEventsParser.js +1 -1
  179. package/dist/bundles/compiler/Parsing/PossibleEventsParser.js.map +1 -1
  180. package/dist/bundles/compiler/Parsing/ProducesParser.js +1 -1
  181. package/dist/bundles/compiler/Parsing/ProducesParser.js.map +1 -1
  182. package/dist/bundles/compiler/Parsing/ProjectionEventScopeValidator.js.map +1 -1
  183. package/dist/bundles/compiler/Parsing/ProjectionExpressionParser.js +1 -1
  184. package/dist/bundles/compiler/Parsing/ProjectionExpressionParser.js.map +1 -1
  185. package/dist/bundles/compiler/Parsing/ProjectionParser.js +1 -1
  186. package/dist/bundles/compiler/Parsing/ProjectionParser.js.map +1 -1
  187. package/dist/bundles/compiler/Parsing/ProjectionTargetValidator.js +1 -1
  188. package/dist/bundles/compiler/Parsing/ProjectionTargetValidator.js.map +1 -1
  189. package/dist/bundles/compiler/Parsing/PropertyLineParser.js +1 -1
  190. package/dist/bundles/compiler/Parsing/PropertyLineParser.js.map +1 -1
  191. package/dist/bundles/compiler/Parsing/PublicEventMetadataValidator.js +1 -1
  192. package/dist/bundles/compiler/Parsing/PublicEventMetadataValidator.js.map +1 -1
  193. package/dist/bundles/compiler/Parsing/PublicEventUsageCollector.js +1 -1
  194. package/dist/bundles/compiler/Parsing/PublicEventUsageCollector.js.map +1 -1
  195. package/dist/bundles/compiler/Parsing/PublicEventUsageValidator.js +1 -1
  196. package/dist/bundles/compiler/Parsing/PublicEventUsageValidator.js.map +1 -1
  197. package/dist/bundles/compiler/Parsing/PurposeParser.js +1 -1
  198. package/dist/bundles/compiler/Parsing/PurposeParser.js.map +1 -1
  199. package/dist/bundles/compiler/Parsing/PurposeValidator.js.map +1 -1
  200. package/dist/bundles/compiler/Parsing/QueryParser.js +1 -1
  201. package/dist/bundles/compiler/Parsing/QueryParser.js.map +1 -1
  202. package/dist/bundles/compiler/Parsing/ReactionIdentityParser.js +1 -1
  203. package/dist/bundles/compiler/Parsing/ReactionIdentityParser.js.map +1 -1
  204. package/dist/bundles/compiler/Parsing/ReactionParser.js +1 -1
  205. package/dist/bundles/compiler/Parsing/ReactionParser.js.map +1 -1
  206. package/dist/bundles/compiler/Parsing/ReactionRefusalValidator.js +1 -1
  207. package/dist/bundles/compiler/Parsing/ReactionRefusalValidator.js.map +1 -1
  208. package/dist/bundles/compiler/Parsing/ReadModelKeyValidator.js.map +1 -1
  209. package/dist/bundles/compiler/Parsing/ReadModelMemberTypeValidator.js.map +1 -1
  210. package/dist/bundles/compiler/Parsing/ReadsParser.js +1 -1
  211. package/dist/bundles/compiler/Parsing/ReadsParser.js.map +1 -1
  212. package/dist/bundles/compiler/Parsing/RedeliveryValues.js.map +1 -1
  213. package/dist/bundles/compiler/Parsing/RefusalDeclarations.js +1 -1
  214. package/dist/bundles/compiler/Parsing/RefusalDeclarations.js.map +1 -1
  215. package/dist/bundles/compiler/Parsing/RefusalValueWalker.js.map +1 -1
  216. package/dist/bundles/compiler/Parsing/ResponseCommandResolver.js.map +1 -1
  217. package/dist/bundles/compiler/Parsing/ResponseDateValues.js.map +1 -1
  218. package/dist/bundles/compiler/Parsing/ResponseValidator.js +1 -1
  219. package/dist/bundles/compiler/Parsing/ResponseValidator.js.map +1 -1
  220. package/dist/bundles/compiler/Parsing/ScreenParser.js +1 -1
  221. package/dist/bundles/compiler/Parsing/ScreenParser.js.map +1 -1
  222. package/dist/bundles/compiler/Parsing/ScreenplayParser.js +1 -1
  223. package/dist/bundles/compiler/Parsing/ScreenplayParser.js.map +1 -1
  224. package/dist/bundles/compiler/Parsing/SeedParser.js +1 -1
  225. package/dist/bundles/compiler/Parsing/SeedParser.js.map +1 -1
  226. package/dist/bundles/compiler/Parsing/SliceParser.js +1 -1
  227. package/dist/bundles/compiler/Parsing/SliceParser.js.map +1 -1
  228. package/dist/bundles/compiler/Parsing/SourceLine.js.map +1 -1
  229. package/dist/bundles/compiler/Parsing/SourceLineSplitter.js.map +1 -1
  230. package/dist/bundles/compiler/Parsing/SourceOptionsParser.js +1 -1
  231. package/dist/bundles/compiler/Parsing/SourceOptionsParser.js.map +1 -1
  232. package/dist/bundles/compiler/Parsing/SpecificationCaseParser.js +1 -1
  233. package/dist/bundles/compiler/Parsing/SpecificationCaseParser.js.map +1 -1
  234. package/dist/bundles/compiler/Parsing/SpecificationCaseValidator.js +1 -1
  235. package/dist/bundles/compiler/Parsing/SpecificationCaseValidator.js.map +1 -1
  236. package/dist/bundles/compiler/Parsing/SpecificationCommandExamples.js +1 -1
  237. package/dist/bundles/compiler/Parsing/SpecificationCommandExamples.js.map +1 -1
  238. package/dist/bundles/compiler/Parsing/SpecificationExampleParser.js +1 -1
  239. package/dist/bundles/compiler/Parsing/SpecificationExampleParser.js.map +1 -1
  240. package/dist/bundles/compiler/Parsing/SpecificationParser.js +1 -1
  241. package/dist/bundles/compiler/Parsing/SpecificationParser.js.map +1 -1
  242. package/dist/bundles/compiler/Parsing/SpecificationRedeliveryValidator.js +1 -1
  243. package/dist/bundles/compiler/Parsing/SpecificationRedeliveryValidator.js.map +1 -1
  244. package/dist/bundles/compiler/Parsing/SpecificationResponseParser.js +1 -1
  245. package/dist/bundles/compiler/Parsing/SpecificationResponseParser.js.map +1 -1
  246. package/dist/bundles/compiler/Parsing/SpecificationRouteComparison.js +1 -1
  247. package/dist/bundles/compiler/Parsing/SpecificationRouteComparison.js.map +1 -1
  248. package/dist/bundles/compiler/Parsing/SpecificationStreamValidator.js +1 -1
  249. package/dist/bundles/compiler/Parsing/SpecificationStreamValidator.js.map +1 -1
  250. package/dist/bundles/compiler/Parsing/StateMachineParser.js +1 -1
  251. package/dist/bundles/compiler/Parsing/StateMachineParser.js.map +1 -1
  252. package/dist/bundles/compiler/Parsing/StructuralInteractionSites.js.map +1 -1
  253. package/dist/bundles/compiler/Parsing/StructuredBlockParser.js +1 -1
  254. package/dist/bundles/compiler/Parsing/StructuredBlockParser.js.map +1 -1
  255. package/dist/bundles/compiler/Parsing/StructuredValueParser.js.map +1 -1
  256. package/dist/bundles/compiler/Parsing/TemplateReferenceText.js +1 -1
  257. package/dist/bundles/compiler/Parsing/TemplateReferenceText.js.map +1 -1
  258. package/dist/bundles/compiler/Parsing/TriggerDataParser.js +1 -1
  259. package/dist/bundles/compiler/Parsing/TriggerDataParser.js.map +1 -1
  260. package/dist/bundles/compiler/Parsing/UiBindingParser.js +1 -1
  261. package/dist/bundles/compiler/Parsing/UiBindingParser.js.map +1 -1
  262. package/dist/bundles/compiler/Parsing/UiProfileLegacyLayout.js +1 -1
  263. package/dist/bundles/compiler/Parsing/UiProfileLegacyLayout.js.map +1 -1
  264. package/dist/bundles/compiler/Parsing/WorkflowParser.js +1 -1
  265. package/dist/bundles/compiler/Parsing/WorkflowParser.js.map +1 -1
  266. package/dist/bundles/compiler/Parsing/checkPortableMatchPattern.js.map +1 -1
  267. package/dist/bundles/compiler/Parsing/hasExponentialMatchAmbiguity.js.map +1 -1
  268. package/dist/bundles/compiler/Parsing/trimMatchAmbiguityGraph.js.map +1 -1
  269. package/dist/bundles/compiler/ScreenActionSubjects.js.map +1 -1
  270. package/dist/bundles/compiler/ScreenplayCompiler.js +1 -1
  271. package/dist/bundles/compiler/ScreenplayCompiler.js.map +1 -1
  272. package/dist/bundles/compiler/Syntax/ActionSubjectInvariants.js.map +1 -1
  273. package/dist/bundles/compiler/Syntax/AuthoringProductionResolver.js.map +1 -1
  274. package/dist/bundles/compiler/Syntax/CaptureEventsSource.js.map +1 -1
  275. package/dist/bundles/compiler/Syntax/DependencySources.js.map +1 -1
  276. package/dist/bundles/compiler/Syntax/EventDeclarations.js.map +1 -1
  277. package/dist/bundles/compiler/Syntax/EventSourceCatalog.js.map +1 -1
  278. package/dist/bundles/compiler/Syntax/EventSourceReadConfidence.js.map +1 -1
  279. package/dist/bundles/compiler/Syntax/ExactMathFacts.js.map +1 -1
  280. package/dist/bundles/compiler/Syntax/ExactNumber.js.map +1 -1
  281. package/dist/bundles/compiler/Syntax/InvalidSyntaxJson.js.map +1 -1
  282. package/dist/bundles/compiler/Syntax/LegacyWireProjection.js.map +1 -1
  283. package/dist/bundles/compiler/Syntax/Operations.js.map +1 -1
  284. package/dist/bundles/compiler/Syntax/PersonaCallers.js.map +1 -1
  285. package/dist/bundles/compiler/Syntax/ProductionDestinations.js.map +1 -1
  286. package/dist/bundles/compiler/Syntax/PublicEventInvariants.js.map +1 -1
  287. package/dist/bundles/compiler/Syntax/ScreenplaySyntaxWalker.js.map +1 -1
  288. package/dist/bundles/compiler/Syntax/SourceOptions.js.map +1 -1
  289. package/dist/bundles/compiler/Syntax/SpecificationCaseOrigin.js.map +1 -1
  290. package/dist/bundles/compiler/Syntax/StreamIdFormatter.js.map +1 -1
  291. package/dist/bundles/compiler/Syntax/StrictSyntaxJson.js +1 -1
  292. package/dist/bundles/compiler/Syntax/Structure.js.map +1 -1
  293. package/dist/bundles/compiler/Syntax/SyntaxCollections.js.map +1 -1
  294. package/dist/bundles/compiler/Syntax/SyntaxInvariants.js +1 -1
  295. package/dist/bundles/compiler/Syntax/SyntaxInvariants.js.map +1 -1
  296. package/dist/bundles/compiler/Syntax/SyntaxJson.js +1 -1
  297. package/dist/bundles/compiler/Syntax/SyntaxJson.js.map +1 -1
  298. package/dist/bundles/compiler/Syntax/SyntaxMemberContracts.js.map +1 -1
  299. package/dist/bundles/compiler/Syntax/index.js +1 -1
  300. package/dist/bundles/compiler/Text/ImplementationHintText.js.map +1 -1
  301. package/dist/bundles/compiler/Text/ReservedWords.js.map +1 -1
  302. package/dist/bundles/compiler/Text/SourceStreamNames.js.map +1 -1
  303. package/dist/bundles/compiler/Text/StringLiteral.js.map +1 -1
  304. package/dist/bundles/compiler/Text/ordinalIgnoreCaseKey.js.map +1 -1
  305. package/dist/bundles/compiler/Text/patterns.js.map +1 -1
  306. package/dist/bundles/compiler/index.js +1 -1
  307. package/dist/bundles/completion-items.js +4 -4
  308. package/dist/bundles/completion-items.js.map +1 -1
  309. package/dist/bundles/completion-planner.js +2 -2
  310. package/dist/bundles/completion-planner.js.map +1 -1
  311. package/dist/bundles/completions.js +1 -1
  312. package/dist/bundles/completions.js.map +1 -1
  313. package/dist/bundles/continuation-responses.js +1 -1
  314. package/dist/bundles/continuation-responses.js.map +1 -1
  315. package/dist/bundles/declarations.js.map +1 -1
  316. package/dist/bundles/dependency-completions.js.map +1 -1
  317. package/dist/bundles/dependency-target-analysis.js.map +1 -1
  318. package/dist/bundles/diagnostic-codes.js +1 -1
  319. package/dist/bundles/diagnostic-codes.js.map +1 -1
  320. package/dist/bundles/diagnostics.js +1 -1
  321. package/dist/bundles/diagnostics.js.map +1 -1
  322. package/dist/bundles/document-context.js.map +1 -1
  323. package/dist/bundles/documentation-item.js.map +1 -1
  324. package/dist/bundles/event-analysis-source.js.map +1 -1
  325. package/dist/bundles/event-context-catalog.js.map +1 -1
  326. package/dist/bundles/event-context.js.map +1 -1
  327. package/dist/bundles/event-source-authoring.js +11 -11
  328. package/dist/bundles/event-source-authoring.js.map +1 -1
  329. package/dist/bundles/example-analysis.js +2 -2
  330. package/dist/bundles/example-analysis.js.map +1 -1
  331. package/dist/bundles/example-authoring.js +2 -2
  332. package/dist/bundles/example-authoring.js.map +1 -1
  333. package/dist/bundles/example-declaration-items.js.map +1 -1
  334. package/dist/bundles/example-values.js.map +1 -1
  335. package/dist/bundles/file-imports.js.map +1 -1
  336. package/dist/bundles/file-references.js.map +1 -1
  337. package/dist/bundles/generation-completions.js.map +1 -1
  338. package/dist/bundles/hover-content.js +5 -5
  339. package/dist/bundles/hover-content.js.map +1 -1
  340. package/dist/bundles/hover.js.map +1 -1
  341. package/dist/bundles/index.js +1 -1
  342. package/dist/bundles/index.js.map +1 -1
  343. package/dist/bundles/inlay-hints.js.map +1 -1
  344. package/dist/bundles/inline-completions.js +1 -1
  345. package/dist/bundles/inline-completions.js.map +1 -1
  346. package/dist/bundles/inline-event-validation.js +1 -1
  347. package/dist/bundles/inline-event-validation.js.map +1 -1
  348. package/dist/bundles/keyword-docs.js.map +1 -1
  349. package/dist/bundles/language.js.map +1 -1
  350. package/dist/bundles/named-rule-context.js.map +1 -1
  351. package/dist/bundles/operation-authoring.js +6 -6
  352. package/dist/bundles/operation-authoring.js.map +1 -1
  353. package/dist/bundles/persona-analysis.js +1 -1
  354. package/dist/bundles/persona-analysis.js.map +1 -1
  355. package/dist/bundles/production-destinations.js +1 -1
  356. package/dist/bundles/production-destinations.js.map +1 -1
  357. package/dist/bundles/purpose-items.js.map +1 -1
  358. package/dist/bundles/reaction-authoring.js +3 -3
  359. package/dist/bundles/reaction-authoring.js.map +1 -1
  360. package/dist/bundles/read-model-key-completions.js +1 -1
  361. package/dist/bundles/read-model-key-completions.js.map +1 -1
  362. package/dist/bundles/refusal-context.js.map +1 -1
  363. package/dist/bundles/response-analysis.js.map +1 -1
  364. package/dist/bundles/response-completions.js +1 -1
  365. package/dist/bundles/response-completions.js.map +1 -1
  366. package/dist/bundles/response-tokens.js +2 -2
  367. package/dist/bundles/response-tokens.js.map +1 -1
  368. package/dist/bundles/scope-items.js +3 -3
  369. package/dist/bundles/scope-items.js.map +1 -1
  370. package/dist/bundles/structure-completions.js.map +1 -1
  371. package/dist/bundles/sub-language-registry.js.map +1 -1
  372. package/dist/bundles/sub-languages/capture/CompletionProvider.js.map +1 -1
  373. package/dist/bundles/sub-languages/capture/HoverProvider.js.map +1 -1
  374. package/dist/bundles/sub-languages/capture/Validator.js.map +1 -1
  375. package/dist/bundles/sub-languages/capture/index.js.map +1 -1
  376. package/dist/bundles/sub-languages/capture/language.js.map +1 -1
  377. package/dist/bundles/sub-languages/cdl.js.map +1 -1
  378. package/dist/bundles/sub-languages/pdl.js.map +1 -1
  379. package/dist/bundles/sub-languages/projection/CodeActionProvider.js.map +1 -1
  380. package/dist/bundles/sub-languages/projection/CompletionProvider.js +1 -1
  381. package/dist/bundles/sub-languages/projection/CompletionProvider.js.map +1 -1
  382. package/dist/bundles/sub-languages/projection/HoverProvider.js.map +1 -1
  383. package/dist/bundles/sub-languages/projection/Validator.js.map +1 -1
  384. package/dist/bundles/sub-languages/projection/index.js.map +1 -1
  385. package/dist/bundles/sub-languages/projection/language.js.map +1 -1
  386. package/dist/bundles/symbols.js +2 -2
  387. package/dist/bundles/symbols.js.map +1 -1
  388. package/dist/bundles/themes/screenplay-dark.js.map +1 -1
  389. package/dist/bundles/themes/screenplay-light.js.map +1 -1
  390. package/dist/bundles/tokens.js.map +1 -1
  391. package/dist/bundles/validation.js +2 -2
  392. package/dist/bundles/validation.js.map +1 -1
  393. package/dist/diagnostic-codes.d.ts +1 -0
  394. package/dist/diagnostic-codes.d.ts.map +1 -1
  395. package/package.json +3 -3
@@ -1 +1 @@
1
- {"version":3,"file":"TypeReferenceSymbol.js","names":["match","text","type"],"sources":["../../TypeReferenceSymbol.ts"],"sourcesContent":["// Copyright (c) Cratis. All rights reserved.\n// Licensed under the MIT license. See LICENSE file in the project root for full license information.\n\nexport interface TypeReferenceSymbol {\n readonly name: string;\n readonly isCollection: boolean;\n readonly isOptional: boolean;\n}\n\nexport function typeReferenceSymbol(text: string): TypeReferenceSymbol {\n const match = /^([\\w.]+)(\\[\\])?(\\?|\\s+optional)?$/.exec(text);\n return { name: match?.[1] ?? text, isCollection: match?.[2] !== undefined, isOptional: match?.[3] !== undefined };\n}\n\nexport function typeReferenceText(type: TypeReferenceSymbol): string {\n return `${type.name}${type.isCollection ? '[]' : ''}${type.isOptional ? ' optional' : ''}`;\n}\n"],"mappings":"iDASA,SAAgB,oBAAoB,EAAmC,CACnE,IAAMA,EAAQ,qCAAqC,KAAKC,CAAI,EAC5D,MAAO,CAAE,KAAMD,IAAQ,IAAMC,EAAM,aAAcD,IAAQ,KAAO,IAAA,GAAW,WAAYA,IAAQ,KAAO,IAAA,EAAU,CACpH,CAEA,SAAgB,kBAAkB,EAAmC,CACjE,MAAO,GAAGE,EAAK,OAAOA,EAAK,aAAe,KAAO,KAAKA,EAAK,WAAa,YAAc,IAC1F"}
1
+ {"version":3,"file":"TypeReferenceSymbol.js","names":["match","text","type"],"sources":["../../TypeReferenceSymbol.ts"],"sourcesContent":["// Copyright (c) Cratis. All rights reserved.\n// Licensed under the MIT license. See LICENSE file in the project root for full license information.\n\nexport interface TypeReferenceSymbol {\n readonly name: string;\n readonly isCollection: boolean;\n readonly isOptional: boolean;\n}\n\nexport function typeReferenceSymbol(text: string): TypeReferenceSymbol {\n const match = /^([\\w.]+)(\\[\\])?(\\?|\\s+optional)?$/.exec(text);\n return { name: match?.[1] ?? text, isCollection: match?.[2] !== undefined, isOptional: match?.[3] !== undefined };\n}\n\nexport function typeReferenceText(type: TypeReferenceSymbol): string {\n return `${type.name}${type.isCollection ? '[]' : ''}${type.isOptional ? ' optional' : ''}`;\n}\n"],"mappings":"A,iDASA,SAAgB,oBAAoB,EAAmC,CACnE,IAAMA,EAAQ,qCAAqC,KAAKC,CAAI,EAC5D,MAAO,CAAE,KAAMD,IAAQ,IAAMC,EAAM,aAAcD,IAAQ,KAAO,IAAA,GAAW,WAAYA,IAAQ,KAAO,IAAA,EAAU,CACpH,CAEA,SAAgB,kBAAkB,EAAmC,CACjE,MAAO,GAAGE,EAAK,OAAOA,EAAK,aAAe,KAAO,KAAKA,EAAK,WAAa,YAAc,IAC1F,C"}
@@ -1 +1 @@
1
- {"version":3,"file":"action-subject-authoring.js","names":["match","line","word","start","column"],"sources":["../../action-subject-authoring.ts"],"sourcesContent":["// Copyright (c) Cratis. All rights reserved.\n// Licensed under the MIT license. See LICENSE file in the project root for full license information.\n\nexport function actionSubjectHover(line: string, word: string, column: number): string | null {\n const match = /^\\s*(?:action\\s+(?:\"(?:[^\"\\\\]|\\\\.)*\"|\\$strings\\.[\\w.]+|[\\w.]+)|item\\s+\\w+\\s+action\\s+[\\w.]+)\\s+(for)\\s+(item|screen)\\b/.exec(line);\n if (match === null || !['for', match[2]].includes(word)) return null;\n const start = match[0].lastIndexOf('for');\n if (column - 1 < start || column - 1 >= match[0].length) return null;\n return match[2] === 'item'\n ? '`for item` uses one nearest data record or selected collection item. Explicit inputs win, followed by compatible same-name fields and one declared nominal identifier/key match. Missing or equally near data is not guessed.'\n : '`for screen` scopes a plain or toolbar action to the screen, without row input filling. A guarded action can inspect a single record, but collection-valued data warns and does not choose a row.';\n}\n"],"mappings":"iDAGA,SAAgB,mBAAmB,EAAc,EAAc,EAA+B,CAC1F,IAAMA,EAAQ,yHAAyH,KAAKC,CAAI,EAChJ,GAAID,IAAU,MAAQ,CAAC,CAAC,MAAOA,EAAM,EAAE,CAAC,CAAC,SAASE,CAAI,EAAG,OAAO,KAChE,IAAMC,EAAQH,EAAM,EAAE,CAAC,YAAY,KAAK,EAExC,OADII,EAAS,EAAID,GAASC,EAAS,GAAKJ,EAAM,EAAE,CAAC,OAAe,KACzDA,EAAM,KAAO,OACd,gOACA,mMACV"}
1
+ {"version":3,"file":"action-subject-authoring.js","names":["match","line","word","start","column"],"sources":["../../action-subject-authoring.ts"],"sourcesContent":["// Copyright (c) Cratis. All rights reserved.\n// Licensed under the MIT license. See LICENSE file in the project root for full license information.\n\nexport function actionSubjectHover(line: string, word: string, column: number): string | null {\n const match = /^\\s*(?:action\\s+(?:\"(?:[^\"\\\\]|\\\\.)*\"|\\$strings\\.[\\w.]+|[\\w.]+)|item\\s+\\w+\\s+action\\s+[\\w.]+)\\s+(for)\\s+(item|screen)\\b/.exec(line);\n if (match === null || !['for', match[2]].includes(word)) return null;\n const start = match[0].lastIndexOf('for');\n if (column - 1 < start || column - 1 >= match[0].length) return null;\n return match[2] === 'item'\n ? '`for item` uses one nearest data record or selected collection item. Explicit inputs win, followed by compatible same-name fields and one declared nominal identifier/key match. Missing or equally near data is not guessed.'\n : '`for screen` scopes a plain or toolbar action to the screen, without row input filling. A guarded action can inspect a single record, but collection-valued data warns and does not choose a row.';\n}\n"],"mappings":"A,iDAGA,SAAgB,mBAAmB,EAAc,EAAc,EAA+B,CAC1F,IAAMA,EAAQ,yHAAyH,KAAKC,CAAI,EAChJ,GAAID,IAAU,MAAQ,CAAC,CAAC,MAAOA,EAAM,EAAE,CAAC,CAAC,SAASE,CAAI,EAAG,OAAO,KAChE,IAAMC,EAAQH,EAAM,EAAE,CAAC,YAAY,KAAK,EAExC,OADII,EAAS,EAAID,GAASC,EAAS,GAAKJ,EAAM,EAAE,CAAC,OAAe,KACzDA,EAAM,KAAO,OACd,gOACA,mMACV,C"}
@@ -1 +1 @@
1
- {"version":3,"file":"bmp-word-characters.js","names":["word","value","result","start","bmpWordCharacters"],"sources":["../../bmp-word-characters.ts"],"sourcesContent":["// Copyright (c) Cratis. All rights reserved.\n// Licensed under the MIT license. See LICENSE file in the project root for full license information.\n\n// .NET regex \\w accepts these categories per UTF-16 code unit, not supplementary code points.\n// Monarch discards a rule's /u flag. Expand just this class into BMP ranges rather than enabling\n// Unicode mode for the entire grammar (which would change legacy regexes and embedded languages).\nconst word = /[\\p{L}\\p{Mn}\\p{Nd}\\p{Pc}]/u;\nconst escape = (value: number) => `\\\\u${value.toString(16).padStart(4, '0')}`;\nfunction ranges(): string {\n let result = '';\n for (let value = 0; value <= 0xffff; value++) {\n if (!word.test(String.fromCharCode(value))) continue;\n const start = value;\n while (value < 0xffff && word.test(String.fromCharCode(value + 1))) value++;\n result += escape(start) + (value > start ? `-${escape(value)}` : '');\n }\n return result;\n}\nexport const bmpWordCharacters = ranges();\n"],"mappings":"iDAMA,MAAMA,EAAO,6BACP,OAAU,GAAkB,MAAMC,EAAM,SAAS,EAAE,CAAC,CAAC,SAAS,EAAG,GAAG,IAC1E,SAAS,QAAiB,CACtB,IAAIC,EAAS,GACb,IAAK,IAAID,EAAQ,EAAGA,GAAS,MAAQ,IAAS,CAC1C,GAAI,CAACD,EAAK,KAAK,OAAO,aAAaC,CAAK,CAAC,EAAG,SAC5C,IAAME,EAAQF,EACd,KAAOA,EAAQ,OAAUD,EAAK,KAAK,OAAO,aAAaC,EAAQ,CAAC,CAAC,GAAG,IACpE,GAAU,OAAOE,CAAK,GAAKF,EAAQE,EAAQ,IAAI,OAAOF,CAAK,IAAM,GACrE,CACA,OAAOC,CACX,CACA,MAAaE,EAAoB,OAAO"}
1
+ {"version":3,"file":"bmp-word-characters.js","names":["word","value","result","start","bmpWordCharacters"],"sources":["../../bmp-word-characters.ts"],"sourcesContent":["// Copyright (c) Cratis. All rights reserved.\n// Licensed under the MIT license. See LICENSE file in the project root for full license information.\n\n// .NET regex \\w accepts these categories per UTF-16 code unit, not supplementary code points.\n// Monarch discards a rule's /u flag. Expand just this class into BMP ranges rather than enabling\n// Unicode mode for the entire grammar (which would change legacy regexes and embedded languages).\nconst word = /[\\p{L}\\p{Mn}\\p{Nd}\\p{Pc}]/u;\nconst escape = (value: number) => `\\\\u${value.toString(16).padStart(4, '0')}`;\nfunction ranges(): string {\n let result = '';\n for (let value = 0; value <= 0xffff; value++) {\n if (!word.test(String.fromCharCode(value))) continue;\n const start = value;\n while (value < 0xffff && word.test(String.fromCharCode(value + 1))) value++;\n result += escape(start) + (value > start ? `-${escape(value)}` : '');\n }\n return result;\n}\nexport const bmpWordCharacters = ranges();\n"],"mappings":"A,iDAMA,MAAMA,EAAO,6BACP,OAAU,GAAkB,MAAMC,EAAM,SAAS,EAAE,CAAC,CAAC,SAAS,EAAG,GAAG,IAC1E,SAAS,QAAiB,CACtB,IAAIC,EAAS,GACb,IAAK,IAAID,EAAQ,EAAGA,GAAS,MAAQ,IAAS,CAC1C,GAAI,CAACD,EAAK,KAAK,OAAO,aAAaC,CAAK,CAAC,EAAG,SAC5C,IAAME,EAAQF,EACd,KAAOA,EAAQ,OAAUD,EAAK,KAAK,OAAO,aAAaC,EAAQ,CAAC,CAAC,GAAG,IACpE,GAAU,OAAOE,CAAK,GAAKF,EAAQE,EAAQ,IAAI,OAAOF,CAAK,IAAM,GACrE,CACA,OAAOC,CACX,CACA,MAAaE,EAAoB,OAAO,E"}
@@ -1,3 +1,3 @@
1
- import"./_virtual/_virtual/_rolldown/runtime.js";import{enclosingHeaders as e,fenceMap as t,indentOf as n}from"./document-context.js";import{responseAnalysis as r}from"./response-analysis.js";function enclosing(i,a){let o=e(i,t(i),a,n(i[a]));if(o.some(e=>e.startsWith(`specification `))&&!o.some(e=>/^(?:case|given caller|when redelivered)\b/.test(e)))return[...r(i).specifications].filter(([e])=>e<=a).sort(([e],[t])=>t-e)[0]?.[1]}function caseCompletions(e,t,n){if(!/(?:=\s*|for\s+|then\s+error\s+)case\.[\w]*$/.test(n)||/when\s+redelivered|given\s+caller/.test(n)||/^\s*case\b/.test(n))return null;let r=enclosing(e,t);return(r?.cases?.length??0)===0?null:r.parameters?.map(e=>({label:`case.${e.name}`,insertText:`case.${e.name}`,documentation:`Case value of ${e.type.name}${e.type.isCollection?`[]`:``}${e.type.isOptional?` optional`:``}.`}))??[]}function caseHover(e,t,n,r){let i=[...e[t].matchAll(/\bcase\.([a-z_]\w*)\b/g)].find(e=>e.index<r&&e.index+e[0].length>=n);if(i===void 0)return null;let a=enclosing(e,t),o=a?.parameters?.find(e=>e.name===i[1]);if(o===void 0)return null;let s=a.cases?.map(e=>{let t=e.values.find(e=>e.property===o.name)?.source,n=typeof t==`object`&&t&&`value`in t?t.value:t;return`- ${e.name}: \`${JSON.stringify(n)}\``}).join(`
1
+ import"./_virtual/_virtual/_rolldown/runtime.js";import{responseAnalysis as e}from"./response-analysis.js";import{enclosingHeaders as t,fenceMap as n,indentOf as r}from"./document-context.js";function enclosing(i,a){let o=t(i,n(i),a,r(i[a]));if(o.some(e=>e.startsWith(`specification `))&&!o.some(e=>/^(?:case|given caller|when redelivered)\b/.test(e)))return[...e(i).specifications].filter(([e])=>e<=a).sort(([e],[t])=>t-e)[0]?.[1]}function caseCompletions(e,t,n){if(!/(?:=\s*|for\s+|then\s+error\s+)case\.[\w]*$/.test(n)||/when\s+redelivered|given\s+caller/.test(n)||/^\s*case\b/.test(n))return null;let r=enclosing(e,t);return(r?.cases?.length??0)===0?null:r.parameters?.map(e=>({label:`case.${e.name}`,insertText:`case.${e.name}`,documentation:`Case value of ${e.type.name}${e.type.isCollection?`[]`:``}${e.type.isOptional?` optional`:``}.`}))??[]}function caseHover(e,t,n,r){let i=[...e[t].matchAll(/\bcase\.([a-z_]\w*)\b/g)].find(e=>e.index<r&&e.index+e[0].length>=n);if(i===void 0)return null;let a=enclosing(e,t),o=a?.parameters?.find(e=>e.name===i[1]);if(o===void 0)return null;let s=a.cases?.map(e=>{let t=e.values.find(e=>e.property===o.name)?.source,n=typeof t==`object`&&t&&`value`in t?t.value:t;return`- ${e.name}: \`${JSON.stringify(n)}\``}).join(`
2
2
  `);return`**case.${o.name}** — ${o.type.name}\n\nCase origin in **${a.name}**; substitutes after example overrides.\n\n${s??``}`}export{caseCompletions,caseHover};
3
3
  //# sourceMappingURL=case-authoring.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"case-authoring.js","names":["headers","enclosingHeaders","lines","fenceMap","line","indentOf","header","responseAnalysis","start","left","right","before","table","parameter","reference","match","end","values","source","row","value"],"sources":["../../case-authoring.ts"],"sourcesContent":["// Copyright (c) Cratis. All rights reserved.\n// Licensed under the MIT license. See LICENSE file in the project root for full license information.\n\nimport { responseAnalysis } from './response-analysis';\nimport { enclosingHeaders, fenceMap, indentOf } from './document-context';\n\nfunction enclosing(lines: string[], line: number) {\n const headers = enclosingHeaders(lines, fenceMap(lines), line, indentOf(lines[line]));\n if (!headers.some(header => header.startsWith('specification ')) || headers.some(header => /^(?:case|given caller|when redelivered)\\b/.test(header))) return undefined;\n return [...responseAnalysis(lines).specifications].filter(([start]) => start <= line).sort(([left], [right]) => right - left)[0]?.[1];\n}\n\nexport function caseCompletions(lines: string[], line: number, before: string) {\n if (!/(?:=\\s*|for\\s+|then\\s+error\\s+)case\\.[\\w]*$/.test(before) || /when\\s+redelivered|given\\s+caller/.test(before) || /^\\s*case\\b/.test(before)) return null;\n const table = enclosing(lines, line);\n if ((table?.cases?.length ?? 0) === 0) return null;\n return table!.parameters?.map(parameter => ({ label: `case.${parameter.name}`, insertText: `case.${parameter.name}`, documentation: `Case value of ${parameter.type.name}${parameter.type.isCollection ? '[]' : ''}${parameter.type.isOptional ? ' optional' : ''}.` })) ?? [];\n}\n\nexport function caseHover(lines: string[], line: number, start: number, end: number): string | null {\n const text = lines[line];\n const reference = [...text.matchAll(/\\bcase\\.([a-z_]\\w*)\\b/g)].find(match => match.index! < end && match.index! + match[0].length >= start);\n if (reference === undefined) return null;\n const table = enclosing(lines, line);\n const parameter = table?.parameters?.find(parameter => parameter.name === reference[1]);\n if (parameter === undefined) return null;\n const values = table!.cases?.map(row => {\n const source = row.values.find(value => value.property === parameter.name)?.source;\n const value = source !== null && typeof source === 'object' && 'value' in source ? source.value : source;\n return `- ${row.name}: \\`${JSON.stringify(value)}\\``;\n }).join('\\n');\n return `**case.${parameter.name}** — ${parameter.type.name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EAC7BS,EAAYD,GAAO,YAAY,KAAK,GAAaC,EAAU,OAASC,EAAU,EAAE,EACtF,GAAID,IAAc,IAAA,GAAW,OAAO,KACpC,IAAMI,EAASL,EAAO,OAAO,IAAI,GAAO,CACpC,IAAMM,EAASC,EAAI,OAAO,KAAK,GAASC,EAAM,WAAaP,EAAU,IAAI,CAAC,EAAE,OACtEO,EAA2B,OAAOF,GAAW,UAArCA,GAAiD,UAAWA,EAASA,EAAO,MAAQA,EAClG,MAAO,KAAKC,EAAI,KAAK,MAAM,KAAK,UAAUC,CAAK,EAAE,GACrD,CAAC,CAAC,CAAC,KAAK;CAAI,EACZ,MAAO,UAAUP,EAAU,KAAK,OAAOA,EAAU,KAAK,KAAK,uBAAuBD,EAAO,KAAK,8CAA8CK,GAAU,IAC1J"}
1
+ {"version":3,"file":"case-authoring.js","names":["headers","enclosingHeaders","lines","fenceMap","line","indentOf","header","responseAnalysis","start","left","right","before","table","parameter","reference","match","end","values","source","row","value"],"sources":["../../case-authoring.ts"],"sourcesContent":["// Copyright (c) Cratis. All rights reserved.\n// Licensed under the MIT license. See LICENSE file in the project root for full license information.\n\nimport { responseAnalysis } from './response-analysis';\nimport { enclosingHeaders, fenceMap, indentOf } from './document-context';\n\nfunction enclosing(lines: string[], line: number) {\n const headers = enclosingHeaders(lines, fenceMap(lines), line, indentOf(lines[line]));\n if (!headers.some(header => header.startsWith('specification ')) || headers.some(header => /^(?:case|given caller|when redelivered)\\b/.test(header))) return undefined;\n return [...responseAnalysis(lines).specifications].filter(([start]) => start <= line).sort(([left], [right]) => right - left)[0]?.[1];\n}\n\nexport function caseCompletions(lines: string[], line: number, before: string) {\n if (!/(?:=\\s*|for\\s+|then\\s+error\\s+)case\\.[\\w]*$/.test(before) || /when\\s+redelivered|given\\s+caller/.test(before) || /^\\s*case\\b/.test(before)) return null;\n const table = enclosing(lines, line);\n if ((table?.cases?.length ?? 0) === 0) return null;\n return table!.parameters?.map(parameter => ({ label: `case.${parameter.name}`, insertText: `case.${parameter.name}`, documentation: `Case value of ${parameter.type.name}${parameter.type.isCollection ? '[]' : ''}${parameter.type.isOptional ? ' optional' : ''}.` })) ?? [];\n}\n\nexport function caseHover(lines: string[], line: number, start: number, end: number): string | null {\n const text = lines[line];\n const reference = [...text.matchAll(/\\bcase\\.([a-z_]\\w*)\\b/g)].find(match => match.index! < end && match.index! + match[0].length >= start);\n if (reference === undefined) return null;\n const table = enclosing(lines, line);\n const parameter = table?.parameters?.find(parameter => parameter.name === reference[1]);\n if (parameter === undefined) return null;\n const values = table!.cases?.map(row => {\n const source = row.values.find(value => value.property === parameter.name)?.source;\n const value = source !== null && typeof source === 'object' && 'value' in source ? source.value : source;\n return `- ${row.name}: \\`${JSON.stringify(value)}\\``;\n }).join('\\n');\n return `**case.${parameter.name}** — ${parameter.type.name}\\n\\nCase origin in **${table!.name}**; substitutes after example overrides.\\n\\n${values ?? ''}`;\n}\n"],"mappings":"A,gMAMA,SAAS,UAAU,EAAiB,EAAc,CAC9C,IAAMA,EAAUC,EAAiBC,EAAOC,EAASD,CAAK,EAAGE,EAAMC,EAASH,EAAME,EAAK,CAAC,EACpF,GAAKJ,EAAQ,KAAK,GAAUM,EAAO,WAAW,gBAAgB,CAAC,GAAK,GAAQ,KAAK,GAAU,4CAA4C,KAAKA,CAAM,CAAC,EACnJ,MAAO,CAAC,GAAGC,EAAiBL,CAAK,CAAC,CAAC,cAAc,CAAC,CAAC,QAAQ,CAACM,KAAWA,GAASJ,CAAI,CAAC,CAAC,MAAM,CAACK,GAAO,CAACC,KAAWA,EAAQD,CAAI,CAAC,CAAC,EAAE,GAAG,EACvI,CAEA,SAAgB,gBAAgB,EAAiB,EAAc,EAAgB,CAC3E,GAAI,CAAC,8CAA8C,KAAKE,CAAM,GAAK,oCAAoC,KAAKA,CAAM,GAAK,aAAa,KAAKA,CAAM,EAAG,OAAO,KACzJ,IAAMC,EAAQ,UAAUV,EAAOE,CAAI,EAEnC,OADKQ,GAAO,OAAO,QAAU,KAAO,EAAU,KACvCA,EAAO,YAAY,IAAI,IAAc,CAAE,MAAO,QAAQC,EAAU,OAAQ,WAAY,QAAQA,EAAU,OAAQ,cAAe,iBAAiBA,EAAU,KAAK,OAAOA,EAAU,KAAK,aAAe,KAAO,KAAKA,EAAU,KAAK,WAAa,YAAc,GAAG,EAAG,EAAE,GAAK,CAAC,CACjR,CAEA,SAAgB,UAAU,EAAiB,EAAc,EAAe,EAA4B,CAEhG,IAAMC,EAAY,CAAC,GADNZ,EAAME,EACO,CAAC,SAAS,wBAAwB,CAAC,CAAC,CAAC,KAAK,GAASW,EAAM,MAASC,GAAOD,EAAM,MAASA,EAAM,EAAE,CAAC,QAAUP,CAAK,EAC1I,GAAIM,IAAc,IAAA,GAAW,OAAO,KACpC,IAAMF,EAAQ,UAAUV,EAAOE,CAAI,EAC7BS,EAAYD,GAAO,YAAY,KAAK,GAAaC,EAAU,OAASC,EAAU,EAAE,EACtF,GAAID,IAAc,IAAA,GAAW,OAAO,KACpC,IAAMI,EAASL,EAAO,OAAO,IAAI,GAAO,CACpC,IAAMM,EAASC,EAAI,OAAO,KAAK,GAASC,EAAM,WAAaP,EAAU,IAAI,CAAC,EAAE,OACtEO,EAA2B,OAAOF,GAAW,UAArCA,GAAiD,UAAWA,EAASA,EAAO,MAAQA,EAClG,MAAO,KAAKC,EAAI,KAAK,MAAM,KAAK,UAAUC,CAAK,EAAE,GACrD,CAAC,CAAC,CAAC,KAAK;CAAI,EACZ,MAAO,UAAUP,EAAU,KAAK,OAAOA,EAAU,KAAK,KAAK,uBAAuBD,EAAO,KAAK,8CAA8CK,GAAU,IAC1J,C"}
@@ -1 +1 @@
1
- {"version":3,"file":"code-actions.js","names":["migrateOptional","migrateCompliance","code","DiagnosticCodes","requested","kind","left","right","cache","migrationRequested","context","migrationOnly","token","diagnostics","marker","isQuickFixDiagnostic","range","version","model","models","applicationModels","path","document","versions","placementKey","placement","analysis","prepareQuickFixes","fixes","diagnostic","fix","edit","start","end"],"sources":["../../code-actions.ts"],"sourcesContent":["// Copyright (c) Cratis. All rights reserved.\n// Licensed under the MIT license. See LICENSE file in the project root for full license information.\n\nimport type { editor, IRange, languages } from 'monaco-editor';\nimport { DiagnosticCodes, isQuickFixDiagnostic, prepareQuickFixes } from '@cratis/screenplay-compiler';\n\nconst migrateOptional = 'source.screenplay.migrateOptional';\nconst migrateCompliance = 'source.screenplay.migrateCompliance';\nconst migrationKind = (code: string) => code === DiagnosticCodes.LegacyComplianceMarker ? migrateCompliance : migrateOptional;\nconst containsKind = (requested: string, kind: string) => requested === '' || requested === kind || kind.startsWith(`${requested}.`);\n\nfunction intersects(left: IRange, right: IRange): boolean {\n return (left.startLineNumber < right.endLineNumber || (left.startLineNumber === right.endLineNumber && left.startColumn <= right.endColumn)) &&\n (right.startLineNumber < left.endLineNumber || (right.startLineNumber === left.endLineNumber && right.startColumn <= left.endColumn));\n}\n\n// The compiler owns recipes and verification. The adapter only translates verified offsets and pins\n// edits to the analyzed buffer version, so future fixes need no editor-specific parsing or .NET bridge.\nexport function createCodeActionProvider(placement?: readonly string[], applicationModels?: () => ReadonlyMap<string, editor.ITextModel>): languages.CodeActionProvider {\n const cache = new WeakMap<editor.ITextModel, { version: number; placement: string; fixes: ReturnType<typeof prepareQuickFixes> }>();\n return {\n provideCodeActions(model, range, context, token) {\n const migrationRequested = context.only !== undefined && [migrateOptional, migrateCompliance].some(kind => containsKind(context.only!, kind));\n const migrationOnly = context.only !== undefined && migrationRequested && !containsKind(context.only, 'quickfix');\n if (token.isCancellationRequested || (context.only !== undefined && !migrationRequested && !containsKind(context.only, 'quickfix'))) return { actions: [], dispose() {} };\n const diagnostics = context.markers.filter(marker => {\n const code = typeof marker.code === 'object' ? marker.code.value : marker.code;\n return isQuickFixDiagnostic(code) && intersects(marker, range);\n });\n if (!migrationRequested && diagnostics.length === 0) return { actions: [], dispose() {} };\n const version = model.getVersionId();\n const models = applicationModels?.();\n const path = models === undefined ? undefined : [...models].find(([, document]) => document === model)?.[0];\n if (models !== undefined && path === undefined) return { actions: [], dispose() {} };\n const versions = new Map([...(models?.values() ?? [model])].map(document => [document, document.getVersionId()]));\n const placementKey = JSON.stringify([placement, models === undefined ? undefined : [...models].map(([path, document]) => [path, document.uri.toString(), versions.get(document)])]);\n let analysis = cache.get(model);\n if (analysis?.version !== version || analysis.placement !== placementKey) {\n analysis = { version, placement: placementKey, fixes: prepareQuickFixes(model.getValue(), { placement, path, documents: models === undefined ? undefined : new Map([...models].map(([path, document]) => [path, document.getValue()])) }) };\n cache.set(model, analysis);\n }\n const occurrences = migrationOnly ? [] : analysis.fixes(diagnostics.map(diagnostic => ({\n line: diagnostic.startLineNumber,\n diagnosticCode: String(typeof diagnostic.code === 'object' ? diagnostic.code.value : diagnostic.code),\n }))).filter(fix => fix.scope === 'occurrence');\n const requested = [...occurrences, ...(context.only === undefined || migrationRequested ? [DiagnosticCodes.LegacyOptionalSuffix, DiagnosticCodes.LegacyComplianceMarker].flatMap(code => analysis.fixes(undefined, code)) : [])];\n const fixes = requested.filter(fix => context.only === undefined || containsKind(context.only, fix.scope === 'document' ? migrationKind(fix.diagnosticCode) : 'quickfix'));\n if (token.isCancellationRequested || [...versions].some(([document, version]) => document.getVersionId() !== version)) return { actions: [], dispose() {} };\n const supported = fixes.filter(fix => fix.edits.every(edit => edit.path === undefined || models?.has(edit.path)));\n return {\n actions: supported.map(fix => ({\n title: fix.title,\n kind: fix.scope === 'document' ? migrationKind(fix.diagnosticCode) : 'quickfix',\n isPreferred: fix.scope === 'occurrence',\n edit: { edits: fix.edits.map(edit => {\n const document = edit.path === undefined ? model : models!.get(edit.path)!;\n const start = document.getPositionAt(edit.start);\n const end = document.getPositionAt(edit.start + edit.length);\n return { resource: document.uri, versionId: versions.get(document)!, textEdit: {\n range: { startLineNumber: start.lineNumber, startColumn: start.column, endLineNumber: end.lineNumber, endColumn: end.column },\n text: edit.text,\n } };\n }).concat(fix.diagnosticCode !== DiagnosticCodes.EventFromLaterSlice || models === undefined ? [] : [...models].filter(([path]) => !fix.edits.some(edit => edit.path === path)).map(([, document]) => ({\n // A sibling change can invalidate the ordering proof. Empty edits pin every\n // analyzed model, including those whose source is not changed by the repair.\n resource: document.uri, versionId: versions.get(document)!, textEdit: { range: { startLineNumber: 1, startColumn: 1, endLineNumber: 1, endColumn: 1 }, text: '' },\n }))) },\n })),\n dispose() {},\n };\n },\n };\n}\n"],"mappings":"0PAMA,MAAMA,EAAkB,oCAClBC,EAAoB,sCACpB,cAAiB,GAAiBC,IAASC,EAAgB,uBAAyBF,EAAoBD,EACxG,cAAgB,EAAmB,IAAiBI,IAAc,IAAMA,IAAcC,GAAQA,EAAK,WAAW,GAAGD,EAAU,EAAE,EAEnI,SAAS,WAAW,EAAc,EAAwB,CACtD,OAAQE,EAAK,gBAAkBC,EAAM,eAAkBD,EAAK,kBAAoBC,EAAM,eAAiBD,EAAK,aAAeC,EAAM,aAC5HA,EAAM,gBAAkBD,EAAK,eAAkBC,EAAM,kBAAoBD,EAAK,eAAiBC,EAAM,aAAeD,EAAK,UAClI,CAIA,SAAgB,yBAAyB,EAA+B,EAAgG,CACpK,IAAME,kBAAQ,IAAI,QAClB,MAAO,CACH,mBAAmB,EAAO,EAAO,EAAS,EAAO,CAC7C,IAAMC,EAAqBC,EAAQ,OAAS,IAAA,IAAa,CAACV,EAAiBC,CAAiB,CAAC,CAAC,KAAK,GAAQ,aAAaS,EAAQ,KAAOL,CAAI,CAAC,EACtIM,EAAgBD,EAAQ,OAAS,IAAA,IAAaD,GAAsB,CAAC,aAAaC,EAAQ,KAAM,UAAU,EAChH,GAAIE,EAAM,yBAA4BF,EAAQ,OAAS,IAAA,IAAa,CAACD,GAAsB,CAAC,aAAaC,EAAQ,KAAM,UAAU,EAAI,MAAO,CAAE,QAAS,CAAC,EAAG,SAAU,CAAC,CAAE,EACxK,IAAMG,EAAcH,EAAQ,QAAQ,OAAO,GAAU,CACjD,IAAMR,EAAO,OAAOY,EAAO,MAAS,SAAWA,EAAO,KAAK,MAAQA,EAA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AM,WAAY,YAAaA,EAAM,OAAQ,cAAeC,EAAI,WAAY,UAAWA,EAAI,MAAO,EAC5H,KAAMF,EAAK,IACf,CAAE,CACN,CAAC,CAAC,CAAC,OAAOD,EAAI,iBAAmB3B,EAAgB,qBAAuBgB,IAAW,IAAA,GAAY,CAAC,EAAI,CAAC,GAAGA,CAAM,CAAC,CAAC,QAAQ,CAACE,KAAU,CAACS,EAAI,MAAM,KAAK,GAAQC,EAAK,OAASV,CAAI,CAAC,CAAC,CAAC,KAAK,EAAGC,MAAe,CAGnM,SAAUA,EAAS,IAAK,UAAWC,EAAS,IAAID,CAAQ,EAAI,SAAU,CAAE,MAAO,CAAE,gBAAiB,EAAG,YAAa,EAAG,cAAe,EAAG,UAAW,CAAE,EAAG,KAAM,EAAG,CACpK,EAAE,CAAC,CAAE,CACT,EAAE,EACF,SAAU,CAAC,CACf,CACJ,CACJ,CACJ"}
1
+ {"version":3,"file":"code-actions.js","names":["migrateOptional","migrateCompliance","code","DiagnosticCodes","requested","kind","left","right","cache","migrationRequested","context","migrationOnly","token","diagnostics","marker","isQuickFixDiagnostic","range","version","model","models","applicationModels","path","document","versions","placementKey","placement","analysis","prepareQuickFixes","fixes","diagnostic","fix","edit","start","end"],"sources":["../../code-actions.ts"],"sourcesContent":["// Copyright (c) Cratis. All rights reserved.\n// Licensed under the MIT license. See LICENSE file in the project root for full license information.\n\nimport type { editor, IRange, languages } from 'monaco-editor';\nimport { DiagnosticCodes, isQuickFixDiagnostic, prepareQuickFixes } from '@cratis/screenplay-compiler';\n\nconst migrateOptional = 'source.screenplay.migrateOptional';\nconst migrateCompliance = 'source.screenplay.migrateCompliance';\nconst migrationKind = (code: string) => code === DiagnosticCodes.LegacyComplianceMarker ? migrateCompliance : migrateOptional;\nconst containsKind = (requested: string, kind: string) => requested === '' || requested === kind || kind.startsWith(`${requested}.`);\n\nfunction intersects(left: IRange, right: IRange): boolean {\n return (left.startLineNumber < right.endLineNumber || (left.startLineNumber === right.endLineNumber && left.startColumn <= right.endColumn)) &&\n (right.startLineNumber < left.endLineNumber || (right.startLineNumber === left.endLineNumber && right.startColumn <= left.endColumn));\n}\n\n// The compiler owns recipes and verification. The adapter only translates verified offsets and pins\n// edits to the analyzed buffer version, so future fixes need no editor-specific parsing or .NET bridge.\nexport function createCodeActionProvider(placement?: readonly string[], applicationModels?: () => ReadonlyMap<string, editor.ITextModel>): languages.CodeActionProvider {\n const cache = new WeakMap<editor.ITextModel, { version: number; placement: string; fixes: ReturnType<typeof prepareQuickFixes> }>();\n return {\n provideCodeActions(model, range, context, token) {\n const migrationRequested = context.only !== undefined && [migrateOptional, migrateCompliance].some(kind => containsKind(context.only!, kind));\n const migrationOnly = context.only !== undefined && migrationRequested && !containsKind(context.only, 'quickfix');\n if (token.isCancellationRequested || (context.only !== undefined && !migrationRequested && !containsKind(context.only, 'quickfix'))) return { actions: [], dispose() {} };\n const diagnostics = context.markers.filter(marker => {\n const code = typeof marker.code === 'object' ? marker.code.value : marker.code;\n return isQuickFixDiagnostic(code) && intersects(marker, range);\n });\n if (!migrationRequested && diagnostics.length === 0) return { actions: [], dispose() {} };\n const version = model.getVersionId();\n const models = applicationModels?.();\n const path = models === undefined ? undefined : [...models].find(([, document]) => document === model)?.[0];\n if (models !== undefined && path === undefined) return { actions: [], dispose() {} };\n const versions = new Map([...(models?.values() ?? [model])].map(document => [document, document.getVersionId()]));\n const placementKey = JSON.stringify([placement, models === undefined ? undefined : [...models].map(([path, document]) => [path, document.uri.toString(), versions.get(document)])]);\n let analysis = cache.get(model);\n if (analysis?.version !== version || analysis.placement !== placementKey) {\n analysis = { version, placement: placementKey, fixes: prepareQuickFixes(model.getValue(), { placement, path, documents: models === undefined ? undefined : new Map([...models].map(([path, document]) => [path, document.getValue()])) }) };\n cache.set(model, analysis);\n }\n const occurrences = migrationOnly ? [] : analysis.fixes(diagnostics.map(diagnostic => ({\n line: diagnostic.startLineNumber,\n diagnosticCode: String(typeof diagnostic.code === 'object' ? diagnostic.code.value : diagnostic.code),\n }))).filter(fix => fix.scope === 'occurrence');\n const requested = [...occurrences, ...(context.only === undefined || migrationRequested ? [DiagnosticCodes.LegacyOptionalSuffix, DiagnosticCodes.LegacyComplianceMarker].flatMap(code => analysis.fixes(undefined, code)) : [])];\n const fixes = requested.filter(fix => context.only === undefined || containsKind(context.only, fix.scope === 'document' ? migrationKind(fix.diagnosticCode) : 'quickfix'));\n if (token.isCancellationRequested || [...versions].some(([document, version]) => document.getVersionId() !== version)) return { actions: [], dispose() {} };\n const supported = fixes.filter(fix => fix.edits.every(edit => edit.path === undefined || models?.has(edit.path)));\n return {\n actions: supported.map(fix => ({\n title: fix.title,\n kind: fix.scope === 'document' ? migrationKind(fix.diagnosticCode) : 'quickfix',\n isPreferred: fix.scope === 'occurrence',\n edit: { edits: fix.edits.map(edit => {\n const document = edit.path === undefined ? model : models!.get(edit.path)!;\n const start = document.getPositionAt(edit.start);\n const end = document.getPositionAt(edit.start + edit.length);\n return { resource: document.uri, versionId: versions.get(document)!, textEdit: {\n range: { startLineNumber: start.lineNumber, startColumn: start.column, endLineNumber: end.lineNumber, endColumn: end.column },\n text: edit.text,\n } };\n }).concat(fix.diagnosticCode !== DiagnosticCodes.EventFromLaterSlice || models === undefined ? [] : [...models].filter(([path]) => !fix.edits.some(edit => edit.path === path)).map(([, document]) => ({\n // A sibling change can invalidate the ordering proof. Empty edits pin every\n // analyzed model, including those whose source is not changed by the repair.\n resource: document.uri, versionId: versions.get(document)!, textEdit: { range: { startLineNumber: 1, startColumn: 1, endLineNumber: 1, endColumn: 1 }, text: '' },\n }))) },\n })),\n dispose() {},\n };\n },\n };\n}\n"],"mappings":"A,0PAMA,MAAMA,EAAkB,oCAClBC,EAAoB,sCACpB,cAAiB,GAAiBC,IAASC,EAAgB,uBAAyBF,EAAoBD,EACxG,cAAgB,EAAmB,IAAiBI,IAAc,IAAMA,IAAcC,GAAQA,EAAK,WAAW,GAAGD,EAAU,EAAE,EAEnI,SAAS,WAAW,EAAc,EAAwB,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UAAW,CAAE,EAAG,KAAM,EAAG,CACpK,EAAE,CAAC,CAAE,CACT,EAAE,EACF,SAAU,CAAC,CACf,CACJ,CACJ,CACJ,C"}
@@ -1 +1 @@
1
- {"version":3,"file":"command-read-completions.js","names":["lines","symbols","document","source","fences","fenceMap","index","text","chain","enclosingChain","line","indentOf","before","operand","mapping","prefix","analysis","responseAnalysis","commandLine","command","scanDocument","reads","name","read","other","property","models","model","scope"],"sources":["../../command-read-completions.ts"],"sourcesContent":["// Copyright (c) Cratis. All rights reserved.\n// Licensed under the MIT license. See LICENSE file in the project root for full license information.\n\nimport { CompletionEntry } from './completion-items';\nimport { enclosingChain, fenceMap, indentOf } from './document-context';\nimport { responseAnalysis } from './response-analysis';\nimport { DocumentSymbols, scanDocument } from './symbols';\n\nexport function commandReadCompletions(lines: string[], line: number, before: string, symbols: DocumentSymbols): CompletionEntry[] | null {\n const sources = [lines.join('\\n'), ...(symbols.authoringDocuments?.map(document => document.source) ?? symbols.authoringSources ?? [])];\n const protectedMode = sources.some(source => {\n const document = source.split('\\n');\n const fences = fenceMap(document);\n return document.some((text, index) => !fences[index] && /^command\\s+reads\\s+protected\\s*(?:\\/\\/.*)?$/.test(text));\n });\n if (!protectedMode) return null;\n const chain = enclosingChain(lines, fenceMap(lines), line, indentOf(before));\n if (!chain.includes('command')) return null;\n const operand = before.match(/^\\s*require\\s+(?:.*(?:==|!=|>=|<=|>|<|\\band\\b|\\bor\\b)\\s+)?([\\w.]*)$/);\n const mapping = chain[0] === 'produces' ? before.match(/^\\s*\\w+\\s*=\\s*([\\w.]*)$/) : null;\n const prefix = (operand ?? mapping)?.[1];\n if (prefix === undefined) return null;\n const analysis = responseAnalysis(lines, symbols.authoringDocuments ?? symbols.authoringSources?.filter(source => source !== lines.join('\\n')) ?? [], symbols.authoringPlacement, symbols.authoringPath, symbols.authoringPlacementResolved);\n const commandLine = analysis.operations.contexts.get(line)?.commandLine;\n const command = commandLine === undefined ? undefined : scanDocument(lines).commands.find(command => command.line === commandLine);\n if (!command) return [];\n const reads = command.reads ?? [];\n return reads.flatMap(read => {\n const name = read.alias ?? read.view;\n if (reads.filter(other => (other.alias ?? other.view) === name).length !== 1 || command.properties.some(property => property.name === name)) return [];\n if (!read.alias && reads.filter(other => other.view === read.view).length !== 1) return [];\n const models = analysis.readModels.filter(({ model, scope }) => model.name === read.view || [...scope, model.name].join('.') === read.view);\n if (models.length !== 1) return [];\n return models[0].model.properties.filter(property => `${name}.${property.name}`.startsWith(prefix)).map(property => ({\n label: `${name}.${property.name}`,\n insertText: prefix.includes('.') ? property.name : `${name}.${property.name}`,\n documentation: 'Protected read property in require or produces mappings (ESM v25). Required absence rejects before requirements; matching intervening facts conflict at commit. Admission depends on the view and key shape.',\n }));\n });\n}\n"],"mappings":"0OAQA,SAAgB,uBAAuB,EAAiB,EAAc,EAAgB,EAAoD,CAOtI,GAAI,CALkB,CADLA,EAAM,KAAK;CAAI,EAAG,GAAIC,EAAQ,oBAAoB,IAAI,GAAYC,EAAS,MAAM,GAAKD,EAAQ,kBAAoB,CAAC,CACxG,CAAC,CAAC,KAAK,GAAU,CACzC,IAAMC,EAAWC,EAAO,MAAM;CAAI,EAC5BC,EAASC,EAASH,CAAQ,EAChC,OAAOA,EAAS,MAAM,EAAM,IAAU,CAACE,EAAOE,IAAU,8CAA8C,KAAKC,CAAI,CAAC,CACpH,CACiB,EAAG,OAAO,KAC3B,IAAMC,EAAQC,EAAeT,EAAOK,EAASL,CAAK,EAAGU,EAAMC,EAASC,CAAM,CAAC,EAC3E,GAAI,CAACJ,EAAM,SAAS,SAAS,EAAG,OAAO,KACvC,IAAMK,EAAUD,EAAO,MAAM,qEAAqE,EAC5FE,EAAUN,EAAM,KAAO,WAAaI,EAAO,MAAM,yBAAyB,EAAI,KAC9EG,GAAUF,GAAWC,EAAA,GAAW,GACtC,GAAIC,IAAW,IAAA,GAAW,OAAO,KACjC,IAAMC,EAAWC,EAAiBjB,EAAOC,EAAQ,oBAAsBA,EAAQ,kBAAkB,OAAO,GAAUE,IAAWH,EAAM,KAAK;CAAI,CAAC,GAAK,CAAC,EAAGC,EAAQ,mBAAoBA,EAAQ,cAAeA,EAAQ,0BAA0B,EACrOiB,EAAcF,EAAS,WAAW,SAAS,IAAIN,CAAI,CAAC,EAAE,YACtDS,EAAUD,IAAgB,IAAA,GAAY,IAAA,GAAYE,EAAapB,CAAK,CAAC,CAAC,SAAS,KAAK,GAAWmB,EAAQ,OAASD,CAAW,EACjI,GAAI,CAACC,EAAS,MAAO,CAAC,EACtB,IAAME,EAAQF,EAAQ,OAAS,CAAC,EAChC,OAAOE,EAAM,QAAQ,GAAQ,CACzB,IAAMC,EAAOC,EAAK,OAASA,EAAK,KAEhC,GADIF,EAAM,OAAO,IAAUG,EAAM,OAASA,EAAM,QAAUF,CAAI,CAAC,CAAC,SAAW,GAAKH,EAAQ,WAAW,KAAK,GAAYM,EAAS,OAASH,CAAI,GACtI,CAACC,EAAK,OAASF,EAAM,OAAO,GAASG,EAAM,OAASD,EAAK,IAAI,CAAC,CAAC,SAAW,EAAG,MAAO,CAAC,EACzF,IAAMG,EAASV,EAAS,WAAW,QAAQ,CAAE,QAAO,WAAYW,EAAM,OAASJ,EAAK,MAAQ,CAAC,GAAGK,EAAOD,EAAM,IAAI,CAAC,CAAC,KAAK,GAAG,IAAMJ,EAAK,IAAI,EAE1I,OADIG,EAAO,SAAW,EACfA,EAAO,EAAE,CAAC,MAAM,WAAW,OAAO,GAAY,GAAGJ,EAAK,GAAGG,EAAS,OAAO,WAAWV,CAAM,CAAC,CAAC,CAAC,IAAI,IAAa,CACjH,MAAO,GAAGO,EAAK,GAAGG,EAAS,OAC3B,WAAYV,EAAO,SAAS,GAAG,EAAIU,EAAS,KAAO,GAAGH,EAAK,GAAGG,EAAS,OACvE,cAAe,8MACnB,EAAE,EAL8B,CAAC,CAMrC,CAAC,CACL"}
1
+ {"version":3,"file":"command-read-completions.js","names":["lines","symbols","document","source","fences","fenceMap","index","text","chain","enclosingChain","line","indentOf","before","operand","mapping","prefix","analysis","responseAnalysis","commandLine","command","scanDocument","reads","name","read","other","property","models","model","scope"],"sources":["../../command-read-completions.ts"],"sourcesContent":["// Copyright (c) Cratis. All rights reserved.\n// Licensed under the MIT license. See LICENSE file in the project root for full license information.\n\nimport { CompletionEntry } from './completion-items';\nimport { enclosingChain, fenceMap, indentOf } from './document-context';\nimport { responseAnalysis } from './response-analysis';\nimport { DocumentSymbols, scanDocument } from './symbols';\n\nexport function commandReadCompletions(lines: string[], line: number, before: string, symbols: DocumentSymbols): CompletionEntry[] | null {\n const sources = [lines.join('\\n'), ...(symbols.authoringDocuments?.map(document => document.source) ?? symbols.authoringSources ?? [])];\n const protectedMode = sources.some(source => {\n const document = source.split('\\n');\n const fences = fenceMap(document);\n return document.some((text, index) => !fences[index] && /^command\\s+reads\\s+protected\\s*(?:\\/\\/.*)?$/.test(text));\n });\n if (!protectedMode) return null;\n const chain = enclosingChain(lines, fenceMap(lines), line, indentOf(before));\n if (!chain.includes('command')) return null;\n const operand = before.match(/^\\s*require\\s+(?:.*(?:==|!=|>=|<=|>|<|\\band\\b|\\bor\\b)\\s+)?([\\w.]*)$/);\n const mapping = chain[0] === 'produces' ? before.match(/^\\s*\\w+\\s*=\\s*([\\w.]*)$/) : null;\n const prefix = (operand ?? mapping)?.[1];\n if (prefix === undefined) return null;\n const analysis = responseAnalysis(lines, symbols.authoringDocuments ?? symbols.authoringSources?.filter(source => source !== lines.join('\\n')) ?? [], symbols.authoringPlacement, symbols.authoringPath, symbols.authoringPlacementResolved);\n const commandLine = analysis.operations.contexts.get(line)?.commandLine;\n const command = commandLine === undefined ? undefined : scanDocument(lines).commands.find(command => command.line === commandLine);\n if (!command) return [];\n const reads = command.reads ?? [];\n return reads.flatMap(read => {\n const name = read.alias ?? read.view;\n if (reads.filter(other => (other.alias ?? other.view) === name).length !== 1 || command.properties.some(property => property.name === name)) return [];\n if (!read.alias && reads.filter(other => other.view === read.view).length !== 1) return [];\n const models = analysis.readModels.filter(({ model, scope }) => model.name === read.view || [...scope, model.name].join('.') === read.view);\n if (models.length !== 1) return [];\n return models[0].model.properties.filter(property => `${name}.${property.name}`.startsWith(prefix)).map(property => ({\n label: `${name}.${property.name}`,\n insertText: prefix.includes('.') ? property.name : `${name}.${property.name}`,\n documentation: 'Protected read property in require or produces mappings (ESM v25). Required absence rejects before requirements; matching intervening facts conflict at commit. Admission depends on the view and key shape.',\n }));\n });\n}\n"],"mappings":"A,0OAQA,SAAgB,uBAAuB,EAAiB,EAAc,EAAgB,EAAoD,CAOtI,GAAI,CALkB,CADLA,EAAM,KAAK;CAAI,EAAG,GAAIC,EAAQ,oBAAoB,IAAI,GAAYC,EAAS,MAAM,GAAKD,EAAQ,kBAAoB,CAAC,CACxG,CAAC,CAAC,KAAK,GAAU,CACzC,IAAMC,EAAWC,EAAO,MAAM;CAAI,EAC5BC,EAASC,EAASH,CAAQ,EAChC,OAAOA,EAAS,MAAM,EAAM,IAAU,CAACE,EAAOE,IAAU,8CAA8C,KAAKC,CAAI,CAAC,CACpH,CACiB,EAAG,OAAO,KAC3B,IAAMC,EAAQC,EAAeT,EAAOK,EAASL,CAAK,EAAGU,EAAMC,EAASC,CAAM,CAAC,EAC3E,GAAI,CAACJ,EAAM,SAAS,SAAS,EAAG,OAAO,KACvC,IAAMK,EAAUD,EAAO,MAAM,qEAAqE,EAC5FE,EAAUN,EAAM,KAAO,WAAaI,EAAO,MAAM,yBAAyB,EAAI,KAC9EG,GAAUF,GAAWC,EAAA,GAAW,GACtC,GAAIC,IAAW,IAAA,GAAW,OAAO,KACjC,IAAMC,EAAWC,EAAiBjB,EAAOC,EAAQ,oBAAsBA,EAAQ,kBAAkB,OAAO,GAAUE,IAAWH,EAAM,KAAK;CAAI,CAAC,GAAK,CAAC,EAAGC,EAAQ,mBAAoBA,EAAQ,cAAeA,EAAQ,0BAA0B,EACrOiB,EAAcF,EAAS,WAAW,SAAS,IAAIN,CAAI,CAAC,EAAE,YACtDS,EAAUD,IAAgB,IAAA,GAAY,IAAA,GAAYE,EAAapB,CAAK,CAAC,CAAC,SAAS,KAAK,GAAWmB,EAAQ,OAASD,CAAW,EACjI,GAAI,CAACC,EAAS,MAAO,CAAC,EACtB,IAAME,EAAQF,EAAQ,OAAS,CAAC,EAChC,OAAOE,EAAM,QAAQ,GAAQ,CACzB,IAAMC,EAAOC,EAAK,OAASA,EAAK,KAEhC,GADIF,EAAM,OAAO,IAAUG,EAAM,OAASA,EAAM,QAAUF,CAAI,CAAC,CAAC,SAAW,GAAKH,EAAQ,WAAW,KAAK,GAAYM,EAAS,OAASH,CAAI,GACtI,CAACC,EAAK,OAASF,EAAM,OAAO,GAASG,EAAM,OAASD,EAAK,IAAI,CAAC,CAAC,SAAW,EAAG,MAAO,CAAC,EACzF,IAAMG,EAASV,EAAS,WAAW,QAAQ,CAAE,QAAO,WAAYW,EAAM,OAASJ,EAAK,MAAQ,CAAC,GAAGK,EAAOD,EAAM,IAAI,CAAC,CAAC,KAAK,GAAG,IAAMJ,EAAK,IAAI,EAE1I,OADIG,EAAO,SAAW,EACfA,EAAO,EAAE,CAAC,MAAM,WAAW,OAAO,GAAY,GAAGJ,EAAK,GAAGG,EAAS,OAAO,WAAWV,CAAM,CAAC,CAAC,CAAC,IAAI,IAAa,CACjH,MAAO,GAAGO,EAAK,GAAGG,EAAS,OAC3B,WAAYV,EAAO,SAAS,GAAG,EAAIU,EAAS,KAAO,GAAGH,EAAK,GAAGG,EAAS,OACvE,cAAe,8MACnB,EAAE,EAL8B,CAAC,CAMrC,CAAC,CACL,C"}
@@ -1,6 +1,6 @@
1
- import"../../_virtual/_virtual/_rolldown/runtime.js";import{DiagnosticCodes as e}from"../Diagnostics/DiagnosticCodes.js";import{pattern as t}from"../Text/patterns.js";import{splitLines as n}from"../Parsing/SourceLineSplitter.js";import{RefusalDeclarations as r}from"../Parsing/RefusalDeclarations.js";import{ActionSubjectInputs as i}from"../Parsing/ActionSubjectInputs.js";import{resolveActionSubjectApplication as a}from"../Parsing/ActionSubjectResolution.js";import{parseForAuthoring as o}from"../ScreenplayCompiler.js";import{toSyntaxJson as s}from"../Syntax/SyntaxJson.js";import{applyQuickFixEdits as c}from"./QuickFixes.js";function prepareActionSubjectQuickFixes(e,t){if(!/^\s*(?:action\s+|item\s+\w+\s+action\s+)/mu.test(e)||t.documents!==void 0&&t.documents.size>1)return()=>[];let s=o(e,void 0,t.placement);if(!s.success)return()=>[];let c=new r(s.value),l={source:e,options:t,application:s.value,diagnostics:s.diagnostics,declarations:c,resolver:new i(c,[]),lines:n(e),ending:e.includes(`\r
1
+ import"../../_virtual/_virtual/_rolldown/runtime.js";import{DiagnosticCodes as e}from"../Diagnostics/DiagnosticCodes.js";import{resolveActionSubjectApplication as t}from"../Parsing/ActionSubjectResolution.js";import{ActionSubjectInputs as n}from"../Parsing/ActionSubjectInputs.js";import{RefusalDeclarations as r}from"../Parsing/RefusalDeclarations.js";import{splitLines as i}from"../Parsing/SourceLineSplitter.js";import{parseForAuthoring as a}from"../ScreenplayCompiler.js";import{toSyntaxJson as o}from"../Syntax/SyntaxJson.js";import{pattern as s}from"../Text/patterns.js";import{applyQuickFixEdits as c}from"./QuickFixes.js";function prepareActionSubjectQuickFixes(e,o){if(!/^\s*(?:action\s+|item\s+\w+\s+action\s+)/mu.test(e)||o.documents!==void 0&&o.documents.size>1)return()=>[];let s=a(e,void 0,o.placement);if(!s.success)return()=>[];let c=new r(s.value),l={source:e,options:o,application:s.value,diagnostics:s.diagnostics,declarations:c,resolver:new n(c,[]),lines:i(e),ending:e.includes(`\r
2
2
  `)?`\r
3
3
  `:`
4
- `},u=[];a(s.value,e=>u.push(e));let d=u.flatMap(e=>entryFixes(l,e));return(e,t)=>selectFixes(d,e,t)}function selectFixes(e,t,n){return e.filter(e=>(t===void 0||e.line===t)&&(n===void 0||e.diagnosticCode===n))}function entryFixes(t,n){if(n.authored.subject!=null||t.declarations.resolve(n.command,n.context.slice,e=>e.commands)===null||!hasDiagnostic(t,n,e.InferredActionSubject))return[];let r=n.effective.subject??`Screen`,i=candidate(t,n,{subject:r,title:`Make inferred 'for ${r.toLowerCase()}' explicit`}),a=i===void 0?[]:[i];return hasDiagnostic(t,n,e.ChangedActionSubject)?[...a,...changedFixes(t,n)]:a}function hasDiagnostic(e,t,n){return e.diagnostics.some(e=>e.location.line===t.authored.location.line&&e.code===n)}function changedFixes(t,n){let r=[{subject:`Item`,title:`Use 'for item' (item-bound action)`},{subject:`Screen`,title:`Use 'for screen' (no selection binding)`}],i=authoredInputs(n),a=t.resolver.legacyInputs(n.command,i,n.context);return a!==null&&a.length>i.length&&r.push({subject:`Item`,title:`Keep legacy row bindings explicitly`,additions:a.slice(i.length)}),r.flatMap(r=>{let i=candidate(t,n,r);return i===void 0?[]:[{...i,diagnosticCode:e.ChangedActionSubject}]})}function authoredInputs(e){return e.authored.kind===`ScreenActionSyntax`?e.authored.inputs??[]:e.authored.parameters.map(e=>({kind:`InteractionArgumentSyntax`,name:e.name,binding:e.binding.path,location:e.location}))}function candidate(n,r,i){let a=n.lines[r.authored.location.line-1],o=t(r.authored.kind===`ScreenActionSyntax`?`^(\\s*action\\s+[\\w.]+)`:`^(\\s*item\\s+\\w+\\s+action\\s+[\\w.]+)`).exec(a.raw);if(o===null)return;let s=[{path:n.options.path,start:a.startOffset+o[0].length,length:0,text:` for ${i.subject.toLowerCase()}`}];i.additions!==void 0&&s.push(inputEdit(n,r,i.additions));let c=replacementNode(r,i);if(matchesExpected(n,r,s,JSON.parse(JSON.stringify(n.application,(e,t)=>t===r.authored?c:t))))return{line:a.number,diagnosticCode:e.InferredActionSubject,title:i.title,scope:`occurrence`,edits:s}}function inputEdit(e,t,n){let r=e.lines[t.authored.location.line-1],i=/^\s*/.exec(r.raw)[0],a=actionEnd(e,t),o=e.lines.find(e=>e.number>r.number&&e.startOffset<a&&e.raw.trim().length>0)?.raw.match(/^\s*/)[0]??`${i} `,s=n.map(e=>inputLine(t,e,o)).join(e.ending)+e.ending;return{path:e.options.path,start:a,length:0,text:(a>0&&e.source[a-1]!==`
5
- `?e.ending:``)+s}}function actionEnd(e,t){let n=e.lines[t.authored.location.line-1],r=/^\s*/.exec(n.raw)[0];return e.lines.find(e=>e.number>n.number&&e.raw.trim().length>0&&/^\s*/.exec(e.raw)[0].length<=r.length)?.startOffset??e.source.length}function inputLine(e,t,n){return`${n}${e.authored.kind===`ScreenActionSyntax`?`with`:`parameter`} ${t.name} from ${e.authored.kind===`ScreenActionSyntax`?``:`data `}${t.binding}`}function replacementNode(e,t){let n=t.additions??[];return e.authored.kind===`ScreenActionSyntax`?{...e.authored,subject:t.subject,inputs:[...e.authored.inputs??[],...n]}:{...e.authored,subject:t.subject,parameters:[...e.authored.parameters,...n.map(e=>({kind:`ScreenNavigationParameterSyntax`,name:e.name,binding:{kind:`UiBindingSyntax`,bindingKind:`DataContext`,path:e.binding,query:null,componentId:null,componentPropertyPath:null,mode:null,nullBehavior:null,expectedValueType:null,literal:null,rawText:null,location:e.location},location:e.location}))]}}function matchesExpected(t,n,r,i){let a=c(t.source,r);if(a===void 0)return!1;let l=o(a,void 0,t.options.placement);return!l.success||JSON.stringify(s(l.value))!==JSON.stringify(s(i))?!1:!l.diagnostics.some(t=>t.location.line===n.authored.location.line&&(t.code===e.InferredActionSubject||t.code===e.ChangedActionSubject))}export{prepareActionSubjectQuickFixes};
4
+ `},u=[];t(s.value,e=>u.push(e));let d=u.flatMap(e=>entryFixes(l,e));return(e,t)=>selectFixes(d,e,t)}function selectFixes(e,t,n){return e.filter(e=>(t===void 0||e.line===t)&&(n===void 0||e.diagnosticCode===n))}function entryFixes(t,n){if(n.authored.subject!=null||t.declarations.resolve(n.command,n.context.slice,e=>e.commands)===null||!hasDiagnostic(t,n,e.InferredActionSubject))return[];let r=n.effective.subject??`Screen`,i=candidate(t,n,{subject:r,title:`Make inferred 'for ${r.toLowerCase()}' explicit`}),a=i===void 0?[]:[i];return hasDiagnostic(t,n,e.ChangedActionSubject)?[...a,...changedFixes(t,n)]:a}function hasDiagnostic(e,t,n){return e.diagnostics.some(e=>e.location.line===t.authored.location.line&&e.code===n)}function changedFixes(t,n){let r=[{subject:`Item`,title:`Use 'for item' (item-bound action)`},{subject:`Screen`,title:`Use 'for screen' (no selection binding)`}],i=authoredInputs(n),a=t.resolver.legacyInputs(n.command,i,n.context);return a!==null&&a.length>i.length&&r.push({subject:`Item`,title:`Keep legacy row bindings explicitly`,additions:a.slice(i.length)}),r.flatMap(r=>{let i=candidate(t,n,r);return i===void 0?[]:[{...i,diagnosticCode:e.ChangedActionSubject}]})}function authoredInputs(e){return e.authored.kind===`ScreenActionSyntax`?e.authored.inputs??[]:e.authored.parameters.map(e=>({kind:`InteractionArgumentSyntax`,name:e.name,binding:e.binding.path,location:e.location}))}function candidate(t,n,r){let i=t.lines[n.authored.location.line-1],a=s(n.authored.kind===`ScreenActionSyntax`?`^(\\s*action\\s+[\\w.]+)`:`^(\\s*item\\s+\\w+\\s+action\\s+[\\w.]+)`).exec(i.raw);if(a===null)return;let o=[{path:t.options.path,start:i.startOffset+a[0].length,length:0,text:` for ${r.subject.toLowerCase()}`}];r.additions!==void 0&&o.push(inputEdit(t,n,r.additions));let c=replacementNode(n,r);if(matchesExpected(t,n,o,JSON.parse(JSON.stringify(t.application,(e,t)=>t===n.authored?c:t))))return{line:i.number,diagnosticCode:e.InferredActionSubject,title:r.title,scope:`occurrence`,edits:o}}function inputEdit(e,t,n){let r=e.lines[t.authored.location.line-1],i=/^\s*/.exec(r.raw)[0],a=actionEnd(e,t),o=e.lines.find(e=>e.number>r.number&&e.startOffset<a&&e.raw.trim().length>0)?.raw.match(/^\s*/)[0]??`${i} `,s=n.map(e=>inputLine(t,e,o)).join(e.ending)+e.ending;return{path:e.options.path,start:a,length:0,text:(a>0&&e.source[a-1]!==`
5
+ `?e.ending:``)+s}}function actionEnd(e,t){let n=e.lines[t.authored.location.line-1],r=/^\s*/.exec(n.raw)[0];return e.lines.find(e=>e.number>n.number&&e.raw.trim().length>0&&/^\s*/.exec(e.raw)[0].length<=r.length)?.startOffset??e.source.length}function inputLine(e,t,n){return`${n}${e.authored.kind===`ScreenActionSyntax`?`with`:`parameter`} ${t.name} from ${e.authored.kind===`ScreenActionSyntax`?``:`data `}${t.binding}`}function replacementNode(e,t){let n=t.additions??[];return e.authored.kind===`ScreenActionSyntax`?{...e.authored,subject:t.subject,inputs:[...e.authored.inputs??[],...n]}:{...e.authored,subject:t.subject,parameters:[...e.authored.parameters,...n.map(e=>({kind:`ScreenNavigationParameterSyntax`,name:e.name,binding:{kind:`UiBindingSyntax`,bindingKind:`DataContext`,path:e.binding,query:null,componentId:null,componentPropertyPath:null,mode:null,nullBehavior:null,expectedValueType:null,literal:null,rawText:null,location:e.location},location:e.location}))]}}function matchesExpected(t,n,r,i){let s=c(t.source,r);if(s===void 0)return!1;let l=a(s,void 0,t.options.placement);return!l.success||JSON.stringify(o(l.value))!==JSON.stringify(o(i))?!1:!l.diagnostics.some(t=>t.location.line===n.authored.location.line&&(t.code===e.InferredActionSubject||t.code===e.ChangedActionSubject))}export{prepareActionSubjectQuickFixes};
6
6
  //# sourceMappingURL=ActionSubjectQuickFixes.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"ActionSubjectQuickFixes.js","names":["source","options","original","parseForAuthoring","declarations","RefusalDeclarations","context","ActionSubjectInputs","splitLines","evidence","resolveActionSubjectApplication","entry","fixes","line","code","fix","slice","DiagnosticCodes","subject","explicit","diagnostic","proposals","authored","retained","proposal","parameter","header","pattern","edits","replacement","value","prefix","end","indent","child","text","additions","input","edited","applyQuickFixEdits","parsed","toSyntaxJson","expected"],"sources":["../../../../../../Compiler/Authoring/ActionSubjectQuickFixes.ts"],"sourcesContent":["// Copyright (c) Cratis. All rights reserved.\n// Licensed under the MIT license. See LICENSE file in the project root for full license information.\n\nimport { Diagnostic } from '../Diagnostics/Diagnostic';\nimport { DiagnosticCodes } from '../Diagnostics/DiagnosticCodes';\nimport { ActionSubjectEvidence, resolveActionSubjectApplication } from '../Parsing/ActionSubjectResolution';\nimport { ActionSubjectInputs } from '../Parsing/ActionSubjectInputs';\nimport { RefusalDeclarations } from '../Parsing/RefusalDeclarations';\nimport { splitLines } from '../Parsing/SourceLineSplitter';\nimport { parseForAuthoring } from '../ScreenplayCompiler';\nimport { InteractionArgumentSyntax, ScreenActionSubjectKind } from '../Syntax/Screens';\nimport { ApplicationSyntax } from '../Syntax/Structure';\nimport { toSyntaxJson } from '../Syntax/SyntaxJson';\nimport { pattern } from '../Text/patterns';\nimport { applyQuickFixEdits, QuickFix, QuickFixEdit, QuickFixOptions } from './QuickFixes';\n\ntype Options = Pick<QuickFixOptions, 'placement' | 'path' | 'documents'>;\ninterface RepairContext {\n source: string;\n options: Options;\n application: ApplicationSyntax;\n diagnostics: readonly Diagnostic[];\n declarations: RefusalDeclarations;\n resolver: ActionSubjectInputs;\n lines: ReturnType<typeof splitLines>;\n ending: string;\n}\ninterface Proposal {\n subject: ScreenActionSubjectKind;\n title: string;\n additions?: readonly InteractionArgumentSyntax[];\n}\n\nexport function prepareActionSubjectQuickFixes(source: string, options: Options): (line?: number, code?: string) => QuickFix[] {\n if (!/^\\s*(?:action\\s+|item\\s+\\w+\\s+action\\s+)/mu.test(source)) return () => [];\n // Imported application snapshots belong to the native workspace; never guess missing declarations in a buffer.\n if (options.documents !== undefined && options.documents.size > 1) return () => [];\n const original = parseForAuthoring(source, undefined, options.placement);\n if (!original.success) return () => [];\n const declarations = new RefusalDeclarations(original.value);\n const context: RepairContext = { source, options, application: original.value, diagnostics: original.diagnostics, declarations,\n resolver: new ActionSubjectInputs(declarations, []), lines: splitLines(source), ending: source.includes('\\r\\n') ? '\\r\\n' : '\\n' };\n const evidence: ActionSubjectEvidence[] = [];\n resolveActionSubjectApplication(original.value, entry => evidence.push(entry));\n const fixes = evidence.flatMap(entry => entryFixes(context, entry));\n return (line, code) => selectFixes(fixes, line, code);\n}\n\nfunction selectFixes(fixes: QuickFix[], line?: number, code?: string): QuickFix[] {\n return fixes.filter(fix => (line === undefined || fix.line === line) && (code === undefined || fix.diagnosticCode === code));\n}\n\nfunction entryFixes(context: RepairContext, entry: ActionSubjectEvidence): QuickFix[] {\n if (entry.authored.subject != null || context.declarations.resolve(entry.command, entry.context.slice, slice => slice.commands) === null) return [];\n if (!hasDiagnostic(context, entry, DiagnosticCodes.InferredActionSubject)) return [];\n const subject = entry.effective.subject ?? 'Screen';\n const explicit = candidate(context, entry, { subject, title: `Make inferred 'for ${subject.toLowerCase()}' explicit` });\n const fixes = explicit === undefined ? [] : [explicit];\n return hasDiagnostic(context, entry, DiagnosticCodes.ChangedActionSubject) ? [...fixes, ...changedFixes(context, entry)] : fixes;\n}\n\nfunction hasDiagnostic(context: RepairContext, entry: ActionSubjectEvidence, code: string): boolean {\n return context.diagnostics.some(diagnostic => diagnostic.location.line === entry.authored.location.line && diagnostic.code === code);\n}\n\nfunction changedFixes(context: RepairContext, entry: ActionSubjectEvidence): QuickFix[] {\n const proposals: Proposal[] = [\n { subject: 'Item', title: \"Use 'for item' (item-bound action)\" },\n { subject: 'Screen', title: \"Use 'for screen' (no selection binding)\" },\n ];\n const authored = authoredInputs(entry);\n const retained = context.resolver.legacyInputs(entry.command, authored, entry.context);\n if (retained !== null && retained.length > authored.length) proposals.push({ subject: 'Item', title: 'Keep legacy row bindings explicitly', additions: retained.slice(authored.length) });\n return proposals.flatMap(proposal => {\n const fix = candidate(context, entry, proposal);\n return fix === undefined ? [] : [{ ...fix, diagnosticCode: DiagnosticCodes.ChangedActionSubject }];\n });\n}\n\nfunction authoredInputs(entry: ActionSubjectEvidence): readonly InteractionArgumentSyntax[] {\n return entry.authored.kind === 'ScreenActionSyntax' ? entry.authored.inputs ?? [] : entry.authored.parameters.map(parameter => ({ kind: 'InteractionArgumentSyntax', name: parameter.name, binding: parameter.binding.path, location: parameter.location }));\n}\n\nfunction candidate(context: RepairContext, entry: ActionSubjectEvidence, proposal: Proposal): QuickFix | undefined {\n const line = context.lines[entry.authored.location.line - 1];\n const header = pattern(entry.authored.kind === 'ScreenActionSyntax' ? '^(\\\\s*action\\\\s+[\\\\w.]+)' : '^(\\\\s*item\\\\s+\\\\w+\\\\s+action\\\\s+[\\\\w.]+)').exec(line.raw);\n if (header === null) return undefined;\n const edits: QuickFixEdit[] = [{ path: context.options.path, start: line.startOffset + header[0].length, length: 0, text: ` for ${proposal.subject.toLowerCase()}` }];\n if (proposal.additions !== undefined) edits.push(inputEdit(context, entry, proposal.additions));\n const replacement = replacementNode(entry, proposal);\n const expected = JSON.parse(JSON.stringify(context.application, (_key, value: unknown) => value === entry.authored ? replacement : value)) as ApplicationSyntax;\n if (!matchesExpected(context, entry, edits, expected)) return undefined;\n return { line: line.number, diagnosticCode: DiagnosticCodes.InferredActionSubject, title: proposal.title, scope: 'occurrence', edits };\n}\n\nfunction inputEdit(context: RepairContext, entry: ActionSubjectEvidence, additions: readonly InteractionArgumentSyntax[]): QuickFixEdit {\n const line = context.lines[entry.authored.location.line - 1];\n const prefix = /^\\s*/.exec(line.raw)![0];\n const end = actionEnd(context, entry);\n const indent = context.lines.find(child => child.number > line.number && child.startOffset < end && child.raw.trim().length > 0)?.raw.match(/^\\s*/)![0] ?? `${prefix} `;\n const text = additions.map(input => inputLine(entry, input, indent)).join(context.ending) + context.ending;\n return { path: context.options.path, start: end, length: 0, text: (end > 0 && context.source[end - 1] !== '\\n' ? context.ending : '') + text };\n}\n\nfunction actionEnd(context: RepairContext, entry: ActionSubjectEvidence): number {\n const line = context.lines[entry.authored.location.line - 1];\n const prefix = /^\\s*/.exec(line.raw)![0];\n return context.lines.find(child => child.number > line.number && child.raw.trim().length > 0 && /^\\s*/.exec(child.raw)![0].length <= prefix.length)?.startOffset ?? context.source.length;\n}\n\nfunction inputLine(entry: ActionSubjectEvidence, input: InteractionArgumentSyntax, indent: string): string {\n return `${indent}${entry.authored.kind === 'ScreenActionSyntax' ? 'with' : 'parameter'} ${input.name} from ${entry.authored.kind === 'ScreenActionSyntax' ? '' : 'data '}${input.binding}`;\n}\n\nfunction replacementNode(entry: ActionSubjectEvidence, proposal: Proposal): ActionSubjectEvidence['authored'] {\n const additions = proposal.additions ?? [];\n return entry.authored.kind === 'ScreenActionSyntax'\n ? { ...entry.authored, subject: proposal.subject, inputs: [...(entry.authored.inputs ?? []), ...additions] }\n : { ...entry.authored, subject: proposal.subject, parameters: [...entry.authored.parameters, ...additions.map(input => ({ kind: 'ScreenNavigationParameterSyntax' as const, name: input.name, binding: { kind: 'UiBindingSyntax' as const, bindingKind: 'DataContext' as const, path: input.binding, query: null, componentId: null, componentPropertyPath: null, mode: null, nullBehavior: null, expectedValueType: null, literal: null, rawText: null, location: input.location }, location: input.location }))] };\n}\n\nfunction matchesExpected(context: RepairContext, entry: ActionSubjectEvidence, edits: QuickFixEdit[], expected: ApplicationSyntax): boolean {\n const edited = applyQuickFixEdits(context.source, edits);\n if (edited === undefined) return false;\n const parsed = parseForAuthoring(edited, undefined, context.options.placement);\n if (!parsed.success || JSON.stringify(toSyntaxJson(parsed.value)) !== JSON.stringify(toSyntaxJson(expected))) return false;\n return !parsed.diagnostics.some(diagnostic => diagnostic.location.line === entry.authored.location.line && (diagnostic.code === DiagnosticCodes.InferredActionSubject || diagnostic.code === DiagnosticCodes.ChangedActionSubject));\n}\n"],"mappings":"snBAiCA,SAAgB,+BAA+B,EAAgB,EAAgE,CAG3H,GAFI,CAAC,6CAA6C,KAAKA,CAAM,GAEzDC,EAAQ,YAAc,IAAA,IAAaA,EAAQ,UAAU,KAAO,EAAG,UAAa,CAAC,EACjF,IAAMC,EAAWC,EAAkBH,EAAQ,IAAA,GAAWC,EAAQ,SAAS,EACvE,GAAI,CAACC,EAAS,QAAS,UAAa,CAAC,EACrC,IAAME,EAAe,IAAIC,EAAoBH,EAAS,KAAK,EACrDI,EAAyB,CAAE,SAAQ,UAAS,YAAaJ,EAAS,MAAO,YAAaA,EAAS,YAAa,eAC9G,SAAU,IAAIK,EAAoBH,EAAc,CAAC,CAAC,EAAG,MAAOI,EAAWR,CAAM,EAAG,OAAQA,EAA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"}
1
+ {"version":3,"file":"ActionSubjectQuickFixes.js","names":["source","options","original","parseForAuthoring","declarations","RefusalDeclarations","context","ActionSubjectInputs","splitLines","evidence","resolveActionSubjectApplication","entry","fixes","line","code","fix","slice","DiagnosticCodes","subject","explicit","diagnostic","proposals","authored","retained","proposal","parameter","header","pattern","edits","replacement","value","prefix","end","indent","child","text","additions","input","edited","applyQuickFixEdits","parsed","toSyntaxJson","expected"],"sources":["../../../../../../Compiler/Authoring/ActionSubjectQuickFixes.ts"],"sourcesContent":["// Copyright (c) Cratis. All rights reserved.\n// Licensed under the MIT license. See LICENSE file in the project root for full license information.\n\nimport { Diagnostic } from '../Diagnostics/Diagnostic';\nimport { DiagnosticCodes } from '../Diagnostics/DiagnosticCodes';\nimport { ActionSubjectEvidence, resolveActionSubjectApplication } from '../Parsing/ActionSubjectResolution';\nimport { ActionSubjectInputs } from '../Parsing/ActionSubjectInputs';\nimport { RefusalDeclarations } from '../Parsing/RefusalDeclarations';\nimport { splitLines } from '../Parsing/SourceLineSplitter';\nimport { parseForAuthoring } from '../ScreenplayCompiler';\nimport { InteractionArgumentSyntax, ScreenActionSubjectKind } from '../Syntax/Screens';\nimport { ApplicationSyntax } from '../Syntax/Structure';\nimport { toSyntaxJson } from '../Syntax/SyntaxJson';\nimport { pattern } from '../Text/patterns';\nimport { applyQuickFixEdits, QuickFix, QuickFixEdit, QuickFixOptions } from './QuickFixes';\n\ntype Options = Pick<QuickFixOptions, 'placement' | 'path' | 'documents'>;\ninterface RepairContext {\n source: string;\n options: Options;\n application: ApplicationSyntax;\n diagnostics: readonly Diagnostic[];\n declarations: RefusalDeclarations;\n resolver: ActionSubjectInputs;\n lines: ReturnType<typeof splitLines>;\n ending: string;\n}\ninterface Proposal {\n subject: ScreenActionSubjectKind;\n title: string;\n additions?: readonly InteractionArgumentSyntax[];\n}\n\nexport function prepareActionSubjectQuickFixes(source: string, options: Options): (line?: number, code?: string) => QuickFix[] {\n if (!/^\\s*(?:action\\s+|item\\s+\\w+\\s+action\\s+)/mu.test(source)) return () => [];\n // Imported application snapshots belong to the native workspace; never guess missing declarations in a buffer.\n if (options.documents !== undefined && options.documents.size > 1) return () => [];\n const original = parseForAuthoring(source, undefined, options.placement);\n if (!original.success) return () => [];\n const declarations = new RefusalDeclarations(original.value);\n const context: RepairContext = { source, options, application: original.value, diagnostics: original.diagnostics, declarations,\n resolver: new ActionSubjectInputs(declarations, []), lines: splitLines(source), ending: source.includes('\\r\\n') ? '\\r\\n' : '\\n' };\n const evidence: ActionSubjectEvidence[] = [];\n resolveActionSubjectApplication(original.value, entry => evidence.push(entry));\n const fixes = evidence.flatMap(entry => entryFixes(context, entry));\n return (line, code) => selectFixes(fixes, line, code);\n}\n\nfunction selectFixes(fixes: QuickFix[], line?: number, code?: string): QuickFix[] {\n return fixes.filter(fix => (line === undefined || fix.line === line) && (code === undefined || fix.diagnosticCode === code));\n}\n\nfunction entryFixes(context: RepairContext, entry: ActionSubjectEvidence): QuickFix[] {\n if (entry.authored.subject != null || context.declarations.resolve(entry.command, entry.context.slice, slice => slice.commands) === null) return [];\n if (!hasDiagnostic(context, entry, DiagnosticCodes.InferredActionSubject)) return [];\n const subject = entry.effective.subject ?? 'Screen';\n const explicit = candidate(context, entry, { subject, title: `Make inferred 'for ${subject.toLowerCase()}' explicit` });\n const fixes = explicit === undefined ? [] : [explicit];\n return hasDiagnostic(context, entry, DiagnosticCodes.ChangedActionSubject) ? [...fixes, ...changedFixes(context, entry)] : fixes;\n}\n\nfunction hasDiagnostic(context: RepairContext, entry: ActionSubjectEvidence, code: string): boolean {\n return context.diagnostics.some(diagnostic => diagnostic.location.line === entry.authored.location.line && diagnostic.code === code);\n}\n\nfunction changedFixes(context: RepairContext, entry: ActionSubjectEvidence): QuickFix[] {\n const proposals: Proposal[] = [\n { subject: 'Item', title: \"Use 'for item' (item-bound action)\" },\n { subject: 'Screen', title: \"Use 'for screen' (no selection binding)\" },\n ];\n const authored = authoredInputs(entry);\n const retained = context.resolver.legacyInputs(entry.command, authored, entry.context);\n if (retained !== null && retained.length > authored.length) proposals.push({ subject: 'Item', title: 'Keep legacy row bindings explicitly', additions: retained.slice(authored.length) });\n return proposals.flatMap(proposal => {\n const fix = candidate(context, entry, proposal);\n return fix === undefined ? [] : [{ ...fix, diagnosticCode: DiagnosticCodes.ChangedActionSubject }];\n });\n}\n\nfunction authoredInputs(entry: ActionSubjectEvidence): readonly InteractionArgumentSyntax[] {\n return entry.authored.kind === 'ScreenActionSyntax' ? entry.authored.inputs ?? [] : entry.authored.parameters.map(parameter => ({ kind: 'InteractionArgumentSyntax', name: parameter.name, binding: parameter.binding.path, location: parameter.location }));\n}\n\nfunction candidate(context: RepairContext, entry: ActionSubjectEvidence, proposal: Proposal): QuickFix | undefined {\n const line = context.lines[entry.authored.location.line - 1];\n const header = pattern(entry.authored.kind === 'ScreenActionSyntax' ? '^(\\\\s*action\\\\s+[\\\\w.]+)' : '^(\\\\s*item\\\\s+\\\\w+\\\\s+action\\\\s+[\\\\w.]+)').exec(line.raw);\n if (header === null) return undefined;\n const edits: QuickFixEdit[] = [{ path: context.options.path, start: line.startOffset + header[0].length, length: 0, text: ` for ${proposal.subject.toLowerCase()}` }];\n if (proposal.additions !== undefined) edits.push(inputEdit(context, entry, proposal.additions));\n const replacement = replacementNode(entry, proposal);\n const expected = JSON.parse(JSON.stringify(context.application, (_key, value: unknown) => value === entry.authored ? replacement : value)) as ApplicationSyntax;\n if (!matchesExpected(context, entry, edits, expected)) return undefined;\n return { line: line.number, diagnosticCode: DiagnosticCodes.InferredActionSubject, title: proposal.title, scope: 'occurrence', edits };\n}\n\nfunction inputEdit(context: RepairContext, entry: ActionSubjectEvidence, additions: readonly InteractionArgumentSyntax[]): QuickFixEdit {\n const line = context.lines[entry.authored.location.line - 1];\n const prefix = /^\\s*/.exec(line.raw)![0];\n const end = actionEnd(context, entry);\n const indent = context.lines.find(child => child.number > line.number && child.startOffset < end && child.raw.trim().length > 0)?.raw.match(/^\\s*/)![0] ?? `${prefix} `;\n const text = additions.map(input => inputLine(entry, input, indent)).join(context.ending) + context.ending;\n return { path: context.options.path, start: end, length: 0, text: (end > 0 && context.source[end - 1] !== '\\n' ? context.ending : '') + text };\n}\n\nfunction actionEnd(context: RepairContext, entry: ActionSubjectEvidence): number {\n const line = context.lines[entry.authored.location.line - 1];\n const prefix = /^\\s*/.exec(line.raw)![0];\n return context.lines.find(child => child.number > line.number && child.raw.trim().length > 0 && /^\\s*/.exec(child.raw)![0].length <= prefix.length)?.startOffset ?? context.source.length;\n}\n\nfunction inputLine(entry: ActionSubjectEvidence, input: InteractionArgumentSyntax, indent: string): string {\n return `${indent}${entry.authored.kind === 'ScreenActionSyntax' ? 'with' : 'parameter'} ${input.name} from ${entry.authored.kind === 'ScreenActionSyntax' ? '' : 'data '}${input.binding}`;\n}\n\nfunction replacementNode(entry: ActionSubjectEvidence, proposal: Proposal): ActionSubjectEvidence['authored'] {\n const additions = proposal.additions ?? [];\n return entry.authored.kind === 'ScreenActionSyntax'\n ? { ...entry.authored, subject: proposal.subject, inputs: [...(entry.authored.inputs ?? []), ...additions] }\n : { ...entry.authored, subject: proposal.subject, parameters: [...entry.authored.parameters, ...additions.map(input => ({ kind: 'ScreenNavigationParameterSyntax' as const, name: input.name, binding: { kind: 'UiBindingSyntax' as const, bindingKind: 'DataContext' as const, path: input.binding, query: null, componentId: null, componentPropertyPath: null, mode: null, nullBehavior: null, expectedValueType: null, literal: null, rawText: null, location: input.location }, location: input.location }))] };\n}\n\nfunction matchesExpected(context: RepairContext, entry: ActionSubjectEvidence, edits: QuickFixEdit[], expected: ApplicationSyntax): boolean {\n const edited = applyQuickFixEdits(context.source, edits);\n if (edited === undefined) return false;\n const parsed = parseForAuthoring(edited, undefined, context.options.placement);\n if (!parsed.success || JSON.stringify(toSyntaxJson(parsed.value)) !== JSON.stringify(toSyntaxJson(expected))) return false;\n return !parsed.diagnostics.some(diagnostic => diagnostic.location.line === entry.authored.location.line && (diagnostic.code === DiagnosticCodes.Inferred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,QAAS,EAAG,SAAUA,EAAM,QAAS,EAAE,CAAC,CAAE,CAC3f,CAEA,SAAS,gBAAgB,EAAwB,EAA8B,EAAuB,EAAsC,CACxI,IAAMC,EAASC,EAAmBjC,EAAQ,OAAQsB,CAAK,EACvD,GAAIU,IAAW,IAAA,GAAW,MAAO,GACjC,IAAME,EAASrC,EAAkBmC,EAAQ,IAAA,GAAWhC,EAAQ,QAAQ,SAAS,EAE7E,MADI,CAACkC,EAAO,SAAW,KAAK,UAAUC,EAAaD,EAAO,KAAK,CAAC,IAAM,KAAK,UAAUC,EAAaC,CAAQ,CAAC,EAAU,GAC9G,CAACF,EAAO,YAAY,KAAK,GAAcpB,EAAW,SAAS,OAAST,EAAM,SAAS,SAAS,OAASS,EAAW,OAASH,EAAgB,uBAAyBG,EAAW,OAASH,EAAgB,qBAAqB,CACtO,C"}
@@ -1,9 +1,9 @@
1
- import"../../_virtual/_virtual/_rolldown/runtime.js";import{DiagnosticCodes as e}from"../Diagnostics/DiagnosticCodes.js";import{checkPortableMatchPattern as t}from"../Parsing/checkPortableMatchPattern.js";import{stringBodyPattern as n}from"../Text/StringLiteral.js";import{pattern as r}from"../Text/patterns.js";import{complianceWireName as i}from"../Parsing/ConceptComplianceParser.js";import{commentStart as a,splitLines as o}from"../Parsing/SourceLineSplitter.js";import{implicitConjunctionTokens as s,isAuthorizeContinuation as c}from"../Parsing/AuthorizeParser.js";import{ScreenplaySyntaxWalker as l}from"../Syntax/ScreenplaySyntaxWalker.js";import{parseForAuthoring as u}from"../ScreenplayCompiler.js";import{prepareTimelineQuickFixes as d}from"./TimelineQuickFixes.js";import{prepareActionSubjectQuickFixes as f}from"./ActionSubjectQuickFixes.js";import{rewriteInlineJson as p}from"./StructuredValueQuickFix.js";const m=/* @__PURE__ */ new Set([e.InferredActionSubject,e.ChangedActionSubject,e.EventFromLaterSlice,e.DeprecatedStudioTextRulePattern,e.DuplicateComplianceMarker,e.LegacyOptionalSuffix,e.LegacyComplianceMarker,e.RedundantEventId,e.PublicTranslationRequiresDirection,e.LegacyProfileLayout,e.RedundantCompositeKeyBraces,e.ImplicitAuthorizationConjunction,e.InlineJsonValue]);function isQuickFixDiagnostic(e){return m.has(e)}function legacyOptionalTypeLength(t,n){return n.code===e.LegacyOptionalSuffix?/^[\p{L}\p{Mn}\p{Nd}\p{Pc}.]+(?:\[\])?\?/u.exec(t.slice(n.location.column-1))?.[0].length??0:0}function prepareQuickFixes(t,n={}){let r=prepareLocalQuickFixes(t,n),i,a,subjectFixes=(e,r)=>(a??=f(t,n))(e,r);return(a,o)=>{let s=typeof a==`number`?[{line:a,diagnosticCode:o}]:a??[],c=r(a,o),l=s.filter(t=>t.diagnosticCode===e.EventFromLaterSlice||t.diagnosticCode===void 0&&c.length===0),u=l.length===0?[]:[...new Set(l.map(e=>e.line))].flatMap(e=>(i??=d(t,n))(e)),f=s.filter(t=>t.diagnosticCode===void 0||t.diagnosticCode===e.InferredActionSubject||t.diagnosticCode===e.ChangedActionSubject),p=s.length===0?subjectFixes(void 0,o):f.flatMap(e=>subjectFixes(e.line,e.diagnosticCode));return[...c,...u,...p]}}function prepareLocalQuickFixes(r,i){let s=u(r,void 0,i.placement),c=/* @__PURE__ */ new Set([...Array.from({length:14},(e,t)=>`PLAY0${607+t}`),e.InlineJsonValue]),acceptable=e=>e.success||e.diagnostics.every(e=>e.severity!==`error`||c.has(e.code)),errorCodes=e=>new Set(e.diagnostics.filter(e=>e.severity===`error`).map(e=>e.code));if(!acceptable(s))return()=>[];let d=o(r),f=/* @__PURE__ */ new Map,m=/* @__PURE__ */ new Map,h=/* @__PURE__ */ new Map;new class extends l{visitValidationRule(e){h.set(e.location.line,e),super.visitValidationRule(e)}visitEvent(e){f.set(e.location.line,e)}visitSlice(e){m.set(e.location.line,e),super.visitSlice(e)}}().visitApplication(s.value);let g=/* @__PURE__ */ new Map,_=/* @__PURE__ */ new Map,v=/* @__PURE__ */ new Map,y=/* @__PURE__ */ new Map,b=/* @__PURE__ */ new Map,x;for(let e of d)x=f.get(e.number)??x,x!==void 0&&b.set(e.number,x);for(let o of s.diagnostics){g.set(o.code,(g.get(o.code)??0)+1);let c=d[o.location.line-1];if(o.code===e.DuplicateComplianceMarker){let e=duplicateComplianceMarkerEdit(c.raw,c.startOffset);e!==void 0&&v.set(c.number,{diagnosticCode:o.code,title:`Remove duplicate compliance markers`,scope:`occurrence`,edits:[e]})}let l=legacyOptionalTypeLength(c.raw,o);if(l>0)_.set(c.number,{line:c.number,fix:{diagnosticCode:o.code,title:`Use 'optional' instead of '?'`,scope:`occurrence`,edits:[{start:c.startOffset+o.location.column+l-2,length:1,text:` optional`}]}});else if(o.code===e.DeprecatedStudioTextRulePattern){let e=h.get(c.number);if(e?.rule!==`Matches`||e.value?.kind!==`LiteralExpressionSyntax`||typeof e.value.value!=`string`)continue;let r=t(e.value.value).replacement,i=RegExp(`\\bmatches\\s+"${n}"`).exec(c.raw);if(r===void 0||i===null)continue;let a={Equal:`==`,NotEqual:`!=`,Contains:`contains`,NotContains:`not contains`,StartsWith:`starts with`,EndsWith:`ends with`},s=`"`+r.value.replace(/["\\\n\r\t]/g,e=>JSON.stringify(e).slice(1,-1))+`"`;_.set(c.number,{line:c.number,fix:{diagnosticCode:o.code,title:`Use the equivalent ordinal text rule`,scope:`occurrence`,edits:[{start:c.startOffset+i.index,length:i[0].length,text:a[r.kind]+` `+s}]},change:{node:e,replacement:{...e,rule:r.kind,value:{...e.value,value:r.value}}}})}else if(o.code===e.LegacyComplianceMarker){let e=complianceMarkerEdit(c.raw,c.startOffset);e!==void 0&&_.set(c.number,{line:c.number,fix:{diagnosticCode:o.code,title:`Use bare pii and secret compliance markers`,scope:`occurrence`,edits:[e]}})}else if(o.code===e.PublicTranslationRequiresDirection){let t=m.get(c.number),n=/^\s*/.exec(c.raw)[0],a=r.includes(`\r
1
+ import"../../_virtual/_virtual/_rolldown/runtime.js";import{DiagnosticCodes as e}from"../Diagnostics/DiagnosticCodes.js";import{checkPortableMatchPattern as t}from"../Parsing/checkPortableMatchPattern.js";import{stringBodyPattern as n}from"../Text/StringLiteral.js";import{complianceWireName as r}from"../Parsing/ConceptComplianceParser.js";import{commentStart as i,splitLines as a}from"../Parsing/SourceLineSplitter.js";import{implicitConjunctionTokens as o,isAuthorizeContinuation as s}from"../Parsing/AuthorizeParser.js";import{parseForAuthoring as c}from"../ScreenplayCompiler.js";import{ScreenplaySyntaxWalker as l}from"../Syntax/ScreenplaySyntaxWalker.js";import{pattern as u}from"../Text/patterns.js";import{prepareTimelineQuickFixes as d}from"./TimelineQuickFixes.js";import{prepareActionSubjectQuickFixes as f}from"./ActionSubjectQuickFixes.js";import{rewriteInlineJson as p}from"./StructuredValueQuickFix.js";const m=/* @__PURE__ */ new Set([e.InferredActionSubject,e.ChangedActionSubject,e.EventFromLaterSlice,e.DeprecatedStudioTextRulePattern,e.DuplicateComplianceMarker,e.LegacyOptionalSuffix,e.LegacyComplianceMarker,e.RedundantEventId,e.PublicTranslationRequiresDirection,e.LegacyProfileLayout,e.RedundantCompositeKeyBraces,e.ImplicitAuthorizationConjunction,e.InlineJsonValue]);function isQuickFixDiagnostic(e){return m.has(e)}function legacyOptionalTypeLength(t,n){return n.code===e.LegacyOptionalSuffix?/^[\p{L}\p{Mn}\p{Nd}\p{Pc}.]+(?:\[\])?\?/u.exec(t.slice(n.location.column-1))?.[0].length??0:0}function prepareQuickFixes(t,n={}){let r=prepareLocalQuickFixes(t,n),i,a,subjectFixes=(e,r)=>(a??=f(t,n))(e,r);return(a,o)=>{let s=typeof a==`number`?[{line:a,diagnosticCode:o}]:a??[],c=r(a,o),l=s.filter(t=>t.diagnosticCode===e.EventFromLaterSlice||t.diagnosticCode===void 0&&c.length===0),u=l.length===0?[]:[...new Set(l.map(e=>e.line))].flatMap(e=>(i??=d(t,n))(e)),f=s.filter(t=>t.diagnosticCode===void 0||t.diagnosticCode===e.InferredActionSubject||t.diagnosticCode===e.ChangedActionSubject),p=s.length===0?subjectFixes(void 0,o):f.flatMap(e=>subjectFixes(e.line,e.diagnosticCode));return[...c,...u,...p]}}function prepareLocalQuickFixes(r,o){let s=c(r,void 0,o.placement),u=/* @__PURE__ */ new Set([...Array.from({length:14},(e,t)=>`PLAY0${607+t}`),e.InlineJsonValue]),acceptable=e=>e.success||e.diagnostics.every(e=>e.severity!==`error`||u.has(e.code)),errorCodes=e=>new Set(e.diagnostics.filter(e=>e.severity===`error`).map(e=>e.code));if(!acceptable(s))return()=>[];let d=a(r),f=/* @__PURE__ */ new Map,m=/* @__PURE__ */ new Map,h=/* @__PURE__ */ new Map;new class extends l{visitValidationRule(e){h.set(e.location.line,e),super.visitValidationRule(e)}visitEvent(e){f.set(e.location.line,e)}visitSlice(e){m.set(e.location.line,e),super.visitSlice(e)}}().visitApplication(s.value);let g=/* @__PURE__ */ new Map,_=/* @__PURE__ */ new Map,v=/* @__PURE__ */ new Map,y=/* @__PURE__ */ new Map,b=/* @__PURE__ */ new Map,x;for(let e of d)x=f.get(e.number)??x,x!==void 0&&b.set(e.number,x);for(let a of s.diagnostics){g.set(a.code,(g.get(a.code)??0)+1);let l=d[a.location.line-1];if(a.code===e.DuplicateComplianceMarker){let e=duplicateComplianceMarkerEdit(l.raw,l.startOffset);e!==void 0&&v.set(l.number,{diagnosticCode:a.code,title:`Remove duplicate compliance markers`,scope:`occurrence`,edits:[e]})}let u=legacyOptionalTypeLength(l.raw,a);if(u>0)_.set(l.number,{line:l.number,fix:{diagnosticCode:a.code,title:`Use 'optional' instead of '?'`,scope:`occurrence`,edits:[{start:l.startOffset+a.location.column+u-2,length:1,text:` optional`}]}});else if(a.code===e.DeprecatedStudioTextRulePattern){let e=h.get(l.number);if(e?.rule!==`Matches`||e.value?.kind!==`LiteralExpressionSyntax`||typeof e.value.value!=`string`)continue;let r=t(e.value.value).replacement,i=RegExp(`\\bmatches\\s+"${n}"`).exec(l.raw);if(r===void 0||i===null)continue;let o={Equal:`==`,NotEqual:`!=`,Contains:`contains`,NotContains:`not contains`,StartsWith:`starts with`,EndsWith:`ends with`},s=`"`+r.value.replace(/["\\\n\r\t]/g,e=>JSON.stringify(e).slice(1,-1))+`"`;_.set(l.number,{line:l.number,fix:{diagnosticCode:a.code,title:`Use the equivalent ordinal text rule`,scope:`occurrence`,edits:[{start:l.startOffset+i.index,length:i[0].length,text:o[r.kind]+` `+s}]},change:{node:e,replacement:{...e,rule:r.kind,value:{...e.value,value:r.value}}}})}else if(a.code===e.LegacyComplianceMarker){let e=complianceMarkerEdit(l.raw,l.startOffset);e!==void 0&&_.set(l.number,{line:l.number,fix:{diagnosticCode:a.code,title:`Use bare pii and secret compliance markers`,scope:`occurrence`,edits:[e]}})}else if(a.code===e.PublicTranslationRequiresDirection){let t=m.get(l.number),n=/^\s*/.exec(l.raw)[0],i=r.includes(`\r
2
2
  `)?`\r
3
3
  `:`
4
- `,l=[`Inbound`,`Outbound`].map(e=>({direction:e,text:`${a}${n} direction ${e===`Inbound`?`inbound`:`outbound`}`})).filter(t=>{let n=applyQuickFixEdits(r,[{start:c.startOffset+c.raw.length,length:0,text:t.text}]),a=u(n,void 0,i.placement),o=errorCodes(s);return acceptable(a)&&![...errorCodes(a)].some(t=>t===e.PublicTranslationRequiresDirection||!o.has(t))});if(l.length===1){let[{direction:e,text:n}]=l;_.set(c.number,{line:c.number,fix:{diagnosticCode:o.code,title:`Declare 'direction ${e===`Inbound`?`inbound`:`outbound`}'`,scope:`occurrence`,edits:[{start:c.startOffset+c.raw.length,length:0,text:n}]},change:{node:t,replacement:{...t,direction:e}}})}}else if(o.code===e.LegacyProfileLayout){let e=legacyProfileLayoutFix(d,c.number-1,o.code);e!==void 0&&_.set(c.number,{line:c.number,fix:e})}else if(o.code===e.RedundantCompositeKeyBraces||o.code===e.ImplicitAuthorizationConjunction){let t=o.code===e.RedundantCompositeKeyBraces?redundantKeyBracesFix(r,d,c.number-1,o.code):implicitAuthorizationFix(r,d,c.number-1,o.code);t!==void 0&&_.set(c.number,{line:c.number,fix:t})}else if(o.code===e.InlineJsonValue){let e=indentationUnit(d,c.number-1),t=p(c.raw,e);if(t!==void 0){let e=r.includes(`\r
4
+ `,u=[`Inbound`,`Outbound`].map(e=>({direction:e,text:`${i}${n} direction ${e===`Inbound`?`inbound`:`outbound`}`})).filter(t=>{let n=applyQuickFixEdits(r,[{start:l.startOffset+l.raw.length,length:0,text:t.text}]),i=c(n,void 0,o.placement),a=errorCodes(s);return acceptable(i)&&![...errorCodes(i)].some(t=>t===e.PublicTranslationRequiresDirection||!a.has(t))});if(u.length===1){let[{direction:e,text:n}]=u;_.set(l.number,{line:l.number,fix:{diagnosticCode:a.code,title:`Declare 'direction ${e===`Inbound`?`inbound`:`outbound`}'`,scope:`occurrence`,edits:[{start:l.startOffset+l.raw.length,length:0,text:n}]},change:{node:t,replacement:{...t,direction:e}}})}}else if(a.code===e.LegacyProfileLayout){let e=legacyProfileLayoutFix(d,l.number-1,a.code);e!==void 0&&_.set(l.number,{line:l.number,fix:e})}else if(a.code===e.RedundantCompositeKeyBraces||a.code===e.ImplicitAuthorizationConjunction){let t=a.code===e.RedundantCompositeKeyBraces?redundantKeyBracesFix(r,d,l.number-1,a.code):implicitAuthorizationFix(r,d,l.number-1,a.code);t!==void 0&&_.set(l.number,{line:l.number,fix:t})}else if(a.code===e.InlineJsonValue){let e=indentationUnit(d,l.number-1),t=p(l.raw,e);if(t!==void 0){let e=r.includes(`\r
5
5
  `)?`\r
6
6
  `:`
7
- `;_.set(c.number,{line:c.number,fix:{diagnosticCode:o.code,title:`Write the value as an indented block`,scope:`occurrence`,edits:[{start:c.startOffset+t.start,length:c.raw.length-t.start,text:t.text.replaceAll(`
8
- `,e)}]}})}}else if(o.code===e.RedundantEventId&&a(c.raw)<0){let e=b.get(c.number);if(e?.id!==e?.name||e===void 0)continue;_.set(c.number,{line:c.number,fix:{diagnosticCode:o.code,title:`Remove the redundant event id`,scope:`occurrence`,edits:[{start:c.startOffset,length:(d[c.number]?.startOffset??r.length)-c.startOffset,text:``}]},change:{node:e,replacement:{...e,id:null}}})}}let S=[e.LegacyOptionalSuffix,e.LegacyComplianceMarker],C=verificationShape(s),w=/* @__PURE__ */ new Map,T,E=/* @__PURE__ */ new Set,D=/* @__PURE__ */ new Map,verify=(e,t)=>{let n=applyQuickFixEdits(r,e.edits);if(n===void 0)return;let a=u(n,void 0,i.placement);if(acceptable(a)&&verificationShape(a)===(t===void 0?C:verificationShape(s,[t])))return a.diagnostics.filter(t=>t.code===e.diagnosticCode).length===(g.get(e.diagnosticCode)??0)-e.edits.length?e:void 0};return(t,n)=>{let a=typeof t==`number`||t===void 0?void 0:t,o=a===void 0?typeof t==`number`&&(n===void 0||n===e.DuplicateComplianceMarker)?[t]:[]:a.filter(t=>t.diagnosticCode===e.DuplicateComplianceMarker).map(e=>e.line),c=[...new Set(o)].flatMap(e=>{let t=v.get(e);if(t===void 0)return[];y.has(e)||y.set(e,verify(t));let n=y.get(e);return n===void 0?[]:[n]}),l=S.filter(e=>a===void 0?n===void 0||n===e:a.some(t=>t.diagnosticCode===e));for(let t of l.filter(e=>!E.has(e))){let n=[..._.values()].filter(e=>e.fix.diagnosticCode===t);if(n.length>0){let r=verify({diagnosticCode:t,title:t===e.LegacyOptionalSuffix?`Use 'optional' throughout this document`:`Use bare pii and secret throughout this document`,scope:`document`,edits:n.flatMap(e=>e.fix.edits)});r!==void 0&&D.set(t,r)}E.add(t)}let f=l.flatMap(e=>D.has(e)?[D.get(e)]:[]);if(a!==void 0){if(T===void 0){T=/* @__PURE__ */ new Map;let e=d.flatMap(e=>_.has(e.number)?[_.get(e.number)]:[]),t=e.flatMap(e=>e.fix.edits),n=applyQuickFixEdits(r,t);if(t.length>0&&n!==void 0){let t=u(n,void 0,i.placement),r=e.flatMap(e=>e.change===void 0?[]:[e.change]);if(acceptable(t)&&verificationShape(t)===verificationShape(s,r)){let n=/* @__PURE__ */ new Map,r=/* @__PURE__ */ new Map;for(let e of t.diagnostics)n.set(e.code,(n.get(e.code)??0)+1);for(let t of e)r.set(t.fix.diagnosticCode,(r.get(t.fix.diagnosticCode)??0)+t.fix.edits.length);if([...r].every(([e,t])=>(n.get(e)??0)===(g.get(e)??0)-t))for(let t of e)T.set(t.line,t.fix)}}}let e=/* @__PURE__ */ new Map;for(let t of a){let n=T.get(t.line);n?.diagnosticCode===t.diagnosticCode&&e.set(t.line,n)}return[...e.values(),...c,...f]}let p=typeof t==`number`?t:void 0,m=p===void 0?void 0:_.get(p),h;return m!==void 0&&p!==void 0&&(n===void 0||m.fix.diagnosticCode===n)&&(w.has(p)||(w.size===32&&w.delete(w.keys().next().value),w.set(p,verify(m.fix,m.change))),h=w.get(p)),[...h===void 0?[]:[h],...c,...f]}}function legacyProfileLayoutFix(e,t,n){let indentOf=e=>/^\s*/.exec(e)[0].length,r=indentOf(e[t].raw),i,a=!1;for(let n=t+1;n<e.length;n++){let t=e[n].raw;if(t.trim().length!==0){if(indentOf(t)<=r)break;i===void 0&&/^\s*layout\s+[A-Za-z_]\w*\s*$/.test(t)&&(i={index:n,indent:indentOf(t)}),/^\s*root\s+template(\s|$)/.test(t)&&(a=!0)}}if(i===void 0)return;let o=e[i.index];return a?{diagnosticCode:n,title:`Remove the ignored layout line`,scope:`occurrence`,edits:[{start:o.startOffset,length:(e[i.index+1]?.startOffset??o.startOffset+o.raw.length)-o.startOffset,text:``}]}:{diagnosticCode:n,title:`Use 'root template' instead of 'layout'`,scope:`occurrence`,edits:[{start:o.startOffset+i.indent,length:6,text:`root template`}]}}function indentationUnit(e,t){let n=e[t].indent,r=e.slice(0,t).reverse().find(e=>e.content.length>0&&e.indent<n);return` `.repeat(r===void 0?2:n-r.indent)}function redundantKeyBracesFix(e,t,n,r){let i=t[n];if(!i.content.endsWith(`{`))return;let a=i.indent+i.content.length-1,o=i.raw.slice(0,a).trimEnd().length;for(let s=n+1;s<t.length;s++){let n=t[s];if(n.content.length===0||n.indent>i.indent)continue;if(n.indent!==i.indent||n.content!==`}`||n.raw.trim()!==`}`)return;let c=t[s+1],l=e.slice(i.startOffset+i.raw.length,n.startOffset),u=i.raw.slice(a+1)+(c===void 0?l.replace(/\r?\n$/,``):l),d=i.startOffset+o;return{diagnosticCode:r,title:`Remove the redundant composite key braces`,scope:`occurrence`,edits:[{start:d,length:(c?.startOffset??e.length)-d,text:u}]}}}function implicitAuthorizationFix(e,t,n,r){let i=t[n];if(!i.content.startsWith(`authorize`))return;let a=[],o,visit=(e,t)=>{let n=s(e.content.slice(t),o);o=n.previous;for(let r of n.tokens)a.push({index:e.startOffset+e.indent+t+r.index,length:r.length})};visit(i,9);for(let e=n+1;e<t.length;e++){let n=t[e];if(n.content.length!==0){if(n.indent<=i.indent||!c(n.content))break;visit(n,0)}}if(a.length===0)return;let l=a[a.length-1],u=a.map((t,n)=>`and `+e.slice(t.index,n<a.length-1?a[n+1].index:t.index+t.length)).join(``);return{diagnosticCode:r,title:`Write 'and' between the adjacent authorize policies`,scope:`occurrence`,edits:[{start:a[0].index,length:l.index+l.length-a[0].index,text:u}]}}function duplicateComplianceMarkerEdit(e,t){let n=r(`^(\\s*concept\\s+\\w+\\s*:\\s*\\w+)((?:[^\\S\\r\\n]+@?\\w+)*)`).exec(e);if(n===null)return;let a=n[2],o=/* @__PURE__ */ new Set,s=a.replace(new RegExp(r(`[^\\S\\r\\n]+(@?\\w+)`).source,`gu`),(e,t)=>{let n=i(t);return o.has(n)?``:(o.add(n),e)});return s===a?void 0:{start:t+n[1].length,length:a.length,text:s}}function complianceMarkerEdit(e,t){let n=r(`^(\\s*concept\\s+\\w+\\s*:\\s*\\w+)((?:[^\\S\\r\\n]+@?\\w+)*)`).exec(e);if(n!==null){let e=n[2],r=e.replace(/@pii\b|@?sensitive\b/g,e=>e===`@pii`?`pii`:`secret`);return r===e?void 0:{start:t+n[1].length,length:e.length,text:r}}let i=r(`^(\\s*)(@pii|@?sensitive)\\b`).exec(e);return i===null?void 0:{start:t+i[1].length,length:i[2].length,text:i[2]===`@pii`?`pii`:`secret`}}function verificationShape(e,t=[]){let n=new Map(t.map(e=>[e.node,e.replacement]));return JSON.stringify([e.value,e.triggerData],(e,t)=>[`location`,`usesLocation`,`targetLocation`].includes(e)?void 0:n.get(t)??t)}function applyQuickFixEdits(e,t){let n=[],r=0;for(let i of t){if(i.start<r||i.start<0||i.length<0||i.start+i.length>e.length)return;n.push(e.slice(r,i.start),i.text),r=i.start+i.length}return n.push(e.slice(r)),n.join(``)}export{applyQuickFixEdits,isQuickFixDiagnostic,legacyOptionalTypeLength,prepareQuickFixes};
7
+ `;_.set(l.number,{line:l.number,fix:{diagnosticCode:a.code,title:`Write the value as an indented block`,scope:`occurrence`,edits:[{start:l.startOffset+t.start,length:l.raw.length-t.start,text:t.text.replaceAll(`
8
+ `,e)}]}})}}else if(a.code===e.RedundantEventId&&i(l.raw)<0){let e=b.get(l.number);if(e?.id!==e?.name||e===void 0)continue;_.set(l.number,{line:l.number,fix:{diagnosticCode:a.code,title:`Remove the redundant event id`,scope:`occurrence`,edits:[{start:l.startOffset,length:(d[l.number]?.startOffset??r.length)-l.startOffset,text:``}]},change:{node:e,replacement:{...e,id:null}}})}}let S=[e.LegacyOptionalSuffix,e.LegacyComplianceMarker],C=verificationShape(s),w=/* @__PURE__ */ new Map,T,E=/* @__PURE__ */ new Set,D=/* @__PURE__ */ new Map,verify=(e,t)=>{let n=applyQuickFixEdits(r,e.edits);if(n===void 0)return;let i=c(n,void 0,o.placement);if(acceptable(i)&&verificationShape(i)===(t===void 0?C:verificationShape(s,[t])))return i.diagnostics.filter(t=>t.code===e.diagnosticCode).length===(g.get(e.diagnosticCode)??0)-e.edits.length?e:void 0};return(t,n)=>{let i=typeof t==`number`||t===void 0?void 0:t,a=i===void 0?typeof t==`number`&&(n===void 0||n===e.DuplicateComplianceMarker)?[t]:[]:i.filter(t=>t.diagnosticCode===e.DuplicateComplianceMarker).map(e=>e.line),l=[...new Set(a)].flatMap(e=>{let t=v.get(e);if(t===void 0)return[];y.has(e)||y.set(e,verify(t));let n=y.get(e);return n===void 0?[]:[n]}),u=S.filter(e=>i===void 0?n===void 0||n===e:i.some(t=>t.diagnosticCode===e));for(let t of u.filter(e=>!E.has(e))){let n=[..._.values()].filter(e=>e.fix.diagnosticCode===t);if(n.length>0){let r=verify({diagnosticCode:t,title:t===e.LegacyOptionalSuffix?`Use 'optional' throughout this document`:`Use bare pii and secret throughout this document`,scope:`document`,edits:n.flatMap(e=>e.fix.edits)});r!==void 0&&D.set(t,r)}E.add(t)}let f=u.flatMap(e=>D.has(e)?[D.get(e)]:[]);if(i!==void 0){if(T===void 0){T=/* @__PURE__ */ new Map;let e=d.flatMap(e=>_.has(e.number)?[_.get(e.number)]:[]),t=e.flatMap(e=>e.fix.edits),n=applyQuickFixEdits(r,t);if(t.length>0&&n!==void 0){let t=c(n,void 0,o.placement),r=e.flatMap(e=>e.change===void 0?[]:[e.change]);if(acceptable(t)&&verificationShape(t)===verificationShape(s,r)){let n=/* @__PURE__ */ new Map,r=/* @__PURE__ */ new Map;for(let e of t.diagnostics)n.set(e.code,(n.get(e.code)??0)+1);for(let t of e)r.set(t.fix.diagnosticCode,(r.get(t.fix.diagnosticCode)??0)+t.fix.edits.length);if([...r].every(([e,t])=>(n.get(e)??0)===(g.get(e)??0)-t))for(let t of e)T.set(t.line,t.fix)}}}let e=/* @__PURE__ */ new Map;for(let t of i){let n=T.get(t.line);n?.diagnosticCode===t.diagnosticCode&&e.set(t.line,n)}return[...e.values(),...l,...f]}let p=typeof t==`number`?t:void 0,m=p===void 0?void 0:_.get(p),h;return m!==void 0&&p!==void 0&&(n===void 0||m.fix.diagnosticCode===n)&&(w.has(p)||(w.size===32&&w.delete(w.keys().next().value),w.set(p,verify(m.fix,m.change))),h=w.get(p)),[...h===void 0?[]:[h],...l,...f]}}function legacyProfileLayoutFix(e,t,n){let indentOf=e=>/^\s*/.exec(e)[0].length,r=indentOf(e[t].raw),i,a=!1;for(let n=t+1;n<e.length;n++){let t=e[n].raw;if(t.trim().length!==0){if(indentOf(t)<=r)break;i===void 0&&/^\s*layout\s+[A-Za-z_]\w*\s*$/.test(t)&&(i={index:n,indent:indentOf(t)}),/^\s*root\s+template(\s|$)/.test(t)&&(a=!0)}}if(i===void 0)return;let o=e[i.index];return a?{diagnosticCode:n,title:`Remove the ignored layout line`,scope:`occurrence`,edits:[{start:o.startOffset,length:(e[i.index+1]?.startOffset??o.startOffset+o.raw.length)-o.startOffset,text:``}]}:{diagnosticCode:n,title:`Use 'root template' instead of 'layout'`,scope:`occurrence`,edits:[{start:o.startOffset+i.indent,length:6,text:`root template`}]}}function indentationUnit(e,t){let n=e[t].indent,r=e.slice(0,t).reverse().find(e=>e.content.length>0&&e.indent<n);return` `.repeat(r===void 0?2:n-r.indent)}function redundantKeyBracesFix(e,t,n,r){let i=t[n];if(!i.content.endsWith(`{`))return;let a=i.indent+i.content.length-1,o=i.raw.slice(0,a).trimEnd().length;for(let s=n+1;s<t.length;s++){let n=t[s];if(n.content.length===0||n.indent>i.indent)continue;if(n.indent!==i.indent||n.content!==`}`||n.raw.trim()!==`}`)return;let c=t[s+1],l=e.slice(i.startOffset+i.raw.length,n.startOffset),u=i.raw.slice(a+1)+(c===void 0?l.replace(/\r?\n$/,``):l),d=i.startOffset+o;return{diagnosticCode:r,title:`Remove the redundant composite key braces`,scope:`occurrence`,edits:[{start:d,length:(c?.startOffset??e.length)-d,text:u}]}}}function implicitAuthorizationFix(e,t,n,r){let i=t[n];if(!i.content.startsWith(`authorize`))return;let a=[],c,visit=(e,t)=>{let n=o(e.content.slice(t),c);c=n.previous;for(let r of n.tokens)a.push({index:e.startOffset+e.indent+t+r.index,length:r.length})};visit(i,9);for(let e=n+1;e<t.length;e++){let n=t[e];if(n.content.length!==0){if(n.indent<=i.indent||!s(n.content))break;visit(n,0)}}if(a.length===0)return;let l=a[a.length-1],u=a.map((t,n)=>`and `+e.slice(t.index,n<a.length-1?a[n+1].index:t.index+t.length)).join(``);return{diagnosticCode:r,title:`Write 'and' between the adjacent authorize policies`,scope:`occurrence`,edits:[{start:a[0].index,length:l.index+l.length-a[0].index,text:u}]}}function duplicateComplianceMarkerEdit(e,t){let n=u(`^(\\s*concept\\s+\\w+\\s*:\\s*\\w+)((?:[^\\S\\r\\n]+@?\\w+)*)`).exec(e);if(n===null)return;let i=n[2],a=/* @__PURE__ */ new Set,o=i.replace(new RegExp(u(`[^\\S\\r\\n]+(@?\\w+)`).source,`gu`),(e,t)=>{let n=r(t);return a.has(n)?``:(a.add(n),e)});return o===i?void 0:{start:t+n[1].length,length:i.length,text:o}}function complianceMarkerEdit(e,t){let n=u(`^(\\s*concept\\s+\\w+\\s*:\\s*\\w+)((?:[^\\S\\r\\n]+@?\\w+)*)`).exec(e);if(n!==null){let e=n[2],r=e.replace(/@pii\b|@?sensitive\b/g,e=>e===`@pii`?`pii`:`secret`);return r===e?void 0:{start:t+n[1].length,length:e.length,text:r}}let r=u(`^(\\s*)(@pii|@?sensitive)\\b`).exec(e);return r===null?void 0:{start:t+r[1].length,length:r[2].length,text:r[2]===`@pii`?`pii`:`secret`}}function verificationShape(e,t=[]){let n=new Map(t.map(e=>[e.node,e.replacement]));return JSON.stringify([e.value,e.triggerData],(e,t)=>[`location`,`usesLocation`,`targetLocation`].includes(e)?void 0:n.get(t)??t)}function applyQuickFixEdits(e,t){let n=[],r=0;for(let i of t){if(i.start<r||i.start<0||i.length<0||i.start+i.length>e.length)return;n.push(e.slice(r,i.start),i.text),r=i.start+i.length}return n.push(e.slice(r)),n.join(``)}export{applyQuickFixEdits,isQuickFixDiagnostic,legacyOptionalTypeLength,prepareQuickFixes};
9
9
  //# sourceMappingURL=QuickFixes.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"QuickFixes.js","names":["quickFixDiagnosticCodes","DiagnosticCodes","code","diagnostic","line","local","source","options","timeline","subjects","prepareActionSubjectQuickFixes","requests","localFixes","diagnosticCode","selected","request","fixes","prepareTimelineQuickFixes","subjectRequests","actions","original","parseForAuthoring","publicEventCodes","index","parsed","lines","splitLines","eventsByLine","slicesByLine","rulesByLine","ScreenplaySyntaxWalker","rule","event","slice","counts","byLine","duplicateByLine","duplicateVerdicts","events","edit","length","replacement","checkPortableMatchPattern","match","stringBodyPattern","spellings","quoted","character","indent","ending","candidates","direction","edited","candidate","originalCodes","fix","unit","rewrite","rewriteInlineJson","commentStart","declaration","spellingCodes","syntax","verified","rangeVerdicts","documentChecked","documentFixes","change","duplicateLines","duplicates","number","selectedCodes","documents","edits","candidateSource","changes","remaining","removed","count","occurrenceLine","occurrenceFix","raw","headerIndent","headerIndex","layout","hasRoot","parent","key","keyIndex","brace","prefix","next","keep","text","start","first","authorizeIndex","found","previous","result","implicitConjunctionTokens","from","token","isAuthorizeContinuation","last","header","pattern","suffix","seen","wire","complianceWireName","marker","startOffset","directive","replacements","value","parts","end"],"sources":["../../../../../../Compiler/Authoring/QuickFixes.ts"],"sourcesContent":["// Copyright (c) Cratis. All rights reserved.\n// Licensed under the MIT license. See LICENSE file in the project root for full license information.\n\nimport { Diagnostic } from '../Diagnostics/Diagnostic';\nimport { DiagnosticCodes } from '../Diagnostics/DiagnosticCodes';\nimport { PlayPlacement } from '../Files/PlayPlacement';\nimport { checkPortableMatchPattern } from '../Parsing/checkPortableMatchPattern';\nimport { ValidationRuleSyntax } from '../Syntax/Commands';\nimport { stringBodyPattern } from '../Text/StringLiteral';\nimport { complianceWireName } from '../Parsing/ConceptComplianceParser';\nimport { commentStart, splitLines } from '../Parsing/SourceLineSplitter';\nimport { implicitConjunctionTokens, isAuthorizeContinuation } from '../Parsing/AuthorizeParser';\nimport { parseForAuthoring } from '../ScreenplayCompiler';\nimport { EventSyntax } from '../Syntax/Declarations';\nimport { SliceSyntax } from '../Syntax/Structure';\nimport { TranslationDirection } from '../Syntax/TranslationDirection';\nimport { ScreenplaySyntaxWalker } from '../Syntax/ScreenplaySyntaxWalker';\nimport { pattern } from '../Text/patterns';\nimport { QuickFixCandidate } from './QuickFixCandidate';\nimport { prepareTimelineQuickFixes } from './TimelineQuickFixes';\nimport { prepareActionSubjectQuickFixes } from './ActionSubjectQuickFixes';\nimport { rewriteInlineJson } from './StructuredValueQuickFix';\n\nexport interface QuickFixEdit {\n /** Destination document for an application-snapshot repair; absent for a buffer-local edit. */\n readonly path?: string;\n readonly start: number;\n readonly length: number;\n readonly text: string;\n}\n\nexport interface QuickFix {\n /** Original diagnostic line, which may differ from the edited import's line. */\n readonly line?: number;\n readonly diagnosticCode: string;\n readonly title: string;\n readonly scope: 'occurrence' | 'document';\n readonly edits: readonly QuickFixEdit[];\n}\n\nexport interface QuickFixOptions {\n readonly path?: string;\n readonly documents?: ReadonlyMap<string, string>;\n readonly line?: number;\n readonly placement?: PlayPlacement;\n readonly diagnosticCode?: string;\n}\n\nconst quickFixDiagnosticCodes: ReadonlySet<unknown> = new Set([\n DiagnosticCodes.InferredActionSubject,\n DiagnosticCodes.ChangedActionSubject,\n DiagnosticCodes.EventFromLaterSlice,\n DiagnosticCodes.DeprecatedStudioTextRulePattern,\n DiagnosticCodes.DuplicateComplianceMarker,\n DiagnosticCodes.LegacyOptionalSuffix,\n DiagnosticCodes.LegacyComplianceMarker,\n DiagnosticCodes.RedundantEventId,\n DiagnosticCodes.PublicTranslationRequiresDirection,\n DiagnosticCodes.LegacyProfileLayout,\n DiagnosticCodes.RedundantCompositeKeyBraces,\n DiagnosticCodes.ImplicitAuthorizationConjunction,\n DiagnosticCodes.InlineJsonValue,\n]);\n\nexport function isQuickFixDiagnostic(code: unknown): code is string {\n return quickFixDiagnosticCodes.has(code);\n}\n\n// Diagnostics point at the complete type, not at the suffix. Never derive edits from message text.\nexport function legacyOptionalTypeLength(line: string, diagnostic: Diagnostic): number {\n if (diagnostic.code !== DiagnosticCodes.LegacyOptionalSuffix) return 0;\n return /^[\\p{L}\\p{Mn}\\p{Nd}\\p{Pc}.]+(?:\\[\\])?\\?/u.exec(line.slice(diagnostic.location.column - 1))?.[0].length ?? 0;\n}\n\nexport function findQuickFixes(source: string, options: QuickFixOptions = {}): QuickFix[] {\n return prepareQuickFixes(source, options)(options.line, options.diagnosticCode);\n}\n\n// One immutable buffer version owns the analysis and document verdict. Cursor moves reuse them;\n// single-occurrence verdicts have a bounded cache. Range requests verify the independent recipes\n// together once per version, rather than reparsing N times for N intersecting markers.\nexport function prepareQuickFixes(source: string, options: Pick<QuickFixOptions, 'placement' | 'path' | 'documents'> = {}): (line?: number | readonly { line: number; diagnosticCode: string }[], diagnosticCode?: string) => QuickFix[] {\n const local = prepareLocalQuickFixes(source, options);\n let timeline: ReturnType<typeof prepareTimelineQuickFixes> | undefined;\n let subjects: ReturnType<typeof prepareActionSubjectQuickFixes> | undefined;\n const subjectFixes = (line?: number, code?: string) => (subjects ??= prepareActionSubjectQuickFixes(source, options))(line, code);\n return (line, diagnosticCode) => {\n const requests = typeof line === 'number' ? [{ line, diagnosticCode }] : line ?? [];\n const localFixes = local(line, diagnosticCode);\n const selected = requests.filter(request => request.diagnosticCode === DiagnosticCodes.EventFromLaterSlice || (request.diagnosticCode === undefined && localFixes.length === 0));\n const fixes = selected.length === 0 ? [] : [...new Set(selected.map(request => request.line))].flatMap(line => (timeline ??= prepareTimelineQuickFixes(source, options))(line));\n const subjectRequests = requests.filter(request => request.diagnosticCode === undefined || request.diagnosticCode === DiagnosticCodes.InferredActionSubject || request.diagnosticCode === DiagnosticCodes.ChangedActionSubject);\n const actions = requests.length === 0 ? subjectFixes(undefined, diagnosticCode) : subjectRequests.flatMap(request => subjectFixes(request.line, request.diagnosticCode));\n return [...localFixes, ...fixes, ...actions];\n };\n}\n\nfunction prepareLocalQuickFixes(source: string, options: Pick<QuickFixOptions, 'placement'>): (line?: number | readonly { line: number; diagnosticCode: string }[], diagnosticCode?: string) => QuickFix[] {\n const original = parseForAuthoring(source, undefined, options.placement);\n // PLAY0614 and the public-event boundary errors that follow from a missing direction are errors the repair itself removes,\n // so a document whose only errors are public-event boundary errors stays repairable.\n // Inline JSON (PLAY0833) is likewise an error its own repair removes.\n const publicEventCodes: ReadonlySet<string> = new Set([...Array.from({ length: 14 }, (_, index) => `PLAY0${607 + index}`), DiagnosticCodes.InlineJsonValue]);\n const acceptable = (parsed: ReturnType<typeof parseForAuthoring>): boolean => parsed.success || parsed.diagnostics.every(diagnostic => diagnostic.severity !== 'error' || publicEventCodes.has(diagnostic.code));\n const errorCodes = (parsed: ReturnType<typeof parseForAuthoring>): Set<string> => new Set(parsed.diagnostics.filter(diagnostic => diagnostic.severity === 'error').map(diagnostic => diagnostic.code));\n if (!acceptable(original)) return () => [];\n const lines = splitLines(source);\n const eventsByLine = new Map<number, EventSyntax>();\n const slicesByLine = new Map<number, SliceSyntax>();\n const rulesByLine = new Map<number, ValidationRuleSyntax>();\n // Index inline and standalone declarations once, without scanning the tree per diagnostic.\n const walker = new class extends ScreenplaySyntaxWalker {\n override visitValidationRule(rule: ValidationRuleSyntax): void { rulesByLine.set(rule.location.line, rule); super.visitValidationRule(rule); }\n override visitEvent(event: EventSyntax): void { eventsByLine.set(event.location.line, event); }\n override visitSlice(slice: SliceSyntax): void { slicesByLine.set(slice.location.line, slice); super.visitSlice(slice); }\n }();\n walker.visitApplication(original.value);\n const counts = new Map<string, number>();\n const byLine = new Map<number, QuickFixCandidate>();\n // Duplicate removal and legacy spelling can share a header. Keep their independently verified recipes separate.\n const duplicateByLine = new Map<number, QuickFix>();\n const duplicateVerdicts = new Map<number, QuickFix | undefined>();\n const events = new Map<number, EventSyntax>();\n let event: EventSyntax | undefined;\n for (const line of lines) {\n event = eventsByLine.get(line.number) ?? event;\n if (event !== undefined) events.set(line.number, event);\n }\n for (const diagnostic of original.diagnostics) {\n counts.set(diagnostic.code, (counts.get(diagnostic.code) ?? 0) + 1);\n const line = lines[diagnostic.location.line - 1];\n if (diagnostic.code === DiagnosticCodes.DuplicateComplianceMarker) {\n const edit = duplicateComplianceMarkerEdit(line.raw, line.startOffset);\n if (edit !== undefined) duplicateByLine.set(line.number, { diagnosticCode: diagnostic.code, title: 'Remove duplicate compliance markers', scope: 'occurrence', edits: [edit] });\n }\n const length = legacyOptionalTypeLength(line.raw, diagnostic);\n if (length > 0) {\n byLine.set(line.number, { line: line.number, fix: { diagnosticCode: diagnostic.code, title: \"Use 'optional' instead of '?'\", scope: 'occurrence', edits: [{ start: line.startOffset + diagnostic.location.column + length - 2, length: 1, text: ' optional' }] } });\n } else if (diagnostic.code === DiagnosticCodes.DeprecatedStudioTextRulePattern) {\n const rule = rulesByLine.get(line.number);\n if (rule?.rule !== 'Matches' || rule.value?.kind !== 'LiteralExpressionSyntax' || typeof rule.value.value !== 'string') continue;\n const replacement = checkPortableMatchPattern(rule.value.value).replacement;\n const match = new RegExp(`\\\\bmatches\\\\s+\"${stringBodyPattern}\"`).exec(line.raw);\n if (replacement === undefined || match === null) continue;\n const spellings = { Equal: '==', NotEqual: '!=', Contains: 'contains', NotContains: 'not contains', StartsWith: 'starts with', EndsWith: 'ends with' };\n const quoted = '\"' + replacement.value.replace(/[\"\\\\\\n\\r\\t]/g, character => JSON.stringify(character).slice(1, -1)) + '\"';\n byLine.set(line.number, { line: line.number,\n fix: { diagnosticCode: diagnostic.code, title: 'Use the equivalent ordinal text rule', scope: 'occurrence', edits: [{ start: line.startOffset + match.index, length: match[0].length, text: spellings[replacement.kind] + ' ' + quoted }] },\n change: { node: rule, replacement: { ...rule, rule: replacement.kind, value: { ...rule.value, value: replacement.value } } as ValidationRuleSyntax } });\n } else if (diagnostic.code === DiagnosticCodes.LegacyComplianceMarker) {\n const edit = complianceMarkerEdit(line.raw, line.startOffset);\n if (edit !== undefined) byLine.set(line.number, { line: line.number, fix: { diagnosticCode: diagnostic.code, title: 'Use bare pii and secret compliance markers', scope: 'occurrence', edits: [edit] } });\n } else if (diagnostic.code === DiagnosticCodes.PublicTranslationRequiresDirection) {\n // PLAY0614 is only reported on the declaration line of a Translate slice that has no direction.\n const slice = slicesByLine.get(line.number)!;\n // Offer a direction only when exactly one is consistent with the slice: the other would add errors.\n const indent = /^\\s*/.exec(line.raw)![0];\n const ending = source.includes('\\r\\n') ? '\\r\\n' : '\\n';\n const candidates = [TranslationDirection.Inbound, TranslationDirection.Outbound].map(direction => ({ direction, text: `${ending}${indent} direction ${direction === TranslationDirection.Inbound ? 'inbound' : 'outbound'}` }))\n .filter(candidate => {\n // The insertion point is the end of an existing line, so the edit is always in bounds.\n const edited = applyQuickFixEdits(source, [{ start: line.startOffset + line.raw.length, length: 0, text: candidate.text }])!;\n const parsed = parseForAuthoring(edited, undefined, options.placement);\n const originalCodes = errorCodes(original);\n // Valid when the missing-direction error is gone and the direction introduces no kind of error the document lacked.\n return acceptable(parsed) && ![...errorCodes(parsed)].some(code => code === DiagnosticCodes.PublicTranslationRequiresDirection || !originalCodes.has(code));\n });\n if (candidates.length === 1) {\n const [{ direction, text }] = candidates;\n byLine.set(line.number, { line: line.number, fix: { diagnosticCode: diagnostic.code, title: `Declare 'direction ${direction === TranslationDirection.Inbound ? 'inbound' : 'outbound'}'`, scope: 'occurrence', edits: [{ start: line.startOffset + line.raw.length, length: 0, text }] },\n change: { node: slice, replacement: { ...slice, direction } as SliceSyntax } });\n }\n } else if (diagnostic.code === DiagnosticCodes.LegacyProfileLayout) {\n const fix = legacyProfileLayoutFix(lines, line.number - 1, diagnostic.code);\n if (fix !== undefined) byLine.set(line.number, { line: line.number, fix });\n } else if (diagnostic.code === DiagnosticCodes.RedundantCompositeKeyBraces || diagnostic.code === DiagnosticCodes.ImplicitAuthorizationConjunction) {\n const fix = diagnostic.code === DiagnosticCodes.RedundantCompositeKeyBraces ? redundantKeyBracesFix(source, lines, line.number - 1, diagnostic.code) : implicitAuthorizationFix(source, lines, line.number - 1, diagnostic.code);\n if (fix !== undefined) byLine.set(line.number, { line: line.number, fix });\n } else if (diagnostic.code === DiagnosticCodes.InlineJsonValue) {\n const unit = indentationUnit(lines, line.number - 1);\n const rewrite = rewriteInlineJson(line.raw, unit);\n if (rewrite !== undefined) {\n const ending = source.includes('\\r\\n') ? '\\r\\n' : '\\n';\n byLine.set(line.number, { line: line.number, fix: { diagnosticCode: diagnostic.code, title: 'Write the value as an indented block', scope: 'occurrence', edits: [{ start: line.startOffset + rewrite.start, length: line.raw.length - rewrite.start, text: rewrite.text.replaceAll('\\n', ending) }] } });\n }\n } else if (diagnostic.code === DiagnosticCodes.RedundantEventId && commentStart(line.raw) < 0) {\n const declaration = events.get(line.number);\n if (declaration?.id !== declaration?.name || declaration === undefined) continue;\n byLine.set(line.number, { line: line.number, fix: { diagnosticCode: diagnostic.code, title: 'Remove the redundant event id', scope: 'occurrence', edits: [{ start: line.startOffset, length: (lines[line.number]?.startOffset ?? source.length) - line.startOffset, text: '' }] },\n change: { node: declaration, replacement: { ...declaration, id: null } as EventSyntax } });\n }\n }\n const spellingCodes = [DiagnosticCodes.LegacyOptionalSuffix, DiagnosticCodes.LegacyComplianceMarker];\n const syntax = verificationShape(original);\n const verified = new Map<number, QuickFix | undefined>();\n let rangeVerdicts: Map<number, QuickFix> | undefined;\n const documentChecked = new Set<string>();\n const documentFixes = new Map<string, QuickFix>();\n const verify = (fix: QuickFix, change?: QuickFixCandidate['change']): QuickFix | undefined => {\n const candidate = applyQuickFixEdits(source, fix.edits);\n if (candidate === undefined) return undefined;\n const parsed = parseForAuthoring(candidate, undefined, options.placement);\n if (!acceptable(parsed) || verificationShape(parsed) !== (change === undefined ? syntax : verificationShape(original, [change]))) return undefined;\n return parsed.diagnostics.filter(diagnostic => diagnostic.code === fix.diagnosticCode).length === (counts.get(fix.diagnosticCode) ?? 0) - fix.edits.length ? fix : undefined;\n };\n return (line, diagnosticCode) => {\n const requests = typeof line === 'number' || line === undefined ? undefined : line;\n const duplicateLines = requests === undefined\n ? typeof line === 'number' && (diagnosticCode === undefined || diagnosticCode === DiagnosticCodes.DuplicateComplianceMarker) ? [line] : []\n : requests.filter(request => request.diagnosticCode === DiagnosticCodes.DuplicateComplianceMarker).map(request => request.line);\n const duplicates = [...new Set(duplicateLines)].flatMap(number => {\n const fix = duplicateByLine.get(number);\n if (fix === undefined) return [];\n if (!duplicateVerdicts.has(number)) duplicateVerdicts.set(number, verify(fix));\n const verified = duplicateVerdicts.get(number);\n return verified === undefined ? [] : [verified];\n });\n const selectedCodes = spellingCodes.filter(code => requests === undefined ? diagnosticCode === undefined || diagnosticCode === code : requests.some(request => request.diagnosticCode === code));\n for (const code of selectedCodes.filter(code => !documentChecked.has(code))) {\n const candidates = [...byLine.values()].filter(candidate => candidate.fix.diagnosticCode === code);\n if (candidates.length > 0) {\n const fix = verify({ diagnosticCode: code, title: code === DiagnosticCodes.LegacyOptionalSuffix ? \"Use 'optional' throughout this document\" : 'Use bare pii and secret throughout this document', scope: 'document', edits: candidates.flatMap(candidate => candidate.fix.edits) });\n if (fix !== undefined) documentFixes.set(code, fix);\n }\n documentChecked.add(code);\n }\n const documents = selectedCodes.flatMap(code => documentFixes.has(code) ? [documentFixes.get(code)!] : []);\n if (requests !== undefined) {\n if (rangeVerdicts === undefined) {\n rangeVerdicts = new Map();\n // Source order gives ordered, non-overlapping edits without sorting. Recipes replace\n // distinct nodes/lines; the batch must preserve every other modeled member and remove\n // exactly the expected diagnostics before any of its occurrence edits can be offered.\n const candidates = lines.flatMap(line => byLine.has(line.number) ? [byLine.get(line.number)!] : []);\n const edits = candidates.flatMap(candidate => candidate.fix.edits);\n const candidateSource = applyQuickFixEdits(source, edits);\n if (edits.length > 0 && candidateSource !== undefined) {\n const parsed = parseForAuthoring(candidateSource, undefined, options.placement);\n const changes = candidates.flatMap(candidate => candidate.change === undefined ? [] : [candidate.change]);\n if (acceptable(parsed) && verificationShape(parsed) === verificationShape(original, changes)) {\n const remaining = new Map<string, number>();\n const removed = new Map<string, number>();\n for (const diagnostic of parsed.diagnostics) remaining.set(diagnostic.code, (remaining.get(diagnostic.code) ?? 0) + 1);\n for (const candidate of candidates) removed.set(candidate.fix.diagnosticCode, (removed.get(candidate.fix.diagnosticCode) ?? 0) + candidate.fix.edits.length);\n if ([...removed].every(([code, count]) => (remaining.get(code) ?? 0) === (counts.get(code) ?? 0) - count)) {\n for (const candidate of candidates) rangeVerdicts.set(candidate.line, candidate.fix);\n }\n }\n }\n }\n const selected = new Map<number, QuickFix>();\n for (const request of requests) {\n const fix = rangeVerdicts.get(request.line);\n if (fix?.diagnosticCode === request.diagnosticCode) selected.set(request.line, fix);\n }\n return [...selected.values(), ...duplicates, ...documents];\n }\n const occurrenceLine = typeof line === 'number' ? line : undefined;\n const selected = occurrenceLine === undefined ? undefined : byLine.get(occurrenceLine);\n let occurrenceFix: QuickFix | undefined;\n if (selected !== undefined && occurrenceLine !== undefined && (diagnosticCode === undefined || selected.fix.diagnosticCode === diagnosticCode)) {\n if (!verified.has(occurrenceLine)) {\n if (verified.size === 32) verified.delete(verified.keys().next().value!);\n verified.set(occurrenceLine, verify(selected.fix, selected.change));\n }\n occurrenceFix = verified.get(occurrenceLine);\n }\n return [...(occurrenceFix === undefined ? [] : [occurrenceFix]), ...duplicates, ...documents];\n };\n}\n\n// PLAY0791 is reported on the `ui profile` line. The canonical form is `root template <Name>`; beside a root template the legacy line is ignored, so it is removed.\nfunction legacyProfileLayoutFix(lines: readonly { readonly number: number; readonly raw: string; readonly startOffset: number }[], headerIndex: number, diagnosticCode: string): QuickFix | undefined {\n const indentOf = (raw: string): number => /^\\s*/.exec(raw)![0].length;\n const headerIndent = indentOf(lines[headerIndex].raw);\n let layout: { readonly index: number; readonly indent: number } | undefined;\n let hasRoot = false;\n for (let index = headerIndex + 1; index < lines.length; index++) {\n const raw = lines[index].raw;\n if (raw.trim().length === 0) continue;\n if (indentOf(raw) <= headerIndent) break;\n if (layout === undefined && /^\\s*layout\\s+[A-Za-z_]\\w*\\s*$/.test(raw)) layout = { index, indent: indentOf(raw) };\n if (/^\\s*root\\s+template(\\s|$)/.test(raw)) hasRoot = true;\n }\n if (layout === undefined) return undefined;\n const line = lines[layout.index];\n return hasRoot\n ? { diagnosticCode, title: 'Remove the ignored layout line', scope: 'occurrence', edits: [{ start: line.startOffset, length: (lines[layout.index + 1]?.startOffset ?? line.startOffset + line.raw.length) - line.startOffset, text: '' }] }\n : { diagnosticCode, title: \"Use 'root template' instead of 'layout'\", scope: 'occurrence', edits: [{ start: line.startOffset + layout.indent, length: 'layout'.length, text: 'root template' }] };\n}\n\ntype QuickFixLine = { readonly number: number; readonly raw: string; readonly indent: number; readonly content: string; readonly startOffset: number };\n\n// The step one level of the document indents by, read from the nearest shallower line above; two spaces otherwise.\nfunction indentationUnit(lines: readonly QuickFixLine[], index: number): string {\n const indent = lines[index].indent;\n const parent = lines.slice(0, index).reverse().find(line => line.content.length > 0 && line.indent < indent);\n return ' '.repeat(parent === undefined ? 2 : indent - parent.indent);\n}\n\n// One edit from the opening brace to the end of the closing line, so the fix removes exactly one diagnostic. A closing brace that carries a comment is left alone.\nfunction redundantKeyBracesFix(source: string, lines: readonly QuickFixLine[], keyIndex: number, diagnosticCode: string): QuickFix | undefined {\n const key = lines[keyIndex];\n if (!key.content.endsWith('{')) return undefined;\n const brace = key.indent + key.content.length - 1;\n const prefix = key.raw.slice(0, brace).trimEnd().length;\n for (let index = keyIndex + 1; index < lines.length; index++) {\n const candidate = lines[index];\n if (candidate.content.length === 0 || candidate.indent > key.indent) continue;\n if (candidate.indent !== key.indent || candidate.content !== '}' || candidate.raw.trim() !== '}') return undefined;\n const next = lines[index + 1];\n const keep = source.slice(key.startOffset + key.raw.length, candidate.startOffset);\n const text = key.raw.slice(brace + 1) + (next === undefined ? keep.replace(/\\r?\\n$/, '') : keep);\n const start = key.startOffset + prefix;\n return { diagnosticCode, title: 'Remove the redundant composite key braces', scope: 'occurrence', edits: [{ start, length: (next?.startOffset ?? source.length) - start, text }] };\n }\n return undefined;\n}\n\n// One edit from the first to the last operand that needs an 'and', so the fix removes exactly one diagnostic.\nfunction implicitAuthorizationFix(source: string, lines: readonly QuickFixLine[], authorizeIndex: number, diagnosticCode: string): QuickFix | undefined {\n const first = lines[authorizeIndex];\n if (!first.content.startsWith('authorize')) return undefined;\n const found: { index: number; length: number }[] = [];\n let previous: string | undefined;\n const visit = (line: QuickFixLine, from: number): void => {\n const result = implicitConjunctionTokens(line.content.slice(from), previous);\n previous = result.previous;\n for (const token of result.tokens) found.push({ index: line.startOffset + line.indent + from + token.index, length: token.length });\n };\n visit(first, 'authorize'.length);\n for (let index = authorizeIndex + 1; index < lines.length; index++) {\n const line = lines[index];\n if (line.content.length === 0) continue;\n if (line.indent <= first.indent || !isAuthorizeContinuation(line.content)) break;\n visit(line, 0);\n }\n if (found.length === 0) return undefined;\n const last = found[found.length - 1];\n const text = found.map((token, index) => 'and ' + source.slice(token.index, index < found.length - 1 ? found[index + 1].index : token.index + token.length)).join('');\n return { diagnosticCode, title: \"Write 'and' between the adjacent authorize policies\", scope: 'occurrence', edits: [{ start: found[0].index, length: last.index + last.length - found[0].index, text }] };\n}\n\nfunction duplicateComplianceMarkerEdit(raw: string, startOffset: number): QuickFixEdit | undefined {\n const header = pattern('^(\\\\s*concept\\\\s+\\\\w+\\\\s*:\\\\s*\\\\w+)((?:[^\\\\S\\\\r\\\\n]+@?\\\\w+)*)').exec(raw);\n if (header === null) return undefined;\n const suffix = header[2];\n const seen = new Set<string>();\n const text = suffix.replace(new RegExp(pattern('[^\\\\S\\\\r\\\\n]+(@?\\\\w+)').source, 'gu'), (token, marker: string) => {\n const wire = complianceWireName(marker);\n if (seen.has(wire)) return '';\n seen.add(wire);\n return token;\n });\n return text === suffix ? undefined : { start: startOffset + header[1].length, length: suffix.length, text };\n}\n\nfunction complianceMarkerEdit(raw: string, startOffset: number): QuickFixEdit | undefined {\n // Restrict rewriting to the suffix or leading directive marker, never comments or quoted reasons.\n const header = pattern('^(\\\\s*concept\\\\s+\\\\w+\\\\s*:\\\\s*\\\\w+)((?:[^\\\\S\\\\r\\\\n]+@?\\\\w+)*)').exec(raw);\n if (header !== null) {\n const suffix = header[2];\n const text = suffix.replace(/@pii\\b|@?sensitive\\b/g, marker => marker === '@pii' ? 'pii' : 'secret');\n return text === suffix ? undefined : { start: startOffset + header[1].length, length: suffix.length, text };\n }\n const directive = pattern('^(\\\\s*)(@pii|@?sensitive)\\\\b').exec(raw);\n return directive === null ? undefined : { start: startOffset + directive[1].length, length: directive[2].length, text: directive[2] === '@pii' ? 'pii' : 'secret' };\n}\n\nfunction verificationShape(parsed: ReturnType<typeof parseForAuthoring>, changes: readonly NonNullable<QuickFixCandidate['change']>[] = []): string {\n // Compare every modeled member (including trigger data), ignoring only source locations. A recipe\n // may replace only its original node; no other id or destination is normalized away.\n const replacements = new Map(changes.map(change => [change.node, change.replacement]));\n return JSON.stringify([parsed.value, parsed.triggerData], (key, value: unknown) => ['location', 'usesLocation', 'targetLocation'].includes(key) ? undefined : replacements.get(value as NonNullable<QuickFixCandidate['change']>['node']) ?? value);\n}\n\n// One forward pass; applying N edits by repeatedly slicing the document would be quadratic.\nexport function applyQuickFixEdits(source: string, edits: readonly QuickFixEdit[]): string | undefined {\n const parts: string[] = [];\n let end = 0;\n for (const edit of edits) {\n if (edit.start < end || edit.start < 0 || edit.length < 0 || edit.start + edit.length > source.length) return undefined;\n parts.push(source.slice(end, edit.start), edit.text);\n end = edit.start + edit.length;\n }\n parts.push(source.slice(end));\n return parts.join('');\n}\n"],"mappings":"u5BAgDA,MAAMA,kBAAgD,IAAI,IAAI,CAC1DC,EAAgB,sBAChBA,EAAgB,qBAChBA,EAAgB,oBAChBA,EAAgB,gCAChBA,EAAgB,0BAChBA,EAAgB,qBAChBA,EAAgB,uBAChBA,EAAgB,iBAChBA,EAAgB,mCAChBA,EAAgB,oBAChBA,EAAgB,4BAChBA,EAAgB,iCAChBA,EAAgB,eACpB,CAAC,EAED,SAAgB,qBAAqB,EAA+B,CAChE,OAAOD,EAAwB,IAAIE,CAAI,CAC3C,CAGA,SAAgB,yBAAyB,EAAc,EAAgC,CAEnF,OADIC,EAAW,OAASF,EAAgB,qBACjC,2CAA2C,KAAKG,EAAK,MAAMD,EAAW,SAAS,OAAS,CAAC,CAAC,CAAC,GAAG,EAAE,CAAC,QAAU,EAD7C,CAEzE,CASA,SAAgB,kBAAkB,EAAgB,EAAqE,CAAC,EAAiH,CACrO,IAAME,EAAQ,uBAAuBC,EAAQ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AAK,MAC5B,CAEA,OADA6E,EAAM,KAAK9G,EAAO,MAAM+G,CAAG,CAAC,EACrBD,EAAM,KAAK,EAAE,CACxB"}
1
+ {"version":3,"file":"QuickFixes.js","names":["quickFixDiagnosticCodes","DiagnosticCodes","code","diagnostic","line","local","source","options","timeline","subjects","prepareActionSubjectQuickFixes","requests","localFixes","diagnosticCode","selected","request","fixes","prepareTimelineQuickFixes","subjectRequests","actions","original","parseForAuthoring","publicEventCodes","index","parsed","lines","splitLines","eventsByLine","slicesByLine","rulesByLine","ScreenplaySyntaxWalker","rule","event","slice","counts","byLine","duplicateByLine","duplicateVerdicts","events","edit","length","replacement","checkPortableMatchPattern","match","stringBodyPattern","spellings","quoted","character","indent","ending","candidates","direction","edited","candidate","originalCodes","fix","unit","rewrite","rewriteInlineJson","commentStart","declaration","spellingCodes","syntax","verified","rangeVerdicts","documentChecked","documentFixes","change","duplicateLines","duplicates","number","selectedCodes","documents","edits","candidateSource","changes","remaining","removed","count","occurrenceLine","occurrenceFix","raw","headerIndent","headerIndex","layout","hasRoot","parent","key","keyIndex","brace","prefix","next","keep","text","start","first","authorizeIndex","found","previous","result","implicitConjunctionTokens","from","token","isAuthorizeContinuation","last","header","pattern","suffix","seen","wire","complianceWireName","marker","startOffset","directive","replacements","value","parts","end"],"sources":["../../../../../../Compiler/Authoring/QuickFixes.ts"],"sourcesContent":["// Copyright (c) Cratis. All rights reserved.\n// Licensed under the MIT license. See LICENSE file in the project root for full license information.\n\nimport { Diagnostic } from '../Diagnostics/Diagnostic';\nimport { DiagnosticCodes } from '../Diagnostics/DiagnosticCodes';\nimport { PlayPlacement } from '../Files/PlayPlacement';\nimport { checkPortableMatchPattern } from '../Parsing/checkPortableMatchPattern';\nimport { ValidationRuleSyntax } from '../Syntax/Commands';\nimport { stringBodyPattern } from '../Text/StringLiteral';\nimport { complianceWireName } from '../Parsing/ConceptComplianceParser';\nimport { commentStart, splitLines } from '../Parsing/SourceLineSplitter';\nimport { implicitConjunctionTokens, isAuthorizeContinuation } from '../Parsing/AuthorizeParser';\nimport { parseForAuthoring } from '../ScreenplayCompiler';\nimport { EventSyntax } from '../Syntax/Declarations';\nimport { SliceSyntax } from '../Syntax/Structure';\nimport { TranslationDirection } from '../Syntax/TranslationDirection';\nimport { ScreenplaySyntaxWalker } from '../Syntax/ScreenplaySyntaxWalker';\nimport { pattern } from '../Text/patterns';\nimport { QuickFixCandidate } from './QuickFixCandidate';\nimport { prepareTimelineQuickFixes } from './TimelineQuickFixes';\nimport { prepareActionSubjectQuickFixes } from './ActionSubjectQuickFixes';\nimport { rewriteInlineJson } from './StructuredValueQuickFix';\n\nexport interface QuickFixEdit {\n /** Destination document for an application-snapshot repair; absent for a buffer-local edit. */\n readonly path?: string;\n readonly start: number;\n readonly length: number;\n readonly text: string;\n}\n\nexport interface QuickFix {\n /** Original diagnostic line, which may differ from the edited import's line. */\n readonly line?: number;\n readonly diagnosticCode: string;\n readonly title: string;\n readonly scope: 'occurrence' | 'document';\n readonly edits: readonly QuickFixEdit[];\n}\n\nexport interface QuickFixOptions {\n readonly path?: string;\n readonly documents?: ReadonlyMap<string, string>;\n readonly line?: number;\n readonly placement?: PlayPlacement;\n readonly diagnosticCode?: string;\n}\n\nconst quickFixDiagnosticCodes: ReadonlySet<unknown> = new Set([\n DiagnosticCodes.InferredActionSubject,\n DiagnosticCodes.ChangedActionSubject,\n DiagnosticCodes.EventFromLaterSlice,\n DiagnosticCodes.DeprecatedStudioTextRulePattern,\n DiagnosticCodes.DuplicateComplianceMarker,\n DiagnosticCodes.LegacyOptionalSuffix,\n DiagnosticCodes.LegacyComplianceMarker,\n DiagnosticCodes.RedundantEventId,\n DiagnosticCodes.PublicTranslationRequiresDirection,\n DiagnosticCodes.LegacyProfileLayout,\n DiagnosticCodes.RedundantCompositeKeyBraces,\n DiagnosticCodes.ImplicitAuthorizationConjunction,\n DiagnosticCodes.InlineJsonValue,\n]);\n\nexport function isQuickFixDiagnostic(code: unknown): code is string {\n return quickFixDiagnosticCodes.has(code);\n}\n\n// Diagnostics point at the complete type, not at the suffix. Never derive edits from message text.\nexport function legacyOptionalTypeLength(line: string, diagnostic: Diagnostic): number {\n if (diagnostic.code !== DiagnosticCodes.LegacyOptionalSuffix) return 0;\n return /^[\\p{L}\\p{Mn}\\p{Nd}\\p{Pc}.]+(?:\\[\\])?\\?/u.exec(line.slice(diagnostic.location.column - 1))?.[0].length ?? 0;\n}\n\nexport function findQuickFixes(source: string, options: QuickFixOptions = {}): QuickFix[] {\n return prepareQuickFixes(source, options)(options.line, options.diagnosticCode);\n}\n\n// One immutable buffer version owns the analysis and document verdict. Cursor moves reuse them;\n// single-occurrence verdicts have a bounded cache. Range requests verify the independent recipes\n// together once per version, rather than reparsing N times for N intersecting markers.\nexport function prepareQuickFixes(source: string, options: Pick<QuickFixOptions, 'placement' | 'path' | 'documents'> = {}): (line?: number | readonly { line: number; diagnosticCode: string }[], diagnosticCode?: string) => QuickFix[] {\n const local = prepareLocalQuickFixes(source, options);\n let timeline: ReturnType<typeof prepareTimelineQuickFixes> | undefined;\n let subjects: ReturnType<typeof prepareActionSubjectQuickFixes> | undefined;\n const subjectFixes = (line?: number, code?: string) => (subjects ??= prepareActionSubjectQuickFixes(source, options))(line, code);\n return (line, diagnosticCode) => {\n const requests = typeof line === 'number' ? [{ line, diagnosticCode }] : line ?? [];\n const localFixes = local(line, diagnosticCode);\n const selected = requests.filter(request => request.diagnosticCode === DiagnosticCodes.EventFromLaterSlice || (request.diagnosticCode === undefined && localFixes.length === 0));\n const fixes = selected.length === 0 ? [] : [...new Set(selected.map(request => request.line))].flatMap(line => (timeline ??= prepareTimelineQuickFixes(source, options))(line));\n const subjectRequests = requests.filter(request => request.diagnosticCode === undefined || request.diagnosticCode === DiagnosticCodes.InferredActionSubject || request.diagnosticCode === DiagnosticCodes.ChangedActionSubject);\n const actions = requests.length === 0 ? subjectFixes(undefined, diagnosticCode) : subjectRequests.flatMap(request => subjectFixes(request.line, request.diagnosticCode));\n return [...localFixes, ...fixes, ...actions];\n };\n}\n\nfunction prepareLocalQuickFixes(source: string, options: Pick<QuickFixOptions, 'placement'>): (line?: number | readonly { line: number; diagnosticCode: string }[], diagnosticCode?: string) => QuickFix[] {\n const original = parseForAuthoring(source, undefined, options.placement);\n // PLAY0614 and the public-event boundary errors that follow from a missing direction are errors the repair itself removes,\n // so a document whose only errors are public-event boundary errors stays repairable.\n // Inline JSON (PLAY0833) is likewise an error its own repair removes.\n const publicEventCodes: ReadonlySet<string> = new Set([...Array.from({ length: 14 }, (_, index) => `PLAY0${607 + index}`), DiagnosticCodes.InlineJsonValue]);\n const acceptable = (parsed: ReturnType<typeof parseForAuthoring>): boolean => parsed.success || parsed.diagnostics.every(diagnostic => diagnostic.severity !== 'error' || publicEventCodes.has(diagnostic.code));\n const errorCodes = (parsed: ReturnType<typeof parseForAuthoring>): Set<string> => new Set(parsed.diagnostics.filter(diagnostic => diagnostic.severity === 'error').map(diagnostic => diagnostic.code));\n if (!acceptable(original)) return () => [];\n const lines = splitLines(source);\n const eventsByLine = new Map<number, EventSyntax>();\n const slicesByLine = new Map<number, SliceSyntax>();\n const rulesByLine = new Map<number, ValidationRuleSyntax>();\n // Index inline and standalone declarations once, without scanning the tree per diagnostic.\n const walker = new class extends ScreenplaySyntaxWalker {\n override visitValidationRule(rule: ValidationRuleSyntax): void { rulesByLine.set(rule.location.line, rule); super.visitValidationRule(rule); }\n override visitEvent(event: EventSyntax): void { eventsByLine.set(event.location.line, event); }\n override visitSlice(slice: SliceSyntax): void { slicesByLine.set(slice.location.line, slice); super.visitSlice(slice); }\n }();\n walker.visitApplication(original.value);\n const counts = new Map<string, number>();\n const byLine = new Map<number, QuickFixCandidate>();\n // Duplicate removal and legacy spelling can share a header. Keep their independently verified recipes separate.\n const duplicateByLine = new Map<number, QuickFix>();\n const duplicateVerdicts = new Map<number, QuickFix | undefined>();\n const events = new Map<number, EventSyntax>();\n let event: EventSyntax | undefined;\n for (const line of lines) {\n event = eventsByLine.get(line.number) ?? event;\n if (event !== undefined) events.set(line.number, event);\n }\n for (const diagnostic of original.diagnostics) {\n counts.set(diagnostic.code, (counts.get(diagnostic.code) ?? 0) + 1);\n const line = lines[diagnostic.location.line - 1];\n if (diagnostic.code === DiagnosticCodes.DuplicateComplianceMarker) {\n const edit = duplicateComplianceMarkerEdit(line.raw, line.startOffset);\n if (edit !== undefined) duplicateByLine.set(line.number, { diagnosticCode: diagnostic.code, title: 'Remove duplicate compliance markers', scope: 'occurrence', edits: [edit] });\n }\n const length = legacyOptionalTypeLength(line.raw, diagnostic);\n if (length > 0) {\n byLine.set(line.number, { line: line.number, fix: { diagnosticCode: diagnostic.code, title: \"Use 'optional' instead of '?'\", scope: 'occurrence', edits: [{ start: line.startOffset + diagnostic.location.column + length - 2, length: 1, text: ' optional' }] } });\n } else if (diagnostic.code === DiagnosticCodes.DeprecatedStudioTextRulePattern) {\n const rule = rulesByLine.get(line.number);\n if (rule?.rule !== 'Matches' || rule.value?.kind !== 'LiteralExpressionSyntax' || typeof rule.value.value !== 'string') continue;\n const replacement = checkPortableMatchPattern(rule.value.value).replacement;\n const match = new RegExp(`\\\\bmatches\\\\s+\"${stringBodyPattern}\"`).exec(line.raw);\n if (replacement === undefined || match === null) continue;\n const spellings = { Equal: '==', NotEqual: '!=', Contains: 'contains', NotContains: 'not contains', StartsWith: 'starts with', EndsWith: 'ends with' };\n const quoted = '\"' + replacement.value.replace(/[\"\\\\\\n\\r\\t]/g, character => JSON.stringify(character).slice(1, -1)) + '\"';\n byLine.set(line.number, { line: line.number,\n fix: { diagnosticCode: diagnostic.code, title: 'Use the equivalent ordinal text rule', scope: 'occurrence', edits: [{ start: line.startOffset + match.index, length: match[0].length, text: spellings[replacement.kind] + ' ' + quoted }] },\n change: { node: rule, replacement: { ...rule, rule: replacement.kind, value: { ...rule.value, value: replacement.value } } as ValidationRuleSyntax } });\n } else if (diagnostic.code === DiagnosticCodes.LegacyComplianceMarker) {\n const edit = complianceMarkerEdit(line.raw, line.startOffset);\n if (edit !== undefined) byLine.set(line.number, { line: line.number, fix: { diagnosticCode: diagnostic.code, title: 'Use bare pii and secret compliance markers', scope: 'occurrence', edits: [edit] } });\n } else if (diagnostic.code === DiagnosticCodes.PublicTranslationRequiresDirection) {\n // PLAY0614 is only reported on the declaration line of a Translate slice that has no direction.\n const slice = slicesByLine.get(line.number)!;\n // Offer a direction only when exactly one is consistent with the slice: the other would add errors.\n const indent = /^\\s*/.exec(line.raw)![0];\n const ending = source.includes('\\r\\n') ? '\\r\\n' : '\\n';\n const candidates = [TranslationDirection.Inbound, TranslationDirection.Outbound].map(direction => ({ direction, text: `${ending}${indent} direction ${direction === TranslationDirection.Inbound ? 'inbound' : 'outbound'}` }))\n .filter(candidate => {\n // The insertion point is the end of an existing line, so the edit is always in bounds.\n const edited = applyQuickFixEdits(source, [{ start: line.startOffset + line.raw.length, length: 0, text: candidate.text }])!;\n const parsed = parseForAuthoring(edited, undefined, options.placement);\n const originalCodes = errorCodes(original);\n // Valid when the missing-direction error is gone and the direction introduces no kind of error the document lacked.\n return acceptable(parsed) && ![...errorCodes(parsed)].some(code => code === DiagnosticCodes.PublicTranslationRequiresDirection || !originalCodes.has(code));\n });\n if (candidates.length === 1) {\n const [{ direction, text }] = candidates;\n byLine.set(line.number, { line: line.number, fix: { diagnosticCode: diagnostic.code, title: `Declare 'direction ${direction === TranslationDirection.Inbound ? 'inbound' : 'outbound'}'`, scope: 'occurrence', edits: [{ start: line.startOffset + line.raw.length, length: 0, text }] },\n change: { node: slice, replacement: { ...slice, direction } as SliceSyntax } });\n }\n } else if (diagnostic.code === DiagnosticCodes.LegacyProfileLayout) {\n const fix = legacyProfileLayoutFix(lines, line.number - 1, diagnostic.code);\n if (fix !== undefined) byLine.set(line.number, { line: line.number, fix });\n } else if (diagnostic.code === DiagnosticCodes.RedundantCompositeKeyBraces || diagnostic.code === DiagnosticCodes.ImplicitAuthorizationConjunction) {\n const fix = diagnostic.code === DiagnosticCodes.RedundantCompositeKeyBraces ? redundantKeyBracesFix(source, lines, line.number - 1, diagnostic.code) : implicitAuthorizationFix(source, lines, line.number - 1, diagnostic.code);\n if (fix !== undefined) byLine.set(line.number, { line: line.number, fix });\n } else if (diagnostic.code === DiagnosticCodes.InlineJsonValue) {\n const unit = indentationUnit(lines, line.number - 1);\n const rewrite = rewriteInlineJson(line.raw, unit);\n if (rewrite !== undefined) {\n const ending = source.includes('\\r\\n') ? '\\r\\n' : '\\n';\n byLine.set(line.number, { line: line.number, fix: { diagnosticCode: diagnostic.code, title: 'Write the value as an indented block', scope: 'occurrence', edits: [{ start: line.startOffset + rewrite.start, length: line.raw.length - rewrite.start, text: rewrite.text.replaceAll('\\n', ending) }] } });\n }\n } else if (diagnostic.code === DiagnosticCodes.RedundantEventId && commentStart(line.raw) < 0) {\n const declaration = events.get(line.number);\n if (declaration?.id !== declaration?.name || declaration === undefined) continue;\n byLine.set(line.number, { line: line.number, fix: { diagnosticCode: diagnostic.code, title: 'Remove the redundant event id', scope: 'occurrence', edits: [{ start: line.startOffset, length: (lines[line.number]?.startOffset ?? source.length) - line.startOffset, text: '' }] },\n change: { node: declaration, replacement: { ...declaration, id: null } as EventSyntax } });\n }\n }\n const spellingCodes = [DiagnosticCodes.LegacyOptionalSuffix, DiagnosticCodes.LegacyComplianceMarker];\n const syntax = verificationShape(original);\n const verified = new Map<number, QuickFix | undefined>();\n let rangeVerdicts: Map<number, QuickFix> | undefined;\n const documentChecked = new Set<string>();\n const documentFixes = new Map<string, QuickFix>();\n const verify = (fix: QuickFix, change?: QuickFixCandidate['change']): QuickFix | undefined => {\n const candidate = applyQuickFixEdits(source, fix.edits);\n if (candidate === undefined) return undefined;\n const parsed = parseForAuthoring(candidate, undefined, options.placement);\n if (!acceptable(parsed) || verificationShape(parsed) !== (change === undefined ? syntax : verificationShape(original, [change]))) return undefined;\n return parsed.diagnostics.filter(diagnostic => diagnostic.code === fix.diagnosticCode).length === (counts.get(fix.diagnosticCode) ?? 0) - fix.edits.length ? fix : undefined;\n };\n return (line, diagnosticCode) => {\n const requests = typeof line === 'number' || line === undefined ? undefined : line;\n const duplicateLines = requests === undefined\n ? typeof line === 'number' && (diagnosticCode === undefined || diagnosticCode === DiagnosticCodes.DuplicateComplianceMarker) ? [line] : []\n : requests.filter(request => request.diagnosticCode === DiagnosticCodes.DuplicateComplianceMarker).map(request => request.line);\n const duplicates = [...new Set(duplicateLines)].flatMap(number => {\n const fix = duplicateByLine.get(number);\n if (fix === undefined) return [];\n if (!duplicateVerdicts.has(number)) duplicateVerdicts.set(number, verify(fix));\n const verified = duplicateVerdicts.get(number);\n return verified === undefined ? [] : [verified];\n });\n const selectedCodes = spellingCodes.filter(code => requests === undefined ? diagnosticCode === undefined || diagnosticCode === code : requests.some(request => request.diagnosticCode === code));\n for (const code of selectedCodes.filter(code => !documentChecked.has(code))) {\n const candidates = [...byLine.values()].filter(candidate => candidate.fix.diagnosticCode === code);\n if (candidates.length > 0) {\n const fix = verify({ diagnosticCode: code, title: code === DiagnosticCodes.LegacyOptionalSuffix ? \"Use 'optional' throughout this document\" : 'Use bare pii and secret throughout this document', scope: 'document', edits: candidates.flatMap(candidate => candidate.fix.edits) });\n if (fix !== undefined) documentFixes.set(code, fix);\n }\n documentChecked.add(code);\n }\n const documents = selectedCodes.flatMap(code => documentFixes.has(code) ? [documentFixes.get(code)!] : []);\n if (requests !== undefined) {\n if (rangeVerdicts === undefined) {\n rangeVerdicts = new Map();\n // Source order gives ordered, non-overlapping edits without sorting. Recipes replace\n // distinct nodes/lines; the batch must preserve every other modeled member and remove\n // exactly the expected diagnostics before any of its occurrence edits can be offered.\n const candidates = lines.flatMap(line => byLine.has(line.number) ? [byLine.get(line.number)!] : []);\n const edits = candidates.flatMap(candidate => candidate.fix.edits);\n const candidateSource = applyQuickFixEdits(source, edits);\n if (edits.length > 0 && candidateSource !== undefined) {\n const parsed = parseForAuthoring(candidateSource, undefined, options.placement);\n const changes = candidates.flatMap(candidate => candidate.change === undefined ? [] : [candidate.change]);\n if (acceptable(parsed) && verificationShape(parsed) === verificationShape(original, changes)) {\n const remaining = new Map<string, number>();\n const removed = new Map<string, number>();\n for (const diagnostic of parsed.diagnostics) remaining.set(diagnostic.code, (remaining.get(diagnostic.code) ?? 0) + 1);\n for (const candidate of candidates) removed.set(candidate.fix.diagnosticCode, (removed.get(candidate.fix.diagnosticCode) ?? 0) + candidate.fix.edits.length);\n if ([...removed].every(([code, count]) => (remaining.get(code) ?? 0) === (counts.get(code) ?? 0) - count)) {\n for (const candidate of candidates) rangeVerdicts.set(candidate.line, candidate.fix);\n }\n }\n }\n }\n const selected = new Map<number, QuickFix>();\n for (const request of requests) {\n const fix = rangeVerdicts.get(request.line);\n if (fix?.diagnosticCode === request.diagnosticCode) selected.set(request.line, fix);\n }\n return [...selected.values(), ...duplicates, ...documents];\n }\n const occurrenceLine = typeof line === 'number' ? line : undefined;\n const selected = occurrenceLine === undefined ? undefined : byLine.get(occurrenceLine);\n let occurrenceFix: QuickFix | undefined;\n if (selected !== undefined && occurrenceLine !== undefined && (diagnosticCode === undefined || selected.fix.diagnosticCode === diagnosticCode)) {\n if (!verified.has(occurrenceLine)) {\n if (verified.size === 32) verified.delete(verified.keys().next().value!);\n verified.set(occurrenceLine, verify(selected.fix, selected.change));\n }\n occurrenceFix = verified.get(occurrenceLine);\n }\n return [...(occurrenceFix === undefined ? [] : [occurrenceFix]), ...duplicates, ...documents];\n };\n}\n\n// PLAY0791 is reported on the `ui profile` line. The canonical form is `root template <Name>`; beside a root template the legacy line is ignored, so it is removed.\nfunction legacyProfileLayoutFix(lines: readonly { readonly number: number; readonly raw: string; readonly startOffset: number }[], headerIndex: number, diagnosticCode: string): QuickFix | undefined {\n const indentOf = (raw: string): number => /^\\s*/.exec(raw)![0].length;\n const headerIndent = indentOf(lines[headerIndex].raw);\n let layout: { readonly index: number; readonly indent: number } | undefined;\n let hasRoot = false;\n for (let index = headerIndex + 1; index < lines.length; index++) {\n const raw = lines[index].raw;\n if (raw.trim().length === 0) continue;\n if (indentOf(raw) <= headerIndent) break;\n if (layout === undefined && /^\\s*layout\\s+[A-Za-z_]\\w*\\s*$/.test(raw)) layout = { index, indent: indentOf(raw) };\n if (/^\\s*root\\s+template(\\s|$)/.test(raw)) hasRoot = true;\n }\n if (layout === undefined) return undefined;\n const line = lines[layout.index];\n return hasRoot\n ? { diagnosticCode, title: 'Remove the ignored layout line', scope: 'occurrence', edits: [{ start: line.startOffset, length: (lines[layout.index + 1]?.startOffset ?? line.startOffset + line.raw.length) - line.startOffset, text: '' }] }\n : { diagnosticCode, title: \"Use 'root template' instead of 'layout'\", scope: 'occurrence', edits: [{ start: line.startOffset + layout.indent, length: 'layout'.length, text: 'root template' }] };\n}\n\ntype QuickFixLine = { readonly number: number; readonly raw: string; readonly indent: number; readonly content: string; readonly startOffset: number };\n\n// The step one level of the document indents by, read from the nearest shallower line above; two spaces otherwise.\nfunction indentationUnit(lines: readonly QuickFixLine[], index: number): string {\n const indent = lines[index].indent;\n const parent = lines.slice(0, index).reverse().find(line => line.content.length > 0 && line.indent < indent);\n return ' '.repeat(parent === undefined ? 2 : indent - parent.indent);\n}\n\n// One edit from the opening brace to the end of the closing line, so the fix removes exactly one diagnostic. A closing brace that carries a comment is left alone.\nfunction redundantKeyBracesFix(source: string, lines: readonly QuickFixLine[], keyIndex: number, diagnosticCode: string): QuickFix | undefined {\n const key = lines[keyIndex];\n if (!key.content.endsWith('{')) return undefined;\n const brace = key.indent + key.content.length - 1;\n const prefix = key.raw.slice(0, brace).trimEnd().length;\n for (let index = keyIndex + 1; index < lines.length; index++) {\n const candidate = lines[index];\n if (candidate.content.length === 0 || candidate.indent > key.indent) continue;\n if (candidate.indent !== key.indent || candidate.content !== '}' || candidate.raw.trim() !== '}') return undefined;\n const next = lines[index + 1];\n const keep = source.slice(key.startOffset + key.raw.length, candidate.startOffset);\n const text = key.raw.slice(brace + 1) + (next === undefined ? keep.replace(/\\r?\\n$/, '') : keep);\n const start = key.startOffset + prefix;\n return { diagnosticCode, title: 'Remove the redundant composite key braces', scope: 'occurrence', edits: [{ start, length: (next?.startOffset ?? source.length) - start, text }] };\n }\n return undefined;\n}\n\n// One edit from the first to the last operand that needs an 'and', so the fix removes exactly one diagnostic.\nfunction implicitAuthorizationFix(source: string, lines: readonly QuickFixLine[], authorizeIndex: number, diagnosticCode: string): QuickFix | undefined {\n const first = lines[authorizeIndex];\n if (!first.content.startsWith('authorize')) return undefined;\n const found: { index: number; length: number }[] = [];\n let previous: string | undefined;\n const visit = (line: QuickFixLine, from: number): void => {\n const result = implicitConjunctionTokens(line.content.slice(from), previous);\n previous = result.previous;\n for (const token of result.tokens) found.push({ index: line.startOffset + line.indent + from + token.index, length: token.length });\n };\n visit(first, 'authorize'.length);\n for (let index = authorizeIndex + 1; index < lines.length; index++) {\n const line = lines[index];\n if (line.content.length === 0) continue;\n if (line.indent <= first.indent || !isAuthorizeContinuation(line.content)) break;\n visit(line, 0);\n }\n if (found.length === 0) return undefined;\n const last = found[found.length - 1];\n const text = found.map((token, index) => 'and ' + source.slice(token.index, index < found.length - 1 ? found[index + 1].index : token.index + token.length)).join('');\n return { diagnosticCode, title: \"Write 'and' between the adjacent authorize policies\", scope: 'occurrence', edits: [{ start: found[0].index, length: last.index + last.length - found[0].index, text }] };\n}\n\nfunction duplicateComplianceMarkerEdit(raw: string, startOffset: number): QuickFixEdit | undefined {\n const header = pattern('^(\\\\s*concept\\\\s+\\\\w+\\\\s*:\\\\s*\\\\w+)((?:[^\\\\S\\\\r\\\\n]+@?\\\\w+)*)').exec(raw);\n if (header === null) return undefined;\n const suffix = header[2];\n const seen = new Set<string>();\n const text = suffix.replace(new RegExp(pattern('[^\\\\S\\\\r\\\\n]+(@?\\\\w+)').source, 'gu'), (token, marker: string) => {\n const wire = complianceWireName(marker);\n if (seen.has(wire)) return '';\n seen.add(wire);\n return token;\n });\n return text === suffix ? undefined : { start: startOffset + header[1].length, length: suffix.length, text };\n}\n\nfunction complianceMarkerEdit(raw: string, startOffset: number): QuickFixEdit | undefined {\n // Restrict rewriting to the suffix or leading directive marker, never comments or quoted reasons.\n const header = pattern('^(\\\\s*concept\\\\s+\\\\w+\\\\s*:\\\\s*\\\\w+)((?:[^\\\\S\\\\r\\\\n]+@?\\\\w+)*)').exec(raw);\n if (header !== null) {\n const suffix = header[2];\n const text = suffix.replace(/@pii\\b|@?sensitive\\b/g, marker => marker === '@pii' ? 'pii' : 'secret');\n return text === suffix ? undefined : { start: startOffset + header[1].length, length: suffix.length, text };\n }\n const directive = pattern('^(\\\\s*)(@pii|@?sensitive)\\\\b').exec(raw);\n return directive === null ? undefined : { start: startOffset + directive[1].length, length: directive[2].length, text: directive[2] === '@pii' ? 'pii' : 'secret' };\n}\n\nfunction verificationShape(parsed: ReturnType<typeof parseForAuthoring>, changes: readonly NonNullable<QuickFixCandidate['change']>[] = []): string {\n // Compare every modeled member (including trigger data), ignoring only source locations. A recipe\n // may replace only its original node; no other id or destination is normalized away.\n const replacements = new Map(changes.map(change => [change.node, change.replacement]));\n return JSON.stringify([parsed.value, parsed.triggerData], (key, value: unknown) => ['location', 'usesLocation', 'targetLocation'].includes(key) ? undefined : replacements.get(value as NonNullable<QuickFixCandidate['change']>['node']) ?? value);\n}\n\n// One forward pass; applying N edits by repeatedly slicing the document would be quadratic.\nexport function applyQuickFixEdits(source: string, edits: readonly QuickFixEdit[]): string | undefined {\n const parts: string[] = [];\n let end = 0;\n for (const edit of edits) {\n if (edit.start < end || edit.start < 0 || edit.length < 0 || edit.start + edit.length > source.length) return undefined;\n parts.push(source.slice(end, edit.start), edit.text);\n end = edit.start + edit.length;\n }\n parts.push(source.slice(end));\n return parts.join('');\n}\n"],"mappings":"A,u5BAgDA,MAAMA,kBAAgD,IAAI,IAAI,CAC1DC,EAAgB,sBAChBA,EAAgB,qBAChBA,EAAgB,oBAChBA,EAAgB,gCAChBA,EAAgB,0BAChBA,EAAgB,qBAChBA,EAAgB,uBAChBA,EAAgB,iBAChBA,EAAgB,mCAChBA,EAAgB,oBAChBA,EAAgB,4BA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