@cratis/screenplay-language 4.73.2 → 4.74.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -1,10 +1,10 @@
1
- import{$ as gn,A as L,B as q,C as tn,D as nn,E as on,F as rn,G as F,H as it,I as U,J as an,K as V,L as xe,M as sn,N as we,O as cn,P as ee,Q as ln,R as mn,S as un,T as pn,W as dn,X as Te,Y as hn,Z as yn,_ as fn,a as M,aa as bn,b as Je,ba as ke,c as re,d as be,e as J,f as Yt,g as Jt,h as $e,i as W,j as Xt,k as Xe,l as ve,m as C,n as et,o as X,p as ie,q as tt,r as nt,s as ot,t as D,u as S,v as en,w as E,x as z,y as H,z as rt}from"./chunk-WZ4PM4ZP.js";import{a as h}from"./chunk-AYDF3IFZ.js";var at=/[\p{L}\p{Mn}\p{Nd}\p{Pc}]/u,st=h(e=>`\\u${e.toString(16).padStart(4,"0")}`,"escape");function $n(){let e="";for(let n=0;n<=65535;n++){if(!at.test(String.fromCharCode(n)))continue;let t=n;for(;n<65535&&at.test(String.fromCharCode(n+1));)n++;e+=st(t)+(n>t?`-${st(n)}`:"")}return e}h($n,"ranges");var G=$n();var lt=new Set(["operation","system","eventsource"]),Ce={csharp:"csharp",typescript:"typescript",react:"typescript",html:"html",sql:"sql"};function ct(e){return`subLanguage_${e}`}h(ct,"subLanguageState");function vn(e){let n=[...re.filter(t=>!lt.has(t)),...e.map(t=>t.keyword)];return[new RegExp(`^\\s*(?:${n.join("|")})\\b`),{token:"@rematch",next:"@pop"}]}h(vn,"subLanguageExitRule");var xn=[[/\/\/.*$/,"comment"],[/^(numbers)([ \t]+)(exact)(?=[ \t]*(?:(?:\/\/|#).*)?$)/,["keyword","white","keyword"]],[/\$(?:context|eventContext|eventSourceId|causedBy)(?:\.\w+)*/,"variable.predefined"],[/\$(?:env|secrets|strings)\.[\w.]+/,"variable.predefined"],[/\$\.[\w.]*/,"variable.predefined"],[/"(?:[^"\\]|\\.)*"/,"string"],[/"(?:[^"\\]|\\.)*$/,"string.invalid"],[/\d+(?:ms|s|m|h|d)\b/,"number"],[/-?\d+\.\d+/,"number.float"],[/-?\d+/,"number"],[/=>|==|!=|>=|<=|[><=:?]/,"operator"],[/[[\](),.]/,"delimiter"],[/\s+/,"white"]];function mt(e){let n={root:[[/^(eventsource)(\s+)([A-Za-z_]\w*)(?=\s*(?:\/\/.*)?$)/,["keyword","white","type.identifier"]],[/^(system)(\s+)([A-Z]\w*)(?=\s*(?:\/\/.*)?$)/,["keyword","white","type.identifier"]],[/^(\s*)(produces\s+operation)(\s+)([A-Z]\w*)(?=\s*(?:\/\/.*)?$)/,["white","keyword","white",{token:"type.identifier",next:"@operationBody.$1"}]],[/^(\s*)(given\s+operation)(\s+)([\w.]+)(\s+)(fails)(?=\s*(?:\/\/.*)?$)/,["white","keyword","white","type.identifier","white","keyword"]],[/^(\s*)(then\s+(?:operation|compensated))(\s+)([\w.]+)(?=\s*(?:\/\/.*)?$)/,["white","keyword","white","type.identifier"]],[new RegExp(`^(\\s*)(command)(\\s+)([A-Za-z_][${G}]*)(?=\\s*(?://.*)?$)`),["white","keyword","white",{token:"type.identifier",next:"@commandBody.$1"}]],[/^(\s*)(handler)(?=\s*(?:\/\/.*)?$)/,["white",{token:"keyword",next:"@handlerBody.$1"}]],[/^(\s*@?[a-z_]\w*\s+)([\w.]+(?:\[\])?(?:\?|\s+optional)?)(\s+)(generated)(\s+identifier)?(?=\s*(?:\/\/.*)?$)/,["identifier","type.identifier","white","keyword","keyword"]],[/^(\s*)(generated)(\s+)([a-z_]\w*)(\s*=(?!=|>))/,["white","keyword","white","identifier","operator"]],[/^(\s*)(then)(\s+)(returns)\b/,["white","keyword","white","keyword"]],[/^(\s*)(returns)(?=\s*(?:\/\/.*)?$|\s+@\w+\s*(?:\/\/.*)?$)/,["white","keyword"]],[/^(\s*(?:by|filter)\s+[a-z_]\w*\s+)([\w.]+(?:\[\])?)(\s+)(optional)\b(?=\s*(?:from\b|\/\/|$))/,["identifier","type.identifier","white","keyword"]],[/^(?!\s*(?:by|filter)\s+)(\s*@?[a-z_]\w*\s+)([\w.]+(?:\[\])?)(\s+)(optional)\b(?=\s*(?:identifier\b|from\b|=(?!=|>)|\/\/|$))/,["identifier","type.identifier","white","keyword"]],[/^(\s*query\s+[A-Za-z_]\w*\s*=>\s*(?!observable\s+optional\s*(?:\/\/.*)?$)(?:observable\s+)?)([\w.]+(?:\[\])?)(\s+)(optional)\b(?=\s*(?:\/\/.*)?$)/,["keyword","type.identifier","white","keyword"]],[/^(\s*)(given|when)(\s+)(clock|capture|trigger|query)\b/,["white","keyword","white","keyword"]],[/^(\s*)(then)(\s+)(result|no\s+result)\b/,["white","keyword","white","keyword"]],[/^(\s*)(import)(\s+)("[^"\\]*")/,["white","keyword","white","string.link"]],[/^(\s*)((?:produces\s+)?event)(\s+)([A-Za-z_]\w*)(\s+)(generation)(\s+)(\d+)(?=\s*(?:\/\/.*)?$)/,["white","keyword","white","type.identifier","white","keyword","white",{token:"number",next:"@eventBody.$1"}]],[/^(\s*)((?:produces\s+)?event)(\s+)([A-Za-z_]\w*)(?=\s*(?:\/\/.*)?$)/,["white","keyword","white",{token:"type.identifier",next:"@eventBody.$1"}]],...J.map(t=>[new RegExp(`^\\s*\\x60\\x60\\x60${t}\\s*$`),{token:"string.quote",next:`@codeBlock.${Ce[t]}`,nextEmbedded:Ce[t]}]),...J.map(t=>[new RegExp(`\\b${t}\\b(?=\\s*$)`),{token:"keyword.tag",next:`@codeBlockPending.${Ce[t]}`}]),...e.map(t=>[new RegExp(`\\b${t.keyword}\\b`),{token:"keyword",next:`@${ct(t.keyword)}`}]),[/\bdescription\b(?=\s*$)/,{token:"keyword",next:"@descriptionBlockPending"}],[/\brow-click\b/,"keyword"],[/^\s*@[a-z_]\w*/,"identifier"],[/@\w+/,"annotation"],[/[A-Z]\w*/,{cases:{"@sliceTypes":"keyword.type","@primitiveTypes":"type","@default":"type.identifier"}}],[/[a-z_]\w*/,{cases:{"@keywords":"keyword","@default":"identifier"}}],{include:"@common"}],commandBody:[[/^(?!$S2[ \t]+|\s*$)/,{token:"@rematch",next:"@pop"}],[/^(\s*)(validate)(?=\s*(?:\/\/.*)?$)/,["white",{token:"keyword",next:"@commandValidation.$1"}]],{include:"@root"}],commandValidation:[[/^(?!$S2[ \t]+|\s*$)/,{token:"@rematch",next:"@pop"}],[new RegExp(`^(\\s*)([${G}.]+)(\\s+)(rule)(\\s+)([A-Za-z_][${G}]*)(?=\\s*(?:severity\\s+\\w+|message\\s+.*|//.*|$))`),["white","identifier","white","keyword","white",{token:"type.identifier",next:"@namedRuleBody.$1"}]],{include:"@root"}],namedRuleBody:[[/^(?!$S2[ \t]+|\s*$)/,{token:"@rematch",next:"@pop"}],[/^(\s*)(implementation)(?=\s*(?:\/\/.*)?$)/,["white",{token:"keyword",next:"@implementationBody.$1"}]],{include:"@root"}],operationBody:[[/^(?!$S2[ \t]+|\s*$)/,{token:"@rematch",next:"@pop"}],[/^(\s*)(execute|compensate)(?=\s*(?:\/\/.*)?$)/,["white",{token:"keyword",next:"@operationPhase.$1"}]],[/^(\s*)(uses)(\s+)([A-Z]\w*)(?=\s*(?:\/\/.*)?$)/,["white","keyword","white","type.identifier"]],[/^(\s*)(@?[a-z_]\w*)(\s+)([\w.]+(?:\[\])?(?:\?|\s+optional)?)(?=\s*(?:=(?!=|>)|\/\/|$))/,["white","identifier","white","type.identifier"]],{include:"@root"}],operationPhase:[[/^(?!$S2[ \t]+|\s*$)/,{token:"@rematch",next:"@pop"}],[/^(\s*)(implementation)(?=\s*(?:\/\/.*)?$)/,["white",{token:"keyword",next:"@implementationBody.$1"}]],{include:"@root"}],handlerBody:[[/^(?!$S2[ \t]+|\s*$)/,{token:"@rematch",next:"@pop"}],[/^(\s*)(implementation)(?=\s*(?:\/\/.*)?$)/,["white",{token:"keyword",next:"@implementationBody.$1"}]],{include:"@root"}],implementationBody:[[/^(?!$S2[ \t]+|\s*$)/,{token:"@rematch",next:"@pop"}],[/^(\s*)(hint)(?=\s+")/,["white","keyword"]],{include:"@root"}],eventBody:[[/^(?!$S2[ \t]+|\s*$)/,{token:"@rematch",next:"@pop"}],[/^(\s*)(id)(?=\s+")/,["white","keyword"]],[/^(\s*)(documentation)(?=\s*(?:\/\/.*)?$)/,["white",{token:"keyword",next:"@descriptionBlockPending"}]],{include:"@root"}],common:xn,codeBlockPending:[[/^\s*```\s*$/,{token:"string.quote",switchTo:"@codeBlock.$S2",nextEmbedded:"$S2"}],[/^\s*[^\s`].*$/,{token:"@rematch",next:"@pop"}],[/\s+/,"white"]],codeBlock:[[/^\s*```\s*$/,{token:"string.quote",next:"@pop",nextEmbedded:"@pop"}],[/[^`]+/,""],[/`/,""]],descriptionBlockPending:[[/\/\/.*$/,"comment"],[/^\s*```(?:text|markdown)?\s*$/,{token:"string.quote",switchTo:"@descriptionBlock"}],[/^\s*[^\s`].*$/,{token:"@rematch",next:"@pop"}],[/\s+/,"white"]],descriptionBlock:[[/^\s*```\s*$/,{token:"string.quote",next:"@pop"}],[/.+/,"string"]]};for(let t of e)n[ct(t.keyword)]=[vn(e),...t.tokens,{include:"@common"},[/[A-Z]\w*/,"type.identifier"],[/[a-z_]\w*/,"identifier"]];return{defaultToken:"",tokenPostfix:".play",ignoreCase:!1,keywords:[...re.filter(t=>!lt.has(t)),...be,...J],sliceTypes:$e,primitiveTypes:W,tokenizer:n}}h(mt,"createTokensProvider");var ae=[{label:"optional",insertText:"optional",documentation:"Allows the complete value, including a collection, to be absent."}],R=h(e=>`\`\`\`${e}
1
+ import{$ as gn,A as L,B as q,C as tn,D as nn,E as on,F as rn,G as F,H as it,I as H,J as an,K as V,L as xe,M as sn,N as we,O as cn,P as ee,Q as ln,R as mn,S as un,T as dn,W as pn,X as Te,Y as hn,Z as yn,_ as fn,a as M,aa as bn,b as Je,ba as ke,c as re,d as be,e as J,f as Yt,g as Jt,h as $e,i as W,j as Xt,k as Xe,l as ve,m as C,n as et,o as X,p as ie,q as tt,r as nt,s as ot,t as D,u as S,v as en,w as P,x as z,y as U,z as rt}from"./chunk-ZVFXYPUI.js";import{a as h}from"./chunk-AYDF3IFZ.js";var at=/[\p{L}\p{Mn}\p{Nd}\p{Pc}]/u,st=h(e=>`\\u${e.toString(16).padStart(4,"0")}`,"escape");function $n(){let e="";for(let n=0;n<=65535;n++){if(!at.test(String.fromCharCode(n)))continue;let t=n;for(;n<65535&&at.test(String.fromCharCode(n+1));)n++;e+=st(t)+(n>t?`-${st(n)}`:"")}return e}h($n,"ranges");var G=$n();var lt=new Set(["operation","system","eventsource"]),Ce={csharp:"csharp",typescript:"typescript",react:"typescript",html:"html",sql:"sql"};function ct(e){return`subLanguage_${e}`}h(ct,"subLanguageState");function vn(e){let n=[...re.filter(t=>!lt.has(t)),...e.map(t=>t.keyword)];return[new RegExp(`^\\s*(?:${n.join("|")})\\b`),{token:"@rematch",next:"@pop"}]}h(vn,"subLanguageExitRule");var xn=[[/\/\/.*$/,"comment"],[/^(numbers)([ \t]+)(exact)(?=[ \t]*(?:(?:\/\/|#).*)?$)/,["keyword","white","keyword"]],[/\$(?:context|eventContext|eventSourceId|causedBy)(?:\.\w+)*/,"variable.predefined"],[/\$(?:env|secrets|strings)\.[\w.]+/,"variable.predefined"],[/\$\.[\w.]*/,"variable.predefined"],[/"(?:[^"\\]|\\.)*"/,"string"],[/"(?:[^"\\]|\\.)*$/,"string.invalid"],[/\d+(?:ms|s|m|h|d)\b/,"number"],[/-?\d+\.\d+/,"number.float"],[/-?\d+/,"number"],[/=>|==|!=|>=|<=|[><=:?]/,"operator"],[/[[\](),.]/,"delimiter"],[/\s+/,"white"]];function mt(e){let n={root:[[/^(eventsource)(\s+)([A-Za-z_]\w*)(?=\s*(?:\/\/.*)?$)/,["keyword","white","type.identifier"]],[/^(system)(\s+)([A-Z]\w*)(?=\s*(?:\/\/.*)?$)/,["keyword","white","type.identifier"]],[/^(\s*)(produces\s+operation)(\s+)([A-Z]\w*)(?=\s*(?:\/\/.*)?$)/,["white","keyword","white",{token:"type.identifier",next:"@operationBody.$1"}]],[/^(\s*)(given\s+operation)(\s+)([\w.]+)(\s+)(fails)(?=\s*(?:\/\/.*)?$)/,["white","keyword","white","type.identifier","white","keyword"]],[/^(\s*)(then\s+(?:operation|compensated))(\s+)([\w.]+)(?=\s*(?:\/\/.*)?$)/,["white","keyword","white","type.identifier"]],[new RegExp(`^(\\s*)(command)(\\s+)([A-Za-z_][${G}]*)(?=\\s*(?://.*)?$)`),["white","keyword","white",{token:"type.identifier",next:"@commandBody.$1"}]],[/^(\s*)(handler)(?=\s*(?:\/\/.*)?$)/,["white",{token:"keyword",next:"@handlerBody.$1"}]],[/^(\s*@?[a-z_]\w*\s+)([\w.]+(?:\[\])?(?:\?|\s+optional)?)(\s+)(generated)(\s+identifier)?(?=\s*(?:\/\/.*)?$)/,["identifier","type.identifier","white","keyword","keyword"]],[/^(\s*)(generated)(\s+)([a-z_]\w*)(\s*=(?!=|>))/,["white","keyword","white","identifier","operator"]],[/^(\s*)(then)(\s+)(returns)\b/,["white","keyword","white","keyword"]],[/^(\s*)(returns)(?=\s*(?:\/\/.*)?$|\s+@\w+\s*(?:\/\/.*)?$)/,["white","keyword"]],[/^(\s*(?:by|filter)\s+[a-z_]\w*\s+)([\w.]+(?:\[\])?)(\s+)(optional)\b(?=\s*(?:from\b|\/\/|$))/,["identifier","type.identifier","white","keyword"]],[/^(?!\s*(?:by|filter)\s+)(\s*@?[a-z_]\w*\s+)([\w.]+(?:\[\])?)(\s+)(optional)\b(?=\s*(?:identifier\b|from\b|=(?!=|>)|\/\/|$))/,["identifier","type.identifier","white","keyword"]],[/^(\s*query\s+[A-Za-z_]\w*\s*=>\s*(?!observable\s+optional\s*(?:\/\/.*)?$)(?:observable\s+)?)([\w.]+(?:\[\])?)(\s+)(optional)\b(?=\s*(?:\/\/.*)?$)/,["keyword","type.identifier","white","keyword"]],[/^(\s*)(given|when)(\s+)(clock|capture|trigger|query)\b/,["white","keyword","white","keyword"]],[/^(\s*)(then)(\s+)(result|no\s+result)\b/,["white","keyword","white","keyword"]],[/^(\s*)(import)(\s+)("[^"\\]*")/,["white","keyword","white","string.link"]],[/^(\s*)((?:produces\s+)?event)(\s+)([A-Za-z_]\w*)(\s+)(generation)(\s+)(\d+)(?=\s*(?:\/\/.*)?$)/,["white","keyword","white","type.identifier","white","keyword","white",{token:"number",next:"@eventBody.$1"}]],[/^(\s*)((?:produces\s+)?event)(\s+)([A-Za-z_]\w*)(?=\s*(?:\/\/.*)?$)/,["white","keyword","white",{token:"type.identifier",next:"@eventBody.$1"}]],...J.map(t=>[new RegExp(`^\\s*\\x60\\x60\\x60${t}\\s*$`),{token:"string.quote",next:`@codeBlock.${Ce[t]}`,nextEmbedded:Ce[t]}]),...J.map(t=>[new RegExp(`\\b${t}\\b(?=\\s*$)`),{token:"keyword.tag",next:`@codeBlockPending.${Ce[t]}`}]),...e.map(t=>[new RegExp(`\\b${t.keyword}\\b`),{token:"keyword",next:`@${ct(t.keyword)}`}]),[/\bdescription\b(?=\s*$)/,{token:"keyword",next:"@descriptionBlockPending"}],[/\brow-click\b/,"keyword"],[/^\s*@[a-z_]\w*/,"identifier"],[/@\w+/,"annotation"],[/[A-Z]\w*/,{cases:{"@sliceTypes":"keyword.type","@primitiveTypes":"type","@default":"type.identifier"}}],[/[a-z_]\w*/,{cases:{"@keywords":"keyword","@default":"identifier"}}],{include:"@common"}],commandBody:[[/^(?!$S2[ \t]+|\s*$)/,{token:"@rematch",next:"@pop"}],[/^(\s*)(validate)(?=\s*(?:\/\/.*)?$)/,["white",{token:"keyword",next:"@commandValidation.$1"}]],{include:"@root"}],commandValidation:[[/^(?!$S2[ \t]+|\s*$)/,{token:"@rematch",next:"@pop"}],[new RegExp(`^(\\s*)([${G}.]+)(\\s+)(rule)(\\s+)([A-Za-z_][${G}]*)(?=\\s*(?:severity\\s+\\w+|message\\s+.*|//.*|$))`),["white","identifier","white","keyword","white",{token:"type.identifier",next:"@namedRuleBody.$1"}]],{include:"@root"}],namedRuleBody:[[/^(?!$S2[ \t]+|\s*$)/,{token:"@rematch",next:"@pop"}],[/^(\s*)(implementation)(?=\s*(?:\/\/.*)?$)/,["white",{token:"keyword",next:"@implementationBody.$1"}]],{include:"@root"}],operationBody:[[/^(?!$S2[ \t]+|\s*$)/,{token:"@rematch",next:"@pop"}],[/^(\s*)(execute|compensate)(?=\s*(?:\/\/.*)?$)/,["white",{token:"keyword",next:"@operationPhase.$1"}]],[/^(\s*)(uses)(\s+)([A-Z]\w*)(?=\s*(?:\/\/.*)?$)/,["white","keyword","white","type.identifier"]],[/^(\s*)(@?[a-z_]\w*)(\s+)([\w.]+(?:\[\])?(?:\?|\s+optional)?)(?=\s*(?:=(?!=|>)|\/\/|$))/,["white","identifier","white","type.identifier"]],{include:"@root"}],operationPhase:[[/^(?!$S2[ \t]+|\s*$)/,{token:"@rematch",next:"@pop"}],[/^(\s*)(implementation)(?=\s*(?:\/\/.*)?$)/,["white",{token:"keyword",next:"@implementationBody.$1"}]],{include:"@root"}],handlerBody:[[/^(?!$S2[ \t]+|\s*$)/,{token:"@rematch",next:"@pop"}],[/^(\s*)(implementation)(?=\s*(?:\/\/.*)?$)/,["white",{token:"keyword",next:"@implementationBody.$1"}]],{include:"@root"}],implementationBody:[[/^(?!$S2[ \t]+|\s*$)/,{token:"@rematch",next:"@pop"}],[/^(\s*)(hint)(?=\s+")/,["white","keyword"]],{include:"@root"}],eventBody:[[/^(?!$S2[ \t]+|\s*$)/,{token:"@rematch",next:"@pop"}],[/^(\s*)(id)(?=\s+")/,["white","keyword"]],[/^(\s*)(documentation)(?=\s*(?:\/\/.*)?$)/,["white",{token:"keyword",next:"@descriptionBlockPending"}]],{include:"@root"}],common:xn,codeBlockPending:[[/^\s*```\s*$/,{token:"string.quote",switchTo:"@codeBlock.$S2",nextEmbedded:"$S2"}],[/^\s*[^\s`].*$/,{token:"@rematch",next:"@pop"}],[/\s+/,"white"]],codeBlock:[[/^\s*```\s*$/,{token:"string.quote",next:"@pop",nextEmbedded:"@pop"}],[/[^`]+/,""],[/`/,""]],descriptionBlockPending:[[/\/\/.*$/,"comment"],[/^\s*```(?:text|markdown)?\s*$/,{token:"string.quote",switchTo:"@descriptionBlock"}],[/^\s*[^\s`].*$/,{token:"@rematch",next:"@pop"}],[/\s+/,"white"]],descriptionBlock:[[/^\s*```\s*$/,{token:"string.quote",next:"@pop"}],[/.+/,"string"]]};for(let t of e)n[ct(t.keyword)]=[vn(e),...t.tokens,{include:"@common"},[/[A-Z]\w*/,"type.identifier"],[/[a-z_]\w*/,"identifier"]];return{defaultToken:"",tokenPostfix:".play",ignoreCase:!1,keywords:[...re.filter(t=>!lt.has(t)),...be,...J],sliceTypes:$e,primitiveTypes:W,tokenizer:n}}h(mt,"createTokensProvider");var ae=[{label:"optional",insertText:"optional",documentation:"Allows the complete value, including a collection, to be absent."}],N=h(e=>`\`\`\`${e}
2
2
  \${1}
3
- \`\`\``,"fenced"),ut=[{label:"eventsource",insertText:"eventsource ${1:Name}\n identifier ${2:Type}\n stream ${3:Name}",documentation:"Application-owned source with nested streams; not admitted by any supported executable model (ESM) version yet (PLAY0268)."},{label:"system",insertText:'system ${1:Name}\n description "${2:external system}"',documentation:"Application-scoped external system; not admitted by any supported executable model (ESM) version yet."},{label:"import",insertText:"import ${1:Module}.${2:Type}",documentation:"Imports a type from another module by its qualified name."},{label:'import "\u2026"',insertText:'import "${1:**/*.play}"',documentation:"Imports other `.play` files by path or glob, relative to this file's folder, as whole documents of the application."},{label:"concept",insertText:"concept ${1:Name} : ${2|Uuid,String,Int,Decimal,Bool,Date,DateTime|}",documentation:"Declares a formalized value type wrapping a primitive."},{label:"concept (enum)",insertText:"concept ${1:Name} : Enum\n ${2:value}",documentation:"Declares an enumeration concept with a fixed set of values."},{label:"concept (@pii with reason)",insertText:'concept ${1:Name} : ${2|String,Uuid,Int,Decimal,Bool,Date,DateTime|} @pii\n pii reason "${3:why this is personal data, its purpose and lawful basis}"',documentation:"Declares a personal-data concept together with the reason it is personal data."},{label:"type",insertText:"type ${1:Name}\n ${2:property} ${3:Type}",documentation:"Declares a composite value type \u2014 a named shape built from several properties."},{label:"policy",insertText:"policy ${1:Name}\n require ${2:authenticated}",documentation:"Declares a named authorization rule for commands and queries."},{label:"module",insertText:"module ${1:Name}\n ",documentation:"Declares the top-level namespace \u2014 maps to a bounded context."}],Q=[{label:"uses",insertText:"uses ${1:System}",documentation:"Exactly one application-scoped external system."},{label:"description",insertText:'description "${1:intent}"',documentation:"Describes operation intent, without requiring code."},{label:"input",insertText:"${1:input} ${2:Type}",documentation:"Typed operation input; no identifier or generated modifier."},{label:"execute",insertText:'execute\n description "${1:effect}"',documentation:"Optional execution intent; not admitted by any supported executable model (ESM) version yet."},{label:"compensate",insertText:'compensate\n description "${1:undo intent}"',documentation:"Optional compensation intent; not admitted by any supported executable model (ESM) version yet."}],te=[{label:"hint",insertText:'hint "${1:implementation guidance}"',documentation:"Ordered authoring guidance; not an executable implementation role."},{label:"file",insertText:"file ${1:Path}",documentation:"Selects the phase\u2019s sole source attachment."},...["csharp","typescript","react","html","sql"].map(e=>({label:e,insertText:R(e),documentation:"Selects the phase\u2019s sole inline source; not admitted by any supported executable model (ESM) version yet."}))],se=[{label:"description",insertText:'description "${1:phase intent}"',documentation:"A description-only phase is valid, pending intent."},{label:"implementation",insertText:'implementation\n hint "${1:guidance}"',documentation:"Hints with optional source; phase owns File/Code, wrapper owns hints only."},...te.filter(e=>e.label!=="hint")],pt=[{label:"file",insertText:"file ${1:Path}",documentation:"Names the repository relative file this declaration is realized by, so the document can be navigated back to the code."},{label:"pii reason",insertText:'pii reason "${1:why this is personal data, its purpose and lawful basis}"',documentation:"Records why the `@pii` marker applies \u2014 purpose, lawful basis, whose subject it lives under."},{label:"sensitive reason",insertText:'sensitive reason "${1:why this value is sensitive}"',documentation:"Records why the `@sensitive` marker applies."},{label:"validate",insertText:'validate\n ${1:not empty} message "${2:message}"',documentation:"Validation rules that travel with the value everywhere it appears."}],dt=[{label:"file",insertText:"file ${1:Path}",documentation:"Names the repository relative file this declaration is realized by, so the document can be navigated back to the code."},{label:"description",insertText:'description "${1:what this shape represents}"',documentation:"A human-readable description of the type."},{label:"property",insertText:"${1:property} ${2:Type}",documentation:"A property of the type \u2014 a name and a type reference."}],ht=[{label:'import "\u2026"',insertText:'import "${1:*/*.play}"',documentation:"Imports `.play` files into this module \u2014 their top level is the module's body, so they hold features and module members without restating the module."},{label:"layout",insertText:"layout ${1:Name}\n template\n ${2:slot}",documentation:"Declares a reusable screen template with named slots."},{label:"feature",insertText:"feature ${1:Name}\n ",documentation:"Groups related slices into a vertical feature."}],yt=[{label:'import "\u2026"',insertText:'import "${1:*.play}"',documentation:"Imports `.play` files into this feature \u2014 their top level is the feature's body, so they hold slices and nested features without restating where they belong."},{label:"feature",insertText:"feature ${1:Name}\n ",documentation:"Declares a nested sub-feature."},{label:"slice StateChange",insertText:"slice StateChange ${1:Name}\n ",documentation:"A command \u2192 events flow; something that changes the system."},{label:"slice StateView",insertText:"slice StateView ${1:Name}\n ",documentation:"A query + projection + screen; something that reads the system."},{label:"slice Automation",insertText:"slice Automation ${1:Name}\n ",documentation:"A reaction or reducer; something that runs when something happens."},{label:"slice Translate",insertText:"slice Translate ${1:Name}\n ",documentation:"A capture; converts external data into events."}],ft=[{label:"operation",insertText:"operation ${1:Name}\n uses ${2:System}\n ${3:input} ${4:Type}",documentation:"Reusable slice-owned operation intent; not admitted by any supported executable model (ESM) version yet."},{label:"file",insertText:"file ${1:Path}",documentation:"Names the repository relative file this declaration is realized by, so the document can be navigated back to the code."},{label:"event",insertText:"event ${1:Name}\n ${2:property} ${3:Type}",documentation:"Declares an event type \u2014 an immutable, past-tense fact."},{label:"event generation",insertText:"event ${1:Name} generation ${2:2}\n ${3:property} ${4:Type}",documentation:"Declares a complete numbered event generation; start at 1 and do not skip a number."},{label:"command",insertText:"command ${1:Name}\n ${2:property} ${3:Type}",documentation:"Declares a command \u2014 an imperative intent that produces events."},{label:"query",insertText:"query ${1:Name} => ${2:ReadModel}",documentation:"Declares a read-side entry point mapping to a return type."},{label:"query observable",insertText:"query ${1:Name} => observable ${2:ReadModel}",documentation:"Declares a live read \u2014 the query keeps pushing as the read model changes, instead of answering once."},{label:"projection",insertText:"projection ${1:Name} => ${2:ReadModel}\n from ${3:EventType}",documentation:"Declares how events project into a read model (PDL)."},{label:"capture",insertText:"capture ${1:Name}\n source ${2:api}",documentation:"Declares a change data capture converting external data into events (CDL)."},{label:"reaction",insertText:"reaction ${1:Name}\n when ${2:Trigger}",documentation:"Declares behavior that runs when something happens."},{label:"screen",insertText:"screen ${1:Name}\n data ${2:ReadModel} via query ${3:QueryName}",documentation:"Declares a UI screen."},{label:"constraint",insertText:"constraint ${1:Name}\n unique ${2:property} on ${3:EventType}",documentation:"Declares a server-side rule enforced before events are committed."}],gt=[{label:"produces operation",insertText:"produces operation ${1:Name}\n uses ${2:System}\n ${3:input} ${4:Type} = ${5:source}",documentation:"Declares ordered operation intent; not admitted by any supported executable model (ESM) version yet (PLAY0268)."},{label:"returns property",insertText:"returns @${1:property}",documentation:"Scalar response from a direct command property, only on acceptance. Executable as ESM v7."},{label:"returns block",insertText:"returns\n ${1:field} = ${2:property}",documentation:"Unnamed record response with inferred or explicit field types, only on acceptance. Executable as ESM v7."},{label:"produces event",insertText:"produces event ${1:Name}\n ${2:property} ${3:Type} = ${4:source}",documentation:"Declares a slice-owned generation-1 event and maps its properties. An omitted for uses the command identifier."},{label:"identifier property",insertText:"${1:property} ${2:Type} identifier",documentation:"Marks the property a runtime resolves the event source id from. At most one per command."},{label:"authorize",insertText:"authorize ${1:PolicyName}",documentation:"References the policies that must pass for the command to execute."},{label:"reads",insertText:"reads ${1:View} by ${2:property}",documentation:"Declares a view the command consults. Executable binding is not yet supported."},{label:"reads as",insertText:"reads ${1:View} as ${2:alias} by ${3:property}",documentation:"Names one instance of a view; every instance needs a unique alias when reading the same view more than once."},{label:"validate",insertText:'validate\n ${1:property} not empty message "${2:message}"',documentation:"Declarative validation rules with messages."},{label:"validate csharp",insertText:`validate
4
- ${R("csharp")}`,documentation:"Imperative validation in C#, yielding the message of every rule the artifact breaks."},{label:"produces",insertText:"produces ${1:EventType}\n ${2:property} = ${3:source}",documentation:"Declares the event the command emits, with property mappings."},{label:"produces when",insertText:"produces when ${1:condition}\n ${2:EventType}\n ${3:property} = ${4:source}",documentation:"Conditionally emits an event when the condition holds."},{label:"handler",insertText:`handler
5
- `,documentation:"Fully imperative command implementation \u2014 file reference or inline C#, instead of produces."}],Se=[{label:"description",insertText:'description "${1:what happened}"',documentation:"Authoring metadata, as one line or a text/markdown fence."},{label:"documentation",insertText:"documentation\n ```markdown\n ${1:Details}\n ```",documentation:"Authoring-only Markdown documentation."},{label:"id",insertText:'id "${1:OldName}"',documentation:"Preserves a previous persisted event name after a rename. Leave absent for new events."},{label:"tag",insertText:"tag ${1:audit}",documentation:"An event-type tag stamped on every occurrence."}],bt=[...Se,{label:"for",insertText:"for ${1:identifier}",documentation:"Explicitly names the command identifier used as the event source."},{label:"property mapping",insertText:"${1:property} ${2:Type} = ${3:source}",documentation:"Declares and maps an event property on one line."}],K=[{label:"when",insertText:"when ${1:condition}",documentation:"Guards the produced event with a condition."}],$t=[{label:"hint",insertText:'hint "${1:implementation guidance}"',documentation:"Ordered nonblank guidance for a handler implementation. Not an execution guarantee."},{label:"file",insertText:"file ${1:Path}",documentation:"Selects one existing model-relative attachment."},...["csharp","typescript","react","html","sql"].map(e=>({label:e,insertText:R(e),documentation:"Selects one inline payload. Handler execution remains unsupported."}))],vt=[{label:"implementation",insertText:'implementation\n hint "${1:implementation guidance}"',documentation:"Handler-only implementation intent with optional file or tagged fence. With no payload it is pending."},{label:"file",insertText:"file ${1:Path}",documentation:"Delegates the command implementation to an external C# file."},{label:"csharp",insertText:R("csharp"),documentation:"Inline C# returning the events to append."}],xt=[{label:"description",insertText:'description "${1:what this query is trying to accomplish}"',documentation:"What the query is for, in prose \u2014 what a generator or reviewer works from."},{label:"by",insertText:"by ${1:param} ${2:Type}",documentation:"Declares the identifying parameter of the query."},{label:"filter",insertText:"filter ${1:param} ${2:Type} optional",documentation:"Declares an optional filter parameter supplied by the caller."},{label:"filter from context",insertText:"filter ${1:param} ${2:Type} from $context.${3|tenant,causedBy.subject,occurred|}",documentation:"Declares a parameter filled from the query context instead of the caller."},{label:"authorize",insertText:"authorize ${1:PolicyName}",documentation:"References the policies that must pass for the query to execute."},{label:"performer",insertText:`performer
6
- `,documentation:"The code that performs the query \u2014 a file reference or an inline csharp/sql block."}],wt=[{label:"file",insertText:"file ${1:Path}",documentation:"Delegates the query implementation to an external file."},{label:"csharp",insertText:R("csharp"),documentation:"Inline C# returning the query result, with the QueryContext in scope as context."},{label:"sql",insertText:R("sql"),documentation:"Inline SQL returning the query result."}],Tt=[{label:"unique",insertText:"unique ${1:property} on ${2:EventType}",documentation:"Enforces a unique property value across an event type."},{label:"unique event",insertText:"unique event ${1:EventType}",documentation:"Enforces that the event type occurs at most once per event source."},{label:"file",insertText:"file ${1:Path}",documentation:"Delegates the constraint to a custom C# implementation."}],kt=[{label:"description",insertText:'description "${1:what this reaction does}"',documentation:"What the reaction does \u2014 a complete statement of intent before any code exists."},{label:"when",insertText:"when ${1:Trigger}",documentation:"An event, a declared trigger or a host signal that sets the reaction off. A trigger needs no body."},{label:"every",insertText:"every ${1:15} ${2|seconds,minutes,hours,days|}",documentation:"Runs the reaction on an interval."},{label:"at",insertText:"at ${1:08:00}",documentation:"Runs the reaction at a time of day \u2014 every day unless narrowed with `on <Weekday>` or `on day <n>`."},{label:"where",insertText:"where ${1:condition}",documentation:"Narrows which occurrences actually run the reaction."}],Ct=[{label:"reads",insertText:"reads ${1:View}",documentation:"The view this trigger consults. Optionally use `as <alias> by <trigger value>`; clock triggers take no values and cannot use `by`."},{label:"description",insertText:'description "${1:what this reaction does}"',documentation:"What this particular reaction does \u2014 enough on its own, with no file to point at."},{label:"produces",insertText:"produces ${1:EventType}",documentation:"An event the reaction appends."},{label:"invokes",insertText:"invokes ${1:Command}",documentation:"A command the reaction hands on. A command is asked for, not produced \u2014 it may still be rejected."},{label:"file",insertText:"file ${1:Path}",documentation:"Delegates the reaction to an external C# file."},{label:"csharp",insertText:R("csharp"),documentation:"Inline C# returning event side effects."}],St=[{label:"file",insertText:"file ${1:Path}",documentation:"Names the repository relative file this declaration is realized by, so the document can be navigated back to the code."},{label:"description",insertText:'description "${1:when this occurs}"',documentation:"What makes an occurrence of this trigger happen."},{label:"value",insertText:"${1:name} ${2:Type}",documentation:"A value an occurrence hands the reaction. The type is optional."}],Dt=[{label:"given operation fails",insertText:"given operation ${1:Name} fails",documentation:"Failure fixture leaf; not admitted by any supported executable model (ESM) version yet (PLAY0268)."},{label:"then operation",insertText:"then operation ${1:Name}\n ${2:input} = ${3:value}",documentation:"Partial requested-operation assertion; not admitted by any supported executable model (ESM) version yet (PLAY0268)."},{label:"then compensated",insertText:"then compensated ${1:Name}",documentation:"Compensation assertion leaf; not admitted by any supported executable model (ESM) version yet (PLAY0268)."},{label:"file",insertText:"file ${1:Path}",documentation:"Names the repository relative file this declaration is realized by, so the document can be navigated back to the code."},{label:"given",insertText:"given ${1:EventType}\n ${2:property} = ${3:value}",documentation:"Establishes prior state by replaying an event before the command runs."},{label:"given readmodel",insertText:"given readmodel ${1:ReadModelType}\n ${2:property} = ${3:value}",documentation:"Establishes prior read model state directly."},{label:"when",insertText:"when ${1:CommandType}\n ${2:property} = ${3:value}",documentation:"The command being exercised."},{label:"then",insertText:"then ${1:EventType}\n ${2:property} = ${3:value}",documentation:"An event expected to be produced by the command."},{label:"then readmodel",insertText:"then readmodel ${1:ReadModelType}\n ${2:property} = ${3:value}",documentation:"The read model state expected after the command."},{label:"then no readmodel",insertText:"then no readmodel ${1:ReadModelType} for ${2:key}",documentation:"Asserts that precisely one keyed read-model instance does not exist; another key may still be present."},{label:"then query",insertText:"then query ${1:QueryName}\n arguments\n ${2:argument} = ${3:value}\n result\n ${4:property} = ${5:value}",documentation:"The ordered query results expected for explicit arguments. Remove the result block to assert an empty result."},{label:"then error",insertText:"then error",documentation:"A rejection, for a reason this specification does not name."},{label:'then error "..."',insertText:'then error "${1:reason}"',documentation:"A rejection, for the named reason."},{label:"given clock",insertText:'given clock "${1:2026-10-05T08:00:00Z}"',documentation:"The instant the scenario happens at - the occurrence time of everything it does. At most once."},{label:"given capture",insertText:"given capture ${1:Capture}\n ${2:field} = ${3:value}",documentation:"A record the capture's source held before."},{label:"when clock",insertText:'when clock "${1:2026-10-05T09:00:00Z}"',documentation:"The clock reaches an instant, as the action."},{label:"when trigger",insertText:"when trigger ${1:Trigger}\n ${2:value} = ${3:value}",documentation:"An application trigger fires, as the action."},{label:"when capture",insertText:"when capture ${1:Capture}\n ${2:field} = ${3:value}",documentation:"The record a capture's source holds now, as the action."},{label:"when query",insertText:"when query ${1:Query}\n ${2:argument} = ${3:value}",documentation:"Performs a query, as the action."},{label:"then result",insertText:"then result\n ${1:property} = ${2:value}",documentation:"One result the query performed by `when query` returns, in order."},{label:"then no result",insertText:"then no result",documentation:"The query performed by `when query` returns nothing."}],De={given:[{label:"operation",insertText:"operation ${1:Name} fails",documentation:"Syntax-only failure fixture; no children."},{label:"clock",insertText:'clock "${1:2026-10-05T08:00:00Z}"',documentation:"The instant the scenario happens at - the occurrence time of everything it does."},{label:"capture",insertText:"capture ${1:Capture}\n ${2:field} = ${3:value}",documentation:"A record the capture's source held before. Repeat it for several records."},{label:"readmodel",insertText:"readmodel ${1:ReadModelType}\n ${2:property} = ${3:value}",documentation:"Establishes prior read model state directly."},{label:"caller",insertText:"caller\n ${1:authenticated}",documentation:"The identity the scenario runs as."}],when:[{label:"clock",insertText:'clock "${1:2026-10-05T09:00:00Z}"',documentation:"The clock reaches an instant - what a scheduled reaction responds to."},{label:"trigger",insertText:"trigger ${1:Trigger}\n ${2:value} = ${3:value}",documentation:"An application trigger fires, with the values it carries."},{label:"capture",insertText:"capture ${1:Capture}\n ${2:field} = ${3:value}",documentation:"The record a capture's source holds now."},{label:"query",insertText:"query ${1:Query}\n ${2:argument} = ${3:value}",documentation:"Performs a query; assert what it returns with `then result` or `then no result`."},{label:"append",insertText:"append ${1:EventType}\n ${2:property} = ${3:value}",documentation:"An event occurs, instead of a command being executed."}],then:[{label:"operation",insertText:"operation ${1:Name}\n ${2:input} = ${3:value}",documentation:"Syntax-only partial operation assertion; not admitted by any supported executable model (ESM) version yet."},{label:"compensated",insertText:"compensated ${1:Name}",documentation:"Syntax-only compensation assertion; no children."},{label:"returns value",insertText:"returns ${1:value}",documentation:"Scalar response expectation, compared by semantic value equality. Executable as ESM v7."},{label:"returns block",insertText:"returns\n ${1:field} = ${2:value}",documentation:"Nonempty subset of response fields asserted by name. Executable as ESM v7."},{label:"result",insertText:"result\n ${1:property} = ${2:value}",documentation:"One result the query performed by `when query` returns, in order."},{label:"result exactly",insertText:"result exactly\n ${1:property} = ${2:value}",documentation:"One result, with every property asserted."},{label:"no result",insertText:"no result",documentation:"The query performed by `when query` returns nothing."},{label:"readmodel",insertText:"readmodel ${1:ReadModelType}\n ${2:property} = ${3:value}",documentation:"The read model state expected afterwards."},{label:"error",insertText:'error "${1:reason}"',documentation:"A rejection, for the named reason."},{label:"denied",insertText:"denied",documentation:"The action is denied to the caller."}]},Ae=[{label:"hint",insertText:'hint "${1:predicate guidance}"',documentation:"Ordered nonblank authoring guidance. Does not execute or confirm the predicate."},{label:"file",insertText:"file ${1:Path}",documentation:"The sole named-rule predicate attachment."},{label:"csharp",insertText:R("csharp"),documentation:"Opaque named-rule predicate returning a bool. Requires an admitting target."}],At=[{label:"implementation",insertText:'implementation\n hint "${1:predicate guidance}"',documentation:"Command named-rule intent with optional file or tagged fence. Pending intent cannot bind."},...Ae.filter(e=>e.label!=="hint")],It=[{label:"file",insertText:"file ${1:Path}",documentation:"Gives the named predicate its implementation in an external C# file."},{label:"csharp",insertText:R("csharp"),documentation:"Gives the named predicate its implementation as inline C# returning a bool."}],qt=[{label:"require authenticated",insertText:"require authenticated",documentation:"Requires an authenticated caller."},{label:"require role",insertText:'require role "${1:role}"',documentation:"Requires the caller to have a role."},{label:"require claim",insertText:'require claim "${1:claim}" matches ${2:subject}',documentation:"Requires a claim to match the subject or a value."},{label:"csharp",insertText:R("csharp"),documentation:"Fully custom policy logic in C#, returning a bool."}],Lt=[{label:"not empty",insertText:'${1:property} not empty message "${2:message}"',documentation:"The property must have a value."},{label:"max",insertText:'${1:property} max ${2:500} message "${3:message}"',documentation:"Maximum length or value."},{label:"min",insertText:'${1:property} min ${2:1} message "${3:message}"',documentation:"Minimum length or value."},{label:"matches",insertText:'${1:property} matches "${2:pattern}" message "${3:message}"',documentation:"The property must match a regular expression."},{label:"rule",insertText:'${1:property} rule ${2:PredicateName} message "${3:message}"',documentation:"Names a predicate \u2014 optionally followed by an indented `file` reference or inline `csharp` block giving it a body; bare, it just states that a constraint exists."},{label:"==",insertText:'${1:property} == ${2:value} message "${3:message}"',documentation:"The property must equal the value."},{label:"!=",insertText:'${1:property} != ${2:value} message "${3:message}"',documentation:"The property must not equal the value."},{label:"length ==",insertText:'${1:property} length == ${2:3} message "${3:message}"',documentation:"The property must have an exact length."},{label:"all >",insertText:'${1:collection}.${2:property} all > ${3:0} message "${4:message}"',documentation:"Every element of a collection must satisfy the comparison."}],Pt=[{label:"data",insertText:"data ${1:ReadModel} via query ${2:QueryName}",documentation:"Binds a read model to the screen through a query."},{label:"action",insertText:"action ${1:CommandName}",documentation:"Makes a command available as an action on the screen."},{label:"layout",insertText:"layout ${1:LayoutName}",documentation:"Uses a layout template and fills its slots."},{label:"section",insertText:"section ${1:name}",documentation:"A named structural section of the screen."},{label:"table",insertText:'table ${1:name}\n column ${2:property} label "${3:text}"',documentation:"A table widget over a read model or collection."},{label:"summary",insertText:'summary ${1:ReadModel}\n field ${2:property} label "${3:text}"',documentation:"A summary widget showing labeled fields."},{label:"title",insertText:'title "${1:text}"',documentation:"The title of the screen or section."},{label:"file",insertText:"file ${1:Path}",documentation:"Full external implementation \u2014 Stage uses the referenced file."},{label:"react",insertText:R("react"),documentation:"Inline React/TSX component receiving the data contract as Props."},{label:"typescript",insertText:R("typescript"),documentation:"Inline plain TypeScript."},{label:"html",insertText:R("html"),documentation:"Inline static HTML."}],Et=[{label:"navigate to",insertText:"navigate to ${1:ScreenName}",documentation:"Navigates to a screen after the action completes."},{label:"label",insertText:'label "${1:text}"',documentation:"The display label of the action."}],Rt=[{label:"column",insertText:'column ${1:property} label "${2:text}"',documentation:"A column bound to a property."},{label:"on row-click",insertText:"on row-click navigate to ${1:ScreenName} by ${2:param}",documentation:"Navigates when a row is clicked."}],Ie=[{label:"$context.occurred",insertText:"$context.occurred",documentation:"When the command or query was received."},{label:"$context.tenant",insertText:"$context.tenant",documentation:"The tenant the command or query is executing for."},{label:"$context.command.",insertText:"$context.command.${1:property}",documentation:"A property of the command being handled."},{label:"$context.arguments.",insertText:"$context.arguments.${1:name}",documentation:"An argument of the query being performed."},{label:"$context.causedBy.subject",insertText:"$context.causedBy.subject",documentation:"Subject of the identity that caused the command or query."},{label:"$context.causedBy.name",insertText:"$context.causedBy.name",documentation:"Display name of the identity that caused the command or query."},{label:"$context.causedBy.userName",insertText:"$context.causedBy.userName",documentation:"User name of the identity that caused the command or query."},{label:"$context.causation.type",insertText:"$context.causation.type",documentation:"What caused this \u2014 a command, a reactor, a schedule."},{label:"$context.identity.id",insertText:"$context.identity.id",documentation:"The identifier of the caller from the auth token."},{label:"$context.identity.name",insertText:"$context.identity.name",documentation:"The display name of the caller."},{label:"$context.identity.userName",insertText:"$context.identity.userName",documentation:"The user name of the caller."},{label:"$context.identity.isAuthenticated",insertText:"$context.identity.isAuthenticated",documentation:"Whether the caller is authenticated."},{label:"$context.identity.roles",insertText:"$context.identity.roles",documentation:"The roles the caller holds."},{label:"$context.identity.claims.",insertText:"$context.identity.claims.${1:name}",documentation:"The value of a claim the caller carries."},{label:"$env.",insertText:"$env.${1:VAR_NAME}",documentation:"An environment variable."},...ee.filter(e=>e.name!=="value").map(e=>({label:`$eventContext.${e.path}`,insertText:`$eventContext.${e.path}`,documentation:`${e.description} (PDL)`}))];function ne(e,n,t,r){let a=E(e);if(a[n]||D(t).length<t.length)return null;let u=t.trim()===""?t.length:S(e[n]),p=z(e,a,n,u),o=H(e,a,n,u),c=h(s=>{let l=r.commands.filter(m=>m.name===s);return l.length===1?l[0]:void 0},"namedCommand"),i=h((s,l=s.name)=>({label:s.name,insertText:l,documentation:`${C(F(s))}${s.isGenerated?" \u2014 generated, not request/form input":""}. ${L}`}),"entry");if(p.includes("command")){let s=U(e).commands.filter(l=>l.line<n).at(-1);if(!s)return null;if(p[0]==="command"){if(/^\s*returns\s+@?\w*$/.test(t))return!/returns\s+@/.test(t)&&s.properties.some(m=>m.name==="returns"&&m.line===n)?null:s.properties.map(m=>i(m,`${/returns\s+@/.test(t)?"":"@"}${m.name}`));let l=t.match(/^\s*@?[a-z_]\w*\s+([\w.]+)\s+(\w*)$/);if(l&&["generated","identifier"].some(m=>m.startsWith(l[2]))&&r.concepts.find(g=>g.name===l[1])?.primitive==="Uuid")return[..."optional".startsWith(l[2])?ae:[],{label:"generated",insertText:"generated",documentation:`Required scalar Uuid concept with no validation rules; not a request/form input. ${L}`},{label:"generated identifier",insertText:"generated identifier",documentation:`Specification fixture uses an indented for value. ${L}`},{label:"identifier",insertText:"identifier",documentation:"Names the event source identifier."}];if(/^\s*@?[a-z_]\w*\s+[\w.]+\s+generated\s+\w*$/.test(t))return[{label:"identifier",insertText:"identifier",documentation:L}]}if(p[0]==="returns")return/=\s*@?\w*$/.test(t)?s.properties.map(l=>i(l)):/^\s*@?[a-z_]\w*\s+[\w.]*$/.test(t)?[...r.concepts.map(l=>l.name),...r.types.map(l=>l.name),...W].map(l=>({label:l,insertText:l,documentation:`Explicit response type must exactly match the source. ${L}`})):s.properties.map(l=>i(l,`${l.name} = ${l.name}`))}if(p[0]==="form"&&o&&(/^\s*field\s+\w*$/.test(t)||t.trim()==="")){let s=c(o.match(/\bfor\s+([\w.]+)$/)?.[1]);if(s)return s.properties.filter(l=>!l.isGenerated).map(l=>i(l,t.trim()===""?`field ${l.name}`:l.name))}if(p.includes("specification")){if(p[0]==="when"&&o){let s=o.match(/^when\s+([\w.]+)$/)?.[1],l=c(s);if(!l)return null;if(/^\s*generated\s+\w*$/.test(t))return l.properties.filter(m=>m.isGenerated&&!m.isIdentifier).map(m=>i(m,`${m.name} = "\${1:uuid}"`));if(t.trim()==="")return[...l.properties.filter(m=>!m.isGenerated).map(m=>i(m,`${m.name} = \${1:value}`)),...l.properties.filter(m=>m.isGenerated&&!m.isIdentifier).map(m=>({...i(m,`generated ${m.name} = "\${1:uuid}"`),label:`generated ${m.name}`})),...l.properties.some(m=>m.isGenerated&&m.isIdentifier)?[{label:"for",insertText:'for "${1:uuid}"',documentation:`Generated identifier fixture, not request input. ${L}`}]:[]]}if(p[0]==="then"&&/^then\s+returns$/.test(o??"")){let s=[...q(e).specifications.values()].filter(m=>m.location.line-1<n).at(-1),l=c(s?.when?.commandType);if(l?.response?.kind==="RecordCommandResponseSyntax"){let m=new Map(l.properties.map(g=>[g.name,g]));return l.response.fields.map(g=>{let y=m.get(g.source.property),$=g.type??(y?F(y):void 0);return{label:g.name,insertText:`${g.name} = \${1:value}`,documentation:`${$?C($):"Unresolved type"}. ${L}`}})}}}return null}h(ne,"responseCompletions");var P="Syntax-only; not admitted by any supported executable model (ESM) version yet (PLAY0268) (#301). No semantic or requirement identity is assigned.";function Nt(e,n){return q(e,n?.authoringDocuments??n?.authoringSources?.filter(t=>t!==e.join(`
7
- `))??[],n?.authoringPlacement,n?.authoringPath).operations}h(Nt,"analyzeOperations");function qe(e){return e?e.file?`file ${e.file.path}`:e.code?`inline ${e.code.language}`:"pending":"not declared"}h(qe,"phaseState");function ce(e){let n=e.inputs.map(r=>`${r.name} ${C(r.type)}`).join(`
3
+ \`\`\``,"fenced"),ut=[{label:"eventsource",insertText:"eventsource ${1:Name}\n identifier ${2:Type}\n stream ${3:Name}",documentation:"Application-owned source with nested streams; not admitted by any supported executable model (ESM) version yet (PLAY0268)."},{label:"system",insertText:'system ${1:Name}\n description "${2:external system}"',documentation:"Application-scoped external system; not admitted by any supported executable model (ESM) version yet."},{label:"import",insertText:"import ${1:Module}.${2:Type}",documentation:"Imports a type from another module by its qualified name."},{label:'import "\u2026"',insertText:'import "${1:**/*.play}"',documentation:"Imports other `.play` files by path or glob, relative to this file's folder, as whole documents of the application."},{label:"concept",insertText:"concept ${1:Name} : ${2|Uuid,String,Int,Decimal,Bool,Date,DateTime|}",documentation:"Declares a formalized value type wrapping a primitive."},{label:"concept (enum)",insertText:"concept ${1:Name} : Enum\n ${2:value}",documentation:"Declares an enumeration concept with a fixed set of values."},{label:"concept (@pii with reason)",insertText:'concept ${1:Name} : ${2|String,Uuid,Int,Decimal,Bool,Date,DateTime|} @pii\n pii reason "${3:why this is personal data, its purpose and lawful basis}"',documentation:"Declares a personal-data concept together with the reason it is personal data."},{label:"type",insertText:"type ${1:Name}\n ${2:property} ${3:Type}",documentation:"Declares a composite value type \u2014 a named shape built from several properties."},{label:"policy",insertText:"policy ${1:Name}\n require ${2:authenticated}",documentation:"Declares a named authorization rule for commands and queries."},{label:"module",insertText:"module ${1:Name}\n ",documentation:"Declares the top-level namespace \u2014 maps to a bounded context."},{label:"domain",insertText:"domain ${1:Name}",documentation:"The domain the file belongs to \u2014 optional, at most one per file, before everything else."},{label:"persona",insertText:'persona ${1:Name}\n description "${2:who they are}"',documentation:"A named role interacting with the application, with the policies it holds."},{label:"authentication",insertText:"authentication\n provider ${1:Name}\n ${2:setting} ${3:value}",documentation:"Declares the identity providers of the application \u2014 at most one block per file."},{label:"seed",insertText:"seed\n for ${1:EventSourceId}\n ${2:EventType}",documentation:"Declares events to seed into the event store per event source id."},{label:"layout",insertText:"layout ${1:Name}\n ${2:slot}",documentation:"Declares the application shell with named slots."},{label:"theme",insertText:"theme ${1:Name}\n compatible with ${2:Package}",documentation:"Declares a theme and the component packages it is compatible with."},{label:"ui profile",insertText:"ui profile ${1:Name}\n target platform ${2:web}\n layout ${3:Layout}\n theme ${4:Theme}",documentation:"Binds a target platform and size to a layout, theme and component packages."},{label:"behavior",insertText:"behavior ${1:Name}\n on ${2:click}\n ${3:execute command}",documentation:"A named interaction wiring, attached to a screen, form or dialog with `uses`."},{label:"trigger",insertText:"trigger ${1:Name}\n ${2:property} ${3:Type}",documentation:"Declares an integration signal a reaction can run on."}],Q=[{label:"uses",insertText:"uses ${1:System}",documentation:"Exactly one application-scoped external system."},{label:"description",insertText:'description "${1:intent}"',documentation:"Describes operation intent, without requiring code."},{label:"input",insertText:"${1:input} ${2:Type}",documentation:"Typed operation input; no identifier or generated modifier."},{label:"execute",insertText:'execute\n description "${1:effect}"',documentation:"Optional execution intent; not admitted by any supported executable model (ESM) version yet."},{label:"compensate",insertText:'compensate\n description "${1:undo intent}"',documentation:"Optional compensation intent; not admitted by any supported executable model (ESM) version yet."}],te=[{label:"hint",insertText:'hint "${1:implementation guidance}"',documentation:"Ordered authoring guidance; not an executable implementation role."},{label:"file",insertText:"file ${1:Path}",documentation:"Selects the phase\u2019s sole source attachment."},...["csharp","typescript","react","html","sql"].map(e=>({label:e,insertText:N(e),documentation:"Selects the phase\u2019s sole inline source; not admitted by any supported executable model (ESM) version yet."}))],se=[{label:"description",insertText:'description "${1:phase intent}"',documentation:"A description-only phase is valid, pending intent."},{label:"implementation",insertText:'implementation\n hint "${1:guidance}"',documentation:"Hints with optional source; phase owns File/Code, wrapper owns hints only."},...te.filter(e=>e.label!=="hint")],dt=[{label:"file",insertText:"file ${1:Path}",documentation:"Names the repository relative file this declaration is realized by, so the document can be navigated back to the code."},{label:"pii reason",insertText:'pii reason "${1:why this is personal data, its purpose and lawful basis}"',documentation:"Records why the `@pii` marker applies \u2014 purpose, lawful basis, whose subject it lives under."},{label:"sensitive reason",insertText:'sensitive reason "${1:why this value is sensitive}"',documentation:"Records why the `@sensitive` marker applies."},{label:"validate",insertText:'validate\n ${1:not empty} message "${2:message}"',documentation:"Validation rules that travel with the value everywhere it appears."}],pt=[{label:"file",insertText:"file ${1:Path}",documentation:"Names the repository relative file this declaration is realized by, so the document can be navigated back to the code."},{label:"description",insertText:'description "${1:what this shape represents}"',documentation:"A human-readable description of the type."},{label:"property",insertText:"${1:property} ${2:Type}",documentation:"A property of the type \u2014 a name and a type reference."}],ht=[{label:'import "\u2026"',insertText:'import "${1:*/*.play}"',documentation:"Imports `.play` files into this module \u2014 their top level is the module's body, so they hold features and module members without restating the module."},{label:"layout",insertText:"layout ${1:Name}\n template\n ${2:slot}",documentation:"Declares a reusable screen template with named slots."},{label:"feature",insertText:"feature ${1:Name}\n ",documentation:"Groups related slices into a vertical feature."},{label:"description",insertText:'description "${1:what this module is for}"',documentation:"A human-readable description."},{label:"authorize",insertText:"authorize ${1:PolicyName}",documentation:"Policies that must pass for everything in the module."},{label:"screen",insertText:"screen ${1:Name}\n data ${2:ReadModel} via query ${3:QueryName}",documentation:"Declares a module-level UI screen."},{label:"dialog",insertText:"dialog ${1:Name}\n ${2:body}",documentation:"Declares a dialog opened over the shell."},{label:"form",insertText:'form ${1:Name} for ${2:Command}\n field ${3:property} label "${4:Label}"',documentation:"Declares a form bound to a command."},{label:"contribute",insertText:'contribute to ${1:Navigation}\n navigate to ${2:Screen}\n label "${3:Label}"',documentation:"Contributes an entry to a named slot of the shell, such as navigation."}],yt=[{label:'import "\u2026"',insertText:'import "${1:*.play}"',documentation:"Imports `.play` files into this feature \u2014 their top level is the feature's body, so they hold slices and nested features without restating where they belong."},{label:"feature",insertText:"feature ${1:Name}\n ",documentation:"Declares a nested sub-feature."},{label:"contribute",insertText:'contribute to ${1:Navigation}\n navigate to ${2:Screen}\n label "${3:Label}"',documentation:"Contributes an entry to a named slot of the shell, such as navigation."},{label:"slice StateChange",insertText:"slice StateChange ${1:Name}\n ",documentation:"A command \u2192 events flow; something that changes the system."},{label:"slice StateView",insertText:"slice StateView ${1:Name}\n ",documentation:"A query + projection + screen; something that reads the system."},{label:"slice Automation",insertText:"slice Automation ${1:Name}\n ",documentation:"A reaction or reducer; something that runs when something happens."},{label:"slice Translate",insertText:"slice Translate ${1:Name}\n ",documentation:"A capture; converts external data into events."}],ft=[{label:"operation",insertText:"operation ${1:Name}\n uses ${2:System}\n ${3:input} ${4:Type}",documentation:"Reusable slice-owned operation intent; not admitted by any supported executable model (ESM) version yet."},{label:"file",insertText:"file ${1:Path}",documentation:"Names the repository relative file this declaration is realized by, so the document can be navigated back to the code."},{label:"event",insertText:"event ${1:Name}\n ${2:property} ${3:Type}",documentation:"Declares an event type \u2014 an immutable, past-tense fact."},{label:"event generation",insertText:"event ${1:Name} generation ${2:2}\n ${3:property} ${4:Type}",documentation:"Declares a complete numbered event generation; start at 1 and do not skip a number."},{label:"command",insertText:"command ${1:Name}\n ${2:property} ${3:Type}",documentation:"Declares a command \u2014 an imperative intent that produces events."},{label:"query",insertText:"query ${1:Name} => ${2:ReadModel}",documentation:"Declares a read-side entry point mapping to a return type."},{label:"query observable",insertText:"query ${1:Name} => observable ${2:ReadModel}",documentation:"Declares a live read \u2014 the query keeps pushing as the read model changes, instead of answering once."},{label:"readmodel",insertText:"readmodel ${1:Name}\n ${2:property} ${3:Type}",documentation:"Declares the shape of a read model \u2014 its properties \u2014 that a projection, reducer or query fills and returns."},{label:"reducer",insertText:"reducer ${1:Name} => ${2:ReadModel}\n on ${3:EventType}\n ```csharp\n ${4}\n ```",documentation:"Declares a reducer building a read model from events with imperative code, for what a projection cannot express."},{label:"specification",insertText:"specification ${1:Name}\n given ${2:EventType}\n when ${3:Command}\n then ${4:EventType}",documentation:"Given/when/then acceptance criteria for the slice."},{label:"projection",insertText:"projection ${1:Name} => ${2:ReadModel}\n from ${3:EventType}",documentation:"Declares how events project into a read model (PDL)."},{label:"capture",insertText:"capture ${1:Name}\n source ${2:api}",documentation:"Declares a change data capture converting external data into events (CDL)."},{label:"reaction",insertText:"reaction ${1:Name}\n when ${2:Trigger}",documentation:"Declares behavior that runs when something happens."},{label:"screen",insertText:"screen ${1:Name}\n data ${2:ReadModel} via query ${3:QueryName}",documentation:"Declares a UI screen."},{label:"constraint",insertText:"constraint ${1:Name}\n unique ${2:property} on ${3:EventType}",documentation:"Declares a server-side rule enforced before events are committed."}],gt=[{label:"produces operation",insertText:"produces operation ${1:Name}\n uses ${2:System}\n ${3:input} ${4:Type} = ${5:source}",documentation:"Declares ordered operation intent; not admitted by any supported executable model (ESM) version yet (PLAY0268)."},{label:"returns property",insertText:"returns @${1:property}",documentation:"Scalar response from a direct command property, only on acceptance. Executable as ESM v7."},{label:"returns block",insertText:"returns\n ${1:field} = ${2:property}",documentation:"Unnamed record response with inferred or explicit field types, only on acceptance. Executable as ESM v7."},{label:"produces event",insertText:"produces event ${1:Name}\n ${2:property} ${3:Type} = ${4:source}",documentation:"Declares a slice-owned generation-1 event and maps its properties. An omitted for uses the command identifier."},{label:"identifier property",insertText:"${1:property} ${2:Type} identifier",documentation:"Marks the property a runtime resolves the event source id from. At most one per command."},{label:"authorize",insertText:"authorize ${1:PolicyName}",documentation:"References the policies that must pass for the command to execute."},{label:"reads",insertText:"reads ${1:View} by ${2:property}",documentation:"Declares a view the command consults. Executable binding is not yet supported."},{label:"reads as",insertText:"reads ${1:View} as ${2:alias} by ${3:property}",documentation:"Names one instance of a view; every instance needs a unique alias when reading the same view more than once."},{label:"validate",insertText:'validate\n ${1:property} not empty message "${2:message}"',documentation:"Declarative validation rules with messages."},{label:"validate csharp",insertText:`validate
4
+ ${N("csharp")}`,documentation:"Imperative validation in C#, yielding the message of every rule the artifact breaks."},{label:"produces",insertText:"produces ${1:EventType}\n ${2:property} = ${3:source}",documentation:"Declares the event the command emits, with property mappings."},{label:"produces when",insertText:"produces when ${1:condition}\n ${2:EventType}\n ${3:property} = ${4:source}",documentation:"Conditionally emits an event when the condition holds."},{label:"handler",insertText:`handler
5
+ `,documentation:"Fully imperative command implementation \u2014 file reference or inline C#, instead of produces."}],Se=[{label:"description",insertText:'description "${1:what happened}"',documentation:"Authoring metadata, as one line or a text/markdown fence."},{label:"documentation",insertText:"documentation\n ```markdown\n ${1:Details}\n ```",documentation:"Authoring-only Markdown documentation."},{label:"id",insertText:'id "${1:OldName}"',documentation:"Preserves a previous persisted event name after a rename. Leave absent for new events."},{label:"tag",insertText:"tag ${1:audit}",documentation:"An event-type tag stamped on every occurrence."}],bt=[...Se,{label:"for",insertText:"for ${1:identifier}",documentation:"Explicitly names the command identifier used as the event source."},{label:"property mapping",insertText:"${1:property} ${2:Type} = ${3:source}",documentation:"Declares and maps an event property on one line."}],K=[{label:"when",insertText:"when ${1:condition}",documentation:"Guards the produced event with a condition."}],$t=[{label:"hint",insertText:'hint "${1:implementation guidance}"',documentation:"Ordered nonblank guidance for a handler implementation. Not an execution guarantee."},{label:"file",insertText:"file ${1:Path}",documentation:"Selects one existing model-relative attachment."},...["csharp","typescript","react","html","sql"].map(e=>({label:e,insertText:N(e),documentation:"Selects one inline payload. Handler execution remains unsupported."}))],vt=[{label:"implementation",insertText:'implementation\n hint "${1:implementation guidance}"',documentation:"Handler-only implementation intent with optional file or tagged fence. With no payload it is pending."},{label:"file",insertText:"file ${1:Path}",documentation:"Delegates the command implementation to an external C# file."},{label:"csharp",insertText:N("csharp"),documentation:"Inline C# returning the events to append."}],xt=[{label:"description",insertText:'description "${1:what this query is trying to accomplish}"',documentation:"What the query is for, in prose \u2014 what a generator or reviewer works from."},{label:"by",insertText:"by ${1:param} ${2:Type}",documentation:"Declares the identifying parameter of the query."},{label:"filter",insertText:"filter ${1:param} ${2:Type} optional",documentation:"Declares an optional filter parameter supplied by the caller."},{label:"filter from context",insertText:"filter ${1:param} ${2:Type} from $context.${3|tenant,causedBy.subject,occurred|}",documentation:"Declares a parameter filled from the query context instead of the caller."},{label:"authorize",insertText:"authorize ${1:PolicyName}",documentation:"References the policies that must pass for the query to execute."},{label:"performer",insertText:`performer
6
+ `,documentation:"The code that performs the query \u2014 a file reference or an inline csharp/sql block."}],wt=[{label:"file",insertText:"file ${1:Path}",documentation:"Delegates the query implementation to an external file."},{label:"csharp",insertText:N("csharp"),documentation:"Inline C# returning the query result, with the QueryContext in scope as context."},{label:"sql",insertText:N("sql"),documentation:"Inline SQL returning the query result."}],Tt=[{label:"unique",insertText:"unique ${1:property} on ${2:EventType}",documentation:"Enforces a unique property value across an event type."},{label:"unique event",insertText:"unique event ${1:EventType}",documentation:"Enforces that the event type occurs at most once per event source."},{label:"file",insertText:"file ${1:Path}",documentation:"Delegates the constraint to a custom C# implementation."}],kt=[{label:"description",insertText:'description "${1:what this reaction does}"',documentation:"What the reaction does \u2014 a complete statement of intent before any code exists."},{label:"when",insertText:"when ${1:Trigger}",documentation:"An event, a declared trigger or a host signal that sets the reaction off. A trigger needs no body."},{label:"every",insertText:"every ${1:15} ${2|seconds,minutes,hours,days|}",documentation:"Runs the reaction on an interval."},{label:"at",insertText:"at ${1:08:00}",documentation:"Runs the reaction at a time of day \u2014 every day unless narrowed with `on <Weekday>` or `on day <n>`."},{label:"where",insertText:"where ${1:condition}",documentation:"Narrows which occurrences actually run the reaction."}],Ct=[{label:"reads",insertText:"reads ${1:View}",documentation:"The view this trigger consults. Optionally use `as <alias> by <trigger value>`; clock triggers take no values and cannot use `by`."},{label:"description",insertText:'description "${1:what this reaction does}"',documentation:"What this particular reaction does \u2014 enough on its own, with no file to point at."},{label:"produces",insertText:"produces ${1:EventType}",documentation:"An event the reaction appends."},{label:"invokes",insertText:"invokes ${1:Command}",documentation:"A command the reaction hands on. A command is asked for, not produced \u2014 it may still be rejected."},{label:"file",insertText:"file ${1:Path}",documentation:"Delegates the reaction to an external C# file."},{label:"csharp",insertText:N("csharp"),documentation:"Inline C# returning event side effects."}],St=[{label:"file",insertText:"file ${1:Path}",documentation:"Names the repository relative file this declaration is realized by, so the document can be navigated back to the code."},{label:"description",insertText:'description "${1:when this occurs}"',documentation:"What makes an occurrence of this trigger happen."},{label:"value",insertText:"${1:name} ${2:Type}",documentation:"A value an occurrence hands the reaction. The type is optional."}],Dt=[{label:"given operation fails",insertText:"given operation ${1:Name} fails",documentation:"Failure fixture leaf; not admitted by any supported executable model (ESM) version yet (PLAY0268)."},{label:"then operation",insertText:"then operation ${1:Name}\n ${2:input} = ${3:value}",documentation:"Partial requested-operation assertion; not admitted by any supported executable model (ESM) version yet (PLAY0268)."},{label:"then compensated",insertText:"then compensated ${1:Name}",documentation:"Compensation assertion leaf; not admitted by any supported executable model (ESM) version yet (PLAY0268)."},{label:"file",insertText:"file ${1:Path}",documentation:"Names the repository relative file this declaration is realized by, so the document can be navigated back to the code."},{label:"given",insertText:"given ${1:EventType}\n ${2:property} = ${3:value}",documentation:"Establishes prior state by replaying an event before the command runs."},{label:"given readmodel",insertText:"given readmodel ${1:ReadModelType}\n ${2:property} = ${3:value}",documentation:"Establishes prior read model state directly."},{label:"when",insertText:"when ${1:CommandType}\n ${2:property} = ${3:value}",documentation:"The command being exercised."},{label:"then",insertText:"then ${1:EventType}\n ${2:property} = ${3:value}",documentation:"An event expected to be produced by the command."},{label:"then readmodel",insertText:"then readmodel ${1:ReadModelType}\n ${2:property} = ${3:value}",documentation:"The read model state expected after the command."},{label:"then no readmodel",insertText:"then no readmodel ${1:ReadModelType} for ${2:key}",documentation:"Asserts that precisely one keyed read-model instance does not exist; another key may still be present."},{label:"then query",insertText:"then query ${1:QueryName}\n arguments\n ${2:argument} = ${3:value}\n result\n ${4:property} = ${5:value}",documentation:"The ordered query results expected for explicit arguments. Remove the result block to assert an empty result."},{label:"then error",insertText:"then error",documentation:"A rejection, for a reason this specification does not name."},{label:'then error "..."',insertText:'then error "${1:reason}"',documentation:"A rejection, for the named reason."},{label:"given clock",insertText:'given clock "${1:2026-10-05T08:00:00Z}"',documentation:"The instant the scenario happens at - the occurrence time of everything it does. At most once."},{label:"given capture",insertText:"given capture ${1:Capture}\n ${2:field} = ${3:value}",documentation:"A record the capture's source held before."},{label:"when clock",insertText:'when clock "${1:2026-10-05T09:00:00Z}"',documentation:"The clock reaches an instant, as the action."},{label:"when trigger",insertText:"when trigger ${1:Trigger}\n ${2:value} = ${3:value}",documentation:"An application trigger fires, as the action."},{label:"when capture",insertText:"when capture ${1:Capture}\n ${2:field} = ${3:value}",documentation:"The record a capture's source holds now, as the action."},{label:"when query",insertText:"when query ${1:Query}\n ${2:argument} = ${3:value}",documentation:"Performs a query, as the action."},{label:"then result",insertText:"then result\n ${1:property} = ${2:value}",documentation:"One result the query performed by `when query` returns, in order."},{label:"then no result",insertText:"then no result",documentation:"The query performed by `when query` returns nothing."}],De={given:[{label:"operation",insertText:"operation ${1:Name} fails",documentation:"Syntax-only failure fixture; no children."},{label:"clock",insertText:'clock "${1:2026-10-05T08:00:00Z}"',documentation:"The instant the scenario happens at - the occurrence time of everything it does."},{label:"capture",insertText:"capture ${1:Capture}\n ${2:field} = ${3:value}",documentation:"A record the capture's source held before. Repeat it for several records."},{label:"readmodel",insertText:"readmodel ${1:ReadModelType}\n ${2:property} = ${3:value}",documentation:"Establishes prior read model state directly."},{label:"caller",insertText:"caller\n ${1:authenticated}",documentation:"The identity the scenario runs as."}],when:[{label:"clock",insertText:'clock "${1:2026-10-05T09:00:00Z}"',documentation:"The clock reaches an instant - what a scheduled reaction responds to."},{label:"trigger",insertText:"trigger ${1:Trigger}\n ${2:value} = ${3:value}",documentation:"An application trigger fires, with the values it carries."},{label:"capture",insertText:"capture ${1:Capture}\n ${2:field} = ${3:value}",documentation:"The record a capture's source holds now."},{label:"query",insertText:"query ${1:Query}\n ${2:argument} = ${3:value}",documentation:"Performs a query; assert what it returns with `then result` or `then no result`."},{label:"append",insertText:"append ${1:EventType}\n ${2:property} = ${3:value}",documentation:"An event occurs, instead of a command being executed."}],then:[{label:"operation",insertText:"operation ${1:Name}\n ${2:input} = ${3:value}",documentation:"Syntax-only partial operation assertion; not admitted by any supported executable model (ESM) version yet."},{label:"compensated",insertText:"compensated ${1:Name}",documentation:"Syntax-only compensation assertion; no children."},{label:"returns value",insertText:"returns ${1:value}",documentation:"Scalar response expectation, compared by semantic value equality. Executable as ESM v7."},{label:"returns block",insertText:"returns\n ${1:field} = ${2:value}",documentation:"Nonempty subset of response fields asserted by name. Executable as ESM v7."},{label:"result",insertText:"result\n ${1:property} = ${2:value}",documentation:"One result the query performed by `when query` returns, in order."},{label:"result exactly",insertText:"result exactly\n ${1:property} = ${2:value}",documentation:"One result, with every property asserted."},{label:"no result",insertText:"no result",documentation:"The query performed by `when query` returns nothing."},{label:"readmodel",insertText:"readmodel ${1:ReadModelType}\n ${2:property} = ${3:value}",documentation:"The read model state expected afterwards."},{label:"error",insertText:'error "${1:reason}"',documentation:"A rejection, for the named reason."},{label:"denied",insertText:"denied",documentation:"The action is denied to the caller."}]},Ae=[{label:"hint",insertText:'hint "${1:predicate guidance}"',documentation:"Ordered nonblank authoring guidance. Does not execute or confirm the predicate."},{label:"file",insertText:"file ${1:Path}",documentation:"The sole named-rule predicate attachment."},{label:"csharp",insertText:N("csharp"),documentation:"Opaque named-rule predicate returning a bool. Requires an admitting target."}],At=[{label:"implementation",insertText:'implementation\n hint "${1:predicate guidance}"',documentation:"Command named-rule intent with optional file or tagged fence. Pending intent cannot bind."},...Ae.filter(e=>e.label!=="hint")],It=[{label:"file",insertText:"file ${1:Path}",documentation:"Gives the named predicate its implementation in an external C# file."},{label:"csharp",insertText:N("csharp"),documentation:"Gives the named predicate its implementation as inline C# returning a bool."}],qt=[{label:"require authenticated",insertText:"require authenticated",documentation:"Requires an authenticated caller."},{label:"require role",insertText:'require role "${1:role}"',documentation:"Requires the caller to have a role."},{label:"require claim",insertText:'require claim "${1:claim}" matches ${2:subject}',documentation:"Requires a claim to match the subject or a value."},{label:"csharp",insertText:N("csharp"),documentation:"Fully custom policy logic in C#, returning a bool."}],Lt=[{label:"not empty",insertText:'${1:property} not empty message "${2:message}"',documentation:"The property must have a value."},{label:"max",insertText:'${1:property} max ${2:500} message "${3:message}"',documentation:"Maximum length or value."},{label:"min",insertText:'${1:property} min ${2:1} message "${3:message}"',documentation:"Minimum length or value."},{label:"matches",insertText:'${1:property} matches "${2:pattern}" message "${3:message}"',documentation:"The property must match a regular expression."},{label:"rule",insertText:'${1:property} rule ${2:PredicateName} message "${3:message}"',documentation:"Names a predicate \u2014 optionally followed by an indented `file` reference or inline `csharp` block giving it a body; bare, it just states that a constraint exists."},{label:"==",insertText:'${1:property} == ${2:value} message "${3:message}"',documentation:"The property must equal the value."},{label:"!=",insertText:'${1:property} != ${2:value} message "${3:message}"',documentation:"The property must not equal the value."},{label:"length ==",insertText:'${1:property} length == ${2:3} message "${3:message}"',documentation:"The property must have an exact length."},{label:"all >",insertText:'${1:collection}.${2:property} all > ${3:0} message "${4:message}"',documentation:"Every element of a collection must satisfy the comparison."}],Et=[{label:"data",insertText:"data ${1:ReadModel} via query ${2:QueryName}",documentation:"Binds a read model to the screen through a query."},{label:"action",insertText:"action ${1:CommandName}",documentation:"Makes a command available as an action on the screen."},{label:"layout",insertText:"layout ${1:LayoutName}",documentation:"Uses a layout template and fills its slots."},{label:"section",insertText:"section ${1:name}",documentation:"A named structural section of the screen."},{label:"table",insertText:'table ${1:name}\n column ${2:property} label "${3:text}"',documentation:"A table widget over a read model or collection."},{label:"summary",insertText:'summary ${1:ReadModel}\n field ${2:property} label "${3:text}"',documentation:"A summary widget showing labeled fields."},{label:"title",insertText:'title "${1:text}"',documentation:"The title of the screen or section."},{label:"file",insertText:"file ${1:Path}",documentation:"Full external implementation \u2014 Stage uses the referenced file."},{label:"react",insertText:N("react"),documentation:"Inline React/TSX component receiving the data contract as Props."},{label:"typescript",insertText:N("typescript"),documentation:"Inline plain TypeScript."},{label:"html",insertText:N("html"),documentation:"Inline static HTML."}],Pt=[{label:"navigate to",insertText:"navigate to ${1:ScreenName}",documentation:"Navigates to a screen after the action completes."},{label:"label",insertText:'label "${1:text}"',documentation:"The display label of the action."}],Nt=[{label:"column",insertText:'column ${1:property} label "${2:text}"',documentation:"A column bound to a property."},{label:"on row-click",insertText:"on row-click navigate to ${1:ScreenName} by ${2:param}",documentation:"Navigates when a row is clicked."}],Ie=[{label:"$context.occurred",insertText:"$context.occurred",documentation:"When the command or query was received."},{label:"$context.tenant",insertText:"$context.tenant",documentation:"The tenant the command or query is executing for."},{label:"$context.command.",insertText:"$context.command.${1:property}",documentation:"A property of the command being handled."},{label:"$context.arguments.",insertText:"$context.arguments.${1:name}",documentation:"An argument of the query being performed."},{label:"$context.causedBy.subject",insertText:"$context.causedBy.subject",documentation:"Subject of the identity that caused the command or query."},{label:"$context.causedBy.name",insertText:"$context.causedBy.name",documentation:"Display name of the identity that caused the command or query."},{label:"$context.causedBy.userName",insertText:"$context.causedBy.userName",documentation:"User name of the identity that caused the command or query."},{label:"$context.causation.type",insertText:"$context.causation.type",documentation:"What caused this \u2014 a command, a reactor, a schedule."},{label:"$context.identity.id",insertText:"$context.identity.id",documentation:"The identifier of the caller from the auth token."},{label:"$context.identity.name",insertText:"$context.identity.name",documentation:"The display name of the caller."},{label:"$context.identity.userName",insertText:"$context.identity.userName",documentation:"The user name of the caller."},{label:"$context.identity.isAuthenticated",insertText:"$context.identity.isAuthenticated",documentation:"Whether the caller is authenticated."},{label:"$context.identity.roles",insertText:"$context.identity.roles",documentation:"The roles the caller holds."},{label:"$context.identity.claims.",insertText:"$context.identity.claims.${1:name}",documentation:"The value of a claim the caller carries."},{label:"$env.",insertText:"$env.${1:VAR_NAME}",documentation:"An environment variable."},...ee.filter(e=>e.name!=="value").map(e=>({label:`$eventContext.${e.path}`,insertText:`$eventContext.${e.path}`,documentation:`${e.description} (PDL)`}))];function ne(e,n,t,r){let a=P(e);if(a[n]||D(t).length<t.length)return null;let u=t.trim()===""?t.length:S(e[n]),d=z(e,a,n,u),o=U(e,a,n,u),c=h(s=>{let l=r.commands.filter(m=>m.name===s);return l.length===1?l[0]:void 0},"namedCommand"),i=h((s,l=s.name)=>({label:s.name,insertText:l,documentation:`${C(F(s))}${s.isGenerated?" \u2014 generated, not request/form input":""}. ${L}`}),"entry");if(d.includes("command")){let s=H(e).commands.filter(l=>l.line<n).at(-1);if(!s)return null;if(d[0]==="command"){if(/^\s*returns\s+@?\w*$/.test(t))return!/returns\s+@/.test(t)&&s.properties.some(m=>m.name==="returns"&&m.line===n)?null:s.properties.map(m=>i(m,`${/returns\s+@/.test(t)?"":"@"}${m.name}`));let l=t.match(/^\s*@?[a-z_]\w*\s+([\w.]+)\s+(\w*)$/);if(l&&["generated","identifier"].some(m=>m.startsWith(l[2]))&&r.concepts.find(g=>g.name===l[1])?.primitive==="Uuid")return[..."optional".startsWith(l[2])?ae:[],{label:"generated",insertText:"generated",documentation:`Required scalar Uuid concept with no validation rules; not a request/form input. ${L}`},{label:"generated identifier",insertText:"generated identifier",documentation:`Specification fixture uses an indented for value. ${L}`},{label:"identifier",insertText:"identifier",documentation:"Names the event source identifier."}];if(/^\s*@?[a-z_]\w*\s+[\w.]+\s+generated\s+\w*$/.test(t))return[{label:"identifier",insertText:"identifier",documentation:L}]}if(d[0]==="returns")return/=\s*@?\w*$/.test(t)?s.properties.map(l=>i(l)):/^\s*@?[a-z_]\w*\s+[\w.]*$/.test(t)?[...r.concepts.map(l=>l.name),...r.types.map(l=>l.name),...W].map(l=>({label:l,insertText:l,documentation:`Explicit response type must exactly match the source. ${L}`})):s.properties.map(l=>i(l,`${l.name} = ${l.name}`))}if(d[0]==="form"&&o&&(/^\s*field\s+\w*$/.test(t)||t.trim()==="")){let s=c(o.match(/\bfor\s+([\w.]+)$/)?.[1]);if(s)return s.properties.filter(l=>!l.isGenerated).map(l=>i(l,t.trim()===""?`field ${l.name}`:l.name))}if(d.includes("specification")){if(d[0]==="when"&&o){let s=o.match(/^when\s+([\w.]+)$/)?.[1],l=c(s);if(!l)return null;if(/^\s*generated\s+\w*$/.test(t))return l.properties.filter(m=>m.isGenerated&&!m.isIdentifier).map(m=>i(m,`${m.name} = "\${1:uuid}"`));if(t.trim()==="")return[...l.properties.filter(m=>!m.isGenerated).map(m=>i(m,`${m.name} = \${1:value}`)),...l.properties.filter(m=>m.isGenerated&&!m.isIdentifier).map(m=>({...i(m,`generated ${m.name} = "\${1:uuid}"`),label:`generated ${m.name}`})),...l.properties.some(m=>m.isGenerated&&m.isIdentifier)?[{label:"for",insertText:'for "${1:uuid}"',documentation:`Generated identifier fixture, not request input. ${L}`}]:[]]}if(d[0]==="then"&&/^then\s+returns$/.test(o??"")){let s=[...q(e).specifications.values()].filter(m=>m.location.line-1<n).at(-1),l=c(s?.when?.commandType);if(l?.response?.kind==="RecordCommandResponseSyntax"){let m=new Map(l.properties.map(g=>[g.name,g]));return l.response.fields.map(g=>{let y=m.get(g.source.property),$=g.type??(y?F(y):void 0);return{label:g.name,insertText:`${g.name} = \${1:value}`,documentation:`${$?C($):"Unresolved type"}. ${L}`}})}}}return null}h(ne,"responseCompletions");var E="Syntax-only; not admitted by any supported executable model (ESM) version yet (PLAY0268) (#301). No semantic or requirement identity is assigned.";function Rt(e,n){return q(e,n?.authoringDocuments??n?.authoringSources?.filter(t=>t!==e.join(`
7
+ `))??[],n?.authoringPlacement,n?.authoringPath).operations}h(Rt,"analyzeOperations");function qe(e){return e?e.file?`file ${e.file.path}`:e.code?`inline ${e.code.language}`:"pending":"not declared"}h(qe,"phaseState");function ce(e){let n=e.inputs.map(r=>`${r.name} ${C(r.type)}`).join(`
8
8
  `),t=h((r,a)=>`${r}: ${r==="compensate"&&!a?"not declared":qe(a)}${a?.description?` \u2014 ${a.description}`:""}${a?.implementation?.hints.map(u=>`
9
9
  hint: ${u.text}`).join("")??""}`,"phase");return`**operation ${[...e.scope,e.name].join(".")}**
10
10
 
@@ -20,57 +20,57 @@ ${t("execute",e.execute)}
20
20
 
21
21
  ${t("compensate",e.compensate)}
22
22
 
23
- ${P}`}h(ce,"operationDetails");function Le(e,n,t,r){let a=E(e);if(a[n]||D(t).length<t.length)return null;let u=t.trim()===""?t.length:S(e[n]),p=z(e,a,n,u),o=H(e,a,n,u)??"",c=q(e,r.authoringDocuments??r.authoringSources?.filter(x=>x!==e.join(`
24
- `))??[],r.authoringPlacement,r.authoringPath),i=c.operations,s=i.contexts.get(n),l=h(()=>{if(!s)return[];let f=(t.match(/(?:produces|given\s+operation|then\s+(?:operation|compensated))\s+([\w.]*)$/)?.[1]??t.trim()).split(".").slice(0,-1);return i.targets(s.scope).filter(b=>f.length===0||f.length<=b.declaration.scope.length&&f.every((k,A)=>b.declaration.scope[b.declaration.scope.length-f.length+A]===k)).map(b=>({label:b.name,insertText:f.length>0?b.declaration.name:b.name,documentation:ce(b.declaration)}))},"targets");if(p.includes("specification")&&/^\s*(?:given\s+operation|then\s+(?:operation|compensated))\s+[\w.]*$/.test(t))return l();if(p[0]==="command"&&/^\s*produces\s+[\w.]*$/.test(t))return l().length?[{label:"event",insertText:"event ${1:Name}",documentation:"Declares an inline event."},{label:"operation",insertText:"operation ${1:Name}\n uses ${2:System}\n ${3:input} ${4:Type} = ${5:source}",documentation:P},...r.events.map(x=>({label:x.name,insertText:x.name,documentation:"Declared event."})),...l()]:null;if(s?.commandLine!==void 0&&p[0]==="produces"&&/^produces\s+when\b/.test(o)&&/^\s*[\w.]*$/.test(t))return l();let m=s?.operation,g=m&&(n===m.location.line-1||u>S(e[m.location.line-1]))?m:void 0;if(g&&/^\s*uses\s+\w*$/.test(t)&&!g.inputs.some(x=>x.location.line===n+1))return i.systems.map(x=>({label:x.name,insertText:x.name,documentation:`${x.description??"External system"}. ${P}`}));if(p[0]==="implementation"&&["execute","compensate"].includes(p[1]))return te;if(["execute","compensate"].includes(p[0])&&g)return se;let y=s?.production,$=(y?.targetLocation??y?.location)?.line,T=$!==void 0&&n>$-1&&u>S(e[$-1]),w=g??(T?y?.declaration:void 0);if(w){let x=t.match(/=\s*([\w.]*)$/);if(x&&s?.commandLine!==void 0){let b=c.commands.get(s.commandLine)?.properties??[],k=x[1].split(".");for(let A of k.slice(0,-1)){let I=b.find(j=>j.name===A);if(!I||I.type.isCollection)return[];let B=i.types.filter(j=>j.name===I.type.name);if(B.length!==1)return[];b=B[0].properties}return b.map(A=>({label:A.name,insertText:A.name,documentation:`${C(A.type)}${A.isGenerated?" \u2014 generated source, not request input":""}. ${P}`}))}return g&&/^\s*@?[a-z_]\w*\s+[\w.]+(?:\[\])?\s+\w*$/.test(t)?[{label:"optional",insertText:"optional",documentation:"Allows absence of the complete operation input value."}]:/^\s*@?[a-z_]\w*\s+[\w.[\]?]*$/.test(t)&&g?[...i.concepts.map(f=>f.name),...i.types.map(f=>f.name),"String","Uuid","Int","Decimal","Bool","Date","DateTime"].map(f=>({label:f,insertText:f,documentation:"Operation input type."})):g?Q:w.inputs.map(f=>({label:f.name,insertText:`${f.name} = \${1:source}`,documentation:`${C(f.type)}. ${P}`}))}if(p[0]==="then"&&/^then\s+operation\s+/.test(o)){let x=o.match(/^then\s+operation\s+([\w.]+)/)?.[1],f=i.references.filter(b=>b.name===x&&b.location.line-1<n&&b.kind==="operation").at(-1)?.declaration;if(f){let b=t.match(/^\s*(\w+)\s*=\s*[^=]*$/);if(b){let k=f.inputs.find(I=>I.name===b[1])?.type,A=i.concepts.filter(I=>I.name===k?.name);if(A.length===1&&A[0].type==="Enum")return A[0].values.map(I=>({label:I,insertText:JSON.stringify(I),documentation:`${k?.name} value.`}))}return f.inputs.map(k=>({label:k.name,insertText:`${k.name} = \${1:value}`,documentation:`${C(k.type)}. Partial assertion; ${P}`}))}}return null}h(Le,"operationCompletions");function Mt(e,n,t,r,a){let u=D(n[t]??"");return e.references.find(p=>{let o=p.targetLocation??p.location;return o.line===t+1&&r>=o.column&&a<=o.column+p.name.length&&u.slice(o.column-1,o.column-1+p.name.length)===p.name})}h(Mt,"operationReferenceAt");function Pe(e,n,t,r,a){let u=Nt(e,a),p=e[n]??"",o=h((y,$)=>{let T=y.column+(p[y.column-1]==="@"?1:0);return y.line===n+1&&t===T&&r===T+$.length&&p.slice(t-1,r-1)===$},"at"),c=u.contexts.get(n),i=c?.operation?.inputs.find(y=>o(y.location,y.name));if(i)return`**${i.name}** \u2014 ${C(i.type)}. Operation input, not a command request field. ${P}`;let s=p.indexOf("=");if(s>=0&&t-1>s&&c?.commandLine!==void 0&&(c.operation||c.production?.declaration)){let y=q(e,a?.authoringDocuments??a?.authoringSources?.filter(x=>x!==e.join(`
25
- `))??[],a?.authoringPlacement,a?.authoringPath).commands.get(c.commandLine),T=p.slice(s+1,r-1).trim().split("."),w=y?.properties??[];for(let[x,f]of T.entries()){let b=w.find(A=>A.name===f);if(!b)break;if(x===T.length-1)return`**${f}** \u2014 ${C(b.type)}. Command source for an operation input. ${P}`;let k=u.types.filter(A=>A.name===b.type.name);if(k.length!==1||b.type.isCollection)break;w=k[0].properties}}let l=Mt(u,e,n,t,r);if(l?.declaration)return ce(l.declaration);if(l?.kind==="ambiguous")return`Ambiguous production: no declaration kind was selected. ${P}`;let m=c?.operation;if(m&&m.location.line===n+1){let y=D(p).match(/^\s*(?:produces\s+)?operation\s+/)?.[0];if(y&&t===y.length+1&&r===t+m.name.length)return ce(m)}if(m?.usesLocation?.line===n+1&&t>=m.usesLocation.column&&r<=m.usesLocation.column+m.uses.length&&D(p).slice(t-1,r-1)===m.uses.slice(t-m.usesLocation.column,r-m.usesLocation.column)){let y=u.systems.filter($=>$.name===m.uses);return y.length===1?`**system ${y[0].name}**
23
+ ${E}`}h(ce,"operationDetails");function Le(e,n,t,r){let a=P(e);if(a[n]||D(t).length<t.length)return null;let u=t.trim()===""?t.length:S(e[n]),d=z(e,a,n,u),o=U(e,a,n,u)??"",c=q(e,r.authoringDocuments??r.authoringSources?.filter(x=>x!==e.join(`
24
+ `))??[],r.authoringPlacement,r.authoringPath),i=c.operations,s=i.contexts.get(n),l=h(()=>{if(!s)return[];let f=(t.match(/(?:produces|given\s+operation|then\s+(?:operation|compensated))\s+([\w.]*)$/)?.[1]??t.trim()).split(".").slice(0,-1);return i.targets(s.scope).filter(b=>f.length===0||f.length<=b.declaration.scope.length&&f.every((k,A)=>b.declaration.scope[b.declaration.scope.length-f.length+A]===k)).map(b=>({label:b.name,insertText:f.length>0?b.declaration.name:b.name,documentation:ce(b.declaration)}))},"targets");if(d.includes("specification")&&/^\s*(?:given\s+operation|then\s+(?:operation|compensated))\s+[\w.]*$/.test(t))return l();if(d[0]==="command"&&/^\s*produces\s+[\w.]*$/.test(t))return l().length?[{label:"event",insertText:"event ${1:Name}",documentation:"Declares an inline event."},{label:"operation",insertText:"operation ${1:Name}\n uses ${2:System}\n ${3:input} ${4:Type} = ${5:source}",documentation:E},...r.events.map(x=>({label:x.name,insertText:x.name,documentation:"Declared event."})),...l()]:null;if(s?.commandLine!==void 0&&d[0]==="produces"&&/^produces\s+when\b/.test(o)&&/^\s*[\w.]*$/.test(t))return l();let m=s?.operation,g=m&&(n===m.location.line-1||u>S(e[m.location.line-1]))?m:void 0;if(g&&/^\s*uses\s+\w*$/.test(t)&&!g.inputs.some(x=>x.location.line===n+1))return i.systems.map(x=>({label:x.name,insertText:x.name,documentation:`${x.description??"External system"}. ${E}`}));if(d[0]==="implementation"&&["execute","compensate"].includes(d[1]))return te;if(["execute","compensate"].includes(d[0])&&g)return se;let y=s?.production,$=(y?.targetLocation??y?.location)?.line,T=$!==void 0&&n>$-1&&u>S(e[$-1]),w=g??(T?y?.declaration:void 0);if(w){let x=t.match(/=\s*([\w.]*)$/);if(x&&s?.commandLine!==void 0){let b=c.commands.get(s.commandLine)?.properties??[],k=x[1].split(".");for(let A of k.slice(0,-1)){let I=b.find(j=>j.name===A);if(!I||I.type.isCollection)return[];let B=i.types.filter(j=>j.name===I.type.name);if(B.length!==1)return[];b=B[0].properties}return b.map(A=>({label:A.name,insertText:A.name,documentation:`${C(A.type)}${A.isGenerated?" \u2014 generated source, not request input":""}. ${E}`}))}return g&&/^\s*@?[a-z_]\w*\s+[\w.]+(?:\[\])?\s+\w*$/.test(t)?[{label:"optional",insertText:"optional",documentation:"Allows absence of the complete operation input value."}]:/^\s*@?[a-z_]\w*\s+[\w.[\]?]*$/.test(t)&&g?[...i.concepts.map(f=>f.name),...i.types.map(f=>f.name),"String","Uuid","Int","Decimal","Bool","Date","DateTime"].map(f=>({label:f,insertText:f,documentation:"Operation input type."})):g?Q:w.inputs.map(f=>({label:f.name,insertText:`${f.name} = \${1:source}`,documentation:`${C(f.type)}. ${E}`}))}if(d[0]==="then"&&/^then\s+operation\s+/.test(o)){let x=o.match(/^then\s+operation\s+([\w.]+)/)?.[1],f=i.references.filter(b=>b.name===x&&b.location.line-1<n&&b.kind==="operation").at(-1)?.declaration;if(f){let b=t.match(/^\s*(\w+)\s*=\s*[^=]*$/);if(b){let k=f.inputs.find(I=>I.name===b[1])?.type,A=i.concepts.filter(I=>I.name===k?.name);if(A.length===1&&A[0].type==="Enum")return A[0].values.map(I=>({label:I,insertText:JSON.stringify(I),documentation:`${k?.name} value.`}))}return f.inputs.map(k=>({label:k.name,insertText:`${k.name} = \${1:value}`,documentation:`${C(k.type)}. Partial assertion; ${E}`}))}}return null}h(Le,"operationCompletions");function Mt(e,n,t,r,a){let u=D(n[t]??"");return e.references.find(d=>{let o=d.targetLocation??d.location;return o.line===t+1&&r>=o.column&&a<=o.column+d.name.length&&u.slice(o.column-1,o.column-1+d.name.length)===d.name})}h(Mt,"operationReferenceAt");function Ee(e,n,t,r,a){let u=Rt(e,a),d=e[n]??"",o=h((y,$)=>{let T=y.column+(d[y.column-1]==="@"?1:0);return y.line===n+1&&t===T&&r===T+$.length&&d.slice(t-1,r-1)===$},"at"),c=u.contexts.get(n),i=c?.operation?.inputs.find(y=>o(y.location,y.name));if(i)return`**${i.name}** \u2014 ${C(i.type)}. Operation input, not a command request field. ${E}`;let s=d.indexOf("=");if(s>=0&&t-1>s&&c?.commandLine!==void 0&&(c.operation||c.production?.declaration)){let y=q(e,a?.authoringDocuments??a?.authoringSources?.filter(x=>x!==e.join(`
25
+ `))??[],a?.authoringPlacement,a?.authoringPath).commands.get(c.commandLine),T=d.slice(s+1,r-1).trim().split("."),w=y?.properties??[];for(let[x,f]of T.entries()){let b=w.find(A=>A.name===f);if(!b)break;if(x===T.length-1)return`**${f}** \u2014 ${C(b.type)}. Command source for an operation input. ${E}`;let k=u.types.filter(A=>A.name===b.type.name);if(k.length!==1||b.type.isCollection)break;w=k[0].properties}}let l=Mt(u,e,n,t,r);if(l?.declaration)return ce(l.declaration);if(l?.kind==="ambiguous")return`Ambiguous production: no declaration kind was selected. ${E}`;let m=c?.operation;if(m&&m.location.line===n+1){let y=D(d).match(/^\s*(?:produces\s+)?operation\s+/)?.[0];if(y&&t===y.length+1&&r===t+m.name.length)return ce(m)}if(m?.usesLocation?.line===n+1&&t>=m.usesLocation.column&&r<=m.usesLocation.column+m.uses.length&&D(d).slice(t-1,r-1)===m.uses.slice(t-m.usesLocation.column,r-m.usesLocation.column)){let y=u.systems.filter($=>$.name===m.uses);return y.length===1?`**system ${y[0].name}**
26
26
 
27
27
  ${y[0].description??""}
28
28
 
29
- ${P}`:`Unresolved or ambiguous external system. ${P}`}for(let y of[m?.execute,m?.compensate])if(y&&(y.location.line===n+1||y.implementation?.location.line===n+1||y.implementation?.hints.some($=>$.location.line===n+1)))return`${qe(y)}
29
+ ${E}`:`Unresolved or ambiguous external system. ${E}`}for(let y of[m?.execute,m?.compensate])if(y&&(y.location.line===n+1||y.implementation?.location.line===n+1||y.implementation?.hints.some($=>$.location.line===n+1)))return`${qe(y)}
30
30
 
31
31
  ${y.description??""}
32
32
 
33
33
  ${y.implementation?.hints.map($=>$.text).join(`
34
34
  `)??""}
35
35
 
36
- ${P}`;let g=u.systems.find(y=>y.location.path===(a?.authoringPath??"current.play")&&y.location.line===n+1);return g?`**system ${g.name}**
36
+ ${E}`;let g=u.systems.find(y=>y.location.path===(a?.authoringPath??"current.play")&&y.location.line===n+1);return g?`**system ${g.name}**
37
37
 
38
38
  ${g.description??""}
39
39
 
40
- ${P}`:null}h(Pe,"operationHover");var O="Syntax-only; not admitted by any supported executable model (ESM) version yet (PLAY0268) (#302). Authored classification does not supply an identity destination. No semantic IDs or automatic identity refactors.",Tn=X("^\\s*stream\\s+(?:[A-Za-z_]\\w*(?:\\.[A-Za-z_]\\w*)?\\.?)?$"),Ot=X("^\\s*streamId\\s*=\\s*([\\w.]*)$"),kn=X("^\\s*identifier\\s+[\\w.]*$"),Cn=X("^\\s*streamId\\s+[\\w.]*$");function me(e,n){return n=V(e,n),q(e,n?.authoringDocuments??n?.authoringSources?.filter(t=>t!==e.join(`
40
+ ${E}`:null}h(Ee,"operationHover");var O="Syntax-only; not admitted by any supported executable model (ESM) version yet (PLAY0268) (#302). Authored classification does not supply an identity destination. No semantic IDs or automatic identity refactors.",Tn=X("^\\s*stream\\s+(?:[A-Za-z_]\\w*(?:\\.[A-Za-z_]\\w*)?\\.?)?$"),Ot=X("^\\s*streamId\\s*=\\s*([\\w.]*)$"),kn=X("^\\s*identifier\\s+[\\w.]*$"),Cn=X("^\\s*streamId\\s+[\\w.]*$");function me(e,n){return n=V(e,n),q(e,n?.authoringDocuments??n?.authoringSources?.filter(t=>t!==e.join(`
41
41
  `))??[],n?.authoringPlacement,n?.authoringPath,n?.authoringPlacementResolved).eventSources}h(me,"analyzeEventSources");function le(e,n){return[`**${n?`stream ${e.name}.${n.name}`:`eventsource ${e.name}`}**`,n?.description??e.description??"",e.identifier?`Identifier type: ${C(e.identifier)}`:"No identifier type declared.",n?n.streamId?`Stream id type: ${C(n.streamId)}`:"Unkeyed stream.":e.streams.map(t=>`${t.name}${t.streamId?` \u2014 ${C(t.streamId)}`:" \u2014 unkeyed"}`).join(`
42
42
  `),n?.id??(n?null:e.id)?"Stored-name pin (rename-only metadata; not a semantic ID).":"",O].filter(Boolean).join(`
43
43
 
44
- `)}h(le,"eventSourceDetails");function ue(e,n,t,r,a){let u=me(e,a),p=h(l=>{let m=l.referenceLocation,g=`${l.eventSource}.${l.stream}`;return m?.line===n+1&&t>=m.column&&r<=m.column+g.length&&D(e[n]??"").slice(m.column-1,m.column-1+g.length)===g},"at"),o=u.ambiguousCandidates.find(p);if(o)return{route:o,resolution:{state:"ambiguous",source:void 0,stream:void 0},target:void 0};let c=u.routes.find(p);if(!c)return null;let i=u.resolve(c.eventSource,c.stream),s=r<=c.referenceLocation.column+c.eventSource.length;return{route:c,resolution:i,target:i.state==="unique"?s?i.source:i.stream:void 0}}h(ue,"eventSourceReferenceAt");function pe(e,n,t){let r=D(t.split(/\r?\n/)[e.line-1]??""),a=r.slice(e.column-1).match(/^(?:eventsource|stream)\s+/)?.[0];return a&&r.slice(e.column-1+a.length,e.column-1+a.length+n.length)===n?{...e,column:e.column+a.length}:void 0}h(pe,"eventSourceIdentifier");function Ee(e,n,t,r,a){a=V(e,a);let u=me(e,a),p=ue(e,n,t,r,a);if(p)return p.resolution.source&&p.resolution.stream?le(p.resolution.source,p.resolution.stream):`Physical stream owner: ${p.resolution.state}; no route selected. ${"reasons"in p.resolution?p.resolution.reasons.join(" "):""} ${O}`;let o=u.contexts.get(n),c=o?.stream??o?.source;if(c){let s=pe(c.location,c.name,e.join(`
44
+ `)}h(le,"eventSourceDetails");function ue(e,n,t,r,a){let u=me(e,a),d=h(l=>{let m=l.referenceLocation,g=`${l.eventSource}.${l.stream}`;return m?.line===n+1&&t>=m.column&&r<=m.column+g.length&&D(e[n]??"").slice(m.column-1,m.column-1+g.length)===g},"at"),o=u.ambiguousCandidates.find(d);if(o)return{route:o,resolution:{state:"ambiguous",source:void 0,stream:void 0},target:void 0};let c=u.routes.find(d);if(!c)return null;let i=u.resolve(c.eventSource,c.stream),s=r<=c.referenceLocation.column+c.eventSource.length;return{route:c,resolution:i,target:i.state==="unique"?s?i.source:i.stream:void 0}}h(ue,"eventSourceReferenceAt");function de(e,n,t){let r=D(t.split(/\r?\n/)[e.line-1]??""),a=r.slice(e.column-1).match(/^(?:eventsource|stream)\s+/)?.[0];return a&&r.slice(e.column-1+a.length,e.column-1+a.length+n.length)===n?{...e,column:e.column+a.length}:void 0}h(de,"eventSourceIdentifier");function Pe(e,n,t,r,a){a=V(e,a);let u=me(e,a),d=ue(e,n,t,r,a);if(d)return d.resolution.source&&d.resolution.stream?le(d.resolution.source,d.resolution.stream):`Physical stream owner: ${d.resolution.state}; no route selected. ${"reasons"in d.resolution?d.resolution.reasons.join(" "):""} ${O}`;let o=u.contexts.get(n),c=o?.stream??o?.source;if(c){let s=de(c.location,c.name,e.join(`
45
45
  `));if(s?.line===n+1&&t===s.column&&r===t+c.name.length&&o?.source){let l=u.resolve(o.source.name,o.stream?.name);return le(o.source,o.stream)+(l.state==="unique"?"":`
46
46
 
47
47
  Physical ownership: ${l.state}. ${l.reasons.join(" ")}`)}}if(o?.route?.streamId&&o.command){let s=o.route.streamId;if(s.location.line===n+1&&t===s.location.column&&r===t+8)return`Authored stream id mapping. ${O}`;let l=s.source;if(l.kind==="PathExpressionSyntax"&&l.path&&l.location?.line===n+1&&t>=l.location.column&&r<=l.location.column+l.path.length){let m=q(e,a?.authoringDocuments??a?.authoringSources?.filter(x=>x!==e.join(`
48
- `))??[],a?.authoringPlacement,a?.authoringPath,a?.authoringPlacementResolved),y=l.path.slice(0,r-l.location.column).split("."),$=o.command.properties,T=!1,w=!1;for(let[x,f]of y.entries()){let b=$.filter(I=>I.name===f);if(b.length!==1)break;let k=b[0];if(T||=k.type.isOptional,w||=k.type.isCollection,x===y.length-1)return`**${f}** \u2014 ${C({...k.type,isOptional:T,isCollection:w})}. Command source for authored stream id. ${O}`;let A=m.operations.types.filter(I=>I.name===k.type.name);if(A.length!==1||w)break;$=A[0].properties.map(I=>({...I,isIdentifier:!1}))}}}if(o?.source&&/^\s*id\s+"/.test(D(e[n]??""))&&t===S(e[n])+1&&r===t+2)return`Stored-name pin: rename-only metadata, not a semantic identity or an automatic refactor. ${O}`;let i=o?.stream?.streamId??o?.source?.identifier;return i&&i.location?.line===n+1&&t>=i.location.column&&r<=i.location.column+i.name.length?`${C(i)} \u2014 authored ${o?.stream?"stream id":"identifier"} type. ${O}`:null}h(Ee,"eventSourceHover");function Re(e,n,t,r){if(E(e)[n]||D(t).length<t.length||/[\uD800-\uDFFF]/.test(t))return null;let a=me(e,r),u=a.contexts.get(n),p=t.trim()?S(e[n]):t.length;if(u?.command&&p>S(e[u.command.location.line-1])&&(!u.route||p<=S(e[u.route.location.line-1]))&&Tn.test(t)){let o=q(e,r.authoringDocuments??r.authoringSources?.filter(s=>s!==e.join(`
49
- `))??[],r.authoringPlacement,r.authoringPath),c=new Set([...o.operations.concepts,...o.operations.types].map(s=>s.name)),i=t.trim().split(/\s+/)[1]??"";return a.targets.filter(s=>ie(s.source.name)&&ie(s.stream.name)&&!c.has(s.name)&&(!i.includes(".")||s.name.startsWith(i.slice(0,i.lastIndexOf(".")+1)))).map(s=>({label:s.name,insertText:i.includes(".")?s.stream.name:s.name,documentation:le(s.source,s.stream)}))}if(u?.route&&u.command&&p>S(e[u.route.location.line-1])&&Ot.test(t)){let o=a.resolve(u.route.eventSource,u.route.stream).stream?.streamId;if(!o)return[];let c=q(e,r.authoringDocuments??r.authoringSources?.filter(g=>g!==e.join(`
50
- `))??[],r.authoringPlacement,r.authoringPath),i=c.operations.concepts.filter(g=>g.name===o.name);if(!(["String","Uuid"].includes(o.name)||i.length===1&&["String","Uuid","Int"].includes(i[0].type)&&i[0].values.length===0)||o.isOptional||o.isCollection)return[];let l=Ot.exec(t)[1].split("."),m=u.command.properties;for(let g of l.slice(0,-1)){let y=m.filter(T=>T.name===g);if(y.length!==1||y[0].type.isOptional||y[0].type.isCollection)return[];let $=c.operations.types.filter(T=>T.name===y[0].type.name);if($.length!==1)return[];m=$[0].properties.map(T=>({...T,isIdentifier:!1}))}return m.filter(g=>ie(g.name)&&g.type.name===o.name&&!g.type.isOptional&&!g.type.isCollection).map(g=>({label:g.name,insertText:g.name,documentation:`${C(g.type)} \u2014 command source for authored stream id. ${O}`}))}if(u?.source&&p>S(e[u.source.location.line-1])){let o=u.stream&&p>S(e[u.stream.location.line-1]);if((o?Cn:kn).test(t)){let c=q(e,r.authoringDocuments??[],r.authoringPlacement,r.authoringPath),i=/^\s*streamId\b/.test(t);return[...i?["String","Uuid"]:["String","Uuid","Int","Decimal","Bool","Date","DateTime"],...c.operations.concepts.filter(s=>!i||["String","Uuid","Int"].includes(s.type)&&s.values.length===0).map(s=>s.name)].filter(tt).map(s=>({label:s,insertText:s,documentation:O}))}if(/^\s*$/.test(t))return o?[{label:"streamId",insertText:"streamId ${1:Type}",documentation:O},{label:"description",insertText:'description "${1:Description}"',documentation:"Authored description."}]:[{label:"identifier",insertText:"identifier ${1:Type}",documentation:O},{label:"stream",insertText:"stream ${1:Name}",documentation:O},{label:"description",insertText:'description "${1:Description}"',documentation:"Authored description."}]}return null}h(Re,"eventSourceCompletions");var Sn=new RegExp(`^[${G}.]+\\s+rule\\s+[A-Za-z_][${G}]*(?:\\s+severity\\s+(?:information|warning|error))?(?:\\s+message\\s+.*)?$`);function de(e,n,t){let r=E(e),a=[],u=t;for(let c=n-1;c>=0&&u>0;c--){if(r[c])continue;let i=D(e[c]).trimEnd();i.trim().length===0||S(i)>=u||(a.push(i.trim()),u=S(i))}let p=a[0]==="implementation",o=p?1:0;return Sn.test(a[o]??"")&&a[o+1]==="validate"&&/^command\s/.test(a[o+2]??"")?p?"implementation":"rule":null}h(de,"namedRuleContext");var Ne=new Map,jt=new Set;function he(e,n){Ne.set(e,{keyword:e,...n}),jt.forEach(t=>t())}h(he,"registerSubLanguage");function Me(){return[...Ne.values()]}h(Me,"getSubLanguages");function _(e){return Ne.get(e)}h(_,"getSubLanguage");function zt(e){jt.add(e)}h(zt,"onSubLanguagesChanged");var Dn=/(?:^|\s)rule\s+[A-Za-z_]\w*(?:\s+severity\s+(?:information|warning|error))?(?:\s+message\s+.*)?$/;function Ft(e){let n=e[0];if(n===void 0)return ut;let t=_(n);if(t)return t.completions??[];switch(n){case"module":return ht;case"feature":return yt;case"slice":return ft;case"concept":return pt;case"type":return dt;case"command":return gt;case"event":return Se;case"system":return Q.filter(r=>r.label==="description");case"operation":return Q;case"execute":case"compensate":return se;case"produces":return K;case"handler":return vt;case"implementation":return e[1]==="handler"?$t:["execute","compensate"].includes(e[1])?te:[];case"query":return xt;case"performer":return wt;case"constraint":return Tt;case"reaction":return kt;case"trigger":return St;case"when":case"every":case"at":return e.includes("reaction")?Ct:[];case"specification":return Dt;case"policy":return qt;case"validate":return Lt;case"action":return Et;case"table":case"summary":return Rt;default:return e.includes("screen")||n==="section"||n==="layout"?Pt:e.includes("produces")?K:[]}}h(Ft,"completionEntriesFor");function Oe(e,n,t){let r=E(e);if(r[n]||D(t).length<t.length)return{kind:"none"};let a=ne(e,n,t,U(e));if(a!==null)return{kind:"entries",entries:a};let u=t.match(/^\s*import\s+"([^"]*)$/);if(u)return{kind:"playFiles",replaceLength:u[1].length};if(/["/]$/.test(t))return{kind:"none"};let p=t.match(/\$[\w.]*$/);if(p)return{kind:"contextVariables",replaceLength:p[0].length};let o=e[n]??"",c=t.trim().length===0?t.length:S(o),i=z(e,r,n,c),s=de(e,n,c);if(s==="implementation")return{kind:"entries",entries:Ae};if(s==="rule")return{kind:"entries",entries:At};let l=["event","command","type","readmodel","trigger","when","every","at"].includes(i[0])||i[0]==="produces"&&/^produces\s+event\b/.test(H(e,r,n,c)??""),m=t.trimStart().split(/\s+/)[0],g=i[0]==="command"&&["reads","authorize","produces"].includes(m)||i[0]==="event"&&m==="tag"||["trigger","when","every","at"].includes(i[0])&&["description","file","reads","produces","invokes"].includes(m),y=h(x=>x!==null&&"optional".startsWith(x[1]),"optionalPrefix"),$=l&&!g&&y(t.match(/^\s*@?[a-z_]\w*\s+[\w.]+(?:\[\])?\s+(\w*)$/)),T=i[0]==="query"&&y(t.match(/^\s*(?:by|filter)\s+[a-z_]\w*\s+[\w.]+(?:\[\])?\s+(\w*)$/))||y(t.match(/^\s*query\s+[A-Za-z_]\w*\s*=>\s*(?:observable\s+)?[\w.]+(?:\[\])?\s+(\w*)$/));if(($||T)&&!/=>\s*observable\s+$/.test(t))return{kind:"entries",entries:ae};if(/\bauthorize\s+[\w\s]*$/.test(t)||i[0]==="authorize")return{kind:"policies"};if(/\bwhen\s+\w*$/.test(t)&&i.includes("reaction"))return{kind:"triggers"};if(/\bon\s+\w*$/.test(t)&&i.includes("constraint"))return{kind:"events"};if(/\binvokes\s+\w*$/.test(t)&&i.includes("reaction"))return{kind:"commands"};if(/\b(?:on|unique\s+event)\s+\w*$/.test(t)&&i[0]==="constraint")return{kind:"events"};if(/\bproduces\s+\w*$/.test(t))return{kind:"producesTargets"};if(/\bnavigate\s+to\s+\w*$/.test(t))return{kind:"screens"};if(i[0]==="specification"){if(/^\s*when\s+query\s+[\w.]*$/.test(t))return{kind:"queries"};let x=t.match(/^\s*(given|when|then)\s+\w*$/);if(x)return{kind:"entries",entries:De[x[1]]}}if(/\b(?:via|then)\s+query\s+[\w.]*$/.test(t))return{kind:"queries"};if((i[0]==="event"||i[0]==="command"||i[0]==="type")&&/^\s+[a-z_]\w*\s+[\w[\]?]*$/.test(t))return{kind:"types"};if(i[0]==="query"&&/^\s+(?:by|filter)\s+[a-z_]\w*\s+[\w[\]?]*$/.test(t))return{kind:"types"};let w=H(e,r,n,c);return w&&/^produces\s+operation\b/.test(w)?{kind:"entries",entries:Q}:w&&/^produces\s+event\b/.test(w)?/^\s+@?[a-z_]\w*\s+[\w[\]?]*$/.test(t)?{kind:"types"}:{kind:"entries",entries:bt}:w&&Dn.test(w)?{kind:"entries",entries:It}:{kind:"entries",entries:Ft(i)}}h(Oe,"planCompletions");function Bt(e,n={}){return{triggerCharacters:[" ","$","@",".",'"',"/"],provideCompletionItems(t,r){let a=t.getLinesContent(),u=r.lineNumber-1,o=(a[u]??"").substring(0,r.column-1),c=n.application?.(t),i=V(a,c),s=Re(a,u,o,i)??Le(a,u,o,i)??ne(a,u,o,i),l=s===null?Oe(a,u,o):{kind:"entries",entries:s};if(l.kind==="none")return{suggestions:[]};let m=t.getWordUntilPosition(r),g=new e.Range(r.lineNumber,m.startColumn,r.lineNumber,m.endColumn),y=e.languages.CompletionItemKind,$=e.languages.CompletionItemInsertTextRule.InsertAsSnippet,T=h(f=>({label:f.label,kind:f.insertText.includes("$")?y.Snippet:y.Keyword,insertText:f.insertText,insertTextRules:$,documentation:f.documentation,range:g}),"snippet"),w=h((f,b,k)=>({label:f,kind:b,insertText:f,detail:k,range:g}),"symbolItem"),x=h(()=>{let f=new Set(i.events.filter(b=>b.inline).map(b=>b.name));return[...new Set(xe(i))].map(b=>w(b,y.Event,f.has(b)?"inline event":"event"))},"eventNames");switch(l.kind){case"playFiles":{let f=new e.Range(r.lineNumber,r.column-l.replaceLength,r.lineNumber,r.column);return{suggestions:(n.playFiles?.(t)??[]).map(b=>({label:b,kind:b.includes("*")?y.Folder:y.File,insertText:b,range:f}))}}case"contextVariables":{let f=new e.Range(r.lineNumber,r.column-l.replaceLength,r.lineNumber,m.endColumn);return{suggestions:Ie.map(b=>({...T(b),range:f}))}}case"policies":return{suggestions:i.policies.map(f=>w(f.name,y.Reference,"policy"))};case"events":return{suggestions:x()};case"triggers":return{suggestions:[...new Set(we(i))].map(f=>w(f,y.Event,"trigger"))};case"commands":return{suggestions:i.commands.map(f=>w(f.name,y.Method,"command"))};case"producesTargets":return{suggestions:[...K.map(T),...x()]};case"screens":return{suggestions:i.screens.map(f=>w(f.name,y.Interface,"screen"))};case"queries":return{suggestions:i.queries.map(f=>w(f.name,y.Function,`query => ${C(f.returnTypeReference??ve(f.returnType))}`))};case"types":return{suggestions:[...i.concepts.map(f=>w(f.name,y.Class,`concept : ${f.primitive}${f.attributes.length?" "+f.attributes.join(" "):""}`)),...i.types.map(f=>w(f.name,y.Struct,`type (${f.properties.length} properties)`)),...W.map(f=>w(f,y.Struct,"primitive"))]};case"entries":return{suggestions:l.entries.map(T)}}}}}h(Bt,"createCompletionProvider");var je=["keyword","property","type"];function ze(e,n){let t=[],r=h((o,c,i,s)=>{let l=e[o-1];if(l===void 0||c<1||i<1)return;let m=c-1+(l[c-1]==="@"?1:0);m+i<=l.length&&t.push({line:o-1,column:m,length:i,type:s})},"add"),a=n?.authoringPath??"current.play",u=q(e,n?.authoringDocuments??n?.authoringSources?.filter(o=>o!==e.join(`
51
- `))??[],n?.authoringPlacement,a,n?.authoringPlacementResolved);for(let o of u.eventSources.declarations.filter(c=>c.location.path===a)){r(o.location.line,o.location.column,11,0),o.identifier&&r(o.identifier.location.line,o.identifier.location.column,o.identifier.name.length,2);for(let c of o.streams)r(c.location.line,c.location.column,6,0),c.streamId&&r(c.streamId.location.line,c.streamId.location.column,c.streamId.name.length,2)}for(let o of u.eventSources.routes)r(o.location.line,o.location.column,6,0),o.referenceLocation&&r(o.referenceLocation.line,o.referenceLocation.column,`${o.eventSource}.${o.stream}`.length,2),o.streamId&&r(o.streamId.location.line,o.streamId.location.column,8,0);for(let o of u.commands.values()){for(let i of o.properties){if(!i.isGenerated)continue;let s=D(e[i.location.line-1]??"");r(i.location.line,s.lastIndexOf("generated")+1,9,0)}let c=o.response;if(c)if(r(c.location.line,c.location.column,7,0),c.kind==="ScalarCommandResponseSyntax")r(c.source.location.line,c.source.location.column,c.source.property.length,1);else for(let i of c.fields)r(i.location.line,i.location.column,i.name.length,1),r(i.source.location.line,i.source.location.column,i.source.property.length,1),i.type&&r(i.type.location.line,i.type.location.column,i.type.name.length,2)}for(let o of u.specifications.values()){for(let c of o.when?.generatedValues??[])r(c.location.line,c.location.column,9,0);o.thenReturns&&r(o.thenReturns.location.line,(e[o.thenReturns.location.line-1]??"").indexOf("returns")+1,7,0)}for(let o of u.operations.systems.filter(c=>c.location.path===a))r(o.location.line,o.location.column,6,0);for(let o of u.operations.declarations.filter(c=>c.location.path===a)){let i=D(e[o.location.line-1]??"").indexOf("operation",o.location.column-1);i>=0&&r(o.location.line,i+1,9,0);for(let s of o.inputs)r(s.location.line,s.location.column,s.name.length,1),r(s.type.location.line,s.type.location.column,s.type.name.length,2);o.usesLocation&&r(o.usesLocation.line,(e[o.usesLocation.line-1]??"").indexOf("uses")+1,4,0);for(let s of[o.execute,o.compensate]){if(!s)continue;let l=D(e[s.location.line-1]??"").trim();r(s.location.line,s.location.column,l.length,0),s.implementation&&r(s.implementation.location.line,s.implementation.location.column,14,0);for(let m of s.implementation?.hints??[])r(m.location.line,m.location.column,4,0)}}let p=t.sort((o,c)=>o.line-c.line||o.column-c.column);return p.filter((o,c)=>c===0||o.line!==p[c-1].line||o.column>=p[c-1].column+p[c-1].length)}h(ze,"responseTokens");var Fe={implementation:"Handler-only intent with ordered hints and at most one file or tagged fence. No payload means pending. Handler execution is unsupported; this is not confirmation.",hint:"One nonblank quoted implementation hint. Order and decoded text are retained; hints do not execute or confirm code."},oe={domain:"The domain the file belongs to \u2014 optional, at most one per file, before everything else.",import:"Imports a type from another module by its qualified name \u2014 `import Module.Type` \u2014 making it available by its short name; or, quoted, other `.play` files by path or glob \u2014 `import \"Orders/**/*.play\"`, relative to this file's folder. Written inside a module or feature, a file import places the imported files there: their top level is that module's or feature's body.",concept:'A formalized value type wrapping a primitive. Attributes such as `@pii` travel with every usage, optionally with a `<attribute> reason "..."` line saying why.',type:"A composite value type \u2014 a named shape built from several properties, referenced by events, commands and other types the same way a concept is.",reason:'Records why a concept attribute applies \u2014 the purpose, the lawful basis, whose subject the value lives under. Written as `pii reason "..."` in the concept body.',optional:"Allows a value to be absent. Write it after the type: `note String optional` or `lines InvoiceLine[] optional`. The collection itself may be absent; its items keep their declared type.",identifier:"Marks the command property a runtime resolves the event source id from. At most one per command; without it a new Uuid is generated.",policy:"A named authorization rule referenced by commands and queries. Multiple policies AND together.",persona:"A named role interacting with the application, with an optional description and its associated policies.",authentication:"Declares the identity providers of the application \u2014 at most one block per file.",provider:"A named identity provider within `authentication`, with free-form `name value` settings.",description:"A human-readable description of a module, feature, slice, persona, or command \u2014 the first body line, as a quoted single line or a fenced ```text block for multiple lines.",module:"The top-level namespace \u2014 maps to a bounded context.",layout:"A reusable screen template with named slots.",template:"Declares the named slots of a layout.",feature:"A vertical slice grouping. Features nest arbitrarily deep.",slice:"The atomic unit of behavior, aligned with Event Modeling. Has a type and a name.",event:"An immutable, past-tense fact. Declare it in a slice or inline with `produces event <Name>` in a command. Inline properties are typed mappings; inline tags belong to the event type.",documentation:"Authoring-only event documentation in a fenced ```markdown block. It does not change executable model bytes.",id:"Preserves the previous persisted event name after a rename. Leave absent on new events; repeating the current name is redundant.",command:"An imperative intent. Declares authorization, validation, and what events it produces \u2014 declaratively, or via a full handler.",query:"A read-side entry point mapping to a return type, with an optional description, parameters and performer.",observable:"Qualifies a query return type as a live read \u2014 `query <Name> => observable <ReadModel>` keeps pushing as the read model changes, instead of answering once.",performer:"The code that performs a query \u2014 a `file <Path>` reference or an inline `csharp`/`sql` block. The query's counterpart to a command handler.",from:"Fills a query parameter from the query context instead of the caller, as in `filter tenantId TenantId from $context.tenant`.",projection:"Declares how events project into a read model, using the embedded Projection Declaration Language (PDL).",capture:"Converts external data into events, using the embedded Change Data Capture Language (CDL).",reaction:"Behavior that runs when something happens. Lives inside Automation slices. A trigger with no body states intent on its own \u2014 `file`/code is optional realization metadata.",trigger:"Declares a kind of occurrence a reaction can respond to, and the values it hands the reaction. What makes one occur belongs to whoever provides it, never to the compiler.",where:"Narrows which occurrences actually run the reaction.",contains:"Text comparison \u2014 true when the left string holds the right one anywhere.",every:"Runs a reaction on an interval \u2014 `every 15 minutes`, `every 1 day`.",invokes:"A command a reaction hands on. A command is asked for, not produced \u2014 it may still be rejected.",screen:"A UI declaration. Supports intent, structure, and layout-with-code levels, or a full file reference.",constraint:"A server-side rule enforced in the Chronicle kernel before events are committed.",authorize:"References the policies that must all pass for the construct to execute.",validate:"Declarative validation rules, or `validate` followed by ```csharp for imperative rules \u2014 on commands and concepts.",produces:"References a declared event with `produces <Name>`, or declares one inline with `produces event <Name>`. An inline omitted `for` uses the command identifier only when all destinations are the same source; legacy plain omission allocates an identity.",reads:"Declares a view consulted by a command or reaction trigger: `reads <View> [as <alias>] [by <value>]`. A reaction `by` names a value taken by its trigger; clock triggers cannot use `by`. Repeated views require unique aliases. Runtime binding is not yet supported for command or reaction reads.",as:"Names an instance of a view in a command or reaction trigger reads declaration, for example `reads Account as source by sourceId`.",handler:"A fully imperative command implementation \u2014 a `file <Path>` reference or an inline `csharp` block, instead of `produces`.",when:"Guards a produced event or a capture append with a condition.",rule:"Names a predicate. Bare, it states that a constraint exists without expressing what it computes \u2014 nothing resolves the name. Optionally followed by an indented `file <Path>` reference or inline `csharp` block giving it a body.",require:'A policy condition: `authenticated`, `role "..."`, or `claim "..." matches ...`.',authenticated:"Requires an authenticated caller.",role:"Requires the caller to have the given role.",claim:"Requires a claim on the caller to match a subject or value.",subject:"The subject (identity) of the caller.",data:"Binds a read model to a screen through a query.",action:"Makes a command available as an action on a screen.",navigate:"Navigates to a screen, optionally passing a parameter with `by`.",section:"A named structural section of a screen.",table:"A table widget over a read model or child collection.",summary:"A summary widget showing labeled fields.",column:"A table column bound to a property.",field:"A summary field bound to a property.",title:"The display title of a screen or section.",label:"The display label of an action, column, or field.",unique:"A uniqueness constraint \u2014 `unique <property> on <EventType>` or `unique event <EventType>`.",concurrency:"The concurrency scope enforced when the command appends events \u2014 dimensions: `eventSource`, `sourceType`, `streamType`, `streamId`, `events`.",eventSource:"Concurrency dimension \u2014 scope the check to the event source id of the command.",sourceType:"Concurrency dimension \u2014 scope the check to an event source type.",streamType:"Concurrency dimension \u2014 scope the check to an event stream type.",streamId:"Concurrency dimension \u2014 scope the check to an event stream id.",tag:"Attaches a tag to appended events \u2014 a static identifier or string, or a `$context.` expression resolved at append time.",seed:"Declares events to seed into the event store per event source id \u2014 multiple blocks accumulate.",for:"Names the event source of a production or seed group. Inside `produces event`, omission uses the command identifier unless another production targets a different source.",readmodel:"Read model state in a specification \u2014 `given readmodel` establishes it, `then readmodel` asserts it, `then no readmodel <View> for <key>` asserts keyed absence.",no:"A keyed absence assertion: `then no readmodel <View> for <key>`.",arguments:"The values supplied to a query asserted by `then query`.",result:"One expected result - `then result [exactly]` after `when query`, or a `result` block inside `then query`. Repeat it to assert several results in authored order.",clock:'The instant a specification happens at - `given clock "2026-10-05T08:00:00Z"` fixes when everything occurs; `when clock "<instant>"` is the clock reaching it, as the action.',exactly:"Requires every property to match, rather than only the ones asserted - on `then readmodel`, `then query` and `then result`.",file:"Delegates the implementation to an external file; the Screenplay contract stays visible.",by:"Introduces the identifying parameter.",via:"Connects screen data to the query that supplies it.",filter:"An optional query filter parameter.",on:"The event a constraint applies to, the day a schedule narrows to, or a widget interaction such as `on row-click`.",message:"The validation message reported when the rule fails.",matches:"Matches a value against a regular expression or a named pattern such as `email`.",all:"Applies a comparison to every element of a collection.",max:"Maximum length or value.",min:"Minimum length or value.",length:"Constrains the exact length of a value.",today:"The current date.",empty:"Used with `not empty` \u2014 the value must be present.",not:"Negates a validation condition, as in `not empty`.",and:"Both conditions must hold.",or:"Either condition may hold.",csharp:"An inline C# block whose opening fence is ```csharp.",sql:"An inline SQL block between triple backticks \u2014 a query performer written against a relational store.",typescript:"An inline TypeScript block between triple backticks.",react:"An inline React/TSX block; receives the surrounding data contract as `Props`.",html:"An inline static HTML block.",StateChange:"Slice type \u2014 a command \u2192 events flow; something that changes the system.",StateView:"Slice type \u2014 a query + projection + screen; something that reads the system.",Automation:"Slice type \u2014 a reaction or reducer; something that runs when something happens.",Translate:"Slice type \u2014 a capture; converts external data into events.",Uuid:"Primitive type \u2014 a universally unique identifier.",String:"Primitive type \u2014 a string of characters.",Int:"Primitive type \u2014 an integer number.",Decimal:"Primitive type \u2014 a decimal number.",Bool:"Primitive type \u2014 true or false.",Date:"Primitive type \u2014 a date without time.",DateTime:"Primitive type \u2014 a date and time.",Enum:"An enumeration concept with a fixed set of values."},ye={clock:oe.clock,trigger:"`when trigger <Trigger>` - an application trigger fires, as the action, with the values on the lines beneath it.",capture:"`given capture <Capture>` - a record the capture's source held before; `when capture <Capture>` - the record it sees now, as the action. The fields go on the lines beneath.",query:"`when query <Query>` - the query is performed, as the action, with its arguments on the lines beneath; assert what it returns with `then result` or `then no result`. `then query` instead asserts a query after another action.",result:"`then result [exactly]` - one result the query performed by `when query` returns, in order; `then no result` - it returns nothing."},Be={pii:'`@pii` \u2014 the value is personally identifiable information; Chronicle manages and erases it automatically wherever the concept is used. Add `pii reason "..."` in the concept body to record why.',sensitive:'`@sensitive` \u2014 the value is sensitive; Chronicle applies its sensitivity rules automatically wherever the concept is used. Add `sensitive reason "..."` in the concept body to record why.'},fe={"$context.occurred":"When the command or query was received.","$context.tenant":"The tenant the command or query is executing for.","$context.command":"The command being handled, shaped by its `command` declaration.","$context.arguments":"The arguments of the query being performed.","$context.causedBy":"The identity that caused the command or query \u2014 `subject`, `name`, `userName`.","$context.causedBy.subject":"The subject of the identity that caused the command or query.","$context.causedBy.name":"The display name of the identity that caused the command or query.","$context.causedBy.userName":"The user name of the identity that caused the command or query.","$context.causation":"What caused the command or query \u2014 `type`, `occurred`, `properties`.","$context.causation.type":"What caused the command or query \u2014 a command, a reactor, a schedule.","$context.identity":"The caller a decision is made about \u2014 `id`, `name`, `userName`, `isAuthenticated`, `roles`, `claims`.","$context.identity.id":"The identifier of the caller from the auth token.","$context.identity.name":"The display name of the caller.","$context.identity.userName":"The user name of the caller.","$context.identity.isAuthenticated":"Whether the caller is authenticated.","$context.identity.roles":"The roles the caller holds.","$context.identity.claims":"The claims the caller carries \u2014 `$context.identity.claims.<name>` reads one.",$env:"An environment variable, e.g. `$env.SERVICE_NAME`.",$secrets:"An encrypted secret resolved at runtime, e.g. `$secrets.azureAdClientId` \u2014 stays symbolic in the compiled tree.",$strings:"A localized string resolved from the `.strings` file of the active locale, e.g. `$strings.invoices.title`.",...Object.fromEntries(ee.map(e=>[`$eventContext.${e.path}`,e.description]))};function Ve(e,n,t,r,a,u){let p=E(e);if(p[n])return null;let o=e[n]??"";if(a-1>D(o).length)return null;let c=!1,i=!1;for(let d=0;d<r-1;d++)o[d]==="\\"&&c?d++:o[d]==='"'&&!i?c=!c:o[d]==="`"&&!c&&(i=!i);if(c||i)return null;let s=Ee(e,n,r,a,u);if(s)return s;let l=Pe(e,n,r,a,u);if(l)return l;let m=h((d,v)=>{let N=d+(o[d-1]==="@"?1:0);return t===v&&r===N&&a===N+v.length&&o.slice(N-1,a-1)===v},"tokenAt"),g=o.charAt(r-2);if(g==="@"){let d=Be[t];if(d)return d}if(g==="$"||g==="."){let d=o.substring(0,a-1).match(/\$[\w.]*$/)?.[0];if(d){let v=fe[d]??(d.startsWith("$env")?fe.$env:void 0);if(v)return v}}let y=o.slice(0,r-1),$=/^\s*(?:by|filter)\s+/.test(y)?/^\s*(?:by|filter)\s+[a-z_]\w*\s+[\w.]+(?:\[\])?\s+$/.test(y):/^\s*@?[a-z_]\w*\s+[\w.]+(?:\[\])?\s+$/.test(y),T=/^\s*query\s+\w+\s*=>\s*(?:observable\s+)?[\w.]+(?:\[\])?\s+$/.test(y)&&!/^\s*query\s+\w+\s*=>\s*observable\s+$/.test(y);if(t==="optional"&&($||T))return`**optional** \u2014 ${oe.optional}`;if(t==="implementation"||t==="hint"){let d=z(e,p,n,S(o)),v=de(e,n,S(o));if(t==="implementation"&&v==="rule"&&/^\s*implementation\s*$/.test(D(o))||t==="hint"&&v==="implementation"&&/^\s*hint\s+"/.test(o))return`**${t}** \u2014 Command named-rule guidance with at most one file or tagged fence. No payload means pending and fails binding (PLAY0268). Attached predicates keep their existing pure RuleContext contract; reference execution is unsupported, never confirmation.`;if(t==="implementation"&&d[0]==="handler"&&/^\s*implementation\s*$/.test(D(o)))return`**implementation** \u2014 ${Fe.implementation}`;if(t==="hint"&&d[0]==="implementation"&&d[1]==="handler"&&/^\s*hint\s+"/.test(o))return`**hint** \u2014 ${Fe.hint}`}let w=U(e),x=w.commands.filter(d=>d.line<n).at(-1),f=x?.properties.find(d=>d.name===t&&d.line===n);if(f?.isGenerated||t==="generated"&&x?.properties.some(d=>d.isGenerated&&d.line===n)&&$)return`**${f?.name??"generated"}** \u2014 ${f?C(F(f))+". ":""}Generated value, not a request or form input. ${L}`;let b=x?.response;if(b?.location.line===n+1&&(m(b.location.column,"returns")||b.kind==="ScalarCommandResponseSyntax"&&m(b.source.location.column,b.source.property))){let d=b.kind==="ScalarCommandResponseSyntax"?x?.properties.find(v=>v.name===b.source.property):void 0;return`**returns**${d?` \u2014 ${C(F(d))}`:" \u2014 unnamed record response"}. ${L}`}if(b?.kind==="RecordCommandResponseSyntax"){let d=b.fields.find(v=>v.location.line===n+1&&(m(v.location.column,v.name)||m(v.source.location.column,v.source.property)));if(d){let v=x?.properties.find(Z=>Z.name===d.source.property),N=d.type?C(d.type):v?C(F(v)):"Unresolved type";return`**${d.name}** \u2014 ${N}${d.type?" (explicit)":" (inferred)"} = ${d.source.property}. ${v?.isGenerated?"Generated source, not request input. ":""}${L}`}}for(let d of q(e).specifications.values())if(t==="returns"&&d.thenReturns?.location.line===n+1||t==="generated"&&d.when?.generatedValues?.some(v=>v.location.line===n+1))return L;let k=w.concepts.find(d=>d.name===t);if(k){let d=k.attributes.length?` ${k.attributes.join(" ")}`:"",v=k.enumValues.length?`
48
+ `))??[],a?.authoringPlacement,a?.authoringPath,a?.authoringPlacementResolved),y=l.path.slice(0,r-l.location.column).split("."),$=o.command.properties,T=!1,w=!1;for(let[x,f]of y.entries()){let b=$.filter(I=>I.name===f);if(b.length!==1)break;let k=b[0];if(T||=k.type.isOptional,w||=k.type.isCollection,x===y.length-1)return`**${f}** \u2014 ${C({...k.type,isOptional:T,isCollection:w})}. Command source for authored stream id. ${O}`;let A=m.operations.types.filter(I=>I.name===k.type.name);if(A.length!==1||w)break;$=A[0].properties.map(I=>({...I,isIdentifier:!1}))}}}if(o?.source&&/^\s*id\s+"/.test(D(e[n]??""))&&t===S(e[n])+1&&r===t+2)return`Stored-name pin: rename-only metadata, not a semantic identity or an automatic refactor. ${O}`;let i=o?.stream?.streamId??o?.source?.identifier;return i&&i.location?.line===n+1&&t>=i.location.column&&r<=i.location.column+i.name.length?`${C(i)} \u2014 authored ${o?.stream?"stream id":"identifier"} type. ${O}`:null}h(Pe,"eventSourceHover");function Ne(e,n,t,r){if(P(e)[n]||D(t).length<t.length||/[\uD800-\uDFFF]/.test(t))return null;let a=me(e,r),u=a.contexts.get(n),d=t.trim()?S(e[n]):t.length;if(u?.command&&d>S(e[u.command.location.line-1])&&(!u.route||d<=S(e[u.route.location.line-1]))&&Tn.test(t)){let o=q(e,r.authoringDocuments??r.authoringSources?.filter(s=>s!==e.join(`
49
+ `))??[],r.authoringPlacement,r.authoringPath),c=new Set([...o.operations.concepts,...o.operations.types].map(s=>s.name)),i=t.trim().split(/\s+/)[1]??"";return a.targets.filter(s=>ie(s.source.name)&&ie(s.stream.name)&&!c.has(s.name)&&(!i.includes(".")||s.name.startsWith(i.slice(0,i.lastIndexOf(".")+1)))).map(s=>({label:s.name,insertText:i.includes(".")?s.stream.name:s.name,documentation:le(s.source,s.stream)}))}if(u?.route&&u.command&&d>S(e[u.route.location.line-1])&&Ot.test(t)){let o=a.resolve(u.route.eventSource,u.route.stream).stream?.streamId;if(!o)return[];let c=q(e,r.authoringDocuments??r.authoringSources?.filter(g=>g!==e.join(`
50
+ `))??[],r.authoringPlacement,r.authoringPath),i=c.operations.concepts.filter(g=>g.name===o.name);if(!(["String","Uuid"].includes(o.name)||i.length===1&&["String","Uuid","Int"].includes(i[0].type)&&i[0].values.length===0)||o.isOptional||o.isCollection)return[];let l=Ot.exec(t)[1].split("."),m=u.command.properties;for(let g of l.slice(0,-1)){let y=m.filter(T=>T.name===g);if(y.length!==1||y[0].type.isOptional||y[0].type.isCollection)return[];let $=c.operations.types.filter(T=>T.name===y[0].type.name);if($.length!==1)return[];m=$[0].properties.map(T=>({...T,isIdentifier:!1}))}return m.filter(g=>ie(g.name)&&g.type.name===o.name&&!g.type.isOptional&&!g.type.isCollection).map(g=>({label:g.name,insertText:g.name,documentation:`${C(g.type)} \u2014 command source for authored stream id. ${O}`}))}if(u?.source&&d>S(e[u.source.location.line-1])){let o=u.stream&&d>S(e[u.stream.location.line-1]);if((o?Cn:kn).test(t)){let c=q(e,r.authoringDocuments??[],r.authoringPlacement,r.authoringPath),i=/^\s*streamId\b/.test(t);return[...i?["String","Uuid"]:["String","Uuid","Int","Decimal","Bool","Date","DateTime"],...c.operations.concepts.filter(s=>!i||["String","Uuid","Int"].includes(s.type)&&s.values.length===0).map(s=>s.name)].filter(tt).map(s=>({label:s,insertText:s,documentation:O}))}if(/^\s*$/.test(t))return o?[{label:"streamId",insertText:"streamId ${1:Type}",documentation:O},{label:"description",insertText:'description "${1:Description}"',documentation:"Authored description."}]:[{label:"identifier",insertText:"identifier ${1:Type}",documentation:O},{label:"stream",insertText:"stream ${1:Name}",documentation:O},{label:"description",insertText:'description "${1:Description}"',documentation:"Authored description."}]}return null}h(Ne,"eventSourceCompletions");var Sn=new RegExp(`^[${G}.]+\\s+rule\\s+[A-Za-z_][${G}]*(?:\\s+severity\\s+(?:information|warning|error))?(?:\\s+message\\s+.*)?$`);function pe(e,n,t){let r=P(e),a=[],u=t;for(let c=n-1;c>=0&&u>0;c--){if(r[c])continue;let i=D(e[c]).trimEnd();i.trim().length===0||S(i)>=u||(a.push(i.trim()),u=S(i))}let d=a[0]==="implementation",o=d?1:0;return Sn.test(a[o]??"")&&a[o+1]==="validate"&&/^command\s/.test(a[o+2]??"")?d?"implementation":"rule":null}h(pe,"namedRuleContext");var Re=new Map,jt=new Set;function he(e,n){Re.set(e,{keyword:e,...n}),jt.forEach(t=>t())}h(he,"registerSubLanguage");function Me(){return[...Re.values()]}h(Me,"getSubLanguages");function _(e){return Re.get(e)}h(_,"getSubLanguage");function zt(e){jt.add(e)}h(zt,"onSubLanguagesChanged");var Dn=/(?:^|\s)rule\s+[A-Za-z_]\w*(?:\s+severity\s+(?:information|warning|error))?(?:\s+message\s+.*)?$/;function Ft(e){let n=e[0];if(n===void 0)return ut;let t=_(n);if(t)return t.completions??[];switch(n){case"module":return ht;case"feature":return yt;case"slice":return ft;case"concept":return dt;case"type":return pt;case"command":return gt;case"event":return Se;case"system":return Q.filter(r=>r.label==="description");case"operation":return Q;case"execute":case"compensate":return se;case"produces":return K;case"handler":return vt;case"implementation":return e[1]==="handler"?$t:["execute","compensate"].includes(e[1])?te:[];case"query":return xt;case"performer":return wt;case"constraint":return Tt;case"reaction":return kt;case"trigger":return St;case"when":case"every":case"at":return e.includes("reaction")?Ct:[];case"specification":return Dt;case"policy":return qt;case"validate":return Lt;case"action":return Pt;case"table":case"summary":return Nt;default:return e.includes("screen")||n==="section"||n==="layout"?Et:e.includes("produces")?K:[]}}h(Ft,"completionEntriesFor");function Oe(e,n,t){let r=P(e);if(r[n]||D(t).length<t.length)return{kind:"none"};let a=ne(e,n,t,H(e));if(a!==null)return{kind:"entries",entries:a};let u=t.match(/^\s*import\s+"([^"]*)$/);if(u)return{kind:"playFiles",replaceLength:u[1].length};if(/["/]$/.test(t))return{kind:"none"};let d=t.match(/\$[\w.]*$/);if(d)return{kind:"contextVariables",replaceLength:d[0].length};let o=e[n]??"",c=t.trim().length===0?t.length:S(o),i=z(e,r,n,c),s=pe(e,n,c);if(s==="implementation")return{kind:"entries",entries:Ae};if(s==="rule")return{kind:"entries",entries:At};let l=["event","command","type","readmodel","trigger","when","every","at"].includes(i[0])||i[0]==="produces"&&/^produces\s+event\b/.test(U(e,r,n,c)??""),m=t.trimStart().split(/\s+/)[0],g=i[0]==="command"&&["reads","authorize","produces"].includes(m)||i[0]==="event"&&m==="tag"||["trigger","when","every","at"].includes(i[0])&&["description","file","reads","produces","invokes"].includes(m),y=h(x=>x!==null&&"optional".startsWith(x[1]),"optionalPrefix"),$=l&&!g&&y(t.match(/^\s*@?[a-z_]\w*\s+[\w.]+(?:\[\])?\s+(\w*)$/)),T=i[0]==="query"&&y(t.match(/^\s*(?:by|filter)\s+[a-z_]\w*\s+[\w.]+(?:\[\])?\s+(\w*)$/))||y(t.match(/^\s*query\s+[A-Za-z_]\w*\s*=>\s*(?:observable\s+)?[\w.]+(?:\[\])?\s+(\w*)$/));if(($||T)&&!/=>\s*observable\s+$/.test(t))return{kind:"entries",entries:ae};if(/\bauthorize\s+[\w\s]*$/.test(t)||i[0]==="authorize")return{kind:"policies"};if(/\bwhen\s+\w*$/.test(t)&&i.includes("reaction"))return{kind:"triggers"};if(/\bon\s+\w*$/.test(t)&&i.includes("constraint"))return{kind:"events"};if(/\binvokes\s+\w*$/.test(t)&&i.includes("reaction"))return{kind:"commands"};if(/\b(?:on|unique\s+event)\s+\w*$/.test(t)&&i[0]==="constraint")return{kind:"events"};if(/\bproduces\s+\w*$/.test(t))return{kind:"producesTargets"};if(/\bnavigate\s+to\s+\w*$/.test(t))return{kind:"screens"};if(i[0]==="specification"){if(/^\s*when\s+query\s+[\w.]*$/.test(t))return{kind:"queries"};let x=t.match(/^\s*(given|when|then)\s+\w*$/);if(x)return{kind:"entries",entries:De[x[1]]}}if(/\b(?:via|then)\s+query\s+[\w.]*$/.test(t))return{kind:"queries"};if((i[0]==="event"||i[0]==="command"||i[0]==="type")&&/^\s+[a-z_]\w*\s+[\w[\]?]*$/.test(t))return{kind:"types"};if(i[0]==="query"&&/^\s+(?:by|filter)\s+[a-z_]\w*\s+[\w[\]?]*$/.test(t))return{kind:"types"};let w=U(e,r,n,c);return w&&/^produces\s+operation\b/.test(w)?{kind:"entries",entries:Q}:w&&/^produces\s+event\b/.test(w)?/^\s+@?[a-z_]\w*\s+[\w[\]?]*$/.test(t)?{kind:"types"}:{kind:"entries",entries:bt}:w&&Dn.test(w)?{kind:"entries",entries:It}:{kind:"entries",entries:Ft(i)}}h(Oe,"planCompletions");function Bt(e,n={}){return{triggerCharacters:[" ","$","@",".",'"',"/"],provideCompletionItems(t,r){let a=t.getLinesContent(),u=r.lineNumber-1,o=(a[u]??"").substring(0,r.column-1),c=n.application?.(t),i=V(a,c),s=Ne(a,u,o,i)??Le(a,u,o,i)??ne(a,u,o,i),l=s===null?Oe(a,u,o):{kind:"entries",entries:s};if(l.kind==="none")return{suggestions:[]};let m=t.getWordUntilPosition(r),g=new e.Range(r.lineNumber,m.startColumn,r.lineNumber,m.endColumn),y=e.languages.CompletionItemKind,$=e.languages.CompletionItemInsertTextRule.InsertAsSnippet,T=h(f=>({label:f.label,kind:f.insertText.includes("$")?y.Snippet:y.Keyword,insertText:f.insertText,insertTextRules:$,documentation:f.documentation,range:g}),"snippet"),w=h((f,b,k)=>({label:f,kind:b,insertText:f,detail:k,range:g}),"symbolItem"),x=h(()=>{let f=new Set(i.events.filter(b=>b.inline).map(b=>b.name));return[...new Set(xe(i))].map(b=>w(b,y.Event,f.has(b)?"inline event":"event"))},"eventNames");switch(l.kind){case"playFiles":{let f=new e.Range(r.lineNumber,r.column-l.replaceLength,r.lineNumber,r.column);return{suggestions:(n.playFiles?.(t)??[]).map(b=>({label:b,kind:b.includes("*")?y.Folder:y.File,insertText:b,range:f}))}}case"contextVariables":{let f=new e.Range(r.lineNumber,r.column-l.replaceLength,r.lineNumber,m.endColumn);return{suggestions:Ie.map(b=>({...T(b),range:f}))}}case"policies":return{suggestions:i.policies.map(f=>w(f.name,y.Reference,"policy"))};case"events":return{suggestions:x()};case"triggers":return{suggestions:[...new Set(we(i))].map(f=>w(f,y.Event,"trigger"))};case"commands":return{suggestions:i.commands.map(f=>w(f.name,y.Method,"command"))};case"producesTargets":return{suggestions:[...K.map(T),...x()]};case"screens":return{suggestions:i.screens.map(f=>w(f.name,y.Interface,"screen"))};case"queries":return{suggestions:i.queries.map(f=>w(f.name,y.Function,`query => ${C(f.returnTypeReference??ve(f.returnType))}`))};case"types":return{suggestions:[...i.concepts.map(f=>w(f.name,y.Class,`concept : ${f.primitive}${f.attributes.length?" "+f.attributes.join(" "):""}`)),...i.types.map(f=>w(f.name,y.Struct,`type (${f.properties.length} properties)`)),...W.map(f=>w(f,y.Struct,"primitive"))]};case"entries":return{suggestions:l.entries.map(T)}}}}}h(Bt,"createCompletionProvider");var je=["keyword","property","type"];function ze(e,n){let t=[],r=h((o,c,i,s)=>{let l=e[o-1];if(l===void 0||c<1||i<1)return;let m=c-1+(l[c-1]==="@"?1:0);m+i<=l.length&&t.push({line:o-1,column:m,length:i,type:s})},"add"),a=n?.authoringPath??"current.play",u=q(e,n?.authoringDocuments??n?.authoringSources?.filter(o=>o!==e.join(`
51
+ `))??[],n?.authoringPlacement,a,n?.authoringPlacementResolved);for(let o of u.eventSources.declarations.filter(c=>c.location.path===a)){r(o.location.line,o.location.column,11,0),o.identifier&&r(o.identifier.location.line,o.identifier.location.column,o.identifier.name.length,2);for(let c of o.streams)r(c.location.line,c.location.column,6,0),c.streamId&&r(c.streamId.location.line,c.streamId.location.column,c.streamId.name.length,2)}for(let o of u.eventSources.routes)r(o.location.line,o.location.column,6,0),o.referenceLocation&&r(o.referenceLocation.line,o.referenceLocation.column,`${o.eventSource}.${o.stream}`.length,2),o.streamId&&r(o.streamId.location.line,o.streamId.location.column,8,0);for(let o of u.commands.values()){for(let i of o.properties){if(!i.isGenerated)continue;let s=D(e[i.location.line-1]??"");r(i.location.line,s.lastIndexOf("generated")+1,9,0)}let c=o.response;if(c)if(r(c.location.line,c.location.column,7,0),c.kind==="ScalarCommandResponseSyntax")r(c.source.location.line,c.source.location.column,c.source.property.length,1);else for(let i of c.fields)r(i.location.line,i.location.column,i.name.length,1),r(i.source.location.line,i.source.location.column,i.source.property.length,1),i.type&&r(i.type.location.line,i.type.location.column,i.type.name.length,2)}for(let o of u.specifications.values()){for(let c of o.when?.generatedValues??[])r(c.location.line,c.location.column,9,0);o.thenReturns&&r(o.thenReturns.location.line,(e[o.thenReturns.location.line-1]??"").indexOf("returns")+1,7,0)}for(let o of u.operations.systems.filter(c=>c.location.path===a))r(o.location.line,o.location.column,6,0);for(let o of u.operations.declarations.filter(c=>c.location.path===a)){let i=D(e[o.location.line-1]??"").indexOf("operation",o.location.column-1);i>=0&&r(o.location.line,i+1,9,0);for(let s of o.inputs)r(s.location.line,s.location.column,s.name.length,1),r(s.type.location.line,s.type.location.column,s.type.name.length,2);o.usesLocation&&r(o.usesLocation.line,(e[o.usesLocation.line-1]??"").indexOf("uses")+1,4,0);for(let s of[o.execute,o.compensate]){if(!s)continue;let l=D(e[s.location.line-1]??"").trim();r(s.location.line,s.location.column,l.length,0),s.implementation&&r(s.implementation.location.line,s.implementation.location.column,14,0);for(let m of s.implementation?.hints??[])r(m.location.line,m.location.column,4,0)}}let d=t.sort((o,c)=>o.line-c.line||o.column-c.column);return d.filter((o,c)=>c===0||o.line!==d[c-1].line||o.column>=d[c-1].column+d[c-1].length)}h(ze,"responseTokens");var Fe={implementation:"Handler-only intent with ordered hints and at most one file or tagged fence. No payload means pending. Handler execution is unsupported; this is not confirmation.",hint:"One nonblank quoted implementation hint. Order and decoded text are retained; hints do not execute or confirm code."},oe={domain:"The domain the file belongs to \u2014 optional, at most one per file, before everything else.",import:"Imports a type from another module by its qualified name \u2014 `import Module.Type` \u2014 making it available by its short name; or, quoted, other `.play` files by path or glob \u2014 `import \"Orders/**/*.play\"`, relative to this file's folder. Written inside a module or feature, a file import places the imported files there: their top level is that module's or feature's body.",concept:'A formalized value type wrapping a primitive. Attributes such as `@pii` travel with every usage, optionally with a `<attribute> reason "..."` line saying why.',type:"A composite value type \u2014 a named shape built from several properties, referenced by events, commands and other types the same way a concept is.",reason:'Records why a concept attribute applies \u2014 the purpose, the lawful basis, whose subject the value lives under. Written as `pii reason "..."` in the concept body.',optional:"Allows a value to be absent. Write it after the type: `note String optional` or `lines InvoiceLine[] optional`. The collection itself may be absent; its items keep their declared type.",identifier:"Marks the command property a runtime resolves the event source id from. At most one per command; without it a new Uuid is generated.",policy:"A named authorization rule referenced by commands and queries. Multiple policies AND together.",persona:"A named role interacting with the application, with an optional description and its associated policies.",authentication:"Declares the identity providers of the application \u2014 at most one block per file.",provider:"A named identity provider within `authentication`, with free-form `name value` settings.",description:"A human-readable description of a module, feature, slice, persona, or command \u2014 the first body line, as a quoted single line or a fenced ```text block for multiple lines.",module:"The top-level namespace \u2014 maps to a bounded context.",layout:"A reusable screen template with named slots.",template:"Declares the named slots of a layout.",feature:"A vertical slice grouping. Features nest arbitrarily deep.",slice:"The atomic unit of behavior, aligned with Event Modeling. Has a type and a name.",event:"An immutable, past-tense fact. Declare it in a slice or inline with `produces event <Name>` in a command. Inline properties are typed mappings; inline tags belong to the event type.",documentation:"Authoring-only event documentation in a fenced ```markdown block. It does not change executable model bytes.",id:"Preserves the previous persisted event name after a rename. Leave absent on new events; repeating the current name is redundant.",command:"An imperative intent. Declares authorization, validation, and what events it produces \u2014 declaratively, or via a full handler.",query:"A read-side entry point mapping to a return type, with an optional description, parameters and performer.",observable:"Qualifies a query return type as a live read \u2014 `query <Name> => observable <ReadModel>` keeps pushing as the read model changes, instead of answering once.",performer:"The code that performs a query \u2014 a `file <Path>` reference or an inline `csharp`/`sql` block. The query's counterpart to a command handler.",from:"Fills a query parameter from the query context instead of the caller, as in `filter tenantId TenantId from $context.tenant`.",projection:"Declares how events project into a read model, using the embedded Projection Declaration Language (PDL).",capture:"Converts external data into events, using the embedded Change Data Capture Language (CDL).",reaction:"Behavior that runs when something happens. Lives inside Automation slices. A trigger with no body states intent on its own \u2014 `file`/code is optional realization metadata.",trigger:"Declares a kind of occurrence a reaction can respond to, and the values it hands the reaction. What makes one occur belongs to whoever provides it, never to the compiler.",where:"Narrows which occurrences actually run the reaction.",contains:"Text comparison \u2014 true when the left string holds the right one anywhere.",every:"Runs a reaction on an interval \u2014 `every 15 minutes`, `every 1 day`.",invokes:"A command a reaction hands on. A command is asked for, not produced \u2014 it may still be rejected.",screen:"A UI declaration. Supports intent, structure, and layout-with-code levels, or a full file reference.",constraint:"A server-side rule enforced in the Chronicle kernel before events are committed.",authorize:"References the policies that must all pass for the construct to execute.",validate:"Declarative validation rules, or `validate` followed by ```csharp for imperative rules \u2014 on commands and concepts.",produces:"References a declared event with `produces <Name>`, or declares one inline with `produces event <Name>`. An inline omitted `for` uses the command identifier only when all destinations are the same source; legacy plain omission allocates an identity.",reads:"Declares a view consulted by a command or reaction trigger: `reads <View> [as <alias>] [by <value>]`. A reaction `by` names a value taken by its trigger; clock triggers cannot use `by`. Repeated views require unique aliases. Runtime binding is not yet supported for command or reaction reads.",as:"Names an instance of a view in a command or reaction trigger reads declaration, for example `reads Account as source by sourceId`.",handler:"A fully imperative command implementation \u2014 a `file <Path>` reference or an inline `csharp` block, instead of `produces`.",when:"Guards a produced event or a capture append with a condition.",rule:"Names a predicate. Bare, it states that a constraint exists without expressing what it computes \u2014 nothing resolves the name. Optionally followed by an indented `file <Path>` reference or inline `csharp` block giving it a body.",require:'A policy condition: `authenticated`, `role "..."`, or `claim "..." matches ...`.',authenticated:"Requires an authenticated caller.",role:"Requires the caller to have the given role.",claim:"Requires a claim on the caller to match a subject or value.",subject:"The subject (identity) of the caller.",data:"Binds a read model to a screen through a query.",action:"Makes a command available as an action on a screen.",navigate:"Navigates to a screen, optionally passing a parameter with `by`.",section:"A named structural section of a screen.",table:"A table widget over a read model or child collection.",summary:"A summary widget showing labeled fields.",column:"A table column bound to a property.",field:"A summary field bound to a property.",title:"The display title of a screen or section.",label:"The display label of an action, column, or field.",unique:"A uniqueness constraint \u2014 `unique <property> on <EventType>` or `unique event <EventType>`.",concurrency:"The concurrency scope enforced when the command appends events \u2014 dimensions: `eventSource`, `sourceType`, `streamType`, `streamId`, `events`.",eventSource:"Concurrency dimension \u2014 scope the check to the event source id of the command.",sourceType:"Concurrency dimension \u2014 scope the check to an event source type.",streamType:"Concurrency dimension \u2014 scope the check to an event stream type.",streamId:"Concurrency dimension \u2014 scope the check to an event stream id.",tag:"Attaches a tag to appended events \u2014 a static identifier or string, or a `$context.` expression resolved at append time.",seed:"Declares events to seed into the event store per event source id \u2014 multiple blocks accumulate.",for:"Names the event source of a production or seed group. Inside `produces event`, omission uses the command identifier unless another production targets a different source.",readmodel:"Declares a read model \u2014 its name and properties \u2014 in a slice, or, in a specification, read model state: `given readmodel` establishes it, `then readmodel` asserts it, `then no readmodel <View> for <key>` asserts keyed absence.",reducer:"Builds a read model from events with imperative code \u2014 `reducer <Name> => <ReadModel>` with an `on <EventType>` rule per event. Use it when a projection cannot express the transition.",specification:"Given/when/then acceptance criteria for a slice: prior events and state, the command, query or appended event under test, and the events, state, results, errors or denials that follow.",dialog:"A dialog opened over the shell, or with `dialog template` a reusable dialog shape.",form:"A form bound to a command \u2014 `form <Name> for <Command>` with a `field` per input.",contribute:"Contributes entries to a slot of the shell \u2014 `contribute to Navigation` with `navigate to`, `label` and `order`.",theme:"A named theme and the component packages it is compatible with.",ui:"A UI profile \u2014 `ui profile <Name>` binds a target platform and size to a layout, theme and packages.",behavior:"A named interaction wiring of `on <interaction>` handlers, attached to a screen, form or dialog with `uses`.",system:"An application-scoped external system that operations use.",eventsource:"An application-owned event source with nested streams.",operation:"A reusable operation intent that uses one external system.",no:"A keyed absence assertion: `then no readmodel <View> for <key>`.",arguments:"The values supplied to a query asserted by `then query`.",result:"One expected result - `then result [exactly]` after `when query`, or a `result` block inside `then query`. Repeat it to assert several results in authored order.",clock:'The instant a specification happens at - `given clock "2026-10-05T08:00:00Z"` fixes when everything occurs; `when clock "<instant>"` is the clock reaching it, as the action.',exactly:"Requires every property to match, rather than only the ones asserted - on `then readmodel`, `then query` and `then result`.",file:"Delegates the implementation to an external file; the Screenplay contract stays visible.",by:"Introduces the identifying parameter.",via:"Connects screen data to the query that supplies it.",filter:"An optional query filter parameter.",on:"The event a constraint applies to, the day a schedule narrows to, or a widget interaction such as `on row-click`.",message:"The validation message reported when the rule fails.",matches:"Matches a value against a regular expression or a named pattern such as `email`.",all:"Applies a comparison to every element of a collection.",max:"Maximum length or value.",min:"Minimum length or value.",length:"Constrains the exact length of a value.",today:"The current date.",empty:"Used with `not empty` \u2014 the value must be present.",not:"Negates a validation condition, as in `not empty`.",and:"Both conditions must hold.",or:"Either condition may hold.",csharp:"An inline C# block whose opening fence is ```csharp.",sql:"An inline SQL block between triple backticks \u2014 a query performer written against a relational store.",typescript:"An inline TypeScript block between triple backticks.",react:"An inline React/TSX block; receives the surrounding data contract as `Props`.",html:"An inline static HTML block.",StateChange:"Slice type \u2014 a command \u2192 events flow; something that changes the system.",StateView:"Slice type \u2014 a query + projection + screen; something that reads the system.",Automation:"Slice type \u2014 a reaction or reducer; something that runs when something happens.",Translate:"Slice type \u2014 a capture; converts external data into events.",Uuid:"Primitive type \u2014 a universally unique identifier.",String:"Primitive type \u2014 a string of characters.",Int:"Primitive type \u2014 an integer number.",Decimal:"Primitive type \u2014 a decimal number.",Bool:"Primitive type \u2014 true or false.",Date:"Primitive type \u2014 a date without time.",DateTime:"Primitive type \u2014 a date and time.",Enum:"An enumeration concept with a fixed set of values."},ye={clock:oe.clock,trigger:"`when trigger <Trigger>` - an application trigger fires, as the action, with the values on the lines beneath it.",capture:"`given capture <Capture>` - a record the capture's source held before; `when capture <Capture>` - the record it sees now, as the action. The fields go on the lines beneath.",query:"`when query <Query>` - the query is performed, as the action, with its arguments on the lines beneath; assert what it returns with `then result` or `then no result`. `then query` instead asserts a query after another action.",result:"`then result [exactly]` - one result the query performed by `when query` returns, in order; `then no result` - it returns nothing."},Be={pii:'`@pii` \u2014 the value is personally identifiable information; Chronicle manages and erases it automatically wherever the concept is used. Add `pii reason "..."` in the concept body to record why.',sensitive:'`@sensitive` \u2014 the value is sensitive; Chronicle applies its sensitivity rules automatically wherever the concept is used. Add `sensitive reason "..."` in the concept body to record why.'},fe={"$context.occurred":"When the command or query was received.","$context.tenant":"The tenant the command or query is executing for.","$context.command":"The command being handled, shaped by its `command` declaration.","$context.arguments":"The arguments of the query being performed.","$context.causedBy":"The identity that caused the command or query \u2014 `subject`, `name`, `userName`.","$context.causedBy.subject":"The subject of the identity that caused the command or query.","$context.causedBy.name":"The display name of the identity that caused the command or query.","$context.causedBy.userName":"The user name of the identity that caused the command or query.","$context.causation":"What caused the command or query \u2014 `type`, `occurred`, `properties`.","$context.causation.type":"What caused the command or query \u2014 a command, a reactor, a schedule.","$context.identity":"The caller a decision is made about \u2014 `id`, `name`, `userName`, `isAuthenticated`, `roles`, `claims`.","$context.identity.id":"The identifier of the caller from the auth token.","$context.identity.name":"The display name of the caller.","$context.identity.userName":"The user name of the caller.","$context.identity.isAuthenticated":"Whether the caller is authenticated.","$context.identity.roles":"The roles the caller holds.","$context.identity.claims":"The claims the caller carries \u2014 `$context.identity.claims.<name>` reads one.",$env:"An environment variable, e.g. `$env.SERVICE_NAME`.",$secrets:"An encrypted secret resolved at runtime, e.g. `$secrets.azureAdClientId` \u2014 stays symbolic in the compiled tree.",$strings:"A localized string resolved from the `.strings` file of the active locale, e.g. `$strings.invoices.title`.",...Object.fromEntries(ee.map(e=>[`$eventContext.${e.path}`,e.description]))};function Ve(e,n,t,r,a,u){let d=P(e);if(d[n])return null;let o=e[n]??"";if(a-1>D(o).length)return null;let c=!1,i=!1;for(let p=0;p<r-1;p++)o[p]==="\\"&&c?p++:o[p]==='"'&&!i?c=!c:o[p]==="`"&&!c&&(i=!i);if(c||i)return null;let s=Pe(e,n,r,a,u);if(s)return s;let l=Ee(e,n,r,a,u);if(l)return l;let m=h((p,v)=>{let R=p+(o[p-1]==="@"?1:0);return t===v&&r===R&&a===R+v.length&&o.slice(R-1,a-1)===v},"tokenAt"),g=o.charAt(r-2);if(g==="@"){let p=Be[t];if(p)return p}if(g==="$"||g==="."){let p=o.substring(0,a-1).match(/\$[\w.]*$/)?.[0];if(p){let v=fe[p]??(p.startsWith("$env")?fe.$env:void 0);if(v)return v}}let y=o.slice(0,r-1),$=/^\s*(?:by|filter)\s+/.test(y)?/^\s*(?:by|filter)\s+[a-z_]\w*\s+[\w.]+(?:\[\])?\s+$/.test(y):/^\s*@?[a-z_]\w*\s+[\w.]+(?:\[\])?\s+$/.test(y),T=/^\s*query\s+\w+\s*=>\s*(?:observable\s+)?[\w.]+(?:\[\])?\s+$/.test(y)&&!/^\s*query\s+\w+\s*=>\s*observable\s+$/.test(y);if(t==="optional"&&($||T))return`**optional** \u2014 ${oe.optional}`;if(t==="implementation"||t==="hint"){let p=z(e,d,n,S(o)),v=pe(e,n,S(o));if(t==="implementation"&&v==="rule"&&/^\s*implementation\s*$/.test(D(o))||t==="hint"&&v==="implementation"&&/^\s*hint\s+"/.test(o))return`**${t}** \u2014 Command named-rule guidance with at most one file or tagged fence. No payload means pending and fails binding (PLAY0268). Attached predicates keep their existing pure RuleContext contract; reference execution is unsupported, never confirmation.`;if(t==="implementation"&&p[0]==="handler"&&/^\s*implementation\s*$/.test(D(o)))return`**implementation** \u2014 ${Fe.implementation}`;if(t==="hint"&&p[0]==="implementation"&&p[1]==="handler"&&/^\s*hint\s+"/.test(o))return`**hint** \u2014 ${Fe.hint}`}let w=H(e),x=w.commands.filter(p=>p.line<n).at(-1),f=x?.properties.find(p=>p.name===t&&p.line===n);if(f?.isGenerated||t==="generated"&&x?.properties.some(p=>p.isGenerated&&p.line===n)&&$)return`**${f?.name??"generated"}** \u2014 ${f?C(F(f))+". ":""}Generated value, not a request or form input. ${L}`;let b=x?.response;if(b?.location.line===n+1&&(m(b.location.column,"returns")||b.kind==="ScalarCommandResponseSyntax"&&m(b.source.location.column,b.source.property))){let p=b.kind==="ScalarCommandResponseSyntax"?x?.properties.find(v=>v.name===b.source.property):void 0;return`**returns**${p?` \u2014 ${C(F(p))}`:" \u2014 unnamed record response"}. ${L}`}if(b?.kind==="RecordCommandResponseSyntax"){let p=b.fields.find(v=>v.location.line===n+1&&(m(v.location.column,v.name)||m(v.source.location.column,v.source.property)));if(p){let v=x?.properties.find(Z=>Z.name===p.source.property),R=p.type?C(p.type):v?C(F(v)):"Unresolved type";return`**${p.name}** \u2014 ${R}${p.type?" (explicit)":" (inferred)"} = ${p.source.property}. ${v?.isGenerated?"Generated source, not request input. ":""}${L}`}}for(let p of q(e).specifications.values())if(t==="returns"&&p.thenReturns?.location.line===n+1||t==="generated"&&p.when?.generatedValues?.some(v=>v.location.line===n+1))return L;let k=w.concepts.find(p=>p.name===t);if(k){let p=k.attributes.length?` ${k.attributes.join(" ")}`:"",v=k.enumValues.length?`
52
52
 
53
- Values: ${k.enumValues.join(", ")}`:"",N=Object.entries(k.attributeReasons).map(([Z,Kt])=>`
53
+ Values: ${k.enumValues.join(", ")}`:"",R=Object.entries(k.attributeReasons).map(([Z,Kt])=>`
54
54
 
55
55
  **@${Z}** \u2014 ${Kt}`).join("");return`\`\`\`screenplay
56
- concept ${k.name} : ${k.primitive}${d}
57
- \`\`\`${N}${v}`}let A=w.types.find(d=>d.name===t);if(A){let d=A.properties.map(v=>`${v.name} ${C(F(v))}`).join(`
56
+ concept ${k.name} : ${k.primitive}${p}
57
+ \`\`\`${R}${v}`}let A=w.types.find(p=>p.name===t);if(A){let p=A.properties.map(v=>`${v.name} ${C(F(v))}`).join(`
58
58
  `);return`\`\`\`screenplay
59
59
  type ${A.name}
60
- ${d}
61
- \`\`\``}let I=w.policies.find(d=>d.name===t);if(I){let d=I.requires.length?I.requires.join(`
60
+ ${p}
61
+ \`\`\``}let I=w.policies.find(p=>p.name===t);if(I){let p=I.requires.length?I.requires.join(`
62
62
  `):"(custom C#)";return`\`\`\`screenplay
63
63
  policy ${I.name}
64
- ${d}
65
- \`\`\``}let B=w.events.find(d=>d.name===t&&d.line===n)??w.events.filter(d=>d.name===t).sort((d,v)=>(v.generation??1)-(d.generation??1))[0];if(B){let d=B.properties.map(v=>`${v.name} ${C(F(v))}`).join(`
64
+ ${p}
65
+ \`\`\``}let B=w.events.find(p=>p.name===t&&p.line===n)??w.events.filter(p=>p.name===t).sort((p,v)=>(v.generation??1)-(p.generation??1))[0];if(B){let p=B.properties.map(v=>`${v.name} ${C(F(v))}`).join(`
66
66
  `);return`\`\`\`screenplay
67
67
  event ${B.name}${B.generation!==void 0?` generation ${B.generation}`:""}
68
- ${d}
69
- \`\`\``}let j=w.commands.find(d=>d.name===t);if(j&&j.properties.length>0){let d=j.properties.map(v=>`${v.name} ${C(F(v))}${v.isGenerated?" generated":""}${v.isIdentifier?" identifier":""}`).join(`
68
+ ${p}
69
+ \`\`\``}let j=w.commands.find(p=>p.name===t);if(j&&j.properties.length>0){let p=j.properties.map(v=>`${v.name} ${C(F(v))}${v.isGenerated?" generated":""}${v.isIdentifier?" identifier":""}`).join(`
70
70
  `);return`\`\`\`screenplay
71
71
  command ${j.name}
72
- ${d}
72
+ ${p}
73
73
  \`\`\`${j.response||j.properties.some(v=>v.isGenerated)?`
74
74
 
75
- ${L}`:""}`}let Y=z(e,p,n,S(o));for(let d of[o.trim().split(/\s+/)[0],...Y]){let N=_(d??"")?.hovers?.[t];if(N)return N}if(t==="reads"&&(Y[0]==="every"||Y[0]==="at")&&Y.includes("reaction"))return"**reads** \u2014 Declares a whole view this clock trigger consults: `reads <View>`. Clock triggers take no values, so `by` is unavailable.";let Ke=o.trim().match(/^(given|when|then)\s+(?:no\s+)?(\w+)/);if(Ke&&Ke[2]===t&&Y[0]==="specification"&&ye[t])return`**${t}** \u2014 ${ye[t]}`;if(t==="id"||t==="documentation"){let d=rt(e),v=w.events.some(Z=>it(d,p,Z.line,S(d[Z.line])).includes(n)),N=t==="id"?/^\s*id\s+"/.test(d[n]):/^\s*documentation\s*$/.test(d[n]);if(!v||!N||r!==S(o)+1)return null}if(t==="optional"||t==="generated"||t==="returns")return null;let Ye=oe[t];return Ye?`**${t}** \u2014 ${Ye}`:null}h(Ve,"hoverContent");function Vt(e={}){return{provideHover(n,t){let r=n.getWordAtPosition(t);if(!r)return null;let a=Ve(n.getLinesContent(),t.lineNumber-1,r.word,r.startColumn,r.endColumn,e.application?.(n));return a?{contents:[{value:a}]}:null}}}h(Vt,"createHoverProvider");function _t(e={}){return{provideInlayHints(n,t){return{hints:Te(n.getLinesContent(),e.application?.(n)).filter(a=>a.line+1>=t.startLineNumber&&a.line+1<=t.endLineNumber).map(a=>({position:{lineNumber:a.line+1,column:a.column},label:a.label,paddingLeft:!0})),dispose(){}}}}}h(_t,"createInlayHintsProvider");var _e="source.screenplay.migrateOptional",ge=h((e,n)=>e===""||e===n||n.startsWith(`${e}.`),"containsKind");function An(e,n){return(e.startLineNumber<n.endLineNumber||e.startLineNumber===n.endLineNumber&&e.startColumn<=n.endColumn)&&(n.startLineNumber<e.endLineNumber||n.startLineNumber===e.endLineNumber&&n.startColumn<=e.endColumn)}h(An,"intersects");function We(e){let n=new WeakMap;return{provideCodeActions(t,r,a,u){let p=a.only!==void 0&&ge(a.only,_e),o=a.only!==void 0&&p&&!ge(a.only,"quickfix");if(u.isCancellationRequested||a.only!==void 0&&!p&&!ge(a.only,"quickfix"))return{actions:[],dispose(){}};let c=a.markers.filter($=>{let T=typeof $.code=="object"?$.code.value:$.code;return nt(T)&&An($,r)});if(!p&&c.length===0)return{actions:[],dispose(){}};let i=t.getVersionId(),s=JSON.stringify(e)??"",l=n.get(t);(l?.version!==i||l.placement!==s)&&(l={version:i,placement:s,fixes:ot(t.getValue(),{placement:e})},n.set(t,l));let y=[...o?[]:l.fixes(c.map($=>({line:$.startLineNumber,diagnosticCode:String(typeof $.code=="object"?$.code.value:$.code)}))).filter($=>$.scope==="occurrence"),...a.only===void 0||p?l.fixes(void 0,et.LegacyOptionalSuffix):[]].filter($=>a.only===void 0||ge(a.only,$.scope==="document"?_e:"quickfix"));return u.isCancellationRequested||t.getVersionId()!==i?{actions:[],dispose(){}}:{actions:y.map($=>({title:$.title,kind:$.scope==="document"?_e:"quickfix",isPreferred:$.scope==="occurrence",edit:{edits:$.edits.map(T=>{let w=t.getPositionAt(T.start),x=t.getPositionAt(T.start+T.length);return{resource:t.uri,versionId:i,textEdit:{range:{startLineNumber:w.lineNumber,startColumn:w.column,endLineNumber:x.lineNumber,endColumn:x.column},text:T.text}}})}})),dispose(){}}}}}h(We,"createCodeActionProvider");var Wt="screenplay",In=300;function qn(e,n,t={}){let r=n.getLinesContent(),a=V(r,t.application?.(n));return ke(r,{application:a,path:a.authoringPath,placement:a.authoringPlacement}).map(u=>({severity:u.severity==="error"?e.MarkerSeverity.Error:u.severity==="information"?e.MarkerSeverity.Info:e.MarkerSeverity.Warning,tags:u.code==="PLAY0479"?[e.MarkerTag.Deprecated]:void 0,message:u.message,code:u.code,startLineNumber:u.line+1,startColumn:u.startColumn,endLineNumber:u.line+1,endColumn:u.endColumn}))}h(qn,"validate");function Ht(e,n,t){let r,a=h(()=>{if(!n.isDisposed()){if(n.getLanguageId()!==M){e.editor.setModelMarkers(n,Wt,[]);return}e.editor.setModelMarkers(n,Wt,qn(e,n,t))}},"run"),u=h(()=>{r!==void 0&&clearTimeout(r),r=setTimeout(a,In)},"schedule"),p=t.onDidChangeApplication?.(a);n.onDidChangeContent(u),n.onDidChangeLanguage(a),n.onWillDispose(()=>{p?.dispose(),r!==void 0&&clearTimeout(r)}),a()}h(Ht,"watch");function Ut(e,n={}){e.editor.getModels().forEach(t=>Ht(e,t,n)),e.editor.onDidCreateModel(t=>Ht(e,t,n))}h(Ut,"attachDiagnostics");var He={tokens:[[/\b(?:from|every|all|nested|join|children|identified|by|key|parent|with|remove|via|clear|on|sequence|automap|no|exclude|literal|set|increment|decrement|add|subtract|count)\b/,"keyword"]],completions:[{label:"key",insertText:"key ${1:property}",documentation:"Declares which property identifies the read model instance."},{label:"from",insertText:"from ${1:EventType}",documentation:"Maps properties from an event onto the read model."},{label:"join",insertText:"join ${1:property} on ${2:key}",documentation:"Joins related state onto the read model by a key property."},{label:"children",insertText:"children ${1:collection} identified by ${2:key}",documentation:"Projects events into a child collection on the read model."},{label:"remove with",insertText:"remove with ${1:EventType}",documentation:"Removes the read model instance when the event occurs."},{label:"parent",insertText:"parent ${1:property}",documentation:"Declares the property that identifies the parent of a child."},{label:"clear",insertText:"clear ${1:property}",documentation:"Removes the value a property holds when the event occurs."},{label:"increment",insertText:"increment ${1:property}",documentation:"Increments a numeric property when the event occurs."},{label:"decrement",insertText:"decrement ${1:property}",documentation:"Decrements a numeric property when the event occurs."}],hovers:{from:"PDL \u2014 maps properties from an event onto the read model.",every:"PDL \u2014 applies property mappings for every event type in the projection.",join:"PDL \u2014 joins related state onto the read model by a key property.",children:"PDL \u2014 projects events into a child collection on the read model.",identified:"PDL \u2014 introduces the identifying key of a child collection.",key:"PDL \u2014 declares which property identifies the read model instance.",parent:"PDL \u2014 declares the property that identifies the parent of a child.",remove:"PDL \u2014 removes the read model instance when an event occurs.",clear:"PDL \u2014 clear <property> removes the value a property holds; clear with <EventType> nulls a nested object.",increment:"PDL \u2014 increments a numeric property when the event occurs.",decrement:"PDL \u2014 decrements a numeric property when the event occurs."}};var Ue={tokens:[[/\b(?:source|api|route|poll|path|topic|key|map|translate|split|append|tag|when|children|nested|identified|by|from|to|and|or|added|removed)\b/,"keyword"]],completions:[{label:"source",insertText:"source ${1:api}",documentation:"Declares where the captured data comes from."},{label:"key",insertText:"key ${1:property}",documentation:"Declares which source property identifies an instance."},{label:"map",insertText:"map\n ${1:property} = ${2:source}",documentation:"Maps and translates source values before events are appended."},{label:"append",insertText:"append ${1:EventType}\n when ${2:property}",documentation:"Appends an event when the source data changes."},{label:"translate",insertText:'translate\n "${1:source}" => ${2:target}',documentation:"Translates source values into Screenplay values."},{label:"children",insertText:"children ${1:collection} identified by ${2:key}",documentation:"Captures changes in a child collection of the source data."},{label:"when added",insertText:"when added",documentation:"Appends the event when a new item appears in the source."},{label:"when removed",insertText:"when removed",documentation:"Appends the event when an item disappears from the source."}],hovers:{source:"CDL \u2014 declares where the captured data comes from.",api:"CDL \u2014 as a source type, polls an HTTP API; as a source property (`api <ServiceName>`), references a named External Service for the base URL and authentication.",route:"CDL \u2014 optional path appended to an API source's External Service base URL.",poll:"CDL \u2014 the polling interval for an API source, e.g. 5m.",path:"CDL \u2014 the inbound path a webhook source listens on.",topic:"CDL \u2014 the topic a message source subscribes to.",key:"CDL \u2014 declares which source property identifies an instance.",map:"CDL \u2014 maps and translates source values before events are appended.",translate:"CDL \u2014 translates source values into Screenplay values.",append:"CDL \u2014 appends an event when the source data changes.",when:"CDL \u2014 the change condition: a property change, added, or removed.",added:"CDL \u2014 matches items that appear in the source.",removed:"CDL \u2014 matches items that disappear from the source.",children:"CDL \u2014 captures changes in a child collection of the source data.",identified:"CDL \u2014 introduces the identifying key of a child collection."}};var Ge="screenplay-dark",Gt={base:"vs-dark",inherit:!0,rules:[{token:"keyword.play",foreground:"C586C0"},{token:"keyword.tag.play",foreground:"569CD6",fontStyle:"italic"},{token:"keyword.type.play",foreground:"4FC1FF",fontStyle:"bold"},{token:"type.play",foreground:"4EC9B0"},{token:"type.identifier.play",foreground:"4EC9B0"},{token:"identifier.play",foreground:"9CDCFE"},{token:"annotation.play",foreground:"DCDCAA"},{token:"variable.predefined.play",foreground:"D7BA7D"},{token:"string.play",foreground:"CE9178"},{token:"string.link.play",foreground:"CE9178",fontStyle:"underline"},{token:"string.invalid.play",foreground:"F44747"},{token:"string.quote.play",foreground:"6A9955"},{token:"number.play",foreground:"B5CEA8"},{token:"number.float.play",foreground:"B5CEA8"},{token:"comment.play",foreground:"6A9955",fontStyle:"italic"},{token:"operator.play",foreground:"D4D4D4"},{token:"delimiter.play",foreground:"CCCCCC"}],colors:{"editor.background":"#1E1E1E"}};var Ze="screenplay-light",Zt={base:"vs",inherit:!0,rules:[{token:"keyword.play",foreground:"AF00DB"},{token:"keyword.tag.play",foreground:"0000FF",fontStyle:"italic"},{token:"keyword.type.play",foreground:"0070C1",fontStyle:"bold"},{token:"type.play",foreground:"267F99"},{token:"type.identifier.play",foreground:"267F99"},{token:"identifier.play",foreground:"001080"},{token:"annotation.play",foreground:"795E26"},{token:"variable.predefined.play",foreground:"B45309"},{token:"string.play",foreground:"A31515"},{token:"string.link.play",foreground:"A31515",fontStyle:"underline"},{token:"string.invalid.play",foreground:"CD3131"},{token:"string.quote.play",foreground:"008000"},{token:"number.play",foreground:"098658"},{token:"number.float.play",foreground:"098658"},{token:"comment.play",foreground:"008000",fontStyle:"italic"},{token:"operator.play",foreground:"000000"},{token:"delimiter.play",foreground:"000000"}],colors:{"editor.background":"#FFFFFF"}};var Qe=new Set;function Qt(e){e.languages.setMonarchTokensProvider(M,mt(Me()))}h(Qt,"applyTokensProvider");zt(()=>Qe.forEach(Qt));function Ln(){_("projection")||he("projection",He),_("capture")||he("capture",Ue)}h(Ln,"ensureBuiltInSubLanguages");function zr(e,n={}){Qe.has(e)||(Ln(),Qe.add(e),e.languages.register(Je),e.languages.setLanguageConfiguration(M,Xe),Qt(e),e.languages.registerCompletionItemProvider(M,Bt(e,n)),e.languages.registerHoverProvider(M,Vt(n)),e.languages.registerDefinitionProvider(M,{provideDefinition(t,r){let a=t.getWordAtPosition(r);if(!a)return[];let u=n.application?.(t),o=ue(t.getLinesContent(),r.lineNumber-1,a.startColumn,a.endColumn,u)?.target;if(!o)return[];let c=u?.authoringPath??"current.play",i=o.location.path===c?t.getValue():u?.authoringDocuments?.find(y=>y.path===o.location.path)?.source,s=i&&pe(o.location,o.name,i);if(!s)return[];let l=o.location.path&&t.uri.path.endsWith(`/${c}`)?t.uri.with({path:t.uri.path.slice(0,-c.length)+o.location.path}):void 0,m=l?e.editor.getModels().filter(y=>y.uri.toString()===l.toString()):[],g=o.location.path===c?t:m.length===1?m[0]:void 0;return g?[{uri:g.uri,range:new e.Range(s.line,s.column,s.line,s.column+o.name.length)}]:[]}}),e.languages.registerDocumentSemanticTokensProvider(M,{getLegend:h(()=>({tokenTypes:[...je],tokenModifiers:[]}),"getLegend"),provideDocumentSemanticTokens(t){let r=[],a=0,u=0;for(let p of ze(t.getLinesContent(),n.application?.(t)))r.push(p.line-a,p.line===a?p.column-u:p.column,p.length,p.type,0),a=p.line,u=p.column;return{data:new Uint32Array(r)}},releaseDocumentSemanticTokens(){}}),e.languages.registerInlayHintsProvider(M,_t(n)),e.languages.registerCodeActionProvider(M,We()),e.editor.defineTheme(Ge,Gt),e.editor.defineTheme(Ze,Zt),Ut(e,n))}h(zr,"register");export{me as analyzeEventSources,Nt as analyzeOperations,Be as attributeDocs,sn as builtInTriggerNames,Jt as causedByProperties,Ue as cdl,be as clauseKeywords,J as codeBlockTags,Ft as completionEntriesFor,Xt as conceptAttributes,re as constructKeywords,Yt as contextRoots,fe as contextVariableDocs,Ie as contextVariableItems,We as createCodeActionProvider,Te as destinationHints,hn as diagnosticCodes,z as enclosingChain,Ln as ensureBuiltInSubLanguages,pn as eventContextMemberAt,mn as eventContextMembers,un as eventContextMembersAfter,ee as eventContextPaths,O as eventSourceAvailability,Re as eventSourceCompletions,le as eventSourceDetails,Ee as eventSourceHover,pe as eventSourceIdentifier,ue as eventSourceReferenceAt,E as fenceMap,fn as fileImportOn,gn as fileImports,tn as fileReferenceKeyword,on as fileReferenceOn,rn as fileReferences,en as firstWord,_ as getSubLanguage,Me as getSubLanguages,Ve as hoverContent,bn as importablePaths,S as indentOf,nn as isAbsoluteFileReferencePath,yn as isFileImportLine,oe as keywordDocs,xe as knownEventNames,we as knownTriggerNames,cn as knownTypeNames,M as languageId,an as mergeSymbols,ln as namesEventContextMember,P as operationAvailability,Le as operationCompletions,ce as operationDetails,Pe as operationHover,Mt as operationReferenceAt,He as pdl,qe as phaseState,Oe as planCompletions,W as primitiveTypes,K as producesItems,dn as productionDestinations,zr as register,he as registerSubLanguage,q as responseAnalysis,L as responseAvailability,ne as responseCompletions,je as responseTokenTypes,ze as responseTokens,U as scanDocument,Ge as screenplayDarkThemeName,Ze as screenplayLightThemeName,$e as sliceTypes,ye as specificationKeywordDocs,De as specificationStepItems,V as symbolsForBuffer,ve as typeReferenceSymbol,C as typeReferenceText,ke as validateLines,D as withoutComment};
75
+ ${L}`:""}`}let Y=z(e,d,n,S(o));for(let p of[o.trim().split(/\s+/)[0],...Y]){let R=_(p??"")?.hovers?.[t];if(R)return R}if(t==="reads"&&(Y[0]==="every"||Y[0]==="at")&&Y.includes("reaction"))return"**reads** \u2014 Declares a whole view this clock trigger consults: `reads <View>`. Clock triggers take no values, so `by` is unavailable.";let Ke=o.trim().match(/^(given|when|then)\s+(?:no\s+)?(\w+)/);if(Ke&&Ke[2]===t&&Y[0]==="specification"&&ye[t])return`**${t}** \u2014 ${ye[t]}`;if(t==="id"||t==="documentation"){let p=rt(e),v=w.events.some(Z=>it(p,d,Z.line,S(p[Z.line])).includes(n)),R=t==="id"?/^\s*id\s+"/.test(p[n]):/^\s*documentation\s*$/.test(p[n]);if(!v||!R||r!==S(o)+1)return null}if(t==="optional"||t==="generated"||t==="returns")return null;let Ye=oe[t];return Ye?`**${t}** \u2014 ${Ye}`:null}h(Ve,"hoverContent");function Vt(e={}){return{provideHover(n,t){let r=n.getWordAtPosition(t);if(!r)return null;let a=Ve(n.getLinesContent(),t.lineNumber-1,r.word,r.startColumn,r.endColumn,e.application?.(n));return a?{contents:[{value:a}]}:null}}}h(Vt,"createHoverProvider");function _t(e={}){return{provideInlayHints(n,t){return{hints:Te(n.getLinesContent(),e.application?.(n)).filter(a=>a.line+1>=t.startLineNumber&&a.line+1<=t.endLineNumber).map(a=>({position:{lineNumber:a.line+1,column:a.column},label:a.label,paddingLeft:!0})),dispose(){}}}}}h(_t,"createInlayHintsProvider");var _e="source.screenplay.migrateOptional",ge=h((e,n)=>e===""||e===n||n.startsWith(`${e}.`),"containsKind");function An(e,n){return(e.startLineNumber<n.endLineNumber||e.startLineNumber===n.endLineNumber&&e.startColumn<=n.endColumn)&&(n.startLineNumber<e.endLineNumber||n.startLineNumber===e.endLineNumber&&n.startColumn<=e.endColumn)}h(An,"intersects");function We(e){let n=new WeakMap;return{provideCodeActions(t,r,a,u){let d=a.only!==void 0&&ge(a.only,_e),o=a.only!==void 0&&d&&!ge(a.only,"quickfix");if(u.isCancellationRequested||a.only!==void 0&&!d&&!ge(a.only,"quickfix"))return{actions:[],dispose(){}};let c=a.markers.filter($=>{let T=typeof $.code=="object"?$.code.value:$.code;return nt(T)&&An($,r)});if(!d&&c.length===0)return{actions:[],dispose(){}};let i=t.getVersionId(),s=JSON.stringify(e)??"",l=n.get(t);(l?.version!==i||l.placement!==s)&&(l={version:i,placement:s,fixes:ot(t.getValue(),{placement:e})},n.set(t,l));let y=[...o?[]:l.fixes(c.map($=>({line:$.startLineNumber,diagnosticCode:String(typeof $.code=="object"?$.code.value:$.code)}))).filter($=>$.scope==="occurrence"),...a.only===void 0||d?l.fixes(void 0,et.LegacyOptionalSuffix):[]].filter($=>a.only===void 0||ge(a.only,$.scope==="document"?_e:"quickfix"));return u.isCancellationRequested||t.getVersionId()!==i?{actions:[],dispose(){}}:{actions:y.map($=>({title:$.title,kind:$.scope==="document"?_e:"quickfix",isPreferred:$.scope==="occurrence",edit:{edits:$.edits.map(T=>{let w=t.getPositionAt(T.start),x=t.getPositionAt(T.start+T.length);return{resource:t.uri,versionId:i,textEdit:{range:{startLineNumber:w.lineNumber,startColumn:w.column,endLineNumber:x.lineNumber,endColumn:x.column},text:T.text}}})}})),dispose(){}}}}}h(We,"createCodeActionProvider");var Wt="screenplay",In=300;function qn(e,n,t={}){let r=n.getLinesContent(),a=V(r,t.application?.(n));return ke(r,{application:a,path:a.authoringPath,placement:a.authoringPlacement}).map(u=>({severity:u.severity==="error"?e.MarkerSeverity.Error:u.severity==="information"?e.MarkerSeverity.Info:e.MarkerSeverity.Warning,tags:u.code==="PLAY0479"?[e.MarkerTag.Deprecated]:void 0,message:u.message,code:u.code,startLineNumber:u.line+1,startColumn:u.startColumn,endLineNumber:u.line+1,endColumn:u.endColumn}))}h(qn,"validate");function Ut(e,n,t){let r,a=h(()=>{if(!n.isDisposed()){if(n.getLanguageId()!==M){e.editor.setModelMarkers(n,Wt,[]);return}e.editor.setModelMarkers(n,Wt,qn(e,n,t))}},"run"),u=h(()=>{r!==void 0&&clearTimeout(r),r=setTimeout(a,In)},"schedule"),d=t.onDidChangeApplication?.(a);n.onDidChangeContent(u),n.onDidChangeLanguage(a),n.onWillDispose(()=>{d?.dispose(),r!==void 0&&clearTimeout(r)}),a()}h(Ut,"watch");function Ht(e,n={}){e.editor.getModels().forEach(t=>Ut(e,t,n)),e.editor.onDidCreateModel(t=>Ut(e,t,n))}h(Ht,"attachDiagnostics");var Ue={tokens:[[/\b(?:from|every|all|nested|join|children|identified|by|key|parent|with|remove|via|clear|on|sequence|automap|no|exclude|literal|set|increment|decrement|add|subtract|count)\b/,"keyword"]],completions:[{label:"key",insertText:"key ${1:property}",documentation:"Declares which property identifies the read model instance."},{label:"from",insertText:"from ${1:EventType}",documentation:"Maps properties from an event onto the read model."},{label:"join",insertText:"join ${1:property} on ${2:key}",documentation:"Joins related state onto the read model by a key property."},{label:"children",insertText:"children ${1:collection} identified by ${2:key}",documentation:"Projects events into a child collection on the read model."},{label:"remove with",insertText:"remove with ${1:EventType}",documentation:"Removes the read model instance when the event occurs."},{label:"parent",insertText:"parent ${1:property}",documentation:"Declares the property that identifies the parent of a child."},{label:"clear",insertText:"clear ${1:property}",documentation:"Removes the value a property holds when the event occurs."},{label:"increment",insertText:"increment ${1:property}",documentation:"Increments a numeric property when the event occurs."},{label:"decrement",insertText:"decrement ${1:property}",documentation:"Decrements a numeric property when the event occurs."}],hovers:{from:"PDL \u2014 maps properties from an event onto the read model.",every:"PDL \u2014 applies property mappings for every event type in the projection.",join:"PDL \u2014 joins related state onto the read model by a key property.",children:"PDL \u2014 projects events into a child collection on the read model.",identified:"PDL \u2014 introduces the identifying key of a child collection.",key:"PDL \u2014 declares which property identifies the read model instance.",parent:"PDL \u2014 declares the property that identifies the parent of a child.",remove:"PDL \u2014 removes the read model instance when an event occurs.",clear:"PDL \u2014 clear <property> removes the value a property holds; clear with <EventType> nulls a nested object.",increment:"PDL \u2014 increments a numeric property when the event occurs.",decrement:"PDL \u2014 decrements a numeric property when the event occurs."}};var He={tokens:[[/\b(?:source|api|route|poll|path|topic|key|map|translate|split|append|tag|when|children|nested|identified|by|from|to|and|or|added|removed)\b/,"keyword"]],completions:[{label:"source",insertText:"source ${1:api}",documentation:"Declares where the captured data comes from."},{label:"key",insertText:"key ${1:property}",documentation:"Declares which source property identifies an instance."},{label:"map",insertText:"map\n ${1:property} = ${2:source}",documentation:"Maps and translates source values before events are appended."},{label:"append",insertText:"append ${1:EventType}\n when ${2:property}",documentation:"Appends an event when the source data changes."},{label:"translate",insertText:'translate\n "${1:source}" => ${2:target}',documentation:"Translates source values into Screenplay values."},{label:"children",insertText:"children ${1:collection} identified by ${2:key}",documentation:"Captures changes in a child collection of the source data."},{label:"when added",insertText:"when added",documentation:"Appends the event when a new item appears in the source."},{label:"when removed",insertText:"when removed",documentation:"Appends the event when an item disappears from the source."}],hovers:{source:"CDL \u2014 declares where the captured data comes from.",api:"CDL \u2014 as a source type, polls an HTTP API; as a source property (`api <ServiceName>`), references a named External Service for the base URL and authentication.",route:"CDL \u2014 optional path appended to an API source's External Service base URL.",poll:"CDL \u2014 the polling interval for an API source, e.g. 5m.",path:"CDL \u2014 the inbound path a webhook source listens on.",topic:"CDL \u2014 the topic a message source subscribes to.",key:"CDL \u2014 declares which source property identifies an instance.",map:"CDL \u2014 maps and translates source values before events are appended.",translate:"CDL \u2014 translates source values into Screenplay values.",append:"CDL \u2014 appends an event when the source data changes.",when:"CDL \u2014 the change condition: a property change, added, or removed.",added:"CDL \u2014 matches items that appear in the source.",removed:"CDL \u2014 matches items that disappear from the source.",children:"CDL \u2014 captures changes in a child collection of the source data.",identified:"CDL \u2014 introduces the identifying key of a child collection."}};var Ge="screenplay-dark",Gt={base:"vs-dark",inherit:!0,rules:[{token:"keyword.play",foreground:"C586C0"},{token:"keyword.tag.play",foreground:"569CD6",fontStyle:"italic"},{token:"keyword.type.play",foreground:"4FC1FF",fontStyle:"bold"},{token:"type.play",foreground:"4EC9B0"},{token:"type.identifier.play",foreground:"4EC9B0"},{token:"identifier.play",foreground:"9CDCFE"},{token:"annotation.play",foreground:"DCDCAA"},{token:"variable.predefined.play",foreground:"D7BA7D"},{token:"string.play",foreground:"CE9178"},{token:"string.link.play",foreground:"CE9178",fontStyle:"underline"},{token:"string.invalid.play",foreground:"F44747"},{token:"string.quote.play",foreground:"6A9955"},{token:"number.play",foreground:"B5CEA8"},{token:"number.float.play",foreground:"B5CEA8"},{token:"comment.play",foreground:"6A9955",fontStyle:"italic"},{token:"operator.play",foreground:"D4D4D4"},{token:"delimiter.play",foreground:"CCCCCC"}],colors:{"editor.background":"#1E1E1E"}};var Ze="screenplay-light",Zt={base:"vs",inherit:!0,rules:[{token:"keyword.play",foreground:"AF00DB"},{token:"keyword.tag.play",foreground:"0000FF",fontStyle:"italic"},{token:"keyword.type.play",foreground:"0070C1",fontStyle:"bold"},{token:"type.play",foreground:"267F99"},{token:"type.identifier.play",foreground:"267F99"},{token:"identifier.play",foreground:"001080"},{token:"annotation.play",foreground:"795E26"},{token:"variable.predefined.play",foreground:"B45309"},{token:"string.play",foreground:"A31515"},{token:"string.link.play",foreground:"A31515",fontStyle:"underline"},{token:"string.invalid.play",foreground:"CD3131"},{token:"string.quote.play",foreground:"008000"},{token:"number.play",foreground:"098658"},{token:"number.float.play",foreground:"098658"},{token:"comment.play",foreground:"008000",fontStyle:"italic"},{token:"operator.play",foreground:"000000"},{token:"delimiter.play",foreground:"000000"}],colors:{"editor.background":"#FFFFFF"}};var Qe=new Set;function Qt(e){e.languages.setMonarchTokensProvider(M,mt(Me()))}h(Qt,"applyTokensProvider");zt(()=>Qe.forEach(Qt));function Ln(){_("projection")||he("projection",Ue),_("capture")||he("capture",He)}h(Ln,"ensureBuiltInSubLanguages");function zr(e,n={}){Qe.has(e)||(Ln(),Qe.add(e),e.languages.register(Je),e.languages.setLanguageConfiguration(M,Xe),Qt(e),e.languages.registerCompletionItemProvider(M,Bt(e,n)),e.languages.registerHoverProvider(M,Vt(n)),e.languages.registerDefinitionProvider(M,{provideDefinition(t,r){let a=t.getWordAtPosition(r);if(!a)return[];let u=n.application?.(t),o=ue(t.getLinesContent(),r.lineNumber-1,a.startColumn,a.endColumn,u)?.target;if(!o)return[];let c=u?.authoringPath??"current.play",i=o.location.path===c?t.getValue():u?.authoringDocuments?.find(y=>y.path===o.location.path)?.source,s=i&&de(o.location,o.name,i);if(!s)return[];let l=o.location.path&&t.uri.path.endsWith(`/${c}`)?t.uri.with({path:t.uri.path.slice(0,-c.length)+o.location.path}):void 0,m=l?e.editor.getModels().filter(y=>y.uri.toString()===l.toString()):[],g=o.location.path===c?t:m.length===1?m[0]:void 0;return g?[{uri:g.uri,range:new e.Range(s.line,s.column,s.line,s.column+o.name.length)}]:[]}}),e.languages.registerDocumentSemanticTokensProvider(M,{getLegend:h(()=>({tokenTypes:[...je],tokenModifiers:[]}),"getLegend"),provideDocumentSemanticTokens(t){let r=[],a=0,u=0;for(let d of ze(t.getLinesContent(),n.application?.(t)))r.push(d.line-a,d.line===a?d.column-u:d.column,d.length,d.type,0),a=d.line,u=d.column;return{data:new Uint32Array(r)}},releaseDocumentSemanticTokens(){}}),e.languages.registerInlayHintsProvider(M,_t(n)),e.languages.registerCodeActionProvider(M,We()),e.editor.defineTheme(Ge,Gt),e.editor.defineTheme(Ze,Zt),Ht(e,n))}h(zr,"register");export{me as analyzeEventSources,Rt as analyzeOperations,Be as attributeDocs,sn as builtInTriggerNames,Jt as causedByProperties,He as cdl,be as clauseKeywords,J as codeBlockTags,Ft as completionEntriesFor,Xt as conceptAttributes,re as constructKeywords,Yt as contextRoots,fe as contextVariableDocs,Ie as contextVariableItems,We as createCodeActionProvider,Te as destinationHints,hn as diagnosticCodes,z as enclosingChain,Ln as ensureBuiltInSubLanguages,dn as eventContextMemberAt,mn as eventContextMembers,un as eventContextMembersAfter,ee as eventContextPaths,O as eventSourceAvailability,Ne as eventSourceCompletions,le as eventSourceDetails,Pe as eventSourceHover,de as eventSourceIdentifier,ue as eventSourceReferenceAt,P as fenceMap,fn as fileImportOn,gn as fileImports,tn as fileReferenceKeyword,on as fileReferenceOn,rn as fileReferences,en as firstWord,_ as getSubLanguage,Me as getSubLanguages,Ve as hoverContent,bn as importablePaths,S as indentOf,nn as isAbsoluteFileReferencePath,yn as isFileImportLine,oe as keywordDocs,xe as knownEventNames,we as knownTriggerNames,cn as knownTypeNames,M as languageId,an as mergeSymbols,ln as namesEventContextMember,E as operationAvailability,Le as operationCompletions,ce as operationDetails,Ee as operationHover,Mt as operationReferenceAt,Ue as pdl,qe as phaseState,Oe as planCompletions,W as primitiveTypes,K as producesItems,pn as productionDestinations,zr as register,he as registerSubLanguage,q as responseAnalysis,L as responseAvailability,ne as responseCompletions,je as responseTokenTypes,ze as responseTokens,H as scanDocument,Ge as screenplayDarkThemeName,Ze as screenplayLightThemeName,$e as sliceTypes,ye as specificationKeywordDocs,De as specificationStepItems,V as symbolsForBuffer,ve as typeReferenceSymbol,C as typeReferenceText,ke as validateLines,D as withoutComment};
76
76
  //# sourceMappingURL=index.js.map