vendor: 4,406 bytes, line 1
1import{a as e,p as t}from"./chunk-6CSD65Y2-xYubHBmU.js";import{C as s,a1 as n,aD as r}from"./voiceStore-D_K9cjIr.js";import{q as i,a4 as a,cw as o,bz as c,cx as l,J as u,M as d,c as h,d as m,B as p,a2 as g,e as f,I as x,cy as y,cj as C,S as b,k as j,g as A,ay as v,cz as N,bJ as w}from"./CoreLayout-V9PVLCM0.js";import{L as k,c as D,u as E,d as F,e as M,f as S,P as B,h as _,b as L,g as I,i as O,j as $,k as R,l as T,m as z,n as P,o as W}from"./categoryColors-DV3W4aOZ.js";import{f as K}from"./typeCompatibility-9UXwri7t.js";import{a as U}from"./useDebounce-B9SwkRXs.js";import{a as q}from"./resolveIcon-DmlbH-ZS.js";import{X as J}from"./overlayFocus-BmDVzTk_.js";import{S as V}from"./skeleton-HiKLIgRk.js";import{C as H,a as G,b as Q}from"./collapsible-BnskTiB4.js";import"./index-BfJR_dAR.js";import"./createLucideIcon-B7UGDY3i.js";import"./index-BcwKVuK3.js";import"./loader-circle-Mux4UJzI.js";import"./user-BccZgP0Q.js";import"./index-ATyz5JdO.js";import"./AuthContextDefinition-CrUuQ85U.js";function X(e){return Array.isArray?Array.isArray(e):"[object Array]"===re(e)}function Y(e){return"string"==typeof e}function Z(e){return"number"==typeof e}function ee(e){return!0===e||!1===e||function(e){return te(e)&&null!==e}(e)&&"[object Boolean]"==re(e)}function te(e){return"object"==typeof e}function se(e){return null!=e}function ne(e){return!e.trim().length}function re(e){return null==e?void 0===e?"[object Undefined]":"[object Null]":Object.prototype.toString.call(e)}const ie=Object.prototype.hasOwnProperty;class ae{constructor(e){this._keys=[],this._keyMap={};let t=0;e.forEach(e=>{let s=oe(e);this._keys.push(s),this._keyMap[s.id]=s,t+=s.weight}),this._keys.forEach(e=>{e.weight/=t})}get(e){return this._keyMap[e]}keys(){return this._keys}toJSON(){return JSON.stringify(this._keys)}}function oe(e){let t=null,s=null,n=null,r=1,i=null;if(Y(e)||X(e))n=e,t=ce(e),s=le(e);else{if(!ie.call(e,"name"))throw new Error((e=>`Missing ${e} property in key`)("name"));const a=e.name;if(n=a,ie.call(e,"weight")&&(r=e.weight,r<=0))throw new Error((e=>`Property 'weight' in key '${e}' must be a positive integer`)(a));t=ce(a),s=le(a),i=e.getFn}return{path:t,id:s,weight:r,src:n,getFn:i}}function ce(e){return X(e)?e:e.split(".")}function le(e){return X(e)?e.join("."):e}var ue={isCaseSensitive:!1,ignoreDiacritics:!1,includeScore:!1,keys:[],shouldSort:!0,sortFn:(e,t)=>e.score===t.score?e.idx<t.idx?-1:1:e.score<t.score?-1:1,includeMatches:!1,findAllMatches:!1,minMatchCharLength:1,location:0,threshold:.6,distance:100,...{useExtendedSearch:!1,getFn:function(e,t){let s=[],n=!1;const r=(e,t,i)=>{if(se(e))if(t[i]){const a=e[t[i]];if(!se(a))return;if(i===t.length-1&&(Y(a)||Z(a)||ee(a)))s.push(function(e){return null==e?"":function(e){if("string"==typeof e)return e;let t=e+"";return"0"==t&&1/e==-1/0?"-0":t}(e)}(a));else if(X(a)){n=!0;for(let e=0,s=a.length;e<s;e+=1)r(a[e],t,i+1)}else t.length&&r(a,t,i+1)}else s.push(e)};return r(e,Y(t)?t.split("."):t,0),n?s:s[0]},ignoreLocation:!1,ignoreFieldNorm:!1,fieldNormWeight:1}};const de=/[^ ]+/g;class he{constructor({getFn:e=ue.getFn,fieldNormWeight:t=ue.fieldNormWeight}={}){this.norm=function(e=1,t=3){const s=new Map,n=Math.pow(10,t);return{get(t){const r=t.match(de).length;if(s.has(r))return s.get(r);const i=1/Math.pow(r,.5*e),a=parseFloat(Math.round(i*n)/n);return s.set(r,a),a},clear(){s.clear()}}}(t,3),this.getFn=e,this.isCreated=!1,this.setIndexRecords()}setSources(e=[]){this.docs=e}setIndexRecords(e=[]){this.records=e}setKeys(e=[]){this.keys=e,this._keysMap={},e.forEach((e,t)=>{this._keysMap[e.id]=t})}create(){!this.isCreated&&this.docs.length&&(this.isCreated=!0,Y(this.docs[0])?this.docs.forEach((e,t)=>{this._addString(e,t)}):this.docs.forEach((e,t)=>{this._addObject(e,t)}),this.norm.clear())}add(e){const t=this.size();Y(e)?this._addString(e,t):this._addObject(e,t)}removeAt(e){this.records.splice(e,1);for(let t=e,s=this.size();t<s;t+=1)this.records[t].i-=1}getValueForItemAtKeyId(e,t){return e[this._keysMap[t]]}size(){return this.records.length}_addString(e,t){if(!se(e)||ne(e))return;let s={v:e,i:t,n:this.norm.get(e)};this.records.push(s)}_addObject(e,t){let s={i:t,$:{}};this.keys.forEach((t,n)=>{let r=t.getFn?t.getFn(e):this.getFn(e,t.path);if(se(r))if(X(r)){let e=[];const t=[{nestedArrIndex:-1,value:r}];for(;t.length;){const{nestedArrIndex:s,value:n}=t.pop();if(se(n))if(Y(n)&&!ne(n)){let t={v:n,i:s,n:this.norm.get(n)};e.push(t)}
vendor: 10,376 bytes, line 1
1else X(n)&&n.forEach((e,s)=>{t.push({nestedArrIndex:s,value:e})})}s.$[n]=e}else if(Y(r)&&!ne(r)){let e={v:r,n:this.norm.get(r)};s.$[n]=e}}),this.records.push(s)}toJSON(){return{keys:this.keys,records:this.records}}}function me(e,t,{getFn:s=ue.getFn,fieldNormWeight:n=ue.fieldNormWeight}={}){const r=new he({getFn:s,fieldNormWeight:n});return r.setKeys(e.map(oe)),r.setSources(t),r.create(),r}function pe(e,{errors:t=0,currentLocation:s=0,expectedLocation:n=0,distance:r=ue.distance,ignoreLocation:i=ue.ignoreLocation}={}){const a=t/e.length;if(i)return a;const o=Math.abs(n-s);return r?a+o/r:o?1:a}const ge=32;function fe(e,t,s,{location:n=ue.location,distance:r=ue.distance,threshold:i=ue.threshold,findAllMatches:a=ue.findAllMatches,minMatchCharLength:o=ue.minMatchCharLength,includeMatches:c=ue.includeMatches,ignoreLocation:l=ue.ignoreLocation}={}){if(t.length>ge)throw new Error(`Pattern length exceeds max of ${ge}.`);const u=t.length,d=e.length,h=Math.max(0,Math.min(n,d));let m=i,p=h;const g=o>1||c,f=g?Array(d):[];let x;for(;(x=e.indexOf(t,p))>-1;){let e=pe(t,{currentLocation:x,expectedLocation:h,distance:r,ignoreLocation:l});if(m=Math.min(e,m),p=x+u,g){let e=0;for(;e<u;)f[x+e]=1,e+=1}}p=-1;let y=[],C=1,b=u+d;const j=1<<u-1;for(let v=0;v<u;v+=1){let n=0,i=b;for(;n<i;){pe(t,{errors:v,currentLocation:h+i,expectedLocation:h,distance:r,ignoreLocation:l})<=m?n=i:b=i,i=Math.floor((b-n)/2+n)}b=i;let o=Math.max(1,h-i+1),c=a?d:Math.min(h+i,d)+u,x=Array(c+2);x[c+1]=(1<<v)-1;for(let a=c;a>=o;a-=1){let n=a-1,i=s[e.charAt(n)];if(g&&(f[n]=+!!i),x[a]=(x[a+1]<<1|1)&i,v&&(x[a]|=(y[a+1]|y[a])<<1|1|y[a+1]),x[a]&j&&(C=pe(t,{errors:v,currentLocation:n,expectedLocation:h,distance:r,ignoreLocation:l}),C<=m)){if(m=C,p=n,p<=h)break;o=Math.max(1,2*h-p)}}if(pe(t,{errors:v+1,currentLocation:h,expectedLocation:h,distance:r,ignoreLocation:l})>m)break;y=x}const A={isMatch:p>=0,score:Math.max(.001,C)};if(g){const e=function(e=[],t=ue.minMatchCharLength){let s=[],n=-1,r=-1,i=0;for(let a=e.length;i<a;i+=1){let a=e[i];a&&-1===n?n=i:a||-1===n||(r=i-1,r-n+1>=t&&s.push([n,r]),n=-1)}return e[i-1]&&i-n>=t&&s.push([n,i-1]),s}(f,o);e.length?c&&(A.indices=e):A.isMatch=!1}return A}function xe(e){let t={};for(let s=0,n=e.length;s<n;s+=1){const r=e.charAt(s);t[r]=(t[r]||0)|1<<n-s-1}return t}const ye=String.prototype.normalize?e=>e.normalize("NFD").replace(/[\u0300-\u036F\u0483-\u0489\u0591-\u05BD\u05BF\u05C1\u05C2\u05C4\u05C5\u05C7\u0610-\u061A\u064B-\u065F\u0670\u06D6-\u06DC\u06DF-\u06E4\u06E7\u06E8\u06EA-\u06ED\u0711\u0730-\u074A\u07A6-\u07B0\u07EB-\u07F3\u07FD\u0816-\u0819\u081B-\u0823\u0825-\u0827\u0829-\u082D\u0859-\u085B\u08D3-\u08E1\u08E3-\u0903\u093A-\u093C\u093E-\u094F\u0951-\u0957\u0962\u0963\u0981-\u0983\u09BC\u09BE-\u09C4\u09C7\u09C8\u09CB-\u09CD\u09D7\u09E2\u09E3\u09FE\u0A01-\u0A03\u0A3C\u0A3E-\u0A42\u0A47\u0A48\u0A4B-\u0A4D\u0A51\u0A70\u0A71\u0A75\u0A81-\u0A83\u0ABC\u0ABE-\u0AC5\u0AC7-\u0AC9\u0ACB-\u0ACD\u0AE2\u0AE3\u0AFA-\u0AFF\u0B01-\u0B03\u0B3C\u0B3E-\u0B44\u0B47\u0B48\u0B4B-\u0B4D\u0B56\u0B57\u0B62\u0B63\u0B82\u0BBE-\u0BC2\u0BC6-\u0BC8\u0BCA-\u0BCD\u0BD7\u0C00-\u0C04\u0C3E-\u0C44\u0C46-\u0C48\u0C4A-\u0C4D\u0C55\u0C56\u0C62\u0C63\u0C81-\u0C83\u0CBC\u0CBE-\u0CC4\u0CC6-\u0CC8\u0CCA-\u0CCD\u0CD5\u0CD6\u0CE2\u0CE3\u0D00-\u0D03\u0D3B\u0D3C\u0D3E-\u0D44\u0D46-\u0D48\u0D4A-\u0D4D\u0D57\u0D62\u0D63\u0D82\u0D83\u0DCA\u0DCF-\u0DD4\u0DD6\u0DD8-\u0DDF\u0DF2\u0DF3\u0E31\u0E34-\u0E3A\u0E47-\u0E4E\u0EB1\u0EB4-\u0EB9\u0EBB\u0EBC\u0EC8-\u0ECD\u0F18\u0F19\u0F35\u0F37\u0F39\u0F3E\u0F3F\u0F71-\u0F84\u0F86\u0F87\u0F8D-\u0F97\u0F99-\u0FBC\u0FC6\u102B-\u103E\u1056-\u1059\u105E-\u1060\u1062-\u1064\u1067-\u106D\u1071-\u1074\u1082-\u108D\u108F\u109A-\u109D\u135D-\u135F\u1712-\u1714\u1732-\u1734\u1752\u1753\u1772\u1773\u17B4-\u17D3\u17DD\u180B-\u180D\u1885\u1886\u18A9\u1920-\u192B\u1930-\u193B\u1A17-\u1A1B\u1A55-\u1A5E\u1A60-\u1A7C\u1A7F\u1AB0-\u1ABE\u1B00-\u1B04\u1B34-\u1B44\u1B6B-\u1B73\u1B80-\u1B82\u1BA1-\u1BAD\u1BE6-\u1BF3\u1C24-\u1C37\u1CD0-\u1CD2\u1CD4-\u1CE8\u1CED\u1CF2-\u1CF4\u1CF7-\u1CF9\u1DC0-\u1DF9\u1DFB-\u1DFF\u20D0-\u20F0\u2CEF-\u2CF1\u2D7F\u2DE0-\u2DFF\u302A-\u302F\u3099\u309A\uA66F-\uA672\uA674-\uA67D\uA69E\uA69F\uA6F0\uA6F1\uA802\uA806\uA80B\uA823-\uA827\uA880\uA881\uA8B4-\uA8C5\uA8E0-\uA8F1\uA8FF\uA926-\uA92D\uA947-\uA953\uA980-\uA983\uA9B3-\uA9C0\uA9E5\uAA29-\uAA36\uAA43\uAA4C\uAA4D\uAA7B-\uAA7D\uAAB0\uAAB2-\uAAB4\uAAB7\uAAB8\uAABE\uAABF\uAAC1\uAAEB-\uAAEF\uAAF5\uAAF6\uABE3-\uABEA\uABEC\uABED\uFB1E\uFE00-\uFE0F\uFE20-\uFE2F]/g,""):e=>e;class Ce{constructor(e,{location:t=ue.location,threshold:s=ue.threshold,distance:n=ue.distance,includeMatches:r=ue.includeMatches,findAllMatches:i=ue.findAllMatches,minMatchCharLength:a=ue.minMatchCharLength,isCaseSensitive:o=ue.isCaseSensitive,ignoreDiacritics:c=ue.ignoreDiacritics,ignoreLocation:l=ue.ignoreLocation}={}){if(this.options={location:t,threshold:s,distance:n,includeMatches:r,findAllMatches:i,minMatchCharLength:a,isCaseSensitive:o,ignoreDiacritics:c,ignoreLocation:l},e=o?e:e.toLowerCase(),e=c?ye(e):e,this.pattern=e,this.chunks=[],!this.pattern.length)return;const u=(e,t)=>{this.chunks.push({pattern:e,alphabet:xe(e),startIndex:t})},d=this.pattern.length;if(d>ge){let e=0;const t=d%ge,s=d-t;for(;e<s;)u(this.pattern.substr(e,ge),e),e+=ge;if(t){const e=d-ge;u(this.pattern.substr(e),e)}}else u(this.pattern,0)}searchIn(e){const{isCaseSensitive:t,ignoreDiacritics:s,includeMatches:n}=this.options;if(e=t?e:e.toLowerCase(),e=s?ye(e):e,this.pattern===e){let t={isMatch:!0,score:0};return n&&(t.indices=[[0,e.length-1]]),t}const{location:r,distance:i,threshold:a,findAllMatches:o,minMatchCharLength:c,ignoreLocation:l}=this.options;let u=[],d=0,h=!1;this.chunks.forEach(({pattern:t,alphabet:s,startIndex:m})=>{const{isMatch:p,score:g,indices:f}=fe(e,t,s,{location:r+m,distance:i,threshold:a,findAllMatches:o,minMatchCharLength:c,includeMatches:n,ignoreLocation:l});p&&(h=!0),d+=g,p&&f&&(u=[...u,...f])});let m={isMatch:h,score:h?d/this.chunks.length:1};return h&&n&&(m.indices=u),m}}class be{constructor(e){this.pattern=e}static isMultiMatch(e){return je(e,this.multiRegex)}static isSingleMatch(e){return je(e,this.singleRegex)}search(){}}function je(e,t){const s=e.match(t);return s?s[1]:null}class Ae extends be{constructor(e,{location:t=ue.location,threshold:s=ue.threshold,distance:n=ue.distance,includeMatches:r=ue.includeMatches,findAllMatches:i=ue.findAllMatches,minMatchCharLength:a=ue.minMatchCharLength,isCaseSensitive:o=ue.isCaseSensitive,ignoreDiacritics:c=ue.ignoreDiacritics,ignoreLocation:l=ue.ignoreLocation}={}){super(e),this._bitapSearch=new Ce(e,{location:t,threshold:s,distance:n,includeMatches:r,findAllMatches:i,minMatchCharLength:a,isCaseSensitive:o,ignoreDiacritics:c,ignoreLocation:l})}static get type(){return"fuzzy"}static get multiRegex(){return/^"(.*)"$/}static get singleRegex(){return/^(.*)$/}search(e){return this._bitapSearch.searchIn(e)}}class ve extends be{constructor(e){super(e)}static get type(){return"include"}static get multiRegex(){return/^'"(.*)"$/}static get singleRegex(){return/^'(.*)$/}search(e){let t,s=0;const n=[],r=this.pattern.length;for(;(t=e.indexOf(this.pattern,s))>-1;)s=t+r,n.push([t,s-1]);const i=!!n.length;return{isMatch:i,score:i?0:1,indices:n}}}const Ne=[class extends be{constructor(e){super(e)}static get type(){return"exact"}static get multiRegex(){return/^="(.*)"$/}static get singleRegex(){return/^=(.*)$/}search(e){const t=e===this.pattern;return{isMatch:t,score:t?0:1,indices:[0,this.pattern.length-1]}}},ve,class extends be{constructor(e){super(e)}static get type(){return"prefix-exact"}static get multiRegex(){return/^\^"(.*)"$/}static get singleRegex(){return/^\^(.*)$/}search(e){const t=e.startsWith(this.pattern);return{isMatch:t,score:t?0:1,indices:[0,this.pattern.length-1]}}},class extends be{constructor(e){super(e)}static get type(){return"inverse-prefix-exact"}static get multiRegex(){return/^!\^"(.*)"$/}static get singleRegex(){return/^!\^(.*)$/}search(e){const t=!e.startsWith(this.pattern);return{isMatch:t,score:t?0:1,indices:[0,e.length-1]}}},class extends be{constructor(e){super(e)}static get type(){return"inverse-suffix-exact"}static get multiRegex(){return/^!"(.*)"\$$/}static get singleRegex(){return/^!(.*)\$$/}search(e){const t=!e.endsWith(this.pattern);return{isMatch:t,score:t?0:1,indices:[0,e.length-1]}}},class extends be{constructor(e){super(e)}static get type(){return"suffix-exact"}static get multiRegex(){return/^"(.*)"\$$/}static get singleRegex(){return/^(.*)\$$/}search(e){const t=e.endsWith(this.pattern);return{isMatch:t,score:t?0:1,indices:[e.length-this.pattern.length,e.length-1]}}},class extends be{constructor(e){super(e)}static get type(){return"inverse-exact"}static get multiRegex(){return/^!"(.*)"$/}static get singleRegex(){return/^!(.*)$/}search(e){const t=-1===e.indexOf(this.pattern);return{isMatch:t,score:t?0:1,indices:[0,e.length-1]}}},Ae],we=Ne.length,ke=/ +(?=(?:[^\"]*\"[^\"]*\")*[^\"]*$)/;const De=new Set([Ae.type,ve.type]);class Ee{constructor(e,{isCaseSensitive:t=ue.isCaseSensitive,ignoreDiacritics:s=ue.ignoreDiacritics,includeMatches:n=ue.includeMatches,minMatchCharLength:r=ue.minMatchCharLength,ignoreLocation:i=ue.ignoreLocation,findAllMatches:a=ue.findAllMatches,location:o=ue.location,threshold:c=ue.threshold,distance:l=ue.distance}={}){this.query=null,this.options={isCaseSensitive:t,ignoreDiacritics:s,includeMatches:n,minMatchCharLength:r,findAllMatches:a,ignoreLocation:i,location:o,threshold:c,distance:l},e=t?e:e.toLowerCase(),e=s?ye(e):e,this.pattern=e,this.query=function(e,t={}){return e.split("|").map(e=>{let s=e.trim().split(ke).filter(e=>e&&!!e.trim()),n=[];for(let r=0,i=s.length;r<i;r+=1){const e=s[r];let i=!1,a=-1;for(;!i&&++a<we;){const s=Ne[a];let r=s.isMultiMatch(e);r&&(n.push(new s(r,t)),i=!0)}if(!i)for(a=-1;++a<we;){const s=Ne[a];let r=s.isSingleMatch(e);if(r){n.push(new s(r,t));break}}}return n})}(this.pattern,this.options)}static condition(e,t){return t.useExtendedSearch}searchIn(e){const t=this.query;if(!t)return{isMatch:!1,score:1};const{includeMatches:s,isCaseSensitive:n,ignoreDiacritics:r}=this.options;e=n?e:e.toLowerCase(),e=r?ye(e):e;let i=0,a=[],o=0;for(let c=0,l=t.length;c<l;c+=1){const n=t[c];a.length=0,i=0;for(let t=0,r=n.length;t<r;t+=1){const r=n[t],{isMatch:c,indices:l,score:u}=r.search(e);if(!c){o=0,i=0,a.length=0;break}if(i+=1,o+=u,s){const e=r.constructor.type;De.has(e)?a=[...a,...l]:a.push(l)}}
1if(i){let e={isMatch:!0,score:o/i};return s&&(e.indices=a),e}}return{isMatch:!1,score:1}}}const Fe=[];function Me(e,t){for(let s=0,n=Fe.length;s<n;s+=1){let n=Fe[s];if(n.condition(e,t))return new n(e,t)}return new Ce(e,t)}const Se="$and",Be="$or",_e="$path",Le="$val",Ie=e=>!(!e[Se]&&!e[Be]),Oe=e=>({[Se]:Object.keys(e).map(t=>({[t]:e[t]}))});function $e(e,t,{auto:s=!0}={}){const n=e=>{let r=Object.keys(e);const i=(e=>!!e[_e])(e);if(!i&&r.length>1&&!Ie(e))return n(Oe(e));if((e=>!X(e)&&te(e)&&!Ie(e))(e)){const n=i?e[_e]:r[0],a=i?e[Le]:e[n];if(!Y(a))throw new Error((e=>`Invalid value for key ${e}`)(n));const o={keyId:le(n),pattern:a};return s&&(o.searcher=Me(a,t)),o}let a={children:[],operator:r[0]};return r.forEach(t=>{const s=e[t];X(s)&&s.forEach(e=>{a.children.push(n(e))})}),a};return Ie(e)||(e=Oe(e)),n(e)}function Re(e,t){const s=e.matches;t.matches=[],se(s)&&s.forEach(e=>{if(!se(e.indices)||!e.indices.length)return;const{indices:s,value:n}=e;let r={indices:s,value:n};e.key&&(r.key=e.key.src),e.idx>-1&&(r.refIndex=e.idx),t.matches.push(r)})}function Te(e,t){t.score=e.score}class ze{constructor(e,t={},s){this.options={...ue,...t},this.options.useExtendedSearch,this._keyStore=new ae(this.options.keys),this.setCollection(e,s)}setCollection(e,t){if(this._docs=e,t&&!(t instanceof he))throw new Error("Incorrect 'index' type");this._myIndex=t||me(this.options.keys,this._docs,{getFn:this.options.getFn,fieldNormWeight:this.options.fieldNormWeight})}add(e){se(e)&&(this._docs.push(e),this._myIndex.add(e))}remove(e=()=>!1){const t=[];for(let s=0,n=this._docs.length;s<n;s+=1){const r=this._docs[s];e(r,s)&&(this.removeAt(s),s-=1,n-=1,t.push(r))}return t}removeAt(e){this._docs.splice(e,1),this._myIndex.removeAt(e)}getIndex(){return this._myIndex}search(e,{limit:t=-1}={}){const{includeMatches:s,includeScore:n,shouldSort:r,sortFn:i,ignoreFieldNorm:a}=this.options;let o=Y(e)?Y(this._docs[0])?this._searchStringList(e):this._searchObjectList(e):this._searchLogical(e);return function(e,{ignoreFieldNorm:t=ue.ignoreFieldNorm}){e.forEach(e=>{let s=1;e.matches.forEach(({key:e,norm:n,score:r})=>{const i=e?e.weight:null;s*=Math.pow(0===r&&i?Number.EPSILON:r,(i||1)*(t?1:n))}),e.score=s})}(o,{ignoreFieldNorm:a}),r&&o.sort(i),Z(t)&&t>-1&&(o=o.slice(0,t)),function(e,t,{includeMatches:s=ue.includeMatches,includeScore:n=ue.includeScore}={}){const r=[];return s&&r.push(Re),n&&r.push(Te),e.map(e=>{const{idx:s}=e,n={item:t[s],refIndex:s};return r.length&&r.forEach(t=>{t(e,n)}),n})}(o,this._docs,{includeMatches:s,includeScore:n})}_searchStringList(e){const t=Me(e,this.options),{records:s}=this._myIndex,n=[];return s.forEach(({v:e,i:s,n:r})=>{if(!se(e))return;const{isMatch:i,score:a,indices:o}=t.searchIn(e);i&&n.push({item:e,idx:s,matches:[{score:a,value:e,norm:r,indices:o}]})}),n}_searchLogical(e){const t=$e(e,this.options),s=(e,t,n)=>{if(!e.children){const{keyId:s,searcher:r}=e,i=this._findMatches({key:this._keyStore.get(s),value:this._myIndex.getValueForItemAtKeyId(t,s),searcher:r});return i&&i.length?[{idx:n,item:t,matches:i}]:[]}const r=[];for(let i=0,a=e.children.length;i<a;i+=1){const a=e.children[i],o=s(a,t,n);if(o.length)r.push(...o);else if(e.operator===Se)return[]}return r},n=this._myIndex.records,r={},i=[];return n.forEach(({$:e,i:n})=>{if(se(e)){let a=s(t,e,n);a.length&&(r[n]||(r[n]={idx:n,item:e,matches:[]},i.push(r[n])),a.forEach(({matches:e})=>{r[n].matches.push(...e)}))}}),i}_searchObjectList(e){const t=Me(e,this.options),{keys:s,records:n}=this._myIndex,r=[];return n.forEach(({$:e,i:n})=>{if(!se(e))return;let i=[];s.forEach((s,n)=>{i.push(...this._findMatches({key:s,value:e[n],searcher:t}))}),i.length&&r.push({idx:n,item:e,matches:i})}),r}_findMatches({key:e,value:t,searcher:s}){if(!se(t))return[];let n=[];if(X(t))t.forEach(({v:t,i:r,n:i})=>{if(!se(t))return;const{isMatch:a,score:o,indices:c}=s.searchIn(t);a&&n.push({score:o,key:e,value:t,idx:r,norm:i,indices:c})});else{const{v:r,n:i}=t,{isMatch:a,score:o,indices:c}=s.searchIn(r);a&&n.push({score:o,key:e,value:r,norm:i,indices:c})}return n}}ze.version="7.1.0",ze.createIndex=me,ze.parseIndex=function(e,{getFn:t=ue.getFn,fieldNormWeight:s=ue.fieldNormWeight}={}){const{keys:n,records:r}=e,i=new he({getFn:t,fieldNormWeight:s});return i.setKeys(n),i.setIndexRecords(r),i},ze.config=ue,ze.parseQuery=$e,function(...e){Fe.push(...e)}(Ee);const Pe=k.COMPONENT_USAGE,We=["ChatInput","ChatOutput","TextInput","TextOutput","OpenAIModel","Prompt","ConditionalRouter","APIRequest"];function Ke(e){try{localStorage.setItem(Pe,JSON.stringify(e))}catch{}}function Ue(){const[t,s]=e.useState(()=>{const e=function(){try{const e=localStorage.getItem(Pe);return e?JSON.parse(e):{}}catch{return{}}}(),t=function(e){const t=Date.now(),s={};for(const[n,r]of Object.entries(e))t-r.lastUsed<7776e6&&(s[n]=r);return s}(e);return Object.keys(t).length!==Object.keys(e).length&&Ke(t),t});return{trackUsage:e.useCallback(e=>{s(t=>{const s=t[e],n={...t,[e]:{count:(s?.count??0)+1,lastUsed:Date.now(),recentCount:(s?.recentCount??0)+1}};return Ke(n),n})},[]),getCommonComponents:e.useCallback((e=8)=>{const s=function(e){const t=Date.now();return Object.entries(e).filter(([e,s])=>t-s.lastUsed<2592e6).map(([e,t])=>({name:e,entry:t})).sort((e,t)=>
1t.entry.recentCount-e.entry.recentCount)}(t);return s.length<5?We.slice(0,e):s.slice(0,e).map(e=>e.name)},[t]),getRecentlyUsed:e.useCallback((e=5)=>function(e,t){return Object.entries(e).map(([e,t])=>({name:e,entry:t})).sort((e,t)=>t.entry.lastUsed-e.entry.lastUsed).slice(0,t)}(t,e).map(e=>e.name),[t])}}const qe=e.memo(function({component:e,onAddNode:s,presentation:n="default",onDragLifecycle:r}){const c=q(e,o),l=!0===e.disabled||"coming_soon"===e.status,u=()=>{l||s?.(e)};return t.jsx("div",{draggable:!l,onDragStart:t=>{if(l)return void t.preventDefault();const s=t.currentTarget.cloneNode(!0);s.style.position="absolute",s.style.width="215px",s.style.top="-500px",s.style.right="-500px",s.classList.add("cursor-grabbing"),document.body.appendChild(s),t.dataTransfer.setDragImage(s,0,0);const n={type:e.category,node:{name:e.name,display_name:e.display_name,description:e.description,template:e.template||{},outputs:e.outputs||[],icon:e.icon,beta:e.beta||!1,provider:e.provider}};t.dataTransfer.setData("genericnode",JSON.stringify(n)),t.dataTransfer.effectAllowed="move",r?.("start")},onDragEnd:()=>{const e=document.getElementsByClassName("cursor-grabbing");e.length>0&&document.body.removeChild(e[0]),r?.("end")},onClick:e=>{e.detail>1||u()},onKeyDown:e=>{"Enter"!==e.key&&" "!==e.key||(e.preventDefault(),u())},tabIndex:l?-1:0,"aria-disabled":l||void 0,"data-palette-row":"text"===n?"":void 0,className:a("rounded-md outline-none","text"===n&&"focus-visible:ring-2 focus-visible:ring-sidebar-ring",l&&"cursor-not-allowed",l&&("text"===n?"opacity-75":"opacity-60"),!l&&"curs
1or-grab active:cursor-grabbing active:scale-[0.98] transition-transform duration-150 motion-reduce:transition-none"),"data-testid":"text"===n?`collapsed-component-${e.name.toLowerCase()}`:`component-${e.name.toLowerCase()}`,children:t.jsxs(D,{size:"sm",disabled:l,tabIndex:"text"===n?-1:void 0,className:a("transition-[width,height,padding,background-color,color] duration-150","motion-reduce:transition-none",l?"cursor-not-allowed":"cursor-grab active:cursor-grabbing"),children:["text"!==n&&t.jsx(c,{className:"h-4 w-4 shrink-0"}),t.jsx("span",{className:"truncate",children:e.display_name}),l?t.jsx(i,{variant:"secondaryStatic",size:"xq",className:"ml-auto shrink-0 text-xs",children:"Soon"}):e.beta&&t.jsx(i,{variant:"purpleStatic",size:"xq",className:"ml-auto shrink-0 text-xs",children:"Beta"})]})})});qe.displayName="ComponentMenuItem";const Je="__recently_used";function Ve(e){return e.startsWith("hsl(")&&e.endsWith(")")?`${e.slice(0,-1)} / 0.14)`:`color-mix(in srgb, ${e} 14%, transparent)`}function He(){return window.matchMedia("(pointer: coarse)").matches}function Ge(e){return e?Array.from(e.querySelectorAll('[data-palette-row]:not([aria-disabled="true"])')):[]}const Qe=e.memo(function({category:s,components:n,isOpen:r,onHoverStart:i,onHoverEnd:o,onKeyboardOpen:u,onDismiss:d,onCoarseToggle:h,onAddNode:m,onDragLifecycle:p,onTabOut:g,registerTrigger:f,isDragging:x,isDragFrozen:y,accent:C}){const b=`collapsed-palette-${s.name}`,j=`${b}-label`,A=e.useRef(!1),v=e.useRef(!1),N=e.useRef(!1),w=e.useRef(null),k=e.useRef(null),[E,F]=e.useState(!1),M=s.icon?c[s.icon]:l,S=()=>{He()||(F(!0),i(s.name))},I=()=>{He()||(F(!1),o())},O=e=>{(x()||(e=>{const t=e;return!!(t&&k.current&&k.current.contains(t))})(e.target??null))&&e.preventDefault()};return t.jsxs(B,{modal:!1,open:r,onOpenChange:e=>{x()||e||d()},children:[t.jsx(_,{asChild:!0,children:t.jsx("div",{className:"flex h-11 w-11 items-center justify-center",onPointerEnter:S,onPointerLeave:I,children:t.jsx(D,{ref:e=>{k.current=e,f(s.name,e)},"aria-label":s.display_name,"aria-haspopup":"dialog","aria-expanded":r,"aria-controls":b,"data-testid":`collapsed-category-${s.name}`,style:C&&(r||E)?{backgroundColor:Ve(C),color:C}:void 0,className:a("h-10 w-10 !size-10 justify-center p-0 group-data-[collapsible=icon]:!size-10 group-data-[collapsible=icon]:!p-0","focus-visible:ring-2 focus-visible:ring-sidebar-ring focus-visible:duration-0 [&>svg]:!size-[18px]","transition-colors duration-150 motion-reduce:transition-none",!C&&r&&"bg-sidebar-accent"),onPointerDown:()=>{v.current=!0},onKeyDownCapture:e=>{if(v.current=!1,"Tab"===e.key&&!e.shiftKey){const t=Ge(w.current);t.length>0&&(e.preventDefault(),e.stopPropagation(),t[0].focus())}},onBlur:()=>{v.current=!1},onFocus:()=>{A.current?A.current=!1:v.current||u(s.name)},onClick:e=>{e.preventDefault(),e.stopPropagation(),He()&&h(s.name)},children:t.jsx(M,{className:"size-[18px]"})})})}),t.jsxs(L,{ref:w,id:b,"data-testid":b,"aria-labelledby":j,side:"right",align:"start",sideOffset:8,collisionPadding:8,onOpenAutoFocus:e=>e.preventDefault(),onEscapeKeyDown:()=>{const e=document.activeElement;N.current=!(!e||!w.current?.contains(e))},onCloseAutoFocus:e=>{e.preventDefault(),N.current&&(N.current=!1,A.current=!0,k.current?.focus())},onInteractOutside:O,onPointerDownOutside:O,onFocusOutside:e=>{x()&&e.preventDefault()},onPointerEnter:S,onPointerLeave:I,onKeyDown:e=>{if("Tab"!==e.key)return;const t=Ge(w.current);if(0===t.length)return;const n=document.activeElement,r=t.findIndex(e=>e===n||e.contains(n));r<0||(e.preventDefault(),e.shiftKey?r<=0?(A.current=!0,k.current?.focus()):t[r-1].focus():r>=t.length-1?(d(),g(s.name)):t[r+1].focus())},className:a("w-64 max-h-[var(--radix-popover-content-available-height)] overflow-y-auto p-1","duration-150 data-[state=open]:animate-in data-[state=open]:fade-in-0 data-[state=open]:slide-in-from-left-[2px]","motion-reduce:data-[state=open]:slide-in-from-left-0 motion-reduce:duration-150",y&&"pointer-events-none"),children:[t.jsx("div",{id:j,className:a("sticky top-0 z-10 -mx-1 -mt-1 mb-1 truncate","border-b border-sidebar-border bg-popover px-3 py-2","text-[11px] font-semibold uppercase tracking-[0.06em] text-muted-foreground"),children:s.display_name}),t.jsx("div",{className:"flex flex-col gap-0.5",children:n.map(e=>t.jsx(qe,{component:e,onAddNode:m,presentation:"text",onDragLifecycle:p},e.name))})]})]})});function Xe({categories:s,getComponents:n,onAddNode:r,onTabPastEnd:i}){const{open:o}=E(),[c,l]=e.useState(null),u=e.useMemo(()=>new Map(s.map(e=>[e.name,n(e.name)])),[s,n]),d=e.useRef(null),h=e.useRef(null),m=e.useRef(!1),[p,g]=e.useState(!1),f=e.useRef(new Map),x=e.useRef(null);x.current=c;const y=e.useCallback(()=>{null!==d.current&&(window.clearTimeout(d.current),d.current=null),null!==h.current&&(window.clearTimeout(h.current),h.current=null)},[]),C=e.useCallback(()=>{m.current||(y(),l(null))},[y]),b=e.useCallback(e=>{y(),l(e)},[y]),j=e.useCallback(e=>{m.current||(y(),x.current!==e&&(d.current=window.setTimeout(()=>{l(e)},150)))},[y]),A=e.useCallback(()=>{m.current||(y(),h.current=window.setTimeout(()=>{m.current||l(null)},250))},[y]),v=e.useCallback(e=>{m.current="start"===e,g("start"===e),"end"===e&&(y(),l(null))},[y]),N=e.useCallback(e=>{x.current===e?C():b(e)},[C,b]),w=e.useCallback((e,t)=>{t?f.current.set(e,t):f.current.delete(e)},[]),k=e.useCallback(()=>m.current,[]),D=e.useCallback(e=>{const t=s.findIndex(t=>t.name===e);
1for(let n=t+1;t>=0&&n<s.length;n++){const e=f.current.get(s[n].name);if(e)return void e.focus()}i()},[s,i]);return e.useEffect(()=>{o&&(m.current=!1,g(!1),y(),l(null))},[o,y]),e.useEffect(()=>()=>{m.current=!1,y()},[y]),e.useEffect(()=>{c&&!s.some(e=>e.name===c)&&(m.current=!1,g(!1),y(),l(null))},[s,c,y]),t.jsx("div",{className:a("hidden min-h-0 flex-1 flex-col overflow-y-auto py-1","group-data-[collapsible=icon]:flex","scroll-fade-b [scrollbar-width:none] [&::-webkit-scrollbar]:hidden"),children:t.jsx(F,{className:"p-0",children:t.jsx(M,{className:"items-center gap-0.5",children:s.map(s=>{const n=u.get(s.name)??[];return 0===n.length?null:t.jsxs(e.Fragment,{children:[t.jsx(S,{className:"flex justify-center",children:t.jsx(Qe,{category:s,components:n,isOpen:c===s.name,onHoverStart:j,onHoverEnd:A,onKeyboardOpen:b,onDismiss:C,onCoarseToggle:N,onAddNode:r,onDragLifecycle:v,onTabOut:D,registerTrigger:w,isDragging:k,isDragFrozen:p,accent:(i=s.name,i===Je?null:I(i))})}),s.name===Je&&t.jsx("li",{"aria-hidden":"true",className:"my-1 h-px w-6 bg-sidebar-border"})]},s.name);var i})})})})}function Ye({onClearSearch:e,message:s="No components found.",clearSearchText:n="Clear your search",additionalText:r="or filter and try a different query."}){return t.jsx("div",{className:"flex h-full flex-col relative",children:t.jsx("div",{className:"flex h-full flex-col items-center justify-center p-3 text-center",children:t.jsxs("p",{className:"text-sm text-foreground",children:[s," ",t.jsx("button",{type:"button",className:"cursor-pointer underline underline-offset-4 hover:text-foreground transition-colors",onClick:e,children:n})," ",r]})})})}function Ze({icon:e,title:s,description:n}){return t.jsxs("div",{className:"flex h-full flex-col items-center justify-center p-8 text-center",children:[t.jsx("div",{className:"text-muted-foreground/50",children:e}),t.jsx("p",{className:"mt-4 text-sm font-medium text-foreground",children:s}),t.jsx("p",{className:"mt-1 text-xs text-secondary-foreground",children:n})]})}function et({showBeta:e,setShowBeta:s,showLegacy:n,setShowLegacy:r}){const a=[{id:"toggle-beta",label:"Beta",checked:e,onChange:s,badgeVariant:"purpleStatic",testId:"sidebar-beta-switch"},{id:"toggle-legacy",label:"Legacy",checked:n,onChange:r,badgeVariant:"secondaryStatic",testId:"sidebar-legacy-switch"}];return t.jsx("div",{className:"flex flex-col gap-1 px-2 py-1",children:a.map(e=>t.jsxs("div",{className:"flex min-h-11 items-center justify-between gap-3",children:[t.jsxs(u,{htmlFor:e.id,className:"flex cursor-pointer gap-2 text-sm font-medium",children:["Show",t.jsx(i,{variant:e.badgeVariant,size:"xq",className:"text-xs",children:e.label})]}),t.jsx(d,{id:e.id,checked:e.checked,onCheckedChange:e.onChange,"data-testid":e.testId})]},e.label))})}function tt({showConfig:e,setShowConfig:s}){return t.jsx("div",{className:"flex items-center justify-center",children:t.jsxs(h,{children:[t.jsx(m,{asChild:!0,children:t.jsx(p,{variant:e?"ghostActive":"ghost",size:"icon","data-testid":"sidebar-options-trigger","aria-label":"Component settings","aria-expanded":e,onClick:()=>s(!e),className:"h-8 w-8 p-0 "+(e?"bg-accent text-accent-foreground":"text-muted-foreground"),children:t.jsx(g,{className:"h-4 w-4"})})}),t.jsx(f,{side:"bottom",className:"z-50",children:"Component settings"})]})})}function st({display_name:e,shortcut:s,sidebar:n=!1}){const r=s?.split("+");return n?t.jsxs("div",{className:"flex justify-center",children:[e&&t.jsxs("span",{children:[" ",e," "]}),t.jsx("span",{className:a("flex h-4 w-4 items-center justify-center rounded-sm bg-muted text-muted-foreground text-xs font-medium",e&&"ml-3"),children:r?.join("+")})]}):t.jsxs("div",{className:"flex content-center items-center justify-center self-center text-xs",children:[t.jsxs("span",{children:[" ",e," "]}),t.jsx("span",{className:"ml-3 flex items-center rounded-sm bg-primary-hover px-1.5 py-[0.1em] text-muted",children:r?.join("+")})]})}Qe.displayName="CollapsedCategoryItem";const nt=e.memo(function({searchInputRef:e,isInputFocused:s,search:n,handleInputFocus:r,handleInputBlur:i,handleInputChange:a}){return t.jsxs("div",{className:"relative w-full flex-1",children:[t.jsx(x,{ref:e,type:"search",icon:"Search",name:"sidebar-search",role:"searchbox","aria-label":"Search components",autoComplete:"one-time-code","data-1p-ignore":!0,"data-lpignore":"true","data-form-type":"other","data-testid":"sidebar-search-input",inputClassName:"w-full rounded-lg bg-background text-sm",placeholder:"Search",onFocus:r,onBlur:i,onChange:a,value:n}),!s&&""===n&&t.jsx("div",{className:"pointer-events-none absolute inset-y-0 right-2 top-1/2 flex -translate-y-1/2 items-center justify-between gap-2 text-sm text-muted-foreground",children:t.jsx("span",{children:t.jsx(st,{sidebar:!0,shortcut:"/"})})})]})});function rt({name:e,description:s,resetFilters:n}){const r=s.split("\n"),i=r.length>
11?"s":"";return t.jsxs("div",{className:"mb-0.5 flex w-full items-center overflow-hidden justify-between rounded border border-border p-2 text-sm text-foreground",children:[t.jsxs("div",{className:"flex flex-1 items-center gap-1.5 overflow-hidden",children:[t.jsx(y,{className:"h-4 w-4 shrink-0",strokeWidth:2}),t.jsxs("div",{className:"flex flex-1 overflow-hidden",children:[e,i,":"," ",t.jsx("div",{className:"flex-1 overflow-hidden truncate pl-1",children:r.join(", ")})]})]}),t.jsxs(h,{children:[t.jsx(m,{asChild:!0,children:t.jsx(p,{variant:"ghost",size:"icon",className:"h-auto w-auto shrink-0 p-0 hover:bg-transparent",onClick:n,"aria-label":"Clear filter","data-testid":"sidebar-filter-reset",children:t.jsx(J,{className:"h-4 w-4",strokeWidth:2,"aria-hidden":"true"})})}),t.jsx(f,{side:"right",className:"max-w-full",children:"Remove filter"})]})]})}function it(){return t.jsxs("div",{className:"flex items-center gap-2 rounded-md border-l-[3px] border-border bg-muted p-1 px-2",children:[t.jsx(V,{className:"h-6 w-6 shrink-0"}),t.jsx("div",{className:"flex-1",children:t.jsx(V,{className:"h-4 w-32"})})]})}function at({itemCount:e=3}){return t.jsxs("div",{className:"space-y-2 py-3",children:[t.jsxs("div",{className:"flex items-center gap-2 py-2",children:[t.jsx(V,{className:"h-4 w-4"}),t.jsx(V,{className:"h-4 w-24"}),t.jsx(V,{className:"h-4 w-8"})]}),t.jsx("div",{className:"space-y-2",children:Array.from({length:e}).map((e,s)=>t.jsx(it,{},s))})]})}nt.displayName="SearchInput";const ot=[3,2,4,3,2];function ct({categoryCount:e=4}){return t.jsx("div",{className:"w-full space-y-0",children:Array.from({length:e}).map((e,s)=>t.jsx(at,{itemCount:ot[s%ot.length]},s))})}const lt=e.memo(function({categoryName:e,displayName:s,icon:n,categoryColor:r,components:i,isOpen:o,onToggle:c,onAddNode:l,description:u}){return t.jsx(F,{className:"p-0",children:t.jsx(H,{open:o,onOpenChange:c,children:t.jsx(M,{children:t.jsxs(S,{children:[t.jsx(G,{asChild:!0,children:t.jsxs(D,{className:u?"h-11":"h-9",children:[t.jsx(n,{className:"h-4 w-4 shrink-0"}),t.jsxs("div",{className:"flex flex-1 flex-col min-w-0",children:[t.jsx("span",{className:"truncate",children:s}),u&&t.jsx("span",{className:"text-xs leading-4 text-muted-foreground truncate",children:u})]}),t.jsx(A,{className:a("h-4 w-4 shrink-0 text-sidebar-foreground/50 transition-transform duration-200",o&&"rotate-90")})]})}),t.jsx(Q,{children:t.jsx("ul",{"data-sidebar":"menu-sub",className:a("mx-3.5 flex min-w-0 translate-x-px flex-col gap-0.5 border-l-[0.5px] px-2.5 py-1","group-data-[collapsible=icon]:hidden"),style:{borderLeftColor:r},children:i.map(e=>t.jsx("li",{children:t.jsx(qe,{component:e,onAddNode:l})},e.name))})})]})})})})});function ut({onAddNode:i}){const o=(e,t)=>{try{const s=localStorage.getItem(e);return null!==s?JSON.parse(s):t}catch{return t}},{open:u,setOpen:d}=E(),g=s(e=>e.getFilterEdge),x=s(e=>e.filterType),y=s(e=>e.clearFilters),{searchTerm:k,debouncedSearchTerm:B,isSearching:_,setSearchTerm:L,clearSearch:q}=U("",300),[J,V]=e.useState(!1),[X,Y]=e.useState(()=>o("showBeta",!0)),[Z,ee]=e.useState(()=>o("showLegacy",!1)),[te,se]=e.useState(!1),[ne,re]=e.useState(["__recently_used"]),[ie,ae]=e.useState(!1),[oe,ce]=e.useState(!1),le=e.useRef(null),ue=e.useRef(null),{trackUsage:de,getRecentlyUsed:he}=Ue(),me=C(),pe=(me.data?.installations??[]).some(e=>!1!==e.enabled),ge=e.useCallback(e=>{de(e.name),i?.(e)},[i,de]),fe=e.useCallback(()=>{ue.current?.focus()},[]),xe=e.useCallback(()=>{window.dispatchEvent(new Event("lf:focus-search"))},[]);e.useEffect(()=>{localStorage.setItem("showBeta",JSON.stringify(X))},[X]),e.useEffect(()=>{localStorage.setItem("showLegacy",JSON.stringify(Z))},[Z]),e.useEffect(()=>{se(_)},[_]),e.useEffect(()=>{const e=()=>{u||d(!0),setTimeout(()=>le.current?.focus(),100)};return window.addEventListener("lf:focus-search",e),()=>window.removeEventListener("lf:focus-search",e)},[u,d]),e.useEffect(()=>{const e=()=>ce(!1);return window.addEventListener("lf:end-add-note",e),()=>window.removeEventListener("lf:end-add-note",e)},[]);const ye=e.useCallback(()=>{window.dispatchEvent(new Event("lf:start-add-note")),ce(!0)},[]),Ce=e.useCallback(e=>{ae(!0)},[]),be=e.useCallback(e=>{ae(!1)},[]),je=e.useCallback(e=>{L(e.target.value)},[L]),Ae=e.useMemo(()=>new ze(n,{keys:["name","display_name","description","category"],threshold:.3,includeScore:!0}),[]),ve=e.useMemo(()=>{let e=n;if(pe||(e=e.filter(e=>!e.requiresCockpit)),X||(e=e.filter(e=>!e.beta)),g.length>0&&(e=K(e,g)),!B.trim())return e;return Ae.search(B).map(e=>e.item).filter(t=>e.includes(t))},[B,Ae,X,Z,g,pe]),Ne=e.useMemo(()=>{const e=new Set(ve.map(e=>e.category));return r.filter(t=>e.has(t.name))},[ve]),we=e.useMemo(()=>{const e=[];
1if(x&&g.length>0){const t=Array.isArray(x.type)?x.type.join(", "):x.type;e.push({name:"Connection",description:`Compatible with: ${t}`,reset:y})}return k.trim()&&e.push({name:"Filter",description:`Search: "${k}"`,reset:()=>L("")}),e},[k,x,g,y,L]),ke=e.useCallback(()=>{q()},[q]);e.useEffect(()=>{if(g.length>0){const e=Ne.map(e=>e.name);re(e)}},[g,Ne]);const De=e.useCallback((e,t)=>{re(s=>t?[...s,e]:s.filter(t=>t!==e))},[]),Ee=B.trim().length>0,Fe=ve.length>0,Me=e.useMemo(()=>he(5).map(e=>n.find(t=>t.name===e)).filter(e=>null!=e&&(pe||!e.requiresCockpit)),[he,pe]),Se=e.useCallback(e=>ve.filter(t=>t.category===e),[ve]),Be=e.useMemo(()=>Se("integrations"),[Se]),_e=e.useMemo(()=>Ee||0===Me.length?Ne:[{name:Je,display_name:"Recently Used",description:"",icon:"Clock"},...Ne],[Ee,Me,Ne]),Le=e.useCallback(e=>e===Je?Me:Se(e),[Me,Se]);return t.jsxs(O,{collapsible:"icon",side:"left",children:[t.jsxs($,{className:"border-b border-sidebar-border p-2 group-data-[collapsible=icon]:p-0.5",children:[t.jsxs("div",{className:"hidden flex-col items-center gap-0.5 group-data-[collapsible=icon]:flex",children:[t.jsx("div",{className:"flex h-11 w-11 items-center justify-center",children:t.jsx(R,{"data-testid":"sidebar-collapsed-toggle",className:"h-10 w-10 text-muted-foreground focus-visible:duration-0 [&>svg]:!size-[18px]"})}),t.jsx("div",{"aria-hidden":"true",className:"h-px w-6 bg-sidebar-border"}),t.jsx("div",{className:"flex h-11 w-11 items-center justify-center",children:t.jsxs(h,{children:[t.jsx(m,{asChild:!0,children:t.jsx(p,{variant:"ghost",size:"icon",onClick:xe,className:"h-10 w-10 text-muted-foreground focus-visible:duration-0","data-testid":"sidebar-collapsed-search","aria-label":"Search components",children:t.jsx(b,{className:"size-[18px]"})})}),t.jsx(f,{side:"right",children:"Search components"})]})})]}),t.jsxs("div",{className:"flex flex-col gap-2 group-data-[collapsible=icon]:hidden",children:[t.jsxs("div",{className:"flex w-full items-center gap-2 px-1",children:[t.jsx(R,{className:"h-8 w-8 text-muted-foreground"}),t.jsx("h2",{className:"flex-1 cursor-default text-sm font-semibold tracking-tight",children:"Components"}),t.jsx(tt,{showConfig:J,setShowConfig:V})]}),J&&t.jsx(et,{showBeta:X,setShowBeta:Y,showLegacy:Z,setShowLegacy:ee}),t.jsx(nt,{searchInputRef:le,isInputFocused:ie,search:k,handleInputFocus:Ce,handleInputBlur:be,handleInputChange:je}),we.length>0&&t.jsx("div",{className:"space-y-1",children:we.map((e,s)=>t.jsx(rt,{name:e.name,description:e.description,resetFilters:e.reset},s))})]})]}),t.jsxs(T,{children:[t.jsx(Xe,{categories:_e,getComponents:Le,onAddNode:ge,onTabPastEnd:fe}),t.jsx("div",{className:"group-data-[collapsible=icon]:hidden px-2 py-1",children:te?t.jsx(ct,{}):Fe?t.jsxs(t.Fragment,{children:[!Ee&&Me.length>0&&t.jsx(F,{className:"p-0",children:t.jsx(H,{open:ne.includes("__recently_used"),onOpenChange:e=>De("__recently_used",e),children:t.jsx(M,{children:t.jsxs(S,{children:[t.jsx(G,{asChild:!0,children:t.jsxs(D,{className:"h-9",children:[t.jsx(j,{className:"h-4 w-4 shrink-0"}),t.jsx("span",{className:"flex-1 truncate",children:"Recently Used"}),t.jsx(A,{className:a("h-4 w-4 shrink-0 text-sidebar-foreground/50 transition-transform duration-200",ne.includes("__recently_used")&&"rotate-90")})]})}),t.jsx(Q,{children:t.jsx("ul",{"data-sidebar":"menu-sub",className:"mx-3.5 flex min-w-0 translate-x-px flex-col gap-0.5 border-l-[0.5px] px-2.5 py-1 group-data-[collapsible=icon]:hidden",style:{borderLeftColor:"hsl(var(--sidebar-border))"},children:Me.map(e=>t.jsx("li",{children:t.jsx(qe,{component:e,onAddNode:ge})},`recent-${e.name}`))})})]})})})}),!Ee&&Me.length>0&&t.jsx("div",{className:"mx-2 my-2 h-px bg-sidebar-border"}),Ne.filter(e=>"integrations"!==e.name).map(e=>{const s=e.icon?c[e.icon]:l,n=Se(e.name);return 0===n.length?null:t.jsx(lt,{categoryName:e.name,displayName:e.display_name,icon:s,categoryColor:I(e.name),components:n,isOpen:ne.includes(e.name),onToggle:t=>De(e.name,t),onAddNode:ge},e.name)}),t.jsx(lt,{categoryName:"__integrations",displayName:"App Connections",description:"Gmail, Slack, Sheets, and more",icon:v,categoryColor:I("integrations"),components:Be,isOpen:ne.includes("__integrations"),onToggle:e=>De("__integrations",e),onAddNode:ge}),t.jsx(F,{className:"p-0",children:t.jsx(H,{open:ne.includes("__mcp"),onOpenChange:e=>De("__mcp",e),children:t.jsx(M,{children:t.jsxs(S,{children:[t.jsx(G,{asChild:!0,children:t.jsxs(D,{className:"h-11",children:[t.jsx(N,{className:"h-4 w-4 shrink-0"}),t.jsxs("div",{className:"flex flex-1 flex-col min-w-0",children:[t.jsx("span",{className:"truncate",children:"MCP Servers"}),t.jsx("span",{className:"text-xs leading-4 text-muted-foreground truncate",children:"Model Context Protocol servers"})]}),t.jsx(A,{className:a("h-4 w-4 shrink-0 text-sidebar-foreground
1/50 transition-transform duration-200",ne.includes("__mcp")&&"rotate-90")})]})}),t.jsx(Q,{children:t.jsx(z,{children:t.jsx(Ze,{icon:t.jsx(N,{className:"h-12 w-12"}),title:"No MCP Servers Added",description:""})})})]})})})})]}):t.jsx(Ye,{onClearSearch:ke,message:"No components found.",clearSearchText:"Clear your search",additionalText:"or adjust filters and try again."})})]}),t.jsxs(P,{className:"border-t border-sidebar-border p-1 gap-1 group-data-[collapsible=icon]:p-0.5",children:[t.jsx("div",{className:"hidden group-data-[collapsible=icon]:flex h-11 w-11 items-center justify-center mx-auto",children:t.jsxs(h,{children:[t.jsx(m,{asChild:!0,children:t.jsx(p,{ref:ue,variant:"ghost",size:"icon",onClick:ye,className:a("h-10 w-10 focus-visible:duration-0",oe&&"bg-accent text-accent-foreground"),"data-testid":"sidebar-add-sticky-note-button-collapsed","aria-label":"Add Sticky Note",children:t.jsx(w,{className:"size-[18px]"})})}),t.jsx(f,{side:"right",children:"Add Sticky Note"})]})}),t.jsx("div",{className:"group-data-[collapsible=icon]:hidden flex flex-col gap-1",children:t.jsxs(p,{variant:"ghost",onClick:ye,className:a("h-auto w-full justify-start gap-3 px-4 py-2 font-normal hover:bg-sidebar-accent",oe&&"bg-accent text-accent-foreground"),"data-testid":"sidebar-add-sticky-note-button",children:[t.jsx(w,{className:"h-4 w-4 text-muted-foreground"}),t.jsx("span",{children:"Add Sticky Note"})]})})]}),t.jsx(W,{className:"right-0 translate-x-0 after:left-auto after:right-0"})]})}lt.displayName="CategoryGroup";export{ut as default};
Line numbers count LF bytes from the start of the resource, as the search results do. Vendor segments are library code the classifier recognised; they are stored but not indexed. Bytes are shown as Latin1 characters, one per byte.