f?Q(e,o,l,!0,!1,p):P(t,s,r,o,l,i,c,u,p)},z=(e,t,s,r,o,l,i,c,u)=>{let a=0;const f=t.length;let p=e.length-1,d=f-1;for(;a<=p&&a<=d;){const n=e[a],r=t[a]=u?ar(t[a]):ur(t[a]);if(!tr(n,r))break;_(n,r,s,null,o,l,i,c,u),a++}for(;a<=p&&a<=d;){const n=e[p],r=t[d]=u?ar(t[d]):ur(t[d]);if(!tr(n,r))break;_(n,r,s,null,o,l,i,c,u),p--,d--}if(a>p){if(a<=d){const e=d+1,n=e!Vi(e)||e.type!==Di&&!(e.type===Ii&&!wo(e.children))))?e:null}const So=e=>e?pr(e)?yr(e):So(e.parent):null,xo=ee(Object.create(null),{$:e=>e,$el:e=>e.vnode.el,$data:e=>e.data,$props:e=>e.props,$attrs:e=>e.attrs,$slots:e=>e.slots,$refs:e=>e.refs,$parent:e=>So(e.parent),$root:e=>So(e.root),$emit:e=>e.emit,$options:e=>No(e),$forceUpdate:e=>e.f||(e.f=()=>{e.effect.dirty=!0,Dn(e.update)}),$nextTick:e=>e.n||(e.n=Pn.bind(e.proxy)),$watch:e=>wi.bind(e)}),ko=(e,t)=>e!==Z&&!e.__isScriptSetup&&oe(e,t),Co={get({_:e},t){if("__v_skip"===t)return!0;const{ctx:n,setupState:o,data:i,props:r,accessCache:s,type:a,appContext:l}=e;let c;if("$"!==t[0]){const a=s[t];if(void 0!==a)switch(a){case 1:return o[t];case 2:return i[t];case 4:return n[t];case 3:return r[t]}else{if(ko(o,t))return s[t]=1,o[t];if(i!==Z&&oe(i,t))return s[t]=2,i[t];if((c=e.propsOptions[0])&&oe(c,t))return s[t]=3,r[t];if(n!==Z&&oe(n,t))return s[t]=4,n[t];Eo&&(s[t]=0)}}const u=xo[t];let d,p;return u?("$attrs"===t&&pt(e.attrs,0,""),u(e)):(d=a.__cssModules)&&(d=d[t])?d:n!==Z&&oe(n,t)?(s[t]=4,n[t]):(p=l.config.globalProperties,oe(p,t)?p[t]:void 0)},set({_:e},t,n){const{data:o,setupState:i,ctx:r}=e;return ko(i,t)?(i[t]=n,!0):o!==Z&&oe(o,t)?(o[t]=n,!0):!oe(e.props,t)&&(("$"!==t[0]||!(t.slice(1)in e))&&(r[t]=n,!0))},has({_:{data:e,setupState:t,accessCache:n,ctx:o,appContext:i,propsOptions:r}},s){let a;return!!n[s]||e!==Z&&oe(e,s)||ko(t,s)||(a=r[0])&&oe(a,s)||oe(o,s)||oe(xo,s)||oe(i.config.globalProperties,s)},defineProperty(e,t,n){return null!=n.get?e._.accessCache[t]=0:oe(n,"value")&&this.set(e,t,n.value,null),Reflect.defineProperty(e,t,n)}};function Ao(e){return ie(e)?e.reduce(((e,t)=>(e[t]=null,e)),{}):e}let Eo=!0;function Oo(e){const t=No(e),n=e.proxy,o=e.ctx;Eo=!1,t.beforeCreate&&Lo(t.beforeCreate,e,"bc");const{data:i,computed:r,methods:s,watch:a,provide:l,inject:c,created:u,beforeMount:d,mounted:p,beforeUpdate:f,updated:h,activated:m,deactivated:g,beforeDestroy:v,beforeUnmount:y,destroyed:b,unmounted:_,render:w,renderTracked:S,renderTriggered:x,errorCaptured:k,serverPrefetch:C,expose:A,inheritAttrs:E,components:O,directives:L,filters:T}=t;if(c&&function(e,t){ie(e)&&(e=jo(e));for(const n in e){const o=e[n];let i;i=ue(o)?"default"in o?zo(o.from||n,o.default,!0):zo(o.from||n):zo(o),dn(i)?Object.defineProperty(t,n,{enumerable:!0,configurable:!0,get:()=>i.value,set:e=>i.value=e}):t[n]=i}}(c,o,null),s)for(const I in s){const e=s[I];ae(e)&&(o[I]=e.bind(n))}if(i){const t=i.call(n,n);ue(t)&&(e.data=Xt(t))}if(Eo=!0,r)for(const I in r){const e=r[I],t=ae(e)?e.bind(n,n):ae(e.get)?e.get.bind(n,n):X,i=!ae(e)&&ae(e.set)?e.set.bind(n):X,s=_r({get:t,set:i});Object.defineProperty(o,I,{enumerable:!0,configurable:!0,get:()=>s.value,set:e=>s.value=e})}if(a)for(const I in a)To(a[I],o,n,I);if(l){const e=ae(l)?l.call(n):l;Reflect.ownKeys(e).forEach((t=>{!function(e,t){if(sr){let n=sr.provides;const o=sr.parent&&sr.parent.provides;o===n&&(n=sr.provides=Object.create(o)),n[e]=t}else;}(t,e[t])}))}function N(e,t){ie(t)?t.forEach((t=>e(t.bind(n)))):t&&e(t.bind(n))}if(u&&Lo(u,e,"c"),N(no,d),N(oo,p),N(io,f),N(ro,h),N(Xn,m),N(Qn,g),N(po,k),N(uo,S),N(co,x),N(so,y),N(ao,_),N(lo,C),ie(A))if(A.length){const t=e.exposed||(e.exposed={});A.forEach((e=>{Object.defineProperty(t,e,{get:()=>n[e],set:t=>n[e]=t})}))}else e.exposed||(e.exposed={});w&&e.render===X&&(e.render=w),null!=E&&(e.inheritAttrs=E),O&&(e.components=O),L&&(e.directives=L)}function Lo(e,t,n){Sn(ie(e)?e.map((e=>e.bind(t.proxy))):e.bind(t.proxy),t,n)}function To(e,t,n,o){const i=o.includes(".")?Si(n,o):()=>n[o];if(le(e)){const n=t[e];ae(n)&&bi(i,n)}else if(ae(e))bi(i,e.bind(n));else if(ue(e))if(ie(e))e.forEach((e=>To(e,t,n,o)));else{const o=ae(e.handler)?e.handler.bind(n):t[e.handler];ae(o)&&bi(i,o,e)}}function No(e){const t=e.type,{mixins:n,extends:o}=t,{mixins:i,optionsCache:r,config:{optionMergeStrategies:s}}=e.appContext,a=r.get(t);let l;return a?l=a:i.length||n||o?(l={},i.length&&i.forEach((e=>Io(l,e,s,!0))),Io(l,t,s)):l=t,ue(t)&&r.set(t,l),l}function Io(e,t,n,o=!1){const{mixins:i,extends:r}=t;r&&Io(e,r,n,!0),i&&i.forEach((t=>Io(e,t,n,!0)));for(const s in t)if(o&&"expose"===s);else{const o=Po[s]||n&&n[s];e[s]=o?o(e[s],t[s]):t[s]}return e}const Po={data:Do,props:$o,emits:$o,methods:Ro,computed:Ro,beforeCreate:Mo,created:Mo,beforeMount:Mo,mounted:Mo,beforeUpdate:Mo,updated:Mo,beforeDestroy:Mo,beforeUnmount:Mo,destroyed:Mo,unmounted:Mo,activated:Mo,deactivated:Mo,errorCaptured:Mo,serverPrefetch:Mo,components:Ro,directives:Ro,watch:function(e,t){if(!e)return t;if(!t)return e;const n=ee(Object.create(null),e);for(const o in t)n[o]=Mo(e[o],t[o]);return n},provide:Do,inject:function(e,t){return Ro(jo(e),jo(t))}};function Do(e,t){return t?e?function(){return ee(ae(e)?e.call(this,this):e,ae(t)?t.call(this,this):t)}:t:e}function jo(e){if(ie(e)){const t={};for(let n=0;n
"),e.push(_("span",{innerHTML:s}))),n&&e.push(_("a",{href:n[0],textContent:n[0],target:"_blank"})),o=r}while(n);return e}addInfoEntry(e,t){return _("p",{parent:this.info},["string"==typeof e?_("label",{textContent:e+": "}):e,"string"==typeof t?_("span",{textContent:t}):t])}async getCivitaiDetails(){const e=await fetch("https://civitai.com/api/v1/model-versions/by-hash/"+this.hash);if(200===e.status)return await e.json();throw 404===e.status?new Error("Model not found"):new Error(`Error loading info (${e.status}) ${e.statusText}`)}addCivitaiInfo(){const e=this.getCivitaiDetails(),t=_("span",{textContent:"ℹ️ Loading..."});return this.addInfoEntry(_("label",[_("img",{style:{width:"18px",position:"relative",top:"3px",margin:"0 5px 0 0"},src:"https://civitai.com/favicon.ico"}),_("span",{textContent:"Civitai: "})]),t),e.then((e=>{var t,n;this.imgWrapper.style.display="block";let o=this.element.querySelector(".easyuse-model-header");o&&o.replaceChildren(_("h2",{textContent:this.name}),_("div.easyuse-model-header-remark",[_("h5",{textContent:V("Updated At:")+O(new Date(e.updatedAt),"yyyy/MM/dd")}),_("h5",{textContent:V("Created At:")+O(new Date(e.updatedAt),"yyyy/MM/dd")})]));let i=null,r=this.parseNote.call(this),s=V("✏️ Edit"),a=_("div.easyuse-model-detail-textarea",[_("p",(null==r?void 0:r.length)>0?r:{textContent:V("No notes")})]);if(r&&0!=r.length?a.classList.remove("empty"):a.classList.add("empty"),this.info.replaceChildren(_("div.easyuse-model-detail",[_("div.easyuse-model-detail-head.flex-b",[_("span",V("Notes")),_("a",{textContent:s,href:"#",style:{fontSize:"12px",float:"right",color:"var(--warning-color)",textDecoration:"none"},onclick:async e=>{if(e.preventDefault(),i){if(i.value!=this.customNotes){toast.showLoading(V("Saving Notes...")),this.customNotes=i.value;const e=await b.fetchApi("/easyuse/metadata/notes/"+encodeURIComponent(`${this.type}/${this.name}`),{method:"POST",body:this.customNotes});if(toast.hideLoading(),200!==e.status)return toast.error(V("Saving Failed")),void alert(`Error saving notes (${e.status}) ${e.statusText}`);toast.success(V("Saving Succeed")),r=this.parseNote.call(this),a.replaceChildren(_("p",(null==r?void 0:r.length)>0?r:{textContent:V("No notes")})),i.value?a.classList.remove("empty"):a.classList.add("empty")}else a.replaceChildren(_("p",{textContent:V("No notes")})),a.classList.add("empty");e.target.textContent=s,i.remove(),i=null}else e.target.textContent="💾 Save",i=_("textarea",{placeholder:V("Type your notes here"),style:{width:"100%",minWidth:"200px",minHeight:"50px",height:"100px"},textContent:this.customNotes}),a.replaceChildren(i),i.focus()}})]),a]),_("div.easyuse-model-detail",[_("div.easyuse-model-detail-head",{textContent:V("Details")}),_("div.easyuse-model-detail-body",[_("div.easyuse-model-detail-item",[_("div.easyuse-model-detail-item-label",{textContent:V("Type")}),_("div.easyuse-model-detail-item-value",{textContent:e.model.type})]),_("div.easyuse-model-detail-item",[_("div.easyuse-model-detail-item-label",{textContent:V("BaseModel")}),_("div.easyuse-model-detail-item-value",{textContent:e.baseModel})]),_("div.easyuse-model-detail-item",[_("div.easyuse-model-detail-item-label",{textContent:V("Download")}),_("div.easyuse-model-detail-item-value",{textContent:(null==(t=e.stats)?void 0:t.downloadCount)||0})]),_("div.easyuse-model-detail-item",[_("div.easyuse-model-detail-item-label",{textContent:V("Trained Words")}),_("div.easyuse-model-detail-item-value",{textContent:(null==e?void 0:e.trainedWords.join(","))||"-"})]),_("div.easyuse-model-detail-item",[_("div.easyuse-model-detail-item-label",{textContent:V("Source")}),_("div.easyuse-model-detail-item-value",[_("label",[_("img",{style:{width:"14px",position:"relative",top:"3px",margin:"0 5px 0 0"},src:"https://civitai.com/favicon.ico"}),_("a",{href:"https://civitai.com/models/"+e.modelId,textContent:"View "+e.model.name,target:"_blank"})])])])])])),null==(n=e.images)?void 0:n.length){this.imgCurrent=0,this.isSaving=!1,e.images.map((e=>e.url&&this.imgList.appendChild(_("div.easyuse-preview-slide",[_("div.easyuse-preview-slide-content",[_("img",{src:e.url}),_("div.save",{textContent:"Save as preview",onclick:async()=>{if(this.isSaving)return;this.isSaving=!0,toast.showLoading(V("Saving Preview..."));const t=await(await fetch(e.url)).blob(),n="temp_preview."+new URL(e.url).pathname.split(".")[1],o=new FormData;o.append("image",new File([t],n)),o.append("overwrite","true"),o.append("type","temp");if(200!==(await b.fetchApi("/upload/image",{method:"POST",body:o})).status)return this.isSaving=!1,toast.error(V("Saving Failed")),toast.hideLoading(),void alert(`Error saving preview (${req.status}) ${req.statusText}`);await b.fetchApi("/easyuse/save/"+encodeURIComponent(`${this.type}/${this.name}`),{method:"POST",body:JSON.stringify({filename:n,type:"temp"}),headers:{"content-type":"application/json"}}).then((e=>{toast.success(V("Saving Succeed")),toast.hideLoading()})),this.isSaving=!1,app.refreshComboInNodes()}})])]))));let t=this;this.imgDistance=(-660*this.imgCurrent).toString(),this.imgList.style.display="",this.imgList.style.transform="translate3d("+this.imgDistance+"px, 0px, 0px)",this.slides=this.imgList.querySelectorAll(".easyuse-preview-slide"),this.slideLeftButton=_("button.left",{parent:this.imgWrapper,style:{display:e.images.length<=2?"none":"block"},innerHTML:'',onclick:()=>{e.images.length<=2||(t.imgList.classList.remove("no-transition"),0==t.imgCurrent?(t.imgCurrent=e.images.length/2-1,this.slides[this.slides.length-1].style.transform="translate3d("+(-660*(this.imgCurrent+1)).toString()+"px, 0px, 0px)",this.slides[this.slides.length-2].style.transform="translate3d("+(-660*(this.imgCurrent+1)).toString()+"px, 0px, 0px)",t.imgList.style.transform="translate3d(660px, 0px, 0px)",setTimeout((e=>{this.slides[this.slides.length-1].style.transform="translate3d(0px, 0px, 0px)",this.slides[this.slides.length-2].style.transform="translate3d(0px, 0px, 0px)",t.imgDistance=(-660*this.imgCurrent).toString(),t.imgList.style.transform="translate3d("+t.imgDistance+"px, 0px, 0px)",t.imgList.classList.add("no-transition")}),500)):(t.imgCurrent=t.imgCurrent-1,t.imgDistance=(-660*this.imgCurrent).toString(),t.imgList.style.transform="translate3d("+t.imgDistance+"px, 0px, 0px)"))}}),this.slideRightButton=_("button.right",{parent:this.imgWrapper,style:{display:e.images.length<=2?"none":"block"},innerHTML:'',onclick:()=>{if(!(e.images.length<=2))if(t.imgList.classList.remove("no-transition"),t.imgCurrent>=e.images.length/2-1){t.imgCurrent=0;const n=e.images.length/2;this.slides[0].style.transform="translate3d("+(660*n).toString()+"px, 0px, 0px)",this.slides[1].style.transform="translate3d("+(660*n).toString()+"px, 0px, 0px)",t.imgList.style.transform="translate3d("+(-660*n).toString()+"px, 0px, 0px)",setTimeout((e=>{this.slides[0].style.transform="translate3d(0px, 0px, 0px)",this.slides[1].style.transform="translate3d(0px, 0px, 0px)",t.imgDistance=(-660*this.imgCurrent).toString(),t.imgList.style.transform="translate3d("+t.imgDistance+"px, 0px, 0px)",t.imgList.classList.add("no-transition")}),500)}else t.imgCurrent=t.imgCurrent+1,t.imgDistance=(-660*this.imgCurrent).toString(),t.imgList.style.transform="translate3d("+t.imgDistance+"px, 0px, 0px)"}})}return e.description&&_("div",{parent:this.content,innerHTML:e.description,style:{marginTop:"10px"}}),e})).catch((e=>{this.imgWrapper.style.display="none",t.textContent="⚠️ "+e.message})).finally((e=>{}))}}class nf extends tf{async addInfo(){await this.addCivitaiInfo()}}class of extends tf{getTagFrequency(){if(!this.metadata.ss_tag_frequency)return[];const e=JSON.parse(this.metadata.ss_tag_frequency),t={};for(const n in e){const o=e[n];for(const e in o)e in t?t[e]+=o[e]:t[e]=o[e]}return Object.entries(t).sort(((e,t)=>t[1]-e[1]))}getResolutions(){let e=[];if(this.metadata.ss_bucket_info){const t=JSON.parse(this.metadata.ss_bucket_info);if(null==t?void 0:t.buckets)for(const{resolution:n,count:o}of Object.values(t.buckets))e.push([o,`${n.join("x")} * ${o}`])}e=e.sort(((e,t)=>t[0]-e[0])).map((e=>e[1]));let t=this.metadata.ss_resolution;if(t){const n=t.split(","),o=n[0].replace("(",""),i=n[1].replace(")","");e.push(`${o.trim()}x${i.trim()} (Base res)`)}else(t=this.metadata["modelspec.resolution"])&&e.push(t+" (Base res");return e.length||e.push("⚠️ Unknown"),e}getTagList(e){return e.map((e=>_("li.easyuse-model-tag",{dataset:{tag:e[0]},$:e=>{e.onclick=()=>{e.classList.toggle("easyuse-model-tag--selected")}}},[_("p",{textContent:e[0]}),_("span",{textContent:e[1]})])))}addTags(){let e,t=this.getTagFrequency();if(null==t?void 0:t.length){const n=t.length;let o;n>500&&(t=t.slice(0,500),e=_("p",[_("span",{textContent:"⚠️ Only showing first 500 tags "}),_("a",{href:"#",textContent:`Show all ${n}`,onclick:()=>{o.replaceChildren(...this.getTagList(this.getTagFrequency())),e.remove()}})])),o=_("ol.easyuse-model-tags-list",this.getTagList(t)),this.tags=_("div",[o])}else this.tags=_("p",{textContent:"⚠️ No tag frequency metadata found"});this.content.append(this.tags),e&&this.content.append(e)}async addInfo(){const e=this.addCivitaiInfo();this.addTags();const t=await e;t&&_("div",{parent:this.content,innerHTML:t.description,style:{maxHeight:"250px",overflow:"auto"}})}createButtons(){const e=super.createButtons();function t(e,t){const n=_("textarea",{parent:document.body,style:{position:"fixed"},textContent:t.map((e=>e.dataset.tag)).join(", ")});n.select();try{document.execCommand("copy"),e.target.dataset.text||(e.target.dataset.text=e.target.textContent),e.target.textContent="Copied "+t.length+" tags",setTimeout((()=>{e.target.textContent=e.target.dataset.text}),1e3)}catch(o){prompt("Copy to clipboard: Ctrl+C, Enter",text)}finally{document.body.removeChild(n)}}return e.unshift(_("button",{type:"button",textContent:"Copy Selected",onclick:e=>{t(e,[...this.tags.querySelectorAll(".easyuse-model-tag--selected")])}}),_("button",{type:"button",textContent:"Copy All",onclick:e=>{t(e,[...this.tags.querySelectorAll(".easyuse-model-tag")])}})),e}}const rf=["easy fullLoader","easy a1111Loader","easy comfyLoader","easy kolorsLoader","easy hunyuanDiTLoader","easy pixArtLoader"],sf=["easy preSampling","easy preSamplingAdvanced","easy preSamplingDynamicCFG","easy preSamplingNoiseIn","easy preSamplingCustom","easy preSamplingLayerDiffusion","easy fullkSampler"],af=["KSamplerSelect","SamplerEulerAncestral","SamplerEulerAncestralCFG++","SamplerLMS","SamplerDPMPP_3M_SDE","SamplerDPMPP_2M_SDE","SamplerDPMPP_SDE","SamplerDPMAdaptative","SamplerLCMUpscale","SamplerTCD","SamplerTCD EulerA"],lf=["BasicScheduler","KarrasScheduler","ExponentialScheduler","PolyexponentialScheduler","VPScheduler","BetaSamplingScheduler","SDTurboScheduler","SplitSigmas","SplitSigmasDenoise","FlipSigmas","AlignYourStepsScheduler","GITSScheduler"],cf=["easy kSampler","easy kSamplerTiled","easy kSamplerInpainting","easy kSamplerDownscaleUnet","easy kSamplerLayerDiffusion"],uf=["easy controlnetLoader","easy controlnetLoaderADV","easy controlnetLoader++","easy instantIDApply","easy instantIDApplyADV"],df=["easy ipadapterApply","easy ipadapterApplyADV","easy ipadapterApplyFaceIDKolors","easy ipadapterStyleComposition","easy ipadapterApplyFromParams","easy pulIDApply","easy pulIDApplyADV"],pf=["easy positive","easy wildcards"],ff=["easy loadImageBase64","LoadImage","LoadImageMask"],hf=["easy applyBrushNet","easy applyPowerPaint","easy applyInpaint"],mf={positive_prompt:{text:"positive",positive:"text"},loaders:{ckpt_name:"ckpt_name",vae_name:"vae_name",clip_skip:"clip_skip",lora_name:"lora_name",resolution:"resolution",empty_latent_width:"empty_latent_width",empty_latent_height:"empty_latent_height",positive:"positive",negative:"negative",batch_size:"batch_size",a1111_prompt_style:"a1111_prompt_style"},preSampling:{steps:"steps",cfg:"cfg",cfg_scale_min:"cfg",sampler_name:"sampler_name",scheduler:"scheduler",denoise:"denoise",seed_num:"seed_num",seed:"seed"},kSampler:{image_output:"image_output",save_prefix:"save_prefix",link_id:"link_id"},controlnet:{control_net_name:"control_net_name",strength:["strength","cn_strength"],scale_soft_weights:["scale_soft_weights","cn_soft_weights"],cn_strength:["strength","cn_strength"],cn_soft_weights:["scale_soft_weights","cn_soft_weights"]},ipadapter:{preset:"preset",lora_strength:"lora_strength",provider:"provider",weight:"weight",weight_faceidv2:"weight_faceidv2",start_at:"start_at",end_at:"end_at",cache_mode:"cache_mode",use_tiled:"use_tiled",insightface:"insightface",pulid_file:"pulid_file"},load_image:{image:"image",base64_data:"base64_data",channel:"channel"},inpaint:{dtype:"dtype",fitting:"fitting",function:"function",scale:"scale",start_at:"start_at",end_at:"end_at"},sampler:{},sigmas:{}},gf={loaders:{optional_lora_stack:"optional_lora_stack",positive:"positive",negative:"negative"},preSampling:{pipe:"pipe",image_to_latent:"image_to_latent",latent:"latent"},kSampler:{pipe:"pipe",model:"model"},controlnet:{pipe:"pipe",image:"image",image_kps:"image_kps",control_net:"control_net",positive:"positive",negative:"negative",mask:"mask"},positive_prompt:{},ipadapter:{model:"model",image:"image",image_style:"image",attn_mask:"attn_mask",optional_ipadapter:"optional_ipadapter"},inpaint:{pipe:"pipe",image:"image",mask:"mask"},sampler:{},sigmas:{}},vf={loaders:{pipe:"pipe",model:"model",vae:"vae",clip:null,positive:null,negative:null,latent:null},preSampling:{pipe:"pipe"},kSampler:{pipe:"pipe",image:"image"},controlnet:{pipe:"pipe",positive:"positive",negative:"negative"},positive_prompt:{text:"positive",positive:"text"},load_image:{IMAGE:"IMAGE",MASK:"MASK"},ipadapter:{model:"model",tiles:"tiles",masks:"masks",ipadapter:"ipadapter"},inpaint:{pipe:"pipe"},sampler:{SAMPLER:"SAMPLER"},sigmas:{SIGMAS:"SIGMAS"}};function yf(e,t,n){return function(){!function(e,t,n){const o=LiteGraph.createNode(t);if(o){if(y.graph.add(o),o.pos=e.pos.slice(),o.size=e.size.slice(),e.widgets.forEach((e=>{if(mf[n][e.name]){const i=mf[n][e.name];if(i){const n=(t=i,o.widgets.find((e=>"object"==typeof t?t.includes(e.name):e.name===t)));n&&(n.value=e.value,"seed_num"==e.name&&(n.linkedWidgets[0].value=e.linkedWidgets[0].value),"converted-widget"==e.type&&Cf(o,n,e))}}var t})),e.inputs&&e.inputs.forEach(((t,i)=>{if(t&&t.link&&gf[n][t.name]){const i=gf[n][t.name];if(null===i)return;const r=o.findInputSlot(i);if(-1!==r){const n=e.graph.links[t.link];if(n){const t=e.graph.getNodeById(n.origin_id);t&&t.connect(n.origin_slot,o,r)}}}})),e.outputs&&e.outputs.forEach(((t,i)=>{if(t&&t.links&&vf[n]&&vf[n][t.name]){const i=vf[n][t.name];if(null===i)return;const r=o.findOutputSlot(i);-1!==r&&t.links.forEach((t=>{const n=e.graph.links[t];if(n){const t=e.graph.getNodeById(n.target_id);t&&o.connect(r,t,n.target_slot)}}))}})),y.graph.remove(e),"easy fullkSampler"==o.type){const e=o.outputs[0].links;if(e&&e[0]){const t=y.graph._nodes.find((t=>t.inputs&&t.inputs[0]&&t.inputs[0].link==e[0]));t&&y.graph.remove(t)}}else if(sf.includes(o.type)){const e=o.outputs[0].links;if(!e||!e[0]){const e=LiteGraph.createNode("easy kSampler");y.graph.add(e),e.pos=o.pos.slice(),e.pos[0]=e.pos[0]+o.size[0]+20;const t=o.findInputSlot("pipe");-1!==t&&o&&o.connect(0,e,t)}}o.setSize([o.size[0],o.computeSize()[1]])}}(e,t,n)}}const bf=(e,t)=>{const n=e.prototype.getExtraMenuOptions;e.prototype.getExtraMenuOptions=function(){const e=n.apply(this,arguments);return t.apply(this,arguments),e}},_f=(e,t,n,o,i=!0)=>{bf(o,(function(o,r){r.unshift({content:e,has_submenu:i,callback:(e,o,i,r,s)=>wf(e,o,i,r,s,t,n)}),"loaders"==t&&(r.unshift({content:V("💎 View Lora Info..."),callback:(e,t,n,o,i)=>{let r=i.widgets.find((e=>"lora_name"==e.name)).value;r&&"None"!=r&&new of(r).show("loras",r)}}),r.unshift({content:V("💎 View Checkpoint Info..."),callback:(e,t,n,o,i)=>{let r=i.widgets[0].value;r&&"None"!=r&&new nf(r).show("checkpoints",r)}}))}))},wf=(e,t,n,o,i,r,s)=>{const a=[];return s.map((e=>{i.type!==e&&a.push({content:`${e}`,callback:yf(i,e,r)})})),new LiteGraph.ContextMenu(a,{event:n,callback:null,parentMenu:o,node:i}),!1},Sf="converted-widget",xf=Symbol();function kf(e,t,n=""){if(t.origType=t.type,t.origComputeSize=t.computeSize,t.origSerializeValue=t.serializeValue,t.computeSize=()=>[0,-4],t.type=Sf+n,t.serializeValue=()=>{if(!e.inputs)return;let n=e.inputs.find((e=>{var n;return(null==(n=e.widget)?void 0:n.name)===t.name}));return n&&n.link?t.origSerializeValue?t.origSerializeValue():t.value:void 0},t.linkedWidgets)for(const o of t.linkedWidgets)kf(e,o,":"+t.name)}function Cf(e,t,n){kf(e,t);const{type:o}=function(e){let t=e[0];t instanceof Array&&(t="COMBO");return{type:t}}(n),i=e.size;t.options&&t.options.forceInput||e.addInput(t.name,o,{widget:{name:t.name,[xf]:()=>n}});for(const r of e.widgets)r.last_y+=LiteGraph.NODE_SLOT_HEIGHT;e.setSize([Math.max(i[0],e.size[0]),Math.max(i[1],e.size[1])])}const Af=function(e){var t,n,o,i;const r=e.constructor.type,s=e.properties.origVals||{},a=s.title||e.title,l=s.color||e.color,c=s.bgcolor||e.bgcolor,u=e,d={size:[...e.size],color:l,bgcolor:c,pos:[...e.pos]};let p=[],f=[];if(e.inputs)for(const y of e.inputs)if(y.link){const t=y.name,n=e.findInputSlot(t),o=e.getInputNode(n),i=e.getInputLink(n);p.push([i.origin_slot,o,t])}if(e.outputs)for(const y of e.outputs)if(y.links){const e=y.name;for(const t of y.links){const n=graph.links[t],o=graph._nodes_by_id[n.target_id];f.push([e,o,n.target_slot])}}y.graph.remove(e);const h=y.graph.add(LiteGraph.createNode(r,a,d));function m(){if(u.widgets)for(let e of u.widgets)if("converted-widget"===e.type){const t=h.widgets.find((t=>t.name===e.name));for(let n of u.inputs)n.name===e.name&&Cf(h,t,n.widget)}for(let e of p){const[t,n,o]=e;n.connect(t,h.id,o)}for(let e of f){const[t,n,o]=e;h.connect(t,n,o)}}let g=u.widgets_values;if(!g&&(null==(t=h.widgets)?void 0:t.length)>0)return h.widgets.forEach(((e,t)=>{const n=u.widgets[t];e.name===n.name&&e.type===n.type&&(e.value=n.value)})),void m();const v=(null==g?void 0:g.length)<=(null==(n=h.widgets)?void 0:n.length);let b=v?0:g.length-1;function _(e,t){var n,o,i,r,s,a;if(!0===e||!1===e){if((null==(n=t.options)?void 0:n.on)&&(null==(o=t.options)?void 0:o.off))return{value:e,pass:!0}}else if("number"==typeof e){if((null==(i=t.options)?void 0:i.min)<=e&&e<=(null==(r=t.options)?void 0:r.max))return{value:e,pass:!0}}else{if(null==(a=null==(s=t.options)?void 0:s.values)?void 0:a.includes(e))return{value:e,pass:!0};if(t.inputEl&&"string"==typeof e)return{value:e,pass:!0}}return{value:t.value,pass:!1}}const w=e=>{var t;const n=u.widgets[e];let o=h.widgets[e];if(o.name===n.name&&o.type===n.type){for(;v?b
"),e.push(te("span",{innerHTML:a}))),s&&e.push(te("a",{href:s[0],textContent:s[0],target:"_blank"})),o=i}while(s);return e}addInfoEntry(e,t){return te("p",{parent:this.info},["string"==typeof e?te("label",{textContent:e+": "}):e,"string"==typeof t?te("span",{textContent:t}):t])}async getCivitaiDetails(){const e=await fetch("https://civitai.com/api/v1/model-versions/by-hash/"+this.hash);if(200===e.status)return await e.json();throw 404===e.status?new Error("Model not found"):new Error(`Error loading info (${e.status}) ${e.statusText}`)}addCivitaiInfo(){const e=this.getCivitaiDetails(),t=te("span",{textContent:"ℹ️ Loading..."});return this.addInfoEntry(te("label",[te("img",{style:{width:"18px",position:"relative",top:"3px",margin:"0 5px 0 0"},src:"https://civitai.com/favicon.ico"}),te("span",{textContent:"Civitai: "})]),t),e.then((e=>{var t,s;this.imgWrapper.style.display="block";let o=this.element.querySelector(".easyuse-model-header");o&&o.replaceChildren(te("h2",{textContent:this.name}),te("div.easyuse-model-header-remark",[te("h5",{textContent:Ce("Updated At:")+de(new Date(e.updatedAt),"yyyy/MM/dd")}),te("h5",{textContent:Ce("Created At:")+de(new Date(e.updatedAt),"yyyy/MM/dd")})]));let n=null,i=this.parseNote.call(this),a=Ce("✏️ Edit"),l=te("div.easyuse-model-detail-textarea",[te("p",(null==i?void 0:i.length)>0?i:{textContent:Ce("No notes")})]);if(i&&0!=i.length?l.classList.remove("empty"):l.classList.add("empty"),this.info.replaceChildren(te("div.easyuse-model-detail",[te("div.easyuse-model-detail-head.flex-b",[te("span",Ce("Notes")),te("a",{textContent:a,href:"#",style:{fontSize:"12px",float:"right",color:"var(--warning-color)",textDecoration:"none"},onclick:async e=>{if(e.preventDefault(),n){if(n.value!=this.customNotes){toast.showLoading(Ce("Saving Notes...")),this.customNotes=n.value;const e=await ee.fetchApi("/easyuse/metadata/notes/"+encodeURIComponent(`${this.type}/${this.name}`),{method:"POST",body:this.customNotes});if(toast.hideLoading(),200!==e.status)return toast.error(Ce("Saving Failed")),void alert(`Error saving notes (${e.status}) ${e.statusText}`);toast.success(Ce("Saving Succeed")),i=this.parseNote.call(this),l.replaceChildren(te("p",(null==i?void 0:i.length)>0?i:{textContent:Ce("No notes")})),n.value?l.classList.remove("empty"):l.classList.add("empty")}else l.replaceChildren(te("p",{textContent:Ce("No notes")})),l.classList.add("empty");e.target.textContent=a,n.remove(),n=null}else e.target.textContent="💾 Save",n=te("textarea",{placeholder:Ce("Type your notes here"),style:{width:"100%",minWidth:"200px",minHeight:"50px",height:"100px"},textContent:this.customNotes}),l.replaceChildren(n),n.focus()}})]),l]),te("div.easyuse-model-detail",[te("div.easyuse-model-detail-head",{textContent:Ce("Details")}),te("div.easyuse-model-detail-body",[te("div.easyuse-model-detail-item",[te("div.easyuse-model-detail-item-label",{textContent:Ce("Type")}),te("div.easyuse-model-detail-item-value",{textContent:e.model.type})]),te("div.easyuse-model-detail-item",[te("div.easyuse-model-detail-item-label",{textContent:Ce("BaseModel")}),te("div.easyuse-model-detail-item-value",{textContent:e.baseModel})]),te("div.easyuse-model-detail-item",[te("div.easyuse-model-detail-item-label",{textContent:Ce("Download")}),te("div.easyuse-model-detail-item-value",{textContent:(null==(t=e.stats)?void 0:t.downloadCount)||0})]),te("div.easyuse-model-detail-item",[te("div.easyuse-model-detail-item-label",{textContent:Ce("Trained Words")}),te("div.easyuse-model-detail-item-value",{textContent:(null==e?void 0:e.trainedWords.join(","))||"-"})]),te("div.easyuse-model-detail-item",[te("div.easyuse-model-detail-item-label",{textContent:Ce("Source")}),te("div.easyuse-model-detail-item-value",[te("label",[te("img",{style:{width:"14px",position:"relative",top:"3px",margin:"0 5px 0 0"},src:"https://civitai.com/favicon.ico"}),te("a",{href:"https://civitai.com/models/"+e.modelId,textContent:"View "+e.model.name,target:"_blank"})])])])])])),null==(s=e.images)?void 0:s.length){this.imgCurrent=0,this.isSaving=!1,e.images.map((e=>e.url&&this.imgList.appendChild(te("div.easyuse-preview-slide",[te("div.easyuse-preview-slide-content",[te("img",{src:e.url}),te("div.save",{textContent:"Save as preview",onclick:async()=>{if(this.isSaving)return;this.isSaving=!0,toast.showLoading(Ce("Saving Preview..."));const t=await(await fetch(e.url)).blob(),s="temp_preview."+new URL(e.url).pathname.split(".")[1],o=new FormData;o.append("image",new File([t],s)),o.append("overwrite","true"),o.append("type","temp");if(200!==(await ee.fetchApi("/upload/image",{method:"POST",body:o})).status)return this.isSaving=!1,toast.error(Ce("Saving Failed")),toast.hideLoading(),void alert(`Error saving preview (${req.status}) ${req.statusText}`);await ee.fetchApi("/easyuse/save/"+encodeURIComponent(`${this.type}/${this.name}`),{method:"POST",body:JSON.stringify({filename:s,type:"temp"}),headers:{"content-type":"application/json"}}).then((e=>{toast.success(Ce("Saving Succeed")),toast.hideLoading()})),this.isSaving=!1,app.refreshComboInNodes()}})])]))));let t=this;this.imgDistance=(-660*this.imgCurrent).toString(),this.imgList.style.display="",this.imgList.style.transform="translate3d("+this.imgDistance+"px, 0px, 0px)",this.slides=this.imgList.querySelectorAll(".easyuse-preview-slide"),this.slideLeftButton=te("button.left",{parent:this.imgWrapper,style:{display:e.images.length<=2?"none":"block"},innerHTML:'',onclick:()=>{e.images.length<=2||(t.imgList.classList.remove("no-transition"),0==t.imgCurrent?(t.imgCurrent=e.images.length/2-1,this.slides[this.slides.length-1].style.transform="translate3d("+(-660*(this.imgCurrent+1)).toString()+"px, 0px, 0px)",this.slides[this.slides.length-2].style.transform="translate3d("+(-660*(this.imgCurrent+1)).toString()+"px, 0px, 0px)",t.imgList.style.transform="translate3d(660px, 0px, 0px)",setTimeout((e=>{this.slides[this.slides.length-1].style.transform="translate3d(0px, 0px, 0px)",this.slides[this.slides.length-2].style.transform="translate3d(0px, 0px, 0px)",t.imgDistance=(-660*this.imgCurrent).toString(),t.imgList.style.transform="translate3d("+t.imgDistance+"px, 0px, 0px)",t.imgList.classList.add("no-transition")}),500)):(t.imgCurrent=t.imgCurrent-1,t.imgDistance=(-660*this.imgCurrent).toString(),t.imgList.style.transform="translate3d("+t.imgDistance+"px, 0px, 0px)"))}}),this.slideRightButton=te("button.right",{parent:this.imgWrapper,style:{display:e.images.length<=2?"none":"block"},innerHTML:'',onclick:()=>{if(!(e.images.length<=2))if(t.imgList.classList.remove("no-transition"),t.imgCurrent>=e.images.length/2-1){t.imgCurrent=0;const s=e.images.length/2;this.slides[0].style.transform="translate3d("+(660*s).toString()+"px, 0px, 0px)",this.slides[1].style.transform="translate3d("+(660*s).toString()+"px, 0px, 0px)",t.imgList.style.transform="translate3d("+(-660*s).toString()+"px, 0px, 0px)",setTimeout((e=>{this.slides[0].style.transform="translate3d(0px, 0px, 0px)",this.slides[1].style.transform="translate3d(0px, 0px, 0px)",t.imgDistance=(-660*this.imgCurrent).toString(),t.imgList.style.transform="translate3d("+t.imgDistance+"px, 0px, 0px)",t.imgList.classList.add("no-transition")}),500)}else t.imgCurrent=t.imgCurrent+1,t.imgDistance=(-660*this.imgCurrent).toString(),t.imgList.style.transform="translate3d("+t.imgDistance+"px, 0px, 0px)"}})}return e.description&&te("div",{parent:this.content,innerHTML:e.description,style:{marginTop:"10px"}}),e})).catch((e=>{this.imgWrapper.style.display="none",t.textContent="⚠️ "+e.message})).finally((e=>{}))}}class It extends xt{async addInfo(){await this.addCivitaiInfo()}}class Nt extends xt{getTagFrequency(){if(!this.metadata.ss_tag_frequency)return[];const e=JSON.parse(this.metadata.ss_tag_frequency),t={};for(const s in e){const o=e[s];for(const e in o)e in t?t[e]+=o[e]:t[e]=o[e]}return Object.entries(t).sort(((e,t)=>t[1]-e[1]))}getResolutions(){let e=[];if(this.metadata.ss_bucket_info){const t=JSON.parse(this.metadata.ss_bucket_info);if(null==t?void 0:t.buckets)for(const{resolution:s,count:o}of Object.values(t.buckets))e.push([o,`${s.join("x")} * ${o}`])}e=e.sort(((e,t)=>t[0]-e[0])).map((e=>e[1]));let t=this.metadata.ss_resolution;if(t){const s=t.split(","),o=s[0].replace("(",""),n=s[1].replace(")","");e.push(`${o.trim()}x${n.trim()} (Base res)`)}else(t=this.metadata["modelspec.resolution"])&&e.push(t+" (Base res");return e.length||e.push("⚠️ Unknown"),e}getTagList(e){return e.map((e=>te("li.easyuse-model-tag",{dataset:{tag:e[0]},$:e=>{e.onclick=()=>{e.classList.toggle("easyuse-model-tag--selected")}}},[te("p",{textContent:e[0]}),te("span",{textContent:e[1]})])))}addTags(){let e,t=this.getTagFrequency();if(null==t?void 0:t.length){const s=t.length;let o;s>500&&(t=t.slice(0,500),e=te("p",[te("span",{textContent:"⚠️ Only showing first 500 tags "}),te("a",{href:"#",textContent:`Show all ${s}`,onclick:()=>{o.replaceChildren(...this.getTagList(this.getTagFrequency())),e.remove()}})])),o=te("ol.easyuse-model-tags-list",this.getTagList(t)),this.tags=te("div",[o])}else this.tags=te("p",{textContent:"⚠️ No tag frequency metadata found"});this.content.append(this.tags),e&&this.content.append(e)}async addInfo(){const e=this.addCivitaiInfo();this.addTags();const t=await e;t&&te("div",{parent:this.content,innerHTML:t.description,style:{maxHeight:"250px",overflow:"auto"}})}createButtons(){const e=super.createButtons();function t(e,t){const s=te("textarea",{parent:document.body,style:{position:"fixed"},textContent:t.map((e=>e.dataset.tag)).join(", ")});s.select();try{document.execCommand("copy"),e.target.dataset.text||(e.target.dataset.text=e.target.textContent),e.target.textContent="Copied "+t.length+" tags",setTimeout((()=>{e.target.textContent=e.target.dataset.text}),1e3)}catch(o){prompt("Copy to clipboard: Ctrl+C, Enter",text)}finally{document.body.removeChild(s)}}return e.unshift(te("button",{type:"button",textContent:"Copy Selected",onclick:e=>{t(e,[...this.tags.querySelectorAll(".easyuse-model-tag--selected")])}}),te("button",{type:"button",textContent:"Copy All",onclick:e=>{t(e,[...this.tags.querySelectorAll(".easyuse-model-tag")])}})),e}}const Tt=["easy fullLoader","easy a1111Loader","easy comfyLoader","easy kolorsLoader","easy hunyuanDiTLoader","easy pixArtLoader"],Ot=["easy preSampling","easy preSamplingAdvanced","easy preSamplingDynamicCFG","easy preSamplingNoiseIn","easy preSamplingCustom","easy preSamplingLayerDiffusion","easy fullkSampler"],Dt=["KSamplerSelect","SamplerEulerAncestral","SamplerEulerAncestralCFG++","SamplerLMS","SamplerDPMPP_3M_SDE","SamplerDPMPP_2M_SDE","SamplerDPMPP_SDE","SamplerDPMAdaptative","SamplerLCMUpscale","SamplerTCD","SamplerTCD EulerA"],Rt=["BasicScheduler","KarrasScheduler","ExponentialScheduler","PolyexponentialScheduler","VPScheduler","BetaSamplingScheduler","SDTurboScheduler","SplitSigmas","SplitSigmasDenoise","FlipSigmas","AlignYourStepsScheduler","GITSScheduler"],Mt=["easy kSampler","easy kSamplerTiled","easy kSamplerInpainting","easy kSamplerDownscaleUnet","easy kSamplerLayerDiffusion"],Gt=["easy controlnetLoader","easy controlnetLoaderADV","easy controlnetLoader++","easy instantIDApply","easy instantIDApplyADV"],Pt=["easy ipadapterApply","easy ipadapterApplyADV","easy ipadapterApplyFaceIDKolors","easy ipadapterStyleComposition","easy ipadapterApplyFromParams","easy pulIDApply","easy pulIDApplyADV"],Bt=["easy positive","easy wildcards"],Ft=["easy loadImageBase64","LoadImage","LoadImageMask"],Ut=["easy applyBrushNet","easy applyPowerPaint","easy applyInpaint"],zt={positive_prompt:{text:"positive",positive:"text"},loaders:{ckpt_name:"ckpt_name",vae_name:"vae_name",clip_skip:"clip_skip",lora_name:"lora_name",resolution:"resolution",empty_latent_width:"empty_latent_width",empty_latent_height:"empty_latent_height",positive:"positive",negative:"negative",batch_size:"batch_size",a1111_prompt_style:"a1111_prompt_style"},preSampling:{steps:"steps",cfg:"cfg",cfg_scale_min:"cfg",sampler_name:"sampler_name",scheduler:"scheduler",denoise:"denoise",seed_num:"seed_num",seed:"seed"},kSampler:{image_output:"image_output",save_prefix:"save_prefix",link_id:"link_id"},controlnet:{control_net_name:"control_net_name",strength:["strength","cn_strength"],scale_soft_weights:["scale_soft_weights","cn_soft_weights"],cn_strength:["strength","cn_strength"],cn_soft_weights:["scale_soft_weights","cn_soft_weights"]},ipadapter:{preset:"preset",lora_strength:"lora_strength",provider:"provider",weight:"weight",weight_faceidv2:"weight_faceidv2",start_at:"start_at",end_at:"end_at",cache_mode:"cache_mode",use_tiled:"use_tiled",insightface:"insightface",pulid_file:"pulid_file"},load_image:{image:"image",base64_data:"base64_data",channel:"channel"},inpaint:{dtype:"dtype",fitting:"fitting",function:"function",scale:"scale",start_at:"start_at",end_at:"end_at"},sampler:{},sigmas:{}},jt={loaders:{optional_lora_stack:"optional_lora_stack",positive:"positive",negative:"negative"},preSampling:{pipe:"pipe",image_to_latent:"image_to_latent",latent:"latent"},kSampler:{pipe:"pipe",model:"model"},controlnet:{pipe:"pipe",image:"image",image_kps:"image_kps",control_net:"control_net",positive:"positive",negative:"negative",mask:"mask"},positive_prompt:{},ipadapter:{model:"model",image:"image",image_style:"image",attn_mask:"attn_mask",optional_ipadapter:"optional_ipadapter"},inpaint:{pipe:"pipe",image:"image",mask:"mask"},sampler:{},sigmas:{}},Ht={loaders:{pipe:"pipe",model:"model",vae:"vae",clip:null,positive:null,negative:null,latent:null},preSampling:{pipe:"pipe"},kSampler:{pipe:"pipe",image:"image"},controlnet:{pipe:"pipe",positive:"positive",negative:"negative"},positive_prompt:{text:"positive",positive:"text"},load_image:{IMAGE:"IMAGE",MASK:"MASK"},ipadapter:{model:"model",tiles:"tiles",masks:"masks",ipadapter:"ipadapter"},inpaint:{pipe:"pipe"},sampler:{SAMPLER:"SAMPLER"},sigmas:{SIGMAS:"SIGMAS"}};function Wt(e,t,s){return function(){!function(e,t,s){const o=LiteGraph.createNode(t);if(o){if($.graph.add(o),o.pos=e.pos.slice(),o.size=e.size.slice(),e.widgets.forEach((e=>{if(zt[s][e.name]){const n=zt[s][e.name];if(n){const s=(t=n,o.widgets.find((e=>"object"==typeof t?t.includes(e.name):e.name===t)));s&&(s.value=e.value,"seed_num"==e.name&&(s.linkedWidgets[0].value=e.linkedWidgets[0].value),"converted-widget"==e.type&&Jt(o,s,e))}}var t})),e.inputs&&e.inputs.forEach(((t,n)=>{if(t&&t.link&&jt[s][t.name]){const n=jt[s][t.name];if(null===n)return;const i=o.findInputSlot(n);if(-1!==i){const s=e.graph.links[t.link];if(s){const t=e.graph.getNodeById(s.origin_id);t&&t.connect(s.origin_slot,o,i)}}}})),e.outputs&&e.outputs.forEach(((t,n)=>{if(t&&t.links&&Ht[s]&&Ht[s][t.name]){const n=Ht[s][t.name];if(null===n)return;const i=o.findOutputSlot(n);-1!==i&&t.links.forEach((t=>{const s=e.graph.links[t];if(s){const t=e.graph.getNodeById(s.target_id);t&&o.connect(i,t,s.target_slot)}}))}})),$.graph.remove(e),"easy fullkSampler"==o.type){const e=o.outputs[0].links;if(e&&e[0]){const t=$.graph._nodes.find((t=>t.inputs&&t.inputs[0]&&t.inputs[0].link==e[0]));t&&$.graph.remove(t)}}else if(Ot.includes(o.type)){const e=o.outputs[0].links;if(!e||!e[0]){const e=LiteGraph.createNode("easy kSampler");$.graph.add(e),e.pos=o.pos.slice(),e.pos[0]=e.pos[0]+o.size[0]+20;const t=o.findInputSlot("pipe");-1!==t&&o&&o.connect(0,e,t)}}o.setSize([o.size[0],o.computeSize()[1]])}}(e,t,s)}}const Yt=(e,t)=>{const s=e.prototype.getExtraMenuOptions;e.prototype.getExtraMenuOptions=function(){const e=s.apply(this,arguments);return t.apply(this,arguments),e}},Vt=(e,t,s,o,n=!0)=>{Yt(o,(function(o,i){i.unshift({content:e,has_submenu:n,callback:(e,o,n,i,a)=>Zt(e,o,n,i,a,t,s)}),"loaders"==t&&(i.unshift({content:Ce("💎 View Lora Info..."),callback:(e,t,s,o,n)=>{let i=n.widgets.find((e=>"lora_name"==e.name)).value;i&&"None"!=i&&new Nt(i).show("loras",i)}}),i.unshift({content:Ce("💎 View Checkpoint Info..."),callback:(e,t,s,o,n)=>{let i=n.widgets[0].value;i&&"None"!=i&&new It(i).show("checkpoints",i)}}))}))},Zt=(e,t,s,o,n,i,a)=>{const l=[];return a.map((e=>{n.type!==e&&l.push({content:`${e}`,callback:Wt(n,e,i)})})),new LiteGraph.ContextMenu(l,{event:s,callback:null,parentMenu:o,node:n}),!1},Xt="converted-widget",Qt=Symbol();function Kt(e,t,s=""){if(t.origType=t.type,t.origComputeSize=t.computeSize,t.origSerializeValue=t.serializeValue,t.computeSize=()=>[0,-4],t.type=Xt+s,t.serializeValue=()=>{if(!e.inputs)return;let s=e.inputs.find((e=>{var s;return(null==(s=e.widget)?void 0:s.name)===t.name}));return s&&s.link?t.origSerializeValue?t.origSerializeValue():t.value:void 0},t.linkedWidgets)for(const o of t.linkedWidgets)Kt(e,o,":"+t.name)}function Jt(e,t,s){Kt(e,t);const{type:o}=function(e){let t=e[0];t instanceof Array&&(t="COMBO");return{type:t}}(s),n=e.size;t.options&&t.options.forceInput||e.addInput(t.name,o,{widget:{name:t.name,[Qt]:()=>s}});for(const i of e.widgets)i.last_y+=LiteGraph.NODE_SLOT_HEIGHT;e.setSize([Math.max(n[0],e.size[0]),Math.max(n[1],e.size[1])])}const qt=function(e){var t,s,o,n;const i=e.constructor.type,a=e.properties.origVals||{},l=a.title||e.title,r=a.color||e.color,d=a.bgcolor||e.bgcolor,u=e,c={size:[...e.size],color:r,bgcolor:d,pos:[...e.pos]};let p=[],h=[];if(e.inputs)for(const b of e.inputs)if(b.link){const t=b.name,s=e.findInputSlot(t),o=e.getInputNode(s),n=e.getInputLink(s);p.push([n.origin_slot,o,t])}if(e.outputs)for(const b of e.outputs)if(b.links){const e=b.name;for(const t of b.links){const s=graph.links[t],o=graph._nodes_by_id[s.target_id];h.push([e,o,s.target_slot])}}$.graph.remove(e);const m=$.graph.add(LiteGraph.createNode(i,l,c));function g(){if(u.widgets)for(let e of u.widgets)if("converted-widget"===e.type){const t=m.widgets.find((t=>t.name===e.name));for(let s of u.inputs)s.name===e.name&&Jt(m,t,s.widget)}for(let e of p){const[t,s,o]=e;s.connect(t,m.id,o)}for(let e of h){const[t,s,o]=e;m.connect(t,s,o)}}let f=u.widgets_values;if(!f&&(null==(t=m.widgets)?void 0:t.length)>0)return m.widgets.forEach(((e,t)=>{const s=u.widgets[t];e.name===s.name&&e.type===s.type&&(e.value=s.value)})),void g();const y=(null==f?void 0:f.length)<=(null==(s=m.widgets)?void 0:s.length);let v=y?0:f.length-1;function _(e,t){var s,o,n,i,a,l;if(!0===e||!1===e){if((null==(s=t.options)?void 0:s.on)&&(null==(o=t.options)?void 0:o.off))return{value:e,pass:!0}}else if("number"==typeof e){if((null==(n=t.options)?void 0:n.min)<=e&&e<=(null==(i=t.options)?void 0:i.max))return{value:e,pass:!0}}else{if(null==(l=null==(a=t.options)?void 0:a.values)?void 0:l.includes(e))return{value:e,pass:!0};if(t.inputEl&&"string"==typeof e)return{value:e,pass:!0}}return{value:t.value,pass:!1}}const w=e=>{var t;const s=u.widgets[e];let o=m.widgets[e];if(o.name===s.name&&o.type===s.type){for(;y?v