UNPKG

monaco-editor

Version:
16 lines (13 loc) 85.6 kB
define("vs/language/json/json.worker",["../../initialize-DL0l1TGY","../../main-BEx-Fmlo","../../main-DsK8pnKg","../../index-049xrXrp"],(function(Me,j,v,p){"use strict";function W(n,e){if(n===e)return!0;if(n==null||e===null||e===void 0||typeof n!=typeof e||typeof n!="object"||Array.isArray(n)!==Array.isArray(e))return!1;let t,r;if(Array.isArray(n)){if(n.length!==e.length)return!1;for(t=0;t<n.length;t++)if(!W(n[t],e[t]))return!1}else{const i=[];for(r in n)i.push(r);i.sort();const s=[];for(r in e)s.push(r);if(s.sort(),!W(i,s))return!1;for(t=0;t<i.length;t++)if(!W(n[i[t]],e[i[t]]))return!1}return!0}function F(n){return typeof n=="number"}function E(n){return typeof n<"u"}function _(n){return typeof n=="boolean"}function he(n){return typeof n=="string"}function K(n){return typeof n=="object"&&n!==null&&!Array.isArray(n)}function Le(n,e){if(n.length<e.length)return!1;for(let t=0;t<e.length;t++)if(n[t]!==e[t])return!1;return!0}function z(n,e){const t=n.length-e.length;return t>0?n.lastIndexOf(e)===t:t===0?n===e:!1}function X(n){let e="";Le(n,"(?i)")&&(n=n.substring(4),e="i");try{return new RegExp(n,e+"u")}catch{try{return new RegExp(n,e)}catch{return}}}function me(n){let e=0;for(let t=0;t<n.length;t++){e++;const r=n.charCodeAt(t);55296<=r&&r<=56319&&t++}return e}var x;(function(n){n[n.Undefined=0]="Undefined",n[n.EnumValueMismatch=1]="EnumValueMismatch",n[n.Deprecated=2]="Deprecated",n[n.UnexpectedEndOfComment=257]="UnexpectedEndOfComment",n[n.UnexpectedEndOfString=258]="UnexpectedEndOfString",n[n.UnexpectedEndOfNumber=259]="UnexpectedEndOfNumber",n[n.InvalidUnicode=260]="InvalidUnicode",n[n.InvalidEscapeCharacter=261]="InvalidEscapeCharacter",n[n.InvalidCharacter=262]="InvalidCharacter",n[n.PropertyExpected=513]="PropertyExpected",n[n.CommaExpected=514]="CommaExpected",n[n.ColonExpected=515]="ColonExpected",n[n.ValueExpected=516]="ValueExpected",n[n.CommaOrCloseBacketExpected=517]="CommaOrCloseBacketExpected",n[n.CommaOrCloseBraceExpected=518]="CommaOrCloseBraceExpected",n[n.TrailingComma=519]="TrailingComma",n[n.DuplicateKey=520]="DuplicateKey",n[n.CommentNotPermitted=521]="CommentNotPermitted",n[n.PropertyKeysMustBeDoublequoted=528]="PropertyKeysMustBeDoublequoted",n[n.SchemaResolveError=768]="SchemaResolveError",n[n.SchemaUnsupportedFeature=769]="SchemaUnsupportedFeature"})(x||(x={}));var R;(function(n){n[n.v3=3]="v3",n[n.v4=4]="v4",n[n.v6=6]="v6",n[n.v7=7]="v7",n[n.v2019_09=19]="v2019_09",n[n.v2020_12=20]="v2020_12"})(R||(R={}));var re;(function(n){n.LATEST={textDocument:{completion:{completionItem:{documentationFormat:[v.MarkupKind.Markdown,v.MarkupKind.PlainText],commitCharactersSupport:!0,labelDetailsSupport:!0}}}}})(re||(re={}));const Fe={"color-hex":{errorMessage:p.t("Invalid color format. Use #RGB, #RGBA, #RRGGBB or #RRGGBBAA."),pattern:/^#([0-9A-Fa-f]{3,4}|([0-9A-Fa-f]{2}){3,4})$/},"date-time":{errorMessage:p.t("String is not a RFC3339 date-time."),pattern:/^(\d{4})-(0[1-9]|1[0-2])-(0[1-9]|[12][0-9]|3[01])T([01][0-9]|2[0-3]):([0-5][0-9]):([0-5][0-9]|60)(\.[0-9]+)?(Z|(\+|-)([01][0-9]|2[0-3]):([0-5][0-9]))$/i},date:{errorMessage:p.t("String is not a RFC3339 date."),pattern:/^(\d{4})-(0[1-9]|1[0-2])-(0[1-9]|[12][0-9]|3[01])$/i},time:{errorMessage:p.t("String is not a RFC3339 time."),pattern:/^([01][0-9]|2[0-3]):([0-5][0-9]):([0-5][0-9]|60)(\.[0-9]+)?(Z|(\+|-)([01][0-9]|2[0-3]):([0-5][0-9]))$/i},email:{errorMessage:p.t("String is not an e-mail address."),pattern:/^(([^<>()\[\]\\.,;:\s@"]+(\.[^<>()\[\]\\.,;:\s@"]+)*)|(".+"))@((\[[0-9]{1,3}\.[0-9]{1,3}\.[0-9]{1,3}\.[0-9]{1,3}])|(([a-zA-Z0-9-]+\.)+[a-zA-Z]{2,}))$/},hostname:{errorMessage:p.t("String is not a hostname."),pattern:/^(?=.{1,253}\.?$)[a-z0-9](?:[a-z0-9-]{0,61}[a-z0-9])?(?:\.[a-z0-9](?:[-0-9a-z]{0,61}[0-9a-z])?)*\.?$/i},ipv4:{errorMessage:p.t("String is not an IPv4 address."),pattern:/^(?:(?:25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)\.){3}(?:25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)$/},ipv6:{errorMessage:p.t("String is not an IPv6 address."),pattern:/^((([0-9a-f]{1,4}:){7}([0-9a-f]{1,4}|:))|(([0-9a-f]{1,4}:){6}(:[0-9a-f]{1,4}|((25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)(\.(25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)){3})|:))|(([0-9a-f]{1,4}:){5}(((:[0-9a-f]{1,4}){1,2})|:((25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)(\.(25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)){3})|:))|(([0-9a-f]{1,4}:){4}(((:[0-9a-f]{1,4}){1,3})|((:[0-9a-f]{1,4})?:((25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)(\.(25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)){3}))|:))|(([0-9a-f]{1,4}:){3}(((:[0-9a-f]{1,4}){1,4})|((:[0-9a-f]{1,4}){0,2}:((25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)(\.(25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)){3}))|:))|(([0-9a-f]{1,4}:){2}(((:[0-9a-f]{1,4}){1,5})|((:[0-9a-f]{1,4}){0,3}:((25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)(\.(25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)){3}))|:))|(([0-9a-f]{1,4}:){1}(((:[0-9a-f]{1,4}){1,6})|((:[0-9a-f]{1,4}){0,4}:((25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)(\.(25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)){3}))|:))|(:(((:[0-9a-f]{1,4}){1,7})|((:[0-9a-f]{1,4}){0,5}:((25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)(\.(25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)){3}))|:)))$/i}};class q{constructor(e,t,r=0){this.offset=t,this.length=r,this.parent=e}get children(){return[]}toString(){return"type: "+this.type+" ("+this.offset+"/"+this.length+")"+(this.parent?" parent: {"+this.parent.toString()+"}":"")}}class De extends q{constructor(e,t){super(e,t),this.type="null",this.value=null}}class ge extends q{constructor(e,t,r){super(e,r),this.type="boolean",this.value=t}}class $e extends q{constructor(e,t){super(e,t),this.type="array",this.items=[]}get children(){return this.items}}class je extends q{constructor(e,t){super(e,t),this.type="number",this.isInteger=!0,this.value=Number.NaN}}class ne extends q{constructor(e,t,r){super(e,t,r),this.type="string",this.value=""}}class Ee extends q{constructor(e,t,r){super(e,t),this.type="property",this.colonOffset=-1,this.keyNode=r}get children(){return this.valueNode?[this.keyNode,this.valueNode]:[this.keyNode]}}class Re extends q{constructor(e,t){super(e,t),this.type="object",this.properties=[]}get children(){return this.properties}}function $(n){return _(n)?n?{}:{not:{}}:n}var de;(function(n){n[n.Key=0]="Key",n[n.Enum=1]="Enum"})(de||(de={}));const _e={"http://json-schema.org/draft-03/schema#":R.v3,"http://json-schema.org/draft-04/schema#":R.v4,"http://json-schema.org/draft-06/schema#":R.v6,"http://json-schema.org/draft-07/schema#":R.v7,"https://json-schema.org/draft/2019-09/schema":R.v2019_09,"https://json-schema.org/draft/2020-12/schema":R.v2020_12};class ye{constructor(e){this.schemaDraft=e}}class se{constructor(e=-1,t){this.focusOffset=e,this.exclude=t,this.schemas=[]}add(e){this.schemas.push(e)}merge(e){Array.prototype.push.apply(this.schemas,e.schemas)}include(e){return(this.focusOffset===-1||be(e,this.focusOffset))&&e!==this.exclude}newSub(){return new se(-1,this.exclude)}}class H{constructor(){}get schemas(){return[]}add(e){}merge(e){}include(e){return!0}newSub(){return this}}H.instance=new H;class D{constructor(){this.problems=[],this.propertiesMatches=0,this.processedProperties=new Set,this.propertiesValueMatches=0,this.primaryValueMatches=0,this.enumValueMatch=!1,this.enumValues=void 0}hasProblems(){return!!this.problems.length}merge(e){this.problems=this.problems.concat(e.problems),this.propertiesMatches+=e.propertiesMatches,this.propertiesValueMatches+=e.propertiesValueMatches,this.mergeProcessedProperties(e)}mergeEnumValues(e){if(!this.enumValueMatch&&!e.enumValueMatch&&this.enumValues&&e.enumValues){this.enumValues=this.enumValues.concat(e.enumValues);for(const t of this.problems)t.code===x.EnumValueMismatch&&(t.message=p.t("Value is not accepted. Valid values: {0}.",this.enumValues.map(r=>JSON.stringify(r)).join(", ")))}}mergePropertyMatch(e){this.problems=this.problems.concat(e.problems),this.propertiesMatches++,(e.enumValueMatch||!e.hasProblems()&&e.propertiesMatches)&&this.propertiesValueMatches++,e.enumValueMatch&&e.enumValues&&e.enumValues.length===1&&this.primaryValueMatches++}mergeProcessedProperties(e){e.processedProperties.forEach(t=>this.processedProperties.add(t))}compare(e){const t=this.hasProblems();return t!==e.hasProblems()?t?-1:1:this.enumValueMatch!==e.enumValueMatch?e.enumValueMatch?-1:1:this.primaryValueMatches!==e.primaryValueMatches?this.primaryValueMatches-e.primaryValueMatches:this.propertiesValueMatches!==e.propertiesValueMatches?this.propertiesValueMatches-e.propertiesValueMatches:this.propertiesMatches-e.propertiesMatches}}function Ke(n,e=[]){return new Se(n,e,[])}function B(n){return j.getNodeValue(n)}function ie(n){return j.getNodePath(n)}function be(n,e,t=!1){return e>=n.offset&&e<n.offset+n.length||t&&e===n.offset+n.length}class Se{constructor(e,t=[],r=[]){this.root=e,this.syntaxErrors=t,this.comments=r}getNodeFromOffset(e,t=!1){if(this.root)return j.findNodeAtOffset(this.root,e,t)}visit(e){if(this.root){const t=r=>{let i=e(r);const s=r.children;if(Array.isArray(s))for(let c=0;c<s.length&&i;c++)i=t(s[c]);return i};t(this.root)}}validate(e,t,r=v.DiagnosticSeverity.Warning,i){if(this.root&&t){const s=new D;return M(this.root,t,s,H.instance,new ye(i??ve(t))),s.problems.map(c=>{const o=v.Range.create(e.positionAt(c.location.offset),e.positionAt(c.location.offset+c.location.length));return v.Diagnostic.create(o,c.message,c.severity??r,c.code)})}}getMatchingSchemas(e,t=-1,r){if(this.root&&e){const i=new se(t,r),s=ve(e),c=new ye(s);return M(this.root,e,new D,i,c),i.schemas}return[]}}function ve(n,e=R.v2020_12){let t=n.$schema;return t?_e[t]??e:e}function M(n,e,t,r,i){if(!n||!r.include(n))return;if(n.type==="property")return M(n.valueNode,e,t,r,i);const s=n;switch(c(),s.type){case"object":g(s);break;case"array":a(s);break;case"string":h(s);break;case"number":o(s);break}r.add({node:s,schema:e});function c(){function l(T){return s.type===T||T==="integer"&&s.type==="number"&&s.isInteger}if(Array.isArray(e.type)?e.type.some(l)||t.problems.push({location:{offset:s.offset,length:s.length},message:e.errorMessage||p.t("Incorrect type. Expected one of {0}.",e.type.join(", "))}):e.type&&(l(e.type)||t.problems.push({location:{offset:s.offset,length:s.length},message:e.errorMessage||p.t('Incorrect type. Expected "{0}".',e.type)})),Array.isArray(e.allOf))for(const T of e.allOf){const m=new D,k=r.newSub();M(s,$(T),m,k,i),t.merge(m),r.merge(k)}const f=$(e.not);if(f){const T=new D,m=r.newSub();M(s,f,T,m,i),T.hasProblems()||t.problems.push({location:{offset:s.offset,length:s.length},message:e.errorMessage||p.t("Matches a schema that is not allowed.")});for(const k of m.schemas)k.inverted=!k.inverted,r.add(k)}const y=(T,m)=>{const k=[];let N;for(const A of T){const I=$(A),P=new D,O=r.newSub();if(M(s,I,P,O,i),P.hasProblems()||k.push(I),!N)N={schema:I,validationResult:P,matchingSchemas:O};else if(!m&&!P.hasProblems()&&!N.validationResult.hasProblems())N.matchingSchemas.merge(O),N.validationResult.propertiesMatches+=P.propertiesMatches,N.validationResult.propertiesValueMatches+=P.propertiesValueMatches,N.validationResult.mergeProcessedProperties(P);else{const L=P.compare(N.validationResult);L>0?N={schema:I,validationResult:P,matchingSchemas:O}:L===0&&(N.matchingSchemas.merge(O),N.validationResult.mergeEnumValues(P))}}return k.length>1&&m&&t.problems.push({location:{offset:s.offset,length:1},message:p.t("Matches multiple schemas when only one must validate.")}),N&&(t.merge(N.validationResult),r.merge(N.matchingSchemas)),k.length};Array.isArray(e.anyOf)&&y(e.anyOf,!1),Array.isArray(e.oneOf)&&y(e.oneOf,!0);const u=T=>{const m=new D,k=r.newSub();M(s,$(T),m,k,i),t.merge(m),r.merge(k)},b=(T,m,k)=>{const N=$(T),A=new D,I=r.newSub();M(s,N,A,I,i),r.merge(I),t.mergeProcessedProperties(A),A.hasProblems()?k&&u(k):m&&u(m)},d=$(e.if);if(d&&b(d,$(e.then),$(e.else)),Array.isArray(e.enum)){const T=B(s);let m=!1;for(const k of e.enum)if(W(T,k)){m=!0;break}t.enumValues=e.enum,t.enumValueMatch=m,m||t.problems.push({location:{offset:s.offset,length:s.length},code:x.EnumValueMismatch,message:e.errorMessage||p.t("Value is not accepted. Valid values: {0}.",e.enum.map(k=>JSON.stringify(k)).join(", "))})}if(E(e.const)){const T=B(s);W(T,e.const)?t.enumValueMatch=!0:(t.problems.push({location:{offset:s.offset,length:s.length},code:x.EnumValueMismatch,message:e.errorMessage||p.t("Value must be {0}.",JSON.stringify(e.const))}),t.enumValueMatch=!1),t.enumValues=[e.const]}let S=e.deprecationMessage;if(S||e.deprecated){S=S||p.t("Value is deprecated");let T=s.parent?.type==="property"?s.parent:s;t.problems.push({location:{offset:T.offset,length:T.length},severity:v.DiagnosticSeverity.Warning,message:S,code:x.Deprecated})}}function o(l){const f=l.value;function y(k){const N=/^(-?\d+)(?:\.(\d+))?(?:e([-+]\d+))?$/.exec(k.toString());return N&&{value:Number(N[1]+(N[2]||"")),multiplier:(N[2]?.length||0)-(parseInt(N[3])||0)}}if(F(e.multipleOf)){let k=-1;if(Number.isInteger(e.multipleOf))k=f%e.multipleOf;else{let N=y(e.multipleOf),A=y(f);if(N&&A){const I=10**Math.abs(A.multiplier-N.multiplier);A.multiplier<N.multiplier?A.value*=I:N.value*=I,k=A.value%N.value}}k!==0&&t.problems.push({location:{offset:l.offset,length:l.length},message:p.t("Value is not divisible by {0}.",e.multipleOf)})}function u(k,N){if(F(N))return N;if(_(N)&&N)return k}function b(k,N){if(!_(N)||!N)return k}const d=u(e.minimum,e.exclusiveMinimum);F(d)&&f<=d&&t.problems.push({location:{offset:l.offset,length:l.length},message:p.t("Value is below the exclusive minimum of {0}.",d)});const S=u(e.maximum,e.exclusiveMaximum);F(S)&&f>=S&&t.problems.push({location:{offset:l.offset,length:l.length},message:p.t("Value is above the exclusive maximum of {0}.",S)});const T=b(e.minimum,e.exclusiveMinimum);F(T)&&f<T&&t.problems.push({location:{offset:l.offset,length:l.length},message:p.t("Value is below the minimum of {0}.",T)});const m=b(e.maximum,e.exclusiveMaximum);F(m)&&f>m&&t.problems.push({location:{offset:l.offset,length:l.length},message:p.t("Value is above the maximum of {0}.",m)})}function h(l){if(F(e.minLength)&&me(l.value)<e.minLength&&t.problems.push({location:{offset:l.offset,length:l.length},message:p.t("String is shorter than the minimum length of {0}.",e.minLength)}),F(e.maxLength)&&me(l.value)>e.maxLength&&t.problems.push({location:{offset:l.offset,length:l.length},message:p.t("String is longer than the maximum length of {0}.",e.maxLength)}),he(e.pattern)&&(X(e.pattern)?.test(l.value)||t.problems.push({location:{offset:l.offset,length:l.length},message:e.patternErrorMessage||e.errorMessage||p.t('String does not match the pattern of "{0}".',e.pattern)})),e.format)switch(e.format){case"uri":case"uri-reference":{let y;if(!l.value)y=p.t("URI expected.");else{const u=/^(([^:/?#]+?):)?(\/\/([^/?#]*))?([^?#]*)(\?([^#]*))?(#(.*))?/.exec(l.value);u?!u[2]&&e.format==="uri"&&(y=p.t("URI with a scheme is expected.")):y=p.t("URI is expected.")}y&&t.problems.push({location:{offset:l.offset,length:l.length},message:e.patternErrorMessage||e.errorMessage||p.t("String is not a URI: {0}",y)})}break;case"color-hex":case"date-time":case"date":case"time":case"email":case"hostname":case"ipv4":case"ipv6":const f=Fe[e.format];(!l.value||!f.pattern.exec(l.value))&&t.problems.push({location:{offset:l.offset,length:l.length},message:e.patternErrorMessage||e.errorMessage||f.errorMessage})}}function a(l){let f,y;i.schemaDraft>=R.v2020_12?(f=e.prefixItems,y=Array.isArray(e.items)?void 0:e.items):(f=Array.isArray(e.items)?e.items:void 0,y=Array.isArray(e.items)?e.additionalItems:e.items);let u=0;if(f!==void 0){const S=Math.min(f.length,l.items.length);for(;u<S;u++){const T=f[u],m=$(T),k=new D,N=l.items[u];N&&(M(N,m,k,r,i),t.mergePropertyMatch(k)),t.processedProperties.add(String(u))}}if(y!==void 0&&u<l.items.length)if(typeof y=="boolean")for(y===!1&&t.problems.push({location:{offset:l.offset,length:l.length},message:p.t("Array has too many items according to schema. Expected {0} or fewer.",u)});u<l.items.length;u++)t.processedProperties.add(String(u)),t.propertiesValueMatches++;else for(;u<l.items.length;u++){const S=new D;M(l.items[u],y,S,r,i),t.mergePropertyMatch(S),t.processedProperties.add(String(u))}const b=$(e.contains);if(b){let S=0;for(let T=0;T<l.items.length;T++){const m=l.items[T],k=new D;M(m,b,k,H.instance,i),k.hasProblems()||(S++,i.schemaDraft>=R.v2020_12&&t.processedProperties.add(String(T)))}S===0&&!F(e.minContains)&&t.problems.push({location:{offset:l.offset,length:l.length},message:e.errorMessage||p.t("Array does not contain required item.")}),F(e.minContains)&&S<e.minContains&&t.problems.push({location:{offset:l.offset,length:l.length},message:e.errorMessage||p.t("Array has too few items that match the contains contraint. Expected {0} or more.",e.minContains)}),F(e.maxContains)&&S>e.maxContains&&t.problems.push({location:{offset:l.offset,length:l.length},message:e.errorMessage||p.t("Array has too many items that match the contains contraint. Expected {0} or less.",e.maxContains)})}const d=e.unevaluatedItems;if(d!==void 0)for(let S=0;S<l.items.length;S++){if(!t.processedProperties.has(String(S)))if(d===!1)t.problems.push({location:{offset:l.offset,length:l.length},message:p.t("Item does not match any validation rule from the array.")});else{const T=new D;M(l.items[S],e.unevaluatedItems,T,r,i),t.mergePropertyMatch(T)}t.processedProperties.add(String(S)),t.propertiesValueMatches++}if(F(e.minItems)&&l.items.length<e.minItems&&t.problems.push({location:{offset:l.offset,length:l.length},message:p.t("Array has too few items. Expected {0} or more.",e.minItems)}),F(e.maxItems)&&l.items.length>e.maxItems&&t.problems.push({location:{offset:l.offset,length:l.length},message:p.t("Array has too many items. Expected {0} or fewer.",e.maxItems)}),e.uniqueItems===!0){let T=function(){for(let m=0;m<S.length-1;m++){const k=S[m];for(let N=m+1;N<S.length;N++)if(W(k,S[N]))return!0}return!1};const S=B(l);T()&&t.problems.push({location:{offset:l.offset,length:l.length},message:p.t("Array has duplicate items.")})}}function g(l){const f=Object.create(null),y=new Set;for(const m of l.properties){const k=m.keyNode.value;f[k]=m.valueNode,y.add(k)}if(Array.isArray(e.required)){for(const m of e.required)if(!f[m]){const k=l.parent&&l.parent.type==="property"&&l.parent.keyNode,N=k?{offset:k.offset,length:k.length}:{offset:l.offset,length:1};t.problems.push({location:N,message:p.t('Missing property "{0}".',m)})}}const u=m=>{y.delete(m),t.processedProperties.add(m)};if(e.properties)for(const m of Object.keys(e.properties)){u(m);const k=e.properties[m],N=f[m];if(N)if(_(k))if(k)t.propertiesMatches++,t.propertiesValueMatches++;else{const A=N.parent;t.problems.push({location:{offset:A.keyNode.offset,length:A.keyNode.length},message:e.errorMessage||p.t("Property {0} is not allowed.",m)})}else{const A=new D;M(N,k,A,r,i),t.mergePropertyMatch(A)}}if(e.patternProperties)for(const m of Object.keys(e.patternProperties)){const k=X(m);if(k){const N=[];for(const A of y)if(k.test(A)){N.push(A);const I=f[A];if(I){const P=e.patternProperties[m];if(_(P))if(P)t.propertiesMatches++,t.propertiesValueMatches++;else{const O=I.parent;t.problems.push({location:{offset:O.keyNode.offset,length:O.keyNode.length},message:e.errorMessage||p.t("Property {0} is not allowed.",A)})}else{const O=new D;M(I,P,O,r,i),t.mergePropertyMatch(O)}}}N.forEach(u)}}const b=e.additionalProperties;if(b!==void 0)for(const m of y){u(m);const k=f[m];if(k){if(b===!1){const N=k.parent;t.problems.push({location:{offset:N.keyNode.offset,length:N.keyNode.length},message:e.errorMessage||p.t("Property {0} is not allowed.",m)})}else if(b!==!0){const N=new D;M(k,b,N,r,i),t.mergePropertyMatch(N)}}}const d=e.unevaluatedProperties;if(d!==void 0){const m=[];for(const k of y)if(!t.processedProperties.has(k)){m.push(k);const N=f[k];if(N){if(d===!1){const A=N.parent;t.problems.push({location:{offset:A.keyNode.offset,length:A.keyNode.length},message:e.errorMessage||p.t("Property {0} is not allowed.",k)})}else if(d!==!0){const A=new D;M(N,d,A,r,i),t.mergePropertyMatch(A)}}}m.forEach(u)}if(F(e.maxProperties)&&l.properties.length>e.maxProperties&&t.problems.push({location:{offset:l.offset,length:l.length},message:p.t("Object has more properties than limit of {0}.",e.maxProperties)}),F(e.minProperties)&&l.properties.length<e.minProperties&&t.problems.push({location:{offset:l.offset,length:l.length},message:p.t("Object has fewer properties than the required number of {0}",e.minProperties)}),e.dependentRequired)for(const m in e.dependentRequired){const k=f[m],N=e.dependentRequired[m];k&&Array.isArray(N)&&T(m,N)}if(e.dependentSchemas)for(const m in e.dependentSchemas){const k=f[m],N=e.dependentSchemas[m];k&&K(N)&&T(m,N)}if(e.dependencies)for(const m in e.dependencies)f[m]&&T(m,e.dependencies[m]);const S=$(e.propertyNames);if(S)for(const m of l.properties){const k=m.keyNode;k&&M(k,S,t,H.instance,i)}function T(m,k){if(Array.isArray(k))for(const N of k)f[N]?t.propertiesValueMatches++:t.problems.push({location:{offset:l.offset,length:l.length},message:p.t("Object is missing property {0} required by property {1}.",N,m)});else{const N=$(k);if(N){const A=new D;M(l,N,A,r,i),t.mergePropertyMatch(A)}}}}}function Ue(n,e){const t=[];let r=-1;const i=n.getText(),s=j.createScanner(i,!1),c=e&&e.collectComments?[]:void 0;function o(){for(;;){const A=s.scan();switch(g(),A){case 12:case 13:Array.isArray(c)&&c.push(v.Range.create(n.positionAt(s.getTokenOffset()),n.positionAt(s.getTokenOffset()+s.getTokenLength())));break;case 15:case 14:break;default:return A}}}function h(A,I,P,O,L=v.DiagnosticSeverity.Error){if(t.length===0||P!==r){const w=v.Range.create(n.positionAt(P),n.positionAt(O));t.push(v.Diagnostic.create(w,A,L,I,n.languageId)),r=P}}function a(A,I,P=void 0,O=[],L=[]){let w=s.getTokenOffset(),pe=s.getTokenOffset()+s.getTokenLength();if(w===pe&&w>0){for(w--;w>0&&/\s/.test(i.charAt(w));)w--;pe=w+1}if(h(A,I,w,pe),P&&l(P,!1),O.length+L.length>0){let te=s.getToken();for(;te!==17;){if(O.indexOf(te)!==-1){o();break}else if(L.indexOf(te)!==-1)break;te=o()}}return P}function g(){switch(s.getTokenError()){case 4:return a(p.t("Invalid unicode sequence in string."),x.InvalidUnicode),!0;case 5:return a(p.t("Invalid escape character in string."),x.InvalidEscapeCharacter),!0;case 3:return a(p.t("Unexpected end of number."),x.UnexpectedEndOfNumber),!0;case 1:return a(p.t("Unexpected end of comment."),x.UnexpectedEndOfComment),!0;case 2:return a(p.t("Unexpected end of string."),x.UnexpectedEndOfString),!0;case 6:return a(p.t("Invalid characters in string. Control characters must be escaped."),x.InvalidCharacter),!0}return!1}function l(A,I){return A.length=s.getTokenOffset()+s.getTokenLength()-A.offset,I&&o(),A}function f(A){if(s.getToken()!==3)return;const I=new $e(A,s.getTokenOffset());o();let P=!1;for(;s.getToken()!==4&&s.getToken()!==17;){if(s.getToken()===5){P||a(p.t("Value expected"),x.ValueExpected);const L=s.getTokenOffset();if(o(),s.getToken()===4){P&&h(p.t("Trailing comma"),x.TrailingComma,L,L+1);continue}}else P&&a(p.t("Expected comma"),x.CommaExpected);const O=m(I);O?I.items.push(O):a(p.t("Value expected"),x.ValueExpected,void 0,[],[4,5]),P=!0}return s.getToken()!==4?a(p.t("Expected comma or closing bracket"),x.CommaOrCloseBacketExpected,I):l(I,!0)}const y=new ne(void 0,0,0);function u(A,I){const P=new Ee(A,s.getTokenOffset(),y);let O=d(P);if(!O)if(s.getToken()===16){a(p.t("Property keys must be doublequoted"),x.PropertyKeysMustBeDoublequoted);const w=new ne(P,s.getTokenOffset(),s.getTokenLength());w.value=s.getTokenValue(),O=w,o()}else return;if(P.keyNode=O,O.value!=="//"){const w=I[O.value];w?(h(p.t("Duplicate object key"),x.DuplicateKey,P.keyNode.offset,P.keyNode.offset+P.keyNode.length,v.DiagnosticSeverity.Warning),K(w)&&h(p.t("Duplicate object key"),x.DuplicateKey,w.keyNode.offset,w.keyNode.offset+w.keyNode.length,v.DiagnosticSeverity.Warning),I[O.value]=!0):I[O.value]=P}if(s.getToken()===6)P.colonOffset=s.getTokenOffset(),o();else if(a(p.t("Colon expected"),x.ColonExpected),s.getToken()===10&&n.positionAt(O.offset+O.length).line<n.positionAt(s.getTokenOffset()).line)return P.length=O.length,P;const L=m(P);return L?(P.valueNode=L,P.length=L.offset+L.length-P.offset,P):a(p.t("Value expected"),x.ValueExpected,P,[],[2,5])}function b(A){if(s.getToken()!==1)return;const I=new Re(A,s.getTokenOffset()),P=Object.create(null);o();let O=!1;for(;s.getToken()!==2&&s.getToken()!==17;){if(s.getToken()===5){O||a(p.t("Property expected"),x.PropertyExpected);const w=s.getTokenOffset();if(o(),s.getToken()===2){O&&h(p.t("Trailing comma"),x.TrailingComma,w,w+1);continue}}else O&&a(p.t("Expected comma"),x.CommaExpected);const L=u(I,P);L?I.properties.push(L):a(p.t("Property expected"),x.PropertyExpected,void 0,[],[2,5]),O=!0}return s.getToken()!==2?a(p.t("Expected comma or closing brace"),x.CommaOrCloseBraceExpected,I):l(I,!0)}function d(A){if(s.getToken()!==10)return;const I=new ne(A,s.getTokenOffset());return I.value=s.getTokenValue(),l(I,!0)}function S(A){if(s.getToken()!==11)return;const I=new je(A,s.getTokenOffset());if(s.getTokenError()===0){const P=s.getTokenValue();try{const O=JSON.parse(P);if(!F(O))return a(p.t("Invalid number format."),x.Undefined,I);I.value=O}catch{return a(p.t("Invalid number format."),x.Undefined,I)}I.isInteger=P.indexOf(".")===-1}return l(I,!0)}function T(A){switch(s.getToken()){case 7:return l(new De(A,s.getTokenOffset()),!0);case 8:return l(new ge(A,!0,s.getTokenOffset()),!0);case 9:return l(new ge(A,!1,s.getTokenOffset()),!0);default:return}}function m(A){return f(A)||b(A)||d(A)||S(A)||T(A)}let k;return o()!==17&&(k=m(k),k?s.getToken()!==17&&a(p.t("End of file expected."),x.Undefined):a(p.t("Expected a JSON object, array or literal."),x.Undefined)),new Se(k,t,c)}function oe(n,e,t){if(n!==null&&typeof n=="object"){const r=e+" ";if(Array.isArray(n)){if(n.length===0)return"[]";let i=`[ `;for(let s=0;s<n.length;s++)i+=r+oe(n[s],r,t),s<n.length-1&&(i+=","),i+=` `;return i+=e+"]",i}else{const i=Object.keys(n);if(i.length===0)return"{}";let s=`{ `;for(let c=0;c<i.length;c++){const o=i[c];s+=r+JSON.stringify(o)+": "+oe(n[o],r,t),c<i.length-1&&(s+=","),s+=` `}return s+=e+"}",s}}return t(n)}class Je{constructor(e,t=[],r=Promise,i={}){this.schemaService=e,this.contributions=t,this.promiseConstructor=r,this.clientCapabilities=i}doResolve(e){for(let t=this.contributions.length-1;t>=0;t--){const r=this.contributions[t].resolveCompletion;if(r){const i=r(e);if(i)return i}}return this.promiseConstructor.resolve(e)}doComplete(e,t,r){const i={items:[],isIncomplete:!1},s=e.getText(),c=e.offsetAt(t);let o=r.getNodeFromOffset(c,!0);if(this.isInComment(e,o?o.offset:0,c))return Promise.resolve(i);if(o&&c===o.offset+o.length&&c>0){const f=s[c-1];(o.type==="object"&&f==="}"||o.type==="array"&&f==="]")&&(o=o.parent)}const h=this.getCurrentWord(e,c);let a;if(o&&(o.type==="string"||o.type==="number"||o.type==="boolean"||o.type==="null"))a=v.Range.create(e.positionAt(o.offset),e.positionAt(o.offset+o.length));else{let f=c-h.length;f>0&&s[f-1]==='"'&&f--,a=v.Range.create(e.positionAt(f),t)}const g=new Map,l={add:f=>{let y=f.label;const u=g.get(y);if(u)u.documentation||(u.documentation=f.documentation),u.detail||(u.detail=f.detail),u.labelDetails||(u.labelDetails=f.labelDetails);else{if(y=y.replace(/[\n]/g,"↵"),y.length>60){const b=y.substr(0,57).trim()+"...";g.has(b)||(y=b)}f.textEdit=v.TextEdit.replace(a,f.insertText),f.label=y,g.set(y,f),i.items.push(f)}},setAsIncomplete:()=>{i.isIncomplete=!0},error:f=>{console.error(f)},getNumberOfProposals:()=>i.items.length};return this.schemaService.getSchemaForResource(e.uri,r).then(f=>{const y=[];let u=!0,b="",d;if(o&&o.type==="string"){const T=o.parent;T&&T.type==="property"&&T.keyNode===o&&(u=!T.valueNode,d=T,b=s.substr(o.offset+1,o.length-2),T&&(o=T.parent))}if(o&&o.type==="object"){if(o.offset===c)return i;o.properties.forEach(N=>{(!d||d!==N)&&g.set(N.keyNode.value,v.CompletionItem.create("__"))});let m="";u&&(m=this.evaluateSeparatorAfter(e,e.offsetAt(a.end))),f?this.getPropertyCompletions(f,r,o,u,m,l):this.getSchemaLessPropertyCompletions(r,o,b,l);const k=ie(o);this.contributions.forEach(N=>{const A=N.collectPropertyCompletions(e.uri,k,h,u,m==="",l);A&&y.push(A)}),!f&&h.length>0&&s.charAt(c-h.length-1)!=='"'&&(l.add({kind:v.CompletionItemKind.Property,label:this.getLabelForValue(h),insertText:this.getInsertTextForProperty(h,void 0,!1,m),insertTextFormat:v.InsertTextFormat.Snippet,documentation:""}),l.setAsIncomplete())}const S={};return f?this.getValueCompletions(f,r,o,c,e,l,S):this.getSchemaLessValueCompletions(r,o,c,e,l),this.contributions.length>0&&this.getContributedValueCompletions(r,o,c,e,l,y),this.promiseConstructor.all(y).then(()=>{if(l.getNumberOfProposals()===0){let T=c;o&&(o.type==="string"||o.type==="number"||o.type==="boolean"||o.type==="null")&&(T=o.offset+o.length);const m=this.evaluateSeparatorAfter(e,T);this.addFillerValueCompletions(S,m,l)}return i})})}getPropertyCompletions(e,t,r,i,s,c){t.getMatchingSchemas(e.schema,r.offset).forEach(h=>{if(h.node===r&&!h.inverted){const a=h.schema.properties;a&&Object.keys(a).forEach(l=>{const f=a[l];if(typeof f=="object"&&!f.deprecationMessage&&!f.doNotSuggest){const y={kind:v.CompletionItemKind.Property,label:l,insertText:this.getInsertTextForProperty(l,f,i,s),insertTextFormat:v.InsertTextFormat.Snippet,filterText:this.getFilterTextForValue(l),documentation:this.fromMarkup(f.markdownDescription)||f.description||""};f.suggestSortText!==void 0&&(y.sortText=f.suggestSortText),y.insertText&&z(y.insertText,`$1${s}`)&&(y.command={title:"Suggest",command:"editor.action.triggerSuggest"}),c.add(y)}});const g=h.schema.propertyNames;if(typeof g=="object"&&!g.deprecationMessage&&!g.doNotSuggest){const l=(f,y=void 0)=>{const u={kind:v.CompletionItemKind.Property,label:f,insertText:this.getInsertTextForProperty(f,void 0,i,s),insertTextFormat:v.InsertTextFormat.Snippet,filterText:this.getFilterTextForValue(f),documentation:y||this.fromMarkup(g.markdownDescription)||g.description||""};g.suggestSortText!==void 0&&(u.sortText=g.suggestSortText),u.insertText&&z(u.insertText,`$1${s}`)&&(u.command={title:"Suggest",command:"editor.action.triggerSuggest"}),c.add(u)};if(g.enum)for(let f=0;f<g.enum.length;f++){let y;g.markdownEnumDescriptions&&f<g.markdownEnumDescriptions.length?y=this.fromMarkup(g.markdownEnumDescriptions[f]):g.enumDescriptions&&f<g.enumDescriptions.length&&(y=g.enumDescriptions[f]),l(g.enum[f],y)}g.const&&l(g.const)}}})}getSchemaLessPropertyCompletions(e,t,r,i){const s=c=>{c.properties.forEach(o=>{const h=o.keyNode.value;i.add({kind:v.CompletionItemKind.Property,label:h,insertText:this.getInsertTextForValue(h,""),insertTextFormat:v.InsertTextFormat.Snippet,filterText:this.getFilterTextForValue(h),documentation:""})})};if(t.parent)if(t.parent.type==="property"){const c=t.parent.keyNode.value;e.visit(o=>(o.type==="property"&&o!==t.parent&&o.keyNode.value===c&&o.valueNode&&o.valueNode.type==="object"&&s(o.valueNode),!0))}else t.parent.type==="array"&&t.parent.items.forEach(c=>{c.type==="object"&&c!==t&&s(c)});else t.type==="object"&&i.add({kind:v.CompletionItemKind.Property,label:"$schema",insertText:this.getInsertTextForProperty("$schema",void 0,!0,""),insertTextFormat:v.InsertTextFormat.Snippet,documentation:"",filterText:this.getFilterTextForValue("$schema")})}getSchemaLessValueCompletions(e,t,r,i,s){let c=r;if(t&&(t.type==="string"||t.type==="number"||t.type==="boolean"||t.type==="null")&&(c=t.offset+t.length,t=t.parent),!t){s.add({kind:this.getSuggestionKind("object"),label:"Empty object",insertText:this.getInsertTextForValue({},""),insertTextFormat:v.InsertTextFormat.Snippet,documentation:""}),s.add({kind:this.getSuggestionKind("array"),label:"Empty array",insertText:this.getInsertTextForValue([],""),insertTextFormat:v.InsertTextFormat.Snippet,documentation:""});return}const o=this.evaluateSeparatorAfter(i,c),h=a=>{a.parent&&!be(a.parent,r,!0)&&s.add({kind:this.getSuggestionKind(a.type),label:this.getLabelTextForMatchingNode(a,i),insertText:this.getInsertTextForMatchingNode(a,i,o),insertTextFormat:v.InsertTextFormat.Snippet,documentation:""}),a.type==="boolean"&&this.addBooleanValueCompletion(!a.value,o,s)};if(t.type==="property"&&r>(t.colonOffset||0)){const a=t.valueNode;if(a&&(r>a.offset+a.length||a.type==="object"||a.type==="array"))return;const g=t.keyNode.value;e.visit(l=>(l.type==="property"&&l.keyNode.value===g&&l.valueNode&&h(l.valueNode),!0)),g==="$schema"&&t.parent&&!t.parent.parent&&this.addDollarSchemaCompletions(o,s)}if(t.type==="array")if(t.parent&&t.parent.type==="property"){const a=t.parent.keyNode.value;e.visit(g=>(g.type==="property"&&g.keyNode.value===a&&g.valueNode&&g.valueNode.type==="array"&&g.valueNode.items.forEach(h),!0))}else t.items.forEach(h)}getValueCompletions(e,t,r,i,s,c,o){let h=i,a,g;if(r&&(r.type==="string"||r.type==="number"||r.type==="boolean"||r.type==="null")&&(h=r.offset+r.length,g=r,r=r.parent),!r){this.addSchemaValueCompletions(e.schema,"",c,o);return}if(r.type==="property"&&i>(r.colonOffset||0)){const l=r.valueNode;if(l&&i>l.offset+l.length)return;a=r.keyNode.value,r=r.parent}if(r&&(a!==void 0||r.type==="array")){const l=this.evaluateSeparatorAfter(s,h),f=t.getMatchingSchemas(e.schema,r.offset,g);for(const y of f)if(y.node===r&&!y.inverted&&y.schema){if(r.type==="array"&&y.schema.items){let u=c;if(y.schema.uniqueItems){const b=new Set;r.children.forEach(d=>{d.type!=="array"&&d.type!=="object"&&b.add(this.getLabelForValue(B(d)))}),u={...c,add(d){b.has(d.label)||c.add(d)}}}if(Array.isArray(y.schema.items)){const b=this.findItemAtOffset(r,s,i);b<y.schema.items.length&&this.addSchemaValueCompletions(y.schema.items[b],l,u,o)}else this.addSchemaValueCompletions(y.schema.items,l,u,o)}if(a!==void 0){let u=!1;if(y.schema.properties){const b=y.schema.properties[a];b&&(u=!0,this.addSchemaValueCompletions(b,l,c,o))}if(y.schema.patternProperties&&!u){for(const b of Object.keys(y.schema.patternProperties))if(X(b)?.test(a)){u=!0;const S=y.schema.patternProperties[b];this.addSchemaValueCompletions(S,l,c,o)}}if(y.schema.additionalProperties&&!u){const b=y.schema.additionalProperties;this.addSchemaValueCompletions(b,l,c,o)}}}a==="$schema"&&!r.parent&&this.addDollarSchemaCompletions(l,c),o.boolean&&(this.addBooleanValueCompletion(!0,l,c),this.addBooleanValueCompletion(!1,l,c)),o.null&&this.addNullValueCompletion(l,c)}}getContributedValueCompletions(e,t,r,i,s,c){if(!t)this.contributions.forEach(o=>{const h=o.collectDefaultCompletions(i.uri,s);h&&c.push(h)});else if((t.type==="string"||t.type==="number"||t.type==="boolean"||t.type==="null")&&(t=t.parent),t&&t.type==="property"&&r>(t.colonOffset||0)){const o=t.keyNode.value,h=t.valueNode;if((!h||r<=h.offset+h.length)&&t.parent){const a=ie(t.parent);this.contributions.forEach(g=>{const l=g.collectValueCompletions(i.uri,a,o,s);l&&c.push(l)})}}}addSchemaValueCompletions(e,t,r,i){typeof e=="object"&&(this.addEnumValueCompletions(e,t,r),this.addDefaultValueCompletions(e,t,r),this.collectTypes(e,i),Array.isArray(e.allOf)&&e.allOf.forEach(s=>this.addSchemaValueCompletions(s,t,r,i)),Array.isArray(e.anyOf)&&e.anyOf.forEach(s=>this.addSchemaValueCompletions(s,t,r,i)),Array.isArray(e.oneOf)&&e.oneOf.forEach(s=>this.addSchemaValueCompletions(s,t,r,i)))}addDefaultValueCompletions(e,t,r,i=0){let s=!1;if(E(e.default)){let c=e.type,o=e.default;for(let a=i;a>0;a--)o=[o],c="array";const h={kind:this.getSuggestionKind(c),label:this.getLabelForValue(o),insertText:this.getInsertTextForValue(o,t),insertTextFormat:v.InsertTextFormat.Snippet};this.doesSupportsLabelDetails()?h.labelDetails={description:p.t("Default value")}:h.detail=p.t("Default value"),r.add(h),s=!0}Array.isArray(e.examples)&&e.examples.forEach(c=>{let o=e.type,h=c;for(let a=i;a>0;a--)h=[h],o="array";r.add({kind:this.getSuggestionKind(o),label:this.getLabelForValue(h),insertText:this.getInsertTextForValue(h,t),insertTextFormat:v.InsertTextFormat.Snippet}),s=!0}),Array.isArray(e.defaultSnippets)&&e.defaultSnippets.forEach(c=>{let o=e.type,h=c.body,a=c.label,g,l;if(E(h)){e.type;for(let f=i;f>0;f--)h=[h];g=this.getInsertTextForSnippetValue(h,t),l=this.getFilterTextForSnippetValue(h),a=a||this.getLabelForSnippetValue(h)}else if(typeof c.bodyText=="string"){let f="",y="",u="";for(let b=i;b>0;b--)f=f+u+`[ `,y=y+` `+u+"]",u+=" ",o="array";g=f+u+c.bodyText.split(` `).join(` `+u)+y+t,a=a||g,l=g.replace(/[\n]/g,"")}else return;r.add({kind:this.getSuggestionKind(o),label:a,documentation:this.fromMarkup(c.markdownDescription)||c.description,insertText:g,insertTextFormat:v.InsertTextFormat.Snippet,filterText:l}),s=!0}),!s&&typeof e.items=="object"&&!Array.isArray(e.items)&&i<5&&this.addDefaultValueCompletions(e.items,t,r,i+1)}addEnumValueCompletions(e,t,r){if(E(e.const)&&r.add({kind:this.getSuggestionKind(e.type),label:this.getLabelForValue(e.const),insertText:this.getInsertTextForValue(e.const,t),insertTextFormat:v.InsertTextFormat.Snippet,documentation:this.fromMarkup(e.markdownDescription)||e.description}),Array.isArray(e.enum))for(let i=0,s=e.enum.length;i<s;i++){const c=e.enum[i];let o=this.fromMarkup(e.markdownDescription)||e.description;e.markdownEnumDescriptions&&i<e.markdownEnumDescriptions.length&&this.doesSupportMarkdown()?o=this.fromMarkup(e.markdownEnumDescriptions[i]):e.enumDescriptions&&i<e.enumDescriptions.length&&(o=e.enumDescriptions[i]),r.add({kind:this.getSuggestionKind(e.type),label:this.getLabelForValue(c),insertText:this.getInsertTextForValue(c,t),insertTextFormat:v.InsertTextFormat.Snippet,documentation:o})}}collectTypes(e,t){if(Array.isArray(e.enum)||E(e.const))return;const r=e.type;Array.isArray(r)?r.forEach(i=>t[i]=!0):r&&(t[r]=!0)}addFillerValueCompletions(e,t,r){e.object&&r.add({kind:this.getSuggestionKind("object"),label:"{}",insertText:this.getInsertTextForGuessedValue({},t),insertTextFormat:v.InsertTextFormat.Snippet,detail:p.t("New object"),documentation:""}),e.array&&r.add({kind:this.getSuggestionKind("array"),label:"[]",insertText:this.getInsertTextForGuessedValue([],t),insertTextFormat:v.InsertTextFormat.Snippet,detail:p.t("New array"),documentation:""})}addBooleanValueCompletion(e,t,r){r.add({kind:this.getSuggestionKind("boolean"),label:e?"true":"false",insertText:this.getInsertTextForValue(e,t),insertTextFormat:v.InsertTextFormat.Snippet,documentation:""})}addNullValueCompletion(e,t){t.add({kind:this.getSuggestionKind("null"),label:"null",insertText:"null"+e,insertTextFormat:v.InsertTextFormat.Snippet,documentation:""})}addDollarSchemaCompletions(e,t){this.schemaService.getRegisteredSchemaIds(i=>i==="http"||i==="https").forEach(i=>{i.startsWith("http://json-schema.org/draft-")&&(i=i+"#"),t.add({kind:v.CompletionItemKind.Module,label:this.getLabelForValue(i),filterText:this.getFilterTextForValue(i),insertText:this.getInsertTextForValue(i,e),insertTextFormat:v.InsertTextFormat.Snippet,documentation:""})})}getLabelForValue(e){return JSON.stringify(e)}getValueFromLabel(e){return JSON.parse(e)}getFilterTextForValue(e){return JSON.stringify(e)}getFilterTextForSnippetValue(e){return JSON.stringify(e).replace(/\$\{\d+:([^}]+)\}|\$\d+/g,"$1")}getLabelForSnippetValue(e){return JSON.stringify(e).replace(/\$\{\d+:([^}]+)\}|\$\d+/g,"$1")}getInsertTextForPlainText(e){return e.replace(/[\\\$\}]/g,"\\$&")}getInsertTextForValue(e,t){const r=JSON.stringify(e,null," ");return r==="{}"?"{$1}"+t:r==="[]"?"[$1]"+t:this.getInsertTextForPlainText(r+t)}getInsertTextForSnippetValue(e,t){return oe(e,"",i=>typeof i=="string"&&i[0]==="^"?i.substr(1):JSON.stringify(i))+t}getInsertTextForGuessedValue(e,t){switch(typeof e){case"object":return e===null?"${1:null}"+t:this.getInsertTextForValue(e,t);case"string":let r=JSON.stringify(e);return r=r.substr(1,r.length-2),r=this.getInsertTextForPlainText(r),'"${1:'+r+'}"'+t;case"number":case"boolean":return"${1:"+JSON.stringify(e)+"}"+t}return this.getInsertTextForValue(e,t)}getSuggestionKind(e){if(Array.isArray(e)){const t=e;e=t.length>0?t[0]:void 0}if(!e)return v.CompletionItemKind.Value;switch(e){case"string":return v.CompletionItemKind.Value;case"object":return v.CompletionItemKind.Module;case"property":return v.CompletionItemKind.Property;default:return v.CompletionItemKind.Value}}getLabelTextForMatchingNode(e,t){switch(e.type){case"array":return"[]";case"object":return"{}";default:return t.getText().substr(e.offset,e.length)}}getInsertTextForMatchingNode(e,t,r){switch(e.type){case"array":return this.getInsertTextForValue([],r);case"object":return this.getInsertTextForValue({},r);default:const i=t.getText().substr(e.offset,e.length)+r;return this.getInsertTextForPlainText(i)}}getInsertTextForProperty(e,t,r,i){const s=this.getInsertTextForValue(e,"");if(!r)return s;const c=s+": ";let o,h=0;if(t){if(Array.isArray(t.defaultSnippets)){if(t.defaultSnippets.length===1){const a=t.defaultSnippets[0].body;E(a)&&(o=this.getInsertTextForSnippetValue(a,""))}h+=t.defaultSnippets.length}if(t.enum&&(!o&&t.enum.length===1&&(o=this.getInsertTextForGuessedValue(t.enum[0],"")),h+=t.enum.length),E(t.const)&&(o||(o=this.getInsertTextForGuessedValue(t.const,"")),h++),E(t.default)&&(o||(o=this.getInsertTextForGuessedValue(t.default,"")),h++),Array.isArray(t.examples)&&t.examples.length&&(o||(o=this.getInsertTextForGuessedValue(t.examples[0],"")),h+=t.examples.length),h===0){let a=Array.isArray(t.type)?t.type[0]:t.type;switch(a||(t.properties?a="object":t.items&&(a="array")),a){case"boolean":o="$1";break;case"string":o='"$1"';break;case"object":o="{$1}";break;case"array":o="[$1]";break;case"number":case"integer":o="${1:0}";break;case"null":o="${1:null}";break;default:return s}}}return(!o||h>1)&&(o="$1"),c+o+i}getCurrentWord(e,t){let r=t-1;const i=e.getText();for(;r>=0&&` \r\v":{[,]}`.indexOf(i.charAt(r))===-1;)r--;return i.substring(r+1,t)}evaluateSeparatorAfter(e,t){const r=j.createScanner(e.getText(),!0);switch(r.setPosition(t),r.scan()){case 5:case 2:case 4:case 17:return"";default:return","}}findItemAtOffset(e,t,r){const i=j.createScanner(t.getText(),!0),s=e.items;for(let c=s.length-1;c>=0;c--){const o=s[c];if(r>o.offset+o.length)return i.setPosition(o.offset+o.length),i.scan()===5&&r>=i.getTokenOffset()+i.getTokenLength()?c+1:c;if(r>=o.offset)return c}return 0}isInComment(e,t,r){const i=j.createScanner(e.getText(),!1);i.setPosition(t);let s=i.scan();for(;s!==17&&i.getTokenOffset()+i.getTokenLength()<r;)s=i.scan();return(s===12||s===13)&&i.getTokenOffset()<=r}fromMarkup(e){if(e&&this.doesSupportMarkdown())return{kind:v.MarkupKind.Markdown,value:e}}doesSupportMarkdown(){if(!E(this.supportsMarkdown)){const e=this.clientCapabilities.textDocument?.completion?.completionItem?.documentationFormat;this.supportsMarkdown=Array.isArray(e)&&e.indexOf(v.MarkupKind.Markdown)!==-1}return this.supportsMarkdown}doesSupportsCommitCharacters(){return E(this.supportsCommitCharacters)||(this.labelDetailsSupport=this.clientCapabilities.textDocument?.completion?.completionItem?.commitCharactersSupport),this.supportsCommitCharacters}doesSupportsLabelDetails(){return E(this.labelDetailsSupport)||(this.labelDetailsSupport=this.clientCapabilities.textDocument?.completion?.completionItem?.labelDetailsSupport),this.labelDetailsSupport}}class qe{constructor(e,t=[],r){this.schemaService=e,this.contributions=t,this.promise=r||Promise}doHover(e,t,r){const i=e.offsetAt(t);let s=r.getNodeFromOffset(i);if(!s||(s.type==="object"||s.type==="array")&&i>s.offset+1&&i<s.offset+s.length-1)return this.promise.resolve(null);const c=s;if(s.type==="string"){const g=s.parent;if(g&&g.type==="property"&&g.keyNode===s&&(s=g.valueNode,!s))return this.promise.resolve(null)}const o=v.Range.create(e.positionAt(c.offset),e.positionAt(c.offset+c.length)),h=g=>({contents:g,range:o}),a=ie(s);for(let g=this.contributions.length-1;g>=0;g--){const f=this.contributions[g].getInfoContribution(e.uri,a);if(f)return f.then(y=>h(y))}return this.schemaService.getSchemaForResource(e.uri,r).then(g=>{if(g&&s){const l=r.getMatchingSchemas(g.schema,s.offset);let f,y,u,b;l.every(S=>{if(S.node===s&&!S.inverted&&S.schema&&(f=f||S.schema.title,y=y||S.schema.markdownDescription||ae(S.schema.description),S.schema.enum)){const T=S.schema.enum.indexOf(B(s));S.schema.markdownEnumDescriptions?u=S.schema.markdownEnumDescriptions[T]:S.schema.enumDescriptions&&(u=ae(S.schema.enumDescriptions[T])),u&&(b=S.schema.enum[T],typeof b!="string"&&(b=JSON.stringify(b)))}return!0});let d="";return f&&(d=ae(f)),y&&(d.length>0&&(d+=` `),d+=y),u&&(d.length>0&&(d+=` `),d+=`\`${Be(b)}\`: ${u}`),h([d])}return null})}}function ae(n){if(n)return n.replace(/([^\n\r])(\r?\n)([^\n\r])/gm,`$1 $3`).replace(/[\\`*_{}[\]()#+\-.!]/g,"\\$&")}function Be(n){return n.indexOf("`")!==-1?"`` "+n+" ``":n}class We{constructor(e,t){this.jsonSchemaService=e,this.promise=t,this.validationEnabled=!0}configure(e){e&&(this.validationEnabled=e.validate!==!1,this.commentSeverity=e.allowComments?void 0:v.DiagnosticSeverity.Error)}doValidation(e,t,r,i){if(!this.validationEnabled)return this.promise.resolve([]);const s=[],c={},o=a=>{const g=a.range.start.line+" "+a.range.start.character+" "+a.message;c[g]||(c[g]=!0,s.push(a))},h=a=>{let g=r?.trailingCommas?Q(r.trailingCommas):v.DiagnosticSeverity.Error,l=r?.comments?Q(r.comments):this.commentSeverity,f=r?.schemaValidation?Q(r.schemaValidation):v.DiagnosticSeverity.Warning,y=r?.schemaRequest?Q(r.schemaRequest):v.DiagnosticSeverity.Warning;if(a){const u=(b,d)=>{if(t.root&&y){const S=t.root,T=S.type==="object"?S.properties[0]:void 0;if(T&&T.keyNode.value==="$schema"){const m=T.valueNode||T,k=v.Range.create(e.positionAt(m.offset),e.positionAt(m.offset+m.length));o(v.Diagnostic.create(k,b,y,d))}else{const m=v.Range.create(e.positionAt(S.offset),e.positionAt(S.offset+1));o(v.Diagnostic.create(m,b,y,d))}}};if(a.errors.length)u(a.errors[0],x.SchemaResolveError);else if(f){for(const d of a.warnings)u(d,x.SchemaUnsupportedFeature);const b=t.validate(e,a.schema,f,r?.schemaDraft);b&&b.forEach(o)}Te(a.schema)&&(l=void 0),ke(a.schema)&&(g=void 0)}for(const u of t.syntaxErrors){if(u.code===x.TrailingComma){if(typeof g!="number")continue;u.severity=g}o(u)}if(typeof l=="number"){const u=p.t("Comments are not permitted in JSON.");t.comments.forEach(b=>{o(v.Diagnostic.create(b,u,l,x.CommentNotPermitted))})}return s};if(i){const a=i.id||"schemaservice://untitled/"+ze++;return this.jsonSchemaService.registerExternalSchema({uri:a,schema:i}).getResolvedSchema().then(l=>h(l))}return this.jsonSchemaService.getSchemaForResource(e.uri,t).then(a=>h(a))}getLanguageStatus(e,t){return{schemas:this.jsonSchemaService.getSchemaURIsForResource(e.uri,t)}}}let ze=0;function Te(n){if(n&&typeof n=="object"){if(_(n.allowComments))return n.allowComments;if(n.allOf)for(const e of n.allOf){const t=Te(e);if(_(t))return t}}}function ke(n){if(n&&typeof n=="object"){if(_(n.allowTrailingCommas))return n.allowTrailingCommas;const e=n;if(_(e.allowsTrailingCommas))return e.allowsTrailingCommas;if(n.allOf)for(const t of n.allOf){const r=ke(t);if(_(r))return r}}}function Q(n){switch(n){case"error":return v.DiagnosticSeverity.Error;case"warning":return v.DiagnosticSeverity.Warning;case"ignore":return}}const Ne=48,He=57,Ge=65,Y=97,Ze=102;function C(n){return n<Ne?0:n<=He?n-Ne:(n<Y&&(n+=Y-Ge),n>=Y&&n<=Ze?n-Y+10:0)}function Xe(n){if(n[0]==="#")switch(n.length){case 4:return{red:C(n.charCodeAt(1))*17/255,green:C(n.charCodeAt(2))*17/255,blue:C(n.charCodeAt(3))*17/255,alpha:1};case 5:return{red:C(n.charCodeAt(1))*17/255,green:C(n.charCodeAt(2))*17/255,blue:C(n.charCodeAt(3))*17/255,alpha:C(n.charCodeAt(4))*17/255};case 7:return{red:(C(n.charCodeAt(1))*16+C(n.charCodeAt(2)))/255,green:(C(n.charCodeAt(3))*16+C(n.charCodeAt(4)))/255,blue:(C(n.charCodeAt(5))*16+C(n.charCodeAt(6)))/255,alpha:1};case 9:return{red:(C(n.charCodeAt(1))*16+C(n.charCodeAt(2)))/255,green:(C(n.charCodeAt(3))*16+C(n.charCodeAt(4)))/255,blue:(C(n.charCodeAt(5))*16+C(n.charCodeAt(6)))/255,alpha:(C(n.charCodeAt(7))*16+C(n.charCodeAt(8)))/255}}}class Qe{constructor(e){this.schemaService=e}findDocumentSymbols(e,t,r={resultLimit:Number.MAX_VALUE}){const i=t.root;if(!i)return[];let s=r.resultLimit||Number.MAX_VALUE;const c=e.uri;if((c==="vscode://defaultsettings/keybindings.json"||z(c.toLowerCase(),"/user/keybindings.json"))&&i.type==="array"){const f=[];for(const y of i.items)if(y.type==="object"){for(const u of y.properties)if(u.keyNode.value==="key"&&u.valueNode){const b=v.Location.create(e.uri,U(e,y));if(f.push({name:Ae(u.valueNode),kind:v.SymbolKind.Function,location:b}),s--,s<=0)return r&&r.onResultLimitExceeded&&r.onResultLimitExceeded(c),f}}return f}const o=[{node:i,containerName:""}];let h=0,a=!1;const g=[],l=(f,y)=>{f.type==="array"?f.items.forEach(u=>{u&&o.push({node:u,containerName:y})}):f.type==="object"&&f.properties.forEach(u=>{const b=u.valueNode;if(b)if(s>0){s--;const d=v.Location.create(e.uri,U(e,u)),S=y?y+"."+u.keyNode.value:u.keyNode.value;g.push({name:this.getKeyLabel(u),kind:this.getSymbolKind(b.type),location:d,containerName:y}),o.push({node:b,containerName:S})}else a=!0})};for(;h<o.length;){const f=o[h++];l(f.node,f.containerName)}return a&&r&&r.onResultLimitExceeded&&r.onResultLimitExceeded(c),g}findDocumentSymbols2(e,t,r={resultLimit:Number.MAX_VALUE}){const i=t.root;if(!i)return[];let s=r.resultLimit||Number.MAX_VALUE;const c=e.uri;if((c==="vscode://defaultsettings/keybindings.json"||z(c.toLowerCase(),"/user/keybindings.json"))&&i.type==="array"){const f=[];for(const y of i.items)if(y.type==="object"){for(const u of y.properties)if(u.keyNode.value==="key"&&u.valueNode){const b=U(e,y),d=U(e,u.keyNode);if(f.push({name:Ae(u.valueNode),kind:v.SymbolKind.Function,range:b,selectionRange:d}),s--,s<=0)return r&&r.onResultLimitExceeded&&r.onResultLimitExceeded(c),f}}return f}const o=[],h=[{node:i,result:o}];let a=0,g=!1;const l=(f,y)=>{f.type==="array"?f.items.forEach((u,b)=>{if(u)if(s>0){s--;const d=U(e,u),S=d,m={name:String(b),kind:this.getSymbolKind(u.type),range:d,selectionRange:S,children:[]};y.push(m),h.push({result:m.children,node:u})}else g=!0}):f.type==="object"&&f.properties.forEach(u=>{const b=u.valueNode;if(b)if(s>0){s--;const d=U(e,u),S=U(e,u.keyNode),T=[],m={name:this.getKeyLabel(u),kind:this.getSymbolKind(b.type),range:d,selectionRange:S,children:T,detail:this.getDetail(b)};y.push(m),h.push({result