1import{_ as q}from"../chunks/PPVm8Dsz.js";import{i as U}from"../chunks/BPfclWvH.js";import{ah as B,a2 as F,ao as G,_ as M,aj as V,ap as Z,a4 as P,s as o,a9 as s,a6 as L,ar as H,a as r,a8 as w,a3 as J,e as Q,ad as n,al as y,af as I,ac as W,ae as i}from"../chunks/Vnp9ZWRY.js";import{h as X}from"../chunks/Tx4HKmpe.js";import{s as ee,r as te}from"../chunks/Bf3u7tR4.js";import{b as ae}from"../chunks/72Mu8gdO.js";import{b as se}from"../chunks/CdaDeJQt.js";import{g as oe}from"../chunks/CRr8_7X8.js";const re=""+new URL("../assets/swagger-ui.DGtZjYem.css",import.meta.url).href;var ne=P('<button type="button" class="btn-secondary svelte-1h1de0f">Clear</button>'),ie=P('<div class="error-state svelte-1h1de0f"> </div>'),le=P('<div class="docs-page svelte-1h1de0f"><header class="page-header svelte-1h1de0f"><a href="/admin/api" class="back-link svelte-1h1de0f">â API tokens</a> <h1 class="svelte-1h1de0f">Affiliate API</h1> <p class="svelte-1h1de0f">Paste a token with the <code>affiliates</code> scope, then use "Try it out" on any endpoint. The token is kept for this browser tab only.</p></header> <form class="token-bar svelte-1h1de0f"><label for="api-token" class="sr-only svelte-1h1de0f">API token</label> <input id="api-token" type="password" autocomplete="off" placeholder="wfp_â¦" class="svelte-1h1de0f"/> <button type="submit" class="btn-primary svelte-1h1de0f"> </button> <!></form> <p class="spec-link svelte-1h1de0f">Spec: <a target="_blank" rel="noopener noreferrer" class="svelte-1h1de0f"> </a></p> <!> <div class="swagger-wrap svelte-1h1de0f"><div></div></div></div>');function _e($,j){F(j,!0);const E=G("adminAuth"),C="https://us-central1-webfootprint-6a34f.cloudfunctions.net/affiliateApi",p=`${C}/openapi.json`,m="wfp-affiliate-api-token";let _,c=null,d=null,l=y(""),f=y(!1),b=y(null);M(()=>{E.loading||E.isAdmin||oe("/admin")}),V(async()=>{d=document.createElement("link"),d.rel="stylesheet",d.href=re,document.head.appendChild(d);try{const[{default:e},a]=await Promise.all([q(()=>import("../chunks/CgP-YqFN.js").then(t=>t.s),[],import.meta.url),fetch(p).then(t=>{if(!t.ok)throw new Error(`Spec request failed: ${t.status}`);return t.json()})]);a.servers=[{url:C}],c=e({spec:a,domNode:_,deepLinking:!1,tryItOutEnabled:!0,persistAuthorization:!1,presets:[e.presets.apis],onComplete:()=>{const t=sessionStorage.getItem(m);t&&(o(l,t,!0),S())}})}catch(e){console.error("Failed to load Swagger UI:",e),o(b,`Could not load the API docs from ${p}.`)}}),Z(()=>{d?.remove()});function S(){const e=r(l).trim();!c||!e||(c.preauthorizeApiKey("bearerAuth",e),sessionStorage.setItem(m,e),o(f,!0))}function D(){c?.authActions.logout(["bearerAuth"]),sessionStorage.removeItem(m),o(l,""),o(f,!1)}var g=le();X("1h1de0f",e=>{Q(()=>{W.title="Affiliate API docs | Admin"})});var u=s(n(g),2),v=s(n(u),2);te(v),v.__input=()=>o(f,!1);var h=s(v,2),R=n(h,!0);i(h);var K=s(h,2);{var O=e=>{var a=ne();a.__click=D,w(e,a)};U(K,e=>{r(f)&&e(O)})}i(u);var k=s(u,2),A=s(n(k)),z=n(A,!0);i(A),i(k);var x=s(k,2);{var N=e=>{var a=ie(),t=n(a,!0);i(a),L(()=>I(t,r(b))),w(e,a)};U(x,e=>{r(b)&&e(N)})}var T=s(x,2),Y=n(T);se(Y,e=>_=e,()=>_),i(T),i(g),L(e=>{h.disabled=e,I(R,r(f)?"Token applied":"Use token"),ee(A,"href",p),I(z,p)},[()=>!r(l).trim()]),H("submit",u,e=>{e.preventDefault(),S()}),ae(v,()=>r(l),e=>o(l,e)),w($,g),J()}B(["input","click"]);export{_e 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.