@auersperg/flare 0.3.2 → 0.3.5
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +10 -4
- package/dist/cli/{chunk-x14smx1y.js → chunk-5s6zv1h9.js} +1 -1
- package/dist/cli/{chunk-5cq8wgte.js → chunk-5yg1zj5n.js} +48 -29
- package/dist/cli/{chunk-786w6vrj.js → chunk-fv98dfg5.js} +21 -1
- package/dist/cli/chunk-r3ceakrn.js +1366 -0
- package/dist/cli/flare.js +122 -4
- package/dist/platform/admin.js +790 -0
- package/dist/platform/dashboard/_astro/auth-view.UTGGCEHc.js +1 -0
- package/dist/platform/dashboard/_astro/cli-approval.BZAWmpiR.js +1 -0
- package/dist/platform/dashboard/_astro/client.BUUZgEFj.js +1 -0
- package/dist/platform/dashboard/_astro/client.Bcl1NrNO.js +1 -0
- package/dist/platform/dashboard/_astro/client.BeKNsjPN.js +9 -0
- package/dist/platform/dashboard/_astro/common.DPoFQu44.js +1 -0
- package/dist/platform/dashboard/_astro/data-view.BgYyTCMN.js +1 -0
- package/dist/platform/dashboard/_astro/functions-view.PUkng3T1.js +1 -0
- package/dist/platform/dashboard/_astro/geist-cyrillic-ext-wght-normal.DjL33-gN.woff2 +0 -0
- package/dist/platform/dashboard/_astro/geist-cyrillic-wght-normal.BEAKL7Jp.woff2 +0 -0
- package/dist/platform/dashboard/_astro/geist-latin-ext-wght-normal.DC-KSUi6.woff2 +0 -0
- package/dist/platform/dashboard/_astro/geist-latin-wght-normal.BgDaEnEv.woff2 +0 -0
- package/dist/platform/dashboard/_astro/geist-vietnamese-wght-normal.6IgcOCM7.woff2 +0 -0
- package/dist/platform/dashboard/_astro/index.astro_astro_type_script_index_0_lang.BEuO3H0E.js +4 -0
- package/dist/platform/dashboard/_astro/index.lobU7uK5.css +2 -0
- package/dist/platform/dashboard/_astro/input-group.CJxPRHej.js +1 -0
- package/dist/platform/dashboard/_astro/sdk-view.COmbEZrF.js +1 -0
- package/dist/platform/dashboard/_astro/services-view.C34dy0dk.js +1 -0
- package/dist/platform/dashboard/_astro/settings-view.IuD2r5JW.js +3 -0
- package/dist/platform/dashboard/_headers +3 -0
- package/dist/platform/dashboard/bootstrap/action.js +263 -0
- package/dist/platform/dashboard/bootstrap/api.ts +5 -0
- package/dist/platform/dashboard/bootstrap/facet.js +914 -0
- package/dist/platform/dashboard/bootstrap/manifest.json +5 -0
- package/dist/platform/dashboard/bootstrap/openapi.json +18 -0
- package/dist/platform/dashboard/bootstrap/release.json +11 -0
- package/dist/platform/dashboard/bootstrap/schema.json +1 -0
- package/dist/platform/dashboard/index.html +1 -0
- package/dist/platform/manifest.json +195 -0
- package/dist/platform/migrations/0001.sql +8 -0
- package/dist/platform/migrations/0002_project_aliases.sql +6 -0
- package/dist/platform/migrations/0003_cli_login.sql +9 -0
- package/dist/platform/migrations/0004_retention.sql +4 -0
- package/dist/platform/migrations/0005_project_deletion.sql +11 -0
- package/dist/platform/migrations/0006_platform_installation.sql +8 -0
- package/dist/platform/runtime.js +9392 -0
- package/dist/sdk/client.js +10 -2
- package/package.json +1 -1
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import{a as e,r as t}from"./client.BeKNsjPN.js";import{S as n,_ as r,a as i,b as a,f as o,g as s,gt as c,ht as l,n as u,p as d,s as f,u as p,v as m,x as h,y as g}from"./common.DPoFQu44.js";import{s as _}from"./index.astro_astro_type_script_index_0_lang.BEuO3H0E.js";var v=e(t(),1),y=c();function b(e){let t=s(e.project,e.env),[c,b]=(0,v.useState)(``),[x,S]=(0,v.useState)(),C=p(t+`/auth-users`+(c?`?cursor=`+encodeURIComponent(c):``)),w=p(t+`/auth-settings`),T=e.session.role===`owner`,E=(n,r,i,a=[])=>{S({title:r,description:`Passwords are never displayed. Changes revoke existing sessions.`,productionId:e.env===`prod`?e.project.id:void 0,fields:a,submit:async r=>{try{await d(t+`/`+n,{...i,...o(a,e=>new FormData(r).get(e)),confirm:e.project.id})}catch(e){throw e instanceof Error&&e.message===`INVALID_PASSWORD`?Error(`Password must contain 6–128 characters. Spaces are allowed; the password is not trimmed.`):e instanceof Error&&e.message===`REGISTRATION_UNAVAILABLE`?Error(`This login is already registered. Choose another login or manage the existing user.`):e}C.refresh(),w.refresh()}})},D={name:`password`,type:`password`,required:!0,description:`6–128 characters.`};return(0,y.jsxs)(`div`,{className:`space-y-4 p-4`,children:[(0,y.jsx)(`h1`,{className:`page-title`,children:`Auth`}),(0,y.jsx)(f,{loading:C.loading||w.loading,error:C.error||w.error}),w.data&&(0,y.jsxs)(`div`,{className:`flex flex-wrap items-center gap-2`,children:[(0,y.jsx)(_,{status:w.data.enabled?`Enabled`:`Disabled`}),(0,y.jsx)(_,{status:w.data.registration?`Public registration`:`Registration closed`}),T&&(0,y.jsx)(l,{variant:`outline`,onClick:()=>E(`auth-configure`,`Configure authentication`,{},[{name:`enabled`,type:`boolean`,value:w.data.enabled},{name:`registration`,type:`boolean`,value:w.data.registration}]),children:`Configure`}),T&&(0,y.jsx)(l,{onClick:()=>E(`auth-create`,`Create user`,{},[{name:`login`,type:`string`,required:!0},D]),children:`Create user`})]}),C.data&&(0,y.jsxs)(y.Fragment,{children:[(0,y.jsxs)(r,{children:[(0,y.jsx)(h,{children:(0,y.jsxs)(n,{children:[(0,y.jsx)(a,{children:`Login`}),(0,y.jsx)(a,{children:`User ID`}),(0,y.jsx)(a,{children:`Status`}),(0,y.jsx)(a,{children:`Created`}),(0,y.jsx)(a,{children:`Actions`})]})}),(0,y.jsx)(m,{children:C.data.users.map(e=>(0,y.jsxs)(n,{children:[(0,y.jsx)(g,{children:e.login}),(0,y.jsx)(g,{children:(0,y.jsx)(`code`,{children:e.id})}),(0,y.jsx)(g,{children:(0,y.jsx)(_,{status:e.disabled?`Blocked`:`Active`})}),(0,y.jsx)(g,{children:new Date(e.createdAt).toLocaleString()}),(0,y.jsx)(g,{children:(0,y.jsx)(`div`,{className:`flex flex-wrap gap-2`,children:T&&(0,y.jsxs)(y.Fragment,{children:[(0,y.jsx)(l,{variant:`outline`,size:`sm`,onClick:()=>E(`auth-password`,`Change user password`,{id:e.id},[D]),children:`Change password`}),(0,y.jsx)(l,{variant:`outline`,size:`sm`,onClick:()=>E(`auth-revoke`,`Revoke all sessions`,{id:e.id}),children:`Revoke sessions`}),(0,y.jsx)(l,{variant:`outline`,size:`sm`,onClick:()=>E(`auth-disable`,e.disabled?`Unblock user`:`Block user`,{id:e.id,disabled:!e.disabled}),children:e.disabled?`Unblock`:`Block`})]})})})]},e.id))})]}),!C.data.users.length&&(0,y.jsx)(u,{title:`No users`}),(0,y.jsxs)(`div`,{className:`flex gap-2`,children:[(0,y.jsx)(l,{variant:`outline`,disabled:!c,onClick:()=>b(``),children:`First page`}),(0,y.jsx)(l,{variant:`outline`,disabled:!C.data.next,onClick:()=>b(C.data.next),children:`Next page`})]})]}),x&&(0,y.jsx)(i,{modal:x,onClose:()=>S(void 0)})]})}export{b as default};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import{a as e,r as t}from"./client.BeKNsjPN.js";import{M as n,Y as r,gt as i,ht as a,j as o,k as s,m as c,p as l,r as u,t as d}from"./common.DPoFQu44.js";var f=e(t(),1),p=i();function m(){let e=new URLSearchParams(location.search).get(`cli`)??``,[t,i]=(0,f.useState)(``),[m,h]=(0,f.useState)([]),[g,_]=(0,f.useState)(`new`),[v,y]=(0,f.useState)(``),[b,x]=(0,f.useState)(``),[S,C]=(0,f.useState)(!1),[w,T]=(0,f.useState)(!1);(0,f.useEffect)(()=>{let t=new AbortController;return Promise.all([l(`cli/approval?id=`+encodeURIComponent(e),void 0,t.signal),l(`projects`,void 0,t.signal)]).then(([e,t])=>{i(e.code),h(t),_(`new`)}).catch(e=>{t.signal.aborted||x(c(e))}),()=>t.abort()},[e]);async function E(){C(!0),x(``);try{let t=g;if(t===`new`){let e=await l(`projects`,{name:v,customer:`Applications`,origins:[]});t=e.id,h(t=>[...t,{id:e.id,name:v,customer:`Applications`}]),_(t)}await l(`cli/approval`,{id:e,project:t}),T(!0)}catch(e){x(c(e))}finally{C(!1)}}return(0,p.jsxs)(`main`,{className:`mx-auto max-w-lg p-8`,children:[(0,p.jsx)(`h1`,{className:`mb-4 text-xl font-semibold`,children:`Connect Flare CLI`}),w?(0,p.jsx)(`p`,{children:`Connected. Return to your terminal. You can close this tab.`}):(0,p.jsxs)(o,{children:[(0,p.jsx)(`p`,{children:`Approve only a login you just started. Compare this code with your terminal:`}),(0,p.jsx)(`strong`,{className:`text-2xl font-mono`,children:t||`Loading…`}),(0,p.jsx)(`p`,{children:`Grants this computer deployment access to the selected project, including production. The credential expires in 30 days and can be revoked in Settings.`}),(0,p.jsxs)(s,{children:[(0,p.jsx)(n,{children:`Project`}),(0,p.jsx)(d,{label:`CLI project`,value:g,onChange:_,items:[...m.map(e=>({value:e.id,label:e.name})),{value:`new`,label:`Create new project`}]})]}),g===`new`&&(0,p.jsxs)(s,{children:[(0,p.jsx)(n,{children:`New project name`}),(0,p.jsx)(r,{value:v,onChange:e=>y(e.target.value),maxLength:100})]}),b&&(0,p.jsx)(u,{children:b}),(0,p.jsx)(a,{disabled:S||!t||!g||g===`new`&&!v.trim(),onClick:E,children:`Approve connection`})]})]})}export{m as default};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
var e=Object.freeze({inputBytes:65536,outputBytes:262144,frameBytes:8192,subscriptions:64,fileBytes:10485760}),t=class extends Error{code;ambiguous;constructor(e,t,n=!1){super(t),this.code=e,this.ambiguous=n,this.name=`FlareError`}};function n(e){if(e.length>256||!/^[A-Za-z][A-Za-z0-9_]*(\/[A-Za-z][A-Za-z0-9_]*)*$/.test(e)||e.split(`/`).some(e=>[`__proto__`,`prototype`,`constructor`].includes(e)))throw new t(`INVALID_PATH`,`Invalid function path`)}function r(e,t){return n(e),Object.freeze({path:e,kind:t})}function i(e){let n=new Set;function r(e,i){if(i>40)throw new t(`INVALID_JSON`,`JSON nesting limit exceeded`);if(e===null||typeof e==`string`||typeof e==`boolean`||typeof e==`number`&&Number.isFinite(e))return e;if(typeof e!=`object`||!e||n.has(e))throw new t(`INVALID_JSON`,`Expected lossless JSON`);if(!Array.isArray(e)&&Object.getPrototypeOf(e)!==Object.prototype&&Object.getPrototypeOf(e)!==null)throw new t(`INVALID_JSON`,`Expected plain JSON object`);if(Object.getOwnPropertySymbols(e).length)throw new t(`INVALID_JSON`,`Symbol keys are unsupported`);n.add(e);let a;if(Array.isArray(e))a=Array.from(e,e=>r(e,i+1));else{let n=Object.create(null);for(let a of Object.keys(e).sort()){let o=Object.getOwnPropertyDescriptor(e,a);if(!(`value`in o))throw new t(`INVALID_JSON`,`Getters are unsupported`);n[a]=r(o.value,i+1)}a=n}return n.delete(e),a}return JSON.stringify(r(e,0))}function a(e,n){let r=i(e);if(new TextEncoder().encode(r).byteLength>n)throw new t(`TOO_LARGE`,`JSON payload exceeds limit`);return r}function o(n){if(n.size>e.fileBytes)throw new t(`TOO_LARGE`,`Maximum file size: 10 MiB`);if(!n.name||n.name.length>120||/[\x00-\x1f\x7f/\\]/.test(n.name))throw new t(`INVALID_INPUT`,`File name must be 1–120 characters, without path separators`);return{name:n.name,size:n.size,type:[`text/plain`,`image/png`,`image/jpeg`,`image/webp`,`application/pdf`].includes(n.type)?n.type:`application/octet-stream`}}async function s(n,r,i={}){if(r.size>e.fileBytes)throw new t(`TOO_LARGE`,`Maximum file size: 10 MiB`);let a=new URL(n.url);if(a.username||a.password||a.protocol!==`https:`&&!(a.protocol===`http:`&&[`localhost`,`127.0.0.1`,`[::1]`].includes(a.hostname)))throw new t(`INVALID_URL`,`Expected secure upload URL`);let o;try{o=await(i.fetch??globalThis.fetch)(a.href,{method:`POST`,body:r,redirect:`error`,credentials:`omit`,signal:i.signal??AbortSignal.timeout(i.timeoutMs??12e4)})}catch{throw new t(`UPLOAD_UNKNOWN`,`Connection interrupted or upload timed out; refresh the file list before trying again`,!0)}let s=await o.json().catch(()=>null);if(!o.ok){let e=s&&typeof s==`object`&&`error`in s&&typeof s.error==`string`?s.error:`HTTP_${o.status}`;throw new t(e,`Upload failed: ${e}`,o.status>=500)}if(!s||typeof s!=`object`||!(`id`in s)||typeof s.id!=`string`)throw new t(`INVALID_RESPONSE`,`Upload outcome is unknown; refresh the file list before uploading again`,!0);return{id:s.id}}var c=new Set([`UNAUTHORIZED`,`AUTH_EXPIRED`,`FORBIDDEN`,`AUTH_DISABLED`,`HTTP_401`,`HTTP_403`]);function l(r){let o=new URL(r.url);if(!/^https?:$/.test(o.protocol)||o.username||o.password||o.search||o.hash)throw new t(`INVALID_URL`,`Expected backend HTTP URL`);if(o.protocol===`http:`&&![`localhost`,`127.0.0.1`,`[::1]`].includes(o.hostname))throw new t(`INVALID_URL`,`Remote backends require HTTPS`);o.pathname=o.pathname.replace(/\/$/,``);let s=r.fetch??globalThis.fetch;if(!s)throw new t(`TRANSPORT_UNAVAILABLE`,`Provide a fetch implementation`);let l=new Map,u=!1,d,f=!1,p=0,m=0,h=0,g,_=new Set,v=e=>`${o.href.replace(/\/$/,``)}${e}`,y=(e,t,n)=>{for(let r of e.observers)try{r[t]?.(t===`next`?JSON.parse(i(n)):n)}catch{}};function b(){if(u)throw new t(`DISPOSED`,`Client is disposed`)}async function x(n,i,o){b();let c=a(i,e.inputBytes),l;try{l=await r.getToken?.()??null}catch{throw new t(`AUTH_UNAVAILABLE`,`Cannot obtain access token`)}b();let u=new AbortController,d=setTimeout(()=>u.abort(),r.requestTimeoutMs??3e4);try{let r=await s(v(n),{method:`POST`,headers:{"Content-Type":`application/json`,...l?{Authorization:`Bearer ${l}`}:{}},body:c,signal:u.signal,redirect:`error`});if(!r.body)throw new t(`INVALID_RESPONSE`,`Missing response body`,o);let i=r.body.getReader(),d=0,f=[];try{for(;;){let{done:n,value:r}=await i.read();if(n)break;if(d+=r.byteLength,d>e.outputBytes)throw new t(`INVALID_RESPONSE`,`Response exceeds limit`,o);f.push(r)}}finally{await i.cancel().catch(()=>{})}let p=new Uint8Array(d),m=0;for(let e of f)p.set(e,m),m+=e.byteLength;let h;try{h=JSON.parse(new TextDecoder(`utf-8`,{fatal:!0}).decode(p))}catch(e){throw r.ok?e:new t(`HTTP_${r.status}`,`Backend request failed`,o&&r.status>=500)}if(!r.ok)throw new t(h&&typeof h==`object`&&`error`in h&&typeof h.error==`string`&&/^[A-Z][A-Z0-9_]{0,63}$/.test(h.error)?h.error:`HTTP_${r.status}`,`Backend request failed`,o&&r.status>=500);if(!h||typeof h!=`object`||!(`result`in h))throw new t(`INVALID_RESPONSE`,`Invalid protocol envelope`,o);return a(h.result,e.outputBytes),h.result}catch(e){throw e instanceof t?e:e instanceof SyntaxError?new t(`INVALID_RESPONSE`,`Invalid JSON response`,o):new t(`TRANSPORT_ERROR`,o?`Write outcome is unknown; do not replay automatically`:`Backend request interrupted`,o)}finally{clearTimeout(d)}}function S(t){d?.send(a(t,e.frameBytes))}function C(e){S({type:`subscribe`,id:e.id,path:e.ref.path,args:e.args})}function w(){if(u||!l.size||g)return;let e=Math.min(3e4,250*2**Math.min(p++,7));g=setTimeout(()=>{g=void 0,T()},e)}async function T(){if(u||f||d||!l.size)return;f=!0;let n=++m;try{let o=await x(`/v1/live/ticket`,{},!1);if(u||n!==m||!l.size)return;if(!o||typeof o.ticket!=`string`||o.ticket.length>1024)throw new t(`INVALID_RESPONSE`,`Invalid live ticket`);let s=new URL(v(`/v1/live`));s.protocol=s.protocol===`https:`?`wss:`:`ws:`,s.searchParams.set(`ticket`,o.ticket);let f=r.createWebSocket?r.createWebSocket(s.href):new globalThis.WebSocket(s.href);d=f;let h=()=>{if(!(d!==f||u)){p=0;for(let e of l.values())e.revision=-1,e.hasValue=!1,e.terminal||C(e)}},g=n=>{if(!(d!==f||u))try{if(typeof n.data!=`string`||new TextEncoder().encode(n.data).byteLength>e.outputBytes+1024)throw Error(`Invalid frame`);let r=JSON.parse(n.data);if(r.type===`ready`)return;let o=[...l.values()].find(e=>e.id===r.id);if(!o||o.terminal)return;if(r.type===`error`){o.terminal=!0,c.has(r.code)&&(o.hasValue=!1,o.value=void 0),y(o,`error`,new t(typeof r.code==`string`?r.code:`LIVE_ERROR`,`Live subscription failed`));return}if(r.type!==`snapshot`||!Number.isSafeInteger(r.revision)||r.revision<0||!(`result`in r))throw Error(`Invalid snapshot`);let s=a(r.result,e.outputBytes);if(r.revision>o.revision){let e=!o.hasValue||i(o.value)!==s;o.revision=r.revision,o.value=r.result,o.hasValue=!0,e&&y(o,`next`,o.value)}S({type:`ack`,id:o.id,revision:o.revision})}catch{f.close(1002,`Invalid protocol frame`)}},b=e=>{if(E(),d===f){d=void 0;for(let n of l.values())e.code===1008&&(n.hasValue=!1,n.value=void 0,n.revision=-1),n.terminal||y(n,`error`,new t(e.code===1008?`AUTH_EXPIRED`:`LIVE_DISCONNECTED`,`Live reconnecting; next snapshot will be current`));w()}},T=()=>f.close(),E=()=>{f.removeEventListener(`open`,h),f.removeEventListener(`message`,g),f.removeEventListener(`close`,b),f.removeEventListener(`error`,T),_.delete(E)};_.add(E),f.addEventListener(`open`,h),f.addEventListener(`message`,g),f.addEventListener(`close`,b),f.addEventListener(`error`,T)}catch(e){if(u||n!==m)return;for(let n of l.values())e instanceof t&&c.has(e.code)&&(n.hasValue=!1,n.value=void 0,n.revision=-1),y(n,`error`,e instanceof t?e:new t(`LIVE_UNAVAILABLE`,`Live connection failed`));w()}finally{f=!1,!u&&n!==m&&!d&&l.size&&w()}}function E(e){return async(r,i)=>{if(n(r.path),r.kind!==e)throw new t(`INVALID_KIND`,`Expected a ${e} function`);return x(`/v1/call`,{path:r.path,kind:r.kind,args:i},r.kind===`mutation`||r.kind===`action`)}}return{query:E(`query`),mutation:E(`mutation`),action:E(`action`),onUpdate(r,o,s,c){let u={next:s,error:c};if(b(),n(r.path),r.kind!==`query`)throw new t(`INVALID_KIND`,`Only queries are subscribable`);a({type:`subscribe`,id:`subscription-9999999999`,path:r.path,args:o},e.frameBytes);let f=i({path:r.path,args:o}),p=l.get(f);if(!p){if(l.size>=e.subscriptions)throw new t(`TOO_MANY_SUBSCRIPTIONS`,`Subscription limit exceeded`);p={id:`subscription-${++h}`,ref:r,args:JSON.parse(i(o)),observers:new Set,revision:-1,hasValue:!1,terminal:!1},l.set(f,p),d?.readyState===1&&C(p)}let v={next:u.next,error:u.error};p.observers.add(v),p.hasValue&&y({...p,observers:new Set([u])},`next`,p.value),T();let x=!1;return()=>{if(!x&&(x=!0,p.observers.delete(v),p.observers.size||(l.delete(f),d?.readyState===1&&S({type:`unsubscribe`,id:p.id})),!l.size)){++m,g&&clearTimeout(g),g=void 0;let e=d;d=void 0;for(let e of[..._])e();e?.close(1e3,`No subscriptions`)}}},refreshAuth(){b(),++m,g&&clearTimeout(g),g=void 0;for(let e of[..._])e();let e=d;d=void 0,e?.close(1e3,`Authorization changed`);for(let e of l.values())e.hasValue=!1,e.value=void 0,e.revision=-1,e.terminal=!1,y(e,`error`,new t(`AUTH_CHANGED`,`Authorization changed; cached value invalidated`));T()},dispose(){if(!u){u=!0,++m,g&&clearTimeout(g),g=void 0;for(let e of[..._])e();l.clear(),d?.close(1e3,`Disposed`),d=void 0}}}}export{r as i,o as n,s as r,l as t};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import{a as e,r as t,t as n}from"./client.BeKNsjPN.js";var r=n(),i=e(t(),1),a=(0,i.memo)(({value:e,name:t,hydrate:n=!0})=>e==null||e.trim()===``?null:(0,i.createElement)(n?`astro-slot`:`astro-static-slot`,{name:t,suppressHydrationWarning:!0,dangerouslySetInnerHTML:{__html:e}}),()=>!0);function o(e){for(let t in e)if(t.startsWith(`__reactContainer`))return t}var s={class:`className`,for:`htmlFor`},c=0;function l(e,t,n){t===void 0&&(c+=1,t=c,n=0);let r={};for(let t of e.attributes){let e=s[t.name]||t.name;r[e]=t.value}if(r.key=`${t}-${n}`,e.firstChild===null)return(0,i.createElement)(e.localName,r);let a=0;return(0,i.createElement)(e.localName,r,Array.from(e.childNodes).map(e=>{if(e.nodeType===Node.TEXT_NODE)return e.data;if(e.nodeType===Node.ELEMENT_NODE)return a+=1,l(e,t,a)}).filter(e=>!!e))}function u(e,t){if(t&&e){let t=[],n=document.createElement(`template`);n.innerHTML=e;for(let e of n.content.children)t.push(l(e));return t}if(e)return(0,i.createElement)(a,{value:e})}var d=new WeakMap,f=(e,t)=>{let n=d.get(e);return n||(n=t(),d.set(e,n)),n},p=e=>(t,n,{default:s,...c},{client:l})=>{if(!e.hasAttribute(`ssr`))return;let d=e.getAttribute(`data-action-key`),p=e.getAttribute(`data-action-name`),m=e.getAttribute(`data-action-result`),h=d&&p&&m?[JSON.parse(m),d,p]:void 0,g={identifierPrefix:e.getAttribute(`prefix`),formState:h};for(let[e,t]of Object.entries(c))n[e]=(0,i.createElement)(a,{value:t,name:e});let _=(0,i.createElement)(t,n,u(s,e.hasAttribute(`data-react-children`))),v=o(e);if(v&&delete e[v],l===`only`)return(0,i.startTransition)(()=>{f(e,()=>{let t=(0,r.createRoot)(e);return e.addEventListener(`astro:unmount`,()=>t.unmount(),{once:!0}),t}).render(_)});(0,i.startTransition)(()=>{f(e,()=>{let t=(0,r.hydrateRoot)(e,_,g);return e.addEventListener(`astro:unmount`,()=>t.unmount(),{once:!0}),t}).render(_)})};export{p as default};
|