@kingsleyweb/bun-ui 3.0.0-rc.1 → 3.0.0-rc.2
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/docs/assets/main-0rchxtv5.js +18 -0
- package/dist/docs/assets/{main-pgxtmtja.js.map → main-0rchxtv5.js.map} +1 -1
- package/dist/docs/manifest.json +5 -5
- package/dist/jobs/assets/AddFlowDialog-h6xkgx9b.js +6 -0
- package/dist/jobs/assets/{AddFlowDialog-0ec5ff4r.js.map → AddFlowDialog-h6xkgx9b.js.map} +1 -1
- package/dist/jobs/assets/added-cbwsxv3e.js +4 -0
- package/dist/jobs/assets/{added-ma7xb2dx.js.map → added-cbwsxv3e.js.map} +1 -1
- package/dist/jobs/assets/{channel-a5chwqet.js → channel-tgkvqm8y.js} +3 -3
- package/dist/jobs/assets/{channel-a5chwqet.js.map → channel-tgkvqm8y.js.map} +1 -1
- package/dist/jobs/assets/{channelChecks-1epbhv9a.js → channelChecks-s4yz4yhw.js} +3 -3
- package/dist/jobs/assets/{channelChecks-1epbhv9a.js.map → channelChecks-s4yz4yhw.js.map} +1 -1
- package/dist/jobs/assets/index-09z2cjft.js +4 -0
- package/dist/jobs/assets/{index-m7zk18cj.js.map → index-09z2cjft.js.map} +1 -1
- package/dist/jobs/assets/index-47pxmyxn.js +4 -0
- package/dist/jobs/assets/{index-c7qk888t.js.map → index-47pxmyxn.js.map} +1 -1
- package/dist/jobs/assets/index-4e55z986.js +4 -0
- package/dist/jobs/assets/{index-7kbae3pm.js.map → index-4e55z986.js.map} +1 -1
- package/dist/jobs/assets/index-5c933424.js +4 -0
- package/dist/jobs/assets/{index-xfq292gs.js.map → index-5c933424.js.map} +1 -1
- package/dist/jobs/assets/index-d5r5n0mm.js +4 -0
- package/dist/jobs/assets/{index-j3h4v03g.js.map → index-d5r5n0mm.js.map} +3 -3
- package/dist/jobs/assets/index-hs60b25v.js +10 -0
- package/dist/jobs/assets/{index-y5zw06cs.js.map → index-hs60b25v.js.map} +1 -1
- package/dist/jobs/assets/index-k2smrr70.js +4 -0
- package/dist/jobs/assets/{index-de1fgbgf.js.map → index-k2smrr70.js.map} +1 -1
- package/dist/jobs/assets/index-q24jw3w9.js +4 -0
- package/dist/jobs/assets/{index-pjtmzrcd.js.map → index-q24jw3w9.js.map} +1 -1
- package/dist/jobs/assets/index-rtynx6wj.js +4 -0
- package/dist/jobs/assets/{index-mykmd5cv.js.map → index-rtynx6wj.js.map} +1 -1
- package/dist/jobs/assets/{live-erz9pvnm.js → live-6k7s6358.js} +3 -3
- package/dist/jobs/assets/{live-erz9pvnm.js.map → live-6k7s6358.js.map} +1 -1
- package/dist/jobs/assets/{main-smabxbn4.js → main-0jmeh6mq.js} +4 -4
- package/dist/jobs/assets/{main-smabxbn4.js.map → main-0jmeh6mq.js.map} +1 -1
- package/dist/jobs/assets/main-3yj6bv90.js +5 -0
- package/dist/jobs/assets/{main-yg6scp84.js.map → main-3yj6bv90.js.map} +1 -1
- package/dist/jobs/assets/main-4g69fn3x.js +5 -0
- package/dist/jobs/assets/{main-v2f8a4g3.js.map → main-4g69fn3x.js.map} +1 -1
- package/dist/jobs/assets/{main-e8zsqez2.js → main-4gte3eqq.js} +4 -4
- package/dist/jobs/assets/{main-e8zsqez2.js.map → main-4gte3eqq.js.map} +1 -1
- package/dist/jobs/assets/{main-zk3n47nq.js → main-4j1fcevh.js} +3 -3
- package/dist/jobs/assets/{main-zk3n47nq.js.map → main-4j1fcevh.js.map} +1 -1
- package/dist/jobs/assets/main-5grjvsy7.js +5 -0
- package/dist/jobs/assets/{main-3xxhy5jh.js.map → main-5grjvsy7.js.map} +1 -1
- package/dist/jobs/assets/{main-gzppw8ng.js → main-5zbx60gq.js} +3 -3
- package/dist/jobs/assets/{main-gzppw8ng.js.map → main-5zbx60gq.js.map} +1 -1
- package/dist/jobs/assets/{main-zx20z2e9.js → main-9prgjhg4.js} +4 -4
- package/dist/jobs/assets/{main-zx20z2e9.js.map → main-9prgjhg4.js.map} +1 -1
- package/dist/jobs/assets/main-a250ffk7.js +17 -0
- package/dist/jobs/assets/{main-xf44bv26.js.map → main-a250ffk7.js.map} +4 -4
- package/dist/jobs/assets/{main-qahvywvw.js → main-d6ge7w08.js} +4 -4
- package/dist/jobs/assets/{main-qahvywvw.js.map → main-d6ge7w08.js.map} +1 -1
- package/dist/jobs/assets/{main-kjywj2zd.js → main-gngzht43.js} +3 -3
- package/dist/jobs/assets/{main-kjywj2zd.js.map → main-gngzht43.js.map} +1 -1
- package/dist/jobs/assets/main-hg0hrg8j.js +5 -0
- package/dist/jobs/assets/{main-yjykmsvp.js.map → main-hg0hrg8j.js.map} +1 -1
- package/dist/jobs/assets/main-hm1ng3yg.js +5 -0
- package/dist/jobs/assets/{main-9qd3nqs5.js.map → main-hm1ng3yg.js.map} +1 -1
- package/dist/jobs/assets/main-jkvd92z9.js +5 -0
- package/dist/jobs/assets/{main-fcq7hfk0.js.map → main-jkvd92z9.js.map} +1 -1
- package/dist/jobs/assets/main-jv5xqd13.js +5 -0
- package/dist/jobs/assets/{main-grcj8v1z.js.map → main-jv5xqd13.js.map} +7 -7
- package/dist/jobs/assets/main-jxre7w93.js +5 -0
- package/dist/jobs/assets/{main-47391fgm.js.map → main-jxre7w93.js.map} +4 -4
- package/dist/jobs/assets/{main-b35rfpdf.js → main-kwmqkjfx.js} +4 -4
- package/dist/jobs/assets/{main-b35rfpdf.js.map → main-kwmqkjfx.js.map} +1 -1
- package/dist/jobs/assets/main-n9cf6bxm.js +5 -0
- package/dist/jobs/assets/{main-vargz49c.js.map → main-n9cf6bxm.js.map} +1 -1
- package/dist/jobs/assets/{main-6xdkyzv1.js → main-pegp0ygb.js} +2 -2
- package/dist/jobs/assets/{main-2n5wnj51.js → main-qr573853.js} +3 -3
- package/dist/jobs/assets/{main-2n5wnj51.js.map → main-qr573853.js.map} +1 -1
- package/dist/jobs/assets/main-rq97rdr4.js +4 -0
- package/dist/jobs/assets/{main-7jzem39c.js.map → main-rq97rdr4.js.map} +1 -1
- package/dist/jobs/assets/main-szjdmydc.js +5 -0
- package/dist/jobs/assets/{main-pqke97qp.js.map → main-szjdmydc.js.map} +1 -1
- package/dist/jobs/assets/{main-jex4pqaa.js → main-tnbhrm9n.js} +5 -5
- package/dist/jobs/assets/{main-jex4pqaa.js.map → main-tnbhrm9n.js.map} +1 -1
- package/dist/jobs/assets/main-ts19j4n0.js +5 -0
- package/dist/jobs/assets/{main-eekxtm5w.js.map → main-ts19j4n0.js.map} +1 -1
- package/dist/jobs/assets/{main-fn8r2zyb.js → main-w93x1dzs.js} +4 -4
- package/dist/jobs/assets/{main-fn8r2zyb.js.map → main-w93x1dzs.js.map} +1 -1
- package/dist/jobs/assets/sections-0y7w4fb4.js +4 -0
- package/dist/jobs/assets/{sections-b570mm22.js.map → sections-0y7w4fb4.js.map} +1 -1
- package/dist/jobs/assets/{sse-42e8mhar.js → sse-mn0t0fh7.js} +4 -4
- package/dist/jobs/assets/{sse-42e8mhar.js.map → sse-mn0t0fh7.js.map} +1 -1
- package/dist/jobs/assets/{sseChecks-0jskzcs1.js → sseChecks-t7tcm7ra.js} +3 -3
- package/dist/jobs/assets/{sseChecks-0jskzcs1.js.map → sseChecks-t7tcm7ra.js.map} +1 -1
- package/dist/jobs/assets/validation-ysjfy072.js +4 -0
- package/dist/jobs/assets/{validation-199pberh.js.map → validation-ysjfy072.js.map} +1 -1
- package/dist/jobs/manifest.json +213 -213
- package/package.json +10 -6
- package/dist/docs/assets/main-pgxtmtja.js +0 -18
- package/dist/jobs/assets/AddFlowDialog-0ec5ff4r.js +0 -6
- package/dist/jobs/assets/added-ma7xb2dx.js +0 -4
- package/dist/jobs/assets/index-7kbae3pm.js +0 -4
- package/dist/jobs/assets/index-c7qk888t.js +0 -4
- package/dist/jobs/assets/index-de1fgbgf.js +0 -4
- package/dist/jobs/assets/index-j3h4v03g.js +0 -4
- package/dist/jobs/assets/index-m7zk18cj.js +0 -4
- package/dist/jobs/assets/index-mykmd5cv.js +0 -4
- package/dist/jobs/assets/index-pjtmzrcd.js +0 -4
- package/dist/jobs/assets/index-xfq292gs.js +0 -4
- package/dist/jobs/assets/index-y5zw06cs.js +0 -10
- package/dist/jobs/assets/main-3xxhy5jh.js +0 -5
- package/dist/jobs/assets/main-47391fgm.js +0 -5
- package/dist/jobs/assets/main-7jzem39c.js +0 -4
- package/dist/jobs/assets/main-9qd3nqs5.js +0 -5
- package/dist/jobs/assets/main-eekxtm5w.js +0 -5
- package/dist/jobs/assets/main-fcq7hfk0.js +0 -5
- package/dist/jobs/assets/main-grcj8v1z.js +0 -5
- package/dist/jobs/assets/main-pqke97qp.js +0 -5
- package/dist/jobs/assets/main-v2f8a4g3.js +0 -5
- package/dist/jobs/assets/main-vargz49c.js +0 -5
- package/dist/jobs/assets/main-xf44bv26.js +0 -17
- package/dist/jobs/assets/main-yg6scp84.js +0 -5
- package/dist/jobs/assets/main-yjykmsvp.js +0 -5
- package/dist/jobs/assets/sections-b570mm22.js +0 -4
- package/dist/jobs/assets/validation-199pberh.js +0 -4
- /package/dist/jobs/assets/{main-6xdkyzv1.js.map → main-pegp0ygb.js.map} +0 -0
|
@@ -1,10 +0,0 @@
|
|
|
1
|
-
import{B,q,D,c,g,T,r,Ur,Rn,wt,ht,er,n,e,t,pe,s,m,et,J,i,ge,de,nt,b,cr,d,f,R,x}from"./main-xf44bv26.js";import{vt,Vt}from"./main-e8zsqez2.js";function Or(o){return o.split(/(`[^`]+`)/).map((a,l)=>a.length>2&&a.startsWith("`")&&a.endsWith("`")?e("code",{children:a.slice(1,-1)},l):a)}function ie({text:o,className:a}){let l=o.split(/\n\s*\n/).filter((u)=>u.trim()!=="");return e(n,{children:l.map((u,p)=>e("p",{className:a,children:Or(u)},p))})}var Et=24;function H(o){return typeof o==="object"&&o!==null&&!Array.isArray(o)}function Zt(o){let a=o;try{a=decodeURIComponent(o)}catch{}return a.replace(/~1/g,"/").replace(/~0/g,"~")}function qe(o,a){if(a==="#")return o;if(!a.startsWith("#/"))return;let l=o;for(let u of a.slice(2).split("/")){let p=Zt(u);if(Array.isArray(l)){let y=Number(p);l=Number.isInteger(y)?l[y]:void 0}else if(H(l)&&Object.hasOwn(l,p))l=l[p];else return}return l}function Oe(o){let a=o.split("/");return Zt(a[a.length-1]??o)||o}function Ee(o){return H(o)&&typeof o.$ref==="string"?o.$ref:void 0}function ue(o,a){let l=[],u=o;for(;;){let p=Ee(u);if(p===void 0)break;if(l.includes(p))return{schema:void 0,refs:l,cycle:!0};l.push(p),u=qe(a,p)}if(typeof u==="boolean"||H(u))return{schema:u,refs:l,cycle:!1};return{schema:void 0,refs:l,cycle:!1}}function Se(o){let{type:a}=o;if(typeof a==="string")return[a];return Array.isArray(a)?a.filter((l)=>typeof l==="string"):[]}function Me(o){if(o===void 0)return"undefined";let a=JSON.stringify(o);return a.length>80?`${a.slice(0,77)}…`:a}function en(o,a){let l=o[a];return Array.isArray(l)?l:[]}function We(o,a,l=0){if(o===!0)return"any";if(o===!1)return"never";if(!H(o))return"any";let u=Ee(o);if(u!==void 0)return Oe(u);let p=Se(o);if(p.length>0){let y=p.map((h)=>{if(h==="array"&&l<2){let{items:v}=o;return v===void 0?"array":`array<${We(v,a,l+1)}>`}return h});if(o.nullable===!0&&!y.includes("null"))y.push("null");return y.join(" | ")}if(Object.hasOwn(o,"const"))return Me(o.const);if(Array.isArray(o.enum)){let y=o.enum.slice(0,6).map(Me);return o.enum.length>6?`${y.join(" | ")} | …`:y.join(" | ")}for(let y of["oneOf","anyOf","allOf"]){let h=en(o,y);if(h.length>0){if(y!=="allOf"&&h.length<=3&&l<2)return h.map((v)=>We(v,a,l+1)).join(" | ");return`${y}(${h.length})`}}if(H(o.properties)||o.additionalProperties!==void 0)return"object";if(o.items!==void 0)return"array";if(o.not!==void 0)return"not";return"any"}var Er=[["format","format"],["const","const"],["enum","one of"],["default","default"],["minimum","min"],["exclusiveMinimum","above"],["maximum","max"],["exclusiveMaximum","below"],["multipleOf","multiple of"],["minLength","min length"],["maxLength","max length"],["pattern","pattern"],["minItems","min items"],["maxItems","max items"],["uniqueItems","unique items"],["minProperties","min fields"],["maxProperties","max fields"],["contentMediaType","media type"],["contentEncoding","encoding"]];function _e(o){if(!H(o))return[];let a=[],l=Se(o).length>0;for(let[u,p]of Er){if(!Object.hasOwn(o,u))continue;if((u==="enum"||u==="const")&&!l)continue;let y=o[u];if(u==="uniqueItems"&&y!==!0)continue;if(u==="enum"&&Array.isArray(y)){a.push({key:u,label:p,value:y.map(Me).join(", ")});continue}a.push({key:u,label:p,value:typeof y==="string"&&u!=="default"&&u!=="const"?y:Me(y)})}if(Array.isArray(o.examples)&&o.examples.length>0)a.push({key:"examples",label:"examples",value:o.examples.map(Me).join(", ")});else if(Object.hasOwn(o,"example"))a.push({key:"example",label:"example",value:Me(o.example)});if(o.nullable===!0)a.push({key:"nullable",label:"nullable",value:"yes"});if(o.deprecated===!0)a.push({key:"deprecated",label:"deprecated",value:"yes"});if(o.readOnly===!0)a.push({key:"readOnly",label:"read only",value:"yes"});if(o.writeOnly===!0)a.push({key:"writeOnly",label:"write only",value:"yes"});return a}function ot(o){if(!H(o)||!Object.hasOwn(o,"additionalProperties"))return null;let a=o.additionalProperties;if(a===!1)return"closed";if(a===!0||H(a)&&Object.keys(a).length===0)return"any";return"typed"}function Dt(o){if(!H(o))return[];let a=[],l=new Set(Array.isArray(o.required)?o.required.filter((u)=>typeof u==="string"):[]);if(H(o.properties))for(let[u,p]of Object.entries(o.properties))a.push({key:`p:${u}`,kind:"property",label:u,schema:p,required:l.has(u)});if(H(o.patternProperties))for(let[u,p]of Object.entries(o.patternProperties))a.push({key:`pp:${u}`,kind:"patternProperty",label:`/${u}/`,schema:p,required:!1});if(ot(o)==="typed")a.push({key:"additional",kind:"additional",label:"any other field",schema:o.additionalProperties,required:!1});if(Array.isArray(o.prefixItems))o.prefixItems.forEach((u,p)=>{a.push({key:`pi:${p}`,kind:"prefixItems",label:`[${p}]`,schema:u,required:!1})});if(o.items!==void 0&&typeof o.items!=="boolean")a.push({key:"items",kind:"items",label:"[]",schema:o.items,required:!1});for(let u of["oneOf","anyOf","allOf"])en(o,u).forEach((p,y)=>{a.push({key:`${u}:${y}`,kind:u,label:u==="allOf"?`Part ${y+1}`:`Option ${y+1}`,schema:p,required:!1})});if(o.not!==void 0)a.push({key:"not",kind:"not",label:"not",schema:o.not,required:!1});return a}var tn={oneOf:"Exactly one of",anyOf:"Any of",allOf:"All of"};function U(...o){return o.filter(Boolean).join(" ")}function he({schema:o,root:a,depth:l=1,onRef:u,label:p="Schema",className:y}){return e("div",{className:U("schema-tree",y),role:"group","aria-label":p,children:e("ul",{className:"schema-list",children:e(nn,{child:null,schema:o,root:a,level:0,depth:l,refChain:[],onRef:u})})})}function Dr({refValue:o,onRef:a}){let l=Oe(o);if(!a)return e("code",{className:"schema-ref",title:o,children:l});return e("button",{type:"button",className:"schema-ref schema-ref-link",title:`Open ${o}`,onClick:()=>a(o,l),children:l})}function Ar(o,a){let l=_e({...o,$ref:void 0}),u=new Set(l.map((p)=>p.key));return[..._e(a).filter((p)=>!u.has(p.key)),...l]}function nn({child:o,schema:a,root:l,level:u,depth:p,refChain:y,onRef:h}){let v=Ee(a),k=ue(a,l),w=k.schema,N=k.cycle||k.refs.some((_)=>y.includes(_)),S=v!==void 0&&w===void 0&&!N,C=N||u>=Et?[]:Dt(w),[P,j]=r(u<p),L=H(a)?a:{},O=typeof L.description==="string"?L.description:H(w)&&typeof w.description==="string"?w.description:void 0,F=v===void 0?_e(a):Ar(L,w),V=v===void 0?We(a,l):N||S?null:We(w,l),M=ot(w),K=o?.label??null,te=[...y,...k.refs];return t("li",{className:"schema-node","data-kind":o?.kind??"root",children:[t("div",{className:"schema-row",children:[C.length>0?e("button",{type:"button",className:"schema-toggle","aria-expanded":P,"aria-label":`${P?"Collapse":"Expand"} ${K??"schema"}`,onClick:()=>j((_)=>!_),children:e("span",{"aria-hidden":"true",children:P?"▾":"▸"})}):e("span",{className:"schema-toggle-spacer","aria-hidden":"true"}),K!==null&&e("span",{className:"schema-name",children:K}),o?.required&&e("span",{className:"schema-required",title:"Required",children:"required"}),V!==null&&e("span",{className:"schema-type",children:V}),v!==void 0&&e(Dr,{refValue:v,onRef:h}),N&&e("span",{className:"schema-note-inline",title:"This schema contains itself; it is expanded above.",children:"recursive"}),S&&e("span",{className:"schema-note-inline schema-unresolved",children:"unresolved $ref"}),F.map((_)=>t("span",{className:"schema-fact","data-fact":_.key,children:[e("span",{className:"schema-fact-label",children:_.label})," ",e("code",{children:_.value})]},_.key))]}),O!==void 0&&e("div",{className:"schema-description",children:e(ie,{text:O})}),M==="closed"&&e("p",{className:"schema-closed","data-testid":"schema-closed",children:"No other fields: any field not listed is refused."}),M==="any"&&e("p",{className:"schema-open",children:"Other fields: any value."}),P&&C.length>0&&e("ul",{className:"schema-list",children:C.map((_,Y)=>{let X=C[Y-1],fe=(_.kind==="oneOf"||_.kind==="anyOf"||_.kind==="allOf")&&X?.kind!==_.kind;return e(Ir,{item:_,heading:fe?tn[_.kind]:void 0,root:l,level:u+1,depth:p,refChain:te,onRef:h},_.key)})})]})}function Ir({item:o,heading:a,...l}){return t(n,{children:[a!==void 0&&e("li",{className:"schema-composition",children:a}),e(nn,{...l,child:o,schema:o.schema})]})}function De(o,a,l=[]){let{schema:u,refs:p,cycle:y}=ue(o,a);if(y||p.some((w)=>l.includes(w)))return null;if(!H(u))return null;let h=[...l,...p];if(Object.hasOwn(u,"default"))return structuredClone(u.default);if(Object.hasOwn(u,"const"))return structuredClone(u.const);if(Array.isArray(u.enum)&&u.enum.length>0)return structuredClone(u.enum.find((w)=>w!==null)??null);if(Array.isArray(u.allOf)&&u.allOf.length>0){let w={};for(let N of u.allOf){let S=De(N,a,h);if(H(S))Object.assign(w,S)}return w}for(let w of["oneOf","anyOf"]){let N=u[w];if(Array.isArray(N)&&N.length>0){let S=N.find((C)=>{let P=ue(C,a).schema;return!(H(P)&&Se(P).length===1&&Se(P)[0]==="null")})??N[0];return De(S,a,h)}}switch(Se(u).filter((w)=>w!=="null")[0]??(H(u.properties)?"object":u.items?"array":void 0)){case"object":{let w={},N=H(u.properties)?u.properties:{},S=Array.isArray(u.required)?u.required:[];for(let C of S)if(typeof C==="string")w[C]=De(N[C],a,h);return w}case"array":return(typeof u.minItems==="number"?u.minItems:0)>0?[De(u.items,a,h)]:[];case"string":return"";case"integer":case"number":return typeof u.minimum==="number"?u.minimum:0;case"boolean":return!1;default:return null}}var it=["x-bun-common","x-bun-jobs"];function Ve(o,a,l){for(let u of l){let p=`${u}-${a}`;if(Object.hasOwn(o,p))return o[p]}return}var $r=["get","put","post","delete","options","head","patch","trace"];function ee(o){return typeof o==="string"?o:void 0}function at(o){return Array.isArray(o)?o.filter((a)=>typeof a==="string"):[]}function ct(o,a){let l=Ee(a);if(l===void 0)return{node:H(a)?a:void 0};let u=ue(a,o).schema;return{node:H(u)?u:void 0,ref:l}}function rn(o){if(!H(o))return[];return Object.entries(o).map(([a,l])=>({contentType:a,schema:H(l)?l.schema:void 0}))}function Lr(o,a){let{node:l}=ct(o,a),u=ee(l?.name),p=ee(l?.in);if(!l||u===void 0||p!=="path"&&p!=="query"&&p!=="header"&&p!=="cookie")return;return{name:u,in:p,required:p==="path"||l.required===!0,description:ee(l.description),schema:l.schema,style:ee(l.style),explode:typeof l.explode==="boolean"?l.explode:void 0,deprecated:l.deprecated===!0}}function Mr(o){if(!H(o))return;return{header:ee(o.header)??null,requireJson:o.requireJson===!0}}function Wr(o,a,l,u,p,y){let h=new Map;for(let w of[...p,...Array.isArray(u.parameters)?u.parameters:[]]){let N=Lr(o,w);if(N)h.set(`${N.in}:${N.name}`,N)}let v=ct(o,u.requestBody).node,k=[];if(H(u.responses))for(let[w,N]of Object.entries(u.responses)){let{node:S,ref:C}=ct(o,N);k.push({status:w,description:ee(S?.description)??"",content:rn(S?.content),codes:at(S===void 0?void 0:Ve(S,"codes",y)),...C?{ref:C}:{}})}return{id:ee(u.operationId)??`${l.toUpperCase()} ${a}`,method:l.toUpperCase(),path:a,summary:ee(u.summary),description:ee(u.description),tags:at(u.tags),deprecated:u.deprecated===!0,parameters:[...h.values()],requestBody:v?{required:v.required===!0,description:ee(v.description),content:rn(v.content)}:void 0,responses:k,action:ee(Ve(u,"action",y)),mutation:Ve(u,"mutation",y)===!0,requires:at(Ve(u,"requires",y)),csrf:Mr(Ve(u,"csrf",y))}}function on(o,a={}){let l=a.extensions??it,u=[];if(!H(o.paths))return u;for(let[p,y]of Object.entries(o.paths)){let h=ct(o,y).node;if(!h)continue;let v=Array.isArray(h.parameters)?h.parameters:[];for(let k of $r){let w=h[k];if(H(w))u.push(Wr(o,p,k,w,v,l))}}return u}function an(o){let a=H(o.info)?o.info:{},l=Array.isArray(o.servers)?o.servers.flatMap((u)=>{let p=H(u)?ee(u.url):void 0;return p===void 0?[]:[{url:p,description:ee(u.description)}]}):[];return{openapi:ee(o.openapi)??"",title:ee(a.title)??"API",version:ee(a.version)??"",description:ee(a.description),servers:l.length>0?l:[{url:"/"}]}}function cn(o,a){let l=new Map;if(Array.isArray(o.tags))for(let y of o.tags){let h=H(y)?ee(y.name):void 0;if(h!==void 0&&!l.has(h))l.set(h,{name:h,description:ee(y.description),operations:[]})}let u=[];for(let y of a){if(y.tags.length===0)u.push(y);for(let h of y.tags){let v=l.get(h);if(!v)v={name:h,operations:[]},l.set(h,v);v.operations.push(y)}}let p=[...l.values()].filter((y)=>y.operations.length>0);if(u.length>0)p.push({name:"Other",operations:u});return p}function lt(o){let a=new Map;return o.map((l,u)=>{let p=(a.get(l.name)??0)+1;return a.set(l.name,p),{key:p===1?l.name:`${l.name}#${p}`,index:u,section:l}})}var sn="Other";function At(o,a){let l=o["x-tagGroups"];if(!Array.isArray(l))return;let u=l.flatMap((k)=>{if(!H(k))return[];let w=ee(k.name);return w===void 0||!Array.isArray(k.tags)?[]:[{name:w,tags:at(k.tags)}]});if(u.length===0)return;let p=new Map(a.map((k)=>[k.name,k])),y=new Set,h=[];for(let{name:k,tags:w}of u){let N={name:k,tags:[]};for(let S of w){let C=p.get(S);if(C&&!N.tags.includes(C))N.tags.push(C),y.add(S)}h.push(N)}let v=a.filter((k)=>!y.has(k.name));if(v.length>0){let k=h.find((w)=>w.name===sn);if(k)k.tags.push(...v);else h.push({name:sn,tags:v})}return h.filter((k)=>k.tags.length>0)}function qr(o,a){let l=a.toLowerCase().split(/\s+/).filter(Boolean);if(l.length===0)return!0;let u=[o.method,o.path,o.id,o.summary??"",o.action??""].join(" ").toLowerCase();return l.every((p)=>u.includes(p))}function ln(o,a){return o.map((l)=>({...l,operations:l.operations.filter((u)=>qr(u,a))})).filter((l)=>l.operations.length>0)}function It(o,a,l){let u=/^https?:\/\//.test(a)?new URL(a).origin:l;try{return new URL(o,`${u}/`).href.replace(/\/$/,"")}catch{return o}}function dn(o){let a=qe(o,"#/components/schemas");return H(a)?Object.keys(a):[]}function un(o){switch(o){case"GET":return"info";case"POST":return"success";case"PUT":case"PATCH":return"warning";case"DELETE":return"danger";default:return"neutral"}}function pn(o){return o.responses.map((a)=>a.status).filter((a)=>/^2\d\d$/.test(a))}var dt=new Set(["POST","PUT","PATCH","DELETE"]),ut=new Set(["POST","PUT","PATCH"]);class ye extends Error{kind;status;code;title;detail;type;issues;context;instance;constructor(o){super(o.detail??o.title,{cause:o.cause});this.name="ApiError",this.kind=o.kind,this.status=o.status,this.code=o.code,this.title=o.title,this.detail=o.detail,this.type=o.type,this.issues=o.issues??[],this.context=o.context??{},this.instance=o.instance}static fromProblem(o){return new ye({kind:"problem",status:o.status,code:o.code,title:o.title,detail:o.detail,type:o.type,issues:o.issues,context:o.context,instance:o.instance})}get isAuth(){return this.status===401||this.status===403}}function Be(o){return o instanceof ye}function mn(o){if(typeof o!=="object"||o===null)return!1;let a=o;return typeof a.status==="number"&&typeof a.code==="string"&&typeof a.title==="string"}var Mt="1";function Wt(o){if(!o)return"";let a=new URLSearchParams;for(let[u,p]of Object.entries(o)){if(p===void 0||p===null)continue;if(Array.isArray(p)){let y=p;if(y.length===0)a.append(u,"");for(let h of y)a.append(u,String(h));continue}a.append(u,String(p))}let l=a.toString();return l?`?${l}`:""}function hn(o){return encodeURIComponent(o)}function $t(o){let a=o.split(";")[0]?.trim().toLowerCase()??"";return a==="application/json"||a.endsWith("+json")}function jr(o,a){return a?.aborted===!0||o instanceof Error&&o.name==="AbortError"||typeof DOMException<"u"&&o instanceof DOMException&&o.name==="AbortError"}function Lt(o){try{return{value:JSON.parse(o)}}catch{return}}function fn(o,a,l){let u=$t(o.headers.get("content-type")??"")?Lt(a):void 0;if(u&&mn(u.value))return ye.fromProblem({...u.value,status:o.status});let p=a.trim().slice(0,300);return new ye({kind:"http",status:o.status,code:`HTTP_${o.status}`,title:o.statusText||`Request failed (${o.status})`,detail:p||void 0,instance:l})}function qt(o){let a=o.base.replace(/\/+$/,"");function l(h,v,{query:k,body:w,signal:N}){let C=`${/^https?:\/\//.test(v)?v:`${a}${v}`}${Wt(k)}`,P={Accept:"application/json"};if(ut.has(h))P["Content-Type"]="application/json";if(o.csrfHeader&&dt.has(h))P[o.csrfHeader]=Mt;let j={method:h,headers:P,credentials:"same-origin"};if(w!==void 0)j.body=JSON.stringify(w);if(N)j.signal=N;return{url:C,init:j}}async function u(h,v,k){let w=o.fetch??globalThis.fetch;try{return await w(h,v)}catch(N){if(jr(N,v.signal??void 0))throw N;throw new ye({kind:"network",status:0,code:"NETWORK_ERROR",title:"The server could not be reached",detail:N instanceof Error?N.message:String(N),instance:k,cause:N})}}async function p(h,v,k={}){let{url:w,init:N}=l(h,v,k),S=await u(w,N,v);if(S.status===204||S.status===205)return;let C=await S.text();if(!S.ok)throw fn(S,C,v);if(C==="")return;let P=$t(S.headers.get("content-type")??"")?Lt(C):void 0;if(!P)throw new ye({kind:"parse",status:S.status,code:"INVALID_RESPONSE",title:"The server answered something other than JSON",detail:C.trim().slice(0,300)||void 0,instance:v});return P.value}async function y(h,v,k={}){let{url:w,init:N}=l(h,v,k),S=performance.now(),C=await u(w,N,v),P=C.status===204||C.status===205?"":await C.text(),j=performance.now()-S,L=P!==""&&$t(C.headers.get("content-type")??"")?Lt(P):void 0,O={};for(let[F,V]of[...C.headers.entries()].sort(([M,K])=>M<K?-1:M>K?1:0))O[F.toLowerCase()]=V;return{ok:C.ok,status:C.status,statusText:C.statusText,headers:O,body:L?L.value:P===""?void 0:P,error:C.ok?void 0:fn(C,P,v),durationMs:j}}return{base:a,request:p,requestRaw:y}}var bn=new Set(["GET","POST","PUT","PATCH","DELETE"]),Hr=new Set(["remove","drain","clean","kill","fail"]);function jt(o){return`${o.in}:${o.name}`}function gn(o,a){let l=ue(o,a).schema;if(!H(l))return;return Se(l).find((u)=>u!=="null")}function yn(o,a){let l=ue(o,a).schema;if(!H(l)||!Array.isArray(l.enum))return;return l.enum.filter((u)=>u!==null).map((u)=>String(u))}function Ht(o,a){let l=ue(o.schema,a).schema,u=H(l)?l:{},p=gn(u,a);if(p==="array"){let h=yn(u.items,a);if(h)return{kind:"enum-list",options:h};let v=gn(u.items,a);return{kind:"list",item:v==="integer"||v==="number"?v:"text"}}let y=yn(u,a);if(y)return{kind:"enum",options:y};if(p==="boolean")return{kind:"boolean"};if(p==="integer"||p==="number")return{kind:"number",integer:p==="integer",min:typeof u.minimum==="number"?u.minimum:void 0,max:typeof u.maximum==="number"?u.maximum:void 0};return{kind:"text"}}function Ft(o){return o.parameters.filter((a)=>a.in==="path"||a.in==="query")}function pt(o){let l=o.requestBody?.content.find((u)=>u.contentType==="application/json")?.schema;if(!H(l)||Object.keys(l).every((u)=>u==="description"||u.startsWith("x-")))return;return l}function vn(o,a){let l=pt(o);return l===void 0?"":JSON.stringify(De(l,a),null,2)}function Fr(o,a,l){if(a.kind==="enum-list"){let p=Array.isArray(l)?l:[];return{value:p.length>0?[...p]:void 0}}let u=typeof l==="string"?l.trim():"";if(u==="")return o.required?{error:`${o.name} is required`}:{value:void 0};switch(a.kind){case"number":{let p=Number(u);if(!Number.isFinite(p)||a.integer&&!Number.isInteger(p))return{error:`${o.name} must be ${a.integer?"an integer":"a number"}`};return{value:p}}case"boolean":return u==="true"||u==="false"?{value:u==="true"}:{error:`${o.name} must be true or false`};case"list":{let p=u.split(",").map((h)=>h.trim()).filter(Boolean),y=[];for(let h of p){if(a.item==="text"){y.push(h);continue}let v=Number(h);if(!Number.isFinite(v)||a.item==="integer"&&!Number.isInteger(v))return{error:`${o.name}: "${h}" is not ${a.item==="integer"?"an integer":"a number"}`};y.push(v)}return{value:y.length>0?y:void 0}}default:return{value:u}}}function xn(o,a,l,u){let p={};if(!bn.has(o.method))return{ok:!1,errors:{method:`${o.method} cannot be sent from here`}};let y=o.path,h={};for(let v of Ft(o)){let k=jt(v),w=Fr(v,Ht(v,a),l[k]);if("error"in w){p[k]=w.error;continue}if(v.in==="path")y=y.split(`{${v.name}}`).join(hn(String(w.value)));else if(w.value!==void 0)h[v.name]=w.value}if(u===void 0&&o.requestBody?.required&&pt(o)!==void 0)p.body="A body is required";if(Object.keys(p).length>0)return{ok:!1,errors:p};return{ok:!0,request:{method:o.method,path:y,query:h,body:u}}}function wn(o,a){let l={Accept:"application/json"};if(ut.has(o))l["Content-Type"]="application/json";if(a&&dt.has(o))l[a]=Mt;return l}function kn(o,a){return`${a.replace(/\/+$/,"")}${o.path}${Wt(o.query)}`}function Bt(o){return`'${o.replace(/'/g,"'\\''")}'`}function Nn(o,a){let l=kn(o,a.apiBase),u=/^https?:\/\//.test(l)?l:`${a.origin}${l}`,p=[`curl -X ${o.method} ${Bt(u)}`];for(let[y,h]of Object.entries(wn(o.method,a.csrfHeader)))p.push(` -H ${Bt(`${y}: ${h}`)}`);if(o.body!==void 0)p.push(` --data ${Bt(JSON.stringify(o.body))}`);return["# The browser also sends this site's cookies (credentials: same-origin).","# If the API's authorize reads a session, add it: -b 'name=value'",p.join(" \\\n")].join(`
|
|
2
|
-
`)}function Sn(o,a){let l=wn(o.method,a.csrfHeader),u=Object.entries(l).map(([y,h])=>` ${JSON.stringify(y)}: ${JSON.stringify(h)},`).join(`
|
|
3
|
-
`),p=[`const response = await fetch(${JSON.stringify(kn(o,a.apiBase))}, {`,` method: ${JSON.stringify(o.method)},`," headers: {",u," },",' credentials: "same-origin",'];if(o.body!==void 0)p.push(` body: JSON.stringify(${JSON.stringify(o.body,null,2).replace(/\n/g,`
|
|
4
|
-
`)}),`);return p.push("});","const data = await response.json();"),p.join(`
|
|
5
|
-
`)}function Cn(o){if(o.method==="DELETE")return!0;let a=o.action?.split(".").pop()??"";return Hr.has(a)}function Pn(o,a){if(!bn.has(o.method))return{enabled:!1,reason:`The viewer's client does not send ${o.method}.`};if(o.mutation&&a.readOnly)return{enabled:!1,reason:"This API is read-only: it refuses every change."};if(o.action!==void 0&&!a.permitted)return{enabled:!1,reason:`You do not have the ${o.action} permission.`};return{enabled:!0}}function Tn(o,a){if(o.responses.some((u)=>u.status===String(a)))return;let l=pn(o);return`Not a documented status. Documented success: ${l.length>0?l.join(" / "):"2xx"}.`}function z({tone:o="neutral",title:a,className:l,testId:u,children:p}){return e("span",{className:U("badge",`badge-${o}`,l),title:a,"data-testid":u,children:p})}function G({title:o,actions:a,className:l,children:u}){let p=c();return t("section",{className:U("card",l),"aria-labelledby":o?p:void 0,children:[(o||a)&&t("div",{className:"card-header",children:[o&&e("h2",{id:p,className:"card-title",children:o}),a&&e("div",{className:"card-actions",children:a})]}),e("div",{className:"card-body",children:u})]})}function re({variant:o="secondary",size:a="md",type:l="button",className:u,...p}){return e("button",{...p,type:l,className:U("btn",`btn-${o}`,a==="sm"&&"btn-sm",u)})}var On=1500;async function En(o){try{if(typeof navigator>"u"||!navigator.clipboard)return!1;return await navigator.clipboard.writeText(o),!0}catch{return!1}}var Jr="[Circular]";function _r(o){let a=new WeakSet,l=(u)=>{if(typeof u==="bigint")return u.toString();if(typeof u==="function"||typeof u==="symbol")return;if(typeof u!=="object"||u===null)return u;if(a.has(u))return Jr;let p=u;if(typeof p.toJSON==="function")return l(p.toJSON.call(u));a.add(u);try{if(Array.isArray(u))return u.map((h)=>{let v=l(h);return v===void 0?null:v});let y={};for(let[h,v]of Object.entries(u)){let k=l(v);if(k!==void 0)y[h]=k}return y}finally{a.delete(u)}};return l(o)}function Dn(o,a=2){return JSON.stringify(_r(o),null,a)??"undefined"}function xe({text:o,label:a="Copy",ariaLabel:l,size:u="sm",className:p,onCopied:y}){let[h,v]=r("idle");D(()=>{if(h==="idle")return;let w=setTimeout(v,On,"idle");return()=>clearTimeout(w)},[h]);let k=async()=>{let w=await En(typeof o==="function"?o():o);v(w?"copied":"failed"),y?.(w)};return e(re,{variant:"ghost",size:u,className:U("copy-button",p),"aria-label":l,"data-status":h,onClick:()=>void k(),children:e("span",{"aria-live":"polite",children:h==="copied"?"Copied":h==="failed"?"Copy failed":a})})}var Vr=["a[href]","button:not([disabled])","input:not([disabled]):not([type='hidden'])","select:not([disabled])","textarea:not([disabled])","summary","[contenteditable]:not([contenteditable='false'])","[tabindex]:not([tabindex='-1'])"].join(",");function Kt(o){return Array.from(o.querySelectorAll(Vr)).filter((a)=>!a.hasAttribute("inert")&&!a.closest("[inert]"))}function mt(o){return o.open?e(zr,{...o}):null}function zr({onClose:o,title:a,description:l,children:u,footer:p,closeOnEscape:y=!0,closeOnBackdrop:h=!0,showCloseButton:v=!0,size:k="md",initialFocusRef:w,role:N="dialog",className:S}){let C=T(null),P=T(null),j=c(),L=c();D(()=>{let M=C.current;if(!M)return;let K=document.activeElement instanceof HTMLElement?document.activeElement:null;if(!M.open)if(typeof M.showModal==="function")M.showModal();else M.setAttribute("open","");return(w?.current??(P.current&&Kt(P.current)[0])??Kt(M).find((_)=>!_.dataset.dialogClose)??M).focus(),()=>{if(M.open&&typeof M.close==="function")M.close();if(K?.isConnected)K.focus()}},[w]);let O=(M)=>{if(M.key==="Escape"){if(M.preventDefault(),M.stopPropagation(),y)o();return}if(M.key!=="Tab"||!C.current)return;let K=Kt(C.current);if(K.length===0){M.preventDefault(),C.current.focus();return}let te=K[0],_=K[K.length-1],Y=document.activeElement,X=Y instanceof Node&&C.current.contains(Y);if(M.shiftKey&&(Y===te||!X))M.preventDefault(),_.focus();else if(!M.shiftKey&&(Y===_||!X))M.preventDefault(),te.focus()},F=(M)=>{if(M.preventDefault(),y)o()},V=(M)=>{if(h&&M.target===M.currentTarget)o()};return e("dialog",{ref:C,role:N==="alertdialog"?"alertdialog":void 0,"aria-modal":"true","aria-labelledby":j,"aria-describedby":l?L:void 0,className:U("dialog",`dialog-${k}`,S),tabIndex:-1,onKeyDown:O,onCancel:F,onClick:V,children:t("div",{className:"dialog-panel",children:[t("div",{className:"dialog-header",children:[e("h2",{id:j,className:"dialog-title",children:a}),v&&e(re,{variant:"ghost",size:"sm",className:"dialog-close","aria-label":"Close","data-dialog-close":"true",onClick:o,children:e("span",{"aria-hidden":"true",children:"×"})})]}),l&&e("p",{id:L,className:"dialog-description",children:l}),u!==void 0&&e("div",{ref:P,className:"dialog-body",children:u}),p&&e("div",{className:"dialog-footer",children:p})]})})}function ft({title:o,description:a,action:l,headingLevel:u}){let p=u?`h${u}`:"p";return t("div",{className:"empty-state",children:[e(p,{className:"empty-state-title",children:o}),a&&e("p",{className:"empty-state-description",children:a}),l&&e("div",{className:"empty-state-action",children:l})]})}var gt=B(null),yt=B(null),An=B(null);function Te(){let o=q(gt);if(!o)throw Error("useDocsUiConfig must be used inside <DocsUiProviders>");return o}function Ut(){let o=q(yt);if(!o)throw Error("useDocsClient must be used inside <DocsClientContext>");return o}function In(){return q(An)??void 0}function Qr(o){return o.button!==0||o.metaKey||o.altKey||o.ctrlKey||o.shiftKey||o.defaultPrevented}function oe({to:o,activeMatch:a,onClick:l,target:u,...p}){let{navigate:y,href:h,location:v}=ge(),k=o.split("?")[0]||"/",w=v.path!==null&&(a==="exact"?v.path===k:a==="prefix"?k==="/"?v.path==="/":v.path===k||v.path.startsWith(`${k}/`):!1);return e("a",{...p,target:u,href:h(o),"aria-current":w?"page":void 0,onClick:(N)=>{if(l?.(N),Qr(N)||u&&u!=="_self")return;N.preventDefault(),y(o)}})}var Jt=B(null);function bt(){return q(Jt)}function je(...o){let a=o.filter(Boolean).join(" ");return a===""?void 0:a}function Ce({label:o,hint:a,error:l,required:u=!1,id:p,className:y,children:h}){let v=c(),k=p??v,w=`${k}-hint`,N=`${k}-error`,S=Boolean(l),C=g(()=>({id:k,"aria-describedby":je(a?w:null,S&&N),"aria-invalid":S||void 0,required:u||void 0}),[k,a,w,S,N,u]);return t("div",{className:U("field",S&&"field-invalid",y),children:[t("label",{className:"field-label",htmlFor:k,children:[o,u&&t("span",{className:"field-required","aria-hidden":"true",children:[" ","*"]})]}),e(Jt,{value:C,children:typeof h==="function"?h(C):h}),a&&e("p",{id:w,className:"field-hint",children:a}),S&&e("p",{id:N,className:"field-error",children:l})]})}function $n(o){let a=bt();return{id:o.id??a?.id,"aria-describedby":je(a?.["aria-describedby"],o["aria-describedby"]),"aria-invalid":o["aria-invalid"]??a?.["aria-invalid"],required:o.required??a?.required}}function we({value:o,onChange:a,type:l="text",className:u,...p}){let y=$n(p);return e("input",{...p,...y,type:l,className:U("input",u),value:o,onChange:(h)=>a(h.target.value,h)})}function Ln({options:o,value:a,onChange:l,className:u,...p}){let y=$n(p);return e("select",{...p,...y,className:U("input","select",u),value:a,onChange:(h)=>{let v=o.find((k)=>k.value===h.target.value);if(v)l(v.value,h)},children:o.map((h)=>e("option",{value:h.value,disabled:h.disabled,children:h.label??h.value},h.value))})}function Mn({checked:o,onChange:a,label:l,hint:u,id:p,className:y,...h}){let v=c(),k=p??v,w=`${k}-hint`;return t("div",{className:U("checkbox",y),children:[e("input",{...h,id:k,type:"checkbox",checked:o,"aria-describedby":u?w:void 0,onChange:(N)=>a(N.target.checked,N)}),e("label",{htmlFor:k,children:l}),u&&e("p",{id:w,className:"field-hint checkbox-hint",children:u})]})}function Xr(o){if(typeof o==="string")return o;try{return JSON.stringify(o)??String(o)}catch{return String(o)}}function ze({error:o,title:a,onRetry:l,onDismiss:u,className:p}){let y=Be(o)?o:null,h=a??y?.title??"Something went wrong",v=y?.detail??(o instanceof Error?o.message:String(o)),k=y?Object.entries(y.context):[];return t("div",{className:U("problem-banner",p),role:"alert",children:[t("div",{className:"problem-banner-main",children:[t("p",{className:"problem-banner-title",children:[e("strong",{children:h}),y&&t("code",{className:"problem-banner-code",children:[y.code,y.status>0?` · ${y.status}`:""]})]}),v&&v!==h&&e("p",{className:"problem-banner-detail",children:v}),k.length>0&&e("ul",{className:"problem-banner-context","aria-label":"Context",children:k.map(([w,N])=>t("li",{children:[e("span",{className:"problem-banner-key",children:w}),"=",e("code",{children:Xr(N)})]},w))}),y&&y.issues.length>0&&e("ul",{className:"problem-banner-issues",children:y.issues.map((w)=>t("li",{children:[t("code",{children:[w.target,w.path?`.${w.path}`:""]})," ",w.message]},`${w.target}:${w.path}:${w.message}`))})]}),(l||u)&&t("div",{className:"problem-banner-actions",children:[l&&e(re,{size:"sm",onClick:l,children:"Retry"}),u&&e(re,{size:"sm",variant:"ghost",onClick:u,children:"Dismiss"})]})]})}function Wn(o){return o.open?e(Yr,{...o}):null}function Yr({onClose:o,title:a,description:l,children:u,onConfirm:p,confirmLabel:y="Confirm",pendingLabel:h,cancelLabel:v="Cancel",variant:k="default",confirmText:w,confirmTextLabel:N,closeOnSuccess:S=!0,confirmDisabled:C=!1}){let[P,j]=r(""),[L,O]=r(!1),[F,V]=r(null),M=T(null),K=T(null),te=T(null),Y=(w===void 0||P===w)&&!L&&!C,X=k==="danger",fe=async()=>{if(!Y)return;O(!0),V(null);try{if(await p(),O(!1),S)o()}catch(ae){O(!1),V(ae)}},se=(ae)=>{ae.preventDefault(),fe()},ke=()=>{if(!L)o()};return e(mt,{open:!0,onClose:ke,title:a,description:l,role:X?"alertdialog":"dialog",size:"sm",closeOnEscape:!L,closeOnBackdrop:!L,initialFocusRef:w!==void 0?te:X?M:K,footer:t(n,{children:[e(re,{ref:M,onClick:ke,disabled:L,children:v}),e(re,{ref:K,variant:X?"danger":"primary",disabled:!Y,"aria-busy":L||void 0,onClick:()=>void fe(),children:L?h??`${y}…`:y})]}),children:t("form",{className:"confirm-dialog-body",onSubmit:se,children:[u,w!==void 0&&e(Ce,{label:N??t(n,{children:["Type ",e("code",{children:w})," to confirm"]}),children:e(we,{ref:te,value:P,onChange:j,autoComplete:"off",spellCheck:!1,disabled:L})}),F!==null&&e(ze,{error:F})]})})}class Ge extends Error{offset;constructor(o,a){super(o);this.offset=a}}function Zr(o,a){return a>=o.length?"end of input":`'${o[a]===`
|
|
6
|
-
`?"\\n":o[a]}'`}function es(o){let a=0,l=()=>{while(a<o.length&&(o[a]===" "||o[a]==="\t"||o[a]===`
|
|
7
|
-
`||o[a]==="\r"))a++},u=(k)=>{throw new Ge(`Expected ${k} but found ${Zr(o,a)}`,a)},p=(k)=>{for(let w=0;w<k.length;w++){if(o[a]!==k[w])u(`'${k}'`);a++}},y=()=>{a++;while(a<o.length){let k=o[a];if(k==='"'){a++;return}if(k==="\\"){let w=o[a+1];if(w==="u"){if(!/^[0-9a-f]{4}$/i.test(o.slice(a+2,a+6)))a+=2,u("four hex digits after \\u");a+=6;continue}if(w===void 0||!'"\\/bfnrt'.includes(w))a++,u("a valid escape");a+=2;continue}if(k<" ")throw new Ge("Control characters must be escaped in strings",a);a++}throw new Ge("Unterminated string",a)},h=()=>{let k=/^-?(?:0|[1-9]\d*)(?:\.\d+)?(?:e[+-]?\d+)?/i.exec(o.slice(a,a+400));if(!k)u("a number");a+=k[0].length},v=()=>{l();let k=o[a];if(k==="{"){if(a++,l(),o[a]==="}"){a++;return}for(;;){if(l(),o[a]!=='"')u("a property name in double quotes");if(y(),l(),o[a]!==":")u("':'");if(a++,v(),l(),o[a]===","){a++;continue}if(o[a]==="}"){a++;return}u("',' or '}'")}}if(k==="["){if(a++,l(),o[a]==="]"){a++;return}for(;;){if(v(),l(),o[a]===","){a++;continue}if(o[a]==="]"){a++;return}u("',' or ']'")}}if(k==='"'){y();return}if(k==="t"){p("true");return}if(k==="f"){p("false");return}if(k==="n"){p("null");return}if(k==="-"||k!==void 0&&k>="0"&&k<="9"){h();return}u("a value")};if(v(),l(),a<o.length)u("end of input")}function ts(o,a){let l=1,u=0,p=Math.min(a,o.length);for(let y=0;y<p;y++)if(o.charCodeAt(y)===10)l++,u=y+1;return{line:l,column:p-u+1}}function ns(o){try{return{ok:!0,value:JSON.parse(o)}}catch(a){let l=a instanceof Error?a.message:String(a),u=0;try{es(o)}catch(p){if(p instanceof Ge)l=p.message,u=p.offset}return{ok:!1,error:{message:l,offset:u,...ts(o,u)}}}}function rs(o){return new TextEncoder().encode(o).byteLength}function Ae(o){if(o<1024)return`${o} B`;if(o<1048576)return`${(o/1024).toFixed(1)} KiB`;return`${(o/1048576).toFixed(1)} MiB`}function Qe(o,{maxBytes:a,allowEmpty:l=!1}={}){let u=rs(o),p=a!==void 0&&u>a;if(l&&o.trim()==="")return{text:o,value:void 0,valid:!p,error:null,bytes:u,overLimit:p};let y=ns(o);return y.ok?{text:o,value:y.value,valid:!p,error:null,bytes:u,overLimit:p}:{text:o,value:void 0,valid:!1,error:y.error,bytes:u,overLimit:p}}function qn({value:o,onChange:a,maxBytes:l,allowEmpty:u=!1,rows:p=10,"aria-label":y,id:h,readOnly:v=!1,disabled:k=!1,placeholder:w,className:N}){let S=bt(),C=c(),P=h??S?.id??C,j=`${P}-json-error`,L=`${P}-json-size`,O=g(()=>Qe(o,{maxBytes:l,allowEmpty:u}),[o,l,u]),F=(K)=>a(Qe(K,{maxBytes:l,allowEmpty:u})),V=(K)=>{if(O.error===null&&O.value!==void 0)F(JSON.stringify(O.value,null,K))},M=!v&&!k&&O.error===null&&O.value!==void 0;return t("div",{className:U("json-editor",!O.valid&&"json-editor-invalid",N),children:[e("textarea",{id:P,className:"input json-editor-text",rows:p,value:o,placeholder:w,readOnly:v,disabled:k,spellCheck:!1,autoCapitalize:"off",autoComplete:"off","aria-label":y,"aria-invalid":!O.valid||S?.["aria-invalid"]||void 0,"aria-required":S?.required,"aria-describedby":je(S?.["aria-describedby"],O.error&&j,L),onChange:(K)=>F(K.target.value)}),t("div",{className:"json-editor-bar",children:[O.error?t("p",{id:j,className:"json-editor-error",children:["Line ",O.error.line,", column ",O.error.column,":"," ",O.error.message]}):e("p",{className:"json-editor-ok muted",children:"Valid JSON"}),t("span",{id:L,className:U("json-editor-size",O.overLimit&&"is-over"),children:[l!==void 0&&e("meter",{className:"json-editor-meter",min:0,max:l,low:l*0.8,high:l,optimum:0,value:Math.min(O.bytes,l),"aria-hidden":"true"}),l===void 0?Ae(O.bytes):O.overLimit?`${Ae(O.bytes)} of ${Ae(l)}: over the limit by ${Ae(O.bytes-l)}`:`${Ae(O.bytes)} of ${Ae(l)}`]}),!v&&t("span",{className:"json-editor-actions",children:[e(re,{size:"sm",disabled:!M,onClick:()=>V(2),children:"Format"}),e(re,{size:"sm",disabled:!M,onClick:()=>V(void 0),children:"Minify"})]})]})]})}function ss(o){if(o===null)return"null";if(Array.isArray(o))return"array";switch(typeof o){case"object":return o instanceof Date?"other":"object";case"string":return"string";case"number":case"bigint":return"number";case"boolean":return"boolean";case"undefined":return"undefined";default:return"other"}}function os(o){if(typeof o==="bigint")return`${o}n`;if(o instanceof Date)return Number.isNaN(o.getTime())?"Invalid Date":o.toISOString();if(typeof o==="symbol"||typeof o==="function")return o.toString();return String(o)}function is(o,a){if(Array.isArray(o))return o.slice(0,a).map((u,p)=>[String(p),u]);let l=o;return Object.keys(l).slice(0,a).map((u)=>[u,l[u]])}function Xe({value:o,label:a="JSON",expandDepth:l=1,maxStringLength:u=200,maxChildren:p=100,copyable:y=!0,className:h}){let v={expandDepth:l,maxStringLength:u,maxChildren:p};return t("div",{className:U("json-view",h),children:[y&&e("div",{className:"json-view-toolbar",children:e(xe,{text:()=>Dn(o,2),ariaLabel:`Copy ${a}`})}),e("ul",{className:"json-tree","aria-label":a,children:e(Bn,{name:null,value:o,depth:0,ancestors:[],limits:v})})]})}function Bn({name:o,value:a,depth:l,ancestors:u,limits:p}){let y=ss(a),h=o===null?null:t("span",{className:"json-key",children:[o,": "]});if(y!=="object"&&y!=="array")return t("li",{className:"json-row",children:[h,e(cs,{value:a,kind:y,maxLength:p.maxStringLength})]});let v=a;if(u.includes(v))return t("li",{className:"json-row",children:[h,e("span",{className:"json-circular",children:"[Circular]"})]});return e(as,{nameNode:h,value:v,isArray:y==="array",depth:l,ancestors:u,limits:p})}function as({nameNode:o,value:a,isArray:l,depth:u,ancestors:p,limits:y}){let[h,v]=r(u<y.expandDepth),[k,w]=r(y.maxChildren),N=l?a.length:Object.keys(a).length,S=l?"[":"{",C=l?"]":"}",P=l?`${N} ${N===1?"item":"items"}`:`${N} ${N===1?"key":"keys"}`;if(N===0)return t("li",{className:"json-row",children:[o,t("span",{className:"json-punct",children:[S,C]})]});let j=h?is(a,k):[],L=h?[...p,a]:p;return t("li",{className:"json-row json-container",children:[t("button",{type:"button",className:"json-toggle","aria-expanded":h,onClick:()=>v((O)=>!O),children:[e("span",{className:"json-caret","aria-hidden":"true"}),o,e("span",{className:"json-punct",children:S}),!h&&t(n,{children:[e("span",{className:"json-summary",children:P}),e("span",{className:"json-punct",children:C})]})]}),h&&t(n,{children:[t("ul",{className:"json-children",children:[j.map(([O,F])=>e(Bn,{name:O,value:F,depth:u+1,ancestors:L,limits:y},O)),N>k&&e("li",{className:"json-row",children:t("button",{type:"button",className:"json-more",onClick:()=>w((O)=>O+y.maxChildren),children:["Show ",Math.min(y.maxChildren,N-k)," more (",N-k," hidden)"]})})]}),e("span",{className:"json-punct",children:C})]})]})}function cs({value:o,kind:a,maxLength:l}){let[u,p]=r(!1);if(a==="string"){let y=o,h=!u&&y.length>l;return t(n,{children:[t("span",{className:"json-string",children:['"',h?y.slice(0,l):y,h?"…":"",'"']}),y.length>l&&e("button",{type:"button",className:"json-more","aria-expanded":u,onClick:()=>p((v)=>!v),children:u?"Show less":`Show more (${y.length} chars)`})]})}return e("span",{className:`json-${a}`,children:os(o)})}var ls=new Intl.NumberFormat(void 0,{notation:"compact"});function jn({tabs:o,value:a,onChange:l,label:u,children:p,activation:y="auto",className:h}){let v=c(),k=T(null),w=(P)=>`${v}-tab-${P}`,N=`${v}-panel`,S=o.findIndex((P)=>P.value===a),C=(P)=>{let j=o.map((V,M)=>({tab:V,index:M})).filter(({tab:V})=>!V.disabled);if(j.length===0)return;let L=j.findIndex(({index:V})=>w(V)===P.currentTarget.id),O=null;switch(P.key){case"ArrowRight":O=(L+1)%j.length;break;case"ArrowLeft":O=(L-1+j.length)%j.length;break;case"Home":O=0;break;case"End":O=j.length-1;break;default:return}P.preventDefault();let F=j[O];if(k.current?.ownerDocument.getElementById(w(F.index))?.focus(),y==="auto")l(F.tab.value)};return t("div",{className:U("tabs",h),children:[e("div",{ref:k,className:"tabs-list",role:"tablist","aria-label":u,children:o.map((P,j)=>{let L=j===S,O=L||S===-1&&j===o.findIndex((F)=>!F.disabled);return t("button",{id:w(j),type:"button",role:"tab",className:"tab","aria-selected":L,"aria-controls":p!==void 0?N:void 0,tabIndex:O?0:-1,disabled:P.disabled,title:P.title,onClick:()=>l(P.value),onKeyDown:C,children:[e("span",{className:"tab-label",children:P.label}),P.count!==void 0&&e("span",{className:"tab-count",title:String(P.count),children:ls.format(P.count)})]},P.value)})}),p!==void 0&&e("div",{id:N,className:"tabs-panel",role:"tabpanel","aria-labelledby":S>=0?w(S):void 0,tabIndex:0,children:p})]})}function ds(o,a){switch(o.kind){case"list":return"Comma-separated; each value is sent as a repeated key (name=a&name=b).";case"enum-list":return"Each ticked value is sent as a repeated key.";case"number":{let l=[o.min!==void 0?`min ${o.min}`:void 0,o.max!==void 0?`max ${o.max}`:void 0].filter(Boolean);return[o.integer?"An integer":"A number",...l].join(", ")}default:return a.in==="path"?"Percent-encoded as one path segment.":void 0}}function us({parameter:o,kind:a,value:l,onChange:u,disabled:p}){let y=typeof l==="string"?l:"";switch(a.kind){case"boolean":case"enum":{let h=a.kind==="boolean"?["true","false"]:a.options;return e(Ln,{value:y,disabled:p,options:[{value:"",label:o.required?"Choose…":"(not sent)"},...h.map((v)=>({value:v}))],onChange:u})}case"enum-list":{let h=Array.isArray(l)?l:[];return e("div",{className:"http-tryit-checks",role:"group","aria-label":o.name,children:a.options.map((v)=>e(Mn,{label:v,disabled:p,checked:h.includes(v),onChange:(k)=>u(k?[...h,v]:h.filter((w)=>w!==v))},v))})}default:return e(we,{value:y,disabled:p,inputMode:a.kind==="number"?"decimal":void 0,placeholder:a.kind==="list"?"a, b, c":void 0,onChange:(h)=>u(h)})}}function ps({headers:o}){let a=Object.entries(o);return t("details",{className:"http-tryit-headers","data-testid":"tryit-headers",children:[e("summary",{children:`Headers (${a.length})`}),a.length===0?e("p",{className:"http-muted",children:"No headers visible to the page."}):e("dl",{children:a.map(([l,u])=>t("div",{"data-header":l,children:[e("dt",{children:e("code",{children:l})}),e("dd",{children:e("code",{children:u})})]},l))})]})}function ms({body:o,label:a}){if(o===void 0)return e("p",{className:"http-muted",children:"No body."});if(typeof o==="string")return e("pre",{className:"http-tryit-text","aria-label":a,children:e("code",{children:o})});return e(Xe,{value:o,label:a,expandDepth:2})}function fs({result:o,operation:a}){let l=o.ok?o.response:void 0,u=o.ok?o.response.error:o.error,p=Be(u)?u:void 0,y=l?Tn(a,l.status):void 0,h=l?l.durationMs:o.ok?0:o.ms;return t("section",{className:"http-tryit-result","aria-label":"Response","data-testid":"tryit-result",children:[t("div",{className:"http-tryit-status",children:[e(z,{tone:l?.ok?"success":"danger",children:e("span",{"data-testid":"tryit-status",children:l?String(l.status):p?.status===0?"No response":"Error"})}),l?.statusText&&e("span",{className:"http-muted",children:l.statusText}),p&&e("code",{children:p.code}),e("span",{className:"http-tryit-timing","data-testid":"tryit-timing",children:`${Math.round(h)} ms`})]}),y&&e("p",{className:"http-muted","data-testid":"tryit-documented",children:y}),!l&&e(ze,{error:u}),l&&t(n,{children:[!l.ok&&e(ze,{error:u}),e(ps,{headers:l.headers}),e(ms,{body:l.body,label:l.ok?"Response body":p?.kind==="problem"?"Problem body":"Response body"})]})]})}function hs({request:o}){let a=Ut(),l=Te(),[u,p]=r("curl"),y={apiBase:a.base,origin:typeof window>"u"?"":window.location.origin,csrfHeader:l.csrfHeader},h=o?u==="curl"?Nn(o,y):Sn(o,y):void 0;return e(jn,{label:"Snippets",value:u,onChange:p,tabs:[{value:"curl",label:"curl"},{value:"fetch",label:"fetch()"}],className:"http-snippets",children:h===void 0?e("p",{className:"http-muted",children:"Fill in the required fields to see the snippet."}):t("div",{className:"http-snippet",children:[e(xe,{text:h,ariaLabel:`Copy the ${u==="curl"?"curl command":"fetch() call"}`}),e("pre",{"data-testid":`snippet-${u}`,children:e("code",{children:h})})]})})}function Hn({operation:o,root:a,readOnly:l=!1,probe:u,onChanged:p}){let y=Ut(),h=Te(),v=Ft(o),k=pt(o),w=o.requestBody?.required!==!0,[N,S]=r({}),[C,P]=r(()=>Qe(vn(o,a),{allowEmpty:w})),[j,L]=r({}),[O,F]=r(null),[V,M]=r(!1),[K,te]=r(null),_=Pn(o,{readOnly:l,permitted:o.action===void 0||u===void 0?!0:u(o.action)===!0}),Y=!_.enabled||V,X=g(()=>xn(o,a,N,k===void 0?void 0:C.value),[o,a,N,k,C.value]);async function fe(Z){M(!0);let ce=performance.now();try{let le=await y.requestRaw(Z.method,Z.path,{query:Z.query,body:Z.body});if(te({ok:!0,response:le}),o.mutation&&le.ok)p?.()}catch(le){te({ok:!1,error:le,ms:performance.now()-ce})}finally{M(!1)}}function se(){if(!_.enabled)return;if(k!==void 0&&!C.valid){L({body:C.error?`Line ${C.error.line}: ${C.error.message}`:"The body is not valid JSON"});return}if(!X.ok){L(X.errors);return}if(L({}),o.mutation){F(X.request);return}fe(X.request)}let ke=Cn(o),ae=o.parameters.find((Z)=>Z.in==="header"&&Z.name===o.csrf?.header);return t("section",{className:"http-tryit","aria-labelledby":`tryit-${o.id}`,"data-testid":"tryit",children:[e("h3",{id:`tryit-${o.id}`,children:"Try it"}),!_.enabled&&e("p",{className:"http-tryit-disabled",role:"note","data-testid":"tryit-disabled",children:_.reason}),t("form",{className:"http-tryit-form",noValidate:!0,onSubmit:(Z)=>{Z.preventDefault(),se()},children:[v.length===0&&k===void 0&&e("p",{className:"http-muted",children:"No parameters."}),v.map((Z)=>{let ce=jt(Z),le=Ht(Z,a);return e(Ce,{label:t(n,{children:[e("code",{children:Z.name})," ",e("span",{className:"http-muted",children:Z.in})]}),required:Z.required,hint:ds(le,Z),error:j[ce],children:e(us,{parameter:Z,kind:le,value:N[ce],disabled:Y,onChange:(tt)=>S((rt)=>({...rt,[ce]:tt}))})},ce)}),ae&&e("p",{className:"http-muted","data-testid":"tryit-csrf",children:h.csrfHeader===ae.name?`The ${ae.name} header is added by the app's client.`:h.csrfHeader?`The API asks for ${ae.name}, but this UI sends ${h.csrfHeader}: the API will refuse this with 403 CSRF_REJECTED.`:`The API asks for ${ae.name}, but this UI is configured with no CSRF header: the API will refuse this with 403 CSRF_REJECTED.`}),k!==void 0&&e(Ce,{label:"Body (application/json)",required:!w,hint:w?"Optional: leave it empty to send none.":"Prefilled with the schema's required fields.",error:j.body,children:e(qn,{value:C.text,allowEmpty:w,readOnly:Y,rows:8,onChange:P})}),t("div",{className:"http-tryit-actions",children:[e(re,{type:"submit",variant:o.mutation?ke?"danger":"primary":"primary",disabled:Y,children:V?"Sending…":`Send ${o.method}`}),K&&e(re,{variant:"ghost",onClick:()=>te(null),children:"Clear response"})]})]}),e(hs,{request:X.ok?X.request:void 0}),K&&e(fs,{result:K,operation:o}),e(Wn,{open:O!==null,onClose:()=>F(null),title:`Send ${o.method} ${O?.path??o.path}?`,description:ke?"This changes the real API and cannot be undone.":"This changes the real API, as the app's own buttons would.",variant:ke?"danger":"default",confirmLabel:`Send ${o.method}`,confirmText:ke?o.id:void 0,onConfirm:async()=>{if(O)await fe(O)}})]})}function _t({method:o}){return e(z,{tone:un(o),className:"http-method",children:o})}function gs(o){if(o.in!=="query"||o.style===void 0)return;if(o.style==="form"&&o.explode!==!1)return"Repeat the key for each value (state=a&state=b).";return`style: ${o.style}${o.explode===void 0?"":`, explode: ${String(o.explode)}`}`}function ys({operation:o,root:a,onRef:l}){if(o.parameters.length===0)return null;return t("section",{className:"http-section","aria-labelledby":`params-${o.id}`,children:[e("h3",{id:`params-${o.id}`,children:"Parameters"}),e("ul",{className:"http-params","data-testid":"op-parameters",children:o.parameters.map((u)=>{let p=gs(u);return t("li",{className:"http-param","data-param":u.name,children:[t("div",{className:"http-param-head",children:[e("code",{className:"http-param-name",children:u.name}),e(z,{tone:"neutral",children:u.in}),u.required?e("span",{className:"schema-required",children:"required"}):e("span",{className:"http-muted",children:"optional"}),u.deprecated&&e(z,{tone:"warning",children:"deprecated"})]}),u.description&&e("div",{className:"http-param-description",children:e(ie,{text:u.description})}),p&&e("p",{className:"http-muted http-param-style",children:p}),e(he,{schema:u.schema,root:a,depth:0,onRef:l,label:`Schema of ${u.name}`})]},`${u.in}:${u.name}`)})})]})}function bs({operation:o,root:a,onRef:l}){let u=o.requestBody;if(!u)return null;return t("section",{className:"http-section","aria-labelledby":`body-${o.id}`,"data-testid":"op-body",children:[t("h3",{id:`body-${o.id}`,children:["Request body"," ",e("span",{className:"http-muted",children:u.required?"(required)":"(optional)"})]}),u.description&&e(ie,{text:u.description}),u.content.map((p)=>t("div",{className:"http-media",children:[e("code",{className:"http-media-type",children:p.contentType}),p.schema!==void 0&&e(he,{schema:p.schema,root:a,depth:2,onRef:l,label:`Request body schema (${p.contentType})`})]},p.contentType))]})}function vs(o){if(o.startsWith("2"))return"success";if(o.startsWith("4"))return"warning";if(o.startsWith("5"))return"danger";return"neutral"}function xs({response:o,root:a,onRef:l}){let u=o.status.startsWith("2");return t("li",{className:"http-response","data-status":o.status,children:[t("div",{className:"http-response-head",children:[e(z,{tone:vs(o.status),children:o.status}),e("span",{children:o.description})]}),o.codes.length>0&&e("ul",{className:"http-codes","aria-label":`Problem codes for ${o.status}`,children:o.codes.map((p)=>e("li",{children:e("code",{children:p})},p))}),o.content.map((p)=>t("div",{className:"http-media",children:[e("code",{className:"http-media-type",children:p.contentType}),p.schema!==void 0&&e(he,{schema:p.schema,root:a,depth:u?1:0,onRef:l,label:`Response ${o.status} schema (${p.contentType})`})]},p.contentType))]})}function Fn({operation:o,root:a,onRef:l,probe:u,readOnly:p=!1,onChanged:y}){let h=Te(),v=o.action===void 0||u===void 0?void 0:u(o.action),k=o.csrf;return t("article",{className:"http-operation","aria-labelledby":`op-${o.id}`,"data-testid":"http-operation",children:[t("header",{className:"http-operation-head",children:[t("div",{className:"http-operation-line",children:[e(_t,{method:o.method}),e("code",{className:"http-operation-path","data-testid":"op-path",children:o.path}),o.deprecated&&e(z,{tone:"warning",children:"deprecated"})]}),e("h2",{id:`op-${o.id}`,className:"http-operation-title",children:o.summary??o.id}),t("p",{className:"http-operation-id",children:[e("span",{className:"http-muted",children:"operationId"})," ",e("code",{children:o.id}),e(xe,{text:o.id,ariaLabel:"Copy the operation id"})]})]}),t("div",{className:"http-markers","aria-label":"Access",role:"group",children:[o.action!==void 0&&(u===void 0?e(z,{tone:"neutral",title:"The permission the API's authorize hook is asked about.",children:t("span",{"data-testid":"op-permission",children:["Needs ",e("code",{children:o.action})]})}):e(z,{tone:v?"success":"danger",title:"From the caller's permissions. authorize may still decide per target.",children:t("span",{"data-testid":"op-permission","data-allowed":String(v??!1),children:[v?"You have ":"You lack ",e("code",{children:o.action})]})})),e(z,{tone:o.mutation?"warning":"neutral",title:o.mutation?"Changes state: CSRF checks apply, and a read-only API refuses it.":"Reads only.",children:e("span",{"data-testid":"op-mutation",children:o.mutation?"Mutation":"Read"})}),o.mutation&&p&&e(z,{tone:"danger",children:"Refused: the API is read-only"}),o.requires.length>0&&t("span",{className:"http-requires","data-testid":"op-requires",children:[e("span",{className:"http-muted",children:"Needs driver support:"})," ",o.requires.map((w)=>e("code",{children:w},w))]})]}),k&&t("div",{className:"http-csrf",role:"note","data-testid":"op-csrf",children:[k.header!==null&&t("p",{children:["Every mutation must carry the ",e("code",{children:k.header})," header, with any non-empty value."," ",h.csrfHeader===k.header?"The app sends it.":"This UI is not configured to send it."]}),k.requireJson&&t("p",{children:["Send ",e("code",{children:"Content-Type: application/json"}),", even with no body; any other media type is refused with 415."]}),k.header===null&&!k.requireJson&&e("p",{children:"Cross-site requests are refused (Origin / Sec-Fetch-Site)."})]}),o.description&&e("div",{className:"http-description",children:e(ie,{text:o.description})}),e(ys,{operation:o,root:a,onRef:l}),e(bs,{operation:o,root:a,onRef:l}),t("section",{className:"http-section","aria-labelledby":`responses-${o.id}`,children:[e("h3",{id:`responses-${o.id}`,children:"Responses"}),e("ul",{className:"http-responses","data-testid":"op-responses",children:o.responses.map((w)=>e(xs,{response:w,root:a,onRef:l},w.status))})]}),e(Hn,{operation:o,root:a,readOnly:p,probe:u,onChanged:y},o.id)]})}function xt(o,a,l){if(a.length===0)return null;let u=l?a.indexOf(l):-1;switch(o){case"ArrowDown":return a[u<0?0:Math.min(u+1,a.length-1)];case"ArrowUp":return a[u<=0?0:u-1];case"Home":return a[0];case"End":return a[a.length-1];default:return null}}var kt={"data-shortcut":"search","aria-keyshortcuts":"/"};function Kn(o){return o?Array.from(o.querySelectorAll("a.http-op-link")):[]}function Un({group:o,headingId:a,level:l,hrefOf:u}){return t("section",{className:"http-tag","aria-labelledby":a,children:[e(l===2?"h2":"h3",{id:a,className:"http-tag-name",title:o.description,children:o.name}),e("ul",{className:"http-tag-ops",children:o.operations.map((y)=>e("li",{children:t(oe,{to:u(y.id),className:"http-op-link",activeMatch:"exact","data-operation":y.id,children:[e(_t,{method:y.method}),t("span",{className:"http-op-text",children:[e("span",{className:"http-op-path",children:y.path}),y.summary&&e("span",{className:"http-op-summary",children:y.summary})]})]})},y.id))})]})}function Jn({groups:o,sections:a,query:l,onQuery:u,hrefOf:p}){let y=T(null),h=o.reduce((k,w)=>k+w.operations.length,0);function v(k){let w=xt(k.key,Kn(y.current),document.activeElement);if(w)k.preventDefault(),w.focus()}return t("nav",{className:"http-sidebar","aria-label":"Operations",children:[e(we,{type:"search",value:l,"aria-label":"Search operations",placeholder:"Search path, id, summary",...kt,onChange:(k)=>u(k),onKeyDown:(k)=>{if(k.key==="ArrowDown"){let w=Kn(y.current)[0];if(w)k.preventDefault(),w.focus()}}}),e("p",{className:"http-muted http-sidebar-count","aria-live":"polite",children:h===1?"1 operation":`${h} operations`}),t("div",{ref:y,className:"http-sidebar-list",onKeyDown:v,children:[a===void 0?o.map((k)=>e(Un,{group:k,headingId:`tag-${k.name}`,level:2,hrefOf:p},k.name)):lt(a).map(({key:k,index:w,section:N})=>t("section",{className:"http-section","aria-labelledby":`section-${w}`,children:[e("h2",{id:`section-${w}`,className:"http-section-name",children:N.name}),N.tags.map((S)=>e(Un,{group:S,headingId:`tag-${w}-${S.name}`,level:3,hrefOf:p},S.name))]},k)),o.length===0&&e("p",{className:"http-muted",children:"No operation matches."})]})]})}function Vn(o,a,l=""){let u=a?`?q=${encodeURIComponent(a)}`:"";return`${l}/http/${encodeURIComponent(o)}${u}`}function ws({info:o,serverBase:a}){let l=Te(),u=typeof window>"u"?"":window.location.origin;return t(G,{className:"http-info",children:[t("div",{className:"http-info-line",children:[e(z,{tone:"accent",children:`OpenAPI ${o.openapi}`}),o.version&&e(z,{tone:"neutral",children:`v${o.version}`})]}),o.description&&e("div",{className:"http-description",children:e(ie,{text:o.description})}),t("dl",{className:"http-servers","data-testid":"http-servers",children:[o.servers.map((p)=>{let y=It(p.url,l.documentUrl,u);return t("div",{children:[t("dt",{children:["Server ",e("code",{children:p.url}),p.description?` (${p.description})`:""]}),t("dd",{children:[e("code",{"data-testid":"http-server-url",children:y}),e(xe,{text:y,ariaLabel:"Copy the server URL"})]})]},p.url)}),t("div",{children:[e("dt",{children:"Requests are sent to"}),e("dd",{children:e("code",{"data-testid":"http-request-base",children:a})})]})]}),e("p",{className:"http-muted",children:"Paths below are relative to the server."})]})}function _n({group:o,query:a,pathBase:l}){return t(n,{children:[o.description&&e("p",{className:"http-muted",children:o.description}),e("ul",{className:"http-overview-ops",children:o.operations.map((u)=>t("li",{children:[t(oe,{to:Vn(u.id,a,l),children:[e("code",{children:u.method})," ",u.path]}),u.summary&&e("span",{className:"http-muted",children:` ${u.summary}`})]},u.id))})]})}function ks({doc:o,groups:a,sections:l,query:u,onRef:p,pathBase:y}){let h=dn(o);return t("div",{className:"http-overview",children:[l===void 0?a.map((v)=>e(G,{title:v.name,children:e(_n,{group:v,query:u,pathBase:y})},v.name)):lt(l).map(({key:v,section:k})=>e(G,{title:k.name,className:"http-overview-section",children:k.tags.map((w)=>t("section",{className:"http-overview-tag","aria-label":w.name,children:[e("h3",{className:"http-overview-tag-name",children:w.name}),e(_n,{group:w,query:u,pathBase:y})]},w.name))},v)),h.length>0&&e(G,{title:"Schemas",children:e("ul",{className:"http-components","data-testid":"http-components",children:h.map((v)=>e("li",{id:`schema-${v}`,children:e("button",{type:"button",className:"schema-ref schema-ref-link",onClick:()=>p(`#/components/schemas/${v}`,v),children:v})},v))})})]})}function Ns({doc:o,refValue:a,onClose:l,onRef:u}){return e(mt,{open:a!==null,onClose:l,title:a===null?"":Oe(a),description:a??void 0,size:"lg",className:"http-schema-panel",children:a!==null&&e(he,{schema:{$ref:a},root:o,depth:2,onRef:u,label:`Schema ${Oe(a)}`},a)})}function zt({doc:o,extensions:a,client:l,probe:u,readOnly:p=!1,onChanged:y,pathBase:h=""}){let v=Te(),k=a??v.extensions,{operationId:w}=de(),[N,S]=nt("q"),[C,P]=r(null),j=g(()=>an(o),[o]),L=g(()=>on(o,{extensions:k}),[o,k]),O=g(()=>cn(o,L),[o,L]),F=g(()=>ln(O,N),[O,N]),V=g(()=>At(o,O),[o,O]),M=g(()=>At(o,F),[o,F]),K=w===void 0?void 0:L.find((se)=>se.id===w),te=(se)=>P(se),_=typeof window>"u"?"":window.location.origin,Y=It(j.servers[0]?.url??"/",v.documentUrl,_),X=In(),fe=g(()=>l??qt({base:Y,csrfHeader:v.csrfHeader,fetch:X}),[l,Y,v.csrfHeader,X]);return t("div",{className:"screen http-docs","data-testid":"http-docs",children:[e("div",{className:"http-docs-title",children:e("h1",{className:"screen-title",children:j.title})}),t("div",{className:"http-docs-layout",children:[e(Jn,{groups:F,sections:M,query:N,onQuery:(se)=>S(se),hrefOf:(se)=>Vn(se,N,h)}),e("div",{className:"http-docs-main",children:w===void 0?t(n,{children:[e(ws,{info:j,serverBase:Y}),e(ks,{doc:o,groups:O,sections:V,query:N,onRef:te,pathBase:h})]}):K?e(yt,{value:fe,children:e(Fn,{operation:K,root:o,onRef:te,probe:u,readOnly:p,onChanged:y},K.id)}):e(ft,{title:"No such operation",description:`This document has no operation "${w}".`,action:e(oe,{to:`${h}/http`,children:"All operations"})})})]}),e(Ns,{doc:o,refValue:C,onClose:()=>P(null),onRef:te})]})}function W(o){return typeof o==="object"&&o!==null&&!Array.isArray(o)}function I(o){return typeof o==="string"?o:void 0}function Pe(o){return typeof o==="number"&&Number.isFinite(o)?o:void 0}function Ye(o,a,l){if(o===void 0)return;for(let u of l){let p=`${u}-${a}`;if(Object.hasOwn(o,p))return{key:p,value:o[p]}}return}function Nt(o){let a=W(o)?I(o.$ref):void 0;if(a===void 0||!a.startsWith("#/"))return;let l=a.split("/").at(-1);return l===void 0?void 0:l.replaceAll("~1","/").replaceAll("~0","~")}function Fe(o,a="",l=""){return`${l}/ws/${encodeURIComponent(o)}${a?`?${new URLSearchParams({q:a}).toString()}`:""}`}function He(o,a){return a===void 0?o:`${o}-${a}`}function zn(o){switch(o.subprotocol.source){case"server-extension":return`from servers.${o.server?.key??"api"} (${o.subprotocolKey??"subprotocol extension"})`;case"connection-extension":return`from the connection channel (${o.subprotocolKey??"subprotocol extension"})`;case"connection-prose":return"from the connection channel's description";case"default":return o.subprotocol.value===void 0?"not stated in the document":"not stated; the configured default"}}function Ss(o){return o?.match(/subprotocol `([^`]+)`/)?.[1]}function Cs(o){switch(I(o.type)){case"http":return[I(o.scheme),I(o.bearerFormat)].filter(Boolean).join(", ");case"httpApiKey":return`${I(o.in)??"?"} ${I(o.name)??"?"}`;case"oauth2":{let l=W(o.flows)?Object.values(o.flows).flatMap((u)=>W(u)&&W(u.availableScopes)?Object.keys(u.availableScopes):[]):[];return l.length>0?`scopes: ${[...new Set(l)].join(", ")}`:void 0}case"openIdConnect":return I(o.openIdConnectUrl);default:return}}function Ps(o){if(!W(o))return null;return Object.entries(o).map(([a,l])=>({scheme:a,scopes:Array.isArray(l)?l.filter((u)=>typeof u==="string"):[]}))}function Ts(o,a){let l=Nt(o);if(l!==void 0)return[{scheme:l,scopes:[]}];if(!W(o))return null;let{scopes:u,...p}=o;return[{scheme:Object.entries(a).find(([,h])=>W(h)&&Object.entries(p).every(([v,k])=>JSON.stringify(h[v])===JSON.stringify(k)))?.[0]??I(p.type)??"(inline)",scopes:Array.isArray(u)?u.filter((h)=>typeof h==="string"):[]}]}function Gt(o){return(Array.isArray(o)?o:W(o)?Object.values(o):[]).flatMap((l)=>{let u=Nt(l);return u===void 0?[]:[u]})}function Rs(o){let a=/^([^.]+)\.(.+)$/.exec(o);return a?{kind:a[1],type:a[2]}:null}function Os(o){if(!W(o))return null;let a=[];for(let[u,p]of Object.entries(o)){let y=Pe(p);if(u!=="replay"&&y!==void 0)a.push([u,y])}let l=o.replay;return{values:a,replay:l===!1?!1:W(l)?{size:Pe(l.size),maxAgeMs:Pe(l.maxAgeMs)}:void 0}}function Gn(o,a={}){let l=a.extensions??it,u=W(o.info)?o.info:{},p=W(o.components)?o.components:{},y=W(p.securitySchemes)?p.securitySchemes:{},h=W(o.servers)?o.servers:{},v=W(h.api)?"api":Object.keys(h).find((E)=>W(h[E])),k=v===void 0?void 0:h[v],w=null,N=[],S=0,C;if(k){let E=W(k.variables)?k.variables:{},A=W(E.host)?E.host:void 0,Q=I(k.host)??"",ne=/\{[^}]+\}/.test(Q),Ne=I(A?.default),st=I(k.pathname),$e=I(k.protocol),Je=ne&&Ne?Q.replace(/\{host\}/,Ne):Q;w={key:v,host:Q,hostIsTemplate:ne,hostDefault:Ne,pathname:st,protocol:$e,description:I(k.description),url:Je!==""&&$e!==void 0?`${$e}://${Je}${st??""}`:void 0};let ve=Array.isArray(k.security)?k.security:[];S=ve.length;let Re=Ye(k,"security",l);C=Re?.key,N=(Re!==void 0&&Array.isArray(Re.value)?Re.value.map(Ps):ve.map((Le)=>Ts(Le,y))).filter((Le)=>Le!==null)}let P=new Set(N.flatMap((E)=>E.map((A)=>A.scheme))),j=Object.entries(y).filter(([E])=>P.has(E)||P.size===0).flatMap(([E,A])=>W(A)?[{name:E,type:I(A.type),detail:Cs(A)||void 0,description:I(A.description),note:I(Ye(A,"note",l)?.value)}]:[]),L=W(o.channels)?o.channels:{},O=Object.entries(L).flatMap(([E,A])=>{if(!W(A))return[];let Q=I(A.address)??E,ne=W(A.parameters)?A.parameters:{},Ne=[...Q.matchAll(/\{([^}]+)\}/g)].map((ve)=>ve[1]),st=[...Ne,...Object.keys(ne).filter((ve)=>!Ne.includes(ve))],$e=W(A.bindings)?A.bindings:{},Je=W($e.ws)?$e.ws:{};return[{key:E,slug:He("channel",E),title:I(A.title)??E,address:Q,description:I(A.description),parameters:st.map((ve)=>{let Re=W(ne[ve])?ne[ve]:void 0,Le=Ye(Re,"schema",l)?.value;return{name:ve,description:I(Re?.description),schema:W(Le)?Le:void 0}}),messages:Gt(A.messages),bindingMethod:I(Je.method),isConnection:E==="connection"||I(Je.method)!==void 0}]}).sort((E,A)=>Number(A.isConnection)-Number(E.isConnection)),F=O.find((E)=>E.isConnection),V=F?L[F.key]:{},M=W(o.operations)?o.operations:{},K=Object.entries(M).flatMap(([E,A])=>{if(!W(A))return[];let Q=I(A.action),ne=W(A.reply)?A.reply:null;return[{key:E,slug:He("operation",E),title:I(A.title)??E,summary:I(A.summary),action:Q==="send"||Q==="receive"?Q:void 0,channel:Nt(A.channel),messages:Gt(A.messages),reply:ne?{channel:Nt(ne.channel),messages:Gt(ne.messages)}:null,permission:I(Ye(A,"action",l)?.value)}]}),te=W(p.messages)?p.messages:{},_=Object.entries(te).flatMap(([E,A])=>{if(!W(A))return[];let Q=Array.isArray(A.examples)?A.examples:[];return[{key:E,slug:He("message",E),name:I(A.name)??E,title:I(A.title),summary:I(A.summary),contentType:I(A.contentType)??I(o.defaultContentType),payload:A.payload,examples:Q.filter(W).map((ne)=>({name:I(ne.name),summary:I(ne.summary),payload:ne.payload})),event:Rs(E)}]}).sort((E,A)=>Number(E.event!==null)-Number(A.event!==null)),Y=(E)=>{for(let A of l){let Q=`${A}-${E}`;if(Object.hasOwn(V,Q))return{key:Q,value:V[Q]};let ne=Object.values(L).find((Ne)=>W(Ne)&&Object.hasOwn(Ne,Q));if(W(ne))return{key:Q,value:ne[Q]}}return},X=Y("close-codes"),fe=(Array.isArray(X?.value)?X.value:[]).flatMap((E)=>W(E)&&Pe(E.code)!==void 0?[{code:Pe(E.code),name:I(E.name)??"",description:I(E.description)??""}]:[]),se=Y("upgrade-refusals"),ke=(Array.isArray(se?.value)?se.value:[]).flatMap((E)=>W(E)&&Pe(E.status)!==void 0?[{status:Pe(E.status),code:I(E.code)??"",description:I(E.description)??"",contentType:I(E.contentType),headers:W(E.headers)?Object.fromEntries(Object.entries(E.headers).flatMap(([A,Q])=>typeof Q==="string"?[[A,Q]]:[])):{}}]:[]),ae=Y("limits"),Z=(E)=>{let A=Ye(E,"subprotocol",l);return A!==void 0&&I(A.value)!==void 0?A:void 0},ce=Z(k),le=ce===void 0?Z(V):void 0,tt=ce===void 0&&le===void 0?Ss(F?.description):void 0,rt=I(ce?.value)??I(le?.value)??tt;return{title:I(u.title)??"WebSocket API",version:I(u.version),description:I(u.description),server:w,subprotocol:{value:rt??a.defaultSubprotocol,fromDocument:rt!==void 0,source:ce!==void 0?"server-extension":le!==void 0?"connection-extension":tt!==void 0?"connection-prose":"default"},subprotocolKey:ce?.key??le?.key,extensionKeys:{security:C,limits:ae?.key,closeCodes:X?.key,upgradeRefusals:se?.key},securitySchemes:j,requirements:N,conjunctive:N.length>S,channels:O,operations:K,messages:_,limits:Os(ae?.value),closeCodes:fe,refusals:ke}}function Qn(o){let l=[o.limits&&{slug:He("limits"),label:"Limits",hint:o.extensionKeys.limits,keywords:o.limits.values.map(([h])=>h).join(" ")},o.closeCodes.length>0&&{slug:He("close-codes"),label:"Close codes",hint:o.extensionKeys.closeCodes,keywords:o.closeCodes.map((h)=>`${h.code} ${h.name}`).join(" ")},o.refusals.length>0&&{slug:He("upgrade-refusals"),label:"Upgrade refusals",hint:o.extensionKeys.upgradeRefusals,keywords:o.refusals.map((h)=>`${h.status} ${h.code}`).join(" ")}].filter((h)=>Boolean(h)),u=o.messages.filter((h)=>h.event===null),p=o.messages.filter((h)=>h.event!==null),y=(h)=>({slug:h.slug,label:h.name,hint:h.summary,keywords:`${h.title??""} ${h.summary??""}`});return[{title:"Connection",items:l},{title:"Channels",items:o.channels.map((h)=>({slug:h.slug,label:h.title,hint:h.address,keywords:`${h.key} ${h.address} ${h.parameters.map((v)=>v.name).join(" ")}`}))},{title:"Operations",items:o.operations.map((h)=>({slug:h.slug,label:h.title,hint:[h.action,h.permission].filter(Boolean).join(" · "),keywords:`${h.key} ${h.summary??""} ${h.permission??""}`}))},{title:"Control messages",items:u.map(y)},{title:"Event messages",items:p.map(y)}].filter((h)=>h.items.length>0)}function Xn(o,a){let l=a.toLowerCase().split(/\s+/).filter(Boolean);if(l.length===0)return[...o];return o.map((u)=>({...u,items:u.items.filter((p)=>{let y=`${p.slug} ${p.label} ${p.hint??""} ${p.keywords}`.toLowerCase();return l.every((h)=>y.includes(h))})})).filter((u)=>u.items.length>0)}function Yn(o,a){if(a==="limits"&&o.limits)return{kind:"limits"};if(a==="close-codes"&&o.closeCodes.length>0)return{kind:"close-codes"};if(a==="upgrade-refusals"&&o.refusals.length>0)return{kind:"upgrade-refusals"};let l=o.channels.find((y)=>y.slug===a);if(l)return{kind:"channel",channel:l};let u=o.operations.find((y)=>y.slug===a);if(u)return{kind:"operation",operation:u};let p=o.messages.find((y)=>y.slug===a);return p?{kind:"message",message:p}:null}function Qt(o,a){return o.operations.filter((l)=>l.channel===a)}function Zn(o,a){return o.channels.filter((l)=>l.messages.includes(a))}function tr(o,a){return o.operations.filter((l)=>l.messages.includes(a)||(l.reply?.messages.includes(a)??!1))}function nr(o,a){return[...new Set(Qt(o,a).flatMap((l)=>l.permission===void 0?[]:[l.permission]))]}function rr(o,a){let l=a.messages.flatMap((u)=>{let p=o.messages.find((y)=>y.key===u);return p?.event?[p.event.type]:[]});return[...new Set(l)]}function Es(o){try{return new RegExp(o,"u")}catch{return}}function Ds(o,a,l){let u=[...a].length,p=Pe(o.maxLength);if(p!==void 0&&u>p)return`At most ${p} characters (this is ${u}).`;let y=Pe(o.minLength);if(y!==void 0&&u<y)return`At least ${y} characters.`;let h=I(o.pattern),v=h===void 0?void 0:Es(h);if(v&&!v.test(a))return(h===void 0?void 0:l?.patternText?.[h])??`Must match ${h}.`;return null}function St(o,a,l,u){if(a==="")return null;if(l!==void 0)return Ds(l,a,u);return u?.nameRule?.(o,a)??null}function sr(o){return Object.fromEntries(o.map((a)=>[a.name,a.schema]))}function or(o,a,l={},u){let p=!0,y=o.replace(/\{([^}]+)\}/g,(h,v)=>{let k=a[v]??"";if(k===""||St(v,k,l[v],u)!==null)return p=!1,"";return u?.escapeValue?.(v,k)??k});return p?y:null}function ir(o,a,l){return o.parameters.flatMap((u)=>{let p=a[u.name]??"";if(p==="")return[`${u.name}: fill it in.`];let y=St(u.name,p,u.schema,l);return y===null?[]:[`${u.name}: ${y}`]})}function ar(o){return!o.isConnection&&!o.address.startsWith("/")}function lr(o,a){let l=(y)=>{let h=y;for(let v=0;v<16&&W(h)&&I(h.$ref);v++)h=qe(a,I(h.$ref));return h},u=l(o),p=W(u)&&W(u.properties)?l(u.properties.event):void 0;return W(p)&&W(p.properties)?p.properties.payload:void 0}function dr(o){let a=W(o)?o.event:void 0;return W(a)?a.payload:void 0}var Is=new Intl.NumberFormat(void 0,{maximumFractionDigits:0});function me(o){return Is.format(o)}function $s(o){if(/bytes$/i.test(o))return"bytes";if(/ms$/i.test(o))return"ms";if(/persecond$/i.test(o))return"per-second";return"count"}function Ls(o){let a=["KiB","MiB","GiB"],l=o,u="";for(let p of a){if(l<1024||l%1024!==0)break;l/=1024,u=p}return u===""?`${me(o)} bytes`:`${me(o)} bytes (${me(l)} ${u})`}function Ct(o){let a=`${me(o)} ms`;if(o>=60000&&o%60000===0)return`${a} (${me(o/60000)} min)`;if(o>=1000&&o%1000===0)return`${a} (${me(o/1000)} s)`;return a}function ur(o,a,l){switch(l?.unit??$s(o)){case"bytes":return Ls(a);case"ms":return Ct(a);case"per-second":return`${me(a)} / s`;default:return me(a)}}function be({text:o}){let a=o.split(/(`[^`]+`)/);return e(n,{children:a.map((l,u)=>l.length>2&&l.startsWith("`")&&l.endsWith("`")?e("code",{children:l.slice(1,-1)},u):l)})}function Pt({schema:o,root:a,label:l,depth:u=2}){return e("div",{className:"ws-schema","data-testid":"ws-schema",children:e(he,{schema:o,root:a,depth:u,label:l})})}function Ke({items:o,layout:a="grid",empty:l="—",className:u}){return e("dl",{className:U("kv",`kv-${a}`,u),children:o.map((p,y)=>{if(!p)return null;let h=p.value===null||p.value===void 0||p.value==="",v=p.key??(typeof p.label==="string"?p.label:`row-${y}`);return t("div",{className:"kv-row",children:[e("dt",{className:"kv-label",children:p.label}),t("dd",{className:U("kv-value",h&&"muted"),children:[h?l:p.value,p.hint&&e("span",{className:"kv-hint",children:p.hint})]})]},v)})})}function Ie({label:o,className:a,children:l}){return e("div",{className:"table-wrap",role:"region","aria-label":o,tabIndex:0,children:t("table",{className:U("table",a),children:[e("caption",{className:"visually-hidden",children:o}),l]})})}function pr({doc:o}){let{server:a,subprotocol:l}=o;return e(G,{title:"Server",children:a===null?e("p",{className:"muted",children:"The document names no server."}):e(Ke,{items:[{label:"URL",value:a.url&&e("code",{"data-testid":"ws-server-url",children:a.url})},{label:"Host",value:e("code",{children:a.host}),hint:a.hostIsTemplate?`A template: the document served over HTTP fills in the request's own host${a.hostDefault?` (default ${a.hostDefault})`:""}.`:"Taken from the request that fetched this document: the host you reached the API on."},{label:"Path",value:a.pathname&&e("code",{children:a.pathname})},{label:"Protocol",value:a.protocol&&e("code",{children:a.protocol}),hint:"wss when the API was reached over HTTPS."},{label:"Subprotocol",value:l.value===void 0?e("span",{className:"muted","data-testid":"ws-subprotocol",children:"Not stated"}):e("code",{"data-testid":"ws-subprotocol",children:l.value}),hint:t(n,{children:[e("span",{"data-testid":"ws-subprotocol-source",children:zn(o)}),l.fromDocument?". Optional: offer it in Sec-WebSocket-Protocol, or offer none. Offering others without it may be refused.":"."]})},a.description!==void 0&&{label:"About",value:a.description}]})})}function mr({doc:o}){let{requirements:a,securitySchemes:l,conjunctive:u}=o;return e(G,{title:"Security",children:e("div",{"data-testid":"ws-security",children:a.length===0?e("p",{className:"muted",children:"No security schemes are declared. The host application decides, on the upgrade and on each subscription; a browser sends its cookies with the upgrade."}):t(n,{children:[e("p",{children:a.length===1?"The connection must satisfy:":"The connection must satisfy any one of:"}),e("ul",{className:"ws-requirements","aria-label":"Security requirements",children:a.map((p)=>{let y=p.map((h)=>`${h.scheme}:${h.scopes.join(",")}`).join("+");return e("li",{children:p.map((h,v)=>t("span",{children:[v>0&&e("strong",{children:" and "}),e("code",{children:h.scheme}),h.scopes.length>0&&t("span",{className:"muted",children:[" ","(scopes: ",h.scopes.join(", "),")"]})]},h.scheme))},y)})}),u&&t("p",{className:"ws-note","data-testid":"ws-security-conjunctive",children:["AsyncAPI 3 can list only one scheme per requirement, so a requirement naming several is only in"," ",e("code",{children:o.extensionKeys.security??"the security extension"}),", which is what this list shows: every scheme within one requirement is needed together."]}),t(Ie,{label:"Security schemes",children:[e("thead",{children:t("tr",{children:[e("th",{scope:"col",children:"Scheme"}),e("th",{scope:"col",children:"Type"}),e("th",{scope:"col",children:"In a browser"})]})}),e("tbody",{children:l.map((p)=>t("tr",{"data-testid":`ws-scheme-${p.name}`,children:[t("td",{children:[e("code",{children:p.name}),p.description&&e("div",{className:"muted",children:p.description})]}),t("td",{children:[p.type,p.detail&&e("div",{className:"muted",children:p.detail})]}),e("td",{children:p.note?e("span",{className:"ws-note",children:e(be,{text:p.note})}):e("span",{className:"muted",children:"Can be sent."})})]},p.name))})]})]})})})}function Ws(o){if(o===!1)return"Off: a resume after a reconnect always reports a gap.";if(o===void 0)return"Not stated.";let a=[o.size!==void 0&&`the last ${me(o.size)} events`,o.maxAgeMs!==void 0&&`at most ${Ct(o.maxAgeMs)} old`].filter(Boolean);return a.length>0?`Keeps ${a.join(", ")}.`:"On."}function Tt({limits:o,extensionKey:a,limitsInfo:l}){return t(G,{title:"Limits",children:[t("p",{className:"muted",children:["What one connection is held to",a===void 0?"":t(n,{children:[" ","(",e("code",{children:a}),")"]}),"."]}),t(Ie,{label:"Limits",className:"ws-table",children:[e("thead",{children:t("tr",{children:[e("th",{scope:"col",children:"Limit"}),e("th",{scope:"col",children:"Value"}),e("th",{scope:"col",children:"Meaning"})]})}),t("tbody",{children:[o.values.map(([u,p])=>t("tr",{"data-testid":`ws-limit-${u}`,children:[t("td",{children:[l?.[u]?.label??u,e("div",{className:"muted",children:e("code",{children:u})})]}),e("td",{className:"ws-value",children:ur(u,p,l?.[u])}),e("td",{children:l?.[u]?.meaning??""})]},u)),t("tr",{"data-testid":"ws-limit-replay",children:[t("td",{children:["Replay",e("div",{className:"muted",children:e("code",{children:"replay"})})]}),e("td",{className:"ws-value",children:o.replay===!1?"off":o.replay===void 0?"—":[o.replay.size!==void 0&&`size ${me(o.replay.size)}`,o.replay.maxAgeMs!==void 0&&`maxAgeMs ${Ct(o.replay.maxAgeMs)}`].filter(Boolean).join(", ")}),t("td",{children:["The events kept for a resume. ",Ws(o.replay)]})]})]})]})]})}function Rt({doc:o}){return t(G,{title:"Close codes",children:[t("p",{className:"muted",children:["How an open connection is closed",o.extensionKeys.closeCodes===void 0?"":t(n,{children:[" ","(",e("code",{children:o.extensionKeys.closeCodes}),")"]}),"."]}),t(Ie,{label:"Close codes",className:"ws-table",children:[e("thead",{children:t("tr",{children:[e("th",{scope:"col",children:"Code"}),e("th",{scope:"col",children:"Name"}),e("th",{scope:"col",children:"When"})]})}),e("tbody",{children:o.closeCodes.map((a)=>t("tr",{"data-testid":`ws-close-${a.code}`,children:[e("td",{className:"ws-value",children:a.code}),e("td",{children:e("code",{children:a.name})}),e("td",{children:e(be,{text:a.description})})]},`${a.code}-${a.name}`))})]})]})}function Ot({doc:o}){return t(G,{title:"Upgrade refusals",children:[t("p",{className:"muted",children:["An upgrade can be refused before any socket exists, with an ordinary HTTP response whose body is a problem carrying ",e("code",{children:"code"}),o.extensionKeys.upgradeRefusals===void 0?"":t(n,{children:[" ","(",e("code",{children:o.extensionKeys.upgradeRefusals}),")"]}),"."]}),t("p",{className:"ws-note","data-testid":"ws-refusal-1006",children:["A browser never sees these: its ",e("code",{children:"WebSocket"})," exposes no status or body for a refused upgrade, only a close with code"," ",e("strong",{children:"1006"})," (abnormal closure). To tell them apart, make the same request over HTTP, or read the server's logs."]}),t(Ie,{label:"Upgrade refusals",className:"ws-table",children:[e("thead",{children:t("tr",{children:[e("th",{scope:"col",children:"Status"}),e("th",{scope:"col",children:"Code"}),e("th",{scope:"col",children:"When"}),e("th",{scope:"col",children:"Content type"}),e("th",{scope:"col",children:"Headers"})]})}),e("tbody",{children:o.refusals.map((a)=>t("tr",{"data-testid":`ws-refusal-${a.code}`,children:[e("td",{className:"ws-value",children:e(z,{tone:a.status>=500?"danger":"warning",children:a.status})}),e("td",{children:e("code",{children:a.code})}),e("td",{children:e(be,{text:a.description})}),e("td",{children:a.contentType&&e("code",{children:a.contentType})}),e("td",{children:Object.keys(a.headers).length===0?e("span",{className:"muted",children:"—"}):Object.entries(a.headers).map(([l,u])=>e("div",{children:t("code",{children:[l,": ",u]})},l))})]},`${a.status}-${a.code}`))})]})]})}function fr({doc:o}){return t("header",{className:"ws-header",children:[t("h1",{className:"screen-title",children:[o.title," ",o.version&&t(z,{tone:"neutral",title:"info.version",children:["v",o.version]})]}),e("p",{className:"muted ws-kicker",children:"WebSocket API (AsyncAPI 3.0)"}),o.description&&t("details",{className:"ws-description",children:[e("summary",{children:"About this socket"}),e(ie,{text:o.description})]})]})}function Xt({action:o,probe:a}){if(a===void 0)return t("span",{className:"ws-permission","data-testid":`ws-permission-${o}`,children:[e("code",{children:o})," ",e(z,{tone:"neutral",children:"permission"})]});let l=a(o);return t("span",{className:"ws-permission","data-testid":`ws-permission-${o}`,"data-has":l===void 0?"unknown":String(l),children:[e("code",{children:o})," ",l===void 0?e(z,{tone:"neutral",children:"Not an action this UI knows"}):e(z,{tone:l?"success":"danger",children:l?"You have this":"You lack this"})]})}function Ue({items:o,pathBase:a="",empty:l="None."}){if(o.length===0)return e("span",{className:"muted",children:l});return e("ul",{className:"ws-links",children:o.map((u)=>e("li",{children:e(oe,{to:Fe(u.slug,"",a),children:e("code",{children:u.label})})},u.slug))})}function gr({console:o}){return e("p",{className:"muted","data-testid":"ws-try-unavailable",children:o.unavailableReason??t(n,{children:["The ",o.label," is not available here."]})})}function qs({doc:o,channel:a,console:l,address:u}){let[p,y]=r({});if(!l.available)return e(G,{title:"Try it",children:e(gr,{console:l})});let h=or(a.address,p,sr(a.parameters),u),v=rr(o,a),k=h===null?null:l.channelLink(h,v),w=ir(a,p,u);return e(G,{title:"Try it",children:t("div",{className:"ws-try","data-testid":"ws-try-channel",children:[t("p",{className:"muted",children:["Opens the ",l.label," subscribed to this channel",v.length>0?`, showing the ${v.length} event types it carries`:"","."]}),a.parameters.length>0&&e("div",{className:"ws-try-fields",children:a.parameters.map((N)=>{let S=p[N.name]??"",C=St(N.name,S,N.schema,u);return e(Ce,{label:N.name,hint:N.description&&e(be,{text:N.description}),error:C,children:e(we,{value:S,onChange:(P)=>y((j)=>({...j,[N.name]:P})),autoComplete:"off",spellCheck:!1})},N.name)})}),t("p",{className:"ws-try-channel",children:["Channel:"," ",h===null?e("span",{className:"muted",children:"fill in every parameter"}):e("code",{"data-testid":"ws-try-address",children:h})]}),k===null?t(n,{children:[t("span",{className:"btn btn-primary ws-disabled","aria-disabled":"true","aria-describedby":`ws-try-reason-${a.key}`,"data-testid":"ws-try-disabled",children:["Open in the ",l.label]}),e("ul",{className:"ws-try-reason muted",id:`ws-try-reason-${a.key}`,"data-testid":"ws-try-reason",children:w.length>0?w.map((N)=>e("li",{children:N},N)):e("li",{children:l.noChannelReason?.(h??a.address)??t(n,{children:["The ",l.label," cannot open"," ",e("code",{children:h??a.address}),"."]})})})]}):t(oe,{to:k,className:"btn btn-primary","data-testid":"ws-try-link",children:["Open in the ",l.label]})]})})}function yr({doc:o,root:a,channel:l,limitsInfo:u,console:p,probe:y,address:h,pathBase:v}){let k=Qt(o,l.key),w=nr(o,l.key),N=l.messages.map((S)=>({slug:o.messages.find((P)=>P.key===S)?.slug??`message-${S}`,label:S}));return t("div",{className:"ws-pane","data-testid":`ws-pane-${l.slug}`,children:[t(G,{title:t(n,{children:[l.title," ",e(z,{tone:"info",children:"channel"})]}),children:[e(Ke,{items:[{label:l.isConnection?"Path":"Address",value:e("code",{"data-testid":"ws-channel-address",children:l.address}),hint:l.isConnection?"The socket itself: control messages travel here.":"A logical channel: subscribe with this name over the connection."},l.bindingMethod!==void 0&&{label:"Upgrade",value:e("code",{children:l.bindingMethod})},w.length>0&&{label:w.length===1?"Permission":"Permissions",value:e("span",{className:"ws-permissions",children:w.map((S)=>e(Xt,{action:S,probe:y},S))})}]}),l.description&&e(ie,{text:l.description})]}),l.parameters.length>0&&e(G,{title:"Parameters",children:t(Ie,{label:"Parameters",children:[e("thead",{children:t("tr",{children:[e("th",{scope:"col",children:"Name"}),e("th",{scope:"col",children:"Description"}),e("th",{scope:"col",children:"Value"})]})}),e("tbody",{children:l.parameters.map((S)=>t("tr",{children:[e("td",{children:e("code",{children:`{${S.name}}`})}),e("td",{children:S.description&&e(be,{text:S.description})}),e("td",{"data-testid":`ws-parameter-schema-${S.name}`,children:S.schema?e(he,{schema:S.schema,root:a,label:`Schema of {${S.name}}`}):e("span",{className:"muted",children:"Any string"})})]},S.name))})]})}),e(G,{title:"Operations",children:e(Ue,{items:k.map((S)=>({slug:S.slug,label:`${S.action??"?"} ${S.key}`})),pathBase:v})}),e(G,{title:`Messages (${N.length})`,children:e(Ue,{items:N,pathBase:v})}),p!==void 0&&ar(l)&&e(qs,{doc:o,channel:l,console:p,address:h},l.key),l.isConnection&&o.limits&&e(Tt,{limits:o.limits,extensionKey:o.extensionKeys.limits,limitsInfo:u}),l.isConnection&&o.closeCodes.length>0&&e(Rt,{doc:o}),l.isConnection&&o.refusals.length>0&&e(Ot,{doc:o})]})}function hr(o,a){return a.map((l)=>({slug:o.messages.find((u)=>u.key===l)?.slug??`message-${l}`,label:l}))}function br({doc:o,operation:a,probe:l,pathBase:u}){let p=o.channels.find((h)=>h.key===a.channel),y=o.channels.find((h)=>h.key===a.reply?.channel);return t("div",{className:"ws-pane","data-testid":`ws-pane-${a.slug}`,children:[e(G,{title:t(n,{children:[a.title," ",e(z,{tone:"accent",children:"operation"})]}),children:e(Ke,{items:[{label:"Direction",value:a.action&&t("span",{"data-testid":"ws-operation-action",children:[e(z,{tone:a.action==="send"?"info":"success",children:a.action})," ",a.action==="send"?"client → server":"server → client"]})},{label:"Channel",value:p&&e(oe,{to:Fe(p.slug,"",u),children:e("code",{children:p.address})})},a.permission!==void 0&&{label:"Permission",value:e(Xt,{action:a.permission,probe:l})},a.summary!==void 0&&{label:"Summary",value:e(be,{text:a.summary})}]})}),e(G,{title:a.action==="send"?"Sends":"Receives",children:e(Ue,{items:hr(o,a.messages),pathBase:u})}),a.reply&&e(G,{title:"Reply",children:t("div",{"data-testid":"ws-operation-reply",children:[t("p",{className:"muted",children:["The server answers on"," ",y?e(oe,{to:Fe(y.slug,"",u),children:e("code",{children:y.address})}):e("code",{children:a.reply.channel??"?"})," ","with one of:"]}),e(Ue,{items:hr(o,a.reply.messages),pathBase:u})]})})]})}function vr({doc:o,root:a,message:l,console:u,pathBase:p}){let y=Zn(o,l.key),h=tr(o,l.key),v=l.event?lr(l.payload,a):void 0,k=u!==void 0&&l.event!==null?u.messageLink(l,o):null;return t("div",{className:"ws-pane","data-testid":`ws-pane-${l.slug}`,children:[e(G,{title:t(n,{children:[l.title??l.name," ",e(z,{tone:l.event?"success":"neutral",children:l.event?`${l.event.kind} event`:"control message"})]}),children:e(Ke,{items:[{label:"Name",value:e("code",{"data-testid":"ws-message-name",children:l.name})},l.summary!==void 0&&{label:"Summary",value:e(be,{text:l.summary})},l.contentType!==void 0&&{label:"Content type",value:e("code",{children:l.contentType})},{label:"Channels",value:e(Ue,{items:y.map((w)=>({slug:w.slug,label:w.address})),pathBase:p})},{label:"Operations",value:e(Ue,{items:h.map((w)=>({slug:w.slug,label:w.key})),pathBase:p})}]})}),l.event&&v!==void 0&&t(G,{title:"Event payload",className:"ws-highlight",children:[t("p",{className:"muted",children:[e("code",{children:"event.payload"}),": what this ",l.event.kind," event says. It arrives inside the envelope below."]}),e("div",{"data-testid":"ws-event-payload",children:e(Pt,{schema:v,root:a,label:`Payload of ${l.name}`})})]}),e(G,{title:l.event?"Full envelope":"Payload",children:e("div",{"data-testid":"ws-message-payload",children:e(Pt,{schema:l.payload,root:a,label:`Schema of ${l.name}`,depth:l.event?1:2})})}),l.examples.length>0&&e(G,{title:l.examples.length===1?"Example":"Examples",children:l.examples.map((w,N)=>e(Bs,{example:w,index:N,isEvent:l.event!==null},N))}),l.event&&u!==void 0&&e(G,{title:"Try it",children:!u.available?e(gr,{console:u}):k===null?e("p",{className:"muted",children:"No channel in this document carries it."}):t("div",{className:"ws-try",children:[t("p",{className:"muted",children:["Opens the ",u.label," on every ",l.event.kind,", showing only ",e("code",{children:l.event.type})," events."]}),t(oe,{to:k,className:"btn btn-primary","data-testid":"ws-try-link",children:["Watch ",l.event.type," events"]})]})})]})}function Bs({example:o,index:a,isEvent:l}){let u=o.name??`Example ${a+1}`,p=l?dr(o.payload):void 0;return t("div",{className:"ws-example","data-testid":"ws-example",children:[t("div",{className:"ws-example-head",children:[e("strong",{"data-testid":"ws-example-name",children:u}),e(xe,{text:()=>JSON.stringify(o.payload,null,2),label:"Copy JSON",ariaLabel:`Copy example ${u} as JSON`})]}),o.summary&&e("p",{className:"muted","data-testid":"ws-example-summary",children:e(be,{text:o.summary})}),p!==void 0&&t("div",{className:"ws-example-event ws-highlight","data-testid":"ws-example-event-payload",children:[e("p",{className:"muted",children:e("code",{children:"event.payload"})}),e(Xe,{value:p,label:`event.payload of ${u}`,expandDepth:4})]}),t("div",{"data-testid":"ws-example-frame",children:[p!==void 0&&e("p",{className:"muted",children:"The whole frame"}),e(Xe,{value:o.payload,label:`Example ${u}`,expandDepth:p!==void 0?1:2})]})]})}function js({groups:o,selected:a,query:l,onQuery:u,pathBase:p}){let y=Xn(o,l),h=T(null),v=()=>Array.from(h.current?.querySelectorAll("a.ws-nav-link")??[]),k=(w)=>{let N=xt(w.key,v(),document.activeElement);if(N)w.preventDefault(),N.focus()};return t("nav",{ref:h,className:"ws-sidebar","aria-label":"WebSocket reference",children:[e(Ce,{label:"Search",children:e(we,{type:"search",value:l,onChange:u,onKeyDown:(w)=>{let N=v()[0];if(w.key==="ArrowDown"&&N)w.preventDefault(),N.focus()},placeholder:"Channel, message, code…",...kt,autoComplete:"off",spellCheck:!1})}),y.length===0&&t("p",{className:"muted","data-testid":"ws-search-empty",children:["Nothing matches “",l,"”."]}),e("div",{className:"ws-sidebar-list",onKeyDown:k,children:y.map((w)=>t("section",{className:"ws-group","data-testid":`ws-group-${w.title}`,children:[e("h2",{className:"ws-group-title",children:w.title}),e("ul",{children:w.items.map((N)=>e("li",{children:t(oe,{to:Fe(N.slug,l,p),className:"ws-nav-link",activeMatch:"exact","data-selected":N.slug===a?"true":void 0,"data-testid":`ws-nav-${N.slug}`,children:[e("span",{className:"ws-nav-label",children:N.label}),N.hint&&e("span",{className:"ws-nav-hint",children:N.hint})]})},N.slug))})]},w.title))})]})}function Yt({document:o,extensions:a,defaultSubprotocol:l,limitsInfo:u,console:p,probe:y,address:h,pathBase:v=""}){let k={console:p,probe:y,address:h,pathBase:v},w=g(()=>Gn(o,{extensions:a,defaultSubprotocol:l}),[o,a,l]),N=g(()=>Qn(w),[w]),{item:S}=de(),[C,P]=nt("q"),j=w.channels.find((V)=>V.isConnection),L=S??j?.slug??w.channels[0]?.slug??"",O=Yn(w,L),F;if(O===null)F=e(ft,{title:"No such item",description:t(n,{children:["This document has nothing called ",e("code",{children:L}),"."," ",e(oe,{to:`${v}/ws`,children:"Back to the connection"}),"."]})});else switch(O.kind){case"channel":F=e(yr,{doc:w,root:o,channel:O.channel,limitsInfo:u,...k});break;case"operation":F=e(br,{doc:w,operation:O.operation,...k});break;case"message":F=e(vr,{doc:w,root:o,message:O.message,...k});break;case"limits":F=w.limits&&e(Tt,{limits:w.limits,extensionKey:w.extensionKeys.limits,limitsInfo:u});break;case"close-codes":F=e(Rt,{doc:w});break;case"upgrade-refusals":F=e(Ot,{doc:w});break}return t("div",{className:"screen ws-docs","data-testid":"ws-docs",children:[e(fr,{doc:w}),t("div",{className:"ws-overview",children:[e(pr,{doc:w}),e(mr,{doc:w})]}),t("div",{className:"ws-layout",children:[e(js,{groups:N,selected:O?L:"",query:C,onQuery:P,pathBase:v}),e("section",{className:"ws-main","aria-label":"Selected item","data-testid":"ws-main","data-selected":O?L:"",children:F})]})]})}function xr(o,a){let u=(/^https?:\/\//.test(o)?new URL(o).pathname:o).replace(/\/+$/,"");return u!==""&&a.startsWith(`${u}/`)?a.slice(u.length):a}var Ze={all:["docs"],openapi:(o)=>["docs","openapi",o],asyncapi:(o)=>["docs","asyncapi",o]};function wr(o,a,l){return o.request("GET",xr(o.base,a),{signal:l})}function kr(o,a,l){return o.request("GET",xr(o.base,a),{signal:l})}function Hs(o){return o===void 0?void 0:new ye({kind:o.kind,status:o.status,code:o.code,title:o.title,detail:o.detail,type:o.type,issues:o.issues,context:o.context,instance:o.instance})}function Fs(){let o=s(),a=pe(),l=m(),u=et(),p=J(),{docs:y}=l,h=y?.openapi,v=i({queryKey:Ze.openapi(h??""),queryFn:({signal:N})=>wr(o,h,N),enabled:h!==void 0,staleTime:1/0}),k=g(()=>({base:o.base,request:(N,S,C)=>o.request(N,S,C),requestRaw:async(N,S,C)=>{let P=await o.requestRaw(N,S,C);return{...P,error:Hs(P.error)}}}),[o]),w=g(()=>({version:1,title:a.title,basePath:a.basePath,assetsPath:a.assetsPath,documentUrl:h??"",csrfHeader:a.csrfHeader,extensions:["x-bun-common","x-bun-jobs"],theme:a.theme,unauthorized:null}),[a,h]);if(h===void 0)return e("div",{className:"screen",children:e(d,{headingLevel:1,title:"No HTTP documentation",description:"This API does not serve its OpenAPI document."})});if(v.isPending)return e("div",{className:"screen",children:e(f,{label:"Loading the OpenAPI document",showLabel:!0})});if(v.isError)return e("div",{className:"screen",children:e(x,{headingLevel:1,error:v.error,title:"Could not load the OpenAPI document",onRetry:()=>void v.refetch()})});return e(gt,{value:w,children:e(zt,{doc:v.data,pathBase:"/docs",client:k,probe:(N)=>u(N),readOnly:l.readOnly,onChanged:()=>void p.invalidateQueries({predicate:(N)=>N.queryKey[0]!==Ze.all[0]})})})}var Ks=new RegExp(wt),Us=`Letters, digits, "_", "." and "-" only (not "." or ".."), at most ${ht}.`,Nr={nameRule:(o,a)=>{if(o==="jobId")return null;return a.length<=ht&&Ks.test(a)?null:Us},patternText:{[wt]:'Letters, digits, "_", "." and "-" only (not "." or "..").'},escapeValue:(o,a)=>o==="jobId"?er(a):a};function Sr(o){return Ur.includes(o)}var Cr=Rn;function Pr(o,a,l){let u=vt(o,l);if(u===null)return null;let p=Vt(u),y=p.filter((v)=>a.includes(v)),h=new URLSearchParams({channel:o});if(y.length>0&&y.length<p.length)h.set("types",y.join(","));return`/events?${h.toString()}`}function Tr(o,a){return{available:a,label:"Events console",unavailableReason:t(n,{children:["The Events console is not available here: it needs the API's socket, the ",e("code",{children:"events.connect"})," permission and the manage screens."]}),noChannelReason:(l)=>t(n,{children:["The Events console has no channel ",e("code",{children:l})," in mode"," ",e("code",{children:o}),"."]}),channelLink:(l,u)=>Pr(l,u,o),messageLink:(l,u)=>{if(l.event===null)return null;let y=[l.event.kind==="queue"?"queues":l.event.kind==="worker"?"workers":"runners","all"].find((v)=>u.channels.some((k)=>k.key===v));if(y===void 0)return null;let h=new URLSearchParams({channel:y,types:l.event.type});return vt(y,o)===null?null:`/events?${h.toString()}`}}}var Rr={maxMessageBytes:{label:"Largest client frame",meaning:"A bigger frame is refused MESSAGE_TOO_LARGE, then the socket closes 1009.",unit:"bytes"},messagesPerSecond:{label:"Client frames per second",meaning:"The sustained rate; over it, a RATE_LIMITED error.",unit:"per-second"},rateLimitBurst:{label:"Rate-limit burst",meaning:"Frames that may be sent at once before the rate applies.",unit:"count"},rateLimitBreachWindowMs:{label:"Breach window",meaning:"A second rate-limit breach within it closes the socket 1008.",unit:"ms"},maxSubscriptions:{label:"Subscriptions per connection",meaning:"Channels one connection may hold; more are refused SUBSCRIPTION_LIMIT.",unit:"count"},maxChannelsPerFrame:{label:"Channels per frame",meaning:"Channels one subscribe or unsubscribe may list: send more in several frames.",unit:"count"},maxConnections:{label:"Connections",meaning:"Open connections the API accepts; the next upgrade is refused 429 CONNECTION_LIMIT.",unit:"count"},heartbeatMs:{label:"Heartbeat",meaning:"How often a heartbeat is sent to an idle connection.",unit:"ms"},maxBufferedBytes:{label:"Send buffer",meaning:"Unsent bytes past which a connection is behind and stops receiving events.",unit:"bytes"},slowConsumerTimeoutMs:{label:"Slow-consumer timeout",meaning:"How long a connection may stay behind before it is closed 4008.",unit:"ms"},coalesceProgressMs:{label:"Progress coalescing",meaning:"A job's progress events are merged to at most one per interval.",unit:"ms"}};function Js(){let o=s(),a=m(),l=et(),u=cr().some((w)=>w.id==="events"),{docs:p}=a,y=p?.asyncapi,h=i({queryKey:Ze.asyncapi(y??""),queryFn:({signal:w})=>kr(o,y,w),enabled:y!==void 0,staleTime:1/0}),v=g(()=>Tr(a.mode,u),[a.mode,u]),k;if(y===void 0)k=t(n,{children:[e("h1",{className:"screen-title",children:"WebSocket API"}),e(d,{title:"This API has no live-events socket",description:"There is no AsyncAPI document to show: the API was created without its WebSocket, so the screens refresh by polling over HTTP.",action:e(b,{to:"/docs",children:"Back to the API docs"})})]});else if(h.data)k=e(Yt,{document:h.data,defaultSubprotocol:Cr,limitsInfo:Rr,console:v,address:Nr,probe:(w)=>Sr(w)?l(w):void 0,pathBase:"/docs"});else if(h.error)k=t(n,{children:[e("h1",{className:"screen-title",children:"WebSocket API"}),e(x,{error:h.error,title:"Could not load the AsyncAPI document",onRetry:()=>void h.refetch()})]});else k=t(n,{children:[e("h1",{className:"screen-title",children:"WebSocket API"}),e(R,{children:e(f,{label:"Loading the AsyncAPI document",showLabel:!0})})]});return e("div",{className:"screen ws-docs","data-testid":"ws-docs",children:k})}function $d(){let{docs:o}=m();return t("div",{className:"screen","data-testid":"docs-home",children:[e("h1",{className:"screen-title",children:"API docs"}),o===null?e(d,{title:"No documentation",description:"This API does not serve its OpenAPI or AsyncAPI documents."}):t("div",{className:"docs-home",children:[t(R,{title:"HTTP API",children:[e("p",{children:"Every route, its parameters, request and response schemas, the permission it needs, and a panel to try it."}),e(b,{to:"/docs/http",children:"Open the HTTP reference"})]}),o.asyncapi!==void 0&&t(R,{title:"WebSocket API",children:[e("p",{children:"The live-events socket: its channels, the messages on each, limits and close codes."}),e(b,{to:"/docs/ws",children:"Open the WebSocket reference"})]})]})]})}export{$d as DocsHomeScreen,Fs as HttpDocsScreen,Js as WsDocsScreen};
|
|
8
|
-
|
|
9
|
-
//# debugId=D1995604E6A6BEB364756E2164756E21
|
|
10
|
-
//# sourceMappingURL=index-y5zw06cs.js.map
|
|
@@ -1,5 +0,0 @@
|
|
|
1
|
-
import{D,r,N,e,a}from"./main-xf44bv26.js";var c=1500;async function y(o){try{if(typeof navigator>"u"||!navigator.clipboard)return!1;return await navigator.clipboard.writeText(o),!0}catch{return!1}}var m="[Circular]";function g(o){let i=new WeakSet,s=(t)=>{if(typeof t==="bigint")return t.toString();if(typeof t==="function"||typeof t==="symbol")return;if(typeof t!=="object"||t===null)return t;if(i.has(t))return m;let u=t;if(typeof u.toJSON==="function")return s(u.toJSON.call(t));i.add(t);try{if(Array.isArray(t))return t.map((n)=>{let f=s(n);return f===void 0?null:f});let l={};for(let[n,f]of Object.entries(t)){let p=s(f);if(p!==void 0)l[n]=p}return l}finally{i.delete(t)}};return s(o)}function na(o,i=2){return JSON.stringify(g(o),null,i)??"undefined"}function ye({text:o,label:i="Copy",ariaLabel:s,size:t="sm",className:u,onCopied:l}){let[n,f]=r("idle");D(()=>{if(n==="idle")return;let d=setTimeout(f,c,"idle");return()=>clearTimeout(d)},[n]);let p=async()=>{let d=await y(typeof o==="function"?o():o);f(d?"copied":"failed"),l?.(d)};return e(a,{variant:"ghost",size:t,className:N("copy-button",u),"aria-label":s,"data-status":n,onClick:()=>void p(),children:e("span",{"aria-live":"polite",children:n==="copied"?"Copied":n==="failed"?"Copy failed":i})})}
|
|
2
|
-
export{na,ye};
|
|
3
|
-
|
|
4
|
-
//# debugId=C71FC6A8C5142DD264756E2164756E21
|
|
5
|
-
//# sourceMappingURL=main-3xxhy5jh.js.map
|
|
@@ -1,5 +0,0 @@
|
|
|
1
|
-
import{H,K,tr,nr,N,n,e,t,p,Fe,se,Te,b,ot,Yt,o,h,l,I}from"./main-xf44bv26.js";import{Ie,v}from"./main-smabxbn4.js";import{F}from"./main-6xdkyzv1.js";class Q extends Error{key;constructor(r,O={}){super(r,{cause:O.cause});this.name="ClientError",this.key=O.key}}class jt extends Q{status;error;response;constructor(r,O,E,s){super(`HTTP ${r} from ${s??E.url}`,{key:s});this.name="HttpError",this.status=r,this.error=O,this.response=E}}class X extends Q{status;declared;response;constructor(r,O,E){super(`${E??r.url} answered ${r.status}, which it does not declare (declared: ${O.join(", ")})`,{key:E});this.name="UnexpectedStatusError",this.status=r.status,this.declared=O,this.response=r}}class He extends Q{constructor(r,O={}){super(r,O);this.name="NetworkError"}}class Ht extends Q{timeout;constructor(r,O){super(`${O??"Request"} timed out after ${r} ms`,{key:O});this.name="TimeoutError",this.timeout=r}}class Ge extends Q{direction;status;issues;constructor(r,O,E,s){let D=E.map((A)=>`${A.target}${A.path?`.${A.path}`:""}: ${A.message}`).join("; ");super(`${r} ${O==="response"?`response ${s}`:O} failed validation: ${D}`,{key:r});this.name="ValidationError",this.direction=O,this.status=s,this.issues=E}}class Qn extends Q{code;status;issues;detail;type;constructor(r,O,E){super(`${r}${E===void 0?"":` ${E}`}: the server answered ${O.code}${O.detail===void 0?"":` (${O.detail})`}`,{key:r});this.name="ChannelError",this.code=O.code,this.status=O.status,this.issues=O.issues??[],this.detail=O.detail,this.type=E}}class wr extends Q{type;id;timeout;constructor(r,O,E,s){super(`${r} ${O}: no reply within ${s} ms`,{key:r});this.name="RequestTimeoutError",this.type=O,this.id=E,this.timeout=s}}class xr extends Q{code;reason;constructor(r,O,E){super(`${r}: the socket closed (${O}${E?` ${E}`:""}) before the reply`,{key:r});this.name="DisconnectedError",this.code=O,this.reason=E}}class Gt extends Q{code;reason;constructor(r,O,E){super(`${r}: ${O}${E===void 0?"":` (${E})`}`,{key:r});this.name="ChannelClosedError",this.code=E,this.reason=O}}var Er=/^[$_\p{ID_Start}]$/u,Nr=/^[$\u200C\u200D\p{ID_Continue}]$/u,Ve=new Map;function sr(r,O){if(r[O]==='"'){let s="",D=O+1;while(D<r.length&&r[D]!=='"'){if(r[D]==="\\")D++;s+=r[D]??"",D++}return[s,D+1]}let E=O;if(Er.test(r[E]??""))do E++;while(Nr.test(r[E]??""));return[r.slice(O,E),E]}function Dr(r,O){let E=0,s=O;do{if(r[s]==="\\")s++;else if(r[s]==="(")E++;else if(r[s]===")")E--;s++}while(E>0&&s<r.length);return s}function fe(r,O=0){let E=[],s="",D=()=>{if(s)E.push({kind:"text",value:s});s=""};while(O<r.length){let A=r[O];if(A==="\\")s+=r[O+1]??"",O+=2;else if(A==="}")return D(),[E,O+1];else if(A==="{"){D();let[T,V]=fe(r,O+1);E.push({kind:"group",tokens:T}),O=V}else if(A===":"||A==="*"){let[T,V]=sr(r,O+1);if(!T){s+=A,O++;continue}if(D(),O=V,A==="*"){E.push({kind:"wildcard",name:T});continue}if(r[O]==="(")O=Dr(r,O);let B=r[O]==="?";if(B){O++;let k=E.at(-1);if(k?.kind==="text"&&k.value.endsWith("/")){if(k.value=k.value.slice(0,-1),!k.value)E.pop();E.push({kind:"group",tokens:[{kind:"text",value:"/"},{kind:"param",name:T,optional:!1}]});continue}}E.push({kind:"param",name:T,optional:B})}else s+=A,O++}return D(),[E,O]}function ge(r){return encodeURIComponent(String(r))}function Ce(r,O){let E="",s=[];for(let D of r)if(D.kind==="text")E+=D.value;else if(D.kind==="group"){let[A,T]=Ce(D.tokens,O);if(!T.length)E+=A}else{let A=Object.hasOwn(O,D.name)?O[D.name]:void 0;if(A===void 0||A===null){if(!(D.kind==="param"&&D.optional))s.push(D.name);continue}if(D.kind==="wildcard"){let T=Array.isArray(A)?A:[A];if(!T.length){s.push(D.name);continue}E+=T.map(ge).join("/")}else E+=ge(A)}return[E,s]}function ye(r,O={},E){let s=Ve.get(r);if(!s)s=fe(r)[0],Ve.set(r,s);let[D,A]=Ce(s,O);if(A.length)throw new Q(`Missing path param${A.length>1?"s":""} ${A.map((T)=>`"${T}"`).join(", ")} for ${r}`,{key:E});return D}var he=new Set(["__proto__","constructor","prototype"]);function Je(r){return encodeURIComponent(r).replace(/\./g,"%2E")}function Me(r){switch(typeof r){case"string":return r;case"number":case"boolean":case"bigint":return String(r)}if(r instanceof Date)return r.toISOString();return}function te(r,O,E){if(E===void 0||E===null)return;let s=Me(E);if(s!==void 0){r.push([O,s]);return}if(Array.isArray(E)){let D=E.filter((T)=>T!==void 0&&T!==null);if(D.every((T)=>Me(T)!==void 0)&&D.length>1)for(let T of D)te(r,O,T);else D.forEach((T,V)=>te(r,`${O}[${V}]`,T));return}if(typeof E==="object")for(let[D,A]of Object.entries(E)){if(he.has(D)||D==="")continue;te(r,`${O}.${Je(D)}`,A)}}function Ne(r){if(r===null||typeof r!=="object")return[];let O=[];for(let[E,s]of Object.entries(r)){if(he.has(E)||E==="")continue;te(O,Je(E),s)}return O}function De(r){return Ne(r).map(([O,E])=>`${O}=${encodeURIComponent(E)}`).join("&")}function ie(r,O,E=Math.random){let s=Math.max(1,Math.floor(r)),D=Math.min(O.baseMs*2**(s-1),O.maxMs);if(!O.jitter)return Math.max(0,D);let A=D*O.jitter;return Math.max(0,D+(E()*2-1)*A)}function Kn(r,O=Date.now()){if(r===null)return;let E=r.trim();if(/^\d+$/.test(E))return Number(E)*1000;if(!/[a-z]{3}/i.test(E))return;let s=Date.parse(E);if(Number.isNaN(s))return;return Math.max(0,s-O)}var Be=Object.freeze({attempts:2,methods:Object.freeze(["GET","HEAD","OPTIONS","PUT","DELETE"]),on:Object.freeze([408,429,500,502,503,504,"network"]),baseMs:300,maxMs:1e4,jitter:0.5,respectRetryAfter:!0}),ir=30000,Ar=new Set([204,205,304]),Ir=["get","post","put","patch","delete","head","options"],ar,ae=()=>ar??=(H("yyw5hmrp"),import("./bodies-yyw5hmrp.js"));function ur(r){return typeof r==="object"&&Object.entries(r).some(([O,E])=>O!=="onFailure"&&E!==!1&&E!==void 0)}function _r(){try{return"production"}catch{return"development"}}function Rr(r){let O=Be;for(let E of r){if(E===void 0)continue;if(E===!1){O=!1;continue}let s=O===!1?Be:O,D=Object.fromEntries(Object.entries(E).filter(([,A])=>A!==void 0));O={...s,...D}}return O}function Ae(r){return typeof FormData<"u"&&r instanceof FormData||typeof URLSearchParams<"u"&&r instanceof URLSearchParams||typeof Blob<"u"&&r instanceof Blob||typeof ReadableStream<"u"&&r instanceof ReadableStream||r instanceof ArrayBuffer||ArrayBuffer.isView(r)}function j(r){return r.reason}function Tr(r,O){return new Promise((E,s)=>{let D=()=>s(j(O));O.addEventListener("abort",D,{once:!0}),r.then((A)=>{O.removeEventListener("abort",D),E(A)},(A)=>{O.removeEventListener("abort",D),s(A)})})}function ve(r,O){return new Promise((E,s)=>{if(O.aborted){s(j(O));return}let D,A=()=>{clearTimeout(D),s(j(O))};D=setTimeout(()=>{O.removeEventListener("abort",A),E()},r),O.addEventListener("abort",A,{once:!0})})}async function Oe(r){try{await r.body?.cancel()}catch{}}function dr(r){return/^application\/(?:[\w.-]+\+)?json\b/i.test(r)}async function Ye(r,O,E,s,D,A){if(O==="HEAD"||Ar.has(r.status))return await Oe(r),{value:void 0};let T=r.headers.get("content-type")??"";if(D===void 0){if(/^text\/event-stream\b/i.test(T))return{value:void 0,unread:!0};if(dr(T)){let V=await r.text();if(!V)return{value:void 0};try{return{value:JSON.parse(V)}}catch(B){throw new Q(`${E} answered ${r.status} with a body that is not JSON`,{key:E,cause:B})}}if(!T||/^text\//i.test(T)){let V=await r.text();return{value:V===""?void 0:V}}}return(await ae()).read(r,s,D,A,E,Q)}class we{config;#r;generation=0;#e;constructor(r){this.config=r}async token(){if(this.#r!==void 0)return this.#r;let r=this.config?.token;return(typeof r==="function"?await r():r)??void 0}triggers(r){if(!this.config?.refresh)return!1;return(this.config.on??[401]).includes(r)}refreshFor(r){if(this.#e)return this.#e;if(r!==this.generation)return Promise.resolve(!0);let O=this.config.refresh;return this.#e=(async()=>{try{let E=await O();if(E===null)return!1;return this.#r=E??void 0,this.generation++,!0}finally{this.#e=void 0}})(),this.#e}}function ue(r={}){let O=new we(r.auth),E=r.logger??console,s=r.routes??{},D=r.manifest??{},A=(r.mode??_r())==="development",T,V=()=>T??=(H("199pberh"),import("./validation-199pberh.js")).then((i)=>i.createChecks({development:A,source:r.schemas,logger:E,errors:{ClientError:Q,ValidationError:Ge}})),B=(i,a)=>{let u=s[i]??{};return{timeout:a.timeout??u.timeout??r.timeout??ir,retry:Rr([r.retry,u.retry,a.retry]),throwOnError:a.throwOnError??r.throwOnError??!1,undeclaredStatus:a.undeclaredStatus??r.undeclaredStatus??"throw",headers:[r.headers,u.headers,a.headers],middleware:[...r.middleware??[],...u.middleware??[],...a.middleware??[]]}},k=(i,a,u)=>{let _=De(a.query);return`${r.baseUrl??""}${ye(i,a.params,u)}${_?`?${_}`:""}`},ee=(i,a)=>{if(/^[a-z][a-z\d+.-]*:/i.test(i))return i;let u=globalThis.location?.href;if(u)return new URL(i,u).href;if(r.fetch)return new URL(i,"http://localhost").href;throw new Q(`${a}: "${i}" is relative, and there is no page to resolve it against; give an absolute baseUrl, or a fetch that serves relative requests`,{key:a})},g=async(i,a,u,_,R,d,U)=>{let c={method:i.method,credentials:r.credentials??"same-origin",signal:R,body:u.body,headers:u.type===void 0?void 0:{"content-type":u.type}};if(typeof ReadableStream<"u"&&u.body instanceof ReadableStream)c.duplex="half";let P={...i,attempt:d,request:new Request(a,c)};for(let C of _.headers){if(C===void 0)continue;let S=typeof C==="function"?await C(P):C;new Headers(Array.isArray(S)||S instanceof Headers?S:JSON.parse(JSON.stringify(S))).forEach((x,Z)=>{P.request.headers.set(Z,x)})}let w=O.generation,Y=await O.token();if(Y!==void 0&&!P.request.headers.has("authorization"))P.request.headers.set("authorization",`Bearer ${Y}`);if(d===1&&U!==void 0)await U(P.request);let G=async(C)=>{let S=_.middleware[C];if(S)return S(P,()=>G(C+1));if(R.aborted)throw j(R);try{return await Tr((r.fetch??fetch)(P.request),R)}catch(x){if(R.aborted)throw j(R);throw new He(`${P.key}: fetch failed`,{key:P.key,cause:x})}};return{response:await G(0),generation:w}},f=async(i,a,u,_,R,d,U)=>{let c=_.retry!==!1&&_.retry.methods.some((P)=>P.toUpperCase()===i.method)&&!(typeof ReadableStream<"u"&&u.body instanceof ReadableStream)?_.retry:void 0;for(let P=1;;P++){let w=d+P-1,Y,G;try{Y=await g(i,a,u,_,R,w,U)}catch(S){if(R.aborted)throw j(R);if(!(S instanceof He))throw S;G=S}if(!c||P>c.attempts){if(Y)return{...Y,attempts:w};throw G}if(Y){let{response:S}=Y;if(!c.on.includes(S.status))return{...Y,attempts:w};let x=c.respectRetryAfter?Kn(S.headers.get("retry-after")):void 0,Z=x===void 0?ie(P,c):Math.min(x,c.maxMs);await Oe(S),E.debug(`${i.key}: ${S.status}, retry ${P} of ${c.attempts} in ${Math.round(Z)} ms`),await ve(Z,R);continue}if(!c.on.includes("network"))throw G;let C=ie(P,c);E.debug(`${i.key}: network failure, retry ${P} of ${c.attempts} in ${Math.round(C)} ms`),await ve(C,R)}},y=async(i,a,u,_,R,d)=>{let U=i.status,c=D[a],P=c?.statuses;if(P&&!P.includes(U)){if(_.throwOnError||_.undeclaredStatus==="throw")throw new X(i,P,a);let S=(await Ye(i,u,a,d)).value;return{ok:!1,status:U,error:S,response:i}}let w=await Ye(i,u,a,d,c?.chunks?.[U],R&&((S)=>R.response(U,S))),{filename:Y,value:G}=w;if(R!==void 0&&w.unread)try{await R.responseHeaders(U,i.headers)}catch(S){throw await Oe(i),S}else if(R!==void 0)G=await R.response(U,w.value,i.headers);let C=U>=200&&U<300;if(_.throwOnError){if(C)return G;throw new jt(U,G,i,a)}return C?{ok:C,status:U,data:G,...Y===void 0?{}:{filename:Y},response:i}:{ok:C,status:U,error:G,response:i}},J=async(i,a,u)=>{let _=i.body;if(a)return{body:(await ae()).formDataOf(Ne(_),i.files)};if(_===void 0)return{};if(Ae(_))return{body:_};if(u==="urlencoded"&&typeof _==="object"&&_!==null)return{body:De(_),type:"application/x-www-form-urlencoded"};return{body:JSON.stringify(_),type:"application/json"}},M=async(i,a={})=>{let u=i.indexOf(" ");if(u<1)throw new Q(`"${i}" is not a route key ("VERB /path")`,{key:i});let _=i.slice(0,u).toUpperCase(),R=i.slice(u+1),d=B(i,a),U=[r.validate,s[i]?.validate,a.validate],c=A&&r.schemas!==void 0||U.some(ur)?(await V())(i,U):void 0,P=D[i]?.bodyType,w=a.files!==void 0&&a.files!==null&&Object.values(a.files).some((W)=>W!=null),Y=w||P==="multipart"&&typeof a.body==="object"&&a.body!==null&&!Ae(a.body),G=w?{...a,files:(await ae()).normaliseFiles(a.files)}:a,C=c===void 0?G:await c.request(G,Ae(G.body)),S=ee(k(R,C,i),i),x=await J(C,Y,P),Z=new AbortController,Or=d.timeout===!1?void 0:setTimeout(()=>Z.abort(new Ht(d.timeout,i)),d.timeout),oe=C.signal?AbortSignal.any([C.signal,Z.signal]):Z.signal,pe={key:i,method:_,path:R,options:C};try{let{response:W,generation:be,attempts:Se}=await f(pe,S,x,d,oe,1,c?.headers);if(O.triggers(W.status)&&await O.refreshFor(be))await Oe(W),{response:W,generation:be,attempts:Se}=await f(pe,S,x,d,oe,Se+1);return await y(W,i,_,d,c,C.as)}catch(W){if(oe.aborted)throw j(oe);throw W}finally{clearTimeout(Or)}},m={request:M,url:(i,a={})=>k(i,a,i),[Symbol.for("@kingsleyweb/bun-client")]:r};for(let i of Ir){let a=i.toUpperCase();m[i]=(u,_)=>M(`${a} ${u}`,_)}let L=new Map;for(let[i,a]of Object.entries(D))if(a?.operationId)L.set(a.operationId,i);return m.op=new Proxy({},{get:(i,a)=>{if(typeof a!=="string")return;let u=L.get(a);if(!u)return()=>Promise.reject(new Q(`No operation "${a}" in the client's manifest`));return(_)=>M(u,_)}}),m}var de=new WeakMap;function re(r){let O=de.get(r);if(O)return O;let E={etags:new Map,pending:new Map,headerTags:new Map};return O=E,de.set(r,E),r.getQueryCache().subscribe((s)=>{let D=s.query.queryHash;if(s.type==="removed"){E.etags.delete(D),E.pending.delete(D),E.headerTags.delete(D);return}if(s.type!=="updated"||s.action.type!=="success")return;if(s.action.manual){E.etags.delete(D),E.pending.delete(D);return}if(!E.pending.has(D))return;let A=E.pending.get(D);if(E.pending.delete(D),A==null)E.etags.delete(D);else E.etags.set(D,A)}),E}function _e(r){let O=r.headers.get("cache-tag"),E=r.headers.get("surrogate-key");if(O===null&&E===null)return;let s=new Set;for(let D of O?.split(",")??[])if(D.trim())s.add(D.trim());for(let D of E?.split(/\s+/)??[])if(D)s.add(D);return[...s]}function Ur(r){return/(?:^|,)\s*no-store\s*(?:,|$)/i.test(r.headers.get("cache-control")??"")}function Ee(r,O){let E=r.getQueryCache();return E.get(Te(O))??E.find({queryKey:O,exact:!0})}function xe(r,O){let E=O.meta?.tags,s=new Set(Array.isArray(E)?E.filter((D)=>typeof D==="string"):[]);for(let D of de.get(r)?.headerTags.get(O.queryHash)??[])s.add(D);return[...s]}function qe(r,O,E,s){let D=new Set(O);if(D.size===0)return Promise.resolve();return r.invalidateQueries({...E,predicate:(A)=>xe(r,A).some((T)=>D.has(T))},s)}var mr=Symbol.for("@kingsleyweb/bun-client/query#live"),cr;function lr(r,O,E={}){let s,D=!1;return(cr??=(H("erz9pvnm"),import("./live-erz9pvnm.js"))).then((A)=>{if(!D)s=A.startLive(r,O,E,xe)},(A)=>{(r[Symbol.for("@kingsleyweb/bun-client")]?.logger??console).error("live(): could not load",A)}),()=>{D=!0,s?.()}}var Pr=Symbol.for("@kingsleyweb/bun-client/graphql");function Qe(r){let O={};for(let[E,s]of Object.entries(r??{}))if(s!==void 0&&s!==null)O[E]=String(s);return O}var pr=/\{([^{}]+)\}/g;function Re(r,O){let E=[];for(let s of r??[]){let D=!1,A=s.replace(pr,(T,V)=>{let B=O?.[V];if(B===void 0||B===null)return D=!0,"";return String(B)});if(!D&&!E.includes(A))E.push(A)}return E}function z(r){return typeof r==="object"&&r!==null?r:{}}function We(r,O={}){let E=r,s=O.manifest??{},D=(g)=>({params:Qe(g.params),query:{...g.query}}),A=async(g,f,y,J)=>{let M,m=async(L,i)=>{if(J!==void 0)L.request.headers.set("if-none-match",J);return M=await i(),M};try{return{data:await E.request(g,{...f,signal:y,throwOnError:!0,middleware:[...f.middleware??[],m]}),response:M}}catch(L){return{error:L,response:M}}};return{key:(g,f)=>f===void 0?[g]:[g,D(f)],query:(g,f)=>{let y=`GET ${g}`,J=f??{};return{queryKey:[y,D(J)],queryFn:async(M)=>{let m=re(M.client),L=Ee(M.client,M.queryKey),i=L?.queryHash,a=L?.state.data,u=i!==void 0&&a!==void 0?m.etags.get(i):void 0,_=await A(y,J,M.signal,u),{response:R}=_,d=u!==void 0&&R?.status===304;if(_.error!==void 0&&!d)throw _.error;if(d&&_.error!==void 0)await R?.body?.cancel().catch(()=>{return});if(i!==void 0){let U=R&&_e(R);if(U!==void 0)m.headerTags.set(i,U);else if(!d)m.headerTags.delete(i);m.pending.set(i,R===void 0||Ur(R)?null:R.headers.get("etag")??(d?u:null))}return d?a:_.data},meta:{tags:Re(s[y]?.cache?.tags,J.params)}}},infinite:(g,f,y)=>{let J=`GET ${g}`,{[y.pageParam]:M,...m}=f.query??{},L={...f,query:m};return{queryKey:[J,D(L),"infinite"],queryFn:async(i)=>{let a=i.pageParam===void 0||i.pageParam===null?m:{...m,[y.pageParam]:i.pageParam},u=await A(J,{...L,query:a},i.signal,void 0),_=u.response&&_e(u.response);if(_!==void 0){let R=Ee(i.client,i.queryKey)?.queryHash;if(R!==void 0){let d=re(i.client),U=d.headerTags.get(R)??[];d.headerTags.set(R,[...new Set([...U,..._])])}}if(u.error!==void 0)throw u.error;return u.data},initialPageParam:"initialPageParam"in y?y.initialPageParam:M,getNextPageParam:y.next,...y.previous===void 0?{}:{getPreviousPageParam:y.previous},meta:{tags:Re(s[J]?.cache?.tags,L.params)}}},mutation:(g,f={})=>{let y=s[g]?.cache?.invalidates??[],J=Object.entries(f.optimistic??{}).filter((m)=>typeof m[1]==="function"),M=(m,L,i)=>m.getQueryCache().findAll({queryKey:[L]}).filter((a)=>{let u=a.queryKey;if(u.length!==2)return!1;let _=z(z(u[1]).params);return Object.entries(_).every(([R,d])=>!(R in i)||i[R]===d)});return{mutationKey:[g],mutationFn:(m)=>E.request(g,{...f.validate===void 0?{}:{validate:f.validate},...z(m),throwOnError:!0}),onMutate:async(m,L)=>{let i=[],a=re(L.client);if(J.length===0)return{written:i};let u=Qe(z(z(m).params));for(let[_]of J)await L.client.cancelQueries({queryKey:[_]});for(let[_,R]of J)for(let d of M(L.client,_,u)){let U=d.state.data;if(U===void 0)continue;let c=R(U,m);if(c===void 0)continue;i.push({queryKey:d.queryKey,data:U,dataUpdatedAt:d.state.dataUpdatedAt,etag:a.etags.get(d.queryHash)}),L.client.setQueryData(d.queryKey,c)}return{written:i}},onError:(m,L,i,a)=>{let u=re(a.client);for(let{queryKey:_,data:R,dataUpdatedAt:d,etag:U}of[...i?.written??[]].reverse()){let c=Ee(a.client,_);if(c===void 0)continue;if(c.setState({data:R,dataUpdatedAt:d}),U!==void 0)u.etags.set(c.queryHash,U)}},onSuccess:async(m,L,i,a)=>{await qe(a.client,Re(y,z(z(L).params)))},onSettled:async(m,L,i,a,u)=>{await Promise.all((a?.written??[]).map(({queryKey:_})=>u.client.invalidateQueries({queryKey:_,exact:!0})))},meta:{invalidates:[...y]}}},graphql:(g,f,y,J={})=>{let M=g[Pr];if(M===void 0)throw TypeError("q.graphql() takes a client from createGraphQLClient (./graphql)");let m=M.describe(f),{tags:L,...i}=J;return{queryKey:[M.url,m.name??m.source,y??{}],queryFn:async(a)=>{let u,_=async(R,d)=>u=await d();try{return(await g.query(f,y,{...i,signal:a.signal,throwOnError:!0,throwOnGraphQLErrors:!0,middleware:[...i.middleware??[],_]})).data}finally{let R=Ee(a.client,a.queryKey)?.queryHash,d=u&&_e(u);if(R!==void 0){let U=re(a.client);if(d!==void 0)U.headerTags.set(R,d);else if(u!==void 0)U.headerTags.delete(R)}}},meta:{tags:[...L??[]]}}},invalidateTags:qe,[mr]:(g,f)=>lr(E,g,f)}}var me={"GET /analytics/jobs":{operationId:"getJobsAnalytics",statuses:[200,400,401,403]},"GET /analytics/runners":{operationId:"getRunnersAnalytics",statuses:[200,400,401,403]},"GET /analytics/workers":{operationId:"getWorkersAnalytics",statuses:[200,400,401,403]},"GET /asyncapi.json":{operationId:"getAsyncApiDocument",statuses:[200,401,403]},"GET /definitions":{operationId:"listDefinitions",statuses:[200,401,403]},"GET /demand":{operationId:"listQueueDemand",statuses:[200,400,401,403]},"GET /meta":{operationId:"getMeta",statuses:[200,401,403]},"GET /meta/permissions":{operationId:"getPermissions",statuses:[200,400,401,403]},"GET /openapi.json":{operationId:"getOpenApiDocument",statuses:[200,401,403]},"GET /overview":{operationId:"getOverview",statuses:[200,400,401,403]},"GET /overview/added":{operationId:"getAddedByState",statuses:[200,400,401,403]},"GET /providers":{operationId:"listProviders",statuses:[200,401,403]},"GET /providers/:id/schema":{operationId:"getProviderSchema",statuses:[200,400,401,403,404]},"POST /providers/:id/validate":{operationId:"validateProvider",statuses:[200,400,401,403,404,413,415]},"GET /queues":{operationId:"listQueues",statuses:[200,400,401,403]},"GET /queues/:queue":{operationId:"getQueue",statuses:[200,400,401,403,404]},"GET /queues/:queue/analytics/jobs":{operationId:"getQueueJobsAnalytics",statuses:[200,400,401,403,404]},"GET /queues/:queue/analytics/workers/:key":{operationId:"getWorkerAnalytics",statuses:[200,400,401,403,404]},"POST /queues/:queue/clean":{operationId:"cleanQueue",statuses:[200,400,401,403,404,413,415]},"GET /queues/:queue/counts":{operationId:"getQueueCounts",statuses:[200,400,401,403,404]},"GET /queues/:queue/counts/added":{operationId:"getQueueAddedByState",statuses:[200,400,401,403,404]},"GET /queues/:queue/demand":{operationId:"getQueueDemand",statuses:[200,400,401,403,404]},"POST /queues/:queue/drain":{operationId:"drainQueue",statuses:[200,400,401,403,404,413,415]},"POST /queues/:queue/flows":{operationId:"addFlow",statuses:[200,201,400,401,403,404,413,415]},"GET /queues/:queue/job-defaults":{operationId:"getJobDefaults",statuses:[200,400,401,403,404]},"PUT /queues/:queue/job-defaults":{operationId:"setJobDefaults",statuses:[200,400,401,403,404,409,413,415]},"DELETE /queues/:queue/job-defaults":{operationId:"resetJobDefaults",statuses:[200,400,401,403,404,409,413,415]},"POST /queues/:queue/job-defaults/apply":{operationId:"applyJobDefaults",statuses:[200,400,401,403,404,409,413,415]},"GET /queues/:queue/jobs":{operationId:"listJobs",statuses:[200,400,401,403,404]},"POST /queues/:queue/jobs":{operationId:"addJob",statuses:[200,201,400,401,403,404,413,415]},"GET /queues/:queue/jobs/:id":{operationId:"getJob",statuses:[200,400,401,403,404]},"PATCH /queues/:queue/jobs/:id":{operationId:"updateJob",statuses:[200,400,401,403,404,409,413,415]},"DELETE /queues/:queue/jobs/:id":{operationId:"removeJob",statuses:[204,400,401,403,404,409,413,415]},"GET /queues/:queue/jobs/:id/children":{operationId:"getJobChildren",statuses:[200,400,401,403,404]},"POST /queues/:queue/jobs/:id/fail":{operationId:"failJob",statuses:[200,400,401,403,404,409,413,415]},"GET /queues/:queue/jobs/:id/logs":{operationId:"getJobLogs",statuses:[200,400,401,403,404]},"DELETE /queues/:queue/jobs/:id/logs":{operationId:"clearJobLogs",statuses:[200,400,401,403,404,409,413,415]},"POST /queues/:queue/jobs/:id/promote":{operationId:"promoteJob",statuses:[200,400,401,403,404,409,413,415]},"POST /queues/:queue/jobs/:id/retry":{operationId:"retryJob",statuses:[200,400,401,403,404,409,413,415]},"POST /queues/:queue/jobs/lookup":{operationId:"lookupJobs",statuses:[200,400,401,403,404,413]},"POST /queues/:queue/jobs/promote":{operationId:"promoteJobs",statuses:[200,400,401,403,404,413,415]},"POST /queues/:queue/jobs/remove":{operationId:"removeJobs",statuses:[200,400,401,403,404,413,415]},"POST /queues/:queue/jobs/retry":{operationId:"retryJobs",statuses:[200,400,401,403,404,413,415]},"POST /queues/:queue/jobs/retry-all":{operationId:"retryAllJobs",statuses:[200,400,401,403,404,409,413,415]},"GET /queues/:queue/limits":{operationId:"getQueueLimits",statuses:[200,400,401,403,404]},"PUT /queues/:queue/limits":{operationId:"setQueueLimits",statuses:[200,400,401,403,404,409,413,415]},"POST /queues/:queue/pause":{operationId:"pauseQueue",statuses:[200,400,401,403,404,413,415]},"GET /queues/:queue/repeatables":{operationId:"listRepeatables",statuses:[200,400,401,403,404]},"DELETE /queues/:queue/repeatables/:key":{operationId:"removeRepeatable",statuses:[204,400,401,403,404,413,415]},"POST /queues/:queue/repeatables/:key/disable":{operationId:"disableRepeatable",statuses:[200,400,401,403,404,413,415]},"POST /queues/:queue/repeatables/:key/enable":{operationId:"enableRepeatable",statuses:[200,400,401,403,404,413,415]},"POST /queues/:queue/resume":{operationId:"resumeQueue",statuses:[200,400,401,403,404,413,415]},"GET /queues/:queue/summon":{operationId:"getQueueSummon",statuses:[200,400,401,403,404,409,503]},"POST /queues/:queue/summon":{operationId:"summonQueue",statuses:[200,400,401,403,404,409,413,415,503]},"POST /queues/:queue/summon/reset":{operationId:"resetQueueSummon",statuses:[200,400,401,403,404,409,413,415,503]},"GET /queues/:queue/throughput":{operationId:"getQueueThroughput",statuses:[200,400,401,403,404]},"GET /queues/:queue/worker-configs":{operationId:"listWorkerConfigs",statuses:[200,400,401,403,404]},"PUT /queues/:queue/worker-configs/:key":{operationId:"configureWorker",statuses:[200,400,401,403,404,409,413,415]},"DELETE /queues/:queue/worker-configs/:key":{operationId:"resetWorkerConfig",statuses:[200,400,401,403,404,409,413,415]},"GET /queues/:queue/workers":{operationId:"listQueueWorkers",statuses:[200,400,401,403,404]},"GET /queues/:queue/workers/:worker":{operationId:"getWorker",statuses:[200,400,401,403,404,410]},"POST /queues/:queue/workers/:worker/pause":{operationId:"pauseWorker",statuses:[200,202,400,401,403,404,409,410,413,415]},"POST /queues/:queue/workers/:worker/resume":{operationId:"resumeWorker",statuses:[200,202,400,401,403,404,409,410,413,415]},"POST /queues/:queue/workers/:worker/start":{operationId:"startWorker",statuses:[200,202,400,401,403,404,409,410,413,415]},"POST /queues/:queue/workers/:worker/stop":{operationId:"stopWorker",statuses:[200,202,400,401,403,404,409,410,413,415]},"GET /runners":{operationId:"listRunners",statuses:[200,401,403]},"GET /runners/:runner":{operationId:"getRunner",statuses:[200,400,401,403,404]},"GET /runners/:runner/analytics":{operationId:"getRunnerAnalytics",statuses:[200,400,401,403,404]},"PUT /runners/:runner/config":{operationId:"configureRunner",statuses:[200,400,401,403,404,409,413,415]},"DELETE /runners/:runner/config":{operationId:"resetRunnerConfig",statuses:[200,400,401,403,404,409,413,415]},"GET /runners/:runner/history":{operationId:"getRunnerHistory",statuses:[200,400,401,403,404]},"DELETE /runners/:runner/history":{operationId:"clearRunnerHistory",statuses:[200,400,401,403,404,413,415]},"POST /runners/:runner/kill":{operationId:"killRunner",statuses:[200,202,400,401,403,404,409,413,415]},"POST /runners/:runner/pause":{operationId:"pauseRunner",statuses:[200,400,401,403,404,413,415]},"POST /runners/:runner/resume":{operationId:"resumeRunner",statuses:[200,400,401,403,404,413,415]},"GET /runners/:runner/runs/:runId/logs":{operationId:"getRunLogs",statuses:[200,400,401,403,404,409]},"PUT /runners/:runner/schedule":{operationId:"rescheduleRunner",statuses:[200,400,401,403,404,413,415]},"GET /runners/:runner/stats":{operationId:"getRunnerStats",statuses:[200,400,401,403,404]},"POST /runners/:runner/stats/reset":{operationId:"resetRunnerStats",statuses:[204,400,401,403,404,409,413,415]},"POST /runners/:runner/trigger":{operationId:"triggerRunner",statuses:[200,202,400,401,403,404,409,413,415]},"GET /summon":{operationId:"listSummonControllers",statuses:[200,401,403]},"GET /summon/groups":{operationId:"listSummonGroups",statuses:[200,401,403]},"GET /summon/groups/:group":{operationId:"getSummonGroup",statuses:[200,400,401,403,409,503]},"POST /summon/groups/:group/reset":{operationId:"resetSummonGroup",statuses:[200,400,401,403,409,413,415,503]},"GET /workers":{operationId:"listWorkers",statuses:[200,400,401,403]}};var Ke=new WeakMap;function q(r){let O=Ke.get(r);if(O===void 0){let E=ue({baseUrl:r.base,manifest:me,fetch:(s)=>br(r,s),headers:(s)=>r.headers(s.method),middleware:[Fr(r)],retry:!1,timeout:!1});O={client:E,q:We(E,{manifest:me})},Ke.set(r,O)}return O}async function br(r,O){let E={};O.headers.forEach((D,A)=>{E[A]=D});let s={method:O.method,headers:E,credentials:O.credentials,signal:O.signal};if(O.method!=="GET"&&O.method!=="HEAD"){let D=await O.text();if(D!=="")s.body=D}return r.fetch(O.url,s)}function Sr(r){let O=r.split(";")[0]?.trim().toLowerCase()??"";return O==="application/json"||O.endsWith("+json")}function Fr(r){return async(O,E)=>{let s=await E();if(!s.ok||s.status===204||Sr(s.headers.get("content-type")??""))return s;let D=await s.clone().text();if(D==="")return s;throw new K({kind:"parse",status:s.status,code:"INVALID_RESPONSE",title:"The API answered something other than JSON",detail:D.trim().slice(0,300)||void 0,instance:Vr(r,O.request.url)})}}function Vr(r,O){let{pathname:E}=new URL(O,"http://localhost");return E.startsWith(r.base)?E.slice(r.base.length):E}function ce(r,O){if(tr(r.error))return K.fromProblem({...r.error,status:r.status});return new K({kind:"http",status:r.status,code:`HTTP_${r.status}`,title:r.response.statusText||`Request failed (${r.status})`,...typeof r.error==="string"&&r.error.trim()!==""?{detail:r.error.trim().slice(0,300)}:{},instance:O})}async function le(r,O){if(r instanceof X){let E=await r.response.text().catch(()=>"");return nr(r.response,E,O)}if(r instanceof He){let E=r.cause;return new K({kind:"network",status:0,code:"NETWORK_ERROR",title:"The API could not be reached",detail:E instanceof Error?E.message:String(E),instance:O,cause:E})}return r}async function ne(r,O){let E;try{E=await r}catch(s){throw await le(s,O)}if(E.ok)return E.data;throw ce(E,O)}var gr="SUMMON_NOT_CONFIGURED",ke={status:(r,O)=>q(r).q.key("GET /queues/:queue/summon",{params:{queue:O}}),list:(r)=>q(r).q.key("GET /summon",{}),groups:(r)=>q(r).q.key("GET /summon/groups",{}),changed:(r,O)=>[ke.status(r,O),q(r).q.key("GET /summon"),q(r).q.key("GET /summon/groups")]};function Le(r,O=""){return`/queues/${encodeURIComponent(r)}/summon${O}`}function $e(r){return typeof r.queue==="string"&&typeof r.local==="boolean"&&typeof r.inert==="boolean"&&Array.isArray(r.pending)&&typeof r.failures==="number"}function fr(r){return ot(r)&&typeof r.queue==="string"&&(r.budget===void 0||ot(r.budget))}function yr(r){return ot(r)&&typeof r.name==="string"&&ot(r.budget)&&ot(r.queues)}async function $n(r,O,E){let s=Le(O),D;try{D=await q(r).client.get("/queues/:queue/summon",{params:{queue:O},signal:E})}catch(A){throw await le(A,s)}if(D.ok)return Yt(D.data,$e,"a queue's summon status",s);if(D.status===409&&D.error.code===gr||D.status===404)return null;throw ce(D,s)}async function Lo(r,O,E){let s=Le(O),D=await ne(q(r).client.post("/queues/:queue/summon",{params:{queue:O},body:{force:E}}),s);return Yt(D,(A)=>typeof A.action==="string","a summon check",s)}async function Po(r,O){let s=await ne(q(r).client.get("/summon",{signal:O}),"/summon");return Yt(s,(D)=>Array.isArray(D.controllers)&&D.controllers.every(fr),"the summon controllers","/summon")}async function ko(r,O){let s=await ne(q(r).client.get("/summon/groups",{signal:O}),"/summon/groups");return Yt(s,(D)=>Array.isArray(D.groups)&&D.groups.every(yr),"the summon groups","/summon/groups")}async function Uo(r,O,E={}){let s=Le(O,"/reset"),D=await ne(q(r).client.post("/queues/:queue/summon/reset",{params:{queue:O},body:E.budget===!0?{budget:!0}:void 0}),s);return Yt(D,$e,"a queue's summon status",s)}function Ue(r){return`/queues/${encodeURIComponent(r)}?panel=summon`}function je(r){return`/summon?group=${encodeURIComponent(r)}`}var Mr=86400000,hr={hour:"this hour",day:"today"};function pt(r,O){let E=new Date(r).toISOString(),s=E.slice(11,16);if(Math.abs(r-O)>=Mr)return`${E.slice(0,10)} ${s} UTC`;return s==="00:00"?"midnight UTC":`${s} UTC`}function ze(r,O,E,s,D){let A=Math.max(0,E-O),T=hr[r];return{window:r,used:O,limit:E,remaining:A,exhausted:O>=E,resetsAt:s,left:`${o(A)} of ${o(E)} left ${T}`,usedText:`${o(O)} of ${o(E)} used ${T}`,resetAt:pt(s,D)}}function Jr(r){return r.off===!0||r.limitsUnknown!==!0&&(r.perHour===void 0||r.perDay===void 0)}function Xe(r){return r.off!==!0&&r.limitsUnknown===!0}function yn(r){if(Jr(r)||Xe(r))return;return`Used ${o(r.hour)} of ${o(r.perHour??0)} this hour, ${o(r.day)} of ${o(r.perDay??0)} today (UTC)`}function er(r,O,E={}){let s=`Counts reset at ${pt(r.hourResetsAt,O)} and at ${pt(r.dayResetsAt,O)}`;if(Xe(r))return{state:"unknown",text:`${o(r.hour)} this hour, ${o(r.day)} today (UTC), limits unknown`,hint:`Its limits are set where its controller runs, and show here after its next summon attempt. ${s}`};if(r.off===!0||r.perHour===void 0||r.perDay===void 0){if(E.group===!0&&r.off===!0)return{state:"off",text:"Off: the group's budget applies",resets:`This queue's own count: ${o(r.hour)} this hour, ${o(r.day)} today (UTC). ${s}`};return{state:"off",text:`Off: ${o(r.hour)} this hour, ${o(r.day)} today (UTC), no limit`,resets:s}}let D=ze("hour",r.hour,r.perHour,r.hourResetsAt,O),A=ze("day",r.day,r.perDay,r.dayResetsAt,O);return{state:"on",hour:D,day:A,exhausted:D.exhausted||A.exhausted,usedText:yn(r)??""}}function Ze({budget:r,testId:O,group:E=!1}){let s=Ie(),D=er(r,s,{group:E});if(D.state==="unknown")return e("span",{className:"summon-budget","data-testid":O,"data-limits-unknown":"true",title:D.hint,children:D.text});if(D.state==="off")return e("span",{className:"summon-budget","data-testid":O,title:D.resets,children:D.text});return t("span",{className:"summon-budget","data-testid":O,"data-exhausted":D.exhausted,title:D.usedText,children:[e(rr,{view:D.hour,testId:`${O}-hour`}),e("span",{className:"visually-hidden",children:"; "}),e(rr,{view:D.day,testId:`${O}-day`})]})}function rr({view:r,testId:O}){let E=Math.max(r.limit,1);return t("span",{className:N("summon-budget-window",r.exhausted&&"is-exhausted"),"data-testid":O,"data-exhausted":r.exhausted,title:r.usedText,children:[e("meter",{className:"summon-budget-meter",min:0,max:E,low:E*0.2,high:E*0.5,optimum:E,value:Math.min(r.remaining,E),"aria-hidden":"true"}),t("span",{children:[r.exhausted&&t(n,{children:[e(p,{tone:"warning",title:"Nothing is summoned until this window resets.",children:"Exhausted"})," "]}),r.left,", resets at ",r.resetAt," (",e(v,{value:r.resetsAt}),")"]})]})}function Wn(r){return Object.entries(r.queues).map(([O,E])=>({queue:O,day:E.day,lastAt:E.lastAt})).sort((O,E)=>E.day-O.day||(O.queue<E.queue?-1:O.queue>E.queue?1:0))}function zn(r,O){let E=Object.entries(r.circuits??{});if(E.length>0)return E.sort(([s],[D])=>s<D?-1:s>D?1:0).map(([s,D])=>({kind:s,failures:D.failures,openUntil:D.openUntil,openedBy:D.openedBy}));if(r.circuit===void 0)return[];return[{kind:O,failures:r.circuit.failures,openUntil:r.circuit.openUntil,openedBy:r.circuit.openedBy}]}function Pe(r){return r===void 0||r===""?"this summoner":r}function Qt(r){return r.unit==="shared"}var Yn="One summoned process serves every queue of this group.";function Cr(r){return Qt(r)?"Shared":"Per queue"}function or(r){return Qt(r)?{heading:"Attempts serving each queue today",note:"One attempt serves every queue of the unit, so each counts it: these do not add up to the group's budget.",empty:"No attempts served the unit's queues today.",tableLabel:`Attempts serving each queue of the group ${r.name} today`}:{heading:"Charged today",note:void 0,empty:"No attempts charged to the group today.",tableLabel:`Attempts charged to the group ${r.name} today`}}var Mo="Today, per queue",Fo="For a per-queue group, each count is the attempts that queue charged to the group today. For a shared unit, each attempt is counted on every queue it served, so the counts do not add up to the group's.",Vo="each attempt serves every queue";function Bo({group:r,queue:O,kind:E}){let s=Wn(r),D=zn(r,E),A=or(r);return t("section",{className:"summon-group","data-testid":"summon-group","aria-label":`Summon group ${r.name}`,children:[t("h3",{className:"summon-heading",children:["Summon group ",e(Br,{name:r.name}),Qt(r)&&t(n,{children:[" ",e(p,{tone:"neutral",title:Yn,testId:"summon-group-unit",children:"Shared unit"})]})]}),e(F,{items:[{key:"group-budget",label:"Group budget",value:e(Ze,{budget:r.budget,testId:"summon-group-budget"}),hint:yn(r.budget)},...D.map((T)=>({key:`circuit-${T.kind??""}`,label:`Shared circuit, ${Pe(T.kind)}`,value:e(Lr,{circuit:T})}))]}),e("h4",{className:"summon-subheading",children:A.heading}),A.note!==void 0&&s.length>0&&e("p",{className:"muted summon-group-note","data-testid":"summon-group-shares-note",children:A.note}),s.length===0?e("p",{className:"muted","data-testid":"summon-group-shares-empty",children:A.empty}):e(Gr,{label:A.tableLabel,queue:O,shares:s})]})}function Br({name:r}){let O=se("summonList")===!0,E=se("summonStoredStatus")===!0,s=Fe()("queues.list");if(!(O&&E&&s))return e("span",{"data-testid":"summon-group-name",children:r});return e(b,{to:je(r),title:`The group ${r} on the Summoning screen`,"data-testid":"summon-group-name",children:r})}function Gr({label:r,queue:O,shares:E}){return t(I,{label:r,children:[e("thead",{children:t("tr",{children:[e("th",{scope:"col",children:"Queue"}),e("th",{scope:"col",className:"num",children:"Attempts today"}),e("th",{scope:"col",children:"Last"})]})}),e("tbody",{children:E.map((s)=>{let D=s.queue===O;return t("tr",{"data-testid":`summon-group-share-${s.queue}`,"aria-current":D?"true":void 0,className:N(D&&"is-current"),children:[t("th",{scope:"row",children:[e(b,{to:Ue(s.queue),title:`The Summon tab of ${s.queue}`,children:s.queue}),D&&e("span",{className:"muted",children:" (this queue)"})]}),e("td",{className:"num",children:o(s.day)}),e("td",{children:e(v,{value:s.lastAt})})]},s.queue)})})]})}function Lr({circuit:r,compact:O=!1,testId:E}){let s=Ie(),D=Pe(r.kind),A=E??`summon-group-circuit-${r.kind===void 0||r.kind===""?"this-summoner":r.kind}`,T=`${h(r.failures,"consecutive failure")} across the group`,V=r.openedBy,B=V?.detail===void 0?void 0:l(V.detail),k=r.openUntil;if(k===void 0)return O?t("span",{"data-testid":A,"data-open":"false",title:T,children:[D,": closed"]}):t("span",{"data-testid":A,"data-open":"false",children:[e(p,{tone:"success",children:"Closed"})," ",e("span",{className:"muted",children:T})]});let ee=V!==void 0&&t(n,{children:[", opened by"," ",e(b,{to:Ue(V.queue),title:`The Summon tab of ${V.queue}`,children:V.queue})]});if(O)return t("span",{className:"summon-group-circuit is-open","data-testid":A,"data-open":"true",title:B===void 0?T:`${T}: ${B}`,children:[D,": open until ",pt(k,s)," (",e(v,{value:k}),")",ee]});return t("span",{className:"summon-group-circuit is-open","data-testid":A,"data-open":"true",children:[e(p,{tone:"warning",title:"After repeated failures across the group nothing is summoned for this kind until then, apart from one trial attempt.",children:"Open"})," ","until ",pt(k,s)," (",e(v,{value:k}),")",ee,B!==void 0&&t("span",{className:"muted",children:[" — ",B]})]})}
|
|
2
|
-
export{Q,jt,He,Ht,Ge,Qn,wr,xr,Gt,Kn,ke,$n,Lo,Po,ko,Uo,Ue,pt,yn,Ze,Wn,zn,Qt,Yn,Cr,Mo,Fo,Vo,Bo,Lr};
|
|
3
|
-
|
|
4
|
-
//# debugId=2C85EE4DCEA7DE6B64756E2164756E21
|
|
5
|
-
//# sourceMappingURL=main-47391fgm.js.map
|
|
@@ -1,4 +0,0 @@
|
|
|
1
|
-
import{w,c,r,Z,Xe,E,n,e,t,p,s,gt,m,y,se,J,z,i,G,a,zt,de,b,oe,le,rt,be,j,d,f,R,x,o,Y,h,l,te,we,u,M,V,S,P,xe,Be,I,ne}from"./main-xf44bv26.js";import{v}from"./main-smabxbn4.js";import{yr,kn,ae,ut,We,Mt,br,Xr,eo,to,no,ro,oo,ao,Un,so,io,on,Ft,an,Ot,Je,sn,ln,un}from"./main-pqke97qp.js";import{dt,dn}from"./main-2n5wnj51.js";import{Le,ct}from"./main-jex4pqaa.js";import{je,Oe}from"./main-b35rfpdf.js";import{k}from"./main-v2f8a4g3.js";import{O}from"./main-zk3n47nq.js";import{ie}from"./main-qahvywvw.js";import{re}from"./main-fcq7hfk0.js";import{A}from"./main-9qd3nqs5.js";import{ye}from"./main-3xxhy5jh.js";import{F}from"./main-6xdkyzv1.js";function Pn(g){return g.open?e(co,{...g}):null}function co({queue:g,onClose:N}){let B=s(),D=m(),L=te(),_=zt(),C=c(),U=D.limits.maxJobDataBytes,T=D.addableNames,Q=T!==null&&T.length===0,[W,K]=r(()=>on({addableNames:T,maxBytes:U})),[H,ee]=r(!1),me=we(),pe=O({mutationFn:(X)=>io(B,g,X),invalidate:ut(g),toastErrors:!1,onSuccess:(X)=>{let Ce={label:"View job",onClick:()=>_(We(g,X.job.id))};if(X.added)L.success(`Job added to ${g}`,{description:`Id ${X.job.id}`,action:Ce});else L.info("A job with this id already exists",{description:`Nothing was added; ${X.job.id} is the existing job.`,action:Ce});N()}}),Ne=H?Ft(W):{},ce=pe.fieldErrors,ue=E(pe.error)?pe.error:null,Ae=ue?.code==="NAME_NOT_ADDABLE"||ue?.code==="SERIALIZATION"?ue.code:null,he=(X)=>(X==="opts.runAt"?me.problems["opts.runAt"]:void 0)??Ne[X]??ce[X]??(X==="name"&&Ae==="NAME_NOT_ADDABLE"&&ue?Ot(ue,"add")??ue.detail:void 0)??(X==="data"&&Ae==="SERIALIZATION"&&ue?Ot(ue,"add")??ue.detail:void 0),q=pe.error&&!Ae&&(Object.keys(ce).length===0||pe.unplacedIssues.length>0)?pe.error:null,fe=ce.body??ce.opts,ge=(X)=>K((Ce)=>({...Ce,...X})),ve=(X)=>{if(X.preventDefault(),ee(!0),Q||me.blocked||Object.keys(Ft(W)).length>0)return;pe.mutate(an(W))},Ie=()=>{if(!pe.isPending)N()};return e(oe,{open:!0,onClose:Ie,title:t(n,{children:["Add a job to ",e("code",{children:g})]}),size:"lg",closeOnEscape:!pe.isPending,closeOnBackdrop:!pe.isPending,footer:t(n,{children:[e(a,{onClick:Ie,disabled:pe.isPending,children:"Cancel"}),e(a,{variant:"primary",type:"submit",form:C,disabled:pe.isPending||Q||me.blocked,"aria-busy":pe.isPending||void 0,children:pe.isPending?"Adding…":"Add job"})]}),children:Q?e(d,{title:"No job can be added here",description:"This API accepts no job names: adding jobs is switched off (the jobs.add action is not enabled, or the API is read-only), or no name is allowed. Ask whoever runs it to list the names in addableNames."}):t("form",{id:C,className:"job-form",onSubmit:ve,noValidate:!0,children:[e(sn,{value:W.name,onChange:(X)=>ge({name:X}),error:he("name"),addableNames:T}),e(ln,{value:W.data.text,onChange:(X)=>ge({data:X}),error:he("data"),maxBytes:U}),e(un,{form:W,patch:ge,fieldError:he,onRunAtProblem:(X)=>me.report("opts.runAt",X)}),fe&&e("p",{className:"field-error job-form-error",role:"alert",children:fe}),q&&e(A,{error:q})]})})}var Re=8;function Te(g){let N=Array.from(g);if(N.length<=40)return{text:g,whole:!0};return{text:N.slice(-8).join(""),whole:!1}}function _e(g){return g.open?e(fo,{...g}):null}function fo({job:g,onClose:N}){let B=s(),[D,L]=r(""),_=O({mutationFn:async(Q)=>await Je("fail",()=>so(B,g.queue,g.id,Q)),successMessage:"Job failed: it is dead, with no attempts left",invalidate:ut(g.queue),toastErrors:!1}),C=!/\S/.test(D),U=D.length>Un,T=Te(g.id);return t(k,{open:!0,onClose:N,variant:"danger",title:"Fail this job?",description:t(n,{children:["Job ",e("code",{children:g.id})," goes to dead for good, with your reason as its failure, whatever attempts it has left. It gets the"," ",e("code",{children:"failed"})," and ",e("code",{children:"dead"})," events and a copy in its dead-letter queue."]}),confirmLabel:"Fail job",pendingLabel:"Failing…",confirmText:T.text,confirmTextLabel:T.whole?void 0:t(n,{children:["Type the id's last ",Re," characters,"," ",e("code",{children:T.text}),", to confirm"]}),confirmDisabled:C||U,onConfirm:()=>_.mutateAsync(D),children:[g.state==="active"&&e("p",{className:"job-note job-note-warning","data-testid":"fail-active-note",children:"This job is running. Failing it does not stop its code: its worker loses the job's lock at its next heartbeat and the attempt's signal is aborted, but the processor runs until it returns, and whatever it returns or throws is discarded."}),e(u,{label:"Reason",required:!0,hint:`Recorded as the job's failure, exactly as typed. At most ${o(Un)} characters.`,error:_.fieldErrors.reason??(U?`At most ${o(Un)} characters.`:D!==""&&C?"Spaces alone are not a reason: type some text.":void 0),children:e(M,{value:D,onChange:L,disabled:_.isPending})})]})}function bo(g){return g!=="completed"&&g!=="dead"}function qe(g){let{readOnly:N}=m(),B=y("jobs.retry"),D=y("jobs.promote"),L=y("jobs.remove"),_=y("jobs.update"),C=y("jobs.fail"),U=se("update");return{retry:!N&&B&&kn(g.state),promote:!N&&D&&g.state==="delayed",remove:!N&&L,update:!N&&_&&U,fail:!N&&C&&bo(g.state)}}function Ee(g){let N={};if(!g.changeData&&g.priority===void 0&&g.runAt===void 0)N.form="Change at least one of data, priority or run time.";if(g.changeData){if(g.data.error)N.data="The data is not valid JSON.";else if(g.data.overLimit)N.data="The data is larger than the API accepts.";else if(g.data.value===void 0)N.data="Enter the new data as JSON (null is allowed)."}if(g.priority!==void 0&&!Number.isFinite(g.priority))N.priority="Enter a number.";if(g.conditional&&g.onlyIn.length===0)N.onlyIn="Pick at least one state, or untick the condition.";return N}function Me(g){return{...g.changeData?{data:g.data.value}:{},...g.priority===void 0?{}:{priority:g.priority},...g.runAt===void 0?{}:{runAt:g.runAt},...g.conditional?{onlyIn:g.onlyIn}:{}}}function Ue(g){return g.open?e(go,{...g}):null}function go({job:g,onClose:N}){let B=s(),{limits:D}=m(),L=c(),_=D.maxJobDataBytes,[C,U]=r(()=>({changeData:!1,data:Le(JSON.stringify(g.data??null,null,2),{maxBytes:_}),priority:void 0,runAt:void 0,conditional:!1,onlyIn:[g.state]})),[T,Q]=r(!1),W=we(),K=O({mutationFn:async(q)=>await Je("update",()=>no(B,g.queue,g.id,q)),successMessage:"Job updated",invalidate:ut(g.queue),toastErrors:!1,onSuccess:()=>N()}),H=T?Ee(C):{},ee=K.fieldErrors,me=(q)=>(q==="runAt"?W.problems.runAt:void 0)??H[q]??ee[q],pe=K.error&&!(E(K.error)&&Object.keys(ee).length>0&&K.unplacedIssues.length===0)?K.error:null,Ne=ee.body,ce=(q)=>U((fe)=>({...fe,...q})),ue=(q)=>{if(q.preventDefault(),Q(!0),W.blocked||Object.keys(Ee(C)).length>0)return;K.mutate(Me(C))},Ae=(q,fe)=>U((ge)=>({...ge,onlyIn:fe?Z.filter((ve)=>ve===q||ge.onlyIn.includes(ve)):ge.onlyIn.filter((ve)=>ve!==q)})),he=()=>{if(!K.isPending)N()};return e(oe,{open:!0,onClose:he,title:"Edit job",description:"Change what you tick or fill in; everything else stays as it is.",size:"lg",closeOnEscape:!K.isPending,closeOnBackdrop:!K.isPending,footer:t(n,{children:[e(a,{onClick:he,disabled:K.isPending,children:"Cancel"}),e(a,{variant:"primary",type:"submit",form:L,disabled:K.isPending||W.blocked,"aria-busy":K.isPending||void 0,children:K.isPending?"Saving…":"Save"})]}),children:t("form",{id:L,className:"job-form",onSubmit:ue,noValidate:!0,children:[e(P,{checked:C.changeData,onChange:(q)=>ce({changeData:q}),label:"Replace the data"}),C.changeData&&e(u,{label:"Data",hint:"JSON; null is allowed.",error:me("data"),children:e(ct,{value:C.data.text,onChange:(q)=>ce({data:q}),maxBytes:_,rows:8})}),e(u,{label:"Priority",hint:`Lower runs first. Now ${g.priority}; leave empty to keep it.`,error:me("priority"),children:e(V,{value:C.priority,onChange:(q)=>ce({priority:q}),step:"any",placeholder:String(g.priority)})}),e(u,{label:"Run at",hint:"Moves only a waiting or delayed job. Leave empty to keep it.",error:me("runAt"),children:e(xe,{value:C.runAt,onChange:(q)=>ce({runAt:q}),onProblem:(q)=>W.report("runAt",q)})}),e(P,{checked:C.conditional,onChange:(q)=>ce({conditional:q}),label:"Only if the job is still in one of these states",hint:"The change is skipped (and reported) if the job has moved on."}),C.conditional&&t("fieldset",{className:"job-states-picker","aria-invalid":Boolean(me("onlyIn"))||void 0,children:[e("legend",{children:"Only in"}),Z.map((q)=>e(P,{checked:C.onlyIn.includes(q),onChange:(fe)=>Ae(q,fe),label:Y[q]},q)),me("onlyIn")&&e("p",{className:"field-error",children:me("onlyIn")})]}),(H.form??Ne)&&e("p",{className:"field-error job-form-error",role:"alert",children:H.form??Ne}),pe&&e(A,{error:pe})]})})}function Ge({job:g}){let N=s(),B=J(),D=zt(),L=qe(g),[_,C]=r(null),[U,T]=r(!0),Q=ut(g.queue),W=O({mutationFn:async(ee)=>await Je("retry",()=>oo(N,g.queue,g.id,ee)),successMessage:"Job retried: it is waiting to run again",invalidate:Q,toastErrors:!1}),K=O({mutationFn:()=>Je("promote",()=>ao(N,g.queue,g.id)),successMessage:"Job promoted: it can run now",errorTitle:"Could not promote the job",invalidate:Q}),H=O({mutationFn:()=>Je("remove",()=>ro(N,g.queue,g.id)),successMessage:"Job removed",invalidate:Q,toastErrors:!1,onSuccess:async()=>{await B.cancelQueries({queryKey:ae.job(g.queue,g.id)}),B.removeQueries({queryKey:ae.job(g.queue,g.id)}),D(Mt(g.queue))}});if(!L.retry&&!L.promote&&!L.remove&&!L.update&&!L.fail)return null;return t("div",{className:"job-actions",role:"group","aria-label":"Job actions",children:[L.retry&&e(a,{onClick:()=>{T(!0),C("retry")},children:"Retry"}),L.promote&&e(a,{disabled:K.isPending,"aria-busy":K.isPending||void 0,onClick:()=>K.mutate(),children:K.isPending?"Promoting…":"Promote"}),L.update&&e(a,{onClick:()=>C("update"),children:"Edit"}),L.fail&&e(a,{variant:"danger",onClick:()=>C("fail"),children:"Fail…"}),L.remove&&e(a,{variant:"danger",onClick:()=>C("remove"),children:"Remove"}),e(k,{open:_==="retry",onClose:()=>C(null),title:"Retry this job?",description:"It goes back to waiting and runs again.",confirmLabel:"Retry",pendingLabel:"Retrying…",onConfirm:()=>W.mutateAsync(U),children:e(P,{checked:U,onChange:T,label:"Reset attempts",hint:"Count attempts from zero again, so it gets its full allowance of retries."})}),e(k,{open:_==="remove",onClose:()=>C(null),variant:"danger",title:"Remove this job?",description:t(n,{children:["Job ",e("code",{children:g.id})," and its logs are deleted. This cannot be undone."]}),confirmLabel:"Remove",pendingLabel:"Removing…",onConfirm:()=>H.mutateAsync()}),e(_e,{job:g,open:_==="fail",onClose:()=>C(null)}),e(Ue,{job:g,open:_==="update",onClose:()=>C(null)})]})}var $e=G,Fe=3000,yo=new Set(["active","waiting"]);function Se(g){return g===void 0||kn(g)?!1:$e}function ke(g){return g!==void 0&&yo.has(g)?Fe:!1}function Ve(g){return ke(g)!==!1}var ze=[50,100,200,500];function Qe(g){return Math.max(1,Math.min(100,g))}function Ke(){let g=j($e);return w((N)=>Se(N)===!1?!1:g,[g])}var ho=new Set(["progress","duplicate","throttled"]),vo=Xe.filter((g)=>!ho.has(g));function wo(g){return typeof g==="number"&&Number.isFinite(g)||typeof g==="object"&&g!==null&&!Array.isArray(g)}function He(g,N,B){let D=J(),L=[le.job(g,N)];be(L,[ae.job(g,N)],{events:vo,enabled:B}),rt({channels:L,events:["progress"],enabled:B,onEvent:(_)=>{if(_.kind!=="queue"||_.type!=="progress")return;let{progress:C}=_.payload;if(!wo(C)){D.invalidateQueries({queryKey:ae.job(g,N),exact:!0});return}let U=(T)=>T?{...T,progress:C}:T;D.setQueryData(ae.job(g,N),U)}})}function Ye({queue:g,id:N}){return t(b,{to:We(g,N),className:"job-ref",children:[e("span",{className:"muted",children:g})," / ",e("code",{children:N})]})}function Jo({child:g}){if(g.failure)return e(dt,{error:g.failure,label:`Failure of ${g.id}`});if(g.value!==void 0)return e(ie,{value:g.value,label:`Value of ${g.id}`,expandDepth:1});return e("span",{className:"muted",children:"—"})}function xo({job:g}){let N=s(),B=i({queryKey:ae.children(g.queue,g.id),queryFn:({signal:L})=>to(N,g.queue,g.id,L),refetchInterval:Se(g.state)});if(B.isPending)return e(f,{label:"Loading the children",showLabel:!0});if(B.isError)return e(A,{error:B.error,title:"Could not load the children",onRetry:()=>void B.refetch()});let D=B.data;return t(n,{children:[t(I,{label:"Children",children:[e("thead",{children:t("tr",{children:[e("th",{scope:"col",children:"Child"}),e("th",{scope:"col",children:"State"}),e("th",{scope:"col",children:"Outcome"})]})}),e("tbody",{children:D.children.map((L)=>t("tr",{"data-testid":`flow-child-${L.queue}:${L.id}`,children:[e("th",{scope:"row",children:e(Ye,{queue:L.queue,id:L.id})}),e("td",{children:L.job?e(Be,{state:L.job.state}):e(p,{tone:"warning",title:"The child is gone, or in a queue this API cannot reach",children:"unreachable"})}),e("td",{children:e(Jo,{child:L})})]},`${L.queue}:${L.id}`))})]}),D.truncated&&t("p",{className:"notice",role:"note","data-testid":"flow-truncated",children:["Showing the first ",h(D.children.length,"child","children"),": this job has more than the API lists at once."]})]})}function Ze({job:g}){let N=g.flow;if(!N)return null;return t(R,{title:"Flow",children:[t("dl",{className:"kv kv-grid job-flow-summary",children:[t("div",{className:"kv-row",children:[e("dt",{className:"kv-label",children:"Parent"}),e("dd",{className:"kv-value",children:N.parent?e(Ye,{queue:N.parent.queue,id:N.parent.id}):e("span",{className:"muted",children:"None: this is the root"})})]}),t("div",{className:"kv-row",children:[e("dt",{className:"kv-label",children:"Pending children"}),e("dd",{className:"kv-value",children:o(N.pending)})]})]}),N.children.length>0?e(xo,{job:g}):e("p",{className:"muted",children:"This job has no children."})]})}function lo(g,N){if(g==="active")return"Clear logs once the job finishes — a running job is still writing to them.";if(N===0)return"No lines to clear.";return null}function po({queue:g,id:N,state:B,total:D,onCleared:L}){let _=s(),C=J(),U=re(),T=c(),[Q,W]=r(!1),K=O({mutationFn:()=>Je("clearLogs",()=>eo(_,g,N)),successMessage:(ee)=>`Cleared ${h(ee.removed,"line")}`,invalidate:[ae.logsAll(g,N)],toastErrors:!1,onSuccess:()=>L?.(),onError:(ee)=>{if(E(ee)&&(ee.code==="JOB_ACTIVE"||ee.code==="JOB_NOT_FOUND"))C.invalidateQueries({queryKey:ae.job(g,N)})}});if(!U("jobs.clearLogs"))return null;let H=lo(B,D);return t("span",{className:"job-logs-clear",children:[e(a,{variant:"danger",size:"sm",disabled:H!==null||D===null,"aria-describedby":H?T:void 0,onClick:()=>W(!0),children:"Clear logs…"}),H&&e("span",{id:T,className:"muted job-logs-clear-reason","data-testid":"clear-logs-reason",children:H}),e(k,{open:Q,onClose:()=>W(!1),variant:"danger",title:`Clear the ${h(D??0,"log line")} of this job?`,description:t(n,{children:["Job ",e("code",{children:N}),"'s log is emptied, and its next line is numbered 1 again. The job itself, its state and its counters are untouched. This cannot be undone."]}),confirmLabel:"Clear logs",pendingLabel:"Clearing…",onConfirm:()=>K.mutateAsync()})]})}var Ao=[{value:"asc",label:"Oldest first"},{value:"desc",label:"Newest first"}];function mo({queue:g,id:N,state:B}){let D=s(),{limits:L}=m(),_=c(),[C,U]=r(()=>({offset:0,limit:Qe(L.maxLogPage),order:"asc"})),T=i({queryKey:ae.logs(g,N,C),queryFn:({signal:H})=>Xr(D,g,N,C,H),placeholderData:z,refetchInterval:ke(B)}),Q=T.data,W=Q?.page.total??0,K=(H)=>C.order==="asc"?C.offset+H+1:W-C.offset-H;return t(R,{title:"Logs",actions:t("span",{className:"job-logs-controls",children:[t("span",{className:"job-logs-order",children:[e("label",{htmlFor:_,children:"Order"}),e(S,{id:_,options:Ao,value:C.order,onChange:(H)=>U((ee)=>({...ee,order:H,offset:0}))})]}),e(po,{queue:g,id:N,state:B,total:Q?W:null,onCleared:()=>U((H)=>({...H,offset:0}))})]}),children:[Ve(B)&&t("p",{className:"muted job-logs-follow","data-testid":"logs-follow",children:["Refreshing every ",Fe/1000," s while the job is ",B,"."]}),!Q?T.isError?e(A,{error:T.error,title:"Could not load the logs",onRetry:()=>void T.refetch()}):e(f,{label:"Loading the logs",showLabel:!0}):t(n,{children:[T.isError&&e(A,{error:T.error,title:"Could not refresh the logs",onRetry:()=>void T.refetch()}),Q.items.length===0?e("p",{className:"muted",children:W===0?"No log lines yet.":"No lines on this page."}):e(dn,{label:"Log lines",items:Q.items.map((H,ee)=>({id:K(ee),number:K(ee),text:H}))}),e(ne,{label:"Log pages",offset:C.offset,limit:C.limit,total:W,itemCount:Q.items.length,hasMore:Q.page.hasMore,pageSizes:ze,maxPageSize:L.maxLogPage,onChange:(H)=>U((ee)=>({...ee,...H}))}),t("p",{className:"muted job-logs-total",children:[o(W)," ",W===1?"line":"lines"," in all"]})]})]})}function Pe(g){return E(g)&&(g.code==="JOB_NOT_FOUND"||g.code==="QUEUE_NOT_FOUND")}function De(g){return E(g)&&g.isAuth}var No=new Intl.NumberFormat(void 0,{maximumFractionDigits:2});function Co(g){if(Number.isNaN(g))return 0;return Math.min(100,Math.max(0,g))}function Eo({progress:g}){if(g===null||g===void 0)return null;if(typeof g==="number"){let N=Co(g),B=`${No.format(g)}%`;return t("span",{className:"job-progress","data-testid":"job-progress",children:[e("span",{className:"job-progress-bar",role:"progressbar","aria-label":"Progress","aria-valuemin":0,"aria-valuemax":100,"aria-valuenow":N,"aria-valuetext":B,children:e("span",{className:"job-progress-fill",style:{width:`${N}%`}})}),e("span",{className:"job-progress-value",children:B})]})}if(typeof g==="object")return e(ie,{value:g,label:"Progress",expandDepth:1,copyable:!1});return e("span",{children:String(g)})}function Lo({queue:g,worker:N}){let B=Oe(),D=N.host!==void 0||N.pid!==void 0?[N.host,N.pid===void 0?void 0:`pid ${N.pid}`].filter((L)=>L!==void 0).join(", "):null;return t("span",{className:"job-processed-by","data-testid":"job-processed-by",children:[N.key!==void 0&&(B?e(b,{to:je(g,N.key),"data-testid":"job-processed-by-key",children:N.key}):e("span",{"data-testid":"job-processed-by-key",children:N.key})),t("span",{className:"muted",children:[N.key!==void 0?"incarnation ":"worker ",e("code",{children:N.id})]}),D!==null&&e("span",{className:"muted",children:D})]})}function Fo({job:g}){let N=se("jobAttribution");return e(F,{className:"job-summary",items:[{label:"State",value:e(Be,{state:g.state})},{label:"Priority",value:o(g.priority)},{label:"Attempts",value:`${o(g.attemptsMade)} of ${o(g.maxAttempts)}`},{label:"Stalled",value:o(g.stalledCount)},{label:"Run at",value:e(v,{value:g.runAt})},{label:"Created",value:e(v,{value:g.createdAt})},{label:"Processed",value:e(v,{value:g.processedOn})},{label:"Finished",value:e(v,{value:g.finishedOn})},{label:"Expires",value:e(v,{value:g.expiresAt})},{label:"Lock expires",value:e(v,{value:g.lockExpiresAt})},g.state==="active"&&{label:"Held by",value:g.workerId?e("code",{children:g.workerId}):null},N&&{label:"Processed by",key:"processedBy",value:g.processedBy?e(Lo,{queue:g.queue,worker:g.processedBy}):e("span",{"data-testid":"job-processed-by-none",children:"No worker recorded"}),hint:g.processedBy?"The worker that ran the last attempt; earlier attempts are not recorded.":"The job was never claimed, or was claimed before this backend recorded who ran a job."},{label:"Repeat key",value:g.repeatKey?e("code",{children:g.repeatKey}):null},{label:"Progress",value:e(Eo,{progress:g.progress}),key:"progress"}]})}function So({queue:g,id:N}){let B=s(),[D,L]=r(!1),_=i({queryKey:ae.stacktrace(g,N),queryFn:({signal:T})=>br(B,g,N,["stacktrace"],T),enabled:D}),C=(T)=>{if(T.currentTarget.open)L(!0)},U=_.data?.stacktrace??[];return t("details",{className:"job-details",onToggle:C,"data-testid":"job-stacktraces",children:[e("summary",{children:"Failure history (newest first)"}),!D?null:_.isPending?e(f,{label:"Loading the failure history",showLabel:!0}):_.isError?e(A,{error:_.error,title:"Could not load the failure history",onRetry:()=>void _.refetch()}):U.length===0?e("p",{className:"muted",children:"No failures were kept for this job."}):e("ol",{className:"job-stacktraces",children:U.map((T,Q)=>e("li",{children:e(dt,{error:T,label:Q===0?"Newest failure":`Failure ${Q+1}`})},Q))})]})}function ko({queue:g,id:N}){return e("div",{className:"screen","data-testid":"job-not-found",children:e(d,{headingLevel:1,title:"Job not found",description:t(n,{children:["There is no job ",e("code",{children:N})," in queue ",e("code",{children:g}),". It may have finished and been cleaned up, or been removed."]}),action:t(b,{to:Mt(g),children:["Back to ",g]})})})}function uo({queue:g,detail:N}){return e("div",{className:"screen","data-testid":"job-hidden",children:e(d,{headingLevel:1,title:"Job hidden",description:N??t(n,{children:["You may not read the jobs of queue ",e("code",{children:g}),"."]}),action:t(b,{to:Mt(g),children:["Back to ",g]})})})}function Po({job:g}){let N=y("jobs.logs"),B=se("logs"),D=g.returnValue!==void 0&&(g.state==="completed"||g.returnValue!==null);return t(n,{children:[t("header",{className:"job-header",children:[t("div",{className:"job-heading",children:[t("h1",{className:"screen-title job-title",children:[e("span",{className:"job-name",children:l(g.name)}),e(Be,{state:g.state})]}),t("p",{className:"job-id-line",children:[e("span",{className:"muted",children:"Id"}),e("code",{className:"job-id","data-testid":"job-id",children:g.id}),e(ye,{text:g.id,ariaLabel:"Copy job id",size:"sm"})]})]}),e(Ge,{job:g})]}),e(R,{title:"Summary",children:e(Fo,{job:g})}),g.failedReason&&t(R,{title:"Failure",children:[e(dt,{error:g.failedReason,label:"Failure"}),e(So,{queue:g.queue,id:g.id})]}),e(R,{title:"Data",children:g.data===void 0?e("p",{className:"muted",children:"Not included in this response."}):e(ie,{value:g.data,label:"Job data"})}),D&&e(R,{title:"Return value",children:e(ie,{value:g.returnValue,label:"Return value"})}),g.flow&&e(Ze,{job:g}),B&&N&&e(mo,{queue:g.queue,id:g.id,state:g.state}),g.opts&&e(R,{title:"Options",children:e(ie,{value:g.opts,label:"Job options",expandDepth:1})})]})}function Fa(){let{queue:g="",id:N=""}=de(),B=s(),D=y("jobs.read"),L=gt(),_=Ke(),C=i({queryKey:ae.job(g,N),queryFn:({signal:U})=>br(B,g,N,yr,U),enabled:D&&L,refetchInterval:(U)=>Pe(U.state.error)||De(U.state.error)?!1:_(U.state.data?.state)});if(He(g,N,D&&L&&!De(C.error)&&!Pe(C.error)),L&&!D)return e(uo,{queue:g});if(De(C.error))return e(uo,{queue:g,detail:C.error.detail});if(Pe(C.error))return e(ko,{queue:g,id:N});return t("div",{className:"screen job-screen","data-testid":"job-screen",children:[e("nav",{className:"breadcrumb","aria-label":"Breadcrumb",children:t("ol",{children:[e("li",{children:e(b,{to:"/queues",children:"Queues"})}),e("li",{children:e(b,{to:Mt(g),children:g})}),e("li",{"aria-current":"page",children:"Job"})]})}),C.data?t(n,{children:[C.isError&&e(A,{error:C.error,title:"Could not refresh this job",onRetry:()=>void C.refetch()}),e(Po,{job:C.data})]}):C.isError?e(x,{error:C.error,headingLevel:1,title:"Could not load the job",onRetry:()=>void C.refetch()}):e(f,{label:"Loading the job",showLabel:!0})]})}export{Pn,Fa};
|
|
2
|
-
|
|
3
|
-
//# debugId=27CF7A9AFC2A2EF364756E2164756E21
|
|
4
|
-
//# sourceMappingURL=main-7jzem39c.js.map
|
|
@@ -1,5 +0,0 @@
|
|
|
1
|
-
import{w,D,r,ve,E,N,e,t,J,X,Te,tt,Wt,Ee,U,Hr,a}from"./main-xf44bv26.js";var b=class extends Ee{#e;#i=void 0;#t;#s;constructor(s,i){super();this.#e=s,this.setOptions(i),this.bindMethods(),this.#r()}bindMethods(){this.mutate=this.mutate.bind(this),this.reset=this.reset.bind(this)}setOptions(s){let i=this.options;if(this.options=this.#e.defaultMutationOptions(s),!tt(this.options,i))this.#e.getMutationCache().notify({type:"observerOptionsUpdated",mutation:this.#t,observer:this});if(i?.mutationKey&&this.options.mutationKey&&Te(i.mutationKey)!==Te(this.options.mutationKey))this.reset();else if(this.#t?.state.status==="pending")this.#t.setOptions(this.options)}onSubscribe(){if(this.listeners.size===1&&this.#t)this.#t.addObserver(this),this.#r()}onUnsubscribe(){if(!this.hasListeners())this.#t?.removeObserver(this)}onMutationUpdate(s){this.#r(),this.#o(s)}getCurrentResult(){return this.#i}reset(){this.#t?.removeObserver(this),this.#t=void 0,this.#r(),this.#o()}mutate(s,i){return this.#s=i,this.#t?.removeObserver(this),this.#t=this.#e.getMutationCache().build(this.#e,this.options),this.#t.addObserver(this),this.#t.execute(s)}#r(){let s=this.#t?.state??Hr();this.#i={...s,isPending:s.status==="pending",isSuccess:s.status==="success",isError:s.status==="error",isIdle:s.status==="idle",mutate:this.mutate,reset:this.reset}}#o(s){U.batch(()=>{if(this.#s&&this.hasListeners()){let i=this.#i.variables,h=this.#i.context,o={client:this.#e,meta:this.options.meta,mutationKey:this.options.mutationKey};if(s?.type==="success"){try{this.#s.onSuccess?.(s.data,i,h,o)}catch(n){Promise.reject(n)}try{this.#s.onSettled?.(s.data,null,i,h,o)}catch(n){Promise.reject(n)}}else if(s?.type==="error"){try{this.#s.onError?.(s.error,i,h,o)}catch(n){Promise.reject(n)}try{this.#s.onSettled?.(void 0,s.error,i,h,o)}catch(n){Promise.reject(n)}}}this.listeners.forEach((i)=>{i(this.#i)})})}};function On(s,i){let h=J(i),[o]=r(()=>new b(h,s));D(()=>{o.setOptions(s)},[o,s]);let n=ve(w((l)=>o.subscribe(U.batchCalls(l)),[o]),()=>o.getCurrentResult(),()=>o.getCurrentResult()),c=w((...l)=>{o.mutate(l[0],l[1]).catch(X)},[o]);if(n.error&&Wt(o.options.throwOnError,[n.error]))throw n.error;return{...n,mutate:c,mutateAsync:n.mutate}}function f(s){if(typeof s==="string")return s;try{return JSON.stringify(s)??String(s)}catch{return String(s)}}function A({error:s,title:i,onRetry:h,onDismiss:o,className:n}){let c=E(s)?s:null,l=i??c?.title??"Something went wrong",m=c?.detail??(s instanceof Error?s.message:String(s)),p=c?Object.entries(c.context):[];return t("div",{className:N("problem-banner",n),role:"alert",children:[t("div",{className:"problem-banner-main",children:[t("p",{className:"problem-banner-title",children:[e("strong",{children:l}),c&&t("code",{className:"problem-banner-code",children:[c.code,c.status>0?` · ${c.status}`:""]})]}),m&&m!==l&&e("p",{className:"problem-banner-detail",children:m}),p.length>0&&e("ul",{className:"problem-banner-context","aria-label":"Context",children:p.map(([u,d])=>t("li",{children:[e("span",{className:"problem-banner-key",children:u}),"=",e("code",{children:f(d)})]},u))}),c&&c.issues.length>0&&e("ul",{className:"problem-banner-issues",children:c.issues.map((u)=>t("li",{children:[t("code",{children:[u.target,u.path?`.${u.path}`:""]})," ",u.message]},`${u.target}:${u.path}:${u.message}`))})]}),(h||o)&&t("div",{className:"problem-banner-actions",children:[h&&e(a,{size:"sm",onClick:h,children:"Retry"}),o&&e(a,{size:"sm",variant:"ghost",onClick:o,children:"Dismiss"})]})]})}
|
|
2
|
-
export{On,A};
|
|
3
|
-
|
|
4
|
-
//# debugId=48826B8D62A9E14664756E2164756E21
|
|
5
|
-
//# sourceMappingURL=main-9qd3nqs5.js.map
|
|
@@ -1,5 +0,0 @@
|
|
|
1
|
-
import{w,D,c,T,r,Z,Fr,Qe,Vr,K,E,N,n,e,t,p,s,m,z,i,a,ge,b,oe,De,le,be,j,d,f,Gr,ee,ce,wn,Ve,xn,ya,ba,Ea,x,o,Sa,Y,Lt,h,l,te,u,M,V,S,P,Be,I,ne,ue,kt}from"./main-xf44bv26.js";import{v}from"./main-smabxbn4.js";import{_e,Ye,je,_r,_o,gn,Jt,Io,Gn,Oe}from"./main-b35rfpdf.js";import{L}from"./main-yjykmsvp.js";import{k}from"./main-v2f8a4g3.js";import{O}from"./main-zk3n47nq.js";import{W,me,Tt,Pe}from"./main-yg6scp84.js";import{re}from"./main-fcq7hfk0.js";import{A}from"./main-9qd3nqs5.js";import{ye}from"./main-3xxhy5jh.js";function ze(g,y,B){let{location:F}=ge(),J=new URLSearchParams(F.search).get(g);return y.find((G)=>G.value===J)?.value??B}var Nt=new Intl.NumberFormat(void 0,{notation:"compact"});function Pt({tabs:g,value:y,onChange:B,label:F,children:J,activation:G="auto",className:se}){let H=c(),Q=T(null),X=(R)=>`${H}-tab-${R}`,ae=`${H}-panel`,q=g.findIndex((R)=>R.value===y),U=(R)=>{let ie=g.map((he,ve)=>({tab:he,index:ve})).filter(({tab:he})=>!he.disabled);if(ie.length===0)return;let C=ie.findIndex(({index:he})=>X(he)===R.currentTarget.id),de=null;switch(R.key){case"ArrowRight":de=(C+1)%ie.length;break;case"ArrowLeft":de=(C-1+ie.length)%ie.length;break;case"Home":de=0;break;case"End":de=ie.length-1;break;default:return}R.preventDefault();let pe=ie[de];if(Q.current?.ownerDocument.getElementById(X(pe.index))?.focus(),G==="auto")B(pe.tab.value)};return t("div",{className:N("tabs",se),children:[e("div",{ref:Q,className:"tabs-list",role:"tablist","aria-label":F,children:g.map((R,ie)=>{let C=ie===q,de=C||q===-1&&ie===g.findIndex((pe)=>!pe.disabled);return t("button",{id:X(ie),type:"button",role:"tab",className:"tab","aria-selected":C,"aria-controls":J!==void 0?ae:void 0,tabIndex:de?0:-1,disabled:R.disabled,title:R.title,onClick:()=>B(R.value),onKeyDown:U,children:[e("span",{className:"tab-label",children:R.label}),R.count!==void 0&&e("span",{className:"tab-count",title:String(R.count),children:Nt.format(R.count)})]},R.value)})}),J!==void 0&&e("div",{id:ae,className:"tabs-panel",role:"tabpanel","aria-labelledby":q>=0?X(q):void 0,tabIndex:0,children:J})]})}function Rt({param:g,defaultValue:y,resetParams:B=[],onChange:F,tabs:J,...G}){let{location:se,navigate:H}=ge(),Q=ze(g,J,y),X=w((ae)=>{let q=new URLSearchParams(se.search);if(ae===y)q.delete(g);else q.set(g,ae);if(ae!==Q)for(let R of B)q.delete(R);let U=q.toString();H(`${se.path??"/"}${U?`?${U}`:""}`,{replace:!0}),F?.(ae)},[se.search,se.path,y,g,Q,B,H,F]);return e(Pt,{...G,tabs:J,value:Q,onChange:X})}var Ae="all",st=80;function it(g,y){return g.length>y?`${g.slice(0,y-1)}…`:g}function He(g,y,B,F){return{state:y===Ae?null:y,offset:me(g,"offset",0),...F===void 0?{}:{cursor:F},limit:Pe(me(g,"limit",B.defaultPageSize),B.maxPageSize),order:g.get("order")==="asc"?"asc":"desc",names:Tt(g.get("name")??""),search:g.get("search")??"",total:g.get("total")==="1"}}function Je(g){return{key:g,trail:[]}}function Ce(g,y){return g.key===y?g:Je(y)}function Et(g,y){return{key:g.key,trail:[...g.trail,y]}}function It(g){return g.trail.length===0?g:{key:g.key,trail:g.trail.slice(0,-1)}}function Dt(g){return g.trail.at(-1)}function at(g){let[y,B]=r(()=>Je(g)),F=Ce(y,g),J=w((H)=>B((Q)=>Et(Ce(Q,g),H)),[g]),G=w(()=>B((H)=>It(Ce(H,g))),[g]),se=w(()=>B((H)=>Ce(H,g).trail.length===0?H:Je(g)),[g]);return{cursor:Dt(F),canPrev:F.trail.length>0,forward:J,back:G,reset:se}}var lt=10;function mn(g){let y=g.slice(0,lt).join(", "),B=g.length-lt;return B>0?`${y} and ${o(B)} more`:y}function bo(g){if(g.cron)return g.tz?`${g.cron} (${g.tz})`:g.cron;if(g.every!==void 0)return`every ${L(g.every)}`;return"—"}var Ot=["offset"];function $t(g){return g==="waiting"?"Walks from where this page ended, so no waiting job is skipped by the queue draining. A job promoted or retried into the queue while you page can land behind this point, and is then not on any page of this walk.":"Walks from where this page ended, so no job is skipped by the list changing under you. A job that joins these states behind the point you have reached is not on any page of this walk."}function Eo({queue:g,counts:y}){let B=s(),F=m(),[J,G]=W(),se=[{value:Ae,label:"All",count:y?Z.reduce((C,de)=>C+y[de],0):void 0},...Z.map((C)=>({value:C,label:Y[C],title:Lt[C],count:y?.[C]}))],H=ze("state",se,Ae),Q=F.features.addedByState,X=He(J,H,F.limits),ae=at(JSON.stringify([g,X.state,X.offset,X.order,X.names,X.search,X.total,Gr(X,Q)])),q=He(J,H,F.limits,ae.cursor),U=ue("jobs"),R=i({queryKey:ee.jobs(g,q),queryFn:({signal:C})=>xn(B,g,q,C,{createdOrder:Q}),refetchInterval:U,placeholderData:z}),ie=JSON.stringify([q.state,q.order,q.names,q.search]);return t("section",{className:"jobs-section","aria-label":"Jobs",children:[e(Rt,{tabs:se,param:"state",defaultValue:Ae,resetParams:Ot,label:"Job states"}),e(Tr,{filters:q,searchIndexed:F.features.search,createdOrder:F.features.addedByState,onApply:(C)=>G({...C,offset:null}),onOrder:(C)=>G({order:C==="asc"?"asc":null,offset:null}),onTotal:(C)=>G({total:C?"1":null})},`${J.get("name")??""}|${q.search}`),R.isPending?e(f,{label:"Loading jobs",showLabel:!0}):R.isError?e(x,{error:R.error,title:"Could not load jobs",onRetry:()=>void R.refetch()}):t(n,{children:[e(Dr,{queue:g,items:R.data.items},ie),e(ne,{label:"Job pages",offset:R.data.page.offset??q.offset,limit:q.limit,total:R.data.page.total,itemCount:R.data.items.length,hasMore:R.data.page.hasMore,walk:{canNext:typeof R.data.page.next==="string",canPrev:ae.canPrev,unnumbered:R.data.page.offset===void 0,hint:$t(H)},maxPageSize:F.limits.maxPageSize,disabled:R.isFetching&&R.isPlaceholderData,onChange:(C)=>{let de=R.data.page.next;if(C.step==="next"&&typeof de==="string"){ae.forward(de);return}if(C.step==="prev"){ae.back();return}if(C.resize===!0&&ae.cursor!==void 0){G({limit:String(C.limit)});return}ae.reset(),G({offset:C.offset>0?String(C.offset):null,limit:String(C.limit)})}})]})]})}function Tr({filters:g,searchIndexed:y,createdOrder:B=!1,onApply:F,onOrder:J,onTotal:G}){let[se,H]=r(g.names.join(", ")),[Q,X]=r(g.search),ae=c(),q=c(),U=c();return t("form",{className:"jobs-filters",role:"search","aria-label":"Filter jobs",onSubmit:(ie)=>{ie.preventDefault();let C=Tt(se);F({name:C.length>0?C.join(","):null,search:Q.trim()||null})},children:[t("span",{className:"jobs-filter",children:[e("label",{htmlFor:ae,children:"Names"}),e(M,{id:ae,value:se,onChange:H,placeholder:"exact, comma-separated",maxLength:2000})]}),t("span",{className:"jobs-filter",children:[e("label",{htmlFor:q,children:"Search"}),e(M,{id:q,type:"search",value:Q,onChange:X,placeholder:"id or name contains",...De,maxLength:512,title:y?void 0:"This backend has no search index: the API scans the queue."})]}),e(a,{type:"submit",size:"sm",children:"Apply"}),t("span",{className:"jobs-filter",children:[e("label",{htmlFor:U,children:"Order"}),e(S,{id:U,options:[{value:"desc",label:"Newest first"},{value:"asc",label:"Oldest first"}],value:g.order,onChange:J})]}),G&&e(P,{checked:g.total,onChange:G,label:"Count total",hint:B&&g.total?"While counting, a one-state tab keeps its own order, not creation order.":void 0,className:"jobs-total"})]})}function Dr({queue:g,items:y,label:B,linkJobs:F=!0,empty:J,processedBy:G=!0}){let se=s(),H=m(),Q=Oe(),X=G&&H.features.jobAttribution,ae=te(),q=re(),U=H.limits.maxBulkIds,[R,ie]=r(()=>new Set),[C,de]=r(!0),[pe,he]=r(null),ve=T(null),Se=T(null),Ze=q("jobs.retry"),et=q("jobs.remove"),tt=q("jobs.promote"),Te=Ze||et||tt,Re=y.map((_)=>_.id),Ee=Re.filter((_)=>R.has(_)).length,We=Re.length>0&&Ee===Re.length,Ie=R.size>=U,Le=T(!1);D(()=>{if(R.size>0||pe!==null){Le.current=!0;return}if(!Le.current)return;Le.current=!1;let _=document.activeElement;if(_===null||_===document.body||_ instanceof HTMLButtonElement&&_.disabled&&Se.current?.contains(_)===!0)Se.current?.focus()},[R,pe]),D(()=>{if(ve.current)ve.current.indeterminate=Ee>0&&!We},[Ee,We]);let xt=(_,ke)=>{ie((fe)=>{let we=new Set(fe);if(ke&&we.size<U)we.add(_);else if(!ke)we.delete(_);return we})},Ct=(_)=>{ie((ke)=>{let fe=new Set(ke);for(let we of Re)if(!_)fe.delete(we);else if(fe.size<U)fe.add(we);return fe})},$e=(_,ke,fe)=>{ae.success(`${_} ${o(ke.length)}, skipped ${o(fe.length)}`,{description:fe.length>0?`Skipped: ${mn(fe)}`:void 0}),ie(new Set)},Fe=ce(g),ot=O({mutationFn:(_)=>ya(se,g,_,C),onSuccess:(_)=>$e("Retried",_.retried,_.skipped),errorTitle:"Could not retry the jobs",invalidate:Fe}),nt=O({mutationFn:(_)=>Ea(se,g,_),onSuccess:(_)=>$e("Promoted",_.promoted,_.skipped),errorTitle:"Could not promote the jobs",invalidate:Fe}),rt=O({mutationFn:(_)=>ba(se,g,_),onSuccess:(_)=>$e("Removed",_.removed,_.skipped),invalidate:Fe,toastErrors:!1}),Me=ot.isPending||nt.isPending||rt.isPending,xe=[...R];if(y.length===0)return J??e(d,{title:"No jobs",description:"No job in this queue matches the state and filters."});return t(n,{children:[Te&&t("div",{ref:Se,className:"bulk-bar",role:"group",tabIndex:-1,"aria-label":"Bulk actions",children:[t("span",{className:"bulk-count","aria-live":"polite","data-testid":"bulk-count",children:[h(R.size,"job")," selected",Ie&&` (the most one action takes: ${o(U)})`]}),Ze&&t(n,{children:[e(P,{checked:C,onChange:de,label:"Reset attempts"}),e(a,{size:"sm",disabled:R.size===0||Me,onClick:()=>ot.mutate(xe),children:"Retry selected"})]}),tt&&e(a,{size:"sm",disabled:R.size===0||Me,onClick:()=>nt.mutate(xe),children:"Promote selected"}),et&&e(a,{size:"sm",variant:"danger",disabled:R.size===0||Me,onClick:()=>he("remove"),children:"Remove selected…"}),R.size>0&&e(a,{size:"sm",variant:"ghost",onClick:()=>ie(new Set),children:"Clear selection"})]}),t(I,{label:B??`Jobs in ${g}`,children:[e("thead",{children:t("tr",{children:[Te&&e("th",{scope:"col",className:"select-cell",children:e("input",{ref:ve,type:"checkbox","aria-label":"Select all jobs on this page",checked:We,disabled:!We&&Ie,onChange:(_)=>Ct(_.target.checked)})}),e("th",{scope:"col",children:"Id"}),e("th",{scope:"col",children:"Name"}),e("th",{scope:"col",children:"State"}),e("th",{scope:"col",className:"num",children:"Attempts"}),e("th",{scope:"col",className:"num",children:"Priority"}),e("th",{scope:"col",children:"Created"}),e("th",{scope:"col",children:"Processed"}),X&&e("th",{scope:"col",className:"job-processed-by-col",title:"The worker that ran the job's last attempt","data-testid":"jobs-processed-by-header",children:"Processed by"}),e("th",{scope:"col",children:"Finished"}),e("th",{scope:"col",children:"Failure"})]})}),e("tbody",{children:y.map((_)=>{let ke=R.has(_.id),fe=_.failedReason?.message;return t("tr",{"data-testid":`job-row-${_.id}`,"aria-selected":Te?ke:void 0,children:[Te&&e("td",{className:"select-cell",children:e("input",{type:"checkbox","aria-label":`Select job ${_.id}`,checked:ke,disabled:!ke&&Ie,onChange:(we)=>xt(_.id,we.target.checked)})}),t("th",{scope:"row",className:"job-id",children:[F?e(b,{to:wn(g,_.id),children:_.id}):_.id,e(ye,{text:_.id,label:"Copy",ariaLabel:`Copy job id ${_.id}`})]}),e("td",{children:l(_.name)}),e("td",{children:e(Be,{state:_.state})}),t("td",{className:"num",children:[o(_.attemptsMade),"/",o(_.maxAttempts)]}),e("td",{className:"num",children:o(_.priority)}),e("td",{children:e(v,{value:_.createdAt})}),e("td",{children:e(v,{value:_.processedOn})}),X&&e(Ft,{queue:g,worker:_.processedBy,linked:Q}),e("td",{children:e(v,{value:_.finishedOn})}),e("td",{className:"job-failure",title:fe,children:fe?it(fe,st):"—"})]},_.id)})})]}),e(k,{open:pe==="remove",onClose:()=>he(null),title:`Remove ${h(xe.length,"job")}?`,description:"Removes the selected jobs for good. Running jobs are skipped.",variant:"danger",confirmLabel:"Remove",pendingLabel:"Removing…",onConfirm:()=>rt.mutateAsync(xe)})]})}function Ft({queue:g,worker:y,linked:B}){if(y===null)return e("td",{className:"job-processed-by-col muted",title:"No worker recorded: the job was never claimed, or was claimed before this backend recorded who ran a job.","data-testid":"jobs-processed-by-none",children:"—"});if(y.key===void 0)return e("td",{className:"job-processed-by-col",title:`Worker incarnation ${y.id} (no stable key recorded)`,children:e("code",{className:"job-processed-by-text","data-testid":"jobs-processed-by-id",children:y.id})});return e("td",{className:"job-processed-by-col",title:`${y.key} (incarnation ${y.id})`,children:B?e(b,{to:je(g,y.key),className:"job-processed-by-text","data-testid":"jobs-processed-by-key",children:y.key}):e("span",{className:"job-processed-by-text","data-testid":"jobs-processed-by-key",children:y.key})})}var _t={list:5000};function No(g){be([le.workers],[_e.all],{enabled:g})}function pn(g,y){be([le.queueWorkers(g)],[_e.ofQueue(g),_e.all],{enabled:y})}function Fn(){return j(_t.list)}var jt={pause:"pause this worker",resume:"resume this worker",stop:"stop this worker",start:"start this worker",configure:"change this worker's settings"};function Ke(g,y){switch(g.code){case"WORKER_NOT_FOUND":return"This worker is not in the registry: it was never there, or its record was removed. Refresh to see the workers reporting now.";case"WORKER_GONE":return"This worker's record lapsed before the instruction reached it — its process stopped reporting. Refresh; if it comes back it will have a new id.";case"WORKER_STATE_CONFLICT":return`Could not ${jt[y]}: it is no longer in the state that action needs. Refresh and look at its state — a stopped worker is started, not resumed.`;case"WORKER_NOT_CONTROLLABLE":return"This API cannot control this worker: remote control is off for it, or it runs an older release that does not listen for instructions.";case"WORKER_PERSISTENCE_NOT_ALLOWED":return"This deployment does not let a stop's persistence be chosen per request. Stop it with the behaviour the deployment configured.";case"CONTROL_CONTENDED":return"Somebody else changed this worker while the dialog was open, so nothing was written. Refresh to see their change, then apply yours again.";case"CONFIG_NOT_ALLOWED":return"The API refused these settings: a value is outside what it allows, or this deployment does not allow that setting to be overridden.";default:return null}}function qe(g,y){if(!E(g))return g;let B=Ke(g,y);if(B===null)return g;return new K({kind:g.kind,status:g.status,code:g.code,title:g.title,detail:B,type:g.type,issues:g.issues,context:g.context,instance:g.instance,cause:g})}function Bt(g,y,B=Date.now()){let F=Jt(g),J=Gn(g,B),G=Io(g),se=F==="stopping"||F==="restarting",H=G&&!J&&!se;return{pause:H&&F==="running"&&y("workers.pause"),resume:H&&F==="paused"&&y("workers.resume"),stop:H&&(F==="running"||F==="paused")&&y("workers.stop"),start:H&&F==="stopped"&&y("workers.start"),configure:G&&g.key!==void 0&&y("workers.configure"),blocked:!G?"uncontrollable":J?"stale":se?"transitioning":null}}function Ne(g,y){return g.blocked!==null&&y("workers.pause")}var dt={stale:"This worker stopped reporting, so nothing would receive the instruction. Its record lapses shortly.",transitioning:"This worker is between states. Its actions come back once it settles.",uncontrollable:"This API cannot control this worker: remote control is off for it, or it runs an older release that does not listen for instructions."};function qt(){let g=m(),y=re();return(B)=>g.features.workerControl&&y(B)}var Mt={process:"Until this process restarts",key:"Until somebody starts it again"},ct={process:"A redeploy or a restart brings this worker back running, because the stop is recorded against this incarnation only.",key:"Recorded against the worker's stable key, so every replica of it — including one started later — comes up stopped."};function ut({open:g,onClose:y,worker:B,onConfirm:F}){let J=B.control?.stopPersistence??"process",G=B.control?.stopPersistenceOverridable===!0,[se,H]=r(J),Q=B.active;return e(k,{open:g,onClose:y,title:`Stop worker ${B.id}?`,description:Q>0?`It finishes the ${Q===1?"job it is running":`${Q} jobs it is running`} and takes no more. It stays listed, so you can start it again.`:"It parks its loop and takes no jobs. It stays listed, so you can start it again.",confirmLabel:"Stop worker",pendingLabel:"Stopping…",variant:"danger",onConfirm:()=>F(G?se:void 0),children:G?e(u,{label:"How long it stays stopped",hint:ct[se],children:e(S,{value:se,onChange:H,options:Fr.map((X)=>({value:X,label:Mt[X]}))})}):e("p",{className:"muted",children:ct[J]})})}var Vn={concurrency:"How many jobs this worker runs at once.",pollInterval:"How often it looks for work when nothing woke it, in ms.",maxBlock:"How long one wait for work may block, in ms.",lockDuration:"How long a job's lock lasts before another worker may claim it, in ms.",heartbeatInterval:"How often a held lock is renewed, in ms. Must be at most half the lock duration.",stalledInterval:"How often stalled jobs are looked for, in ms.",maxStalledCount:"How often one job may stall before it is failed.",reportInterval:"How often this worker reports itself to the registry, in ms.",drainDelay:"How long it waits before declaring the queue drained, in ms."};function Bn({worker:g,onClose:y}){let B=s(),F=g.config,J=g.key??g.id,[G,se]=r({}),[H,Q]=r(null),X=(C)=>(C in G)?G[C]:F?.effective[C],ae=()=>{let C={};for(let de of Qe){if(!(de in G))continue;let pe=G[de];if(pe===void 0){if(F?.overridden.includes(de))C[de]=null;continue}if(pe!==F?.effective[de])C[de]=pe}if(F)C.expectedSeq=F.seq;return C},q=O({mutationFn:()=>_o(B,g.queue,J,ae()),invalidate:Ye(g.queue),successMessage:(C)=>C.instances.length>1?`Saved the settings of ${J}; ${C.instances.length} workers carry it`:`Saved the settings of ${J}`,toastErrors:!1,onSuccess:y,onError:(C)=>Q(qe(C,"configure"))}),U=O({mutationFn:()=>gn(B,g.queue,J),invalidate:Ye(g.queue),successMessage:`Reset ${J} to the values in its code`,toastErrors:!1,onSuccess:y,onError:(C)=>Q(qe(C,"configure"))}),R=q.isPending||U.isPending,ie=Object.keys(ae()).filter((C)=>C!=="expectedSeq");return t(oe,{open:!0,onClose:y,closeOnEscape:!R,size:"lg",title:`Settings of ${J}`,description:t(n,{children:["Stored against the worker’s key, so this reaches every worker carrying ",e("code",{children:J})," — including ones started later — until you reset it. Changes apply in place: nothing drains or restarts."]}),footer:t(n,{children:[e(a,{onClick:y,disabled:R,children:"Cancel"}),F&&F.overridden.length>0&&e(a,{variant:"danger",onClick:()=>U.mutate(),disabled:R,"aria-busy":U.isPending||void 0,children:U.isPending?"Resetting…":"Reset to code values"}),e(a,{variant:"primary",onClick:()=>q.mutate(),disabled:R||ie.length===0,"aria-busy":q.isPending||void 0,children:q.isPending?"Saving…":"Save settings"})]}),children:[H!==null&&e(A,{error:H}),g.control?.pending===!0&&e("p",{className:"worker-config-note","data-testid":"worker-config-pending",children:"A change is waiting to be taken up, so the values below are the ones this worker still runs with. Saving now replaces the waiting change."}),F===void 0?e("p",{className:"worker-config-note",children:"This worker does not report its settings, so there is nothing to show yet. It reports them at its next heartbeat."}):e("div",{className:"worker-config-form",children:Qe.map((C)=>{let de=Vr[C],pe=F.overridden.includes(C),he=F.code[C];return t("div",{className:"worker-config-row",children:[e(u,{label:C,hint:t(n,{children:[Vn[C]," ",de.min,"–",de.max,"."," ",pe?`Overridden; its code asks for ${he}.`:`Its code asks for ${he}.`]}),children:e(V,{value:X(C),min:de.min,max:de.max,onChange:(ve)=>se((Se)=>({...Se,[C]:ve}))})}),pe&&e(a,{size:"sm",onClick:()=>se((ve)=>({...ve,[C]:he})),disabled:R,children:"Use code value"})]},C)})})]})}function Ue(g,y,B){return g?y:B}function Ht(g,y){let B=y.persisted==="key"?"; every replica of it stays stopped until started":"",F=y.worker;return(F===void 0?y.applied:Jt(F)==="stopped"&&F.control?.pending!==!0||y.applied&&F.active===0)?`Stopped ${g}${B}`:`Asked ${g} to stop; it finishes its jobs first${B}`}function pt({worker:g}){let y=s(),B=te(),F=qt(),[J,G]=r(null),se=()=>G(null),H=Bt(g,F),Q=O({mutationFn:(U)=>_r(y,g.queue,g.id,U).then((R)=>({action:U,result:R})),invalidate:Ye(g.queue),successMessage:({action:U,result:R})=>U==="pause"?Ue(R.applied,`Paused ${g.id}`,`Asked ${g.id} to pause; it stops taking jobs shortly`):U==="resume"?Ue(R.applied,`Resumed ${g.id}`,`Asked ${g.id} to resume; it takes jobs again shortly`):Ue(R.applied,`Started ${g.id}`,`Asked ${g.id} to start; it takes jobs again shortly`),toastErrors:!1,onError:(U,R)=>{B.error(`Could not ${R} ${g.id}`,{description:E(U)?Ke(U,R)??U.detail??U.title:U.message})}}),X=O({mutationFn:(U)=>_r(y,g.queue,g.id,"stop",{persist:U}),invalidate:Ye(g.queue),successMessage:(U)=>Ht(g.id,U),toastErrors:!1}),ae=H.pause||H.resume||H.stop||H.start,q=H.blocked!==null&&Ne(H,F)?e("span",{className:"worker-actions-hint muted","data-testid":`worker-blocked-${g.id}`,children:dt[H.blocked]}):null;if(!ae&&!H.configure)return q;return t("div",{className:"worker-actions",role:"group","aria-label":`Actions for worker ${g.id}`,children:[H.pause&&e(a,{size:"sm",onClick:()=>Q.mutate("pause"),disabled:Q.isPending,"aria-busy":Q.isPending||void 0,children:"Pause"}),H.resume&&e(a,{size:"sm",onClick:()=>Q.mutate("resume"),disabled:Q.isPending,"aria-busy":Q.isPending||void 0,children:"Resume"}),H.start&&e(a,{size:"sm",variant:"primary",onClick:()=>Q.mutate("start"),disabled:Q.isPending,"aria-busy":Q.isPending||void 0,children:"Start"}),H.stop&&e(a,{size:"sm",variant:"danger",onClick:()=>G("stop"),children:"Stop…"}),H.configure&&e(a,{size:"sm",onClick:()=>G("settings"),children:"Settings…"}),q,e(ut,{open:J==="stop",onClose:se,worker:g,onConfirm:(U)=>X.mutateAsync(U)}),J==="settings"&&e(Bn,{worker:g,onClose:se})]})}var Ge={"exit-on-idle":{label:"Exit when idle",hint:"The summoner asked it to exit once its queue has no work for it."},"until-stopped":{label:"Run until stopped",hint:"The summoner asked it to keep running until something stops it."},"in-invocation":{label:"Within one invocation",hint:"The summoner asked it to run inside a single platform invocation, and end with it."}},Oo="How this worker was started, as its summoner recorded it. The mode and deadline are what the summoner requested, not a report of what the worker is doing.";function mt(g){return typeof g==="string"&&Object.hasOwn(Ge,g)}function fn(g){return mt(g)?Ge[g].label:l(g)}function vo(g){return mt(g)?Ge[g].hint:`The summoner requested a mode this version of the UI does not know ("${l(g)}").`}function ft(g){return g.kind===void 0?"Summoned":`Summoned by ${l(g.kind)}`}function gt(g){return`Unit of ${l(g)}`}function qn(g){return`This worker runs in the shared unit summoned for the summon group ${l(g)}: one process serving its member queues.`}function ht(g){let y=[g.mode!==void 0&&`requested mode: ${fn(g.mode)}`,typeof g.deadlineAt==="number"&&Number.isFinite(g.deadlineAt)&&`requested deadline: ${new Date(g.deadlineAt).toISOString()}`].filter((B)=>B!==!1);return[`Started by a summoner, attempt ${l(g.id)}.`,g.resolvedMode===void 0?"":`Runs as: ${fn(g.resolvedMode)}.`,y.length>0?`The summoner's ${y.join("; ")}.`:"","How it was started, not a setting."].filter((B)=>B!=="").join(" ")}var Xe={"in-process":{label:"In process",hint:"Its attempts run in the worker's own process, on the thread that claims them."},"worker-thread":{label:"Worker thread",hint:"Each attempt runs on a fresh worker thread (a Web Worker) inside the worker's process."},"child-process":{label:"Child process",hint:"Each attempt runs in a fresh child process, which can be killed if it ignores its signal."},container:{label:"Container",hint:"Each attempt runs in a fresh container: no network, none of the worker's environment, a read-only filesystem."},custom:{label:"Custom",hint:"Its attempts run on a target the application supplied."}},bt={function:"Function",file:"File"},yt="Set in the worker's code when it was built; changing it is a redeploy, not a setting.";function vt(g){return typeof g==="string"&&Object.hasOwn(Xe,g)}function Jn(g){return vt(g)?Xe[g].label:l(g)}function Sr(g){return typeof g==="string"&&Object.hasOwn(bt,g)?bt[g]:l(g)}function wt(g){if(g.kind==="custom"&&g.name!==void 0)return l(g.name);return Jn(g.kind)}function jn(g){return vt(g)?Xe[g].hint:`Its attempts run on a target this version of the UI does not know ("${l(g)}").`}function St(g){let y=jn(g.kind),B=g.kind==="custom"&&g.name!==void 0?` Named "${l(g.name)}" by the application.`:"";return`${y}${B} ${yt}`}var Ro=yt;function Kt(g){return g===void 0?"":JSON.stringify([g.kind,g.processor,g.name,g.file])}function Ao(g){let y=new Map;for(let B of g){let F=Kt(B.target),J=y.get(F);if(J===void 0)y.set(F,{target:B.target,ids:[B.id]});else J.ids.push(B.id)}return[...y.values()]}var zt={running:{label:"Running",tone:"success",hint:"Taking jobs from its queue."},paused:{label:"Paused",tone:"warning",hint:"Its loop runs, but it takes no new jobs until it is resumed."},stopping:{label:"Stopping",tone:"neutral",hint:"Finishing the jobs it holds; it takes no more."},stopped:{label:"Stopped",tone:"neutral",hint:"Parked, and still listed, so it can be started again."},restarting:{label:"Restarting",tone:"accent",hint:"Taking up changed settings; this lasts milliseconds."}},Ut="Resident memory of the process this worker runs in, at its last report — not the worker's own. Workers sharing a pid repeat the same figure, so do not add these up; to size a host, take one row per pid.",Vt=new Intl.NumberFormat(void 0,{maximumFractionDigits:1});function Gt(g){let y=g.heartbeatRttMs;if(y===void 0)return;return`Last write took ${Vt.format(y)} ms (the previous report's round trip to the driver, not a network ping).`}function Qt({worker:g}){let y=zt[Jt(g)];return t(n,{children:[e(p,{tone:y.tone,title:y.hint,testId:"worker-state",children:y.label})," ",g.control?.pending===!0&&e(p,{tone:"accent",title:"A change was recorded and this worker has not taken it up yet. It applies within seconds.",children:"Change pending"})," ",Gn(g)&&e(p,{tone:"danger",title:"This worker stopped reporting. Its record lapses unless it reports again.",children:"Not reporting"})," ",g.target!==void 0&&t(p,{className:"worker-target",title:St(g.target),children:[e("span",{className:"visually-hidden",children:"Runs in: "}),wt(g.target)]})," ",g.summon!==void 0&&e(p,{className:"worker-summon",title:ht(g.summon),testId:"worker-summon-badge",children:ft(g.summon)})," ",g.summon?.group!==void 0&&e(p,{className:"worker-summon",title:qn(g.summon.group),testId:"worker-summon-unit",children:gt(g.summon.group)})]})}function Wt({value:g}){return e("td",{className:"num",children:g===void 0?e("span",{className:"muted",title:"This worker does not report its counts (it predates them).",children:"—"}):o(g)})}function Xt({value:g}){return e("td",{className:"num",children:g===void 0?e("span",{className:"muted",title:"This worker does not report its process memory (it predates it).",children:"—"}):Sa(g)})}function At({workers:g,label:y,showQueue:B=!0,linkQueues:F=!1,showHost:J=!1,linkKeys:G=!1,showMemory:se=!1,pageSize:H}){let Q=qt(),X=kt(g,H??null),ae=se&&g.some((R)=>R.rssBytes!==void 0),q=g.some((R)=>R.completed!==void 0||R.failed!==void 0),U=g.some((R)=>{let ie=Bt(R,Q);return ie.pause||ie.resume||ie.stop||ie.start||ie.configure||Ne(ie,Q)});return t(n,{children:[t(I,{label:y,children:[e("thead",{children:t("tr",{children:[e("th",{scope:"col",children:"Worker"}),B&&e("th",{scope:"col",children:"Queue"}),J&&e("th",{scope:"col",children:"Host"}),J&&e("th",{scope:"col",className:"num",children:"Pid"}),e("th",{scope:"col",children:"State"}),e("th",{scope:"col",className:"num",children:"Active / concurrency"}),q&&e("th",{scope:"col",className:"num",title:"Jobs this incarnation completed since it started; a restart starts it again.",children:"Completed"}),q&&e("th",{scope:"col",className:"num",title:"Attempts this incarnation failed since it started; a restart starts it again.",children:"Failed"}),ae&&e("th",{scope:"col",className:"num",title:Ut,children:"Memory"}),e("th",{scope:"col",children:"Started"}),e("th",{scope:"col",children:"Heartbeat"}),U&&e("th",{scope:"col",children:"Actions"})]})}),e("tbody",{children:X.rows.map((R)=>t("tr",{"data-testid":`worker-row-${R.id}`,children:[t("th",{scope:"row",children:[e("code",{children:R.id}),G&&R.key!==void 0&&e("div",{className:"worker-key",children:e(b,{to:je(R.queue,R.key),title:`Every instance of ${R.key}, its settings and its numbers`,"data-testid":`worker-key-link-${R.id}`,children:R.key})})]}),B&&e("td",{children:F?e(b,{to:Ve(R.queue),children:R.queue}):R.queue}),J&&e("td",{children:R.host??"—"}),J&&e("td",{className:"num",children:R.pid??"—"}),e("td",{children:e(Qt,{worker:R})}),t("td",{className:"num",children:[o(R.active)," /"," ",o(R.concurrency)]}),q&&e(Wt,{value:R.completed}),q&&e(Wt,{value:R.failed}),ae&&e(Xt,{value:R.rssBytes}),e("td",{children:e(v,{value:R.startedAt})}),e("td",{children:e(v,{value:R.heartbeatAt,hint:Gt(R)})}),U&&e("td",{children:e(pt,{worker:R})})]},`${R.queue}/${R.id}`))})]}),X.paged&&e(ne,{label:`Pages of ${y}`,offset:X.offset,limit:X.limit,total:X.total,itemCount:X.rows.length,onChange:X.onChange})]})}
|
|
2
|
-
export{ze,Rt,Ae,mn,bo,Eo,Tr,Dr,No,pn,Fn,Bt,qt,Vn,Bn,Oo,fn,vo,qn,Jn,Sr,jn,Ro,Ao,At};
|
|
3
|
-
|
|
4
|
-
//# debugId=0ABD2DBE1937257464756E2164756E21
|
|
5
|
-
//# sourceMappingURL=main-eekxtm5w.js.map
|
|
@@ -1,5 +0,0 @@
|
|
|
1
|
-
import{m,et}from"./main-xf44bv26.js";function re(){let o=m(),t=et();return(n)=>!o.readOnly&&t(n)}function ta(o,t){return t&&!o.readOnly&&(o.addableNames===null||o.addableNames.length>0)}
|
|
2
|
-
export{re,ta};
|
|
3
|
-
|
|
4
|
-
//# debugId=A0FCD4A0C768228664756E2164756E21
|
|
5
|
-
//# sourceMappingURL=main-fcq7hfk0.js.map
|