@dbml/parse 3.13.5 → 3.13.6

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (78) hide show
  1. package/LICENSE +0 -0
  2. package/dist/dbml-parse.js +1 -1
  3. package/dist/dbml-parse.mjs +33 -65
  4. package/dist/src/compiler.d.ts +0 -0
  5. package/dist/src/constants.d.ts +0 -0
  6. package/dist/src/index.d.ts +0 -0
  7. package/dist/src/lib/analyzer/analyzer.d.ts +0 -0
  8. package/dist/src/lib/analyzer/binder/binder.d.ts +0 -0
  9. package/dist/src/lib/analyzer/binder/elementBinder/custom.d.ts +0 -0
  10. package/dist/src/lib/analyzer/binder/elementBinder/elementBinder.d.ts +0 -0
  11. package/dist/src/lib/analyzer/binder/elementBinder/enum.d.ts +0 -0
  12. package/dist/src/lib/analyzer/binder/elementBinder/indexes.d.ts +0 -0
  13. package/dist/src/lib/analyzer/binder/elementBinder/note.d.ts +0 -0
  14. package/dist/src/lib/analyzer/binder/elementBinder/project.d.ts +0 -0
  15. package/dist/src/lib/analyzer/binder/elementBinder/ref.d.ts +0 -0
  16. package/dist/src/lib/analyzer/binder/elementBinder/table.d.ts +0 -0
  17. package/dist/src/lib/analyzer/binder/elementBinder/tableGroup.d.ts +0 -0
  18. package/dist/src/lib/analyzer/binder/elementBinder/tablePartial.d.ts +0 -0
  19. package/dist/src/lib/analyzer/binder/types.d.ts +0 -0
  20. package/dist/src/lib/analyzer/binder/utils.d.ts +0 -0
  21. package/dist/src/lib/analyzer/symbol/factory.d.ts +0 -0
  22. package/dist/src/lib/analyzer/symbol/symbolIndex.d.ts +0 -0
  23. package/dist/src/lib/analyzer/symbol/symbolTable.d.ts +0 -0
  24. package/dist/src/lib/analyzer/symbol/symbols.d.ts +0 -0
  25. package/dist/src/lib/analyzer/symbol/utils.d.ts +0 -0
  26. package/dist/src/lib/analyzer/types.d.ts +0 -0
  27. package/dist/src/lib/analyzer/utils.d.ts +0 -0
  28. package/dist/src/lib/analyzer/validator/elementValidators/custom.d.ts +0 -0
  29. package/dist/src/lib/analyzer/validator/elementValidators/enum.d.ts +0 -0
  30. package/dist/src/lib/analyzer/validator/elementValidators/indexes.d.ts +0 -0
  31. package/dist/src/lib/analyzer/validator/elementValidators/note.d.ts +0 -0
  32. package/dist/src/lib/analyzer/validator/elementValidators/project.d.ts +0 -0
  33. package/dist/src/lib/analyzer/validator/elementValidators/ref.d.ts +0 -0
  34. package/dist/src/lib/analyzer/validator/elementValidators/table.d.ts +0 -0
  35. package/dist/src/lib/analyzer/validator/elementValidators/tableGroup.d.ts +0 -0
  36. package/dist/src/lib/analyzer/validator/elementValidators/tablePartial.d.ts +0 -0
  37. package/dist/src/lib/analyzer/validator/types.d.ts +0 -0
  38. package/dist/src/lib/analyzer/validator/utils.d.ts +0 -0
  39. package/dist/src/lib/analyzer/validator/validator.d.ts +0 -0
  40. package/dist/src/lib/errors.d.ts +0 -0
  41. package/dist/src/lib/interpreter/elementInterpreter/enum.d.ts +0 -0
  42. package/dist/src/lib/interpreter/elementInterpreter/project.d.ts +0 -0
  43. package/dist/src/lib/interpreter/elementInterpreter/ref.d.ts +0 -0
  44. package/dist/src/lib/interpreter/elementInterpreter/sticky_note.d.ts +0 -0
  45. package/dist/src/lib/interpreter/elementInterpreter/table.d.ts +0 -0
  46. package/dist/src/lib/interpreter/elementInterpreter/tableGroup.d.ts +0 -0
  47. package/dist/src/lib/interpreter/elementInterpreter/tablePartial.d.ts +0 -0
  48. package/dist/src/lib/interpreter/interpreter.d.ts +0 -0
  49. package/dist/src/lib/interpreter/types.d.ts +0 -0
  50. package/dist/src/lib/interpreter/utils.d.ts +0 -0
  51. package/dist/src/lib/lexer/lexer.d.ts +0 -0
  52. package/dist/src/lib/lexer/tokens.d.ts +0 -0
  53. package/dist/src/lib/lexer/utils.d.ts +0 -0
  54. package/dist/src/lib/option.d.ts +0 -0
  55. package/dist/src/lib/parser/contextStack.d.ts +0 -0
  56. package/dist/src/lib/parser/factory.d.ts +0 -0
  57. package/dist/src/lib/parser/nodes.d.ts +0 -0
  58. package/dist/src/lib/parser/parser.d.ts +0 -0
  59. package/dist/src/lib/parser/utils.d.ts +0 -0
  60. package/dist/src/lib/report.d.ts +0 -0
  61. package/dist/src/lib/serialization/serialize.d.ts +0 -0
  62. package/dist/src/lib/types.d.ts +0 -0
  63. package/dist/src/lib/utils.d.ts +0 -0
  64. package/dist/src/services/definition/provider.d.ts +0 -0
  65. package/dist/src/services/index.d.ts +0 -0
  66. package/dist/src/services/references/provider.d.ts +0 -0
  67. package/dist/src/services/suggestions/provider.d.ts +0 -0
  68. package/dist/src/services/suggestions/utils.d.ts +0 -0
  69. package/dist/src/services/types.d.ts +0 -0
  70. package/dist/src/services/utils.d.ts +0 -0
  71. package/dist/tests/NaN_errors/interpreter_NaN.test.d.ts +0 -0
  72. package/dist/tests/binder/binder.test.d.ts +0 -0
  73. package/dist/tests/interpreter/interpreter.test.d.ts +0 -0
  74. package/dist/tests/jestHelpers.d.ts +0 -0
  75. package/dist/tests/lexer/lexer.test.d.ts +0 -0
  76. package/dist/tests/parser/parser.test.d.ts +0 -0
  77. package/dist/tests/validator/validator.test.d.ts +0 -0
  78. package/package.json +8 -5
package/LICENSE CHANGED
File without changes
@@ -1,4 +1,4 @@
1
- "use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const L=require("lodash");var u=(t=>(t.SPACE="<space>",t.TAB="<tab>",t.NEWLINE="<newline>",t.COMMA="<comma>",t.LPAREN="<lparen>",t.RPAREN="<rparen>",t.LBRACE="<lbrace>",t.RBRACE="<rbrace>",t.LBRACKET="<lbracket>",t.RBRACKET="<rbracket>",t.LANGLE="<langle>",t.RANGLE="<rangle>",t.OP="<op>",t.EOF="<eof>",t.NUMERIC_LITERAL="<number>",t.STRING_LITERAL="<string>",t.COLOR_LITERAL="<color>",t.FUNCTION_EXPRESSION="<function-expression>",t.QUOTED_STRING="<variable>",t.IDENTIFIER="<identifier>",t.SEMICOLON="<semicolon>",t.COLON="<colon>",t.TILDE="<tilde>",t.SINGLE_LINE_COMMENT="<single-line-comment>",t.MULTILINE_COMMENT="<multiline-comment>",t))(u||{});function an(t){switch(t.kind){case"<newline>":case"<space>":case"<tab>":case"<single-line-comment>":case"<multiline-comment>":return!0;default:return!1}}function rn(t){if(!t)return!1;switch(t){case"+":case"-":case"*":case"/":case"%":case"<":case">":case"=":case"!":case".":case"&":case"|":return!0;default:return!1}}function pt(t){return t!==void 0&&t.kind==="<op>"}class Q{constructor(e,n,s,i,a){this.kind=e,this.startPos=n,this.endPos=s,this.value=i,this.leadingTrivia=[],this.trailingTrivia=[],this.leadingInvalid=[],this.trailingInvalid=[],this.isInvalid=a,this.start=n.offset,this.end=s.offset}static create(e,n,s,i,a){return new Q(e,n,s,i,a)}}function yt(t){return t.trailingTrivia.find(({kind:e})=>e===u.NEWLINE)!==void 0}function dt(t,e){return e.leadingTrivia.find(({kind:s})=>s===u.NEWLINE)!==void 0||yt(t)}function Je(t){return t.trailingTrivia.find(({kind:e})=>[u.SPACE,u.TAB].includes(e))!==void 0}function Pt(t){return t.trailingTrivia.length===0?t.end:Pt(L.last(t.trailingTrivia))}function kt(t){return t.leadingTrivia.length===0?t.start:kt(t.leadingTrivia[0])}function on(t){return[u.SINGLE_LINE_COMMENT,u.MULTILINE_COMMENT].includes(t.kind)}class ln{constructor(){this.id=0}reset(){this.id=0}nextId(){return this.id++}}class O{constructor(e,n,s){this.id=e,this.kind=n;const i=s.find(r=>r!==void 0&&!Number.isNaN(r.start));i?(this.startPos=i.startPos,this.fullStart=i instanceof Q?kt(i):i.fullStart):(this.startPos={offset:NaN,column:NaN,line:NaN},this.fullStart=NaN);const a=[...s].reverse().find(r=>r!==void 0&&!Number.isNaN(r.end));a?(this.endPos=a.endPos,this.fullEnd=a instanceof Q?Pt(a):a.fullEnd):(this.endPos={offset:NaN,column:NaN,line:NaN},this.fullEnd=NaN),this.start=this.startPos.offset,this.end=this.endPos.offset}}var me=(t=>(t.PROGRAM="<program>",t.ELEMENT_DECLARATION="<element-declaration>",t.ATTRIBUTE="<attribute>",t.IDENTIFIER_STREAM="<identifer-stream>",t.LITERAL="<literal>",t.VARIABLE="<variable>",t.PREFIX_EXPRESSION="<prefix-expression>",t.INFIX_EXPRESSION="<infix-expression>",t.POSTFIX_EXPRESSION="<postfix-expression>",t.FUNCTION_EXPRESSION="<function-expression>",t.FUNCTION_APPLICATION="<function-application>",t.BLOCK_EXPRESSION="<block-expression>",t.LIST_EXPRESSION="<list-expression>",t.TUPLE_EXPRESSION="<tuple-expression>",t.CALL_EXPRESSION="<call-expression>",t.PRIMARY_EXPRESSION="<primary-expression>",t.GROUP_EXPRESSION="<group-expression>",t.DUMMY="<dummy>",t.ARRAY="<array>",t.PARTIAL_INJECTION="<partial-injection>",t))(me||{});class K extends O{constructor({body:e=[],eof:n},s){super(s,"<program>",[...e,n]),this.body=e,this.eof=n}}class y extends O{constructor({type:e,name:n,as:s,alias:i,attributeList:a,bodyColon:r,body:c},f){if(super(f,"<element-declaration>",[e,n,s,i,a,r,c]),c&&r&&!(c instanceof w||c instanceof y))throw new Error("If an element has a simple body, it must be a function application node");this.type=e,this.name=n,this.as=s,this.alias=i,this.attributeList=a,this.bodyColon=r,this.body=c}}class ne extends O{constructor({identifiers:e=[]},n){super(n,"<identifer-stream>",e||[]),this.identifiers=e}}class se extends O{constructor({name:e,colon:n,value:s},i){super(i,"<attribute>",[e,n,s]),this.name=e,this.value=s,this.colon=n}}class Z extends O{constructor({op:e,expression:n},s){super(s,"<prefix-expression>",[e,n]),this.op=e,this.expression=n}}class le extends O{constructor({op:e,leftExpression:n,rightExpression:s},i){super(i,"<infix-expression>",[n,e,s]),this.op=e,this.leftExpression=n,this.rightExpression=s}}class We extends O{constructor({op:e,expression:n},s){super(s,"<postfix-expression>",[n,e]),this.op=e,this.expression=n}}class ue extends O{constructor({value:e},n){super(n,"<function-expression>",[e]),this.value=e}}class w extends O{constructor({callee:e,args:n=[]},s){super(s,"<function-application>",[e,...n]),this.callee=e,this.args=n}}class oe extends O{constructor({blockOpenBrace:e,body:n=[],blockCloseBrace:s},i){super(i,"<block-expression>",[e,...n,s]),this.blockOpenBrace=e,this.body=n,this.blockCloseBrace=s}}class be extends O{constructor({op:e,partial:n},s){super(s,"<partial-injection>",[e,n]),this.partial=n}}class M extends O{constructor({listOpenBracket:e,elementList:n=[],commaList:s=[],listCloseBracket:i},a){super(a,"<list-expression>",[e,...St(n,s),i]),this.listOpenBracket=e,this.elementList=n,this.commaList=s,this.listCloseBracket=i}}class ce extends O{constructor({tupleOpenParen:e,elementList:n=[],commaList:s=[],tupleCloseParen:i},a){super(a,"<tuple-expression>",[e,...St(n,s),i]),this.tupleOpenParen=e,this.elementList=n,this.commaList=s,this.tupleCloseParen=i}}class et extends ce{constructor({groupOpenParen:e,expression:n,groupCloseParen:s},i){super({tupleOpenParen:e,elementList:n&&[n],commaList:[],tupleCloseParen:s},i),this.kind="<group-expression>"}}class ee extends O{constructor({callee:e,argumentList:n},s){super(s,"<call-expression>",[e,n]),this.callee=e,this.argumentList=n}}class ye extends O{constructor({literal:e},n){super(n,"<literal>",[e]),this.literal=e}}class re extends O{constructor({variable:e},n){super(n,"<variable>",[e]),this.variable=e}}class j extends O{constructor({expression:e},n){super(n,"<primary-expression>",[e]),this.expression=e}}class Me extends O{constructor({pre:e},n){const s=Q.create(u.SPACE,e.endPos,e.endPos," ",!1);super(n,"<dummy>",[s])}}class Ie extends O{constructor({expression:e,indexer:n},s){super(s,"<array>",[e,n]),this.array=e,this.indexer=n}}function St(t,e){if(!t||t.length===0)return e||[];if(!e||e.length===0)return t||[];const[n]=t,[s]=e;return(n.start<s.start?L.flatten(L.zip(t,e)):L.flatten(L.zip(e,t))).filter(i=>i!==null)}function cn(t,e=!1){return JSON.stringify(t,function(n,s){var i;return!(this instanceof K)&&n==="symbol"?s==null?void 0:s.id:n==="symbol"?{symbolTable:s==null?void 0:s.symbolTable,id:s==null?void 0:s.id,references:s==null?void 0:s.references.map(a=>a.id),declaration:(i=s==null?void 0:s.declaration)==null?void 0:i.id}:n==="referee"||n==="parent"||n==="declaration"?s==null?void 0:s.id:n==="symbolTable"?Object.fromEntries(s.table):s},e?2:0)}class U{constructor(e){this.value=e}unwrap(){return this.value}unwrap_or(e){return this.value}and_then(e){return e(this.value)}map(e){return new U(e(this.value))}isOk(){return!0}}class k{constructor(){this.value=void 0}unwrap(){throw new Error("Trying to unwrap a None value")}unwrap_or(e){return e}and_then(e){return new k}map(e){return new k}isOk(){return!1}}var m=(t=>(t.Schema="Schema",t.Table="Table",t.Column="Column",t.TableGroup="TableGroup",t.TableGroupField="TableGroup field",t.Enum="Enum",t.EnumField="Enum field",t.Note="Note",t.TablePartial="TablePartial",t.TablePartialInjection="TablePartialInjection",t))(m||{});function tt(t){return`Schema:${t}`}function Ve(t){return`Table:${t}`}function qe(t){return`Column:${t}`}function nt(t){return`Enum:${t}`}function st(t){return`Enum field:${t}`}function it(t){return`TableGroup:${t}`}function at(t){return`TableGroup field:${t}`}function un(t){return`Note:${t}`}function rt(t){return`TablePartial:${t}`}function Dt(t){return`TablePartialInjection:${t}`}function Fe(t,e){switch(e){case"Column":return qe(t);case"Enum":return nt(t);case"Enum field":return st(t);case"Schema":return tt(t);case"Table":return Ve(t);case"TableGroup":return it(t);case"TableGroup field":return at(t);case"TablePartial":return rt(t);default:throw new Error("Unreachable")}}function ie(t){const[e,n]=t.split(":");return Object.values(m).includes(e)?new U({name:n,kind:e}):new k}function hn(t){const e=ie(t).unwrap_or(void 0);if(!e)return!1;const{kind:n,name:s}=e;return n==="Schema"&&s==="public"}function fn(t){const e=ie(t).unwrap_or(void 0);if(!e)return!1;const{kind:n}=e;return n==="TablePartialInjection"}function pn(t){const e=ie(t).unwrap_or(void 0);if(!e)return null;const{kind:n,name:s}=e;return n==="TablePartialInjection"?Fe(s,"TablePartial"):null}class dn{constructor(){this.id=0}reset(){this.id=0}nextId(){return this.id++}}class Ot{constructor({symbolTable:e},n){this.references=[],this.id=n,this.symbolTable=e}}class En{constructor({symbolTable:e,declaration:n},s){this.references=[],this.id=s,this.symbolTable=e,this.declaration=n}}class Nn{constructor({declaration:e},n){this.references=[],this.id=n,this.declaration=e}}class xt{constructor({symbolTable:e,declaration:n},s){this.references=[],this.id=s,this.symbolTable=e,this.declaration=n}}class ot{constructor({declaration:e},n){this.references=[],this.id=n,this.declaration=e}}class Tn{constructor({symbolTable:e,declaration:n},s){this.references=[],this.id=s,this.symbolTable=e,this.declaration=n}}class mn{constructor({declaration:e},n){this.references=[],this.id=n,this.declaration=e}}class bn{constructor({symbolTable:e,declaration:n},s){this.references=[],this.id=s,this.symbolTable=e,this.declaration=n}}class In{constructor({declaration:e},n){this.references=[],this.id=n,this.declaration=e}}class Ln{constructor({injectorFieldSymbol:e,injectorDeclaration:n},s){this.references=[],this.id=s,this.injectorDeclaration=n,this.injectorFieldSymbol=e}}function An(t){return[tt,Ve,nt,it,qe,st,at,rt,Dt].map(e=>e(t))}function _n(t){return t instanceof ot?Ln:null}function Ye(t){return!!t.match(/(\p{L}|_|\p{M})/gu)}function Ge(t){const[e]=t;return e>="0"&&e<="9"}function gn(t){const[e]=t;return Ge(e)||Ye(e)&&e.toLowerCase()>="a"&&e.toLowerCase()<="f"}function ve(t){return Ye(t)||Ge(t)}function Et(t,e){const n=[],s=Math.min(t.length,e.length);for(let i=0;i<s;i+=1)n.push(t[i],e[i]);return n.push(...t.slice(s),...e.slice(s)),n}function Se(t,e){return t>=e.start&&t<e.end}function Rt(t){var e;return t instanceof Z?`${(e=t.op)==null?void 0:e.value}${Rt(t.expression)}`:t.expression.literal.value}function Ke(t){var e;return t instanceof Z?((e=t.op)==null?void 0:e.value)==="-"?-Ke(t.expression):Ke(t.expression):Number.parseFloat(t.expression.literal.value)}var o=(t=>(t[t.UNKNOWN_SYMBOL=1e3]="UNKNOWN_SYMBOL",t[t.UNEXPECTED_SYMBOL=1001]="UNEXPECTED_SYMBOL",t[t.UNEXPECTED_EOF=1002]="UNEXPECTED_EOF",t[t.UNEXPECTED_NEWLINE=1003]="UNEXPECTED_NEWLINE",t[t.UNKNOWN_TOKEN=1004]="UNKNOWN_TOKEN",t[t.UNEXPECTED_TOKEN=1005]="UNEXPECTED_TOKEN",t[t.UNEXPECTED_ELEMENT_DECLARATION=1006]="UNEXPECTED_ELEMENT_DECLARATION",t[t.MISSING_SPACES=1007]="MISSING_SPACES",t[t.UNKNOWN_PREFIX_OP=1008]="UNKNOWN_PREFIX_OP",t[t.INVALID_OPERAND=1009]="INVALID_OPERAND",t[t.EMPTY_ATTRIBUTE_NAME=1010]="EMPTY_ATTRIBUTE_NAME",t[t.INVALID_ESCAPE_SEQUENCE=1011]="INVALID_ESCAPE_SEQUENCE",t[t.INVALID_NAME=3e3]="INVALID_NAME",t[t.UNEXPECTED_NAME=3001]="UNEXPECTED_NAME",t[t.NAME_NOT_FOUND=3002]="NAME_NOT_FOUND",t[t.DUPLICATE_NAME=3003]="DUPLICATE_NAME",t[t.INVALID_ALIAS=3004]="INVALID_ALIAS",t[t.UNEXPECTED_ALIAS=3005]="UNEXPECTED_ALIAS",t[t.UNEXPECTED_SETTINGS=3006]="UNEXPECTED_SETTINGS",t[t.INVALID_SETTINGS=3007]="INVALID_SETTINGS",t[t.UNEXPECTED_SIMPLE_BODY=3008]="UNEXPECTED_SIMPLE_BODY",t[t.UNEXPECTED_COMPLEX_BODY=3009]="UNEXPECTED_COMPLEX_BODY",t[t.INVALID_TABLE_CONTEXT=3010]="INVALID_TABLE_CONTEXT",t[t.INVALID_TABLE_SETTING=3011]="INVALID_TABLE_SETTING",t[t.DUPLICATE_TABLE_SETTING=3012]="DUPLICATE_TABLE_SETTING",t[t.INVALID_TABLEGROUP_CONTEXT=3013]="INVALID_TABLEGROUP_CONTEXT",t[t.INVALID_TABLEGROUP_ELEMENT_NAME=3014]="INVALID_TABLEGROUP_ELEMENT_NAME",t[t.DUPLICATE_TABLEGROUP_ELEMENT_NAME=3015]="DUPLICATE_TABLEGROUP_ELEMENT_NAME",t[t.DUPLICATE_TABLEGROUP_FIELD_NAME=3016]="DUPLICATE_TABLEGROUP_FIELD_NAME",t[t.INVALID_TABLEGROUP_FIELD=3017]="INVALID_TABLEGROUP_FIELD",t[t.EMPTY_TABLE=3018]="EMPTY_TABLE",t[t.INVALID_COLUMN=3019]="INVALID_COLUMN",t[t.INVALID_COLUMN_NAME=3020]="INVALID_COLUMN_NAME",t[t.UNKNOWN_COLUMN_SETTING=3021]="UNKNOWN_COLUMN_SETTING",t[t.INVALID_COLUMN_TYPE=3022]="INVALID_COLUMN_TYPE",t[t.DUPLICATE_COLUMN_NAME=3023]="DUPLICATE_COLUMN_NAME",t[t.DUPLICATE_COLUMN_SETTING=3024]="DUPLICATE_COLUMN_SETTING",t[t.INVALID_COLUMN_SETTING_VALUE=3025]="INVALID_COLUMN_SETTING_VALUE",t[t.INVALID_ENUM_CONTEXT=3026]="INVALID_ENUM_CONTEXT",t[t.INVALID_ENUM_ELEMENT_NAME=3027]="INVALID_ENUM_ELEMENT_NAME",t[t.INVALID_ENUM_ELEMENT=3028]="INVALID_ENUM_ELEMENT",t[t.DUPLICATE_ENUM_ELEMENT_NAME=3029]="DUPLICATE_ENUM_ELEMENT_NAME",t[t.UNKNOWN_ENUM_ELEMENT_SETTING=3030]="UNKNOWN_ENUM_ELEMENT_SETTING",t[t.DUPLICATE_ENUM_ELEMENT_SETTING=3031]="DUPLICATE_ENUM_ELEMENT_SETTING",t[t.INVALID_ENUM_ELEMENT_SETTING=3032]="INVALID_ENUM_ELEMENT_SETTING",t[t.EMPTY_ENUM=3033]="EMPTY_ENUM",t[t.INVALID_REF_CONTEXT=3034]="INVALID_REF_CONTEXT",t[t.UNKNOWN_REF_SETTING=3035]="UNKNOWN_REF_SETTING",t[t.DUPLICATE_REF_SETTING=3036]="DUPLICATE_REF_SETTING",t[t.INVALID_REF_SETTING_VALUE=3037]="INVALID_REF_SETTING_VALUE",t[t.INVALID_REF_RELATIONSHIP=3038]="INVALID_REF_RELATIONSHIP",t[t.INVALID_REF_FIELD=3039]="INVALID_REF_FIELD",t[t.EMPTY_REF=3040]="EMPTY_REF",t[t.REF_REDEFINED=3041]="REF_REDEFINED",t[t.INVALID_NOTE_CONTEXT=3042]="INVALID_NOTE_CONTEXT",t[t.INVALID_NOTE=3043]="INVALID_NOTE",t[t.NOTE_REDEFINED=3044]="NOTE_REDEFINED",t[t.NOTE_CONTENT_REDEFINED=3045]="NOTE_CONTENT_REDEFINED",t[t.EMPTY_NOTE=3046]="EMPTY_NOTE",t[t.INVALID_INDEXES_CONTEXT=3047]="INVALID_INDEXES_CONTEXT",t[t.INVALID_INDEXES_FIELD=3048]="INVALID_INDEXES_FIELD",t[t.INVALID_INDEX=3049]="INVALID_INDEX",t[t.UNKNOWN_INDEX_SETTING=3050]="UNKNOWN_INDEX_SETTING",t[t.DUPLICATE_INDEX_SETTING=3051]="DUPLICATE_INDEX_SETTING",t[t.UNEXPECTED_INDEX_SETTING_VALUE=3052]="UNEXPECTED_INDEX_SETTING_VALUE",t[t.INVALID_INDEX_SETTING_VALUE=3053]="INVALID_INDEX_SETTING_VALUE",t[t.INVALID_PROJECT_CONTEXT=3054]="INVALID_PROJECT_CONTEXT",t[t.PROJECT_REDEFINED=3055]="PROJECT_REDEFINED",t[t.INVALID_PROJECT_FIELD=3056]="INVALID_PROJECT_FIELD",t[t.INVALID_CUSTOM_CONTEXT=3057]="INVALID_CUSTOM_CONTEXT",t[t.INVALID_CUSTOM_ELEMENT_VALUE=3058]="INVALID_CUSTOM_ELEMENT_VALUE",t[t.INVALID_ELEMENT_IN_SIMPLE_BODY=3059]="INVALID_ELEMENT_IN_SIMPLE_BODY",t[t.INVALID_TABLE_PARTIAL_CONTEXT=3060]="INVALID_TABLE_PARTIAL_CONTEXT",t[t.INVALID_TABLE_PARTIAL_ELEMENT_NAME=3061]="INVALID_TABLE_PARTIAL_ELEMENT_NAME",t[t.INVALID_TABLE_PARTIAL_SETTING=3062]="INVALID_TABLE_PARTIAL_SETTING",t[t.DUPLICATE_TABLE_PARTIAL_ELEMENT_NAME=3063]="DUPLICATE_TABLE_PARTIAL_ELEMENT_NAME",t[t.DUPLICATE_TABLE_PARTIAL_SETTING=3064]="DUPLICATE_TABLE_PARTIAL_SETTING",t[t.INVALID_TABLE_PARTIAL_INJECTION=3065]="INVALID_TABLE_PARTIAL_INJECTION",t[t.INVALID_TABLE_PARTIAL_INJECTION_OP=3066]="INVALID_TABLE_PARTIAL_INJECTION_OP",t[t.INVALID_TABLE_PARTIAL_INJECTION_NAME=3067]="INVALID_TABLE_PARTIAL_INJECTION_NAME",t[t.DUPLICATE_TABLE_PARTIAL_INJECTION_NAME=3068]="DUPLICATE_TABLE_PARTIAL_INJECTION_NAME",t[t.BINDING_ERROR=4e3]="BINDING_ERROR",t[t.UNSUPPORTED=5e3]="UNSUPPORTED",t[t.CIRCULAR_REF=5001]="CIRCULAR_REF",t[t.SAME_ENDPOINT=5002]="SAME_ENDPOINT",t[t.UNEQUAL_FIELDS_BINARY_REF=5003]="UNEQUAL_FIELDS_BINARY_REF",t[t.CONFLICTING_SETTING=5004]="CONFLICTING_SETTING",t[t.TABLE_REAPPEAR_IN_TABLEGROUP=5005]="TABLE_REAPPEAR_IN_TABLEGROUP",t))(o||{});class l extends Error{constructor(e,n,s){super(n),this.code=e,this.diagnostic=n,this.nodeOrToken=s,this.start=s.start,this.end=s.end,this.name=this.constructor.name,Object.setPrototypeOf(this,l.prototype)}}class J{constructor(e,n){this.value=e,this.errors=n===void 0?[]:n}getValue(){return this.value}getErrors(){return this.errors}chain(e){const n=e(this.value),s=[...this.errors,...n.errors];return new J(n.value,s)}map(e){return new J(e(this.value),this.errors)}}function vn(t,e,n){if(!t||!Ne(t)||e.length===0)return new k;const s=[...e],i=Nt(t).unwrap(),a=s.pop();if(!(a instanceof oe))return new k;const r=L.last(s)instanceof M?s.pop():void 0;if(s.length===3){const c=Nt(s[1]).value;return!c||!Ze(c)?new k:new U(n.create(y,{type:i,name:s[0],as:c,alias:s[2],attributeList:r,body:a}))}return s.length===1?new U(n.create(y,{type:i,name:s[0],attributeList:r,body:a})):s.length===0?new U(n.create(y,{type:i,attributeList:r,body:a})):new k}function Ze(t){return t.kind===u.IDENTIFIER&&t.value==="as"}function b(t){t&&(t instanceof Q?wn(t):yn(t))}function wn(t){t.kind!==u.EOF&&(t.isInvalid=!0)}function yn(t){if(t instanceof y)b(t.type),b(t.name),b(t.as),b(t.alias),b(t.bodyColon),b(t.attributeList),b(t.body);else if(t instanceof ne)t.identifiers.forEach(b);else if(t instanceof se)b(t.name),b(t.colon),b(t.value);else if(t instanceof Z)b(t.op),b(t.expression);else if(t instanceof le)b(t.leftExpression),b(t.op),b(t.rightExpression);else if(t instanceof We)b(t.op),b(t.expression);else if(t instanceof oe)b(t.blockOpenBrace),t.body.forEach(b),b(t.blockCloseBrace);else if(t instanceof M)b(t.listOpenBracket),t.commaList.forEach(b),t.elementList.forEach(b),b(t.listCloseBracket);else if(t instanceof ce)b(t.tupleOpenParen),t.commaList.forEach(b),t.elementList.forEach(b),b(t.tupleCloseParen);else if(t instanceof ee)b(t.callee),b(t.argumentList);else if(t instanceof w)b(t.callee),t.args.forEach(b);else if(t instanceof j)b(t.expression);else if(t instanceof ue)b(t.value);else if(t instanceof re)b(t.variable);else if(t instanceof ye)b(t.literal);else throw t instanceof et?new Error("This case is handled by the TupleExpressionNode case"):new Error("Unreachable case in markInvalidNode")}function Ut(t){return!!(t!=null&&t.isInvalid)}function C(...t){return t.filter(e=>e!==void 0)}function Pn(t){if(t instanceof K)return C(...t.body,t.eof);if(t instanceof y)return C(t.type,t.name,t.as,t.alias,t.attributeList,t.bodyColon,t.body);if(t instanceof se)return C(t.name,t.colon,t.value);if(t instanceof ne)return t.identifiers;if(t instanceof ye)return t.literal?[t.literal]:[];if(t instanceof re)return C(t.variable);if(t instanceof Z)return C(t.op,t.expression);if(t instanceof le)return C(t.leftExpression,t.op,t.rightExpression);if(t instanceof We)return C(t.expression,t.op);if(t instanceof ue)return C(t.value);if(t instanceof w)return C(t.callee,...t.args);if(t instanceof oe)return C(t.blockOpenBrace,...t.body,t.blockCloseBrace);if(t instanceof M)return C(t.listOpenBracket,...Et(t.elementList,t.commaList),t.listCloseBracket);if(t instanceof ce)return C(t.tupleOpenParen,...Et(t.elementList,t.commaList),t.tupleCloseParen);if(t instanceof ee)return C(t.callee,t.argumentList);if(t instanceof j)return C(t.expression);if(t instanceof Ie)return C(t.array,t.indexer);if(t instanceof be)return C(t.partial);throw t instanceof et?new Error("This case is already handled by TupleExpressionNode"):new Error("Unreachable - no other possible cases")}function Nt(t){return $(t)?new U(t.expression.variable):new k}function q(t){var e;return t instanceof j&&(t.expression instanceof re&&t.expression.variable instanceof Q&&t.expression.variable.kind===u.QUOTED_STRING||t.expression instanceof ye&&((e=t.expression.literal)==null?void 0:e.kind)===u.STRING_LITERAL)}function $(t){return t instanceof j&&t.expression instanceof re&&t.expression.variable instanceof Q}function Ne(t){var e;return t instanceof j&&t.expression instanceof re&&((e=t.expression.variable)==null?void 0:e.kind)===u.IDENTIFIER}function lt(t){var e;return t instanceof le&&t.leftExpression instanceof O&&t.rightExpression instanceof O&&((e=t.op)==null?void 0:e.value)==="."}function we(t){if(t===void 0)return new k;const e=t.identifiers.map(n=>n.value).join(" ");return e===""?new k:new U(e)}class kn{constructor(e){this.start={offset:0,line:0,column:0},this.current={offset:0,line:0,column:0},this.tokens=[],this.errors=[],this.text=e}isAtEnd(){return this.current.offset>=this.text.length}advance(){const e=this.peek();return this.current={...this.current},e===`
1
+ "use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const L=require("lodash");var u=(t=>(t.SPACE="<space>",t.TAB="<tab>",t.NEWLINE="<newline>",t.COMMA="<comma>",t.LPAREN="<lparen>",t.RPAREN="<rparen>",t.LBRACE="<lbrace>",t.RBRACE="<rbrace>",t.LBRACKET="<lbracket>",t.RBRACKET="<rbracket>",t.LANGLE="<langle>",t.RANGLE="<rangle>",t.OP="<op>",t.EOF="<eof>",t.NUMERIC_LITERAL="<number>",t.STRING_LITERAL="<string>",t.COLOR_LITERAL="<color>",t.FUNCTION_EXPRESSION="<function-expression>",t.QUOTED_STRING="<variable>",t.IDENTIFIER="<identifier>",t.SEMICOLON="<semicolon>",t.COLON="<colon>",t.TILDE="<tilde>",t.SINGLE_LINE_COMMENT="<single-line-comment>",t.MULTILINE_COMMENT="<multiline-comment>",t))(u||{});function an(t){switch(t.kind){case"<newline>":case"<space>":case"<tab>":case"<single-line-comment>":case"<multiline-comment>":return!0;default:return!1}}function rn(t){if(!t)return!1;switch(t){case"+":case"-":case"*":case"/":case"%":case"<":case">":case"=":case"!":case".":case"&":case"|":return!0;default:return!1}}function pt(t){return t!==void 0&&t.kind==="<op>"}class Q{constructor(e,n,s,i,a){this.kind=e,this.startPos=n,this.endPos=s,this.value=i,this.leadingTrivia=[],this.trailingTrivia=[],this.leadingInvalid=[],this.trailingInvalid=[],this.isInvalid=a,this.start=n.offset,this.end=s.offset}static create(e,n,s,i,a){return new Q(e,n,s,i,a)}}function yt(t){return t.trailingTrivia.find(({kind:e})=>e===u.NEWLINE)!==void 0}function dt(t,e){return e.leadingTrivia.find(({kind:s})=>s===u.NEWLINE)!==void 0||yt(t)}function Je(t){return t.trailingTrivia.find(({kind:e})=>[u.SPACE,u.TAB].includes(e))!==void 0}function Pt(t){return t.trailingTrivia.length===0?t.end:Pt(L.last(t.trailingTrivia))}function kt(t){return t.leadingTrivia.length===0?t.start:kt(t.leadingTrivia[0])}function on(t){return[u.SINGLE_LINE_COMMENT,u.MULTILINE_COMMENT].includes(t.kind)}class ln{constructor(){this.id=0}reset(){this.id=0}nextId(){return this.id++}}class O{constructor(e,n,s){this.id=e,this.kind=n;const i=s.find(r=>r!==void 0&&!Number.isNaN(r.start));i?(this.startPos=i.startPos,this.fullStart=i instanceof Q?kt(i):i.fullStart):(this.startPos={offset:NaN,column:NaN,line:NaN},this.fullStart=NaN);const a=[...s].reverse().find(r=>r!==void 0&&!Number.isNaN(r.end));a?(this.endPos=a.endPos,this.fullEnd=a instanceof Q?Pt(a):a.fullEnd):(this.endPos={offset:NaN,column:NaN,line:NaN},this.fullEnd=NaN),this.start=this.startPos.offset,this.end=this.endPos.offset}}var me=(t=>(t.PROGRAM="<program>",t.ELEMENT_DECLARATION="<element-declaration>",t.ATTRIBUTE="<attribute>",t.IDENTIFIER_STREAM="<identifer-stream>",t.LITERAL="<literal>",t.VARIABLE="<variable>",t.PREFIX_EXPRESSION="<prefix-expression>",t.INFIX_EXPRESSION="<infix-expression>",t.POSTFIX_EXPRESSION="<postfix-expression>",t.FUNCTION_EXPRESSION="<function-expression>",t.FUNCTION_APPLICATION="<function-application>",t.BLOCK_EXPRESSION="<block-expression>",t.LIST_EXPRESSION="<list-expression>",t.TUPLE_EXPRESSION="<tuple-expression>",t.CALL_EXPRESSION="<call-expression>",t.PRIMARY_EXPRESSION="<primary-expression>",t.GROUP_EXPRESSION="<group-expression>",t.DUMMY="<dummy>",t.ARRAY="<array>",t.PARTIAL_INJECTION="<partial-injection>",t))(me||{});class K extends O{constructor({body:e=[],eof:n},s){super(s,"<program>",[...e,n]),this.body=e,this.eof=n}}class y extends O{constructor({type:e,name:n,as:s,alias:i,attributeList:a,bodyColon:r,body:c},f){if(super(f,"<element-declaration>",[e,n,s,i,a,r,c]),c&&r&&!(c instanceof w||c instanceof y))throw new Error("If an element has a simple body, it must be a function application node");this.type=e,this.name=n,this.as=s,this.alias=i,this.attributeList=a,this.bodyColon=r,this.body=c}}class ne extends O{constructor({identifiers:e=[]},n){super(n,"<identifer-stream>",e||[]),this.identifiers=e}}class se extends O{constructor({name:e,colon:n,value:s},i){super(i,"<attribute>",[e,n,s]),this.name=e,this.value=s,this.colon=n}}class Z extends O{constructor({op:e,expression:n},s){super(s,"<prefix-expression>",[e,n]),this.op=e,this.expression=n}}class le extends O{constructor({op:e,leftExpression:n,rightExpression:s},i){super(i,"<infix-expression>",[n,e,s]),this.op=e,this.leftExpression=n,this.rightExpression=s}}class We extends O{constructor({op:e,expression:n},s){super(s,"<postfix-expression>",[n,e]),this.op=e,this.expression=n}}class ue extends O{constructor({value:e},n){super(n,"<function-expression>",[e]),this.value=e}}class w extends O{constructor({callee:e,args:n=[]},s){super(s,"<function-application>",[e,...n]),this.callee=e,this.args=n}}class oe extends O{constructor({blockOpenBrace:e,body:n=[],blockCloseBrace:s},i){super(i,"<block-expression>",[e,...n,s]),this.blockOpenBrace=e,this.body=n,this.blockCloseBrace=s}}class be extends O{constructor({op:e,partial:n},s){super(s,"<partial-injection>",[e,n]),this.partial=n}}class M extends O{constructor({listOpenBracket:e,elementList:n=[],commaList:s=[],listCloseBracket:i},a){super(a,"<list-expression>",[e,...St(n,s),i]),this.listOpenBracket=e,this.elementList=n,this.commaList=s,this.listCloseBracket=i}}class ce extends O{constructor({tupleOpenParen:e,elementList:n=[],commaList:s=[],tupleCloseParen:i},a){super(a,"<tuple-expression>",[e,...St(n,s),i]),this.tupleOpenParen=e,this.elementList=n,this.commaList=s,this.tupleCloseParen=i}}class et extends ce{constructor({groupOpenParen:e,expression:n,groupCloseParen:s},i){super({tupleOpenParen:e,elementList:n&&[n],commaList:[],tupleCloseParen:s},i),this.kind="<group-expression>"}}class ee extends O{constructor({callee:e,argumentList:n},s){super(s,"<call-expression>",[e,n]),this.callee=e,this.argumentList=n}}class ye extends O{constructor({literal:e},n){super(n,"<literal>",[e]),this.literal=e}}class re extends O{constructor({variable:e},n){super(n,"<variable>",[e]),this.variable=e}}class j extends O{constructor({expression:e},n){super(n,"<primary-expression>",[e]),this.expression=e}}class Me extends O{constructor({pre:e},n){const s=Q.create(u.SPACE,e.endPos,e.endPos," ",!1);super(n,"<dummy>",[s])}}class Ie extends O{constructor({expression:e,indexer:n},s){super(s,"<array>",[e,n]),this.array=e,this.indexer=n}}function St(t,e){if(!t||t.length===0)return e||[];if(!e||e.length===0)return t||[];const[n]=t,[s]=e;return(n.start<s.start?L.flatten(L.zip(t,e)):L.flatten(L.zip(e,t))).filter(i=>i!==null)}function cn(t,e=!1){return JSON.stringify(t,function(n,s){var i;return!(this instanceof K)&&n==="symbol"?s==null?void 0:s.id:n==="symbol"?{symbolTable:s==null?void 0:s.symbolTable,id:s==null?void 0:s.id,references:s==null?void 0:s.references.map(a=>a.id),declaration:(i=s==null?void 0:s.declaration)==null?void 0:i.id}:n==="referee"||n==="parent"||n==="declaration"?s==null?void 0:s.id:n==="symbolTable"?Object.fromEntries(s.table):s},e?2:0)}class U{constructor(e){this.value=e}unwrap(){return this.value}unwrap_or(e){return this.value}and_then(e){return e(this.value)}map(e){return new U(e(this.value))}isOk(){return!0}}class k{constructor(){this.value=void 0}unwrap(){throw new Error("Trying to unwrap a None value")}unwrap_or(e){return e}and_then(e){return new k}map(e){return new k}isOk(){return!1}}var m=(t=>(t.Schema="Schema",t.Table="Table",t.Column="Column",t.TableGroup="TableGroup",t.TableGroupField="TableGroup field",t.Enum="Enum",t.EnumField="Enum field",t.Note="Note",t.TablePartial="TablePartial",t.TablePartialInjection="TablePartialInjection",t))(m||{});function tt(t){return`Schema:${t}`}function Ve(t){return`Table:${t}`}function qe(t){return`Column:${t}`}function nt(t){return`Enum:${t}`}function st(t){return`Enum field:${t}`}function it(t){return`TableGroup:${t}`}function at(t){return`TableGroup field:${t}`}function un(t){return`Note:${t}`}function rt(t){return`TablePartial:${t}`}function Dt(t){return`TablePartialInjection:${t}`}function Fe(t,e){switch(e){case"Column":return qe(t);case"Enum":return nt(t);case"Enum field":return st(t);case"Schema":return tt(t);case"Table":return Ve(t);case"TableGroup":return it(t);case"TableGroup field":return at(t);case"TablePartial":return rt(t);default:throw new Error("Unreachable")}}function ie(t){const[e,n]=t.split(":");return Object.values(m).includes(e)?new U({name:n,kind:e}):new k}function hn(t){const e=ie(t).unwrap_or(void 0);if(!e)return!1;const{kind:n,name:s}=e;return n==="Schema"&&s==="public"}function fn(t){const e=ie(t).unwrap_or(void 0);if(!e)return!1;const{kind:n}=e;return n==="TablePartialInjection"}function pn(t){const e=ie(t).unwrap_or(void 0);if(!e)return null;const{kind:n,name:s}=e;return n==="TablePartialInjection"?Fe(s,"TablePartial"):null}class dn{constructor(){this.id=0}reset(){this.id=0}nextId(){return this.id++}}class Ot{constructor({symbolTable:e},n){this.references=[],this.id=n,this.symbolTable=e}}class En{constructor({symbolTable:e,declaration:n},s){this.references=[],this.id=s,this.symbolTable=e,this.declaration=n}}class Nn{constructor({declaration:e},n){this.references=[],this.id=n,this.declaration=e}}class xt{constructor({symbolTable:e,declaration:n},s){this.references=[],this.id=s,this.symbolTable=e,this.declaration=n}}class ot{constructor({declaration:e},n){this.references=[],this.id=n,this.declaration=e}}class Tn{constructor({symbolTable:e,declaration:n},s){this.references=[],this.id=s,this.symbolTable=e,this.declaration=n}}class mn{constructor({declaration:e},n){this.references=[],this.id=n,this.declaration=e}}class bn{constructor({symbolTable:e,declaration:n},s){this.references=[],this.id=s,this.symbolTable=e,this.declaration=n}}class In{constructor({declaration:e},n){this.references=[],this.id=n,this.declaration=e}}class Ln{constructor({injectorFieldSymbol:e,injectorDeclaration:n},s){this.references=[],this.id=s,this.injectorDeclaration=n,this.injectorFieldSymbol=e}}function An(t){return[tt,Ve,nt,it,qe,st,at,rt,Dt].map(e=>e(t))}function _n(t){return t instanceof ot?Ln:null}function Ye(t){return!!t.match(new RegExp("(\\p{L}|_|\\p{M})","gu"))}function Ge(t){const[e]=t;return e>="0"&&e<="9"}function gn(t){const[e]=t;return Ge(e)||Ye(e)&&e.toLowerCase()>="a"&&e.toLowerCase()<="f"}function ve(t){return Ye(t)||Ge(t)}function Et(t,e){const n=[],s=Math.min(t.length,e.length);for(let i=0;i<s;i+=1)n.push(t[i],e[i]);return n.push(...t.slice(s),...e.slice(s)),n}function Se(t,e){return t>=e.start&&t<e.end}function Rt(t){var e;return t instanceof Z?`${(e=t.op)==null?void 0:e.value}${Rt(t.expression)}`:t.expression.literal.value}function Ke(t){var e;return t instanceof Z?((e=t.op)==null?void 0:e.value)==="-"?-Ke(t.expression):Ke(t.expression):Number.parseFloat(t.expression.literal.value)}var o=(t=>(t[t.UNKNOWN_SYMBOL=1e3]="UNKNOWN_SYMBOL",t[t.UNEXPECTED_SYMBOL=1001]="UNEXPECTED_SYMBOL",t[t.UNEXPECTED_EOF=1002]="UNEXPECTED_EOF",t[t.UNEXPECTED_NEWLINE=1003]="UNEXPECTED_NEWLINE",t[t.UNKNOWN_TOKEN=1004]="UNKNOWN_TOKEN",t[t.UNEXPECTED_TOKEN=1005]="UNEXPECTED_TOKEN",t[t.UNEXPECTED_ELEMENT_DECLARATION=1006]="UNEXPECTED_ELEMENT_DECLARATION",t[t.MISSING_SPACES=1007]="MISSING_SPACES",t[t.UNKNOWN_PREFIX_OP=1008]="UNKNOWN_PREFIX_OP",t[t.INVALID_OPERAND=1009]="INVALID_OPERAND",t[t.EMPTY_ATTRIBUTE_NAME=1010]="EMPTY_ATTRIBUTE_NAME",t[t.INVALID_ESCAPE_SEQUENCE=1011]="INVALID_ESCAPE_SEQUENCE",t[t.INVALID_NAME=3e3]="INVALID_NAME",t[t.UNEXPECTED_NAME=3001]="UNEXPECTED_NAME",t[t.NAME_NOT_FOUND=3002]="NAME_NOT_FOUND",t[t.DUPLICATE_NAME=3003]="DUPLICATE_NAME",t[t.INVALID_ALIAS=3004]="INVALID_ALIAS",t[t.UNEXPECTED_ALIAS=3005]="UNEXPECTED_ALIAS",t[t.UNEXPECTED_SETTINGS=3006]="UNEXPECTED_SETTINGS",t[t.INVALID_SETTINGS=3007]="INVALID_SETTINGS",t[t.UNEXPECTED_SIMPLE_BODY=3008]="UNEXPECTED_SIMPLE_BODY",t[t.UNEXPECTED_COMPLEX_BODY=3009]="UNEXPECTED_COMPLEX_BODY",t[t.INVALID_TABLE_CONTEXT=3010]="INVALID_TABLE_CONTEXT",t[t.INVALID_TABLE_SETTING=3011]="INVALID_TABLE_SETTING",t[t.DUPLICATE_TABLE_SETTING=3012]="DUPLICATE_TABLE_SETTING",t[t.INVALID_TABLEGROUP_CONTEXT=3013]="INVALID_TABLEGROUP_CONTEXT",t[t.INVALID_TABLEGROUP_ELEMENT_NAME=3014]="INVALID_TABLEGROUP_ELEMENT_NAME",t[t.DUPLICATE_TABLEGROUP_ELEMENT_NAME=3015]="DUPLICATE_TABLEGROUP_ELEMENT_NAME",t[t.DUPLICATE_TABLEGROUP_FIELD_NAME=3016]="DUPLICATE_TABLEGROUP_FIELD_NAME",t[t.INVALID_TABLEGROUP_FIELD=3017]="INVALID_TABLEGROUP_FIELD",t[t.EMPTY_TABLE=3018]="EMPTY_TABLE",t[t.INVALID_COLUMN=3019]="INVALID_COLUMN",t[t.INVALID_COLUMN_NAME=3020]="INVALID_COLUMN_NAME",t[t.UNKNOWN_COLUMN_SETTING=3021]="UNKNOWN_COLUMN_SETTING",t[t.INVALID_COLUMN_TYPE=3022]="INVALID_COLUMN_TYPE",t[t.DUPLICATE_COLUMN_NAME=3023]="DUPLICATE_COLUMN_NAME",t[t.DUPLICATE_COLUMN_SETTING=3024]="DUPLICATE_COLUMN_SETTING",t[t.INVALID_COLUMN_SETTING_VALUE=3025]="INVALID_COLUMN_SETTING_VALUE",t[t.INVALID_ENUM_CONTEXT=3026]="INVALID_ENUM_CONTEXT",t[t.INVALID_ENUM_ELEMENT_NAME=3027]="INVALID_ENUM_ELEMENT_NAME",t[t.INVALID_ENUM_ELEMENT=3028]="INVALID_ENUM_ELEMENT",t[t.DUPLICATE_ENUM_ELEMENT_NAME=3029]="DUPLICATE_ENUM_ELEMENT_NAME",t[t.UNKNOWN_ENUM_ELEMENT_SETTING=3030]="UNKNOWN_ENUM_ELEMENT_SETTING",t[t.DUPLICATE_ENUM_ELEMENT_SETTING=3031]="DUPLICATE_ENUM_ELEMENT_SETTING",t[t.INVALID_ENUM_ELEMENT_SETTING=3032]="INVALID_ENUM_ELEMENT_SETTING",t[t.EMPTY_ENUM=3033]="EMPTY_ENUM",t[t.INVALID_REF_CONTEXT=3034]="INVALID_REF_CONTEXT",t[t.UNKNOWN_REF_SETTING=3035]="UNKNOWN_REF_SETTING",t[t.DUPLICATE_REF_SETTING=3036]="DUPLICATE_REF_SETTING",t[t.INVALID_REF_SETTING_VALUE=3037]="INVALID_REF_SETTING_VALUE",t[t.INVALID_REF_RELATIONSHIP=3038]="INVALID_REF_RELATIONSHIP",t[t.INVALID_REF_FIELD=3039]="INVALID_REF_FIELD",t[t.EMPTY_REF=3040]="EMPTY_REF",t[t.REF_REDEFINED=3041]="REF_REDEFINED",t[t.INVALID_NOTE_CONTEXT=3042]="INVALID_NOTE_CONTEXT",t[t.INVALID_NOTE=3043]="INVALID_NOTE",t[t.NOTE_REDEFINED=3044]="NOTE_REDEFINED",t[t.NOTE_CONTENT_REDEFINED=3045]="NOTE_CONTENT_REDEFINED",t[t.EMPTY_NOTE=3046]="EMPTY_NOTE",t[t.INVALID_INDEXES_CONTEXT=3047]="INVALID_INDEXES_CONTEXT",t[t.INVALID_INDEXES_FIELD=3048]="INVALID_INDEXES_FIELD",t[t.INVALID_INDEX=3049]="INVALID_INDEX",t[t.UNKNOWN_INDEX_SETTING=3050]="UNKNOWN_INDEX_SETTING",t[t.DUPLICATE_INDEX_SETTING=3051]="DUPLICATE_INDEX_SETTING",t[t.UNEXPECTED_INDEX_SETTING_VALUE=3052]="UNEXPECTED_INDEX_SETTING_VALUE",t[t.INVALID_INDEX_SETTING_VALUE=3053]="INVALID_INDEX_SETTING_VALUE",t[t.INVALID_PROJECT_CONTEXT=3054]="INVALID_PROJECT_CONTEXT",t[t.PROJECT_REDEFINED=3055]="PROJECT_REDEFINED",t[t.INVALID_PROJECT_FIELD=3056]="INVALID_PROJECT_FIELD",t[t.INVALID_CUSTOM_CONTEXT=3057]="INVALID_CUSTOM_CONTEXT",t[t.INVALID_CUSTOM_ELEMENT_VALUE=3058]="INVALID_CUSTOM_ELEMENT_VALUE",t[t.INVALID_ELEMENT_IN_SIMPLE_BODY=3059]="INVALID_ELEMENT_IN_SIMPLE_BODY",t[t.INVALID_TABLE_PARTIAL_CONTEXT=3060]="INVALID_TABLE_PARTIAL_CONTEXT",t[t.INVALID_TABLE_PARTIAL_ELEMENT_NAME=3061]="INVALID_TABLE_PARTIAL_ELEMENT_NAME",t[t.INVALID_TABLE_PARTIAL_SETTING=3062]="INVALID_TABLE_PARTIAL_SETTING",t[t.DUPLICATE_TABLE_PARTIAL_ELEMENT_NAME=3063]="DUPLICATE_TABLE_PARTIAL_ELEMENT_NAME",t[t.DUPLICATE_TABLE_PARTIAL_SETTING=3064]="DUPLICATE_TABLE_PARTIAL_SETTING",t[t.INVALID_TABLE_PARTIAL_INJECTION=3065]="INVALID_TABLE_PARTIAL_INJECTION",t[t.INVALID_TABLE_PARTIAL_INJECTION_OP=3066]="INVALID_TABLE_PARTIAL_INJECTION_OP",t[t.INVALID_TABLE_PARTIAL_INJECTION_NAME=3067]="INVALID_TABLE_PARTIAL_INJECTION_NAME",t[t.DUPLICATE_TABLE_PARTIAL_INJECTION_NAME=3068]="DUPLICATE_TABLE_PARTIAL_INJECTION_NAME",t[t.BINDING_ERROR=4e3]="BINDING_ERROR",t[t.UNSUPPORTED=5e3]="UNSUPPORTED",t[t.CIRCULAR_REF=5001]="CIRCULAR_REF",t[t.SAME_ENDPOINT=5002]="SAME_ENDPOINT",t[t.UNEQUAL_FIELDS_BINARY_REF=5003]="UNEQUAL_FIELDS_BINARY_REF",t[t.CONFLICTING_SETTING=5004]="CONFLICTING_SETTING",t[t.TABLE_REAPPEAR_IN_TABLEGROUP=5005]="TABLE_REAPPEAR_IN_TABLEGROUP",t))(o||{});class l extends Error{constructor(e,n,s){super(n),this.code=e,this.diagnostic=n,this.nodeOrToken=s,this.start=s.start,this.end=s.end,this.name=this.constructor.name,Object.setPrototypeOf(this,l.prototype)}}class J{constructor(e,n){this.value=e,this.errors=n===void 0?[]:n}getValue(){return this.value}getErrors(){return this.errors}chain(e){const n=e(this.value),s=[...this.errors,...n.errors];return new J(n.value,s)}map(e){return new J(e(this.value),this.errors)}}function vn(t,e,n){if(!t||!Ne(t)||e.length===0)return new k;const s=[...e],i=Nt(t).unwrap(),a=s.pop();if(!(a instanceof oe))return new k;const r=L.last(s)instanceof M?s.pop():void 0;if(s.length===3){const c=Nt(s[1]).value;return!c||!Ze(c)?new k:new U(n.create(y,{type:i,name:s[0],as:c,alias:s[2],attributeList:r,body:a}))}return s.length===1?new U(n.create(y,{type:i,name:s[0],attributeList:r,body:a})):s.length===0?new U(n.create(y,{type:i,attributeList:r,body:a})):new k}function Ze(t){return t.kind===u.IDENTIFIER&&t.value==="as"}function b(t){t&&(t instanceof Q?wn(t):yn(t))}function wn(t){t.kind!==u.EOF&&(t.isInvalid=!0)}function yn(t){if(t instanceof y)b(t.type),b(t.name),b(t.as),b(t.alias),b(t.bodyColon),b(t.attributeList),b(t.body);else if(t instanceof ne)t.identifiers.forEach(b);else if(t instanceof se)b(t.name),b(t.colon),b(t.value);else if(t instanceof Z)b(t.op),b(t.expression);else if(t instanceof le)b(t.leftExpression),b(t.op),b(t.rightExpression);else if(t instanceof We)b(t.op),b(t.expression);else if(t instanceof oe)b(t.blockOpenBrace),t.body.forEach(b),b(t.blockCloseBrace);else if(t instanceof M)b(t.listOpenBracket),t.commaList.forEach(b),t.elementList.forEach(b),b(t.listCloseBracket);else if(t instanceof ce)b(t.tupleOpenParen),t.commaList.forEach(b),t.elementList.forEach(b),b(t.tupleCloseParen);else if(t instanceof ee)b(t.callee),b(t.argumentList);else if(t instanceof w)b(t.callee),t.args.forEach(b);else if(t instanceof j)b(t.expression);else if(t instanceof ue)b(t.value);else if(t instanceof re)b(t.variable);else if(t instanceof ye)b(t.literal);else throw t instanceof et?new Error("This case is handled by the TupleExpressionNode case"):new Error("Unreachable case in markInvalidNode")}function Ut(t){return!!(t!=null&&t.isInvalid)}function C(...t){return t.filter(e=>e!==void 0)}function Pn(t){if(t instanceof K)return C(...t.body,t.eof);if(t instanceof y)return C(t.type,t.name,t.as,t.alias,t.attributeList,t.bodyColon,t.body);if(t instanceof se)return C(t.name,t.colon,t.value);if(t instanceof ne)return t.identifiers;if(t instanceof ye)return t.literal?[t.literal]:[];if(t instanceof re)return C(t.variable);if(t instanceof Z)return C(t.op,t.expression);if(t instanceof le)return C(t.leftExpression,t.op,t.rightExpression);if(t instanceof We)return C(t.expression,t.op);if(t instanceof ue)return C(t.value);if(t instanceof w)return C(t.callee,...t.args);if(t instanceof oe)return C(t.blockOpenBrace,...t.body,t.blockCloseBrace);if(t instanceof M)return C(t.listOpenBracket,...Et(t.elementList,t.commaList),t.listCloseBracket);if(t instanceof ce)return C(t.tupleOpenParen,...Et(t.elementList,t.commaList),t.tupleCloseParen);if(t instanceof ee)return C(t.callee,t.argumentList);if(t instanceof j)return C(t.expression);if(t instanceof Ie)return C(t.array,t.indexer);if(t instanceof be)return C(t.partial);throw t instanceof et?new Error("This case is already handled by TupleExpressionNode"):new Error("Unreachable - no other possible cases")}function Nt(t){return $(t)?new U(t.expression.variable):new k}function q(t){var e;return t instanceof j&&(t.expression instanceof re&&t.expression.variable instanceof Q&&t.expression.variable.kind===u.QUOTED_STRING||t.expression instanceof ye&&((e=t.expression.literal)==null?void 0:e.kind)===u.STRING_LITERAL)}function $(t){return t instanceof j&&t.expression instanceof re&&t.expression.variable instanceof Q}function Ne(t){var e;return t instanceof j&&t.expression instanceof re&&((e=t.expression.variable)==null?void 0:e.kind)===u.IDENTIFIER}function lt(t){var e;return t instanceof le&&t.leftExpression instanceof O&&t.rightExpression instanceof O&&((e=t.op)==null?void 0:e.value)==="."}function we(t){if(t===void 0)return new k;const e=t.identifiers.map(n=>n.value).join(" ");return e===""?new k:new U(e)}class kn{constructor(e){this.start={offset:0,line:0,column:0},this.current={offset:0,line:0,column:0},this.tokens=[],this.errors=[],this.text=e}isAtEnd(){return this.current.offset>=this.text.length}advance(){const e=this.peek();return this.current={...this.current},e===`
2
2
  `?(this.current.line+=1,this.current.column=0):this.current.column+=1,this.current.offset+=1,e}peek(e=0){if(!(this.current.offset+e>=this.text.length))return this.text[this.current.offset+e]}check(e){for(let n=0;n<e.length;n+=1)if(e[n]!==this.peek(n))return!1;return!0}match(e){return this.check(e)?(e.split("").forEach(()=>this.advance()),!0):!1}addToken(e,n=!1){this.tokens.push(this.createToken(e,n))}createToken(e,n=!1){return Q.create(e,this.start,this.current,this.text.substring(this.start.offset,this.current.offset),n)}lex(){return this.scanTokens(),this.tokens.push(Q.create(u.EOF,this.start,this.current,"",!1)),this.gatherTrivia(),this.gatherInvalid(),new J(this.tokens,this.errors)}scanTokens(){for(;!this.isAtEnd();){const e=this.advance();switch(e){case" ":this.addToken(u.SPACE);break;case"\r":break;case`
3
3
  `:this.addToken(u.NEWLINE);break;case" ":this.addToken(u.TAB);break;case",":this.addToken(u.COMMA);break;case"(":this.addToken(u.LPAREN);break;case")":this.addToken(u.RPAREN);break;case"[":this.addToken(u.LBRACKET);break;case"]":this.addToken(u.RBRACKET);break;case"{":this.addToken(u.LBRACE);break;case"}":this.addToken(u.RBRACE);break;case";":this.addToken(u.SEMICOLON);break;case":":this.addToken(u.COLON);break;case"~":this.addToken(u.TILDE);break;case"'":this.match("''")?this.multilineStringLiteral():this.singleLineStringLiteral();break;case'"':this.quotedVariable();break;case"`":this.functionExpression();break;case"#":this.colorLiteral();break;case"/":this.match("/")?this.singleLineComment():this.match("*")?this.multilineComment():this.operator(e);break;default:if(rn(e)){this.operator(e);break}if(Ye(e)){this.identifier();break}if(Ge(e)){this.numericLiteralOrIdentifier();break}this.addToken(u.OP,!0),this.errors.push(new l(o.UNKNOWN_SYMBOL,`Unexpected token '${e}'`,this.createToken(u.OP,!0)));break}this.start={...this.current}}}gatherTrivia(){let e=!0,n=[],s;const i=[];for(const a of this.tokens)an(a)?(n.push(a),a.kind===u.NEWLINE&&s&&(s.trailingTrivia=n,e=!0,s=void 0,n=[])):(e?a.leadingTrivia=n:s.trailingTrivia=n,i.push(a),n=[],s=a,e=!1);this.tokens=i}gatherInvalid(){let e;const n=[],s=[];for(e=0;e<this.tokens.length&&Ut(this.tokens[e]);e+=1)s.push(this.tokens[e]);let i=this.tokens[e];for(i.leadingInvalid=[...s,...i.leadingInvalid];e<this.tokens.length;e+=1){const a=this.tokens[e];a.isInvalid?i.trailingInvalid.push(a):(i=a,n.push(a))}this.tokens=n}consumeUntil(e,n,{allowNewline:s,allowEof:i,raw:a,consumeStopSequence:r=!0}){let c="";for(;!this.isAtEnd()&&(s||!this.check(`
4
4
  `))&&!this.check(n);)this.peek()==="\\"&&!a?(this.advance(),c+=this.escapedString()):c+=this.advance();if(this.isAtEnd()&&!i){const f=this.createToken(e,!0);this.tokens.push(f),this.errors.push(new l(o.UNEXPECTED_EOF,"EOF reached while parsing",f));return}if(this.check(`
@@ -408,15 +408,13 @@ function En(t) {
408
408
  }
409
409
  function Nn(t) {
410
410
  const e = ie(t).unwrap_or(void 0);
411
- if (!e)
412
- return !1;
411
+ if (!e) return !1;
413
412
  const { kind: n } = e;
414
413
  return n === "TablePartialInjection";
415
414
  }
416
415
  function Tn(t) {
417
416
  const e = ie(t).unwrap_or(void 0);
418
- if (!e)
419
- return null;
417
+ if (!e) return null;
420
418
  const { kind: n, name: s } = e;
421
419
  return n === "TablePartialInjection" ? Fe(
422
420
  s,
@@ -502,7 +500,7 @@ function yn(t) {
502
500
  return t instanceof ct ? vn : null;
503
501
  }
504
502
  function ze(t) {
505
- return !!t.match(/(\p{L}|_|\p{M})/gu);
503
+ return !!t.match(new RegExp("(\\p{L}|_|\\p{M})", "gu"));
506
504
  }
507
505
  function Xe(t) {
508
506
  const [e] = t;
@@ -631,8 +629,7 @@ function Dn(t) {
631
629
  b(t.variable);
632
630
  else if (t instanceof ye)
633
631
  b(t.literal);
634
- else
635
- throw t instanceof nt ? new Error("This case is handled by the TupleExpressionNode case") : new Error("Unreachable case in markInvalidNode");
632
+ else throw t instanceof nt ? new Error("This case is handled by the TupleExpressionNode case") : new Error("Unreachable case in markInvalidNode");
636
633
  }
637
634
  function Bt(t) {
638
635
  return !!(t != null && t.isInvalid);
@@ -694,8 +691,7 @@ function xn(t) {
694
691
  t.array,
695
692
  t.indexer
696
693
  );
697
- if (t instanceof be)
698
- return C(t.partial);
694
+ if (t instanceof be) return C(t.partial);
699
695
  throw t instanceof nt ? new Error("This case is already handled by TupleExpressionNode") : new Error("Unreachable - no other possible cases");
700
696
  }
701
697
  function mt(t) {
@@ -2038,8 +2034,7 @@ class qn {
2038
2034
  "An Indexes can only appear inside a Table or a TablePartial",
2039
2035
  this.declarationNode
2040
2036
  );
2041
- if (this.declarationNode.parent instanceof K)
2042
- return [e];
2037
+ if (this.declarationNode.parent instanceof K) return [e];
2043
2038
  const n = Le(this.declarationNode.parent).unwrap_or(void 0);
2044
2039
  return n && [I.Table, I.TablePartial].includes(n) ? [] : [e];
2045
2040
  }
@@ -2140,8 +2135,7 @@ class Hn {
2140
2135
  if (!e)
2141
2136
  return [new l(o.INVALID_NAME, "Sticky note must have a name", this.declarationNode)];
2142
2137
  const n = q(e);
2143
- if (!n.isOk())
2144
- return [new l(o.INVALID_NAME, "Invalid name for sticky note ", this.declarationNode)];
2138
+ if (!n.isOk()) return [new l(o.INVALID_NAME, "Invalid name for sticky note ", this.declarationNode)];
2145
2139
  const i = n.unwrap().join("."), a = dn(i);
2146
2140
  return this.publicSymbolTable.has(a) ? [new l(o.DUPLICATE_NAME, `Sticky note "${i}" has already been defined`, e)] : (this.publicSymbolTable.set(a, this.declarationNode.symbol), []);
2147
2141
  }
@@ -2248,8 +2242,7 @@ class Qn {
2248
2242
  if (g.last(i) instanceof M) {
2249
2243
  const a = this.validateFieldSettings(g.last(i));
2250
2244
  n.push(...a), i.pop();
2251
- } else
2252
- i[0] instanceof M && (n.push(...this.validateFieldSettings(i[0])), i.shift());
2245
+ } else i[0] instanceof M && (n.push(...this.validateFieldSettings(i[0])), i.shift());
2253
2246
  i.length > 0 && n.push(...i.map((a) => new l(o.INVALID_REF_FIELD, "A Ref field should only have a single binary relationship", a)));
2254
2247
  }), n;
2255
2248
  }
@@ -2374,8 +2367,7 @@ class Kn {
2374
2367
  }
2375
2368
  registerInjection(e) {
2376
2369
  var c, f, p;
2377
- if (!((f = (c = e.partial) == null ? void 0 : c.variable) != null && f.value))
2378
- return [];
2370
+ if (!((f = (c = e.partial) == null ? void 0 : c.variable) != null && f.value)) return [];
2379
2371
  const n = (p = e.partial.variable) == null ? void 0 : p.value, s = Rt(n), i = this.symbolFactory.create(gn, { declaration: e });
2380
2372
  e.symbol = i;
2381
2373
  const a = this.declarationNode.symbol.symbolTable, r = a.get(s);
@@ -2599,8 +2591,7 @@ class es {
2599
2591
  }), s;
2600
2592
  }
2601
2593
  validateBody(e) {
2602
- if (!e)
2603
- return [];
2594
+ if (!e) return [];
2604
2595
  if (e instanceof w)
2605
2596
  return [new l(
2606
2597
  o.UNEXPECTED_SIMPLE_BODY,
@@ -2711,14 +2702,12 @@ class ns {
2711
2702
  const { name: e } = this.declarationNode;
2712
2703
  this.declarationNode.symbol = this.symbolFactory.create(_n, { declaration: this.declarationNode, symbolTable: new ke() });
2713
2704
  const n = q(e);
2714
- if (!n.isOk())
2715
- return [];
2705
+ if (!n.isOk()) return [];
2716
2706
  const s = n.unwrap(), i = s.pop(), a = Qe(s, this.publicSymbolTable, this.symbolFactory), r = lt(i);
2717
2707
  return a.has(r) ? [new l(o.DUPLICATE_NAME, `TablePartial name '${i}' already exists`, e)] : (a.set(r, this.declarationNode.symbol), []);
2718
2708
  }
2719
2709
  validateBody(e) {
2720
- if (!e)
2721
- return [];
2710
+ if (!e) return [];
2722
2711
  if (e instanceof w)
2723
2712
  return [new l(o.UNEXPECTED_SIMPLE_BODY, "A TablePartial's body must be a block", e)];
2724
2713
  const [n, s] = g.partition(e.body, (i) => i instanceof w);
@@ -2729,8 +2718,7 @@ class ns {
2729
2718
  }
2730
2719
  validateFields(e) {
2731
2720
  return e.flatMap((n) => {
2732
- if (!n.callee)
2733
- return [];
2721
+ if (!n.callee) return [];
2734
2722
  const s = [];
2735
2723
  n.args.length === 0 && s.push(new l(o.INVALID_COLUMN, "A column must have a type", n.callee)), $(n.callee) || s.push(new l(o.INVALID_COLUMN_NAME, "A column name must be an identifier or a quoted identifier", n.callee)), n.args[0] && !jt(n.args[0]) && s.push(new l(o.INVALID_COLUMN_TYPE, "Invalid column type", n.args[0]));
2736
2724
  const i = n.args.slice(1);
@@ -2741,8 +2729,7 @@ class ns {
2741
2729
  });
2742
2730
  }
2743
2731
  registerField(e) {
2744
- if (!e.callee || !$(e.callee))
2745
- return [];
2732
+ if (!e.callee || !$(e.callee)) return [];
2746
2733
  const n = X(e.callee).unwrap(), s = He(n), i = this.symbolFactory.create(ct, { declaration: e });
2747
2734
  e.symbol = i;
2748
2735
  const a = this.declarationNode.symbol.symbolTable;
@@ -2760,8 +2747,7 @@ class ns {
2760
2747
  const n = Ve(e);
2761
2748
  if (!e.slice(0, -1).every(Ne) || !(Ne(n) || n instanceof M))
2762
2749
  return [...e.map((p) => new l(o.INVALID_COLUMN, "These fields must be some inline settings optionally ended with a setting list", p))];
2763
- if (e.length === 0)
2764
- return [];
2750
+ if (e.length === 0) return [];
2765
2751
  let s;
2766
2752
  g.last(e) instanceof M && (s = e.pop());
2767
2753
  const i = F(s), a = i.getErrors(), r = i.getValue();
@@ -3004,28 +2990,23 @@ class fe {
3004
2990
  }
3005
2991
  bindSettingList(e, n) {
3006
2992
  e && e.elementList.forEach((s) => {
3007
- if (s.name instanceof j)
3008
- return;
2993
+ if (s.name instanceof j) return;
3009
2994
  const i = we(s.name).unwrap_or(void 0);
3010
- if (!i)
3011
- return;
2995
+ if (!i) return;
3012
2996
  const a = n[i.toLowerCase()];
3013
2997
  a != null && a.shouldBind && this.scanAndBind(s.value, a);
3014
2998
  });
3015
2999
  }
3016
3000
  bindBody() {
3017
3001
  const e = this.declarationNode;
3018
- if (!e.body)
3019
- return;
3002
+ if (!e.body) return;
3020
3003
  const { body: n } = e;
3021
3004
  n instanceof oe ? n.body.forEach((s) => {
3022
3005
  if (s instanceof y) {
3023
- if (!s.type || Le(this.declarationNode).unwrap_or(null) === I.TablePartial && Le(s).unwrap_or(null) === I.Indexes)
3024
- return;
3006
+ if (!s.type || Le(this.declarationNode).unwrap_or(null) === I.TablePartial && Le(s).unwrap_or(null) === I.Indexes) return;
3025
3007
  const i = Wt(s);
3026
3008
  new i(s, this.errors).bind();
3027
- } else
3028
- s instanceof w ? this.bindSubfield(s) : this.bindPartialInjection(s);
3009
+ } else s instanceof w ? this.bindSubfield(s) : this.bindPartialInjection(s);
3029
3010
  }) : this.bindSubfield(n);
3030
3011
  }
3031
3012
  bindSubfield(e) {
@@ -3047,21 +3028,18 @@ class fe {
3047
3028
  if (e.expression instanceof re && ((i = n.keywords) != null && i.includes((s = e.expression.variable) == null ? void 0 : s.value.toLowerCase())))
3048
3029
  return;
3049
3030
  this.bindFragments([e], n);
3050
- } else
3051
- e instanceof le ? ut(e) ? this.bindFragments(_e(e).unwrap_or([]), n) : (this.scanAndBind(e.leftExpression, n), this.scanAndBind(e.rightExpression, n)) : e instanceof Z ? this.scanAndBind(e.expression, n) : e instanceof qe ? this.scanAndBind(e.expression, n) : e instanceof ce ? e.elementList.forEach((a) => this.scanAndBind(a, n)) : e instanceof be && this.bindFragments([e], n);
3031
+ } else e instanceof le ? ut(e) ? this.bindFragments(_e(e).unwrap_or([]), n) : (this.scanAndBind(e.leftExpression, n), this.scanAndBind(e.rightExpression, n)) : e instanceof Z ? this.scanAndBind(e.expression, n) : e instanceof qe ? this.scanAndBind(e.expression, n) : e instanceof ce ? e.elementList.forEach((a) => this.scanAndBind(a, n)) : e instanceof be && this.bindFragments([e], n);
3052
3032
  }
3053
3033
  // Bind the fragments of a member access expression
3054
3034
  // which can be a simple expression like v1.User,
3055
3035
  // or a complex tuple like v1.User.(id, name)
3056
3036
  bindFragments(e, n) {
3057
- if (e.length === 0)
3058
- return;
3037
+ if (e.length === 0) return;
3059
3038
  const s = e.length === 1 && e[0] instanceof be, i = [...n.topSubnamesSymbolKind], { remainingSubnamesSymbolKind: a } = n, r = s ? -1 : e.findIndex((N) => !$(N)), f = r !== -1 && $t(e[r]) ? e[r] : void 0, p = r >= 0 ? i.pop() : void 0, h = e.slice(
3060
3039
  0,
3061
3040
  r === -1 ? void 0 : r
3062
3041
  );
3063
- if (h.length === 0)
3064
- return;
3042
+ if (h.length === 0) return;
3065
3043
  const d = [];
3066
3044
  for (; i.length && h.length; ) {
3067
3045
  const N = i.pop(), L = h.pop(), v = X(L).unwrap();
@@ -3126,21 +3104,18 @@ class fe {
3126
3104
  resolveInjections(e) {
3127
3105
  var i;
3128
3106
  const n = (i = this.declarationNode.symbol) == null ? void 0 : i.symbolTable;
3129
- if (!n)
3130
- return;
3107
+ if (!n) return;
3131
3108
  const s = /* @__PURE__ */ new Map();
3132
3109
  n.forEach((a, r) => {
3133
3110
  var p, h;
3134
- if (!Nn(r))
3135
- return;
3111
+ if (!Nn(r)) return;
3136
3112
  const c = Lt(Tn(r), this.declarationNode), f = (h = (p = c == null ? void 0 : c.declaration) == null ? void 0 : p.symbol) == null ? void 0 : h.symbolTable;
3137
3113
  f && f.forEach((d, N) => {
3138
3114
  n.has(N) || s.set(N, { injectorFieldSymbol: d, injectorDeclaration: a.declaration });
3139
3115
  });
3140
3116
  }), s.forEach((a, r) => {
3141
3117
  const c = yn(a.injectorFieldSymbol);
3142
- if (!c)
3143
- return;
3118
+ if (!c) return;
3144
3119
  const f = e.create(c, a);
3145
3120
  n.set(r, f);
3146
3121
  });
@@ -3344,8 +3319,7 @@ class ps {
3344
3319
  }
3345
3320
  resolve(e) {
3346
3321
  return this.ast.body.map((n) => {
3347
- if (!n.type)
3348
- return null;
3322
+ if (!n.type) return null;
3349
3323
  const s = Wt(n), i = new s(n, this.errors);
3350
3324
  return i.resolveInjections(e), i;
3351
3325
  }).forEach((n) => n == null ? void 0 : n.bind()), new J(this.ast, this.errors);
@@ -4048,8 +4022,7 @@ class en {
4048
4022
  }, s.type = W((N = (d = L[E.Type]) == null ? void 0 : d.at(0)) == null ? void 0 : N.value).unwrap_or(void 0);
4049
4023
  }
4050
4024
  return a.flatMap((L) => {
4051
- if (!(L instanceof ee))
4052
- return L;
4025
+ if (!(L instanceof ee)) return L;
4053
4026
  const v = [];
4054
4027
  let A = L;
4055
4028
  for (; A instanceof ee; )
@@ -4388,8 +4361,7 @@ function vt(t, e, n) {
4388
4361
  }
4389
4362
  function wt(t, e) {
4390
4363
  const n = t.container.element(e);
4391
- if (n instanceof K)
4392
- return G();
4364
+ if (n instanceof K) return G();
4393
4365
  const s = t.container.scopeKind(e);
4394
4366
  if (n.body && !Se(e, n.body)) {
4395
4367
  let i;
@@ -4626,8 +4598,7 @@ function ws(t) {
4626
4598
  ...Ke({
4627
4599
  suggestions: [...t.parse.publicSymbolTable().entries()].flatMap(([e]) => {
4628
4600
  const n = ie(e).unwrap_or(void 0);
4629
- if (n === void 0)
4630
- return [];
4601
+ if (n === void 0) return [];
4631
4602
  const { kind: s, name: i } = n;
4632
4603
  return s !== m.Table && s !== m.Schema ? [] : {
4633
4604
  label: i,
@@ -4748,8 +4719,7 @@ function an(t, e) {
4748
4719
  });
4749
4720
  }
4750
4721
  function pt(t, e) {
4751
- if (!e.callee)
4752
- return -1;
4722
+ if (!e.callee) return -1;
4753
4723
  const n = [e.callee, ...e.args], s = n.findIndex((i) => t <= i.end);
4754
4724
  return s === -1 ? n.length : s;
4755
4725
  }
@@ -4762,8 +4732,7 @@ class rn {
4762
4732
  const { uri: s } = e, i = ft(e, n), a = [...this.compiler.container.stack(i)];
4763
4733
  for (; a.length !== 0; ) {
4764
4734
  const f = a.pop();
4765
- if (!(f != null && f.referee))
4766
- continue;
4735
+ if (!(f != null && f.referee)) continue;
4767
4736
  let p;
4768
4737
  if ((r = f.referee) != null && r.declaration && [
4769
4738
  me.PRIMARY_EXPRESSION,
@@ -4892,8 +4861,7 @@ class xs {
4892
4861
  for (let N = h.end; N < e; N += 1)
4893
4862
  d[N] === `
4894
4863
  ` && (f.pop(), p = !0);
4895
- } else
4896
- h instanceof Z || h instanceof le ? this.container.token(e).token !== h.op && (f.pop(), p = !0) : h instanceof M ? h.listCloseBracket && h.end <= e && (f.pop(), p = !0) : h instanceof ce ? h.tupleCloseParen && h.end <= e && (f.pop(), p = !0) : h instanceof oe ? h.blockCloseBrace && h.end <= e && (f.pop(), p = !0) : h instanceof ne || h.end < e && (f.pop(), p = !0);
4864
+ } else h instanceof Z || h instanceof le ? this.container.token(e).token !== h.op && (f.pop(), p = !0) : h instanceof M ? h.listCloseBracket && h.end <= e && (f.pop(), p = !0) : h instanceof ce ? h.tupleCloseParen && h.end <= e && (f.pop(), p = !0) : h instanceof oe ? h.blockCloseBrace && h.end <= e && (f.pop(), p = !0) : h instanceof ne || h.end < e && (f.pop(), p = !0);
4897
4865
  if (p) {
4898
4866
  const d = Ve(f);
4899
4867
  d instanceof y && d.end <= e && f.pop();
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@dbml/parse",
3
- "version": "3.13.5",
3
+ "version": "3.13.6",
4
4
  "description": "> TODO: description",
5
5
  "author": "Holistics <dev@holistics.io>",
6
6
  "license": "Apache-2.0",
@@ -38,9 +38,9 @@
38
38
  "@typescript-eslint/parser": "^8.30.1",
39
39
  "monaco-editor-core": "^0.44.0",
40
40
  "typescript": "^5.2.2",
41
- "vite": "^4.5.0",
42
- "vite-plugin-dts": "^4.1.1",
43
- "vitest": "^0.34.6"
41
+ "vite": "^6.3.5",
42
+ "vite-plugin-dts": "^4.5.4",
43
+ "vitest": "^3.1.4"
44
44
  },
45
45
  "dependencies": {
46
46
  "lodash": "^4.17.21"
@@ -48,5 +48,8 @@
48
48
  "peerDependencies": {
49
49
  "lodash": "^4.17.21"
50
50
  },
51
- "gitHead": "7496d9e42bdd83b9605fe620234433afca3f0d37"
51
+ "engines": {
52
+ "node": ">=18"
53
+ },
54
+ "gitHead": "a36ce92fe9350c5a509aa37a3bb0bb35fb3e82a0"
52
55
  }