/*!
Copyright (c) 2026 Lenovo SSG BASD. All rights reserved.
@license Proprietary

This software is the confidential and proprietary property of Lenovo SSG BASD.
You shall not disclose such Confidential Information and shall use it only in
accordance with the terms of the license agreement.

--- Build Info ---
Version: 1.1.1
Build Time: 2026/2/26 17:21:00
Build Commit: 81e556ed827e2f043668506dae6fae8dbb9ef395
*/
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const e=require("../../../@lezer/python/dist/index.js"),t=require("../../language/dist/index.js"),r=require("../../../@lezer/common/dist/index.js"),n=require("../../autocomplete/dist/index.js"),o=new r.NodeWeakMap,i=new Set(["Script","Body","FunctionDefinition","ClassDefinition","LambdaExpression","ForStatement","MatchClause"]);function a(e){return(t,r,n)=>{if(n)return!1;let o=t.node.getChild("VariableName");return o&&r(o,e),!0}}const l={FunctionDefinition:a("function"),ClassDefinition:a("class"),ForStatement(e,t,r){if(r)for(let n=e.node.firstChild;n;n=n.nextSibling)if("VariableName"==n.name)t(n,"variable");else if("in"==n.name)break},ImportStatement(e,t){var r,n;let{node:o}=e,i="from"==(null===(r=o.firstChild)||void 0===r?void 0:r.name);for(let a=o.getChild("import");a;a=a.nextSibling)"VariableName"==a.name&&"as"!=(null===(n=a.nextSibling)||void 0===n?void 0:n.name)&&t(a,i?"variable":"namespace")},AssignStatement(e,t){for(let r=e.node.firstChild;r;r=r.nextSibling)if("VariableName"==r.name)t(r,"variable");else if(":"==r.name||"AssignOp"==r.name)break},ParamList(e,t){for(let r=null,n=e.node.firstChild;n;n=n.nextSibling)"VariableName"!=n.name||r&&/\*|AssignOp/.test(r.name)||t(n,"variable"),r=n},CapturePattern:a("variable"),AsPattern:a("variable"),__proto__:null};function s(e,t){let n=o.get(t);if(n)return n;let a=[],p=!0;function d(t,r){let n=e.sliceString(t.from,t.to);a.push({label:n,type:r})}return t.cursor(r.IterMode.IncludeAnonymous).iterate(t=>{if(t.name){let e=l[t.name];if(e&&e(t,d,p)||!p&&i.has(t.name))return!1;p=!1}else if(t.to-t.from>8192){for(let r of s(e,t.node))a.push(r);return!1}}),o.set(t,a),a}const p=/^[\w\xa1-\uffff][\w\d\xa1-\uffff]*$/,d=["String","FormatString","Comment","PropertyName"];function m(e){let r=t.syntaxTree(e.state).resolveInner(e.pos,-1);if(d.indexOf(r.name)>-1)return null;let n="VariableName"==r.name||r.to-r.from<20&&p.test(e.state.sliceDoc(r.from,r.to));if(!n&&!e.explicit)return null;let o=[];for(let t=r;t;t=t.parent)i.has(t.name)&&(o=o.concat(s(e.state.doc,t)));return{options:o,from:n?r.from:e.pos,validFor:p}}const c=["__annotations__","__builtins__","__debug__","__doc__","__import__","__name__","__loader__","__package__","__spec__","False","None","True"].map(e=>({label:e,type:"constant"})).concat(["ArithmeticError","AssertionError","AttributeError","BaseException","BlockingIOError","BrokenPipeError","BufferError","BytesWarning","ChildProcessError","ConnectionAbortedError","ConnectionError","ConnectionRefusedError","ConnectionResetError","DeprecationWarning","EOFError","Ellipsis","EncodingWarning","EnvironmentError","Exception","FileExistsError","FileNotFoundError","FloatingPointError","FutureWarning","GeneratorExit","IOError","ImportError","ImportWarning","IndentationError","IndexError","InterruptedError","IsADirectoryError","KeyError","KeyboardInterrupt","LookupError","MemoryError","ModuleNotFoundError","NameError","NotADirectoryError","NotImplemented","NotImplementedError","OSError","OverflowError","PendingDeprecationWarning","PermissionError","ProcessLookupError","RecursionError","ReferenceError","ResourceWarning","RuntimeError","RuntimeWarning","StopAsyncIteration","StopIteration","SyntaxError","SyntaxWarning","SystemError","SystemExit","TabError","TimeoutError","TypeError","UnboundLocalError","UnicodeDecodeError","UnicodeEncodeError","UnicodeError","UnicodeTranslateError","UnicodeWarning","UserWarning","ValueError","Warning","ZeroDivisionError"].map(e=>({label:e,type:"type"}))).concat(["bool","bytearray","bytes","classmethod","complex","float","frozenset","int","list","map","memoryview","object","range","set","staticmethod","str","super","tuple","type"].map(e=>({label:e,type:"class"}))).concat(["abs","aiter","all","anext","any","ascii","bin","breakpoint","callable","chr","compile","delattr","dict","dir","divmod","enumerate","eval","exec","exit","filter","format","getattr","globals","hasattr","hash","help","hex","id","input","isinstance","issubclass","iter","len","license","locals","max","min","next","oct","open","ord","pow","print","property","quit","repr","reversed","round","setattr","slice","sorted","sum","vars","zip"].map(e=>({label:e,type:"function"}))),u=[n.snippetCompletion("def ${name}(${params}):\n\t${}",{label:"def",detail:"function",type:"keyword"}),n.snippetCompletion("for ${name} in ${collection}:\n\t${}",{label:"for",detail:"loop",type:"keyword"}),n.snippetCompletion("while ${}:\n\t${}",{label:"while",detail:"loop",type:"keyword"}),n.snippetCompletion("try:\n\t${}\nexcept ${error}:\n\t${}",{label:"try",detail:"/ except block",type:"keyword"}),n.snippetCompletion("if ${}:\n\t\n",{label:"if",detail:"block",type:"keyword"}),n.snippetCompletion("if ${}:\n\t${}\nelse:\n\t${}",{label:"if",detail:"/ else block",type:"keyword"}),n.snippetCompletion("class ${name}:\n\tdef __init__(self, ${params}):\n\t\t\t${}",{label:"class",detail:"definition",type:"keyword"}),n.snippetCompletion("import ${module}",{label:"import",detail:"statement",type:"keyword"}),n.snippetCompletion("from ${module} import ${names}",{label:"from",detail:"import",type:"keyword"})],f=n.ifNotIn(d,n.completeFromList(c.concat(u)));function E(e){let{node:t,pos:r}=e,n=e.lineIndent(r,-1),o=null;for(;;){let i=t.childBefore(r);if(!i)break;if("Comment"==i.name)r=i.from;else if("Body"==i.name||"MatchBody"==i.name)e.baseIndentFor(i)+e.unit<=n&&(o=i),t=i;else if("MatchClause"==i.name)t=i;else{if(!i.type.is("Statement"))break;t=i}}return o}function b(e,t){let r=e.baseIndentFor(t),n=e.lineAt(e.pos,-1),o=n.from+n.text.length;return/^\s*($|#)/.test(n.text)&&e.node.to<o+100&&!/\S/.test(e.state.sliceDoc(o,e.node.to))&&e.lineIndent(e.pos,-1)<=r||/^\s*(else:|elif |except |finally:|case\s+[^=:]+:)/.test(e.textAfter)&&e.lineIndent(e.pos,-1)>r?null:r+e.unit}const y=t.LRLanguage.define({name:"python",parser:e.parser.configure({props:[t.indentNodeProp.add({Body:e=>{var t;return null!==(t=b(e,/^\s*(#|$)/.test(e.textAfter)&&E(e)||e.node))&&void 0!==t?t:e.continue()},MatchBody:e=>{var t;return null!==(t=b(e,E(e)||e.node))&&void 0!==t?t:e.continue()},IfStatement:e=>/^\s*(else:|elif )/.test(e.textAfter)?e.baseIndent:e.continue(),"ForStatement WhileStatement":e=>/^\s*else:/.test(e.textAfter)?e.baseIndent:e.continue(),TryStatement:e=>/^\s*(except[ :]|finally:|else:)/.test(e.textAfter)?e.baseIndent:e.continue(),MatchStatement:e=>/^\s*case /.test(e.textAfter)?e.baseIndent+e.unit:e.continue(),"TupleExpression ComprehensionExpression ParamList ArgList ParenthesizedExpression":t.delimitedIndent({closing:")"}),"DictionaryExpression DictionaryComprehensionExpression SetExpression SetComprehensionExpression":t.delimitedIndent({closing:"}"}),"ArrayExpression ArrayComprehensionExpression":t.delimitedIndent({closing:"]"}),MemberExpression:e=>e.baseIndent+e.unit,"String FormatString":()=>null,Script:e=>{var t;let r=E(e);return null!==(t=r&&b(e,r))&&void 0!==t?t:e.continue()}}),t.foldNodeProp.add({"ArrayExpression DictionaryExpression SetExpression TupleExpression":t.foldInside,Body:(e,t)=>({from:e.from+1,to:e.to-(e.to==t.doc.length?0:1)}),"String FormatString":(e,t)=>({from:t.doc.lineAt(e.from).to,to:e.to})})]}),languageData:{closeBrackets:{brackets:["(","[","{","'",'"',"'''",'"""'],stringPrefixes:["f","fr","rf","r","u","b","br","rb","F","FR","RF","R","U","B","BR","RB"]},commentTokens:{line:"#"},indentOnInput:/^\s*([\}\]\)]|else:|elif |except |finally:|case\s+[^:]*:?)$/}});exports.globalCompletion=f,exports.localCompletionSource=m,exports.python=function(){return new t.LanguageSupport(y,[y.data.of({autocomplete:m}),y.data.of({autocomplete:f})])},exports.pythonLanguage=y;