diff --git a/crates/ghostlight-dungeon/src/model.rs b/crates/ghostlight-dungeon/src/model.rs index b102cc5..a446d71 100644 --- a/crates/ghostlight-dungeon/src/model.rs +++ b/crates/ghostlight-dungeon/src/model.rs @@ -576,7 +576,7 @@ mod tests { capable.model = MODEL_CAPABLE.into(); assert_eq!( openrouter_request_body(&capable, "stealth/ox-alpha")["reasoning"]["effort"], - "high" + "medium" ); } @@ -852,7 +852,7 @@ fn openrouter_request_body(request: &ModelStageRequest, resolved_model: &str) -> "messages": [{"role": "user", "content": request.lived_stream}], "stream": false, "reasoning": { - "effort": if request.model == MODEL_CAPABLE { "high" } else { "low" }, + "effort": if request.model == MODEL_CAPABLE { "medium" } else { "low" }, "exclude": true } }); diff --git a/crates/ghostlight-dungeon/src/session_zero.rs b/crates/ghostlight-dungeon/src/session_zero.rs index 266c4e1..e682d03 100644 --- a/crates/ghostlight-dungeon/src/session_zero.rs +++ b/crates/ghostlight-dungeon/src/session_zero.rs @@ -1361,6 +1361,21 @@ fn permitted_dm_context( }); if channel.kind == SessionZeroChannelKind::PrivateDm { let member_id = member_id.ok_or_else(|| anyhow!("private member is missing"))?; + let recent_shared_messages = state + .channels + .get("shared:table") + .into_iter() + .flat_map(|shared| shared.message_ids.iter().rev().take(8).rev()) + .filter_map(|id| state.messages.get(id)) + .map(|message| { + serde_json::json!({ + "speaker": message.speaker, + "author_member_id": message.author_member_id, + "text": message.text, + }) + }) + .collect::>(); + value["recent_shared_messages"] = serde_json::to_value(recent_shared_messages)?; value["private_character"] = serde_json::to_value( state .character_drafts @@ -2804,6 +2819,39 @@ mod tests { assert_eq!(receipts.len(), 3); } + #[test] + fn private_dm_context_carries_bounded_public_session_continuity() { + let mut draft = state(); + let host_id = draft.host_member_id.clone(); + append_message( + &mut draft, + "shared:table".into(), + Some(host_id.clone()), + SessionZeroSpeakerKind::Player, + "The campaign begins in Hellas inside Zhestokost space.".into(), + ) + .unwrap(); + let private_channel = format!("private:{host_id}"); + append_message( + &mut draft, + private_channel.clone(), + Some(host_id.clone()), + SessionZeroSpeakerKind::Player, + "I carry a forged transit credential.".into(), + ) + .unwrap(); + + let context = permitted_dm_context(&draft, &private_channel, Some(&host_id)).unwrap(); + let shared = serde_json::to_string(&context["recent_shared_messages"]).unwrap(); + assert!(shared.contains("Hellas inside Zhestokost space")); + assert!(!shared.contains("forged transit credential")); + assert!( + serde_json::to_string(&context["recent_messages"]) + .unwrap() + .contains("forged transit credential") + ); + } + #[tokio::test] async fn private_channels_and_boundaries_preserve_ownership() { let dir = tempdir().unwrap(); diff --git a/vendor/eve b/vendor/eve index 6b5faa6..23eaf32 160000 --- a/vendor/eve +++ b/vendor/eve @@ -1 +1 @@ -Subproject commit 6b5faa6a77cf59faaa46a2a96ddb3fcadab9c67f +Subproject commit 23eaf32eae76204357c1406b4a7d01bcece6b815 diff --git a/web/dist/assets/index-CRfIb_s9.js b/web/dist/assets/index-BAZ19qgm.js similarity index 83% rename from web/dist/assets/index-CRfIb_s9.js rename to web/dist/assets/index-BAZ19qgm.js index 78076c5..53a47d5 100644 --- a/web/dist/assets/index-CRfIb_s9.js +++ b/web/dist/assets/index-BAZ19qgm.js @@ -1,4 +1,4 @@ -(function(){const t=document.createElement("link").relList;if(t&&t.supports&&t.supports("modulepreload"))return;for(const o of document.querySelectorAll('link[rel="modulepreload"]'))n(o);new MutationObserver(o=>{for(const i of o)if(i.type==="childList")for(const s of i.addedNodes)s.tagName==="LINK"&&s.rel==="modulepreload"&&n(s)}).observe(document,{childList:!0,subtree:!0});function r(o){const i={};return o.integrity&&(i.integrity=o.integrity),o.referrerPolicy&&(i.referrerPolicy=o.referrerPolicy),o.crossOrigin==="use-credentials"?i.credentials="include":o.crossOrigin==="anonymous"?i.credentials="omit":i.credentials="same-origin",i}function n(o){if(o.ep)return;o.ep=!0;const i=r(o);fetch(o.href,i)}})();const Ve=new WeakMap,Or=20;function _a(e,t,r,n,o,i,s,c){const l=Ea(e.canvas);if(!l)return!1;const u=l.gl;if(!Pa(l,i,s))return Ve.set(e.canvas,null),!1;const a=$a(t,r,n,o,c);u.bindFramebuffer(u.FRAMEBUFFER,l.framebuffer),u.viewport(0,0,i,s),u.disable(u.DEPTH_TEST),u.disable(u.CULL_FACE),u.enable(u.BLEND),u.blendFunc(u.ONE,u.ONE),u.clearColor(0,0,0,1),u.clear(u.COLOR_BUFFER_BIT),a.gravity.length>0&&(u.useProgram(l.splatProgram),u.uniform4f(u.getUniformLocation(l.splatProgram,"u_viewport"),o.minX,o.minY,o.maxX,o.maxY),u.uniform1f(u.getUniformLocation(l.splatProgram,"u_time"),se(t.simulationTimeSeconds,0)),u.bindBuffer(u.ARRAY_BUFFER,l.splatBuffer),u.bufferData(u.ARRAY_BUFFER,a.gravity,u.DYNAMIC_DRAW),nn(u,l.splatProgram),u.drawArrays(u.TRIANGLES,0,a.gravity.length/Or)),u.bindFramebuffer(u.FRAMEBUFFER,l.tintFramebuffer),u.clearColor(0,0,0,0),u.clear(u.COLOR_BUFFER_BIT),a.tint.length>0&&(u.useProgram(l.splatProgram),u.uniform4f(u.getUniformLocation(l.splatProgram,"u_viewport"),o.minX,o.minY,o.maxX,o.maxY),u.uniform1f(u.getUniformLocation(l.splatProgram,"u_time"),se(t.simulationTimeSeconds,0)),u.bindBuffer(u.ARRAY_BUFFER,l.splatBuffer),u.bufferData(u.ARRAY_BUFFER,a.tint,u.DYNAMIC_DRAW),nn(u,l.splatProgram),u.drawArrays(u.TRIANGLES,0,a.tint.length/Or)),u.disable(u.BLEND),u.bindFramebuffer(u.FRAMEBUFFER,null),u.viewport(0,0,i,s),u.useProgram(l.shadeProgram),u.activeTexture(u.TEXTURE0),u.bindTexture(u.TEXTURE_2D,l.fieldTexture),u.uniform1i(u.getUniformLocation(l.shadeProgram,"u_field"),0),u.activeTexture(u.TEXTURE1),u.bindTexture(u.TEXTURE_2D,l.tintTexture),u.uniform1i(u.getUniformLocation(l.shadeProgram,"u_tint"),1),u.uniform2f(u.getUniformLocation(l.shadeProgram,"u_resolution"),i,s),u.uniform1f(u.getUniformLocation(l.shadeProgram,"u_time"),se(r.simulationTimeSeconds,se(t.simulationTimeSeconds,0))),u.uniform1f(u.getUniformLocation(l.shadeProgram,"u_lineInterval"),se(t.lineInterval,se(t.scalarFieldLineInterval,se(t.depthRange,228.79605)/20))),u.uniform1f(u.getUniformLocation(l.shadeProgram,"u_lineOffset"),se(t.lineOffset,se(t.startDepth,2.310401))),u.uniform1f(u.getUniformLocation(l.shadeProgram,"u_lineWidth"),se(t.lineWidth,.3)),u.uniform1f(u.getUniformLocation(l.shadeProgram,"u_lineFade"),se(t.lineFade,5)),u.uniform1f(u.getUniformLocation(l.shadeProgram,"u_angleWidth"),se(t.angleWidth,.05)),u.uniform1f(u.getUniformLocation(l.shadeProgram,"u_angleFade"),se(t.angleFade,1.15)),u.uniform1f(u.getUniformLocation(l.shadeProgram,"u_dangerSteepness"),se(t.dangerSteepness,1.5)),u.uniform1f(u.getUniformLocation(l.shadeProgram,"u_scale"),se(t.isolineScale,2.6924083)),We(u,l.shadeProgram,"u_baseColor",Ge(t.scalarFieldBaseColor,[.002,.006,.012])),We(u,l.shadeProgram,"u_fieldGlowColor",Ge(t.scalarFieldGlowColor,[.018,.05,.075])),We(u,l.shadeProgram,"u_lineLowColor",Ge(t.scalarFieldLowLineColor,[0,.34,.52])),We(u,l.shadeProgram,"u_lineHighColor",Ge(t.scalarFieldHighLineColor,[1.45,.3,.05])),We(u,l.shadeProgram,"u_angleLowColor",Ge(t.scalarFieldLowAngleColor,[.06,.16,.24])),We(u,l.shadeProgram,"u_angleHighColor",Ge(t.scalarFieldHighAngleColor,[1.1,.24,.04])),u.uniform1f(u.getUniformLocation(l.shadeProgram,"u_tintScale"),se(t.vectorFieldTintScale,.45)),u.bindBuffer(u.ARRAY_BUFFER,l.quadBuffer);const f=u.getAttribLocation(l.shadeProgram,"a_position");return u.enableVertexAttribArray(f),u.vertexAttribPointer(f,2,u.FLOAT,!1,0,0),u.drawArrays(u.TRIANGLES,0,6),e.drawImage(l.canvas,0,0,i,s),!0}function $a(e,t,r,n,o){const i=[],s=[];return wa(i,e,t,r),Sa(s,e,o),{gravity:new Float32Array(i),tint:new Float32Array(s)}}function wa(e,t,r,n,o){const i=se(r.terrainRadius,se(t.terrainRadius,1200)),s=se(r.terrainDepth,se(t.terrainDepth,-8));s!==0&&ar(e,0,0,Math.max(1,i*2),Math.max(1,i*2),-s,0,0,1,Math.max(1e-4,se(r.terrainDepthExponent,se(t.terrainDepthExponent,1.2))),0,1,0,0);for(const c of n)ar(e,c.x,c.y,Math.max(1,c.radius),Math.max(1,c.radius),-c.depth,0,0,1,Math.max(1e-4,c.exponent),0,1,0,0),c.waveRadius>0&&c.waveDepth!==0&&ar(e,c.x,c.y,c.waveRadius,c.waveRadius,-c.waveDepth,0,0,1,8,4,se(r.terrainWaveFrequency,se(t.terrainWaveFrequency,.6)),c.waveSpeed,0)}function Sa(e,t,r){const n=Ia(r?.splats),o=Array.isArray(r?.layers)?r.layers:[],i=new Set,s=Aa(t.vectorFieldLayer,t.tintFieldLayer,"fog.tint");o.forEach((O,A)=>{const M=Ra(O?.layerKey,"");se(O?.channel,-1)===4&&M===s&&i.add(A)});const c=Math.max(0,ka(n.count,0));if(c<=0||i.size===0)return;const l=ye(n.centerX),u=ye(n.centerY),a=ye(n.halfExtentX),f=ye(n.halfExtentY),m=ye(n.rotationCos),y=ye(n.rotationSin),$=ye(n.channel),S=ye(n.falloff),g=ye(n.valueR),_=ye(n.valueG),p=ye(n.valueB),w=ye(n.valueA),E=ye(n.sourceKind),d=ye(n.frequencyX),h=ye(n.animationSpeed),v=ye(n.sourceFlags),I=ye(n.layerIndex);for(let O=0;ONumber(n));if(r.length>=3&&r.slice(0,3).every(Number.isFinite))return[r[0],r[1],r[2]]}if(typeof e=="string"){const r=e.split(/[,\s]+/).map(n=>Number(n)).filter(Number.isFinite);if(r.length>=3)return[r[0],r[1],r[2]]}return t}function We(e,t,r,n){e.uniform3f(e.getUniformLocation(t,r),n[0],n[1],n[2])}function ye(e){return Array.isArray(e)?e.map(t=>se(t,0)):[]}function Ia(e){return e&&typeof e=="object"&&!Array.isArray(e)?e:{}}function Ra(e,t){return e==null?t:String(e)}function Aa(...e){for(const t of e){if(typeof t=="string"&&t.trim())return t;if(typeof t=="number"&&Number.isFinite(t))return String(t)}return""}function ka(e,t){const r=Number(e);return Number.isFinite(r)?Math.max(0,Math.floor(r)):t}const Ca=`#version 300 es +(function(){const t=document.createElement("link").relList;if(t&&t.supports&&t.supports("modulepreload"))return;for(const o of document.querySelectorAll('link[rel="modulepreload"]'))n(o);new MutationObserver(o=>{for(const i of o)if(i.type==="childList")for(const s of i.addedNodes)s.tagName==="LINK"&&s.rel==="modulepreload"&&n(s)}).observe(document,{childList:!0,subtree:!0});function r(o){const i={};return o.integrity&&(i.integrity=o.integrity),o.referrerPolicy&&(i.referrerPolicy=o.referrerPolicy),o.crossOrigin==="use-credentials"?i.credentials="include":o.crossOrigin==="anonymous"?i.credentials="omit":i.credentials="same-origin",i}function n(o){if(o.ep)return;o.ep=!0;const i=r(o);fetch(o.href,i)}})();const Ve=new WeakMap,Mr=20;function _a(e,t,r,n,o,i,s,c){const l=Ea(e.canvas);if(!l)return!1;const u=l.gl;if(!Pa(l,i,s))return Ve.set(e.canvas,null),!1;const a=$a(t,r,n,o,c);u.bindFramebuffer(u.FRAMEBUFFER,l.framebuffer),u.viewport(0,0,i,s),u.disable(u.DEPTH_TEST),u.disable(u.CULL_FACE),u.enable(u.BLEND),u.blendFunc(u.ONE,u.ONE),u.clearColor(0,0,0,1),u.clear(u.COLOR_BUFFER_BIT),a.gravity.length>0&&(u.useProgram(l.splatProgram),u.uniform4f(u.getUniformLocation(l.splatProgram,"u_viewport"),o.minX,o.minY,o.maxX,o.maxY),u.uniform1f(u.getUniformLocation(l.splatProgram,"u_time"),se(t.simulationTimeSeconds,0)),u.bindBuffer(u.ARRAY_BUFFER,l.splatBuffer),u.bufferData(u.ARRAY_BUFFER,a.gravity,u.DYNAMIC_DRAW),an(u,l.splatProgram),u.drawArrays(u.TRIANGLES,0,a.gravity.length/Mr)),u.bindFramebuffer(u.FRAMEBUFFER,l.tintFramebuffer),u.clearColor(0,0,0,0),u.clear(u.COLOR_BUFFER_BIT),a.tint.length>0&&(u.useProgram(l.splatProgram),u.uniform4f(u.getUniformLocation(l.splatProgram,"u_viewport"),o.minX,o.minY,o.maxX,o.maxY),u.uniform1f(u.getUniformLocation(l.splatProgram,"u_time"),se(t.simulationTimeSeconds,0)),u.bindBuffer(u.ARRAY_BUFFER,l.splatBuffer),u.bufferData(u.ARRAY_BUFFER,a.tint,u.DYNAMIC_DRAW),an(u,l.splatProgram),u.drawArrays(u.TRIANGLES,0,a.tint.length/Mr)),u.disable(u.BLEND),u.bindFramebuffer(u.FRAMEBUFFER,null),u.viewport(0,0,i,s),u.useProgram(l.shadeProgram),u.activeTexture(u.TEXTURE0),u.bindTexture(u.TEXTURE_2D,l.fieldTexture),u.uniform1i(u.getUniformLocation(l.shadeProgram,"u_field"),0),u.activeTexture(u.TEXTURE1),u.bindTexture(u.TEXTURE_2D,l.tintTexture),u.uniform1i(u.getUniformLocation(l.shadeProgram,"u_tint"),1),u.uniform2f(u.getUniformLocation(l.shadeProgram,"u_resolution"),i,s),u.uniform1f(u.getUniformLocation(l.shadeProgram,"u_time"),se(r.simulationTimeSeconds,se(t.simulationTimeSeconds,0))),u.uniform1f(u.getUniformLocation(l.shadeProgram,"u_lineInterval"),se(t.lineInterval,se(t.scalarFieldLineInterval,se(t.depthRange,228.79605)/20))),u.uniform1f(u.getUniformLocation(l.shadeProgram,"u_lineOffset"),se(t.lineOffset,se(t.startDepth,2.310401))),u.uniform1f(u.getUniformLocation(l.shadeProgram,"u_lineWidth"),se(t.lineWidth,.3)),u.uniform1f(u.getUniformLocation(l.shadeProgram,"u_lineFade"),se(t.lineFade,5)),u.uniform1f(u.getUniformLocation(l.shadeProgram,"u_angleWidth"),se(t.angleWidth,.05)),u.uniform1f(u.getUniformLocation(l.shadeProgram,"u_angleFade"),se(t.angleFade,1.15)),u.uniform1f(u.getUniformLocation(l.shadeProgram,"u_dangerSteepness"),se(t.dangerSteepness,1.5)),u.uniform1f(u.getUniformLocation(l.shadeProgram,"u_scale"),se(t.isolineScale,2.6924083)),We(u,l.shadeProgram,"u_baseColor",Ge(t.scalarFieldBaseColor,[.002,.006,.012])),We(u,l.shadeProgram,"u_fieldGlowColor",Ge(t.scalarFieldGlowColor,[.018,.05,.075])),We(u,l.shadeProgram,"u_lineLowColor",Ge(t.scalarFieldLowLineColor,[0,.34,.52])),We(u,l.shadeProgram,"u_lineHighColor",Ge(t.scalarFieldHighLineColor,[1.45,.3,.05])),We(u,l.shadeProgram,"u_angleLowColor",Ge(t.scalarFieldLowAngleColor,[.06,.16,.24])),We(u,l.shadeProgram,"u_angleHighColor",Ge(t.scalarFieldHighAngleColor,[1.1,.24,.04])),u.uniform1f(u.getUniformLocation(l.shadeProgram,"u_tintScale"),se(t.vectorFieldTintScale,.45)),u.bindBuffer(u.ARRAY_BUFFER,l.quadBuffer);const f=u.getAttribLocation(l.shadeProgram,"a_position");return u.enableVertexAttribArray(f),u.vertexAttribPointer(f,2,u.FLOAT,!1,0,0),u.drawArrays(u.TRIANGLES,0,6),e.drawImage(l.canvas,0,0,i,s),!0}function $a(e,t,r,n,o){const i=[],s=[];return wa(i,e,t,r),Sa(s,e,o),{gravity:new Float32Array(i),tint:new Float32Array(s)}}function wa(e,t,r,n,o){const i=se(r.terrainRadius,se(t.terrainRadius,1200)),s=se(r.terrainDepth,se(t.terrainDepth,-8));s!==0&&ar(e,0,0,Math.max(1,i*2),Math.max(1,i*2),-s,0,0,1,Math.max(1e-4,se(r.terrainDepthExponent,se(t.terrainDepthExponent,1.2))),0,1,0,0);for(const c of n)ar(e,c.x,c.y,Math.max(1,c.radius),Math.max(1,c.radius),-c.depth,0,0,1,Math.max(1e-4,c.exponent),0,1,0,0),c.waveRadius>0&&c.waveDepth!==0&&ar(e,c.x,c.y,c.waveRadius,c.waveRadius,-c.waveDepth,0,0,1,8,4,se(r.terrainWaveFrequency,se(t.terrainWaveFrequency,.6)),c.waveSpeed,0)}function Sa(e,t,r){const n=Ia(r?.splats),o=Array.isArray(r?.layers)?r.layers:[],i=new Set,s=Aa(t.vectorFieldLayer,t.tintFieldLayer,"fog.tint");o.forEach((O,A)=>{const M=Ra(O?.layerKey,"");se(O?.channel,-1)===4&&M===s&&i.add(A)});const c=Math.max(0,ka(n.count,0));if(c<=0||i.size===0)return;const l=ye(n.centerX),u=ye(n.centerY),a=ye(n.halfExtentX),f=ye(n.halfExtentY),m=ye(n.rotationCos),y=ye(n.rotationSin),$=ye(n.channel),S=ye(n.falloff),g=ye(n.valueR),_=ye(n.valueG),p=ye(n.valueB),w=ye(n.valueA),E=ye(n.sourceKind),d=ye(n.frequencyX),h=ye(n.animationSpeed),v=ye(n.sourceFlags),I=ye(n.layerIndex);for(let O=0;ONumber(n));if(r.length>=3&&r.slice(0,3).every(Number.isFinite))return[r[0],r[1],r[2]]}if(typeof e=="string"){const r=e.split(/[,\s]+/).map(n=>Number(n)).filter(Number.isFinite);if(r.length>=3)return[r[0],r[1],r[2]]}return t}function We(e,t,r,n){e.uniform3f(e.getUniformLocation(t,r),n[0],n[1],n[2])}function ye(e){return Array.isArray(e)?e.map(t=>se(t,0)):[]}function Ia(e){return e&&typeof e=="object"&&!Array.isArray(e)?e:{}}function Ra(e,t){return e==null?t:String(e)}function Aa(...e){for(const t of e){if(typeof t=="string"&&t.trim())return t;if(typeof t=="number"&&Number.isFinite(t))return String(t)}return""}function ka(e,t){const r=Number(e);return Number.isFinite(r)?Math.max(0,Math.floor(r)):t}const Ca=`#version 300 es in vec2 a_corner; in vec2 a_center; in vec2 a_half; @@ -131,14 +131,14 @@ void main() { color += clamp(lines, 0.0, 1.7); outColor = vec4(color, 1.0); -}`,Bi=new Set(["gamecult.fields.splats.v1","gamecult.fields.gravity.v1","gamecult.fields.objects.v1"]),Oa={pluginId:"fields.surface",capabilities:["field.surface2d","gravity.surface","field.scalar","field.vector","field.objects"],componentKinds:["field.surface2d","gravity.surface"],schemas:[...Bi],normalizeDocument:Mr,renderComponent:Ma};function Ma(e,t,r,n,o,i){const s=document.createElement("canvas");s.className="cultui-gravity-surface",e.id&&(s.id=e.id),s.setAttribute("role","img"),s.setAttribute("aria-label",ao(t.label,"gravity surface")),s.style.display="block",s.style.width="100%",s.style.height="100%",s.style.pointerEvents="none",i.applyGeneratedLayout(s,r,n);let c=!1;const l={},u=()=>La(s,t,l,i.resolveAssetUrl),a=()=>{!s.isConnected||c||(c=!0,requestAnimationFrame(()=>{c=!1,s.isConnected&&u()}))};s.addEventListener("cultui:asset-loaded",a);let f=0,m;const y=()=>{f&&window.clearInterval(f),m?.disconnect(),s.removeEventListener("cultui:asset-loaded",a)},$=()=>{if(!s.isConnected){y();return}qa(e,t,o,i.providerId,l).then(g=>{g&&s.isConnected&&a()}).catch(g=>{l.lastError=g instanceof Error?g.message:String(g)})};typeof ResizeObserver<"u"&&(m=new ResizeObserver(a),m.observe(s)),a();const S=Math.max(33,Math.min(1e3,oo(t.stateRefreshMs,100)));return f=window.setInterval($,S),queueMicrotask($),window.setTimeout(a,300),window.setTimeout(a,1e3),s}async function qa(e,t,r,n,o){if(o.loading)return!1;const i=[$r(e,t,"renderSplats","renderSplatsDocumentId","renderSplatsSchemaId"),$r(e,t,"gravity","gravityDocumentId","gravitySchemaId"),$r(e,t,"objects","objectsDocumentId","objectsSchemaId")].filter(s=>!!s?.documentId);if(i.length===0)return!1;o.loading=!0;try{let s=!1;for(const c of i){const l=await r.documentResolver?.(c,e);let u=ur(Mr(l?.schemaId||c.schemaId,l?.document));if(Object.keys(u).length===0&&(u=ur(Mr(c.schemaId,await xa(c,n||r.provider?.providerId)))),Object.keys(u).length===0)continue;const a=c.slotId==="renderSplats"?"renderSplats":c.slotId==="gravity"?"gravity":"objects",f=xr(o[a]?.frameId,-1),m=xr(u.frameId,f);o[a]=u,s||=m!==f}return o.lastLoadedAt=Date.now(),s}finally{o.loading=!1}}async function xa(e,t){if(typeof fetch!="function"||typeof window>"u"||!t)return;const r=new URLSearchParams({documentId:e.documentId});e.schemaId&&r.set("schemaId",e.schemaId),e.slotId&&r.set("slotId",e.slotId);const n=await fetch(`/eir/document/${encodeURIComponent(t)}?${r.toString()}`,{cache:"no-store",headers:{Accept:"application/json"}});if(n.ok)return ur(await n.json()).document}function $r(e,t,r,n,o){const i=(e.embeddedDocuments||[]).find(c=>String(c?.slotId||"")===r),s=ue(t[n],i?.documentId);if(s)return{documentId:s,schemaId:ue(t[o],i?.schemaId),presentationKind:ue(i?.presentationKind)||"data",slotId:r}}function Mr(e,t){const r=Array.isArray(t)?t:void 0,n=r?r[0]:t?.schema,o=String(e||n||"");return!r||!Bi.has(o)?t:o==="gamecult.fields.splats.v1"?Ya(r):o==="gamecult.fields.gravity.v1"?Ja(r):Qa(r)}function La(e,t,r,n){const o=e.getBoundingClientRect(),i=Math.max(1,Math.floor(o.width||e.clientWidth||1)),s=Math.max(1,Math.floor(o.height||e.clientHeight||1)),c=Math.max(1,Math.min(2,window.devicePixelRatio||1)),l=Math.max(1,Math.floor(i*c)),u=Math.max(1,Math.floor(s*c));(e.width!==l||e.height!==u)&&(e.width=l,e.height=u);const a=e.getContext("2d");if(!a)return;a.setTransform(c,0,0,c,0,0),a.clearRect(0,0,i,s);const f=Xa(Wa(t),i,s),m=Wi(r?.gravity),y=Ha(r?.gravity)||Ka(ue(t.bodies,"")),$=Ga(r?.objects)||Ba(ue(t.objects,""));_a(a,t,m,y,f,i,s,r?.renderSplats)||Da(a,t,i,s,"field.surface2d requires WebGL2 float render targets"),Fa(a,y,t,f,i,s,n),za(a,$,t,f,i,s,n)}function Da(e,t,r,n,o){e.save(),e.fillStyle=ue(t.failureBackground,"rgba(0, 0, 0, 0.72)"),e.fillRect(0,0,r,n),e.font=ue(t.failureFont,"700 13px Cascadia Mono, Consolas, monospace"),e.fillStyle=ue(t.failureColor,"rgba(255, 184, 79, 0.95)"),e.fillText(o,16,28),e.restore()}function Fa(e,t,r,n,o,i,s){for(const c of t){const l=Gi(n,c.x,c.y,o,i),u=Math.max(18,Math.min(190,c.radius/Math.max(1,n.maxX-n.minX)*o*.32)),a=s(c.icon),f=c.kind.toLowerCase().includes("sun")?Math.max(oe(r.sunIconMinPx,34),u*oe(r.sunIconScale,.72)):Math.max(oe(r.bodyIconMinPx,24),u*oe(r.bodyIconScale,.48)),m=c.iconSize>0?c.iconSize:f;a&&Ua(e,a,l.x,l.y,m,.92),c.key&&Hi(e,r,c.key.replace(/^local\./,""),l.x+u*.44,l.y-u*.48,ue(r.bodyLabelColor,"rgba(226, 244, 255, 0.82)"))}}const cr=new Map;function Ua(e,t,r,n,o,i){let s=cr.get(t);s||(s=new Image,s.decoding="async",s.onload=()=>requestAnimationFrame(()=>{e.canvas.dispatchEvent(new CustomEvent("cultui:asset-loaded"))}),s.src=t,cr.set(t,s)),!(!s.complete||s.naturalWidth===0)&&(e.save(),e.globalAlpha=i,e.drawImage(s,r-o/2,n-o/2,o,o),e.restore())}function za(e,t,r,n,o,i,s){for(const c of t){const l=Gi(n,c.x,c.y,o,i);if(l.x<-40||l.x>o+40||l.y<-40||l.y>i+40)continue;const u=c.kind.toLowerCase().includes("station")?oe(r.stationIconSizePx,34):c.controlled?oe(r.shipIconSizePx,22):oe(r.remoteShipIconSizePx,18),a=Va(r,c.faction,c.controlled,c.visibility),f=s(c.icon);e.save(),e.globalAlpha=Math.max(.25,Math.min(1,c.visibility)),e.translate(l.x,l.y);const m=Math.atan2(c.directionY,c.directionX)+Math.PI/2;if(c.kind.toLowerCase().includes("ship")&&e.rotate(m),f){const y=cr.get(f);if(y)y.complete&&y.naturalWidth>0&&e.drawImage(y,-u/2,-u/2,u,u);else{const $=new Image;$.decoding="async",$.onload=()=>e.canvas.dispatchEvent(new CustomEvent("cultui:asset-loaded")),$.src=f,cr.set(f,$)}}e.restore(),Hi(e,r,c.label,l.x+u*.55,l.y-u*.45,a)}}function Hi(e,t,r,n,o,i){r&&(e.save(),e.font=ue(t.objectLabelFont,"700 12px Ubuntu, system-ui, sans-serif"),e.textBaseline="middle",e.lineWidth=oe(t.objectLabelStrokeWidth,3),e.strokeStyle=ue(t.objectLabelStroke,"rgba(0, 0, 0, 0.72)"),e.fillStyle=i,e.strokeText(r,n,o),e.fillText(r,n,o),e.restore())}function Va(e,t,r,n){const o=Math.max(.25,Math.min(1,n));if(r)return st(ue(e.objectControlledColor,"rgba(122, 240, 255, {alpha})"),o);const i=t.toLowerCase();return i.includes("raider")?st(ue(e.objectRaiderColor,"rgba(255, 143, 74, {alpha})"),o):i.includes("neutral")?st(ue(e.objectNeutralColor,"rgba(232, 232, 224, {alpha})"),o):st(ue(e.objectDefaultColor,"rgba(214, 244, 255, {alpha})"),o)}function st(e,t){return e.replaceAll("{alpha}",String(t))}function Ka(e){return e.split(";").map(t=>t.trim()).filter(Boolean).map(t=>{const r=t.split("|");return{key:r[0]??"",kind:r[1]??"",x:Number(r[2])||0,y:Number(r[3])||0,radius:Math.max(1,Number(r[4])||1),depth:Number(r[5])||0,exponent:Number(r[6])||1,waveRadius:Number(r[7])||0,waveDepth:Number(r[8])||0,waveSpeed:Number(r[9])||0,icon:r[10]??"",iconSize:Number(r[12])||0,tint:r[11]??""}})}function Ba(e){return e.split(";").map(t=>t.trim()).filter(Boolean).map(t=>{const r=t.split("|");return{key:r[0]??"",kind:r[1]??"",label:r[2]??"",x:Number(r[3])||0,y:Number(r[4])||0,directionX:Number(r[5])||0,directionY:Number(r[6])||1,faction:r[7]??"",controlled:r[8]==="1"||r[8]==="true",visibility:Number(r[9])||1,icon:r[10]??""}})}function Ha(e){const t=Array.isArray(e?.gravityInfluences)?e.gravityInfluences:[],r=Array.isArray(e?.bodies)?e.bodies:[];if(t.length===0&&r.length===0)return;const n=new Map;for(const o of r){const i=ue(o.bodyKey,o.name,"");i&&n.set(i,o)}return(t.length>0?t:r).map(o=>{const i=ue(o.bodyKey,o.name,"body"),s=n.get(i),c=ue(o.kind,"Body");return{key:i,kind:c,x:oe(o.x,0),y:oe(o.y,0),radius:Math.max(1,oe(o.radius,80)),depth:oe(o.gravityDepth,0),exponent:oe(o.gravityDepthExponent,1),waveRadius:oe(o.waveRadius,0),waveDepth:oe(o.waveDepth,0),waveSpeed:oe(o.waveSpeed,0),icon:qr(o.iconAsset)||qr(s?.iconAsset),iconSize:oe(s?.iconSize,oe(o.iconSize,0)),tint:""}})}function Ga(e){const t=Array.isArray(e?.objects)?e.objects:[];if(t.length!==0)return t.map(r=>{const n=ue(r.kind,"object");return{key:ue(r.entityKey,String(r.entityIndex??""),"object"),kind:n,label:ue(r.displayName,r.entityKey,"object"),x:oe(r.x,0),y:oe(r.y,0),directionX:oe(r.directionX,1),directionY:oe(r.directionY,0),faction:ue(r.factionKey,""),controlled:so(r.controlled),visibility:oe(r.visibility,1),icon:qr(r.iconAsset)}})}function qr(e){const t=Wi(e);return ue(t.uri,"")}function Wa(e){const t=Math.max(1,oe(e.viewRadius,Math.max(1200,oe(e.terrainRadius,1200))));return{minX:oe(e.minX,-t),minY:oe(e.minY,-t),maxX:oe(e.maxX,t),maxY:oe(e.maxY,t)}}function Xa(e,t,r){const n=Math.max(1e-4,e.maxX-e.minX),o=Math.max(1e-4,e.maxY-e.minY),i=Math.max(1e-4,t/Math.max(1,r)),s=n/o,c=(e.minX+e.maxX)*.5,l=(e.minY+e.maxY)*.5;if(i>s){const a=o*i;return{minX:c-a*.5,maxX:c+a*.5,minY:e.minY,maxY:e.maxY}}const u=n/i;return{minX:e.minX,maxX:e.maxX,minY:l-u*.5,maxY:l+u*.5}}function Gi(e,t,r,n,o){return{x:(t-e.minX)/Math.max(1,e.maxX-e.minX)*n,y:(r-e.minY)/Math.max(1,e.maxY-e.minY)*o}}function Ya(e){const t=$e(e[9]);return{schema:e[0],frameId:e[1],publishedAtUtc:e[2],simulationTimeSeconds:e[3],runId:e[4],zoneIndex:e[5],zoneName:e[6],viewport:zr(e[7]),layers:$e(e[8]).map(Za),splats:{count:t[0]??0,centerX:t[1]||[],centerY:t[2]||[],halfExtentX:t[3]||[],halfExtentY:t[4]||[],rotationCos:t[5]||[],rotationSin:t[6]||[],channel:t[7]||[],falloff:t[8]||[],valueR:t[9]||[],valueG:t[10]||[],valueB:t[11]||[],valueA:t[12]||[],sourceKey:t[13]||[],layerIndex:t[14]||[],sourceKind:t[15]||[],frequencyX:t[16]||[],frequencyY:t[17]||[],phaseX:t[18]||[],phaseY:t[19]||[],animationSpeed:t[20]||[],sourceFlags:t[21]||[]}}}function Ja(e){return{schema:e[0],frameId:e[1],publishedAtUtc:e[2],simulationTimeSeconds:e[3],runId:e[4],zoneIndex:e[5],zoneName:e[6],viewport:zr(e[7]),gravityInfluences:$e(e[8]).map(eo),bodies:$e(e[9]).map(to),terrainRadius:e[10],terrainDepth:e[11],terrainDepthExponent:e[12],terrainWaveFrequency:e[13]}}function Qa(e){return{schema:e[0],frameId:e[1],publishedAtUtc:e[2],simulationTimeSeconds:e[3],runId:e[4],zoneIndex:e[5],zoneName:e[6],currentEntityKey:e[7],viewport:zr(e[8]),controlledEntityIndices:$e(e[9]),objects:$e(e[10]).map(ro)}}function zr(e){const t=$e(e);return t.length?{minX:t[0],minY:t[1],maxX:t[2],maxY:t[3]}:e}function Za(e){const t=$e(e);return t.length?{layerKey:t[0],displayName:t[1],channel:t[2],blendMode:t[3],graphicsFormat:t[4],clearBeforeDraw:t[5],clearR:t[6],clearG:t[7],clearB:t[8],clearA:t[9]}:e}function eo(e){const t=$e(e);return t.length?{bodyKey:t[0],orbitKey:t[1],kind:t[2],x:t[3],y:t[4],radius:t[5],gravityDepth:t[6],gravityDepthExponent:t[7],waveRadius:t[8],waveDepth:t[9],waveSpeed:t[10]}:e}function to(e){const t=$e(e);return t.length?{bodyKey:t[0],orbitKey:t[1],name:t[2],kind:t[3],x:t[4],y:t[5],radius:t[6],isAsteroidBelt:t[7],body:t[8],iconAsset:Vr(t[9])}:e}function ro(e){const t=$e(e);return t.length?{entityIndex:t[0],entityKey:t[1],displayName:t[2],kind:t[3],factionKey:t[4],x:t[5],y:t[6],z:t[7],directionX:t[8],directionY:t[9],velocityX:t[10],velocityY:t[11],controlled:t[12],targetEntityIndex:t[13],isActive:t[14],visibility:t[15],status:no(t[16]),inventory:$e(t[17]).map(io),iconAsset:Vr(t[18])}:e}function no(e){const t=$e(e);return t.length?{hull:t[0],shield:t[1],heat:t[2]}:e||{}}function io(e){const t=$e(e);return t.length?{source:t[0],itemKey:t[1],quantity:t[2],quality:t[3],durability:t[4],enabled:t[5],sourceIndex:t[6],x:t[7],y:t[8],iconAsset:Vr(t[9])}:e}function Vr(e){const t=$e(e);return t.length?{assetKey:t[0],kind:t[1],uri:t[2],transport:t[3],contentHash:t[4],mimeType:t[5],metadata:t[6]||{}}:e||{}}function $e(e){return Array.isArray(e)?e:[]}function ur(e){return e&&typeof e=="object"&&!Array.isArray(e)?e:{}}function ue(...e){for(const t of e)if(typeof t=="string"&&t.trim())return t.trim();return""}function ao(e,t){return typeof e=="string"&&e?e:t}function oo(e,t){const r=Number(e);return Number.isFinite(r)&&r>0?Math.floor(r):t}function xr(e,t){const r=Number(e);return Number.isFinite(r)?r:t}const Wi=ur,oe=xr;function so(e){return typeof e=="boolean"?e:typeof e=="number"?e!==0:typeof e=="string"&&["1","true","yes","on"].includes(e.trim().toLowerCase())}function co(e){return e&&e.__esModule&&Object.prototype.hasOwnProperty.call(e,"default")?e.default:e}var ct={exports:{}},wr={},Te={},Fe={},Sr={},Er={},Pr={},sn;function lr(){return sn||(sn=1,(function(e){Object.defineProperty(e,"__esModule",{value:!0}),e.regexpCode=e.getEsmExportName=e.getProperty=e.safeStringify=e.stringify=e.strConcat=e.addCodeArg=e.str=e._=e.nil=e._Code=e.Name=e.IDENTIFIER=e._CodeOrName=void 0;class t{}e._CodeOrName=t,e.IDENTIFIER=/^[a-z$_][a-z$_0-9]*$/i;class r extends t{constructor(p){if(super(),!e.IDENTIFIER.test(p))throw new Error("CodeGen: name must be a valid identifier");this.str=p}toString(){return this.str}emptyStr(){return!1}get names(){return{[this.str]:1}}}e.Name=r;class n extends t{constructor(p){super(),this._items=typeof p=="string"?[p]:p}toString(){return this.str}emptyStr(){if(this._items.length>1)return!1;const p=this._items[0];return p===""||p==='""'}get str(){var p;return(p=this._str)!==null&&p!==void 0?p:this._str=this._items.reduce((w,E)=>`${w}${E}`,"")}get names(){var p;return(p=this._names)!==null&&p!==void 0?p:this._names=this._items.reduce((w,E)=>(E instanceof r&&(w[E.str]=(w[E.str]||0)+1),w),{})}}e._Code=n,e.nil=new n("");function o(_,...p){const w=[_[0]];let E=0;for(;E{if(f.scopePath===void 0)throw new Error(`CodeGen: name "${f}" has no value`);return(0,t._)`${u}${f.scopePath}`})}scopeCode(u=this._values,a,f){return this._reduceValues(u,m=>{if(m.value===void 0)throw new Error(`CodeGen: name "${m}" has no value`);return m.value.code},a,f)}_reduceValues(u,a,f={},m){let y=t.nil;for(const $ in u){const S=u[$];if(!S)continue;const g=f[$]=f[$]||new Map;S.forEach(_=>{if(g.has(_))return;g.set(_,n.Started);let p=a(_);if(p){const w=this.opts.es5?e.varKinds.var:e.varKinds.const;y=(0,t._)`${y}${w} ${_} = ${p};${this.opts._n}`}else if(p=m?.(_))y=(0,t._)`${y}${p}${this.opts._n}`;else throw new r(_);g.set(_,n.Completed)})}return y}}e.ValueScope=c})(Ir)),Ir}var ln;function W(){return ln||(ln=1,(function(e){Object.defineProperty(e,"__esModule",{value:!0}),e.or=e.and=e.not=e.CodeGen=e.operators=e.varKinds=e.ValueScopeName=e.ValueScope=e.Scope=e.Name=e.regexpCode=e.stringify=e.getProperty=e.nil=e.strConcat=e.str=e._=void 0;const t=lr(),r=un();var n=lr();Object.defineProperty(e,"_",{enumerable:!0,get:function(){return n._}}),Object.defineProperty(e,"str",{enumerable:!0,get:function(){return n.str}}),Object.defineProperty(e,"strConcat",{enumerable:!0,get:function(){return n.strConcat}}),Object.defineProperty(e,"nil",{enumerable:!0,get:function(){return n.nil}}),Object.defineProperty(e,"getProperty",{enumerable:!0,get:function(){return n.getProperty}}),Object.defineProperty(e,"stringify",{enumerable:!0,get:function(){return n.stringify}}),Object.defineProperty(e,"regexpCode",{enumerable:!0,get:function(){return n.regexpCode}}),Object.defineProperty(e,"Name",{enumerable:!0,get:function(){return n.Name}});var o=un();Object.defineProperty(e,"Scope",{enumerable:!0,get:function(){return o.Scope}}),Object.defineProperty(e,"ValueScope",{enumerable:!0,get:function(){return o.ValueScope}}),Object.defineProperty(e,"ValueScopeName",{enumerable:!0,get:function(){return o.ValueScopeName}}),Object.defineProperty(e,"varKinds",{enumerable:!0,get:function(){return o.varKinds}}),e.operators={GT:new t._Code(">"),GTE:new t._Code(">="),LT:new t._Code("<"),LTE:new t._Code("<="),EQ:new t._Code("==="),NEQ:new t._Code("!=="),NOT:new t._Code("!"),OR:new t._Code("||"),AND:new t._Code("&&"),ADD:new t._Code("+")};class i{optimizeNodes(){return this}optimizeNames(b,P){return this}}class s extends i{constructor(b,P,x){super(),this.varKind=b,this.name=P,this.rhs=x}render({es5:b,_n:P}){const x=b?r.varKinds.var:this.varKind,B=this.rhs===void 0?"":` = ${this.rhs}`;return`${x} ${this.name}${B};`+P}optimizeNames(b,P){if(b[this.name.str])return this.rhs&&(this.rhs=z(this.rhs,b,P)),this}get names(){return this.rhs instanceof t._CodeOrName?this.rhs.names:{}}}class c extends i{constructor(b,P,x){super(),this.lhs=b,this.rhs=P,this.sideEffects=x}render({_n:b}){return`${this.lhs} = ${this.rhs};`+b}optimizeNames(b,P){if(!(this.lhs instanceof t.Name&&!b[this.lhs.str]&&!this.sideEffects))return this.rhs=z(this.rhs,b,P),this}get names(){const b=this.lhs instanceof t.Name?{}:{...this.lhs.names};return N(b,this.rhs)}}class l extends c{constructor(b,P,x,B){super(b,x,B),this.op=P}render({_n:b}){return`${this.lhs} ${this.op}= ${this.rhs};`+b}}class u extends i{constructor(b){super(),this.label=b,this.names={}}render({_n:b}){return`${this.label}:`+b}}class a extends i{constructor(b){super(),this.label=b,this.names={}}render({_n:b}){return`break${this.label?` ${this.label}`:""};`+b}}class f extends i{constructor(b){super(),this.error=b}render({_n:b}){return`throw ${this.error};`+b}get names(){return this.error.names}}class m extends i{constructor(b){super(),this.code=b}render({_n:b}){return`${this.code};`+b}optimizeNodes(){return`${this.code}`?this:void 0}optimizeNames(b,P){return this.code=z(this.code,b,P),this}get names(){return this.code instanceof t._CodeOrName?this.code.names:{}}}class y extends i{constructor(b=[]){super(),this.nodes=b}render(b){return this.nodes.reduce((P,x)=>P+x.render(b),"")}optimizeNodes(){const{nodes:b}=this;let P=b.length;for(;P--;){const x=b[P].optimizeNodes();Array.isArray(x)?b.splice(P,1,...x):x?b[P]=x:b.splice(P,1)}return b.length>0?this:void 0}optimizeNames(b,P){const{nodes:x}=this;let B=x.length;for(;B--;){const G=x[B];G.optimizeNames(b,P)||(ne(b,G.names),x.splice(B,1))}return x.length>0?this:void 0}get names(){return this.nodes.reduce((b,P)=>L(b,P.names),{})}}class $ extends y{render(b){return"{"+b._n+super.render(b)+"}"+b._n}}class S extends y{}class g extends ${}g.kind="else";class _ extends ${constructor(b,P){super(P),this.condition=b}render(b){let P=`if(${this.condition})`+super.render(b);return this.else&&(P+="else "+this.else.render(b)),P}optimizeNodes(){super.optimizeNodes();const b=this.condition;if(b===!0)return this.nodes;let P=this.else;if(P){const x=P.optimizeNodes();P=this.else=Array.isArray(x)?new g(x):x}if(P)return b===!1?P instanceof _?P:P.nodes:this.nodes.length?this:new _(fe(b),P instanceof _?[P]:P.nodes);if(!(b===!1||!this.nodes.length))return this}optimizeNames(b,P){var x;if(this.else=(x=this.else)===null||x===void 0?void 0:x.optimizeNames(b,P),!!(super.optimizeNames(b,P)||this.else))return this.condition=z(this.condition,b,P),this}get names(){const b=super.names;return N(b,this.condition),this.else&&L(b,this.else.names),b}}_.kind="if";class p extends ${}p.kind="for";class w extends p{constructor(b){super(),this.iteration=b}render(b){return`for(${this.iteration})`+super.render(b)}optimizeNames(b,P){if(super.optimizeNames(b,P))return this.iteration=z(this.iteration,b,P),this}get names(){return L(super.names,this.iteration.names)}}class E extends p{constructor(b,P,x,B){super(),this.varKind=b,this.name=P,this.from=x,this.to=B}render(b){const P=b.es5?r.varKinds.var:this.varKind,{name:x,from:B,to:G}=this;return`for(${P} ${x}=${B}; ${x}<${G}; ${x}++)`+super.render(b)}get names(){const b=N(super.names,this.from);return N(b,this.to)}}class d extends p{constructor(b,P,x,B){super(),this.loop=b,this.varKind=P,this.name=x,this.iterable=B}render(b){return`for(${this.varKind} ${this.name} ${this.loop} ${this.iterable})`+super.render(b)}optimizeNames(b,P){if(super.optimizeNames(b,P))return this.iterable=z(this.iterable,b,P),this}get names(){return L(super.names,this.iterable.names)}}class h extends ${constructor(b,P,x){super(),this.name=b,this.args=P,this.async=x}render(b){return`${this.async?"async ":""}function ${this.name}(${this.args})`+super.render(b)}}h.kind="func";class v extends y{render(b){return"return "+super.render(b)}}v.kind="return";class I extends ${render(b){let P="try"+super.render(b);return this.catch&&(P+=this.catch.render(b)),this.finally&&(P+=this.finally.render(b)),P}optimizeNodes(){var b,P;return super.optimizeNodes(),(b=this.catch)===null||b===void 0||b.optimizeNodes(),(P=this.finally)===null||P===void 0||P.optimizeNodes(),this}optimizeNames(b,P){var x,B;return super.optimizeNames(b,P),(x=this.catch)===null||x===void 0||x.optimizeNames(b,P),(B=this.finally)===null||B===void 0||B.optimizeNames(b,P),this}get names(){const b=super.names;return this.catch&&L(b,this.catch.names),this.finally&&L(b,this.finally.names),b}}class O extends ${constructor(b){super(),this.error=b}render(b){return`catch(${this.error})`+super.render(b)}}O.kind="catch";class A extends ${render(b){return"finally"+super.render(b)}}A.kind="finally";class M{constructor(b,P={}){this._values={},this._blockStarts=[],this._constants={},this.opts={...P,_n:P.lines?` -`:""},this._extScope=b,this._scope=new r.Scope({parent:b}),this._nodes=[new S]}toString(){return this._root.render(this.opts)}name(b){return this._scope.name(b)}scopeName(b){return this._extScope.name(b)}scopeValue(b,P){const x=this._extScope.value(b,P);return(this._values[x.prefix]||(this._values[x.prefix]=new Set)).add(x),x}getScopeValue(b,P){return this._extScope.getValue(b,P)}scopeRefs(b){return this._extScope.scopeRefs(b,this._values)}scopeCode(){return this._extScope.scopeCode(this._values)}_def(b,P,x,B){const G=this._scope.toName(P);return x!==void 0&&B&&(this._constants[G.str]=x),this._leafNode(new s(b,G,x)),G}const(b,P,x){return this._def(r.varKinds.const,b,P,x)}let(b,P,x){return this._def(r.varKinds.let,b,P,x)}var(b,P,x){return this._def(r.varKinds.var,b,P,x)}assign(b,P,x){return this._leafNode(new c(b,P,x))}add(b,P){return this._leafNode(new l(b,e.operators.ADD,P))}code(b){return typeof b=="function"?b():b!==t.nil&&this._leafNode(new m(b)),this}object(...b){const P=["{"];for(const[x,B]of b)P.length>1&&P.push(","),P.push(x),(x!==B||this.opts.es5)&&(P.push(":"),(0,t.addCodeArg)(P,B));return P.push("}"),new t._Code(P)}if(b,P,x){if(this._blockNode(new _(b)),P&&x)this.code(P).else().code(x).endIf();else if(P)this.code(P).endIf();else if(x)throw new Error('CodeGen: "else" body without "then" body');return this}elseIf(b){return this._elseNode(new _(b))}else(){return this._elseNode(new g)}endIf(){return this._endBlockNode(_,g)}_for(b,P){return this._blockNode(b),P&&this.code(P).endFor(),this}for(b,P){return this._for(new w(b),P)}forRange(b,P,x,B,G=this.opts.es5?r.varKinds.var:r.varKinds.let){const ie=this._scope.toName(b);return this._for(new E(G,ie,P,x),()=>B(ie))}forOf(b,P,x,B=r.varKinds.const){const G=this._scope.toName(b);if(this.opts.es5){const ie=P instanceof t.Name?P:this.var("_arr",P);return this.forRange("_i",0,(0,t._)`${ie}.length`,ee=>{this.var(G,(0,t._)`${ie}[${ee}]`),x(G)})}return this._for(new d("of",B,G,P),()=>x(G))}forIn(b,P,x,B=this.opts.es5?r.varKinds.var:r.varKinds.const){if(this.opts.ownProperties)return this.forOf(b,(0,t._)`Object.keys(${P})`,x);const G=this._scope.toName(b);return this._for(new d("in",B,G,P),()=>x(G))}endFor(){return this._endBlockNode(p)}label(b){return this._leafNode(new u(b))}break(b){return this._leafNode(new a(b))}return(b){const P=new v;if(this._blockNode(P),this.code(b),P.nodes.length!==1)throw new Error('CodeGen: "return" should have one node');return this._endBlockNode(v)}try(b,P,x){if(!P&&!x)throw new Error('CodeGen: "try" without "catch" and "finally"');const B=new I;if(this._blockNode(B),this.code(b),P){const G=this.name("e");this._currNode=B.catch=new O(G),P(G)}return x&&(this._currNode=B.finally=new A,this.code(x)),this._endBlockNode(O,A)}throw(b){return this._leafNode(new f(b))}block(b,P){return this._blockStarts.push(this._nodes.length),b&&this.code(b).endBlock(P),this}endBlock(b){const P=this._blockStarts.pop();if(P===void 0)throw new Error("CodeGen: not in self-balancing block");const x=this._nodes.length-P;if(x<0||b!==void 0&&x!==b)throw new Error(`CodeGen: wrong number of nodes: ${x} vs ${b} expected`);return this._nodes.length=P,this}func(b,P=t.nil,x,B){return this._blockNode(new h(b,P,x)),B&&this.code(B).endFunc(),this}endFunc(){return this._endBlockNode(h)}optimize(b=1){for(;b-- >0;)this._root.optimizeNodes(),this._root.optimizeNames(this._root.names,this._constants)}_leafNode(b){return this._currNode.nodes.push(b),this}_blockNode(b){this._currNode.nodes.push(b),this._nodes.push(b)}_endBlockNode(b,P){const x=this._currNode;if(x instanceof b||P&&x instanceof P)return this._nodes.pop(),this;throw new Error(`CodeGen: not in block "${P?`${b.kind}/${P.kind}`:b.kind}"`)}_elseNode(b){const P=this._currNode;if(!(P instanceof _))throw new Error('CodeGen: "else" without "if"');return this._currNode=P.else=b,this}get _root(){return this._nodes[0]}get _currNode(){const b=this._nodes;return b[b.length-1]}set _currNode(b){const P=this._nodes;P[P.length-1]=b}}e.CodeGen=M;function L(j,b){for(const P in b)j[P]=(j[P]||0)+(b[P]||0);return j}function N(j,b){return b instanceof t._CodeOrName?L(j,b.names):j}function z(j,b,P){if(j instanceof t.Name)return x(j);if(!B(j))return j;return new t._Code(j._items.reduce((G,ie)=>(ie instanceof t.Name&&(ie=x(ie)),ie instanceof t._Code?G.push(...ie._items):G.push(ie),G),[]));function x(G){const ie=P[G.str];return ie===void 0||b[G.str]!==1?G:(delete b[G.str],ie)}function B(G){return G instanceof t._Code&&G._items.some(ie=>ie instanceof t.Name&&b[ie.str]===1&&P[ie.str]!==void 0)}}function ne(j,b){for(const P in b)j[P]=(j[P]||0)-(b[P]||0)}function fe(j){return typeof j=="boolean"||typeof j=="number"||j===null?!j:(0,t._)`!${F(j)}`}e.not=fe;const le=k(e.operators.AND);function X(...j){return j.reduce(le)}e.and=X;const we=k(e.operators.OR);function U(...j){return j.reduce(we)}e.or=U;function k(j){return(b,P)=>b===t.nil?P:P===t.nil?b:(0,t._)`${F(b)} ${j} ${F(P)}`}function F(j){return j instanceof t.Name?j:(0,t._)`(${j})`}})(Er)),Er}var Y={},dn;function Z(){if(dn)return Y;dn=1,Object.defineProperty(Y,"__esModule",{value:!0}),Y.checkStrictMode=Y.getErrorPath=Y.Type=Y.useFunc=Y.setEvaluated=Y.evaluatedPropsToName=Y.mergeEvaluated=Y.eachItem=Y.unescapeJsonPointer=Y.escapeJsonPointer=Y.escapeFragment=Y.unescapeFragment=Y.schemaRefOrVal=Y.schemaHasRulesButRef=Y.schemaHasRules=Y.checkUnknownRules=Y.alwaysValidSchema=Y.toHash=void 0;const e=W(),t=lr();function r(d){const h={};for(const v of d)h[v]=!0;return h}Y.toHash=r;function n(d,h){return typeof h=="boolean"?h:Object.keys(h).length===0?!0:(o(d,h),!i(h,d.self.RULES.all))}Y.alwaysValidSchema=n;function o(d,h=d.schema){const{opts:v,self:I}=d;if(!v.strictSchema||typeof h=="boolean")return;const O=I.RULES.keywords;for(const A in h)O[A]||E(d,`unknown keyword: "${A}"`)}Y.checkUnknownRules=o;function i(d,h){if(typeof d=="boolean")return!d;for(const v in d)if(h[v])return!0;return!1}Y.schemaHasRules=i;function s(d,h){if(typeof d=="boolean")return!d;for(const v in d)if(v!=="$ref"&&h.all[v])return!0;return!1}Y.schemaHasRulesButRef=s;function c({topSchemaRef:d,schemaPath:h},v,I,O){if(!O){if(typeof v=="number"||typeof v=="boolean")return v;if(typeof v=="string")return(0,e._)`${v}`}return(0,e._)`${d}${h}${(0,e.getProperty)(I)}`}Y.schemaRefOrVal=c;function l(d){return f(decodeURIComponent(d))}Y.unescapeFragment=l;function u(d){return encodeURIComponent(a(d))}Y.escapeFragment=u;function a(d){return typeof d=="number"?`${d}`:d.replace(/~/g,"~0").replace(/\//g,"~1")}Y.escapeJsonPointer=a;function f(d){return d.replace(/~1/g,"/").replace(/~0/g,"~")}Y.unescapeJsonPointer=f;function m(d,h){if(Array.isArray(d))for(const v of d)h(v);else h(d)}Y.eachItem=m;function y({mergeNames:d,mergeToName:h,mergeValues:v,resultToName:I}){return(O,A,M,L)=>{const N=M===void 0?A:M instanceof e.Name?(A instanceof e.Name?d(O,A,M):h(O,A,M),M):A instanceof e.Name?(h(O,M,A),A):v(A,M);return L===e.Name&&!(N instanceof e.Name)?I(O,N):N}}Y.mergeEvaluated={props:y({mergeNames:(d,h,v)=>d.if((0,e._)`${v} !== true && ${h} !== undefined`,()=>{d.if((0,e._)`${h} === true`,()=>d.assign(v,!0),()=>d.assign(v,(0,e._)`${v} || {}`).code((0,e._)`Object.assign(${v}, ${h})`))}),mergeToName:(d,h,v)=>d.if((0,e._)`${v} !== true`,()=>{h===!0?d.assign(v,!0):(d.assign(v,(0,e._)`${v} || {}`),S(d,v,h))}),mergeValues:(d,h)=>d===!0?!0:{...d,...h},resultToName:$}),items:y({mergeNames:(d,h,v)=>d.if((0,e._)`${v} !== true && ${h} !== undefined`,()=>d.assign(v,(0,e._)`${h} === true ? true : ${v} > ${h} ? ${v} : ${h}`)),mergeToName:(d,h,v)=>d.if((0,e._)`${v} !== true`,()=>d.assign(v,h===!0?!0:(0,e._)`${v} > ${h} ? ${v} : ${h}`)),mergeValues:(d,h)=>d===!0?!0:Math.max(d,h),resultToName:(d,h)=>d.var("items",h)})};function $(d,h){if(h===!0)return d.var("props",!0);const v=d.var("props",(0,e._)`{}`);return h!==void 0&&S(d,v,h),v}Y.evaluatedPropsToName=$;function S(d,h,v){Object.keys(v).forEach(I=>d.assign((0,e._)`${h}${(0,e.getProperty)(I)}`,!0))}Y.setEvaluated=S;const g={};function _(d,h){return d.scopeValue("func",{ref:h,code:g[h.code]||(g[h.code]=new t._Code(h.code))})}Y.useFunc=_;var p;(function(d){d[d.Num=0]="Num",d[d.Str=1]="Str"})(p||(Y.Type=p={}));function w(d,h,v){if(d instanceof e.Name){const I=h===p.Num;return v?I?(0,e._)`"[" + ${d} + "]"`:(0,e._)`"['" + ${d} + "']"`:I?(0,e._)`"/" + ${d}`:(0,e._)`"/" + ${d}.replace(/~/g, "~0").replace(/\\//g, "~1")`}return v?(0,e.getProperty)(d).toString():"/"+a(d)}Y.getErrorPath=w;function E(d,h,v=d.opts.strictSchema){if(v){if(h=`strict mode: ${h}`,v===!0)throw new Error(h);d.self.logger.warn(h)}}return Y.checkStrictMode=E,Y}var ut={},fn;function Ce(){if(fn)return ut;fn=1,Object.defineProperty(ut,"__esModule",{value:!0});const e=W(),t={data:new e.Name("data"),valCxt:new e.Name("valCxt"),instancePath:new e.Name("instancePath"),parentData:new e.Name("parentData"),parentDataProperty:new e.Name("parentDataProperty"),rootData:new e.Name("rootData"),dynamicAnchors:new e.Name("dynamicAnchors"),vErrors:new e.Name("vErrors"),errors:new e.Name("errors"),this:new e.Name("this"),self:new e.Name("self"),scope:new e.Name("scope"),json:new e.Name("json"),jsonPos:new e.Name("jsonPos"),jsonLen:new e.Name("jsonLen"),jsonPart:new e.Name("jsonPart")};return ut.default=t,ut}var mn;function fr(){return mn||(mn=1,(function(e){Object.defineProperty(e,"__esModule",{value:!0}),e.extendErrors=e.resetErrorsCount=e.reportExtraError=e.reportError=e.keyword$DataError=e.keywordError=void 0;const t=W(),r=Z(),n=Ce();e.keywordError={message:({keyword:g})=>(0,t.str)`must pass "${g}" keyword validation`},e.keyword$DataError={message:({keyword:g,schemaType:_})=>_?(0,t.str)`"${g}" keyword must be ${_} ($data)`:(0,t.str)`"${g}" keyword is invalid ($data)`};function o(g,_=e.keywordError,p,w){const{it:E}=g,{gen:d,compositeRule:h,allErrors:v}=E,I=f(g,_,p);w??(h||v)?l(d,I):u(E,(0,t._)`[${I}]`)}e.reportError=o;function i(g,_=e.keywordError,p){const{it:w}=g,{gen:E,compositeRule:d,allErrors:h}=w,v=f(g,_,p);l(E,v),d||h||u(w,n.default.vErrors)}e.reportExtraError=i;function s(g,_){g.assign(n.default.errors,_),g.if((0,t._)`${n.default.vErrors} !== null`,()=>g.if(_,()=>g.assign((0,t._)`${n.default.vErrors}.length`,_),()=>g.assign(n.default.vErrors,null)))}e.resetErrorsCount=s;function c({gen:g,keyword:_,schemaValue:p,data:w,errsCount:E,it:d}){if(E===void 0)throw new Error("ajv implementation error");const h=g.name("err");g.forRange("i",E,n.default.errors,v=>{g.const(h,(0,t._)`${n.default.vErrors}[${v}]`),g.if((0,t._)`${h}.instancePath === undefined`,()=>g.assign((0,t._)`${h}.instancePath`,(0,t.strConcat)(n.default.instancePath,d.errorPath))),g.assign((0,t._)`${h}.schemaPath`,(0,t.str)`${d.errSchemaPath}/${_}`),d.opts.verbose&&(g.assign((0,t._)`${h}.schema`,p),g.assign((0,t._)`${h}.data`,w))})}e.extendErrors=c;function l(g,_){const p=g.const("err",_);g.if((0,t._)`${n.default.vErrors} === null`,()=>g.assign(n.default.vErrors,(0,t._)`[${p}]`),(0,t._)`${n.default.vErrors}.push(${p})`),g.code((0,t._)`${n.default.errors}++`)}function u(g,_){const{gen:p,validateName:w,schemaEnv:E}=g;E.$async?p.throw((0,t._)`new ${g.ValidationError}(${_})`):(p.assign((0,t._)`${w}.errors`,_),p.return(!1))}const a={keyword:new t.Name("keyword"),schemaPath:new t.Name("schemaPath"),params:new t.Name("params"),propertyName:new t.Name("propertyName"),message:new t.Name("message"),schema:new t.Name("schema"),parentSchema:new t.Name("parentSchema")};function f(g,_,p){const{createErrors:w}=g.it;return w===!1?(0,t._)`{}`:m(g,_,p)}function m(g,_,p={}){const{gen:w,it:E}=g,d=[y(E,p),$(g,p)];return S(g,_,d),w.object(...d)}function y({errorPath:g},{instancePath:_}){const p=_?(0,t.str)`${g}${(0,r.getErrorPath)(_,r.Type.Str)}`:g;return[n.default.instancePath,(0,t.strConcat)(n.default.instancePath,p)]}function $({keyword:g,it:{errSchemaPath:_}},{schemaPath:p,parentSchema:w}){let E=w?_:(0,t.str)`${_}/${g}`;return p&&(E=(0,t.str)`${E}${(0,r.getErrorPath)(p,r.Type.Str)}`),[a.schemaPath,E]}function S(g,{params:_,message:p},w){const{keyword:E,data:d,schemaValue:h,it:v}=g,{opts:I,propertyName:O,topSchemaRef:A,schemaPath:M}=v;w.push([a.keyword,E],[a.params,typeof _=="function"?_(g):_||(0,t._)`{}`]),I.messages&&w.push([a.message,typeof p=="function"?p(g):p]),I.verbose&&w.push([a.schema,h],[a.parentSchema,(0,t._)`${A}${M}`],[n.default.data,d]),O&&w.push([a.propertyName,O])}})(Sr)),Sr}var pn;function uo(){if(pn)return Fe;pn=1,Object.defineProperty(Fe,"__esModule",{value:!0}),Fe.boolOrEmptySchema=Fe.topBoolOrEmptySchema=void 0;const e=fr(),t=W(),r=Ce(),n={message:"boolean schema is false"};function o(c){const{gen:l,schema:u,validateName:a}=c;u===!1?s(c,!1):typeof u=="object"&&u.$async===!0?l.return(r.default.data):(l.assign((0,t._)`${a}.errors`,null),l.return(!0))}Fe.topBoolOrEmptySchema=o;function i(c,l){const{gen:u,schema:a}=c;a===!1?(u.var(l,!1),s(c)):u.var(l,!0)}Fe.boolOrEmptySchema=i;function s(c,l){const{gen:u,data:a}=c,f={gen:u,keyword:"false schema",data:a,schema:!1,schemaCode:!1,schemaValue:!1,params:{},it:c};(0,e.reportError)(f,n,void 0,l)}return Fe}var ge={},Ue={},hn;function Xi(){if(hn)return Ue;hn=1,Object.defineProperty(Ue,"__esModule",{value:!0}),Ue.getRules=Ue.isJSONType=void 0;const e=["string","number","integer","boolean","null","object","array"],t=new Set(e);function r(o){return typeof o=="string"&&t.has(o)}Ue.isJSONType=r;function n(){const o={number:{type:"number",rules:[]},string:{type:"string",rules:[]},array:{type:"array",rules:[]},object:{type:"object",rules:[]}};return{types:{...o,integer:!0,boolean:!0,null:!0},rules:[{rules:[]},o.number,o.string,o.array,o.object],post:{rules:[]},all:{},keywords:{}}}return Ue.getRules=n,Ue}var Oe={},yn;function Yi(){if(yn)return Oe;yn=1,Object.defineProperty(Oe,"__esModule",{value:!0}),Oe.shouldUseRule=Oe.shouldUseGroup=Oe.schemaHasRulesForType=void 0;function e({schema:n,self:o},i){const s=o.RULES.types[i];return s&&s!==!0&&t(n,s)}Oe.schemaHasRulesForType=e;function t(n,o){return o.rules.some(i=>r(n,i))}Oe.shouldUseGroup=t;function r(n,o){var i;return n[o.keyword]!==void 0||((i=o.definition.implements)===null||i===void 0?void 0:i.some(s=>n[s]!==void 0))}return Oe.shouldUseRule=r,Oe}var gn;function dr(){if(gn)return ge;gn=1,Object.defineProperty(ge,"__esModule",{value:!0}),ge.reportTypeError=ge.checkDataTypes=ge.checkDataType=ge.coerceAndCheckDataType=ge.getJSONTypes=ge.getSchemaTypes=ge.DataType=void 0;const e=Xi(),t=Yi(),r=fr(),n=W(),o=Z();var i;(function(p){p[p.Correct=0]="Correct",p[p.Wrong=1]="Wrong"})(i||(ge.DataType=i={}));function s(p){const w=c(p.type);if(w.includes("null")){if(p.nullable===!1)throw new Error("type: null contradicts nullable: false")}else{if(!w.length&&p.nullable!==void 0)throw new Error('"nullable" cannot be used without "type"');p.nullable===!0&&w.push("null")}return w}ge.getSchemaTypes=s;function c(p){const w=Array.isArray(p)?p:p?[p]:[];if(w.every(e.isJSONType))return w;throw new Error("type must be JSONType or JSONType[]: "+w.join(","))}ge.getJSONTypes=c;function l(p,w){const{gen:E,data:d,opts:h}=p,v=a(w,h.coerceTypes),I=w.length>0&&!(v.length===0&&w.length===1&&(0,t.schemaHasRulesForType)(p,w[0]));if(I){const O=$(w,d,h.strictNumbers,i.Wrong);E.if(O,()=>{v.length?f(p,w,v):g(p)})}return I}ge.coerceAndCheckDataType=l;const u=new Set(["string","number","integer","boolean","null"]);function a(p,w){return w?p.filter(E=>u.has(E)||w==="array"&&E==="array"):[]}function f(p,w,E){const{gen:d,data:h,opts:v}=p,I=d.let("dataType",(0,n._)`typeof ${h}`),O=d.let("coerced",(0,n._)`undefined`);v.coerceTypes==="array"&&d.if((0,n._)`${I} == 'object' && Array.isArray(${h}) && ${h}.length == 1`,()=>d.assign(h,(0,n._)`${h}[0]`).assign(I,(0,n._)`typeof ${h}`).if($(w,h,v.strictNumbers),()=>d.assign(O,h))),d.if((0,n._)`${O} !== undefined`);for(const M of E)(u.has(M)||M==="array"&&v.coerceTypes==="array")&&A(M);d.else(),g(p),d.endIf(),d.if((0,n._)`${O} !== undefined`,()=>{d.assign(h,O),m(p,O)});function A(M){switch(M){case"string":d.elseIf((0,n._)`${I} == "number" || ${I} == "boolean"`).assign(O,(0,n._)`"" + ${h}`).elseIf((0,n._)`${h} === null`).assign(O,(0,n._)`""`);return;case"number":d.elseIf((0,n._)`${I} == "boolean" || ${h} === null +}`,Hi=new Set(["gamecult.fields.splats.v1","gamecult.fields.gravity.v1","gamecult.fields.objects.v1"]),Oa={pluginId:"fields.surface",capabilities:["field.surface2d","gravity.surface","field.scalar","field.vector","field.objects"],componentKinds:["field.surface2d","gravity.surface"],schemas:[...Hi],normalizeDocument:qr,renderComponent:Ma};function Ma(e,t,r,n,o,i){const s=document.createElement("canvas");s.className="cultui-gravity-surface",e.id&&(s.id=e.id),s.setAttribute("role","img"),s.setAttribute("aria-label",ao(t.label,"gravity surface")),s.style.display="block",s.style.width="100%",s.style.height="100%",s.style.pointerEvents="none",i.applyGeneratedLayout(s,r,n);let c=!1;const l={},u=()=>La(s,t,l,i.resolveAssetUrl),a=()=>{!s.isConnected||c||(c=!0,requestAnimationFrame(()=>{c=!1,s.isConnected&&u()}))};s.addEventListener("cultui:asset-loaded",a);let f=0,m;const y=()=>{f&&window.clearInterval(f),m?.disconnect(),s.removeEventListener("cultui:asset-loaded",a)},$=()=>{if(!s.isConnected){y();return}qa(e,t,o,i.providerId,l).then(g=>{g&&s.isConnected&&a()}).catch(g=>{l.lastError=g instanceof Error?g.message:String(g)})};typeof ResizeObserver<"u"&&(m=new ResizeObserver(a),m.observe(s)),a();const S=Math.max(33,Math.min(1e3,oo(t.stateRefreshMs,100)));return f=window.setInterval($,S),queueMicrotask($),window.setTimeout(a,300),window.setTimeout(a,1e3),s}async function qa(e,t,r,n,o){if(o.loading)return!1;const i=[wr(e,t,"renderSplats","renderSplatsDocumentId","renderSplatsSchemaId"),wr(e,t,"gravity","gravityDocumentId","gravitySchemaId"),wr(e,t,"objects","objectsDocumentId","objectsSchemaId")].filter(s=>!!s?.documentId);if(i.length===0)return!1;o.loading=!0;try{let s=!1;for(const c of i){const l=await r.documentResolver?.(c,e);let u=lr(qr(l?.schemaId||c.schemaId,l?.document));if(Object.keys(u).length===0&&(u=lr(qr(c.schemaId,await xa(c,n||r.provider?.providerId)))),Object.keys(u).length===0)continue;const a=c.slotId==="renderSplats"?"renderSplats":c.slotId==="gravity"?"gravity":"objects",f=Lr(o[a]?.frameId,-1),m=Lr(u.frameId,f);o[a]=u,s||=m!==f}return o.lastLoadedAt=Date.now(),s}finally{o.loading=!1}}async function xa(e,t){if(typeof fetch!="function"||typeof window>"u"||!t)return;const r=new URLSearchParams({documentId:e.documentId});e.schemaId&&r.set("schemaId",e.schemaId),e.slotId&&r.set("slotId",e.slotId);const n=await fetch(`/eir/document/${encodeURIComponent(t)}?${r.toString()}`,{cache:"no-store",headers:{Accept:"application/json"}});if(n.ok)return lr(await n.json()).document}function wr(e,t,r,n,o){const i=(e.embeddedDocuments||[]).find(c=>String(c?.slotId||"")===r),s=ue(t[n],i?.documentId);if(s)return{documentId:s,schemaId:ue(t[o],i?.schemaId),presentationKind:ue(i?.presentationKind)||"data",slotId:r}}function qr(e,t){const r=Array.isArray(t)?t:void 0,n=r?r[0]:t?.schema,o=String(e||n||"");return!r||!Hi.has(o)?t:o==="gamecult.fields.splats.v1"?Ya(r):o==="gamecult.fields.gravity.v1"?Ja(r):Qa(r)}function La(e,t,r,n){const o=e.getBoundingClientRect(),i=Math.max(1,Math.floor(o.width||e.clientWidth||1)),s=Math.max(1,Math.floor(o.height||e.clientHeight||1)),c=Math.max(1,Math.min(2,window.devicePixelRatio||1)),l=Math.max(1,Math.floor(i*c)),u=Math.max(1,Math.floor(s*c));(e.width!==l||e.height!==u)&&(e.width=l,e.height=u);const a=e.getContext("2d");if(!a)return;a.setTransform(c,0,0,c,0,0),a.clearRect(0,0,i,s);const f=Xa(Wa(t),i,s),m=Xi(r?.gravity),y=Ha(r?.gravity)||Ka(ue(t.bodies,"")),$=Ga(r?.objects)||Ba(ue(t.objects,""));_a(a,t,m,y,f,i,s,r?.renderSplats)||Da(a,t,i,s,"field.surface2d requires WebGL2 float render targets"),Fa(a,y,t,f,i,s,n),za(a,$,t,f,i,s,n)}function Da(e,t,r,n,o){e.save(),e.fillStyle=ue(t.failureBackground,"rgba(0, 0, 0, 0.72)"),e.fillRect(0,0,r,n),e.font=ue(t.failureFont,"700 13px Cascadia Mono, Consolas, monospace"),e.fillStyle=ue(t.failureColor,"rgba(255, 184, 79, 0.95)"),e.fillText(o,16,28),e.restore()}function Fa(e,t,r,n,o,i,s){for(const c of t){const l=Wi(n,c.x,c.y,o,i),u=Math.max(18,Math.min(190,c.radius/Math.max(1,n.maxX-n.minX)*o*.32)),a=s(c.icon),f=c.kind.toLowerCase().includes("sun")?Math.max(oe(r.sunIconMinPx,34),u*oe(r.sunIconScale,.72)):Math.max(oe(r.bodyIconMinPx,24),u*oe(r.bodyIconScale,.48)),m=c.iconSize>0?c.iconSize:f;a&&Ua(e,a,l.x,l.y,m,.92),c.key&&Gi(e,r,c.key.replace(/^local\./,""),l.x+u*.44,l.y-u*.48,ue(r.bodyLabelColor,"rgba(226, 244, 255, 0.82)"))}}const ur=new Map;function Ua(e,t,r,n,o,i){let s=ur.get(t);s||(s=new Image,s.decoding="async",s.onload=()=>requestAnimationFrame(()=>{e.canvas.dispatchEvent(new CustomEvent("cultui:asset-loaded"))}),s.src=t,ur.set(t,s)),!(!s.complete||s.naturalWidth===0)&&(e.save(),e.globalAlpha=i,e.drawImage(s,r-o/2,n-o/2,o,o),e.restore())}function za(e,t,r,n,o,i,s){for(const c of t){const l=Wi(n,c.x,c.y,o,i);if(l.x<-40||l.x>o+40||l.y<-40||l.y>i+40)continue;const u=c.kind.toLowerCase().includes("station")?oe(r.stationIconSizePx,34):c.controlled?oe(r.shipIconSizePx,22):oe(r.remoteShipIconSizePx,18),a=Va(r,c.faction,c.controlled,c.visibility),f=s(c.icon);e.save(),e.globalAlpha=Math.max(.25,Math.min(1,c.visibility)),e.translate(l.x,l.y);const m=Math.atan2(c.directionY,c.directionX)+Math.PI/2;if(c.kind.toLowerCase().includes("ship")&&e.rotate(m),f){const y=ur.get(f);if(y)y.complete&&y.naturalWidth>0&&e.drawImage(y,-u/2,-u/2,u,u);else{const $=new Image;$.decoding="async",$.onload=()=>e.canvas.dispatchEvent(new CustomEvent("cultui:asset-loaded")),$.src=f,ur.set(f,$)}}e.restore(),Gi(e,r,c.label,l.x+u*.55,l.y-u*.45,a)}}function Gi(e,t,r,n,o,i){r&&(e.save(),e.font=ue(t.objectLabelFont,"700 12px Ubuntu, system-ui, sans-serif"),e.textBaseline="middle",e.lineWidth=oe(t.objectLabelStrokeWidth,3),e.strokeStyle=ue(t.objectLabelStroke,"rgba(0, 0, 0, 0.72)"),e.fillStyle=i,e.strokeText(r,n,o),e.fillText(r,n,o),e.restore())}function Va(e,t,r,n){const o=Math.max(.25,Math.min(1,n));if(r)return st(ue(e.objectControlledColor,"rgba(122, 240, 255, {alpha})"),o);const i=t.toLowerCase();return i.includes("raider")?st(ue(e.objectRaiderColor,"rgba(255, 143, 74, {alpha})"),o):i.includes("neutral")?st(ue(e.objectNeutralColor,"rgba(232, 232, 224, {alpha})"),o):st(ue(e.objectDefaultColor,"rgba(214, 244, 255, {alpha})"),o)}function st(e,t){return e.replaceAll("{alpha}",String(t))}function Ka(e){return e.split(";").map(t=>t.trim()).filter(Boolean).map(t=>{const r=t.split("|");return{key:r[0]??"",kind:r[1]??"",x:Number(r[2])||0,y:Number(r[3])||0,radius:Math.max(1,Number(r[4])||1),depth:Number(r[5])||0,exponent:Number(r[6])||1,waveRadius:Number(r[7])||0,waveDepth:Number(r[8])||0,waveSpeed:Number(r[9])||0,icon:r[10]??"",iconSize:Number(r[12])||0,tint:r[11]??""}})}function Ba(e){return e.split(";").map(t=>t.trim()).filter(Boolean).map(t=>{const r=t.split("|");return{key:r[0]??"",kind:r[1]??"",label:r[2]??"",x:Number(r[3])||0,y:Number(r[4])||0,directionX:Number(r[5])||0,directionY:Number(r[6])||1,faction:r[7]??"",controlled:r[8]==="1"||r[8]==="true",visibility:Number(r[9])||1,icon:r[10]??""}})}function Ha(e){const t=Array.isArray(e?.gravityInfluences)?e.gravityInfluences:[],r=Array.isArray(e?.bodies)?e.bodies:[];if(t.length===0&&r.length===0)return;const n=new Map;for(const o of r){const i=ue(o.bodyKey,o.name,"");i&&n.set(i,o)}return(t.length>0?t:r).map(o=>{const i=ue(o.bodyKey,o.name,"body"),s=n.get(i),c=ue(o.kind,"Body");return{key:i,kind:c,x:oe(o.x,0),y:oe(o.y,0),radius:Math.max(1,oe(o.radius,80)),depth:oe(o.gravityDepth,0),exponent:oe(o.gravityDepthExponent,1),waveRadius:oe(o.waveRadius,0),waveDepth:oe(o.waveDepth,0),waveSpeed:oe(o.waveSpeed,0),icon:xr(o.iconAsset)||xr(s?.iconAsset),iconSize:oe(s?.iconSize,oe(o.iconSize,0)),tint:""}})}function Ga(e){const t=Array.isArray(e?.objects)?e.objects:[];if(t.length!==0)return t.map(r=>{const n=ue(r.kind,"object");return{key:ue(r.entityKey,String(r.entityIndex??""),"object"),kind:n,label:ue(r.displayName,r.entityKey,"object"),x:oe(r.x,0),y:oe(r.y,0),directionX:oe(r.directionX,1),directionY:oe(r.directionY,0),faction:ue(r.factionKey,""),controlled:so(r.controlled),visibility:oe(r.visibility,1),icon:xr(r.iconAsset)}})}function xr(e){const t=Xi(e);return ue(t.uri,"")}function Wa(e){const t=Math.max(1,oe(e.viewRadius,Math.max(1200,oe(e.terrainRadius,1200))));return{minX:oe(e.minX,-t),minY:oe(e.minY,-t),maxX:oe(e.maxX,t),maxY:oe(e.maxY,t)}}function Xa(e,t,r){const n=Math.max(1e-4,e.maxX-e.minX),o=Math.max(1e-4,e.maxY-e.minY),i=Math.max(1e-4,t/Math.max(1,r)),s=n/o,c=(e.minX+e.maxX)*.5,l=(e.minY+e.maxY)*.5;if(i>s){const a=o*i;return{minX:c-a*.5,maxX:c+a*.5,minY:e.minY,maxY:e.maxY}}const u=n/i;return{minX:e.minX,maxX:e.maxX,minY:l-u*.5,maxY:l+u*.5}}function Wi(e,t,r,n,o){return{x:(t-e.minX)/Math.max(1,e.maxX-e.minX)*n,y:(r-e.minY)/Math.max(1,e.maxY-e.minY)*o}}function Ya(e){const t=$e(e[9]);return{schema:e[0],frameId:e[1],publishedAtUtc:e[2],simulationTimeSeconds:e[3],runId:e[4],zoneIndex:e[5],zoneName:e[6],viewport:Vr(e[7]),layers:$e(e[8]).map(Za),splats:{count:t[0]??0,centerX:t[1]||[],centerY:t[2]||[],halfExtentX:t[3]||[],halfExtentY:t[4]||[],rotationCos:t[5]||[],rotationSin:t[6]||[],channel:t[7]||[],falloff:t[8]||[],valueR:t[9]||[],valueG:t[10]||[],valueB:t[11]||[],valueA:t[12]||[],sourceKey:t[13]||[],layerIndex:t[14]||[],sourceKind:t[15]||[],frequencyX:t[16]||[],frequencyY:t[17]||[],phaseX:t[18]||[],phaseY:t[19]||[],animationSpeed:t[20]||[],sourceFlags:t[21]||[]}}}function Ja(e){return{schema:e[0],frameId:e[1],publishedAtUtc:e[2],simulationTimeSeconds:e[3],runId:e[4],zoneIndex:e[5],zoneName:e[6],viewport:Vr(e[7]),gravityInfluences:$e(e[8]).map(eo),bodies:$e(e[9]).map(to),terrainRadius:e[10],terrainDepth:e[11],terrainDepthExponent:e[12],terrainWaveFrequency:e[13]}}function Qa(e){return{schema:e[0],frameId:e[1],publishedAtUtc:e[2],simulationTimeSeconds:e[3],runId:e[4],zoneIndex:e[5],zoneName:e[6],currentEntityKey:e[7],viewport:Vr(e[8]),controlledEntityIndices:$e(e[9]),objects:$e(e[10]).map(ro)}}function Vr(e){const t=$e(e);return t.length?{minX:t[0],minY:t[1],maxX:t[2],maxY:t[3]}:e}function Za(e){const t=$e(e);return t.length?{layerKey:t[0],displayName:t[1],channel:t[2],blendMode:t[3],graphicsFormat:t[4],clearBeforeDraw:t[5],clearR:t[6],clearG:t[7],clearB:t[8],clearA:t[9]}:e}function eo(e){const t=$e(e);return t.length?{bodyKey:t[0],orbitKey:t[1],kind:t[2],x:t[3],y:t[4],radius:t[5],gravityDepth:t[6],gravityDepthExponent:t[7],waveRadius:t[8],waveDepth:t[9],waveSpeed:t[10]}:e}function to(e){const t=$e(e);return t.length?{bodyKey:t[0],orbitKey:t[1],name:t[2],kind:t[3],x:t[4],y:t[5],radius:t[6],isAsteroidBelt:t[7],body:t[8],iconAsset:Kr(t[9])}:e}function ro(e){const t=$e(e);return t.length?{entityIndex:t[0],entityKey:t[1],displayName:t[2],kind:t[3],factionKey:t[4],x:t[5],y:t[6],z:t[7],directionX:t[8],directionY:t[9],velocityX:t[10],velocityY:t[11],controlled:t[12],targetEntityIndex:t[13],isActive:t[14],visibility:t[15],status:no(t[16]),inventory:$e(t[17]).map(io),iconAsset:Kr(t[18])}:e}function no(e){const t=$e(e);return t.length?{hull:t[0],shield:t[1],heat:t[2]}:e||{}}function io(e){const t=$e(e);return t.length?{source:t[0],itemKey:t[1],quantity:t[2],quality:t[3],durability:t[4],enabled:t[5],sourceIndex:t[6],x:t[7],y:t[8],iconAsset:Kr(t[9])}:e}function Kr(e){const t=$e(e);return t.length?{assetKey:t[0],kind:t[1],uri:t[2],transport:t[3],contentHash:t[4],mimeType:t[5],metadata:t[6]||{}}:e||{}}function $e(e){return Array.isArray(e)?e:[]}function lr(e){return e&&typeof e=="object"&&!Array.isArray(e)?e:{}}function ue(...e){for(const t of e)if(typeof t=="string"&&t.trim())return t.trim();return""}function ao(e,t){return typeof e=="string"&&e?e:t}function oo(e,t){const r=Number(e);return Number.isFinite(r)&&r>0?Math.floor(r):t}function Lr(e,t){const r=Number(e);return Number.isFinite(r)?r:t}const Xi=lr,oe=Lr;function so(e){return typeof e=="boolean"?e:typeof e=="number"?e!==0:typeof e=="string"&&["1","true","yes","on"].includes(e.trim().toLowerCase())}function co(e){return e&&e.__esModule&&Object.prototype.hasOwnProperty.call(e,"default")?e.default:e}var ct={exports:{}},Sr={},Te={},Fe={},Er={},Pr={},Ir={},cn;function dr(){return cn||(cn=1,(function(e){Object.defineProperty(e,"__esModule",{value:!0}),e.regexpCode=e.getEsmExportName=e.getProperty=e.safeStringify=e.stringify=e.strConcat=e.addCodeArg=e.str=e._=e.nil=e._Code=e.Name=e.IDENTIFIER=e._CodeOrName=void 0;class t{}e._CodeOrName=t,e.IDENTIFIER=/^[a-z$_][a-z$_0-9]*$/i;class r extends t{constructor(p){if(super(),!e.IDENTIFIER.test(p))throw new Error("CodeGen: name must be a valid identifier");this.str=p}toString(){return this.str}emptyStr(){return!1}get names(){return{[this.str]:1}}}e.Name=r;class n extends t{constructor(p){super(),this._items=typeof p=="string"?[p]:p}toString(){return this.str}emptyStr(){if(this._items.length>1)return!1;const p=this._items[0];return p===""||p==='""'}get str(){var p;return(p=this._str)!==null&&p!==void 0?p:this._str=this._items.reduce((w,E)=>`${w}${E}`,"")}get names(){var p;return(p=this._names)!==null&&p!==void 0?p:this._names=this._items.reduce((w,E)=>(E instanceof r&&(w[E.str]=(w[E.str]||0)+1),w),{})}}e._Code=n,e.nil=new n("");function o(_,...p){const w=[_[0]];let E=0;for(;E{if(f.scopePath===void 0)throw new Error(`CodeGen: name "${f}" has no value`);return(0,t._)`${u}${f.scopePath}`})}scopeCode(u=this._values,a,f){return this._reduceValues(u,m=>{if(m.value===void 0)throw new Error(`CodeGen: name "${m}" has no value`);return m.value.code},a,f)}_reduceValues(u,a,f={},m){let y=t.nil;for(const $ in u){const S=u[$];if(!S)continue;const g=f[$]=f[$]||new Map;S.forEach(_=>{if(g.has(_))return;g.set(_,n.Started);let p=a(_);if(p){const w=this.opts.es5?e.varKinds.var:e.varKinds.const;y=(0,t._)`${y}${w} ${_} = ${p};${this.opts._n}`}else if(p=m?.(_))y=(0,t._)`${y}${p}${this.opts._n}`;else throw new r(_);g.set(_,n.Completed)})}return y}}e.ValueScope=c})(Rr)),Rr}var dn;function W(){return dn||(dn=1,(function(e){Object.defineProperty(e,"__esModule",{value:!0}),e.or=e.and=e.not=e.CodeGen=e.operators=e.varKinds=e.ValueScopeName=e.ValueScope=e.Scope=e.Name=e.regexpCode=e.stringify=e.getProperty=e.nil=e.strConcat=e.str=e._=void 0;const t=dr(),r=ln();var n=dr();Object.defineProperty(e,"_",{enumerable:!0,get:function(){return n._}}),Object.defineProperty(e,"str",{enumerable:!0,get:function(){return n.str}}),Object.defineProperty(e,"strConcat",{enumerable:!0,get:function(){return n.strConcat}}),Object.defineProperty(e,"nil",{enumerable:!0,get:function(){return n.nil}}),Object.defineProperty(e,"getProperty",{enumerable:!0,get:function(){return n.getProperty}}),Object.defineProperty(e,"stringify",{enumerable:!0,get:function(){return n.stringify}}),Object.defineProperty(e,"regexpCode",{enumerable:!0,get:function(){return n.regexpCode}}),Object.defineProperty(e,"Name",{enumerable:!0,get:function(){return n.Name}});var o=ln();Object.defineProperty(e,"Scope",{enumerable:!0,get:function(){return o.Scope}}),Object.defineProperty(e,"ValueScope",{enumerable:!0,get:function(){return o.ValueScope}}),Object.defineProperty(e,"ValueScopeName",{enumerable:!0,get:function(){return o.ValueScopeName}}),Object.defineProperty(e,"varKinds",{enumerable:!0,get:function(){return o.varKinds}}),e.operators={GT:new t._Code(">"),GTE:new t._Code(">="),LT:new t._Code("<"),LTE:new t._Code("<="),EQ:new t._Code("==="),NEQ:new t._Code("!=="),NOT:new t._Code("!"),OR:new t._Code("||"),AND:new t._Code("&&"),ADD:new t._Code("+")};class i{optimizeNodes(){return this}optimizeNames(b,P){return this}}class s extends i{constructor(b,P,x){super(),this.varKind=b,this.name=P,this.rhs=x}render({es5:b,_n:P}){const x=b?r.varKinds.var:this.varKind,B=this.rhs===void 0?"":` = ${this.rhs}`;return`${x} ${this.name}${B};`+P}optimizeNames(b,P){if(b[this.name.str])return this.rhs&&(this.rhs=z(this.rhs,b,P)),this}get names(){return this.rhs instanceof t._CodeOrName?this.rhs.names:{}}}class c extends i{constructor(b,P,x){super(),this.lhs=b,this.rhs=P,this.sideEffects=x}render({_n:b}){return`${this.lhs} = ${this.rhs};`+b}optimizeNames(b,P){if(!(this.lhs instanceof t.Name&&!b[this.lhs.str]&&!this.sideEffects))return this.rhs=z(this.rhs,b,P),this}get names(){const b=this.lhs instanceof t.Name?{}:{...this.lhs.names};return N(b,this.rhs)}}class l extends c{constructor(b,P,x,B){super(b,x,B),this.op=P}render({_n:b}){return`${this.lhs} ${this.op}= ${this.rhs};`+b}}class u extends i{constructor(b){super(),this.label=b,this.names={}}render({_n:b}){return`${this.label}:`+b}}class a extends i{constructor(b){super(),this.label=b,this.names={}}render({_n:b}){return`break${this.label?` ${this.label}`:""};`+b}}class f extends i{constructor(b){super(),this.error=b}render({_n:b}){return`throw ${this.error};`+b}get names(){return this.error.names}}class m extends i{constructor(b){super(),this.code=b}render({_n:b}){return`${this.code};`+b}optimizeNodes(){return`${this.code}`?this:void 0}optimizeNames(b,P){return this.code=z(this.code,b,P),this}get names(){return this.code instanceof t._CodeOrName?this.code.names:{}}}class y extends i{constructor(b=[]){super(),this.nodes=b}render(b){return this.nodes.reduce((P,x)=>P+x.render(b),"")}optimizeNodes(){const{nodes:b}=this;let P=b.length;for(;P--;){const x=b[P].optimizeNodes();Array.isArray(x)?b.splice(P,1,...x):x?b[P]=x:b.splice(P,1)}return b.length>0?this:void 0}optimizeNames(b,P){const{nodes:x}=this;let B=x.length;for(;B--;){const G=x[B];G.optimizeNames(b,P)||(ne(b,G.names),x.splice(B,1))}return x.length>0?this:void 0}get names(){return this.nodes.reduce((b,P)=>L(b,P.names),{})}}class $ extends y{render(b){return"{"+b._n+super.render(b)+"}"+b._n}}class S extends y{}class g extends ${}g.kind="else";class _ extends ${constructor(b,P){super(P),this.condition=b}render(b){let P=`if(${this.condition})`+super.render(b);return this.else&&(P+="else "+this.else.render(b)),P}optimizeNodes(){super.optimizeNodes();const b=this.condition;if(b===!0)return this.nodes;let P=this.else;if(P){const x=P.optimizeNodes();P=this.else=Array.isArray(x)?new g(x):x}if(P)return b===!1?P instanceof _?P:P.nodes:this.nodes.length?this:new _(fe(b),P instanceof _?[P]:P.nodes);if(!(b===!1||!this.nodes.length))return this}optimizeNames(b,P){var x;if(this.else=(x=this.else)===null||x===void 0?void 0:x.optimizeNames(b,P),!!(super.optimizeNames(b,P)||this.else))return this.condition=z(this.condition,b,P),this}get names(){const b=super.names;return N(b,this.condition),this.else&&L(b,this.else.names),b}}_.kind="if";class p extends ${}p.kind="for";class w extends p{constructor(b){super(),this.iteration=b}render(b){return`for(${this.iteration})`+super.render(b)}optimizeNames(b,P){if(super.optimizeNames(b,P))return this.iteration=z(this.iteration,b,P),this}get names(){return L(super.names,this.iteration.names)}}class E extends p{constructor(b,P,x,B){super(),this.varKind=b,this.name=P,this.from=x,this.to=B}render(b){const P=b.es5?r.varKinds.var:this.varKind,{name:x,from:B,to:G}=this;return`for(${P} ${x}=${B}; ${x}<${G}; ${x}++)`+super.render(b)}get names(){const b=N(super.names,this.from);return N(b,this.to)}}class d extends p{constructor(b,P,x,B){super(),this.loop=b,this.varKind=P,this.name=x,this.iterable=B}render(b){return`for(${this.varKind} ${this.name} ${this.loop} ${this.iterable})`+super.render(b)}optimizeNames(b,P){if(super.optimizeNames(b,P))return this.iterable=z(this.iterable,b,P),this}get names(){return L(super.names,this.iterable.names)}}class h extends ${constructor(b,P,x){super(),this.name=b,this.args=P,this.async=x}render(b){return`${this.async?"async ":""}function ${this.name}(${this.args})`+super.render(b)}}h.kind="func";class v extends y{render(b){return"return "+super.render(b)}}v.kind="return";class I extends ${render(b){let P="try"+super.render(b);return this.catch&&(P+=this.catch.render(b)),this.finally&&(P+=this.finally.render(b)),P}optimizeNodes(){var b,P;return super.optimizeNodes(),(b=this.catch)===null||b===void 0||b.optimizeNodes(),(P=this.finally)===null||P===void 0||P.optimizeNodes(),this}optimizeNames(b,P){var x,B;return super.optimizeNames(b,P),(x=this.catch)===null||x===void 0||x.optimizeNames(b,P),(B=this.finally)===null||B===void 0||B.optimizeNames(b,P),this}get names(){const b=super.names;return this.catch&&L(b,this.catch.names),this.finally&&L(b,this.finally.names),b}}class O extends ${constructor(b){super(),this.error=b}render(b){return`catch(${this.error})`+super.render(b)}}O.kind="catch";class A extends ${render(b){return"finally"+super.render(b)}}A.kind="finally";class M{constructor(b,P={}){this._values={},this._blockStarts=[],this._constants={},this.opts={...P,_n:P.lines?` +`:""},this._extScope=b,this._scope=new r.Scope({parent:b}),this._nodes=[new S]}toString(){return this._root.render(this.opts)}name(b){return this._scope.name(b)}scopeName(b){return this._extScope.name(b)}scopeValue(b,P){const x=this._extScope.value(b,P);return(this._values[x.prefix]||(this._values[x.prefix]=new Set)).add(x),x}getScopeValue(b,P){return this._extScope.getValue(b,P)}scopeRefs(b){return this._extScope.scopeRefs(b,this._values)}scopeCode(){return this._extScope.scopeCode(this._values)}_def(b,P,x,B){const G=this._scope.toName(P);return x!==void 0&&B&&(this._constants[G.str]=x),this._leafNode(new s(b,G,x)),G}const(b,P,x){return this._def(r.varKinds.const,b,P,x)}let(b,P,x){return this._def(r.varKinds.let,b,P,x)}var(b,P,x){return this._def(r.varKinds.var,b,P,x)}assign(b,P,x){return this._leafNode(new c(b,P,x))}add(b,P){return this._leafNode(new l(b,e.operators.ADD,P))}code(b){return typeof b=="function"?b():b!==t.nil&&this._leafNode(new m(b)),this}object(...b){const P=["{"];for(const[x,B]of b)P.length>1&&P.push(","),P.push(x),(x!==B||this.opts.es5)&&(P.push(":"),(0,t.addCodeArg)(P,B));return P.push("}"),new t._Code(P)}if(b,P,x){if(this._blockNode(new _(b)),P&&x)this.code(P).else().code(x).endIf();else if(P)this.code(P).endIf();else if(x)throw new Error('CodeGen: "else" body without "then" body');return this}elseIf(b){return this._elseNode(new _(b))}else(){return this._elseNode(new g)}endIf(){return this._endBlockNode(_,g)}_for(b,P){return this._blockNode(b),P&&this.code(P).endFor(),this}for(b,P){return this._for(new w(b),P)}forRange(b,P,x,B,G=this.opts.es5?r.varKinds.var:r.varKinds.let){const ie=this._scope.toName(b);return this._for(new E(G,ie,P,x),()=>B(ie))}forOf(b,P,x,B=r.varKinds.const){const G=this._scope.toName(b);if(this.opts.es5){const ie=P instanceof t.Name?P:this.var("_arr",P);return this.forRange("_i",0,(0,t._)`${ie}.length`,ee=>{this.var(G,(0,t._)`${ie}[${ee}]`),x(G)})}return this._for(new d("of",B,G,P),()=>x(G))}forIn(b,P,x,B=this.opts.es5?r.varKinds.var:r.varKinds.const){if(this.opts.ownProperties)return this.forOf(b,(0,t._)`Object.keys(${P})`,x);const G=this._scope.toName(b);return this._for(new d("in",B,G,P),()=>x(G))}endFor(){return this._endBlockNode(p)}label(b){return this._leafNode(new u(b))}break(b){return this._leafNode(new a(b))}return(b){const P=new v;if(this._blockNode(P),this.code(b),P.nodes.length!==1)throw new Error('CodeGen: "return" should have one node');return this._endBlockNode(v)}try(b,P,x){if(!P&&!x)throw new Error('CodeGen: "try" without "catch" and "finally"');const B=new I;if(this._blockNode(B),this.code(b),P){const G=this.name("e");this._currNode=B.catch=new O(G),P(G)}return x&&(this._currNode=B.finally=new A,this.code(x)),this._endBlockNode(O,A)}throw(b){return this._leafNode(new f(b))}block(b,P){return this._blockStarts.push(this._nodes.length),b&&this.code(b).endBlock(P),this}endBlock(b){const P=this._blockStarts.pop();if(P===void 0)throw new Error("CodeGen: not in self-balancing block");const x=this._nodes.length-P;if(x<0||b!==void 0&&x!==b)throw new Error(`CodeGen: wrong number of nodes: ${x} vs ${b} expected`);return this._nodes.length=P,this}func(b,P=t.nil,x,B){return this._blockNode(new h(b,P,x)),B&&this.code(B).endFunc(),this}endFunc(){return this._endBlockNode(h)}optimize(b=1){for(;b-- >0;)this._root.optimizeNodes(),this._root.optimizeNames(this._root.names,this._constants)}_leafNode(b){return this._currNode.nodes.push(b),this}_blockNode(b){this._currNode.nodes.push(b),this._nodes.push(b)}_endBlockNode(b,P){const x=this._currNode;if(x instanceof b||P&&x instanceof P)return this._nodes.pop(),this;throw new Error(`CodeGen: not in block "${P?`${b.kind}/${P.kind}`:b.kind}"`)}_elseNode(b){const P=this._currNode;if(!(P instanceof _))throw new Error('CodeGen: "else" without "if"');return this._currNode=P.else=b,this}get _root(){return this._nodes[0]}get _currNode(){const b=this._nodes;return b[b.length-1]}set _currNode(b){const P=this._nodes;P[P.length-1]=b}}e.CodeGen=M;function L(j,b){for(const P in b)j[P]=(j[P]||0)+(b[P]||0);return j}function N(j,b){return b instanceof t._CodeOrName?L(j,b.names):j}function z(j,b,P){if(j instanceof t.Name)return x(j);if(!B(j))return j;return new t._Code(j._items.reduce((G,ie)=>(ie instanceof t.Name&&(ie=x(ie)),ie instanceof t._Code?G.push(...ie._items):G.push(ie),G),[]));function x(G){const ie=P[G.str];return ie===void 0||b[G.str]!==1?G:(delete b[G.str],ie)}function B(G){return G instanceof t._Code&&G._items.some(ie=>ie instanceof t.Name&&b[ie.str]===1&&P[ie.str]!==void 0)}}function ne(j,b){for(const P in b)j[P]=(j[P]||0)-(b[P]||0)}function fe(j){return typeof j=="boolean"||typeof j=="number"||j===null?!j:(0,t._)`!${F(j)}`}e.not=fe;const le=k(e.operators.AND);function X(...j){return j.reduce(le)}e.and=X;const we=k(e.operators.OR);function U(...j){return j.reduce(we)}e.or=U;function k(j){return(b,P)=>b===t.nil?P:P===t.nil?b:(0,t._)`${F(b)} ${j} ${F(P)}`}function F(j){return j instanceof t.Name?j:(0,t._)`(${j})`}})(Pr)),Pr}var Y={},fn;function Z(){if(fn)return Y;fn=1,Object.defineProperty(Y,"__esModule",{value:!0}),Y.checkStrictMode=Y.getErrorPath=Y.Type=Y.useFunc=Y.setEvaluated=Y.evaluatedPropsToName=Y.mergeEvaluated=Y.eachItem=Y.unescapeJsonPointer=Y.escapeJsonPointer=Y.escapeFragment=Y.unescapeFragment=Y.schemaRefOrVal=Y.schemaHasRulesButRef=Y.schemaHasRules=Y.checkUnknownRules=Y.alwaysValidSchema=Y.toHash=void 0;const e=W(),t=dr();function r(d){const h={};for(const v of d)h[v]=!0;return h}Y.toHash=r;function n(d,h){return typeof h=="boolean"?h:Object.keys(h).length===0?!0:(o(d,h),!i(h,d.self.RULES.all))}Y.alwaysValidSchema=n;function o(d,h=d.schema){const{opts:v,self:I}=d;if(!v.strictSchema||typeof h=="boolean")return;const O=I.RULES.keywords;for(const A in h)O[A]||E(d,`unknown keyword: "${A}"`)}Y.checkUnknownRules=o;function i(d,h){if(typeof d=="boolean")return!d;for(const v in d)if(h[v])return!0;return!1}Y.schemaHasRules=i;function s(d,h){if(typeof d=="boolean")return!d;for(const v in d)if(v!=="$ref"&&h.all[v])return!0;return!1}Y.schemaHasRulesButRef=s;function c({topSchemaRef:d,schemaPath:h},v,I,O){if(!O){if(typeof v=="number"||typeof v=="boolean")return v;if(typeof v=="string")return(0,e._)`${v}`}return(0,e._)`${d}${h}${(0,e.getProperty)(I)}`}Y.schemaRefOrVal=c;function l(d){return f(decodeURIComponent(d))}Y.unescapeFragment=l;function u(d){return encodeURIComponent(a(d))}Y.escapeFragment=u;function a(d){return typeof d=="number"?`${d}`:d.replace(/~/g,"~0").replace(/\//g,"~1")}Y.escapeJsonPointer=a;function f(d){return d.replace(/~1/g,"/").replace(/~0/g,"~")}Y.unescapeJsonPointer=f;function m(d,h){if(Array.isArray(d))for(const v of d)h(v);else h(d)}Y.eachItem=m;function y({mergeNames:d,mergeToName:h,mergeValues:v,resultToName:I}){return(O,A,M,L)=>{const N=M===void 0?A:M instanceof e.Name?(A instanceof e.Name?d(O,A,M):h(O,A,M),M):A instanceof e.Name?(h(O,M,A),A):v(A,M);return L===e.Name&&!(N instanceof e.Name)?I(O,N):N}}Y.mergeEvaluated={props:y({mergeNames:(d,h,v)=>d.if((0,e._)`${v} !== true && ${h} !== undefined`,()=>{d.if((0,e._)`${h} === true`,()=>d.assign(v,!0),()=>d.assign(v,(0,e._)`${v} || {}`).code((0,e._)`Object.assign(${v}, ${h})`))}),mergeToName:(d,h,v)=>d.if((0,e._)`${v} !== true`,()=>{h===!0?d.assign(v,!0):(d.assign(v,(0,e._)`${v} || {}`),S(d,v,h))}),mergeValues:(d,h)=>d===!0?!0:{...d,...h},resultToName:$}),items:y({mergeNames:(d,h,v)=>d.if((0,e._)`${v} !== true && ${h} !== undefined`,()=>d.assign(v,(0,e._)`${h} === true ? true : ${v} > ${h} ? ${v} : ${h}`)),mergeToName:(d,h,v)=>d.if((0,e._)`${v} !== true`,()=>d.assign(v,h===!0?!0:(0,e._)`${v} > ${h} ? ${v} : ${h}`)),mergeValues:(d,h)=>d===!0?!0:Math.max(d,h),resultToName:(d,h)=>d.var("items",h)})};function $(d,h){if(h===!0)return d.var("props",!0);const v=d.var("props",(0,e._)`{}`);return h!==void 0&&S(d,v,h),v}Y.evaluatedPropsToName=$;function S(d,h,v){Object.keys(v).forEach(I=>d.assign((0,e._)`${h}${(0,e.getProperty)(I)}`,!0))}Y.setEvaluated=S;const g={};function _(d,h){return d.scopeValue("func",{ref:h,code:g[h.code]||(g[h.code]=new t._Code(h.code))})}Y.useFunc=_;var p;(function(d){d[d.Num=0]="Num",d[d.Str=1]="Str"})(p||(Y.Type=p={}));function w(d,h,v){if(d instanceof e.Name){const I=h===p.Num;return v?I?(0,e._)`"[" + ${d} + "]"`:(0,e._)`"['" + ${d} + "']"`:I?(0,e._)`"/" + ${d}`:(0,e._)`"/" + ${d}.replace(/~/g, "~0").replace(/\\//g, "~1")`}return v?(0,e.getProperty)(d).toString():"/"+a(d)}Y.getErrorPath=w;function E(d,h,v=d.opts.strictSchema){if(v){if(h=`strict mode: ${h}`,v===!0)throw new Error(h);d.self.logger.warn(h)}}return Y.checkStrictMode=E,Y}var ut={},mn;function Ce(){if(mn)return ut;mn=1,Object.defineProperty(ut,"__esModule",{value:!0});const e=W(),t={data:new e.Name("data"),valCxt:new e.Name("valCxt"),instancePath:new e.Name("instancePath"),parentData:new e.Name("parentData"),parentDataProperty:new e.Name("parentDataProperty"),rootData:new e.Name("rootData"),dynamicAnchors:new e.Name("dynamicAnchors"),vErrors:new e.Name("vErrors"),errors:new e.Name("errors"),this:new e.Name("this"),self:new e.Name("self"),scope:new e.Name("scope"),json:new e.Name("json"),jsonPos:new e.Name("jsonPos"),jsonLen:new e.Name("jsonLen"),jsonPart:new e.Name("jsonPart")};return ut.default=t,ut}var pn;function mr(){return pn||(pn=1,(function(e){Object.defineProperty(e,"__esModule",{value:!0}),e.extendErrors=e.resetErrorsCount=e.reportExtraError=e.reportError=e.keyword$DataError=e.keywordError=void 0;const t=W(),r=Z(),n=Ce();e.keywordError={message:({keyword:g})=>(0,t.str)`must pass "${g}" keyword validation`},e.keyword$DataError={message:({keyword:g,schemaType:_})=>_?(0,t.str)`"${g}" keyword must be ${_} ($data)`:(0,t.str)`"${g}" keyword is invalid ($data)`};function o(g,_=e.keywordError,p,w){const{it:E}=g,{gen:d,compositeRule:h,allErrors:v}=E,I=f(g,_,p);w??(h||v)?l(d,I):u(E,(0,t._)`[${I}]`)}e.reportError=o;function i(g,_=e.keywordError,p){const{it:w}=g,{gen:E,compositeRule:d,allErrors:h}=w,v=f(g,_,p);l(E,v),d||h||u(w,n.default.vErrors)}e.reportExtraError=i;function s(g,_){g.assign(n.default.errors,_),g.if((0,t._)`${n.default.vErrors} !== null`,()=>g.if(_,()=>g.assign((0,t._)`${n.default.vErrors}.length`,_),()=>g.assign(n.default.vErrors,null)))}e.resetErrorsCount=s;function c({gen:g,keyword:_,schemaValue:p,data:w,errsCount:E,it:d}){if(E===void 0)throw new Error("ajv implementation error");const h=g.name("err");g.forRange("i",E,n.default.errors,v=>{g.const(h,(0,t._)`${n.default.vErrors}[${v}]`),g.if((0,t._)`${h}.instancePath === undefined`,()=>g.assign((0,t._)`${h}.instancePath`,(0,t.strConcat)(n.default.instancePath,d.errorPath))),g.assign((0,t._)`${h}.schemaPath`,(0,t.str)`${d.errSchemaPath}/${_}`),d.opts.verbose&&(g.assign((0,t._)`${h}.schema`,p),g.assign((0,t._)`${h}.data`,w))})}e.extendErrors=c;function l(g,_){const p=g.const("err",_);g.if((0,t._)`${n.default.vErrors} === null`,()=>g.assign(n.default.vErrors,(0,t._)`[${p}]`),(0,t._)`${n.default.vErrors}.push(${p})`),g.code((0,t._)`${n.default.errors}++`)}function u(g,_){const{gen:p,validateName:w,schemaEnv:E}=g;E.$async?p.throw((0,t._)`new ${g.ValidationError}(${_})`):(p.assign((0,t._)`${w}.errors`,_),p.return(!1))}const a={keyword:new t.Name("keyword"),schemaPath:new t.Name("schemaPath"),params:new t.Name("params"),propertyName:new t.Name("propertyName"),message:new t.Name("message"),schema:new t.Name("schema"),parentSchema:new t.Name("parentSchema")};function f(g,_,p){const{createErrors:w}=g.it;return w===!1?(0,t._)`{}`:m(g,_,p)}function m(g,_,p={}){const{gen:w,it:E}=g,d=[y(E,p),$(g,p)];return S(g,_,d),w.object(...d)}function y({errorPath:g},{instancePath:_}){const p=_?(0,t.str)`${g}${(0,r.getErrorPath)(_,r.Type.Str)}`:g;return[n.default.instancePath,(0,t.strConcat)(n.default.instancePath,p)]}function $({keyword:g,it:{errSchemaPath:_}},{schemaPath:p,parentSchema:w}){let E=w?_:(0,t.str)`${_}/${g}`;return p&&(E=(0,t.str)`${E}${(0,r.getErrorPath)(p,r.Type.Str)}`),[a.schemaPath,E]}function S(g,{params:_,message:p},w){const{keyword:E,data:d,schemaValue:h,it:v}=g,{opts:I,propertyName:O,topSchemaRef:A,schemaPath:M}=v;w.push([a.keyword,E],[a.params,typeof _=="function"?_(g):_||(0,t._)`{}`]),I.messages&&w.push([a.message,typeof p=="function"?p(g):p]),I.verbose&&w.push([a.schema,h],[a.parentSchema,(0,t._)`${A}${M}`],[n.default.data,d]),O&&w.push([a.propertyName,O])}})(Er)),Er}var hn;function uo(){if(hn)return Fe;hn=1,Object.defineProperty(Fe,"__esModule",{value:!0}),Fe.boolOrEmptySchema=Fe.topBoolOrEmptySchema=void 0;const e=mr(),t=W(),r=Ce(),n={message:"boolean schema is false"};function o(c){const{gen:l,schema:u,validateName:a}=c;u===!1?s(c,!1):typeof u=="object"&&u.$async===!0?l.return(r.default.data):(l.assign((0,t._)`${a}.errors`,null),l.return(!0))}Fe.topBoolOrEmptySchema=o;function i(c,l){const{gen:u,schema:a}=c;a===!1?(u.var(l,!1),s(c)):u.var(l,!0)}Fe.boolOrEmptySchema=i;function s(c,l){const{gen:u,data:a}=c,f={gen:u,keyword:"false schema",data:a,schema:!1,schemaCode:!1,schemaValue:!1,params:{},it:c};(0,e.reportError)(f,n,void 0,l)}return Fe}var ge={},Ue={},yn;function Yi(){if(yn)return Ue;yn=1,Object.defineProperty(Ue,"__esModule",{value:!0}),Ue.getRules=Ue.isJSONType=void 0;const e=["string","number","integer","boolean","null","object","array"],t=new Set(e);function r(o){return typeof o=="string"&&t.has(o)}Ue.isJSONType=r;function n(){const o={number:{type:"number",rules:[]},string:{type:"string",rules:[]},array:{type:"array",rules:[]},object:{type:"object",rules:[]}};return{types:{...o,integer:!0,boolean:!0,null:!0},rules:[{rules:[]},o.number,o.string,o.array,o.object],post:{rules:[]},all:{},keywords:{}}}return Ue.getRules=n,Ue}var Oe={},gn;function Ji(){if(gn)return Oe;gn=1,Object.defineProperty(Oe,"__esModule",{value:!0}),Oe.shouldUseRule=Oe.shouldUseGroup=Oe.schemaHasRulesForType=void 0;function e({schema:n,self:o},i){const s=o.RULES.types[i];return s&&s!==!0&&t(n,s)}Oe.schemaHasRulesForType=e;function t(n,o){return o.rules.some(i=>r(n,i))}Oe.shouldUseGroup=t;function r(n,o){var i;return n[o.keyword]!==void 0||((i=o.definition.implements)===null||i===void 0?void 0:i.some(s=>n[s]!==void 0))}return Oe.shouldUseRule=r,Oe}var vn;function fr(){if(vn)return ge;vn=1,Object.defineProperty(ge,"__esModule",{value:!0}),ge.reportTypeError=ge.checkDataTypes=ge.checkDataType=ge.coerceAndCheckDataType=ge.getJSONTypes=ge.getSchemaTypes=ge.DataType=void 0;const e=Yi(),t=Ji(),r=mr(),n=W(),o=Z();var i;(function(p){p[p.Correct=0]="Correct",p[p.Wrong=1]="Wrong"})(i||(ge.DataType=i={}));function s(p){const w=c(p.type);if(w.includes("null")){if(p.nullable===!1)throw new Error("type: null contradicts nullable: false")}else{if(!w.length&&p.nullable!==void 0)throw new Error('"nullable" cannot be used without "type"');p.nullable===!0&&w.push("null")}return w}ge.getSchemaTypes=s;function c(p){const w=Array.isArray(p)?p:p?[p]:[];if(w.every(e.isJSONType))return w;throw new Error("type must be JSONType or JSONType[]: "+w.join(","))}ge.getJSONTypes=c;function l(p,w){const{gen:E,data:d,opts:h}=p,v=a(w,h.coerceTypes),I=w.length>0&&!(v.length===0&&w.length===1&&(0,t.schemaHasRulesForType)(p,w[0]));if(I){const O=$(w,d,h.strictNumbers,i.Wrong);E.if(O,()=>{v.length?f(p,w,v):g(p)})}return I}ge.coerceAndCheckDataType=l;const u=new Set(["string","number","integer","boolean","null"]);function a(p,w){return w?p.filter(E=>u.has(E)||w==="array"&&E==="array"):[]}function f(p,w,E){const{gen:d,data:h,opts:v}=p,I=d.let("dataType",(0,n._)`typeof ${h}`),O=d.let("coerced",(0,n._)`undefined`);v.coerceTypes==="array"&&d.if((0,n._)`${I} == 'object' && Array.isArray(${h}) && ${h}.length == 1`,()=>d.assign(h,(0,n._)`${h}[0]`).assign(I,(0,n._)`typeof ${h}`).if($(w,h,v.strictNumbers),()=>d.assign(O,h))),d.if((0,n._)`${O} !== undefined`);for(const M of E)(u.has(M)||M==="array"&&v.coerceTypes==="array")&&A(M);d.else(),g(p),d.endIf(),d.if((0,n._)`${O} !== undefined`,()=>{d.assign(h,O),m(p,O)});function A(M){switch(M){case"string":d.elseIf((0,n._)`${I} == "number" || ${I} == "boolean"`).assign(O,(0,n._)`"" + ${h}`).elseIf((0,n._)`${h} === null`).assign(O,(0,n._)`""`);return;case"number":d.elseIf((0,n._)`${I} == "boolean" || ${h} === null || (${I} == "string" && ${h} && ${h} == +${h})`).assign(O,(0,n._)`+${h}`);return;case"integer":d.elseIf((0,n._)`${I} === "boolean" || ${h} === null || (${I} === "string" && ${h} && ${h} == +${h} && !(${h} % 1))`).assign(O,(0,n._)`+${h}`);return;case"boolean":d.elseIf((0,n._)`${h} === "false" || ${h} === 0 || ${h} === null`).assign(O,!1).elseIf((0,n._)`${h} === "true" || ${h} === 1`).assign(O,!0);return;case"null":d.elseIf((0,n._)`${h} === "" || ${h} === 0 || ${h} === false`),d.assign(O,null);return;case"array":d.elseIf((0,n._)`${I} === "string" || ${I} === "number" - || ${I} === "boolean" || ${h} === null`).assign(O,(0,n._)`[${h}]`)}}}function m({gen:p,parentData:w,parentDataProperty:E},d){p.if((0,n._)`${w} !== undefined`,()=>p.assign((0,n._)`${w}[${E}]`,d))}function y(p,w,E,d=i.Correct){const h=d===i.Correct?n.operators.EQ:n.operators.NEQ;let v;switch(p){case"null":return(0,n._)`${w} ${h} null`;case"array":v=(0,n._)`Array.isArray(${w})`;break;case"object":v=(0,n._)`${w} && typeof ${w} == "object" && !Array.isArray(${w})`;break;case"integer":v=I((0,n._)`!(${w} % 1) && !isNaN(${w})`);break;case"number":v=I();break;default:return(0,n._)`typeof ${w} ${h} ${p}`}return d===i.Correct?v:(0,n.not)(v);function I(O=n.nil){return(0,n.and)((0,n._)`typeof ${w} == "number"`,O,E?(0,n._)`isFinite(${w})`:n.nil)}}ge.checkDataType=y;function $(p,w,E,d){if(p.length===1)return y(p[0],w,E,d);let h;const v=(0,o.toHash)(p);if(v.array&&v.object){const I=(0,n._)`typeof ${w} != "object"`;h=v.null?I:(0,n._)`!${w} || ${I}`,delete v.null,delete v.array,delete v.object}else h=n.nil;v.number&&delete v.integer;for(const I in v)h=(0,n.and)(h,y(I,w,E,d));return h}ge.checkDataTypes=$;const S={message:({schema:p})=>`must be ${p}`,params:({schema:p,schemaValue:w})=>typeof p=="string"?(0,n._)`{type: ${p}}`:(0,n._)`{type: ${w}}`};function g(p){const w=_(p);(0,r.reportError)(w,S)}ge.reportTypeError=g;function _(p){const{gen:w,data:E,schema:d}=p,h=(0,o.schemaRefOrVal)(p,d,"type");return{gen:w,keyword:"type",data:E,schema:d.type,schemaCode:h,schemaValue:h,parentSchema:d,params:{},it:p}}return ge}var tt={},vn;function lo(){if(vn)return tt;vn=1,Object.defineProperty(tt,"__esModule",{value:!0}),tt.assignDefaults=void 0;const e=W(),t=Z();function r(o,i){const{properties:s,items:c}=o.schema;if(i==="object"&&s)for(const l in s)n(o,l,s[l].default);else i==="array"&&Array.isArray(c)&&c.forEach((l,u)=>n(o,u,l.default))}tt.assignDefaults=r;function n(o,i,s){const{gen:c,compositeRule:l,data:u,opts:a}=o;if(s===void 0)return;const f=(0,e._)`${u}${(0,e.getProperty)(i)}`;if(l){(0,t.checkStrictMode)(o,`default is ignored for: ${f}`);return}let m=(0,e._)`${f} === undefined`;a.useDefaults==="empty"&&(m=(0,e._)`${m} || ${f} === null || ${f} === ""`),c.if(m,(0,e._)`${f} = ${(0,e.stringify)(s)}`)}return tt}var Ae={},ae={},bn;function Ne(){if(bn)return ae;bn=1,Object.defineProperty(ae,"__esModule",{value:!0}),ae.validateUnion=ae.validateArray=ae.usePattern=ae.callValidateCode=ae.schemaProperties=ae.allSchemaProperties=ae.noPropertyInData=ae.propertyInData=ae.isOwnProperty=ae.hasPropFunc=ae.reportMissingProp=ae.checkMissingProp=ae.checkReportMissingProp=void 0;const e=W(),t=Z(),r=Ce(),n=Z();function o(p,w){const{gen:E,data:d,it:h}=p;E.if(a(E,d,w,h.opts.ownProperties),()=>{p.setParams({missingProperty:(0,e._)`${w}`},!0),p.error()})}ae.checkReportMissingProp=o;function i({gen:p,data:w,it:{opts:E}},d,h){return(0,e.or)(...d.map(v=>(0,e.and)(a(p,w,v,E.ownProperties),(0,e._)`${h} = ${v}`)))}ae.checkMissingProp=i;function s(p,w){p.setParams({missingProperty:w},!0),p.error()}ae.reportMissingProp=s;function c(p){return p.scopeValue("func",{ref:Object.prototype.hasOwnProperty,code:(0,e._)`Object.prototype.hasOwnProperty`})}ae.hasPropFunc=c;function l(p,w,E){return(0,e._)`${c(p)}.call(${w}, ${E})`}ae.isOwnProperty=l;function u(p,w,E,d){const h=(0,e._)`${w}${(0,e.getProperty)(E)} !== undefined`;return d?(0,e._)`${h} && ${l(p,w,E)}`:h}ae.propertyInData=u;function a(p,w,E,d){const h=(0,e._)`${w}${(0,e.getProperty)(E)} === undefined`;return d?(0,e.or)(h,(0,e.not)(l(p,w,E))):h}ae.noPropertyInData=a;function f(p){return p?Object.keys(p).filter(w=>w!=="__proto__"):[]}ae.allSchemaProperties=f;function m(p,w){return f(w).filter(E=>!(0,t.alwaysValidSchema)(p,w[E]))}ae.schemaProperties=m;function y({schemaCode:p,data:w,it:{gen:E,topSchemaRef:d,schemaPath:h,errorPath:v},it:I},O,A,M){const L=M?(0,e._)`${p}, ${w}, ${d}${h}`:w,N=[[r.default.instancePath,(0,e.strConcat)(r.default.instancePath,v)],[r.default.parentData,I.parentData],[r.default.parentDataProperty,I.parentDataProperty],[r.default.rootData,r.default.rootData]];I.opts.dynamicRef&&N.push([r.default.dynamicAnchors,r.default.dynamicAnchors]);const z=(0,e._)`${L}, ${E.object(...N)}`;return A!==e.nil?(0,e._)`${O}.call(${A}, ${z})`:(0,e._)`${O}(${z})`}ae.callValidateCode=y;const $=(0,e._)`new RegExp`;function S({gen:p,it:{opts:w}},E){const d=w.unicodeRegExp?"u":"",{regExp:h}=w.code,v=h(E,d);return p.scopeValue("pattern",{key:v.toString(),ref:v,code:(0,e._)`${h.code==="new RegExp"?$:(0,n.useFunc)(p,h)}(${E}, ${d})`})}ae.usePattern=S;function g(p){const{gen:w,data:E,keyword:d,it:h}=p,v=w.name("valid");if(h.allErrors){const O=w.let("valid",!0);return I(()=>w.assign(O,!1)),O}return w.var(v,!0),I(()=>w.break()),v;function I(O){const A=w.const("len",(0,e._)`${E}.length`);w.forRange("i",0,A,M=>{p.subschema({keyword:d,dataProp:M,dataPropType:t.Type.Num},v),w.if((0,e.not)(v),O)})}}ae.validateArray=g;function _(p){const{gen:w,schema:E,keyword:d,it:h}=p;if(!Array.isArray(E))throw new Error("ajv implementation error");if(E.some(A=>(0,t.alwaysValidSchema)(h,A))&&!h.opts.unevaluated)return;const I=w.let("valid",!1),O=w.name("_valid");w.block(()=>E.forEach((A,M)=>{const L=p.subschema({keyword:d,schemaProp:M,compositeRule:!0},O);w.assign(I,(0,e._)`${I} || ${O}`),p.mergeValidEvaluated(L,O)||w.if((0,e.not)(I))})),p.result(I,()=>p.reset(),()=>p.error(!0))}return ae.validateUnion=_,ae}var _n;function fo(){if(_n)return Ae;_n=1,Object.defineProperty(Ae,"__esModule",{value:!0}),Ae.validateKeywordUsage=Ae.validSchemaType=Ae.funcKeywordCode=Ae.macroKeywordCode=void 0;const e=W(),t=Ce(),r=Ne(),n=fr();function o(m,y){const{gen:$,keyword:S,schema:g,parentSchema:_,it:p}=m,w=y.macro.call(p.self,g,_,p),E=u($,S,w);p.opts.validateSchema!==!1&&p.self.validateSchema(w,!0);const d=$.name("valid");m.subschema({schema:w,schemaPath:e.nil,errSchemaPath:`${p.errSchemaPath}/${S}`,topSchemaRef:E,compositeRule:!0},d),m.pass(d,()=>m.error(!0))}Ae.macroKeywordCode=o;function i(m,y){var $;const{gen:S,keyword:g,schema:_,parentSchema:p,$data:w,it:E}=m;l(E,y);const d=!w&&y.compile?y.compile.call(E.self,_,p,E):y.validate,h=u(S,g,d),v=S.let("valid");m.block$data(v,I),m.ok(($=y.valid)!==null&&$!==void 0?$:v);function I(){if(y.errors===!1)M(),y.modifying&&s(m),L(()=>m.error());else{const N=y.async?O():A();y.modifying&&s(m),L(()=>c(m,N))}}function O(){const N=S.let("ruleErrs",null);return S.try(()=>M((0,e._)`await `),z=>S.assign(v,!1).if((0,e._)`${z} instanceof ${E.ValidationError}`,()=>S.assign(N,(0,e._)`${z}.errors`),()=>S.throw(z))),N}function A(){const N=(0,e._)`${h}.errors`;return S.assign(N,null),M(e.nil),N}function M(N=y.async?(0,e._)`await `:e.nil){const z=E.opts.passContext?t.default.this:t.default.self,ne=!("compile"in y&&!w||y.schema===!1);S.assign(v,(0,e._)`${N}${(0,r.callValidateCode)(m,h,z,ne)}`,y.modifying)}function L(N){var z;S.if((0,e.not)((z=y.valid)!==null&&z!==void 0?z:v),N)}}Ae.funcKeywordCode=i;function s(m){const{gen:y,data:$,it:S}=m;y.if(S.parentData,()=>y.assign($,(0,e._)`${S.parentData}[${S.parentDataProperty}]`))}function c(m,y){const{gen:$}=m;$.if((0,e._)`Array.isArray(${y})`,()=>{$.assign(t.default.vErrors,(0,e._)`${t.default.vErrors} === null ? ${y} : ${t.default.vErrors}.concat(${y})`).assign(t.default.errors,(0,e._)`${t.default.vErrors}.length`),(0,n.extendErrors)(m)},()=>m.error())}function l({schemaEnv:m},y){if(y.async&&!m.$async)throw new Error("async keyword in sync schema")}function u(m,y,$){if($===void 0)throw new Error(`keyword "${y}" failed to compile`);return m.scopeValue("keyword",typeof $=="function"?{ref:$}:{ref:$,code:(0,e.stringify)($)})}function a(m,y,$=!1){return!y.length||y.some(S=>S==="array"?Array.isArray(m):S==="object"?m&&typeof m=="object"&&!Array.isArray(m):typeof m==S||$&&typeof m>"u")}Ae.validSchemaType=a;function f({schema:m,opts:y,self:$,errSchemaPath:S},g,_){if(Array.isArray(g.keyword)?!g.keyword.includes(_):g.keyword!==_)throw new Error("ajv implementation error");const p=g.dependencies;if(p?.some(w=>!Object.prototype.hasOwnProperty.call(m,w)))throw new Error(`parent schema must have dependencies of ${_}: ${p.join(",")}`);if(g.validateSchema&&!g.validateSchema(m[_])){const E=`keyword "${_}" value is invalid at path "${S}": `+$.errorsText(g.validateSchema.errors);if(y.validateSchema==="log")$.logger.error(E);else throw new Error(E)}}return Ae.validateKeywordUsage=f,Ae}var Me={},$n;function mo(){if($n)return Me;$n=1,Object.defineProperty(Me,"__esModule",{value:!0}),Me.extendSubschemaMode=Me.extendSubschemaData=Me.getSubschema=void 0;const e=W(),t=Z();function r(i,{keyword:s,schemaProp:c,schema:l,schemaPath:u,errSchemaPath:a,topSchemaRef:f}){if(s!==void 0&&l!==void 0)throw new Error('both "keyword" and "schema" passed, only one allowed');if(s!==void 0){const m=i.schema[s];return c===void 0?{schema:m,schemaPath:(0,e._)`${i.schemaPath}${(0,e.getProperty)(s)}`,errSchemaPath:`${i.errSchemaPath}/${s}`}:{schema:m[c],schemaPath:(0,e._)`${i.schemaPath}${(0,e.getProperty)(s)}${(0,e.getProperty)(c)}`,errSchemaPath:`${i.errSchemaPath}/${s}/${(0,t.escapeFragment)(c)}`}}if(l!==void 0){if(u===void 0||a===void 0||f===void 0)throw new Error('"schemaPath", "errSchemaPath" and "topSchemaRef" are required with "schema"');return{schema:l,schemaPath:u,topSchemaRef:f,errSchemaPath:a}}throw new Error('either "keyword" or "schema" must be passed')}Me.getSubschema=r;function n(i,s,{dataProp:c,dataPropType:l,data:u,dataTypes:a,propertyName:f}){if(u!==void 0&&c!==void 0)throw new Error('both "data" and "dataProp" passed, only one allowed');const{gen:m}=s;if(c!==void 0){const{errorPath:$,dataPathArr:S,opts:g}=s,_=m.let("data",(0,e._)`${s.data}${(0,e.getProperty)(c)}`,!0);y(_),i.errorPath=(0,e.str)`${$}${(0,t.getErrorPath)(c,l,g.jsPropertySyntax)}`,i.parentDataProperty=(0,e._)`${c}`,i.dataPathArr=[...S,i.parentDataProperty]}if(u!==void 0){const $=u instanceof e.Name?u:m.let("data",u,!0);y($),f!==void 0&&(i.propertyName=f)}a&&(i.dataTypes=a);function y($){i.data=$,i.dataLevel=s.dataLevel+1,i.dataTypes=[],s.definedProperties=new Set,i.parentData=s.data,i.dataNames=[...s.dataNames,$]}}Me.extendSubschemaData=n;function o(i,{jtdDiscriminator:s,jtdMetadata:c,compositeRule:l,createErrors:u,allErrors:a}){l!==void 0&&(i.compositeRule=l),u!==void 0&&(i.createErrors=u),a!==void 0&&(i.allErrors=a),i.jtdDiscriminator=s,i.jtdMetadata=c}return Me.extendSubschemaMode=o,Me}var be={},Rr,wn;function Ji(){return wn||(wn=1,Rr=function e(t,r){if(t===r)return!0;if(t&&r&&typeof t=="object"&&typeof r=="object"){if(t.constructor!==r.constructor)return!1;var n,o,i;if(Array.isArray(t)){if(n=t.length,n!=r.length)return!1;for(o=n;o--!==0;)if(!e(t[o],r[o]))return!1;return!0}if(t.constructor===RegExp)return t.source===r.source&&t.flags===r.flags;if(t.valueOf!==Object.prototype.valueOf)return t.valueOf()===r.valueOf();if(t.toString!==Object.prototype.toString)return t.toString()===r.toString();if(i=Object.keys(t),n=i.length,n!==Object.keys(r).length)return!1;for(o=n;o--!==0;)if(!Object.prototype.hasOwnProperty.call(r,i[o]))return!1;for(o=n;o--!==0;){var s=i[o];if(!e(t[s],r[s]))return!1}return!0}return t!==t&&r!==r}),Rr}var Ar={exports:{}},Sn;function po(){if(Sn)return Ar.exports;Sn=1;var e=Ar.exports=function(n,o,i){typeof o=="function"&&(i=o,o={}),i=o.cb||i;var s=typeof i=="function"?i:i.pre||function(){},c=i.post||function(){};t(o,s,c,n,"",n)};e.keywords={additionalItems:!0,items:!0,contains:!0,additionalProperties:!0,propertyNames:!0,not:!0,if:!0,then:!0,else:!0},e.arrayKeywords={items:!0,allOf:!0,anyOf:!0,oneOf:!0},e.propsKeywords={$defs:!0,definitions:!0,properties:!0,patternProperties:!0,dependencies:!0},e.skipKeywords={default:!0,enum:!0,const:!0,required:!0,maximum:!0,minimum:!0,exclusiveMaximum:!0,exclusiveMinimum:!0,multipleOf:!0,maxLength:!0,minLength:!0,pattern:!0,format:!0,maxItems:!0,minItems:!0,uniqueItems:!0,maxProperties:!0,minProperties:!0};function t(n,o,i,s,c,l,u,a,f,m){if(s&&typeof s=="object"&&!Array.isArray(s)){o(s,c,l,u,a,f,m);for(var y in s){var $=s[y];if(Array.isArray($)){if(y in e.arrayKeywords)for(var S=0;S<$.length;S++)t(n,o,i,$[S],c+"/"+y+"/"+S,l,c,y,s,S)}else if(y in e.propsKeywords){if($&&typeof $=="object")for(var g in $)t(n,o,i,$[g],c+"/"+y+"/"+r(g),l,c,y,s,g)}else(y in e.keywords||n.allKeys&&!(y in e.skipKeywords))&&t(n,o,i,$,c+"/"+y,l,c,y,s)}i(s,c,l,u,a,f,m)}}function r(n){return n.replace(/~/g,"~0").replace(/\//g,"~1")}return Ar.exports}var En;function mr(){if(En)return be;En=1,Object.defineProperty(be,"__esModule",{value:!0}),be.getSchemaRefs=be.resolveUrl=be.normalizeId=be._getFullPath=be.getFullPath=be.inlineRef=void 0;const e=Z(),t=Ji(),r=po(),n=new Set(["type","format","pattern","maxLength","minLength","maxProperties","minProperties","maxItems","minItems","maximum","minimum","uniqueItems","multipleOf","required","enum","const"]);function o(S,g=!0){return typeof S=="boolean"?!0:g===!0?!s(S):g?c(S)<=g:!1}be.inlineRef=o;const i=new Set(["$ref","$recursiveRef","$recursiveAnchor","$dynamicRef","$dynamicAnchor"]);function s(S){for(const g in S){if(i.has(g))return!0;const _=S[g];if(Array.isArray(_)&&_.some(s)||typeof _=="object"&&s(_))return!0}return!1}function c(S){let g=0;for(const _ in S){if(_==="$ref")return 1/0;if(g++,!n.has(_)&&(typeof S[_]=="object"&&(0,e.eachItem)(S[_],p=>g+=c(p)),g===1/0))return 1/0}return g}function l(S,g="",_){_!==!1&&(g=f(g));const p=S.parse(g);return u(S,p)}be.getFullPath=l;function u(S,g){return S.serialize(g).split("#")[0]+"#"}be._getFullPath=u;const a=/#\/?$/;function f(S){return S?S.replace(a,""):""}be.normalizeId=f;function m(S,g,_){return _=f(_),S.resolve(g,_)}be.resolveUrl=m;const y=/^[a-z_][-a-z0-9._]*$/i;function $(S,g){if(typeof S=="boolean")return{};const{schemaId:_,uriResolver:p}=this.opts,w=f(S[_]||g),E={"":w},d=l(p,w,!1),h={},v=new Set;return r(S,{allKeys:!0},(A,M,L,N)=>{if(N===void 0)return;const z=d+M;let ne=E[N];typeof A[_]=="string"&&(ne=fe.call(this,A[_])),le.call(this,A.$anchor),le.call(this,A.$dynamicAnchor),E[M]=ne;function fe(X){const we=this.opts.uriResolver.resolve;if(X=f(ne?we(ne,X):X),v.has(X))throw O(X);v.add(X);let U=this.refs[X];return typeof U=="string"&&(U=this.refs[U]),typeof U=="object"?I(A,U.schema,X):X!==f(z)&&(X[0]==="#"?(I(A,h[X],X),h[X]=A):this.refs[X]=z),X}function le(X){if(typeof X=="string"){if(!y.test(X))throw new Error(`invalid anchor "${X}"`);fe.call(this,`#${X}`)}}}),h;function I(A,M,L){if(M!==void 0&&!t(A,M))throw O(L)}function O(A){return new Error(`reference "${A}" resolves to more than one schema`)}}return be.getSchemaRefs=$,be}var Pn;function pr(){if(Pn)return Te;Pn=1,Object.defineProperty(Te,"__esModule",{value:!0}),Te.getData=Te.KeywordCxt=Te.validateFunctionCode=void 0;const e=uo(),t=dr(),r=Yi(),n=dr(),o=lo(),i=fo(),s=mo(),c=W(),l=Ce(),u=mr(),a=Z(),f=fr();function m(R){if(d(R)&&(v(R),E(R))){g(R);return}y(R,()=>(0,e.topBoolOrEmptySchema)(R))}Te.validateFunctionCode=m;function y({gen:R,validateName:C,schema:D,schemaEnv:V,opts:H},J){H.code.es5?R.func(C,(0,c._)`${l.default.data}, ${l.default.valCxt}`,V.$async,()=>{R.code((0,c._)`"use strict"; ${p(D,H)}`),S(R,H),R.code(J)}):R.func(C,(0,c._)`${l.default.data}, ${$(H)}`,V.$async,()=>R.code(p(D,H)).code(J))}function $(R){return(0,c._)`{${l.default.instancePath}="", ${l.default.parentData}, ${l.default.parentDataProperty}, ${l.default.rootData}=${l.default.data}${R.dynamicRef?(0,c._)`, ${l.default.dynamicAnchors}={}`:c.nil}}={}`}function S(R,C){R.if(l.default.valCxt,()=>{R.var(l.default.instancePath,(0,c._)`${l.default.valCxt}.${l.default.instancePath}`),R.var(l.default.parentData,(0,c._)`${l.default.valCxt}.${l.default.parentData}`),R.var(l.default.parentDataProperty,(0,c._)`${l.default.valCxt}.${l.default.parentDataProperty}`),R.var(l.default.rootData,(0,c._)`${l.default.valCxt}.${l.default.rootData}`),C.dynamicRef&&R.var(l.default.dynamicAnchors,(0,c._)`${l.default.valCxt}.${l.default.dynamicAnchors}`)},()=>{R.var(l.default.instancePath,(0,c._)`""`),R.var(l.default.parentData,(0,c._)`undefined`),R.var(l.default.parentDataProperty,(0,c._)`undefined`),R.var(l.default.rootData,l.default.data),C.dynamicRef&&R.var(l.default.dynamicAnchors,(0,c._)`{}`)})}function g(R){const{schema:C,opts:D,gen:V}=R;y(R,()=>{D.$comment&&C.$comment&&N(R),A(R),V.let(l.default.vErrors,null),V.let(l.default.errors,0),D.unevaluated&&_(R),I(R),z(R)})}function _(R){const{gen:C,validateName:D}=R;R.evaluated=C.const("evaluated",(0,c._)`${D}.evaluated`),C.if((0,c._)`${R.evaluated}.dynamicProps`,()=>C.assign((0,c._)`${R.evaluated}.props`,(0,c._)`undefined`)),C.if((0,c._)`${R.evaluated}.dynamicItems`,()=>C.assign((0,c._)`${R.evaluated}.items`,(0,c._)`undefined`))}function p(R,C){const D=typeof R=="object"&&R[C.schemaId];return D&&(C.code.source||C.code.process)?(0,c._)`/*# sourceURL=${D} */`:c.nil}function w(R,C){if(d(R)&&(v(R),E(R))){h(R,C);return}(0,e.boolOrEmptySchema)(R,C)}function E({schema:R,self:C}){if(typeof R=="boolean")return!R;for(const D in R)if(C.RULES.all[D])return!0;return!1}function d(R){return typeof R.schema!="boolean"}function h(R,C){const{schema:D,gen:V,opts:H}=R;H.$comment&&D.$comment&&N(R),M(R),L(R);const J=V.const("_errs",l.default.errors);I(R,J),V.var(C,(0,c._)`${J} === ${l.default.errors}`)}function v(R){(0,a.checkUnknownRules)(R),O(R)}function I(R,C){if(R.opts.jtd)return fe(R,[],!1,C);const D=(0,t.getSchemaTypes)(R.schema),V=(0,t.coerceAndCheckDataType)(R,D);fe(R,D,!V,C)}function O(R){const{schema:C,errSchemaPath:D,opts:V,self:H}=R;C.$ref&&V.ignoreKeywordsWithRef&&(0,a.schemaHasRulesButRef)(C,H.RULES)&&H.logger.warn(`$ref: keywords ignored in schema at path "${D}"`)}function A(R){const{schema:C,opts:D}=R;C.default!==void 0&&D.useDefaults&&D.strictSchema&&(0,a.checkStrictMode)(R,"default is ignored in the schema root")}function M(R){const C=R.schema[R.opts.schemaId];C&&(R.baseId=(0,u.resolveUrl)(R.opts.uriResolver,R.baseId,C))}function L(R){if(R.schema.$async&&!R.schemaEnv.$async)throw new Error("async schema in sync schema")}function N({gen:R,schemaEnv:C,schema:D,errSchemaPath:V,opts:H}){const J=D.$comment;if(H.$comment===!0)R.code((0,c._)`${l.default.self}.logger.log(${J})`);else if(typeof H.$comment=="function"){const pe=(0,c.str)`${V}/$comment`,Re=R.scopeValue("root",{ref:C.root});R.code((0,c._)`${l.default.self}.opts.$comment(${J}, ${pe}, ${Re}.schema)`)}}function z(R){const{gen:C,schemaEnv:D,validateName:V,ValidationError:H,opts:J}=R;D.$async?C.if((0,c._)`${l.default.errors} === 0`,()=>C.return(l.default.data),()=>C.throw((0,c._)`new ${H}(${l.default.vErrors})`)):(C.assign((0,c._)`${V}.errors`,l.default.vErrors),J.unevaluated&&ne(R),C.return((0,c._)`${l.default.errors} === 0`))}function ne({gen:R,evaluated:C,props:D,items:V}){D instanceof c.Name&&R.assign((0,c._)`${C}.props`,D),V instanceof c.Name&&R.assign((0,c._)`${C}.items`,V)}function fe(R,C,D,V){const{gen:H,schema:J,data:pe,allErrors:Re,opts:Se,self:Ee}=R,{RULES:he}=Ee;if(J.$ref&&(Se.ignoreKeywordsWithRef||!(0,a.schemaHasRulesButRef)(J,he))){H.block(()=>B(R,"$ref",he.all.$ref.definition));return}Se.jtd||X(R,C),H.block(()=>{for(const Ie of he.rules)He(Ie);He(he.post)});function He(Ie){(0,r.shouldUseGroup)(J,Ie)&&(Ie.type?(H.if((0,n.checkDataType)(Ie.type,pe,Se.strictNumbers)),le(R,Ie),C.length===1&&C[0]===Ie.type&&D&&(H.else(),(0,n.reportTypeError)(R)),H.endIf()):le(R,Ie),Re||H.if((0,c._)`${l.default.errors} === ${V||0}`))}}function le(R,C){const{gen:D,schema:V,opts:{useDefaults:H}}=R;H&&(0,o.assignDefaults)(R,C.type),D.block(()=>{for(const J of C.rules)(0,r.shouldUseRule)(V,J)&&B(R,J.keyword,J.definition,C.type)})}function X(R,C){R.schemaEnv.meta||!R.opts.strictTypes||(we(R,C),R.opts.allowUnionTypes||U(R,C),k(R,R.dataTypes))}function we(R,C){if(C.length){if(!R.dataTypes.length){R.dataTypes=C;return}C.forEach(D=>{j(R.dataTypes,D)||P(R,`type "${D}" not allowed by context "${R.dataTypes.join(",")}"`)}),b(R,C)}}function U(R,C){C.length>1&&!(C.length===2&&C.includes("null"))&&P(R,"use allowUnionTypes to allow union type keyword")}function k(R,C){const D=R.self.RULES.all;for(const V in D){const H=D[V];if(typeof H=="object"&&(0,r.shouldUseRule)(R.schema,H)){const{type:J}=H.definition;J.length&&!J.some(pe=>F(C,pe))&&P(R,`missing type "${J.join(",")}" for keyword "${V}"`)}}}function F(R,C){return R.includes(C)||C==="number"&&R.includes("integer")}function j(R,C){return R.includes(C)||C==="integer"&&R.includes("number")}function b(R,C){const D=[];for(const V of R.dataTypes)j(C,V)?D.push(V):C.includes("integer")&&V==="number"&&D.push("integer");R.dataTypes=D}function P(R,C){const D=R.schemaEnv.baseId+R.errSchemaPath;C+=` at "${D}" (strictTypes)`,(0,a.checkStrictMode)(R,C,R.opts.strictTypes)}class x{constructor(C,D,V){if((0,i.validateKeywordUsage)(C,D,V),this.gen=C.gen,this.allErrors=C.allErrors,this.keyword=V,this.data=C.data,this.schema=C.schema[V],this.$data=D.$data&&C.opts.$data&&this.schema&&this.schema.$data,this.schemaValue=(0,a.schemaRefOrVal)(C,this.schema,V,this.$data),this.schemaType=D.schemaType,this.parentSchema=C.schema,this.params={},this.it=C,this.def=D,this.$data)this.schemaCode=C.gen.const("vSchema",ee(this.$data,C));else if(this.schemaCode=this.schemaValue,!(0,i.validSchemaType)(this.schema,D.schemaType,D.allowUndefined))throw new Error(`${V} value must be ${JSON.stringify(D.schemaType)}`);("code"in D?D.trackErrors:D.errors!==!1)&&(this.errsCount=C.gen.const("_errs",l.default.errors))}result(C,D,V){this.failResult((0,c.not)(C),D,V)}failResult(C,D,V){this.gen.if(C),V?V():this.error(),D?(this.gen.else(),D(),this.allErrors&&this.gen.endIf()):this.allErrors?this.gen.endIf():this.gen.else()}pass(C,D){this.failResult((0,c.not)(C),void 0,D)}fail(C){if(C===void 0){this.error(),this.allErrors||this.gen.if(!1);return}this.gen.if(C),this.error(),this.allErrors?this.gen.endIf():this.gen.else()}fail$data(C){if(!this.$data)return this.fail(C);const{schemaCode:D}=this;this.fail((0,c._)`${D} !== undefined && (${(0,c.or)(this.invalid$data(),C)})`)}error(C,D,V){if(D){this.setParams(D),this._error(C,V),this.setParams({});return}this._error(C,V)}_error(C,D){(C?f.reportExtraError:f.reportError)(this,this.def.error,D)}$dataError(){(0,f.reportError)(this,this.def.$dataError||f.keyword$DataError)}reset(){if(this.errsCount===void 0)throw new Error('add "trackErrors" to keyword definition');(0,f.resetErrorsCount)(this.gen,this.errsCount)}ok(C){this.allErrors||this.gen.if(C)}setParams(C,D){D?Object.assign(this.params,C):this.params=C}block$data(C,D,V=c.nil){this.gen.block(()=>{this.check$data(C,V),D()})}check$data(C=c.nil,D=c.nil){if(!this.$data)return;const{gen:V,schemaCode:H,schemaType:J,def:pe}=this;V.if((0,c.or)((0,c._)`${H} === undefined`,D)),C!==c.nil&&V.assign(C,!0),(J.length||pe.validateSchema)&&(V.elseIf(this.invalid$data()),this.$dataError(),C!==c.nil&&V.assign(C,!1)),V.else()}invalid$data(){const{gen:C,schemaCode:D,schemaType:V,def:H,it:J}=this;return(0,c.or)(pe(),Re());function pe(){if(V.length){if(!(D instanceof c.Name))throw new Error("ajv implementation error");const Se=Array.isArray(V)?V:[V];return(0,c._)`${(0,n.checkDataTypes)(Se,D,J.opts.strictNumbers,n.DataType.Wrong)}`}return c.nil}function Re(){if(H.validateSchema){const Se=C.scopeValue("validate$data",{ref:H.validateSchema});return(0,c._)`!${Se}(${D})`}return c.nil}}subschema(C,D){const V=(0,s.getSubschema)(this.it,C);(0,s.extendSubschemaData)(V,this.it,C),(0,s.extendSubschemaMode)(V,C);const H={...this.it,...V,items:void 0,props:void 0};return w(H,D),H}mergeEvaluated(C,D){const{it:V,gen:H}=this;V.opts.unevaluated&&(V.props!==!0&&C.props!==void 0&&(V.props=a.mergeEvaluated.props(H,C.props,V.props,D)),V.items!==!0&&C.items!==void 0&&(V.items=a.mergeEvaluated.items(H,C.items,V.items,D)))}mergeValidEvaluated(C,D){const{it:V,gen:H}=this;if(V.opts.unevaluated&&(V.props!==!0||V.items!==!0))return H.if(D,()=>this.mergeEvaluated(C,c.Name)),!0}}Te.KeywordCxt=x;function B(R,C,D,V){const H=new x(R,D,C);"code"in D?D.code(H,V):H.$data&&D.validate?(0,i.funcKeywordCode)(H,D):"macro"in D?(0,i.macroKeywordCode)(H,D):(D.compile||D.validate)&&(0,i.funcKeywordCode)(H,D)}const G=/^\/(?:[^~]|~0|~1)*$/,ie=/^([0-9]+)(#|\/(?:[^~]|~0|~1)*)?$/;function ee(R,{dataLevel:C,dataNames:D,dataPathArr:V}){let H,J;if(R==="")return l.default.rootData;if(R[0]==="/"){if(!G.test(R))throw new Error(`Invalid JSON-pointer: ${R}`);H=R,J=l.default.rootData}else{const Ee=ie.exec(R);if(!Ee)throw new Error(`Invalid JSON-pointer: ${R}`);const he=+Ee[1];if(H=Ee[2],H==="#"){if(he>=C)throw new Error(Se("property/index",he));return V[C-he]}if(he>C)throw new Error(Se("data",he));if(J=D[C-he],!H)return J}let pe=J;const Re=H.split("/");for(const Ee of Re)Ee&&(J=(0,c._)`${J}${(0,c.getProperty)((0,a.unescapeJsonPointer)(Ee))}`,pe=(0,c._)`${pe} && ${J}`);return pe;function Se(Ee,he){return`Cannot access ${Ee} ${he} levels up, current level is ${C}`}}return Te.getData=ee,Te}var lt={},In;function Kr(){if(In)return lt;In=1,Object.defineProperty(lt,"__esModule",{value:!0});class e extends Error{constructor(r){super("validation failed"),this.errors=r,this.ajv=this.validation=!0}}return lt.default=e,lt}var dt={},Rn;function hr(){if(Rn)return dt;Rn=1,Object.defineProperty(dt,"__esModule",{value:!0});const e=mr();class t extends Error{constructor(n,o,i,s){super(s||`can't resolve reference ${i} from id ${o}`),this.missingRef=(0,e.resolveUrl)(n,o,i),this.missingSchema=(0,e.normalizeId)((0,e.getFullPath)(n,this.missingRef))}}return dt.default=t,dt}var Pe={},An;function yr(){if(An)return Pe;An=1,Object.defineProperty(Pe,"__esModule",{value:!0}),Pe.resolveSchema=Pe.getCompilingSchema=Pe.resolveRef=Pe.compileSchema=Pe.SchemaEnv=void 0;const e=W(),t=Kr(),r=Ce(),n=mr(),o=Z(),i=pr();class s{constructor(_){var p;this.refs={},this.dynamicAnchors={};let w;typeof _.schema=="object"&&(w=_.schema),this.schema=_.schema,this.schemaId=_.schemaId,this.root=_.root||this,this.baseId=(p=_.baseId)!==null&&p!==void 0?p:(0,n.normalizeId)(w?.[_.schemaId||"$id"]),this.schemaPath=_.schemaPath,this.localRefs=_.localRefs,this.meta=_.meta,this.$async=w?.$async,this.refs={}}}Pe.SchemaEnv=s;function c(g){const _=a.call(this,g);if(_)return _;const p=(0,n.getFullPath)(this.opts.uriResolver,g.root.baseId),{es5:w,lines:E}=this.opts.code,{ownProperties:d}=this.opts,h=new e.CodeGen(this.scope,{es5:w,lines:E,ownProperties:d});let v;g.$async&&(v=h.scopeValue("Error",{ref:t.default,code:(0,e._)`require("ajv/dist/runtime/validation_error").default`}));const I=h.scopeName("validate");g.validateName=I;const O={gen:h,allErrors:this.opts.allErrors,data:r.default.data,parentData:r.default.parentData,parentDataProperty:r.default.parentDataProperty,dataNames:[r.default.data],dataPathArr:[e.nil],dataLevel:0,dataTypes:[],definedProperties:new Set,topSchemaRef:h.scopeValue("schema",this.opts.code.source===!0?{ref:g.schema,code:(0,e.stringify)(g.schema)}:{ref:g.schema}),validateName:I,ValidationError:v,schema:g.schema,schemaEnv:g,rootId:p,baseId:g.baseId||p,schemaPath:e.nil,errSchemaPath:g.schemaPath||(this.opts.jtd?"":"#"),errorPath:(0,e._)`""`,opts:this.opts,self:this};let A;try{this._compilations.add(g),(0,i.validateFunctionCode)(O),h.optimize(this.opts.code.optimize);const M=h.toString();A=`${h.scopeRefs(r.default.scope)}return ${M}`,this.opts.code.process&&(A=this.opts.code.process(A,g));const N=new Function(`${r.default.self}`,`${r.default.scope}`,A)(this,this.scope.get());if(this.scope.value(I,{ref:N}),N.errors=null,N.schema=g.schema,N.schemaEnv=g,g.$async&&(N.$async=!0),this.opts.code.source===!0&&(N.source={validateName:I,validateCode:M,scopeValues:h._values}),this.opts.unevaluated){const{props:z,items:ne}=O;N.evaluated={props:z instanceof e.Name?void 0:z,items:ne instanceof e.Name?void 0:ne,dynamicProps:z instanceof e.Name,dynamicItems:ne instanceof e.Name},N.source&&(N.source.evaluated=(0,e.stringify)(N.evaluated))}return g.validate=N,g}catch(M){throw delete g.validate,delete g.validateName,A&&this.logger.error("Error compiling schema, function code:",A),M}finally{this._compilations.delete(g)}}Pe.compileSchema=c;function l(g,_,p){var w;p=(0,n.resolveUrl)(this.opts.uriResolver,_,p);const E=g.refs[p];if(E)return E;let d=m.call(this,g,p);if(d===void 0){const h=(w=g.localRefs)===null||w===void 0?void 0:w[p],{schemaId:v}=this.opts;h&&(d=new s({schema:h,schemaId:v,root:g,baseId:_}))}if(d!==void 0)return g.refs[p]=u.call(this,d)}Pe.resolveRef=l;function u(g){return(0,n.inlineRef)(g.schema,this.opts.inlineRefs)?g.schema:g.validate?g:c.call(this,g)}function a(g){for(const _ of this._compilations)if(f(_,g))return _}Pe.getCompilingSchema=a;function f(g,_){return g.schema===_.schema&&g.root===_.root&&g.baseId===_.baseId}function m(g,_){let p;for(;typeof(p=this.refs[_])=="string";)_=p;return p||this.schemas[_]||y.call(this,g,_)}function y(g,_){const p=this.opts.uriResolver.parse(_),w=(0,n._getFullPath)(this.opts.uriResolver,p);let E=(0,n.getFullPath)(this.opts.uriResolver,g.baseId,void 0);if(Object.keys(g.schema).length>0&&w===E)return S.call(this,p,g);const d=(0,n.normalizeId)(w),h=this.refs[d]||this.schemas[d];if(typeof h=="string"){const v=y.call(this,g,h);return typeof v?.schema!="object"?void 0:S.call(this,p,v)}if(typeof h?.schema=="object"){if(h.validate||c.call(this,h),d===(0,n.normalizeId)(_)){const{schema:v}=h,{schemaId:I}=this.opts,O=v[I];return O&&(E=(0,n.resolveUrl)(this.opts.uriResolver,E,O)),new s({schema:v,schemaId:I,root:g,baseId:E})}return S.call(this,p,h)}}Pe.resolveSchema=y;const $=new Set(["properties","patternProperties","enum","dependencies","definitions"]);function S(g,{baseId:_,schema:p,root:w}){var E;if(((E=g.fragment)===null||E===void 0?void 0:E[0])!=="/")return;for(const v of g.fragment.slice(1).split("/")){if(typeof p=="boolean")return;const I=p[(0,o.unescapeFragment)(v)];if(I===void 0)return;p=I;const O=typeof p=="object"&&p[this.opts.schemaId];!$.has(v)&&O&&(_=(0,n.resolveUrl)(this.opts.uriResolver,_,O))}let d;if(typeof p!="boolean"&&p.$ref&&!(0,o.schemaHasRulesButRef)(p,this.RULES)){const v=(0,n.resolveUrl)(this.opts.uriResolver,_,p.$ref);d=y.call(this,w,v)}const{schemaId:h}=this.opts;if(d=d||new s({schema:p,schemaId:h,root:w,baseId:_}),d.schema!==d.root.schema)return d}return Pe}const ho="https://raw.githubusercontent.com/ajv-validator/ajv/master/lib/refs/data.json#",yo="Meta-schema for $data reference (JSON AnySchema extension proposal)",go="object",vo=["$data"],bo={$data:{type:"string",anyOf:[{format:"relative-json-pointer"},{format:"json-pointer"}]}},_o=!1,$o={$id:ho,description:yo,type:go,required:vo,properties:bo,additionalProperties:_o};var ft={},rt={exports:{}},kr,kn;function Qi(){if(kn)return kr;kn=1;const e=RegExp.prototype.test.bind(/^[\da-f]{8}-[\da-f]{4}-[\da-f]{4}-[\da-f]{4}-[\da-f]{12}$/iu),t=RegExp.prototype.test.bind(/^(?:(?:25[0-5]|2[0-4]\d|1\d{2}|[1-9]\d|\d)\.){3}(?:25[0-5]|2[0-4]\d|1\d{2}|[1-9]\d|\d)$/u),r=RegExp.prototype.test.bind(/^[\da-f]{2}$/iu),n=RegExp.prototype.test.bind(/^[\da-z\-._~]$/iu),o=RegExp.prototype.test.bind(/^[\da-z\-._~!$&'()*+,;=:@/]$/iu);function i(d){let h="",v=0,I=0;for(I=0;I=48&&v<=57||v>=65&&v<=70||v>=97&&v<=102))return"";h+=d[I];break}for(I+=1;I=48&&v<=57||v>=65&&v<=70||v>=97&&v<=102))return"";h+=d[I]}return h}const s=RegExp.prototype.test.bind(/[^!"$&'()*+,\-.;=_`a-z{}~]/u);function c(d){return d.length=0,!0}function l(d,h,v){if(d.length){const I=i(d);if(I!=="")h.push(I);else return v.error=!0,!1;d.length=0}return!0}function u(d){let h=0;const v={error:!1,address:"",zone:""},I=[],O=[];let A=!1,M=!1,L=l;for(let N=0;N7){v.error=!0;break}N>0&&d[N-1]===":"&&(A=!0),I.push(":");continue}else if(z==="%"){if(!L(O,I,v))break;L=c}else{O.push(z);continue}}return O.length&&(L===c?v.zone=O.join(""):M?I.push(O.join("")):I.push(i(O))),v.address=I.join(""),v}function a(d){if(f(d,":")<2)return{host:d,isIPV6:!1};const h=u(d);if(h.error)return{host:d,isIPV6:!1};{let v=h.address,I=h.address;return h.zone&&(v+="%"+h.zone,I+="%25"+h.zone),{host:v,isIPV6:!0,escapedHost:I}}}function f(d,h){let v=0;for(let I=0;Iy[I])}function _(d,h=!1){if(d.indexOf("%")===-1)return d;let v="";for(let I=0;I65535))return"URI port is malformed."}function E(A,M){const L=Object.assign({},M),N={scheme:void 0,userinfo:void 0,host:"",port:void 0,path:"",query:void 0,fragment:void 0};let z=!1,ne=!1;L.reference==="suffix"&&(L.scheme?A=L.scheme+":"+A:A="//"+A);const fe=A.match(_);fe!==null&&fe[1].indexOf("\\")!==-1&&(N.error="URI authority must not contain a literal backslash.",z=!0);const le=A.match(p);if(le!==null){const we=le[1],U=we.replace(/[\t\n\r]/g,"");U.length>=2&&(U.slice(0,2)!=="//"?(N.error=N.error||"URI authority must not contain a literal backslash.",z=!0):we.length!==U.length&&(N.error=N.error||"URI authority introducer must not contain whitespace.",z=!0))}const X=A.match(g);if(X){N.scheme=X[1],N.userinfo=X[3],N.host=X[4],N.port=parseInt(X[5],10),N.path=X[6]||"",N.query=X[7],N.fragment=X[8],isNaN(N.port)&&(N.port=X[5]);const we=w(N,X);if(we!==void 0&&(N.error=N.error||we,z=!0),N.host)if(c(N.host)===!1){const F=e(N.host);N.host=F.host.toLowerCase(),ne=F.isIPV6}else ne=!0;N.scheme===void 0&&N.userinfo===void 0&&N.host===void 0&&N.port===void 0&&N.query===void 0&&!N.path?N.reference="same-document":N.scheme===void 0?N.reference="relative":N.fragment===void 0?N.reference="absolute":N.reference="uri",L.reference&&L.reference!=="suffix"&&L.reference!==N.reference&&(N.error=N.error||"URI is not a "+L.reference+" reference.");const U=a(L.scheme||N.scheme);if(!L.unicodeSupport&&(!U||!U.unicodeSupport)&&N.host&&(L.domainHost||U&&U.domainHost)&&ne===!1&&l(N.host))try{N.host=new URL("http://"+N.host).hostname}catch(k){N.error=N.error||"Host's domain name can not be converted to ASCII: "+k}if((!U||U&&!U.skipNormalize)&&(A.indexOf("%")!==-1&&(N.scheme!==void 0&&(N.scheme=unescape(N.scheme)),N.host!==void 0&&(N.host=s(unescape(N.host),ne))),N.path&&(N.path=o(N.path)),N.fragment))try{N.fragment=encodeURI(decodeURIComponent(N.fragment))}catch{N.error=N.error||"URI malformed"}U&&U.parse&&U.parse(N,L)}else N.error=N.error||"URI can not be parsed.";return{parsed:N,malformedAuthorityOrPort:z}}function d(A,M){return E(A,M).parsed}function h(A,M){return v(A,M).normalized}function v(A,M){const{parsed:L,malformedAuthorityOrPort:N}=E(A,M);return{normalized:N?A:S(L,M),malformedAuthorityOrPort:N}}function I(A,M){if(typeof A=="string"){const{normalized:L,malformedAuthorityOrPort:N}=v(A,M);return N?void 0:L}if(typeof A=="object")return S(A,M)}const O={SCHEMES:u,normalize:f,resolve:m,resolveComponent:y,equal:$,serialize:S,parse:d};return rt.exports=O,rt.exports.default=O,rt.exports.fastUri=O,rt.exports}var jn;function Eo(){if(jn)return ft;jn=1,Object.defineProperty(ft,"__esModule",{value:!0});const e=So();return e.code='require("ajv/dist/runtime/uri").default',ft.default=e,ft}var Tn;function Po(){return Tn||(Tn=1,(function(e){Object.defineProperty(e,"__esModule",{value:!0}),e.CodeGen=e.Name=e.nil=e.stringify=e.str=e._=e.KeywordCxt=void 0;var t=pr();Object.defineProperty(e,"KeywordCxt",{enumerable:!0,get:function(){return t.KeywordCxt}});var r=W();Object.defineProperty(e,"_",{enumerable:!0,get:function(){return r._}}),Object.defineProperty(e,"str",{enumerable:!0,get:function(){return r.str}}),Object.defineProperty(e,"stringify",{enumerable:!0,get:function(){return r.stringify}}),Object.defineProperty(e,"nil",{enumerable:!0,get:function(){return r.nil}}),Object.defineProperty(e,"Name",{enumerable:!0,get:function(){return r.Name}}),Object.defineProperty(e,"CodeGen",{enumerable:!0,get:function(){return r.CodeGen}});const n=Kr(),o=hr(),i=Xi(),s=yr(),c=W(),l=mr(),u=dr(),a=Z(),f=$o,m=Eo(),y=(U,k)=>new RegExp(U,k);y.code="new RegExp";const $=["removeAdditional","useDefaults","coerceTypes"],S=new Set(["validate","serialize","parse","wrapper","root","schema","keyword","pattern","formats","validate$data","func","obj","Error"]),g={errorDataPath:"",format:"`validateFormats: false` can be used instead.",nullable:'"nullable" keyword is supported by default.',jsonPointers:"Deprecated jsPropertySyntax can be used instead.",extendRefs:"Deprecated ignoreKeywordsWithRef can be used instead.",missingRefs:"Pass empty schema with $id that should be ignored to ajv.addSchema.",processCode:"Use option `code: {process: (code, schemaEnv: object) => string}`",sourceCode:"Use option `code: {source: true}`",strictDefaults:"It is default now, see option `strict`.",strictKeywords:"It is default now, see option `strict`.",uniqueItems:'"uniqueItems" keyword is always validated.',unknownFormats:"Disable strict mode or pass `true` to `ajv.addFormat` (or `formats` option).",cache:"Map is used as cache, schema object as key.",serialize:"Map is used as cache, schema object as key.",ajvErrors:"It is default now."},_={ignoreKeywordsWithRef:"",jsPropertySyntax:"",unicode:'"minLength"/"maxLength" account for unicode characters by default.'},p=200;function w(U){var k,F,j,b,P,x,B,G,ie,ee,R,C,D,V,H,J,pe,Re,Se,Ee,he,He,Ie,vr,br;const et=U.strict,_r=(k=U.code)===null||k===void 0?void 0:k.optimize,en=_r===!0||_r===void 0?1:_r||0,tn=(j=(F=U.code)===null||F===void 0?void 0:F.regExp)!==null&&j!==void 0?j:y,ba=(b=U.uriResolver)!==null&&b!==void 0?b:m.default;return{strictSchema:(x=(P=U.strictSchema)!==null&&P!==void 0?P:et)!==null&&x!==void 0?x:!0,strictNumbers:(G=(B=U.strictNumbers)!==null&&B!==void 0?B:et)!==null&&G!==void 0?G:!0,strictTypes:(ee=(ie=U.strictTypes)!==null&&ie!==void 0?ie:et)!==null&&ee!==void 0?ee:"log",strictTuples:(C=(R=U.strictTuples)!==null&&R!==void 0?R:et)!==null&&C!==void 0?C:"log",strictRequired:(V=(D=U.strictRequired)!==null&&D!==void 0?D:et)!==null&&V!==void 0?V:!1,code:U.code?{...U.code,optimize:en,regExp:tn}:{optimize:en,regExp:tn},loopRequired:(H=U.loopRequired)!==null&&H!==void 0?H:p,loopEnum:(J=U.loopEnum)!==null&&J!==void 0?J:p,meta:(pe=U.meta)!==null&&pe!==void 0?pe:!0,messages:(Re=U.messages)!==null&&Re!==void 0?Re:!0,inlineRefs:(Se=U.inlineRefs)!==null&&Se!==void 0?Se:!0,schemaId:(Ee=U.schemaId)!==null&&Ee!==void 0?Ee:"$id",addUsedSchema:(he=U.addUsedSchema)!==null&&he!==void 0?he:!0,validateSchema:(He=U.validateSchema)!==null&&He!==void 0?He:!0,validateFormats:(Ie=U.validateFormats)!==null&&Ie!==void 0?Ie:!0,unicodeRegExp:(vr=U.unicodeRegExp)!==null&&vr!==void 0?vr:!0,int32range:(br=U.int32range)!==null&&br!==void 0?br:!0,uriResolver:ba}}class E{constructor(k={}){this.schemas={},this.refs={},this.formats=Object.create(null),this._compilations=new Set,this._loading={},this._cache=new Map,k=this.opts={...k,...w(k)};const{es5:F,lines:j}=this.opts.code;this.scope=new c.ValueScope({scope:{},prefixes:S,es5:F,lines:j}),this.logger=L(k.logger);const b=k.validateFormats;k.validateFormats=!1,this.RULES=(0,i.getRules)(),d.call(this,g,k,"NOT SUPPORTED"),d.call(this,_,k,"DEPRECATED","warn"),this._metaOpts=A.call(this),k.formats&&I.call(this),this._addVocabularies(),this._addDefaultMetaSchema(),k.keywords&&O.call(this,k.keywords),typeof k.meta=="object"&&this.addMetaSchema(k.meta),v.call(this),k.validateFormats=b}_addVocabularies(){this.addKeyword("$async")}_addDefaultMetaSchema(){const{$data:k,meta:F,schemaId:j}=this.opts;let b=f;j==="id"&&(b={...f},b.id=b.$id,delete b.$id),F&&k&&this.addMetaSchema(b,b[j],!1)}defaultMeta(){const{meta:k,schemaId:F}=this.opts;return this.opts.defaultMeta=typeof k=="object"?k[F]||k:void 0}validate(k,F){let j;if(typeof k=="string"){if(j=this.getSchema(k),!j)throw new Error(`no schema with key or ref "${k}"`)}else j=this.compile(k);const b=j(F);return"$async"in j||(this.errors=j.errors),b}compile(k,F){const j=this._addSchema(k,F);return j.validate||this._compileSchemaEnv(j)}compileAsync(k,F){if(typeof this.opts.loadSchema!="function")throw new Error("options.loadSchema should be a function");const{loadSchema:j}=this.opts;return b.call(this,k,F);async function b(ee,R){await P.call(this,ee.$schema);const C=this._addSchema(ee,R);return C.validate||x.call(this,C)}async function P(ee){ee&&!this.getSchema(ee)&&await b.call(this,{$ref:ee},!0)}async function x(ee){try{return this._compileSchemaEnv(ee)}catch(R){if(!(R instanceof o.default))throw R;return B.call(this,R),await G.call(this,R.missingSchema),x.call(this,ee)}}function B({missingSchema:ee,missingRef:R}){if(this.refs[ee])throw new Error(`AnySchema ${ee} is loaded but ${R} cannot be resolved`)}async function G(ee){const R=await ie.call(this,ee);this.refs[ee]||await P.call(this,R.$schema),this.refs[ee]||this.addSchema(R,ee,F)}async function ie(ee){const R=this._loading[ee];if(R)return R;try{return await(this._loading[ee]=j(ee))}finally{delete this._loading[ee]}}}addSchema(k,F,j,b=this.opts.validateSchema){if(Array.isArray(k)){for(const x of k)this.addSchema(x,void 0,j,b);return this}let P;if(typeof k=="object"){const{schemaId:x}=this.opts;if(P=k[x],P!==void 0&&typeof P!="string")throw new Error(`schema ${x} must be string`)}return F=(0,l.normalizeId)(F||P),this._checkUnique(F),this.schemas[F]=this._addSchema(k,j,F,b,!0),this}addMetaSchema(k,F,j=this.opts.validateSchema){return this.addSchema(k,F,!0,j),this}validateSchema(k,F){if(typeof k=="boolean")return!0;let j;if(j=k.$schema,j!==void 0&&typeof j!="string")throw new Error("$schema must be a string");if(j=j||this.opts.defaultMeta||this.defaultMeta(),!j)return this.logger.warn("meta-schema not available"),this.errors=null,!0;const b=this.validate(j,k);if(!b&&F){const P="schema is invalid: "+this.errorsText();if(this.opts.validateSchema==="log")this.logger.error(P);else throw new Error(P)}return b}getSchema(k){let F;for(;typeof(F=h.call(this,k))=="string";)k=F;if(F===void 0){const{schemaId:j}=this.opts,b=new s.SchemaEnv({schema:{},schemaId:j});if(F=s.resolveSchema.call(this,b,k),!F)return;this.refs[k]=F}return F.validate||this._compileSchemaEnv(F)}removeSchema(k){if(k instanceof RegExp)return this._removeAllSchemas(this.schemas,k),this._removeAllSchemas(this.refs,k),this;switch(typeof k){case"undefined":return this._removeAllSchemas(this.schemas),this._removeAllSchemas(this.refs),this._cache.clear(),this;case"string":{const F=h.call(this,k);return typeof F=="object"&&this._cache.delete(F.schema),delete this.schemas[k],delete this.refs[k],this}case"object":{const F=k;this._cache.delete(F);let j=k[this.opts.schemaId];return j&&(j=(0,l.normalizeId)(j),delete this.schemas[j],delete this.refs[j]),this}default:throw new Error("ajv.removeSchema: invalid parameter")}}addVocabulary(k){for(const F of k)this.addKeyword(F);return this}addKeyword(k,F){let j;if(typeof k=="string")j=k,typeof F=="object"&&(this.logger.warn("these parameters are deprecated, see docs for addKeyword"),F.keyword=j);else if(typeof k=="object"&&F===void 0){if(F=k,j=F.keyword,Array.isArray(j)&&!j.length)throw new Error("addKeywords: keyword must be string or non-empty array")}else throw new Error("invalid addKeywords parameters");if(z.call(this,j,F),!F)return(0,a.eachItem)(j,P=>ne.call(this,P)),this;le.call(this,F);const b={...F,type:(0,u.getJSONTypes)(F.type),schemaType:(0,u.getJSONTypes)(F.schemaType)};return(0,a.eachItem)(j,b.type.length===0?P=>ne.call(this,P,b):P=>b.type.forEach(x=>ne.call(this,P,b,x))),this}getKeyword(k){const F=this.RULES.all[k];return typeof F=="object"?F.definition:!!F}removeKeyword(k){const{RULES:F}=this;delete F.keywords[k],delete F.all[k];for(const j of F.rules){const b=j.rules.findIndex(P=>P.keyword===k);b>=0&&j.rules.splice(b,1)}return this}addFormat(k,F){return typeof F=="string"&&(F=new RegExp(F)),this.formats[k]=F,this}errorsText(k=this.errors,{separator:F=", ",dataVar:j="data"}={}){return!k||k.length===0?"No errors":k.map(b=>`${j}${b.instancePath} ${b.message}`).reduce((b,P)=>b+F+P)}$dataMetaSchema(k,F){const j=this.RULES.all;k=JSON.parse(JSON.stringify(k));for(const b of F){const P=b.split("/").slice(1);let x=k;for(const B of P)x=x[B];for(const B in j){const G=j[B];if(typeof G!="object")continue;const{$data:ie}=G.definition,ee=x[B];ie&&ee&&(x[B]=we(ee))}}return k}_removeAllSchemas(k,F){for(const j in k){const b=k[j];(!F||F.test(j))&&(typeof b=="string"?delete k[j]:b&&!b.meta&&(this._cache.delete(b.schema),delete k[j]))}}_addSchema(k,F,j,b=this.opts.validateSchema,P=this.opts.addUsedSchema){let x;const{schemaId:B}=this.opts;if(typeof k=="object")x=k[B];else{if(this.opts.jtd)throw new Error("schema must be object");if(typeof k!="boolean")throw new Error("schema must be object or boolean")}let G=this._cache.get(k);if(G!==void 0)return G;j=(0,l.normalizeId)(x||j);const ie=l.getSchemaRefs.call(this,k,j);return G=new s.SchemaEnv({schema:k,schemaId:B,meta:F,baseId:j,localRefs:ie}),this._cache.set(G.schema,G),P&&!j.startsWith("#")&&(j&&this._checkUnique(j),this.refs[j]=G),b&&this.validateSchema(k,!0),G}_checkUnique(k){if(this.schemas[k]||this.refs[k])throw new Error(`schema with key or id "${k}" already exists`)}_compileSchemaEnv(k){if(k.meta?this._compileMetaSchema(k):s.compileSchema.call(this,k),!k.validate)throw new Error("ajv implementation error");return k.validate}_compileMetaSchema(k){const F=this.opts;this.opts=this._metaOpts;try{s.compileSchema.call(this,k)}finally{this.opts=F}}}E.ValidationError=n.default,E.MissingRefError=o.default,e.default=E;function d(U,k,F,j="error"){for(const b in U){const P=b;P in k&&this.logger[j](`${F}: option ${b}. ${U[P]}`)}}function h(U){return U=(0,l.normalizeId)(U),this.schemas[U]||this.refs[U]}function v(){const U=this.opts.schemas;if(U)if(Array.isArray(U))this.addSchema(U);else for(const k in U)this.addSchema(U[k],k)}function I(){for(const U in this.opts.formats){const k=this.opts.formats[U];k&&this.addFormat(U,k)}}function O(U){if(Array.isArray(U)){this.addVocabulary(U);return}this.logger.warn("keywords option as map is deprecated, pass array");for(const k in U){const F=U[k];F.keyword||(F.keyword=k),this.addKeyword(F)}}function A(){const U={...this.opts};for(const k of $)delete U[k];return U}const M={log(){},warn(){},error(){}};function L(U){if(U===!1)return M;if(U===void 0)return console;if(U.log&&U.warn&&U.error)return U;throw new Error("logger must implement log, warn and error methods")}const N=/^[a-z_$][a-z0-9_$:-]*$/i;function z(U,k){const{RULES:F}=this;if((0,a.eachItem)(U,j=>{if(F.keywords[j])throw new Error(`Keyword ${j} is already defined`);if(!N.test(j))throw new Error(`Keyword ${j} has invalid name`)}),!!k&&k.$data&&!("code"in k||"validate"in k))throw new Error('$data keyword must have "code" or "validate" function')}function ne(U,k,F){var j;const b=k?.post;if(F&&b)throw new Error('keyword with "post" flag cannot have "type"');const{RULES:P}=this;let x=b?P.post:P.rules.find(({type:G})=>G===F);if(x||(x={type:F,rules:[]},P.rules.push(x)),P.keywords[U]=!0,!k)return;const B={keyword:U,definition:{...k,type:(0,u.getJSONTypes)(k.type),schemaType:(0,u.getJSONTypes)(k.schemaType)}};k.before?fe.call(this,x,B,k.before):x.rules.push(B),P.all[U]=B,(j=k.implements)===null||j===void 0||j.forEach(G=>this.addKeyword(G))}function fe(U,k,F){const j=U.rules.findIndex(b=>b.keyword===F);j>=0?U.rules.splice(j,0,k):(U.rules.push(k),this.logger.warn(`rule ${F} is not defined`))}function le(U){let{metaSchema:k}=U;k!==void 0&&(U.$data&&this.opts.$data&&(k=we(k)),U.validateSchema=this.compile(k,!0))}const X={$ref:"https://raw.githubusercontent.com/ajv-validator/ajv/master/lib/refs/data.json#"};function we(U){return{anyOf:[U,X]}}})(wr)),wr}var mt={},pt={},ht={},On;function Io(){if(On)return ht;On=1,Object.defineProperty(ht,"__esModule",{value:!0});const e={keyword:"id",code(){throw new Error('NOT SUPPORTED: keyword "id", use "$id" for schema ID')}};return ht.default=e,ht}var qe={},Mn;function Br(){if(Mn)return qe;Mn=1,Object.defineProperty(qe,"__esModule",{value:!0}),qe.callRef=qe.getValidate=void 0;const e=hr(),t=Ne(),r=W(),n=Ce(),o=yr(),i=Z(),s={keyword:"$ref",schemaType:"string",code(u){const{gen:a,schema:f,it:m}=u,{baseId:y,schemaEnv:$,validateName:S,opts:g,self:_}=m,{root:p}=$;if((f==="#"||f==="#/")&&y===p.baseId)return E();const w=o.resolveRef.call(_,p,y,f);if(w===void 0)throw new e.default(m.opts.uriResolver,y,f);if(w instanceof o.SchemaEnv)return d(w);return h(w);function E(){if($===p)return l(u,S,$,$.$async);const v=a.scopeValue("root",{ref:p});return l(u,(0,r._)`${v}.validate`,p,p.$async)}function d(v){const I=c(u,v);l(u,I,v,v.$async)}function h(v){const I=a.scopeValue("schema",g.code.source===!0?{ref:v,code:(0,r.stringify)(v)}:{ref:v}),O=a.name("valid"),A=u.subschema({schema:v,dataTypes:[],schemaPath:r.nil,topSchemaRef:I,errSchemaPath:f},O);u.mergeEvaluated(A),u.ok(O)}}};function c(u,a){const{gen:f}=u;return a.validate?f.scopeValue("validate",{ref:a.validate}):(0,r._)`${f.scopeValue("wrapper",{ref:a})}.validate`}qe.getValidate=c;function l(u,a,f,m){const{gen:y,it:$}=u,{allErrors:S,schemaEnv:g,opts:_}=$,p=_.passContext?n.default.this:r.nil;m?w():E();function w(){if(!g.$async)throw new Error("async schema referenced by sync schema");const v=y.let("valid");y.try(()=>{y.code((0,r._)`await ${(0,t.callValidateCode)(u,a,p)}`),h(a),S||y.assign(v,!0)},I=>{y.if((0,r._)`!(${I} instanceof ${$.ValidationError})`,()=>y.throw(I)),d(I),S||y.assign(v,!1)}),u.ok(v)}function E(){u.result((0,t.callValidateCode)(u,a,p),()=>h(a),()=>d(a))}function d(v){const I=(0,r._)`${v}.errors`;y.assign(n.default.vErrors,(0,r._)`${n.default.vErrors} === null ? ${I} : ${n.default.vErrors}.concat(${I})`),y.assign(n.default.errors,(0,r._)`${n.default.vErrors}.length`)}function h(v){var I;if(!$.opts.unevaluated)return;const O=(I=f?.validate)===null||I===void 0?void 0:I.evaluated;if($.props!==!0)if(O&&!O.dynamicProps)O.props!==void 0&&($.props=i.mergeEvaluated.props(y,O.props,$.props));else{const A=y.var("props",(0,r._)`${v}.evaluated.props`);$.props=i.mergeEvaluated.props(y,A,$.props,r.Name)}if($.items!==!0)if(O&&!O.dynamicItems)O.items!==void 0&&($.items=i.mergeEvaluated.items(y,O.items,$.items));else{const A=y.var("items",(0,r._)`${v}.evaluated.items`);$.items=i.mergeEvaluated.items(y,A,$.items,r.Name)}}}return qe.callRef=l,qe.default=s,qe}var qn;function Ro(){if(qn)return pt;qn=1,Object.defineProperty(pt,"__esModule",{value:!0});const e=Io(),t=Br(),r=["$schema","$id","$defs","$vocabulary",{keyword:"$comment"},"definitions",e.default,t.default];return pt.default=r,pt}var yt={},gt={},xn;function Ao(){if(xn)return gt;xn=1,Object.defineProperty(gt,"__esModule",{value:!0});const e=W(),t=e.operators,r={maximum:{okStr:"<=",ok:t.LTE,fail:t.GT},minimum:{okStr:">=",ok:t.GTE,fail:t.LT},exclusiveMaximum:{okStr:"<",ok:t.LT,fail:t.GTE},exclusiveMinimum:{okStr:">",ok:t.GT,fail:t.LTE}},n={message:({keyword:i,schemaCode:s})=>(0,e.str)`must be ${r[i].okStr} ${s}`,params:({keyword:i,schemaCode:s})=>(0,e._)`{comparison: ${r[i].okStr}, limit: ${s}}`},o={keyword:Object.keys(r),type:"number",schemaType:"number",$data:!0,error:n,code(i){const{keyword:s,data:c,schemaCode:l}=i;i.fail$data((0,e._)`${c} ${r[s].fail} ${l} || isNaN(${c})`)}};return gt.default=o,gt}var vt={},Ln;function ko(){if(Ln)return vt;Ln=1,Object.defineProperty(vt,"__esModule",{value:!0});const e=W(),r={keyword:"multipleOf",type:"number",schemaType:"number",$data:!0,error:{message:({schemaCode:n})=>(0,e.str)`must be multiple of ${n}`,params:({schemaCode:n})=>(0,e._)`{multipleOf: ${n}}`},code(n){const{gen:o,data:i,schemaCode:s,it:c}=n,l=c.opts.multipleOfPrecision,u=o.let("res"),a=l?(0,e._)`Math.abs(Math.round(${u}) - ${u}) > 1e-${l}`:(0,e._)`${u} !== parseInt(${u})`;n.fail$data((0,e._)`(${s} === 0 || (${u} = ${i}/${s}, ${a}))`)}};return vt.default=r,vt}var bt={},_t={},Dn;function Co(){if(Dn)return _t;Dn=1,Object.defineProperty(_t,"__esModule",{value:!0});function e(t){const r=t.length;let n=0,o=0,i;for(;o=55296&&i<=56319&&o(0,e._)`{limit: ${i}}`},code(i){const{keyword:s,data:c,schemaCode:l,it:u}=i,a=s==="maxLength"?e.operators.GT:e.operators.LT,f=u.opts.unicode===!1?(0,e._)`${c}.length`:(0,e._)`${(0,t.useFunc)(i.gen,r.default)}(${c})`;i.fail$data((0,e._)`${f} ${a} ${l}`)}};return bt.default=o,bt}var $t={},Un;function jo(){if(Un)return $t;Un=1,Object.defineProperty($t,"__esModule",{value:!0});const e=Ne(),t=Z(),r=W(),o={keyword:"pattern",type:"string",schemaType:"string",$data:!0,error:{message:({schemaCode:i})=>(0,r.str)`must match pattern "${i}"`,params:({schemaCode:i})=>(0,r._)`{pattern: ${i}}`},code(i){const{gen:s,data:c,$data:l,schema:u,schemaCode:a,it:f}=i,m=f.opts.unicodeRegExp?"u":"";if(l){const{regExp:y}=f.opts.code,$=y.code==="new RegExp"?(0,r._)`new RegExp`:(0,t.useFunc)(s,y),S=s.let("valid");s.try(()=>s.assign(S,(0,r._)`${$}(${a}, ${m}).test(${c})`),()=>s.assign(S,!1)),i.fail$data((0,r._)`!${S}`)}else{const y=(0,e.usePattern)(i,u);i.fail$data((0,r._)`!${y}.test(${c})`)}}};return $t.default=o,$t}var wt={},zn;function To(){if(zn)return wt;zn=1,Object.defineProperty(wt,"__esModule",{value:!0});const e=W(),r={keyword:["maxProperties","minProperties"],type:"object",schemaType:"number",$data:!0,error:{message({keyword:n,schemaCode:o}){const i=n==="maxProperties"?"more":"fewer";return(0,e.str)`must NOT have ${i} than ${o} properties`},params:({schemaCode:n})=>(0,e._)`{limit: ${n}}`},code(n){const{keyword:o,data:i,schemaCode:s}=n,c=o==="maxProperties"?e.operators.GT:e.operators.LT;n.fail$data((0,e._)`Object.keys(${i}).length ${c} ${s}`)}};return wt.default=r,wt}var St={},Vn;function Oo(){if(Vn)return St;Vn=1,Object.defineProperty(St,"__esModule",{value:!0});const e=Ne(),t=W(),r=Z(),o={keyword:"required",type:"object",schemaType:"array",$data:!0,error:{message:({params:{missingProperty:i}})=>(0,t.str)`must have required property '${i}'`,params:({params:{missingProperty:i}})=>(0,t._)`{missingProperty: ${i}}`},code(i){const{gen:s,schema:c,schemaCode:l,data:u,$data:a,it:f}=i,{opts:m}=f;if(!a&&c.length===0)return;const y=c.length>=m.loopRequired;if(f.allErrors?$():S(),m.strictRequired){const p=i.parentSchema.properties,{definedProperties:w}=i.it;for(const E of c)if(p?.[E]===void 0&&!w.has(E)){const d=f.schemaEnv.baseId+f.errSchemaPath,h=`required property "${E}" is not defined at "${d}" (strictRequired)`;(0,r.checkStrictMode)(f,h,f.opts.strictRequired)}}function $(){if(y||a)i.block$data(t.nil,g);else for(const p of c)(0,e.checkReportMissingProp)(i,p)}function S(){const p=s.let("missing");if(y||a){const w=s.let("valid",!0);i.block$data(w,()=>_(p,w)),i.ok(w)}else s.if((0,e.checkMissingProp)(i,c,p)),(0,e.reportMissingProp)(i,p),s.else()}function g(){s.forOf("prop",l,p=>{i.setParams({missingProperty:p}),s.if((0,e.noPropertyInData)(s,u,p,m.ownProperties),()=>i.error())})}function _(p,w){i.setParams({missingProperty:p}),s.forOf(p,l,()=>{s.assign(w,(0,e.propertyInData)(s,u,p,m.ownProperties)),s.if((0,t.not)(w),()=>{i.error(),s.break()})},t.nil)}}};return St.default=o,St}var Et={},Kn;function Mo(){if(Kn)return Et;Kn=1,Object.defineProperty(Et,"__esModule",{value:!0});const e=W(),r={keyword:["maxItems","minItems"],type:"array",schemaType:"number",$data:!0,error:{message({keyword:n,schemaCode:o}){const i=n==="maxItems"?"more":"fewer";return(0,e.str)`must NOT have ${i} than ${o} items`},params:({schemaCode:n})=>(0,e._)`{limit: ${n}}`},code(n){const{keyword:o,data:i,schemaCode:s}=n,c=o==="maxItems"?e.operators.GT:e.operators.LT;n.fail$data((0,e._)`${i}.length ${c} ${s}`)}};return Et.default=r,Et}var Pt={},It={},Bn;function Hr(){if(Bn)return It;Bn=1,Object.defineProperty(It,"__esModule",{value:!0});const e=Ji();return e.code='require("ajv/dist/runtime/equal").default',It.default=e,It}var Hn;function qo(){if(Hn)return Pt;Hn=1,Object.defineProperty(Pt,"__esModule",{value:!0});const e=dr(),t=W(),r=Z(),n=Hr(),i={keyword:"uniqueItems",type:"array",schemaType:"boolean",$data:!0,error:{message:({params:{i:s,j:c}})=>(0,t.str)`must NOT have duplicate items (items ## ${c} and ${s} are identical)`,params:({params:{i:s,j:c}})=>(0,t._)`{i: ${s}, j: ${c}}`},code(s){const{gen:c,data:l,$data:u,schema:a,parentSchema:f,schemaCode:m,it:y}=s;if(!u&&!a)return;const $=c.let("valid"),S=f.items?(0,e.getSchemaTypes)(f.items):[];s.block$data($,g,(0,t._)`${m} === false`),s.ok($);function g(){const E=c.let("i",(0,t._)`${l}.length`),d=c.let("j");s.setParams({i:E,j:d}),c.assign($,!0),c.if((0,t._)`${E} > 1`,()=>(_()?p:w)(E,d))}function _(){return S.length>0&&!S.some(E=>E==="object"||E==="array")}function p(E,d){const h=c.name("item"),v=(0,e.checkDataTypes)(S,h,y.opts.strictNumbers,e.DataType.Wrong),I=c.const("indices",(0,t._)`{}`);c.for((0,t._)`;${E}--;`,()=>{c.let(h,(0,t._)`${l}[${E}]`),c.if(v,(0,t._)`continue`),S.length>1&&c.if((0,t._)`typeof ${h} == "string"`,(0,t._)`${h} += "_"`),c.if((0,t._)`typeof ${I}[${h}] == "number"`,()=>{c.assign(d,(0,t._)`${I}[${h}]`),s.error(),c.assign($,!1).break()}).code((0,t._)`${I}[${h}] = ${E}`)})}function w(E,d){const h=(0,r.useFunc)(c,n.default),v=c.name("outer");c.label(v).for((0,t._)`;${E}--;`,()=>c.for((0,t._)`${d} = ${E}; ${d}--;`,()=>c.if((0,t._)`${h}(${l}[${E}], ${l}[${d}])`,()=>{s.error(),c.assign($,!1).break(v)})))}}};return Pt.default=i,Pt}var Rt={},Gn;function xo(){if(Gn)return Rt;Gn=1,Object.defineProperty(Rt,"__esModule",{value:!0});const e=W(),t=Z(),r=Hr(),o={keyword:"const",$data:!0,error:{message:"must be equal to constant",params:({schemaCode:i})=>(0,e._)`{allowedValue: ${i}}`},code(i){const{gen:s,data:c,$data:l,schemaCode:u,schema:a}=i;l||a&&typeof a=="object"?i.fail$data((0,e._)`!${(0,t.useFunc)(s,r.default)}(${c}, ${u})`):i.fail((0,e._)`${a} !== ${c}`)}};return Rt.default=o,Rt}var At={},Wn;function Lo(){if(Wn)return At;Wn=1,Object.defineProperty(At,"__esModule",{value:!0});const e=W(),t=Z(),r=Hr(),o={keyword:"enum",schemaType:"array",$data:!0,error:{message:"must be equal to one of the allowed values",params:({schemaCode:i})=>(0,e._)`{allowedValues: ${i}}`},code(i){const{gen:s,data:c,$data:l,schema:u,schemaCode:a,it:f}=i;if(!l&&u.length===0)throw new Error("enum must have non-empty array");const m=u.length>=f.opts.loopEnum;let y;const $=()=>y??(y=(0,t.useFunc)(s,r.default));let S;if(m||l)S=s.let("valid"),i.block$data(S,g);else{if(!Array.isArray(u))throw new Error("ajv implementation error");const p=s.const("vSchema",a);S=(0,e.or)(...u.map((w,E)=>_(p,E)))}i.pass(S);function g(){s.assign(S,!1),s.forOf("v",a,p=>s.if((0,e._)`${$()}(${c}, ${p})`,()=>s.assign(S,!0).break()))}function _(p,w){const E=u[w];return typeof E=="object"&&E!==null?(0,e._)`${$()}(${c}, ${p}[${w}])`:(0,e._)`${c} === ${E}`}}};return At.default=o,At}var Xn;function Do(){if(Xn)return yt;Xn=1,Object.defineProperty(yt,"__esModule",{value:!0});const e=Ao(),t=ko(),r=No(),n=jo(),o=To(),i=Oo(),s=Mo(),c=qo(),l=xo(),u=Lo(),a=[e.default,t.default,r.default,n.default,o.default,i.default,s.default,c.default,{keyword:"type",schemaType:["string","array"]},{keyword:"nullable",schemaType:"boolean"},l.default,u.default];return yt.default=a,yt}var kt={},Xe={},Yn;function Zi(){if(Yn)return Xe;Yn=1,Object.defineProperty(Xe,"__esModule",{value:!0}),Xe.validateAdditionalItems=void 0;const e=W(),t=Z(),n={keyword:"additionalItems",type:"array",schemaType:["boolean","object"],before:"uniqueItems",error:{message:({params:{len:i}})=>(0,e.str)`must NOT have more than ${i} items`,params:({params:{len:i}})=>(0,e._)`{limit: ${i}}`},code(i){const{parentSchema:s,it:c}=i,{items:l}=s;if(!Array.isArray(l)){(0,t.checkStrictMode)(c,'"additionalItems" is ignored when "items" is not an array of schemas');return}o(i,l)}};function o(i,s){const{gen:c,schema:l,data:u,keyword:a,it:f}=i;f.items=!0;const m=c.const("len",(0,e._)`${u}.length`);if(l===!1)i.setParams({len:s.length}),i.pass((0,e._)`${m} <= ${s.length}`);else if(typeof l=="object"&&!(0,t.alwaysValidSchema)(f,l)){const $=c.var("valid",(0,e._)`${m} <= ${s.length}`);c.if((0,e.not)($),()=>y($)),i.ok($)}function y($){c.forRange("i",s.length,m,S=>{i.subschema({keyword:a,dataProp:S,dataPropType:t.Type.Num},$),f.allErrors||c.if((0,e.not)($),()=>c.break())})}}return Xe.validateAdditionalItems=o,Xe.default=n,Xe}var Ct={},Ye={},Jn;function ea(){if(Jn)return Ye;Jn=1,Object.defineProperty(Ye,"__esModule",{value:!0}),Ye.validateTuple=void 0;const e=W(),t=Z(),r=Ne(),n={keyword:"items",type:"array",schemaType:["object","array","boolean"],before:"uniqueItems",code(i){const{schema:s,it:c}=i;if(Array.isArray(s))return o(i,"additionalItems",s);c.items=!0,!(0,t.alwaysValidSchema)(c,s)&&i.ok((0,r.validateArray)(i))}};function o(i,s,c=i.schema){const{gen:l,parentSchema:u,data:a,keyword:f,it:m}=i;S(u),m.opts.unevaluated&&c.length&&m.items!==!0&&(m.items=t.mergeEvaluated.items(l,c.length,m.items));const y=l.name("valid"),$=l.const("len",(0,e._)`${a}.length`);c.forEach((g,_)=>{(0,t.alwaysValidSchema)(m,g)||(l.if((0,e._)`${$} > ${_}`,()=>i.subschema({keyword:f,schemaProp:_,dataProp:_},y)),i.ok(y))});function S(g){const{opts:_,errSchemaPath:p}=m,w=c.length,E=w===g.minItems&&(w===g.maxItems||g[s]===!1);if(_.strictTuples&&!E){const d=`"${f}" is ${w}-tuple, but minItems or maxItems/${s} are not specified or different at path "${p}"`;(0,t.checkStrictMode)(m,d,_.strictTuples)}}}return Ye.validateTuple=o,Ye.default=n,Ye}var Qn;function Fo(){if(Qn)return Ct;Qn=1,Object.defineProperty(Ct,"__esModule",{value:!0});const e=ea(),t={keyword:"prefixItems",type:"array",schemaType:["array"],before:"uniqueItems",code:r=>(0,e.validateTuple)(r,"items")};return Ct.default=t,Ct}var Nt={},Zn;function Uo(){if(Zn)return Nt;Zn=1,Object.defineProperty(Nt,"__esModule",{value:!0});const e=W(),t=Z(),r=Ne(),n=Zi(),i={keyword:"items",type:"array",schemaType:["object","boolean"],before:"uniqueItems",error:{message:({params:{len:s}})=>(0,e.str)`must NOT have more than ${s} items`,params:({params:{len:s}})=>(0,e._)`{limit: ${s}}`},code(s){const{schema:c,parentSchema:l,it:u}=s,{prefixItems:a}=l;u.items=!0,!(0,t.alwaysValidSchema)(u,c)&&(a?(0,n.validateAdditionalItems)(s,a):s.ok((0,r.validateArray)(s)))}};return Nt.default=i,Nt}var jt={},ei;function zo(){if(ei)return jt;ei=1,Object.defineProperty(jt,"__esModule",{value:!0});const e=W(),t=Z(),n={keyword:"contains",type:"array",schemaType:["object","boolean"],before:"uniqueItems",trackErrors:!0,error:{message:({params:{min:o,max:i}})=>i===void 0?(0,e.str)`must contain at least ${o} valid item(s)`:(0,e.str)`must contain at least ${o} and no more than ${i} valid item(s)`,params:({params:{min:o,max:i}})=>i===void 0?(0,e._)`{minContains: ${o}}`:(0,e._)`{minContains: ${o}, maxContains: ${i}}`},code(o){const{gen:i,schema:s,parentSchema:c,data:l,it:u}=o;let a,f;const{minContains:m,maxContains:y}=c;u.opts.next?(a=m===void 0?1:m,f=y):a=1;const $=i.const("len",(0,e._)`${l}.length`);if(o.setParams({min:a,max:f}),f===void 0&&a===0){(0,t.checkStrictMode)(u,'"minContains" == 0 without "maxContains": "contains" keyword ignored');return}if(f!==void 0&&a>f){(0,t.checkStrictMode)(u,'"minContains" > "maxContains" is always invalid'),o.fail();return}if((0,t.alwaysValidSchema)(u,s)){let w=(0,e._)`${$} >= ${a}`;f!==void 0&&(w=(0,e._)`${w} && ${$} <= ${f}`),o.pass(w);return}u.items=!0;const S=i.name("valid");f===void 0&&a===1?_(S,()=>i.if(S,()=>i.break())):a===0?(i.let(S,!0),f!==void 0&&i.if((0,e._)`${l}.length > 0`,g)):(i.let(S,!1),g()),o.result(S,()=>o.reset());function g(){const w=i.name("_valid"),E=i.let("count",0);_(w,()=>i.if(w,()=>p(E)))}function _(w,E){i.forRange("i",0,$,d=>{o.subschema({keyword:"contains",dataProp:d,dataPropType:t.Type.Num,compositeRule:!0},w),E()})}function p(w){i.code((0,e._)`${w}++`),f===void 0?i.if((0,e._)`${w} >= ${a}`,()=>i.assign(S,!0).break()):(i.if((0,e._)`${w} > ${f}`,()=>i.assign(S,!1).break()),a===1?i.assign(S,!0):i.if((0,e._)`${w} >= ${a}`,()=>i.assign(S,!0)))}}};return jt.default=n,jt}var Nr={},ti;function Gr(){return ti||(ti=1,(function(e){Object.defineProperty(e,"__esModule",{value:!0}),e.validateSchemaDeps=e.validatePropertyDeps=e.error=void 0;const t=W(),r=Z(),n=Ne();e.error={message:({params:{property:l,depsCount:u,deps:a}})=>{const f=u===1?"property":"properties";return(0,t.str)`must have ${f} ${a} when property ${l} is present`},params:({params:{property:l,depsCount:u,deps:a,missingProperty:f}})=>(0,t._)`{property: ${l}, + || ${I} === "boolean" || ${h} === null`).assign(O,(0,n._)`[${h}]`)}}}function m({gen:p,parentData:w,parentDataProperty:E},d){p.if((0,n._)`${w} !== undefined`,()=>p.assign((0,n._)`${w}[${E}]`,d))}function y(p,w,E,d=i.Correct){const h=d===i.Correct?n.operators.EQ:n.operators.NEQ;let v;switch(p){case"null":return(0,n._)`${w} ${h} null`;case"array":v=(0,n._)`Array.isArray(${w})`;break;case"object":v=(0,n._)`${w} && typeof ${w} == "object" && !Array.isArray(${w})`;break;case"integer":v=I((0,n._)`!(${w} % 1) && !isNaN(${w})`);break;case"number":v=I();break;default:return(0,n._)`typeof ${w} ${h} ${p}`}return d===i.Correct?v:(0,n.not)(v);function I(O=n.nil){return(0,n.and)((0,n._)`typeof ${w} == "number"`,O,E?(0,n._)`isFinite(${w})`:n.nil)}}ge.checkDataType=y;function $(p,w,E,d){if(p.length===1)return y(p[0],w,E,d);let h;const v=(0,o.toHash)(p);if(v.array&&v.object){const I=(0,n._)`typeof ${w} != "object"`;h=v.null?I:(0,n._)`!${w} || ${I}`,delete v.null,delete v.array,delete v.object}else h=n.nil;v.number&&delete v.integer;for(const I in v)h=(0,n.and)(h,y(I,w,E,d));return h}ge.checkDataTypes=$;const S={message:({schema:p})=>`must be ${p}`,params:({schema:p,schemaValue:w})=>typeof p=="string"?(0,n._)`{type: ${p}}`:(0,n._)`{type: ${w}}`};function g(p){const w=_(p);(0,r.reportError)(w,S)}ge.reportTypeError=g;function _(p){const{gen:w,data:E,schema:d}=p,h=(0,o.schemaRefOrVal)(p,d,"type");return{gen:w,keyword:"type",data:E,schema:d.type,schemaCode:h,schemaValue:h,parentSchema:d,params:{},it:p}}return ge}var tt={},bn;function lo(){if(bn)return tt;bn=1,Object.defineProperty(tt,"__esModule",{value:!0}),tt.assignDefaults=void 0;const e=W(),t=Z();function r(o,i){const{properties:s,items:c}=o.schema;if(i==="object"&&s)for(const l in s)n(o,l,s[l].default);else i==="array"&&Array.isArray(c)&&c.forEach((l,u)=>n(o,u,l.default))}tt.assignDefaults=r;function n(o,i,s){const{gen:c,compositeRule:l,data:u,opts:a}=o;if(s===void 0)return;const f=(0,e._)`${u}${(0,e.getProperty)(i)}`;if(l){(0,t.checkStrictMode)(o,`default is ignored for: ${f}`);return}let m=(0,e._)`${f} === undefined`;a.useDefaults==="empty"&&(m=(0,e._)`${m} || ${f} === null || ${f} === ""`),c.if(m,(0,e._)`${f} = ${(0,e.stringify)(s)}`)}return tt}var Ae={},ae={},_n;function Ne(){if(_n)return ae;_n=1,Object.defineProperty(ae,"__esModule",{value:!0}),ae.validateUnion=ae.validateArray=ae.usePattern=ae.callValidateCode=ae.schemaProperties=ae.allSchemaProperties=ae.noPropertyInData=ae.propertyInData=ae.isOwnProperty=ae.hasPropFunc=ae.reportMissingProp=ae.checkMissingProp=ae.checkReportMissingProp=void 0;const e=W(),t=Z(),r=Ce(),n=Z();function o(p,w){const{gen:E,data:d,it:h}=p;E.if(a(E,d,w,h.opts.ownProperties),()=>{p.setParams({missingProperty:(0,e._)`${w}`},!0),p.error()})}ae.checkReportMissingProp=o;function i({gen:p,data:w,it:{opts:E}},d,h){return(0,e.or)(...d.map(v=>(0,e.and)(a(p,w,v,E.ownProperties),(0,e._)`${h} = ${v}`)))}ae.checkMissingProp=i;function s(p,w){p.setParams({missingProperty:w},!0),p.error()}ae.reportMissingProp=s;function c(p){return p.scopeValue("func",{ref:Object.prototype.hasOwnProperty,code:(0,e._)`Object.prototype.hasOwnProperty`})}ae.hasPropFunc=c;function l(p,w,E){return(0,e._)`${c(p)}.call(${w}, ${E})`}ae.isOwnProperty=l;function u(p,w,E,d){const h=(0,e._)`${w}${(0,e.getProperty)(E)} !== undefined`;return d?(0,e._)`${h} && ${l(p,w,E)}`:h}ae.propertyInData=u;function a(p,w,E,d){const h=(0,e._)`${w}${(0,e.getProperty)(E)} === undefined`;return d?(0,e.or)(h,(0,e.not)(l(p,w,E))):h}ae.noPropertyInData=a;function f(p){return p?Object.keys(p).filter(w=>w!=="__proto__"):[]}ae.allSchemaProperties=f;function m(p,w){return f(w).filter(E=>!(0,t.alwaysValidSchema)(p,w[E]))}ae.schemaProperties=m;function y({schemaCode:p,data:w,it:{gen:E,topSchemaRef:d,schemaPath:h,errorPath:v},it:I},O,A,M){const L=M?(0,e._)`${p}, ${w}, ${d}${h}`:w,N=[[r.default.instancePath,(0,e.strConcat)(r.default.instancePath,v)],[r.default.parentData,I.parentData],[r.default.parentDataProperty,I.parentDataProperty],[r.default.rootData,r.default.rootData]];I.opts.dynamicRef&&N.push([r.default.dynamicAnchors,r.default.dynamicAnchors]);const z=(0,e._)`${L}, ${E.object(...N)}`;return A!==e.nil?(0,e._)`${O}.call(${A}, ${z})`:(0,e._)`${O}(${z})`}ae.callValidateCode=y;const $=(0,e._)`new RegExp`;function S({gen:p,it:{opts:w}},E){const d=w.unicodeRegExp?"u":"",{regExp:h}=w.code,v=h(E,d);return p.scopeValue("pattern",{key:v.toString(),ref:v,code:(0,e._)`${h.code==="new RegExp"?$:(0,n.useFunc)(p,h)}(${E}, ${d})`})}ae.usePattern=S;function g(p){const{gen:w,data:E,keyword:d,it:h}=p,v=w.name("valid");if(h.allErrors){const O=w.let("valid",!0);return I(()=>w.assign(O,!1)),O}return w.var(v,!0),I(()=>w.break()),v;function I(O){const A=w.const("len",(0,e._)`${E}.length`);w.forRange("i",0,A,M=>{p.subschema({keyword:d,dataProp:M,dataPropType:t.Type.Num},v),w.if((0,e.not)(v),O)})}}ae.validateArray=g;function _(p){const{gen:w,schema:E,keyword:d,it:h}=p;if(!Array.isArray(E))throw new Error("ajv implementation error");if(E.some(A=>(0,t.alwaysValidSchema)(h,A))&&!h.opts.unevaluated)return;const I=w.let("valid",!1),O=w.name("_valid");w.block(()=>E.forEach((A,M)=>{const L=p.subschema({keyword:d,schemaProp:M,compositeRule:!0},O);w.assign(I,(0,e._)`${I} || ${O}`),p.mergeValidEvaluated(L,O)||w.if((0,e.not)(I))})),p.result(I,()=>p.reset(),()=>p.error(!0))}return ae.validateUnion=_,ae}var $n;function fo(){if($n)return Ae;$n=1,Object.defineProperty(Ae,"__esModule",{value:!0}),Ae.validateKeywordUsage=Ae.validSchemaType=Ae.funcKeywordCode=Ae.macroKeywordCode=void 0;const e=W(),t=Ce(),r=Ne(),n=mr();function o(m,y){const{gen:$,keyword:S,schema:g,parentSchema:_,it:p}=m,w=y.macro.call(p.self,g,_,p),E=u($,S,w);p.opts.validateSchema!==!1&&p.self.validateSchema(w,!0);const d=$.name("valid");m.subschema({schema:w,schemaPath:e.nil,errSchemaPath:`${p.errSchemaPath}/${S}`,topSchemaRef:E,compositeRule:!0},d),m.pass(d,()=>m.error(!0))}Ae.macroKeywordCode=o;function i(m,y){var $;const{gen:S,keyword:g,schema:_,parentSchema:p,$data:w,it:E}=m;l(E,y);const d=!w&&y.compile?y.compile.call(E.self,_,p,E):y.validate,h=u(S,g,d),v=S.let("valid");m.block$data(v,I),m.ok(($=y.valid)!==null&&$!==void 0?$:v);function I(){if(y.errors===!1)M(),y.modifying&&s(m),L(()=>m.error());else{const N=y.async?O():A();y.modifying&&s(m),L(()=>c(m,N))}}function O(){const N=S.let("ruleErrs",null);return S.try(()=>M((0,e._)`await `),z=>S.assign(v,!1).if((0,e._)`${z} instanceof ${E.ValidationError}`,()=>S.assign(N,(0,e._)`${z}.errors`),()=>S.throw(z))),N}function A(){const N=(0,e._)`${h}.errors`;return S.assign(N,null),M(e.nil),N}function M(N=y.async?(0,e._)`await `:e.nil){const z=E.opts.passContext?t.default.this:t.default.self,ne=!("compile"in y&&!w||y.schema===!1);S.assign(v,(0,e._)`${N}${(0,r.callValidateCode)(m,h,z,ne)}`,y.modifying)}function L(N){var z;S.if((0,e.not)((z=y.valid)!==null&&z!==void 0?z:v),N)}}Ae.funcKeywordCode=i;function s(m){const{gen:y,data:$,it:S}=m;y.if(S.parentData,()=>y.assign($,(0,e._)`${S.parentData}[${S.parentDataProperty}]`))}function c(m,y){const{gen:$}=m;$.if((0,e._)`Array.isArray(${y})`,()=>{$.assign(t.default.vErrors,(0,e._)`${t.default.vErrors} === null ? ${y} : ${t.default.vErrors}.concat(${y})`).assign(t.default.errors,(0,e._)`${t.default.vErrors}.length`),(0,n.extendErrors)(m)},()=>m.error())}function l({schemaEnv:m},y){if(y.async&&!m.$async)throw new Error("async keyword in sync schema")}function u(m,y,$){if($===void 0)throw new Error(`keyword "${y}" failed to compile`);return m.scopeValue("keyword",typeof $=="function"?{ref:$}:{ref:$,code:(0,e.stringify)($)})}function a(m,y,$=!1){return!y.length||y.some(S=>S==="array"?Array.isArray(m):S==="object"?m&&typeof m=="object"&&!Array.isArray(m):typeof m==S||$&&typeof m>"u")}Ae.validSchemaType=a;function f({schema:m,opts:y,self:$,errSchemaPath:S},g,_){if(Array.isArray(g.keyword)?!g.keyword.includes(_):g.keyword!==_)throw new Error("ajv implementation error");const p=g.dependencies;if(p?.some(w=>!Object.prototype.hasOwnProperty.call(m,w)))throw new Error(`parent schema must have dependencies of ${_}: ${p.join(",")}`);if(g.validateSchema&&!g.validateSchema(m[_])){const E=`keyword "${_}" value is invalid at path "${S}": `+$.errorsText(g.validateSchema.errors);if(y.validateSchema==="log")$.logger.error(E);else throw new Error(E)}}return Ae.validateKeywordUsage=f,Ae}var Me={},wn;function mo(){if(wn)return Me;wn=1,Object.defineProperty(Me,"__esModule",{value:!0}),Me.extendSubschemaMode=Me.extendSubschemaData=Me.getSubschema=void 0;const e=W(),t=Z();function r(i,{keyword:s,schemaProp:c,schema:l,schemaPath:u,errSchemaPath:a,topSchemaRef:f}){if(s!==void 0&&l!==void 0)throw new Error('both "keyword" and "schema" passed, only one allowed');if(s!==void 0){const m=i.schema[s];return c===void 0?{schema:m,schemaPath:(0,e._)`${i.schemaPath}${(0,e.getProperty)(s)}`,errSchemaPath:`${i.errSchemaPath}/${s}`}:{schema:m[c],schemaPath:(0,e._)`${i.schemaPath}${(0,e.getProperty)(s)}${(0,e.getProperty)(c)}`,errSchemaPath:`${i.errSchemaPath}/${s}/${(0,t.escapeFragment)(c)}`}}if(l!==void 0){if(u===void 0||a===void 0||f===void 0)throw new Error('"schemaPath", "errSchemaPath" and "topSchemaRef" are required with "schema"');return{schema:l,schemaPath:u,topSchemaRef:f,errSchemaPath:a}}throw new Error('either "keyword" or "schema" must be passed')}Me.getSubschema=r;function n(i,s,{dataProp:c,dataPropType:l,data:u,dataTypes:a,propertyName:f}){if(u!==void 0&&c!==void 0)throw new Error('both "data" and "dataProp" passed, only one allowed');const{gen:m}=s;if(c!==void 0){const{errorPath:$,dataPathArr:S,opts:g}=s,_=m.let("data",(0,e._)`${s.data}${(0,e.getProperty)(c)}`,!0);y(_),i.errorPath=(0,e.str)`${$}${(0,t.getErrorPath)(c,l,g.jsPropertySyntax)}`,i.parentDataProperty=(0,e._)`${c}`,i.dataPathArr=[...S,i.parentDataProperty]}if(u!==void 0){const $=u instanceof e.Name?u:m.let("data",u,!0);y($),f!==void 0&&(i.propertyName=f)}a&&(i.dataTypes=a);function y($){i.data=$,i.dataLevel=s.dataLevel+1,i.dataTypes=[],s.definedProperties=new Set,i.parentData=s.data,i.dataNames=[...s.dataNames,$]}}Me.extendSubschemaData=n;function o(i,{jtdDiscriminator:s,jtdMetadata:c,compositeRule:l,createErrors:u,allErrors:a}){l!==void 0&&(i.compositeRule=l),u!==void 0&&(i.createErrors=u),a!==void 0&&(i.allErrors=a),i.jtdDiscriminator=s,i.jtdMetadata=c}return Me.extendSubschemaMode=o,Me}var be={},Ar,Sn;function Qi(){return Sn||(Sn=1,Ar=function e(t,r){if(t===r)return!0;if(t&&r&&typeof t=="object"&&typeof r=="object"){if(t.constructor!==r.constructor)return!1;var n,o,i;if(Array.isArray(t)){if(n=t.length,n!=r.length)return!1;for(o=n;o--!==0;)if(!e(t[o],r[o]))return!1;return!0}if(t.constructor===RegExp)return t.source===r.source&&t.flags===r.flags;if(t.valueOf!==Object.prototype.valueOf)return t.valueOf()===r.valueOf();if(t.toString!==Object.prototype.toString)return t.toString()===r.toString();if(i=Object.keys(t),n=i.length,n!==Object.keys(r).length)return!1;for(o=n;o--!==0;)if(!Object.prototype.hasOwnProperty.call(r,i[o]))return!1;for(o=n;o--!==0;){var s=i[o];if(!e(t[s],r[s]))return!1}return!0}return t!==t&&r!==r}),Ar}var kr={exports:{}},En;function po(){if(En)return kr.exports;En=1;var e=kr.exports=function(n,o,i){typeof o=="function"&&(i=o,o={}),i=o.cb||i;var s=typeof i=="function"?i:i.pre||function(){},c=i.post||function(){};t(o,s,c,n,"",n)};e.keywords={additionalItems:!0,items:!0,contains:!0,additionalProperties:!0,propertyNames:!0,not:!0,if:!0,then:!0,else:!0},e.arrayKeywords={items:!0,allOf:!0,anyOf:!0,oneOf:!0},e.propsKeywords={$defs:!0,definitions:!0,properties:!0,patternProperties:!0,dependencies:!0},e.skipKeywords={default:!0,enum:!0,const:!0,required:!0,maximum:!0,minimum:!0,exclusiveMaximum:!0,exclusiveMinimum:!0,multipleOf:!0,maxLength:!0,minLength:!0,pattern:!0,format:!0,maxItems:!0,minItems:!0,uniqueItems:!0,maxProperties:!0,minProperties:!0};function t(n,o,i,s,c,l,u,a,f,m){if(s&&typeof s=="object"&&!Array.isArray(s)){o(s,c,l,u,a,f,m);for(var y in s){var $=s[y];if(Array.isArray($)){if(y in e.arrayKeywords)for(var S=0;S<$.length;S++)t(n,o,i,$[S],c+"/"+y+"/"+S,l,c,y,s,S)}else if(y in e.propsKeywords){if($&&typeof $=="object")for(var g in $)t(n,o,i,$[g],c+"/"+y+"/"+r(g),l,c,y,s,g)}else(y in e.keywords||n.allKeys&&!(y in e.skipKeywords))&&t(n,o,i,$,c+"/"+y,l,c,y,s)}i(s,c,l,u,a,f,m)}}function r(n){return n.replace(/~/g,"~0").replace(/\//g,"~1")}return kr.exports}var Pn;function pr(){if(Pn)return be;Pn=1,Object.defineProperty(be,"__esModule",{value:!0}),be.getSchemaRefs=be.resolveUrl=be.normalizeId=be._getFullPath=be.getFullPath=be.inlineRef=void 0;const e=Z(),t=Qi(),r=po(),n=new Set(["type","format","pattern","maxLength","minLength","maxProperties","minProperties","maxItems","minItems","maximum","minimum","uniqueItems","multipleOf","required","enum","const"]);function o(S,g=!0){return typeof S=="boolean"?!0:g===!0?!s(S):g?c(S)<=g:!1}be.inlineRef=o;const i=new Set(["$ref","$recursiveRef","$recursiveAnchor","$dynamicRef","$dynamicAnchor"]);function s(S){for(const g in S){if(i.has(g))return!0;const _=S[g];if(Array.isArray(_)&&_.some(s)||typeof _=="object"&&s(_))return!0}return!1}function c(S){let g=0;for(const _ in S){if(_==="$ref")return 1/0;if(g++,!n.has(_)&&(typeof S[_]=="object"&&(0,e.eachItem)(S[_],p=>g+=c(p)),g===1/0))return 1/0}return g}function l(S,g="",_){_!==!1&&(g=f(g));const p=S.parse(g);return u(S,p)}be.getFullPath=l;function u(S,g){return S.serialize(g).split("#")[0]+"#"}be._getFullPath=u;const a=/#\/?$/;function f(S){return S?S.replace(a,""):""}be.normalizeId=f;function m(S,g,_){return _=f(_),S.resolve(g,_)}be.resolveUrl=m;const y=/^[a-z_][-a-z0-9._]*$/i;function $(S,g){if(typeof S=="boolean")return{};const{schemaId:_,uriResolver:p}=this.opts,w=f(S[_]||g),E={"":w},d=l(p,w,!1),h={},v=new Set;return r(S,{allKeys:!0},(A,M,L,N)=>{if(N===void 0)return;const z=d+M;let ne=E[N];typeof A[_]=="string"&&(ne=fe.call(this,A[_])),le.call(this,A.$anchor),le.call(this,A.$dynamicAnchor),E[M]=ne;function fe(X){const we=this.opts.uriResolver.resolve;if(X=f(ne?we(ne,X):X),v.has(X))throw O(X);v.add(X);let U=this.refs[X];return typeof U=="string"&&(U=this.refs[U]),typeof U=="object"?I(A,U.schema,X):X!==f(z)&&(X[0]==="#"?(I(A,h[X],X),h[X]=A):this.refs[X]=z),X}function le(X){if(typeof X=="string"){if(!y.test(X))throw new Error(`invalid anchor "${X}"`);fe.call(this,`#${X}`)}}}),h;function I(A,M,L){if(M!==void 0&&!t(A,M))throw O(L)}function O(A){return new Error(`reference "${A}" resolves to more than one schema`)}}return be.getSchemaRefs=$,be}var In;function hr(){if(In)return Te;In=1,Object.defineProperty(Te,"__esModule",{value:!0}),Te.getData=Te.KeywordCxt=Te.validateFunctionCode=void 0;const e=uo(),t=fr(),r=Ji(),n=fr(),o=lo(),i=fo(),s=mo(),c=W(),l=Ce(),u=pr(),a=Z(),f=mr();function m(R){if(d(R)&&(v(R),E(R))){g(R);return}y(R,()=>(0,e.topBoolOrEmptySchema)(R))}Te.validateFunctionCode=m;function y({gen:R,validateName:C,schema:D,schemaEnv:V,opts:H},J){H.code.es5?R.func(C,(0,c._)`${l.default.data}, ${l.default.valCxt}`,V.$async,()=>{R.code((0,c._)`"use strict"; ${p(D,H)}`),S(R,H),R.code(J)}):R.func(C,(0,c._)`${l.default.data}, ${$(H)}`,V.$async,()=>R.code(p(D,H)).code(J))}function $(R){return(0,c._)`{${l.default.instancePath}="", ${l.default.parentData}, ${l.default.parentDataProperty}, ${l.default.rootData}=${l.default.data}${R.dynamicRef?(0,c._)`, ${l.default.dynamicAnchors}={}`:c.nil}}={}`}function S(R,C){R.if(l.default.valCxt,()=>{R.var(l.default.instancePath,(0,c._)`${l.default.valCxt}.${l.default.instancePath}`),R.var(l.default.parentData,(0,c._)`${l.default.valCxt}.${l.default.parentData}`),R.var(l.default.parentDataProperty,(0,c._)`${l.default.valCxt}.${l.default.parentDataProperty}`),R.var(l.default.rootData,(0,c._)`${l.default.valCxt}.${l.default.rootData}`),C.dynamicRef&&R.var(l.default.dynamicAnchors,(0,c._)`${l.default.valCxt}.${l.default.dynamicAnchors}`)},()=>{R.var(l.default.instancePath,(0,c._)`""`),R.var(l.default.parentData,(0,c._)`undefined`),R.var(l.default.parentDataProperty,(0,c._)`undefined`),R.var(l.default.rootData,l.default.data),C.dynamicRef&&R.var(l.default.dynamicAnchors,(0,c._)`{}`)})}function g(R){const{schema:C,opts:D,gen:V}=R;y(R,()=>{D.$comment&&C.$comment&&N(R),A(R),V.let(l.default.vErrors,null),V.let(l.default.errors,0),D.unevaluated&&_(R),I(R),z(R)})}function _(R){const{gen:C,validateName:D}=R;R.evaluated=C.const("evaluated",(0,c._)`${D}.evaluated`),C.if((0,c._)`${R.evaluated}.dynamicProps`,()=>C.assign((0,c._)`${R.evaluated}.props`,(0,c._)`undefined`)),C.if((0,c._)`${R.evaluated}.dynamicItems`,()=>C.assign((0,c._)`${R.evaluated}.items`,(0,c._)`undefined`))}function p(R,C){const D=typeof R=="object"&&R[C.schemaId];return D&&(C.code.source||C.code.process)?(0,c._)`/*# sourceURL=${D} */`:c.nil}function w(R,C){if(d(R)&&(v(R),E(R))){h(R,C);return}(0,e.boolOrEmptySchema)(R,C)}function E({schema:R,self:C}){if(typeof R=="boolean")return!R;for(const D in R)if(C.RULES.all[D])return!0;return!1}function d(R){return typeof R.schema!="boolean"}function h(R,C){const{schema:D,gen:V,opts:H}=R;H.$comment&&D.$comment&&N(R),M(R),L(R);const J=V.const("_errs",l.default.errors);I(R,J),V.var(C,(0,c._)`${J} === ${l.default.errors}`)}function v(R){(0,a.checkUnknownRules)(R),O(R)}function I(R,C){if(R.opts.jtd)return fe(R,[],!1,C);const D=(0,t.getSchemaTypes)(R.schema),V=(0,t.coerceAndCheckDataType)(R,D);fe(R,D,!V,C)}function O(R){const{schema:C,errSchemaPath:D,opts:V,self:H}=R;C.$ref&&V.ignoreKeywordsWithRef&&(0,a.schemaHasRulesButRef)(C,H.RULES)&&H.logger.warn(`$ref: keywords ignored in schema at path "${D}"`)}function A(R){const{schema:C,opts:D}=R;C.default!==void 0&&D.useDefaults&&D.strictSchema&&(0,a.checkStrictMode)(R,"default is ignored in the schema root")}function M(R){const C=R.schema[R.opts.schemaId];C&&(R.baseId=(0,u.resolveUrl)(R.opts.uriResolver,R.baseId,C))}function L(R){if(R.schema.$async&&!R.schemaEnv.$async)throw new Error("async schema in sync schema")}function N({gen:R,schemaEnv:C,schema:D,errSchemaPath:V,opts:H}){const J=D.$comment;if(H.$comment===!0)R.code((0,c._)`${l.default.self}.logger.log(${J})`);else if(typeof H.$comment=="function"){const pe=(0,c.str)`${V}/$comment`,Re=R.scopeValue("root",{ref:C.root});R.code((0,c._)`${l.default.self}.opts.$comment(${J}, ${pe}, ${Re}.schema)`)}}function z(R){const{gen:C,schemaEnv:D,validateName:V,ValidationError:H,opts:J}=R;D.$async?C.if((0,c._)`${l.default.errors} === 0`,()=>C.return(l.default.data),()=>C.throw((0,c._)`new ${H}(${l.default.vErrors})`)):(C.assign((0,c._)`${V}.errors`,l.default.vErrors),J.unevaluated&&ne(R),C.return((0,c._)`${l.default.errors} === 0`))}function ne({gen:R,evaluated:C,props:D,items:V}){D instanceof c.Name&&R.assign((0,c._)`${C}.props`,D),V instanceof c.Name&&R.assign((0,c._)`${C}.items`,V)}function fe(R,C,D,V){const{gen:H,schema:J,data:pe,allErrors:Re,opts:Se,self:Ee}=R,{RULES:he}=Ee;if(J.$ref&&(Se.ignoreKeywordsWithRef||!(0,a.schemaHasRulesButRef)(J,he))){H.block(()=>B(R,"$ref",he.all.$ref.definition));return}Se.jtd||X(R,C),H.block(()=>{for(const Ie of he.rules)He(Ie);He(he.post)});function He(Ie){(0,r.shouldUseGroup)(J,Ie)&&(Ie.type?(H.if((0,n.checkDataType)(Ie.type,pe,Se.strictNumbers)),le(R,Ie),C.length===1&&C[0]===Ie.type&&D&&(H.else(),(0,n.reportTypeError)(R)),H.endIf()):le(R,Ie),Re||H.if((0,c._)`${l.default.errors} === ${V||0}`))}}function le(R,C){const{gen:D,schema:V,opts:{useDefaults:H}}=R;H&&(0,o.assignDefaults)(R,C.type),D.block(()=>{for(const J of C.rules)(0,r.shouldUseRule)(V,J)&&B(R,J.keyword,J.definition,C.type)})}function X(R,C){R.schemaEnv.meta||!R.opts.strictTypes||(we(R,C),R.opts.allowUnionTypes||U(R,C),k(R,R.dataTypes))}function we(R,C){if(C.length){if(!R.dataTypes.length){R.dataTypes=C;return}C.forEach(D=>{j(R.dataTypes,D)||P(R,`type "${D}" not allowed by context "${R.dataTypes.join(",")}"`)}),b(R,C)}}function U(R,C){C.length>1&&!(C.length===2&&C.includes("null"))&&P(R,"use allowUnionTypes to allow union type keyword")}function k(R,C){const D=R.self.RULES.all;for(const V in D){const H=D[V];if(typeof H=="object"&&(0,r.shouldUseRule)(R.schema,H)){const{type:J}=H.definition;J.length&&!J.some(pe=>F(C,pe))&&P(R,`missing type "${J.join(",")}" for keyword "${V}"`)}}}function F(R,C){return R.includes(C)||C==="number"&&R.includes("integer")}function j(R,C){return R.includes(C)||C==="integer"&&R.includes("number")}function b(R,C){const D=[];for(const V of R.dataTypes)j(C,V)?D.push(V):C.includes("integer")&&V==="number"&&D.push("integer");R.dataTypes=D}function P(R,C){const D=R.schemaEnv.baseId+R.errSchemaPath;C+=` at "${D}" (strictTypes)`,(0,a.checkStrictMode)(R,C,R.opts.strictTypes)}class x{constructor(C,D,V){if((0,i.validateKeywordUsage)(C,D,V),this.gen=C.gen,this.allErrors=C.allErrors,this.keyword=V,this.data=C.data,this.schema=C.schema[V],this.$data=D.$data&&C.opts.$data&&this.schema&&this.schema.$data,this.schemaValue=(0,a.schemaRefOrVal)(C,this.schema,V,this.$data),this.schemaType=D.schemaType,this.parentSchema=C.schema,this.params={},this.it=C,this.def=D,this.$data)this.schemaCode=C.gen.const("vSchema",ee(this.$data,C));else if(this.schemaCode=this.schemaValue,!(0,i.validSchemaType)(this.schema,D.schemaType,D.allowUndefined))throw new Error(`${V} value must be ${JSON.stringify(D.schemaType)}`);("code"in D?D.trackErrors:D.errors!==!1)&&(this.errsCount=C.gen.const("_errs",l.default.errors))}result(C,D,V){this.failResult((0,c.not)(C),D,V)}failResult(C,D,V){this.gen.if(C),V?V():this.error(),D?(this.gen.else(),D(),this.allErrors&&this.gen.endIf()):this.allErrors?this.gen.endIf():this.gen.else()}pass(C,D){this.failResult((0,c.not)(C),void 0,D)}fail(C){if(C===void 0){this.error(),this.allErrors||this.gen.if(!1);return}this.gen.if(C),this.error(),this.allErrors?this.gen.endIf():this.gen.else()}fail$data(C){if(!this.$data)return this.fail(C);const{schemaCode:D}=this;this.fail((0,c._)`${D} !== undefined && (${(0,c.or)(this.invalid$data(),C)})`)}error(C,D,V){if(D){this.setParams(D),this._error(C,V),this.setParams({});return}this._error(C,V)}_error(C,D){(C?f.reportExtraError:f.reportError)(this,this.def.error,D)}$dataError(){(0,f.reportError)(this,this.def.$dataError||f.keyword$DataError)}reset(){if(this.errsCount===void 0)throw new Error('add "trackErrors" to keyword definition');(0,f.resetErrorsCount)(this.gen,this.errsCount)}ok(C){this.allErrors||this.gen.if(C)}setParams(C,D){D?Object.assign(this.params,C):this.params=C}block$data(C,D,V=c.nil){this.gen.block(()=>{this.check$data(C,V),D()})}check$data(C=c.nil,D=c.nil){if(!this.$data)return;const{gen:V,schemaCode:H,schemaType:J,def:pe}=this;V.if((0,c.or)((0,c._)`${H} === undefined`,D)),C!==c.nil&&V.assign(C,!0),(J.length||pe.validateSchema)&&(V.elseIf(this.invalid$data()),this.$dataError(),C!==c.nil&&V.assign(C,!1)),V.else()}invalid$data(){const{gen:C,schemaCode:D,schemaType:V,def:H,it:J}=this;return(0,c.or)(pe(),Re());function pe(){if(V.length){if(!(D instanceof c.Name))throw new Error("ajv implementation error");const Se=Array.isArray(V)?V:[V];return(0,c._)`${(0,n.checkDataTypes)(Se,D,J.opts.strictNumbers,n.DataType.Wrong)}`}return c.nil}function Re(){if(H.validateSchema){const Se=C.scopeValue("validate$data",{ref:H.validateSchema});return(0,c._)`!${Se}(${D})`}return c.nil}}subschema(C,D){const V=(0,s.getSubschema)(this.it,C);(0,s.extendSubschemaData)(V,this.it,C),(0,s.extendSubschemaMode)(V,C);const H={...this.it,...V,items:void 0,props:void 0};return w(H,D),H}mergeEvaluated(C,D){const{it:V,gen:H}=this;V.opts.unevaluated&&(V.props!==!0&&C.props!==void 0&&(V.props=a.mergeEvaluated.props(H,C.props,V.props,D)),V.items!==!0&&C.items!==void 0&&(V.items=a.mergeEvaluated.items(H,C.items,V.items,D)))}mergeValidEvaluated(C,D){const{it:V,gen:H}=this;if(V.opts.unevaluated&&(V.props!==!0||V.items!==!0))return H.if(D,()=>this.mergeEvaluated(C,c.Name)),!0}}Te.KeywordCxt=x;function B(R,C,D,V){const H=new x(R,D,C);"code"in D?D.code(H,V):H.$data&&D.validate?(0,i.funcKeywordCode)(H,D):"macro"in D?(0,i.macroKeywordCode)(H,D):(D.compile||D.validate)&&(0,i.funcKeywordCode)(H,D)}const G=/^\/(?:[^~]|~0|~1)*$/,ie=/^([0-9]+)(#|\/(?:[^~]|~0|~1)*)?$/;function ee(R,{dataLevel:C,dataNames:D,dataPathArr:V}){let H,J;if(R==="")return l.default.rootData;if(R[0]==="/"){if(!G.test(R))throw new Error(`Invalid JSON-pointer: ${R}`);H=R,J=l.default.rootData}else{const Ee=ie.exec(R);if(!Ee)throw new Error(`Invalid JSON-pointer: ${R}`);const he=+Ee[1];if(H=Ee[2],H==="#"){if(he>=C)throw new Error(Se("property/index",he));return V[C-he]}if(he>C)throw new Error(Se("data",he));if(J=D[C-he],!H)return J}let pe=J;const Re=H.split("/");for(const Ee of Re)Ee&&(J=(0,c._)`${J}${(0,c.getProperty)((0,a.unescapeJsonPointer)(Ee))}`,pe=(0,c._)`${pe} && ${J}`);return pe;function Se(Ee,he){return`Cannot access ${Ee} ${he} levels up, current level is ${C}`}}return Te.getData=ee,Te}var lt={},Rn;function Br(){if(Rn)return lt;Rn=1,Object.defineProperty(lt,"__esModule",{value:!0});class e extends Error{constructor(r){super("validation failed"),this.errors=r,this.ajv=this.validation=!0}}return lt.default=e,lt}var dt={},An;function yr(){if(An)return dt;An=1,Object.defineProperty(dt,"__esModule",{value:!0});const e=pr();class t extends Error{constructor(n,o,i,s){super(s||`can't resolve reference ${i} from id ${o}`),this.missingRef=(0,e.resolveUrl)(n,o,i),this.missingSchema=(0,e.normalizeId)((0,e.getFullPath)(n,this.missingRef))}}return dt.default=t,dt}var Pe={},kn;function gr(){if(kn)return Pe;kn=1,Object.defineProperty(Pe,"__esModule",{value:!0}),Pe.resolveSchema=Pe.getCompilingSchema=Pe.resolveRef=Pe.compileSchema=Pe.SchemaEnv=void 0;const e=W(),t=Br(),r=Ce(),n=pr(),o=Z(),i=hr();class s{constructor(_){var p;this.refs={},this.dynamicAnchors={};let w;typeof _.schema=="object"&&(w=_.schema),this.schema=_.schema,this.schemaId=_.schemaId,this.root=_.root||this,this.baseId=(p=_.baseId)!==null&&p!==void 0?p:(0,n.normalizeId)(w?.[_.schemaId||"$id"]),this.schemaPath=_.schemaPath,this.localRefs=_.localRefs,this.meta=_.meta,this.$async=w?.$async,this.refs={}}}Pe.SchemaEnv=s;function c(g){const _=a.call(this,g);if(_)return _;const p=(0,n.getFullPath)(this.opts.uriResolver,g.root.baseId),{es5:w,lines:E}=this.opts.code,{ownProperties:d}=this.opts,h=new e.CodeGen(this.scope,{es5:w,lines:E,ownProperties:d});let v;g.$async&&(v=h.scopeValue("Error",{ref:t.default,code:(0,e._)`require("ajv/dist/runtime/validation_error").default`}));const I=h.scopeName("validate");g.validateName=I;const O={gen:h,allErrors:this.opts.allErrors,data:r.default.data,parentData:r.default.parentData,parentDataProperty:r.default.parentDataProperty,dataNames:[r.default.data],dataPathArr:[e.nil],dataLevel:0,dataTypes:[],definedProperties:new Set,topSchemaRef:h.scopeValue("schema",this.opts.code.source===!0?{ref:g.schema,code:(0,e.stringify)(g.schema)}:{ref:g.schema}),validateName:I,ValidationError:v,schema:g.schema,schemaEnv:g,rootId:p,baseId:g.baseId||p,schemaPath:e.nil,errSchemaPath:g.schemaPath||(this.opts.jtd?"":"#"),errorPath:(0,e._)`""`,opts:this.opts,self:this};let A;try{this._compilations.add(g),(0,i.validateFunctionCode)(O),h.optimize(this.opts.code.optimize);const M=h.toString();A=`${h.scopeRefs(r.default.scope)}return ${M}`,this.opts.code.process&&(A=this.opts.code.process(A,g));const N=new Function(`${r.default.self}`,`${r.default.scope}`,A)(this,this.scope.get());if(this.scope.value(I,{ref:N}),N.errors=null,N.schema=g.schema,N.schemaEnv=g,g.$async&&(N.$async=!0),this.opts.code.source===!0&&(N.source={validateName:I,validateCode:M,scopeValues:h._values}),this.opts.unevaluated){const{props:z,items:ne}=O;N.evaluated={props:z instanceof e.Name?void 0:z,items:ne instanceof e.Name?void 0:ne,dynamicProps:z instanceof e.Name,dynamicItems:ne instanceof e.Name},N.source&&(N.source.evaluated=(0,e.stringify)(N.evaluated))}return g.validate=N,g}catch(M){throw delete g.validate,delete g.validateName,A&&this.logger.error("Error compiling schema, function code:",A),M}finally{this._compilations.delete(g)}}Pe.compileSchema=c;function l(g,_,p){var w;p=(0,n.resolveUrl)(this.opts.uriResolver,_,p);const E=g.refs[p];if(E)return E;let d=m.call(this,g,p);if(d===void 0){const h=(w=g.localRefs)===null||w===void 0?void 0:w[p],{schemaId:v}=this.opts;h&&(d=new s({schema:h,schemaId:v,root:g,baseId:_}))}if(d!==void 0)return g.refs[p]=u.call(this,d)}Pe.resolveRef=l;function u(g){return(0,n.inlineRef)(g.schema,this.opts.inlineRefs)?g.schema:g.validate?g:c.call(this,g)}function a(g){for(const _ of this._compilations)if(f(_,g))return _}Pe.getCompilingSchema=a;function f(g,_){return g.schema===_.schema&&g.root===_.root&&g.baseId===_.baseId}function m(g,_){let p;for(;typeof(p=this.refs[_])=="string";)_=p;return p||this.schemas[_]||y.call(this,g,_)}function y(g,_){const p=this.opts.uriResolver.parse(_),w=(0,n._getFullPath)(this.opts.uriResolver,p);let E=(0,n.getFullPath)(this.opts.uriResolver,g.baseId,void 0);if(Object.keys(g.schema).length>0&&w===E)return S.call(this,p,g);const d=(0,n.normalizeId)(w),h=this.refs[d]||this.schemas[d];if(typeof h=="string"){const v=y.call(this,g,h);return typeof v?.schema!="object"?void 0:S.call(this,p,v)}if(typeof h?.schema=="object"){if(h.validate||c.call(this,h),d===(0,n.normalizeId)(_)){const{schema:v}=h,{schemaId:I}=this.opts,O=v[I];return O&&(E=(0,n.resolveUrl)(this.opts.uriResolver,E,O)),new s({schema:v,schemaId:I,root:g,baseId:E})}return S.call(this,p,h)}}Pe.resolveSchema=y;const $=new Set(["properties","patternProperties","enum","dependencies","definitions"]);function S(g,{baseId:_,schema:p,root:w}){var E;if(((E=g.fragment)===null||E===void 0?void 0:E[0])!=="/")return;for(const v of g.fragment.slice(1).split("/")){if(typeof p=="boolean")return;const I=p[(0,o.unescapeFragment)(v)];if(I===void 0)return;p=I;const O=typeof p=="object"&&p[this.opts.schemaId];!$.has(v)&&O&&(_=(0,n.resolveUrl)(this.opts.uriResolver,_,O))}let d;if(typeof p!="boolean"&&p.$ref&&!(0,o.schemaHasRulesButRef)(p,this.RULES)){const v=(0,n.resolveUrl)(this.opts.uriResolver,_,p.$ref);d=y.call(this,w,v)}const{schemaId:h}=this.opts;if(d=d||new s({schema:p,schemaId:h,root:w,baseId:_}),d.schema!==d.root.schema)return d}return Pe}const ho="https://raw.githubusercontent.com/ajv-validator/ajv/master/lib/refs/data.json#",yo="Meta-schema for $data reference (JSON AnySchema extension proposal)",go="object",vo=["$data"],bo={$data:{type:"string",anyOf:[{format:"relative-json-pointer"},{format:"json-pointer"}]}},_o=!1,$o={$id:ho,description:yo,type:go,required:vo,properties:bo,additionalProperties:_o};var ft={},rt={exports:{}},Cr,Cn;function Zi(){if(Cn)return Cr;Cn=1;const e=RegExp.prototype.test.bind(/^[\da-f]{8}-[\da-f]{4}-[\da-f]{4}-[\da-f]{4}-[\da-f]{12}$/iu),t=RegExp.prototype.test.bind(/^(?:(?:25[0-5]|2[0-4]\d|1\d{2}|[1-9]\d|\d)\.){3}(?:25[0-5]|2[0-4]\d|1\d{2}|[1-9]\d|\d)$/u),r=RegExp.prototype.test.bind(/^[\da-f]{2}$/iu),n=RegExp.prototype.test.bind(/^[\da-z\-._~]$/iu),o=RegExp.prototype.test.bind(/^[\da-z\-._~!$&'()*+,;=:@/]$/iu);function i(d){let h="",v=0,I=0;for(I=0;I=48&&v<=57||v>=65&&v<=70||v>=97&&v<=102))return"";h+=d[I];break}for(I+=1;I=48&&v<=57||v>=65&&v<=70||v>=97&&v<=102))return"";h+=d[I]}return h}const s=RegExp.prototype.test.bind(/[^!"$&'()*+,\-.;=_`a-z{}~]/u);function c(d){return d.length=0,!0}function l(d,h,v){if(d.length){const I=i(d);if(I!=="")h.push(I);else return v.error=!0,!1;d.length=0}return!0}function u(d){let h=0;const v={error:!1,address:"",zone:""},I=[],O=[];let A=!1,M=!1,L=l;for(let N=0;N7){v.error=!0;break}N>0&&d[N-1]===":"&&(A=!0),I.push(":");continue}else if(z==="%"){if(!L(O,I,v))break;L=c}else{O.push(z);continue}}return O.length&&(L===c?v.zone=O.join(""):M?I.push(O.join("")):I.push(i(O))),v.address=I.join(""),v}function a(d){if(f(d,":")<2)return{host:d,isIPV6:!1};const h=u(d);if(h.error)return{host:d,isIPV6:!1};{let v=h.address,I=h.address;return h.zone&&(v+="%"+h.zone,I+="%25"+h.zone),{host:v,isIPV6:!0,escapedHost:I}}}function f(d,h){let v=0;for(let I=0;Iy[I])}function _(d,h=!1){if(d.indexOf("%")===-1)return d;let v="";for(let I=0;I65535))return"URI port is malformed."}function E(A,M){const L=Object.assign({},M),N={scheme:void 0,userinfo:void 0,host:"",port:void 0,path:"",query:void 0,fragment:void 0};let z=!1,ne=!1;L.reference==="suffix"&&(L.scheme?A=L.scheme+":"+A:A="//"+A);const fe=A.match(_);fe!==null&&fe[1].indexOf("\\")!==-1&&(N.error="URI authority must not contain a literal backslash.",z=!0);const le=A.match(p);if(le!==null){const we=le[1],U=we.replace(/[\t\n\r]/g,"");U.length>=2&&(U.slice(0,2)!=="//"?(N.error=N.error||"URI authority must not contain a literal backslash.",z=!0):we.length!==U.length&&(N.error=N.error||"URI authority introducer must not contain whitespace.",z=!0))}const X=A.match(g);if(X){N.scheme=X[1],N.userinfo=X[3],N.host=X[4],N.port=parseInt(X[5],10),N.path=X[6]||"",N.query=X[7],N.fragment=X[8],isNaN(N.port)&&(N.port=X[5]);const we=w(N,X);if(we!==void 0&&(N.error=N.error||we,z=!0),N.host)if(c(N.host)===!1){const F=e(N.host);N.host=F.host.toLowerCase(),ne=F.isIPV6}else ne=!0;N.scheme===void 0&&N.userinfo===void 0&&N.host===void 0&&N.port===void 0&&N.query===void 0&&!N.path?N.reference="same-document":N.scheme===void 0?N.reference="relative":N.fragment===void 0?N.reference="absolute":N.reference="uri",L.reference&&L.reference!=="suffix"&&L.reference!==N.reference&&(N.error=N.error||"URI is not a "+L.reference+" reference.");const U=a(L.scheme||N.scheme);if(!L.unicodeSupport&&(!U||!U.unicodeSupport)&&N.host&&(L.domainHost||U&&U.domainHost)&&ne===!1&&l(N.host))try{N.host=new URL("http://"+N.host).hostname}catch(k){N.error=N.error||"Host's domain name can not be converted to ASCII: "+k}if((!U||U&&!U.skipNormalize)&&(A.indexOf("%")!==-1&&(N.scheme!==void 0&&(N.scheme=unescape(N.scheme)),N.host!==void 0&&(N.host=s(unescape(N.host),ne))),N.path&&(N.path=o(N.path)),N.fragment))try{N.fragment=encodeURI(decodeURIComponent(N.fragment))}catch{N.error=N.error||"URI malformed"}U&&U.parse&&U.parse(N,L)}else N.error=N.error||"URI can not be parsed.";return{parsed:N,malformedAuthorityOrPort:z}}function d(A,M){return E(A,M).parsed}function h(A,M){return v(A,M).normalized}function v(A,M){const{parsed:L,malformedAuthorityOrPort:N}=E(A,M);return{normalized:N?A:S(L,M),malformedAuthorityOrPort:N}}function I(A,M){if(typeof A=="string"){const{normalized:L,malformedAuthorityOrPort:N}=v(A,M);return N?void 0:L}if(typeof A=="object")return S(A,M)}const O={SCHEMES:u,normalize:f,resolve:m,resolveComponent:y,equal:$,serialize:S,parse:d};return rt.exports=O,rt.exports.default=O,rt.exports.fastUri=O,rt.exports}var Tn;function Eo(){if(Tn)return ft;Tn=1,Object.defineProperty(ft,"__esModule",{value:!0});const e=So();return e.code='require("ajv/dist/runtime/uri").default',ft.default=e,ft}var On;function Po(){return On||(On=1,(function(e){Object.defineProperty(e,"__esModule",{value:!0}),e.CodeGen=e.Name=e.nil=e.stringify=e.str=e._=e.KeywordCxt=void 0;var t=hr();Object.defineProperty(e,"KeywordCxt",{enumerable:!0,get:function(){return t.KeywordCxt}});var r=W();Object.defineProperty(e,"_",{enumerable:!0,get:function(){return r._}}),Object.defineProperty(e,"str",{enumerable:!0,get:function(){return r.str}}),Object.defineProperty(e,"stringify",{enumerable:!0,get:function(){return r.stringify}}),Object.defineProperty(e,"nil",{enumerable:!0,get:function(){return r.nil}}),Object.defineProperty(e,"Name",{enumerable:!0,get:function(){return r.Name}}),Object.defineProperty(e,"CodeGen",{enumerable:!0,get:function(){return r.CodeGen}});const n=Br(),o=yr(),i=Yi(),s=gr(),c=W(),l=pr(),u=fr(),a=Z(),f=$o,m=Eo(),y=(U,k)=>new RegExp(U,k);y.code="new RegExp";const $=["removeAdditional","useDefaults","coerceTypes"],S=new Set(["validate","serialize","parse","wrapper","root","schema","keyword","pattern","formats","validate$data","func","obj","Error"]),g={errorDataPath:"",format:"`validateFormats: false` can be used instead.",nullable:'"nullable" keyword is supported by default.',jsonPointers:"Deprecated jsPropertySyntax can be used instead.",extendRefs:"Deprecated ignoreKeywordsWithRef can be used instead.",missingRefs:"Pass empty schema with $id that should be ignored to ajv.addSchema.",processCode:"Use option `code: {process: (code, schemaEnv: object) => string}`",sourceCode:"Use option `code: {source: true}`",strictDefaults:"It is default now, see option `strict`.",strictKeywords:"It is default now, see option `strict`.",uniqueItems:'"uniqueItems" keyword is always validated.',unknownFormats:"Disable strict mode or pass `true` to `ajv.addFormat` (or `formats` option).",cache:"Map is used as cache, schema object as key.",serialize:"Map is used as cache, schema object as key.",ajvErrors:"It is default now."},_={ignoreKeywordsWithRef:"",jsPropertySyntax:"",unicode:'"minLength"/"maxLength" account for unicode characters by default.'},p=200;function w(U){var k,F,j,b,P,x,B,G,ie,ee,R,C,D,V,H,J,pe,Re,Se,Ee,he,He,Ie,br,_r;const et=U.strict,$r=(k=U.code)===null||k===void 0?void 0:k.optimize,tn=$r===!0||$r===void 0?1:$r||0,rn=(j=(F=U.code)===null||F===void 0?void 0:F.regExp)!==null&&j!==void 0?j:y,ba=(b=U.uriResolver)!==null&&b!==void 0?b:m.default;return{strictSchema:(x=(P=U.strictSchema)!==null&&P!==void 0?P:et)!==null&&x!==void 0?x:!0,strictNumbers:(G=(B=U.strictNumbers)!==null&&B!==void 0?B:et)!==null&&G!==void 0?G:!0,strictTypes:(ee=(ie=U.strictTypes)!==null&&ie!==void 0?ie:et)!==null&&ee!==void 0?ee:"log",strictTuples:(C=(R=U.strictTuples)!==null&&R!==void 0?R:et)!==null&&C!==void 0?C:"log",strictRequired:(V=(D=U.strictRequired)!==null&&D!==void 0?D:et)!==null&&V!==void 0?V:!1,code:U.code?{...U.code,optimize:tn,regExp:rn}:{optimize:tn,regExp:rn},loopRequired:(H=U.loopRequired)!==null&&H!==void 0?H:p,loopEnum:(J=U.loopEnum)!==null&&J!==void 0?J:p,meta:(pe=U.meta)!==null&&pe!==void 0?pe:!0,messages:(Re=U.messages)!==null&&Re!==void 0?Re:!0,inlineRefs:(Se=U.inlineRefs)!==null&&Se!==void 0?Se:!0,schemaId:(Ee=U.schemaId)!==null&&Ee!==void 0?Ee:"$id",addUsedSchema:(he=U.addUsedSchema)!==null&&he!==void 0?he:!0,validateSchema:(He=U.validateSchema)!==null&&He!==void 0?He:!0,validateFormats:(Ie=U.validateFormats)!==null&&Ie!==void 0?Ie:!0,unicodeRegExp:(br=U.unicodeRegExp)!==null&&br!==void 0?br:!0,int32range:(_r=U.int32range)!==null&&_r!==void 0?_r:!0,uriResolver:ba}}class E{constructor(k={}){this.schemas={},this.refs={},this.formats=Object.create(null),this._compilations=new Set,this._loading={},this._cache=new Map,k=this.opts={...k,...w(k)};const{es5:F,lines:j}=this.opts.code;this.scope=new c.ValueScope({scope:{},prefixes:S,es5:F,lines:j}),this.logger=L(k.logger);const b=k.validateFormats;k.validateFormats=!1,this.RULES=(0,i.getRules)(),d.call(this,g,k,"NOT SUPPORTED"),d.call(this,_,k,"DEPRECATED","warn"),this._metaOpts=A.call(this),k.formats&&I.call(this),this._addVocabularies(),this._addDefaultMetaSchema(),k.keywords&&O.call(this,k.keywords),typeof k.meta=="object"&&this.addMetaSchema(k.meta),v.call(this),k.validateFormats=b}_addVocabularies(){this.addKeyword("$async")}_addDefaultMetaSchema(){const{$data:k,meta:F,schemaId:j}=this.opts;let b=f;j==="id"&&(b={...f},b.id=b.$id,delete b.$id),F&&k&&this.addMetaSchema(b,b[j],!1)}defaultMeta(){const{meta:k,schemaId:F}=this.opts;return this.opts.defaultMeta=typeof k=="object"?k[F]||k:void 0}validate(k,F){let j;if(typeof k=="string"){if(j=this.getSchema(k),!j)throw new Error(`no schema with key or ref "${k}"`)}else j=this.compile(k);const b=j(F);return"$async"in j||(this.errors=j.errors),b}compile(k,F){const j=this._addSchema(k,F);return j.validate||this._compileSchemaEnv(j)}compileAsync(k,F){if(typeof this.opts.loadSchema!="function")throw new Error("options.loadSchema should be a function");const{loadSchema:j}=this.opts;return b.call(this,k,F);async function b(ee,R){await P.call(this,ee.$schema);const C=this._addSchema(ee,R);return C.validate||x.call(this,C)}async function P(ee){ee&&!this.getSchema(ee)&&await b.call(this,{$ref:ee},!0)}async function x(ee){try{return this._compileSchemaEnv(ee)}catch(R){if(!(R instanceof o.default))throw R;return B.call(this,R),await G.call(this,R.missingSchema),x.call(this,ee)}}function B({missingSchema:ee,missingRef:R}){if(this.refs[ee])throw new Error(`AnySchema ${ee} is loaded but ${R} cannot be resolved`)}async function G(ee){const R=await ie.call(this,ee);this.refs[ee]||await P.call(this,R.$schema),this.refs[ee]||this.addSchema(R,ee,F)}async function ie(ee){const R=this._loading[ee];if(R)return R;try{return await(this._loading[ee]=j(ee))}finally{delete this._loading[ee]}}}addSchema(k,F,j,b=this.opts.validateSchema){if(Array.isArray(k)){for(const x of k)this.addSchema(x,void 0,j,b);return this}let P;if(typeof k=="object"){const{schemaId:x}=this.opts;if(P=k[x],P!==void 0&&typeof P!="string")throw new Error(`schema ${x} must be string`)}return F=(0,l.normalizeId)(F||P),this._checkUnique(F),this.schemas[F]=this._addSchema(k,j,F,b,!0),this}addMetaSchema(k,F,j=this.opts.validateSchema){return this.addSchema(k,F,!0,j),this}validateSchema(k,F){if(typeof k=="boolean")return!0;let j;if(j=k.$schema,j!==void 0&&typeof j!="string")throw new Error("$schema must be a string");if(j=j||this.opts.defaultMeta||this.defaultMeta(),!j)return this.logger.warn("meta-schema not available"),this.errors=null,!0;const b=this.validate(j,k);if(!b&&F){const P="schema is invalid: "+this.errorsText();if(this.opts.validateSchema==="log")this.logger.error(P);else throw new Error(P)}return b}getSchema(k){let F;for(;typeof(F=h.call(this,k))=="string";)k=F;if(F===void 0){const{schemaId:j}=this.opts,b=new s.SchemaEnv({schema:{},schemaId:j});if(F=s.resolveSchema.call(this,b,k),!F)return;this.refs[k]=F}return F.validate||this._compileSchemaEnv(F)}removeSchema(k){if(k instanceof RegExp)return this._removeAllSchemas(this.schemas,k),this._removeAllSchemas(this.refs,k),this;switch(typeof k){case"undefined":return this._removeAllSchemas(this.schemas),this._removeAllSchemas(this.refs),this._cache.clear(),this;case"string":{const F=h.call(this,k);return typeof F=="object"&&this._cache.delete(F.schema),delete this.schemas[k],delete this.refs[k],this}case"object":{const F=k;this._cache.delete(F);let j=k[this.opts.schemaId];return j&&(j=(0,l.normalizeId)(j),delete this.schemas[j],delete this.refs[j]),this}default:throw new Error("ajv.removeSchema: invalid parameter")}}addVocabulary(k){for(const F of k)this.addKeyword(F);return this}addKeyword(k,F){let j;if(typeof k=="string")j=k,typeof F=="object"&&(this.logger.warn("these parameters are deprecated, see docs for addKeyword"),F.keyword=j);else if(typeof k=="object"&&F===void 0){if(F=k,j=F.keyword,Array.isArray(j)&&!j.length)throw new Error("addKeywords: keyword must be string or non-empty array")}else throw new Error("invalid addKeywords parameters");if(z.call(this,j,F),!F)return(0,a.eachItem)(j,P=>ne.call(this,P)),this;le.call(this,F);const b={...F,type:(0,u.getJSONTypes)(F.type),schemaType:(0,u.getJSONTypes)(F.schemaType)};return(0,a.eachItem)(j,b.type.length===0?P=>ne.call(this,P,b):P=>b.type.forEach(x=>ne.call(this,P,b,x))),this}getKeyword(k){const F=this.RULES.all[k];return typeof F=="object"?F.definition:!!F}removeKeyword(k){const{RULES:F}=this;delete F.keywords[k],delete F.all[k];for(const j of F.rules){const b=j.rules.findIndex(P=>P.keyword===k);b>=0&&j.rules.splice(b,1)}return this}addFormat(k,F){return typeof F=="string"&&(F=new RegExp(F)),this.formats[k]=F,this}errorsText(k=this.errors,{separator:F=", ",dataVar:j="data"}={}){return!k||k.length===0?"No errors":k.map(b=>`${j}${b.instancePath} ${b.message}`).reduce((b,P)=>b+F+P)}$dataMetaSchema(k,F){const j=this.RULES.all;k=JSON.parse(JSON.stringify(k));for(const b of F){const P=b.split("/").slice(1);let x=k;for(const B of P)x=x[B];for(const B in j){const G=j[B];if(typeof G!="object")continue;const{$data:ie}=G.definition,ee=x[B];ie&&ee&&(x[B]=we(ee))}}return k}_removeAllSchemas(k,F){for(const j in k){const b=k[j];(!F||F.test(j))&&(typeof b=="string"?delete k[j]:b&&!b.meta&&(this._cache.delete(b.schema),delete k[j]))}}_addSchema(k,F,j,b=this.opts.validateSchema,P=this.opts.addUsedSchema){let x;const{schemaId:B}=this.opts;if(typeof k=="object")x=k[B];else{if(this.opts.jtd)throw new Error("schema must be object");if(typeof k!="boolean")throw new Error("schema must be object or boolean")}let G=this._cache.get(k);if(G!==void 0)return G;j=(0,l.normalizeId)(x||j);const ie=l.getSchemaRefs.call(this,k,j);return G=new s.SchemaEnv({schema:k,schemaId:B,meta:F,baseId:j,localRefs:ie}),this._cache.set(G.schema,G),P&&!j.startsWith("#")&&(j&&this._checkUnique(j),this.refs[j]=G),b&&this.validateSchema(k,!0),G}_checkUnique(k){if(this.schemas[k]||this.refs[k])throw new Error(`schema with key or id "${k}" already exists`)}_compileSchemaEnv(k){if(k.meta?this._compileMetaSchema(k):s.compileSchema.call(this,k),!k.validate)throw new Error("ajv implementation error");return k.validate}_compileMetaSchema(k){const F=this.opts;this.opts=this._metaOpts;try{s.compileSchema.call(this,k)}finally{this.opts=F}}}E.ValidationError=n.default,E.MissingRefError=o.default,e.default=E;function d(U,k,F,j="error"){for(const b in U){const P=b;P in k&&this.logger[j](`${F}: option ${b}. ${U[P]}`)}}function h(U){return U=(0,l.normalizeId)(U),this.schemas[U]||this.refs[U]}function v(){const U=this.opts.schemas;if(U)if(Array.isArray(U))this.addSchema(U);else for(const k in U)this.addSchema(U[k],k)}function I(){for(const U in this.opts.formats){const k=this.opts.formats[U];k&&this.addFormat(U,k)}}function O(U){if(Array.isArray(U)){this.addVocabulary(U);return}this.logger.warn("keywords option as map is deprecated, pass array");for(const k in U){const F=U[k];F.keyword||(F.keyword=k),this.addKeyword(F)}}function A(){const U={...this.opts};for(const k of $)delete U[k];return U}const M={log(){},warn(){},error(){}};function L(U){if(U===!1)return M;if(U===void 0)return console;if(U.log&&U.warn&&U.error)return U;throw new Error("logger must implement log, warn and error methods")}const N=/^[a-z_$][a-z0-9_$:-]*$/i;function z(U,k){const{RULES:F}=this;if((0,a.eachItem)(U,j=>{if(F.keywords[j])throw new Error(`Keyword ${j} is already defined`);if(!N.test(j))throw new Error(`Keyword ${j} has invalid name`)}),!!k&&k.$data&&!("code"in k||"validate"in k))throw new Error('$data keyword must have "code" or "validate" function')}function ne(U,k,F){var j;const b=k?.post;if(F&&b)throw new Error('keyword with "post" flag cannot have "type"');const{RULES:P}=this;let x=b?P.post:P.rules.find(({type:G})=>G===F);if(x||(x={type:F,rules:[]},P.rules.push(x)),P.keywords[U]=!0,!k)return;const B={keyword:U,definition:{...k,type:(0,u.getJSONTypes)(k.type),schemaType:(0,u.getJSONTypes)(k.schemaType)}};k.before?fe.call(this,x,B,k.before):x.rules.push(B),P.all[U]=B,(j=k.implements)===null||j===void 0||j.forEach(G=>this.addKeyword(G))}function fe(U,k,F){const j=U.rules.findIndex(b=>b.keyword===F);j>=0?U.rules.splice(j,0,k):(U.rules.push(k),this.logger.warn(`rule ${F} is not defined`))}function le(U){let{metaSchema:k}=U;k!==void 0&&(U.$data&&this.opts.$data&&(k=we(k)),U.validateSchema=this.compile(k,!0))}const X={$ref:"https://raw.githubusercontent.com/ajv-validator/ajv/master/lib/refs/data.json#"};function we(U){return{anyOf:[U,X]}}})(Sr)),Sr}var mt={},pt={},ht={},Mn;function Io(){if(Mn)return ht;Mn=1,Object.defineProperty(ht,"__esModule",{value:!0});const e={keyword:"id",code(){throw new Error('NOT SUPPORTED: keyword "id", use "$id" for schema ID')}};return ht.default=e,ht}var qe={},qn;function Hr(){if(qn)return qe;qn=1,Object.defineProperty(qe,"__esModule",{value:!0}),qe.callRef=qe.getValidate=void 0;const e=yr(),t=Ne(),r=W(),n=Ce(),o=gr(),i=Z(),s={keyword:"$ref",schemaType:"string",code(u){const{gen:a,schema:f,it:m}=u,{baseId:y,schemaEnv:$,validateName:S,opts:g,self:_}=m,{root:p}=$;if((f==="#"||f==="#/")&&y===p.baseId)return E();const w=o.resolveRef.call(_,p,y,f);if(w===void 0)throw new e.default(m.opts.uriResolver,y,f);if(w instanceof o.SchemaEnv)return d(w);return h(w);function E(){if($===p)return l(u,S,$,$.$async);const v=a.scopeValue("root",{ref:p});return l(u,(0,r._)`${v}.validate`,p,p.$async)}function d(v){const I=c(u,v);l(u,I,v,v.$async)}function h(v){const I=a.scopeValue("schema",g.code.source===!0?{ref:v,code:(0,r.stringify)(v)}:{ref:v}),O=a.name("valid"),A=u.subschema({schema:v,dataTypes:[],schemaPath:r.nil,topSchemaRef:I,errSchemaPath:f},O);u.mergeEvaluated(A),u.ok(O)}}};function c(u,a){const{gen:f}=u;return a.validate?f.scopeValue("validate",{ref:a.validate}):(0,r._)`${f.scopeValue("wrapper",{ref:a})}.validate`}qe.getValidate=c;function l(u,a,f,m){const{gen:y,it:$}=u,{allErrors:S,schemaEnv:g,opts:_}=$,p=_.passContext?n.default.this:r.nil;m?w():E();function w(){if(!g.$async)throw new Error("async schema referenced by sync schema");const v=y.let("valid");y.try(()=>{y.code((0,r._)`await ${(0,t.callValidateCode)(u,a,p)}`),h(a),S||y.assign(v,!0)},I=>{y.if((0,r._)`!(${I} instanceof ${$.ValidationError})`,()=>y.throw(I)),d(I),S||y.assign(v,!1)}),u.ok(v)}function E(){u.result((0,t.callValidateCode)(u,a,p),()=>h(a),()=>d(a))}function d(v){const I=(0,r._)`${v}.errors`;y.assign(n.default.vErrors,(0,r._)`${n.default.vErrors} === null ? ${I} : ${n.default.vErrors}.concat(${I})`),y.assign(n.default.errors,(0,r._)`${n.default.vErrors}.length`)}function h(v){var I;if(!$.opts.unevaluated)return;const O=(I=f?.validate)===null||I===void 0?void 0:I.evaluated;if($.props!==!0)if(O&&!O.dynamicProps)O.props!==void 0&&($.props=i.mergeEvaluated.props(y,O.props,$.props));else{const A=y.var("props",(0,r._)`${v}.evaluated.props`);$.props=i.mergeEvaluated.props(y,A,$.props,r.Name)}if($.items!==!0)if(O&&!O.dynamicItems)O.items!==void 0&&($.items=i.mergeEvaluated.items(y,O.items,$.items));else{const A=y.var("items",(0,r._)`${v}.evaluated.items`);$.items=i.mergeEvaluated.items(y,A,$.items,r.Name)}}}return qe.callRef=l,qe.default=s,qe}var xn;function Ro(){if(xn)return pt;xn=1,Object.defineProperty(pt,"__esModule",{value:!0});const e=Io(),t=Hr(),r=["$schema","$id","$defs","$vocabulary",{keyword:"$comment"},"definitions",e.default,t.default];return pt.default=r,pt}var yt={},gt={},Ln;function Ao(){if(Ln)return gt;Ln=1,Object.defineProperty(gt,"__esModule",{value:!0});const e=W(),t=e.operators,r={maximum:{okStr:"<=",ok:t.LTE,fail:t.GT},minimum:{okStr:">=",ok:t.GTE,fail:t.LT},exclusiveMaximum:{okStr:"<",ok:t.LT,fail:t.GTE},exclusiveMinimum:{okStr:">",ok:t.GT,fail:t.LTE}},n={message:({keyword:i,schemaCode:s})=>(0,e.str)`must be ${r[i].okStr} ${s}`,params:({keyword:i,schemaCode:s})=>(0,e._)`{comparison: ${r[i].okStr}, limit: ${s}}`},o={keyword:Object.keys(r),type:"number",schemaType:"number",$data:!0,error:n,code(i){const{keyword:s,data:c,schemaCode:l}=i;i.fail$data((0,e._)`${c} ${r[s].fail} ${l} || isNaN(${c})`)}};return gt.default=o,gt}var vt={},Dn;function ko(){if(Dn)return vt;Dn=1,Object.defineProperty(vt,"__esModule",{value:!0});const e=W(),r={keyword:"multipleOf",type:"number",schemaType:"number",$data:!0,error:{message:({schemaCode:n})=>(0,e.str)`must be multiple of ${n}`,params:({schemaCode:n})=>(0,e._)`{multipleOf: ${n}}`},code(n){const{gen:o,data:i,schemaCode:s,it:c}=n,l=c.opts.multipleOfPrecision,u=o.let("res"),a=l?(0,e._)`Math.abs(Math.round(${u}) - ${u}) > 1e-${l}`:(0,e._)`${u} !== parseInt(${u})`;n.fail$data((0,e._)`(${s} === 0 || (${u} = ${i}/${s}, ${a}))`)}};return vt.default=r,vt}var bt={},_t={},Fn;function Co(){if(Fn)return _t;Fn=1,Object.defineProperty(_t,"__esModule",{value:!0});function e(t){const r=t.length;let n=0,o=0,i;for(;o=55296&&i<=56319&&o(0,e._)`{limit: ${i}}`},code(i){const{keyword:s,data:c,schemaCode:l,it:u}=i,a=s==="maxLength"?e.operators.GT:e.operators.LT,f=u.opts.unicode===!1?(0,e._)`${c}.length`:(0,e._)`${(0,t.useFunc)(i.gen,r.default)}(${c})`;i.fail$data((0,e._)`${f} ${a} ${l}`)}};return bt.default=o,bt}var $t={},zn;function jo(){if(zn)return $t;zn=1,Object.defineProperty($t,"__esModule",{value:!0});const e=Ne(),t=Z(),r=W(),o={keyword:"pattern",type:"string",schemaType:"string",$data:!0,error:{message:({schemaCode:i})=>(0,r.str)`must match pattern "${i}"`,params:({schemaCode:i})=>(0,r._)`{pattern: ${i}}`},code(i){const{gen:s,data:c,$data:l,schema:u,schemaCode:a,it:f}=i,m=f.opts.unicodeRegExp?"u":"";if(l){const{regExp:y}=f.opts.code,$=y.code==="new RegExp"?(0,r._)`new RegExp`:(0,t.useFunc)(s,y),S=s.let("valid");s.try(()=>s.assign(S,(0,r._)`${$}(${a}, ${m}).test(${c})`),()=>s.assign(S,!1)),i.fail$data((0,r._)`!${S}`)}else{const y=(0,e.usePattern)(i,u);i.fail$data((0,r._)`!${y}.test(${c})`)}}};return $t.default=o,$t}var wt={},Vn;function To(){if(Vn)return wt;Vn=1,Object.defineProperty(wt,"__esModule",{value:!0});const e=W(),r={keyword:["maxProperties","minProperties"],type:"object",schemaType:"number",$data:!0,error:{message({keyword:n,schemaCode:o}){const i=n==="maxProperties"?"more":"fewer";return(0,e.str)`must NOT have ${i} than ${o} properties`},params:({schemaCode:n})=>(0,e._)`{limit: ${n}}`},code(n){const{keyword:o,data:i,schemaCode:s}=n,c=o==="maxProperties"?e.operators.GT:e.operators.LT;n.fail$data((0,e._)`Object.keys(${i}).length ${c} ${s}`)}};return wt.default=r,wt}var St={},Kn;function Oo(){if(Kn)return St;Kn=1,Object.defineProperty(St,"__esModule",{value:!0});const e=Ne(),t=W(),r=Z(),o={keyword:"required",type:"object",schemaType:"array",$data:!0,error:{message:({params:{missingProperty:i}})=>(0,t.str)`must have required property '${i}'`,params:({params:{missingProperty:i}})=>(0,t._)`{missingProperty: ${i}}`},code(i){const{gen:s,schema:c,schemaCode:l,data:u,$data:a,it:f}=i,{opts:m}=f;if(!a&&c.length===0)return;const y=c.length>=m.loopRequired;if(f.allErrors?$():S(),m.strictRequired){const p=i.parentSchema.properties,{definedProperties:w}=i.it;for(const E of c)if(p?.[E]===void 0&&!w.has(E)){const d=f.schemaEnv.baseId+f.errSchemaPath,h=`required property "${E}" is not defined at "${d}" (strictRequired)`;(0,r.checkStrictMode)(f,h,f.opts.strictRequired)}}function $(){if(y||a)i.block$data(t.nil,g);else for(const p of c)(0,e.checkReportMissingProp)(i,p)}function S(){const p=s.let("missing");if(y||a){const w=s.let("valid",!0);i.block$data(w,()=>_(p,w)),i.ok(w)}else s.if((0,e.checkMissingProp)(i,c,p)),(0,e.reportMissingProp)(i,p),s.else()}function g(){s.forOf("prop",l,p=>{i.setParams({missingProperty:p}),s.if((0,e.noPropertyInData)(s,u,p,m.ownProperties),()=>i.error())})}function _(p,w){i.setParams({missingProperty:p}),s.forOf(p,l,()=>{s.assign(w,(0,e.propertyInData)(s,u,p,m.ownProperties)),s.if((0,t.not)(w),()=>{i.error(),s.break()})},t.nil)}}};return St.default=o,St}var Et={},Bn;function Mo(){if(Bn)return Et;Bn=1,Object.defineProperty(Et,"__esModule",{value:!0});const e=W(),r={keyword:["maxItems","minItems"],type:"array",schemaType:"number",$data:!0,error:{message({keyword:n,schemaCode:o}){const i=n==="maxItems"?"more":"fewer";return(0,e.str)`must NOT have ${i} than ${o} items`},params:({schemaCode:n})=>(0,e._)`{limit: ${n}}`},code(n){const{keyword:o,data:i,schemaCode:s}=n,c=o==="maxItems"?e.operators.GT:e.operators.LT;n.fail$data((0,e._)`${i}.length ${c} ${s}`)}};return Et.default=r,Et}var Pt={},It={},Hn;function Gr(){if(Hn)return It;Hn=1,Object.defineProperty(It,"__esModule",{value:!0});const e=Qi();return e.code='require("ajv/dist/runtime/equal").default',It.default=e,It}var Gn;function qo(){if(Gn)return Pt;Gn=1,Object.defineProperty(Pt,"__esModule",{value:!0});const e=fr(),t=W(),r=Z(),n=Gr(),i={keyword:"uniqueItems",type:"array",schemaType:"boolean",$data:!0,error:{message:({params:{i:s,j:c}})=>(0,t.str)`must NOT have duplicate items (items ## ${c} and ${s} are identical)`,params:({params:{i:s,j:c}})=>(0,t._)`{i: ${s}, j: ${c}}`},code(s){const{gen:c,data:l,$data:u,schema:a,parentSchema:f,schemaCode:m,it:y}=s;if(!u&&!a)return;const $=c.let("valid"),S=f.items?(0,e.getSchemaTypes)(f.items):[];s.block$data($,g,(0,t._)`${m} === false`),s.ok($);function g(){const E=c.let("i",(0,t._)`${l}.length`),d=c.let("j");s.setParams({i:E,j:d}),c.assign($,!0),c.if((0,t._)`${E} > 1`,()=>(_()?p:w)(E,d))}function _(){return S.length>0&&!S.some(E=>E==="object"||E==="array")}function p(E,d){const h=c.name("item"),v=(0,e.checkDataTypes)(S,h,y.opts.strictNumbers,e.DataType.Wrong),I=c.const("indices",(0,t._)`{}`);c.for((0,t._)`;${E}--;`,()=>{c.let(h,(0,t._)`${l}[${E}]`),c.if(v,(0,t._)`continue`),S.length>1&&c.if((0,t._)`typeof ${h} == "string"`,(0,t._)`${h} += "_"`),c.if((0,t._)`typeof ${I}[${h}] == "number"`,()=>{c.assign(d,(0,t._)`${I}[${h}]`),s.error(),c.assign($,!1).break()}).code((0,t._)`${I}[${h}] = ${E}`)})}function w(E,d){const h=(0,r.useFunc)(c,n.default),v=c.name("outer");c.label(v).for((0,t._)`;${E}--;`,()=>c.for((0,t._)`${d} = ${E}; ${d}--;`,()=>c.if((0,t._)`${h}(${l}[${E}], ${l}[${d}])`,()=>{s.error(),c.assign($,!1).break(v)})))}}};return Pt.default=i,Pt}var Rt={},Wn;function xo(){if(Wn)return Rt;Wn=1,Object.defineProperty(Rt,"__esModule",{value:!0});const e=W(),t=Z(),r=Gr(),o={keyword:"const",$data:!0,error:{message:"must be equal to constant",params:({schemaCode:i})=>(0,e._)`{allowedValue: ${i}}`},code(i){const{gen:s,data:c,$data:l,schemaCode:u,schema:a}=i;l||a&&typeof a=="object"?i.fail$data((0,e._)`!${(0,t.useFunc)(s,r.default)}(${c}, ${u})`):i.fail((0,e._)`${a} !== ${c}`)}};return Rt.default=o,Rt}var At={},Xn;function Lo(){if(Xn)return At;Xn=1,Object.defineProperty(At,"__esModule",{value:!0});const e=W(),t=Z(),r=Gr(),o={keyword:"enum",schemaType:"array",$data:!0,error:{message:"must be equal to one of the allowed values",params:({schemaCode:i})=>(0,e._)`{allowedValues: ${i}}`},code(i){const{gen:s,data:c,$data:l,schema:u,schemaCode:a,it:f}=i;if(!l&&u.length===0)throw new Error("enum must have non-empty array");const m=u.length>=f.opts.loopEnum;let y;const $=()=>y??(y=(0,t.useFunc)(s,r.default));let S;if(m||l)S=s.let("valid"),i.block$data(S,g);else{if(!Array.isArray(u))throw new Error("ajv implementation error");const p=s.const("vSchema",a);S=(0,e.or)(...u.map((w,E)=>_(p,E)))}i.pass(S);function g(){s.assign(S,!1),s.forOf("v",a,p=>s.if((0,e._)`${$()}(${c}, ${p})`,()=>s.assign(S,!0).break()))}function _(p,w){const E=u[w];return typeof E=="object"&&E!==null?(0,e._)`${$()}(${c}, ${p}[${w}])`:(0,e._)`${c} === ${E}`}}};return At.default=o,At}var Yn;function Do(){if(Yn)return yt;Yn=1,Object.defineProperty(yt,"__esModule",{value:!0});const e=Ao(),t=ko(),r=No(),n=jo(),o=To(),i=Oo(),s=Mo(),c=qo(),l=xo(),u=Lo(),a=[e.default,t.default,r.default,n.default,o.default,i.default,s.default,c.default,{keyword:"type",schemaType:["string","array"]},{keyword:"nullable",schemaType:"boolean"},l.default,u.default];return yt.default=a,yt}var kt={},Xe={},Jn;function ea(){if(Jn)return Xe;Jn=1,Object.defineProperty(Xe,"__esModule",{value:!0}),Xe.validateAdditionalItems=void 0;const e=W(),t=Z(),n={keyword:"additionalItems",type:"array",schemaType:["boolean","object"],before:"uniqueItems",error:{message:({params:{len:i}})=>(0,e.str)`must NOT have more than ${i} items`,params:({params:{len:i}})=>(0,e._)`{limit: ${i}}`},code(i){const{parentSchema:s,it:c}=i,{items:l}=s;if(!Array.isArray(l)){(0,t.checkStrictMode)(c,'"additionalItems" is ignored when "items" is not an array of schemas');return}o(i,l)}};function o(i,s){const{gen:c,schema:l,data:u,keyword:a,it:f}=i;f.items=!0;const m=c.const("len",(0,e._)`${u}.length`);if(l===!1)i.setParams({len:s.length}),i.pass((0,e._)`${m} <= ${s.length}`);else if(typeof l=="object"&&!(0,t.alwaysValidSchema)(f,l)){const $=c.var("valid",(0,e._)`${m} <= ${s.length}`);c.if((0,e.not)($),()=>y($)),i.ok($)}function y($){c.forRange("i",s.length,m,S=>{i.subschema({keyword:a,dataProp:S,dataPropType:t.Type.Num},$),f.allErrors||c.if((0,e.not)($),()=>c.break())})}}return Xe.validateAdditionalItems=o,Xe.default=n,Xe}var Ct={},Ye={},Qn;function ta(){if(Qn)return Ye;Qn=1,Object.defineProperty(Ye,"__esModule",{value:!0}),Ye.validateTuple=void 0;const e=W(),t=Z(),r=Ne(),n={keyword:"items",type:"array",schemaType:["object","array","boolean"],before:"uniqueItems",code(i){const{schema:s,it:c}=i;if(Array.isArray(s))return o(i,"additionalItems",s);c.items=!0,!(0,t.alwaysValidSchema)(c,s)&&i.ok((0,r.validateArray)(i))}};function o(i,s,c=i.schema){const{gen:l,parentSchema:u,data:a,keyword:f,it:m}=i;S(u),m.opts.unevaluated&&c.length&&m.items!==!0&&(m.items=t.mergeEvaluated.items(l,c.length,m.items));const y=l.name("valid"),$=l.const("len",(0,e._)`${a}.length`);c.forEach((g,_)=>{(0,t.alwaysValidSchema)(m,g)||(l.if((0,e._)`${$} > ${_}`,()=>i.subschema({keyword:f,schemaProp:_,dataProp:_},y)),i.ok(y))});function S(g){const{opts:_,errSchemaPath:p}=m,w=c.length,E=w===g.minItems&&(w===g.maxItems||g[s]===!1);if(_.strictTuples&&!E){const d=`"${f}" is ${w}-tuple, but minItems or maxItems/${s} are not specified or different at path "${p}"`;(0,t.checkStrictMode)(m,d,_.strictTuples)}}}return Ye.validateTuple=o,Ye.default=n,Ye}var Zn;function Fo(){if(Zn)return Ct;Zn=1,Object.defineProperty(Ct,"__esModule",{value:!0});const e=ta(),t={keyword:"prefixItems",type:"array",schemaType:["array"],before:"uniqueItems",code:r=>(0,e.validateTuple)(r,"items")};return Ct.default=t,Ct}var Nt={},ei;function Uo(){if(ei)return Nt;ei=1,Object.defineProperty(Nt,"__esModule",{value:!0});const e=W(),t=Z(),r=Ne(),n=ea(),i={keyword:"items",type:"array",schemaType:["object","boolean"],before:"uniqueItems",error:{message:({params:{len:s}})=>(0,e.str)`must NOT have more than ${s} items`,params:({params:{len:s}})=>(0,e._)`{limit: ${s}}`},code(s){const{schema:c,parentSchema:l,it:u}=s,{prefixItems:a}=l;u.items=!0,!(0,t.alwaysValidSchema)(u,c)&&(a?(0,n.validateAdditionalItems)(s,a):s.ok((0,r.validateArray)(s)))}};return Nt.default=i,Nt}var jt={},ti;function zo(){if(ti)return jt;ti=1,Object.defineProperty(jt,"__esModule",{value:!0});const e=W(),t=Z(),n={keyword:"contains",type:"array",schemaType:["object","boolean"],before:"uniqueItems",trackErrors:!0,error:{message:({params:{min:o,max:i}})=>i===void 0?(0,e.str)`must contain at least ${o} valid item(s)`:(0,e.str)`must contain at least ${o} and no more than ${i} valid item(s)`,params:({params:{min:o,max:i}})=>i===void 0?(0,e._)`{minContains: ${o}}`:(0,e._)`{minContains: ${o}, maxContains: ${i}}`},code(o){const{gen:i,schema:s,parentSchema:c,data:l,it:u}=o;let a,f;const{minContains:m,maxContains:y}=c;u.opts.next?(a=m===void 0?1:m,f=y):a=1;const $=i.const("len",(0,e._)`${l}.length`);if(o.setParams({min:a,max:f}),f===void 0&&a===0){(0,t.checkStrictMode)(u,'"minContains" == 0 without "maxContains": "contains" keyword ignored');return}if(f!==void 0&&a>f){(0,t.checkStrictMode)(u,'"minContains" > "maxContains" is always invalid'),o.fail();return}if((0,t.alwaysValidSchema)(u,s)){let w=(0,e._)`${$} >= ${a}`;f!==void 0&&(w=(0,e._)`${w} && ${$} <= ${f}`),o.pass(w);return}u.items=!0;const S=i.name("valid");f===void 0&&a===1?_(S,()=>i.if(S,()=>i.break())):a===0?(i.let(S,!0),f!==void 0&&i.if((0,e._)`${l}.length > 0`,g)):(i.let(S,!1),g()),o.result(S,()=>o.reset());function g(){const w=i.name("_valid"),E=i.let("count",0);_(w,()=>i.if(w,()=>p(E)))}function _(w,E){i.forRange("i",0,$,d=>{o.subschema({keyword:"contains",dataProp:d,dataPropType:t.Type.Num,compositeRule:!0},w),E()})}function p(w){i.code((0,e._)`${w}++`),f===void 0?i.if((0,e._)`${w} >= ${a}`,()=>i.assign(S,!0).break()):(i.if((0,e._)`${w} > ${f}`,()=>i.assign(S,!1).break()),a===1?i.assign(S,!0):i.if((0,e._)`${w} >= ${a}`,()=>i.assign(S,!0)))}}};return jt.default=n,jt}var jr={},ri;function Wr(){return ri||(ri=1,(function(e){Object.defineProperty(e,"__esModule",{value:!0}),e.validateSchemaDeps=e.validatePropertyDeps=e.error=void 0;const t=W(),r=Z(),n=Ne();e.error={message:({params:{property:l,depsCount:u,deps:a}})=>{const f=u===1?"property":"properties";return(0,t.str)`must have ${f} ${a} when property ${l} is present`},params:({params:{property:l,depsCount:u,deps:a,missingProperty:f}})=>(0,t._)`{property: ${l}, missingProperty: ${f}, depsCount: ${u}, - deps: ${a}}`};const o={keyword:"dependencies",type:"object",schemaType:"object",error:e.error,code(l){const[u,a]=i(l);s(l,u),c(l,a)}};function i({schema:l}){const u={},a={};for(const f in l){if(f==="__proto__")continue;const m=Array.isArray(l[f])?u:a;m[f]=l[f]}return[u,a]}function s(l,u=l.schema){const{gen:a,data:f,it:m}=l;if(Object.keys(u).length===0)return;const y=a.let("missing");for(const $ in u){const S=u[$];if(S.length===0)continue;const g=(0,n.propertyInData)(a,f,$,m.opts.ownProperties);l.setParams({property:$,depsCount:S.length,deps:S.join(", ")}),m.allErrors?a.if(g,()=>{for(const _ of S)(0,n.checkReportMissingProp)(l,_)}):(a.if((0,t._)`${g} && (${(0,n.checkMissingProp)(l,S,y)})`),(0,n.reportMissingProp)(l,y),a.else())}}e.validatePropertyDeps=s;function c(l,u=l.schema){const{gen:a,data:f,keyword:m,it:y}=l,$=a.name("valid");for(const S in u)(0,r.alwaysValidSchema)(y,u[S])||(a.if((0,n.propertyInData)(a,f,S,y.opts.ownProperties),()=>{const g=l.subschema({keyword:m,schemaProp:S},$);l.mergeValidEvaluated(g,$)},()=>a.var($,!0)),l.ok($))}e.validateSchemaDeps=c,e.default=o})(Nr)),Nr}var Tt={},ri;function Vo(){if(ri)return Tt;ri=1,Object.defineProperty(Tt,"__esModule",{value:!0});const e=W(),t=Z(),n={keyword:"propertyNames",type:"object",schemaType:["object","boolean"],error:{message:"property name must be valid",params:({params:o})=>(0,e._)`{propertyName: ${o.propertyName}}`},code(o){const{gen:i,schema:s,data:c,it:l}=o;if((0,t.alwaysValidSchema)(l,s))return;const u=i.name("valid");i.forIn("key",c,a=>{o.setParams({propertyName:a}),o.subschema({keyword:"propertyNames",data:a,dataTypes:["string"],propertyName:a,compositeRule:!0},u),i.if((0,e.not)(u),()=>{o.error(!0),l.allErrors||i.break()})}),o.ok(u)}};return Tt.default=n,Tt}var Ot={},ni;function ta(){if(ni)return Ot;ni=1,Object.defineProperty(Ot,"__esModule",{value:!0});const e=Ne(),t=W(),r=Ce(),n=Z(),i={keyword:"additionalProperties",type:["object"],schemaType:["boolean","object"],allowUndefined:!0,trackErrors:!0,error:{message:"must NOT have additional properties",params:({params:s})=>(0,t._)`{additionalProperty: ${s.additionalProperty}}`},code(s){const{gen:c,schema:l,parentSchema:u,data:a,errsCount:f,it:m}=s;if(!f)throw new Error("ajv implementation error");const{allErrors:y,opts:$}=m;if(m.props=!0,$.removeAdditional!=="all"&&(0,n.alwaysValidSchema)(m,l))return;const S=(0,e.allSchemaProperties)(u.properties),g=(0,e.allSchemaProperties)(u.patternProperties);_(),s.ok((0,t._)`${f} === ${r.default.errors}`);function _(){c.forIn("key",a,h=>{!S.length&&!g.length?E(h):c.if(p(h),()=>E(h))})}function p(h){let v;if(S.length>8){const I=(0,n.schemaRefOrVal)(m,u.properties,"properties");v=(0,e.isOwnProperty)(c,I,h)}else S.length?v=(0,t.or)(...S.map(I=>(0,t._)`${h} === ${I}`)):v=t.nil;return g.length&&(v=(0,t.or)(v,...g.map(I=>(0,t._)`${(0,e.usePattern)(s,I)}.test(${h})`))),(0,t.not)(v)}function w(h){c.code((0,t._)`delete ${a}[${h}]`)}function E(h){if($.removeAdditional==="all"||$.removeAdditional&&l===!1){w(h);return}if(l===!1){s.setParams({additionalProperty:h}),s.error(),y||c.break();return}if(typeof l=="object"&&!(0,n.alwaysValidSchema)(m,l)){const v=c.name("valid");$.removeAdditional==="failing"?(d(h,v,!1),c.if((0,t.not)(v),()=>{s.reset(),w(h)})):(d(h,v),y||c.if((0,t.not)(v),()=>c.break()))}}function d(h,v,I){const O={keyword:"additionalProperties",dataProp:h,dataPropType:n.Type.Str};I===!1&&Object.assign(O,{compositeRule:!0,createErrors:!1,allErrors:!1}),s.subschema(O,v)}}};return Ot.default=i,Ot}var Mt={},ii;function Ko(){if(ii)return Mt;ii=1,Object.defineProperty(Mt,"__esModule",{value:!0});const e=pr(),t=Ne(),r=Z(),n=ta(),o={keyword:"properties",type:"object",schemaType:"object",code(i){const{gen:s,schema:c,parentSchema:l,data:u,it:a}=i;a.opts.removeAdditional==="all"&&l.additionalProperties===void 0&&n.default.code(new e.KeywordCxt(a,n.default,"additionalProperties"));const f=(0,t.allSchemaProperties)(c);for(const g of f)a.definedProperties.add(g);a.opts.unevaluated&&f.length&&a.props!==!0&&(a.props=r.mergeEvaluated.props(s,(0,r.toHash)(f),a.props));const m=f.filter(g=>!(0,r.alwaysValidSchema)(a,c[g]));if(m.length===0)return;const y=s.name("valid");for(const g of m)$(g)?S(g):(s.if((0,t.propertyInData)(s,u,g,a.opts.ownProperties)),S(g),a.allErrors||s.else().var(y,!0),s.endIf()),i.it.definedProperties.add(g),i.ok(y);function $(g){return a.opts.useDefaults&&!a.compositeRule&&c[g].default!==void 0}function S(g){i.subschema({keyword:"properties",schemaProp:g,dataProp:g},y)}}};return Mt.default=o,Mt}var qt={},ai;function Bo(){if(ai)return qt;ai=1,Object.defineProperty(qt,"__esModule",{value:!0});const e=Ne(),t=W(),r=Z(),n=Z(),o={keyword:"patternProperties",type:"object",schemaType:"object",code(i){const{gen:s,schema:c,data:l,parentSchema:u,it:a}=i,{opts:f}=a,m=(0,e.allSchemaProperties)(c),y=m.filter(E=>(0,r.alwaysValidSchema)(a,c[E]));if(m.length===0||y.length===m.length&&(!a.opts.unevaluated||a.props===!0))return;const $=f.strictSchema&&!f.allowMatchingProperties&&u.properties,S=s.name("valid");a.props!==!0&&!(a.props instanceof t.Name)&&(a.props=(0,n.evaluatedPropsToName)(s,a.props));const{props:g}=a;_();function _(){for(const E of m)$&&p(E),a.allErrors?w(E):(s.var(S,!0),w(E),s.if(S))}function p(E){for(const d in $)new RegExp(E).test(d)&&(0,r.checkStrictMode)(a,`property ${d} matches pattern ${E} (use allowMatchingProperties)`)}function w(E){s.forIn("key",l,d=>{s.if((0,t._)`${(0,e.usePattern)(i,E)}.test(${d})`,()=>{const h=y.includes(E);h||i.subschema({keyword:"patternProperties",schemaProp:E,dataProp:d,dataPropType:n.Type.Str},S),a.opts.unevaluated&&g!==!0?s.assign((0,t._)`${g}[${d}]`,!0):!h&&!a.allErrors&&s.if((0,t.not)(S),()=>s.break())})})}}};return qt.default=o,qt}var xt={},oi;function Ho(){if(oi)return xt;oi=1,Object.defineProperty(xt,"__esModule",{value:!0});const e=Z(),t={keyword:"not",schemaType:["object","boolean"],trackErrors:!0,code(r){const{gen:n,schema:o,it:i}=r;if((0,e.alwaysValidSchema)(i,o)){r.fail();return}const s=n.name("valid");r.subschema({keyword:"not",compositeRule:!0,createErrors:!1,allErrors:!1},s),r.failResult(s,()=>r.reset(),()=>r.error())},error:{message:"must NOT be valid"}};return xt.default=t,xt}var Lt={},si;function Go(){if(si)return Lt;si=1,Object.defineProperty(Lt,"__esModule",{value:!0});const t={keyword:"anyOf",schemaType:"array",trackErrors:!0,code:Ne().validateUnion,error:{message:"must match a schema in anyOf"}};return Lt.default=t,Lt}var Dt={},ci;function Wo(){if(ci)return Dt;ci=1,Object.defineProperty(Dt,"__esModule",{value:!0});const e=W(),t=Z(),n={keyword:"oneOf",schemaType:"array",trackErrors:!0,error:{message:"must match exactly one schema in oneOf",params:({params:o})=>(0,e._)`{passingSchemas: ${o.passing}}`},code(o){const{gen:i,schema:s,parentSchema:c,it:l}=o;if(!Array.isArray(s))throw new Error("ajv implementation error");if(l.opts.discriminator&&c.discriminator)return;const u=s,a=i.let("valid",!1),f=i.let("passing",null),m=i.name("_valid");o.setParams({passing:f}),i.block(y),o.result(a,()=>o.reset(),()=>o.error(!0));function y(){u.forEach(($,S)=>{let g;(0,t.alwaysValidSchema)(l,$)?i.var(m,!0):g=o.subschema({keyword:"oneOf",schemaProp:S,compositeRule:!0},m),S>0&&i.if((0,e._)`${m} && ${a}`).assign(a,!1).assign(f,(0,e._)`[${f}, ${S}]`).else(),i.if(m,()=>{i.assign(a,!0),i.assign(f,S),g&&o.mergeEvaluated(g,e.Name)})})}}};return Dt.default=n,Dt}var Ft={},ui;function Xo(){if(ui)return Ft;ui=1,Object.defineProperty(Ft,"__esModule",{value:!0});const e=Z(),t={keyword:"allOf",schemaType:"array",code(r){const{gen:n,schema:o,it:i}=r;if(!Array.isArray(o))throw new Error("ajv implementation error");const s=n.name("valid");o.forEach((c,l)=>{if((0,e.alwaysValidSchema)(i,c))return;const u=r.subschema({keyword:"allOf",schemaProp:l},s);r.ok(s),r.mergeEvaluated(u)})}};return Ft.default=t,Ft}var Ut={},li;function Yo(){if(li)return Ut;li=1,Object.defineProperty(Ut,"__esModule",{value:!0});const e=W(),t=Z(),n={keyword:"if",schemaType:["object","boolean"],trackErrors:!0,error:{message:({params:i})=>(0,e.str)`must match "${i.ifClause}" schema`,params:({params:i})=>(0,e._)`{failingKeyword: ${i.ifClause}}`},code(i){const{gen:s,parentSchema:c,it:l}=i;c.then===void 0&&c.else===void 0&&(0,t.checkStrictMode)(l,'"if" without "then" and "else" is ignored');const u=o(l,"then"),a=o(l,"else");if(!u&&!a)return;const f=s.let("valid",!0),m=s.name("_valid");if(y(),i.reset(),u&&a){const S=s.let("ifClause");i.setParams({ifClause:S}),s.if(m,$("then",S),$("else",S))}else u?s.if(m,$("then")):s.if((0,e.not)(m),$("else"));i.pass(f,()=>i.error(!0));function y(){const S=i.subschema({keyword:"if",compositeRule:!0,createErrors:!1,allErrors:!1},m);i.mergeEvaluated(S)}function $(S,g){return()=>{const _=i.subschema({keyword:S},m);s.assign(f,m),i.mergeValidEvaluated(_,f),g?s.assign(g,(0,e._)`${S}`):i.setParams({ifClause:S})}}}};function o(i,s){const c=i.schema[s];return c!==void 0&&!(0,t.alwaysValidSchema)(i,c)}return Ut.default=n,Ut}var zt={},di;function Jo(){if(di)return zt;di=1,Object.defineProperty(zt,"__esModule",{value:!0});const e=Z(),t={keyword:["then","else"],schemaType:["object","boolean"],code({keyword:r,parentSchema:n,it:o}){n.if===void 0&&(0,e.checkStrictMode)(o,`"${r}" without "if" is ignored`)}};return zt.default=t,zt}var fi;function Qo(){if(fi)return kt;fi=1,Object.defineProperty(kt,"__esModule",{value:!0});const e=Zi(),t=Fo(),r=ea(),n=Uo(),o=zo(),i=Gr(),s=Vo(),c=ta(),l=Ko(),u=Bo(),a=Ho(),f=Go(),m=Wo(),y=Xo(),$=Yo(),S=Jo();function g(_=!1){const p=[a.default,f.default,m.default,y.default,$.default,S.default,s.default,c.default,i.default,l.default,u.default];return _?p.push(t.default,n.default):p.push(e.default,r.default),p.push(o.default),p}return kt.default=g,kt}var Vt={},Je={},mi;function ra(){if(mi)return Je;mi=1,Object.defineProperty(Je,"__esModule",{value:!0}),Je.dynamicAnchor=void 0;const e=W(),t=Ce(),r=yr(),n=Br(),o={keyword:"$dynamicAnchor",schemaType:"string",code:c=>i(c,c.schema)};function i(c,l){const{gen:u,it:a}=c;a.schemaEnv.root.dynamicAnchors[l]=!0;const f=(0,e._)`${t.default.dynamicAnchors}${(0,e.getProperty)(l)}`,m=a.errSchemaPath==="#"?a.validateName:s(c);u.if((0,e._)`!${f}`,()=>u.assign(f,m))}Je.dynamicAnchor=i;function s(c){const{schemaEnv:l,schema:u,self:a}=c.it,{root:f,baseId:m,localRefs:y,meta:$}=l.root,{schemaId:S}=a.opts,g=new r.SchemaEnv({schema:u,schemaId:S,root:f,baseId:m,localRefs:y,meta:$});return r.compileSchema.call(a,g),(0,n.getValidate)(c,g)}return Je.default=o,Je}var Qe={},pi;function na(){if(pi)return Qe;pi=1,Object.defineProperty(Qe,"__esModule",{value:!0}),Qe.dynamicRef=void 0;const e=W(),t=Ce(),r=Br(),n={keyword:"$dynamicRef",schemaType:"string",code:i=>o(i,i.schema)};function o(i,s){const{gen:c,keyword:l,it:u}=i;if(s[0]!=="#")throw new Error(`"${l}" only supports hash fragment reference`);const a=s.slice(1);if(u.allErrors)f();else{const y=c.let("valid",!1);f(y),i.ok(y)}function f(y){if(u.schemaEnv.root.dynamicAnchors[a]){const $=c.let("_v",(0,e._)`${t.default.dynamicAnchors}${(0,e.getProperty)(a)}`);c.if($,m($,y),m(u.validateName,y))}else m(u.validateName,y)()}function m(y,$){return $?()=>c.block(()=>{(0,r.callRef)(i,y),c.let($,!0)}):()=>(0,r.callRef)(i,y)}}return Qe.dynamicRef=o,Qe.default=n,Qe}var Kt={},hi;function Zo(){if(hi)return Kt;hi=1,Object.defineProperty(Kt,"__esModule",{value:!0});const e=ra(),t=Z(),r={keyword:"$recursiveAnchor",schemaType:"boolean",code(n){n.schema?(0,e.dynamicAnchor)(n,""):(0,t.checkStrictMode)(n.it,"$recursiveAnchor: false is ignored")}};return Kt.default=r,Kt}var Bt={},yi;function es(){if(yi)return Bt;yi=1,Object.defineProperty(Bt,"__esModule",{value:!0});const e=na(),t={keyword:"$recursiveRef",schemaType:"string",code:r=>(0,e.dynamicRef)(r,r.schema)};return Bt.default=t,Bt}var gi;function ts(){if(gi)return Vt;gi=1,Object.defineProperty(Vt,"__esModule",{value:!0});const e=ra(),t=na(),r=Zo(),n=es(),o=[e.default,t.default,r.default,n.default];return Vt.default=o,Vt}var Ht={},Gt={},vi;function rs(){if(vi)return Gt;vi=1,Object.defineProperty(Gt,"__esModule",{value:!0});const e=Gr(),t={keyword:"dependentRequired",type:"object",schemaType:"object",error:e.error,code:r=>(0,e.validatePropertyDeps)(r)};return Gt.default=t,Gt}var Wt={},bi;function ns(){if(bi)return Wt;bi=1,Object.defineProperty(Wt,"__esModule",{value:!0});const e=Gr(),t={keyword:"dependentSchemas",type:"object",schemaType:"object",code:r=>(0,e.validateSchemaDeps)(r)};return Wt.default=t,Wt}var Xt={},_i;function is(){if(_i)return Xt;_i=1,Object.defineProperty(Xt,"__esModule",{value:!0});const e=Z(),t={keyword:["maxContains","minContains"],type:"array",schemaType:"number",code({keyword:r,parentSchema:n,it:o}){n.contains===void 0&&(0,e.checkStrictMode)(o,`"${r}" without "contains" is ignored`)}};return Xt.default=t,Xt}var $i;function as(){if($i)return Ht;$i=1,Object.defineProperty(Ht,"__esModule",{value:!0});const e=rs(),t=ns(),r=is(),n=[e.default,t.default,r.default];return Ht.default=n,Ht}var Yt={},Jt={},wi;function os(){if(wi)return Jt;wi=1,Object.defineProperty(Jt,"__esModule",{value:!0});const e=W(),t=Z(),r=Ce(),o={keyword:"unevaluatedProperties",type:"object",schemaType:["boolean","object"],trackErrors:!0,error:{message:"must NOT have unevaluated properties",params:({params:i})=>(0,e._)`{unevaluatedProperty: ${i.unevaluatedProperty}}`},code(i){const{gen:s,schema:c,data:l,errsCount:u,it:a}=i;if(!u)throw new Error("ajv implementation error");const{allErrors:f,props:m}=a;m instanceof e.Name?s.if((0,e._)`${m} !== true`,()=>s.forIn("key",l,g=>s.if($(m,g),()=>y(g)))):m!==!0&&s.forIn("key",l,g=>m===void 0?y(g):s.if(S(m,g),()=>y(g))),a.props=!0,i.ok((0,e._)`${u} === ${r.default.errors}`);function y(g){if(c===!1){i.setParams({unevaluatedProperty:g}),i.error(),f||s.break();return}if(!(0,t.alwaysValidSchema)(a,c)){const _=s.name("valid");i.subschema({keyword:"unevaluatedProperties",dataProp:g,dataPropType:t.Type.Str},_),f||s.if((0,e.not)(_),()=>s.break())}}function $(g,_){return(0,e._)`!${g} || !${g}[${_}]`}function S(g,_){const p=[];for(const w in g)g[w]===!0&&p.push((0,e._)`${_} !== ${w}`);return(0,e.and)(...p)}}};return Jt.default=o,Jt}var Qt={},Si;function ss(){if(Si)return Qt;Si=1,Object.defineProperty(Qt,"__esModule",{value:!0});const e=W(),t=Z(),n={keyword:"unevaluatedItems",type:"array",schemaType:["boolean","object"],error:{message:({params:{len:o}})=>(0,e.str)`must NOT have more than ${o} items`,params:({params:{len:o}})=>(0,e._)`{limit: ${o}}`},code(o){const{gen:i,schema:s,data:c,it:l}=o,u=l.items||0;if(u===!0)return;const a=i.const("len",(0,e._)`${c}.length`);if(s===!1)o.setParams({len:u}),o.fail((0,e._)`${a} > ${u}`);else if(typeof s=="object"&&!(0,t.alwaysValidSchema)(l,s)){const m=i.var("valid",(0,e._)`${a} <= ${u}`);i.if((0,e.not)(m),()=>f(m,u)),o.ok(m)}l.items=!0;function f(m,y){i.forRange("i",y,a,$=>{o.subschema({keyword:"unevaluatedItems",dataProp:$,dataPropType:t.Type.Num},m),l.allErrors||i.if((0,e.not)(m),()=>i.break())})}}};return Qt.default=n,Qt}var Ei;function cs(){if(Ei)return Yt;Ei=1,Object.defineProperty(Yt,"__esModule",{value:!0});const e=os(),t=ss(),r=[e.default,t.default];return Yt.default=r,Yt}var Zt={},er={},Pi;function us(){if(Pi)return er;Pi=1,Object.defineProperty(er,"__esModule",{value:!0});const e=W(),r={keyword:"format",type:["number","string"],schemaType:"string",$data:!0,error:{message:({schemaCode:n})=>(0,e.str)`must match format "${n}"`,params:({schemaCode:n})=>(0,e._)`{format: ${n}}`},code(n,o){const{gen:i,data:s,$data:c,schema:l,schemaCode:u,it:a}=n,{opts:f,errSchemaPath:m,schemaEnv:y,self:$}=a;if(!f.validateFormats)return;c?S():g();function S(){const _=i.scopeValue("formats",{ref:$.formats,code:f.code.formats}),p=i.const("fDef",(0,e._)`${_}[${u}]`),w=i.let("fType"),E=i.let("format");i.if((0,e._)`typeof ${p} == "object" && !(${p} instanceof RegExp)`,()=>i.assign(w,(0,e._)`${p}.type || "string"`).assign(E,(0,e._)`${p}.validate`),()=>i.assign(w,(0,e._)`"string"`).assign(E,p)),n.fail$data((0,e.or)(d(),h()));function d(){return f.strictSchema===!1?e.nil:(0,e._)`${u} && !${E}`}function h(){const v=y.$async?(0,e._)`(${p}.async ? await ${E}(${s}) : ${E}(${s}))`:(0,e._)`${E}(${s})`,I=(0,e._)`(typeof ${E} == "function" ? ${v} : ${E}.test(${s}))`;return(0,e._)`${E} && ${E} !== true && ${w} === ${o} && !${I}`}}function g(){const _=$.formats[l];if(!_){d();return}if(_===!0)return;const[p,w,E]=h(_);p===o&&n.pass(v());function d(){if(f.strictSchema===!1){$.logger.warn(I());return}throw new Error(I());function I(){return`unknown format "${l}" ignored in schema at path "${m}"`}}function h(I){const O=I instanceof RegExp?(0,e.regexpCode)(I):f.code.formats?(0,e._)`${f.code.formats}${(0,e.getProperty)(l)}`:void 0,A=i.scopeValue("formats",{key:l,ref:I,code:O});return typeof I=="object"&&!(I instanceof RegExp)?[I.type||"string",I.validate,(0,e._)`${A}.validate`]:["string",I,A]}function v(){if(typeof _=="object"&&!(_ instanceof RegExp)&&_.async){if(!y.$async)throw new Error("async format in sync schema");return(0,e._)`await ${E}(${s})`}return typeof w=="function"?(0,e._)`${E}(${s})`:(0,e._)`${E}.test(${s})`}}}};return er.default=r,er}var Ii;function ls(){if(Ii)return Zt;Ii=1,Object.defineProperty(Zt,"__esModule",{value:!0});const t=[us().default];return Zt.default=t,Zt}var ze={},Ri;function ds(){return Ri||(Ri=1,Object.defineProperty(ze,"__esModule",{value:!0}),ze.contentVocabulary=ze.metadataVocabulary=void 0,ze.metadataVocabulary=["title","description","default","deprecated","readOnly","writeOnly","examples"],ze.contentVocabulary=["contentMediaType","contentEncoding","contentSchema"]),ze}var Ai;function fs(){if(Ai)return mt;Ai=1,Object.defineProperty(mt,"__esModule",{value:!0});const e=Ro(),t=Do(),r=Qo(),n=ts(),o=as(),i=cs(),s=ls(),c=ds(),l=[n.default,e.default,t.default,(0,r.default)(!0),s.default,c.metadataVocabulary,c.contentVocabulary,o.default,i.default];return mt.default=l,mt}var tr={},nt={},ki;function ms(){if(ki)return nt;ki=1,Object.defineProperty(nt,"__esModule",{value:!0}),nt.DiscrError=void 0;var e;return(function(t){t.Tag="tag",t.Mapping="mapping"})(e||(nt.DiscrError=e={})),nt}var Ci;function ps(){if(Ci)return tr;Ci=1,Object.defineProperty(tr,"__esModule",{value:!0});const e=W(),t=ms(),r=yr(),n=hr(),o=Z(),s={keyword:"discriminator",type:"object",schemaType:"object",error:{message:({params:{discrError:c,tagName:l}})=>c===t.DiscrError.Tag?`tag "${l}" must be string`:`value of tag "${l}" must be in oneOf`,params:({params:{discrError:c,tag:l,tagName:u}})=>(0,e._)`{error: ${c}, tag: ${u}, tagValue: ${l}}`},code(c){const{gen:l,data:u,schema:a,parentSchema:f,it:m}=c,{oneOf:y}=f;if(!m.opts.discriminator)throw new Error("discriminator: requires discriminator option");const $=a.propertyName;if(typeof $!="string")throw new Error("discriminator: requires propertyName");if(a.mapping)throw new Error("discriminator: mapping is not supported");if(!y)throw new Error("discriminator: requires oneOf keyword");const S=l.let("valid",!1),g=l.const("tag",(0,e._)`${u}${(0,e.getProperty)($)}`);l.if((0,e._)`typeof ${g} == "string"`,()=>_(),()=>c.error(!1,{discrError:t.DiscrError.Tag,tag:g,tagName:$})),c.ok(S);function _(){const E=w();l.if(!1);for(const d in E)l.elseIf((0,e._)`${g} === ${d}`),l.assign(S,p(E[d]));l.else(),c.error(!1,{discrError:t.DiscrError.Mapping,tag:g,tagName:$}),l.endIf()}function p(E){const d=l.name("valid"),h=c.subschema({keyword:"oneOf",schemaProp:E},d);return c.mergeEvaluated(h,e.Name),d}function w(){var E;const d={},h=I(f);let v=!0;for(let M=0;Mthis.addMetaSchema(m,void 0,!1)),this;function f(m,y){return a?m.$dataMetaSchema(y,l):y}}return rr.default=u,rr}var ji;function Nc(){return ji||(ji=1,(function(e,t){Object.defineProperty(t,"__esModule",{value:!0}),t.MissingRefError=t.ValidationError=t.CodeGen=t.Name=t.nil=t.stringify=t.str=t._=t.KeywordCxt=t.Ajv2020=void 0;const r=Po(),n=fs(),o=ps(),i=Cc(),s="https://json-schema.org/draft/2020-12/schema";class c extends r.default{constructor(y={}){super({...y,dynamicRef:!0,next:!0,unevaluated:!0})}_addVocabularies(){super._addVocabularies(),n.default.forEach(y=>this.addVocabulary(y)),this.opts.discriminator&&this.addKeyword(o.default)}_addDefaultMetaSchema(){super._addDefaultMetaSchema();const{$data:y,meta:$}=this.opts;$&&(i.default.call(this,y),this.refs["http://json-schema.org/schema"]=s)}defaultMeta(){return this.opts.defaultMeta=super.defaultMeta()||(this.getSchema(s)?s:void 0)}}t.Ajv2020=c,e.exports=t=c,e.exports.Ajv2020=c,Object.defineProperty(t,"__esModule",{value:!0}),t.default=c;var l=pr();Object.defineProperty(t,"KeywordCxt",{enumerable:!0,get:function(){return l.KeywordCxt}});var u=W();Object.defineProperty(t,"_",{enumerable:!0,get:function(){return u._}}),Object.defineProperty(t,"str",{enumerable:!0,get:function(){return u.str}}),Object.defineProperty(t,"stringify",{enumerable:!0,get:function(){return u.stringify}}),Object.defineProperty(t,"nil",{enumerable:!0,get:function(){return u.nil}}),Object.defineProperty(t,"Name",{enumerable:!0,get:function(){return u.Name}}),Object.defineProperty(t,"CodeGen",{enumerable:!0,get:function(){return u.CodeGen}});var a=Kr();Object.defineProperty(t,"ValidationError",{enumerable:!0,get:function(){return a.default}});var f=hr();Object.defineProperty(t,"MissingRefError",{enumerable:!0,get:function(){return f.default}})})(ct,ct.exports)),ct.exports}var jc=Nc();const Tc=co(jc),ia={providerAdvertisement:{$schema:"https://json-schema.org/draft/2020-12/schema",$id:"gamecult.eve.provider_advertisement.v1",title:"Eve Provider Advertisement",type:"object",required:["schema","providerId","serviceId","verseId","title","kind","freshness","schemas","witnesses","surfaces","commands"],properties:{schema:{const:"gamecult.eve.provider_advertisement.v1"},providerId:{type:"string",minLength:1},serviceId:{type:"string",minLength:1},verseId:{type:"string",minLength:1},rootVerse:{type:"string",minLength:1},canonicalService:{type:"string"},locatedService:{type:"string"},cultMeshAddress:{type:"string"},title:{type:"string",minLength:1},kind:{type:"string",minLength:1},updatedAt:{type:"string"},updatedAtUtc:{type:"string"},freshness:{type:"object",required:["state"],properties:{state:{type:"string",minLength:1},lastSeenAt:{type:"string"},lastSeenAtUtc:{type:"string"},maxAgeMs:{type:"number"}},additionalProperties:!0},schemas:{type:"array",items:{type:["string","object"]}},witnesses:{type:"array",items:{type:"object",required:["kind"],properties:{kind:{type:"string",minLength:1},ref:{type:"string"},path:{type:"string"},summary:{type:"string"}},additionalProperties:!0}},surfaces:{type:"array",items:{type:"object",required:["surfaceId","schema","transport"],properties:{surfaceId:{type:"string",minLength:1},schema:{type:"string",minLength:1},key:{type:"string"},recordRef:{type:"string"},url:{type:"string"},transport:{type:"string",minLength:1},status:{type:"string",minLength:1},surfaceKind:{type:"string",minLength:1},interactionModel:{type:"string",minLength:1},worldInteraction:{type:"object",required:["projectionKind","stateSchemas","commandBoundary","receiptSchema","loweringTargets","ownership"],properties:{projectionKind:{type:"string",minLength:1},stateSchemas:{type:"array",items:{type:"string",minLength:1}},commandBoundary:{type:"string",minLength:1},commandRecordRef:{type:"string"},receiptSchema:{type:"string",minLength:1},receiptRecordRef:{type:"string"},assetManifestRecordRef:{type:"string"},loweringTargets:{type:"array",items:{type:"string",minLength:1}},ownership:{type:"string",minLength:1}},additionalProperties:!0},requiresPlugins:{type:"array",items:{type:"object",required:["pluginId","requiredCapabilities"],properties:{pluginId:{type:"string",minLength:1},versionRange:{type:"string"},availability:{type:"string",enum:["required","optional","optional-nested"]},requiredCapabilities:{type:"array",items:{type:"string",minLength:1}},optionalCapabilities:{type:"array",items:{type:"string",minLength:1}}},allOf:[{if:{properties:{availability:{const:"required"}}},then:{properties:{requiredCapabilities:{minItems:1}}}},{if:{required:["availability"],properties:{availability:{const:"optional-nested"}}},then:{required:["optionalCapabilities"],properties:{requiredCapabilities:{maxItems:0},optionalCapabilities:{minItems:1}}}}],additionalProperties:!0}}},additionalProperties:!0}},commands:{type:"array",items:{type:"object",required:["command","transport"],properties:{command:{type:"string",minLength:1},transport:{type:"string",minLength:1},summary:{type:"string"}},additionalProperties:!0}},conformanceScenarios:{type:"array",items:{type:"object",required:["scenarioId","schema","path"],properties:{scenarioId:{type:"string",minLength:1},schema:{type:"string",minLength:1},path:{type:"string",minLength:1},summary:{type:"string"}},additionalProperties:!0}}},additionalProperties:!0},surface:{$schema:"https://json-schema.org/draft/2020-12/schema",$id:"gamecult.eve.surface.v1",title:"Eve Surface Document",type:"object",required:["type","schema","providerId","providerKind","title","version","surface","commands"],properties:{type:{const:"surface-state"},schema:{const:"gamecult.eve.surface.v1"},providerId:{type:"string",minLength:1},providerKind:{type:"string",minLength:1},title:{type:"string",minLength:1},version:{type:"integer",minimum:0},updatedAt:{type:"string",minLength:1},updatedAtUtc:{type:"string",minLength:1},surface:{type:"object",required:["root","styles"],properties:{id:{type:"string"},title:{type:"string"},root:{$ref:"#/$defs/component"},styles:{type:["object","array"]}},additionalProperties:!0},commands:{type:"array",items:{$ref:"gamecult.eve.command.v1"}},nodes:{type:"array",items:{type:"object"}},selectedNodeId:{type:"string"}},$defs:{component:{type:"object",required:["id","kind","props","children"],properties:{id:{type:"string",minLength:1},kind:{type:"string",minLength:1},props:{type:"object"},children:{type:"array",items:{$ref:"#/$defs/component"}},stateBindings:{type:"array",items:{type:"object",required:["targetProp","pointerId","sourceId","schemaId","routeKind"],properties:{targetProp:{type:"string",minLength:1},pointerId:{type:"string",minLength:1},sourceId:{type:"string",minLength:1},schemaId:{type:"string",minLength:1},routeKind:{type:"string",minLength:1},routeDescription:{type:"string"},bindingName:{type:"string",minLength:1},documentId:{type:"string"},fieldPath:{type:"string"},valueKind:{type:"string",enum:["string","number","boolean","choice","string-list"]},accessMode:{type:"string",enum:["read","write","read-write","local-draft"]},authority:{type:"string"},writeCommand:{type:"string"}},additionalProperties:!0}},embeddedDocuments:{type:"array",items:{type:"object",required:["slotId","documentId","schemaId","presentationKind"],properties:{slotId:{type:"string",minLength:1},documentId:{type:"string",minLength:1},schemaId:{type:"string",minLength:1},presentationKind:{type:"string",minLength:1},routeHint:{type:["string","object"]}},additionalProperties:!0}}},additionalProperties:!0}},anyOf:[{required:["updatedAt"]},{required:["updatedAtUtc"]}],additionalProperties:!0},commandDescriptor:{$schema:"https://json-schema.org/draft/2020-12/schema",$id:"gamecult.eve.command.v1",title:"Eve Command Descriptor",type:"object",required:["schema","command"],properties:{schema:{const:"gamecult.eve.command.v1"},command:{type:"string",minLength:1},label:{type:"string"},surfaceId:{type:"string"},transport:{type:"string"},authority:{type:"string"},result:{type:"string"},payloadSchema:{type:"string"},captureBindings:{type:"array",items:{type:"string",minLength:1},uniqueItems:!0}},additionalProperties:!0},commandInvocation:{$schema:"https://json-schema.org/draft/2020-12/schema",$id:"gamecult.eve.command_invocation.v1",title:"Eve Command Invocation",type:"object",required:["schema","providerId","surfaceId","operation","payload","issuedAt","clientId","commandBoundary","receiptSchema"],properties:{schema:{const:"gamecult.eve.command_invocation.v1"},providerId:{type:"string",minLength:1},surfaceId:{type:"string",minLength:1},operation:{type:"object",required:["operationId"],properties:{operationId:{type:"string",minLength:1},schemaId:{type:"string"},idempotencyKey:{type:"string"},routeHint:{type:"object"}},additionalProperties:!0},payload:{type:"object"},issuedAt:{type:"string"},clientId:{type:"string",minLength:1},commandBoundary:{type:"string",minLength:1},receiptSchema:{type:"string",minLength:1}},additionalProperties:!1},commandReceipt:{$schema:"https://json-schema.org/draft/2020-12/schema",$id:"gamecult.eve.command_receipt.v1",title:"Eve Command Receipt",type:"object",required:["schema","receiptId","commandId","command","state","ownerRepo","authority","providerId","surfaceId","sourceVersion"],properties:{schema:{const:"gamecult.eve.command_receipt.v1"},receiptId:{type:"string",minLength:1},commandId:{type:"string"},command:{type:"string",minLength:1},state:{type:"string",enum:["accepted","denied","pending","reconciled"]},ownerRepo:{type:"string",minLength:1},authority:{type:"string",minLength:1},providerId:{type:"string"},surfaceId:{type:"string"},message:{type:"string"},diagnostics:{type:"array",items:{type:"object"}},issuedAtUtc:{type:"string"},sourceVersion:{type:"integer",minimum:0},navigation:{type:"object",required:["verseId","surfaceId"],properties:{verseId:{type:"string",minLength:1},providerId:{type:"string"},surfaceId:{type:"string",minLength:1},surfaceKind:{type:"string"},rendezvousEndpoints:{type:"array",items:{type:"string",minLength:1},uniqueItems:!0}},additionalProperties:!1}},additionalProperties:!0},commandResult:{$schema:"https://json-schema.org/draft/2020-12/schema",$id:"gamecult.eve.command_result.v1",title:"Eve Command Result",type:"object",required:["schema","receipt"],properties:{schema:{const:"gamecult.eve.command_result.v1"},receipt:{$ref:"gamecult.eve.command_receipt.v1"},transientProjection:{type:"object",required:["schema"],properties:{schema:{const:"gamecult.eve.surface.v1"}},additionalProperties:!0},pluginPayload:{type:"object",required:["pluginId","schemaId","payload"],properties:{pluginId:{type:"string",minLength:1},schemaId:{type:"string",minLength:1},payload:{type:"object"}},additionalProperties:!1},draftDirective:{type:"object",required:["clear"],properties:{clear:{type:"boolean"},bindingNames:{type:"array",items:{type:"string",minLength:1},uniqueItems:!0}},additionalProperties:!1}},additionalProperties:!1},inputCapability:{$schema:"https://json-schema.org/draft/2020-12/schema",$id:"gamecult.eve.input_capability.v1",title:"Eve Input Capability",type:"object",required:["schema","providerId","capabilityId","actions","defaultProfiles"],properties:{schema:{const:"gamecult.eve.input_capability.v1"},providerId:{type:"string",minLength:1},capabilityId:{type:"string",minLength:1},version:{type:"integer",minimum:0},actions:{type:"array",items:{type:"object",required:["actionId","label","operation","availability"],properties:{actionId:{type:"string",minLength:1},label:{type:"string",minLength:1},operation:{type:"string",minLength:1},context:{type:"string"},category:{type:"string"},iconRef:{type:"string"},actionBar:{type:"boolean"},availability:{enum:["available","dormant","unavailable"]},sourceRef:{type:"string"},payload:{type:"object",additionalProperties:{type:"string"}},inputValue:{$ref:"#/$defs/inputValue"}},additionalProperties:!1}},defaultProfiles:{type:"array",items:{type:"object",required:["profileId","deviceClass","bindings"],properties:{profileId:{type:"string",minLength:1},deviceClass:{enum:["keyboard-mouse","gamepad"]},bindings:{type:"array",items:{$ref:"#/$defs/binding"}}},additionalProperties:!1}}},$defs:{inputValue:{type:"object",required:["model"],properties:{model:{enum:["button-hold.v1","axis.v1","scalar.v1","view-direction.v1"]},payloadKey:{type:"string",minLength:1},currentValue:{type:"number"},minimumValue:{type:"number"},maximumValue:{type:"number"},stepValue:{type:"number",exclusiveMinimum:0},unit:{type:"string",minLength:1},payloadKeys:{type:"array",minItems:3,maxItems:3,uniqueItems:!0,items:{type:"string",minLength:1}}},allOf:[{if:{properties:{model:{const:"view-direction.v1"}},required:["model"]},then:{required:["payloadKeys"]},else:{required:["payloadKey"]}},{if:{properties:{model:{const:"scalar.v1"}},required:["model"]},then:{required:["currentValue"]}}],additionalProperties:!1},gesture:{type:"object",required:["kind","controls"],properties:{kind:{enum:["direct","chord","sequence","axis"]},controls:{type:"array",minItems:1,items:{type:"string",minLength:1}},maxStepIntervalMs:{type:"integer",minimum:50},completionControl:{type:"string"}},additionalProperties:!1},binding:{type:"object",required:["bindingId","actionId","gesture"],properties:{bindingId:{type:"string",minLength:1},actionId:{type:"string",minLength:1},gesture:{$ref:"#/$defs/gesture"},actionBar:{type:"boolean"}},additionalProperties:!1}},additionalProperties:!1}},Wr=new Tc({allErrors:!0,allowUnionTypes:!0,strict:!0,strictRequired:!1,strictTypes:!1});for(const e of Object.values(ia))Wr.addSchema(e);const Oc=Object.fromEntries(Object.entries(ia).map(([e,t])=>[e,Lc(t.$id)]));class Mc extends TypeError{contract;errors;constructor(t,r){super(`Invalid Eve ${t}: ${Wr.errorsText(r,{separator:"; "})}`),this.name="EveContractValidationError",this.contract=t,this.errors=r}}function aa(e,t){const r=Oc[e];if(!r(t))throw new Mc(e,r.errors??[]);return t}const qc=e=>aa("surface",e),xc=e=>{const t=aa("commandResult",e);return t.transientProjection&&qc(t.transientProjection),t};function Lc(e){const t=Wr.getSchema(e);if(!t)throw new Error(`Eve contract schema ${e} was not registered.`);return t}class oa{values=new Map;key(t,r,n){return`${t}${r}${n}`}has(t,r,n){return this.values.has(this.key(t,r,n))}get(t,r,n){return this.values.get(this.key(t,r,n))}set(t,r,n,o){this.values.set(this.key(t,r,n),o)}clear(t,r,n){if(n?.length){for(const i of n)this.values.delete(this.key(t,r,i));return}const o=`${t}${r}`;for(const i of this.values.keys())i.startsWith(o)&&this.values.delete(i)}capture(t,r,n){return Object.fromEntries(n.map(o=>[o,this.get(t,r,o)]))}}const Xr=[Oa];function Dc(e,t=Xr){const r=[];for(const n of e.requiresPlugins||[]){const o=t.find(s=>s.pluginId===n.pluginId);if(!o){if((n.availability||"required")==="required")throw new Error(`Missing required Eve plugin adapter ${n.pluginId}.`);continue}const i=(n.requiredCapabilities||[]).filter(s=>!o.capabilities.includes(s));if(i.length>0)throw new Error(`Eve plugin adapter ${n.pluginId} lacks required capabilities: ${i.join(", ")}.`);r.push(o)}return r}function Fc(e,t=""){const r=e.surfaces||e.localAdvertisement?.surfaces||[],n=t?r.find(o=>o.surfaceId===t):r.find(o=>o.status!=="unavailable")??r[0];if(!n?.surfaceId)throw new Error(`Provider ${e.providerId||"(unknown)"} does not advertise surface ${t||"(first available)"}.`);return n}class Uc{host;transport;options;active=!1;lastSurfaceVersion="";pollHandle;provider;selected;pluginAdapters=[];draftStore=new oa;constructor(t,r,n={}){this.host=t,this.transport=r,this.options=n}async start(){try{this.provider=await this.transport.providerAdvertisement(),this.selected=Fc(this.provider,this.options.requestedSurfaceId),zc(this.selected),this.pluginAdapters=Dc(this.selected,this.options.pluginAdapters||Xr)}catch(r){const n=r instanceof Error?r.message:"Eve provider capabilities are unavailable.";throw this.host.replaceChildren(Le(n)),this.options.statusElement&&(this.options.statusElement.textContent=n),r}this.active=!0,await this.refresh();const t=Math.max(0,this.options.pollMs??250);t>0&&(this.pollHandle=window.setInterval(()=>{this.refresh()},t))}stop(){this.active=!1,this.pollHandle!==void 0&&window.clearInterval(this.pollHandle),this.pollHandle=void 0}async refresh(){if(!(!this.active||!this.provider||!this.selected))try{const t=await this.transport.surface(this.selected),r=`${t.providerId||""}:${t.surface?.id||""}:${t.version??""}`;if(r===this.lastSurfaceVersion)return;this.lastSurfaceVersion=r,Bc(t,this.host,{activeSurfaceId:this.selected.surfaceId,assetUrlResolver:this.transport.resolveAssetUrl,body:this.options.body,clientId:this.options.clientId||"eve-browser",commandSink:n=>this.submit(n),documentResolver:this.transport.resolveDocument,provider:this.provider,pluginAdapters:this.pluginAdapters,source:this.options.source,statusElement:this.options.statusElement,draftStore:this.draftStore})}catch(t){this.options.statusElement&&(this.options.statusElement.textContent=t instanceof Error?t.message:"Eve surface unavailable.")}}async submit(t){try{const r=xc(await this.transport.submitCommand(t));await this.consumeCommandResult(t,r)}catch(r){this.presentCommandStatus(r instanceof Error?r.message:"Command failed.","error");return}this.lastSurfaceVersion="",window.setTimeout(()=>{this.refresh()},100)}async consumeCommandResult(t,r){const n=r.receipt.state==="accepted"||r.receipt.state==="reconciled";if(n&&r.draftDirective?.clear&&this.draftStore.clear(t.providerId,t.surfaceId,r.draftDirective.bindingNames),r.pluginPayload){const o=this.pluginAdapters.find(i=>i.pluginId===r.pluginPayload?.pluginId);if(!o?.consumeCommandResult)throw new Error(`No Eve plugin adapter can consume ${r.pluginPayload.pluginId}.`);await o.consumeCommandResult(r.pluginPayload,r,{provider:this.provider,surface:this.selected})}this.presentCommandStatus(r.receipt.message||r.receipt.state,n?"status":"error",r.transientProjection)}presentCommandStatus(t,r,n){let o=this.host.querySelector(":scope > .eve-command-result-region");o||(o=T("section","eve-command-result-region"),o.setAttribute("aria-live","polite"),this.host.append(o)),o.setAttribute("role",r),o.replaceChildren(T("p","eve-command-result-message",t));const i=n;i?.surface?.root&&o.append(de(i.surface.root,{activeSurfaceId:i.surface.id||this.selected?.surfaceId,clientId:this.options.clientId,draftStore:this.draftStore,pluginAdapters:this.pluginAdapters,provider:this.provider}))}}function zc(e){if(!e.worldInteraction?.commandBoundary||!e.worldInteraction.receiptSchema)throw new Error(`Eve surface ${e.surfaceId||"(unknown)"} does not advertise a command boundary and receipt schema.`)}const Vc={"--bg":"#020909","--bg-top":"#020909","--bg-mid":"#020909","--bg-bottom":"#020909","--shell-top":"#010707","--shell-bottom":"#010707","--panel":"#071918","--panel-2":"#0a2423","--line":"rgba(103, 240, 228, 0.28)","--line-deep":"rgba(103, 240, 228, 0.18)","--text":"#e7f1f1","--text-bright":"#e7f1f1","--quiet":"#8ba5a3","--accent":"#ffb84f","--accent-strong":"#ffb84f","--corner-accent":"#ffb84f","--cyan":"#8efcff","--shadow":"rgba(0, 0, 0, 0.35)","--pixel-grid":"rgba(142, 252, 255, 0.04)","--border-width":"1px","--border-bottom-width":"1px","--corner-accent-size":"0","--font-body":'"M PLUS 1", "Ubuntu Sans", Ubuntu, "Noto Sans JP", system-ui, sans-serif',"--font-title":'"Montserrat", "Zen Kaku Gothic New", "M PLUS 1", "Ubuntu Sans", system-ui, sans-serif',"--font-mono":'"Ubuntu Sans Mono", "M PLUS 1 Code", "Cascadia Mono", Consolas, monospace'},Ti=new Map,Oi=new WeakMap,Mi=new WeakMap,sa=Symbol("eve.browser.render-context");function Kc(e,t){return{...t,[sa]:{surface:e,styles:ya(e.surface?.styles),elements:new WeakMap}}}function Ke(e){return e[sa]}function Bc(e,t,r={}){Oi.get(t)?.dispose();let n=r.draftStore||Mi.get(t);n||(n=new oa,Mi.set(t,n));const o=Kc(e,{...r,draftStore:n});if(mu(e.surface?.styles,r.body??t),t.dataset.provider=e.providerId||r.provider?.providerId||"",r.body&&(r.body.dataset.provider=e.providerId||r.provider?.providerId||""),r.statusElement&&(r.statusElement.textContent=`${e.title||e.surface?.title||"surface"}${r.source?` (${r.source})`:""}`),e.surface?.root){const i=t.querySelector(":scope > .eve-command-result-region");if(t.replaceChildren(de(e.surface.root,o)),i&&t.append(i),r.stateBindingResolver){const s=new Hc(e,t,o);Oi.set(t,s),s.start()}}else t.replaceChildren(Le("No surface root"));return t}function qi(e,t,r){const n=t.targetProp.split(".").filter(Boolean);if(n.length===0)throw new Error("Eve state binding targetProp must not be empty.");e.props||={};let o=e.props;for(const i of n.slice(0,-1)){const s=o[i];(!s||typeof s!="object"||Array.isArray(s))&&(o[i]={}),o=o[i]}o[n[n.length-1]]=r}class Hc{surface;host;options;disposed=!1;unsubscribers=[];pendingComponents=new Set;projectionQueued=!1;constructor(t,r,n){this.surface=t,this.host=r,this.options=n}async start(){const t=this.options.stateBindingResolver,r=this.surface.surface?.root;if(!t||!r)return;const n=new Set;for(const o of ca(r))for(const i of o.stateBindings||[]){if(this.disposed)return;const s=await t(i,o);if(!s||this.disposed)continue;const c=l=>{this.disposed||(qi(o,i,l),this.queueComponentProjection(o))};if(qi(o,i,await s.latest()),n.add(o),this.disposed)return;this.unsubscribers.push(s.watch(c))}for(const o of n){if(this.disposed)return;this.renderComponentProjection(o)}}dispose(){this.disposed=!0,this.pendingComponents.clear();for(const t of this.unsubscribers.splice(0))t()}queueComponentProjection(t){this.pendingComponents.add(t),!this.projectionQueued&&(this.projectionQueued=!0,queueMicrotask(()=>{if(this.projectionQueued=!1,!this.disposed){for(const r of this.pendingComponents)this.renderComponentProjection(r);this.pendingComponents.clear()}}))}renderComponentProjection(t){const r=Ke(this.options)?.elements.get(t);r?.isConnected&&Gc(r,de(t,this.options),this.host)}}function Gc(e,t,r){const n=e.ownerDocument.activeElement,o=n instanceof HTMLElement&&e.contains(n)?n:void 0,i=o?Wc(e,o):void 0,s=o instanceof HTMLInputElement||o instanceof HTMLTextAreaElement?{start:o.selectionStart,end:o.selectionEnd,direction:o.selectionDirection}:void 0,c={left:r.scrollLeft,top:r.scrollTop};if(e.replaceWith(t),r.scrollLeft=c.left,r.scrollTop=c.top,!i)return;const l=Xc(t,i);l?.focus({preventScroll:!0}),s&&(l instanceof HTMLInputElement||l instanceof HTMLTextAreaElement)&&l.setSelectionRange(s.start,s.end,s.direction??void 0)}function Wc(e,t){if(e===t)return[];const r=[];let n=t;for(;n&&n!==e;){const o=n.parentElement;if(!o)return;r.unshift(Array.prototype.indexOf.call(o.children,n)),n=o}return n===e?r:void 0}function Xc(e,t){let r=e;for(const n of t){const o=r.children.item(n);if(!(o instanceof HTMLElement))return;r=o}return r instanceof HTMLElement?r:void 0}function*ca(e){yield e;for(const t of e.children||[])yield*ca(t)}function de(e,t={}){const r=Yc(e,t);return Ke(t)?.elements.set(e,r),r}function Yc(e,t){const r=e.kind||"panel",n=Q(e.props),o=Q(e.layout),i=Q(e.style),s=e.children||[],c=e.embeddedDocuments||[];if(r==="surface"||r==="cockpit"||r==="dashboard"){const a=T("section","cultui-surface-root eve-surface");te(a,e),typeof o.direction=="string"?a.dataset.direction=o.direction:typeof n.layout=="object"&&n.layout&&typeof n.layout.direction=="string"&&(a.dataset.direction=String(n.layout.direction)),r!=="surface"&&(a.dataset.surfaceKind=r),re(a,o,i);for(const f of s)a.append(de(f,t));return a}if(r==="column"||r==="row"||r==="form"||r==="rail"){const a=T("div",`cultui-partition eve-${r}`);te(a,e),a.dataset.direction=r==="row"||r==="rail"?"horizontal":"vertical",r==="rail"&&(a.dataset.overflow="x"),at(a,{...o,...n}),re(a,o,i);for(const f of s)a.append(de(f,t));return a}if(r==="grid"){const a=T("section","cultui-grid"),f=_e(n.columns,0);f>0?a.style.gridTemplateColumns=`repeat(${f}, minmax(0, 1fr))`:typeof n.columns=="string"&&(a.style.gridTemplateColumns=n.columns);const m=_e(n.rows,0);m>0&&(a.style.gridTemplateRows=`repeat(${m}, minmax(0, auto))`),re(a,o,i);for(const y of s)a.append(de(y,t));return a}if(r==="partition"){const a=T("section",`cultui-partition split-${K(n.split,"none")}`);te(a,e),at(a,n),re(a,o,i),a.style.minWidth="0",K(n.split,"none")==="x"&&!q(n.flexWrap,o.flexWrap,"")&&(a.style.flexWrap="wrap"),typeof n.role=="string"&&(a.dataset.role=n.role);for(const f of s)a.append(de(f,t));return a}if(r==="input.binding-map")return uu(e,n,t);if(r==="inventory.drag_session")return nu(e,n,o,i);if(r==="inventory.grid")return iu(e,n,o,i,t);if(r==="inventory.item")return au(e,n,o,i);const l=(t.pluginAdapters||Xr).find(a=>a.componentKinds.includes(r));if(l?.renderComponent)return l.renderComponent(e,n,o,i,t,{applyGeneratedLayout:re,providerId:Ke(t)?.surface.providerId||t.provider?.providerId,resolveAssetUrl:a=>it(a,t)});if(r==="world.scene3d"||r==="world.scene2d")return Qc(e,n,o,i,t);if(r==="image.background"){const a=T("div","cultui-background"),f=it(q(n.src,n.assetUri,n.assetRef,""),t);return f&&(a.style.backgroundImage=`url("${f}")`),a.setAttribute("aria-label",K(n.label,"background")),a}if(r==="image.sprite"){const a=T("figure",`cultui-sprite ${K(n.slot,"center")}`);te(a,e);const f=it(q(n.src,n.assetUri,n.assetRef,""),t);if(f){const m=T("img");m.src=f,m.alt=K(n.alt,K(n.actor,K(n.label,""))),a.append(m)}return a}if(r==="avatar"){const a=T("figure","cultui-avatar-card");te(a,e);const f=it(q(n.src,n.assetUri,n.assetRef,""),t);if(f){const S=T("img");S.src=f,S.alt=K(n.alt,K(n.text,K(n.label,""))),a.append(S)}else a.append(T("div","cultui-avatar-fallback",ju(q(n.text,n.label,n.actor,"?"))));const m=q(n.text,n.label,n.actor,"");m&&a.append(T("figcaption","cultui-avatar-name",m));const y=q(n.status,"");y&&a.append(T("div","cultui-avatar-status",y));const $=q(n.detail,"");return $&&a.append(T("div","cultui-avatar-detail",$)),a}if(r==="pane"||r==="panel"){const a=T("section","pane cultui-pane");te(a,e);const f=K(n.span,"");f&&(a.dataset.span=f);const m=K(n.density,"");m&&(a.dataset.density=m);const y=K(n.title,e.text||"");y&&a.append(T("h2","",y));for(const $ of s)a.append(de($,t));return a}if(r==="list"||r.endsWith(".roster")){const a=T("section","cultui-list");te(a,e),a.dataset.componentKind=r;const f=K(n.title,"");f&&a.append(T("h3","cultui-list-title",f));for(const[m,y]of Cu(n.items).entries())a.append(de({id:`${e.id||"list"}-item-${m}`,kind:"list.item",props:{...y}},t));for(const m of s)a.append(de(m,t));return a}if(r==="list.item"||r.endsWith(".item")){const a=ua(e),f=T("article","cultui-list-item");te(f,e),f.dataset.componentKind=r;const m=T("div","cultui-list-item-heading");if(m.append(T("strong","cultui-list-item-label",a.label)),a.status&&m.append(T("span","cultui-list-item-status",a.status)),f.append(m),a.detail&&f.append(T("div","cultui-list-item-detail",a.detail)),a.badges.length){const y=T("div","cultui-list-item-badges");for(const $ of a.badges)y.append(T("span","cultui-list-item-badge",$));f.append(y)}for(const y of s)f.append(de(y,t));return f}if(r==="bar"){const a=T("div","cultui-meter");te(a,e);const f=K(n.label,""),m=K(n.value,"");if(f||m){const S=T("div","cultui-meter-head");S.append(T("span","",f)),S.append(T("strong","",m)),a.append(S)}const y=T("div","cultui-meter-track"),$=T("span","cultui-meter-fill");return $.style.width=`${Vi(n.percent)}%`,y.append($),a.append(y),a}if(r==="card"){const a=Dr(n,e),f=a?T("button","card cultui-card cultui-card-button"):T("article","card cultui-card");te(f,e),re(f,o,i),f instanceof HTMLButtonElement&&(f.type="button");const m=K(n.title,e.text||"");m&&f.append(T("div","card-title",m));for(const y of s)f.append(de(y,t));return a&&zi(f,e,a,n,t),f}if(r==="control.button"){const a=T("button","cultui-button eve-control-button",K(n.label,"Action"));return te(a,e),a.type="button",re(a,o,i),zi(a,e,Dr(n,e),n,t),a}if(r==="control.popup"){const a=T("button","cultui-button eve-control-popup",K(n.label,"Open"));return te(a,e),a.type="button",re(a,o,i),a.addEventListener("click",f=>{lu(e,t,a,f.clientX,f.clientY)}),a}if(r==="text.dialogue"||r==="text"||r==="text.title"||r==="text.subtitle"||r==="label"){const a=T("div",Pu(r,n),K(n.value,K(n.text,e.text||"")));return te(a,e),at(a,n),re(a,o,i),a}if(r==="metric"){const a=T("dl","metric cultui-reactive-metric eve-metric");return te(a,e),re(a,o,i),a.append(T("dt","",K(n.label,"Metric"))),a.append(T("dd","metric-value",K(n.value,""))),a}if(r==="progress"){const a=T("div","cultui-meter eve-progress");te(a,e),re(a,o,i);const f=K(n.label,""),m=K(n.value,""),y=Number(n.min??0),$=Number(n.max??1),S=Number(n.value??0),g=Number.isFinite(S)&&Number.isFinite(y)&&Number.isFinite($)&&$!==y?(S-y)/($-y)*100:Vi(n.percent);if(f||m){const w=T("div","cultui-meter-head");w.append(T("span","",f)),w.append(T("strong","",m)),a.append(w)}const _=T("div","cultui-meter-track"),p=T("span","cultui-meter-fill");return p.style.width=`${Math.max(0,Math.min(100,g))}%`,_.append(p),a.append(_),a}if(r==="modal"){const a=T("section","cultui-modal-surface");te(a,e),re(a,o,i);const f=K(n.title,"");f&&a.append(T("h2","cultui-modal-surface-title",f));for(const m of s)a.append(de(m,t));return a}if(r==="options"){const a=T("section","cultui-options");te(a,e),re(a,o,i);const f=K(n.label,"");f&&a.append(T("h3","cultui-list-title",f));for(const m of s)a.append(de(m,t));return s.length===0&&a.append(Le("waiting for options")),a}if(r==="image.preview"){const a=T("figure","cultui-image-preview");te(a,e);const f=T("div","cultui-image-frame"),m=it(q(n.src,n.assetUri,n.assetRef,""),t);if(m){const y=T("img");y.src=m,y.alt=K(n.label,""),y.style.imageRendering=K(n.imageRendering,"auto"),n.zoom!==void 0&&(y.style.transform=`scale(${n.zoom})`,y.style.transformOrigin=K(n.crop,"50% 50%")),f.append(y)}else f.append(T("span","",K(n.label,"image")));return a.append(f),n.label&&a.append(T("figcaption","",String(n.label))),a}if(r==="canvas.preview"||r==="canvas.editor"){const a=T("div",`cultui-canvas-placeholder ${r==="canvas.editor"?"editor":"preview"}`);return te(a,e),a.append(T("div","viz-label",K(n.label,"Canvas"))),a.append(T("div","cultui-canvas-grid",n.state==="empty"?"waiting for pixels":K(n.state,""))),a}if(r==="surface.slot"){const a=T("section","cultui-embedded-slot");te(a,e),re(a,o,i),a.dataset.slotId=K(n.slotId,K(c[0]?.slotId,"")),a.dataset.documentId=K(n.documentId,K(c[0]?.documentId,"")),a.dataset.schemaId=K(n.schemaId,K(c[0]?.schemaId,"")),a.dataset.presentationKind=K(n.presentationKind,K(c[0]?.presentationKind,""));const f=c.map(y=>Q(y.surface)).find(y=>Q(y.root).kind||y.root),m=n.modal===!0||a.dataset.presentationKind.includes("modal");if((f||a.dataset.documentId)&&m){const y=T("button","cultui-button cultui-modal-trigger",K(n.label,a.dataset.slotId||"Configure"));y.type="button",y.addEventListener("click",()=>pa(Lr(e,t),t)),a.append(y)}else if(f||a.dataset.documentId){const y=T("div","cultui-embedded-slot-body");y.append(T("div","detail","materializing surface")),a.append(y),Lr(e,t).then($=>{y.replaceChildren($?.root?de($.root,t):Le("Embedded surface unavailable"))}).catch($=>{y.replaceChildren(Le(`Embedded surface failed: ${$ instanceof Error?$.message:String($)}`))})}else a.append(T("div","detail",a.dataset.presentationKind||a.dataset.slotId||"embedded surface"));return a}if(r==="control.slider")return wu(n,s,t);if(r==="control.toggle"){const a=T("label","toggle-row cultui-toggle");return te(a,e),a.append(T("span","field-control",n.value?"on":"off")),a.append(T("span","toggle-copy",K(n.label,"Toggle"))),a}if(r==="input.select"||r==="control.select")return $u(e,n,s,o,i,t);if(r==="control.choice-group")return bu(e,n,s,o,i,t);if(r==="input.number"||r==="control.range"||r==="control.input.number"||r==="control.input.text"||r==="control.input.textarea")return vu(e,r,n,o,i,t);if(r==="control.tabs")return _u(e,n,s,o,i,t);if(r==="color.swatch"){const a=T("div","paint-swatch cultui-swatch");return te(a,e),a.style.background=K(n.value,K(n.color,"currentColor")),a.title=K(n.label,"Color"),a}const u=T("section","pane");te(u,e),u.append(T("h2","",r));for(const a of s)u.append(de(a,t));return u}function ua(e){const t=Q(e.props);return{label:q(t.label,t.title,t.displayName,e.text,e.kind,"item"),status:q(t.status,t.state,""),detail:q(t.detail,t.phase,t.repoName,""),badges:Array.isArray(t.badges)?t.badges.map(r=>String(r).trim()).filter(Boolean):q(t.badges,"").split(",").map(r=>r.trim()).filter(Boolean)}}function re(e,t,r={}){const n=q(t.display,"");n&&(e.style.display=n);const o=q(t.direction,"");o&&(e.style.flexDirection=o==="horizontal"?"row":o==="vertical"?"column":o);const i=q(t.flexWrap,"");i&&(e.style.flexWrap=i);const s=q(t.gridTemplateColumns,"");s&&(e.style.gridTemplateColumns=s);const c=q(t.gridTemplateRows,"");c&&(e.style.gridTemplateRows=c);const l=q(t.gridTemplateAreas,"");l&&(e.style.gridTemplateAreas=l);const u=q(t.gridArea,"");u&&(e.style.gridArea=u);const a=q(t.placeItems,"");a&&(e.style.placeItems=a),ve(e,"gap",q(t.gap,"")),ve(e,"padding",q(t.padding,"")),ve(e,"margin",q(t.margin,"")),ve(e,"top",q(t.top,"")),ve(e,"right",q(t.right,"")),ve(e,"bottom",q(t.bottom,"")),ve(e,"left",q(t.left,"")),ve(e,"width",q(t.width,"")),ve(e,"minWidth",q(t.minWidth,"")),ve(e,"maxWidth",q(t.maxWidth,"")),ve(e,"height",q(t.height,"")),ve(e,"minHeight",q(t.minHeight,"")),ve(e,"maxHeight",q(t.maxHeight,""));const f=q(t.alignItems,"");f&&(e.style.alignItems=f);const m=q(t.justifyContent,"");m&&(e.style.justifyContent=m);const y=q(t.alignSelf,"");y&&(e.style.alignSelf=y);const $=q(t.overflow,"");$&&(e.style.overflow=$);const S=q(t.overflowX,"");S&&(e.style.overflowX=S);const g=q(t.overflowY,"");g&&(e.style.overflowY=g);const _=q(t.position,"");_&&(e.style.position=_);const p=q(t.cursor,"");p&&(e.style.cursor=p);const w=q(r.background,"");w&&(e.style.background=sr(w));const E=q(r.color,"");E&&(e.style.color=sr(E)),ve(e,"borderWidth",q(r.borderWidth,""));const d=q(r.borderColor,"");d&&(e.style.borderColor=sr(d));const h=q(r.borderStyle,"");h&&(e.style.borderStyle=h),ve(e,"borderRadius",q(r.borderRadius,""));const v=q(r.boxShadow,"");v&&(e.style.boxShadow=v);const I=q(r.font,"");I&&(e.style.font=I),ve(e,"fontSize",q(r.fontSize,""));const O=q(r.fontWeight,"");O&&(e.style.fontWeight=O);const A=q(r.textTransform,"");A&&(e.style.textTransform=A);const M=q(r.textAlign,"");M&&(e.style.textAlign=M);const L=q(r.whiteSpace,"");L&&(e.style.whiteSpace=L);const N=q(r.overflow,"");N&&(e.style.overflow=N);const z=q(r.textOverflow,"");z&&(e.style.textOverflow=z),ve(e,"lineHeight",q(r.lineHeight,""))}function ve(e,t,r){r&&(e.style[t]=ce(r))}function me(e,t){const r={};for(const[n,o]of Object.entries(e))n.startsWith(t)&&(r[n.slice(t.length)]=o);return r}function Jc(e){const t=(e.children||[]).filter(m=>m.kind==="world.entity3d"),r=t.map(m=>ru(Q(m.props).position,[0,0,0])),n=r.map(m=>m[0]),o=r.map(m=>m[2]),i=Math.min(...n,-1),s=Math.max(...n,1),c=Math.min(...o,-1),l=Math.max(...o,1),u=Math.max(1,s-i),a=Math.max(1,l-c),f=6;return t.map((m,y)=>{const $=Q(m.props);return{entityId:q($.entityId,m.id),faction:K($.faction,"neutral"),kind:K($.entityKind,"entity"),label:q($.label,$.entityId,m.id,"Entity"),controlled:je($.controllable),xPercent:f+(r[y][0]-i)/u*(100-f*2),yPercent:f+(1-(r[y][2]-c)/a)*(100-f*2),source:m}})}function Qc(e,t,r,n,o){const i=T("section","cultui-world-scene");te(i,e),re(i,r,n),i.tabIndex=0,i.setAttribute("aria-label",K(t.label,"Interactive world"));const s=Jc(e),c=s.find(a=>a.controlled),l=T("div","cultui-world-heading");l.append(T("strong","",K(t.label,"World"))),l.append(T("span","",`${s.length} entities`)),i.append(l);const u=T("div","cultui-world-plane");for(const a of s){const f=T("button",`cultui-world-entity faction-${xi(a.faction)} kind-${xi(a.kind)}`);f.type="button",f.style.left=`${a.xPercent}%`,f.style.top=`${a.yPercent}%`,f.dataset.entityId=a.entityId,f.dataset.controlled=a.controlled?"true":"false",f.title=a.label,f.setAttribute("aria-label",`${a.label}, ${a.kind}, ${a.faction}`),f.append(T("span","cultui-world-entity-glyph",tu(a.kind))),f.append(T("span","cultui-world-entity-label",a.label));const m=Q(a.source.props),y=q(m.targetCommand,t.targetCommand,m.focusCommand,t.focusCommand);y&&f.addEventListener("click",()=>jr(y,{actorEntityId:c?.entityId||q(t.playerEntityId),entityId:a.entityId,targetEntityId:a.entityId,targetEntityKey:a.entityId},a.source,o)),u.append(f)}return i.append(u),i.addEventListener("keydown",a=>{const f=eu(a.key);if(f){a.preventDefault();const y=q(t.movementCommand,Q(c?.source.props).moveCommand);y&&jr(y,{actorEntityId:c?.entityId||q(t.playerEntityId),actorEntityKey:c?.entityId||q(t.playerEntityId),directionX:f[0],directionY:f[1],scalar:1},e,o);return}const m=a.key===" "?q(t.actionCommand,Q(c?.source.props).actionCommand):a.key.toLowerCase()==="f"?q(t.focusCommand,Q(c?.source.props).focusCommand):"";m&&(a.preventDefault(),jr(m,{actionId:a.key===" "?"0":"focus",actorEntityId:c?.entityId||q(t.playerEntityId),actorEntityKey:c?.entityId||q(t.playerEntityId)},e,o))}),i}function jr(e,t,r,n){n.commandSink?.(Zc(e,t,n),r)}function Zc(e,t,r={}){return Be(e,{action:t},r)}function eu(e){switch(e.toLowerCase()){case"w":case"arrowup":return[0,1];case"s":case"arrowdown":return[0,-1];case"a":case"arrowleft":return[-1,0];case"d":case"arrowright":return[1,0];default:return}}function tu(e){return e.includes("station")?"S":e.includes("projectile")?".":e.includes("ship")?"^":"+"}function xi(e){return e.toLowerCase().replace(/[^a-z0-9_-]+/g,"-")}function ke(e,t){const r=Number(e);return Number.isFinite(r)?r:t}function ru(e,t){if(Array.isArray(e)){const r=e.map(n=>Number(n));if(r.length>=3&&r.slice(0,3).every(Number.isFinite))return[r[0],r[1],r[2]]}if(typeof e=="string"){const r=e.split(/[,\s]+/).map(n=>Number(n)).filter(Number.isFinite);if(r.length>=3)return[r[0],r[1],r[2]]}return t}function nu(e,t,r,n){const o=je(t.active),i=T("section","cultui-inventory-drag");te(i,e),re(i,r,n),i.dataset.active=o?"true":"false";const s=T("div","cultui-inventory-section-label","Drag");if(re(s,me(r,"sectionLabel."),me(n,"sectionLabel.")),i.append(s),!o){const f=T("div","cultui-inventory-empty","None");return re(f,me(r,"empty."),me(n,"empty.")),i.append(f),i}const c=q(t.itemKey,t.item,"item"),l=T("div","cultui-inventory-drag-chip",c);re(l,me(r,"dragChip."),me(n,"dragChip.")),i.append(l);const u=[t.originOffsetX,t.originOffsetY].map(f=>Number(f)).map(f=>Number.isFinite(f)?f:0),a=T("div","cultui-inventory-meta",`origin ${u[0]}, ${u[1]}`);return re(a,me(r,"meta."),me(n,"meta.")),i.append(a),i}function iu(e,t,r,n,o){const i=T("section","cultui-inventory-grid");te(i,e),re(i,r,n);const s=_e(q(t.columns,t.gridColumns,t.widthCells,""),0),c=s>0?s:6,l=_e(t.rows,0),u=l>0?l:Math.max(3,Math.ceil(Math.max((e.children||[]).length,1)/c));i.style.setProperty("--inventory-columns",String(c)),i.style.setProperty("--inventory-rows",String(u)),i.dataset.cellSpriteMode=K(t.cellSpriteMode,"");const a=q(t.title,t.label,"Inventory"),f=T("div","cultui-inventory-section-label",a);re(f,me(r,"sectionLabel."),me(n,"sectionLabel.")),i.append(f);const m=T("div","cultui-inventory-board");m.style.display="grid",m.style.gridTemplateColumns=`repeat(${c}, ${ce(q(t.cellSize,"72"))})`,m.style.gridTemplateRows=`repeat(${u}, ${ce(q(t.cellSize,"72"))})`,m.style.gap=ce(q(t.cellGap,"4")),m.style.overflow=q(t.boardOverflow,"auto"),m.style.padding=ce(q(t.boardPadding,"4")),re(m,me(r,"board."),me(n,"board.")),m.addEventListener("dragover",S=>{if(!ou(t))return;S.preventDefault(),S.dataTransfer&&(S.dataTransfer.dropEffect="move");const g=S.dataTransfer?.getData("application/vnd.gamecult.eve.inventory-item+json")||"";if(g)try{const _=JSON.parse(g),p=m.getBoundingClientRect(),w=Math.max(1,ke(t.cellSize,72)),E=Math.max(0,ke(t.cellGap,4)),d=w+E,h=Math.max(0,Math.floor((S.clientX-p.left)/d)),v=Math.max(0,Math.floor((S.clientY-p.top)/d));cu(m,_,t,e.children||[],h,v,w)}catch{or(m)}}),m.addEventListener("dragleave",S=>{S.relatedTarget instanceof Node&&m.contains(S.relatedTarget)||or(m)}),m.addEventListener("drop",S=>{or(m);const g=S.dataTransfer?.getData("application/vnd.gamecult.eve.inventory-item+json")||"";if(!g)return;let _;try{_=JSON.parse(g)}catch{return}const p=m.getBoundingClientRect(),w=Math.max(1,ke(t.cellSize,72)),E=Math.max(0,ke(t.cellGap,4)),d=w+E,h=Math.max(0,Math.min(c-1,Math.floor((S.clientX-p.left)/d))),v=Math.max(0,Math.min(u-1,Math.floor((S.clientY-p.top)/d)));if(!la(_,t,e.children||[],h,v).valid)return;const I=su(_,t,h,v,o);I&&(S.preventDefault(),o.commandSink?.(I,e))});const y=new Set;for(const S of e.children||[]){const g=Q(S.props),_=_e(g.x,0),p=_e(g.y,0);y.add(`${_}:${p}`),m.append(de(S,o))}const $=Math.min(c*u,256);for(let S=0;S<$;S+=1){const g=S%c,_=Math.floor(S/c);if(y.has(`${g}:${_}`))continue;const p=T("div","cultui-inventory-cell");p.dataset.x=String(g),p.dataset.y=String(_),p.style.gridColumn=String(g+1),p.style.gridRow=String(_+1),p.style.width=ce(q(t.cellSize,"72")),p.style.height=ce(q(t.cellSize,"72")),re(p,me(r,"cell."),me(n,"cell.")),m.append(p)}return i.append(m),i}function au(e,t,r,n,o){const i=T("button","cultui-inventory-item");te(i,e),i.type="button",re(i,r,n);const s=_e(t.x,0),c=_e(t.y,0);i.dataset.itemKey=q(t.itemKey,t.label,e.id,"item"),i.dataset.source=q(t.source,""),i.draggable=(t.draggable===void 0||je(t.draggable))&&!!q(t.sourceKind,t.source,""),i.addEventListener("dragstart",$=>{!i.draggable||!$.dataTransfer||($.dataTransfer.effectAllowed="move",$.dataTransfer.setData("application/vnd.gamecult.eve.inventory-item+json",JSON.stringify({...t,id:e.id})))});let l=_e(t.shapeWidth,1),u=_e(t.shapeHeight,1);const a=q(t.rotation,"").toLowerCase();["clockwise","counterclockwise","right","left","rotate90","rotate270"].includes(a)&&([l,u]=[u,l]),i.style.gridColumn=`${s+1} / span ${l}`,i.style.gridRow=`${c+1} / span ${u}`;const f=T("span","cultui-inventory-item-icon");re(f,me(r,"icon."),me(n,"icon.")),f.textContent=Nu(q(t.iconAssetUri,t.iconAssetKey,t.itemKey,t.label,"")),i.append(f);const m=q(t.label,t.itemKey,"");if(m){const $=T("span","cultui-inventory-item-label",m);re($,me(r,"label."),me(n,"label.")),i.append($)}const y=Number(t.quantity);if(Number.isFinite(y)&&y>1){const $=T("span","cultui-inventory-item-quantity",String(y));re($,me(r,"quantity."),me(n,"quantity.")),i.append($)}return i.title=[m,q(t.source,""),q(t.quality,"")?`quality ${t.quality}`:"",q(t.durability,"")?`durability ${t.durability}`:""].filter(Boolean).join(" | "),i}function ou(e){return Object.entries(e).some(([t,r])=>(t==="dropCommand"||t.startsWith("dropCommand."))&&typeof r=="string"&&r.length>0)}function su(e,t,r,n,o={}){const i=q(e.sourceKind,e.source,""),s=q(t[`dropCommand.${i}`],t.dropCommand,"");if(!i||!s)return;const c=ke(e.sourceIndex,-1),l=ke(t.targetIndex,-1),u=q(t.targetKind,""),a={};return Di(e,a),Di(t,a),Object.assign(a,{sourceKind:i,originEntityKey:q(e.sourceEntityKey,e.entityKey,""),originIndex:c,originCargoIndex:i==="cargo"?c:-1,itemKey:q(e.itemKey,""),quantity:Math.max(1,ke(e.quantity,1)),sourceX:ke(e.x,-2147483648),sourceY:ke(e.y,-2147483648),sourceRotation:q(e.rotation,"None"),destinationKind:u,destinationEntityKey:q(t.targetEntityKey,t.entityKey,""),destinationIndex:l,destinationCargoIndex:u==="cargo"?l:-1,destinationX:Math.trunc(r),destinationY:Math.trunc(n),destinationRotation:q(t.dropRotation,e.rotation,"None"),hasDestinationPosition:!0}),Be(s,{action:a},o)}function la(e,t,r,n,o){const i=Math.max(1,_e(t.columns,1)),s=Math.max(1,_e(t.rows,1)),c=Li(e).map(m=>({x:Math.trunc(n)+m.x,y:Math.trunc(o)+m.y})),l=new Set(da(t.validCells).map(m=>`${m.x}:${m.y}`)),u=q(e.id,""),a=new Set;for(const m of r||[]){if(m.kind!=="inventory.item"||u&&m.id===u)continue;const y=Q(m.props),$=Math.trunc(ke(y.x,0)),S=Math.trunc(ke(y.y,0));for(const g of Li(y))a.add(`${$+g.x}:${S+g.y}`)}let f="valid";return c.some(m=>m.x<0||m.y<0||m.x>=i||m.y>=s)?f="outside-grid":l.size>0&&c.some(m=>!l.has(`${m.x}:${m.y}`))?f="outside-valid-shape":c.some(m=>a.has(`${m.x}:${m.y}`))&&(f="occupied"),{valid:f==="valid",reason:f,cells:c}}function Li(e){const t=da(e.shapeCells);if(t.length>0)return t;let r=Math.max(1,_e(e.shapeWidth,1)),n=Math.max(1,_e(e.shapeHeight,1));const o=q(e.rotation,"").toLowerCase();return["clockwise","counterclockwise","right","left","rotate90","rotate270","clockwise90","clockwise270"].includes(o)&&([r,n]=[n,r]),Array.from({length:r*n},(i,s)=>({x:s%r,y:Math.floor(s/r)}))}function da(e){return typeof e!="string"?[]:e.split(";").flatMap(t=>{const[r,n]=t.split(",").map(Number);return Number.isInteger(r)&&Number.isInteger(n)?[{x:r,y:n}]:[]})}function Di(e,t){for(const[r,n]of Object.entries(e))r.startsWith("payload.")&&r.length>8&&(t[r.slice(8)]=n)}function or(e){e.querySelectorAll(".cultui-inventory-placement-preview").forEach(t=>t.remove())}function cu(e,t,r,n,o,i,s){or(e);const c=la(t,r,n,o,i);for(const l of c.cells){const u=T("div",`cultui-inventory-placement-preview ${c.valid?"is-valid":"is-invalid"}`);u.style.gridColumn=String(l.x+1),u.style.gridRow=String(l.y+1),u.style.width=ce(String(s)),u.style.height=ce(String(s)),u.style.pointerEvents="none",e.append(u)}}function uu(e,t,r){const n=T("section","cultui-binding-map");te(n,e);const o=document.createElementNS("http://www.w3.org/2000/svg","svg");o.setAttribute("class","cultui-xbox-controller"),o.setAttribute("viewBox","0 0 780 420"),o.setAttribute("role","img"),o.setAttribute("aria-label",K(t.label,"Xbox controller remapping")),o.innerHTML=fu(),n.append(o);const i=T("div","cultui-binding-overlay");for(const s of e.children||[]){const c=Q(s.props),l=K(c.target,s.id||""),u=T("button","cultui-binding-box");te(u,s),u.type="button",u.dataset.target=l,u.dataset.kind=K(c.bindingKind,"button"),u.style.left=ce(c.x??"50%"),u.style.top=ce(c.y??"50%"),u.append(T("span","cultui-binding-target",K(c.label,l))),u.append(T("span","cultui-binding-source",K(c.current,"unmapped"))),u.addEventListener("click",()=>{const f=ma(s);if(fa(s)||f?.documentId)pa(Lr(s,r),r);else{const m=K(c.commandId,"");m&&r.commandSink?.(Be(m,c,r),s)}}),i.append(u);const a=document.createElementNS("http://www.w3.org/2000/svg","line");a.setAttribute("class","cultui-binding-line"),a.setAttribute("x1",K(c.anchorX,"390")),a.setAttribute("y1",K(c.anchorY,"210")),a.setAttribute("x2",String(Ui(c.x,780))),a.setAttribute("y2",String(Ui(c.y,420))),o.append(a)}return n.append(i),n}function fa(e){for(const t of e.embeddedDocuments||[]){const r=Q(t.surface);if(r.root)return r}}function ma(e){const t=(e.embeddedDocuments||[])[0],r=Q(e.props),n=q(r.documentId,t?.documentId,"");if(n)return{documentId:n,presentationKind:q(r.presentationKind,t?.presentationKind,""),schemaId:q(r.schemaId,t?.schemaId,""),slotId:q(r.slotId,t?.slotId,"")}}async function Lr(e,t){const r=fa(e);if(r)return r;const n=ma(e);if(!n?.documentId||!t.documentResolver)return;const o=await t.documentResolver(n,e);if(o)return Q(o.surface).root?o.surface:o}function pa(e,t){const r=T("div","cultui-modal-backdrop"),n=T("section","cultui-modal");n.setAttribute("role","dialog"),n.setAttribute("aria-modal","true");const o=T("header","cultui-modal-header");o.append(T("h2","","Configure Binding"));const i=T("button","cultui-modal-close","Close");i.type="button",i.addEventListener("click",()=>r.remove()),o.append(i);const s=T("div","cultui-modal-body");n.append(o,s),r.append(n),r.addEventListener("click",c=>{c.target===r&&r.remove()}),document.body.append(r),s.append(T("div","detail","materializing document")),Promise.resolve(e).then(c=>{o.querySelector("h2").textContent=c?.title||"Configure Binding",s.replaceChildren(c?.root?de(c.root,t):Le("Embedded document unavailable"))}).catch(c=>{s.replaceChildren(Le(`Embedded document failed: ${c instanceof Error?c.message:String(c)}`))})}function lu(e,t,r,n,o){const i=Q(e.props),s=(e.children||[])[0],c=Q(s?.props),l=q(c.anchor,i.anchor,"trigger"),u=q(c.placement,i.placement,"below-start"),a=Number(q(c.offsetX,i.offsetX,"0"))||0,f=Number(q(c.offsetY,i.offsetY,"4"))||0,m=T("div","cultui-modal-backdrop");m.style.background="transparent",m.style.placeItems="start";const y=T("section","cultui-modal");y.setAttribute("role","dialog"),y.setAttribute("aria-modal","true"),y.style.position="fixed",y.style.width="min(420px, calc(100vw - 24px))",y.style.maxHeight="min(620px, calc(100vh - 24px))";const $=T("header","cultui-modal-header");$.append(T("h2","",q(c.title,i.title,i.label,"Options")));const S=T("button","cultui-modal-close","Close");S.type="button",S.addEventListener("click",()=>m.remove()),$.append(S);const g=T("div","cultui-modal-body");if(s){const p=s.children||[];p.length>0?g.replaceChildren(...p.map(w=>de(w,t))):g.append(de(s,t))}else g.append(Le("Popup has no content"));y.append($,g),m.append(y),m.addEventListener("click",p=>{p.target===m&&m.remove()}),document.body.append(m);const _=du(l,u,r,y,n,o,a,f);y.style.left=`${_.left}px`,y.style.top=`${_.top}px`}function du(e,t,r,n,o,i,s,c){const l=r.getBoundingClientRect(),u=n.getBoundingClientRect(),a=u.width||420,f=u.height||320,m=e==="cursor"?{left:o,right:o,top:i,bottom:i}:l;if(t==="right-down"||t==="dropdown")return nr(m,a,f,s,c,"right","down");if(t==="left-down")return nr(m,a,f,s,c,"left","down");if(t==="right-up")return nr(m,a,f,s,c,"right","up");if(t==="left-up")return nr(m,a,f,s,c,"left","up");switch(t){case"above-start":return xe(m.left+s,m.top-f-c,a,f);case"above-end":return xe(m.right-a+s,m.top-f-c,a,f);case"below-end":return xe(m.right-a+s,m.bottom+c,a,f);case"right-start":return xe(m.right+s,m.top+c,a,f);case"left-start":return xe(m.left-a-s,m.top+c,a,f);case"center":return xe((window.innerWidth-a)/2+s,(window.innerHeight-f)/2+c,a,f);default:return xe(m.left+s,m.bottom+c,a,f)}}function nr(e,t,r,n,o,i,s){const l=window.innerWidth-e.right-n-12,u=e.left-n-12,a=window.innerHeight-e.top-o-12,f=e.bottom-o-12,m=i==="right"?l>=t||l>=u:!(u>=t||u>=l),y=s==="down"?a>=r||a>=f:!(f>=r||f>=a),$=m?e.right+n:e.left-t-n,S=y?e.top+o:e.bottom-r-o;return xe($,S,t,r)}function xe(e,t,r,n){return{left:Fi(e,12,window.innerWidth-r-12),top:Fi(t,12,window.innerHeight-n-12)}}function Fi(e,t,r){return r{for(const _ of S)(0,n.checkReportMissingProp)(l,_)}):(a.if((0,t._)`${g} && (${(0,n.checkMissingProp)(l,S,y)})`),(0,n.reportMissingProp)(l,y),a.else())}}e.validatePropertyDeps=s;function c(l,u=l.schema){const{gen:a,data:f,keyword:m,it:y}=l,$=a.name("valid");for(const S in u)(0,r.alwaysValidSchema)(y,u[S])||(a.if((0,n.propertyInData)(a,f,S,y.opts.ownProperties),()=>{const g=l.subschema({keyword:m,schemaProp:S},$);l.mergeValidEvaluated(g,$)},()=>a.var($,!0)),l.ok($))}e.validateSchemaDeps=c,e.default=o})(jr)),jr}var Tt={},ni;function Vo(){if(ni)return Tt;ni=1,Object.defineProperty(Tt,"__esModule",{value:!0});const e=W(),t=Z(),n={keyword:"propertyNames",type:"object",schemaType:["object","boolean"],error:{message:"property name must be valid",params:({params:o})=>(0,e._)`{propertyName: ${o.propertyName}}`},code(o){const{gen:i,schema:s,data:c,it:l}=o;if((0,t.alwaysValidSchema)(l,s))return;const u=i.name("valid");i.forIn("key",c,a=>{o.setParams({propertyName:a}),o.subschema({keyword:"propertyNames",data:a,dataTypes:["string"],propertyName:a,compositeRule:!0},u),i.if((0,e.not)(u),()=>{o.error(!0),l.allErrors||i.break()})}),o.ok(u)}};return Tt.default=n,Tt}var Ot={},ii;function ra(){if(ii)return Ot;ii=1,Object.defineProperty(Ot,"__esModule",{value:!0});const e=Ne(),t=W(),r=Ce(),n=Z(),i={keyword:"additionalProperties",type:["object"],schemaType:["boolean","object"],allowUndefined:!0,trackErrors:!0,error:{message:"must NOT have additional properties",params:({params:s})=>(0,t._)`{additionalProperty: ${s.additionalProperty}}`},code(s){const{gen:c,schema:l,parentSchema:u,data:a,errsCount:f,it:m}=s;if(!f)throw new Error("ajv implementation error");const{allErrors:y,opts:$}=m;if(m.props=!0,$.removeAdditional!=="all"&&(0,n.alwaysValidSchema)(m,l))return;const S=(0,e.allSchemaProperties)(u.properties),g=(0,e.allSchemaProperties)(u.patternProperties);_(),s.ok((0,t._)`${f} === ${r.default.errors}`);function _(){c.forIn("key",a,h=>{!S.length&&!g.length?E(h):c.if(p(h),()=>E(h))})}function p(h){let v;if(S.length>8){const I=(0,n.schemaRefOrVal)(m,u.properties,"properties");v=(0,e.isOwnProperty)(c,I,h)}else S.length?v=(0,t.or)(...S.map(I=>(0,t._)`${h} === ${I}`)):v=t.nil;return g.length&&(v=(0,t.or)(v,...g.map(I=>(0,t._)`${(0,e.usePattern)(s,I)}.test(${h})`))),(0,t.not)(v)}function w(h){c.code((0,t._)`delete ${a}[${h}]`)}function E(h){if($.removeAdditional==="all"||$.removeAdditional&&l===!1){w(h);return}if(l===!1){s.setParams({additionalProperty:h}),s.error(),y||c.break();return}if(typeof l=="object"&&!(0,n.alwaysValidSchema)(m,l)){const v=c.name("valid");$.removeAdditional==="failing"?(d(h,v,!1),c.if((0,t.not)(v),()=>{s.reset(),w(h)})):(d(h,v),y||c.if((0,t.not)(v),()=>c.break()))}}function d(h,v,I){const O={keyword:"additionalProperties",dataProp:h,dataPropType:n.Type.Str};I===!1&&Object.assign(O,{compositeRule:!0,createErrors:!1,allErrors:!1}),s.subschema(O,v)}}};return Ot.default=i,Ot}var Mt={},ai;function Ko(){if(ai)return Mt;ai=1,Object.defineProperty(Mt,"__esModule",{value:!0});const e=hr(),t=Ne(),r=Z(),n=ra(),o={keyword:"properties",type:"object",schemaType:"object",code(i){const{gen:s,schema:c,parentSchema:l,data:u,it:a}=i;a.opts.removeAdditional==="all"&&l.additionalProperties===void 0&&n.default.code(new e.KeywordCxt(a,n.default,"additionalProperties"));const f=(0,t.allSchemaProperties)(c);for(const g of f)a.definedProperties.add(g);a.opts.unevaluated&&f.length&&a.props!==!0&&(a.props=r.mergeEvaluated.props(s,(0,r.toHash)(f),a.props));const m=f.filter(g=>!(0,r.alwaysValidSchema)(a,c[g]));if(m.length===0)return;const y=s.name("valid");for(const g of m)$(g)?S(g):(s.if((0,t.propertyInData)(s,u,g,a.opts.ownProperties)),S(g),a.allErrors||s.else().var(y,!0),s.endIf()),i.it.definedProperties.add(g),i.ok(y);function $(g){return a.opts.useDefaults&&!a.compositeRule&&c[g].default!==void 0}function S(g){i.subschema({keyword:"properties",schemaProp:g,dataProp:g},y)}}};return Mt.default=o,Mt}var qt={},oi;function Bo(){if(oi)return qt;oi=1,Object.defineProperty(qt,"__esModule",{value:!0});const e=Ne(),t=W(),r=Z(),n=Z(),o={keyword:"patternProperties",type:"object",schemaType:"object",code(i){const{gen:s,schema:c,data:l,parentSchema:u,it:a}=i,{opts:f}=a,m=(0,e.allSchemaProperties)(c),y=m.filter(E=>(0,r.alwaysValidSchema)(a,c[E]));if(m.length===0||y.length===m.length&&(!a.opts.unevaluated||a.props===!0))return;const $=f.strictSchema&&!f.allowMatchingProperties&&u.properties,S=s.name("valid");a.props!==!0&&!(a.props instanceof t.Name)&&(a.props=(0,n.evaluatedPropsToName)(s,a.props));const{props:g}=a;_();function _(){for(const E of m)$&&p(E),a.allErrors?w(E):(s.var(S,!0),w(E),s.if(S))}function p(E){for(const d in $)new RegExp(E).test(d)&&(0,r.checkStrictMode)(a,`property ${d} matches pattern ${E} (use allowMatchingProperties)`)}function w(E){s.forIn("key",l,d=>{s.if((0,t._)`${(0,e.usePattern)(i,E)}.test(${d})`,()=>{const h=y.includes(E);h||i.subschema({keyword:"patternProperties",schemaProp:E,dataProp:d,dataPropType:n.Type.Str},S),a.opts.unevaluated&&g!==!0?s.assign((0,t._)`${g}[${d}]`,!0):!h&&!a.allErrors&&s.if((0,t.not)(S),()=>s.break())})})}}};return qt.default=o,qt}var xt={},si;function Ho(){if(si)return xt;si=1,Object.defineProperty(xt,"__esModule",{value:!0});const e=Z(),t={keyword:"not",schemaType:["object","boolean"],trackErrors:!0,code(r){const{gen:n,schema:o,it:i}=r;if((0,e.alwaysValidSchema)(i,o)){r.fail();return}const s=n.name("valid");r.subschema({keyword:"not",compositeRule:!0,createErrors:!1,allErrors:!1},s),r.failResult(s,()=>r.reset(),()=>r.error())},error:{message:"must NOT be valid"}};return xt.default=t,xt}var Lt={},ci;function Go(){if(ci)return Lt;ci=1,Object.defineProperty(Lt,"__esModule",{value:!0});const t={keyword:"anyOf",schemaType:"array",trackErrors:!0,code:Ne().validateUnion,error:{message:"must match a schema in anyOf"}};return Lt.default=t,Lt}var Dt={},ui;function Wo(){if(ui)return Dt;ui=1,Object.defineProperty(Dt,"__esModule",{value:!0});const e=W(),t=Z(),n={keyword:"oneOf",schemaType:"array",trackErrors:!0,error:{message:"must match exactly one schema in oneOf",params:({params:o})=>(0,e._)`{passingSchemas: ${o.passing}}`},code(o){const{gen:i,schema:s,parentSchema:c,it:l}=o;if(!Array.isArray(s))throw new Error("ajv implementation error");if(l.opts.discriminator&&c.discriminator)return;const u=s,a=i.let("valid",!1),f=i.let("passing",null),m=i.name("_valid");o.setParams({passing:f}),i.block(y),o.result(a,()=>o.reset(),()=>o.error(!0));function y(){u.forEach(($,S)=>{let g;(0,t.alwaysValidSchema)(l,$)?i.var(m,!0):g=o.subschema({keyword:"oneOf",schemaProp:S,compositeRule:!0},m),S>0&&i.if((0,e._)`${m} && ${a}`).assign(a,!1).assign(f,(0,e._)`[${f}, ${S}]`).else(),i.if(m,()=>{i.assign(a,!0),i.assign(f,S),g&&o.mergeEvaluated(g,e.Name)})})}}};return Dt.default=n,Dt}var Ft={},li;function Xo(){if(li)return Ft;li=1,Object.defineProperty(Ft,"__esModule",{value:!0});const e=Z(),t={keyword:"allOf",schemaType:"array",code(r){const{gen:n,schema:o,it:i}=r;if(!Array.isArray(o))throw new Error("ajv implementation error");const s=n.name("valid");o.forEach((c,l)=>{if((0,e.alwaysValidSchema)(i,c))return;const u=r.subschema({keyword:"allOf",schemaProp:l},s);r.ok(s),r.mergeEvaluated(u)})}};return Ft.default=t,Ft}var Ut={},di;function Yo(){if(di)return Ut;di=1,Object.defineProperty(Ut,"__esModule",{value:!0});const e=W(),t=Z(),n={keyword:"if",schemaType:["object","boolean"],trackErrors:!0,error:{message:({params:i})=>(0,e.str)`must match "${i.ifClause}" schema`,params:({params:i})=>(0,e._)`{failingKeyword: ${i.ifClause}}`},code(i){const{gen:s,parentSchema:c,it:l}=i;c.then===void 0&&c.else===void 0&&(0,t.checkStrictMode)(l,'"if" without "then" and "else" is ignored');const u=o(l,"then"),a=o(l,"else");if(!u&&!a)return;const f=s.let("valid",!0),m=s.name("_valid");if(y(),i.reset(),u&&a){const S=s.let("ifClause");i.setParams({ifClause:S}),s.if(m,$("then",S),$("else",S))}else u?s.if(m,$("then")):s.if((0,e.not)(m),$("else"));i.pass(f,()=>i.error(!0));function y(){const S=i.subschema({keyword:"if",compositeRule:!0,createErrors:!1,allErrors:!1},m);i.mergeEvaluated(S)}function $(S,g){return()=>{const _=i.subschema({keyword:S},m);s.assign(f,m),i.mergeValidEvaluated(_,f),g?s.assign(g,(0,e._)`${S}`):i.setParams({ifClause:S})}}}};function o(i,s){const c=i.schema[s];return c!==void 0&&!(0,t.alwaysValidSchema)(i,c)}return Ut.default=n,Ut}var zt={},fi;function Jo(){if(fi)return zt;fi=1,Object.defineProperty(zt,"__esModule",{value:!0});const e=Z(),t={keyword:["then","else"],schemaType:["object","boolean"],code({keyword:r,parentSchema:n,it:o}){n.if===void 0&&(0,e.checkStrictMode)(o,`"${r}" without "if" is ignored`)}};return zt.default=t,zt}var mi;function Qo(){if(mi)return kt;mi=1,Object.defineProperty(kt,"__esModule",{value:!0});const e=ea(),t=Fo(),r=ta(),n=Uo(),o=zo(),i=Wr(),s=Vo(),c=ra(),l=Ko(),u=Bo(),a=Ho(),f=Go(),m=Wo(),y=Xo(),$=Yo(),S=Jo();function g(_=!1){const p=[a.default,f.default,m.default,y.default,$.default,S.default,s.default,c.default,i.default,l.default,u.default];return _?p.push(t.default,n.default):p.push(e.default,r.default),p.push(o.default),p}return kt.default=g,kt}var Vt={},Je={},pi;function na(){if(pi)return Je;pi=1,Object.defineProperty(Je,"__esModule",{value:!0}),Je.dynamicAnchor=void 0;const e=W(),t=Ce(),r=gr(),n=Hr(),o={keyword:"$dynamicAnchor",schemaType:"string",code:c=>i(c,c.schema)};function i(c,l){const{gen:u,it:a}=c;a.schemaEnv.root.dynamicAnchors[l]=!0;const f=(0,e._)`${t.default.dynamicAnchors}${(0,e.getProperty)(l)}`,m=a.errSchemaPath==="#"?a.validateName:s(c);u.if((0,e._)`!${f}`,()=>u.assign(f,m))}Je.dynamicAnchor=i;function s(c){const{schemaEnv:l,schema:u,self:a}=c.it,{root:f,baseId:m,localRefs:y,meta:$}=l.root,{schemaId:S}=a.opts,g=new r.SchemaEnv({schema:u,schemaId:S,root:f,baseId:m,localRefs:y,meta:$});return r.compileSchema.call(a,g),(0,n.getValidate)(c,g)}return Je.default=o,Je}var Qe={},hi;function ia(){if(hi)return Qe;hi=1,Object.defineProperty(Qe,"__esModule",{value:!0}),Qe.dynamicRef=void 0;const e=W(),t=Ce(),r=Hr(),n={keyword:"$dynamicRef",schemaType:"string",code:i=>o(i,i.schema)};function o(i,s){const{gen:c,keyword:l,it:u}=i;if(s[0]!=="#")throw new Error(`"${l}" only supports hash fragment reference`);const a=s.slice(1);if(u.allErrors)f();else{const y=c.let("valid",!1);f(y),i.ok(y)}function f(y){if(u.schemaEnv.root.dynamicAnchors[a]){const $=c.let("_v",(0,e._)`${t.default.dynamicAnchors}${(0,e.getProperty)(a)}`);c.if($,m($,y),m(u.validateName,y))}else m(u.validateName,y)()}function m(y,$){return $?()=>c.block(()=>{(0,r.callRef)(i,y),c.let($,!0)}):()=>(0,r.callRef)(i,y)}}return Qe.dynamicRef=o,Qe.default=n,Qe}var Kt={},yi;function Zo(){if(yi)return Kt;yi=1,Object.defineProperty(Kt,"__esModule",{value:!0});const e=na(),t=Z(),r={keyword:"$recursiveAnchor",schemaType:"boolean",code(n){n.schema?(0,e.dynamicAnchor)(n,""):(0,t.checkStrictMode)(n.it,"$recursiveAnchor: false is ignored")}};return Kt.default=r,Kt}var Bt={},gi;function es(){if(gi)return Bt;gi=1,Object.defineProperty(Bt,"__esModule",{value:!0});const e=ia(),t={keyword:"$recursiveRef",schemaType:"string",code:r=>(0,e.dynamicRef)(r,r.schema)};return Bt.default=t,Bt}var vi;function ts(){if(vi)return Vt;vi=1,Object.defineProperty(Vt,"__esModule",{value:!0});const e=na(),t=ia(),r=Zo(),n=es(),o=[e.default,t.default,r.default,n.default];return Vt.default=o,Vt}var Ht={},Gt={},bi;function rs(){if(bi)return Gt;bi=1,Object.defineProperty(Gt,"__esModule",{value:!0});const e=Wr(),t={keyword:"dependentRequired",type:"object",schemaType:"object",error:e.error,code:r=>(0,e.validatePropertyDeps)(r)};return Gt.default=t,Gt}var Wt={},_i;function ns(){if(_i)return Wt;_i=1,Object.defineProperty(Wt,"__esModule",{value:!0});const e=Wr(),t={keyword:"dependentSchemas",type:"object",schemaType:"object",code:r=>(0,e.validateSchemaDeps)(r)};return Wt.default=t,Wt}var Xt={},$i;function is(){if($i)return Xt;$i=1,Object.defineProperty(Xt,"__esModule",{value:!0});const e=Z(),t={keyword:["maxContains","minContains"],type:"array",schemaType:"number",code({keyword:r,parentSchema:n,it:o}){n.contains===void 0&&(0,e.checkStrictMode)(o,`"${r}" without "contains" is ignored`)}};return Xt.default=t,Xt}var wi;function as(){if(wi)return Ht;wi=1,Object.defineProperty(Ht,"__esModule",{value:!0});const e=rs(),t=ns(),r=is(),n=[e.default,t.default,r.default];return Ht.default=n,Ht}var Yt={},Jt={},Si;function os(){if(Si)return Jt;Si=1,Object.defineProperty(Jt,"__esModule",{value:!0});const e=W(),t=Z(),r=Ce(),o={keyword:"unevaluatedProperties",type:"object",schemaType:["boolean","object"],trackErrors:!0,error:{message:"must NOT have unevaluated properties",params:({params:i})=>(0,e._)`{unevaluatedProperty: ${i.unevaluatedProperty}}`},code(i){const{gen:s,schema:c,data:l,errsCount:u,it:a}=i;if(!u)throw new Error("ajv implementation error");const{allErrors:f,props:m}=a;m instanceof e.Name?s.if((0,e._)`${m} !== true`,()=>s.forIn("key",l,g=>s.if($(m,g),()=>y(g)))):m!==!0&&s.forIn("key",l,g=>m===void 0?y(g):s.if(S(m,g),()=>y(g))),a.props=!0,i.ok((0,e._)`${u} === ${r.default.errors}`);function y(g){if(c===!1){i.setParams({unevaluatedProperty:g}),i.error(),f||s.break();return}if(!(0,t.alwaysValidSchema)(a,c)){const _=s.name("valid");i.subschema({keyword:"unevaluatedProperties",dataProp:g,dataPropType:t.Type.Str},_),f||s.if((0,e.not)(_),()=>s.break())}}function $(g,_){return(0,e._)`!${g} || !${g}[${_}]`}function S(g,_){const p=[];for(const w in g)g[w]===!0&&p.push((0,e._)`${_} !== ${w}`);return(0,e.and)(...p)}}};return Jt.default=o,Jt}var Qt={},Ei;function ss(){if(Ei)return Qt;Ei=1,Object.defineProperty(Qt,"__esModule",{value:!0});const e=W(),t=Z(),n={keyword:"unevaluatedItems",type:"array",schemaType:["boolean","object"],error:{message:({params:{len:o}})=>(0,e.str)`must NOT have more than ${o} items`,params:({params:{len:o}})=>(0,e._)`{limit: ${o}}`},code(o){const{gen:i,schema:s,data:c,it:l}=o,u=l.items||0;if(u===!0)return;const a=i.const("len",(0,e._)`${c}.length`);if(s===!1)o.setParams({len:u}),o.fail((0,e._)`${a} > ${u}`);else if(typeof s=="object"&&!(0,t.alwaysValidSchema)(l,s)){const m=i.var("valid",(0,e._)`${a} <= ${u}`);i.if((0,e.not)(m),()=>f(m,u)),o.ok(m)}l.items=!0;function f(m,y){i.forRange("i",y,a,$=>{o.subschema({keyword:"unevaluatedItems",dataProp:$,dataPropType:t.Type.Num},m),l.allErrors||i.if((0,e.not)(m),()=>i.break())})}}};return Qt.default=n,Qt}var Pi;function cs(){if(Pi)return Yt;Pi=1,Object.defineProperty(Yt,"__esModule",{value:!0});const e=os(),t=ss(),r=[e.default,t.default];return Yt.default=r,Yt}var Zt={},er={},Ii;function us(){if(Ii)return er;Ii=1,Object.defineProperty(er,"__esModule",{value:!0});const e=W(),r={keyword:"format",type:["number","string"],schemaType:"string",$data:!0,error:{message:({schemaCode:n})=>(0,e.str)`must match format "${n}"`,params:({schemaCode:n})=>(0,e._)`{format: ${n}}`},code(n,o){const{gen:i,data:s,$data:c,schema:l,schemaCode:u,it:a}=n,{opts:f,errSchemaPath:m,schemaEnv:y,self:$}=a;if(!f.validateFormats)return;c?S():g();function S(){const _=i.scopeValue("formats",{ref:$.formats,code:f.code.formats}),p=i.const("fDef",(0,e._)`${_}[${u}]`),w=i.let("fType"),E=i.let("format");i.if((0,e._)`typeof ${p} == "object" && !(${p} instanceof RegExp)`,()=>i.assign(w,(0,e._)`${p}.type || "string"`).assign(E,(0,e._)`${p}.validate`),()=>i.assign(w,(0,e._)`"string"`).assign(E,p)),n.fail$data((0,e.or)(d(),h()));function d(){return f.strictSchema===!1?e.nil:(0,e._)`${u} && !${E}`}function h(){const v=y.$async?(0,e._)`(${p}.async ? await ${E}(${s}) : ${E}(${s}))`:(0,e._)`${E}(${s})`,I=(0,e._)`(typeof ${E} == "function" ? ${v} : ${E}.test(${s}))`;return(0,e._)`${E} && ${E} !== true && ${w} === ${o} && !${I}`}}function g(){const _=$.formats[l];if(!_){d();return}if(_===!0)return;const[p,w,E]=h(_);p===o&&n.pass(v());function d(){if(f.strictSchema===!1){$.logger.warn(I());return}throw new Error(I());function I(){return`unknown format "${l}" ignored in schema at path "${m}"`}}function h(I){const O=I instanceof RegExp?(0,e.regexpCode)(I):f.code.formats?(0,e._)`${f.code.formats}${(0,e.getProperty)(l)}`:void 0,A=i.scopeValue("formats",{key:l,ref:I,code:O});return typeof I=="object"&&!(I instanceof RegExp)?[I.type||"string",I.validate,(0,e._)`${A}.validate`]:["string",I,A]}function v(){if(typeof _=="object"&&!(_ instanceof RegExp)&&_.async){if(!y.$async)throw new Error("async format in sync schema");return(0,e._)`await ${E}(${s})`}return typeof w=="function"?(0,e._)`${E}(${s})`:(0,e._)`${E}.test(${s})`}}}};return er.default=r,er}var Ri;function ls(){if(Ri)return Zt;Ri=1,Object.defineProperty(Zt,"__esModule",{value:!0});const t=[us().default];return Zt.default=t,Zt}var ze={},Ai;function ds(){return Ai||(Ai=1,Object.defineProperty(ze,"__esModule",{value:!0}),ze.contentVocabulary=ze.metadataVocabulary=void 0,ze.metadataVocabulary=["title","description","default","deprecated","readOnly","writeOnly","examples"],ze.contentVocabulary=["contentMediaType","contentEncoding","contentSchema"]),ze}var ki;function fs(){if(ki)return mt;ki=1,Object.defineProperty(mt,"__esModule",{value:!0});const e=Ro(),t=Do(),r=Qo(),n=ts(),o=as(),i=cs(),s=ls(),c=ds(),l=[n.default,e.default,t.default,(0,r.default)(!0),s.default,c.metadataVocabulary,c.contentVocabulary,o.default,i.default];return mt.default=l,mt}var tr={},nt={},Ci;function ms(){if(Ci)return nt;Ci=1,Object.defineProperty(nt,"__esModule",{value:!0}),nt.DiscrError=void 0;var e;return(function(t){t.Tag="tag",t.Mapping="mapping"})(e||(nt.DiscrError=e={})),nt}var Ni;function ps(){if(Ni)return tr;Ni=1,Object.defineProperty(tr,"__esModule",{value:!0});const e=W(),t=ms(),r=gr(),n=yr(),o=Z(),s={keyword:"discriminator",type:"object",schemaType:"object",error:{message:({params:{discrError:c,tagName:l}})=>c===t.DiscrError.Tag?`tag "${l}" must be string`:`value of tag "${l}" must be in oneOf`,params:({params:{discrError:c,tag:l,tagName:u}})=>(0,e._)`{error: ${c}, tag: ${u}, tagValue: ${l}}`},code(c){const{gen:l,data:u,schema:a,parentSchema:f,it:m}=c,{oneOf:y}=f;if(!m.opts.discriminator)throw new Error("discriminator: requires discriminator option");const $=a.propertyName;if(typeof $!="string")throw new Error("discriminator: requires propertyName");if(a.mapping)throw new Error("discriminator: mapping is not supported");if(!y)throw new Error("discriminator: requires oneOf keyword");const S=l.let("valid",!1),g=l.const("tag",(0,e._)`${u}${(0,e.getProperty)($)}`);l.if((0,e._)`typeof ${g} == "string"`,()=>_(),()=>c.error(!1,{discrError:t.DiscrError.Tag,tag:g,tagName:$})),c.ok(S);function _(){const E=w();l.if(!1);for(const d in E)l.elseIf((0,e._)`${g} === ${d}`),l.assign(S,p(E[d]));l.else(),c.error(!1,{discrError:t.DiscrError.Mapping,tag:g,tagName:$}),l.endIf()}function p(E){const d=l.name("valid"),h=c.subschema({keyword:"oneOf",schemaProp:E},d);return c.mergeEvaluated(h,e.Name),d}function w(){var E;const d={},h=I(f);let v=!0;for(let M=0;Mthis.addMetaSchema(m,void 0,!1)),this;function f(m,y){return a?m.$dataMetaSchema(y,l):y}}return rr.default=u,rr}var Ti;function Nc(){return Ti||(Ti=1,(function(e,t){Object.defineProperty(t,"__esModule",{value:!0}),t.MissingRefError=t.ValidationError=t.CodeGen=t.Name=t.nil=t.stringify=t.str=t._=t.KeywordCxt=t.Ajv2020=void 0;const r=Po(),n=fs(),o=ps(),i=Cc(),s="https://json-schema.org/draft/2020-12/schema";class c extends r.default{constructor(y={}){super({...y,dynamicRef:!0,next:!0,unevaluated:!0})}_addVocabularies(){super._addVocabularies(),n.default.forEach(y=>this.addVocabulary(y)),this.opts.discriminator&&this.addKeyword(o.default)}_addDefaultMetaSchema(){super._addDefaultMetaSchema();const{$data:y,meta:$}=this.opts;$&&(i.default.call(this,y),this.refs["http://json-schema.org/schema"]=s)}defaultMeta(){return this.opts.defaultMeta=super.defaultMeta()||(this.getSchema(s)?s:void 0)}}t.Ajv2020=c,e.exports=t=c,e.exports.Ajv2020=c,Object.defineProperty(t,"__esModule",{value:!0}),t.default=c;var l=hr();Object.defineProperty(t,"KeywordCxt",{enumerable:!0,get:function(){return l.KeywordCxt}});var u=W();Object.defineProperty(t,"_",{enumerable:!0,get:function(){return u._}}),Object.defineProperty(t,"str",{enumerable:!0,get:function(){return u.str}}),Object.defineProperty(t,"stringify",{enumerable:!0,get:function(){return u.stringify}}),Object.defineProperty(t,"nil",{enumerable:!0,get:function(){return u.nil}}),Object.defineProperty(t,"Name",{enumerable:!0,get:function(){return u.Name}}),Object.defineProperty(t,"CodeGen",{enumerable:!0,get:function(){return u.CodeGen}});var a=Br();Object.defineProperty(t,"ValidationError",{enumerable:!0,get:function(){return a.default}});var f=yr();Object.defineProperty(t,"MissingRefError",{enumerable:!0,get:function(){return f.default}})})(ct,ct.exports)),ct.exports}var jc=Nc();const Tc=co(jc),aa={providerAdvertisement:{$schema:"https://json-schema.org/draft/2020-12/schema",$id:"gamecult.eve.provider_advertisement.v1",title:"Eve Provider Advertisement",type:"object",required:["schema","providerId","serviceId","verseId","title","kind","freshness","schemas","witnesses","surfaces","commands"],properties:{schema:{const:"gamecult.eve.provider_advertisement.v1"},providerId:{type:"string",minLength:1},serviceId:{type:"string",minLength:1},verseId:{type:"string",minLength:1},rootVerse:{type:"string",minLength:1},canonicalService:{type:"string"},locatedService:{type:"string"},cultMeshAddress:{type:"string"},title:{type:"string",minLength:1},kind:{type:"string",minLength:1},updatedAt:{type:"string"},updatedAtUtc:{type:"string"},freshness:{type:"object",required:["state"],properties:{state:{type:"string",minLength:1},lastSeenAt:{type:"string"},lastSeenAtUtc:{type:"string"},maxAgeMs:{type:"number"}},additionalProperties:!0},schemas:{type:"array",items:{type:["string","object"]}},witnesses:{type:"array",items:{type:"object",required:["kind"],properties:{kind:{type:"string",minLength:1},ref:{type:"string"},path:{type:"string"},summary:{type:"string"}},additionalProperties:!0}},surfaces:{type:"array",items:{type:"object",required:["surfaceId","schema","transport"],properties:{surfaceId:{type:"string",minLength:1},schema:{type:"string",minLength:1},key:{type:"string"},recordRef:{type:"string"},url:{type:"string"},transport:{type:"string",minLength:1},status:{type:"string",minLength:1},surfaceKind:{type:"string",minLength:1},interactionModel:{type:"string",minLength:1},worldInteraction:{type:"object",required:["projectionKind","stateSchemas","commandBoundary","receiptSchema","loweringTargets","ownership"],properties:{projectionKind:{type:"string",minLength:1},stateSchemas:{type:"array",items:{type:"string",minLength:1}},commandBoundary:{type:"string",minLength:1},commandRecordRef:{type:"string"},receiptSchema:{type:"string",minLength:1},receiptRecordRef:{type:"string"},assetManifestRecordRef:{type:"string"},loweringTargets:{type:"array",items:{type:"string",minLength:1}},ownership:{type:"string",minLength:1}},additionalProperties:!0},requiresPlugins:{type:"array",items:{type:"object",required:["pluginId","requiredCapabilities"],properties:{pluginId:{type:"string",minLength:1},versionRange:{type:"string"},availability:{type:"string",enum:["required","optional","optional-nested"]},requiredCapabilities:{type:"array",items:{type:"string",minLength:1}},optionalCapabilities:{type:"array",items:{type:"string",minLength:1}}},allOf:[{if:{properties:{availability:{const:"required"}}},then:{properties:{requiredCapabilities:{minItems:1}}}},{if:{required:["availability"],properties:{availability:{const:"optional-nested"}}},then:{required:["optionalCapabilities"],properties:{requiredCapabilities:{maxItems:0},optionalCapabilities:{minItems:1}}}}],additionalProperties:!0}}},additionalProperties:!0}},commands:{type:"array",items:{type:"object",required:["command","transport"],properties:{command:{type:"string",minLength:1},transport:{type:"string",minLength:1},summary:{type:"string"}},additionalProperties:!0}},conformanceScenarios:{type:"array",items:{type:"object",required:["scenarioId","schema","path"],properties:{scenarioId:{type:"string",minLength:1},schema:{type:"string",minLength:1},path:{type:"string",minLength:1},summary:{type:"string"}},additionalProperties:!0}}},additionalProperties:!0},surface:{$schema:"https://json-schema.org/draft/2020-12/schema",$id:"gamecult.eve.surface.v1",title:"Eve Surface Document",type:"object",required:["type","schema","providerId","providerKind","title","version","surface","commands"],properties:{type:{const:"surface-state"},schema:{const:"gamecult.eve.surface.v1"},providerId:{type:"string",minLength:1},providerKind:{type:"string",minLength:1},title:{type:"string",minLength:1},version:{type:"integer",minimum:0},updatedAt:{type:"string",minLength:1},updatedAtUtc:{type:"string",minLength:1},surface:{type:"object",required:["root","styles"],properties:{id:{type:"string"},title:{type:"string"},root:{$ref:"#/$defs/component"},styles:{type:["object","array"]}},additionalProperties:!0},commands:{type:"array",items:{$ref:"gamecult.eve.command.v1"}},nodes:{type:"array",items:{type:"object"}},selectedNodeId:{type:"string"}},$defs:{component:{type:"object",required:["id","kind","props","children"],properties:{id:{type:"string",minLength:1},kind:{type:"string",minLength:1},props:{type:"object"},children:{type:"array",items:{$ref:"#/$defs/component"}},stateBindings:{type:"array",items:{type:"object",required:["targetProp","pointerId","sourceId","schemaId","routeKind"],properties:{targetProp:{type:"string",minLength:1},pointerId:{type:"string",minLength:1},sourceId:{type:"string",minLength:1},schemaId:{type:"string",minLength:1},routeKind:{type:"string",minLength:1},routeDescription:{type:"string"},bindingName:{type:"string",minLength:1},documentId:{type:"string"},fieldPath:{type:"string"},valueKind:{type:"string",enum:["string","number","boolean","choice","string-list"]},accessMode:{type:"string",enum:["read","write","read-write","local-draft"]},authority:{type:"string"},writeCommand:{type:"string"}},additionalProperties:!0}},embeddedDocuments:{type:"array",items:{type:"object",required:["slotId","documentId","schemaId","presentationKind"],properties:{slotId:{type:"string",minLength:1},documentId:{type:"string",minLength:1},schemaId:{type:"string",minLength:1},presentationKind:{type:"string",minLength:1},routeHint:{type:["string","object"]}},additionalProperties:!0}}},additionalProperties:!0}},anyOf:[{required:["updatedAt"]},{required:["updatedAtUtc"]}],additionalProperties:!0},commandDescriptor:{$schema:"https://json-schema.org/draft/2020-12/schema",$id:"gamecult.eve.command.v1",title:"Eve Command Descriptor",type:"object",required:["schema","command"],properties:{schema:{const:"gamecult.eve.command.v1"},command:{type:"string",minLength:1},label:{type:"string"},surfaceId:{type:"string"},transport:{type:"string"},authority:{type:"string"},result:{type:"string"},payloadSchema:{type:"string"},captureBindings:{type:"array",items:{type:"string",minLength:1},uniqueItems:!0}},additionalProperties:!0},commandInvocation:{$schema:"https://json-schema.org/draft/2020-12/schema",$id:"gamecult.eve.command_invocation.v1",title:"Eve Command Invocation",type:"object",required:["schema","providerId","surfaceId","operation","payload","issuedAt","clientId","commandBoundary","receiptSchema"],properties:{schema:{const:"gamecult.eve.command_invocation.v1"},providerId:{type:"string",minLength:1},surfaceId:{type:"string",minLength:1},operation:{type:"object",required:["operationId"],properties:{operationId:{type:"string",minLength:1},schemaId:{type:"string"},idempotencyKey:{type:"string"},routeHint:{type:"object"}},additionalProperties:!0},payload:{type:"object"},issuedAt:{type:"string"},clientId:{type:"string",minLength:1},commandBoundary:{type:"string",minLength:1},receiptSchema:{type:"string",minLength:1}},additionalProperties:!1},commandReceipt:{$schema:"https://json-schema.org/draft/2020-12/schema",$id:"gamecult.eve.command_receipt.v1",title:"Eve Command Receipt",type:"object",required:["schema","receiptId","commandId","command","state","ownerRepo","authority","providerId","surfaceId","sourceVersion"],properties:{schema:{const:"gamecult.eve.command_receipt.v1"},receiptId:{type:"string",minLength:1},commandId:{type:"string"},command:{type:"string",minLength:1},state:{type:"string",enum:["accepted","denied","pending","reconciled"]},ownerRepo:{type:"string",minLength:1},authority:{type:"string",minLength:1},providerId:{type:"string"},surfaceId:{type:"string"},message:{type:"string"},diagnostics:{type:"array",items:{type:"object"}},issuedAtUtc:{type:"string"},sourceVersion:{type:"integer",minimum:0},navigation:{type:"object",required:["verseId","surfaceId"],properties:{verseId:{type:"string",minLength:1},providerId:{type:"string"},surfaceId:{type:"string",minLength:1},surfaceKind:{type:"string"},rendezvousEndpoints:{type:"array",items:{type:"string",minLength:1},uniqueItems:!0}},additionalProperties:!1}},additionalProperties:!0},commandResult:{$schema:"https://json-schema.org/draft/2020-12/schema",$id:"gamecult.eve.command_result.v1",title:"Eve Command Result",type:"object",required:["schema","receipt"],properties:{schema:{const:"gamecult.eve.command_result.v1"},receipt:{$ref:"gamecult.eve.command_receipt.v1"},transientProjection:{type:"object",required:["schema"],properties:{schema:{const:"gamecult.eve.surface.v1"}},additionalProperties:!0},pluginPayload:{type:"object",required:["pluginId","schemaId","payload"],properties:{pluginId:{type:"string",minLength:1},schemaId:{type:"string",minLength:1},payload:{type:"object"}},additionalProperties:!1},draftDirective:{type:"object",required:["clear"],properties:{clear:{type:"boolean"},bindingNames:{type:"array",items:{type:"string",minLength:1},uniqueItems:!0}},additionalProperties:!1}},additionalProperties:!1},inputCapability:{$schema:"https://json-schema.org/draft/2020-12/schema",$id:"gamecult.eve.input_capability.v1",title:"Eve Input Capability",type:"object",required:["schema","providerId","capabilityId","actions","defaultProfiles"],properties:{schema:{const:"gamecult.eve.input_capability.v1"},providerId:{type:"string",minLength:1},capabilityId:{type:"string",minLength:1},version:{type:"integer",minimum:0},actions:{type:"array",items:{type:"object",required:["actionId","label","operation","availability"],properties:{actionId:{type:"string",minLength:1},label:{type:"string",minLength:1},operation:{type:"string",minLength:1},context:{type:"string"},category:{type:"string"},iconRef:{type:"string"},actionBar:{type:"boolean"},availability:{enum:["available","dormant","unavailable"]},sourceRef:{type:"string"},payload:{type:"object",additionalProperties:{type:"string"}},inputValue:{$ref:"#/$defs/inputValue"}},additionalProperties:!1}},defaultProfiles:{type:"array",items:{type:"object",required:["profileId","deviceClass","bindings"],properties:{profileId:{type:"string",minLength:1},deviceClass:{enum:["keyboard-mouse","gamepad"]},bindings:{type:"array",items:{$ref:"#/$defs/binding"}}},additionalProperties:!1}}},$defs:{inputValue:{type:"object",required:["model"],properties:{model:{enum:["button-hold.v1","axis.v1","scalar.v1","view-direction.v1"]},payloadKey:{type:"string",minLength:1},currentValue:{type:"number"},minimumValue:{type:"number"},maximumValue:{type:"number"},stepValue:{type:"number",exclusiveMinimum:0},unit:{type:"string",minLength:1},payloadKeys:{type:"array",minItems:3,maxItems:3,uniqueItems:!0,items:{type:"string",minLength:1}}},allOf:[{if:{properties:{model:{const:"view-direction.v1"}},required:["model"]},then:{required:["payloadKeys"]},else:{required:["payloadKey"]}},{if:{properties:{model:{const:"scalar.v1"}},required:["model"]},then:{required:["currentValue"]}}],additionalProperties:!1},gesture:{type:"object",required:["kind","controls"],properties:{kind:{enum:["direct","chord","sequence","axis"]},controls:{type:"array",minItems:1,items:{type:"string",minLength:1}},maxStepIntervalMs:{type:"integer",minimum:50},completionControl:{type:"string"}},additionalProperties:!1},binding:{type:"object",required:["bindingId","actionId","gesture"],properties:{bindingId:{type:"string",minLength:1},actionId:{type:"string",minLength:1},gesture:{$ref:"#/$defs/gesture"},actionBar:{type:"boolean"}},additionalProperties:!1}},additionalProperties:!1}},Xr=new Tc({allErrors:!0,allowUnionTypes:!0,strict:!0,strictRequired:!1,strictTypes:!1});for(const e of Object.values(aa))Xr.addSchema(e);const Oc=Object.fromEntries(Object.entries(aa).map(([e,t])=>[e,Lc(t.$id)]));class Mc extends TypeError{contract;errors;constructor(t,r){super(`Invalid Eve ${t}: ${Xr.errorsText(r,{separator:"; "})}`),this.name="EveContractValidationError",this.contract=t,this.errors=r}}function oa(e,t){const r=Oc[e];if(!r(t))throw new Mc(e,r.errors??[]);return t}const qc=e=>oa("surface",e),xc=e=>{const t=oa("commandResult",e);return t.transientProjection&&qc(t.transientProjection),t};function Lc(e){const t=Xr.getSchema(e);if(!t)throw new Error(`Eve contract schema ${e} was not registered.`);return t}class sa{values=new Map;key(t,r,n){return`${t}${r}${n}`}has(t,r,n){return this.values.has(this.key(t,r,n))}get(t,r,n){return this.values.get(this.key(t,r,n))}set(t,r,n,o){this.values.set(this.key(t,r,n),o)}clear(t,r,n){if(n?.length){for(const i of n)this.values.delete(this.key(t,r,i));return}const o=`${t}${r}`;for(const i of this.values.keys())i.startsWith(o)&&this.values.delete(i)}capture(t,r,n){return Object.fromEntries(n.map(o=>[o,this.get(t,r,o)]))}}const Yr=[Oa];function Dc(e,t=Yr){const r=[];for(const n of e.requiresPlugins||[]){const o=t.find(s=>s.pluginId===n.pluginId);if(!o){if((n.availability||"required")==="required")throw new Error(`Missing required Eve plugin adapter ${n.pluginId}.`);continue}const i=(n.requiredCapabilities||[]).filter(s=>!o.capabilities.includes(s));if(i.length>0)throw new Error(`Eve plugin adapter ${n.pluginId} lacks required capabilities: ${i.join(", ")}.`);r.push(o)}return r}function Fc(e,t=""){const r=e.surfaces||e.localAdvertisement?.surfaces||[],n=t?r.find(o=>o.surfaceId===t):r.find(o=>o.status!=="unavailable")??r[0];if(!n?.surfaceId)throw new Error(`Provider ${e.providerId||"(unknown)"} does not advertise surface ${t||"(first available)"}.`);return n}class Uc{host;transport;options;active=!1;lastSurfaceVersion="";pollHandle;provider;selected;pluginAdapters=[];draftStore=new sa;constructor(t,r,n={}){this.host=t,this.transport=r,this.options=n}async start(){try{this.provider=await this.transport.providerAdvertisement(),this.selected=Fc(this.provider,this.options.requestedSurfaceId),zc(this.selected),this.pluginAdapters=Dc(this.selected,this.options.pluginAdapters||Yr)}catch(r){const n=r instanceof Error?r.message:"Eve provider capabilities are unavailable.";throw this.host.replaceChildren(Le(n)),this.options.statusElement&&(this.options.statusElement.textContent=n),r}this.active=!0,await this.refresh();const t=Math.max(0,this.options.pollMs??250);t>0&&(this.pollHandle=window.setInterval(()=>{this.refresh()},t))}stop(){this.active=!1,this.pollHandle!==void 0&&window.clearInterval(this.pollHandle),this.pollHandle=void 0}async refresh(){if(!(!this.active||!this.provider||!this.selected))try{const t=await this.transport.surface(this.selected),r=`${t.providerId||""}:${t.surface?.id||""}:${t.version??""}`;if(r===this.lastSurfaceVersion)return;this.lastSurfaceVersion=r,Bc(t,this.host,{activeSurfaceId:this.selected.surfaceId,assetUrlResolver:this.transport.resolveAssetUrl,body:this.options.body,clientId:this.options.clientId||"eve-browser",commandSink:n=>this.submit(n),documentResolver:this.transport.resolveDocument,provider:this.provider,pluginAdapters:this.pluginAdapters,source:this.options.source,statusElement:this.options.statusElement,draftStore:this.draftStore})}catch(t){this.options.statusElement&&(this.options.statusElement.textContent=t instanceof Error?t.message:"Eve surface unavailable.")}}async submit(t){try{const r=xc(await this.transport.submitCommand(t));await this.consumeCommandResult(t,r)}catch(r){this.presentCommandStatus(r instanceof Error?r.message:"Command failed.","error");return}this.lastSurfaceVersion="",window.setTimeout(()=>{this.refresh()},100)}async consumeCommandResult(t,r){const n=r.receipt.state==="accepted"||r.receipt.state==="reconciled";if(n&&r.draftDirective?.clear&&this.draftStore.clear(t.providerId,t.surfaceId,r.draftDirective.bindingNames),r.pluginPayload){const o=this.pluginAdapters.find(i=>i.pluginId===r.pluginPayload?.pluginId);if(!o?.consumeCommandResult)throw new Error(`No Eve plugin adapter can consume ${r.pluginPayload.pluginId}.`);await o.consumeCommandResult(r.pluginPayload,r,{provider:this.provider,surface:this.selected})}this.presentCommandStatus(r.receipt.message||r.receipt.state,n?"status":"error",r.transientProjection)}presentCommandStatus(t,r,n){let o=this.host.querySelector(":scope > .eve-command-result-region");o||(o=T("section","eve-command-result-region"),o.setAttribute("aria-live","polite"),this.host.append(o)),o.setAttribute("role",r),o.replaceChildren(T("p","eve-command-result-message",t));const i=n;i?.surface?.root&&o.append(de(i.surface.root,{activeSurfaceId:i.surface.id||this.selected?.surfaceId,clientId:this.options.clientId,draftStore:this.draftStore,pluginAdapters:this.pluginAdapters,provider:this.provider}))}}function zc(e){if(!e.worldInteraction?.commandBoundary||!e.worldInteraction.receiptSchema)throw new Error(`Eve surface ${e.surfaceId||"(unknown)"} does not advertise a command boundary and receipt schema.`)}const Vc={"--bg":"#020909","--bg-top":"#020909","--bg-mid":"#020909","--bg-bottom":"#020909","--shell-top":"#010707","--shell-bottom":"#010707","--panel":"#071918","--panel-2":"#0a2423","--line":"rgba(103, 240, 228, 0.28)","--line-deep":"rgba(103, 240, 228, 0.18)","--text":"#e7f1f1","--text-bright":"#e7f1f1","--quiet":"#8ba5a3","--accent":"#ffb84f","--accent-strong":"#ffb84f","--corner-accent":"#ffb84f","--cyan":"#8efcff","--shadow":"rgba(0, 0, 0, 0.35)","--pixel-grid":"rgba(142, 252, 255, 0.04)","--border-width":"1px","--border-bottom-width":"1px","--corner-accent-size":"0","--font-body":'"M PLUS 1", "Ubuntu Sans", Ubuntu, "Noto Sans JP", system-ui, sans-serif',"--font-title":'"Montserrat", "Zen Kaku Gothic New", "M PLUS 1", "Ubuntu Sans", system-ui, sans-serif',"--font-mono":'"Ubuntu Sans Mono", "M PLUS 1 Code", "Cascadia Mono", Consolas, monospace'},Oi=new Map,Mi=new WeakMap,qi=new WeakMap,ca=Symbol("eve.browser.render-context");function Kc(e,t){return{...t,[ca]:{surface:e,styles:ga(e.surface?.styles),elements:new WeakMap}}}function Ke(e){return e[ca]}function Bc(e,t,r={}){Mi.get(t)?.dispose();let n=r.draftStore||qi.get(t);n||(n=new sa,qi.set(t,n));const o=Kc(e,{...r,draftStore:n});if(mu(e.surface?.styles,r.body??t),t.dataset.provider=e.providerId||r.provider?.providerId||"",r.body&&(r.body.dataset.provider=e.providerId||r.provider?.providerId||""),r.statusElement&&(r.statusElement.textContent=`${e.title||e.surface?.title||"surface"}${r.source?` (${r.source})`:""}`),e.surface?.root){const i=t.querySelector(":scope > .eve-command-result-region");if(t.replaceChildren(de(e.surface.root,o)),i&&t.append(i),r.stateBindingResolver){const s=new Hc(e,t,o);Mi.set(t,s),s.start()}}else t.replaceChildren(Le("No surface root"));return t}function xi(e,t,r){const n=t.targetProp.split(".").filter(Boolean);if(n.length===0)throw new Error("Eve state binding targetProp must not be empty.");e.props||={};let o=e.props;for(const i of n.slice(0,-1)){const s=o[i];(!s||typeof s!="object"||Array.isArray(s))&&(o[i]={}),o=o[i]}o[n[n.length-1]]=r}class Hc{surface;host;options;disposed=!1;unsubscribers=[];pendingComponents=new Set;projectionQueued=!1;constructor(t,r,n){this.surface=t,this.host=r,this.options=n}async start(){const t=this.options.stateBindingResolver,r=this.surface.surface?.root;if(!t||!r)return;const n=new Set;for(const o of ua(r))for(const i of o.stateBindings||[]){if(this.disposed)return;const s=await t(i,o);if(!s||this.disposed)continue;const c=l=>{this.disposed||(xi(o,i,l),this.queueComponentProjection(o))};if(xi(o,i,await s.latest()),n.add(o),this.disposed)return;this.unsubscribers.push(s.watch(c))}for(const o of n){if(this.disposed)return;this.renderComponentProjection(o)}}dispose(){this.disposed=!0,this.pendingComponents.clear();for(const t of this.unsubscribers.splice(0))t()}queueComponentProjection(t){this.pendingComponents.add(t),!this.projectionQueued&&(this.projectionQueued=!0,queueMicrotask(()=>{if(this.projectionQueued=!1,!this.disposed){for(const r of this.pendingComponents)this.renderComponentProjection(r);this.pendingComponents.clear()}}))}renderComponentProjection(t){const r=Ke(this.options)?.elements.get(t);r?.isConnected&&Gc(r,de(t,this.options),this.host)}}function Gc(e,t,r){const n=e.ownerDocument.activeElement,o=n instanceof HTMLElement&&e.contains(n)?n:void 0,i=o?Wc(e,o):void 0,s=o instanceof HTMLInputElement||o instanceof HTMLTextAreaElement?{start:o.selectionStart,end:o.selectionEnd,direction:o.selectionDirection}:void 0,c={left:r.scrollLeft,top:r.scrollTop};if(e.replaceWith(t),r.scrollLeft=c.left,r.scrollTop=c.top,!i)return;const l=Xc(t,i);l?.focus({preventScroll:!0}),s&&(l instanceof HTMLInputElement||l instanceof HTMLTextAreaElement)&&l.setSelectionRange(s.start,s.end,s.direction??void 0)}function Wc(e,t){if(e===t)return[];const r=[];let n=t;for(;n&&n!==e;){const o=n.parentElement;if(!o)return;r.unshift(Array.prototype.indexOf.call(o.children,n)),n=o}return n===e?r:void 0}function Xc(e,t){let r=e;for(const n of t){const o=r.children.item(n);if(!(o instanceof HTMLElement))return;r=o}return r instanceof HTMLElement?r:void 0}function*ua(e){yield e;for(const t of e.children||[])yield*ua(t)}function de(e,t={}){const r=Yc(e,t);return Ke(t)?.elements.set(e,r),r}function Yc(e,t){const r=e.kind||"panel",n=Q(e.props),o=Q(e.layout),i=Q(e.style),s=e.children||[],c=e.embeddedDocuments||[];if(r==="surface"||r==="cockpit"||r==="dashboard"){const a=T("section","cultui-surface-root eve-surface");te(a,e),typeof o.direction=="string"?a.dataset.direction=o.direction:typeof n.layout=="object"&&n.layout&&typeof n.layout.direction=="string"&&(a.dataset.direction=String(n.layout.direction)),r!=="surface"&&(a.dataset.surfaceKind=r),re(a,o,i);for(const f of s)a.append(de(f,t));return a}if(r==="column"||r==="row"||r==="form"||r==="rail"){const a=T("div",`cultui-partition eve-${r}`);te(a,e),a.dataset.direction=r==="row"||r==="rail"?"horizontal":"vertical",r==="rail"&&(a.dataset.overflow="x"),at(a,{...o,...n}),re(a,o,i);for(const f of s)a.append(de(f,t));return a}if(r==="grid"){const a=T("section","cultui-grid"),f=_e(n.columns,0);f>0?a.style.gridTemplateColumns=`repeat(${f}, minmax(0, 1fr))`:typeof n.columns=="string"&&(a.style.gridTemplateColumns=n.columns);const m=_e(n.rows,0);m>0&&(a.style.gridTemplateRows=`repeat(${m}, minmax(0, auto))`),re(a,o,i);for(const y of s)a.append(de(y,t));return a}if(r==="partition"){const a=T("section",`cultui-partition split-${K(n.split,"none")}`);te(a,e),at(a,n),re(a,o,i),a.style.minWidth="0",K(n.split,"none")==="x"&&!q(n.flexWrap,o.flexWrap,"")&&(a.style.flexWrap="wrap"),typeof n.role=="string"&&(a.dataset.role=n.role);for(const f of s)a.append(de(f,t));return a}if(r==="input.binding-map")return uu(e,n,t);if(r==="inventory.drag_session")return nu(e,n,o,i);if(r==="inventory.grid")return iu(e,n,o,i,t);if(r==="inventory.item")return au(e,n,o,i);const l=(t.pluginAdapters||Yr).find(a=>a.componentKinds.includes(r));if(l?.renderComponent)return l.renderComponent(e,n,o,i,t,{applyGeneratedLayout:re,providerId:Ke(t)?.surface.providerId||t.provider?.providerId,resolveAssetUrl:a=>it(a,t)});if(r==="world.scene3d"||r==="world.scene2d")return Qc(e,n,o,i,t);if(r==="image.background"){const a=T("div","cultui-background"),f=it(q(n.src,n.assetUri,n.assetRef,""),t);return f&&(a.style.backgroundImage=`url("${f}")`),a.setAttribute("aria-label",K(n.label,"background")),a}if(r==="image.sprite"){const a=T("figure",`cultui-sprite ${K(n.slot,"center")}`);te(a,e);const f=it(q(n.src,n.assetUri,n.assetRef,""),t);if(f){const m=T("img");m.src=f,m.alt=K(n.alt,K(n.actor,K(n.label,""))),a.append(m)}return a}if(r==="avatar"){const a=T("figure","cultui-avatar-card");te(a,e);const f=it(q(n.src,n.assetUri,n.assetRef,""),t);if(f){const S=T("img");S.src=f,S.alt=K(n.alt,K(n.text,K(n.label,""))),a.append(S)}else a.append(T("div","cultui-avatar-fallback",ju(q(n.text,n.label,n.actor,"?"))));const m=q(n.text,n.label,n.actor,"");m&&a.append(T("figcaption","cultui-avatar-name",m));const y=q(n.status,"");y&&a.append(T("div","cultui-avatar-status",y));const $=q(n.detail,"");return $&&a.append(T("div","cultui-avatar-detail",$)),a}if(r==="pane"||r==="panel"){const a=T("section","pane cultui-pane");te(a,e);const f=K(n.span,"");f&&(a.dataset.span=f);const m=K(n.density,"");m&&(a.dataset.density=m);const y=K(n.title,e.text||"");y&&a.append(T("h2","",y));for(const $ of s)a.append(de($,t));return a}if(r==="list"||r.endsWith(".roster")){const a=T("section","cultui-list");te(a,e),a.dataset.componentKind=r;const f=K(n.title,"");f&&a.append(T("h3","cultui-list-title",f));for(const[m,y]of Cu(n.items).entries())a.append(de({id:`${e.id||"list"}-item-${m}`,kind:"list.item",props:{...y}},t));for(const m of s)a.append(de(m,t));return a}if(r==="list.item"||r.endsWith(".item")){const a=la(e),f=T("article","cultui-list-item");te(f,e),f.dataset.componentKind=r;const m=T("div","cultui-list-item-heading");if(m.append(T("strong","cultui-list-item-label",a.label)),a.status&&m.append(T("span","cultui-list-item-status",a.status)),f.append(m),a.detail&&f.append(T("div","cultui-list-item-detail",a.detail)),a.badges.length){const y=T("div","cultui-list-item-badges");for(const $ of a.badges)y.append(T("span","cultui-list-item-badge",$));f.append(y)}for(const y of s)f.append(de(y,t));return f}if(r==="bar"){const a=T("div","cultui-meter");te(a,e);const f=K(n.label,""),m=K(n.value,"");if(f||m){const S=T("div","cultui-meter-head");S.append(T("span","",f)),S.append(T("strong","",m)),a.append(S)}const y=T("div","cultui-meter-track"),$=T("span","cultui-meter-fill");return $.style.width=`${Ki(n.percent)}%`,y.append($),a.append(y),a}if(r==="card"){const a=Fr(n,e),f=a?T("button","card cultui-card cultui-card-button"):T("article","card cultui-card");te(f,e),re(f,o,i),f instanceof HTMLButtonElement&&(f.type="button");const m=K(n.title,e.text||"");m&&f.append(T("div","card-title",m));for(const y of s)f.append(de(y,t));return a&&Vi(f,e,a,n,t),f}if(r==="control.button"){const a=T("button","cultui-button eve-control-button",K(n.label,"Action"));return te(a,e),a.type="button",re(a,o,i),Vi(a,e,Fr(n,e),n,t),a}if(r==="control.popup"){const a=T("button","cultui-button eve-control-popup",K(n.label,"Open"));return te(a,e),a.type="button",re(a,o,i),a.addEventListener("click",f=>{lu(e,t,a,f.clientX,f.clientY)}),a}if(r==="text.dialogue"||r==="text"||r==="text.title"||r==="text.subtitle"||r==="label"){const a=T("div",Pu(r,n),K(n.value,K(n.text,e.text||"")));return te(a,e),at(a,n),re(a,o,i),a}if(r==="metric"){const a=T("dl","metric cultui-reactive-metric eve-metric");return te(a,e),re(a,o,i),a.append(T("dt","",K(n.label,"Metric"))),a.append(T("dd","metric-value",K(n.value,""))),a}if(r==="progress"){const a=T("div","cultui-meter eve-progress");te(a,e),re(a,o,i);const f=K(n.label,""),m=K(n.value,""),y=Number(n.min??0),$=Number(n.max??1),S=Number(n.value??0),g=Number.isFinite(S)&&Number.isFinite(y)&&Number.isFinite($)&&$!==y?(S-y)/($-y)*100:Ki(n.percent);if(f||m){const w=T("div","cultui-meter-head");w.append(T("span","",f)),w.append(T("strong","",m)),a.append(w)}const _=T("div","cultui-meter-track"),p=T("span","cultui-meter-fill");return p.style.width=`${Math.max(0,Math.min(100,g))}%`,_.append(p),a.append(_),a}if(r==="modal"){const a=T("section","cultui-modal-surface");te(a,e),re(a,o,i);const f=K(n.title,"");f&&a.append(T("h2","cultui-modal-surface-title",f));for(const m of s)a.append(de(m,t));return a}if(r==="options"){const a=T("section","cultui-options");te(a,e),re(a,o,i);const f=K(n.label,"");f&&a.append(T("h3","cultui-list-title",f));for(const m of s)a.append(de(m,t));return s.length===0&&a.append(Le("waiting for options")),a}if(r==="image.preview"){const a=T("figure","cultui-image-preview");te(a,e);const f=T("div","cultui-image-frame"),m=it(q(n.src,n.assetUri,n.assetRef,""),t);if(m){const y=T("img");y.src=m,y.alt=K(n.label,""),y.style.imageRendering=K(n.imageRendering,"auto"),n.zoom!==void 0&&(y.style.transform=`scale(${n.zoom})`,y.style.transformOrigin=K(n.crop,"50% 50%")),f.append(y)}else f.append(T("span","",K(n.label,"image")));return a.append(f),n.label&&a.append(T("figcaption","",String(n.label))),a}if(r==="canvas.preview"||r==="canvas.editor"){const a=T("div",`cultui-canvas-placeholder ${r==="canvas.editor"?"editor":"preview"}`);return te(a,e),a.append(T("div","viz-label",K(n.label,"Canvas"))),a.append(T("div","cultui-canvas-grid",n.state==="empty"?"waiting for pixels":K(n.state,""))),a}if(r==="surface.slot"){const a=T("section","cultui-embedded-slot");te(a,e),re(a,o,i),a.dataset.slotId=K(n.slotId,K(c[0]?.slotId,"")),a.dataset.documentId=K(n.documentId,K(c[0]?.documentId,"")),a.dataset.schemaId=K(n.schemaId,K(c[0]?.schemaId,"")),a.dataset.presentationKind=K(n.presentationKind,K(c[0]?.presentationKind,""));const f=c.map(y=>Q(y.surface)).find(y=>Q(y.root).kind||y.root),m=n.modal===!0||a.dataset.presentationKind.includes("modal");if((f||a.dataset.documentId)&&m){const y=T("button","cultui-button cultui-modal-trigger",K(n.label,a.dataset.slotId||"Configure"));y.type="button",y.addEventListener("click",()=>ha(Dr(e,t),t)),a.append(y)}else if(f||a.dataset.documentId){const y=T("div","cultui-embedded-slot-body");y.append(T("div","detail","materializing surface")),a.append(y),Dr(e,t).then($=>{y.replaceChildren($?.root?de($.root,t):Le("Embedded surface unavailable"))}).catch($=>{y.replaceChildren(Le(`Embedded surface failed: ${$ instanceof Error?$.message:String($)}`))})}else a.append(T("div","detail",a.dataset.presentationKind||a.dataset.slotId||"embedded surface"));return a}if(r==="control.slider")return wu(n,s,t);if(r==="control.toggle"){const a=T("label","toggle-row cultui-toggle");return te(a,e),a.append(T("span","field-control",n.value?"on":"off")),a.append(T("span","toggle-copy",K(n.label,"Toggle"))),a}if(r==="input.select"||r==="control.select")return $u(e,n,s,o,i,t);if(r==="control.choice-group")return bu(e,n,s,o,i,t);if(r==="input.number"||r==="control.range"||r==="control.input.number"||r==="control.input.text"||r==="control.input.textarea")return vu(e,r,n,o,i,t);if(r==="control.tabs")return _u(e,n,s,o,i,t);if(r==="color.swatch"){const a=T("div","paint-swatch cultui-swatch");return te(a,e),a.style.background=K(n.value,K(n.color,"currentColor")),a.title=K(n.label,"Color"),a}const u=T("section","pane");te(u,e),u.append(T("h2","",r));for(const a of s)u.append(de(a,t));return u}function la(e){const t=Q(e.props);return{label:q(t.label,t.title,t.displayName,e.text,e.kind,"item"),status:q(t.status,t.state,""),detail:q(t.detail,t.phase,t.repoName,""),badges:Array.isArray(t.badges)?t.badges.map(r=>String(r).trim()).filter(Boolean):q(t.badges,"").split(",").map(r=>r.trim()).filter(Boolean)}}function re(e,t,r={}){const n=q(t.display,"");n&&(e.style.display=n);const o=q(t.direction,"");o&&(e.style.flexDirection=o==="horizontal"?"row":o==="vertical"?"column":o);const i=q(t.flexWrap,"");i&&(e.style.flexWrap=i);const s=q(t.gridTemplateColumns,"");s&&(e.style.gridTemplateColumns=s);const c=q(t.gridTemplateRows,"");c&&(e.style.gridTemplateRows=c);const l=q(t.gridTemplateAreas,"");l&&(e.style.gridTemplateAreas=l);const u=q(t.gridArea,"");u&&(e.style.gridArea=u);const a=q(t.placeItems,"");a&&(e.style.placeItems=a),ve(e,"gap",q(t.gap,"")),ve(e,"padding",q(t.padding,"")),ve(e,"margin",q(t.margin,"")),ve(e,"top",q(t.top,"")),ve(e,"right",q(t.right,"")),ve(e,"bottom",q(t.bottom,"")),ve(e,"left",q(t.left,"")),ve(e,"width",q(t.width,"")),ve(e,"minWidth",q(t.minWidth,"")),ve(e,"maxWidth",q(t.maxWidth,"")),ve(e,"height",q(t.height,"")),ve(e,"minHeight",q(t.minHeight,"")),ve(e,"maxHeight",q(t.maxHeight,""));const f=q(t.alignItems,"");f&&(e.style.alignItems=f);const m=q(t.justifyContent,"");m&&(e.style.justifyContent=m);const y=q(t.alignSelf,"");y&&(e.style.alignSelf=y);const $=q(t.overflow,"");$&&(e.style.overflow=$);const S=q(t.overflowX,"");S&&(e.style.overflowX=S);const g=q(t.overflowY,"");g&&(e.style.overflowY=g);const _=q(t.position,"");_&&(e.style.position=_);const p=q(t.cursor,"");p&&(e.style.cursor=p);const w=q(r.background,"");w&&(e.style.background=sr(w));const E=q(r.color,"");E&&(e.style.color=sr(E)),ve(e,"borderWidth",q(r.borderWidth,""));const d=q(r.borderColor,"");d&&(e.style.borderColor=sr(d));const h=q(r.borderStyle,"");h&&(e.style.borderStyle=h),ve(e,"borderRadius",q(r.borderRadius,""));const v=q(r.boxShadow,"");v&&(e.style.boxShadow=v);const I=q(r.font,"");I&&(e.style.font=I),ve(e,"fontSize",q(r.fontSize,""));const O=q(r.fontWeight,"");O&&(e.style.fontWeight=O);const A=q(r.textTransform,"");A&&(e.style.textTransform=A);const M=q(r.textAlign,"");M&&(e.style.textAlign=M);const L=q(r.whiteSpace,"");L&&(e.style.whiteSpace=L);const N=q(r.overflow,"");N&&(e.style.overflow=N);const z=q(r.textOverflow,"");z&&(e.style.textOverflow=z),ve(e,"lineHeight",q(r.lineHeight,""))}function ve(e,t,r){r&&(e.style[t]=ce(r))}function me(e,t){const r={};for(const[n,o]of Object.entries(e))n.startsWith(t)&&(r[n.slice(t.length)]=o);return r}function Jc(e){const t=(e.children||[]).filter(m=>m.kind==="world.entity3d"),r=t.map(m=>ru(Q(m.props).position,[0,0,0])),n=r.map(m=>m[0]),o=r.map(m=>m[2]),i=Math.min(...n,-1),s=Math.max(...n,1),c=Math.min(...o,-1),l=Math.max(...o,1),u=Math.max(1,s-i),a=Math.max(1,l-c),f=6;return t.map((m,y)=>{const $=Q(m.props);return{entityId:q($.entityId,m.id),faction:K($.faction,"neutral"),kind:K($.entityKind,"entity"),label:q($.label,$.entityId,m.id,"Entity"),controlled:je($.controllable),xPercent:f+(r[y][0]-i)/u*(100-f*2),yPercent:f+(1-(r[y][2]-c)/a)*(100-f*2),source:m}})}function Qc(e,t,r,n,o){const i=T("section","cultui-world-scene");te(i,e),re(i,r,n),i.tabIndex=0,i.setAttribute("aria-label",K(t.label,"Interactive world"));const s=Jc(e),c=s.find(a=>a.controlled),l=T("div","cultui-world-heading");l.append(T("strong","",K(t.label,"World"))),l.append(T("span","",`${s.length} entities`)),i.append(l);const u=T("div","cultui-world-plane");for(const a of s){const f=T("button",`cultui-world-entity faction-${Li(a.faction)} kind-${Li(a.kind)}`);f.type="button",f.style.left=`${a.xPercent}%`,f.style.top=`${a.yPercent}%`,f.dataset.entityId=a.entityId,f.dataset.controlled=a.controlled?"true":"false",f.title=a.label,f.setAttribute("aria-label",`${a.label}, ${a.kind}, ${a.faction}`),f.append(T("span","cultui-world-entity-glyph",tu(a.kind))),f.append(T("span","cultui-world-entity-label",a.label));const m=Q(a.source.props),y=q(m.targetCommand,t.targetCommand,m.focusCommand,t.focusCommand);y&&f.addEventListener("click",()=>Tr(y,{actorEntityId:c?.entityId||q(t.playerEntityId),entityId:a.entityId,targetEntityId:a.entityId,targetEntityKey:a.entityId},a.source,o)),u.append(f)}return i.append(u),i.addEventListener("keydown",a=>{const f=eu(a.key);if(f){a.preventDefault();const y=q(t.movementCommand,Q(c?.source.props).moveCommand);y&&Tr(y,{actorEntityId:c?.entityId||q(t.playerEntityId),actorEntityKey:c?.entityId||q(t.playerEntityId),directionX:f[0],directionY:f[1],scalar:1},e,o);return}const m=a.key===" "?q(t.actionCommand,Q(c?.source.props).actionCommand):a.key.toLowerCase()==="f"?q(t.focusCommand,Q(c?.source.props).focusCommand):"";m&&(a.preventDefault(),Tr(m,{actionId:a.key===" "?"0":"focus",actorEntityId:c?.entityId||q(t.playerEntityId),actorEntityKey:c?.entityId||q(t.playerEntityId)},e,o))}),i}function Tr(e,t,r,n){n.commandSink?.(Zc(e,t,n),r)}function Zc(e,t,r={}){return Be(e,{action:t},r)}function eu(e){switch(e.toLowerCase()){case"w":case"arrowup":return[0,1];case"s":case"arrowdown":return[0,-1];case"a":case"arrowleft":return[-1,0];case"d":case"arrowright":return[1,0];default:return}}function tu(e){return e.includes("station")?"S":e.includes("projectile")?".":e.includes("ship")?"^":"+"}function Li(e){return e.toLowerCase().replace(/[^a-z0-9_-]+/g,"-")}function ke(e,t){const r=Number(e);return Number.isFinite(r)?r:t}function ru(e,t){if(Array.isArray(e)){const r=e.map(n=>Number(n));if(r.length>=3&&r.slice(0,3).every(Number.isFinite))return[r[0],r[1],r[2]]}if(typeof e=="string"){const r=e.split(/[,\s]+/).map(n=>Number(n)).filter(Number.isFinite);if(r.length>=3)return[r[0],r[1],r[2]]}return t}function nu(e,t,r,n){const o=je(t.active),i=T("section","cultui-inventory-drag");te(i,e),re(i,r,n),i.dataset.active=o?"true":"false";const s=T("div","cultui-inventory-section-label","Drag");if(re(s,me(r,"sectionLabel."),me(n,"sectionLabel.")),i.append(s),!o){const f=T("div","cultui-inventory-empty","None");return re(f,me(r,"empty."),me(n,"empty.")),i.append(f),i}const c=q(t.itemKey,t.item,"item"),l=T("div","cultui-inventory-drag-chip",c);re(l,me(r,"dragChip."),me(n,"dragChip.")),i.append(l);const u=[t.originOffsetX,t.originOffsetY].map(f=>Number(f)).map(f=>Number.isFinite(f)?f:0),a=T("div","cultui-inventory-meta",`origin ${u[0]}, ${u[1]}`);return re(a,me(r,"meta."),me(n,"meta.")),i.append(a),i}function iu(e,t,r,n,o){const i=T("section","cultui-inventory-grid");te(i,e),re(i,r,n);const s=_e(q(t.columns,t.gridColumns,t.widthCells,""),0),c=s>0?s:6,l=_e(t.rows,0),u=l>0?l:Math.max(3,Math.ceil(Math.max((e.children||[]).length,1)/c));i.style.setProperty("--inventory-columns",String(c)),i.style.setProperty("--inventory-rows",String(u)),i.dataset.cellSpriteMode=K(t.cellSpriteMode,"");const a=q(t.title,t.label,"Inventory"),f=T("div","cultui-inventory-section-label",a);re(f,me(r,"sectionLabel."),me(n,"sectionLabel.")),i.append(f);const m=T("div","cultui-inventory-board");m.style.display="grid",m.style.gridTemplateColumns=`repeat(${c}, ${ce(q(t.cellSize,"72"))})`,m.style.gridTemplateRows=`repeat(${u}, ${ce(q(t.cellSize,"72"))})`,m.style.gap=ce(q(t.cellGap,"4")),m.style.overflow=q(t.boardOverflow,"auto"),m.style.padding=ce(q(t.boardPadding,"4")),re(m,me(r,"board."),me(n,"board.")),m.addEventListener("dragover",S=>{if(!ou(t))return;S.preventDefault(),S.dataTransfer&&(S.dataTransfer.dropEffect="move");const g=S.dataTransfer?.getData("application/vnd.gamecult.eve.inventory-item+json")||"";if(g)try{const _=JSON.parse(g),p=m.getBoundingClientRect(),w=Math.max(1,ke(t.cellSize,72)),E=Math.max(0,ke(t.cellGap,4)),d=w+E,h=Math.max(0,Math.floor((S.clientX-p.left)/d)),v=Math.max(0,Math.floor((S.clientY-p.top)/d));cu(m,_,t,e.children||[],h,v,w)}catch{or(m)}}),m.addEventListener("dragleave",S=>{S.relatedTarget instanceof Node&&m.contains(S.relatedTarget)||or(m)}),m.addEventListener("drop",S=>{or(m);const g=S.dataTransfer?.getData("application/vnd.gamecult.eve.inventory-item+json")||"";if(!g)return;let _;try{_=JSON.parse(g)}catch{return}const p=m.getBoundingClientRect(),w=Math.max(1,ke(t.cellSize,72)),E=Math.max(0,ke(t.cellGap,4)),d=w+E,h=Math.max(0,Math.min(c-1,Math.floor((S.clientX-p.left)/d))),v=Math.max(0,Math.min(u-1,Math.floor((S.clientY-p.top)/d)));if(!da(_,t,e.children||[],h,v).valid)return;const I=su(_,t,h,v,o);I&&(S.preventDefault(),o.commandSink?.(I,e))});const y=new Set;for(const S of e.children||[]){const g=Q(S.props),_=_e(g.x,0),p=_e(g.y,0);y.add(`${_}:${p}`),m.append(de(S,o))}const $=Math.min(c*u,256);for(let S=0;S<$;S+=1){const g=S%c,_=Math.floor(S/c);if(y.has(`${g}:${_}`))continue;const p=T("div","cultui-inventory-cell");p.dataset.x=String(g),p.dataset.y=String(_),p.style.gridColumn=String(g+1),p.style.gridRow=String(_+1),p.style.width=ce(q(t.cellSize,"72")),p.style.height=ce(q(t.cellSize,"72")),re(p,me(r,"cell."),me(n,"cell.")),m.append(p)}return i.append(m),i}function au(e,t,r,n,o){const i=T("button","cultui-inventory-item");te(i,e),i.type="button",re(i,r,n);const s=_e(t.x,0),c=_e(t.y,0);i.dataset.itemKey=q(t.itemKey,t.label,e.id,"item"),i.dataset.source=q(t.source,""),i.draggable=(t.draggable===void 0||je(t.draggable))&&!!q(t.sourceKind,t.source,""),i.addEventListener("dragstart",$=>{!i.draggable||!$.dataTransfer||($.dataTransfer.effectAllowed="move",$.dataTransfer.setData("application/vnd.gamecult.eve.inventory-item+json",JSON.stringify({...t,id:e.id})))});let l=_e(t.shapeWidth,1),u=_e(t.shapeHeight,1);const a=q(t.rotation,"").toLowerCase();["clockwise","counterclockwise","right","left","rotate90","rotate270"].includes(a)&&([l,u]=[u,l]),i.style.gridColumn=`${s+1} / span ${l}`,i.style.gridRow=`${c+1} / span ${u}`;const f=T("span","cultui-inventory-item-icon");re(f,me(r,"icon."),me(n,"icon.")),f.textContent=Nu(q(t.iconAssetUri,t.iconAssetKey,t.itemKey,t.label,"")),i.append(f);const m=q(t.label,t.itemKey,"");if(m){const $=T("span","cultui-inventory-item-label",m);re($,me(r,"label."),me(n,"label.")),i.append($)}const y=Number(t.quantity);if(Number.isFinite(y)&&y>1){const $=T("span","cultui-inventory-item-quantity",String(y));re($,me(r,"quantity."),me(n,"quantity.")),i.append($)}return i.title=[m,q(t.source,""),q(t.quality,"")?`quality ${t.quality}`:"",q(t.durability,"")?`durability ${t.durability}`:""].filter(Boolean).join(" | "),i}function ou(e){return Object.entries(e).some(([t,r])=>(t==="dropCommand"||t.startsWith("dropCommand."))&&typeof r=="string"&&r.length>0)}function su(e,t,r,n,o={}){const i=q(e.sourceKind,e.source,""),s=q(t[`dropCommand.${i}`],t.dropCommand,"");if(!i||!s)return;const c=ke(e.sourceIndex,-1),l=ke(t.targetIndex,-1),u=q(t.targetKind,""),a={};return Fi(e,a),Fi(t,a),Object.assign(a,{sourceKind:i,originEntityKey:q(e.sourceEntityKey,e.entityKey,""),originIndex:c,originCargoIndex:i==="cargo"?c:-1,itemKey:q(e.itemKey,""),quantity:Math.max(1,ke(e.quantity,1)),sourceX:ke(e.x,-2147483648),sourceY:ke(e.y,-2147483648),sourceRotation:q(e.rotation,"None"),destinationKind:u,destinationEntityKey:q(t.targetEntityKey,t.entityKey,""),destinationIndex:l,destinationCargoIndex:u==="cargo"?l:-1,destinationX:Math.trunc(r),destinationY:Math.trunc(n),destinationRotation:q(t.dropRotation,e.rotation,"None"),hasDestinationPosition:!0}),Be(s,{action:a},o)}function da(e,t,r,n,o){const i=Math.max(1,_e(t.columns,1)),s=Math.max(1,_e(t.rows,1)),c=Di(e).map(m=>({x:Math.trunc(n)+m.x,y:Math.trunc(o)+m.y})),l=new Set(fa(t.validCells).map(m=>`${m.x}:${m.y}`)),u=q(e.id,""),a=new Set;for(const m of r||[]){if(m.kind!=="inventory.item"||u&&m.id===u)continue;const y=Q(m.props),$=Math.trunc(ke(y.x,0)),S=Math.trunc(ke(y.y,0));for(const g of Di(y))a.add(`${$+g.x}:${S+g.y}`)}let f="valid";return c.some(m=>m.x<0||m.y<0||m.x>=i||m.y>=s)?f="outside-grid":l.size>0&&c.some(m=>!l.has(`${m.x}:${m.y}`))?f="outside-valid-shape":c.some(m=>a.has(`${m.x}:${m.y}`))&&(f="occupied"),{valid:f==="valid",reason:f,cells:c}}function Di(e){const t=fa(e.shapeCells);if(t.length>0)return t;let r=Math.max(1,_e(e.shapeWidth,1)),n=Math.max(1,_e(e.shapeHeight,1));const o=q(e.rotation,"").toLowerCase();return["clockwise","counterclockwise","right","left","rotate90","rotate270","clockwise90","clockwise270"].includes(o)&&([r,n]=[n,r]),Array.from({length:r*n},(i,s)=>({x:s%r,y:Math.floor(s/r)}))}function fa(e){return typeof e!="string"?[]:e.split(";").flatMap(t=>{const[r,n]=t.split(",").map(Number);return Number.isInteger(r)&&Number.isInteger(n)?[{x:r,y:n}]:[]})}function Fi(e,t){for(const[r,n]of Object.entries(e))r.startsWith("payload.")&&r.length>8&&(t[r.slice(8)]=n)}function or(e){e.querySelectorAll(".cultui-inventory-placement-preview").forEach(t=>t.remove())}function cu(e,t,r,n,o,i,s){or(e);const c=da(t,r,n,o,i);for(const l of c.cells){const u=T("div",`cultui-inventory-placement-preview ${c.valid?"is-valid":"is-invalid"}`);u.style.gridColumn=String(l.x+1),u.style.gridRow=String(l.y+1),u.style.width=ce(String(s)),u.style.height=ce(String(s)),u.style.pointerEvents="none",e.append(u)}}function uu(e,t,r){const n=T("section","cultui-binding-map");te(n,e);const o=document.createElementNS("http://www.w3.org/2000/svg","svg");o.setAttribute("class","cultui-xbox-controller"),o.setAttribute("viewBox","0 0 780 420"),o.setAttribute("role","img"),o.setAttribute("aria-label",K(t.label,"Xbox controller remapping")),o.innerHTML=fu(),n.append(o);const i=T("div","cultui-binding-overlay");for(const s of e.children||[]){const c=Q(s.props),l=K(c.target,s.id||""),u=T("button","cultui-binding-box");te(u,s),u.type="button",u.dataset.target=l,u.dataset.kind=K(c.bindingKind,"button"),u.style.left=ce(c.x??"50%"),u.style.top=ce(c.y??"50%"),u.append(T("span","cultui-binding-target",K(c.label,l))),u.append(T("span","cultui-binding-source",K(c.current,"unmapped"))),u.addEventListener("click",()=>{const f=pa(s);if(ma(s)||f?.documentId)ha(Dr(s,r),r);else{const m=K(c.commandId,"");m&&r.commandSink?.(Be(m,c,r),s)}}),i.append(u);const a=document.createElementNS("http://www.w3.org/2000/svg","line");a.setAttribute("class","cultui-binding-line"),a.setAttribute("x1",K(c.anchorX,"390")),a.setAttribute("y1",K(c.anchorY,"210")),a.setAttribute("x2",String(zi(c.x,780))),a.setAttribute("y2",String(zi(c.y,420))),o.append(a)}return n.append(i),n}function ma(e){for(const t of e.embeddedDocuments||[]){const r=Q(t.surface);if(r.root)return r}}function pa(e){const t=(e.embeddedDocuments||[])[0],r=Q(e.props),n=q(r.documentId,t?.documentId,"");if(n)return{documentId:n,presentationKind:q(r.presentationKind,t?.presentationKind,""),schemaId:q(r.schemaId,t?.schemaId,""),slotId:q(r.slotId,t?.slotId,"")}}async function Dr(e,t){const r=ma(e);if(r)return r;const n=pa(e);if(!n?.documentId||!t.documentResolver)return;const o=await t.documentResolver(n,e);if(o)return Q(o.surface).root?o.surface:o}function ha(e,t){const r=T("div","cultui-modal-backdrop"),n=T("section","cultui-modal");n.setAttribute("role","dialog"),n.setAttribute("aria-modal","true");const o=T("header","cultui-modal-header");o.append(T("h2","","Configure Binding"));const i=T("button","cultui-modal-close","Close");i.type="button",i.addEventListener("click",()=>r.remove()),o.append(i);const s=T("div","cultui-modal-body");n.append(o,s),r.append(n),r.addEventListener("click",c=>{c.target===r&&r.remove()}),document.body.append(r),s.append(T("div","detail","materializing document")),Promise.resolve(e).then(c=>{o.querySelector("h2").textContent=c?.title||"Configure Binding",s.replaceChildren(c?.root?de(c.root,t):Le("Embedded document unavailable"))}).catch(c=>{s.replaceChildren(Le(`Embedded document failed: ${c instanceof Error?c.message:String(c)}`))})}function lu(e,t,r,n,o){const i=Q(e.props),s=(e.children||[])[0],c=Q(s?.props),l=q(c.anchor,i.anchor,"trigger"),u=q(c.placement,i.placement,"below-start"),a=Number(q(c.offsetX,i.offsetX,"0"))||0,f=Number(q(c.offsetY,i.offsetY,"4"))||0,m=T("div","cultui-modal-backdrop");m.style.background="transparent",m.style.placeItems="start";const y=T("section","cultui-modal");y.setAttribute("role","dialog"),y.setAttribute("aria-modal","true"),y.style.position="fixed",y.style.width="min(420px, calc(100vw - 24px))",y.style.maxHeight="min(620px, calc(100vh - 24px))";const $=T("header","cultui-modal-header");$.append(T("h2","",q(c.title,i.title,i.label,"Options")));const S=T("button","cultui-modal-close","Close");S.type="button",S.addEventListener("click",()=>m.remove()),$.append(S);const g=T("div","cultui-modal-body");if(s){const p=s.children||[];p.length>0?g.replaceChildren(...p.map(w=>de(w,t))):g.append(de(s,t))}else g.append(Le("Popup has no content"));y.append($,g),m.append(y),m.addEventListener("click",p=>{p.target===m&&m.remove()}),document.body.append(m);const _=du(l,u,r,y,n,o,a,f);y.style.left=`${_.left}px`,y.style.top=`${_.top}px`}function du(e,t,r,n,o,i,s,c){const l=r.getBoundingClientRect(),u=n.getBoundingClientRect(),a=u.width||420,f=u.height||320,m=e==="cursor"?{left:o,right:o,top:i,bottom:i}:l;if(t==="right-down"||t==="dropdown")return nr(m,a,f,s,c,"right","down");if(t==="left-down")return nr(m,a,f,s,c,"left","down");if(t==="right-up")return nr(m,a,f,s,c,"right","up");if(t==="left-up")return nr(m,a,f,s,c,"left","up");switch(t){case"above-start":return xe(m.left+s,m.top-f-c,a,f);case"above-end":return xe(m.right-a+s,m.top-f-c,a,f);case"below-end":return xe(m.right-a+s,m.bottom+c,a,f);case"right-start":return xe(m.right+s,m.top+c,a,f);case"left-start":return xe(m.left-a-s,m.top+c,a,f);case"center":return xe((window.innerWidth-a)/2+s,(window.innerHeight-f)/2+c,a,f);default:return xe(m.left+s,m.bottom+c,a,f)}}function nr(e,t,r,n,o,i,s){const l=window.innerWidth-e.right-n-12,u=e.left-n-12,a=window.innerHeight-e.top-o-12,f=e.bottom-o-12,m=i==="right"?l>=t||l>=u:!(u>=t||u>=l),y=s==="down"?a>=r||a>=f:!(f>=r||f>=a),$=m?e.right+n:e.left-t-n,S=y?e.top+o:e.bottom-r-o;return xe($,S,t,r)}function xe(e,t,r,n){return{left:Ui(e,12,window.innerWidth-r-12),top:Ui(t,12,window.innerHeight-n-12)}}function Ui(e,t,r){return r @@ -157,4 +157,4 @@ void main() { YBXA - `}function mu(e,t=document.body){const r=ya(e),n=document.documentElement.style;Eu(r.assets.fontCss);for(const[u,a]of Object.entries(Vc))n.setProperty(u,a);const o={colorBackground:"--bg",colorBackgroundTop:"--bg-top",colorBackgroundMid:"--bg-mid",colorBackgroundBottom:"--bg-bottom",colorShellSurfaceTop:"--shell-top",colorShellSurfaceBottom:"--shell-bottom",colorPanel:"--panel",colorPanelAlt:"--panel-2",colorPanelBorder:"--line",colorPanelBorderDeep:"--line-deep",colorText:"--text",colorTextBright:"--text-bright",colorMuted:"--quiet",colorAccent:"--accent",colorAccentStrong:"--accent-strong",colorCornerAccent:"--corner-accent",colorLink:"--cyan",colorShadow:"--shadow",colorPixelGrid:"--pixel-grid"};for(const[u,a]of Object.entries(o)){const f=r.tokens[u];f!==void 0&&n.setProperty(a,String(f))}const i=r.tokens.fontBody,s=r.tokens.fontDisplay,c=r.tokens.fontTitle,l=r.tokens.fontMono;i&&n.setProperty("--font-body",ir(String(i))),s&&n.setProperty("--font-title",ir(String(s))),c&&n.setProperty("--font-title",ir(String(c))),l&&n.setProperty("--font-mono",ir(String(l))),r.tokens.borderWidthPx&&n.setProperty("--border-width",`${r.tokens.borderWidthPx}px`),r.tokens.borderBottomWidthPx&&n.setProperty("--border-bottom-width",`${r.tokens.borderBottomWidthPx}px`),r.tokens.cornerAccentPx&&n.setProperty("--corner-accent-size",`${r.tokens.cornerAccentPx}px`),t.dataset.pixelArt=r.tokens.pixelArt||r.tokens.imageRendering==="pixelated"?"true":"false",t.dataset.scanlines=r.tokens.scanlineOverlay?"true":"false"}function Be(e,t={},r={}){const n=Q(t.action),o=Ke(r)?.surface,i=r.provider?.providerId||o?.providerId||"surface unknown",s=r.activeSurfaceId||o?.surface?.id||r.provider?.surfaces?.[0]?.surfaceId||i,c=gu(r,s),l=q(c.commandBoundary,t.commandBoundary,n.commandBoundary,n.target),u=q(c.receiptSchema,t.receiptSchema,n.receiptSchema);if(!l||!u)throw new Error(`Eve surface ${s} cannot invoke commands without an advertised command boundary and receipt schema.`);const a=e||K(n.type,"invoke"),f=o?.commands?.find(g=>g.command===a),m=ga(f?.captureBindings??n.captureBindings??t.captureBindings),y=pu(o?.surface?.root,i,s,m,r.draftStore),$=hu(n);return m.length&&($.bindings=y),{schema:"gamecult.eve.command_invocation.v1",providerId:i,surfaceId:s,operation:{operationId:a,schemaId:q(f?.payloadSchema,n.schemaId,t.payloadSchema,"gamecult.eve.operation_payload.v1"),idempotencyKey:yu(),routeHint:{sourceVersion:Math.max(0,Math.trunc(o?.version??0)),...q(f?.transport,t.transport,n.transport)?{transport:q(f?.transport,t.transport,n.transport)}:{}}},payload:$,issuedAt:new Date().toISOString(),clientId:r.clientId||"eve.browser",commandBoundary:l,receiptSchema:u}}function pu(e,t,r,n,o){const i={};for(const s of n){if(o?.has(t,r,s)){i[s]=o.get(t,r,s);continue}const c=ha(e,s);c.found&&(i[s]=c.value)}return i}function ha(e,t){if(!e)return{found:!1};const r=Q(e.props),n=(e.stateBindings||[]).find(i=>q(i.bindingName,i.pointerId)===t);if(q(n?.bindingName,r.bind,n?.pointerId,e.id)===t){const i=q(n?.targetProp,"value");if(Object.prototype.hasOwnProperty.call(r,i))return{found:!0,value:r[i]}}for(const i of e.children||[]){const s=ha(i,t);if(s.found)return s}return{found:!1}}function hu(e){const t={...e};for(const r of["command","commandBoundary","receiptSchema","schemaId","captureBindings","transport"])delete t[r];return t}function yu(){if(typeof globalThis.crypto?.randomUUID=="function")return globalThis.crypto.randomUUID();const e=new Uint8Array(16);if(globalThis.crypto?.getRandomValues?.(e),!e.some(Boolean))for(let t=0;tt.toString(16).padStart(2,"0")).join("")}function gu(e,t){const r=[...e.provider?.surfaces||[],...e.provider?.localAdvertisement?.surfaces||[]];return r.find(n=>n.surfaceId===t&&n.worldInteraction)?.worldInteraction||r.find(n=>n.worldInteraction)?.worldInteraction||{}}function Dr(e,t){const r=Q(e.action);return K(e.command,K(e.commandId,K(r.command,K(r.target,K(r.type,t?.commandId||"")))))}function Le(e){const t=T("section","pane");return t.append(T("h2","","No Surface")),t.append(T("div","detail",e)),t}function zi(e,t,r,n,o){e.dataset.commandId=r,e.tabIndex=e instanceof HTMLButtonElement?e.tabIndex:0;const i=()=>{const s=Be(r,n,o);o.commandSink?.(s,t)};e.addEventListener("click",i),e.addEventListener("keydown",s=>{(s.key==="Enter"||s.key===" ")&&(s.preventDefault(),i())})}function gr(e,t,r){const n=(e.stateBindings||[]).find(a=>a.targetProp==="value")??e.stateBindings?.[0],o=Ke(r)?.surface,i=r.provider?.providerId||o?.providerId||"surface unknown",s=r.activeSurfaceId||o?.surface?.id||i,c=q(n?.bindingName,t.bind,n?.pointerId,e.id),l=c&&r.draftStore?.has(i,s,c)?r.draftStore.get(i,s,c):void 0,u=n?.accessMode||(n?"read":"local-draft");return{binding:n,bindingName:c,providerId:i,surfaceId:s,value:l??t.value??"",disabled:je(t.disabled)||u==="read"}}function ot(e,t,r){e.bindingName&&r.draftStore?.set(e.providerId,e.surfaceId,e.bindingName,t)}function Yr(e,t,r,n){const o=e.binding,i=o?.writeCommand;!o||!i||!e.bindingName||n.commandSink?.(Be(i,{action:{bindingName:e.bindingName,documentId:o.documentId,fieldPath:o.fieldPath,value:t}},n),r)}function vu(e,t,r,n,o,i){const s=gr(e,r,i),c=T("label","field cultui-field cultui-editable");te(c,e),at(c,r),re(c,n,o);const l=K(r.label,"");l&&c.append(T("span","field-label",l));const u=T(t==="control.input.textarea"?"textarea":"input","field-control cultui-field-input");u instanceof HTMLInputElement?(u.type=t.includes("number")||t==="control.range"?"number":"text",r.min!==void 0&&(u.min=String(r.min)),r.max!==void 0&&(u.max=String(r.max)),r.step!==void 0&&(u.step=String(r.step))):r.rows!==void 0&&(u.rows=_e(r.rows,3)),u.value=String(s.value??""),u.disabled=s.disabled,u.name=s.bindingName,u.dataset.bindingName=s.bindingName,u.setAttribute("aria-label",l||s.bindingName||e.id||"Input"),r.placeholder!==void 0&&u.setAttribute("placeholder",String(r.placeholder)),je(r.required)&&(u.required=!0),u.addEventListener("input",()=>{const f=u instanceof HTMLInputElement&&u.type==="number"?u.value===""?"":Number(u.value):u.value;ot(s,f,i)}),u.addEventListener("change",()=>{const f=u instanceof HTMLInputElement&&u.type==="number"?u.value===""?"":Number(u.value):u.value;Yr(s,f,e,i)}),c.append(u);const a=q(r.validationMessage,r.error,"");if(a){const f=T("span","cultui-field-validation",a);f.setAttribute("role","alert"),c.append(f),u.setAttribute("aria-invalid","true")}return c}function bu(e,t,r,n,o,i){const s=gr(e,t,i),c=T("fieldset","field cultui-field cultui-choice-group");te(c,e),re(c,n,o);const l=q(t.label,e.text,s.bindingName);l&&c.append(T("legend","field-label",l));for(const u of r){const a=Q(u.props),f=q(a.value,u.id),m=T("label","cultui-choice"),y=T("input");y.type=je(t.multiple)?"checkbox":"radio",y.name=s.bindingName,y.value=f,y.disabled=s.disabled||je(a.disabled),y.checked=y.type==="checkbox"?ga(s.value).includes(f):String(s.value)===f,y.addEventListener("change",()=>{const $=y.type==="checkbox"?[...c.querySelectorAll("input:checked")].map(S=>S.value):f;ot(s,$,i),Yr(s,$,e,i)}),m.append(y,document.createTextNode(q(a.label,u.text,f))),c.append(m)}return c}function _u(e,t,r,n,o,i){const s=gr(e,{...t,bind:t.bind||`${e.id||"tabs"}.selected`},i),c=T("section","cultui-tabs");te(c,e),re(c,n,o);const l=T("div","cultui-tab-list");l.setAttribute("role","tablist");const u=T("div","cultui-tab-panels"),a=q(s.value,Q(r[0]?.props).value,r[0]?.id),f=m=>{ot(s,m,i);for(const y of l.querySelectorAll("[role=tab]")){const $=y.dataset.value===m;y.setAttribute("aria-selected",String($)),y.tabIndex=$?0:-1}for(const y of u.querySelectorAll("[role=tabpanel]"))y.hidden=y.dataset.value!==m};for(const[m,y]of r.entries()){const $=Q(y.props),S=q($.value,y.id,String(m)),g=T("button","cultui-tab",q($.label,y.text,S));g.type="button",g.dataset.value=S,g.setAttribute("role","tab"),g.addEventListener("click",()=>f(S)),l.append(g);const _=T("section","cultui-tab-panel");_.dataset.value=S,_.setAttribute("role","tabpanel");for(const p of y.children||[])_.append(de(p,i));u.append(_)}return c.append(l,u),f(a),c}function $u(e,t,r,n,o,i){const s=gr(e,t,i),c=T("label","field cultui-field cultui-select");te(c,e),at(c,t),re(c,n,o);const l=K(t.label,"");l&&c.append(T("span","field-label",l));const u=T("select","field-control cultui-field-select");u.setAttribute("aria-label",l||e.id||"Select");for(const f of r){if(f.kind!=="control.option"&&f.kind!=="input.option"&&f.kind!=="option")continue;const m=Q(f.props),y=document.createElement("option");y.value=K(m.value,f.id||""),y.textContent=K(m.label,K(m.text,y.value)),y.disabled=je(m.disabled)||m.enabled!==void 0&&!je(m.enabled),u.append(y)}u.value=String(s.value??""),u.name=s.bindingName,u.dataset.bindingName=s.bindingName,u.disabled=s.disabled||t.enabled!==void 0&&!je(t.enabled);const a=Dr(t,e);return a?(u.dataset.commandId=a,u.addEventListener("change",()=>{ot(s,u.value,i);const f=Be(a,{...t,action:{...Q(t.action),value:u.value}},i);i.commandSink?.(f,e)})):u.addEventListener("change",()=>{ot(s,u.value,i),Yr(s,u.value,e,i)}),c.append(u),c}function wu(e,t,r){const n=Su(e,t,r),o=Q(n.find(m=>m.kind==="control.box")?.props),i=n.filter(m=>m.kind==="control.part"),s=Number(e.min??0),c=Number(e.max??1),l=T("div","cultui-slider");l.dataset.skin=K(e.skin,"default"),l.dataset.bind=K(e.bind,""),Iu(l,o);const u=T("div","cultui-slider-visual"),a=T("input","cultui-slider-input");a.type="range",a.min=String(s),a.max=String(c),a.step=String(e.step??.01),a.setAttribute("aria-label",K(e.bind,"slider"));for(const m of i){const y=Q(m.props),$=T("span",`cultui-slider-part ${K(y.name,"part")}`);Ru($,y),u.append($)}return i.some(m=>Q(m.props).name==="track")||u.append(T("span","cultui-slider-part track")),i.some(m=>Q(m.props).name==="fill")||u.append(T("span","cultui-slider-part fill")),i.some(m=>Q(m.props).name==="thumb")||u.append(T("span","cultui-slider-part thumb")),l.append(u,a),(m=>{const y=Number(m??s),$=Math.max(s,Math.min(c,Number.isFinite(y)?y:s)),S=c===s?0:($-s)/(c-s)*100;a.value=String($),l.style.setProperty("--cultui-slider-value",`${S}%`),l.dataset.value=String($)})(e.value??s),a.addEventListener("input",()=>{const m=Be(K(e.command,"control.slider.input"),{...e,action:{...Q(e.action),value:Number(a.value)},value:Number(a.value)},r);r.commandSink?.(m,{kind:"control.slider",props:e})}),l}function Su(e,t,r){const n=typeof e.skin=="string"?e.skin:"",i=[...n?Ke(r)?.styles.controlSkins[n]?.children||[]:[],...t];return i.length?i:[{kind:"control.box",props:{height:18,overflow:"visible"}},{kind:"control.part",props:{name:"track",anchor:"center",size:["100%",6],radius:2,fill:"color.panelInset"}},{kind:"control.part",props:{name:"fill",anchor:["left","center"],size:["value%",6],radius:2,fill:"color.accent"}},{kind:"control.part",props:{name:"thumb",anchor:["value","center"],size:[12,12],bleed:3,radius:999,fill:"color.accent"}}]}function ya(e){if(Array.isArray(e)){const t={},r={};for(const n of e)n?.name&&(n.name==="font.web.google"&&typeof n.value=="string"?r.fontCss=n.value:t[n.name]=n.value);return{tokens:t,assets:r,controlSkins:{}}}return{tokens:Q(e?.tokens),assets:Q(e?.assets),controlSkins:Q(e?.controlSkins)}}function it(e,t){if(!e)return"";const r=Ke(t)?.surface,n=t.assetUrlResolver;return n?n(e,r):/^(https?:|data:|blob:)/i.test(e)?e:t.assetBaseUrl&&e.startsWith("/")?`${t.assetBaseUrl.replace(/\/+$/,"")}${e}`:e}function Eu(e){const t=typeof e=="string"?e.trim():"";if(!t||Ti.has(t))return;const r=document.createElement("link");r.rel="preconnect",r.href="https://fonts.gstatic.com",r.crossOrigin="anonymous",document.head.append(r);const n=document.createElement("link");n.rel="stylesheet",n.href=t,n.dataset.href=t,document.head.append(n),Ti.set(t,n)}function Pu(e,t,r){const n=[];return(e==="text.title"||t.role==="title")&&n.push("cultui-title","eve-text-title"),e==="text.subtitle"&&n.push("eve-text-subtitle"),e==="label"&&n.push("cultui-label"),t.role==="mono"&&n.push("detail","mono"),n.length===0&&n.push("detail","eve-text"),n.join(" ")}function Iu(e,t){t.height!==void 0&&(e.style.minHeight=ce(t.height)),t.width!==void 0&&(e.style.width=ce(t.width)),typeof t.overflow=="string"&&(e.style.overflow=t.overflow)}function Ru(e,t){const r=Array.isArray(t.size)?t.size:[t.size,void 0];r[0]!==void 0&&r[0]!=="value%"&&(e.style.width=ce(r[0])),r[1]!==void 0&&(e.style.height=ce(r[1])),t.radius!==void 0&&(e.style.borderRadius=ce(t.radius)),t.fill!==void 0&&(e.style.background=sr(String(t.fill))),t.bleed!==void 0&&e.style.setProperty("--part-bleed",ce(t.bleed)),(Array.isArray(t.anchor)?t.anchor:[t.anchor]).includes("value")&&(e.dataset.anchorValue="true")}function at(e,t){t.gap!==void 0&&(e.style.gap=ce(t.gap)),t.padding!==void 0&&(e.style.padding=ce(t.padding)),t.size!==void 0&&(e.style.flex=Au(t.size)),t.min!==void 0&&(e.style.minWidth=ce(t.min)),t.max!==void 0&&(e.style.maxWidth=ce(t.max)),t.align!==void 0&&(e.style.alignItems=t.align==="end"?"flex-end":String(t.align)),(t.clip==="true"||t.clip===!0)&&(e.style.overflow="hidden"),t.scroll==="y"&&(e.style.overflowY="auto"),t.scroll==="x"&&(e.style.overflowX="auto")}function Au(e){return typeof e=="string"&&e.endsWith("fr")?`${Number(e.slice(0,-2))||1} 1 0`:e==="auto"||e==="content"?"0 0 auto":`0 0 ${ce(e)}`}function ce(e){return Array.isArray(e)?e.map(ce).join(" "):typeof e=="number"?`${e}px`:typeof e=="string"&&/^-?\d+(\.\d+)?$/.test(e)?`${e}px`:String(e??"")}function sr(e){return{"color.accent":"var(--accent)","color.panelInset":"rgba(0, 0, 0, 0.34)","color.panel":"var(--panel)","color.text":"var(--text)"}[e]||e}function ir(e){return e.includes("Zen Kaku Gothic New")||e.includes("M PLUS 1")?e:e.includes("Montserrat")?`${e}, "Zen Kaku Gothic New", "M PLUS 1", "Noto Sans JP", "Hiragino Sans", "Yu Gothic", sans-serif`:e.includes("Ubuntu")?`${e}, "M PLUS 1", "Noto Sans JP", "Hiragino Sans", "Yu Gothic", sans-serif`:`${e}, "Noto Sans JP", "Hiragino Sans", "Yu Gothic", sans-serif`}function te(e,t){t.id&&(e.id=t.id),t.id&&(e.dataset.eveNodeId=t.id),t.kind&&(e.dataset.eveKind=t.kind)}function Q(e){return e&&typeof e=="object"&&!Array.isArray(e)?e:{}}function ku(e){return Array.isArray(e)?e:[]}function Cu(e){return ku(e).map((t,r)=>ua({kind:"list.item",props:Q(t)}))}function K(e,t){return e==null?t:String(e)}function ga(e){return Array.isArray(e)?e.map(t=>String(t).trim()).filter(Boolean):typeof e=="string"?e.split(",").map(t=>t.trim()).filter(Boolean):[]}function q(...e){for(const t of e){if(typeof t=="string"&&t.trim())return t;if(typeof t=="number"&&Number.isFinite(t))return String(t)}return""}function je(e){return typeof e=="boolean"?e:typeof e=="number"?e!==0:typeof e=="string"?["1","true","yes","on"].includes(e.trim().toLowerCase()):!1}function _e(e,t){const r=Number(e);return Number.isFinite(r)?Math.max(0,Math.floor(r)):t}function Nu(e){const t=e.toLowerCase();return t.includes("sensor")?"S":t.includes("thermal")?"T":t.includes("fuel")?"F":t.includes("cargo")?"C":t.includes("weapon")?"W":e.trim().slice(0,1).toUpperCase()||"?"}function ju(e){const t=e.trim().split(/\s+/).filter(Boolean);return t.length&&t.slice(0,2).map(r=>r[0]?.toUpperCase()||"").join("")||"?"}function Vi(e){const t=Number(e);return Number.isFinite(t)?Math.max(0,Math.min(100,t)):0}function T(e,t="",r=""){const n=document.createElement(e);return t&&(n.className=t),r&&(n.textContent=r),n}const Ze="gamecult.heimdall.access.attempt";function Tu(e){const t=new Set(e.advertisedOrigins.map(r=>new URL(r).origin));return{pluginId:"gamecult.heimdall.access",capabilities:["auth.gate","auth.begin","auth.complete","auth.logout"],componentKinds:["heimdall.access_gate","heimdall.identity","heimdall.access_status"],schemas:["heimdall.access_gate_state.v1"],normalizeDocument(r,n){return n},renderComponent(r,n){const o=document.createElement("section");o.className=`heimdall-access heimdall-access-${String(n.state||"unknown")}`,r.id&&(o.id=r.id),o.setAttribute("role","status"),o.setAttribute("aria-live","polite");const i=document.createElement("h2");i.textContent=String(n.title||"Access");const s=document.createElement("p");s.textContent=String(n.detail||""),o.append(i,s);const c=String(n.displayName||"");if(c){const l=document.createElement("p");l.className="heimdall-identity",l.textContent=c,o.append(l)}return o},async consumeCommandResult(r){if(r.schemaId==="heimdall.auth_navigation_receipt.v1"){const n=String(r.payload.handle||""),o=xu(r.payload.navigation),i=new URL(String(o.url||"")),s=Array.isArray(o.allowedOrigins)?o.allowedOrigins.filter(c=>typeof c=="string"):[];if(!n||i.protocol!=="https:"||!t.has(i.origin)||!s.includes(i.origin))throw new Error("Heimdall returned an unsafe authentication navigation receipt.");sessionStorage.setItem(Ze,n),window.location.assign(i.toString());return}if(r.schemaId==="heimdall.auth_completion_status.v1"){const n=String(r.payload.status||"");(n==="authenticated"||n==="denied"||n==="expired")&&sessionStorage.removeItem(Ze)}}}}const Fr=Tu({advertisedOrigins:["https://discord.com","https://heimdall.gamecult.org"]});async function Ou(e,t){const r=Mu(window.location.href,t.appSlug),n=sessionStorage.getItem(Ze);if(r){if(qu(),r.status==="error")throw sessionStorage.removeItem(Ze),new Error(r.message);if(n&&n!==r.handle)throw sessionStorage.removeItem(Ze),new Error("Heimdall returned an authentication attempt other than the one this browser started.");sessionStorage.setItem(Ze,r.handle)}const o=r?.status==="success"?r.handle:n;return o?(await e.complete(o),!0):!1}function Mu(e,t){const r=new URL(e),n=new URLSearchParams(r.hash.startsWith("#")?r.hash.slice(1):r.hash),o=n.get("heimdall_status");if(!o)return;if(n.get("heimdall_handoff_kind")!=="browser_completion"||n.get("heimdall_app_slug")!==t)return{status:"error",message:"Heimdall returned an authentication result for another application or handoff mode."};if(o!=="success")return{status:"error",message:n.get("heimdall_error_description")||n.get("heimdall_error")||"Heimdall authentication failed."};const i=n.get("heimdall_attempt_id")||"",s=n.get("heimdall_completion_code")||"";return!i||!s||i!==s?{status:"error",message:"Heimdall returned a malformed authentication completion witness."}:{status:"success",handle:s}}function qu(){history.replaceState(null,"",`${window.location.pathname}${window.location.search}`)}function xu(e){return e&&typeof e=="object"&&!Array.isArray(e)?e:{}}class Lu{provider;sourceVersion=0;authenticatedSurface=!1;async providerAdvertisement(){return this.provider=await Tr("api/eve/provider"),this.provider}async surface(t){const r=t.surfaceId||"ghostlight.play",n=sessionStorage.getItem("ghostlight.pendingInvite"),o=n?`?invite=${encodeURIComponent(n)}`:"",i=await Tr(`api/eve/surfaces/${encodeURIComponent(r)}${o}`);return this.sourceVersion=Math.max(0,Math.trunc(i.version||0)),this.authenticatedSurface=!Ur(i),i}hasAuthenticatedSurface(){return this.authenticatedSurface}async submitCommand(t){const r=await Tr("api/eve/commands",{method:"POST",headers:{"content-type":"application/json"},body:JSON.stringify(t)});return t.operation.operationId==="session_zero.join"&&r.receipt?.state==="accepted"&&sessionStorage.removeItem("ghostlight.pendingInvite"),r}async completeAuthentication(t){return this.provider||await this.providerAdvertisement(),await this.submitCommand({schema:"gamecult.eve.command_invocation.v1",providerId:this.provider?.providerId||"gamecult.ghostlight.dungeon",surfaceId:"ghostlight.play",operation:{operationId:"heimdall.auth.complete",schemaId:"heimdall.auth_complete_command.v1",idempotencyKey:crypto.randomUUID(),routeHint:{sourceVersion:this.sourceVersion}},payload:{handle:t},issuedAt:new Date().toISOString(),clientId:"ghostlight.browser",commandBoundary:"ghostlight.eve.commands",receiptSchema:"gamecult.eve.command_result.v1"})}}const Ki=new URL(window.location.href).searchParams.get("invite");Ki&&(sessionStorage.setItem("ghostlight.pendingInvite",Ki),history.replaceState(null,"",`${window.location.pathname}${window.location.hash}`));async function Tr(e,t){const r=await fetch(e,{cache:"no-store",credentials:"same-origin",...t}),n=await r.json().catch(()=>{});if(!r.ok){const o=n&&typeof n.message=="string"?n.message:`Ghostlight refused the request (${r.status}).`;throw new Error(o)}return n}function Ur(e){if(!e||typeof e!="object")return!1;if(Array.isArray(e))return e.some(Ur);const t=e;return t.kind==="heimdall.access_gate"?(t.props&&typeof t.props=="object"&&!Array.isArray(t.props)?t.props:{}).state==="anonymous":Object.values(t).some(Ur)}function va(e){const t=document.getElementById(e);if(!(t instanceof HTMLElement))throw new Error(`Missing browser host #${e}.`);return t}const Du=va("surface"),Jr=va("status"),Qr=new Lu,Zr=new Uc(Du,Qr,{body:document.body,clientId:"ghostlight.browser",pollMs:0,requestedSurfaceId:"ghostlight.play",source:"Ghostlight",statusElement:Jr,pluginAdapters:[Fr]});window.addEventListener("unhandledrejection",e=>{e.preventDefault(),Jr.textContent=e.reason instanceof Error?e.reason.message:String(e.reason)});await Zr.start();await Ou({complete:async e=>{const t=await Qr.completeAuthentication(e);t.pluginPayload?.pluginId===Fr.pluginId&&await Fr.consumeCommandResult?.(t.pluginPayload),await Zr.refresh()}},{appSlug:"ghostlight"});if(Qr.hasAuthenticatedSurface()){const e=new EventSource("api/eve/events");e.addEventListener("revision",()=>{Zr.refresh()}),e.addEventListener("error",()=>{Jr.textContent="Live revision notices are unavailable; your authoritative surface remains safe to refresh."})} + `}function mu(e,t=document.body){const r=ga(e),n=document.documentElement.style;Eu(r.assets.fontCss);for(const[u,a]of Object.entries(Vc))n.setProperty(u,a);const o={colorBackground:"--bg",colorBackgroundTop:"--bg-top",colorBackgroundMid:"--bg-mid",colorBackgroundBottom:"--bg-bottom",colorShellSurfaceTop:"--shell-top",colorShellSurfaceBottom:"--shell-bottom",colorPanel:"--panel",colorPanelAlt:"--panel-2",colorPanelBorder:"--line",colorPanelBorderDeep:"--line-deep",colorText:"--text",colorTextBright:"--text-bright",colorMuted:"--quiet",colorAccent:"--accent",colorAccentStrong:"--accent-strong",colorCornerAccent:"--corner-accent",colorLink:"--cyan",colorShadow:"--shadow",colorPixelGrid:"--pixel-grid"};for(const[u,a]of Object.entries(o)){const f=r.tokens[u];f!==void 0&&n.setProperty(a,String(f))}const i=r.tokens.fontBody,s=r.tokens.fontDisplay,c=r.tokens.fontTitle,l=r.tokens.fontMono;i&&n.setProperty("--font-body",ir(String(i))),s&&n.setProperty("--font-title",ir(String(s))),c&&n.setProperty("--font-title",ir(String(c))),l&&n.setProperty("--font-mono",ir(String(l))),r.tokens.borderWidthPx&&n.setProperty("--border-width",`${r.tokens.borderWidthPx}px`),r.tokens.borderBottomWidthPx&&n.setProperty("--border-bottom-width",`${r.tokens.borderBottomWidthPx}px`),r.tokens.cornerAccentPx&&n.setProperty("--corner-accent-size",`${r.tokens.cornerAccentPx}px`),t.dataset.pixelArt=r.tokens.pixelArt||r.tokens.imageRendering==="pixelated"?"true":"false",t.dataset.scanlines=r.tokens.scanlineOverlay?"true":"false"}function Be(e,t={},r={}){const n=Q(t.action),o=Ke(r)?.surface,i=r.provider?.providerId||o?.providerId||"surface unknown",s=r.activeSurfaceId||o?.surface?.id||r.provider?.surfaces?.[0]?.surfaceId||i,c=gu(r,s),l=q(c.commandBoundary,t.commandBoundary,n.commandBoundary,n.target),u=q(c.receiptSchema,t.receiptSchema,n.receiptSchema);if(!l||!u)throw new Error(`Eve surface ${s} cannot invoke commands without an advertised command boundary and receipt schema.`);const a=e||K(n.type,"invoke"),f=o?.commands?.find(g=>g.command===a),m=[...new Set([...cr(f?.captureBindings),...cr(n.captureBindings),...cr(t.captureBindings)])],y=pu(o?.surface?.root,i,s,m,r.draftStore),$=hu(n);return m.length&&($.bindings=y),{schema:"gamecult.eve.command_invocation.v1",providerId:i,surfaceId:s,operation:{operationId:a,schemaId:q(f?.payloadSchema,n.schemaId,t.payloadSchema,"gamecult.eve.operation_payload.v1"),idempotencyKey:yu(),routeHint:{sourceVersion:Math.max(0,Math.trunc(o?.version??0)),...q(f?.transport,t.transport,n.transport)?{transport:q(f?.transport,t.transport,n.transport)}:{}}},payload:$,issuedAt:new Date().toISOString(),clientId:r.clientId||"eve.browser",commandBoundary:l,receiptSchema:u}}function pu(e,t,r,n,o){const i={};for(const s of n){if(o?.has(t,r,s)){i[s]=o.get(t,r,s);continue}const c=ya(e,s);c.found&&(i[s]=c.value)}return i}function ya(e,t){if(!e)return{found:!1};const r=Q(e.props),n=(e.stateBindings||[]).find(i=>q(i.bindingName,i.pointerId)===t);if(q(n?.bindingName,r.bind,n?.pointerId,e.id)===t){const i=q(n?.targetProp,"value");if(Object.prototype.hasOwnProperty.call(r,i))return{found:!0,value:r[i]}}for(const i of e.children||[]){const s=ya(i,t);if(s.found)return s}return{found:!1}}function hu(e){const t={...e};for(const r of["command","commandBoundary","receiptSchema","schemaId","captureBindings","transport"])delete t[r];return t}function yu(){if(typeof globalThis.crypto?.randomUUID=="function")return globalThis.crypto.randomUUID();const e=new Uint8Array(16);if(globalThis.crypto?.getRandomValues?.(e),!e.some(Boolean))for(let t=0;tt.toString(16).padStart(2,"0")).join("")}function gu(e,t){const r=[...e.provider?.surfaces||[],...e.provider?.localAdvertisement?.surfaces||[]];return r.find(n=>n.surfaceId===t&&n.worldInteraction)?.worldInteraction||r.find(n=>n.worldInteraction)?.worldInteraction||{}}function Fr(e,t){const r=Q(e.action);return K(e.command,K(e.commandId,K(r.command,K(r.target,K(r.type,t?.commandId||"")))))}function Le(e){const t=T("section","pane");return t.append(T("h2","","No Surface")),t.append(T("div","detail",e)),t}function Vi(e,t,r,n,o){e.dataset.commandId=r,e.tabIndex=e instanceof HTMLButtonElement?e.tabIndex:0;const i=()=>{const s=Be(r,n,o);o.commandSink?.(s,t)};e.addEventListener("click",i),e.addEventListener("keydown",s=>{(s.key==="Enter"||s.key===" ")&&(s.preventDefault(),i())})}function vr(e,t,r){const n=(e.stateBindings||[]).find(a=>a.targetProp==="value")??e.stateBindings?.[0],o=Ke(r)?.surface,i=r.provider?.providerId||o?.providerId||"surface unknown",s=r.activeSurfaceId||o?.surface?.id||i,c=q(n?.bindingName,t.bind,n?.pointerId,e.id),l=c&&r.draftStore?.has(i,s,c)?r.draftStore.get(i,s,c):void 0,u=n?.accessMode||(n?"read":"local-draft");return{binding:n,bindingName:c,providerId:i,surfaceId:s,value:l??t.value??"",disabled:je(t.disabled)||u==="read"}}function ot(e,t,r){e.bindingName&&r.draftStore?.set(e.providerId,e.surfaceId,e.bindingName,t)}function Jr(e,t,r,n){const o=e.binding,i=o?.writeCommand;!o||!i||!e.bindingName||n.commandSink?.(Be(i,{action:{bindingName:e.bindingName,documentId:o.documentId,fieldPath:o.fieldPath,value:t}},n),r)}function vu(e,t,r,n,o,i){const s=vr(e,r,i),c=T("label","field cultui-field cultui-editable");te(c,e),at(c,r),re(c,n,o);const l=K(r.label,"");l&&c.append(T("span","field-label",l));const u=T(t==="control.input.textarea"?"textarea":"input","field-control cultui-field-input");u instanceof HTMLInputElement?(u.type=t.includes("number")||t==="control.range"?"number":"text",r.min!==void 0&&(u.min=String(r.min)),r.max!==void 0&&(u.max=String(r.max)),r.step!==void 0&&(u.step=String(r.step))):r.rows!==void 0&&(u.rows=_e(r.rows,3)),u.value=String(s.value??""),u.disabled=s.disabled,u.name=s.bindingName,u.dataset.bindingName=s.bindingName,u.setAttribute("aria-label",l||s.bindingName||e.id||"Input"),r.placeholder!==void 0&&u.setAttribute("placeholder",String(r.placeholder)),je(r.required)&&(u.required=!0),u.addEventListener("input",()=>{const f=u instanceof HTMLInputElement&&u.type==="number"?u.value===""?"":Number(u.value):u.value;ot(s,f,i)}),u.addEventListener("change",()=>{const f=u instanceof HTMLInputElement&&u.type==="number"?u.value===""?"":Number(u.value):u.value;Jr(s,f,e,i)}),c.append(u);const a=q(r.validationMessage,r.error,"");if(a){const f=T("span","cultui-field-validation",a);f.setAttribute("role","alert"),c.append(f),u.setAttribute("aria-invalid","true")}return c}function bu(e,t,r,n,o,i){const s=vr(e,t,i),c=T("fieldset","field cultui-field cultui-choice-group");te(c,e),re(c,n,o);const l=q(t.label,e.text,s.bindingName);l&&c.append(T("legend","field-label",l));for(const u of r){const a=Q(u.props),f=q(a.value,u.id),m=T("label","cultui-choice"),y=T("input");y.type=je(t.multiple)?"checkbox":"radio",y.name=s.bindingName,y.value=f,y.disabled=s.disabled||je(a.disabled),y.checked=y.type==="checkbox"?cr(s.value).includes(f):String(s.value)===f,y.addEventListener("change",()=>{const $=y.type==="checkbox"?[...c.querySelectorAll("input:checked")].map(S=>S.value):f;ot(s,$,i),Jr(s,$,e,i)}),m.append(y,document.createTextNode(q(a.label,u.text,f))),c.append(m)}return c}function _u(e,t,r,n,o,i){const s=vr(e,{...t,bind:t.bind||`${e.id||"tabs"}.selected`},i),c=T("section","cultui-tabs");te(c,e),re(c,n,o);const l=T("div","cultui-tab-list");l.setAttribute("role","tablist");const u=T("div","cultui-tab-panels"),a=q(s.value,Q(r[0]?.props).value,r[0]?.id),f=m=>{ot(s,m,i);for(const y of l.querySelectorAll("[role=tab]")){const $=y.dataset.value===m;y.setAttribute("aria-selected",String($)),y.tabIndex=$?0:-1}for(const y of u.querySelectorAll("[role=tabpanel]"))y.hidden=y.dataset.value!==m};for(const[m,y]of r.entries()){const $=Q(y.props),S=q($.value,y.id,String(m)),g=T("button","cultui-tab",q($.label,y.text,S));g.type="button",g.dataset.value=S,g.setAttribute("role","tab"),g.addEventListener("click",()=>f(S)),l.append(g);const _=T("section","cultui-tab-panel");_.dataset.value=S,_.setAttribute("role","tabpanel");for(const p of y.children||[])_.append(de(p,i));u.append(_)}return c.append(l,u),f(a),c}function $u(e,t,r,n,o,i){const s=vr(e,t,i),c=T("label","field cultui-field cultui-select");te(c,e),at(c,t),re(c,n,o);const l=K(t.label,"");l&&c.append(T("span","field-label",l));const u=T("select","field-control cultui-field-select");u.setAttribute("aria-label",l||e.id||"Select");for(const f of r){if(f.kind!=="control.option"&&f.kind!=="input.option"&&f.kind!=="option")continue;const m=Q(f.props),y=document.createElement("option");y.value=K(m.value,f.id||""),y.textContent=K(m.label,K(m.text,y.value)),y.disabled=je(m.disabled)||m.enabled!==void 0&&!je(m.enabled),u.append(y)}u.value=String(s.value??""),u.name=s.bindingName,u.dataset.bindingName=s.bindingName,u.disabled=s.disabled||t.enabled!==void 0&&!je(t.enabled);const a=Fr(t,e);return a?(u.dataset.commandId=a,u.addEventListener("change",()=>{ot(s,u.value,i);const f=Be(a,{...t,action:{...Q(t.action),value:u.value}},i);i.commandSink?.(f,e)})):u.addEventListener("change",()=>{ot(s,u.value,i),Jr(s,u.value,e,i)}),c.append(u),c}function wu(e,t,r){const n=Su(e,t,r),o=Q(n.find(m=>m.kind==="control.box")?.props),i=n.filter(m=>m.kind==="control.part"),s=Number(e.min??0),c=Number(e.max??1),l=T("div","cultui-slider");l.dataset.skin=K(e.skin,"default"),l.dataset.bind=K(e.bind,""),Iu(l,o);const u=T("div","cultui-slider-visual"),a=T("input","cultui-slider-input");a.type="range",a.min=String(s),a.max=String(c),a.step=String(e.step??.01),a.setAttribute("aria-label",K(e.bind,"slider"));for(const m of i){const y=Q(m.props),$=T("span",`cultui-slider-part ${K(y.name,"part")}`);Ru($,y),u.append($)}return i.some(m=>Q(m.props).name==="track")||u.append(T("span","cultui-slider-part track")),i.some(m=>Q(m.props).name==="fill")||u.append(T("span","cultui-slider-part fill")),i.some(m=>Q(m.props).name==="thumb")||u.append(T("span","cultui-slider-part thumb")),l.append(u,a),(m=>{const y=Number(m??s),$=Math.max(s,Math.min(c,Number.isFinite(y)?y:s)),S=c===s?0:($-s)/(c-s)*100;a.value=String($),l.style.setProperty("--cultui-slider-value",`${S}%`),l.dataset.value=String($)})(e.value??s),a.addEventListener("input",()=>{const m=Be(K(e.command,"control.slider.input"),{...e,action:{...Q(e.action),value:Number(a.value)},value:Number(a.value)},r);r.commandSink?.(m,{kind:"control.slider",props:e})}),l}function Su(e,t,r){const n=typeof e.skin=="string"?e.skin:"",i=[...n?Ke(r)?.styles.controlSkins[n]?.children||[]:[],...t];return i.length?i:[{kind:"control.box",props:{height:18,overflow:"visible"}},{kind:"control.part",props:{name:"track",anchor:"center",size:["100%",6],radius:2,fill:"color.panelInset"}},{kind:"control.part",props:{name:"fill",anchor:["left","center"],size:["value%",6],radius:2,fill:"color.accent"}},{kind:"control.part",props:{name:"thumb",anchor:["value","center"],size:[12,12],bleed:3,radius:999,fill:"color.accent"}}]}function ga(e){if(Array.isArray(e)){const t={},r={};for(const n of e)n?.name&&(n.name==="font.web.google"&&typeof n.value=="string"?r.fontCss=n.value:t[n.name]=n.value);return{tokens:t,assets:r,controlSkins:{}}}return{tokens:Q(e?.tokens),assets:Q(e?.assets),controlSkins:Q(e?.controlSkins)}}function it(e,t){if(!e)return"";const r=Ke(t)?.surface,n=t.assetUrlResolver;return n?n(e,r):/^(https?:|data:|blob:)/i.test(e)?e:t.assetBaseUrl&&e.startsWith("/")?`${t.assetBaseUrl.replace(/\/+$/,"")}${e}`:e}function Eu(e){const t=typeof e=="string"?e.trim():"";if(!t||Oi.has(t))return;const r=document.createElement("link");r.rel="preconnect",r.href="https://fonts.gstatic.com",r.crossOrigin="anonymous",document.head.append(r);const n=document.createElement("link");n.rel="stylesheet",n.href=t,n.dataset.href=t,document.head.append(n),Oi.set(t,n)}function Pu(e,t,r){const n=[];return(e==="text.title"||t.role==="title")&&n.push("cultui-title","eve-text-title"),e==="text.subtitle"&&n.push("eve-text-subtitle"),e==="label"&&n.push("cultui-label"),t.role==="mono"&&n.push("detail","mono"),n.length===0&&n.push("detail","eve-text"),n.join(" ")}function Iu(e,t){t.height!==void 0&&(e.style.minHeight=ce(t.height)),t.width!==void 0&&(e.style.width=ce(t.width)),typeof t.overflow=="string"&&(e.style.overflow=t.overflow)}function Ru(e,t){const r=Array.isArray(t.size)?t.size:[t.size,void 0];r[0]!==void 0&&r[0]!=="value%"&&(e.style.width=ce(r[0])),r[1]!==void 0&&(e.style.height=ce(r[1])),t.radius!==void 0&&(e.style.borderRadius=ce(t.radius)),t.fill!==void 0&&(e.style.background=sr(String(t.fill))),t.bleed!==void 0&&e.style.setProperty("--part-bleed",ce(t.bleed)),(Array.isArray(t.anchor)?t.anchor:[t.anchor]).includes("value")&&(e.dataset.anchorValue="true")}function at(e,t){t.gap!==void 0&&(e.style.gap=ce(t.gap)),t.padding!==void 0&&(e.style.padding=ce(t.padding)),t.size!==void 0&&(e.style.flex=Au(t.size)),t.min!==void 0&&(e.style.minWidth=ce(t.min)),t.max!==void 0&&(e.style.maxWidth=ce(t.max)),t.align!==void 0&&(e.style.alignItems=t.align==="end"?"flex-end":String(t.align)),(t.clip==="true"||t.clip===!0)&&(e.style.overflow="hidden"),t.scroll==="y"&&(e.style.overflowY="auto"),t.scroll==="x"&&(e.style.overflowX="auto")}function Au(e){return typeof e=="string"&&e.endsWith("fr")?`${Number(e.slice(0,-2))||1} 1 0`:e==="auto"||e==="content"?"0 0 auto":`0 0 ${ce(e)}`}function ce(e){return Array.isArray(e)?e.map(ce).join(" "):typeof e=="number"?`${e}px`:typeof e=="string"&&/^-?\d+(\.\d+)?$/.test(e)?`${e}px`:String(e??"")}function sr(e){return{"color.accent":"var(--accent)","color.panelInset":"rgba(0, 0, 0, 0.34)","color.panel":"var(--panel)","color.text":"var(--text)"}[e]||e}function ir(e){return e.includes("Zen Kaku Gothic New")||e.includes("M PLUS 1")?e:e.includes("Montserrat")?`${e}, "Zen Kaku Gothic New", "M PLUS 1", "Noto Sans JP", "Hiragino Sans", "Yu Gothic", sans-serif`:e.includes("Ubuntu")?`${e}, "M PLUS 1", "Noto Sans JP", "Hiragino Sans", "Yu Gothic", sans-serif`:`${e}, "Noto Sans JP", "Hiragino Sans", "Yu Gothic", sans-serif`}function te(e,t){t.id&&(e.id=t.id),t.id&&(e.dataset.eveNodeId=t.id),t.kind&&(e.dataset.eveKind=t.kind)}function Q(e){return e&&typeof e=="object"&&!Array.isArray(e)?e:{}}function ku(e){return Array.isArray(e)?e:[]}function Cu(e){return ku(e).map((t,r)=>la({kind:"list.item",props:Q(t)}))}function K(e,t){return e==null?t:String(e)}function cr(e){return Array.isArray(e)?e.map(t=>String(t).trim()).filter(Boolean):typeof e=="string"?e.split(",").map(t=>t.trim()).filter(Boolean):[]}function q(...e){for(const t of e){if(typeof t=="string"&&t.trim())return t;if(typeof t=="number"&&Number.isFinite(t))return String(t)}return""}function je(e){return typeof e=="boolean"?e:typeof e=="number"?e!==0:typeof e=="string"?["1","true","yes","on"].includes(e.trim().toLowerCase()):!1}function _e(e,t){const r=Number(e);return Number.isFinite(r)?Math.max(0,Math.floor(r)):t}function Nu(e){const t=e.toLowerCase();return t.includes("sensor")?"S":t.includes("thermal")?"T":t.includes("fuel")?"F":t.includes("cargo")?"C":t.includes("weapon")?"W":e.trim().slice(0,1).toUpperCase()||"?"}function ju(e){const t=e.trim().split(/\s+/).filter(Boolean);return t.length&&t.slice(0,2).map(r=>r[0]?.toUpperCase()||"").join("")||"?"}function Ki(e){const t=Number(e);return Number.isFinite(t)?Math.max(0,Math.min(100,t)):0}function T(e,t="",r=""){const n=document.createElement(e);return t&&(n.className=t),r&&(n.textContent=r),n}const Ze="gamecult.heimdall.access.attempt";function Tu(e){const t=new Set(e.advertisedOrigins.map(r=>new URL(r).origin));return{pluginId:"gamecult.heimdall.access",capabilities:["auth.gate","auth.begin","auth.complete","auth.logout"],componentKinds:["heimdall.access_gate","heimdall.identity","heimdall.access_status"],schemas:["heimdall.access_gate_state.v1"],normalizeDocument(r,n){return n},renderComponent(r,n){const o=document.createElement("section");o.className=`heimdall-access heimdall-access-${String(n.state||"unknown")}`,r.id&&(o.id=r.id),o.setAttribute("role","status"),o.setAttribute("aria-live","polite");const i=document.createElement("h2");i.textContent=String(n.title||"Access");const s=document.createElement("p");s.textContent=String(n.detail||""),o.append(i,s);const c=String(n.displayName||"");if(c){const l=document.createElement("p");l.className="heimdall-identity",l.textContent=c,o.append(l)}return o},async consumeCommandResult(r){if(r.schemaId==="heimdall.auth_navigation_receipt.v1"){const n=String(r.payload.handle||""),o=xu(r.payload.navigation),i=new URL(String(o.url||"")),s=Array.isArray(o.allowedOrigins)?o.allowedOrigins.filter(c=>typeof c=="string"):[];if(!n||i.protocol!=="https:"||!t.has(i.origin)||!s.includes(i.origin))throw new Error("Heimdall returned an unsafe authentication navigation receipt.");sessionStorage.setItem(Ze,n),window.location.assign(i.toString());return}if(r.schemaId==="heimdall.auth_completion_status.v1"){const n=String(r.payload.status||"");(n==="authenticated"||n==="denied"||n==="expired")&&sessionStorage.removeItem(Ze)}}}}const Ur=Tu({advertisedOrigins:["https://discord.com","https://heimdall.gamecult.org"]});async function Ou(e,t){const r=Mu(window.location.href,t.appSlug),n=sessionStorage.getItem(Ze);if(r){if(qu(),r.status==="error")throw sessionStorage.removeItem(Ze),new Error(r.message);if(n&&n!==r.handle)throw sessionStorage.removeItem(Ze),new Error("Heimdall returned an authentication attempt other than the one this browser started.");sessionStorage.setItem(Ze,r.handle)}const o=r?.status==="success"?r.handle:n;return o?(await e.complete(o),!0):!1}function Mu(e,t){const r=new URL(e),n=new URLSearchParams(r.hash.startsWith("#")?r.hash.slice(1):r.hash),o=n.get("heimdall_status");if(!o)return;if(n.get("heimdall_handoff_kind")!=="browser_completion"||n.get("heimdall_app_slug")!==t)return{status:"error",message:"Heimdall returned an authentication result for another application or handoff mode."};if(o!=="success")return{status:"error",message:n.get("heimdall_error_description")||n.get("heimdall_error")||"Heimdall authentication failed."};const i=n.get("heimdall_attempt_id")||"",s=n.get("heimdall_completion_code")||"";return!i||!s||i!==s?{status:"error",message:"Heimdall returned a malformed authentication completion witness."}:{status:"success",handle:s}}function qu(){history.replaceState(null,"",`${window.location.pathname}${window.location.search}`)}function xu(e){return e&&typeof e=="object"&&!Array.isArray(e)?e:{}}class Lu{provider;sourceVersion=0;authenticatedSurface=!1;async providerAdvertisement(){return this.provider=await Or("api/eve/provider"),this.provider}async surface(t){const r=t.surfaceId||"ghostlight.play",n=sessionStorage.getItem("ghostlight.pendingInvite"),o=n?`?invite=${encodeURIComponent(n)}`:"",i=await Or(`api/eve/surfaces/${encodeURIComponent(r)}${o}`);return this.sourceVersion=Math.max(0,Math.trunc(i.version||0)),this.authenticatedSurface=!zr(i),i}hasAuthenticatedSurface(){return this.authenticatedSurface}async submitCommand(t){const r=await Or("api/eve/commands",{method:"POST",headers:{"content-type":"application/json"},body:JSON.stringify(t)});return t.operation.operationId==="session_zero.join"&&r.receipt?.state==="accepted"&&sessionStorage.removeItem("ghostlight.pendingInvite"),r}async completeAuthentication(t){return this.provider||await this.providerAdvertisement(),await this.submitCommand({schema:"gamecult.eve.command_invocation.v1",providerId:this.provider?.providerId||"gamecult.ghostlight.dungeon",surfaceId:"ghostlight.play",operation:{operationId:"heimdall.auth.complete",schemaId:"heimdall.auth_complete_command.v1",idempotencyKey:crypto.randomUUID(),routeHint:{sourceVersion:this.sourceVersion}},payload:{handle:t},issuedAt:new Date().toISOString(),clientId:"ghostlight.browser",commandBoundary:"ghostlight.eve.commands",receiptSchema:"gamecult.eve.command_result.v1"})}}const Bi=new URL(window.location.href).searchParams.get("invite");Bi&&(sessionStorage.setItem("ghostlight.pendingInvite",Bi),history.replaceState(null,"",`${window.location.pathname}${window.location.hash}`));async function Or(e,t){const r=await fetch(e,{cache:"no-store",credentials:"same-origin",...t}),n=await r.json().catch(()=>{});if(!r.ok){const o=n&&typeof n.message=="string"?n.message:`Ghostlight refused the request (${r.status}).`;throw new Error(o)}return n}function zr(e){if(!e||typeof e!="object")return!1;if(Array.isArray(e))return e.some(zr);const t=e;return t.kind==="heimdall.access_gate"?(t.props&&typeof t.props=="object"&&!Array.isArray(t.props)?t.props:{}).state==="anonymous":Object.values(t).some(zr)}function va(e){const t=document.getElementById(e);if(!(t instanceof HTMLElement))throw new Error(`Missing browser host #${e}.`);return t}const Du=va("surface"),Qr=va("status"),Zr=new Lu,en=new Uc(Du,Zr,{body:document.body,clientId:"ghostlight.browser",pollMs:0,requestedSurfaceId:"ghostlight.play",source:"Ghostlight",statusElement:Qr,pluginAdapters:[Ur]});window.addEventListener("unhandledrejection",e=>{e.preventDefault(),Qr.textContent=e.reason instanceof Error?e.reason.message:String(e.reason)});await en.start();await Ou({complete:async e=>{const t=await Zr.completeAuthentication(e);t.pluginPayload?.pluginId===Ur.pluginId&&await Ur.consumeCommandResult?.(t.pluginPayload),await en.refresh()}},{appSlug:"ghostlight"});if(Zr.hasAuthenticatedSurface()){const e=new EventSource("api/eve/events");e.addEventListener("revision",()=>{en.refresh()}),e.addEventListener("error",()=>{Qr.textContent="Live revision notices are unavailable; your authoritative surface remains safe to refresh."})} diff --git a/web/dist/index.html b/web/dist/index.html index 75e37e5..dec3529 100644 --- a/web/dist/index.html +++ b/web/dist/index.html @@ -4,7 +4,7 @@ Ghostlight Dungeon - +