import{s as Re,y as ye,z as Me,a as T,d as v,f as p,i as D,g as I,n as de,B as Ft,E as Wt,j as Se,p as Ht,G as Kt,q as Ut,k as F,o as W,e as N,c as C,r as Gt,v as Yt,w as Zt,x as Jt,J as Te,t as Y,b as Z,h as re,C as nt,u as Ee,F as Qt,L as lt,A as Ve}from"./scheduler.DB3Sqaa-.js";import{S as xe,i as Pe,f as Xt,b as X,d as q,m as ee,t as S,a as R,e as te,g as le,c as ie}from"./index.CidI1d1E.js";import{e as he}from"./each.cN4tVpvB.js";import{T as Ae,m as it}from"./create.DJSy4-Dz.js";import{M as qt,a as es,b as ts}from"./menu-trigger.Syw7IYi9.js";import{f as ss}from"./index.DMdt0oYD.js";import{C as rs}from"./Selector.svelte_svelte_type_style_lang.WKCdmVFr.js";import{g as ns,p as ls,d as is}from"./index.BDkw09Wf.js";import{M as ke,k as os,u as as,l as ot,m as cs}from"./index.DPWiq6NR.js";import{t as fe}from"./Toaster.svelte_svelte_type_style_lang.C-7zrEBl.js";import{s as us,f as at}from"./index.DYGdzELC.js";import{g as fs}from"./index.BS8UhGmM.js";import{S as hs}from"./Switch.C2EOWhLk.js";import{g as ds}from"./entry.JtQ7vg2d.js";function ce(r){return Array.isArray?Array.isArray(r):Rt(r)==="[object Array]"}const ms=1/0;function gs(r){if(typeof r=="string")return r;let e=r+"";return e=="0"&&1/r==-ms?"-0":e}function ps(r){return r==null?"":gs(r)}function oe(r){return typeof r=="string"}function Tt(r){return typeof r=="number"}function _s(r){return r===!0||r===!1||vs(r)&&Rt(r)=="[object Boolean]"}function Dt(r){return typeof r=="object"}function vs(r){return Dt(r)&&r!==null}function Q(r){return r!=null}function je(r){return!r.trim().length}function Rt(r){return r==null?r===void 0?"[object Undefined]":"[object Null]":Object.prototype.toString.call(r)}const ws="Incorrect 'index' type",bs=r=>`Invalid value for key ${r}`,ks=r=>`Pattern length exceeds max of ${r}.`,ys=r=>`Missing ${r} property in key`,Ms=r=>`Property 'weight' in key '${r}' must be a positive integer`,ct=Object.prototype.hasOwnProperty;class Es{constructor(e){this._keys=[],this._keyMap={};let t=0;e.forEach(s=>{let n=Vt(s);this._keys.push(n),this._keyMap[n.id]=n,t+=n.weight}),this._keys.forEach(s=>{s.weight/=t})}get(e){return this._keyMap[e]}keys(){return this._keys}toJSON(){return JSON.stringify(this._keys)}}function Vt(r){let e=null,t=null,s=null,n=1,l=null;if(oe(r)||ce(r))s=r,e=ut(r),t=ze(r);else{if(!ct.call(r,"name"))throw new Error(ys("name"));const i=r.name;if(s=i,ct.call(r,"weight")&&(n=r.weight,n<=0))throw new Error(Ms(i));e=ut(i),t=ze(i),l=r.getFn}return{path:e,id:t,weight:n,src:s,getFn:l}}function ut(r){return ce(r)?r:r.split(".")}function ze(r){return ce(r)?r.join("."):r}function Is(r,e){let t=[],s=!1;const n=(l,i,o)=>{if(Q(l))if(!i[o])t.push(l);else{let a=i[o];const u=l[a];if(!Q(u))return;if(o===i.length-1&&(oe(u)||Tt(u)||_s(u)))t.push(ps(u));else if(ce(u)){s=!0;for(let c=0,m=u.length;cr.score===e.score?r.idx{this._keysMap[t.id]=s})}create(){this.isCreated||!this.docs.length||(this.isCreated=!0,oe(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();oe(e)?this._addString(e,t):this._addObject(e,t)}removeAt(e){this.records.splice(e,1);for(let t=e,s=this.size();t{let i=n.getFn?n.getFn(e):this.getFn(e,n.path);if(Q(i)){if(ce(i)){let o=[];const a=[{nestedArrIndex:-1,value:i}];for(;a.length;){const{nestedArrIndex:u,value:c}=a.pop();if(Q(c))if(oe(c)&&!je(c)){let m={v:c,i:u,n:this.norm.get(c)};o.push(m)}else ce(c)&&c.forEach((m,f)=>{a.push({nestedArrIndex:f,value:m})})}s.$[l]=o}else if(oe(i)&&!je(i)){let o={v:i,n:this.norm.get(i)};s.$[l]=o}}}),this.records.push(s)}toJSON(){return{keys:this.keys,records:this.records}}}function xt(r,e,{getFn:t=$.getFn,fieldNormWeight:s=$.fieldNormWeight}={}){const n=new Ue({getFn:t,fieldNormWeight:s});return n.setKeys(r.map(Vt)),n.setSources(e),n.create(),n}function Os(r,{getFn:e=$.getFn,fieldNormWeight:t=$.fieldNormWeight}={}){const{keys:s,records:n}=r,l=new Ue({getFn:e,fieldNormWeight:t});return l.setKeys(s),l.setIndexRecords(n),l}function Oe(r,{errors:e=0,currentLocation:t=0,expectedLocation:s=0,distance:n=$.distance,ignoreLocation:l=$.ignoreLocation}={}){const i=e/r.length;if(l)return i;const o=Math.abs(s-t);return n?i+o/n:o?1:i}function Ts(r=[],e=$.minMatchCharLength){let t=[],s=-1,n=-1,l=0;for(let i=r.length;l=e&&t.push([s,n]),s=-1)}return r[l-1]&&l-s>=e&&t.push([s,l-1]),t}const be=32;function Ds(r,e,t,{location:s=$.location,distance:n=$.distance,threshold:l=$.threshold,findAllMatches:i=$.findAllMatches,minMatchCharLength:o=$.minMatchCharLength,includeMatches:a=$.includeMatches,ignoreLocation:u=$.ignoreLocation}={}){if(e.length>be)throw new Error(ks(be));const c=e.length,m=r.length,f=Math.max(0,Math.min(s,m));let k=l,w=f;const V=o>1||a,b=V?Array(m):[];let y;for(;(y=r.indexOf(e,w))>-1;){let d=Oe(e,{currentLocation:y,expectedLocation:f,distance:n,ignoreLocation:u});if(k=Math.min(d,k),w=y+c,V){let g=0;for(;g=P;K-=1){let ae=K-1,ge=t[r.charAt(ae)];if(V&&(b[ae]=+!!ge),z[K]=(z[K+1]<<1|1)&ge,d&&(z[K]|=(O[K+1]|O[K])<<1|1|O[K+1]),z[K]&M&&(E=Oe(e,{errors:d,currentLocation:ae,expectedLocation:f,distance:n,ignoreLocation:u}),E<=k)){if(k=E,w=ae,w<=f)break;P=Math.max(1,2*f-w)}}if(Oe(e,{errors:d+1,currentLocation:f,expectedLocation:f,distance:n,ignoreLocation:u})>k)break;O=z}const h={isMatch:w>=0,score:Math.max(.001,E)};if(V){const d=Ts(b,o);d.length?a&&(h.indices=d):h.isMatch=!1}return h}function Rs(r){let e={};for(let t=0,s=r.length;t{this.chunks.push({pattern:f,alphabet:Rs(f),startIndex:k})},m=this.pattern.length;if(m>be){let f=0;const k=m%be,w=m-k;for(;f{const{isMatch:y,score:O,indices:E}=Ds(e,w,V,{location:n+b,distance:l,threshold:i,findAllMatches:o,minMatchCharLength:a,includeMatches:s,ignoreLocation:u});y&&(f=!0),m+=O,y&&E&&(c=[...c,...E])});let k={isMatch:f,score:f?m/this.chunks.length:1};return f&&s&&(k.indices=c),k}}class me{constructor(e){this.pattern=e}static isMultiMatch(e){return ft(e,this.multiRegex)}static isSingleMatch(e){return ft(e,this.singleRegex)}search(){}}function ft(r,e){const t=r.match(e);return t?t[1]:null}class Vs extends me{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]}}}class xs extends me{constructor(e){super(e)}static get type(){return"inverse-exact"}static get multiRegex(){return/^!"(.*)"$/}static get singleRegex(){return/^!(.*)$/}search(e){const s=e.indexOf(this.pattern)===-1;return{isMatch:s,score:s?0:1,indices:[0,e.length-1]}}}class Ps extends me{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 js extends me{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 zs extends me{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 Bs extends me{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 jt extends me{constructor(e,{location:t=$.location,threshold:s=$.threshold,distance:n=$.distance,includeMatches:l=$.includeMatches,findAllMatches:i=$.findAllMatches,minMatchCharLength:o=$.minMatchCharLength,isCaseSensitive:a=$.isCaseSensitive,ignoreLocation:u=$.ignoreLocation}={}){super(e),this._bitapSearch=new Pt(e,{location:t,threshold:s,distance:n,includeMatches:l,findAllMatches:i,minMatchCharLength:o,isCaseSensitive:a,ignoreLocation:u})}static get type(){return"fuzzy"}static get multiRegex(){return/^"(.*)"$/}static get singleRegex(){return/^(.*)$/}search(e){return this._bitapSearch.searchIn(e)}}class zt extends me{constructor(e){super(e)}static get type(){return"include"}static get multiRegex(){return/^'"(.*)"$/}static get singleRegex(){return/^'(.*)$/}search(e){let t=0,s;const n=[],l=this.pattern.length;for(;(s=e.indexOf(this.pattern,t))>-1;)t=s+l,n.push([s,t-1]);const i=!!n.length;return{isMatch:i,score:i?0:1,indices:n}}}const Be=[Vs,zt,Ps,js,Bs,zs,xs,jt],ht=Be.length,Fs=/ +(?=(?:[^\"]*\"[^\"]*\")*[^\"]*$)/,Ws="|";function Hs(r,e={}){return r.split(Ws).map(t=>{let s=t.trim().split(Fs).filter(l=>l&&!!l.trim()),n=[];for(let l=0,i=s.length;l!!(r[De.AND]||r[De.OR]),Ys=r=>!!r[He.PATH],Zs=r=>!ce(r)&&Dt(r)&&!Ke(r),dt=r=>({[De.AND]:Object.keys(r).map(e=>({[e]:r[e]}))});function Bt(r,e,{auto:t=!0}={}){const s=n=>{let l=Object.keys(n);const i=Ys(n);if(!i&&l.length>1&&!Ke(n))return s(dt(n));if(Zs(n)){const a=i?n[He.PATH]:l[0],u=i?n[He.PATTERN]:n[a];if(!oe(u))throw new Error(bs(a));const c={keyId:ze(a),pattern:u};return t&&(c.searcher=We(u,e)),c}let o={children:[],operator:l[0]};return l.forEach(a=>{const u=n[a];ce(u)&&u.forEach(c=>{o.children.push(s(c))})}),o};return Ke(r)||(r=dt(r)),s(r)}function Js(r,{ignoreFieldNorm:e=$.ignoreFieldNorm}){r.forEach(t=>{let s=1;t.matches.forEach(({key:n,norm:l,score:i})=>{const o=n?n.weight:null;s*=Math.pow(i===0&&o?Number.EPSILON:i,(o||1)*(e?1:l))}),t.score=s})}function Qs(r,e){const t=r.matches;e.matches=[],Q(t)&&t.forEach(s=>{if(!Q(s.indices)||!s.indices.length)return;const{indices:n,value:l}=s;let i={indices:n,value:l};s.key&&(i.key=s.key.src),s.idx>-1&&(i.refIndex=s.idx),e.matches.push(i)})}function Xs(r,e){e.score=r.score}function qs(r,e,{includeMatches:t=$.includeMatches,includeScore:s=$.includeScore}={}){const n=[];return t&&n.push(Qs),s&&n.push(Xs),r.map(l=>{const{idx:i}=l,o={item:e[i],refIndex:i};return n.length&&n.forEach(a=>{a(l,o)}),o})}class Ie{constructor(e,t={},s){this.options={...$,...t},this.options.useExtendedSearch,this._keyStore=new Es(this.options.keys),this.setCollection(e,s)}setCollection(e,t){if(this._docs=e,t&&!(t instanceof Ue))throw new Error(ws);this._myIndex=t||xt(this.options.keys,this._docs,{getFn:this.options.getFn,fieldNormWeight:this.options.fieldNormWeight})}add(e){Q(e)&&(this._docs.push(e),this._myIndex.add(e))}remove(e=()=>!1){const t=[];for(let s=0,n=this._docs.length;s-1&&(a=a.slice(0,t)),qs(a,this._docs,{includeMatches:s,includeScore:n})}_searchStringList(e){const t=We(e,this.options),{records:s}=this._myIndex,n=[];return s.forEach(({v:l,i,n:o})=>{if(!Q(l))return;const{isMatch:a,score:u,indices:c}=t.searchIn(l);a&&n.push({item:l,idx:i,matches:[{score:u,value:l,norm:o,indices:c}]})}),n}_searchLogical(e){const t=Bt(e,this.options),s=(o,a,u)=>{if(!o.children){const{keyId:m,searcher:f}=o,k=this._findMatches({key:this._keyStore.get(m),value:this._myIndex.getValueForItemAtKeyId(a,m),searcher:f});return k&&k.length?[{idx:u,item:a,matches:k}]:[]}const c=[];for(let m=0,f=o.children.length;m{if(Q(o)){let u=s(t,o,a);u.length&&(l[a]||(l[a]={idx:a,item:o,matches:[]},i.push(l[a])),u.forEach(({matches:c})=>{l[a].matches.push(...c)}))}}),i}_searchObjectList(e){const t=We(e,this.options),{keys:s,records:n}=this._myIndex,l=[];return n.forEach(({$:i,i:o})=>{if(!Q(i))return;let a=[];s.forEach((u,c)=>{a.push(...this._findMatches({key:u,value:i[c],searcher:t}))}),a.length&&l.push({idx:o,item:i,matches:a})}),l}_findMatches({key:e,value:t,searcher:s}){if(!Q(t))return[];let n=[];if(ce(t))t.forEach(({v:l,i,n:o})=>{if(!Q(l))return;const{isMatch:a,score:u,indices:c}=s.searchIn(l);a&&n.push({score:u,key:e,value:l,idx:i,norm:o,indices:c})});else{const{v:l,n:i}=t,{isMatch:o,score:a,indices:u}=s.searchIn(l);o&&n.push({score:a,key:e,value:l,norm:i,indices:u})}return n}}Ie.version="7.0.0";Ie.createIndex=xt;Ie.parseIndex=Os;Ie.config=$;Ie.parseQuery=Bt;Gs(Us);function er(r){let e,t;return{c(){e=ye("svg"),t=ye("path"),this.h()},l(s){e=Me(s,"svg",{xmlns:!0,fill:!0,viewBox:!0,"stroke-width":!0,stroke:!0,class:!0});var n=T(e);t=Me(n,"path",{"stroke-linecap":!0,"stroke-linejoin":!0,d:!0}),T(t).forEach(v),n.forEach(v),this.h()},h(){p(t,"stroke-linecap","round"),p(t,"stroke-linejoin","round"),p(t,"d","m4.5 12.75 6 6 9-13.5"),p(e,"xmlns","http://www.w3.org/2000/svg"),p(e,"fill","none"),p(e,"viewBox","0 0 24 24"),p(e,"stroke-width",r[1]),p(e,"stroke","currentColor"),p(e,"class",r[0])},m(s,n){D(s,e,n),I(e,t)},p(s,[n]){n&2&&p(e,"stroke-width",s[1]),n&1&&p(e,"class",s[0])},i:de,o:de,d(s){s&&v(e)}}}function tr(r,e,t){let{className:s="w-4 h-4"}=e,{strokeWidth:n="1.5"}=e;return r.$$set=l=>{"className"in l&&t(0,s=l.className),"strokeWidth"in l&&t(1,n=l.strokeWidth)},[s,n]}class sr extends xe{constructor(e){super(),Pe(this,e,tr,er,Re,{className:0,strokeWidth:1})}}function rr(r){let e,t;return{c(){e=ye("svg"),t=ye("path"),this.h()},l(s){e=Me(s,"svg",{xmlns:!0,fill:!0,viewBox:!0,"stroke-width":!0,stroke:!0,class:!0});var n=T(e);t=Me(n,"path",{"stroke-linecap":!0,"stroke-linejoin":!0,d:!0}),T(t).forEach(v),n.forEach(v),this.h()},h(){p(t,"stroke-linecap","round"),p(t,"stroke-linejoin","round"),p(t,"d","m21 21-5.197-5.197m0 0A7.5 7.5 0 1 0 5.196 5.196a7.5 7.5 0 0 0 10.607 10.607Z"),p(e,"xmlns","http://www.w3.org/2000/svg"),p(e,"fill","none"),p(e,"viewBox","0 0 24 24"),p(e,"stroke-width",r[1]),p(e,"stroke","currentColor"),p(e,"class",r[0])},m(s,n){D(s,e,n),I(e,t)},p(s,[n]){n&2&&p(e,"stroke-width",s[1]),n&1&&p(e,"class",s[0])},i:de,o:de,d(s){s&&v(e)}}}function nr(r,e,t){let{className:s="w-4 h-4"}=e,{strokeWidth:n="1.5"}=e;return r.$$set=l=>{"className"in l&&t(0,s=l.className),"strokeWidth"in l&&t(1,n=l.strokeWidth)},[s,n]}class lr extends xe{constructor(e){super(),Pe(this,e,nr,rr,Re,{className:0,strokeWidth:1})}}function ir(r){let e,t;return{c(){e=ye("svg"),t=ye("path"),this.h()},l(s){e=Me(s,"svg",{xmlns:!0,fill:!0,viewBox:!0,"stroke-width":!0,stroke:!0,class:!0});var n=T(e);t=Me(n,"path",{"stroke-linecap":!0,"stroke-linejoin":!0,d:!0}),T(t).forEach(v),n.forEach(v),this.h()},h(){p(t,"stroke-linecap","round"),p(t,"stroke-linejoin","round"),p(t,"d","M12 20.25c4.97 0 9-3.694 9-8.25s-4.03-8.25-9-8.25S3 7.444 3 12c0 2.104.859 4.023 2.273 5.48.432.447.74 1.04.586 1.641a4.483 4.483 0 0 1-.923 1.785A5.969 5.969 0 0 0 6 21c1.282 0 2.47-.402 3.445-1.087.81.22 1.668.337 2.555.337Z"),p(e,"xmlns","http://www.w3.org/2000/svg"),p(e,"fill","none"),p(e,"viewBox","0 0 24 24"),p(e,"stroke-width",r[1]),p(e,"stroke","currentColor"),p(e,"class",r[0])},m(s,n){D(s,e,n),I(e,t)},p(s,[n]){n&2&&p(e,"stroke-width",s[1]),n&1&&p(e,"class",s[0])},i:de,o:de,d(s){s&&v(e)}}}function or(r,e,t){let{className:s="size-4"}=e,{strokeWidth:n="1.5"}=e;return r.$$set=l=>{"className"in l&&t(0,s=l.className),"strokeWidth"in l&&t(1,n=l.strokeWidth)},[s,n]}class ar extends xe{constructor(e){super(),Pe(this,e,or,ir,Re,{className:0,strokeWidth:1})}}function mt(r,e,t){const s=r.slice();return s[33]=e[t],s}function gt(r,e,t){const s=r.slice();return s[36]=e[t],s[38]=t,s}function pt(r,e,t){const s=r.slice();return s[39]=e[t],s}function _t(r,e,t){const s=r.slice();return s[39]=e[t],s}function cr(r){let e;return{c(){e=Y(r[1])},l(t){e=Z(t,r[1])},m(t,s){D(t,e,s)},p(t,s){s[0]&2&&re(e,t[1])},d(t){t&&v(e)}}}function ur(r){let e=r[8].label+"",t;return{c(){t=Y(e)},l(s){t=Z(s,e)},m(s,n){D(s,t,n)},p(s,n){n[0]&256&&e!==(e=s[8].label+"")&&re(t,e)},d(s){s&&v(t)}}}function fr(r){let e,t,s,n;function l(a,u){return a[8]?ur:cr}let i=l(r),o=i(r);return s=new rs({props:{className:" self-center ml-2 size-3",strokeWidth:"2.5"}}),{c(){e=N("div"),o.c(),t=F(),X(s.$$.fragment),this.h()},l(a){e=C(a,"DIV",{class:!0});var u=T(e);o.l(u),t=W(u),q(s.$$.fragment,u),u.forEach(v),this.h()},h(){p(e,"class","flex w-full text-left px-0.5 outline-none bg-transparent truncate text-lg font-medium placeholder-gray-400 focus:outline-none")},m(a,u){D(a,e,u),o.m(e,null),I(e,t),ee(s,e,null),n=!0},p(a,u){i===(i=l(a))&&o?o.p(a,u):(o.d(1),o=i(a),o&&(o.c(),o.m(e,t)))},i(a){n||(S(s.$$.fragment,a),n=!0)},o(a){R(s.$$.fragment,a),n=!1},d(a){a&&v(e),o.d(),te(s)}}}function vt(r){let e,t,s,n,l,i,o,a,u;return t=new lr({props:{className:"size-4",strokeWidth:"2.5"}}),{c(){e=N("div"),X(t.$$.fragment),s=F(),n=N("input"),l=F(),i=N("hr"),this.h()},l(c){e=C(c,"DIV",{class:!0});var m=T(e);q(t.$$.fragment,m),s=W(m),n=C(m,"INPUT",{id:!0,class:!0,placeholder:!0,autocomplete:!0}),m.forEach(v),l=W(c),i=C(c,"HR",{class:!0}),this.h()},h(){p(n,"id","model-search-input"),p(n,"class","w-full text-sm bg-transparent outline-none"),p(n,"placeholder",r[3]),p(n,"autocomplete","off"),p(e,"class","flex items-center gap-2.5 px-5 mt-3.5 mb-3"),p(i,"class","border-gray-100 dark:border-gray-800")},m(c,m){D(c,e,m),ee(t,e,null),I(e,s),I(e,n),nt(n,r[6]),D(c,l,m),D(c,i,m),o=!0,a||(u=[Ee(n,"input",r[22]),Ee(n,"keydown",r[23])],a=!0)},p(c,m){(!o||m[0]&8)&&p(n,"placeholder",c[3]),m[0]&64&&n.value!==c[6]&&nt(n,c[6])},i(c){o||(S(t.$$.fragment,c),o=!0)},o(c){R(t.$$.fragment,c),o=!1},d(c){c&&(v(e),v(l),v(i)),te(t),a=!1,Qt(u)}}}function wt(r){let e,t,s=r[13].t("No results found")+"",n;return{c(){e=N("div"),t=N("div"),n=Y(s),this.h()},l(l){e=C(l,"DIV",{});var i=T(e);t=C(i,"DIV",{class:!0});var o=T(t);n=Z(o,s),o.forEach(v),i.forEach(v),this.h()},h(){p(t,"class","block px-3 py-2 text-sm text-gray-700 dark:text-gray-100")},m(l,i){D(l,e,i),I(e,t),I(t,n)},p(l,i){i[0]&8192&&s!==(s=l[13].t("No results found")+"")&&re(n,s)},d(l){l&&v(e)}}}function bt(r){var n,l;let e,t=he((l=(n=r[36].model)==null?void 0:n.info)==null?void 0:l.meta.tags),s=[];for(let i=0;i"))}`,$$slots:{default:[mr]},$$scope:{ctx:r}}}),{c(){X(e.$$.fragment)},l(i){q(e.$$.fragment,i)},m(i,o){ee(e,i,o),t=!0},p(i,o){var u,c,m;const a={};o[0]&2048&&(a.content=`${it.parse(at((m=(c=(u=i[36].model)==null?void 0:u.info)==null?void 0:c.meta)==null?void 0:m.description).replaceAll(` `,"
"))}`),o[0]&1073741824&&(a.$$scope={dirty:o,ctx:i}),e.$set(a)},i(i){t||(S(e.$$.fragment,i),t=!0)},o(i){R(e.$$.fragment,i),t=!1},d(i){te(e,i)}}}function mr(r){let e,t='';return{c(){e=N("div"),e.innerHTML=t,this.h()},l(s){e=C(s,"DIV",{class:!0,"data-svelte-h":!0}),Ve(e)!=="svelte-1mqbvzr"&&(e.innerHTML=t),this.h()},h(){p(e,"class","translate-y-[1px]")},m(s,n){D(s,e,n)},p:de,d(s){s&&v(e)}}}function It(r){var i,o;let e,t,s=he((o=(i=r[36].model)==null?void 0:i.info)==null?void 0:o.meta.tags),n=[];for(let a=0;aR(n[a],1,1,()=>{n[a]=null});return{c(){e=N("div");for(let a=0;a0&&bt(r),g=r[36].model.owned_by==="ollama"&&(((_=(Le=r[36].model.ollama)==null?void 0:Le.details)==null?void 0:_.parameter_size)??"")!==""&&yt(r),A=r[36].model.owned_by==="openai"&&Mt(r),P=((G=(U=(H=r[36].model)==null?void 0:H.info)==null?void 0:U.meta)==null?void 0:G.description)&&Et(r),B=!r[14]&&(((ue=(_e=(pe=(J=r[36])==null?void 0:J.model)==null?void 0:pe.info)==null?void 0:_e.meta)==null?void 0:ue.tags)??[]).length>0&&It(r),z=r[0]===r[36].value&&St();function Ne(){return r[24](r[36],r[38])}return{c(){e=N("button"),t=N("div"),d&&d.c(),s=F(),n=N("div"),l=N("div"),i=N("div"),o=N("div"),a=N("img"),c=F(),f=Y(m),k=F(),g&&g.c(),w=F(),A&&A.c(),V=F(),P&&P.c(),b=F(),B&&B.c(),y=F(),z&&z.c(),this.h()},l(j){e=C(j,"BUTTON",{"aria-label":!0,class:!0,"data-arrow-selected":!0});var x=T(e);t=C(x,"DIV",{class:!0});var se=T(t);d&&d.l(se),s=W(se),n=C(se,"DIV",{class:!0});var ne=T(n);l=C(ne,"DIV",{class:!0});var ve=T(l);i=C(ve,"DIV",{class:!0});var $e=T(i);o=C($e,"DIV",{class:!0});var we=T(o);a=C(we,"IMG",{src:!0,alt:!0,class:!0}),c=W(we),f=Z(we,m),we.forEach(v),$e.forEach(v),k=W(ve),g&&g.l(ve),ve.forEach(v),w=W(ne),A&&A.l(ne),V=W(ne),P&&P.l(ne),b=W(ne),B&&B.l(ne),ne.forEach(v),se.forEach(v),y=W(x),z&&z.l(x),x.forEach(v),this.h()},h(){var j,x,se;lt(a.src,u=((se=(x=(j=r[36].model)==null?void 0:j.info)==null?void 0:x.meta)==null?void 0:se.profile_image_url)??"/static/favicon.png")||p(a,"src",u),p(a,"alt","Model"),p(a,"class","rounded-full size-5 flex items-center mr-2"),p(o,"class","flex items-center min-w-fit"),p(i,"class","line-clamp-1"),p(l,"class","flex items-center min-w-fit"),p(n,"class","flex items-center gap-2"),p(t,"class","flex flex-col"),p(e,"aria-label","model-item"),p(e,"class",O="flex w-full text-left font-medium line-clamp-1 select-none items-center rounded-button py-2 pl-3 pr-1.5 text-sm text-gray-700 dark:text-gray-100 outline-none transition-all duration-75 hover:bg-gray-100 dark:hover:bg-gray-800 rounded-lg cursor-pointer data-[highlighted]:bg-muted "+(r[38]===r[10]?"bg-gray-100 dark:bg-gray-800 group-hover:bg-transparent":"")),p(e,"data-arrow-selected",E=r[38]===r[10])},m(j,x){D(j,e,x),I(e,t),d&&d.m(t,null),I(t,s),I(t,n),I(n,l),I(l,i),I(i,o),I(o,a),I(o,c),I(o,f),I(l,k),g&&g.m(l,null),I(n,w),A&&A.m(n,null),I(n,V),P&&P.m(n,null),I(n,b),B&&B.m(n,null),I(e,y),z&&z.m(e,null),L=!0,M||(h=Ee(e,"click",Ne),M=!0)},p(j,x){var se,ne,ve,$e,we,Ge,Ye,Ze,Je,Qe,Xe,qe,et,tt,st,rt;r=j,r[14]&&((($e=(ve=(ne=(se=r[36])==null?void 0:se.model)==null?void 0:ne.info)==null?void 0:ve.meta)==null?void 0:$e.tags)??[]).length>0?d?d.p(r,x):(d=bt(r),d.c(),d.m(t,s)):d&&(d.d(1),d=null),(!L||x[0]&2048&&!lt(a.src,u=((Ye=(Ge=(we=r[36].model)==null?void 0:we.info)==null?void 0:Ge.meta)==null?void 0:Ye.profile_image_url)??"/static/favicon.png"))&&p(a,"src",u),(!L||x[0]&2048)&&m!==(m=r[36].label+"")&&re(f,m),r[36].model.owned_by==="ollama"&&(((Je=(Ze=r[36].model.ollama)==null?void 0:Ze.details)==null?void 0:Je.parameter_size)??"")!==""?g?(g.p(r,x),x[0]&2048&&S(g,1)):(g=yt(r),g.c(),S(g,1),g.m(l,null)):g&&(le(),R(g,1,1,()=>{g=null}),ie()),r[36].model.owned_by==="openai"?A?x[0]&2048&&S(A,1):(A=Mt(r),A.c(),S(A,1),A.m(n,V)):A&&(le(),R(A,1,1,()=>{A=null}),ie()),(qe=(Xe=(Qe=r[36].model)==null?void 0:Qe.info)==null?void 0:Xe.meta)!=null&&qe.description?P?(P.p(r,x),x[0]&2048&&S(P,1)):(P=Et(r),P.c(),S(P,1),P.m(n,b)):P&&(le(),R(P,1,1,()=>{P=null}),ie()),!r[14]&&(((rt=(st=(tt=(et=r[36])==null?void 0:et.model)==null?void 0:tt.info)==null?void 0:st.meta)==null?void 0:rt.tags)??[]).length>0?B?(B.p(r,x),x[0]&18432&&S(B,1)):(B=It(r),B.c(),S(B,1),B.m(n,null)):B&&(le(),R(B,1,1,()=>{B=null}),ie()),r[0]===r[36].value?z?x[0]&2049&&S(z,1):(z=St(),z.c(),S(z,1),z.m(e,null)):z&&(le(),R(z,1,1,()=>{z=null}),ie()),(!L||x[0]&1024&&O!==(O="flex w-full text-left font-medium line-clamp-1 select-none items-center rounded-button py-2 pl-3 pr-1.5 text-sm text-gray-700 dark:text-gray-100 outline-none transition-all duration-75 hover:bg-gray-100 dark:hover:bg-gray-800 rounded-lg cursor-pointer data-[highlighted]:bg-muted "+(r[38]===r[10]?"bg-gray-100 dark:bg-gray-800 group-hover:bg-transparent":"")))&&p(e,"class",O),(!L||x[0]&1024&&E!==(E=r[38]===r[10]))&&p(e,"data-arrow-selected",E)},i(j){L||(S(g),S(A),S(P),S(B),S(z),L=!0)},o(j){R(g),R(A),R(P),R(B),R(z),L=!1},d(j){j&&v(e),d&&d.d(),g&&g.d(),A&&A.d(),P&&P.d(),B&&B.d(),z&&z.d(),M=!1,h()}}}function Nt(r){let e,t=r[13].t('Pull "{{searchValue}}" from Ollama.com',{searchValue:r[6]})+"",s,n,l;return{c(){e=N("button"),s=Y(t),this.h()},l(i){e=C(i,"BUTTON",{class:!0});var o=T(e);s=Z(o,t),o.forEach(v),this.h()},h(){p(e,"class","flex w-full font-medium line-clamp-1 select-none items-center rounded-button py-2 pl-3 pr-1.5 text-sm text-gray-700 dark:text-gray-100 outline-none transition-all duration-75 hover:bg-gray-100 dark:hover:bg-gray-800 rounded-lg cursor-pointer data-[highlighted]:bg-muted")},m(i,o){D(i,e,o),I(e,s),n||(l=Ee(e,"click",r[25]),n=!0)},p(i,o){o[0]&8256&&t!==(t=i[13].t('Pull "{{searchValue}}" from Ollama.com',{searchValue:i[6]})+"")&&re(s,t)},d(i){i&&v(e),n=!1,l()}}}function Ct(r){let e,t=r[12][r[33]].digest+"",s;return{c(){e=N("div"),s=Y(t),this.h()},l(n){e=C(n,"DIV",{class:!0});var l=T(e);s=Z(l,t),l.forEach(v),this.h()},h(){p(e,"class","-mt-1 h-fit text-[0.7rem] dark:text-gray-500 line-clamp-1")},m(n,l){D(n,e,l),I(e,s)},p(n,l){l[0]&4096&&t!==(t=n[12][n[33]].digest+"")&&re(s,t)},d(n){n&&v(e)}}}function pr(r){let e,t='',s,n;function l(){return r[26](r[33])}return{c(){e=N("button"),e.innerHTML=t,this.h()},l(i){e=C(i,"BUTTON",{class:!0,"data-svelte-h":!0}),Ve(e)!=="svelte-19bzgft"&&(e.innerHTML=t),this.h()},h(){p(e,"class","text-gray-800 dark:text-gray-100")},m(i,o){D(i,e,o),s||(n=Ee(e,"click",l),s=!0)},p(i,o){r=i},d(i){i&&v(e),s=!1,n()}}}function Lt(r){let e,t,s,n=``,l,i,o,a,u=r[33]+"",c,m,f="pullProgress"in r[12][r[33]]?`(${r[12][r[33]].pullProgress}%)`:"",k,w,V,b,y,O,E,L="digest"in r[12][r[33]]&&r[12][r[33]].digest&&Ct(r);return y=new Ae({props:{content:r[13].t("Cancel"),$$slots:{default:[pr]},$$scope:{ctx:r}}}),{c(){e=N("div"),t=N("div"),s=N("div"),s.innerHTML=n,l=F(),i=N("div"),o=N("div"),a=Y('Downloading "'),c=Y(u),m=Y('" '),k=Y(f),w=F(),L&&L.c(),V=F(),b=N("div"),X(y.$$.fragment),O=F(),this.h()},l(M){e=C(M,"DIV",{class:!0});var h=T(e);t=C(h,"DIV",{class:!0});var d=T(t);s=C(d,"DIV",{class:!0,"data-svelte-h":!0}),Ve(s)!=="svelte-102rp4j"&&(s.innerHTML=n),l=W(d),i=C(d,"DIV",{class:!0});var g=T(i);o=C(g,"DIV",{class:!0});var A=T(o);a=Z(A,'Downloading "'),c=Z(A,u),m=Z(A,'" '),k=Z(A,f),A.forEach(v),w=W(g),L&&L.l(g),g.forEach(v),d.forEach(v),V=W(h),b=C(h,"DIV",{class:!0});var P=T(b);q(y.$$.fragment,P),P.forEach(v),O=W(h),h.forEach(v),this.h()},h(){p(s,"class","-ml-2 mr-2.5 translate-y-0.5"),p(o,"class","line-clamp-1"),p(i,"class","flex flex-col self-start"),p(t,"class","flex"),p(b,"class","mr-2 translate-y-0.5"),p(e,"class","flex w-full justify-between font-medium select-none rounded-button py-2 pl-3 pr-1.5 text-sm text-gray-700 dark:text-gray-100 outline-none transition-all duration-75 rounded-lg cursor-pointer data-[highlighted]:bg-muted")},m(M,h){D(M,e,h),I(e,t),I(t,s),I(t,l),I(t,i),I(i,o),I(o,a),I(o,c),I(o,m),I(o,k),I(i,w),L&&L.m(i,null),I(e,V),I(e,b),ee(y,b,null),I(e,O),E=!0},p(M,h){(!E||h[0]&4096)&&u!==(u=M[33]+"")&&re(c,u),(!E||h[0]&4096)&&f!==(f="pullProgress"in M[12][M[33]]?`(${M[12][M[33]].pullProgress}%)`:"")&&re(k,f),"digest"in M[12][M[33]]&&M[12][M[33]].digest?L?L.p(M,h):(L=Ct(M),L.c(),L.m(i,null)):L&&(L.d(1),L=null);const d={};h[0]&8192&&(d.content=M[13].t("Cancel")),h[0]&1073745920&&(d.$$scope={dirty:h,ctx:M}),y.$set(d)},i(M){E||(S(y.$$.fragment,M),E=!0)},o(M){R(y.$$.fragment,M),E=!1},d(M){M&&v(e),L&&L.d(),te(y)}}}function Ot(r){let e,t,s,n,l,i,o,a=r[13].t("Temporary Chat")+"",u,c,m,f,k,w,V;return i=new ar({props:{className:"size-4",strokeWidth:"2.5"}}),f=new hs({props:{state:r[16]}}),{c(){e=N("hr"),t=F(),s=N("div"),n=N("button"),l=N("div"),X(i.$$.fragment),o=F(),u=Y(a),c=F(),m=N("div"),X(f.$$.fragment),this.h()},l(b){e=C(b,"HR",{class:!0}),t=W(b),s=C(b,"DIV",{class:!0});var y=T(s);n=C(y,"BUTTON",{class:!0});var O=T(n);l=C(O,"DIV",{class:!0});var E=T(l);q(i.$$.fragment,E),o=W(E),u=Z(E,a),E.forEach(v),c=W(O),m=C(O,"DIV",{});var L=T(m);q(f.$$.fragment,L),L.forEach(v),O.forEach(v),y.forEach(v),this.h()},h(){p(e,"class","border-gray-100 dark:border-gray-800"),p(l,"class","flex gap-2.5 items-center"),p(n,"class","flex justify-between w-full font-medium line-clamp-1 select-none items-center rounded-button py-2 px-3 text-sm text-gray-700 dark:text-gray-100 outline-none transition-all duration-75 hover:bg-gray-100 dark:hover:bg-gray-800 rounded-lg cursor-pointer data-[highlighted]:bg-muted"),p(s,"class","flex items-center mx-2 my-2")},m(b,y){D(b,e,y),D(b,t,y),D(b,s,y),I(s,n),I(n,l),ee(i,l,null),I(l,o),I(l,u),I(n,c),I(n,m),ee(f,m,null),k=!0,w||(V=Ee(n,"click",r[27]),w=!0)},p(b,y){(!k||y[0]&8192)&&a!==(a=b[13].t("Temporary Chat")+"")&&re(u,a);const O={};y[0]&65536&&(O.state=b[16]),f.$set(O)},i(b){k||(S(i.$$.fragment,b),S(f.$$.fragment,b),k=!0)},o(b){R(i.$$.fragment,b),R(f.$$.fragment,b),k=!1},d(b){b&&(v(e),v(t),v(s)),te(i),te(f),w=!1,V()}}}function _r(r){let e,t,s,n=!(r[6].trim()in r[12])&&r[6]&&r[9]&&r[15].role==="admin",l,i,o,a,u,c,m,f=r[2]&&vt(r),k=he(r[11]),w=[];for(let h=0;hR(w[h],1,1,()=>{w[h]=null});let b=null;k.length||(b=wt(r));let y=n&&Nt(r),O=he(Object.keys(r[12])),E=[];for(let h=0;hR(E[h],1,1,()=>{E[h]=null});let M=r[4]&&Ot(r);return{c(){f&&f.c(),e=F(),t=N("div");for(let h=0;h{f=null}),ie()),d[0]&27777){k=he(h[11]);let g;for(g=0;g{M=null}),ie())},i(h){if(!m){S(f);for(let d=0;dXt(e,"open",n)),{c(){X(e.$$.fragment)},l(i){q(e.$$.fragment,i)},m(i,o){ee(e,i,o),s=!0},p(i,o){const a={};o[0]&1088&&(a.onOpenChange=i[28]),o[0]&1073872895&&(a.$$scope={dirty:o,ctx:i}),!t&&o[0]&128&&(t=!0,a.open=i[7],Wt(()=>t=!1)),e.$set(a)},i(i){s||(S(e.$$.fragment,i),s=!0)},o(i){R(e.$$.fragment,i),s=!1},d(i){te(e,i)}}}function kr(r,e,t){let s,n,l,i,o,a;Se(r,ke,_=>t(12,n=_)),Se(r,os,_=>t(14,i=_)),Se(r,as,_=>t(15,o=_)),Se(r,ot,_=>t(16,a=_));let{$$slots:u={},$$scope:c}=e;const m=Ht("i18n");Se(r,m,_=>t(13,l=_)),Kt();let{value:f=""}=e,{placeholder:k="Select a model"}=e,{searchEnabled:w=!0}=e,{searchPlaceholder:V=l.t("Search a model")}=e,{showTemporaryChatControl:b=!1}=e,{items:y=[]}=e,{className:O="w-[32rem]"}=e,E=!1,L="",M="",h=null,d=0;const g=new Ie(y.filter(_=>{var H,U,G;return!((G=(U=(H=_.model)==null?void 0:H.info)==null?void 0:U.meta)!=null&&G.hidden)}).map(_=>{var U,G,J,pe,_e,ue,j,x;return{..._,modelName:(U=_.model)==null?void 0:U.name,tags:(_e=(pe=(J=(G=_.model)==null?void 0:G.info)==null?void 0:J.meta)==null?void 0:pe.tags)==null?void 0:_e.map(se=>se.name).join(" "),desc:(x=(j=(ue=_.model)==null?void 0:ue.info)==null?void 0:j.meta)==null?void 0:x.description}}),{keys:["value","tags","modelName"],threshold:.3}),A=async()=>{const _=M.trim().replace(/^ollama\s+(run|pull)\s+/,"");if(console.log(n),n[_]){fe.error(l.t("Model '{{modelTag}}' is already in queue for downloading.",{modelTag:_}));return}if(Object.keys(n).length===3){fe.error(l.t("Maximum of 3 models can be downloaded simultaneously. Please try again later."));return}const[H,U]=await ls(localStorage.token,_,"0").catch(G=>(fe.error(G),null));if(H){const G=H.body.pipeThrough(new TextDecoderStream).pipeThrough(us(` `)).getReader();for(ke.set({...n,[_]:{...n[_],abortController:U,reader:G,done:!1}});;)try{const{value:J,done:pe}=await G.read();if(pe)break;let _e=J.split(` `);for(const ue of _e)if(ue!==""){let j=JSON.parse(ue);if(console.log(j),j.error)throw j.error;if(j.detail)throw j.detail;if(j.status)if(j.digest){let x=0;j.completed?x=Math.round(j.completed/j.total*1e3)/10:x=100,ke.set({...n,[_]:{...n[_],pullProgress:x,digest:j.digest}})}else fe.success(j.status),ke.set({...n,[_]:{...n[_],done:j.status==="success"}})}}catch(J){console.log(J),typeof J!="string"&&(J=J.message),fe.error(J);break}n[_].done?(fe.success(l.t("Model '{{modelName}}' has been successfully downloaded.",{modelName:_})),cs.set(await fs(localStorage.token))):fe.error(l.t("Download canceled")),delete n[_],ke.set({...n})}};Ut(async()=>{t(9,h=await ns(localStorage.token).catch(_=>!1))});const P=async _=>{const{reader:H,abortController:U}=n[_];U&&U.abort(),H&&(await H.cancel(),delete n[_],ke.set({...n}),await is(localStorage.token,_),fe.success(`${_} download has been canceled`))};function B(){M=this.value,t(6,M)}const z=_=>{if(_.code==="Enter"&&s.length>0){t(0,f=s[d].value),t(7,E=!1);return}else _.code==="ArrowDown"?t(10,d=Math.min(d+1,s.length-1)):_.code==="ArrowUp"?t(10,d=Math.max(d-1,0)):t(10,d=0);const H=document.querySelector('[data-arrow-selected="true"]');H==null||H.scrollIntoView({block:"center",inline:"nearest",behavior:"instant"})},Ne=(_,H)=>{t(0,f=_.value),t(10,d=H),t(7,E=!1)},K=()=>{A()},ae=_=>{P(_)},ge=async()=>{ot.set(!a),await ds("/");const _=document.getElementById("new-chat-button");setTimeout(()=>{_==null||_.click()},0),a?history.replaceState(null,"","?temporary-chat=true"):history.replaceState(null,"",location.pathname),t(7,E=!1)},Ce=async()=>{t(6,M=""),t(10,d=0),window.setTimeout(()=>{var _;return(_=document.getElementById("model-search-input"))==null?void 0:_.focus()},0)};function Le(_){E=_,t(7,E)}return r.$$set=_=>{"value"in _&&t(0,f=_.value),"placeholder"in _&&t(1,k=_.placeholder),"searchEnabled"in _&&t(2,w=_.searchEnabled),"searchPlaceholder"in _&&t(3,V=_.searchPlaceholder),"showTemporaryChatControl"in _&&t(4,b=_.showTemporaryChatControl),"items"in _&&t(20,y=_.items),"className"in _&&t(5,O=_.className),"$$scope"in _&&t(30,c=_.$$scope)},r.$$.update=()=>{r.$$.dirty[0]&1048577&&t(8,L=y.find(_=>_.value===f)??""),r.$$.dirty[0]&1048640&&t(11,s=M?g.search(M).map(_=>_.item):y.filter(_=>{var H,U,G;return!((G=(U=(H=_.model)==null?void 0:H.info)==null?void 0:U.meta)!=null&&G.hidden)}))},[f,k,w,V,b,O,M,E,L,h,d,s,n,l,i,o,a,m,A,P,y,u,B,z,Ne,K,ae,ge,Ce,Le,c]}class Vr extends xe{constructor(e){super(),Pe(this,e,kr,br,Re,{value:0,placeholder:1,searchEnabled:2,searchPlaceholder:3,showTemporaryChatControl:4,items:20,className:5},null,[-1,-1])}}export{Vr as S}; //# sourceMappingURL=Selector.Bqb2boTp.js.map