1import{d as Ge,f as x,i as q,a as v,s as f,c as He,e as Ne,t as M}from"../chunks/BmSKQWIQ.js";import{B as Oe,V as Ke,U as h,Q as Me,W as Le,X as Ve,F as ae,O as t,J as r,D as Je,c as n,P as e,a as s,K as Xe,G as D}from"../chunks/DstTTDS_.js";import{f as Ye,r as ze,e as Qe,s as We,g as Ze,h as $e}from"../chunks/psxyvfJL.js";import{r as et}from"../chunks/noctlh8y.js";import{b as tt}from"../chunks/CeWU3frX.js";import{g as at}from"../chunks/CdckgkFQ.js";var st=x('<div class="error-state svelte-qkx10j"><p> </p></div>'),ot=x('<div class="loading-state svelte-qkx10j"><div class="spinner svelte-qkx10j"></div> <p>Loading tokens...</p></div>'),rt=x('<div class="empty-state svelte-qkx10j"><p>No API tokens yet. Create one to share with an external platform.</p></div>'),lt=x('<button class="action-icon revoke svelte-qkx10j" title="Revoke token">Revoke</button>'),nt=x('<tr class="svelte-qkx10j"><td class="name-cell svelte-qkx10j"> </td><td class="prefix-cell svelte-qkx10j"><code class="svelte-qkx10j"> </code></td><td class="status-cell svelte-qkx10j"><span> </span></td><td class="date-cell svelte-qkx10j"> </td><td class="date-cell svelte-qkx10j"> </td><td class="usage-cell svelte-qkx10j"> </td><td class="actions-cell svelte-qkx10j"><!></td></tr>'),it=x('<div class="tokens-table svelte-qkx10j"><table class="svelte-qkx10j"><thead><tr><th class="svelte-qkx10j">Name</th><th class="svelte-qkx10j">Prefix</th><th class="svelte-qkx10j">Status</th><th class="svelte-qkx10j">Created</th><th class="svelte-qkx10j">Last used</th><th class="svelte-qkx10j">Usage</th><th class="svelte-qkx10j">Actions</th></tr></thead><tbody class="svelte-qkx10j"></tbody></table></div>'),ct=x(`<p class="token-warning svelte-qkx10j">Copy this token now. It won't be shown again.</p> <div class="token-display svelte-qkx10j"><code class="token-value svelte-qkx10j"> </code> <button type="button" class="copy-btn svelte-qkx10j">Copy</button></div>`,1),vt=x('<form><div class="form-group svelte-qkx10j"><label for="token-name" class="svelte-qkx10j">Label</label> <input id="token-name" type="text" placeholder="e.g. Make.com Integration" required class="svelte-qkx10j"/></div> <div class="modal-actions svelte-qkx10j"><button type="button" class="btn-secondary svelte-qkx10j">Cancel</button> <button type="submit" class="btn-primary svelte-qkx10j"><!></button></div></form>'),dt=x('<div class="modal-overlay svelte-qkx10j" role="button" tabindex="-1"><div class="modal svelte-qkx10j" role="dialog" tabindex="-1"><div class="modal-header svelte-qkx10j"><h2 class="svelte-qkx10j"> </h2> <button class="close-btn svelte-qkx10j" type="button" aria-label="Close"><svg xmlns="http://www.w3.org/2000/svg" width="20" height="20" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round"><line x1="18" y1="6" x2="6" y2="18"></line><line x1="6" y1="6" x2="18" y2="18"></line></svg></button></div> <div class="modal-body svelte-qkx10j"><!></div></div></div>'),ut=x('<div class="modal-overlay svelte-qkx10j" role="button" tabindex="-1"><div class="confirm-modal svelte-qkx10j" role="dialog" tabindex="-1"><h3 class="svelte-qkx10j">Revoke token?</h3> <p class="svelte-qkx10j"> </p> <div class="modal-actions svelte-qkx10j"><button type="button" class="btn-secondary svelte-qkx10j">Cancel</button> <button type="button" class="btn-danger svelte-qkx10j"><!></button></div></div></div>'),kt=x('<div class="api-page svelte-qkx10j"><header class="page-header svelte-qkx10j"><div><h1 class="svelte-qkx10j">API</h1> <p class="svelte-qkx10j">Bearer tokens for the image generation API. Share a token with another platform to generate images (OpenAI or Gemini) without a system prompt.</p></div> <div class="header-actions"><button class="add-btn svelte-qkx10j"><svg xmlns="http://www.w3.org/2000/svg" width="18" height="18" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round"><line x1="12" y1="5" x2="12" y2="19"></line><line x1="5" y1="12" x2="19" y2="12"></line></svg> Create Token</button></div></header> <!> <section class="section svelte-qkx10j"><h2 class="svelte-qkx10j">Tokens</h2> <!></section> <section class="section docs-section svelte-qkx10j"><h2 class="svelte-qkx10j">API documentation</h2> <p class="svelte-qkx10j">Use the endpoint below with a bearer token. The full prompt is under your control; no system prompt is applied.</p> <a href="/api-docs/" target="_blank" rel="noopener noreferrer" class="swagger-link svelte-qkx10j">View in Swagger UI <svg xmlns="http://www.w3.org/2000/svg" width="16" height="16" viewB
1ox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" class="svelte-qkx10j"><path d="M18 13v6a2 2 0 0 1-2 2H5a2 2 0 0 1-2-2V8a2 2 0 0 1 2-2h6"></path><polyline points="15 3 21 3 21 9"></polyline><line x1="10" y1="14" x2="21" y2="3"></line></svg></a> <div class="endpoint-block svelte-qkx10j"><strong class="svelte-qkx10j">Endpoint</strong> <code class="endpoint-url svelte-qkx10j"></code></div> <div class="params-block svelte-qkx10j"><strong class="svelte-qkx10j">Request body (JSON)</strong> <ul class="svelte-qkx10j"><li class="svelte-qkx10j"><code>prompt</code> (required) â Full image prompt, 10â2000 characters</li> <li class="svelte-qkx10j"><code>model</code> (optional) â <code>gpt-image-1.5</code>, <code>dall-e-3</code>, <code>gemini-3-pro-image-preview</code>, <code>gemini-2.5-flash-image</code>. Default: <code>gemini-3-pro-image-preview</code></li> <li class="svelte-qkx10j"><code>aspectRatio</code> (optional) â <code>1:1</code>, <code>16:9</code>, <code>9:16</code>, <code>4:3</code>, <code>3:4</code>, <code>3:2</code>, <code>2:3</code>, <code>21:9</code>. Default: <code>1:1</code></li> <li class="svelte-qkx10j"><code>resolution</code> (optional) â <code>1K</code> or <code>2K</code> (Gemini). Default: <code>1K</code></li></ul></div> <div class="curl-block svelte-qkx10j"><strong class="svelte-qkx10j">Example (curl)</strong> <pre class="svelte-qkx10j"><code></code></pre></div> <div class="response-block svelte-qkx10j"><strong class="svelte-qkx10j">Response (success)</strong> <pre class="svelte-qkx10j"><code></code></pre> <p class="response-note svelte-qkx10j">Decode the <code>image</code> base64 string to get the PNG bytes. Save or use the image on your platform.</p></div></section></div> <!> <!>',1);function ht(pe,xe){Oe(xe,!0);const se=Ke("adminAuth");let L=h(Me([])),V=h(!0),b=h(null),J=h(!1),C=h(""),N=h(!1),y=h(null),X=h(!1),I=h(null),O=h(!1),Y=null;Le(()=>{if(!se.loading){if(!se.isAdmin){at("/admin");return}Y||(Y=Ye(a=>{n(L,a,!0),n(V,!1),n(b,null)},a=>{console.error("Failed to subscribe to API tokens:",a),n(V,!1),n(b,"Failed to load tokens. Please try refreshing.")}))}}),Ve(()=>{Y?.()});function _e(){const a="wfp_",o=new Uint8Array(16);crypto.getRandomValues(o);const i=Array.from(o).map(c=>c.toString(16).padStart(2,"0")).join("");return a+i}async function me(a){const i=new TextEncoder().encode(a),c=await crypto.subtle.digest("SHA-256",i),j=new Uint8Array(c);return Array.from(j).map(k=>k.toString(16).padStart(2,"0")).join("")}function ge(){n(C,""),n(y,null),n(J,!0)}function U(){n(J,!1),n(y,null),n(C,"")}async function fe(){if(!s(C).trim())return;const a=Ze();if(!a){n(b,"You must be signed in to create a token.");return}n(N,!0),n(b,null);try{const o=_e(),i=await me(o),c=o.slice(0,11)+"...";await $e({name:s(C).trim(),tokenHash:i,tokenPrefix:c,createdBy:a.uid}),n(y,o,!0)}catch(o){console.error("Error creating token:",o),n(b,"Failed to create token. Please try again.")}n(N,!1)}async function he(){if(s(y))try{await navigator.clipboard.writeText(s(y))}catch{n(b,"Could not copy to clipboard.")}}function be(a){n(I,a,!0),n(X,!0)}function B(){n(X,!1),n(I,null)}async function je(){if(s(I)){n(O,!0);try{await ze(s(I).id),B()}catch(a){console.error("Error revoking token:",a),n(b,"Failed to revoke token. Please try again.")}n(O,!1)}}function oe(a){return a?a.toLocaleDateString(void 0,{year:"numeric",month:"short",day:"numeric",hour:"2-digit",minute:"2-digit"}):"â"}var re=kt(),z=ae(re),Q=t(z),le=r(t(Q),2),qe=t(le);qe.__click=ge,e(le),e(Q);var ne=r(Q,2);{var ye=a=>{var o=st(),i=t(o),c=t(i,!0);e(i),e(o),D(()=>f(c,s(b))),v(a,o)};q(ne,a=>{s(b)&&a(ye)})}var W=r(ne,2),we=r(t(W),2);{var Ce=a=>{var o=ot();v(a,o)},Ae=a=>{var o=He(),i=ae(o);{var c=k=>{var _=rt();v(k,_)},j=k=>{var _=it(),m=t(_),S=r(t(m));Qe(S,21,()=>s(L),A=>A.id,(A,p)=>{var l=nt(),d=t(l),w=t(d,!0);e(d);var g=r(d),T=t(g),E=t(T,!0);e(T),e(g);var P=r(g),F=t(P),ee=t(F,!0);e(F),e(P);var G=r(P),u=t(G,!0);e(G);var R=r(G),De=t(R,!0);e(R);var te=r(R),Ue=t(te,!0);e(te);var ke=r(te),Be=t(ke);{var Fe=H=>{var K=lt();K.__click=()=>be(s(p)),v(H,K)};q(Be,H=>{s(p).status==="active"&&H(Fe)})}e(ke),e(l),D((H,K)=>{f(w,s(p).name),f(E,s(p).tokenPrefix),We(F,1,`status-badge ${s(p).status??""}`,"svelte-qkx10j"),f(ee,s(p).status),f(u,H),f(De,K),f(Ue,s(p).usageCount)},[()=>oe(s(p).createdAt),()=>oe(s(p).lastUsedAt)]),v(A,l)}),e(S),e(m),e(_),v(k,_)};q(i,k=>{s(L).length===0?k(c):k(j,!1)},!0)}v(a,o)};q(we,a=>{s(V)?a(Ce):a(Ae,!1)})}e(W);var ie=r(W,2),Z=r(t(ie),6),Te=r(t(Z),2);Te.textContent="https://us-central1-webfootprint-6a34f.cloudfunctions.net/apiGenerateImage",e(Z);var $=r(Z,4),ce=r(t($),2),Pe=t(ce);Pe.textContent=`curl -X POST 'https://us-central1-webfootprint-6a34f.cloudfunctions.net/apiGenerateImage' \\ 2 -H 'Content-Type: application/json' \\ 3 -H 'Authorization: Bearer YOUR_TOKEN' \\ 4 -d '{"prompt": "A futuristic cityscape at sunset", "model": "gpt-image-1.5", "aspectRatio": "16:9"}'`,e(ce),e($);var ve=r($,2),de=r(t(ve),2),Re=t(de);Re.textContent=`{ 5 "success": true, 6 "image": "<base64 encoded image data>", 7 "mimeType": "image/png", 8 "model": "gpt-image-1.5", 9 "revisedPrompt": "..." 10}`,e(de),Xe(2),e(ve),e(ie),e(z);var ue=r(z,2);{var Ie=a=>{var o=dt();o.__click=U,o.__keydown=l=>l.key==="Escape"&&U();var i=t(o);i.__click=l=>l.stopPropagation(),i.__keydown=l=>l.key==="Escape"&&U();var c=t(i),j=t(c),k=t(j,!0);e(j);var _=r(j,2);_.__click=U,e(c);var m=r(c,2),S=t(m);{var A=l=>
10{var d=ct(),w=r(ae(d),2),g=t(w),T=t(g,!0);e(g);var E=r(g,2);E.__click=he,e(w),D(()=>f(T,s(y))),v(l,d)},p=l=>{var d=vt(),w=t(d),g=r(t(w),2);et(g),e(w);var T=r(w,2),E=t(T);E.__click=U;var P=r(E,2),F=t(P);{var ee=u=>{var R=M("Creating...");v(u,R)},G=u=>{var R=M("Create token");v(u,R)};q(F,u=>{s(N)?u(ee):u(G,!1)})}e(P),e(T),e(d),D(u=>P.disabled=u,[()=>s(N)||!s(C).trim()]),Ne("submit",d,u=>{u.preventDefault(),fe()}),tt(g,()=>s(C),u=>n(C,u)),v(l,d)};q(S,l=>{s(y)?l(A):l(p,!1)})}e(m),e(i),e(o),D(()=>f(k,s(y)?"Token created":"Create API token")),v(a,o)};q(ue,a=>{s(J)&&a(Ie)})}var Se=r(ue,2);{var Ee=a=>{var o=ut();o.__click=B,o.__keydown=l=>l.key==="Escape"&&B();var i=t(o);i.__click=l=>l.stopPropagation(),i.__keydown=l=>l.key==="Escape"&&B();var c=r(t(i),2),j=t(c);e(c);var k=r(c,2),_=t(k);_.__click=B;var m=r(_,2);m.__click=je;var S=t(m);{var A=l=>{var d=M("Revoking...");v(l,d)},p=l=>{var d=M("Revoke");v(l,d)};q(S,l=>{s(O)?l(A):l(p,!1)})}e(m),e(k),e(i),e(o),D(()=>{f(j,`"${s(I).name??""}" will stop working. Any platform using this token will get 401 errors. This cannot be undone.`),m.disabled=s(O)}),v(a,o)};q(Se,a=>{s(X)&&s(I)&&a(Ee)})}v(pe,re),Je()}Ge(["click","keydown"]);export{ht as component};
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.