vitral 0.11.0 → 0.11.2
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +194 -8
- package/dist/angular.js +1 -1
- package/dist/auto.js +1 -1
- package/dist/{chunk-7P5O3REI.js → chunk-I3CDUKHO.js} +23 -4
- package/dist/{chunk-AQUQD3NA.js → chunk-SVYL6UCB.js} +4 -2
- package/dist/element.d.ts +1 -1
- package/dist/element.js +1 -1
- package/dist/embed.js +1 -1
- package/dist/next-host.js +1 -1
- package/dist/next.d.ts +1 -1
- package/dist/react.js +1 -1
- package/dist/vue.d.ts +1 -1
- package/dist/vue.js +1 -1
- package/package.json +18 -24
- package/dist/portals-RLXKPXBZ.js +0 -24
package/README.md
CHANGED
|
@@ -20,7 +20,7 @@
|
|
|
20
20
|
<a href="./README.en.md">English</a>
|
|
21
21
|
</p>
|
|
22
22
|
|
|
23
|
-
|
|
23
|
+
Micro-frontends com qualquer framework, sem configurar build no host. React, Next.js, Vue, Nuxt, Angular, Svelte e outros na mesma página.
|
|
24
24
|
|
|
25
25
|
Cada equipe publica o próprio pedaço da página (um remote) com `vite build`. O host recebe a URL de cada remote e monta tudo no navegador.
|
|
26
26
|
|
|
@@ -31,7 +31,7 @@ Cada equipe publica o próprio pedaço da página (um remote) com `vite build`.
|
|
|
31
31
|
- **Deploy independente.** Cada equipe publica quando quiser. O host vê a versão nova sem novo build.
|
|
32
32
|
- **CSS e erros isolados.** O CSS de um remote não muda o resto da página. Um remote fora do ar mostra o próprio erro, e o resto continua funcionando.
|
|
33
33
|
- **Seguro.** O JS só roda se vier de uma origem permitida e se o hash SHA-384 bater.
|
|
34
|
-
- **Leve e rápido.**
|
|
34
|
+
- **Leve e rápido.** 5,1 kB de host. Abre a página na metade do tempo do Module Federation e troca de área 4,5 vezes mais rápido que o Next.js Multi-Zones.
|
|
35
35
|
|
|
36
36
|
```bash
|
|
37
37
|
npm install vitral
|
|
@@ -54,15 +54,31 @@ npm install vitral
|
|
|
54
54
|
| Trocar de área | Sem recarregar | Sem recarregar | Recarrega a página e baixa Next e React de novo | Sem recarregar |
|
|
55
55
|
| Isolamento de CSS | Nenhum | Nenhum | Por página | Escopo automático ou Shadow DOM |
|
|
56
56
|
| Remote fora do ar | Erro sem tratamento derruba a página | A tela de erro é com você | A zona inteira fica fora | Só aquele remote mostra erro, com `retry` |
|
|
57
|
-
| Código de host (brotli) | 19,4 kB | 5,8 kB | Runtime do Next em cada zona |
|
|
57
|
+
| Código de host (brotli) | 19,4 kB | 5,8 kB | Runtime do Next em cada zona | 5,1 kB |
|
|
58
58
|
|
|
59
|
-
|
|
59
|
+
## Velocidade
|
|
60
60
|
|
|
61
|
-
|
|
62
|
-
- **4,6 vezes mais rápido** para trocar de área que o Next.js Multi-Zones (184 ms contra 850 ms), com 63% menos bytes para abrir duas áreas.
|
|
63
|
-
- **10 frameworks** cobertos por testes de ponta a ponta no CI, com host e remote de frameworks diferentes, em Chromium, Firefox, WebKit e mobile.
|
|
61
|
+
Medido no Chromium com rede de celular lenta (Slow 4G). Mediana de 7 visitas. Menor é melhor.
|
|
64
62
|
|
|
65
|
-
|
|
63
|
+
**Contra o Module Federation**, com o React compartilhado entre os remotes:
|
|
64
|
+
|
|
65
|
+
| | vitral | Module Federation |
|
|
66
|
+
|---|--:|--:|
|
|
67
|
+
| Abrir a página com 1 remote | **1,1 s** | 2,6 s |
|
|
68
|
+
| Abrir a página com 8 remotes | **2,1 s** | 4,5 s |
|
|
69
|
+
| Baixado com 8 remotes | **153 kB** | 409 kB |
|
|
70
|
+
|
|
71
|
+
**Contra o Next.js Multi-Zones**, com o app dividido em duas áreas:
|
|
72
|
+
|
|
73
|
+
| | vitral | Multi-Zones |
|
|
74
|
+
|---|--:|--:|
|
|
75
|
+
| Abrir a primeira área | **0,7 s** | 1,0 s |
|
|
76
|
+
| Trocar de área | **0,2 s** | 0,8 s |
|
|
77
|
+
| Baixado para abrir as duas áreas | **83 kB** | 229 kB |
|
|
78
|
+
|
|
79
|
+
[Como foi medido](https://joaogabriel15.github.io/vitral/aprender/benchmark): versões, máquina e o script para rodar de novo.
|
|
80
|
+
|
|
81
|
+
Os 10 frameworks têm testes de ponta a ponta no CI, com host e remote de frameworks diferentes, em Chromium, Firefox, WebKit e mobile.
|
|
66
82
|
|
|
67
83
|
## Começo rápido
|
|
68
84
|
|
|
@@ -120,6 +136,155 @@ Sem build no host, numa página HTML qualquer:
|
|
|
120
136
|
|
|
121
137
|
Todos os componentes de host aceitam `src` no lugar de `name`.
|
|
122
138
|
|
|
139
|
+
## Next.js e Nuxt como host
|
|
140
|
+
|
|
141
|
+
O remote é sempre um projeto Vite (React, Vue ou outro), como no Começo rápido acima. O host pode ser um app Next ou Nuxt.
|
|
142
|
+
|
|
143
|
+
**Next.js (App Router):**
|
|
144
|
+
|
|
145
|
+
```tsx
|
|
146
|
+
// app/carrinho.tsx
|
|
147
|
+
'use client'
|
|
148
|
+
import { configure } from 'vitral'
|
|
149
|
+
import { Remote } from 'vitral/react'
|
|
150
|
+
|
|
151
|
+
if (typeof window !== 'undefined') {
|
|
152
|
+
configure({ remotes: { carrinho: 'https://cdn.empresa.com/carrinho/vitral.json' } })
|
|
153
|
+
}
|
|
154
|
+
|
|
155
|
+
export function Carrinho({ userId }: { userId: number }) {
|
|
156
|
+
return <Remote name="carrinho" props={{ userId }} fallback={<p>Carregando…</p>} />
|
|
157
|
+
}
|
|
158
|
+
```
|
|
159
|
+
|
|
160
|
+
```tsx
|
|
161
|
+
// app/page.tsx
|
|
162
|
+
import { Carrinho } from './carrinho'
|
|
163
|
+
|
|
164
|
+
export default function Page() {
|
|
165
|
+
return <main><Carrinho userId={42} /></main>
|
|
166
|
+
}
|
|
167
|
+
```
|
|
168
|
+
|
|
169
|
+
**Nuxt 3 e 4:**
|
|
170
|
+
|
|
171
|
+
```ts
|
|
172
|
+
// app/plugins/vitral.client.ts
|
|
173
|
+
import { configure } from 'vitral'
|
|
174
|
+
|
|
175
|
+
export default defineNuxtPlugin(() => {
|
|
176
|
+
configure({ remotes: { catalogo: 'https://cdn.empresa.com/catalogo/vitral.json' } })
|
|
177
|
+
})
|
|
178
|
+
```
|
|
179
|
+
|
|
180
|
+
```vue
|
|
181
|
+
<!-- app/pages/index.vue -->
|
|
182
|
+
<script setup lang="ts">
|
|
183
|
+
import { VitralRemote } from 'vitral/vue'
|
|
184
|
+
</script>
|
|
185
|
+
|
|
186
|
+
<template>
|
|
187
|
+
<VitralRemote name="catalogo" :props="{ userId: 42 }">
|
|
188
|
+
<template #fallback><p>Carregando…</p></template>
|
|
189
|
+
</VitralRemote>
|
|
190
|
+
</template>
|
|
191
|
+
```
|
|
192
|
+
|
|
193
|
+
Nos dois, o servidor renderiza o `fallback` e o remote monta no navegador. Não precisa de `dynamic(..., { ssr: false })` nem de `<ClientOnly>`.
|
|
194
|
+
|
|
195
|
+
## Multi-Zones ou vitral
|
|
196
|
+
|
|
197
|
+
O mesmo app Next dividido em duas áreas: a loja (app principal) e a conta, de outra equipe.
|
|
198
|
+
|
|
199
|
+
<p align="center">
|
|
200
|
+
<picture>
|
|
201
|
+
<source media="(prefers-color-scheme: dark)" srcset="https://raw.githubusercontent.com/joaogabriel15/vitral/main/docs/public/marca/multizonas-escuro.png">
|
|
202
|
+
<img src="https://raw.githubusercontent.com/joaogabriel15/vitral/main/docs/public/marca/multizonas.png" width="900" alt="À esquerda, Multi-Zones: dois apps Next, rewrites e a página recarrega ao trocar de área (0,8 s). À direita, vitral: um app Next com withVitral, a conta é um remote dentro do layout e a troca é sem recarregar (0,2 s).">
|
|
203
|
+
</picture>
|
|
204
|
+
</p>
|
|
205
|
+
|
|
206
|
+
**Com Multi-Zones**, a conta é um segundo app Next, e o app principal repassa as URLs para ele:
|
|
207
|
+
|
|
208
|
+
```js
|
|
209
|
+
// conta/next.config.js (a zona)
|
|
210
|
+
module.exports = {
|
|
211
|
+
basePath: '/conta',
|
|
212
|
+
assetPrefix: '/conta-static',
|
|
213
|
+
}
|
|
214
|
+
```
|
|
215
|
+
|
|
216
|
+
```js
|
|
217
|
+
// loja/next.config.js (o app principal)
|
|
218
|
+
module.exports = {
|
|
219
|
+
async rewrites() {
|
|
220
|
+
return [
|
|
221
|
+
{ source: '/conta', destination: `${process.env.CONTA_URL}/conta` },
|
|
222
|
+
{ source: '/conta/:path+', destination: `${process.env.CONTA_URL}/conta/:path+` },
|
|
223
|
+
{ source: '/conta-static/:path+', destination: `${process.env.CONTA_URL}/conta-static/:path+` },
|
|
224
|
+
]
|
|
225
|
+
},
|
|
226
|
+
}
|
|
227
|
+
```
|
|
228
|
+
|
|
229
|
+
```tsx
|
|
230
|
+
// links entre zonas: <a>, não <Link>. A página recarrega e baixa Next e React de novo.
|
|
231
|
+
<a href="/conta">Minha conta</a>
|
|
232
|
+
```
|
|
233
|
+
|
|
234
|
+
**Com vitral**, a conta é um remote (projeto Vite) e a loja continua sendo o único app Next:
|
|
235
|
+
|
|
236
|
+
```js
|
|
237
|
+
// conta/vite.config.js (o remote)
|
|
238
|
+
import react from '@vitejs/plugin-react'
|
|
239
|
+
import vitral from 'vitral/vite'
|
|
240
|
+
|
|
241
|
+
export default { plugins: [react(), vitral({ name: 'conta', dedupe: ['react'] })] }
|
|
242
|
+
```
|
|
243
|
+
|
|
244
|
+
```js
|
|
245
|
+
// loja/next.config.js (o host)
|
|
246
|
+
const { withVitral } = require('vitral/next-config')
|
|
247
|
+
|
|
248
|
+
module.exports = withVitral({}, {
|
|
249
|
+
remotes: {
|
|
250
|
+
conta: { url: 'https://cdn.empresa.com/conta/vitral.json', basePath: '/conta' },
|
|
251
|
+
},
|
|
252
|
+
})
|
|
253
|
+
```
|
|
254
|
+
|
|
255
|
+
```tsx
|
|
256
|
+
// loja/pages/_app.tsx
|
|
257
|
+
import { VitralNext } from 'vitral/next-host'
|
|
258
|
+
|
|
259
|
+
export default function App({ Component, pageProps }) {
|
|
260
|
+
return <><VitralNext /><Component {...pageProps} /></>
|
|
261
|
+
}
|
|
262
|
+
```
|
|
263
|
+
|
|
264
|
+
```tsx
|
|
265
|
+
// loja/pages/conta/[[...slug]].tsx
|
|
266
|
+
import { NextRemote } from 'vitral/next-host'
|
|
267
|
+
|
|
268
|
+
export default function Conta() {
|
|
269
|
+
return <Layout><NextRemote name="conta" fallback={<p>Carregando…</p>} /></Layout>
|
|
270
|
+
}
|
|
271
|
+
```
|
|
272
|
+
|
|
273
|
+
```tsx
|
|
274
|
+
// links: <Link> normal. A troca é sem recarregar, e o React não baixa de novo.
|
|
275
|
+
<Link href="/conta">Minha conta</Link>
|
|
276
|
+
```
|
|
277
|
+
|
|
278
|
+
| | Multi-Zones | vitral |
|
|
279
|
+
|---|---|---|
|
|
280
|
+
| Apps Next | Um por área | Só o host |
|
|
281
|
+
| Configuração | `basePath` e `assetPrefix` na zona, `rewrites` no app principal | `withVitral` no host, plugin no remote |
|
|
282
|
+
| Trocar de área | Recarrega a página (0,8 s no benchmark) | Sem recarregar (0,2 s) |
|
|
283
|
+
| React e Next | Baixados de novo em cada área | Uma cópia para a página toda |
|
|
284
|
+
| Layout do app principal | Cada zona repete o seu | O remote fica dentro do layout do host |
|
|
285
|
+
|
|
286
|
+
Guia completo, com SSR por rota e prefetch: [Migrar do Next.js Multi-Zones](https://joaogabriel15.github.io/vitral/migracao/multi-zones).
|
|
287
|
+
|
|
123
288
|
## Rodar local
|
|
124
289
|
|
|
125
290
|
Cada remote roda no próprio `vite dev`, numa porta. O host aponta para essas portas:
|
|
@@ -246,6 +411,13 @@ O que entra em `${}` é escapado. Mudar `state` ou as props atualiza a tela.
|
|
|
246
411
|
|
|
247
412
|
## Comunicação entre remotes
|
|
248
413
|
|
|
414
|
+
<p align="center">
|
|
415
|
+
<picture>
|
|
416
|
+
<source media="(prefers-color-scheme: dark)" srcset="https://raw.githubusercontent.com/joaogabriel15/vitral/main/docs/public/marca/comunicacao-escuro.png">
|
|
417
|
+
<img src="https://raw.githubusercontent.com/joaogabriel15/vitral/main/docs/public/marca/comunicacao.png" width="900" alt="Três remotes em React, Vue e Angular. O carrinho emite um evento, a busca recebe pelo mesmo barramento, e a conta lê o usuário que o host criou com provide.">
|
|
418
|
+
</picture>
|
|
419
|
+
</p>
|
|
420
|
+
|
|
249
421
|
```js
|
|
250
422
|
import { events } from 'vitral'
|
|
251
423
|
|
|
@@ -399,6 +571,13 @@ Um remote local (`module`) só mede `css` e `mount`. Erros dentro do
|
|
|
399
571
|
|
|
400
572
|
Para não baixar React ou Vue mais de uma vez, liste-os em `dedupe` no remote:
|
|
401
573
|
|
|
574
|
+
<p align="center">
|
|
575
|
+
<picture>
|
|
576
|
+
<source media="(prefers-color-scheme: dark)" srcset="https://raw.githubusercontent.com/joaogabriel15/vitral/main/docs/public/marca/dedupe-escuro.png">
|
|
577
|
+
<img src="https://raw.githubusercontent.com/joaogabriel15/vitral/main/docs/public/marca/dedupe.png" width="900" alt="Sem dedupe, cada remote baixa o próprio React. Com dedupe, os remotes usam o React que já está na página quando a versão serve; o que não serve baixa o próprio.">
|
|
578
|
+
</picture>
|
|
579
|
+
</p>
|
|
580
|
+
|
|
402
581
|
```js
|
|
403
582
|
vitral({ dedupe: ['react'] })
|
|
404
583
|
```
|
|
@@ -415,6 +594,13 @@ página (`watchUpdates()` e `refresh('carrinho')`) e app shell por rota
|
|
|
415
594
|
|
|
416
595
|
## Segurança
|
|
417
596
|
|
|
597
|
+
<p align="center">
|
|
598
|
+
<picture>
|
|
599
|
+
<source media="(prefers-color-scheme: dark)" srcset="https://raw.githubusercontent.com/joaogabriel15/vitral/main/docs/public/marca/seguranca-escuro.png">
|
|
600
|
+
<img src="https://raw.githubusercontent.com/joaogabriel15/vitral/main/docs/public/marca/seguranca.png" width="900" alt="O host configura allowedOrigins e integrity. Antes de rodar, a lib confere a origem e o SHA-384. Se um dos dois falha, nada executa e o erro aparece no lugar do remote.">
|
|
601
|
+
</picture>
|
|
602
|
+
</p>
|
|
603
|
+
|
|
418
604
|
- Só importa JS de origens permitidas, mesmo que o `vitral.json` aponte para outra. O `src` de um componente de host entra na allowlist; o atributo `src` do `<vitral-remote>` não entra quando há `allowedOrigins`.
|
|
419
605
|
- Com `integrity`, nada roda sem o hash conferir. A lib usa o primeiro caminho que o navegador garante: import map com `integrity` (Chrome 133+, Safari 18.4+), `<link rel="modulepreload" integrity>` (Firefox 115+) ou, nos outros, baixa, confere e executa exatamente os bytes conferidos via `blob:`. Aceita `sha256`, `sha384` e `sha512`, e vários hashes separados por espaço (vale o mais forte). O CSS do manifesto também é conferido.
|
|
420
606
|
- Com CSP, a lib copia o `nonce` de um `<script nonce>` da página para o import map. Sem nonce, cai para o `modulepreload`.
|
package/dist/angular.js
CHANGED
package/dist/auto.js
CHANGED
|
@@ -42,15 +42,35 @@ import * as ReactDOM from "react-dom";
|
|
|
42
42
|
import * as ReactDOMClient from "react-dom/client";
|
|
43
43
|
import * as JSXRuntime from "react/jsx-runtime";
|
|
44
44
|
import * as JSXDevRuntime from "react/jsx-dev-runtime";
|
|
45
|
+
|
|
46
|
+
// src/core/portals.ts
|
|
47
|
+
function scopePortals(root, scope) {
|
|
48
|
+
const owner = (node) => {
|
|
49
|
+
const key = Object.keys(node).find((k) => k.startsWith("__reactFiber$"));
|
|
50
|
+
for (let f = key && node[key]; f; f = f.return) {
|
|
51
|
+
const s = f.stateNode;
|
|
52
|
+
if (s && s !== node && s.nodeType === 1 && root.contains(s)) return true;
|
|
53
|
+
if (f.tag === 3) return s?.containerInfo === root;
|
|
54
|
+
}
|
|
55
|
+
return false;
|
|
56
|
+
};
|
|
57
|
+
const mark = (n) => {
|
|
58
|
+
if (n instanceof Element && !n.hasAttribute("data-vitral-scope") && owner(n)) n.setAttribute("data-vitral-scope", scope);
|
|
59
|
+
};
|
|
60
|
+
const watch = new MutationObserver((list) => list.forEach((r) => r.addedNodes.forEach(mark)));
|
|
61
|
+
watch.observe(document.body, { childList: true });
|
|
62
|
+
document.body.childNodes.forEach(mark);
|
|
63
|
+
return () => watch.disconnect();
|
|
64
|
+
}
|
|
65
|
+
|
|
66
|
+
// src/react.tsx
|
|
45
67
|
import { jsx, jsxs } from "react/jsx-runtime";
|
|
46
68
|
function reactRemote(Component) {
|
|
47
69
|
const start = (el, props, ctx, hydrate) => {
|
|
48
70
|
const tree = (p) => /* @__PURE__ */ jsx(RemoteTree, { Component, props: p, ctx });
|
|
49
71
|
const options = { onUncaughtError: (e) => ctx.reportError(e) };
|
|
50
72
|
const scope = ctx.portalContainer === document.body && el.closest("[data-vitral-scope]")?.getAttribute("data-vitral-scope");
|
|
51
|
-
|
|
52
|
-
let gone = false;
|
|
53
|
-
if (scope) void import("./portals-RLXKPXBZ.js").then((m) => gone || (stop = m.scopePortals(el, scope)));
|
|
73
|
+
const stop = scope ? scopePortals(el, scope) : void 0;
|
|
54
74
|
const root = hydrate ? hydrateRoot(el, tree(props), options) : createRoot(el, options);
|
|
55
75
|
const render = (p) => root.render(tree(p));
|
|
56
76
|
if (!hydrate) render(props);
|
|
@@ -58,7 +78,6 @@ function reactRemote(Component) {
|
|
|
58
78
|
update: render,
|
|
59
79
|
unmount: () => {
|
|
60
80
|
root.unmount();
|
|
61
|
-
gone = true;
|
|
62
81
|
stop?.();
|
|
63
82
|
}
|
|
64
83
|
};
|
|
@@ -19,8 +19,10 @@ import {
|
|
|
19
19
|
var Base = typeof HTMLElement === "undefined" ? class {
|
|
20
20
|
} : HTMLElement;
|
|
21
21
|
var VitralRemoteElement = class extends Base {
|
|
22
|
-
static {
|
|
23
|
-
|
|
22
|
+
// Getter, e não campo estático: o campo vira um bloco `static {}`, e o
|
|
23
|
+
// bundler do remote mantém a classe (e o loader do host) por causa dele.
|
|
24
|
+
static get observedAttributes() {
|
|
25
|
+
return ["name", "src", "props", "isolate"];
|
|
24
26
|
}
|
|
25
27
|
#slot = null;
|
|
26
28
|
#props = {};
|
package/dist/element.d.ts
CHANGED
|
@@ -37,7 +37,7 @@ import './errors-kjBv6IH_.js';
|
|
|
37
37
|
declare const Base: typeof HTMLElement;
|
|
38
38
|
declare class VitralRemoteElement extends Base {
|
|
39
39
|
#private;
|
|
40
|
-
static observedAttributes: string[];
|
|
40
|
+
static get observedAttributes(): string[];
|
|
41
41
|
get props(): Props;
|
|
42
42
|
set props(value: Props);
|
|
43
43
|
get status(): SlotStatus;
|
package/dist/element.js
CHANGED
package/dist/embed.js
CHANGED
|
@@ -1,2 +1,2 @@
|
|
|
1
1
|
"use strict";(()=>{var Po=Object.defineProperty;var h=(e,t)=>()=>(e&&(t=e(e=0)),t);var x=(e,t)=>{for(var o in t)Po(e,o,{get:t[o],enumerable:!0})};var L,B=h(()=>{"use strict";L={}});function Ve(){let e=new Map,t=new Map;return{emit(o,r){t.set(o,r);for(let n of[...e.get(o)??[]])try{n(r)}catch(s){console.error(`[vitral] handler de "${o}" falhou`,s)}},on(o,r){let n=e.get(o);return n||e.set(o,n=new Set),n.add(r),()=>n.delete(r)},last(o){return t.get(o)}}}var Fe=h(()=>{"use strict"});function xo(){let e={timeout:15e3,retries:1,isolate:"none",allowedOrigins:null},t=new Map,o=new Map,r=Promise.resolve();return{protocol:We,events:Ve(),settings:()=>e,configure(n){Object.assign(e,n)},register(n,s){t.set(n,s),o.delete(n)},entry:n=>t.get(n),origins:()=>[...t.values()].filter(n=>n.url).map(n=>new URL(n.url).origin),pending(n){return n&&(r=Promise.all([r,n])),r.then(()=>{})},load(n,s){let a=o.get(n);if(!a){a=s();let i=a;i.catch(()=>o.get(n)===i&&o.delete(n)),o.set(n,a)}return a}}}function p(){let e=Ke[ze];return e&&typeof e.protocol=="number"&&e.protocol>=We?e:Ke[ze]=xo()}var We,ze,Ke,R=h(()=>{"use strict";Fe();We=1,ze=Symbol.for("vitral"),Ke=globalThis});function O(e,t){if(S(e)&&!q.has(e)){q.add(e),e.cause instanceof Object&&q.add(e.cause),e.entry??=t?.entry??p().entry(e.remote)?.url,e.version??=t?.version;try{p().settings().onError?.(e)}catch{}L.watch?.(e.remote,e)}return e}var Je,g,S,$,q,X,w=h(()=>{"use strict";B();R();Je="https://joaogabriel15.github.io/vitral/erros/",g=class extends Error{constructor(o,r,n,s){super(`[vitral] ${r}: ${n} (${Je}${o})`);this.code=o;this.remote=r;this.cause=s;this.name="RemoteError",this.docs=`${Je}${o}`,typeof location<"u"&&(this.route=location.pathname)}},S=e=>e?.name==="RemoteError",$=new Map,q=new WeakSet;X=e=>{throw O(e)}});function fe(e,t){if(t==="*")return!0;let[,o="",r=""]=/^(\^|~|>=|=)?(.*)$/.exec(t.trim());if(!o||o==="="||e.includes("-"))return e===r;let[n,s]=[e,r].map(i=>(i+".0.0").split(".",3).map(Number));for(let i=0;i<3;i++)if(n[i]!==s[i]){if(!(n[i]>s[i]))return!1;break}if(o===">=")return!0;let a=Math.min(r.split(".").length,o==="~"?2:s[0]?1:s[1]?2:3);return n.slice(0,a).join(".")===s.slice(0,a).join(".")}var Ge=h(()=>{"use strict"});var me={};x(me,{offer:()=>Oo,planned:()=>ko,satisfies:()=>fe,shared:()=>Ze});function Ze(e){if(!e.dedupe){let t=new Map,o=new Map,r=(s,a)=>s.includes(a)&&s.splice(s.indexOf(a),1),n=(s,a,i)=>(i.p||((i.p=i.load()).catch(()=>r(a,i)),i.url&&i.p.then(()=>Mo(`${s}@${i.version}`,i.url),()=>{})),i.p);e.dedupe=(s,a,i)=>{let l=i,c=t.get(s)??[];t.set(s,c),l?.url&&o.get(s+l.url)?.(l);let m=c.find(u=>fe(u.version,a));if(!m&&l){m=c[c.push(l)-1];let u=l.url&&Lo(`${s}@${l.version}`);u&&u!==l.url&&(l.p=new Promise(d=>{o.set(s+u,d),setTimeout(d,300,l)}).then(d=>(o.delete(s+u),d===l&&(l.p=void 0),n(s,c,d))),l.p.catch(()=>r(c,l)))}return m&&n(s,c,m)}}return e.dedupe}function Oo(e,t){for(let o in t){let{version:r,modules:n}=t[o];Ze(e)(o,r,{version:r,load:typeof n=="function"?n:async()=>n}),e.configure({offered:{...e.settings().offered,[o]:r}})}}function ko(e,t){let o=globalThis[Symbol.for("vitral")].settings().dedupePlan?.[e],r=a=>new URL(a,location.href).href;if(!o||!t.dedupe)return t;let n={...t.sri},s=t.dedupe.map(a=>{let i=o[a.name];if(i?.for!==`${a.range}@${a.version}`)return a;for(let l in i.sri)n[r(l)]=i.sri[l];return{...a,version:i.version,file:r(i.file),chunks:i.chunks?.map(r)}});return{...t,dedupe:s,sri:n}}var Ye,Lo,Mo,ge=h(()=>{"use strict";Ge();Ye="vitral:dedupe:",Lo=e=>{try{return localStorage.getItem(Ye+e)}catch{return null}},Mo=(e,t)=>{try{localStorage.setItem(Ye+e,t)}catch{}}});async function Qe(e,t,o){let r=o.split(/\s+/).map(i=>/^sha(256|384|512)-([\w+/=-]+)/.exec(i)).filter(i=>!!i);if(!r.length)throw new g("INTEGRITY",e,`formato de integrity inv\xE1lido: ${o}`);let n=Math.max(...r.map(i=>+i[1])),s=btoa(String.fromCharCode(...new Uint8Array(await crypto.subtle.digest("SHA-"+n,t)))),a=r.filter(i=>+i[1]===n).map(i=>i[2]);if(!a.some(i=>Xe(i)===Xe(s)))throw new g("INTEGRITY",e,`o hash n\xE3o confere: esperado sha${n}-${a.join(" ou ")}, obtido sha${n}-${s}`)}var Xe,et=h(()=>{"use strict";w();Xe=e=>e.replace(/-/g,"+").replace(/_/g,"/").replace(/=/g,"")});function V(){return typeof location<"u"?location.origin:null}function b(e,t){return new URL(e,t??(typeof location<"u"?location.href:void 0)).href}async function tt(e,t){for(let o=0;;o++)try{return await t()}catch(r){if(!(S(r)&&(r.code==="LOAD_FAILED"||r.code==="TIMEOUT"))||o>=e)throw r;await new Promise(s=>setTimeout(s,200*2**o))}}function F(e,t,o){return new Promise((r,n)=>{let s=setTimeout(()=>n(new g("TIMEOUT",t,`n\xE3o respondeu em ${e}ms`)),e);o.then(r,n).finally(()=>clearTimeout(s))})}function z(e,t,o,r){let n=new AbortController,s=fetch(e,{signal:n.signal,credentials:"omit",...r}).then(a=>{if(!a.ok)throw new g("LOAD_FAILED",o,`HTTP ${a.status} em ${e}`);return a.arrayBuffer()},a=>{throw new g("LOAD_FAILED",o,`falha ao baixar ${e}`,a)});return F(t,o,s).catch(a=>{throw n.abort(),a})}async function Q(e,t,o,r){let n=new TextDecoder().decode(await z(e,t,o,r));try{return JSON.parse(n)}catch(s){throw new g("INVALID_MODULE",o,`JSON inv\xE1lido em ${e}`,s)}}function A(e,t,o={},r=document.head){return r.appendChild(Object.assign(document.createElement("link"),{rel:e,crossOrigin:"anonymous",href:t},o))}function H(e,t,o){try{let r=`vitral:${e}:${t}`;performance.clearMeasures(r),performance.measure(r,{start:o}),p().settings().onMetric?.({name:e,stage:t,start:o,duration:performance.now()-o})}catch{}}var k=h(()=>{"use strict";w();R()});var dt={};x(dt,{importVerified:()=>To,signature:()=>ct,verified:()=>ut});async function To(e,t,o,r){t.split?.dedupe?.length&&globalThis[Symbol.for("vitral")]?.settings().dedupePlan?.[e]&&(t={...t,split:(await T()).planned(e,t.split)});let{entry:n,integrity:s,priority:a}=t;if(!ye.has(n))try{let m=await F(r,e,(async()=>{let u=await ut(t.split??{entry:n,chunks:[],sri:{[n]:s},priority:a},o);return u&&{ns:await o(u)}})());if(m)return m.ns}catch(c){if(ye.add(n),c instanceof g&&c.code==="TIMEOUT")throw c}let i=await z(n,r,e,{priority:a,...ye.has(n)&&{cache:"reload"},...ct(s)});await Qe(e,i,s);let l=URL.createObjectURL(new Blob([i],{type:"text/javascript"}));try{return await o(l)}finally{URL.revokeObjectURL(l)}}async function Io(e,t){if(he)return await he&&at(e,!1);let o=!1;try{o=localStorage[st]===navigator.userAgent}catch{}let r=await(he=at(e,!o,t));if(r&&!o)try{localStorage[st]=navigator.userAgent}catch{}return r}async function ut(e,t){let{entry:o,chunks:r,sri:n,priority:s="auto",dedupe:a=[]}=e,i=a.flatMap(u=>[...u.chunks??[],u.file]);if(![o,...r,...i].every(u=>Co.test(n[u]??"")))return;let l=globalThis[Symbol.for("vitral")],c=async u=>{if(!t||!a.length)return;let{shared:d}=await T();for(let f of a)d(l)(f.name,f.range,{version:f.version,url:f.file,load:async()=>(u&&await Promise.all([...f.chunks??[],f.file].map(y=>ve(y,n[y],s))),(await t(f.file)).default)})},m=e.probe?.every(u=>u.startsWith("data:")||new URL(u,location.href).origin===location.origin)?e.probe:void 0;if(rt!==!1&&(rt=await Io(n,m))){await c();let u=new Set([...document.querySelectorAll("link[rel=preload]")].map(d=>d.href));for(let d of r)u.has(d)||fetch(d,{priority:s}).catch(()=>{});return o}if(await(Ao??=Do(m)))return l.sri={...l.sri,...n},await c(!0),await Promise.all([...r,o].map(u=>ve(u,n[u],s))),o}async function at(e,t,o){if(!HTMLScriptElement.supports?.("importmap"))return!1;let r={};for(let l in e)!/\.css([?#]|$)/.test(l)&&!nt.has(l)&&(nt.add(l),r[l]=e[l]);let n=t?["export{}","export{}//"].map(l=>URL.createObjectURL(new Blob([l],{type:"text/javascript"}))):[];for(let l of n)r[l]=ee;let s=!0,a=()=>s=!1,i=l=>import(l);try{if(await lt(r,a),s&&t){let l=await te(i,n[0],n[1]);l===void 0&&o&&(await lt({[o[0]]:ee,[o[1]]:ee},a),l=s&&await te(i,o[0],o[1])),s=!!l}}catch{s=!1}for(let l of n)URL.revokeObjectURL(l);return s}async function lt(e,t){let o=document.createElement("script");o.type="importmap",o.nonce=document.querySelector("script[nonce]")?.nonce??"",o.onerror=t,o.addEventListener("securitypolicyviolation",t),o.textContent=JSON.stringify({integrity:e}),document.head.append(o),await it(),await it()}function ve(e,t,o="auto"){return new Promise((r,n)=>{let s=A("modulepreload",e,{integrity:t,fetchPriority:o});s.onload=r,s.onerror=n})}async function Do(e){if(!document.createElement("link").relList.supports("modulepreload"))return!1;let t=r=>ve(r,ee),o=await te(t,ot,ot+"//");return!!(o===void 0&&e?await te(t,...e.map(r=>r+(r.includes("?")?"&":"?")+"preload")):o)}function te(e,t,o){return Promise.race([Promise.all([e(t).then(()=>!0,()=>!1),e(o).then(()=>!1,()=>!0)]).then(([r,n])=>r?n:void 0),new Promise(r=>setTimeout(r,3e3,!1))])}var ye,ct,Co,ot,ee,rt,nt,he,Ao,st,it,pt=h(()=>{"use strict";oe();et();w();k();ye=new Set;ct=e=>/ed25519-/.test(e)?{integrity:e}:{},Co=/^(sha(256|384|512)-[A-Za-z0-9+/]+={0,2}( +|$))+(ed25519-[A-Za-z0-9+/]+={0,2}( +|$))*$/,ot="data:text/javascript,export{}",ee="sha256-d3bjIZdvLjBurwdLwkSVOnEBPFFly+T1SR9r3VVHBGg=",nt=new Set,st="vitral:sri-map";it=()=>new Promise(e=>{let t=new MessageChannel;t.port1.onmessage=()=>e(),t.port2.postMessage(0)})});var re,T,ft,oe=h(()=>{"use strict";re={},T=()=>re.dedupe?Promise.resolve(re.dedupe):Promise.resolve().then(()=>(ge(),me)),ft=()=>re.sri?Promise.resolve(re.sri):Promise.resolve().then(()=>(pt(),dt))});var ht={};x(ht,{capture:()=>$o,owner:()=>yt});function $o(){mt||typeof addEventListener>"u"||(mt=!0,addEventListener("error",e=>gt(e.error,e.filename)),addEventListener("unhandledrejection",e=>gt(e.reason)))}function yt(e,t){let o=t||String(e?.stack??"").match(/(?:https?|file):\/\/[^\s)'"]+/)?.[0];if(!o)return;let r=[...document.querySelectorAll("script[src],link[rel=modulepreload]")].map(a=>a.src||a.href),n,s=0;for(let[a,{entry:i}]of $){let l=new URL(".",i).href;l.length>s&&o.startsWith(l)&&!r.some(c=>c.startsWith(l))&&(n=a,s=l.length)}return n}function gt(e,t){if(!p().settings().captureGlobalErrors||S(e)||e instanceof Object&&q.has(e))return;let o=yt(e,t);o&&O(new g("RENDER_FAILED",o,String(e?.message??e),e),$.get(o))}var mt,vt=h(()=>{"use strict";w();R();mt=!1});function Re(e){let t=p(),{remotes:o,dedupe:r,...n}=e;if(t.configure(n),n.captureGlobalErrors&&Promise.resolve().then(()=>(vt(),ht)).then(s=>s.capture()),r&&t.pending(T().then(s=>s.offer(t,r)).catch(()=>{})),typeof o=="string"){let s=b(o);t.pending(Q(s,t.settings().timeout,"remotes",{cache:"no-cache"}).then(a=>Rt(a,s))).catch(()=>{})}else o&&Rt(o)}function Et(e,t){let o=typeof t=="string"?{url:t}:t;if(!o.url&&!o.module)throw new g("NOT_REGISTERED",e,"informe url ou module");if(!o.url)return p().register(e,o);let r=b(o.url);p().register(e,{...o,url:r});let{origin:n}=new URL(r);typeof document<"u"&&n!==V()&&n!=="null"&&!document.querySelector(`link[href="${n}"]`)&&A("preconnect",n)}function I(e,t,o=!0){let r=p(),n=b(e),s=t||n;r.entry(s)?.url!==n&&r.register(s,{url:n});let a=new URL(n).origin,i=r.settings().trusted??[];return o&&!i.includes(a)&&r.configure({trusted:[...i,a]}),s}function Rt(e,t){for(let[o,r]of Object.entries(e)){let n=typeof r=="string"?{url:r}:r;Et(o,n.url?{...n,url:b(n.url,t)}:n)}}function K(e,t){let o=p(),r=new URL(t).origin,{allowedOrigins:n,trusted:s=[]}=o.settings(),a=[...n??[V(),...o.origins()].filter(Boolean),...s];if(!(a.includes("*")||a.includes(r)||t.startsWith("blob:")))throw new g("ORIGIN_BLOCKED",e,`origem ${r} n\xE3o est\xE1 em allowedOrigins`)}var U=h(()=>{"use strict";oe();w();R();k()});var Pe={};x(Pe,{attachShadowRoot:()=>jo,prefetch:()=>No,registryFor:()=>be});function xt({css:e,shadow:t}){let o=n=>new URL(n,e[0]).href,r=t?t.css.map(o):[];return[t?[...(t.imports??[]).map(o),...r,...e.slice(r.length)]:e,r,(t?.global??[]).map(o)]}function No(e,t){let[o,,r]=xt(e);for(let n of o)Le(n,e.sri?.[n],t).catch(Ho);W(r,null,e.sri)}async function jo(e,t,o,r={},n={}){let s=t().getAttribute("data-vitral-root"),a=be(s),i=e.shadowRoot;if(!i&&!St(a))try{i=e.attachShadow({mode:"open",customElementRegistry:a})}catch{Se=!0,we.delete(s),a=be(s)}i??=e.attachShadow({mode:"open"});let l=i.customElementRegistry??a,c=t();if(!St(l))try{c=t({customElementRegistry:l})}catch{}return c.isConnected||i.appendChild(c),[...await qo(i,c,o,r,n),i,l,c]}function be(e){let t=we.get(e);if(t)return t;let o=customElements;if(!Se&&"initialize"in CustomElementRegistry.prototype)try{o=new CustomElementRegistry}catch{Se=!0}let r=o===customElements,n=t=r?Object.create(o):o;if(r)for(let a of["get","getName","upgrade","whenDefined"])a in o&&(n[a]=o[a].bind(o));let s=o.define;return n.define=(a,i,l)=>{let c=o.get(a),m=bt.get(a);if(!c)return r&&bt.set(a,e),s.call(o,a,i,l);r&&c!==i&&m!==e&&Bo()&&console.warn(`[vitral] ${e}: <${a}> j\xE1 foi definido por ${m??"outro c\xF3digo"}; fica essa defini\xE7\xE3o. Sem Scoped Custom Element Registries, os remotes dividem o registro global.`)},we.set(e,t),t}function Bo(){try{return process.env.NODE_ENV!=="production"}catch{return!1}}async function qo(e,t,o,r={},n={}){let s=o.sri??{},[a,i,l]=xt(o),c=t.cloneNode();c.setAttribute("data-vitral-portal",""),t.after(c);let m=[...r.inherit??[],...n.inherit??[]].map(f=>new URL(f,document.baseURI).href).concat(a),u=W(l,null,s);if(typeof CSSStyleSheet<"u"&&"replaceSync"in CSSStyleSheet.prototype){let f=await Promise.all(m.map(y=>Lt(y,[],s[y],i.includes(y)?!!o.shadow.rebase:void 0)));e.adoptedStyleSheets=[...new Set([...e.adoptedStyleSheets,...f.flat()])]}else await W(m,e,s);await u;let d=(n.mirrorTheme??r.mirrorTheme)===!1?[]:[Pt(t),Pt(c)];return[()=>(d.forEach(f=>f()),c.remove()),c]}function Lt(e,t,o,r){let n=Ee.get(e);return n||(n=Le(e,o).then(s=>{let a=new CSSStyleSheet;if(r!==!1&&(s=s.replace(Uo,(u,d,f)=>`url(${d}${new URL(f,e).href}${d})`)),r!=null)return a.replaceSync(s),[a];let i=[],l=[],c=s.replace(_o,(u,d,f,y,M)=>{let v=y??M;return v?l.push(new URL(v,e).href):wt.has(d??u)||(wt.add(d??u),i.push(u)),""});if(i.length){let u=document.createElement("style");u.setAttribute("data-vitral-properties",""),u.textContent=i.join(`
|
|
2
|
-
`),document.head.appendChild(u)}a.replaceSync(c);let m=[...t,e];return Promise.all(l.filter(u=>!m.includes(u)).map(u=>Lt(u,m))).then(u=>[...u.flat(),a])}).catch(()=>(Ee.delete(e),[])),Ee.set(e,n)),n}function Pt(e){let t=document.documentElement,o=[],r=()=>{e.classList.remove(...o),o=[...t.classList].filter(a=>!e.classList.contains(a)),e.classList.add(...o);let s=t.getAttribute("data-theme");s===null?e.removeAttribute("data-theme"):e.setAttribute("data-theme",s)};r();let n=new MutationObserver(r);return n.observe(t,{attributeFilter:["class","data-theme"]}),()=>n.disconnect()}var Ee,Ho,wt,Uo,_o,we,Se,St,bt,xe=h(()=>{"use strict";ne();Ee=new Map,Ho=()=>{},wt=new Set,Uo=/url\(\s*(['"]?)(?![a-z]+:|\/\/|#)([^'")]+)\1\s*\)/gi,_o=/@property\s+(--[\w-]+)\s*\{[^}]*\}|@font-face\s*\{[^}]*\}|@import\s+(?:url\(\s*)?(?:(['"])(.*?)\2|([^'"\s);]+))\s*\)?[^;]*;/gi;we=new Map,Se=!1,St=e=>Object.getPrototypeOf(e)===customElements,bt=new Map});function Le(e,t,o){let r=`${e} ${t??""}`,n=Me.get(r);return n||(n=z(e,p().settings().timeout,e,{integrity:t,priority:o}).then(s=>new TextDecoder().decode(s)),n.catch(()=>Me.delete(r)),Me.set(r,n)),n}function kt(e,t,o="auto"){if(t&&Vo())Promise.resolve().then(()=>(xe(),Pe)).then(r=>r.prefetch(e,o),Ot);else for(let r of e.css)document.querySelector(`link[href="${r}"]`)||A("preload",r,{as:"style",integrity:e.sri?.[r]??"",fetchPriority:o})}function Tt(e,t,o,r){return t?Promise.resolve().then(()=>(xe(),Pe)).then(n=>n.attachShadowRoot(t,o,e,p().settings().styles,r)):W(e.css,null,e.sri).then(()=>[Ot])}function W(e,t,o={}){let r=t??document,n=Mt.get(r);n||Mt.set(r,n=new Map);let s=t??document.head,a=p().settings().timeout;return Promise.all(e.map(i=>{let l=n.get(i);return l||(l=new Promise(c=>{let m=A("stylesheet",i,{integrity:o[i]??""},s);setTimeout(c,a),m.onload=()=>c(),m.onerror=()=>{m.remove(),n.delete(i),c()}}),n.set(i,l)),l}))}var Mt,Me,Ot,Vo,ne=h(()=>{"use strict";R();k();Mt=new WeakMap,Me=new Map,Ot=()=>{},Vo=()=>typeof CSSStyleSheet<"u"&&"replaceSync"in CSSStyleSheet.prototype});function se(){let e=typeof navigator=="object"?navigator:{},t=e.connection||{};return p().settings().policy||(t.saveData||/2g/.test(t.effectiveType)?"lazy":t.effectiveType=="3g"||e.deviceMemory<=2?"critical":"all")}var Oe=h(()=>{"use strict";R()});var It={};x(It,{resolveModule:()=>zo,resolveTarget:()=>Fo,splitName:()=>Ct});function Ct(e){let t=p(),o=e.length;if(!t.entry(e))for(;(o=e.lastIndexOf("/",o-1))>0&&!t.entry(e.slice(0,o)););return o>0&&o<e.length?[e.slice(0,o),"."+e.slice(o)]:[e,null]}function Fo(e,t){return At(e,t).then(o=>ke(e,o))}function At(e,t){let o=p();return o.entry(e)||!e.includes("/")?t(e):o.pending().then(async()=>{let[r,n]=Ct(e);if(!n)return t(e);let s=await t(r),a=s.exports?.exposes;if(!a?.[n])throw new g("NOT_EXPOSED",e,`${r} n\xE3o exp\xF5e ${n}. Expostos: ${Object.keys(a??{}).join(", ")}`);try{let i=a[n],l=await(typeof i=="function"?i():i);return{...s,module:l?.default??l,exports:l}}catch(i){throw new g("LOAD_FAILED",e,String(i),i)}})}async function zo(e,t){let o=await At(e,t);if(!o.exports)throw new g("INVALID_MODULE",e,"o remote foi carregado por uma c\xF3pia antiga da lib, que n\xE3o guarda os exports");return o.exports}var Dt=h(()=>{"use strict";w();ie();R()});var jt={};x(jt,{OVERRIDES_KEY:()=>ae,activeOverrides:()=>Nt,clearOverrides:()=>Ut,dropOverride:()=>Jo,isRef:()=>Te,manifestUrl:()=>le,overrideFor:()=>Go,overridesEnabled:()=>Ht,resolveOverride:()=>_t,storeOverride:()=>Ko,storedOverrides:()=>Ae});function Ht(){return!!p().settings().devOverrides||typeof location<"u"&&/^(localhost|127\.0\.0\.1|\[::1\])$/.test(location.hostname)}function Ko(e,t){let o=Ae();t?o[e]=Te(t)?t:le(t):delete o[e],J(ue,o)}function Wo(){let e=Ce(ce),t=new URLSearchParams(location.search).getAll("vitral").join(",").split(",");if(!t.some(Boolean))return e;for(let o of t){let r=o.indexOf("@");o==="off"?(Ut(),Object.keys(e).forEach(n=>delete e[n])):r>0&&o.slice(r+1)==="off"?delete e[o.slice(0,r)]:r>0&&(e[o.slice(0,r)]=o.slice(r+1))}return J(ce,e),e}function Ut(){J(ce,{}),J(ue,{})}function Jo(e){for(let t of[ce,ue]){let o=Ce(t);delete o[e],J(t,o)}}function _t(e,t){if(!Te(t))return new URL(le(t),location.href).href;let o=p().settings().devOverrides,r=typeof o=="object"?o.preview:void 0;if(!r)return;let n=r.replace(/\{name\}/g,encodeURIComponent(e)).replace(/\{ref\}/g,encodeURIComponent(t));return new URL(le(n),location.href).href}function Nt(){let e=Wo(),t={};for(let[o,r]of[["navegador",Ae()],["aba",e]])for(let[n,s]of Object.entries(r))t[n]={name:n,value:s,url:_t(n,s),source:o};return Object.values(t)}function Go(e){if(!Ht())return;let t=Nt().find(a=>a.name===e);if(!t)return;let o=!$t.has(e)&&$t.add(e);if(!t.url){o&&console.warn(`[vitral] override ${e}@${t.value} ignorado: falta configure({ devOverrides: { preview } })`);return}let r=p(),n=r.settings().trusted??[],s=new URL(t.url).origin;return n.includes(s)||r.configure({trusted:[...n,s]}),o&&console.warn(`[vitral] override ativo: ${e} \u2192 ${t.url} (${t.source}). Para limpar: ?vitral=off`),{url:t.url}}var ae,le,Te,Ce,J,ue,ce,Ae,$t,Bt=h(()=>{"use strict";R();ae="vitral:overrides";le=e=>/\.(json|m?js)(\?|$)/.test(e)?e:e.replace(/\/?$/,"/vitral.json"),Te=e=>/^[\w.-]+$/.test(e),Ce=e=>{try{return JSON.parse(e().getItem(ae)??"{}")??{}}catch{return{}}},J=(e,t)=>{try{Object.keys(t).length?e().setItem(ae,JSON.stringify(t)):e().removeItem(ae)}catch{}},ue=()=>localStorage,ce=()=>sessionStorage,Ae=()=>Ce(ue);$t=new Set});var Wt={};x(Wt,{bucket:()=>zt,pick:()=>Yo,resetChannels:()=>er,versionUrl:()=>Ft});async function Yo(e,t,o){if(typeof o.stable!="string")throw new g("INVALID_MODULE",e,`canal inv\xE1lido em ${t.url}: falta "stable"`);L.watch=Xo;let r={name:e,bucket:zt(e)},{canary:n,stable:s}=o,a=await t.resolve?.(o,r)??(n&&r.bucket<n.percent?n.version:s);return a!==s&&Kt()[e]===a&&(a=s),a===s||t.rollback===!1?N.delete(e):N.get(e)?.from!==a&&N.set(e,{from:a,to:s,errors:0,mounts:0,max:{errors:3,mounts:20,...t.rollback}}),{...t,url:Ft(a,t.url),integrity:void 0,manifest:void 0}}function zt(e){let t=p().settings().canaryKey??Zo(),o=2166136261;for(let r of`${t}:${e}`)o=Math.imul(o^r.charCodeAt(0),16777619);return(o>>>0)%100}function Zo(){try{_??=localStorage.getItem(qt)??void 0}catch{}if(!_){_=Math.random().toString(36).slice(2);try{localStorage.setItem(qt,_)}catch{}}return _}function Kt(){try{return{...JSON.parse(sessionStorage.getItem(Vt)||"{}"),...G}}catch{return G}}function Xo(e,t){for(let[o,r]of N)e!==o&&!e.startsWith(o+"/")||(t?++r.errors>=r.max.errors&&Qo(o,r):++r.mounts>r.max.mounts&&(r.mounts=1,r.errors=0))}function Qo(e,t){N.delete(e),G={...Kt(),[e]:t.from};try{sessionStorage.setItem(Vt,JSON.stringify(G))}catch{}console.warn(`[vitral] ${e}: ${t.errors} erros em ${t.mounts} montagens da vers\xE3o ${t.from}; voltando para ${t.to}`);try{p().settings().onRollback?.({name:e,from:t.from,to:t.to,errors:t.errors,mounts:t.mounts})}catch{}let o=p();o.register(e,o.entry(e)),o.events.emit("vitral:refresh",e)}function er(){N.clear(),G={},_=void 0}var Vt,qt,N,G,_,Ft,Jt=h(()=>{"use strict";w();B();R();k();Vt="vitral:rollback",qt="vitral:id",N=new Map,G={};Ft=(e,t)=>b(/[/:]|\.(m?js|json)$/.test(e)?e:`${e}/vitral.json`,t)});var Gt={};x(Gt,{checkContract:()=>tr});async function tr(e,t=p().settings().contract){let{satisfies:o}=await Promise.resolve().then(()=>(ge(),me));if(e.version&&!o(e.version,t))return`o host aceita contrato ${t}, o remote publica ${e.version}`;let r=p().settings().offered??{};for(let n in e.peers){let s=r[n];if(s&&!o(s,e.peers[n]))return`o remote espera ${n} ${e.peers[n]}, o host oferece ${s}`}}var Yt=h(()=>{"use strict";R()});var Zt={};x(Zt,{stale:()=>or});function or(e,t,o){let r="vitral:manifest:"+e;t.then(n=>localStorage[r]=JSON.stringify({t:Date.now(),m:n})).catch(()=>{});try{let n=JSON.parse(localStorage[r]);if(Date.now()-n.t<o*1e3)return n.m}catch{}return t}var Xt=h(()=>{"use strict"});function Qt(e,t={}){let o=$e(e);o.catch(()=>{}),t.routes&&o.then(nr,()=>{})}function rr(e){let t=e.split;if(!t)return[];if(t.lazy)return t.lazy;let o=t.entry.slice(0,t.entry.lastIndexOf("/")+1),r=new Set([t.entry,...t.chunks,...t.probe??[],...(t.dedupe??[]).flatMap(n=>[n.file,...n.chunks??[]])]);return Object.keys(e.sri??{}).filter(n=>n.startsWith(o)&&n.endsWith(".js")&&!r.has(n))}function nr(e){if(se()!=="all")return;let t=rr(e).slice(),o=()=>t.length&&fetch(t.shift(),{priority:"low"}).then(n=>n.arrayBuffer()).catch(()=>{}).then(o),r=()=>[0,0,0].map(o);typeof requestIdleCallback=="function"?requestIdleCallback(r,{timeout:1e4}):setTimeout(r,1)}function sr(){Ie||(Ie=ft().catch(()=>null),T().catch(()=>{}))}function $e(e,t,o){let r=n=>ir(n,t,o);return(p().entry(e)||!e.includes("/")?r(e).then(n=>ke(e,n)):Promise.resolve().then(()=>(Dt(),It)).then(n=>n.resolveTarget(e,r))).catch(X)}function ir(e,t,o){let r=p();return r.load(e,async()=>{sr();let n;try{let s=r.entry(e),a=s?.url&&!s.module&&!s.manifest&&!to()?lr(s.url,e,o,oo(s)):void 0;await r.pending();let i=await eo(e),l=i?{isolate:r.entry(e)?.isolate,...i}:r.entry(e);if(!l)throw new g("NOT_REGISTERED",e,"remote n\xE3o registrado. Use configure({ remotes }).");if(l.module)return await ar(e,l);let c=performance.now();n=await De(e,l,o,l.url===s?.url?a:void 0),H(e,"manifest",c);let m=n.split?.dedupe;m?.some(d=>d.uses)&&((r.uses??={})[n.split.entry]=Object.fromEntries(m.map(d=>[d.name,d.uses]))),kt(n,(t??n.isolate??r.settings().isolate)==="shadow",o),c=performance.now();let u=await tt(r.settings().retries,()=>cr(e,n));return H(e,"js",c),{...n,module:u?.default??u,exports:u}}catch(s){throw O(S(s)?s:new g("LOAD_FAILED",e,String(s?.message??s),s),n)}})}function eo(e){if(to())return Promise.resolve().then(()=>(Bt(),jt)).then(t=>t.overrideFor(e))}function to(){try{let e="vitral:overrides";return/[?&]vitral=/.test(location.search)||!!(localStorage[e]||sessionStorage[e])}catch{}}async function ar(e,t){let o=t.module;return typeof o=="function"&&(o=await o()),{module:o?.default??o,exports:o,entry:typeof location<"u"?location.href:"http://localhost/",css:t.css??[],isolate:t.isolate}}async function De(e,t,o,r){K(e,t.url);let n=oo(t),s=t.manifest??(new URL(t.url).pathname.endsWith(".json")?await(r??ro(t.url,e,o,n)):{name:e,entry:t.url});if(s?.stable)return De(e,await(await Promise.resolve().then(()=>(Jt(),Wt))).pick(e,t,s),o);if(typeof s?.entry!="string")throw new g("INVALID_MODULE",e,`manifesto inv\xE1lido em ${t.url}`);if(s.contract&&(t.contract||p().settings().contract)){let c=await(await Promise.resolve().then(()=>(Yt(),Gt))).checkContract(s.contract,t.contract);if(c)throw new g("CONTRACT_MISMATCH",e,c)}let a=c=>b(c,t.url),i={};for(let c in s.files??{})i[a(c)]=s.files[c]+n;let l={entry:a(s.entry),css:[...s.css??[],...t.css??[]].map(a),shadow:s.shadow,integrity:t.integrity===!1?void 0:t.integrity??(s.integrity&&s.integrity+n),isolate:t.isolate,scope:s.scope,version:s.version,sri:i,priority:o,split:s.split&&typeof t.integrity!="string"?{entry:a(s.split.entry),chunks:(s.split.chunks??[]).map(a),...s.split.lazy&&{lazy:s.split.lazy.map(a)},sri:i,priority:o,...s.probe&&{probe:s.probe.map(a)},dedupe:s.dedupe?.map(c=>({...c,file:a(c.file),chunks:c.chunks?.map(a)}))}:void 0};K(e,l.entry);for(let c of[l.split?.entry,...(l.split?.dedupe??[]).map(m=>m.file)])c&&K(e,c);if(e===t.url&&s.name){let c=await eo(s.name);if(c)return{...await De(e,c),name:s.name};l.name=s.name,p().entry(s.name)||p().register(s.name,t)}return l}function lr(e,t,o,r){try{if(!new URL(e).pathname.endsWith(".json"))return;K(t,e)}catch{return}let n=ro(e,t,o,r);return n.catch(()=>{}),n}function ro(e,t,o,r){let{timeout:n,maxStale:s}=p().settings(),a=Q(e,n,t,{cache:"no-cache",credentials:"same-origin",priority:o,integrity:r.slice(1)});return s?Promise.resolve().then(()=>(Xt(),Zt)).then(i=>i.stale(e,a,s),()=>a):a}async function cr(e,t){let{timeout:o}=p().settings(),r=s=>F(o,e,import(s)).catch(a=>{throw S(a)?a:new g("LOAD_FAILED",e,`falha ao importar ${t.entry}`,a)});if(!t.integrity){if(!t.split)return r(t.entry);if(t.split.dedupe?.length){let{shared:s,planned:a}=await T();for(let i of a(e,t.split).dedupe)s(p())(i.name,i.range,{version:i.version,url:i.file,load:async()=>(await r(i.file)).default})}return r(t.split.entry)}let n=await Ie;if(!n)throw new g("LOAD_FAILED",e,"n\xE3o foi poss\xEDvel carregar o verificador de integrity");return n.importVerified(e,t,r,o)}function ke(e,t){if(typeof t.module?.mount!="function")throw new g("INVALID_MODULE",e,"o m\xF3dulo n\xE3o exporta mount(). Use defineRemote(), ou loadModule() para m\xF3dulo sem UI.");return t}var Ie,oo,ie=h(()=>{"use strict";oe();ne();w();Oe();U();R();k();oo=e=>(e.keys??[]).map(t=>" ed25519-"+t).join("")});var He={};x(He,{load:()=>po,noFrames:()=>ur});function po(e){throw new g("MOUNT_FAILED",e,"isolate sem suporte no embed.js")}var ur,Ue=h(()=>{"use strict";w();ur=(e,t)=>po(t)});U();ne();w();R();var D={emit:(e,t)=>p().events.emit(e,t),on:(e,t)=>p().events.on(e,t),last:e=>p().events.last(e)};function no(){let e=new Set,t=o=>{let r=()=>(e.delete(r),o());return e.add(r),r};return{bus:{emit:(o,r)=>D.emit(o,r),last:o=>D.last(o),on:(o,r)=>t(D.on(o,r))},track:t,dispose(){for(let o of[...e])o()}}}B();ie();function so(e,t={}){let o=new URL(e,location.href);if(o.origin!==location.origin){location.assign(o.href);return}t.replace?history.replaceState(history.state,"",o.href):history.pushState(history.state,"",o.href),dispatchEvent(new PopStateEvent("popstate",{state:history.state})),D.emit("vitral:navigate",o.pathname+o.search+o.hash)}R();w();var io=new Map,Y=new Map;function co(e,t){return io.set(e,t.entry),$.set(e,t),Y.set(e,(Y.get(e)??0)+1),()=>{let o=Y.get(e)-1;o?Y.set(e,o):(Y.delete(e),io.delete(e),$.delete(e))}}var ao=null;function uo(e,t,o,r){let n=0,s=D.on("vitral:refresh",a=>{if(a!==t&&!t.startsWith(a+"/"))return;let i=++n,l=o,c=r(l).then(m=>{if(e.unmount===lo||i!==n)return m.unmount();let u=e;e=m,u.unmount(),o!==l&&m.update?.(o)});ao?ao.push(c):c.catch(console.error)});return{update(a){o=a,e.update?.(a)},unmount(){s(),e.unmount(),e={unmount:lo}}}}var lo=()=>{};k();async function mo(e,t,o,r={}){return uo(await fo(e,t,o,r),t,o,n=>fo(e,t,n,r))}var dr;async function fo(e,t,o,r){let n=p();await n.pending();let s=r.isolate??pr(t)?.isolate??n.settings().isolate;if(s==="iframe")return(dr??(await Promise.resolve().then(()=>(Ue(),He))).noFrames)(e,t,o,r).catch(X);let{module:a,...i}=await(s=="reframe"?(await Promise.resolve().then(()=>(Ue(),He))).load:$e)(t,s,r.priority),l=co(t,i);L.watch?.(t);let c=i.name??t,m=E=>{let P=document.createElement("div",E);return P.setAttribute("data-vitral-root",c),i.scope&&P.setAttribute("data-vitral-scope",i.scope),P.style.display="contents",P},u=performance.now(),[d,f=document.body,y=null,M=customElements,v=e.appendChild(m())]=await Tt(i,s>"q"&&e,m,r.styles);H(t,"css",u),u=performance.now();let Z=no(),Be=E=>P=>(v.addEventListener(E,P),()=>v.removeEventListener(E,P)),qe={name:c,baseUrl:new URL(".",i.entry).href,events:Z.bus,shadowRoot:y,portalContainer:f,customElements:M,reportError(E){let P=O(S(E)?E:new g("RENDER_FAILED",c,String(E?.message??E),E),i);r.onError?r.onError(P):console.error(P)},navigate:so,protocol:n.protocol,onActivate:Be("vitral:activate"),onDeactivate:Be("vitral:deactivate")};L.shared&&(qe.shared=L.shared(t,Z.track));let de;try{de=await a.mount(v,o,qe),H(t,"mount",u)}catch(E){throw l(),Z.dispose(),d(),v.remove(),O(new g("MOUNT_FAILED",c,"erro ao montar",E),i)}let pe=!0;return{update(E){pe&&de.update?.(E)},unmount(){if(pe){pe=!1;try{de.unmount()}finally{l(),Z.dispose(),d(),v.remove()}}}}}function pr(e){let t=p(),o=e;for(;o&&!t.entry(o);)o=o.slice(0,Math.max(0,o.lastIndexOf("/")));return o?t.entry(o):void 0}w();U();function go(e,t){let{isolate:o}=t,r=f=>f.src?I(f.src,f.name):f.name??"",n=r(t),s=t.props??{},a=null,i=null,l=0,c="loading",m=(f,y=null)=>{c=f,i&&(i.style.display=f==="error"?"none":""),t.onStatus?.(f,y)},u=()=>{a?.unmount(),a=null,i?.remove(),i=null},d=()=>{let f=++l;u(),i=document.createElement("div"),i.setAttribute("data-vitral-slot",n),e.appendChild(i),m("loading");let y=v=>{f===l&&m("error",S(v)?v:new g("MOUNT_FAILED",n,String(v),v))},M=s;mo(i,n,s,{isolate:o,priority:t.priority,styles:t.styles,onError:y}).then(v=>{if(f!==l)return v.unmount();a=v,s!==M&&v.update?.(s),m("ready")},y)};return d(),{update(f){s=f,a?.update?.(f)},set(f){let y=f.src||f.name!==void 0?r(f):n,M=y!==n||"isolate"in f&&f.isolate!==o;n=y,"isolate"in f&&(o=f.isolate),M&&d()},retry:d,destroy(){l++,u()},get status(){return c}}}B();ie();Oe();U();var _e=()=>{};function ho(e){let t={};if(typeof performance>"u"||!performance.getEntriesByName)return t;for(let o of["manifest","js","css","mount"]){let r=performance.getEntriesByName(`vitral:${e}:${o}`,"measure").pop();r&&(t[o]=Math.round(r.duration*10)/10)}return t}function yo(e,t,o){if(t==="lazy"||t==="visible"){if(typeof IntersectionObserver>"u")return o(),_e;let r=new IntersectionObserver(n=>{n.some(s=>s.isIntersecting)&&(r.disconnect(),o())},{rootMargin:"200px"});return r.observe(e),()=>r.disconnect()}if(t==="idle"){if(typeof requestIdleCallback>"u"){let n=setTimeout(o,1);return()=>clearTimeout(n)}let r=requestIdleCallback(o,{timeout:2e3});return()=>cancelIdleCallback(r)}if(t==="hover"){let r=()=>(n(),o()),n=()=>{e.removeEventListener("pointerenter",r),e.removeEventListener("focusin",r)};return e.addEventListener("pointerenter",r),e.addEventListener("focusin",r),n}return o(),_e}var C=new Map,j=null;function vo(e,t){try{e.moveBefore(t,null)}catch{e.appendChild(t)}}function Ne(e,t){for(let o of e.querySelectorAll("*"))o.hasAttribute("data-vitral-root")&&o.dispatchEvent(new Event(t)),o.shadowRoot&&Ne(o.shadowRoot,t)}function fr(e,t,o){C.get(e)?.slot.destroy(),C.delete(e),j?.isConnected||(j=document.createElement("div"),j.hidden=!0,j.setAttribute("data-vitral-keep-alive",""),document.body.appendChild(j)),vo(j,t.box),Ne(t.box,"vitral:deactivate"),C.set(e,t);for(let[r,n]of C){if(C.size<=o)break;C.delete(r),n.slot.destroy(),n.box.remove()}}function Ro(e,t){let{props:o={},keepAlive:r}=t,n=d=>d.src?I(d.src,d.name):d.name??"",s=n(t),a="loading",i=null,l=t.snapshot?L.snapshot?.(e,s,()=>o,()=>i?.box,t.onSnapshot):void 0,c=(d,f)=>{a=d,l?.(d),t.onStatus?.(d,f)},m=t.prefetch&&(t.prefetch!=="idle"||se()!=="lazy")?yo(e,t.prefetch,()=>Qt(s)):_e,u=yo(e,t.loading,()=>{m();let d=r?C.get(s):void 0;if(d){C.delete(s),i=d,i.on=c,vo(e,i.box),i.slot.update(o),Ne(i.box,"vitral:activate"),c(i.slot.status,null);return}let f=e;r&&(f=e.appendChild(document.createElement("div")),f.style.display="contents");let y={box:f,on:c,slot:null};y.slot=go(f,{...t,name:s,src:void 0,props:o,onStatus:(M,v)=>y.on(M,v)}),i=y});return{update(d){o=d,i?.slot.update(d)},set(d){(d.src||d.name!==void 0)&&(s=n(d)),i?.slot.set({...d,src:void 0,name:s})},retry:()=>i?.slot.retry(),destroy(){u(),m(),l?.(),i&&(r&&a==="ready"?fr(s,i,r===!0?5:r):(i.slot.destroy(),i.box!==e&&i.box.remove()),i=null)},get status(){return a}}}U();var mr=typeof HTMLElement>"u"?class{}:HTMLElement,je=class extends mr{static{this.observedAttributes=["name","src","props","isolate"]}#e=null;#t={};get props(){return this.#t}set props(t){this.#t=t??{},this.#e?.update(this.#t)}get status(){return this.#e?.status??"loading"}retry(){this.#e?.retry()}connectedCallback(){if(this.#e)return;let t=this.#n();if(!t)return;this.hasAttribute("props")&&!Object.keys(this.#t).length&&(this.#t=Eo(this.getAttribute("props")));let o=this.getAttribute("keep-alive"),r={name:t,props:this.#t,isolate:this.getAttribute("isolate")||void 0,loading:this.getAttribute("loading"),prefetch:this.getAttribute("prefetch"),priority:this.getAttribute("priority")||void 0,keepAlive:o===null?!1:Number(o)||!0,snapshot:this.hasAttribute("snapshot"),onSnapshot:s=>this.#r=s,styles:{inherit:this.getAttribute("inherit-styles")?.split(/\s+/).filter(Boolean)},onStatus:(s,a)=>{this.setAttribute("data-vitral-status",s),s==="loading"?this.setAttribute("aria-busy","true"):this.removeAttribute("aria-busy");let i=l=>{let c=this.querySelectorAll(`:scope > [slot="${l}"]`);for(let m of c)m.hidden=s!==(l==="fallback"?"loading":"error")||l==="fallback"&&this.#r;return c.length>0};queueMicrotask(()=>{if(this.#e?.status!==s)return;let l={loading:i("fallback"),error:i("error"),ready:!0};this.#s(l[s]||s==="loading"&&this.#r?null:s)}),s==="ready"&&this.dispatchEvent(new CustomEvent("vitral-ready",{bubbles:!0,detail:{timings:ho(t)}})),s==="error"&&this.dispatchEvent(new CustomEvent("vitral-error",{bubbles:!0,detail:{error:a}}))}},n=null;this.#e=Ro(this,r)}#n(){let t=this.getAttribute("src"),o=this.getAttribute("name");return t?I(t,o??void 0,!1):o}#o=null;#r=!1;#s(t){if(this.#o?.remove(),this.#o=null,!t)return;let o=document.createElement("div");if(o.setAttribute("data-vitral-default",t),t==="loading")o.setAttribute("role","status"),o.textContent="Carregando\u2026";else{o.setAttribute("role","alert");let r=document.createElement("button");r.type="button",r.textContent="Tentar de novo",r.onclick=()=>this.retry(),o.append("N\xE3o foi poss\xEDvel carregar. ",r)}this.prepend(this.#o=o)}disconnectedCallback(){queueMicrotask(()=>{this.isConnected||(this.#e?.destroy(),this.#e=null,this.#s(null))})}attributeChangedCallback(t,o,r){if(t==="props")return void(this.props=Eo(r));if(!this.#e)return void(this.isConnected&&this.connectedCallback());if(t==="name"||t==="src"){let n=this.#n();n&&this.#e.set({name:n})}t==="isolate"&&this.#e.set({isolate:r||void 0})}};function Eo(e){if(!e)return{};try{return JSON.parse(e)}catch{return console.error("[vitral] atributo props n\xE3o \xE9 JSON v\xE1lido:",e),{}}}function wo(e="vitral-remote"){typeof customElements<"u"&&!customElements.get(e)&&customElements.define(e,class extends je{})}R();k();var So="data-vitral-embed";function bo(e){let t=e.dataset;if(!t.remote||e.hasAttribute(So))return null;let o=t.target?document.querySelector(t.target):e.closest("body")?e:document.body;if(!o)return document.readyState==="loading"?document.addEventListener("DOMContentLoaded",()=>bo(e),{once:!0}):console.error(`[vitral] data-target n\xE3o encontrado: ${t.target}`),null;e.setAttribute(So,"");let r=b(t.remote);gr([new URL(r).origin,...t.origins?.split(/\s+/).filter(Boolean)??[]]),wo();let n=document.createElement("vitral-remote");return n.setAttribute("isolate",t.isolate||"shadow"),t.loading&&n.setAttribute("loading",t.loading),t.props&&n.setAttribute("props",t.props),t.name&&n.setAttribute("name",t.name),n.setAttribute("src",r),o===e?e.after(n):o.appendChild(n),n}function gr(e){let t=p(),o=t.settings().allowedOrigins??[V(),...t.origins()].filter(Boolean);Re({allowedOrigins:[...new Set([...o,...e])]})}var yr=Symbol.for("vitral:embed"),hr=globalThis[yr]??=bo;typeof document<"u"&&document.currentScript instanceof HTMLScriptElement&&hr(document.currentScript);})();
|
|
2
|
+
`),document.head.appendChild(u)}a.replaceSync(c);let m=[...t,e];return Promise.all(l.filter(u=>!m.includes(u)).map(u=>Lt(u,m))).then(u=>[...u.flat(),a])}).catch(()=>(Ee.delete(e),[])),Ee.set(e,n)),n}function Pt(e){let t=document.documentElement,o=[],r=()=>{e.classList.remove(...o),o=[...t.classList].filter(a=>!e.classList.contains(a)),e.classList.add(...o);let s=t.getAttribute("data-theme");s===null?e.removeAttribute("data-theme"):e.setAttribute("data-theme",s)};r();let n=new MutationObserver(r);return n.observe(t,{attributeFilter:["class","data-theme"]}),()=>n.disconnect()}var Ee,Ho,wt,Uo,_o,we,Se,St,bt,xe=h(()=>{"use strict";ne();Ee=new Map,Ho=()=>{},wt=new Set,Uo=/url\(\s*(['"]?)(?![a-z]+:|\/\/|#)([^'")]+)\1\s*\)/gi,_o=/@property\s+(--[\w-]+)\s*\{[^}]*\}|@font-face\s*\{[^}]*\}|@import\s+(?:url\(\s*)?(?:(['"])(.*?)\2|([^'"\s);]+))\s*\)?[^;]*;/gi;we=new Map,Se=!1,St=e=>Object.getPrototypeOf(e)===customElements,bt=new Map});function Le(e,t,o){let r=`${e} ${t??""}`,n=Me.get(r);return n||(n=z(e,p().settings().timeout,e,{integrity:t,priority:o}).then(s=>new TextDecoder().decode(s)),n.catch(()=>Me.delete(r)),Me.set(r,n)),n}function kt(e,t,o="auto"){if(t&&Vo())Promise.resolve().then(()=>(xe(),Pe)).then(r=>r.prefetch(e,o),Ot);else for(let r of e.css)document.querySelector(`link[href="${r}"]`)||A("preload",r,{as:"style",integrity:e.sri?.[r]??"",fetchPriority:o})}function Tt(e,t,o,r){return t?Promise.resolve().then(()=>(xe(),Pe)).then(n=>n.attachShadowRoot(t,o,e,p().settings().styles,r)):W(e.css,null,e.sri).then(()=>[Ot])}function W(e,t,o={}){let r=t??document,n=Mt.get(r);n||Mt.set(r,n=new Map);let s=t??document.head,a=p().settings().timeout;return Promise.all(e.map(i=>{let l=n.get(i);return l||(l=new Promise(c=>{let m=A("stylesheet",i,{integrity:o[i]??""},s);setTimeout(c,a),m.onload=()=>c(),m.onerror=()=>{m.remove(),n.delete(i),c()}}),n.set(i,l)),l}))}var Mt,Me,Ot,Vo,ne=h(()=>{"use strict";R();k();Mt=new WeakMap,Me=new Map,Ot=()=>{},Vo=()=>typeof CSSStyleSheet<"u"&&"replaceSync"in CSSStyleSheet.prototype});function se(){let e=typeof navigator=="object"?navigator:{},t=e.connection||{};return p().settings().policy||(t.saveData||/2g/.test(t.effectiveType)?"lazy":t.effectiveType=="3g"||e.deviceMemory<=2?"critical":"all")}var Oe=h(()=>{"use strict";R()});var It={};x(It,{resolveModule:()=>zo,resolveTarget:()=>Fo,splitName:()=>Ct});function Ct(e){let t=p(),o=e.length;if(!t.entry(e))for(;(o=e.lastIndexOf("/",o-1))>0&&!t.entry(e.slice(0,o)););return o>0&&o<e.length?[e.slice(0,o),"."+e.slice(o)]:[e,null]}function Fo(e,t){return At(e,t).then(o=>ke(e,o))}function At(e,t){let o=p();return o.entry(e)||!e.includes("/")?t(e):o.pending().then(async()=>{let[r,n]=Ct(e);if(!n)return t(e);let s=await t(r),a=s.exports?.exposes;if(!a?.[n])throw new g("NOT_EXPOSED",e,`${r} n\xE3o exp\xF5e ${n}. Expostos: ${Object.keys(a??{}).join(", ")}`);try{let i=a[n],l=await(typeof i=="function"?i():i);return{...s,module:l?.default??l,exports:l}}catch(i){throw new g("LOAD_FAILED",e,String(i),i)}})}async function zo(e,t){let o=await At(e,t);if(!o.exports)throw new g("INVALID_MODULE",e,"o remote foi carregado por uma c\xF3pia antiga da lib, que n\xE3o guarda os exports");return o.exports}var Dt=h(()=>{"use strict";w();ie();R()});var jt={};x(jt,{OVERRIDES_KEY:()=>ae,activeOverrides:()=>Nt,clearOverrides:()=>Ut,dropOverride:()=>Jo,isRef:()=>Te,manifestUrl:()=>le,overrideFor:()=>Go,overridesEnabled:()=>Ht,resolveOverride:()=>_t,storeOverride:()=>Ko,storedOverrides:()=>Ae});function Ht(){return!!p().settings().devOverrides||typeof location<"u"&&/^(localhost|127\.0\.0\.1|\[::1\])$/.test(location.hostname)}function Ko(e,t){let o=Ae();t?o[e]=Te(t)?t:le(t):delete o[e],J(ue,o)}function Wo(){let e=Ce(ce),t=new URLSearchParams(location.search).getAll("vitral").join(",").split(",");if(!t.some(Boolean))return e;for(let o of t){let r=o.indexOf("@");o==="off"?(Ut(),Object.keys(e).forEach(n=>delete e[n])):r>0&&o.slice(r+1)==="off"?delete e[o.slice(0,r)]:r>0&&(e[o.slice(0,r)]=o.slice(r+1))}return J(ce,e),e}function Ut(){J(ce,{}),J(ue,{})}function Jo(e){for(let t of[ce,ue]){let o=Ce(t);delete o[e],J(t,o)}}function _t(e,t){if(!Te(t))return new URL(le(t),location.href).href;let o=p().settings().devOverrides,r=typeof o=="object"?o.preview:void 0;if(!r)return;let n=r.replace(/\{name\}/g,encodeURIComponent(e)).replace(/\{ref\}/g,encodeURIComponent(t));return new URL(le(n),location.href).href}function Nt(){let e=Wo(),t={};for(let[o,r]of[["navegador",Ae()],["aba",e]])for(let[n,s]of Object.entries(r))t[n]={name:n,value:s,url:_t(n,s),source:o};return Object.values(t)}function Go(e){if(!Ht())return;let t=Nt().find(a=>a.name===e);if(!t)return;let o=!$t.has(e)&&$t.add(e);if(!t.url){o&&console.warn(`[vitral] override ${e}@${t.value} ignorado: falta configure({ devOverrides: { preview } })`);return}let r=p(),n=r.settings().trusted??[],s=new URL(t.url).origin;return n.includes(s)||r.configure({trusted:[...n,s]}),o&&console.warn(`[vitral] override ativo: ${e} \u2192 ${t.url} (${t.source}). Para limpar: ?vitral=off`),{url:t.url}}var ae,le,Te,Ce,J,ue,ce,Ae,$t,Bt=h(()=>{"use strict";R();ae="vitral:overrides";le=e=>/\.(json|m?js)(\?|$)/.test(e)?e:e.replace(/\/?$/,"/vitral.json"),Te=e=>/^[\w.-]+$/.test(e),Ce=e=>{try{return JSON.parse(e().getItem(ae)??"{}")??{}}catch{return{}}},J=(e,t)=>{try{Object.keys(t).length?e().setItem(ae,JSON.stringify(t)):e().removeItem(ae)}catch{}},ue=()=>localStorage,ce=()=>sessionStorage,Ae=()=>Ce(ue);$t=new Set});var Wt={};x(Wt,{bucket:()=>zt,pick:()=>Yo,resetChannels:()=>er,versionUrl:()=>Ft});async function Yo(e,t,o){if(typeof o.stable!="string")throw new g("INVALID_MODULE",e,`canal inv\xE1lido em ${t.url}: falta "stable"`);L.watch=Xo;let r={name:e,bucket:zt(e)},{canary:n,stable:s}=o,a=await t.resolve?.(o,r)??(n&&r.bucket<n.percent?n.version:s);return a!==s&&Kt()[e]===a&&(a=s),a===s||t.rollback===!1?N.delete(e):N.get(e)?.from!==a&&N.set(e,{from:a,to:s,errors:0,mounts:0,max:{errors:3,mounts:20,...t.rollback}}),{...t,url:Ft(a,t.url),integrity:void 0,manifest:void 0}}function zt(e){let t=p().settings().canaryKey??Zo(),o=2166136261;for(let r of`${t}:${e}`)o=Math.imul(o^r.charCodeAt(0),16777619);return(o>>>0)%100}function Zo(){try{_??=localStorage.getItem(qt)??void 0}catch{}if(!_){_=Math.random().toString(36).slice(2);try{localStorage.setItem(qt,_)}catch{}}return _}function Kt(){try{return{...JSON.parse(sessionStorage.getItem(Vt)||"{}"),...G}}catch{return G}}function Xo(e,t){for(let[o,r]of N)e!==o&&!e.startsWith(o+"/")||(t?++r.errors>=r.max.errors&&Qo(o,r):++r.mounts>r.max.mounts&&(r.mounts=1,r.errors=0))}function Qo(e,t){N.delete(e),G={...Kt(),[e]:t.from};try{sessionStorage.setItem(Vt,JSON.stringify(G))}catch{}console.warn(`[vitral] ${e}: ${t.errors} erros em ${t.mounts} montagens da vers\xE3o ${t.from}; voltando para ${t.to}`);try{p().settings().onRollback?.({name:e,from:t.from,to:t.to,errors:t.errors,mounts:t.mounts})}catch{}let o=p();o.register(e,o.entry(e)),o.events.emit("vitral:refresh",e)}function er(){N.clear(),G={},_=void 0}var Vt,qt,N,G,_,Ft,Jt=h(()=>{"use strict";w();B();R();k();Vt="vitral:rollback",qt="vitral:id",N=new Map,G={};Ft=(e,t)=>b(/[/:]|\.(m?js|json)$/.test(e)?e:`${e}/vitral.json`,t)});var Gt={};x(Gt,{checkContract:()=>tr});async function tr(e,t=p().settings().contract){let{satisfies:o}=await Promise.resolve().then(()=>(ge(),me));if(e.version&&!o(e.version,t))return`o host aceita contrato ${t}, o remote publica ${e.version}`;let r=p().settings().offered??{};for(let n in e.peers){let s=r[n];if(s&&!o(s,e.peers[n]))return`o remote espera ${n} ${e.peers[n]}, o host oferece ${s}`}}var Yt=h(()=>{"use strict";R()});var Zt={};x(Zt,{stale:()=>or});function or(e,t,o){let r="vitral:manifest:"+e;t.then(n=>localStorage[r]=JSON.stringify({t:Date.now(),m:n})).catch(()=>{});try{let n=JSON.parse(localStorage[r]);if(Date.now()-n.t<o*1e3)return n.m}catch{}return t}var Xt=h(()=>{"use strict"});function Qt(e,t={}){let o=$e(e);o.catch(()=>{}),t.routes&&o.then(nr,()=>{})}function rr(e){let t=e.split;if(!t)return[];if(t.lazy)return t.lazy;let o=t.entry.slice(0,t.entry.lastIndexOf("/")+1),r=new Set([t.entry,...t.chunks,...t.probe??[],...(t.dedupe??[]).flatMap(n=>[n.file,...n.chunks??[]])]);return Object.keys(e.sri??{}).filter(n=>n.startsWith(o)&&n.endsWith(".js")&&!r.has(n))}function nr(e){if(se()!=="all")return;let t=rr(e).slice(),o=()=>t.length&&fetch(t.shift(),{priority:"low"}).then(n=>n.arrayBuffer()).catch(()=>{}).then(o),r=()=>[0,0,0].map(o);typeof requestIdleCallback=="function"?requestIdleCallback(r,{timeout:1e4}):setTimeout(r,1)}function sr(){Ie||(Ie=ft().catch(()=>null),T().catch(()=>{}))}function $e(e,t,o){let r=n=>ir(n,t,o);return(p().entry(e)||!e.includes("/")?r(e).then(n=>ke(e,n)):Promise.resolve().then(()=>(Dt(),It)).then(n=>n.resolveTarget(e,r))).catch(X)}function ir(e,t,o){let r=p();return r.load(e,async()=>{sr();let n;try{let s=r.entry(e),a=s?.url&&!s.module&&!s.manifest&&!to()?lr(s.url,e,o,oo(s)):void 0;await r.pending();let i=await eo(e),l=i?{isolate:r.entry(e)?.isolate,...i}:r.entry(e);if(!l)throw new g("NOT_REGISTERED",e,"remote n\xE3o registrado. Use configure({ remotes }).");if(l.module)return await ar(e,l);let c=performance.now();n=await De(e,l,o,l.url===s?.url?a:void 0),H(e,"manifest",c);let m=n.split?.dedupe;m?.some(d=>d.uses)&&((r.uses??={})[n.split.entry]=Object.fromEntries(m.map(d=>[d.name,d.uses]))),kt(n,(t??n.isolate??r.settings().isolate)==="shadow",o),c=performance.now();let u=await tt(r.settings().retries,()=>cr(e,n));return H(e,"js",c),{...n,module:u?.default??u,exports:u}}catch(s){throw O(S(s)?s:new g("LOAD_FAILED",e,String(s?.message??s),s),n)}})}function eo(e){if(to())return Promise.resolve().then(()=>(Bt(),jt)).then(t=>t.overrideFor(e))}function to(){try{let e="vitral:overrides";return/[?&]vitral=/.test(location.search)||!!(localStorage[e]||sessionStorage[e])}catch{}}async function ar(e,t){let o=t.module;return typeof o=="function"&&(o=await o()),{module:o?.default??o,exports:o,entry:typeof location<"u"?location.href:"http://localhost/",css:t.css??[],isolate:t.isolate}}async function De(e,t,o,r){K(e,t.url);let n=oo(t),s=t.manifest??(new URL(t.url).pathname.endsWith(".json")?await(r??ro(t.url,e,o,n)):{name:e,entry:t.url});if(s?.stable)return De(e,await(await Promise.resolve().then(()=>(Jt(),Wt))).pick(e,t,s),o);if(typeof s?.entry!="string")throw new g("INVALID_MODULE",e,`manifesto inv\xE1lido em ${t.url}`);if(s.contract&&(t.contract||p().settings().contract)){let c=await(await Promise.resolve().then(()=>(Yt(),Gt))).checkContract(s.contract,t.contract);if(c)throw new g("CONTRACT_MISMATCH",e,c)}let a=c=>b(c,t.url),i={};for(let c in s.files??{})i[a(c)]=s.files[c]+n;let l={entry:a(s.entry),css:[...s.css??[],...t.css??[]].map(a),shadow:s.shadow,integrity:t.integrity===!1?void 0:t.integrity??(s.integrity&&s.integrity+n),isolate:t.isolate,scope:s.scope,version:s.version,sri:i,priority:o,split:s.split&&typeof t.integrity!="string"?{entry:a(s.split.entry),chunks:(s.split.chunks??[]).map(a),...s.split.lazy&&{lazy:s.split.lazy.map(a)},sri:i,priority:o,...s.probe&&{probe:s.probe.map(a)},dedupe:s.dedupe?.map(c=>({...c,file:a(c.file),chunks:c.chunks?.map(a)}))}:void 0};K(e,l.entry);for(let c of[l.split?.entry,...(l.split?.dedupe??[]).map(m=>m.file)])c&&K(e,c);if(e===t.url&&s.name){let c=await eo(s.name);if(c)return{...await De(e,c),name:s.name};l.name=s.name,p().entry(s.name)||p().register(s.name,t)}return l}function lr(e,t,o,r){try{if(!new URL(e).pathname.endsWith(".json"))return;K(t,e)}catch{return}let n=ro(e,t,o,r);return n.catch(()=>{}),n}function ro(e,t,o,r){let{timeout:n,maxStale:s}=p().settings(),a=Q(e,n,t,{cache:"no-cache",credentials:"same-origin",priority:o,integrity:r.slice(1)});return s?Promise.resolve().then(()=>(Xt(),Zt)).then(i=>i.stale(e,a,s),()=>a):a}async function cr(e,t){let{timeout:o}=p().settings(),r=s=>F(o,e,import(s)).catch(a=>{throw S(a)?a:new g("LOAD_FAILED",e,`falha ao importar ${t.entry}`,a)});if(!t.integrity){if(!t.split)return r(t.entry);if(t.split.dedupe?.length){let{shared:s,planned:a}=await T();for(let i of a(e,t.split).dedupe)s(p())(i.name,i.range,{version:i.version,url:i.file,load:async()=>(await r(i.file)).default})}return r(t.split.entry)}let n=await Ie;if(!n)throw new g("LOAD_FAILED",e,"n\xE3o foi poss\xEDvel carregar o verificador de integrity");return n.importVerified(e,t,r,o)}function ke(e,t){if(typeof t.module?.mount!="function")throw new g("INVALID_MODULE",e,"o m\xF3dulo n\xE3o exporta mount(). Use defineRemote(), ou loadModule() para m\xF3dulo sem UI.");return t}var Ie,oo,ie=h(()=>{"use strict";oe();ne();w();Oe();U();R();k();oo=e=>(e.keys??[]).map(t=>" ed25519-"+t).join("")});var He={};x(He,{load:()=>po,noFrames:()=>ur});function po(e){throw new g("MOUNT_FAILED",e,"isolate sem suporte no embed.js")}var ur,Ue=h(()=>{"use strict";w();ur=(e,t)=>po(t)});U();ne();w();R();var D={emit:(e,t)=>p().events.emit(e,t),on:(e,t)=>p().events.on(e,t),last:e=>p().events.last(e)};function no(){let e=new Set,t=o=>{let r=()=>(e.delete(r),o());return e.add(r),r};return{bus:{emit:(o,r)=>D.emit(o,r),last:o=>D.last(o),on:(o,r)=>t(D.on(o,r))},track:t,dispose(){for(let o of[...e])o()}}}B();ie();function so(e,t={}){let o=new URL(e,location.href);if(o.origin!==location.origin){location.assign(o.href);return}t.replace?history.replaceState(history.state,"",o.href):history.pushState(history.state,"",o.href),dispatchEvent(new PopStateEvent("popstate",{state:history.state})),D.emit("vitral:navigate",o.pathname+o.search+o.hash)}R();w();var io=new Map,Y=new Map;function co(e,t){return io.set(e,t.entry),$.set(e,t),Y.set(e,(Y.get(e)??0)+1),()=>{let o=Y.get(e)-1;o?Y.set(e,o):(Y.delete(e),io.delete(e),$.delete(e))}}var ao=null;function uo(e,t,o,r){let n=0,s=D.on("vitral:refresh",a=>{if(a!==t&&!t.startsWith(a+"/"))return;let i=++n,l=o,c=r(l).then(m=>{if(e.unmount===lo||i!==n)return m.unmount();let u=e;e=m,u.unmount(),o!==l&&m.update?.(o)});ao?ao.push(c):c.catch(console.error)});return{update(a){o=a,e.update?.(a)},unmount(){s(),e.unmount(),e={unmount:lo}}}}var lo=()=>{};k();async function mo(e,t,o,r={}){return uo(await fo(e,t,o,r),t,o,n=>fo(e,t,n,r))}var dr;async function fo(e,t,o,r){let n=p();await n.pending();let s=r.isolate??pr(t)?.isolate??n.settings().isolate;if(s==="iframe")return(dr??(await Promise.resolve().then(()=>(Ue(),He))).noFrames)(e,t,o,r).catch(X);let{module:a,...i}=await(s=="reframe"?(await Promise.resolve().then(()=>(Ue(),He))).load:$e)(t,s,r.priority),l=co(t,i);L.watch?.(t);let c=i.name??t,m=E=>{let P=document.createElement("div",E);return P.setAttribute("data-vitral-root",c),i.scope&&P.setAttribute("data-vitral-scope",i.scope),P.style.display="contents",P},u=performance.now(),[d,f=document.body,y=null,M=customElements,v=e.appendChild(m())]=await Tt(i,s>"q"&&e,m,r.styles);H(t,"css",u),u=performance.now();let Z=no(),Be=E=>P=>(v.addEventListener(E,P),()=>v.removeEventListener(E,P)),qe={name:c,baseUrl:new URL(".",i.entry).href,events:Z.bus,shadowRoot:y,portalContainer:f,customElements:M,reportError(E){let P=O(S(E)?E:new g("RENDER_FAILED",c,String(E?.message??E),E),i);r.onError?r.onError(P):console.error(P)},navigate:so,protocol:n.protocol,onActivate:Be("vitral:activate"),onDeactivate:Be("vitral:deactivate")};L.shared&&(qe.shared=L.shared(t,Z.track));let de;try{de=await a.mount(v,o,qe),H(t,"mount",u)}catch(E){throw l(),Z.dispose(),d(),v.remove(),O(new g("MOUNT_FAILED",c,"erro ao montar",E),i)}let pe=!0;return{update(E){pe&&de.update?.(E)},unmount(){if(pe){pe=!1;try{de.unmount()}finally{l(),Z.dispose(),d(),v.remove()}}}}}function pr(e){let t=p(),o=e;for(;o&&!t.entry(o);)o=o.slice(0,Math.max(0,o.lastIndexOf("/")));return o?t.entry(o):void 0}w();U();function go(e,t){let{isolate:o}=t,r=f=>f.src?I(f.src,f.name):f.name??"",n=r(t),s=t.props??{},a=null,i=null,l=0,c="loading",m=(f,y=null)=>{c=f,i&&(i.style.display=f==="error"?"none":""),t.onStatus?.(f,y)},u=()=>{a?.unmount(),a=null,i?.remove(),i=null},d=()=>{let f=++l;u(),i=document.createElement("div"),i.setAttribute("data-vitral-slot",n),e.appendChild(i),m("loading");let y=v=>{f===l&&m("error",S(v)?v:new g("MOUNT_FAILED",n,String(v),v))},M=s;mo(i,n,s,{isolate:o,priority:t.priority,styles:t.styles,onError:y}).then(v=>{if(f!==l)return v.unmount();a=v,s!==M&&v.update?.(s),m("ready")},y)};return d(),{update(f){s=f,a?.update?.(f)},set(f){let y=f.src||f.name!==void 0?r(f):n,M=y!==n||"isolate"in f&&f.isolate!==o;n=y,"isolate"in f&&(o=f.isolate),M&&d()},retry:d,destroy(){l++,u()},get status(){return c}}}B();ie();Oe();U();var _e=()=>{};function ho(e){let t={};if(typeof performance>"u"||!performance.getEntriesByName)return t;for(let o of["manifest","js","css","mount"]){let r=performance.getEntriesByName(`vitral:${e}:${o}`,"measure").pop();r&&(t[o]=Math.round(r.duration*10)/10)}return t}function yo(e,t,o){if(t==="lazy"||t==="visible"){if(typeof IntersectionObserver>"u")return o(),_e;let r=new IntersectionObserver(n=>{n.some(s=>s.isIntersecting)&&(r.disconnect(),o())},{rootMargin:"200px"});return r.observe(e),()=>r.disconnect()}if(t==="idle"){if(typeof requestIdleCallback>"u"){let n=setTimeout(o,1);return()=>clearTimeout(n)}let r=requestIdleCallback(o,{timeout:2e3});return()=>cancelIdleCallback(r)}if(t==="hover"){let r=()=>(n(),o()),n=()=>{e.removeEventListener("pointerenter",r),e.removeEventListener("focusin",r)};return e.addEventListener("pointerenter",r),e.addEventListener("focusin",r),n}return o(),_e}var C=new Map,j=null;function vo(e,t){try{e.moveBefore(t,null)}catch{e.appendChild(t)}}function Ne(e,t){for(let o of e.querySelectorAll("*"))o.hasAttribute("data-vitral-root")&&o.dispatchEvent(new Event(t)),o.shadowRoot&&Ne(o.shadowRoot,t)}function fr(e,t,o){C.get(e)?.slot.destroy(),C.delete(e),j?.isConnected||(j=document.createElement("div"),j.hidden=!0,j.setAttribute("data-vitral-keep-alive",""),document.body.appendChild(j)),vo(j,t.box),Ne(t.box,"vitral:deactivate"),C.set(e,t);for(let[r,n]of C){if(C.size<=o)break;C.delete(r),n.slot.destroy(),n.box.remove()}}function Ro(e,t){let{props:o={},keepAlive:r}=t,n=d=>d.src?I(d.src,d.name):d.name??"",s=n(t),a="loading",i=null,l=t.snapshot?L.snapshot?.(e,s,()=>o,()=>i?.box,t.onSnapshot):void 0,c=(d,f)=>{a=d,l?.(d),t.onStatus?.(d,f)},m=t.prefetch&&(t.prefetch!=="idle"||se()!=="lazy")?yo(e,t.prefetch,()=>Qt(s)):_e,u=yo(e,t.loading,()=>{m();let d=r?C.get(s):void 0;if(d){C.delete(s),i=d,i.on=c,vo(e,i.box),i.slot.update(o),Ne(i.box,"vitral:activate"),c(i.slot.status,null);return}let f=e;r&&(f=e.appendChild(document.createElement("div")),f.style.display="contents");let y={box:f,on:c,slot:null};y.slot=go(f,{...t,name:s,src:void 0,props:o,onStatus:(M,v)=>y.on(M,v)}),i=y});return{update(d){o=d,i?.slot.update(d)},set(d){(d.src||d.name!==void 0)&&(s=n(d)),i?.slot.set({...d,src:void 0,name:s})},retry:()=>i?.slot.retry(),destroy(){u(),m(),l?.(),i&&(r&&a==="ready"?fr(s,i,r===!0?5:r):(i.slot.destroy(),i.box!==e&&i.box.remove()),i=null)},get status(){return a}}}U();var mr=typeof HTMLElement>"u"?class{}:HTMLElement,je=class extends mr{static get observedAttributes(){return["name","src","props","isolate"]}#e=null;#t={};get props(){return this.#t}set props(t){this.#t=t??{},this.#e?.update(this.#t)}get status(){return this.#e?.status??"loading"}retry(){this.#e?.retry()}connectedCallback(){if(this.#e)return;let t=this.#n();if(!t)return;this.hasAttribute("props")&&!Object.keys(this.#t).length&&(this.#t=Eo(this.getAttribute("props")));let o=this.getAttribute("keep-alive"),r={name:t,props:this.#t,isolate:this.getAttribute("isolate")||void 0,loading:this.getAttribute("loading"),prefetch:this.getAttribute("prefetch"),priority:this.getAttribute("priority")||void 0,keepAlive:o===null?!1:Number(o)||!0,snapshot:this.hasAttribute("snapshot"),onSnapshot:s=>this.#r=s,styles:{inherit:this.getAttribute("inherit-styles")?.split(/\s+/).filter(Boolean)},onStatus:(s,a)=>{this.setAttribute("data-vitral-status",s),s==="loading"?this.setAttribute("aria-busy","true"):this.removeAttribute("aria-busy");let i=l=>{let c=this.querySelectorAll(`:scope > [slot="${l}"]`);for(let m of c)m.hidden=s!==(l==="fallback"?"loading":"error")||l==="fallback"&&this.#r;return c.length>0};queueMicrotask(()=>{if(this.#e?.status!==s)return;let l={loading:i("fallback"),error:i("error"),ready:!0};this.#s(l[s]||s==="loading"&&this.#r?null:s)}),s==="ready"&&this.dispatchEvent(new CustomEvent("vitral-ready",{bubbles:!0,detail:{timings:ho(t)}})),s==="error"&&this.dispatchEvent(new CustomEvent("vitral-error",{bubbles:!0,detail:{error:a}}))}},n=null;this.#e=Ro(this,r)}#n(){let t=this.getAttribute("src"),o=this.getAttribute("name");return t?I(t,o??void 0,!1):o}#o=null;#r=!1;#s(t){if(this.#o?.remove(),this.#o=null,!t)return;let o=document.createElement("div");if(o.setAttribute("data-vitral-default",t),t==="loading")o.setAttribute("role","status"),o.textContent="Carregando\u2026";else{o.setAttribute("role","alert");let r=document.createElement("button");r.type="button",r.textContent="Tentar de novo",r.onclick=()=>this.retry(),o.append("N\xE3o foi poss\xEDvel carregar. ",r)}this.prepend(this.#o=o)}disconnectedCallback(){queueMicrotask(()=>{this.isConnected||(this.#e?.destroy(),this.#e=null,this.#s(null))})}attributeChangedCallback(t,o,r){if(t==="props")return void(this.props=Eo(r));if(!this.#e)return void(this.isConnected&&this.connectedCallback());if(t==="name"||t==="src"){let n=this.#n();n&&this.#e.set({name:n})}t==="isolate"&&this.#e.set({isolate:r||void 0})}};function Eo(e){if(!e)return{};try{return JSON.parse(e)}catch{return console.error("[vitral] atributo props n\xE3o \xE9 JSON v\xE1lido:",e),{}}}function wo(e="vitral-remote"){typeof customElements<"u"&&!customElements.get(e)&&customElements.define(e,class extends je{})}R();k();var So="data-vitral-embed";function bo(e){let t=e.dataset;if(!t.remote||e.hasAttribute(So))return null;let o=t.target?document.querySelector(t.target):e.closest("body")?e:document.body;if(!o)return document.readyState==="loading"?document.addEventListener("DOMContentLoaded",()=>bo(e),{once:!0}):console.error(`[vitral] data-target n\xE3o encontrado: ${t.target}`),null;e.setAttribute(So,"");let r=b(t.remote);gr([new URL(r).origin,...t.origins?.split(/\s+/).filter(Boolean)??[]]),wo();let n=document.createElement("vitral-remote");return n.setAttribute("isolate",t.isolate||"shadow"),t.loading&&n.setAttribute("loading",t.loading),t.props&&n.setAttribute("props",t.props),t.name&&n.setAttribute("name",t.name),n.setAttribute("src",r),o===e?e.after(n):o.appendChild(n),n}function gr(e){let t=p(),o=t.settings().allowedOrigins??[V(),...t.origins()].filter(Boolean);Re({allowedOrigins:[...new Set([...o,...e])]})}var yr=Symbol.for("vitral:embed"),hr=globalThis[yr]??=bo;typeof document<"u"&&document.currentScript instanceof HTMLScriptElement&&hr(document.currentScript);})();
|
package/dist/next-host.js
CHANGED
package/dist/next.d.ts
CHANGED
|
@@ -118,7 +118,7 @@ type ImageProps = Omit<ImgHTMLAttributes<HTMLImageElement>, 'src' | 'width' | 'h
|
|
|
118
118
|
}) => string;
|
|
119
119
|
onLoadingComplete?: (img: HTMLImageElement) => void;
|
|
120
120
|
};
|
|
121
|
-
declare const Image: react.ForwardRefExoticComponent<Omit<ImgHTMLAttributes<HTMLImageElement>, "
|
|
121
|
+
declare const Image: react.ForwardRefExoticComponent<Omit<ImgHTMLAttributes<HTMLImageElement>, "height" | "width" | "loading" | "src"> & {
|
|
122
122
|
src: string | StaticImage;
|
|
123
123
|
alt: string;
|
|
124
124
|
width?: number | string;
|
package/dist/react.js
CHANGED
package/dist/vue.d.ts
CHANGED
|
@@ -127,9 +127,9 @@ declare const VitralRemote: vue.DefineComponent<vue.ExtractPropTypes<{
|
|
|
127
127
|
onError?: ((...args: any[]) => any) | undefined;
|
|
128
128
|
onReady?: ((...args: any[]) => any) | undefined;
|
|
129
129
|
}>, {
|
|
130
|
+
name: string;
|
|
130
131
|
isolate: Isolation;
|
|
131
132
|
priority: RequestPriority;
|
|
132
|
-
name: string;
|
|
133
133
|
loading: Loading;
|
|
134
134
|
src: string;
|
|
135
135
|
props: Props;
|
package/dist/vue.js
CHANGED
|
@@ -84,7 +84,7 @@ function useShared(key, select) {
|
|
|
84
84
|
if (getCurrentScope()) onScopeDispose(off);
|
|
85
85
|
return select ? computed(() => state.value) : computed({ get: () => state.value, set: handle.set });
|
|
86
86
|
}
|
|
87
|
-
var VitralRemote = defineComponent({
|
|
87
|
+
var VitralRemote = /* @__PURE__ */ defineComponent({
|
|
88
88
|
name: "VitralRemote",
|
|
89
89
|
props: {
|
|
90
90
|
/** Nome registrado. Com `src`, o nome sob o qual a URL é registrada. */
|
package/package.json
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "vitral",
|
|
3
|
-
"version": "0.11.
|
|
4
|
-
"description": "Micro-frontends
|
|
3
|
+
"version": "0.11.2",
|
|
4
|
+
"description": "Micro-frontends com qualquer framework, sem configurar build no host. React, Next.js, Vue, Nuxt, Angular, Svelte e outros na mesma página.",
|
|
5
5
|
"keywords": [
|
|
6
6
|
"micro-frontend",
|
|
7
7
|
"micro-frontends",
|
|
@@ -27,7 +27,11 @@
|
|
|
27
27
|
"astro",
|
|
28
28
|
"lit",
|
|
29
29
|
"web-components",
|
|
30
|
-
"typescript"
|
|
30
|
+
"typescript",
|
|
31
|
+
"micro-frontend-framework",
|
|
32
|
+
"module-federation-alternative",
|
|
33
|
+
"nextjs-multi-zones",
|
|
34
|
+
"multi-zones"
|
|
31
35
|
],
|
|
32
36
|
"homepage": "https://joaogabriel15.github.io/vitral/",
|
|
33
37
|
"bugs": {
|
|
@@ -278,8 +282,7 @@
|
|
|
278
282
|
"./expose-*",
|
|
279
283
|
"./capture-*",
|
|
280
284
|
"./channel-*",
|
|
281
|
-
"./hydrate-*"
|
|
282
|
-
"./portals-*"
|
|
285
|
+
"./hydrate-*"
|
|
283
286
|
],
|
|
284
287
|
"limit": "5.11 kB"
|
|
285
288
|
},
|
|
@@ -298,8 +301,7 @@
|
|
|
298
301
|
"./expose-*",
|
|
299
302
|
"./capture-*",
|
|
300
303
|
"./channel-*",
|
|
301
|
-
"./hydrate-*"
|
|
302
|
-
"./portals-*"
|
|
304
|
+
"./hydrate-*"
|
|
303
305
|
],
|
|
304
306
|
"limit": "6.10 kB"
|
|
305
307
|
},
|
|
@@ -341,8 +343,7 @@
|
|
|
341
343
|
"./expose-*",
|
|
342
344
|
"./capture-*",
|
|
343
345
|
"./channel-*",
|
|
344
|
-
"./hydrate-*"
|
|
345
|
-
"./portals-*"
|
|
346
|
+
"./hydrate-*"
|
|
346
347
|
],
|
|
347
348
|
"limit": "5.79 kB"
|
|
348
349
|
},
|
|
@@ -361,8 +362,7 @@
|
|
|
361
362
|
"./expose-*",
|
|
362
363
|
"./capture-*",
|
|
363
364
|
"./channel-*",
|
|
364
|
-
"./hydrate-*"
|
|
365
|
-
"./portals-*"
|
|
365
|
+
"./hydrate-*"
|
|
366
366
|
],
|
|
367
367
|
"limit": "6.01 kB"
|
|
368
368
|
},
|
|
@@ -408,10 +408,9 @@
|
|
|
408
408
|
"./expose-*",
|
|
409
409
|
"./capture-*",
|
|
410
410
|
"./channel-*",
|
|
411
|
-
"./hydrate-*"
|
|
412
|
-
"./portals-*"
|
|
411
|
+
"./hydrate-*"
|
|
413
412
|
],
|
|
414
|
-
"limit": "
|
|
413
|
+
"limit": "7.15 kB"
|
|
415
414
|
},
|
|
416
415
|
{
|
|
417
416
|
"name": "vue",
|
|
@@ -429,8 +428,7 @@
|
|
|
429
428
|
"./expose-*",
|
|
430
429
|
"./capture-*",
|
|
431
430
|
"./channel-*",
|
|
432
|
-
"./hydrate-*"
|
|
433
|
-
"./portals-*"
|
|
431
|
+
"./hydrate-*"
|
|
434
432
|
],
|
|
435
433
|
"limit": "6.51 kB"
|
|
436
434
|
},
|
|
@@ -449,8 +447,7 @@
|
|
|
449
447
|
"./expose-*",
|
|
450
448
|
"./capture-*",
|
|
451
449
|
"./channel-*",
|
|
452
|
-
"./hydrate-*"
|
|
453
|
-
"./portals-*"
|
|
450
|
+
"./hydrate-*"
|
|
454
451
|
],
|
|
455
452
|
"limit": "6.93 kB"
|
|
456
453
|
},
|
|
@@ -475,8 +472,7 @@
|
|
|
475
472
|
"./expose-*",
|
|
476
473
|
"./capture-*",
|
|
477
474
|
"./channel-*",
|
|
478
|
-
"./hydrate-*"
|
|
479
|
-
"./portals-*"
|
|
475
|
+
"./hydrate-*"
|
|
480
476
|
]
|
|
481
477
|
},
|
|
482
478
|
{
|
|
@@ -489,8 +485,7 @@
|
|
|
489
485
|
"./stale-*",
|
|
490
486
|
"./channel-*",
|
|
491
487
|
"./reframe-*",
|
|
492
|
-
"./hydrate-*"
|
|
493
|
-
"./portals-*"
|
|
488
|
+
"./hydrate-*"
|
|
494
489
|
]
|
|
495
490
|
},
|
|
496
491
|
{
|
|
@@ -532,8 +527,7 @@
|
|
|
532
527
|
"./stale-*",
|
|
533
528
|
"./channel-*",
|
|
534
529
|
"./reframe-*",
|
|
535
|
-
"./hydrate-*"
|
|
536
|
-
"./portals-*"
|
|
530
|
+
"./hydrate-*"
|
|
537
531
|
]
|
|
538
532
|
},
|
|
539
533
|
{
|
package/dist/portals-RLXKPXBZ.js
DELETED
|
@@ -1,24 +0,0 @@
|
|
|
1
|
-
import "./chunk-MLKGABMK.js";
|
|
2
|
-
|
|
3
|
-
// src/core/portals.ts
|
|
4
|
-
function scopePortals(root, scope) {
|
|
5
|
-
const owner = (node) => {
|
|
6
|
-
const key = Object.keys(node).find((k) => k.startsWith("__reactFiber$"));
|
|
7
|
-
for (let f = key && node[key]; f; f = f.return) {
|
|
8
|
-
const s = f.stateNode;
|
|
9
|
-
if (s && s !== node && s.nodeType === 1 && root.contains(s)) return true;
|
|
10
|
-
if (f.tag === 3) return s?.containerInfo === root;
|
|
11
|
-
}
|
|
12
|
-
return false;
|
|
13
|
-
};
|
|
14
|
-
const mark = (n) => {
|
|
15
|
-
if (n instanceof Element && !n.hasAttribute("data-vitral-scope") && owner(n)) n.setAttribute("data-vitral-scope", scope);
|
|
16
|
-
};
|
|
17
|
-
const watch = new MutationObserver((list) => list.forEach((r) => r.addedNodes.forEach(mark)));
|
|
18
|
-
watch.observe(document.body, { childList: true });
|
|
19
|
-
document.body.childNodes.forEach(mark);
|
|
20
|
-
return () => watch.disconnect();
|
|
21
|
-
}
|
|
22
|
-
export {
|
|
23
|
-
scopePortals
|
|
24
|
-
};
|