3 | (self.webpackChunkaltair=self.webpackChunkaltair||[]).push([[150],{25150:(p,d,i)=>{i.r(d),i.d(d,{DocUtils:()=>f});var o=i(26642),l=i(34027),u=i(60069),_=i(5669),g=i(52489);class f{constructor(e){this.searchIndex=[],e&&this.updateSchema(e)}updateSchema(e){this.schema=(0,u.I)(e)}generateSearchIndex(){if(!this.schema)return[];let e=[];(0,_.Z)(this.schema).forEach(s=>{e=[...e,...this.getTypeIndices(s,!0,e)]});const a=this.schema.getTypeMap();return Object.keys(a).forEach(s=>{/^__/.test(s)||(e=[...e,...this.getTypeIndices(a[s],!1,e)])}),this.searchIndex=e,e}getFieldsIndices(e,n,a,s){let t=[];return Object.entries(e).forEach(([h,r])=>{const m={search:r.name,name:r.name,description:r.description?r.description:"",args:r.args?.map(c=>({name:c.name,description:c.description??""})),cat:"field",type:n.name,isQuery:a,highlight:"field"};t=[...t,m],r.args&&r.args.length&&r.args.forEach(c=>{t=[...t,{...m,search:c.name,highlight:"argument"}]}),r.type&&(t=[...t,...this.getTypeIndices(r.type,!1,[...s,...t]).filter(c=>!!c)])}),t}getTypeIndices(e,n,a){let s;if(!e.name)return[];if(a.some(h=>h.name===e.name&&"type"===h.cat))return[];e.getFields&&(s=e.getFields());const t=[{search:e.name,name:e.name,cat:"type",description:e.description?e.description:"",isRoot:n,highlight:"type"}];return s?[...t,...this.getFieldsIndices(s,e,n,[...a,...t]).filter(h=>!!h)]:t}searchDocs(e){return this.searchIndex.length?new l.Z(this.searchIndex,{keys:["search"],threshold:.4}).search(e).map(a=>a.item):[]}generateQueryV2(e,n,a){var s=this;return(0,o.Z)(function*(){if(!s.schema)return;const t=yield(0,g.Ku)(s.schema,e,n,{maxDepth:a.addQueryDepthLimit,tabSize:a.tabSize});return{query:t.generated,meta:t.metas.find(h=>h.hasArgs)||{}}})()}cleanName(e){return e.replace(/[[\]!]/g,"")}}}}]);
|