diff --git a/app.py b/app.py index 89872ead..9a2591ca 100644 --- a/app.py +++ b/app.py @@ -33,7 +33,7 @@ from lollms.config import InstallOption from lollms.main_config import LOLLMSConfig from lollms.paths import LollmsPaths, gptqlora_repo from lollms.com import NotificationType, NotificationDisplayType -from lollms.utilities import AdvancedGarbageCollector, reinstall_pytorch_with_cuda, convert_language_name +from lollms.utilities import AdvancedGarbageCollector, reinstall_pytorch_with_cuda, convert_language_name, find_first_available_file_index lollms_paths = LollmsPaths.find_paths(force_local=True, custom_default_cfg_path="configs/config.yaml") # Configuration loading part config = LOLLMSConfig.autoload(lollms_paths) @@ -788,8 +788,17 @@ try: def read(self): # Get the JSON data from the POST request. + try: + from lollms.audio_gen_modules.lollms_xtts import LollmsXTTS + if self.tts is None: + self.tts = LollmsXTTS(self, voice_samples_path=Path(__file__).parent/"voices") + except: + return jsonify({"url": None}) + data = request.get_json() voice=data.get("voice",self.config.current_voice) + index = find_first_available_file_index(self.tts.output_folder, "voice_sample_",".wav") + output_fn=data.get("fn",f"voice_sample_{index}.wav") if voice is None: voice = "main_voice" self.info("Starting to build voice") @@ -803,10 +812,8 @@ try: else: voices_folder = Path(__file__).parent/"voices" self.tts.set_speaker_folder(voices_folder) - fn = self.personality.name.lower().replace(' ',"_").replace('.','') - fn = f"playground_voice.wav" - url = f"audio/{fn}" - self.tts.tts_to_file(data['text'], f"{voice}.wav", f"{fn}", language=language) + url = f"audio/{output_fn}" + self.tts.tts_to_file(data['text'], f"{voice}.wav", f"{output_fn}", language=language) self.info("Voice file ready") return jsonify({"url": url}) except: diff --git a/lollms_core b/lollms_core index 1a49dd9d..f1fd6521 160000 --- a/lollms_core +++ b/lollms_core @@ -1 +1 @@ -Subproject commit 1a49dd9dfc07c42c8329fc637274f7f4fc71dc36 +Subproject commit f1fd6521e3840a11e2e2f626d01a6c44ad39bc93 diff --git a/web/dist/assets/bash_block-7ca80e4e.png b/web/dist/assets/bash_block-7ca80e4e.png new file mode 100644 index 00000000..b1f63949 Binary files /dev/null and b/web/dist/assets/bash_block-7ca80e4e.png differ diff --git a/web/dist/assets/index-dbbd1f94.js b/web/dist/assets/index-553d66ea.js similarity index 97% rename from web/dist/assets/index-dbbd1f94.js rename to web/dist/assets/index-553d66ea.js index c32db117..9b7a2cb4 100644 --- a/web/dist/assets/index-dbbd1f94.js +++ b/web/dist/assets/index-553d66ea.js @@ -156,11 +156,13 @@ Response: Error: `+e.error,4,!1);this.isLoading=!1},async remountExtension(n){await this.unmountExtension(n),await this.mountExtension(n)},onExtensionReinstall(n){console.log("on reinstall ",n),this.isLoading=!0,console.log(n),Pe.post("/reinstall_extension",{name:n.extension.full_path}).then(e=>{if(e)return this.isLoading=!1,console.log("reinstall_extension",e),e.data.status?this.$store.state.toast.showToast("Extension reinstalled successfully!",4,!0):this.$store.state.toast.showToast("Could not reinstall extension",4,!1),e.data;this.isLoading=!1}).catch(e=>(this.isLoading=!1,this.$store.state.toast.showToast(`Could not reinstall personality `+e.message,4,!1),{status:!1}))},onPersonalityReinstall(n){console.log("on reinstall ",n),this.isLoading=!0,Pe.post("/reinstall_personality",{name:n.personality.path}).then(e=>{if(e)return this.isLoading=!1,console.log("reinstall_personality",e),e.data.status?this.$store.state.toast.showToast("Personality reinstalled successfully!",4,!0):this.$store.state.toast.showToast("Could not reinstall personality",4,!1),e.data;this.isLoading=!1}).catch(e=>(this.isLoading=!1,this.$store.state.toast.showToast(`Could not reinstall personality `+e.message,4,!1),{status:!1}))},personalityImgPlacehodler(n){n.target.src=Vo},extensionImgPlacehodler(n){n.target.src=Iet},searchPersonality_func(){clearTimeout(this.searchPersonalityTimer),this.searchPersonality&&(this.searchPersonalityInProgress=!0,setTimeout(this.filterPersonalities,this.searchPersonalityTimerInterval))},searchModel_func(){this.filterModels()}},async mounted(){console.log("Getting voices"),this.getVoices(),console.log("Constructing"),this.load_everything(),this.getSeviceVoices()},activated(){},computed:{rendered_models_zoo:{get(){return this.searchModel?this.show_only_installed_models?this.modelsFiltered.filter(n=>n.isInstalled===!0):this.modelsFiltered.slice(0,Math.min(this.models_zoo.length,this.models_zoo_initialLoadCount)):(console.log("this.models_zoo"),console.log(this.models_zoo),console.log(this.models_zoo_initialLoadCount),this.show_only_installed_models?this.models_zoo.filter(n=>n.isInstalled===!0):this.models_zoo.slice(0,Math.min(this.models_zoo.length,this.models_zoo_initialLoadCount)))}},imgBinding:{get(){if(!this.isMounted)return Ti;try{return this.$refs.bindingZoo[this.$refs.bindingZoo.findIndex(n=>n.binding.folder==this.configFile.binding_name)].$refs.imgElement.src}catch{return Ti}}},imgModel:{get(){try{if(idx=this.$store.state.modelsZoo.findIndex(n=>n.name==this.$store.state.selectedModel),idx>=0)return this.$store.state.modelsZoo[idx].avatar}catch{}if(!this.isMounted)return Ti;try{return this.$refs.bindingZoo[this.$refs.bindingZoo.findIndex(n=>n.binding.folder==this.configFile.binding_name)].$refs.imgElement.src}catch{return Ti}}},isReady:{get(){return this.$store.state.ready}},audio_out_voice:{get(){return this.$store.state.config.audio_out_voice},set(n){this.$store.state.config.audio_out_voice=n}},audioLanguages(){return[{code:"en-US",name:"English (US)"},{code:"en-GB",name:"English (UK)"},{code:"es-ES",name:"Spanish (Spain)"},{code:"es-MX",name:"Spanish (Mexico)"},{code:"fr-FR",name:"French (France)"},{code:"fr-CA",name:"French (Canada)"},{code:"de-DE",name:"German (Germany)"},{code:"it-IT",name:"Italian (Italy)"},{code:"pt-BR",name:"Portuguese (Brazil)"},{code:"pt-PT",name:"Portuguese (Portugal)"},{code:"ru-RU",name:"Russian (Russia)"},{code:"zh-CN",name:"Chinese (China)"},{code:"ja-JP",name:"Japanese (Japan)"},{code:"ar-SA",name:"Arabic (Saudi Arabia)"},{code:"tr-TR",name:"Turkish (Turkey)"},{code:"ms-MY",name:"Malay (Malaysia)"},{code:"ko-KR",name:"Korean (South Korea)"},{code:"nl-NL",name:"Dutch (Netherlands)"},{code:"sv-SE",name:"Swedish (Sweden)"},{code:"da-DK",name:"Danish (Denmark)"},{code:"fi-FI",name:"Finnish (Finland)"},{code:"no-NO",name:"Norwegian (Norway)"},{code:"pl-PL",name:"Polish (Poland)"},{code:"el-GR",name:"Greek (Greece)"},{code:"hu-HU",name:"Hungarian (Hungary)"},{code:"cs-CZ",name:"Czech (Czech Republic)"},{code:"th-TH",name:"Thai (Thailand)"},{code:"hi-IN",name:"Hindi (India)"},{code:"he-IL",name:"Hebrew (Israel)"},{code:"id-ID",name:"Indonesian (Indonesia)"},{code:"vi-VN",name:"Vietnamese (Vietnam)"},{code:"uk-UA",name:"Ukrainian (Ukraine)"},{code:"ro-RO",name:"Romanian (Romania)"},{code:"bg-BG",name:"Bulgarian (Bulgaria)"},{code:"hr-HR",name:"Croatian (Croatia)"},{code:"sr-RS",name:"Serbian (Serbia)"},{code:"sk-SK",name:"Slovak (Slovakia)"},{code:"sl-SI",name:"Slovenian (Slovenia)"},{code:"et-EE",name:"Estonian (Estonia)"},{code:"lv-LV",name:"Latvian (Latvia)"},{code:"lt-LT",name:"Lithuanian (Lithuania)"},{code:"ka-GE",name:"Georgian (Georgia)"},{code:"hy-AM",name:"Armenian (Armenia)"},{code:"az-AZ",name:"Azerbaijani (Azerbaijan)"},{code:"kk-KZ",name:"Kazakh (Kazakhstan)"},{code:"uz-UZ",name:"Uzbek (Uzbekistan)"},{code:"kkj-CM",name:"Kako (Cameroon)"},{code:"my-MM",name:"Burmese (Myanmar)"},{code:"ne-NP",name:"Nepali (Nepal)"},{code:"si-LK",name:"Sinhala (Sri Lanka)"}]},configFile:{get(){return this.$store.state.config},set(n){this.$store.commit("setConfig",n)}},userName:{get(){return this.$store.state.config.user_name},set(n){this.$store.state.config.user_name=n}},user_avatar:{get(){return"/user_infos/"+this.$store.state.config.user_avatar},set(n){this.$store.state.config.user_avatar=n}},enable_gpu:{get(){return this.$store.state.config.enable_gpu},set(n){this.$store.state.config.enable_gpu=n}},auto_update:{get(){return this.$store.state.config.auto_update},set(n){this.$store.state.config.auto_update=n}},auto_speak:{get(){return this.$store.state.config.auto_speak},set(n){this.$store.state.config.auto_speak=n}},auto_read:{get(){return this.$store.state.config.auto_read},set(n){this.$store.state.config.auto_read=n}},enable_voice_service:{get(){return this.$store.state.config.enable_voice_service},set(n){this.$store.state.config.enable_voice_service=n}},current_voice:{get(){return this.$store.state.config.current_voice===null||this.$store.state.config.current_voice===void 0?(console.log("current voice",this.$store.state.config.current_voice),"main_voice"):this.$store.state.config.current_voice},set(n){n=="main_voice"?this.$store.state.config.current_voice=null:this.$store.state.config.current_voice=n}},audio_pitch:{get(){return this.$store.state.config.audio_pitch},set(n){this.$store.state.config.audio_pitch=n}},audio_in_language:{get(){return this.$store.state.config.audio_in_language},set(n){this.$store.state.config.audio_in_language=n}},use_user_name_in_discussions:{get(){return this.$store.state.config.use_user_name_in_discussions},set(n){this.$store.state.config.use_user_name_in_discussions=n}},db_path:{get(){return this.$store.state.config.db_path},set(n){this.$store.state.config.db_path=n}},personalities:{get(){return this.$store.state.personalities},set(n){this.$store.commit("setPersonalities",n)}},mountedPersArr:{get(){return this.$store.state.mountedPersArr},set(n){this.$store.commit("setMountedPers",n)}},mountedExtensions:{get(){return console.log("this.$store.state.mountedExtensions:",this.$store.state.mountedExtensions),this.$store.state.mountedExtensions},set(n){this.$store.commit("setActiveExtensions",n)}},bindingsZoo:{get(){return this.$store.state.bindingsZoo},set(n){this.$store.commit("setbindingsZoo",n)}},modelsArr:{get(){return this.$store.state.modelsArr},set(n){this.$store.commit("setModelsArr",n)}},models:{get(){return this.models_zoo},set(n){this.$store.commit("setModelsZoo",n)}},installed_models:{get(){return this.models_zoo},set(n){this.$store.commit("setModelsZoo",n)}},diskUsage:{get(){return this.$store.state.diskUsage},set(n){this.$store.commit("setDiskUsage",n)}},ramUsage:{get(){return this.$store.state.ramUsage},set(n){this.$store.commit("setRamUsage",n)}},vramUsage:{get(){return this.$store.state.vramUsage},set(n){this.$store.commit("setVramUsage",n)}},disk_available_space(){return this.computedFileSize(this.diskUsage.available_space)},disk_binding_models_usage(){return console.log(`this.diskUsage : ${this.diskUsage}`),this.computedFileSize(this.diskUsage.binding_models_usage)},disk_percent_usage(){return this.diskUsage.percent_usage},disk_total_space(){return this.computedFileSize(this.diskUsage.total_space)},ram_available_space(){return this.computedFileSize(this.ramUsage.available_space)},ram_usage(){return this.computedFileSize(this.ramUsage.ram_usage)},ram_percent_usage(){return this.ramUsage.percent_usage},ram_total_space(){return this.computedFileSize(this.ramUsage.total_space)},model_name(){if(this.isMounted)return this.configFile.model_name},binding_name(){if(!this.isMounted)return;const n=this.bindingsZoo.findIndex(e=>e.folder===this.configFile.binding_name);if(n>-1)return this.bindingsZoo[n].name},active_pesonality(){if(!this.isMounted)return;const n=this.personalities.findIndex(e=>e.full_path===this.configFile.personalities[this.configFile.active_personality_id]);if(n>-1)return this.personalities[n].name},speed_computed(){return Oi(this.addModel.speed)},total_size_computed(){return Oi(this.addModel.total_size)},downloaded_size_computed(){return Oi(this.addModel.downloaded_size)}},watch:{enable_voice_service(n){n||(this.configFile.auto_read=!1)},bec_collapsed(){Ue(()=>{Ge.replace()})},pc_collapsed(){Ue(()=>{Ge.replace()})},mc_collapsed(){Ue(()=>{Ge.replace()})},sc_collapsed(){Ue(()=>{Ge.replace()})},showConfirmation(){Ue(()=>{Ge.replace()})},mzl_collapsed(){Ue(()=>{Ge.replace()})},pzl_collapsed(){Ue(()=>{Ge.replace()})},ezl_collapsed(){Ue(()=>{Ge.replace()})},bzl_collapsed(){Ue(()=>{Ge.replace()})},all_collapsed(n){this.collapseAll(n),Ue(()=>{Ge.replace()})},settingsChanged(n){this.$store.state.settingsChanged=n,Ue(()=>{Ge.replace()})},isLoading(){Ue(()=>{Ge.replace()})},searchPersonality(n){n==""&&this.filterPersonalities()},mzdc_collapsed(){Ue(()=>{Ge.replace()})}},async beforeRouteLeave(n){if(await this.$router.isReady(),this.settingsChanged)return await this.$store.state.yesNoDialog.askQuestion(`Did You forget to apply changes? -You need to apply changes before you leave, or else.`,"Apply configuration","Cancel")&&this.applyConfiguration(),!1}},Ce=n=>(Gs("data-v-8ad66bce"),n=n(),zs(),n),jtt={class:"container overflow-y-scroll flex flex-row shadow-lg p-10 pt-0 overflow-y-scroll w-full dark:bg-bg-dark scrollbar-thin scrollbar-track-bg-light-tone scrollbar-thumb-bg-light-tone-panel hover:scrollbar-thumb-primary dark:scrollbar-track-bg-dark-tone dark:scrollbar-thumb-bg-dark-tone-panel dark:hover:scrollbar-thumb-primary active:scrollbar-thumb-secondary"},Qtt={class:"sticky top-0 z-10 flex flex-row mb-2 p-3 gap-3 w-full rounded-b-lg bg-bg-light-tone dark:bg-bg-dark-tone shadow-lg"},Xtt={key:0,class:"flex gap-3 flex-1 items-center duration-75"},Ztt=Ce(()=>p("i",{"data-feather":"x"},null,-1)),Jtt=[Ztt],ent=Ce(()=>p("i",{"data-feather":"check"},null,-1)),tnt=[ent],nnt={key:1,class:"flex gap-3 flex-1 items-center"},int=Ce(()=>p("i",{"data-feather":"save"},null,-1)),rnt=[int],snt=Ce(()=>p("i",{"data-feather":"refresh-ccw"},null,-1)),ont=[snt],ant=Ce(()=>p("i",{"data-feather":"list"},null,-1)),lnt=[ant],cnt={class:"flex gap-3 flex-1 items-center justify-end"},dnt=Ce(()=>p("i",{"data-feather":"trash-2"},null,-1)),unt=[dnt],_nt=Ce(()=>p("i",{"data-feather":"refresh-ccw"},null,-1)),pnt=[_nt],hnt=Ce(()=>p("i",{"data-feather":"arrow-up-circle"},null,-1)),fnt={key:0},mnt=Ce(()=>p("i",{"data-feather":"alert-circle"},null,-1)),gnt=[mnt],Ent={class:"flex gap-3 items-center"},bnt={key:0,class:"flex gap-3 items-center"},Snt=Ce(()=>p("p",{class:"text-red-600 font-bold"},"Apply changes:",-1)),ynt=Ce(()=>p("i",{"data-feather":"check"},null,-1)),vnt=[ynt],Tnt={key:1,role:"status"},xnt=Ce(()=>p("svg",{"aria-hidden":"true",class:"w-6 h-6 animate-spin fill-secondary",viewBox:"0 0 100 101",fill:"none",xmlns:"http://www.w3.org/2000/svg"},[p("path",{d:"M100 50.5908C100 78.2051 77.6142 100.591 50 100.591C22.3858 100.591 0 78.2051 0 50.5908C0 22.9766 22.3858 0.59082 50 0.59082C77.6142 0.59082 100 22.9766 100 50.5908ZM9.08144 50.5908C9.08144 73.1895 27.4013 91.5094 50 91.5094C72.5987 91.5094 90.9186 73.1895 90.9186 50.5908C90.9186 27.9921 72.5987 9.67226 50 9.67226C27.4013 9.67226 9.08144 27.9921 9.08144 50.5908Z",fill:"currentColor"}),p("path",{d:"M93.9676 39.0409C96.393 38.4038 97.8624 35.9116 97.0079 33.5539C95.2932 28.8227 92.871 24.3692 89.8167 20.348C85.8452 15.1192 80.8826 10.7238 75.2124 7.41289C69.5422 4.10194 63.2754 1.94025 56.7698 1.05124C51.7666 0.367541 46.6976 0.446843 41.7345 1.27873C39.2613 1.69328 37.813 4.19778 38.4501 6.62326C39.0873 9.04874 41.5694 10.4717 44.0505 10.1071C47.8511 9.54855 51.7191 9.52689 55.5402 10.0491C60.8642 10.7766 65.9928 12.5457 70.6331 15.2552C75.2735 17.9648 79.3347 21.5619 82.5849 25.841C84.9175 28.9121 86.7997 32.2913 88.1811 35.8758C89.083 38.2158 91.5421 39.6781 93.9676 39.0409Z",fill:"currentFill"})],-1)),Cnt=Ce(()=>p("span",{class:"sr-only"},"Loading...",-1)),Rnt={class:"flex flex-col mb-2 rounded-lg bg-bg-light-tone dark:bg-bg-dark-tone hover:bg-bg-light-tone-panel hover:dark:bg-bg-dark-tone-panel duration-150 shadow-lg"},Ant={class:"flex flex-row p-3"},wnt=Ce(()=>p("i",{"data-feather":"chevron-right"},null,-1)),Ont=[wnt],Nnt=Ce(()=>p("i",{"data-feather":"chevron-down"},null,-1)),Mnt=[Nnt],Int=Ce(()=>p("h3",{class:"text-lg font-semibold cursor-pointer select-none mr-2"}," System status",-1)),Dnt=Ce(()=>p("div",{class:"mr-2"},"|",-1)),Lnt={class:"text-base font-semibold cursor-pointer select-none items-center"},knt={class:"flex gap-2 items-center"},Pnt={key:0},Unt={class:"flex gap-2 items-center"},Fnt=["src"],Bnt={class:"font-bold font-large text-lg"},Gnt={key:1},znt={class:"flex gap-2 items-center"},Vnt=["src"],Hnt={class:"font-bold font-large text-lg"},qnt=Ce(()=>p("i",{"data-feather":"cpu",title:"CPU Ram",class:"w-5 h-5 mx-1 flex-shrink-0"},null,-1)),Ynt={class:"font-bold font-large text-lg"},$nt=Ce(()=>p("i",{"data-feather":"hard-drive",title:"Hard drive",class:"w-5 h-5 mx-1 flex-shrink-0"},null,-1)),Wnt={class:"font-bold font-large text-lg"},Knt={class:"mb-2"},jnt=Ce(()=>p("label",{class:"flex items-center gap-1 ml-2 mb-2 text-sm font-medium text-gray-900 dark:text-white"},[p("svg",{xmlns:"http://www.w3.org/2000/svg",width:"24",height:"24",viewBox:"0 0 24 24"},[p("path",{fill:"currentColor",d:"M17 17H7V7h10m4 4V9h-2V7a2 2 0 0 0-2-2h-2V3h-2v2h-2V3H9v2H7c-1.11 0-2 .89-2 2v2H3v2h2v2H3v2h2v2a2 2 0 0 0 2 2h2v2h2v-2h2v2h2v-2h2a2 2 0 0 0 2-2v-2h2v-2h-2v-2m-6 2h-2v-2h2m2-2H9v6h6V9Z"})]),$e(" CPU Ram usage: ")],-1)),Qnt={class:"flex flex-col mx-2"},Xnt=Ce(()=>p("b",null,"Avaliable ram: ",-1)),Znt=Ce(()=>p("b",null,"Ram usage: ",-1)),Jnt={class:"p-2"},eit={class:"w-full bg-gray-200 rounded-full h-2.5 dark:bg-gray-700"},tit={class:"mb-2"},nit=Ce(()=>p("label",{class:"flex items-center gap-1 ml-2 mb-2 text-sm font-medium text-gray-900 dark:text-white"},[p("i",{"data-feather":"hard-drive",class:"w-5 h-5"}),$e(" Disk usage: ")],-1)),iit={class:"flex flex-col mx-2"},rit=Ce(()=>p("b",null,"Avaliable disk space: ",-1)),sit=Ce(()=>p("b",null,"Disk usage: ",-1)),oit={class:"p-2"},ait={class:"w-full bg-gray-200 rounded-full h-2.5 dark:bg-gray-700"},lit={class:"mb-2"},cit={class:"flex items-center gap-1 ml-2 mb-2 text-sm font-medium text-gray-900 dark:text-white"},dit=["src"],uit={class:"flex flex-col mx-2"},_it=Ce(()=>p("b",null,"Model: ",-1)),pit=Ce(()=>p("b",null,"Avaliable vram: ",-1)),hit=Ce(()=>p("b",null,"GPU usage: ",-1)),fit={class:"p-2"},mit={class:"w-full bg-gray-200 rounded-full h-2.5 dark:bg-gray-700"},git={class:"flex flex-col mb-2 rounded-lg bg-bg-light-tone dark:bg-bg-dark-tone hover:bg-bg-light-tone-panel hover:dark:bg-bg-dark-tone-panel duration-150 shadow-lg"},Eit={class:"flex flex-row p-3"},bit=Ce(()=>p("i",{"data-feather":"chevron-right"},null,-1)),Sit=[bit],yit=Ce(()=>p("i",{"data-feather":"chevron-down"},null,-1)),vit=[yit],Tit=Ce(()=>p("h3",{class:"text-lg font-semibold cursor-pointer select-none mr-2"}," Main configurations",-1)),xit={class:"flex flex-col mb-2 px-3 pb-2"},Cit={class:"expand-to-fit bg-gray-50 border border-gray-300 text-gray-900 text-sm rounded-lg focus:ring-blue-500 focus:border-blue-500 block p-2.5 dark:bg-gray-700 dark:border-gray-600 dark:placeholder-gray-400 dark:text-white dark:focus:ring-blue-500 dark:focus:border-blue-500"},Rit=Ce(()=>p("td",{style:{"min-width":"200px"}},[p("label",{for:"db_path",class:"text-sm font-bold",style:{"margin-right":"1rem"}},"Host:")],-1)),Ait={style:{width:"100%"}},wit=Ce(()=>p("td",{style:{"min-width":"200px"}},[p("label",{for:"db_path",class:"text-sm font-bold",style:{"margin-right":"1rem"}},"Port:")],-1)),Oit={style:{width:"100%"}},Nit=Ce(()=>p("td",{style:{"min-width":"200px"}},[p("label",{for:"db_path",class:"text-sm font-bold",style:{"margin-right":"1rem"}},"Database path:")],-1)),Mit={style:{width:"100%"}},Iit=Ce(()=>p("td",{style:{"min-width":"200px"}},[p("label",{for:"auto_show_browser",class:"text-sm font-bold",style:{"margin-right":"1rem"}},"Auto show browser:")],-1)),Dit={class:"flex flex-row"},Lit=Ce(()=>p("td",{style:{"min-width":"200px"}},[p("label",{for:"activate_debug",class:"text-sm font-bold",style:{"margin-right":"1rem"}},"Activate debug mode:")],-1)),kit={class:"flex flex-row"},Pit=Ce(()=>p("td",{style:{"min-width":"200px"}},[p("label",{for:"enable_gpu",class:"text-sm font-bold",style:{"margin-right":"1rem"}},"Enable GPU:")],-1)),Uit={class:"text-center items-center"},Fit={class:"flex flex-row"},Bit=Ce(()=>p("td",{style:{"min-width":"200px"}},[p("label",{for:"auto_save",class:"text-sm font-bold",style:{"margin-right":"1rem"}},"Auto save:")],-1)),Git={class:"flex flex-row"},zit=Ce(()=>p("td",{style:{"min-width":"200px"}},[p("label",{for:"auto_update",class:"text-sm font-bold",style:{"margin-right":"1rem"}},"Auto update:")],-1)),Vit={class:"flex flex-row"},Hit=Ce(()=>p("td",{style:{"min-width":"200px"}},[p("label",{for:"auto_update",class:"text-sm font-bold",style:{"margin-right":"1rem"}},"Auto title:")],-1)),qit={class:"flex flex-row"},Yit={class:"bg-gray-50 border border-gray-300 text-gray-900 text-sm rounded-lg focus:ring-blue-500 focus:border-blue-500 block w-full p-2.5 dark:bg-gray-700 dark:border-gray-600 dark:placeholder-gray-400 dark:text-white dark:focus:ring-blue-500 dark:focus:border-blue-500"},$it=Ce(()=>p("td",{style:{"min-width":"200px"}},[p("label",{for:"user_name",class:"text-sm font-bold",style:{"margin-right":"1rem"}},"User name:")],-1)),Wit={style:{width:"100%"}},Kit=Ce(()=>p("td",{style:{"min-width":"200px"}},[p("label",{for:"user_description",class:"text-sm font-bold",style:{"margin-right":"1rem"}},"User description:")],-1)),jit={style:{width:"100%"}},Qit=Ce(()=>p("td",{style:{"min-width":"200px"}},[p("label",{for:"user_description",class:"text-sm font-bold",style:{"margin-right":"1rem"}},"Use user description in discussion:")],-1)),Xit={style:{width:"100%"}},Zit=Ce(()=>p("td",{style:{"min-width":"200px"}},[p("label",{for:"user_name",class:"text-sm font-bold",style:{"margin-right":"1rem"}},"User avatar:")],-1)),Jit={style:{width:"100%"}},ert={for:"avatar-upload"},trt=["src"],nrt=Ce(()=>p("td",{style:{"min-width":"200px"}},[p("label",{for:"use_user_name_in_discussions",class:"text-sm font-bold",style:{"margin-right":"1rem"}},"Use User Name in discussions:")],-1)),irt={class:"flex flex-row"},rrt=Ce(()=>p("td",{style:{"min-width":"200px"}},[p("label",{for:"min_n_predict",class:"text-sm font-bold",style:{"margin-right":"1rem"}},"Minimum number of output tokens space (forces the model to have more space to speak):")],-1)),srt={style:{width:"100%"}},ort={class:"bg-gray-50 border border-gray-300 text-gray-900 text-sm rounded-lg focus:ring-blue-500 focus:border-blue-500 block w-full p-2.5 dark:bg-gray-700 dark:border-gray-600 dark:placeholder-gray-400 dark:text-white dark:focus:ring-blue-500 dark:focus:border-blue-500"},art=Ce(()=>p("td",{style:{"min-width":"200px"}},[p("label",{for:"use_files",class:"text-sm font-bold",style:{"margin-right":"1rem"}},"Activate files support:")],-1)),lrt={class:"flex flex-row"},crt=Ce(()=>p("td",{style:{"min-width":"200px"}},[p("label",{for:"use_discussions_history",class:"text-sm font-bold",style:{"margin-right":"1rem"}},"Activate discussion vectorization:")],-1)),drt={class:"flex flex-row"},urt=Ce(()=>p("td",{style:{"min-width":"200px"}},[p("label",{for:"summerize_discussion",class:"text-sm font-bold",style:{"margin-right":"1rem"}},"Activate Continuous Learning from discussions:")],-1)),_rt={class:"flex flex-row"},prt=Ce(()=>p("td",{style:{"min-width":"200px"}},[p("label",{for:"data_vectorization_visualize_on_vectorization",class:"text-sm font-bold",style:{"margin-right":"1rem"}},"show vectorized data:")],-1)),hrt={class:"flex flex-row"},frt=Ce(()=>p("td",{style:{"min-width":"200px"}},[p("label",{for:"data_vectorization_activate",class:"text-sm font-bold",style:{"margin-right":"1rem"}},"Activate data Vectorization:")],-1)),mrt={class:"flex flex-row"},grt=Ce(()=>p("td",{style:{"min-width":"200px"}},[p("label",{for:"data_vectorization_build_keys_words",class:"text-sm font-bold",style:{"margin-right":"1rem"}},"Build keywords when querying the vectorized database:")],-1)),Ert={class:"flex flex-row"},brt=Ce(()=>p("td",{style:{"min-width":"200px"}},[p("label",{for:"data_vectorization_method",class:"text-sm font-bold",style:{"margin-right":"1rem"}},"Data vectorization method:")],-1)),Srt=Ce(()=>p("option",{value:"tfidf_vectorizer"},"tfidf Vectorizer",-1)),yrt=Ce(()=>p("option",{value:"model_embedding"},"Model Embedding",-1)),vrt=[Srt,yrt],Trt=Ce(()=>p("td",{style:{"min-width":"200px"}},[p("label",{for:"data_visualization_method",class:"text-sm font-bold",style:{"margin-right":"1rem"}},"Data visualization method:")],-1)),xrt=Ce(()=>p("option",{value:"PCA"},"PCA",-1)),Crt=Ce(()=>p("option",{value:"TSNE"},"TSNE",-1)),Rrt=[xrt,Crt],Art=Ce(()=>p("td",{style:{"min-width":"200px"}},[p("label",{for:"data_vectorization_save_db",class:"text-sm font-bold",style:{"margin-right":"1rem"}},"Save the new files to the database (The database wil always grow and continue to be the same over many sessions):")],-1)),wrt={class:"flex flex-row"},Ort=Ce(()=>p("td",{style:{"min-width":"200px"}},[p("label",{for:"data_vectorization_chunk_size",class:"text-sm font-bold",style:{"margin-right":"1rem"}},"Data vectorization chunk size(tokens):")],-1)),Nrt=Ce(()=>p("td",{style:{"min-width":"200px"}},[p("label",{for:"data_vectorization_overlap_size",class:"text-sm font-bold",style:{"margin-right":"1rem"}},"Data vectorization overlap size(tokens):")],-1)),Mrt=Ce(()=>p("td",{style:{"min-width":"200px"}},[p("label",{for:"data_vectorization_overlap_size",class:"text-sm font-bold",style:{"margin-right":"1rem"}},"Number of chunks to use for each message:")],-1)),Irt={class:"bg-gray-50 border border-gray-300 text-gray-900 text-sm rounded-lg focus:ring-blue-500 focus:border-blue-500 block w-full p-2.5 dark:bg-gray-700 dark:border-gray-600 dark:placeholder-gray-400 dark:text-white dark:focus:ring-blue-500 dark:focus:border-blue-500"},Drt=Ce(()=>p("td",{style:{"min-width":"200px"}},[p("label",{for:"audio_auto_send_input",class:"text-sm font-bold",style:{"margin-right":"1rem"}},"Send audio input automatically:")],-1)),Lrt={class:"flex flex-row"},krt=Ce(()=>p("td",{style:{"min-width":"200px"}},[p("label",{for:"auto_speak",class:"text-sm font-bold",style:{"margin-right":"1rem"}},"Enable auto speak:")],-1)),Prt={class:"flex flex-row"},Urt=Ce(()=>p("td",{style:{"min-width":"200px"}},[p("label",{for:"enable_voice_service",class:"text-sm font-bold",style:{"margin-right":"1rem"}},"Enable voice service:")],-1)),Frt={class:"flex flex-row"},Brt=Ce(()=>p("td",{style:{"min-width":"200px"}},[p("label",{for:"current_voice",class:"text-sm font-bold",style:{"margin-right":"1rem"}},"Current voice:")],-1)),Grt={class:"flex flex-row"},zrt=["disabled"],Vrt=["value"],Hrt=Ce(()=>p("td",{style:{"min-width":"200px"}},[p("label",{for:"auto_read",class:"text-sm font-bold",style:{"margin-right":"1rem"}},"Enable auto read:")],-1)),qrt={class:"flex flex-row"},Yrt=["disabled"],$rt=Ce(()=>p("td",{style:{"min-width":"200px"}},[p("label",{for:"audio_pitch",class:"text-sm font-bold",style:{"margin-right":"1rem"}},"audio pitch:")],-1)),Wrt=Ce(()=>p("td",{style:{"min-width":"200px"}},[p("label",{for:"audio_silenceTimer",class:"text-sm font-bold",style:{"margin-right":"1rem"}},"audio in silence timer (ms):")],-1)),Krt=Ce(()=>p("td",{style:{"min-width":"200px"}},[p("label",{for:"audio_in_language",class:"text-sm font-bold",style:{"margin-right":"1rem"}},"Input Audio Language:")],-1)),jrt=["value"],Qrt=Ce(()=>p("td",{style:{"min-width":"200px"}},[p("label",{for:"audio_out_voice",class:"text-sm font-bold",style:{"margin-right":"1rem"}},"Output Audio Voice:")],-1)),Xrt=["value"],Zrt={class:"flex flex-col mb-2 rounded-lg bg-bg-light-tone dark:bg-bg-dark-tone hover:bg-bg-light-tone-panel hover:dark:bg-bg-dark-tone-panel duration-150 shadow-lg"},Jrt={class:"flex flex-row p-3"},est=Ce(()=>p("i",{"data-feather":"chevron-right"},null,-1)),tst=[est],nst=Ce(()=>p("i",{"data-feather":"chevron-down"},null,-1)),ist=[nst],rst=Ce(()=>p("h3",{class:"text-lg font-semibold cursor-pointer select-none mr-2"}," Binding zoo",-1)),sst={key:0,class:"text-base text-red-600 flex gap-3 items-center mr-2"},ost=Ce(()=>p("i",{"data-feather":"alert-triangle",class:"flex-shrink-0"},null,-1)),ast={key:1,class:"mr-2"},lst={key:2,class:"text-base font-semibold cursor-pointer select-none items-center"},cst={class:"flex gap-1 items-center"},dst=["src"],ust={class:"font-bold font-large text-lg line-clamp-1"},_st={key:0,class:"mb-2"},pst={for:"binding",class:"block ml-2 mb-2 text-sm font-medium text-gray-900 dark:text-white"},hst=Ce(()=>p("i",{"data-feather":"chevron-up"},null,-1)),fst=[hst],mst=Ce(()=>p("i",{"data-feather":"chevron-down"},null,-1)),gst=[mst],Est={class:"flex flex-col mb-2 rounded-lg bg-bg-light-tone dark:bg-bg-dark-tone hover:bg-bg-light-tone-panel hover:dark:bg-bg-dark-tone-panel duration-150 shadow-lg"},bst={class:"flex flex-row p-3"},Sst=Ce(()=>p("i",{"data-feather":"chevron-right"},null,-1)),yst=[Sst],vst=Ce(()=>p("i",{"data-feather":"chevron-down"},null,-1)),Tst=[vst],xst=Ce(()=>p("h3",{class:"text-lg font-semibold cursor-pointer select-none mr-2"}," Models zoo",-1)),Cst={class:"flex flex-row items-center"},Rst={key:0,class:"text-base text-red-600 flex gap-3 items-center mr-2"},Ast=Ce(()=>p("i",{"data-feather":"alert-triangle",class:"flex-shrink-0"},null,-1)),wst={key:1,class:"text-base text-red-600 flex gap-3 items-center mr-2"},Ost=Ce(()=>p("i",{"data-feather":"alert-triangle",class:"flex-shrink-0"},null,-1)),Nst={key:2,class:"mr-2"},Mst={key:3,class:"text-base font-semibold cursor-pointer select-none items-center"},Ist={class:"flex gap-1 items-center"},Dst=["src"],Lst={class:"font-bold font-large text-lg line-clamp-1"},kst={class:"mx-2 mb-4"},Pst={class:"relative"},Ust={class:"absolute inset-y-0 left-0 flex items-center pl-3 pointer-events-none"},Fst={key:0},Bst=Ce(()=>p("div",{role:"status"},[p("svg",{"aria-hidden":"true",class:"inline w-4 h-4 mr-2 text-gray-200 animate-spin dark:text-gray-600 fill-blue-600",viewBox:"0 0 100 101",fill:"none",xmlns:"http://www.w3.org/2000/svg"},[p("path",{d:"M100 50.5908C100 78.2051 77.6142 100.591 50 100.591C22.3858 100.591 0 78.2051 0 50.5908C0 22.9766 22.3858 0.59082 50 0.59082C77.6142 0.59082 100 22.9766 100 50.5908ZM9.08144 50.5908C9.08144 73.1895 27.4013 91.5094 50 91.5094C72.5987 91.5094 90.9186 73.1895 90.9186 50.5908C90.9186 27.9921 72.5987 9.67226 50 9.67226C27.4013 9.67226 9.08144 27.9921 9.08144 50.5908Z",fill:"currentColor"}),p("path",{d:"M93.9676 39.0409C96.393 38.4038 97.8624 35.9116 97.0079 33.5539C95.2932 28.8227 92.871 24.3692 89.8167 20.348C85.8452 15.1192 80.8826 10.7238 75.2124 7.41289C69.5422 4.10194 63.2754 1.94025 56.7698 1.05124C51.7666 0.367541 46.6976 0.446843 41.7345 1.27873C39.2613 1.69328 37.813 4.19778 38.4501 6.62326C39.0873 9.04874 41.5694 10.4717 44.0505 10.1071C47.8511 9.54855 51.7191 9.52689 55.5402 10.0491C60.8642 10.7766 65.9928 12.5457 70.6331 15.2552C75.2735 17.9648 79.3347 21.5619 82.5849 25.841C84.9175 28.9121 86.7997 32.2913 88.1811 35.8758C89.083 38.2158 91.5421 39.6781 93.9676 39.0409Z",fill:"currentFill"})]),p("span",{class:"sr-only"},"Loading...")],-1)),Gst=[Bst],zst={key:1},Vst=Ce(()=>p("svg",{"aria-hidden":"true",class:"w-5 h-5 text-gray-500 dark:text-gray-400",fill:"none",stroke:"currentColor",viewBox:"0 0 24 24",xmlns:"http://www.w3.org/2000/svg"},[p("path",{"stroke-linecap":"round","stroke-linejoin":"round","stroke-width":"2",d:"M21 21l-6-6m2-5a7 7 0 11-14 0 7 7 0 0114 0z"})],-1)),Hst=[Vst],qst=Ce(()=>p("label",{for:"only_installed"},"Show only installed models",-1)),Yst=Ce(()=>p("a",{href:"https://huggingface.co/spaces/HuggingFaceH4/open_llm_leaderboard",target:"_blank",class:"mb-4 font-bold underline text-blue-500 pb-4"},"Hugging face Leaderboard",-1)),$st={key:0,role:"status",class:"text-center w-full display: flex;align-items: center;"},Wst=Ce(()=>p("svg",{"aria-hidden":"true",class:"text-center w-full display: flex;align-items: center; h-20 animate-spin fill-secondary",viewBox:"0 0 100 101",fill:"none",xmlns:"http://www.w3.org/2000/svg"},[p("path",{d:"M100 50.5908C100 78.2051 77.6142 100.591 50 100.591C22.3858 100.591 0 78.2051 0 50.5908C0 22.9766 22.3858 0.59082 50 0.59082C77.6142 0.59082 100 22.9766 100 50.5908ZM9.08144 50.5908C9.08144 73.1895 27.4013 91.5094 50 91.5094C72.5987 91.5094 90.9186 73.1895 90.9186 50.5908C90.9186 27.9921 72.5987 9.67226 50 9.67226C27.4013 9.67226 9.08144 27.9921 9.08144 50.5908Z",fill:"currentColor"}),p("path",{d:"M93.9676 39.0409C96.393 38.4038 97.8624 35.9116 97.0079 33.5539C95.2932 28.8227 92.871 24.3692 89.8167 20.348C85.8452 15.1192 80.8826 10.7238 75.2124 7.41289C69.5422 4.10194 63.2754 1.94025 56.7698 1.05124C51.7666 0.367541 46.6976 0.446843 41.7345 1.27873C39.2613 1.69328 37.813 4.19778 38.4501 6.62326C39.0873 9.04874 41.5694 10.4717 44.0505 10.1071C47.8511 9.54855 51.7191 9.52689 55.5402 10.0491C60.8642 10.7766 65.9928 12.5457 70.6331 15.2552C75.2735 17.9648 79.3347 21.5619 82.5849 25.841C84.9175 28.9121 86.7997 32.2913 88.1811 35.8758C89.083 38.2158 91.5421 39.6781 93.9676 39.0409Z",fill:"currentFill"})],-1)),Kst=Ce(()=>p("p",{class:"heartbeat-text"},"Loading models Zoo",-1)),jst=[Wst,Kst],Qst={key:1,class:"mb-2"},Xst={for:"model",class:"block ml-2 mb-2 text-sm font-medium text-gray-900 dark:text-white"},Zst=Ce(()=>p("i",{"data-feather":"chevron-up"},null,-1)),Jst=[Zst],eot=Ce(()=>p("i",{"data-feather":"chevron-down"},null,-1)),tot=[eot],not={class:"flex flex-col mb-2 rounded-lg bg-bg-light-tone dark:bg-bg-dark-tone hover:bg-bg-light-tone-panel hover:dark:bg-bg-dark-tone-panel duration-150 shadow-lg"},iot={class:"flex flex-row p-3"},rot=Ce(()=>p("i",{"data-feather":"chevron-right"},null,-1)),sot=[rot],oot=Ce(()=>p("i",{"data-feather":"chevron-down"},null,-1)),aot=[oot],lot=Ce(()=>p("h3",{class:"text-lg font-semibold cursor-pointer select-none mr-2"}," Add models for binding",-1)),cot={key:0,class:"text-base text-red-600 flex gap-3 items-center mr-2"},dot=Ce(()=>p("i",{"data-feather":"alert-triangle",class:"flex-shrink-0"},null,-1)),uot={key:1,class:"mr-2"},_ot={key:2,class:"text-base font-semibold cursor-pointer select-none items-center"},pot={class:"flex gap-1 items-center"},hot=["src"],fot={class:"font-bold font-large text-lg line-clamp-1"},mot={class:"mb-2"},got={class:"p-2"},Eot={class:"mb-3"},bot=Ce(()=>p("label",{class:"block mb-2 text-sm font-medium text-gray-900 dark:text-white"},"Create a reference from local file path:",-1)),Sot={key:0},yot={class:"mb-3"},vot=Ce(()=>p("label",{class:"block mb-2 text-sm font-medium text-gray-900 dark:text-white"},"Download from web:",-1)),Tot={key:1,class:"relative flex flex-col items-center justify-center flex-grow h-full"},xot=Ce(()=>p("div",{role:"status",class:"justify-center"},null,-1)),Cot={class:"relative flex flex-row flex-grow items-center w-full h-full bottom-0"},Rot={class:"w-full p-2"},Aot={class:"flex justify-between mb-1"},wot=Og(' Downloading Loading...',1),Oot={class:"text-sm font-medium text-blue-700 dark:text-white"},Not=["title"],Mot={class:"w-full bg-gray-200 rounded-full h-2.5 dark:bg-gray-700"},Iot={class:"flex justify-between mb-1"},Dot={class:"text-base font-medium text-blue-700 dark:text-white"},Lot={class:"text-sm font-medium text-blue-700 dark:text-white"},kot={class:"flex flex-grow"},Pot={class:"flex flex-row flex-grow gap-3"},Uot={class:"p-2 text-center grow"},Fot={class:"flex flex-col mb-2 rounded-lg bg-bg-light-tone dark:bg-bg-dark-tone hover:bg-bg-light-tone-panel hover:dark:bg-bg-dark-tone-panel duration-150 shadow-lg"},Bot={class:"flex flex-row p-3 items-center"},Got=Ce(()=>p("i",{"data-feather":"chevron-right"},null,-1)),zot=[Got],Vot=Ce(()=>p("i",{"data-feather":"chevron-down"},null,-1)),Hot=[Vot],qot=Ce(()=>p("h3",{class:"text-lg font-semibold cursor-pointer select-none mr-2"}," Personalities zoo",-1)),Yot={key:0,class:"mr-2"},$ot={class:"mr-2 font-bold font-large text-lg line-clamp-1"},Wot={key:1,class:"mr-2"},Kot={key:2,class:"text-base font-semibold cursor-pointer select-none items-center flex flex-row"},jot={key:0,class:"flex -space-x-4 items-center"},Qot={class:"group items-center flex flex-row"},Xot=["onClick"],Zot=["src","title"],Jot=["onClick"],eat=Ce(()=>p("span",{class:"hidden group-hover:block top-0 left-7 absolute active:scale-90 bg-bg-light dark:bg-bg-dark rounded-full border-2 border-transparent",title:"Unmount personality"},[p("svg",{"aria-hidden":"true",class:"w-4 h-4 text-red-600 hover:text-red-500",fill:"currentColor",viewBox:"0 0 20 20",xmlns:"http://www.w3.org/2000/svg"},[p("path",{"fill-rule":"evenodd",d:"M4.293 4.293a1 1 0 011.414 0L10 8.586l4.293-4.293a1 1 0 111.414 1.414L11.414 10l4.293 4.293a1 1 0 01-1.414 1.414L10 11.414l-4.293 4.293a1 1 0 01-1.414-1.414L8.586 10 4.293 5.707a1 1 0 010-1.414z","clip-rule":"evenodd"})])],-1)),tat=[eat],nat={class:"mx-2 mb-4"},iat=Ce(()=>p("label",{for:"personality-search",class:"mb-2 text-sm font-medium text-gray-900 sr-only dark:text-white"},"Search",-1)),rat={class:"relative"},sat={class:"absolute inset-y-0 left-0 flex items-center pl-3 pointer-events-none"},oat={key:0},aat=Ce(()=>p("div",{role:"status"},[p("svg",{"aria-hidden":"true",class:"inline w-4 h-4 mr-2 text-gray-200 animate-spin dark:text-gray-600 fill-blue-600",viewBox:"0 0 100 101",fill:"none",xmlns:"http://www.w3.org/2000/svg"},[p("path",{d:"M100 50.5908C100 78.2051 77.6142 100.591 50 100.591C22.3858 100.591 0 78.2051 0 50.5908C0 22.9766 22.3858 0.59082 50 0.59082C77.6142 0.59082 100 22.9766 100 50.5908ZM9.08144 50.5908C9.08144 73.1895 27.4013 91.5094 50 91.5094C72.5987 91.5094 90.9186 73.1895 90.9186 50.5908C90.9186 27.9921 72.5987 9.67226 50 9.67226C27.4013 9.67226 9.08144 27.9921 9.08144 50.5908Z",fill:"currentColor"}),p("path",{d:"M93.9676 39.0409C96.393 38.4038 97.8624 35.9116 97.0079 33.5539C95.2932 28.8227 92.871 24.3692 89.8167 20.348C85.8452 15.1192 80.8826 10.7238 75.2124 7.41289C69.5422 4.10194 63.2754 1.94025 56.7698 1.05124C51.7666 0.367541 46.6976 0.446843 41.7345 1.27873C39.2613 1.69328 37.813 4.19778 38.4501 6.62326C39.0873 9.04874 41.5694 10.4717 44.0505 10.1071C47.8511 9.54855 51.7191 9.52689 55.5402 10.0491C60.8642 10.7766 65.9928 12.5457 70.6331 15.2552C75.2735 17.9648 79.3347 21.5619 82.5849 25.841C84.9175 28.9121 86.7997 32.2913 88.1811 35.8758C89.083 38.2158 91.5421 39.6781 93.9676 39.0409Z",fill:"currentFill"})]),p("span",{class:"sr-only"},"Loading...")],-1)),lat=[aat],cat={key:1},dat=Ce(()=>p("svg",{"aria-hidden":"true",class:"w-5 h-5 text-gray-500 dark:text-gray-400",fill:"none",stroke:"currentColor",viewBox:"0 0 24 24",xmlns:"http://www.w3.org/2000/svg"},[p("path",{"stroke-linecap":"round","stroke-linejoin":"round","stroke-width":"2",d:"M21 21l-6-6m2-5a7 7 0 11-14 0 7 7 0 0114 0z"})],-1)),uat=[dat],_at={key:0,class:"mx-2 mb-4"},pat={for:"persCat",class:"block mb-2 text-sm font-medium text-gray-900 dark:text-white"},hat=["selected"],fat={key:0,class:"mb-2"},mat={for:"model",class:"block ml-2 mb-2 text-sm font-medium text-gray-900 dark:text-white"},gat=Ce(()=>p("i",{"data-feather":"chevron-up"},null,-1)),Eat=[gat],bat=Ce(()=>p("i",{"data-feather":"chevron-down"},null,-1)),Sat=[bat],yat={class:"flex flex-col mb-2 rounded-lg bg-bg-light-tone dark:bg-bg-dark-tone hover:bg-bg-light-tone-panel hover:dark:bg-bg-dark-tone-panel duration-150 shadow-lg"},vat={class:"flex flex-row p-3 items-center"},Tat=Ce(()=>p("i",{"data-feather":"chevron-right"},null,-1)),xat=[Tat],Cat=Ce(()=>p("i",{"data-feather":"chevron-down"},null,-1)),Rat=[Cat],Aat=Ce(()=>p("h3",{class:"text-lg font-semibold cursor-pointer select-none mr-2"}," Extensions zoo",-1)),wat={key:0,class:"mr-2"},Oat={key:1,class:"text-base font-semibold cursor-pointer select-none items-center flex flex-row"},Nat={key:0,class:"flex -space-x-4 items-center"},Mat={class:"group items-center flex flex-row"},Iat=["src","title"],Dat=["onClick"],Lat=Ce(()=>p("span",{class:"hidden group-hover:block top-0 left-7 absolute active:scale-90 bg-bg-light dark:bg-bg-dark rounded-full border-2 border-transparent",title:"Unmount personality"},[p("svg",{"aria-hidden":"true",class:"w-4 h-4 text-red-600 hover:text-red-500",fill:"currentColor",viewBox:"0 0 20 20",xmlns:"http://www.w3.org/2000/svg"},[p("path",{"fill-rule":"evenodd",d:"M4.293 4.293a1 1 0 011.414 0L10 8.586l4.293-4.293a1 1 0 111.414 1.414L11.414 10l4.293 4.293a1 1 0 01-1.414 1.414L10 11.414l-4.293 4.293a1 1 0 01-1.414-1.414L8.586 10 4.293 5.707a1 1 0 010-1.414z","clip-rule":"evenodd"})])],-1)),kat=[Lat],Pat={class:"mx-2 mb-4"},Uat=Ce(()=>p("label",{for:"personality-search",class:"mb-2 text-sm font-medium text-gray-900 sr-only dark:text-white"},"Search",-1)),Fat={class:"relative"},Bat={class:"absolute inset-y-0 left-0 flex items-center pl-3 pointer-events-none"},Gat={key:0},zat=Ce(()=>p("div",{role:"status"},[p("svg",{"aria-hidden":"true",class:"inline w-4 h-4 mr-2 text-gray-200 animate-spin dark:text-gray-600 fill-blue-600",viewBox:"0 0 100 101",fill:"none",xmlns:"http://www.w3.org/2000/svg"},[p("path",{d:"M100 50.5908C100 78.2051 77.6142 100.591 50 100.591C22.3858 100.591 0 78.2051 0 50.5908C0 22.9766 22.3858 0.59082 50 0.59082C77.6142 0.59082 100 22.9766 100 50.5908ZM9.08144 50.5908C9.08144 73.1895 27.4013 91.5094 50 91.5094C72.5987 91.5094 90.9186 73.1895 90.9186 50.5908C90.9186 27.9921 72.5987 9.67226 50 9.67226C27.4013 9.67226 9.08144 27.9921 9.08144 50.5908Z",fill:"currentColor"}),p("path",{d:"M93.9676 39.0409C96.393 38.4038 97.8624 35.9116 97.0079 33.5539C95.2932 28.8227 92.871 24.3692 89.8167 20.348C85.8452 15.1192 80.8826 10.7238 75.2124 7.41289C69.5422 4.10194 63.2754 1.94025 56.7698 1.05124C51.7666 0.367541 46.6976 0.446843 41.7345 1.27873C39.2613 1.69328 37.813 4.19778 38.4501 6.62326C39.0873 9.04874 41.5694 10.4717 44.0505 10.1071C47.8511 9.54855 51.7191 9.52689 55.5402 10.0491C60.8642 10.7766 65.9928 12.5457 70.6331 15.2552C75.2735 17.9648 79.3347 21.5619 82.5849 25.841C84.9175 28.9121 86.7997 32.2913 88.1811 35.8758C89.083 38.2158 91.5421 39.6781 93.9676 39.0409Z",fill:"currentFill"})]),p("span",{class:"sr-only"},"Loading...")],-1)),Vat=[zat],Hat={key:1},qat=Ce(()=>p("svg",{"aria-hidden":"true",class:"w-5 h-5 text-gray-500 dark:text-gray-400",fill:"none",stroke:"currentColor",viewBox:"0 0 24 24",xmlns:"http://www.w3.org/2000/svg"},[p("path",{"stroke-linecap":"round","stroke-linejoin":"round","stroke-width":"2",d:"M21 21l-6-6m2-5a7 7 0 11-14 0 7 7 0 0114 0z"})],-1)),Yat=[qat],$at={key:0,class:"mx-2 mb-4"},Wat={for:"extCat",class:"block mb-2 text-sm font-medium text-gray-900 dark:text-white"},Kat=["selected"],jat={key:0,class:"mb-2"},Qat={for:"model",class:"block ml-2 mb-2 text-sm font-medium text-gray-900 dark:text-white"},Xat=Ce(()=>p("i",{"data-feather":"chevron-up"},null,-1)),Zat=[Xat],Jat=Ce(()=>p("i",{"data-feather":"chevron-down"},null,-1)),elt=[Jat],tlt={class:"flex flex-col mb-2 rounded-lg bg-bg-light-tone dark:bg-bg-dark-tone hover:bg-bg-light-tone-panel hover:dark:bg-bg-dark-tone-panel duration-150 shadow-lg"},nlt={class:"flex flex-row p-3 items-center"},ilt=Ce(()=>p("i",{"data-feather":"chevron-right"},null,-1)),rlt=[ilt],slt=Ce(()=>p("i",{"data-feather":"chevron-down"},null,-1)),olt=[slt],alt=Ce(()=>p("h3",{class:"text-lg font-semibold cursor-pointer select-none mr-2"}," Mounted Extensions Priority",-1)),llt={class:"flex flex-col mb-2 p-3 rounded-lg bg-bg-light-tone dark:bg-bg-dark-tone hover:bg-bg-light-tone-panel hover:dark:bg-bg-dark-tone-panel duration-150 shadow-lg"},clt={class:"flex flex-row"},dlt=Ce(()=>p("i",{"data-feather":"chevron-right"},null,-1)),ult=[dlt],_lt=Ce(()=>p("i",{"data-feather":"chevron-down"},null,-1)),plt=[_lt],hlt=Ce(()=>p("h3",{class:"text-lg font-semibold cursor-pointer select-none"}," Model Configuration",-1)),flt={class:"m-2"},mlt={class:"flex flex-row gap-2 items-center"},glt=Ce(()=>p("label",{for:"override-model-parameters",class:"block text-sm font-medium"}," Override personality model parameters ",-1)),Elt={class:"m-2"},blt=Ce(()=>p("label",{for:"seed",class:"block mb-2 text-sm font-medium"}," Seed: ",-1)),Slt={class:"m-2"},ylt={class:"flex flex-col align-bottom"},vlt={class:"relative"},Tlt=Ce(()=>p("p",{class:"absolute left-0 mt-6"},[p("label",{for:"temperature",class:"text-sm font-medium"}," Temperature: ")],-1)),xlt={class:"absolute right-0"},Clt={class:"m-2"},Rlt={class:"flex flex-col align-bottom"},Alt={class:"relative"},wlt=Ce(()=>p("p",{class:"absolute left-0 mt-6"},[p("label",{for:"predict",class:"text-sm font-medium"}," N Predict: ")],-1)),Olt={class:"absolute right-0"},Nlt={class:"m-2"},Mlt={class:"flex flex-col align-bottom"},Ilt={class:"relative"},Dlt=Ce(()=>p("p",{class:"absolute left-0 mt-6"},[p("label",{for:"top_k",class:"text-sm font-medium"}," Top-K: ")],-1)),Llt={class:"absolute right-0"},klt={class:"m-2"},Plt={class:"flex flex-col align-bottom"},Ult={class:"relative"},Flt=Ce(()=>p("p",{class:"absolute left-0 mt-6"},[p("label",{for:"top_p",class:"text-sm font-medium"}," Top-P: ")],-1)),Blt={class:"absolute right-0"},Glt={class:"m-2"},zlt={class:"flex flex-col align-bottom"},Vlt={class:"relative"},Hlt=Ce(()=>p("p",{class:"absolute left-0 mt-6"},[p("label",{for:"repeat_penalty",class:"text-sm font-medium"}," Repeat penalty: ")],-1)),qlt={class:"absolute right-0"},Ylt={class:"m-2"},$lt={class:"flex flex-col align-bottom"},Wlt={class:"relative"},Klt=Ce(()=>p("p",{class:"absolute left-0 mt-6"},[p("label",{for:"repeat_last_n",class:"text-sm font-medium"}," Repeat last N: ")],-1)),jlt={class:"absolute right-0"};function Qlt(n,e,t,i,r,s){const o=St("Card"),a=St("BindingEntry"),l=St("RadioOptions"),c=St("model-entry"),d=St("personality-entry"),u=St("ExtensionEntry"),_=St("AddModelDialog"),f=St("ChoiceDialog");return M(),L(Xe,null,[p("div",jtt,[p("div",Qtt,[r.showConfirmation?(M(),L("div",Xtt,[p("button",{class:"text-2xl hover:text-red-600 duration-75 active:scale-90",title:"Cancel",type:"button",onClick:e[0]||(e[0]=Oe(h=>r.showConfirmation=!1,["stop"]))},Jtt),p("button",{class:"text-2xl hover:text-secondary duration-75 active:scale-90",title:"Confirm save changes",type:"button",onClick:e[1]||(e[1]=Oe(h=>s.save_configuration(),["stop"]))},tnt)])):X("",!0),r.showConfirmation?X("",!0):(M(),L("div",nnt,[p("button",{title:"Save configuration",class:"text-2xl hover:text-secondary duration-75 active:scale-90",onClick:e[2]||(e[2]=h=>r.showConfirmation=!0)},rnt),p("button",{title:"Reset configuration",class:"text-2xl hover:text-secondary duration-75 active:scale-90",onClick:e[3]||(e[3]=h=>s.reset_configuration())},ont),p("button",{class:"text-2xl hover:text-secondary duration-75 active:scale-90",title:"Collapse / Expand all panels",type:"button",onClick:e[4]||(e[4]=Oe(h=>r.all_collapsed=!r.all_collapsed,["stop"]))},lnt)])),p("div",cnt,[p("button",{title:"Clear uploads",class:"text-2xl hover:text-secondary duration-75 active:scale-90",onClick:e[5]||(e[5]=h=>s.api_get_req("clear_uploads").then(E=>{E.status?this.$store.state.toast.showToast("Success!",4,!0):this.$store.state.toast.showToast(["failed!"],4,!1)}))},unt),p("button",{title:"Restart program",class:"text-2xl hover:text-secondary duration-75 active:scale-90",onClick:e[6]||(e[6]=h=>s.api_get_req("restart_program").then(E=>{E.status?this.$store.state.toast.showToast("Success!",4,!0):this.$store.state.toast.showToast(["failed!"],4,!1)}))},pnt),p("button",{title:"Upgrade program ",class:"text-2xl hover:text-secondary duration-75 active:scale-90",onClick:e[7]||(e[7]=h=>s.api_get_req("update_software").then(E=>{E.status?this.$store.state.toast.showToast("Success!",4,!0):this.$store.state.toast.showToast("Success!",4,!0)}))},[hnt,r.has_updates?(M(),L("div",fnt,gnt)):X("",!0)]),p("div",Ent,[r.settingsChanged?(M(),L("div",bnt,[Snt,r.isLoading?X("",!0):(M(),L("button",{key:0,class:"text-2xl hover:text-secondary duration-75 active:scale-90",title:"Apply changes",type:"button",onClick:e[8]||(e[8]=Oe(h=>s.applyConfiguration(),["stop"]))},vnt))])):X("",!0),r.isLoading?(M(),L("div",Tnt,[p("p",null,me(r.loading_text),1),xnt,Cnt])):X("",!0)])])]),p("div",{class:Ke(r.isLoading?"pointer-events-none opacity-30 w-full":"w-full")},[p("div",Rnt,[p("div",Ant,[p("button",{onClick:e[9]||(e[9]=Oe(h=>r.sc_collapsed=!r.sc_collapsed,["stop"])),class:"text-2xl hover:text-primary p-2 -m-2 w-full text-left flex flex-row items-center"},[Ae(p("div",null,Ont,512),[[At,r.sc_collapsed]]),Ae(p("div",null,Mnt,512),[[At,!r.sc_collapsed]]),Int,Dnt,p("div",Lnt,[p("div",knt,[p("div",null,[s.vramUsage&&s.vramUsage.gpus&&s.vramUsage.gpus.length==1?(M(),L("div",Pnt,[(M(!0),L(Xe,null,bt(s.vramUsage.gpus,h=>(M(),L("div",Unt,[p("img",{src:r.SVGGPU,width:"25",height:"25"},null,8,Fnt),p("h3",Bnt,[p("div",null,me(s.computedFileSize(h.used_vram))+" / "+me(s.computedFileSize(h.total_vram))+" ("+me(h.percentage)+"%) ",1)])]))),256))])):X("",!0),s.vramUsage&&s.vramUsage.gpus&&s.vramUsage.gpus.length>1?(M(),L("div",Gnt,[p("div",znt,[p("img",{src:r.SVGGPU,width:"25",height:"25"},null,8,Vnt),p("h3",Hnt,[p("div",null,me(s.vramUsage.gpus.length)+"x ",1)])])])):X("",!0)]),qnt,p("h3",Ynt,[p("div",null,me(s.ram_usage)+" / "+me(s.ram_total_space)+" ("+me(s.ram_percent_usage)+"%)",1)]),$nt,p("h3",Wnt,[p("div",null,me(s.disk_binding_models_usage)+" / "+me(s.disk_total_space)+" ("+me(s.disk_percent_usage)+"%)",1)])])])])]),p("div",{class:Ke([{hidden:r.sc_collapsed},"flex flex-col mb-2 px-3 pb-0"])},[p("div",Knt,[jnt,p("div",Qnt,[p("div",null,[Xnt,$e(me(s.ram_available_space),1)]),p("div",null,[Znt,$e(" "+me(s.ram_usage)+" / "+me(s.ram_total_space)+" ("+me(s.ram_percent_usage)+")% ",1)])]),p("div",Jnt,[p("div",eit,[p("div",{class:"bg-blue-600 h-2.5 rounded-full",style:un("width: "+s.ram_percent_usage+"%;")},null,4)])])]),p("div",tit,[nit,p("div",iit,[p("div",null,[rit,$e(me(s.disk_available_space),1)]),p("div",null,[sit,$e(" "+me(s.disk_binding_models_usage)+" / "+me(s.disk_total_space)+" ("+me(s.disk_percent_usage)+"%)",1)])]),p("div",oit,[p("div",ait,[p("div",{class:"bg-blue-600 h-2.5 rounded-full",style:un("width: "+s.disk_percent_usage+"%;")},null,4)])])]),(M(!0),L(Xe,null,bt(s.vramUsage.gpus,h=>(M(),L("div",lit,[p("label",cit,[p("img",{src:r.SVGGPU,width:"25",height:"25"},null,8,dit),$e(" GPU usage: ")]),p("div",uit,[p("div",null,[_it,$e(me(h.gpu_model),1)]),p("div",null,[pit,$e(me(this.computedFileSize(h.available_space)),1)]),p("div",null,[hit,$e(" "+me(this.computedFileSize(h.used_vram))+" / "+me(this.computedFileSize(h.total_vram))+" ("+me(h.percentage)+"%)",1)])]),p("div",fit,[p("div",mit,[p("div",{class:"bg-blue-600 h-2.5 rounded-full",style:un("width: "+h.percentage+"%;")},null,4)])])]))),256))],2)]),p("div",git,[p("div",Eit,[p("button",{onClick:e[10]||(e[10]=Oe(h=>r.minconf_collapsed=!r.minconf_collapsed,["stop"])),class:"text-2xl hover:text-primary p-2 -m-2 w-full text-left flex flex-row items-center"},[Ae(p("div",null,Sit,512),[[At,r.minconf_collapsed]]),Ae(p("div",null,vit,512),[[At,!r.minconf_collapsed]]),Tit])]),p("div",{class:Ke([{hidden:r.minconf_collapsed},"flex flex-col mb-2 px-3 pb-0"])},[p("div",xit,[Le(o,{title:"General",is_subcard:!0,class:"pb-2 m-2"},{default:dt(()=>[p("table",Cit,[p("tr",null,[Rit,p("td",Ait,[Ae(p("input",{type:"text",id:"host",required:"","onUpdate:modelValue":e[11]||(e[11]=h=>s.configFile.host=h),onChange:e[12]||(e[12]=h=>r.settingsChanged=!0),class:"w-full w-full mt-1 px-2 py-1 border border-gray-300 rounded dark:bg-gray-600 dark:bg-gray-600"},null,544),[[Je,s.configFile.host]])])]),p("tr",null,[wit,p("td",Oit,[Ae(p("input",{type:"number",step:"1",id:"port",required:"","onUpdate:modelValue":e[13]||(e[13]=h=>s.configFile.port=h),onChange:e[14]||(e[14]=h=>r.settingsChanged=!0),class:"w-full w-full mt-1 px-2 py-1 border border-gray-300 rounded dark:bg-gray-600 dark:bg-gray-600"},null,544),[[Je,s.configFile.port]])])]),p("tr",null,[Nit,p("td",Mit,[Ae(p("input",{type:"text",id:"db_path",required:"","onUpdate:modelValue":e[15]||(e[15]=h=>s.configFile.db_path=h),onChange:e[16]||(e[16]=h=>r.settingsChanged=!0),class:"w-full w-full mt-1 px-2 py-1 border border-gray-300 rounded dark:bg-gray-600 dark:bg-gray-600"},null,544),[[Je,s.configFile.db_path]])])]),p("tr",null,[Iit,p("td",null,[p("div",Dit,[Ae(p("input",{type:"checkbox",id:"auto_show_browser",required:"","onUpdate:modelValue":e[17]||(e[17]=h=>s.configFile.auto_show_browser=h),onChange:e[18]||(e[18]=h=>r.settingsChanged=!0),class:"m-2 h-50 w-50 py-1 border border-gray-300 rounded dark:bg-gray-600"},null,544),[[Mt,s.configFile.auto_show_browser]])])])]),p("tr",null,[Lit,p("td",null,[p("div",kit,[Ae(p("input",{type:"checkbox",id:"activate_debug",required:"","onUpdate:modelValue":e[19]||(e[19]=h=>s.configFile.debug=h),onChange:e[20]||(e[20]=h=>r.settingsChanged=!0),class:"m-2 h-50 w-50 py-1 border border-gray-300 rounded dark:bg-gray-600"},null,544),[[Mt,s.configFile.debug]])])])]),p("tr",null,[Pit,p("td",Uit,[p("div",Fit,[Ae(p("input",{type:"checkbox",id:"enable_gpu",required:"","onUpdate:modelValue":e[21]||(e[21]=h=>s.configFile.enable_gpu=h),onChange:e[22]||(e[22]=h=>r.settingsChanged=!0),class:"m-2 h-50 w-50 py-1 border border-gray-300 rounded dark:bg-gray-600"},null,544),[[Mt,s.configFile.enable_gpu]]),s.configFile.enable_gpu?X("",!0):(M(),L("button",{key:0,onClick:e[23]||(e[23]=Oe((...h)=>s.upgrade2GPU&&s.upgrade2GPU(...h),["prevent"])),class:"w-100 text-center rounded m-2 bg-blue-300 hover:bg-blue-200 text-l hover:text-primary p-2 m-2 text-left flex flex-row"}," Upgrade from CPU to GPU "))])])]),p("tr",null,[Bit,p("td",null,[p("div",Git,[Ae(p("input",{type:"checkbox",id:"auto_save",required:"","onUpdate:modelValue":e[24]||(e[24]=h=>s.configFile.auto_save=h),onChange:e[25]||(e[25]=h=>r.settingsChanged=!0),class:"mt-1 px-2 py-1 border border-gray-300 rounded dark:bg-gray-600"},null,544),[[Mt,s.configFile.auto_save]])])])]),p("tr",null,[zit,p("td",null,[p("div",Vit,[Ae(p("input",{type:"checkbox",id:"auto_update",required:"","onUpdate:modelValue":e[26]||(e[26]=h=>s.configFile.auto_update=h),onChange:e[27]||(e[27]=h=>r.settingsChanged=!0),class:"mt-1 px-2 py-1 border border-gray-300 rounded dark:bg-gray-600"},null,544),[[Mt,s.configFile.auto_update]])])])]),p("tr",null,[Hit,p("td",null,[p("div",qit,[Ae(p("input",{type:"checkbox",id:"auto_title",required:"","onUpdate:modelValue":e[28]||(e[28]=h=>s.configFile.auto_title=h),onChange:e[29]||(e[29]=h=>r.settingsChanged=!0),class:"mt-1 px-2 py-1 border border-gray-300 rounded dark:bg-gray-600"},null,544),[[Mt,s.configFile.auto_title]])])])])])]),_:1}),Le(o,{title:"User",is_subcard:!0,class:"pb-2 m-2"},{default:dt(()=>[p("table",Yit,[p("tr",null,[$it,p("td",Wit,[Ae(p("input",{type:"text",id:"user_name",required:"","onUpdate:modelValue":e[30]||(e[30]=h=>s.configFile.user_name=h),onChange:e[31]||(e[31]=h=>r.settingsChanged=!0),class:"w-full w-full mt-1 px-2 py-1 border border-gray-300 rounded dark:bg-gray-600"},null,544),[[Je,s.configFile.user_name]])])]),p("tr",null,[Kit,p("td",jit,[Ae(p("textarea",{id:"user_description",required:"","onUpdate:modelValue":e[32]||(e[32]=h=>s.configFile.user_description=h),onChange:e[33]||(e[33]=h=>r.settingsChanged=!0),class:"w-full w-full mt-1 px-2 py-1 border border-gray-300 rounded dark:bg-gray-600"},null,544),[[Je,s.configFile.user_description]])])]),p("tr",null,[Qit,p("td",Xit,[Ae(p("input",{type:"checkbox",id:"override_personality_model_parameters",required:"","onUpdate:modelValue":e[34]||(e[34]=h=>s.configFile.override_personality_model_parameters=h),onChange:e[35]||(e[35]=h=>r.settingsChanged=!0),class:"mt-1 px-2 py-1 border border-gray-300 rounded dark:bg-gray-600"},null,544),[[Mt,s.configFile.override_personality_model_parameters]])])]),p("tr",null,[Zit,p("td",Jit,[p("label",ert,[p("img",{src:"/user_infos/"+s.configFile.user_avatar,class:"w-50 h-50 rounded-full",style:{"max-width":"50px","max-height":"50px",cursor:"pointer"}},null,8,trt)]),p("input",{type:"file",id:"avatar-upload",style:{display:"none"},onChange:e[36]||(e[36]=(...h)=>s.uploadAvatar&&s.uploadAvatar(...h))},null,32)])]),p("tr",null,[nrt,p("td",null,[p("div",irt,[Ae(p("input",{type:"checkbox",id:"use_user_name_in_discussions",required:"","onUpdate:modelValue":e[37]||(e[37]=h=>s.configFile.use_user_name_in_discussions=h),onChange:e[38]||(e[38]=h=>r.settingsChanged=!0),class:"mt-1 px-2 py-1 border border-gray-300 rounded dark:bg-gray-600"},null,544),[[Mt,s.configFile.use_user_name_in_discussions]])])])]),p("tr",null,[rrt,p("td",srt,[Ae(p("input",{type:"number",id:"min_n_predict",required:"","onUpdate:modelValue":e[39]||(e[39]=h=>s.configFile.min_n_predict=h),onChange:e[40]||(e[40]=h=>r.settingsChanged=!0),class:"mt-1 px-2 py-1 border border-gray-300 rounded dark:bg-gray-600"},null,544),[[Je,s.configFile.min_n_predict]])])])])]),_:1}),Le(o,{title:"Data Vectorization",is_subcard:!0,class:"pb-2 m-2"},{default:dt(()=>[p("table",ort,[p("tr",null,[art,p("td",null,[p("div",lrt,[Ae(p("input",{type:"checkbox",id:"use_files",required:"","onUpdate:modelValue":e[41]||(e[41]=h=>s.configFile.use_files=h),onChange:e[42]||(e[42]=h=>r.settingsChanged=!0),class:"mt-1 px-2 py-1 border border-gray-300 rounded dark:bg-gray-600"},null,544),[[Mt,s.configFile.use_files]])])])]),p("tr",null,[crt,p("td",null,[p("div",drt,[Ae(p("input",{type:"checkbox",id:"use_discussions_history",required:"","onUpdate:modelValue":e[43]||(e[43]=h=>s.configFile.use_discussions_history=h),onChange:e[44]||(e[44]=h=>r.settingsChanged=!0),class:"mt-1 px-2 py-1 border border-gray-300 rounded dark:bg-gray-600"},null,544),[[Mt,s.configFile.use_discussions_history]])])])]),p("tr",null,[urt,p("td",null,[p("div",_rt,[Ae(p("input",{type:"checkbox",id:"summerize_discussion",required:"","onUpdate:modelValue":e[45]||(e[45]=h=>s.configFile.summerize_discussion=h),onChange:e[46]||(e[46]=h=>r.settingsChanged=!0),class:"mt-1 px-2 py-1 border border-gray-300 rounded dark:bg-gray-600"},null,544),[[Mt,s.configFile.summerize_discussion]])])])]),p("tr",null,[prt,p("td",null,[p("div",hrt,[Ae(p("input",{type:"checkbox",id:"data_vectorization_visualize_on_vectorization",required:"","onUpdate:modelValue":e[47]||(e[47]=h=>s.configFile.data_vectorization_visualize_on_vectorization=h),onChange:e[48]||(e[48]=h=>r.settingsChanged=!0),class:"mt-1 px-2 py-1 border border-gray-300 rounded dark:bg-gray-600"},null,544),[[Mt,s.configFile.data_vectorization_visualize_on_vectorization]])])])]),p("tr",null,[frt,p("td",null,[p("div",mrt,[Ae(p("input",{type:"checkbox",id:"data_vectorization_activate",required:"","onUpdate:modelValue":e[49]||(e[49]=h=>s.configFile.data_vectorization_activate=h),onChange:e[50]||(e[50]=h=>r.settingsChanged=!0),class:"mt-1 px-2 py-1 border border-gray-300 rounded dark:bg-gray-600"},null,544),[[Mt,s.configFile.data_vectorization_activate]])])])]),p("tr",null,[grt,p("td",null,[p("div",Ert,[Ae(p("input",{type:"checkbox",id:"data_vectorization_build_keys_words",required:"","onUpdate:modelValue":e[51]||(e[51]=h=>s.configFile.data_vectorization_build_keys_words=h),onChange:e[52]||(e[52]=h=>r.settingsChanged=!0),class:"mt-1 px-2 py-1 border border-gray-300 rounded dark:bg-gray-600"},null,544),[[Mt,s.configFile.data_vectorization_build_keys_words]])])])]),p("tr",null,[brt,p("td",null,[Ae(p("select",{id:"data_vectorization_method",required:"","onUpdate:modelValue":e[53]||(e[53]=h=>s.configFile.data_vectorization_method=h),onChange:e[54]||(e[54]=h=>r.settingsChanged=!0),class:"w-full mt-1 px-2 py-1 border border-gray-300 rounded dark:bg-gray-600"},vrt,544),[[_i,s.configFile.data_vectorization_method]])])]),p("tr",null,[Trt,p("td",null,[Ae(p("select",{id:"data_visualization_method",required:"","onUpdate:modelValue":e[55]||(e[55]=h=>s.configFile.data_visualization_method=h),onChange:e[56]||(e[56]=h=>r.settingsChanged=!0),class:"w-full mt-1 px-2 py-1 border border-gray-300 rounded dark:bg-gray-600"},Rrt,544),[[_i,s.configFile.data_visualization_method]])])]),p("tr",null,[Art,p("td",null,[p("div",wrt,[Ae(p("input",{type:"checkbox",id:"data_vectorization_save_db",required:"","onUpdate:modelValue":e[57]||(e[57]=h=>s.configFile.data_vectorization_save_db=h),onChange:e[58]||(e[58]=h=>r.settingsChanged=!0),class:"mt-1 px-2 py-1 border border-gray-300 rounded dark:bg-gray-600"},null,544),[[Mt,s.configFile.data_vectorization_save_db]])])])]),p("tr",null,[Ort,p("td",null,[Ae(p("input",{id:"data_vectorization_chunk_size","onUpdate:modelValue":e[59]||(e[59]=h=>s.configFile.data_vectorization_chunk_size=h),onChange:e[60]||(e[60]=h=>r.settingsChanged=!0),type:"range",min:"0",max:"64000",step:"1",class:"flex-none h-2 mt-14 mb-2 w-full bg-gray-200 rounded-lg appearance-none cursor-pointer dark:bg-gray-700 focus:ring-blue-500 focus:border-blue-500 dark:border-gray-600 dark:placeholder-gray-400 dark:focus:ring-blue-500 dark:focus:border-blue-500"},null,544),[[Je,s.configFile.data_vectorization_chunk_size]]),Ae(p("input",{"onUpdate:modelValue":e[61]||(e[61]=h=>s.configFile.data_vectorization_chunk_size=h),type:"number",onChange:e[62]||(e[62]=h=>r.settingsChanged=!0),class:"w-full mt-1 px-2 py-1 border border-gray-300 rounded dark:bg-gray-600"},null,544),[[Je,s.configFile.data_vectorization_chunk_size]])])]),p("tr",null,[Nrt,p("td",null,[Ae(p("input",{id:"data_vectorization_overlap_size","onUpdate:modelValue":e[63]||(e[63]=h=>s.configFile.data_vectorization_overlap_size=h),onChange:e[64]||(e[64]=h=>r.settingsChanged=!0),type:"range",min:"0",max:"64000",step:"1",class:"flex-none h-2 mt-14 mb-2 w-full bg-gray-200 rounded-lg appearance-none cursor-pointer dark:bg-gray-700 focus:ring-blue-500 focus:border-blue-500 dark:border-gray-600 dark:placeholder-gray-400 dark:focus:ring-blue-500 dark:focus:border-blue-500"},null,544),[[Je,s.configFile.data_vectorization_overlap_size]]),Ae(p("input",{"onUpdate:modelValue":e[65]||(e[65]=h=>s.configFile.data_vectorization_overlap_size=h),type:"number",onChange:e[66]||(e[66]=h=>r.settingsChanged=!0),class:"w-full mt-1 px-2 py-1 border border-gray-300 rounded dark:bg-gray-600"},null,544),[[Je,s.configFile.data_vectorization_overlap_size]])])]),p("tr",null,[Mrt,p("td",null,[Ae(p("input",{id:"data_vectorization_nb_chunks","onUpdate:modelValue":e[67]||(e[67]=h=>s.configFile.data_vectorization_nb_chunks=h),onChange:e[68]||(e[68]=h=>r.settingsChanged=!0),type:"range",min:"0",max:"1000",step:"1",class:"flex-none h-2 mt-14 mb-2 w-full bg-gray-200 rounded-lg appearance-none cursor-pointer dark:bg-gray-700 focus:ring-blue-500 focus:border-blue-500 dark:border-gray-600 dark:placeholder-gray-400 dark:focus:ring-blue-500 dark:focus:border-blue-500"},null,544),[[Je,s.configFile.data_vectorization_nb_chunks]]),Ae(p("input",{"onUpdate:modelValue":e[69]||(e[69]=h=>s.configFile.data_vectorization_nb_chunks=h),type:"number",onChange:e[70]||(e[70]=h=>r.settingsChanged=!0),class:"w-full mt-1 px-2 py-1 border border-gray-300 rounded dark:bg-gray-600"},null,544),[[Je,s.configFile.data_vectorization_nb_chunks]])])])])]),_:1}),Le(o,{title:"Audio",is_subcard:!0,class:"pb-2 m-2"},{default:dt(()=>[p("table",Irt,[p("tr",null,[Drt,p("td",null,[p("div",Lrt,[Ae(p("input",{type:"checkbox",id:"audio_auto_send_input",required:"","onUpdate:modelValue":e[71]||(e[71]=h=>s.configFile.audio_auto_send_input=h),onChange:e[72]||(e[72]=h=>r.settingsChanged=!0),class:"mt-1 px-2 py-1 border border-gray-300 rounded dark:bg-gray-600"},null,544),[[Mt,s.configFile.audio_auto_send_input]])])])]),p("tr",null,[krt,p("td",null,[p("div",Prt,[Ae(p("input",{type:"checkbox",id:"auto_speak",required:"","onUpdate:modelValue":e[73]||(e[73]=h=>s.configFile.auto_speak=h),onChange:e[74]||(e[74]=h=>r.settingsChanged=!0),class:"mt-1 px-2 py-1 border border-gray-300 rounded dark:bg-gray-600"},null,544),[[Mt,s.configFile.auto_speak]])])])]),p("tr",null,[Urt,p("td",null,[p("div",Frt,[Ae(p("input",{type:"checkbox",id:"enable_voice_service",required:"","onUpdate:modelValue":e[75]||(e[75]=h=>s.configFile.enable_voice_service=h),onChange:e[76]||(e[76]=h=>r.settingsChanged=!0),class:"mt-1 px-2 py-1 border border-gray-300 rounded dark:bg-gray-600"},null,544),[[Mt,s.configFile.enable_voice_service]])])])]),p("tr",null,[Brt,p("td",null,[p("div",Grt,[Ae(p("select",{"onUpdate:modelValue":e[77]||(e[77]=h=>s.current_voice=h),onChange:e[78]||(e[78]=h=>r.settingsChanged=!0),disabled:!s.enable_voice_service},[(M(!0),L(Xe,null,bt(r.voices,h=>(M(),L("option",{key:h.id,value:h.id},me(h),9,Vrt))),128))],40,zrt),[[_i,s.current_voice]])])])]),p("tr",null,[Hrt,p("td",null,[p("div",qrt,[Ae(p("input",{type:"checkbox",id:"auto_read",required:"","onUpdate:modelValue":e[79]||(e[79]=h=>s.configFile.auto_read=h),onChange:e[80]||(e[80]=h=>r.settingsChanged=!0),class:"mt-1 px-2 py-1 border border-gray-300 rounded dark:bg-gray-600",disabled:!s.enable_voice_service},null,40,Yrt),[[Mt,s.configFile.auto_read]])])])]),p("tr",null,[$rt,p("td",null,[Ae(p("input",{id:"audio_pitch","onUpdate:modelValue":e[81]||(e[81]=h=>s.configFile.audio_pitch=h),onChange:e[82]||(e[82]=h=>r.settingsChanged=!0),type:"range",min:"0",max:"10",step:"0.1",class:"flex-none h-2 mt-14 mb-2 w-full bg-gray-200 rounded-lg appearance-none cursor-pointer dark:bg-gray-700 focus:ring-blue-500 focus:border-blue-500 dark:border-gray-600 dark:placeholder-gray-400 dark:focus:ring-blue-500 dark:focus:border-blue-500"},null,544),[[Je,s.configFile.audio_pitch]]),Ae(p("input",{"onUpdate:modelValue":e[83]||(e[83]=h=>s.configFile.audio_pitch=h),onChange:e[84]||(e[84]=h=>r.settingsChanged=!0),class:"w-full mt-1 px-2 py-1 border border-gray-300 rounded dark:bg-gray-600"},null,544),[[Je,s.configFile.audio_pitch]])])]),p("tr",null,[Wrt,p("td",null,[Ae(p("input",{id:"audio_silenceTimer","onUpdate:modelValue":e[85]||(e[85]=h=>s.configFile.audio_silenceTimer=h),onChange:e[86]||(e[86]=h=>r.settingsChanged=!0),type:"range",min:"0",max:"10000",step:"1",class:"flex-none h-2 mt-14 mb-2 w-full bg-gray-200 rounded-lg appearance-none cursor-pointer dark:bg-gray-700 focus:ring-blue-500 focus:border-blue-500 dark:border-gray-600 dark:placeholder-gray-400 dark:focus:ring-blue-500 dark:focus:border-blue-500"},null,544),[[Je,s.configFile.audio_silenceTimer]]),Ae(p("input",{"onUpdate:modelValue":e[87]||(e[87]=h=>s.configFile.audio_silenceTimer=h),onChange:e[88]||(e[88]=h=>r.settingsChanged=!0),class:"w-full mt-1 px-2 py-1 border border-gray-300 rounded dark:bg-gray-600"},null,544),[[Je,s.configFile.audio_silenceTimer]])])]),p("tr",null,[Krt,p("td",null,[Ae(p("select",{id:"audio_in_language","onUpdate:modelValue":e[89]||(e[89]=h=>s.configFile.audio_in_language=h),onChange:e[90]||(e[90]=h=>r.settingsChanged=!0),class:"w-full mt-1 px-2 py-1 border border-gray-300 rounded dark:bg-gray-600"},[(M(!0),L(Xe,null,bt(s.audioLanguages,h=>(M(),L("option",{key:h.code,value:h.code},me(h.name),9,jrt))),128))],544),[[_i,s.configFile.audio_in_language]])])]),p("tr",null,[Qrt,p("td",null,[Ae(p("select",{id:"audio_out_voice","onUpdate:modelValue":e[91]||(e[91]=h=>s.configFile.audio_out_voice=h),onChange:e[92]||(e[92]=h=>r.settingsChanged=!0),class:"w-full mt-1 px-2 py-1 border border-gray-300 rounded dark:bg-gray-600"},[(M(!0),L(Xe,null,bt(r.audioVoices,h=>(M(),L("option",{key:h.name,value:h.name},me(h.name),9,Xrt))),128))],544),[[_i,s.configFile.audio_out_voice]])])])])]),_:1})])],2)]),p("div",Zrt,[p("div",Jrt,[p("button",{onClick:e[93]||(e[93]=Oe(h=>r.bzc_collapsed=!r.bzc_collapsed,["stop"])),class:"text-2xl hover:text-primary p-2 -m-2 w-full text-left flex flex-row items-center"},[Ae(p("div",null,tst,512),[[At,r.bzc_collapsed]]),Ae(p("div",null,ist,512),[[At,!r.bzc_collapsed]]),rst,s.configFile.binding_name?X("",!0):(M(),L("div",sst,[ost,$e(" No binding selected! ")])),s.configFile.binding_name?(M(),L("div",ast,"|")):X("",!0),s.configFile.binding_name?(M(),L("div",lst,[p("div",cst,[p("img",{src:s.imgBinding,class:"w-8 h-8 rounded-full object-fill text-blue-700"},null,8,dst),p("h3",ust,me(s.binding_name),1)])])):X("",!0)])]),p("div",{class:Ke([{hidden:r.bzc_collapsed},"flex flex-col mb-2 px-3 pb-0"])},[s.bindingsZoo&&s.bindingsZoo.length>0?(M(),L("div",_st,[p("label",pst," Bindings: ("+me(s.bindingsZoo.length)+") ",1),p("div",{class:Ke(["overflow-y-auto no-scrollbar p-2 pb-0 grid lg:grid-cols-3 md:grid-cols-2 gap-4",r.bzl_collapsed?"":"max-h-96"])},[Le(Vr,{name:"list"},{default:dt(()=>[(M(!0),L(Xe,null,bt(s.bindingsZoo,(h,E)=>(M(),Qt(a,{ref_for:!0,ref:"bindingZoo",key:"index-"+E+"-"+h.folder,binding:h,"on-selected":s.onBindingSelected,"on-reinstall":s.onReinstallBinding,"on-unInstall":s.onUnInstallBinding,"on-install":s.onInstallBinding,"on-settings":s.onSettingsBinding,"on-reload-binding":s.onReloadBinding,selected:h.folder===s.configFile.binding_name},null,8,["binding","on-selected","on-reinstall","on-unInstall","on-install","on-settings","on-reload-binding","selected"]))),128))]),_:1})],2)])):X("",!0),r.bzl_collapsed?(M(),L("button",{key:1,class:"text-2xl hover:text-secondary duration-75 flex justify-center hover:bg-bg-light-tone hover:dark:bg-bg-dark-tone rounded-lg",title:"Collapse",type:"button",onClick:e[94]||(e[94]=h=>r.bzl_collapsed=!r.bzl_collapsed)},fst)):(M(),L("button",{key:2,class:"text-2xl hover:text-secondary duration-75 flex justify-center hover:bg-bg-light-tone hover:dark:bg-bg-dark-tone rounded-lg",title:"Expand",type:"button",onClick:e[95]||(e[95]=h=>r.bzl_collapsed=!r.bzl_collapsed)},gst))],2)]),p("div",Est,[p("div",bst,[p("button",{onClick:e[96]||(e[96]=Oe(h=>s.modelsZooToggleCollapse(),["stop"])),class:"text-2xl hover:text-primary p-2 -m-2 w-full text-left flex items-center"},[Ae(p("div",null,yst,512),[[At,r.mzc_collapsed]]),Ae(p("div",null,Tst,512),[[At,!r.mzc_collapsed]]),xst,p("div",Cst,[s.configFile.binding_name?X("",!0):(M(),L("div",Rst,[Ast,$e(" Select binding first! ")])),!r.isModelSelected&&s.configFile.binding_name?(M(),L("div",wst,[Ost,$e(" No model selected! ")])):X("",!0),s.configFile.model_name?(M(),L("div",Nst,"|")):X("",!0),s.configFile.model_name?(M(),L("div",Mst,[p("div",Ist,[p("img",{src:s.imgModel,class:"w-8 h-8 rounded-lg object-fill"},null,8,Dst),p("h3",Lst,me(s.configFile.model_name),1)])])):X("",!0)])])]),p("div",{class:Ke([{hidden:r.mzc_collapsed},"flex flex-col mb-2 px-3 pb-0"])},[p("div",kst,[p("div",Pst,[p("div",Ust,[r.searchModelInProgress?(M(),L("div",Fst,Gst)):X("",!0),r.searchModelInProgress?X("",!0):(M(),L("div",zst,Hst))]),Ae(p("input",{type:"search",class:"block w-full p-4 pl-10 text-sm text-gray-900 border border-gray-300 rounded-lg bg-gray-50 focus:ring-blue-500 focus:border-blue-500 dark:bg-gray-700 dark:border-gray-600 dark:placeholder-gray-400 dark:text-white dark:focus:ring-blue-500 dark:focus:border-blue-500",placeholder:"Search models...",required:"","onUpdate:modelValue":e[97]||(e[97]=h=>r.searchModel=h),onKeyup:e[98]||(e[98]=Fo((...h)=>s.searchModel_func&&s.searchModel_func(...h),["enter"]))},null,544),[[Je,r.searchModel]]),r.searchModel?(M(),L("button",{key:0,onClick:e[99]||(e[99]=Oe(h=>r.searchModel="",["stop"])),type:"button",class:"text-white absolute right-2.5 bottom-2.5 bg-blue-700 hover:bg-blue-800 focus:ring-4 focus:outline-none focus:ring-blue-300 font-medium rounded-lg text-sm px-4 py-2 dark:bg-blue-600 dark:hover:bg-blue-700 dark:focus:ring-blue-800"}," Clear search")):X("",!0)])]),p("div",null,[Ae(p("input",{"onUpdate:modelValue":e[100]||(e[100]=h=>r.show_only_installed_models=h),class:"m-2 p-2",type:"checkbox",ref:"only_installed"},null,512),[[Mt,r.show_only_installed_models]]),qst]),p("div",null,[Le(l,{radioOptions:r.sortOptions,onRadioSelected:s.handleRadioSelected},null,8,["radioOptions","onRadioSelected"])]),Yst,r.is_loading_zoo?(M(),L("div",$st,jst)):X("",!0),r.models_zoo&&r.models_zoo.length>0?(M(),L("div",Qst,[p("label",Xst," Models: ("+me(r.models_zoo.length)+") ",1),p("div",{class:Ke(["overflow-y-auto p-2 pb-0 grid lg:grid-cols-3 md:grid-cols-2 gap-4 overflow-y-scroll w-full dark:bg-bg-dark scrollbar-thin scrollbar-track-bg-light-tone scrollbar-thumb-bg-light-tone-panel hover:scrollbar-thumb-primary dark:scrollbar-track-bg-dark-tone dark:scrollbar-thumb-bg-dark-tone-panel dark:hover:scrollbar-thumb-primary active:scrollbar-thumb-secondary",r.mzl_collapsed?"":"max-h-96"])},[Le(Vr,{name:"list"},{default:dt(()=>[(M(!0),L(Xe,null,bt(s.rendered_models_zoo,(h,E)=>(M(),Qt(c,{ref_for:!0,ref:"modelZoo",key:"index-"+E+"-"+h.name,model:h,"is-installed":h.isInstalled,"on-install":s.onInstall,"on-uninstall":s.onUninstall,"on-selected":s.onModelSelected,selected:h.name===s.configFile.model_name,model_type:h.model_type,"on-copy":s.onCopy,"on-copy-link":s.onCopyLink,"on-cancel-install":s.onCancelInstall},null,8,["model","is-installed","on-install","on-uninstall","on-selected","selected","model_type","on-copy","on-copy-link","on-cancel-install"]))),128)),p("button",{ref:"load_more_models",class:"relative items-start p-4 hover:bg-primary-light rounded-lg mb-2 shadow-lg border-2 select-none",onClick:e[101]||(e[101]=(...h)=>s.load_more_models&&s.load_more_models(...h))},"Load more models",512)]),_:1})],2)])):X("",!0),r.mzl_collapsed?(M(),L("button",{key:2,class:"text-2xl hover:text-secondary duration-75 flex justify-center hover:bg-bg-light-tone hover:dark:bg-bg-dark-tone rounded-lg",title:"Collapse",type:"button",onClick:e[102]||(e[102]=(...h)=>s.open_mzl&&s.open_mzl(...h))},Jst)):(M(),L("button",{key:3,class:"text-2xl hover:text-secondary duration-75 flex justify-center hover:bg-bg-light-tone hover:dark:bg-bg-dark-tone rounded-lg",title:"Expand",type:"button",onClick:e[103]||(e[103]=(...h)=>s.open_mzl&&s.open_mzl(...h))},tot))],2)]),p("div",not,[p("div",iot,[p("button",{onClick:e[104]||(e[104]=Oe(h=>r.mzdc_collapsed=!r.mzdc_collapsed,["stop"])),class:"text-2xl hover:text-primary p-2 -m-2 w-full text-left flex items-center"},[Ae(p("div",null,sot,512),[[At,r.mzdc_collapsed]]),Ae(p("div",null,aot,512),[[At,!r.mzdc_collapsed]]),lot,s.binding_name?X("",!0):(M(),L("div",cot,[dot,$e(" No binding selected! ")])),s.configFile.binding_name?(M(),L("div",uot,"|")):X("",!0),s.configFile.binding_name?(M(),L("div",_ot,[p("div",pot,[p("img",{src:s.imgBinding,class:"w-8 h-8 rounded-full object-fill text-blue-700"},null,8,hot),p("h3",fot,me(s.binding_name),1)])])):X("",!0)])]),p("div",{class:Ke([{hidden:r.mzdc_collapsed},"flex flex-col mb-2 px-3 pb-0"])},[p("div",mot,[p("div",got,[p("div",null,[p("div",Eot,[bot,Ae(p("input",{type:"text","onUpdate:modelValue":e[105]||(e[105]=h=>r.reference_path=h),class:"bg-gray-50 border border-gray-300 text-gray-900 text-sm rounded-lg focus:ring-blue-500 focus:border-blue-500 block w-full p-2.5 dark:bg-gray-700 dark:border-gray-600 dark:placeholder-gray-400 dark:text-white dark:focus:ring-blue-500 dark:focus:border-blue-500",placeholder:"Enter Path ...",required:""},null,512),[[Je,r.reference_path]])]),p("button",{type:"button",onClick:e[106]||(e[106]=Oe(h=>s.onCreateReference(),["stop"])),class:"text-white bg-blue-700 hover:bg-blue-800 focus:ring-4 focus:outline-none focus:ring-blue-300 font-medium rounded-lg text-sm w-full sm:w-auto px-5 py-2.5 text-center dark:bg-blue-600 dark:hover:bg-blue-700 dark:focus:ring-blue-800"},"Add reference")]),r.modelDownlaodInProgress?X("",!0):(M(),L("div",Sot,[p("div",yot,[vot,Ae(p("input",{type:"text","onUpdate:modelValue":e[107]||(e[107]=h=>r.addModel.url=h),class:"bg-gray-50 border border-gray-300 text-gray-900 text-sm rounded-lg focus:ring-blue-500 focus:border-blue-500 block w-full p-2.5 dark:bg-gray-700 dark:border-gray-600 dark:placeholder-gray-400 dark:text-white dark:focus:ring-blue-500 dark:focus:border-blue-500",placeholder:"Enter URL ...",required:""},null,512),[[Je,r.addModel.url]])]),p("button",{type:"button",onClick:e[108]||(e[108]=Oe(h=>s.onInstallAddModel(),["stop"])),class:"text-white bg-blue-700 hover:bg-blue-800 focus:ring-4 focus:outline-none focus:ring-blue-300 font-medium rounded-lg text-sm w-full sm:w-auto px-5 py-2.5 text-center dark:bg-blue-600 dark:hover:bg-blue-700 dark:focus:ring-blue-800"},"Download")])),r.modelDownlaodInProgress?(M(),L("div",Tot,[xot,p("div",Cot,[p("div",Rot,[p("div",Aot,[wot,p("span",Oot,me(Math.floor(r.addModel.progress))+"%",1)]),p("div",{class:"mx-1 opacity-80 line-clamp-1",title:r.addModel.url},me(r.addModel.url),9,Not),p("div",Mot,[p("div",{class:"bg-blue-600 h-2.5 rounded-full",style:un({width:r.addModel.progress+"%"})},null,4)]),p("div",Iot,[p("span",Dot,"Download speed: "+me(s.speed_computed)+"/s",1),p("span",Lot,me(s.downloaded_size_computed)+"/"+me(s.total_size_computed),1)])])]),p("div",kot,[p("div",Pot,[p("div",Uot,[p("button",{onClick:e[109]||(e[109]=Oe((...h)=>s.onCancelInstall&&s.onCancelInstall(...h),["stop"])),type:"button",title:"Cancel download",class:"text-gray-500 bg-white hover:bg-gray-100 focus:ring-4 focus:outline-none focus:ring-gray-200 rounded-lg border border-gray-200 text-sm font-medium px-5 py-2.5 hover:text-gray-900 focus:z-10 dark:bg-gray-700 dark:text-gray-300 dark:border-gray-500 dark:hover:text-white dark:hover:bg-gray-600 dark:focus:ring-gray-600"}," Cancel ")])])])])):X("",!0)])])],2)]),p("div",Fot,[p("div",Bot,[p("button",{onClick:e[111]||(e[111]=Oe(h=>r.pzc_collapsed=!r.pzc_collapsed,["stop"])),class:"text-2xl hover:text-primary p-2 -m-2 text-left w-full flex items-center"},[Ae(p("div",null,zot,512),[[At,r.pzc_collapsed]]),Ae(p("div",null,Hot,512),[[At,!r.pzc_collapsed]]),qot,s.configFile.personalities?(M(),L("div",Yot,"|")):X("",!0),p("div",$ot,me(s.active_pesonality),1),s.configFile.personalities?(M(),L("div",Wot,"|")):X("",!0),s.configFile.personalities?(M(),L("div",Kot,[s.mountedPersArr.length>0?(M(),L("div",jot,[(M(!0),L(Xe,null,bt(s.mountedPersArr,(h,E)=>(M(),L("div",{class:"relative hover:-translate-y-2 duration-300 hover:z-10 shrink-0",key:E+"-"+h.name,ref_for:!0,ref:"mountedPersonalities"},[p("div",Qot,[p("button",{onClick:Oe(g=>s.onPersonalitySelected(h),["stop"])},[p("img",{src:r.bUrl+h.avatar,onError:e[110]||(e[110]=(...g)=>s.personalityImgPlacehodler&&s.personalityImgPlacehodler(...g)),class:Ke(["w-8 h-8 rounded-full object-fill text-red-700 border-2 active:scale-90 group-hover:border-secondary",s.configFile.active_personality_id==s.configFile.personalities.indexOf(h.full_path)?"border-secondary":"border-transparent z-0"]),title:h.name},null,42,Zot)],8,Xot),p("button",{onClick:Oe(g=>s.unmountPersonality(h),["stop"])},tat,8,Jot)])]))),128))])):X("",!0)])):X("",!0)])]),p("div",{class:Ke([{hidden:r.pzc_collapsed},"flex flex-col mb-2 px-3 pb-0"])},[p("div",nat,[iat,p("div",rat,[p("div",sat,[r.searchPersonalityInProgress?(M(),L("div",oat,lat)):X("",!0),r.searchPersonalityInProgress?X("",!0):(M(),L("div",cat,uat))]),Ae(p("input",{type:"search",id:"personality-search",class:"block w-full p-4 pl-10 text-sm text-gray-900 border border-gray-300 rounded-lg bg-gray-50 focus:ring-blue-500 focus:border-blue-500 dark:bg-gray-700 dark:border-gray-600 dark:placeholder-gray-400 dark:text-white dark:focus:ring-blue-500 dark:focus:border-blue-500",placeholder:"Search personality...",required:"","onUpdate:modelValue":e[112]||(e[112]=h=>r.searchPersonality=h),onKeyup:e[113]||(e[113]=Oe((...h)=>s.searchPersonality_func&&s.searchPersonality_func(...h),["stop"]))},null,544),[[Je,r.searchPersonality]]),r.searchPersonality?(M(),L("button",{key:0,onClick:e[114]||(e[114]=Oe(h=>r.searchPersonality="",["stop"])),type:"button",class:"text-white absolute right-2.5 bottom-2.5 bg-blue-700 hover:bg-blue-800 focus:ring-4 focus:outline-none focus:ring-blue-300 font-medium rounded-lg text-sm px-4 py-2 dark:bg-blue-600 dark:hover:bg-blue-700 dark:focus:ring-blue-800"}," Clear search")):X("",!0)])]),r.searchPersonality?X("",!0):(M(),L("div",_at,[p("label",pat," Personalities Category: ("+me(r.persCatgArr.length)+") ",1),p("select",{id:"persCat",onChange:e[115]||(e[115]=h=>s.update_personality_category(h.target.value,s.refresh)),class:"bg-gray-50 border border-gray-300 text-gray-900 text-sm rounded-lg focus:ring-blue-500 focus:border-blue-500 block w-full p-2.5 dark:bg-gray-700 dark:border-gray-600 dark:placeholder-gray-400 dark:text-white dark:focus:ring-blue-500 dark:focus:border-blue-500"},[(M(!0),L(Xe,null,bt(r.persCatgArr,(h,E)=>(M(),L("option",{key:E,selected:h==this.configFile.personality_category},me(h),9,hat))),128))],32)])),p("div",null,[r.personalitiesFiltered.length>0?(M(),L("div",fat,[p("label",mat,me(r.searchPersonality?"Search results":"Personalities")+": ("+me(r.personalitiesFiltered.length)+") ",1),p("div",{class:Ke(["overflow-y-auto no-scrollbar p-2 pb-0 grid lg:grid-cols-3 md:grid-cols-2 gap-4",r.pzl_collapsed?"":"max-h-96"])},[Le(Vr,{name:"bounce"},{default:dt(()=>[(M(!0),L(Xe,null,bt(r.personalitiesFiltered,(h,E)=>(M(),Qt(d,{ref_for:!0,ref:"personalitiesZoo",key:"index-"+E+"-"+h.name,personality:h,select_language:!0,full_path:h.full_path,selected:s.configFile.active_personality_id==s.configFile.personalities.findIndex(g=>g===h.full_path||g===h.full_path+":"+h.language),"on-selected":s.onPersonalitySelected,"on-mount":s.mountPersonality,"on-un-mount":s.unmountPersonality,"on-remount":s.remountPersonality,"on-reinstall":s.onPersonalityReinstall,"on-settings":s.onSettingsPersonality,"on-copy-personality-name":s.onCopyPersonalityName},null,8,["personality","full_path","selected","on-selected","on-mount","on-un-mount","on-remount","on-reinstall","on-settings","on-copy-personality-name"]))),128))]),_:1})],2)])):X("",!0)]),r.pzl_collapsed?(M(),L("button",{key:1,class:"text-2xl hover:text-secondary duration-75 flex justify-center hover:bg-bg-light-tone hover:dark:bg-bg-dark-tone rounded-lg",title:"Collapse",type:"button",onClick:e[116]||(e[116]=h=>r.pzl_collapsed=!r.pzl_collapsed)},Eat)):(M(),L("button",{key:2,class:"text-2xl hover:text-secondary duration-75 flex justify-center hover:bg-bg-light-tone hover:dark:bg-bg-dark-tone rounded-lg",title:"Expand",type:"button",onClick:e[117]||(e[117]=h=>r.pzl_collapsed=!r.pzl_collapsed)},Sat))],2)]),p("div",yat,[p("div",vat,[p("button",{onClick:e[119]||(e[119]=Oe(h=>r.ezc_collapsed=!r.ezc_collapsed,["stop"])),class:"text-2xl hover:text-primary p-2 -m-2 text-left w-full flex items-center"},[Ae(p("div",null,xat,512),[[At,r.ezc_collapsed]]),Ae(p("div",null,Rat,512),[[At,!r.ezc_collapsed]]),Aat,s.configFile.extensions?(M(),L("div",wat,"|")):X("",!0),s.configFile.extensions?(M(),L("div",Oat,[s.mountedExtensions.length>0?(M(),L("div",Nat,[(M(!0),L(Xe,null,bt(s.mountedExtensions,(h,E)=>(M(),L("div",{class:"relative hover:-translate-y-2 duration-300 hover:z-10 shrink-0",key:E+"-"+h.name,ref_for:!0,ref:"mountedExtensions"},[p("div",Mat,[p("button",null,[p("img",{src:r.bUrl+h.avatar,onError:e[118]||(e[118]=(...g)=>s.extensionImgPlacehodler&&s.extensionImgPlacehodler(...g)),class:Ke(["w-8 h-8 rounded-full object-fill text-red-700 border-2 active:scale-90 group-hover:border-secondary","border-transparent z-0"]),title:h.name},null,40,Iat)]),p("button",{onClick:Oe(g=>s.unmountExtension(h),["stop"])},kat,8,Dat)])]))),128))])):X("",!0)])):X("",!0)])]),p("div",{class:Ke([{hidden:r.ezc_collapsed},"flex flex-col mb-2 px-3 pb-0"])},[p("div",Pat,[Uat,p("div",Fat,[p("div",Bat,[r.searchExtensionInProgress?(M(),L("div",Gat,Vat)):X("",!0),r.searchExtensionInProgress?X("",!0):(M(),L("div",Hat,Yat))]),Ae(p("input",{type:"search",id:"personality-search",class:"block w-full p-4 pl-10 text-sm text-gray-900 border border-gray-300 rounded-lg bg-gray-50 focus:ring-blue-500 focus:border-blue-500 dark:bg-gray-700 dark:border-gray-600 dark:placeholder-gray-400 dark:text-white dark:focus:ring-blue-500 dark:focus:border-blue-500",placeholder:"Search extension...",required:"","onUpdate:modelValue":e[120]||(e[120]=h=>r.searchExtension=h),onKeyup:e[121]||(e[121]=Oe((...h)=>n.searchExtension_func&&n.searchExtension_func(...h),["stop"]))},null,544),[[Je,r.searchExtension]]),r.searchExtension?(M(),L("button",{key:0,onClick:e[122]||(e[122]=Oe(h=>r.searchExtension="",["stop"])),type:"button",class:"text-white absolute right-2.5 bottom-2.5 bg-blue-700 hover:bg-blue-800 focus:ring-4 focus:outline-none focus:ring-blue-300 font-medium rounded-lg text-sm px-4 py-2 dark:bg-blue-600 dark:hover:bg-blue-700 dark:focus:ring-blue-800"}," Clear search")):X("",!0)])]),r.searchExtension?X("",!0):(M(),L("div",$at,[p("label",Wat," Extensions Category: ("+me(r.extCatgArr.length)+") ",1),p("select",{id:"extCat",onChange:e[123]||(e[123]=h=>s.update_extension_category(h.target.value,s.refresh)),class:"bg-gray-50 border border-gray-300 text-gray-900 text-sm rounded-lg focus:ring-blue-500 focus:border-blue-500 block w-full p-2.5 dark:bg-gray-700 dark:border-gray-600 dark:placeholder-gray-400 dark:text-white dark:focus:ring-blue-500 dark:focus:border-blue-500"},[(M(!0),L(Xe,null,bt(r.extCatgArr,(h,E)=>(M(),L("option",{key:E,selected:h==this.extension_category},me(h),9,Kat))),128))],32)])),p("div",null,[r.extensionsFiltererd.length>0?(M(),L("div",jat,[p("label",Qat,me(r.searchExtension?"Search results":"Personalities")+": ("+me(r.extensionsFiltererd.length)+") ",1),p("div",{class:Ke(["overflow-y-auto no-scrollbar p-2 pb-0 grid lg:grid-cols-3 md:grid-cols-2 gap-4",r.ezl_collapsed?"":"max-h-96"])},[(M(!0),L(Xe,null,bt(r.extensionsFiltererd,(h,E)=>(M(),Qt(u,{ref_for:!0,ref:"extensionsZoo",key:"index-"+E+"-"+h.name,extension:h,select_language:!0,full_path:h.full_path,"on-mount":s.mountExtension,"on-un-mount":s.unmountExtension,"on-remount":s.remountExtension,"on-reinstall":s.onExtensionReinstall,"on-settings":s.onSettingsExtension},null,8,["extension","full_path","on-mount","on-un-mount","on-remount","on-reinstall","on-settings"]))),128))],2)])):X("",!0)]),r.ezc_collapsed?(M(),L("button",{key:1,class:"text-2xl hover:text-secondary duration-75 flex justify-center hover:bg-bg-light-tone hover:dark:bg-bg-dark-tone rounded-lg",title:"Collapse",type:"button",onClick:e[124]||(e[124]=h=>r.ezl_collapsed=!r.ezl_collapsed)},Zat)):(M(),L("button",{key:2,class:"text-2xl hover:text-secondary duration-75 flex justify-center hover:bg-bg-light-tone hover:dark:bg-bg-dark-tone rounded-lg",title:"Expand",type:"button",onClick:e[125]||(e[125]=h=>r.ezl_collapsed=!r.ezl_collapsed)},elt))],2)]),p("div",tlt,[p("div",nlt,[p("button",{onClick:e[126]||(e[126]=Oe(h=>r.mep_collapsed=!r.mep_collapsed,["stop"])),class:"text-2xl hover:text-primary p-2 -m-2 text-left w-full flex items-center"},[Ae(p("div",null,rlt,512),[[At,r.mep_collapsed]]),Ae(p("div",null,olt,512),[[At,!r.mep_collapsed]]),alt])]),p("div",{class:Ke([{hidden:r.mep_collapsed},"flex flex-col mb-2 px-3 pb-0"])},null,2)]),p("div",llt,[p("div",clt,[p("button",{onClick:e[127]||(e[127]=Oe(h=>r.mc_collapsed=!r.mc_collapsed,["stop"])),class:"text-2xl hover:text-primary p-2 -m-2 w-full text-left flex items-center"},[Ae(p("div",null,ult,512),[[At,r.mc_collapsed]]),Ae(p("div",null,plt,512),[[At,!r.mc_collapsed]]),hlt])]),p("div",{class:Ke([{hidden:r.mc_collapsed},"flex flex-col mb-2 p-2"])},[p("div",flt,[p("div",mlt,[Ae(p("input",{id:"override-model-parameters",type:"checkbox",class:"w-4 h-4 text-blue-600 bg-gray-100 border-gray-300 rounded focus:ring-blue-500 dark:focus:ring-blue-600 dark:ring-offset-gray-700 dark:focus:ring-offset-gray-700 focus:ring-2 dark:bg-gray-600 dark:border-gray-500",onClick:e[128]||(e[128]=Oe(()=>{},["stop"])),"onUpdate:modelValue":e[129]||(e[129]=h=>s.configFile.override_personality_model_parameters=h),onChange:e[130]||(e[130]=h=>s.update_setting("override_personality_model_parameters",s.configFile.override_personality_model_parameters))},null,544),[[Mt,s.configFile.override_personality_model_parameters]]),glt])]),p("div",{class:Ke(s.configFile.override_personality_model_parameters?"":"pointer-events-none opacity-30")},[p("div",Elt,[blt,Ae(p("input",{type:"text",id:"seed","onUpdate:modelValue":e[131]||(e[131]=h=>s.configFile.seed=h),class:"bg-gray-50 border border-gray-300 text-sm rounded-lg focus:ring-blue-500 focus:border-blue-500 block w-full p-2.5 dark:bg-gray-700 dark:border-gray-600 dark:placeholder-gray-400 dark:focus:ring-blue-500 dark:focus:border-blue-500"},null,512),[[Je,s.configFile.seed]])]),p("div",Slt,[p("div",ylt,[p("div",vlt,[Tlt,p("p",xlt,[Ae(p("input",{type:"text",id:"temp-val","onUpdate:modelValue":e[132]||(e[132]=h=>s.configFile.temperature=h),onChange:e[133]||(e[133]=h=>r.settingsChanged=!0),class:"mt-2 w-16 text-right p-2 border border-gray-300 rounded-lg bg-gray-50 sm:text-xs focus:ring-blue-500 focus:border-blue-500 dark:bg-gray-700 dark:border-gray-600 dark:placeholder-gray-400 dark:focus:ring-blue-500 dark:focus:border-blue-500"},null,544),[[Je,s.configFile.temperature]])])]),Ae(p("input",{id:"temperature",onChange:e[134]||(e[134]=h=>r.settingsChanged=!0),type:"range","onUpdate:modelValue":e[135]||(e[135]=h=>s.configFile.temperature=h),min:"0",max:"5",step:"0.1",class:"flex-none h-2 mt-14 mb-2 w-full bg-gray-200 rounded-lg appearance-none cursor-pointer dark:bg-gray-700 focus:ring-blue-500 focus:border-blue-500 dark:border-gray-600 dark:placeholder-gray-400 dark:focus:ring-blue-500 dark:focus:border-blue-500"},null,544),[[Je,s.configFile.temperature]])])]),p("div",Clt,[p("div",Rlt,[p("div",Alt,[wlt,p("p",Olt,[Ae(p("input",{type:"text",id:"predict-val","onUpdate:modelValue":e[136]||(e[136]=h=>s.configFile.n_predict=h),onChange:e[137]||(e[137]=h=>r.settingsChanged=!0),class:"mt-2 w-16 text-right p-2 border border-gray-300 rounded-lg bg-gray-50 sm:text-xs focus:ring-blue-500 focus:border-blue-500 dark:bg-gray-700 dark:border-gray-600 dark:placeholder-gray-400 dark:focus:ring-blue-500 dark:focus:border-blue-500"},null,544),[[Je,s.configFile.n_predict]])])]),Ae(p("input",{id:"predict",type:"range",onChange:e[138]||(e[138]=h=>r.settingsChanged=!0),"onUpdate:modelValue":e[139]||(e[139]=h=>s.configFile.n_predict=h),min:"0",max:"2048",step:"32",class:"flex-none h-2 mt-14 mb-2 w-full bg-gray-200 rounded-lg appearance-none cursor-pointer dark:bg-gray-700 focus:ring-blue-500 focus:border-blue-500 dark:border-gray-600 dark:placeholder-gray-400 dark:focus:ring-blue-500 dark:focus:border-blue-500"},null,544),[[Je,s.configFile.n_predict]])])]),p("div",Nlt,[p("div",Mlt,[p("div",Ilt,[Dlt,p("p",Llt,[Ae(p("input",{type:"text",id:"top_k-val","onUpdate:modelValue":e[140]||(e[140]=h=>s.configFile.top_k=h),onChange:e[141]||(e[141]=h=>r.settingsChanged=!0),class:"mt-2 w-16 text-right p-2 border border-gray-300 rounded-lg bg-gray-50 sm:text-xs focus:ring-blue-500 focus:border-blue-500 dark:bg-gray-700 dark:border-gray-600 dark:placeholder-gray-400 dark:focus:ring-blue-500 dark:focus:border-blue-500"},null,544),[[Je,s.configFile.top_k]])])]),Ae(p("input",{id:"top_k",type:"range",onChange:e[142]||(e[142]=h=>r.settingsChanged=!0),"onUpdate:modelValue":e[143]||(e[143]=h=>s.configFile.top_k=h),min:"0",max:"100",step:"1",class:"flex-none h-2 mt-14 mb-2 w-full bg-gray-200 rounded-lg appearance-none cursor-pointer dark:bg-gray-700 focus:ring-blue-500 focus:border-blue-500 dark:border-gray-600 dark:placeholder-gray-400 dark:focus:ring-blue-500 dark:focus:border-blue-500"},null,544),[[Je,s.configFile.top_k]])])]),p("div",klt,[p("div",Plt,[p("div",Ult,[Flt,p("p",Blt,[Ae(p("input",{type:"text",id:"top_p-val","onUpdate:modelValue":e[144]||(e[144]=h=>s.configFile.top_p=h),onChange:e[145]||(e[145]=h=>r.settingsChanged=!0),class:"mt-2 w-16 text-right p-2 border border-gray-300 rounded-lg bg-gray-50 sm:text-xs focus:ring-blue-500 focus:border-blue-500 dark:bg-gray-700 dark:border-gray-600 dark:placeholder-gray-400 dark:focus:ring-blue-500 dark:focus:border-blue-500"},null,544),[[Je,s.configFile.top_p]])])]),Ae(p("input",{id:"top_p",type:"range","onUpdate:modelValue":e[146]||(e[146]=h=>s.configFile.top_p=h),min:"0",max:"1",step:"0.01",onChange:e[147]||(e[147]=h=>r.settingsChanged=!0),class:"flex-none h-2 mt-14 mb-2 w-full bg-gray-200 rounded-lg appearance-none cursor-pointer dark:bg-gray-700 focus:ring-blue-500 focus:border-blue-500 dark:border-gray-600 dark:placeholder-gray-400 dark:focus:ring-blue-500 dark:focus:border-blue-500"},null,544),[[Je,s.configFile.top_p]])])]),p("div",Glt,[p("div",zlt,[p("div",Vlt,[Hlt,p("p",qlt,[Ae(p("input",{type:"text",id:"repeat_penalty-val","onUpdate:modelValue":e[148]||(e[148]=h=>s.configFile.repeat_penalty=h),onChange:e[149]||(e[149]=h=>r.settingsChanged=!0),class:"mt-2 w-16 text-right p-2 border border-gray-300 rounded-lg bg-gray-50 sm:text-xs focus:ring-blue-500 focus:border-blue-500 dark:bg-gray-700 dark:border-gray-600 dark:placeholder-gray-400 dark:focus:ring-blue-500 dark:focus:border-blue-500"},null,544),[[Je,s.configFile.repeat_penalty]])])]),Ae(p("input",{id:"repeat_penalty",onChange:e[150]||(e[150]=h=>r.settingsChanged=!0),type:"range","onUpdate:modelValue":e[151]||(e[151]=h=>s.configFile.repeat_penalty=h),min:"0",max:"2",step:"0.01",class:"flex-none h-2 mt-14 mb-2 w-full bg-gray-200 rounded-lg appearance-none cursor-pointer dark:bg-gray-700 focus:ring-blue-500 focus:border-blue-500 dark:border-gray-600 dark:placeholder-gray-400 dark:focus:ring-blue-500 dark:focus:border-blue-500"},null,544),[[Je,s.configFile.repeat_penalty]])])]),p("div",Ylt,[p("div",$lt,[p("div",Wlt,[Klt,p("p",jlt,[Ae(p("input",{type:"text",id:"repeat_last_n-val","onUpdate:modelValue":e[152]||(e[152]=h=>s.configFile.repeat_last_n=h),onChange:e[153]||(e[153]=h=>r.settingsChanged=!0),class:"mt-2 w-16 text-right p-2 border border-gray-300 rounded-lg bg-gray-50 sm:text-xs focus:ring-blue-500 focus:border-blue-500 dark:bg-gray-700 dark:border-gray-600 dark:placeholder-gray-400 dark:focus:ring-blue-500 dark:focus:border-blue-500"},null,544),[[Je,s.configFile.repeat_last_n]])])]),Ae(p("input",{id:"repeat_last_n",type:"range","onUpdate:modelValue":e[154]||(e[154]=h=>s.configFile.repeat_last_n=h),min:"0",max:"100",step:"1",onChange:e[155]||(e[155]=h=>r.settingsChanged=!0),class:"flex-none h-2 mt-14 mb-2 w-full bg-gray-200 rounded-lg appearance-none cursor-pointer dark:bg-gray-700 focus:ring-blue-500 focus:border-blue-500 dark:border-gray-600 dark:placeholder-gray-400 dark:focus:ring-blue-500 dark:focus:border-blue-500"},null,544),[[Je,s.configFile.repeat_last_n]])])])],2)],2)])],2)]),Le(_,{ref:"addmodeldialog"},null,512),Le(f,{class:"z-20",show:r.variantSelectionDialogVisible,choices:r.variant_choices,onChoiceSelected:s.onVariantChoiceSelected,onCloseDialog:s.oncloseVariantChoiceDialog,onChoiceValidated:s.onvalidateVariantChoice},null,8,["show","choices","onChoiceSelected","onCloseDialog","onChoiceValidated"])],64)}const Xlt=ft(Ktt,[["render",Qlt],["__scopeId","data-v-8ad66bce"]]),Zlt={components:{ClipBoardTextInput:_E,Card:Ll},data(){return{dataset_path:"",max_length:1024,batch_size:4,lr:5e-5,num_epochs:2,selectedFolder:"",selectedDataset:""}},methods:{submitForm(){const n={model_name:this.selectedModel,dataset_file:this.selectedDataset,max_length:this.max_length,batch_size:this.batch_size,lr:this.lr,num_epochs:this.num_epochs,output_dir:this.selectedFolder};Pe.post("/start_training",n).then(e=>{})},openFolderSelector(){this.$refs.folder_selector.click()},selectOutputDirectory(n){var t;console.log("here");const e=(t=n.target.files[0])==null?void 0:t.path;console.log(e),e&&(this.selectedFolder=e)},selectDataset(n){const e=n.target.files;e.length>0&&(this.selectedDataset=e[0])}},computed:{selectedModel:{get(){return this.$store.state.selectedModel}},models:{get(){return this.$store.state.modelsArr}}},watch:{model_name(n){console.log("watching model_name",n),this.$refs.clipboardInput.inputValue=n}}},Jlt={key:0,class:"container overflow-y-scroll flex flex-col no-scrollbar shadow-lg p-10 pt-2 bg-bg-light-tone dark:bg-bg-dark-tone"},ect={class:"mb-4"},tct=p("label",{for:"model_name",class:"text-sm"},"Model Name:",-1),nct=["value"],ict={class:"mb-4"},rct=p("label",{for:"dataset_path",class:"text-sm"},"Dataset:",-1),sct={class:"mb-4"},oct=p("label",{for:"lr",class:"text-sm"},"Learning Rate:",-1),act={class:"mb-4"},lct=p("label",{for:"num_epochs",class:"text-sm"},"Number of Epochs:",-1),cct={class:"mb-4"},dct=p("label",{for:"max_length",class:"text-sm"},"Max Length:",-1),uct={class:"mb-4"},_ct=p("label",{for:"batch_size",class:"text-sm"},"Batch Size:",-1),pct={class:"mb-4"},hct=p("label",{for:"output_dir",class:"text-sm"},"Output Directory:",-1),fct=p("button",{class:"bg-blue-500 text-white px-4 py-2 rounded"},"Start training",-1),mct={key:1};function gct(n,e,t,i,r,s){const o=St("Card"),a=St("ClipBoardTextInput");return s.selectedModel!==null&&s.selectedModel.toLowerCase().includes("gptq")?(M(),L("div",Jlt,[p("form",{onSubmit:e[2]||(e[2]=Oe((...l)=>s.submitForm&&s.submitForm(...l),["prevent"])),class:""},[Le(o,{title:"Training configuration",isHorizontal:!0,disableHoverAnimation:!0,disableFocus:!0},{default:dt(()=>[Le(o,{title:"Model",class:"",isHorizontal:!1},{default:dt(()=>[p("div",ect,[tct,Ae(p("select",{"onUpdate:modelValue":e[0]||(e[0]=l=>s.selectedModel=l),onChange:e[1]||(e[1]=(...l)=>n.setModel&&n.setModel(...l)),class:"bg-white dark:bg-black m-0 border-2 rounded-md shadow-sm w-full"},[(M(!0),L(Xe,null,bt(s.models,l=>(M(),L("option",{key:l,value:l},me(l),9,nct))),128))],544),[[_i,s.selectedModel]])])]),_:1}),Le(o,{title:"Data",isHorizontal:!1},{default:dt(()=>[p("div",ict,[rct,Le(a,{id:"model_path",inputType:"file",value:r.dataset_path,onchange:"selectDataset()"},null,8,["value"])])]),_:1}),Le(o,{title:"Training",isHorizontal:!1},{default:dt(()=>[p("div",sct,[oct,Le(a,{id:"model_path",inputType:"integer",value:r.lr},null,8,["value"])]),p("div",act,[lct,Le(a,{id:"model_path",inputType:"integer",value:r.num_epochs},null,8,["value"])]),p("div",cct,[dct,Le(a,{id:"model_path",inputType:"integer",value:r.max_length},null,8,["value"])]),p("div",uct,[_ct,Le(a,{id:"model_path",inputType:"integer",value:r.batch_size},null,8,["value"])])]),_:1}),Le(o,{title:"Output",isHorizontal:!1},{default:dt(()=>[p("div",pct,[hct,Le(a,{id:"model_path",inputType:"text",value:n.output_dir},null,8,["value"])])]),_:1})]),_:1}),Le(o,{disableHoverAnimation:!0,disableFocus:!0},{default:dt(()=>[fct]),_:1})],32)])):(M(),L("div",mct,[Le(o,{title:"Info",class:"",isHorizontal:!1},{default:dt(()=>[$e(" Only GPTQ models are supported for QLora fine tuning. Please select a GPTQ compatible binding. ")]),_:1})]))}const Ect=ft(Zlt,[["render",gct]]),bct={components:{ClipBoardTextInput:_E,Card:Ll},data(){return{model_name:"jondurbin/airoboros-7b-gpt4",tokenizer_name:"jondurbin/airoboros-7b-gpt4",dataset_path:"",max_length:1024,batch_size:4,lr:5e-5,num_epochs:2,selectedFolder:"",selectedDatasetPath:""}},methods:{submitForm(){this.model_name,this.tokenizer_name,this.selectedDatasetPath,this.max_length,this.batch_size,this.lr,this.num_epochs,this.selectedFolder},openFolderSelector(){this.$refs.folder_selector.click()},selectOutputDirectory(n){var t;console.log("here");const e=(t=n.target.files[0])==null?void 0:t.path;console.log(e),e&&(this.selectedFolder=e)},selectDatasetPath(n){const e=n.target.files;e.length>0&&(this.selectedDatasetPath=e[0].webkitRelativePath)}}},Sct={class:"container overflow-y-scroll flex flex-col no-scrollbar shadow-lg p-10 pt-2 bg-bg-light-tone dark:bg-bg-dark-tone"},yct={class:"mb-4"},vct=p("label",{for:"model_name",class:"text-sm"},"Model Name:",-1),Tct={class:"mb-4"},xct=p("label",{for:"tokenizer_name",class:"text-sm"},"Tokenizer Name:",-1),Cct=p("button",{type:"submit",class:"bg-blue-500 text-white px-4 py-2 rounded"},"Quantize LLM",-1);function Rct(n,e,t,i,r,s){const o=St("ClipBoardTextInput"),a=St("Card");return M(),L("div",Sct,[p("form",{onSubmit:e[0]||(e[0]=Oe((...l)=>s.submitForm&&s.submitForm(...l),["prevent"])),class:"max-w-md mx-auto"},[Le(a,{title:"Quantizing configuration",isHorizontal:!0,disableHoverAnimation:!0,disableFocus:!0},{default:dt(()=>[Le(a,{title:"Model",class:"",isHorizontal:!1},{default:dt(()=>[p("div",yct,[vct,Le(o,{id:"model_path",inputType:"text",value:r.model_name},null,8,["value"])]),p("div",Tct,[xct,Le(o,{id:"model_path",inputType:"text",value:r.tokenizer_name},null,8,["value"])])]),_:1})]),_:1}),Le(a,{disableHoverAnimation:!0,disableFocus:!0},{default:dt(()=>[Cct]),_:1})],32)])}const Act=ft(bct,[["render",Rct]]),wct={data(){return{show:!1,prompt:"",inputText:""}},methods:{showPanel(){this.show=!0},ok(){this.show=!1,this.$emit("ok",this.inputText)},cancel(){this.show=!1,this.inputText=""}},props:{promptText:{type:String,required:!0}},watch:{promptText(n){this.prompt=n}}},Oct={key:0,class:"fixed top-0 left-0 w-full h-full flex justify-center items-center bg-black bg-opacity-50"},Nct={class:"bg-white p-8 rounded"},Mct={class:"text-xl font-bold mb-4"};function Ict(n,e,t,i,r,s){return M(),L("div",null,[r.show?(M(),L("div",Oct,[p("div",Nct,[p("h2",Mct,me(t.promptText),1),Ae(p("input",{type:"text","onUpdate:modelValue":e[0]||(e[0]=o=>r.inputText=o),class:"border border-gray-300 px-4 py-2 rounded mb-4"},null,512),[[Je,r.inputText]]),p("button",{onClick:e[1]||(e[1]=(...o)=>s.ok&&s.ok(...o)),class:"bg-blue-500 text-white px-4 py-2 rounded mr-2"},"OK"),p("button",{onClick:e[2]||(e[2]=(...o)=>s.cancel&&s.cancel(...o)),class:"bg-gray-500 text-white px-4 py-2 rounded"},"Cancel")])])):X("",!0)])}const Ew=ft(wct,[["render",Ict]]),Dct={props:{htmlContent:{type:String,required:!0}}},Lct=["innerHTML"];function kct(n,e,t,i,r,s){return M(),L("div",null,[p("div",{innerHTML:t.htmlContent},null,8,Lct)])}const Pct=ft(Dct,[["render",kct]]);const Uct={props:{jsonData:{type:[Object,Array,String],default:null},jsonFormText:{type:String,default:"JSON Form"}},data(){return{collapsed:!0}},computed:{formattedJson(){return typeof this.jsonData=="string"?JSON.stringify(JSON.parse(this.jsonData),null," ").replace(/\n/g,"
"):JSON.stringify(this.jsonData,null," ").replace(/\n/g,"
")},isObject(){return typeof this.jsonData=="object"&&this.jsonData!==null},isContentPresent(){return this.jsonData!==null&&(typeof this.jsonData!="string"||this.jsonData.trim()!=="")}},methods:{toggleCollapsed(){this.collapsed=!this.collapsed},toggleCollapsible(){this.collapsed=!this.collapsed}}},Fct={key:0},Bct={class:"toggle-icon mr-1"},Gct={key:0,class:"fas fa-plus-circle text-gray-600"},zct={key:1,class:"fas fa-minus-circle text-gray-600"},Vct={class:"json-viewer max-h-64 overflow-auto p-4 bg-gray-100 border border-gray-300 rounded dark:bg-gray-600"},Hct={key:0,class:"fas fa-plus-circle text-gray-600"},qct={key:1,class:"fas fa-minus-circle text-gray-600"},Yct=["innerHTML"];function $ct(n,e,t,i,r,s){return s.isContentPresent?(M(),L("div",Fct,[p("div",{class:"collapsible-section cursor-pointer mb-4 font-bold hover:text-gray-900",onClick:e[0]||(e[0]=(...o)=>s.toggleCollapsible&&s.toggleCollapsible(...o))},[p("span",Bct,[r.collapsed?(M(),L("i",Gct)):(M(),L("i",zct))]),$e(" "+me(t.jsonFormText),1)]),Ae(p("div",null,[p("div",Vct,[s.isObject?(M(),L("span",{key:0,onClick:e[1]||(e[1]=(...o)=>s.toggleCollapsed&&s.toggleCollapsed(...o)),class:"toggle-icon cursor-pointer mr-1"},[r.collapsed?(M(),L("i",Hct)):(M(),L("i",qct))])):X("",!0),p("pre",{innerHTML:s.formattedJson},null,8,Yct)])],512),[[At,!r.collapsed]])])):X("",!0)}const Wct=ft(Uct,[["render",$ct]]),Kct={props:{done:{type:Boolean,required:!0},message:{type:String,required:!0},status:{type:Boolean,required:!0}}},jct={class:"step flex items-center mb-4"},Qct={class:"flex items-center justify-center w-6 h-6 mr-2"},Xct={key:0},Zct=p("i",{"data-feather":"square",class:"text-gray-400 w-4 h-4"},null,-1),Jct=[Zct],edt={key:1},tdt=p("i",{"data-feather":"check-square",class:"text-green-500 w-4 h-4"},null,-1),ndt=[tdt],idt={key:2},rdt=p("i",{"data-feather":"x-square",class:"text-red-500 w-4 h-4"},null,-1),sdt=[rdt],odt={key:0,role:"status"},adt=p("svg",{"aria-hidden":"true",class:"w-6 h-6 animate-spin fill-secondary",viewBox:"0 0 100 101",fill:"none",xmlns:"http://www.w3.org/2000/svg"},[p("path",{d:"M100 50.5908C100 78.2051 77.6142 100.591 50 100.591C22.3858 100.591 0 78.2051 0 50.5908C0 22.9766 22.3858 0.59082 50 0.59082C77.6142 0.59082 100 22.9766 100 50.5908ZM9.08144 50.5908C9.08144 73.1895 27.4013 91.5094 50 91.5094C72.5987 91.5094 90.9186 73.1895 90.9186 50.5908C90.9186 27.9921 72.5987 9.67226 50 9.67226C27.4013 9.67226 9.08144 27.9921 9.08144 50.5908Z",fill:"currentColor"}),p("path",{d:"M93.9676 39.0409C96.393 38.4038 97.8624 35.9116 97.0079 33.5539C95.2932 28.8227 92.871 24.3692 89.8167 20.348C85.8452 15.1192 80.8826 10.7238 75.2124 7.41289C69.5422 4.10194 63.2754 1.94025 56.7698 1.05124C51.7666 0.367541 46.6976 0.446843 41.7345 1.27873C39.2613 1.69328 37.813 4.19778 38.4501 6.62326C39.0873 9.04874 41.5694 10.4717 44.0505 10.1071C47.8511 9.54855 51.7191 9.52689 55.5402 10.0491C60.8642 10.7766 65.9928 12.5457 70.6331 15.2552C75.2735 17.9648 79.3347 21.5619 82.5849 25.841C84.9175 28.9121 86.7997 32.2913 88.1811 35.8758C89.083 38.2158 91.5421 39.6781 93.9676 39.0409Z",fill:"currentFill"})],-1),ldt=[adt];function cdt(n,e,t,i,r,s){return M(),L("div",jct,[p("div",Qct,[t.done?X("",!0):(M(),L("div",Xct,Jct)),t.done&&t.status?(M(),L("div",edt,ndt)):X("",!0),t.done&&!t.status?(M(),L("div",idt,sdt)):X("",!0)]),t.done?X("",!0):(M(),L("div",odt,ldt)),p("div",{class:Ke(["content flex-1 px-2",{"text-green-500":t.done,"text-yellow-500":!t.done}])},me(t.message),3)])}const ddt=ft(Kct,[["render",cdt]]);const ax="/",udt={name:"Message",emits:["copy","delete","rankUp","rankDown","updateMessage","resendMessage","continueMessage"],components:{MarkdownRenderer:hw,Step:ddt,RenderHTMLJS:Pct,JsonViewer:Wct,DynamicUIRenderer:gw},props:{host:{type:String,required:!1,default:"http://localhost:9600"},message:Object,avatar:""},data(){return{audio_url:null,audio:null,msg:null,isSpeaking:!1,speechSynthesis:null,voices:[],expanded:!1,showConfirmation:!1,editMsgMode_:!1,deleteMsgMode:!1,mdRenderHeight:Number}},mounted(){"speechSynthesis"in window?(this.speechSynthesis=window.speechSynthesis,this.voices=this.speechSynthesis.getVoices(),this.voices.length===0&&this.speechSynthesis.addEventListener("voiceschanged",this.onVoicesChanged)):console.error("Speech synthesis is not supported in this browser."),Ue(()=>{Ge.replace(),this.mdRenderHeight=this.$refs.mdRender.$el.offsetHeight})},methods:{insertTab(n){const e=n.target,t=e.selectionStart,i=e.selectionEnd,r=e.value.substring(0,t),s=e.value.substring(i),o=r+" "+s;this.message.content=o,this.$nextTick(()=>{e.selectionStart=e.selectionEnd=t+4}),n.preventDefault()},onVoicesChanged(){this.voices=this.speechSynthesis.getVoices()},read(){this.isSpeaking?this.audio.pause():(this.isSpeaking=!0,Pe.post("./read",{text:this.message.content}).then(n=>{let e=n.data.url;console.log(e),this.audio_url=e}).catch(n=>{this.$store.state.toast.showToast(`Error: ${n}`,4,!1),this.generating=!1}))},speak(){if(this.msg){this.speechSynthesis.cancel(),this.msg=null,this.isSpeaking=!1;return}let n=0;console.log("voice on"),this.isSpeaking=!0;const e=200;this.message.content,this.msg=new SpeechSynthesisUtterance,this.msg.pitch=this.$store.state.config.audio_pitch,this.voices.length>0&&(this.msg.voice=this.voices.filter(r=>r.name===this.$store.state.config.audio_out_voice)[0]);const t=r=>{let s=this.message.content.substring(r,r+e);const o=[".","!","?",` -`];let a=-1;return o.forEach(l=>{const c=s.lastIndexOf(l);c>a&&(a=c)}),a==-1&&(a=s.length),console.log(a),a+r+1},i=()=>{if(this.message.content.includes(".")){const r=t(n),s=this.message.content.substring(n,r);this.msg.text=s,n=r+1,this.msg.onend=o=>{n{i()},1):(this.isSpeaking=!1,console.log("voice off :",this.message.content.length," ",r))},this.speechSynthesis.speak(this.msg)}else setTimeout(()=>{i()},1)};i()},toggleModel(){this.expanded=!this.expanded},copyContentToClipboard(){this.$emit("copy",this)},deleteMsg(){this.$emit("delete",this.message.id),this.deleteMsgMode=!1},rankUp(){this.$emit("rankUp",this.message.id)},rankDown(){this.$emit("rankDown",this.message.id)},updateMessage(){this.$emit("updateMessage",this.message.id,this.message.content),this.editMsgMode=!1},resendMessage(n){this.$emit("resendMessage",this.message.id,this.message.content,n)},continueMessage(){this.$emit("continueMessage",this.message.id,this.message.content)},getImgUrl(){return this.avatar?(console.log("Avatar:",ax+this.avatar),ax+this.avatar):(console.log("No avatar found"),Vo)},defaultImg(n){n.target.src=Vo},parseDate(n){let e=new Date(Date.parse(n)),i=Math.floor((new Date-e)/1e3);return i<=1?"just now":i<20?i+" seconds ago":i<40?"half a minute ago":i<60?"less than a minute ago":i<=90?"one minute ago":i<=3540?Math.round(i/60)+" minutes ago":i<=5400?"1 hour ago":i<=86400?Math.round(i/3600)+" hours ago":i<=129600?"1 day ago":i<604800?Math.round(i/86400)+" days ago":i<=777600?"1 week ago":n},prettyDate(n){let e=new Date((n||"").replace(/-/g,"/").replace(/[TZ]/g," ")),t=(new Date().getTime()-e.getTime())/1e3,i=Math.floor(t/86400);if(!(isNaN(i)||i<0||i>=31))return i==0&&(t<60&&"just now"||t<120&&"1 minute ago"||t<3600&&Math.floor(t/60)+" minutes ago"||t<7200&&"1 hour ago"||t<86400&&Math.floor(t/3600)+" hours ago")||i==1&&"Yesterday"||i<7&&i+" days ago"||i<31&&Math.ceil(i/7)+" weeks ago"},checkForFullSentence(){if(this.message.content.trim().split(" ").length>3){this.speak();return}}},watch:{"message.content":function(n){this.$store.state.config.auto_speak&&(this.isSpeaking||this.checkForFullSentence())},"message.ui":function(n){console.log("ui changed"),console.log(this.message.ui)},showConfirmation(){Ue(()=>{Ge.replace()})},deleteMsgMode(){Ue(()=>{Ge.replace()})}},computed:{enable_voice_service:{get(){this.$store.state.config.enable_voice_service}},editMsgMode:{get(){return this.message.hasOwnProperty("open")?this.editMsgMode_||this.message.open:this.editMsgMode_},set(n){this.message.open=n,this.editMsgMode_=n,Ue(()=>{Ge.replace()})}},isTalking:{get(){return this.isSpeaking}},created_at(){return this.prettyDate(this.message.created_at)},created_at_parsed(){return new Date(Date.parse(this.message.created_at)).toLocaleString()},finished_generating_at_parsed(){return new Date(Date.parse(this.message.finished_generating_at)).toLocaleString()},time_spent(){const n=new Date(Date.parse(this.message.created_at)),e=new Date(Date.parse(this.message.finished_generating_at));if(e.getTime()===n.getTime()||!e.getTime())return;let i=e.getTime()-n.getTime();const r=Math.floor(i/(1e3*60*60));i-=r*(1e3*60*60);const s=Math.floor(i/(1e3*60));i-=s*(1e3*60);const o=Math.floor(i/1e3);i-=o*1e3;function a(c){return c<10&&(c="0"+c),c}return a(r)+"h:"+a(s)+"m:"+a(o)+"s"}}},_dt={class:"relative w-full group rounded-lg m-2 shadow-lg hover:border-primary dark:hover:border-primary hover:border-solid hover:border-2 border-2 border-transparent even:bg-bg-light-discussion-odd dark:even:bg-bg-dark-discussion-odd flex flex-col flex-grow flex-wrap overflow-visible p-4 pb-2"},pdt={class:"flex flex-row gap-2"},hdt={class:"flex-shrink-0"},fdt={class:"group/avatar"},mdt=["src","data-popover-target"],gdt={class:"flex flex-col w-full flex-grow-0"},Edt={class:"flex flex-row flex-grow items-start"},bdt={class:"flex flex-col mb-2"},Sdt={class:"drop-shadow-sm text-lg text-opacity-95 font-bold grow"},ydt=["title"],vdt=p("div",{class:"flex-grow"},null,-1),Tdt={class:"flex-row justify-end mx-2"},xdt={class:"invisible group-hover:visible flex flex-row"},Cdt={key:0,class:"flex items-center duration-75"},Rdt=p("i",{"data-feather":"x"},null,-1),Adt=[Rdt],wdt=p("i",{"data-feather":"check"},null,-1),Odt=[wdt],Ndt=p("i",{"data-feather":"edit"},null,-1),Mdt=[Ndt],Idt=p("i",{"data-feather":"copy"},null,-1),Ddt=[Idt],Ldt=p("i",{"data-feather":"send"},null,-1),kdt=[Ldt],Pdt=p("i",{"data-feather":"send"},null,-1),Udt=[Pdt],Fdt=p("i",{"data-feather":"fast-forward"},null,-1),Bdt=[Fdt],Gdt={key:5,class:"flex items-center duration-75"},zdt=p("i",{"data-feather":"x"},null,-1),Vdt=[zdt],Hdt=p("i",{"data-feather":"check"},null,-1),qdt=[Hdt],Ydt=p("i",{"data-feather":"trash"},null,-1),$dt=[Ydt],Wdt=p("i",{"data-feather":"thumbs-up"},null,-1),Kdt=[Wdt],jdt={class:"flex flex-row items-center"},Qdt=p("i",{"data-feather":"thumbs-down"},null,-1),Xdt=[Qdt],Zdt={class:"flex flex-row items-center"},Jdt=p("i",{"data-feather":"volume-2"},null,-1),eut=[Jdt],tut={key:7,class:"flex flex-row items-center"},nut=p("i",{"data-feather":"voicemail"},null,-1),iut=[nut],rut={class:"overflow-x-auto w-full"},sut={class:"flex flex-col items-start w-full"},out={class:"flex flex-col items-start w-full"},aut={key:1},lut={key:3,controls:"",autoplay:""},cut=["src"],dut={class:"text-sm text-gray-400 mt-2"},uut={class:"flex flex-row items-center gap-2"},_ut={key:0},put={class:"font-thin"},hut={key:1},fut={class:"font-thin"},mut={key:2},gut={class:"font-thin"},Eut={key:3},but=["title"];function Sut(n,e,t,i,r,s){const o=St("Step"),a=St("RenderHTMLJS"),l=St("MarkdownRenderer"),c=St("JsonViewer"),d=St("DynamicUIRenderer");return M(),L("div",_dt,[p("div",pdt,[p("div",hdt,[p("div",fdt,[p("img",{src:s.getImgUrl(),onError:e[0]||(e[0]=u=>s.defaultImg(u)),"data-popover-target":"avatar"+t.message.id,"data-popover-placement":"bottom",class:"w-10 h-10 rounded-full object-fill text-red-700"},null,40,mdt)])]),p("div",gdt,[p("div",Edt,[p("div",bdt,[p("div",Sdt,me(t.message.sender)+" ",1),t.message.created_at?(M(),L("div",{key:0,class:"text-sm text-gray-400 font-thin",title:"Created at: "+s.created_at_parsed},me(s.created_at),9,ydt)):X("",!0)]),vdt,p("div",Tdt,[p("div",xdt,[s.editMsgMode?(M(),L("div",Cdt,[p("button",{class:"text-2xl hover:text-red-600 duration-75 active:scale-90 p-2",title:"Cancel edit",type:"button",onClick:e[1]||(e[1]=Oe(u=>s.editMsgMode=!1,["stop"]))},Adt),p("button",{class:"text-2xl hover:text-secondary duration-75 active:scale-90 p-2",title:"Update message",type:"button",onClick:e[2]||(e[2]=Oe((...u)=>s.updateMessage&&s.updateMessage(...u),["stop"]))},Odt)])):X("",!0),s.editMsgMode?X("",!0):(M(),L("div",{key:1,class:"text-lg hover:text-secondary duration-75 active:scale-90 p-2",title:"Edit message",onClick:e[3]||(e[3]=Oe(u=>s.editMsgMode=!0,["stop"]))},Mdt)),p("div",{class:"text-lg hover:text-secondary duration-75 active:scale-90 p-2",title:"Copy message to clipboard",onClick:e[4]||(e[4]=Oe(u=>s.copyContentToClipboard(),["stop"]))},Ddt),!s.editMsgMode&&t.message.sender!=this.$store.state.mountedPers.name?(M(),L("div",{key:2,class:Ke(["text-lg text-red-500 hover:text-secondary duration-75 active:scale-90 p-2",{"text-5xl":s.editMsgMode}]),title:"Resend message with full context",onClick:e[5]||(e[5]=Oe(u=>s.resendMessage("full_context"),["stop"]))},kdt,2)):X("",!0),!s.editMsgMode&&t.message.sender!=this.$store.state.mountedPers.name?(M(),L("div",{key:3,class:Ke(["text-lg hover:text-secondary duration-75 active:scale-90 p-2",{"text-5xl":s.editMsgMode}]),title:"Resend message without the full context",onClick:e[6]||(e[6]=Oe(u=>s.resendMessage("simple_question"),["stop"]))},Udt,2)):X("",!0),!s.editMsgMode&&t.message.sender==this.$store.state.mountedPers.name?(M(),L("div",{key:4,class:"text-lg hover:text-secondary duration-75 active:scale-90 p-2",title:"Resend message",onClick:e[7]||(e[7]=Oe(u=>s.continueMessage(),["stop"]))},Bdt)):X("",!0),r.deleteMsgMode?(M(),L("div",Gdt,[p("button",{class:"text-2xl hover:text-red-600 duration-75 active:scale-90 p-2",title:"Cancel removal",type:"button",onClick:e[8]||(e[8]=Oe(u=>r.deleteMsgMode=!1,["stop"]))},Vdt),p("button",{class:"text-2xl hover:text-secondary duration-75 active:scale-90 p-2",title:"Confirm removal",type:"button",onClick:e[9]||(e[9]=Oe(u=>s.deleteMsg(),["stop"]))},qdt)])):X("",!0),!s.editMsgMode&&!r.deleteMsgMode?(M(),L("div",{key:6,class:"text-lg hover:text-red-600 duration-75 active:scale-90 p-2",title:"Remove message",onClick:e[10]||(e[10]=u=>r.deleteMsgMode=!0)},$dt)):X("",!0),p("div",{class:"text-lg hover:text-secondary duration-75 active:scale-90 p-2",title:"Upvote",onClick:e[11]||(e[11]=Oe(u=>s.rankUp(),["stop"]))},Kdt),p("div",jdt,[p("div",{class:"text-lg hover:text-red-600 duration-75 active:scale-90 p-2",title:"Downvote",onClick:e[12]||(e[12]=Oe(u=>s.rankDown(),["stop"]))},Xdt),t.message.rank!=0?(M(),L("div",{key:0,class:Ke(["rounded-full px-2 text-sm flex items-center justify-center font-bold",t.message.rank>0?"bg-secondary":"bg-red-600"]),title:"Rank"},me(t.message.rank),3)):X("",!0)]),p("div",Zdt,[p("div",{class:Ke(["text-lg hover:text-red-600 duration-75 active:scale-90 p-2",{"text-red-500":s.isTalking}]),title:"speak",onClick:e[13]||(e[13]=Oe(u=>s.speak(),["stop"]))},eut,2)]),s.enable_voice_service?(M(),L("div",tut,[p("div",{class:Ke(["text-lg hover:text-red-600 duration-75 active:scale-90 p-2",{"text-red-500":s.isTalking}]),title:"read",onClick:e[14]||(e[14]=Oe(u=>s.read(),["stop"]))},iut,2)])):X("",!0)])])]),p("div",rut,[p("div",sut,[(M(!0),L(Xe,null,bt(t.message.steps,(u,_)=>(M(),L("div",{key:"step-"+t.message.id+"-"+_,class:"step font-bold",style:un({backgroundColor:u.done?"transparent":"inherit"})},[Le(o,{done:u.done,message:u.message,status:u.status},null,8,["done","message","status"])],4))),128))]),p("div",out,[(M(!0),L(Xe,null,bt(t.message.html_js_s,(u,_)=>(M(),L("div",{key:"htmljs-"+t.message.id+"-"+_,class:"htmljs font-bold",style:un({backgroundColor:n.step.done?"transparent":"inherit"})},[Le(a,{htmlContent:u},null,8,["htmlContent"])],4))),128))]),s.editMsgMode?X("",!0):(M(),Qt(l,{key:0,ref:"mdRender",host:t.host,"markdown-text":t.message.content,message_id:t.message.id,discussion_id:t.message.discussion_id},null,8,["host","markdown-text","message_id","discussion_id"])),p("div",null,[t.message.open?Ae((M(),L("textarea",{key:0,ref:"mdTextarea",onKeydown:e[15]||(e[15]=Fo(Oe((...u)=>s.insertTab&&s.insertTab(...u),["prevent"]),["tab"])),class:"block min-h-[900px] p-2.5 w-full text-gray-900 bg-gray-50 rounded-lg border border-gray-300 focus:ring-blue-500 focus:border-blue-500 dark:bg-gray-700 dark:border-gray-600 dark:placeholder-gray-400 dark:text-white dark:focus:ring-blue-500 dark:focus:border-blue-500 overflow-y-scroll flex flex-col shadow-lg p-10 pt-0 overflow-y-scroll dark:bg-bg-dark scrollbar-thin scrollbar-track-bg-light-tone scrollbar-thumb-bg-light-tone-panel hover:scrollbar-thumb-primary dark:scrollbar-track-bg-dark-tone dark:scrollbar-thumb-bg-dark-tone-panel dark:hover:scrollbar-thumb-primary active:scrollbar-thumb-secondary",rows:4,style:un({minHeight:r.mdRenderHeight+"px"}),placeholder:"Enter message here...","onUpdate:modelValue":e[16]||(e[16]=u=>t.message.content=u)},`\r - `,36)),[[Je,t.message.content]]):X("",!0)]),t.message.metadata!==null?(M(),L("div",aut,[(M(!0),L(Xe,null,bt(t.message.metadata,(u,_)=>(M(),L("div",{key:"json-"+t.message.id+"-"+_,class:"json font-bold"},[Le(c,{jsonFormText:u.title,jsonData:u.content},null,8,["jsonFormText","jsonData"])]))),128))])):X("",!0),t.message.ui!==null&&t.message.ui!==void 0&&t.message.ui!==""?(M(),Qt(d,{key:2,class:"w-full h-full",code:t.message.ui},null,8,["code"])):X("",!0),r.audio_url!=null?(M(),L("audio",lut,[p("source",{src:r.audio_url,type:"audio/wav"},null,8,cut),$e(" Your browser does not support the audio element. ")])):X("",!0)]),p("div",dut,[p("div",uut,[t.message.binding?(M(),L("p",_ut,[$e("Binding: "),p("span",put,me(t.message.binding),1)])):X("",!0),t.message.model?(M(),L("p",hut,[$e("Model: "),p("span",fut,me(t.message.model),1)])):X("",!0),t.message.seed?(M(),L("p",mut,[$e("Seed: "),p("span",gut,me(t.message.seed),1)])):X("",!0),s.time_spent?(M(),L("p",Eut,[$e("Time spent: "),p("span",{class:"font-thin",title:"Finished generating: "+s.finished_generating_at_parsed},me(s.time_spent),9,but)])):X("",!0)])])])])])}const bw=ft(udt,[["render",Sut]]),yut="/";Pe.defaults.baseURL="/";const vut={name:"MountedPersonalities",props:{onShowPersList:Function,onReady:Function},components:{Toast:Ol,UniversalForm:Nl},data(){return{bUrl:yut,isMounted:!1,show:!1}},async mounted(){await this.constructor(),this.isMounted=!0},async activated(){this.isMounted&&await this.constructor()},computed:{configFile:{get(){return this.$store.state.config},set(n){this.$store.commit("setConfig",n)}},mountedPers:{get(){return this.$store.state.mountedPers},set(n){this.$store.commit("setMountedPers",n)}},personalities:{get(){return this.$store.state.personalities},set(n){this.$store.commit("setPersonalities",n)}},mountedPersArr:{get(){return this.$store.state.mountedPersArr},set(n){this.$store.commit("setMountedPers",n)}}},methods:{onSettingsPersonality(n){try{Pe.get("/get_active_personality_settings").then(e=>{e&&(console.log("pers sett",e),e.data&&Object.keys(e.data).length>0?this.$refs.universalForm.showForm(e.data,"Personality settings - "+n.name,"Save changes","Cancel").then(t=>{try{Pe.post("/set_active_personality_settings",t).then(i=>{i&&i.data?(console.log("personality set with new settings",i.data),this.$refs.toast.showToast("Personality settings updated successfully!",4,!0)):this.$refs.toast.showToast(`Did not get Personality settings responses. +You need to apply changes before you leave, or else.`,"Apply configuration","Cancel")&&this.applyConfiguration(),!1}},Ce=n=>(Gs("data-v-8ad66bce"),n=n(),zs(),n),jtt={class:"container overflow-y-scroll flex flex-row shadow-lg p-10 pt-0 overflow-y-scroll w-full dark:bg-bg-dark scrollbar-thin scrollbar-track-bg-light-tone scrollbar-thumb-bg-light-tone-panel hover:scrollbar-thumb-primary dark:scrollbar-track-bg-dark-tone dark:scrollbar-thumb-bg-dark-tone-panel dark:hover:scrollbar-thumb-primary active:scrollbar-thumb-secondary"},Qtt={class:"sticky top-0 z-10 flex flex-row mb-2 p-3 gap-3 w-full rounded-b-lg bg-bg-light-tone dark:bg-bg-dark-tone shadow-lg"},Xtt={key:0,class:"flex gap-3 flex-1 items-center duration-75"},Ztt=Ce(()=>p("i",{"data-feather":"x"},null,-1)),Jtt=[Ztt],ent=Ce(()=>p("i",{"data-feather":"check"},null,-1)),tnt=[ent],nnt={key:1,class:"flex gap-3 flex-1 items-center"},int=Ce(()=>p("i",{"data-feather":"save"},null,-1)),rnt=[int],snt=Ce(()=>p("i",{"data-feather":"refresh-ccw"},null,-1)),ont=[snt],ant=Ce(()=>p("i",{"data-feather":"list"},null,-1)),lnt=[ant],cnt={class:"flex gap-3 flex-1 items-center justify-end"},dnt=Ce(()=>p("i",{"data-feather":"trash-2"},null,-1)),unt=[dnt],_nt=Ce(()=>p("i",{"data-feather":"refresh-ccw"},null,-1)),pnt=[_nt],hnt=Ce(()=>p("i",{"data-feather":"arrow-up-circle"},null,-1)),fnt={key:0},mnt=Ce(()=>p("i",{"data-feather":"alert-circle"},null,-1)),gnt=[mnt],Ent={class:"flex gap-3 items-center"},bnt={key:0,class:"flex gap-3 items-center"},Snt=Ce(()=>p("p",{class:"text-red-600 font-bold"},"Apply changes:",-1)),ynt=Ce(()=>p("i",{"data-feather":"check"},null,-1)),vnt=[ynt],Tnt={key:1,role:"status"},xnt=Ce(()=>p("svg",{"aria-hidden":"true",class:"w-6 h-6 animate-spin fill-secondary",viewBox:"0 0 100 101",fill:"none",xmlns:"http://www.w3.org/2000/svg"},[p("path",{d:"M100 50.5908C100 78.2051 77.6142 100.591 50 100.591C22.3858 100.591 0 78.2051 0 50.5908C0 22.9766 22.3858 0.59082 50 0.59082C77.6142 0.59082 100 22.9766 100 50.5908ZM9.08144 50.5908C9.08144 73.1895 27.4013 91.5094 50 91.5094C72.5987 91.5094 90.9186 73.1895 90.9186 50.5908C90.9186 27.9921 72.5987 9.67226 50 9.67226C27.4013 9.67226 9.08144 27.9921 9.08144 50.5908Z",fill:"currentColor"}),p("path",{d:"M93.9676 39.0409C96.393 38.4038 97.8624 35.9116 97.0079 33.5539C95.2932 28.8227 92.871 24.3692 89.8167 20.348C85.8452 15.1192 80.8826 10.7238 75.2124 7.41289C69.5422 4.10194 63.2754 1.94025 56.7698 1.05124C51.7666 0.367541 46.6976 0.446843 41.7345 1.27873C39.2613 1.69328 37.813 4.19778 38.4501 6.62326C39.0873 9.04874 41.5694 10.4717 44.0505 10.1071C47.8511 9.54855 51.7191 9.52689 55.5402 10.0491C60.8642 10.7766 65.9928 12.5457 70.6331 15.2552C75.2735 17.9648 79.3347 21.5619 82.5849 25.841C84.9175 28.9121 86.7997 32.2913 88.1811 35.8758C89.083 38.2158 91.5421 39.6781 93.9676 39.0409Z",fill:"currentFill"})],-1)),Cnt=Ce(()=>p("span",{class:"sr-only"},"Loading...",-1)),Rnt={class:"flex flex-col mb-2 rounded-lg bg-bg-light-tone dark:bg-bg-dark-tone hover:bg-bg-light-tone-panel hover:dark:bg-bg-dark-tone-panel duration-150 shadow-lg"},Ant={class:"flex flex-row p-3"},wnt=Ce(()=>p("i",{"data-feather":"chevron-right"},null,-1)),Ont=[wnt],Nnt=Ce(()=>p("i",{"data-feather":"chevron-down"},null,-1)),Mnt=[Nnt],Int=Ce(()=>p("h3",{class:"text-lg font-semibold cursor-pointer select-none mr-2"}," System status",-1)),Dnt=Ce(()=>p("div",{class:"mr-2"},"|",-1)),Lnt={class:"text-base font-semibold cursor-pointer select-none items-center"},knt={class:"flex gap-2 items-center"},Pnt={key:0},Unt={class:"flex gap-2 items-center"},Fnt=["src"],Bnt={class:"font-bold font-large text-lg"},Gnt={key:1},znt={class:"flex gap-2 items-center"},Vnt=["src"],Hnt={class:"font-bold font-large text-lg"},qnt=Ce(()=>p("i",{"data-feather":"cpu",title:"CPU Ram",class:"w-5 h-5 mx-1 flex-shrink-0"},null,-1)),Ynt={class:"font-bold font-large text-lg"},$nt=Ce(()=>p("i",{"data-feather":"hard-drive",title:"Hard drive",class:"w-5 h-5 mx-1 flex-shrink-0"},null,-1)),Wnt={class:"font-bold font-large text-lg"},Knt={class:"mb-2"},jnt=Ce(()=>p("label",{class:"flex items-center gap-1 ml-2 mb-2 text-sm font-medium text-gray-900 dark:text-white"},[p("svg",{xmlns:"http://www.w3.org/2000/svg",width:"24",height:"24",viewBox:"0 0 24 24"},[p("path",{fill:"currentColor",d:"M17 17H7V7h10m4 4V9h-2V7a2 2 0 0 0-2-2h-2V3h-2v2h-2V3H9v2H7c-1.11 0-2 .89-2 2v2H3v2h2v2H3v2h2v2a2 2 0 0 0 2 2h2v2h2v-2h2v2h2v-2h2a2 2 0 0 0 2-2v-2h2v-2h-2v-2m-6 2h-2v-2h2m2-2H9v6h6V9Z"})]),$e(" CPU Ram usage: ")],-1)),Qnt={class:"flex flex-col mx-2"},Xnt=Ce(()=>p("b",null,"Avaliable ram: ",-1)),Znt=Ce(()=>p("b",null,"Ram usage: ",-1)),Jnt={class:"p-2"},eit={class:"w-full bg-gray-200 rounded-full h-2.5 dark:bg-gray-700"},tit={class:"mb-2"},nit=Ce(()=>p("label",{class:"flex items-center gap-1 ml-2 mb-2 text-sm font-medium text-gray-900 dark:text-white"},[p("i",{"data-feather":"hard-drive",class:"w-5 h-5"}),$e(" Disk usage: ")],-1)),iit={class:"flex flex-col mx-2"},rit=Ce(()=>p("b",null,"Avaliable disk space: ",-1)),sit=Ce(()=>p("b",null,"Disk usage: ",-1)),oit={class:"p-2"},ait={class:"w-full bg-gray-200 rounded-full h-2.5 dark:bg-gray-700"},lit={class:"mb-2"},cit={class:"flex items-center gap-1 ml-2 mb-2 text-sm font-medium text-gray-900 dark:text-white"},dit=["src"],uit={class:"flex flex-col mx-2"},_it=Ce(()=>p("b",null,"Model: ",-1)),pit=Ce(()=>p("b",null,"Avaliable vram: ",-1)),hit=Ce(()=>p("b",null,"GPU usage: ",-1)),fit={class:"p-2"},mit={class:"w-full bg-gray-200 rounded-full h-2.5 dark:bg-gray-700"},git={class:"flex flex-col mb-2 rounded-lg bg-bg-light-tone dark:bg-bg-dark-tone hover:bg-bg-light-tone-panel hover:dark:bg-bg-dark-tone-panel duration-150 shadow-lg"},Eit={class:"flex flex-row p-3"},bit=Ce(()=>p("i",{"data-feather":"chevron-right"},null,-1)),Sit=[bit],yit=Ce(()=>p("i",{"data-feather":"chevron-down"},null,-1)),vit=[yit],Tit=Ce(()=>p("h3",{class:"text-lg font-semibold cursor-pointer select-none mr-2"}," Main configurations",-1)),xit={class:"flex flex-col mb-2 px-3 pb-2"},Cit={class:"expand-to-fit bg-gray-50 border border-gray-300 text-gray-900 text-sm rounded-lg focus:ring-blue-500 focus:border-blue-500 block p-2.5 dark:bg-gray-700 dark:border-gray-600 dark:placeholder-gray-400 dark:text-white dark:focus:ring-blue-500 dark:focus:border-blue-500"},Rit=Ce(()=>p("td",{style:{"min-width":"200px"}},[p("label",{for:"db_path",class:"text-sm font-bold",style:{"margin-right":"1rem"}},"Host:")],-1)),Ait={style:{width:"100%"}},wit=Ce(()=>p("td",{style:{"min-width":"200px"}},[p("label",{for:"db_path",class:"text-sm font-bold",style:{"margin-right":"1rem"}},"Port:")],-1)),Oit={style:{width:"100%"}},Nit=Ce(()=>p("td",{style:{"min-width":"200px"}},[p("label",{for:"db_path",class:"text-sm font-bold",style:{"margin-right":"1rem"}},"Database path:")],-1)),Mit={style:{width:"100%"}},Iit=Ce(()=>p("td",{style:{"min-width":"200px"}},[p("label",{for:"auto_show_browser",class:"text-sm font-bold",style:{"margin-right":"1rem"}},"Auto show browser:")],-1)),Dit={class:"flex flex-row"},Lit=Ce(()=>p("td",{style:{"min-width":"200px"}},[p("label",{for:"activate_debug",class:"text-sm font-bold",style:{"margin-right":"1rem"}},"Activate debug mode:")],-1)),kit={class:"flex flex-row"},Pit=Ce(()=>p("td",{style:{"min-width":"200px"}},[p("label",{for:"enable_gpu",class:"text-sm font-bold",style:{"margin-right":"1rem"}},"Enable GPU:")],-1)),Uit={class:"text-center items-center"},Fit={class:"flex flex-row"},Bit=Ce(()=>p("td",{style:{"min-width":"200px"}},[p("label",{for:"auto_save",class:"text-sm font-bold",style:{"margin-right":"1rem"}},"Auto save:")],-1)),Git={class:"flex flex-row"},zit=Ce(()=>p("td",{style:{"min-width":"200px"}},[p("label",{for:"auto_update",class:"text-sm font-bold",style:{"margin-right":"1rem"}},"Auto update:")],-1)),Vit={class:"flex flex-row"},Hit=Ce(()=>p("td",{style:{"min-width":"200px"}},[p("label",{for:"auto_update",class:"text-sm font-bold",style:{"margin-right":"1rem"}},"Auto title:")],-1)),qit={class:"flex flex-row"},Yit={class:"bg-gray-50 border border-gray-300 text-gray-900 text-sm rounded-lg focus:ring-blue-500 focus:border-blue-500 block w-full p-2.5 dark:bg-gray-700 dark:border-gray-600 dark:placeholder-gray-400 dark:text-white dark:focus:ring-blue-500 dark:focus:border-blue-500"},$it=Ce(()=>p("td",{style:{"min-width":"200px"}},[p("label",{for:"user_name",class:"text-sm font-bold",style:{"margin-right":"1rem"}},"User name:")],-1)),Wit={style:{width:"100%"}},Kit=Ce(()=>p("td",{style:{"min-width":"200px"}},[p("label",{for:"user_description",class:"text-sm font-bold",style:{"margin-right":"1rem"}},"User description:")],-1)),jit={style:{width:"100%"}},Qit=Ce(()=>p("td",{style:{"min-width":"200px"}},[p("label",{for:"user_description",class:"text-sm font-bold",style:{"margin-right":"1rem"}},"Use user description in discussion:")],-1)),Xit={style:{width:"100%"}},Zit=Ce(()=>p("td",{style:{"min-width":"200px"}},[p("label",{for:"user_name",class:"text-sm font-bold",style:{"margin-right":"1rem"}},"User avatar:")],-1)),Jit={style:{width:"100%"}},ert={for:"avatar-upload"},trt=["src"],nrt=Ce(()=>p("td",{style:{"min-width":"200px"}},[p("label",{for:"use_user_name_in_discussions",class:"text-sm font-bold",style:{"margin-right":"1rem"}},"Use User Name in discussions:")],-1)),irt={class:"flex flex-row"},rrt=Ce(()=>p("td",{style:{"min-width":"200px"}},[p("label",{for:"min_n_predict",class:"text-sm font-bold",style:{"margin-right":"1rem"}},"Minimum number of output tokens space (forces the model to have more space to speak):")],-1)),srt={style:{width:"100%"}},ort={class:"bg-gray-50 border border-gray-300 text-gray-900 text-sm rounded-lg focus:ring-blue-500 focus:border-blue-500 block w-full p-2.5 dark:bg-gray-700 dark:border-gray-600 dark:placeholder-gray-400 dark:text-white dark:focus:ring-blue-500 dark:focus:border-blue-500"},art=Ce(()=>p("td",{style:{"min-width":"200px"}},[p("label",{for:"use_files",class:"text-sm font-bold",style:{"margin-right":"1rem"}},"Activate files support:")],-1)),lrt={class:"flex flex-row"},crt=Ce(()=>p("td",{style:{"min-width":"200px"}},[p("label",{for:"use_discussions_history",class:"text-sm font-bold",style:{"margin-right":"1rem"}},"Activate discussion vectorization:")],-1)),drt={class:"flex flex-row"},urt=Ce(()=>p("td",{style:{"min-width":"200px"}},[p("label",{for:"summerize_discussion",class:"text-sm font-bold",style:{"margin-right":"1rem"}},"Activate Continuous Learning from discussions:")],-1)),_rt={class:"flex flex-row"},prt=Ce(()=>p("td",{style:{"min-width":"200px"}},[p("label",{for:"data_vectorization_visualize_on_vectorization",class:"text-sm font-bold",style:{"margin-right":"1rem"}},"show vectorized data:")],-1)),hrt={class:"flex flex-row"},frt=Ce(()=>p("td",{style:{"min-width":"200px"}},[p("label",{for:"data_vectorization_activate",class:"text-sm font-bold",style:{"margin-right":"1rem"}},"Activate data Vectorization:")],-1)),mrt={class:"flex flex-row"},grt=Ce(()=>p("td",{style:{"min-width":"200px"}},[p("label",{for:"data_vectorization_build_keys_words",class:"text-sm font-bold",style:{"margin-right":"1rem"}},"Build keywords when querying the vectorized database:")],-1)),Ert={class:"flex flex-row"},brt=Ce(()=>p("td",{style:{"min-width":"200px"}},[p("label",{for:"data_vectorization_method",class:"text-sm font-bold",style:{"margin-right":"1rem"}},"Data vectorization method:")],-1)),Srt=Ce(()=>p("option",{value:"tfidf_vectorizer"},"tfidf Vectorizer",-1)),yrt=Ce(()=>p("option",{value:"model_embedding"},"Model Embedding",-1)),vrt=[Srt,yrt],Trt=Ce(()=>p("td",{style:{"min-width":"200px"}},[p("label",{for:"data_visualization_method",class:"text-sm font-bold",style:{"margin-right":"1rem"}},"Data visualization method:")],-1)),xrt=Ce(()=>p("option",{value:"PCA"},"PCA",-1)),Crt=Ce(()=>p("option",{value:"TSNE"},"TSNE",-1)),Rrt=[xrt,Crt],Art=Ce(()=>p("td",{style:{"min-width":"200px"}},[p("label",{for:"data_vectorization_save_db",class:"text-sm font-bold",style:{"margin-right":"1rem"}},"Save the new files to the database (The database wil always grow and continue to be the same over many sessions):")],-1)),wrt={class:"flex flex-row"},Ort=Ce(()=>p("td",{style:{"min-width":"200px"}},[p("label",{for:"data_vectorization_chunk_size",class:"text-sm font-bold",style:{"margin-right":"1rem"}},"Data vectorization chunk size(tokens):")],-1)),Nrt=Ce(()=>p("td",{style:{"min-width":"200px"}},[p("label",{for:"data_vectorization_overlap_size",class:"text-sm font-bold",style:{"margin-right":"1rem"}},"Data vectorization overlap size(tokens):")],-1)),Mrt=Ce(()=>p("td",{style:{"min-width":"200px"}},[p("label",{for:"data_vectorization_overlap_size",class:"text-sm font-bold",style:{"margin-right":"1rem"}},"Number of chunks to use for each message:")],-1)),Irt={class:"bg-gray-50 border border-gray-300 text-gray-900 text-sm rounded-lg focus:ring-blue-500 focus:border-blue-500 block w-full p-2.5 dark:bg-gray-700 dark:border-gray-600 dark:placeholder-gray-400 dark:text-white dark:focus:ring-blue-500 dark:focus:border-blue-500"},Drt=Ce(()=>p("td",{style:{"min-width":"200px"}},[p("label",{for:"audio_auto_send_input",class:"text-sm font-bold",style:{"margin-right":"1rem"}},"Send audio input automatically:")],-1)),Lrt={class:"flex flex-row"},krt=Ce(()=>p("td",{style:{"min-width":"200px"}},[p("label",{for:"auto_speak",class:"text-sm font-bold",style:{"margin-right":"1rem"}},"Enable auto speak:")],-1)),Prt={class:"flex flex-row"},Urt=Ce(()=>p("td",{style:{"min-width":"200px"}},[p("label",{for:"enable_voice_service",class:"text-sm font-bold",style:{"margin-right":"1rem"}},"Enable voice service:")],-1)),Frt={class:"flex flex-row"},Brt=Ce(()=>p("td",{style:{"min-width":"200px"}},[p("label",{for:"current_voice",class:"text-sm font-bold",style:{"margin-right":"1rem"}},"Current voice:")],-1)),Grt={class:"flex flex-row"},zrt=["disabled"],Vrt=["value"],Hrt=Ce(()=>p("td",{style:{"min-width":"200px"}},[p("label",{for:"auto_read",class:"text-sm font-bold",style:{"margin-right":"1rem"}},"Enable auto read:")],-1)),qrt={class:"flex flex-row"},Yrt=["disabled"],$rt=Ce(()=>p("td",{style:{"min-width":"200px"}},[p("label",{for:"audio_pitch",class:"text-sm font-bold",style:{"margin-right":"1rem"}},"audio pitch:")],-1)),Wrt=Ce(()=>p("td",{style:{"min-width":"200px"}},[p("label",{for:"audio_silenceTimer",class:"text-sm font-bold",style:{"margin-right":"1rem"}},"audio in silence timer (ms):")],-1)),Krt=Ce(()=>p("td",{style:{"min-width":"200px"}},[p("label",{for:"audio_in_language",class:"text-sm font-bold",style:{"margin-right":"1rem"}},"Input Audio Language:")],-1)),jrt=["value"],Qrt=Ce(()=>p("td",{style:{"min-width":"200px"}},[p("label",{for:"audio_out_voice",class:"text-sm font-bold",style:{"margin-right":"1rem"}},"Output Audio Voice:")],-1)),Xrt=["value"],Zrt={class:"flex flex-col mb-2 rounded-lg bg-bg-light-tone dark:bg-bg-dark-tone hover:bg-bg-light-tone-panel hover:dark:bg-bg-dark-tone-panel duration-150 shadow-lg"},Jrt={class:"flex flex-row p-3"},est=Ce(()=>p("i",{"data-feather":"chevron-right"},null,-1)),tst=[est],nst=Ce(()=>p("i",{"data-feather":"chevron-down"},null,-1)),ist=[nst],rst=Ce(()=>p("h3",{class:"text-lg font-semibold cursor-pointer select-none mr-2"}," Binding zoo",-1)),sst={key:0,class:"text-base text-red-600 flex gap-3 items-center mr-2"},ost=Ce(()=>p("i",{"data-feather":"alert-triangle",class:"flex-shrink-0"},null,-1)),ast={key:1,class:"mr-2"},lst={key:2,class:"text-base font-semibold cursor-pointer select-none items-center"},cst={class:"flex gap-1 items-center"},dst=["src"],ust={class:"font-bold font-large text-lg line-clamp-1"},_st={key:0,class:"mb-2"},pst={for:"binding",class:"block ml-2 mb-2 text-sm font-medium text-gray-900 dark:text-white"},hst=Ce(()=>p("i",{"data-feather":"chevron-up"},null,-1)),fst=[hst],mst=Ce(()=>p("i",{"data-feather":"chevron-down"},null,-1)),gst=[mst],Est={class:"flex flex-col mb-2 rounded-lg bg-bg-light-tone dark:bg-bg-dark-tone hover:bg-bg-light-tone-panel hover:dark:bg-bg-dark-tone-panel duration-150 shadow-lg"},bst={class:"flex flex-row p-3"},Sst=Ce(()=>p("i",{"data-feather":"chevron-right"},null,-1)),yst=[Sst],vst=Ce(()=>p("i",{"data-feather":"chevron-down"},null,-1)),Tst=[vst],xst=Ce(()=>p("h3",{class:"text-lg font-semibold cursor-pointer select-none mr-2"}," Models zoo",-1)),Cst={class:"flex flex-row items-center"},Rst={key:0,class:"text-base text-red-600 flex gap-3 items-center mr-2"},Ast=Ce(()=>p("i",{"data-feather":"alert-triangle",class:"flex-shrink-0"},null,-1)),wst={key:1,class:"text-base text-red-600 flex gap-3 items-center mr-2"},Ost=Ce(()=>p("i",{"data-feather":"alert-triangle",class:"flex-shrink-0"},null,-1)),Nst={key:2,class:"mr-2"},Mst={key:3,class:"text-base font-semibold cursor-pointer select-none items-center"},Ist={class:"flex gap-1 items-center"},Dst=["src"],Lst={class:"font-bold font-large text-lg line-clamp-1"},kst={class:"mx-2 mb-4"},Pst={class:"relative"},Ust={class:"absolute inset-y-0 left-0 flex items-center pl-3 pointer-events-none"},Fst={key:0},Bst=Ce(()=>p("div",{role:"status"},[p("svg",{"aria-hidden":"true",class:"inline w-4 h-4 mr-2 text-gray-200 animate-spin dark:text-gray-600 fill-blue-600",viewBox:"0 0 100 101",fill:"none",xmlns:"http://www.w3.org/2000/svg"},[p("path",{d:"M100 50.5908C100 78.2051 77.6142 100.591 50 100.591C22.3858 100.591 0 78.2051 0 50.5908C0 22.9766 22.3858 0.59082 50 0.59082C77.6142 0.59082 100 22.9766 100 50.5908ZM9.08144 50.5908C9.08144 73.1895 27.4013 91.5094 50 91.5094C72.5987 91.5094 90.9186 73.1895 90.9186 50.5908C90.9186 27.9921 72.5987 9.67226 50 9.67226C27.4013 9.67226 9.08144 27.9921 9.08144 50.5908Z",fill:"currentColor"}),p("path",{d:"M93.9676 39.0409C96.393 38.4038 97.8624 35.9116 97.0079 33.5539C95.2932 28.8227 92.871 24.3692 89.8167 20.348C85.8452 15.1192 80.8826 10.7238 75.2124 7.41289C69.5422 4.10194 63.2754 1.94025 56.7698 1.05124C51.7666 0.367541 46.6976 0.446843 41.7345 1.27873C39.2613 1.69328 37.813 4.19778 38.4501 6.62326C39.0873 9.04874 41.5694 10.4717 44.0505 10.1071C47.8511 9.54855 51.7191 9.52689 55.5402 10.0491C60.8642 10.7766 65.9928 12.5457 70.6331 15.2552C75.2735 17.9648 79.3347 21.5619 82.5849 25.841C84.9175 28.9121 86.7997 32.2913 88.1811 35.8758C89.083 38.2158 91.5421 39.6781 93.9676 39.0409Z",fill:"currentFill"})]),p("span",{class:"sr-only"},"Loading...")],-1)),Gst=[Bst],zst={key:1},Vst=Ce(()=>p("svg",{"aria-hidden":"true",class:"w-5 h-5 text-gray-500 dark:text-gray-400",fill:"none",stroke:"currentColor",viewBox:"0 0 24 24",xmlns:"http://www.w3.org/2000/svg"},[p("path",{"stroke-linecap":"round","stroke-linejoin":"round","stroke-width":"2",d:"M21 21l-6-6m2-5a7 7 0 11-14 0 7 7 0 0114 0z"})],-1)),Hst=[Vst],qst=Ce(()=>p("label",{for:"only_installed"},"Show only installed models",-1)),Yst=Ce(()=>p("a",{href:"https://huggingface.co/spaces/HuggingFaceH4/open_llm_leaderboard",target:"_blank",class:"mb-4 font-bold underline text-blue-500 pb-4"},"Hugging face Leaderboard",-1)),$st={key:0,role:"status",class:"text-center w-full display: flex;align-items: center;"},Wst=Ce(()=>p("svg",{"aria-hidden":"true",class:"text-center w-full display: flex;align-items: center; h-20 animate-spin fill-secondary",viewBox:"0 0 100 101",fill:"none",xmlns:"http://www.w3.org/2000/svg"},[p("path",{d:"M100 50.5908C100 78.2051 77.6142 100.591 50 100.591C22.3858 100.591 0 78.2051 0 50.5908C0 22.9766 22.3858 0.59082 50 0.59082C77.6142 0.59082 100 22.9766 100 50.5908ZM9.08144 50.5908C9.08144 73.1895 27.4013 91.5094 50 91.5094C72.5987 91.5094 90.9186 73.1895 90.9186 50.5908C90.9186 27.9921 72.5987 9.67226 50 9.67226C27.4013 9.67226 9.08144 27.9921 9.08144 50.5908Z",fill:"currentColor"}),p("path",{d:"M93.9676 39.0409C96.393 38.4038 97.8624 35.9116 97.0079 33.5539C95.2932 28.8227 92.871 24.3692 89.8167 20.348C85.8452 15.1192 80.8826 10.7238 75.2124 7.41289C69.5422 4.10194 63.2754 1.94025 56.7698 1.05124C51.7666 0.367541 46.6976 0.446843 41.7345 1.27873C39.2613 1.69328 37.813 4.19778 38.4501 6.62326C39.0873 9.04874 41.5694 10.4717 44.0505 10.1071C47.8511 9.54855 51.7191 9.52689 55.5402 10.0491C60.8642 10.7766 65.9928 12.5457 70.6331 15.2552C75.2735 17.9648 79.3347 21.5619 82.5849 25.841C84.9175 28.9121 86.7997 32.2913 88.1811 35.8758C89.083 38.2158 91.5421 39.6781 93.9676 39.0409Z",fill:"currentFill"})],-1)),Kst=Ce(()=>p("p",{class:"heartbeat-text"},"Loading models Zoo",-1)),jst=[Wst,Kst],Qst={key:1,class:"mb-2"},Xst={for:"model",class:"block ml-2 mb-2 text-sm font-medium text-gray-900 dark:text-white"},Zst=Ce(()=>p("i",{"data-feather":"chevron-up"},null,-1)),Jst=[Zst],eot=Ce(()=>p("i",{"data-feather":"chevron-down"},null,-1)),tot=[eot],not={class:"flex flex-col mb-2 rounded-lg bg-bg-light-tone dark:bg-bg-dark-tone hover:bg-bg-light-tone-panel hover:dark:bg-bg-dark-tone-panel duration-150 shadow-lg"},iot={class:"flex flex-row p-3"},rot=Ce(()=>p("i",{"data-feather":"chevron-right"},null,-1)),sot=[rot],oot=Ce(()=>p("i",{"data-feather":"chevron-down"},null,-1)),aot=[oot],lot=Ce(()=>p("h3",{class:"text-lg font-semibold cursor-pointer select-none mr-2"}," Add models for binding",-1)),cot={key:0,class:"text-base text-red-600 flex gap-3 items-center mr-2"},dot=Ce(()=>p("i",{"data-feather":"alert-triangle",class:"flex-shrink-0"},null,-1)),uot={key:1,class:"mr-2"},_ot={key:2,class:"text-base font-semibold cursor-pointer select-none items-center"},pot={class:"flex gap-1 items-center"},hot=["src"],fot={class:"font-bold font-large text-lg line-clamp-1"},mot={class:"mb-2"},got={class:"p-2"},Eot={class:"mb-3"},bot=Ce(()=>p("label",{class:"block mb-2 text-sm font-medium text-gray-900 dark:text-white"},"Create a reference from local file path:",-1)),Sot={key:0},yot={class:"mb-3"},vot=Ce(()=>p("label",{class:"block mb-2 text-sm font-medium text-gray-900 dark:text-white"},"Download from web:",-1)),Tot={key:1,class:"relative flex flex-col items-center justify-center flex-grow h-full"},xot=Ce(()=>p("div",{role:"status",class:"justify-center"},null,-1)),Cot={class:"relative flex flex-row flex-grow items-center w-full h-full bottom-0"},Rot={class:"w-full p-2"},Aot={class:"flex justify-between mb-1"},wot=Og(' Downloading Loading...',1),Oot={class:"text-sm font-medium text-blue-700 dark:text-white"},Not=["title"],Mot={class:"w-full bg-gray-200 rounded-full h-2.5 dark:bg-gray-700"},Iot={class:"flex justify-between mb-1"},Dot={class:"text-base font-medium text-blue-700 dark:text-white"},Lot={class:"text-sm font-medium text-blue-700 dark:text-white"},kot={class:"flex flex-grow"},Pot={class:"flex flex-row flex-grow gap-3"},Uot={class:"p-2 text-center grow"},Fot={class:"flex flex-col mb-2 rounded-lg bg-bg-light-tone dark:bg-bg-dark-tone hover:bg-bg-light-tone-panel hover:dark:bg-bg-dark-tone-panel duration-150 shadow-lg"},Bot={class:"flex flex-row p-3 items-center"},Got=Ce(()=>p("i",{"data-feather":"chevron-right"},null,-1)),zot=[Got],Vot=Ce(()=>p("i",{"data-feather":"chevron-down"},null,-1)),Hot=[Vot],qot=Ce(()=>p("h3",{class:"text-lg font-semibold cursor-pointer select-none mr-2"}," Personalities zoo",-1)),Yot={key:0,class:"mr-2"},$ot={class:"mr-2 font-bold font-large text-lg line-clamp-1"},Wot={key:1,class:"mr-2"},Kot={key:2,class:"text-base font-semibold cursor-pointer select-none items-center flex flex-row"},jot={key:0,class:"flex -space-x-4 items-center"},Qot={class:"group items-center flex flex-row"},Xot=["onClick"],Zot=["src","title"],Jot=["onClick"],eat=Ce(()=>p("span",{class:"hidden group-hover:block top-0 left-7 absolute active:scale-90 bg-bg-light dark:bg-bg-dark rounded-full border-2 border-transparent",title:"Unmount personality"},[p("svg",{"aria-hidden":"true",class:"w-4 h-4 text-red-600 hover:text-red-500",fill:"currentColor",viewBox:"0 0 20 20",xmlns:"http://www.w3.org/2000/svg"},[p("path",{"fill-rule":"evenodd",d:"M4.293 4.293a1 1 0 011.414 0L10 8.586l4.293-4.293a1 1 0 111.414 1.414L11.414 10l4.293 4.293a1 1 0 01-1.414 1.414L10 11.414l-4.293 4.293a1 1 0 01-1.414-1.414L8.586 10 4.293 5.707a1 1 0 010-1.414z","clip-rule":"evenodd"})])],-1)),tat=[eat],nat={class:"mx-2 mb-4"},iat=Ce(()=>p("label",{for:"personality-search",class:"mb-2 text-sm font-medium text-gray-900 sr-only dark:text-white"},"Search",-1)),rat={class:"relative"},sat={class:"absolute inset-y-0 left-0 flex items-center pl-3 pointer-events-none"},oat={key:0},aat=Ce(()=>p("div",{role:"status"},[p("svg",{"aria-hidden":"true",class:"inline w-4 h-4 mr-2 text-gray-200 animate-spin dark:text-gray-600 fill-blue-600",viewBox:"0 0 100 101",fill:"none",xmlns:"http://www.w3.org/2000/svg"},[p("path",{d:"M100 50.5908C100 78.2051 77.6142 100.591 50 100.591C22.3858 100.591 0 78.2051 0 50.5908C0 22.9766 22.3858 0.59082 50 0.59082C77.6142 0.59082 100 22.9766 100 50.5908ZM9.08144 50.5908C9.08144 73.1895 27.4013 91.5094 50 91.5094C72.5987 91.5094 90.9186 73.1895 90.9186 50.5908C90.9186 27.9921 72.5987 9.67226 50 9.67226C27.4013 9.67226 9.08144 27.9921 9.08144 50.5908Z",fill:"currentColor"}),p("path",{d:"M93.9676 39.0409C96.393 38.4038 97.8624 35.9116 97.0079 33.5539C95.2932 28.8227 92.871 24.3692 89.8167 20.348C85.8452 15.1192 80.8826 10.7238 75.2124 7.41289C69.5422 4.10194 63.2754 1.94025 56.7698 1.05124C51.7666 0.367541 46.6976 0.446843 41.7345 1.27873C39.2613 1.69328 37.813 4.19778 38.4501 6.62326C39.0873 9.04874 41.5694 10.4717 44.0505 10.1071C47.8511 9.54855 51.7191 9.52689 55.5402 10.0491C60.8642 10.7766 65.9928 12.5457 70.6331 15.2552C75.2735 17.9648 79.3347 21.5619 82.5849 25.841C84.9175 28.9121 86.7997 32.2913 88.1811 35.8758C89.083 38.2158 91.5421 39.6781 93.9676 39.0409Z",fill:"currentFill"})]),p("span",{class:"sr-only"},"Loading...")],-1)),lat=[aat],cat={key:1},dat=Ce(()=>p("svg",{"aria-hidden":"true",class:"w-5 h-5 text-gray-500 dark:text-gray-400",fill:"none",stroke:"currentColor",viewBox:"0 0 24 24",xmlns:"http://www.w3.org/2000/svg"},[p("path",{"stroke-linecap":"round","stroke-linejoin":"round","stroke-width":"2",d:"M21 21l-6-6m2-5a7 7 0 11-14 0 7 7 0 0114 0z"})],-1)),uat=[dat],_at={key:0,class:"mx-2 mb-4"},pat={for:"persCat",class:"block mb-2 text-sm font-medium text-gray-900 dark:text-white"},hat=["selected"],fat={key:0,class:"mb-2"},mat={for:"model",class:"block ml-2 mb-2 text-sm font-medium text-gray-900 dark:text-white"},gat=Ce(()=>p("i",{"data-feather":"chevron-up"},null,-1)),Eat=[gat],bat=Ce(()=>p("i",{"data-feather":"chevron-down"},null,-1)),Sat=[bat],yat={class:"flex flex-col mb-2 rounded-lg bg-bg-light-tone dark:bg-bg-dark-tone hover:bg-bg-light-tone-panel hover:dark:bg-bg-dark-tone-panel duration-150 shadow-lg"},vat={class:"flex flex-row p-3 items-center"},Tat=Ce(()=>p("i",{"data-feather":"chevron-right"},null,-1)),xat=[Tat],Cat=Ce(()=>p("i",{"data-feather":"chevron-down"},null,-1)),Rat=[Cat],Aat=Ce(()=>p("h3",{class:"text-lg font-semibold cursor-pointer select-none mr-2"}," Extensions zoo",-1)),wat={key:0,class:"mr-2"},Oat={key:1,class:"text-base font-semibold cursor-pointer select-none items-center flex flex-row"},Nat={key:0,class:"flex -space-x-4 items-center"},Mat={class:"group items-center flex flex-row"},Iat=["src","title"],Dat=["onClick"],Lat=Ce(()=>p("span",{class:"hidden group-hover:block top-0 left-7 absolute active:scale-90 bg-bg-light dark:bg-bg-dark rounded-full border-2 border-transparent",title:"Unmount personality"},[p("svg",{"aria-hidden":"true",class:"w-4 h-4 text-red-600 hover:text-red-500",fill:"currentColor",viewBox:"0 0 20 20",xmlns:"http://www.w3.org/2000/svg"},[p("path",{"fill-rule":"evenodd",d:"M4.293 4.293a1 1 0 011.414 0L10 8.586l4.293-4.293a1 1 0 111.414 1.414L11.414 10l4.293 4.293a1 1 0 01-1.414 1.414L10 11.414l-4.293 4.293a1 1 0 01-1.414-1.414L8.586 10 4.293 5.707a1 1 0 010-1.414z","clip-rule":"evenodd"})])],-1)),kat=[Lat],Pat={class:"mx-2 mb-4"},Uat=Ce(()=>p("label",{for:"personality-search",class:"mb-2 text-sm font-medium text-gray-900 sr-only dark:text-white"},"Search",-1)),Fat={class:"relative"},Bat={class:"absolute inset-y-0 left-0 flex items-center pl-3 pointer-events-none"},Gat={key:0},zat=Ce(()=>p("div",{role:"status"},[p("svg",{"aria-hidden":"true",class:"inline w-4 h-4 mr-2 text-gray-200 animate-spin dark:text-gray-600 fill-blue-600",viewBox:"0 0 100 101",fill:"none",xmlns:"http://www.w3.org/2000/svg"},[p("path",{d:"M100 50.5908C100 78.2051 77.6142 100.591 50 100.591C22.3858 100.591 0 78.2051 0 50.5908C0 22.9766 22.3858 0.59082 50 0.59082C77.6142 0.59082 100 22.9766 100 50.5908ZM9.08144 50.5908C9.08144 73.1895 27.4013 91.5094 50 91.5094C72.5987 91.5094 90.9186 73.1895 90.9186 50.5908C90.9186 27.9921 72.5987 9.67226 50 9.67226C27.4013 9.67226 9.08144 27.9921 9.08144 50.5908Z",fill:"currentColor"}),p("path",{d:"M93.9676 39.0409C96.393 38.4038 97.8624 35.9116 97.0079 33.5539C95.2932 28.8227 92.871 24.3692 89.8167 20.348C85.8452 15.1192 80.8826 10.7238 75.2124 7.41289C69.5422 4.10194 63.2754 1.94025 56.7698 1.05124C51.7666 0.367541 46.6976 0.446843 41.7345 1.27873C39.2613 1.69328 37.813 4.19778 38.4501 6.62326C39.0873 9.04874 41.5694 10.4717 44.0505 10.1071C47.8511 9.54855 51.7191 9.52689 55.5402 10.0491C60.8642 10.7766 65.9928 12.5457 70.6331 15.2552C75.2735 17.9648 79.3347 21.5619 82.5849 25.841C84.9175 28.9121 86.7997 32.2913 88.1811 35.8758C89.083 38.2158 91.5421 39.6781 93.9676 39.0409Z",fill:"currentFill"})]),p("span",{class:"sr-only"},"Loading...")],-1)),Vat=[zat],Hat={key:1},qat=Ce(()=>p("svg",{"aria-hidden":"true",class:"w-5 h-5 text-gray-500 dark:text-gray-400",fill:"none",stroke:"currentColor",viewBox:"0 0 24 24",xmlns:"http://www.w3.org/2000/svg"},[p("path",{"stroke-linecap":"round","stroke-linejoin":"round","stroke-width":"2",d:"M21 21l-6-6m2-5a7 7 0 11-14 0 7 7 0 0114 0z"})],-1)),Yat=[qat],$at={key:0,class:"mx-2 mb-4"},Wat={for:"extCat",class:"block mb-2 text-sm font-medium text-gray-900 dark:text-white"},Kat=["selected"],jat={key:0,class:"mb-2"},Qat={for:"model",class:"block ml-2 mb-2 text-sm font-medium text-gray-900 dark:text-white"},Xat=Ce(()=>p("i",{"data-feather":"chevron-up"},null,-1)),Zat=[Xat],Jat=Ce(()=>p("i",{"data-feather":"chevron-down"},null,-1)),elt=[Jat],tlt={class:"flex flex-col mb-2 rounded-lg bg-bg-light-tone dark:bg-bg-dark-tone hover:bg-bg-light-tone-panel hover:dark:bg-bg-dark-tone-panel duration-150 shadow-lg"},nlt={class:"flex flex-row p-3 items-center"},ilt=Ce(()=>p("i",{"data-feather":"chevron-right"},null,-1)),rlt=[ilt],slt=Ce(()=>p("i",{"data-feather":"chevron-down"},null,-1)),olt=[slt],alt=Ce(()=>p("h3",{class:"text-lg font-semibold cursor-pointer select-none mr-2"}," Mounted Extensions Priority",-1)),llt={class:"flex flex-col mb-2 p-3 rounded-lg bg-bg-light-tone dark:bg-bg-dark-tone hover:bg-bg-light-tone-panel hover:dark:bg-bg-dark-tone-panel duration-150 shadow-lg"},clt={class:"flex flex-row"},dlt=Ce(()=>p("i",{"data-feather":"chevron-right"},null,-1)),ult=[dlt],_lt=Ce(()=>p("i",{"data-feather":"chevron-down"},null,-1)),plt=[_lt],hlt=Ce(()=>p("h3",{class:"text-lg font-semibold cursor-pointer select-none"}," Model Configuration",-1)),flt={class:"m-2"},mlt={class:"flex flex-row gap-2 items-center"},glt=Ce(()=>p("label",{for:"override-model-parameters",class:"block text-sm font-medium"}," Override personality model parameters ",-1)),Elt={class:"m-2"},blt=Ce(()=>p("label",{for:"seed",class:"block mb-2 text-sm font-medium"}," Seed: ",-1)),Slt={class:"m-2"},ylt={class:"flex flex-col align-bottom"},vlt={class:"relative"},Tlt=Ce(()=>p("p",{class:"absolute left-0 mt-6"},[p("label",{for:"temperature",class:"text-sm font-medium"}," Temperature: ")],-1)),xlt={class:"absolute right-0"},Clt={class:"m-2"},Rlt={class:"flex flex-col align-bottom"},Alt={class:"relative"},wlt=Ce(()=>p("p",{class:"absolute left-0 mt-6"},[p("label",{for:"predict",class:"text-sm font-medium"}," N Predict: ")],-1)),Olt={class:"absolute right-0"},Nlt={class:"m-2"},Mlt={class:"flex flex-col align-bottom"},Ilt={class:"relative"},Dlt=Ce(()=>p("p",{class:"absolute left-0 mt-6"},[p("label",{for:"top_k",class:"text-sm font-medium"}," Top-K: ")],-1)),Llt={class:"absolute right-0"},klt={class:"m-2"},Plt={class:"flex flex-col align-bottom"},Ult={class:"relative"},Flt=Ce(()=>p("p",{class:"absolute left-0 mt-6"},[p("label",{for:"top_p",class:"text-sm font-medium"}," Top-P: ")],-1)),Blt={class:"absolute right-0"},Glt={class:"m-2"},zlt={class:"flex flex-col align-bottom"},Vlt={class:"relative"},Hlt=Ce(()=>p("p",{class:"absolute left-0 mt-6"},[p("label",{for:"repeat_penalty",class:"text-sm font-medium"}," Repeat penalty: ")],-1)),qlt={class:"absolute right-0"},Ylt={class:"m-2"},$lt={class:"flex flex-col align-bottom"},Wlt={class:"relative"},Klt=Ce(()=>p("p",{class:"absolute left-0 mt-6"},[p("label",{for:"repeat_last_n",class:"text-sm font-medium"}," Repeat last N: ")],-1)),jlt={class:"absolute right-0"};function Qlt(n,e,t,i,r,s){const o=St("Card"),a=St("BindingEntry"),l=St("RadioOptions"),c=St("model-entry"),d=St("personality-entry"),u=St("ExtensionEntry"),_=St("AddModelDialog"),f=St("ChoiceDialog");return M(),L(Xe,null,[p("div",jtt,[p("div",Qtt,[r.showConfirmation?(M(),L("div",Xtt,[p("button",{class:"text-2xl hover:text-red-600 duration-75 active:scale-90",title:"Cancel",type:"button",onClick:e[0]||(e[0]=Oe(h=>r.showConfirmation=!1,["stop"]))},Jtt),p("button",{class:"text-2xl hover:text-secondary duration-75 active:scale-90",title:"Confirm save changes",type:"button",onClick:e[1]||(e[1]=Oe(h=>s.save_configuration(),["stop"]))},tnt)])):X("",!0),r.showConfirmation?X("",!0):(M(),L("div",nnt,[p("button",{title:"Save configuration",class:"text-2xl hover:text-secondary duration-75 active:scale-90",onClick:e[2]||(e[2]=h=>r.showConfirmation=!0)},rnt),p("button",{title:"Reset configuration",class:"text-2xl hover:text-secondary duration-75 active:scale-90",onClick:e[3]||(e[3]=h=>s.reset_configuration())},ont),p("button",{class:"text-2xl hover:text-secondary duration-75 active:scale-90",title:"Collapse / Expand all panels",type:"button",onClick:e[4]||(e[4]=Oe(h=>r.all_collapsed=!r.all_collapsed,["stop"]))},lnt)])),p("div",cnt,[p("button",{title:"Clear uploads",class:"text-2xl hover:text-secondary duration-75 active:scale-90",onClick:e[5]||(e[5]=h=>s.api_get_req("clear_uploads").then(E=>{E.status?this.$store.state.toast.showToast("Success!",4,!0):this.$store.state.toast.showToast(["failed!"],4,!1)}))},unt),p("button",{title:"Restart program",class:"text-2xl hover:text-secondary duration-75 active:scale-90",onClick:e[6]||(e[6]=h=>s.api_get_req("restart_program").then(E=>{E.status?this.$store.state.toast.showToast("Success!",4,!0):this.$store.state.toast.showToast(["failed!"],4,!1)}))},pnt),p("button",{title:"Upgrade program ",class:"text-2xl hover:text-secondary duration-75 active:scale-90",onClick:e[7]||(e[7]=h=>s.api_get_req("update_software").then(E=>{E.status?this.$store.state.toast.showToast("Success!",4,!0):this.$store.state.toast.showToast("Success!",4,!0)}))},[hnt,r.has_updates?(M(),L("div",fnt,gnt)):X("",!0)]),p("div",Ent,[r.settingsChanged?(M(),L("div",bnt,[Snt,r.isLoading?X("",!0):(M(),L("button",{key:0,class:"text-2xl hover:text-secondary duration-75 active:scale-90",title:"Apply changes",type:"button",onClick:e[8]||(e[8]=Oe(h=>s.applyConfiguration(),["stop"]))},vnt))])):X("",!0),r.isLoading?(M(),L("div",Tnt,[p("p",null,me(r.loading_text),1),xnt,Cnt])):X("",!0)])])]),p("div",{class:Ke(r.isLoading?"pointer-events-none opacity-30 w-full":"w-full")},[p("div",Rnt,[p("div",Ant,[p("button",{onClick:e[9]||(e[9]=Oe(h=>r.sc_collapsed=!r.sc_collapsed,["stop"])),class:"text-2xl hover:text-primary p-2 -m-2 w-full text-left flex flex-row items-center"},[Ae(p("div",null,Ont,512),[[At,r.sc_collapsed]]),Ae(p("div",null,Mnt,512),[[At,!r.sc_collapsed]]),Int,Dnt,p("div",Lnt,[p("div",knt,[p("div",null,[s.vramUsage&&s.vramUsage.gpus&&s.vramUsage.gpus.length==1?(M(),L("div",Pnt,[(M(!0),L(Xe,null,bt(s.vramUsage.gpus,h=>(M(),L("div",Unt,[p("img",{src:r.SVGGPU,width:"25",height:"25"},null,8,Fnt),p("h3",Bnt,[p("div",null,me(s.computedFileSize(h.used_vram))+" / "+me(s.computedFileSize(h.total_vram))+" ("+me(h.percentage)+"%) ",1)])]))),256))])):X("",!0),s.vramUsage&&s.vramUsage.gpus&&s.vramUsage.gpus.length>1?(M(),L("div",Gnt,[p("div",znt,[p("img",{src:r.SVGGPU,width:"25",height:"25"},null,8,Vnt),p("h3",Hnt,[p("div",null,me(s.vramUsage.gpus.length)+"x ",1)])])])):X("",!0)]),qnt,p("h3",Ynt,[p("div",null,me(s.ram_usage)+" / "+me(s.ram_total_space)+" ("+me(s.ram_percent_usage)+"%)",1)]),$nt,p("h3",Wnt,[p("div",null,me(s.disk_binding_models_usage)+" / "+me(s.disk_total_space)+" ("+me(s.disk_percent_usage)+"%)",1)])])])])]),p("div",{class:Ke([{hidden:r.sc_collapsed},"flex flex-col mb-2 px-3 pb-0"])},[p("div",Knt,[jnt,p("div",Qnt,[p("div",null,[Xnt,$e(me(s.ram_available_space),1)]),p("div",null,[Znt,$e(" "+me(s.ram_usage)+" / "+me(s.ram_total_space)+" ("+me(s.ram_percent_usage)+")% ",1)])]),p("div",Jnt,[p("div",eit,[p("div",{class:"bg-blue-600 h-2.5 rounded-full",style:un("width: "+s.ram_percent_usage+"%;")},null,4)])])]),p("div",tit,[nit,p("div",iit,[p("div",null,[rit,$e(me(s.disk_available_space),1)]),p("div",null,[sit,$e(" "+me(s.disk_binding_models_usage)+" / "+me(s.disk_total_space)+" ("+me(s.disk_percent_usage)+"%)",1)])]),p("div",oit,[p("div",ait,[p("div",{class:"bg-blue-600 h-2.5 rounded-full",style:un("width: "+s.disk_percent_usage+"%;")},null,4)])])]),(M(!0),L(Xe,null,bt(s.vramUsage.gpus,h=>(M(),L("div",lit,[p("label",cit,[p("img",{src:r.SVGGPU,width:"25",height:"25"},null,8,dit),$e(" GPU usage: ")]),p("div",uit,[p("div",null,[_it,$e(me(h.gpu_model),1)]),p("div",null,[pit,$e(me(this.computedFileSize(h.available_space)),1)]),p("div",null,[hit,$e(" "+me(this.computedFileSize(h.used_vram))+" / "+me(this.computedFileSize(h.total_vram))+" ("+me(h.percentage)+"%)",1)])]),p("div",fit,[p("div",mit,[p("div",{class:"bg-blue-600 h-2.5 rounded-full",style:un("width: "+h.percentage+"%;")},null,4)])])]))),256))],2)]),p("div",git,[p("div",Eit,[p("button",{onClick:e[10]||(e[10]=Oe(h=>r.minconf_collapsed=!r.minconf_collapsed,["stop"])),class:"text-2xl hover:text-primary p-2 -m-2 w-full text-left flex flex-row items-center"},[Ae(p("div",null,Sit,512),[[At,r.minconf_collapsed]]),Ae(p("div",null,vit,512),[[At,!r.minconf_collapsed]]),Tit])]),p("div",{class:Ke([{hidden:r.minconf_collapsed},"flex flex-col mb-2 px-3 pb-0"])},[p("div",xit,[Le(o,{title:"General",is_subcard:!0,class:"pb-2 m-2"},{default:dt(()=>[p("table",Cit,[p("tr",null,[Rit,p("td",Ait,[Ae(p("input",{type:"text",id:"host",required:"","onUpdate:modelValue":e[11]||(e[11]=h=>s.configFile.host=h),onChange:e[12]||(e[12]=h=>r.settingsChanged=!0),class:"w-full w-full mt-1 px-2 py-1 border border-gray-300 rounded dark:bg-gray-600 dark:bg-gray-600"},null,544),[[Je,s.configFile.host]])])]),p("tr",null,[wit,p("td",Oit,[Ae(p("input",{type:"number",step:"1",id:"port",required:"","onUpdate:modelValue":e[13]||(e[13]=h=>s.configFile.port=h),onChange:e[14]||(e[14]=h=>r.settingsChanged=!0),class:"w-full w-full mt-1 px-2 py-1 border border-gray-300 rounded dark:bg-gray-600 dark:bg-gray-600"},null,544),[[Je,s.configFile.port]])])]),p("tr",null,[Nit,p("td",Mit,[Ae(p("input",{type:"text",id:"db_path",required:"","onUpdate:modelValue":e[15]||(e[15]=h=>s.configFile.db_path=h),onChange:e[16]||(e[16]=h=>r.settingsChanged=!0),class:"w-full w-full mt-1 px-2 py-1 border border-gray-300 rounded dark:bg-gray-600 dark:bg-gray-600"},null,544),[[Je,s.configFile.db_path]])])]),p("tr",null,[Iit,p("td",null,[p("div",Dit,[Ae(p("input",{type:"checkbox",id:"auto_show_browser",required:"","onUpdate:modelValue":e[17]||(e[17]=h=>s.configFile.auto_show_browser=h),onChange:e[18]||(e[18]=h=>r.settingsChanged=!0),class:"m-2 h-50 w-50 py-1 border border-gray-300 rounded dark:bg-gray-600"},null,544),[[Mt,s.configFile.auto_show_browser]])])])]),p("tr",null,[Lit,p("td",null,[p("div",kit,[Ae(p("input",{type:"checkbox",id:"activate_debug",required:"","onUpdate:modelValue":e[19]||(e[19]=h=>s.configFile.debug=h),onChange:e[20]||(e[20]=h=>r.settingsChanged=!0),class:"m-2 h-50 w-50 py-1 border border-gray-300 rounded dark:bg-gray-600"},null,544),[[Mt,s.configFile.debug]])])])]),p("tr",null,[Pit,p("td",Uit,[p("div",Fit,[Ae(p("input",{type:"checkbox",id:"enable_gpu",required:"","onUpdate:modelValue":e[21]||(e[21]=h=>s.configFile.enable_gpu=h),onChange:e[22]||(e[22]=h=>r.settingsChanged=!0),class:"m-2 h-50 w-50 py-1 border border-gray-300 rounded dark:bg-gray-600"},null,544),[[Mt,s.configFile.enable_gpu]]),s.configFile.enable_gpu?X("",!0):(M(),L("button",{key:0,onClick:e[23]||(e[23]=Oe((...h)=>s.upgrade2GPU&&s.upgrade2GPU(...h),["prevent"])),class:"w-100 text-center rounded m-2 bg-blue-300 hover:bg-blue-200 text-l hover:text-primary p-2 m-2 text-left flex flex-row"}," Upgrade from CPU to GPU "))])])]),p("tr",null,[Bit,p("td",null,[p("div",Git,[Ae(p("input",{type:"checkbox",id:"auto_save",required:"","onUpdate:modelValue":e[24]||(e[24]=h=>s.configFile.auto_save=h),onChange:e[25]||(e[25]=h=>r.settingsChanged=!0),class:"mt-1 px-2 py-1 border border-gray-300 rounded dark:bg-gray-600"},null,544),[[Mt,s.configFile.auto_save]])])])]),p("tr",null,[zit,p("td",null,[p("div",Vit,[Ae(p("input",{type:"checkbox",id:"auto_update",required:"","onUpdate:modelValue":e[26]||(e[26]=h=>s.configFile.auto_update=h),onChange:e[27]||(e[27]=h=>r.settingsChanged=!0),class:"mt-1 px-2 py-1 border border-gray-300 rounded dark:bg-gray-600"},null,544),[[Mt,s.configFile.auto_update]])])])]),p("tr",null,[Hit,p("td",null,[p("div",qit,[Ae(p("input",{type:"checkbox",id:"auto_title",required:"","onUpdate:modelValue":e[28]||(e[28]=h=>s.configFile.auto_title=h),onChange:e[29]||(e[29]=h=>r.settingsChanged=!0),class:"mt-1 px-2 py-1 border border-gray-300 rounded dark:bg-gray-600"},null,544),[[Mt,s.configFile.auto_title]])])])])])]),_:1}),Le(o,{title:"User",is_subcard:!0,class:"pb-2 m-2"},{default:dt(()=>[p("table",Yit,[p("tr",null,[$it,p("td",Wit,[Ae(p("input",{type:"text",id:"user_name",required:"","onUpdate:modelValue":e[30]||(e[30]=h=>s.configFile.user_name=h),onChange:e[31]||(e[31]=h=>r.settingsChanged=!0),class:"w-full w-full mt-1 px-2 py-1 border border-gray-300 rounded dark:bg-gray-600"},null,544),[[Je,s.configFile.user_name]])])]),p("tr",null,[Kit,p("td",jit,[Ae(p("textarea",{id:"user_description",required:"","onUpdate:modelValue":e[32]||(e[32]=h=>s.configFile.user_description=h),onChange:e[33]||(e[33]=h=>r.settingsChanged=!0),class:"w-full w-full mt-1 px-2 py-1 border border-gray-300 rounded dark:bg-gray-600"},null,544),[[Je,s.configFile.user_description]])])]),p("tr",null,[Qit,p("td",Xit,[Ae(p("input",{type:"checkbox",id:"override_personality_model_parameters",required:"","onUpdate:modelValue":e[34]||(e[34]=h=>s.configFile.override_personality_model_parameters=h),onChange:e[35]||(e[35]=h=>r.settingsChanged=!0),class:"mt-1 px-2 py-1 border border-gray-300 rounded dark:bg-gray-600"},null,544),[[Mt,s.configFile.override_personality_model_parameters]])])]),p("tr",null,[Zit,p("td",Jit,[p("label",ert,[p("img",{src:"/user_infos/"+s.configFile.user_avatar,class:"w-50 h-50 rounded-full",style:{"max-width":"50px","max-height":"50px",cursor:"pointer"}},null,8,trt)]),p("input",{type:"file",id:"avatar-upload",style:{display:"none"},onChange:e[36]||(e[36]=(...h)=>s.uploadAvatar&&s.uploadAvatar(...h))},null,32)])]),p("tr",null,[nrt,p("td",null,[p("div",irt,[Ae(p("input",{type:"checkbox",id:"use_user_name_in_discussions",required:"","onUpdate:modelValue":e[37]||(e[37]=h=>s.configFile.use_user_name_in_discussions=h),onChange:e[38]||(e[38]=h=>r.settingsChanged=!0),class:"mt-1 px-2 py-1 border border-gray-300 rounded dark:bg-gray-600"},null,544),[[Mt,s.configFile.use_user_name_in_discussions]])])])]),p("tr",null,[rrt,p("td",srt,[Ae(p("input",{type:"number",id:"min_n_predict",required:"","onUpdate:modelValue":e[39]||(e[39]=h=>s.configFile.min_n_predict=h),onChange:e[40]||(e[40]=h=>r.settingsChanged=!0),class:"mt-1 px-2 py-1 border border-gray-300 rounded dark:bg-gray-600"},null,544),[[Je,s.configFile.min_n_predict]])])])])]),_:1}),Le(o,{title:"Data Vectorization",is_subcard:!0,class:"pb-2 m-2"},{default:dt(()=>[p("table",ort,[p("tr",null,[art,p("td",null,[p("div",lrt,[Ae(p("input",{type:"checkbox",id:"use_files",required:"","onUpdate:modelValue":e[41]||(e[41]=h=>s.configFile.use_files=h),onChange:e[42]||(e[42]=h=>r.settingsChanged=!0),class:"mt-1 px-2 py-1 border border-gray-300 rounded dark:bg-gray-600"},null,544),[[Mt,s.configFile.use_files]])])])]),p("tr",null,[crt,p("td",null,[p("div",drt,[Ae(p("input",{type:"checkbox",id:"use_discussions_history",required:"","onUpdate:modelValue":e[43]||(e[43]=h=>s.configFile.use_discussions_history=h),onChange:e[44]||(e[44]=h=>r.settingsChanged=!0),class:"mt-1 px-2 py-1 border border-gray-300 rounded dark:bg-gray-600"},null,544),[[Mt,s.configFile.use_discussions_history]])])])]),p("tr",null,[urt,p("td",null,[p("div",_rt,[Ae(p("input",{type:"checkbox",id:"summerize_discussion",required:"","onUpdate:modelValue":e[45]||(e[45]=h=>s.configFile.summerize_discussion=h),onChange:e[46]||(e[46]=h=>r.settingsChanged=!0),class:"mt-1 px-2 py-1 border border-gray-300 rounded dark:bg-gray-600"},null,544),[[Mt,s.configFile.summerize_discussion]])])])]),p("tr",null,[prt,p("td",null,[p("div",hrt,[Ae(p("input",{type:"checkbox",id:"data_vectorization_visualize_on_vectorization",required:"","onUpdate:modelValue":e[47]||(e[47]=h=>s.configFile.data_vectorization_visualize_on_vectorization=h),onChange:e[48]||(e[48]=h=>r.settingsChanged=!0),class:"mt-1 px-2 py-1 border border-gray-300 rounded dark:bg-gray-600"},null,544),[[Mt,s.configFile.data_vectorization_visualize_on_vectorization]])])])]),p("tr",null,[frt,p("td",null,[p("div",mrt,[Ae(p("input",{type:"checkbox",id:"data_vectorization_activate",required:"","onUpdate:modelValue":e[49]||(e[49]=h=>s.configFile.data_vectorization_activate=h),onChange:e[50]||(e[50]=h=>r.settingsChanged=!0),class:"mt-1 px-2 py-1 border border-gray-300 rounded dark:bg-gray-600"},null,544),[[Mt,s.configFile.data_vectorization_activate]])])])]),p("tr",null,[grt,p("td",null,[p("div",Ert,[Ae(p("input",{type:"checkbox",id:"data_vectorization_build_keys_words",required:"","onUpdate:modelValue":e[51]||(e[51]=h=>s.configFile.data_vectorization_build_keys_words=h),onChange:e[52]||(e[52]=h=>r.settingsChanged=!0),class:"mt-1 px-2 py-1 border border-gray-300 rounded dark:bg-gray-600"},null,544),[[Mt,s.configFile.data_vectorization_build_keys_words]])])])]),p("tr",null,[brt,p("td",null,[Ae(p("select",{id:"data_vectorization_method",required:"","onUpdate:modelValue":e[53]||(e[53]=h=>s.configFile.data_vectorization_method=h),onChange:e[54]||(e[54]=h=>r.settingsChanged=!0),class:"w-full mt-1 px-2 py-1 border border-gray-300 rounded dark:bg-gray-600"},vrt,544),[[_i,s.configFile.data_vectorization_method]])])]),p("tr",null,[Trt,p("td",null,[Ae(p("select",{id:"data_visualization_method",required:"","onUpdate:modelValue":e[55]||(e[55]=h=>s.configFile.data_visualization_method=h),onChange:e[56]||(e[56]=h=>r.settingsChanged=!0),class:"w-full mt-1 px-2 py-1 border border-gray-300 rounded dark:bg-gray-600"},Rrt,544),[[_i,s.configFile.data_visualization_method]])])]),p("tr",null,[Art,p("td",null,[p("div",wrt,[Ae(p("input",{type:"checkbox",id:"data_vectorization_save_db",required:"","onUpdate:modelValue":e[57]||(e[57]=h=>s.configFile.data_vectorization_save_db=h),onChange:e[58]||(e[58]=h=>r.settingsChanged=!0),class:"mt-1 px-2 py-1 border border-gray-300 rounded dark:bg-gray-600"},null,544),[[Mt,s.configFile.data_vectorization_save_db]])])])]),p("tr",null,[Ort,p("td",null,[Ae(p("input",{id:"data_vectorization_chunk_size","onUpdate:modelValue":e[59]||(e[59]=h=>s.configFile.data_vectorization_chunk_size=h),onChange:e[60]||(e[60]=h=>r.settingsChanged=!0),type:"range",min:"0",max:"64000",step:"1",class:"flex-none h-2 mt-14 mb-2 w-full bg-gray-200 rounded-lg appearance-none cursor-pointer dark:bg-gray-700 focus:ring-blue-500 focus:border-blue-500 dark:border-gray-600 dark:placeholder-gray-400 dark:focus:ring-blue-500 dark:focus:border-blue-500"},null,544),[[Je,s.configFile.data_vectorization_chunk_size]]),Ae(p("input",{"onUpdate:modelValue":e[61]||(e[61]=h=>s.configFile.data_vectorization_chunk_size=h),type:"number",onChange:e[62]||(e[62]=h=>r.settingsChanged=!0),class:"w-full mt-1 px-2 py-1 border border-gray-300 rounded dark:bg-gray-600"},null,544),[[Je,s.configFile.data_vectorization_chunk_size]])])]),p("tr",null,[Nrt,p("td",null,[Ae(p("input",{id:"data_vectorization_overlap_size","onUpdate:modelValue":e[63]||(e[63]=h=>s.configFile.data_vectorization_overlap_size=h),onChange:e[64]||(e[64]=h=>r.settingsChanged=!0),type:"range",min:"0",max:"64000",step:"1",class:"flex-none h-2 mt-14 mb-2 w-full bg-gray-200 rounded-lg appearance-none cursor-pointer dark:bg-gray-700 focus:ring-blue-500 focus:border-blue-500 dark:border-gray-600 dark:placeholder-gray-400 dark:focus:ring-blue-500 dark:focus:border-blue-500"},null,544),[[Je,s.configFile.data_vectorization_overlap_size]]),Ae(p("input",{"onUpdate:modelValue":e[65]||(e[65]=h=>s.configFile.data_vectorization_overlap_size=h),type:"number",onChange:e[66]||(e[66]=h=>r.settingsChanged=!0),class:"w-full mt-1 px-2 py-1 border border-gray-300 rounded dark:bg-gray-600"},null,544),[[Je,s.configFile.data_vectorization_overlap_size]])])]),p("tr",null,[Mrt,p("td",null,[Ae(p("input",{id:"data_vectorization_nb_chunks","onUpdate:modelValue":e[67]||(e[67]=h=>s.configFile.data_vectorization_nb_chunks=h),onChange:e[68]||(e[68]=h=>r.settingsChanged=!0),type:"range",min:"0",max:"1000",step:"1",class:"flex-none h-2 mt-14 mb-2 w-full bg-gray-200 rounded-lg appearance-none cursor-pointer dark:bg-gray-700 focus:ring-blue-500 focus:border-blue-500 dark:border-gray-600 dark:placeholder-gray-400 dark:focus:ring-blue-500 dark:focus:border-blue-500"},null,544),[[Je,s.configFile.data_vectorization_nb_chunks]]),Ae(p("input",{"onUpdate:modelValue":e[69]||(e[69]=h=>s.configFile.data_vectorization_nb_chunks=h),type:"number",onChange:e[70]||(e[70]=h=>r.settingsChanged=!0),class:"w-full mt-1 px-2 py-1 border border-gray-300 rounded dark:bg-gray-600"},null,544),[[Je,s.configFile.data_vectorization_nb_chunks]])])])])]),_:1}),Le(o,{title:"Audio",is_subcard:!0,class:"pb-2 m-2"},{default:dt(()=>[p("table",Irt,[p("tr",null,[Drt,p("td",null,[p("div",Lrt,[Ae(p("input",{type:"checkbox",id:"audio_auto_send_input",required:"","onUpdate:modelValue":e[71]||(e[71]=h=>s.configFile.audio_auto_send_input=h),onChange:e[72]||(e[72]=h=>r.settingsChanged=!0),class:"mt-1 px-2 py-1 border border-gray-300 rounded dark:bg-gray-600"},null,544),[[Mt,s.configFile.audio_auto_send_input]])])])]),p("tr",null,[krt,p("td",null,[p("div",Prt,[Ae(p("input",{type:"checkbox",id:"auto_speak",required:"","onUpdate:modelValue":e[73]||(e[73]=h=>s.configFile.auto_speak=h),onChange:e[74]||(e[74]=h=>r.settingsChanged=!0),class:"mt-1 px-2 py-1 border border-gray-300 rounded dark:bg-gray-600"},null,544),[[Mt,s.configFile.auto_speak]])])])]),p("tr",null,[Urt,p("td",null,[p("div",Frt,[Ae(p("input",{type:"checkbox",id:"enable_voice_service",required:"","onUpdate:modelValue":e[75]||(e[75]=h=>s.configFile.enable_voice_service=h),onChange:e[76]||(e[76]=h=>r.settingsChanged=!0),class:"mt-1 px-2 py-1 border border-gray-300 rounded dark:bg-gray-600"},null,544),[[Mt,s.configFile.enable_voice_service]])])])]),p("tr",null,[Brt,p("td",null,[p("div",Grt,[Ae(p("select",{"onUpdate:modelValue":e[77]||(e[77]=h=>s.current_voice=h),onChange:e[78]||(e[78]=h=>r.settingsChanged=!0),disabled:!s.enable_voice_service},[(M(!0),L(Xe,null,bt(r.voices,h=>(M(),L("option",{key:h.id,value:h.id},me(h),9,Vrt))),128))],40,zrt),[[_i,s.current_voice]])])])]),p("tr",null,[Hrt,p("td",null,[p("div",qrt,[Ae(p("input",{type:"checkbox",id:"auto_read",required:"","onUpdate:modelValue":e[79]||(e[79]=h=>s.configFile.auto_read=h),onChange:e[80]||(e[80]=h=>r.settingsChanged=!0),class:"mt-1 px-2 py-1 border border-gray-300 rounded dark:bg-gray-600",disabled:!s.enable_voice_service},null,40,Yrt),[[Mt,s.configFile.auto_read]])])])]),p("tr",null,[$rt,p("td",null,[Ae(p("input",{id:"audio_pitch","onUpdate:modelValue":e[81]||(e[81]=h=>s.configFile.audio_pitch=h),onChange:e[82]||(e[82]=h=>r.settingsChanged=!0),type:"range",min:"0",max:"10",step:"0.1",class:"flex-none h-2 mt-14 mb-2 w-full bg-gray-200 rounded-lg appearance-none cursor-pointer dark:bg-gray-700 focus:ring-blue-500 focus:border-blue-500 dark:border-gray-600 dark:placeholder-gray-400 dark:focus:ring-blue-500 dark:focus:border-blue-500"},null,544),[[Je,s.configFile.audio_pitch]]),Ae(p("input",{"onUpdate:modelValue":e[83]||(e[83]=h=>s.configFile.audio_pitch=h),onChange:e[84]||(e[84]=h=>r.settingsChanged=!0),class:"w-full mt-1 px-2 py-1 border border-gray-300 rounded dark:bg-gray-600"},null,544),[[Je,s.configFile.audio_pitch]])])]),p("tr",null,[Wrt,p("td",null,[Ae(p("input",{id:"audio_silenceTimer","onUpdate:modelValue":e[85]||(e[85]=h=>s.configFile.audio_silenceTimer=h),onChange:e[86]||(e[86]=h=>r.settingsChanged=!0),type:"range",min:"0",max:"10000",step:"1",class:"flex-none h-2 mt-14 mb-2 w-full bg-gray-200 rounded-lg appearance-none cursor-pointer dark:bg-gray-700 focus:ring-blue-500 focus:border-blue-500 dark:border-gray-600 dark:placeholder-gray-400 dark:focus:ring-blue-500 dark:focus:border-blue-500"},null,544),[[Je,s.configFile.audio_silenceTimer]]),Ae(p("input",{"onUpdate:modelValue":e[87]||(e[87]=h=>s.configFile.audio_silenceTimer=h),onChange:e[88]||(e[88]=h=>r.settingsChanged=!0),class:"w-full mt-1 px-2 py-1 border border-gray-300 rounded dark:bg-gray-600"},null,544),[[Je,s.configFile.audio_silenceTimer]])])]),p("tr",null,[Krt,p("td",null,[Ae(p("select",{id:"audio_in_language","onUpdate:modelValue":e[89]||(e[89]=h=>s.configFile.audio_in_language=h),onChange:e[90]||(e[90]=h=>r.settingsChanged=!0),class:"w-full mt-1 px-2 py-1 border border-gray-300 rounded dark:bg-gray-600"},[(M(!0),L(Xe,null,bt(s.audioLanguages,h=>(M(),L("option",{key:h.code,value:h.code},me(h.name),9,jrt))),128))],544),[[_i,s.configFile.audio_in_language]])])]),p("tr",null,[Qrt,p("td",null,[Ae(p("select",{id:"audio_out_voice","onUpdate:modelValue":e[91]||(e[91]=h=>s.configFile.audio_out_voice=h),onChange:e[92]||(e[92]=h=>r.settingsChanged=!0),class:"w-full mt-1 px-2 py-1 border border-gray-300 rounded dark:bg-gray-600"},[(M(!0),L(Xe,null,bt(r.audioVoices,h=>(M(),L("option",{key:h.name,value:h.name},me(h.name),9,Xrt))),128))],544),[[_i,s.configFile.audio_out_voice]])])])])]),_:1})])],2)]),p("div",Zrt,[p("div",Jrt,[p("button",{onClick:e[93]||(e[93]=Oe(h=>r.bzc_collapsed=!r.bzc_collapsed,["stop"])),class:"text-2xl hover:text-primary p-2 -m-2 w-full text-left flex flex-row items-center"},[Ae(p("div",null,tst,512),[[At,r.bzc_collapsed]]),Ae(p("div",null,ist,512),[[At,!r.bzc_collapsed]]),rst,s.configFile.binding_name?X("",!0):(M(),L("div",sst,[ost,$e(" No binding selected! ")])),s.configFile.binding_name?(M(),L("div",ast,"|")):X("",!0),s.configFile.binding_name?(M(),L("div",lst,[p("div",cst,[p("img",{src:s.imgBinding,class:"w-8 h-8 rounded-full object-fill text-blue-700"},null,8,dst),p("h3",ust,me(s.binding_name),1)])])):X("",!0)])]),p("div",{class:Ke([{hidden:r.bzc_collapsed},"flex flex-col mb-2 px-3 pb-0"])},[s.bindingsZoo&&s.bindingsZoo.length>0?(M(),L("div",_st,[p("label",pst," Bindings: ("+me(s.bindingsZoo.length)+") ",1),p("div",{class:Ke(["overflow-y-auto no-scrollbar p-2 pb-0 grid lg:grid-cols-3 md:grid-cols-2 gap-4",r.bzl_collapsed?"":"max-h-96"])},[Le(Vr,{name:"list"},{default:dt(()=>[(M(!0),L(Xe,null,bt(s.bindingsZoo,(h,E)=>(M(),Qt(a,{ref_for:!0,ref:"bindingZoo",key:"index-"+E+"-"+h.folder,binding:h,"on-selected":s.onBindingSelected,"on-reinstall":s.onReinstallBinding,"on-unInstall":s.onUnInstallBinding,"on-install":s.onInstallBinding,"on-settings":s.onSettingsBinding,"on-reload-binding":s.onReloadBinding,selected:h.folder===s.configFile.binding_name},null,8,["binding","on-selected","on-reinstall","on-unInstall","on-install","on-settings","on-reload-binding","selected"]))),128))]),_:1})],2)])):X("",!0),r.bzl_collapsed?(M(),L("button",{key:1,class:"text-2xl hover:text-secondary duration-75 flex justify-center hover:bg-bg-light-tone hover:dark:bg-bg-dark-tone rounded-lg",title:"Collapse",type:"button",onClick:e[94]||(e[94]=h=>r.bzl_collapsed=!r.bzl_collapsed)},fst)):(M(),L("button",{key:2,class:"text-2xl hover:text-secondary duration-75 flex justify-center hover:bg-bg-light-tone hover:dark:bg-bg-dark-tone rounded-lg",title:"Expand",type:"button",onClick:e[95]||(e[95]=h=>r.bzl_collapsed=!r.bzl_collapsed)},gst))],2)]),p("div",Est,[p("div",bst,[p("button",{onClick:e[96]||(e[96]=Oe(h=>s.modelsZooToggleCollapse(),["stop"])),class:"text-2xl hover:text-primary p-2 -m-2 w-full text-left flex items-center"},[Ae(p("div",null,yst,512),[[At,r.mzc_collapsed]]),Ae(p("div",null,Tst,512),[[At,!r.mzc_collapsed]]),xst,p("div",Cst,[s.configFile.binding_name?X("",!0):(M(),L("div",Rst,[Ast,$e(" Select binding first! ")])),!r.isModelSelected&&s.configFile.binding_name?(M(),L("div",wst,[Ost,$e(" No model selected! ")])):X("",!0),s.configFile.model_name?(M(),L("div",Nst,"|")):X("",!0),s.configFile.model_name?(M(),L("div",Mst,[p("div",Ist,[p("img",{src:s.imgModel,class:"w-8 h-8 rounded-lg object-fill"},null,8,Dst),p("h3",Lst,me(s.configFile.model_name),1)])])):X("",!0)])])]),p("div",{class:Ke([{hidden:r.mzc_collapsed},"flex flex-col mb-2 px-3 pb-0"])},[p("div",kst,[p("div",Pst,[p("div",Ust,[r.searchModelInProgress?(M(),L("div",Fst,Gst)):X("",!0),r.searchModelInProgress?X("",!0):(M(),L("div",zst,Hst))]),Ae(p("input",{type:"search",class:"block w-full p-4 pl-10 text-sm text-gray-900 border border-gray-300 rounded-lg bg-gray-50 focus:ring-blue-500 focus:border-blue-500 dark:bg-gray-700 dark:border-gray-600 dark:placeholder-gray-400 dark:text-white dark:focus:ring-blue-500 dark:focus:border-blue-500",placeholder:"Search models...",required:"","onUpdate:modelValue":e[97]||(e[97]=h=>r.searchModel=h),onKeyup:e[98]||(e[98]=Fo((...h)=>s.searchModel_func&&s.searchModel_func(...h),["enter"]))},null,544),[[Je,r.searchModel]]),r.searchModel?(M(),L("button",{key:0,onClick:e[99]||(e[99]=Oe(h=>r.searchModel="",["stop"])),type:"button",class:"text-white absolute right-2.5 bottom-2.5 bg-blue-700 hover:bg-blue-800 focus:ring-4 focus:outline-none focus:ring-blue-300 font-medium rounded-lg text-sm px-4 py-2 dark:bg-blue-600 dark:hover:bg-blue-700 dark:focus:ring-blue-800"}," Clear search")):X("",!0)])]),p("div",null,[Ae(p("input",{"onUpdate:modelValue":e[100]||(e[100]=h=>r.show_only_installed_models=h),class:"m-2 p-2",type:"checkbox",ref:"only_installed"},null,512),[[Mt,r.show_only_installed_models]]),qst]),p("div",null,[Le(l,{radioOptions:r.sortOptions,onRadioSelected:s.handleRadioSelected},null,8,["radioOptions","onRadioSelected"])]),Yst,r.is_loading_zoo?(M(),L("div",$st,jst)):X("",!0),r.models_zoo&&r.models_zoo.length>0?(M(),L("div",Qst,[p("label",Xst," Models: ("+me(r.models_zoo.length)+") ",1),p("div",{class:Ke(["overflow-y-auto p-2 pb-0 grid lg:grid-cols-3 md:grid-cols-2 gap-4 overflow-y-scroll w-full dark:bg-bg-dark scrollbar-thin scrollbar-track-bg-light-tone scrollbar-thumb-bg-light-tone-panel hover:scrollbar-thumb-primary dark:scrollbar-track-bg-dark-tone dark:scrollbar-thumb-bg-dark-tone-panel dark:hover:scrollbar-thumb-primary active:scrollbar-thumb-secondary",r.mzl_collapsed?"":"max-h-96"])},[Le(Vr,{name:"list"},{default:dt(()=>[(M(!0),L(Xe,null,bt(s.rendered_models_zoo,(h,E)=>(M(),Qt(c,{ref_for:!0,ref:"modelZoo",key:"index-"+E+"-"+h.name,model:h,"is-installed":h.isInstalled,"on-install":s.onInstall,"on-uninstall":s.onUninstall,"on-selected":s.onModelSelected,selected:h.name===s.configFile.model_name,model_type:h.model_type,"on-copy":s.onCopy,"on-copy-link":s.onCopyLink,"on-cancel-install":s.onCancelInstall},null,8,["model","is-installed","on-install","on-uninstall","on-selected","selected","model_type","on-copy","on-copy-link","on-cancel-install"]))),128)),p("button",{ref:"load_more_models",class:"relative items-start p-4 hover:bg-primary-light rounded-lg mb-2 shadow-lg border-2 select-none",onClick:e[101]||(e[101]=(...h)=>s.load_more_models&&s.load_more_models(...h))},"Load more models",512)]),_:1})],2)])):X("",!0),r.mzl_collapsed?(M(),L("button",{key:2,class:"text-2xl hover:text-secondary duration-75 flex justify-center hover:bg-bg-light-tone hover:dark:bg-bg-dark-tone rounded-lg",title:"Collapse",type:"button",onClick:e[102]||(e[102]=(...h)=>s.open_mzl&&s.open_mzl(...h))},Jst)):(M(),L("button",{key:3,class:"text-2xl hover:text-secondary duration-75 flex justify-center hover:bg-bg-light-tone hover:dark:bg-bg-dark-tone rounded-lg",title:"Expand",type:"button",onClick:e[103]||(e[103]=(...h)=>s.open_mzl&&s.open_mzl(...h))},tot))],2)]),p("div",not,[p("div",iot,[p("button",{onClick:e[104]||(e[104]=Oe(h=>r.mzdc_collapsed=!r.mzdc_collapsed,["stop"])),class:"text-2xl hover:text-primary p-2 -m-2 w-full text-left flex items-center"},[Ae(p("div",null,sot,512),[[At,r.mzdc_collapsed]]),Ae(p("div",null,aot,512),[[At,!r.mzdc_collapsed]]),lot,s.binding_name?X("",!0):(M(),L("div",cot,[dot,$e(" No binding selected! ")])),s.configFile.binding_name?(M(),L("div",uot,"|")):X("",!0),s.configFile.binding_name?(M(),L("div",_ot,[p("div",pot,[p("img",{src:s.imgBinding,class:"w-8 h-8 rounded-full object-fill text-blue-700"},null,8,hot),p("h3",fot,me(s.binding_name),1)])])):X("",!0)])]),p("div",{class:Ke([{hidden:r.mzdc_collapsed},"flex flex-col mb-2 px-3 pb-0"])},[p("div",mot,[p("div",got,[p("div",null,[p("div",Eot,[bot,Ae(p("input",{type:"text","onUpdate:modelValue":e[105]||(e[105]=h=>r.reference_path=h),class:"bg-gray-50 border border-gray-300 text-gray-900 text-sm rounded-lg focus:ring-blue-500 focus:border-blue-500 block w-full p-2.5 dark:bg-gray-700 dark:border-gray-600 dark:placeholder-gray-400 dark:text-white dark:focus:ring-blue-500 dark:focus:border-blue-500",placeholder:"Enter Path ...",required:""},null,512),[[Je,r.reference_path]])]),p("button",{type:"button",onClick:e[106]||(e[106]=Oe(h=>s.onCreateReference(),["stop"])),class:"text-white bg-blue-700 hover:bg-blue-800 focus:ring-4 focus:outline-none focus:ring-blue-300 font-medium rounded-lg text-sm w-full sm:w-auto px-5 py-2.5 text-center dark:bg-blue-600 dark:hover:bg-blue-700 dark:focus:ring-blue-800"},"Add reference")]),r.modelDownlaodInProgress?X("",!0):(M(),L("div",Sot,[p("div",yot,[vot,Ae(p("input",{type:"text","onUpdate:modelValue":e[107]||(e[107]=h=>r.addModel.url=h),class:"bg-gray-50 border border-gray-300 text-gray-900 text-sm rounded-lg focus:ring-blue-500 focus:border-blue-500 block w-full p-2.5 dark:bg-gray-700 dark:border-gray-600 dark:placeholder-gray-400 dark:text-white dark:focus:ring-blue-500 dark:focus:border-blue-500",placeholder:"Enter URL ...",required:""},null,512),[[Je,r.addModel.url]])]),p("button",{type:"button",onClick:e[108]||(e[108]=Oe(h=>s.onInstallAddModel(),["stop"])),class:"text-white bg-blue-700 hover:bg-blue-800 focus:ring-4 focus:outline-none focus:ring-blue-300 font-medium rounded-lg text-sm w-full sm:w-auto px-5 py-2.5 text-center dark:bg-blue-600 dark:hover:bg-blue-700 dark:focus:ring-blue-800"},"Download")])),r.modelDownlaodInProgress?(M(),L("div",Tot,[xot,p("div",Cot,[p("div",Rot,[p("div",Aot,[wot,p("span",Oot,me(Math.floor(r.addModel.progress))+"%",1)]),p("div",{class:"mx-1 opacity-80 line-clamp-1",title:r.addModel.url},me(r.addModel.url),9,Not),p("div",Mot,[p("div",{class:"bg-blue-600 h-2.5 rounded-full",style:un({width:r.addModel.progress+"%"})},null,4)]),p("div",Iot,[p("span",Dot,"Download speed: "+me(s.speed_computed)+"/s",1),p("span",Lot,me(s.downloaded_size_computed)+"/"+me(s.total_size_computed),1)])])]),p("div",kot,[p("div",Pot,[p("div",Uot,[p("button",{onClick:e[109]||(e[109]=Oe((...h)=>s.onCancelInstall&&s.onCancelInstall(...h),["stop"])),type:"button",title:"Cancel download",class:"text-gray-500 bg-white hover:bg-gray-100 focus:ring-4 focus:outline-none focus:ring-gray-200 rounded-lg border border-gray-200 text-sm font-medium px-5 py-2.5 hover:text-gray-900 focus:z-10 dark:bg-gray-700 dark:text-gray-300 dark:border-gray-500 dark:hover:text-white dark:hover:bg-gray-600 dark:focus:ring-gray-600"}," Cancel ")])])])])):X("",!0)])])],2)]),p("div",Fot,[p("div",Bot,[p("button",{onClick:e[111]||(e[111]=Oe(h=>r.pzc_collapsed=!r.pzc_collapsed,["stop"])),class:"text-2xl hover:text-primary p-2 -m-2 text-left w-full flex items-center"},[Ae(p("div",null,zot,512),[[At,r.pzc_collapsed]]),Ae(p("div",null,Hot,512),[[At,!r.pzc_collapsed]]),qot,s.configFile.personalities?(M(),L("div",Yot,"|")):X("",!0),p("div",$ot,me(s.active_pesonality),1),s.configFile.personalities?(M(),L("div",Wot,"|")):X("",!0),s.configFile.personalities?(M(),L("div",Kot,[s.mountedPersArr.length>0?(M(),L("div",jot,[(M(!0),L(Xe,null,bt(s.mountedPersArr,(h,E)=>(M(),L("div",{class:"relative hover:-translate-y-2 duration-300 hover:z-10 shrink-0",key:E+"-"+h.name,ref_for:!0,ref:"mountedPersonalities"},[p("div",Qot,[p("button",{onClick:Oe(g=>s.onPersonalitySelected(h),["stop"])},[p("img",{src:r.bUrl+h.avatar,onError:e[110]||(e[110]=(...g)=>s.personalityImgPlacehodler&&s.personalityImgPlacehodler(...g)),class:Ke(["w-8 h-8 rounded-full object-fill text-red-700 border-2 active:scale-90 group-hover:border-secondary",s.configFile.active_personality_id==s.configFile.personalities.indexOf(h.full_path)?"border-secondary":"border-transparent z-0"]),title:h.name},null,42,Zot)],8,Xot),p("button",{onClick:Oe(g=>s.unmountPersonality(h),["stop"])},tat,8,Jot)])]))),128))])):X("",!0)])):X("",!0)])]),p("div",{class:Ke([{hidden:r.pzc_collapsed},"flex flex-col mb-2 px-3 pb-0"])},[p("div",nat,[iat,p("div",rat,[p("div",sat,[r.searchPersonalityInProgress?(M(),L("div",oat,lat)):X("",!0),r.searchPersonalityInProgress?X("",!0):(M(),L("div",cat,uat))]),Ae(p("input",{type:"search",id:"personality-search",class:"block w-full p-4 pl-10 text-sm text-gray-900 border border-gray-300 rounded-lg bg-gray-50 focus:ring-blue-500 focus:border-blue-500 dark:bg-gray-700 dark:border-gray-600 dark:placeholder-gray-400 dark:text-white dark:focus:ring-blue-500 dark:focus:border-blue-500",placeholder:"Search personality...",required:"","onUpdate:modelValue":e[112]||(e[112]=h=>r.searchPersonality=h),onKeyup:e[113]||(e[113]=Oe((...h)=>s.searchPersonality_func&&s.searchPersonality_func(...h),["stop"]))},null,544),[[Je,r.searchPersonality]]),r.searchPersonality?(M(),L("button",{key:0,onClick:e[114]||(e[114]=Oe(h=>r.searchPersonality="",["stop"])),type:"button",class:"text-white absolute right-2.5 bottom-2.5 bg-blue-700 hover:bg-blue-800 focus:ring-4 focus:outline-none focus:ring-blue-300 font-medium rounded-lg text-sm px-4 py-2 dark:bg-blue-600 dark:hover:bg-blue-700 dark:focus:ring-blue-800"}," Clear search")):X("",!0)])]),r.searchPersonality?X("",!0):(M(),L("div",_at,[p("label",pat," Personalities Category: ("+me(r.persCatgArr.length)+") ",1),p("select",{id:"persCat",onChange:e[115]||(e[115]=h=>s.update_personality_category(h.target.value,s.refresh)),class:"bg-gray-50 border border-gray-300 text-gray-900 text-sm rounded-lg focus:ring-blue-500 focus:border-blue-500 block w-full p-2.5 dark:bg-gray-700 dark:border-gray-600 dark:placeholder-gray-400 dark:text-white dark:focus:ring-blue-500 dark:focus:border-blue-500"},[(M(!0),L(Xe,null,bt(r.persCatgArr,(h,E)=>(M(),L("option",{key:E,selected:h==this.configFile.personality_category},me(h),9,hat))),128))],32)])),p("div",null,[r.personalitiesFiltered.length>0?(M(),L("div",fat,[p("label",mat,me(r.searchPersonality?"Search results":"Personalities")+": ("+me(r.personalitiesFiltered.length)+") ",1),p("div",{class:Ke(["overflow-y-auto no-scrollbar p-2 pb-0 grid lg:grid-cols-3 md:grid-cols-2 gap-4",r.pzl_collapsed?"":"max-h-96"])},[Le(Vr,{name:"bounce"},{default:dt(()=>[(M(!0),L(Xe,null,bt(r.personalitiesFiltered,(h,E)=>(M(),Qt(d,{ref_for:!0,ref:"personalitiesZoo",key:"index-"+E+"-"+h.name,personality:h,select_language:!0,full_path:h.full_path,selected:s.configFile.active_personality_id==s.configFile.personalities.findIndex(g=>g===h.full_path||g===h.full_path+":"+h.language),"on-selected":s.onPersonalitySelected,"on-mount":s.mountPersonality,"on-un-mount":s.unmountPersonality,"on-remount":s.remountPersonality,"on-reinstall":s.onPersonalityReinstall,"on-settings":s.onSettingsPersonality,"on-copy-personality-name":s.onCopyPersonalityName},null,8,["personality","full_path","selected","on-selected","on-mount","on-un-mount","on-remount","on-reinstall","on-settings","on-copy-personality-name"]))),128))]),_:1})],2)])):X("",!0)]),r.pzl_collapsed?(M(),L("button",{key:1,class:"text-2xl hover:text-secondary duration-75 flex justify-center hover:bg-bg-light-tone hover:dark:bg-bg-dark-tone rounded-lg",title:"Collapse",type:"button",onClick:e[116]||(e[116]=h=>r.pzl_collapsed=!r.pzl_collapsed)},Eat)):(M(),L("button",{key:2,class:"text-2xl hover:text-secondary duration-75 flex justify-center hover:bg-bg-light-tone hover:dark:bg-bg-dark-tone rounded-lg",title:"Expand",type:"button",onClick:e[117]||(e[117]=h=>r.pzl_collapsed=!r.pzl_collapsed)},Sat))],2)]),p("div",yat,[p("div",vat,[p("button",{onClick:e[119]||(e[119]=Oe(h=>r.ezc_collapsed=!r.ezc_collapsed,["stop"])),class:"text-2xl hover:text-primary p-2 -m-2 text-left w-full flex items-center"},[Ae(p("div",null,xat,512),[[At,r.ezc_collapsed]]),Ae(p("div",null,Rat,512),[[At,!r.ezc_collapsed]]),Aat,s.configFile.extensions?(M(),L("div",wat,"|")):X("",!0),s.configFile.extensions?(M(),L("div",Oat,[s.mountedExtensions.length>0?(M(),L("div",Nat,[(M(!0),L(Xe,null,bt(s.mountedExtensions,(h,E)=>(M(),L("div",{class:"relative hover:-translate-y-2 duration-300 hover:z-10 shrink-0",key:E+"-"+h.name,ref_for:!0,ref:"mountedExtensions"},[p("div",Mat,[p("button",null,[p("img",{src:r.bUrl+h.avatar,onError:e[118]||(e[118]=(...g)=>s.extensionImgPlacehodler&&s.extensionImgPlacehodler(...g)),class:Ke(["w-8 h-8 rounded-full object-fill text-red-700 border-2 active:scale-90 group-hover:border-secondary","border-transparent z-0"]),title:h.name},null,40,Iat)]),p("button",{onClick:Oe(g=>s.unmountExtension(h),["stop"])},kat,8,Dat)])]))),128))])):X("",!0)])):X("",!0)])]),p("div",{class:Ke([{hidden:r.ezc_collapsed},"flex flex-col mb-2 px-3 pb-0"])},[p("div",Pat,[Uat,p("div",Fat,[p("div",Bat,[r.searchExtensionInProgress?(M(),L("div",Gat,Vat)):X("",!0),r.searchExtensionInProgress?X("",!0):(M(),L("div",Hat,Yat))]),Ae(p("input",{type:"search",id:"personality-search",class:"block w-full p-4 pl-10 text-sm text-gray-900 border border-gray-300 rounded-lg bg-gray-50 focus:ring-blue-500 focus:border-blue-500 dark:bg-gray-700 dark:border-gray-600 dark:placeholder-gray-400 dark:text-white dark:focus:ring-blue-500 dark:focus:border-blue-500",placeholder:"Search extension...",required:"","onUpdate:modelValue":e[120]||(e[120]=h=>r.searchExtension=h),onKeyup:e[121]||(e[121]=Oe((...h)=>n.searchExtension_func&&n.searchExtension_func(...h),["stop"]))},null,544),[[Je,r.searchExtension]]),r.searchExtension?(M(),L("button",{key:0,onClick:e[122]||(e[122]=Oe(h=>r.searchExtension="",["stop"])),type:"button",class:"text-white absolute right-2.5 bottom-2.5 bg-blue-700 hover:bg-blue-800 focus:ring-4 focus:outline-none focus:ring-blue-300 font-medium rounded-lg text-sm px-4 py-2 dark:bg-blue-600 dark:hover:bg-blue-700 dark:focus:ring-blue-800"}," Clear search")):X("",!0)])]),r.searchExtension?X("",!0):(M(),L("div",$at,[p("label",Wat," Extensions Category: ("+me(r.extCatgArr.length)+") ",1),p("select",{id:"extCat",onChange:e[123]||(e[123]=h=>s.update_extension_category(h.target.value,s.refresh)),class:"bg-gray-50 border border-gray-300 text-gray-900 text-sm rounded-lg focus:ring-blue-500 focus:border-blue-500 block w-full p-2.5 dark:bg-gray-700 dark:border-gray-600 dark:placeholder-gray-400 dark:text-white dark:focus:ring-blue-500 dark:focus:border-blue-500"},[(M(!0),L(Xe,null,bt(r.extCatgArr,(h,E)=>(M(),L("option",{key:E,selected:h==this.extension_category},me(h),9,Kat))),128))],32)])),p("div",null,[r.extensionsFiltererd.length>0?(M(),L("div",jat,[p("label",Qat,me(r.searchExtension?"Search results":"Personalities")+": ("+me(r.extensionsFiltererd.length)+") ",1),p("div",{class:Ke(["overflow-y-auto no-scrollbar p-2 pb-0 grid lg:grid-cols-3 md:grid-cols-2 gap-4",r.ezl_collapsed?"":"max-h-96"])},[(M(!0),L(Xe,null,bt(r.extensionsFiltererd,(h,E)=>(M(),Qt(u,{ref_for:!0,ref:"extensionsZoo",key:"index-"+E+"-"+h.name,extension:h,select_language:!0,full_path:h.full_path,"on-mount":s.mountExtension,"on-un-mount":s.unmountExtension,"on-remount":s.remountExtension,"on-reinstall":s.onExtensionReinstall,"on-settings":s.onSettingsExtension},null,8,["extension","full_path","on-mount","on-un-mount","on-remount","on-reinstall","on-settings"]))),128))],2)])):X("",!0)]),r.ezc_collapsed?(M(),L("button",{key:1,class:"text-2xl hover:text-secondary duration-75 flex justify-center hover:bg-bg-light-tone hover:dark:bg-bg-dark-tone rounded-lg",title:"Collapse",type:"button",onClick:e[124]||(e[124]=h=>r.ezl_collapsed=!r.ezl_collapsed)},Zat)):(M(),L("button",{key:2,class:"text-2xl hover:text-secondary duration-75 flex justify-center hover:bg-bg-light-tone hover:dark:bg-bg-dark-tone rounded-lg",title:"Expand",type:"button",onClick:e[125]||(e[125]=h=>r.ezl_collapsed=!r.ezl_collapsed)},elt))],2)]),p("div",tlt,[p("div",nlt,[p("button",{onClick:e[126]||(e[126]=Oe(h=>r.mep_collapsed=!r.mep_collapsed,["stop"])),class:"text-2xl hover:text-primary p-2 -m-2 text-left w-full flex items-center"},[Ae(p("div",null,rlt,512),[[At,r.mep_collapsed]]),Ae(p("div",null,olt,512),[[At,!r.mep_collapsed]]),alt])]),p("div",{class:Ke([{hidden:r.mep_collapsed},"flex flex-col mb-2 px-3 pb-0"])},null,2)]),p("div",llt,[p("div",clt,[p("button",{onClick:e[127]||(e[127]=Oe(h=>r.mc_collapsed=!r.mc_collapsed,["stop"])),class:"text-2xl hover:text-primary p-2 -m-2 w-full text-left flex items-center"},[Ae(p("div",null,ult,512),[[At,r.mc_collapsed]]),Ae(p("div",null,plt,512),[[At,!r.mc_collapsed]]),hlt])]),p("div",{class:Ke([{hidden:r.mc_collapsed},"flex flex-col mb-2 p-2"])},[p("div",flt,[p("div",mlt,[Ae(p("input",{id:"override-model-parameters",type:"checkbox",class:"w-4 h-4 text-blue-600 bg-gray-100 border-gray-300 rounded focus:ring-blue-500 dark:focus:ring-blue-600 dark:ring-offset-gray-700 dark:focus:ring-offset-gray-700 focus:ring-2 dark:bg-gray-600 dark:border-gray-500",onClick:e[128]||(e[128]=Oe(()=>{},["stop"])),"onUpdate:modelValue":e[129]||(e[129]=h=>s.configFile.override_personality_model_parameters=h),onChange:e[130]||(e[130]=h=>s.update_setting("override_personality_model_parameters",s.configFile.override_personality_model_parameters))},null,544),[[Mt,s.configFile.override_personality_model_parameters]]),glt])]),p("div",{class:Ke(s.configFile.override_personality_model_parameters?"":"pointer-events-none opacity-30")},[p("div",Elt,[blt,Ae(p("input",{type:"text",id:"seed","onUpdate:modelValue":e[131]||(e[131]=h=>s.configFile.seed=h),class:"bg-gray-50 border border-gray-300 text-sm rounded-lg focus:ring-blue-500 focus:border-blue-500 block w-full p-2.5 dark:bg-gray-700 dark:border-gray-600 dark:placeholder-gray-400 dark:focus:ring-blue-500 dark:focus:border-blue-500"},null,512),[[Je,s.configFile.seed]])]),p("div",Slt,[p("div",ylt,[p("div",vlt,[Tlt,p("p",xlt,[Ae(p("input",{type:"text",id:"temp-val","onUpdate:modelValue":e[132]||(e[132]=h=>s.configFile.temperature=h),onChange:e[133]||(e[133]=h=>r.settingsChanged=!0),class:"mt-2 w-16 text-right p-2 border border-gray-300 rounded-lg bg-gray-50 sm:text-xs focus:ring-blue-500 focus:border-blue-500 dark:bg-gray-700 dark:border-gray-600 dark:placeholder-gray-400 dark:focus:ring-blue-500 dark:focus:border-blue-500"},null,544),[[Je,s.configFile.temperature]])])]),Ae(p("input",{id:"temperature",onChange:e[134]||(e[134]=h=>r.settingsChanged=!0),type:"range","onUpdate:modelValue":e[135]||(e[135]=h=>s.configFile.temperature=h),min:"0",max:"5",step:"0.1",class:"flex-none h-2 mt-14 mb-2 w-full bg-gray-200 rounded-lg appearance-none cursor-pointer dark:bg-gray-700 focus:ring-blue-500 focus:border-blue-500 dark:border-gray-600 dark:placeholder-gray-400 dark:focus:ring-blue-500 dark:focus:border-blue-500"},null,544),[[Je,s.configFile.temperature]])])]),p("div",Clt,[p("div",Rlt,[p("div",Alt,[wlt,p("p",Olt,[Ae(p("input",{type:"text",id:"predict-val","onUpdate:modelValue":e[136]||(e[136]=h=>s.configFile.n_predict=h),onChange:e[137]||(e[137]=h=>r.settingsChanged=!0),class:"mt-2 w-16 text-right p-2 border border-gray-300 rounded-lg bg-gray-50 sm:text-xs focus:ring-blue-500 focus:border-blue-500 dark:bg-gray-700 dark:border-gray-600 dark:placeholder-gray-400 dark:focus:ring-blue-500 dark:focus:border-blue-500"},null,544),[[Je,s.configFile.n_predict]])])]),Ae(p("input",{id:"predict",type:"range",onChange:e[138]||(e[138]=h=>r.settingsChanged=!0),"onUpdate:modelValue":e[139]||(e[139]=h=>s.configFile.n_predict=h),min:"0",max:"2048",step:"32",class:"flex-none h-2 mt-14 mb-2 w-full bg-gray-200 rounded-lg appearance-none cursor-pointer dark:bg-gray-700 focus:ring-blue-500 focus:border-blue-500 dark:border-gray-600 dark:placeholder-gray-400 dark:focus:ring-blue-500 dark:focus:border-blue-500"},null,544),[[Je,s.configFile.n_predict]])])]),p("div",Nlt,[p("div",Mlt,[p("div",Ilt,[Dlt,p("p",Llt,[Ae(p("input",{type:"text",id:"top_k-val","onUpdate:modelValue":e[140]||(e[140]=h=>s.configFile.top_k=h),onChange:e[141]||(e[141]=h=>r.settingsChanged=!0),class:"mt-2 w-16 text-right p-2 border border-gray-300 rounded-lg bg-gray-50 sm:text-xs focus:ring-blue-500 focus:border-blue-500 dark:bg-gray-700 dark:border-gray-600 dark:placeholder-gray-400 dark:focus:ring-blue-500 dark:focus:border-blue-500"},null,544),[[Je,s.configFile.top_k]])])]),Ae(p("input",{id:"top_k",type:"range",onChange:e[142]||(e[142]=h=>r.settingsChanged=!0),"onUpdate:modelValue":e[143]||(e[143]=h=>s.configFile.top_k=h),min:"0",max:"100",step:"1",class:"flex-none h-2 mt-14 mb-2 w-full bg-gray-200 rounded-lg appearance-none cursor-pointer dark:bg-gray-700 focus:ring-blue-500 focus:border-blue-500 dark:border-gray-600 dark:placeholder-gray-400 dark:focus:ring-blue-500 dark:focus:border-blue-500"},null,544),[[Je,s.configFile.top_k]])])]),p("div",klt,[p("div",Plt,[p("div",Ult,[Flt,p("p",Blt,[Ae(p("input",{type:"text",id:"top_p-val","onUpdate:modelValue":e[144]||(e[144]=h=>s.configFile.top_p=h),onChange:e[145]||(e[145]=h=>r.settingsChanged=!0),class:"mt-2 w-16 text-right p-2 border border-gray-300 rounded-lg bg-gray-50 sm:text-xs focus:ring-blue-500 focus:border-blue-500 dark:bg-gray-700 dark:border-gray-600 dark:placeholder-gray-400 dark:focus:ring-blue-500 dark:focus:border-blue-500"},null,544),[[Je,s.configFile.top_p]])])]),Ae(p("input",{id:"top_p",type:"range","onUpdate:modelValue":e[146]||(e[146]=h=>s.configFile.top_p=h),min:"0",max:"1",step:"0.01",onChange:e[147]||(e[147]=h=>r.settingsChanged=!0),class:"flex-none h-2 mt-14 mb-2 w-full bg-gray-200 rounded-lg appearance-none cursor-pointer dark:bg-gray-700 focus:ring-blue-500 focus:border-blue-500 dark:border-gray-600 dark:placeholder-gray-400 dark:focus:ring-blue-500 dark:focus:border-blue-500"},null,544),[[Je,s.configFile.top_p]])])]),p("div",Glt,[p("div",zlt,[p("div",Vlt,[Hlt,p("p",qlt,[Ae(p("input",{type:"text",id:"repeat_penalty-val","onUpdate:modelValue":e[148]||(e[148]=h=>s.configFile.repeat_penalty=h),onChange:e[149]||(e[149]=h=>r.settingsChanged=!0),class:"mt-2 w-16 text-right p-2 border border-gray-300 rounded-lg bg-gray-50 sm:text-xs focus:ring-blue-500 focus:border-blue-500 dark:bg-gray-700 dark:border-gray-600 dark:placeholder-gray-400 dark:focus:ring-blue-500 dark:focus:border-blue-500"},null,544),[[Je,s.configFile.repeat_penalty]])])]),Ae(p("input",{id:"repeat_penalty",onChange:e[150]||(e[150]=h=>r.settingsChanged=!0),type:"range","onUpdate:modelValue":e[151]||(e[151]=h=>s.configFile.repeat_penalty=h),min:"0",max:"2",step:"0.01",class:"flex-none h-2 mt-14 mb-2 w-full bg-gray-200 rounded-lg appearance-none cursor-pointer dark:bg-gray-700 focus:ring-blue-500 focus:border-blue-500 dark:border-gray-600 dark:placeholder-gray-400 dark:focus:ring-blue-500 dark:focus:border-blue-500"},null,544),[[Je,s.configFile.repeat_penalty]])])]),p("div",Ylt,[p("div",$lt,[p("div",Wlt,[Klt,p("p",jlt,[Ae(p("input",{type:"text",id:"repeat_last_n-val","onUpdate:modelValue":e[152]||(e[152]=h=>s.configFile.repeat_last_n=h),onChange:e[153]||(e[153]=h=>r.settingsChanged=!0),class:"mt-2 w-16 text-right p-2 border border-gray-300 rounded-lg bg-gray-50 sm:text-xs focus:ring-blue-500 focus:border-blue-500 dark:bg-gray-700 dark:border-gray-600 dark:placeholder-gray-400 dark:focus:ring-blue-500 dark:focus:border-blue-500"},null,544),[[Je,s.configFile.repeat_last_n]])])]),Ae(p("input",{id:"repeat_last_n",type:"range","onUpdate:modelValue":e[154]||(e[154]=h=>s.configFile.repeat_last_n=h),min:"0",max:"100",step:"1",onChange:e[155]||(e[155]=h=>r.settingsChanged=!0),class:"flex-none h-2 mt-14 mb-2 w-full bg-gray-200 rounded-lg appearance-none cursor-pointer dark:bg-gray-700 focus:ring-blue-500 focus:border-blue-500 dark:border-gray-600 dark:placeholder-gray-400 dark:focus:ring-blue-500 dark:focus:border-blue-500"},null,544),[[Je,s.configFile.repeat_last_n]])])])],2)],2)])],2)]),Le(_,{ref:"addmodeldialog"},null,512),Le(f,{class:"z-20",show:r.variantSelectionDialogVisible,choices:r.variant_choices,onChoiceSelected:s.onVariantChoiceSelected,onCloseDialog:s.oncloseVariantChoiceDialog,onChoiceValidated:s.onvalidateVariantChoice},null,8,["show","choices","onChoiceSelected","onCloseDialog","onChoiceValidated"])],64)}const Xlt=ft(Ktt,[["render",Qlt],["__scopeId","data-v-8ad66bce"]]),Zlt={components:{ClipBoardTextInput:_E,Card:Ll},data(){return{dataset_path:"",max_length:1024,batch_size:4,lr:5e-5,num_epochs:2,selectedFolder:"",selectedDataset:""}},methods:{submitForm(){const n={model_name:this.selectedModel,dataset_file:this.selectedDataset,max_length:this.max_length,batch_size:this.batch_size,lr:this.lr,num_epochs:this.num_epochs,output_dir:this.selectedFolder};Pe.post("/start_training",n).then(e=>{})},openFolderSelector(){this.$refs.folder_selector.click()},selectOutputDirectory(n){var t;console.log("here");const e=(t=n.target.files[0])==null?void 0:t.path;console.log(e),e&&(this.selectedFolder=e)},selectDataset(n){const e=n.target.files;e.length>0&&(this.selectedDataset=e[0])}},computed:{selectedModel:{get(){return this.$store.state.selectedModel}},models:{get(){return this.$store.state.modelsArr}}},watch:{model_name(n){console.log("watching model_name",n),this.$refs.clipboardInput.inputValue=n}}},Jlt={key:0,class:"container overflow-y-scroll flex flex-col no-scrollbar shadow-lg p-10 pt-2 bg-bg-light-tone dark:bg-bg-dark-tone"},ect={class:"mb-4"},tct=p("label",{for:"model_name",class:"text-sm"},"Model Name:",-1),nct=["value"],ict={class:"mb-4"},rct=p("label",{for:"dataset_path",class:"text-sm"},"Dataset:",-1),sct={class:"mb-4"},oct=p("label",{for:"lr",class:"text-sm"},"Learning Rate:",-1),act={class:"mb-4"},lct=p("label",{for:"num_epochs",class:"text-sm"},"Number of Epochs:",-1),cct={class:"mb-4"},dct=p("label",{for:"max_length",class:"text-sm"},"Max Length:",-1),uct={class:"mb-4"},_ct=p("label",{for:"batch_size",class:"text-sm"},"Batch Size:",-1),pct={class:"mb-4"},hct=p("label",{for:"output_dir",class:"text-sm"},"Output Directory:",-1),fct=p("button",{class:"bg-blue-500 text-white px-4 py-2 rounded"},"Start training",-1),mct={key:1};function gct(n,e,t,i,r,s){const o=St("Card"),a=St("ClipBoardTextInput");return s.selectedModel!==null&&s.selectedModel.toLowerCase().includes("gptq")?(M(),L("div",Jlt,[p("form",{onSubmit:e[2]||(e[2]=Oe((...l)=>s.submitForm&&s.submitForm(...l),["prevent"])),class:""},[Le(o,{title:"Training configuration",isHorizontal:!0,disableHoverAnimation:!0,disableFocus:!0},{default:dt(()=>[Le(o,{title:"Model",class:"",isHorizontal:!1},{default:dt(()=>[p("div",ect,[tct,Ae(p("select",{"onUpdate:modelValue":e[0]||(e[0]=l=>s.selectedModel=l),onChange:e[1]||(e[1]=(...l)=>n.setModel&&n.setModel(...l)),class:"bg-white dark:bg-black m-0 border-2 rounded-md shadow-sm w-full"},[(M(!0),L(Xe,null,bt(s.models,l=>(M(),L("option",{key:l,value:l},me(l),9,nct))),128))],544),[[_i,s.selectedModel]])])]),_:1}),Le(o,{title:"Data",isHorizontal:!1},{default:dt(()=>[p("div",ict,[rct,Le(a,{id:"model_path",inputType:"file",value:r.dataset_path,onchange:"selectDataset()"},null,8,["value"])])]),_:1}),Le(o,{title:"Training",isHorizontal:!1},{default:dt(()=>[p("div",sct,[oct,Le(a,{id:"model_path",inputType:"integer",value:r.lr},null,8,["value"])]),p("div",act,[lct,Le(a,{id:"model_path",inputType:"integer",value:r.num_epochs},null,8,["value"])]),p("div",cct,[dct,Le(a,{id:"model_path",inputType:"integer",value:r.max_length},null,8,["value"])]),p("div",uct,[_ct,Le(a,{id:"model_path",inputType:"integer",value:r.batch_size},null,8,["value"])])]),_:1}),Le(o,{title:"Output",isHorizontal:!1},{default:dt(()=>[p("div",pct,[hct,Le(a,{id:"model_path",inputType:"text",value:n.output_dir},null,8,["value"])])]),_:1})]),_:1}),Le(o,{disableHoverAnimation:!0,disableFocus:!0},{default:dt(()=>[fct]),_:1})],32)])):(M(),L("div",mct,[Le(o,{title:"Info",class:"",isHorizontal:!1},{default:dt(()=>[$e(" Only GPTQ models are supported for QLora fine tuning. Please select a GPTQ compatible binding. ")]),_:1})]))}const Ect=ft(Zlt,[["render",gct]]),bct={components:{ClipBoardTextInput:_E,Card:Ll},data(){return{model_name:"jondurbin/airoboros-7b-gpt4",tokenizer_name:"jondurbin/airoboros-7b-gpt4",dataset_path:"",max_length:1024,batch_size:4,lr:5e-5,num_epochs:2,selectedFolder:"",selectedDatasetPath:""}},methods:{submitForm(){this.model_name,this.tokenizer_name,this.selectedDatasetPath,this.max_length,this.batch_size,this.lr,this.num_epochs,this.selectedFolder},openFolderSelector(){this.$refs.folder_selector.click()},selectOutputDirectory(n){var t;console.log("here");const e=(t=n.target.files[0])==null?void 0:t.path;console.log(e),e&&(this.selectedFolder=e)},selectDatasetPath(n){const e=n.target.files;e.length>0&&(this.selectedDatasetPath=e[0].webkitRelativePath)}}},Sct={class:"container overflow-y-scroll flex flex-col no-scrollbar shadow-lg p-10 pt-2 bg-bg-light-tone dark:bg-bg-dark-tone"},yct={class:"mb-4"},vct=p("label",{for:"model_name",class:"text-sm"},"Model Name:",-1),Tct={class:"mb-4"},xct=p("label",{for:"tokenizer_name",class:"text-sm"},"Tokenizer Name:",-1),Cct=p("button",{type:"submit",class:"bg-blue-500 text-white px-4 py-2 rounded"},"Quantize LLM",-1);function Rct(n,e,t,i,r,s){const o=St("ClipBoardTextInput"),a=St("Card");return M(),L("div",Sct,[p("form",{onSubmit:e[0]||(e[0]=Oe((...l)=>s.submitForm&&s.submitForm(...l),["prevent"])),class:"max-w-md mx-auto"},[Le(a,{title:"Quantizing configuration",isHorizontal:!0,disableHoverAnimation:!0,disableFocus:!0},{default:dt(()=>[Le(a,{title:"Model",class:"",isHorizontal:!1},{default:dt(()=>[p("div",yct,[vct,Le(o,{id:"model_path",inputType:"text",value:r.model_name},null,8,["value"])]),p("div",Tct,[xct,Le(o,{id:"model_path",inputType:"text",value:r.tokenizer_name},null,8,["value"])])]),_:1})]),_:1}),Le(a,{disableHoverAnimation:!0,disableFocus:!0},{default:dt(()=>[Cct]),_:1})],32)])}const Act=ft(bct,[["render",Rct]]),wct={data(){return{show:!1,prompt:"",inputText:""}},methods:{showPanel(){this.show=!0},ok(){this.show=!1,this.$emit("ok",this.inputText)},cancel(){this.show=!1,this.inputText=""}},props:{promptText:{type:String,required:!0}},watch:{promptText(n){this.prompt=n}}},Oct={key:0,class:"fixed top-0 left-0 w-full h-full flex justify-center items-center bg-black bg-opacity-50"},Nct={class:"bg-white p-8 rounded"},Mct={class:"text-xl font-bold mb-4"};function Ict(n,e,t,i,r,s){return M(),L("div",null,[r.show?(M(),L("div",Oct,[p("div",Nct,[p("h2",Mct,me(t.promptText),1),Ae(p("input",{type:"text","onUpdate:modelValue":e[0]||(e[0]=o=>r.inputText=o),class:"border border-gray-300 px-4 py-2 rounded mb-4"},null,512),[[Je,r.inputText]]),p("button",{onClick:e[1]||(e[1]=(...o)=>s.ok&&s.ok(...o)),class:"bg-blue-500 text-white px-4 py-2 rounded mr-2"},"OK"),p("button",{onClick:e[2]||(e[2]=(...o)=>s.cancel&&s.cancel(...o)),class:"bg-gray-500 text-white px-4 py-2 rounded"},"Cancel")])])):X("",!0)])}const Ew=ft(wct,[["render",Ict]]),Dct={props:{htmlContent:{type:String,required:!0}}},Lct=["innerHTML"];function kct(n,e,t,i,r,s){return M(),L("div",null,[p("div",{innerHTML:t.htmlContent},null,8,Lct)])}const Pct=ft(Dct,[["render",kct]]);const Uct={props:{jsonData:{type:[Object,Array,String],default:null},jsonFormText:{type:String,default:"JSON Form"}},data(){return{collapsed:!0}},computed:{formattedJson(){return typeof this.jsonData=="string"?JSON.stringify(JSON.parse(this.jsonData),null," ").replace(/\n/g,"
"):JSON.stringify(this.jsonData,null," ").replace(/\n/g,"
")},isObject(){return typeof this.jsonData=="object"&&this.jsonData!==null},isContentPresent(){return this.jsonData!==null&&(typeof this.jsonData!="string"||this.jsonData.trim()!=="")}},methods:{toggleCollapsed(){this.collapsed=!this.collapsed},toggleCollapsible(){this.collapsed=!this.collapsed}}},Fct={key:0},Bct={class:"toggle-icon mr-1"},Gct={key:0,class:"fas fa-plus-circle text-gray-600"},zct={key:1,class:"fas fa-minus-circle text-gray-600"},Vct={class:"json-viewer max-h-64 overflow-auto p-4 bg-gray-100 border border-gray-300 rounded dark:bg-gray-600"},Hct={key:0,class:"fas fa-plus-circle text-gray-600"},qct={key:1,class:"fas fa-minus-circle text-gray-600"},Yct=["innerHTML"];function $ct(n,e,t,i,r,s){return s.isContentPresent?(M(),L("div",Fct,[p("div",{class:"collapsible-section cursor-pointer mb-4 font-bold hover:text-gray-900",onClick:e[0]||(e[0]=(...o)=>s.toggleCollapsible&&s.toggleCollapsible(...o))},[p("span",Bct,[r.collapsed?(M(),L("i",Gct)):(M(),L("i",zct))]),$e(" "+me(t.jsonFormText),1)]),Ae(p("div",null,[p("div",Vct,[s.isObject?(M(),L("span",{key:0,onClick:e[1]||(e[1]=(...o)=>s.toggleCollapsed&&s.toggleCollapsed(...o)),class:"toggle-icon cursor-pointer mr-1"},[r.collapsed?(M(),L("i",Hct)):(M(),L("i",qct))])):X("",!0),p("pre",{innerHTML:s.formattedJson},null,8,Yct)])],512),[[At,!r.collapsed]])])):X("",!0)}const Wct=ft(Uct,[["render",$ct]]),Kct={props:{done:{type:Boolean,required:!0},message:{type:String,required:!0},status:{type:Boolean,required:!0}}},jct={class:"step flex items-center mb-4"},Qct={class:"flex items-center justify-center w-6 h-6 mr-2"},Xct={key:0},Zct=p("i",{"data-feather":"square",class:"text-gray-400 w-4 h-4"},null,-1),Jct=[Zct],edt={key:1},tdt=p("i",{"data-feather":"check-square",class:"text-green-500 w-4 h-4"},null,-1),ndt=[tdt],idt={key:2},rdt=p("i",{"data-feather":"x-square",class:"text-red-500 w-4 h-4"},null,-1),sdt=[rdt],odt={key:0,role:"status"},adt=p("svg",{"aria-hidden":"true",class:"w-6 h-6 animate-spin fill-secondary",viewBox:"0 0 100 101",fill:"none",xmlns:"http://www.w3.org/2000/svg"},[p("path",{d:"M100 50.5908C100 78.2051 77.6142 100.591 50 100.591C22.3858 100.591 0 78.2051 0 50.5908C0 22.9766 22.3858 0.59082 50 0.59082C77.6142 0.59082 100 22.9766 100 50.5908ZM9.08144 50.5908C9.08144 73.1895 27.4013 91.5094 50 91.5094C72.5987 91.5094 90.9186 73.1895 90.9186 50.5908C90.9186 27.9921 72.5987 9.67226 50 9.67226C27.4013 9.67226 9.08144 27.9921 9.08144 50.5908Z",fill:"currentColor"}),p("path",{d:"M93.9676 39.0409C96.393 38.4038 97.8624 35.9116 97.0079 33.5539C95.2932 28.8227 92.871 24.3692 89.8167 20.348C85.8452 15.1192 80.8826 10.7238 75.2124 7.41289C69.5422 4.10194 63.2754 1.94025 56.7698 1.05124C51.7666 0.367541 46.6976 0.446843 41.7345 1.27873C39.2613 1.69328 37.813 4.19778 38.4501 6.62326C39.0873 9.04874 41.5694 10.4717 44.0505 10.1071C47.8511 9.54855 51.7191 9.52689 55.5402 10.0491C60.8642 10.7766 65.9928 12.5457 70.6331 15.2552C75.2735 17.9648 79.3347 21.5619 82.5849 25.841C84.9175 28.9121 86.7997 32.2913 88.1811 35.8758C89.083 38.2158 91.5421 39.6781 93.9676 39.0409Z",fill:"currentFill"})],-1),ldt=[adt];function cdt(n,e,t,i,r,s){return M(),L("div",jct,[p("div",Qct,[t.done?X("",!0):(M(),L("div",Xct,Jct)),t.done&&t.status?(M(),L("div",edt,ndt)):X("",!0),t.done&&!t.status?(M(),L("div",idt,sdt)):X("",!0)]),t.done?X("",!0):(M(),L("div",odt,ldt)),p("div",{class:Ke(["content flex-1 px-2",{"text-green-500":t.done,"text-yellow-500":!t.done}])},me(t.message),3)])}const ddt=ft(Kct,[["render",cdt]]),udt="/assets/python_block-4008a934.png",_dt="/assets/bash_block-7ca80e4e.png";const ax="/",pdt={name:"Message",emits:["copy","delete","rankUp","rankDown","updateMessage","resendMessage","continueMessage"],components:{MarkdownRenderer:hw,Step:ddt,RenderHTMLJS:Pct,JsonViewer:Wct,DynamicUIRenderer:gw},props:{host:{type:String,required:!1,default:"http://localhost:9600"},message:Object,avatar:""},data(){return{python_block:udt,bash_block:_dt,audio_url:null,audio:null,msg:null,isSpeaking:!1,speechSynthesis:null,voices:[],expanded:!1,showConfirmation:!1,editMsgMode_:!1,deleteMsgMode:!1,mdRenderHeight:Number}},mounted(){"speechSynthesis"in window?(this.speechSynthesis=window.speechSynthesis,this.voices=this.speechSynthesis.getVoices(),this.voices.length===0&&this.speechSynthesis.addEventListener("voiceschanged",this.onVoicesChanged)):console.error("Speech synthesis is not supported in this browser."),Ue(()=>{Ge.replace(),this.mdRenderHeight=this.$refs.mdRender.$el.offsetHeight})},methods:{insertTab(n){const e=n.target,t=e.selectionStart,i=e.selectionEnd,r=e.value.substring(0,t),s=e.value.substring(i),o=r+" "+s;this.message.content=o,this.$nextTick(()=>{e.selectionStart=e.selectionEnd=t+4}),n.preventDefault()},onVoicesChanged(){this.voices=this.speechSynthesis.getVoices()},read(){this.isSpeaking?(this.$refs.audio_player.pause(),this.isSpeaking=!1):(this.isSpeaking=!0,Pe.post("./read",{text:this.message.content}).then(n=>{let e=n.data.url;console.log(e),this.audio_url=e}).catch(n=>{this.$store.state.toast.showToast(`Error: ${n}`,4,!1),this.generating=!1}))},speak(){if(this.msg){this.speechSynthesis.cancel(),this.msg=null,this.isSpeaking=!1;return}let n=0;console.log("voice on"),this.isSpeaking=!0;const e=200;this.message.content,this.msg=new SpeechSynthesisUtterance,this.msg.pitch=this.$store.state.config.audio_pitch,this.voices.length>0&&(this.msg.voice=this.voices.filter(r=>r.name===this.$store.state.config.audio_out_voice)[0]);const t=r=>{let s=this.message.content.substring(r,r+e);const o=[".","!","?",` +`];let a=-1;return o.forEach(l=>{const c=s.lastIndexOf(l);c>a&&(a=c)}),a==-1&&(a=s.length),console.log(a),a+r+1},i=()=>{if(this.message.content.includes(".")){const r=t(n),s=this.message.content.substring(n,r);this.msg.text=s,n=r+1,this.msg.onend=o=>{n{i()},1):(this.isSpeaking=!1,console.log("voice off :",this.message.content.length," ",r))},this.speechSynthesis.speak(this.msg)}else setTimeout(()=>{i()},1)};i()},toggleModel(){this.expanded=!this.expanded},addBashBlock(){let n=this.$refs.mdTextarea.selectionStart;n==0||this.message.content[n-1]==` +`?this.message.content=this.message.content.slice(0,n)+"```bash\n\n```\n"+this.message.content.slice(n):this.message.content=this.message.content.slice(0,n)+"\n```bash\n\n```\n"+this.message.content.slice(n),n=n+9,this.$refs.mdTextarea.focus(),this.$refs.mdTextarea.selectionStart=this.$refs.mdTextarea.selectionEnd=n},addPythonBlock(){let n=this.$refs.mdTextarea.selectionStart;n==0||this.message.content[n-1]==` +`?this.message.content=this.message.content.slice(0,n)+"```python\n\n```\n"+this.message.content.slice(n):this.message.content=this.message.content.slice(0,n)+"\n```python\n\n```\n"+this.message.content.slice(n),n=n+11,this.$refs.mdTextarea.focus(),this.$refs.mdTextarea.selectionStart=this.$refs.mdTextarea.selectionEnd=n},copyContentToClipboard(){this.$emit("copy",this)},deleteMsg(){this.$emit("delete",this.message.id),this.deleteMsgMode=!1},rankUp(){this.$emit("rankUp",this.message.id)},rankDown(){this.$emit("rankDown",this.message.id)},updateMessage(){this.$emit("updateMessage",this.message.id,this.message.content),this.editMsgMode=!1},resendMessage(n){this.$emit("resendMessage",this.message.id,this.message.content,n)},continueMessage(){this.$emit("continueMessage",this.message.id,this.message.content)},getImgUrl(){return this.avatar?(console.log("Avatar:",ax+this.avatar),ax+this.avatar):(console.log("No avatar found"),Vo)},defaultImg(n){n.target.src=Vo},parseDate(n){let e=new Date(Date.parse(n)),i=Math.floor((new Date-e)/1e3);return i<=1?"just now":i<20?i+" seconds ago":i<40?"half a minute ago":i<60?"less than a minute ago":i<=90?"one minute ago":i<=3540?Math.round(i/60)+" minutes ago":i<=5400?"1 hour ago":i<=86400?Math.round(i/3600)+" hours ago":i<=129600?"1 day ago":i<604800?Math.round(i/86400)+" days ago":i<=777600?"1 week ago":n},prettyDate(n){let e=new Date((n||"").replace(/-/g,"/").replace(/[TZ]/g," ")),t=(new Date().getTime()-e.getTime())/1e3,i=Math.floor(t/86400);if(!(isNaN(i)||i<0||i>=31))return i==0&&(t<60&&"just now"||t<120&&"1 minute ago"||t<3600&&Math.floor(t/60)+" minutes ago"||t<7200&&"1 hour ago"||t<86400&&Math.floor(t/3600)+" hours ago")||i==1&&"Yesterday"||i<7&&i+" days ago"||i<31&&Math.ceil(i/7)+" weeks ago"},checkForFullSentence(){if(this.message.content.trim().split(" ").length>3){this.speak();return}}},watch:{"message.content":function(n){this.$store.state.config.auto_speak&&(this.isSpeaking||this.checkForFullSentence())},"message.ui":function(n){console.log("ui changed"),console.log(this.message.ui)},showConfirmation(){Ue(()=>{Ge.replace()})},deleteMsgMode(){Ue(()=>{Ge.replace()})}},computed:{editMsgMode:{get(){return this.message.hasOwnProperty("open")?this.editMsgMode_||this.message.open:this.editMsgMode_},set(n){this.message.open=n,this.editMsgMode_=n,Ue(()=>{Ge.replace()})}},isTalking:{get(){return this.isSpeaking}},created_at(){return this.prettyDate(this.message.created_at)},created_at_parsed(){return new Date(Date.parse(this.message.created_at)).toLocaleString()},finished_generating_at_parsed(){return new Date(Date.parse(this.message.finished_generating_at)).toLocaleString()},time_spent(){const n=new Date(Date.parse(this.message.created_at)),e=new Date(Date.parse(this.message.finished_generating_at));if(e.getTime()===n.getTime()||!e.getTime())return;let i=e.getTime()-n.getTime();const r=Math.floor(i/(1e3*60*60));i-=r*(1e3*60*60);const s=Math.floor(i/(1e3*60));i-=s*(1e3*60);const o=Math.floor(i/1e3);i-=o*1e3;function a(c){return c<10&&(c="0"+c),c}return a(r)+"h:"+a(s)+"m:"+a(o)+"s"}}},hdt={class:"relative w-full group rounded-lg m-2 shadow-lg hover:border-primary dark:hover:border-primary hover:border-solid hover:border-2 border-2 border-transparent even:bg-bg-light-discussion-odd dark:even:bg-bg-dark-discussion-odd flex flex-col flex-grow flex-wrap overflow-visible p-4 pb-2"},fdt={class:"flex flex-row gap-2"},mdt={class:"flex-shrink-0"},gdt={class:"group/avatar"},Edt=["src","data-popover-target"],bdt={class:"flex flex-col w-full flex-grow-0"},Sdt={class:"flex flex-row flex-grow items-start"},ydt={class:"flex flex-col mb-2"},vdt={class:"drop-shadow-sm text-lg text-opacity-95 font-bold grow"},Tdt=["title"],xdt=p("div",{class:"flex-grow"},null,-1),Cdt={class:"flex-row justify-end mx-2"},Rdt={class:"invisible group-hover:visible flex flex-row"},Adt={key:0,class:"flex items-center duration-75"},wdt=p("i",{"data-feather":"x"},null,-1),Odt=[wdt],Ndt=p("i",{"data-feather":"check"},null,-1),Mdt=[Ndt],Idt=p("i",{"data-feather":"edit"},null,-1),Ddt=[Idt],Ldt=["src"],kdt=["src"],Pdt=p("i",{"data-feather":"copy"},null,-1),Udt=[Pdt],Fdt=p("i",{"data-feather":"send"},null,-1),Bdt=[Fdt],Gdt=p("i",{"data-feather":"send"},null,-1),zdt=[Gdt],Vdt=p("i",{"data-feather":"fast-forward"},null,-1),Hdt=[Vdt],qdt={key:7,class:"flex items-center duration-75"},Ydt=p("i",{"data-feather":"x"},null,-1),$dt=[Ydt],Wdt=p("i",{"data-feather":"check"},null,-1),Kdt=[Wdt],jdt=p("i",{"data-feather":"trash"},null,-1),Qdt=[jdt],Xdt=p("i",{"data-feather":"thumbs-up"},null,-1),Zdt=[Xdt],Jdt={class:"flex flex-row items-center"},eut=p("i",{"data-feather":"thumbs-down"},null,-1),tut=[eut],nut={class:"flex flex-row items-center"},iut=p("i",{"data-feather":"volume-2"},null,-1),rut=[iut],sut={key:9,class:"flex flex-row items-center"},out=p("i",{"data-feather":"voicemail"},null,-1),aut=[out],lut={class:"overflow-x-auto w-full"},cut={class:"flex flex-col items-start w-full"},dut={class:"flex flex-col items-start w-full"},uut={key:1},_ut={key:3,controls:"",autoplay:"",ref:"audio_player"},put=["src"],hut={class:"text-sm text-gray-400 mt-2"},fut={class:"flex flex-row items-center gap-2"},mut={key:0},gut={class:"font-thin"},Eut={key:1},but={class:"font-thin"},Sut={key:2},yut={class:"font-thin"},vut={key:3},Tut=["title"];function xut(n,e,t,i,r,s){const o=St("Step"),a=St("RenderHTMLJS"),l=St("MarkdownRenderer"),c=St("JsonViewer"),d=St("DynamicUIRenderer");return M(),L("div",hdt,[p("div",fdt,[p("div",mdt,[p("div",gdt,[p("img",{src:s.getImgUrl(),onError:e[0]||(e[0]=u=>s.defaultImg(u)),"data-popover-target":"avatar"+t.message.id,"data-popover-placement":"bottom",class:"w-10 h-10 rounded-full object-fill text-red-700"},null,40,Edt)])]),p("div",bdt,[p("div",Sdt,[p("div",ydt,[p("div",vdt,me(t.message.sender)+" ",1),t.message.created_at?(M(),L("div",{key:0,class:"text-sm text-gray-400 font-thin",title:"Created at: "+s.created_at_parsed},me(s.created_at),9,Tdt)):X("",!0)]),xdt,p("div",Cdt,[p("div",Rdt,[s.editMsgMode?(M(),L("div",Adt,[p("button",{class:"text-2xl hover:text-red-600 duration-75 active:scale-90 p-2",title:"Cancel edit",type:"button",onClick:e[1]||(e[1]=Oe(u=>s.editMsgMode=!1,["stop"]))},Odt),p("button",{class:"text-2xl hover:text-secondary duration-75 active:scale-90 p-2",title:"Update message",type:"button",onClick:e[2]||(e[2]=Oe((...u)=>s.updateMessage&&s.updateMessage(...u),["stop"]))},Mdt)])):X("",!0),s.editMsgMode?X("",!0):(M(),L("div",{key:1,class:"text-lg hover:text-secondary duration-75 active:scale-90 p-2",title:"Edit message",onClick:e[3]||(e[3]=Oe(u=>s.editMsgMode=!0,["stop"]))},Ddt)),s.editMsgMode?(M(),L("div",{key:2,class:"text-lg hover:text-secondary duration-75 active:scale-90 p-2",title:"Add python block",onClick:e[4]||(e[4]=Oe(u=>s.addPythonBlock(),["stop"]))},[p("img",{src:r.python_block,width:"25",height:"25"},null,8,Ldt)])):X("",!0),s.editMsgMode?(M(),L("div",{key:3,class:"text-lg hover:text-secondary duration-75 active:scale-90 p-2",title:"Add bash block",onClick:e[5]||(e[5]=Oe(u=>s.addBashBlock(),["stop"]))},[p("img",{src:r.bash_block,width:"25",height:"25"},null,8,kdt)])):X("",!0),p("div",{class:"text-lg hover:text-secondary duration-75 active:scale-90 p-2",title:"Copy message to clipboard",onClick:e[6]||(e[6]=Oe(u=>s.copyContentToClipboard(),["stop"]))},Udt),!s.editMsgMode&&t.message.sender!=this.$store.state.mountedPers.name?(M(),L("div",{key:4,class:Ke(["text-lg text-red-500 hover:text-secondary duration-75 active:scale-90 p-2",{"text-5xl":s.editMsgMode}]),title:"Resend message with full context",onClick:e[7]||(e[7]=Oe(u=>s.resendMessage("full_context"),["stop"]))},Bdt,2)):X("",!0),!s.editMsgMode&&t.message.sender!=this.$store.state.mountedPers.name?(M(),L("div",{key:5,class:Ke(["text-lg hover:text-secondary duration-75 active:scale-90 p-2",{"text-5xl":s.editMsgMode}]),title:"Resend message without the full context",onClick:e[8]||(e[8]=Oe(u=>s.resendMessage("simple_question"),["stop"]))},zdt,2)):X("",!0),!s.editMsgMode&&t.message.sender==this.$store.state.mountedPers.name?(M(),L("div",{key:6,class:"text-lg hover:text-secondary duration-75 active:scale-90 p-2",title:"Resend message",onClick:e[9]||(e[9]=Oe(u=>s.continueMessage(),["stop"]))},Hdt)):X("",!0),r.deleteMsgMode?(M(),L("div",qdt,[p("button",{class:"text-2xl hover:text-red-600 duration-75 active:scale-90 p-2",title:"Cancel removal",type:"button",onClick:e[10]||(e[10]=Oe(u=>r.deleteMsgMode=!1,["stop"]))},$dt),p("button",{class:"text-2xl hover:text-secondary duration-75 active:scale-90 p-2",title:"Confirm removal",type:"button",onClick:e[11]||(e[11]=Oe(u=>s.deleteMsg(),["stop"]))},Kdt)])):X("",!0),!s.editMsgMode&&!r.deleteMsgMode?(M(),L("div",{key:8,class:"text-lg hover:text-red-600 duration-75 active:scale-90 p-2",title:"Remove message",onClick:e[12]||(e[12]=u=>r.deleteMsgMode=!0)},Qdt)):X("",!0),p("div",{class:"text-lg hover:text-secondary duration-75 active:scale-90 p-2",title:"Upvote",onClick:e[13]||(e[13]=Oe(u=>s.rankUp(),["stop"]))},Zdt),p("div",Jdt,[p("div",{class:"text-lg hover:text-red-600 duration-75 active:scale-90 p-2",title:"Downvote",onClick:e[14]||(e[14]=Oe(u=>s.rankDown(),["stop"]))},tut),t.message.rank!=0?(M(),L("div",{key:0,class:Ke(["rounded-full px-2 text-sm flex items-center justify-center font-bold",t.message.rank>0?"bg-secondary":"bg-red-600"]),title:"Rank"},me(t.message.rank),3)):X("",!0)]),p("div",nut,[p("div",{class:Ke(["text-lg hover:text-red-600 duration-75 active:scale-90 p-2",{"text-red-500":s.isTalking}]),title:"speak",onClick:e[15]||(e[15]=Oe(u=>s.speak(),["stop"]))},rut,2)]),this.$store.state.config.enable_voice_service?(M(),L("div",sut,[p("div",{class:Ke(["text-lg hover:text-red-600 duration-75 active:scale-90 p-2",{"text-red-500":s.isTalking}]),title:"read",onClick:e[16]||(e[16]=Oe(u=>s.read(),["stop"]))},aut,2)])):X("",!0)])])]),p("div",lut,[p("div",cut,[(M(!0),L(Xe,null,bt(t.message.steps,(u,_)=>(M(),L("div",{key:"step-"+t.message.id+"-"+_,class:"step font-bold",style:un({backgroundColor:u.done?"transparent":"inherit"})},[Le(o,{done:u.done,message:u.message,status:u.status},null,8,["done","message","status"])],4))),128))]),p("div",dut,[(M(!0),L(Xe,null,bt(t.message.html_js_s,(u,_)=>(M(),L("div",{key:"htmljs-"+t.message.id+"-"+_,class:"htmljs font-bold",style:un({backgroundColor:n.step.done?"transparent":"inherit"})},[Le(a,{htmlContent:u},null,8,["htmlContent"])],4))),128))]),s.editMsgMode?X("",!0):(M(),Qt(l,{key:0,ref:"mdRender",host:t.host,"markdown-text":t.message.content,message_id:t.message.id,discussion_id:t.message.discussion_id},null,8,["host","markdown-text","message_id","discussion_id"])),p("div",null,[t.message.open?Ae((M(),L("textarea",{key:0,ref:"mdTextarea",onKeydown:e[17]||(e[17]=Fo(Oe((...u)=>s.insertTab&&s.insertTab(...u),["prevent"]),["tab"])),class:"block min-h-[900px] p-2.5 w-full text-gray-900 bg-gray-50 rounded-lg border border-gray-300 focus:ring-blue-500 focus:border-blue-500 dark:bg-gray-700 dark:border-gray-600 dark:placeholder-gray-400 dark:text-white dark:focus:ring-blue-500 dark:focus:border-blue-500 overflow-y-scroll flex flex-col shadow-lg p-10 pt-0 overflow-y-scroll dark:bg-bg-dark scrollbar-thin scrollbar-track-bg-light-tone scrollbar-thumb-bg-light-tone-panel hover:scrollbar-thumb-primary dark:scrollbar-track-bg-dark-tone dark:scrollbar-thumb-bg-dark-tone-panel dark:hover:scrollbar-thumb-primary active:scrollbar-thumb-secondary",rows:4,style:un({minHeight:r.mdRenderHeight+"px"}),placeholder:"Enter message here...","onUpdate:modelValue":e[18]||(e[18]=u=>t.message.content=u)},`\r + `,36)),[[Je,t.message.content]]):X("",!0)]),t.message.metadata!==null?(M(),L("div",uut,[(M(!0),L(Xe,null,bt(t.message.metadata,(u,_)=>(M(),L("div",{key:"json-"+t.message.id+"-"+_,class:"json font-bold"},[Le(c,{jsonFormText:u.title,jsonData:u.content},null,8,["jsonFormText","jsonData"])]))),128))])):X("",!0),t.message.ui!==null&&t.message.ui!==void 0&&t.message.ui!==""?(M(),Qt(d,{key:2,class:"w-full h-full",code:t.message.ui},null,8,["code"])):X("",!0),r.audio_url!=null?(M(),L("audio",_ut,[p("source",{src:r.audio_url,type:"audio/wav"},null,8,put),$e(" Your browser does not support the audio element. ")],512)):X("",!0)]),p("div",hut,[p("div",fut,[t.message.binding?(M(),L("p",mut,[$e("Binding: "),p("span",gut,me(t.message.binding),1)])):X("",!0),t.message.model?(M(),L("p",Eut,[$e("Model: "),p("span",but,me(t.message.model),1)])):X("",!0),t.message.seed?(M(),L("p",Sut,[$e("Seed: "),p("span",yut,me(t.message.seed),1)])):X("",!0),s.time_spent?(M(),L("p",vut,[$e("Time spent: "),p("span",{class:"font-thin",title:"Finished generating: "+s.finished_generating_at_parsed},me(s.time_spent),9,Tut)])):X("",!0)])])])])])}const bw=ft(pdt,[["render",xut]]),Cut="/";Pe.defaults.baseURL="/";const Rut={name:"MountedPersonalities",props:{onShowPersList:Function,onReady:Function},components:{Toast:Ol,UniversalForm:Nl},data(){return{bUrl:Cut,isMounted:!1,show:!1}},async mounted(){await this.constructor(),this.isMounted=!0},async activated(){this.isMounted&&await this.constructor()},computed:{configFile:{get(){return this.$store.state.config},set(n){this.$store.commit("setConfig",n)}},mountedPers:{get(){return this.$store.state.mountedPers},set(n){this.$store.commit("setMountedPers",n)}},personalities:{get(){return this.$store.state.personalities},set(n){this.$store.commit("setPersonalities",n)}},mountedPersArr:{get(){return this.$store.state.mountedPersArr},set(n){this.$store.commit("setMountedPers",n)}}},methods:{onSettingsPersonality(n){try{Pe.get("/get_active_personality_settings").then(e=>{e&&(console.log("pers sett",e),e.data&&Object.keys(e.data).length>0?this.$refs.universalForm.showForm(e.data,"Personality settings - "+n.name,"Save changes","Cancel").then(t=>{try{Pe.post("/set_active_personality_settings",t).then(i=>{i&&i.data?(console.log("personality set with new settings",i.data),this.$refs.toast.showToast("Personality settings updated successfully!",4,!0)):this.$refs.toast.showToast(`Did not get Personality settings responses. `+i,4,!1)})}catch(i){this.$refs.toast.showToast(`Did not get Personality settings responses. - Endpoint error: `+i.message,4,!1)}}):this.$refs.toast.showToast("Personality has no settings",4,!1))})}catch(e){this.$refs.toast.showToast("Could not open personality settings. Endpoint error: "+e.message,4,!1)}},toggleShowPersList(){this.onShowPersList()},async constructor(){for(Ue(()=>{Ge.replace()});this.$store.state.ready===!1;)await new Promise(n=>setTimeout(n,100));this.onReady()},async api_get_req(n){try{const e=await Pe.get("/"+n);if(e)return e.data}catch(e){console.log(e.message,"api_get_req - mountedPersonalities");return}},personalityImgPlacehodler(n){n.target.src=Pl}}},Tut={class:"w-fit select-none"},xut={key:0,class:"flex -space-x-4"},Cut=["src","title"],Rut={key:1,class:"flex -space-x-4"},Aut=["src","title"],wut={key:2,title:"Loading personalities"},Out=p("div",{role:"status"},[p("svg",{"aria-hidden":"true",class:"w-6 h-6 animate-spin fill-secondary",viewBox:"0 0 100 101",fill:"none",xmlns:"http://www.w3.org/2000/svg"},[p("path",{d:"M100 50.5908C100 78.2051 77.6142 100.591 50 100.591C22.3858 100.591 0 78.2051 0 50.5908C0 22.9766 22.3858 0.59082 50 0.59082C77.6142 0.59082 100 22.9766 100 50.5908ZM9.08144 50.5908C9.08144 73.1895 27.4013 91.5094 50 91.5094C72.5987 91.5094 90.9186 73.1895 90.9186 50.5908C90.9186 27.9921 72.5987 9.67226 50 9.67226C27.4013 9.67226 9.08144 27.9921 9.08144 50.5908Z",fill:"currentColor"}),p("path",{d:"M93.9676 39.0409C96.393 38.4038 97.8624 35.9116 97.0079 33.5539C95.2932 28.8227 92.871 24.3692 89.8167 20.348C85.8452 15.1192 80.8826 10.7238 75.2124 7.41289C69.5422 4.10194 63.2754 1.94025 56.7698 1.05124C51.7666 0.367541 46.6976 0.446843 41.7345 1.27873C39.2613 1.69328 37.813 4.19778 38.4501 6.62326C39.0873 9.04874 41.5694 10.4717 44.0505 10.1071C47.8511 9.54855 51.7191 9.52689 55.5402 10.0491C60.8642 10.7766 65.9928 12.5457 70.6331 15.2552C75.2735 17.9648 79.3347 21.5619 82.5849 25.841C84.9175 28.9121 86.7997 32.2913 88.1811 35.8758C89.083 38.2158 91.5421 39.6781 93.9676 39.0409Z",fill:"currentFill"})]),p("span",{class:"sr-only"},"Loading...")],-1),Nut=[Out];function Mut(n,e,t,i,r,s){const o=St("UniversalForm");return M(),L(Xe,null,[p("div",Tut,[s.mountedPersArr.length>1?(M(),L("div",xut,[p("img",{src:r.bUrl+s.mountedPers.avatar,onError:e[0]||(e[0]=(...a)=>s.personalityImgPlacehodler&&s.personalityImgPlacehodler(...a)),class:"w-8 h-8 rounded-full object-fill text-red-700 border-2 active:scale-90 hover:z-20 hover:-translate-y-2 duration-150 border-secondary cursor-pointer",title:"Active personality: "+s.mountedPers.name,onClick:e[1]||(e[1]=a=>s.onSettingsPersonality(s.mountedPers))},null,40,Cut),p("div",{class:"flex items-center justify-center w-8 h-8 cursor-pointer text-xs font-medium bg-bg-light dark:bg-bg-dark border-2 hover:border-secondary rounded-full hover:bg-bg-light-tone dark:hover:bg-bg-dark-tone dark:border-gray-800 hover:z-20 hover:-translate-y-2 duration-150 active:scale-90",onClick:e[2]||(e[2]=Oe((...a)=>s.toggleShowPersList&&s.toggleShowPersList(...a),["stop"])),title:"Click to show more"},"+"+me(s.mountedPersArr.length-1),1)])):X("",!0),s.mountedPersArr.length==1?(M(),L("div",Rut,[p("img",{src:r.bUrl+this.$store.state.mountedPers.avatar,onError:e[3]||(e[3]=(...a)=>s.personalityImgPlacehodler&&s.personalityImgPlacehodler(...a)),class:"w-8 h-8 rounded-full object-fill text-red-700 border-2 active:scale-90 hover:z-20 cursor-pointer border-secondary",title:"Active personality: "+this.$store.state.mountedPers.name,onClick:e[4]||(e[4]=Oe((...a)=>s.toggleShowPersList&&s.toggleShowPersList(...a),["stop"]))},null,40,Aut)])):X("",!0),s.mountedPersArr.length==0?(M(),L("div",wut,Nut)):X("",!0)]),Le(o,{ref:"universalForm",class:"z-20"},null,512)],64)}const Iut=ft(vut,[["render",Mut]]);const Dut="/";Pe.defaults.baseURL="/";const Lut={props:{onTalk:Function,onMounted:Function,onUnmounted:Function,onRemounted:Function,discussionPersonalities:Array,onShowPersList:Function},components:{PersonalityEntry:mw,Toast:Ol,UniversalForm:Nl},name:"MountedPersonalitiesList",data(){return{bUrl:Dut,isMounted:!1,isLoading:!1}},async mounted(){await this.constructor(),this.isMounted=!0},async activated(){this.isMounted&&await this.constructor()},computed:{configFile:{get(){return this.$store.state.config},set(n){this.$store.commit("setConfig",n)}},personalities:{get(){return this.$store.state.personalities},set(n){this.$store.commit("setPersonalities",n)}},mountedPersArr:{get(){return this.$store.state.mountedPersArr},set(n){this.$store.commit("setMountedPers",n)}}},methods:{toggleShowPersList(){this.onShowPersList()},async constructor(){},async api_get_req(n){try{const e=await Pe.get("/"+n);if(e)return e.data}catch(e){console.log(e.message,"api_get_req - mountedPersonalities");return}},personalityImgPlacehodler(n){n.target.src=Pl},onPersonalityReinstall(n){console.log("on reinstall ",n),this.isLoading=!0,Pe.post("/reinstall_personality",{name:n.personality.full_path}).then(e=>{if(e)return this.isLoading=!1,console.log("reinstall_personality",e),e.data.status?this.$refs.toast.showToast("Personality reinstalled successfully!",4,!0):this.$refs.toast.showToast("Could not reinstall personality",4,!1),e.data;this.isLoading=!1}).catch(e=>(this.isLoading=!1,this.$refs.toast.showToast(`Could not reinstall personality + Endpoint error: `+i.message,4,!1)}}):this.$refs.toast.showToast("Personality has no settings",4,!1))})}catch(e){this.$refs.toast.showToast("Could not open personality settings. Endpoint error: "+e.message,4,!1)}},toggleShowPersList(){this.onShowPersList()},async constructor(){for(Ue(()=>{Ge.replace()});this.$store.state.ready===!1;)await new Promise(n=>setTimeout(n,100));this.onReady()},async api_get_req(n){try{const e=await Pe.get("/"+n);if(e)return e.data}catch(e){console.log(e.message,"api_get_req - mountedPersonalities");return}},personalityImgPlacehodler(n){n.target.src=Pl}}},Aut={class:"w-fit select-none"},wut={key:0,class:"flex -space-x-4"},Out=["src","title"],Nut={key:1,class:"flex -space-x-4"},Mut=["src","title"],Iut={key:2,title:"Loading personalities"},Dut=p("div",{role:"status"},[p("svg",{"aria-hidden":"true",class:"w-6 h-6 animate-spin fill-secondary",viewBox:"0 0 100 101",fill:"none",xmlns:"http://www.w3.org/2000/svg"},[p("path",{d:"M100 50.5908C100 78.2051 77.6142 100.591 50 100.591C22.3858 100.591 0 78.2051 0 50.5908C0 22.9766 22.3858 0.59082 50 0.59082C77.6142 0.59082 100 22.9766 100 50.5908ZM9.08144 50.5908C9.08144 73.1895 27.4013 91.5094 50 91.5094C72.5987 91.5094 90.9186 73.1895 90.9186 50.5908C90.9186 27.9921 72.5987 9.67226 50 9.67226C27.4013 9.67226 9.08144 27.9921 9.08144 50.5908Z",fill:"currentColor"}),p("path",{d:"M93.9676 39.0409C96.393 38.4038 97.8624 35.9116 97.0079 33.5539C95.2932 28.8227 92.871 24.3692 89.8167 20.348C85.8452 15.1192 80.8826 10.7238 75.2124 7.41289C69.5422 4.10194 63.2754 1.94025 56.7698 1.05124C51.7666 0.367541 46.6976 0.446843 41.7345 1.27873C39.2613 1.69328 37.813 4.19778 38.4501 6.62326C39.0873 9.04874 41.5694 10.4717 44.0505 10.1071C47.8511 9.54855 51.7191 9.52689 55.5402 10.0491C60.8642 10.7766 65.9928 12.5457 70.6331 15.2552C75.2735 17.9648 79.3347 21.5619 82.5849 25.841C84.9175 28.9121 86.7997 32.2913 88.1811 35.8758C89.083 38.2158 91.5421 39.6781 93.9676 39.0409Z",fill:"currentFill"})]),p("span",{class:"sr-only"},"Loading...")],-1),Lut=[Dut];function kut(n,e,t,i,r,s){const o=St("UniversalForm");return M(),L(Xe,null,[p("div",Aut,[s.mountedPersArr.length>1?(M(),L("div",wut,[p("img",{src:r.bUrl+s.mountedPers.avatar,onError:e[0]||(e[0]=(...a)=>s.personalityImgPlacehodler&&s.personalityImgPlacehodler(...a)),class:"w-8 h-8 rounded-full object-fill text-red-700 border-2 active:scale-90 hover:z-20 hover:-translate-y-2 duration-150 border-secondary cursor-pointer",title:"Active personality: "+s.mountedPers.name,onClick:e[1]||(e[1]=a=>s.onSettingsPersonality(s.mountedPers))},null,40,Out),p("div",{class:"flex items-center justify-center w-8 h-8 cursor-pointer text-xs font-medium bg-bg-light dark:bg-bg-dark border-2 hover:border-secondary rounded-full hover:bg-bg-light-tone dark:hover:bg-bg-dark-tone dark:border-gray-800 hover:z-20 hover:-translate-y-2 duration-150 active:scale-90",onClick:e[2]||(e[2]=Oe((...a)=>s.toggleShowPersList&&s.toggleShowPersList(...a),["stop"])),title:"Click to show more"},"+"+me(s.mountedPersArr.length-1),1)])):X("",!0),s.mountedPersArr.length==1?(M(),L("div",Nut,[p("img",{src:r.bUrl+this.$store.state.mountedPers.avatar,onError:e[3]||(e[3]=(...a)=>s.personalityImgPlacehodler&&s.personalityImgPlacehodler(...a)),class:"w-8 h-8 rounded-full object-fill text-red-700 border-2 active:scale-90 hover:z-20 cursor-pointer border-secondary",title:"Active personality: "+this.$store.state.mountedPers.name,onClick:e[4]||(e[4]=Oe((...a)=>s.toggleShowPersList&&s.toggleShowPersList(...a),["stop"]))},null,40,Mut)])):X("",!0),s.mountedPersArr.length==0?(M(),L("div",Iut,Lut)):X("",!0)]),Le(o,{ref:"universalForm",class:"z-20"},null,512)],64)}const Put=ft(Rut,[["render",kut]]);const Uut="/";Pe.defaults.baseURL="/";const Fut={props:{onTalk:Function,onMounted:Function,onUnmounted:Function,onRemounted:Function,discussionPersonalities:Array,onShowPersList:Function},components:{PersonalityEntry:mw,Toast:Ol,UniversalForm:Nl},name:"MountedPersonalitiesList",data(){return{bUrl:Uut,isMounted:!1,isLoading:!1}},async mounted(){await this.constructor(),this.isMounted=!0},async activated(){this.isMounted&&await this.constructor()},computed:{configFile:{get(){return this.$store.state.config},set(n){this.$store.commit("setConfig",n)}},personalities:{get(){return this.$store.state.personalities},set(n){this.$store.commit("setPersonalities",n)}},mountedPersArr:{get(){return this.$store.state.mountedPersArr},set(n){this.$store.commit("setMountedPers",n)}}},methods:{toggleShowPersList(){this.onShowPersList()},async constructor(){},async api_get_req(n){try{const e=await Pe.get("/"+n);if(e)return e.data}catch(e){console.log(e.message,"api_get_req - mountedPersonalities");return}},personalityImgPlacehodler(n){n.target.src=Pl},onPersonalityReinstall(n){console.log("on reinstall ",n),this.isLoading=!0,Pe.post("/reinstall_personality",{name:n.personality.full_path}).then(e=>{if(e)return this.isLoading=!1,console.log("reinstall_personality",e),e.data.status?this.$refs.toast.showToast("Personality reinstalled successfully!",4,!0):this.$refs.toast.showToast("Could not reinstall personality",4,!1),e.data;this.isLoading=!1}).catch(e=>(this.isLoading=!1,this.$refs.toast.showToast(`Could not reinstall personality `+e.message,4,!1),{status:!1}))},onPersonalityMounted(n){this.mountPersonality(n)},onPersonalityUnMounted(n){this.unmountPersonality(n)},onPersonalityRemount(n){this.reMountPersonality(n)},async handleOnTalk(n){if(Ge.replace(),console.log("ppa",n),n){if(n.isMounted){const e=await this.select_personality(n);e&&e.status&&(await this.constructor(),this.$refs.toast.showToast(`Selected personality: `+n.name,4,!0))}else this.onPersonalityMounted(n);this.onTalk(n)}},async onPersonalitySelected(n){if(Ge.replace(),console.log("Selected personality : ",JSON.stringify(n.personality)),n){if(n.selected){this.$refs.toast.showToast("Personality already selected",4,!0);return}if(n.isMounted){const e=await this.select_personality(n);e&&e.status&&(await this.constructor(),this.$refs.toast.showToast(`Selected personality: `+n.name,4,!0))}else this.onPersonalityMounted(n)}},onSettingsPersonality(n){try{Pe.get("/get_active_personality_settings").then(e=>{e&&(console.log("pers sett",e),e.data&&Object.keys(e.data).length>0?this.$refs.universalForm.showForm(e.data,"Personality settings - "+n.personality.name,"Save changes","Cancel").then(t=>{try{Pe.post("/set_active_personality_settings",t).then(i=>{i&&i.data?(console.log("personality set with new settings",i.data),this.$refs.toast.showToast("Personality settings updated successfully!",4,!0)):this.$refs.toast.showToast(`Did not get Personality settings responses. @@ -170,17 +172,17 @@ You need to apply changes before you leave, or else.`,"Apply configuration","Can Error: `+e.error,4,!1))},async reMountPersonality(n){if(console.log("remount pers",n),!n)return;if(!this.configFile.personalities.includes(n.personality.full_path)){this.$refs.toast.showToast("Personality not mounted",4,!1);return}const e=await this.remount_personality(n.personality);console.log("remount_personality res",e),e.status?(this.configFile.personalities=e.personalities,this.$refs.toast.showToast("Personality remounted",4,!0),n.isMounted=!0,this.onMounted(this),(await this.select_personality(n.personality)).status&&this.$refs.toast.showToast(`Selected personality: `+n.personality.name,4,!0),this.getMountedPersonalities()):(n.isMounted=!1,this.$refs.toast.showToast(`Could not mount personality Error: `+e.error,4,!1))},async unmountPersonality(n){if(!n)return;console.log(`Unmounting ${JSON.stringify(n.personality)}`);const e=await this.unmount_personality(n.personality);if(e.status){console.log("unmount response",e),this.configFile.active_personality_id=e.active_personality_id,this.configFile.personalities=e.personalities;const t=this.configFile.personalities[this.configFile.active_personality_id],i=this.personalities.findIndex(a=>a.full_path==t),r=this.$refs.personalitiesZoo.findIndex(a=>a.full_path==n.full_path),s=this.personalities[i];s.isMounted=!1,s.selected=!0,this.$refs.personalitiesZoo[r].isMounted=!1,this.getMountedPersonalities(),(await this.select_personality(s)).status&&Ge.replace(),this.$refs.toast.showToast("Personality unmounted",4,!0),this.onUnMounted(this)}else this.$refs.toast.showToast(`Could not unmount personality -Error: `+e.error,4,!1)},getMountedPersonalities(){this.isLoading=!0;let n=[];console.log(this.configFile.personalities.length);for(let e=0;es.full_path==t),r=this.personalities[i];if(r)console.log("adding from config"),n.push(r);else{console.log("adding default");const s=this.personalities.findIndex(a=>a.full_path=="english/generic/lollms"),o=this.personalities[s];n.push(o)}}if(this.mountedPersArr=[],this.mountedPersArr=n,console.log("discussionPersonalities",this.discussionPersonalities),this.discussionPersonalities!=null&&this.discussionPersonalities.length>0)for(let e=0;er.full_path==t);if(console.log("discussionPersonalities -includes",i),console.log("discussionPersonalities -mounted list",this.mountedPersArr),i==-1){const r=this.personalities.findIndex(o=>o.full_path==t),s=this.personalities[r];console.log("adding discucc121",s,t),s&&(this.mountedPersArr.push(s),console.log("adding discucc",s))}}this.isLoading=!1,console.log("getMountedPersonalities",this.mountedPersArr),console.log("fig",this.configFile)}}},hE=n=>(Gs("data-v-d16a58b9"),n=n(),zs(),n),kut={class:"text-left overflow-visible text-base font-semibold cursor-pointer select-none items-center flex flex-col flex-grow w-full overflow-x-auto scrollbar-thin scrollbar-track-bg-light scrollbar-thumb-bg-light-tone hover:scrollbar-thumb-primary dark:scrollbar-track-bg-dark dark:scrollbar-thumb-bg-dark-tone dark:hover:scrollbar-thumb-primary active:scrollbar-thumb-secondary"},Put={key:0,role:"status",class:"flex justify-center overflow-y-hidden"},Uut=hE(()=>p("svg",{"aria-hidden":"true",class:"w-6 h-6 animate-spin fill-secondary",viewBox:"0 0 100 101",fill:"none",xmlns:"http://www.w3.org/2000/svg"},[p("path",{d:"M100 50.5908C100 78.2051 77.6142 100.591 50 100.591C22.3858 100.591 0 78.2051 0 50.5908C0 22.9766 22.3858 0.59082 50 0.59082C77.6142 0.59082 100 22.9766 100 50.5908ZM9.08144 50.5908C9.08144 73.1895 27.4013 91.5094 50 91.5094C72.5987 91.5094 90.9186 73.1895 90.9186 50.5908C90.9186 27.9921 72.5987 9.67226 50 9.67226C27.4013 9.67226 9.08144 27.9921 9.08144 50.5908Z",fill:"currentColor"}),p("path",{d:"M93.9676 39.0409C96.393 38.4038 97.8624 35.9116 97.0079 33.5539C95.2932 28.8227 92.871 24.3692 89.8167 20.348C85.8452 15.1192 80.8826 10.7238 75.2124 7.41289C69.5422 4.10194 63.2754 1.94025 56.7698 1.05124C51.7666 0.367541 46.6976 0.446843 41.7345 1.27873C39.2613 1.69328 37.813 4.19778 38.4501 6.62326C39.0873 9.04874 41.5694 10.4717 44.0505 10.1071C47.8511 9.54855 51.7191 9.52689 55.5402 10.0491C60.8642 10.7766 65.9928 12.5457 70.6331 15.2552C75.2735 17.9648 79.3347 21.5619 82.5849 25.841C84.9175 28.9121 86.7997 32.2913 88.1811 35.8758C89.083 38.2158 91.5421 39.6781 93.9676 39.0409Z",fill:"currentFill"})],-1)),Fut=hE(()=>p("span",{class:"sr-only"},"Loading...",-1)),But=[Uut,Fut],Gut=hE(()=>p("i",{"data-feather":"chevron-down"},null,-1)),zut=[Gut],Vut={class:"block my-2 text-sm font-medium text-gray-900 dark:text-white"},Hut={class:"overflow-y-auto no-scrollbar pb-0 grid lg:grid-cols-3 md:grid-cols-2 gap-4 max-h-96"};function qut(n,e,t,i,r,s){const o=St("personality-entry"),a=St("Toast"),l=St("UniversalForm");return M(),L("div",kut,[r.isLoading?(M(),L("div",Put,But)):X("",!0),p("div",null,[s.mountedPersArr.length>0?(M(),L("div",{key:0,class:Ke(r.isLoading?"pointer-events-none opacity-30 cursor-default":"")},[p("button",{class:"mt-0 w-full text-2xl hover:text-secondary duration-75 flex justify-center hover:bg-bg-light-tone hover:dark:bg-bg-dark-tone rounded-lg",title:"Close personality list",type:"button",onClick:e[0]||(e[0]=Oe((...c)=>s.toggleShowPersList&&s.toggleShowPersList(...c),["stop"]))},zut),p("label",Vut," Mounted Personalities: ("+me(s.mountedPersArr.length)+") ",1),p("div",Hut,[Le(Vr,{name:"bounce"},{default:dt(()=>[(M(!0),L(Xe,null,bt(this.$store.state.mountedPersArr,(c,d)=>(M(),Qt(o,{ref_for:!0,ref:"personalitiesZoo",key:"index-"+d+"-"+c.name,personality:c,full_path:c.full_path,select_language:!1,selected:s.configFile.personalities[s.configFile.active_personality_id]===c.full_path||s.configFile.personalities[s.configFile.active_personality_id]===c.full_path+":"+c.language,"on-selected":s.onPersonalitySelected,"on-mount":s.onPersonalityMounted,"on-un-mount":s.onPersonalityUnMounted,"on-remount":s.onPersonalityRemount,"on-settings":s.onSettingsPersonality,"on-reinstall":s.onPersonalityReinstall,"on-talk":s.handleOnTalk},null,8,["personality","full_path","selected","on-selected","on-mount","on-un-mount","on-remount","on-settings","on-reinstall","on-talk"]))),128))]),_:1})])],2)):X("",!0)]),Le(a,{ref:"toast"},null,512),Le(l,{ref:"universalForm",class:"z-20"},null,512)])}const Yut=ft(Lut,[["render",qut],["__scopeId","data-v-d16a58b9"]]);const $ut={components:{InteractiveMenu:kl},props:{commandsList:{type:Array,required:!0},sendCommand:Function,onShowToastMessage:Function},data(){return{loading:!1,selectedFile:null,showMenu:!1,showHelpText:!1,helpText:"",commands:[]}},async mounted(){nextTick(()=>{Ge.replace()})},methods:{isHTML(n){const t=new DOMParser().parseFromString(n,"text/html");return Array.from(t.body.childNodes).some(i=>i.nodeType===Node.ELEMENT_NODE)},selectFile(n,e){const t=document.createElement("input");t.type="file",t.accept=n,t.onchange=i=>{this.selectedFile=i.target.files[0],console.log("File selected"),e()},t.click()},uploadFile(){new FormData().append("file",this.selectedFile),console.log("Uploading file"),this.loading=!0;const e=new FileReader;e.onload=()=>{const t={filename:this.selectedFile.name,fileData:e.result};He.on("file_received",i=>{i.status?this.onShowToastMessage("File uploaded successfully",4,!0):this.onShowToastMessage(`Couldn't upload file -`+i.error,4,!1),this.loading=!1,He.off("file_received")}),He.emit("send_file",t)},e.readAsDataURL(this.selectedFile)},async constructor(){nextTick(()=>{Ge.replace()})},toggleMenu(){this.showMenu=!this.showMenu},execute_cmd(n){this.showMenu=!this.showMenu,n.hasOwnProperty("is_file")?(console.log("Need to send a file."),this.selectFile(n.hasOwnProperty("file_types")?n.file_types:"*",()=>{this.selectedFile!=null&&this.uploadFile()})):this.sendCommand(n.value)},handleClickOutside(n){const e=this.$el.querySelector(".commands-menu-items-wrapper");e&&!e.contains(n.target)&&(this.showMenu=!1)}},mounted(){this.commands=this.commandsList,document.addEventListener("click",this.handleClickOutside)},beforeUnmount(){document.removeEventListener("click",this.handleClickOutside)}},Wut=n=>(Gs("data-v-52cfa09c"),n=n(),zs(),n),Kut={key:0,title:"Loading..",class:"flex flex-row flex-grow justify-end"},jut=Wut(()=>p("div",{role:"status"},[p("svg",{"aria-hidden":"true",class:"w-6 h-6 animate-spin fill-secondary",viewBox:"0 0 100 101",fill:"none",xmlns:"http://www.w3.org/2000/svg"},[p("path",{d:"M100 50.5908C100 78.2051 77.6142 100.591 50 100.591C22.3858 100.591 0 78.2051 0 50.5908C0 22.9766 22.3858 0.59082 50 0.59082C77.6142 0.59082 100 22.9766 100 50.5908ZM9.08144 50.5908C9.08144 73.1895 27.4013 91.5094 50 91.5094C72.5987 91.5094 90.9186 73.1895 90.9186 50.5908C90.9186 27.9921 72.5987 9.67226 50 9.67226C27.4013 9.67226 9.08144 27.9921 9.08144 50.5908Z",fill:"currentColor"}),p("path",{d:"M93.9676 39.0409C96.393 38.4038 97.8624 35.9116 97.0079 33.5539C95.2932 28.8227 92.871 24.3692 89.8167 20.348C85.8452 15.1192 80.8826 10.7238 75.2124 7.41289C69.5422 4.10194 63.2754 1.94025 56.7698 1.05124C51.7666 0.367541 46.6976 0.446843 41.7345 1.27873C39.2613 1.69328 37.813 4.19778 38.4501 6.62326C39.0873 9.04874 41.5694 10.4717 44.0505 10.1071C47.8511 9.54855 51.7191 9.52689 55.5402 10.0491C60.8642 10.7766 65.9928 12.5457 70.6331 15.2552C75.2735 17.9648 79.3347 21.5619 82.5849 25.841C84.9175 28.9121 86.7997 32.2913 88.1811 35.8758C89.083 38.2158 91.5421 39.6781 93.9676 39.0409Z",fill:"currentFill"})]),p("span",{class:"sr-only"},"Loading...")],-1)),Qut=[jut];function Xut(n,e,t,i,r,s){const o=St("InteractiveMenu");return r.loading?(M(),L("div",Kut,Qut)):(M(),Qt(o,{key:1,commands:t.commandsList,execute_cmd:s.execute_cmd},null,8,["commands","execute_cmd"]))}const Zut=ft($ut,[["render",Xut],["__scopeId","data-v-52cfa09c"]]);console.log("modelImgPlaceholder:",Ti);const Jut="/",e_t={name:"ChatBox",emits:["messageSentEvent","sendCMDEvent","stopGenerating","loaded","createEmptyUserMessage","createEmptyAIMessage","personalitySelected","addWebLink"],props:{onTalk:Function,discussionList:Array,loading:!1,onShowToastMessage:Function},components:{UniversalForm:Nl,MountedPersonalities:Iut,MountedPersonalitiesList:Yut,PersonalitiesCommands:Zut,InteractiveMenu:kl},setup(){},data(){return{modelImgPlaceholder:Ti,bUrl:Jut,message:"",selecting_model:!1,selectedModel:"",isLesteningToVoice:!1,filesList:[],isFileSentList:[],totalSize:0,showfilesList:!0,showPersonalities:!1,personalities_ready:!1,models_menu_icon:""}},computed:{currentModel(){if(this.$store.state.currentModel!=null)return console.log("Model found"),this.$store.state.currentModel;{console.log("No model found");let n={};return n.name="unknown",n}},installedModels(){return this.$store.state.installedModels},model_name(){return this.$store.state.config.model_name},config(){return this.$store.state.config},mountedPers(){return this.$store.state.mountedPers},allDiscussionPersonalities(){if(this.discussionList.length>0){let n=[];for(let e=0;e{this.isLoading=!1,n&&(console.log("binding sett",n),n.data&&Object.keys(n.data).length>0?this.$refs.universalForm.showForm(n.data,"Binding settings ","Save changes","Cancel").then(e=>{try{Pe.post("/set_active_binding_settings",e).then(t=>{t&&t.data?(console.log("binding set with new settings",t.data),this.$store.state.toast.showToast("Binding settings updated successfully!",4,!0)):(this.$store.state.toast.showToast(`Did not get binding settings responses. +Error: `+e.error,4,!1)},getMountedPersonalities(){this.isLoading=!0;let n=[];console.log(this.configFile.personalities.length);for(let e=0;es.full_path==t),r=this.personalities[i];if(r)console.log("adding from config"),n.push(r);else{console.log("adding default");const s=this.personalities.findIndex(a=>a.full_path=="english/generic/lollms"),o=this.personalities[s];n.push(o)}}if(this.mountedPersArr=[],this.mountedPersArr=n,console.log("discussionPersonalities",this.discussionPersonalities),this.discussionPersonalities!=null&&this.discussionPersonalities.length>0)for(let e=0;er.full_path==t);if(console.log("discussionPersonalities -includes",i),console.log("discussionPersonalities -mounted list",this.mountedPersArr),i==-1){const r=this.personalities.findIndex(o=>o.full_path==t),s=this.personalities[r];console.log("adding discucc121",s,t),s&&(this.mountedPersArr.push(s),console.log("adding discucc",s))}}this.isLoading=!1,console.log("getMountedPersonalities",this.mountedPersArr),console.log("fig",this.configFile)}}},hE=n=>(Gs("data-v-d16a58b9"),n=n(),zs(),n),But={class:"text-left overflow-visible text-base font-semibold cursor-pointer select-none items-center flex flex-col flex-grow w-full overflow-x-auto scrollbar-thin scrollbar-track-bg-light scrollbar-thumb-bg-light-tone hover:scrollbar-thumb-primary dark:scrollbar-track-bg-dark dark:scrollbar-thumb-bg-dark-tone dark:hover:scrollbar-thumb-primary active:scrollbar-thumb-secondary"},Gut={key:0,role:"status",class:"flex justify-center overflow-y-hidden"},zut=hE(()=>p("svg",{"aria-hidden":"true",class:"w-6 h-6 animate-spin fill-secondary",viewBox:"0 0 100 101",fill:"none",xmlns:"http://www.w3.org/2000/svg"},[p("path",{d:"M100 50.5908C100 78.2051 77.6142 100.591 50 100.591C22.3858 100.591 0 78.2051 0 50.5908C0 22.9766 22.3858 0.59082 50 0.59082C77.6142 0.59082 100 22.9766 100 50.5908ZM9.08144 50.5908C9.08144 73.1895 27.4013 91.5094 50 91.5094C72.5987 91.5094 90.9186 73.1895 90.9186 50.5908C90.9186 27.9921 72.5987 9.67226 50 9.67226C27.4013 9.67226 9.08144 27.9921 9.08144 50.5908Z",fill:"currentColor"}),p("path",{d:"M93.9676 39.0409C96.393 38.4038 97.8624 35.9116 97.0079 33.5539C95.2932 28.8227 92.871 24.3692 89.8167 20.348C85.8452 15.1192 80.8826 10.7238 75.2124 7.41289C69.5422 4.10194 63.2754 1.94025 56.7698 1.05124C51.7666 0.367541 46.6976 0.446843 41.7345 1.27873C39.2613 1.69328 37.813 4.19778 38.4501 6.62326C39.0873 9.04874 41.5694 10.4717 44.0505 10.1071C47.8511 9.54855 51.7191 9.52689 55.5402 10.0491C60.8642 10.7766 65.9928 12.5457 70.6331 15.2552C75.2735 17.9648 79.3347 21.5619 82.5849 25.841C84.9175 28.9121 86.7997 32.2913 88.1811 35.8758C89.083 38.2158 91.5421 39.6781 93.9676 39.0409Z",fill:"currentFill"})],-1)),Vut=hE(()=>p("span",{class:"sr-only"},"Loading...",-1)),Hut=[zut,Vut],qut=hE(()=>p("i",{"data-feather":"chevron-down"},null,-1)),Yut=[qut],$ut={class:"block my-2 text-sm font-medium text-gray-900 dark:text-white"},Wut={class:"overflow-y-auto no-scrollbar pb-0 grid lg:grid-cols-3 md:grid-cols-2 gap-4 max-h-96"};function Kut(n,e,t,i,r,s){const o=St("personality-entry"),a=St("Toast"),l=St("UniversalForm");return M(),L("div",But,[r.isLoading?(M(),L("div",Gut,Hut)):X("",!0),p("div",null,[s.mountedPersArr.length>0?(M(),L("div",{key:0,class:Ke(r.isLoading?"pointer-events-none opacity-30 cursor-default":"")},[p("button",{class:"mt-0 w-full text-2xl hover:text-secondary duration-75 flex justify-center hover:bg-bg-light-tone hover:dark:bg-bg-dark-tone rounded-lg",title:"Close personality list",type:"button",onClick:e[0]||(e[0]=Oe((...c)=>s.toggleShowPersList&&s.toggleShowPersList(...c),["stop"]))},Yut),p("label",$ut," Mounted Personalities: ("+me(s.mountedPersArr.length)+") ",1),p("div",Wut,[Le(Vr,{name:"bounce"},{default:dt(()=>[(M(!0),L(Xe,null,bt(this.$store.state.mountedPersArr,(c,d)=>(M(),Qt(o,{ref_for:!0,ref:"personalitiesZoo",key:"index-"+d+"-"+c.name,personality:c,full_path:c.full_path,select_language:!1,selected:s.configFile.personalities[s.configFile.active_personality_id]===c.full_path||s.configFile.personalities[s.configFile.active_personality_id]===c.full_path+":"+c.language,"on-selected":s.onPersonalitySelected,"on-mount":s.onPersonalityMounted,"on-un-mount":s.onPersonalityUnMounted,"on-remount":s.onPersonalityRemount,"on-settings":s.onSettingsPersonality,"on-reinstall":s.onPersonalityReinstall,"on-talk":s.handleOnTalk},null,8,["personality","full_path","selected","on-selected","on-mount","on-un-mount","on-remount","on-settings","on-reinstall","on-talk"]))),128))]),_:1})])],2)):X("",!0)]),Le(a,{ref:"toast"},null,512),Le(l,{ref:"universalForm",class:"z-20"},null,512)])}const jut=ft(Fut,[["render",Kut],["__scopeId","data-v-d16a58b9"]]);const Qut={components:{InteractiveMenu:kl},props:{commandsList:{type:Array,required:!0},sendCommand:Function,onShowToastMessage:Function},data(){return{loading:!1,selectedFile:null,showMenu:!1,showHelpText:!1,helpText:"",commands:[]}},async mounted(){nextTick(()=>{Ge.replace()})},methods:{isHTML(n){const t=new DOMParser().parseFromString(n,"text/html");return Array.from(t.body.childNodes).some(i=>i.nodeType===Node.ELEMENT_NODE)},selectFile(n,e){const t=document.createElement("input");t.type="file",t.accept=n,t.onchange=i=>{this.selectedFile=i.target.files[0],console.log("File selected"),e()},t.click()},uploadFile(){new FormData().append("file",this.selectedFile),console.log("Uploading file"),this.loading=!0;const e=new FileReader;e.onload=()=>{const t={filename:this.selectedFile.name,fileData:e.result};He.on("file_received",i=>{i.status?this.onShowToastMessage("File uploaded successfully",4,!0):this.onShowToastMessage(`Couldn't upload file +`+i.error,4,!1),this.loading=!1,He.off("file_received")}),He.emit("send_file",t)},e.readAsDataURL(this.selectedFile)},async constructor(){nextTick(()=>{Ge.replace()})},toggleMenu(){this.showMenu=!this.showMenu},execute_cmd(n){this.showMenu=!this.showMenu,n.hasOwnProperty("is_file")?(console.log("Need to send a file."),this.selectFile(n.hasOwnProperty("file_types")?n.file_types:"*",()=>{this.selectedFile!=null&&this.uploadFile()})):this.sendCommand(n.value)},handleClickOutside(n){const e=this.$el.querySelector(".commands-menu-items-wrapper");e&&!e.contains(n.target)&&(this.showMenu=!1)}},mounted(){this.commands=this.commandsList,document.addEventListener("click",this.handleClickOutside)},beforeUnmount(){document.removeEventListener("click",this.handleClickOutside)}},Xut=n=>(Gs("data-v-52cfa09c"),n=n(),zs(),n),Zut={key:0,title:"Loading..",class:"flex flex-row flex-grow justify-end"},Jut=Xut(()=>p("div",{role:"status"},[p("svg",{"aria-hidden":"true",class:"w-6 h-6 animate-spin fill-secondary",viewBox:"0 0 100 101",fill:"none",xmlns:"http://www.w3.org/2000/svg"},[p("path",{d:"M100 50.5908C100 78.2051 77.6142 100.591 50 100.591C22.3858 100.591 0 78.2051 0 50.5908C0 22.9766 22.3858 0.59082 50 0.59082C77.6142 0.59082 100 22.9766 100 50.5908ZM9.08144 50.5908C9.08144 73.1895 27.4013 91.5094 50 91.5094C72.5987 91.5094 90.9186 73.1895 90.9186 50.5908C90.9186 27.9921 72.5987 9.67226 50 9.67226C27.4013 9.67226 9.08144 27.9921 9.08144 50.5908Z",fill:"currentColor"}),p("path",{d:"M93.9676 39.0409C96.393 38.4038 97.8624 35.9116 97.0079 33.5539C95.2932 28.8227 92.871 24.3692 89.8167 20.348C85.8452 15.1192 80.8826 10.7238 75.2124 7.41289C69.5422 4.10194 63.2754 1.94025 56.7698 1.05124C51.7666 0.367541 46.6976 0.446843 41.7345 1.27873C39.2613 1.69328 37.813 4.19778 38.4501 6.62326C39.0873 9.04874 41.5694 10.4717 44.0505 10.1071C47.8511 9.54855 51.7191 9.52689 55.5402 10.0491C60.8642 10.7766 65.9928 12.5457 70.6331 15.2552C75.2735 17.9648 79.3347 21.5619 82.5849 25.841C84.9175 28.9121 86.7997 32.2913 88.1811 35.8758C89.083 38.2158 91.5421 39.6781 93.9676 39.0409Z",fill:"currentFill"})]),p("span",{class:"sr-only"},"Loading...")],-1)),e_t=[Jut];function t_t(n,e,t,i,r,s){const o=St("InteractiveMenu");return r.loading?(M(),L("div",Zut,e_t)):(M(),Qt(o,{key:1,commands:t.commandsList,execute_cmd:s.execute_cmd},null,8,["commands","execute_cmd"]))}const n_t=ft(Qut,[["render",t_t],["__scopeId","data-v-52cfa09c"]]);console.log("modelImgPlaceholder:",Ti);const i_t="/",r_t={name:"ChatBox",emits:["messageSentEvent","sendCMDEvent","stopGenerating","loaded","createEmptyUserMessage","createEmptyAIMessage","personalitySelected","addWebLink"],props:{onTalk:Function,discussionList:Array,loading:!1,onShowToastMessage:Function},components:{UniversalForm:Nl,MountedPersonalities:Put,MountedPersonalitiesList:jut,PersonalitiesCommands:n_t,InteractiveMenu:kl},setup(){},data(){return{modelImgPlaceholder:Ti,bUrl:i_t,message:"",selecting_model:!1,selectedModel:"",isLesteningToVoice:!1,filesList:[],isFileSentList:[],totalSize:0,showfilesList:!0,showPersonalities:!1,personalities_ready:!1,models_menu_icon:""}},computed:{currentModel(){if(this.$store.state.currentModel!=null)return console.log("Model found"),this.$store.state.currentModel;{console.log("No model found");let n={};return n.name="unknown",n}},installedModels(){return this.$store.state.installedModels},model_name(){return this.$store.state.config.model_name},config(){return this.$store.state.config},mountedPers(){return this.$store.state.mountedPers},allDiscussionPersonalities(){if(this.discussionList.length>0){let n=[];for(let e=0;e{this.isLoading=!1,n&&(console.log("binding sett",n),n.data&&Object.keys(n.data).length>0?this.$refs.universalForm.showForm(n.data,"Binding settings ","Save changes","Cancel").then(e=>{try{Pe.post("/set_active_binding_settings",e).then(t=>{t&&t.data?(console.log("binding set with new settings",t.data),this.$store.state.toast.showToast("Binding settings updated successfully!",4,!0)):(this.$store.state.toast.showToast(`Did not get binding settings responses. `+t,4,!1),this.isLoading=!1)})}catch(t){this.$store.state.toast.showToast(`Did not get binding settings responses. Endpoint error: `+t.message,4,!1),this.isLoading=!1}}):(this.$store.state.toast.showToast("Binding has no settings",4,!1),this.isLoading=!1))})}catch(n){this.isLoading=!1,this.$store.state.toast.showToast("Could not open binding settings. Endpoint error: "+n.message,4,!1)}},async unmountPersonality(n){if(this.loading=!0,!n)return;const e=await this.unmount_personality(n.personality||n);if(e.status){this.$store.state.config.personalities=e.personalities,this.$store.state.toast.showToast("Personality unmounted",4,!0),this.$store.dispatch("refreshMountedPersonalities");const t=this.$store.state.mountedPersArr[this.$store.state.mountedPersArr.length-1];console.log(t,this.$store.state.mountedPersArr.length),(await this.select_personality(n.personality)).status&&this.$store.state.toast.showToast(`Selected personality: `+t.name,4,!0)}else this.$store.state.toast.showToast(`Could not unmount personality Error: `+e.error,4,!1);this.loading=!1},async unmount_personality(n){if(!n)return{status:!1,error:"no personality - unmount_personality"};const e={language:n.language,category:n.category,folder:n.folder};try{const t=await Pe.post("/unmount_personality",e);if(t)return t.data}catch(t){console.log(t.message,"unmount_personality - settings");return}},async onPersonalitySelected(n){if(console.log("on pers",n),console.log("selecting ",n),n){if(n.selected){this.$store.state.toast.showToast("Personality already selected",4,!0);return}const e=n.language===null?n.full_path:n.full_path+":"+n.language;if(console.log("pers_path",e),console.log("this.$store.state.config.personalities",this.$store.state.config.personalities),this.$store.state.config.personalities.includes(e)){const t=await this.select_personality(n);console.log("pers is mounted",t),t&&t.status&&t.active_personality_id>-1?this.$store.state.toast.showToast(`Selected personality: `+n.name,4,!0):this.$store.state.toast.showToast(`Error on select personality: -`+n.name,4,!1)}else console.log("mounting pers");this.$emit("personalitySelected"),Ue(()=>{Ge.replace()})}},async select_personality(n){if(!n)return{status:!1,error:"no personality - select_personality"};const e=n.language===null?n.full_path:n.full_path+":"+n.language;console.log("Selecting personality ",e);const i={id:this.$store.state.config.personalities.findIndex(r=>r===e)};try{const r=await Pe.post("/select_personality",i);if(r)return this.$store.dispatch("refreshConfig").then(()=>{this.$store.dispatch("refreshPersonalitiesZoo").then(()=>{this.$store.dispatch("refreshMountedPersonalities")})}),r.data}catch(r){console.log(r.message,"select_personality - settings");return}},emitloaded(){this.$emit("loaded")},showModels(n){n.preventDefault();const e=this.$refs.modelsSelectionList;console.log(e);const t=new MouseEvent("click");e.dispatchEvent(t)},setModel(n){console.log("Setting model to "+n.name),this.selecting_model=!0,this.selectedModel=n,Pe.post("/update_setting",{setting_name:"model_name",setting_value:n.name}).then(async e=>{console.log("UPDATED"),console.log(e),await this.$store.dispatch("refreshConfig"),await this.$store.dispatch("refreshModels"),this.$store.state.toast.showToast(`Model changed to ${this.currentModel.name}`,4,!0),this.selecting_model=!1}).catch(e=>{this.$store.state.toast.showToast(`Error ${e}`,4,!0),this.selecting_model=!1})},clear_files(){Pe.get("/clear_personality_files_list").then(n=>{console.log(n),n.data.state?(this.$store.state.toast.showToast("File uploaded successfully",4,!0),this.filesList.length=0,this.isFileSentList.length=0):this.$store.state.toast.showToast("Files couldn't be removed",4,!1)})},send_file(n,e){const t=new FileReader,i=24*1024;let r=0,s=0;t.onloadend=()=>{if(t.error){console.error("Error reading file:",t.error);return}const a=t.result,l=r+a.byteLength>=n.size;He.emit("send_file_chunk",{filename:n.name,chunk:a,offset:r,isLastChunk:l,chunkIndex:s}),r+=a.byteLength,s++,l?(console.log("File sent successfully"),this.isFileSentList[this.filesList.length-1]=!0,console.log(this.isFileSentList),this.$store.state.toast.showToast("File uploaded successfully",4,!0),this.loading=!1,e()):o()};function o(){const a=n.slice(r,r+i);t.readAsArrayBuffer(a)}console.log("Uploading file"),o()},makeAnEmptyUserMessage(){this.$emit("createEmptyUserMessage")},makeAnEmptyAIMessage(){this.$emit("createEmptyAIMessage")},startSpeechRecognition(){"SpeechRecognition"in window||"webkitSpeechRecognition"in window?(this.recognition=new(window.SpeechRecognition||window.webkitSpeechRecognition),this.recognition.lang=this.$store.state.config.audio_in_language,this.recognition.interimResults=!0,this.recognition.onstart=()=>{this.isLesteningToVoice=!0,this.silenceTimer=setTimeout(()=>{this.recognition.stop()},this.silenceTimeout)},this.recognition.onresult=n=>{let e="";for(let t=n.resultIndex;t{this.recognition.stop()},this.silenceTimeout)},this.recognition.onerror=n=>{console.error("Speech recognition error:",n.error),this.isLesteningToVoice=!1,clearTimeout(this.silenceTimer)},this.recognition.onend=()=>{console.log("Speech recognition ended."),this.isLesteningToVoice=!1,clearTimeout(this.silenceTimer),this.submit()},this.recognition.start()):console.error("Speech recognition is not supported in this browser.")},onPersonalitiesReadyFun(){this.personalities_ready=!0},onShowPersListFun(n){this.showPersonalities=!this.showPersonalities},handleOnTalk(n){this.showPersonalities=!1,this.onTalk(n)},onMountFun(n){console.log("Mounting personality"),this.$refs.mountedPers.constructor()},onUnmountFun(n){console.log("Unmounting personality"),this.$refs.mountedPers.constructor()},onRemount(n){console.log("Remounting chat"),this.$refs.mountedPers.constructor()},computedFileSize(n){return Ue(()=>{Ge.replace()}),Oi(n)},removeItem(n){this.filesList=this.filesList.filter(e=>e!=n)},sendMessageEvent(n){this.filesList.length=0,this.$emit("messageSentEvent",n)},sendCMDEvent(n){this.$emit("sendCMDEvent",n)},addWebLink(){console.log("Emitting addWebLink"),this.$emit("addWebLink")},takePicture(){He.emit("take_picture"),He.on("picture_taken",()=>{Pe.get("/get_current_personality_files_list").then(n=>{this.filesList=n.data.files,this.isFileSentList=n.data.files.map(e=>!0),console.log(`Files recovered: ${this.filesList}`)})})},submitOnEnter(n){this.loading||n.which===13&&(n.preventDefault(),n.repeat||(this.sendMessageEvent(this.message),this.message=""))},submit(){this.message&&(this.sendMessageEvent(this.message),this.message="")},stopGenerating(){this.$emit("stopGenerating")},addFiles(n){console.log("Adding files");const e=[...n.target.files];let t=0;const i=()=>{if(t>=e.length){console.log(`Files_list: ${this.filesList}`);return}const r=e[t];this.filesList.push(r),this.isFileSentList.push(!1),this.send_file(r,()=>{t++,i()})};i()}},watch:{installedModels:{immediate:!0,handler(n){this.$nextTick(()=>{this.installedModels=n})}},model_name:{immediate:!0,handler(n){this.$nextTick(()=>{this.model_name=n})}},showfilesList(){Ue(()=>{Ge.replace()})},loading(n,e){Ue(()=>{Ge.replace()})},filesList:{handler(n,e){let t=0;if(n.length>0)for(let i=0;i{Ge.replace()})},activated(){Ue(()=>{Ge.replace()})}},$t=n=>(Gs("data-v-b2f77eff"),n=n(),zs(),n),t_t={class:"absolute bottom-0 min-w-96 w-full justify-center text-center p-4"},n_t={key:0,class:"flex items-center justify-center w-full"},i_t={class:"flex flex-row p-2 rounded-t-lg"},r_t=$t(()=>p("label",{for:"chat",class:"sr-only"},"Send message",-1)),s_t={class:"px-3 py-3 rounded-lg bg-bg-light-tone-panel dark:bg-bg-dark-tone-panel shadow-lg"},o_t={class:"flex flex-col gap-2"},a_t={class:"flex"},l_t=["title"],c_t=$t(()=>p("i",{"data-feather":"list"},null,-1)),d_t=[c_t],u_t={key:0},__t={class:"flex flex-col max-h-64"},p_t=["title"],h_t={class:"flex flex-row items-center gap-1 text-left p-2 text-sm font-medium bg-bg-dark-tone-panel dark:bg-bg-dark-tone rounded-lg hover:bg-primary dark:hover:bg-primary"},f_t={key:0,filesList:"",role:"status"},m_t=$t(()=>p("svg",{"aria-hidden":"true",class:"w-6 h-6 animate-spin fill-secondary",viewBox:"0 0 100 101",fill:"none",xmlns:"http://www.w3.org/2000/svg"},[p("path",{d:"M100 50.5908C100 78.2051 77.6142 100.591 50 100.591C22.3858 100.591 0 78.2051 0 50.5908C0 22.9766 22.3858 0.59082 50 0.59082C77.6142 0.59082 100 22.9766 100 50.5908ZM9.08144 50.5908C9.08144 73.1895 27.4013 91.5094 50 91.5094C72.5987 91.5094 90.9186 73.1895 90.9186 50.5908C90.9186 27.9921 72.5987 9.67226 50 9.67226C27.4013 9.67226 9.08144 27.9921 9.08144 50.5908Z",fill:"currentColor"}),p("path",{d:"M93.9676 39.0409C96.393 38.4038 97.8624 35.9116 97.0079 33.5539C95.2932 28.8227 92.871 24.3692 89.8167 20.348C85.8452 15.1192 80.8826 10.7238 75.2124 7.41289C69.5422 4.10194 63.2754 1.94025 56.7698 1.05124C51.7666 0.367541 46.6976 0.446843 41.7345 1.27873C39.2613 1.69328 37.813 4.19778 38.4501 6.62326C39.0873 9.04874 41.5694 10.4717 44.0505 10.1071C47.8511 9.54855 51.7191 9.52689 55.5402 10.0491C60.8642 10.7766 65.9928 12.5457 70.6331 15.2552C75.2735 17.9648 79.3347 21.5619 82.5849 25.841C84.9175 28.9121 86.7997 32.2913 88.1811 35.8758C89.083 38.2158 91.5421 39.6781 93.9676 39.0409Z",fill:"currentFill"})],-1)),g_t=$t(()=>p("span",{class:"sr-only"},"Loading...",-1)),E_t=[m_t,g_t],b_t=$t(()=>p("div",null,[p("i",{"data-feather":"file",class:"w-5 h-5"})],-1)),S_t=$t(()=>p("div",{class:"grow"},null,-1)),y_t={class:"flex flex-row items-center"},v_t={class:"whitespace-nowrap"},T_t=["onClick"],x_t=$t(()=>p("i",{"data-feather":"x",class:"w-5 h-5"},null,-1)),C_t=[x_t],R_t={key:1,class:"flex items-center mx-1"},A_t={class:"whitespace-nowrap flex flex-row gap-2"},w_t=$t(()=>p("p",{class:"font-bold"}," Total size: ",-1)),O_t=$t(()=>p("div",{class:"grow"},null,-1)),N_t=$t(()=>p("i",{"data-feather":"trash",class:"w-5 h-5"},null,-1)),M_t=[N_t],I_t={key:2,class:"mx-1"},D_t={class:"flex flex-row flex-grow items-center gap-2 overflow-visible"},L_t={key:0,title:"Selecting model",class:"flex flex-row flex-grow justify-end"},k_t=$t(()=>p("div",{role:"status"},[p("svg",{"aria-hidden":"true",class:"w-6 h-6 animate-spin fill-secondary",viewBox:"0 0 100 101",fill:"none",xmlns:"http://www.w3.org/2000/svg"},[p("path",{d:"M100 50.5908C100 78.2051 77.6142 100.591 50 100.591C22.3858 100.591 0 78.2051 0 50.5908C0 22.9766 22.3858 0.59082 50 0.59082C77.6142 0.59082 100 22.9766 100 50.5908ZM9.08144 50.5908C9.08144 73.1895 27.4013 91.5094 50 91.5094C72.5987 91.5094 90.9186 73.1895 90.9186 50.5908C90.9186 27.9921 72.5987 9.67226 50 9.67226C27.4013 9.67226 9.08144 27.9921 9.08144 50.5908Z",fill:"currentColor"}),p("path",{d:"M93.9676 39.0409C96.393 38.4038 97.8624 35.9116 97.0079 33.5539C95.2932 28.8227 92.871 24.3692 89.8167 20.348C85.8452 15.1192 80.8826 10.7238 75.2124 7.41289C69.5422 4.10194 63.2754 1.94025 56.7698 1.05124C51.7666 0.367541 46.6976 0.446843 41.7345 1.27873C39.2613 1.69328 37.813 4.19778 38.4501 6.62326C39.0873 9.04874 41.5694 10.4717 44.0505 10.1071C47.8511 9.54855 51.7191 9.52689 55.5402 10.0491C60.8642 10.7766 65.9928 12.5457 70.6331 15.2552C75.2735 17.9648 79.3347 21.5619 82.5849 25.841C84.9175 28.9121 86.7997 32.2913 88.1811 35.8758C89.083 38.2158 91.5421 39.6781 93.9676 39.0409Z",fill:"currentFill"})]),p("span",{class:"sr-only"},"Selecting model...")],-1)),P_t=[k_t],U_t={key:1,class:"w-fit group relative"},F_t={class:"group w-full inline-flex absolute opacity-0 group-hover:opacity-100 transform group-hover:-translate-y-10 group-hover:translate-x-15 transition-all duration-300"},B_t={key:0,class:"group items-center flex flex-row"},G_t=["onClick"],z_t=["src","title"],V_t={class:"group items-center flex flex-row"},H_t=["src","title"],q_t={class:"w-fit group relative"},Y_t={class:"group w-full inline-flex absolute opacity-0 group-hover:opacity-100 transform group-hover:-translate-y-10 group-hover:translate-x-15 transition-all duration-300"},$_t={key:0,class:"group items-center flex flex-row"},W_t=["onClick"],K_t=["src","title"],j_t=["onClick"],Q_t=$t(()=>p("span",{class:"hidden hover:block top-3 left-9 absolute active:scale-90 bg-bg-light dark:bg-bg-dark rounded-full border-2 border-transparent",title:"Unmount personality"},[p("svg",{"aria-hidden":"true",class:"w-4 h-4 text-red-600 hover:text-red-500",fill:"currentColor",viewBox:"0 0 20 20",xmlns:"http://www.w3.org/2000/svg"},[p("path",{"fill-rule":"evenodd",d:"M4.293 4.293a1 1 0 011.414 0L10 8.586l4.293-4.293a1 1 0 111.414 1.414L11.414 10l4.293 4.293a1 1 0 01-1.414 1.414L10 11.414l-4.293 4.293a1 1 0 01-1.414-1.414L8.586 10 4.293 5.707a1 1 0 010-1.414z","clip-rule":"evenodd"})])],-1)),X_t=[Q_t],Z_t={class:"w-fit"},J_t={class:"relative grow"},ept={class:"inline-flex justify-center rounded-full"},tpt=$t(()=>p("i",{"data-feather":"mic"},null,-1)),npt=[tpt],ipt=$t(()=>p("i",{"data-feather":"file-plus"},null,-1)),rpt=[ipt],spt=$t(()=>p("i",{"data-feather":"camera"},null,-1)),opt=[spt],apt=$t(()=>p("i",{"data-feather":"globe"},null,-1)),lpt=[apt],cpt=$t(()=>p("i",{"data-feather":"message-square"},null,-1)),dpt=$t(()=>p("span",{class:"sr-only"},"New empty User message",-1)),upt=[cpt,dpt],_pt=$t(()=>p("i",{"data-feather":"message-square"},null,-1)),ppt=$t(()=>p("span",{class:"sr-only"},"New empty message",-1)),hpt=[_pt,ppt],fpt=$t(()=>p("i",{"data-feather":"send"},null,-1)),mpt=$t(()=>p("span",{class:"sr-only"},"Send message",-1)),gpt=[fpt,mpt],Ept={key:4,title:"Waiting for reply"},bpt=$t(()=>p("div",{role:"status"},[p("svg",{"aria-hidden":"true",class:"w-6 h-6 animate-spin fill-secondary",viewBox:"0 0 100 101",fill:"none",xmlns:"http://www.w3.org/2000/svg"},[p("path",{d:"M100 50.5908C100 78.2051 77.6142 100.591 50 100.591C22.3858 100.591 0 78.2051 0 50.5908C0 22.9766 22.3858 0.59082 50 0.59082C77.6142 0.59082 100 22.9766 100 50.5908ZM9.08144 50.5908C9.08144 73.1895 27.4013 91.5094 50 91.5094C72.5987 91.5094 90.9186 73.1895 90.9186 50.5908C90.9186 27.9921 72.5987 9.67226 50 9.67226C27.4013 9.67226 9.08144 27.9921 9.08144 50.5908Z",fill:"currentColor"}),p("path",{d:"M93.9676 39.0409C96.393 38.4038 97.8624 35.9116 97.0079 33.5539C95.2932 28.8227 92.871 24.3692 89.8167 20.348C85.8452 15.1192 80.8826 10.7238 75.2124 7.41289C69.5422 4.10194 63.2754 1.94025 56.7698 1.05124C51.7666 0.367541 46.6976 0.446843 41.7345 1.27873C39.2613 1.69328 37.813 4.19778 38.4501 6.62326C39.0873 9.04874 41.5694 10.4717 44.0505 10.1071C47.8511 9.54855 51.7191 9.52689 55.5402 10.0491C60.8642 10.7766 65.9928 12.5457 70.6331 15.2552C75.2735 17.9648 79.3347 21.5619 82.5849 25.841C84.9175 28.9121 86.7997 32.2913 88.1811 35.8758C89.083 38.2158 91.5421 39.6781 93.9676 39.0409Z",fill:"currentFill"})]),p("span",{class:"sr-only"},"Loading...")],-1)),Spt=[bpt];function ypt(n,e,t,i,r,s){const o=St("MountedPersonalitiesList"),a=St("MountedPersonalities"),l=St("PersonalitiesCommands"),c=St("UniversalForm");return M(),L(Xe,null,[p("div",t_t,[t.loading?(M(),L("div",n_t,[p("div",i_t,[p("button",{type:"button",class:"bg-red-500 dark:bg-red-800 hover:bg-red-600 focus:ring-4 focus:ring-blue-300 font-medium rounded-lg text-sm px-5 py-2.5 mr-2 mb-2 dark:hover:bg-bg-dark-tone focus:outline-none dark:focus:ring-blue-800",onClick:e[0]||(e[0]=Oe((...d)=>s.stopGenerating&&s.stopGenerating(...d),["stop"]))}," Stop generating ")])])):X("",!0),p("form",null,[r_t,p("div",s_t,[p("div",o_t,[p("div",a_t,[r.filesList.length>0?(M(),L("button",{key:0,class:"mx-1 w-full text-2xl hover:text-secondary duration-75 flex justify-center hover:bg-bg-light-tone hover:dark:bg-bg-dark-tone rounded-lg",title:r.showfilesList?"Hide file list":"Show file list",type:"button",onClick:e[1]||(e[1]=Oe(d=>r.showfilesList=!r.showfilesList,["stop"]))},d_t,8,l_t)):X("",!0)]),r.filesList.length>0&&r.showfilesList==!0?(M(),L("div",u_t,[p("div",__t,[Le(Vr,{name:"list",tag:"div",class:"flex flex-col flex-grow overflow-y-auto scrollbar-thin scrollbar-track-bg-light scrollbar-thumb-bg-light-tone hover:scrollbar-thumb-primary dark:scrollbar-track-bg-dark dark:scrollbar-thumb-bg-dark-tone dark:hover:scrollbar-thumb-primary active:scrollbar-thumb-secondary"},{default:dt(()=>[(M(!0),L(Xe,null,bt(r.filesList,(d,u)=>(M(),L("div",{key:u+"-"+d.name},[p("div",{class:"m-1",title:d.name},[p("div",h_t,[r.isFileSentList[u]?X("",!0):(M(),L("div",f_t,E_t)),b_t,p("div",{class:Ke(["line-clamp-1 w-3/5",r.isFileSentList[u]?"text-green-200":"text-red-200"])},me(d.name),3),S_t,p("div",y_t,[p("p",v_t,me(s.computedFileSize(d.size)),1),p("button",{type:"button",title:"Remove item",class:"flex items-center p-0.5 text-sm rounded-sm hover:text-red-600 active:scale-75",onClick:_=>s.removeItem(d)},C_t,8,T_t)])])],8,p_t)]))),128))]),_:1})])])):X("",!0),r.filesList.length>0?(M(),L("div",R_t,[p("div",A_t,[w_t,$e(" "+me(r.totalSize)+" ("+me(r.filesList.length)+") ",1)]),O_t,p("button",{type:"button",title:"Clear all",class:"flex items-center p-0.5 text-sm rounded-sm hover:text-red-600 active:scale-75",onClick:e[2]||(e[2]=(...d)=>s.clear_files&&s.clear_files(...d))},M_t)])):X("",!0),r.showPersonalities?(M(),L("div",I_t,[Le(o,{ref:"mountedPersList",onShowPersList:s.onShowPersListFun,"on-mounted":s.onMountFun,"on-un-mounted":s.onUnmountFun,"on-remounted":n.onRemountFun,"on-talk":s.handleOnTalk,discussionPersonalities:s.allDiscussionPersonalities},null,8,["onShowPersList","on-mounted","on-un-mounted","on-remounted","on-talk","discussionPersonalities"])])):X("",!0),p("div",D_t,[r.selecting_model?(M(),L("div",L_t,P_t)):X("",!0),t.loading?X("",!0):(M(),L("div",U_t,[p("div",F_t,[(M(!0),L(Xe,null,bt(s.installedModels,(d,u)=>(M(),L("div",{class:"w-full",key:u+"-"+d.name,ref_for:!0,ref:"installedModels"},[d.name!=s.model_name?(M(),L("div",B_t,[p("button",{onClick:Oe(_=>s.setModel(d),["prevent"]),class:"w-8 h-8"},[p("img",{src:d.icon?d.icon:r.modelImgPlaceholder,onError:e[3]||(e[3]=(..._)=>r.modelImgPlaceholder&&r.modelImgPlaceholder(..._)),class:"w-8 h-8 rounded-full object-fill text-red-700 border-2 active:scale-90 hover:border-secondary",title:d.name},null,40,z_t)],8,G_t)])):X("",!0)]))),128))]),p("div",V_t,[p("button",{onClick:e[5]||(e[5]=Oe(d=>s.showModelConfig(),["prevent"])),class:"w-8 h-8"},[p("img",{src:s.currentModel.icon?s.currentModel.icon:r.modelImgPlaceholder,onError:e[4]||(e[4]=(...d)=>r.modelImgPlaceholder&&r.modelImgPlaceholder(...d)),class:"w-8 h-8 rounded-full object-fill text-red-700 border-2 active:scale-90 hover:border-secondary",title:s.currentModel?s.currentModel.name:"unknown"},null,40,H_t)])])])),p("div",q_t,[p("div",Y_t,[(M(!0),L(Xe,null,bt(this.$store.state.mountedPersArr,(d,u)=>(M(),L("div",{class:"w-full",key:u+"-"+d.name,ref_for:!0,ref:"mountedPersonalities"},[u!=this.$store.state.config.active_personality_id?(M(),L("div",$_t,[p("button",{onClick:Oe(_=>s.onPersonalitySelected(d),["prevent"]),class:"w-8 h-8"},[p("img",{src:r.bUrl+d.avatar,onError:e[6]||(e[6]=(..._)=>n.personalityImgPlacehodler&&n.personalityImgPlacehodler(..._)),class:Ke(["w-8 h-8 rounded-full object-fill text-red-700 border-2 active:scale-90 hover:border-secondary",this.$store.state.active_personality_id==this.$store.state.personalities.indexOf(d.full_path)?"border-secondary":"border-transparent z-0"]),title:d.name},null,42,K_t)],8,W_t),p("button",{onClick:Oe(_=>s.unmountPersonality(d),["prevent"])},X_t,8,j_t)])):X("",!0)]))),128))]),Le(a,{ref:"mountedPers",onShowPersList:s.onShowPersListFun,onReady:s.onPersonalitiesReadyFun},null,8,["onShowPersList","onReady"])]),p("div",Z_t,[r.personalities_ready&&this.$store.state.mountedPersArr[this.$store.state.config.active_personality_id].commands!=""?(M(),Qt(l,{key:0,commandsList:this.$store.state.mountedPersArr[this.$store.state.config.active_personality_id].commands,sendCommand:s.sendCMDEvent,"on-show-toast-message":t.onShowToastMessage,ref:"personalityCMD"},null,8,["commandsList","sendCommand","on-show-toast-message"])):X("",!0)]),p("div",J_t,[Ae(p("textarea",{id:"chat",rows:"1","onUpdate:modelValue":e[7]||(e[7]=d=>r.message=d),title:"Hold SHIFT + ENTER to add new line",class:"inline-block no-scrollbar p-2.5 w-full text-sm text-gray-900 bg-bg-light rounded-lg border border-gray-300 focus:ring-blue-500 focus:border-blue-500 dark:bg-bg-dark dark:border-gray-600 dark:placeholder-gray-400 dark:text-white dark:focus:ring-blue-500 dark:focus:border-blue-500",placeholder:"Send message...",onKeydown:e[8]||(e[8]=Fo(Oe(d=>s.submitOnEnter(d),["exact"]),["enter"]))},`\r +`+n.name,4,!1)}else console.log("mounting pers");this.$emit("personalitySelected"),Ue(()=>{Ge.replace()})}},async select_personality(n){if(!n)return{status:!1,error:"no personality - select_personality"};const e=n.language===null?n.full_path:n.full_path+":"+n.language;console.log("Selecting personality ",e);const i={id:this.$store.state.config.personalities.findIndex(r=>r===e)};try{const r=await Pe.post("/select_personality",i);if(r)return this.$store.dispatch("refreshConfig").then(()=>{this.$store.dispatch("refreshPersonalitiesZoo").then(()=>{this.$store.dispatch("refreshMountedPersonalities")})}),r.data}catch(r){console.log(r.message,"select_personality - settings");return}},emitloaded(){this.$emit("loaded")},showModels(n){n.preventDefault();const e=this.$refs.modelsSelectionList;console.log(e);const t=new MouseEvent("click");e.dispatchEvent(t)},setModel(n){console.log("Setting model to "+n.name),this.selecting_model=!0,this.selectedModel=n,Pe.post("/update_setting",{setting_name:"model_name",setting_value:n.name}).then(async e=>{console.log("UPDATED"),console.log(e),await this.$store.dispatch("refreshConfig"),await this.$store.dispatch("refreshModels"),this.$store.state.toast.showToast(`Model changed to ${this.currentModel.name}`,4,!0),this.selecting_model=!1}).catch(e=>{this.$store.state.toast.showToast(`Error ${e}`,4,!0),this.selecting_model=!1})},clear_files(){Pe.get("/clear_personality_files_list").then(n=>{console.log(n),n.data.state?(this.$store.state.toast.showToast("File uploaded successfully",4,!0),this.filesList.length=0,this.isFileSentList.length=0):this.$store.state.toast.showToast("Files couldn't be removed",4,!1)})},send_file(n,e){const t=new FileReader,i=24*1024;let r=0,s=0;t.onloadend=()=>{if(t.error){console.error("Error reading file:",t.error);return}const a=t.result,l=r+a.byteLength>=n.size;He.emit("send_file_chunk",{filename:n.name,chunk:a,offset:r,isLastChunk:l,chunkIndex:s}),r+=a.byteLength,s++,l?(console.log("File sent successfully"),this.isFileSentList[this.filesList.length-1]=!0,console.log(this.isFileSentList),this.$store.state.toast.showToast("File uploaded successfully",4,!0),this.loading=!1,e()):o()};function o(){const a=n.slice(r,r+i);t.readAsArrayBuffer(a)}console.log("Uploading file"),o()},makeAnEmptyUserMessage(){this.$emit("createEmptyUserMessage")},makeAnEmptyAIMessage(){this.$emit("createEmptyAIMessage")},startSpeechRecognition(){"SpeechRecognition"in window||"webkitSpeechRecognition"in window?(this.recognition=new(window.SpeechRecognition||window.webkitSpeechRecognition),this.recognition.lang=this.$store.state.config.audio_in_language,this.recognition.interimResults=!0,this.recognition.onstart=()=>{this.isLesteningToVoice=!0,this.silenceTimer=setTimeout(()=>{this.recognition.stop()},this.silenceTimeout)},this.recognition.onresult=n=>{let e="";for(let t=n.resultIndex;t{this.recognition.stop()},this.silenceTimeout)},this.recognition.onerror=n=>{console.error("Speech recognition error:",n.error),this.isLesteningToVoice=!1,clearTimeout(this.silenceTimer)},this.recognition.onend=()=>{console.log("Speech recognition ended."),this.isLesteningToVoice=!1,clearTimeout(this.silenceTimer),this.submit()},this.recognition.start()):console.error("Speech recognition is not supported in this browser.")},onPersonalitiesReadyFun(){this.personalities_ready=!0},onShowPersListFun(n){this.showPersonalities=!this.showPersonalities},handleOnTalk(n){this.showPersonalities=!1,this.onTalk(n)},onMountFun(n){console.log("Mounting personality"),this.$refs.mountedPers.constructor()},onUnmountFun(n){console.log("Unmounting personality"),this.$refs.mountedPers.constructor()},onRemount(n){console.log("Remounting chat"),this.$refs.mountedPers.constructor()},computedFileSize(n){return Ue(()=>{Ge.replace()}),Oi(n)},removeItem(n){this.filesList=this.filesList.filter(e=>e!=n)},sendMessageEvent(n){this.filesList.length=0,this.$emit("messageSentEvent",n)},sendCMDEvent(n){this.$emit("sendCMDEvent",n)},addWebLink(){console.log("Emitting addWebLink"),this.$emit("addWebLink")},takePicture(){He.emit("take_picture"),He.on("picture_taken",()=>{Pe.get("/get_current_personality_files_list").then(n=>{this.filesList=n.data.files,this.isFileSentList=n.data.files.map(e=>!0),console.log(`Files recovered: ${this.filesList}`)})})},submitOnEnter(n){this.loading||n.which===13&&(n.preventDefault(),n.repeat||(this.sendMessageEvent(this.message),this.message=""))},submit(){this.message&&(this.sendMessageEvent(this.message),this.message="")},stopGenerating(){this.$emit("stopGenerating")},addFiles(n){console.log("Adding files");const e=[...n.target.files];let t=0;const i=()=>{if(t>=e.length){console.log(`Files_list: ${this.filesList}`);return}const r=e[t];this.filesList.push(r),this.isFileSentList.push(!1),this.send_file(r,()=>{t++,i()})};i()}},watch:{installedModels:{immediate:!0,handler(n){this.$nextTick(()=>{this.installedModels=n})}},model_name:{immediate:!0,handler(n){this.$nextTick(()=>{this.model_name=n})}},showfilesList(){Ue(()=>{Ge.replace()})},loading(n,e){Ue(()=>{Ge.replace()})},filesList:{handler(n,e){let t=0;if(n.length>0)for(let i=0;i{Ge.replace()})},activated(){Ue(()=>{Ge.replace()})}},$t=n=>(Gs("data-v-b2f77eff"),n=n(),zs(),n),s_t={class:"absolute bottom-0 min-w-96 w-full justify-center text-center p-4"},o_t={key:0,class:"flex items-center justify-center w-full"},a_t={class:"flex flex-row p-2 rounded-t-lg"},l_t=$t(()=>p("label",{for:"chat",class:"sr-only"},"Send message",-1)),c_t={class:"px-3 py-3 rounded-lg bg-bg-light-tone-panel dark:bg-bg-dark-tone-panel shadow-lg"},d_t={class:"flex flex-col gap-2"},u_t={class:"flex"},__t=["title"],p_t=$t(()=>p("i",{"data-feather":"list"},null,-1)),h_t=[p_t],f_t={key:0},m_t={class:"flex flex-col max-h-64"},g_t=["title"],E_t={class:"flex flex-row items-center gap-1 text-left p-2 text-sm font-medium bg-bg-dark-tone-panel dark:bg-bg-dark-tone rounded-lg hover:bg-primary dark:hover:bg-primary"},b_t={key:0,filesList:"",role:"status"},S_t=$t(()=>p("svg",{"aria-hidden":"true",class:"w-6 h-6 animate-spin fill-secondary",viewBox:"0 0 100 101",fill:"none",xmlns:"http://www.w3.org/2000/svg"},[p("path",{d:"M100 50.5908C100 78.2051 77.6142 100.591 50 100.591C22.3858 100.591 0 78.2051 0 50.5908C0 22.9766 22.3858 0.59082 50 0.59082C77.6142 0.59082 100 22.9766 100 50.5908ZM9.08144 50.5908C9.08144 73.1895 27.4013 91.5094 50 91.5094C72.5987 91.5094 90.9186 73.1895 90.9186 50.5908C90.9186 27.9921 72.5987 9.67226 50 9.67226C27.4013 9.67226 9.08144 27.9921 9.08144 50.5908Z",fill:"currentColor"}),p("path",{d:"M93.9676 39.0409C96.393 38.4038 97.8624 35.9116 97.0079 33.5539C95.2932 28.8227 92.871 24.3692 89.8167 20.348C85.8452 15.1192 80.8826 10.7238 75.2124 7.41289C69.5422 4.10194 63.2754 1.94025 56.7698 1.05124C51.7666 0.367541 46.6976 0.446843 41.7345 1.27873C39.2613 1.69328 37.813 4.19778 38.4501 6.62326C39.0873 9.04874 41.5694 10.4717 44.0505 10.1071C47.8511 9.54855 51.7191 9.52689 55.5402 10.0491C60.8642 10.7766 65.9928 12.5457 70.6331 15.2552C75.2735 17.9648 79.3347 21.5619 82.5849 25.841C84.9175 28.9121 86.7997 32.2913 88.1811 35.8758C89.083 38.2158 91.5421 39.6781 93.9676 39.0409Z",fill:"currentFill"})],-1)),y_t=$t(()=>p("span",{class:"sr-only"},"Loading...",-1)),v_t=[S_t,y_t],T_t=$t(()=>p("div",null,[p("i",{"data-feather":"file",class:"w-5 h-5"})],-1)),x_t=$t(()=>p("div",{class:"grow"},null,-1)),C_t={class:"flex flex-row items-center"},R_t={class:"whitespace-nowrap"},A_t=["onClick"],w_t=$t(()=>p("i",{"data-feather":"x",class:"w-5 h-5"},null,-1)),O_t=[w_t],N_t={key:1,class:"flex items-center mx-1"},M_t={class:"whitespace-nowrap flex flex-row gap-2"},I_t=$t(()=>p("p",{class:"font-bold"}," Total size: ",-1)),D_t=$t(()=>p("div",{class:"grow"},null,-1)),L_t=$t(()=>p("i",{"data-feather":"trash",class:"w-5 h-5"},null,-1)),k_t=[L_t],P_t={key:2,class:"mx-1"},U_t={class:"flex flex-row flex-grow items-center gap-2 overflow-visible"},F_t={key:0,title:"Selecting model",class:"flex flex-row flex-grow justify-end"},B_t=$t(()=>p("div",{role:"status"},[p("svg",{"aria-hidden":"true",class:"w-6 h-6 animate-spin fill-secondary",viewBox:"0 0 100 101",fill:"none",xmlns:"http://www.w3.org/2000/svg"},[p("path",{d:"M100 50.5908C100 78.2051 77.6142 100.591 50 100.591C22.3858 100.591 0 78.2051 0 50.5908C0 22.9766 22.3858 0.59082 50 0.59082C77.6142 0.59082 100 22.9766 100 50.5908ZM9.08144 50.5908C9.08144 73.1895 27.4013 91.5094 50 91.5094C72.5987 91.5094 90.9186 73.1895 90.9186 50.5908C90.9186 27.9921 72.5987 9.67226 50 9.67226C27.4013 9.67226 9.08144 27.9921 9.08144 50.5908Z",fill:"currentColor"}),p("path",{d:"M93.9676 39.0409C96.393 38.4038 97.8624 35.9116 97.0079 33.5539C95.2932 28.8227 92.871 24.3692 89.8167 20.348C85.8452 15.1192 80.8826 10.7238 75.2124 7.41289C69.5422 4.10194 63.2754 1.94025 56.7698 1.05124C51.7666 0.367541 46.6976 0.446843 41.7345 1.27873C39.2613 1.69328 37.813 4.19778 38.4501 6.62326C39.0873 9.04874 41.5694 10.4717 44.0505 10.1071C47.8511 9.54855 51.7191 9.52689 55.5402 10.0491C60.8642 10.7766 65.9928 12.5457 70.6331 15.2552C75.2735 17.9648 79.3347 21.5619 82.5849 25.841C84.9175 28.9121 86.7997 32.2913 88.1811 35.8758C89.083 38.2158 91.5421 39.6781 93.9676 39.0409Z",fill:"currentFill"})]),p("span",{class:"sr-only"},"Selecting model...")],-1)),G_t=[B_t],z_t={key:1,class:"w-fit group relative"},V_t={class:"group w-full inline-flex absolute opacity-0 group-hover:opacity-100 transform group-hover:-translate-y-10 group-hover:translate-x-15 transition-all duration-300"},H_t={key:0,class:"group items-center flex flex-row"},q_t=["onClick"],Y_t=["src","title"],$_t={class:"group items-center flex flex-row"},W_t=["src","title"],K_t={class:"w-fit group relative"},j_t={class:"group w-full inline-flex absolute opacity-0 group-hover:opacity-100 transform group-hover:-translate-y-10 group-hover:translate-x-15 transition-all duration-300"},Q_t={key:0,class:"group items-center flex flex-row"},X_t=["onClick"],Z_t=["src","title"],J_t=["onClick"],ept=$t(()=>p("span",{class:"hidden hover:block top-3 left-9 absolute active:scale-90 bg-bg-light dark:bg-bg-dark rounded-full border-2 border-transparent",title:"Unmount personality"},[p("svg",{"aria-hidden":"true",class:"w-4 h-4 text-red-600 hover:text-red-500",fill:"currentColor",viewBox:"0 0 20 20",xmlns:"http://www.w3.org/2000/svg"},[p("path",{"fill-rule":"evenodd",d:"M4.293 4.293a1 1 0 011.414 0L10 8.586l4.293-4.293a1 1 0 111.414 1.414L11.414 10l4.293 4.293a1 1 0 01-1.414 1.414L10 11.414l-4.293 4.293a1 1 0 01-1.414-1.414L8.586 10 4.293 5.707a1 1 0 010-1.414z","clip-rule":"evenodd"})])],-1)),tpt=[ept],npt={class:"w-fit"},ipt={class:"relative grow"},rpt={class:"inline-flex justify-center rounded-full"},spt=$t(()=>p("i",{"data-feather":"mic"},null,-1)),opt=[spt],apt=$t(()=>p("i",{"data-feather":"file-plus"},null,-1)),lpt=[apt],cpt=$t(()=>p("i",{"data-feather":"camera"},null,-1)),dpt=[cpt],upt=$t(()=>p("i",{"data-feather":"globe"},null,-1)),_pt=[upt],ppt=$t(()=>p("i",{"data-feather":"message-square"},null,-1)),hpt=$t(()=>p("span",{class:"sr-only"},"New empty User message",-1)),fpt=[ppt,hpt],mpt=$t(()=>p("i",{"data-feather":"message-square"},null,-1)),gpt=$t(()=>p("span",{class:"sr-only"},"New empty message",-1)),Ept=[mpt,gpt],bpt=$t(()=>p("i",{"data-feather":"send"},null,-1)),Spt=$t(()=>p("span",{class:"sr-only"},"Send message",-1)),ypt=[bpt,Spt],vpt={key:4,title:"Waiting for reply"},Tpt=$t(()=>p("div",{role:"status"},[p("svg",{"aria-hidden":"true",class:"w-6 h-6 animate-spin fill-secondary",viewBox:"0 0 100 101",fill:"none",xmlns:"http://www.w3.org/2000/svg"},[p("path",{d:"M100 50.5908C100 78.2051 77.6142 100.591 50 100.591C22.3858 100.591 0 78.2051 0 50.5908C0 22.9766 22.3858 0.59082 50 0.59082C77.6142 0.59082 100 22.9766 100 50.5908ZM9.08144 50.5908C9.08144 73.1895 27.4013 91.5094 50 91.5094C72.5987 91.5094 90.9186 73.1895 90.9186 50.5908C90.9186 27.9921 72.5987 9.67226 50 9.67226C27.4013 9.67226 9.08144 27.9921 9.08144 50.5908Z",fill:"currentColor"}),p("path",{d:"M93.9676 39.0409C96.393 38.4038 97.8624 35.9116 97.0079 33.5539C95.2932 28.8227 92.871 24.3692 89.8167 20.348C85.8452 15.1192 80.8826 10.7238 75.2124 7.41289C69.5422 4.10194 63.2754 1.94025 56.7698 1.05124C51.7666 0.367541 46.6976 0.446843 41.7345 1.27873C39.2613 1.69328 37.813 4.19778 38.4501 6.62326C39.0873 9.04874 41.5694 10.4717 44.0505 10.1071C47.8511 9.54855 51.7191 9.52689 55.5402 10.0491C60.8642 10.7766 65.9928 12.5457 70.6331 15.2552C75.2735 17.9648 79.3347 21.5619 82.5849 25.841C84.9175 28.9121 86.7997 32.2913 88.1811 35.8758C89.083 38.2158 91.5421 39.6781 93.9676 39.0409Z",fill:"currentFill"})]),p("span",{class:"sr-only"},"Loading...")],-1)),xpt=[Tpt];function Cpt(n,e,t,i,r,s){const o=St("MountedPersonalitiesList"),a=St("MountedPersonalities"),l=St("PersonalitiesCommands"),c=St("UniversalForm");return M(),L(Xe,null,[p("div",s_t,[t.loading?(M(),L("div",o_t,[p("div",a_t,[p("button",{type:"button",class:"bg-red-500 dark:bg-red-800 hover:bg-red-600 focus:ring-4 focus:ring-blue-300 font-medium rounded-lg text-sm px-5 py-2.5 mr-2 mb-2 dark:hover:bg-bg-dark-tone focus:outline-none dark:focus:ring-blue-800",onClick:e[0]||(e[0]=Oe((...d)=>s.stopGenerating&&s.stopGenerating(...d),["stop"]))}," Stop generating ")])])):X("",!0),p("form",null,[l_t,p("div",c_t,[p("div",d_t,[p("div",u_t,[r.filesList.length>0?(M(),L("button",{key:0,class:"mx-1 w-full text-2xl hover:text-secondary duration-75 flex justify-center hover:bg-bg-light-tone hover:dark:bg-bg-dark-tone rounded-lg",title:r.showfilesList?"Hide file list":"Show file list",type:"button",onClick:e[1]||(e[1]=Oe(d=>r.showfilesList=!r.showfilesList,["stop"]))},h_t,8,__t)):X("",!0)]),r.filesList.length>0&&r.showfilesList==!0?(M(),L("div",f_t,[p("div",m_t,[Le(Vr,{name:"list",tag:"div",class:"flex flex-col flex-grow overflow-y-auto scrollbar-thin scrollbar-track-bg-light scrollbar-thumb-bg-light-tone hover:scrollbar-thumb-primary dark:scrollbar-track-bg-dark dark:scrollbar-thumb-bg-dark-tone dark:hover:scrollbar-thumb-primary active:scrollbar-thumb-secondary"},{default:dt(()=>[(M(!0),L(Xe,null,bt(r.filesList,(d,u)=>(M(),L("div",{key:u+"-"+d.name},[p("div",{class:"m-1",title:d.name},[p("div",E_t,[r.isFileSentList[u]?X("",!0):(M(),L("div",b_t,v_t)),T_t,p("div",{class:Ke(["line-clamp-1 w-3/5",r.isFileSentList[u]?"text-green-200":"text-red-200"])},me(d.name),3),x_t,p("div",C_t,[p("p",R_t,me(s.computedFileSize(d.size)),1),p("button",{type:"button",title:"Remove item",class:"flex items-center p-0.5 text-sm rounded-sm hover:text-red-600 active:scale-75",onClick:_=>s.removeItem(d)},O_t,8,A_t)])])],8,g_t)]))),128))]),_:1})])])):X("",!0),r.filesList.length>0?(M(),L("div",N_t,[p("div",M_t,[I_t,$e(" "+me(r.totalSize)+" ("+me(r.filesList.length)+") ",1)]),D_t,p("button",{type:"button",title:"Clear all",class:"flex items-center p-0.5 text-sm rounded-sm hover:text-red-600 active:scale-75",onClick:e[2]||(e[2]=(...d)=>s.clear_files&&s.clear_files(...d))},k_t)])):X("",!0),r.showPersonalities?(M(),L("div",P_t,[Le(o,{ref:"mountedPersList",onShowPersList:s.onShowPersListFun,"on-mounted":s.onMountFun,"on-un-mounted":s.onUnmountFun,"on-remounted":n.onRemountFun,"on-talk":s.handleOnTalk,discussionPersonalities:s.allDiscussionPersonalities},null,8,["onShowPersList","on-mounted","on-un-mounted","on-remounted","on-talk","discussionPersonalities"])])):X("",!0),p("div",U_t,[r.selecting_model?(M(),L("div",F_t,G_t)):X("",!0),t.loading?X("",!0):(M(),L("div",z_t,[p("div",V_t,[(M(!0),L(Xe,null,bt(s.installedModels,(d,u)=>(M(),L("div",{class:"w-full",key:u+"-"+d.name,ref_for:!0,ref:"installedModels"},[d.name!=s.model_name?(M(),L("div",H_t,[p("button",{onClick:Oe(_=>s.setModel(d),["prevent"]),class:"w-8 h-8"},[p("img",{src:d.icon?d.icon:r.modelImgPlaceholder,onError:e[3]||(e[3]=(..._)=>r.modelImgPlaceholder&&r.modelImgPlaceholder(..._)),class:"w-8 h-8 rounded-full object-fill text-red-700 border-2 active:scale-90 hover:border-secondary",title:d.name},null,40,Y_t)],8,q_t)])):X("",!0)]))),128))]),p("div",$_t,[p("button",{onClick:e[5]||(e[5]=Oe(d=>s.showModelConfig(),["prevent"])),class:"w-8 h-8"},[p("img",{src:s.currentModel.icon?s.currentModel.icon:r.modelImgPlaceholder,onError:e[4]||(e[4]=(...d)=>r.modelImgPlaceholder&&r.modelImgPlaceholder(...d)),class:"w-8 h-8 rounded-full object-fill text-red-700 border-2 active:scale-90 hover:border-secondary",title:s.currentModel?s.currentModel.name:"unknown"},null,40,W_t)])])])),p("div",K_t,[p("div",j_t,[(M(!0),L(Xe,null,bt(this.$store.state.mountedPersArr,(d,u)=>(M(),L("div",{class:"w-full",key:u+"-"+d.name,ref_for:!0,ref:"mountedPersonalities"},[u!=this.$store.state.config.active_personality_id?(M(),L("div",Q_t,[p("button",{onClick:Oe(_=>s.onPersonalitySelected(d),["prevent"]),class:"w-8 h-8"},[p("img",{src:r.bUrl+d.avatar,onError:e[6]||(e[6]=(..._)=>n.personalityImgPlacehodler&&n.personalityImgPlacehodler(..._)),class:Ke(["w-8 h-8 rounded-full object-fill text-red-700 border-2 active:scale-90 hover:border-secondary",this.$store.state.active_personality_id==this.$store.state.personalities.indexOf(d.full_path)?"border-secondary":"border-transparent z-0"]),title:d.name},null,42,Z_t)],8,X_t),p("button",{onClick:Oe(_=>s.unmountPersonality(d),["prevent"])},tpt,8,J_t)])):X("",!0)]))),128))]),Le(a,{ref:"mountedPers",onShowPersList:s.onShowPersListFun,onReady:s.onPersonalitiesReadyFun},null,8,["onShowPersList","onReady"])]),p("div",npt,[r.personalities_ready&&this.$store.state.mountedPersArr[this.$store.state.config.active_personality_id].commands!=""?(M(),Qt(l,{key:0,commandsList:this.$store.state.mountedPersArr[this.$store.state.config.active_personality_id].commands,sendCommand:s.sendCMDEvent,"on-show-toast-message":t.onShowToastMessage,ref:"personalityCMD"},null,8,["commandsList","sendCommand","on-show-toast-message"])):X("",!0)]),p("div",ipt,[Ae(p("textarea",{id:"chat",rows:"1","onUpdate:modelValue":e[7]||(e[7]=d=>r.message=d),title:"Hold SHIFT + ENTER to add new line",class:"inline-block no-scrollbar p-2.5 w-full text-sm text-gray-900 bg-bg-light rounded-lg border border-gray-300 focus:ring-blue-500 focus:border-blue-500 dark:bg-bg-dark dark:border-gray-600 dark:placeholder-gray-400 dark:text-white dark:focus:ring-blue-500 dark:focus:border-blue-500",placeholder:"Send message...",onKeydown:e[8]||(e[8]=Fo(Oe(d=>s.submitOnEnter(d),["exact"]),["enter"]))},`\r \r \r - `,544),[[Je,r.message]])]),p("div",ept,[t.loading?X("",!0):(M(),L("button",{key:0,type:"button",onClick:e[9]||(e[9]=(...d)=>s.startSpeechRecognition&&s.startSpeechRecognition(...d)),title:"Press and talk",class:Ke([{"text-red-500":r.isLesteningToVoice},"w-6 hover:text-secondary duration-75 active:scale-90 cursor-pointer"])},npt,2)),p("input",{type:"file",ref:"fileDialog",style:{display:"none"},onChange:e[10]||(e[10]=(...d)=>s.addFiles&&s.addFiles(...d)),multiple:""},null,544),p("button",{type:"button",onClick:e[11]||(e[11]=Oe(d=>n.$refs.fileDialog.click(),["stop"])),title:"Add files",class:"m-1 w-6 hover:text-secondary duration-75 active:scale-90"},rpt),p("button",{type:"button",onClick:e[12]||(e[12]=Oe((...d)=>s.takePicture&&s.takePicture(...d),["stop"])),title:"take a shot from camera",class:"m-1 w-6 hover:text-secondary duration-75 active:scale-90"},opt),p("button",{type:"button",onClick:e[13]||(e[13]=Oe((...d)=>s.addWebLink&&s.addWebLink(...d),["stop"])),title:"add web link",class:"m-1 w-6 hover:text-secondary duration-75 active:scale-90"},lpt),t.loading?X("",!0):(M(),L("button",{key:1,type:"button",onClick:e[14]||(e[14]=(...d)=>s.makeAnEmptyUserMessage&&s.makeAnEmptyUserMessage(...d)),title:"New empty user message",class:"w-6 text-blue-400 hover:text-secondary duration-75 active:scale-90"},upt)),t.loading?X("",!0):(M(),L("button",{key:2,type:"button",onClick:e[15]||(e[15]=(...d)=>s.makeAnEmptyAIMessage&&s.makeAnEmptyAIMessage(...d)),title:"New empty ai message",class:"w-6 text-red-400 hover:text-secondary duration-75 active:scale-90"},hpt)),t.loading?X("",!0):(M(),L("button",{key:3,type:"button",onClick:e[16]||(e[16]=(...d)=>s.submit&&s.submit(...d)),title:"Send",class:"w-6 hover:text-secondary duration-75 active:scale-90"},gpt)),t.loading?(M(),L("div",Ept,Spt)):X("",!0)])])])])])]),Le(c,{ref:"universalForm",class:"z-20"},null,512)],64)}const Sw=ft(e_t,[["render",ypt],["__scopeId","data-v-b2f77eff"]]),vpt={name:"WelcomeComponent",setup(){return{}}},Tpt={class:"flex flex-col text-center"},xpt=Og('
Logo

Lord of Large Language and Multimodal Systems

One tool to rule them all


Welcome

Please create a new discussion or select existing one to start

',1),Cpt=[xpt];function Rpt(n,e,t,i,r,s){return M(),L("div",Tpt,Cpt)}const yw=ft(vpt,[["render",Rpt]]);var Apt=function(){function n(e,t){t===void 0&&(t=[]),this._eventType=e,this._eventFunctions=t}return n.prototype.init=function(){var e=this;this._eventFunctions.forEach(function(t){typeof window<"u"&&window.addEventListener(e._eventType,t)})},n}(),ud=globalThis&&globalThis.__assign||function(){return ud=Object.assign||function(n){for(var e,t=1,i=arguments.length;t"u")return!1;var e=Gn(n).ShadowRoot;return n instanceof e||n instanceof ShadowRoot}function Gpt(n){var e=n.state;Object.keys(e.elements).forEach(function(t){var i=e.styles[t]||{},r=e.attributes[t]||{},s=e.elements[t];!ei(s)||!Di(s)||(Object.assign(s.style,i),Object.keys(r).forEach(function(o){var a=r[o];a===!1?s.removeAttribute(o):s.setAttribute(o,a===!0?"":a)}))})}function zpt(n){var e=n.state,t={popper:{position:e.options.strategy,left:"0",top:"0",margin:"0"},arrow:{position:"absolute"},reference:{}};return Object.assign(e.elements.popper.style,t.popper),e.styles=t,e.elements.arrow&&Object.assign(e.elements.arrow.style,t.arrow),function(){Object.keys(e.elements).forEach(function(i){var r=e.elements[i],s=e.attributes[i]||{},o=Object.keys(e.styles.hasOwnProperty(i)?e.styles[i]:t[i]),a=o.reduce(function(l,c){return l[c]="",l},{});!ei(r)||!Di(r)||(Object.assign(r.style,a),Object.keys(s).forEach(function(l){r.removeAttribute(l)}))})}}const Vpt={name:"applyStyles",enabled:!0,phase:"write",fn:Gpt,effect:zpt,requires:["computeStyles"]};function Ni(n){return n.split("-")[0]}var As=Math.max,fd=Math.min,$o=Math.round;function Ym(){var n=navigator.userAgentData;return n!=null&&n.brands&&Array.isArray(n.brands)?n.brands.map(function(e){return e.brand+"/"+e.version}).join(" "):navigator.userAgent}function ww(){return!/^((?!chrome|android).)*safari/i.test(Ym())}function Wo(n,e,t){e===void 0&&(e=!1),t===void 0&&(t=!1);var i=n.getBoundingClientRect(),r=1,s=1;e&&ei(n)&&(r=n.offsetWidth>0&&$o(i.width)/n.offsetWidth||1,s=n.offsetHeight>0&&$o(i.height)/n.offsetHeight||1);var o=Ls(n)?Gn(n):window,a=o.visualViewport,l=!ww()&&t,c=(i.left+(l&&a?a.offsetLeft:0))/r,d=(i.top+(l&&a?a.offsetTop:0))/s,u=i.width/r,_=i.height/s;return{width:u,height:_,top:d,right:c+u,bottom:d+_,left:c,x:c,y:d}}function yE(n){var e=Wo(n),t=n.offsetWidth,i=n.offsetHeight;return Math.abs(e.width-t)<=1&&(t=e.width),Math.abs(e.height-i)<=1&&(i=e.height),{x:n.offsetLeft,y:n.offsetTop,width:t,height:i}}function Ow(n,e){var t=e.getRootNode&&e.getRootNode();if(n.contains(e))return!0;if(t&&SE(t)){var i=e;do{if(i&&n.isSameNode(i))return!0;i=i.parentNode||i.host}while(i)}return!1}function lr(n){return Gn(n).getComputedStyle(n)}function Hpt(n){return["table","td","th"].indexOf(Di(n))>=0}function Qr(n){return((Ls(n)?n.ownerDocument:n.document)||window.document).documentElement}function su(n){return Di(n)==="html"?n:n.assignedSlot||n.parentNode||(SE(n)?n.host:null)||Qr(n)}function ux(n){return!ei(n)||lr(n).position==="fixed"?null:n.offsetParent}function qpt(n){var e=/firefox/i.test(Ym()),t=/Trident/i.test(Ym());if(t&&ei(n)){var i=lr(n);if(i.position==="fixed")return null}var r=su(n);for(SE(r)&&(r=r.host);ei(r)&&["html","body"].indexOf(Di(r))<0;){var s=lr(r);if(s.transform!=="none"||s.perspective!=="none"||s.contain==="paint"||["transform","perspective"].indexOf(s.willChange)!==-1||e&&s.willChange==="filter"||e&&s.filter&&s.filter!=="none")return r;r=r.parentNode}return null}function Fl(n){for(var e=Gn(n),t=ux(n);t&&Hpt(t)&&lr(t).position==="static";)t=ux(t);return t&&(Di(t)==="html"||Di(t)==="body"&&lr(t).position==="static")?e:t||qpt(n)||e}function vE(n){return["top","bottom"].indexOf(n)>=0?"x":"y"}function Za(n,e,t){return As(n,fd(e,t))}function Ypt(n,e,t){var i=Za(n,e,t);return i>t?t:i}function Nw(){return{top:0,right:0,bottom:0,left:0}}function Mw(n){return Object.assign({},Nw(),n)}function Iw(n,e){return e.reduce(function(t,i){return t[i]=n,t},{})}var $pt=function(e,t){return e=typeof e=="function"?e(Object.assign({},t.rects,{placement:t.placement})):e,Mw(typeof e!="number"?e:Iw(e,Ul))};function Wpt(n){var e,t=n.state,i=n.name,r=n.options,s=t.elements.arrow,o=t.modifiersData.popperOffsets,a=Ni(t.placement),l=vE(a),c=[Dn,ii].indexOf(a)>=0,d=c?"height":"width";if(!(!s||!o)){var u=$pt(r.padding,t),_=yE(s),f=l==="y"?In:Dn,h=l==="y"?ni:ii,E=t.rects.reference[d]+t.rects.reference[l]-o[l]-t.rects.popper[d],g=o[l]-t.rects.reference[l],m=Fl(s),b=m?l==="y"?m.clientHeight||0:m.clientWidth||0:0,S=E/2-g/2,v=u[f],T=b-_[d]-u[h],C=b/2-_[d]/2+S,N=Za(v,C,T),x=l;t.modifiersData[i]=(e={},e[x]=N,e.centerOffset=N-C,e)}}function Kpt(n){var e=n.state,t=n.options,i=t.element,r=i===void 0?"[data-popper-arrow]":i;r!=null&&(typeof r=="string"&&(r=e.elements.popper.querySelector(r),!r)||Ow(e.elements.popper,r)&&(e.elements.arrow=r))}const jpt={name:"arrow",enabled:!0,phase:"main",fn:Wpt,effect:Kpt,requires:["popperOffsets"],requiresIfExists:["preventOverflow"]};function Ko(n){return n.split("-")[1]}var Qpt={top:"auto",right:"auto",bottom:"auto",left:"auto"};function Xpt(n,e){var t=n.x,i=n.y,r=e.devicePixelRatio||1;return{x:$o(t*r)/r||0,y:$o(i*r)/r||0}}function _x(n){var e,t=n.popper,i=n.popperRect,r=n.placement,s=n.variation,o=n.offsets,a=n.position,l=n.gpuAcceleration,c=n.adaptive,d=n.roundOffsets,u=n.isFixed,_=o.x,f=_===void 0?0:_,h=o.y,E=h===void 0?0:h,g=typeof d=="function"?d({x:f,y:E}):{x:f,y:E};f=g.x,E=g.y;var m=o.hasOwnProperty("x"),b=o.hasOwnProperty("y"),S=Dn,v=In,T=window;if(c){var C=Fl(t),N="clientHeight",x="clientWidth";if(C===Gn(t)&&(C=Qr(t),lr(C).position!=="static"&&a==="absolute"&&(N="scrollHeight",x="scrollWidth")),C=C,r===In||(r===Dn||r===ii)&&s===Sl){v=ni;var y=u&&C===T&&T.visualViewport?T.visualViewport.height:C[N];E-=y-i.height,E*=l?1:-1}if(r===Dn||(r===In||r===ni)&&s===Sl){S=ii;var R=u&&C===T&&T.visualViewport?T.visualViewport.width:C[x];f-=R-i.width,f*=l?1:-1}}var P=Object.assign({position:a},c&&Qpt),k=d===!0?Xpt({x:f,y:E},Gn(t)):{x:f,y:E};if(f=k.x,E=k.y,l){var W;return Object.assign({},P,(W={},W[v]=b?"0":"",W[S]=m?"0":"",W.transform=(T.devicePixelRatio||1)<=1?"translate("+f+"px, "+E+"px)":"translate3d("+f+"px, "+E+"px, 0)",W))}return Object.assign({},P,(e={},e[v]=b?E+"px":"",e[S]=m?f+"px":"",e.transform="",e))}function Zpt(n){var e=n.state,t=n.options,i=t.gpuAcceleration,r=i===void 0?!0:i,s=t.adaptive,o=s===void 0?!0:s,a=t.roundOffsets,l=a===void 0?!0:a,c={placement:Ni(e.placement),variation:Ko(e.placement),popper:e.elements.popper,popperRect:e.rects.popper,gpuAcceleration:r,isFixed:e.options.strategy==="fixed"};e.modifiersData.popperOffsets!=null&&(e.styles.popper=Object.assign({},e.styles.popper,_x(Object.assign({},c,{offsets:e.modifiersData.popperOffsets,position:e.options.strategy,adaptive:o,roundOffsets:l})))),e.modifiersData.arrow!=null&&(e.styles.arrow=Object.assign({},e.styles.arrow,_x(Object.assign({},c,{offsets:e.modifiersData.arrow,position:"absolute",adaptive:!1,roundOffsets:l})))),e.attributes.popper=Object.assign({},e.attributes.popper,{"data-popper-placement":e.placement})}const Jpt={name:"computeStyles",enabled:!0,phase:"beforeWrite",fn:Zpt,data:{}};var ic={passive:!0};function eht(n){var e=n.state,t=n.instance,i=n.options,r=i.scroll,s=r===void 0?!0:r,o=i.resize,a=o===void 0?!0:o,l=Gn(e.elements.popper),c=[].concat(e.scrollParents.reference,e.scrollParents.popper);return s&&c.forEach(function(d){d.addEventListener("scroll",t.update,ic)}),a&&l.addEventListener("resize",t.update,ic),function(){s&&c.forEach(function(d){d.removeEventListener("scroll",t.update,ic)}),a&&l.removeEventListener("resize",t.update,ic)}}const tht={name:"eventListeners",enabled:!0,phase:"write",fn:function(){},effect:eht,data:{}};var nht={left:"right",right:"left",bottom:"top",top:"bottom"};function jc(n){return n.replace(/left|right|bottom|top/g,function(e){return nht[e]})}var iht={start:"end",end:"start"};function px(n){return n.replace(/start|end/g,function(e){return iht[e]})}function TE(n){var e=Gn(n),t=e.pageXOffset,i=e.pageYOffset;return{scrollLeft:t,scrollTop:i}}function xE(n){return Wo(Qr(n)).left+TE(n).scrollLeft}function rht(n,e){var t=Gn(n),i=Qr(n),r=t.visualViewport,s=i.clientWidth,o=i.clientHeight,a=0,l=0;if(r){s=r.width,o=r.height;var c=ww();(c||!c&&e==="fixed")&&(a=r.offsetLeft,l=r.offsetTop)}return{width:s,height:o,x:a+xE(n),y:l}}function sht(n){var e,t=Qr(n),i=TE(n),r=(e=n.ownerDocument)==null?void 0:e.body,s=As(t.scrollWidth,t.clientWidth,r?r.scrollWidth:0,r?r.clientWidth:0),o=As(t.scrollHeight,t.clientHeight,r?r.scrollHeight:0,r?r.clientHeight:0),a=-i.scrollLeft+xE(n),l=-i.scrollTop;return lr(r||t).direction==="rtl"&&(a+=As(t.clientWidth,r?r.clientWidth:0)-s),{width:s,height:o,x:a,y:l}}function CE(n){var e=lr(n),t=e.overflow,i=e.overflowX,r=e.overflowY;return/auto|scroll|overlay|hidden/.test(t+r+i)}function Dw(n){return["html","body","#document"].indexOf(Di(n))>=0?n.ownerDocument.body:ei(n)&&CE(n)?n:Dw(su(n))}function Ja(n,e){var t;e===void 0&&(e=[]);var i=Dw(n),r=i===((t=n.ownerDocument)==null?void 0:t.body),s=Gn(i),o=r?[s].concat(s.visualViewport||[],CE(i)?i:[]):i,a=e.concat(o);return r?a:a.concat(Ja(su(o)))}function $m(n){return Object.assign({},n,{left:n.x,top:n.y,right:n.x+n.width,bottom:n.y+n.height})}function oht(n,e){var t=Wo(n,!1,e==="fixed");return t.top=t.top+n.clientTop,t.left=t.left+n.clientLeft,t.bottom=t.top+n.clientHeight,t.right=t.left+n.clientWidth,t.width=n.clientWidth,t.height=n.clientHeight,t.x=t.left,t.y=t.top,t}function hx(n,e,t){return e===Rw?$m(rht(n,t)):Ls(e)?oht(e,t):$m(sht(Qr(n)))}function aht(n){var e=Ja(su(n)),t=["absolute","fixed"].indexOf(lr(n).position)>=0,i=t&&ei(n)?Fl(n):n;return Ls(i)?e.filter(function(r){return Ls(r)&&Ow(r,i)&&Di(r)!=="body"}):[]}function lht(n,e,t,i){var r=e==="clippingParents"?aht(n):[].concat(e),s=[].concat(r,[t]),o=s[0],a=s.reduce(function(l,c){var d=hx(n,c,i);return l.top=As(d.top,l.top),l.right=fd(d.right,l.right),l.bottom=fd(d.bottom,l.bottom),l.left=As(d.left,l.left),l},hx(n,o,i));return a.width=a.right-a.left,a.height=a.bottom-a.top,a.x=a.left,a.y=a.top,a}function Lw(n){var e=n.reference,t=n.element,i=n.placement,r=i?Ni(i):null,s=i?Ko(i):null,o=e.x+e.width/2-t.width/2,a=e.y+e.height/2-t.height/2,l;switch(r){case In:l={x:o,y:e.y-t.height};break;case ni:l={x:o,y:e.y+e.height};break;case ii:l={x:e.x+e.width,y:a};break;case Dn:l={x:e.x-t.width,y:a};break;default:l={x:e.x,y:e.y}}var c=r?vE(r):null;if(c!=null){var d=c==="y"?"height":"width";switch(s){case Yo:l[c]=l[c]-(e[d]/2-t[d]/2);break;case Sl:l[c]=l[c]+(e[d]/2-t[d]/2);break}}return l}function yl(n,e){e===void 0&&(e={});var t=e,i=t.placement,r=i===void 0?n.placement:i,s=t.strategy,o=s===void 0?n.strategy:s,a=t.boundary,l=a===void 0?wpt:a,c=t.rootBoundary,d=c===void 0?Rw:c,u=t.elementContext,_=u===void 0?Da:u,f=t.altBoundary,h=f===void 0?!1:f,E=t.padding,g=E===void 0?0:E,m=Mw(typeof g!="number"?g:Iw(g,Ul)),b=_===Da?Opt:Da,S=n.rects.popper,v=n.elements[h?b:_],T=lht(Ls(v)?v:v.contextElement||Qr(n.elements.popper),l,d,o),C=Wo(n.elements.reference),N=Lw({reference:C,element:S,strategy:"absolute",placement:r}),x=$m(Object.assign({},S,N)),y=_===Da?x:C,R={top:T.top-y.top+m.top,bottom:y.bottom-T.bottom+m.bottom,left:T.left-y.left+m.left,right:y.right-T.right+m.right},P=n.modifiersData.offset;if(_===Da&&P){var k=P[r];Object.keys(R).forEach(function(W){var I=[ii,ni].indexOf(W)>=0?1:-1,V=[In,ni].indexOf(W)>=0?"y":"x";R[W]+=k[V]*I})}return R}function cht(n,e){e===void 0&&(e={});var t=e,i=t.placement,r=t.boundary,s=t.rootBoundary,o=t.padding,a=t.flipVariations,l=t.allowedAutoPlacements,c=l===void 0?Aw:l,d=Ko(i),u=d?a?dx:dx.filter(function(h){return Ko(h)===d}):Ul,_=u.filter(function(h){return c.indexOf(h)>=0});_.length===0&&(_=u);var f=_.reduce(function(h,E){return h[E]=yl(n,{placement:E,boundary:r,rootBoundary:s,padding:o})[Ni(E)],h},{});return Object.keys(f).sort(function(h,E){return f[h]-f[E]})}function dht(n){if(Ni(n)===bE)return[];var e=jc(n);return[px(n),e,px(e)]}function uht(n){var e=n.state,t=n.options,i=n.name;if(!e.modifiersData[i]._skip){for(var r=t.mainAxis,s=r===void 0?!0:r,o=t.altAxis,a=o===void 0?!0:o,l=t.fallbackPlacements,c=t.padding,d=t.boundary,u=t.rootBoundary,_=t.altBoundary,f=t.flipVariations,h=f===void 0?!0:f,E=t.allowedAutoPlacements,g=e.options.placement,m=Ni(g),b=m===g,S=l||(b||!h?[jc(g)]:dht(g)),v=[g].concat(S).reduce(function(_e,he){return _e.concat(Ni(he)===bE?cht(e,{placement:he,boundary:d,rootBoundary:u,padding:c,flipVariations:h,allowedAutoPlacements:E}):he)},[]),T=e.rects.reference,C=e.rects.popper,N=new Map,x=!0,y=v[0],R=0;R=0,V=I?"width":"height",z=yl(e,{placement:P,boundary:d,rootBoundary:u,altBoundary:_,padding:c}),D=I?W?ii:Dn:W?ni:In;T[V]>C[V]&&(D=jc(D));var Y=jc(D),K=[];if(s&&K.push(z[k]<=0),a&&K.push(z[D]<=0,z[Y]<=0),K.every(function(_e){return _e})){y=P,x=!1;break}N.set(P,K)}if(x)for(var q=h?3:1,le=function(he){var ye=v.find(function(j){var de=N.get(j);if(de)return de.slice(0,he).every(function(Q){return Q})});if(ye)return y=ye,"break"},Z=q;Z>0;Z--){var J=le(Z);if(J==="break")break}e.placement!==y&&(e.modifiersData[i]._skip=!0,e.placement=y,e.reset=!0)}}const _ht={name:"flip",enabled:!0,phase:"main",fn:uht,requiresIfExists:["offset"],data:{_skip:!1}};function fx(n,e,t){return t===void 0&&(t={x:0,y:0}),{top:n.top-e.height-t.y,right:n.right-e.width+t.x,bottom:n.bottom-e.height+t.y,left:n.left-e.width-t.x}}function mx(n){return[In,ii,ni,Dn].some(function(e){return n[e]>=0})}function pht(n){var e=n.state,t=n.name,i=e.rects.reference,r=e.rects.popper,s=e.modifiersData.preventOverflow,o=yl(e,{elementContext:"reference"}),a=yl(e,{altBoundary:!0}),l=fx(o,i),c=fx(a,r,s),d=mx(l),u=mx(c);e.modifiersData[t]={referenceClippingOffsets:l,popperEscapeOffsets:c,isReferenceHidden:d,hasPopperEscaped:u},e.attributes.popper=Object.assign({},e.attributes.popper,{"data-popper-reference-hidden":d,"data-popper-escaped":u})}const hht={name:"hide",enabled:!0,phase:"main",requiresIfExists:["preventOverflow"],fn:pht};function fht(n,e,t){var i=Ni(n),r=[Dn,In].indexOf(i)>=0?-1:1,s=typeof t=="function"?t(Object.assign({},e,{placement:n})):t,o=s[0],a=s[1];return o=o||0,a=(a||0)*r,[Dn,ii].indexOf(i)>=0?{x:a,y:o}:{x:o,y:a}}function mht(n){var e=n.state,t=n.options,i=n.name,r=t.offset,s=r===void 0?[0,0]:r,o=Aw.reduce(function(d,u){return d[u]=fht(u,e.rects,s),d},{}),a=o[e.placement],l=a.x,c=a.y;e.modifiersData.popperOffsets!=null&&(e.modifiersData.popperOffsets.x+=l,e.modifiersData.popperOffsets.y+=c),e.modifiersData[i]=o}const ght={name:"offset",enabled:!0,phase:"main",requires:["popperOffsets"],fn:mht};function Eht(n){var e=n.state,t=n.name;e.modifiersData[t]=Lw({reference:e.rects.reference,element:e.rects.popper,strategy:"absolute",placement:e.placement})}const bht={name:"popperOffsets",enabled:!0,phase:"read",fn:Eht,data:{}};function Sht(n){return n==="x"?"y":"x"}function yht(n){var e=n.state,t=n.options,i=n.name,r=t.mainAxis,s=r===void 0?!0:r,o=t.altAxis,a=o===void 0?!1:o,l=t.boundary,c=t.rootBoundary,d=t.altBoundary,u=t.padding,_=t.tether,f=_===void 0?!0:_,h=t.tetherOffset,E=h===void 0?0:h,g=yl(e,{boundary:l,rootBoundary:c,padding:u,altBoundary:d}),m=Ni(e.placement),b=Ko(e.placement),S=!b,v=vE(m),T=Sht(v),C=e.modifiersData.popperOffsets,N=e.rects.reference,x=e.rects.popper,y=typeof E=="function"?E(Object.assign({},e.rects,{placement:e.placement})):E,R=typeof y=="number"?{mainAxis:y,altAxis:y}:Object.assign({mainAxis:0,altAxis:0},y),P=e.modifiersData.offset?e.modifiersData.offset[e.placement]:null,k={x:0,y:0};if(C){if(s){var W,I=v==="y"?In:Dn,V=v==="y"?ni:ii,z=v==="y"?"height":"width",D=C[v],Y=D+g[I],K=D-g[V],q=f?-x[z]/2:0,le=b===Yo?N[z]:x[z],Z=b===Yo?-x[z]:-N[z],J=e.elements.arrow,_e=f&&J?yE(J):{width:0,height:0},he=e.modifiersData["arrow#persistent"]?e.modifiersData["arrow#persistent"].padding:Nw(),ye=he[I],j=he[V],de=Za(0,N[z],_e[z]),Q=S?N[z]/2-q-de-ye-R.mainAxis:le-de-ye-R.mainAxis,fe=S?-N[z]/2+q+de+j+R.mainAxis:Z+de+j+R.mainAxis,we=e.elements.arrow&&Fl(e.elements.arrow),O=we?v==="y"?we.clientTop||0:we.clientLeft||0:0,F=(W=P==null?void 0:P[v])!=null?W:0,H=D+Q-F-O,se=D+fe-F,te=Za(f?fd(Y,H):Y,D,f?As(K,se):K);C[v]=te,k[v]=te-D}if(a){var be,xe=v==="x"?In:Dn,B=v==="x"?ni:ii,ae=C[T],ne=T==="y"?"height":"width",re=ae+g[xe],w=ae-g[B],A=[In,Dn].indexOf(m)!==-1,G=(be=P==null?void 0:P[T])!=null?be:0,ce=A?re:ae-N[ne]-x[ne]-G+R.altAxis,$=A?ae+N[ne]+x[ne]-G-R.altAxis:w,ee=f&&A?Ypt(ce,ae,$):Za(f?ce:re,ae,f?$:w);C[T]=ee,k[T]=ee-ae}e.modifiersData[i]=k}}const vht={name:"preventOverflow",enabled:!0,phase:"main",fn:yht,requiresIfExists:["offset"]};function Tht(n){return{scrollLeft:n.scrollLeft,scrollTop:n.scrollTop}}function xht(n){return n===Gn(n)||!ei(n)?TE(n):Tht(n)}function Cht(n){var e=n.getBoundingClientRect(),t=$o(e.width)/n.offsetWidth||1,i=$o(e.height)/n.offsetHeight||1;return t!==1||i!==1}function Rht(n,e,t){t===void 0&&(t=!1);var i=ei(e),r=ei(e)&&Cht(e),s=Qr(e),o=Wo(n,r,t),a={scrollLeft:0,scrollTop:0},l={x:0,y:0};return(i||!i&&!t)&&((Di(e)!=="body"||CE(s))&&(a=xht(e)),ei(e)?(l=Wo(e,!0),l.x+=e.clientLeft,l.y+=e.clientTop):s&&(l.x=xE(s))),{x:o.left+a.scrollLeft-l.x,y:o.top+a.scrollTop-l.y,width:o.width,height:o.height}}function Aht(n){var e=new Map,t=new Set,i=[];n.forEach(function(s){e.set(s.name,s)});function r(s){t.add(s.name);var o=[].concat(s.requires||[],s.requiresIfExists||[]);o.forEach(function(a){if(!t.has(a)){var l=e.get(a);l&&r(l)}}),i.push(s)}return n.forEach(function(s){t.has(s.name)||r(s)}),i}function wht(n){var e=Aht(n);return Bpt.reduce(function(t,i){return t.concat(e.filter(function(r){return r.phase===i}))},[])}function Oht(n){var e;return function(){return e||(e=new Promise(function(t){Promise.resolve().then(function(){e=void 0,t(n())})})),e}}function Nht(n){var e=n.reduce(function(t,i){var r=t[i.name];return t[i.name]=r?Object.assign({},r,i,{options:Object.assign({},r.options,i.options),data:Object.assign({},r.data,i.data)}):i,t},{});return Object.keys(e).map(function(t){return e[t]})}var gx={placement:"bottom",modifiers:[],strategy:"absolute"};function Ex(){for(var n=arguments.length,e=new Array(n),t=0;t(Gs("data-v-ea1ea661"),n=n(),zs(),n),Uht={key:0,class:"fixed top-0 left-0 w-screen h-screen flex items-center justify-center"},Fht={class:"flex flex-col text-center"},Bht={class:"flex flex-col text-center items-center"},Ght={class:"flex items-center gap-3 text-5xl drop-shadow-md align-middle pt-24"},zht=Lt(()=>p("img",{class:"w-24 animate-bounce",title:"LoLLMS WebUI",src:Vo,alt:"Logo"},null,-1)),Vht={class:"flex flex-col items-start"},Hht={class:"text-2xl"},qht=Lt(()=>p("p",{class:"text-gray-400 text-base"},"One tool to rule them all",-1)),Yht=Lt(()=>p("p",{class:"text-gray-400 text-base"},"by ParisNeo",-1)),$ht=Lt(()=>p("hr",{class:"mt-1 w-96 h-1 mx-auto my-2 md:my-2 dark:bg-bg-dark-tone-panel bg-bg-light-tone-panel border-0 rounded"},null,-1)),Wht=Lt(()=>p("p",{class:"text-2xl mb-10"},"Welcome",-1)),Kht={role:"status",class:"text-center w-full display: flex; flex-row align-items: center;"},jht={class:"text-2xl animate-pulse mt-2"},Qht=Lt(()=>p("i",{"data-feather":"chevron-right"},null,-1)),Xht=[Qht],Zht=Lt(()=>p("i",{"data-feather":"chevron-left"},null,-1)),Jht=[Zht],eft={key:0,class:"relative flex flex-col no-scrollbar shadow-lg min-w-[24rem] max-w-[24rem] bg-bg-light-tone dark:bg-bg-dark-tone"},tft={class:"sticky z-10 top-0 bg-bg-light-tone dark:bg-bg-dark-tone shadow-md"},nft={class:"flex-row p-4 flex items-center gap-3 flex-0"},ift=Lt(()=>p("i",{"data-feather":"plus"},null,-1)),rft=[ift],sft=Lt(()=>p("i",{"data-feather":"check-square"},null,-1)),oft=[sft],aft=Lt(()=>p("button",{class:"text-2xl hover:text-secondary duration-75 active:scale-90",title:"Reset database, remove all discussions"},[p("i",{"data-feather":"refresh-ccw"})],-1)),lft=Lt(()=>p("i",{"data-feather":"database"},null,-1)),cft=[lft],dft=Lt(()=>p("i",{"data-feather":"log-in"},null,-1)),uft=[dft],_ft={key:0,class:"dropdown"},pft=Lt(()=>p("i",{"data-feather":"search"},null,-1)),hft=[pft],fft=Lt(()=>p("i",{"data-feather":"save"},null,-1)),mft=[fft],gft={key:2,class:"flex gap-3 flex-1 items-center duration-75"},Eft=Lt(()=>p("i",{"data-feather":"x"},null,-1)),bft=[Eft],Sft=Lt(()=>p("i",{"data-feather":"check"},null,-1)),yft=[Sft],vft=["src"],Tft=["src"],xft=["src"],Cft={key:4,title:"Loading..",class:"flex flex-row flex-grow justify-end"},Rft=Lt(()=>p("div",{role:"status"},[p("svg",{"aria-hidden":"true",class:"w-6 h-6 animate-spin fill-secondary",viewBox:"0 0 100 101",fill:"none",xmlns:"http://www.w3.org/2000/svg"},[p("path",{d:"M100 50.5908C100 78.2051 77.6142 100.591 50 100.591C22.3858 100.591 0 78.2051 0 50.5908C0 22.9766 22.3858 0.59082 50 0.59082C77.6142 0.59082 100 22.9766 100 50.5908ZM9.08144 50.5908C9.08144 73.1895 27.4013 91.5094 50 91.5094C72.5987 91.5094 90.9186 73.1895 90.9186 50.5908C90.9186 27.9921 72.5987 9.67226 50 9.67226C27.4013 9.67226 9.08144 27.9921 9.08144 50.5908Z",fill:"currentColor"}),p("path",{d:"M93.9676 39.0409C96.393 38.4038 97.8624 35.9116 97.0079 33.5539C95.2932 28.8227 92.871 24.3692 89.8167 20.348C85.8452 15.1192 80.8826 10.7238 75.2124 7.41289C69.5422 4.10194 63.2754 1.94025 56.7698 1.05124C51.7666 0.367541 46.6976 0.446843 41.7345 1.27873C39.2613 1.69328 37.813 4.19778 38.4501 6.62326C39.0873 9.04874 41.5694 10.4717 44.0505 10.1071C47.8511 9.54855 51.7191 9.52689 55.5402 10.0491C60.8642 10.7766 65.9928 12.5457 70.6331 15.2552C75.2735 17.9648 79.3347 21.5619 82.5849 25.841C84.9175 28.9121 86.7997 32.2913 88.1811 35.8758C89.083 38.2158 91.5421 39.6781 93.9676 39.0409Z",fill:"currentFill"})]),p("span",{class:"sr-only"},"Loading...")],-1)),Aft=[Rft],wft={key:0,class:"flex-row items-center gap-3 flex-0 w-full"},Oft={class:"p-4 pt-2"},Nft={class:"relative"},Mft=Lt(()=>p("div",{class:"absolute inset-y-0 left-0 flex items-center pl-3 pointer-events-none"},[p("div",{class:"scale-75"},[p("i",{"data-feather":"search"})])],-1)),Ift={class:"absolute inset-y-0 right-0 flex items-center pr-3"},Dft=Lt(()=>p("i",{"data-feather":"x"},null,-1)),Lft=[Dft],kft={key:1,class:"h-px bg-bg-light p-0 mb-4 px-4 mx-4 border-0 dark:bg-bg-dark"},Pft={key:2,class:"flex flex-row flex-grow p-4 pt-0 items-center"},Uft={class:"flex flex-row flex-grow"},Fft={key:0},Bft={class:"flex flex-row"},Gft={key:0,class:"flex gap-3"},zft=Lt(()=>p("i",{"data-feather":"trash"},null,-1)),Vft=[zft],Hft={key:1,class:"flex gap-3 mx-3 flex-1 items-center justify-end group-hover:visible duration-75"},qft=Lt(()=>p("i",{"data-feather":"check"},null,-1)),Yft=[qft],$ft=Lt(()=>p("i",{"data-feather":"x"},null,-1)),Wft=[$ft],Kft={class:"flex gap-3"},jft=Lt(()=>p("i",{"data-feather":"log-out"},null,-1)),Qft=[jft],Xft=Lt(()=>p("i",{"data-feather":"bookmark"},null,-1)),Zft=[Xft],Jft=Lt(()=>p("i",{"data-feather":"list"},null,-1)),emt=[Jft],tmt={class:"relative flex flex-row flex-grow mb-10 z-0 w-full"},nmt={key:1,class:"gap-2 py-2 my-2 hover:shadow-md hover:bg-primary-light dark:hover:bg-primary rounded-md p-2 duration-75 group cursor-pointer"},imt=Lt(()=>p("p",{class:"px-3"},"No discussions are found",-1)),rmt=[imt],smt=Lt(()=>p("div",{class:"sticky bottom-0 bg-gradient-to-t pointer-events-none from-bg-light-tone dark:from-bg-dark-tone flex flex-grow"},null,-1)),omt={class:"ml-2"},amt={key:1,class:"relative flex flex-col flex-grow w-full"},lmt={class:"container pt-4 pb-50 mb-50 w-full"},cmt=Lt(()=>p("div",null,[p("br"),p("br"),p("br"),p("br"),p("br"),p("br"),p("br")],-1)),dmt=Lt(()=>p("div",{class:"absolute w-full bottom-0 bg-transparent p-10 pt-16 bg-gradient-to-t from-bg-light dark:from-bg-dark from-5% via-bg-light dark:via-bg-dark via-10% to-transparent to-100%"},null,-1)),umt={key:0,class:"bottom-0 flex flex-row items-center justify-center"},_mt={role:"status",class:"fixed m-0 p-2 left-2 bottom-2 min-w-[24rem] max-w-[24rem] h-20 flex flex-col justify-center items-center pb-4 bg-blue-500 rounded-lg shadow-lg z-50 background-a"},pmt={class:"text-2xl animate-pulse mt-2 text-white"},hmt={setup(){},data(){return{currentDiscussion:{},host:"",progress_visibility_val:!0,progress_value:0,msgTypes:{MSG_TYPE_CHUNK:0,MSG_TYPE_FULL:1,MSG_TYPE_FULL_INVISIBLE_TO_AI:2,MSG_TYPE_FULL_INVISIBLE_TO_USER:3,MSG_TYPE_EXCEPTION:4,MSG_TYPE_WARNING:5,MSG_TYPE_INFO:6,MSG_TYPE_STEP:7,MSG_TYPE_STEP_START:8,MSG_TYPE_STEP_PROGRESS:9,MSG_TYPE_STEP_END:10,MSG_TYPE_JSON_INFOS:11,MSG_TYPE_REF:12,MSG_TYPE_CODE:13,MSG_TYPE_UI:14,MSG_TYPE_NEW_MESSAGE:15,MSG_TYPE_FINISHED_MESSAGE:17},senderTypes:{SENDER_TYPES_USER:0,SENDER_TYPES_AI:1,SENDER_TYPES_SYSTEM:2},list:[],tempList:[],currentDiscussion:{},discussionArr:[],loading:!1,filterTitle:"",filterInProgress:!1,isCreated:!1,isCheckbox:!1,isSelectAll:!1,showSaveConfirmation:!1,showBrainConfirmation:!1,showConfirmation:!1,chime:new Audio("chime_aud.wav"),showToast:!1,isSearch:!1,isDiscussionBottom:!1,personalityAvatars:[],fileList:[],database_selectorDialogVisible:!1,isDragOverDiscussion:!1,isDragOverChat:!1,panelCollapsed:!1,isOpen:!1,discussion_id:0}},methods:{add_webpage(){console.log("addWebLink received"),this.$refs.web_url_input_box.showPanel()},handleOk(){console.log("OK"),He.on("web_page_added",()=>{Pe.get("/get_current_personality_files_list").then(n=>{this.filesList=n.data.files,console.log("this.filesList",this.filesList),this.isFileSentList=n.data.files.map(e=>!0),console.log(`Files recovered: ${this.filesList}`)})}),He.emit("add_webpage",{url:this.$refs.web_url_input_box.inputText})},show_progress(n){this.progress_visibility_val=!0},hide_progress(n){this.progress_visibility_val=!1},update_progress(n){console.log("Progress update"),this.progress_value=n.value},onSettingsBinding(){try{this.isLoading=!0,Pe.get("/get_active_binding_settings").then(n=>{this.isLoading=!1,n&&(n.data&&Object.keys(n.data).length>0?this.$store.state.universalForm.showForm(n.data,"Binding settings - "+bindingEntry.binding.name,"Save changes","Cancel").then(e=>{try{Pe.post("/set_active_binding_settings",e).then(t=>{t&&t.data?(console.log("binding set with new settings",t.data),this.$store.state.toast.showToast("Binding settings updated successfully!",4,!0)):(this.$store.state.toast.showToast(`Did not get binding settings responses. + `,544),[[Je,r.message]])]),p("div",rpt,[t.loading?X("",!0):(M(),L("button",{key:0,type:"button",onClick:e[9]||(e[9]=(...d)=>s.startSpeechRecognition&&s.startSpeechRecognition(...d)),title:"Press and talk",class:Ke([{"text-red-500":r.isLesteningToVoice},"w-6 hover:text-secondary duration-75 active:scale-90 cursor-pointer"])},opt,2)),p("input",{type:"file",ref:"fileDialog",style:{display:"none"},onChange:e[10]||(e[10]=(...d)=>s.addFiles&&s.addFiles(...d)),multiple:""},null,544),p("button",{type:"button",onClick:e[11]||(e[11]=Oe(d=>n.$refs.fileDialog.click(),["stop"])),title:"Add files",class:"m-1 w-6 hover:text-secondary duration-75 active:scale-90"},lpt),p("button",{type:"button",onClick:e[12]||(e[12]=Oe((...d)=>s.takePicture&&s.takePicture(...d),["stop"])),title:"take a shot from camera",class:"m-1 w-6 hover:text-secondary duration-75 active:scale-90"},dpt),p("button",{type:"button",onClick:e[13]||(e[13]=Oe((...d)=>s.addWebLink&&s.addWebLink(...d),["stop"])),title:"add web link",class:"m-1 w-6 hover:text-secondary duration-75 active:scale-90"},_pt),t.loading?X("",!0):(M(),L("button",{key:1,type:"button",onClick:e[14]||(e[14]=(...d)=>s.makeAnEmptyUserMessage&&s.makeAnEmptyUserMessage(...d)),title:"New empty user message",class:"w-6 text-blue-400 hover:text-secondary duration-75 active:scale-90"},fpt)),t.loading?X("",!0):(M(),L("button",{key:2,type:"button",onClick:e[15]||(e[15]=(...d)=>s.makeAnEmptyAIMessage&&s.makeAnEmptyAIMessage(...d)),title:"New empty ai message",class:"w-6 text-red-400 hover:text-secondary duration-75 active:scale-90"},Ept)),t.loading?X("",!0):(M(),L("button",{key:3,type:"button",onClick:e[16]||(e[16]=(...d)=>s.submit&&s.submit(...d)),title:"Send",class:"w-6 hover:text-secondary duration-75 active:scale-90"},ypt)),t.loading?(M(),L("div",vpt,xpt)):X("",!0)])])])])])]),Le(c,{ref:"universalForm",class:"z-20"},null,512)],64)}const Sw=ft(r_t,[["render",Cpt],["__scopeId","data-v-b2f77eff"]]),Rpt={name:"WelcomeComponent",setup(){return{}}},Apt={class:"flex flex-col text-center"},wpt=Og('
Logo

Lord of Large Language and Multimodal Systems

One tool to rule them all


Welcome

Please create a new discussion or select existing one to start

',1),Opt=[wpt];function Npt(n,e,t,i,r,s){return M(),L("div",Apt,Opt)}const yw=ft(Rpt,[["render",Npt]]);var Mpt=function(){function n(e,t){t===void 0&&(t=[]),this._eventType=e,this._eventFunctions=t}return n.prototype.init=function(){var e=this;this._eventFunctions.forEach(function(t){typeof window<"u"&&window.addEventListener(e._eventType,t)})},n}(),ud=globalThis&&globalThis.__assign||function(){return ud=Object.assign||function(n){for(var e,t=1,i=arguments.length;t"u")return!1;var e=Gn(n).ShadowRoot;return n instanceof e||n instanceof ShadowRoot}function qpt(n){var e=n.state;Object.keys(e.elements).forEach(function(t){var i=e.styles[t]||{},r=e.attributes[t]||{},s=e.elements[t];!ei(s)||!Di(s)||(Object.assign(s.style,i),Object.keys(r).forEach(function(o){var a=r[o];a===!1?s.removeAttribute(o):s.setAttribute(o,a===!0?"":a)}))})}function Ypt(n){var e=n.state,t={popper:{position:e.options.strategy,left:"0",top:"0",margin:"0"},arrow:{position:"absolute"},reference:{}};return Object.assign(e.elements.popper.style,t.popper),e.styles=t,e.elements.arrow&&Object.assign(e.elements.arrow.style,t.arrow),function(){Object.keys(e.elements).forEach(function(i){var r=e.elements[i],s=e.attributes[i]||{},o=Object.keys(e.styles.hasOwnProperty(i)?e.styles[i]:t[i]),a=o.reduce(function(l,c){return l[c]="",l},{});!ei(r)||!Di(r)||(Object.assign(r.style,a),Object.keys(s).forEach(function(l){r.removeAttribute(l)}))})}}const $pt={name:"applyStyles",enabled:!0,phase:"write",fn:qpt,effect:Ypt,requires:["computeStyles"]};function Ni(n){return n.split("-")[0]}var As=Math.max,fd=Math.min,$o=Math.round;function Ym(){var n=navigator.userAgentData;return n!=null&&n.brands&&Array.isArray(n.brands)?n.brands.map(function(e){return e.brand+"/"+e.version}).join(" "):navigator.userAgent}function ww(){return!/^((?!chrome|android).)*safari/i.test(Ym())}function Wo(n,e,t){e===void 0&&(e=!1),t===void 0&&(t=!1);var i=n.getBoundingClientRect(),r=1,s=1;e&&ei(n)&&(r=n.offsetWidth>0&&$o(i.width)/n.offsetWidth||1,s=n.offsetHeight>0&&$o(i.height)/n.offsetHeight||1);var o=Ls(n)?Gn(n):window,a=o.visualViewport,l=!ww()&&t,c=(i.left+(l&&a?a.offsetLeft:0))/r,d=(i.top+(l&&a?a.offsetTop:0))/s,u=i.width/r,_=i.height/s;return{width:u,height:_,top:d,right:c+u,bottom:d+_,left:c,x:c,y:d}}function yE(n){var e=Wo(n),t=n.offsetWidth,i=n.offsetHeight;return Math.abs(e.width-t)<=1&&(t=e.width),Math.abs(e.height-i)<=1&&(i=e.height),{x:n.offsetLeft,y:n.offsetTop,width:t,height:i}}function Ow(n,e){var t=e.getRootNode&&e.getRootNode();if(n.contains(e))return!0;if(t&&SE(t)){var i=e;do{if(i&&n.isSameNode(i))return!0;i=i.parentNode||i.host}while(i)}return!1}function lr(n){return Gn(n).getComputedStyle(n)}function Wpt(n){return["table","td","th"].indexOf(Di(n))>=0}function Qr(n){return((Ls(n)?n.ownerDocument:n.document)||window.document).documentElement}function su(n){return Di(n)==="html"?n:n.assignedSlot||n.parentNode||(SE(n)?n.host:null)||Qr(n)}function ux(n){return!ei(n)||lr(n).position==="fixed"?null:n.offsetParent}function Kpt(n){var e=/firefox/i.test(Ym()),t=/Trident/i.test(Ym());if(t&&ei(n)){var i=lr(n);if(i.position==="fixed")return null}var r=su(n);for(SE(r)&&(r=r.host);ei(r)&&["html","body"].indexOf(Di(r))<0;){var s=lr(r);if(s.transform!=="none"||s.perspective!=="none"||s.contain==="paint"||["transform","perspective"].indexOf(s.willChange)!==-1||e&&s.willChange==="filter"||e&&s.filter&&s.filter!=="none")return r;r=r.parentNode}return null}function Fl(n){for(var e=Gn(n),t=ux(n);t&&Wpt(t)&&lr(t).position==="static";)t=ux(t);return t&&(Di(t)==="html"||Di(t)==="body"&&lr(t).position==="static")?e:t||Kpt(n)||e}function vE(n){return["top","bottom"].indexOf(n)>=0?"x":"y"}function Za(n,e,t){return As(n,fd(e,t))}function jpt(n,e,t){var i=Za(n,e,t);return i>t?t:i}function Nw(){return{top:0,right:0,bottom:0,left:0}}function Mw(n){return Object.assign({},Nw(),n)}function Iw(n,e){return e.reduce(function(t,i){return t[i]=n,t},{})}var Qpt=function(e,t){return e=typeof e=="function"?e(Object.assign({},t.rects,{placement:t.placement})):e,Mw(typeof e!="number"?e:Iw(e,Ul))};function Xpt(n){var e,t=n.state,i=n.name,r=n.options,s=t.elements.arrow,o=t.modifiersData.popperOffsets,a=Ni(t.placement),l=vE(a),c=[Dn,ii].indexOf(a)>=0,d=c?"height":"width";if(!(!s||!o)){var u=Qpt(r.padding,t),_=yE(s),f=l==="y"?In:Dn,h=l==="y"?ni:ii,E=t.rects.reference[d]+t.rects.reference[l]-o[l]-t.rects.popper[d],g=o[l]-t.rects.reference[l],m=Fl(s),b=m?l==="y"?m.clientHeight||0:m.clientWidth||0:0,S=E/2-g/2,v=u[f],T=b-_[d]-u[h],C=b/2-_[d]/2+S,N=Za(v,C,T),x=l;t.modifiersData[i]=(e={},e[x]=N,e.centerOffset=N-C,e)}}function Zpt(n){var e=n.state,t=n.options,i=t.element,r=i===void 0?"[data-popper-arrow]":i;r!=null&&(typeof r=="string"&&(r=e.elements.popper.querySelector(r),!r)||Ow(e.elements.popper,r)&&(e.elements.arrow=r))}const Jpt={name:"arrow",enabled:!0,phase:"main",fn:Xpt,effect:Zpt,requires:["popperOffsets"],requiresIfExists:["preventOverflow"]};function Ko(n){return n.split("-")[1]}var eht={top:"auto",right:"auto",bottom:"auto",left:"auto"};function tht(n,e){var t=n.x,i=n.y,r=e.devicePixelRatio||1;return{x:$o(t*r)/r||0,y:$o(i*r)/r||0}}function _x(n){var e,t=n.popper,i=n.popperRect,r=n.placement,s=n.variation,o=n.offsets,a=n.position,l=n.gpuAcceleration,c=n.adaptive,d=n.roundOffsets,u=n.isFixed,_=o.x,f=_===void 0?0:_,h=o.y,E=h===void 0?0:h,g=typeof d=="function"?d({x:f,y:E}):{x:f,y:E};f=g.x,E=g.y;var m=o.hasOwnProperty("x"),b=o.hasOwnProperty("y"),S=Dn,v=In,T=window;if(c){var C=Fl(t),N="clientHeight",x="clientWidth";if(C===Gn(t)&&(C=Qr(t),lr(C).position!=="static"&&a==="absolute"&&(N="scrollHeight",x="scrollWidth")),C=C,r===In||(r===Dn||r===ii)&&s===Sl){v=ni;var y=u&&C===T&&T.visualViewport?T.visualViewport.height:C[N];E-=y-i.height,E*=l?1:-1}if(r===Dn||(r===In||r===ni)&&s===Sl){S=ii;var R=u&&C===T&&T.visualViewport?T.visualViewport.width:C[x];f-=R-i.width,f*=l?1:-1}}var P=Object.assign({position:a},c&&eht),k=d===!0?tht({x:f,y:E},Gn(t)):{x:f,y:E};if(f=k.x,E=k.y,l){var W;return Object.assign({},P,(W={},W[v]=b?"0":"",W[S]=m?"0":"",W.transform=(T.devicePixelRatio||1)<=1?"translate("+f+"px, "+E+"px)":"translate3d("+f+"px, "+E+"px, 0)",W))}return Object.assign({},P,(e={},e[v]=b?E+"px":"",e[S]=m?f+"px":"",e.transform="",e))}function nht(n){var e=n.state,t=n.options,i=t.gpuAcceleration,r=i===void 0?!0:i,s=t.adaptive,o=s===void 0?!0:s,a=t.roundOffsets,l=a===void 0?!0:a,c={placement:Ni(e.placement),variation:Ko(e.placement),popper:e.elements.popper,popperRect:e.rects.popper,gpuAcceleration:r,isFixed:e.options.strategy==="fixed"};e.modifiersData.popperOffsets!=null&&(e.styles.popper=Object.assign({},e.styles.popper,_x(Object.assign({},c,{offsets:e.modifiersData.popperOffsets,position:e.options.strategy,adaptive:o,roundOffsets:l})))),e.modifiersData.arrow!=null&&(e.styles.arrow=Object.assign({},e.styles.arrow,_x(Object.assign({},c,{offsets:e.modifiersData.arrow,position:"absolute",adaptive:!1,roundOffsets:l})))),e.attributes.popper=Object.assign({},e.attributes.popper,{"data-popper-placement":e.placement})}const iht={name:"computeStyles",enabled:!0,phase:"beforeWrite",fn:nht,data:{}};var ic={passive:!0};function rht(n){var e=n.state,t=n.instance,i=n.options,r=i.scroll,s=r===void 0?!0:r,o=i.resize,a=o===void 0?!0:o,l=Gn(e.elements.popper),c=[].concat(e.scrollParents.reference,e.scrollParents.popper);return s&&c.forEach(function(d){d.addEventListener("scroll",t.update,ic)}),a&&l.addEventListener("resize",t.update,ic),function(){s&&c.forEach(function(d){d.removeEventListener("scroll",t.update,ic)}),a&&l.removeEventListener("resize",t.update,ic)}}const sht={name:"eventListeners",enabled:!0,phase:"write",fn:function(){},effect:rht,data:{}};var oht={left:"right",right:"left",bottom:"top",top:"bottom"};function jc(n){return n.replace(/left|right|bottom|top/g,function(e){return oht[e]})}var aht={start:"end",end:"start"};function px(n){return n.replace(/start|end/g,function(e){return aht[e]})}function TE(n){var e=Gn(n),t=e.pageXOffset,i=e.pageYOffset;return{scrollLeft:t,scrollTop:i}}function xE(n){return Wo(Qr(n)).left+TE(n).scrollLeft}function lht(n,e){var t=Gn(n),i=Qr(n),r=t.visualViewport,s=i.clientWidth,o=i.clientHeight,a=0,l=0;if(r){s=r.width,o=r.height;var c=ww();(c||!c&&e==="fixed")&&(a=r.offsetLeft,l=r.offsetTop)}return{width:s,height:o,x:a+xE(n),y:l}}function cht(n){var e,t=Qr(n),i=TE(n),r=(e=n.ownerDocument)==null?void 0:e.body,s=As(t.scrollWidth,t.clientWidth,r?r.scrollWidth:0,r?r.clientWidth:0),o=As(t.scrollHeight,t.clientHeight,r?r.scrollHeight:0,r?r.clientHeight:0),a=-i.scrollLeft+xE(n),l=-i.scrollTop;return lr(r||t).direction==="rtl"&&(a+=As(t.clientWidth,r?r.clientWidth:0)-s),{width:s,height:o,x:a,y:l}}function CE(n){var e=lr(n),t=e.overflow,i=e.overflowX,r=e.overflowY;return/auto|scroll|overlay|hidden/.test(t+r+i)}function Dw(n){return["html","body","#document"].indexOf(Di(n))>=0?n.ownerDocument.body:ei(n)&&CE(n)?n:Dw(su(n))}function Ja(n,e){var t;e===void 0&&(e=[]);var i=Dw(n),r=i===((t=n.ownerDocument)==null?void 0:t.body),s=Gn(i),o=r?[s].concat(s.visualViewport||[],CE(i)?i:[]):i,a=e.concat(o);return r?a:a.concat(Ja(su(o)))}function $m(n){return Object.assign({},n,{left:n.x,top:n.y,right:n.x+n.width,bottom:n.y+n.height})}function dht(n,e){var t=Wo(n,!1,e==="fixed");return t.top=t.top+n.clientTop,t.left=t.left+n.clientLeft,t.bottom=t.top+n.clientHeight,t.right=t.left+n.clientWidth,t.width=n.clientWidth,t.height=n.clientHeight,t.x=t.left,t.y=t.top,t}function hx(n,e,t){return e===Rw?$m(lht(n,t)):Ls(e)?dht(e,t):$m(cht(Qr(n)))}function uht(n){var e=Ja(su(n)),t=["absolute","fixed"].indexOf(lr(n).position)>=0,i=t&&ei(n)?Fl(n):n;return Ls(i)?e.filter(function(r){return Ls(r)&&Ow(r,i)&&Di(r)!=="body"}):[]}function _ht(n,e,t,i){var r=e==="clippingParents"?uht(n):[].concat(e),s=[].concat(r,[t]),o=s[0],a=s.reduce(function(l,c){var d=hx(n,c,i);return l.top=As(d.top,l.top),l.right=fd(d.right,l.right),l.bottom=fd(d.bottom,l.bottom),l.left=As(d.left,l.left),l},hx(n,o,i));return a.width=a.right-a.left,a.height=a.bottom-a.top,a.x=a.left,a.y=a.top,a}function Lw(n){var e=n.reference,t=n.element,i=n.placement,r=i?Ni(i):null,s=i?Ko(i):null,o=e.x+e.width/2-t.width/2,a=e.y+e.height/2-t.height/2,l;switch(r){case In:l={x:o,y:e.y-t.height};break;case ni:l={x:o,y:e.y+e.height};break;case ii:l={x:e.x+e.width,y:a};break;case Dn:l={x:e.x-t.width,y:a};break;default:l={x:e.x,y:e.y}}var c=r?vE(r):null;if(c!=null){var d=c==="y"?"height":"width";switch(s){case Yo:l[c]=l[c]-(e[d]/2-t[d]/2);break;case Sl:l[c]=l[c]+(e[d]/2-t[d]/2);break}}return l}function yl(n,e){e===void 0&&(e={});var t=e,i=t.placement,r=i===void 0?n.placement:i,s=t.strategy,o=s===void 0?n.strategy:s,a=t.boundary,l=a===void 0?Ipt:a,c=t.rootBoundary,d=c===void 0?Rw:c,u=t.elementContext,_=u===void 0?Da:u,f=t.altBoundary,h=f===void 0?!1:f,E=t.padding,g=E===void 0?0:E,m=Mw(typeof g!="number"?g:Iw(g,Ul)),b=_===Da?Dpt:Da,S=n.rects.popper,v=n.elements[h?b:_],T=_ht(Ls(v)?v:v.contextElement||Qr(n.elements.popper),l,d,o),C=Wo(n.elements.reference),N=Lw({reference:C,element:S,strategy:"absolute",placement:r}),x=$m(Object.assign({},S,N)),y=_===Da?x:C,R={top:T.top-y.top+m.top,bottom:y.bottom-T.bottom+m.bottom,left:T.left-y.left+m.left,right:y.right-T.right+m.right},P=n.modifiersData.offset;if(_===Da&&P){var k=P[r];Object.keys(R).forEach(function(W){var I=[ii,ni].indexOf(W)>=0?1:-1,V=[In,ni].indexOf(W)>=0?"y":"x";R[W]+=k[V]*I})}return R}function pht(n,e){e===void 0&&(e={});var t=e,i=t.placement,r=t.boundary,s=t.rootBoundary,o=t.padding,a=t.flipVariations,l=t.allowedAutoPlacements,c=l===void 0?Aw:l,d=Ko(i),u=d?a?dx:dx.filter(function(h){return Ko(h)===d}):Ul,_=u.filter(function(h){return c.indexOf(h)>=0});_.length===0&&(_=u);var f=_.reduce(function(h,E){return h[E]=yl(n,{placement:E,boundary:r,rootBoundary:s,padding:o})[Ni(E)],h},{});return Object.keys(f).sort(function(h,E){return f[h]-f[E]})}function hht(n){if(Ni(n)===bE)return[];var e=jc(n);return[px(n),e,px(e)]}function fht(n){var e=n.state,t=n.options,i=n.name;if(!e.modifiersData[i]._skip){for(var r=t.mainAxis,s=r===void 0?!0:r,o=t.altAxis,a=o===void 0?!0:o,l=t.fallbackPlacements,c=t.padding,d=t.boundary,u=t.rootBoundary,_=t.altBoundary,f=t.flipVariations,h=f===void 0?!0:f,E=t.allowedAutoPlacements,g=e.options.placement,m=Ni(g),b=m===g,S=l||(b||!h?[jc(g)]:hht(g)),v=[g].concat(S).reduce(function(_e,he){return _e.concat(Ni(he)===bE?pht(e,{placement:he,boundary:d,rootBoundary:u,padding:c,flipVariations:h,allowedAutoPlacements:E}):he)},[]),T=e.rects.reference,C=e.rects.popper,N=new Map,x=!0,y=v[0],R=0;R=0,V=I?"width":"height",z=yl(e,{placement:P,boundary:d,rootBoundary:u,altBoundary:_,padding:c}),D=I?W?ii:Dn:W?ni:In;T[V]>C[V]&&(D=jc(D));var Y=jc(D),K=[];if(s&&K.push(z[k]<=0),a&&K.push(z[D]<=0,z[Y]<=0),K.every(function(_e){return _e})){y=P,x=!1;break}N.set(P,K)}if(x)for(var q=h?3:1,le=function(he){var ye=v.find(function(j){var de=N.get(j);if(de)return de.slice(0,he).every(function(Q){return Q})});if(ye)return y=ye,"break"},Z=q;Z>0;Z--){var J=le(Z);if(J==="break")break}e.placement!==y&&(e.modifiersData[i]._skip=!0,e.placement=y,e.reset=!0)}}const mht={name:"flip",enabled:!0,phase:"main",fn:fht,requiresIfExists:["offset"],data:{_skip:!1}};function fx(n,e,t){return t===void 0&&(t={x:0,y:0}),{top:n.top-e.height-t.y,right:n.right-e.width+t.x,bottom:n.bottom-e.height+t.y,left:n.left-e.width-t.x}}function mx(n){return[In,ii,ni,Dn].some(function(e){return n[e]>=0})}function ght(n){var e=n.state,t=n.name,i=e.rects.reference,r=e.rects.popper,s=e.modifiersData.preventOverflow,o=yl(e,{elementContext:"reference"}),a=yl(e,{altBoundary:!0}),l=fx(o,i),c=fx(a,r,s),d=mx(l),u=mx(c);e.modifiersData[t]={referenceClippingOffsets:l,popperEscapeOffsets:c,isReferenceHidden:d,hasPopperEscaped:u},e.attributes.popper=Object.assign({},e.attributes.popper,{"data-popper-reference-hidden":d,"data-popper-escaped":u})}const Eht={name:"hide",enabled:!0,phase:"main",requiresIfExists:["preventOverflow"],fn:ght};function bht(n,e,t){var i=Ni(n),r=[Dn,In].indexOf(i)>=0?-1:1,s=typeof t=="function"?t(Object.assign({},e,{placement:n})):t,o=s[0],a=s[1];return o=o||0,a=(a||0)*r,[Dn,ii].indexOf(i)>=0?{x:a,y:o}:{x:o,y:a}}function Sht(n){var e=n.state,t=n.options,i=n.name,r=t.offset,s=r===void 0?[0,0]:r,o=Aw.reduce(function(d,u){return d[u]=bht(u,e.rects,s),d},{}),a=o[e.placement],l=a.x,c=a.y;e.modifiersData.popperOffsets!=null&&(e.modifiersData.popperOffsets.x+=l,e.modifiersData.popperOffsets.y+=c),e.modifiersData[i]=o}const yht={name:"offset",enabled:!0,phase:"main",requires:["popperOffsets"],fn:Sht};function vht(n){var e=n.state,t=n.name;e.modifiersData[t]=Lw({reference:e.rects.reference,element:e.rects.popper,strategy:"absolute",placement:e.placement})}const Tht={name:"popperOffsets",enabled:!0,phase:"read",fn:vht,data:{}};function xht(n){return n==="x"?"y":"x"}function Cht(n){var e=n.state,t=n.options,i=n.name,r=t.mainAxis,s=r===void 0?!0:r,o=t.altAxis,a=o===void 0?!1:o,l=t.boundary,c=t.rootBoundary,d=t.altBoundary,u=t.padding,_=t.tether,f=_===void 0?!0:_,h=t.tetherOffset,E=h===void 0?0:h,g=yl(e,{boundary:l,rootBoundary:c,padding:u,altBoundary:d}),m=Ni(e.placement),b=Ko(e.placement),S=!b,v=vE(m),T=xht(v),C=e.modifiersData.popperOffsets,N=e.rects.reference,x=e.rects.popper,y=typeof E=="function"?E(Object.assign({},e.rects,{placement:e.placement})):E,R=typeof y=="number"?{mainAxis:y,altAxis:y}:Object.assign({mainAxis:0,altAxis:0},y),P=e.modifiersData.offset?e.modifiersData.offset[e.placement]:null,k={x:0,y:0};if(C){if(s){var W,I=v==="y"?In:Dn,V=v==="y"?ni:ii,z=v==="y"?"height":"width",D=C[v],Y=D+g[I],K=D-g[V],q=f?-x[z]/2:0,le=b===Yo?N[z]:x[z],Z=b===Yo?-x[z]:-N[z],J=e.elements.arrow,_e=f&&J?yE(J):{width:0,height:0},he=e.modifiersData["arrow#persistent"]?e.modifiersData["arrow#persistent"].padding:Nw(),ye=he[I],j=he[V],de=Za(0,N[z],_e[z]),Q=S?N[z]/2-q-de-ye-R.mainAxis:le-de-ye-R.mainAxis,fe=S?-N[z]/2+q+de+j+R.mainAxis:Z+de+j+R.mainAxis,we=e.elements.arrow&&Fl(e.elements.arrow),O=we?v==="y"?we.clientTop||0:we.clientLeft||0:0,F=(W=P==null?void 0:P[v])!=null?W:0,H=D+Q-F-O,se=D+fe-F,te=Za(f?fd(Y,H):Y,D,f?As(K,se):K);C[v]=te,k[v]=te-D}if(a){var be,xe=v==="x"?In:Dn,B=v==="x"?ni:ii,ae=C[T],ne=T==="y"?"height":"width",re=ae+g[xe],w=ae-g[B],A=[In,Dn].indexOf(m)!==-1,G=(be=P==null?void 0:P[T])!=null?be:0,ce=A?re:ae-N[ne]-x[ne]-G+R.altAxis,$=A?ae+N[ne]+x[ne]-G-R.altAxis:w,ee=f&&A?jpt(ce,ae,$):Za(f?ce:re,ae,f?$:w);C[T]=ee,k[T]=ee-ae}e.modifiersData[i]=k}}const Rht={name:"preventOverflow",enabled:!0,phase:"main",fn:Cht,requiresIfExists:["offset"]};function Aht(n){return{scrollLeft:n.scrollLeft,scrollTop:n.scrollTop}}function wht(n){return n===Gn(n)||!ei(n)?TE(n):Aht(n)}function Oht(n){var e=n.getBoundingClientRect(),t=$o(e.width)/n.offsetWidth||1,i=$o(e.height)/n.offsetHeight||1;return t!==1||i!==1}function Nht(n,e,t){t===void 0&&(t=!1);var i=ei(e),r=ei(e)&&Oht(e),s=Qr(e),o=Wo(n,r,t),a={scrollLeft:0,scrollTop:0},l={x:0,y:0};return(i||!i&&!t)&&((Di(e)!=="body"||CE(s))&&(a=wht(e)),ei(e)?(l=Wo(e,!0),l.x+=e.clientLeft,l.y+=e.clientTop):s&&(l.x=xE(s))),{x:o.left+a.scrollLeft-l.x,y:o.top+a.scrollTop-l.y,width:o.width,height:o.height}}function Mht(n){var e=new Map,t=new Set,i=[];n.forEach(function(s){e.set(s.name,s)});function r(s){t.add(s.name);var o=[].concat(s.requires||[],s.requiresIfExists||[]);o.forEach(function(a){if(!t.has(a)){var l=e.get(a);l&&r(l)}}),i.push(s)}return n.forEach(function(s){t.has(s.name)||r(s)}),i}function Iht(n){var e=Mht(n);return Hpt.reduce(function(t,i){return t.concat(e.filter(function(r){return r.phase===i}))},[])}function Dht(n){var e;return function(){return e||(e=new Promise(function(t){Promise.resolve().then(function(){e=void 0,t(n())})})),e}}function Lht(n){var e=n.reduce(function(t,i){var r=t[i.name];return t[i.name]=r?Object.assign({},r,i,{options:Object.assign({},r.options,i.options),data:Object.assign({},r.data,i.data)}):i,t},{});return Object.keys(e).map(function(t){return e[t]})}var gx={placement:"bottom",modifiers:[],strategy:"absolute"};function Ex(){for(var n=arguments.length,e=new Array(n),t=0;t(Gs("data-v-ea1ea661"),n=n(),zs(),n),zht={key:0,class:"fixed top-0 left-0 w-screen h-screen flex items-center justify-center"},Vht={class:"flex flex-col text-center"},Hht={class:"flex flex-col text-center items-center"},qht={class:"flex items-center gap-3 text-5xl drop-shadow-md align-middle pt-24"},Yht=Lt(()=>p("img",{class:"w-24 animate-bounce",title:"LoLLMS WebUI",src:Vo,alt:"Logo"},null,-1)),$ht={class:"flex flex-col items-start"},Wht={class:"text-2xl"},Kht=Lt(()=>p("p",{class:"text-gray-400 text-base"},"One tool to rule them all",-1)),jht=Lt(()=>p("p",{class:"text-gray-400 text-base"},"by ParisNeo",-1)),Qht=Lt(()=>p("hr",{class:"mt-1 w-96 h-1 mx-auto my-2 md:my-2 dark:bg-bg-dark-tone-panel bg-bg-light-tone-panel border-0 rounded"},null,-1)),Xht=Lt(()=>p("p",{class:"text-2xl mb-10"},"Welcome",-1)),Zht={role:"status",class:"text-center w-full display: flex; flex-row align-items: center;"},Jht={class:"text-2xl animate-pulse mt-2"},eft=Lt(()=>p("i",{"data-feather":"chevron-right"},null,-1)),tft=[eft],nft=Lt(()=>p("i",{"data-feather":"chevron-left"},null,-1)),ift=[nft],rft={key:0,class:"relative flex flex-col no-scrollbar shadow-lg min-w-[24rem] max-w-[24rem] bg-bg-light-tone dark:bg-bg-dark-tone"},sft={class:"sticky z-10 top-0 bg-bg-light-tone dark:bg-bg-dark-tone shadow-md"},oft={class:"flex-row p-4 flex items-center gap-3 flex-0"},aft=Lt(()=>p("i",{"data-feather":"plus"},null,-1)),lft=[aft],cft=Lt(()=>p("i",{"data-feather":"check-square"},null,-1)),dft=[cft],uft=Lt(()=>p("button",{class:"text-2xl hover:text-secondary duration-75 active:scale-90",title:"Reset database, remove all discussions"},[p("i",{"data-feather":"refresh-ccw"})],-1)),_ft=Lt(()=>p("i",{"data-feather":"database"},null,-1)),pft=[_ft],hft=Lt(()=>p("i",{"data-feather":"log-in"},null,-1)),fft=[hft],mft={key:0,class:"dropdown"},gft=Lt(()=>p("i",{"data-feather":"search"},null,-1)),Eft=[gft],bft=Lt(()=>p("i",{"data-feather":"save"},null,-1)),Sft=[bft],yft={key:2,class:"flex gap-3 flex-1 items-center duration-75"},vft=Lt(()=>p("i",{"data-feather":"x"},null,-1)),Tft=[vft],xft=Lt(()=>p("i",{"data-feather":"check"},null,-1)),Cft=[xft],Rft=["src"],Aft=["src"],wft=["src"],Oft={key:4,title:"Loading..",class:"flex flex-row flex-grow justify-end"},Nft=Lt(()=>p("div",{role:"status"},[p("svg",{"aria-hidden":"true",class:"w-6 h-6 animate-spin fill-secondary",viewBox:"0 0 100 101",fill:"none",xmlns:"http://www.w3.org/2000/svg"},[p("path",{d:"M100 50.5908C100 78.2051 77.6142 100.591 50 100.591C22.3858 100.591 0 78.2051 0 50.5908C0 22.9766 22.3858 0.59082 50 0.59082C77.6142 0.59082 100 22.9766 100 50.5908ZM9.08144 50.5908C9.08144 73.1895 27.4013 91.5094 50 91.5094C72.5987 91.5094 90.9186 73.1895 90.9186 50.5908C90.9186 27.9921 72.5987 9.67226 50 9.67226C27.4013 9.67226 9.08144 27.9921 9.08144 50.5908Z",fill:"currentColor"}),p("path",{d:"M93.9676 39.0409C96.393 38.4038 97.8624 35.9116 97.0079 33.5539C95.2932 28.8227 92.871 24.3692 89.8167 20.348C85.8452 15.1192 80.8826 10.7238 75.2124 7.41289C69.5422 4.10194 63.2754 1.94025 56.7698 1.05124C51.7666 0.367541 46.6976 0.446843 41.7345 1.27873C39.2613 1.69328 37.813 4.19778 38.4501 6.62326C39.0873 9.04874 41.5694 10.4717 44.0505 10.1071C47.8511 9.54855 51.7191 9.52689 55.5402 10.0491C60.8642 10.7766 65.9928 12.5457 70.6331 15.2552C75.2735 17.9648 79.3347 21.5619 82.5849 25.841C84.9175 28.9121 86.7997 32.2913 88.1811 35.8758C89.083 38.2158 91.5421 39.6781 93.9676 39.0409Z",fill:"currentFill"})]),p("span",{class:"sr-only"},"Loading...")],-1)),Mft=[Nft],Ift={key:0,class:"flex-row items-center gap-3 flex-0 w-full"},Dft={class:"p-4 pt-2"},Lft={class:"relative"},kft=Lt(()=>p("div",{class:"absolute inset-y-0 left-0 flex items-center pl-3 pointer-events-none"},[p("div",{class:"scale-75"},[p("i",{"data-feather":"search"})])],-1)),Pft={class:"absolute inset-y-0 right-0 flex items-center pr-3"},Uft=Lt(()=>p("i",{"data-feather":"x"},null,-1)),Fft=[Uft],Bft={key:1,class:"h-px bg-bg-light p-0 mb-4 px-4 mx-4 border-0 dark:bg-bg-dark"},Gft={key:2,class:"flex flex-row flex-grow p-4 pt-0 items-center"},zft={class:"flex flex-row flex-grow"},Vft={key:0},Hft={class:"flex flex-row"},qft={key:0,class:"flex gap-3"},Yft=Lt(()=>p("i",{"data-feather":"trash"},null,-1)),$ft=[Yft],Wft={key:1,class:"flex gap-3 mx-3 flex-1 items-center justify-end group-hover:visible duration-75"},Kft=Lt(()=>p("i",{"data-feather":"check"},null,-1)),jft=[Kft],Qft=Lt(()=>p("i",{"data-feather":"x"},null,-1)),Xft=[Qft],Zft={class:"flex gap-3"},Jft=Lt(()=>p("i",{"data-feather":"log-out"},null,-1)),emt=[Jft],tmt=Lt(()=>p("i",{"data-feather":"bookmark"},null,-1)),nmt=[tmt],imt=Lt(()=>p("i",{"data-feather":"list"},null,-1)),rmt=[imt],smt={class:"relative flex flex-row flex-grow mb-10 z-0 w-full"},omt={key:1,class:"gap-2 py-2 my-2 hover:shadow-md hover:bg-primary-light dark:hover:bg-primary rounded-md p-2 duration-75 group cursor-pointer"},amt=Lt(()=>p("p",{class:"px-3"},"No discussions are found",-1)),lmt=[amt],cmt=Lt(()=>p("div",{class:"sticky bottom-0 bg-gradient-to-t pointer-events-none from-bg-light-tone dark:from-bg-dark-tone flex flex-grow"},null,-1)),dmt={class:"ml-2"},umt={key:1,class:"relative flex flex-col flex-grow w-full"},_mt={class:"container pt-4 pb-50 mb-50 w-full"},pmt=Lt(()=>p("div",null,[p("br"),p("br"),p("br"),p("br"),p("br"),p("br"),p("br")],-1)),hmt=Lt(()=>p("div",{class:"absolute w-full bottom-0 bg-transparent p-10 pt-16 bg-gradient-to-t from-bg-light dark:from-bg-dark from-5% via-bg-light dark:via-bg-dark via-10% to-transparent to-100%"},null,-1)),fmt={key:0,class:"bottom-0 flex flex-row items-center justify-center"},mmt={role:"status",class:"fixed m-0 p-2 left-2 bottom-2 min-w-[24rem] max-w-[24rem] h-20 flex flex-col justify-center items-center pb-4 bg-blue-500 rounded-lg shadow-lg z-50 background-a"},gmt={class:"text-2xl animate-pulse mt-2 text-white"},Emt={setup(){},data(){return{currentDiscussion:{},host:"",progress_visibility_val:!0,progress_value:0,msgTypes:{MSG_TYPE_CHUNK:0,MSG_TYPE_FULL:1,MSG_TYPE_FULL_INVISIBLE_TO_AI:2,MSG_TYPE_FULL_INVISIBLE_TO_USER:3,MSG_TYPE_EXCEPTION:4,MSG_TYPE_WARNING:5,MSG_TYPE_INFO:6,MSG_TYPE_STEP:7,MSG_TYPE_STEP_START:8,MSG_TYPE_STEP_PROGRESS:9,MSG_TYPE_STEP_END:10,MSG_TYPE_JSON_INFOS:11,MSG_TYPE_REF:12,MSG_TYPE_CODE:13,MSG_TYPE_UI:14,MSG_TYPE_NEW_MESSAGE:15,MSG_TYPE_FINISHED_MESSAGE:17},senderTypes:{SENDER_TYPES_USER:0,SENDER_TYPES_AI:1,SENDER_TYPES_SYSTEM:2},list:[],tempList:[],currentDiscussion:{},discussionArr:[],loading:!1,filterTitle:"",filterInProgress:!1,isCreated:!1,isCheckbox:!1,isSelectAll:!1,showSaveConfirmation:!1,showBrainConfirmation:!1,showConfirmation:!1,chime:new Audio("chime_aud.wav"),showToast:!1,isSearch:!1,isDiscussionBottom:!1,personalityAvatars:[],fileList:[],database_selectorDialogVisible:!1,isDragOverDiscussion:!1,isDragOverChat:!1,panelCollapsed:!1,isOpen:!1,discussion_id:0}},methods:{add_webpage(){console.log("addWebLink received"),this.$refs.web_url_input_box.showPanel()},handleOk(){console.log("OK"),He.on("web_page_added",()=>{Pe.get("/get_current_personality_files_list").then(n=>{this.filesList=n.data.files,console.log("this.filesList",this.filesList),this.isFileSentList=n.data.files.map(e=>!0),console.log(`Files recovered: ${this.filesList}`)})}),He.emit("add_webpage",{url:this.$refs.web_url_input_box.inputText})},show_progress(n){this.progress_visibility_val=!0},hide_progress(n){this.progress_visibility_val=!1},update_progress(n){console.log("Progress update"),this.progress_value=n.value},onSettingsBinding(){try{this.isLoading=!0,Pe.get("/get_active_binding_settings").then(n=>{this.isLoading=!1,n&&(n.data&&Object.keys(n.data).length>0?this.$store.state.universalForm.showForm(n.data,"Binding settings - "+bindingEntry.binding.name,"Save changes","Cancel").then(e=>{try{Pe.post("/set_active_binding_settings",e).then(t=>{t&&t.data?(console.log("binding set with new settings",t.data),this.$store.state.toast.showToast("Binding settings updated successfully!",4,!0)):(this.$store.state.toast.showToast(`Did not get binding settings responses. `+t,4,!1),this.isLoading=!1)})}catch(t){this.$store.state.toast.showToast(`Did not get binding settings responses. Endpoint error: `+t.message,4,!1),this.isLoading=!1}}):(this.$store.state.toast.showToast("Binding has no settings",4,!1),this.isLoading=!1))})}catch(n){this.isLoading=!1,this.$store.state.toast.showToast("Could not open binding settings. Endpoint error: "+n.message,4,!1)}},showDatabaseSelector(){this.database_selectorDialogVisible=!0},async ondatabase_selectorDialogSelected(n){console.log("Selected:",n)},onclosedatabase_selectorDialog(){this.database_selectorDialogVisible=!1},async onvalidatedatabase_selectorChoice(n){if(this.database_selectorDialogVisible=!1,(await Pe.post("/select_database",{name:n})).status){console.log("Selected database"),this.$store.state.config=await Pe.get("/get_config"),console.log("new config loaded :",this.$store.state.config);let t=await Pe.get("/list_databases").data;console.log("New list of database: ",t),this.$store.state.databases=t,console.log("New list of database: ",this.$store.state.databases),location.reload()}},async toggleLTM(){this.$store.state.config.use_discussions_history=!this.$store.state.config.use_discussions_history,await this.applyConfiguration(),He.emit("upgrade_vectorization")},async applyConfiguration(){this.loading=!0;const n=await Pe.post("/apply_settings",{config:this.$store.state.config});this.loading=!1,n.data.status?this.$store.state.toast.showToast("Configuration changed successfully.",4,!0):this.$store.state.toast.showToast("Configuration change failed.",4,!1),Ue(()=>{Ge.replace()})},save_configuration(){this.showConfirmation=!1,Pe.post("/save_settings",{}).then(n=>{if(n)return n.status?this.$store.state.toast.showToast("Settings saved!",4,!0):this.$store.state.messageBox.showMessage("Error: Couldn't save settings!"),n.data}).catch(n=>(console.log(n.message,"save_configuration"),this.$store.state.messageBox.showMessage("Couldn't save settings!"),{status:!1}))},showToastMessage(n,e,t){console.log("sending",n),this.$store.state.toast.showToast(n,e,t)},togglePanel(){this.panelCollapsed=!this.panelCollapsed},toggleDropdown(){this.isOpen=!this.isOpen},importChatGPT(){},async api_get_req(n){try{const e=await Pe.get("/"+n);if(e)return e.data}catch(e){console.log(e.message,"api_get_req");return}},async list_discussions(){try{const n=await Pe.get("/list_discussions");if(n)return this.createDiscussionList(n.data),n.data}catch(n){return console.log("Error: Could not list discussions",n.message),[]}},load_discussion(n,e){n&&(console.log("Loading discussion",n),this.loading=!0,this.discussionArr=[],this.setDiscussionLoading(n,this.loading),He.on("discussion",t=>{this.loading=!1,this.setDiscussionLoading(n,this.loading),t&&(this.discussionArr=t.filter(i=>i.message_type==this.msgTypes.MSG_TYPE_CHUNK||i.message_type==this.msgTypes.MSG_TYPE_FULL||i.message_type==this.msgTypes.MSG_TYPE_FULL_INVISIBLE_TO_AI||i.message_type==this.msgTypes.MSG_TYPE_CODE||i.message_type==this.msgTypes.MSG_TYPE_JSON_INFOS||i.message_type==this.msgTypes.MSG_TYPE_UI),console.log("this.discussionArr"),console.log(this.discussionArr),e&&e()),He.off("discussion")}),He.emit("load_discussion",{id:n}))},recoverFiles(){console.log("Recovering files"),Pe.get("/get_current_personality_files_list").then(n=>{this.$refs.chatBox.filesList=n.data.files,this.$refs.chatBox.isFileSentList=n.data.files.map(e=>!0),console.log(`Files recovered: ${this.$refs.chatBox.filesList}`)})},new_discussion(n){try{this.loading=!0,He.on("discussion_created",e=>{He.off("discussion_created"),this.list_discussions().then(()=>{const t=this.list.findIndex(r=>r.id==e.id),i=this.list[t];this.selectDiscussion(i),this.load_discussion(e.id,()=>{this.loading=!1,Pe.get("/get_current_personality_files_list").then(r=>{console.log("Files recovered"),this.fileList=r.files}),Ue(()=>{const r=document.getElementById("dis-"+e.id);this.scrollToElement(r),console.log("Scrolling tp "+r)})})})}),console.log("new_discussion ",n),He.emit("new_discussion",{title:n})}catch(e){return console.log("Error: Could not create new discussion",e.message),{}}},async delete_discussion(n){try{n&&(this.loading=!0,this.setDiscussionLoading(n,this.loading),await Pe.post("/delete_discussion",{client_id:this.client_id,id:n}),this.loading=!1,this.setDiscussionLoading(n,this.loading))}catch(e){console.log("Error: Could not delete discussion",e.message),this.loading=!1,this.setDiscussionLoading(n,this.loading)}},async edit_title(n,e){try{if(n){this.loading=!0,this.setDiscussionLoading(n,this.loading);const t=await Pe.post("/edit_title",{client_id:this.client_id,id:n,title:e});if(this.loading=!1,this.setDiscussionLoading(n,this.loading),t.status==200){const i=this.list.findIndex(s=>s.id==n),r=this.list[i];r.title=e,this.tempList=this.list}}}catch(t){console.log("Error: Could not edit title",t.message),this.loading=!1,this.setDiscussionLoading(n,this.loading)}},async make_title(n){try{if(n){this.loading=!0,this.setDiscussionLoading(n,this.loading);const e=await Pe.post("/make_title",{client_id:this.client_id,id:n});if(console.log("Making title:",e),this.loading=!1,this.setDiscussionLoading(n,this.loading),e.status==200){const t=this.list.findIndex(r=>r.id==n),i=this.list[t];i.title=e.data.title,this.tempList=this.list}}}catch(e){console.log("Error: Could not edit title",e.message),this.loading=!1,this.setDiscussionLoading(n,this.loading)}},async delete_message(n){try{const e=await Pe.get("/delete_message",{params:{client_id:this.client_id,id:n}});if(e)return e.data}catch(e){return console.log("Error: Could delete message",e.message),{}}},async stop_gen(){try{if(He.emit("cancel_generation"),res)return res.data}catch(n){return console.log("Error: Could not stop generating",n.message),{}}},async message_rank_up(n){try{const e=await Pe.get("/message_rank_up",{params:{client_id:this.client_id,id:n}});if(e)return e.data}catch(e){return console.log("Error: Could not rank up message",e.message),{}}},async message_rank_down(n){try{const e=await Pe.get("/message_rank_down",{params:{client_id:this.client_id,id:n}});if(e)return e.data}catch(e){return console.log("Error: Could not rank down message",e.message),{}}},async edit_message(n,e){try{const t=await Pe.get("/edit_message",{params:{client_id:this.client_id,id:n,message:e}});if(t)return t.data}catch(t){return console.log("Error: Could not update message",t.message),{}}},async export_multiple_discussions(n,e){try{if(n.length>0){const t=await Pe.post("/export_multiple_discussions",{discussion_ids:n,export_format:e});if(t)return t.data}}catch(t){return console.log("Error: Could not export multiple discussions",t.message),{}}},async import_multiple_discussions(n){try{if(n.length>0){console.log("sending import",n);const e=await Pe.post("/import_multiple_discussions",{jArray:n});if(e)return console.log("import response",e.data),e.data}}catch(e){console.log("Error: Could not import multiple discussions",e.message);return}},filterDiscussions(){this.filterInProgress||(this.filterInProgress=!0,setTimeout(()=>{this.filterTitle?this.list=this.tempList.filter(n=>n.title&&n.title.includes(this.filterTitle)):this.list=this.tempList,this.filterInProgress=!1},100))},async selectDiscussion(n){if(this.isGenerating){this.$store.state.toast.showToast("You are currently generating a text. Please wait for text generation to finish or stop it before trying to select another discussion",4,!1);return}n&&(this.currentDiscussion===void 0?(this.currentDiscussion=n,this.setPageTitle(n),localStorage.setItem("selected_discussion",this.currentDiscussion.id),this.load_discussion(n.id,()=>{this.discussionArr.length>1&&(this.currentDiscussion.title===""||this.currentDiscussion.title===null)&&this.changeTitleUsingUserMSG(this.currentDiscussion.id,this.discussionArr[1].content)})):this.currentDiscussion.id!=n.id&&(console.log("item",n),console.log("this.currentDiscussion",this.currentDiscussion),this.currentDiscussion=n,console.log("this.currentDiscussion",this.currentDiscussion),this.setPageTitle(n),localStorage.setItem("selected_discussion",this.currentDiscussion.id),this.load_discussion(n.id,()=>{this.discussionArr.length>1&&(this.currentDiscussion.title===""||this.currentDiscussion.title===null)&&this.changeTitleUsingUserMSG(this.currentDiscussion.id,this.discussionArr[1].content)})),Ue(()=>{const e=document.getElementById("dis-"+this.currentDiscussion.id);this.scrollToElementInContainer(e,"leftPanel");const t=document.getElementById("messages-list");this.scrollBottom(t)}))},scrollToElement(n){n?n.scrollIntoView({behavior:"smooth",block:"start",inline:"nearest"}):console.log("Error: scrollToElement")},scrollToElementInContainer(n,e){try{const t=n.offsetTop;document.getElementById(e).scrollTo({top:t,behavior:"smooth"})}catch{}},scrollBottom(n){n?n.scrollTo({top:n.scrollHeight,behavior:"smooth"}):console.log("Error: scrollBottom")},scrollTop(n){n?n.scrollTo({top:0,behavior:"smooth"}):console.log("Error: scrollTop")},createUserMsg(n){let e={content:n.message,id:n.id,rank:0,sender:n.user,created_at:n.created_at,steps:[],html_js_s:[]};this.discussionArr.push(e),Ue(()=>{const t=document.getElementById("messages-list");this.scrollBottom(t)})},updateLastUserMsg(n){const e=this.discussionArr.indexOf(i=>i.id=n.user_id),t={binding:n.binding,content:n.message,created_at:n.created_at,type:n.type,finished_generating_at:n.finished_generating_at,id:n.user_id,model:n.model,personality:n.personality,sender:n.user,steps:[]};e!==-1&&(this.discussionArr[e]=t)},socketIOConnected(){return console.log("socketIOConnected"),this.$store.state.isConnected=!0,!0},socketIODisconnected(){return console.log("socketIOConnected"),this.currentDiscussion=null,this.$store.dispatch("refreshModels"),this.$store.state.isConnected=!1,!0},new_message(n){console.log("Making a new message"),console.log("New message",n);let e={sender:n.sender,message_type:n.message_type,sender_type:n.sender_type,content:n.content,id:n.id,discussion_id:n.discussion_id,parent_id:n.parent_id,binding:n.binding,model:n.model,personality:n.personality,created_at:n.created_at,finished_generating_at:n.finished_generating_at,rank:0,ui:n.ui,steps:[],parameters:n.parameters,metadata:n.metadata,open:n.open};console.log(e),this.discussionArr.push(e),(this.currentDiscussion.title===""||this.currentDiscussion.title===null)&&this.changeTitleUsingUserMSG(this.currentDiscussion.id,n.message),console.log("infos",n)},talk(n){this.isGenerating=!0,this.setDiscussionLoading(this.currentDiscussion.id,this.isGenerating),Pe.get("/get_generation_status",{}).then(e=>{e&&(e.data.status?console.log("Already generating"):(console.log("Generating message from ",e.data.status),He.emit("generate_msg_from",{id:-1}),this.discussionArr.length>0&&Number(this.discussionArr[this.discussionArr.length-1].id)+1))}).catch(e=>{console.log("Error: Could not get generation status",e)})},createEmptyUserMessage(){He.emit("create_empty_message",{type:0})},createEmptyAIMessage(){He.emit("create_empty_message",{type:1})},sendMsg(n){if(!n){this.$store.state.toast.showToast("Message contains no content!",4,!1);return}this.isGenerating=!0,this.setDiscussionLoading(this.currentDiscussion.id,this.isGenerating),Pe.get("/get_generation_status",{}).then(e=>{if(e)if(e.data.status)console.log("Already generating");else{He.emit("generate_msg",{prompt:n});let t=0;this.discussionArr.length>0&&(t=Number(this.discussionArr[this.discussionArr.length-1].id)+1);let i={message:n,id:t,rank:0,user:this.$store.state.config.user_name,created_at:new Date().toLocaleString(),sender:this.$store.state.config.user_name,message_type:this.msgTypes.MSG_TYPE_FULL,sender_type:this.senderTypes.SENDER_TYPES_USER,content:n,id:t,discussion_id:this.discussion_id,parent_id:t,binding:"",model:"",personality:"",created_at:new Date().toLocaleString(),finished_generating_at:new Date().toLocaleString(),rank:0,steps:[],parameters:null,metadata:[],ui:null};this.createUserMsg(i)}}).catch(e=>{console.log("Error: Could not get generation status",e)})},sendCmd(n){this.isGenerating=!0,He.emit("execute_command",{command:n,parameters:[]})},notify(n){self.isGenerating=!1,this.setDiscussionLoading(this.currentDiscussion.id,this.isGenerating),Ue(()=>{const e=document.getElementById("messages-list");this.scrollBottom(e)}),n.display_type==0?this.$store.state.toast.showToast(n.content,n.duration,n.notification_type):n.display_type==1?this.$store.state.messageBox.showMessage(n.content):n.display_type==2&&this.$store.state.yesNoDialog.askQuestion(n.content,"Yes","Cancel").then(e=>{He.emit("yesNoRes",{yesRes:e})}),this.chime.play()},streamMessageContent(n){if(this.discussion_id=n.discussion_id,this.setDiscussionLoading(this.discussion_id,!0),this.currentDiscussion.id==this.discussion_id){const e=this.discussionArr.findIndex(i=>i.id==n.id),t=this.discussionArr[e];if(t&&(n.message_type==this.msgTypes.MSG_TYPE_FULL||n.message_type==this.msgTypes.MSG_TYPE_FULL_INVISIBLE_TO_AI))t.content=n.content,t.finished_generating_at=n.finished_generating_at;else if(t&&n.message_type==this.msgTypes.MSG_TYPE_CHUNK)t.content+=n.content;else if(n.message_type==this.msgTypes.MSG_TYPE_STEP)t.steps.push({message:n.content,done:!0,status:!0});else if(n.message_type==this.msgTypes.MSG_TYPE_STEP_START)t.steps.push({message:n.content,done:!1,status:!0});else if(n.message_type==this.msgTypes.MSG_TYPE_STEP_END){const i=t.steps.find(r=>r.message===n.content);if(i){i.done=!0;try{console.log(n.parameters);const r=n.parameters;i.status=r.status,console.log(r)}catch(r){console.error("Error parsing JSON:",r.message)}}}else n.message_type==this.msgTypes.MSG_TYPE_JSON_INFOS?(console.log("JSON message"),console.log(n.metadata),t.metadata=n.metadata):n.message_type==this.msgTypes.MSG_TYPE_UI?(console.log("UI message"),t.ui=n.ui,console.log(t.ui)):n.message_type==this.msgTypes.MSG_TYPE_EXCEPTION&&this.$store.state.toast.showToast(n.content,5,!1)}this.$nextTick(()=>{Ge.replace()})},async changeTitleUsingUserMSG(n,e){const t=this.list.findIndex(r=>r.id==n),i=this.list[t];e&&(i.title=e,this.tempList=this.list,await this.edit_title(n,e))},async createNewDiscussion(){this.new_discussion(null)},loadLastUsedDiscussion(){console.log("Loading last discussion");const n=localStorage.getItem("selected_discussion");if(console.log("Last discussion id: ",n),n){const e=this.list.findIndex(i=>i.id==n),t=this.list[e];t&&this.selectDiscussion(t)}},onCopyPersonalityName(n){this.$store.state.toast.showToast("Copied name to clipboard!",4,!0),navigator.clipboard.writeText(n.name)},async deleteDiscussion(n){await this.delete_discussion(n),this.currentDiscussion.id==n&&(this.currentDiscussion={},this.discussionArr=[],this.setPageTitle()),this.list.splice(this.list.findIndex(e=>e.id==n),1),this.createDiscussionList(this.list)},async deleteDiscussionMulti(){const n=this.selectedDiscussions;for(let e=0;ei.id==t.id),1)}this.tempList=this.list,this.isCheckbox=!1,this.$store.state.toast.showToast("Removed ("+n.length+") items",4,!0),this.showConfirmation=!1,console.log("Multi delete done")},async deleteMessage(n){await this.delete_message(n).then(()=>{this.discussionArr.splice(this.discussionArr.findIndex(e=>e.id==n),1)}).catch(()=>{this.$store.state.toast.showToast("Could not remove message",4,!1),console.log("Error: Could not delete message")})},async editTitle(n){const e=this.list.findIndex(i=>i.id==n.id),t=this.list[e];t.title=n.title,t.loading=!0,await this.edit_title(n.id,n.title),t.loading=!1},async makeTitle(n){this.list.findIndex(e=>e.id==n.id),await this.make_title(n.id)},checkUncheckDiscussion(n,e){const t=this.list.findIndex(r=>r.id==e),i=this.list[t];i.checkBoxValue=n.target.checked,this.tempList=this.list},selectAllDiscussions(){this.isSelectAll=!this.tempList.filter(n=>n.checkBoxValue==!1).length>0;for(let n=0;n({id:t.id,title:t.title,selected:!1,loading:!1,checkBoxValue:!1})).sort(function(t,i){return i.id-t.id});this.list=e,this.tempList=e}},setDiscussionLoading(n,e){const t=this.list.findIndex(r=>r.id==n),i=this.list[t];i.loading=e},setPageTitle(n){if(n)if(n.id){const e=n.title?n.title==="untitled"?"New discussion":n.title:"New discussion";document.title="LoLLMS WebUI - "+e}else{const e=n||"Welcome";document.title="LoLLMS WebUI - "+e}else{const e=n||"Welcome";document.title="LoLLMS WebUI - "+e}},async rankUpMessage(n){await this.message_rank_up(n).then(e=>{const t=this.discussionArr[this.discussionArr.findIndex(i=>i.id==n)];t.rank=e.new_rank}).catch(()=>{this.$store.state.toast.showToast("Could not rank up message",4,!1),console.log("Error: Could not rank up message")})},async rankDownMessage(n){await this.message_rank_down(n).then(e=>{const t=this.discussionArr[this.discussionArr.findIndex(i=>i.id==n)];t.rank=e.new_rank}).catch(()=>{this.$store.state.toast.showToast("Could not rank down message",4,!1),console.log("Error: Could not rank down message")})},async updateMessage(n,e){await this.edit_message(n,e).then(()=>{const t=this.discussionArr[this.discussionArr.findIndex(i=>i.id==n)];t.content=e}).catch(()=>{this.$store.state.toast.showToast("Could not update message",4,!1),console.log("Error: Could not update message")})},resendMessage(n,e,t){Ue(()=>{Ge.replace()}),this.isGenerating=!0,this.setDiscussionLoading(this.currentDiscussion.id,this.isGenerating),Pe.get("/get_generation_status",{}).then(i=>{i&&(i.data.status?(this.$store.state.toast.showToast("The server is busy. Wait",4,!1),console.log("Already generating")):He.emit("generate_msg_from",{prompt:e,id:n,msg_type:t}))}).catch(i=>{console.log("Error: Could not get generation status",i)})},continueMessage(n,e){Ue(()=>{Ge.replace()}),this.isGenerating=!0,this.setDiscussionLoading(this.currentDiscussion.id,this.isGenerating),Pe.get("/get_generation_status",{}).then(t=>{t&&(t.data.status?console.log("Already generating"):He.emit("continue_generate_msg_from",{prompt:e,id:n}))}).catch(t=>{console.log("Error: Could not get generation status",t)})},stopGenerating(){this.stop_gen(),this.isGenerating=!1,this.setDiscussionLoading(this.currentDiscussion.id,this.isGenerating),console.log("Stopped generating"),Ue(()=>{const n=document.getElementById("messages-list");this.scrollBottom(n)})},finalMsgEvent(n){if(console.log("final",n),n.parent_id,this.discussion_id=n.discussion_id,this.currentDiscussion.id==this.discussion_id){const e=this.discussionArr.findIndex(t=>t.id==n.id);this.discussionArr[e].content=n.content,this.discussionArr[e].finished_generating_at=n.finished_generating_at}Ue(()=>{const e=document.getElementById("messages-list");this.scrollBottom(e)}),this.isGenerating=!1,this.setDiscussionLoading(this.currentDiscussion.id,this.isGenerating),this.chime.play()},copyToClipBoard(n){this.$store.state.toast.showToast("Copied to clipboard successfully",4,!0);let e="";n.message.binding&&(e=`Binding: ${n.message.binding}`);let t="";n.message.personality&&(t=` Personality: ${n.message.personality}`);let i="";n.created_at_parsed&&(i=` @@ -191,15 +193,15 @@ ${r} ${l}`;navigator.clipboard.writeText(c),Ue(()=>{Ge.replace()})},closeToast(){this.showToast=!1},saveJSONtoFile(n,e){e=e||"data.json";const t=document.createElement("a");t.href=URL.createObjectURL(new Blob([JSON.stringify(n,null,2)],{type:"text/plain"})),t.setAttribute("download",e),document.body.appendChild(t),t.click(),document.body.removeChild(t)},saveMarkdowntoFile(n,e){e=e||"data.md";const t=document.createElement("a");t.href=URL.createObjectURL(new Blob([n],{type:"text/plain"})),t.setAttribute("download",e),document.body.appendChild(t),t.click(),document.body.removeChild(t)},parseJsonObj(n){try{return JSON.parse(n)}catch(e){return this.$store.state.toast.showToast(`Could not parse JSON. `+e.message,4,!1),null}},async parseJsonFile(n){return new Promise((e,t)=>{const i=new FileReader;i.onload=r=>e(this.parseJsonObj(r.target.result)),i.onerror=r=>t(r),i.readAsText(n)})},async exportDiscussionsAsMarkdown(){const n=this.list.filter(e=>e.checkBoxValue==!0).map(e=>e.id);if(n.length>0){console.log("export",n);let e=new Date;const t=e.getFullYear(),i=(e.getMonth()+1).toString().padStart(2,"0"),r=e.getDate().toString().padStart(2,"0"),s=e.getHours().toString().padStart(2,"0"),o=e.getMinutes().toString().padStart(2,"0"),a=e.getSeconds().toString().padStart(2,"0"),c="discussions_export_"+(t+"."+i+"."+r+"."+s+o+a)+".md";this.loading=!0;const d=await this.export_multiple_discussions(n,"markdown");d?(this.saveMarkdowntoFile(d,c),this.$store.state.toast.showToast("Successfully exported",4,!0),this.isCheckbox=!1):this.$store.state.toast.showToast("Failed to export discussions",4,!1),this.loading=!1}},async exportDiscussionsAsJson(){const n=this.list.filter(e=>e.checkBoxValue==!0).map(e=>e.id);if(n.length>0){console.log("export",n);let e=new Date;const t=e.getFullYear(),i=(e.getMonth()+1).toString().padStart(2,"0"),r=e.getDate().toString().padStart(2,"0"),s=e.getHours().toString().padStart(2,"0"),o=e.getMinutes().toString().padStart(2,"0"),a=e.getSeconds().toString().padStart(2,"0"),c="discussions_export_"+(t+"."+i+"."+r+"."+s+o+a)+".json";this.loading=!0;const d=await this.export_multiple_discussions(n,"json");d?(this.saveJSONtoFile(d,c),this.$store.state.toast.showToast("Successfully exported",4,!0),this.isCheckbox=!1):this.$store.state.toast.showToast("Failed to export discussions",4,!1),this.loading=!1}},async importDiscussions(n){const e=await this.parseJsonFile(n.target.files[0]);await this.import_multiple_discussions(e)?(this.$store.state.toast.showToast("Successfully imported ("+e.length+")",4,!0),await this.list_discussions()):this.$store.state.toast.showToast("Failed to import discussions",4,!1)},async getPersonalityAvatars(){for(;this.$store.state.personalities===null;)await new Promise(e=>setTimeout(e,100));let n=this.$store.state.personalities;this.personalityAvatars=n.map(e=>({name:e.name,avatar:e.avatar}))},getAvatar(n){if(n.toLowerCase().trim()==this.$store.state.config.user_name.toLowerCase().trim())return"user_infos/"+this.$store.state.config.user_avatar;const e=this.personalityAvatars.findIndex(i=>i.name===n),t=this.personalityAvatars[e];if(t)return console.log("Avatar",t.avatar),t.avatar},setFileListChat(n){try{this.$refs.chatBox.fileList=this.$refs.chatBox.fileList.concat(n)}catch(e){this.$store.state.toast.showToast(`Failed to set filelist in chatbox -`+e.message,4,!1)}this.isDragOverChat=!1},async setFileListDiscussion(n){if(n.length>1){this.$store.state.toast.showToast("Failed to import discussions. Too many files",4,!1);return}const e=await this.parseJsonFile(n[0]);await this.import_multiple_discussions(e)?(this.$store.state.toast.showToast("Successfully imported ("+e.length+")",4,!0),await this.list_discussions()):this.$store.state.toast.showToast("Failed to import discussions",4,!1),this.isDragOverDiscussion=!1}},async created(){for(this.$nextTick(()=>{Ge.replace()}),He.on("disucssion_renamed",n=>{console.log("Received new title",n.discussion_id,n.title);const e=this.list.findIndex(i=>i.id==n.discussion_id),t=this.list[e];t.title=n.title}),He.onclose=n=>{console.log("WebSocket connection closed:",n.code,n.reason),this.socketIODisconnected()},He.on("connect_error",n=>{n.message==="ERR_CONNECTION_REFUSED"?console.error("Connection refused. The server is not available."):console.error("Connection error:",n),this.$store.state.isConnected=!1}),He.onerror=n=>{console.log("WebSocket connection error:",n.code,n.reason),this.socketIODisconnected(),He.disconnect()},He.on("connected",this.socketIOConnected),He.on("disconnected",this.socketIODisconnected),console.log("Added events"),console.log("Waiting to be ready");this.$store.state.ready===!1;)await new Promise(n=>setTimeout(n,100)),console.log(this.$store.state.ready);console.log("Ready"),this.setPageTitle(),await this.list_discussions(),this.loadLastUsedDiscussion(),He.on("show_progress",this.show_progress),He.on("hide_progress",this.hide_progress),He.on("update_progress",this.update_progress),He.on("notification",this.notify),He.on("new_message",this.new_message),He.on("update_message",this.streamMessageContent),He.on("close_message",this.finalMsgEvent),He.onopen=()=>{console.log("WebSocket connection established."),this.currentDiscussion!=null&&(this.setPageTitle(item),localStorage.setItem("selected_discussion",this.currentDiscussion.id),this.load_discussion(item.id,()=>{this.discussionArr.length>1&&(this.currentDiscussion.title===""||this.currentDiscussion.title===null)&&this.changeTitleUsingUserMSG(this.currentDiscussion.id,this.discussionArr[1].content)}))},this.isCreated=!0},async mounted(){let n="http://localhost:9600/";try{n=await(await fetch("/get_server_address")).text(),n.includes("<")&&(console.log("Server address not found"),n="http://localhost:9600/"),console.log(`Server address: ${n}`)}catch(e){console.error("Error fetching server address:",e),n="http://localhost:9600/"}this.host=`${n}`,Pe.defaults.baseURL=n,this.$nextTick(()=>{Ge.replace()})},async activated(){for(;this.isReady===!1;)await new Promise(n=>setTimeout(n,100));await this.getPersonalityAvatars(),console.log("Avatars found:",this.personalityAvatars),this.isCreated&&Ue(()=>{const n=document.getElementById("messages-list");this.scrollBottom(n)})},components:{Discussion:Yg,Message:bw,ChatBox:Sw,WelcomeComponent:yw,ChoiceDialog:pE,ProgressBar:ml,InputBox:Ew},watch:{progress_visibility_val(n){console.log("progress_visibility changed")},filterTitle(n){n==""&&(this.filterInProgress=!0,this.list=this.tempList,this.filterInProgress=!1)},isCheckbox(n){Ue(()=>{Ge.replace()}),n||(this.isSelectAll=!1)},socketConnected(n){console.log("Websocket connected (watch)",n)},showConfirmation(){Ue(()=>{Ge.replace()})},isSearch(){Ue(()=>{Ge.replace()})}},computed:{progress_visibility:{get(){return self.progress_visibility_val}},version_info:{get(){return this.$store.state.version!=null&&this.$store.state.version!="unknown"?" v"+this.$store.state.version:""}},loading_infos:{get(){return this.$store.state.loading_infos}},loading_progress:{get(){return this.$store.state.loading_progress}},isModelOk:{get(){return this.$store.state.isModelOk},set(n){this.$store.state.isModelOk=n}},isGenerating:{get(){return this.$store.state.isGenerating},set(n){this.$store.state.isGenerating=n}},formatted_database_name(){const n=this.$store.state.config.db_path;return n.slice(0,n.length-3)},UseDiscussionHistory(){return this.$store.state.config.use_discussions_history},isReady:{get(){return this.$store.state.ready}},databases(){return this.$store.state.databases},client_id(){return He.id},isReady(){return console.log("verify ready",this.isCreated),this.isCreated},showPanel(){return this.$store.state.ready&&!this.panelCollapsed},socketConnected(){return console.log(" --- > Websocket connected"),this.$store.commit("setIsConnected",!0),!0},socketDisconnected(){return this.$store.commit("setIsConnected",!1),console.log(" --- > Websocket disconnected"),!0},selectedDiscussions(){return Ue(()=>{Ge.replace()}),this.list.filter(n=>n.checkBoxValue==!0)}}},fmt=Object.assign(hmt,{__name:"DiscussionsView",setup(n){return Rl(()=>{zw()}),Pe.defaults.baseURL="/",(e,t)=>(M(),L(Xe,null,[Le(Po,{name:"fade-and-fly"},{default:dt(()=>[e.isReady?X("",!0):(M(),L("div",Uht,[p("div",Fht,[p("div",Bht,[p("div",Ght,[zht,p("div",Vht,[p("p",Hht,"Lord of Large Language and Multimodal Systems "+me(e.version_info),1),qht,Yht])]),$ht,Wht,p("div",Kht,[Le(ml,{ref:"loading_progress",progress:e.loading_progress},null,8,["progress"]),p("p",jht,me(e.loading_infos)+" ...",1)])])])]))]),_:1}),e.isReady?(M(),L("button",{key:0,onClick:t[0]||(t[0]=(...i)=>e.togglePanel&&e.togglePanel(...i)),class:"absolute top-0 left-0 z-50 p-2 m-2 bg-white rounded-full shadow-md bg-bg-light-tone dark:bg-bg-dark-tone hover:bg-primary-light dark:hover:bg-primary"},[Ae(p("div",null,Xht,512),[[At,e.panelCollapsed]]),Ae(p("div",null,Jht,512),[[At,!e.panelCollapsed]])])):X("",!0),Le(Po,{name:"slide-right"},{default:dt(()=>[e.showPanel?(M(),L("div",eft,[p("div",{id:"leftPanel",class:"flex flex-col flex-grow overflow-y-scroll no-scrollbar",onDragover:t[22]||(t[22]=Oe(i=>e.setDropZoneDiscussion(),["stop","prevent"]))},[p("div",tft,[p("div",nft,[p("button",{class:"text-2xl hover:text-secondary duration-75 active:scale-90",title:"Create new discussion",type:"button",onClick:t[1]||(t[1]=i=>e.createNewDiscussion())},rft),p("button",{class:Ke(["text-2xl hover:text-secondary duration-75 active:scale-90",e.isCheckbox?"text-secondary":""]),title:"Edit discussion list",type:"button",onClick:t[2]||(t[2]=i=>e.isCheckbox=!e.isCheckbox)},oft,2),aft,p("button",{class:"text-2xl hover:text-secondary duration-75 active:scale-90",title:"Export database",type:"button",onClick:t[3]||(t[3]=Oe(i=>e.database_selectorDialogVisible=!0,["stop"]))},cft),p("input",{type:"file",ref:"fileDialog",style:{display:"none"},onChange:t[4]||(t[4]=(...i)=>e.importDiscussions&&e.importDiscussions(...i))},null,544),p("button",{class:"text-2xl hover:text-secondary duration-75 active:scale-90 rotate-90",title:"Import discussions",type:"button",onClick:t[5]||(t[5]=Oe(i=>e.$refs.fileDialog.click(),["stop"]))},uft),e.isOpen?(M(),L("div",_ft,[p("button",{onClick:t[6]||(t[6]=(...i)=>e.importDiscussions&&e.importDiscussions(...i))},"LOLLMS"),p("button",{onClick:t[7]||(t[7]=(...i)=>e.importChatGPT&&e.importChatGPT(...i))},"ChatGPT")])):X("",!0),p("button",{class:Ke(["text-2xl hover:text-secondary duration-75 active:scale-90",e.isSearch?"text-secondary":""]),title:"Filter discussions",type:"button",onClick:t[8]||(t[8]=i=>e.isSearch=!e.isSearch)},hft,2),e.showSaveConfirmation?X("",!0):(M(),L("button",{key:1,title:"Save configuration",class:"text-2xl hover:text-secondary duration-75 active:scale-90",onClick:t[9]||(t[9]=i=>e.showSaveConfirmation=!0)},mft)),e.showSaveConfirmation?(M(),L("div",gft,[p("button",{class:"text-2xl hover:text-red-600 duration-75 active:scale-90",title:"Cancel",type:"button",onClick:t[10]||(t[10]=Oe(i=>e.showSaveConfirmation=!1,["stop"]))},bft),p("button",{class:"text-2xl hover:text-secondary duration-75 active:scale-90",title:"Confirm save changes",type:"button",onClick:t[11]||(t[11]=Oe(i=>e.save_configuration(),["stop"]))},yft)])):X("",!0),e.showBrainConfirmation?X("",!0):(M(),L("button",{key:3,title:"Activate Long term Memory",class:"text-2xl hover:text-secondary duration-75 active:scale-90",onClick:t[12]||(t[12]=i=>e.toggleLTM())},[e.loading?(M(),L("img",{key:0,src:bn(kht),width:"25",height:"25",class:"animate-pulse",title:"Applying config, please stand by..."},null,8,vft)):e.UseDiscussionHistory?(M(),L("img",{key:1,src:bn(Pht),width:"25",height:"25"},null,8,Tft)):(M(),L("img",{key:2,src:bn(Lht),width:"25",height:"25"},null,8,xft))])),e.loading?(M(),L("div",Cft,Aft)):X("",!0)]),e.isSearch?(M(),L("div",wft,[p("div",Oft,[p("div",Nft,[Mft,p("div",Ift,[p("div",{class:Ke(["hover:text-secondary duration-75 active:scale-90",e.filterTitle?"visible":"invisible"]),title:"Clear",onClick:t[13]||(t[13]=i=>e.filterTitle="")},Lft,2)]),Ae(p("input",{type:"search",id:"default-search",class:"block w-full p-2 pl-10 pr-10 text-sm border border-gray-300 rounded-lg bg-bg-light focus:ring-secondary focus:border-secondary dark:bg-bg-dark dark:border-gray-600 dark:placeholder-gray-400 dark:focus:ring-secondary dark:focus:border-secondary",placeholder:"Search...",title:"Filter discussions by title","onUpdate:modelValue":t[14]||(t[14]=i=>e.filterTitle=i),onInput:t[15]||(t[15]=i=>e.filterDiscussions())},null,544),[[Je,e.filterTitle]])])])])):X("",!0),e.isCheckbox?(M(),L("hr",kft)):X("",!0),e.isCheckbox?(M(),L("div",Pft,[p("div",Uft,[e.selectedDiscussions.length>0?(M(),L("p",Fft,"Selected: "+me(e.selectedDiscussions.length),1)):X("",!0)]),p("div",Bft,[e.selectedDiscussions.length>0?(M(),L("div",Gft,[e.showConfirmation?X("",!0):(M(),L("button",{key:0,class:"flex mx-3 flex-1 text-2xl hover:text-red-600 duration-75 active:scale-90",title:"Remove selected",type:"button",onClick:t[16]||(t[16]=Oe(i=>e.showConfirmation=!0,["stop"]))},Vft)),e.showConfirmation?(M(),L("div",Hft,[p("button",{class:"text-2xl hover:text-secondary duration-75 active:scale-90",title:"Confirm removal",type:"button",onClick:t[17]||(t[17]=Oe((...i)=>e.deleteDiscussionMulti&&e.deleteDiscussionMulti(...i),["stop"]))},Yft),p("button",{class:"text-2xl hover:text-red-600 duration-75 active:scale-90",title:"Cancel removal",type:"button",onClick:t[18]||(t[18]=Oe(i=>e.showConfirmation=!1,["stop"]))},Wft)])):X("",!0)])):X("",!0),p("div",Kft,[p("button",{class:"text-2xl hover:text-secondary duration-75 active:scale-90 rotate-90",title:"Export selected to a json file",type:"button",onClick:t[19]||(t[19]=Oe((...i)=>e.exportDiscussionsAsJson&&e.exportDiscussionsAsJson(...i),["stop"]))},Qft),p("button",{class:"text-2xl hover:text-secondary duration-75 active:scale-90 rotate-90",title:"Export selected to a martkdown file",type:"button",onClick:t[20]||(t[20]=Oe((...i)=>e.exportDiscussionsAsMarkdown&&e.exportDiscussionsAsMarkdown(...i),["stop"]))},Zft),p("button",{class:"text-2xl hover:text-secondary duration-75 active:scale-90",title:"Select All",type:"button",onClick:t[21]||(t[21]=Oe((...i)=>e.selectAllDiscussions&&e.selectAllDiscussions(...i),["stop"]))},emt)])])])):X("",!0)]),p("div",tmt,[p("div",{class:Ke(["mx-4 flex flex-col flex-grow w-full",e.isDragOverDiscussion?"pointer-events-none":""])},[p("div",{id:"dis-list",class:Ke([e.filterInProgress?"opacity-20 pointer-events-none":"","flex flex-col flex-grow w-full"])},[e.list.length>0?(M(),Qt(Vr,{key:0,name:"list"},{default:dt(()=>[(M(!0),L(Xe,null,bt(e.list,(i,r)=>(M(),Qt(Yg,{key:i.id,id:i.id,title:i.title,selected:e.currentDiscussion.id==i.id,loading:i.loading,isCheckbox:e.isCheckbox,checkBoxValue:i.checkBoxValue,onSelect:s=>e.selectDiscussion(i),onDelete:s=>e.deleteDiscussion(i.id),onEditTitle:e.editTitle,onMakeTitle:e.makeTitle,onChecked:e.checkUncheckDiscussion},null,8,["id","title","selected","loading","isCheckbox","checkBoxValue","onSelect","onDelete","onEditTitle","onMakeTitle","onChecked"]))),128))]),_:1})):X("",!0),e.list.length<1?(M(),L("div",nmt,rmt)):X("",!0),smt],2)],2)])],32),p("div",{class:"absolute bottom-0 left-0 w-full bg-blue-200 dark:bg-blue-800 text-white py-2 cursor-pointer hover:text-green-500",onClick:t[23]||(t[23]=(...i)=>e.showDatabaseSelector&&e.showDatabaseSelector(...i))},[p("p",omt,"Current database: "+me(e.formatted_database_name),1)])])):X("",!0)]),_:1}),e.isReady?(M(),L("div",amt,[p("div",{id:"messages-list",class:Ke(["w-full z-0 flex flex-col flex-grow overflow-y-auto scrollbar-thin scrollbar-track-bg-light-tone scrollbar-thumb-bg-light-tone-panel hover:scrollbar-thumb-primary dark:scrollbar-track-bg-dark-tone dark:scrollbar-thumb-bg-dark-tone-panel dark:hover:scrollbar-thumb-primary active:scrollbar-thumb-secondary",e.isDragOverChat?"pointer-events-none":""])},[p("div",lmt,[e.discussionArr.length>0?(M(),Qt(Vr,{key:0,name:"list"},{default:dt(()=>[(M(!0),L(Xe,null,bt(e.discussionArr,(i,r)=>(M(),Qt(bw,{key:i.id,message:i,id:"msg-"+i.id,host:e.host,ref_for:!0,ref:"messages",onCopy:e.copyToClipBoard,onDelete:e.deleteMessage,onRankUp:e.rankUpMessage,onRankDown:e.rankDownMessage,onUpdateMessage:e.updateMessage,onResendMessage:e.resendMessage,onContinueMessage:e.continueMessage,avatar:e.getAvatar(i.sender)},null,8,["message","id","host","onCopy","onDelete","onRankUp","onRankDown","onUpdateMessage","onResendMessage","onContinueMessage","avatar"]))),128))]),_:1})):X("",!0),e.currentDiscussion.id?X("",!0):(M(),Qt(yw,{key:1})),cmt]),dmt,e.currentDiscussion.id?(M(),L("div",umt,[Le(Sw,{ref:"chatBox",loading:e.isGenerating,discussionList:e.discussionArr,"on-show-toast-message":e.showToastMessage,"on-talk":e.talk,onPersonalitySelected:e.recoverFiles,onMessageSentEvent:e.sendMsg,onSendCMDEvent:e.sendCmd,onAddWebLink:e.add_webpage,onCreateEmptyUserMessage:e.createEmptyUserMessage,onCreateEmptyAIMessage:e.createEmptyAIMessage,onStopGenerating:e.stopGenerating,onLoaded:e.recoverFiles},null,8,["loading","discussionList","on-show-toast-message","on-talk","onPersonalitySelected","onMessageSentEvent","onSendCMDEvent","onAddWebLink","onCreateEmptyUserMessage","onCreateEmptyAIMessage","onStopGenerating","onLoaded"])])):X("",!0)],2)])):X("",!0),Le(pE,{reference:"database_selector",class:"z-20",show:e.database_selectorDialogVisible,choices:e.databases,onChoiceSelected:e.ondatabase_selectorDialogSelected,onCloseDialog:e.onclosedatabase_selectorDialog,onChoiceValidated:e.onvalidatedatabase_selectorChoice},null,8,["show","choices","onChoiceSelected","onCloseDialog","onChoiceValidated"]),Ae(p("div",_mt,[Le(ml,{ref:"progress",progress:e.progress_value,class:"w-full h-4"},null,8,["progress"]),p("p",pmt,me(e.loading_infos)+" ...",1)],512),[[At,e.progress_visibility]]),Le(Ew,{"prompt-text":"Enter the url to the page to use as discussion support",onOk:e.handleOk,ref:"web_url_input_box"},null,8,["onOk"])],64))}}),mmt=ft(fmt,[["__scopeId","data-v-ea1ea661"]]);/** +`+e.message,4,!1)}this.isDragOverChat=!1},async setFileListDiscussion(n){if(n.length>1){this.$store.state.toast.showToast("Failed to import discussions. Too many files",4,!1);return}const e=await this.parseJsonFile(n[0]);await this.import_multiple_discussions(e)?(this.$store.state.toast.showToast("Successfully imported ("+e.length+")",4,!0),await this.list_discussions()):this.$store.state.toast.showToast("Failed to import discussions",4,!1),this.isDragOverDiscussion=!1}},async created(){for(this.$nextTick(()=>{Ge.replace()}),He.on("disucssion_renamed",n=>{console.log("Received new title",n.discussion_id,n.title);const e=this.list.findIndex(i=>i.id==n.discussion_id),t=this.list[e];t.title=n.title}),He.onclose=n=>{console.log("WebSocket connection closed:",n.code,n.reason),this.socketIODisconnected()},He.on("connect_error",n=>{n.message==="ERR_CONNECTION_REFUSED"?console.error("Connection refused. The server is not available."):console.error("Connection error:",n),this.$store.state.isConnected=!1}),He.onerror=n=>{console.log("WebSocket connection error:",n.code,n.reason),this.socketIODisconnected(),He.disconnect()},He.on("connected",this.socketIOConnected),He.on("disconnected",this.socketIODisconnected),console.log("Added events"),console.log("Waiting to be ready");this.$store.state.ready===!1;)await new Promise(n=>setTimeout(n,100)),console.log(this.$store.state.ready);console.log("Ready"),this.setPageTitle(),await this.list_discussions(),this.loadLastUsedDiscussion(),He.on("show_progress",this.show_progress),He.on("hide_progress",this.hide_progress),He.on("update_progress",this.update_progress),He.on("notification",this.notify),He.on("new_message",this.new_message),He.on("update_message",this.streamMessageContent),He.on("close_message",this.finalMsgEvent),He.onopen=()=>{console.log("WebSocket connection established."),this.currentDiscussion!=null&&(this.setPageTitle(item),localStorage.setItem("selected_discussion",this.currentDiscussion.id),this.load_discussion(item.id,()=>{this.discussionArr.length>1&&(this.currentDiscussion.title===""||this.currentDiscussion.title===null)&&this.changeTitleUsingUserMSG(this.currentDiscussion.id,this.discussionArr[1].content)}))},this.isCreated=!0},async mounted(){let n="http://localhost:9600/";try{n=await(await fetch("/get_server_address")).text(),n.includes("<")&&(console.log("Server address not found"),n="http://localhost:9600/"),console.log(`Server address: ${n}`)}catch(e){console.error("Error fetching server address:",e),n="http://localhost:9600/"}this.host=`${n}`,Pe.defaults.baseURL=n,this.$nextTick(()=>{Ge.replace()})},async activated(){for(;this.isReady===!1;)await new Promise(n=>setTimeout(n,100));await this.getPersonalityAvatars(),console.log("Avatars found:",this.personalityAvatars),this.isCreated&&Ue(()=>{const n=document.getElementById("messages-list");this.scrollBottom(n)})},components:{Discussion:Yg,Message:bw,ChatBox:Sw,WelcomeComponent:yw,ChoiceDialog:pE,ProgressBar:ml,InputBox:Ew},watch:{progress_visibility_val(n){console.log("progress_visibility changed")},filterTitle(n){n==""&&(this.filterInProgress=!0,this.list=this.tempList,this.filterInProgress=!1)},isCheckbox(n){Ue(()=>{Ge.replace()}),n||(this.isSelectAll=!1)},socketConnected(n){console.log("Websocket connected (watch)",n)},showConfirmation(){Ue(()=>{Ge.replace()})},isSearch(){Ue(()=>{Ge.replace()})}},computed:{progress_visibility:{get(){return self.progress_visibility_val}},version_info:{get(){return this.$store.state.version!=null&&this.$store.state.version!="unknown"?" v"+this.$store.state.version:""}},loading_infos:{get(){return this.$store.state.loading_infos}},loading_progress:{get(){return this.$store.state.loading_progress}},isModelOk:{get(){return this.$store.state.isModelOk},set(n){this.$store.state.isModelOk=n}},isGenerating:{get(){return this.$store.state.isGenerating},set(n){this.$store.state.isGenerating=n}},formatted_database_name(){const n=this.$store.state.config.db_path;return n.slice(0,n.length-3)},UseDiscussionHistory(){return this.$store.state.config.use_discussions_history},isReady:{get(){return this.$store.state.ready}},databases(){return this.$store.state.databases},client_id(){return He.id},isReady(){return console.log("verify ready",this.isCreated),this.isCreated},showPanel(){return this.$store.state.ready&&!this.panelCollapsed},socketConnected(){return console.log(" --- > Websocket connected"),this.$store.commit("setIsConnected",!0),!0},socketDisconnected(){return this.$store.commit("setIsConnected",!1),console.log(" --- > Websocket disconnected"),!0},selectedDiscussions(){return Ue(()=>{Ge.replace()}),this.list.filter(n=>n.checkBoxValue==!0)}}},bmt=Object.assign(Emt,{__name:"DiscussionsView",setup(n){return Rl(()=>{zw()}),Pe.defaults.baseURL="/",(e,t)=>(M(),L(Xe,null,[Le(Po,{name:"fade-and-fly"},{default:dt(()=>[e.isReady?X("",!0):(M(),L("div",zht,[p("div",Vht,[p("div",Hht,[p("div",qht,[Yht,p("div",$ht,[p("p",Wht,"Lord of Large Language and Multimodal Systems "+me(e.version_info),1),Kht,jht])]),Qht,Xht,p("div",Zht,[Le(ml,{ref:"loading_progress",progress:e.loading_progress},null,8,["progress"]),p("p",Jht,me(e.loading_infos)+" ...",1)])])])]))]),_:1}),e.isReady?(M(),L("button",{key:0,onClick:t[0]||(t[0]=(...i)=>e.togglePanel&&e.togglePanel(...i)),class:"absolute top-0 left-0 z-50 p-2 m-2 bg-white rounded-full shadow-md bg-bg-light-tone dark:bg-bg-dark-tone hover:bg-primary-light dark:hover:bg-primary"},[Ae(p("div",null,tft,512),[[At,e.panelCollapsed]]),Ae(p("div",null,ift,512),[[At,!e.panelCollapsed]])])):X("",!0),Le(Po,{name:"slide-right"},{default:dt(()=>[e.showPanel?(M(),L("div",rft,[p("div",{id:"leftPanel",class:"flex flex-col flex-grow overflow-y-scroll no-scrollbar",onDragover:t[22]||(t[22]=Oe(i=>e.setDropZoneDiscussion(),["stop","prevent"]))},[p("div",sft,[p("div",oft,[p("button",{class:"text-2xl hover:text-secondary duration-75 active:scale-90",title:"Create new discussion",type:"button",onClick:t[1]||(t[1]=i=>e.createNewDiscussion())},lft),p("button",{class:Ke(["text-2xl hover:text-secondary duration-75 active:scale-90",e.isCheckbox?"text-secondary":""]),title:"Edit discussion list",type:"button",onClick:t[2]||(t[2]=i=>e.isCheckbox=!e.isCheckbox)},dft,2),uft,p("button",{class:"text-2xl hover:text-secondary duration-75 active:scale-90",title:"Export database",type:"button",onClick:t[3]||(t[3]=Oe(i=>e.database_selectorDialogVisible=!0,["stop"]))},pft),p("input",{type:"file",ref:"fileDialog",style:{display:"none"},onChange:t[4]||(t[4]=(...i)=>e.importDiscussions&&e.importDiscussions(...i))},null,544),p("button",{class:"text-2xl hover:text-secondary duration-75 active:scale-90 rotate-90",title:"Import discussions",type:"button",onClick:t[5]||(t[5]=Oe(i=>e.$refs.fileDialog.click(),["stop"]))},fft),e.isOpen?(M(),L("div",mft,[p("button",{onClick:t[6]||(t[6]=(...i)=>e.importDiscussions&&e.importDiscussions(...i))},"LOLLMS"),p("button",{onClick:t[7]||(t[7]=(...i)=>e.importChatGPT&&e.importChatGPT(...i))},"ChatGPT")])):X("",!0),p("button",{class:Ke(["text-2xl hover:text-secondary duration-75 active:scale-90",e.isSearch?"text-secondary":""]),title:"Filter discussions",type:"button",onClick:t[8]||(t[8]=i=>e.isSearch=!e.isSearch)},Eft,2),e.showSaveConfirmation?X("",!0):(M(),L("button",{key:1,title:"Save configuration",class:"text-2xl hover:text-secondary duration-75 active:scale-90",onClick:t[9]||(t[9]=i=>e.showSaveConfirmation=!0)},Sft)),e.showSaveConfirmation?(M(),L("div",yft,[p("button",{class:"text-2xl hover:text-red-600 duration-75 active:scale-90",title:"Cancel",type:"button",onClick:t[10]||(t[10]=Oe(i=>e.showSaveConfirmation=!1,["stop"]))},Tft),p("button",{class:"text-2xl hover:text-secondary duration-75 active:scale-90",title:"Confirm save changes",type:"button",onClick:t[11]||(t[11]=Oe(i=>e.save_configuration(),["stop"]))},Cft)])):X("",!0),e.showBrainConfirmation?X("",!0):(M(),L("button",{key:3,title:"Activate Long term Memory",class:"text-2xl hover:text-secondary duration-75 active:scale-90",onClick:t[12]||(t[12]=i=>e.toggleLTM())},[e.loading?(M(),L("img",{key:0,src:bn(Bht),width:"25",height:"25",class:"animate-pulse",title:"Applying config, please stand by..."},null,8,Rft)):e.UseDiscussionHistory?(M(),L("img",{key:1,src:bn(Ght),width:"25",height:"25"},null,8,Aft)):(M(),L("img",{key:2,src:bn(Fht),width:"25",height:"25"},null,8,wft))])),e.loading?(M(),L("div",Oft,Mft)):X("",!0)]),e.isSearch?(M(),L("div",Ift,[p("div",Dft,[p("div",Lft,[kft,p("div",Pft,[p("div",{class:Ke(["hover:text-secondary duration-75 active:scale-90",e.filterTitle?"visible":"invisible"]),title:"Clear",onClick:t[13]||(t[13]=i=>e.filterTitle="")},Fft,2)]),Ae(p("input",{type:"search",id:"default-search",class:"block w-full p-2 pl-10 pr-10 text-sm border border-gray-300 rounded-lg bg-bg-light focus:ring-secondary focus:border-secondary dark:bg-bg-dark dark:border-gray-600 dark:placeholder-gray-400 dark:focus:ring-secondary dark:focus:border-secondary",placeholder:"Search...",title:"Filter discussions by title","onUpdate:modelValue":t[14]||(t[14]=i=>e.filterTitle=i),onInput:t[15]||(t[15]=i=>e.filterDiscussions())},null,544),[[Je,e.filterTitle]])])])])):X("",!0),e.isCheckbox?(M(),L("hr",Bft)):X("",!0),e.isCheckbox?(M(),L("div",Gft,[p("div",zft,[e.selectedDiscussions.length>0?(M(),L("p",Vft,"Selected: "+me(e.selectedDiscussions.length),1)):X("",!0)]),p("div",Hft,[e.selectedDiscussions.length>0?(M(),L("div",qft,[e.showConfirmation?X("",!0):(M(),L("button",{key:0,class:"flex mx-3 flex-1 text-2xl hover:text-red-600 duration-75 active:scale-90",title:"Remove selected",type:"button",onClick:t[16]||(t[16]=Oe(i=>e.showConfirmation=!0,["stop"]))},$ft)),e.showConfirmation?(M(),L("div",Wft,[p("button",{class:"text-2xl hover:text-secondary duration-75 active:scale-90",title:"Confirm removal",type:"button",onClick:t[17]||(t[17]=Oe((...i)=>e.deleteDiscussionMulti&&e.deleteDiscussionMulti(...i),["stop"]))},jft),p("button",{class:"text-2xl hover:text-red-600 duration-75 active:scale-90",title:"Cancel removal",type:"button",onClick:t[18]||(t[18]=Oe(i=>e.showConfirmation=!1,["stop"]))},Xft)])):X("",!0)])):X("",!0),p("div",Zft,[p("button",{class:"text-2xl hover:text-secondary duration-75 active:scale-90 rotate-90",title:"Export selected to a json file",type:"button",onClick:t[19]||(t[19]=Oe((...i)=>e.exportDiscussionsAsJson&&e.exportDiscussionsAsJson(...i),["stop"]))},emt),p("button",{class:"text-2xl hover:text-secondary duration-75 active:scale-90 rotate-90",title:"Export selected to a martkdown file",type:"button",onClick:t[20]||(t[20]=Oe((...i)=>e.exportDiscussionsAsMarkdown&&e.exportDiscussionsAsMarkdown(...i),["stop"]))},nmt),p("button",{class:"text-2xl hover:text-secondary duration-75 active:scale-90",title:"Select All",type:"button",onClick:t[21]||(t[21]=Oe((...i)=>e.selectAllDiscussions&&e.selectAllDiscussions(...i),["stop"]))},rmt)])])])):X("",!0)]),p("div",smt,[p("div",{class:Ke(["mx-4 flex flex-col flex-grow w-full",e.isDragOverDiscussion?"pointer-events-none":""])},[p("div",{id:"dis-list",class:Ke([e.filterInProgress?"opacity-20 pointer-events-none":"","flex flex-col flex-grow w-full"])},[e.list.length>0?(M(),Qt(Vr,{key:0,name:"list"},{default:dt(()=>[(M(!0),L(Xe,null,bt(e.list,(i,r)=>(M(),Qt(Yg,{key:i.id,id:i.id,title:i.title,selected:e.currentDiscussion.id==i.id,loading:i.loading,isCheckbox:e.isCheckbox,checkBoxValue:i.checkBoxValue,onSelect:s=>e.selectDiscussion(i),onDelete:s=>e.deleteDiscussion(i.id),onEditTitle:e.editTitle,onMakeTitle:e.makeTitle,onChecked:e.checkUncheckDiscussion},null,8,["id","title","selected","loading","isCheckbox","checkBoxValue","onSelect","onDelete","onEditTitle","onMakeTitle","onChecked"]))),128))]),_:1})):X("",!0),e.list.length<1?(M(),L("div",omt,lmt)):X("",!0),cmt],2)],2)])],32),p("div",{class:"absolute bottom-0 left-0 w-full bg-blue-200 dark:bg-blue-800 text-white py-2 cursor-pointer hover:text-green-500",onClick:t[23]||(t[23]=(...i)=>e.showDatabaseSelector&&e.showDatabaseSelector(...i))},[p("p",dmt,"Current database: "+me(e.formatted_database_name),1)])])):X("",!0)]),_:1}),e.isReady?(M(),L("div",umt,[p("div",{id:"messages-list",class:Ke(["w-full z-0 flex flex-col flex-grow overflow-y-auto scrollbar-thin scrollbar-track-bg-light-tone scrollbar-thumb-bg-light-tone-panel hover:scrollbar-thumb-primary dark:scrollbar-track-bg-dark-tone dark:scrollbar-thumb-bg-dark-tone-panel dark:hover:scrollbar-thumb-primary active:scrollbar-thumb-secondary",e.isDragOverChat?"pointer-events-none":""])},[p("div",_mt,[e.discussionArr.length>0?(M(),Qt(Vr,{key:0,name:"list"},{default:dt(()=>[(M(!0),L(Xe,null,bt(e.discussionArr,(i,r)=>(M(),Qt(bw,{key:i.id,message:i,id:"msg-"+i.id,host:e.host,ref_for:!0,ref:"messages",onCopy:e.copyToClipBoard,onDelete:e.deleteMessage,onRankUp:e.rankUpMessage,onRankDown:e.rankDownMessage,onUpdateMessage:e.updateMessage,onResendMessage:e.resendMessage,onContinueMessage:e.continueMessage,avatar:e.getAvatar(i.sender)},null,8,["message","id","host","onCopy","onDelete","onRankUp","onRankDown","onUpdateMessage","onResendMessage","onContinueMessage","avatar"]))),128))]),_:1})):X("",!0),e.currentDiscussion.id?X("",!0):(M(),Qt(yw,{key:1})),pmt]),hmt,e.currentDiscussion.id?(M(),L("div",fmt,[Le(Sw,{ref:"chatBox",loading:e.isGenerating,discussionList:e.discussionArr,"on-show-toast-message":e.showToastMessage,"on-talk":e.talk,onPersonalitySelected:e.recoverFiles,onMessageSentEvent:e.sendMsg,onSendCMDEvent:e.sendCmd,onAddWebLink:e.add_webpage,onCreateEmptyUserMessage:e.createEmptyUserMessage,onCreateEmptyAIMessage:e.createEmptyAIMessage,onStopGenerating:e.stopGenerating,onLoaded:e.recoverFiles},null,8,["loading","discussionList","on-show-toast-message","on-talk","onPersonalitySelected","onMessageSentEvent","onSendCMDEvent","onAddWebLink","onCreateEmptyUserMessage","onCreateEmptyAIMessage","onStopGenerating","onLoaded"])])):X("",!0)],2)])):X("",!0),Le(pE,{reference:"database_selector",class:"z-20",show:e.database_selectorDialogVisible,choices:e.databases,onChoiceSelected:e.ondatabase_selectorDialogSelected,onCloseDialog:e.onclosedatabase_selectorDialog,onChoiceValidated:e.onvalidatedatabase_selectorChoice},null,8,["show","choices","onChoiceSelected","onCloseDialog","onChoiceValidated"]),Ae(p("div",mmt,[Le(ml,{ref:"progress",progress:e.progress_value,class:"w-full h-4"},null,8,["progress"]),p("p",gmt,me(e.loading_infos)+" ...",1)],512),[[At,e.progress_visibility]]),Le(Ew,{"prompt-text":"Enter the url to the page to use as discussion support",onOk:e.handleOk,ref:"web_url_input_box"},null,8,["onOk"])],64))}}),Smt=ft(bmt,[["__scopeId","data-v-ea1ea661"]]);/** * @license * Copyright 2010-2023 Three.js Authors * SPDX-License-Identifier: MIT - */const LE="159",gmt=0,Sx=1,Emt=2,Vw=1,bmt=2,Zi=3,cr=0,Ln=1,xi=2,Hr=0,No=1,yx=2,vx=3,Tx=4,Smt=5,bs=100,ymt=101,vmt=102,xx=103,Cx=104,Tmt=200,xmt=201,Cmt=202,Rmt=203,jm=204,Qm=205,Amt=206,wmt=207,Omt=208,Nmt=209,Mmt=210,Imt=211,Dmt=212,Lmt=213,kmt=214,Pmt=0,Umt=1,Fmt=2,yd=3,Bmt=4,Gmt=5,zmt=6,Vmt=7,kE=0,Hmt=1,qmt=2,qr=0,Ymt=1,$mt=2,Wmt=3,Kmt=4,jmt=5,Rx="attached",Qmt="detached",Hw=300,jo=301,Qo=302,Xm=303,Zm=304,ou=306,Xo=1e3,Kn=1001,vd=1002,an=1003,Jm=1004,Qc=1005,Mn=1006,qw=1007,ks=1008,Yr=1009,Xmt=1010,Zmt=1011,PE=1012,Yw=1013,Ur=1014,tr=1015,vl=1016,$w=1017,Ww=1018,ws=1020,Jmt=1021,jn=1023,egt=1024,tgt=1025,Os=1026,Zo=1027,ngt=1028,Kw=1029,igt=1030,jw=1031,Qw=1033,wf=33776,Of=33777,Nf=33778,Mf=33779,Ax=35840,wx=35841,Ox=35842,Nx=35843,Xw=36196,Mx=37492,Ix=37496,Dx=37808,Lx=37809,kx=37810,Px=37811,Ux=37812,Fx=37813,Bx=37814,Gx=37815,zx=37816,Vx=37817,Hx=37818,qx=37819,Yx=37820,$x=37821,If=36492,Wx=36494,Kx=36495,rgt=36283,jx=36284,Qx=36285,Xx=36286,Tl=2300,Jo=2301,Df=2302,Zx=2400,Jx=2401,eC=2402,sgt=2500,ogt=0,Zw=1,eg=2,Jw=3e3,Ns=3001,agt=3200,lgt=3201,UE=0,cgt=1,Qn="",Kt="srgb",hn="srgb-linear",FE="display-p3",au="display-p3-linear",Td="linear",Gt="srgb",xd="rec709",Cd="p3",Js=7680,tC=519,dgt=512,ugt=513,_gt=514,eO=515,pgt=516,hgt=517,fgt=518,mgt=519,tg=35044,nC="300 es",ng=1035,nr=2e3,Rd=2001;class fa{addEventListener(e,t){this._listeners===void 0&&(this._listeners={});const i=this._listeners;i[e]===void 0&&(i[e]=[]),i[e].indexOf(t)===-1&&i[e].push(t)}hasEventListener(e,t){if(this._listeners===void 0)return!1;const i=this._listeners;return i[e]!==void 0&&i[e].indexOf(t)!==-1}removeEventListener(e,t){if(this._listeners===void 0)return;const r=this._listeners[e];if(r!==void 0){const s=r.indexOf(t);s!==-1&&r.splice(s,1)}}dispatchEvent(e){if(this._listeners===void 0)return;const i=this._listeners[e.type];if(i!==void 0){e.target=this;const r=i.slice(0);for(let s=0,o=r.length;s>8&255]+mn[n>>16&255]+mn[n>>24&255]+"-"+mn[e&255]+mn[e>>8&255]+"-"+mn[e>>16&15|64]+mn[e>>24&255]+"-"+mn[t&63|128]+mn[t>>8&255]+"-"+mn[t>>16&255]+mn[t>>24&255]+mn[i&255]+mn[i>>8&255]+mn[i>>16&255]+mn[i>>24&255]).toLowerCase()}function En(n,e,t){return Math.max(e,Math.min(t,n))}function BE(n,e){return(n%e+e)%e}function ggt(n,e,t,i,r){return i+(n-e)*(r-i)/(t-e)}function Egt(n,e,t){return n!==e?(t-n)/(e-n):0}function nl(n,e,t){return(1-t)*n+t*e}function bgt(n,e,t,i){return nl(n,e,1-Math.exp(-t*i))}function Sgt(n,e=1){return e-Math.abs(BE(n,e*2)-e)}function ygt(n,e,t){return n<=e?0:n>=t?1:(n=(n-e)/(t-e),n*n*(3-2*n))}function vgt(n,e,t){return n<=e?0:n>=t?1:(n=(n-e)/(t-e),n*n*n*(n*(n*6-15)+10))}function Tgt(n,e){return n+Math.floor(Math.random()*(e-n+1))}function xgt(n,e){return n+Math.random()*(e-n)}function Cgt(n){return n*(.5-Math.random())}function Rgt(n){n!==void 0&&(iC=n);let e=iC+=1831565813;return e=Math.imul(e^e>>>15,e|1),e^=e+Math.imul(e^e>>>7,e|61),((e^e>>>14)>>>0)/4294967296}function Agt(n){return n*tl}function wgt(n){return n*ea}function ig(n){return(n&n-1)===0&&n!==0}function Ogt(n){return Math.pow(2,Math.ceil(Math.log(n)/Math.LN2))}function Ad(n){return Math.pow(2,Math.floor(Math.log(n)/Math.LN2))}function Ngt(n,e,t,i,r){const s=Math.cos,o=Math.sin,a=s(t/2),l=o(t/2),c=s((e+i)/2),d=o((e+i)/2),u=s((e-i)/2),_=o((e-i)/2),f=s((i-e)/2),h=o((i-e)/2);switch(r){case"XYX":n.set(a*d,l*u,l*_,a*c);break;case"YZY":n.set(l*_,a*d,l*u,a*c);break;case"ZXZ":n.set(l*u,l*_,a*d,a*c);break;case"XZX":n.set(a*d,l*h,l*f,a*c);break;case"YXY":n.set(l*f,a*d,l*h,a*c);break;case"ZYZ":n.set(l*h,l*f,a*d,a*c);break;default:console.warn("THREE.MathUtils: .setQuaternionFromProperEuler() encountered an unknown order: "+r)}}function Ci(n,e){switch(e.constructor){case Float32Array:return n;case Uint32Array:return n/4294967295;case Uint16Array:return n/65535;case Uint8Array:return n/255;case Int32Array:return Math.max(n/2147483647,-1);case Int16Array:return Math.max(n/32767,-1);case Int8Array:return Math.max(n/127,-1);default:throw new Error("Invalid component type.")}}function kt(n,e){switch(e.constructor){case Float32Array:return n;case Uint32Array:return Math.round(n*4294967295);case Uint16Array:return Math.round(n*65535);case Uint8Array:return Math.round(n*255);case Int32Array:return Math.round(n*2147483647);case Int16Array:return Math.round(n*32767);case Int8Array:return Math.round(n*127);default:throw new Error("Invalid component type.")}}const Mgt={DEG2RAD:tl,RAD2DEG:ea,generateUUID:fi,clamp:En,euclideanModulo:BE,mapLinear:ggt,inverseLerp:Egt,lerp:nl,damp:bgt,pingpong:Sgt,smoothstep:ygt,smootherstep:vgt,randInt:Tgt,randFloat:xgt,randFloatSpread:Cgt,seededRandom:Rgt,degToRad:Agt,radToDeg:wgt,isPowerOfTwo:ig,ceilPowerOfTwo:Ogt,floorPowerOfTwo:Ad,setQuaternionFromProperEuler:Ngt,normalize:kt,denormalize:Ci};class vt{constructor(e=0,t=0){vt.prototype.isVector2=!0,this.x=e,this.y=t}get width(){return this.x}set width(e){this.x=e}get height(){return this.y}set height(e){this.y=e}set(e,t){return this.x=e,this.y=t,this}setScalar(e){return this.x=e,this.y=e,this}setX(e){return this.x=e,this}setY(e){return this.y=e,this}setComponent(e,t){switch(e){case 0:this.x=t;break;case 1:this.y=t;break;default:throw new Error("index is out of range: "+e)}return this}getComponent(e){switch(e){case 0:return this.x;case 1:return this.y;default:throw new Error("index is out of range: "+e)}}clone(){return new this.constructor(this.x,this.y)}copy(e){return this.x=e.x,this.y=e.y,this}add(e){return this.x+=e.x,this.y+=e.y,this}addScalar(e){return this.x+=e,this.y+=e,this}addVectors(e,t){return this.x=e.x+t.x,this.y=e.y+t.y,this}addScaledVector(e,t){return this.x+=e.x*t,this.y+=e.y*t,this}sub(e){return this.x-=e.x,this.y-=e.y,this}subScalar(e){return this.x-=e,this.y-=e,this}subVectors(e,t){return this.x=e.x-t.x,this.y=e.y-t.y,this}multiply(e){return this.x*=e.x,this.y*=e.y,this}multiplyScalar(e){return this.x*=e,this.y*=e,this}divide(e){return this.x/=e.x,this.y/=e.y,this}divideScalar(e){return this.multiplyScalar(1/e)}applyMatrix3(e){const t=this.x,i=this.y,r=e.elements;return this.x=r[0]*t+r[3]*i+r[6],this.y=r[1]*t+r[4]*i+r[7],this}min(e){return this.x=Math.min(this.x,e.x),this.y=Math.min(this.y,e.y),this}max(e){return this.x=Math.max(this.x,e.x),this.y=Math.max(this.y,e.y),this}clamp(e,t){return this.x=Math.max(e.x,Math.min(t.x,this.x)),this.y=Math.max(e.y,Math.min(t.y,this.y)),this}clampScalar(e,t){return this.x=Math.max(e,Math.min(t,this.x)),this.y=Math.max(e,Math.min(t,this.y)),this}clampLength(e,t){const i=this.length();return this.divideScalar(i||1).multiplyScalar(Math.max(e,Math.min(t,i)))}floor(){return this.x=Math.floor(this.x),this.y=Math.floor(this.y),this}ceil(){return this.x=Math.ceil(this.x),this.y=Math.ceil(this.y),this}round(){return this.x=Math.round(this.x),this.y=Math.round(this.y),this}roundToZero(){return this.x=Math.trunc(this.x),this.y=Math.trunc(this.y),this}negate(){return this.x=-this.x,this.y=-this.y,this}dot(e){return this.x*e.x+this.y*e.y}cross(e){return this.x*e.y-this.y*e.x}lengthSq(){return this.x*this.x+this.y*this.y}length(){return Math.sqrt(this.x*this.x+this.y*this.y)}manhattanLength(){return Math.abs(this.x)+Math.abs(this.y)}normalize(){return this.divideScalar(this.length()||1)}angle(){return Math.atan2(-this.y,-this.x)+Math.PI}angleTo(e){const t=Math.sqrt(this.lengthSq()*e.lengthSq());if(t===0)return Math.PI/2;const i=this.dot(e)/t;return Math.acos(En(i,-1,1))}distanceTo(e){return Math.sqrt(this.distanceToSquared(e))}distanceToSquared(e){const t=this.x-e.x,i=this.y-e.y;return t*t+i*i}manhattanDistanceTo(e){return Math.abs(this.x-e.x)+Math.abs(this.y-e.y)}setLength(e){return this.normalize().multiplyScalar(e)}lerp(e,t){return this.x+=(e.x-this.x)*t,this.y+=(e.y-this.y)*t,this}lerpVectors(e,t,i){return this.x=e.x+(t.x-e.x)*i,this.y=e.y+(t.y-e.y)*i,this}equals(e){return e.x===this.x&&e.y===this.y}fromArray(e,t=0){return this.x=e[t],this.y=e[t+1],this}toArray(e=[],t=0){return e[t]=this.x,e[t+1]=this.y,e}fromBufferAttribute(e,t){return this.x=e.getX(t),this.y=e.getY(t),this}rotateAround(e,t){const i=Math.cos(t),r=Math.sin(t),s=this.x-e.x,o=this.y-e.y;return this.x=s*i-o*r+e.x,this.y=s*r+o*i+e.y,this}random(){return this.x=Math.random(),this.y=Math.random(),this}*[Symbol.iterator](){yield this.x,yield this.y}}class mt{constructor(e,t,i,r,s,o,a,l,c){mt.prototype.isMatrix3=!0,this.elements=[1,0,0,0,1,0,0,0,1],e!==void 0&&this.set(e,t,i,r,s,o,a,l,c)}set(e,t,i,r,s,o,a,l,c){const d=this.elements;return d[0]=e,d[1]=r,d[2]=a,d[3]=t,d[4]=s,d[5]=l,d[6]=i,d[7]=o,d[8]=c,this}identity(){return this.set(1,0,0,0,1,0,0,0,1),this}copy(e){const t=this.elements,i=e.elements;return t[0]=i[0],t[1]=i[1],t[2]=i[2],t[3]=i[3],t[4]=i[4],t[5]=i[5],t[6]=i[6],t[7]=i[7],t[8]=i[8],this}extractBasis(e,t,i){return e.setFromMatrix3Column(this,0),t.setFromMatrix3Column(this,1),i.setFromMatrix3Column(this,2),this}setFromMatrix4(e){const t=e.elements;return this.set(t[0],t[4],t[8],t[1],t[5],t[9],t[2],t[6],t[10]),this}multiply(e){return this.multiplyMatrices(this,e)}premultiply(e){return this.multiplyMatrices(e,this)}multiplyMatrices(e,t){const i=e.elements,r=t.elements,s=this.elements,o=i[0],a=i[3],l=i[6],c=i[1],d=i[4],u=i[7],_=i[2],f=i[5],h=i[8],E=r[0],g=r[3],m=r[6],b=r[1],S=r[4],v=r[7],T=r[2],C=r[5],N=r[8];return s[0]=o*E+a*b+l*T,s[3]=o*g+a*S+l*C,s[6]=o*m+a*v+l*N,s[1]=c*E+d*b+u*T,s[4]=c*g+d*S+u*C,s[7]=c*m+d*v+u*N,s[2]=_*E+f*b+h*T,s[5]=_*g+f*S+h*C,s[8]=_*m+f*v+h*N,this}multiplyScalar(e){const t=this.elements;return t[0]*=e,t[3]*=e,t[6]*=e,t[1]*=e,t[4]*=e,t[7]*=e,t[2]*=e,t[5]*=e,t[8]*=e,this}determinant(){const e=this.elements,t=e[0],i=e[1],r=e[2],s=e[3],o=e[4],a=e[5],l=e[6],c=e[7],d=e[8];return t*o*d-t*a*c-i*s*d+i*a*l+r*s*c-r*o*l}invert(){const e=this.elements,t=e[0],i=e[1],r=e[2],s=e[3],o=e[4],a=e[5],l=e[6],c=e[7],d=e[8],u=d*o-a*c,_=a*l-d*s,f=c*s-o*l,h=t*u+i*_+r*f;if(h===0)return this.set(0,0,0,0,0,0,0,0,0);const E=1/h;return e[0]=u*E,e[1]=(r*c-d*i)*E,e[2]=(a*i-r*o)*E,e[3]=_*E,e[4]=(d*t-r*l)*E,e[5]=(r*s-a*t)*E,e[6]=f*E,e[7]=(i*l-c*t)*E,e[8]=(o*t-i*s)*E,this}transpose(){let e;const t=this.elements;return e=t[1],t[1]=t[3],t[3]=e,e=t[2],t[2]=t[6],t[6]=e,e=t[5],t[5]=t[7],t[7]=e,this}getNormalMatrix(e){return this.setFromMatrix4(e).invert().transpose()}transposeIntoArray(e){const t=this.elements;return e[0]=t[0],e[1]=t[3],e[2]=t[6],e[3]=t[1],e[4]=t[4],e[5]=t[7],e[6]=t[2],e[7]=t[5],e[8]=t[8],this}setUvTransform(e,t,i,r,s,o,a){const l=Math.cos(s),c=Math.sin(s);return this.set(i*l,i*c,-i*(l*o+c*a)+o+e,-r*c,r*l,-r*(-c*o+l*a)+a+t,0,0,1),this}scale(e,t){return this.premultiply(Lf.makeScale(e,t)),this}rotate(e){return this.premultiply(Lf.makeRotation(-e)),this}translate(e,t){return this.premultiply(Lf.makeTranslation(e,t)),this}makeTranslation(e,t){return e.isVector2?this.set(1,0,e.x,0,1,e.y,0,0,1):this.set(1,0,e,0,1,t,0,0,1),this}makeRotation(e){const t=Math.cos(e),i=Math.sin(e);return this.set(t,-i,0,i,t,0,0,0,1),this}makeScale(e,t){return this.set(e,0,0,0,t,0,0,0,1),this}equals(e){const t=this.elements,i=e.elements;for(let r=0;r<9;r++)if(t[r]!==i[r])return!1;return!0}fromArray(e,t=0){for(let i=0;i<9;i++)this.elements[i]=e[i+t];return this}toArray(e=[],t=0){const i=this.elements;return e[t]=i[0],e[t+1]=i[1],e[t+2]=i[2],e[t+3]=i[3],e[t+4]=i[4],e[t+5]=i[5],e[t+6]=i[6],e[t+7]=i[7],e[t+8]=i[8],e}clone(){return new this.constructor().fromArray(this.elements)}}const Lf=new mt;function tO(n){for(let e=n.length-1;e>=0;--e)if(n[e]>=65535)return!0;return!1}function xl(n){return document.createElementNS("http://www.w3.org/1999/xhtml",n)}function Igt(){const n=xl("canvas");return n.style.display="block",n}const rC={};function il(n){n in rC||(rC[n]=!0,console.warn(n))}const sC=new mt().set(.8224621,.177538,0,.0331941,.9668058,0,.0170827,.0723974,.9105199),oC=new mt().set(1.2249401,-.2249404,0,-.0420569,1.0420571,0,-.0196376,-.0786361,1.0982735),cc={[hn]:{transfer:Td,primaries:xd,toReference:n=>n,fromReference:n=>n},[Kt]:{transfer:Gt,primaries:xd,toReference:n=>n.convertSRGBToLinear(),fromReference:n=>n.convertLinearToSRGB()},[au]:{transfer:Td,primaries:Cd,toReference:n=>n.applyMatrix3(oC),fromReference:n=>n.applyMatrix3(sC)},[FE]:{transfer:Gt,primaries:Cd,toReference:n=>n.convertSRGBToLinear().applyMatrix3(oC),fromReference:n=>n.applyMatrix3(sC).convertLinearToSRGB()}},Dgt=new Set([hn,au]),Nt={enabled:!0,_workingColorSpace:hn,get legacyMode(){return console.warn("THREE.ColorManagement: .legacyMode=false renamed to .enabled=true in r150."),!this.enabled},set legacyMode(n){console.warn("THREE.ColorManagement: .legacyMode=false renamed to .enabled=true in r150."),this.enabled=!n},get workingColorSpace(){return this._workingColorSpace},set workingColorSpace(n){if(!Dgt.has(n))throw new Error(`Unsupported working color space, "${n}".`);this._workingColorSpace=n},convert:function(n,e,t){if(this.enabled===!1||e===t||!e||!t)return n;const i=cc[e].toReference,r=cc[t].fromReference;return r(i(n))},fromWorkingColorSpace:function(n,e){return this.convert(n,this._workingColorSpace,e)},toWorkingColorSpace:function(n,e){return this.convert(n,e,this._workingColorSpace)},getPrimaries:function(n){return cc[n].primaries},getTransfer:function(n){return n===Qn?Td:cc[n].transfer}};function Mo(n){return n<.04045?n*.0773993808:Math.pow(n*.9478672986+.0521327014,2.4)}function kf(n){return n<.0031308?n*12.92:1.055*Math.pow(n,.41666)-.055}let eo;class nO{static getDataURL(e){if(/^data:/i.test(e.src)||typeof HTMLCanvasElement>"u")return e.src;let t;if(e instanceof HTMLCanvasElement)t=e;else{eo===void 0&&(eo=xl("canvas")),eo.width=e.width,eo.height=e.height;const i=eo.getContext("2d");e instanceof ImageData?i.putImageData(e,0,0):i.drawImage(e,0,0,e.width,e.height),t=eo}return t.width>2048||t.height>2048?(console.warn("THREE.ImageUtils.getDataURL: Image converted to jpg for performance reasons",e),t.toDataURL("image/jpeg",.6)):t.toDataURL("image/png")}static sRGBToLinear(e){if(typeof HTMLImageElement<"u"&&e instanceof HTMLImageElement||typeof HTMLCanvasElement<"u"&&e instanceof HTMLCanvasElement||typeof ImageBitmap<"u"&&e instanceof ImageBitmap){const t=xl("canvas");t.width=e.width,t.height=e.height;const i=t.getContext("2d");i.drawImage(e,0,0,e.width,e.height);const r=i.getImageData(0,0,e.width,e.height),s=r.data;for(let o=0;o0&&(i.userData=this.userData),t||(e.textures[this.uuid]=i),i}dispose(){this.dispatchEvent({type:"dispose"})}transformUv(e){if(this.mapping!==Hw)return e;if(e.applyMatrix3(this.matrix),e.x<0||e.x>1)switch(this.wrapS){case Xo:e.x=e.x-Math.floor(e.x);break;case Kn:e.x=e.x<0?0:1;break;case vd:Math.abs(Math.floor(e.x)%2)===1?e.x=Math.ceil(e.x)-e.x:e.x=e.x-Math.floor(e.x);break}if(e.y<0||e.y>1)switch(this.wrapT){case Xo:e.y=e.y-Math.floor(e.y);break;case Kn:e.y=e.y<0?0:1;break;case vd:Math.abs(Math.floor(e.y)%2)===1?e.y=Math.ceil(e.y)-e.y:e.y=e.y-Math.floor(e.y);break}return this.flipY&&(e.y=1-e.y),e}set needsUpdate(e){e===!0&&(this.version++,this.source.needsUpdate=!0)}get encoding(){return il("THREE.Texture: Property .encoding has been replaced by .colorSpace."),this.colorSpace===Kt?Ns:Jw}set encoding(e){il("THREE.Texture: Property .encoding has been replaced by .colorSpace."),this.colorSpace=e===Ns?Kt:Qn}}pn.DEFAULT_IMAGE=null;pn.DEFAULT_MAPPING=Hw;pn.DEFAULT_ANISOTROPY=1;class Pt{constructor(e=0,t=0,i=0,r=1){Pt.prototype.isVector4=!0,this.x=e,this.y=t,this.z=i,this.w=r}get width(){return this.z}set width(e){this.z=e}get height(){return this.w}set height(e){this.w=e}set(e,t,i,r){return this.x=e,this.y=t,this.z=i,this.w=r,this}setScalar(e){return this.x=e,this.y=e,this.z=e,this.w=e,this}setX(e){return this.x=e,this}setY(e){return this.y=e,this}setZ(e){return this.z=e,this}setW(e){return this.w=e,this}setComponent(e,t){switch(e){case 0:this.x=t;break;case 1:this.y=t;break;case 2:this.z=t;break;case 3:this.w=t;break;default:throw new Error("index is out of range: "+e)}return this}getComponent(e){switch(e){case 0:return this.x;case 1:return this.y;case 2:return this.z;case 3:return this.w;default:throw new Error("index is out of range: "+e)}}clone(){return new this.constructor(this.x,this.y,this.z,this.w)}copy(e){return this.x=e.x,this.y=e.y,this.z=e.z,this.w=e.w!==void 0?e.w:1,this}add(e){return this.x+=e.x,this.y+=e.y,this.z+=e.z,this.w+=e.w,this}addScalar(e){return this.x+=e,this.y+=e,this.z+=e,this.w+=e,this}addVectors(e,t){return this.x=e.x+t.x,this.y=e.y+t.y,this.z=e.z+t.z,this.w=e.w+t.w,this}addScaledVector(e,t){return this.x+=e.x*t,this.y+=e.y*t,this.z+=e.z*t,this.w+=e.w*t,this}sub(e){return this.x-=e.x,this.y-=e.y,this.z-=e.z,this.w-=e.w,this}subScalar(e){return this.x-=e,this.y-=e,this.z-=e,this.w-=e,this}subVectors(e,t){return this.x=e.x-t.x,this.y=e.y-t.y,this.z=e.z-t.z,this.w=e.w-t.w,this}multiply(e){return this.x*=e.x,this.y*=e.y,this.z*=e.z,this.w*=e.w,this}multiplyScalar(e){return this.x*=e,this.y*=e,this.z*=e,this.w*=e,this}applyMatrix4(e){const t=this.x,i=this.y,r=this.z,s=this.w,o=e.elements;return this.x=o[0]*t+o[4]*i+o[8]*r+o[12]*s,this.y=o[1]*t+o[5]*i+o[9]*r+o[13]*s,this.z=o[2]*t+o[6]*i+o[10]*r+o[14]*s,this.w=o[3]*t+o[7]*i+o[11]*r+o[15]*s,this}divideScalar(e){return this.multiplyScalar(1/e)}setAxisAngleFromQuaternion(e){this.w=2*Math.acos(e.w);const t=Math.sqrt(1-e.w*e.w);return t<1e-4?(this.x=1,this.y=0,this.z=0):(this.x=e.x/t,this.y=e.y/t,this.z=e.z/t),this}setAxisAngleFromRotationMatrix(e){let t,i,r,s;const l=e.elements,c=l[0],d=l[4],u=l[8],_=l[1],f=l[5],h=l[9],E=l[2],g=l[6],m=l[10];if(Math.abs(d-_)<.01&&Math.abs(u-E)<.01&&Math.abs(h-g)<.01){if(Math.abs(d+_)<.1&&Math.abs(u+E)<.1&&Math.abs(h+g)<.1&&Math.abs(c+f+m-3)<.1)return this.set(1,0,0,0),this;t=Math.PI;const S=(c+1)/2,v=(f+1)/2,T=(m+1)/2,C=(d+_)/4,N=(u+E)/4,x=(h+g)/4;return S>v&&S>T?S<.01?(i=0,r=.707106781,s=.707106781):(i=Math.sqrt(S),r=C/i,s=N/i):v>T?v<.01?(i=.707106781,r=0,s=.707106781):(r=Math.sqrt(v),i=C/r,s=x/r):T<.01?(i=.707106781,r=.707106781,s=0):(s=Math.sqrt(T),i=N/s,r=x/s),this.set(i,r,s,t),this}let b=Math.sqrt((g-h)*(g-h)+(u-E)*(u-E)+(_-d)*(_-d));return Math.abs(b)<.001&&(b=1),this.x=(g-h)/b,this.y=(u-E)/b,this.z=(_-d)/b,this.w=Math.acos((c+f+m-1)/2),this}min(e){return this.x=Math.min(this.x,e.x),this.y=Math.min(this.y,e.y),this.z=Math.min(this.z,e.z),this.w=Math.min(this.w,e.w),this}max(e){return this.x=Math.max(this.x,e.x),this.y=Math.max(this.y,e.y),this.z=Math.max(this.z,e.z),this.w=Math.max(this.w,e.w),this}clamp(e,t){return this.x=Math.max(e.x,Math.min(t.x,this.x)),this.y=Math.max(e.y,Math.min(t.y,this.y)),this.z=Math.max(e.z,Math.min(t.z,this.z)),this.w=Math.max(e.w,Math.min(t.w,this.w)),this}clampScalar(e,t){return this.x=Math.max(e,Math.min(t,this.x)),this.y=Math.max(e,Math.min(t,this.y)),this.z=Math.max(e,Math.min(t,this.z)),this.w=Math.max(e,Math.min(t,this.w)),this}clampLength(e,t){const i=this.length();return this.divideScalar(i||1).multiplyScalar(Math.max(e,Math.min(t,i)))}floor(){return this.x=Math.floor(this.x),this.y=Math.floor(this.y),this.z=Math.floor(this.z),this.w=Math.floor(this.w),this}ceil(){return this.x=Math.ceil(this.x),this.y=Math.ceil(this.y),this.z=Math.ceil(this.z),this.w=Math.ceil(this.w),this}round(){return this.x=Math.round(this.x),this.y=Math.round(this.y),this.z=Math.round(this.z),this.w=Math.round(this.w),this}roundToZero(){return this.x=Math.trunc(this.x),this.y=Math.trunc(this.y),this.z=Math.trunc(this.z),this.w=Math.trunc(this.w),this}negate(){return this.x=-this.x,this.y=-this.y,this.z=-this.z,this.w=-this.w,this}dot(e){return this.x*e.x+this.y*e.y+this.z*e.z+this.w*e.w}lengthSq(){return this.x*this.x+this.y*this.y+this.z*this.z+this.w*this.w}length(){return Math.sqrt(this.x*this.x+this.y*this.y+this.z*this.z+this.w*this.w)}manhattanLength(){return Math.abs(this.x)+Math.abs(this.y)+Math.abs(this.z)+Math.abs(this.w)}normalize(){return this.divideScalar(this.length()||1)}setLength(e){return this.normalize().multiplyScalar(e)}lerp(e,t){return this.x+=(e.x-this.x)*t,this.y+=(e.y-this.y)*t,this.z+=(e.z-this.z)*t,this.w+=(e.w-this.w)*t,this}lerpVectors(e,t,i){return this.x=e.x+(t.x-e.x)*i,this.y=e.y+(t.y-e.y)*i,this.z=e.z+(t.z-e.z)*i,this.w=e.w+(t.w-e.w)*i,this}equals(e){return e.x===this.x&&e.y===this.y&&e.z===this.z&&e.w===this.w}fromArray(e,t=0){return this.x=e[t],this.y=e[t+1],this.z=e[t+2],this.w=e[t+3],this}toArray(e=[],t=0){return e[t]=this.x,e[t+1]=this.y,e[t+2]=this.z,e[t+3]=this.w,e}fromBufferAttribute(e,t){return this.x=e.getX(t),this.y=e.getY(t),this.z=e.getZ(t),this.w=e.getW(t),this}random(){return this.x=Math.random(),this.y=Math.random(),this.z=Math.random(),this.w=Math.random(),this}*[Symbol.iterator](){yield this.x,yield this.y,yield this.z,yield this.w}}class Pgt extends fa{constructor(e=1,t=1,i={}){super(),this.isRenderTarget=!0,this.width=e,this.height=t,this.depth=1,this.scissor=new Pt(0,0,e,t),this.scissorTest=!1,this.viewport=new Pt(0,0,e,t);const r={width:e,height:t,depth:1};i.encoding!==void 0&&(il("THREE.WebGLRenderTarget: option.encoding has been replaced by option.colorSpace."),i.colorSpace=i.encoding===Ns?Kt:Qn),i=Object.assign({generateMipmaps:!1,internalFormat:null,minFilter:Mn,depthBuffer:!0,stencilBuffer:!1,depthTexture:null,samples:0},i),this.texture=new pn(r,i.mapping,i.wrapS,i.wrapT,i.magFilter,i.minFilter,i.format,i.type,i.anisotropy,i.colorSpace),this.texture.isRenderTargetTexture=!0,this.texture.flipY=!1,this.texture.generateMipmaps=i.generateMipmaps,this.texture.internalFormat=i.internalFormat,this.depthBuffer=i.depthBuffer,this.stencilBuffer=i.stencilBuffer,this.depthTexture=i.depthTexture,this.samples=i.samples}setSize(e,t,i=1){(this.width!==e||this.height!==t||this.depth!==i)&&(this.width=e,this.height=t,this.depth=i,this.texture.image.width=e,this.texture.image.height=t,this.texture.image.depth=i,this.dispose()),this.viewport.set(0,0,e,t),this.scissor.set(0,0,e,t)}clone(){return new this.constructor().copy(this)}copy(e){this.width=e.width,this.height=e.height,this.depth=e.depth,this.scissor.copy(e.scissor),this.scissorTest=e.scissorTest,this.viewport.copy(e.viewport),this.texture=e.texture.clone(),this.texture.isRenderTargetTexture=!0;const t=Object.assign({},e.texture.image);return this.texture.source=new iO(t),this.depthBuffer=e.depthBuffer,this.stencilBuffer=e.stencilBuffer,e.depthTexture!==null&&(this.depthTexture=e.depthTexture.clone()),this.samples=e.samples,this}dispose(){this.dispatchEvent({type:"dispose"})}}class Ps extends Pgt{constructor(e=1,t=1,i={}){super(e,t,i),this.isWebGLRenderTarget=!0}}class rO extends pn{constructor(e=null,t=1,i=1,r=1){super(null),this.isDataArrayTexture=!0,this.image={data:e,width:t,height:i,depth:r},this.magFilter=an,this.minFilter=an,this.wrapR=Kn,this.generateMipmaps=!1,this.flipY=!1,this.unpackAlignment=1}}class Ugt extends pn{constructor(e=null,t=1,i=1,r=1){super(null),this.isData3DTexture=!0,this.image={data:e,width:t,height:i,depth:r},this.magFilter=an,this.minFilter=an,this.wrapR=Kn,this.generateMipmaps=!1,this.flipY=!1,this.unpackAlignment=1}}class Xr{constructor(e=0,t=0,i=0,r=1){this.isQuaternion=!0,this._x=e,this._y=t,this._z=i,this._w=r}static slerpFlat(e,t,i,r,s,o,a){let l=i[r+0],c=i[r+1],d=i[r+2],u=i[r+3];const _=s[o+0],f=s[o+1],h=s[o+2],E=s[o+3];if(a===0){e[t+0]=l,e[t+1]=c,e[t+2]=d,e[t+3]=u;return}if(a===1){e[t+0]=_,e[t+1]=f,e[t+2]=h,e[t+3]=E;return}if(u!==E||l!==_||c!==f||d!==h){let g=1-a;const m=l*_+c*f+d*h+u*E,b=m>=0?1:-1,S=1-m*m;if(S>Number.EPSILON){const T=Math.sqrt(S),C=Math.atan2(T,m*b);g=Math.sin(g*C)/T,a=Math.sin(a*C)/T}const v=a*b;if(l=l*g+_*v,c=c*g+f*v,d=d*g+h*v,u=u*g+E*v,g===1-a){const T=1/Math.sqrt(l*l+c*c+d*d+u*u);l*=T,c*=T,d*=T,u*=T}}e[t]=l,e[t+1]=c,e[t+2]=d,e[t+3]=u}static multiplyQuaternionsFlat(e,t,i,r,s,o){const a=i[r],l=i[r+1],c=i[r+2],d=i[r+3],u=s[o],_=s[o+1],f=s[o+2],h=s[o+3];return e[t]=a*h+d*u+l*f-c*_,e[t+1]=l*h+d*_+c*u-a*f,e[t+2]=c*h+d*f+a*_-l*u,e[t+3]=d*h-a*u-l*_-c*f,e}get x(){return this._x}set x(e){this._x=e,this._onChangeCallback()}get y(){return this._y}set y(e){this._y=e,this._onChangeCallback()}get z(){return this._z}set z(e){this._z=e,this._onChangeCallback()}get w(){return this._w}set w(e){this._w=e,this._onChangeCallback()}set(e,t,i,r){return this._x=e,this._y=t,this._z=i,this._w=r,this._onChangeCallback(),this}clone(){return new this.constructor(this._x,this._y,this._z,this._w)}copy(e){return this._x=e.x,this._y=e.y,this._z=e.z,this._w=e.w,this._onChangeCallback(),this}setFromEuler(e,t){const i=e._x,r=e._y,s=e._z,o=e._order,a=Math.cos,l=Math.sin,c=a(i/2),d=a(r/2),u=a(s/2),_=l(i/2),f=l(r/2),h=l(s/2);switch(o){case"XYZ":this._x=_*d*u+c*f*h,this._y=c*f*u-_*d*h,this._z=c*d*h+_*f*u,this._w=c*d*u-_*f*h;break;case"YXZ":this._x=_*d*u+c*f*h,this._y=c*f*u-_*d*h,this._z=c*d*h-_*f*u,this._w=c*d*u+_*f*h;break;case"ZXY":this._x=_*d*u-c*f*h,this._y=c*f*u+_*d*h,this._z=c*d*h+_*f*u,this._w=c*d*u-_*f*h;break;case"ZYX":this._x=_*d*u-c*f*h,this._y=c*f*u+_*d*h,this._z=c*d*h-_*f*u,this._w=c*d*u+_*f*h;break;case"YZX":this._x=_*d*u+c*f*h,this._y=c*f*u+_*d*h,this._z=c*d*h-_*f*u,this._w=c*d*u-_*f*h;break;case"XZY":this._x=_*d*u-c*f*h,this._y=c*f*u-_*d*h,this._z=c*d*h+_*f*u,this._w=c*d*u+_*f*h;break;default:console.warn("THREE.Quaternion: .setFromEuler() encountered an unknown order: "+o)}return t!==!1&&this._onChangeCallback(),this}setFromAxisAngle(e,t){const i=t/2,r=Math.sin(i);return this._x=e.x*r,this._y=e.y*r,this._z=e.z*r,this._w=Math.cos(i),this._onChangeCallback(),this}setFromRotationMatrix(e){const t=e.elements,i=t[0],r=t[4],s=t[8],o=t[1],a=t[5],l=t[9],c=t[2],d=t[6],u=t[10],_=i+a+u;if(_>0){const f=.5/Math.sqrt(_+1);this._w=.25/f,this._x=(d-l)*f,this._y=(s-c)*f,this._z=(o-r)*f}else if(i>a&&i>u){const f=2*Math.sqrt(1+i-a-u);this._w=(d-l)/f,this._x=.25*f,this._y=(r+o)/f,this._z=(s+c)/f}else if(a>u){const f=2*Math.sqrt(1+a-i-u);this._w=(s-c)/f,this._x=(r+o)/f,this._y=.25*f,this._z=(l+d)/f}else{const f=2*Math.sqrt(1+u-i-a);this._w=(o-r)/f,this._x=(s+c)/f,this._y=(l+d)/f,this._z=.25*f}return this._onChangeCallback(),this}setFromUnitVectors(e,t){let i=e.dot(t)+1;return iMath.abs(e.z)?(this._x=-e.y,this._y=e.x,this._z=0,this._w=i):(this._x=0,this._y=-e.z,this._z=e.y,this._w=i)):(this._x=e.y*t.z-e.z*t.y,this._y=e.z*t.x-e.x*t.z,this._z=e.x*t.y-e.y*t.x,this._w=i),this.normalize()}angleTo(e){return 2*Math.acos(Math.abs(En(this.dot(e),-1,1)))}rotateTowards(e,t){const i=this.angleTo(e);if(i===0)return this;const r=Math.min(1,t/i);return this.slerp(e,r),this}identity(){return this.set(0,0,0,1)}invert(){return this.conjugate()}conjugate(){return this._x*=-1,this._y*=-1,this._z*=-1,this._onChangeCallback(),this}dot(e){return this._x*e._x+this._y*e._y+this._z*e._z+this._w*e._w}lengthSq(){return this._x*this._x+this._y*this._y+this._z*this._z+this._w*this._w}length(){return Math.sqrt(this._x*this._x+this._y*this._y+this._z*this._z+this._w*this._w)}normalize(){let e=this.length();return e===0?(this._x=0,this._y=0,this._z=0,this._w=1):(e=1/e,this._x=this._x*e,this._y=this._y*e,this._z=this._z*e,this._w=this._w*e),this._onChangeCallback(),this}multiply(e){return this.multiplyQuaternions(this,e)}premultiply(e){return this.multiplyQuaternions(e,this)}multiplyQuaternions(e,t){const i=e._x,r=e._y,s=e._z,o=e._w,a=t._x,l=t._y,c=t._z,d=t._w;return this._x=i*d+o*a+r*c-s*l,this._y=r*d+o*l+s*a-i*c,this._z=s*d+o*c+i*l-r*a,this._w=o*d-i*a-r*l-s*c,this._onChangeCallback(),this}slerp(e,t){if(t===0)return this;if(t===1)return this.copy(e);const i=this._x,r=this._y,s=this._z,o=this._w;let a=o*e._w+i*e._x+r*e._y+s*e._z;if(a<0?(this._w=-e._w,this._x=-e._x,this._y=-e._y,this._z=-e._z,a=-a):this.copy(e),a>=1)return this._w=o,this._x=i,this._y=r,this._z=s,this;const l=1-a*a;if(l<=Number.EPSILON){const f=1-t;return this._w=f*o+t*this._w,this._x=f*i+t*this._x,this._y=f*r+t*this._y,this._z=f*s+t*this._z,this.normalize(),this._onChangeCallback(),this}const c=Math.sqrt(l),d=Math.atan2(c,a),u=Math.sin((1-t)*d)/c,_=Math.sin(t*d)/c;return this._w=o*u+this._w*_,this._x=i*u+this._x*_,this._y=r*u+this._y*_,this._z=s*u+this._z*_,this._onChangeCallback(),this}slerpQuaternions(e,t,i){return this.copy(e).slerp(t,i)}random(){const e=Math.random(),t=Math.sqrt(1-e),i=Math.sqrt(e),r=2*Math.PI*Math.random(),s=2*Math.PI*Math.random();return this.set(t*Math.cos(r),i*Math.sin(s),i*Math.cos(s),t*Math.sin(r))}equals(e){return e._x===this._x&&e._y===this._y&&e._z===this._z&&e._w===this._w}fromArray(e,t=0){return this._x=e[t],this._y=e[t+1],this._z=e[t+2],this._w=e[t+3],this._onChangeCallback(),this}toArray(e=[],t=0){return e[t]=this._x,e[t+1]=this._y,e[t+2]=this._z,e[t+3]=this._w,e}fromBufferAttribute(e,t){return this._x=e.getX(t),this._y=e.getY(t),this._z=e.getZ(t),this._w=e.getW(t),this}toJSON(){return this.toArray()}_onChange(e){return this._onChangeCallback=e,this}_onChangeCallback(){}*[Symbol.iterator](){yield this._x,yield this._y,yield this._z,yield this._w}}class ue{constructor(e=0,t=0,i=0){ue.prototype.isVector3=!0,this.x=e,this.y=t,this.z=i}set(e,t,i){return i===void 0&&(i=this.z),this.x=e,this.y=t,this.z=i,this}setScalar(e){return this.x=e,this.y=e,this.z=e,this}setX(e){return this.x=e,this}setY(e){return this.y=e,this}setZ(e){return this.z=e,this}setComponent(e,t){switch(e){case 0:this.x=t;break;case 1:this.y=t;break;case 2:this.z=t;break;default:throw new Error("index is out of range: "+e)}return this}getComponent(e){switch(e){case 0:return this.x;case 1:return this.y;case 2:return this.z;default:throw new Error("index is out of range: "+e)}}clone(){return new this.constructor(this.x,this.y,this.z)}copy(e){return this.x=e.x,this.y=e.y,this.z=e.z,this}add(e){return this.x+=e.x,this.y+=e.y,this.z+=e.z,this}addScalar(e){return this.x+=e,this.y+=e,this.z+=e,this}addVectors(e,t){return this.x=e.x+t.x,this.y=e.y+t.y,this.z=e.z+t.z,this}addScaledVector(e,t){return this.x+=e.x*t,this.y+=e.y*t,this.z+=e.z*t,this}sub(e){return this.x-=e.x,this.y-=e.y,this.z-=e.z,this}subScalar(e){return this.x-=e,this.y-=e,this.z-=e,this}subVectors(e,t){return this.x=e.x-t.x,this.y=e.y-t.y,this.z=e.z-t.z,this}multiply(e){return this.x*=e.x,this.y*=e.y,this.z*=e.z,this}multiplyScalar(e){return this.x*=e,this.y*=e,this.z*=e,this}multiplyVectors(e,t){return this.x=e.x*t.x,this.y=e.y*t.y,this.z=e.z*t.z,this}applyEuler(e){return this.applyQuaternion(aC.setFromEuler(e))}applyAxisAngle(e,t){return this.applyQuaternion(aC.setFromAxisAngle(e,t))}applyMatrix3(e){const t=this.x,i=this.y,r=this.z,s=e.elements;return this.x=s[0]*t+s[3]*i+s[6]*r,this.y=s[1]*t+s[4]*i+s[7]*r,this.z=s[2]*t+s[5]*i+s[8]*r,this}applyNormalMatrix(e){return this.applyMatrix3(e).normalize()}applyMatrix4(e){const t=this.x,i=this.y,r=this.z,s=e.elements,o=1/(s[3]*t+s[7]*i+s[11]*r+s[15]);return this.x=(s[0]*t+s[4]*i+s[8]*r+s[12])*o,this.y=(s[1]*t+s[5]*i+s[9]*r+s[13])*o,this.z=(s[2]*t+s[6]*i+s[10]*r+s[14])*o,this}applyQuaternion(e){const t=this.x,i=this.y,r=this.z,s=e.x,o=e.y,a=e.z,l=e.w,c=2*(o*r-a*i),d=2*(a*t-s*r),u=2*(s*i-o*t);return this.x=t+l*c+o*u-a*d,this.y=i+l*d+a*c-s*u,this.z=r+l*u+s*d-o*c,this}project(e){return this.applyMatrix4(e.matrixWorldInverse).applyMatrix4(e.projectionMatrix)}unproject(e){return this.applyMatrix4(e.projectionMatrixInverse).applyMatrix4(e.matrixWorld)}transformDirection(e){const t=this.x,i=this.y,r=this.z,s=e.elements;return this.x=s[0]*t+s[4]*i+s[8]*r,this.y=s[1]*t+s[5]*i+s[9]*r,this.z=s[2]*t+s[6]*i+s[10]*r,this.normalize()}divide(e){return this.x/=e.x,this.y/=e.y,this.z/=e.z,this}divideScalar(e){return this.multiplyScalar(1/e)}min(e){return this.x=Math.min(this.x,e.x),this.y=Math.min(this.y,e.y),this.z=Math.min(this.z,e.z),this}max(e){return this.x=Math.max(this.x,e.x),this.y=Math.max(this.y,e.y),this.z=Math.max(this.z,e.z),this}clamp(e,t){return this.x=Math.max(e.x,Math.min(t.x,this.x)),this.y=Math.max(e.y,Math.min(t.y,this.y)),this.z=Math.max(e.z,Math.min(t.z,this.z)),this}clampScalar(e,t){return this.x=Math.max(e,Math.min(t,this.x)),this.y=Math.max(e,Math.min(t,this.y)),this.z=Math.max(e,Math.min(t,this.z)),this}clampLength(e,t){const i=this.length();return this.divideScalar(i||1).multiplyScalar(Math.max(e,Math.min(t,i)))}floor(){return this.x=Math.floor(this.x),this.y=Math.floor(this.y),this.z=Math.floor(this.z),this}ceil(){return this.x=Math.ceil(this.x),this.y=Math.ceil(this.y),this.z=Math.ceil(this.z),this}round(){return this.x=Math.round(this.x),this.y=Math.round(this.y),this.z=Math.round(this.z),this}roundToZero(){return this.x=Math.trunc(this.x),this.y=Math.trunc(this.y),this.z=Math.trunc(this.z),this}negate(){return this.x=-this.x,this.y=-this.y,this.z=-this.z,this}dot(e){return this.x*e.x+this.y*e.y+this.z*e.z}lengthSq(){return this.x*this.x+this.y*this.y+this.z*this.z}length(){return Math.sqrt(this.x*this.x+this.y*this.y+this.z*this.z)}manhattanLength(){return Math.abs(this.x)+Math.abs(this.y)+Math.abs(this.z)}normalize(){return this.divideScalar(this.length()||1)}setLength(e){return this.normalize().multiplyScalar(e)}lerp(e,t){return this.x+=(e.x-this.x)*t,this.y+=(e.y-this.y)*t,this.z+=(e.z-this.z)*t,this}lerpVectors(e,t,i){return this.x=e.x+(t.x-e.x)*i,this.y=e.y+(t.y-e.y)*i,this.z=e.z+(t.z-e.z)*i,this}cross(e){return this.crossVectors(this,e)}crossVectors(e,t){const i=e.x,r=e.y,s=e.z,o=t.x,a=t.y,l=t.z;return this.x=r*l-s*a,this.y=s*o-i*l,this.z=i*a-r*o,this}projectOnVector(e){const t=e.lengthSq();if(t===0)return this.set(0,0,0);const i=e.dot(this)/t;return this.copy(e).multiplyScalar(i)}projectOnPlane(e){return Uf.copy(this).projectOnVector(e),this.sub(Uf)}reflect(e){return this.sub(Uf.copy(e).multiplyScalar(2*this.dot(e)))}angleTo(e){const t=Math.sqrt(this.lengthSq()*e.lengthSq());if(t===0)return Math.PI/2;const i=this.dot(e)/t;return Math.acos(En(i,-1,1))}distanceTo(e){return Math.sqrt(this.distanceToSquared(e))}distanceToSquared(e){const t=this.x-e.x,i=this.y-e.y,r=this.z-e.z;return t*t+i*i+r*r}manhattanDistanceTo(e){return Math.abs(this.x-e.x)+Math.abs(this.y-e.y)+Math.abs(this.z-e.z)}setFromSpherical(e){return this.setFromSphericalCoords(e.radius,e.phi,e.theta)}setFromSphericalCoords(e,t,i){const r=Math.sin(t)*e;return this.x=r*Math.sin(i),this.y=Math.cos(t)*e,this.z=r*Math.cos(i),this}setFromCylindrical(e){return this.setFromCylindricalCoords(e.radius,e.theta,e.y)}setFromCylindricalCoords(e,t,i){return this.x=e*Math.sin(t),this.y=i,this.z=e*Math.cos(t),this}setFromMatrixPosition(e){const t=e.elements;return this.x=t[12],this.y=t[13],this.z=t[14],this}setFromMatrixScale(e){const t=this.setFromMatrixColumn(e,0).length(),i=this.setFromMatrixColumn(e,1).length(),r=this.setFromMatrixColumn(e,2).length();return this.x=t,this.y=i,this.z=r,this}setFromMatrixColumn(e,t){return this.fromArray(e.elements,t*4)}setFromMatrix3Column(e,t){return this.fromArray(e.elements,t*3)}setFromEuler(e){return this.x=e._x,this.y=e._y,this.z=e._z,this}setFromColor(e){return this.x=e.r,this.y=e.g,this.z=e.b,this}equals(e){return e.x===this.x&&e.y===this.y&&e.z===this.z}fromArray(e,t=0){return this.x=e[t],this.y=e[t+1],this.z=e[t+2],this}toArray(e=[],t=0){return e[t]=this.x,e[t+1]=this.y,e[t+2]=this.z,e}fromBufferAttribute(e,t){return this.x=e.getX(t),this.y=e.getY(t),this.z=e.getZ(t),this}random(){return this.x=Math.random(),this.y=Math.random(),this.z=Math.random(),this}randomDirection(){const e=(Math.random()-.5)*2,t=Math.random()*Math.PI*2,i=Math.sqrt(1-e**2);return this.x=i*Math.cos(t),this.y=i*Math.sin(t),this.z=e,this}*[Symbol.iterator](){yield this.x,yield this.y,yield this.z}}const Uf=new ue,aC=new Xr;class hr{constructor(e=new ue(1/0,1/0,1/0),t=new ue(-1/0,-1/0,-1/0)){this.isBox3=!0,this.min=e,this.max=t}set(e,t){return this.min.copy(e),this.max.copy(t),this}setFromArray(e){this.makeEmpty();for(let t=0,i=e.length;tthis.max.x||e.ythis.max.y||e.zthis.max.z)}containsBox(e){return this.min.x<=e.min.x&&e.max.x<=this.max.x&&this.min.y<=e.min.y&&e.max.y<=this.max.y&&this.min.z<=e.min.z&&e.max.z<=this.max.z}getParameter(e,t){return t.set((e.x-this.min.x)/(this.max.x-this.min.x),(e.y-this.min.y)/(this.max.y-this.min.y),(e.z-this.min.z)/(this.max.z-this.min.z))}intersectsBox(e){return!(e.max.xthis.max.x||e.max.ythis.max.y||e.max.zthis.max.z)}intersectsSphere(e){return this.clampPoint(e.center,si),si.distanceToSquared(e.center)<=e.radius*e.radius}intersectsPlane(e){let t,i;return e.normal.x>0?(t=e.normal.x*this.min.x,i=e.normal.x*this.max.x):(t=e.normal.x*this.max.x,i=e.normal.x*this.min.x),e.normal.y>0?(t+=e.normal.y*this.min.y,i+=e.normal.y*this.max.y):(t+=e.normal.y*this.max.y,i+=e.normal.y*this.min.y),e.normal.z>0?(t+=e.normal.z*this.min.z,i+=e.normal.z*this.max.z):(t+=e.normal.z*this.max.z,i+=e.normal.z*this.min.z),t<=-e.constant&&i>=-e.constant}intersectsTriangle(e){if(this.isEmpty())return!1;this.getCenter(La),uc.subVectors(this.max,La),to.subVectors(e.a,La),no.subVectors(e.b,La),io.subVectors(e.c,La),Sr.subVectors(no,to),yr.subVectors(io,no),os.subVectors(to,io);let t=[0,-Sr.z,Sr.y,0,-yr.z,yr.y,0,-os.z,os.y,Sr.z,0,-Sr.x,yr.z,0,-yr.x,os.z,0,-os.x,-Sr.y,Sr.x,0,-yr.y,yr.x,0,-os.y,os.x,0];return!Ff(t,to,no,io,uc)||(t=[1,0,0,0,1,0,0,0,1],!Ff(t,to,no,io,uc))?!1:(_c.crossVectors(Sr,yr),t=[_c.x,_c.y,_c.z],Ff(t,to,no,io,uc))}clampPoint(e,t){return t.copy(e).clamp(this.min,this.max)}distanceToPoint(e){return this.clampPoint(e,si).distanceTo(e)}getBoundingSphere(e){return this.isEmpty()?e.makeEmpty():(this.getCenter(e.center),e.radius=this.getSize(si).length()*.5),e}intersect(e){return this.min.max(e.min),this.max.min(e.max),this.isEmpty()&&this.makeEmpty(),this}union(e){return this.min.min(e.min),this.max.max(e.max),this}applyMatrix4(e){return this.isEmpty()?this:(Yi[0].set(this.min.x,this.min.y,this.min.z).applyMatrix4(e),Yi[1].set(this.min.x,this.min.y,this.max.z).applyMatrix4(e),Yi[2].set(this.min.x,this.max.y,this.min.z).applyMatrix4(e),Yi[3].set(this.min.x,this.max.y,this.max.z).applyMatrix4(e),Yi[4].set(this.max.x,this.min.y,this.min.z).applyMatrix4(e),Yi[5].set(this.max.x,this.min.y,this.max.z).applyMatrix4(e),Yi[6].set(this.max.x,this.max.y,this.min.z).applyMatrix4(e),Yi[7].set(this.max.x,this.max.y,this.max.z).applyMatrix4(e),this.setFromPoints(Yi),this)}translate(e){return this.min.add(e),this.max.add(e),this}equals(e){return e.min.equals(this.min)&&e.max.equals(this.max)}}const Yi=[new ue,new ue,new ue,new ue,new ue,new ue,new ue,new ue],si=new ue,dc=new hr,to=new ue,no=new ue,io=new ue,Sr=new ue,yr=new ue,os=new ue,La=new ue,uc=new ue,_c=new ue,as=new ue;function Ff(n,e,t,i,r){for(let s=0,o=n.length-3;s<=o;s+=3){as.fromArray(n,s);const a=r.x*Math.abs(as.x)+r.y*Math.abs(as.y)+r.z*Math.abs(as.z),l=e.dot(as),c=t.dot(as),d=i.dot(as);if(Math.max(-Math.max(l,c,d),Math.min(l,c,d))>a)return!1}return!0}const Fgt=new hr,ka=new ue,Bf=new ue;class Ui{constructor(e=new ue,t=-1){this.center=e,this.radius=t}set(e,t){return this.center.copy(e),this.radius=t,this}setFromPoints(e,t){const i=this.center;t!==void 0?i.copy(t):Fgt.setFromPoints(e).getCenter(i);let r=0;for(let s=0,o=e.length;sthis.radius*this.radius&&(t.sub(this.center).normalize(),t.multiplyScalar(this.radius).add(this.center)),t}getBoundingBox(e){return this.isEmpty()?(e.makeEmpty(),e):(e.set(this.center,this.center),e.expandByScalar(this.radius),e)}applyMatrix4(e){return this.center.applyMatrix4(e),this.radius=this.radius*e.getMaxScaleOnAxis(),this}translate(e){return this.center.add(e),this}expandByPoint(e){if(this.isEmpty())return this.center.copy(e),this.radius=0,this;ka.subVectors(e,this.center);const t=ka.lengthSq();if(t>this.radius*this.radius){const i=Math.sqrt(t),r=(i-this.radius)*.5;this.center.addScaledVector(ka,r/i),this.radius+=r}return this}union(e){return e.isEmpty()?this:this.isEmpty()?(this.copy(e),this):(this.center.equals(e.center)===!0?this.radius=Math.max(this.radius,e.radius):(Bf.subVectors(e.center,this.center).setLength(e.radius),this.expandByPoint(ka.copy(e.center).add(Bf)),this.expandByPoint(ka.copy(e.center).sub(Bf))),this)}equals(e){return e.center.equals(this.center)&&e.radius===this.radius}clone(){return new this.constructor().copy(this)}}const $i=new ue,Gf=new ue,pc=new ue,vr=new ue,zf=new ue,hc=new ue,Vf=new ue;class lu{constructor(e=new ue,t=new ue(0,0,-1)){this.origin=e,this.direction=t}set(e,t){return this.origin.copy(e),this.direction.copy(t),this}copy(e){return this.origin.copy(e.origin),this.direction.copy(e.direction),this}at(e,t){return t.copy(this.origin).addScaledVector(this.direction,e)}lookAt(e){return this.direction.copy(e).sub(this.origin).normalize(),this}recast(e){return this.origin.copy(this.at(e,$i)),this}closestPointToPoint(e,t){t.subVectors(e,this.origin);const i=t.dot(this.direction);return i<0?t.copy(this.origin):t.copy(this.origin).addScaledVector(this.direction,i)}distanceToPoint(e){return Math.sqrt(this.distanceSqToPoint(e))}distanceSqToPoint(e){const t=$i.subVectors(e,this.origin).dot(this.direction);return t<0?this.origin.distanceToSquared(e):($i.copy(this.origin).addScaledVector(this.direction,t),$i.distanceToSquared(e))}distanceSqToSegment(e,t,i,r){Gf.copy(e).add(t).multiplyScalar(.5),pc.copy(t).sub(e).normalize(),vr.copy(this.origin).sub(Gf);const s=e.distanceTo(t)*.5,o=-this.direction.dot(pc),a=vr.dot(this.direction),l=-vr.dot(pc),c=vr.lengthSq(),d=Math.abs(1-o*o);let u,_,f,h;if(d>0)if(u=o*l-a,_=o*a-l,h=s*d,u>=0)if(_>=-h)if(_<=h){const E=1/d;u*=E,_*=E,f=u*(u+o*_+2*a)+_*(o*u+_+2*l)+c}else _=s,u=Math.max(0,-(o*_+a)),f=-u*u+_*(_+2*l)+c;else _=-s,u=Math.max(0,-(o*_+a)),f=-u*u+_*(_+2*l)+c;else _<=-h?(u=Math.max(0,-(-o*s+a)),_=u>0?-s:Math.min(Math.max(-s,-l),s),f=-u*u+_*(_+2*l)+c):_<=h?(u=0,_=Math.min(Math.max(-s,-l),s),f=_*(_+2*l)+c):(u=Math.max(0,-(o*s+a)),_=u>0?s:Math.min(Math.max(-s,-l),s),f=-u*u+_*(_+2*l)+c);else _=o>0?-s:s,u=Math.max(0,-(o*_+a)),f=-u*u+_*(_+2*l)+c;return i&&i.copy(this.origin).addScaledVector(this.direction,u),r&&r.copy(Gf).addScaledVector(pc,_),f}intersectSphere(e,t){$i.subVectors(e.center,this.origin);const i=$i.dot(this.direction),r=$i.dot($i)-i*i,s=e.radius*e.radius;if(r>s)return null;const o=Math.sqrt(s-r),a=i-o,l=i+o;return l<0?null:a<0?this.at(l,t):this.at(a,t)}intersectsSphere(e){return this.distanceSqToPoint(e.center)<=e.radius*e.radius}distanceToPlane(e){const t=e.normal.dot(this.direction);if(t===0)return e.distanceToPoint(this.origin)===0?0:null;const i=-(this.origin.dot(e.normal)+e.constant)/t;return i>=0?i:null}intersectPlane(e,t){const i=this.distanceToPlane(e);return i===null?null:this.at(i,t)}intersectsPlane(e){const t=e.distanceToPoint(this.origin);return t===0||e.normal.dot(this.direction)*t<0}intersectBox(e,t){let i,r,s,o,a,l;const c=1/this.direction.x,d=1/this.direction.y,u=1/this.direction.z,_=this.origin;return c>=0?(i=(e.min.x-_.x)*c,r=(e.max.x-_.x)*c):(i=(e.max.x-_.x)*c,r=(e.min.x-_.x)*c),d>=0?(s=(e.min.y-_.y)*d,o=(e.max.y-_.y)*d):(s=(e.max.y-_.y)*d,o=(e.min.y-_.y)*d),i>o||s>r||((s>i||isNaN(i))&&(i=s),(o=0?(a=(e.min.z-_.z)*u,l=(e.max.z-_.z)*u):(a=(e.max.z-_.z)*u,l=(e.min.z-_.z)*u),i>l||a>r)||((a>i||i!==i)&&(i=a),(l=0?i:r,t)}intersectsBox(e){return this.intersectBox(e,$i)!==null}intersectTriangle(e,t,i,r,s){zf.subVectors(t,e),hc.subVectors(i,e),Vf.crossVectors(zf,hc);let o=this.direction.dot(Vf),a;if(o>0){if(r)return null;a=1}else if(o<0)a=-1,o=-o;else return null;vr.subVectors(this.origin,e);const l=a*this.direction.dot(hc.crossVectors(vr,hc));if(l<0)return null;const c=a*this.direction.dot(zf.cross(vr));if(c<0||l+c>o)return null;const d=-a*vr.dot(Vf);return d<0?null:this.at(d/o,s)}applyMatrix4(e){return this.origin.applyMatrix4(e),this.direction.transformDirection(e),this}equals(e){return e.origin.equals(this.origin)&&e.direction.equals(this.direction)}clone(){return new this.constructor().copy(this)}}class gt{constructor(e,t,i,r,s,o,a,l,c,d,u,_,f,h,E,g){gt.prototype.isMatrix4=!0,this.elements=[1,0,0,0,0,1,0,0,0,0,1,0,0,0,0,1],e!==void 0&&this.set(e,t,i,r,s,o,a,l,c,d,u,_,f,h,E,g)}set(e,t,i,r,s,o,a,l,c,d,u,_,f,h,E,g){const m=this.elements;return m[0]=e,m[4]=t,m[8]=i,m[12]=r,m[1]=s,m[5]=o,m[9]=a,m[13]=l,m[2]=c,m[6]=d,m[10]=u,m[14]=_,m[3]=f,m[7]=h,m[11]=E,m[15]=g,this}identity(){return this.set(1,0,0,0,0,1,0,0,0,0,1,0,0,0,0,1),this}clone(){return new gt().fromArray(this.elements)}copy(e){const t=this.elements,i=e.elements;return t[0]=i[0],t[1]=i[1],t[2]=i[2],t[3]=i[3],t[4]=i[4],t[5]=i[5],t[6]=i[6],t[7]=i[7],t[8]=i[8],t[9]=i[9],t[10]=i[10],t[11]=i[11],t[12]=i[12],t[13]=i[13],t[14]=i[14],t[15]=i[15],this}copyPosition(e){const t=this.elements,i=e.elements;return t[12]=i[12],t[13]=i[13],t[14]=i[14],this}setFromMatrix3(e){const t=e.elements;return this.set(t[0],t[3],t[6],0,t[1],t[4],t[7],0,t[2],t[5],t[8],0,0,0,0,1),this}extractBasis(e,t,i){return e.setFromMatrixColumn(this,0),t.setFromMatrixColumn(this,1),i.setFromMatrixColumn(this,2),this}makeBasis(e,t,i){return this.set(e.x,t.x,i.x,0,e.y,t.y,i.y,0,e.z,t.z,i.z,0,0,0,0,1),this}extractRotation(e){const t=this.elements,i=e.elements,r=1/ro.setFromMatrixColumn(e,0).length(),s=1/ro.setFromMatrixColumn(e,1).length(),o=1/ro.setFromMatrixColumn(e,2).length();return t[0]=i[0]*r,t[1]=i[1]*r,t[2]=i[2]*r,t[3]=0,t[4]=i[4]*s,t[5]=i[5]*s,t[6]=i[6]*s,t[7]=0,t[8]=i[8]*o,t[9]=i[9]*o,t[10]=i[10]*o,t[11]=0,t[12]=0,t[13]=0,t[14]=0,t[15]=1,this}makeRotationFromEuler(e){const t=this.elements,i=e.x,r=e.y,s=e.z,o=Math.cos(i),a=Math.sin(i),l=Math.cos(r),c=Math.sin(r),d=Math.cos(s),u=Math.sin(s);if(e.order==="XYZ"){const _=o*d,f=o*u,h=a*d,E=a*u;t[0]=l*d,t[4]=-l*u,t[8]=c,t[1]=f+h*c,t[5]=_-E*c,t[9]=-a*l,t[2]=E-_*c,t[6]=h+f*c,t[10]=o*l}else if(e.order==="YXZ"){const _=l*d,f=l*u,h=c*d,E=c*u;t[0]=_+E*a,t[4]=h*a-f,t[8]=o*c,t[1]=o*u,t[5]=o*d,t[9]=-a,t[2]=f*a-h,t[6]=E+_*a,t[10]=o*l}else if(e.order==="ZXY"){const _=l*d,f=l*u,h=c*d,E=c*u;t[0]=_-E*a,t[4]=-o*u,t[8]=h+f*a,t[1]=f+h*a,t[5]=o*d,t[9]=E-_*a,t[2]=-o*c,t[6]=a,t[10]=o*l}else if(e.order==="ZYX"){const _=o*d,f=o*u,h=a*d,E=a*u;t[0]=l*d,t[4]=h*c-f,t[8]=_*c+E,t[1]=l*u,t[5]=E*c+_,t[9]=f*c-h,t[2]=-c,t[6]=a*l,t[10]=o*l}else if(e.order==="YZX"){const _=o*l,f=o*c,h=a*l,E=a*c;t[0]=l*d,t[4]=E-_*u,t[8]=h*u+f,t[1]=u,t[5]=o*d,t[9]=-a*d,t[2]=-c*d,t[6]=f*u+h,t[10]=_-E*u}else if(e.order==="XZY"){const _=o*l,f=o*c,h=a*l,E=a*c;t[0]=l*d,t[4]=-u,t[8]=c*d,t[1]=_*u+E,t[5]=o*d,t[9]=f*u-h,t[2]=h*u-f,t[6]=a*d,t[10]=E*u+_}return t[3]=0,t[7]=0,t[11]=0,t[12]=0,t[13]=0,t[14]=0,t[15]=1,this}makeRotationFromQuaternion(e){return this.compose(Bgt,e,Ggt)}lookAt(e,t,i){const r=this.elements;return Un.subVectors(e,t),Un.lengthSq()===0&&(Un.z=1),Un.normalize(),Tr.crossVectors(i,Un),Tr.lengthSq()===0&&(Math.abs(i.z)===1?Un.x+=1e-4:Un.z+=1e-4,Un.normalize(),Tr.crossVectors(i,Un)),Tr.normalize(),fc.crossVectors(Un,Tr),r[0]=Tr.x,r[4]=fc.x,r[8]=Un.x,r[1]=Tr.y,r[5]=fc.y,r[9]=Un.y,r[2]=Tr.z,r[6]=fc.z,r[10]=Un.z,this}multiply(e){return this.multiplyMatrices(this,e)}premultiply(e){return this.multiplyMatrices(e,this)}multiplyMatrices(e,t){const i=e.elements,r=t.elements,s=this.elements,o=i[0],a=i[4],l=i[8],c=i[12],d=i[1],u=i[5],_=i[9],f=i[13],h=i[2],E=i[6],g=i[10],m=i[14],b=i[3],S=i[7],v=i[11],T=i[15],C=r[0],N=r[4],x=r[8],y=r[12],R=r[1],P=r[5],k=r[9],W=r[13],I=r[2],V=r[6],z=r[10],D=r[14],Y=r[3],K=r[7],q=r[11],le=r[15];return s[0]=o*C+a*R+l*I+c*Y,s[4]=o*N+a*P+l*V+c*K,s[8]=o*x+a*k+l*z+c*q,s[12]=o*y+a*W+l*D+c*le,s[1]=d*C+u*R+_*I+f*Y,s[5]=d*N+u*P+_*V+f*K,s[9]=d*x+u*k+_*z+f*q,s[13]=d*y+u*W+_*D+f*le,s[2]=h*C+E*R+g*I+m*Y,s[6]=h*N+E*P+g*V+m*K,s[10]=h*x+E*k+g*z+m*q,s[14]=h*y+E*W+g*D+m*le,s[3]=b*C+S*R+v*I+T*Y,s[7]=b*N+S*P+v*V+T*K,s[11]=b*x+S*k+v*z+T*q,s[15]=b*y+S*W+v*D+T*le,this}multiplyScalar(e){const t=this.elements;return t[0]*=e,t[4]*=e,t[8]*=e,t[12]*=e,t[1]*=e,t[5]*=e,t[9]*=e,t[13]*=e,t[2]*=e,t[6]*=e,t[10]*=e,t[14]*=e,t[3]*=e,t[7]*=e,t[11]*=e,t[15]*=e,this}determinant(){const e=this.elements,t=e[0],i=e[4],r=e[8],s=e[12],o=e[1],a=e[5],l=e[9],c=e[13],d=e[2],u=e[6],_=e[10],f=e[14],h=e[3],E=e[7],g=e[11],m=e[15];return h*(+s*l*u-r*c*u-s*a*_+i*c*_+r*a*f-i*l*f)+E*(+t*l*f-t*c*_+s*o*_-r*o*f+r*c*d-s*l*d)+g*(+t*c*u-t*a*f-s*o*u+i*o*f+s*a*d-i*c*d)+m*(-r*a*d-t*l*u+t*a*_+r*o*u-i*o*_+i*l*d)}transpose(){const e=this.elements;let t;return t=e[1],e[1]=e[4],e[4]=t,t=e[2],e[2]=e[8],e[8]=t,t=e[6],e[6]=e[9],e[9]=t,t=e[3],e[3]=e[12],e[12]=t,t=e[7],e[7]=e[13],e[13]=t,t=e[11],e[11]=e[14],e[14]=t,this}setPosition(e,t,i){const r=this.elements;return e.isVector3?(r[12]=e.x,r[13]=e.y,r[14]=e.z):(r[12]=e,r[13]=t,r[14]=i),this}invert(){const e=this.elements,t=e[0],i=e[1],r=e[2],s=e[3],o=e[4],a=e[5],l=e[6],c=e[7],d=e[8],u=e[9],_=e[10],f=e[11],h=e[12],E=e[13],g=e[14],m=e[15],b=u*g*c-E*_*c+E*l*f-a*g*f-u*l*m+a*_*m,S=h*_*c-d*g*c-h*l*f+o*g*f+d*l*m-o*_*m,v=d*E*c-h*u*c+h*a*f-o*E*f-d*a*m+o*u*m,T=h*u*l-d*E*l-h*a*_+o*E*_+d*a*g-o*u*g,C=t*b+i*S+r*v+s*T;if(C===0)return this.set(0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0);const N=1/C;return e[0]=b*N,e[1]=(E*_*s-u*g*s-E*r*f+i*g*f+u*r*m-i*_*m)*N,e[2]=(a*g*s-E*l*s+E*r*c-i*g*c-a*r*m+i*l*m)*N,e[3]=(u*l*s-a*_*s-u*r*c+i*_*c+a*r*f-i*l*f)*N,e[4]=S*N,e[5]=(d*g*s-h*_*s+h*r*f-t*g*f-d*r*m+t*_*m)*N,e[6]=(h*l*s-o*g*s-h*r*c+t*g*c+o*r*m-t*l*m)*N,e[7]=(o*_*s-d*l*s+d*r*c-t*_*c-o*r*f+t*l*f)*N,e[8]=v*N,e[9]=(h*u*s-d*E*s-h*i*f+t*E*f+d*i*m-t*u*m)*N,e[10]=(o*E*s-h*a*s+h*i*c-t*E*c-o*i*m+t*a*m)*N,e[11]=(d*a*s-o*u*s-d*i*c+t*u*c+o*i*f-t*a*f)*N,e[12]=T*N,e[13]=(d*E*r-h*u*r+h*i*_-t*E*_-d*i*g+t*u*g)*N,e[14]=(h*a*r-o*E*r-h*i*l+t*E*l+o*i*g-t*a*g)*N,e[15]=(o*u*r-d*a*r+d*i*l-t*u*l-o*i*_+t*a*_)*N,this}scale(e){const t=this.elements,i=e.x,r=e.y,s=e.z;return t[0]*=i,t[4]*=r,t[8]*=s,t[1]*=i,t[5]*=r,t[9]*=s,t[2]*=i,t[6]*=r,t[10]*=s,t[3]*=i,t[7]*=r,t[11]*=s,this}getMaxScaleOnAxis(){const e=this.elements,t=e[0]*e[0]+e[1]*e[1]+e[2]*e[2],i=e[4]*e[4]+e[5]*e[5]+e[6]*e[6],r=e[8]*e[8]+e[9]*e[9]+e[10]*e[10];return Math.sqrt(Math.max(t,i,r))}makeTranslation(e,t,i){return e.isVector3?this.set(1,0,0,e.x,0,1,0,e.y,0,0,1,e.z,0,0,0,1):this.set(1,0,0,e,0,1,0,t,0,0,1,i,0,0,0,1),this}makeRotationX(e){const t=Math.cos(e),i=Math.sin(e);return this.set(1,0,0,0,0,t,-i,0,0,i,t,0,0,0,0,1),this}makeRotationY(e){const t=Math.cos(e),i=Math.sin(e);return this.set(t,0,i,0,0,1,0,0,-i,0,t,0,0,0,0,1),this}makeRotationZ(e){const t=Math.cos(e),i=Math.sin(e);return this.set(t,-i,0,0,i,t,0,0,0,0,1,0,0,0,0,1),this}makeRotationAxis(e,t){const i=Math.cos(t),r=Math.sin(t),s=1-i,o=e.x,a=e.y,l=e.z,c=s*o,d=s*a;return this.set(c*o+i,c*a-r*l,c*l+r*a,0,c*a+r*l,d*a+i,d*l-r*o,0,c*l-r*a,d*l+r*o,s*l*l+i,0,0,0,0,1),this}makeScale(e,t,i){return this.set(e,0,0,0,0,t,0,0,0,0,i,0,0,0,0,1),this}makeShear(e,t,i,r,s,o){return this.set(1,i,s,0,e,1,o,0,t,r,1,0,0,0,0,1),this}compose(e,t,i){const r=this.elements,s=t._x,o=t._y,a=t._z,l=t._w,c=s+s,d=o+o,u=a+a,_=s*c,f=s*d,h=s*u,E=o*d,g=o*u,m=a*u,b=l*c,S=l*d,v=l*u,T=i.x,C=i.y,N=i.z;return r[0]=(1-(E+m))*T,r[1]=(f+v)*T,r[2]=(h-S)*T,r[3]=0,r[4]=(f-v)*C,r[5]=(1-(_+m))*C,r[6]=(g+b)*C,r[7]=0,r[8]=(h+S)*N,r[9]=(g-b)*N,r[10]=(1-(_+E))*N,r[11]=0,r[12]=e.x,r[13]=e.y,r[14]=e.z,r[15]=1,this}decompose(e,t,i){const r=this.elements;let s=ro.set(r[0],r[1],r[2]).length();const o=ro.set(r[4],r[5],r[6]).length(),a=ro.set(r[8],r[9],r[10]).length();this.determinant()<0&&(s=-s),e.x=r[12],e.y=r[13],e.z=r[14],oi.copy(this);const c=1/s,d=1/o,u=1/a;return oi.elements[0]*=c,oi.elements[1]*=c,oi.elements[2]*=c,oi.elements[4]*=d,oi.elements[5]*=d,oi.elements[6]*=d,oi.elements[8]*=u,oi.elements[9]*=u,oi.elements[10]*=u,t.setFromRotationMatrix(oi),i.x=s,i.y=o,i.z=a,this}makePerspective(e,t,i,r,s,o,a=nr){const l=this.elements,c=2*s/(t-e),d=2*s/(i-r),u=(t+e)/(t-e),_=(i+r)/(i-r);let f,h;if(a===nr)f=-(o+s)/(o-s),h=-2*o*s/(o-s);else if(a===Rd)f=-o/(o-s),h=-o*s/(o-s);else throw new Error("THREE.Matrix4.makePerspective(): Invalid coordinate system: "+a);return l[0]=c,l[4]=0,l[8]=u,l[12]=0,l[1]=0,l[5]=d,l[9]=_,l[13]=0,l[2]=0,l[6]=0,l[10]=f,l[14]=h,l[3]=0,l[7]=0,l[11]=-1,l[15]=0,this}makeOrthographic(e,t,i,r,s,o,a=nr){const l=this.elements,c=1/(t-e),d=1/(i-r),u=1/(o-s),_=(t+e)*c,f=(i+r)*d;let h,E;if(a===nr)h=(o+s)*u,E=-2*u;else if(a===Rd)h=s*u,E=-1*u;else throw new Error("THREE.Matrix4.makeOrthographic(): Invalid coordinate system: "+a);return l[0]=2*c,l[4]=0,l[8]=0,l[12]=-_,l[1]=0,l[5]=2*d,l[9]=0,l[13]=-f,l[2]=0,l[6]=0,l[10]=E,l[14]=-h,l[3]=0,l[7]=0,l[11]=0,l[15]=1,this}equals(e){const t=this.elements,i=e.elements;for(let r=0;r<16;r++)if(t[r]!==i[r])return!1;return!0}fromArray(e,t=0){for(let i=0;i<16;i++)this.elements[i]=e[i+t];return this}toArray(e=[],t=0){const i=this.elements;return e[t]=i[0],e[t+1]=i[1],e[t+2]=i[2],e[t+3]=i[3],e[t+4]=i[4],e[t+5]=i[5],e[t+6]=i[6],e[t+7]=i[7],e[t+8]=i[8],e[t+9]=i[9],e[t+10]=i[10],e[t+11]=i[11],e[t+12]=i[12],e[t+13]=i[13],e[t+14]=i[14],e[t+15]=i[15],e}}const ro=new ue,oi=new gt,Bgt=new ue(0,0,0),Ggt=new ue(1,1,1),Tr=new ue,fc=new ue,Un=new ue,lC=new gt,cC=new Xr;class cu{constructor(e=0,t=0,i=0,r=cu.DEFAULT_ORDER){this.isEuler=!0,this._x=e,this._y=t,this._z=i,this._order=r}get x(){return this._x}set x(e){this._x=e,this._onChangeCallback()}get y(){return this._y}set y(e){this._y=e,this._onChangeCallback()}get z(){return this._z}set z(e){this._z=e,this._onChangeCallback()}get order(){return this._order}set order(e){this._order=e,this._onChangeCallback()}set(e,t,i,r=this._order){return this._x=e,this._y=t,this._z=i,this._order=r,this._onChangeCallback(),this}clone(){return new this.constructor(this._x,this._y,this._z,this._order)}copy(e){return this._x=e._x,this._y=e._y,this._z=e._z,this._order=e._order,this._onChangeCallback(),this}setFromRotationMatrix(e,t=this._order,i=!0){const r=e.elements,s=r[0],o=r[4],a=r[8],l=r[1],c=r[5],d=r[9],u=r[2],_=r[6],f=r[10];switch(t){case"XYZ":this._y=Math.asin(En(a,-1,1)),Math.abs(a)<.9999999?(this._x=Math.atan2(-d,f),this._z=Math.atan2(-o,s)):(this._x=Math.atan2(_,c),this._z=0);break;case"YXZ":this._x=Math.asin(-En(d,-1,1)),Math.abs(d)<.9999999?(this._y=Math.atan2(a,f),this._z=Math.atan2(l,c)):(this._y=Math.atan2(-u,s),this._z=0);break;case"ZXY":this._x=Math.asin(En(_,-1,1)),Math.abs(_)<.9999999?(this._y=Math.atan2(-u,f),this._z=Math.atan2(-o,c)):(this._y=0,this._z=Math.atan2(l,s));break;case"ZYX":this._y=Math.asin(-En(u,-1,1)),Math.abs(u)<.9999999?(this._x=Math.atan2(_,f),this._z=Math.atan2(l,s)):(this._x=0,this._z=Math.atan2(-o,c));break;case"YZX":this._z=Math.asin(En(l,-1,1)),Math.abs(l)<.9999999?(this._x=Math.atan2(-d,c),this._y=Math.atan2(-u,s)):(this._x=0,this._y=Math.atan2(a,f));break;case"XZY":this._z=Math.asin(-En(o,-1,1)),Math.abs(o)<.9999999?(this._x=Math.atan2(_,c),this._y=Math.atan2(a,s)):(this._x=Math.atan2(-d,f),this._y=0);break;default:console.warn("THREE.Euler: .setFromRotationMatrix() encountered an unknown order: "+t)}return this._order=t,i===!0&&this._onChangeCallback(),this}setFromQuaternion(e,t,i){return lC.makeRotationFromQuaternion(e),this.setFromRotationMatrix(lC,t,i)}setFromVector3(e,t=this._order){return this.set(e.x,e.y,e.z,t)}reorder(e){return cC.setFromEuler(this),this.setFromQuaternion(cC,e)}equals(e){return e._x===this._x&&e._y===this._y&&e._z===this._z&&e._order===this._order}fromArray(e){return this._x=e[0],this._y=e[1],this._z=e[2],e[3]!==void 0&&(this._order=e[3]),this._onChangeCallback(),this}toArray(e=[],t=0){return e[t]=this._x,e[t+1]=this._y,e[t+2]=this._z,e[t+3]=this._order,e}_onChange(e){return this._onChangeCallback=e,this}_onChangeCallback(){}*[Symbol.iterator](){yield this._x,yield this._y,yield this._z,yield this._order}}cu.DEFAULT_ORDER="XYZ";class sO{constructor(){this.mask=1}set(e){this.mask=(1<>>0}enable(e){this.mask|=1<1){for(let t=0;t1){for(let i=0;i0&&(r.userData=this.userData),r.layers=this.layers.mask,r.matrix=this.matrix.toArray(),r.up=this.up.toArray(),this.matrixAutoUpdate===!1&&(r.matrixAutoUpdate=!1),this.isInstancedMesh&&(r.type="InstancedMesh",r.count=this.count,r.instanceMatrix=this.instanceMatrix.toJSON(),this.instanceColor!==null&&(r.instanceColor=this.instanceColor.toJSON())),this.isBatchedMesh&&(r.type="BatchedMesh",r.perObjectFrustumCulled=this.perObjectFrustumCulled,r.sortObjects=this.sortObjects,r.drawRanges=this._drawRanges,r.reservedRanges=this._reservedRanges,r.visibility=this._visibility,r.active=this._active,r.bounds=this._bounds.map(a=>({boxInitialized:a.boxInitialized,boxMin:a.box.min.toArray(),boxMax:a.box.max.toArray(),sphereInitialized:a.sphereInitialized,sphereRadius:a.sphere.radius,sphereCenter:a.sphere.center.toArray()})),r.maxGeometryCount=this._maxGeometryCount,r.maxVertexCount=this._maxVertexCount,r.maxIndexCount=this._maxIndexCount,r.geometryInitialized=this._geometryInitialized,r.geometryCount=this._geometryCount,r.matricesTexture=this._matricesTexture.toJSON(e),this.boundingSphere!==null&&(r.boundingSphere={center:r.boundingSphere.center.toArray(),radius:r.boundingSphere.radius}),this.boundingBox!==null&&(r.boundingBox={min:r.boundingBox.min.toArray(),max:r.boundingBox.max.toArray()}));function s(a,l){return a[l.uuid]===void 0&&(a[l.uuid]=l.toJSON(e)),l.uuid}if(this.isScene)this.background&&(this.background.isColor?r.background=this.background.toJSON():this.background.isTexture&&(r.background=this.background.toJSON(e).uuid)),this.environment&&this.environment.isTexture&&this.environment.isRenderTargetTexture!==!0&&(r.environment=this.environment.toJSON(e).uuid);else if(this.isMesh||this.isLine||this.isPoints){r.geometry=s(e.geometries,this.geometry);const a=this.geometry.parameters;if(a!==void 0&&a.shapes!==void 0){const l=a.shapes;if(Array.isArray(l))for(let c=0,d=l.length;c0){r.children=[];for(let a=0;a0){r.animations=[];for(let a=0;a0&&(i.geometries=a),l.length>0&&(i.materials=l),c.length>0&&(i.textures=c),d.length>0&&(i.images=d),u.length>0&&(i.shapes=u),_.length>0&&(i.skeletons=_),f.length>0&&(i.animations=f),h.length>0&&(i.nodes=h)}return i.object=r,i;function o(a){const l=[];for(const c in a){const d=a[c];delete d.metadata,l.push(d)}return l}}clone(e){return new this.constructor().copy(this,e)}copy(e,t=!0){if(this.name=e.name,this.up.copy(e.up),this.position.copy(e.position),this.rotation.order=e.rotation.order,this.quaternion.copy(e.quaternion),this.scale.copy(e.scale),this.matrix.copy(e.matrix),this.matrixWorld.copy(e.matrixWorld),this.matrixAutoUpdate=e.matrixAutoUpdate,this.matrixWorldAutoUpdate=e.matrixWorldAutoUpdate,this.matrixWorldNeedsUpdate=e.matrixWorldNeedsUpdate,this.layers.mask=e.layers.mask,this.visible=e.visible,this.castShadow=e.castShadow,this.receiveShadow=e.receiveShadow,this.frustumCulled=e.frustumCulled,this.renderOrder=e.renderOrder,this.animations=e.animations.slice(),this.userData=JSON.parse(JSON.stringify(e.userData)),t===!0)for(let i=0;i0?r.multiplyScalar(1/Math.sqrt(s)):r.set(0,0,0)}static getBarycoord(e,t,i,r,s){ai.subVectors(r,t),Ki.subVectors(i,t),Hf.subVectors(e,t);const o=ai.dot(ai),a=ai.dot(Ki),l=ai.dot(Hf),c=Ki.dot(Ki),d=Ki.dot(Hf),u=o*c-a*a;if(u===0)return s.set(-2,-1,-1);const _=1/u,f=(c*l-a*d)*_,h=(o*d-a*l)*_;return s.set(1-f-h,h,f)}static containsPoint(e,t,i,r){return this.getBarycoord(e,t,i,r,ji),ji.x>=0&&ji.y>=0&&ji.x+ji.y<=1}static getUV(e,t,i,r,s,o,a,l){return gc===!1&&(console.warn("THREE.Triangle.getUV() has been renamed to THREE.Triangle.getInterpolation()."),gc=!0),this.getInterpolation(e,t,i,r,s,o,a,l)}static getInterpolation(e,t,i,r,s,o,a,l){return this.getBarycoord(e,t,i,r,ji),l.setScalar(0),l.addScaledVector(s,ji.x),l.addScaledVector(o,ji.y),l.addScaledVector(a,ji.z),l}static isFrontFacing(e,t,i,r){return ai.subVectors(i,t),Ki.subVectors(e,t),ai.cross(Ki).dot(r)<0}set(e,t,i){return this.a.copy(e),this.b.copy(t),this.c.copy(i),this}setFromPointsAndIndices(e,t,i,r){return this.a.copy(e[t]),this.b.copy(e[i]),this.c.copy(e[r]),this}setFromAttributeAndIndices(e,t,i,r){return this.a.fromBufferAttribute(e,t),this.b.fromBufferAttribute(e,i),this.c.fromBufferAttribute(e,r),this}clone(){return new this.constructor().copy(this)}copy(e){return this.a.copy(e.a),this.b.copy(e.b),this.c.copy(e.c),this}getArea(){return ai.subVectors(this.c,this.b),Ki.subVectors(this.a,this.b),ai.cross(Ki).length()*.5}getMidpoint(e){return e.addVectors(this.a,this.b).add(this.c).multiplyScalar(1/3)}getNormal(e){return di.getNormal(this.a,this.b,this.c,e)}getPlane(e){return e.setFromCoplanarPoints(this.a,this.b,this.c)}getBarycoord(e,t){return di.getBarycoord(e,this.a,this.b,this.c,t)}getUV(e,t,i,r,s){return gc===!1&&(console.warn("THREE.Triangle.getUV() has been renamed to THREE.Triangle.getInterpolation()."),gc=!0),di.getInterpolation(e,this.a,this.b,this.c,t,i,r,s)}getInterpolation(e,t,i,r,s){return di.getInterpolation(e,this.a,this.b,this.c,t,i,r,s)}containsPoint(e){return di.containsPoint(e,this.a,this.b,this.c)}isFrontFacing(e){return di.isFrontFacing(this.a,this.b,this.c,e)}intersectsBox(e){return e.intersectsTriangle(this)}closestPointToPoint(e,t){const i=this.a,r=this.b,s=this.c;let o,a;oo.subVectors(r,i),ao.subVectors(s,i),qf.subVectors(e,i);const l=oo.dot(qf),c=ao.dot(qf);if(l<=0&&c<=0)return t.copy(i);Yf.subVectors(e,r);const d=oo.dot(Yf),u=ao.dot(Yf);if(d>=0&&u<=d)return t.copy(r);const _=l*u-d*c;if(_<=0&&l>=0&&d<=0)return o=l/(l-d),t.copy(i).addScaledVector(oo,o);$f.subVectors(e,s);const f=oo.dot($f),h=ao.dot($f);if(h>=0&&f<=h)return t.copy(s);const E=f*c-l*h;if(E<=0&&c>=0&&h<=0)return a=c/(c-h),t.copy(i).addScaledVector(ao,a);const g=d*h-f*u;if(g<=0&&u-d>=0&&f-h>=0)return hC.subVectors(s,r),a=(u-d)/(u-d+(f-h)),t.copy(r).addScaledVector(hC,a);const m=1/(g+E+_);return o=E*m,a=_*m,t.copy(i).addScaledVector(oo,o).addScaledVector(ao,a)}equals(e){return e.a.equals(this.a)&&e.b.equals(this.b)&&e.c.equals(this.c)}}const oO={aliceblue:15792383,antiquewhite:16444375,aqua:65535,aquamarine:8388564,azure:15794175,beige:16119260,bisque:16770244,black:0,blanchedalmond:16772045,blue:255,blueviolet:9055202,brown:10824234,burlywood:14596231,cadetblue:6266528,chartreuse:8388352,chocolate:13789470,coral:16744272,cornflowerblue:6591981,cornsilk:16775388,crimson:14423100,cyan:65535,darkblue:139,darkcyan:35723,darkgoldenrod:12092939,darkgray:11119017,darkgreen:25600,darkgrey:11119017,darkkhaki:12433259,darkmagenta:9109643,darkolivegreen:5597999,darkorange:16747520,darkorchid:10040012,darkred:9109504,darksalmon:15308410,darkseagreen:9419919,darkslateblue:4734347,darkslategray:3100495,darkslategrey:3100495,darkturquoise:52945,darkviolet:9699539,deeppink:16716947,deepskyblue:49151,dimgray:6908265,dimgrey:6908265,dodgerblue:2003199,firebrick:11674146,floralwhite:16775920,forestgreen:2263842,fuchsia:16711935,gainsboro:14474460,ghostwhite:16316671,gold:16766720,goldenrod:14329120,gray:8421504,green:32768,greenyellow:11403055,grey:8421504,honeydew:15794160,hotpink:16738740,indianred:13458524,indigo:4915330,ivory:16777200,khaki:15787660,lavender:15132410,lavenderblush:16773365,lawngreen:8190976,lemonchiffon:16775885,lightblue:11393254,lightcoral:15761536,lightcyan:14745599,lightgoldenrodyellow:16448210,lightgray:13882323,lightgreen:9498256,lightgrey:13882323,lightpink:16758465,lightsalmon:16752762,lightseagreen:2142890,lightskyblue:8900346,lightslategray:7833753,lightslategrey:7833753,lightsteelblue:11584734,lightyellow:16777184,lime:65280,limegreen:3329330,linen:16445670,magenta:16711935,maroon:8388608,mediumaquamarine:6737322,mediumblue:205,mediumorchid:12211667,mediumpurple:9662683,mediumseagreen:3978097,mediumslateblue:8087790,mediumspringgreen:64154,mediumturquoise:4772300,mediumvioletred:13047173,midnightblue:1644912,mintcream:16121850,mistyrose:16770273,moccasin:16770229,navajowhite:16768685,navy:128,oldlace:16643558,olive:8421376,olivedrab:7048739,orange:16753920,orangered:16729344,orchid:14315734,palegoldenrod:15657130,palegreen:10025880,paleturquoise:11529966,palevioletred:14381203,papayawhip:16773077,peachpuff:16767673,peru:13468991,pink:16761035,plum:14524637,powderblue:11591910,purple:8388736,rebeccapurple:6697881,red:16711680,rosybrown:12357519,royalblue:4286945,saddlebrown:9127187,salmon:16416882,sandybrown:16032864,seagreen:3050327,seashell:16774638,sienna:10506797,silver:12632256,skyblue:8900331,slateblue:6970061,slategray:7372944,slategrey:7372944,snow:16775930,springgreen:65407,steelblue:4620980,tan:13808780,teal:32896,thistle:14204888,tomato:16737095,turquoise:4251856,violet:15631086,wheat:16113331,white:16777215,whitesmoke:16119285,yellow:16776960,yellowgreen:10145074},xr={h:0,s:0,l:0},Ec={h:0,s:0,l:0};function Wf(n,e,t){return t<0&&(t+=1),t>1&&(t-=1),t<1/6?n+(e-n)*6*t:t<1/2?e:t<2/3?n+(e-n)*6*(2/3-t):n}class ot{constructor(e,t,i){return this.isColor=!0,this.r=1,this.g=1,this.b=1,this.set(e,t,i)}set(e,t,i){if(t===void 0&&i===void 0){const r=e;r&&r.isColor?this.copy(r):typeof r=="number"?this.setHex(r):typeof r=="string"&&this.setStyle(r)}else this.setRGB(e,t,i);return this}setScalar(e){return this.r=e,this.g=e,this.b=e,this}setHex(e,t=Kt){return e=Math.floor(e),this.r=(e>>16&255)/255,this.g=(e>>8&255)/255,this.b=(e&255)/255,Nt.toWorkingColorSpace(this,t),this}setRGB(e,t,i,r=Nt.workingColorSpace){return this.r=e,this.g=t,this.b=i,Nt.toWorkingColorSpace(this,r),this}setHSL(e,t,i,r=Nt.workingColorSpace){if(e=BE(e,1),t=En(t,0,1),i=En(i,0,1),t===0)this.r=this.g=this.b=i;else{const s=i<=.5?i*(1+t):i+t-i*t,o=2*i-s;this.r=Wf(o,s,e+1/3),this.g=Wf(o,s,e),this.b=Wf(o,s,e-1/3)}return Nt.toWorkingColorSpace(this,r),this}setStyle(e,t=Kt){function i(s){s!==void 0&&parseFloat(s)<1&&console.warn("THREE.Color: Alpha component of "+e+" will be ignored.")}let r;if(r=/^(\w+)\(([^\)]*)\)/.exec(e)){let s;const o=r[1],a=r[2];switch(o){case"rgb":case"rgba":if(s=/^\s*(\d+)\s*,\s*(\d+)\s*,\s*(\d+)\s*(?:,\s*(\d*\.?\d+)\s*)?$/.exec(a))return i(s[4]),this.setRGB(Math.min(255,parseInt(s[1],10))/255,Math.min(255,parseInt(s[2],10))/255,Math.min(255,parseInt(s[3],10))/255,t);if(s=/^\s*(\d+)\%\s*,\s*(\d+)\%\s*,\s*(\d+)\%\s*(?:,\s*(\d*\.?\d+)\s*)?$/.exec(a))return i(s[4]),this.setRGB(Math.min(100,parseInt(s[1],10))/100,Math.min(100,parseInt(s[2],10))/100,Math.min(100,parseInt(s[3],10))/100,t);break;case"hsl":case"hsla":if(s=/^\s*(\d*\.?\d+)\s*,\s*(\d*\.?\d+)\%\s*,\s*(\d*\.?\d+)\%\s*(?:,\s*(\d*\.?\d+)\s*)?$/.exec(a))return i(s[4]),this.setHSL(parseFloat(s[1])/360,parseFloat(s[2])/100,parseFloat(s[3])/100,t);break;default:console.warn("THREE.Color: Unknown color model "+e)}}else if(r=/^\#([A-Fa-f\d]+)$/.exec(e)){const s=r[1],o=s.length;if(o===3)return this.setRGB(parseInt(s.charAt(0),16)/15,parseInt(s.charAt(1),16)/15,parseInt(s.charAt(2),16)/15,t);if(o===6)return this.setHex(parseInt(s,16),t);console.warn("THREE.Color: Invalid hex color "+e)}else if(e&&e.length>0)return this.setColorName(e,t);return this}setColorName(e,t=Kt){const i=oO[e.toLowerCase()];return i!==void 0?this.setHex(i,t):console.warn("THREE.Color: Unknown color "+e),this}clone(){return new this.constructor(this.r,this.g,this.b)}copy(e){return this.r=e.r,this.g=e.g,this.b=e.b,this}copySRGBToLinear(e){return this.r=Mo(e.r),this.g=Mo(e.g),this.b=Mo(e.b),this}copyLinearToSRGB(e){return this.r=kf(e.r),this.g=kf(e.g),this.b=kf(e.b),this}convertSRGBToLinear(){return this.copySRGBToLinear(this),this}convertLinearToSRGB(){return this.copyLinearToSRGB(this),this}getHex(e=Kt){return Nt.fromWorkingColorSpace(gn.copy(this),e),Math.round(En(gn.r*255,0,255))*65536+Math.round(En(gn.g*255,0,255))*256+Math.round(En(gn.b*255,0,255))}getHexString(e=Kt){return("000000"+this.getHex(e).toString(16)).slice(-6)}getHSL(e,t=Nt.workingColorSpace){Nt.fromWorkingColorSpace(gn.copy(this),t);const i=gn.r,r=gn.g,s=gn.b,o=Math.max(i,r,s),a=Math.min(i,r,s);let l,c;const d=(a+o)/2;if(a===o)l=0,c=0;else{const u=o-a;switch(c=d<=.5?u/(o+a):u/(2-o-a),o){case i:l=(r-s)/u+(r0!=e>0&&this.version++,this._alphaTest=e}onBuild(){}onBeforeRender(){}onBeforeCompile(){}customProgramCacheKey(){return this.onBeforeCompile.toString()}setValues(e){if(e!==void 0)for(const t in e){const i=e[t];if(i===void 0){console.warn(`THREE.Material: parameter '${t}' has value of undefined.`);continue}const r=this[t];if(r===void 0){console.warn(`THREE.Material: '${t}' is not a property of THREE.${this.type}.`);continue}r&&r.isColor?r.set(i):r&&r.isVector3&&i&&i.isVector3?r.copy(i):this[t]=i}}toJSON(e){const t=e===void 0||typeof e=="string";t&&(e={textures:{},images:{}});const i={metadata:{version:4.6,type:"Material",generator:"Material.toJSON"}};i.uuid=this.uuid,i.type=this.type,this.name!==""&&(i.name=this.name),this.color&&this.color.isColor&&(i.color=this.color.getHex()),this.roughness!==void 0&&(i.roughness=this.roughness),this.metalness!==void 0&&(i.metalness=this.metalness),this.sheen!==void 0&&(i.sheen=this.sheen),this.sheenColor&&this.sheenColor.isColor&&(i.sheenColor=this.sheenColor.getHex()),this.sheenRoughness!==void 0&&(i.sheenRoughness=this.sheenRoughness),this.emissive&&this.emissive.isColor&&(i.emissive=this.emissive.getHex()),this.emissiveIntensity&&this.emissiveIntensity!==1&&(i.emissiveIntensity=this.emissiveIntensity),this.specular&&this.specular.isColor&&(i.specular=this.specular.getHex()),this.specularIntensity!==void 0&&(i.specularIntensity=this.specularIntensity),this.specularColor&&this.specularColor.isColor&&(i.specularColor=this.specularColor.getHex()),this.shininess!==void 0&&(i.shininess=this.shininess),this.clearcoat!==void 0&&(i.clearcoat=this.clearcoat),this.clearcoatRoughness!==void 0&&(i.clearcoatRoughness=this.clearcoatRoughness),this.clearcoatMap&&this.clearcoatMap.isTexture&&(i.clearcoatMap=this.clearcoatMap.toJSON(e).uuid),this.clearcoatRoughnessMap&&this.clearcoatRoughnessMap.isTexture&&(i.clearcoatRoughnessMap=this.clearcoatRoughnessMap.toJSON(e).uuid),this.clearcoatNormalMap&&this.clearcoatNormalMap.isTexture&&(i.clearcoatNormalMap=this.clearcoatNormalMap.toJSON(e).uuid,i.clearcoatNormalScale=this.clearcoatNormalScale.toArray()),this.iridescence!==void 0&&(i.iridescence=this.iridescence),this.iridescenceIOR!==void 0&&(i.iridescenceIOR=this.iridescenceIOR),this.iridescenceThicknessRange!==void 0&&(i.iridescenceThicknessRange=this.iridescenceThicknessRange),this.iridescenceMap&&this.iridescenceMap.isTexture&&(i.iridescenceMap=this.iridescenceMap.toJSON(e).uuid),this.iridescenceThicknessMap&&this.iridescenceThicknessMap.isTexture&&(i.iridescenceThicknessMap=this.iridescenceThicknessMap.toJSON(e).uuid),this.anisotropy!==void 0&&(i.anisotropy=this.anisotropy),this.anisotropyRotation!==void 0&&(i.anisotropyRotation=this.anisotropyRotation),this.anisotropyMap&&this.anisotropyMap.isTexture&&(i.anisotropyMap=this.anisotropyMap.toJSON(e).uuid),this.map&&this.map.isTexture&&(i.map=this.map.toJSON(e).uuid),this.matcap&&this.matcap.isTexture&&(i.matcap=this.matcap.toJSON(e).uuid),this.alphaMap&&this.alphaMap.isTexture&&(i.alphaMap=this.alphaMap.toJSON(e).uuid),this.lightMap&&this.lightMap.isTexture&&(i.lightMap=this.lightMap.toJSON(e).uuid,i.lightMapIntensity=this.lightMapIntensity),this.aoMap&&this.aoMap.isTexture&&(i.aoMap=this.aoMap.toJSON(e).uuid,i.aoMapIntensity=this.aoMapIntensity),this.bumpMap&&this.bumpMap.isTexture&&(i.bumpMap=this.bumpMap.toJSON(e).uuid,i.bumpScale=this.bumpScale),this.normalMap&&this.normalMap.isTexture&&(i.normalMap=this.normalMap.toJSON(e).uuid,i.normalMapType=this.normalMapType,i.normalScale=this.normalScale.toArray()),this.displacementMap&&this.displacementMap.isTexture&&(i.displacementMap=this.displacementMap.toJSON(e).uuid,i.displacementScale=this.displacementScale,i.displacementBias=this.displacementBias),this.roughnessMap&&this.roughnessMap.isTexture&&(i.roughnessMap=this.roughnessMap.toJSON(e).uuid),this.metalnessMap&&this.metalnessMap.isTexture&&(i.metalnessMap=this.metalnessMap.toJSON(e).uuid),this.emissiveMap&&this.emissiveMap.isTexture&&(i.emissiveMap=this.emissiveMap.toJSON(e).uuid),this.specularMap&&this.specularMap.isTexture&&(i.specularMap=this.specularMap.toJSON(e).uuid),this.specularIntensityMap&&this.specularIntensityMap.isTexture&&(i.specularIntensityMap=this.specularIntensityMap.toJSON(e).uuid),this.specularColorMap&&this.specularColorMap.isTexture&&(i.specularColorMap=this.specularColorMap.toJSON(e).uuid),this.envMap&&this.envMap.isTexture&&(i.envMap=this.envMap.toJSON(e).uuid,this.combine!==void 0&&(i.combine=this.combine)),this.envMapIntensity!==void 0&&(i.envMapIntensity=this.envMapIntensity),this.reflectivity!==void 0&&(i.reflectivity=this.reflectivity),this.refractionRatio!==void 0&&(i.refractionRatio=this.refractionRatio),this.gradientMap&&this.gradientMap.isTexture&&(i.gradientMap=this.gradientMap.toJSON(e).uuid),this.transmission!==void 0&&(i.transmission=this.transmission),this.transmissionMap&&this.transmissionMap.isTexture&&(i.transmissionMap=this.transmissionMap.toJSON(e).uuid),this.thickness!==void 0&&(i.thickness=this.thickness),this.thicknessMap&&this.thicknessMap.isTexture&&(i.thicknessMap=this.thicknessMap.toJSON(e).uuid),this.attenuationDistance!==void 0&&this.attenuationDistance!==1/0&&(i.attenuationDistance=this.attenuationDistance),this.attenuationColor!==void 0&&(i.attenuationColor=this.attenuationColor.getHex()),this.size!==void 0&&(i.size=this.size),this.shadowSide!==null&&(i.shadowSide=this.shadowSide),this.sizeAttenuation!==void 0&&(i.sizeAttenuation=this.sizeAttenuation),this.blending!==No&&(i.blending=this.blending),this.side!==cr&&(i.side=this.side),this.vertexColors===!0&&(i.vertexColors=!0),this.opacity<1&&(i.opacity=this.opacity),this.transparent===!0&&(i.transparent=!0),this.blendSrc!==jm&&(i.blendSrc=this.blendSrc),this.blendDst!==Qm&&(i.blendDst=this.blendDst),this.blendEquation!==bs&&(i.blendEquation=this.blendEquation),this.blendSrcAlpha!==null&&(i.blendSrcAlpha=this.blendSrcAlpha),this.blendDstAlpha!==null&&(i.blendDstAlpha=this.blendDstAlpha),this.blendEquationAlpha!==null&&(i.blendEquationAlpha=this.blendEquationAlpha),this.blendColor&&this.blendColor.isColor&&(i.blendColor=this.blendColor.getHex()),this.blendAlpha!==0&&(i.blendAlpha=this.blendAlpha),this.depthFunc!==yd&&(i.depthFunc=this.depthFunc),this.depthTest===!1&&(i.depthTest=this.depthTest),this.depthWrite===!1&&(i.depthWrite=this.depthWrite),this.colorWrite===!1&&(i.colorWrite=this.colorWrite),this.stencilWriteMask!==255&&(i.stencilWriteMask=this.stencilWriteMask),this.stencilFunc!==tC&&(i.stencilFunc=this.stencilFunc),this.stencilRef!==0&&(i.stencilRef=this.stencilRef),this.stencilFuncMask!==255&&(i.stencilFuncMask=this.stencilFuncMask),this.stencilFail!==Js&&(i.stencilFail=this.stencilFail),this.stencilZFail!==Js&&(i.stencilZFail=this.stencilZFail),this.stencilZPass!==Js&&(i.stencilZPass=this.stencilZPass),this.stencilWrite===!0&&(i.stencilWrite=this.stencilWrite),this.rotation!==void 0&&this.rotation!==0&&(i.rotation=this.rotation),this.polygonOffset===!0&&(i.polygonOffset=!0),this.polygonOffsetFactor!==0&&(i.polygonOffsetFactor=this.polygonOffsetFactor),this.polygonOffsetUnits!==0&&(i.polygonOffsetUnits=this.polygonOffsetUnits),this.linewidth!==void 0&&this.linewidth!==1&&(i.linewidth=this.linewidth),this.dashSize!==void 0&&(i.dashSize=this.dashSize),this.gapSize!==void 0&&(i.gapSize=this.gapSize),this.scale!==void 0&&(i.scale=this.scale),this.dithering===!0&&(i.dithering=!0),this.alphaTest>0&&(i.alphaTest=this.alphaTest),this.alphaHash===!0&&(i.alphaHash=!0),this.alphaToCoverage===!0&&(i.alphaToCoverage=!0),this.premultipliedAlpha===!0&&(i.premultipliedAlpha=!0),this.forceSinglePass===!0&&(i.forceSinglePass=!0),this.wireframe===!0&&(i.wireframe=!0),this.wireframeLinewidth>1&&(i.wireframeLinewidth=this.wireframeLinewidth),this.wireframeLinecap!=="round"&&(i.wireframeLinecap=this.wireframeLinecap),this.wireframeLinejoin!=="round"&&(i.wireframeLinejoin=this.wireframeLinejoin),this.flatShading===!0&&(i.flatShading=!0),this.visible===!1&&(i.visible=!1),this.toneMapped===!1&&(i.toneMapped=!1),this.fog===!1&&(i.fog=!1),Object.keys(this.userData).length>0&&(i.userData=this.userData);function r(s){const o=[];for(const a in s){const l=s[a];delete l.metadata,o.push(l)}return o}if(t){const s=r(e.textures),o=r(e.images);s.length>0&&(i.textures=s),o.length>0&&(i.images=o)}return i}clone(){return new this.constructor().copy(this)}copy(e){this.name=e.name,this.blending=e.blending,this.side=e.side,this.vertexColors=e.vertexColors,this.opacity=e.opacity,this.transparent=e.transparent,this.blendSrc=e.blendSrc,this.blendDst=e.blendDst,this.blendEquation=e.blendEquation,this.blendSrcAlpha=e.blendSrcAlpha,this.blendDstAlpha=e.blendDstAlpha,this.blendEquationAlpha=e.blendEquationAlpha,this.blendColor.copy(e.blendColor),this.blendAlpha=e.blendAlpha,this.depthFunc=e.depthFunc,this.depthTest=e.depthTest,this.depthWrite=e.depthWrite,this.stencilWriteMask=e.stencilWriteMask,this.stencilFunc=e.stencilFunc,this.stencilRef=e.stencilRef,this.stencilFuncMask=e.stencilFuncMask,this.stencilFail=e.stencilFail,this.stencilZFail=e.stencilZFail,this.stencilZPass=e.stencilZPass,this.stencilWrite=e.stencilWrite;const t=e.clippingPlanes;let i=null;if(t!==null){const r=t.length;i=new Array(r);for(let s=0;s!==r;++s)i[s]=t[s].clone()}return this.clippingPlanes=i,this.clipIntersection=e.clipIntersection,this.clipShadows=e.clipShadows,this.shadowSide=e.shadowSide,this.colorWrite=e.colorWrite,this.precision=e.precision,this.polygonOffset=e.polygonOffset,this.polygonOffsetFactor=e.polygonOffsetFactor,this.polygonOffsetUnits=e.polygonOffsetUnits,this.dithering=e.dithering,this.alphaTest=e.alphaTest,this.alphaHash=e.alphaHash,this.alphaToCoverage=e.alphaToCoverage,this.premultipliedAlpha=e.premultipliedAlpha,this.forceSinglePass=e.forceSinglePass,this.visible=e.visible,this.toneMapped=e.toneMapped,this.userData=JSON.parse(JSON.stringify(e.userData)),this}dispose(){this.dispatchEvent({type:"dispose"})}set needsUpdate(e){e===!0&&this.version++}}class Fr extends mi{constructor(e){super(),this.isMeshBasicMaterial=!0,this.type="MeshBasicMaterial",this.color=new ot(16777215),this.map=null,this.lightMap=null,this.lightMapIntensity=1,this.aoMap=null,this.aoMapIntensity=1,this.specularMap=null,this.alphaMap=null,this.envMap=null,this.combine=kE,this.reflectivity=1,this.refractionRatio=.98,this.wireframe=!1,this.wireframeLinewidth=1,this.wireframeLinecap="round",this.wireframeLinejoin="round",this.fog=!0,this.setValues(e)}copy(e){return super.copy(e),this.color.copy(e.color),this.map=e.map,this.lightMap=e.lightMap,this.lightMapIntensity=e.lightMapIntensity,this.aoMap=e.aoMap,this.aoMapIntensity=e.aoMapIntensity,this.specularMap=e.specularMap,this.alphaMap=e.alphaMap,this.envMap=e.envMap,this.combine=e.combine,this.reflectivity=e.reflectivity,this.refractionRatio=e.refractionRatio,this.wireframe=e.wireframe,this.wireframeLinewidth=e.wireframeLinewidth,this.wireframeLinecap=e.wireframeLinecap,this.wireframeLinejoin=e.wireframeLinejoin,this.fog=e.fog,this}}const Zt=new ue,bc=new vt;class wn{constructor(e,t,i=!1){if(Array.isArray(e))throw new TypeError("THREE.BufferAttribute: array should be a Typed Array.");this.isBufferAttribute=!0,this.name="",this.array=e,this.itemSize=t,this.count=e!==void 0?e.length/t:0,this.normalized=i,this.usage=tg,this._updateRange={offset:0,count:-1},this.updateRanges=[],this.gpuType=tr,this.version=0}onUploadCallback(){}set needsUpdate(e){e===!0&&this.version++}get updateRange(){return console.warn('THREE.BufferAttribute: "updateRange" is deprecated and removed in r169. Use "addUpdateRange()" instead.'),this._updateRange}setUsage(e){return this.usage=e,this}addUpdateRange(e,t){this.updateRanges.push({start:e,count:t})}clearUpdateRanges(){this.updateRanges.length=0}copy(e){return this.name=e.name,this.array=new e.array.constructor(e.array),this.itemSize=e.itemSize,this.count=e.count,this.normalized=e.normalized,this.usage=e.usage,this.gpuType=e.gpuType,this}copyAt(e,t,i){e*=this.itemSize,i*=t.itemSize;for(let r=0,s=this.itemSize;r0&&(e.userData=this.userData),this.parameters!==void 0){const l=this.parameters;for(const c in l)l[c]!==void 0&&(e[c]=l[c]);return e}e.data={attributes:{}};const t=this.index;t!==null&&(e.data.index={type:t.array.constructor.name,array:Array.prototype.slice.call(t.array)});const i=this.attributes;for(const l in i){const c=i[l];e.data.attributes[l]=c.toJSON(e.data)}const r={};let s=!1;for(const l in this.morphAttributes){const c=this.morphAttributes[l],d=[];for(let u=0,_=c.length;u<_;u++){const f=c[u];d.push(f.toJSON(e.data))}d.length>0&&(r[l]=d,s=!0)}s&&(e.data.morphAttributes=r,e.data.morphTargetsRelative=this.morphTargetsRelative);const o=this.groups;o.length>0&&(e.data.groups=JSON.parse(JSON.stringify(o)));const a=this.boundingSphere;return a!==null&&(e.data.boundingSphere={center:a.center.toArray(),radius:a.radius}),e}clone(){return new this.constructor().copy(this)}copy(e){this.index=null,this.attributes={},this.morphAttributes={},this.groups=[],this.boundingBox=null,this.boundingSphere=null;const t={};this.name=e.name;const i=e.index;i!==null&&this.setIndex(i.clone(t));const r=e.attributes;for(const c in r){const d=r[c];this.setAttribute(c,d.clone(t))}const s=e.morphAttributes;for(const c in s){const d=[],u=s[c];for(let _=0,f=u.length;_0){const r=t[i[0]];if(r!==void 0){this.morphTargetInfluences=[],this.morphTargetDictionary={};for(let s=0,o=r.length;s(e.far-e.near)**2))&&(fC.copy(s).invert(),ls.copy(e.ray).applyMatrix4(fC),!(i.boundingBox!==null&&ls.intersectsBox(i.boundingBox)===!1)&&this._computeIntersections(e,t,ls)))}_computeIntersections(e,t,i){let r;const s=this.geometry,o=this.material,a=s.index,l=s.attributes.position,c=s.attributes.uv,d=s.attributes.uv1,u=s.attributes.normal,_=s.groups,f=s.drawRange;if(a!==null)if(Array.isArray(o))for(let h=0,E=_.length;ht.far?null:{distance:c,point:Rc.clone(),object:n}}function Ac(n,e,t,i,r,s,o,a,l,c){n.getVertexPosition(a,co),n.getVertexPosition(l,uo),n.getVertexPosition(c,_o);const d=Kgt(n,e,t,i,co,uo,_o,Cc);if(d){r&&(vc.fromBufferAttribute(r,a),Tc.fromBufferAttribute(r,l),xc.fromBufferAttribute(r,c),d.uv=di.getInterpolation(Cc,co,uo,_o,vc,Tc,xc,new vt)),s&&(vc.fromBufferAttribute(s,a),Tc.fromBufferAttribute(s,l),xc.fromBufferAttribute(s,c),d.uv1=di.getInterpolation(Cc,co,uo,_o,vc,Tc,xc,new vt),d.uv2=d.uv1),o&&(gC.fromBufferAttribute(o,a),EC.fromBufferAttribute(o,l),bC.fromBufferAttribute(o,c),d.normal=di.getInterpolation(Cc,co,uo,_o,gC,EC,bC,new ue),d.normal.dot(i.direction)>0&&d.normal.multiplyScalar(-1));const u={a,b:l,c,normal:new ue,materialIndex:0};di.getNormal(co,uo,_o,u.normal),d.face=u}return d}class $r extends Fi{constructor(e=1,t=1,i=1,r=1,s=1,o=1){super(),this.type="BoxGeometry",this.parameters={width:e,height:t,depth:i,widthSegments:r,heightSegments:s,depthSegments:o};const a=this;r=Math.floor(r),s=Math.floor(s),o=Math.floor(o);const l=[],c=[],d=[],u=[];let _=0,f=0;h("z","y","x",-1,-1,i,t,e,o,s,0),h("z","y","x",1,-1,i,t,-e,o,s,1),h("x","z","y",1,1,e,i,t,r,o,2),h("x","z","y",1,-1,e,i,-t,r,o,3),h("x","y","z",1,-1,e,t,i,r,s,4),h("x","y","z",-1,-1,e,t,-i,r,s,5),this.setIndex(l),this.setAttribute("position",new sr(c,3)),this.setAttribute("normal",new sr(d,3)),this.setAttribute("uv",new sr(u,2));function h(E,g,m,b,S,v,T,C,N,x,y){const R=v/N,P=T/x,k=v/2,W=T/2,I=C/2,V=N+1,z=x+1;let D=0,Y=0;const K=new ue;for(let q=0;q0?1:-1,d.push(K.x,K.y,K.z),u.push(Z/N),u.push(1-q/x),D+=1}}for(let q=0;q>8&255]+mn[n>>16&255]+mn[n>>24&255]+"-"+mn[e&255]+mn[e>>8&255]+"-"+mn[e>>16&15|64]+mn[e>>24&255]+"-"+mn[t&63|128]+mn[t>>8&255]+"-"+mn[t>>16&255]+mn[t>>24&255]+mn[i&255]+mn[i>>8&255]+mn[i>>16&255]+mn[i>>24&255]).toLowerCase()}function En(n,e,t){return Math.max(e,Math.min(t,n))}function BE(n,e){return(n%e+e)%e}function ygt(n,e,t,i,r){return i+(n-e)*(r-i)/(t-e)}function vgt(n,e,t){return n!==e?(t-n)/(e-n):0}function nl(n,e,t){return(1-t)*n+t*e}function Tgt(n,e,t,i){return nl(n,e,1-Math.exp(-t*i))}function xgt(n,e=1){return e-Math.abs(BE(n,e*2)-e)}function Cgt(n,e,t){return n<=e?0:n>=t?1:(n=(n-e)/(t-e),n*n*(3-2*n))}function Rgt(n,e,t){return n<=e?0:n>=t?1:(n=(n-e)/(t-e),n*n*n*(n*(n*6-15)+10))}function Agt(n,e){return n+Math.floor(Math.random()*(e-n+1))}function wgt(n,e){return n+Math.random()*(e-n)}function Ogt(n){return n*(.5-Math.random())}function Ngt(n){n!==void 0&&(iC=n);let e=iC+=1831565813;return e=Math.imul(e^e>>>15,e|1),e^=e+Math.imul(e^e>>>7,e|61),((e^e>>>14)>>>0)/4294967296}function Mgt(n){return n*tl}function Igt(n){return n*ea}function ig(n){return(n&n-1)===0&&n!==0}function Dgt(n){return Math.pow(2,Math.ceil(Math.log(n)/Math.LN2))}function Ad(n){return Math.pow(2,Math.floor(Math.log(n)/Math.LN2))}function Lgt(n,e,t,i,r){const s=Math.cos,o=Math.sin,a=s(t/2),l=o(t/2),c=s((e+i)/2),d=o((e+i)/2),u=s((e-i)/2),_=o((e-i)/2),f=s((i-e)/2),h=o((i-e)/2);switch(r){case"XYX":n.set(a*d,l*u,l*_,a*c);break;case"YZY":n.set(l*_,a*d,l*u,a*c);break;case"ZXZ":n.set(l*u,l*_,a*d,a*c);break;case"XZX":n.set(a*d,l*h,l*f,a*c);break;case"YXY":n.set(l*f,a*d,l*h,a*c);break;case"ZYZ":n.set(l*h,l*f,a*d,a*c);break;default:console.warn("THREE.MathUtils: .setQuaternionFromProperEuler() encountered an unknown order: "+r)}}function Ci(n,e){switch(e.constructor){case Float32Array:return n;case Uint32Array:return n/4294967295;case Uint16Array:return n/65535;case Uint8Array:return n/255;case Int32Array:return Math.max(n/2147483647,-1);case Int16Array:return Math.max(n/32767,-1);case Int8Array:return Math.max(n/127,-1);default:throw new Error("Invalid component type.")}}function kt(n,e){switch(e.constructor){case Float32Array:return n;case Uint32Array:return Math.round(n*4294967295);case Uint16Array:return Math.round(n*65535);case Uint8Array:return Math.round(n*255);case Int32Array:return Math.round(n*2147483647);case Int16Array:return Math.round(n*32767);case Int8Array:return Math.round(n*127);default:throw new Error("Invalid component type.")}}const kgt={DEG2RAD:tl,RAD2DEG:ea,generateUUID:fi,clamp:En,euclideanModulo:BE,mapLinear:ygt,inverseLerp:vgt,lerp:nl,damp:Tgt,pingpong:xgt,smoothstep:Cgt,smootherstep:Rgt,randInt:Agt,randFloat:wgt,randFloatSpread:Ogt,seededRandom:Ngt,degToRad:Mgt,radToDeg:Igt,isPowerOfTwo:ig,ceilPowerOfTwo:Dgt,floorPowerOfTwo:Ad,setQuaternionFromProperEuler:Lgt,normalize:kt,denormalize:Ci};class vt{constructor(e=0,t=0){vt.prototype.isVector2=!0,this.x=e,this.y=t}get width(){return this.x}set width(e){this.x=e}get height(){return this.y}set height(e){this.y=e}set(e,t){return this.x=e,this.y=t,this}setScalar(e){return this.x=e,this.y=e,this}setX(e){return this.x=e,this}setY(e){return this.y=e,this}setComponent(e,t){switch(e){case 0:this.x=t;break;case 1:this.y=t;break;default:throw new Error("index is out of range: "+e)}return this}getComponent(e){switch(e){case 0:return this.x;case 1:return this.y;default:throw new Error("index is out of range: "+e)}}clone(){return new this.constructor(this.x,this.y)}copy(e){return this.x=e.x,this.y=e.y,this}add(e){return this.x+=e.x,this.y+=e.y,this}addScalar(e){return this.x+=e,this.y+=e,this}addVectors(e,t){return this.x=e.x+t.x,this.y=e.y+t.y,this}addScaledVector(e,t){return this.x+=e.x*t,this.y+=e.y*t,this}sub(e){return this.x-=e.x,this.y-=e.y,this}subScalar(e){return this.x-=e,this.y-=e,this}subVectors(e,t){return this.x=e.x-t.x,this.y=e.y-t.y,this}multiply(e){return this.x*=e.x,this.y*=e.y,this}multiplyScalar(e){return this.x*=e,this.y*=e,this}divide(e){return this.x/=e.x,this.y/=e.y,this}divideScalar(e){return this.multiplyScalar(1/e)}applyMatrix3(e){const t=this.x,i=this.y,r=e.elements;return this.x=r[0]*t+r[3]*i+r[6],this.y=r[1]*t+r[4]*i+r[7],this}min(e){return this.x=Math.min(this.x,e.x),this.y=Math.min(this.y,e.y),this}max(e){return this.x=Math.max(this.x,e.x),this.y=Math.max(this.y,e.y),this}clamp(e,t){return this.x=Math.max(e.x,Math.min(t.x,this.x)),this.y=Math.max(e.y,Math.min(t.y,this.y)),this}clampScalar(e,t){return this.x=Math.max(e,Math.min(t,this.x)),this.y=Math.max(e,Math.min(t,this.y)),this}clampLength(e,t){const i=this.length();return this.divideScalar(i||1).multiplyScalar(Math.max(e,Math.min(t,i)))}floor(){return this.x=Math.floor(this.x),this.y=Math.floor(this.y),this}ceil(){return this.x=Math.ceil(this.x),this.y=Math.ceil(this.y),this}round(){return this.x=Math.round(this.x),this.y=Math.round(this.y),this}roundToZero(){return this.x=Math.trunc(this.x),this.y=Math.trunc(this.y),this}negate(){return this.x=-this.x,this.y=-this.y,this}dot(e){return this.x*e.x+this.y*e.y}cross(e){return this.x*e.y-this.y*e.x}lengthSq(){return this.x*this.x+this.y*this.y}length(){return Math.sqrt(this.x*this.x+this.y*this.y)}manhattanLength(){return Math.abs(this.x)+Math.abs(this.y)}normalize(){return this.divideScalar(this.length()||1)}angle(){return Math.atan2(-this.y,-this.x)+Math.PI}angleTo(e){const t=Math.sqrt(this.lengthSq()*e.lengthSq());if(t===0)return Math.PI/2;const i=this.dot(e)/t;return Math.acos(En(i,-1,1))}distanceTo(e){return Math.sqrt(this.distanceToSquared(e))}distanceToSquared(e){const t=this.x-e.x,i=this.y-e.y;return t*t+i*i}manhattanDistanceTo(e){return Math.abs(this.x-e.x)+Math.abs(this.y-e.y)}setLength(e){return this.normalize().multiplyScalar(e)}lerp(e,t){return this.x+=(e.x-this.x)*t,this.y+=(e.y-this.y)*t,this}lerpVectors(e,t,i){return this.x=e.x+(t.x-e.x)*i,this.y=e.y+(t.y-e.y)*i,this}equals(e){return e.x===this.x&&e.y===this.y}fromArray(e,t=0){return this.x=e[t],this.y=e[t+1],this}toArray(e=[],t=0){return e[t]=this.x,e[t+1]=this.y,e}fromBufferAttribute(e,t){return this.x=e.getX(t),this.y=e.getY(t),this}rotateAround(e,t){const i=Math.cos(t),r=Math.sin(t),s=this.x-e.x,o=this.y-e.y;return this.x=s*i-o*r+e.x,this.y=s*r+o*i+e.y,this}random(){return this.x=Math.random(),this.y=Math.random(),this}*[Symbol.iterator](){yield this.x,yield this.y}}class mt{constructor(e,t,i,r,s,o,a,l,c){mt.prototype.isMatrix3=!0,this.elements=[1,0,0,0,1,0,0,0,1],e!==void 0&&this.set(e,t,i,r,s,o,a,l,c)}set(e,t,i,r,s,o,a,l,c){const d=this.elements;return d[0]=e,d[1]=r,d[2]=a,d[3]=t,d[4]=s,d[5]=l,d[6]=i,d[7]=o,d[8]=c,this}identity(){return this.set(1,0,0,0,1,0,0,0,1),this}copy(e){const t=this.elements,i=e.elements;return t[0]=i[0],t[1]=i[1],t[2]=i[2],t[3]=i[3],t[4]=i[4],t[5]=i[5],t[6]=i[6],t[7]=i[7],t[8]=i[8],this}extractBasis(e,t,i){return e.setFromMatrix3Column(this,0),t.setFromMatrix3Column(this,1),i.setFromMatrix3Column(this,2),this}setFromMatrix4(e){const t=e.elements;return this.set(t[0],t[4],t[8],t[1],t[5],t[9],t[2],t[6],t[10]),this}multiply(e){return this.multiplyMatrices(this,e)}premultiply(e){return this.multiplyMatrices(e,this)}multiplyMatrices(e,t){const i=e.elements,r=t.elements,s=this.elements,o=i[0],a=i[3],l=i[6],c=i[1],d=i[4],u=i[7],_=i[2],f=i[5],h=i[8],E=r[0],g=r[3],m=r[6],b=r[1],S=r[4],v=r[7],T=r[2],C=r[5],N=r[8];return s[0]=o*E+a*b+l*T,s[3]=o*g+a*S+l*C,s[6]=o*m+a*v+l*N,s[1]=c*E+d*b+u*T,s[4]=c*g+d*S+u*C,s[7]=c*m+d*v+u*N,s[2]=_*E+f*b+h*T,s[5]=_*g+f*S+h*C,s[8]=_*m+f*v+h*N,this}multiplyScalar(e){const t=this.elements;return t[0]*=e,t[3]*=e,t[6]*=e,t[1]*=e,t[4]*=e,t[7]*=e,t[2]*=e,t[5]*=e,t[8]*=e,this}determinant(){const e=this.elements,t=e[0],i=e[1],r=e[2],s=e[3],o=e[4],a=e[5],l=e[6],c=e[7],d=e[8];return t*o*d-t*a*c-i*s*d+i*a*l+r*s*c-r*o*l}invert(){const e=this.elements,t=e[0],i=e[1],r=e[2],s=e[3],o=e[4],a=e[5],l=e[6],c=e[7],d=e[8],u=d*o-a*c,_=a*l-d*s,f=c*s-o*l,h=t*u+i*_+r*f;if(h===0)return this.set(0,0,0,0,0,0,0,0,0);const E=1/h;return e[0]=u*E,e[1]=(r*c-d*i)*E,e[2]=(a*i-r*o)*E,e[3]=_*E,e[4]=(d*t-r*l)*E,e[5]=(r*s-a*t)*E,e[6]=f*E,e[7]=(i*l-c*t)*E,e[8]=(o*t-i*s)*E,this}transpose(){let e;const t=this.elements;return e=t[1],t[1]=t[3],t[3]=e,e=t[2],t[2]=t[6],t[6]=e,e=t[5],t[5]=t[7],t[7]=e,this}getNormalMatrix(e){return this.setFromMatrix4(e).invert().transpose()}transposeIntoArray(e){const t=this.elements;return e[0]=t[0],e[1]=t[3],e[2]=t[6],e[3]=t[1],e[4]=t[4],e[5]=t[7],e[6]=t[2],e[7]=t[5],e[8]=t[8],this}setUvTransform(e,t,i,r,s,o,a){const l=Math.cos(s),c=Math.sin(s);return this.set(i*l,i*c,-i*(l*o+c*a)+o+e,-r*c,r*l,-r*(-c*o+l*a)+a+t,0,0,1),this}scale(e,t){return this.premultiply(Lf.makeScale(e,t)),this}rotate(e){return this.premultiply(Lf.makeRotation(-e)),this}translate(e,t){return this.premultiply(Lf.makeTranslation(e,t)),this}makeTranslation(e,t){return e.isVector2?this.set(1,0,e.x,0,1,e.y,0,0,1):this.set(1,0,e,0,1,t,0,0,1),this}makeRotation(e){const t=Math.cos(e),i=Math.sin(e);return this.set(t,-i,0,i,t,0,0,0,1),this}makeScale(e,t){return this.set(e,0,0,0,t,0,0,0,1),this}equals(e){const t=this.elements,i=e.elements;for(let r=0;r<9;r++)if(t[r]!==i[r])return!1;return!0}fromArray(e,t=0){for(let i=0;i<9;i++)this.elements[i]=e[i+t];return this}toArray(e=[],t=0){const i=this.elements;return e[t]=i[0],e[t+1]=i[1],e[t+2]=i[2],e[t+3]=i[3],e[t+4]=i[4],e[t+5]=i[5],e[t+6]=i[6],e[t+7]=i[7],e[t+8]=i[8],e}clone(){return new this.constructor().fromArray(this.elements)}}const Lf=new mt;function tO(n){for(let e=n.length-1;e>=0;--e)if(n[e]>=65535)return!0;return!1}function xl(n){return document.createElementNS("http://www.w3.org/1999/xhtml",n)}function Pgt(){const n=xl("canvas");return n.style.display="block",n}const rC={};function il(n){n in rC||(rC[n]=!0,console.warn(n))}const sC=new mt().set(.8224621,.177538,0,.0331941,.9668058,0,.0170827,.0723974,.9105199),oC=new mt().set(1.2249401,-.2249404,0,-.0420569,1.0420571,0,-.0196376,-.0786361,1.0982735),cc={[hn]:{transfer:Td,primaries:xd,toReference:n=>n,fromReference:n=>n},[Kt]:{transfer:Gt,primaries:xd,toReference:n=>n.convertSRGBToLinear(),fromReference:n=>n.convertLinearToSRGB()},[au]:{transfer:Td,primaries:Cd,toReference:n=>n.applyMatrix3(oC),fromReference:n=>n.applyMatrix3(sC)},[FE]:{transfer:Gt,primaries:Cd,toReference:n=>n.convertSRGBToLinear().applyMatrix3(oC),fromReference:n=>n.applyMatrix3(sC).convertLinearToSRGB()}},Ugt=new Set([hn,au]),Nt={enabled:!0,_workingColorSpace:hn,get legacyMode(){return console.warn("THREE.ColorManagement: .legacyMode=false renamed to .enabled=true in r150."),!this.enabled},set legacyMode(n){console.warn("THREE.ColorManagement: .legacyMode=false renamed to .enabled=true in r150."),this.enabled=!n},get workingColorSpace(){return this._workingColorSpace},set workingColorSpace(n){if(!Ugt.has(n))throw new Error(`Unsupported working color space, "${n}".`);this._workingColorSpace=n},convert:function(n,e,t){if(this.enabled===!1||e===t||!e||!t)return n;const i=cc[e].toReference,r=cc[t].fromReference;return r(i(n))},fromWorkingColorSpace:function(n,e){return this.convert(n,this._workingColorSpace,e)},toWorkingColorSpace:function(n,e){return this.convert(n,e,this._workingColorSpace)},getPrimaries:function(n){return cc[n].primaries},getTransfer:function(n){return n===Qn?Td:cc[n].transfer}};function Mo(n){return n<.04045?n*.0773993808:Math.pow(n*.9478672986+.0521327014,2.4)}function kf(n){return n<.0031308?n*12.92:1.055*Math.pow(n,.41666)-.055}let eo;class nO{static getDataURL(e){if(/^data:/i.test(e.src)||typeof HTMLCanvasElement>"u")return e.src;let t;if(e instanceof HTMLCanvasElement)t=e;else{eo===void 0&&(eo=xl("canvas")),eo.width=e.width,eo.height=e.height;const i=eo.getContext("2d");e instanceof ImageData?i.putImageData(e,0,0):i.drawImage(e,0,0,e.width,e.height),t=eo}return t.width>2048||t.height>2048?(console.warn("THREE.ImageUtils.getDataURL: Image converted to jpg for performance reasons",e),t.toDataURL("image/jpeg",.6)):t.toDataURL("image/png")}static sRGBToLinear(e){if(typeof HTMLImageElement<"u"&&e instanceof HTMLImageElement||typeof HTMLCanvasElement<"u"&&e instanceof HTMLCanvasElement||typeof ImageBitmap<"u"&&e instanceof ImageBitmap){const t=xl("canvas");t.width=e.width,t.height=e.height;const i=t.getContext("2d");i.drawImage(e,0,0,e.width,e.height);const r=i.getImageData(0,0,e.width,e.height),s=r.data;for(let o=0;o0&&(i.userData=this.userData),t||(e.textures[this.uuid]=i),i}dispose(){this.dispatchEvent({type:"dispose"})}transformUv(e){if(this.mapping!==Hw)return e;if(e.applyMatrix3(this.matrix),e.x<0||e.x>1)switch(this.wrapS){case Xo:e.x=e.x-Math.floor(e.x);break;case Kn:e.x=e.x<0?0:1;break;case vd:Math.abs(Math.floor(e.x)%2)===1?e.x=Math.ceil(e.x)-e.x:e.x=e.x-Math.floor(e.x);break}if(e.y<0||e.y>1)switch(this.wrapT){case Xo:e.y=e.y-Math.floor(e.y);break;case Kn:e.y=e.y<0?0:1;break;case vd:Math.abs(Math.floor(e.y)%2)===1?e.y=Math.ceil(e.y)-e.y:e.y=e.y-Math.floor(e.y);break}return this.flipY&&(e.y=1-e.y),e}set needsUpdate(e){e===!0&&(this.version++,this.source.needsUpdate=!0)}get encoding(){return il("THREE.Texture: Property .encoding has been replaced by .colorSpace."),this.colorSpace===Kt?Ns:Jw}set encoding(e){il("THREE.Texture: Property .encoding has been replaced by .colorSpace."),this.colorSpace=e===Ns?Kt:Qn}}pn.DEFAULT_IMAGE=null;pn.DEFAULT_MAPPING=Hw;pn.DEFAULT_ANISOTROPY=1;class Pt{constructor(e=0,t=0,i=0,r=1){Pt.prototype.isVector4=!0,this.x=e,this.y=t,this.z=i,this.w=r}get width(){return this.z}set width(e){this.z=e}get height(){return this.w}set height(e){this.w=e}set(e,t,i,r){return this.x=e,this.y=t,this.z=i,this.w=r,this}setScalar(e){return this.x=e,this.y=e,this.z=e,this.w=e,this}setX(e){return this.x=e,this}setY(e){return this.y=e,this}setZ(e){return this.z=e,this}setW(e){return this.w=e,this}setComponent(e,t){switch(e){case 0:this.x=t;break;case 1:this.y=t;break;case 2:this.z=t;break;case 3:this.w=t;break;default:throw new Error("index is out of range: "+e)}return this}getComponent(e){switch(e){case 0:return this.x;case 1:return this.y;case 2:return this.z;case 3:return this.w;default:throw new Error("index is out of range: "+e)}}clone(){return new this.constructor(this.x,this.y,this.z,this.w)}copy(e){return this.x=e.x,this.y=e.y,this.z=e.z,this.w=e.w!==void 0?e.w:1,this}add(e){return this.x+=e.x,this.y+=e.y,this.z+=e.z,this.w+=e.w,this}addScalar(e){return this.x+=e,this.y+=e,this.z+=e,this.w+=e,this}addVectors(e,t){return this.x=e.x+t.x,this.y=e.y+t.y,this.z=e.z+t.z,this.w=e.w+t.w,this}addScaledVector(e,t){return this.x+=e.x*t,this.y+=e.y*t,this.z+=e.z*t,this.w+=e.w*t,this}sub(e){return this.x-=e.x,this.y-=e.y,this.z-=e.z,this.w-=e.w,this}subScalar(e){return this.x-=e,this.y-=e,this.z-=e,this.w-=e,this}subVectors(e,t){return this.x=e.x-t.x,this.y=e.y-t.y,this.z=e.z-t.z,this.w=e.w-t.w,this}multiply(e){return this.x*=e.x,this.y*=e.y,this.z*=e.z,this.w*=e.w,this}multiplyScalar(e){return this.x*=e,this.y*=e,this.z*=e,this.w*=e,this}applyMatrix4(e){const t=this.x,i=this.y,r=this.z,s=this.w,o=e.elements;return this.x=o[0]*t+o[4]*i+o[8]*r+o[12]*s,this.y=o[1]*t+o[5]*i+o[9]*r+o[13]*s,this.z=o[2]*t+o[6]*i+o[10]*r+o[14]*s,this.w=o[3]*t+o[7]*i+o[11]*r+o[15]*s,this}divideScalar(e){return this.multiplyScalar(1/e)}setAxisAngleFromQuaternion(e){this.w=2*Math.acos(e.w);const t=Math.sqrt(1-e.w*e.w);return t<1e-4?(this.x=1,this.y=0,this.z=0):(this.x=e.x/t,this.y=e.y/t,this.z=e.z/t),this}setAxisAngleFromRotationMatrix(e){let t,i,r,s;const l=e.elements,c=l[0],d=l[4],u=l[8],_=l[1],f=l[5],h=l[9],E=l[2],g=l[6],m=l[10];if(Math.abs(d-_)<.01&&Math.abs(u-E)<.01&&Math.abs(h-g)<.01){if(Math.abs(d+_)<.1&&Math.abs(u+E)<.1&&Math.abs(h+g)<.1&&Math.abs(c+f+m-3)<.1)return this.set(1,0,0,0),this;t=Math.PI;const S=(c+1)/2,v=(f+1)/2,T=(m+1)/2,C=(d+_)/4,N=(u+E)/4,x=(h+g)/4;return S>v&&S>T?S<.01?(i=0,r=.707106781,s=.707106781):(i=Math.sqrt(S),r=C/i,s=N/i):v>T?v<.01?(i=.707106781,r=0,s=.707106781):(r=Math.sqrt(v),i=C/r,s=x/r):T<.01?(i=.707106781,r=.707106781,s=0):(s=Math.sqrt(T),i=N/s,r=x/s),this.set(i,r,s,t),this}let b=Math.sqrt((g-h)*(g-h)+(u-E)*(u-E)+(_-d)*(_-d));return Math.abs(b)<.001&&(b=1),this.x=(g-h)/b,this.y=(u-E)/b,this.z=(_-d)/b,this.w=Math.acos((c+f+m-1)/2),this}min(e){return this.x=Math.min(this.x,e.x),this.y=Math.min(this.y,e.y),this.z=Math.min(this.z,e.z),this.w=Math.min(this.w,e.w),this}max(e){return this.x=Math.max(this.x,e.x),this.y=Math.max(this.y,e.y),this.z=Math.max(this.z,e.z),this.w=Math.max(this.w,e.w),this}clamp(e,t){return this.x=Math.max(e.x,Math.min(t.x,this.x)),this.y=Math.max(e.y,Math.min(t.y,this.y)),this.z=Math.max(e.z,Math.min(t.z,this.z)),this.w=Math.max(e.w,Math.min(t.w,this.w)),this}clampScalar(e,t){return this.x=Math.max(e,Math.min(t,this.x)),this.y=Math.max(e,Math.min(t,this.y)),this.z=Math.max(e,Math.min(t,this.z)),this.w=Math.max(e,Math.min(t,this.w)),this}clampLength(e,t){const i=this.length();return this.divideScalar(i||1).multiplyScalar(Math.max(e,Math.min(t,i)))}floor(){return this.x=Math.floor(this.x),this.y=Math.floor(this.y),this.z=Math.floor(this.z),this.w=Math.floor(this.w),this}ceil(){return this.x=Math.ceil(this.x),this.y=Math.ceil(this.y),this.z=Math.ceil(this.z),this.w=Math.ceil(this.w),this}round(){return this.x=Math.round(this.x),this.y=Math.round(this.y),this.z=Math.round(this.z),this.w=Math.round(this.w),this}roundToZero(){return this.x=Math.trunc(this.x),this.y=Math.trunc(this.y),this.z=Math.trunc(this.z),this.w=Math.trunc(this.w),this}negate(){return this.x=-this.x,this.y=-this.y,this.z=-this.z,this.w=-this.w,this}dot(e){return this.x*e.x+this.y*e.y+this.z*e.z+this.w*e.w}lengthSq(){return this.x*this.x+this.y*this.y+this.z*this.z+this.w*this.w}length(){return Math.sqrt(this.x*this.x+this.y*this.y+this.z*this.z+this.w*this.w)}manhattanLength(){return Math.abs(this.x)+Math.abs(this.y)+Math.abs(this.z)+Math.abs(this.w)}normalize(){return this.divideScalar(this.length()||1)}setLength(e){return this.normalize().multiplyScalar(e)}lerp(e,t){return this.x+=(e.x-this.x)*t,this.y+=(e.y-this.y)*t,this.z+=(e.z-this.z)*t,this.w+=(e.w-this.w)*t,this}lerpVectors(e,t,i){return this.x=e.x+(t.x-e.x)*i,this.y=e.y+(t.y-e.y)*i,this.z=e.z+(t.z-e.z)*i,this.w=e.w+(t.w-e.w)*i,this}equals(e){return e.x===this.x&&e.y===this.y&&e.z===this.z&&e.w===this.w}fromArray(e,t=0){return this.x=e[t],this.y=e[t+1],this.z=e[t+2],this.w=e[t+3],this}toArray(e=[],t=0){return e[t]=this.x,e[t+1]=this.y,e[t+2]=this.z,e[t+3]=this.w,e}fromBufferAttribute(e,t){return this.x=e.getX(t),this.y=e.getY(t),this.z=e.getZ(t),this.w=e.getW(t),this}random(){return this.x=Math.random(),this.y=Math.random(),this.z=Math.random(),this.w=Math.random(),this}*[Symbol.iterator](){yield this.x,yield this.y,yield this.z,yield this.w}}class Ggt extends fa{constructor(e=1,t=1,i={}){super(),this.isRenderTarget=!0,this.width=e,this.height=t,this.depth=1,this.scissor=new Pt(0,0,e,t),this.scissorTest=!1,this.viewport=new Pt(0,0,e,t);const r={width:e,height:t,depth:1};i.encoding!==void 0&&(il("THREE.WebGLRenderTarget: option.encoding has been replaced by option.colorSpace."),i.colorSpace=i.encoding===Ns?Kt:Qn),i=Object.assign({generateMipmaps:!1,internalFormat:null,minFilter:Mn,depthBuffer:!0,stencilBuffer:!1,depthTexture:null,samples:0},i),this.texture=new pn(r,i.mapping,i.wrapS,i.wrapT,i.magFilter,i.minFilter,i.format,i.type,i.anisotropy,i.colorSpace),this.texture.isRenderTargetTexture=!0,this.texture.flipY=!1,this.texture.generateMipmaps=i.generateMipmaps,this.texture.internalFormat=i.internalFormat,this.depthBuffer=i.depthBuffer,this.stencilBuffer=i.stencilBuffer,this.depthTexture=i.depthTexture,this.samples=i.samples}setSize(e,t,i=1){(this.width!==e||this.height!==t||this.depth!==i)&&(this.width=e,this.height=t,this.depth=i,this.texture.image.width=e,this.texture.image.height=t,this.texture.image.depth=i,this.dispose()),this.viewport.set(0,0,e,t),this.scissor.set(0,0,e,t)}clone(){return new this.constructor().copy(this)}copy(e){this.width=e.width,this.height=e.height,this.depth=e.depth,this.scissor.copy(e.scissor),this.scissorTest=e.scissorTest,this.viewport.copy(e.viewport),this.texture=e.texture.clone(),this.texture.isRenderTargetTexture=!0;const t=Object.assign({},e.texture.image);return this.texture.source=new iO(t),this.depthBuffer=e.depthBuffer,this.stencilBuffer=e.stencilBuffer,e.depthTexture!==null&&(this.depthTexture=e.depthTexture.clone()),this.samples=e.samples,this}dispose(){this.dispatchEvent({type:"dispose"})}}class Ps extends Ggt{constructor(e=1,t=1,i={}){super(e,t,i),this.isWebGLRenderTarget=!0}}class rO extends pn{constructor(e=null,t=1,i=1,r=1){super(null),this.isDataArrayTexture=!0,this.image={data:e,width:t,height:i,depth:r},this.magFilter=an,this.minFilter=an,this.wrapR=Kn,this.generateMipmaps=!1,this.flipY=!1,this.unpackAlignment=1}}class zgt extends pn{constructor(e=null,t=1,i=1,r=1){super(null),this.isData3DTexture=!0,this.image={data:e,width:t,height:i,depth:r},this.magFilter=an,this.minFilter=an,this.wrapR=Kn,this.generateMipmaps=!1,this.flipY=!1,this.unpackAlignment=1}}class Xr{constructor(e=0,t=0,i=0,r=1){this.isQuaternion=!0,this._x=e,this._y=t,this._z=i,this._w=r}static slerpFlat(e,t,i,r,s,o,a){let l=i[r+0],c=i[r+1],d=i[r+2],u=i[r+3];const _=s[o+0],f=s[o+1],h=s[o+2],E=s[o+3];if(a===0){e[t+0]=l,e[t+1]=c,e[t+2]=d,e[t+3]=u;return}if(a===1){e[t+0]=_,e[t+1]=f,e[t+2]=h,e[t+3]=E;return}if(u!==E||l!==_||c!==f||d!==h){let g=1-a;const m=l*_+c*f+d*h+u*E,b=m>=0?1:-1,S=1-m*m;if(S>Number.EPSILON){const T=Math.sqrt(S),C=Math.atan2(T,m*b);g=Math.sin(g*C)/T,a=Math.sin(a*C)/T}const v=a*b;if(l=l*g+_*v,c=c*g+f*v,d=d*g+h*v,u=u*g+E*v,g===1-a){const T=1/Math.sqrt(l*l+c*c+d*d+u*u);l*=T,c*=T,d*=T,u*=T}}e[t]=l,e[t+1]=c,e[t+2]=d,e[t+3]=u}static multiplyQuaternionsFlat(e,t,i,r,s,o){const a=i[r],l=i[r+1],c=i[r+2],d=i[r+3],u=s[o],_=s[o+1],f=s[o+2],h=s[o+3];return e[t]=a*h+d*u+l*f-c*_,e[t+1]=l*h+d*_+c*u-a*f,e[t+2]=c*h+d*f+a*_-l*u,e[t+3]=d*h-a*u-l*_-c*f,e}get x(){return this._x}set x(e){this._x=e,this._onChangeCallback()}get y(){return this._y}set y(e){this._y=e,this._onChangeCallback()}get z(){return this._z}set z(e){this._z=e,this._onChangeCallback()}get w(){return this._w}set w(e){this._w=e,this._onChangeCallback()}set(e,t,i,r){return this._x=e,this._y=t,this._z=i,this._w=r,this._onChangeCallback(),this}clone(){return new this.constructor(this._x,this._y,this._z,this._w)}copy(e){return this._x=e.x,this._y=e.y,this._z=e.z,this._w=e.w,this._onChangeCallback(),this}setFromEuler(e,t){const i=e._x,r=e._y,s=e._z,o=e._order,a=Math.cos,l=Math.sin,c=a(i/2),d=a(r/2),u=a(s/2),_=l(i/2),f=l(r/2),h=l(s/2);switch(o){case"XYZ":this._x=_*d*u+c*f*h,this._y=c*f*u-_*d*h,this._z=c*d*h+_*f*u,this._w=c*d*u-_*f*h;break;case"YXZ":this._x=_*d*u+c*f*h,this._y=c*f*u-_*d*h,this._z=c*d*h-_*f*u,this._w=c*d*u+_*f*h;break;case"ZXY":this._x=_*d*u-c*f*h,this._y=c*f*u+_*d*h,this._z=c*d*h+_*f*u,this._w=c*d*u-_*f*h;break;case"ZYX":this._x=_*d*u-c*f*h,this._y=c*f*u+_*d*h,this._z=c*d*h-_*f*u,this._w=c*d*u+_*f*h;break;case"YZX":this._x=_*d*u+c*f*h,this._y=c*f*u+_*d*h,this._z=c*d*h-_*f*u,this._w=c*d*u-_*f*h;break;case"XZY":this._x=_*d*u-c*f*h,this._y=c*f*u-_*d*h,this._z=c*d*h+_*f*u,this._w=c*d*u+_*f*h;break;default:console.warn("THREE.Quaternion: .setFromEuler() encountered an unknown order: "+o)}return t!==!1&&this._onChangeCallback(),this}setFromAxisAngle(e,t){const i=t/2,r=Math.sin(i);return this._x=e.x*r,this._y=e.y*r,this._z=e.z*r,this._w=Math.cos(i),this._onChangeCallback(),this}setFromRotationMatrix(e){const t=e.elements,i=t[0],r=t[4],s=t[8],o=t[1],a=t[5],l=t[9],c=t[2],d=t[6],u=t[10],_=i+a+u;if(_>0){const f=.5/Math.sqrt(_+1);this._w=.25/f,this._x=(d-l)*f,this._y=(s-c)*f,this._z=(o-r)*f}else if(i>a&&i>u){const f=2*Math.sqrt(1+i-a-u);this._w=(d-l)/f,this._x=.25*f,this._y=(r+o)/f,this._z=(s+c)/f}else if(a>u){const f=2*Math.sqrt(1+a-i-u);this._w=(s-c)/f,this._x=(r+o)/f,this._y=.25*f,this._z=(l+d)/f}else{const f=2*Math.sqrt(1+u-i-a);this._w=(o-r)/f,this._x=(s+c)/f,this._y=(l+d)/f,this._z=.25*f}return this._onChangeCallback(),this}setFromUnitVectors(e,t){let i=e.dot(t)+1;return iMath.abs(e.z)?(this._x=-e.y,this._y=e.x,this._z=0,this._w=i):(this._x=0,this._y=-e.z,this._z=e.y,this._w=i)):(this._x=e.y*t.z-e.z*t.y,this._y=e.z*t.x-e.x*t.z,this._z=e.x*t.y-e.y*t.x,this._w=i),this.normalize()}angleTo(e){return 2*Math.acos(Math.abs(En(this.dot(e),-1,1)))}rotateTowards(e,t){const i=this.angleTo(e);if(i===0)return this;const r=Math.min(1,t/i);return this.slerp(e,r),this}identity(){return this.set(0,0,0,1)}invert(){return this.conjugate()}conjugate(){return this._x*=-1,this._y*=-1,this._z*=-1,this._onChangeCallback(),this}dot(e){return this._x*e._x+this._y*e._y+this._z*e._z+this._w*e._w}lengthSq(){return this._x*this._x+this._y*this._y+this._z*this._z+this._w*this._w}length(){return Math.sqrt(this._x*this._x+this._y*this._y+this._z*this._z+this._w*this._w)}normalize(){let e=this.length();return e===0?(this._x=0,this._y=0,this._z=0,this._w=1):(e=1/e,this._x=this._x*e,this._y=this._y*e,this._z=this._z*e,this._w=this._w*e),this._onChangeCallback(),this}multiply(e){return this.multiplyQuaternions(this,e)}premultiply(e){return this.multiplyQuaternions(e,this)}multiplyQuaternions(e,t){const i=e._x,r=e._y,s=e._z,o=e._w,a=t._x,l=t._y,c=t._z,d=t._w;return this._x=i*d+o*a+r*c-s*l,this._y=r*d+o*l+s*a-i*c,this._z=s*d+o*c+i*l-r*a,this._w=o*d-i*a-r*l-s*c,this._onChangeCallback(),this}slerp(e,t){if(t===0)return this;if(t===1)return this.copy(e);const i=this._x,r=this._y,s=this._z,o=this._w;let a=o*e._w+i*e._x+r*e._y+s*e._z;if(a<0?(this._w=-e._w,this._x=-e._x,this._y=-e._y,this._z=-e._z,a=-a):this.copy(e),a>=1)return this._w=o,this._x=i,this._y=r,this._z=s,this;const l=1-a*a;if(l<=Number.EPSILON){const f=1-t;return this._w=f*o+t*this._w,this._x=f*i+t*this._x,this._y=f*r+t*this._y,this._z=f*s+t*this._z,this.normalize(),this._onChangeCallback(),this}const c=Math.sqrt(l),d=Math.atan2(c,a),u=Math.sin((1-t)*d)/c,_=Math.sin(t*d)/c;return this._w=o*u+this._w*_,this._x=i*u+this._x*_,this._y=r*u+this._y*_,this._z=s*u+this._z*_,this._onChangeCallback(),this}slerpQuaternions(e,t,i){return this.copy(e).slerp(t,i)}random(){const e=Math.random(),t=Math.sqrt(1-e),i=Math.sqrt(e),r=2*Math.PI*Math.random(),s=2*Math.PI*Math.random();return this.set(t*Math.cos(r),i*Math.sin(s),i*Math.cos(s),t*Math.sin(r))}equals(e){return e._x===this._x&&e._y===this._y&&e._z===this._z&&e._w===this._w}fromArray(e,t=0){return this._x=e[t],this._y=e[t+1],this._z=e[t+2],this._w=e[t+3],this._onChangeCallback(),this}toArray(e=[],t=0){return e[t]=this._x,e[t+1]=this._y,e[t+2]=this._z,e[t+3]=this._w,e}fromBufferAttribute(e,t){return this._x=e.getX(t),this._y=e.getY(t),this._z=e.getZ(t),this._w=e.getW(t),this}toJSON(){return this.toArray()}_onChange(e){return this._onChangeCallback=e,this}_onChangeCallback(){}*[Symbol.iterator](){yield this._x,yield this._y,yield this._z,yield this._w}}class ue{constructor(e=0,t=0,i=0){ue.prototype.isVector3=!0,this.x=e,this.y=t,this.z=i}set(e,t,i){return i===void 0&&(i=this.z),this.x=e,this.y=t,this.z=i,this}setScalar(e){return this.x=e,this.y=e,this.z=e,this}setX(e){return this.x=e,this}setY(e){return this.y=e,this}setZ(e){return this.z=e,this}setComponent(e,t){switch(e){case 0:this.x=t;break;case 1:this.y=t;break;case 2:this.z=t;break;default:throw new Error("index is out of range: "+e)}return this}getComponent(e){switch(e){case 0:return this.x;case 1:return this.y;case 2:return this.z;default:throw new Error("index is out of range: "+e)}}clone(){return new this.constructor(this.x,this.y,this.z)}copy(e){return this.x=e.x,this.y=e.y,this.z=e.z,this}add(e){return this.x+=e.x,this.y+=e.y,this.z+=e.z,this}addScalar(e){return this.x+=e,this.y+=e,this.z+=e,this}addVectors(e,t){return this.x=e.x+t.x,this.y=e.y+t.y,this.z=e.z+t.z,this}addScaledVector(e,t){return this.x+=e.x*t,this.y+=e.y*t,this.z+=e.z*t,this}sub(e){return this.x-=e.x,this.y-=e.y,this.z-=e.z,this}subScalar(e){return this.x-=e,this.y-=e,this.z-=e,this}subVectors(e,t){return this.x=e.x-t.x,this.y=e.y-t.y,this.z=e.z-t.z,this}multiply(e){return this.x*=e.x,this.y*=e.y,this.z*=e.z,this}multiplyScalar(e){return this.x*=e,this.y*=e,this.z*=e,this}multiplyVectors(e,t){return this.x=e.x*t.x,this.y=e.y*t.y,this.z=e.z*t.z,this}applyEuler(e){return this.applyQuaternion(aC.setFromEuler(e))}applyAxisAngle(e,t){return this.applyQuaternion(aC.setFromAxisAngle(e,t))}applyMatrix3(e){const t=this.x,i=this.y,r=this.z,s=e.elements;return this.x=s[0]*t+s[3]*i+s[6]*r,this.y=s[1]*t+s[4]*i+s[7]*r,this.z=s[2]*t+s[5]*i+s[8]*r,this}applyNormalMatrix(e){return this.applyMatrix3(e).normalize()}applyMatrix4(e){const t=this.x,i=this.y,r=this.z,s=e.elements,o=1/(s[3]*t+s[7]*i+s[11]*r+s[15]);return this.x=(s[0]*t+s[4]*i+s[8]*r+s[12])*o,this.y=(s[1]*t+s[5]*i+s[9]*r+s[13])*o,this.z=(s[2]*t+s[6]*i+s[10]*r+s[14])*o,this}applyQuaternion(e){const t=this.x,i=this.y,r=this.z,s=e.x,o=e.y,a=e.z,l=e.w,c=2*(o*r-a*i),d=2*(a*t-s*r),u=2*(s*i-o*t);return this.x=t+l*c+o*u-a*d,this.y=i+l*d+a*c-s*u,this.z=r+l*u+s*d-o*c,this}project(e){return this.applyMatrix4(e.matrixWorldInverse).applyMatrix4(e.projectionMatrix)}unproject(e){return this.applyMatrix4(e.projectionMatrixInverse).applyMatrix4(e.matrixWorld)}transformDirection(e){const t=this.x,i=this.y,r=this.z,s=e.elements;return this.x=s[0]*t+s[4]*i+s[8]*r,this.y=s[1]*t+s[5]*i+s[9]*r,this.z=s[2]*t+s[6]*i+s[10]*r,this.normalize()}divide(e){return this.x/=e.x,this.y/=e.y,this.z/=e.z,this}divideScalar(e){return this.multiplyScalar(1/e)}min(e){return this.x=Math.min(this.x,e.x),this.y=Math.min(this.y,e.y),this.z=Math.min(this.z,e.z),this}max(e){return this.x=Math.max(this.x,e.x),this.y=Math.max(this.y,e.y),this.z=Math.max(this.z,e.z),this}clamp(e,t){return this.x=Math.max(e.x,Math.min(t.x,this.x)),this.y=Math.max(e.y,Math.min(t.y,this.y)),this.z=Math.max(e.z,Math.min(t.z,this.z)),this}clampScalar(e,t){return this.x=Math.max(e,Math.min(t,this.x)),this.y=Math.max(e,Math.min(t,this.y)),this.z=Math.max(e,Math.min(t,this.z)),this}clampLength(e,t){const i=this.length();return this.divideScalar(i||1).multiplyScalar(Math.max(e,Math.min(t,i)))}floor(){return this.x=Math.floor(this.x),this.y=Math.floor(this.y),this.z=Math.floor(this.z),this}ceil(){return this.x=Math.ceil(this.x),this.y=Math.ceil(this.y),this.z=Math.ceil(this.z),this}round(){return this.x=Math.round(this.x),this.y=Math.round(this.y),this.z=Math.round(this.z),this}roundToZero(){return this.x=Math.trunc(this.x),this.y=Math.trunc(this.y),this.z=Math.trunc(this.z),this}negate(){return this.x=-this.x,this.y=-this.y,this.z=-this.z,this}dot(e){return this.x*e.x+this.y*e.y+this.z*e.z}lengthSq(){return this.x*this.x+this.y*this.y+this.z*this.z}length(){return Math.sqrt(this.x*this.x+this.y*this.y+this.z*this.z)}manhattanLength(){return Math.abs(this.x)+Math.abs(this.y)+Math.abs(this.z)}normalize(){return this.divideScalar(this.length()||1)}setLength(e){return this.normalize().multiplyScalar(e)}lerp(e,t){return this.x+=(e.x-this.x)*t,this.y+=(e.y-this.y)*t,this.z+=(e.z-this.z)*t,this}lerpVectors(e,t,i){return this.x=e.x+(t.x-e.x)*i,this.y=e.y+(t.y-e.y)*i,this.z=e.z+(t.z-e.z)*i,this}cross(e){return this.crossVectors(this,e)}crossVectors(e,t){const i=e.x,r=e.y,s=e.z,o=t.x,a=t.y,l=t.z;return this.x=r*l-s*a,this.y=s*o-i*l,this.z=i*a-r*o,this}projectOnVector(e){const t=e.lengthSq();if(t===0)return this.set(0,0,0);const i=e.dot(this)/t;return this.copy(e).multiplyScalar(i)}projectOnPlane(e){return Uf.copy(this).projectOnVector(e),this.sub(Uf)}reflect(e){return this.sub(Uf.copy(e).multiplyScalar(2*this.dot(e)))}angleTo(e){const t=Math.sqrt(this.lengthSq()*e.lengthSq());if(t===0)return Math.PI/2;const i=this.dot(e)/t;return Math.acos(En(i,-1,1))}distanceTo(e){return Math.sqrt(this.distanceToSquared(e))}distanceToSquared(e){const t=this.x-e.x,i=this.y-e.y,r=this.z-e.z;return t*t+i*i+r*r}manhattanDistanceTo(e){return Math.abs(this.x-e.x)+Math.abs(this.y-e.y)+Math.abs(this.z-e.z)}setFromSpherical(e){return this.setFromSphericalCoords(e.radius,e.phi,e.theta)}setFromSphericalCoords(e,t,i){const r=Math.sin(t)*e;return this.x=r*Math.sin(i),this.y=Math.cos(t)*e,this.z=r*Math.cos(i),this}setFromCylindrical(e){return this.setFromCylindricalCoords(e.radius,e.theta,e.y)}setFromCylindricalCoords(e,t,i){return this.x=e*Math.sin(t),this.y=i,this.z=e*Math.cos(t),this}setFromMatrixPosition(e){const t=e.elements;return this.x=t[12],this.y=t[13],this.z=t[14],this}setFromMatrixScale(e){const t=this.setFromMatrixColumn(e,0).length(),i=this.setFromMatrixColumn(e,1).length(),r=this.setFromMatrixColumn(e,2).length();return this.x=t,this.y=i,this.z=r,this}setFromMatrixColumn(e,t){return this.fromArray(e.elements,t*4)}setFromMatrix3Column(e,t){return this.fromArray(e.elements,t*3)}setFromEuler(e){return this.x=e._x,this.y=e._y,this.z=e._z,this}setFromColor(e){return this.x=e.r,this.y=e.g,this.z=e.b,this}equals(e){return e.x===this.x&&e.y===this.y&&e.z===this.z}fromArray(e,t=0){return this.x=e[t],this.y=e[t+1],this.z=e[t+2],this}toArray(e=[],t=0){return e[t]=this.x,e[t+1]=this.y,e[t+2]=this.z,e}fromBufferAttribute(e,t){return this.x=e.getX(t),this.y=e.getY(t),this.z=e.getZ(t),this}random(){return this.x=Math.random(),this.y=Math.random(),this.z=Math.random(),this}randomDirection(){const e=(Math.random()-.5)*2,t=Math.random()*Math.PI*2,i=Math.sqrt(1-e**2);return this.x=i*Math.cos(t),this.y=i*Math.sin(t),this.z=e,this}*[Symbol.iterator](){yield this.x,yield this.y,yield this.z}}const Uf=new ue,aC=new Xr;class hr{constructor(e=new ue(1/0,1/0,1/0),t=new ue(-1/0,-1/0,-1/0)){this.isBox3=!0,this.min=e,this.max=t}set(e,t){return this.min.copy(e),this.max.copy(t),this}setFromArray(e){this.makeEmpty();for(let t=0,i=e.length;tthis.max.x||e.ythis.max.y||e.zthis.max.z)}containsBox(e){return this.min.x<=e.min.x&&e.max.x<=this.max.x&&this.min.y<=e.min.y&&e.max.y<=this.max.y&&this.min.z<=e.min.z&&e.max.z<=this.max.z}getParameter(e,t){return t.set((e.x-this.min.x)/(this.max.x-this.min.x),(e.y-this.min.y)/(this.max.y-this.min.y),(e.z-this.min.z)/(this.max.z-this.min.z))}intersectsBox(e){return!(e.max.xthis.max.x||e.max.ythis.max.y||e.max.zthis.max.z)}intersectsSphere(e){return this.clampPoint(e.center,si),si.distanceToSquared(e.center)<=e.radius*e.radius}intersectsPlane(e){let t,i;return e.normal.x>0?(t=e.normal.x*this.min.x,i=e.normal.x*this.max.x):(t=e.normal.x*this.max.x,i=e.normal.x*this.min.x),e.normal.y>0?(t+=e.normal.y*this.min.y,i+=e.normal.y*this.max.y):(t+=e.normal.y*this.max.y,i+=e.normal.y*this.min.y),e.normal.z>0?(t+=e.normal.z*this.min.z,i+=e.normal.z*this.max.z):(t+=e.normal.z*this.max.z,i+=e.normal.z*this.min.z),t<=-e.constant&&i>=-e.constant}intersectsTriangle(e){if(this.isEmpty())return!1;this.getCenter(La),uc.subVectors(this.max,La),to.subVectors(e.a,La),no.subVectors(e.b,La),io.subVectors(e.c,La),Sr.subVectors(no,to),yr.subVectors(io,no),os.subVectors(to,io);let t=[0,-Sr.z,Sr.y,0,-yr.z,yr.y,0,-os.z,os.y,Sr.z,0,-Sr.x,yr.z,0,-yr.x,os.z,0,-os.x,-Sr.y,Sr.x,0,-yr.y,yr.x,0,-os.y,os.x,0];return!Ff(t,to,no,io,uc)||(t=[1,0,0,0,1,0,0,0,1],!Ff(t,to,no,io,uc))?!1:(_c.crossVectors(Sr,yr),t=[_c.x,_c.y,_c.z],Ff(t,to,no,io,uc))}clampPoint(e,t){return t.copy(e).clamp(this.min,this.max)}distanceToPoint(e){return this.clampPoint(e,si).distanceTo(e)}getBoundingSphere(e){return this.isEmpty()?e.makeEmpty():(this.getCenter(e.center),e.radius=this.getSize(si).length()*.5),e}intersect(e){return this.min.max(e.min),this.max.min(e.max),this.isEmpty()&&this.makeEmpty(),this}union(e){return this.min.min(e.min),this.max.max(e.max),this}applyMatrix4(e){return this.isEmpty()?this:(Yi[0].set(this.min.x,this.min.y,this.min.z).applyMatrix4(e),Yi[1].set(this.min.x,this.min.y,this.max.z).applyMatrix4(e),Yi[2].set(this.min.x,this.max.y,this.min.z).applyMatrix4(e),Yi[3].set(this.min.x,this.max.y,this.max.z).applyMatrix4(e),Yi[4].set(this.max.x,this.min.y,this.min.z).applyMatrix4(e),Yi[5].set(this.max.x,this.min.y,this.max.z).applyMatrix4(e),Yi[6].set(this.max.x,this.max.y,this.min.z).applyMatrix4(e),Yi[7].set(this.max.x,this.max.y,this.max.z).applyMatrix4(e),this.setFromPoints(Yi),this)}translate(e){return this.min.add(e),this.max.add(e),this}equals(e){return e.min.equals(this.min)&&e.max.equals(this.max)}}const Yi=[new ue,new ue,new ue,new ue,new ue,new ue,new ue,new ue],si=new ue,dc=new hr,to=new ue,no=new ue,io=new ue,Sr=new ue,yr=new ue,os=new ue,La=new ue,uc=new ue,_c=new ue,as=new ue;function Ff(n,e,t,i,r){for(let s=0,o=n.length-3;s<=o;s+=3){as.fromArray(n,s);const a=r.x*Math.abs(as.x)+r.y*Math.abs(as.y)+r.z*Math.abs(as.z),l=e.dot(as),c=t.dot(as),d=i.dot(as);if(Math.max(-Math.max(l,c,d),Math.min(l,c,d))>a)return!1}return!0}const Vgt=new hr,ka=new ue,Bf=new ue;class Ui{constructor(e=new ue,t=-1){this.center=e,this.radius=t}set(e,t){return this.center.copy(e),this.radius=t,this}setFromPoints(e,t){const i=this.center;t!==void 0?i.copy(t):Vgt.setFromPoints(e).getCenter(i);let r=0;for(let s=0,o=e.length;sthis.radius*this.radius&&(t.sub(this.center).normalize(),t.multiplyScalar(this.radius).add(this.center)),t}getBoundingBox(e){return this.isEmpty()?(e.makeEmpty(),e):(e.set(this.center,this.center),e.expandByScalar(this.radius),e)}applyMatrix4(e){return this.center.applyMatrix4(e),this.radius=this.radius*e.getMaxScaleOnAxis(),this}translate(e){return this.center.add(e),this}expandByPoint(e){if(this.isEmpty())return this.center.copy(e),this.radius=0,this;ka.subVectors(e,this.center);const t=ka.lengthSq();if(t>this.radius*this.radius){const i=Math.sqrt(t),r=(i-this.radius)*.5;this.center.addScaledVector(ka,r/i),this.radius+=r}return this}union(e){return e.isEmpty()?this:this.isEmpty()?(this.copy(e),this):(this.center.equals(e.center)===!0?this.radius=Math.max(this.radius,e.radius):(Bf.subVectors(e.center,this.center).setLength(e.radius),this.expandByPoint(ka.copy(e.center).add(Bf)),this.expandByPoint(ka.copy(e.center).sub(Bf))),this)}equals(e){return e.center.equals(this.center)&&e.radius===this.radius}clone(){return new this.constructor().copy(this)}}const $i=new ue,Gf=new ue,pc=new ue,vr=new ue,zf=new ue,hc=new ue,Vf=new ue;class lu{constructor(e=new ue,t=new ue(0,0,-1)){this.origin=e,this.direction=t}set(e,t){return this.origin.copy(e),this.direction.copy(t),this}copy(e){return this.origin.copy(e.origin),this.direction.copy(e.direction),this}at(e,t){return t.copy(this.origin).addScaledVector(this.direction,e)}lookAt(e){return this.direction.copy(e).sub(this.origin).normalize(),this}recast(e){return this.origin.copy(this.at(e,$i)),this}closestPointToPoint(e,t){t.subVectors(e,this.origin);const i=t.dot(this.direction);return i<0?t.copy(this.origin):t.copy(this.origin).addScaledVector(this.direction,i)}distanceToPoint(e){return Math.sqrt(this.distanceSqToPoint(e))}distanceSqToPoint(e){const t=$i.subVectors(e,this.origin).dot(this.direction);return t<0?this.origin.distanceToSquared(e):($i.copy(this.origin).addScaledVector(this.direction,t),$i.distanceToSquared(e))}distanceSqToSegment(e,t,i,r){Gf.copy(e).add(t).multiplyScalar(.5),pc.copy(t).sub(e).normalize(),vr.copy(this.origin).sub(Gf);const s=e.distanceTo(t)*.5,o=-this.direction.dot(pc),a=vr.dot(this.direction),l=-vr.dot(pc),c=vr.lengthSq(),d=Math.abs(1-o*o);let u,_,f,h;if(d>0)if(u=o*l-a,_=o*a-l,h=s*d,u>=0)if(_>=-h)if(_<=h){const E=1/d;u*=E,_*=E,f=u*(u+o*_+2*a)+_*(o*u+_+2*l)+c}else _=s,u=Math.max(0,-(o*_+a)),f=-u*u+_*(_+2*l)+c;else _=-s,u=Math.max(0,-(o*_+a)),f=-u*u+_*(_+2*l)+c;else _<=-h?(u=Math.max(0,-(-o*s+a)),_=u>0?-s:Math.min(Math.max(-s,-l),s),f=-u*u+_*(_+2*l)+c):_<=h?(u=0,_=Math.min(Math.max(-s,-l),s),f=_*(_+2*l)+c):(u=Math.max(0,-(o*s+a)),_=u>0?s:Math.min(Math.max(-s,-l),s),f=-u*u+_*(_+2*l)+c);else _=o>0?-s:s,u=Math.max(0,-(o*_+a)),f=-u*u+_*(_+2*l)+c;return i&&i.copy(this.origin).addScaledVector(this.direction,u),r&&r.copy(Gf).addScaledVector(pc,_),f}intersectSphere(e,t){$i.subVectors(e.center,this.origin);const i=$i.dot(this.direction),r=$i.dot($i)-i*i,s=e.radius*e.radius;if(r>s)return null;const o=Math.sqrt(s-r),a=i-o,l=i+o;return l<0?null:a<0?this.at(l,t):this.at(a,t)}intersectsSphere(e){return this.distanceSqToPoint(e.center)<=e.radius*e.radius}distanceToPlane(e){const t=e.normal.dot(this.direction);if(t===0)return e.distanceToPoint(this.origin)===0?0:null;const i=-(this.origin.dot(e.normal)+e.constant)/t;return i>=0?i:null}intersectPlane(e,t){const i=this.distanceToPlane(e);return i===null?null:this.at(i,t)}intersectsPlane(e){const t=e.distanceToPoint(this.origin);return t===0||e.normal.dot(this.direction)*t<0}intersectBox(e,t){let i,r,s,o,a,l;const c=1/this.direction.x,d=1/this.direction.y,u=1/this.direction.z,_=this.origin;return c>=0?(i=(e.min.x-_.x)*c,r=(e.max.x-_.x)*c):(i=(e.max.x-_.x)*c,r=(e.min.x-_.x)*c),d>=0?(s=(e.min.y-_.y)*d,o=(e.max.y-_.y)*d):(s=(e.max.y-_.y)*d,o=(e.min.y-_.y)*d),i>o||s>r||((s>i||isNaN(i))&&(i=s),(o=0?(a=(e.min.z-_.z)*u,l=(e.max.z-_.z)*u):(a=(e.max.z-_.z)*u,l=(e.min.z-_.z)*u),i>l||a>r)||((a>i||i!==i)&&(i=a),(l=0?i:r,t)}intersectsBox(e){return this.intersectBox(e,$i)!==null}intersectTriangle(e,t,i,r,s){zf.subVectors(t,e),hc.subVectors(i,e),Vf.crossVectors(zf,hc);let o=this.direction.dot(Vf),a;if(o>0){if(r)return null;a=1}else if(o<0)a=-1,o=-o;else return null;vr.subVectors(this.origin,e);const l=a*this.direction.dot(hc.crossVectors(vr,hc));if(l<0)return null;const c=a*this.direction.dot(zf.cross(vr));if(c<0||l+c>o)return null;const d=-a*vr.dot(Vf);return d<0?null:this.at(d/o,s)}applyMatrix4(e){return this.origin.applyMatrix4(e),this.direction.transformDirection(e),this}equals(e){return e.origin.equals(this.origin)&&e.direction.equals(this.direction)}clone(){return new this.constructor().copy(this)}}class gt{constructor(e,t,i,r,s,o,a,l,c,d,u,_,f,h,E,g){gt.prototype.isMatrix4=!0,this.elements=[1,0,0,0,0,1,0,0,0,0,1,0,0,0,0,1],e!==void 0&&this.set(e,t,i,r,s,o,a,l,c,d,u,_,f,h,E,g)}set(e,t,i,r,s,o,a,l,c,d,u,_,f,h,E,g){const m=this.elements;return m[0]=e,m[4]=t,m[8]=i,m[12]=r,m[1]=s,m[5]=o,m[9]=a,m[13]=l,m[2]=c,m[6]=d,m[10]=u,m[14]=_,m[3]=f,m[7]=h,m[11]=E,m[15]=g,this}identity(){return this.set(1,0,0,0,0,1,0,0,0,0,1,0,0,0,0,1),this}clone(){return new gt().fromArray(this.elements)}copy(e){const t=this.elements,i=e.elements;return t[0]=i[0],t[1]=i[1],t[2]=i[2],t[3]=i[3],t[4]=i[4],t[5]=i[5],t[6]=i[6],t[7]=i[7],t[8]=i[8],t[9]=i[9],t[10]=i[10],t[11]=i[11],t[12]=i[12],t[13]=i[13],t[14]=i[14],t[15]=i[15],this}copyPosition(e){const t=this.elements,i=e.elements;return t[12]=i[12],t[13]=i[13],t[14]=i[14],this}setFromMatrix3(e){const t=e.elements;return this.set(t[0],t[3],t[6],0,t[1],t[4],t[7],0,t[2],t[5],t[8],0,0,0,0,1),this}extractBasis(e,t,i){return e.setFromMatrixColumn(this,0),t.setFromMatrixColumn(this,1),i.setFromMatrixColumn(this,2),this}makeBasis(e,t,i){return this.set(e.x,t.x,i.x,0,e.y,t.y,i.y,0,e.z,t.z,i.z,0,0,0,0,1),this}extractRotation(e){const t=this.elements,i=e.elements,r=1/ro.setFromMatrixColumn(e,0).length(),s=1/ro.setFromMatrixColumn(e,1).length(),o=1/ro.setFromMatrixColumn(e,2).length();return t[0]=i[0]*r,t[1]=i[1]*r,t[2]=i[2]*r,t[3]=0,t[4]=i[4]*s,t[5]=i[5]*s,t[6]=i[6]*s,t[7]=0,t[8]=i[8]*o,t[9]=i[9]*o,t[10]=i[10]*o,t[11]=0,t[12]=0,t[13]=0,t[14]=0,t[15]=1,this}makeRotationFromEuler(e){const t=this.elements,i=e.x,r=e.y,s=e.z,o=Math.cos(i),a=Math.sin(i),l=Math.cos(r),c=Math.sin(r),d=Math.cos(s),u=Math.sin(s);if(e.order==="XYZ"){const _=o*d,f=o*u,h=a*d,E=a*u;t[0]=l*d,t[4]=-l*u,t[8]=c,t[1]=f+h*c,t[5]=_-E*c,t[9]=-a*l,t[2]=E-_*c,t[6]=h+f*c,t[10]=o*l}else if(e.order==="YXZ"){const _=l*d,f=l*u,h=c*d,E=c*u;t[0]=_+E*a,t[4]=h*a-f,t[8]=o*c,t[1]=o*u,t[5]=o*d,t[9]=-a,t[2]=f*a-h,t[6]=E+_*a,t[10]=o*l}else if(e.order==="ZXY"){const _=l*d,f=l*u,h=c*d,E=c*u;t[0]=_-E*a,t[4]=-o*u,t[8]=h+f*a,t[1]=f+h*a,t[5]=o*d,t[9]=E-_*a,t[2]=-o*c,t[6]=a,t[10]=o*l}else if(e.order==="ZYX"){const _=o*d,f=o*u,h=a*d,E=a*u;t[0]=l*d,t[4]=h*c-f,t[8]=_*c+E,t[1]=l*u,t[5]=E*c+_,t[9]=f*c-h,t[2]=-c,t[6]=a*l,t[10]=o*l}else if(e.order==="YZX"){const _=o*l,f=o*c,h=a*l,E=a*c;t[0]=l*d,t[4]=E-_*u,t[8]=h*u+f,t[1]=u,t[5]=o*d,t[9]=-a*d,t[2]=-c*d,t[6]=f*u+h,t[10]=_-E*u}else if(e.order==="XZY"){const _=o*l,f=o*c,h=a*l,E=a*c;t[0]=l*d,t[4]=-u,t[8]=c*d,t[1]=_*u+E,t[5]=o*d,t[9]=f*u-h,t[2]=h*u-f,t[6]=a*d,t[10]=E*u+_}return t[3]=0,t[7]=0,t[11]=0,t[12]=0,t[13]=0,t[14]=0,t[15]=1,this}makeRotationFromQuaternion(e){return this.compose(Hgt,e,qgt)}lookAt(e,t,i){const r=this.elements;return Un.subVectors(e,t),Un.lengthSq()===0&&(Un.z=1),Un.normalize(),Tr.crossVectors(i,Un),Tr.lengthSq()===0&&(Math.abs(i.z)===1?Un.x+=1e-4:Un.z+=1e-4,Un.normalize(),Tr.crossVectors(i,Un)),Tr.normalize(),fc.crossVectors(Un,Tr),r[0]=Tr.x,r[4]=fc.x,r[8]=Un.x,r[1]=Tr.y,r[5]=fc.y,r[9]=Un.y,r[2]=Tr.z,r[6]=fc.z,r[10]=Un.z,this}multiply(e){return this.multiplyMatrices(this,e)}premultiply(e){return this.multiplyMatrices(e,this)}multiplyMatrices(e,t){const i=e.elements,r=t.elements,s=this.elements,o=i[0],a=i[4],l=i[8],c=i[12],d=i[1],u=i[5],_=i[9],f=i[13],h=i[2],E=i[6],g=i[10],m=i[14],b=i[3],S=i[7],v=i[11],T=i[15],C=r[0],N=r[4],x=r[8],y=r[12],R=r[1],P=r[5],k=r[9],W=r[13],I=r[2],V=r[6],z=r[10],D=r[14],Y=r[3],K=r[7],q=r[11],le=r[15];return s[0]=o*C+a*R+l*I+c*Y,s[4]=o*N+a*P+l*V+c*K,s[8]=o*x+a*k+l*z+c*q,s[12]=o*y+a*W+l*D+c*le,s[1]=d*C+u*R+_*I+f*Y,s[5]=d*N+u*P+_*V+f*K,s[9]=d*x+u*k+_*z+f*q,s[13]=d*y+u*W+_*D+f*le,s[2]=h*C+E*R+g*I+m*Y,s[6]=h*N+E*P+g*V+m*K,s[10]=h*x+E*k+g*z+m*q,s[14]=h*y+E*W+g*D+m*le,s[3]=b*C+S*R+v*I+T*Y,s[7]=b*N+S*P+v*V+T*K,s[11]=b*x+S*k+v*z+T*q,s[15]=b*y+S*W+v*D+T*le,this}multiplyScalar(e){const t=this.elements;return t[0]*=e,t[4]*=e,t[8]*=e,t[12]*=e,t[1]*=e,t[5]*=e,t[9]*=e,t[13]*=e,t[2]*=e,t[6]*=e,t[10]*=e,t[14]*=e,t[3]*=e,t[7]*=e,t[11]*=e,t[15]*=e,this}determinant(){const e=this.elements,t=e[0],i=e[4],r=e[8],s=e[12],o=e[1],a=e[5],l=e[9],c=e[13],d=e[2],u=e[6],_=e[10],f=e[14],h=e[3],E=e[7],g=e[11],m=e[15];return h*(+s*l*u-r*c*u-s*a*_+i*c*_+r*a*f-i*l*f)+E*(+t*l*f-t*c*_+s*o*_-r*o*f+r*c*d-s*l*d)+g*(+t*c*u-t*a*f-s*o*u+i*o*f+s*a*d-i*c*d)+m*(-r*a*d-t*l*u+t*a*_+r*o*u-i*o*_+i*l*d)}transpose(){const e=this.elements;let t;return t=e[1],e[1]=e[4],e[4]=t,t=e[2],e[2]=e[8],e[8]=t,t=e[6],e[6]=e[9],e[9]=t,t=e[3],e[3]=e[12],e[12]=t,t=e[7],e[7]=e[13],e[13]=t,t=e[11],e[11]=e[14],e[14]=t,this}setPosition(e,t,i){const r=this.elements;return e.isVector3?(r[12]=e.x,r[13]=e.y,r[14]=e.z):(r[12]=e,r[13]=t,r[14]=i),this}invert(){const e=this.elements,t=e[0],i=e[1],r=e[2],s=e[3],o=e[4],a=e[5],l=e[6],c=e[7],d=e[8],u=e[9],_=e[10],f=e[11],h=e[12],E=e[13],g=e[14],m=e[15],b=u*g*c-E*_*c+E*l*f-a*g*f-u*l*m+a*_*m,S=h*_*c-d*g*c-h*l*f+o*g*f+d*l*m-o*_*m,v=d*E*c-h*u*c+h*a*f-o*E*f-d*a*m+o*u*m,T=h*u*l-d*E*l-h*a*_+o*E*_+d*a*g-o*u*g,C=t*b+i*S+r*v+s*T;if(C===0)return this.set(0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0);const N=1/C;return e[0]=b*N,e[1]=(E*_*s-u*g*s-E*r*f+i*g*f+u*r*m-i*_*m)*N,e[2]=(a*g*s-E*l*s+E*r*c-i*g*c-a*r*m+i*l*m)*N,e[3]=(u*l*s-a*_*s-u*r*c+i*_*c+a*r*f-i*l*f)*N,e[4]=S*N,e[5]=(d*g*s-h*_*s+h*r*f-t*g*f-d*r*m+t*_*m)*N,e[6]=(h*l*s-o*g*s-h*r*c+t*g*c+o*r*m-t*l*m)*N,e[7]=(o*_*s-d*l*s+d*r*c-t*_*c-o*r*f+t*l*f)*N,e[8]=v*N,e[9]=(h*u*s-d*E*s-h*i*f+t*E*f+d*i*m-t*u*m)*N,e[10]=(o*E*s-h*a*s+h*i*c-t*E*c-o*i*m+t*a*m)*N,e[11]=(d*a*s-o*u*s-d*i*c+t*u*c+o*i*f-t*a*f)*N,e[12]=T*N,e[13]=(d*E*r-h*u*r+h*i*_-t*E*_-d*i*g+t*u*g)*N,e[14]=(h*a*r-o*E*r-h*i*l+t*E*l+o*i*g-t*a*g)*N,e[15]=(o*u*r-d*a*r+d*i*l-t*u*l-o*i*_+t*a*_)*N,this}scale(e){const t=this.elements,i=e.x,r=e.y,s=e.z;return t[0]*=i,t[4]*=r,t[8]*=s,t[1]*=i,t[5]*=r,t[9]*=s,t[2]*=i,t[6]*=r,t[10]*=s,t[3]*=i,t[7]*=r,t[11]*=s,this}getMaxScaleOnAxis(){const e=this.elements,t=e[0]*e[0]+e[1]*e[1]+e[2]*e[2],i=e[4]*e[4]+e[5]*e[5]+e[6]*e[6],r=e[8]*e[8]+e[9]*e[9]+e[10]*e[10];return Math.sqrt(Math.max(t,i,r))}makeTranslation(e,t,i){return e.isVector3?this.set(1,0,0,e.x,0,1,0,e.y,0,0,1,e.z,0,0,0,1):this.set(1,0,0,e,0,1,0,t,0,0,1,i,0,0,0,1),this}makeRotationX(e){const t=Math.cos(e),i=Math.sin(e);return this.set(1,0,0,0,0,t,-i,0,0,i,t,0,0,0,0,1),this}makeRotationY(e){const t=Math.cos(e),i=Math.sin(e);return this.set(t,0,i,0,0,1,0,0,-i,0,t,0,0,0,0,1),this}makeRotationZ(e){const t=Math.cos(e),i=Math.sin(e);return this.set(t,-i,0,0,i,t,0,0,0,0,1,0,0,0,0,1),this}makeRotationAxis(e,t){const i=Math.cos(t),r=Math.sin(t),s=1-i,o=e.x,a=e.y,l=e.z,c=s*o,d=s*a;return this.set(c*o+i,c*a-r*l,c*l+r*a,0,c*a+r*l,d*a+i,d*l-r*o,0,c*l-r*a,d*l+r*o,s*l*l+i,0,0,0,0,1),this}makeScale(e,t,i){return this.set(e,0,0,0,0,t,0,0,0,0,i,0,0,0,0,1),this}makeShear(e,t,i,r,s,o){return this.set(1,i,s,0,e,1,o,0,t,r,1,0,0,0,0,1),this}compose(e,t,i){const r=this.elements,s=t._x,o=t._y,a=t._z,l=t._w,c=s+s,d=o+o,u=a+a,_=s*c,f=s*d,h=s*u,E=o*d,g=o*u,m=a*u,b=l*c,S=l*d,v=l*u,T=i.x,C=i.y,N=i.z;return r[0]=(1-(E+m))*T,r[1]=(f+v)*T,r[2]=(h-S)*T,r[3]=0,r[4]=(f-v)*C,r[5]=(1-(_+m))*C,r[6]=(g+b)*C,r[7]=0,r[8]=(h+S)*N,r[9]=(g-b)*N,r[10]=(1-(_+E))*N,r[11]=0,r[12]=e.x,r[13]=e.y,r[14]=e.z,r[15]=1,this}decompose(e,t,i){const r=this.elements;let s=ro.set(r[0],r[1],r[2]).length();const o=ro.set(r[4],r[5],r[6]).length(),a=ro.set(r[8],r[9],r[10]).length();this.determinant()<0&&(s=-s),e.x=r[12],e.y=r[13],e.z=r[14],oi.copy(this);const c=1/s,d=1/o,u=1/a;return oi.elements[0]*=c,oi.elements[1]*=c,oi.elements[2]*=c,oi.elements[4]*=d,oi.elements[5]*=d,oi.elements[6]*=d,oi.elements[8]*=u,oi.elements[9]*=u,oi.elements[10]*=u,t.setFromRotationMatrix(oi),i.x=s,i.y=o,i.z=a,this}makePerspective(e,t,i,r,s,o,a=nr){const l=this.elements,c=2*s/(t-e),d=2*s/(i-r),u=(t+e)/(t-e),_=(i+r)/(i-r);let f,h;if(a===nr)f=-(o+s)/(o-s),h=-2*o*s/(o-s);else if(a===Rd)f=-o/(o-s),h=-o*s/(o-s);else throw new Error("THREE.Matrix4.makePerspective(): Invalid coordinate system: "+a);return l[0]=c,l[4]=0,l[8]=u,l[12]=0,l[1]=0,l[5]=d,l[9]=_,l[13]=0,l[2]=0,l[6]=0,l[10]=f,l[14]=h,l[3]=0,l[7]=0,l[11]=-1,l[15]=0,this}makeOrthographic(e,t,i,r,s,o,a=nr){const l=this.elements,c=1/(t-e),d=1/(i-r),u=1/(o-s),_=(t+e)*c,f=(i+r)*d;let h,E;if(a===nr)h=(o+s)*u,E=-2*u;else if(a===Rd)h=s*u,E=-1*u;else throw new Error("THREE.Matrix4.makeOrthographic(): Invalid coordinate system: "+a);return l[0]=2*c,l[4]=0,l[8]=0,l[12]=-_,l[1]=0,l[5]=2*d,l[9]=0,l[13]=-f,l[2]=0,l[6]=0,l[10]=E,l[14]=-h,l[3]=0,l[7]=0,l[11]=0,l[15]=1,this}equals(e){const t=this.elements,i=e.elements;for(let r=0;r<16;r++)if(t[r]!==i[r])return!1;return!0}fromArray(e,t=0){for(let i=0;i<16;i++)this.elements[i]=e[i+t];return this}toArray(e=[],t=0){const i=this.elements;return e[t]=i[0],e[t+1]=i[1],e[t+2]=i[2],e[t+3]=i[3],e[t+4]=i[4],e[t+5]=i[5],e[t+6]=i[6],e[t+7]=i[7],e[t+8]=i[8],e[t+9]=i[9],e[t+10]=i[10],e[t+11]=i[11],e[t+12]=i[12],e[t+13]=i[13],e[t+14]=i[14],e[t+15]=i[15],e}}const ro=new ue,oi=new gt,Hgt=new ue(0,0,0),qgt=new ue(1,1,1),Tr=new ue,fc=new ue,Un=new ue,lC=new gt,cC=new Xr;class cu{constructor(e=0,t=0,i=0,r=cu.DEFAULT_ORDER){this.isEuler=!0,this._x=e,this._y=t,this._z=i,this._order=r}get x(){return this._x}set x(e){this._x=e,this._onChangeCallback()}get y(){return this._y}set y(e){this._y=e,this._onChangeCallback()}get z(){return this._z}set z(e){this._z=e,this._onChangeCallback()}get order(){return this._order}set order(e){this._order=e,this._onChangeCallback()}set(e,t,i,r=this._order){return this._x=e,this._y=t,this._z=i,this._order=r,this._onChangeCallback(),this}clone(){return new this.constructor(this._x,this._y,this._z,this._order)}copy(e){return this._x=e._x,this._y=e._y,this._z=e._z,this._order=e._order,this._onChangeCallback(),this}setFromRotationMatrix(e,t=this._order,i=!0){const r=e.elements,s=r[0],o=r[4],a=r[8],l=r[1],c=r[5],d=r[9],u=r[2],_=r[6],f=r[10];switch(t){case"XYZ":this._y=Math.asin(En(a,-1,1)),Math.abs(a)<.9999999?(this._x=Math.atan2(-d,f),this._z=Math.atan2(-o,s)):(this._x=Math.atan2(_,c),this._z=0);break;case"YXZ":this._x=Math.asin(-En(d,-1,1)),Math.abs(d)<.9999999?(this._y=Math.atan2(a,f),this._z=Math.atan2(l,c)):(this._y=Math.atan2(-u,s),this._z=0);break;case"ZXY":this._x=Math.asin(En(_,-1,1)),Math.abs(_)<.9999999?(this._y=Math.atan2(-u,f),this._z=Math.atan2(-o,c)):(this._y=0,this._z=Math.atan2(l,s));break;case"ZYX":this._y=Math.asin(-En(u,-1,1)),Math.abs(u)<.9999999?(this._x=Math.atan2(_,f),this._z=Math.atan2(l,s)):(this._x=0,this._z=Math.atan2(-o,c));break;case"YZX":this._z=Math.asin(En(l,-1,1)),Math.abs(l)<.9999999?(this._x=Math.atan2(-d,c),this._y=Math.atan2(-u,s)):(this._x=0,this._y=Math.atan2(a,f));break;case"XZY":this._z=Math.asin(-En(o,-1,1)),Math.abs(o)<.9999999?(this._x=Math.atan2(_,c),this._y=Math.atan2(a,s)):(this._x=Math.atan2(-d,f),this._y=0);break;default:console.warn("THREE.Euler: .setFromRotationMatrix() encountered an unknown order: "+t)}return this._order=t,i===!0&&this._onChangeCallback(),this}setFromQuaternion(e,t,i){return lC.makeRotationFromQuaternion(e),this.setFromRotationMatrix(lC,t,i)}setFromVector3(e,t=this._order){return this.set(e.x,e.y,e.z,t)}reorder(e){return cC.setFromEuler(this),this.setFromQuaternion(cC,e)}equals(e){return e._x===this._x&&e._y===this._y&&e._z===this._z&&e._order===this._order}fromArray(e){return this._x=e[0],this._y=e[1],this._z=e[2],e[3]!==void 0&&(this._order=e[3]),this._onChangeCallback(),this}toArray(e=[],t=0){return e[t]=this._x,e[t+1]=this._y,e[t+2]=this._z,e[t+3]=this._order,e}_onChange(e){return this._onChangeCallback=e,this}_onChangeCallback(){}*[Symbol.iterator](){yield this._x,yield this._y,yield this._z,yield this._order}}cu.DEFAULT_ORDER="XYZ";class sO{constructor(){this.mask=1}set(e){this.mask=(1<>>0}enable(e){this.mask|=1<1){for(let t=0;t1){for(let i=0;i0&&(r.userData=this.userData),r.layers=this.layers.mask,r.matrix=this.matrix.toArray(),r.up=this.up.toArray(),this.matrixAutoUpdate===!1&&(r.matrixAutoUpdate=!1),this.isInstancedMesh&&(r.type="InstancedMesh",r.count=this.count,r.instanceMatrix=this.instanceMatrix.toJSON(),this.instanceColor!==null&&(r.instanceColor=this.instanceColor.toJSON())),this.isBatchedMesh&&(r.type="BatchedMesh",r.perObjectFrustumCulled=this.perObjectFrustumCulled,r.sortObjects=this.sortObjects,r.drawRanges=this._drawRanges,r.reservedRanges=this._reservedRanges,r.visibility=this._visibility,r.active=this._active,r.bounds=this._bounds.map(a=>({boxInitialized:a.boxInitialized,boxMin:a.box.min.toArray(),boxMax:a.box.max.toArray(),sphereInitialized:a.sphereInitialized,sphereRadius:a.sphere.radius,sphereCenter:a.sphere.center.toArray()})),r.maxGeometryCount=this._maxGeometryCount,r.maxVertexCount=this._maxVertexCount,r.maxIndexCount=this._maxIndexCount,r.geometryInitialized=this._geometryInitialized,r.geometryCount=this._geometryCount,r.matricesTexture=this._matricesTexture.toJSON(e),this.boundingSphere!==null&&(r.boundingSphere={center:r.boundingSphere.center.toArray(),radius:r.boundingSphere.radius}),this.boundingBox!==null&&(r.boundingBox={min:r.boundingBox.min.toArray(),max:r.boundingBox.max.toArray()}));function s(a,l){return a[l.uuid]===void 0&&(a[l.uuid]=l.toJSON(e)),l.uuid}if(this.isScene)this.background&&(this.background.isColor?r.background=this.background.toJSON():this.background.isTexture&&(r.background=this.background.toJSON(e).uuid)),this.environment&&this.environment.isTexture&&this.environment.isRenderTargetTexture!==!0&&(r.environment=this.environment.toJSON(e).uuid);else if(this.isMesh||this.isLine||this.isPoints){r.geometry=s(e.geometries,this.geometry);const a=this.geometry.parameters;if(a!==void 0&&a.shapes!==void 0){const l=a.shapes;if(Array.isArray(l))for(let c=0,d=l.length;c0){r.children=[];for(let a=0;a0){r.animations=[];for(let a=0;a0&&(i.geometries=a),l.length>0&&(i.materials=l),c.length>0&&(i.textures=c),d.length>0&&(i.images=d),u.length>0&&(i.shapes=u),_.length>0&&(i.skeletons=_),f.length>0&&(i.animations=f),h.length>0&&(i.nodes=h)}return i.object=r,i;function o(a){const l=[];for(const c in a){const d=a[c];delete d.metadata,l.push(d)}return l}}clone(e){return new this.constructor().copy(this,e)}copy(e,t=!0){if(this.name=e.name,this.up.copy(e.up),this.position.copy(e.position),this.rotation.order=e.rotation.order,this.quaternion.copy(e.quaternion),this.scale.copy(e.scale),this.matrix.copy(e.matrix),this.matrixWorld.copy(e.matrixWorld),this.matrixAutoUpdate=e.matrixAutoUpdate,this.matrixWorldAutoUpdate=e.matrixWorldAutoUpdate,this.matrixWorldNeedsUpdate=e.matrixWorldNeedsUpdate,this.layers.mask=e.layers.mask,this.visible=e.visible,this.castShadow=e.castShadow,this.receiveShadow=e.receiveShadow,this.frustumCulled=e.frustumCulled,this.renderOrder=e.renderOrder,this.animations=e.animations.slice(),this.userData=JSON.parse(JSON.stringify(e.userData)),t===!0)for(let i=0;i0?r.multiplyScalar(1/Math.sqrt(s)):r.set(0,0,0)}static getBarycoord(e,t,i,r,s){ai.subVectors(r,t),Ki.subVectors(i,t),Hf.subVectors(e,t);const o=ai.dot(ai),a=ai.dot(Ki),l=ai.dot(Hf),c=Ki.dot(Ki),d=Ki.dot(Hf),u=o*c-a*a;if(u===0)return s.set(-2,-1,-1);const _=1/u,f=(c*l-a*d)*_,h=(o*d-a*l)*_;return s.set(1-f-h,h,f)}static containsPoint(e,t,i,r){return this.getBarycoord(e,t,i,r,ji),ji.x>=0&&ji.y>=0&&ji.x+ji.y<=1}static getUV(e,t,i,r,s,o,a,l){return gc===!1&&(console.warn("THREE.Triangle.getUV() has been renamed to THREE.Triangle.getInterpolation()."),gc=!0),this.getInterpolation(e,t,i,r,s,o,a,l)}static getInterpolation(e,t,i,r,s,o,a,l){return this.getBarycoord(e,t,i,r,ji),l.setScalar(0),l.addScaledVector(s,ji.x),l.addScaledVector(o,ji.y),l.addScaledVector(a,ji.z),l}static isFrontFacing(e,t,i,r){return ai.subVectors(i,t),Ki.subVectors(e,t),ai.cross(Ki).dot(r)<0}set(e,t,i){return this.a.copy(e),this.b.copy(t),this.c.copy(i),this}setFromPointsAndIndices(e,t,i,r){return this.a.copy(e[t]),this.b.copy(e[i]),this.c.copy(e[r]),this}setFromAttributeAndIndices(e,t,i,r){return this.a.fromBufferAttribute(e,t),this.b.fromBufferAttribute(e,i),this.c.fromBufferAttribute(e,r),this}clone(){return new this.constructor().copy(this)}copy(e){return this.a.copy(e.a),this.b.copy(e.b),this.c.copy(e.c),this}getArea(){return ai.subVectors(this.c,this.b),Ki.subVectors(this.a,this.b),ai.cross(Ki).length()*.5}getMidpoint(e){return e.addVectors(this.a,this.b).add(this.c).multiplyScalar(1/3)}getNormal(e){return di.getNormal(this.a,this.b,this.c,e)}getPlane(e){return e.setFromCoplanarPoints(this.a,this.b,this.c)}getBarycoord(e,t){return di.getBarycoord(e,this.a,this.b,this.c,t)}getUV(e,t,i,r,s){return gc===!1&&(console.warn("THREE.Triangle.getUV() has been renamed to THREE.Triangle.getInterpolation()."),gc=!0),di.getInterpolation(e,this.a,this.b,this.c,t,i,r,s)}getInterpolation(e,t,i,r,s){return di.getInterpolation(e,this.a,this.b,this.c,t,i,r,s)}containsPoint(e){return di.containsPoint(e,this.a,this.b,this.c)}isFrontFacing(e){return di.isFrontFacing(this.a,this.b,this.c,e)}intersectsBox(e){return e.intersectsTriangle(this)}closestPointToPoint(e,t){const i=this.a,r=this.b,s=this.c;let o,a;oo.subVectors(r,i),ao.subVectors(s,i),qf.subVectors(e,i);const l=oo.dot(qf),c=ao.dot(qf);if(l<=0&&c<=0)return t.copy(i);Yf.subVectors(e,r);const d=oo.dot(Yf),u=ao.dot(Yf);if(d>=0&&u<=d)return t.copy(r);const _=l*u-d*c;if(_<=0&&l>=0&&d<=0)return o=l/(l-d),t.copy(i).addScaledVector(oo,o);$f.subVectors(e,s);const f=oo.dot($f),h=ao.dot($f);if(h>=0&&f<=h)return t.copy(s);const E=f*c-l*h;if(E<=0&&c>=0&&h<=0)return a=c/(c-h),t.copy(i).addScaledVector(ao,a);const g=d*h-f*u;if(g<=0&&u-d>=0&&f-h>=0)return hC.subVectors(s,r),a=(u-d)/(u-d+(f-h)),t.copy(r).addScaledVector(hC,a);const m=1/(g+E+_);return o=E*m,a=_*m,t.copy(i).addScaledVector(oo,o).addScaledVector(ao,a)}equals(e){return e.a.equals(this.a)&&e.b.equals(this.b)&&e.c.equals(this.c)}}const oO={aliceblue:15792383,antiquewhite:16444375,aqua:65535,aquamarine:8388564,azure:15794175,beige:16119260,bisque:16770244,black:0,blanchedalmond:16772045,blue:255,blueviolet:9055202,brown:10824234,burlywood:14596231,cadetblue:6266528,chartreuse:8388352,chocolate:13789470,coral:16744272,cornflowerblue:6591981,cornsilk:16775388,crimson:14423100,cyan:65535,darkblue:139,darkcyan:35723,darkgoldenrod:12092939,darkgray:11119017,darkgreen:25600,darkgrey:11119017,darkkhaki:12433259,darkmagenta:9109643,darkolivegreen:5597999,darkorange:16747520,darkorchid:10040012,darkred:9109504,darksalmon:15308410,darkseagreen:9419919,darkslateblue:4734347,darkslategray:3100495,darkslategrey:3100495,darkturquoise:52945,darkviolet:9699539,deeppink:16716947,deepskyblue:49151,dimgray:6908265,dimgrey:6908265,dodgerblue:2003199,firebrick:11674146,floralwhite:16775920,forestgreen:2263842,fuchsia:16711935,gainsboro:14474460,ghostwhite:16316671,gold:16766720,goldenrod:14329120,gray:8421504,green:32768,greenyellow:11403055,grey:8421504,honeydew:15794160,hotpink:16738740,indianred:13458524,indigo:4915330,ivory:16777200,khaki:15787660,lavender:15132410,lavenderblush:16773365,lawngreen:8190976,lemonchiffon:16775885,lightblue:11393254,lightcoral:15761536,lightcyan:14745599,lightgoldenrodyellow:16448210,lightgray:13882323,lightgreen:9498256,lightgrey:13882323,lightpink:16758465,lightsalmon:16752762,lightseagreen:2142890,lightskyblue:8900346,lightslategray:7833753,lightslategrey:7833753,lightsteelblue:11584734,lightyellow:16777184,lime:65280,limegreen:3329330,linen:16445670,magenta:16711935,maroon:8388608,mediumaquamarine:6737322,mediumblue:205,mediumorchid:12211667,mediumpurple:9662683,mediumseagreen:3978097,mediumslateblue:8087790,mediumspringgreen:64154,mediumturquoise:4772300,mediumvioletred:13047173,midnightblue:1644912,mintcream:16121850,mistyrose:16770273,moccasin:16770229,navajowhite:16768685,navy:128,oldlace:16643558,olive:8421376,olivedrab:7048739,orange:16753920,orangered:16729344,orchid:14315734,palegoldenrod:15657130,palegreen:10025880,paleturquoise:11529966,palevioletred:14381203,papayawhip:16773077,peachpuff:16767673,peru:13468991,pink:16761035,plum:14524637,powderblue:11591910,purple:8388736,rebeccapurple:6697881,red:16711680,rosybrown:12357519,royalblue:4286945,saddlebrown:9127187,salmon:16416882,sandybrown:16032864,seagreen:3050327,seashell:16774638,sienna:10506797,silver:12632256,skyblue:8900331,slateblue:6970061,slategray:7372944,slategrey:7372944,snow:16775930,springgreen:65407,steelblue:4620980,tan:13808780,teal:32896,thistle:14204888,tomato:16737095,turquoise:4251856,violet:15631086,wheat:16113331,white:16777215,whitesmoke:16119285,yellow:16776960,yellowgreen:10145074},xr={h:0,s:0,l:0},Ec={h:0,s:0,l:0};function Wf(n,e,t){return t<0&&(t+=1),t>1&&(t-=1),t<1/6?n+(e-n)*6*t:t<1/2?e:t<2/3?n+(e-n)*6*(2/3-t):n}class ot{constructor(e,t,i){return this.isColor=!0,this.r=1,this.g=1,this.b=1,this.set(e,t,i)}set(e,t,i){if(t===void 0&&i===void 0){const r=e;r&&r.isColor?this.copy(r):typeof r=="number"?this.setHex(r):typeof r=="string"&&this.setStyle(r)}else this.setRGB(e,t,i);return this}setScalar(e){return this.r=e,this.g=e,this.b=e,this}setHex(e,t=Kt){return e=Math.floor(e),this.r=(e>>16&255)/255,this.g=(e>>8&255)/255,this.b=(e&255)/255,Nt.toWorkingColorSpace(this,t),this}setRGB(e,t,i,r=Nt.workingColorSpace){return this.r=e,this.g=t,this.b=i,Nt.toWorkingColorSpace(this,r),this}setHSL(e,t,i,r=Nt.workingColorSpace){if(e=BE(e,1),t=En(t,0,1),i=En(i,0,1),t===0)this.r=this.g=this.b=i;else{const s=i<=.5?i*(1+t):i+t-i*t,o=2*i-s;this.r=Wf(o,s,e+1/3),this.g=Wf(o,s,e),this.b=Wf(o,s,e-1/3)}return Nt.toWorkingColorSpace(this,r),this}setStyle(e,t=Kt){function i(s){s!==void 0&&parseFloat(s)<1&&console.warn("THREE.Color: Alpha component of "+e+" will be ignored.")}let r;if(r=/^(\w+)\(([^\)]*)\)/.exec(e)){let s;const o=r[1],a=r[2];switch(o){case"rgb":case"rgba":if(s=/^\s*(\d+)\s*,\s*(\d+)\s*,\s*(\d+)\s*(?:,\s*(\d*\.?\d+)\s*)?$/.exec(a))return i(s[4]),this.setRGB(Math.min(255,parseInt(s[1],10))/255,Math.min(255,parseInt(s[2],10))/255,Math.min(255,parseInt(s[3],10))/255,t);if(s=/^\s*(\d+)\%\s*,\s*(\d+)\%\s*,\s*(\d+)\%\s*(?:,\s*(\d*\.?\d+)\s*)?$/.exec(a))return i(s[4]),this.setRGB(Math.min(100,parseInt(s[1],10))/100,Math.min(100,parseInt(s[2],10))/100,Math.min(100,parseInt(s[3],10))/100,t);break;case"hsl":case"hsla":if(s=/^\s*(\d*\.?\d+)\s*,\s*(\d*\.?\d+)\%\s*,\s*(\d*\.?\d+)\%\s*(?:,\s*(\d*\.?\d+)\s*)?$/.exec(a))return i(s[4]),this.setHSL(parseFloat(s[1])/360,parseFloat(s[2])/100,parseFloat(s[3])/100,t);break;default:console.warn("THREE.Color: Unknown color model "+e)}}else if(r=/^\#([A-Fa-f\d]+)$/.exec(e)){const s=r[1],o=s.length;if(o===3)return this.setRGB(parseInt(s.charAt(0),16)/15,parseInt(s.charAt(1),16)/15,parseInt(s.charAt(2),16)/15,t);if(o===6)return this.setHex(parseInt(s,16),t);console.warn("THREE.Color: Invalid hex color "+e)}else if(e&&e.length>0)return this.setColorName(e,t);return this}setColorName(e,t=Kt){const i=oO[e.toLowerCase()];return i!==void 0?this.setHex(i,t):console.warn("THREE.Color: Unknown color "+e),this}clone(){return new this.constructor(this.r,this.g,this.b)}copy(e){return this.r=e.r,this.g=e.g,this.b=e.b,this}copySRGBToLinear(e){return this.r=Mo(e.r),this.g=Mo(e.g),this.b=Mo(e.b),this}copyLinearToSRGB(e){return this.r=kf(e.r),this.g=kf(e.g),this.b=kf(e.b),this}convertSRGBToLinear(){return this.copySRGBToLinear(this),this}convertLinearToSRGB(){return this.copyLinearToSRGB(this),this}getHex(e=Kt){return Nt.fromWorkingColorSpace(gn.copy(this),e),Math.round(En(gn.r*255,0,255))*65536+Math.round(En(gn.g*255,0,255))*256+Math.round(En(gn.b*255,0,255))}getHexString(e=Kt){return("000000"+this.getHex(e).toString(16)).slice(-6)}getHSL(e,t=Nt.workingColorSpace){Nt.fromWorkingColorSpace(gn.copy(this),t);const i=gn.r,r=gn.g,s=gn.b,o=Math.max(i,r,s),a=Math.min(i,r,s);let l,c;const d=(a+o)/2;if(a===o)l=0,c=0;else{const u=o-a;switch(c=d<=.5?u/(o+a):u/(2-o-a),o){case i:l=(r-s)/u+(r0!=e>0&&this.version++,this._alphaTest=e}onBuild(){}onBeforeRender(){}onBeforeCompile(){}customProgramCacheKey(){return this.onBeforeCompile.toString()}setValues(e){if(e!==void 0)for(const t in e){const i=e[t];if(i===void 0){console.warn(`THREE.Material: parameter '${t}' has value of undefined.`);continue}const r=this[t];if(r===void 0){console.warn(`THREE.Material: '${t}' is not a property of THREE.${this.type}.`);continue}r&&r.isColor?r.set(i):r&&r.isVector3&&i&&i.isVector3?r.copy(i):this[t]=i}}toJSON(e){const t=e===void 0||typeof e=="string";t&&(e={textures:{},images:{}});const i={metadata:{version:4.6,type:"Material",generator:"Material.toJSON"}};i.uuid=this.uuid,i.type=this.type,this.name!==""&&(i.name=this.name),this.color&&this.color.isColor&&(i.color=this.color.getHex()),this.roughness!==void 0&&(i.roughness=this.roughness),this.metalness!==void 0&&(i.metalness=this.metalness),this.sheen!==void 0&&(i.sheen=this.sheen),this.sheenColor&&this.sheenColor.isColor&&(i.sheenColor=this.sheenColor.getHex()),this.sheenRoughness!==void 0&&(i.sheenRoughness=this.sheenRoughness),this.emissive&&this.emissive.isColor&&(i.emissive=this.emissive.getHex()),this.emissiveIntensity&&this.emissiveIntensity!==1&&(i.emissiveIntensity=this.emissiveIntensity),this.specular&&this.specular.isColor&&(i.specular=this.specular.getHex()),this.specularIntensity!==void 0&&(i.specularIntensity=this.specularIntensity),this.specularColor&&this.specularColor.isColor&&(i.specularColor=this.specularColor.getHex()),this.shininess!==void 0&&(i.shininess=this.shininess),this.clearcoat!==void 0&&(i.clearcoat=this.clearcoat),this.clearcoatRoughness!==void 0&&(i.clearcoatRoughness=this.clearcoatRoughness),this.clearcoatMap&&this.clearcoatMap.isTexture&&(i.clearcoatMap=this.clearcoatMap.toJSON(e).uuid),this.clearcoatRoughnessMap&&this.clearcoatRoughnessMap.isTexture&&(i.clearcoatRoughnessMap=this.clearcoatRoughnessMap.toJSON(e).uuid),this.clearcoatNormalMap&&this.clearcoatNormalMap.isTexture&&(i.clearcoatNormalMap=this.clearcoatNormalMap.toJSON(e).uuid,i.clearcoatNormalScale=this.clearcoatNormalScale.toArray()),this.iridescence!==void 0&&(i.iridescence=this.iridescence),this.iridescenceIOR!==void 0&&(i.iridescenceIOR=this.iridescenceIOR),this.iridescenceThicknessRange!==void 0&&(i.iridescenceThicknessRange=this.iridescenceThicknessRange),this.iridescenceMap&&this.iridescenceMap.isTexture&&(i.iridescenceMap=this.iridescenceMap.toJSON(e).uuid),this.iridescenceThicknessMap&&this.iridescenceThicknessMap.isTexture&&(i.iridescenceThicknessMap=this.iridescenceThicknessMap.toJSON(e).uuid),this.anisotropy!==void 0&&(i.anisotropy=this.anisotropy),this.anisotropyRotation!==void 0&&(i.anisotropyRotation=this.anisotropyRotation),this.anisotropyMap&&this.anisotropyMap.isTexture&&(i.anisotropyMap=this.anisotropyMap.toJSON(e).uuid),this.map&&this.map.isTexture&&(i.map=this.map.toJSON(e).uuid),this.matcap&&this.matcap.isTexture&&(i.matcap=this.matcap.toJSON(e).uuid),this.alphaMap&&this.alphaMap.isTexture&&(i.alphaMap=this.alphaMap.toJSON(e).uuid),this.lightMap&&this.lightMap.isTexture&&(i.lightMap=this.lightMap.toJSON(e).uuid,i.lightMapIntensity=this.lightMapIntensity),this.aoMap&&this.aoMap.isTexture&&(i.aoMap=this.aoMap.toJSON(e).uuid,i.aoMapIntensity=this.aoMapIntensity),this.bumpMap&&this.bumpMap.isTexture&&(i.bumpMap=this.bumpMap.toJSON(e).uuid,i.bumpScale=this.bumpScale),this.normalMap&&this.normalMap.isTexture&&(i.normalMap=this.normalMap.toJSON(e).uuid,i.normalMapType=this.normalMapType,i.normalScale=this.normalScale.toArray()),this.displacementMap&&this.displacementMap.isTexture&&(i.displacementMap=this.displacementMap.toJSON(e).uuid,i.displacementScale=this.displacementScale,i.displacementBias=this.displacementBias),this.roughnessMap&&this.roughnessMap.isTexture&&(i.roughnessMap=this.roughnessMap.toJSON(e).uuid),this.metalnessMap&&this.metalnessMap.isTexture&&(i.metalnessMap=this.metalnessMap.toJSON(e).uuid),this.emissiveMap&&this.emissiveMap.isTexture&&(i.emissiveMap=this.emissiveMap.toJSON(e).uuid),this.specularMap&&this.specularMap.isTexture&&(i.specularMap=this.specularMap.toJSON(e).uuid),this.specularIntensityMap&&this.specularIntensityMap.isTexture&&(i.specularIntensityMap=this.specularIntensityMap.toJSON(e).uuid),this.specularColorMap&&this.specularColorMap.isTexture&&(i.specularColorMap=this.specularColorMap.toJSON(e).uuid),this.envMap&&this.envMap.isTexture&&(i.envMap=this.envMap.toJSON(e).uuid,this.combine!==void 0&&(i.combine=this.combine)),this.envMapIntensity!==void 0&&(i.envMapIntensity=this.envMapIntensity),this.reflectivity!==void 0&&(i.reflectivity=this.reflectivity),this.refractionRatio!==void 0&&(i.refractionRatio=this.refractionRatio),this.gradientMap&&this.gradientMap.isTexture&&(i.gradientMap=this.gradientMap.toJSON(e).uuid),this.transmission!==void 0&&(i.transmission=this.transmission),this.transmissionMap&&this.transmissionMap.isTexture&&(i.transmissionMap=this.transmissionMap.toJSON(e).uuid),this.thickness!==void 0&&(i.thickness=this.thickness),this.thicknessMap&&this.thicknessMap.isTexture&&(i.thicknessMap=this.thicknessMap.toJSON(e).uuid),this.attenuationDistance!==void 0&&this.attenuationDistance!==1/0&&(i.attenuationDistance=this.attenuationDistance),this.attenuationColor!==void 0&&(i.attenuationColor=this.attenuationColor.getHex()),this.size!==void 0&&(i.size=this.size),this.shadowSide!==null&&(i.shadowSide=this.shadowSide),this.sizeAttenuation!==void 0&&(i.sizeAttenuation=this.sizeAttenuation),this.blending!==No&&(i.blending=this.blending),this.side!==cr&&(i.side=this.side),this.vertexColors===!0&&(i.vertexColors=!0),this.opacity<1&&(i.opacity=this.opacity),this.transparent===!0&&(i.transparent=!0),this.blendSrc!==jm&&(i.blendSrc=this.blendSrc),this.blendDst!==Qm&&(i.blendDst=this.blendDst),this.blendEquation!==bs&&(i.blendEquation=this.blendEquation),this.blendSrcAlpha!==null&&(i.blendSrcAlpha=this.blendSrcAlpha),this.blendDstAlpha!==null&&(i.blendDstAlpha=this.blendDstAlpha),this.blendEquationAlpha!==null&&(i.blendEquationAlpha=this.blendEquationAlpha),this.blendColor&&this.blendColor.isColor&&(i.blendColor=this.blendColor.getHex()),this.blendAlpha!==0&&(i.blendAlpha=this.blendAlpha),this.depthFunc!==yd&&(i.depthFunc=this.depthFunc),this.depthTest===!1&&(i.depthTest=this.depthTest),this.depthWrite===!1&&(i.depthWrite=this.depthWrite),this.colorWrite===!1&&(i.colorWrite=this.colorWrite),this.stencilWriteMask!==255&&(i.stencilWriteMask=this.stencilWriteMask),this.stencilFunc!==tC&&(i.stencilFunc=this.stencilFunc),this.stencilRef!==0&&(i.stencilRef=this.stencilRef),this.stencilFuncMask!==255&&(i.stencilFuncMask=this.stencilFuncMask),this.stencilFail!==Js&&(i.stencilFail=this.stencilFail),this.stencilZFail!==Js&&(i.stencilZFail=this.stencilZFail),this.stencilZPass!==Js&&(i.stencilZPass=this.stencilZPass),this.stencilWrite===!0&&(i.stencilWrite=this.stencilWrite),this.rotation!==void 0&&this.rotation!==0&&(i.rotation=this.rotation),this.polygonOffset===!0&&(i.polygonOffset=!0),this.polygonOffsetFactor!==0&&(i.polygonOffsetFactor=this.polygonOffsetFactor),this.polygonOffsetUnits!==0&&(i.polygonOffsetUnits=this.polygonOffsetUnits),this.linewidth!==void 0&&this.linewidth!==1&&(i.linewidth=this.linewidth),this.dashSize!==void 0&&(i.dashSize=this.dashSize),this.gapSize!==void 0&&(i.gapSize=this.gapSize),this.scale!==void 0&&(i.scale=this.scale),this.dithering===!0&&(i.dithering=!0),this.alphaTest>0&&(i.alphaTest=this.alphaTest),this.alphaHash===!0&&(i.alphaHash=!0),this.alphaToCoverage===!0&&(i.alphaToCoverage=!0),this.premultipliedAlpha===!0&&(i.premultipliedAlpha=!0),this.forceSinglePass===!0&&(i.forceSinglePass=!0),this.wireframe===!0&&(i.wireframe=!0),this.wireframeLinewidth>1&&(i.wireframeLinewidth=this.wireframeLinewidth),this.wireframeLinecap!=="round"&&(i.wireframeLinecap=this.wireframeLinecap),this.wireframeLinejoin!=="round"&&(i.wireframeLinejoin=this.wireframeLinejoin),this.flatShading===!0&&(i.flatShading=!0),this.visible===!1&&(i.visible=!1),this.toneMapped===!1&&(i.toneMapped=!1),this.fog===!1&&(i.fog=!1),Object.keys(this.userData).length>0&&(i.userData=this.userData);function r(s){const o=[];for(const a in s){const l=s[a];delete l.metadata,o.push(l)}return o}if(t){const s=r(e.textures),o=r(e.images);s.length>0&&(i.textures=s),o.length>0&&(i.images=o)}return i}clone(){return new this.constructor().copy(this)}copy(e){this.name=e.name,this.blending=e.blending,this.side=e.side,this.vertexColors=e.vertexColors,this.opacity=e.opacity,this.transparent=e.transparent,this.blendSrc=e.blendSrc,this.blendDst=e.blendDst,this.blendEquation=e.blendEquation,this.blendSrcAlpha=e.blendSrcAlpha,this.blendDstAlpha=e.blendDstAlpha,this.blendEquationAlpha=e.blendEquationAlpha,this.blendColor.copy(e.blendColor),this.blendAlpha=e.blendAlpha,this.depthFunc=e.depthFunc,this.depthTest=e.depthTest,this.depthWrite=e.depthWrite,this.stencilWriteMask=e.stencilWriteMask,this.stencilFunc=e.stencilFunc,this.stencilRef=e.stencilRef,this.stencilFuncMask=e.stencilFuncMask,this.stencilFail=e.stencilFail,this.stencilZFail=e.stencilZFail,this.stencilZPass=e.stencilZPass,this.stencilWrite=e.stencilWrite;const t=e.clippingPlanes;let i=null;if(t!==null){const r=t.length;i=new Array(r);for(let s=0;s!==r;++s)i[s]=t[s].clone()}return this.clippingPlanes=i,this.clipIntersection=e.clipIntersection,this.clipShadows=e.clipShadows,this.shadowSide=e.shadowSide,this.colorWrite=e.colorWrite,this.precision=e.precision,this.polygonOffset=e.polygonOffset,this.polygonOffsetFactor=e.polygonOffsetFactor,this.polygonOffsetUnits=e.polygonOffsetUnits,this.dithering=e.dithering,this.alphaTest=e.alphaTest,this.alphaHash=e.alphaHash,this.alphaToCoverage=e.alphaToCoverage,this.premultipliedAlpha=e.premultipliedAlpha,this.forceSinglePass=e.forceSinglePass,this.visible=e.visible,this.toneMapped=e.toneMapped,this.userData=JSON.parse(JSON.stringify(e.userData)),this}dispose(){this.dispatchEvent({type:"dispose"})}set needsUpdate(e){e===!0&&this.version++}}class Fr extends mi{constructor(e){super(),this.isMeshBasicMaterial=!0,this.type="MeshBasicMaterial",this.color=new ot(16777215),this.map=null,this.lightMap=null,this.lightMapIntensity=1,this.aoMap=null,this.aoMapIntensity=1,this.specularMap=null,this.alphaMap=null,this.envMap=null,this.combine=kE,this.reflectivity=1,this.refractionRatio=.98,this.wireframe=!1,this.wireframeLinewidth=1,this.wireframeLinecap="round",this.wireframeLinejoin="round",this.fog=!0,this.setValues(e)}copy(e){return super.copy(e),this.color.copy(e.color),this.map=e.map,this.lightMap=e.lightMap,this.lightMapIntensity=e.lightMapIntensity,this.aoMap=e.aoMap,this.aoMapIntensity=e.aoMapIntensity,this.specularMap=e.specularMap,this.alphaMap=e.alphaMap,this.envMap=e.envMap,this.combine=e.combine,this.reflectivity=e.reflectivity,this.refractionRatio=e.refractionRatio,this.wireframe=e.wireframe,this.wireframeLinewidth=e.wireframeLinewidth,this.wireframeLinecap=e.wireframeLinecap,this.wireframeLinejoin=e.wireframeLinejoin,this.fog=e.fog,this}}const Zt=new ue,bc=new vt;class wn{constructor(e,t,i=!1){if(Array.isArray(e))throw new TypeError("THREE.BufferAttribute: array should be a Typed Array.");this.isBufferAttribute=!0,this.name="",this.array=e,this.itemSize=t,this.count=e!==void 0?e.length/t:0,this.normalized=i,this.usage=tg,this._updateRange={offset:0,count:-1},this.updateRanges=[],this.gpuType=tr,this.version=0}onUploadCallback(){}set needsUpdate(e){e===!0&&this.version++}get updateRange(){return console.warn('THREE.BufferAttribute: "updateRange" is deprecated and removed in r169. Use "addUpdateRange()" instead.'),this._updateRange}setUsage(e){return this.usage=e,this}addUpdateRange(e,t){this.updateRanges.push({start:e,count:t})}clearUpdateRanges(){this.updateRanges.length=0}copy(e){return this.name=e.name,this.array=new e.array.constructor(e.array),this.itemSize=e.itemSize,this.count=e.count,this.normalized=e.normalized,this.usage=e.usage,this.gpuType=e.gpuType,this}copyAt(e,t,i){e*=this.itemSize,i*=t.itemSize;for(let r=0,s=this.itemSize;r0&&(e.userData=this.userData),this.parameters!==void 0){const l=this.parameters;for(const c in l)l[c]!==void 0&&(e[c]=l[c]);return e}e.data={attributes:{}};const t=this.index;t!==null&&(e.data.index={type:t.array.constructor.name,array:Array.prototype.slice.call(t.array)});const i=this.attributes;for(const l in i){const c=i[l];e.data.attributes[l]=c.toJSON(e.data)}const r={};let s=!1;for(const l in this.morphAttributes){const c=this.morphAttributes[l],d=[];for(let u=0,_=c.length;u<_;u++){const f=c[u];d.push(f.toJSON(e.data))}d.length>0&&(r[l]=d,s=!0)}s&&(e.data.morphAttributes=r,e.data.morphTargetsRelative=this.morphTargetsRelative);const o=this.groups;o.length>0&&(e.data.groups=JSON.parse(JSON.stringify(o)));const a=this.boundingSphere;return a!==null&&(e.data.boundingSphere={center:a.center.toArray(),radius:a.radius}),e}clone(){return new this.constructor().copy(this)}copy(e){this.index=null,this.attributes={},this.morphAttributes={},this.groups=[],this.boundingBox=null,this.boundingSphere=null;const t={};this.name=e.name;const i=e.index;i!==null&&this.setIndex(i.clone(t));const r=e.attributes;for(const c in r){const d=r[c];this.setAttribute(c,d.clone(t))}const s=e.morphAttributes;for(const c in s){const d=[],u=s[c];for(let _=0,f=u.length;_0){const r=t[i[0]];if(r!==void 0){this.morphTargetInfluences=[],this.morphTargetDictionary={};for(let s=0,o=r.length;s(e.far-e.near)**2))&&(fC.copy(s).invert(),ls.copy(e.ray).applyMatrix4(fC),!(i.boundingBox!==null&&ls.intersectsBox(i.boundingBox)===!1)&&this._computeIntersections(e,t,ls)))}_computeIntersections(e,t,i){let r;const s=this.geometry,o=this.material,a=s.index,l=s.attributes.position,c=s.attributes.uv,d=s.attributes.uv1,u=s.attributes.normal,_=s.groups,f=s.drawRange;if(a!==null)if(Array.isArray(o))for(let h=0,E=_.length;ht.far?null:{distance:c,point:Rc.clone(),object:n}}function Ac(n,e,t,i,r,s,o,a,l,c){n.getVertexPosition(a,co),n.getVertexPosition(l,uo),n.getVertexPosition(c,_o);const d=Zgt(n,e,t,i,co,uo,_o,Cc);if(d){r&&(vc.fromBufferAttribute(r,a),Tc.fromBufferAttribute(r,l),xc.fromBufferAttribute(r,c),d.uv=di.getInterpolation(Cc,co,uo,_o,vc,Tc,xc,new vt)),s&&(vc.fromBufferAttribute(s,a),Tc.fromBufferAttribute(s,l),xc.fromBufferAttribute(s,c),d.uv1=di.getInterpolation(Cc,co,uo,_o,vc,Tc,xc,new vt),d.uv2=d.uv1),o&&(gC.fromBufferAttribute(o,a),EC.fromBufferAttribute(o,l),bC.fromBufferAttribute(o,c),d.normal=di.getInterpolation(Cc,co,uo,_o,gC,EC,bC,new ue),d.normal.dot(i.direction)>0&&d.normal.multiplyScalar(-1));const u={a,b:l,c,normal:new ue,materialIndex:0};di.getNormal(co,uo,_o,u.normal),d.face=u}return d}class $r extends Fi{constructor(e=1,t=1,i=1,r=1,s=1,o=1){super(),this.type="BoxGeometry",this.parameters={width:e,height:t,depth:i,widthSegments:r,heightSegments:s,depthSegments:o};const a=this;r=Math.floor(r),s=Math.floor(s),o=Math.floor(o);const l=[],c=[],d=[],u=[];let _=0,f=0;h("z","y","x",-1,-1,i,t,e,o,s,0),h("z","y","x",1,-1,i,t,-e,o,s,1),h("x","z","y",1,1,e,i,t,r,o,2),h("x","z","y",1,-1,e,i,-t,r,o,3),h("x","y","z",1,-1,e,t,i,r,s,4),h("x","y","z",-1,-1,e,t,-i,r,s,5),this.setIndex(l),this.setAttribute("position",new sr(c,3)),this.setAttribute("normal",new sr(d,3)),this.setAttribute("uv",new sr(u,2));function h(E,g,m,b,S,v,T,C,N,x,y){const R=v/N,P=T/x,k=v/2,W=T/2,I=C/2,V=N+1,z=x+1;let D=0,Y=0;const K=new ue;for(let q=0;q0?1:-1,d.push(K.x,K.y,K.z),u.push(Z/N),u.push(1-q/x),D+=1}}for(let q=0;q0&&(t.defines=this.defines),t.vertexShader=this.vertexShader,t.fragmentShader=this.fragmentShader,t.lights=this.lights,t.clipping=this.clipping;const i={};for(const r in this.extensions)this.extensions[r]===!0&&(i[r]=!0);return Object.keys(i).length>0&&(t.extensions=i),t}}class dO extends Yt{constructor(){super(),this.isCamera=!0,this.type="Camera",this.matrixWorldInverse=new gt,this.projectionMatrix=new gt,this.projectionMatrixInverse=new gt,this.coordinateSystem=nr}copy(e,t){return super.copy(e,t),this.matrixWorldInverse.copy(e.matrixWorldInverse),this.projectionMatrix.copy(e.projectionMatrix),this.projectionMatrixInverse.copy(e.projectionMatrixInverse),this.coordinateSystem=e.coordinateSystem,this}getWorldDirection(e){return super.getWorldDirection(e).negate()}updateMatrixWorld(e){super.updateMatrixWorld(e),this.matrixWorldInverse.copy(this.matrixWorld).invert()}updateWorldMatrix(e,t){super.updateWorldMatrix(e,t),this.matrixWorldInverse.copy(this.matrixWorld).invert()}clone(){return new this.constructor().copy(this)}}class Rn extends dO{constructor(e=50,t=1,i=.1,r=2e3){super(),this.isPerspectiveCamera=!0,this.type="PerspectiveCamera",this.fov=e,this.zoom=1,this.near=i,this.far=r,this.focus=10,this.aspect=t,this.view=null,this.filmGauge=35,this.filmOffset=0,this.updateProjectionMatrix()}copy(e,t){return super.copy(e,t),this.fov=e.fov,this.zoom=e.zoom,this.near=e.near,this.far=e.far,this.focus=e.focus,this.aspect=e.aspect,this.view=e.view===null?null:Object.assign({},e.view),this.filmGauge=e.filmGauge,this.filmOffset=e.filmOffset,this}setFocalLength(e){const t=.5*this.getFilmHeight()/e;this.fov=ea*2*Math.atan(t),this.updateProjectionMatrix()}getFocalLength(){const e=Math.tan(tl*.5*this.fov);return .5*this.getFilmHeight()/e}getEffectiveFOV(){return ea*2*Math.atan(Math.tan(tl*.5*this.fov)/this.zoom)}getFilmWidth(){return this.filmGauge*Math.min(this.aspect,1)}getFilmHeight(){return this.filmGauge/Math.max(this.aspect,1)}setViewOffset(e,t,i,r,s,o){this.aspect=e/t,this.view===null&&(this.view={enabled:!0,fullWidth:1,fullHeight:1,offsetX:0,offsetY:0,width:1,height:1}),this.view.enabled=!0,this.view.fullWidth=e,this.view.fullHeight=t,this.view.offsetX=i,this.view.offsetY=r,this.view.width=s,this.view.height=o,this.updateProjectionMatrix()}clearViewOffset(){this.view!==null&&(this.view.enabled=!1),this.updateProjectionMatrix()}updateProjectionMatrix(){const e=this.near;let t=e*Math.tan(tl*.5*this.fov)/this.zoom,i=2*t,r=this.aspect*i,s=-.5*r;const o=this.view;if(this.view!==null&&this.view.enabled){const l=o.fullWidth,c=o.fullHeight;s+=o.offsetX*r/l,t-=o.offsetY*i/c,r*=o.width/l,i*=o.height/c}const a=this.filmOffset;a!==0&&(s+=e*a/this.getFilmWidth()),this.projectionMatrix.makePerspective(s,s+r,t,t-i,e,this.far,this.coordinateSystem),this.projectionMatrixInverse.copy(this.projectionMatrix).invert()}toJSON(e){const t=super.toJSON(e);return t.object.fov=this.fov,t.object.zoom=this.zoom,t.object.near=this.near,t.object.far=this.far,t.object.focus=this.focus,t.object.aspect=this.aspect,this.view!==null&&(t.object.view=Object.assign({},this.view)),t.object.filmGauge=this.filmGauge,t.object.filmOffset=this.filmOffset,t}}const po=-90,ho=1;class Jgt extends Yt{constructor(e,t,i){super(),this.type="CubeCamera",this.renderTarget=i,this.coordinateSystem=null,this.activeMipmapLevel=0;const r=new Rn(po,ho,e,t);r.layers=this.layers,this.add(r);const s=new Rn(po,ho,e,t);s.layers=this.layers,this.add(s);const o=new Rn(po,ho,e,t);o.layers=this.layers,this.add(o);const a=new Rn(po,ho,e,t);a.layers=this.layers,this.add(a);const l=new Rn(po,ho,e,t);l.layers=this.layers,this.add(l);const c=new Rn(po,ho,e,t);c.layers=this.layers,this.add(c)}updateCoordinateSystem(){const e=this.coordinateSystem,t=this.children.concat(),[i,r,s,o,a,l]=t;for(const c of t)this.remove(c);if(e===nr)i.up.set(0,1,0),i.lookAt(1,0,0),r.up.set(0,1,0),r.lookAt(-1,0,0),s.up.set(0,0,-1),s.lookAt(0,1,0),o.up.set(0,0,1),o.lookAt(0,-1,0),a.up.set(0,1,0),a.lookAt(0,0,1),l.up.set(0,1,0),l.lookAt(0,0,-1);else if(e===Rd)i.up.set(0,-1,0),i.lookAt(-1,0,0),r.up.set(0,-1,0),r.lookAt(1,0,0),s.up.set(0,0,1),s.lookAt(0,1,0),o.up.set(0,0,-1),o.lookAt(0,-1,0),a.up.set(0,-1,0),a.lookAt(0,0,1),l.up.set(0,-1,0),l.lookAt(0,0,-1);else throw new Error("THREE.CubeCamera.updateCoordinateSystem(): Invalid coordinate system: "+e);for(const c of t)this.add(c),c.updateMatrixWorld()}update(e,t){this.parent===null&&this.updateMatrixWorld();const{renderTarget:i,activeMipmapLevel:r}=this;this.coordinateSystem!==e.coordinateSystem&&(this.coordinateSystem=e.coordinateSystem,this.updateCoordinateSystem());const[s,o,a,l,c,d]=this.children,u=e.getRenderTarget(),_=e.getActiveCubeFace(),f=e.getActiveMipmapLevel(),h=e.xr.enabled;e.xr.enabled=!1;const E=i.texture.generateMipmaps;i.texture.generateMipmaps=!1,e.setRenderTarget(i,0,r),e.render(t,s),e.setRenderTarget(i,1,r),e.render(t,o),e.setRenderTarget(i,2,r),e.render(t,a),e.setRenderTarget(i,3,r),e.render(t,l),e.setRenderTarget(i,4,r),e.render(t,c),i.texture.generateMipmaps=E,e.setRenderTarget(i,5,r),e.render(t,d),e.setRenderTarget(u,_,f),e.xr.enabled=h,i.texture.needsPMREMUpdate=!0}}class uO extends pn{constructor(e,t,i,r,s,o,a,l,c,d){e=e!==void 0?e:[],t=t!==void 0?t:jo,super(e,t,i,r,s,o,a,l,c,d),this.isCubeTexture=!0,this.flipY=!1}get images(){return this.image}set images(e){this.image=e}}class eEt extends Ps{constructor(e=1,t={}){super(e,e,t),this.isWebGLCubeRenderTarget=!0;const i={width:e,height:e,depth:1},r=[i,i,i,i,i,i];t.encoding!==void 0&&(il("THREE.WebGLCubeRenderTarget: option.encoding has been replaced by option.colorSpace."),t.colorSpace=t.encoding===Ns?Kt:Qn),this.texture=new uO(r,t.mapping,t.wrapS,t.wrapT,t.magFilter,t.minFilter,t.format,t.type,t.anisotropy,t.colorSpace),this.texture.isRenderTargetTexture=!0,this.texture.generateMipmaps=t.generateMipmaps!==void 0?t.generateMipmaps:!1,this.texture.minFilter=t.minFilter!==void 0?t.minFilter:Mn}fromEquirectangularTexture(e,t){this.texture.type=t.type,this.texture.colorSpace=t.colorSpace,this.texture.generateMipmaps=t.generateMipmaps,this.texture.minFilter=t.minFilter,this.texture.magFilter=t.magFilter;const i={uniforms:{tEquirect:{value:null}},vertexShader:` +}`;class Us extends mi{constructor(e){super(),this.isShaderMaterial=!0,this.type="ShaderMaterial",this.defines={},this.uniforms={},this.uniformsGroups=[],this.vertexShader=tEt,this.fragmentShader=nEt,this.linewidth=1,this.wireframe=!1,this.wireframeLinewidth=1,this.fog=!1,this.lights=!1,this.clipping=!1,this.forceSinglePass=!0,this.extensions={derivatives:!1,fragDepth:!1,drawBuffers:!1,shaderTextureLOD:!1},this.defaultAttributeValues={color:[1,1,1],uv:[0,0],uv1:[0,0]},this.index0AttributeName=void 0,this.uniformsNeedUpdate=!1,this.glslVersion=null,e!==void 0&&this.setValues(e)}copy(e){return super.copy(e),this.fragmentShader=e.fragmentShader,this.vertexShader=e.vertexShader,this.uniforms=ta(e.uniforms),this.uniformsGroups=Jgt(e.uniformsGroups),this.defines=Object.assign({},e.defines),this.wireframe=e.wireframe,this.wireframeLinewidth=e.wireframeLinewidth,this.fog=e.fog,this.lights=e.lights,this.clipping=e.clipping,this.extensions=Object.assign({},e.extensions),this.glslVersion=e.glslVersion,this}toJSON(e){const t=super.toJSON(e);t.glslVersion=this.glslVersion,t.uniforms={};for(const r in this.uniforms){const o=this.uniforms[r].value;o&&o.isTexture?t.uniforms[r]={type:"t",value:o.toJSON(e).uuid}:o&&o.isColor?t.uniforms[r]={type:"c",value:o.getHex()}:o&&o.isVector2?t.uniforms[r]={type:"v2",value:o.toArray()}:o&&o.isVector3?t.uniforms[r]={type:"v3",value:o.toArray()}:o&&o.isVector4?t.uniforms[r]={type:"v4",value:o.toArray()}:o&&o.isMatrix3?t.uniforms[r]={type:"m3",value:o.toArray()}:o&&o.isMatrix4?t.uniforms[r]={type:"m4",value:o.toArray()}:t.uniforms[r]={value:o}}Object.keys(this.defines).length>0&&(t.defines=this.defines),t.vertexShader=this.vertexShader,t.fragmentShader=this.fragmentShader,t.lights=this.lights,t.clipping=this.clipping;const i={};for(const r in this.extensions)this.extensions[r]===!0&&(i[r]=!0);return Object.keys(i).length>0&&(t.extensions=i),t}}class dO extends Yt{constructor(){super(),this.isCamera=!0,this.type="Camera",this.matrixWorldInverse=new gt,this.projectionMatrix=new gt,this.projectionMatrixInverse=new gt,this.coordinateSystem=nr}copy(e,t){return super.copy(e,t),this.matrixWorldInverse.copy(e.matrixWorldInverse),this.projectionMatrix.copy(e.projectionMatrix),this.projectionMatrixInverse.copy(e.projectionMatrixInverse),this.coordinateSystem=e.coordinateSystem,this}getWorldDirection(e){return super.getWorldDirection(e).negate()}updateMatrixWorld(e){super.updateMatrixWorld(e),this.matrixWorldInverse.copy(this.matrixWorld).invert()}updateWorldMatrix(e,t){super.updateWorldMatrix(e,t),this.matrixWorldInverse.copy(this.matrixWorld).invert()}clone(){return new this.constructor().copy(this)}}class Rn extends dO{constructor(e=50,t=1,i=.1,r=2e3){super(),this.isPerspectiveCamera=!0,this.type="PerspectiveCamera",this.fov=e,this.zoom=1,this.near=i,this.far=r,this.focus=10,this.aspect=t,this.view=null,this.filmGauge=35,this.filmOffset=0,this.updateProjectionMatrix()}copy(e,t){return super.copy(e,t),this.fov=e.fov,this.zoom=e.zoom,this.near=e.near,this.far=e.far,this.focus=e.focus,this.aspect=e.aspect,this.view=e.view===null?null:Object.assign({},e.view),this.filmGauge=e.filmGauge,this.filmOffset=e.filmOffset,this}setFocalLength(e){const t=.5*this.getFilmHeight()/e;this.fov=ea*2*Math.atan(t),this.updateProjectionMatrix()}getFocalLength(){const e=Math.tan(tl*.5*this.fov);return .5*this.getFilmHeight()/e}getEffectiveFOV(){return ea*2*Math.atan(Math.tan(tl*.5*this.fov)/this.zoom)}getFilmWidth(){return this.filmGauge*Math.min(this.aspect,1)}getFilmHeight(){return this.filmGauge/Math.max(this.aspect,1)}setViewOffset(e,t,i,r,s,o){this.aspect=e/t,this.view===null&&(this.view={enabled:!0,fullWidth:1,fullHeight:1,offsetX:0,offsetY:0,width:1,height:1}),this.view.enabled=!0,this.view.fullWidth=e,this.view.fullHeight=t,this.view.offsetX=i,this.view.offsetY=r,this.view.width=s,this.view.height=o,this.updateProjectionMatrix()}clearViewOffset(){this.view!==null&&(this.view.enabled=!1),this.updateProjectionMatrix()}updateProjectionMatrix(){const e=this.near;let t=e*Math.tan(tl*.5*this.fov)/this.zoom,i=2*t,r=this.aspect*i,s=-.5*r;const o=this.view;if(this.view!==null&&this.view.enabled){const l=o.fullWidth,c=o.fullHeight;s+=o.offsetX*r/l,t-=o.offsetY*i/c,r*=o.width/l,i*=o.height/c}const a=this.filmOffset;a!==0&&(s+=e*a/this.getFilmWidth()),this.projectionMatrix.makePerspective(s,s+r,t,t-i,e,this.far,this.coordinateSystem),this.projectionMatrixInverse.copy(this.projectionMatrix).invert()}toJSON(e){const t=super.toJSON(e);return t.object.fov=this.fov,t.object.zoom=this.zoom,t.object.near=this.near,t.object.far=this.far,t.object.focus=this.focus,t.object.aspect=this.aspect,this.view!==null&&(t.object.view=Object.assign({},this.view)),t.object.filmGauge=this.filmGauge,t.object.filmOffset=this.filmOffset,t}}const po=-90,ho=1;class iEt extends Yt{constructor(e,t,i){super(),this.type="CubeCamera",this.renderTarget=i,this.coordinateSystem=null,this.activeMipmapLevel=0;const r=new Rn(po,ho,e,t);r.layers=this.layers,this.add(r);const s=new Rn(po,ho,e,t);s.layers=this.layers,this.add(s);const o=new Rn(po,ho,e,t);o.layers=this.layers,this.add(o);const a=new Rn(po,ho,e,t);a.layers=this.layers,this.add(a);const l=new Rn(po,ho,e,t);l.layers=this.layers,this.add(l);const c=new Rn(po,ho,e,t);c.layers=this.layers,this.add(c)}updateCoordinateSystem(){const e=this.coordinateSystem,t=this.children.concat(),[i,r,s,o,a,l]=t;for(const c of t)this.remove(c);if(e===nr)i.up.set(0,1,0),i.lookAt(1,0,0),r.up.set(0,1,0),r.lookAt(-1,0,0),s.up.set(0,0,-1),s.lookAt(0,1,0),o.up.set(0,0,1),o.lookAt(0,-1,0),a.up.set(0,1,0),a.lookAt(0,0,1),l.up.set(0,1,0),l.lookAt(0,0,-1);else if(e===Rd)i.up.set(0,-1,0),i.lookAt(-1,0,0),r.up.set(0,-1,0),r.lookAt(1,0,0),s.up.set(0,0,1),s.lookAt(0,1,0),o.up.set(0,0,-1),o.lookAt(0,-1,0),a.up.set(0,-1,0),a.lookAt(0,0,1),l.up.set(0,-1,0),l.lookAt(0,0,-1);else throw new Error("THREE.CubeCamera.updateCoordinateSystem(): Invalid coordinate system: "+e);for(const c of t)this.add(c),c.updateMatrixWorld()}update(e,t){this.parent===null&&this.updateMatrixWorld();const{renderTarget:i,activeMipmapLevel:r}=this;this.coordinateSystem!==e.coordinateSystem&&(this.coordinateSystem=e.coordinateSystem,this.updateCoordinateSystem());const[s,o,a,l,c,d]=this.children,u=e.getRenderTarget(),_=e.getActiveCubeFace(),f=e.getActiveMipmapLevel(),h=e.xr.enabled;e.xr.enabled=!1;const E=i.texture.generateMipmaps;i.texture.generateMipmaps=!1,e.setRenderTarget(i,0,r),e.render(t,s),e.setRenderTarget(i,1,r),e.render(t,o),e.setRenderTarget(i,2,r),e.render(t,a),e.setRenderTarget(i,3,r),e.render(t,l),e.setRenderTarget(i,4,r),e.render(t,c),i.texture.generateMipmaps=E,e.setRenderTarget(i,5,r),e.render(t,d),e.setRenderTarget(u,_,f),e.xr.enabled=h,i.texture.needsPMREMUpdate=!0}}class uO extends pn{constructor(e,t,i,r,s,o,a,l,c,d){e=e!==void 0?e:[],t=t!==void 0?t:jo,super(e,t,i,r,s,o,a,l,c,d),this.isCubeTexture=!0,this.flipY=!1}get images(){return this.image}set images(e){this.image=e}}class rEt extends Ps{constructor(e=1,t={}){super(e,e,t),this.isWebGLCubeRenderTarget=!0;const i={width:e,height:e,depth:1},r=[i,i,i,i,i,i];t.encoding!==void 0&&(il("THREE.WebGLCubeRenderTarget: option.encoding has been replaced by option.colorSpace."),t.colorSpace=t.encoding===Ns?Kt:Qn),this.texture=new uO(r,t.mapping,t.wrapS,t.wrapT,t.magFilter,t.minFilter,t.format,t.type,t.anisotropy,t.colorSpace),this.texture.isRenderTargetTexture=!0,this.texture.generateMipmaps=t.generateMipmaps!==void 0?t.generateMipmaps:!1,this.texture.minFilter=t.minFilter!==void 0?t.minFilter:Mn}fromEquirectangularTexture(e,t){this.texture.type=t.type,this.texture.colorSpace=t.colorSpace,this.texture.generateMipmaps=t.generateMipmaps,this.texture.minFilter=t.minFilter,this.texture.magFilter=t.magFilter;const i={uniforms:{tEquirect:{value:null}},vertexShader:` varying vec3 vWorldDirection; @@ -234,9 +236,9 @@ ${l}`;navigator.clipboard.writeText(c),Ue(()=>{Ge.replace()})},closeToast(){this gl_FragColor = texture2D( tEquirect, sampleUV ); } - `},r=new $r(5,5,5),s=new Us({name:"CubemapFromEquirect",uniforms:ta(i.uniforms),vertexShader:i.vertexShader,fragmentShader:i.fragmentShader,side:Ln,blending:Hr});s.uniforms.tEquirect.value=t;const o=new An(r,s),a=t.minFilter;return t.minFilter===ks&&(t.minFilter=Mn),new Jgt(1,10,this).update(e,o),t.minFilter=a,o.geometry.dispose(),o.material.dispose(),this}clear(e,t,i,r){const s=e.getRenderTarget();for(let o=0;o<6;o++)e.setRenderTarget(this,o),e.clear(t,i,r);e.setRenderTarget(s)}}const Qf=new ue,tEt=new ue,nEt=new mt;class _s{constructor(e=new ue(1,0,0),t=0){this.isPlane=!0,this.normal=e,this.constant=t}set(e,t){return this.normal.copy(e),this.constant=t,this}setComponents(e,t,i,r){return this.normal.set(e,t,i),this.constant=r,this}setFromNormalAndCoplanarPoint(e,t){return this.normal.copy(e),this.constant=-t.dot(this.normal),this}setFromCoplanarPoints(e,t,i){const r=Qf.subVectors(i,t).cross(tEt.subVectors(e,t)).normalize();return this.setFromNormalAndCoplanarPoint(r,e),this}copy(e){return this.normal.copy(e.normal),this.constant=e.constant,this}normalize(){const e=1/this.normal.length();return this.normal.multiplyScalar(e),this.constant*=e,this}negate(){return this.constant*=-1,this.normal.negate(),this}distanceToPoint(e){return this.normal.dot(e)+this.constant}distanceToSphere(e){return this.distanceToPoint(e.center)-e.radius}projectPoint(e,t){return t.copy(e).addScaledVector(this.normal,-this.distanceToPoint(e))}intersectLine(e,t){const i=e.delta(Qf),r=this.normal.dot(i);if(r===0)return this.distanceToPoint(e.start)===0?t.copy(e.start):null;const s=-(e.start.dot(this.normal)+this.constant)/r;return s<0||s>1?null:t.copy(e.start).addScaledVector(i,s)}intersectsLine(e){const t=this.distanceToPoint(e.start),i=this.distanceToPoint(e.end);return t<0&&i>0||i<0&&t>0}intersectsBox(e){return e.intersectsPlane(this)}intersectsSphere(e){return e.intersectsPlane(this)}coplanarPoint(e){return e.copy(this.normal).multiplyScalar(-this.constant)}applyMatrix4(e,t){const i=t||nEt.getNormalMatrix(e),r=this.coplanarPoint(Qf).applyMatrix4(e),s=this.normal.applyMatrix3(i).normalize();return this.constant=-r.dot(s),this}translate(e){return this.constant-=e.dot(this.normal),this}equals(e){return e.normal.equals(this.normal)&&e.constant===this.constant}clone(){return new this.constructor().copy(this)}}const cs=new Ui,wc=new ue;class GE{constructor(e=new _s,t=new _s,i=new _s,r=new _s,s=new _s,o=new _s){this.planes=[e,t,i,r,s,o]}set(e,t,i,r,s,o){const a=this.planes;return a[0].copy(e),a[1].copy(t),a[2].copy(i),a[3].copy(r),a[4].copy(s),a[5].copy(o),this}copy(e){const t=this.planes;for(let i=0;i<6;i++)t[i].copy(e.planes[i]);return this}setFromProjectionMatrix(e,t=nr){const i=this.planes,r=e.elements,s=r[0],o=r[1],a=r[2],l=r[3],c=r[4],d=r[5],u=r[6],_=r[7],f=r[8],h=r[9],E=r[10],g=r[11],m=r[12],b=r[13],S=r[14],v=r[15];if(i[0].setComponents(l-s,_-c,g-f,v-m).normalize(),i[1].setComponents(l+s,_+c,g+f,v+m).normalize(),i[2].setComponents(l+o,_+d,g+h,v+b).normalize(),i[3].setComponents(l-o,_-d,g-h,v-b).normalize(),i[4].setComponents(l-a,_-u,g-E,v-S).normalize(),t===nr)i[5].setComponents(l+a,_+u,g+E,v+S).normalize();else if(t===Rd)i[5].setComponents(a,u,E,S).normalize();else throw new Error("THREE.Frustum.setFromProjectionMatrix(): Invalid coordinate system: "+t);return this}intersectsObject(e){if(e.boundingSphere!==void 0)e.boundingSphere===null&&e.computeBoundingSphere(),cs.copy(e.boundingSphere).applyMatrix4(e.matrixWorld);else{const t=e.geometry;t.boundingSphere===null&&t.computeBoundingSphere(),cs.copy(t.boundingSphere).applyMatrix4(e.matrixWorld)}return this.intersectsSphere(cs)}intersectsSprite(e){return cs.center.set(0,0,0),cs.radius=.7071067811865476,cs.applyMatrix4(e.matrixWorld),this.intersectsSphere(cs)}intersectsSphere(e){const t=this.planes,i=e.center,r=-e.radius;for(let s=0;s<6;s++)if(t[s].distanceToPoint(i)0?e.max.x:e.min.x,wc.y=r.normal.y>0?e.max.y:e.min.y,wc.z=r.normal.z>0?e.max.z:e.min.z,r.distanceToPoint(wc)<0)return!1}return!0}containsPoint(e){const t=this.planes;for(let i=0;i<6;i++)if(t[i].distanceToPoint(e)<0)return!1;return!0}clone(){return new this.constructor().copy(this)}}function _O(){let n=null,e=!1,t=null,i=null;function r(s,o){t(s,o),i=n.requestAnimationFrame(r)}return{start:function(){e!==!0&&t!==null&&(i=n.requestAnimationFrame(r),e=!0)},stop:function(){n.cancelAnimationFrame(i),e=!1},setAnimationLoop:function(s){t=s},setContext:function(s){n=s}}}function iEt(n,e){const t=e.isWebGL2,i=new WeakMap;function r(c,d){const u=c.array,_=c.usage,f=u.byteLength,h=n.createBuffer();n.bindBuffer(d,h),n.bufferData(d,u,_),c.onUploadCallback();let E;if(u instanceof Float32Array)E=n.FLOAT;else if(u instanceof Uint16Array)if(c.isFloat16BufferAttribute)if(t)E=n.HALF_FLOAT;else throw new Error("THREE.WebGLAttributes: Usage of Float16BufferAttribute requires WebGL2.");else E=n.UNSIGNED_SHORT;else if(u instanceof Int16Array)E=n.SHORT;else if(u instanceof Uint32Array)E=n.UNSIGNED_INT;else if(u instanceof Int32Array)E=n.INT;else if(u instanceof Int8Array)E=n.BYTE;else if(u instanceof Uint8Array)E=n.UNSIGNED_BYTE;else if(u instanceof Uint8ClampedArray)E=n.UNSIGNED_BYTE;else throw new Error("THREE.WebGLAttributes: Unsupported buffer data format: "+u);return{buffer:h,type:E,bytesPerElement:u.BYTES_PER_ELEMENT,version:c.version,size:f}}function s(c,d,u){const _=d.array,f=d._updateRange,h=d.updateRanges;if(n.bindBuffer(u,c),f.count===-1&&h.length===0&&n.bufferSubData(u,0,_),h.length!==0){for(let E=0,g=h.length;E1?null:t.copy(e.start).addScaledVector(i,s)}intersectsLine(e){const t=this.distanceToPoint(e.start),i=this.distanceToPoint(e.end);return t<0&&i>0||i<0&&t>0}intersectsBox(e){return e.intersectsPlane(this)}intersectsSphere(e){return e.intersectsPlane(this)}coplanarPoint(e){return e.copy(this.normal).multiplyScalar(-this.constant)}applyMatrix4(e,t){const i=t||oEt.getNormalMatrix(e),r=this.coplanarPoint(Qf).applyMatrix4(e),s=this.normal.applyMatrix3(i).normalize();return this.constant=-r.dot(s),this}translate(e){return this.constant-=e.dot(this.normal),this}equals(e){return e.normal.equals(this.normal)&&e.constant===this.constant}clone(){return new this.constructor().copy(this)}}const cs=new Ui,wc=new ue;class GE{constructor(e=new _s,t=new _s,i=new _s,r=new _s,s=new _s,o=new _s){this.planes=[e,t,i,r,s,o]}set(e,t,i,r,s,o){const a=this.planes;return a[0].copy(e),a[1].copy(t),a[2].copy(i),a[3].copy(r),a[4].copy(s),a[5].copy(o),this}copy(e){const t=this.planes;for(let i=0;i<6;i++)t[i].copy(e.planes[i]);return this}setFromProjectionMatrix(e,t=nr){const i=this.planes,r=e.elements,s=r[0],o=r[1],a=r[2],l=r[3],c=r[4],d=r[5],u=r[6],_=r[7],f=r[8],h=r[9],E=r[10],g=r[11],m=r[12],b=r[13],S=r[14],v=r[15];if(i[0].setComponents(l-s,_-c,g-f,v-m).normalize(),i[1].setComponents(l+s,_+c,g+f,v+m).normalize(),i[2].setComponents(l+o,_+d,g+h,v+b).normalize(),i[3].setComponents(l-o,_-d,g-h,v-b).normalize(),i[4].setComponents(l-a,_-u,g-E,v-S).normalize(),t===nr)i[5].setComponents(l+a,_+u,g+E,v+S).normalize();else if(t===Rd)i[5].setComponents(a,u,E,S).normalize();else throw new Error("THREE.Frustum.setFromProjectionMatrix(): Invalid coordinate system: "+t);return this}intersectsObject(e){if(e.boundingSphere!==void 0)e.boundingSphere===null&&e.computeBoundingSphere(),cs.copy(e.boundingSphere).applyMatrix4(e.matrixWorld);else{const t=e.geometry;t.boundingSphere===null&&t.computeBoundingSphere(),cs.copy(t.boundingSphere).applyMatrix4(e.matrixWorld)}return this.intersectsSphere(cs)}intersectsSprite(e){return cs.center.set(0,0,0),cs.radius=.7071067811865476,cs.applyMatrix4(e.matrixWorld),this.intersectsSphere(cs)}intersectsSphere(e){const t=this.planes,i=e.center,r=-e.radius;for(let s=0;s<6;s++)if(t[s].distanceToPoint(i)0?e.max.x:e.min.x,wc.y=r.normal.y>0?e.max.y:e.min.y,wc.z=r.normal.z>0?e.max.z:e.min.z,r.distanceToPoint(wc)<0)return!1}return!0}containsPoint(e){const t=this.planes;for(let i=0;i<6;i++)if(t[i].distanceToPoint(e)<0)return!1;return!0}clone(){return new this.constructor().copy(this)}}function _O(){let n=null,e=!1,t=null,i=null;function r(s,o){t(s,o),i=n.requestAnimationFrame(r)}return{start:function(){e!==!0&&t!==null&&(i=n.requestAnimationFrame(r),e=!0)},stop:function(){n.cancelAnimationFrame(i),e=!1},setAnimationLoop:function(s){t=s},setContext:function(s){n=s}}}function aEt(n,e){const t=e.isWebGL2,i=new WeakMap;function r(c,d){const u=c.array,_=c.usage,f=u.byteLength,h=n.createBuffer();n.bindBuffer(d,h),n.bufferData(d,u,_),c.onUploadCallback();let E;if(u instanceof Float32Array)E=n.FLOAT;else if(u instanceof Uint16Array)if(c.isFloat16BufferAttribute)if(t)E=n.HALF_FLOAT;else throw new Error("THREE.WebGLAttributes: Usage of Float16BufferAttribute requires WebGL2.");else E=n.UNSIGNED_SHORT;else if(u instanceof Int16Array)E=n.SHORT;else if(u instanceof Uint32Array)E=n.UNSIGNED_INT;else if(u instanceof Int32Array)E=n.INT;else if(u instanceof Int8Array)E=n.BYTE;else if(u instanceof Uint8Array)E=n.UNSIGNED_BYTE;else if(u instanceof Uint8ClampedArray)E=n.UNSIGNED_BYTE;else throw new Error("THREE.WebGLAttributes: Unsupported buffer data format: "+u);return{buffer:h,type:E,bytesPerElement:u.BYTES_PER_ELEMENT,version:c.version,size:f}}function s(c,d,u){const _=d.array,f=d._updateRange,h=d.updateRanges;if(n.bindBuffer(u,c),f.count===-1&&h.length===0&&n.bufferSubData(u,0,_),h.length!==0){for(let E=0,g=h.length;E{Ge.replace()})},closeToast(){this : cases.z; return clamp( threshold , 1.0e-6, 1.0 ); } -#endif`,oEt=`#ifdef USE_ALPHAMAP +#endif`,dEt=`#ifdef USE_ALPHAMAP diffuseColor.a *= texture2D( alphaMap, vAlphaMapUv ).g; -#endif`,aEt=`#ifdef USE_ALPHAMAP +#endif`,uEt=`#ifdef USE_ALPHAMAP uniform sampler2D alphaMap; -#endif`,lEt=`#ifdef USE_ALPHATEST +#endif`,_Et=`#ifdef USE_ALPHATEST if ( diffuseColor.a < alphaTest ) discard; -#endif`,cEt=`#ifdef USE_ALPHATEST +#endif`,pEt=`#ifdef USE_ALPHATEST uniform float alphaTest; -#endif`,dEt=`#ifdef USE_AOMAP +#endif`,hEt=`#ifdef USE_AOMAP float ambientOcclusion = ( texture2D( aoMap, vAoMapUv ).r - 1.0 ) * aoMapIntensity + 1.0; reflectedLight.indirectDiffuse *= ambientOcclusion; #if defined( USE_CLEARCOAT ) @@ -292,10 +294,10 @@ ${l}`;navigator.clipboard.writeText(c),Ue(()=>{Ge.replace()})},closeToast(){this float dotNV = saturate( dot( geometryNormal, geometryViewDir ) ); reflectedLight.indirectSpecular *= computeSpecularOcclusion( dotNV, ambientOcclusion, material.roughness ); #endif -#endif`,uEt=`#ifdef USE_AOMAP +#endif`,fEt=`#ifdef USE_AOMAP uniform sampler2D aoMap; uniform float aoMapIntensity; -#endif`,_Et=`#ifdef USE_BATCHING +#endif`,mEt=`#ifdef USE_BATCHING attribute float batchId; uniform highp sampler2D batchingTexture; mat4 getBatchingMatrix( const in float i ) { @@ -309,15 +311,15 @@ ${l}`;navigator.clipboard.writeText(c),Ue(()=>{Ge.replace()})},closeToast(){this vec4 v4 = texelFetch( batchingTexture, ivec2( x + 3, y ), 0 ); return mat4( v1, v2, v3, v4 ); } -#endif`,pEt=`#ifdef USE_BATCHING +#endif`,gEt=`#ifdef USE_BATCHING mat4 batchingMatrix = getBatchingMatrix( batchId ); -#endif`,hEt=`vec3 transformed = vec3( position ); +#endif`,EEt=`vec3 transformed = vec3( position ); #ifdef USE_ALPHAHASH vPosition = vec3( position ); -#endif`,fEt=`vec3 objectNormal = vec3( normal ); +#endif`,bEt=`vec3 objectNormal = vec3( normal ); #ifdef USE_TANGENT vec3 objectTangent = vec3( tangent.xyz ); -#endif`,mEt=`float G_BlinnPhong_Implicit( ) { +#endif`,SEt=`float G_BlinnPhong_Implicit( ) { return 0.25; } float D_BlinnPhong( const in float shininess, const in float dotNH ) { @@ -331,7 +333,7 @@ vec3 BRDF_BlinnPhong( const in vec3 lightDir, const in vec3 viewDir, const in ve float G = G_BlinnPhong_Implicit( ); float D = D_BlinnPhong( shininess, dotNH ); return F * ( G * D ); -} // validated`,gEt=`#ifdef USE_IRIDESCENCE +} // validated`,yEt=`#ifdef USE_IRIDESCENCE const mat3 XYZ_TO_REC709 = mat3( 3.2404542, -0.9692660, 0.0556434, -1.5371385, 1.8760108, -0.2040259, @@ -394,7 +396,7 @@ vec3 BRDF_BlinnPhong( const in vec3 lightDir, const in vec3 viewDir, const in ve } return max( I, vec3( 0.0 ) ); } -#endif`,EEt=`#ifdef USE_BUMPMAP +#endif`,vEt=`#ifdef USE_BUMPMAP uniform sampler2D bumpMap; uniform float bumpScale; vec2 dHdxy_fwd() { @@ -415,7 +417,7 @@ vec3 BRDF_BlinnPhong( const in vec3 lightDir, const in vec3 viewDir, const in ve vec3 vGrad = sign( fDet ) * ( dHdxy.x * R1 + dHdxy.y * R2 ); return normalize( abs( fDet ) * surf_norm - vGrad ); } -#endif`,bEt=`#if NUM_CLIPPING_PLANES > 0 +#endif`,TEt=`#if NUM_CLIPPING_PLANES > 0 vec4 plane; #pragma unroll_loop_start for ( int i = 0; i < UNION_CLIPPING_PLANES; i ++ ) { @@ -433,26 +435,26 @@ vec3 BRDF_BlinnPhong( const in vec3 lightDir, const in vec3 viewDir, const in ve #pragma unroll_loop_end if ( clipped ) discard; #endif -#endif`,SEt=`#if NUM_CLIPPING_PLANES > 0 +#endif`,xEt=`#if NUM_CLIPPING_PLANES > 0 varying vec3 vClipPosition; uniform vec4 clippingPlanes[ NUM_CLIPPING_PLANES ]; -#endif`,yEt=`#if NUM_CLIPPING_PLANES > 0 +#endif`,CEt=`#if NUM_CLIPPING_PLANES > 0 varying vec3 vClipPosition; -#endif`,vEt=`#if NUM_CLIPPING_PLANES > 0 +#endif`,REt=`#if NUM_CLIPPING_PLANES > 0 vClipPosition = - mvPosition.xyz; -#endif`,TEt=`#if defined( USE_COLOR_ALPHA ) +#endif`,AEt=`#if defined( USE_COLOR_ALPHA ) diffuseColor *= vColor; #elif defined( USE_COLOR ) diffuseColor.rgb *= vColor; -#endif`,xEt=`#if defined( USE_COLOR_ALPHA ) +#endif`,wEt=`#if defined( USE_COLOR_ALPHA ) varying vec4 vColor; #elif defined( USE_COLOR ) varying vec3 vColor; -#endif`,CEt=`#if defined( USE_COLOR_ALPHA ) +#endif`,OEt=`#if defined( USE_COLOR_ALPHA ) varying vec4 vColor; #elif defined( USE_COLOR ) || defined( USE_INSTANCING_COLOR ) varying vec3 vColor; -#endif`,REt=`#if defined( USE_COLOR_ALPHA ) +#endif`,NEt=`#if defined( USE_COLOR_ALPHA ) vColor = vec4( 1.0 ); #elif defined( USE_COLOR ) || defined( USE_INSTANCING_COLOR ) vColor = vec3( 1.0 ); @@ -462,7 +464,7 @@ vec3 BRDF_BlinnPhong( const in vec3 lightDir, const in vec3 viewDir, const in ve #endif #ifdef USE_INSTANCING_COLOR vColor.xyz *= instanceColor.xyz; -#endif`,AEt=`#define PI 3.141592653589793 +#endif`,MEt=`#define PI 3.141592653589793 #define PI2 6.283185307179586 #define PI_HALF 1.5707963267948966 #define RECIPROCAL_PI 0.3183098861837907 @@ -540,7 +542,7 @@ vec3 F_Schlick( const in vec3 f0, const in float f90, const in float dotVH ) { float F_Schlick( const in float f0, const in float f90, const in float dotVH ) { float fresnel = exp2( ( - 5.55473 * dotVH - 6.98316 ) * dotVH ); return f0 * ( 1.0 - fresnel ) + ( f90 * fresnel ); -} // validated`,wEt=`#ifdef ENVMAP_TYPE_CUBE_UV +} // validated`,IEt=`#ifdef ENVMAP_TYPE_CUBE_UV #define cubeUV_minMipLevel 4.0 #define cubeUV_minTileSize 16.0 float getFace( vec3 direction ) { @@ -638,7 +640,7 @@ float F_Schlick( const in float f0, const in float f90, const in float dotVH ) { return vec4( mix( color0, color1, mipF ), 1.0 ); } } -#endif`,OEt=`vec3 transformedNormal = objectNormal; +#endif`,DEt=`vec3 transformedNormal = objectNormal; #ifdef USE_TANGENT vec3 transformedTangent = objectTangent; #endif @@ -667,18 +669,18 @@ transformedNormal = normalMatrix * transformedNormal; #ifdef FLIP_SIDED transformedTangent = - transformedTangent; #endif -#endif`,NEt=`#ifdef USE_DISPLACEMENTMAP +#endif`,LEt=`#ifdef USE_DISPLACEMENTMAP uniform sampler2D displacementMap; uniform float displacementScale; uniform float displacementBias; -#endif`,MEt=`#ifdef USE_DISPLACEMENTMAP +#endif`,kEt=`#ifdef USE_DISPLACEMENTMAP transformed += normalize( objectNormal ) * ( texture2D( displacementMap, vDisplacementMapUv ).x * displacementScale + displacementBias ); -#endif`,IEt=`#ifdef USE_EMISSIVEMAP +#endif`,PEt=`#ifdef USE_EMISSIVEMAP vec4 emissiveColor = texture2D( emissiveMap, vEmissiveMapUv ); totalEmissiveRadiance *= emissiveColor.rgb; -#endif`,DEt=`#ifdef USE_EMISSIVEMAP +#endif`,UEt=`#ifdef USE_EMISSIVEMAP uniform sampler2D emissiveMap; -#endif`,LEt="gl_FragColor = linearToOutputTexel( gl_FragColor );",kEt=` +#endif`,FEt="gl_FragColor = linearToOutputTexel( gl_FragColor );",BEt=` const mat3 LINEAR_SRGB_TO_LINEAR_DISPLAY_P3 = mat3( vec3( 0.8224621, 0.177538, 0.0 ), vec3( 0.0331941, 0.9668058, 0.0 ), @@ -706,7 +708,7 @@ vec4 LinearToLinear( in vec4 value ) { } vec4 LinearTosRGB( in vec4 value ) { return sRGBTransferOETF( value ); -}`,PEt=`#ifdef USE_ENVMAP +}`,GEt=`#ifdef USE_ENVMAP #ifdef ENV_WORLDPOS vec3 cameraToFrag; if ( isOrthographic ) { @@ -735,7 +737,7 @@ vec4 LinearTosRGB( in vec4 value ) { #elif defined( ENVMAP_BLENDING_ADD ) outgoingLight += envColor.xyz * specularStrength * reflectivity; #endif -#endif`,UEt=`#ifdef USE_ENVMAP +#endif`,zEt=`#ifdef USE_ENVMAP uniform float envMapIntensity; uniform float flipEnvMap; #ifdef ENVMAP_TYPE_CUBE @@ -744,7 +746,7 @@ vec4 LinearTosRGB( in vec4 value ) { uniform sampler2D envMap; #endif -#endif`,FEt=`#ifdef USE_ENVMAP +#endif`,VEt=`#ifdef USE_ENVMAP uniform float reflectivity; #if defined( USE_BUMPMAP ) || defined( USE_NORMALMAP ) || defined( PHONG ) || defined( LAMBERT ) #define ENV_WORLDPOS @@ -755,7 +757,7 @@ vec4 LinearTosRGB( in vec4 value ) { #else varying vec3 vReflect; #endif -#endif`,BEt=`#ifdef USE_ENVMAP +#endif`,HEt=`#ifdef USE_ENVMAP #if defined( USE_BUMPMAP ) || defined( USE_NORMALMAP ) || defined( PHONG ) || defined( LAMBERT ) #define ENV_WORLDPOS #endif @@ -766,7 +768,7 @@ vec4 LinearTosRGB( in vec4 value ) { varying vec3 vReflect; uniform float refractionRatio; #endif -#endif`,GEt=`#ifdef USE_ENVMAP +#endif`,qEt=`#ifdef USE_ENVMAP #ifdef ENV_WORLDPOS vWorldPosition = worldPosition.xyz; #else @@ -783,18 +785,18 @@ vec4 LinearTosRGB( in vec4 value ) { vReflect = refract( cameraToVertex, worldNormal, refractionRatio ); #endif #endif -#endif`,zEt=`#ifdef USE_FOG +#endif`,YEt=`#ifdef USE_FOG vFogDepth = - mvPosition.z; -#endif`,VEt=`#ifdef USE_FOG +#endif`,$Et=`#ifdef USE_FOG varying float vFogDepth; -#endif`,HEt=`#ifdef USE_FOG +#endif`,WEt=`#ifdef USE_FOG #ifdef FOG_EXP2 float fogFactor = 1.0 - exp( - fogDensity * fogDensity * vFogDepth * vFogDepth ); #else float fogFactor = smoothstep( fogNear, fogFar, vFogDepth ); #endif gl_FragColor.rgb = mix( gl_FragColor.rgb, fogColor, fogFactor ); -#endif`,qEt=`#ifdef USE_FOG +#endif`,KEt=`#ifdef USE_FOG uniform vec3 fogColor; varying float vFogDepth; #ifdef FOG_EXP2 @@ -803,7 +805,7 @@ vec4 LinearTosRGB( in vec4 value ) { uniform float fogNear; uniform float fogFar; #endif -#endif`,YEt=`#ifdef USE_GRADIENTMAP +#endif`,jEt=`#ifdef USE_GRADIENTMAP uniform sampler2D gradientMap; #endif vec3 getGradientIrradiance( vec3 normal, vec3 lightDirection ) { @@ -815,16 +817,16 @@ vec3 getGradientIrradiance( vec3 normal, vec3 lightDirection ) { vec2 fw = fwidth( coord ) * 0.5; return mix( vec3( 0.7 ), vec3( 1.0 ), smoothstep( 0.7 - fw.x, 0.7 + fw.x, coord.x ) ); #endif -}`,$Et=`#ifdef USE_LIGHTMAP +}`,QEt=`#ifdef USE_LIGHTMAP vec4 lightMapTexel = texture2D( lightMap, vLightMapUv ); vec3 lightMapIrradiance = lightMapTexel.rgb * lightMapIntensity; reflectedLight.indirectDiffuse += lightMapIrradiance; -#endif`,WEt=`#ifdef USE_LIGHTMAP +#endif`,XEt=`#ifdef USE_LIGHTMAP uniform sampler2D lightMap; uniform float lightMapIntensity; -#endif`,KEt=`LambertMaterial material; +#endif`,ZEt=`LambertMaterial material; material.diffuseColor = diffuseColor.rgb; -material.specularStrength = specularStrength;`,jEt=`varying vec3 vViewPosition; +material.specularStrength = specularStrength;`,JEt=`varying vec3 vViewPosition; struct LambertMaterial { vec3 diffuseColor; float specularStrength; @@ -838,7 +840,7 @@ void RE_IndirectDiffuse_Lambert( const in vec3 irradiance, const in vec3 geometr reflectedLight.indirectDiffuse += irradiance * BRDF_Lambert( material.diffuseColor ); } #define RE_Direct RE_Direct_Lambert -#define RE_IndirectDiffuse RE_IndirectDiffuse_Lambert`,QEt=`uniform bool receiveShadow; +#define RE_IndirectDiffuse RE_IndirectDiffuse_Lambert`,ebt=`uniform bool receiveShadow; uniform vec3 ambientLightColor; #if defined( USE_LIGHT_PROBES ) uniform vec3 lightProbe[ 9 ]; @@ -961,7 +963,7 @@ float getSpotAttenuation( const in float coneCosine, const in float penumbraCosi vec3 irradiance = mix( hemiLight.groundColor, hemiLight.skyColor, hemiDiffuseWeight ); return irradiance; } -#endif`,XEt=`#ifdef USE_ENVMAP +#endif`,tbt=`#ifdef USE_ENVMAP vec3 getIBLIrradiance( const in vec3 normal ) { #ifdef ENVMAP_TYPE_CUBE_UV vec3 worldNormal = inverseTransformDirection( normal, viewMatrix ); @@ -994,8 +996,8 @@ float getSpotAttenuation( const in float coneCosine, const in float penumbraCosi #endif } #endif -#endif`,ZEt=`ToonMaterial material; -material.diffuseColor = diffuseColor.rgb;`,JEt=`varying vec3 vViewPosition; +#endif`,nbt=`ToonMaterial material; +material.diffuseColor = diffuseColor.rgb;`,ibt=`varying vec3 vViewPosition; struct ToonMaterial { vec3 diffuseColor; }; @@ -1007,11 +1009,11 @@ void RE_IndirectDiffuse_Toon( const in vec3 irradiance, const in vec3 geometryPo reflectedLight.indirectDiffuse += irradiance * BRDF_Lambert( material.diffuseColor ); } #define RE_Direct RE_Direct_Toon -#define RE_IndirectDiffuse RE_IndirectDiffuse_Toon`,ebt=`BlinnPhongMaterial material; +#define RE_IndirectDiffuse RE_IndirectDiffuse_Toon`,rbt=`BlinnPhongMaterial material; material.diffuseColor = diffuseColor.rgb; material.specularColor = specular; material.specularShininess = shininess; -material.specularStrength = specularStrength;`,tbt=`varying vec3 vViewPosition; +material.specularStrength = specularStrength;`,sbt=`varying vec3 vViewPosition; struct BlinnPhongMaterial { vec3 diffuseColor; vec3 specularColor; @@ -1028,7 +1030,7 @@ void RE_IndirectDiffuse_BlinnPhong( const in vec3 irradiance, const in vec3 geom reflectedLight.indirectDiffuse += irradiance * BRDF_Lambert( material.diffuseColor ); } #define RE_Direct RE_Direct_BlinnPhong -#define RE_IndirectDiffuse RE_IndirectDiffuse_BlinnPhong`,nbt=`PhysicalMaterial material; +#define RE_IndirectDiffuse RE_IndirectDiffuse_BlinnPhong`,obt=`PhysicalMaterial material; material.diffuseColor = diffuseColor.rgb * ( 1.0 - metalnessFactor ); vec3 dxy = max( abs( dFdx( nonPerturbedNormal ) ), abs( dFdy( nonPerturbedNormal ) ) ); float geometryRoughness = max( max( dxy.x, dxy.y ), dxy.z ); @@ -1111,7 +1113,7 @@ material.roughness = min( material.roughness, 1.0 ); material.alphaT = mix( pow2( material.roughness ), 1.0, pow2( material.anisotropy ) ); material.anisotropyT = tbn[ 0 ] * anisotropyV.x + tbn[ 1 ] * anisotropyV.y; material.anisotropyB = tbn[ 1 ] * anisotropyV.x - tbn[ 0 ] * anisotropyV.y; -#endif`,ibt=`struct PhysicalMaterial { +#endif`,abt=`struct PhysicalMaterial { vec3 diffuseColor; float roughness; vec3 specularColor; @@ -1411,7 +1413,7 @@ void RE_IndirectSpecular_Physical( const in vec3 radiance, const in vec3 irradia #define RE_IndirectSpecular RE_IndirectSpecular_Physical float computeSpecularOcclusion( const in float dotNV, const in float ambientOcclusion, const in float roughness ) { return saturate( pow( dotNV + ambientOcclusion, exp2( - 16.0 * roughness - 1.0 ) ) - 1.0 + ambientOcclusion ); -}`,rbt=` +}`,lbt=` vec3 geometryPosition = - vViewPosition; vec3 geometryNormal = normal; vec3 geometryViewDir = ( isOrthographic ) ? vec3( 0, 0, 1 ) : normalize( vViewPosition ); @@ -1526,7 +1528,7 @@ IncidentLight directLight; #if defined( RE_IndirectSpecular ) vec3 radiance = vec3( 0.0 ); vec3 clearcoatRadiance = vec3( 0.0 ); -#endif`,sbt=`#if defined( RE_IndirectDiffuse ) +#endif`,cbt=`#if defined( RE_IndirectDiffuse ) #ifdef USE_LIGHTMAP vec4 lightMapTexel = texture2D( lightMap, vLightMapUv ); vec3 lightMapIrradiance = lightMapTexel.rgb * lightMapIntensity; @@ -1545,25 +1547,25 @@ IncidentLight directLight; #ifdef USE_CLEARCOAT clearcoatRadiance += getIBLRadiance( geometryViewDir, geometryClearcoatNormal, material.clearcoatRoughness ); #endif -#endif`,obt=`#if defined( RE_IndirectDiffuse ) +#endif`,dbt=`#if defined( RE_IndirectDiffuse ) RE_IndirectDiffuse( irradiance, geometryPosition, geometryNormal, geometryViewDir, geometryClearcoatNormal, material, reflectedLight ); #endif #if defined( RE_IndirectSpecular ) RE_IndirectSpecular( radiance, iblIrradiance, clearcoatRadiance, geometryPosition, geometryNormal, geometryViewDir, geometryClearcoatNormal, material, reflectedLight ); -#endif`,abt=`#if defined( USE_LOGDEPTHBUF ) && defined( USE_LOGDEPTHBUF_EXT ) +#endif`,ubt=`#if defined( USE_LOGDEPTHBUF ) && defined( USE_LOGDEPTHBUF_EXT ) gl_FragDepthEXT = vIsPerspective == 0.0 ? gl_FragCoord.z : log2( vFragDepth ) * logDepthBufFC * 0.5; -#endif`,lbt=`#if defined( USE_LOGDEPTHBUF ) && defined( USE_LOGDEPTHBUF_EXT ) +#endif`,_bt=`#if defined( USE_LOGDEPTHBUF ) && defined( USE_LOGDEPTHBUF_EXT ) uniform float logDepthBufFC; varying float vFragDepth; varying float vIsPerspective; -#endif`,cbt=`#ifdef USE_LOGDEPTHBUF +#endif`,pbt=`#ifdef USE_LOGDEPTHBUF #ifdef USE_LOGDEPTHBUF_EXT varying float vFragDepth; varying float vIsPerspective; #else uniform float logDepthBufFC; #endif -#endif`,dbt=`#ifdef USE_LOGDEPTHBUF +#endif`,hbt=`#ifdef USE_LOGDEPTHBUF #ifdef USE_LOGDEPTHBUF_EXT vFragDepth = 1.0 + gl_Position.w; vIsPerspective = float( isPerspectiveMatrix( projectionMatrix ) ); @@ -1573,16 +1575,16 @@ IncidentLight directLight; gl_Position.z *= gl_Position.w; } #endif -#endif`,ubt=`#ifdef USE_MAP +#endif`,fbt=`#ifdef USE_MAP vec4 sampledDiffuseColor = texture2D( map, vMapUv ); #ifdef DECODE_VIDEO_TEXTURE sampledDiffuseColor = vec4( mix( pow( sampledDiffuseColor.rgb * 0.9478672986 + vec3( 0.0521327014 ), vec3( 2.4 ) ), sampledDiffuseColor.rgb * 0.0773993808, vec3( lessThanEqual( sampledDiffuseColor.rgb, vec3( 0.04045 ) ) ) ), sampledDiffuseColor.w ); #endif diffuseColor *= sampledDiffuseColor; -#endif`,_bt=`#ifdef USE_MAP +#endif`,mbt=`#ifdef USE_MAP uniform sampler2D map; -#endif`,pbt=`#if defined( USE_MAP ) || defined( USE_ALPHAMAP ) +#endif`,gbt=`#if defined( USE_MAP ) || defined( USE_ALPHAMAP ) #if defined( USE_POINTS_UV ) vec2 uv = vUv; #else @@ -1594,7 +1596,7 @@ IncidentLight directLight; #endif #ifdef USE_ALPHAMAP diffuseColor.a *= texture2D( alphaMap, uv ).g; -#endif`,hbt=`#if defined( USE_POINTS_UV ) +#endif`,Ebt=`#if defined( USE_POINTS_UV ) varying vec2 vUv; #else #if defined( USE_MAP ) || defined( USE_ALPHAMAP ) @@ -1606,13 +1608,13 @@ IncidentLight directLight; #endif #ifdef USE_ALPHAMAP uniform sampler2D alphaMap; -#endif`,fbt=`float metalnessFactor = metalness; +#endif`,bbt=`float metalnessFactor = metalness; #ifdef USE_METALNESSMAP vec4 texelMetalness = texture2D( metalnessMap, vMetalnessMapUv ); metalnessFactor *= texelMetalness.b; -#endif`,mbt=`#ifdef USE_METALNESSMAP +#endif`,Sbt=`#ifdef USE_METALNESSMAP uniform sampler2D metalnessMap; -#endif`,gbt=`#if defined( USE_MORPHCOLORS ) && defined( MORPHTARGETS_TEXTURE ) +#endif`,ybt=`#if defined( USE_MORPHCOLORS ) && defined( MORPHTARGETS_TEXTURE ) vColor *= morphTargetBaseInfluence; for ( int i = 0; i < MORPHTARGETS_COUNT; i ++ ) { #if defined( USE_COLOR_ALPHA ) @@ -1621,7 +1623,7 @@ IncidentLight directLight; if ( morphTargetInfluences[ i ] != 0.0 ) vColor += getMorph( gl_VertexID, i, 2 ).rgb * morphTargetInfluences[ i ]; #endif } -#endif`,Ebt=`#ifdef USE_MORPHNORMALS +#endif`,vbt=`#ifdef USE_MORPHNORMALS objectNormal *= morphTargetBaseInfluence; #ifdef MORPHTARGETS_TEXTURE for ( int i = 0; i < MORPHTARGETS_COUNT; i ++ ) { @@ -1633,7 +1635,7 @@ IncidentLight directLight; objectNormal += morphNormal2 * morphTargetInfluences[ 2 ]; objectNormal += morphNormal3 * morphTargetInfluences[ 3 ]; #endif -#endif`,bbt=`#ifdef USE_MORPHTARGETS +#endif`,Tbt=`#ifdef USE_MORPHTARGETS uniform float morphTargetBaseInfluence; #ifdef MORPHTARGETS_TEXTURE uniform float morphTargetInfluences[ MORPHTARGETS_COUNT ]; @@ -1653,7 +1655,7 @@ IncidentLight directLight; uniform float morphTargetInfluences[ 4 ]; #endif #endif -#endif`,Sbt=`#ifdef USE_MORPHTARGETS +#endif`,xbt=`#ifdef USE_MORPHTARGETS transformed *= morphTargetBaseInfluence; #ifdef MORPHTARGETS_TEXTURE for ( int i = 0; i < MORPHTARGETS_COUNT; i ++ ) { @@ -1671,7 +1673,7 @@ IncidentLight directLight; transformed += morphTarget7 * morphTargetInfluences[ 7 ]; #endif #endif -#endif`,ybt=`float faceDirection = gl_FrontFacing ? 1.0 : - 1.0; +#endif`,Cbt=`float faceDirection = gl_FrontFacing ? 1.0 : - 1.0; #ifdef FLAT_SHADED vec3 fdx = dFdx( vViewPosition ); vec3 fdy = dFdy( vViewPosition ); @@ -1712,7 +1714,7 @@ IncidentLight directLight; tbn2[1] *= faceDirection; #endif #endif -vec3 nonPerturbedNormal = normal;`,vbt=`#ifdef USE_NORMALMAP_OBJECTSPACE +vec3 nonPerturbedNormal = normal;`,Rbt=`#ifdef USE_NORMALMAP_OBJECTSPACE normal = texture2D( normalMap, vNormalMapUv ).xyz * 2.0 - 1.0; #ifdef FLIP_SIDED normal = - normal; @@ -1727,25 +1729,25 @@ vec3 nonPerturbedNormal = normal;`,vbt=`#ifdef USE_NORMALMAP_OBJECTSPACE normal = normalize( tbn * mapN ); #elif defined( USE_BUMPMAP ) normal = perturbNormalArb( - vViewPosition, normal, dHdxy_fwd(), faceDirection ); -#endif`,Tbt=`#ifndef FLAT_SHADED +#endif`,Abt=`#ifndef FLAT_SHADED varying vec3 vNormal; #ifdef USE_TANGENT varying vec3 vTangent; varying vec3 vBitangent; #endif -#endif`,xbt=`#ifndef FLAT_SHADED +#endif`,wbt=`#ifndef FLAT_SHADED varying vec3 vNormal; #ifdef USE_TANGENT varying vec3 vTangent; varying vec3 vBitangent; #endif -#endif`,Cbt=`#ifndef FLAT_SHADED +#endif`,Obt=`#ifndef FLAT_SHADED vNormal = normalize( transformedNormal ); #ifdef USE_TANGENT vTangent = normalize( transformedTangent ); vBitangent = normalize( cross( vNormal, vTangent ) * tangent.w ); #endif -#endif`,Rbt=`#ifdef USE_NORMALMAP +#endif`,Nbt=`#ifdef USE_NORMALMAP uniform sampler2D normalMap; uniform vec2 normalScale; #endif @@ -1767,13 +1769,13 @@ vec3 nonPerturbedNormal = normal;`,vbt=`#ifdef USE_NORMALMAP_OBJECTSPACE float scale = ( det == 0.0 ) ? 0.0 : inversesqrt( det ); return mat3( T * scale, B * scale, N ); } -#endif`,Abt=`#ifdef USE_CLEARCOAT +#endif`,Mbt=`#ifdef USE_CLEARCOAT vec3 clearcoatNormal = nonPerturbedNormal; -#endif`,wbt=`#ifdef USE_CLEARCOAT_NORMALMAP +#endif`,Ibt=`#ifdef USE_CLEARCOAT_NORMALMAP vec3 clearcoatMapN = texture2D( clearcoatNormalMap, vClearcoatNormalMapUv ).xyz * 2.0 - 1.0; clearcoatMapN.xy *= clearcoatNormalScale; clearcoatNormal = normalize( tbn2 * clearcoatMapN ); -#endif`,Obt=`#ifdef USE_CLEARCOATMAP +#endif`,Dbt=`#ifdef USE_CLEARCOATMAP uniform sampler2D clearcoatMap; #endif #ifdef USE_CLEARCOAT_NORMALMAP @@ -1782,18 +1784,18 @@ vec3 nonPerturbedNormal = normal;`,vbt=`#ifdef USE_NORMALMAP_OBJECTSPACE #endif #ifdef USE_CLEARCOAT_ROUGHNESSMAP uniform sampler2D clearcoatRoughnessMap; -#endif`,Nbt=`#ifdef USE_IRIDESCENCEMAP +#endif`,Lbt=`#ifdef USE_IRIDESCENCEMAP uniform sampler2D iridescenceMap; #endif #ifdef USE_IRIDESCENCE_THICKNESSMAP uniform sampler2D iridescenceThicknessMap; -#endif`,Mbt=`#ifdef OPAQUE +#endif`,kbt=`#ifdef OPAQUE diffuseColor.a = 1.0; #endif #ifdef USE_TRANSMISSION diffuseColor.a *= material.transmissionAlpha; #endif -gl_FragColor = vec4( outgoingLight, diffuseColor.a );`,Ibt=`vec3 packNormalToRGB( const in vec3 normal ) { +gl_FragColor = vec4( outgoingLight, diffuseColor.a );`,Pbt=`vec3 packNormalToRGB( const in vec3 normal ) { return normalize( normal ) * 0.5 + 0.5; } vec3 unpackRGBToNormal( const in vec3 rgb ) { @@ -1834,9 +1836,9 @@ float viewZToPerspectiveDepth( const in float viewZ, const in float near, const } float perspectiveDepthToViewZ( const in float depth, const in float near, const in float far ) { return ( near * far ) / ( ( far - near ) * depth - far ); -}`,Dbt=`#ifdef PREMULTIPLIED_ALPHA +}`,Ubt=`#ifdef PREMULTIPLIED_ALPHA gl_FragColor.rgb *= gl_FragColor.a; -#endif`,Lbt=`vec4 mvPosition = vec4( transformed, 1.0 ); +#endif`,Fbt=`vec4 mvPosition = vec4( transformed, 1.0 ); #ifdef USE_BATCHING mvPosition = batchingMatrix * mvPosition; #endif @@ -1844,22 +1846,22 @@ float perspectiveDepthToViewZ( const in float depth, const in float near, const mvPosition = instanceMatrix * mvPosition; #endif mvPosition = modelViewMatrix * mvPosition; -gl_Position = projectionMatrix * mvPosition;`,kbt=`#ifdef DITHERING +gl_Position = projectionMatrix * mvPosition;`,Bbt=`#ifdef DITHERING gl_FragColor.rgb = dithering( gl_FragColor.rgb ); -#endif`,Pbt=`#ifdef DITHERING +#endif`,Gbt=`#ifdef DITHERING vec3 dithering( vec3 color ) { float grid_position = rand( gl_FragCoord.xy ); vec3 dither_shift_RGB = vec3( 0.25 / 255.0, -0.25 / 255.0, 0.25 / 255.0 ); dither_shift_RGB = mix( 2.0 * dither_shift_RGB, -2.0 * dither_shift_RGB, grid_position ); return color + dither_shift_RGB; } -#endif`,Ubt=`float roughnessFactor = roughness; +#endif`,zbt=`float roughnessFactor = roughness; #ifdef USE_ROUGHNESSMAP vec4 texelRoughness = texture2D( roughnessMap, vRoughnessMapUv ); roughnessFactor *= texelRoughness.g; -#endif`,Fbt=`#ifdef USE_ROUGHNESSMAP +#endif`,Vbt=`#ifdef USE_ROUGHNESSMAP uniform sampler2D roughnessMap; -#endif`,Bbt=`#if NUM_SPOT_LIGHT_COORDS > 0 +#endif`,Hbt=`#if NUM_SPOT_LIGHT_COORDS > 0 varying vec4 vSpotLightCoord[ NUM_SPOT_LIGHT_COORDS ]; #endif #if NUM_SPOT_LIGHT_MAPS > 0 @@ -2036,7 +2038,7 @@ gl_Position = projectionMatrix * mvPosition;`,kbt=`#ifdef DITHERING return texture2DCompare( shadowMap, cubeToUV( bd3D, texelSize.y ), dp ); #endif } -#endif`,Gbt=`#if NUM_SPOT_LIGHT_COORDS > 0 +#endif`,qbt=`#if NUM_SPOT_LIGHT_COORDS > 0 uniform mat4 spotLightMatrix[ NUM_SPOT_LIGHT_COORDS ]; varying vec4 vSpotLightCoord[ NUM_SPOT_LIGHT_COORDS ]; #endif @@ -2074,7 +2076,7 @@ gl_Position = projectionMatrix * mvPosition;`,kbt=`#ifdef DITHERING }; uniform PointLightShadow pointLightShadows[ NUM_POINT_LIGHT_SHADOWS ]; #endif -#endif`,zbt=`#if ( defined( USE_SHADOWMAP ) && ( NUM_DIR_LIGHT_SHADOWS > 0 || NUM_POINT_LIGHT_SHADOWS > 0 ) ) || ( NUM_SPOT_LIGHT_COORDS > 0 ) +#endif`,Ybt=`#if ( defined( USE_SHADOWMAP ) && ( NUM_DIR_LIGHT_SHADOWS > 0 || NUM_POINT_LIGHT_SHADOWS > 0 ) ) || ( NUM_SPOT_LIGHT_COORDS > 0 ) vec3 shadowWorldNormal = inverseTransformDirection( transformedNormal, viewMatrix ); vec4 shadowWorldPosition; #endif @@ -2106,7 +2108,7 @@ gl_Position = projectionMatrix * mvPosition;`,kbt=`#ifdef DITHERING vSpotLightCoord[ i ] = spotLightMatrix[ i ] * shadowWorldPosition; } #pragma unroll_loop_end -#endif`,Vbt=`float getShadowMask() { +#endif`,$bt=`float getShadowMask() { float shadow = 1.0; #ifdef USE_SHADOWMAP #if NUM_DIR_LIGHT_SHADOWS > 0 @@ -2138,12 +2140,12 @@ gl_Position = projectionMatrix * mvPosition;`,kbt=`#ifdef DITHERING #endif #endif return shadow; -}`,Hbt=`#ifdef USE_SKINNING +}`,Wbt=`#ifdef USE_SKINNING mat4 boneMatX = getBoneMatrix( skinIndex.x ); mat4 boneMatY = getBoneMatrix( skinIndex.y ); mat4 boneMatZ = getBoneMatrix( skinIndex.z ); mat4 boneMatW = getBoneMatrix( skinIndex.w ); -#endif`,qbt=`#ifdef USE_SKINNING +#endif`,Kbt=`#ifdef USE_SKINNING uniform mat4 bindMatrix; uniform mat4 bindMatrixInverse; uniform highp sampler2D boneTexture; @@ -2158,7 +2160,7 @@ gl_Position = projectionMatrix * mvPosition;`,kbt=`#ifdef DITHERING vec4 v4 = texelFetch( boneTexture, ivec2( x + 3, y ), 0 ); return mat4( v1, v2, v3, v4 ); } -#endif`,Ybt=`#ifdef USE_SKINNING +#endif`,jbt=`#ifdef USE_SKINNING vec4 skinVertex = bindMatrix * vec4( transformed, 1.0 ); vec4 skinned = vec4( 0.0 ); skinned += boneMatX * skinVertex * skinWeight.x; @@ -2166,7 +2168,7 @@ gl_Position = projectionMatrix * mvPosition;`,kbt=`#ifdef DITHERING skinned += boneMatZ * skinVertex * skinWeight.z; skinned += boneMatW * skinVertex * skinWeight.w; transformed = ( bindMatrixInverse * skinned ).xyz; -#endif`,$bt=`#ifdef USE_SKINNING +#endif`,Qbt=`#ifdef USE_SKINNING mat4 skinMatrix = mat4( 0.0 ); skinMatrix += skinWeight.x * boneMatX; skinMatrix += skinWeight.y * boneMatY; @@ -2177,17 +2179,17 @@ gl_Position = projectionMatrix * mvPosition;`,kbt=`#ifdef DITHERING #ifdef USE_TANGENT objectTangent = vec4( skinMatrix * vec4( objectTangent, 0.0 ) ).xyz; #endif -#endif`,Wbt=`float specularStrength; +#endif`,Xbt=`float specularStrength; #ifdef USE_SPECULARMAP vec4 texelSpecular = texture2D( specularMap, vSpecularMapUv ); specularStrength = texelSpecular.r; #else specularStrength = 1.0; -#endif`,Kbt=`#ifdef USE_SPECULARMAP +#endif`,Zbt=`#ifdef USE_SPECULARMAP uniform sampler2D specularMap; -#endif`,jbt=`#if defined( TONE_MAPPING ) +#endif`,Jbt=`#if defined( TONE_MAPPING ) gl_FragColor.rgb = toneMapping( gl_FragColor.rgb ); -#endif`,Qbt=`#ifndef saturate +#endif`,eSt=`#ifndef saturate #define saturate( a ) clamp( a, 0.0, 1.0 ) #endif uniform float toneMappingExposure; @@ -2223,7 +2225,7 @@ vec3 ACESFilmicToneMapping( vec3 color ) { color = ACESOutputMat * color; return saturate( color ); } -vec3 CustomToneMapping( vec3 color ) { return color; }`,Xbt=`#ifdef USE_TRANSMISSION +vec3 CustomToneMapping( vec3 color ) { return color; }`,tSt=`#ifdef USE_TRANSMISSION material.transmission = transmission; material.transmissionAlpha = 1.0; material.thickness = thickness; @@ -2244,7 +2246,7 @@ vec3 CustomToneMapping( vec3 color ) { return color; }`,Xbt=`#ifdef USE_TRANSMIS material.attenuationColor, material.attenuationDistance ); material.transmissionAlpha = mix( material.transmissionAlpha, transmitted.a, material.transmission ); totalDiffuse = mix( totalDiffuse, transmitted.rgb, material.transmission ); -#endif`,Zbt=`#ifdef USE_TRANSMISSION +#endif`,nSt=`#ifdef USE_TRANSMISSION uniform float transmission; uniform float thickness; uniform float attenuationDistance; @@ -2350,7 +2352,7 @@ vec3 CustomToneMapping( vec3 color ) { return color; }`,Xbt=`#ifdef USE_TRANSMIS float transmittanceFactor = ( transmittance.r + transmittance.g + transmittance.b ) / 3.0; return vec4( ( 1.0 - F ) * attenuatedColor, 1.0 - ( 1.0 - transmittedLight.a ) * transmittanceFactor ); } -#endif`,Jbt=`#if defined( USE_UV ) || defined( USE_ANISOTROPY ) +#endif`,iSt=`#if defined( USE_UV ) || defined( USE_ANISOTROPY ) varying vec2 vUv; #endif #ifdef USE_MAP @@ -2420,7 +2422,7 @@ vec3 CustomToneMapping( vec3 color ) { return color; }`,Xbt=`#ifdef USE_TRANSMIS #ifdef USE_THICKNESSMAP uniform mat3 thicknessMapTransform; varying vec2 vThicknessMapUv; -#endif`,eSt=`#if defined( USE_UV ) || defined( USE_ANISOTROPY ) +#endif`,rSt=`#if defined( USE_UV ) || defined( USE_ANISOTROPY ) varying vec2 vUv; #endif #ifdef USE_MAP @@ -2514,7 +2516,7 @@ vec3 CustomToneMapping( vec3 color ) { return color; }`,Xbt=`#ifdef USE_TRANSMIS #ifdef USE_THICKNESSMAP uniform mat3 thicknessMapTransform; varying vec2 vThicknessMapUv; -#endif`,tSt=`#if defined( USE_UV ) || defined( USE_ANISOTROPY ) +#endif`,sSt=`#if defined( USE_UV ) || defined( USE_ANISOTROPY ) vUv = vec3( uv, 1 ).xy; #endif #ifdef USE_MAP @@ -2585,7 +2587,7 @@ vec3 CustomToneMapping( vec3 color ) { return color; }`,Xbt=`#ifdef USE_TRANSMIS #endif #ifdef USE_THICKNESSMAP vThicknessMapUv = ( thicknessMapTransform * vec3( THICKNESSMAP_UV, 1 ) ).xy; -#endif`,nSt=`#if defined( USE_ENVMAP ) || defined( DISTANCE ) || defined ( USE_SHADOWMAP ) || defined ( USE_TRANSMISSION ) || NUM_SPOT_LIGHT_COORDS > 0 +#endif`,oSt=`#if defined( USE_ENVMAP ) || defined( DISTANCE ) || defined ( USE_SHADOWMAP ) || defined ( USE_TRANSMISSION ) || NUM_SPOT_LIGHT_COORDS > 0 vec4 worldPosition = vec4( transformed, 1.0 ); #ifdef USE_BATCHING worldPosition = batchingMatrix * worldPosition; @@ -2594,12 +2596,12 @@ vec3 CustomToneMapping( vec3 color ) { return color; }`,Xbt=`#ifdef USE_TRANSMIS worldPosition = instanceMatrix * worldPosition; #endif worldPosition = modelMatrix * worldPosition; -#endif`;const iSt=`varying vec2 vUv; +#endif`;const aSt=`varying vec2 vUv; uniform mat3 uvTransform; void main() { vUv = ( uvTransform * vec3( uv, 1 ) ).xy; gl_Position = vec4( position.xy, 1.0, 1.0 ); -}`,rSt=`uniform sampler2D t2D; +}`,lSt=`uniform sampler2D t2D; uniform float backgroundIntensity; varying vec2 vUv; void main() { @@ -2611,14 +2613,14 @@ void main() { gl_FragColor = texColor; #include #include -}`,sSt=`varying vec3 vWorldDirection; +}`,cSt=`varying vec3 vWorldDirection; #include void main() { vWorldDirection = transformDirection( position, modelMatrix ); #include #include gl_Position.z = gl_Position.w; -}`,oSt=`#ifdef ENVMAP_TYPE_CUBE +}`,dSt=`#ifdef ENVMAP_TYPE_CUBE uniform samplerCube envMap; #elif defined( ENVMAP_TYPE_CUBE_UV ) uniform sampler2D envMap; @@ -2640,14 +2642,14 @@ void main() { gl_FragColor = texColor; #include #include -}`,aSt=`varying vec3 vWorldDirection; +}`,uSt=`varying vec3 vWorldDirection; #include void main() { vWorldDirection = transformDirection( position, modelMatrix ); #include #include gl_Position.z = gl_Position.w; -}`,lSt=`uniform samplerCube tCube; +}`,_St=`uniform samplerCube tCube; uniform float tFlip; uniform float opacity; varying vec3 vWorldDirection; @@ -2657,7 +2659,7 @@ void main() { gl_FragColor.a *= opacity; #include #include -}`,cSt=`#include +}`,pSt=`#include #include #include #include @@ -2683,7 +2685,7 @@ void main() { #include #include vHighPrecisionZW = gl_Position.zw; -}`,dSt=`#if DEPTH_PACKING == 3200 +}`,hSt=`#if DEPTH_PACKING == 3200 uniform float opacity; #endif #include @@ -2713,7 +2715,7 @@ void main() { #elif DEPTH_PACKING == 3201 gl_FragColor = packDepthToRGBA( fragCoordZ ); #endif -}`,uSt=`#define DISTANCE +}`,fSt=`#define DISTANCE varying vec3 vWorldPosition; #include #include @@ -2739,7 +2741,7 @@ void main() { #include #include vWorldPosition = worldPosition.xyz; -}`,_St=`#define DISTANCE +}`,mSt=`#define DISTANCE uniform vec3 referencePosition; uniform float nearDistance; uniform float farDistance; @@ -2763,13 +2765,13 @@ void main () { dist = ( dist - nearDistance ) / ( farDistance - nearDistance ); dist = saturate( dist ); gl_FragColor = packDepthToRGBA( dist ); -}`,pSt=`varying vec3 vWorldDirection; +}`,gSt=`varying vec3 vWorldDirection; #include void main() { vWorldDirection = transformDirection( position, modelMatrix ); #include #include -}`,hSt=`uniform sampler2D tEquirect; +}`,ESt=`uniform sampler2D tEquirect; varying vec3 vWorldDirection; #include void main() { @@ -2778,7 +2780,7 @@ void main() { gl_FragColor = texture2D( tEquirect, sampleUV ); #include #include -}`,fSt=`uniform float scale; +}`,bSt=`uniform float scale; attribute float lineDistance; varying float vLineDistance; #include @@ -2799,7 +2801,7 @@ void main() { #include #include #include -}`,mSt=`uniform vec3 diffuse; +}`,SSt=`uniform vec3 diffuse; uniform float opacity; uniform float dashSize; uniform float totalSize; @@ -2827,7 +2829,7 @@ void main() { #include #include #include -}`,gSt=`#include +}`,ySt=`#include #include #include #include @@ -2858,7 +2860,7 @@ void main() { #include #include #include -}`,ESt=`uniform vec3 diffuse; +}`,vSt=`uniform vec3 diffuse; uniform float opacity; #ifndef FLAT_SHADED varying vec3 vNormal; @@ -2906,7 +2908,7 @@ void main() { #include #include #include -}`,bSt=`#define LAMBERT +}`,TSt=`#define LAMBERT varying vec3 vViewPosition; #include #include @@ -2944,7 +2946,7 @@ void main() { #include #include #include -}`,SSt=`#define LAMBERT +}`,xSt=`#define LAMBERT uniform vec3 diffuse; uniform vec3 emissive; uniform float opacity; @@ -3001,7 +3003,7 @@ void main() { #include #include #include -}`,ySt=`#define MATCAP +}`,CSt=`#define MATCAP varying vec3 vViewPosition; #include #include @@ -3034,7 +3036,7 @@ void main() { #include #include vViewPosition = - mvPosition.xyz; -}`,vSt=`#define MATCAP +}`,RSt=`#define MATCAP uniform vec3 diffuse; uniform float opacity; uniform sampler2D matcap; @@ -3080,7 +3082,7 @@ void main() { #include #include #include -}`,TSt=`#define NORMAL +}`,ASt=`#define NORMAL #if defined( FLAT_SHADED ) || defined( USE_BUMPMAP ) || defined( USE_NORMALMAP_TANGENTSPACE ) varying vec3 vViewPosition; #endif @@ -3112,7 +3114,7 @@ void main() { #if defined( FLAT_SHADED ) || defined( USE_BUMPMAP ) || defined( USE_NORMALMAP_TANGENTSPACE ) vViewPosition = - mvPosition.xyz; #endif -}`,xSt=`#define NORMAL +}`,wSt=`#define NORMAL uniform float opacity; #if defined( FLAT_SHADED ) || defined( USE_BUMPMAP ) || defined( USE_NORMALMAP_TANGENTSPACE ) varying vec3 vViewPosition; @@ -3133,7 +3135,7 @@ void main() { #ifdef OPAQUE gl_FragColor.a = 1.0; #endif -}`,CSt=`#define PHONG +}`,OSt=`#define PHONG varying vec3 vViewPosition; #include #include @@ -3171,7 +3173,7 @@ void main() { #include #include #include -}`,RSt=`#define PHONG +}`,NSt=`#define PHONG uniform vec3 diffuse; uniform vec3 emissive; uniform vec3 specular; @@ -3230,7 +3232,7 @@ void main() { #include #include #include -}`,ASt=`#define STANDARD +}`,MSt=`#define STANDARD varying vec3 vViewPosition; #ifdef USE_TRANSMISSION varying vec3 vWorldPosition; @@ -3272,7 +3274,7 @@ void main() { #ifdef USE_TRANSMISSION vWorldPosition = worldPosition.xyz; #endif -}`,wSt=`#define STANDARD +}`,ISt=`#define STANDARD #ifdef PHYSICAL #define IOR #define USE_SPECULAR @@ -3394,7 +3396,7 @@ void main() { #include #include #include -}`,OSt=`#define TOON +}`,DSt=`#define TOON varying vec3 vViewPosition; #include #include @@ -3430,7 +3432,7 @@ void main() { #include #include #include -}`,NSt=`#define TOON +}`,LSt=`#define TOON uniform vec3 diffuse; uniform vec3 emissive; uniform float opacity; @@ -3483,7 +3485,7 @@ void main() { #include #include #include -}`,MSt=`uniform float size; +}`,kSt=`uniform float size; uniform float scale; #include #include @@ -3513,7 +3515,7 @@ void main() { #include #include #include -}`,ISt=`uniform vec3 diffuse; +}`,PSt=`uniform vec3 diffuse; uniform float opacity; #include #include @@ -3538,7 +3540,7 @@ void main() { #include #include #include -}`,DSt=`#include +}`,USt=`#include #include #include #include @@ -3560,7 +3562,7 @@ void main() { #include #include #include -}`,LSt=`uniform vec3 color; +}`,FSt=`uniform vec3 color; uniform float opacity; #include #include @@ -3576,7 +3578,7 @@ void main() { #include #include #include -}`,kSt=`uniform float rotation; +}`,BSt=`uniform float rotation; uniform vec2 center; #include #include @@ -3602,7 +3604,7 @@ void main() { #include #include #include -}`,PSt=`uniform vec3 diffuse; +}`,GSt=`uniform vec3 diffuse; uniform float opacity; #include #include @@ -3627,7 +3629,7 @@ void main() { #include #include #include -}`,ht={alphahash_fragment:rEt,alphahash_pars_fragment:sEt,alphamap_fragment:oEt,alphamap_pars_fragment:aEt,alphatest_fragment:lEt,alphatest_pars_fragment:cEt,aomap_fragment:dEt,aomap_pars_fragment:uEt,batching_pars_vertex:_Et,batching_vertex:pEt,begin_vertex:hEt,beginnormal_vertex:fEt,bsdfs:mEt,iridescence_fragment:gEt,bumpmap_pars_fragment:EEt,clipping_planes_fragment:bEt,clipping_planes_pars_fragment:SEt,clipping_planes_pars_vertex:yEt,clipping_planes_vertex:vEt,color_fragment:TEt,color_pars_fragment:xEt,color_pars_vertex:CEt,color_vertex:REt,common:AEt,cube_uv_reflection_fragment:wEt,defaultnormal_vertex:OEt,displacementmap_pars_vertex:NEt,displacementmap_vertex:MEt,emissivemap_fragment:IEt,emissivemap_pars_fragment:DEt,colorspace_fragment:LEt,colorspace_pars_fragment:kEt,envmap_fragment:PEt,envmap_common_pars_fragment:UEt,envmap_pars_fragment:FEt,envmap_pars_vertex:BEt,envmap_physical_pars_fragment:XEt,envmap_vertex:GEt,fog_vertex:zEt,fog_pars_vertex:VEt,fog_fragment:HEt,fog_pars_fragment:qEt,gradientmap_pars_fragment:YEt,lightmap_fragment:$Et,lightmap_pars_fragment:WEt,lights_lambert_fragment:KEt,lights_lambert_pars_fragment:jEt,lights_pars_begin:QEt,lights_toon_fragment:ZEt,lights_toon_pars_fragment:JEt,lights_phong_fragment:ebt,lights_phong_pars_fragment:tbt,lights_physical_fragment:nbt,lights_physical_pars_fragment:ibt,lights_fragment_begin:rbt,lights_fragment_maps:sbt,lights_fragment_end:obt,logdepthbuf_fragment:abt,logdepthbuf_pars_fragment:lbt,logdepthbuf_pars_vertex:cbt,logdepthbuf_vertex:dbt,map_fragment:ubt,map_pars_fragment:_bt,map_particle_fragment:pbt,map_particle_pars_fragment:hbt,metalnessmap_fragment:fbt,metalnessmap_pars_fragment:mbt,morphcolor_vertex:gbt,morphnormal_vertex:Ebt,morphtarget_pars_vertex:bbt,morphtarget_vertex:Sbt,normal_fragment_begin:ybt,normal_fragment_maps:vbt,normal_pars_fragment:Tbt,normal_pars_vertex:xbt,normal_vertex:Cbt,normalmap_pars_fragment:Rbt,clearcoat_normal_fragment_begin:Abt,clearcoat_normal_fragment_maps:wbt,clearcoat_pars_fragment:Obt,iridescence_pars_fragment:Nbt,opaque_fragment:Mbt,packing:Ibt,premultiplied_alpha_fragment:Dbt,project_vertex:Lbt,dithering_fragment:kbt,dithering_pars_fragment:Pbt,roughnessmap_fragment:Ubt,roughnessmap_pars_fragment:Fbt,shadowmap_pars_fragment:Bbt,shadowmap_pars_vertex:Gbt,shadowmap_vertex:zbt,shadowmask_pars_fragment:Vbt,skinbase_vertex:Hbt,skinning_pars_vertex:qbt,skinning_vertex:Ybt,skinnormal_vertex:$bt,specularmap_fragment:Wbt,specularmap_pars_fragment:Kbt,tonemapping_fragment:jbt,tonemapping_pars_fragment:Qbt,transmission_fragment:Xbt,transmission_pars_fragment:Zbt,uv_pars_fragment:Jbt,uv_pars_vertex:eSt,uv_vertex:tSt,worldpos_vertex:nSt,background_vert:iSt,background_frag:rSt,backgroundCube_vert:sSt,backgroundCube_frag:oSt,cube_vert:aSt,cube_frag:lSt,depth_vert:cSt,depth_frag:dSt,distanceRGBA_vert:uSt,distanceRGBA_frag:_St,equirect_vert:pSt,equirect_frag:hSt,linedashed_vert:fSt,linedashed_frag:mSt,meshbasic_vert:gSt,meshbasic_frag:ESt,meshlambert_vert:bSt,meshlambert_frag:SSt,meshmatcap_vert:ySt,meshmatcap_frag:vSt,meshnormal_vert:TSt,meshnormal_frag:xSt,meshphong_vert:CSt,meshphong_frag:RSt,meshphysical_vert:ASt,meshphysical_frag:wSt,meshtoon_vert:OSt,meshtoon_frag:NSt,points_vert:MSt,points_frag:ISt,shadow_vert:DSt,shadow_frag:LSt,sprite_vert:kSt,sprite_frag:PSt},ze={common:{diffuse:{value:new ot(16777215)},opacity:{value:1},map:{value:null},mapTransform:{value:new mt},alphaMap:{value:null},alphaMapTransform:{value:new mt},alphaTest:{value:0}},specularmap:{specularMap:{value:null},specularMapTransform:{value:new mt}},envmap:{envMap:{value:null},flipEnvMap:{value:-1},reflectivity:{value:1},ior:{value:1.5},refractionRatio:{value:.98}},aomap:{aoMap:{value:null},aoMapIntensity:{value:1},aoMapTransform:{value:new mt}},lightmap:{lightMap:{value:null},lightMapIntensity:{value:1},lightMapTransform:{value:new mt}},bumpmap:{bumpMap:{value:null},bumpMapTransform:{value:new mt},bumpScale:{value:1}},normalmap:{normalMap:{value:null},normalMapTransform:{value:new mt},normalScale:{value:new vt(1,1)}},displacementmap:{displacementMap:{value:null},displacementMapTransform:{value:new mt},displacementScale:{value:1},displacementBias:{value:0}},emissivemap:{emissiveMap:{value:null},emissiveMapTransform:{value:new mt}},metalnessmap:{metalnessMap:{value:null},metalnessMapTransform:{value:new mt}},roughnessmap:{roughnessMap:{value:null},roughnessMapTransform:{value:new mt}},gradientmap:{gradientMap:{value:null}},fog:{fogDensity:{value:25e-5},fogNear:{value:1},fogFar:{value:2e3},fogColor:{value:new ot(16777215)}},lights:{ambientLightColor:{value:[]},lightProbe:{value:[]},directionalLights:{value:[],properties:{direction:{},color:{}}},directionalLightShadows:{value:[],properties:{shadowBias:{},shadowNormalBias:{},shadowRadius:{},shadowMapSize:{}}},directionalShadowMap:{value:[]},directionalShadowMatrix:{value:[]},spotLights:{value:[],properties:{color:{},position:{},direction:{},distance:{},coneCos:{},penumbraCos:{},decay:{}}},spotLightShadows:{value:[],properties:{shadowBias:{},shadowNormalBias:{},shadowRadius:{},shadowMapSize:{}}},spotLightMap:{value:[]},spotShadowMap:{value:[]},spotLightMatrix:{value:[]},pointLights:{value:[],properties:{color:{},position:{},decay:{},distance:{}}},pointLightShadows:{value:[],properties:{shadowBias:{},shadowNormalBias:{},shadowRadius:{},shadowMapSize:{},shadowCameraNear:{},shadowCameraFar:{}}},pointShadowMap:{value:[]},pointShadowMatrix:{value:[]},hemisphereLights:{value:[],properties:{direction:{},skyColor:{},groundColor:{}}},rectAreaLights:{value:[],properties:{color:{},position:{},width:{},height:{}}},ltc_1:{value:null},ltc_2:{value:null}},points:{diffuse:{value:new ot(16777215)},opacity:{value:1},size:{value:1},scale:{value:1},map:{value:null},alphaMap:{value:null},alphaMapTransform:{value:new mt},alphaTest:{value:0},uvTransform:{value:new mt}},sprite:{diffuse:{value:new ot(16777215)},opacity:{value:1},center:{value:new vt(.5,.5)},rotation:{value:0},map:{value:null},mapTransform:{value:new mt},alphaMap:{value:null},alphaMapTransform:{value:new mt},alphaTest:{value:0}}},yi={basic:{uniforms:Cn([ze.common,ze.specularmap,ze.envmap,ze.aomap,ze.lightmap,ze.fog]),vertexShader:ht.meshbasic_vert,fragmentShader:ht.meshbasic_frag},lambert:{uniforms:Cn([ze.common,ze.specularmap,ze.envmap,ze.aomap,ze.lightmap,ze.emissivemap,ze.bumpmap,ze.normalmap,ze.displacementmap,ze.fog,ze.lights,{emissive:{value:new ot(0)}}]),vertexShader:ht.meshlambert_vert,fragmentShader:ht.meshlambert_frag},phong:{uniforms:Cn([ze.common,ze.specularmap,ze.envmap,ze.aomap,ze.lightmap,ze.emissivemap,ze.bumpmap,ze.normalmap,ze.displacementmap,ze.fog,ze.lights,{emissive:{value:new ot(0)},specular:{value:new ot(1118481)},shininess:{value:30}}]),vertexShader:ht.meshphong_vert,fragmentShader:ht.meshphong_frag},standard:{uniforms:Cn([ze.common,ze.envmap,ze.aomap,ze.lightmap,ze.emissivemap,ze.bumpmap,ze.normalmap,ze.displacementmap,ze.roughnessmap,ze.metalnessmap,ze.fog,ze.lights,{emissive:{value:new ot(0)},roughness:{value:1},metalness:{value:0},envMapIntensity:{value:1}}]),vertexShader:ht.meshphysical_vert,fragmentShader:ht.meshphysical_frag},toon:{uniforms:Cn([ze.common,ze.aomap,ze.lightmap,ze.emissivemap,ze.bumpmap,ze.normalmap,ze.displacementmap,ze.gradientmap,ze.fog,ze.lights,{emissive:{value:new ot(0)}}]),vertexShader:ht.meshtoon_vert,fragmentShader:ht.meshtoon_frag},matcap:{uniforms:Cn([ze.common,ze.bumpmap,ze.normalmap,ze.displacementmap,ze.fog,{matcap:{value:null}}]),vertexShader:ht.meshmatcap_vert,fragmentShader:ht.meshmatcap_frag},points:{uniforms:Cn([ze.points,ze.fog]),vertexShader:ht.points_vert,fragmentShader:ht.points_frag},dashed:{uniforms:Cn([ze.common,ze.fog,{scale:{value:1},dashSize:{value:1},totalSize:{value:2}}]),vertexShader:ht.linedashed_vert,fragmentShader:ht.linedashed_frag},depth:{uniforms:Cn([ze.common,ze.displacementmap]),vertexShader:ht.depth_vert,fragmentShader:ht.depth_frag},normal:{uniforms:Cn([ze.common,ze.bumpmap,ze.normalmap,ze.displacementmap,{opacity:{value:1}}]),vertexShader:ht.meshnormal_vert,fragmentShader:ht.meshnormal_frag},sprite:{uniforms:Cn([ze.sprite,ze.fog]),vertexShader:ht.sprite_vert,fragmentShader:ht.sprite_frag},background:{uniforms:{uvTransform:{value:new mt},t2D:{value:null},backgroundIntensity:{value:1}},vertexShader:ht.background_vert,fragmentShader:ht.background_frag},backgroundCube:{uniforms:{envMap:{value:null},flipEnvMap:{value:-1},backgroundBlurriness:{value:0},backgroundIntensity:{value:1}},vertexShader:ht.backgroundCube_vert,fragmentShader:ht.backgroundCube_frag},cube:{uniforms:{tCube:{value:null},tFlip:{value:-1},opacity:{value:1}},vertexShader:ht.cube_vert,fragmentShader:ht.cube_frag},equirect:{uniforms:{tEquirect:{value:null}},vertexShader:ht.equirect_vert,fragmentShader:ht.equirect_frag},distanceRGBA:{uniforms:Cn([ze.common,ze.displacementmap,{referencePosition:{value:new ue},nearDistance:{value:1},farDistance:{value:1e3}}]),vertexShader:ht.distanceRGBA_vert,fragmentShader:ht.distanceRGBA_frag},shadow:{uniforms:Cn([ze.lights,ze.fog,{color:{value:new ot(0)},opacity:{value:1}}]),vertexShader:ht.shadow_vert,fragmentShader:ht.shadow_frag}};yi.physical={uniforms:Cn([yi.standard.uniforms,{clearcoat:{value:0},clearcoatMap:{value:null},clearcoatMapTransform:{value:new mt},clearcoatNormalMap:{value:null},clearcoatNormalMapTransform:{value:new mt},clearcoatNormalScale:{value:new vt(1,1)},clearcoatRoughness:{value:0},clearcoatRoughnessMap:{value:null},clearcoatRoughnessMapTransform:{value:new mt},iridescence:{value:0},iridescenceMap:{value:null},iridescenceMapTransform:{value:new mt},iridescenceIOR:{value:1.3},iridescenceThicknessMinimum:{value:100},iridescenceThicknessMaximum:{value:400},iridescenceThicknessMap:{value:null},iridescenceThicknessMapTransform:{value:new mt},sheen:{value:0},sheenColor:{value:new ot(0)},sheenColorMap:{value:null},sheenColorMapTransform:{value:new mt},sheenRoughness:{value:1},sheenRoughnessMap:{value:null},sheenRoughnessMapTransform:{value:new mt},transmission:{value:0},transmissionMap:{value:null},transmissionMapTransform:{value:new mt},transmissionSamplerSize:{value:new vt},transmissionSamplerMap:{value:null},thickness:{value:0},thicknessMap:{value:null},thicknessMapTransform:{value:new mt},attenuationDistance:{value:0},attenuationColor:{value:new ot(0)},specularColor:{value:new ot(1,1,1)},specularColorMap:{value:null},specularColorMapTransform:{value:new mt},specularIntensity:{value:1},specularIntensityMap:{value:null},specularIntensityMapTransform:{value:new mt},anisotropyVector:{value:new vt},anisotropyMap:{value:null},anisotropyMapTransform:{value:new mt}}]),vertexShader:ht.meshphysical_vert,fragmentShader:ht.meshphysical_frag};const Oc={r:0,b:0,g:0};function USt(n,e,t,i,r,s,o){const a=new ot(0);let l=s===!0?0:1,c,d,u=null,_=0,f=null;function h(g,m){let b=!1,S=m.isScene===!0?m.background:null;S&&S.isTexture&&(S=(m.backgroundBlurriness>0?t:e).get(S)),S===null?E(a,l):S&&S.isColor&&(E(S,1),b=!0);const v=n.xr.getEnvironmentBlendMode();v==="additive"?i.buffers.color.setClear(0,0,0,1,o):v==="alpha-blend"&&i.buffers.color.setClear(0,0,0,0,o),(n.autoClear||b)&&n.clear(n.autoClearColor,n.autoClearDepth,n.autoClearStencil),S&&(S.isCubeTexture||S.mapping===ou)?(d===void 0&&(d=new An(new $r(1,1,1),new Us({name:"BackgroundCubeMaterial",uniforms:ta(yi.backgroundCube.uniforms),vertexShader:yi.backgroundCube.vertexShader,fragmentShader:yi.backgroundCube.fragmentShader,side:Ln,depthTest:!1,depthWrite:!1,fog:!1})),d.geometry.deleteAttribute("normal"),d.geometry.deleteAttribute("uv"),d.onBeforeRender=function(T,C,N){this.matrixWorld.copyPosition(N.matrixWorld)},Object.defineProperty(d.material,"envMap",{get:function(){return this.uniforms.envMap.value}}),r.update(d)),d.material.uniforms.envMap.value=S,d.material.uniforms.flipEnvMap.value=S.isCubeTexture&&S.isRenderTargetTexture===!1?-1:1,d.material.uniforms.backgroundBlurriness.value=m.backgroundBlurriness,d.material.uniforms.backgroundIntensity.value=m.backgroundIntensity,d.material.toneMapped=Nt.getTransfer(S.colorSpace)!==Gt,(u!==S||_!==S.version||f!==n.toneMapping)&&(d.material.needsUpdate=!0,u=S,_=S.version,f=n.toneMapping),d.layers.enableAll(),g.unshift(d,d.geometry,d.material,0,0,null)):S&&S.isTexture&&(c===void 0&&(c=new An(new zE(2,2),new Us({name:"BackgroundMaterial",uniforms:ta(yi.background.uniforms),vertexShader:yi.background.vertexShader,fragmentShader:yi.background.fragmentShader,side:cr,depthTest:!1,depthWrite:!1,fog:!1})),c.geometry.deleteAttribute("normal"),Object.defineProperty(c.material,"map",{get:function(){return this.uniforms.t2D.value}}),r.update(c)),c.material.uniforms.t2D.value=S,c.material.uniforms.backgroundIntensity.value=m.backgroundIntensity,c.material.toneMapped=Nt.getTransfer(S.colorSpace)!==Gt,S.matrixAutoUpdate===!0&&S.updateMatrix(),c.material.uniforms.uvTransform.value.copy(S.matrix),(u!==S||_!==S.version||f!==n.toneMapping)&&(c.material.needsUpdate=!0,u=S,_=S.version,f=n.toneMapping),c.layers.enableAll(),g.unshift(c,c.geometry,c.material,0,0,null))}function E(g,m){g.getRGB(Oc,cO(n)),i.buffers.color.setClear(Oc.r,Oc.g,Oc.b,m,o)}return{getClearColor:function(){return a},setClearColor:function(g,m=1){a.set(g),l=m,E(a,l)},getClearAlpha:function(){return l},setClearAlpha:function(g){l=g,E(a,l)},render:h}}function FSt(n,e,t,i){const r=n.getParameter(n.MAX_VERTEX_ATTRIBS),s=i.isWebGL2?null:e.get("OES_vertex_array_object"),o=i.isWebGL2||s!==null,a={},l=g(null);let c=l,d=!1;function u(I,V,z,D,Y){let K=!1;if(o){const q=E(D,z,V);c!==q&&(c=q,f(c.object)),K=m(I,D,z,Y),K&&b(I,D,z,Y)}else{const q=V.wireframe===!0;(c.geometry!==D.id||c.program!==z.id||c.wireframe!==q)&&(c.geometry=D.id,c.program=z.id,c.wireframe=q,K=!0)}Y!==null&&t.update(Y,n.ELEMENT_ARRAY_BUFFER),(K||d)&&(d=!1,x(I,V,z,D),Y!==null&&n.bindBuffer(n.ELEMENT_ARRAY_BUFFER,t.get(Y).buffer))}function _(){return i.isWebGL2?n.createVertexArray():s.createVertexArrayOES()}function f(I){return i.isWebGL2?n.bindVertexArray(I):s.bindVertexArrayOES(I)}function h(I){return i.isWebGL2?n.deleteVertexArray(I):s.deleteVertexArrayOES(I)}function E(I,V,z){const D=z.wireframe===!0;let Y=a[I.id];Y===void 0&&(Y={},a[I.id]=Y);let K=Y[V.id];K===void 0&&(K={},Y[V.id]=K);let q=K[D];return q===void 0&&(q=g(_()),K[D]=q),q}function g(I){const V=[],z=[],D=[];for(let Y=0;Y=0){const _e=Y[Z];let he=K[Z];if(he===void 0&&(Z==="instanceMatrix"&&I.instanceMatrix&&(he=I.instanceMatrix),Z==="instanceColor"&&I.instanceColor&&(he=I.instanceColor)),_e===void 0||_e.attribute!==he||he&&_e.data!==he.data)return!0;q++}return c.attributesNum!==q||c.index!==D}function b(I,V,z,D){const Y={},K=V.attributes;let q=0;const le=z.getAttributes();for(const Z in le)if(le[Z].location>=0){let _e=K[Z];_e===void 0&&(Z==="instanceMatrix"&&I.instanceMatrix&&(_e=I.instanceMatrix),Z==="instanceColor"&&I.instanceColor&&(_e=I.instanceColor));const he={};he.attribute=_e,_e&&_e.data&&(he.data=_e.data),Y[Z]=he,q++}c.attributes=Y,c.attributesNum=q,c.index=D}function S(){const I=c.newAttributes;for(let V=0,z=I.length;V=0){let J=Y[le];if(J===void 0&&(le==="instanceMatrix"&&I.instanceMatrix&&(J=I.instanceMatrix),le==="instanceColor"&&I.instanceColor&&(J=I.instanceColor)),J!==void 0){const _e=J.normalized,he=J.itemSize,ye=t.get(J);if(ye===void 0)continue;const j=ye.buffer,de=ye.type,Q=ye.bytesPerElement,fe=i.isWebGL2===!0&&(de===n.INT||de===n.UNSIGNED_INT||J.gpuType===Yw);if(J.isInterleavedBufferAttribute){const we=J.data,O=we.stride,F=J.offset;if(we.isInstancedInterleavedBuffer){for(let H=0;H0&&n.getShaderPrecisionFormat(n.FRAGMENT_SHADER,n.HIGH_FLOAT).precision>0)return"highp";N="mediump"}return N==="mediump"&&n.getShaderPrecisionFormat(n.VERTEX_SHADER,n.MEDIUM_FLOAT).precision>0&&n.getShaderPrecisionFormat(n.FRAGMENT_SHADER,n.MEDIUM_FLOAT).precision>0?"mediump":"lowp"}const o=typeof WebGL2RenderingContext<"u"&&n.constructor.name==="WebGL2RenderingContext";let a=t.precision!==void 0?t.precision:"highp";const l=s(a);l!==a&&(console.warn("THREE.WebGLRenderer:",a,"not supported, using",l,"instead."),a=l);const c=o||e.has("WEBGL_draw_buffers"),d=t.logarithmicDepthBuffer===!0,u=n.getParameter(n.MAX_TEXTURE_IMAGE_UNITS),_=n.getParameter(n.MAX_VERTEX_TEXTURE_IMAGE_UNITS),f=n.getParameter(n.MAX_TEXTURE_SIZE),h=n.getParameter(n.MAX_CUBE_MAP_TEXTURE_SIZE),E=n.getParameter(n.MAX_VERTEX_ATTRIBS),g=n.getParameter(n.MAX_VERTEX_UNIFORM_VECTORS),m=n.getParameter(n.MAX_VARYING_VECTORS),b=n.getParameter(n.MAX_FRAGMENT_UNIFORM_VECTORS),S=_>0,v=o||e.has("OES_texture_float"),T=S&&v,C=o?n.getParameter(n.MAX_SAMPLES):0;return{isWebGL2:o,drawBuffers:c,getMaxAnisotropy:r,getMaxPrecision:s,precision:a,logarithmicDepthBuffer:d,maxTextures:u,maxVertexTextures:_,maxTextureSize:f,maxCubemapSize:h,maxAttributes:E,maxVertexUniforms:g,maxVaryings:m,maxFragmentUniforms:b,vertexTextures:S,floatFragmentTextures:v,floatVertexTextures:T,maxSamples:C}}function zSt(n){const e=this;let t=null,i=0,r=!1,s=!1;const o=new _s,a=new mt,l={value:null,needsUpdate:!1};this.uniform=l,this.numPlanes=0,this.numIntersection=0,this.init=function(u,_){const f=u.length!==0||_||i!==0||r;return r=_,i=u.length,f},this.beginShadows=function(){s=!0,d(null)},this.endShadows=function(){s=!1},this.setGlobalState=function(u,_){t=d(u,_,0)},this.setState=function(u,_,f){const h=u.clippingPlanes,E=u.clipIntersection,g=u.clipShadows,m=n.get(u);if(!r||h===null||h.length===0||s&&!g)s?d(null):c();else{const b=s?0:i,S=b*4;let v=m.clippingState||null;l.value=v,v=d(h,_,S,f);for(let T=0;T!==S;++T)v[T]=t[T];m.clippingState=v,this.numIntersection=E?this.numPlanes:0,this.numPlanes+=b}};function c(){l.value!==t&&(l.value=t,l.needsUpdate=i>0),e.numPlanes=i,e.numIntersection=0}function d(u,_,f,h){const E=u!==null?u.length:0;let g=null;if(E!==0){if(g=l.value,h!==!0||g===null){const m=f+E*4,b=_.matrixWorldInverse;a.getNormalMatrix(b),(g===null||g.length0){const c=new eEt(l.height/2);return c.fromEquirectangularTexture(n,o),e.set(o,c),o.addEventListener("dispose",r),t(c.texture,o.mapping)}else return null}}return o}function r(o){const a=o.target;a.removeEventListener("dispose",r);const l=e.get(a);l!==void 0&&(e.delete(a),l.dispose())}function s(){e=new WeakMap}return{get:i,dispose:s}}class VE extends dO{constructor(e=-1,t=1,i=1,r=-1,s=.1,o=2e3){super(),this.isOrthographicCamera=!0,this.type="OrthographicCamera",this.zoom=1,this.view=null,this.left=e,this.right=t,this.top=i,this.bottom=r,this.near=s,this.far=o,this.updateProjectionMatrix()}copy(e,t){return super.copy(e,t),this.left=e.left,this.right=e.right,this.top=e.top,this.bottom=e.bottom,this.near=e.near,this.far=e.far,this.zoom=e.zoom,this.view=e.view===null?null:Object.assign({},e.view),this}setViewOffset(e,t,i,r,s,o){this.view===null&&(this.view={enabled:!0,fullWidth:1,fullHeight:1,offsetX:0,offsetY:0,width:1,height:1}),this.view.enabled=!0,this.view.fullWidth=e,this.view.fullHeight=t,this.view.offsetX=i,this.view.offsetY=r,this.view.width=s,this.view.height=o,this.updateProjectionMatrix()}clearViewOffset(){this.view!==null&&(this.view.enabled=!1),this.updateProjectionMatrix()}updateProjectionMatrix(){const e=(this.right-this.left)/(2*this.zoom),t=(this.top-this.bottom)/(2*this.zoom),i=(this.right+this.left)/2,r=(this.top+this.bottom)/2;let s=i-e,o=i+e,a=r+t,l=r-t;if(this.view!==null&&this.view.enabled){const c=(this.right-this.left)/this.view.fullWidth/this.zoom,d=(this.top-this.bottom)/this.view.fullHeight/this.zoom;s+=c*this.view.offsetX,o=s+c*this.view.width,a-=d*this.view.offsetY,l=a-d*this.view.height}this.projectionMatrix.makeOrthographic(s,o,a,l,this.near,this.far,this.coordinateSystem),this.projectionMatrixInverse.copy(this.projectionMatrix).invert()}toJSON(e){const t=super.toJSON(e);return t.object.zoom=this.zoom,t.object.left=this.left,t.object.right=this.right,t.object.top=this.top,t.object.bottom=this.bottom,t.object.near=this.near,t.object.far=this.far,this.view!==null&&(t.object.view=Object.assign({},this.view)),t}}const yo=4,SC=[.125,.215,.35,.446,.526,.582],Ss=20,Xf=new VE,yC=new ot;let Zf=null,Jf=0,em=0;const ps=(1+Math.sqrt(5))/2,fo=1/ps,vC=[new ue(1,1,1),new ue(-1,1,1),new ue(1,1,-1),new ue(-1,1,-1),new ue(0,ps,fo),new ue(0,ps,-fo),new ue(fo,0,ps),new ue(-fo,0,ps),new ue(ps,fo,0),new ue(-ps,fo,0)];class TC{constructor(e){this._renderer=e,this._pingPongRenderTarget=null,this._lodMax=0,this._cubeSize=0,this._lodPlanes=[],this._sizeLods=[],this._sigmas=[],this._blurMaterial=null,this._cubemapMaterial=null,this._equirectMaterial=null,this._compileMaterial(this._blurMaterial)}fromScene(e,t=0,i=.1,r=100){Zf=this._renderer.getRenderTarget(),Jf=this._renderer.getActiveCubeFace(),em=this._renderer.getActiveMipmapLevel(),this._setSize(256);const s=this._allocateTargets();return s.depthBuffer=!0,this._sceneToCubeUV(e,i,r,s),t>0&&this._blur(s,0,0,t),this._applyPMREM(s),this._cleanup(s),s}fromEquirectangular(e,t=null){return this._fromTexture(e,t)}fromCubemap(e,t=null){return this._fromTexture(e,t)}compileCubemapShader(){this._cubemapMaterial===null&&(this._cubemapMaterial=RC(),this._compileMaterial(this._cubemapMaterial))}compileEquirectangularShader(){this._equirectMaterial===null&&(this._equirectMaterial=CC(),this._compileMaterial(this._equirectMaterial))}dispose(){this._dispose(),this._cubemapMaterial!==null&&this._cubemapMaterial.dispose(),this._equirectMaterial!==null&&this._equirectMaterial.dispose()}_setSize(e){this._lodMax=Math.floor(Math.log2(e)),this._cubeSize=Math.pow(2,this._lodMax)}_dispose(){this._blurMaterial!==null&&this._blurMaterial.dispose(),this._pingPongRenderTarget!==null&&this._pingPongRenderTarget.dispose();for(let e=0;e2?S:0,S,S),d.setRenderTarget(r),E&&d.render(h,a),d.render(e,a)}h.geometry.dispose(),h.material.dispose(),d.toneMapping=_,d.autoClear=u,e.background=g}_textureToCubeUV(e,t){const i=this._renderer,r=e.mapping===jo||e.mapping===Qo;r?(this._cubemapMaterial===null&&(this._cubemapMaterial=RC()),this._cubemapMaterial.uniforms.flipEnvMap.value=e.isRenderTargetTexture===!1?-1:1):this._equirectMaterial===null&&(this._equirectMaterial=CC());const s=r?this._cubemapMaterial:this._equirectMaterial,o=new An(this._lodPlanes[0],s),a=s.uniforms;a.envMap.value=e;const l=this._cubeSize;Nc(t,0,0,3*l,2*l),i.setRenderTarget(t),i.render(o,Xf)}_applyPMREM(e){const t=this._renderer,i=t.autoClear;t.autoClear=!1;for(let r=1;rSs&&console.warn(`sigmaRadians, ${s}, is too large and will clip, as it requested ${g} samples when the maximum is set to ${Ss}`);const m=[];let b=0;for(let N=0;NS-yo?r-S+yo:0),C=4*(this._cubeSize-v);Nc(t,T,C,3*v,2*v),l.setRenderTarget(t),l.render(u,Xf)}}function HSt(n){const e=[],t=[],i=[];let r=n;const s=n-yo+1+SC.length;for(let o=0;on-yo?l=SC[o-n+yo-1]:o===0&&(l=0),i.push(l);const c=1/(a-2),d=-c,u=1+c,_=[d,d,u,d,u,u,d,d,u,u,d,u],f=6,h=6,E=3,g=2,m=1,b=new Float32Array(E*h*f),S=new Float32Array(g*h*f),v=new Float32Array(m*h*f);for(let C=0;C2?0:-1,y=[N,x,0,N+2/3,x,0,N+2/3,x+1,0,N,x,0,N+2/3,x+1,0,N,x+1,0];b.set(y,E*h*C),S.set(_,g*h*C);const R=[C,C,C,C,C,C];v.set(R,m*h*C)}const T=new Fi;T.setAttribute("position",new wn(b,E)),T.setAttribute("uv",new wn(S,g)),T.setAttribute("faceIndex",new wn(v,m)),e.push(T),r>yo&&r--}return{lodPlanes:e,sizeLods:t,sigmas:i}}function xC(n,e,t){const i=new Ps(n,e,t);return i.texture.mapping=ou,i.texture.name="PMREM.cubeUv",i.scissorTest=!0,i}function Nc(n,e,t,i,r){n.viewport.set(e,t,i,r),n.scissor.set(e,t,i,r)}function qSt(n,e,t){const i=new Float32Array(Ss),r=new ue(0,1,0);return new Us({name:"SphericalGaussianBlur",defines:{n:Ss,CUBEUV_TEXEL_WIDTH:1/e,CUBEUV_TEXEL_HEIGHT:1/t,CUBEUV_MAX_MIP:`${n}.0`},uniforms:{envMap:{value:null},samples:{value:1},weights:{value:i},latitudinal:{value:!1},dTheta:{value:0},mipInt:{value:0},poleAxis:{value:r}},vertexShader:HE(),fragmentShader:` +}`,ht={alphahash_fragment:lEt,alphahash_pars_fragment:cEt,alphamap_fragment:dEt,alphamap_pars_fragment:uEt,alphatest_fragment:_Et,alphatest_pars_fragment:pEt,aomap_fragment:hEt,aomap_pars_fragment:fEt,batching_pars_vertex:mEt,batching_vertex:gEt,begin_vertex:EEt,beginnormal_vertex:bEt,bsdfs:SEt,iridescence_fragment:yEt,bumpmap_pars_fragment:vEt,clipping_planes_fragment:TEt,clipping_planes_pars_fragment:xEt,clipping_planes_pars_vertex:CEt,clipping_planes_vertex:REt,color_fragment:AEt,color_pars_fragment:wEt,color_pars_vertex:OEt,color_vertex:NEt,common:MEt,cube_uv_reflection_fragment:IEt,defaultnormal_vertex:DEt,displacementmap_pars_vertex:LEt,displacementmap_vertex:kEt,emissivemap_fragment:PEt,emissivemap_pars_fragment:UEt,colorspace_fragment:FEt,colorspace_pars_fragment:BEt,envmap_fragment:GEt,envmap_common_pars_fragment:zEt,envmap_pars_fragment:VEt,envmap_pars_vertex:HEt,envmap_physical_pars_fragment:tbt,envmap_vertex:qEt,fog_vertex:YEt,fog_pars_vertex:$Et,fog_fragment:WEt,fog_pars_fragment:KEt,gradientmap_pars_fragment:jEt,lightmap_fragment:QEt,lightmap_pars_fragment:XEt,lights_lambert_fragment:ZEt,lights_lambert_pars_fragment:JEt,lights_pars_begin:ebt,lights_toon_fragment:nbt,lights_toon_pars_fragment:ibt,lights_phong_fragment:rbt,lights_phong_pars_fragment:sbt,lights_physical_fragment:obt,lights_physical_pars_fragment:abt,lights_fragment_begin:lbt,lights_fragment_maps:cbt,lights_fragment_end:dbt,logdepthbuf_fragment:ubt,logdepthbuf_pars_fragment:_bt,logdepthbuf_pars_vertex:pbt,logdepthbuf_vertex:hbt,map_fragment:fbt,map_pars_fragment:mbt,map_particle_fragment:gbt,map_particle_pars_fragment:Ebt,metalnessmap_fragment:bbt,metalnessmap_pars_fragment:Sbt,morphcolor_vertex:ybt,morphnormal_vertex:vbt,morphtarget_pars_vertex:Tbt,morphtarget_vertex:xbt,normal_fragment_begin:Cbt,normal_fragment_maps:Rbt,normal_pars_fragment:Abt,normal_pars_vertex:wbt,normal_vertex:Obt,normalmap_pars_fragment:Nbt,clearcoat_normal_fragment_begin:Mbt,clearcoat_normal_fragment_maps:Ibt,clearcoat_pars_fragment:Dbt,iridescence_pars_fragment:Lbt,opaque_fragment:kbt,packing:Pbt,premultiplied_alpha_fragment:Ubt,project_vertex:Fbt,dithering_fragment:Bbt,dithering_pars_fragment:Gbt,roughnessmap_fragment:zbt,roughnessmap_pars_fragment:Vbt,shadowmap_pars_fragment:Hbt,shadowmap_pars_vertex:qbt,shadowmap_vertex:Ybt,shadowmask_pars_fragment:$bt,skinbase_vertex:Wbt,skinning_pars_vertex:Kbt,skinning_vertex:jbt,skinnormal_vertex:Qbt,specularmap_fragment:Xbt,specularmap_pars_fragment:Zbt,tonemapping_fragment:Jbt,tonemapping_pars_fragment:eSt,transmission_fragment:tSt,transmission_pars_fragment:nSt,uv_pars_fragment:iSt,uv_pars_vertex:rSt,uv_vertex:sSt,worldpos_vertex:oSt,background_vert:aSt,background_frag:lSt,backgroundCube_vert:cSt,backgroundCube_frag:dSt,cube_vert:uSt,cube_frag:_St,depth_vert:pSt,depth_frag:hSt,distanceRGBA_vert:fSt,distanceRGBA_frag:mSt,equirect_vert:gSt,equirect_frag:ESt,linedashed_vert:bSt,linedashed_frag:SSt,meshbasic_vert:ySt,meshbasic_frag:vSt,meshlambert_vert:TSt,meshlambert_frag:xSt,meshmatcap_vert:CSt,meshmatcap_frag:RSt,meshnormal_vert:ASt,meshnormal_frag:wSt,meshphong_vert:OSt,meshphong_frag:NSt,meshphysical_vert:MSt,meshphysical_frag:ISt,meshtoon_vert:DSt,meshtoon_frag:LSt,points_vert:kSt,points_frag:PSt,shadow_vert:USt,shadow_frag:FSt,sprite_vert:BSt,sprite_frag:GSt},ze={common:{diffuse:{value:new ot(16777215)},opacity:{value:1},map:{value:null},mapTransform:{value:new mt},alphaMap:{value:null},alphaMapTransform:{value:new mt},alphaTest:{value:0}},specularmap:{specularMap:{value:null},specularMapTransform:{value:new mt}},envmap:{envMap:{value:null},flipEnvMap:{value:-1},reflectivity:{value:1},ior:{value:1.5},refractionRatio:{value:.98}},aomap:{aoMap:{value:null},aoMapIntensity:{value:1},aoMapTransform:{value:new mt}},lightmap:{lightMap:{value:null},lightMapIntensity:{value:1},lightMapTransform:{value:new mt}},bumpmap:{bumpMap:{value:null},bumpMapTransform:{value:new mt},bumpScale:{value:1}},normalmap:{normalMap:{value:null},normalMapTransform:{value:new mt},normalScale:{value:new vt(1,1)}},displacementmap:{displacementMap:{value:null},displacementMapTransform:{value:new mt},displacementScale:{value:1},displacementBias:{value:0}},emissivemap:{emissiveMap:{value:null},emissiveMapTransform:{value:new mt}},metalnessmap:{metalnessMap:{value:null},metalnessMapTransform:{value:new mt}},roughnessmap:{roughnessMap:{value:null},roughnessMapTransform:{value:new mt}},gradientmap:{gradientMap:{value:null}},fog:{fogDensity:{value:25e-5},fogNear:{value:1},fogFar:{value:2e3},fogColor:{value:new ot(16777215)}},lights:{ambientLightColor:{value:[]},lightProbe:{value:[]},directionalLights:{value:[],properties:{direction:{},color:{}}},directionalLightShadows:{value:[],properties:{shadowBias:{},shadowNormalBias:{},shadowRadius:{},shadowMapSize:{}}},directionalShadowMap:{value:[]},directionalShadowMatrix:{value:[]},spotLights:{value:[],properties:{color:{},position:{},direction:{},distance:{},coneCos:{},penumbraCos:{},decay:{}}},spotLightShadows:{value:[],properties:{shadowBias:{},shadowNormalBias:{},shadowRadius:{},shadowMapSize:{}}},spotLightMap:{value:[]},spotShadowMap:{value:[]},spotLightMatrix:{value:[]},pointLights:{value:[],properties:{color:{},position:{},decay:{},distance:{}}},pointLightShadows:{value:[],properties:{shadowBias:{},shadowNormalBias:{},shadowRadius:{},shadowMapSize:{},shadowCameraNear:{},shadowCameraFar:{}}},pointShadowMap:{value:[]},pointShadowMatrix:{value:[]},hemisphereLights:{value:[],properties:{direction:{},skyColor:{},groundColor:{}}},rectAreaLights:{value:[],properties:{color:{},position:{},width:{},height:{}}},ltc_1:{value:null},ltc_2:{value:null}},points:{diffuse:{value:new ot(16777215)},opacity:{value:1},size:{value:1},scale:{value:1},map:{value:null},alphaMap:{value:null},alphaMapTransform:{value:new mt},alphaTest:{value:0},uvTransform:{value:new mt}},sprite:{diffuse:{value:new ot(16777215)},opacity:{value:1},center:{value:new vt(.5,.5)},rotation:{value:0},map:{value:null},mapTransform:{value:new mt},alphaMap:{value:null},alphaMapTransform:{value:new mt},alphaTest:{value:0}}},yi={basic:{uniforms:Cn([ze.common,ze.specularmap,ze.envmap,ze.aomap,ze.lightmap,ze.fog]),vertexShader:ht.meshbasic_vert,fragmentShader:ht.meshbasic_frag},lambert:{uniforms:Cn([ze.common,ze.specularmap,ze.envmap,ze.aomap,ze.lightmap,ze.emissivemap,ze.bumpmap,ze.normalmap,ze.displacementmap,ze.fog,ze.lights,{emissive:{value:new ot(0)}}]),vertexShader:ht.meshlambert_vert,fragmentShader:ht.meshlambert_frag},phong:{uniforms:Cn([ze.common,ze.specularmap,ze.envmap,ze.aomap,ze.lightmap,ze.emissivemap,ze.bumpmap,ze.normalmap,ze.displacementmap,ze.fog,ze.lights,{emissive:{value:new ot(0)},specular:{value:new ot(1118481)},shininess:{value:30}}]),vertexShader:ht.meshphong_vert,fragmentShader:ht.meshphong_frag},standard:{uniforms:Cn([ze.common,ze.envmap,ze.aomap,ze.lightmap,ze.emissivemap,ze.bumpmap,ze.normalmap,ze.displacementmap,ze.roughnessmap,ze.metalnessmap,ze.fog,ze.lights,{emissive:{value:new ot(0)},roughness:{value:1},metalness:{value:0},envMapIntensity:{value:1}}]),vertexShader:ht.meshphysical_vert,fragmentShader:ht.meshphysical_frag},toon:{uniforms:Cn([ze.common,ze.aomap,ze.lightmap,ze.emissivemap,ze.bumpmap,ze.normalmap,ze.displacementmap,ze.gradientmap,ze.fog,ze.lights,{emissive:{value:new ot(0)}}]),vertexShader:ht.meshtoon_vert,fragmentShader:ht.meshtoon_frag},matcap:{uniforms:Cn([ze.common,ze.bumpmap,ze.normalmap,ze.displacementmap,ze.fog,{matcap:{value:null}}]),vertexShader:ht.meshmatcap_vert,fragmentShader:ht.meshmatcap_frag},points:{uniforms:Cn([ze.points,ze.fog]),vertexShader:ht.points_vert,fragmentShader:ht.points_frag},dashed:{uniforms:Cn([ze.common,ze.fog,{scale:{value:1},dashSize:{value:1},totalSize:{value:2}}]),vertexShader:ht.linedashed_vert,fragmentShader:ht.linedashed_frag},depth:{uniforms:Cn([ze.common,ze.displacementmap]),vertexShader:ht.depth_vert,fragmentShader:ht.depth_frag},normal:{uniforms:Cn([ze.common,ze.bumpmap,ze.normalmap,ze.displacementmap,{opacity:{value:1}}]),vertexShader:ht.meshnormal_vert,fragmentShader:ht.meshnormal_frag},sprite:{uniforms:Cn([ze.sprite,ze.fog]),vertexShader:ht.sprite_vert,fragmentShader:ht.sprite_frag},background:{uniforms:{uvTransform:{value:new mt},t2D:{value:null},backgroundIntensity:{value:1}},vertexShader:ht.background_vert,fragmentShader:ht.background_frag},backgroundCube:{uniforms:{envMap:{value:null},flipEnvMap:{value:-1},backgroundBlurriness:{value:0},backgroundIntensity:{value:1}},vertexShader:ht.backgroundCube_vert,fragmentShader:ht.backgroundCube_frag},cube:{uniforms:{tCube:{value:null},tFlip:{value:-1},opacity:{value:1}},vertexShader:ht.cube_vert,fragmentShader:ht.cube_frag},equirect:{uniforms:{tEquirect:{value:null}},vertexShader:ht.equirect_vert,fragmentShader:ht.equirect_frag},distanceRGBA:{uniforms:Cn([ze.common,ze.displacementmap,{referencePosition:{value:new ue},nearDistance:{value:1},farDistance:{value:1e3}}]),vertexShader:ht.distanceRGBA_vert,fragmentShader:ht.distanceRGBA_frag},shadow:{uniforms:Cn([ze.lights,ze.fog,{color:{value:new ot(0)},opacity:{value:1}}]),vertexShader:ht.shadow_vert,fragmentShader:ht.shadow_frag}};yi.physical={uniforms:Cn([yi.standard.uniforms,{clearcoat:{value:0},clearcoatMap:{value:null},clearcoatMapTransform:{value:new mt},clearcoatNormalMap:{value:null},clearcoatNormalMapTransform:{value:new mt},clearcoatNormalScale:{value:new vt(1,1)},clearcoatRoughness:{value:0},clearcoatRoughnessMap:{value:null},clearcoatRoughnessMapTransform:{value:new mt},iridescence:{value:0},iridescenceMap:{value:null},iridescenceMapTransform:{value:new mt},iridescenceIOR:{value:1.3},iridescenceThicknessMinimum:{value:100},iridescenceThicknessMaximum:{value:400},iridescenceThicknessMap:{value:null},iridescenceThicknessMapTransform:{value:new mt},sheen:{value:0},sheenColor:{value:new ot(0)},sheenColorMap:{value:null},sheenColorMapTransform:{value:new mt},sheenRoughness:{value:1},sheenRoughnessMap:{value:null},sheenRoughnessMapTransform:{value:new mt},transmission:{value:0},transmissionMap:{value:null},transmissionMapTransform:{value:new mt},transmissionSamplerSize:{value:new vt},transmissionSamplerMap:{value:null},thickness:{value:0},thicknessMap:{value:null},thicknessMapTransform:{value:new mt},attenuationDistance:{value:0},attenuationColor:{value:new ot(0)},specularColor:{value:new ot(1,1,1)},specularColorMap:{value:null},specularColorMapTransform:{value:new mt},specularIntensity:{value:1},specularIntensityMap:{value:null},specularIntensityMapTransform:{value:new mt},anisotropyVector:{value:new vt},anisotropyMap:{value:null},anisotropyMapTransform:{value:new mt}}]),vertexShader:ht.meshphysical_vert,fragmentShader:ht.meshphysical_frag};const Oc={r:0,b:0,g:0};function zSt(n,e,t,i,r,s,o){const a=new ot(0);let l=s===!0?0:1,c,d,u=null,_=0,f=null;function h(g,m){let b=!1,S=m.isScene===!0?m.background:null;S&&S.isTexture&&(S=(m.backgroundBlurriness>0?t:e).get(S)),S===null?E(a,l):S&&S.isColor&&(E(S,1),b=!0);const v=n.xr.getEnvironmentBlendMode();v==="additive"?i.buffers.color.setClear(0,0,0,1,o):v==="alpha-blend"&&i.buffers.color.setClear(0,0,0,0,o),(n.autoClear||b)&&n.clear(n.autoClearColor,n.autoClearDepth,n.autoClearStencil),S&&(S.isCubeTexture||S.mapping===ou)?(d===void 0&&(d=new An(new $r(1,1,1),new Us({name:"BackgroundCubeMaterial",uniforms:ta(yi.backgroundCube.uniforms),vertexShader:yi.backgroundCube.vertexShader,fragmentShader:yi.backgroundCube.fragmentShader,side:Ln,depthTest:!1,depthWrite:!1,fog:!1})),d.geometry.deleteAttribute("normal"),d.geometry.deleteAttribute("uv"),d.onBeforeRender=function(T,C,N){this.matrixWorld.copyPosition(N.matrixWorld)},Object.defineProperty(d.material,"envMap",{get:function(){return this.uniforms.envMap.value}}),r.update(d)),d.material.uniforms.envMap.value=S,d.material.uniforms.flipEnvMap.value=S.isCubeTexture&&S.isRenderTargetTexture===!1?-1:1,d.material.uniforms.backgroundBlurriness.value=m.backgroundBlurriness,d.material.uniforms.backgroundIntensity.value=m.backgroundIntensity,d.material.toneMapped=Nt.getTransfer(S.colorSpace)!==Gt,(u!==S||_!==S.version||f!==n.toneMapping)&&(d.material.needsUpdate=!0,u=S,_=S.version,f=n.toneMapping),d.layers.enableAll(),g.unshift(d,d.geometry,d.material,0,0,null)):S&&S.isTexture&&(c===void 0&&(c=new An(new zE(2,2),new Us({name:"BackgroundMaterial",uniforms:ta(yi.background.uniforms),vertexShader:yi.background.vertexShader,fragmentShader:yi.background.fragmentShader,side:cr,depthTest:!1,depthWrite:!1,fog:!1})),c.geometry.deleteAttribute("normal"),Object.defineProperty(c.material,"map",{get:function(){return this.uniforms.t2D.value}}),r.update(c)),c.material.uniforms.t2D.value=S,c.material.uniforms.backgroundIntensity.value=m.backgroundIntensity,c.material.toneMapped=Nt.getTransfer(S.colorSpace)!==Gt,S.matrixAutoUpdate===!0&&S.updateMatrix(),c.material.uniforms.uvTransform.value.copy(S.matrix),(u!==S||_!==S.version||f!==n.toneMapping)&&(c.material.needsUpdate=!0,u=S,_=S.version,f=n.toneMapping),c.layers.enableAll(),g.unshift(c,c.geometry,c.material,0,0,null))}function E(g,m){g.getRGB(Oc,cO(n)),i.buffers.color.setClear(Oc.r,Oc.g,Oc.b,m,o)}return{getClearColor:function(){return a},setClearColor:function(g,m=1){a.set(g),l=m,E(a,l)},getClearAlpha:function(){return l},setClearAlpha:function(g){l=g,E(a,l)},render:h}}function VSt(n,e,t,i){const r=n.getParameter(n.MAX_VERTEX_ATTRIBS),s=i.isWebGL2?null:e.get("OES_vertex_array_object"),o=i.isWebGL2||s!==null,a={},l=g(null);let c=l,d=!1;function u(I,V,z,D,Y){let K=!1;if(o){const q=E(D,z,V);c!==q&&(c=q,f(c.object)),K=m(I,D,z,Y),K&&b(I,D,z,Y)}else{const q=V.wireframe===!0;(c.geometry!==D.id||c.program!==z.id||c.wireframe!==q)&&(c.geometry=D.id,c.program=z.id,c.wireframe=q,K=!0)}Y!==null&&t.update(Y,n.ELEMENT_ARRAY_BUFFER),(K||d)&&(d=!1,x(I,V,z,D),Y!==null&&n.bindBuffer(n.ELEMENT_ARRAY_BUFFER,t.get(Y).buffer))}function _(){return i.isWebGL2?n.createVertexArray():s.createVertexArrayOES()}function f(I){return i.isWebGL2?n.bindVertexArray(I):s.bindVertexArrayOES(I)}function h(I){return i.isWebGL2?n.deleteVertexArray(I):s.deleteVertexArrayOES(I)}function E(I,V,z){const D=z.wireframe===!0;let Y=a[I.id];Y===void 0&&(Y={},a[I.id]=Y);let K=Y[V.id];K===void 0&&(K={},Y[V.id]=K);let q=K[D];return q===void 0&&(q=g(_()),K[D]=q),q}function g(I){const V=[],z=[],D=[];for(let Y=0;Y=0){const _e=Y[Z];let he=K[Z];if(he===void 0&&(Z==="instanceMatrix"&&I.instanceMatrix&&(he=I.instanceMatrix),Z==="instanceColor"&&I.instanceColor&&(he=I.instanceColor)),_e===void 0||_e.attribute!==he||he&&_e.data!==he.data)return!0;q++}return c.attributesNum!==q||c.index!==D}function b(I,V,z,D){const Y={},K=V.attributes;let q=0;const le=z.getAttributes();for(const Z in le)if(le[Z].location>=0){let _e=K[Z];_e===void 0&&(Z==="instanceMatrix"&&I.instanceMatrix&&(_e=I.instanceMatrix),Z==="instanceColor"&&I.instanceColor&&(_e=I.instanceColor));const he={};he.attribute=_e,_e&&_e.data&&(he.data=_e.data),Y[Z]=he,q++}c.attributes=Y,c.attributesNum=q,c.index=D}function S(){const I=c.newAttributes;for(let V=0,z=I.length;V=0){let J=Y[le];if(J===void 0&&(le==="instanceMatrix"&&I.instanceMatrix&&(J=I.instanceMatrix),le==="instanceColor"&&I.instanceColor&&(J=I.instanceColor)),J!==void 0){const _e=J.normalized,he=J.itemSize,ye=t.get(J);if(ye===void 0)continue;const j=ye.buffer,de=ye.type,Q=ye.bytesPerElement,fe=i.isWebGL2===!0&&(de===n.INT||de===n.UNSIGNED_INT||J.gpuType===Yw);if(J.isInterleavedBufferAttribute){const we=J.data,O=we.stride,F=J.offset;if(we.isInstancedInterleavedBuffer){for(let H=0;H0&&n.getShaderPrecisionFormat(n.FRAGMENT_SHADER,n.HIGH_FLOAT).precision>0)return"highp";N="mediump"}return N==="mediump"&&n.getShaderPrecisionFormat(n.VERTEX_SHADER,n.MEDIUM_FLOAT).precision>0&&n.getShaderPrecisionFormat(n.FRAGMENT_SHADER,n.MEDIUM_FLOAT).precision>0?"mediump":"lowp"}const o=typeof WebGL2RenderingContext<"u"&&n.constructor.name==="WebGL2RenderingContext";let a=t.precision!==void 0?t.precision:"highp";const l=s(a);l!==a&&(console.warn("THREE.WebGLRenderer:",a,"not supported, using",l,"instead."),a=l);const c=o||e.has("WEBGL_draw_buffers"),d=t.logarithmicDepthBuffer===!0,u=n.getParameter(n.MAX_TEXTURE_IMAGE_UNITS),_=n.getParameter(n.MAX_VERTEX_TEXTURE_IMAGE_UNITS),f=n.getParameter(n.MAX_TEXTURE_SIZE),h=n.getParameter(n.MAX_CUBE_MAP_TEXTURE_SIZE),E=n.getParameter(n.MAX_VERTEX_ATTRIBS),g=n.getParameter(n.MAX_VERTEX_UNIFORM_VECTORS),m=n.getParameter(n.MAX_VARYING_VECTORS),b=n.getParameter(n.MAX_FRAGMENT_UNIFORM_VECTORS),S=_>0,v=o||e.has("OES_texture_float"),T=S&&v,C=o?n.getParameter(n.MAX_SAMPLES):0;return{isWebGL2:o,drawBuffers:c,getMaxAnisotropy:r,getMaxPrecision:s,precision:a,logarithmicDepthBuffer:d,maxTextures:u,maxVertexTextures:_,maxTextureSize:f,maxCubemapSize:h,maxAttributes:E,maxVertexUniforms:g,maxVaryings:m,maxFragmentUniforms:b,vertexTextures:S,floatFragmentTextures:v,floatVertexTextures:T,maxSamples:C}}function YSt(n){const e=this;let t=null,i=0,r=!1,s=!1;const o=new _s,a=new mt,l={value:null,needsUpdate:!1};this.uniform=l,this.numPlanes=0,this.numIntersection=0,this.init=function(u,_){const f=u.length!==0||_||i!==0||r;return r=_,i=u.length,f},this.beginShadows=function(){s=!0,d(null)},this.endShadows=function(){s=!1},this.setGlobalState=function(u,_){t=d(u,_,0)},this.setState=function(u,_,f){const h=u.clippingPlanes,E=u.clipIntersection,g=u.clipShadows,m=n.get(u);if(!r||h===null||h.length===0||s&&!g)s?d(null):c();else{const b=s?0:i,S=b*4;let v=m.clippingState||null;l.value=v,v=d(h,_,S,f);for(let T=0;T!==S;++T)v[T]=t[T];m.clippingState=v,this.numIntersection=E?this.numPlanes:0,this.numPlanes+=b}};function c(){l.value!==t&&(l.value=t,l.needsUpdate=i>0),e.numPlanes=i,e.numIntersection=0}function d(u,_,f,h){const E=u!==null?u.length:0;let g=null;if(E!==0){if(g=l.value,h!==!0||g===null){const m=f+E*4,b=_.matrixWorldInverse;a.getNormalMatrix(b),(g===null||g.length0){const c=new rEt(l.height/2);return c.fromEquirectangularTexture(n,o),e.set(o,c),o.addEventListener("dispose",r),t(c.texture,o.mapping)}else return null}}return o}function r(o){const a=o.target;a.removeEventListener("dispose",r);const l=e.get(a);l!==void 0&&(e.delete(a),l.dispose())}function s(){e=new WeakMap}return{get:i,dispose:s}}class VE extends dO{constructor(e=-1,t=1,i=1,r=-1,s=.1,o=2e3){super(),this.isOrthographicCamera=!0,this.type="OrthographicCamera",this.zoom=1,this.view=null,this.left=e,this.right=t,this.top=i,this.bottom=r,this.near=s,this.far=o,this.updateProjectionMatrix()}copy(e,t){return super.copy(e,t),this.left=e.left,this.right=e.right,this.top=e.top,this.bottom=e.bottom,this.near=e.near,this.far=e.far,this.zoom=e.zoom,this.view=e.view===null?null:Object.assign({},e.view),this}setViewOffset(e,t,i,r,s,o){this.view===null&&(this.view={enabled:!0,fullWidth:1,fullHeight:1,offsetX:0,offsetY:0,width:1,height:1}),this.view.enabled=!0,this.view.fullWidth=e,this.view.fullHeight=t,this.view.offsetX=i,this.view.offsetY=r,this.view.width=s,this.view.height=o,this.updateProjectionMatrix()}clearViewOffset(){this.view!==null&&(this.view.enabled=!1),this.updateProjectionMatrix()}updateProjectionMatrix(){const e=(this.right-this.left)/(2*this.zoom),t=(this.top-this.bottom)/(2*this.zoom),i=(this.right+this.left)/2,r=(this.top+this.bottom)/2;let s=i-e,o=i+e,a=r+t,l=r-t;if(this.view!==null&&this.view.enabled){const c=(this.right-this.left)/this.view.fullWidth/this.zoom,d=(this.top-this.bottom)/this.view.fullHeight/this.zoom;s+=c*this.view.offsetX,o=s+c*this.view.width,a-=d*this.view.offsetY,l=a-d*this.view.height}this.projectionMatrix.makeOrthographic(s,o,a,l,this.near,this.far,this.coordinateSystem),this.projectionMatrixInverse.copy(this.projectionMatrix).invert()}toJSON(e){const t=super.toJSON(e);return t.object.zoom=this.zoom,t.object.left=this.left,t.object.right=this.right,t.object.top=this.top,t.object.bottom=this.bottom,t.object.near=this.near,t.object.far=this.far,this.view!==null&&(t.object.view=Object.assign({},this.view)),t}}const yo=4,SC=[.125,.215,.35,.446,.526,.582],Ss=20,Xf=new VE,yC=new ot;let Zf=null,Jf=0,em=0;const ps=(1+Math.sqrt(5))/2,fo=1/ps,vC=[new ue(1,1,1),new ue(-1,1,1),new ue(1,1,-1),new ue(-1,1,-1),new ue(0,ps,fo),new ue(0,ps,-fo),new ue(fo,0,ps),new ue(-fo,0,ps),new ue(ps,fo,0),new ue(-ps,fo,0)];class TC{constructor(e){this._renderer=e,this._pingPongRenderTarget=null,this._lodMax=0,this._cubeSize=0,this._lodPlanes=[],this._sizeLods=[],this._sigmas=[],this._blurMaterial=null,this._cubemapMaterial=null,this._equirectMaterial=null,this._compileMaterial(this._blurMaterial)}fromScene(e,t=0,i=.1,r=100){Zf=this._renderer.getRenderTarget(),Jf=this._renderer.getActiveCubeFace(),em=this._renderer.getActiveMipmapLevel(),this._setSize(256);const s=this._allocateTargets();return s.depthBuffer=!0,this._sceneToCubeUV(e,i,r,s),t>0&&this._blur(s,0,0,t),this._applyPMREM(s),this._cleanup(s),s}fromEquirectangular(e,t=null){return this._fromTexture(e,t)}fromCubemap(e,t=null){return this._fromTexture(e,t)}compileCubemapShader(){this._cubemapMaterial===null&&(this._cubemapMaterial=RC(),this._compileMaterial(this._cubemapMaterial))}compileEquirectangularShader(){this._equirectMaterial===null&&(this._equirectMaterial=CC(),this._compileMaterial(this._equirectMaterial))}dispose(){this._dispose(),this._cubemapMaterial!==null&&this._cubemapMaterial.dispose(),this._equirectMaterial!==null&&this._equirectMaterial.dispose()}_setSize(e){this._lodMax=Math.floor(Math.log2(e)),this._cubeSize=Math.pow(2,this._lodMax)}_dispose(){this._blurMaterial!==null&&this._blurMaterial.dispose(),this._pingPongRenderTarget!==null&&this._pingPongRenderTarget.dispose();for(let e=0;e2?S:0,S,S),d.setRenderTarget(r),E&&d.render(h,a),d.render(e,a)}h.geometry.dispose(),h.material.dispose(),d.toneMapping=_,d.autoClear=u,e.background=g}_textureToCubeUV(e,t){const i=this._renderer,r=e.mapping===jo||e.mapping===Qo;r?(this._cubemapMaterial===null&&(this._cubemapMaterial=RC()),this._cubemapMaterial.uniforms.flipEnvMap.value=e.isRenderTargetTexture===!1?-1:1):this._equirectMaterial===null&&(this._equirectMaterial=CC());const s=r?this._cubemapMaterial:this._equirectMaterial,o=new An(this._lodPlanes[0],s),a=s.uniforms;a.envMap.value=e;const l=this._cubeSize;Nc(t,0,0,3*l,2*l),i.setRenderTarget(t),i.render(o,Xf)}_applyPMREM(e){const t=this._renderer,i=t.autoClear;t.autoClear=!1;for(let r=1;rSs&&console.warn(`sigmaRadians, ${s}, is too large and will clip, as it requested ${g} samples when the maximum is set to ${Ss}`);const m=[];let b=0;for(let N=0;NS-yo?r-S+yo:0),C=4*(this._cubeSize-v);Nc(t,T,C,3*v,2*v),l.setRenderTarget(t),l.render(u,Xf)}}function WSt(n){const e=[],t=[],i=[];let r=n;const s=n-yo+1+SC.length;for(let o=0;on-yo?l=SC[o-n+yo-1]:o===0&&(l=0),i.push(l);const c=1/(a-2),d=-c,u=1+c,_=[d,d,u,d,u,u,d,d,u,u,d,u],f=6,h=6,E=3,g=2,m=1,b=new Float32Array(E*h*f),S=new Float32Array(g*h*f),v=new Float32Array(m*h*f);for(let C=0;C2?0:-1,y=[N,x,0,N+2/3,x,0,N+2/3,x+1,0,N,x,0,N+2/3,x+1,0,N,x+1,0];b.set(y,E*h*C),S.set(_,g*h*C);const R=[C,C,C,C,C,C];v.set(R,m*h*C)}const T=new Fi;T.setAttribute("position",new wn(b,E)),T.setAttribute("uv",new wn(S,g)),T.setAttribute("faceIndex",new wn(v,m)),e.push(T),r>yo&&r--}return{lodPlanes:e,sizeLods:t,sigmas:i}}function xC(n,e,t){const i=new Ps(n,e,t);return i.texture.mapping=ou,i.texture.name="PMREM.cubeUv",i.scissorTest=!0,i}function Nc(n,e,t,i,r){n.viewport.set(e,t,i,r),n.scissor.set(e,t,i,r)}function KSt(n,e,t){const i=new Float32Array(Ss),r=new ue(0,1,0);return new Us({name:"SphericalGaussianBlur",defines:{n:Ss,CUBEUV_TEXEL_WIDTH:1/e,CUBEUV_TEXEL_HEIGHT:1/t,CUBEUV_MAX_MIP:`${n}.0`},uniforms:{envMap:{value:null},samples:{value:1},weights:{value:i},latitudinal:{value:!1},dTheta:{value:0},mipInt:{value:0},poleAxis:{value:r}},vertexShader:HE(),fragmentShader:` precision mediump float; precision mediump int; @@ -3777,26 +3779,26 @@ void main() { gl_Position = vec4( position, 1.0 ); } - `}function YSt(n){let e=new WeakMap,t=null;function i(a){if(a&&a.isTexture){const l=a.mapping,c=l===Xm||l===Zm,d=l===jo||l===Qo;if(c||d)if(a.isRenderTargetTexture&&a.needsPMREMUpdate===!0){a.needsPMREMUpdate=!1;let u=e.get(a);return t===null&&(t=new TC(n)),u=c?t.fromEquirectangular(a,u):t.fromCubemap(a,u),e.set(a,u),u.texture}else{if(e.has(a))return e.get(a).texture;{const u=a.image;if(c&&u&&u.height>0||d&&u&&r(u)){t===null&&(t=new TC(n));const _=c?t.fromEquirectangular(a):t.fromCubemap(a);return e.set(a,_),a.addEventListener("dispose",s),_.texture}else return null}}}return a}function r(a){let l=0;const c=6;for(let d=0;de.maxTextureSize&&(P=Math.ceil(R/e.maxTextureSize),R=e.maxTextureSize);const k=new Float32Array(R*P*4*E),W=new rO(k,R,P,E);W.type=tr,W.needsUpdate=!0;const I=y*4;for(let z=0;z0)return n;const r=e*t;let s=AC[r];if(s===void 0&&(s=new Float32Array(r),AC[r]=s),e!==0){i.toArray(s,0);for(let o=1,a=0;o!==e;++o)a+=t,n[o].toArray(s,a)}return s}function nn(n,e){if(n.length!==e.length)return!1;for(let t=0,i=n.length;t0||d&&u&&r(u)){t===null&&(t=new TC(n));const _=c?t.fromEquirectangular(a):t.fromCubemap(a);return e.set(a,_),a.addEventListener("dispose",s),_.texture}else return null}}}return a}function r(a){let l=0;const c=6;for(let d=0;de.maxTextureSize&&(P=Math.ceil(R/e.maxTextureSize),R=e.maxTextureSize);const k=new Float32Array(R*P*4*E),W=new rO(k,R,P,E);W.type=tr,W.needsUpdate=!0;const I=y*4;for(let z=0;z0)return n;const r=e*t;let s=AC[r];if(s===void 0&&(s=new Float32Array(r),AC[r]=s),e!==0){i.toArray(s,0);for(let o=1,a=0;o!==e;++o)a+=t,n[o].toArray(s,a)}return s}function nn(n,e){if(n.length!==e.length)return!1;for(let t=0,i=n.length;t":" "} ${a}: ${t[o]}`)}return i.join(` -`)}function Wyt(n){const e=Nt.getPrimaries(Nt.workingColorSpace),t=Nt.getPrimaries(n);let i;switch(e===t?i="":e===Cd&&t===xd?i="LinearDisplayP3ToLinearSRGB":e===xd&&t===Cd&&(i="LinearSRGBToLinearDisplayP3"),n){case hn:case au:return[i,"LinearTransferOETF"];case Kt:case FE:return[i,"sRGBTransferOETF"];default:return console.warn("THREE.WebGLProgram: Unsupported color space:",n),[i,"LinearTransferOETF"]}}function LC(n,e,t){const i=n.getShaderParameter(e,n.COMPILE_STATUS),r=n.getShaderInfoLog(e).trim();if(i&&r==="")return"";const s=/ERROR: 0:(\d+)/.exec(r);if(s){const o=parseInt(s[1]);return t.toUpperCase()+` +`)}function Xyt(n){const e=Nt.getPrimaries(Nt.workingColorSpace),t=Nt.getPrimaries(n);let i;switch(e===t?i="":e===Cd&&t===xd?i="LinearDisplayP3ToLinearSRGB":e===xd&&t===Cd&&(i="LinearSRGBToLinearDisplayP3"),n){case hn:case au:return[i,"LinearTransferOETF"];case Kt:case FE:return[i,"sRGBTransferOETF"];default:return console.warn("THREE.WebGLProgram: Unsupported color space:",n),[i,"LinearTransferOETF"]}}function LC(n,e,t){const i=n.getShaderParameter(e,n.COMPILE_STATUS),r=n.getShaderInfoLog(e).trim();if(i&&r==="")return"";const s=/ERROR: 0:(\d+)/.exec(r);if(s){const o=parseInt(s[1]);return t.toUpperCase()+` `+r+` -`+$yt(n.getShaderSource(e),o)}else return r}function Kyt(n,e){const t=Wyt(e);return`vec4 ${n}( vec4 value ) { return ${t[0]}( ${t[1]}( value ) ); }`}function jyt(n,e){let t;switch(e){case Ymt:t="Linear";break;case $mt:t="Reinhard";break;case Wmt:t="OptimizedCineon";break;case Kmt:t="ACESFilmic";break;case jmt:t="Custom";break;default:console.warn("THREE.WebGLProgram: Unsupported toneMapping:",e),t="Linear"}return"vec3 "+n+"( vec3 color ) { return "+t+"ToneMapping( color ); }"}function Qyt(n){return[n.extensionDerivatives||n.envMapCubeUVHeight||n.bumpMap||n.normalMapTangentSpace||n.clearcoatNormalMap||n.flatShading||n.shaderID==="physical"?"#extension GL_OES_standard_derivatives : enable":"",(n.extensionFragDepth||n.logarithmicDepthBuffer)&&n.rendererExtensionFragDepth?"#extension GL_EXT_frag_depth : enable":"",n.extensionDrawBuffers&&n.rendererExtensionDrawBuffers?"#extension GL_EXT_draw_buffers : require":"",(n.extensionShaderTextureLOD||n.envMap||n.transmission)&&n.rendererExtensionShaderTextureLod?"#extension GL_EXT_shader_texture_lod : enable":""].filter($a).join(` -`)}function Xyt(n){const e=[];for(const t in n){const i=n[t];i!==!1&&e.push("#define "+t+" "+i)}return e.join(` -`)}function Zyt(n,e){const t={},i=n.getProgramParameter(e,n.ACTIVE_ATTRIBUTES);for(let r=0;r/gm;function rg(n){return n.replace(Jyt,tvt)}const evt=new Map([["encodings_fragment","colorspace_fragment"],["encodings_pars_fragment","colorspace_pars_fragment"],["output_fragment","opaque_fragment"]]);function tvt(n,e){let t=ht[e];if(t===void 0){const i=evt.get(e);if(i!==void 0)t=ht[i],console.warn('THREE.WebGLRenderer: Shader chunk "%s" has been deprecated. Use "%s" instead.',e,i);else throw new Error("Can not resolve #include <"+e+">")}return rg(t)}const nvt=/#pragma unroll_loop_start\s+for\s*\(\s*int\s+i\s*=\s*(\d+)\s*;\s*i\s*<\s*(\d+)\s*;\s*i\s*\+\+\s*\)\s*{([\s\S]+?)}\s+#pragma unroll_loop_end/g;function UC(n){return n.replace(nvt,ivt)}function ivt(n,e,t,i){let r="";for(let s=parseInt(e);s/gm;function rg(n){return n.replace(ivt,svt)}const rvt=new Map([["encodings_fragment","colorspace_fragment"],["encodings_pars_fragment","colorspace_pars_fragment"],["output_fragment","opaque_fragment"]]);function svt(n,e){let t=ht[e];if(t===void 0){const i=rvt.get(e);if(i!==void 0)t=ht[i],console.warn('THREE.WebGLRenderer: Shader chunk "%s" has been deprecated. Use "%s" instead.',e,i);else throw new Error("Can not resolve #include <"+e+">")}return rg(t)}const ovt=/#pragma unroll_loop_start\s+for\s*\(\s*int\s+i\s*=\s*(\d+)\s*;\s*i\s*<\s*(\d+)\s*;\s*i\s*\+\+\s*\)\s*{([\s\S]+?)}\s+#pragma unroll_loop_end/g;function UC(n){return n.replace(ovt,avt)}function avt(n,e,t,i){let r="";for(let s=parseInt(e);s0&&(g+=` `),m=[f,"#define SHADER_TYPE "+t.shaderType,"#define SHADER_NAME "+t.shaderName,h].filter($a).join(` `),m.length>0&&(m+=` `)):(g=[FC(t),"#define SHADER_TYPE "+t.shaderType,"#define SHADER_NAME "+t.shaderName,h,t.batching?"#define USE_BATCHING":"",t.instancing?"#define USE_INSTANCING":"",t.instancingColor?"#define USE_INSTANCING_COLOR":"",t.useFog&&t.fog?"#define USE_FOG":"",t.useFog&&t.fogExp2?"#define FOG_EXP2":"",t.map?"#define USE_MAP":"",t.envMap?"#define USE_ENVMAP":"",t.envMap?"#define "+d:"",t.lightMap?"#define USE_LIGHTMAP":"",t.aoMap?"#define USE_AOMAP":"",t.bumpMap?"#define USE_BUMPMAP":"",t.normalMap?"#define USE_NORMALMAP":"",t.normalMapObjectSpace?"#define USE_NORMALMAP_OBJECTSPACE":"",t.normalMapTangentSpace?"#define USE_NORMALMAP_TANGENTSPACE":"",t.displacementMap?"#define USE_DISPLACEMENTMAP":"",t.emissiveMap?"#define USE_EMISSIVEMAP":"",t.anisotropy?"#define USE_ANISOTROPY":"",t.anisotropyMap?"#define USE_ANISOTROPYMAP":"",t.clearcoatMap?"#define USE_CLEARCOATMAP":"",t.clearcoatRoughnessMap?"#define USE_CLEARCOAT_ROUGHNESSMAP":"",t.clearcoatNormalMap?"#define USE_CLEARCOAT_NORMALMAP":"",t.iridescenceMap?"#define USE_IRIDESCENCEMAP":"",t.iridescenceThicknessMap?"#define USE_IRIDESCENCE_THICKNESSMAP":"",t.specularMap?"#define USE_SPECULARMAP":"",t.specularColorMap?"#define USE_SPECULAR_COLORMAP":"",t.specularIntensityMap?"#define USE_SPECULAR_INTENSITYMAP":"",t.roughnessMap?"#define USE_ROUGHNESSMAP":"",t.metalnessMap?"#define USE_METALNESSMAP":"",t.alphaMap?"#define USE_ALPHAMAP":"",t.alphaHash?"#define USE_ALPHAHASH":"",t.transmission?"#define USE_TRANSMISSION":"",t.transmissionMap?"#define USE_TRANSMISSIONMAP":"",t.thicknessMap?"#define USE_THICKNESSMAP":"",t.sheenColorMap?"#define USE_SHEEN_COLORMAP":"",t.sheenRoughnessMap?"#define USE_SHEEN_ROUGHNESSMAP":"",t.mapUv?"#define MAP_UV "+t.mapUv:"",t.alphaMapUv?"#define ALPHAMAP_UV "+t.alphaMapUv:"",t.lightMapUv?"#define LIGHTMAP_UV "+t.lightMapUv:"",t.aoMapUv?"#define AOMAP_UV "+t.aoMapUv:"",t.emissiveMapUv?"#define EMISSIVEMAP_UV "+t.emissiveMapUv:"",t.bumpMapUv?"#define BUMPMAP_UV "+t.bumpMapUv:"",t.normalMapUv?"#define NORMALMAP_UV "+t.normalMapUv:"",t.displacementMapUv?"#define DISPLACEMENTMAP_UV "+t.displacementMapUv:"",t.metalnessMapUv?"#define METALNESSMAP_UV "+t.metalnessMapUv:"",t.roughnessMapUv?"#define ROUGHNESSMAP_UV "+t.roughnessMapUv:"",t.anisotropyMapUv?"#define ANISOTROPYMAP_UV "+t.anisotropyMapUv:"",t.clearcoatMapUv?"#define CLEARCOATMAP_UV "+t.clearcoatMapUv:"",t.clearcoatNormalMapUv?"#define CLEARCOAT_NORMALMAP_UV "+t.clearcoatNormalMapUv:"",t.clearcoatRoughnessMapUv?"#define CLEARCOAT_ROUGHNESSMAP_UV "+t.clearcoatRoughnessMapUv:"",t.iridescenceMapUv?"#define IRIDESCENCEMAP_UV "+t.iridescenceMapUv:"",t.iridescenceThicknessMapUv?"#define IRIDESCENCE_THICKNESSMAP_UV "+t.iridescenceThicknessMapUv:"",t.sheenColorMapUv?"#define SHEEN_COLORMAP_UV "+t.sheenColorMapUv:"",t.sheenRoughnessMapUv?"#define SHEEN_ROUGHNESSMAP_UV "+t.sheenRoughnessMapUv:"",t.specularMapUv?"#define SPECULARMAP_UV "+t.specularMapUv:"",t.specularColorMapUv?"#define SPECULAR_COLORMAP_UV "+t.specularColorMapUv:"",t.specularIntensityMapUv?"#define SPECULAR_INTENSITYMAP_UV "+t.specularIntensityMapUv:"",t.transmissionMapUv?"#define TRANSMISSIONMAP_UV "+t.transmissionMapUv:"",t.thicknessMapUv?"#define THICKNESSMAP_UV "+t.thicknessMapUv:"",t.vertexTangents&&t.flatShading===!1?"#define USE_TANGENT":"",t.vertexColors?"#define USE_COLOR":"",t.vertexAlphas?"#define USE_COLOR_ALPHA":"",t.vertexUv1s?"#define USE_UV1":"",t.vertexUv2s?"#define USE_UV2":"",t.vertexUv3s?"#define USE_UV3":"",t.pointsUvs?"#define USE_POINTS_UV":"",t.flatShading?"#define FLAT_SHADED":"",t.skinning?"#define USE_SKINNING":"",t.morphTargets?"#define USE_MORPHTARGETS":"",t.morphNormals&&t.flatShading===!1?"#define USE_MORPHNORMALS":"",t.morphColors&&t.isWebGL2?"#define USE_MORPHCOLORS":"",t.morphTargetsCount>0&&t.isWebGL2?"#define MORPHTARGETS_TEXTURE":"",t.morphTargetsCount>0&&t.isWebGL2?"#define MORPHTARGETS_TEXTURE_STRIDE "+t.morphTextureStride:"",t.morphTargetsCount>0&&t.isWebGL2?"#define MORPHTARGETS_COUNT "+t.morphTargetsCount:"",t.doubleSided?"#define DOUBLE_SIDED":"",t.flipSided?"#define FLIP_SIDED":"",t.shadowMapEnabled?"#define USE_SHADOWMAP":"",t.shadowMapEnabled?"#define "+l:"",t.sizeAttenuation?"#define USE_SIZEATTENUATION":"",t.numLightProbes>0?"#define USE_LIGHT_PROBES":"",t.useLegacyLights?"#define LEGACY_LIGHTS":"",t.logarithmicDepthBuffer?"#define USE_LOGDEPTHBUF":"",t.logarithmicDepthBuffer&&t.rendererExtensionFragDepth?"#define USE_LOGDEPTHBUF_EXT":"","uniform mat4 modelMatrix;","uniform mat4 modelViewMatrix;","uniform mat4 projectionMatrix;","uniform mat4 viewMatrix;","uniform mat3 normalMatrix;","uniform vec3 cameraPosition;","uniform bool isOrthographic;","#ifdef USE_INSTANCING"," attribute mat4 instanceMatrix;","#endif","#ifdef USE_INSTANCING_COLOR"," attribute vec3 instanceColor;","#endif","attribute vec3 position;","attribute vec3 normal;","attribute vec2 uv;","#ifdef USE_UV1"," attribute vec2 uv1;","#endif","#ifdef USE_UV2"," attribute vec2 uv2;","#endif","#ifdef USE_UV3"," attribute vec2 uv3;","#endif","#ifdef USE_TANGENT"," attribute vec4 tangent;","#endif","#if defined( USE_COLOR_ALPHA )"," attribute vec4 color;","#elif defined( USE_COLOR )"," attribute vec3 color;","#endif","#if ( defined( USE_MORPHTARGETS ) && ! defined( MORPHTARGETS_TEXTURE ) )"," attribute vec3 morphTarget0;"," attribute vec3 morphTarget1;"," attribute vec3 morphTarget2;"," attribute vec3 morphTarget3;"," #ifdef USE_MORPHNORMALS"," attribute vec3 morphNormal0;"," attribute vec3 morphNormal1;"," attribute vec3 morphNormal2;"," attribute vec3 morphNormal3;"," #else"," attribute vec3 morphTarget4;"," attribute vec3 morphTarget5;"," attribute vec3 morphTarget6;"," attribute vec3 morphTarget7;"," #endif","#endif","#ifdef USE_SKINNING"," attribute vec4 skinIndex;"," attribute vec4 skinWeight;","#endif",` `].filter($a).join(` -`),m=[f,FC(t),"#define SHADER_TYPE "+t.shaderType,"#define SHADER_NAME "+t.shaderName,h,t.useFog&&t.fog?"#define USE_FOG":"",t.useFog&&t.fogExp2?"#define FOG_EXP2":"",t.map?"#define USE_MAP":"",t.matcap?"#define USE_MATCAP":"",t.envMap?"#define USE_ENVMAP":"",t.envMap?"#define "+c:"",t.envMap?"#define "+d:"",t.envMap?"#define "+u:"",_?"#define CUBEUV_TEXEL_WIDTH "+_.texelWidth:"",_?"#define CUBEUV_TEXEL_HEIGHT "+_.texelHeight:"",_?"#define CUBEUV_MAX_MIP "+_.maxMip+".0":"",t.lightMap?"#define USE_LIGHTMAP":"",t.aoMap?"#define USE_AOMAP":"",t.bumpMap?"#define USE_BUMPMAP":"",t.normalMap?"#define USE_NORMALMAP":"",t.normalMapObjectSpace?"#define USE_NORMALMAP_OBJECTSPACE":"",t.normalMapTangentSpace?"#define USE_NORMALMAP_TANGENTSPACE":"",t.emissiveMap?"#define USE_EMISSIVEMAP":"",t.anisotropy?"#define USE_ANISOTROPY":"",t.anisotropyMap?"#define USE_ANISOTROPYMAP":"",t.clearcoat?"#define USE_CLEARCOAT":"",t.clearcoatMap?"#define USE_CLEARCOATMAP":"",t.clearcoatRoughnessMap?"#define USE_CLEARCOAT_ROUGHNESSMAP":"",t.clearcoatNormalMap?"#define USE_CLEARCOAT_NORMALMAP":"",t.iridescence?"#define USE_IRIDESCENCE":"",t.iridescenceMap?"#define USE_IRIDESCENCEMAP":"",t.iridescenceThicknessMap?"#define USE_IRIDESCENCE_THICKNESSMAP":"",t.specularMap?"#define USE_SPECULARMAP":"",t.specularColorMap?"#define USE_SPECULAR_COLORMAP":"",t.specularIntensityMap?"#define USE_SPECULAR_INTENSITYMAP":"",t.roughnessMap?"#define USE_ROUGHNESSMAP":"",t.metalnessMap?"#define USE_METALNESSMAP":"",t.alphaMap?"#define USE_ALPHAMAP":"",t.alphaTest?"#define USE_ALPHATEST":"",t.alphaHash?"#define USE_ALPHAHASH":"",t.sheen?"#define USE_SHEEN":"",t.sheenColorMap?"#define USE_SHEEN_COLORMAP":"",t.sheenRoughnessMap?"#define USE_SHEEN_ROUGHNESSMAP":"",t.transmission?"#define USE_TRANSMISSION":"",t.transmissionMap?"#define USE_TRANSMISSIONMAP":"",t.thicknessMap?"#define USE_THICKNESSMAP":"",t.vertexTangents&&t.flatShading===!1?"#define USE_TANGENT":"",t.vertexColors||t.instancingColor?"#define USE_COLOR":"",t.vertexAlphas?"#define USE_COLOR_ALPHA":"",t.vertexUv1s?"#define USE_UV1":"",t.vertexUv2s?"#define USE_UV2":"",t.vertexUv3s?"#define USE_UV3":"",t.pointsUvs?"#define USE_POINTS_UV":"",t.gradientMap?"#define USE_GRADIENTMAP":"",t.flatShading?"#define FLAT_SHADED":"",t.doubleSided?"#define DOUBLE_SIDED":"",t.flipSided?"#define FLIP_SIDED":"",t.shadowMapEnabled?"#define USE_SHADOWMAP":"",t.shadowMapEnabled?"#define "+l:"",t.premultipliedAlpha?"#define PREMULTIPLIED_ALPHA":"",t.numLightProbes>0?"#define USE_LIGHT_PROBES":"",t.useLegacyLights?"#define LEGACY_LIGHTS":"",t.decodeVideoTexture?"#define DECODE_VIDEO_TEXTURE":"",t.logarithmicDepthBuffer?"#define USE_LOGDEPTHBUF":"",t.logarithmicDepthBuffer&&t.rendererExtensionFragDepth?"#define USE_LOGDEPTHBUF_EXT":"","uniform mat4 viewMatrix;","uniform vec3 cameraPosition;","uniform bool isOrthographic;",t.toneMapping!==qr?"#define TONE_MAPPING":"",t.toneMapping!==qr?ht.tonemapping_pars_fragment:"",t.toneMapping!==qr?jyt("toneMapping",t.toneMapping):"",t.dithering?"#define DITHERING":"",t.opaque?"#define OPAQUE":"",ht.colorspace_pars_fragment,Kyt("linearToOutputTexel",t.outputColorSpace),t.useDepthPacking?"#define DEPTH_PACKING "+t.depthPacking:"",` +`),m=[f,FC(t),"#define SHADER_TYPE "+t.shaderType,"#define SHADER_NAME "+t.shaderName,h,t.useFog&&t.fog?"#define USE_FOG":"",t.useFog&&t.fogExp2?"#define FOG_EXP2":"",t.map?"#define USE_MAP":"",t.matcap?"#define USE_MATCAP":"",t.envMap?"#define USE_ENVMAP":"",t.envMap?"#define "+c:"",t.envMap?"#define "+d:"",t.envMap?"#define "+u:"",_?"#define CUBEUV_TEXEL_WIDTH "+_.texelWidth:"",_?"#define CUBEUV_TEXEL_HEIGHT "+_.texelHeight:"",_?"#define CUBEUV_MAX_MIP "+_.maxMip+".0":"",t.lightMap?"#define USE_LIGHTMAP":"",t.aoMap?"#define USE_AOMAP":"",t.bumpMap?"#define USE_BUMPMAP":"",t.normalMap?"#define USE_NORMALMAP":"",t.normalMapObjectSpace?"#define USE_NORMALMAP_OBJECTSPACE":"",t.normalMapTangentSpace?"#define USE_NORMALMAP_TANGENTSPACE":"",t.emissiveMap?"#define USE_EMISSIVEMAP":"",t.anisotropy?"#define USE_ANISOTROPY":"",t.anisotropyMap?"#define USE_ANISOTROPYMAP":"",t.clearcoat?"#define USE_CLEARCOAT":"",t.clearcoatMap?"#define USE_CLEARCOATMAP":"",t.clearcoatRoughnessMap?"#define USE_CLEARCOAT_ROUGHNESSMAP":"",t.clearcoatNormalMap?"#define USE_CLEARCOAT_NORMALMAP":"",t.iridescence?"#define USE_IRIDESCENCE":"",t.iridescenceMap?"#define USE_IRIDESCENCEMAP":"",t.iridescenceThicknessMap?"#define USE_IRIDESCENCE_THICKNESSMAP":"",t.specularMap?"#define USE_SPECULARMAP":"",t.specularColorMap?"#define USE_SPECULAR_COLORMAP":"",t.specularIntensityMap?"#define USE_SPECULAR_INTENSITYMAP":"",t.roughnessMap?"#define USE_ROUGHNESSMAP":"",t.metalnessMap?"#define USE_METALNESSMAP":"",t.alphaMap?"#define USE_ALPHAMAP":"",t.alphaTest?"#define USE_ALPHATEST":"",t.alphaHash?"#define USE_ALPHAHASH":"",t.sheen?"#define USE_SHEEN":"",t.sheenColorMap?"#define USE_SHEEN_COLORMAP":"",t.sheenRoughnessMap?"#define USE_SHEEN_ROUGHNESSMAP":"",t.transmission?"#define USE_TRANSMISSION":"",t.transmissionMap?"#define USE_TRANSMISSIONMAP":"",t.thicknessMap?"#define USE_THICKNESSMAP":"",t.vertexTangents&&t.flatShading===!1?"#define USE_TANGENT":"",t.vertexColors||t.instancingColor?"#define USE_COLOR":"",t.vertexAlphas?"#define USE_COLOR_ALPHA":"",t.vertexUv1s?"#define USE_UV1":"",t.vertexUv2s?"#define USE_UV2":"",t.vertexUv3s?"#define USE_UV3":"",t.pointsUvs?"#define USE_POINTS_UV":"",t.gradientMap?"#define USE_GRADIENTMAP":"",t.flatShading?"#define FLAT_SHADED":"",t.doubleSided?"#define DOUBLE_SIDED":"",t.flipSided?"#define FLIP_SIDED":"",t.shadowMapEnabled?"#define USE_SHADOWMAP":"",t.shadowMapEnabled?"#define "+l:"",t.premultipliedAlpha?"#define PREMULTIPLIED_ALPHA":"",t.numLightProbes>0?"#define USE_LIGHT_PROBES":"",t.useLegacyLights?"#define LEGACY_LIGHTS":"",t.decodeVideoTexture?"#define DECODE_VIDEO_TEXTURE":"",t.logarithmicDepthBuffer?"#define USE_LOGDEPTHBUF":"",t.logarithmicDepthBuffer&&t.rendererExtensionFragDepth?"#define USE_LOGDEPTHBUF_EXT":"","uniform mat4 viewMatrix;","uniform vec3 cameraPosition;","uniform bool isOrthographic;",t.toneMapping!==qr?"#define TONE_MAPPING":"",t.toneMapping!==qr?ht.tonemapping_pars_fragment:"",t.toneMapping!==qr?Jyt("toneMapping",t.toneMapping):"",t.dithering?"#define DITHERING":"",t.opaque?"#define OPAQUE":"",ht.colorspace_pars_fragment,Zyt("linearToOutputTexel",t.outputColorSpace),t.useDepthPacking?"#define DEPTH_PACKING "+t.depthPacking:"",` `].filter($a).join(` `)),o=rg(o),o=kC(o,t),o=PC(o,t),a=rg(a),a=kC(a,t),a=PC(a,t),o=UC(o),a=UC(a),t.isWebGL2&&t.isRawShaderMaterial!==!0&&(b=`#version 300 es `,g=["precision mediump sampler2DArray;","#define attribute in","#define varying out","#define texture2D texture"].join(` @@ -3807,9 +3809,9 @@ precision `+n.precision+" int;";return n.precision==="highp"?e+=` Program Info Log: `+k+` `+D+` -`+Y)}else k!==""?console.warn("THREE.WebGLProgram: Program Info Log:",k):(W===""||I==="")&&(z=!1);z&&(P.diagnostics={runnable:V,programLog:k,vertexShader:{log:W,prefix:g},fragmentShader:{log:I,prefix:m}})}r.deleteShader(T),r.deleteShader(C),x=new Xc(r,E),y=Zyt(r,E)}let x;this.getUniforms=function(){return x===void 0&&N(this),x};let y;this.getAttributes=function(){return y===void 0&&N(this),y};let R=t.rendererExtensionParallelShaderCompile===!1;return this.isReady=function(){return R===!1&&(R=r.getProgramParameter(E,qyt)),R},this.destroy=function(){i.releaseStatesOfProgram(this),r.deleteProgram(E),this.program=void 0},this.type=t.shaderType,this.name=t.shaderName,this.id=Yyt++,this.cacheKey=e,this.usedTimes=1,this.program=E,this.vertexShader=T,this.fragmentShader=C,this}let dvt=0;class uvt{constructor(){this.shaderCache=new Map,this.materialCache=new Map}update(e){const t=e.vertexShader,i=e.fragmentShader,r=this._getShaderStage(t),s=this._getShaderStage(i),o=this._getShaderCacheForMaterial(e);return o.has(r)===!1&&(o.add(r),r.usedTimes++),o.has(s)===!1&&(o.add(s),s.usedTimes++),this}remove(e){const t=this.materialCache.get(e);for(const i of t)i.usedTimes--,i.usedTimes===0&&this.shaderCache.delete(i.code);return this.materialCache.delete(e),this}getVertexShaderID(e){return this._getShaderStage(e.vertexShader).id}getFragmentShaderID(e){return this._getShaderStage(e.fragmentShader).id}dispose(){this.shaderCache.clear(),this.materialCache.clear()}_getShaderCacheForMaterial(e){const t=this.materialCache;let i=t.get(e);return i===void 0&&(i=new Set,t.set(e,i)),i}_getShaderStage(e){const t=this.shaderCache;let i=t.get(e);return i===void 0&&(i=new _vt(e),t.set(e,i)),i}}class _vt{constructor(e){this.id=dvt++,this.code=e,this.usedTimes=0}}function pvt(n,e,t,i,r,s,o){const a=new sO,l=new uvt,c=[],d=r.isWebGL2,u=r.logarithmicDepthBuffer,_=r.vertexTextures;let f=r.precision;const h={MeshDepthMaterial:"depth",MeshDistanceMaterial:"distanceRGBA",MeshNormalMaterial:"normal",MeshBasicMaterial:"basic",MeshLambertMaterial:"lambert",MeshPhongMaterial:"phong",MeshToonMaterial:"toon",MeshStandardMaterial:"physical",MeshPhysicalMaterial:"physical",MeshMatcapMaterial:"matcap",LineBasicMaterial:"basic",LineDashedMaterial:"dashed",PointsMaterial:"points",ShadowMaterial:"shadow",SpriteMaterial:"sprite"};function E(y){return y===0?"uv":`uv${y}`}function g(y,R,P,k,W){const I=k.fog,V=W.geometry,z=y.isMeshStandardMaterial?k.environment:null,D=(y.isMeshStandardMaterial?t:e).get(y.envMap||z),Y=D&&D.mapping===ou?D.image.height:null,K=h[y.type];y.precision!==null&&(f=r.getMaxPrecision(y.precision),f!==y.precision&&console.warn("THREE.WebGLProgram.getParameters:",y.precision,"not supported, using",f,"instead."));const q=V.morphAttributes.position||V.morphAttributes.normal||V.morphAttributes.color,le=q!==void 0?q.length:0;let Z=0;V.morphAttributes.position!==void 0&&(Z=1),V.morphAttributes.normal!==void 0&&(Z=2),V.morphAttributes.color!==void 0&&(Z=3);let J,_e,he,ye;if(K){const tn=yi[K];J=tn.vertexShader,_e=tn.fragmentShader}else J=y.vertexShader,_e=y.fragmentShader,l.update(y),he=l.getVertexShaderID(y),ye=l.getFragmentShaderID(y);const j=n.getRenderTarget(),de=W.isInstancedMesh===!0,Q=W.isBatchedMesh===!0,fe=!!y.map,we=!!y.matcap,O=!!D,F=!!y.aoMap,H=!!y.lightMap,se=!!y.bumpMap,te=!!y.normalMap,be=!!y.displacementMap,xe=!!y.emissiveMap,B=!!y.metalnessMap,ae=!!y.roughnessMap,ne=y.anisotropy>0,re=y.clearcoat>0,w=y.iridescence>0,A=y.sheen>0,G=y.transmission>0,ce=ne&&!!y.anisotropyMap,$=re&&!!y.clearcoatMap,ee=re&&!!y.clearcoatNormalMap,ve=re&&!!y.clearcoatRoughnessMap,Ee=w&&!!y.iridescenceMap,Ie=w&&!!y.iridescenceThicknessMap,Be=A&&!!y.sheenColorMap,et=A&&!!y.sheenRoughnessMap,Me=!!y.specularMap,tt=!!y.specularColorMap,We=!!y.specularIntensityMap,Fe=G&&!!y.transmissionMap,je=G&&!!y.thicknessMap,qe=!!y.gradientMap,lt=!!y.alphaMap,oe=y.alphaTest>0,Ve=!!y.alphaHash,De=!!y.extensions,Re=!!V.attributes.uv1,ke=!!V.attributes.uv2,it=!!V.attributes.uv3;let _t=qr;return y.toneMapped&&(j===null||j.isXRRenderTarget===!0)&&(_t=n.toneMapping),{isWebGL2:d,shaderID:K,shaderType:y.type,shaderName:y.name,vertexShader:J,fragmentShader:_e,defines:y.defines,customVertexShaderID:he,customFragmentShaderID:ye,isRawShaderMaterial:y.isRawShaderMaterial===!0,glslVersion:y.glslVersion,precision:f,batching:Q,instancing:de,instancingColor:de&&W.instanceColor!==null,supportsVertexTextures:_,outputColorSpace:j===null?n.outputColorSpace:j.isXRRenderTarget===!0?j.texture.colorSpace:hn,map:fe,matcap:we,envMap:O,envMapMode:O&&D.mapping,envMapCubeUVHeight:Y,aoMap:F,lightMap:H,bumpMap:se,normalMap:te,displacementMap:_&&be,emissiveMap:xe,normalMapObjectSpace:te&&y.normalMapType===cgt,normalMapTangentSpace:te&&y.normalMapType===UE,metalnessMap:B,roughnessMap:ae,anisotropy:ne,anisotropyMap:ce,clearcoat:re,clearcoatMap:$,clearcoatNormalMap:ee,clearcoatRoughnessMap:ve,iridescence:w,iridescenceMap:Ee,iridescenceThicknessMap:Ie,sheen:A,sheenColorMap:Be,sheenRoughnessMap:et,specularMap:Me,specularColorMap:tt,specularIntensityMap:We,transmission:G,transmissionMap:Fe,thicknessMap:je,gradientMap:qe,opaque:y.transparent===!1&&y.blending===No,alphaMap:lt,alphaTest:oe,alphaHash:Ve,combine:y.combine,mapUv:fe&&E(y.map.channel),aoMapUv:F&&E(y.aoMap.channel),lightMapUv:H&&E(y.lightMap.channel),bumpMapUv:se&&E(y.bumpMap.channel),normalMapUv:te&&E(y.normalMap.channel),displacementMapUv:be&&E(y.displacementMap.channel),emissiveMapUv:xe&&E(y.emissiveMap.channel),metalnessMapUv:B&&E(y.metalnessMap.channel),roughnessMapUv:ae&&E(y.roughnessMap.channel),anisotropyMapUv:ce&&E(y.anisotropyMap.channel),clearcoatMapUv:$&&E(y.clearcoatMap.channel),clearcoatNormalMapUv:ee&&E(y.clearcoatNormalMap.channel),clearcoatRoughnessMapUv:ve&&E(y.clearcoatRoughnessMap.channel),iridescenceMapUv:Ee&&E(y.iridescenceMap.channel),iridescenceThicknessMapUv:Ie&&E(y.iridescenceThicknessMap.channel),sheenColorMapUv:Be&&E(y.sheenColorMap.channel),sheenRoughnessMapUv:et&&E(y.sheenRoughnessMap.channel),specularMapUv:Me&&E(y.specularMap.channel),specularColorMapUv:tt&&E(y.specularColorMap.channel),specularIntensityMapUv:We&&E(y.specularIntensityMap.channel),transmissionMapUv:Fe&&E(y.transmissionMap.channel),thicknessMapUv:je&&E(y.thicknessMap.channel),alphaMapUv:lt&&E(y.alphaMap.channel),vertexTangents:!!V.attributes.tangent&&(te||ne),vertexColors:y.vertexColors,vertexAlphas:y.vertexColors===!0&&!!V.attributes.color&&V.attributes.color.itemSize===4,vertexUv1s:Re,vertexUv2s:ke,vertexUv3s:it,pointsUvs:W.isPoints===!0&&!!V.attributes.uv&&(fe||lt),fog:!!I,useFog:y.fog===!0,fogExp2:I&&I.isFogExp2,flatShading:y.flatShading===!0,sizeAttenuation:y.sizeAttenuation===!0,logarithmicDepthBuffer:u,skinning:W.isSkinnedMesh===!0,morphTargets:V.morphAttributes.position!==void 0,morphNormals:V.morphAttributes.normal!==void 0,morphColors:V.morphAttributes.color!==void 0,morphTargetsCount:le,morphTextureStride:Z,numDirLights:R.directional.length,numPointLights:R.point.length,numSpotLights:R.spot.length,numSpotLightMaps:R.spotLightMap.length,numRectAreaLights:R.rectArea.length,numHemiLights:R.hemi.length,numDirLightShadows:R.directionalShadowMap.length,numPointLightShadows:R.pointShadowMap.length,numSpotLightShadows:R.spotShadowMap.length,numSpotLightShadowsWithMaps:R.numSpotLightShadowsWithMaps,numLightProbes:R.numLightProbes,numClippingPlanes:o.numPlanes,numClipIntersection:o.numIntersection,dithering:y.dithering,shadowMapEnabled:n.shadowMap.enabled&&P.length>0,shadowMapType:n.shadowMap.type,toneMapping:_t,useLegacyLights:n._useLegacyLights,decodeVideoTexture:fe&&y.map.isVideoTexture===!0&&Nt.getTransfer(y.map.colorSpace)===Gt,premultipliedAlpha:y.premultipliedAlpha,doubleSided:y.side===xi,flipSided:y.side===Ln,useDepthPacking:y.depthPacking>=0,depthPacking:y.depthPacking||0,index0AttributeName:y.index0AttributeName,extensionDerivatives:De&&y.extensions.derivatives===!0,extensionFragDepth:De&&y.extensions.fragDepth===!0,extensionDrawBuffers:De&&y.extensions.drawBuffers===!0,extensionShaderTextureLOD:De&&y.extensions.shaderTextureLOD===!0,rendererExtensionFragDepth:d||i.has("EXT_frag_depth"),rendererExtensionDrawBuffers:d||i.has("WEBGL_draw_buffers"),rendererExtensionShaderTextureLod:d||i.has("EXT_shader_texture_lod"),rendererExtensionParallelShaderCompile:i.has("KHR_parallel_shader_compile"),customProgramCacheKey:y.customProgramCacheKey()}}function m(y){const R=[];if(y.shaderID?R.push(y.shaderID):(R.push(y.customVertexShaderID),R.push(y.customFragmentShaderID)),y.defines!==void 0)for(const P in y.defines)R.push(P),R.push(y.defines[P]);return y.isRawShaderMaterial===!1&&(b(R,y),S(R,y),R.push(n.outputColorSpace)),R.push(y.customProgramCacheKey),R.join()}function b(y,R){y.push(R.precision),y.push(R.outputColorSpace),y.push(R.envMapMode),y.push(R.envMapCubeUVHeight),y.push(R.mapUv),y.push(R.alphaMapUv),y.push(R.lightMapUv),y.push(R.aoMapUv),y.push(R.bumpMapUv),y.push(R.normalMapUv),y.push(R.displacementMapUv),y.push(R.emissiveMapUv),y.push(R.metalnessMapUv),y.push(R.roughnessMapUv),y.push(R.anisotropyMapUv),y.push(R.clearcoatMapUv),y.push(R.clearcoatNormalMapUv),y.push(R.clearcoatRoughnessMapUv),y.push(R.iridescenceMapUv),y.push(R.iridescenceThicknessMapUv),y.push(R.sheenColorMapUv),y.push(R.sheenRoughnessMapUv),y.push(R.specularMapUv),y.push(R.specularColorMapUv),y.push(R.specularIntensityMapUv),y.push(R.transmissionMapUv),y.push(R.thicknessMapUv),y.push(R.combine),y.push(R.fogExp2),y.push(R.sizeAttenuation),y.push(R.morphTargetsCount),y.push(R.morphAttributeCount),y.push(R.numDirLights),y.push(R.numPointLights),y.push(R.numSpotLights),y.push(R.numSpotLightMaps),y.push(R.numHemiLights),y.push(R.numRectAreaLights),y.push(R.numDirLightShadows),y.push(R.numPointLightShadows),y.push(R.numSpotLightShadows),y.push(R.numSpotLightShadowsWithMaps),y.push(R.numLightProbes),y.push(R.shadowMapType),y.push(R.toneMapping),y.push(R.numClippingPlanes),y.push(R.numClipIntersection),y.push(R.depthPacking)}function S(y,R){a.disableAll(),R.isWebGL2&&a.enable(0),R.supportsVertexTextures&&a.enable(1),R.instancing&&a.enable(2),R.instancingColor&&a.enable(3),R.matcap&&a.enable(4),R.envMap&&a.enable(5),R.normalMapObjectSpace&&a.enable(6),R.normalMapTangentSpace&&a.enable(7),R.clearcoat&&a.enable(8),R.iridescence&&a.enable(9),R.alphaTest&&a.enable(10),R.vertexColors&&a.enable(11),R.vertexAlphas&&a.enable(12),R.vertexUv1s&&a.enable(13),R.vertexUv2s&&a.enable(14),R.vertexUv3s&&a.enable(15),R.vertexTangents&&a.enable(16),R.anisotropy&&a.enable(17),R.alphaHash&&a.enable(18),R.batching&&a.enable(19),y.push(a.mask),a.disableAll(),R.fog&&a.enable(0),R.useFog&&a.enable(1),R.flatShading&&a.enable(2),R.logarithmicDepthBuffer&&a.enable(3),R.skinning&&a.enable(4),R.morphTargets&&a.enable(5),R.morphNormals&&a.enable(6),R.morphColors&&a.enable(7),R.premultipliedAlpha&&a.enable(8),R.shadowMapEnabled&&a.enable(9),R.useLegacyLights&&a.enable(10),R.doubleSided&&a.enable(11),R.flipSided&&a.enable(12),R.useDepthPacking&&a.enable(13),R.dithering&&a.enable(14),R.transmission&&a.enable(15),R.sheen&&a.enable(16),R.opaque&&a.enable(17),R.pointsUvs&&a.enable(18),R.decodeVideoTexture&&a.enable(19),y.push(a.mask)}function v(y){const R=h[y.type];let P;if(R){const k=yi[R];P=Qgt.clone(k.uniforms)}else P=y.uniforms;return P}function T(y,R){let P;for(let k=0,W=c.length;k0?i.push(m):f.transparent===!0?r.push(m):t.push(m)}function l(u,_,f,h,E,g){const m=o(u,_,f,h,E,g);f.transmission>0?i.unshift(m):f.transparent===!0?r.unshift(m):t.unshift(m)}function c(u,_){t.length>1&&t.sort(u||fvt),i.length>1&&i.sort(_||BC),r.length>1&&r.sort(_||BC)}function d(){for(let u=e,_=n.length;u<_;u++){const f=n[u];if(f.id===null)break;f.id=null,f.object=null,f.geometry=null,f.material=null,f.group=null}}return{opaque:t,transmissive:i,transparent:r,init:s,push:a,unshift:l,finish:d,sort:c}}function mvt(){let n=new WeakMap;function e(i,r){const s=n.get(i);let o;return s===void 0?(o=new GC,n.set(i,[o])):r>=s.length?(o=new GC,s.push(o)):o=s[r],o}function t(){n=new WeakMap}return{get:e,dispose:t}}function gvt(){const n={};return{get:function(e){if(n[e.id]!==void 0)return n[e.id];let t;switch(e.type){case"DirectionalLight":t={direction:new ue,color:new ot};break;case"SpotLight":t={position:new ue,direction:new ue,color:new ot,distance:0,coneCos:0,penumbraCos:0,decay:0};break;case"PointLight":t={position:new ue,color:new ot,distance:0,decay:0};break;case"HemisphereLight":t={direction:new ue,skyColor:new ot,groundColor:new ot};break;case"RectAreaLight":t={color:new ot,position:new ue,halfWidth:new ue,halfHeight:new ue};break}return n[e.id]=t,t}}}function Evt(){const n={};return{get:function(e){if(n[e.id]!==void 0)return n[e.id];let t;switch(e.type){case"DirectionalLight":t={shadowBias:0,shadowNormalBias:0,shadowRadius:1,shadowMapSize:new vt};break;case"SpotLight":t={shadowBias:0,shadowNormalBias:0,shadowRadius:1,shadowMapSize:new vt};break;case"PointLight":t={shadowBias:0,shadowNormalBias:0,shadowRadius:1,shadowMapSize:new vt,shadowCameraNear:1,shadowCameraFar:1e3};break}return n[e.id]=t,t}}}let bvt=0;function Svt(n,e){return(e.castShadow?2:0)-(n.castShadow?2:0)+(e.map?1:0)-(n.map?1:0)}function yvt(n,e){const t=new gvt,i=Evt(),r={version:0,hash:{directionalLength:-1,pointLength:-1,spotLength:-1,rectAreaLength:-1,hemiLength:-1,numDirectionalShadows:-1,numPointShadows:-1,numSpotShadows:-1,numSpotMaps:-1,numLightProbes:-1},ambient:[0,0,0],probe:[],directional:[],directionalShadow:[],directionalShadowMap:[],directionalShadowMatrix:[],spot:[],spotLightMap:[],spotShadow:[],spotShadowMap:[],spotLightMatrix:[],rectArea:[],rectAreaLTC1:null,rectAreaLTC2:null,point:[],pointShadow:[],pointShadowMap:[],pointShadowMatrix:[],hemi:[],numSpotLightShadowsWithMaps:0,numLightProbes:0};for(let d=0;d<9;d++)r.probe.push(new ue);const s=new ue,o=new gt,a=new gt;function l(d,u){let _=0,f=0,h=0;for(let k=0;k<9;k++)r.probe[k].set(0,0,0);let E=0,g=0,m=0,b=0,S=0,v=0,T=0,C=0,N=0,x=0,y=0;d.sort(Svt);const R=u===!0?Math.PI:1;for(let k=0,W=d.length;k0&&(e.isWebGL2||n.has("OES_texture_float_linear")===!0?(r.rectAreaLTC1=ze.LTC_FLOAT_1,r.rectAreaLTC2=ze.LTC_FLOAT_2):n.has("OES_texture_half_float_linear")===!0?(r.rectAreaLTC1=ze.LTC_HALF_1,r.rectAreaLTC2=ze.LTC_HALF_2):console.error("THREE.WebGLRenderer: Unable to use RectAreaLight. Missing WebGL extensions.")),r.ambient[0]=_,r.ambient[1]=f,r.ambient[2]=h;const P=r.hash;(P.directionalLength!==E||P.pointLength!==g||P.spotLength!==m||P.rectAreaLength!==b||P.hemiLength!==S||P.numDirectionalShadows!==v||P.numPointShadows!==T||P.numSpotShadows!==C||P.numSpotMaps!==N||P.numLightProbes!==y)&&(r.directional.length=E,r.spot.length=m,r.rectArea.length=b,r.point.length=g,r.hemi.length=S,r.directionalShadow.length=v,r.directionalShadowMap.length=v,r.pointShadow.length=T,r.pointShadowMap.length=T,r.spotShadow.length=C,r.spotShadowMap.length=C,r.directionalShadowMatrix.length=v,r.pointShadowMatrix.length=T,r.spotLightMatrix.length=C+N-x,r.spotLightMap.length=N,r.numSpotLightShadowsWithMaps=x,r.numLightProbes=y,P.directionalLength=E,P.pointLength=g,P.spotLength=m,P.rectAreaLength=b,P.hemiLength=S,P.numDirectionalShadows=v,P.numPointShadows=T,P.numSpotShadows=C,P.numSpotMaps=N,P.numLightProbes=y,r.version=bvt++)}function c(d,u){let _=0,f=0,h=0,E=0,g=0;const m=u.matrixWorldInverse;for(let b=0,S=d.length;b=a.length?(l=new zC(n,e),a.push(l)):l=a[o],l}function r(){t=new WeakMap}return{get:i,dispose:r}}class Tvt extends mi{constructor(e){super(),this.isMeshDepthMaterial=!0,this.type="MeshDepthMaterial",this.depthPacking=agt,this.map=null,this.alphaMap=null,this.displacementMap=null,this.displacementScale=1,this.displacementBias=0,this.wireframe=!1,this.wireframeLinewidth=1,this.setValues(e)}copy(e){return super.copy(e),this.depthPacking=e.depthPacking,this.map=e.map,this.alphaMap=e.alphaMap,this.displacementMap=e.displacementMap,this.displacementScale=e.displacementScale,this.displacementBias=e.displacementBias,this.wireframe=e.wireframe,this.wireframeLinewidth=e.wireframeLinewidth,this}}class xvt extends mi{constructor(e){super(),this.isMeshDistanceMaterial=!0,this.type="MeshDistanceMaterial",this.map=null,this.alphaMap=null,this.displacementMap=null,this.displacementScale=1,this.displacementBias=0,this.setValues(e)}copy(e){return super.copy(e),this.map=e.map,this.alphaMap=e.alphaMap,this.displacementMap=e.displacementMap,this.displacementScale=e.displacementScale,this.displacementBias=e.displacementBias,this}}const Cvt=`void main() { +`+Y)}else k!==""?console.warn("THREE.WebGLProgram: Program Info Log:",k):(W===""||I==="")&&(z=!1);z&&(P.diagnostics={runnable:V,programLog:k,vertexShader:{log:W,prefix:g},fragmentShader:{log:I,prefix:m}})}r.deleteShader(T),r.deleteShader(C),x=new Xc(r,E),y=nvt(r,E)}let x;this.getUniforms=function(){return x===void 0&&N(this),x};let y;this.getAttributes=function(){return y===void 0&&N(this),y};let R=t.rendererExtensionParallelShaderCompile===!1;return this.isReady=function(){return R===!1&&(R=r.getProgramParameter(E,Kyt)),R},this.destroy=function(){i.releaseStatesOfProgram(this),r.deleteProgram(E),this.program=void 0},this.type=t.shaderType,this.name=t.shaderName,this.id=jyt++,this.cacheKey=e,this.usedTimes=1,this.program=E,this.vertexShader=T,this.fragmentShader=C,this}let hvt=0;class fvt{constructor(){this.shaderCache=new Map,this.materialCache=new Map}update(e){const t=e.vertexShader,i=e.fragmentShader,r=this._getShaderStage(t),s=this._getShaderStage(i),o=this._getShaderCacheForMaterial(e);return o.has(r)===!1&&(o.add(r),r.usedTimes++),o.has(s)===!1&&(o.add(s),s.usedTimes++),this}remove(e){const t=this.materialCache.get(e);for(const i of t)i.usedTimes--,i.usedTimes===0&&this.shaderCache.delete(i.code);return this.materialCache.delete(e),this}getVertexShaderID(e){return this._getShaderStage(e.vertexShader).id}getFragmentShaderID(e){return this._getShaderStage(e.fragmentShader).id}dispose(){this.shaderCache.clear(),this.materialCache.clear()}_getShaderCacheForMaterial(e){const t=this.materialCache;let i=t.get(e);return i===void 0&&(i=new Set,t.set(e,i)),i}_getShaderStage(e){const t=this.shaderCache;let i=t.get(e);return i===void 0&&(i=new mvt(e),t.set(e,i)),i}}class mvt{constructor(e){this.id=hvt++,this.code=e,this.usedTimes=0}}function gvt(n,e,t,i,r,s,o){const a=new sO,l=new fvt,c=[],d=r.isWebGL2,u=r.logarithmicDepthBuffer,_=r.vertexTextures;let f=r.precision;const h={MeshDepthMaterial:"depth",MeshDistanceMaterial:"distanceRGBA",MeshNormalMaterial:"normal",MeshBasicMaterial:"basic",MeshLambertMaterial:"lambert",MeshPhongMaterial:"phong",MeshToonMaterial:"toon",MeshStandardMaterial:"physical",MeshPhysicalMaterial:"physical",MeshMatcapMaterial:"matcap",LineBasicMaterial:"basic",LineDashedMaterial:"dashed",PointsMaterial:"points",ShadowMaterial:"shadow",SpriteMaterial:"sprite"};function E(y){return y===0?"uv":`uv${y}`}function g(y,R,P,k,W){const I=k.fog,V=W.geometry,z=y.isMeshStandardMaterial?k.environment:null,D=(y.isMeshStandardMaterial?t:e).get(y.envMap||z),Y=D&&D.mapping===ou?D.image.height:null,K=h[y.type];y.precision!==null&&(f=r.getMaxPrecision(y.precision),f!==y.precision&&console.warn("THREE.WebGLProgram.getParameters:",y.precision,"not supported, using",f,"instead."));const q=V.morphAttributes.position||V.morphAttributes.normal||V.morphAttributes.color,le=q!==void 0?q.length:0;let Z=0;V.morphAttributes.position!==void 0&&(Z=1),V.morphAttributes.normal!==void 0&&(Z=2),V.morphAttributes.color!==void 0&&(Z=3);let J,_e,he,ye;if(K){const tn=yi[K];J=tn.vertexShader,_e=tn.fragmentShader}else J=y.vertexShader,_e=y.fragmentShader,l.update(y),he=l.getVertexShaderID(y),ye=l.getFragmentShaderID(y);const j=n.getRenderTarget(),de=W.isInstancedMesh===!0,Q=W.isBatchedMesh===!0,fe=!!y.map,we=!!y.matcap,O=!!D,F=!!y.aoMap,H=!!y.lightMap,se=!!y.bumpMap,te=!!y.normalMap,be=!!y.displacementMap,xe=!!y.emissiveMap,B=!!y.metalnessMap,ae=!!y.roughnessMap,ne=y.anisotropy>0,re=y.clearcoat>0,w=y.iridescence>0,A=y.sheen>0,G=y.transmission>0,ce=ne&&!!y.anisotropyMap,$=re&&!!y.clearcoatMap,ee=re&&!!y.clearcoatNormalMap,ve=re&&!!y.clearcoatRoughnessMap,Ee=w&&!!y.iridescenceMap,Ie=w&&!!y.iridescenceThicknessMap,Be=A&&!!y.sheenColorMap,et=A&&!!y.sheenRoughnessMap,Me=!!y.specularMap,tt=!!y.specularColorMap,We=!!y.specularIntensityMap,Fe=G&&!!y.transmissionMap,je=G&&!!y.thicknessMap,qe=!!y.gradientMap,lt=!!y.alphaMap,oe=y.alphaTest>0,Ve=!!y.alphaHash,De=!!y.extensions,Re=!!V.attributes.uv1,ke=!!V.attributes.uv2,it=!!V.attributes.uv3;let _t=qr;return y.toneMapped&&(j===null||j.isXRRenderTarget===!0)&&(_t=n.toneMapping),{isWebGL2:d,shaderID:K,shaderType:y.type,shaderName:y.name,vertexShader:J,fragmentShader:_e,defines:y.defines,customVertexShaderID:he,customFragmentShaderID:ye,isRawShaderMaterial:y.isRawShaderMaterial===!0,glslVersion:y.glslVersion,precision:f,batching:Q,instancing:de,instancingColor:de&&W.instanceColor!==null,supportsVertexTextures:_,outputColorSpace:j===null?n.outputColorSpace:j.isXRRenderTarget===!0?j.texture.colorSpace:hn,map:fe,matcap:we,envMap:O,envMapMode:O&&D.mapping,envMapCubeUVHeight:Y,aoMap:F,lightMap:H,bumpMap:se,normalMap:te,displacementMap:_&&be,emissiveMap:xe,normalMapObjectSpace:te&&y.normalMapType===pgt,normalMapTangentSpace:te&&y.normalMapType===UE,metalnessMap:B,roughnessMap:ae,anisotropy:ne,anisotropyMap:ce,clearcoat:re,clearcoatMap:$,clearcoatNormalMap:ee,clearcoatRoughnessMap:ve,iridescence:w,iridescenceMap:Ee,iridescenceThicknessMap:Ie,sheen:A,sheenColorMap:Be,sheenRoughnessMap:et,specularMap:Me,specularColorMap:tt,specularIntensityMap:We,transmission:G,transmissionMap:Fe,thicknessMap:je,gradientMap:qe,opaque:y.transparent===!1&&y.blending===No,alphaMap:lt,alphaTest:oe,alphaHash:Ve,combine:y.combine,mapUv:fe&&E(y.map.channel),aoMapUv:F&&E(y.aoMap.channel),lightMapUv:H&&E(y.lightMap.channel),bumpMapUv:se&&E(y.bumpMap.channel),normalMapUv:te&&E(y.normalMap.channel),displacementMapUv:be&&E(y.displacementMap.channel),emissiveMapUv:xe&&E(y.emissiveMap.channel),metalnessMapUv:B&&E(y.metalnessMap.channel),roughnessMapUv:ae&&E(y.roughnessMap.channel),anisotropyMapUv:ce&&E(y.anisotropyMap.channel),clearcoatMapUv:$&&E(y.clearcoatMap.channel),clearcoatNormalMapUv:ee&&E(y.clearcoatNormalMap.channel),clearcoatRoughnessMapUv:ve&&E(y.clearcoatRoughnessMap.channel),iridescenceMapUv:Ee&&E(y.iridescenceMap.channel),iridescenceThicknessMapUv:Ie&&E(y.iridescenceThicknessMap.channel),sheenColorMapUv:Be&&E(y.sheenColorMap.channel),sheenRoughnessMapUv:et&&E(y.sheenRoughnessMap.channel),specularMapUv:Me&&E(y.specularMap.channel),specularColorMapUv:tt&&E(y.specularColorMap.channel),specularIntensityMapUv:We&&E(y.specularIntensityMap.channel),transmissionMapUv:Fe&&E(y.transmissionMap.channel),thicknessMapUv:je&&E(y.thicknessMap.channel),alphaMapUv:lt&&E(y.alphaMap.channel),vertexTangents:!!V.attributes.tangent&&(te||ne),vertexColors:y.vertexColors,vertexAlphas:y.vertexColors===!0&&!!V.attributes.color&&V.attributes.color.itemSize===4,vertexUv1s:Re,vertexUv2s:ke,vertexUv3s:it,pointsUvs:W.isPoints===!0&&!!V.attributes.uv&&(fe||lt),fog:!!I,useFog:y.fog===!0,fogExp2:I&&I.isFogExp2,flatShading:y.flatShading===!0,sizeAttenuation:y.sizeAttenuation===!0,logarithmicDepthBuffer:u,skinning:W.isSkinnedMesh===!0,morphTargets:V.morphAttributes.position!==void 0,morphNormals:V.morphAttributes.normal!==void 0,morphColors:V.morphAttributes.color!==void 0,morphTargetsCount:le,morphTextureStride:Z,numDirLights:R.directional.length,numPointLights:R.point.length,numSpotLights:R.spot.length,numSpotLightMaps:R.spotLightMap.length,numRectAreaLights:R.rectArea.length,numHemiLights:R.hemi.length,numDirLightShadows:R.directionalShadowMap.length,numPointLightShadows:R.pointShadowMap.length,numSpotLightShadows:R.spotShadowMap.length,numSpotLightShadowsWithMaps:R.numSpotLightShadowsWithMaps,numLightProbes:R.numLightProbes,numClippingPlanes:o.numPlanes,numClipIntersection:o.numIntersection,dithering:y.dithering,shadowMapEnabled:n.shadowMap.enabled&&P.length>0,shadowMapType:n.shadowMap.type,toneMapping:_t,useLegacyLights:n._useLegacyLights,decodeVideoTexture:fe&&y.map.isVideoTexture===!0&&Nt.getTransfer(y.map.colorSpace)===Gt,premultipliedAlpha:y.premultipliedAlpha,doubleSided:y.side===xi,flipSided:y.side===Ln,useDepthPacking:y.depthPacking>=0,depthPacking:y.depthPacking||0,index0AttributeName:y.index0AttributeName,extensionDerivatives:De&&y.extensions.derivatives===!0,extensionFragDepth:De&&y.extensions.fragDepth===!0,extensionDrawBuffers:De&&y.extensions.drawBuffers===!0,extensionShaderTextureLOD:De&&y.extensions.shaderTextureLOD===!0,rendererExtensionFragDepth:d||i.has("EXT_frag_depth"),rendererExtensionDrawBuffers:d||i.has("WEBGL_draw_buffers"),rendererExtensionShaderTextureLod:d||i.has("EXT_shader_texture_lod"),rendererExtensionParallelShaderCompile:i.has("KHR_parallel_shader_compile"),customProgramCacheKey:y.customProgramCacheKey()}}function m(y){const R=[];if(y.shaderID?R.push(y.shaderID):(R.push(y.customVertexShaderID),R.push(y.customFragmentShaderID)),y.defines!==void 0)for(const P in y.defines)R.push(P),R.push(y.defines[P]);return y.isRawShaderMaterial===!1&&(b(R,y),S(R,y),R.push(n.outputColorSpace)),R.push(y.customProgramCacheKey),R.join()}function b(y,R){y.push(R.precision),y.push(R.outputColorSpace),y.push(R.envMapMode),y.push(R.envMapCubeUVHeight),y.push(R.mapUv),y.push(R.alphaMapUv),y.push(R.lightMapUv),y.push(R.aoMapUv),y.push(R.bumpMapUv),y.push(R.normalMapUv),y.push(R.displacementMapUv),y.push(R.emissiveMapUv),y.push(R.metalnessMapUv),y.push(R.roughnessMapUv),y.push(R.anisotropyMapUv),y.push(R.clearcoatMapUv),y.push(R.clearcoatNormalMapUv),y.push(R.clearcoatRoughnessMapUv),y.push(R.iridescenceMapUv),y.push(R.iridescenceThicknessMapUv),y.push(R.sheenColorMapUv),y.push(R.sheenRoughnessMapUv),y.push(R.specularMapUv),y.push(R.specularColorMapUv),y.push(R.specularIntensityMapUv),y.push(R.transmissionMapUv),y.push(R.thicknessMapUv),y.push(R.combine),y.push(R.fogExp2),y.push(R.sizeAttenuation),y.push(R.morphTargetsCount),y.push(R.morphAttributeCount),y.push(R.numDirLights),y.push(R.numPointLights),y.push(R.numSpotLights),y.push(R.numSpotLightMaps),y.push(R.numHemiLights),y.push(R.numRectAreaLights),y.push(R.numDirLightShadows),y.push(R.numPointLightShadows),y.push(R.numSpotLightShadows),y.push(R.numSpotLightShadowsWithMaps),y.push(R.numLightProbes),y.push(R.shadowMapType),y.push(R.toneMapping),y.push(R.numClippingPlanes),y.push(R.numClipIntersection),y.push(R.depthPacking)}function S(y,R){a.disableAll(),R.isWebGL2&&a.enable(0),R.supportsVertexTextures&&a.enable(1),R.instancing&&a.enable(2),R.instancingColor&&a.enable(3),R.matcap&&a.enable(4),R.envMap&&a.enable(5),R.normalMapObjectSpace&&a.enable(6),R.normalMapTangentSpace&&a.enable(7),R.clearcoat&&a.enable(8),R.iridescence&&a.enable(9),R.alphaTest&&a.enable(10),R.vertexColors&&a.enable(11),R.vertexAlphas&&a.enable(12),R.vertexUv1s&&a.enable(13),R.vertexUv2s&&a.enable(14),R.vertexUv3s&&a.enable(15),R.vertexTangents&&a.enable(16),R.anisotropy&&a.enable(17),R.alphaHash&&a.enable(18),R.batching&&a.enable(19),y.push(a.mask),a.disableAll(),R.fog&&a.enable(0),R.useFog&&a.enable(1),R.flatShading&&a.enable(2),R.logarithmicDepthBuffer&&a.enable(3),R.skinning&&a.enable(4),R.morphTargets&&a.enable(5),R.morphNormals&&a.enable(6),R.morphColors&&a.enable(7),R.premultipliedAlpha&&a.enable(8),R.shadowMapEnabled&&a.enable(9),R.useLegacyLights&&a.enable(10),R.doubleSided&&a.enable(11),R.flipSided&&a.enable(12),R.useDepthPacking&&a.enable(13),R.dithering&&a.enable(14),R.transmission&&a.enable(15),R.sheen&&a.enable(16),R.opaque&&a.enable(17),R.pointsUvs&&a.enable(18),R.decodeVideoTexture&&a.enable(19),y.push(a.mask)}function v(y){const R=h[y.type];let P;if(R){const k=yi[R];P=eEt.clone(k.uniforms)}else P=y.uniforms;return P}function T(y,R){let P;for(let k=0,W=c.length;k0?i.push(m):f.transparent===!0?r.push(m):t.push(m)}function l(u,_,f,h,E,g){const m=o(u,_,f,h,E,g);f.transmission>0?i.unshift(m):f.transparent===!0?r.unshift(m):t.unshift(m)}function c(u,_){t.length>1&&t.sort(u||bvt),i.length>1&&i.sort(_||BC),r.length>1&&r.sort(_||BC)}function d(){for(let u=e,_=n.length;u<_;u++){const f=n[u];if(f.id===null)break;f.id=null,f.object=null,f.geometry=null,f.material=null,f.group=null}}return{opaque:t,transmissive:i,transparent:r,init:s,push:a,unshift:l,finish:d,sort:c}}function Svt(){let n=new WeakMap;function e(i,r){const s=n.get(i);let o;return s===void 0?(o=new GC,n.set(i,[o])):r>=s.length?(o=new GC,s.push(o)):o=s[r],o}function t(){n=new WeakMap}return{get:e,dispose:t}}function yvt(){const n={};return{get:function(e){if(n[e.id]!==void 0)return n[e.id];let t;switch(e.type){case"DirectionalLight":t={direction:new ue,color:new ot};break;case"SpotLight":t={position:new ue,direction:new ue,color:new ot,distance:0,coneCos:0,penumbraCos:0,decay:0};break;case"PointLight":t={position:new ue,color:new ot,distance:0,decay:0};break;case"HemisphereLight":t={direction:new ue,skyColor:new ot,groundColor:new ot};break;case"RectAreaLight":t={color:new ot,position:new ue,halfWidth:new ue,halfHeight:new ue};break}return n[e.id]=t,t}}}function vvt(){const n={};return{get:function(e){if(n[e.id]!==void 0)return n[e.id];let t;switch(e.type){case"DirectionalLight":t={shadowBias:0,shadowNormalBias:0,shadowRadius:1,shadowMapSize:new vt};break;case"SpotLight":t={shadowBias:0,shadowNormalBias:0,shadowRadius:1,shadowMapSize:new vt};break;case"PointLight":t={shadowBias:0,shadowNormalBias:0,shadowRadius:1,shadowMapSize:new vt,shadowCameraNear:1,shadowCameraFar:1e3};break}return n[e.id]=t,t}}}let Tvt=0;function xvt(n,e){return(e.castShadow?2:0)-(n.castShadow?2:0)+(e.map?1:0)-(n.map?1:0)}function Cvt(n,e){const t=new yvt,i=vvt(),r={version:0,hash:{directionalLength:-1,pointLength:-1,spotLength:-1,rectAreaLength:-1,hemiLength:-1,numDirectionalShadows:-1,numPointShadows:-1,numSpotShadows:-1,numSpotMaps:-1,numLightProbes:-1},ambient:[0,0,0],probe:[],directional:[],directionalShadow:[],directionalShadowMap:[],directionalShadowMatrix:[],spot:[],spotLightMap:[],spotShadow:[],spotShadowMap:[],spotLightMatrix:[],rectArea:[],rectAreaLTC1:null,rectAreaLTC2:null,point:[],pointShadow:[],pointShadowMap:[],pointShadowMatrix:[],hemi:[],numSpotLightShadowsWithMaps:0,numLightProbes:0};for(let d=0;d<9;d++)r.probe.push(new ue);const s=new ue,o=new gt,a=new gt;function l(d,u){let _=0,f=0,h=0;for(let k=0;k<9;k++)r.probe[k].set(0,0,0);let E=0,g=0,m=0,b=0,S=0,v=0,T=0,C=0,N=0,x=0,y=0;d.sort(xvt);const R=u===!0?Math.PI:1;for(let k=0,W=d.length;k0&&(e.isWebGL2||n.has("OES_texture_float_linear")===!0?(r.rectAreaLTC1=ze.LTC_FLOAT_1,r.rectAreaLTC2=ze.LTC_FLOAT_2):n.has("OES_texture_half_float_linear")===!0?(r.rectAreaLTC1=ze.LTC_HALF_1,r.rectAreaLTC2=ze.LTC_HALF_2):console.error("THREE.WebGLRenderer: Unable to use RectAreaLight. Missing WebGL extensions.")),r.ambient[0]=_,r.ambient[1]=f,r.ambient[2]=h;const P=r.hash;(P.directionalLength!==E||P.pointLength!==g||P.spotLength!==m||P.rectAreaLength!==b||P.hemiLength!==S||P.numDirectionalShadows!==v||P.numPointShadows!==T||P.numSpotShadows!==C||P.numSpotMaps!==N||P.numLightProbes!==y)&&(r.directional.length=E,r.spot.length=m,r.rectArea.length=b,r.point.length=g,r.hemi.length=S,r.directionalShadow.length=v,r.directionalShadowMap.length=v,r.pointShadow.length=T,r.pointShadowMap.length=T,r.spotShadow.length=C,r.spotShadowMap.length=C,r.directionalShadowMatrix.length=v,r.pointShadowMatrix.length=T,r.spotLightMatrix.length=C+N-x,r.spotLightMap.length=N,r.numSpotLightShadowsWithMaps=x,r.numLightProbes=y,P.directionalLength=E,P.pointLength=g,P.spotLength=m,P.rectAreaLength=b,P.hemiLength=S,P.numDirectionalShadows=v,P.numPointShadows=T,P.numSpotShadows=C,P.numSpotMaps=N,P.numLightProbes=y,r.version=Tvt++)}function c(d,u){let _=0,f=0,h=0,E=0,g=0;const m=u.matrixWorldInverse;for(let b=0,S=d.length;b=a.length?(l=new zC(n,e),a.push(l)):l=a[o],l}function r(){t=new WeakMap}return{get:i,dispose:r}}class Avt extends mi{constructor(e){super(),this.isMeshDepthMaterial=!0,this.type="MeshDepthMaterial",this.depthPacking=ugt,this.map=null,this.alphaMap=null,this.displacementMap=null,this.displacementScale=1,this.displacementBias=0,this.wireframe=!1,this.wireframeLinewidth=1,this.setValues(e)}copy(e){return super.copy(e),this.depthPacking=e.depthPacking,this.map=e.map,this.alphaMap=e.alphaMap,this.displacementMap=e.displacementMap,this.displacementScale=e.displacementScale,this.displacementBias=e.displacementBias,this.wireframe=e.wireframe,this.wireframeLinewidth=e.wireframeLinewidth,this}}class wvt extends mi{constructor(e){super(),this.isMeshDistanceMaterial=!0,this.type="MeshDistanceMaterial",this.map=null,this.alphaMap=null,this.displacementMap=null,this.displacementScale=1,this.displacementBias=0,this.setValues(e)}copy(e){return super.copy(e),this.map=e.map,this.alphaMap=e.alphaMap,this.displacementMap=e.displacementMap,this.displacementScale=e.displacementScale,this.displacementBias=e.displacementBias,this}}const Ovt=`void main() { gl_Position = vec4( position, 1.0 ); -}`,Rvt=`uniform sampler2D shadow_pass; +}`,Nvt=`uniform sampler2D shadow_pass; uniform vec2 resolution; uniform float radius; #include @@ -3835,4 +3837,4 @@ void main() { squared_mean = squared_mean / samples; float std_dev = sqrt( squared_mean - mean * mean ); gl_FragColor = pack2HalfToRGBA( vec2( mean, std_dev ) ); -}`;function Avt(n,e,t){let i=new GE;const r=new vt,s=new vt,o=new Pt,a=new Tvt({depthPacking:lgt}),l=new xvt,c={},d=t.maxTextureSize,u={[cr]:Ln,[Ln]:cr,[xi]:xi},_=new Us({defines:{VSM_SAMPLES:8},uniforms:{shadow_pass:{value:null},resolution:{value:new vt},radius:{value:4}},vertexShader:Cvt,fragmentShader:Rvt}),f=_.clone();f.defines.HORIZONTAL_PASS=1;const h=new Fi;h.setAttribute("position",new wn(new Float32Array([-1,-1,.5,3,-1,.5,-1,3,.5]),3));const E=new An(h,_),g=this;this.enabled=!1,this.autoUpdate=!0,this.needsUpdate=!1,this.type=Vw;let m=this.type;this.render=function(T,C,N){if(g.enabled===!1||g.autoUpdate===!1&&g.needsUpdate===!1||T.length===0)return;const x=n.getRenderTarget(),y=n.getActiveCubeFace(),R=n.getActiveMipmapLevel(),P=n.state;P.setBlending(Hr),P.buffers.color.setClear(1,1,1,1),P.buffers.depth.setTest(!0),P.setScissorTest(!1);const k=m!==Zi&&this.type===Zi,W=m===Zi&&this.type!==Zi;for(let I=0,V=T.length;Id||r.y>d)&&(r.x>d&&(s.x=Math.floor(d/Y.x),r.x=s.x*Y.x,D.mapSize.x=s.x),r.y>d&&(s.y=Math.floor(d/Y.y),r.y=s.y*Y.y,D.mapSize.y=s.y)),D.map===null||k===!0||W===!0){const q=this.type!==Zi?{minFilter:an,magFilter:an}:{};D.map!==null&&D.map.dispose(),D.map=new Ps(r.x,r.y,q),D.map.texture.name=z.name+".shadowMap",D.camera.updateProjectionMatrix()}n.setRenderTarget(D.map),n.clear();const K=D.getViewportCount();for(let q=0;q0||C.map&&C.alphaTest>0){const P=y.uuid,k=C.uuid;let W=c[P];W===void 0&&(W={},c[P]=W);let I=W[k];I===void 0&&(I=y.clone(),W[k]=I),y=I}if(y.visible=C.visible,y.wireframe=C.wireframe,x===Zi?y.side=C.shadowSide!==null?C.shadowSide:C.side:y.side=C.shadowSide!==null?C.shadowSide:u[C.side],y.alphaMap=C.alphaMap,y.alphaTest=C.alphaTest,y.map=C.map,y.clipShadows=C.clipShadows,y.clippingPlanes=C.clippingPlanes,y.clipIntersection=C.clipIntersection,y.displacementMap=C.displacementMap,y.displacementScale=C.displacementScale,y.displacementBias=C.displacementBias,y.wireframeLinewidth=C.wireframeLinewidth,y.linewidth=C.linewidth,N.isPointLight===!0&&y.isMeshDistanceMaterial===!0){const P=n.properties.get(y);P.light=N}return y}function v(T,C,N,x,y){if(T.visible===!1)return;if(T.layers.test(C.layers)&&(T.isMesh||T.isLine||T.isPoints)&&(T.castShadow||T.receiveShadow&&y===Zi)&&(!T.frustumCulled||i.intersectsObject(T))){T.modelViewMatrix.multiplyMatrices(N.matrixWorldInverse,T.matrixWorld);const k=e.update(T),W=T.material;if(Array.isArray(W)){const I=k.groups;for(let V=0,z=I.length;V=1):q.indexOf("OpenGL ES")!==-1&&(K=parseFloat(/^OpenGL ES (\d)/.exec(q)[1]),Y=K>=2);let le=null,Z={};const J=n.getParameter(n.SCISSOR_BOX),_e=n.getParameter(n.VIEWPORT),he=new Pt().fromArray(J),ye=new Pt().fromArray(_e);function j(oe,Ve,De,Re){const ke=new Uint8Array(4),it=n.createTexture();n.bindTexture(oe,it),n.texParameteri(oe,n.TEXTURE_MIN_FILTER,n.NEAREST),n.texParameteri(oe,n.TEXTURE_MAG_FILTER,n.NEAREST);for(let _t=0;_t"u"?!1:/OculusBrowser/g.test(navigator.userAgent),h=new WeakMap;let E;const g=new WeakMap;let m=!1;try{m=typeof OffscreenCanvas<"u"&&new OffscreenCanvas(1,1).getContext("2d")!==null}catch{}function b(w,A){return m?new OffscreenCanvas(w,A):xl("canvas")}function S(w,A,G,ce){let $=1;if((w.width>ce||w.height>ce)&&($=ce/Math.max(w.width,w.height)),$<1||A===!0)if(typeof HTMLImageElement<"u"&&w instanceof HTMLImageElement||typeof HTMLCanvasElement<"u"&&w instanceof HTMLCanvasElement||typeof ImageBitmap<"u"&&w instanceof ImageBitmap){const ee=A?Ad:Math.floor,ve=ee($*w.width),Ee=ee($*w.height);E===void 0&&(E=b(ve,Ee));const Ie=G?b(ve,Ee):E;return Ie.width=ve,Ie.height=Ee,Ie.getContext("2d").drawImage(w,0,0,ve,Ee),console.warn("THREE.WebGLRenderer: Texture has been resized from ("+w.width+"x"+w.height+") to ("+ve+"x"+Ee+")."),Ie}else return"data"in w&&console.warn("THREE.WebGLRenderer: Image in DataTexture is too big ("+w.width+"x"+w.height+")."),w;return w}function v(w){return ig(w.width)&&ig(w.height)}function T(w){return a?!1:w.wrapS!==Kn||w.wrapT!==Kn||w.minFilter!==an&&w.minFilter!==Mn}function C(w,A){return w.generateMipmaps&&A&&w.minFilter!==an&&w.minFilter!==Mn}function N(w){n.generateMipmap(w)}function x(w,A,G,ce,$=!1){if(a===!1)return A;if(w!==null){if(n[w]!==void 0)return n[w];console.warn("THREE.WebGLRenderer: Attempt to use non-existing WebGL internal format '"+w+"'")}let ee=A;if(A===n.RED&&(G===n.FLOAT&&(ee=n.R32F),G===n.HALF_FLOAT&&(ee=n.R16F),G===n.UNSIGNED_BYTE&&(ee=n.R8)),A===n.RED_INTEGER&&(G===n.UNSIGNED_BYTE&&(ee=n.R8UI),G===n.UNSIGNED_SHORT&&(ee=n.R16UI),G===n.UNSIGNED_INT&&(ee=n.R32UI),G===n.BYTE&&(ee=n.R8I),G===n.SHORT&&(ee=n.R16I),G===n.INT&&(ee=n.R32I)),A===n.RG&&(G===n.FLOAT&&(ee=n.RG32F),G===n.HALF_FLOAT&&(ee=n.RG16F),G===n.UNSIGNED_BYTE&&(ee=n.RG8)),A===n.RGBA){const ve=$?Td:Nt.getTransfer(ce);G===n.FLOAT&&(ee=n.RGBA32F),G===n.HALF_FLOAT&&(ee=n.RGBA16F),G===n.UNSIGNED_BYTE&&(ee=ve===Gt?n.SRGB8_ALPHA8:n.RGBA8),G===n.UNSIGNED_SHORT_4_4_4_4&&(ee=n.RGBA4),G===n.UNSIGNED_SHORT_5_5_5_1&&(ee=n.RGB5_A1)}return(ee===n.R16F||ee===n.R32F||ee===n.RG16F||ee===n.RG32F||ee===n.RGBA16F||ee===n.RGBA32F)&&e.get("EXT_color_buffer_float"),ee}function y(w,A,G){return C(w,G)===!0||w.isFramebufferTexture&&w.minFilter!==an&&w.minFilter!==Mn?Math.log2(Math.max(A.width,A.height))+1:w.mipmaps!==void 0&&w.mipmaps.length>0?w.mipmaps.length:w.isCompressedTexture&&Array.isArray(w.image)?A.mipmaps.length:1}function R(w){return w===an||w===Jm||w===Qc?n.NEAREST:n.LINEAR}function P(w){const A=w.target;A.removeEventListener("dispose",P),W(A),A.isVideoTexture&&h.delete(A)}function k(w){const A=w.target;A.removeEventListener("dispose",k),V(A)}function W(w){const A=i.get(w);if(A.__webglInit===void 0)return;const G=w.source,ce=g.get(G);if(ce){const $=ce[A.__cacheKey];$.usedTimes--,$.usedTimes===0&&I(w),Object.keys(ce).length===0&&g.delete(G)}i.remove(w)}function I(w){const A=i.get(w);n.deleteTexture(A.__webglTexture);const G=w.source,ce=g.get(G);delete ce[A.__cacheKey],o.memory.textures--}function V(w){const A=w.texture,G=i.get(w),ce=i.get(A);if(ce.__webglTexture!==void 0&&(n.deleteTexture(ce.__webglTexture),o.memory.textures--),w.depthTexture&&w.depthTexture.dispose(),w.isWebGLCubeRenderTarget)for(let $=0;$<6;$++){if(Array.isArray(G.__webglFramebuffer[$]))for(let ee=0;ee=l&&console.warn("THREE.WebGLTextures: Trying to use "+w+" texture units while this GPU supports only "+l),z+=1,w}function K(w){const A=[];return A.push(w.wrapS),A.push(w.wrapT),A.push(w.wrapR||0),A.push(w.magFilter),A.push(w.minFilter),A.push(w.anisotropy),A.push(w.internalFormat),A.push(w.format),A.push(w.type),A.push(w.generateMipmaps),A.push(w.premultiplyAlpha),A.push(w.flipY),A.push(w.unpackAlignment),A.push(w.colorSpace),A.join()}function q(w,A){const G=i.get(w);if(w.isVideoTexture&&ne(w),w.isRenderTargetTexture===!1&&w.version>0&&G.__version!==w.version){const ce=w.image;if(ce===null)console.warn("THREE.WebGLRenderer: Texture marked for update but no image data found.");else if(ce.complete===!1)console.warn("THREE.WebGLRenderer: Texture marked for update but image is incomplete");else{Q(G,w,A);return}}t.bindTexture(n.TEXTURE_2D,G.__webglTexture,n.TEXTURE0+A)}function le(w,A){const G=i.get(w);if(w.version>0&&G.__version!==w.version){Q(G,w,A);return}t.bindTexture(n.TEXTURE_2D_ARRAY,G.__webglTexture,n.TEXTURE0+A)}function Z(w,A){const G=i.get(w);if(w.version>0&&G.__version!==w.version){Q(G,w,A);return}t.bindTexture(n.TEXTURE_3D,G.__webglTexture,n.TEXTURE0+A)}function J(w,A){const G=i.get(w);if(w.version>0&&G.__version!==w.version){fe(G,w,A);return}t.bindTexture(n.TEXTURE_CUBE_MAP,G.__webglTexture,n.TEXTURE0+A)}const _e={[Xo]:n.REPEAT,[Kn]:n.CLAMP_TO_EDGE,[vd]:n.MIRRORED_REPEAT},he={[an]:n.NEAREST,[Jm]:n.NEAREST_MIPMAP_NEAREST,[Qc]:n.NEAREST_MIPMAP_LINEAR,[Mn]:n.LINEAR,[qw]:n.LINEAR_MIPMAP_NEAREST,[ks]:n.LINEAR_MIPMAP_LINEAR},ye={[dgt]:n.NEVER,[mgt]:n.ALWAYS,[ugt]:n.LESS,[eO]:n.LEQUAL,[_gt]:n.EQUAL,[fgt]:n.GEQUAL,[pgt]:n.GREATER,[hgt]:n.NOTEQUAL};function j(w,A,G){if(G?(n.texParameteri(w,n.TEXTURE_WRAP_S,_e[A.wrapS]),n.texParameteri(w,n.TEXTURE_WRAP_T,_e[A.wrapT]),(w===n.TEXTURE_3D||w===n.TEXTURE_2D_ARRAY)&&n.texParameteri(w,n.TEXTURE_WRAP_R,_e[A.wrapR]),n.texParameteri(w,n.TEXTURE_MAG_FILTER,he[A.magFilter]),n.texParameteri(w,n.TEXTURE_MIN_FILTER,he[A.minFilter])):(n.texParameteri(w,n.TEXTURE_WRAP_S,n.CLAMP_TO_EDGE),n.texParameteri(w,n.TEXTURE_WRAP_T,n.CLAMP_TO_EDGE),(w===n.TEXTURE_3D||w===n.TEXTURE_2D_ARRAY)&&n.texParameteri(w,n.TEXTURE_WRAP_R,n.CLAMP_TO_EDGE),(A.wrapS!==Kn||A.wrapT!==Kn)&&console.warn("THREE.WebGLRenderer: Texture is not power of two. Texture.wrapS and Texture.wrapT should be set to THREE.ClampToEdgeWrapping."),n.texParameteri(w,n.TEXTURE_MAG_FILTER,R(A.magFilter)),n.texParameteri(w,n.TEXTURE_MIN_FILTER,R(A.minFilter)),A.minFilter!==an&&A.minFilter!==Mn&&console.warn("THREE.WebGLRenderer: Texture is not power of two. Texture.minFilter should be set to THREE.NearestFilter or THREE.LinearFilter.")),A.compareFunction&&(n.texParameteri(w,n.TEXTURE_COMPARE_MODE,n.COMPARE_REF_TO_TEXTURE),n.texParameteri(w,n.TEXTURE_COMPARE_FUNC,ye[A.compareFunction])),e.has("EXT_texture_filter_anisotropic")===!0){const ce=e.get("EXT_texture_filter_anisotropic");if(A.magFilter===an||A.minFilter!==Qc&&A.minFilter!==ks||A.type===tr&&e.has("OES_texture_float_linear")===!1||a===!1&&A.type===vl&&e.has("OES_texture_half_float_linear")===!1)return;(A.anisotropy>1||i.get(A).__currentAnisotropy)&&(n.texParameterf(w,ce.TEXTURE_MAX_ANISOTROPY_EXT,Math.min(A.anisotropy,r.getMaxAnisotropy())),i.get(A).__currentAnisotropy=A.anisotropy)}}function de(w,A){let G=!1;w.__webglInit===void 0&&(w.__webglInit=!0,A.addEventListener("dispose",P));const ce=A.source;let $=g.get(ce);$===void 0&&($={},g.set(ce,$));const ee=K(A);if(ee!==w.__cacheKey){$[ee]===void 0&&($[ee]={texture:n.createTexture(),usedTimes:0},o.memory.textures++,G=!0),$[ee].usedTimes++;const ve=$[w.__cacheKey];ve!==void 0&&($[w.__cacheKey].usedTimes--,ve.usedTimes===0&&I(A)),w.__cacheKey=ee,w.__webglTexture=$[ee].texture}return G}function Q(w,A,G){let ce=n.TEXTURE_2D;(A.isDataArrayTexture||A.isCompressedArrayTexture)&&(ce=n.TEXTURE_2D_ARRAY),A.isData3DTexture&&(ce=n.TEXTURE_3D);const $=de(w,A),ee=A.source;t.bindTexture(ce,w.__webglTexture,n.TEXTURE0+G);const ve=i.get(ee);if(ee.version!==ve.__version||$===!0){t.activeTexture(n.TEXTURE0+G);const Ee=Nt.getPrimaries(Nt.workingColorSpace),Ie=A.colorSpace===Qn?null:Nt.getPrimaries(A.colorSpace),Be=A.colorSpace===Qn||Ee===Ie?n.NONE:n.BROWSER_DEFAULT_WEBGL;n.pixelStorei(n.UNPACK_FLIP_Y_WEBGL,A.flipY),n.pixelStorei(n.UNPACK_PREMULTIPLY_ALPHA_WEBGL,A.premultiplyAlpha),n.pixelStorei(n.UNPACK_ALIGNMENT,A.unpackAlignment),n.pixelStorei(n.UNPACK_COLORSPACE_CONVERSION_WEBGL,Be);const et=T(A)&&v(A.image)===!1;let Me=S(A.image,et,!1,d);Me=re(A,Me);const tt=v(Me)||a,We=s.convert(A.format,A.colorSpace);let Fe=s.convert(A.type),je=x(A.internalFormat,We,Fe,A.colorSpace,A.isVideoTexture);j(ce,A,tt);let qe;const lt=A.mipmaps,oe=a&&A.isVideoTexture!==!0&&je!==Xw,Ve=ve.__version===void 0||$===!0,De=y(A,Me,tt);if(A.isDepthTexture)je=n.DEPTH_COMPONENT,a?A.type===tr?je=n.DEPTH_COMPONENT32F:A.type===Ur?je=n.DEPTH_COMPONENT24:A.type===ws?je=n.DEPTH24_STENCIL8:je=n.DEPTH_COMPONENT16:A.type===tr&&console.error("WebGLRenderer: Floating point depth texture requires WebGL2."),A.format===Os&&je===n.DEPTH_COMPONENT&&A.type!==PE&&A.type!==Ur&&(console.warn("THREE.WebGLRenderer: Use UnsignedShortType or UnsignedIntType for DepthFormat DepthTexture."),A.type=Ur,Fe=s.convert(A.type)),A.format===Zo&&je===n.DEPTH_COMPONENT&&(je=n.DEPTH_STENCIL,A.type!==ws&&(console.warn("THREE.WebGLRenderer: Use UnsignedInt248Type for DepthStencilFormat DepthTexture."),A.type=ws,Fe=s.convert(A.type))),Ve&&(oe?t.texStorage2D(n.TEXTURE_2D,1,je,Me.width,Me.height):t.texImage2D(n.TEXTURE_2D,0,je,Me.width,Me.height,0,We,Fe,null));else if(A.isDataTexture)if(lt.length>0&&tt){oe&&Ve&&t.texStorage2D(n.TEXTURE_2D,De,je,lt[0].width,lt[0].height);for(let Re=0,ke=lt.length;Re>=1,ke>>=1}}else if(lt.length>0&&tt){oe&&Ve&&t.texStorage2D(n.TEXTURE_2D,De,je,lt[0].width,lt[0].height);for(let Re=0,ke=lt.length;Re0&&Ve++,t.texStorage2D(n.TEXTURE_CUBE_MAP,Ve,qe,Me[0].width,Me[0].height));for(let Re=0;Re<6;Re++)if(et){lt?t.texSubImage2D(n.TEXTURE_CUBE_MAP_POSITIVE_X+Re,0,0,0,Me[Re].width,Me[Re].height,Fe,je,Me[Re].data):t.texImage2D(n.TEXTURE_CUBE_MAP_POSITIVE_X+Re,0,qe,Me[Re].width,Me[Re].height,0,Fe,je,Me[Re].data);for(let ke=0;ke>ee),Me=Math.max(1,A.height>>ee);$===n.TEXTURE_3D||$===n.TEXTURE_2D_ARRAY?t.texImage3D($,ee,Ie,et,Me,A.depth,0,ve,Ee,null):t.texImage2D($,ee,Ie,et,Me,0,ve,Ee,null)}t.bindFramebuffer(n.FRAMEBUFFER,w),ae(A)?_.framebufferTexture2DMultisampleEXT(n.FRAMEBUFFER,ce,$,i.get(G).__webglTexture,0,B(A)):($===n.TEXTURE_2D||$>=n.TEXTURE_CUBE_MAP_POSITIVE_X&&$<=n.TEXTURE_CUBE_MAP_NEGATIVE_Z)&&n.framebufferTexture2D(n.FRAMEBUFFER,ce,$,i.get(G).__webglTexture,ee),t.bindFramebuffer(n.FRAMEBUFFER,null)}function O(w,A,G){if(n.bindRenderbuffer(n.RENDERBUFFER,w),A.depthBuffer&&!A.stencilBuffer){let ce=a===!0?n.DEPTH_COMPONENT24:n.DEPTH_COMPONENT16;if(G||ae(A)){const $=A.depthTexture;$&&$.isDepthTexture&&($.type===tr?ce=n.DEPTH_COMPONENT32F:$.type===Ur&&(ce=n.DEPTH_COMPONENT24));const ee=B(A);ae(A)?_.renderbufferStorageMultisampleEXT(n.RENDERBUFFER,ee,ce,A.width,A.height):n.renderbufferStorageMultisample(n.RENDERBUFFER,ee,ce,A.width,A.height)}else n.renderbufferStorage(n.RENDERBUFFER,ce,A.width,A.height);n.framebufferRenderbuffer(n.FRAMEBUFFER,n.DEPTH_ATTACHMENT,n.RENDERBUFFER,w)}else if(A.depthBuffer&&A.stencilBuffer){const ce=B(A);G&&ae(A)===!1?n.renderbufferStorageMultisample(n.RENDERBUFFER,ce,n.DEPTH24_STENCIL8,A.width,A.height):ae(A)?_.renderbufferStorageMultisampleEXT(n.RENDERBUFFER,ce,n.DEPTH24_STENCIL8,A.width,A.height):n.renderbufferStorage(n.RENDERBUFFER,n.DEPTH_STENCIL,A.width,A.height),n.framebufferRenderbuffer(n.FRAMEBUFFER,n.DEPTH_STENCIL_ATTACHMENT,n.RENDERBUFFER,w)}else{const ce=A.isWebGLMultipleRenderTargets===!0?A.texture:[A.texture];for(let $=0;$0){G.__webglFramebuffer[Ee]=[];for(let Ie=0;Ie0){G.__webglFramebuffer=[];for(let Ee=0;Ee0&&ae(w)===!1){const Ee=ee?A:[A];G.__webglMultisampledFramebuffer=n.createFramebuffer(),G.__webglColorRenderbuffer=[],t.bindFramebuffer(n.FRAMEBUFFER,G.__webglMultisampledFramebuffer);for(let Ie=0;Ie0)for(let Ie=0;Ie0)for(let Ie=0;Ie0&&ae(w)===!1){const A=w.isWebGLMultipleRenderTargets?w.texture:[w.texture],G=w.width,ce=w.height;let $=n.COLOR_BUFFER_BIT;const ee=[],ve=w.stencilBuffer?n.DEPTH_STENCIL_ATTACHMENT:n.DEPTH_ATTACHMENT,Ee=i.get(w),Ie=w.isWebGLMultipleRenderTargets===!0;if(Ie)for(let Be=0;Be0&&e.has("WEBGL_multisampled_render_to_texture")===!0&&A.__useRenderToTexture!==!1}function ne(w){const A=o.render.frame;h.get(w)!==A&&(h.set(w,A),w.update())}function re(w,A){const G=w.colorSpace,ce=w.format,$=w.type;return w.isCompressedTexture===!0||w.isVideoTexture===!0||w.format===ng||G!==hn&&G!==Qn&&(Nt.getTransfer(G)===Gt?a===!1?e.has("EXT_sRGB")===!0&&ce===jn?(w.format=ng,w.minFilter=Mn,w.generateMipmaps=!1):A=nO.sRGBToLinear(A):(ce!==jn||$!==Yr)&&console.warn("THREE.WebGLTextures: sRGB encoded textures have to use RGBAFormat and UnsignedByteType."):console.error("THREE.WebGLTextures: Unsupported texture color space:",G)),A}this.allocateTextureUnit=Y,this.resetTextureUnits=D,this.setTexture2D=q,this.setTexture2DArray=le,this.setTexture3D=Z,this.setTextureCube=J,this.rebindTextures=se,this.setupRenderTarget=te,this.updateRenderTargetMipmap=be,this.updateMultisampleRenderTarget=xe,this.setupDepthRenderbuffer=H,this.setupFrameBufferTexture=we,this.useMultisampledRTT=ae}function Nvt(n,e,t){const i=t.isWebGL2;function r(s,o=Qn){let a;const l=Nt.getTransfer(o);if(s===Yr)return n.UNSIGNED_BYTE;if(s===$w)return n.UNSIGNED_SHORT_4_4_4_4;if(s===Ww)return n.UNSIGNED_SHORT_5_5_5_1;if(s===Xmt)return n.BYTE;if(s===Zmt)return n.SHORT;if(s===PE)return n.UNSIGNED_SHORT;if(s===Yw)return n.INT;if(s===Ur)return n.UNSIGNED_INT;if(s===tr)return n.FLOAT;if(s===vl)return i?n.HALF_FLOAT:(a=e.get("OES_texture_half_float"),a!==null?a.HALF_FLOAT_OES:null);if(s===Jmt)return n.ALPHA;if(s===jn)return n.RGBA;if(s===egt)return n.LUMINANCE;if(s===tgt)return n.LUMINANCE_ALPHA;if(s===Os)return n.DEPTH_COMPONENT;if(s===Zo)return n.DEPTH_STENCIL;if(s===ng)return a=e.get("EXT_sRGB"),a!==null?a.SRGB_ALPHA_EXT:null;if(s===ngt)return n.RED;if(s===Kw)return n.RED_INTEGER;if(s===igt)return n.RG;if(s===jw)return n.RG_INTEGER;if(s===Qw)return n.RGBA_INTEGER;if(s===wf||s===Of||s===Nf||s===Mf)if(l===Gt)if(a=e.get("WEBGL_compressed_texture_s3tc_srgb"),a!==null){if(s===wf)return a.COMPRESSED_SRGB_S3TC_DXT1_EXT;if(s===Of)return a.COMPRESSED_SRGB_ALPHA_S3TC_DXT1_EXT;if(s===Nf)return a.COMPRESSED_SRGB_ALPHA_S3TC_DXT3_EXT;if(s===Mf)return a.COMPRESSED_SRGB_ALPHA_S3TC_DXT5_EXT}else return null;else if(a=e.get("WEBGL_compressed_texture_s3tc"),a!==null){if(s===wf)return a.COMPRESSED_RGB_S3TC_DXT1_EXT;if(s===Of)return a.COMPRESSED_RGBA_S3TC_DXT1_EXT;if(s===Nf)return a.COMPRESSED_RGBA_S3TC_DXT3_EXT;if(s===Mf)return a.COMPRESSED_RGBA_S3TC_DXT5_EXT}else return null;if(s===Ax||s===wx||s===Ox||s===Nx)if(a=e.get("WEBGL_compressed_texture_pvrtc"),a!==null){if(s===Ax)return a.COMPRESSED_RGB_PVRTC_4BPPV1_IMG;if(s===wx)return a.COMPRESSED_RGB_PVRTC_2BPPV1_IMG;if(s===Ox)return a.COMPRESSED_RGBA_PVRTC_4BPPV1_IMG;if(s===Nx)return a.COMPRESSED_RGBA_PVRTC_2BPPV1_IMG}else return null;if(s===Xw)return a=e.get("WEBGL_compressed_texture_etc1"),a!==null?a.COMPRESSED_RGB_ETC1_WEBGL:null;if(s===Mx||s===Ix)if(a=e.get("WEBGL_compressed_texture_etc"),a!==null){if(s===Mx)return l===Gt?a.COMPRESSED_SRGB8_ETC2:a.COMPRESSED_RGB8_ETC2;if(s===Ix)return l===Gt?a.COMPRESSED_SRGB8_ALPHA8_ETC2_EAC:a.COMPRESSED_RGBA8_ETC2_EAC}else return null;if(s===Dx||s===Lx||s===kx||s===Px||s===Ux||s===Fx||s===Bx||s===Gx||s===zx||s===Vx||s===Hx||s===qx||s===Yx||s===$x)if(a=e.get("WEBGL_compressed_texture_astc"),a!==null){if(s===Dx)return l===Gt?a.COMPRESSED_SRGB8_ALPHA8_ASTC_4x4_KHR:a.COMPRESSED_RGBA_ASTC_4x4_KHR;if(s===Lx)return l===Gt?a.COMPRESSED_SRGB8_ALPHA8_ASTC_5x4_KHR:a.COMPRESSED_RGBA_ASTC_5x4_KHR;if(s===kx)return l===Gt?a.COMPRESSED_SRGB8_ALPHA8_ASTC_5x5_KHR:a.COMPRESSED_RGBA_ASTC_5x5_KHR;if(s===Px)return l===Gt?a.COMPRESSED_SRGB8_ALPHA8_ASTC_6x5_KHR:a.COMPRESSED_RGBA_ASTC_6x5_KHR;if(s===Ux)return l===Gt?a.COMPRESSED_SRGB8_ALPHA8_ASTC_6x6_KHR:a.COMPRESSED_RGBA_ASTC_6x6_KHR;if(s===Fx)return l===Gt?a.COMPRESSED_SRGB8_ALPHA8_ASTC_8x5_KHR:a.COMPRESSED_RGBA_ASTC_8x5_KHR;if(s===Bx)return l===Gt?a.COMPRESSED_SRGB8_ALPHA8_ASTC_8x6_KHR:a.COMPRESSED_RGBA_ASTC_8x6_KHR;if(s===Gx)return l===Gt?a.COMPRESSED_SRGB8_ALPHA8_ASTC_8x8_KHR:a.COMPRESSED_RGBA_ASTC_8x8_KHR;if(s===zx)return l===Gt?a.COMPRESSED_SRGB8_ALPHA8_ASTC_10x5_KHR:a.COMPRESSED_RGBA_ASTC_10x5_KHR;if(s===Vx)return l===Gt?a.COMPRESSED_SRGB8_ALPHA8_ASTC_10x6_KHR:a.COMPRESSED_RGBA_ASTC_10x6_KHR;if(s===Hx)return l===Gt?a.COMPRESSED_SRGB8_ALPHA8_ASTC_10x8_KHR:a.COMPRESSED_RGBA_ASTC_10x8_KHR;if(s===qx)return l===Gt?a.COMPRESSED_SRGB8_ALPHA8_ASTC_10x10_KHR:a.COMPRESSED_RGBA_ASTC_10x10_KHR;if(s===Yx)return l===Gt?a.COMPRESSED_SRGB8_ALPHA8_ASTC_12x10_KHR:a.COMPRESSED_RGBA_ASTC_12x10_KHR;if(s===$x)return l===Gt?a.COMPRESSED_SRGB8_ALPHA8_ASTC_12x12_KHR:a.COMPRESSED_RGBA_ASTC_12x12_KHR}else return null;if(s===If||s===Wx||s===Kx)if(a=e.get("EXT_texture_compression_bptc"),a!==null){if(s===If)return l===Gt?a.COMPRESSED_SRGB_ALPHA_BPTC_UNORM_EXT:a.COMPRESSED_RGBA_BPTC_UNORM_EXT;if(s===Wx)return a.COMPRESSED_RGB_BPTC_SIGNED_FLOAT_EXT;if(s===Kx)return a.COMPRESSED_RGB_BPTC_UNSIGNED_FLOAT_EXT}else return null;if(s===rgt||s===jx||s===Qx||s===Xx)if(a=e.get("EXT_texture_compression_rgtc"),a!==null){if(s===If)return a.COMPRESSED_RED_RGTC1_EXT;if(s===jx)return a.COMPRESSED_SIGNED_RED_RGTC1_EXT;if(s===Qx)return a.COMPRESSED_RED_GREEN_RGTC2_EXT;if(s===Xx)return a.COMPRESSED_SIGNED_RED_GREEN_RGTC2_EXT}else return null;return s===ws?i?n.UNSIGNED_INT_24_8:(a=e.get("WEBGL_depth_texture"),a!==null?a.UNSIGNED_INT_24_8_WEBGL:null):n[s]!==void 0?n[s]:null}return{convert:r}}class Mvt extends Rn{constructor(e=[]){super(),this.isArrayCamera=!0,this.cameras=e}}class Ts extends Yt{constructor(){super(),this.isGroup=!0,this.type="Group"}}const Ivt={type:"move"};class nm{constructor(){this._targetRay=null,this._grip=null,this._hand=null}getHandSpace(){return this._hand===null&&(this._hand=new Ts,this._hand.matrixAutoUpdate=!1,this._hand.visible=!1,this._hand.joints={},this._hand.inputState={pinching:!1}),this._hand}getTargetRaySpace(){return this._targetRay===null&&(this._targetRay=new Ts,this._targetRay.matrixAutoUpdate=!1,this._targetRay.visible=!1,this._targetRay.hasLinearVelocity=!1,this._targetRay.linearVelocity=new ue,this._targetRay.hasAngularVelocity=!1,this._targetRay.angularVelocity=new ue),this._targetRay}getGripSpace(){return this._grip===null&&(this._grip=new Ts,this._grip.matrixAutoUpdate=!1,this._grip.visible=!1,this._grip.hasLinearVelocity=!1,this._grip.linearVelocity=new ue,this._grip.hasAngularVelocity=!1,this._grip.angularVelocity=new ue),this._grip}dispatchEvent(e){return this._targetRay!==null&&this._targetRay.dispatchEvent(e),this._grip!==null&&this._grip.dispatchEvent(e),this._hand!==null&&this._hand.dispatchEvent(e),this}connect(e){if(e&&e.hand){const t=this._hand;if(t)for(const i of e.hand.values())this._getHandJoint(t,i)}return this.dispatchEvent({type:"connected",data:e}),this}disconnect(e){return this.dispatchEvent({type:"disconnected",data:e}),this._targetRay!==null&&(this._targetRay.visible=!1),this._grip!==null&&(this._grip.visible=!1),this._hand!==null&&(this._hand.visible=!1),this}update(e,t,i){let r=null,s=null,o=null;const a=this._targetRay,l=this._grip,c=this._hand;if(e&&t.session.visibilityState!=="visible-blurred"){if(c&&e.hand){o=!0;for(const E of e.hand.values()){const g=t.getJointPose(E,i),m=this._getHandJoint(c,E);g!==null&&(m.matrix.fromArray(g.transform.matrix),m.matrix.decompose(m.position,m.rotation,m.scale),m.matrixWorldNeedsUpdate=!0,m.jointRadius=g.radius),m.visible=g!==null}const d=c.joints["index-finger-tip"],u=c.joints["thumb-tip"],_=d.position.distanceTo(u.position),f=.02,h=.005;c.inputState.pinching&&_>f+h?(c.inputState.pinching=!1,this.dispatchEvent({type:"pinchend",handedness:e.handedness,target:this})):!c.inputState.pinching&&_<=f-h&&(c.inputState.pinching=!0,this.dispatchEvent({type:"pinchstart",handedness:e.handedness,target:this}))}else l!==null&&e.gripSpace&&(s=t.getPose(e.gripSpace,i),s!==null&&(l.matrix.fromArray(s.transform.matrix),l.matrix.decompose(l.position,l.rotation,l.scale),l.matrixWorldNeedsUpdate=!0,s.linearVelocity?(l.hasLinearVelocity=!0,l.linearVelocity.copy(s.linearVelocity)):l.hasLinearVelocity=!1,s.angularVelocity?(l.hasAngularVelocity=!0,l.angularVelocity.copy(s.angularVelocity)):l.hasAngularVelocity=!1));a!==null&&(r=t.getPose(e.targetRaySpace,i),r===null&&s!==null&&(r=s),r!==null&&(a.matrix.fromArray(r.transform.matrix),a.matrix.decompose(a.position,a.rotation,a.scale),a.matrixWorldNeedsUpdate=!0,r.linearVelocity?(a.hasLinearVelocity=!0,a.linearVelocity.copy(r.linearVelocity)):a.hasLinearVelocity=!1,r.angularVelocity?(a.hasAngularVelocity=!0,a.angularVelocity.copy(r.angularVelocity)):a.hasAngularVelocity=!1,this.dispatchEvent(Ivt)))}return a!==null&&(a.visible=r!==null),l!==null&&(l.visible=s!==null),c!==null&&(c.visible=o!==null),this}_getHandJoint(e,t){if(e.joints[t.jointName]===void 0){const i=new Ts;i.matrixAutoUpdate=!1,i.visible=!1,e.joints[t.jointName]=i,e.add(i)}return e.joints[t.jointName]}}class Dvt extends fa{constructor(e,t){super();const i=this;let r=null,s=1,o=null,a="local-floor",l=1,c=null,d=null,u=null,_=null,f=null,h=null;const E=t.getContextAttributes();let g=null,m=null;const b=[],S=[],v=new vt;let T=null;const C=new Rn;C.layers.enable(1),C.viewport=new Pt;const N=new Rn;N.layers.enable(2),N.viewport=new Pt;const x=[C,N],y=new Mvt;y.layers.enable(1),y.layers.enable(2);let R=null,P=null;this.cameraAutoUpdate=!0,this.enabled=!1,this.isPresenting=!1,this.getController=function(J){let _e=b[J];return _e===void 0&&(_e=new nm,b[J]=_e),_e.getTargetRaySpace()},this.getControllerGrip=function(J){let _e=b[J];return _e===void 0&&(_e=new nm,b[J]=_e),_e.getGripSpace()},this.getHand=function(J){let _e=b[J];return _e===void 0&&(_e=new nm,b[J]=_e),_e.getHandSpace()};function k(J){const _e=S.indexOf(J.inputSource);if(_e===-1)return;const he=b[_e];he!==void 0&&(he.update(J.inputSource,J.frame,c||o),he.dispatchEvent({type:J.type,data:J.inputSource}))}function W(){r.removeEventListener("select",k),r.removeEventListener("selectstart",k),r.removeEventListener("selectend",k),r.removeEventListener("squeeze",k),r.removeEventListener("squeezestart",k),r.removeEventListener("squeezeend",k),r.removeEventListener("end",W),r.removeEventListener("inputsourceschange",I);for(let J=0;J=0&&(S[ye]=null,b[ye].disconnect(he))}for(let _e=0;_e=S.length){S.push(he),ye=de;break}else if(S[de]===null){S[de]=he,ye=de;break}if(ye===-1)break}const j=b[ye];j&&j.connect(he)}}const V=new ue,z=new ue;function D(J,_e,he){V.setFromMatrixPosition(_e.matrixWorld),z.setFromMatrixPosition(he.matrixWorld);const ye=V.distanceTo(z),j=_e.projectionMatrix.elements,de=he.projectionMatrix.elements,Q=j[14]/(j[10]-1),fe=j[14]/(j[10]+1),we=(j[9]+1)/j[5],O=(j[9]-1)/j[5],F=(j[8]-1)/j[0],H=(de[8]+1)/de[0],se=Q*F,te=Q*H,be=ye/(-F+H),xe=be*-F;_e.matrixWorld.decompose(J.position,J.quaternion,J.scale),J.translateX(xe),J.translateZ(be),J.matrixWorld.compose(J.position,J.quaternion,J.scale),J.matrixWorldInverse.copy(J.matrixWorld).invert();const B=Q+be,ae=fe+be,ne=se-xe,re=te+(ye-xe),w=we*fe/ae*B,A=O*fe/ae*B;J.projectionMatrix.makePerspective(ne,re,w,A,B,ae),J.projectionMatrixInverse.copy(J.projectionMatrix).invert()}function Y(J,_e){_e===null?J.matrixWorld.copy(J.matrix):J.matrixWorld.multiplyMatrices(_e.matrixWorld,J.matrix),J.matrixWorldInverse.copy(J.matrixWorld).invert()}this.updateCamera=function(J){if(r===null)return;y.near=N.near=C.near=J.near,y.far=N.far=C.far=J.far,(R!==y.near||P!==y.far)&&(r.updateRenderState({depthNear:y.near,depthFar:y.far}),R=y.near,P=y.far);const _e=J.parent,he=y.cameras;Y(y,_e);for(let ye=0;ye0&&(g.alphaTest.value=m.alphaTest);const b=e.get(m).envMap;if(b&&(g.envMap.value=b,g.flipEnvMap.value=b.isCubeTexture&&b.isRenderTargetTexture===!1?-1:1,g.reflectivity.value=m.reflectivity,g.ior.value=m.ior,g.refractionRatio.value=m.refractionRatio),m.lightMap){g.lightMap.value=m.lightMap;const S=n._useLegacyLights===!0?Math.PI:1;g.lightMapIntensity.value=m.lightMapIntensity*S,t(m.lightMap,g.lightMapTransform)}m.aoMap&&(g.aoMap.value=m.aoMap,g.aoMapIntensity.value=m.aoMapIntensity,t(m.aoMap,g.aoMapTransform))}function o(g,m){g.diffuse.value.copy(m.color),g.opacity.value=m.opacity,m.map&&(g.map.value=m.map,t(m.map,g.mapTransform))}function a(g,m){g.dashSize.value=m.dashSize,g.totalSize.value=m.dashSize+m.gapSize,g.scale.value=m.scale}function l(g,m,b,S){g.diffuse.value.copy(m.color),g.opacity.value=m.opacity,g.size.value=m.size*b,g.scale.value=S*.5,m.map&&(g.map.value=m.map,t(m.map,g.uvTransform)),m.alphaMap&&(g.alphaMap.value=m.alphaMap,t(m.alphaMap,g.alphaMapTransform)),m.alphaTest>0&&(g.alphaTest.value=m.alphaTest)}function c(g,m){g.diffuse.value.copy(m.color),g.opacity.value=m.opacity,g.rotation.value=m.rotation,m.map&&(g.map.value=m.map,t(m.map,g.mapTransform)),m.alphaMap&&(g.alphaMap.value=m.alphaMap,t(m.alphaMap,g.alphaMapTransform)),m.alphaTest>0&&(g.alphaTest.value=m.alphaTest)}function d(g,m){g.specular.value.copy(m.specular),g.shininess.value=Math.max(m.shininess,1e-4)}function u(g,m){m.gradientMap&&(g.gradientMap.value=m.gradientMap)}function _(g,m){g.metalness.value=m.metalness,m.metalnessMap&&(g.metalnessMap.value=m.metalnessMap,t(m.metalnessMap,g.metalnessMapTransform)),g.roughness.value=m.roughness,m.roughnessMap&&(g.roughnessMap.value=m.roughnessMap,t(m.roughnessMap,g.roughnessMapTransform)),e.get(m).envMap&&(g.envMapIntensity.value=m.envMapIntensity)}function f(g,m,b){g.ior.value=m.ior,m.sheen>0&&(g.sheenColor.value.copy(m.sheenColor).multiplyScalar(m.sheen),g.sheenRoughness.value=m.sheenRoughness,m.sheenColorMap&&(g.sheenColorMap.value=m.sheenColorMap,t(m.sheenColorMap,g.sheenColorMapTransform)),m.sheenRoughnessMap&&(g.sheenRoughnessMap.value=m.sheenRoughnessMap,t(m.sheenRoughnessMap,g.sheenRoughnessMapTransform))),m.clearcoat>0&&(g.clearcoat.value=m.clearcoat,g.clearcoatRoughness.value=m.clearcoatRoughness,m.clearcoatMap&&(g.clearcoatMap.value=m.clearcoatMap,t(m.clearcoatMap,g.clearcoatMapTransform)),m.clearcoatRoughnessMap&&(g.clearcoatRoughnessMap.value=m.clearcoatRoughnessMap,t(m.clearcoatRoughnessMap,g.clearcoatRoughnessMapTransform)),m.clearcoatNormalMap&&(g.clearcoatNormalMap.value=m.clearcoatNormalMap,t(m.clearcoatNormalMap,g.clearcoatNormalMapTransform),g.clearcoatNormalScale.value.copy(m.clearcoatNormalScale),m.side===Ln&&g.clearcoatNormalScale.value.negate())),m.iridescence>0&&(g.iridescence.value=m.iridescence,g.iridescenceIOR.value=m.iridescenceIOR,g.iridescenceThicknessMinimum.value=m.iridescenceThicknessRange[0],g.iridescenceThicknessMaximum.value=m.iridescenceThicknessRange[1],m.iridescenceMap&&(g.iridescenceMap.value=m.iridescenceMap,t(m.iridescenceMap,g.iridescenceMapTransform)),m.iridescenceThicknessMap&&(g.iridescenceThicknessMap.value=m.iridescenceThicknessMap,t(m.iridescenceThicknessMap,g.iridescenceThicknessMapTransform))),m.transmission>0&&(g.transmission.value=m.transmission,g.transmissionSamplerMap.value=b.texture,g.transmissionSamplerSize.value.set(b.width,b.height),m.transmissionMap&&(g.transmissionMap.value=m.transmissionMap,t(m.transmissionMap,g.transmissionMapTransform)),g.thickness.value=m.thickness,m.thicknessMap&&(g.thicknessMap.value=m.thicknessMap,t(m.thicknessMap,g.thicknessMapTransform)),g.attenuationDistance.value=m.attenuationDistance,g.attenuationColor.value.copy(m.attenuationColor)),m.anisotropy>0&&(g.anisotropyVector.value.set(m.anisotropy*Math.cos(m.anisotropyRotation),m.anisotropy*Math.sin(m.anisotropyRotation)),m.anisotropyMap&&(g.anisotropyMap.value=m.anisotropyMap,t(m.anisotropyMap,g.anisotropyMapTransform))),g.specularIntensity.value=m.specularIntensity,g.specularColor.value.copy(m.specularColor),m.specularColorMap&&(g.specularColorMap.value=m.specularColorMap,t(m.specularColorMap,g.specularColorMapTransform)),m.specularIntensityMap&&(g.specularIntensityMap.value=m.specularIntensityMap,t(m.specularIntensityMap,g.specularIntensityMapTransform))}function h(g,m){m.matcap&&(g.matcap.value=m.matcap)}function E(g,m){const b=e.get(m).light;g.referencePosition.value.setFromMatrixPosition(b.matrixWorld),g.nearDistance.value=b.shadow.camera.near,g.farDistance.value=b.shadow.camera.far}return{refreshFogUniforms:i,refreshMaterialUniforms:r}}function kvt(n,e,t,i){let r={},s={},o=[];const a=t.isWebGL2?n.getParameter(n.MAX_UNIFORM_BUFFER_BINDINGS):0;function l(b,S){const v=S.program;i.uniformBlockBinding(b,v)}function c(b,S){let v=r[b.id];v===void 0&&(h(b),v=d(b),r[b.id]=v,b.addEventListener("dispose",g));const T=S.program;i.updateUBOMapping(b,T);const C=e.render.frame;s[b.id]!==C&&(_(b),s[b.id]=C)}function d(b){const S=u();b.__bindingPointIndex=S;const v=n.createBuffer(),T=b.__size,C=b.usage;return n.bindBuffer(n.UNIFORM_BUFFER,v),n.bufferData(n.UNIFORM_BUFFER,T,C),n.bindBuffer(n.UNIFORM_BUFFER,null),n.bindBufferBase(n.UNIFORM_BUFFER,S,v),v}function u(){for(let b=0;b0){C=v%T;const k=T-C;C!==0&&k-R.boundary<0&&(v+=T-C,y.__offset=v)}v+=R.storage}return C=v%T,C>0&&(v+=T-C),b.__size=v,b.__cache={},this}function E(b){const S={boundary:0,storage:0};return typeof b=="number"?(S.boundary=4,S.storage=4):b.isVector2?(S.boundary=8,S.storage=8):b.isVector3||b.isColor?(S.boundary=16,S.storage=12):b.isVector4?(S.boundary=16,S.storage=16):b.isMatrix3?(S.boundary=48,S.storage=48):b.isMatrix4?(S.boundary=64,S.storage=64):b.isTexture?console.warn("THREE.WebGLRenderer: Texture samplers can not be part of an uniforms group."):console.warn("THREE.WebGLRenderer: Unsupported uniform value type.",b),S}function g(b){const S=b.target;S.removeEventListener("dispose",g);const v=o.indexOf(S.__bindingPointIndex);o.splice(v,1),n.deleteBuffer(r[S.id]),delete r[S.id],delete s[S.id]}function m(){for(const b in r)n.deleteBuffer(r[b]);o=[],r={},s={}}return{bind:l,update:c,dispose:m}}class bO{constructor(e={}){const{canvas:t=Igt(),context:i=null,depth:r=!0,stencil:s=!0,alpha:o=!1,antialias:a=!1,premultipliedAlpha:l=!0,preserveDrawingBuffer:c=!1,powerPreference:d="default",failIfMajorPerformanceCaveat:u=!1}=e;this.isWebGLRenderer=!0;let _;i!==null?_=i.getContextAttributes().alpha:_=o;const f=new Uint32Array(4),h=new Int32Array(4);let E=null,g=null;const m=[],b=[];this.domElement=t,this.debug={checkShaderErrors:!0,onShaderError:null},this.autoClear=!0,this.autoClearColor=!0,this.autoClearDepth=!0,this.autoClearStencil=!0,this.sortObjects=!0,this.clippingPlanes=[],this.localClippingEnabled=!1,this._outputColorSpace=Kt,this._useLegacyLights=!1,this.toneMapping=qr,this.toneMappingExposure=1;const S=this;let v=!1,T=0,C=0,N=null,x=-1,y=null;const R=new Pt,P=new Pt;let k=null;const W=new ot(0);let I=0,V=t.width,z=t.height,D=1,Y=null,K=null;const q=new Pt(0,0,V,z),le=new Pt(0,0,V,z);let Z=!1;const J=new GE;let _e=!1,he=!1,ye=null;const j=new gt,de=new vt,Q=new ue,fe={background:null,fog:null,environment:null,overrideMaterial:null,isScene:!0};function we(){return N===null?D:1}let O=i;function F(U,pe){for(let Se=0;Se{function Ye(){if(Te.forEach(function(Qe){xe.get(Qe).currentProgram.isReady()&&Te.delete(Qe)}),Te.size===0){ge(U);return}setTimeout(Ye,10)}H.get("KHR_parallel_shader_compile")!==null?Ye():setTimeout(Ye,10)})};let _t=null;function Wt(U){_t&&_t(U)}function tn(){Ht.stop()}function Ot(){Ht.start()}const Ht=new _O;Ht.setAnimationLoop(Wt),typeof self<"u"&&Ht.setContext(self),this.setAnimationLoop=function(U){_t=U,qe.setAnimationLoop(U),U===null?Ht.stop():Ht.start()},qe.addEventListener("sessionstart",tn),qe.addEventListener("sessionend",Ot),this.render=function(U,pe){if(pe!==void 0&&pe.isCamera!==!0){console.error("THREE.WebGLRenderer.render: camera is not an instance of THREE.Camera.");return}if(v===!0)return;U.matrixWorldAutoUpdate===!0&&U.updateMatrixWorld(),pe.parent===null&&pe.matrixWorldAutoUpdate===!0&&pe.updateMatrixWorld(),qe.enabled===!0&&qe.isPresenting===!0&&(qe.cameraAutoUpdate===!0&&qe.updateCamera(pe),pe=qe.getCamera()),U.isScene===!0&&U.onBeforeRender(S,U,pe,N),g=ee.get(U,b.length),g.init(),b.push(g),j.multiplyMatrices(pe.projectionMatrix,pe.matrixWorldInverse),J.setFromProjectionMatrix(j),he=this.localClippingEnabled,_e=ve.init(this.clippingPlanes,he),E=$.get(U,m.length),E.init(),m.push(E),On(U,pe,0,S.sortObjects),E.finish(),S.sortObjects===!0&&E.sort(Y,K),this.info.render.frame++,_e===!0&&ve.beginShadows();const Se=g.state.shadowsArray;if(Ee.render(Se,U,pe),_e===!0&&ve.endShadows(),this.info.autoReset===!0&&this.info.reset(),Ie.render(E,U),g.setupLights(S._useLegacyLights),pe.isArrayCamera){const Te=pe.cameras;for(let ge=0,Ye=Te.length;ge0?g=b[b.length-1]:g=null,m.pop(),m.length>0?E=m[m.length-1]:E=null};function On(U,pe,Se,Te){if(U.visible===!1)return;if(U.layers.test(pe.layers)){if(U.isGroup)Se=U.renderOrder;else if(U.isLOD)U.autoUpdate===!0&&U.update(pe);else if(U.isLight)g.pushLight(U),U.castShadow&&g.pushShadow(U);else if(U.isSprite){if(!U.frustumCulled||J.intersectsSprite(U)){Te&&Q.setFromMatrixPosition(U.matrixWorld).applyMatrix4(j);const Qe=A.update(U),nt=U.material;nt.visible&&E.push(U,Qe,nt,Se,Q.z,null)}}else if((U.isMesh||U.isLine||U.isPoints)&&(!U.frustumCulled||J.intersectsObject(U))){const Qe=A.update(U),nt=U.material;if(Te&&(U.boundingSphere!==void 0?(U.boundingSphere===null&&U.computeBoundingSphere(),Q.copy(U.boundingSphere.center)):(Qe.boundingSphere===null&&Qe.computeBoundingSphere(),Q.copy(Qe.boundingSphere.center)),Q.applyMatrix4(U.matrixWorld).applyMatrix4(j)),Array.isArray(nt)){const rt=Qe.groups;for(let ct=0,st=rt.length;ct0&&Sa(ge,Ye,pe,Se),Te&&te.viewport(R.copy(Te)),ge.length>0&&Gi(ge,pe,Se),Ye.length>0&&Gi(Ye,pe,Se),Qe.length>0&&Gi(Qe,pe,Se),te.buffers.depth.setTest(!0),te.buffers.depth.setMask(!0),te.buffers.color.setMask(!0),te.setPolygonOffset(!1)}function Sa(U,pe,Se,Te){if((Se.isScene===!0?Se.overrideMaterial:null)!==null)return;const Ye=se.isWebGL2;ye===null&&(ye=new Ps(1,1,{generateMipmaps:!0,type:H.has("EXT_color_buffer_half_float")?vl:Yr,minFilter:ks,samples:Ye?4:0})),S.getDrawingBufferSize(de),Ye?ye.setSize(de.x,de.y):ye.setSize(Ad(de.x),Ad(de.y));const Qe=S.getRenderTarget();S.setRenderTarget(ye),S.getClearColor(W),I=S.getClearAlpha(),I<1&&S.setClearColor(16777215,.5),S.clear();const nt=S.toneMapping;S.toneMapping=qr,Gi(U,Se,Te),B.updateMultisampleRenderTarget(ye),B.updateRenderTargetMipmap(ye);let rt=!1;for(let ct=0,st=pe.length;ct0),at=!!Se.morphAttributes.position,Ft=!!Se.morphAttributes.normal,cn=!!Se.morphAttributes.color;let qt=qr;Te.toneMapped&&(N===null||N.isXRRenderTarget===!0)&&(qt=S.toneMapping);const fn=Se.morphAttributes.position||Se.morphAttributes.normal||Se.morphAttributes.color,Bt=fn!==void 0?fn.length:0,pt=xe.get(Te),va=g.state.lights;if(_e===!0&&(he===!0||U!==y)){const Nn=U===y&&Te.id===x;ve.setState(Te,U,Nn)}let Vt=!1;Te.version===pt.__version?(pt.needsLights&&pt.lightsStateVersion!==va.state.version||pt.outputColorSpace!==nt||ge.isBatchedMesh&&pt.batching===!1||!ge.isBatchedMesh&&pt.batching===!0||ge.isInstancedMesh&&pt.instancing===!1||!ge.isInstancedMesh&&pt.instancing===!0||ge.isSkinnedMesh&&pt.skinning===!1||!ge.isSkinnedMesh&&pt.skinning===!0||ge.isInstancedMesh&&pt.instancingColor===!0&&ge.instanceColor===null||ge.isInstancedMesh&&pt.instancingColor===!1&&ge.instanceColor!==null||pt.envMap!==rt||Te.fog===!0&&pt.fog!==Ye||pt.numClippingPlanes!==void 0&&(pt.numClippingPlanes!==ve.numPlanes||pt.numIntersection!==ve.numIntersection)||pt.vertexAlphas!==ct||pt.vertexTangents!==st||pt.morphTargets!==at||pt.morphNormals!==Ft||pt.morphColors!==cn||pt.toneMapping!==qt||se.isWebGL2===!0&&pt.morphTargetsCount!==Bt)&&(Vt=!0):(Vt=!0,pt.__version=Te.version);let Vi=pt.currentProgram;Vt===!0&&(Vi=zi(Te,pe,ge));let Gl=!1,ts=!1,Ta=!1;const sn=Vi.getUniforms(),Hi=pt.uniforms;if(te.useProgram(Vi.program)&&(Gl=!0,ts=!0,Ta=!0),Te.id!==x&&(x=Te.id,ts=!0),Gl||y!==U){sn.setValue(O,"projectionMatrix",U.projectionMatrix),sn.setValue(O,"viewMatrix",U.matrixWorldInverse);const Nn=sn.map.cameraPosition;Nn!==void 0&&Nn.setValue(O,Q.setFromMatrixPosition(U.matrixWorld)),se.logarithmicDepthBuffer&&sn.setValue(O,"logDepthBufFC",2/(Math.log(U.far+1)/Math.LN2)),(Te.isMeshPhongMaterial||Te.isMeshToonMaterial||Te.isMeshLambertMaterial||Te.isMeshBasicMaterial||Te.isMeshStandardMaterial||Te.isShaderMaterial)&&sn.setValue(O,"isOrthographic",U.isOrthographicCamera===!0),y!==U&&(y=U,ts=!0,Ta=!0)}if(ge.isSkinnedMesh){sn.setOptional(O,ge,"bindMatrix"),sn.setOptional(O,ge,"bindMatrixInverse");const Nn=ge.skeleton;Nn&&(se.floatVertexTextures?(Nn.boneTexture===null&&Nn.computeBoneTexture(),sn.setValue(O,"boneTexture",Nn.boneTexture,B)):console.warn("THREE.WebGLRenderer: SkinnedMesh can only be used with WebGL 2. With WebGL 1 OES_texture_float and vertex textures support is required."))}ge.isBatchedMesh&&(sn.setOptional(O,ge,"batchingTexture"),sn.setValue(O,"batchingTexture",ge._matricesTexture,B));const xa=Se.morphAttributes;if((xa.position!==void 0||xa.normal!==void 0||xa.color!==void 0&&se.isWebGL2===!0)&&Be.update(ge,Se,Vi),(ts||pt.receiveShadow!==ge.receiveShadow)&&(pt.receiveShadow=ge.receiveShadow,sn.setValue(O,"receiveShadow",ge.receiveShadow)),Te.isMeshGouraudMaterial&&Te.envMap!==null&&(Hi.envMap.value=rt,Hi.flipEnvMap.value=rt.isCubeTexture&&rt.isRenderTargetTexture===!1?-1:1),ts&&(sn.setValue(O,"toneMappingExposure",S.toneMappingExposure),pt.needsLights&&es(Hi,Ta),Ye&&Te.fog===!0&&ce.refreshFogUniforms(Hi,Ye),ce.refreshMaterialUniforms(Hi,Te,D,z,ye),Xc.upload(O,Jr(pt),Hi,B)),Te.isShaderMaterial&&Te.uniformsNeedUpdate===!0&&(Xc.upload(O,Jr(pt),Hi,B),Te.uniformsNeedUpdate=!1),Te.isSpriteMaterial&&sn.setValue(O,"center",ge.center),sn.setValue(O,"modelViewMatrix",ge.modelViewMatrix),sn.setValue(O,"normalMatrix",ge.normalMatrix),sn.setValue(O,"modelMatrix",ge.matrixWorld),Te.isShaderMaterial||Te.isRawShaderMaterial){const Nn=Te.uniformsGroups;for(let Ca=0,pu=Nn.length;Ca0&&B.useMultisampledRTT(U)===!1?ge=xe.get(U).__webglMultisampledFramebuffer:Array.isArray(st)?ge=st[Se]:ge=st,R.copy(U.viewport),P.copy(U.scissor),k=U.scissorTest}else R.copy(q).multiplyScalar(D).floor(),P.copy(le).multiplyScalar(D).floor(),k=Z;if(te.bindFramebuffer(O.FRAMEBUFFER,ge)&&se.drawBuffers&&Te&&te.drawBuffers(U,ge),te.viewport(R),te.scissor(P),te.setScissorTest(k),Ye){const rt=xe.get(U.texture);O.framebufferTexture2D(O.FRAMEBUFFER,O.COLOR_ATTACHMENT0,O.TEXTURE_CUBE_MAP_POSITIVE_X+pe,rt.__webglTexture,Se)}else if(Qe){const rt=xe.get(U.texture),ct=pe||0;O.framebufferTextureLayer(O.FRAMEBUFFER,O.COLOR_ATTACHMENT0,rt.__webglTexture,Se||0,ct)}x=-1},this.readRenderTargetPixels=function(U,pe,Se,Te,ge,Ye,Qe){if(!(U&&U.isWebGLRenderTarget)){console.error("THREE.WebGLRenderer.readRenderTargetPixels: renderTarget is not THREE.WebGLRenderTarget.");return}let nt=xe.get(U).__webglFramebuffer;if(U.isWebGLCubeRenderTarget&&Qe!==void 0&&(nt=nt[Qe]),nt){te.bindFramebuffer(O.FRAMEBUFFER,nt);try{const rt=U.texture,ct=rt.format,st=rt.type;if(ct!==jn&&tt.convert(ct)!==O.getParameter(O.IMPLEMENTATION_COLOR_READ_FORMAT)){console.error("THREE.WebGLRenderer.readRenderTargetPixels: renderTarget is not in RGBA or implementation defined format.");return}const at=st===vl&&(H.has("EXT_color_buffer_half_float")||se.isWebGL2&&H.has("EXT_color_buffer_float"));if(st!==Yr&&tt.convert(st)!==O.getParameter(O.IMPLEMENTATION_COLOR_READ_TYPE)&&!(st===tr&&(se.isWebGL2||H.has("OES_texture_float")||H.has("WEBGL_color_buffer_float")))&&!at){console.error("THREE.WebGLRenderer.readRenderTargetPixels: renderTarget is not in UnsignedByteType or implementation defined type.");return}pe>=0&&pe<=U.width-Te&&Se>=0&&Se<=U.height-ge&&O.readPixels(pe,Se,Te,ge,tt.convert(ct),tt.convert(st),Ye)}finally{const rt=N!==null?xe.get(N).__webglFramebuffer:null;te.bindFramebuffer(O.FRAMEBUFFER,rt)}}},this.copyFramebufferToTexture=function(U,pe,Se=0){const Te=Math.pow(2,-Se),ge=Math.floor(pe.image.width*Te),Ye=Math.floor(pe.image.height*Te);B.setTexture2D(pe,0),O.copyTexSubImage2D(O.TEXTURE_2D,Se,0,0,U.x,U.y,ge,Ye),te.unbindTexture()},this.copyTextureToTexture=function(U,pe,Se,Te=0){const ge=pe.image.width,Ye=pe.image.height,Qe=tt.convert(Se.format),nt=tt.convert(Se.type);B.setTexture2D(Se,0),O.pixelStorei(O.UNPACK_FLIP_Y_WEBGL,Se.flipY),O.pixelStorei(O.UNPACK_PREMULTIPLY_ALPHA_WEBGL,Se.premultiplyAlpha),O.pixelStorei(O.UNPACK_ALIGNMENT,Se.unpackAlignment),pe.isDataTexture?O.texSubImage2D(O.TEXTURE_2D,Te,U.x,U.y,ge,Ye,Qe,nt,pe.image.data):pe.isCompressedTexture?O.compressedTexSubImage2D(O.TEXTURE_2D,Te,U.x,U.y,pe.mipmaps[0].width,pe.mipmaps[0].height,Qe,pe.mipmaps[0].data):O.texSubImage2D(O.TEXTURE_2D,Te,U.x,U.y,Qe,nt,pe.image),Te===0&&Se.generateMipmaps&&O.generateMipmap(O.TEXTURE_2D),te.unbindTexture()},this.copyTextureToTexture3D=function(U,pe,Se,Te,ge=0){if(S.isWebGL1Renderer){console.warn("THREE.WebGLRenderer.copyTextureToTexture3D: can only be used with WebGL2.");return}const Ye=U.max.x-U.min.x+1,Qe=U.max.y-U.min.y+1,nt=U.max.z-U.min.z+1,rt=tt.convert(Te.format),ct=tt.convert(Te.type);let st;if(Te.isData3DTexture)B.setTexture3D(Te,0),st=O.TEXTURE_3D;else if(Te.isDataArrayTexture)B.setTexture2DArray(Te,0),st=O.TEXTURE_2D_ARRAY;else{console.warn("THREE.WebGLRenderer.copyTextureToTexture3D: only supports THREE.DataTexture3D and THREE.DataTexture2DArray.");return}O.pixelStorei(O.UNPACK_FLIP_Y_WEBGL,Te.flipY),O.pixelStorei(O.UNPACK_PREMULTIPLY_ALPHA_WEBGL,Te.premultiplyAlpha),O.pixelStorei(O.UNPACK_ALIGNMENT,Te.unpackAlignment);const at=O.getParameter(O.UNPACK_ROW_LENGTH),Ft=O.getParameter(O.UNPACK_IMAGE_HEIGHT),cn=O.getParameter(O.UNPACK_SKIP_PIXELS),qt=O.getParameter(O.UNPACK_SKIP_ROWS),fn=O.getParameter(O.UNPACK_SKIP_IMAGES),Bt=Se.isCompressedTexture?Se.mipmaps[0]:Se.image;O.pixelStorei(O.UNPACK_ROW_LENGTH,Bt.width),O.pixelStorei(O.UNPACK_IMAGE_HEIGHT,Bt.height),O.pixelStorei(O.UNPACK_SKIP_PIXELS,U.min.x),O.pixelStorei(O.UNPACK_SKIP_ROWS,U.min.y),O.pixelStorei(O.UNPACK_SKIP_IMAGES,U.min.z),Se.isDataTexture||Se.isData3DTexture?O.texSubImage3D(st,ge,pe.x,pe.y,pe.z,Ye,Qe,nt,rt,ct,Bt.data):Se.isCompressedArrayTexture?(console.warn("THREE.WebGLRenderer.copyTextureToTexture3D: untested support for compressed srcTexture."),O.compressedTexSubImage3D(st,ge,pe.x,pe.y,pe.z,Ye,Qe,nt,rt,Bt.data)):O.texSubImage3D(st,ge,pe.x,pe.y,pe.z,Ye,Qe,nt,rt,ct,Bt),O.pixelStorei(O.UNPACK_ROW_LENGTH,at),O.pixelStorei(O.UNPACK_IMAGE_HEIGHT,Ft),O.pixelStorei(O.UNPACK_SKIP_PIXELS,cn),O.pixelStorei(O.UNPACK_SKIP_ROWS,qt),O.pixelStorei(O.UNPACK_SKIP_IMAGES,fn),ge===0&&Te.generateMipmaps&&O.generateMipmap(st),te.unbindTexture()},this.initTexture=function(U){U.isCubeTexture?B.setTextureCube(U,0):U.isData3DTexture?B.setTexture3D(U,0):U.isDataArrayTexture||U.isCompressedArrayTexture?B.setTexture2DArray(U,0):B.setTexture2D(U,0),te.unbindTexture()},this.resetState=function(){T=0,C=0,N=null,te.reset(),We.reset()},typeof __THREE_DEVTOOLS__<"u"&&__THREE_DEVTOOLS__.dispatchEvent(new CustomEvent("observe",{detail:this}))}get coordinateSystem(){return nr}get outputColorSpace(){return this._outputColorSpace}set outputColorSpace(e){this._outputColorSpace=e;const t=this.getContext();t.drawingBufferColorSpace=e===FE?"display-p3":"srgb",t.unpackColorSpace=Nt.workingColorSpace===au?"display-p3":"srgb"}get physicallyCorrectLights(){return console.warn("THREE.WebGLRenderer: The property .physicallyCorrectLights has been removed. Set renderer.useLegacyLights instead."),!this.useLegacyLights}set physicallyCorrectLights(e){console.warn("THREE.WebGLRenderer: The property .physicallyCorrectLights has been removed. Set renderer.useLegacyLights instead."),this.useLegacyLights=!e}get outputEncoding(){return console.warn("THREE.WebGLRenderer: Property .outputEncoding has been removed. Use .outputColorSpace instead."),this.outputColorSpace===Kt?Ns:Jw}set outputEncoding(e){console.warn("THREE.WebGLRenderer: Property .outputEncoding has been removed. Use .outputColorSpace instead."),this.outputColorSpace=e===Ns?Kt:hn}get useLegacyLights(){return console.warn("THREE.WebGLRenderer: The property .useLegacyLights has been deprecated. Migrate your lighting according to the following guide: https://discourse.threejs.org/t/updates-to-lighting-in-three-js-r155/53733."),this._useLegacyLights}set useLegacyLights(e){console.warn("THREE.WebGLRenderer: The property .useLegacyLights has been deprecated. Migrate your lighting according to the following guide: https://discourse.threejs.org/t/updates-to-lighting-in-three-js-r155/53733."),this._useLegacyLights=e}}class Pvt extends bO{}Pvt.prototype.isWebGL1Renderer=!0;class Uvt extends Yt{constructor(){super(),this.isScene=!0,this.type="Scene",this.background=null,this.environment=null,this.fog=null,this.backgroundBlurriness=0,this.backgroundIntensity=1,this.overrideMaterial=null,typeof __THREE_DEVTOOLS__<"u"&&__THREE_DEVTOOLS__.dispatchEvent(new CustomEvent("observe",{detail:this}))}copy(e,t){return super.copy(e,t),e.background!==null&&(this.background=e.background.clone()),e.environment!==null&&(this.environment=e.environment.clone()),e.fog!==null&&(this.fog=e.fog.clone()),this.backgroundBlurriness=e.backgroundBlurriness,this.backgroundIntensity=e.backgroundIntensity,e.overrideMaterial!==null&&(this.overrideMaterial=e.overrideMaterial.clone()),this.matrixAutoUpdate=e.matrixAutoUpdate,this}toJSON(e){const t=super.toJSON(e);return this.fog!==null&&(t.object.fog=this.fog.toJSON()),this.backgroundBlurriness>0&&(t.object.backgroundBlurriness=this.backgroundBlurriness),this.backgroundIntensity!==1&&(t.object.backgroundIntensity=this.backgroundIntensity),t}}class Fvt{constructor(e,t){this.isInterleavedBuffer=!0,this.array=e,this.stride=t,this.count=e!==void 0?e.length/t:0,this.usage=tg,this._updateRange={offset:0,count:-1},this.updateRanges=[],this.version=0,this.uuid=fi()}onUploadCallback(){}set needsUpdate(e){e===!0&&this.version++}get updateRange(){return console.warn('THREE.InterleavedBuffer: "updateRange" is deprecated and removed in r169. Use "addUpdateRange()" instead.'),this._updateRange}setUsage(e){return this.usage=e,this}addUpdateRange(e,t){this.updateRanges.push({start:e,count:t})}clearUpdateRanges(){this.updateRanges.length=0}copy(e){return this.array=new e.array.constructor(e.array),this.count=e.count,this.stride=e.stride,this.usage=e.usage,this}copyAt(e,t,i){e*=this.stride,i*=t.stride;for(let r=0,s=this.stride;rl)continue;_.applyMatrix4(this.matrixWorld);const x=e.ray.origin.distanceTo(_);xe.far||t.push({distance:x,point:u.clone().applyMatrix4(this.matrixWorld),index:S,face:null,faceIndex:null,object:this})}}else{const m=Math.max(0,o.start),b=Math.min(g.count,o.start+o.count);for(let S=m,v=b-1;Sl)continue;_.applyMatrix4(this.matrixWorld);const C=e.ray.origin.distanceTo(_);Ce.far||t.push({distance:C,point:u.clone().applyMatrix4(this.matrixWorld),index:S,face:null,faceIndex:null,object:this})}}}updateMorphTargets(){const t=this.geometry.morphAttributes,i=Object.keys(t);if(i.length>0){const r=t[i[0]];if(r!==void 0){this.morphTargetInfluences=[],this.morphTargetDictionary={};for(let s=0,o=r.length;s0){const r=t[i[0]];if(r!==void 0){this.morphTargetInfluences=[],this.morphTargetDictionary={};for(let s=0,o=r.length;sr.far)return;s.push({distance:c,distanceToRay:Math.sqrt(a),point:l,index:e,face:null,object:o})}}class WE extends mi{constructor(e){super(),this.isMeshStandardMaterial=!0,this.defines={STANDARD:""},this.type="MeshStandardMaterial",this.color=new ot(16777215),this.roughness=1,this.metalness=0,this.map=null,this.lightMap=null,this.lightMapIntensity=1,this.aoMap=null,this.aoMapIntensity=1,this.emissive=new ot(0),this.emissiveIntensity=1,this.emissiveMap=null,this.bumpMap=null,this.bumpScale=1,this.normalMap=null,this.normalMapType=UE,this.normalScale=new vt(1,1),this.displacementMap=null,this.displacementScale=1,this.displacementBias=0,this.roughnessMap=null,this.metalnessMap=null,this.alphaMap=null,this.envMap=null,this.envMapIntensity=1,this.wireframe=!1,this.wireframeLinewidth=1,this.wireframeLinecap="round",this.wireframeLinejoin="round",this.flatShading=!1,this.fog=!0,this.setValues(e)}copy(e){return super.copy(e),this.defines={STANDARD:""},this.color.copy(e.color),this.roughness=e.roughness,this.metalness=e.metalness,this.map=e.map,this.lightMap=e.lightMap,this.lightMapIntensity=e.lightMapIntensity,this.aoMap=e.aoMap,this.aoMapIntensity=e.aoMapIntensity,this.emissive.copy(e.emissive),this.emissiveMap=e.emissiveMap,this.emissiveIntensity=e.emissiveIntensity,this.bumpMap=e.bumpMap,this.bumpScale=e.bumpScale,this.normalMap=e.normalMap,this.normalMapType=e.normalMapType,this.normalScale.copy(e.normalScale),this.displacementMap=e.displacementMap,this.displacementScale=e.displacementScale,this.displacementBias=e.displacementBias,this.roughnessMap=e.roughnessMap,this.metalnessMap=e.metalnessMap,this.alphaMap=e.alphaMap,this.envMap=e.envMap,this.envMapIntensity=e.envMapIntensity,this.wireframe=e.wireframe,this.wireframeLinewidth=e.wireframeLinewidth,this.wireframeLinecap=e.wireframeLinecap,this.wireframeLinejoin=e.wireframeLinejoin,this.flatShading=e.flatShading,this.fog=e.fog,this}}class fr extends WE{constructor(e){super(),this.isMeshPhysicalMaterial=!0,this.defines={STANDARD:"",PHYSICAL:""},this.type="MeshPhysicalMaterial",this.anisotropyRotation=0,this.anisotropyMap=null,this.clearcoatMap=null,this.clearcoatRoughness=0,this.clearcoatRoughnessMap=null,this.clearcoatNormalScale=new vt(1,1),this.clearcoatNormalMap=null,this.ior=1.5,Object.defineProperty(this,"reflectivity",{get:function(){return En(2.5*(this.ior-1)/(this.ior+1),0,1)},set:function(t){this.ior=(1+.4*t)/(1-.4*t)}}),this.iridescenceMap=null,this.iridescenceIOR=1.3,this.iridescenceThicknessRange=[100,400],this.iridescenceThicknessMap=null,this.sheenColor=new ot(0),this.sheenColorMap=null,this.sheenRoughness=1,this.sheenRoughnessMap=null,this.transmissionMap=null,this.thickness=0,this.thicknessMap=null,this.attenuationDistance=1/0,this.attenuationColor=new ot(1,1,1),this.specularIntensity=1,this.specularIntensityMap=null,this.specularColor=new ot(1,1,1),this.specularColorMap=null,this._anisotropy=0,this._clearcoat=0,this._iridescence=0,this._sheen=0,this._transmission=0,this.setValues(e)}get anisotropy(){return this._anisotropy}set anisotropy(e){this._anisotropy>0!=e>0&&this.version++,this._anisotropy=e}get clearcoat(){return this._clearcoat}set clearcoat(e){this._clearcoat>0!=e>0&&this.version++,this._clearcoat=e}get iridescence(){return this._iridescence}set iridescence(e){this._iridescence>0!=e>0&&this.version++,this._iridescence=e}get sheen(){return this._sheen}set sheen(e){this._sheen>0!=e>0&&this.version++,this._sheen=e}get transmission(){return this._transmission}set transmission(e){this._transmission>0!=e>0&&this.version++,this._transmission=e}copy(e){return super.copy(e),this.defines={STANDARD:"",PHYSICAL:""},this.anisotropy=e.anisotropy,this.anisotropyRotation=e.anisotropyRotation,this.anisotropyMap=e.anisotropyMap,this.clearcoat=e.clearcoat,this.clearcoatMap=e.clearcoatMap,this.clearcoatRoughness=e.clearcoatRoughness,this.clearcoatRoughnessMap=e.clearcoatRoughnessMap,this.clearcoatNormalMap=e.clearcoatNormalMap,this.clearcoatNormalScale.copy(e.clearcoatNormalScale),this.ior=e.ior,this.iridescence=e.iridescence,this.iridescenceMap=e.iridescenceMap,this.iridescenceIOR=e.iridescenceIOR,this.iridescenceThicknessRange=[...e.iridescenceThicknessRange],this.iridescenceThicknessMap=e.iridescenceThicknessMap,this.sheen=e.sheen,this.sheenColor.copy(e.sheenColor),this.sheenColorMap=e.sheenColorMap,this.sheenRoughness=e.sheenRoughness,this.sheenRoughnessMap=e.sheenRoughnessMap,this.transmission=e.transmission,this.transmissionMap=e.transmissionMap,this.thickness=e.thickness,this.thicknessMap=e.thicknessMap,this.attenuationDistance=e.attenuationDistance,this.attenuationColor.copy(e.attenuationColor),this.specularIntensity=e.specularIntensity,this.specularIntensityMap=e.specularIntensityMap,this.specularColor.copy(e.specularColor),this.specularColorMap=e.specularColorMap,this}}class iR extends mi{constructor(e){super(),this.isMeshPhongMaterial=!0,this.type="MeshPhongMaterial",this.color=new ot(16777215),this.specular=new ot(1118481),this.shininess=30,this.map=null,this.lightMap=null,this.lightMapIntensity=1,this.aoMap=null,this.aoMapIntensity=1,this.emissive=new ot(0),this.emissiveIntensity=1,this.emissiveMap=null,this.bumpMap=null,this.bumpScale=1,this.normalMap=null,this.normalMapType=UE,this.normalScale=new vt(1,1),this.displacementMap=null,this.displacementScale=1,this.displacementBias=0,this.specularMap=null,this.alphaMap=null,this.envMap=null,this.combine=kE,this.reflectivity=1,this.refractionRatio=.98,this.wireframe=!1,this.wireframeLinewidth=1,this.wireframeLinecap="round",this.wireframeLinejoin="round",this.flatShading=!1,this.fog=!0,this.setValues(e)}copy(e){return super.copy(e),this.color.copy(e.color),this.specular.copy(e.specular),this.shininess=e.shininess,this.map=e.map,this.lightMap=e.lightMap,this.lightMapIntensity=e.lightMapIntensity,this.aoMap=e.aoMap,this.aoMapIntensity=e.aoMapIntensity,this.emissive.copy(e.emissive),this.emissiveMap=e.emissiveMap,this.emissiveIntensity=e.emissiveIntensity,this.bumpMap=e.bumpMap,this.bumpScale=e.bumpScale,this.normalMap=e.normalMap,this.normalMapType=e.normalMapType,this.normalScale.copy(e.normalScale),this.displacementMap=e.displacementMap,this.displacementScale=e.displacementScale,this.displacementBias=e.displacementBias,this.specularMap=e.specularMap,this.alphaMap=e.alphaMap,this.envMap=e.envMap,this.combine=e.combine,this.reflectivity=e.reflectivity,this.refractionRatio=e.refractionRatio,this.wireframe=e.wireframe,this.wireframeLinewidth=e.wireframeLinewidth,this.wireframeLinecap=e.wireframeLinecap,this.wireframeLinejoin=e.wireframeLinejoin,this.flatShading=e.flatShading,this.fog=e.fog,this}}function Pc(n,e,t){return!n||!t&&n.constructor===e?n:typeof e.BYTES_PER_ELEMENT=="number"?new e(n):Array.prototype.slice.call(n)}function Kvt(n){return ArrayBuffer.isView(n)&&!(n instanceof DataView)}function jvt(n){function e(r,s){return n[r]-n[s]}const t=n.length,i=new Array(t);for(let r=0;r!==t;++r)i[r]=r;return i.sort(e),i}function rR(n,e,t){const i=n.length,r=new n.constructor(i);for(let s=0,o=0;o!==i;++s){const a=t[s]*e;for(let l=0;l!==e;++l)r[o++]=n[a+l]}return r}function TO(n,e,t,i){let r=1,s=n[0];for(;s!==void 0&&s[i]===void 0;)s=n[r++];if(s===void 0)return;let o=s[i];if(o!==void 0)if(Array.isArray(o))do o=s[i],o!==void 0&&(e.push(s.time),t.push.apply(t,o)),s=n[r++];while(s!==void 0);else if(o.toArray!==void 0)do o=s[i],o!==void 0&&(e.push(s.time),o.toArray(t,t.length)),s=n[r++];while(s!==void 0);else do o=s[i],o!==void 0&&(e.push(s.time),t.push(o)),s=n[r++];while(s!==void 0)}class Bl{constructor(e,t,i,r){this.parameterPositions=e,this._cachedIndex=0,this.resultBuffer=r!==void 0?r:new t.constructor(i),this.sampleValues=t,this.valueSize=i,this.settings=null,this.DefaultSettings_={}}evaluate(e){const t=this.parameterPositions;let i=this._cachedIndex,r=t[i],s=t[i-1];e:{t:{let o;n:{i:if(!(e=s)){const a=t[1];e=s)break t}o=i,i=0;break n}break e}for(;i>>1;et;)--o;if(++o,s!==0||o!==r){s>=o&&(o=Math.max(o,1),s=o-1);const a=this.getValueSize();this.times=i.slice(s,o),this.values=this.values.slice(s*a,o*a)}return this}validate(){let e=!0;const t=this.getValueSize();t-Math.floor(t)!==0&&(console.error("THREE.KeyframeTrack: Invalid value size in track.",this),e=!1);const i=this.times,r=this.values,s=i.length;s===0&&(console.error("THREE.KeyframeTrack: Track is empty.",this),e=!1);let o=null;for(let a=0;a!==s;a++){const l=i[a];if(typeof l=="number"&&isNaN(l)){console.error("THREE.KeyframeTrack: Time is not a valid number.",this,a,l),e=!1;break}if(o!==null&&o>l){console.error("THREE.KeyframeTrack: Out of order keys.",this,a,l,o),e=!1;break}o=l}if(r!==void 0&&Kvt(r))for(let a=0,l=r.length;a!==l;++a){const c=r[a];if(isNaN(c)){console.error("THREE.KeyframeTrack: Value is not a valid number.",this,a,c),e=!1;break}}return e}optimize(){const e=this.times.slice(),t=this.values.slice(),i=this.getValueSize(),r=this.getInterpolation()===Df,s=e.length-1;let o=1;for(let a=1;a0){e[o]=e[s];for(let a=s*i,l=o*i,c=0;c!==i;++c)t[l+c]=t[a+c];++o}return o!==e.length?(this.times=e.slice(0,o),this.values=t.slice(0,o*i)):(this.times=e,this.values=t),this}clone(){const e=this.times.slice(),t=this.values.slice(),i=this.constructor,r=new i(this.name,e,t);return r.createInterpolant=this.createInterpolant,r}}Bi.prototype.TimeBufferType=Float32Array;Bi.prototype.ValueBufferType=Float32Array;Bi.prototype.DefaultInterpolation=Jo;class ga extends Bi{}ga.prototype.ValueTypeName="bool";ga.prototype.ValueBufferType=Array;ga.prototype.DefaultInterpolation=Tl;ga.prototype.InterpolantFactoryMethodLinear=void 0;ga.prototype.InterpolantFactoryMethodSmooth=void 0;class xO extends Bi{}xO.prototype.ValueTypeName="color";class na extends Bi{}na.prototype.ValueTypeName="number";class Jvt extends Bl{constructor(e,t,i,r){super(e,t,i,r)}interpolate_(e,t,i,r){const s=this.resultBuffer,o=this.sampleValues,a=this.valueSize,l=(i-t)/(r-t);let c=e*a;for(let d=c+a;c!==d;c+=4)Xr.slerpFlat(s,0,o,c-a,o,c,l);return s}}class Fs extends Bi{InterpolantFactoryMethodLinear(e){return new Jvt(this.times,this.values,this.getValueSize(),e)}}Fs.prototype.ValueTypeName="quaternion";Fs.prototype.DefaultInterpolation=Jo;Fs.prototype.InterpolantFactoryMethodSmooth=void 0;class Ea extends Bi{}Ea.prototype.ValueTypeName="string";Ea.prototype.ValueBufferType=Array;Ea.prototype.DefaultInterpolation=Tl;Ea.prototype.InterpolantFactoryMethodLinear=void 0;Ea.prototype.InterpolantFactoryMethodSmooth=void 0;class ia extends Bi{}ia.prototype.ValueTypeName="vector";class eTt{constructor(e,t=-1,i,r=sgt){this.name=e,this.tracks=i,this.duration=t,this.blendMode=r,this.uuid=fi(),this.duration<0&&this.resetDuration()}static parse(e){const t=[],i=e.tracks,r=1/(e.fps||1);for(let o=0,a=i.length;o!==a;++o)t.push(nTt(i[o]).scale(r));const s=new this(e.name,e.duration,t,e.blendMode);return s.uuid=e.uuid,s}static toJSON(e){const t=[],i=e.tracks,r={name:e.name,duration:e.duration,tracks:t,uuid:e.uuid,blendMode:e.blendMode};for(let s=0,o=i.length;s!==o;++s)t.push(Bi.toJSON(i[s]));return r}static CreateFromMorphTargetSequence(e,t,i,r){const s=t.length,o=[];for(let a=0;a1){const u=d[1];let _=r[u];_||(r[u]=_=[]),_.push(c)}}const o=[];for(const a in r)o.push(this.CreateFromMorphTargetSequence(a,r[a],t,i));return o}static parseAnimation(e,t){if(!e)return console.error("THREE.AnimationClip: No animation in JSONLoader data."),null;const i=function(u,_,f,h,E){if(f.length!==0){const g=[],m=[];TO(f,g,m,h),g.length!==0&&E.push(new u(_,g,m))}},r=[],s=e.name||"default",o=e.fps||30,a=e.blendMode;let l=e.length||-1;const c=e.hierarchy||[];for(let u=0;u{t&&t(s),this.manager.itemEnd(e)},0),s;if(Qi[e]!==void 0){Qi[e].push({onLoad:t,onProgress:i,onError:r});return}Qi[e]=[],Qi[e].push({onLoad:t,onProgress:i,onError:r});const o=new Request(e,{headers:new Headers(this.requestHeader),credentials:this.withCredentials?"include":"same-origin"}),a=this.mimeType,l=this.responseType;fetch(o).then(c=>{if(c.status===200||c.status===0){if(c.status===0&&console.warn("THREE.FileLoader: HTTP Status 0 received."),typeof ReadableStream>"u"||c.body===void 0||c.body.getReader===void 0)return c;const d=Qi[e],u=c.body.getReader(),_=c.headers.get("Content-Length")||c.headers.get("X-File-Size"),f=_?parseInt(_):0,h=f!==0;let E=0;const g=new ReadableStream({start(m){b();function b(){u.read().then(({done:S,value:v})=>{if(S)m.close();else{E+=v.byteLength;const T=new ProgressEvent("progress",{lengthComputable:h,loaded:E,total:f});for(let C=0,N=d.length;C{switch(l){case"arraybuffer":return c.arrayBuffer();case"blob":return c.blob();case"document":return c.text().then(d=>new DOMParser().parseFromString(d,a));case"json":return c.json();default:if(a===void 0)return c.text();{const u=/charset="?([^;"\s]*)"?/i.exec(a),_=u&&u[1]?u[1].toLowerCase():void 0,f=new TextDecoder(_);return c.arrayBuffer().then(h=>f.decode(h))}}}).then(c=>{ra.add(e,c);const d=Qi[e];delete Qi[e];for(let u=0,_=d.length;u<_;u++){const f=d[u];f.onLoad&&f.onLoad(c)}}).catch(c=>{const d=Qi[e];if(d===void 0)throw this.manager.itemError(e),c;delete Qi[e];for(let u=0,_=d.length;u<_;u++){const f=d[u];f.onError&&f.onError(c)}this.manager.itemError(e)}).finally(()=>{this.manager.itemEnd(e)}),this.manager.itemStart(e)}setResponseType(e){return this.responseType=e,this}setMimeType(e){return this.mimeType=e,this}}class oTt extends ba{constructor(e){super(e)}load(e,t,i,r){this.path!==void 0&&(e=this.path+e),e=this.manager.resolveURL(e);const s=this,o=ra.get(e);if(o!==void 0)return s.manager.itemStart(e),setTimeout(function(){t&&t(o),s.manager.itemEnd(e)},0),o;const a=xl("img");function l(){d(),ra.add(e,this),t&&t(this),s.manager.itemEnd(e)}function c(u){d(),r&&r(u),s.manager.itemError(e),s.manager.itemEnd(e)}function d(){a.removeEventListener("load",l,!1),a.removeEventListener("error",c,!1)}return a.addEventListener("load",l,!1),a.addEventListener("error",c,!1),e.slice(0,5)!=="data:"&&this.crossOrigin!==void 0&&(a.crossOrigin=this.crossOrigin),s.manager.itemStart(e),a.src=e,a}}class RO extends ba{constructor(e){super(e)}load(e,t,i,r){const s=new pn,o=new oTt(this.manager);return o.setCrossOrigin(this.crossOrigin),o.setPath(this.path),o.load(e,function(a){s.image=a,s.needsUpdate=!0,t!==void 0&&t(s)},i,r),s}}class uu extends Yt{constructor(e,t=1){super(),this.isLight=!0,this.type="Light",this.color=new ot(e),this.intensity=t}dispose(){}copy(e,t){return super.copy(e,t),this.color.copy(e.color),this.intensity=e.intensity,this}toJSON(e){const t=super.toJSON(e);return t.object.color=this.color.getHex(),t.object.intensity=this.intensity,this.groundColor!==void 0&&(t.object.groundColor=this.groundColor.getHex()),this.distance!==void 0&&(t.object.distance=this.distance),this.angle!==void 0&&(t.object.angle=this.angle),this.decay!==void 0&&(t.object.decay=this.decay),this.penumbra!==void 0&&(t.object.penumbra=this.penumbra),this.shadow!==void 0&&(t.object.shadow=this.shadow.toJSON()),t}}const om=new gt,sR=new ue,oR=new ue;class KE{constructor(e){this.camera=e,this.bias=0,this.normalBias=0,this.radius=1,this.blurSamples=8,this.mapSize=new vt(512,512),this.map=null,this.mapPass=null,this.matrix=new gt,this.autoUpdate=!0,this.needsUpdate=!1,this._frustum=new GE,this._frameExtents=new vt(1,1),this._viewportCount=1,this._viewports=[new Pt(0,0,1,1)]}getViewportCount(){return this._viewportCount}getFrustum(){return this._frustum}updateMatrices(e){const t=this.camera,i=this.matrix;sR.setFromMatrixPosition(e.matrixWorld),t.position.copy(sR),oR.setFromMatrixPosition(e.target.matrixWorld),t.lookAt(oR),t.updateMatrixWorld(),om.multiplyMatrices(t.projectionMatrix,t.matrixWorldInverse),this._frustum.setFromProjectionMatrix(om),i.set(.5,0,0,.5,0,.5,0,.5,0,0,.5,.5,0,0,0,1),i.multiply(om)}getViewport(e){return this._viewports[e]}getFrameExtents(){return this._frameExtents}dispose(){this.map&&this.map.dispose(),this.mapPass&&this.mapPass.dispose()}copy(e){return this.camera=e.camera.clone(),this.bias=e.bias,this.radius=e.radius,this.mapSize.copy(e.mapSize),this}clone(){return new this.constructor().copy(this)}toJSON(){const e={};return this.bias!==0&&(e.bias=this.bias),this.normalBias!==0&&(e.normalBias=this.normalBias),this.radius!==1&&(e.radius=this.radius),(this.mapSize.x!==512||this.mapSize.y!==512)&&(e.mapSize=this.mapSize.toArray()),e.camera=this.camera.toJSON(!1).object,delete e.camera.matrix,e}}class aTt extends KE{constructor(){super(new Rn(50,1,.5,500)),this.isSpotLightShadow=!0,this.focus=1}updateMatrices(e){const t=this.camera,i=ea*2*e.angle*this.focus,r=this.mapSize.width/this.mapSize.height,s=e.distance||t.far;(i!==t.fov||r!==t.aspect||s!==t.far)&&(t.fov=i,t.aspect=r,t.far=s,t.updateProjectionMatrix()),super.updateMatrices(e)}copy(e){return super.copy(e),this.focus=e.focus,this}}class lTt extends uu{constructor(e,t,i=0,r=Math.PI/3,s=0,o=2){super(e,t),this.isSpotLight=!0,this.type="SpotLight",this.position.copy(Yt.DEFAULT_UP),this.updateMatrix(),this.target=new Yt,this.distance=i,this.angle=r,this.penumbra=s,this.decay=o,this.map=null,this.shadow=new aTt}get power(){return this.intensity*Math.PI}set power(e){this.intensity=e/Math.PI}dispose(){this.shadow.dispose()}copy(e,t){return super.copy(e,t),this.distance=e.distance,this.angle=e.angle,this.penumbra=e.penumbra,this.decay=e.decay,this.target=e.target.clone(),this.shadow=e.shadow.clone(),this}}const aR=new gt,Ga=new ue,am=new ue;class cTt extends KE{constructor(){super(new Rn(90,1,.5,500)),this.isPointLightShadow=!0,this._frameExtents=new vt(4,2),this._viewportCount=6,this._viewports=[new Pt(2,1,1,1),new Pt(0,1,1,1),new Pt(3,1,1,1),new Pt(1,1,1,1),new Pt(3,0,1,1),new Pt(1,0,1,1)],this._cubeDirections=[new ue(1,0,0),new ue(-1,0,0),new ue(0,0,1),new ue(0,0,-1),new ue(0,1,0),new ue(0,-1,0)],this._cubeUps=[new ue(0,1,0),new ue(0,1,0),new ue(0,1,0),new ue(0,1,0),new ue(0,0,1),new ue(0,0,-1)]}updateMatrices(e,t=0){const i=this.camera,r=this.matrix,s=e.distance||i.far;s!==i.far&&(i.far=s,i.updateProjectionMatrix()),Ga.setFromMatrixPosition(e.matrixWorld),i.position.copy(Ga),am.copy(i.position),am.add(this._cubeDirections[t]),i.up.copy(this._cubeUps[t]),i.lookAt(am),i.updateMatrixWorld(),r.makeTranslation(-Ga.x,-Ga.y,-Ga.z),aR.multiplyMatrices(i.projectionMatrix,i.matrixWorldInverse),this._frustum.setFromProjectionMatrix(aR)}}class dTt extends uu{constructor(e,t,i=0,r=2){super(e,t),this.isPointLight=!0,this.type="PointLight",this.distance=i,this.decay=r,this.shadow=new cTt}get power(){return this.intensity*4*Math.PI}set power(e){this.intensity=e/(4*Math.PI)}dispose(){this.shadow.dispose()}copy(e,t){return super.copy(e,t),this.distance=e.distance,this.decay=e.decay,this.shadow=e.shadow.clone(),this}}class uTt extends KE{constructor(){super(new VE(-5,5,5,-5,.5,500)),this.isDirectionalLightShadow=!0}}class AO extends uu{constructor(e,t){super(e,t),this.isDirectionalLight=!0,this.type="DirectionalLight",this.position.copy(Yt.DEFAULT_UP),this.updateMatrix(),this.target=new Yt,this.shadow=new uTt}dispose(){this.shadow.dispose()}copy(e){return super.copy(e),this.target=e.target.clone(),this.shadow=e.shadow.clone(),this}}class _Tt extends uu{constructor(e,t){super(e,t),this.isAmbientLight=!0,this.type="AmbientLight"}}class rl{static decodeText(e){if(typeof TextDecoder<"u")return new TextDecoder().decode(e);let t="";for(let i=0,r=e.length;i"u"&&console.warn("THREE.ImageBitmapLoader: createImageBitmap() not supported."),typeof fetch>"u"&&console.warn("THREE.ImageBitmapLoader: fetch() not supported."),this.options={premultiplyAlpha:"none"}}setOptions(e){return this.options=e,this}load(e,t,i,r){e===void 0&&(e=""),this.path!==void 0&&(e=this.path+e),e=this.manager.resolveURL(e);const s=this,o=ra.get(e);if(o!==void 0)return s.manager.itemStart(e),setTimeout(function(){t&&t(o),s.manager.itemEnd(e)},0),o;const a={};a.credentials=this.crossOrigin==="anonymous"?"same-origin":"include",a.headers=this.requestHeader,fetch(e,a).then(function(l){return l.blob()}).then(function(l){return createImageBitmap(l,Object.assign(s.options,{colorSpaceConversion:"none"}))}).then(function(l){ra.add(e,l),t&&t(l),s.manager.itemEnd(e)}).catch(function(l){r&&r(l),s.manager.itemError(e),s.manager.itemEnd(e)}),s.manager.itemStart(e)}}const jE="\\[\\]\\.:\\/",hTt=new RegExp("["+jE+"]","g"),QE="[^"+jE+"]",fTt="[^"+jE.replace("\\.","")+"]",mTt=/((?:WC+[\/:])*)/.source.replace("WC",QE),gTt=/(WCOD+)?/.source.replace("WCOD",fTt),ETt=/(?:\.(WC+)(?:\[(.+)\])?)?/.source.replace("WC",QE),bTt=/\.(WC+)(?:\[(.+)\])?/.source.replace("WC",QE),STt=new RegExp("^"+mTt+gTt+ETt+bTt+"$"),yTt=["material","materials","bones","map"];class vTt{constructor(e,t,i){const r=i||Dt.parseTrackName(t);this._targetGroup=e,this._bindings=e.subscribe_(t,r)}getValue(e,t){this.bind();const i=this._targetGroup.nCachedObjects_,r=this._bindings[i];r!==void 0&&r.getValue(e,t)}setValue(e,t){const i=this._bindings;for(let r=this._targetGroup.nCachedObjects_,s=i.length;r!==s;++r)i[r].setValue(e,t)}bind(){const e=this._bindings;for(let t=this._targetGroup.nCachedObjects_,i=e.length;t!==i;++t)e[t].bind()}unbind(){const e=this._bindings;for(let t=this._targetGroup.nCachedObjects_,i=e.length;t!==i;++t)e[t].unbind()}}class Dt{constructor(e,t,i){this.path=t,this.parsedPath=i||Dt.parseTrackName(t),this.node=Dt.findNode(e,this.parsedPath.nodeName),this.rootNode=e,this.getValue=this._getValue_unbound,this.setValue=this._setValue_unbound}static create(e,t,i){return e&&e.isAnimationObjectGroup?new Dt.Composite(e,t,i):new Dt(e,t,i)}static sanitizeNodeName(e){return e.replace(/\s/g,"_").replace(hTt,"")}static parseTrackName(e){const t=STt.exec(e);if(t===null)throw new Error("PropertyBinding: Cannot parse trackName: "+e);const i={nodeName:t[2],objectName:t[3],objectIndex:t[4],propertyName:t[5],propertyIndex:t[6]},r=i.nodeName&&i.nodeName.lastIndexOf(".");if(r!==void 0&&r!==-1){const s=i.nodeName.substring(r+1);yTt.indexOf(s)!==-1&&(i.nodeName=i.nodeName.substring(0,r),i.objectName=s)}if(i.propertyName===null||i.propertyName.length===0)throw new Error("PropertyBinding: can not parse propertyName from trackName: "+e);return i}static findNode(e,t){if(t===void 0||t===""||t==="."||t===-1||t===e.name||t===e.uuid)return e;if(e.skeleton){const i=e.skeleton.getBoneByName(t);if(i!==void 0)return i}if(e.children){const i=function(s){for(let o=0;o=2.0 are supported."));return}const c=new t0t(s,{path:t||this.resourcePath||"",crossOrigin:this.crossOrigin,requestHeader:this.requestHeader,manager:this.manager,ktx2Loader:this.ktx2Loader,meshoptDecoder:this.meshoptDecoder});c.fileLoader.setRequestHeader(this.requestHeader);for(let d=0;d=0&&a[u]===void 0&&console.warn('THREE.GLTFLoader: Unknown extension "'+u+'".')}}c.setExtensions(o),c.setPlugins(a),c.parse(i,r)}parseAsync(e,t){const i=this;return new Promise(function(r,s){i.parse(e,t,r,s)})}}function xTt(){let n={};return{get:function(e){return n[e]},add:function(e,t){n[e]=t},remove:function(e){delete n[e]},removeAll:function(){n={}}}}const yt={KHR_BINARY_GLTF:"KHR_binary_glTF",KHR_DRACO_MESH_COMPRESSION:"KHR_draco_mesh_compression",KHR_LIGHTS_PUNCTUAL:"KHR_lights_punctual",KHR_MATERIALS_CLEARCOAT:"KHR_materials_clearcoat",KHR_MATERIALS_IOR:"KHR_materials_ior",KHR_MATERIALS_SHEEN:"KHR_materials_sheen",KHR_MATERIALS_SPECULAR:"KHR_materials_specular",KHR_MATERIALS_TRANSMISSION:"KHR_materials_transmission",KHR_MATERIALS_IRIDESCENCE:"KHR_materials_iridescence",KHR_MATERIALS_ANISOTROPY:"KHR_materials_anisotropy",KHR_MATERIALS_UNLIT:"KHR_materials_unlit",KHR_MATERIALS_VOLUME:"KHR_materials_volume",KHR_TEXTURE_BASISU:"KHR_texture_basisu",KHR_TEXTURE_TRANSFORM:"KHR_texture_transform",KHR_MESH_QUANTIZATION:"KHR_mesh_quantization",KHR_MATERIALS_EMISSIVE_STRENGTH:"KHR_materials_emissive_strength",EXT_MATERIALS_BUMP:"EXT_materials_bump",EXT_TEXTURE_WEBP:"EXT_texture_webp",EXT_TEXTURE_AVIF:"EXT_texture_avif",EXT_MESHOPT_COMPRESSION:"EXT_meshopt_compression",EXT_MESH_GPU_INSTANCING:"EXT_mesh_gpu_instancing"};class CTt{constructor(e){this.parser=e,this.name=yt.KHR_LIGHTS_PUNCTUAL,this.cache={refs:{},uses:{}}}_markDefs(){const e=this.parser,t=this.parser.json.nodes||[];for(let i=0,r=t.length;i=0)throw new Error("THREE.GLTFLoader: setKTX2Loader must be called before loading KTX2 textures");return null}return t.loadTextureImage(e,s.source,o)}}class FTt{constructor(e){this.parser=e,this.name=yt.EXT_TEXTURE_WEBP,this.isSupported=null}loadTexture(e){const t=this.name,i=this.parser,r=i.json,s=r.textures[e];if(!s.extensions||!s.extensions[t])return null;const o=s.extensions[t],a=r.images[o.source];let l=i.textureLoader;if(a.uri){const c=i.options.manager.getHandler(a.uri);c!==null&&(l=c)}return this.detectSupport().then(function(c){if(c)return i.loadTextureImage(e,o.source,l);if(r.extensionsRequired&&r.extensionsRequired.indexOf(t)>=0)throw new Error("THREE.GLTFLoader: WebP required by asset but unsupported.");return i.loadTexture(e)})}detectSupport(){return this.isSupported||(this.isSupported=new Promise(function(e){const t=new Image;t.src="data:image/webp;base64,UklGRiIAAABXRUJQVlA4IBYAAAAwAQCdASoBAAEADsD+JaQAA3AAAAAA",t.onload=t.onerror=function(){e(t.height===1)}})),this.isSupported}}class BTt{constructor(e){this.parser=e,this.name=yt.EXT_TEXTURE_AVIF,this.isSupported=null}loadTexture(e){const t=this.name,i=this.parser,r=i.json,s=r.textures[e];if(!s.extensions||!s.extensions[t])return null;const o=s.extensions[t],a=r.images[o.source];let l=i.textureLoader;if(a.uri){const c=i.options.manager.getHandler(a.uri);c!==null&&(l=c)}return this.detectSupport().then(function(c){if(c)return i.loadTextureImage(e,o.source,l);if(r.extensionsRequired&&r.extensionsRequired.indexOf(t)>=0)throw new Error("THREE.GLTFLoader: AVIF required by asset but unsupported.");return i.loadTexture(e)})}detectSupport(){return this.isSupported||(this.isSupported=new Promise(function(e){const t=new Image;t.src="data:image/avif;base64,AAAAIGZ0eXBhdmlmAAAAAGF2aWZtaWYxbWlhZk1BMUIAAADybWV0YQAAAAAAAAAoaGRscgAAAAAAAAAAcGljdAAAAAAAAAAAAAAAAGxpYmF2aWYAAAAADnBpdG0AAAAAAAEAAAAeaWxvYwAAAABEAAABAAEAAAABAAABGgAAABcAAAAoaWluZgAAAAAAAQAAABppbmZlAgAAAAABAABhdjAxQ29sb3IAAAAAamlwcnAAAABLaXBjbwAAABRpc3BlAAAAAAAAAAEAAAABAAAAEHBpeGkAAAAAAwgICAAAAAxhdjFDgQAMAAAAABNjb2xybmNseAACAAIABoAAAAAXaXBtYQAAAAAAAAABAAEEAQKDBAAAAB9tZGF0EgAKCBgABogQEDQgMgkQAAAAB8dSLfI=",t.onload=t.onerror=function(){e(t.height===1)}})),this.isSupported}}class GTt{constructor(e){this.name=yt.EXT_MESHOPT_COMPRESSION,this.parser=e}loadBufferView(e){const t=this.parser.json,i=t.bufferViews[e];if(i.extensions&&i.extensions[this.name]){const r=i.extensions[this.name],s=this.parser.getDependency("buffer",r.buffer),o=this.parser.options.meshoptDecoder;if(!o||!o.supported){if(t.extensionsRequired&&t.extensionsRequired.indexOf(this.name)>=0)throw new Error("THREE.GLTFLoader: setMeshoptDecoder must be called before loading compressed files");return null}return s.then(function(a){const l=r.byteOffset||0,c=r.byteLength||0,d=r.count,u=r.byteStride,_=new Uint8Array(a,l,c);return o.decodeGltfBufferAsync?o.decodeGltfBufferAsync(d,u,_,r.mode,r.filter).then(function(f){return f.buffer}):o.ready.then(function(){const f=new ArrayBuffer(d*u);return o.decodeGltfBuffer(new Uint8Array(f),d,u,_,r.mode,r.filter),f})})}else return null}}class zTt{constructor(e){this.name=yt.EXT_MESH_GPU_INSTANCING,this.parser=e}createNodeMesh(e){const t=this.parser.json,i=t.nodes[e];if(!i.extensions||!i.extensions[this.name]||i.mesh===void 0)return null;const r=t.meshes[i.mesh];for(const c of r.primitives)if(c.mode!==Yn.TRIANGLES&&c.mode!==Yn.TRIANGLE_STRIP&&c.mode!==Yn.TRIANGLE_FAN&&c.mode!==void 0)return null;const o=i.extensions[this.name].attributes,a=[],l={};for(const c in o)a.push(this.parser.getDependency("accessor",o[c]).then(d=>(l[c]=d,l[c])));return a.length<1?null:(a.push(this.parser.createNodeMesh(e)),Promise.all(a).then(c=>{const d=c.pop(),u=d.isGroup?d.children:[d],_=c[0].count,f=[];for(const h of u){const E=new gt,g=new ue,m=new Xr,b=new ue(1,1,1),S=new qvt(h.geometry,h.material,_);for(let v=0;v<_;v++)l.TRANSLATION&&g.fromBufferAttribute(l.TRANSLATION,v),l.ROTATION&&m.fromBufferAttribute(l.ROTATION,v),l.SCALE&&b.fromBufferAttribute(l.SCALE,v),S.setMatrixAt(v,E.compose(g,m,b));for(const v in l)if(v==="_COLOR_0"){const T=l[v];S.instanceColor=new sg(T.array,T.itemSize,T.normalized)}else v!=="TRANSLATION"&&v!=="ROTATION"&&v!=="SCALE"&&h.geometry.setAttribute(v,l[v]);Yt.prototype.copy.call(S,h),this.parser.assignFinalMaterial(S),f.push(S)}return d.isGroup?(d.clear(),d.add(...f),d):f[0]}))}}const wO="glTF",za=12,cR={JSON:1313821514,BIN:5130562};class VTt{constructor(e){this.name=yt.KHR_BINARY_GLTF,this.content=null,this.body=null;const t=new DataView(e,0,za),i=new TextDecoder;if(this.header={magic:i.decode(new Uint8Array(e.slice(0,4))),version:t.getUint32(4,!0),length:t.getUint32(8,!0)},this.header.magic!==wO)throw new Error("THREE.GLTFLoader: Unsupported glTF-Binary header.");if(this.header.version<2)throw new Error("THREE.GLTFLoader: Legacy binary file detected.");const r=this.header.length-za,s=new DataView(e,za);let o=0;for(;o0||n.search(/^data\:image\/jpeg/)===0?"image/jpeg":n.search(/\.webp($|\?)/i)>0||n.search(/^data\:image\/webp/)===0?"image/webp":"image/png"}const e0t=new gt;class t0t{constructor(e={},t={}){this.json=e,this.extensions={},this.plugins={},this.options=t,this.cache=new xTt,this.associations=new Map,this.primitiveCache={},this.nodeCache={},this.meshCache={refs:{},uses:{}},this.cameraCache={refs:{},uses:{}},this.lightCache={refs:{},uses:{}},this.sourceCache={},this.textureCache={},this.nodeNamesUsed={};let i=!1,r=!1,s=-1;typeof navigator<"u"&&(i=/^((?!chrome|android).)*safari/i.test(navigator.userAgent)===!0,r=navigator.userAgent.indexOf("Firefox")>-1,s=r?navigator.userAgent.match(/Firefox\/([0-9]+)\./)[1]:-1),typeof createImageBitmap>"u"||i||r&&s<98?this.textureLoader=new RO(this.options.manager):this.textureLoader=new pTt(this.options.manager),this.textureLoader.setCrossOrigin(this.options.crossOrigin),this.textureLoader.setRequestHeader(this.options.requestHeader),this.fileLoader=new CO(this.options.manager),this.fileLoader.setResponseType("arraybuffer"),this.options.crossOrigin==="use-credentials"&&this.fileLoader.setWithCredentials(!0)}setExtensions(e){this.extensions=e}setPlugins(e){this.plugins=e}parse(e,t){const i=this,r=this.json,s=this.extensions;this.cache.removeAll(),this.nodeCache={},this._invokeAll(function(o){return o._markDefs&&o._markDefs()}),Promise.all(this._invokeAll(function(o){return o.beforeRoot&&o.beforeRoot()})).then(function(){return Promise.all([i.getDependencies("scene"),i.getDependencies("animation"),i.getDependencies("camera")])}).then(function(o){const a={scene:o[0][r.scene||0],scenes:o[0],animations:o[1],cameras:o[2],asset:r.asset,parser:i,userData:{}};return ds(s,a,r),Lr(a,r),Promise.all(i._invokeAll(function(l){return l.afterRoot&&l.afterRoot(a)})).then(function(){e(a)})}).catch(t)}_markDefs(){const e=this.json.nodes||[],t=this.json.skins||[],i=this.json.meshes||[];for(let r=0,s=t.length;r{const l=this.associations.get(o);l!=null&&this.associations.set(a,l);for(const[c,d]of o.children.entries())s(d,a.children[c])};return s(i,r),r.name+="_instance_"+e.uses[t]++,r}_invokeOne(e){const t=Object.values(this.plugins);t.push(this);for(let i=0;i=2&&g.setY(y,C[N*l+1]),l>=3&&g.setZ(y,C[N*l+2]),l>=4&&g.setW(y,C[N*l+3]),l>=5)throw new Error("THREE.GLTFLoader: Unsupported itemSize in sparse BufferAttribute.")}}return g})}loadTexture(e){const t=this.json,i=this.options,s=t.textures[e].source,o=t.images[s];let a=this.textureLoader;if(o.uri){const l=i.manager.getHandler(o.uri);l!==null&&(a=l)}return this.loadTextureImage(e,s,a)}loadTextureImage(e,t,i){const r=this,s=this.json,o=s.textures[e],a=s.images[t],l=(a.uri||a.bufferView)+":"+o.sampler;if(this.textureCache[l])return this.textureCache[l];const c=this.loadImageSource(t,i).then(function(d){d.flipY=!1,d.name=o.name||a.name||"",d.name===""&&typeof a.uri=="string"&&a.uri.startsWith("data:image/")===!1&&(d.name=a.uri);const _=(s.samplers||{})[o.sampler]||{};return d.magFilter=dR[_.magFilter]||Mn,d.minFilter=dR[_.minFilter]||ks,d.wrapS=uR[_.wrapS]||Xo,d.wrapT=uR[_.wrapT]||Xo,r.associations.set(d,{textures:e}),d}).catch(function(){return null});return this.textureCache[l]=c,c}loadImageSource(e,t){const i=this,r=this.json,s=this.options;if(this.sourceCache[e]!==void 0)return this.sourceCache[e].then(u=>u.clone());const o=r.images[e],a=self.URL||self.webkitURL;let l=o.uri||"",c=!1;if(o.bufferView!==void 0)l=i.getDependency("bufferView",o.bufferView).then(function(u){c=!0;const _=new Blob([u],{type:o.mimeType});return l=a.createObjectURL(_),l});else if(o.uri===void 0)throw new Error("THREE.GLTFLoader: Image "+e+" is missing URI and bufferView");const d=Promise.resolve(l).then(function(u){return new Promise(function(_,f){let h=_;t.isImageBitmapLoader===!0&&(h=function(E){const g=new pn(E);g.needsUpdate=!0,_(g)}),t.load(rl.resolveURL(u,s.path),h,void 0,f)})}).then(function(u){return c===!0&&a.revokeObjectURL(l),u.userData.mimeType=o.mimeType||JTt(o.uri),u}).catch(function(u){throw console.error("THREE.GLTFLoader: Couldn't load texture",l),u});return this.sourceCache[e]=d,d}assignTexture(e,t,i,r){const s=this;return this.getDependency("texture",i.index).then(function(o){if(!o)return null;if(i.texCoord!==void 0&&i.texCoord>0&&(o=o.clone(),o.channel=i.texCoord),s.extensions[yt.KHR_TEXTURE_TRANSFORM]){const a=i.extensions!==void 0?i.extensions[yt.KHR_TEXTURE_TRANSFORM]:void 0;if(a){const l=s.associations.get(o);o=s.extensions[yt.KHR_TEXTURE_TRANSFORM].extendTexture(o,a),s.associations.set(o,l)}}return r!==void 0&&(o.colorSpace=r),e[t]=o,o})}assignFinalMaterial(e){const t=e.geometry;let i=e.material;const r=t.attributes.tangent===void 0,s=t.attributes.color!==void 0,o=t.attributes.normal===void 0;if(e.isPoints){const a="PointsMaterial:"+i.uuid;let l=this.cache.get(a);l||(l=new vO,mi.prototype.copy.call(l,i),l.color.copy(i.color),l.map=i.map,l.sizeAttenuation=!1,this.cache.add(a,l)),i=l}else if(e.isLine){const a="LineBasicMaterial:"+i.uuid;let l=this.cache.get(a);l||(l=new yO,mi.prototype.copy.call(l,i),l.color.copy(i.color),l.map=i.map,this.cache.add(a,l)),i=l}if(r||s||o){let a="ClonedMaterial:"+i.uuid+":";r&&(a+="derivative-tangents:"),s&&(a+="vertex-colors:"),o&&(a+="flat-shading:");let l=this.cache.get(a);l||(l=i.clone(),s&&(l.vertexColors=!0),o&&(l.flatShading=!0),r&&(l.normalScale&&(l.normalScale.y*=-1),l.clearcoatNormalScale&&(l.clearcoatNormalScale.y*=-1)),this.cache.add(a,l),this.associations.set(l,this.associations.get(i))),i=l}e.material=i}getMaterialType(){return WE}loadMaterial(e){const t=this,i=this.json,r=this.extensions,s=i.materials[e];let o;const a={},l=s.extensions||{},c=[];if(l[yt.KHR_MATERIALS_UNLIT]){const u=r[yt.KHR_MATERIALS_UNLIT];o=u.getMaterialType(),c.push(u.extendParams(a,s,t))}else{const u=s.pbrMetallicRoughness||{};if(a.color=new ot(1,1,1),a.opacity=1,Array.isArray(u.baseColorFactor)){const _=u.baseColorFactor;a.color.setRGB(_[0],_[1],_[2],hn),a.opacity=_[3]}u.baseColorTexture!==void 0&&c.push(t.assignTexture(a,"map",u.baseColorTexture,Kt)),a.metalness=u.metallicFactor!==void 0?u.metallicFactor:1,a.roughness=u.roughnessFactor!==void 0?u.roughnessFactor:1,u.metallicRoughnessTexture!==void 0&&(c.push(t.assignTexture(a,"metalnessMap",u.metallicRoughnessTexture)),c.push(t.assignTexture(a,"roughnessMap",u.metallicRoughnessTexture))),o=this._invokeOne(function(_){return _.getMaterialType&&_.getMaterialType(e)}),c.push(Promise.all(this._invokeAll(function(_){return _.extendMaterialParams&&_.extendMaterialParams(e,a)})))}s.doubleSided===!0&&(a.side=xi);const d=s.alphaMode||cm.OPAQUE;if(d===cm.BLEND?(a.transparent=!0,a.depthWrite=!1):(a.transparent=!1,d===cm.MASK&&(a.alphaTest=s.alphaCutoff!==void 0?s.alphaCutoff:.5)),s.normalTexture!==void 0&&o!==Fr&&(c.push(t.assignTexture(a,"normalMap",s.normalTexture)),a.normalScale=new vt(1,1),s.normalTexture.scale!==void 0)){const u=s.normalTexture.scale;a.normalScale.set(u,u)}if(s.occlusionTexture!==void 0&&o!==Fr&&(c.push(t.assignTexture(a,"aoMap",s.occlusionTexture)),s.occlusionTexture.strength!==void 0&&(a.aoMapIntensity=s.occlusionTexture.strength)),s.emissiveFactor!==void 0&&o!==Fr){const u=s.emissiveFactor;a.emissive=new ot().setRGB(u[0],u[1],u[2],hn)}return s.emissiveTexture!==void 0&&o!==Fr&&c.push(t.assignTexture(a,"emissiveMap",s.emissiveTexture,Kt)),Promise.all(c).then(function(){const u=new o(a);return s.name&&(u.name=s.name),Lr(u,s),t.associations.set(u,{materials:e}),s.extensions&&ds(r,u,s),u})}createUniqueName(e){const t=Dt.sanitizeNodeName(e||"");return t in this.nodeNamesUsed?t+"_"+ ++this.nodeNamesUsed[t]:(this.nodeNamesUsed[t]=0,t)}loadGeometries(e){const t=this,i=this.extensions,r=this.primitiveCache;function s(a){return i[yt.KHR_DRACO_MESH_COMPRESSION].decodePrimitive(a,t).then(function(l){return _R(l,a,t)})}const o=[];for(let a=0,l=e.length;a0&&XTt(m,s),m.name=t.createUniqueName(s.name||"mesh_"+e),Lr(m,s),g.extensions&&ds(r,m,g),t.assignFinalMaterial(m),u.push(m)}for(let f=0,h=u.length;f1?d=new Ts:c.length===1?d=c[0]:d=new Yt,d!==c[0])for(let u=0,_=c.length;u<_;u++)d.add(c[u]);if(s.name&&(d.userData.name=s.name,d.name=o),Lr(d,s),s.extensions&&ds(i,d,s),s.matrix!==void 0){const u=new gt;u.fromArray(s.matrix),d.applyMatrix4(u)}else s.translation!==void 0&&d.position.fromArray(s.translation),s.rotation!==void 0&&d.quaternion.fromArray(s.rotation),s.scale!==void 0&&d.scale.fromArray(s.scale);return r.associations.has(d)||r.associations.set(d,{}),r.associations.get(d).nodes=e,d}),this.nodeCache[e]}loadScene(e){const t=this.extensions,i=this.json.scenes[e],r=this,s=new Ts;i.name&&(s.name=r.createUniqueName(i.name)),Lr(s,i),i.extensions&&ds(t,s,i);const o=i.nodes||[],a=[];for(let l=0,c=o.length;l{const u=new Map;for(const[_,f]of r.associations)(_ instanceof mi||_ instanceof pn)&&u.set(_,f);return d.traverse(_=>{const f=r.associations.get(_);f!=null&&u.set(_,f)}),u};return r.associations=c(s),s})}_createAnimationTracks(e,t,i,r,s){const o=[],a=e.name?e.name:e.uuid,l=[];Cr[s.path]===Cr.weights?e.traverse(function(_){_.morphTargetInfluences&&l.push(_.name?_.name:_.uuid)}):l.push(a);let c;switch(Cr[s.path]){case Cr.weights:c=na;break;case Cr.rotation:c=Fs;break;case Cr.position:case Cr.scale:c=ia;break;default:switch(i.itemSize){case 1:c=na;break;case 2:case 3:default:c=ia;break}break}const d=r.interpolation!==void 0?KTt[r.interpolation]:Jo,u=this._getArrayFromAccessor(i);for(let _=0,f=l.length;_{Ge.replace()})},stopVideoStream(){this.isVideoActive=!1,this.imageData=null,He.emit("stop_webcam_video_stream"),Ue(()=>{Ge.replace()})},startDrag(n){this.isDragging=!0,this.zIndex=5001,this.dragStart.x=n.clientX,this.dragStart.y=n.clientY,document.addEventListener("mousemove",this.drag),document.addEventListener("mouseup",this.stopDrag)},drag(n){if(this.isDragging){const e=n.clientX-this.dragStart.x,t=n.clientY-this.dragStart.y;this.position.bottom-=t,this.position.right-=e,this.dragStart.x=n.clientX,this.dragStart.y=n.clientY}},stopDrag(){this.isDragging=!1,this.zIndex=0,document.removeEventListener("mousemove",this.drag),document.removeEventListener("mouseup",this.stopDrag)}},mounted(){Ge.replace(),He.on("video_stream_image",n=>{if(this.isVideoActive){this.imageDataUrl="data:image/jpeg;base64,"+n,this.frameCount++;const e=Date.now();e-this.lastFrameTime>=1e3&&(this.frameRate=this.frameCount,this.frameCount=0,this.lastFrameTime=e)}})}},r0t=["src"],s0t=["src"],o0t={class:"controls"},a0t=p("i",{"data-feather":"video"},null,-1),l0t=[a0t],c0t=p("i",{"data-feather":"video"},null,-1),d0t=[c0t],u0t={key:2};function _0t(n,e,t,i,r,s){return M(),L("div",{class:"floating-frame bg-white",style:un({bottom:r.position.bottom+"px",right:r.position.right+"px","z-index":r.zIndex}),onMousedown:e[4]||(e[4]=Oe((...o)=>s.startDrag&&s.startDrag(...o),["stop"])),onMouseup:e[5]||(e[5]=Oe((...o)=>s.stopDrag&&s.stopDrag(...o),["stop"]))},[p("div",{class:"handle",onMousedown:e[0]||(e[0]=Oe((...o)=>s.startDrag&&s.startDrag(...o),["stop"])),onMouseup:e[1]||(e[1]=Oe((...o)=>s.stopDrag&&s.stopDrag(...o),["stop"]))},"Drag Me",32),r.isVideoActive&&r.imageDataUrl!=null?(M(),L("img",{key:0,src:r.imageDataUrl,alt:"Webcam Frame",width:"300",height:"300"},null,8,r0t)):X("",!0),r.isVideoActive&&r.imageDataUrl==null?(M(),L("p",{key:1,src:r.imageDataUrl,alt:"Webcam Frame",width:"300",height:"300"},"Loading. Please wait...",8,s0t)):X("",!0),p("div",o0t,[r.isVideoActive?X("",!0):(M(),L("button",{key:0,class:"bg-green-500 hover:bg-green-700 text-white font-bold py-2 px-4 rounded",onClick:e[2]||(e[2]=(...o)=>s.startVideoStream&&s.startVideoStream(...o))},l0t)),r.isVideoActive?(M(),L("button",{key:1,class:"bg-red-500 hover:bg-red-700 text-white font-bold py-2 px-4 rounded",onClick:e[3]||(e[3]=(...o)=>s.stopVideoStream&&s.stopVideoStream(...o))},d0t)):X("",!0),r.isVideoActive?(M(),L("span",u0t,"FPS: "+me(r.frameRate),1)):X("",!0)])],36)}const p0t=ft(i0t,[["render",_0t]]);const h0t={data(){return{isAudioActive:!1,imageDataUrl:null,isDragging:!1,position:{bottom:0,right:0},dragStart:{x:0,y:0},zIndex:0,frameRate:0,frameCount:0,lastFrameTime:Date.now()}},methods:{startAudioStream(){this.isAudioActive=!0,He.emit("start_audio_stream"),Ue(()=>{Ge.replace()})},stopAudioStream(){this.isAudioActive=!1,this.imageDataUrl=null,He.emit("stop_audio_stream"),Ue(()=>{Ge.replace()})},startDrag(n){this.isDragging=!0,this.zIndex=5001,this.dragStart.x=n.clientX,this.dragStart.y=n.clientY,document.addEventListener("mousemove",this.drag),document.addEventListener("mouseup",this.stopDrag)},drag(n){if(this.isDragging){const e=n.clientX-this.dragStart.x,t=n.clientY-this.dragStart.y;this.position.bottom-=t,this.position.right-=e,this.dragStart.x=n.clientX,this.dragStart.y=n.clientY}},stopDrag(){this.isDragging=!1,this.zIndex=0,document.removeEventListener("mousemove",this.drag),document.removeEventListener("mouseup",this.stopDrag)}},mounted(){Ge.replace(),He.on("update_spectrogram",n=>{if(this.isAudioActive){this.imageDataUrl="data:image/jpeg;base64,"+n,this.frameCount++;const e=Date.now();e-this.lastFrameTime>=1e3&&(this.frameRate=this.frameCount,this.frameCount=0,this.lastFrameTime=e)}})}},f0t=["src"],m0t={class:"controls"},g0t=p("i",{"data-feather":"mic"},null,-1),E0t=[g0t],b0t=p("i",{"data-feather":"mic"},null,-1),S0t=[b0t],y0t={key:2};function v0t(n,e,t,i,r,s){return M(),L("div",{class:"floating-frame bg-white",style:un({bottom:r.position.bottom+"px",right:r.position.right+"px","z-index":r.zIndex}),onMousedown:e[4]||(e[4]=Oe((...o)=>s.startDrag&&s.startDrag(...o),["stop"])),onMouseup:e[5]||(e[5]=Oe((...o)=>s.stopDrag&&s.stopDrag(...o),["stop"]))},[p("div",{class:"handle",onMousedown:e[0]||(e[0]=Oe((...o)=>s.startDrag&&s.startDrag(...o),["stop"])),onMouseup:e[1]||(e[1]=Oe((...o)=>s.stopDrag&&s.stopDrag(...o),["stop"]))},"Drag Me",32),r.isAudioActive&&r.imageDataUrl!=null?(M(),L("img",{key:0,src:r.imageDataUrl,alt:"Spectrogram",width:"300",height:"300"},null,8,f0t)):X("",!0),p("div",m0t,[r.isAudioActive?X("",!0):(M(),L("button",{key:0,class:"bg-green-500 hover:bg-green-700 text-white font-bold py-2 px-4 rounded",onClick:e[2]||(e[2]=(...o)=>s.startAudioStream&&s.startAudioStream(...o))},E0t)),r.isAudioActive?(M(),L("button",{key:1,class:"bg-red-500 hover:bg-red-700 text-white font-bold py-2 px-4 rounded",onClick:e[3]||(e[3]=(...o)=>s.stopAudioStream&&s.stopAudioStream(...o))},S0t)):X("",!0),r.isAudioActive?(M(),L("span",y0t,"FPS: "+me(r.frameRate),1)):X("",!0)])],36)}const T0t=ft(h0t,[["render",v0t]]);const x0t={data(){return{activePersonality:null}},props:{personality:{type:Object,default:()=>({})}},components:{VideoFrame:p0t,AudioFrame:T0t},computed:{isReady:{get(){return this.$store.state.ready}}},watch:{"$store.state.mountedPersArr":"updatePersonality","$store.state.config.active_personality_id":"updatePersonality"},async mounted(){for(;this.isReady===!1;)await new Promise(n=>setTimeout(n,100));console.log("Personality:",this.personality),this.initWebGLScene(),this.updatePersonality(),Ue(()=>{Ge.replace()}),this.$refs.video_frame.position={bottom:0,right:0},this.$refs.audio_frame.position={bottom:0,right:100}},beforeDestroy(){},methods:{initWebGLScene(){this.scene=new Uvt,this.camera=new Rn(75,window.innerWidth/window.innerHeight,.1,1e3),this.renderer=new bO,this.renderer.setSize(window.innerWidth,window.innerHeight),this.$refs.webglContainer.appendChild(this.renderer.domElement);const n=new $r,e=new iR({color:65280});this.cube=new An(n,e),this.scene.add(this.cube);const t=new _Tt(4210752),i=new AO(16777215,.5);i.position.set(0,1,0),this.scene.add(t),this.scene.add(i),this.camera.position.z=5,this.animate()},updatePersonality(){const{mountedPersArr:n,config:e}=this.$store.state;this.activePersonality=n[e.active_personality_id],this.activePersonality.avatar?this.showBoxWithAvatar(this.activePersonality.avatar):this.showDefaultCube(),this.$emit("update:personality",this.activePersonality)},loadScene(n){new TTt().load(n,t=>{this.scene.remove(this.cube),this.cube=t.scene,this.scene.add(this.cube)})},showBoxWithAvatar(n){this.cube&&this.scene.remove(this.cube);const e=new $r,t=new RO().load(n),i=new Fr({map:t});this.cube=new An(e,i),this.scene.add(this.cube)},showDefaultCube(){this.scene.remove(this.cube);const n=new $r,e=new iR({color:65280});this.cube=new An(n,e),this.scene.add(this.cube)},animate(){requestAnimationFrame(this.animate),this.cube&&(this.cube.rotation.x+=.01,this.cube.rotation.y+=.01),this.renderer.render(this.scene,this.camera)}}},C0t={ref:"webglContainer"},R0t={class:"flex-col y-overflow scrollbar-thin scrollbar-track-bg-light-tone scrollbar-thumb-bg-light-tone-panel hover:scrollbar-thumb-primary dark:scrollbar-track-bg-dark-tone dark:scrollbar-thumb-bg-dark-tone-panel dark:hover:scrollbar-thumb-primary active:scrollbar-thumb-secondary"},A0t={key:0,class:"text-center"},w0t={key:1,class:"text-center"},O0t={class:"floating-frame2"},N0t=["innerHTML"];function M0t(n,e,t,i,r,s){const o=St("VideoFrame"),a=St("AudioFrame");return M(),L(Xe,null,[p("div",C0t,null,512),p("div",R0t,[!r.activePersonality||!r.activePersonality.scene_path?(M(),L("div",A0t," Personality does not have a 3d avatar. ")):X("",!0),!r.activePersonality||!r.activePersonality.avatar||r.activePersonality.avatar===""?(M(),L("div",w0t," Personality does not have an avatar. ")):X("",!0),p("div",O0t,[p("div",{innerHTML:n.htmlContent},null,8,N0t)])]),Le(o,{ref:"video_frame"},null,512),Le(a,{ref:"audio_frame"},null,512)],64)}const I0t=ft(x0t,[["render",M0t]]),D0t=oL({history:x2("/"),routes:[{path:"/playground/",name:"playground",component:GQe},{path:"/extensions/",name:"extensions",component:XQe},{path:"/help/",name:"help",component:gXe},{path:"/settings/",name:"settings",component:Xlt},{path:"/training/",name:"training",component:Ect},{path:"/quantizing/",name:"quantizing",component:Act},{path:"/",name:"discussions",component:mmt},{path:"/",name:"interactive",component:I0t}]});const _u=mI(DU);console.log("Loaded main.js");function pR(n){const e={};for(const t in n)n.hasOwnProperty(t)&&(e[t]=n[t]);return e}const L0t=HI({state(){return{yesNoDialog:null,universalForm:null,toast:null,messageBox:null,api_get_req:null,startSpeechRecognition:null,ready:!1,loading_infos:"",loading_progress:0,version:"unknown",settingsChanged:!1,isConnected:!1,isModelOk:!1,isGenerating:!1,config:null,mountedPers:null,mountedPersArr:[],mountedExtensions:[],bindingsZoo:[],modelsArr:[],selectedModel:null,personalities:[],diskUsage:null,ramUsage:null,vramUsage:null,modelsZoo:[],installedModels:[],currentModel:null,extensionsZoo:[],databases:[]}},mutations:{setIsReady(n,e){n.ready=e},setIsConnected(n,e){n.isConnected=e},setIsModelOk(n,e){n.isModelOk=e},setIsGenerating(n,e){n.isGenerating=e},setConfig(n,e){n.config=e},setPersonalities(n,e){n.personalities=e},setMountedPers(n,e){n.mountedPers=e},setMountedPersArr(n,e){n.mountedPersArr=e},setMountedExtensions(n,e){n.mountedExtensions=e},setbindingsZoo(n,e){n.bindingsZoo=e},setModelsArr(n,e){n.modelsArr=e},setselectedModel(n,e){n.selectedModel=e},setDiskUsage(n,e){n.diskUsage=e},setRamUsage(n,e){n.ramUsage=e},setVramUsage(n,e){n.vramUsage=e},setModelsZoo(n,e){n.modelsZoo=e},setCurrentModel(n,e){n.currentModel=e},setExtensionsZoo(n,e){n.extensionsZoo=e},setDatabases(n,e){n.databases=e}},getters:{getIsConnected(n){return n.isConnected},getIsModelOk(n){return n.isModelOk},getIsGenerating(n){return n.isGenerating},getConfig(n){return n.config},getPersonalities(n){return n.personalities},getMountedPersArr(n){return n.mountedPersArr},getmmountedExtensions(n){return n.mountedExtensions},getMountedPers(n){return n.mountedPers},getbindingsZoo(n){return n.bindingsZoo},getModelsArr(n){return n.modelsArr},getDiskUsage(n){return n.diskUsage},getRamUsage(n){return n.ramUsage},getVramUsage(n){return n.vramUsage},getDatabasesList(n){return n.databases},getModelsZoo(n){return n.modelsZoo},getCurrentModel(n){return n.currentModel},getExtensionsZoo(n){return n.extensionsZoo}},actions:{async getVersion(){try{let n=await Pe.get("/get_lollms_webui_version",{});n&&(this.state.version=n.data.version)}catch{console.log("Coudln't get version")}},async refreshConfig({commit:n}){console.log("Fetching configuration");try{const e=await Hn("get_config");e.active_personality_id<0&&(e.active_personality_id=0);let t=e.personalities[e.active_personality_id].split("/");e.personality_category=t[0],e.personality_folder=t[1],e.extensions.length>0?e.extension_category=e.extensions[-1]:e.extension_category="ai_sensors",console.log("Recovered config"),console.log(e),console.log("Committing config"),console.log(e),console.log(this.state.config),n("setConfig",e)}catch(e){console.log(e.message,"refreshConfig")}},async refreshDatabase({commit:n}){let e=await Hn("list_databases");console.log("databases:",e),n("setDatabases",e)},async refreshPersonalitiesZoo({commit:n}){let e=[];const t=await Hn("get_all_personalities"),i=Object.keys(t);console.log("Personalities recovered:"+this.state.config.personalities);for(let r=0;r{let c=!1;for(const u of this.state.config.personalities)if(u.includes(s+"/"+l.folder))if(c=!0,u.includes(":")){const _=u.split(":");l.language=_[1]}else l.language=null;let d={};return d=l,d.category=s,d.full_path=s+"/"+l.folder,d.isMounted=c,d});e.length==0?e=a:e=e.concat(a)}e.sort((r,s)=>r.name.localeCompare(s.name)),n("setPersonalities",e),console.log("Done loading personalities")},refreshMountedPersonalities({commit:n}){this.state.config.active_personality_id<0&&(this.state.config.active_personality_id=0);let e=[];const t=[];for(let i=0;ia.full_path==r||a.full_path==s[0]);if(o>=0){let a=pR(this.state.personalities[o]);s.length>1&&(a.language=s[1]),a?e.push(a):e.push(this.state.personalities[this.state.personalities.findIndex(l=>l.full_path=="generic/lollms")])}else t.push(i),console.log("Couldn't load personality : ",r)}for(let i=t.length-1;i>=0;i--)console.log("Removing personality : ",this.state.config.personalities[t[i]]),this.state.config.personalities.splice(t[i],1),this.state.config.active_personality_id>t[i]&&(this.state.config.active_personality_id-=1);n("setMountedPersArr",e),this.state.mountedPers=this.state.personalities[this.state.personalities.findIndex(i=>i.full_path==this.state.config.personalities[this.state.config.active_personality_id]||i.full_path+":"+i.language==this.state.config.personalities[this.state.config.active_personality_id])]},async refreshBindings({commit:n}){let e=await Hn("list_bindings");n("setbindingsZoo",e)},async refreshModelsZoo({commit:n}){console.log("Fetching models");const e=await Pe.get("/get_available_models");n("setModelsZoo",e.data.filter(t=>t.variants&&t.variants.length>0))},async refreshModelStatus({commit:n}){let e=await Hn("get_model_status");n("setIsModelOk",e.status)},async refreshModels({commit:n}){console.log("Fetching models");let e=await Hn("list_models");console.log(`Found ${e}`);let t=await Hn("get_active_model");console.log("Selected model ",t),t!=null&&n("setselectedModel",t.model),n("setModelsArr",e),console.log("setModelsArr",e),this.state.modelsZoo.map(r=>{r.isInstalled=e.includes(r.name)}),this.state.installedModels=this.state.modelsZoo.filter(r=>r.isInstalled);const i=this.state.modelsZoo.findIndex(r=>r.name==this.state.config.model_name);i!=-1&&n("setCurrentModel",this.state.modelsZoo[i])},async refreshExtensionsZoo({commit:n}){let e=[],t=await Hn("list_extensions");const i=Object.keys(t);console.log("Extensions recovered:"+t);for(let r=0;r{let c=!1;for(const u of this.state.config.extensions)u.includes(s+"/"+l.folder)&&(c=!0);let d={};return d=l,d.category=s,d.full_path=s+"/"+l.folder,d.isMounted=c,d});e.length==0?e=a:e=e.concat(a)}e.sort((r,s)=>r.name.localeCompare(s.name)),console.log("Done loading extensions"),n("setExtensionsZoo",e)},refreshmountedExtensions({commit:n}){console.log("Mounting extensions");let e=[];const t=[];for(let i=0;io.full_path==r);if(s>=0){let o=pR(this.state.config.extensions[s]);o&&e.push(o)}else t.push(i),console.log("Couldn't load extension : ",r)}for(let i=t.length-1;i>=0;i--)console.log("Removing extensions : ",this.state.config.extensions[t[i]]),this.state.config.extensions.splice(t[i],1);n("setMountedExtensions",e)},async refreshDiskUsage({commit:n}){this.state.diskUsage=await Hn("disk_usage")},async refreshRamUsage({commit:n}){this.state.ramUsage=await Hn("ram_usage")},async refreshVramUsage({commit:n}){const e=await Hn("vram_usage"),t=[];if(e.nb_gpus>0){for(let r=0;rd||r.y>d)&&(r.x>d&&(s.x=Math.floor(d/Y.x),r.x=s.x*Y.x,D.mapSize.x=s.x),r.y>d&&(s.y=Math.floor(d/Y.y),r.y=s.y*Y.y,D.mapSize.y=s.y)),D.map===null||k===!0||W===!0){const q=this.type!==Zi?{minFilter:an,magFilter:an}:{};D.map!==null&&D.map.dispose(),D.map=new Ps(r.x,r.y,q),D.map.texture.name=z.name+".shadowMap",D.camera.updateProjectionMatrix()}n.setRenderTarget(D.map),n.clear();const K=D.getViewportCount();for(let q=0;q0||C.map&&C.alphaTest>0){const P=y.uuid,k=C.uuid;let W=c[P];W===void 0&&(W={},c[P]=W);let I=W[k];I===void 0&&(I=y.clone(),W[k]=I),y=I}if(y.visible=C.visible,y.wireframe=C.wireframe,x===Zi?y.side=C.shadowSide!==null?C.shadowSide:C.side:y.side=C.shadowSide!==null?C.shadowSide:u[C.side],y.alphaMap=C.alphaMap,y.alphaTest=C.alphaTest,y.map=C.map,y.clipShadows=C.clipShadows,y.clippingPlanes=C.clippingPlanes,y.clipIntersection=C.clipIntersection,y.displacementMap=C.displacementMap,y.displacementScale=C.displacementScale,y.displacementBias=C.displacementBias,y.wireframeLinewidth=C.wireframeLinewidth,y.linewidth=C.linewidth,N.isPointLight===!0&&y.isMeshDistanceMaterial===!0){const P=n.properties.get(y);P.light=N}return y}function v(T,C,N,x,y){if(T.visible===!1)return;if(T.layers.test(C.layers)&&(T.isMesh||T.isLine||T.isPoints)&&(T.castShadow||T.receiveShadow&&y===Zi)&&(!T.frustumCulled||i.intersectsObject(T))){T.modelViewMatrix.multiplyMatrices(N.matrixWorldInverse,T.matrixWorld);const k=e.update(T),W=T.material;if(Array.isArray(W)){const I=k.groups;for(let V=0,z=I.length;V=1):q.indexOf("OpenGL ES")!==-1&&(K=parseFloat(/^OpenGL ES (\d)/.exec(q)[1]),Y=K>=2);let le=null,Z={};const J=n.getParameter(n.SCISSOR_BOX),_e=n.getParameter(n.VIEWPORT),he=new Pt().fromArray(J),ye=new Pt().fromArray(_e);function j(oe,Ve,De,Re){const ke=new Uint8Array(4),it=n.createTexture();n.bindTexture(oe,it),n.texParameteri(oe,n.TEXTURE_MIN_FILTER,n.NEAREST),n.texParameteri(oe,n.TEXTURE_MAG_FILTER,n.NEAREST);for(let _t=0;_t"u"?!1:/OculusBrowser/g.test(navigator.userAgent),h=new WeakMap;let E;const g=new WeakMap;let m=!1;try{m=typeof OffscreenCanvas<"u"&&new OffscreenCanvas(1,1).getContext("2d")!==null}catch{}function b(w,A){return m?new OffscreenCanvas(w,A):xl("canvas")}function S(w,A,G,ce){let $=1;if((w.width>ce||w.height>ce)&&($=ce/Math.max(w.width,w.height)),$<1||A===!0)if(typeof HTMLImageElement<"u"&&w instanceof HTMLImageElement||typeof HTMLCanvasElement<"u"&&w instanceof HTMLCanvasElement||typeof ImageBitmap<"u"&&w instanceof ImageBitmap){const ee=A?Ad:Math.floor,ve=ee($*w.width),Ee=ee($*w.height);E===void 0&&(E=b(ve,Ee));const Ie=G?b(ve,Ee):E;return Ie.width=ve,Ie.height=Ee,Ie.getContext("2d").drawImage(w,0,0,ve,Ee),console.warn("THREE.WebGLRenderer: Texture has been resized from ("+w.width+"x"+w.height+") to ("+ve+"x"+Ee+")."),Ie}else return"data"in w&&console.warn("THREE.WebGLRenderer: Image in DataTexture is too big ("+w.width+"x"+w.height+")."),w;return w}function v(w){return ig(w.width)&&ig(w.height)}function T(w){return a?!1:w.wrapS!==Kn||w.wrapT!==Kn||w.minFilter!==an&&w.minFilter!==Mn}function C(w,A){return w.generateMipmaps&&A&&w.minFilter!==an&&w.minFilter!==Mn}function N(w){n.generateMipmap(w)}function x(w,A,G,ce,$=!1){if(a===!1)return A;if(w!==null){if(n[w]!==void 0)return n[w];console.warn("THREE.WebGLRenderer: Attempt to use non-existing WebGL internal format '"+w+"'")}let ee=A;if(A===n.RED&&(G===n.FLOAT&&(ee=n.R32F),G===n.HALF_FLOAT&&(ee=n.R16F),G===n.UNSIGNED_BYTE&&(ee=n.R8)),A===n.RED_INTEGER&&(G===n.UNSIGNED_BYTE&&(ee=n.R8UI),G===n.UNSIGNED_SHORT&&(ee=n.R16UI),G===n.UNSIGNED_INT&&(ee=n.R32UI),G===n.BYTE&&(ee=n.R8I),G===n.SHORT&&(ee=n.R16I),G===n.INT&&(ee=n.R32I)),A===n.RG&&(G===n.FLOAT&&(ee=n.RG32F),G===n.HALF_FLOAT&&(ee=n.RG16F),G===n.UNSIGNED_BYTE&&(ee=n.RG8)),A===n.RGBA){const ve=$?Td:Nt.getTransfer(ce);G===n.FLOAT&&(ee=n.RGBA32F),G===n.HALF_FLOAT&&(ee=n.RGBA16F),G===n.UNSIGNED_BYTE&&(ee=ve===Gt?n.SRGB8_ALPHA8:n.RGBA8),G===n.UNSIGNED_SHORT_4_4_4_4&&(ee=n.RGBA4),G===n.UNSIGNED_SHORT_5_5_5_1&&(ee=n.RGB5_A1)}return(ee===n.R16F||ee===n.R32F||ee===n.RG16F||ee===n.RG32F||ee===n.RGBA16F||ee===n.RGBA32F)&&e.get("EXT_color_buffer_float"),ee}function y(w,A,G){return C(w,G)===!0||w.isFramebufferTexture&&w.minFilter!==an&&w.minFilter!==Mn?Math.log2(Math.max(A.width,A.height))+1:w.mipmaps!==void 0&&w.mipmaps.length>0?w.mipmaps.length:w.isCompressedTexture&&Array.isArray(w.image)?A.mipmaps.length:1}function R(w){return w===an||w===Jm||w===Qc?n.NEAREST:n.LINEAR}function P(w){const A=w.target;A.removeEventListener("dispose",P),W(A),A.isVideoTexture&&h.delete(A)}function k(w){const A=w.target;A.removeEventListener("dispose",k),V(A)}function W(w){const A=i.get(w);if(A.__webglInit===void 0)return;const G=w.source,ce=g.get(G);if(ce){const $=ce[A.__cacheKey];$.usedTimes--,$.usedTimes===0&&I(w),Object.keys(ce).length===0&&g.delete(G)}i.remove(w)}function I(w){const A=i.get(w);n.deleteTexture(A.__webglTexture);const G=w.source,ce=g.get(G);delete ce[A.__cacheKey],o.memory.textures--}function V(w){const A=w.texture,G=i.get(w),ce=i.get(A);if(ce.__webglTexture!==void 0&&(n.deleteTexture(ce.__webglTexture),o.memory.textures--),w.depthTexture&&w.depthTexture.dispose(),w.isWebGLCubeRenderTarget)for(let $=0;$<6;$++){if(Array.isArray(G.__webglFramebuffer[$]))for(let ee=0;ee=l&&console.warn("THREE.WebGLTextures: Trying to use "+w+" texture units while this GPU supports only "+l),z+=1,w}function K(w){const A=[];return A.push(w.wrapS),A.push(w.wrapT),A.push(w.wrapR||0),A.push(w.magFilter),A.push(w.minFilter),A.push(w.anisotropy),A.push(w.internalFormat),A.push(w.format),A.push(w.type),A.push(w.generateMipmaps),A.push(w.premultiplyAlpha),A.push(w.flipY),A.push(w.unpackAlignment),A.push(w.colorSpace),A.join()}function q(w,A){const G=i.get(w);if(w.isVideoTexture&&ne(w),w.isRenderTargetTexture===!1&&w.version>0&&G.__version!==w.version){const ce=w.image;if(ce===null)console.warn("THREE.WebGLRenderer: Texture marked for update but no image data found.");else if(ce.complete===!1)console.warn("THREE.WebGLRenderer: Texture marked for update but image is incomplete");else{Q(G,w,A);return}}t.bindTexture(n.TEXTURE_2D,G.__webglTexture,n.TEXTURE0+A)}function le(w,A){const G=i.get(w);if(w.version>0&&G.__version!==w.version){Q(G,w,A);return}t.bindTexture(n.TEXTURE_2D_ARRAY,G.__webglTexture,n.TEXTURE0+A)}function Z(w,A){const G=i.get(w);if(w.version>0&&G.__version!==w.version){Q(G,w,A);return}t.bindTexture(n.TEXTURE_3D,G.__webglTexture,n.TEXTURE0+A)}function J(w,A){const G=i.get(w);if(w.version>0&&G.__version!==w.version){fe(G,w,A);return}t.bindTexture(n.TEXTURE_CUBE_MAP,G.__webglTexture,n.TEXTURE0+A)}const _e={[Xo]:n.REPEAT,[Kn]:n.CLAMP_TO_EDGE,[vd]:n.MIRRORED_REPEAT},he={[an]:n.NEAREST,[Jm]:n.NEAREST_MIPMAP_NEAREST,[Qc]:n.NEAREST_MIPMAP_LINEAR,[Mn]:n.LINEAR,[qw]:n.LINEAR_MIPMAP_NEAREST,[ks]:n.LINEAR_MIPMAP_LINEAR},ye={[hgt]:n.NEVER,[Sgt]:n.ALWAYS,[fgt]:n.LESS,[eO]:n.LEQUAL,[mgt]:n.EQUAL,[bgt]:n.GEQUAL,[ggt]:n.GREATER,[Egt]:n.NOTEQUAL};function j(w,A,G){if(G?(n.texParameteri(w,n.TEXTURE_WRAP_S,_e[A.wrapS]),n.texParameteri(w,n.TEXTURE_WRAP_T,_e[A.wrapT]),(w===n.TEXTURE_3D||w===n.TEXTURE_2D_ARRAY)&&n.texParameteri(w,n.TEXTURE_WRAP_R,_e[A.wrapR]),n.texParameteri(w,n.TEXTURE_MAG_FILTER,he[A.magFilter]),n.texParameteri(w,n.TEXTURE_MIN_FILTER,he[A.minFilter])):(n.texParameteri(w,n.TEXTURE_WRAP_S,n.CLAMP_TO_EDGE),n.texParameteri(w,n.TEXTURE_WRAP_T,n.CLAMP_TO_EDGE),(w===n.TEXTURE_3D||w===n.TEXTURE_2D_ARRAY)&&n.texParameteri(w,n.TEXTURE_WRAP_R,n.CLAMP_TO_EDGE),(A.wrapS!==Kn||A.wrapT!==Kn)&&console.warn("THREE.WebGLRenderer: Texture is not power of two. Texture.wrapS and Texture.wrapT should be set to THREE.ClampToEdgeWrapping."),n.texParameteri(w,n.TEXTURE_MAG_FILTER,R(A.magFilter)),n.texParameteri(w,n.TEXTURE_MIN_FILTER,R(A.minFilter)),A.minFilter!==an&&A.minFilter!==Mn&&console.warn("THREE.WebGLRenderer: Texture is not power of two. Texture.minFilter should be set to THREE.NearestFilter or THREE.LinearFilter.")),A.compareFunction&&(n.texParameteri(w,n.TEXTURE_COMPARE_MODE,n.COMPARE_REF_TO_TEXTURE),n.texParameteri(w,n.TEXTURE_COMPARE_FUNC,ye[A.compareFunction])),e.has("EXT_texture_filter_anisotropic")===!0){const ce=e.get("EXT_texture_filter_anisotropic");if(A.magFilter===an||A.minFilter!==Qc&&A.minFilter!==ks||A.type===tr&&e.has("OES_texture_float_linear")===!1||a===!1&&A.type===vl&&e.has("OES_texture_half_float_linear")===!1)return;(A.anisotropy>1||i.get(A).__currentAnisotropy)&&(n.texParameterf(w,ce.TEXTURE_MAX_ANISOTROPY_EXT,Math.min(A.anisotropy,r.getMaxAnisotropy())),i.get(A).__currentAnisotropy=A.anisotropy)}}function de(w,A){let G=!1;w.__webglInit===void 0&&(w.__webglInit=!0,A.addEventListener("dispose",P));const ce=A.source;let $=g.get(ce);$===void 0&&($={},g.set(ce,$));const ee=K(A);if(ee!==w.__cacheKey){$[ee]===void 0&&($[ee]={texture:n.createTexture(),usedTimes:0},o.memory.textures++,G=!0),$[ee].usedTimes++;const ve=$[w.__cacheKey];ve!==void 0&&($[w.__cacheKey].usedTimes--,ve.usedTimes===0&&I(A)),w.__cacheKey=ee,w.__webglTexture=$[ee].texture}return G}function Q(w,A,G){let ce=n.TEXTURE_2D;(A.isDataArrayTexture||A.isCompressedArrayTexture)&&(ce=n.TEXTURE_2D_ARRAY),A.isData3DTexture&&(ce=n.TEXTURE_3D);const $=de(w,A),ee=A.source;t.bindTexture(ce,w.__webglTexture,n.TEXTURE0+G);const ve=i.get(ee);if(ee.version!==ve.__version||$===!0){t.activeTexture(n.TEXTURE0+G);const Ee=Nt.getPrimaries(Nt.workingColorSpace),Ie=A.colorSpace===Qn?null:Nt.getPrimaries(A.colorSpace),Be=A.colorSpace===Qn||Ee===Ie?n.NONE:n.BROWSER_DEFAULT_WEBGL;n.pixelStorei(n.UNPACK_FLIP_Y_WEBGL,A.flipY),n.pixelStorei(n.UNPACK_PREMULTIPLY_ALPHA_WEBGL,A.premultiplyAlpha),n.pixelStorei(n.UNPACK_ALIGNMENT,A.unpackAlignment),n.pixelStorei(n.UNPACK_COLORSPACE_CONVERSION_WEBGL,Be);const et=T(A)&&v(A.image)===!1;let Me=S(A.image,et,!1,d);Me=re(A,Me);const tt=v(Me)||a,We=s.convert(A.format,A.colorSpace);let Fe=s.convert(A.type),je=x(A.internalFormat,We,Fe,A.colorSpace,A.isVideoTexture);j(ce,A,tt);let qe;const lt=A.mipmaps,oe=a&&A.isVideoTexture!==!0&&je!==Xw,Ve=ve.__version===void 0||$===!0,De=y(A,Me,tt);if(A.isDepthTexture)je=n.DEPTH_COMPONENT,a?A.type===tr?je=n.DEPTH_COMPONENT32F:A.type===Ur?je=n.DEPTH_COMPONENT24:A.type===ws?je=n.DEPTH24_STENCIL8:je=n.DEPTH_COMPONENT16:A.type===tr&&console.error("WebGLRenderer: Floating point depth texture requires WebGL2."),A.format===Os&&je===n.DEPTH_COMPONENT&&A.type!==PE&&A.type!==Ur&&(console.warn("THREE.WebGLRenderer: Use UnsignedShortType or UnsignedIntType for DepthFormat DepthTexture."),A.type=Ur,Fe=s.convert(A.type)),A.format===Zo&&je===n.DEPTH_COMPONENT&&(je=n.DEPTH_STENCIL,A.type!==ws&&(console.warn("THREE.WebGLRenderer: Use UnsignedInt248Type for DepthStencilFormat DepthTexture."),A.type=ws,Fe=s.convert(A.type))),Ve&&(oe?t.texStorage2D(n.TEXTURE_2D,1,je,Me.width,Me.height):t.texImage2D(n.TEXTURE_2D,0,je,Me.width,Me.height,0,We,Fe,null));else if(A.isDataTexture)if(lt.length>0&&tt){oe&&Ve&&t.texStorage2D(n.TEXTURE_2D,De,je,lt[0].width,lt[0].height);for(let Re=0,ke=lt.length;Re>=1,ke>>=1}}else if(lt.length>0&&tt){oe&&Ve&&t.texStorage2D(n.TEXTURE_2D,De,je,lt[0].width,lt[0].height);for(let Re=0,ke=lt.length;Re0&&Ve++,t.texStorage2D(n.TEXTURE_CUBE_MAP,Ve,qe,Me[0].width,Me[0].height));for(let Re=0;Re<6;Re++)if(et){lt?t.texSubImage2D(n.TEXTURE_CUBE_MAP_POSITIVE_X+Re,0,0,0,Me[Re].width,Me[Re].height,Fe,je,Me[Re].data):t.texImage2D(n.TEXTURE_CUBE_MAP_POSITIVE_X+Re,0,qe,Me[Re].width,Me[Re].height,0,Fe,je,Me[Re].data);for(let ke=0;ke>ee),Me=Math.max(1,A.height>>ee);$===n.TEXTURE_3D||$===n.TEXTURE_2D_ARRAY?t.texImage3D($,ee,Ie,et,Me,A.depth,0,ve,Ee,null):t.texImage2D($,ee,Ie,et,Me,0,ve,Ee,null)}t.bindFramebuffer(n.FRAMEBUFFER,w),ae(A)?_.framebufferTexture2DMultisampleEXT(n.FRAMEBUFFER,ce,$,i.get(G).__webglTexture,0,B(A)):($===n.TEXTURE_2D||$>=n.TEXTURE_CUBE_MAP_POSITIVE_X&&$<=n.TEXTURE_CUBE_MAP_NEGATIVE_Z)&&n.framebufferTexture2D(n.FRAMEBUFFER,ce,$,i.get(G).__webglTexture,ee),t.bindFramebuffer(n.FRAMEBUFFER,null)}function O(w,A,G){if(n.bindRenderbuffer(n.RENDERBUFFER,w),A.depthBuffer&&!A.stencilBuffer){let ce=a===!0?n.DEPTH_COMPONENT24:n.DEPTH_COMPONENT16;if(G||ae(A)){const $=A.depthTexture;$&&$.isDepthTexture&&($.type===tr?ce=n.DEPTH_COMPONENT32F:$.type===Ur&&(ce=n.DEPTH_COMPONENT24));const ee=B(A);ae(A)?_.renderbufferStorageMultisampleEXT(n.RENDERBUFFER,ee,ce,A.width,A.height):n.renderbufferStorageMultisample(n.RENDERBUFFER,ee,ce,A.width,A.height)}else n.renderbufferStorage(n.RENDERBUFFER,ce,A.width,A.height);n.framebufferRenderbuffer(n.FRAMEBUFFER,n.DEPTH_ATTACHMENT,n.RENDERBUFFER,w)}else if(A.depthBuffer&&A.stencilBuffer){const ce=B(A);G&&ae(A)===!1?n.renderbufferStorageMultisample(n.RENDERBUFFER,ce,n.DEPTH24_STENCIL8,A.width,A.height):ae(A)?_.renderbufferStorageMultisampleEXT(n.RENDERBUFFER,ce,n.DEPTH24_STENCIL8,A.width,A.height):n.renderbufferStorage(n.RENDERBUFFER,n.DEPTH_STENCIL,A.width,A.height),n.framebufferRenderbuffer(n.FRAMEBUFFER,n.DEPTH_STENCIL_ATTACHMENT,n.RENDERBUFFER,w)}else{const ce=A.isWebGLMultipleRenderTargets===!0?A.texture:[A.texture];for(let $=0;$0){G.__webglFramebuffer[Ee]=[];for(let Ie=0;Ie0){G.__webglFramebuffer=[];for(let Ee=0;Ee0&&ae(w)===!1){const Ee=ee?A:[A];G.__webglMultisampledFramebuffer=n.createFramebuffer(),G.__webglColorRenderbuffer=[],t.bindFramebuffer(n.FRAMEBUFFER,G.__webglMultisampledFramebuffer);for(let Ie=0;Ie0)for(let Ie=0;Ie0)for(let Ie=0;Ie0&&ae(w)===!1){const A=w.isWebGLMultipleRenderTargets?w.texture:[w.texture],G=w.width,ce=w.height;let $=n.COLOR_BUFFER_BIT;const ee=[],ve=w.stencilBuffer?n.DEPTH_STENCIL_ATTACHMENT:n.DEPTH_ATTACHMENT,Ee=i.get(w),Ie=w.isWebGLMultipleRenderTargets===!0;if(Ie)for(let Be=0;Be0&&e.has("WEBGL_multisampled_render_to_texture")===!0&&A.__useRenderToTexture!==!1}function ne(w){const A=o.render.frame;h.get(w)!==A&&(h.set(w,A),w.update())}function re(w,A){const G=w.colorSpace,ce=w.format,$=w.type;return w.isCompressedTexture===!0||w.isVideoTexture===!0||w.format===ng||G!==hn&&G!==Qn&&(Nt.getTransfer(G)===Gt?a===!1?e.has("EXT_sRGB")===!0&&ce===jn?(w.format=ng,w.minFilter=Mn,w.generateMipmaps=!1):A=nO.sRGBToLinear(A):(ce!==jn||$!==Yr)&&console.warn("THREE.WebGLTextures: sRGB encoded textures have to use RGBAFormat and UnsignedByteType."):console.error("THREE.WebGLTextures: Unsupported texture color space:",G)),A}this.allocateTextureUnit=Y,this.resetTextureUnits=D,this.setTexture2D=q,this.setTexture2DArray=le,this.setTexture3D=Z,this.setTextureCube=J,this.rebindTextures=se,this.setupRenderTarget=te,this.updateRenderTargetMipmap=be,this.updateMultisampleRenderTarget=xe,this.setupDepthRenderbuffer=H,this.setupFrameBufferTexture=we,this.useMultisampledRTT=ae}function Lvt(n,e,t){const i=t.isWebGL2;function r(s,o=Qn){let a;const l=Nt.getTransfer(o);if(s===Yr)return n.UNSIGNED_BYTE;if(s===$w)return n.UNSIGNED_SHORT_4_4_4_4;if(s===Ww)return n.UNSIGNED_SHORT_5_5_5_1;if(s===tgt)return n.BYTE;if(s===ngt)return n.SHORT;if(s===PE)return n.UNSIGNED_SHORT;if(s===Yw)return n.INT;if(s===Ur)return n.UNSIGNED_INT;if(s===tr)return n.FLOAT;if(s===vl)return i?n.HALF_FLOAT:(a=e.get("OES_texture_half_float"),a!==null?a.HALF_FLOAT_OES:null);if(s===igt)return n.ALPHA;if(s===jn)return n.RGBA;if(s===rgt)return n.LUMINANCE;if(s===sgt)return n.LUMINANCE_ALPHA;if(s===Os)return n.DEPTH_COMPONENT;if(s===Zo)return n.DEPTH_STENCIL;if(s===ng)return a=e.get("EXT_sRGB"),a!==null?a.SRGB_ALPHA_EXT:null;if(s===ogt)return n.RED;if(s===Kw)return n.RED_INTEGER;if(s===agt)return n.RG;if(s===jw)return n.RG_INTEGER;if(s===Qw)return n.RGBA_INTEGER;if(s===wf||s===Of||s===Nf||s===Mf)if(l===Gt)if(a=e.get("WEBGL_compressed_texture_s3tc_srgb"),a!==null){if(s===wf)return a.COMPRESSED_SRGB_S3TC_DXT1_EXT;if(s===Of)return a.COMPRESSED_SRGB_ALPHA_S3TC_DXT1_EXT;if(s===Nf)return a.COMPRESSED_SRGB_ALPHA_S3TC_DXT3_EXT;if(s===Mf)return a.COMPRESSED_SRGB_ALPHA_S3TC_DXT5_EXT}else return null;else if(a=e.get("WEBGL_compressed_texture_s3tc"),a!==null){if(s===wf)return a.COMPRESSED_RGB_S3TC_DXT1_EXT;if(s===Of)return a.COMPRESSED_RGBA_S3TC_DXT1_EXT;if(s===Nf)return a.COMPRESSED_RGBA_S3TC_DXT3_EXT;if(s===Mf)return a.COMPRESSED_RGBA_S3TC_DXT5_EXT}else return null;if(s===Ax||s===wx||s===Ox||s===Nx)if(a=e.get("WEBGL_compressed_texture_pvrtc"),a!==null){if(s===Ax)return a.COMPRESSED_RGB_PVRTC_4BPPV1_IMG;if(s===wx)return a.COMPRESSED_RGB_PVRTC_2BPPV1_IMG;if(s===Ox)return a.COMPRESSED_RGBA_PVRTC_4BPPV1_IMG;if(s===Nx)return a.COMPRESSED_RGBA_PVRTC_2BPPV1_IMG}else return null;if(s===Xw)return a=e.get("WEBGL_compressed_texture_etc1"),a!==null?a.COMPRESSED_RGB_ETC1_WEBGL:null;if(s===Mx||s===Ix)if(a=e.get("WEBGL_compressed_texture_etc"),a!==null){if(s===Mx)return l===Gt?a.COMPRESSED_SRGB8_ETC2:a.COMPRESSED_RGB8_ETC2;if(s===Ix)return l===Gt?a.COMPRESSED_SRGB8_ALPHA8_ETC2_EAC:a.COMPRESSED_RGBA8_ETC2_EAC}else return null;if(s===Dx||s===Lx||s===kx||s===Px||s===Ux||s===Fx||s===Bx||s===Gx||s===zx||s===Vx||s===Hx||s===qx||s===Yx||s===$x)if(a=e.get("WEBGL_compressed_texture_astc"),a!==null){if(s===Dx)return l===Gt?a.COMPRESSED_SRGB8_ALPHA8_ASTC_4x4_KHR:a.COMPRESSED_RGBA_ASTC_4x4_KHR;if(s===Lx)return l===Gt?a.COMPRESSED_SRGB8_ALPHA8_ASTC_5x4_KHR:a.COMPRESSED_RGBA_ASTC_5x4_KHR;if(s===kx)return l===Gt?a.COMPRESSED_SRGB8_ALPHA8_ASTC_5x5_KHR:a.COMPRESSED_RGBA_ASTC_5x5_KHR;if(s===Px)return l===Gt?a.COMPRESSED_SRGB8_ALPHA8_ASTC_6x5_KHR:a.COMPRESSED_RGBA_ASTC_6x5_KHR;if(s===Ux)return l===Gt?a.COMPRESSED_SRGB8_ALPHA8_ASTC_6x6_KHR:a.COMPRESSED_RGBA_ASTC_6x6_KHR;if(s===Fx)return l===Gt?a.COMPRESSED_SRGB8_ALPHA8_ASTC_8x5_KHR:a.COMPRESSED_RGBA_ASTC_8x5_KHR;if(s===Bx)return l===Gt?a.COMPRESSED_SRGB8_ALPHA8_ASTC_8x6_KHR:a.COMPRESSED_RGBA_ASTC_8x6_KHR;if(s===Gx)return l===Gt?a.COMPRESSED_SRGB8_ALPHA8_ASTC_8x8_KHR:a.COMPRESSED_RGBA_ASTC_8x8_KHR;if(s===zx)return l===Gt?a.COMPRESSED_SRGB8_ALPHA8_ASTC_10x5_KHR:a.COMPRESSED_RGBA_ASTC_10x5_KHR;if(s===Vx)return l===Gt?a.COMPRESSED_SRGB8_ALPHA8_ASTC_10x6_KHR:a.COMPRESSED_RGBA_ASTC_10x6_KHR;if(s===Hx)return l===Gt?a.COMPRESSED_SRGB8_ALPHA8_ASTC_10x8_KHR:a.COMPRESSED_RGBA_ASTC_10x8_KHR;if(s===qx)return l===Gt?a.COMPRESSED_SRGB8_ALPHA8_ASTC_10x10_KHR:a.COMPRESSED_RGBA_ASTC_10x10_KHR;if(s===Yx)return l===Gt?a.COMPRESSED_SRGB8_ALPHA8_ASTC_12x10_KHR:a.COMPRESSED_RGBA_ASTC_12x10_KHR;if(s===$x)return l===Gt?a.COMPRESSED_SRGB8_ALPHA8_ASTC_12x12_KHR:a.COMPRESSED_RGBA_ASTC_12x12_KHR}else return null;if(s===If||s===Wx||s===Kx)if(a=e.get("EXT_texture_compression_bptc"),a!==null){if(s===If)return l===Gt?a.COMPRESSED_SRGB_ALPHA_BPTC_UNORM_EXT:a.COMPRESSED_RGBA_BPTC_UNORM_EXT;if(s===Wx)return a.COMPRESSED_RGB_BPTC_SIGNED_FLOAT_EXT;if(s===Kx)return a.COMPRESSED_RGB_BPTC_UNSIGNED_FLOAT_EXT}else return null;if(s===lgt||s===jx||s===Qx||s===Xx)if(a=e.get("EXT_texture_compression_rgtc"),a!==null){if(s===If)return a.COMPRESSED_RED_RGTC1_EXT;if(s===jx)return a.COMPRESSED_SIGNED_RED_RGTC1_EXT;if(s===Qx)return a.COMPRESSED_RED_GREEN_RGTC2_EXT;if(s===Xx)return a.COMPRESSED_SIGNED_RED_GREEN_RGTC2_EXT}else return null;return s===ws?i?n.UNSIGNED_INT_24_8:(a=e.get("WEBGL_depth_texture"),a!==null?a.UNSIGNED_INT_24_8_WEBGL:null):n[s]!==void 0?n[s]:null}return{convert:r}}class kvt extends Rn{constructor(e=[]){super(),this.isArrayCamera=!0,this.cameras=e}}class Ts extends Yt{constructor(){super(),this.isGroup=!0,this.type="Group"}}const Pvt={type:"move"};class nm{constructor(){this._targetRay=null,this._grip=null,this._hand=null}getHandSpace(){return this._hand===null&&(this._hand=new Ts,this._hand.matrixAutoUpdate=!1,this._hand.visible=!1,this._hand.joints={},this._hand.inputState={pinching:!1}),this._hand}getTargetRaySpace(){return this._targetRay===null&&(this._targetRay=new Ts,this._targetRay.matrixAutoUpdate=!1,this._targetRay.visible=!1,this._targetRay.hasLinearVelocity=!1,this._targetRay.linearVelocity=new ue,this._targetRay.hasAngularVelocity=!1,this._targetRay.angularVelocity=new ue),this._targetRay}getGripSpace(){return this._grip===null&&(this._grip=new Ts,this._grip.matrixAutoUpdate=!1,this._grip.visible=!1,this._grip.hasLinearVelocity=!1,this._grip.linearVelocity=new ue,this._grip.hasAngularVelocity=!1,this._grip.angularVelocity=new ue),this._grip}dispatchEvent(e){return this._targetRay!==null&&this._targetRay.dispatchEvent(e),this._grip!==null&&this._grip.dispatchEvent(e),this._hand!==null&&this._hand.dispatchEvent(e),this}connect(e){if(e&&e.hand){const t=this._hand;if(t)for(const i of e.hand.values())this._getHandJoint(t,i)}return this.dispatchEvent({type:"connected",data:e}),this}disconnect(e){return this.dispatchEvent({type:"disconnected",data:e}),this._targetRay!==null&&(this._targetRay.visible=!1),this._grip!==null&&(this._grip.visible=!1),this._hand!==null&&(this._hand.visible=!1),this}update(e,t,i){let r=null,s=null,o=null;const a=this._targetRay,l=this._grip,c=this._hand;if(e&&t.session.visibilityState!=="visible-blurred"){if(c&&e.hand){o=!0;for(const E of e.hand.values()){const g=t.getJointPose(E,i),m=this._getHandJoint(c,E);g!==null&&(m.matrix.fromArray(g.transform.matrix),m.matrix.decompose(m.position,m.rotation,m.scale),m.matrixWorldNeedsUpdate=!0,m.jointRadius=g.radius),m.visible=g!==null}const d=c.joints["index-finger-tip"],u=c.joints["thumb-tip"],_=d.position.distanceTo(u.position),f=.02,h=.005;c.inputState.pinching&&_>f+h?(c.inputState.pinching=!1,this.dispatchEvent({type:"pinchend",handedness:e.handedness,target:this})):!c.inputState.pinching&&_<=f-h&&(c.inputState.pinching=!0,this.dispatchEvent({type:"pinchstart",handedness:e.handedness,target:this}))}else l!==null&&e.gripSpace&&(s=t.getPose(e.gripSpace,i),s!==null&&(l.matrix.fromArray(s.transform.matrix),l.matrix.decompose(l.position,l.rotation,l.scale),l.matrixWorldNeedsUpdate=!0,s.linearVelocity?(l.hasLinearVelocity=!0,l.linearVelocity.copy(s.linearVelocity)):l.hasLinearVelocity=!1,s.angularVelocity?(l.hasAngularVelocity=!0,l.angularVelocity.copy(s.angularVelocity)):l.hasAngularVelocity=!1));a!==null&&(r=t.getPose(e.targetRaySpace,i),r===null&&s!==null&&(r=s),r!==null&&(a.matrix.fromArray(r.transform.matrix),a.matrix.decompose(a.position,a.rotation,a.scale),a.matrixWorldNeedsUpdate=!0,r.linearVelocity?(a.hasLinearVelocity=!0,a.linearVelocity.copy(r.linearVelocity)):a.hasLinearVelocity=!1,r.angularVelocity?(a.hasAngularVelocity=!0,a.angularVelocity.copy(r.angularVelocity)):a.hasAngularVelocity=!1,this.dispatchEvent(Pvt)))}return a!==null&&(a.visible=r!==null),l!==null&&(l.visible=s!==null),c!==null&&(c.visible=o!==null),this}_getHandJoint(e,t){if(e.joints[t.jointName]===void 0){const i=new Ts;i.matrixAutoUpdate=!1,i.visible=!1,e.joints[t.jointName]=i,e.add(i)}return e.joints[t.jointName]}}class Uvt extends fa{constructor(e,t){super();const i=this;let r=null,s=1,o=null,a="local-floor",l=1,c=null,d=null,u=null,_=null,f=null,h=null;const E=t.getContextAttributes();let g=null,m=null;const b=[],S=[],v=new vt;let T=null;const C=new Rn;C.layers.enable(1),C.viewport=new Pt;const N=new Rn;N.layers.enable(2),N.viewport=new Pt;const x=[C,N],y=new kvt;y.layers.enable(1),y.layers.enable(2);let R=null,P=null;this.cameraAutoUpdate=!0,this.enabled=!1,this.isPresenting=!1,this.getController=function(J){let _e=b[J];return _e===void 0&&(_e=new nm,b[J]=_e),_e.getTargetRaySpace()},this.getControllerGrip=function(J){let _e=b[J];return _e===void 0&&(_e=new nm,b[J]=_e),_e.getGripSpace()},this.getHand=function(J){let _e=b[J];return _e===void 0&&(_e=new nm,b[J]=_e),_e.getHandSpace()};function k(J){const _e=S.indexOf(J.inputSource);if(_e===-1)return;const he=b[_e];he!==void 0&&(he.update(J.inputSource,J.frame,c||o),he.dispatchEvent({type:J.type,data:J.inputSource}))}function W(){r.removeEventListener("select",k),r.removeEventListener("selectstart",k),r.removeEventListener("selectend",k),r.removeEventListener("squeeze",k),r.removeEventListener("squeezestart",k),r.removeEventListener("squeezeend",k),r.removeEventListener("end",W),r.removeEventListener("inputsourceschange",I);for(let J=0;J=0&&(S[ye]=null,b[ye].disconnect(he))}for(let _e=0;_e=S.length){S.push(he),ye=de;break}else if(S[de]===null){S[de]=he,ye=de;break}if(ye===-1)break}const j=b[ye];j&&j.connect(he)}}const V=new ue,z=new ue;function D(J,_e,he){V.setFromMatrixPosition(_e.matrixWorld),z.setFromMatrixPosition(he.matrixWorld);const ye=V.distanceTo(z),j=_e.projectionMatrix.elements,de=he.projectionMatrix.elements,Q=j[14]/(j[10]-1),fe=j[14]/(j[10]+1),we=(j[9]+1)/j[5],O=(j[9]-1)/j[5],F=(j[8]-1)/j[0],H=(de[8]+1)/de[0],se=Q*F,te=Q*H,be=ye/(-F+H),xe=be*-F;_e.matrixWorld.decompose(J.position,J.quaternion,J.scale),J.translateX(xe),J.translateZ(be),J.matrixWorld.compose(J.position,J.quaternion,J.scale),J.matrixWorldInverse.copy(J.matrixWorld).invert();const B=Q+be,ae=fe+be,ne=se-xe,re=te+(ye-xe),w=we*fe/ae*B,A=O*fe/ae*B;J.projectionMatrix.makePerspective(ne,re,w,A,B,ae),J.projectionMatrixInverse.copy(J.projectionMatrix).invert()}function Y(J,_e){_e===null?J.matrixWorld.copy(J.matrix):J.matrixWorld.multiplyMatrices(_e.matrixWorld,J.matrix),J.matrixWorldInverse.copy(J.matrixWorld).invert()}this.updateCamera=function(J){if(r===null)return;y.near=N.near=C.near=J.near,y.far=N.far=C.far=J.far,(R!==y.near||P!==y.far)&&(r.updateRenderState({depthNear:y.near,depthFar:y.far}),R=y.near,P=y.far);const _e=J.parent,he=y.cameras;Y(y,_e);for(let ye=0;ye0&&(g.alphaTest.value=m.alphaTest);const b=e.get(m).envMap;if(b&&(g.envMap.value=b,g.flipEnvMap.value=b.isCubeTexture&&b.isRenderTargetTexture===!1?-1:1,g.reflectivity.value=m.reflectivity,g.ior.value=m.ior,g.refractionRatio.value=m.refractionRatio),m.lightMap){g.lightMap.value=m.lightMap;const S=n._useLegacyLights===!0?Math.PI:1;g.lightMapIntensity.value=m.lightMapIntensity*S,t(m.lightMap,g.lightMapTransform)}m.aoMap&&(g.aoMap.value=m.aoMap,g.aoMapIntensity.value=m.aoMapIntensity,t(m.aoMap,g.aoMapTransform))}function o(g,m){g.diffuse.value.copy(m.color),g.opacity.value=m.opacity,m.map&&(g.map.value=m.map,t(m.map,g.mapTransform))}function a(g,m){g.dashSize.value=m.dashSize,g.totalSize.value=m.dashSize+m.gapSize,g.scale.value=m.scale}function l(g,m,b,S){g.diffuse.value.copy(m.color),g.opacity.value=m.opacity,g.size.value=m.size*b,g.scale.value=S*.5,m.map&&(g.map.value=m.map,t(m.map,g.uvTransform)),m.alphaMap&&(g.alphaMap.value=m.alphaMap,t(m.alphaMap,g.alphaMapTransform)),m.alphaTest>0&&(g.alphaTest.value=m.alphaTest)}function c(g,m){g.diffuse.value.copy(m.color),g.opacity.value=m.opacity,g.rotation.value=m.rotation,m.map&&(g.map.value=m.map,t(m.map,g.mapTransform)),m.alphaMap&&(g.alphaMap.value=m.alphaMap,t(m.alphaMap,g.alphaMapTransform)),m.alphaTest>0&&(g.alphaTest.value=m.alphaTest)}function d(g,m){g.specular.value.copy(m.specular),g.shininess.value=Math.max(m.shininess,1e-4)}function u(g,m){m.gradientMap&&(g.gradientMap.value=m.gradientMap)}function _(g,m){g.metalness.value=m.metalness,m.metalnessMap&&(g.metalnessMap.value=m.metalnessMap,t(m.metalnessMap,g.metalnessMapTransform)),g.roughness.value=m.roughness,m.roughnessMap&&(g.roughnessMap.value=m.roughnessMap,t(m.roughnessMap,g.roughnessMapTransform)),e.get(m).envMap&&(g.envMapIntensity.value=m.envMapIntensity)}function f(g,m,b){g.ior.value=m.ior,m.sheen>0&&(g.sheenColor.value.copy(m.sheenColor).multiplyScalar(m.sheen),g.sheenRoughness.value=m.sheenRoughness,m.sheenColorMap&&(g.sheenColorMap.value=m.sheenColorMap,t(m.sheenColorMap,g.sheenColorMapTransform)),m.sheenRoughnessMap&&(g.sheenRoughnessMap.value=m.sheenRoughnessMap,t(m.sheenRoughnessMap,g.sheenRoughnessMapTransform))),m.clearcoat>0&&(g.clearcoat.value=m.clearcoat,g.clearcoatRoughness.value=m.clearcoatRoughness,m.clearcoatMap&&(g.clearcoatMap.value=m.clearcoatMap,t(m.clearcoatMap,g.clearcoatMapTransform)),m.clearcoatRoughnessMap&&(g.clearcoatRoughnessMap.value=m.clearcoatRoughnessMap,t(m.clearcoatRoughnessMap,g.clearcoatRoughnessMapTransform)),m.clearcoatNormalMap&&(g.clearcoatNormalMap.value=m.clearcoatNormalMap,t(m.clearcoatNormalMap,g.clearcoatNormalMapTransform),g.clearcoatNormalScale.value.copy(m.clearcoatNormalScale),m.side===Ln&&g.clearcoatNormalScale.value.negate())),m.iridescence>0&&(g.iridescence.value=m.iridescence,g.iridescenceIOR.value=m.iridescenceIOR,g.iridescenceThicknessMinimum.value=m.iridescenceThicknessRange[0],g.iridescenceThicknessMaximum.value=m.iridescenceThicknessRange[1],m.iridescenceMap&&(g.iridescenceMap.value=m.iridescenceMap,t(m.iridescenceMap,g.iridescenceMapTransform)),m.iridescenceThicknessMap&&(g.iridescenceThicknessMap.value=m.iridescenceThicknessMap,t(m.iridescenceThicknessMap,g.iridescenceThicknessMapTransform))),m.transmission>0&&(g.transmission.value=m.transmission,g.transmissionSamplerMap.value=b.texture,g.transmissionSamplerSize.value.set(b.width,b.height),m.transmissionMap&&(g.transmissionMap.value=m.transmissionMap,t(m.transmissionMap,g.transmissionMapTransform)),g.thickness.value=m.thickness,m.thicknessMap&&(g.thicknessMap.value=m.thicknessMap,t(m.thicknessMap,g.thicknessMapTransform)),g.attenuationDistance.value=m.attenuationDistance,g.attenuationColor.value.copy(m.attenuationColor)),m.anisotropy>0&&(g.anisotropyVector.value.set(m.anisotropy*Math.cos(m.anisotropyRotation),m.anisotropy*Math.sin(m.anisotropyRotation)),m.anisotropyMap&&(g.anisotropyMap.value=m.anisotropyMap,t(m.anisotropyMap,g.anisotropyMapTransform))),g.specularIntensity.value=m.specularIntensity,g.specularColor.value.copy(m.specularColor),m.specularColorMap&&(g.specularColorMap.value=m.specularColorMap,t(m.specularColorMap,g.specularColorMapTransform)),m.specularIntensityMap&&(g.specularIntensityMap.value=m.specularIntensityMap,t(m.specularIntensityMap,g.specularIntensityMapTransform))}function h(g,m){m.matcap&&(g.matcap.value=m.matcap)}function E(g,m){const b=e.get(m).light;g.referencePosition.value.setFromMatrixPosition(b.matrixWorld),g.nearDistance.value=b.shadow.camera.near,g.farDistance.value=b.shadow.camera.far}return{refreshFogUniforms:i,refreshMaterialUniforms:r}}function Bvt(n,e,t,i){let r={},s={},o=[];const a=t.isWebGL2?n.getParameter(n.MAX_UNIFORM_BUFFER_BINDINGS):0;function l(b,S){const v=S.program;i.uniformBlockBinding(b,v)}function c(b,S){let v=r[b.id];v===void 0&&(h(b),v=d(b),r[b.id]=v,b.addEventListener("dispose",g));const T=S.program;i.updateUBOMapping(b,T);const C=e.render.frame;s[b.id]!==C&&(_(b),s[b.id]=C)}function d(b){const S=u();b.__bindingPointIndex=S;const v=n.createBuffer(),T=b.__size,C=b.usage;return n.bindBuffer(n.UNIFORM_BUFFER,v),n.bufferData(n.UNIFORM_BUFFER,T,C),n.bindBuffer(n.UNIFORM_BUFFER,null),n.bindBufferBase(n.UNIFORM_BUFFER,S,v),v}function u(){for(let b=0;b0){C=v%T;const k=T-C;C!==0&&k-R.boundary<0&&(v+=T-C,y.__offset=v)}v+=R.storage}return C=v%T,C>0&&(v+=T-C),b.__size=v,b.__cache={},this}function E(b){const S={boundary:0,storage:0};return typeof b=="number"?(S.boundary=4,S.storage=4):b.isVector2?(S.boundary=8,S.storage=8):b.isVector3||b.isColor?(S.boundary=16,S.storage=12):b.isVector4?(S.boundary=16,S.storage=16):b.isMatrix3?(S.boundary=48,S.storage=48):b.isMatrix4?(S.boundary=64,S.storage=64):b.isTexture?console.warn("THREE.WebGLRenderer: Texture samplers can not be part of an uniforms group."):console.warn("THREE.WebGLRenderer: Unsupported uniform value type.",b),S}function g(b){const S=b.target;S.removeEventListener("dispose",g);const v=o.indexOf(S.__bindingPointIndex);o.splice(v,1),n.deleteBuffer(r[S.id]),delete r[S.id],delete s[S.id]}function m(){for(const b in r)n.deleteBuffer(r[b]);o=[],r={},s={}}return{bind:l,update:c,dispose:m}}class bO{constructor(e={}){const{canvas:t=Pgt(),context:i=null,depth:r=!0,stencil:s=!0,alpha:o=!1,antialias:a=!1,premultipliedAlpha:l=!0,preserveDrawingBuffer:c=!1,powerPreference:d="default",failIfMajorPerformanceCaveat:u=!1}=e;this.isWebGLRenderer=!0;let _;i!==null?_=i.getContextAttributes().alpha:_=o;const f=new Uint32Array(4),h=new Int32Array(4);let E=null,g=null;const m=[],b=[];this.domElement=t,this.debug={checkShaderErrors:!0,onShaderError:null},this.autoClear=!0,this.autoClearColor=!0,this.autoClearDepth=!0,this.autoClearStencil=!0,this.sortObjects=!0,this.clippingPlanes=[],this.localClippingEnabled=!1,this._outputColorSpace=Kt,this._useLegacyLights=!1,this.toneMapping=qr,this.toneMappingExposure=1;const S=this;let v=!1,T=0,C=0,N=null,x=-1,y=null;const R=new Pt,P=new Pt;let k=null;const W=new ot(0);let I=0,V=t.width,z=t.height,D=1,Y=null,K=null;const q=new Pt(0,0,V,z),le=new Pt(0,0,V,z);let Z=!1;const J=new GE;let _e=!1,he=!1,ye=null;const j=new gt,de=new vt,Q=new ue,fe={background:null,fog:null,environment:null,overrideMaterial:null,isScene:!0};function we(){return N===null?D:1}let O=i;function F(U,pe){for(let Se=0;Se{function Ye(){if(Te.forEach(function(Qe){xe.get(Qe).currentProgram.isReady()&&Te.delete(Qe)}),Te.size===0){ge(U);return}setTimeout(Ye,10)}H.get("KHR_parallel_shader_compile")!==null?Ye():setTimeout(Ye,10)})};let _t=null;function Wt(U){_t&&_t(U)}function tn(){Ht.stop()}function Ot(){Ht.start()}const Ht=new _O;Ht.setAnimationLoop(Wt),typeof self<"u"&&Ht.setContext(self),this.setAnimationLoop=function(U){_t=U,qe.setAnimationLoop(U),U===null?Ht.stop():Ht.start()},qe.addEventListener("sessionstart",tn),qe.addEventListener("sessionend",Ot),this.render=function(U,pe){if(pe!==void 0&&pe.isCamera!==!0){console.error("THREE.WebGLRenderer.render: camera is not an instance of THREE.Camera.");return}if(v===!0)return;U.matrixWorldAutoUpdate===!0&&U.updateMatrixWorld(),pe.parent===null&&pe.matrixWorldAutoUpdate===!0&&pe.updateMatrixWorld(),qe.enabled===!0&&qe.isPresenting===!0&&(qe.cameraAutoUpdate===!0&&qe.updateCamera(pe),pe=qe.getCamera()),U.isScene===!0&&U.onBeforeRender(S,U,pe,N),g=ee.get(U,b.length),g.init(),b.push(g),j.multiplyMatrices(pe.projectionMatrix,pe.matrixWorldInverse),J.setFromProjectionMatrix(j),he=this.localClippingEnabled,_e=ve.init(this.clippingPlanes,he),E=$.get(U,m.length),E.init(),m.push(E),On(U,pe,0,S.sortObjects),E.finish(),S.sortObjects===!0&&E.sort(Y,K),this.info.render.frame++,_e===!0&&ve.beginShadows();const Se=g.state.shadowsArray;if(Ee.render(Se,U,pe),_e===!0&&ve.endShadows(),this.info.autoReset===!0&&this.info.reset(),Ie.render(E,U),g.setupLights(S._useLegacyLights),pe.isArrayCamera){const Te=pe.cameras;for(let ge=0,Ye=Te.length;ge0?g=b[b.length-1]:g=null,m.pop(),m.length>0?E=m[m.length-1]:E=null};function On(U,pe,Se,Te){if(U.visible===!1)return;if(U.layers.test(pe.layers)){if(U.isGroup)Se=U.renderOrder;else if(U.isLOD)U.autoUpdate===!0&&U.update(pe);else if(U.isLight)g.pushLight(U),U.castShadow&&g.pushShadow(U);else if(U.isSprite){if(!U.frustumCulled||J.intersectsSprite(U)){Te&&Q.setFromMatrixPosition(U.matrixWorld).applyMatrix4(j);const Qe=A.update(U),nt=U.material;nt.visible&&E.push(U,Qe,nt,Se,Q.z,null)}}else if((U.isMesh||U.isLine||U.isPoints)&&(!U.frustumCulled||J.intersectsObject(U))){const Qe=A.update(U),nt=U.material;if(Te&&(U.boundingSphere!==void 0?(U.boundingSphere===null&&U.computeBoundingSphere(),Q.copy(U.boundingSphere.center)):(Qe.boundingSphere===null&&Qe.computeBoundingSphere(),Q.copy(Qe.boundingSphere.center)),Q.applyMatrix4(U.matrixWorld).applyMatrix4(j)),Array.isArray(nt)){const rt=Qe.groups;for(let ct=0,st=rt.length;ct0&&Sa(ge,Ye,pe,Se),Te&&te.viewport(R.copy(Te)),ge.length>0&&Gi(ge,pe,Se),Ye.length>0&&Gi(Ye,pe,Se),Qe.length>0&&Gi(Qe,pe,Se),te.buffers.depth.setTest(!0),te.buffers.depth.setMask(!0),te.buffers.color.setMask(!0),te.setPolygonOffset(!1)}function Sa(U,pe,Se,Te){if((Se.isScene===!0?Se.overrideMaterial:null)!==null)return;const Ye=se.isWebGL2;ye===null&&(ye=new Ps(1,1,{generateMipmaps:!0,type:H.has("EXT_color_buffer_half_float")?vl:Yr,minFilter:ks,samples:Ye?4:0})),S.getDrawingBufferSize(de),Ye?ye.setSize(de.x,de.y):ye.setSize(Ad(de.x),Ad(de.y));const Qe=S.getRenderTarget();S.setRenderTarget(ye),S.getClearColor(W),I=S.getClearAlpha(),I<1&&S.setClearColor(16777215,.5),S.clear();const nt=S.toneMapping;S.toneMapping=qr,Gi(U,Se,Te),B.updateMultisampleRenderTarget(ye),B.updateRenderTargetMipmap(ye);let rt=!1;for(let ct=0,st=pe.length;ct0),at=!!Se.morphAttributes.position,Ft=!!Se.morphAttributes.normal,cn=!!Se.morphAttributes.color;let qt=qr;Te.toneMapped&&(N===null||N.isXRRenderTarget===!0)&&(qt=S.toneMapping);const fn=Se.morphAttributes.position||Se.morphAttributes.normal||Se.morphAttributes.color,Bt=fn!==void 0?fn.length:0,pt=xe.get(Te),va=g.state.lights;if(_e===!0&&(he===!0||U!==y)){const Nn=U===y&&Te.id===x;ve.setState(Te,U,Nn)}let Vt=!1;Te.version===pt.__version?(pt.needsLights&&pt.lightsStateVersion!==va.state.version||pt.outputColorSpace!==nt||ge.isBatchedMesh&&pt.batching===!1||!ge.isBatchedMesh&&pt.batching===!0||ge.isInstancedMesh&&pt.instancing===!1||!ge.isInstancedMesh&&pt.instancing===!0||ge.isSkinnedMesh&&pt.skinning===!1||!ge.isSkinnedMesh&&pt.skinning===!0||ge.isInstancedMesh&&pt.instancingColor===!0&&ge.instanceColor===null||ge.isInstancedMesh&&pt.instancingColor===!1&&ge.instanceColor!==null||pt.envMap!==rt||Te.fog===!0&&pt.fog!==Ye||pt.numClippingPlanes!==void 0&&(pt.numClippingPlanes!==ve.numPlanes||pt.numIntersection!==ve.numIntersection)||pt.vertexAlphas!==ct||pt.vertexTangents!==st||pt.morphTargets!==at||pt.morphNormals!==Ft||pt.morphColors!==cn||pt.toneMapping!==qt||se.isWebGL2===!0&&pt.morphTargetsCount!==Bt)&&(Vt=!0):(Vt=!0,pt.__version=Te.version);let Vi=pt.currentProgram;Vt===!0&&(Vi=zi(Te,pe,ge));let Gl=!1,ts=!1,Ta=!1;const sn=Vi.getUniforms(),Hi=pt.uniforms;if(te.useProgram(Vi.program)&&(Gl=!0,ts=!0,Ta=!0),Te.id!==x&&(x=Te.id,ts=!0),Gl||y!==U){sn.setValue(O,"projectionMatrix",U.projectionMatrix),sn.setValue(O,"viewMatrix",U.matrixWorldInverse);const Nn=sn.map.cameraPosition;Nn!==void 0&&Nn.setValue(O,Q.setFromMatrixPosition(U.matrixWorld)),se.logarithmicDepthBuffer&&sn.setValue(O,"logDepthBufFC",2/(Math.log(U.far+1)/Math.LN2)),(Te.isMeshPhongMaterial||Te.isMeshToonMaterial||Te.isMeshLambertMaterial||Te.isMeshBasicMaterial||Te.isMeshStandardMaterial||Te.isShaderMaterial)&&sn.setValue(O,"isOrthographic",U.isOrthographicCamera===!0),y!==U&&(y=U,ts=!0,Ta=!0)}if(ge.isSkinnedMesh){sn.setOptional(O,ge,"bindMatrix"),sn.setOptional(O,ge,"bindMatrixInverse");const Nn=ge.skeleton;Nn&&(se.floatVertexTextures?(Nn.boneTexture===null&&Nn.computeBoneTexture(),sn.setValue(O,"boneTexture",Nn.boneTexture,B)):console.warn("THREE.WebGLRenderer: SkinnedMesh can only be used with WebGL 2. With WebGL 1 OES_texture_float and vertex textures support is required."))}ge.isBatchedMesh&&(sn.setOptional(O,ge,"batchingTexture"),sn.setValue(O,"batchingTexture",ge._matricesTexture,B));const xa=Se.morphAttributes;if((xa.position!==void 0||xa.normal!==void 0||xa.color!==void 0&&se.isWebGL2===!0)&&Be.update(ge,Se,Vi),(ts||pt.receiveShadow!==ge.receiveShadow)&&(pt.receiveShadow=ge.receiveShadow,sn.setValue(O,"receiveShadow",ge.receiveShadow)),Te.isMeshGouraudMaterial&&Te.envMap!==null&&(Hi.envMap.value=rt,Hi.flipEnvMap.value=rt.isCubeTexture&&rt.isRenderTargetTexture===!1?-1:1),ts&&(sn.setValue(O,"toneMappingExposure",S.toneMappingExposure),pt.needsLights&&es(Hi,Ta),Ye&&Te.fog===!0&&ce.refreshFogUniforms(Hi,Ye),ce.refreshMaterialUniforms(Hi,Te,D,z,ye),Xc.upload(O,Jr(pt),Hi,B)),Te.isShaderMaterial&&Te.uniformsNeedUpdate===!0&&(Xc.upload(O,Jr(pt),Hi,B),Te.uniformsNeedUpdate=!1),Te.isSpriteMaterial&&sn.setValue(O,"center",ge.center),sn.setValue(O,"modelViewMatrix",ge.modelViewMatrix),sn.setValue(O,"normalMatrix",ge.normalMatrix),sn.setValue(O,"modelMatrix",ge.matrixWorld),Te.isShaderMaterial||Te.isRawShaderMaterial){const Nn=Te.uniformsGroups;for(let Ca=0,pu=Nn.length;Ca0&&B.useMultisampledRTT(U)===!1?ge=xe.get(U).__webglMultisampledFramebuffer:Array.isArray(st)?ge=st[Se]:ge=st,R.copy(U.viewport),P.copy(U.scissor),k=U.scissorTest}else R.copy(q).multiplyScalar(D).floor(),P.copy(le).multiplyScalar(D).floor(),k=Z;if(te.bindFramebuffer(O.FRAMEBUFFER,ge)&&se.drawBuffers&&Te&&te.drawBuffers(U,ge),te.viewport(R),te.scissor(P),te.setScissorTest(k),Ye){const rt=xe.get(U.texture);O.framebufferTexture2D(O.FRAMEBUFFER,O.COLOR_ATTACHMENT0,O.TEXTURE_CUBE_MAP_POSITIVE_X+pe,rt.__webglTexture,Se)}else if(Qe){const rt=xe.get(U.texture),ct=pe||0;O.framebufferTextureLayer(O.FRAMEBUFFER,O.COLOR_ATTACHMENT0,rt.__webglTexture,Se||0,ct)}x=-1},this.readRenderTargetPixels=function(U,pe,Se,Te,ge,Ye,Qe){if(!(U&&U.isWebGLRenderTarget)){console.error("THREE.WebGLRenderer.readRenderTargetPixels: renderTarget is not THREE.WebGLRenderTarget.");return}let nt=xe.get(U).__webglFramebuffer;if(U.isWebGLCubeRenderTarget&&Qe!==void 0&&(nt=nt[Qe]),nt){te.bindFramebuffer(O.FRAMEBUFFER,nt);try{const rt=U.texture,ct=rt.format,st=rt.type;if(ct!==jn&&tt.convert(ct)!==O.getParameter(O.IMPLEMENTATION_COLOR_READ_FORMAT)){console.error("THREE.WebGLRenderer.readRenderTargetPixels: renderTarget is not in RGBA or implementation defined format.");return}const at=st===vl&&(H.has("EXT_color_buffer_half_float")||se.isWebGL2&&H.has("EXT_color_buffer_float"));if(st!==Yr&&tt.convert(st)!==O.getParameter(O.IMPLEMENTATION_COLOR_READ_TYPE)&&!(st===tr&&(se.isWebGL2||H.has("OES_texture_float")||H.has("WEBGL_color_buffer_float")))&&!at){console.error("THREE.WebGLRenderer.readRenderTargetPixels: renderTarget is not in UnsignedByteType or implementation defined type.");return}pe>=0&&pe<=U.width-Te&&Se>=0&&Se<=U.height-ge&&O.readPixels(pe,Se,Te,ge,tt.convert(ct),tt.convert(st),Ye)}finally{const rt=N!==null?xe.get(N).__webglFramebuffer:null;te.bindFramebuffer(O.FRAMEBUFFER,rt)}}},this.copyFramebufferToTexture=function(U,pe,Se=0){const Te=Math.pow(2,-Se),ge=Math.floor(pe.image.width*Te),Ye=Math.floor(pe.image.height*Te);B.setTexture2D(pe,0),O.copyTexSubImage2D(O.TEXTURE_2D,Se,0,0,U.x,U.y,ge,Ye),te.unbindTexture()},this.copyTextureToTexture=function(U,pe,Se,Te=0){const ge=pe.image.width,Ye=pe.image.height,Qe=tt.convert(Se.format),nt=tt.convert(Se.type);B.setTexture2D(Se,0),O.pixelStorei(O.UNPACK_FLIP_Y_WEBGL,Se.flipY),O.pixelStorei(O.UNPACK_PREMULTIPLY_ALPHA_WEBGL,Se.premultiplyAlpha),O.pixelStorei(O.UNPACK_ALIGNMENT,Se.unpackAlignment),pe.isDataTexture?O.texSubImage2D(O.TEXTURE_2D,Te,U.x,U.y,ge,Ye,Qe,nt,pe.image.data):pe.isCompressedTexture?O.compressedTexSubImage2D(O.TEXTURE_2D,Te,U.x,U.y,pe.mipmaps[0].width,pe.mipmaps[0].height,Qe,pe.mipmaps[0].data):O.texSubImage2D(O.TEXTURE_2D,Te,U.x,U.y,Qe,nt,pe.image),Te===0&&Se.generateMipmaps&&O.generateMipmap(O.TEXTURE_2D),te.unbindTexture()},this.copyTextureToTexture3D=function(U,pe,Se,Te,ge=0){if(S.isWebGL1Renderer){console.warn("THREE.WebGLRenderer.copyTextureToTexture3D: can only be used with WebGL2.");return}const Ye=U.max.x-U.min.x+1,Qe=U.max.y-U.min.y+1,nt=U.max.z-U.min.z+1,rt=tt.convert(Te.format),ct=tt.convert(Te.type);let st;if(Te.isData3DTexture)B.setTexture3D(Te,0),st=O.TEXTURE_3D;else if(Te.isDataArrayTexture)B.setTexture2DArray(Te,0),st=O.TEXTURE_2D_ARRAY;else{console.warn("THREE.WebGLRenderer.copyTextureToTexture3D: only supports THREE.DataTexture3D and THREE.DataTexture2DArray.");return}O.pixelStorei(O.UNPACK_FLIP_Y_WEBGL,Te.flipY),O.pixelStorei(O.UNPACK_PREMULTIPLY_ALPHA_WEBGL,Te.premultiplyAlpha),O.pixelStorei(O.UNPACK_ALIGNMENT,Te.unpackAlignment);const at=O.getParameter(O.UNPACK_ROW_LENGTH),Ft=O.getParameter(O.UNPACK_IMAGE_HEIGHT),cn=O.getParameter(O.UNPACK_SKIP_PIXELS),qt=O.getParameter(O.UNPACK_SKIP_ROWS),fn=O.getParameter(O.UNPACK_SKIP_IMAGES),Bt=Se.isCompressedTexture?Se.mipmaps[0]:Se.image;O.pixelStorei(O.UNPACK_ROW_LENGTH,Bt.width),O.pixelStorei(O.UNPACK_IMAGE_HEIGHT,Bt.height),O.pixelStorei(O.UNPACK_SKIP_PIXELS,U.min.x),O.pixelStorei(O.UNPACK_SKIP_ROWS,U.min.y),O.pixelStorei(O.UNPACK_SKIP_IMAGES,U.min.z),Se.isDataTexture||Se.isData3DTexture?O.texSubImage3D(st,ge,pe.x,pe.y,pe.z,Ye,Qe,nt,rt,ct,Bt.data):Se.isCompressedArrayTexture?(console.warn("THREE.WebGLRenderer.copyTextureToTexture3D: untested support for compressed srcTexture."),O.compressedTexSubImage3D(st,ge,pe.x,pe.y,pe.z,Ye,Qe,nt,rt,Bt.data)):O.texSubImage3D(st,ge,pe.x,pe.y,pe.z,Ye,Qe,nt,rt,ct,Bt),O.pixelStorei(O.UNPACK_ROW_LENGTH,at),O.pixelStorei(O.UNPACK_IMAGE_HEIGHT,Ft),O.pixelStorei(O.UNPACK_SKIP_PIXELS,cn),O.pixelStorei(O.UNPACK_SKIP_ROWS,qt),O.pixelStorei(O.UNPACK_SKIP_IMAGES,fn),ge===0&&Te.generateMipmaps&&O.generateMipmap(st),te.unbindTexture()},this.initTexture=function(U){U.isCubeTexture?B.setTextureCube(U,0):U.isData3DTexture?B.setTexture3D(U,0):U.isDataArrayTexture||U.isCompressedArrayTexture?B.setTexture2DArray(U,0):B.setTexture2D(U,0),te.unbindTexture()},this.resetState=function(){T=0,C=0,N=null,te.reset(),We.reset()},typeof __THREE_DEVTOOLS__<"u"&&__THREE_DEVTOOLS__.dispatchEvent(new CustomEvent("observe",{detail:this}))}get coordinateSystem(){return nr}get outputColorSpace(){return this._outputColorSpace}set outputColorSpace(e){this._outputColorSpace=e;const t=this.getContext();t.drawingBufferColorSpace=e===FE?"display-p3":"srgb",t.unpackColorSpace=Nt.workingColorSpace===au?"display-p3":"srgb"}get physicallyCorrectLights(){return console.warn("THREE.WebGLRenderer: The property .physicallyCorrectLights has been removed. Set renderer.useLegacyLights instead."),!this.useLegacyLights}set physicallyCorrectLights(e){console.warn("THREE.WebGLRenderer: The property .physicallyCorrectLights has been removed. Set renderer.useLegacyLights instead."),this.useLegacyLights=!e}get outputEncoding(){return console.warn("THREE.WebGLRenderer: Property .outputEncoding has been removed. Use .outputColorSpace instead."),this.outputColorSpace===Kt?Ns:Jw}set outputEncoding(e){console.warn("THREE.WebGLRenderer: Property .outputEncoding has been removed. Use .outputColorSpace instead."),this.outputColorSpace=e===Ns?Kt:hn}get useLegacyLights(){return console.warn("THREE.WebGLRenderer: The property .useLegacyLights has been deprecated. Migrate your lighting according to the following guide: https://discourse.threejs.org/t/updates-to-lighting-in-three-js-r155/53733."),this._useLegacyLights}set useLegacyLights(e){console.warn("THREE.WebGLRenderer: The property .useLegacyLights has been deprecated. Migrate your lighting according to the following guide: https://discourse.threejs.org/t/updates-to-lighting-in-three-js-r155/53733."),this._useLegacyLights=e}}class Gvt extends bO{}Gvt.prototype.isWebGL1Renderer=!0;class zvt extends Yt{constructor(){super(),this.isScene=!0,this.type="Scene",this.background=null,this.environment=null,this.fog=null,this.backgroundBlurriness=0,this.backgroundIntensity=1,this.overrideMaterial=null,typeof __THREE_DEVTOOLS__<"u"&&__THREE_DEVTOOLS__.dispatchEvent(new CustomEvent("observe",{detail:this}))}copy(e,t){return super.copy(e,t),e.background!==null&&(this.background=e.background.clone()),e.environment!==null&&(this.environment=e.environment.clone()),e.fog!==null&&(this.fog=e.fog.clone()),this.backgroundBlurriness=e.backgroundBlurriness,this.backgroundIntensity=e.backgroundIntensity,e.overrideMaterial!==null&&(this.overrideMaterial=e.overrideMaterial.clone()),this.matrixAutoUpdate=e.matrixAutoUpdate,this}toJSON(e){const t=super.toJSON(e);return this.fog!==null&&(t.object.fog=this.fog.toJSON()),this.backgroundBlurriness>0&&(t.object.backgroundBlurriness=this.backgroundBlurriness),this.backgroundIntensity!==1&&(t.object.backgroundIntensity=this.backgroundIntensity),t}}class Vvt{constructor(e,t){this.isInterleavedBuffer=!0,this.array=e,this.stride=t,this.count=e!==void 0?e.length/t:0,this.usage=tg,this._updateRange={offset:0,count:-1},this.updateRanges=[],this.version=0,this.uuid=fi()}onUploadCallback(){}set needsUpdate(e){e===!0&&this.version++}get updateRange(){return console.warn('THREE.InterleavedBuffer: "updateRange" is deprecated and removed in r169. Use "addUpdateRange()" instead.'),this._updateRange}setUsage(e){return this.usage=e,this}addUpdateRange(e,t){this.updateRanges.push({start:e,count:t})}clearUpdateRanges(){this.updateRanges.length=0}copy(e){return this.array=new e.array.constructor(e.array),this.count=e.count,this.stride=e.stride,this.usage=e.usage,this}copyAt(e,t,i){e*=this.stride,i*=t.stride;for(let r=0,s=this.stride;rl)continue;_.applyMatrix4(this.matrixWorld);const x=e.ray.origin.distanceTo(_);xe.far||t.push({distance:x,point:u.clone().applyMatrix4(this.matrixWorld),index:S,face:null,faceIndex:null,object:this})}}else{const m=Math.max(0,o.start),b=Math.min(g.count,o.start+o.count);for(let S=m,v=b-1;Sl)continue;_.applyMatrix4(this.matrixWorld);const C=e.ray.origin.distanceTo(_);Ce.far||t.push({distance:C,point:u.clone().applyMatrix4(this.matrixWorld),index:S,face:null,faceIndex:null,object:this})}}}updateMorphTargets(){const t=this.geometry.morphAttributes,i=Object.keys(t);if(i.length>0){const r=t[i[0]];if(r!==void 0){this.morphTargetInfluences=[],this.morphTargetDictionary={};for(let s=0,o=r.length;s0){const r=t[i[0]];if(r!==void 0){this.morphTargetInfluences=[],this.morphTargetDictionary={};for(let s=0,o=r.length;sr.far)return;s.push({distance:c,distanceToRay:Math.sqrt(a),point:l,index:e,face:null,object:o})}}class WE extends mi{constructor(e){super(),this.isMeshStandardMaterial=!0,this.defines={STANDARD:""},this.type="MeshStandardMaterial",this.color=new ot(16777215),this.roughness=1,this.metalness=0,this.map=null,this.lightMap=null,this.lightMapIntensity=1,this.aoMap=null,this.aoMapIntensity=1,this.emissive=new ot(0),this.emissiveIntensity=1,this.emissiveMap=null,this.bumpMap=null,this.bumpScale=1,this.normalMap=null,this.normalMapType=UE,this.normalScale=new vt(1,1),this.displacementMap=null,this.displacementScale=1,this.displacementBias=0,this.roughnessMap=null,this.metalnessMap=null,this.alphaMap=null,this.envMap=null,this.envMapIntensity=1,this.wireframe=!1,this.wireframeLinewidth=1,this.wireframeLinecap="round",this.wireframeLinejoin="round",this.flatShading=!1,this.fog=!0,this.setValues(e)}copy(e){return super.copy(e),this.defines={STANDARD:""},this.color.copy(e.color),this.roughness=e.roughness,this.metalness=e.metalness,this.map=e.map,this.lightMap=e.lightMap,this.lightMapIntensity=e.lightMapIntensity,this.aoMap=e.aoMap,this.aoMapIntensity=e.aoMapIntensity,this.emissive.copy(e.emissive),this.emissiveMap=e.emissiveMap,this.emissiveIntensity=e.emissiveIntensity,this.bumpMap=e.bumpMap,this.bumpScale=e.bumpScale,this.normalMap=e.normalMap,this.normalMapType=e.normalMapType,this.normalScale.copy(e.normalScale),this.displacementMap=e.displacementMap,this.displacementScale=e.displacementScale,this.displacementBias=e.displacementBias,this.roughnessMap=e.roughnessMap,this.metalnessMap=e.metalnessMap,this.alphaMap=e.alphaMap,this.envMap=e.envMap,this.envMapIntensity=e.envMapIntensity,this.wireframe=e.wireframe,this.wireframeLinewidth=e.wireframeLinewidth,this.wireframeLinecap=e.wireframeLinecap,this.wireframeLinejoin=e.wireframeLinejoin,this.flatShading=e.flatShading,this.fog=e.fog,this}}class fr extends WE{constructor(e){super(),this.isMeshPhysicalMaterial=!0,this.defines={STANDARD:"",PHYSICAL:""},this.type="MeshPhysicalMaterial",this.anisotropyRotation=0,this.anisotropyMap=null,this.clearcoatMap=null,this.clearcoatRoughness=0,this.clearcoatRoughnessMap=null,this.clearcoatNormalScale=new vt(1,1),this.clearcoatNormalMap=null,this.ior=1.5,Object.defineProperty(this,"reflectivity",{get:function(){return En(2.5*(this.ior-1)/(this.ior+1),0,1)},set:function(t){this.ior=(1+.4*t)/(1-.4*t)}}),this.iridescenceMap=null,this.iridescenceIOR=1.3,this.iridescenceThicknessRange=[100,400],this.iridescenceThicknessMap=null,this.sheenColor=new ot(0),this.sheenColorMap=null,this.sheenRoughness=1,this.sheenRoughnessMap=null,this.transmissionMap=null,this.thickness=0,this.thicknessMap=null,this.attenuationDistance=1/0,this.attenuationColor=new ot(1,1,1),this.specularIntensity=1,this.specularIntensityMap=null,this.specularColor=new ot(1,1,1),this.specularColorMap=null,this._anisotropy=0,this._clearcoat=0,this._iridescence=0,this._sheen=0,this._transmission=0,this.setValues(e)}get anisotropy(){return this._anisotropy}set anisotropy(e){this._anisotropy>0!=e>0&&this.version++,this._anisotropy=e}get clearcoat(){return this._clearcoat}set clearcoat(e){this._clearcoat>0!=e>0&&this.version++,this._clearcoat=e}get iridescence(){return this._iridescence}set iridescence(e){this._iridescence>0!=e>0&&this.version++,this._iridescence=e}get sheen(){return this._sheen}set sheen(e){this._sheen>0!=e>0&&this.version++,this._sheen=e}get transmission(){return this._transmission}set transmission(e){this._transmission>0!=e>0&&this.version++,this._transmission=e}copy(e){return super.copy(e),this.defines={STANDARD:"",PHYSICAL:""},this.anisotropy=e.anisotropy,this.anisotropyRotation=e.anisotropyRotation,this.anisotropyMap=e.anisotropyMap,this.clearcoat=e.clearcoat,this.clearcoatMap=e.clearcoatMap,this.clearcoatRoughness=e.clearcoatRoughness,this.clearcoatRoughnessMap=e.clearcoatRoughnessMap,this.clearcoatNormalMap=e.clearcoatNormalMap,this.clearcoatNormalScale.copy(e.clearcoatNormalScale),this.ior=e.ior,this.iridescence=e.iridescence,this.iridescenceMap=e.iridescenceMap,this.iridescenceIOR=e.iridescenceIOR,this.iridescenceThicknessRange=[...e.iridescenceThicknessRange],this.iridescenceThicknessMap=e.iridescenceThicknessMap,this.sheen=e.sheen,this.sheenColor.copy(e.sheenColor),this.sheenColorMap=e.sheenColorMap,this.sheenRoughness=e.sheenRoughness,this.sheenRoughnessMap=e.sheenRoughnessMap,this.transmission=e.transmission,this.transmissionMap=e.transmissionMap,this.thickness=e.thickness,this.thicknessMap=e.thicknessMap,this.attenuationDistance=e.attenuationDistance,this.attenuationColor.copy(e.attenuationColor),this.specularIntensity=e.specularIntensity,this.specularIntensityMap=e.specularIntensityMap,this.specularColor.copy(e.specularColor),this.specularColorMap=e.specularColorMap,this}}class iR extends mi{constructor(e){super(),this.isMeshPhongMaterial=!0,this.type="MeshPhongMaterial",this.color=new ot(16777215),this.specular=new ot(1118481),this.shininess=30,this.map=null,this.lightMap=null,this.lightMapIntensity=1,this.aoMap=null,this.aoMapIntensity=1,this.emissive=new ot(0),this.emissiveIntensity=1,this.emissiveMap=null,this.bumpMap=null,this.bumpScale=1,this.normalMap=null,this.normalMapType=UE,this.normalScale=new vt(1,1),this.displacementMap=null,this.displacementScale=1,this.displacementBias=0,this.specularMap=null,this.alphaMap=null,this.envMap=null,this.combine=kE,this.reflectivity=1,this.refractionRatio=.98,this.wireframe=!1,this.wireframeLinewidth=1,this.wireframeLinecap="round",this.wireframeLinejoin="round",this.flatShading=!1,this.fog=!0,this.setValues(e)}copy(e){return super.copy(e),this.color.copy(e.color),this.specular.copy(e.specular),this.shininess=e.shininess,this.map=e.map,this.lightMap=e.lightMap,this.lightMapIntensity=e.lightMapIntensity,this.aoMap=e.aoMap,this.aoMapIntensity=e.aoMapIntensity,this.emissive.copy(e.emissive),this.emissiveMap=e.emissiveMap,this.emissiveIntensity=e.emissiveIntensity,this.bumpMap=e.bumpMap,this.bumpScale=e.bumpScale,this.normalMap=e.normalMap,this.normalMapType=e.normalMapType,this.normalScale.copy(e.normalScale),this.displacementMap=e.displacementMap,this.displacementScale=e.displacementScale,this.displacementBias=e.displacementBias,this.specularMap=e.specularMap,this.alphaMap=e.alphaMap,this.envMap=e.envMap,this.combine=e.combine,this.reflectivity=e.reflectivity,this.refractionRatio=e.refractionRatio,this.wireframe=e.wireframe,this.wireframeLinewidth=e.wireframeLinewidth,this.wireframeLinecap=e.wireframeLinecap,this.wireframeLinejoin=e.wireframeLinejoin,this.flatShading=e.flatShading,this.fog=e.fog,this}}function Pc(n,e,t){return!n||!t&&n.constructor===e?n:typeof e.BYTES_PER_ELEMENT=="number"?new e(n):Array.prototype.slice.call(n)}function Zvt(n){return ArrayBuffer.isView(n)&&!(n instanceof DataView)}function Jvt(n){function e(r,s){return n[r]-n[s]}const t=n.length,i=new Array(t);for(let r=0;r!==t;++r)i[r]=r;return i.sort(e),i}function rR(n,e,t){const i=n.length,r=new n.constructor(i);for(let s=0,o=0;o!==i;++s){const a=t[s]*e;for(let l=0;l!==e;++l)r[o++]=n[a+l]}return r}function TO(n,e,t,i){let r=1,s=n[0];for(;s!==void 0&&s[i]===void 0;)s=n[r++];if(s===void 0)return;let o=s[i];if(o!==void 0)if(Array.isArray(o))do o=s[i],o!==void 0&&(e.push(s.time),t.push.apply(t,o)),s=n[r++];while(s!==void 0);else if(o.toArray!==void 0)do o=s[i],o!==void 0&&(e.push(s.time),o.toArray(t,t.length)),s=n[r++];while(s!==void 0);else do o=s[i],o!==void 0&&(e.push(s.time),t.push(o)),s=n[r++];while(s!==void 0)}class Bl{constructor(e,t,i,r){this.parameterPositions=e,this._cachedIndex=0,this.resultBuffer=r!==void 0?r:new t.constructor(i),this.sampleValues=t,this.valueSize=i,this.settings=null,this.DefaultSettings_={}}evaluate(e){const t=this.parameterPositions;let i=this._cachedIndex,r=t[i],s=t[i-1];e:{t:{let o;n:{i:if(!(e=s)){const a=t[1];e=s)break t}o=i,i=0;break n}break e}for(;i>>1;et;)--o;if(++o,s!==0||o!==r){s>=o&&(o=Math.max(o,1),s=o-1);const a=this.getValueSize();this.times=i.slice(s,o),this.values=this.values.slice(s*a,o*a)}return this}validate(){let e=!0;const t=this.getValueSize();t-Math.floor(t)!==0&&(console.error("THREE.KeyframeTrack: Invalid value size in track.",this),e=!1);const i=this.times,r=this.values,s=i.length;s===0&&(console.error("THREE.KeyframeTrack: Track is empty.",this),e=!1);let o=null;for(let a=0;a!==s;a++){const l=i[a];if(typeof l=="number"&&isNaN(l)){console.error("THREE.KeyframeTrack: Time is not a valid number.",this,a,l),e=!1;break}if(o!==null&&o>l){console.error("THREE.KeyframeTrack: Out of order keys.",this,a,l,o),e=!1;break}o=l}if(r!==void 0&&Zvt(r))for(let a=0,l=r.length;a!==l;++a){const c=r[a];if(isNaN(c)){console.error("THREE.KeyframeTrack: Value is not a valid number.",this,a,c),e=!1;break}}return e}optimize(){const e=this.times.slice(),t=this.values.slice(),i=this.getValueSize(),r=this.getInterpolation()===Df,s=e.length-1;let o=1;for(let a=1;a0){e[o]=e[s];for(let a=s*i,l=o*i,c=0;c!==i;++c)t[l+c]=t[a+c];++o}return o!==e.length?(this.times=e.slice(0,o),this.values=t.slice(0,o*i)):(this.times=e,this.values=t),this}clone(){const e=this.times.slice(),t=this.values.slice(),i=this.constructor,r=new i(this.name,e,t);return r.createInterpolant=this.createInterpolant,r}}Bi.prototype.TimeBufferType=Float32Array;Bi.prototype.ValueBufferType=Float32Array;Bi.prototype.DefaultInterpolation=Jo;class ga extends Bi{}ga.prototype.ValueTypeName="bool";ga.prototype.ValueBufferType=Array;ga.prototype.DefaultInterpolation=Tl;ga.prototype.InterpolantFactoryMethodLinear=void 0;ga.prototype.InterpolantFactoryMethodSmooth=void 0;class xO extends Bi{}xO.prototype.ValueTypeName="color";class na extends Bi{}na.prototype.ValueTypeName="number";class iTt extends Bl{constructor(e,t,i,r){super(e,t,i,r)}interpolate_(e,t,i,r){const s=this.resultBuffer,o=this.sampleValues,a=this.valueSize,l=(i-t)/(r-t);let c=e*a;for(let d=c+a;c!==d;c+=4)Xr.slerpFlat(s,0,o,c-a,o,c,l);return s}}class Fs extends Bi{InterpolantFactoryMethodLinear(e){return new iTt(this.times,this.values,this.getValueSize(),e)}}Fs.prototype.ValueTypeName="quaternion";Fs.prototype.DefaultInterpolation=Jo;Fs.prototype.InterpolantFactoryMethodSmooth=void 0;class Ea extends Bi{}Ea.prototype.ValueTypeName="string";Ea.prototype.ValueBufferType=Array;Ea.prototype.DefaultInterpolation=Tl;Ea.prototype.InterpolantFactoryMethodLinear=void 0;Ea.prototype.InterpolantFactoryMethodSmooth=void 0;class ia extends Bi{}ia.prototype.ValueTypeName="vector";class rTt{constructor(e,t=-1,i,r=cgt){this.name=e,this.tracks=i,this.duration=t,this.blendMode=r,this.uuid=fi(),this.duration<0&&this.resetDuration()}static parse(e){const t=[],i=e.tracks,r=1/(e.fps||1);for(let o=0,a=i.length;o!==a;++o)t.push(oTt(i[o]).scale(r));const s=new this(e.name,e.duration,t,e.blendMode);return s.uuid=e.uuid,s}static toJSON(e){const t=[],i=e.tracks,r={name:e.name,duration:e.duration,tracks:t,uuid:e.uuid,blendMode:e.blendMode};for(let s=0,o=i.length;s!==o;++s)t.push(Bi.toJSON(i[s]));return r}static CreateFromMorphTargetSequence(e,t,i,r){const s=t.length,o=[];for(let a=0;a1){const u=d[1];let _=r[u];_||(r[u]=_=[]),_.push(c)}}const o=[];for(const a in r)o.push(this.CreateFromMorphTargetSequence(a,r[a],t,i));return o}static parseAnimation(e,t){if(!e)return console.error("THREE.AnimationClip: No animation in JSONLoader data."),null;const i=function(u,_,f,h,E){if(f.length!==0){const g=[],m=[];TO(f,g,m,h),g.length!==0&&E.push(new u(_,g,m))}},r=[],s=e.name||"default",o=e.fps||30,a=e.blendMode;let l=e.length||-1;const c=e.hierarchy||[];for(let u=0;u{t&&t(s),this.manager.itemEnd(e)},0),s;if(Qi[e]!==void 0){Qi[e].push({onLoad:t,onProgress:i,onError:r});return}Qi[e]=[],Qi[e].push({onLoad:t,onProgress:i,onError:r});const o=new Request(e,{headers:new Headers(this.requestHeader),credentials:this.withCredentials?"include":"same-origin"}),a=this.mimeType,l=this.responseType;fetch(o).then(c=>{if(c.status===200||c.status===0){if(c.status===0&&console.warn("THREE.FileLoader: HTTP Status 0 received."),typeof ReadableStream>"u"||c.body===void 0||c.body.getReader===void 0)return c;const d=Qi[e],u=c.body.getReader(),_=c.headers.get("Content-Length")||c.headers.get("X-File-Size"),f=_?parseInt(_):0,h=f!==0;let E=0;const g=new ReadableStream({start(m){b();function b(){u.read().then(({done:S,value:v})=>{if(S)m.close();else{E+=v.byteLength;const T=new ProgressEvent("progress",{lengthComputable:h,loaded:E,total:f});for(let C=0,N=d.length;C{switch(l){case"arraybuffer":return c.arrayBuffer();case"blob":return c.blob();case"document":return c.text().then(d=>new DOMParser().parseFromString(d,a));case"json":return c.json();default:if(a===void 0)return c.text();{const u=/charset="?([^;"\s]*)"?/i.exec(a),_=u&&u[1]?u[1].toLowerCase():void 0,f=new TextDecoder(_);return c.arrayBuffer().then(h=>f.decode(h))}}}).then(c=>{ra.add(e,c);const d=Qi[e];delete Qi[e];for(let u=0,_=d.length;u<_;u++){const f=d[u];f.onLoad&&f.onLoad(c)}}).catch(c=>{const d=Qi[e];if(d===void 0)throw this.manager.itemError(e),c;delete Qi[e];for(let u=0,_=d.length;u<_;u++){const f=d[u];f.onError&&f.onError(c)}this.manager.itemError(e)}).finally(()=>{this.manager.itemEnd(e)}),this.manager.itemStart(e)}setResponseType(e){return this.responseType=e,this}setMimeType(e){return this.mimeType=e,this}}class dTt extends ba{constructor(e){super(e)}load(e,t,i,r){this.path!==void 0&&(e=this.path+e),e=this.manager.resolveURL(e);const s=this,o=ra.get(e);if(o!==void 0)return s.manager.itemStart(e),setTimeout(function(){t&&t(o),s.manager.itemEnd(e)},0),o;const a=xl("img");function l(){d(),ra.add(e,this),t&&t(this),s.manager.itemEnd(e)}function c(u){d(),r&&r(u),s.manager.itemError(e),s.manager.itemEnd(e)}function d(){a.removeEventListener("load",l,!1),a.removeEventListener("error",c,!1)}return a.addEventListener("load",l,!1),a.addEventListener("error",c,!1),e.slice(0,5)!=="data:"&&this.crossOrigin!==void 0&&(a.crossOrigin=this.crossOrigin),s.manager.itemStart(e),a.src=e,a}}class RO extends ba{constructor(e){super(e)}load(e,t,i,r){const s=new pn,o=new dTt(this.manager);return o.setCrossOrigin(this.crossOrigin),o.setPath(this.path),o.load(e,function(a){s.image=a,s.needsUpdate=!0,t!==void 0&&t(s)},i,r),s}}class uu extends Yt{constructor(e,t=1){super(),this.isLight=!0,this.type="Light",this.color=new ot(e),this.intensity=t}dispose(){}copy(e,t){return super.copy(e,t),this.color.copy(e.color),this.intensity=e.intensity,this}toJSON(e){const t=super.toJSON(e);return t.object.color=this.color.getHex(),t.object.intensity=this.intensity,this.groundColor!==void 0&&(t.object.groundColor=this.groundColor.getHex()),this.distance!==void 0&&(t.object.distance=this.distance),this.angle!==void 0&&(t.object.angle=this.angle),this.decay!==void 0&&(t.object.decay=this.decay),this.penumbra!==void 0&&(t.object.penumbra=this.penumbra),this.shadow!==void 0&&(t.object.shadow=this.shadow.toJSON()),t}}const om=new gt,sR=new ue,oR=new ue;class KE{constructor(e){this.camera=e,this.bias=0,this.normalBias=0,this.radius=1,this.blurSamples=8,this.mapSize=new vt(512,512),this.map=null,this.mapPass=null,this.matrix=new gt,this.autoUpdate=!0,this.needsUpdate=!1,this._frustum=new GE,this._frameExtents=new vt(1,1),this._viewportCount=1,this._viewports=[new Pt(0,0,1,1)]}getViewportCount(){return this._viewportCount}getFrustum(){return this._frustum}updateMatrices(e){const t=this.camera,i=this.matrix;sR.setFromMatrixPosition(e.matrixWorld),t.position.copy(sR),oR.setFromMatrixPosition(e.target.matrixWorld),t.lookAt(oR),t.updateMatrixWorld(),om.multiplyMatrices(t.projectionMatrix,t.matrixWorldInverse),this._frustum.setFromProjectionMatrix(om),i.set(.5,0,0,.5,0,.5,0,.5,0,0,.5,.5,0,0,0,1),i.multiply(om)}getViewport(e){return this._viewports[e]}getFrameExtents(){return this._frameExtents}dispose(){this.map&&this.map.dispose(),this.mapPass&&this.mapPass.dispose()}copy(e){return this.camera=e.camera.clone(),this.bias=e.bias,this.radius=e.radius,this.mapSize.copy(e.mapSize),this}clone(){return new this.constructor().copy(this)}toJSON(){const e={};return this.bias!==0&&(e.bias=this.bias),this.normalBias!==0&&(e.normalBias=this.normalBias),this.radius!==1&&(e.radius=this.radius),(this.mapSize.x!==512||this.mapSize.y!==512)&&(e.mapSize=this.mapSize.toArray()),e.camera=this.camera.toJSON(!1).object,delete e.camera.matrix,e}}class uTt extends KE{constructor(){super(new Rn(50,1,.5,500)),this.isSpotLightShadow=!0,this.focus=1}updateMatrices(e){const t=this.camera,i=ea*2*e.angle*this.focus,r=this.mapSize.width/this.mapSize.height,s=e.distance||t.far;(i!==t.fov||r!==t.aspect||s!==t.far)&&(t.fov=i,t.aspect=r,t.far=s,t.updateProjectionMatrix()),super.updateMatrices(e)}copy(e){return super.copy(e),this.focus=e.focus,this}}class _Tt extends uu{constructor(e,t,i=0,r=Math.PI/3,s=0,o=2){super(e,t),this.isSpotLight=!0,this.type="SpotLight",this.position.copy(Yt.DEFAULT_UP),this.updateMatrix(),this.target=new Yt,this.distance=i,this.angle=r,this.penumbra=s,this.decay=o,this.map=null,this.shadow=new uTt}get power(){return this.intensity*Math.PI}set power(e){this.intensity=e/Math.PI}dispose(){this.shadow.dispose()}copy(e,t){return super.copy(e,t),this.distance=e.distance,this.angle=e.angle,this.penumbra=e.penumbra,this.decay=e.decay,this.target=e.target.clone(),this.shadow=e.shadow.clone(),this}}const aR=new gt,Ga=new ue,am=new ue;class pTt extends KE{constructor(){super(new Rn(90,1,.5,500)),this.isPointLightShadow=!0,this._frameExtents=new vt(4,2),this._viewportCount=6,this._viewports=[new Pt(2,1,1,1),new Pt(0,1,1,1),new Pt(3,1,1,1),new Pt(1,1,1,1),new Pt(3,0,1,1),new Pt(1,0,1,1)],this._cubeDirections=[new ue(1,0,0),new ue(-1,0,0),new ue(0,0,1),new ue(0,0,-1),new ue(0,1,0),new ue(0,-1,0)],this._cubeUps=[new ue(0,1,0),new ue(0,1,0),new ue(0,1,0),new ue(0,1,0),new ue(0,0,1),new ue(0,0,-1)]}updateMatrices(e,t=0){const i=this.camera,r=this.matrix,s=e.distance||i.far;s!==i.far&&(i.far=s,i.updateProjectionMatrix()),Ga.setFromMatrixPosition(e.matrixWorld),i.position.copy(Ga),am.copy(i.position),am.add(this._cubeDirections[t]),i.up.copy(this._cubeUps[t]),i.lookAt(am),i.updateMatrixWorld(),r.makeTranslation(-Ga.x,-Ga.y,-Ga.z),aR.multiplyMatrices(i.projectionMatrix,i.matrixWorldInverse),this._frustum.setFromProjectionMatrix(aR)}}class hTt extends uu{constructor(e,t,i=0,r=2){super(e,t),this.isPointLight=!0,this.type="PointLight",this.distance=i,this.decay=r,this.shadow=new pTt}get power(){return this.intensity*4*Math.PI}set power(e){this.intensity=e/(4*Math.PI)}dispose(){this.shadow.dispose()}copy(e,t){return super.copy(e,t),this.distance=e.distance,this.decay=e.decay,this.shadow=e.shadow.clone(),this}}class fTt extends KE{constructor(){super(new VE(-5,5,5,-5,.5,500)),this.isDirectionalLightShadow=!0}}class AO extends uu{constructor(e,t){super(e,t),this.isDirectionalLight=!0,this.type="DirectionalLight",this.position.copy(Yt.DEFAULT_UP),this.updateMatrix(),this.target=new Yt,this.shadow=new fTt}dispose(){this.shadow.dispose()}copy(e){return super.copy(e),this.target=e.target.clone(),this.shadow=e.shadow.clone(),this}}class mTt extends uu{constructor(e,t){super(e,t),this.isAmbientLight=!0,this.type="AmbientLight"}}class rl{static decodeText(e){if(typeof TextDecoder<"u")return new TextDecoder().decode(e);let t="";for(let i=0,r=e.length;i"u"&&console.warn("THREE.ImageBitmapLoader: createImageBitmap() not supported."),typeof fetch>"u"&&console.warn("THREE.ImageBitmapLoader: fetch() not supported."),this.options={premultiplyAlpha:"none"}}setOptions(e){return this.options=e,this}load(e,t,i,r){e===void 0&&(e=""),this.path!==void 0&&(e=this.path+e),e=this.manager.resolveURL(e);const s=this,o=ra.get(e);if(o!==void 0)return s.manager.itemStart(e),setTimeout(function(){t&&t(o),s.manager.itemEnd(e)},0),o;const a={};a.credentials=this.crossOrigin==="anonymous"?"same-origin":"include",a.headers=this.requestHeader,fetch(e,a).then(function(l){return l.blob()}).then(function(l){return createImageBitmap(l,Object.assign(s.options,{colorSpaceConversion:"none"}))}).then(function(l){ra.add(e,l),t&&t(l),s.manager.itemEnd(e)}).catch(function(l){r&&r(l),s.manager.itemError(e),s.manager.itemEnd(e)}),s.manager.itemStart(e)}}const jE="\\[\\]\\.:\\/",ETt=new RegExp("["+jE+"]","g"),QE="[^"+jE+"]",bTt="[^"+jE.replace("\\.","")+"]",STt=/((?:WC+[\/:])*)/.source.replace("WC",QE),yTt=/(WCOD+)?/.source.replace("WCOD",bTt),vTt=/(?:\.(WC+)(?:\[(.+)\])?)?/.source.replace("WC",QE),TTt=/\.(WC+)(?:\[(.+)\])?/.source.replace("WC",QE),xTt=new RegExp("^"+STt+yTt+vTt+TTt+"$"),CTt=["material","materials","bones","map"];class RTt{constructor(e,t,i){const r=i||Dt.parseTrackName(t);this._targetGroup=e,this._bindings=e.subscribe_(t,r)}getValue(e,t){this.bind();const i=this._targetGroup.nCachedObjects_,r=this._bindings[i];r!==void 0&&r.getValue(e,t)}setValue(e,t){const i=this._bindings;for(let r=this._targetGroup.nCachedObjects_,s=i.length;r!==s;++r)i[r].setValue(e,t)}bind(){const e=this._bindings;for(let t=this._targetGroup.nCachedObjects_,i=e.length;t!==i;++t)e[t].bind()}unbind(){const e=this._bindings;for(let t=this._targetGroup.nCachedObjects_,i=e.length;t!==i;++t)e[t].unbind()}}class Dt{constructor(e,t,i){this.path=t,this.parsedPath=i||Dt.parseTrackName(t),this.node=Dt.findNode(e,this.parsedPath.nodeName),this.rootNode=e,this.getValue=this._getValue_unbound,this.setValue=this._setValue_unbound}static create(e,t,i){return e&&e.isAnimationObjectGroup?new Dt.Composite(e,t,i):new Dt(e,t,i)}static sanitizeNodeName(e){return e.replace(/\s/g,"_").replace(ETt,"")}static parseTrackName(e){const t=xTt.exec(e);if(t===null)throw new Error("PropertyBinding: Cannot parse trackName: "+e);const i={nodeName:t[2],objectName:t[3],objectIndex:t[4],propertyName:t[5],propertyIndex:t[6]},r=i.nodeName&&i.nodeName.lastIndexOf(".");if(r!==void 0&&r!==-1){const s=i.nodeName.substring(r+1);CTt.indexOf(s)!==-1&&(i.nodeName=i.nodeName.substring(0,r),i.objectName=s)}if(i.propertyName===null||i.propertyName.length===0)throw new Error("PropertyBinding: can not parse propertyName from trackName: "+e);return i}static findNode(e,t){if(t===void 0||t===""||t==="."||t===-1||t===e.name||t===e.uuid)return e;if(e.skeleton){const i=e.skeleton.getBoneByName(t);if(i!==void 0)return i}if(e.children){const i=function(s){for(let o=0;o=2.0 are supported."));return}const c=new s0t(s,{path:t||this.resourcePath||"",crossOrigin:this.crossOrigin,requestHeader:this.requestHeader,manager:this.manager,ktx2Loader:this.ktx2Loader,meshoptDecoder:this.meshoptDecoder});c.fileLoader.setRequestHeader(this.requestHeader);for(let d=0;d=0&&a[u]===void 0&&console.warn('THREE.GLTFLoader: Unknown extension "'+u+'".')}}c.setExtensions(o),c.setPlugins(a),c.parse(i,r)}parseAsync(e,t){const i=this;return new Promise(function(r,s){i.parse(e,t,r,s)})}}function wTt(){let n={};return{get:function(e){return n[e]},add:function(e,t){n[e]=t},remove:function(e){delete n[e]},removeAll:function(){n={}}}}const yt={KHR_BINARY_GLTF:"KHR_binary_glTF",KHR_DRACO_MESH_COMPRESSION:"KHR_draco_mesh_compression",KHR_LIGHTS_PUNCTUAL:"KHR_lights_punctual",KHR_MATERIALS_CLEARCOAT:"KHR_materials_clearcoat",KHR_MATERIALS_IOR:"KHR_materials_ior",KHR_MATERIALS_SHEEN:"KHR_materials_sheen",KHR_MATERIALS_SPECULAR:"KHR_materials_specular",KHR_MATERIALS_TRANSMISSION:"KHR_materials_transmission",KHR_MATERIALS_IRIDESCENCE:"KHR_materials_iridescence",KHR_MATERIALS_ANISOTROPY:"KHR_materials_anisotropy",KHR_MATERIALS_UNLIT:"KHR_materials_unlit",KHR_MATERIALS_VOLUME:"KHR_materials_volume",KHR_TEXTURE_BASISU:"KHR_texture_basisu",KHR_TEXTURE_TRANSFORM:"KHR_texture_transform",KHR_MESH_QUANTIZATION:"KHR_mesh_quantization",KHR_MATERIALS_EMISSIVE_STRENGTH:"KHR_materials_emissive_strength",EXT_MATERIALS_BUMP:"EXT_materials_bump",EXT_TEXTURE_WEBP:"EXT_texture_webp",EXT_TEXTURE_AVIF:"EXT_texture_avif",EXT_MESHOPT_COMPRESSION:"EXT_meshopt_compression",EXT_MESH_GPU_INSTANCING:"EXT_mesh_gpu_instancing"};class OTt{constructor(e){this.parser=e,this.name=yt.KHR_LIGHTS_PUNCTUAL,this.cache={refs:{},uses:{}}}_markDefs(){const e=this.parser,t=this.parser.json.nodes||[];for(let i=0,r=t.length;i=0)throw new Error("THREE.GLTFLoader: setKTX2Loader must be called before loading KTX2 textures");return null}return t.loadTextureImage(e,s.source,o)}}class VTt{constructor(e){this.parser=e,this.name=yt.EXT_TEXTURE_WEBP,this.isSupported=null}loadTexture(e){const t=this.name,i=this.parser,r=i.json,s=r.textures[e];if(!s.extensions||!s.extensions[t])return null;const o=s.extensions[t],a=r.images[o.source];let l=i.textureLoader;if(a.uri){const c=i.options.manager.getHandler(a.uri);c!==null&&(l=c)}return this.detectSupport().then(function(c){if(c)return i.loadTextureImage(e,o.source,l);if(r.extensionsRequired&&r.extensionsRequired.indexOf(t)>=0)throw new Error("THREE.GLTFLoader: WebP required by asset but unsupported.");return i.loadTexture(e)})}detectSupport(){return this.isSupported||(this.isSupported=new Promise(function(e){const t=new Image;t.src="data:image/webp;base64,UklGRiIAAABXRUJQVlA4IBYAAAAwAQCdASoBAAEADsD+JaQAA3AAAAAA",t.onload=t.onerror=function(){e(t.height===1)}})),this.isSupported}}class HTt{constructor(e){this.parser=e,this.name=yt.EXT_TEXTURE_AVIF,this.isSupported=null}loadTexture(e){const t=this.name,i=this.parser,r=i.json,s=r.textures[e];if(!s.extensions||!s.extensions[t])return null;const o=s.extensions[t],a=r.images[o.source];let l=i.textureLoader;if(a.uri){const c=i.options.manager.getHandler(a.uri);c!==null&&(l=c)}return this.detectSupport().then(function(c){if(c)return i.loadTextureImage(e,o.source,l);if(r.extensionsRequired&&r.extensionsRequired.indexOf(t)>=0)throw new Error("THREE.GLTFLoader: AVIF required by asset but unsupported.");return i.loadTexture(e)})}detectSupport(){return this.isSupported||(this.isSupported=new Promise(function(e){const t=new Image;t.src="data:image/avif;base64,AAAAIGZ0eXBhdmlmAAAAAGF2aWZtaWYxbWlhZk1BMUIAAADybWV0YQAAAAAAAAAoaGRscgAAAAAAAAAAcGljdAAAAAAAAAAAAAAAAGxpYmF2aWYAAAAADnBpdG0AAAAAAAEAAAAeaWxvYwAAAABEAAABAAEAAAABAAABGgAAABcAAAAoaWluZgAAAAAAAQAAABppbmZlAgAAAAABAABhdjAxQ29sb3IAAAAAamlwcnAAAABLaXBjbwAAABRpc3BlAAAAAAAAAAEAAAABAAAAEHBpeGkAAAAAAwgICAAAAAxhdjFDgQAMAAAAABNjb2xybmNseAACAAIABoAAAAAXaXBtYQAAAAAAAAABAAEEAQKDBAAAAB9tZGF0EgAKCBgABogQEDQgMgkQAAAAB8dSLfI=",t.onload=t.onerror=function(){e(t.height===1)}})),this.isSupported}}class qTt{constructor(e){this.name=yt.EXT_MESHOPT_COMPRESSION,this.parser=e}loadBufferView(e){const t=this.parser.json,i=t.bufferViews[e];if(i.extensions&&i.extensions[this.name]){const r=i.extensions[this.name],s=this.parser.getDependency("buffer",r.buffer),o=this.parser.options.meshoptDecoder;if(!o||!o.supported){if(t.extensionsRequired&&t.extensionsRequired.indexOf(this.name)>=0)throw new Error("THREE.GLTFLoader: setMeshoptDecoder must be called before loading compressed files");return null}return s.then(function(a){const l=r.byteOffset||0,c=r.byteLength||0,d=r.count,u=r.byteStride,_=new Uint8Array(a,l,c);return o.decodeGltfBufferAsync?o.decodeGltfBufferAsync(d,u,_,r.mode,r.filter).then(function(f){return f.buffer}):o.ready.then(function(){const f=new ArrayBuffer(d*u);return o.decodeGltfBuffer(new Uint8Array(f),d,u,_,r.mode,r.filter),f})})}else return null}}class YTt{constructor(e){this.name=yt.EXT_MESH_GPU_INSTANCING,this.parser=e}createNodeMesh(e){const t=this.parser.json,i=t.nodes[e];if(!i.extensions||!i.extensions[this.name]||i.mesh===void 0)return null;const r=t.meshes[i.mesh];for(const c of r.primitives)if(c.mode!==Yn.TRIANGLES&&c.mode!==Yn.TRIANGLE_STRIP&&c.mode!==Yn.TRIANGLE_FAN&&c.mode!==void 0)return null;const o=i.extensions[this.name].attributes,a=[],l={};for(const c in o)a.push(this.parser.getDependency("accessor",o[c]).then(d=>(l[c]=d,l[c])));return a.length<1?null:(a.push(this.parser.createNodeMesh(e)),Promise.all(a).then(c=>{const d=c.pop(),u=d.isGroup?d.children:[d],_=c[0].count,f=[];for(const h of u){const E=new gt,g=new ue,m=new Xr,b=new ue(1,1,1),S=new Kvt(h.geometry,h.material,_);for(let v=0;v<_;v++)l.TRANSLATION&&g.fromBufferAttribute(l.TRANSLATION,v),l.ROTATION&&m.fromBufferAttribute(l.ROTATION,v),l.SCALE&&b.fromBufferAttribute(l.SCALE,v),S.setMatrixAt(v,E.compose(g,m,b));for(const v in l)if(v==="_COLOR_0"){const T=l[v];S.instanceColor=new sg(T.array,T.itemSize,T.normalized)}else v!=="TRANSLATION"&&v!=="ROTATION"&&v!=="SCALE"&&h.geometry.setAttribute(v,l[v]);Yt.prototype.copy.call(S,h),this.parser.assignFinalMaterial(S),f.push(S)}return d.isGroup?(d.clear(),d.add(...f),d):f[0]}))}}const wO="glTF",za=12,cR={JSON:1313821514,BIN:5130562};class $Tt{constructor(e){this.name=yt.KHR_BINARY_GLTF,this.content=null,this.body=null;const t=new DataView(e,0,za),i=new TextDecoder;if(this.header={magic:i.decode(new Uint8Array(e.slice(0,4))),version:t.getUint32(4,!0),length:t.getUint32(8,!0)},this.header.magic!==wO)throw new Error("THREE.GLTFLoader: Unsupported glTF-Binary header.");if(this.header.version<2)throw new Error("THREE.GLTFLoader: Legacy binary file detected.");const r=this.header.length-za,s=new DataView(e,za);let o=0;for(;o0||n.search(/^data\:image\/jpeg/)===0?"image/jpeg":n.search(/\.webp($|\?)/i)>0||n.search(/^data\:image\/webp/)===0?"image/webp":"image/png"}const r0t=new gt;class s0t{constructor(e={},t={}){this.json=e,this.extensions={},this.plugins={},this.options=t,this.cache=new wTt,this.associations=new Map,this.primitiveCache={},this.nodeCache={},this.meshCache={refs:{},uses:{}},this.cameraCache={refs:{},uses:{}},this.lightCache={refs:{},uses:{}},this.sourceCache={},this.textureCache={},this.nodeNamesUsed={};let i=!1,r=!1,s=-1;typeof navigator<"u"&&(i=/^((?!chrome|android).)*safari/i.test(navigator.userAgent)===!0,r=navigator.userAgent.indexOf("Firefox")>-1,s=r?navigator.userAgent.match(/Firefox\/([0-9]+)\./)[1]:-1),typeof createImageBitmap>"u"||i||r&&s<98?this.textureLoader=new RO(this.options.manager):this.textureLoader=new gTt(this.options.manager),this.textureLoader.setCrossOrigin(this.options.crossOrigin),this.textureLoader.setRequestHeader(this.options.requestHeader),this.fileLoader=new CO(this.options.manager),this.fileLoader.setResponseType("arraybuffer"),this.options.crossOrigin==="use-credentials"&&this.fileLoader.setWithCredentials(!0)}setExtensions(e){this.extensions=e}setPlugins(e){this.plugins=e}parse(e,t){const i=this,r=this.json,s=this.extensions;this.cache.removeAll(),this.nodeCache={},this._invokeAll(function(o){return o._markDefs&&o._markDefs()}),Promise.all(this._invokeAll(function(o){return o.beforeRoot&&o.beforeRoot()})).then(function(){return Promise.all([i.getDependencies("scene"),i.getDependencies("animation"),i.getDependencies("camera")])}).then(function(o){const a={scene:o[0][r.scene||0],scenes:o[0],animations:o[1],cameras:o[2],asset:r.asset,parser:i,userData:{}};return ds(s,a,r),Lr(a,r),Promise.all(i._invokeAll(function(l){return l.afterRoot&&l.afterRoot(a)})).then(function(){e(a)})}).catch(t)}_markDefs(){const e=this.json.nodes||[],t=this.json.skins||[],i=this.json.meshes||[];for(let r=0,s=t.length;r{const l=this.associations.get(o);l!=null&&this.associations.set(a,l);for(const[c,d]of o.children.entries())s(d,a.children[c])};return s(i,r),r.name+="_instance_"+e.uses[t]++,r}_invokeOne(e){const t=Object.values(this.plugins);t.push(this);for(let i=0;i=2&&g.setY(y,C[N*l+1]),l>=3&&g.setZ(y,C[N*l+2]),l>=4&&g.setW(y,C[N*l+3]),l>=5)throw new Error("THREE.GLTFLoader: Unsupported itemSize in sparse BufferAttribute.")}}return g})}loadTexture(e){const t=this.json,i=this.options,s=t.textures[e].source,o=t.images[s];let a=this.textureLoader;if(o.uri){const l=i.manager.getHandler(o.uri);l!==null&&(a=l)}return this.loadTextureImage(e,s,a)}loadTextureImage(e,t,i){const r=this,s=this.json,o=s.textures[e],a=s.images[t],l=(a.uri||a.bufferView)+":"+o.sampler;if(this.textureCache[l])return this.textureCache[l];const c=this.loadImageSource(t,i).then(function(d){d.flipY=!1,d.name=o.name||a.name||"",d.name===""&&typeof a.uri=="string"&&a.uri.startsWith("data:image/")===!1&&(d.name=a.uri);const _=(s.samplers||{})[o.sampler]||{};return d.magFilter=dR[_.magFilter]||Mn,d.minFilter=dR[_.minFilter]||ks,d.wrapS=uR[_.wrapS]||Xo,d.wrapT=uR[_.wrapT]||Xo,r.associations.set(d,{textures:e}),d}).catch(function(){return null});return this.textureCache[l]=c,c}loadImageSource(e,t){const i=this,r=this.json,s=this.options;if(this.sourceCache[e]!==void 0)return this.sourceCache[e].then(u=>u.clone());const o=r.images[e],a=self.URL||self.webkitURL;let l=o.uri||"",c=!1;if(o.bufferView!==void 0)l=i.getDependency("bufferView",o.bufferView).then(function(u){c=!0;const _=new Blob([u],{type:o.mimeType});return l=a.createObjectURL(_),l});else if(o.uri===void 0)throw new Error("THREE.GLTFLoader: Image "+e+" is missing URI and bufferView");const d=Promise.resolve(l).then(function(u){return new Promise(function(_,f){let h=_;t.isImageBitmapLoader===!0&&(h=function(E){const g=new pn(E);g.needsUpdate=!0,_(g)}),t.load(rl.resolveURL(u,s.path),h,void 0,f)})}).then(function(u){return c===!0&&a.revokeObjectURL(l),u.userData.mimeType=o.mimeType||i0t(o.uri),u}).catch(function(u){throw console.error("THREE.GLTFLoader: Couldn't load texture",l),u});return this.sourceCache[e]=d,d}assignTexture(e,t,i,r){const s=this;return this.getDependency("texture",i.index).then(function(o){if(!o)return null;if(i.texCoord!==void 0&&i.texCoord>0&&(o=o.clone(),o.channel=i.texCoord),s.extensions[yt.KHR_TEXTURE_TRANSFORM]){const a=i.extensions!==void 0?i.extensions[yt.KHR_TEXTURE_TRANSFORM]:void 0;if(a){const l=s.associations.get(o);o=s.extensions[yt.KHR_TEXTURE_TRANSFORM].extendTexture(o,a),s.associations.set(o,l)}}return r!==void 0&&(o.colorSpace=r),e[t]=o,o})}assignFinalMaterial(e){const t=e.geometry;let i=e.material;const r=t.attributes.tangent===void 0,s=t.attributes.color!==void 0,o=t.attributes.normal===void 0;if(e.isPoints){const a="PointsMaterial:"+i.uuid;let l=this.cache.get(a);l||(l=new vO,mi.prototype.copy.call(l,i),l.color.copy(i.color),l.map=i.map,l.sizeAttenuation=!1,this.cache.add(a,l)),i=l}else if(e.isLine){const a="LineBasicMaterial:"+i.uuid;let l=this.cache.get(a);l||(l=new yO,mi.prototype.copy.call(l,i),l.color.copy(i.color),l.map=i.map,this.cache.add(a,l)),i=l}if(r||s||o){let a="ClonedMaterial:"+i.uuid+":";r&&(a+="derivative-tangents:"),s&&(a+="vertex-colors:"),o&&(a+="flat-shading:");let l=this.cache.get(a);l||(l=i.clone(),s&&(l.vertexColors=!0),o&&(l.flatShading=!0),r&&(l.normalScale&&(l.normalScale.y*=-1),l.clearcoatNormalScale&&(l.clearcoatNormalScale.y*=-1)),this.cache.add(a,l),this.associations.set(l,this.associations.get(i))),i=l}e.material=i}getMaterialType(){return WE}loadMaterial(e){const t=this,i=this.json,r=this.extensions,s=i.materials[e];let o;const a={},l=s.extensions||{},c=[];if(l[yt.KHR_MATERIALS_UNLIT]){const u=r[yt.KHR_MATERIALS_UNLIT];o=u.getMaterialType(),c.push(u.extendParams(a,s,t))}else{const u=s.pbrMetallicRoughness||{};if(a.color=new ot(1,1,1),a.opacity=1,Array.isArray(u.baseColorFactor)){const _=u.baseColorFactor;a.color.setRGB(_[0],_[1],_[2],hn),a.opacity=_[3]}u.baseColorTexture!==void 0&&c.push(t.assignTexture(a,"map",u.baseColorTexture,Kt)),a.metalness=u.metallicFactor!==void 0?u.metallicFactor:1,a.roughness=u.roughnessFactor!==void 0?u.roughnessFactor:1,u.metallicRoughnessTexture!==void 0&&(c.push(t.assignTexture(a,"metalnessMap",u.metallicRoughnessTexture)),c.push(t.assignTexture(a,"roughnessMap",u.metallicRoughnessTexture))),o=this._invokeOne(function(_){return _.getMaterialType&&_.getMaterialType(e)}),c.push(Promise.all(this._invokeAll(function(_){return _.extendMaterialParams&&_.extendMaterialParams(e,a)})))}s.doubleSided===!0&&(a.side=xi);const d=s.alphaMode||cm.OPAQUE;if(d===cm.BLEND?(a.transparent=!0,a.depthWrite=!1):(a.transparent=!1,d===cm.MASK&&(a.alphaTest=s.alphaCutoff!==void 0?s.alphaCutoff:.5)),s.normalTexture!==void 0&&o!==Fr&&(c.push(t.assignTexture(a,"normalMap",s.normalTexture)),a.normalScale=new vt(1,1),s.normalTexture.scale!==void 0)){const u=s.normalTexture.scale;a.normalScale.set(u,u)}if(s.occlusionTexture!==void 0&&o!==Fr&&(c.push(t.assignTexture(a,"aoMap",s.occlusionTexture)),s.occlusionTexture.strength!==void 0&&(a.aoMapIntensity=s.occlusionTexture.strength)),s.emissiveFactor!==void 0&&o!==Fr){const u=s.emissiveFactor;a.emissive=new ot().setRGB(u[0],u[1],u[2],hn)}return s.emissiveTexture!==void 0&&o!==Fr&&c.push(t.assignTexture(a,"emissiveMap",s.emissiveTexture,Kt)),Promise.all(c).then(function(){const u=new o(a);return s.name&&(u.name=s.name),Lr(u,s),t.associations.set(u,{materials:e}),s.extensions&&ds(r,u,s),u})}createUniqueName(e){const t=Dt.sanitizeNodeName(e||"");return t in this.nodeNamesUsed?t+"_"+ ++this.nodeNamesUsed[t]:(this.nodeNamesUsed[t]=0,t)}loadGeometries(e){const t=this,i=this.extensions,r=this.primitiveCache;function s(a){return i[yt.KHR_DRACO_MESH_COMPRESSION].decodePrimitive(a,t).then(function(l){return _R(l,a,t)})}const o=[];for(let a=0,l=e.length;a0&&t0t(m,s),m.name=t.createUniqueName(s.name||"mesh_"+e),Lr(m,s),g.extensions&&ds(r,m,g),t.assignFinalMaterial(m),u.push(m)}for(let f=0,h=u.length;f1?d=new Ts:c.length===1?d=c[0]:d=new Yt,d!==c[0])for(let u=0,_=c.length;u<_;u++)d.add(c[u]);if(s.name&&(d.userData.name=s.name,d.name=o),Lr(d,s),s.extensions&&ds(i,d,s),s.matrix!==void 0){const u=new gt;u.fromArray(s.matrix),d.applyMatrix4(u)}else s.translation!==void 0&&d.position.fromArray(s.translation),s.rotation!==void 0&&d.quaternion.fromArray(s.rotation),s.scale!==void 0&&d.scale.fromArray(s.scale);return r.associations.has(d)||r.associations.set(d,{}),r.associations.get(d).nodes=e,d}),this.nodeCache[e]}loadScene(e){const t=this.extensions,i=this.json.scenes[e],r=this,s=new Ts;i.name&&(s.name=r.createUniqueName(i.name)),Lr(s,i),i.extensions&&ds(t,s,i);const o=i.nodes||[],a=[];for(let l=0,c=o.length;l{const u=new Map;for(const[_,f]of r.associations)(_ instanceof mi||_ instanceof pn)&&u.set(_,f);return d.traverse(_=>{const f=r.associations.get(_);f!=null&&u.set(_,f)}),u};return r.associations=c(s),s})}_createAnimationTracks(e,t,i,r,s){const o=[],a=e.name?e.name:e.uuid,l=[];Cr[s.path]===Cr.weights?e.traverse(function(_){_.morphTargetInfluences&&l.push(_.name?_.name:_.uuid)}):l.push(a);let c;switch(Cr[s.path]){case Cr.weights:c=na;break;case Cr.rotation:c=Fs;break;case Cr.position:case Cr.scale:c=ia;break;default:switch(i.itemSize){case 1:c=na;break;case 2:case 3:default:c=ia;break}break}const d=r.interpolation!==void 0?ZTt[r.interpolation]:Jo,u=this._getArrayFromAccessor(i);for(let _=0,f=l.length;_{Ge.replace()})},stopVideoStream(){this.isVideoActive=!1,this.imageData=null,He.emit("stop_webcam_video_stream"),Ue(()=>{Ge.replace()})},startDrag(n){this.isDragging=!0,this.zIndex=5001,this.dragStart.x=n.clientX,this.dragStart.y=n.clientY,document.addEventListener("mousemove",this.drag),document.addEventListener("mouseup",this.stopDrag)},drag(n){if(this.isDragging){const e=n.clientX-this.dragStart.x,t=n.clientY-this.dragStart.y;this.position.bottom-=t,this.position.right-=e,this.dragStart.x=n.clientX,this.dragStart.y=n.clientY}},stopDrag(){this.isDragging=!1,this.zIndex=0,document.removeEventListener("mousemove",this.drag),document.removeEventListener("mouseup",this.stopDrag)}},mounted(){Ge.replace(),He.on("video_stream_image",n=>{if(this.isVideoActive){this.imageDataUrl="data:image/jpeg;base64,"+n,this.frameCount++;const e=Date.now();e-this.lastFrameTime>=1e3&&(this.frameRate=this.frameCount,this.frameCount=0,this.lastFrameTime=e)}})}},l0t=["src"],c0t=["src"],d0t={class:"controls"},u0t=p("i",{"data-feather":"video"},null,-1),_0t=[u0t],p0t=p("i",{"data-feather":"video"},null,-1),h0t=[p0t],f0t={key:2};function m0t(n,e,t,i,r,s){return M(),L("div",{class:"floating-frame bg-white",style:un({bottom:r.position.bottom+"px",right:r.position.right+"px","z-index":r.zIndex}),onMousedown:e[4]||(e[4]=Oe((...o)=>s.startDrag&&s.startDrag(...o),["stop"])),onMouseup:e[5]||(e[5]=Oe((...o)=>s.stopDrag&&s.stopDrag(...o),["stop"]))},[p("div",{class:"handle",onMousedown:e[0]||(e[0]=Oe((...o)=>s.startDrag&&s.startDrag(...o),["stop"])),onMouseup:e[1]||(e[1]=Oe((...o)=>s.stopDrag&&s.stopDrag(...o),["stop"]))},"Drag Me",32),r.isVideoActive&&r.imageDataUrl!=null?(M(),L("img",{key:0,src:r.imageDataUrl,alt:"Webcam Frame",width:"300",height:"300"},null,8,l0t)):X("",!0),r.isVideoActive&&r.imageDataUrl==null?(M(),L("p",{key:1,src:r.imageDataUrl,alt:"Webcam Frame",width:"300",height:"300"},"Loading. Please wait...",8,c0t)):X("",!0),p("div",d0t,[r.isVideoActive?X("",!0):(M(),L("button",{key:0,class:"bg-green-500 hover:bg-green-700 text-white font-bold py-2 px-4 rounded",onClick:e[2]||(e[2]=(...o)=>s.startVideoStream&&s.startVideoStream(...o))},_0t)),r.isVideoActive?(M(),L("button",{key:1,class:"bg-red-500 hover:bg-red-700 text-white font-bold py-2 px-4 rounded",onClick:e[3]||(e[3]=(...o)=>s.stopVideoStream&&s.stopVideoStream(...o))},h0t)):X("",!0),r.isVideoActive?(M(),L("span",f0t,"FPS: "+me(r.frameRate),1)):X("",!0)])],36)}const g0t=ft(a0t,[["render",m0t]]);const E0t={data(){return{isAudioActive:!1,imageDataUrl:null,isDragging:!1,position:{bottom:0,right:0},dragStart:{x:0,y:0},zIndex:0,frameRate:0,frameCount:0,lastFrameTime:Date.now()}},methods:{startAudioStream(){this.isAudioActive=!0,He.emit("start_audio_stream"),Ue(()=>{Ge.replace()})},stopAudioStream(){this.isAudioActive=!1,this.imageDataUrl=null,He.emit("stop_audio_stream"),Ue(()=>{Ge.replace()})},startDrag(n){this.isDragging=!0,this.zIndex=5001,this.dragStart.x=n.clientX,this.dragStart.y=n.clientY,document.addEventListener("mousemove",this.drag),document.addEventListener("mouseup",this.stopDrag)},drag(n){if(this.isDragging){const e=n.clientX-this.dragStart.x,t=n.clientY-this.dragStart.y;this.position.bottom-=t,this.position.right-=e,this.dragStart.x=n.clientX,this.dragStart.y=n.clientY}},stopDrag(){this.isDragging=!1,this.zIndex=0,document.removeEventListener("mousemove",this.drag),document.removeEventListener("mouseup",this.stopDrag)}},mounted(){Ge.replace(),He.on("update_spectrogram",n=>{if(this.isAudioActive){this.imageDataUrl="data:image/jpeg;base64,"+n,this.frameCount++;const e=Date.now();e-this.lastFrameTime>=1e3&&(this.frameRate=this.frameCount,this.frameCount=0,this.lastFrameTime=e)}})}},b0t=["src"],S0t={class:"controls"},y0t=p("i",{"data-feather":"mic"},null,-1),v0t=[y0t],T0t=p("i",{"data-feather":"mic"},null,-1),x0t=[T0t],C0t={key:2};function R0t(n,e,t,i,r,s){return M(),L("div",{class:"floating-frame bg-white",style:un({bottom:r.position.bottom+"px",right:r.position.right+"px","z-index":r.zIndex}),onMousedown:e[4]||(e[4]=Oe((...o)=>s.startDrag&&s.startDrag(...o),["stop"])),onMouseup:e[5]||(e[5]=Oe((...o)=>s.stopDrag&&s.stopDrag(...o),["stop"]))},[p("div",{class:"handle",onMousedown:e[0]||(e[0]=Oe((...o)=>s.startDrag&&s.startDrag(...o),["stop"])),onMouseup:e[1]||(e[1]=Oe((...o)=>s.stopDrag&&s.stopDrag(...o),["stop"]))},"Drag Me",32),r.isAudioActive&&r.imageDataUrl!=null?(M(),L("img",{key:0,src:r.imageDataUrl,alt:"Spectrogram",width:"300",height:"300"},null,8,b0t)):X("",!0),p("div",S0t,[r.isAudioActive?X("",!0):(M(),L("button",{key:0,class:"bg-green-500 hover:bg-green-700 text-white font-bold py-2 px-4 rounded",onClick:e[2]||(e[2]=(...o)=>s.startAudioStream&&s.startAudioStream(...o))},v0t)),r.isAudioActive?(M(),L("button",{key:1,class:"bg-red-500 hover:bg-red-700 text-white font-bold py-2 px-4 rounded",onClick:e[3]||(e[3]=(...o)=>s.stopAudioStream&&s.stopAudioStream(...o))},x0t)):X("",!0),r.isAudioActive?(M(),L("span",C0t,"FPS: "+me(r.frameRate),1)):X("",!0)])],36)}const A0t=ft(E0t,[["render",R0t]]);const w0t={data(){return{activePersonality:null}},props:{personality:{type:Object,default:()=>({})}},components:{VideoFrame:g0t,AudioFrame:A0t},computed:{isReady:{get(){return this.$store.state.ready}}},watch:{"$store.state.mountedPersArr":"updatePersonality","$store.state.config.active_personality_id":"updatePersonality"},async mounted(){for(;this.isReady===!1;)await new Promise(n=>setTimeout(n,100));console.log("Personality:",this.personality),this.initWebGLScene(),this.updatePersonality(),Ue(()=>{Ge.replace()}),this.$refs.video_frame.position={bottom:0,right:0},this.$refs.audio_frame.position={bottom:0,right:100}},beforeDestroy(){},methods:{initWebGLScene(){this.scene=new zvt,this.camera=new Rn(75,window.innerWidth/window.innerHeight,.1,1e3),this.renderer=new bO,this.renderer.setSize(window.innerWidth,window.innerHeight),this.$refs.webglContainer.appendChild(this.renderer.domElement);const n=new $r,e=new iR({color:65280});this.cube=new An(n,e),this.scene.add(this.cube);const t=new mTt(4210752),i=new AO(16777215,.5);i.position.set(0,1,0),this.scene.add(t),this.scene.add(i),this.camera.position.z=5,this.animate()},updatePersonality(){const{mountedPersArr:n,config:e}=this.$store.state;this.activePersonality=n[e.active_personality_id],this.activePersonality.avatar?this.showBoxWithAvatar(this.activePersonality.avatar):this.showDefaultCube(),this.$emit("update:personality",this.activePersonality)},loadScene(n){new ATt().load(n,t=>{this.scene.remove(this.cube),this.cube=t.scene,this.scene.add(this.cube)})},showBoxWithAvatar(n){this.cube&&this.scene.remove(this.cube);const e=new $r,t=new RO().load(n),i=new Fr({map:t});this.cube=new An(e,i),this.scene.add(this.cube)},showDefaultCube(){this.scene.remove(this.cube);const n=new $r,e=new iR({color:65280});this.cube=new An(n,e),this.scene.add(this.cube)},animate(){requestAnimationFrame(this.animate),this.cube&&(this.cube.rotation.x+=.01,this.cube.rotation.y+=.01),this.renderer.render(this.scene,this.camera)}}},O0t={ref:"webglContainer"},N0t={class:"flex-col y-overflow scrollbar-thin scrollbar-track-bg-light-tone scrollbar-thumb-bg-light-tone-panel hover:scrollbar-thumb-primary dark:scrollbar-track-bg-dark-tone dark:scrollbar-thumb-bg-dark-tone-panel dark:hover:scrollbar-thumb-primary active:scrollbar-thumb-secondary"},M0t={key:0,class:"text-center"},I0t={key:1,class:"text-center"},D0t={class:"floating-frame2"},L0t=["innerHTML"];function k0t(n,e,t,i,r,s){const o=St("VideoFrame"),a=St("AudioFrame");return M(),L(Xe,null,[p("div",O0t,null,512),p("div",N0t,[!r.activePersonality||!r.activePersonality.scene_path?(M(),L("div",M0t," Personality does not have a 3d avatar. ")):X("",!0),!r.activePersonality||!r.activePersonality.avatar||r.activePersonality.avatar===""?(M(),L("div",I0t," Personality does not have an avatar. ")):X("",!0),p("div",D0t,[p("div",{innerHTML:n.htmlContent},null,8,L0t)])]),Le(o,{ref:"video_frame"},null,512),Le(a,{ref:"audio_frame"},null,512)],64)}const P0t=ft(w0t,[["render",k0t]]),U0t=oL({history:x2("/"),routes:[{path:"/playground/",name:"playground",component:GQe},{path:"/extensions/",name:"extensions",component:XQe},{path:"/help/",name:"help",component:gXe},{path:"/settings/",name:"settings",component:Xlt},{path:"/training/",name:"training",component:Ect},{path:"/quantizing/",name:"quantizing",component:Act},{path:"/",name:"discussions",component:Smt},{path:"/",name:"interactive",component:P0t}]});const _u=mI(DU);console.log("Loaded main.js");function pR(n){const e={};for(const t in n)n.hasOwnProperty(t)&&(e[t]=n[t]);return e}const F0t=HI({state(){return{yesNoDialog:null,universalForm:null,toast:null,messageBox:null,api_get_req:null,startSpeechRecognition:null,ready:!1,loading_infos:"",loading_progress:0,version:"unknown",settingsChanged:!1,isConnected:!1,isModelOk:!1,isGenerating:!1,config:null,mountedPers:null,mountedPersArr:[],mountedExtensions:[],bindingsZoo:[],modelsArr:[],selectedModel:null,personalities:[],diskUsage:null,ramUsage:null,vramUsage:null,modelsZoo:[],installedModels:[],currentModel:null,extensionsZoo:[],databases:[]}},mutations:{setIsReady(n,e){n.ready=e},setIsConnected(n,e){n.isConnected=e},setIsModelOk(n,e){n.isModelOk=e},setIsGenerating(n,e){n.isGenerating=e},setConfig(n,e){n.config=e},setPersonalities(n,e){n.personalities=e},setMountedPers(n,e){n.mountedPers=e},setMountedPersArr(n,e){n.mountedPersArr=e},setMountedExtensions(n,e){n.mountedExtensions=e},setbindingsZoo(n,e){n.bindingsZoo=e},setModelsArr(n,e){n.modelsArr=e},setselectedModel(n,e){n.selectedModel=e},setDiskUsage(n,e){n.diskUsage=e},setRamUsage(n,e){n.ramUsage=e},setVramUsage(n,e){n.vramUsage=e},setModelsZoo(n,e){n.modelsZoo=e},setCurrentModel(n,e){n.currentModel=e},setExtensionsZoo(n,e){n.extensionsZoo=e},setDatabases(n,e){n.databases=e}},getters:{getIsConnected(n){return n.isConnected},getIsModelOk(n){return n.isModelOk},getIsGenerating(n){return n.isGenerating},getConfig(n){return n.config},getPersonalities(n){return n.personalities},getMountedPersArr(n){return n.mountedPersArr},getmmountedExtensions(n){return n.mountedExtensions},getMountedPers(n){return n.mountedPers},getbindingsZoo(n){return n.bindingsZoo},getModelsArr(n){return n.modelsArr},getDiskUsage(n){return n.diskUsage},getRamUsage(n){return n.ramUsage},getVramUsage(n){return n.vramUsage},getDatabasesList(n){return n.databases},getModelsZoo(n){return n.modelsZoo},getCurrentModel(n){return n.currentModel},getExtensionsZoo(n){return n.extensionsZoo}},actions:{async getVersion(){try{let n=await Pe.get("/get_lollms_webui_version",{});n&&(this.state.version=n.data.version)}catch{console.log("Coudln't get version")}},async refreshConfig({commit:n}){console.log("Fetching configuration");try{const e=await Hn("get_config");e.active_personality_id<0&&(e.active_personality_id=0);let t=e.personalities[e.active_personality_id].split("/");e.personality_category=t[0],e.personality_folder=t[1],e.extensions.length>0?e.extension_category=e.extensions[-1]:e.extension_category="ai_sensors",console.log("Recovered config"),console.log(e),console.log("Committing config"),console.log(e),console.log(this.state.config),n("setConfig",e)}catch(e){console.log(e.message,"refreshConfig")}},async refreshDatabase({commit:n}){let e=await Hn("list_databases");console.log("databases:",e),n("setDatabases",e)},async refreshPersonalitiesZoo({commit:n}){let e=[];const t=await Hn("get_all_personalities"),i=Object.keys(t);console.log("Personalities recovered:"+this.state.config.personalities);for(let r=0;r{let c=!1;for(const u of this.state.config.personalities)if(u.includes(s+"/"+l.folder))if(c=!0,u.includes(":")){const _=u.split(":");l.language=_[1]}else l.language=null;let d={};return d=l,d.category=s,d.full_path=s+"/"+l.folder,d.isMounted=c,d});e.length==0?e=a:e=e.concat(a)}e.sort((r,s)=>r.name.localeCompare(s.name)),n("setPersonalities",e),console.log("Done loading personalities")},refreshMountedPersonalities({commit:n}){this.state.config.active_personality_id<0&&(this.state.config.active_personality_id=0);let e=[];const t=[];for(let i=0;ia.full_path==r||a.full_path==s[0]);if(o>=0){let a=pR(this.state.personalities[o]);s.length>1&&(a.language=s[1]),a?e.push(a):e.push(this.state.personalities[this.state.personalities.findIndex(l=>l.full_path=="generic/lollms")])}else t.push(i),console.log("Couldn't load personality : ",r)}for(let i=t.length-1;i>=0;i--)console.log("Removing personality : ",this.state.config.personalities[t[i]]),this.state.config.personalities.splice(t[i],1),this.state.config.active_personality_id>t[i]&&(this.state.config.active_personality_id-=1);n("setMountedPersArr",e),this.state.mountedPers=this.state.personalities[this.state.personalities.findIndex(i=>i.full_path==this.state.config.personalities[this.state.config.active_personality_id]||i.full_path+":"+i.language==this.state.config.personalities[this.state.config.active_personality_id])]},async refreshBindings({commit:n}){let e=await Hn("list_bindings");n("setbindingsZoo",e)},async refreshModelsZoo({commit:n}){console.log("Fetching models");const e=await Pe.get("/get_available_models");n("setModelsZoo",e.data.filter(t=>t.variants&&t.variants.length>0))},async refreshModelStatus({commit:n}){let e=await Hn("get_model_status");n("setIsModelOk",e.status)},async refreshModels({commit:n}){console.log("Fetching models");let e=await Hn("list_models");console.log(`Found ${e}`);let t=await Hn("get_active_model");console.log("Selected model ",t),t!=null&&n("setselectedModel",t.model),n("setModelsArr",e),console.log("setModelsArr",e),this.state.modelsZoo.map(r=>{r.isInstalled=e.includes(r.name)}),this.state.installedModels=this.state.modelsZoo.filter(r=>r.isInstalled);const i=this.state.modelsZoo.findIndex(r=>r.name==this.state.config.model_name);i!=-1&&n("setCurrentModel",this.state.modelsZoo[i])},async refreshExtensionsZoo({commit:n}){let e=[],t=await Hn("list_extensions");const i=Object.keys(t);console.log("Extensions recovered:"+t);for(let r=0;r{let c=!1;for(const u of this.state.config.extensions)u.includes(s+"/"+l.folder)&&(c=!0);let d={};return d=l,d.category=s,d.full_path=s+"/"+l.folder,d.isMounted=c,d});e.length==0?e=a:e=e.concat(a)}e.sort((r,s)=>r.name.localeCompare(s.name)),console.log("Done loading extensions"),n("setExtensionsZoo",e)},refreshmountedExtensions({commit:n}){console.log("Mounting extensions");let e=[];const t=[];for(let i=0;io.full_path==r);if(s>=0){let o=pR(this.state.config.extensions[s]);o&&e.push(o)}else t.push(i),console.log("Couldn't load extension : ",r)}for(let i=t.length-1;i>=0;i--)console.log("Removing extensions : ",this.state.config.extensions[t[i]]),this.state.config.extensions.splice(t[i],1);n("setMountedExtensions",e)},async refreshDiskUsage({commit:n}){this.state.diskUsage=await Hn("disk_usage")},async refreshRamUsage({commit:n}){this.state.ramUsage=await Hn("ram_usage")},async refreshVramUsage({commit:n}){const e=await Hn("vram_usage"),t=[];if(e.nb_gpus>0){for(let r=0;r LoLLMS WebUI - Welcome - + diff --git a/web/src/assets/bash_block.png b/web/src/assets/bash_block.png new file mode 100644 index 00000000..b1f63949 Binary files /dev/null and b/web/src/assets/bash_block.png differ diff --git a/web/src/assets/extension.png b/web/src/assets/extension.png new file mode 100644 index 00000000..dc364003 Binary files /dev/null and b/web/src/assets/extension.png differ diff --git a/web/src/assets/python_block.png b/web/src/assets/python_block.png new file mode 100644 index 00000000..20f36f4d Binary files /dev/null and b/web/src/assets/python_block.png differ diff --git a/web/src/components/Message.vue b/web/src/components/Message.vue index efd97ba9..1765b55c 100644 --- a/web/src/components/Message.vue +++ b/web/src/components/Message.vue @@ -72,6 +72,15 @@ title="Edit message" @click.stop="editMsgMode = true"> +
+ +
+
+ +
+
@@ -133,7 +142,7 @@
-
+
- +
@@ -177,7 +186,7 @@
-