1(self.webpackChunk_N_E=self.webpackChunk_N_E||[]).push([[8409,9878],{83125:function(e,a,t){"use strict";t.r(a),t.d(a,{ControlParam:function(){return B},ControlParamItem:function(){return H},Sd:function(){return ec},SdPanel:function(){return J},getModelParamBasicData:function(){return G},getParams:function(){return K},models:function(){return F},params:function(){return R}});var r,n,l,s,i,d,o=t(57437),c=t(3109),u=t.n(c),m=t(61399),p=t.n(m),h=t(71869),v=t.n(h),g=t(35499),x=t(76908),P=t(13894),S=t(75591),j=t(2265),y=t(92944),f=t(59208),w=t(44922),b=t(68397),Z=t(14845),_=t(94880),C=t(45762),k=t(24333),N=t(84193),A=t(76058),I=t(98829),M=t(13823),D=t(45578),E=t(84065),T=t(26757),L=t(44666),O=t.n(L),q=t(65878);let R=[{name:P.ZP.SdPanel.Prompt,value:"prompt",type:"textarea",placeholder:P.ZP.SdPanel.PleaseInput(P.ZP.SdPanel.Prompt),required:!0},{name:P.ZP.SdPanel.ModelVersion,value:"model",type:"select",default:"sd3-medium",support:["sd3"],options:[{name:"SD3 Medium",value:"sd3-medium"},{name:"SD3 Large",value:"sd3-large"},{name:"SD3 Large Turbo",value:"sd3-large-turbo"}]},{name:P.ZP.SdPanel.NegativePrompt,value:"negative_prompt",type:"textarea",placeholder:P.ZP.SdPanel.PleaseInput(P.ZP.SdPanel.NegativePrompt)},{name:P.ZP.SdPanel.AspectRatio,value:"aspect_ratio",type:"select",default:"1:1",options:[{name:"1:1",value:"1:1"},{name:"16:9",value:"16:9"},{name:"21:9",value:"21:9"},{name:"2:3",value:"2:3"},{name:"3:2",value:"3:2"},{name:"4:5",value:"4:5"},{name:"5:4",value:"5:4"},{name:"9:16",value:"9:16"},{name:"9:21",value:"9:21"}]},{name:P.ZP.SdPanel.ImageStyle,value:"style",type:"select",default:"3d-model",support:["core"],options:[{name:P.ZP.SdPanel.Styles.D3Model,value:"3d-model"},{name:P.ZP.SdPanel.Styles.AnalogFilm,value:"analog-film"},{name:P.ZP.SdPanel.Styles.Anime,value:"anime"},{name:P.ZP.SdPanel.Styles.Cinematic,value:"cinematic"},{name:P.ZP.SdPanel.Styles.ComicBook,value:"comic-book"},{name:P.ZP.SdPanel.Styles.DigitalArt,value:"digital-art"},{name:P.ZP.SdPanel.Styles.Enhance,value:"enhance"},{name:P.ZP.SdPanel.Styles.FantasyArt,value:"fantasy-art"},{name:P.ZP.SdPanel.Styles.Isometric,value:"isometric"},{name:P.ZP.SdPanel.Styles.LineArt,value:"line-art"},{name:P.ZP.SdPanel.Styles.LowPoly,value:"low-poly"},{name:P.ZP.SdPanel.Styles.ModelingCompound,value:"modeling-compound"},{name:P.ZP.SdPanel.Styles.NeonPunk,value:"neon-punk"},{name:P.ZP.SdPanel.Styles.Origami,value:"origami"},{name:P.ZP.SdPanel.Styles.Photographic,value:"photographic"},{name:P.ZP.SdPanel.Styles.PixelArt,value:"pixel-art"},{name:P.ZP.SdPanel.Styles.TileTexture,value:"tile-texture"}]},{name:"Seed",value:"seed",type:"number",default:0,min:0,max:4294967294},{name:P.ZP.SdPanel.OutFormat,value:"output_format",type:"select",default:"png",options:[{name:"PNG",value:"png"},{name:"JPEG",value:"jpeg"},{name:"WebP",value:"webp"}]}],W=(e,a)=>R.filter(a=>!(a.support&&!a.support.includes(e))),F=[{name:"Stable Image Ultra",value:"ultra",params:e=>W("ultra",e)},{name:"Stable Image Core",value:"core",params:e=>W("core",e)},{name:"Stable Diffusion 3",value:"sd3",params:e=>W("sd3",e).filter(a=>!("sd3-large-turbo"===e.model&&"negative_prompt"==a.value))}];function H(e){return(0,o.jsxs)("div",{className:O()["ctrl-param-item"]+" ".concat(e.className||""),children:[(0,o.jsx)("div",{className:O()["ctrl-param-item-header"],children:(0,o.jsx)("div",{className:O()["ctrl-param-item-title"],children:(0,o.jsxs)("div",{children:[e.title,e.required&&(0,o.jsx)("span",{style:{color:"red"},children:"*"})]})})}),e.children,e.subTitle&&(0,o.jsx)("div",{className:O()["ctrl-param-item-sub-title"],children:e.subTitle})]})}function B(e){var a;return(0,o.jsx)(o.Fragment,{children:null===(a=e.columns)||void 0===a?void 0:a.map(a=>{let t;switch(a.type){case"textarea":t=(0,o.jsx)(H,{title:a.name,subTitle:a.sub,required:a.required,children:(0,o.jsx)("textarea",{rows:a.rows||3,style:{maxWidth:"100%",width:"100%",padding:"10px"},placeholder:a.placeholder,onChange:t=>{e.onChange(a.value,t.currentTarget.value)},value:e.data[a.value]})});break;case"select":t=(0,o.jsx)(H,{title:a.name,subTitle:a.sub,required:a.required,
1children:(0,o.jsx)(q.Ph,{"aria-label":a.name,value:e.data[a.value],onChange:t=>{e.onChange(a.value,t.currentTarget.value)},children:a.options.map(e=>(0,o.jsx)("option",{value:e.value,children:e.name},e.value))})});break;case"number":t=(0,o.jsx)(H,{title:a.name,subTitle:a.sub,required:a.required,children:(0,o.jsx)("input",{"aria-label":a.name,type:"number",min:a.min,max:a.max,value:e.data[a.value]||0,onChange:t=>{e.onChange(a.value,parseInt(t.currentTarget.value))}})});break;default:t=(0,o.jsx)(H,{title:a.name,subTitle:a.sub,required:a.required,children:(0,o.jsx)("input",{"aria-label":a.name,type:"text",value:e.data[a.value],style:{maxWidth:"100%",width:"100%"},onChange:t=>{e.onChange(a.value,t.currentTarget.value)}})})}return(0,o.jsx)("div",{children:t},a.value)})})}let G=(e,a,t)=>{let r={};return e.forEach(e=>{t&&["text","textarea","number"].includes(e.type)?r[e.value]=e.default||"":r[e.value]=a[e.value]||e.default||""}),r},K=(e,a)=>{var t;return(null===(t=F.find(a=>a.value===e.value))||void 0===t?void 0:t.params(a))||[]};function J(){let e=z(),a=e.currentModel,t=e.setCurrentModel,r=e.currentParams,n=e.setCurrentParams,l=e=>{t(e),n(G(e.params({}),r))};return(0,o.jsxs)(o.Fragment,{children:[(0,o.jsx)(H,{title:P.ZP.SdPanel.AIModel,children:(0,o.jsx)("div",{className:O()["ai-models"],children:F.map(e=>(0,o.jsx)(g.h,{text:e.name,type:a.value==e.value?"primary":null,shadow:!0,onClick:()=>l(e)},e.value))})}),(0,o.jsx)(B,{columns:null==K?void 0:K(a,r),data:r,onChange:(e,a)=>{n({...r,[e]:a})}})]})}var $=t(39138);let U={name:F[0].name,value:F[0].value},V=G(F[0].params({}),{}),z=(0,D.D)({currentId:0,draw:[],currentModel:U,currentParams:V},(e,a)=>({getNextId(){let t=++a().currentId;return e({currentId:t}),t},sendTask(t,r){e({draw:[t={...t,id:(0,E.x0)(),status:"running"},...a().draw]}),this.getNextId(),this.stabilityRequestCall(t),null==r||r()},stabilityRequestCall(e){let a=$._.getState(),t=S.L.Stability,r="";a.useCustomConfig&&(t=a.stabilityUrl||S.L.Stability,r=(0,M.Oj)(a.stabilityApiKey)),!r&&a.enabledAccessControl()&&(r=(0,M.Oj)(S.TW+a.accessCode));let n={Accept:"application/json",Authorization:r},l="".concat(t,"/").concat(S.Xy.GeneratePath,"/").concat(e.model),s=new FormData;for(let a in e.params)s.append(a,e.params[a]);fetch(l,{method:"POST",headers:n,body:s}).then(e=>e.json()).then(a=>{if(a.errors&&a.errors.length>0){this.updateDraw({...e,status:"error",error:a.errors[0]}),this.getNextId();return}let t=this;"SUCCESS"===a.finish_reason?(0,T.Ix)((0,T.lf)(a.image,"image/png")).then(a=>{console.debug("uploadImage success",a,t),t.updateDraw({...e,status:"success",img_data:a})}).catch(a=>{console.error("uploadImage error",a),t.updateDraw({...e,status:"error",error:JSON.stringify(a)})}):t.updateDraw({...e,status:"error",error:JSON.stringify(a)}),this.getNextId()}).catch(a=>{this.updateDraw({...e,status:"error",error:a.message}),console.error("Error:",a),this.getNextId()})},updateDraw(t){let r=a().draw||[];r.some((a,n)=>{if(a.id===t.id)return r[n]=t,e(()=>({draw:r})),!0})},setCurrentModel(a){e({currentModel:a})},setCurrentParams(a){e({currentParams:a})}}),{name:S.KJ.SdList,version:1});var Q=t(24053),X=t(15592),Y=t(52846);function ee(){return(ee=Object.assign?Object.assign.bind():function(e){for(var a=1;a<arguments.length;a++){var t=arguments[a];for(var r in t)Object.prototype.hasOwnProperty.call(t,r)&&(e[r]=t[r])}return e}).apply(this,arguments)}var ea=function(e){return Y.createElement("svg",ee({xmlns:"http://www.w3.org/2000/svg",width:"1.21em",height:"1em",viewBox:"0 0 256 213"},e),r||(r=Y.createElement("defs",null,Y.createElement("linearGradient",{id:"sd_svg__a",x1:"50%",x2:"50%",y1:"0%",y2:"100%"},Y.createElement("stop",{offset:"0%",stopColor:"#9d39ff"}),Y.createElement("stop",{offset:"100%",stopColor:"#a380ff"})))),n||(n=Y.createElement("path",{fill:"url(#sd_svg__a)",d:"M72.418 212.45c49.478 0 81.658-26.205 81.658-65.626 0-30.572-19.572-49.998-54.569-58.043l-22.469-6.74c-19.71-4.424-31.215-9.738-28.505-23.312 2.255-11.292 9.002-17.667 24.69-17.667 49.872 0 68.35 17.667 68.35 17.667V16.237S123.583 0 73.223 0C25.757 0 0 24.424 0 62.236c0 30.571 17.85 48.35 54.052 56.798q3.802.95 3.885.976 8.26 2.556 22.293 6.755c18.504 4.425 23.262 9.121 23.262 23.2 0 12.872-13.374 20.19-31.074 20.19C21.432 170.154 0 144.36 0 144.36v47.078s13.402 21.01 72.418 21.01"})),l||(l=Y.createElement("path",{fill:"#e80000",d:"M225.442 209.266c17.515 0 30.558-12.67 30.558-29.812 0-17.515-12.67-29.813-30.558-29.813-17.515 0-30.185 12.298-30.185 29.813s12.67 29.812 30.185 29.812"})))},et=t(59566);function er(){return(er=Object.assign?Object.assign.bind():function(e){for(var a=1;a<arguments.length;a++){var t=arguments[a];for(var r in t)Object.prototype.hasOwnProperty.call(t,r)&&(e[r]=t[r])}return e}).apply(this,arguments)}var en=function(e){return Y.createElement("svg",er({width:16,height:16,viewBox:"0 0 48 48",fill:"none",xmlns:"http://www.w3.org/2000/svg"},e),s||(s=Y.createElement("path",{d:"M5.818 6.727V14h7.273",stroke:"#333",strokeWidth:4,strokeLinecap:"round",strokeLinejoin:"round"})),i||(i=Y.createElement("path",{d:"M4 24c0 11.046 8.954 20 20 20v0c11.046 0 20-8.954 20-20S35.046 4 24 4c-7.402 0-13.865 4.021-17.323 9.998",stroke:"#333",strokeWidth:4,strokeLinecap:"round",strokeLinejoin:"round"})),d||(d=Y.createElement("path",{d:"m24.005 12-.001 12.009 8.48 8.48",stroke:"#333",strokeWidth:4,strokeLinecap:"round",strokeLinejoin:"round"})))},el=t(24232),es=t(59254);let ei=(0,el.default)(async()=>(await Promise.resolve().then(t.bind(t,83125))).SdPanel,{loadableGenerated:{webpack:()=>[83125]},loading:()=>null});function ed(e){(0,es.Ku)();let a=(0,y.S0)(),{onDragStart:t,shouldNarrow:r}=(0,es.RW)(),n=(0,f.s0)(),l=z(),s=l.currentModel,i=l.currentParam
1s,d=l.setCurrentParams;return(0,o.jsxs)(es.th,{onDragStart:t,shouldNarrow:r,...e,children:[a?(0,o.jsxs)("div",{className:"window-header","data-tauri-drag-region":!0,style:{paddingLeft:0,paddingRight:0},children:[(0,o.jsx)("div",{className:"window-actions",children:(0,o.jsx)("div",{className:"window-action-button",children:(0,o.jsx)(g.h,{icon:(0,o.jsx)(x.Z,{}),bordered:!0,title:P.ZP.Sd.Actions.ReturnHome,onClick:()=>n(S.y$.Home)})})}),(0,o.jsx)(ea,{width:50,height:50}),(0,o.jsx)("div",{className:"window-actions",children:(0,o.jsx)("div",{className:"window-action-button",children:(0,o.jsx)(g.h,{icon:(0,o.jsx)(en,{}),bordered:!0,title:P.ZP.Sd.Actions.History,onClick:()=>n(S.y$.SdNew)})})})]}):(0,o.jsx)(es.ec,{title:(0,o.jsx)(g.h,{icon:(0,o.jsx)(x.Z,{}),bordered:!0,title:P.ZP.Sd.Actions.ReturnHome,onClick:()=>n(S.y$.Home)}),logo:(0,o.jsx)(ea,{width:38,height:"100%"})}),(0,o.jsx)(es.M3,{children:(0,o.jsx)(ei,{})}),(0,o.jsx)(es.yw,{primaryAction:(0,o.jsx)("a",{href:S.Bv,target:"_blank",rel:"noopener noreferrer",children:(0,o.jsx)(g.h,{icon:(0,o.jsx)(et.Z,{}),shadow:!0})}),secondaryAction:(0,o.jsx)(g.h,{text:P.ZP.SdPanel.Submit,type:"primary",shadow:!0,onClick:()=>{let e=null==K?void 0:K(s,i),a={};for(let r=0;r<e.length;r++){var t;let n=e[r];if(a[n.value]=null!==(t=i[n.value])&&void 0!==t?t:null,n.required&&!a[n.value]){(0,q.CF)(P.ZP.SdPanel.ParamIsRequired(n.name));return}}let r={model:s.value,model_name:s.name,status:"wait",params:a,created_at:new Date().toLocaleString(),img_data:""};l.sendTask(r,()=>{d(G(e,i,!0)),n(S.y$.SdNew)})}})})]})}var eo=t(77120);function ec(){let e=(0,y.S0)(),a=(0,f.s0)(),t=(0,f.TH)(),r=(0,j.useMemo)(()=>(0,_.Z)(),[]),n=!e&&!(null==r?void 0:r.isApp),l=(0,w.MG)(),s=(0,j.useRef)(null),i=z(),[d,c]=(0,j.useState)(i.draw),m=t.pathname===S.y$.Sd;return(0,j.useEffect)(()=>{c(i.draw)},[i.currentId]),(0,o.jsxs)(o.Fragment,{children:[(0,o.jsx)(ed,{className:m?v()["sidebar-show"]:""}),(0,o.jsx)(eo.WindowContent,{children:(0,o.jsxs)("div",{className:u().chat,children:[(0,o.jsxs)("div",{className:"window-header","data-tauri-drag-region":!0,children:[e&&(0,o.jsx)("div",{className:"window-actions",children:(0,o.jsx)("div",{className:"window-action-button",children:(0,o.jsx)(g.h,{icon:(0,o.jsx)(x.Z,{}),bordered:!0,title:P.ZP.Chat.Actions.ChatList,onClick:()=>a(S.y$.Sd)})})}),(0,o.jsxs)("div",{className:"window-header-title ".concat(u()["chat-body-title"]),children:[(0,o.jsx)("div",{className:"window-header-main-title",children:"Stability AI"}),(0,o.jsx)("div",{className:"window-header-sub-title",children:P.ZP.Sd.SubTitle(d.length||0)})]}),(0,o.jsxs)("div",{className:"window-actions",children:[n&&(0,o.jsx)("div",{className:"window-action-button",children:(0,o.jsx)(g.h,{aria:P.ZP.Chat.Actions.FullScreen,icon:l.tightBorder?(0,o.jsx)(b.Z,{}):(0,o.jsx)(Z.Z,{}),bordered:!0,onClick:()=>{l.update(e=>e.tightBorder=!e.tightBorder)}})}),e&&(0,o.jsx)(ea,{width:50,height:50})]})]}),(0,o.jsx)("div",{className:u()["chat-body"],ref:s,children:(0,o.jsx)("div",{className:p()["sd-img-list"],children:d.length>0?d.map(a=>(0,o.jsxs)("div",{style:{display:"flex"},className:p()["sd-img-item"],children:["success"===a.status?(0,o.jsx)("img",{className:p().img,src:a.img_data,alt:a.id,onClick:t=>(0,q.vi)(a.img_data,!0,e?{width:"100%",height:"fit-content"}:{maxWidth:"100%",maxHeight:"100%"},e?{width:"100%",height:"fit-content"}:{width:"100%",height:"100%"})}):"error"===a.status?(0,o.jsx)("div",{className:p()["pre-img"],children:(0,o.jsx)(X.Z,{})}):(0,o.jsx)("div",{className:p()["pre-img"],children:(0,o.jsx)(Q.Z,{})}),(0,o.jsxs)("div",{style:{marginLeft:"10px"},className:p()["sd-img-item-info"],children:[(0,o.jsxs)("p",{className:p()["line-1"],children:[P.ZP.SdPanel.Prompt,":"," ",(0,o.jsx)("span",{className:"clickable",title:a.params.prompt,onClick:()=>{(0,q.K4)({title:P.ZP.Sd.Detail,children:(0,o.jsx)("div",{style:{userSelect:"text"},children:a.params.prompt})})},children:a.params.prompt})]}),(0,o.jsxs)("p",{children:[P.ZP.SdPanel.AIModel,": ",a.model_name]}),function(e){let a,t;switch(e.status){case"success":a=P.ZP.Sd.Status.Success,t="green";break;case"error":a=P.ZP.Sd.Status.Error,t="red";break;case"wait":a=P.ZP.Sd.Status.Wait,t="yellow";break;case"running":a=P.ZP.Sd.Status.Running,t="blue";break;default:a=e.status.toUpperCase()}return(0,o.jsxs)("p",{className:p()["line-1"],title:e.error,style:{color:t},children:[(0,o.jsxs)("span",{children:[P.ZP.Sd.Status.Name,": ",a
1]}),"error"===e.status&&(0,o.jsxs)("span",{className:"clickable",onClick:()=>{(0,q.K4)({title:P.ZP.Sd.Detail,children:(0,o.jsx)("div",{style:{color:t,userSelect:"text"},children:e.error})})},children:["- ",e.error]})]})}(a),(0,o.jsx)("p",{children:a.created_at}),(0,o.jsx)("div",{className:u()["chat-message-actions"],children:(0,o.jsxs)("div",{className:u()["chat-input-actions"],children:[(0,o.jsx)(C.ChatAction,{text:P.ZP.Sd.Actions.Params,icon:(0,o.jsx)(A.Z,{}),onClick:()=>{(0,q.K4)({title:P.ZP.Sd.GenerateParams,children:(0,o.jsx)("div",{style:{userSelect:"text"},children:Object.keys(a.params).map(e=>{let t=e,r=a.params[e];switch(t){case"prompt":t=P.ZP.SdPanel.Prompt;break;case"negative_prompt":t=P.ZP.SdPanel.NegativePrompt;break;case"aspect_ratio":t=P.ZP.SdPanel.AspectRatio;break;case"seed":t="Seed",r=r||0;break;case"output_format":t=P.ZP.SdPanel.OutFormat,r=null==r?void 0:r.toUpperCase();break;case"style":var n,l,s;t=P.ZP.SdPanel.ImageStyle,r=null===(s=R.find(e=>"style"===e.value))||void 0===s?void 0:null===(l=s.options)||void 0===l?void 0:null===(n=l.find(e=>e.value===r))||void 0===n?void 0:n.name}return(0,o.jsxs)("div",{style:{margin:"10px"},children:[(0,o.jsxs)("strong",{children:[t,": "]}),r]},e)})})})}}),(0,o.jsx)(C.ChatAction,{text:P.ZP.Sd.Actions.Copy,icon:(0,o.jsx)(N.Z,{}),onClick:()=>(0,y.vQ)((0,y.YK)({role:"user",content:a.params.prompt}))}),(0,o.jsx)(C.ChatAction,{text:P.ZP.Sd.Actions.Retry,icon:(0,o.jsx)(I.Z,{}),onClick:()=>{let e={model:a.model,model_name:a.model_name,status:"wait",params:{...a.params},created_at:new Date().toLocaleString(),img_data:""};i.sendTask(e)}}),(0,o.jsx)(C.ChatAction,{text:P.ZP.Sd.Actions.Delete,icon:(0,o.jsx)(k.Z,{}),onClick:async()=>{await (0,q.i0)(P.ZP.Sd.Danger.Delete)&&(0,T.CM)(a.img_data).finally(()=>{i.draw=d.filter(e=>e.id!==a.id),i.getNextId()})}})]})})]})]},a.id)):(0,o.jsx)("div",{children:P.ZP.Sd.EmptyRecord})})})]},"1")})]})}},44666:function(e){e.exports={"ctrl-param-item":"sd-panel_ctrl-param-item__J3n2p","slide-in":"sd-panel_slide-in__pgHFP","ctrl-param-item-header":"sd-panel_ctrl-param-item-header__WMsg6","ctrl-param-item-title":"sd-panel_ctrl-param-item-title__2MLu7","ctrl-param-item-sub-title":"sd-panel_ctrl-param-item-sub-title__BAohX","ai-models":"sd-panel_ai-models__gLs5k"}},61399:function(e){e.exports={"sd-img-list":"sd_sd-img-list__oHHnG","sd-img-item":"sd_sd-img-item__cMa5W","sd-img-item-info":"sd_sd-img-item-info__jbgQS","line-1":"sd_line-1__2ScCb","pre-img":"sd_pre-img__Ty1zJ",img:"sd_img__9EVCT"}}}]);
Line numbers count LF bytes from the start of the resource, as the search results do. Vendor segments are library code the classifier recognised; they are stored but not indexed. Bytes are shown as Latin1 characters, one per byte.