diff --git a/.github/ISSUE_TEMPLATE/bug_report.md b/.github/ISSUE_TEMPLATE/bug_report.md index 4f030a0..0c83a41 100644 --- a/.github/ISSUE_TEMPLATE/bug_report.md +++ b/.github/ISSUE_TEMPLATE/bug_report.md @@ -12,9 +12,9 @@ assignees: '' Note: Any posts that do not follow this template will be closed immediately. I won't be able to address your issue if the information below is not provided. Please mark "x" inside the square brackets to indicate that you have read the following information. -- [ ] I confirm that I have searched for a solution to this issue in the [FAQ](https://physton.github.io/sd-webui-prompt-all-in-one-assets/#/FAQ) and couldn't find a solution. +- [ ] I confirm that I have searched for a solution to this issue in the [FAQ](https://physton.github.io/sd-webui-prompt-all-in-one-assets/FAQ.html) and couldn't find a solution. - [ ] I confirm that I have searched for this issue in the [Issues](https://github.com/Physton/sd-webui-prompt-all-in-one/issues) list (including closed ones) and couldn't find a solution. -- [ ] I confirm that I have read the [Wiki](https://physton.github.io/sd-webui-prompt-all-in-one-assets/#/Installation) and couldn't find a solution. +- [ ] I confirm that I have read the [Wiki](https://physton.github.io/sd-webui-prompt-all-in-one-assets/) and couldn't find a solution. **Describe the Issue** Please describe the problem you encountered here. diff --git a/.github/ISSUE_TEMPLATE/反馈问题.md b/.github/ISSUE_TEMPLATE/反馈问题.md index 5fc73ed..09d3b72 100644 --- a/.github/ISSUE_TEMPLATE/反馈问题.md +++ b/.github/ISSUE_TEMPLATE/反馈问题.md @@ -12,9 +12,9 @@ assignees: '' 注意:不遵循此模板的任何帖子都会被立即关闭,如果没有提供下方的信息,我无法定位你的问题。 请在下方中括号内输入 x 来表示你已经知晓相关内容。 -- [ ] 我确认已经在 [常见问题](https://physton.github.io/sd-webui-prompt-all-in-one-assets/#/zh-cn/FAQ) 中搜索了此次反馈的问题,没有找到解决方法。 +- [ ] 我确认已经在 [常见问题](https://physton.github.io/sd-webui-prompt-all-in-one-assets/zh-CN/FAQ.html) 中搜索了此次反馈的问题,没有找到解决方法。 - [ ] 我确认已经在 [Issues](https://github.com/Physton/sd-webui-prompt-all-in-one/issues) 列表(包括已经 Close 的)中搜索了此次反馈的问题,没有找到解决方法。 -- [ ] 我确认阅读了 [文档](https://physton.github.io/sd-webui-prompt-all-in-one-assets/#/zh-cn/Installation),没有找到解决方法。 +- [ ] 我确认阅读了 [文档](https://physton.github.io/sd-webui-prompt-all-in-one-assets/zh-CN/),没有找到解决方法。 **描述问题** 请在此描述你遇到了什么问题。 diff --git a/README.MD b/README.MD index 337e8c4..a5c7270 100644 --- a/README.MD +++ b/README.MD @@ -15,13 +15,13 @@ sd-webui-prompt-all-in-one is an extension based on [stable-diffusion-webui](htt
-### Installation tutorial, detailed feature introduction, usage instructions, frequently asked questions, and more can be found in the [Wiki](https://physton.github.io/sd-webui-prompt-all-in-one-assets/#/Installation). +### Installation tutorial, detailed feature introduction, usage instructions, frequently asked questions, and more can be found in the [Wiki](https://physton.github.io/sd-webui-prompt-all-in-one-assets/). -### Перевод на русский: Инструкции по установке, подробное описание функций, методы использования, часто задаваемые вопросы и многое другое можно найти в [документации](https://physton.github.io/sd-webui-prompt-all-in-one-assets/#/ru/Installation). +### Перевод на русский: Инструкции по установке, подробное описание функций, методы использования, часто задаваемые вопросы и многое другое можно найти в [документации](https://physton.github.io/sd-webui-prompt-all-in-one-assets/ru/). -### 安装教程、功能详解、使用方法、常见问题等等,详见:[文档](https://physton.gitee.io/sd-webui-prompt-all-in-one-assets/#/zh-cn/Installation)。 +### 安装教程、功能详解、使用方法、常见问题等等,详见:[文档](https://physton.gitee.io/sd-webui-prompt-all-in-one-assets/zh-CN/)。 -### 安裝教程、功能詳解、使用方法、常見問題等等,詳見:[文檔](https://physton.github.io/sd-webui-prompt-all-in-one-assets/#/zh-tw/Installation)。 +### 安裝教程、功能詳解、使用方法、常見問題等等,詳見:[文檔](https://physton.github.io/sd-webui-prompt-all-in-one-assets/zh-TW/)。
@@ -32,16 +32,16 @@ sd-webui-prompt-all-in-one is an extension based on [stable-diffusion-webui](htt > > 如果你觉得这个扩展有帮助,请在Github上给我一颗星! > 你也可以请我喝杯咖啡: [donate](#donate) -> +> > QQ群:820700336 ---- > 中国用户镜像地址: -> +> > 仓库地址:[https://gitee.com/physton/sd-webui-prompt-all-in-one.git](https://gitee.com/physton/sd-webui-prompt-all-in-one.git) -> -> 文档地址:[https://physton.gitee.io/sd-webui-prompt-all-in-one-assets/](https://physton.gitee.io/sd-webui-prompt-all-in-one-assets/#/zh-cn/Installation) +> +> 文档地址:[https://physton.gitee.io/sd-webui-prompt-all-in-one-assets/](https://physton.gitee.io/sd-webui-prompt-all-in-one-assets/zh-CN/) ---- @@ -49,12 +49,12 @@ sd-webui-prompt-all-in-one is an extension based on [stable-diffusion-webui](htt | English | Русский | 简体中文 | 繁體中文 | | :-----: | :-----: | :-----: | :-----: | -| [Wiki](https://physton.github.io/sd-webui-prompt-all-in-one-assets/#/Installation) | [документация](https://physton.github.io/sd-webui-prompt-all-in-one-assets/#/ru/Installation) | [文档](https://physton.gitee.io/sd-webui-prompt-all-in-one-assets/#/zh-cn/Installation) | [文檔](https://physton.github.io/sd-webui-prompt-all-in-one-assets/#/zh-tw/Installation) -| [Installation](https://physton.github.io/sd-webui-prompt-all-in-one-assets/#/Installation) | [Установка](https://physton.github.io/sd-webui-prompt-all-in-one-assets/#/ru/Installation) | [安装](https://physton.gitee.io/sd-webui-prompt-all-in-one-assets/#/zh-cn/Installation) | [安裝](https://physton.github.io/sd-webui-prompt-all-in-one-assets/#/zh-tw/Installation) -| [Extension update description](https://physton.github.io/sd-webui-prompt-all-in-one-assets/#/ExtensionUpdateDescription) | [Обновление расширения](https://physton.github.io/sd-webui-prompt-all-in-one-assets/#/ru/ExtensionUpdateDescription) | [扩展更新说明](https://physton.gitee.io/sd-webui-prompt-all-in-one-assets/#/zh-cn/ExtensionUpdateDescription) | [擴展更新說明](https://physton.github.io/sd-webui-prompt-all-in-one-assets/#/zh-tw/ExtensionUpdateDescription) | -| [Contributing](https://physton.github.io/sd-webui-prompt-all-in-one-assets/#/Contributing) | [Помощь в разработке](https://physton.github.io/sd-webui-prompt-all-in-one-assets/#/ru/Contributing) | [帮助开发](https://physton.gitee.io/sd-webui-prompt-all-in-one-assets/#/zh-cn/Contributing) | [幫助開發](https://physton.github.io/sd-webui-prompt-all-in-one-assets/#/zh-tw/Contributing) | -| [Custom Theme](https://physton.github.io/sd-webui-prompt-all-in-one-assets/#/Contributing?id=custom-theme) | [Настройка темы](https://physton.github.io/sd-webui-prompt-all-in-one-assets/#/ru/Contributing?id=Настройка-темы) | [自定义主题](https://physton.gitee.io/sd-webui-prompt-all-in-one-assets/#/zh-cn/Contributing?id=自定义主题) | [自定義主題](https://physton.github.io/sd-webui-prompt-all-in-one-assets/#/zh-tw/Contributing?id=自定義主題) | -| [FAQ](https://physton.github.io/sd-webui-prompt-all-in-one-assets/#/FAQ) | [Часто задаваемые вопросы](https://physton.github.io/sd-webui-prompt-all-in-one-assets/#/ru/FAQ) | [常见问题](https://physton.gitee.io/sd-webui-prompt-all-in-one-assets/#/zh-cn/FAQ) | [常見問題](https://physton.github.io/sd-webui-prompt-all-in-one-assets/#/zh-tw/FAQ) | +| [Wiki](https://physton.github.io/sd-webui-prompt-all-in-one-assets/) | [документация](https://physton.github.io/sd-webui-prompt-all-in-one-assets/ru/) | [文档](https://physton.gitee.io/sd-webui-prompt-all-in-one-assets/zh-CN/) | [文檔](https://physton.github.io/sd-webui-prompt-all-in-one-assets/zh-TW/) +| [Installation](https://physton.github.io/sd-webui-prompt-all-in-one-assets/Installation.html) | [Установка](https://physton.github.io/sd-webui-prompt-all-in-one-assets/ru/Installation.html) | [安装](https://physton.gitee.io/sd-webui-prompt-all-in-one-assets/zh-CN/Installation.html) | [安裝](https://physton.github.io/sd-webui-prompt-all-in-one-assets/zh-TW/Installation.html) +| [Extension update description](https://physton.github.io/sd-webui-prompt-all-in-one-assets/ExtensionUpdateDescription.html) | [Обновление расширения](https://physton.github.io/sd-webui-prompt-all-in-one-assets/ru/ExtensionUpdateDescription.html) | [扩展更新说明](https://physton.gitee.io/sd-webui-prompt-all-in-one-assets/zh-CN/ExtensionUpdateDescription.html) | [擴展更新說明](https://physton.github.io/sd-webui-prompt-all-in-one-assets/zh-TW/ExtensionUpdateDescription.html) | +| [Contributing](https://physton.github.io/sd-webui-prompt-all-in-one-assets/Contributing.html) | [Помощь в разработке](https://physton.github.io/sd-webui-prompt-all-in-one-assets/ru/Contributing.html) | [帮助开发](https://physton.gitee.io/sd-webui-prompt-all-in-one-assets/zh-CN/Contributing.html) | [幫助開發](https://physton.github.io/sd-webui-prompt-all-in-one-assets/zh-TW/Contributing.html) | +| [Custom Theme](https://physton.github.io/sd-webui-prompt-all-in-one-assets/Contributing.html#custom-theme) | [Настройка темы](https://physton.github.io/sd-webui-prompt-all-in-one-assets/ru/Contributing.html#настроика-темы) | [自定义主题](https://physton.gitee.io/sd-webui-prompt-all-in-one-assets/zh-CN/Contributing.html#自定义主题) | [自定義主題](https://physton.github.io/sd-webui-prompt-all-in-one-assets/zh-TW/Contributing.html#自定義主題) | +| [FAQ](https://physton.github.io/sd-webui-prompt-all-in-one-assets/FAQ.html) | [Часто задаваемые вопросы](https://physton.github.io/sd-webui-prompt-all-in-one-assets/ru/FAQ.html) | [常见问题](https://physton.gitee.io/sd-webui-prompt-all-in-one-assets/zh-CN/FAQ.html) | [常見問題](https://physton.github.io/sd-webui-prompt-all-in-one-assets/zh-TW/FAQ.html) | | [Donate](#donate) | [Пожертвование](#donate) | [捐赠](#donate) | [捐贈](#donate) | ## Demo / *演示* @@ -134,7 +134,7 @@ Translation supports almost all national languages, but the UI interface of most ## Donate -[Donation list / *捐赠列表*](https://physton.github.io/sd-webui-prompt-all-in-one-assets/#/Donate?id=donation-list-捐赠列表) +[Donation list / *捐赠列表*](https://physton.github.io/sd-webui-prompt-all-in-one-assets/Donate.html) ### Buy me a coffee / *请我喝杯咖啡* diff --git a/javascript/main.entry.js b/javascript/main.entry.js index aefd4c6..0b69c8d 100644 --- a/javascript/main.entry.js +++ b/javascript/main.entry.js @@ -42,7 +42,7 @@ complete!`,setTimeout(this.close,2e3)),this.scrollToBottom()},n=()=>{let i=e.shi `,r.state?(this.scrollToBottom(),n()):t(!1)}).catch(r=>{console.log(r),this.result+=`${i.name} install failed ${r.message} `,t(!1)})};n()},scrollToBottom(){this.$nextTick(()=>{this.$refs.result.scrollTop=this.$refs.result.scrollHeight})},onTodayNotShowChange(){this.todayNotShow=!this.todayNotShow,this.gradioAPI.setData("packagesStateTodayNotShow",new Date().toLocaleDateString())},open(){this.gradioAPI.getData("packagesStateTodayNotShow").then(e=>{e&&e===new Date().toLocaleDateString()?this.close():(this.result="",this.loading=!1,this.showResult=!1,this.isOpen=!0)}).catch(e=>{})},close(){this.isOpen=!1}}},Ub={class:"today-now-show"},Wb=["value"],Vb=_("div",{class:"state-body-name"},"sd-webui-prompt-all-in-one",-1),Kb=["innerHTML"],qb={class:"package-list"},zb={class:"package-name"},Xb={class:"package-command"},Yb={key:0,class:"install-result"};function Gb(e,t,n,i,r,o){const l=Lt("icon-svg");return r.isOpen?(R(),B("div",{key:0,class:"physton-packages-state",onClick:t[6]||(t[6]=(...c)=>o.close&&o.close(...c))},[_("div",{class:"state-main",onClick:t[5]||(t[5]=tt(()=>{},["stop"]))},[_("div",{class:"state-close",onClick:t[0]||(t[0]=(...c)=>o.close&&o.close(...c))},[ve(l,{name:"close"})]),_("div",{class:"state-body",onClick:t[4]||(t[4]=tt(()=>{},["stop"]))},[_("div",Ub,[_("label",null,[_("input",{type:"checkbox",value:r.todayNotShow,onChange:t[1]||(t[1]=(...c)=>o.onTodayNotShowChange&&o.onTodayNotShowChange(...c))},null,40,Wb),$t(" "+ce(e.getLang("today_not_show")),1)])]),Vb,_("div",{class:"state-body-language",onClick:t[2]||(t[2]=c=>e.$emit("click:selectLanguage",c))},[ve(l,{name:"i18n"}),_("div",null,"Language: "+ce(e.langName),1)]),_("div",{class:"state-body-desc",innerHTML:e.getLang("packages_desc")},null,8,Kb),_("div",qb,[(R(!0),B(Re,null,mt(n.packagesState,c=>(R(),B("div",{key:c.name,class:"package-item"},[_("div",zb,ce(c.name),1),_("div",{class:At(["package-state",c.state?"installed":"not_install"])},ce(e.getLang(c.state?"installed":"not_install")),3),_("div",Xb,ce(o.getCommand(c)),1)]))),128))]),_("div",{class:"btn-packages-install hover-scale-120",onClick:t[3]||(t[3]=(...c)=>o.onInstallClick&&o.onInstallClick(...c))},[r.loading?(R(),vt(l,{key:0,name:"loading"})):(R(),B(Re,{key:1},[$t(ce(e.getLang("install")),1)],64))]),r.showResult?(R(),B("div",Yb,[$t(ce(e.getLang("packages_installing"))+" ",1),r.result?(R(),B("div",{key:0,class:"result-content",ref:"result"},ce(r.result),513)):ze("",!0)])):ze("",!0)])])])):ze("",!0)}const Jb=sn($b,[["render",Gb]]),Zb={name:"ChatgptPrompt",components:{IconSvg:Fn},mixins:[Yn],props:{},data(){return{isOpen:!1,api:{},configs:[],chatPreset:"",hidePanels:{api:!0},imageDesc:"",promptResult:"",saveConfigIng:!1,genIng:!1}},emits:["use"],computed:{},mounted(){},methods:{open(){this.isOpen=!0,this.saveConfigIng=!1,this.genIng=!1,this.gradioAPI.getDatas(["chatgpt_prompts_preset","chatgpt_key","translate_api.openai"]).then(e=>{console.log(e),e.chatgpt_prompts_preset!==null?this.chatPreset=e.chatgpt_prompts_preset:this.chatPreset=this.getLang("chatgpt_prompts_preset"),this.configs=[];let t={},n=oe.getTranslateApiItem(this.translateApis,"openai");if(n=JSON.parse(JSON.stringify(n)),e.chatgpt_key&&typeof e.chatgpt_key=="object")for(const i of n.config)t[i.key]=e.chatgpt_key[i.key]||i.default||"";else if(e["translate_api.openai"]&&e["translate_api.openai"].api_key)for(const i of n.config)t[i.key]=e["translate_api.openai"][i.key]||i.default||"";else for(const i of n.config)t[i.key]=i.default||"";t.api_key||(this.hidePanels.api=!1);for(const i of n.config)i.value=t[i.key],this.configs.push(i)})},close(){this.isOpen=!1},onUnfoldClick(e){this.hidePanels[e]=!this.hidePanels[e]},onSaveConfigClick(){if(this.saveConfigIng)return;this.saveConfigIng=!0;let e={};this.configs.forEach(t=>{e[t.key]=t.value}),this.gradioAPI.setData("chatgpt_key",e).then(t=>{this.$toastr.success(this.getLang("success")),this.saveConfigIng=!1}).catch(t=>{this.$toastr.error(t.message||t),this.saveConfigIng=!1})},onPresetChange(e){this.chatPreset=e.target.value,this._saveChatPreset()},onRestoreClick(){this.chatPreset=this.getLang("chatgpt_prompts_preset"),this._saveChatPreset()},_saveChatPreset(){this.gradioAPI.setData("chatgpt_prompts_preset",this.chatPreset)},onGenClick(){if(this.genIng)return;if(!this.imageDesc)return this.$refs.imageDesc.focus();if(this.imageDesc=this.imageDesc.trim(),!this.imageDesc)return this.$refs.imageDesc.focus();this.genIng=!0;let e=[{role:"user",content:this.chatPreset},{role:"user",content:this.imageDesc}],t={};this.configs.forEach(n=>{t[n.key]=n.value}),this.gradioAPI.genOpenAI(e,t).then(n=>{n.success?this.promptResult=n.result:this.$toastr.error(n.message||"error"),this.genIng=!1}).catch(n=>{this.$toastr.error(n.message||n),this.genIng=!1})},onUseClick(){this.$emit("use",this.promptResult),this.close()}}},Qb={class:"panel-header"},eC={class:"panel-title"},tC={class:"panel-content"},nC={class:"body-line"},iC={class:"line-title"},rC={class:"line-content"},sC=["onUpdate:modelValue"],oC=["onUpdate:modelValue"],aC=["value"],lC={class:"body-line"},uC=_("div",{class:"line-title"},null,-1),cC={class:"line-content text-right"},fC={class:"panel-header"},dC={class:"panel-title"},pC={class:"panel-content"},hC={class:"body-line"},gC={class:"line-title"},mC={class:"line-subtitle"},vC={class:"line-content"},yC=["value"],bC={class:"body-line"},CC=_("div",{class:"line-title"},null,-1),wC={class:"line-content text-right"},TC={class:"body-line"},_C={class:"line-title"},EC={class:"line-subtitle"},SC={class:"line-content"},xC=["placeholder"],kC={class:"body-line"},AC=_("div",{class:"line-title"},null,-1),LC={class:"line-content text-right"},OC={class:"panel-header"},DC={class:"panel-title"},PC={class:"panel-content"},IC={class:"body-line"},NC={class:"line-title"},RC={class:"line-content"},MC={key:0,class:"body-line"},FC=_("div",{class:"line-title"},null,-1),HC={class:"line-content text-right"};function BC(e,t,n,i,r,o){const l=Lt("icon-svg");return r.isOpen?(R(),B("div",{key:0,class:"physton-chatgpt-prompt",onClick:t[13]||(t[13]=(...c)=>o.close&&o.close(...c))},[_("div",{class:"chatgpt-main",onClick:t[12]||(t[12]=tt(()=>{},["stop"]))},[_("div",{class:"chatgpt-close",onClick:t[0]||(t[0]=(...c)=>o.close&&o.close(...c))},[ve(l,{name:"close"})]),_("div",{class:"chatgpt-body",onClick:t[11]||(t[11]=tt(()=>{},["stop"]))},[_("div",{class:At(["body-panel",r.hidePanels.api?"fold":""])},[_("div",Qb,[_("div",{class:"panel-unfold",onClick:t[1]||(t[1]=c=>o.onUnfoldClick("api"))},[ve(l,{class:"hover-scale-120",name:"unfold"})]),_("div",eC,ce(e.getLang("api_config")),1)]),_("div",tC,[(R(!0),B(Re,null,mt(r.configs,c=>(R(),B("div",nC,[_("div",iC,ce(c.title),1),_("div",rC,[c.type=="input"?fe((R(),B("input",{key:0,type:"text","onUpdate:modelValue":d=>c.value=d},null,8,sC)),[[Hi,c.value]]):ze("",!0),c.type=="select"?fe((R(),B("select",{key:1,"onUpdate:modelValue":d=>c.value=d},[(R(!0),B(Re,null,mt(c.options,d=>(R(),B("option",{value:d},ce(d),9,aC))),256))],8,oC)),[[Xs,c.value]]):ze("",!0)])]))),256)),_("div",lC,[uC,_("div",cC,[_("div",{class:"common-btn hover-scale-120",onClick:t[2]||(t[2]=(...c)=>o.onSaveConfigClick&&o.onSaveConfigClick(...c))},[r.saveConfigIng?(R(),vt(l,{key:0,name:"loading"})):(R(),B(Re,{key:1},[$t(ce(e.getLang("save")),1)],64))])])])])],2),_("div",{class:At(["body-panel",r.hidePanels.send?"fold":""])},[_("div",fC,[_("div",{class:"panel-unfold",onClick:t[3]||(t[3]=c=>o.onUnfoldClick("send"))},[ve(l,{class:"hover-scale-120",name:"unfold"})]),_("div",dC,ce(e.getLang("image_desc")),1)]),_("div",pC,[_("div",hC,[_("div",gC,[$t(ce(e.getLang("preset"))+" ",1),_("div",mC,ce(e.getLang("ai_one")),1)]),_("div",vC,[_("textarea",{value:r.chatPreset,onChange:t[4]||(t[4]=(...c)=>o.onPresetChange&&o.onPresetChange(...c)),style:{height:"100px"}},null,40,yC)])]),_("div",bC,[CC,_("div",wC,[_("a",{href:"javascript:",onClick:t[5]||(t[5]=(...c)=>o.onRestoreClick&&o.onRestoreClick(...c))},ce(e.getLang("restore_to_default")),1)])]),_("div",TC,[_("div",_C,[$t(ce(e.getLang("image_desc"))+" ",1),_("div",EC,ce(e.getLang("ai_two")),1)]),_("div",SC,[fe(_("textarea",{style:{height:"100px"},ref:"imageDesc","onUpdate:modelValue":t[6]||(t[6]=c=>r.imageDesc=c),placeholder:e.getLang("input_image_desc")},null,8,xC),[[Hi,r.imageDesc]])])]),_("div",kC,[AC,_("div",LC,[_("div",{class:"common-btn hover-scale-120",onClick:t[7]||(t[7]=(...c)=>o.onGenClick&&o.onGenClick(...c))},[r.genIng?(R(),vt(l,{key:0,name:"loading"})):(R(),B(Re,{key:1},[$t(ce(e.getLang("generate")),1)],64))])])])])],2),_("div",{class:At(["body-panel",r.hidePanels.result?"fold":""])},[_("div",OC,[_("div",{class:"panel-unfold",onClick:t[8]||(t[8]=c=>o.onUnfoldClick("result"))},[ve(l,{class:"hover-scale-120",name:"unfold"})]),_("div",DC,ce(e.getLang("generate_result")),1)]),_("div",PC,[_("div",IC,[_("div",NC,ce(e.getLang("generate_result")),1),_("div",RC,[fe(_("textarea",{style:{height:"100px"},"onUpdate:modelValue":t[9]||(t[9]=c=>r.promptResult=c)},null,512),[[Hi,r.promptResult]])])]),r.promptResult?(R(),B("div",MC,[FC,_("div",HC,[_("div",{class:"common-btn hover-scale-120",onClick:t[10]||(t[10]=(...c)=>o.onUseClick&&o.onUseClick(...c))},ce(e.getLang("use")),1)])])):ze("",!0)])],2)])])])):ze("",!0)}const jC=sn(Zb,[["render",BC]]),$C={name:"About",components:{IconSvg:Fn},mixins:[Yn],props:{version:{type:String,default:""},latestVersion:{type:String,default:""},isLatestVersion:{type:Boolean,default:!0}},data(){return{isOpen:!1,loading:!1,versions:[],icons:[{title:"GitHub stars",url:"https://github.com/Physton/sd-webui-prompt-all-in-one/stargazers",image:"https://img.shields.io/github/stars/Physton/sd-webui-prompt-all-in-one?style=plastic"},{title:"GitHub forks",url:"https://github.com/Physton/sd-webui-prompt-all-in-one/network/members",image:"https://img.shields.io/github/forks/Physton/sd-webui-prompt-all-in-one?style=plastic"},{title:"GitHub issues",url:"https://github.com/Physton/sd-webui-prompt-all-in-one/issues",image:"https://img.shields.io/github/issues/Physton/sd-webui-prompt-all-in-one?style=plastic"},{title:"GitHub issues closed",url:"https://github.com/Physton/sd-webui-prompt-all-in-one/issues?q=is%3Aissue+is%3Aclosed",image:"https://img.shields.io/github/issues-closed/Physton/sd-webui-prompt-all-in-one?style=plastic"},{title:"GitHub license",url:"https://github.com/Physton/sd-webui-prompt-all-in-one/blob/master/LICENSE.md",image:"https://img.shields.io/github/license/Physton/sd-webui-prompt-all-in-one?style=plastic"},{title:"GitHub commits",url:"https://github.com/Physton/sd-webui-prompt-all-in-one/commits/main",image:"https://img.shields.io/github/last-commit/Physton/sd-webui-prompt-all-in-one?style=plastic"}]}},emits:["use"],computed:{},mounted(){},methods:{open(){this.isOpen=!0,this.versions=[],this.loading=!0,this.gradioAPI.getRemoteVersions().then(e=>{this.loading=!1;let t=[];e.forEach((n,i)=>{n.is_update_readme||(n.date=oe.formatTime(n.date),t.push(n))}),this.versions=t}).catch(e=>{this.loading=!1})},close(){this.isOpen=!1},commitUrl(e){return"https://github.com/Physton/sd-webui-prompt-all-in-one/commit/"+e},formatVersion(e){return e?e.slice(0,7):this.getLang("unknown_version")},message(e){return e=oe.escapeHtml(e),e=e.replace(/Former-commit-id: [a-z0-9]{40}/g,""),e=e.trim(),e=e.replace(` -`,"
"),e=e.replace(/#(\d+)/g,'#$1'),e}}},UC=_("p",{class:"body-title"},[_("a",{href:"https://github.com/Physton/sd-webui-prompt-all-in-one",target:"_blank"},"sd-webui-prompt-all-in-one")],-1),WC=["href"],VC=["src","alt"],KC=["href"],qC={key:0,class:"has-new-version"},zC=["href"],XC=_("a",{href:"https://physton.github.io/sd-webui-prompt-all-in-one-assets/#/Installation",target:"_blank"},"Wiki",-1),YC={class:"version-list"},GC={class:"item-header"},JC={class:"version-sha"},ZC=["href"],QC={class:"version-date"},ew=["innerHTML"];function tw(e,t,n,i,r,o){const l=Lt("icon-svg");return r.isOpen?(R(),B("div",{key:0,class:"physton-about-prompt",onClick:t[3]||(t[3]=(...c)=>o.close&&o.close(...c))},[_("div",{class:"about-main",onClick:t[2]||(t[2]=tt(()=>{},["stop"]))},[_("div",{class:"about-close",onClick:t[0]||(t[0]=(...c)=>o.close&&o.close(...c))},[ve(l,{name:"close"})]),_("div",{class:"about-body",onClick:t[1]||(t[1]=tt(()=>{},["stop"]))},[UC,_("p",null,[(R(!0),B(Re,null,mt(r.icons,c=>(R(),B("a",{key:c.title,href:c.url,target:"_blank"},[_("img",{src:c.image,alt:c.title},null,8,VC)],8,WC))),128))]),_("p",null,[_("span",null,[$t(ce(e.getLang("version"))+": ",1),_("a",{href:o.commitUrl(n.version),target:"_blank"},ce(o.formatVersion(n.version)),9,KC)]),!n.isLatestVersion&&n.latestVersion?(R(),B("span",qC,[$t("    ("+ce(e.getLang("has_new_version"))+": ",1),_("a",{href:o.commitUrl(n.latestVersion),target:"_blank"},ce(o.formatVersion(n.latestVersion)),9,zC),$t(")")])):ze("",!0)]),_("p",null,[$t(ce(e.getLang("wiki_desc"))+" ",1),XC]),_("div",YC,[r.loading?(R(),vt(l,{key:0,name:"loading"})):ze("",!0),(R(!0),B(Re,null,mt(r.versions,c=>(R(),B("div",{class:"version-item",key:c.version},[_("div",GC,[_("div",JC,[_("a",{href:o.commitUrl(c.version),target:"_blank"},ce(o.formatVersion(c.version)),9,ZC)]),_("div",QC,ce(c.date),1)]),_("div",{class:"version-msg",innerHTML:o.message(c.message)},null,8,ew)]))),128))])])])])):ze("",!0)}const nw={name:"App",components:{About:sn($C,[["render",tw]]),ChatgptPrompt:jC,PackagesState:Jb,PromptFormat:jb,ExtensionCss:Sb,IconSvg:Fn,History:mb,Favorite:By,SelectLanguage:uy,TranslateSetting:sy,PhystonPrompt:cv},mixins:[],data(){return{prompts:[{tab:"tab_txt2img",prompt:"txt2img_prompt",counter:"txt2img_token_counter",button:"txt2img_token_button",steps:"txt2img_steps",historyKey:"txt2img",favoriteKey:"txt2img",$prompt:null,$textarea:null,$steps:null,name:"txt2img_prompt",neg:!1,hideDefaultInputKey:"txt2ImgHideDefaultInput",hideDefaultInput:!1,hidePanelKey:"txt2ImgHidePanel",hidePanel:!1,id:"phystonPrompt_txt2img_prompt"},{tab:"tab_txt2img",prompt:"txt2img_neg_prompt",counter:"txt2img_negative_token_counter",button:"txt2img_negative_token_button",steps:"txt2img_steps",historyKey:"txt2img_neg",favoriteKey:"txt2img_neg",$prompt:null,$textarea:null,$steps:null,name:"txt2img_neg_prompt",neg:!0,hideDefaultInputKey:"txt2ImgNegHideDefaultInput",hideDefaultInput:!1,hidePanelKey:"txt2ImgNegHidePanel",hidePanel:!1,id:"phystonPrompt_txt2img_neg_prompt"},{tab:"tab_img2img",prompt:"img2img_prompt",counter:"img2img_token_counter",button:"img2img_token_button",steps:"img2img_steps",historyKey:"img2img",favoriteKey:"img2img",$prompt:null,$textarea:null,$steps:null,name:"img2img_prompt",neg:!1,hideDefaultInputKey:"img2ImgHideDefaultInput",hideDefaultInput:!1,hidePanelKey:"img2ImgHidePanel",hidePanel:!1,id:"phystonPrompt_img2img_prompt"},{tab:"tab_img2img",prompt:"img2img_neg_prompt",counter:"img2img_negative_token_counter",button:"img2img_negative_token_button",steps:"img2img_steps",historyKey:"img2img_neg",favoriteKey:"img2img_neg",$prompt:null,$textarea:null,$steps:null,name:"img2img_neg_prompt",neg:!0,hideDefaultInputKey:"img2ImgNegHideDefaultInput",hideDefaultInput:!1,hidePanelKey:"img2ImgNegHidePanel",hidePanel:!1,id:"phystonPrompt_img2img_neg_prompt"}],languageCode:"",languages:{},translateApis:[],translateApi:"",translateApiConfig:{},canOneTranslate:!1,autoTranslate:!1,autoTranslateToEnglish:!1,autoTranslateToLocal:!1,autoRemoveSpace:!0,autoRemoveLastComma:!1,autoKeepWeightZero:!1,autoKeepWeightOne:!1,enableTooltip:!0,tagCompleteFile:"",onlyCsvOnAuto:!1,startWatchSave:!1,pasteBtn:null,showPastePopup:!1,pasteTitle:"",pasteContent:"",pasteLoading:!1,historyCurrentPrompt:"",favoriteCurrentPrompt:"",chatgptCurrentPrompt:"",extraNetworks:[],loras:[],lycos:[],embeddings:[],python:"",packagesState:[],version:"",latestVersion:"",isLatestVersion:!0}},watch:{languageCode:{handler:function(e,t){this.startWatchSave&&(console.log("onLanguageCodeChange",e),this.canOneTranslate=oe.canOneTranslate(this.languageCode),this.gradioAPI.setData("languageCode",e).then(n=>{}).catch(n=>{}))},immediate:!1},autoTranslateToEnglish:{handler:function(e,t){this.startWatchSave&&(console.log("onAutoTranslateToEnglishChange",e),this.gradioAPI.setData("autoTranslateToEnglish",e).then(n=>{}).catch(n=>{}))},immediate:!1},autoTranslateToLocal:{handler:function(e,t){this.startWatchSave&&(console.log("onAutoTranslateToLocalChange",e),this.gradioAPI.setData("autoTranslateToLocal",e).then(n=>{}).catch(n=>{}))},immediate:!1},autoTranslate:{handler:function(e,t){this.startWatchSave&&(this.autoTranslateToEnglish=this.autoTranslate,this.autoTranslateToLocal=this.autoTranslate,console.log("onAutoTranslateChange",e),this.gradioAPI.setData("autoTranslate",e).then(n=>{}).catch(n=>{}))},immediate:!1},autoRemoveSpace:{handler:function(e,t){this.startWatchSave&&(console.log("onAutoRemoveSpaceChange",e),this.gradioAPI.setData("autoRemoveSpace",e).then(n=>{}).catch(n=>{}))},immediate:!1},autoRemoveLastComma:{handler:function(e,t){this.startWatchSave&&(console.log("onAutoRemoveLastCommaChange",e),this.gradioAPI.setData("autoRemoveLastComma",e).then(n=>{}).catch(n=>{}))},immediate:!1},autoKeepWeightZero:{handler:function(e,t){this.startWatchSave&&(console.log("onAutoKeepWeightZeroChange",e),this.gradioAPI.setData("autoKeepWeightZero",e).then(n=>{}).catch(n=>{}))},immediate:!1},autoKeepWeightOne:{handler:function(e,t){this.startWatchSave&&(console.log("onAutoKeepWeightOneChange",e),this.gradioAPI.setData("autoKeepWeightOne",e).then(n=>{}).catch(n=>{}))},immediate:!1},enableTooltip:{handler:function(e,t){this.startWatchSave&&(localStorage.setItem("phystonPromptEnableTooltip",e?"true":"false"),this.updateTippyState(),this.gradioAPI.setData("enableTooltip",e).then(n=>{}).catch(n=>{}))},immediate:!1},translateApi:{handler:function(e,t){this.startWatchSave&&(console.log("onTranslateApiChange",e,t),this.updateTranslateApiConfig(),this.gradioAPI.setData("translateApi",e).then(n=>{}).catch(n=>{}))},immediate:!1},tagCompleteFile:{handler:function(e,t){this.startWatchSave&&(console.log("onTagCompleteFileChange",e,t),this.gradioAPI.setData("tagCompleteFile",e).then(n=>{}).catch(n=>{}))},immediate:!1},onlyCsvOnAuto(){this.startWatchSave&&(console.log("onOnlyCsvOnAutoChange",this.onlyCsvOnAuto),this.gradioAPI.setData("onlyCsvOnAuto",this.onlyCsvOnAuto).then(e=>{}).catch(e=>{}))}},mounted(){oe.loadCSS("toastr.min.css","physton-prompt-toastr",!0,!0,!1),oe.loadCSS("tippy.css","physton-prompt-tippy",!0,!0,!1),oe.loadCSS("main.min.css","physton-prompt-main",!0);const t=new URLSearchParams(window.location.search).get("__theme");oe.gradioApp().classList.contains(t)||oe.gradioApp().classList.add(t),this.gradioAPI.getConfig().then(n=>{console.log("config:",n),this.languageCode=n.i18n.default,this.translateApi=n.translate_apis.default,this.translateApis=n.translate_apis.apis,this.python=n.python,this.packagesState=n.packages_state;let i={};n.i18n.languages.forEach(r=>{i[r.code]=r}),this.languages=i,this.init()}).catch(n=>{this.$toastr.error("Connection to backend API service failed. Please manually refresh the webpage. If it still doesn't work, please restart the WebUI.
连接到后台接口服务失败,请手动再刷新一次网页。如果还是不行,请重启WebUI。

"+n.message,"sd-webui-prompt-all-in-one",{timeOut:2e4}),console.log(n)})},methods:{getLang(e){return oe.getLang(e,this.languageCode,this.languages)},init(){this.loadExtraNetworks();let e=["languageCode","autoTranslate","autoTranslateToEnglish","autoTranslateToLocal","autoRemoveSpace","autoRemoveLastComma","autoKeepWeightZero","autoKeepWeightOne","translateApi","enableTooltip","tagCompleteFile","onlyCsvOnAuto","extensionSelect.minimalist"];this.prompts.forEach(t=>{e.push(t.hideDefaultInputKey),e.push(t.hidePanelKey)}),this.gradioAPI.getDatas(e).then(t=>{if(t.languageCode!==null){let n=!1;for(let i in this.languages)if(this.languages[i].code===t.languageCode){n=!0;break}n&&(this.languageCode=t.languageCode,this.$forceUpdate())}this.canOneTranslate=oe.canOneTranslate(this.languageCode),t.autoTranslateToEnglish!==null&&(this.autoTranslateToEnglish=t.autoTranslateToEnglish),t.autoTranslateToLocal!==null&&(this.autoTranslateToLocal=t.autoTranslateToLocal),t.autoTranslate!==null?this.canOneTranslate?(this.autoTranslate=t.autoTranslate,this.autoTranslateToEnglish=this.autoTranslate,this.autoTranslateToLocal=this.autoTranslate):this.autoTranslate=!1:this.canOneTranslate?(this.autoTranslate=this.autoTranslateToEnglish||this.autoTranslateToLocal,this.autoTranslateToEnglish=!0,this.autoTranslateToLocal=!0):this.autoTranslate=!1,t.autoRemoveSpace!==null&&(this.autoRemoveSpace=t.autoRemoveSpace),t.autoRemoveLastComma!==null&&(this.autoRemoveLastComma=t.autoRemoveLastComma),t.autoKeepWeightZero!==null&&(this.autoKeepWeightZero=t.autoKeepWeightZero),t.autoKeepWeightOne!==null&&(this.autoKeepWeightOne=t.autoKeepWeightOne),t.enableTooltip!==null&&(this.enableTooltip=t.enableTooltip),localStorage.setItem("phystonPromptEnableTooltip",this.enableTooltip?"true":"false"),this.updateTippyState(),t.translateApi!==null&&(this.translateApi=t.translateApi),t.tagCompleteFile!==null&&(this.tagCompleteFile=t.tagCompleteFile,this.$nextTick(()=>{this.$refs.translateSetting.getCSV(this.tagCompleteFile)})),t.onlyCsvOnAuto!==null&&(this.onlyCsvOnAuto=t.onlyCsvOnAuto),t["extensionSelect.minimalist"]===null&&this.gradioAPI.setData("extensionSelect.minimalist",!0),this.updateTranslateApiConfig(),this.$refs.extensionCss.init(),this.prompts.forEach(n=>{t[n.hideDefaultInputKey]!==null&&(n.hideDefaultInput=t[n.hideDefaultInputKey]),t[n.hidePanelKey]!==null&&(n.hidePanel=t[n.hidePanelKey]),n.$prompt=oe.gradioApp().querySelector("#"+n.prompt),n.$textarea=n.$prompt.getElementsByTagName("textarea")[0],n.$steps=oe.gradioApp().querySelector("#"+n.steps)}),this.$nextTick(()=>{this.prompts.forEach(n=>{const i=oe.gradioApp().querySelector("#"+n.id);n.$prompt.parentElement.parentElement.parentElement.appendChild(i),n.$prompt.parentElement.parentElement.style.display=n.hideDefaultInput?"none":"flex"}),this.startWatchSave=!0}),this.handlePaste(),this.gradioAPI.getVersion().then(n=>{this.version=n.version,this.latestVersion=n.latest_version,this.isLatestVersion=n.version===n.latest_version})})},updateTippyState(){for(const e of this.$tippyList)this.enableTooltip?e.enable():e.disable()},updateTranslateApiConfig(){this.gradioAPI.getData("translate_api."+this.translateApi).then(e=>{let t={};const n=oe.getTranslateApiItem(this.translateApis,this.translateApi);if(n.config){for(const i of n.config)n.type==="translators"&&i.key==="region"&&!e.region?t[i.key]=this.languageCode==="zh_CN"||this.languageCode==="zh_HK"||this.languageCode==="zh_TW"?"China":"EN":e?t[i.key]=e[i.key]:t[i.key]=i.default||"";t.concurrent=n.concurrent||0}this.translateApiConfig=t})},onPromptFormatClick(e){this.$refs.promptFormat.open(e)},onSelectLanguageClick(e){this.$refs.selectLanguage.open(e)},onTranslateApiClick(){this.$refs.translateSetting.open(this.translateApi)},onSelectThemeClick(){this.$refs.extensionCss.open()},handlePaste(){if(typeof gradioApp!="function")return;const e=gradioApp().querySelectorAll("#paste");!e||e.length<=0||e.forEach((t,n)=>{const i=t.cloneNode(!0);i.id="paste-new-"+n,i.innerHTML="🗒",t.parentNode.insertBefore(i,t.nextSibling),i.addEventListener("click",()=>{this.pasteBtn=t,this.openPastePopup()}),this.pasteTitle=t.title})},openPastePopup(){this.pasteContent="",this.pasteLoading=!1,this.showPastePopup=!0},closePastePopup(){this.showPastePopup=!1},onClickPasteSubmit(){this.pasteLoading=!0;const e=get_uiCurrentTabContent();let t=null,n=null,i=null,r=null,o=[];for(const l of this.prompts)l.tab==e.id&&(console.log(l),o.push(l.id),l.neg?(n=l.$textarea,r=l.$prompt):(t=l.$textarea,i=l.$prompt));if(!t||!i||!r){this.pasteLoading=!1;return}t.value=this.pasteContent,t.dispatchEvent(new Event("input")),this.pasteBtn.dispatchEvent(new Event("click")),setTimeout(()=>{let l=0,c=0;l=setInterval(()=>{if(c++,c>100){this.pasteLoading=!1,clearInterval(l);return}i.getElementsByClassName("hide").length>0&&r.getElementsByClassName("hide").length>0&&(this.pasteLoading=!1,this.closePastePopup(),clearInterval(l),oe.hideCompleteResults(t),oe.hideCompleteResults(n),o.forEach((d,m)=>{setTimeout(()=>{this.$refs[d][0].onTextareaChange(!0)},1e3)}))},100)},1e3)},onUpdateHideDefaultInput(e,t){const n=this.prompts.find(i=>i.id==e);n&&(n.hideDefaultInput=t,this.gradioAPI.setData(n.hideDefaultInputKey,n.hideDefaultInput),n.$prompt.parentElement.parentElement.style.display=n.hideDefaultInput?"none":"flex")},onUpdateHidePanel(e,t){const n=this.prompts.find(i=>i.id==e);n&&(n.hidePanel=t,this.gradioAPI.setData(n.hidePanelKey,n.hidePanel))},onShowHistory(e,t){this.$refs.favorite.hide(),this.historyCurrentPrompt=e;const n=this.prompts.find(i=>i.id==e);n&&this.$refs.history.show(n.historyKey,t)},onUseHistory(e){if(!this.historyCurrentPrompt)return;const t=this.prompts.find(n=>n.id==this.historyCurrentPrompt);t&&this.$refs[t.id][0].useFavorite(e)},onShowFavorite(e,t){this.$refs.history.hide(),this.favoriteCurrentPrompt=e;const n=this.prompts.find(i=>i.id==e);n&&this.$refs.favorite.show(n.favoriteKey,t)},onUseFavorite(e){if(!this.favoriteCurrentPrompt)return;const t=this.prompts.find(n=>n.id==this.favoriteCurrentPrompt);t&&this.$refs[t.id][0].useFavorite(e)},onRefreshFavorites(e){this.$refs.favorite.getFavorites(e)},onShowChatgpt(e,t){this.chatgptCurrentPrompt=e,this.prompts.find(i=>i.id==e)&&this.$refs.chatgptPrompt.open()},onUseChatgpt(e){if(!this.chatgptCurrentPrompt)return;const t=this.prompts.find(n=>n.id==this.chatgptCurrentPrompt);t&&this.$refs[t.id][0].useChatgpt(e)},onShowAbout(){this.$refs.about.open()}}},iw={class:"paste-popup-title"},rw={class:"paste-popup-body"},sw=["placeholder"],ow={key:1,class:"paste-submit"};function aw(e,t,n,i,r,o){const l=Lt("physton-prompt"),c=Lt("translate-setting"),d=Lt("select-language"),m=Lt("prompt-format"),g=Lt("history"),w=Lt("favorite"),T=Lt("extension-css"),N=Lt("packages-state"),x=Lt("chatgpt-prompt"),O=Lt("about"),U=Lt("icon-svg");return R(),B("div",null,[(R(!0),B(Re,null,mt(r.prompts,P=>(R(),B(Re,{key:P.name},[P.$textarea?(R(),vt(l,{key:0,id:P.id,ref_for:!0,ref:P.id,name:P.name,neg:P.neg,textarea:P.$textarea,steps:P.$steps,"language-code":r.languageCode,"onUpdate:languageCode":t[0]||(t[0]=Z=>r.languageCode=Z),"translate-apis":r.translateApis,languages:r.languages,"history-key":P.historyKey,"onClick:showHistory":Z=>o.onShowHistory(P.id,Z),"favorite-key":P.favoriteKey,onRefreshFavorites:o.onRefreshFavorites,"onClick:showFavorite":Z=>o.onShowFavorite(P.id,Z),"can-one-translate":r.canOneTranslate,"onUpdate:canOneTranslate":t[1]||(t[1]=Z=>r.canOneTranslate=Z),"auto-translate":r.autoTranslate,"onUpdate:autoTranslate":t[2]||(t[2]=Z=>r.autoTranslate=Z),"auto-translate-to-english":r.autoTranslateToEnglish,"onUpdate:autoTranslateToEnglish":t[3]||(t[3]=Z=>r.autoTranslateToEnglish=Z),"auto-translate-to-local":r.autoTranslateToLocal,"onUpdate:autoTranslateToLocal":t[4]||(t[4]=Z=>r.autoTranslateToLocal=Z),"auto-remove-space":r.autoRemoveSpace,"onUpdate:autoRemoveSpace":t[5]||(t[5]=Z=>r.autoRemoveSpace=Z),"auto-remove-last-comma":r.autoRemoveLastComma,"onUpdate:autoRemoveLastComma":t[6]||(t[6]=Z=>r.autoRemoveLastComma=Z),"auto-keep-weight-zero":r.autoKeepWeightZero,"onUpdate:autoKeepWeightZero":t[7]||(t[7]=Z=>r.autoKeepWeightZero=Z),"auto-keep-weight-one":r.autoKeepWeightOne,"onUpdate:autoKeepWeightOne":t[8]||(t[8]=Z=>r.autoKeepWeightOne=Z),"hide-default-input":P.hideDefaultInput,"onUpdate:hideDefaultInput":Z=>o.onUpdateHideDefaultInput(P.id,Z),"hide-panel":P.hidePanel,"onUpdate:hidePanel":Z=>o.onUpdateHidePanel(P.id,Z),"enable-tooltip":r.enableTooltip,"onUpdate:enableTooltip":t[9]||(t[9]=Z=>r.enableTooltip=Z),"translate-api":r.translateApi,"onUpdate:translateApi":t[10]||(t[10]=Z=>r.translateApi=Z),"translate-api-config":r.translateApiConfig,"onClick:translateApi":o.onTranslateApiClick,"onClick:promptFormat":o.onPromptFormatClick,"tag-complete-file":r.tagCompleteFile,"onUpdate:tagCompleteFile":t[11]||(t[11]=Z=>r.tagCompleteFile=Z),"only-csv-on-auto":r.onlyCsvOnAuto,"onUpdate:onlyCsvOnAuto":t[12]||(t[12]=Z=>r.onlyCsvOnAuto=Z),"onClick:selectLanguage":o.onSelectLanguageClick,"onClick:selectTheme":o.onSelectThemeClick,"onClick:showChatgpt":Z=>o.onShowChatgpt(P.id,Z),"extra-networks":r.extraNetworks,loras:r.loras,lycos:r.lycos,embeddings:r.embeddings,version:r.version,"latest-version":r.latestVersion,"is-latest-version":r.isLatestVersion,"onClick:showAbout":o.onShowAbout},null,8,["id","name","neg","textarea","steps","language-code","translate-apis","languages","history-key","onClick:showHistory","favorite-key","onRefreshFavorites","onClick:showFavorite","can-one-translate","auto-translate","auto-translate-to-english","auto-translate-to-local","auto-remove-space","auto-remove-last-comma","auto-keep-weight-zero","auto-keep-weight-one","hide-default-input","onUpdate:hideDefaultInput","hide-panel","onUpdate:hidePanel","enable-tooltip","translate-api","translate-api-config","onClick:translateApi","onClick:promptFormat","tag-complete-file","only-csv-on-auto","onClick:selectLanguage","onClick:selectTheme","onClick:showChatgpt","extra-networks","loras","lycos","embeddings","version","latest-version","is-latest-version","onClick:showAbout"])):ze("",!0)],64))),128)),ve(c,{ref:"translateSetting","language-code":r.languageCode,"onUpdate:languageCode":t[13]||(t[13]=P=>r.languageCode=P),"translate-apis":r.translateApis,languages:r.languages,"onForceUpdate:translateApi":o.updateTranslateApiConfig,"tag-complete-file":r.tagCompleteFile,"onUpdate:tagCompleteFile":t[14]||(t[14]=P=>r.tagCompleteFile=P),"only-csv-on-auto":r.onlyCsvOnAuto,"onUpdate:onlyCsvOnAuto":t[15]||(t[15]=P=>r.onlyCsvOnAuto=P),"translate-api":r.translateApi,"onUpdate:translateApi":t[16]||(t[16]=P=>r.translateApi=P)},null,8,["language-code","translate-apis","languages","onForceUpdate:translateApi","tag-complete-file","only-csv-on-auto","translate-api"]),ve(d,{ref:"selectLanguage","language-code":r.languageCode,"onUpdate:languageCode":t[17]||(t[17]=P=>r.languageCode=P),"translate-apis":r.translateApis,languages:r.languages,"translate-api":r.translateApi,"onUpdate:translateApi":t[18]||(t[18]=P=>r.translateApi=P),"tag-complete-file":r.tagCompleteFile,"onUpdate:tagCompleteFile":t[19]||(t[19]=P=>r.tagCompleteFile=P),"only-csv-on-auto":r.onlyCsvOnAuto,"onUpdate:onlyCsvOnAuto":t[20]||(t[20]=P=>r.onlyCsvOnAuto=P)},null,8,["language-code","translate-apis","languages","translate-api","tag-complete-file","only-csv-on-auto"]),ve(m,{ref:"promptFormat","language-code":r.languageCode,"onUpdate:languageCode":t[21]||(t[21]=P=>r.languageCode=P),"translate-apis":r.translateApis,languages:r.languages,"auto-remove-space":r.autoRemoveSpace,"onUpdate:autoRemoveSpace":t[22]||(t[22]=P=>r.autoRemoveSpace=P),"auto-remove-last-comma":r.autoRemoveLastComma,"onUpdate:autoRemoveLastComma":t[23]||(t[23]=P=>r.autoRemoveLastComma=P),"auto-keep-weight-zero":r.autoKeepWeightZero,"onUpdate:autoKeepWeightZero":t[24]||(t[24]=P=>r.autoKeepWeightZero=P),"auto-keep-weight-one":r.autoKeepWeightOne,"onUpdate:autoKeepWeightOne":t[25]||(t[25]=P=>r.autoKeepWeightOne=P)},null,8,["language-code","translate-apis","languages","auto-remove-space","auto-remove-last-comma","auto-keep-weight-zero","auto-keep-weight-one"]),ve(g,{ref:"history","language-code":r.languageCode,"onUpdate:languageCode":t[26]||(t[26]=P=>r.languageCode=P),"translate-apis":r.translateApis,languages:r.languages,"tag-complete-file":r.tagCompleteFile,"onUpdate:tagCompleteFile":t[27]||(t[27]=P=>r.tagCompleteFile=P),"only-csv-on-auto":r.onlyCsvOnAuto,"onUpdate:onlyCsvOnAuto":t[28]||(t[28]=P=>r.onlyCsvOnAuto=P),onRefreshFavorites:o.onRefreshFavorites,onUse:o.onUseHistory},null,8,["language-code","translate-apis","languages","tag-complete-file","only-csv-on-auto","onRefreshFavorites","onUse"]),ve(w,{ref:"favorite","language-code":r.languageCode,"onUpdate:languageCode":t[29]||(t[29]=P=>r.languageCode=P),"translate-apis":r.translateApis,languages:r.languages,"tag-complete-file":r.tagCompleteFile,"onUpdate:tagCompleteFile":t[30]||(t[30]=P=>r.tagCompleteFile=P),"only-csv-on-auto":r.onlyCsvOnAuto,"onUpdate:onlyCsvOnAuto":t[31]||(t[31]=P=>r.onlyCsvOnAuto=P),onUse:o.onUseFavorite},null,8,["language-code","translate-apis","languages","tag-complete-file","only-csv-on-auto","onUse"]),ve(T,{ref:"extensionCss","language-code":r.languageCode,"onUpdate:languageCode":t[32]||(t[32]=P=>r.languageCode=P),"translate-apis":r.translateApis,languages:r.languages},null,8,["language-code","translate-apis","languages"]),ve(N,{ref:"packagesState","language-code":r.languageCode,"onUpdate:languageCode":t[33]||(t[33]=P=>r.languageCode=P),"translate-apis":r.translateApis,languages:r.languages,"onClick:selectLanguage":o.onSelectLanguageClick,"packages-state":r.packagesState,python:r.python},null,8,["language-code","translate-apis","languages","onClick:selectLanguage","packages-state","python"]),ve(x,{ref:"chatgptPrompt","language-code":r.languageCode,"onUpdate:languageCode":t[34]||(t[34]=P=>r.languageCode=P),"translate-apis":r.translateApis,languages:r.languages,onUse:o.onUseChatgpt},null,8,["language-code","translate-apis","languages","onUse"]),ve(O,{ref:"about","language-code":r.languageCode,"onUpdate:languageCode":t[35]||(t[35]=P=>r.languageCode=P),"translate-apis":r.translateApis,languages:r.languages,version:r.version,"latest-version":r.latestVersion,"is-latest-version":r.isLatestVersion},null,8,["language-code","translate-apis","languages","version","latest-version","is-latest-version"]),r.showPastePopup?(R(),B("div",{key:0,class:"physton-paste-popup",onClick:t[40]||(t[40]=(...P)=>o.closePastePopup&&o.closePastePopup(...P))},[_("div",{class:"paste-popup-main",onClick:t[39]||(t[39]=tt(()=>{},["stop"]))},[_("div",{class:"paste-popup-close",onClick:t[36]||(t[36]=(...P)=>o.closePastePopup&&o.closePastePopup(...P))},[ve(U,{name:"close"})]),_("div",iw,ce(r.pasteTitle),1),_("div",rw,[fe(_("textarea",{class:"paste-content","onUpdate:modelValue":t[37]||(t[37]=P=>r.pasteContent=P),placeholder:o.getLang("please_enter_the_content_here")},null,8,sw),[[Hi,r.pasteContent]]),r.pasteLoading?(R(),B("div",ow,[ve(U,{name:"loading"})])):(R(),B("div",{key:0,class:"paste-submit",onClick:t[38]||(t[38]=(...P)=>o.onClickPasteSubmit&&o.onClickPasteSubmit(...P))},"Submit"))])])])):ze("",!0)])}const lw=sn(nw,[["render",aw]]);var Oc={exports:{}},ja={exports:{}};/*! +`,"
"),e=e.replace(/#(\d+)/g,'#$1'),e}}},UC=_("p",{class:"body-title"},[_("a",{href:"https://github.com/Physton/sd-webui-prompt-all-in-one",target:"_blank"},"sd-webui-prompt-all-in-one")],-1),WC=["href"],VC=["src","alt"],KC=["href"],qC={key:0,class:"has-new-version"},zC=["href"],XC=_("a",{href:"https://physton.github.io/sd-webui-prompt-all-in-one-assets/",target:"_blank"},"Wiki",-1),YC={class:"version-list"},GC={class:"item-header"},JC={class:"version-sha"},ZC=["href"],QC={class:"version-date"},ew=["innerHTML"];function tw(e,t,n,i,r,o){const l=Lt("icon-svg");return r.isOpen?(R(),B("div",{key:0,class:"physton-about-prompt",onClick:t[3]||(t[3]=(...c)=>o.close&&o.close(...c))},[_("div",{class:"about-main",onClick:t[2]||(t[2]=tt(()=>{},["stop"]))},[_("div",{class:"about-close",onClick:t[0]||(t[0]=(...c)=>o.close&&o.close(...c))},[ve(l,{name:"close"})]),_("div",{class:"about-body",onClick:t[1]||(t[1]=tt(()=>{},["stop"]))},[UC,_("p",null,[(R(!0),B(Re,null,mt(r.icons,c=>(R(),B("a",{key:c.title,href:c.url,target:"_blank"},[_("img",{src:c.image,alt:c.title},null,8,VC)],8,WC))),128))]),_("p",null,[_("span",null,[$t(ce(e.getLang("version"))+": ",1),_("a",{href:o.commitUrl(n.version),target:"_blank"},ce(o.formatVersion(n.version)),9,KC)]),!n.isLatestVersion&&n.latestVersion?(R(),B("span",qC,[$t("    ("+ce(e.getLang("has_new_version"))+": ",1),_("a",{href:o.commitUrl(n.latestVersion),target:"_blank"},ce(o.formatVersion(n.latestVersion)),9,zC),$t(")")])):ze("",!0)]),_("p",null,[$t(ce(e.getLang("wiki_desc"))+" ",1),XC]),_("div",YC,[r.loading?(R(),vt(l,{key:0,name:"loading"})):ze("",!0),(R(!0),B(Re,null,mt(r.versions,c=>(R(),B("div",{class:"version-item",key:c.version},[_("div",GC,[_("div",JC,[_("a",{href:o.commitUrl(c.version),target:"_blank"},ce(o.formatVersion(c.version)),9,ZC)]),_("div",QC,ce(c.date),1)]),_("div",{class:"version-msg",innerHTML:o.message(c.message)},null,8,ew)]))),128))])])])])):ze("",!0)}const nw={name:"App",components:{About:sn($C,[["render",tw]]),ChatgptPrompt:jC,PackagesState:Jb,PromptFormat:jb,ExtensionCss:Sb,IconSvg:Fn,History:mb,Favorite:By,SelectLanguage:uy,TranslateSetting:sy,PhystonPrompt:cv},mixins:[],data(){return{prompts:[{tab:"tab_txt2img",prompt:"txt2img_prompt",counter:"txt2img_token_counter",button:"txt2img_token_button",steps:"txt2img_steps",historyKey:"txt2img",favoriteKey:"txt2img",$prompt:null,$textarea:null,$steps:null,name:"txt2img_prompt",neg:!1,hideDefaultInputKey:"txt2ImgHideDefaultInput",hideDefaultInput:!1,hidePanelKey:"txt2ImgHidePanel",hidePanel:!1,id:"phystonPrompt_txt2img_prompt"},{tab:"tab_txt2img",prompt:"txt2img_neg_prompt",counter:"txt2img_negative_token_counter",button:"txt2img_negative_token_button",steps:"txt2img_steps",historyKey:"txt2img_neg",favoriteKey:"txt2img_neg",$prompt:null,$textarea:null,$steps:null,name:"txt2img_neg_prompt",neg:!0,hideDefaultInputKey:"txt2ImgNegHideDefaultInput",hideDefaultInput:!1,hidePanelKey:"txt2ImgNegHidePanel",hidePanel:!1,id:"phystonPrompt_txt2img_neg_prompt"},{tab:"tab_img2img",prompt:"img2img_prompt",counter:"img2img_token_counter",button:"img2img_token_button",steps:"img2img_steps",historyKey:"img2img",favoriteKey:"img2img",$prompt:null,$textarea:null,$steps:null,name:"img2img_prompt",neg:!1,hideDefaultInputKey:"img2ImgHideDefaultInput",hideDefaultInput:!1,hidePanelKey:"img2ImgHidePanel",hidePanel:!1,id:"phystonPrompt_img2img_prompt"},{tab:"tab_img2img",prompt:"img2img_neg_prompt",counter:"img2img_negative_token_counter",button:"img2img_negative_token_button",steps:"img2img_steps",historyKey:"img2img_neg",favoriteKey:"img2img_neg",$prompt:null,$textarea:null,$steps:null,name:"img2img_neg_prompt",neg:!0,hideDefaultInputKey:"img2ImgNegHideDefaultInput",hideDefaultInput:!1,hidePanelKey:"img2ImgNegHidePanel",hidePanel:!1,id:"phystonPrompt_img2img_neg_prompt"}],languageCode:"",languages:{},translateApis:[],translateApi:"",translateApiConfig:{},canOneTranslate:!1,autoTranslate:!1,autoTranslateToEnglish:!1,autoTranslateToLocal:!1,autoRemoveSpace:!0,autoRemoveLastComma:!1,autoKeepWeightZero:!1,autoKeepWeightOne:!1,enableTooltip:!0,tagCompleteFile:"",onlyCsvOnAuto:!1,startWatchSave:!1,pasteBtn:null,showPastePopup:!1,pasteTitle:"",pasteContent:"",pasteLoading:!1,historyCurrentPrompt:"",favoriteCurrentPrompt:"",chatgptCurrentPrompt:"",extraNetworks:[],loras:[],lycos:[],embeddings:[],python:"",packagesState:[],version:"",latestVersion:"",isLatestVersion:!0}},watch:{languageCode:{handler:function(e,t){this.startWatchSave&&(console.log("onLanguageCodeChange",e),this.canOneTranslate=oe.canOneTranslate(this.languageCode),this.gradioAPI.setData("languageCode",e).then(n=>{}).catch(n=>{}))},immediate:!1},autoTranslateToEnglish:{handler:function(e,t){this.startWatchSave&&(console.log("onAutoTranslateToEnglishChange",e),this.gradioAPI.setData("autoTranslateToEnglish",e).then(n=>{}).catch(n=>{}))},immediate:!1},autoTranslateToLocal:{handler:function(e,t){this.startWatchSave&&(console.log("onAutoTranslateToLocalChange",e),this.gradioAPI.setData("autoTranslateToLocal",e).then(n=>{}).catch(n=>{}))},immediate:!1},autoTranslate:{handler:function(e,t){this.startWatchSave&&(this.autoTranslateToEnglish=this.autoTranslate,this.autoTranslateToLocal=this.autoTranslate,console.log("onAutoTranslateChange",e),this.gradioAPI.setData("autoTranslate",e).then(n=>{}).catch(n=>{}))},immediate:!1},autoRemoveSpace:{handler:function(e,t){this.startWatchSave&&(console.log("onAutoRemoveSpaceChange",e),this.gradioAPI.setData("autoRemoveSpace",e).then(n=>{}).catch(n=>{}))},immediate:!1},autoRemoveLastComma:{handler:function(e,t){this.startWatchSave&&(console.log("onAutoRemoveLastCommaChange",e),this.gradioAPI.setData("autoRemoveLastComma",e).then(n=>{}).catch(n=>{}))},immediate:!1},autoKeepWeightZero:{handler:function(e,t){this.startWatchSave&&(console.log("onAutoKeepWeightZeroChange",e),this.gradioAPI.setData("autoKeepWeightZero",e).then(n=>{}).catch(n=>{}))},immediate:!1},autoKeepWeightOne:{handler:function(e,t){this.startWatchSave&&(console.log("onAutoKeepWeightOneChange",e),this.gradioAPI.setData("autoKeepWeightOne",e).then(n=>{}).catch(n=>{}))},immediate:!1},enableTooltip:{handler:function(e,t){this.startWatchSave&&(localStorage.setItem("phystonPromptEnableTooltip",e?"true":"false"),this.updateTippyState(),this.gradioAPI.setData("enableTooltip",e).then(n=>{}).catch(n=>{}))},immediate:!1},translateApi:{handler:function(e,t){this.startWatchSave&&(console.log("onTranslateApiChange",e,t),this.updateTranslateApiConfig(),this.gradioAPI.setData("translateApi",e).then(n=>{}).catch(n=>{}))},immediate:!1},tagCompleteFile:{handler:function(e,t){this.startWatchSave&&(console.log("onTagCompleteFileChange",e,t),this.gradioAPI.setData("tagCompleteFile",e).then(n=>{}).catch(n=>{}))},immediate:!1},onlyCsvOnAuto(){this.startWatchSave&&(console.log("onOnlyCsvOnAutoChange",this.onlyCsvOnAuto),this.gradioAPI.setData("onlyCsvOnAuto",this.onlyCsvOnAuto).then(e=>{}).catch(e=>{}))}},mounted(){oe.loadCSS("toastr.min.css","physton-prompt-toastr",!0,!0,!1),oe.loadCSS("tippy.css","physton-prompt-tippy",!0,!0,!1),oe.loadCSS("main.min.css","physton-prompt-main",!0);const t=new URLSearchParams(window.location.search).get("__theme");oe.gradioApp().classList.contains(t)||oe.gradioApp().classList.add(t),this.gradioAPI.getConfig().then(n=>{console.log("config:",n),this.languageCode=n.i18n.default,this.translateApi=n.translate_apis.default,this.translateApis=n.translate_apis.apis,this.python=n.python,this.packagesState=n.packages_state;let i={};n.i18n.languages.forEach(r=>{i[r.code]=r}),this.languages=i,this.init()}).catch(n=>{this.$toastr.error("Connection to backend API service failed. Please manually refresh the webpage. If it still doesn't work, please restart the WebUI.
连接到后台接口服务失败,请手动再刷新一次网页。如果还是不行,请重启WebUI。

"+n.message,"sd-webui-prompt-all-in-one",{timeOut:2e4}),console.log(n)})},methods:{getLang(e){return oe.getLang(e,this.languageCode,this.languages)},init(){this.loadExtraNetworks();let e=["languageCode","autoTranslate","autoTranslateToEnglish","autoTranslateToLocal","autoRemoveSpace","autoRemoveLastComma","autoKeepWeightZero","autoKeepWeightOne","translateApi","enableTooltip","tagCompleteFile","onlyCsvOnAuto","extensionSelect.minimalist"];this.prompts.forEach(t=>{e.push(t.hideDefaultInputKey),e.push(t.hidePanelKey)}),this.gradioAPI.getDatas(e).then(t=>{if(t.languageCode!==null){let n=!1;for(let i in this.languages)if(this.languages[i].code===t.languageCode){n=!0;break}n&&(this.languageCode=t.languageCode,this.$forceUpdate())}this.canOneTranslate=oe.canOneTranslate(this.languageCode),t.autoTranslateToEnglish!==null&&(this.autoTranslateToEnglish=t.autoTranslateToEnglish),t.autoTranslateToLocal!==null&&(this.autoTranslateToLocal=t.autoTranslateToLocal),t.autoTranslate!==null?this.canOneTranslate?(this.autoTranslate=t.autoTranslate,this.autoTranslateToEnglish=this.autoTranslate,this.autoTranslateToLocal=this.autoTranslate):this.autoTranslate=!1:this.canOneTranslate?(this.autoTranslate=this.autoTranslateToEnglish||this.autoTranslateToLocal,this.autoTranslateToEnglish=!0,this.autoTranslateToLocal=!0):this.autoTranslate=!1,t.autoRemoveSpace!==null&&(this.autoRemoveSpace=t.autoRemoveSpace),t.autoRemoveLastComma!==null&&(this.autoRemoveLastComma=t.autoRemoveLastComma),t.autoKeepWeightZero!==null&&(this.autoKeepWeightZero=t.autoKeepWeightZero),t.autoKeepWeightOne!==null&&(this.autoKeepWeightOne=t.autoKeepWeightOne),t.enableTooltip!==null&&(this.enableTooltip=t.enableTooltip),localStorage.setItem("phystonPromptEnableTooltip",this.enableTooltip?"true":"false"),this.updateTippyState(),t.translateApi!==null&&(this.translateApi=t.translateApi),t.tagCompleteFile!==null&&(this.tagCompleteFile=t.tagCompleteFile,this.$nextTick(()=>{this.$refs.translateSetting.getCSV(this.tagCompleteFile)})),t.onlyCsvOnAuto!==null&&(this.onlyCsvOnAuto=t.onlyCsvOnAuto),t["extensionSelect.minimalist"]===null&&this.gradioAPI.setData("extensionSelect.minimalist",!0),this.updateTranslateApiConfig(),this.$refs.extensionCss.init(),this.prompts.forEach(n=>{t[n.hideDefaultInputKey]!==null&&(n.hideDefaultInput=t[n.hideDefaultInputKey]),t[n.hidePanelKey]!==null&&(n.hidePanel=t[n.hidePanelKey]),n.$prompt=oe.gradioApp().querySelector("#"+n.prompt),n.$textarea=n.$prompt.getElementsByTagName("textarea")[0],n.$steps=oe.gradioApp().querySelector("#"+n.steps)}),this.$nextTick(()=>{this.prompts.forEach(n=>{const i=oe.gradioApp().querySelector("#"+n.id);n.$prompt.parentElement.parentElement.parentElement.appendChild(i),n.$prompt.parentElement.parentElement.style.display=n.hideDefaultInput?"none":"flex"}),this.startWatchSave=!0}),this.handlePaste(),this.gradioAPI.getVersion().then(n=>{this.version=n.version,this.latestVersion=n.latest_version,this.isLatestVersion=n.version===n.latest_version})})},updateTippyState(){for(const e of this.$tippyList)this.enableTooltip?e.enable():e.disable()},updateTranslateApiConfig(){this.gradioAPI.getData("translate_api."+this.translateApi).then(e=>{let t={};const n=oe.getTranslateApiItem(this.translateApis,this.translateApi);if(n.config){for(const i of n.config)n.type==="translators"&&i.key==="region"&&!e.region?t[i.key]=this.languageCode==="zh_CN"||this.languageCode==="zh_HK"||this.languageCode==="zh_TW"?"China":"EN":e?t[i.key]=e[i.key]:t[i.key]=i.default||"";t.concurrent=n.concurrent||0}this.translateApiConfig=t})},onPromptFormatClick(e){this.$refs.promptFormat.open(e)},onSelectLanguageClick(e){this.$refs.selectLanguage.open(e)},onTranslateApiClick(){this.$refs.translateSetting.open(this.translateApi)},onSelectThemeClick(){this.$refs.extensionCss.open()},handlePaste(){if(typeof gradioApp!="function")return;const e=gradioApp().querySelectorAll("#paste");!e||e.length<=0||e.forEach((t,n)=>{const i=t.cloneNode(!0);i.id="paste-new-"+n,i.innerHTML="🗒",t.parentNode.insertBefore(i,t.nextSibling),i.addEventListener("click",()=>{this.pasteBtn=t,this.openPastePopup()}),this.pasteTitle=t.title})},openPastePopup(){this.pasteContent="",this.pasteLoading=!1,this.showPastePopup=!0},closePastePopup(){this.showPastePopup=!1},onClickPasteSubmit(){this.pasteLoading=!0;const e=get_uiCurrentTabContent();let t=null,n=null,i=null,r=null,o=[];for(const l of this.prompts)l.tab==e.id&&(console.log(l),o.push(l.id),l.neg?(n=l.$textarea,r=l.$prompt):(t=l.$textarea,i=l.$prompt));if(!t||!i||!r){this.pasteLoading=!1;return}t.value=this.pasteContent,t.dispatchEvent(new Event("input")),this.pasteBtn.dispatchEvent(new Event("click")),setTimeout(()=>{let l=0,c=0;l=setInterval(()=>{if(c++,c>100){this.pasteLoading=!1,clearInterval(l);return}i.getElementsByClassName("hide").length>0&&r.getElementsByClassName("hide").length>0&&(this.pasteLoading=!1,this.closePastePopup(),clearInterval(l),oe.hideCompleteResults(t),oe.hideCompleteResults(n),o.forEach((d,m)=>{setTimeout(()=>{this.$refs[d][0].onTextareaChange(!0)},1e3)}))},100)},1e3)},onUpdateHideDefaultInput(e,t){const n=this.prompts.find(i=>i.id==e);n&&(n.hideDefaultInput=t,this.gradioAPI.setData(n.hideDefaultInputKey,n.hideDefaultInput),n.$prompt.parentElement.parentElement.style.display=n.hideDefaultInput?"none":"flex")},onUpdateHidePanel(e,t){const n=this.prompts.find(i=>i.id==e);n&&(n.hidePanel=t,this.gradioAPI.setData(n.hidePanelKey,n.hidePanel))},onShowHistory(e,t){this.$refs.favorite.hide(),this.historyCurrentPrompt=e;const n=this.prompts.find(i=>i.id==e);n&&this.$refs.history.show(n.historyKey,t)},onUseHistory(e){if(!this.historyCurrentPrompt)return;const t=this.prompts.find(n=>n.id==this.historyCurrentPrompt);t&&this.$refs[t.id][0].useFavorite(e)},onShowFavorite(e,t){this.$refs.history.hide(),this.favoriteCurrentPrompt=e;const n=this.prompts.find(i=>i.id==e);n&&this.$refs.favorite.show(n.favoriteKey,t)},onUseFavorite(e){if(!this.favoriteCurrentPrompt)return;const t=this.prompts.find(n=>n.id==this.favoriteCurrentPrompt);t&&this.$refs[t.id][0].useFavorite(e)},onRefreshFavorites(e){this.$refs.favorite.getFavorites(e)},onShowChatgpt(e,t){this.chatgptCurrentPrompt=e,this.prompts.find(i=>i.id==e)&&this.$refs.chatgptPrompt.open()},onUseChatgpt(e){if(!this.chatgptCurrentPrompt)return;const t=this.prompts.find(n=>n.id==this.chatgptCurrentPrompt);t&&this.$refs[t.id][0].useChatgpt(e)},onShowAbout(){this.$refs.about.open()}}},iw={class:"paste-popup-title"},rw={class:"paste-popup-body"},sw=["placeholder"],ow={key:1,class:"paste-submit"};function aw(e,t,n,i,r,o){const l=Lt("physton-prompt"),c=Lt("translate-setting"),d=Lt("select-language"),m=Lt("prompt-format"),g=Lt("history"),w=Lt("favorite"),T=Lt("extension-css"),N=Lt("packages-state"),x=Lt("chatgpt-prompt"),O=Lt("about"),U=Lt("icon-svg");return R(),B("div",null,[(R(!0),B(Re,null,mt(r.prompts,P=>(R(),B(Re,{key:P.name},[P.$textarea?(R(),vt(l,{key:0,id:P.id,ref_for:!0,ref:P.id,name:P.name,neg:P.neg,textarea:P.$textarea,steps:P.$steps,"language-code":r.languageCode,"onUpdate:languageCode":t[0]||(t[0]=Z=>r.languageCode=Z),"translate-apis":r.translateApis,languages:r.languages,"history-key":P.historyKey,"onClick:showHistory":Z=>o.onShowHistory(P.id,Z),"favorite-key":P.favoriteKey,onRefreshFavorites:o.onRefreshFavorites,"onClick:showFavorite":Z=>o.onShowFavorite(P.id,Z),"can-one-translate":r.canOneTranslate,"onUpdate:canOneTranslate":t[1]||(t[1]=Z=>r.canOneTranslate=Z),"auto-translate":r.autoTranslate,"onUpdate:autoTranslate":t[2]||(t[2]=Z=>r.autoTranslate=Z),"auto-translate-to-english":r.autoTranslateToEnglish,"onUpdate:autoTranslateToEnglish":t[3]||(t[3]=Z=>r.autoTranslateToEnglish=Z),"auto-translate-to-local":r.autoTranslateToLocal,"onUpdate:autoTranslateToLocal":t[4]||(t[4]=Z=>r.autoTranslateToLocal=Z),"auto-remove-space":r.autoRemoveSpace,"onUpdate:autoRemoveSpace":t[5]||(t[5]=Z=>r.autoRemoveSpace=Z),"auto-remove-last-comma":r.autoRemoveLastComma,"onUpdate:autoRemoveLastComma":t[6]||(t[6]=Z=>r.autoRemoveLastComma=Z),"auto-keep-weight-zero":r.autoKeepWeightZero,"onUpdate:autoKeepWeightZero":t[7]||(t[7]=Z=>r.autoKeepWeightZero=Z),"auto-keep-weight-one":r.autoKeepWeightOne,"onUpdate:autoKeepWeightOne":t[8]||(t[8]=Z=>r.autoKeepWeightOne=Z),"hide-default-input":P.hideDefaultInput,"onUpdate:hideDefaultInput":Z=>o.onUpdateHideDefaultInput(P.id,Z),"hide-panel":P.hidePanel,"onUpdate:hidePanel":Z=>o.onUpdateHidePanel(P.id,Z),"enable-tooltip":r.enableTooltip,"onUpdate:enableTooltip":t[9]||(t[9]=Z=>r.enableTooltip=Z),"translate-api":r.translateApi,"onUpdate:translateApi":t[10]||(t[10]=Z=>r.translateApi=Z),"translate-api-config":r.translateApiConfig,"onClick:translateApi":o.onTranslateApiClick,"onClick:promptFormat":o.onPromptFormatClick,"tag-complete-file":r.tagCompleteFile,"onUpdate:tagCompleteFile":t[11]||(t[11]=Z=>r.tagCompleteFile=Z),"only-csv-on-auto":r.onlyCsvOnAuto,"onUpdate:onlyCsvOnAuto":t[12]||(t[12]=Z=>r.onlyCsvOnAuto=Z),"onClick:selectLanguage":o.onSelectLanguageClick,"onClick:selectTheme":o.onSelectThemeClick,"onClick:showChatgpt":Z=>o.onShowChatgpt(P.id,Z),"extra-networks":r.extraNetworks,loras:r.loras,lycos:r.lycos,embeddings:r.embeddings,version:r.version,"latest-version":r.latestVersion,"is-latest-version":r.isLatestVersion,"onClick:showAbout":o.onShowAbout},null,8,["id","name","neg","textarea","steps","language-code","translate-apis","languages","history-key","onClick:showHistory","favorite-key","onRefreshFavorites","onClick:showFavorite","can-one-translate","auto-translate","auto-translate-to-english","auto-translate-to-local","auto-remove-space","auto-remove-last-comma","auto-keep-weight-zero","auto-keep-weight-one","hide-default-input","onUpdate:hideDefaultInput","hide-panel","onUpdate:hidePanel","enable-tooltip","translate-api","translate-api-config","onClick:translateApi","onClick:promptFormat","tag-complete-file","only-csv-on-auto","onClick:selectLanguage","onClick:selectTheme","onClick:showChatgpt","extra-networks","loras","lycos","embeddings","version","latest-version","is-latest-version","onClick:showAbout"])):ze("",!0)],64))),128)),ve(c,{ref:"translateSetting","language-code":r.languageCode,"onUpdate:languageCode":t[13]||(t[13]=P=>r.languageCode=P),"translate-apis":r.translateApis,languages:r.languages,"onForceUpdate:translateApi":o.updateTranslateApiConfig,"tag-complete-file":r.tagCompleteFile,"onUpdate:tagCompleteFile":t[14]||(t[14]=P=>r.tagCompleteFile=P),"only-csv-on-auto":r.onlyCsvOnAuto,"onUpdate:onlyCsvOnAuto":t[15]||(t[15]=P=>r.onlyCsvOnAuto=P),"translate-api":r.translateApi,"onUpdate:translateApi":t[16]||(t[16]=P=>r.translateApi=P)},null,8,["language-code","translate-apis","languages","onForceUpdate:translateApi","tag-complete-file","only-csv-on-auto","translate-api"]),ve(d,{ref:"selectLanguage","language-code":r.languageCode,"onUpdate:languageCode":t[17]||(t[17]=P=>r.languageCode=P),"translate-apis":r.translateApis,languages:r.languages,"translate-api":r.translateApi,"onUpdate:translateApi":t[18]||(t[18]=P=>r.translateApi=P),"tag-complete-file":r.tagCompleteFile,"onUpdate:tagCompleteFile":t[19]||(t[19]=P=>r.tagCompleteFile=P),"only-csv-on-auto":r.onlyCsvOnAuto,"onUpdate:onlyCsvOnAuto":t[20]||(t[20]=P=>r.onlyCsvOnAuto=P)},null,8,["language-code","translate-apis","languages","translate-api","tag-complete-file","only-csv-on-auto"]),ve(m,{ref:"promptFormat","language-code":r.languageCode,"onUpdate:languageCode":t[21]||(t[21]=P=>r.languageCode=P),"translate-apis":r.translateApis,languages:r.languages,"auto-remove-space":r.autoRemoveSpace,"onUpdate:autoRemoveSpace":t[22]||(t[22]=P=>r.autoRemoveSpace=P),"auto-remove-last-comma":r.autoRemoveLastComma,"onUpdate:autoRemoveLastComma":t[23]||(t[23]=P=>r.autoRemoveLastComma=P),"auto-keep-weight-zero":r.autoKeepWeightZero,"onUpdate:autoKeepWeightZero":t[24]||(t[24]=P=>r.autoKeepWeightZero=P),"auto-keep-weight-one":r.autoKeepWeightOne,"onUpdate:autoKeepWeightOne":t[25]||(t[25]=P=>r.autoKeepWeightOne=P)},null,8,["language-code","translate-apis","languages","auto-remove-space","auto-remove-last-comma","auto-keep-weight-zero","auto-keep-weight-one"]),ve(g,{ref:"history","language-code":r.languageCode,"onUpdate:languageCode":t[26]||(t[26]=P=>r.languageCode=P),"translate-apis":r.translateApis,languages:r.languages,"tag-complete-file":r.tagCompleteFile,"onUpdate:tagCompleteFile":t[27]||(t[27]=P=>r.tagCompleteFile=P),"only-csv-on-auto":r.onlyCsvOnAuto,"onUpdate:onlyCsvOnAuto":t[28]||(t[28]=P=>r.onlyCsvOnAuto=P),onRefreshFavorites:o.onRefreshFavorites,onUse:o.onUseHistory},null,8,["language-code","translate-apis","languages","tag-complete-file","only-csv-on-auto","onRefreshFavorites","onUse"]),ve(w,{ref:"favorite","language-code":r.languageCode,"onUpdate:languageCode":t[29]||(t[29]=P=>r.languageCode=P),"translate-apis":r.translateApis,languages:r.languages,"tag-complete-file":r.tagCompleteFile,"onUpdate:tagCompleteFile":t[30]||(t[30]=P=>r.tagCompleteFile=P),"only-csv-on-auto":r.onlyCsvOnAuto,"onUpdate:onlyCsvOnAuto":t[31]||(t[31]=P=>r.onlyCsvOnAuto=P),onUse:o.onUseFavorite},null,8,["language-code","translate-apis","languages","tag-complete-file","only-csv-on-auto","onUse"]),ve(T,{ref:"extensionCss","language-code":r.languageCode,"onUpdate:languageCode":t[32]||(t[32]=P=>r.languageCode=P),"translate-apis":r.translateApis,languages:r.languages},null,8,["language-code","translate-apis","languages"]),ve(N,{ref:"packagesState","language-code":r.languageCode,"onUpdate:languageCode":t[33]||(t[33]=P=>r.languageCode=P),"translate-apis":r.translateApis,languages:r.languages,"onClick:selectLanguage":o.onSelectLanguageClick,"packages-state":r.packagesState,python:r.python},null,8,["language-code","translate-apis","languages","onClick:selectLanguage","packages-state","python"]),ve(x,{ref:"chatgptPrompt","language-code":r.languageCode,"onUpdate:languageCode":t[34]||(t[34]=P=>r.languageCode=P),"translate-apis":r.translateApis,languages:r.languages,onUse:o.onUseChatgpt},null,8,["language-code","translate-apis","languages","onUse"]),ve(O,{ref:"about","language-code":r.languageCode,"onUpdate:languageCode":t[35]||(t[35]=P=>r.languageCode=P),"translate-apis":r.translateApis,languages:r.languages,version:r.version,"latest-version":r.latestVersion,"is-latest-version":r.isLatestVersion},null,8,["language-code","translate-apis","languages","version","latest-version","is-latest-version"]),r.showPastePopup?(R(),B("div",{key:0,class:"physton-paste-popup",onClick:t[40]||(t[40]=(...P)=>o.closePastePopup&&o.closePastePopup(...P))},[_("div",{class:"paste-popup-main",onClick:t[39]||(t[39]=tt(()=>{},["stop"]))},[_("div",{class:"paste-popup-close",onClick:t[36]||(t[36]=(...P)=>o.closePastePopup&&o.closePastePopup(...P))},[ve(U,{name:"close"})]),_("div",iw,ce(r.pasteTitle),1),_("div",rw,[fe(_("textarea",{class:"paste-content","onUpdate:modelValue":t[37]||(t[37]=P=>r.pasteContent=P),placeholder:o.getLang("please_enter_the_content_here")},null,8,sw),[[Hi,r.pasteContent]]),r.pasteLoading?(R(),B("div",ow,[ve(U,{name:"loading"})])):(R(),B("div",{key:0,class:"paste-submit",onClick:t[38]||(t[38]=(...P)=>o.onClickPasteSubmit&&o.onClickPasteSubmit(...P))},"Submit"))])])])):ze("",!0)])}const lw=sn(nw,[["render",aw]]);var Oc={exports:{}},ja={exports:{}};/*! * jQuery JavaScript Library v3.6.4 * https://jquery.com/ * diff --git a/javascript/main.entry.js.map b/javascript/main.entry.js.map index 0e9f90b..edd343e 100644 --- a/javascript/main.entry.js.map +++ b/javascript/main.entry.js.map @@ -1 +1 @@ -{"version":3,"file":"main.entry.js","sources":["../src/node_modules/@vue/shared/dist/shared.esm-bundler.js","../src/node_modules/@vue/reactivity/dist/reactivity.esm-bundler.js","../src/node_modules/@vue/runtime-core/dist/runtime-core.esm-bundler.js","../src/node_modules/@vue/runtime-dom/dist/runtime-dom.esm-bundler.js","../src/node_modules/sortablejs/modular/sortable.esm.js","../src/src/utils/splitTags.js","../src/src/utils/common.js","../src/src/mixins/languageMixin.js","../src/src/components/vue-number-input.vue","../src/src/mixins/phystonPrompt/headerMixin.js","../src/src/mixins/phystonPrompt/dropMixin.js","../src/node_modules/autosize-input/index.js","../src/src/mixins/phystonPrompt/tagMixin.js","../src/src/components/iconSvg.vue","../src/src/components/highlightPrompt.vue","../src/src/components/phystonPrompt.vue","../src/src/components/translateSetting.vue","../src/src/components/selectLanguage.vue","../src/src/components/favorite.vue","../src/src/components/history.vue","../src/src/components/extensionCss.vue","../src/src/components/promptFormat.vue","../src/src/components/packagesState.vue","../src/src/components/chatgptPrompt.vue","../src/src/components/about.vue","../src/src/App.vue","../src/node_modules/jquery/dist/jquery.js","../src/node_modules/toastr/toastr.js","../src/node_modules/clipboard/dist/clipboard.js","../src/node_modules/vue-clipboard3/dist/esm/index.js","../src/node_modules/axios/lib/helpers/bind.js","../src/node_modules/axios/lib/utils.js","../src/node_modules/axios/lib/core/AxiosError.js","../src/node_modules/axios/lib/helpers/null.js","../src/node_modules/axios/lib/helpers/toFormData.js","../src/node_modules/axios/lib/helpers/AxiosURLSearchParams.js","../src/node_modules/axios/lib/helpers/buildURL.js","../src/node_modules/axios/lib/core/InterceptorManager.js","../src/node_modules/axios/lib/defaults/transitional.js","../src/node_modules/axios/lib/platform/browser/classes/URLSearchParams.js","../src/node_modules/axios/lib/platform/browser/classes/FormData.js","../src/node_modules/axios/lib/platform/browser/classes/Blob.js","../src/node_modules/axios/lib/platform/browser/index.js","../src/node_modules/axios/lib/helpers/toURLEncodedForm.js","../src/node_modules/axios/lib/helpers/formDataToJSON.js","../src/node_modules/axios/lib/defaults/index.js","../src/node_modules/axios/lib/helpers/parseHeaders.js","../src/node_modules/axios/lib/core/AxiosHeaders.js","../src/node_modules/axios/lib/core/transformData.js","../src/node_modules/axios/lib/cancel/isCancel.js","../src/node_modules/axios/lib/cancel/CanceledError.js","../src/node_modules/axios/lib/core/settle.js","../src/node_modules/axios/lib/helpers/cookies.js","../src/node_modules/axios/lib/helpers/isAbsoluteURL.js","../src/node_modules/axios/lib/helpers/combineURLs.js","../src/node_modules/axios/lib/core/buildFullPath.js","../src/node_modules/axios/lib/helpers/isURLSameOrigin.js","../src/node_modules/axios/lib/helpers/parseProtocol.js","../src/node_modules/axios/lib/helpers/speedometer.js","../src/node_modules/axios/lib/adapters/xhr.js","../src/node_modules/axios/lib/adapters/adapters.js","../src/node_modules/axios/lib/core/dispatchRequest.js","../src/node_modules/axios/lib/core/mergeConfig.js","../src/node_modules/axios/lib/env/data.js","../src/node_modules/axios/lib/helpers/validator.js","../src/node_modules/axios/lib/core/Axios.js","../src/node_modules/axios/lib/cancel/CancelToken.js","../src/node_modules/axios/lib/helpers/spread.js","../src/node_modules/axios/lib/helpers/isAxiosError.js","../src/node_modules/axios/lib/helpers/HttpStatusCode.js","../src/node_modules/axios/lib/axios.js","../src/src/utils/gradioAPI.js","../src/src/mixins/commonMixin.js","../src/node_modules/@popperjs/core/lib/enums.js","../src/node_modules/@popperjs/core/lib/dom-utils/getNodeName.js","../src/node_modules/@popperjs/core/lib/dom-utils/getWindow.js","../src/node_modules/@popperjs/core/lib/dom-utils/instanceOf.js","../src/node_modules/@popperjs/core/lib/modifiers/applyStyles.js","../src/node_modules/@popperjs/core/lib/utils/getBasePlacement.js","../src/node_modules/@popperjs/core/lib/utils/math.js","../src/node_modules/@popperjs/core/lib/utils/userAgent.js","../src/node_modules/@popperjs/core/lib/dom-utils/isLayoutViewport.js","../src/node_modules/@popperjs/core/lib/dom-utils/getBoundingClientRect.js","../src/node_modules/@popperjs/core/lib/dom-utils/getLayoutRect.js","../src/node_modules/@popperjs/core/lib/dom-utils/contains.js","../src/node_modules/@popperjs/core/lib/dom-utils/getComputedStyle.js","../src/node_modules/@popperjs/core/lib/dom-utils/isTableElement.js","../src/node_modules/@popperjs/core/lib/dom-utils/getDocumentElement.js","../src/node_modules/@popperjs/core/lib/dom-utils/getParentNode.js","../src/node_modules/@popperjs/core/lib/dom-utils/getOffsetParent.js","../src/node_modules/@popperjs/core/lib/utils/getMainAxisFromPlacement.js","../src/node_modules/@popperjs/core/lib/utils/within.js","../src/node_modules/@popperjs/core/lib/utils/getFreshSideObject.js","../src/node_modules/@popperjs/core/lib/utils/mergePaddingObject.js","../src/node_modules/@popperjs/core/lib/utils/expandToHashMap.js","../src/node_modules/@popperjs/core/lib/modifiers/arrow.js","../src/node_modules/@popperjs/core/lib/utils/getVariation.js","../src/node_modules/@popperjs/core/lib/modifiers/computeStyles.js","../src/node_modules/@popperjs/core/lib/modifiers/eventListeners.js","../src/node_modules/@popperjs/core/lib/utils/getOppositePlacement.js","../src/node_modules/@popperjs/core/lib/utils/getOppositeVariationPlacement.js","../src/node_modules/@popperjs/core/lib/dom-utils/getWindowScroll.js","../src/node_modules/@popperjs/core/lib/dom-utils/getWindowScrollBarX.js","../src/node_modules/@popperjs/core/lib/dom-utils/getViewportRect.js","../src/node_modules/@popperjs/core/lib/dom-utils/getDocumentRect.js","../src/node_modules/@popperjs/core/lib/dom-utils/isScrollParent.js","../src/node_modules/@popperjs/core/lib/dom-utils/getScrollParent.js","../src/node_modules/@popperjs/core/lib/dom-utils/listScrollParents.js","../src/node_modules/@popperjs/core/lib/utils/rectToClientRect.js","../src/node_modules/@popperjs/core/lib/dom-utils/getClippingRect.js","../src/node_modules/@popperjs/core/lib/utils/computeOffsets.js","../src/node_modules/@popperjs/core/lib/utils/detectOverflow.js","../src/node_modules/@popperjs/core/lib/utils/computeAutoPlacement.js","../src/node_modules/@popperjs/core/lib/modifiers/flip.js","../src/node_modules/@popperjs/core/lib/modifiers/hide.js","../src/node_modules/@popperjs/core/lib/modifiers/offset.js","../src/node_modules/@popperjs/core/lib/modifiers/popperOffsets.js","../src/node_modules/@popperjs/core/lib/utils/getAltAxis.js","../src/node_modules/@popperjs/core/lib/modifiers/preventOverflow.js","../src/node_modules/@popperjs/core/lib/dom-utils/getHTMLElementScroll.js","../src/node_modules/@popperjs/core/lib/dom-utils/getNodeScroll.js","../src/node_modules/@popperjs/core/lib/dom-utils/getCompositeRect.js","../src/node_modules/@popperjs/core/lib/utils/orderModifiers.js","../src/node_modules/@popperjs/core/lib/utils/debounce.js","../src/node_modules/@popperjs/core/lib/utils/mergeByName.js","../src/node_modules/@popperjs/core/lib/createPopper.js","../src/node_modules/@popperjs/core/lib/popper.js","../src/node_modules/tippy.js/dist/tippy.esm.js","../src/src/main.js"],"sourcesContent":["/**\n * Make a map and return a function for checking if a key\n * is in that map.\n * IMPORTANT: all calls of this function must be prefixed with\n * \\/\\*#\\_\\_PURE\\_\\_\\*\\/\n * So that rollup can tree-shake them if necessary.\n */\nfunction makeMap(str, expectsLowerCase) {\n const map = Object.create(null);\n const list = str.split(',');\n for (let i = 0; i < list.length; i++) {\n map[list[i]] = true;\n }\n return expectsLowerCase ? val => !!map[val.toLowerCase()] : val => !!map[val];\n}\n\n/**\n * dev only flag -> name mapping\n */\nconst PatchFlagNames = {\n [1 /* PatchFlags.TEXT */]: `TEXT`,\n [2 /* PatchFlags.CLASS */]: `CLASS`,\n [4 /* PatchFlags.STYLE */]: `STYLE`,\n [8 /* PatchFlags.PROPS */]: `PROPS`,\n [16 /* PatchFlags.FULL_PROPS */]: `FULL_PROPS`,\n [32 /* PatchFlags.HYDRATE_EVENTS */]: `HYDRATE_EVENTS`,\n [64 /* PatchFlags.STABLE_FRAGMENT */]: `STABLE_FRAGMENT`,\n [128 /* PatchFlags.KEYED_FRAGMENT */]: `KEYED_FRAGMENT`,\n [256 /* PatchFlags.UNKEYED_FRAGMENT */]: `UNKEYED_FRAGMENT`,\n [512 /* PatchFlags.NEED_PATCH */]: `NEED_PATCH`,\n [1024 /* PatchFlags.DYNAMIC_SLOTS */]: `DYNAMIC_SLOTS`,\n [2048 /* PatchFlags.DEV_ROOT_FRAGMENT */]: `DEV_ROOT_FRAGMENT`,\n [-1 /* PatchFlags.HOISTED */]: `HOISTED`,\n [-2 /* PatchFlags.BAIL */]: `BAIL`\n};\n\n/**\n * Dev only\n */\nconst slotFlagsText = {\n [1 /* SlotFlags.STABLE */]: 'STABLE',\n [2 /* SlotFlags.DYNAMIC */]: 'DYNAMIC',\n [3 /* SlotFlags.FORWARDED */]: 'FORWARDED'\n};\n\nconst GLOBALS_WHITE_LISTED = 'Infinity,undefined,NaN,isFinite,isNaN,parseFloat,parseInt,decodeURI,' +\n 'decodeURIComponent,encodeURI,encodeURIComponent,Math,Number,Date,Array,' +\n 'Object,Boolean,String,RegExp,Map,Set,JSON,Intl,BigInt';\nconst isGloballyWhitelisted = /*#__PURE__*/ makeMap(GLOBALS_WHITE_LISTED);\n\nconst range = 2;\nfunction generateCodeFrame(source, start = 0, end = source.length) {\n // Split the content into individual lines but capture the newline sequence\n // that separated each line. This is important because the actual sequence is\n // needed to properly take into account the full line length for offset\n // comparison\n let lines = source.split(/(\\r?\\n)/);\n // Separate the lines and newline sequences into separate arrays for easier referencing\n const newlineSequences = lines.filter((_, idx) => idx % 2 === 1);\n lines = lines.filter((_, idx) => idx % 2 === 0);\n let count = 0;\n const res = [];\n for (let i = 0; i < lines.length; i++) {\n count +=\n lines[i].length +\n ((newlineSequences[i] && newlineSequences[i].length) || 0);\n if (count >= start) {\n for (let j = i - range; j <= i + range || end > count; j++) {\n if (j < 0 || j >= lines.length)\n continue;\n const line = j + 1;\n res.push(`${line}${' '.repeat(Math.max(3 - String(line).length, 0))}| ${lines[j]}`);\n const lineLength = lines[j].length;\n const newLineSeqLength = (newlineSequences[j] && newlineSequences[j].length) || 0;\n if (j === i) {\n // push underline\n const pad = start - (count - (lineLength + newLineSeqLength));\n const length = Math.max(1, end > count ? lineLength - pad : end - start);\n res.push(` | ` + ' '.repeat(pad) + '^'.repeat(length));\n }\n else if (j > i) {\n if (end > count) {\n const length = Math.max(Math.min(end - count, lineLength), 1);\n res.push(` | ` + '^'.repeat(length));\n }\n count += lineLength + newLineSeqLength;\n }\n }\n break;\n }\n }\n return res.join('\\n');\n}\n\nfunction normalizeStyle(value) {\n if (isArray(value)) {\n const res = {};\n for (let i = 0; i < value.length; i++) {\n const item = value[i];\n const normalized = isString(item)\n ? parseStringStyle(item)\n : normalizeStyle(item);\n if (normalized) {\n for (const key in normalized) {\n res[key] = normalized[key];\n }\n }\n }\n return res;\n }\n else if (isString(value)) {\n return value;\n }\n else if (isObject(value)) {\n return value;\n }\n}\nconst listDelimiterRE = /;(?![^(]*\\))/g;\nconst propertyDelimiterRE = /:([^]+)/;\nconst styleCommentRE = /\\/\\*.*?\\*\\//gs;\nfunction parseStringStyle(cssText) {\n const ret = {};\n cssText\n .replace(styleCommentRE, '')\n .split(listDelimiterRE)\n .forEach(item => {\n if (item) {\n const tmp = item.split(propertyDelimiterRE);\n tmp.length > 1 && (ret[tmp[0].trim()] = tmp[1].trim());\n }\n });\n return ret;\n}\nfunction stringifyStyle(styles) {\n let ret = '';\n if (!styles || isString(styles)) {\n return ret;\n }\n for (const key in styles) {\n const value = styles[key];\n const normalizedKey = key.startsWith(`--`) ? key : hyphenate(key);\n if (isString(value) || typeof value === 'number') {\n // only render valid values\n ret += `${normalizedKey}:${value};`;\n }\n }\n return ret;\n}\nfunction normalizeClass(value) {\n let res = '';\n if (isString(value)) {\n res = value;\n }\n else if (isArray(value)) {\n for (let i = 0; i < value.length; i++) {\n const normalized = normalizeClass(value[i]);\n if (normalized) {\n res += normalized + ' ';\n }\n }\n }\n else if (isObject(value)) {\n for (const name in value) {\n if (value[name]) {\n res += name + ' ';\n }\n }\n }\n return res.trim();\n}\nfunction normalizeProps(props) {\n if (!props)\n return null;\n let { class: klass, style } = props;\n if (klass && !isString(klass)) {\n props.class = normalizeClass(klass);\n }\n if (style) {\n props.style = normalizeStyle(style);\n }\n return props;\n}\n\n// These tag configs are shared between compiler-dom and runtime-dom, so they\n// https://developer.mozilla.org/en-US/docs/Web/HTML/Element\nconst HTML_TAGS = 'html,body,base,head,link,meta,style,title,address,article,aside,footer,' +\n 'header,hgroup,h1,h2,h3,h4,h5,h6,nav,section,div,dd,dl,dt,figcaption,' +\n 'figure,picture,hr,img,li,main,ol,p,pre,ul,a,b,abbr,bdi,bdo,br,cite,code,' +\n 'data,dfn,em,i,kbd,mark,q,rp,rt,ruby,s,samp,small,span,strong,sub,sup,' +\n 'time,u,var,wbr,area,audio,map,track,video,embed,object,param,source,' +\n 'canvas,script,noscript,del,ins,caption,col,colgroup,table,thead,tbody,td,' +\n 'th,tr,button,datalist,fieldset,form,input,label,legend,meter,optgroup,' +\n 'option,output,progress,select,textarea,details,dialog,menu,' +\n 'summary,template,blockquote,iframe,tfoot';\n// https://developer.mozilla.org/en-US/docs/Web/SVG/Element\nconst SVG_TAGS = 'svg,animate,animateMotion,animateTransform,circle,clipPath,color-profile,' +\n 'defs,desc,discard,ellipse,feBlend,feColorMatrix,feComponentTransfer,' +\n 'feComposite,feConvolveMatrix,feDiffuseLighting,feDisplacementMap,' +\n 'feDistantLight,feDropShadow,feFlood,feFuncA,feFuncB,feFuncG,feFuncR,' +\n 'feGaussianBlur,feImage,feMerge,feMergeNode,feMorphology,feOffset,' +\n 'fePointLight,feSpecularLighting,feSpotLight,feTile,feTurbulence,filter,' +\n 'foreignObject,g,hatch,hatchpath,image,line,linearGradient,marker,mask,' +\n 'mesh,meshgradient,meshpatch,meshrow,metadata,mpath,path,pattern,' +\n 'polygon,polyline,radialGradient,rect,set,solidcolor,stop,switch,symbol,' +\n 'text,textPath,title,tspan,unknown,use,view';\nconst VOID_TAGS = 'area,base,br,col,embed,hr,img,input,link,meta,param,source,track,wbr';\n/**\n * Compiler only.\n * Do NOT use in runtime code paths unless behind `(process.env.NODE_ENV !== 'production')` flag.\n */\nconst isHTMLTag = /*#__PURE__*/ makeMap(HTML_TAGS);\n/**\n * Compiler only.\n * Do NOT use in runtime code paths unless behind `(process.env.NODE_ENV !== 'production')` flag.\n */\nconst isSVGTag = /*#__PURE__*/ makeMap(SVG_TAGS);\n/**\n * Compiler only.\n * Do NOT use in runtime code paths unless behind `(process.env.NODE_ENV !== 'production')` flag.\n */\nconst isVoidTag = /*#__PURE__*/ makeMap(VOID_TAGS);\n\n/**\n * On the client we only need to offer special cases for boolean attributes that\n * have different names from their corresponding dom properties:\n * - itemscope -> N/A\n * - allowfullscreen -> allowFullscreen\n * - formnovalidate -> formNoValidate\n * - ismap -> isMap\n * - nomodule -> noModule\n * - novalidate -> noValidate\n * - readonly -> readOnly\n */\nconst specialBooleanAttrs = `itemscope,allowfullscreen,formnovalidate,ismap,nomodule,novalidate,readonly`;\nconst isSpecialBooleanAttr = /*#__PURE__*/ makeMap(specialBooleanAttrs);\n/**\n * The full list is needed during SSR to produce the correct initial markup.\n */\nconst isBooleanAttr = /*#__PURE__*/ makeMap(specialBooleanAttrs +\n `,async,autofocus,autoplay,controls,default,defer,disabled,hidden,` +\n `loop,open,required,reversed,scoped,seamless,` +\n `checked,muted,multiple,selected`);\n/**\n * Boolean attributes should be included if the value is truthy or ''.\n * e.g. `