@otea/cli 0.0.0-stage → 0.1.0
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/LICENSE +661 -0
- package/README.es.md +151 -0
- package/README.md +252 -2
- package/THIRD_PARTY_NOTICES.md +114 -0
- package/bin/otea.mjs +28 -0
- package/dist/app/agent-detail.js +26 -0
- package/dist/app/agent-draft.js +429 -0
- package/dist/app/agent-prompts.js +52 -0
- package/dist/app/agents.js +77 -0
- package/dist/app/asking.js +43 -0
- package/dist/app/board-archive.js +243 -0
- package/dist/app/board-migration.js +272 -0
- package/dist/app/boards.js +870 -0
- package/dist/app/branch-owner.js +48 -0
- package/dist/app/brief.js +53 -0
- package/dist/app/choices.js +61 -0
- package/dist/app/collections.js +101 -0
- package/dist/app/context.js +1 -0
- package/dist/app/crop.js +56 -0
- package/dist/app/devices.js +62 -0
- package/dist/app/draft-request.js +82 -0
- package/dist/app/events.js +12 -0
- package/dist/app/evidence.js +287 -0
- package/dist/app/gates.js +610 -0
- package/dist/app/guide.js +37 -0
- package/dist/app/home.js +145 -0
- package/dist/app/init-boards.js +36 -0
- package/dist/app/intake.js +25 -0
- package/dist/app/item-search.js +141 -0
- package/dist/app/items.js +318 -0
- package/dist/app/keep-waiting.js +44 -0
- package/dist/app/land-order.js +107 -0
- package/dist/app/language.js +52 -0
- package/dist/app/launcher.js +56 -0
- package/dist/app/lease-take.js +54 -0
- package/dist/app/leases.js +86 -0
- package/dist/app/machine.js +39 -0
- package/dist/app/merged.js +89 -0
- package/dist/app/migrate.js +171 -0
- package/dist/app/next.js +1637 -0
- package/dist/app/notes.js +319 -0
- package/dist/app/notify-targets.js +113 -0
- package/dist/app/opened.js +25 -0
- package/dist/app/owner-only.js +34 -0
- package/dist/app/performance.js +28 -0
- package/dist/app/phone.js +97 -0
- package/dist/app/presence.js +596 -0
- package/dist/app/preset-views.js +25 -0
- package/dist/app/presets.js +129 -0
- package/dist/app/priority.js +156 -0
- package/dist/app/profile.js +86 -0
- package/dist/app/project.js +247 -0
- package/dist/app/proofs.js +179 -0
- package/dist/app/questions.js +215 -0
- package/dist/app/reader-filter.js +58 -0
- package/dist/app/relations.js +164 -0
- package/dist/app/relay.js +98 -0
- package/dist/app/repos.js +176 -0
- package/dist/app/restart.js +92 -0
- package/dist/app/set-aside.js +64 -0
- package/dist/app/system-locale.js +6 -0
- package/dist/app/tailscale-cli.js +77 -0
- package/dist/app/tailscale-testing.js +41 -0
- package/dist/app/tailscale.js +177 -0
- package/dist/app/tips.js +30 -0
- package/dist/app/topics-everywhere.js +53 -0
- package/dist/app/topics.js +453 -0
- package/dist/app/undo.js +52 -0
- package/dist/app/validate.js +131 -0
- package/dist/app/watch.js +48 -0
- package/dist/cli/command.js +44 -0
- package/dist/cli/commands.js +3303 -0
- package/dist/cli/exit-codes.js +70 -0
- package/dist/cli/forge.js +176 -0
- package/dist/cli/format.js +340 -0
- package/dist/cli/gh.js +17 -0
- package/dist/cli/gitrepo.js +489 -0
- package/dist/cli/help.js +101 -0
- package/dist/cli/hooks.js +232 -0
- package/dist/cli/main.js +37 -0
- package/dist/cli/merged-outside.js +58 -0
- package/dist/cli/names.js +154 -0
- package/dist/cli/opener.js +21 -0
- package/dist/cli/owner.js +154 -0
- package/dist/cli/phone.js +221 -0
- package/dist/cli/ports.js +24 -0
- package/dist/cli/probe.js +18 -0
- package/dist/cli/run.js +246 -0
- package/dist/cli/serve-file.js +21 -0
- package/dist/cli/stats.js +55 -0
- package/dist/cli/version.js +3 -0
- package/dist/core/agent-guide.js +31 -0
- package/dist/core/agent-prompts.js +139 -0
- package/dist/core/authority.js +94 -0
- package/dist/core/board/analysis.js +86 -0
- package/dist/core/board/choices.js +100 -0
- package/dist/core/board/compile.js +362 -0
- package/dist/core/board/engine.js +523 -0
- package/dist/core/board/hints.js +46 -0
- package/dist/core/board/history.js +146 -0
- package/dist/core/board/ids.js +87 -0
- package/dist/core/board/joins.js +30 -0
- package/dist/core/board/mentions.js +68 -0
- package/dist/core/board/merged.js +18 -0
- package/dist/core/board/model.js +135 -0
- package/dist/core/board/next.js +1116 -0
- package/dist/core/board/notes.js +298 -0
- package/dist/core/board/performance.js +218 -0
- package/dist/core/board/plan.js +299 -0
- package/dist/core/board/problems.js +232 -0
- package/dist/core/board/proofs.js +84 -0
- package/dist/core/board/questions.js +114 -0
- package/dist/core/board/reading.js +220 -0
- package/dist/core/board/readings.js +534 -0
- package/dist/core/board/schema.js +335 -0
- package/dist/core/board/shape-words.js +179 -0
- package/dist/core/board/template-words.js +23 -0
- package/dist/core/board/templates-catalogue.js +965 -0
- package/dist/core/board/templates-coverage.js +261 -0
- package/dist/core/board/templates-flows.js +779 -0
- package/dist/core/board/templates.js +586 -0
- package/dist/core/brief.js +93 -0
- package/dist/core/diagram.js +80 -0
- package/dist/core/errors.js +12 -0
- package/dist/core/evidence.js +33 -0
- package/dist/core/fields.js +129 -0
- package/dist/core/hierarchy.js +30 -0
- package/dist/core/icons.js +181 -0
- package/dist/core/image-crop.js +166 -0
- package/dist/core/item.js +49 -0
- package/dist/core/lease.js +31 -0
- package/dist/core/modules.js +318 -0
- package/dist/core/notify/planner.js +117 -0
- package/dist/core/notify/signals.js +66 -0
- package/dist/core/notify/text.js +60 -0
- package/dist/core/path-key.js +22 -0
- package/dist/core/placement.js +161 -0
- package/dist/core/preset-labels.js +66 -0
- package/dist/core/preset-notes.js +109 -0
- package/dist/core/preset.js +541 -0
- package/dist/core/profile.js +55 -0
- package/dist/core/project-id.js +20 -0
- package/dist/core/refusal.js +1 -0
- package/dist/core/relations.js +208 -0
- package/dist/core/repo.js +54 -0
- package/dist/core/samples.js +161 -0
- package/dist/core/search-words.js +68 -0
- package/dist/core/test-report.js +120 -0
- package/dist/core/time.js +8 -0
- package/dist/core/validation.js +60 -0
- package/dist/core/views.js +171 -0
- package/dist/core/workflow.js +51 -0
- package/dist/mcp/commands.js +101 -0
- package/dist/mcp/server.js +239 -0
- package/dist/mcp/words.js +95 -0
- package/dist/server/boards.js +232 -0
- package/dist/server/changes.js +42 -0
- package/dist/server/diff-tip.js +83 -0
- package/dist/server/drift.js +87 -0
- package/dist/server/errors.js +87 -0
- package/dist/server/evidence.js +82 -0
- package/dist/server/hosts.js +6 -0
- package/dist/server/hub.js +98 -0
- package/dist/server/lan-access.js +62 -0
- package/dist/server/lan.js +164 -0
- package/dist/server/listen.js +70 -0
- package/dist/server/notifier.js +156 -0
- package/dist/server/notify-api.js +151 -0
- package/dist/server/pairing.js +124 -0
- package/dist/server/projects.js +191 -0
- package/dist/server/push.js +199 -0
- package/dist/server/server.js +960 -0
- package/dist/server/session.js +43 -0
- package/dist/server/stream.js +36 -0
- package/dist/server/test-push.js +38 -0
- package/dist/server/token.js +37 -0
- package/dist/server/transports.js +54 -0
- package/dist/server/ui.js +44 -0
- package/dist/server/writes.js +361 -0
- package/dist/server/wrong-address.js +36 -0
- package/dist/store/boards.js +111 -0
- package/dist/store/database.js +45 -0
- package/dist/store/machine.js +77 -0
- package/dist/store/migrations.js +493 -0
- package/dist/store/queries.js +585 -0
- package/dist/store/registry.js +72 -0
- package/package.json +73 -4
- package/presets/architecture/playbook.md +69 -0
- package/presets/architecture/preset.yaml +80 -0
- package/presets/architecture/samples.yaml +23 -0
- package/presets/bug-triage/playbook.md +129 -0
- package/presets/bug-triage/preset.yaml +127 -0
- package/presets/bug-triage/samples/wall-slide-after.png +0 -0
- package/presets/bug-triage/samples/wall-slide-before.png +0 -0
- package/presets/bug-triage/samples.yaml +72 -0
- package/presets/change/playbook.md +115 -0
- package/presets/change/preset.yaml +141 -0
- package/presets/change/samples.yaml +62 -0
- package/presets/review/playbook.md +51 -0
- package/presets/review/preset.yaml +62 -0
- package/presets/review/samples.yaml +27 -0
- package/presets/tasks/playbook.md +78 -0
- package/presets/tasks/preset.yaml +61 -0
- package/presets/tasks/samples.yaml +46 -0
- package/schemas/board.schema.json +764 -0
- package/ui/dist/THIRD_PARTY_NOTICES.md +114 -0
- package/ui/dist/assets/dm-mono-latin-400-normal--0xN8mdc.woff +0 -0
- package/ui/dist/assets/dm-mono-latin-400-normal-4GdczIuU.woff2 +0 -0
- package/ui/dist/assets/dm-mono-latin-500-normal-CN8Miw6E.woff +0 -0
- package/ui/dist/assets/dm-mono-latin-500-normal-DRMDZjhP.woff2 +0 -0
- package/ui/dist/assets/dm-mono-latin-ext-400-normal-1aZr6b2b.woff +0 -0
- package/ui/dist/assets/dm-mono-latin-ext-400-normal-C2zvOubV.woff2 +0 -0
- package/ui/dist/assets/dm-mono-latin-ext-500-normal-BtRyHRi6.woff2 +0 -0
- package/ui/dist/assets/dm-mono-latin-ext-500-normal-Dw3M13d8.woff +0 -0
- package/ui/dist/assets/index-C3OzJope.js +103 -0
- package/ui/dist/assets/index-COdEjckQ.css +1 -0
- package/ui/dist/assets/newsreader-latin-ext-opsz-italic-CSPGnFdO.woff2 +0 -0
- package/ui/dist/assets/newsreader-latin-ext-opsz-normal-BQn1nviT.woff2 +0 -0
- package/ui/dist/assets/newsreader-latin-opsz-italic-kJKFiXvB.woff2 +0 -0
- package/ui/dist/assets/newsreader-latin-opsz-normal-s-izfB6B.woff2 +0 -0
- package/ui/dist/assets/newsreader-vietnamese-opsz-italic-DTr-ymY4.woff2 +0 -0
- package/ui/dist/assets/newsreader-vietnamese-opsz-normal-BjhtXyW2.woff2 +0 -0
- package/ui/dist/assets/pdf-YwugTw7Y.js +54 -0
- package/ui/dist/assets/pdf-engine-CkBopwck.js +1 -0
- package/ui/dist/assets/pdf-rELvHkft.js +56 -0
- package/ui/dist/assets/pdf.worker.min-B5Yc7dP4.mjs +27 -0
- package/ui/dist/assets/pdf.worker.min-B7U8ptvh.js +1 -0
- package/ui/dist/assets/pdf.worker.min-CIqJB0yW.mjs +28 -0
- package/ui/dist/assets/pdf.worker.min-UqOn5EDC.js +1 -0
- package/ui/dist/assets/schibsted-grotesk-latin-ext-wght-normal-hsMS0n0O.woff2 +0 -0
- package/ui/dist/assets/schibsted-grotesk-latin-wght-normal-Bb8VGrTG.woff2 +0 -0
- package/ui/dist/icons/apple-touch-icon.png +0 -0
- package/ui/dist/icons/otea-192.png +0 -0
- package/ui/dist/icons/otea-512.png +0 -0
- package/ui/dist/icons/otea-badge.png +0 -0
- package/ui/dist/icons/otea-maskable-512.png +0 -0
- package/ui/dist/index.html +25 -0
- package/ui/dist/manifest.webmanifest +24 -0
- package/ui/dist/otea-idle.svg +5 -0
- package/ui/dist/otea-working.svg +5 -0
- package/ui/dist/otea-yours-working.svg +5 -0
- package/ui/dist/otea-yours.svg +5 -0
- package/ui/dist/sw.js +1 -0
|
@@ -0,0 +1 @@
|
|
|
1
|
+
var e=`/assets/pdf.worker.min-CIqJB0yW.mjs`;export{e as default};
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
@@ -0,0 +1,25 @@
|
|
|
1
|
+
<!doctype html>
|
|
2
|
+
<html lang="en">
|
|
3
|
+
<head>
|
|
4
|
+
<meta charset="UTF-8" />
|
|
5
|
+
<meta name="viewport" content="width=device-width, initial-scale=1, viewport-fit=cover" />
|
|
6
|
+
<meta name="color-scheme" content="light dark" />
|
|
7
|
+
<link rel="icon" type="image/svg+xml" href="/otea-idle.svg" />
|
|
8
|
+
<!-- Add to Home Screen: a manifest everywhere; over HTTPS a service worker too (offline/register.ts).
|
|
9
|
+
With the session: a browser sends no cookie with a manifest request unless the link asks. -->
|
|
10
|
+
<link rel="manifest" href="/manifest.webmanifest" crossorigin="use-credentials" />
|
|
11
|
+
<meta name="theme-color" media="(prefers-color-scheme: light)" content="#f7f8fc" />
|
|
12
|
+
<meta name="theme-color" media="(prefers-color-scheme: dark)" content="#13161c" />
|
|
13
|
+
<link rel="apple-touch-icon" href="/icons/apple-touch-icon.png" />
|
|
14
|
+
<meta name="mobile-web-app-capable" content="yes" />
|
|
15
|
+
<meta name="apple-mobile-web-app-capable" content="yes" />
|
|
16
|
+
<meta name="apple-mobile-web-app-status-bar-style" content="default" />
|
|
17
|
+
<meta name="apple-mobile-web-app-title" content="Otea" />
|
|
18
|
+
<title>Otea</title>
|
|
19
|
+
<script type="module" crossorigin src="/assets/index-C3OzJope.js"></script>
|
|
20
|
+
<link rel="stylesheet" crossorigin href="/assets/index-COdEjckQ.css">
|
|
21
|
+
</head>
|
|
22
|
+
<body>
|
|
23
|
+
<div id="root"></div>
|
|
24
|
+
</body>
|
|
25
|
+
</html>
|
|
@@ -0,0 +1,24 @@
|
|
|
1
|
+
{
|
|
2
|
+
"name": "Otea",
|
|
3
|
+
"short_name": "Otea",
|
|
4
|
+
"lang": "en",
|
|
5
|
+
"description": "The handoff surface between you and your AI agents.",
|
|
6
|
+
"description_localized": { "es": "El traspaso de trabajo entre tú y tus agentes de IA." },
|
|
7
|
+
"id": "/",
|
|
8
|
+
"start_url": "/",
|
|
9
|
+
"scope": "/",
|
|
10
|
+
"display": "standalone",
|
|
11
|
+
"launch_handler": { "client_mode": ["focus-existing", "auto"] },
|
|
12
|
+
"background_color": "#f7f8fc",
|
|
13
|
+
"theme_color": "#f7f8fc",
|
|
14
|
+
"icons": [
|
|
15
|
+
{ "src": "/icons/otea-192.png", "sizes": "192x192", "type": "image/png", "purpose": "any" },
|
|
16
|
+
{ "src": "/icons/otea-512.png", "sizes": "512x512", "type": "image/png", "purpose": "any" },
|
|
17
|
+
{
|
|
18
|
+
"src": "/icons/otea-maskable-512.png",
|
|
19
|
+
"sizes": "512x512",
|
|
20
|
+
"type": "image/png",
|
|
21
|
+
"purpose": "maskable"
|
|
22
|
+
}
|
|
23
|
+
]
|
|
24
|
+
}
|
|
@@ -0,0 +1,5 @@
|
|
|
1
|
+
<svg xmlns="http://www.w3.org/2000/svg" width="16" height="16" viewBox="0 0 16 16">
|
|
2
|
+
<title>Otea</title>
|
|
3
|
+
<style>.ink{stroke:#1b1f29}.fill{fill:#1b1f29}@media (prefers-color-scheme:dark){.ink{stroke:#e5e8ed}.fill{fill:#e5e8ed}}</style>
|
|
4
|
+
<defs><mask id="cut" maskUnits="userSpaceOnUse" x="1" y="1" width="14" height="14"><rect x="1" y="1" width="14" height="14" fill="#fff"/><circle cx="11.45" cy="4.55" r="2.59" fill="#000"/></mask></defs><g mask="url(#cut)"><circle class="ring ink" cx="8" cy="8" r="4.88" fill="none" stroke-width="2.25"/></g><circle class="dot rest fill" cx="11.45" cy="4.55" r="1.3"/>
|
|
5
|
+
</svg>
|
|
@@ -0,0 +1,5 @@
|
|
|
1
|
+
<svg xmlns="http://www.w3.org/2000/svg" width="16" height="16" viewBox="0 0 16 16">
|
|
2
|
+
<title>Otea</title>
|
|
3
|
+
<style>.ink{stroke:#1b1f29}.fill{fill:#1b1f29}@media (prefers-color-scheme:dark){.ink{stroke:#e5e8ed}.fill{fill:#e5e8ed}}</style>
|
|
4
|
+
<defs><mask id="cut" maskUnits="userSpaceOnUse" x="1" y="1" width="14" height="14"><rect x="1" y="1" width="14" height="14" fill="#fff"/><circle cx="11.45" cy="11.45" r="2.92" fill="#000"/></mask></defs><g mask="url(#cut)"><circle class="ring ink" cx="8" cy="8" r="4.88" fill="none" stroke-width="2.25"/><path class="trail" d="M12.88 8 A4.88 4.88 0 0 1 11.45 11.45" fill="none" stroke="#4473fb" stroke-opacity="0.55" stroke-width="2.25"/></g><circle class="dot" fill="#4473fb" cx="11.45" cy="11.45" r="2.11"/>
|
|
5
|
+
</svg>
|
|
@@ -0,0 +1,5 @@
|
|
|
1
|
+
<svg xmlns="http://www.w3.org/2000/svg" width="16" height="16" viewBox="0 0 16 16">
|
|
2
|
+
<title>Otea</title>
|
|
3
|
+
<style>.ink{stroke:#1b1f29}.fill{fill:#1b1f29}@media (prefers-color-scheme:dark){.ink{stroke:#e5e8ed}.fill{fill:#e5e8ed}}</style>
|
|
4
|
+
<defs><mask id="cut" maskUnits="userSpaceOnUse" x="1" y="1" width="14" height="14"><rect x="1" y="1" width="14" height="14" fill="#fff"/><circle cx="11.45" cy="11.45" r="2.92" fill="#000"/></mask></defs><g mask="url(#cut)"><circle class="ring ink" cx="8" cy="8" r="4.88" fill="none" stroke-width="2.25"/><path class="trail" d="M12.88 8 A4.88 4.88 0 0 1 11.45 11.45" fill="none" stroke="#4473fb" stroke-opacity="0.55" stroke-width="2.25"/></g><circle class="dot" fill="#4473fb" cx="11.45" cy="11.45" r="2.11"/>
|
|
5
|
+
</svg>
|
|
@@ -0,0 +1,5 @@
|
|
|
1
|
+
<svg xmlns="http://www.w3.org/2000/svg" width="16" height="16" viewBox="0 0 16 16">
|
|
2
|
+
<title>Otea</title>
|
|
3
|
+
<style>.ink{stroke:#1b1f29}.fill{fill:#1b1f29}@media (prefers-color-scheme:dark){.ink{stroke:#e5e8ed}.fill{fill:#e5e8ed}}</style>
|
|
4
|
+
<defs><mask id="cut" maskUnits="userSpaceOnUse" x="1" y="1" width="14" height="14"><rect x="1" y="1" width="14" height="14" fill="#fff"/><circle cx="11.45" cy="4.55" r="2.59" fill="#000"/></mask></defs><g mask="url(#cut)"><circle class="ring ink" cx="8" cy="8" r="4.88" fill="none" stroke-width="2.25"/></g><circle class="dot" fill="#4473fb" cx="11.45" cy="4.55" r="1.95"/>
|
|
5
|
+
</svg>
|
package/ui/dist/sw.js
ADDED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
(function(){let e=/^\/p\/([^/]+)\//;function t(t){let n=e.exec(t);return n?.[1]===void 0?void 0:decodeURIComponent(n[1])}let n=()=>typeof window>`u`?`/`:window.location.pathname;function r(e,r=n()){if(!e.startsWith(`/api`))return e;let i=t(r);return i===void 0?e:`/p/${encodeURIComponent(i)}${e}`}let i=/^\/p\/[^/]+(?=\/)/,a=[`/api/stream`,`/api/evidence/`,`/api/pair`,`/api/lan`,`/api/phone`,`/api/notify`];function o(e,t,n){if(e.method!==`GET`)return`network`;let r=new URL(e.url);if(r.origin!==t)return`network`;let o=r.pathname.replace(i,``);return o===`/api`||o.startsWith(`/api/`)?a.some(e=>o===e||o.startsWith(e))?`network`:`data`:e.mode===`navigate`?r.pathname===`/`?`home`:r.pathname.startsWith(`/p/`)||r.pathname===`/pair`?`shell`:`network`:n.has(r.pathname)?`static`:`network`}let s=`/index.html`,c=`x-otea-offline`,l=`x-otea-project`;function u(e){return e.filter(e=>e.refused===void 0).sort((e,t)=>e.at-t.at)}async function d(e,t){let n={made:[],refused:[],unheard:!1};for(let r of u(await e.all())){let i;try{i=await t(r)}catch{i={kind:`unheard`}}if(i.kind===`unheard`){n.unheard=!0;break}if(i.kind===`made`)await e.remove(r.id),n.made.push({capture:r,item:i.item});else{let t={...r,refused:i.message};await e.put(t),n.refused.push(t)}}return n}function f(e){let t={collection:e.board,type:e.type,fields:e.fields},n={accept:`application/json`,"idempotency-key":e.id,...e.project?{[l]:e.project}:{}},i=e.project?`/p/${encodeURIComponent(e.project)}/api/items`:r(`/api/items`),{photo:a}=e;if(!a)return{url:i,init:{method:`POST`,headers:{...n,"content-type":`application/json`},body:JSON.stringify(t)}};let o=new FormData,s=a.module===void 0?{role:a.role}:{role:a.role,module:a.module};return o.append(`item`,JSON.stringify({...t,evidence:[s]})),o.append(`file`,new Blob([a.bytes],{type:a.type}),a.name),{url:i,init:{method:`POST`,headers:n,body:o}}}let p=/* @__PURE__ */ new Set([401,408,429,500,502,503,504]);function m(e){return async t=>{let{url:n,init:r}=f(t),i;try{i=await e(n,r)}catch{return{kind:`unheard`}}if(p.has(i.status))return{kind:`unheard`};let a=await i.json().catch(()=>void 0);if(i.ok){let e=a?.id;return typeof e==`string`?{kind:`made`,item:e}:{kind:`unheard`}}let o=a?.error?.message;return{kind:`refused`,message:typeof o==`string`?o:`HTTP ${i.status}`}}}let h=`captures`;function g(){return new Promise((e,t)=>{let n=indexedDB.open(`otea-offline`,1);n.onupgradeneeded=()=>{n.result.createObjectStore(h,{keyPath:`id`})},n.onsuccess=()=>e(n.result),n.onerror=()=>t(n.error)})}function _(e,t){return g().then(n=>new Promise((r,i)=>{let a=n.transaction(h,e),o=t(a.objectStore(h));a.oncomplete=()=>{n.close(),r(o.result)},a.onerror=()=>{n.close(),i(a.error)},a.onabort=()=>{n.close(),i(a.error)}}))}let v={all:()=>_(`readonly`,e=>e.getAll()),put:async e=>{await _(`readwrite`,t=>t.put(e))},remove:async e=>{await _(`readwrite`,t=>t.delete(e))}},y=e=>typeof e==`string`?e:void 0;function b(e){let t=e??{},n=y(t.title),r=y(t.tag);return{title:n??`Otea`,options:{body:(n===void 0?void 0:y(t.body))??``,...r===void 0?{}:{tag:r},icon:`/icons/otea-192.png`,badge:`/icons/otea-badge.png`,data:{url:y(t.url)??`/#/`}}}}function x(e,t){let n=y(e?.url)??`/#/`;try{let e=new URL(n,t);if(e.origin===t)return e.href}catch{}return`${t}/#/`}async function S(e,t){let n=new URL(e).origin,r=(await t.matchAll()).filter(e=>{try{return new URL(e.url).origin===n}catch{return!1}}),i=r.find(e=>e.focused)??r.find(e=>e.visibilityState===`visible`)??r[0];i?(await i.focus().catch(()=>void 0),new URL(i.url).pathname!==new URL(e).pathname&&i.navigate?await i.navigate(e).catch(()=>i.postMessage({type:`open`,url:e})):i.postMessage({type:`open`,url:e})):await t.openWindow(e)}let C=e=>/^\/p\/([^/]+)\//.exec(new URL(e).pathname)?.[1];function w(e,t){let n=t.headers.get(l),r=C(e);return n===null||r===void 0||n===r}function T(e){return e===void 0||[502,503,504].includes(e.status)}let E=e=>e?.status===502?`closed`:`1`,D=()=>({downAt:null,waiting:/* @__PURE__ */ new Set}),O=(e,t)=>e.downAt!==null&&t-e.downAt<3e4;function k(e,t){e.downAt=t;let n=[...e.waiting];e.waiting.clear();for(let e of n)e()}async function A(e,t,n,r){if(O(n,r()))return;let i,a=()=>void 0,o=new Promise(e=>{a=()=>e(void 0),i=setTimeout(()=>{k(n,r()),e(void 0)},t)});n.waiting.add(a);try{let t=await Promise.race([e,o]);return(t===void 0||T(t))&&k(n,r()),t}finally{clearTimeout(i),n.waiting.delete(a)}}function j(e,t,n,r=async()=>void 0){return e(t).then(async e=>(T(e)||(n.downAt=null,await r(e)),e),()=>void 0)}function M(e,t){let n=new Headers(e.headers);for(let[e,r]of Object.entries(t))n.set(e,r);return new Response(e.body,{status:e.status,statusText:e.statusText,headers:n})}async function N(e,{net:t,cache:n,now:r,waitMs:i=4e3,link:a=D(),background:o=()=>void 0}){let s=e.url,l=j(t,e,a,async e=>{e.ok&&w(s,e)&&await n.put(s,M(e.clone(),{"x-otea-saved-at":`${r()}`}))}),u=await A(l,i,a,r);if(u&&!T(u))return u;u||o(l);let d=E(u),f=await n.match(s);return f?M(f,{[c]:d}):u?M(u,{[c]:d}):Response.json({error:{code:`offline`,message:`Your PC does not answer`}},{status:503,headers:{[c]:d}})}let P=`/otea-last-project`;async function F(e,t){let n=C(e);n!==void 0&&await t.put(P,new Response(n))}async function I(e,{net:t,shell:n,data:r,waitMs:i=3e3,link:a=D(),now:o=Date.now,background:s=()=>void 0}){let c=j(t,e,a),l=await(await r.match(P))?.text();if(l)return s(A(c,i,a,o)),Response.redirect(new URL(`/p/${l}/`,e.url).href,302);let u=await A(c,i,a,o);return u&&!T(u)?u:await n.match(`/index.html`)??u??Response.error()}async function L(e,t,{net:n,cache:r}){let i=await r.match(e);if(i)return i;let a=await n(t);return a.ok&&await r.put(e,a.clone()),a}let R=`otea-data`;function z(e){let t=C(e);return t===void 0?R:`${R}-${t}`}let B=e=>`otea-shell-${e}`;function V(e,t){return e.filter(e=>e.startsWith(`otea-shell-`)&&e!==B(t))}let H=self,U=`4c9e09591e2d`,W=/* @__PURE__ */ `/index.html,/assets/dm-mono-latin-400-normal-4GdczIuU.woff2,/assets/dm-mono-latin-500-normal-DRMDZjhP.woff2,/assets/dm-mono-latin-ext-400-normal-C2zvOubV.woff2,/assets/dm-mono-latin-ext-500-normal-BtRyHRi6.woff2,/assets/index-C3OzJope.js,/assets/index-COdEjckQ.css,/assets/newsreader-latin-ext-opsz-italic-CSPGnFdO.woff2,/assets/newsreader-latin-ext-opsz-normal-BQn1nviT.woff2,/assets/newsreader-latin-opsz-italic-kJKFiXvB.woff2,/assets/newsreader-latin-opsz-normal-s-izfB6B.woff2,/assets/newsreader-vietnamese-opsz-italic-DTr-ymY4.woff2,/assets/newsreader-vietnamese-opsz-normal-BjhtXyW2.woff2,/assets/pdf-YwugTw7Y.js,/assets/pdf-engine-CkBopwck.js,/assets/pdf-rELvHkft.js,/assets/pdf.worker.min-B5Yc7dP4.mjs,/assets/pdf.worker.min-B7U8ptvh.js,/assets/pdf.worker.min-CIqJB0yW.mjs,/assets/pdf.worker.min-UqOn5EDC.js,/assets/schibsted-grotesk-latin-ext-wght-normal-hsMS0n0O.woff2,/assets/schibsted-grotesk-latin-wght-normal-Bb8VGrTG.woff2,/icons/apple-touch-icon.png,/icons/otea-192.png,/icons/otea-512.png,/icons/otea-badge.png,/icons/otea-maskable-512.png,/manifest.webmanifest,/otea-idle.svg,/otea-working.svg,/otea-yours-working.svg,/otea-yours.svg`.split(`,`),G=new Set(W),K=H.location.origin,q=e=>caches.open(e).then(e=>({match:t=>e.match(t),put:(t,n)=>e.put(t,n),keys:()=>e.keys().then(e=>e.map(e=>e.url)),delete:t=>e.delete(t)})),J=e=>fetch(e),Y=D();function X(e,t){let n=[],r=t(e=>void n.push(e));e.respondWith(r),e.waitUntil(r.then(()=>Promise.allSettled(n)).catch(()=>void 0))}H.addEventListener(`install`,e=>{e.waitUntil(caches.open(B(U)).then(e=>e.addAll(W)))}),H.addEventListener(`activate`,e=>{e.waitUntil(caches.keys().then(e=>Promise.all(V(e,U).map(e=>caches.delete(e)))).then(()=>H.clients.claim()))}),H.addEventListener(`message`,e=>{let t=e.data?.type;t===`skip-waiting`&&e.waitUntil(H.skipWaiting()),t===`version`&&e.source?.postMessage({type:`version`,version:U})}),H.addEventListener(`fetch`,e=>{let{request:t}=e,n=o(t,K,G);if(n===`network`)return;if(n===`home`){X(e,e=>Promise.all([q(B(U)),q(R)]).then(([n,r])=>I(t,{net:J,shell:n,data:r,link:Y,background:e})));return}if(n===`data`){X(e,e=>q(z(t.url)).then(n=>N(t,{net:J,cache:n,now:Date.now,link:Y,background:e})));return}n===`shell`&&e.waitUntil(q(R).then(e=>F(t.url,e)));let r=n===`shell`?s:new URL(t.url).pathname;e.respondWith(q(B(U)).then(e=>L(r,n===`shell`?s:t,{net:J,cache:e})))}),H.addEventListener(`sync`,e=>{e.tag===`otea-captures`&&e.waitUntil(d(v,m(fetch.bind(self))).then(async e=>{for(let e of await H.clients.matchAll())e.postMessage({type:`queue-changed`});if(e.unheard)throw Error(`PC not reachable`)}))}),H.addEventListener(`push`,e=>{let t;try{t=e.data?.json()}catch{t=void 0}let{title:n,options:r}=b(t);e.waitUntil(H.registration.showNotification(n,r))}),H.addEventListener(`notificationclick`,e=>{e.notification.close();let t=x(e.notification.data,K);e.waitUntil(S(t,{matchAll:()=>H.clients.matchAll({type:`window`,includeUncontrolled:!0}),openWindow:e=>H.clients.openWindow(e)}))})})();
|