1var e=Object.defineProperty,t=Object.defineProperties,i=Object.getOwnPropertyDescriptors,r=Object.getOwnPropertySymbols,l=Object.prototype.hasOwnProperty,a=Object.prototype.propertyIsEnumerable,s=(t,i,r)=>i in t?e(t,i,{enumerable:!0,configurable:!0,writable:!0,value:r}):t[i]=r,n=(e,t)=>{for(var i in t||(t={}))l.call(t,i)&&s(e,i,t[i]);if(r)for(var i of r(t))a.call(t,i)&&s(e,i,t[i]);return e};import{j as o}from"./vendor-mui-CBxi4-UE.js";import{i as c,f as d,a as p}from"./vendor-react-DJCar8wk.js";import{u as m,a as u,g}from"./main-fFbGxLEq.js";import"./index-Cc7IhL_s.js";import"./vendor-utils-hGafao2v.js";const v=g` 2 query StyleEditQuery { 3 stylePresetsAdminList { 4 id slug name collectionSlug directivePrompt negativePrompt 5 providerHints compatibleOps compatibleProviders 6 thumbnailUrl displayOrder isActive 7 } 8 } 9`,y=g` 10 mutation StyleAdminUpsert( 11 $slug: String!, $name: String, $collectionSlug: String, 12 $directivePrompt: String, $negativePrompt: String, 13 $providerHints: JSON, $compatibleOps: [String!], $compatibleProviders: [String!], 14 $thumbnailUrl: String, $displayOrder: Int, $isActive: Boolean 15 ) { 16 stylePresetAdminUpsert(input: { 17 slug: $slug, name: $name, collectionSlug: $collectionSlug, 18 directivePrompt: $directivePrompt, negativePrompt: $negativePrompt, 19 providerHints: $providerHints, compatibleOps: $compatibleOps, 20 compatibleProviders: $compatibleProviders, 21 thumbnailUrl: $thumbnailUrl, displayOrder: $displayOrder, isActive: $isActive 22 }) { 23 preset { slug } 24 errors 25 } 26 } 27`;function b(){const{slug:e}=c(),r=d(),l="new"===e,{data:a,refetch:s}=m(v),[g,b]=p.useState(null),[f,x]=p.useState("{}"),[j,S]=p.useState(null),[P,O]=p.useState(null),[N,{loading:$}]=u(y,{onCompleted:e=>{var t;(null==(t=e.stylePresetAdminUpsert.errors)?void 0:t.length)?O(e.stylePresetAdminUpsert.errors.join(" · ")):(O(null),s(),l&&r("/admin/effects/styles/"+e.stylePresetAdminUpsert.preset.slug))},onError:e=>O(e.message)});if(p.useEffect(()=>{if(l&&!g)return b({slug:"",name:"",collectionSlug:"viral_visual_styles",directivePrompt:"",isActive:!0,displayOrder:99}),void x("{}");if(a&&!g){const t=(a.stylePresetsAdminList||[]).find(t=>t.slug===e);t&&(b(n({},t)),x(JSON.stringify(t.providerHints||{},null,2)))}},[a,l,e]),!g)return o.jsx("div",{className:"page",children:o.jsx("div",{className:"card",style:{padding:24},children:"Loadingâ¦"})});const C=(g.directivePrompt||"").split(/\s+/).filter(Boolean).length,A=(e,r)=>{return b((l=n({},g),t(l,i({[e]:r}))));var l};return o.jsxs("div",{className:"page",children:[o.jsx("button",{className:"btn btn--ghost btn--sm",onClick:()=>r("/admin/effects/styles"),style:{marginBottom:12},children:"â All styles"}),o.jsx("h1",{style:{margin:"0 0 16px",fontFamily:"var(--font-display)",fontSize:28,fontWeight:800},children:l?"New style preset":g.name||g.slug}),o.jsxs("div",{className:"card",style:{padding:20,display:"grid",gap:14},children:[o.jsx(h,{label:"Slug",hint:"snake_case, unique. Used in style_preset config references.",children:o.jsx("input",{className:"input",value:g.slug,disabled:!l,onChange:e=>A("slug",e.target.value.toLowerCase().replace(/[^a-z0-9_]/g,"_")),style:{fontFamily:"var(--font-mono)"}})}),o.jsx(h,{label:"Name",children:o.jsx("input",{className:"input",value:g.name||"",onChange:e=>A("name",e.target.value)})}),o.jsx(h,{label:"Collection",hint:"viral_visual_styles / kids_cartoon / etc. Used by user_inputs option_source.",children:o.jsx("input",{className:"input",value:g.collectionSlug||"",onChange:e=>A("collectionSlug",e.target.value),style:{fontFamily:"var(--font-mono)"}})}),o.jsx(h,{label:`Directive prompt (${C} words)`,hint:"60-120 word literary prompt injected into image/video generation. NEVER visible to iOS clients.",children:o.jsx("textarea",{className:"textarea textarea--mono",rows:8,value:g.directivePrompt||"",onChange:e=>A("directivePrompt",e.target.value)})}),o.jsx(h,{label:"Negative prompt (optional)",children:o.jsx("textarea",{className:"textarea textarea--mono",rows:2,value:g.negativePrompt||"",onChange:e=>A("negativePrompt",e.target.value)})}),o.jsxs(h,{label:"Provider hints (JSON)",hint:'Per-provider override prompts, e.g. {"kling_v3_i2v": "Claymation style, stop-motion..."}',children:[o.jsx("textarea",{className:"textarea textarea--mono",rows:5,value:f,onChange:e=>{x(e.target.value),S(null)}}),j&&o.jsxs("div",{style:{color:"var(--red-500)",fontSize:12,marginTop:4},children:["JSON: ",j]})]}),o.jsx(h,{label:"Compatible ops",hint:"Comma-separated list (image.generate, video.generate).",children:o.jsx("input",{className:"input",value:(g.compatibleOps||[]).join(", "),onChange:e=>A("compatibleOps",e.target.value.split(",").map(e=>
27e.trim()).filter(Boolean)),style:{fontFamily:"var(--font-mono)",fontSize:12}})}),o.jsx(h,{label:"Thumbnail URL",children:o.jsx("input",{className:"input",value:g.thumbnailUrl||"",onChange:e=>A("thumbnailUrl",e.target.value),style:{fontFamily:"var(--font-mono)",fontSize:12}})}),o.jsxs("div",{style:{display:"flex",gap:16},children:[o.jsx(h,{label:"Display order",children:o.jsx("input",{className:"input",type:"number",value:g.displayOrder||0,onChange:e=>A("displayOrder",parseInt(e.target.value,10)||0),style:{width:100}})}),o.jsxs("label",{style:{display:"flex",alignItems:"center",gap:6},children:[o.jsx("input",{type:"checkbox",checked:!1!==g.isActive,onChange:e=>A("isActive",e.target.checked)}),o.jsx("span",{children:"Active"})]})]})]}),P&&o.jsx("div",{style:{marginTop:12,padding:10,background:"rgba(255,59,48,.12)",color:"var(--red-500)",borderRadius:8,fontSize:12.5},children:P}),o.jsxs("div",{style:{display:"flex",gap:8,marginTop:20,justifyContent:"flex-end"},children:[o.jsx("button",{className:"btn",onClick:()=>r("/admin/effects/styles"),children:"Cancel"}),o.jsx("button",{className:"btn btn--primary",disabled:$,onClick:()=>{let e;O(null);try{e=JSON.parse(f)}catch(t){return void S(t.message)}S(null),N({variables:{slug:g.slug,name:g.name,collectionSlug:g.collectionSlug,directivePrompt:g.directivePrompt,negativePrompt:g.negativePrompt,providerHints:e,compatibleOps:g.compatibleOps,compatibleProviders:g.compatibleProviders,thumbnailUrl:g.thumbnailUrl,displayOrder:g.displayOrder,isActive:g.isActive}})},children:$?"Savingâ¦":l?"Create":"Save changes"})]})]})}function h({label:e,hint:t,children:i}){return o.jsxs("div",{children:[o.jsx("label",{style:{display:"block",fontSize:11.5,fontWeight:700,textTransform:"uppercase",letterSpacing:".08em",color:"var(--fg-muted)",marginBottom:6},children:e}),i,t&&o.jsx("div",{className:"text-muted",style:{fontSize:11.5,marginTop:4},children:t})]})}export{b as default};
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.