directus-extension-gotenberg 1.0.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/README.md +160 -0
- package/dist/api.js +1 -0
- package/dist/app.js +1 -0
- package/package.json +77 -0
package/README.md
ADDED
|
@@ -0,0 +1,160 @@
|
|
|
1
|
+
# directus-gotenberg
|
|
2
|
+
|
|
3
|
+
Directus extension bundle: **PDF templates** with [Handlebars](https://handlebarsjs.com/), **fonts from Directus files**, and **[Gotenberg 8](https://gotenberg.dev/)** HTML→PDF. Generation runs only through **Flows** (custom operation), not a public PDF endpoint.
|
|
4
|
+
|
|
5
|
+
## Requirements
|
|
6
|
+
|
|
7
|
+
- Directus **10.10+** (see `package.json` `host`)
|
|
8
|
+
- **Bun** ≥ 1.1 (`packageManager` field)
|
|
9
|
+
- **macOS (local `test:setup`):** Xcode **Command Line Tools** so `isolated-vm` can compile (`xcode-select --install`). If install fails with a missing `MacOSX*.sdk` or `make`, update Xcode from the App Store, then run `sudo xcode-select -s /Applications/Xcode.app/Contents/Developer`.
|
|
10
|
+
- Gotenberg **8** reachable from the Directus API process (configure in **PDF Templates → Extension setup**, or set `GOTENBERG_URL` as a fallback)
|
|
11
|
+
|
|
12
|
+
## Install & build
|
|
13
|
+
|
|
14
|
+
```bash
|
|
15
|
+
bun install
|
|
16
|
+
bun run build
|
|
17
|
+
```
|
|
18
|
+
|
|
19
|
+
Copy `dist/` (or symlink via `directus-extension link`) into your Directus `extensions` directory.
|
|
20
|
+
|
|
21
|
+
## Local dev (no Docker)
|
|
22
|
+
|
|
23
|
+
Scripts in [dev/](dev/) install **Directus 10** under `dev/instance/` with **SQLite**, symlink this repo as an extension, and run `directus bootstrap` once. No Docker Compose.
|
|
24
|
+
|
|
25
|
+
| Command | Purpose |
|
|
26
|
+
| ----------------------------- | --------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
|
|
27
|
+
| `bun run test:setup` | `bun install` + `bun run build`, create `dev/instance`, `bun add directus@10`, symlink extension, write `.env`, `directus bootstrap` (skipped if `data.db` already exists). |
|
|
28
|
+
| `bun run test:start` | Rebuild extension, refresh symlink, `node …/directus/cli.js start` (foreground on port 8055; same Node as install when using nvm + `dev/.nvmrc`). |
|
|
29
|
+
| `bun run test:reset -- --yes` | Delete `dev/instance/` entirely. |
|
|
30
|
+
|
|
31
|
+
```bash
|
|
32
|
+
chmod +x dev/setup.sh dev/start.sh dev/reset.sh # once
|
|
33
|
+
bun run test:setup
|
|
34
|
+
bun run test:start
|
|
35
|
+
```
|
|
36
|
+
|
|
37
|
+
Configure Gotenberg in **PDF Templates → Extension setup** (e.g. `http://localhost:3000` if Gotenberg runs on the same machine).
|
|
38
|
+
|
|
39
|
+
Re-bootstrap from scratch: `bun run test:reset -- --yes` then `bun run test:setup`.
|
|
40
|
+
|
|
41
|
+
## Environment
|
|
42
|
+
|
|
43
|
+
| Variable | Description |
|
|
44
|
+
| --------------- | ------------------------------------------------------------------------------------------------------------------------------------------------------------- |
|
|
45
|
+
| `GOTENBERG_URL` | Optional **fallback** base URL if the Extension setup field is empty. Prefer configuring URL and headers in the app (**singleton** `pdf_extension_settings`). |
|
|
46
|
+
|
|
47
|
+
## Extension setup (Gotenberg)
|
|
48
|
+
|
|
49
|
+
1. Create singleton collection **`pdf_extension_settings`** (see [schema/pdf_extension_settings.collection.yaml](schema/pdf_extension_settings.collection.yaml)).
|
|
50
|
+
2. In the app: **PDF Templates** module → **Extension setup** (gear) or route `/pdf-templates-module/setup`.
|
|
51
|
+
3. Set **Gotenberg base URL** and optional **HTTP headers** (JSON object), e.g. `Authorization` for a secured Gotenberg proxy.
|
|
52
|
+
|
|
53
|
+
The **generate-pdf** operation reads these values with elevated access. `Content-Type` is not taken from headers (multipart body sets it). Dangerous hop-by-hop header names are stripped server-side.
|
|
54
|
+
|
|
55
|
+
## Data model
|
|
56
|
+
|
|
57
|
+
Create collection **`pdf_templates`**. See [schema/pdf_templates.collection.yaml](schema/pdf_templates.collection.yaml) for field reference.
|
|
58
|
+
|
|
59
|
+
Important fields:
|
|
60
|
+
|
|
61
|
+
- `target_collection` — **collection name** (e.g. `invoices`) used to load item data and schema for mentions.
|
|
62
|
+
- `content`, `header_html`, `footer_html` — Handlebars templates; use **PDF Template Editor** interface.
|
|
63
|
+
- `language` — `en` or `dv` (RTL for Dhivehi).
|
|
64
|
+
- `font_*` — M2O-style file fields to `directus_files` (heading/body × English/Dhivehi). Fonts are read server-side and embedded as `@font-face` data URLs in the HTML sent to Gotenberg.
|
|
65
|
+
- `gotenberg_config` — JSON with **whitelisted** form keys only (`paperWidth`, `paperHeight`, margins, `landscape`, `scale`, `printBackground`, `waitDelay`, `emulatedMediaType`, `generateDocumentOutline`).
|
|
66
|
+
|
|
67
|
+
## Flow setup (manual trigger)
|
|
68
|
+
|
|
69
|
+
1. **Settings → Flows** → New flow, trigger **Manual**, location **Item page** (sidebar), scope the collection(s) that have PDFs.
|
|
70
|
+
2. Add operation **Generate PDF (Gotenberg)** and choose the `pdf_templates` row (`template_id`).
|
|
71
|
+
3. Ensure flow **accountability** runs as the current user so permissions apply to template, item, and font files.
|
|
72
|
+
4. Keep **Generate PDF (Gotenberg)** as the **last step** in that flow (or make sure the final step still returns the same payload), so callers can read the PDF response.
|
|
73
|
+
|
|
74
|
+
The operation returns `{ base64, mimeType }` for the last step in the chain.
|
|
75
|
+
|
|
76
|
+
## In-app PDF button (optional)
|
|
77
|
+
|
|
78
|
+
On any item collection:
|
|
79
|
+
|
|
80
|
+
1. Add a string (or text) field (e.g. `pdf_last_run`).
|
|
81
|
+
2. Set interface to **PDF Flow Launcher** and configure options:
|
|
82
|
+
|
|
83
|
+
```json
|
|
84
|
+
{
|
|
85
|
+
"template_id": "<pdf-templates-uuid>",
|
|
86
|
+
"buttonLabel": "Generate PDF",
|
|
87
|
+
"action_mode": "open"
|
|
88
|
+
}
|
|
89
|
+
```
|
|
90
|
+
|
|
91
|
+
3. `action_mode` values:
|
|
92
|
+
|
|
93
|
+
- `open` (default): open PDF in a new tab
|
|
94
|
+
- `download`: browser download
|
|
95
|
+
|
|
96
|
+
4. The button calls the authenticated endpoint `POST /pdf-render/render`, which streams PDF bytes directly as a blob response. If `template_id` is not set, launcher auto-picks the first template matching the current collection.
|
|
97
|
+
5. **Hidden on viewports ≤768px** (mobile).
|
|
98
|
+
|
|
99
|
+
## End-to-end usage
|
|
100
|
+
|
|
101
|
+
1. Build and install the extension (`bun install && bun run build`) into your Directus `extensions/` path.
|
|
102
|
+
2. Create/apply schema for:
|
|
103
|
+
- `pdf_templates` (template rows)
|
|
104
|
+
- `pdf_extension_settings` (singleton Gotenberg URL/headers)
|
|
105
|
+
Use files under [schema/](schema/) or `dev/apply-schema.sh` for local SQLite dev.
|
|
106
|
+
3. Open **PDF Templates → Extension setup** and set Gotenberg URL (plus optional headers).
|
|
107
|
+
4. Create at least one `pdf_templates` row:
|
|
108
|
+
- set `target_collection` to the collection key where you will click the button
|
|
109
|
+
- edit `content`/`header_html`/`footer_html` with **PDF Template Editor**
|
|
110
|
+
5. Add a field in the same target collection with interface **PDF Flow Launcher**, then set `template_id` to that template UUID (or leave empty to auto-select by collection).
|
|
111
|
+
6. Open an existing item (not a new unsaved item) on desktop and click the button.
|
|
112
|
+
|
|
113
|
+
## Troubleshooting
|
|
114
|
+
|
|
115
|
+
- Button is disabled with a configuration hint:
|
|
116
|
+
- Open an **existing saved item** (new items use `+` and cannot trigger item-page flows yet).
|
|
117
|
+
- Ensure you are on desktop width (>768px), since launcher is hidden on mobile.
|
|
118
|
+
- Confirm a `pdf_templates` record exists for this collection (`target_collection` must match).
|
|
119
|
+
- If there are multiple templates for one collection, set `template_id` explicitly in interface options.
|
|
120
|
+
- Rebuild/reload extension after code changes: `bun run build`, then restart Directus.
|
|
121
|
+
|
|
122
|
+
- Launcher click fails with endpoint error:
|
|
123
|
+
- Verify extension bundle is rebuilt/reloaded so `/pdf-render/render` exists.
|
|
124
|
+
- Confirm the current user has read access to `pdf_templates`, the target item collection, and required font files.
|
|
125
|
+
|
|
126
|
+
- Error: template applies to another collection:
|
|
127
|
+
- Make sure `pdf_templates.target_collection` matches the collection where launcher is used.
|
|
128
|
+
|
|
129
|
+
- Gotenberg connectivity errors:
|
|
130
|
+
- Verify `pdf_extension_settings.gotenberg_url` (or fallback `GOTENBERG_URL`) from the Directus API container/network.
|
|
131
|
+
|
|
132
|
+
## Settings module
|
|
133
|
+
|
|
134
|
+
**PDF Templates** module lists `pdf_templates` and links into the Content module for editing. You can also manage the collection entirely under **Content**.
|
|
135
|
+
|
|
136
|
+
## Security notes
|
|
137
|
+
|
|
138
|
+
- Launcher uses authenticated endpoint `/pdf-render/render`, which requires user accountability and reuses the same permission checks as `generate-pdf`.
|
|
139
|
+
- **Gotenberg URL:** configured by admins (Extension setup or env), not from `pdf_templates` user JSON. Template `gotenberg_config` only whitelists **multipart form field** names (paper size, etc.), not arbitrary URLs.
|
|
140
|
+
|
|
141
|
+
## Docker (optional deploy)
|
|
142
|
+
|
|
143
|
+
For a minimal **Directus + SQLite** container example (no bundled Gotenberg), see [docker-compose.example.yml](docker-compose.example.yml).
|
|
144
|
+
|
|
145
|
+
## Development
|
|
146
|
+
|
|
147
|
+
```bash
|
|
148
|
+
bun run dev # watch build
|
|
149
|
+
bun run validate
|
|
150
|
+
```
|
|
151
|
+
|
|
152
|
+
After `bun run add` (Extensions SDK), run **`bun install`** again if the CLI falls back to npm.
|
|
153
|
+
|
|
154
|
+
## Liquid snippets
|
|
155
|
+
|
|
156
|
+
- Variables: `{{ field }}`, `{{ relation.field }}`
|
|
157
|
+
- Filters: e.g. `{{ title | default: "Untitled" }}`
|
|
158
|
+
- Control flow: `{% if active %}…{% endif %}`
|
|
159
|
+
|
|
160
|
+
Invalid Handlebars surfaces as operation errors (message shown in the app / logs).
|
package/dist/api.js
ADDED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import e from"fs";function t(e){return e&&e.__esModule&&Object.prototype.hasOwnProperty.call(e,"default")?e.default:e}const n=["interface","display","layout","module","panel","theme"],r=["hook","endpoint"],o=["operation"];function i(e,t,n){function r(n,r){var o;Object.defineProperty(n,"_zod",{value:n._zod??{},enumerable:!1}),(o=n._zod).traits??(o.traits=new Set),n._zod.traits.add(e),t(n,r);for(const e in s.prototype)e in n||Object.defineProperty(n,e,{value:s.prototype[e].bind(n)});n._zod.constr=s,n._zod.def=r}const o=n?.Parent??Object;class i extends o{}function s(e){var t;const o=n?.Parent?new i:this;r(o,e),(t=o._zod).deferred??(t.deferred=[]);for(const e of o._zod.deferred)e();return o}return Object.defineProperty(i,"name",{value:e}),Object.defineProperty(s,"init",{value:r}),Object.defineProperty(s,Symbol.hasInstance,{value:t=>!!(n?.Parent&&t instanceof n.Parent)||t?._zod?.traits?.has(e)}),Object.defineProperty(s,"name",{value:e}),s}class s extends Error{constructor(){super("Encountered Promise during synchronous parse. Use .parseAsync() instead.")}}class a extends Error{constructor(e){super(`Encountered unidirectional transform during encode: ${e}`),this.name="ZodEncodeError"}}const u={};function c(e){return u}function l(e,t){return"bigint"==typeof t?t.toString():t}function p(e){return{get value(){{const t=e();return Object.defineProperty(this,"value",{value:t}),t}}}}function h(e){return null==e}function d(e){const t=e.startsWith("^")?1:0,n=e.endsWith("$")?e.length-1:e.length;return e.slice(t,n)}const f=Symbol("evaluating");function m(e,t,n){let r;Object.defineProperty(e,t,{get(){if(r!==f)return void 0===r&&(r=f,r=n()),r},set(n){Object.defineProperty(e,t,{value:n})},configurable:!0})}function g(e,t,n){Object.defineProperty(e,t,{value:n,writable:!0,enumerable:!0,configurable:!0})}function v(...e){const t={};for(const n of e){const e=Object.getOwnPropertyDescriptors(n);Object.assign(t,e)}return Object.defineProperties({},t)}function y(e){return JSON.stringify(e)}const _="captureStackTrace"in Error?Error.captureStackTrace:(...e)=>{};function b(e){return"object"==typeof e&&null!==e&&!Array.isArray(e)}const w=p(()=>{if("undefined"!=typeof navigator&&navigator?.userAgent?.includes("Cloudflare"))return!1;try{return new Function(""),!0}catch(e){return!1}});function k(e){if(!1===b(e))return!1;const t=e.constructor;if(void 0===t)return!0;const n=t.prototype;return!1!==b(n)&&!1!==Object.prototype.hasOwnProperty.call(n,"isPrototypeOf")}function S(e){return k(e)?{...e}:Array.isArray(e)?[...e]:e}const P=new Set(["string","number","symbol"]);function x(e){return e.replace(/[.*+?^${}()|[\]\\]/g,"\\$&")}function E(e,t,n){const r=new e._zod.constr(t??e._zod.def);return t&&!n?.parent||(r._zod.parent=e),r}function C(e){const t=e;if(!t)return{};if("string"==typeof t)return{error:()=>t};if(void 0!==t?.message){if(void 0!==t?.error)throw new Error("Cannot specify both `message` and `error` params");t.error=t.message}return delete t.message,"string"==typeof t.error?{...t,error:()=>t.error}:t}function A(e,t=0){if(!0===e.aborted)return!0;for(let n=t;n<e.issues.length;n++)if(!0!==e.issues[n]?.continue)return!0;return!1}function O(e,t){return t.map(t=>{var n;return(n=t).path??(n.path=[]),t.path.unshift(e),t})}function z(e){return"string"==typeof e?e:e?.message}function L(e,t,n){const r={...e,path:e.path??[]};if(!e.message){const o=z(e.inst?._zod.def?.error?.(e))??z(t?.error?.(e))??z(n.customError?.(e))??z(n.localeError?.(e))??"Invalid input";r.message=o}return delete r.inst,delete r.continue,t?.reportInput||delete r.input,r}function $(e){return Array.isArray(e)?"array":"string"==typeof e?"string":"unknown"}function I(...e){const[t,n,r]=e;return"string"==typeof t?{message:t,code:"custom",input:n,inst:r}:{...t}}const M=(e,t)=>{e.name="$ZodError",Object.defineProperty(e,"_zod",{value:e._zod,enumerable:!1}),Object.defineProperty(e,"issues",{value:t,enumerable:!1}),e.message=JSON.stringify(t,l,2),Object.defineProperty(e,"toString",{value:()=>e.message,enumerable:!1})},T=i("$ZodError",M),N=i("$ZodError",M,{Parent:Error});const R=e=>(t,n,r,o)=>{const i=r?Object.assign(r,{async:!1}):{async:!1},a=t._zod.run({value:n,issues:[]},i);if(a instanceof Promise)throw new s;if(a.issues.length){const t=new(o?.Err??e)(a.issues.map(e=>L(e,i,c())));throw _(t,o?.callee),t}return a.value},j=e=>async(t,n,r,o)=>{const i=r?Object.assign(r,{async:!0}):{async:!0};let s=t._zod.run({value:n,issues:[]},i);if(s instanceof Promise&&(s=await s),s.issues.length){const t=new(o?.Err??e)(s.issues.map(e=>L(e,i,c())));throw _(t,o?.callee),t}return s.value},D=e=>(t,n,r)=>{const o=r?{...r,async:!1}:{async:!1},i=t._zod.run({value:n,issues:[]},o);if(i instanceof Promise)throw new s;return i.issues.length?{success:!1,error:new(e??T)(i.issues.map(e=>L(e,o,c())))}:{success:!0,data:i.value}},B=D(N),Z=e=>async(t,n,r)=>{const o=r?Object.assign(r,{async:!0}):{async:!0};let i=t._zod.run({value:n,issues:[]},o);return i instanceof Promise&&(i=await i),i.issues.length?{success:!1,error:new e(i.issues.map(e=>L(e,o,c())))}:{success:!0,data:i.value}},F=Z(N),H=e=>(t,n,r)=>{const o=r?Object.assign(r,{direction:"backward"}):{direction:"backward"};return R(e)(t,n,o)},U=e=>(t,n,r)=>R(e)(t,n,r),V=e=>async(t,n,r)=>{const o=r?Object.assign(r,{direction:"backward"}):{direction:"backward"};return j(e)(t,n,o)},G=e=>async(t,n,r)=>j(e)(t,n,r),q=e=>(t,n,r)=>{const o=r?Object.assign(r,{direction:"backward"}):{direction:"backward"};return D(e)(t,n,o)},W=e=>(t,n,r)=>D(e)(t,n,r),K=e=>async(t,n,r)=>{const o=r?Object.assign(r,{direction:"backward"}):{direction:"backward"};return Z(e)(t,n,o)},J=e=>async(t,n,r)=>Z(e)(t,n,r),Y=/^[cC][^\s-]{8,}$/,X=/^[0-9a-z]+$/,Q=/^[0-9A-HJKMNP-TV-Za-hjkmnp-tv-z]{26}$/,ee=/^[0-9a-vA-V]{20}$/,te=/^[A-Za-z0-9]{27}$/,ne=/^[a-zA-Z0-9_-]{21}$/,re=/^P(?:(\d+W)|(?!.*W)(?=\d|T\d)(\d+Y)?(\d+M)?(\d+D)?(T(?=\d)(\d+H)?(\d+M)?(\d+([.,]\d+)?S)?)?)$/,oe=/^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[0-9a-fA-F]{4}-[0-9a-fA-F]{4}-[0-9a-fA-F]{12})$/,ie=e=>e?new RegExp(`^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-${e}[0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12})$`):/^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$/,se=/^(?!\.)(?!.*\.\.)([A-Za-z0-9_'+\-\.]*)[A-Za-z0-9_+-]@([A-Za-z0-9][A-Za-z0-9\-]*\.)+[A-Za-z]{2,}$/;const ae=/^(?:(?:25[0-5]|2[0-4][0-9]|1[0-9][0-9]|[1-9][0-9]|[0-9])\.){3}(?:25[0-5]|2[0-4][0-9]|1[0-9][0-9]|[1-9][0-9]|[0-9])$/,ue=/^(([0-9a-fA-F]{1,4}:){7}[0-9a-fA-F]{1,4}|([0-9a-fA-F]{1,4}:){1,7}:|([0-9a-fA-F]{1,4}:){1,6}:[0-9a-fA-F]{1,4}|([0-9a-fA-F]{1,4}:){1,5}(:[0-9a-fA-F]{1,4}){1,2}|([0-9a-fA-F]{1,4}:){1,4}(:[0-9a-fA-F]{1,4}){1,3}|([0-9a-fA-F]{1,4}:){1,3}(:[0-9a-fA-F]{1,4}){1,4}|([0-9a-fA-F]{1,4}:){1,2}(:[0-9a-fA-F]{1,4}){1,5}|[0-9a-fA-F]{1,4}:((:[0-9a-fA-F]{1,4}){1,6})|:((:[0-9a-fA-F]{1,4}){1,7}|:))$/,ce=/^((25[0-5]|2[0-4][0-9]|1[0-9][0-9]|[1-9][0-9]|[0-9])\.){3}(25[0-5]|2[0-4][0-9]|1[0-9][0-9]|[1-9][0-9]|[0-9])\/([0-9]|[1-2][0-9]|3[0-2])$/,le=/^(([0-9a-fA-F]{1,4}:){7}[0-9a-fA-F]{1,4}|::|([0-9a-fA-F]{1,4})?::([0-9a-fA-F]{1,4}:?){0,6})\/(12[0-8]|1[01][0-9]|[1-9]?[0-9])$/,pe=/^$|^(?:[0-9a-zA-Z+/]{4})*(?:(?:[0-9a-zA-Z+/]{2}==)|(?:[0-9a-zA-Z+/]{3}=))?$/,he=/^[A-Za-z0-9_-]*$/,de=/^(?=.{1,253}\.?$)[a-zA-Z0-9](?:[a-zA-Z0-9-]{0,61}[a-zA-Z0-9])?(?:\.[a-zA-Z0-9](?:[-0-9a-zA-Z]{0,61}[0-9a-zA-Z])?)*\.?$/,fe=/^\+(?:[0-9]){6,14}[0-9]$/,me="(?:(?:\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\\d|30)|(?:02)-(?:0[1-9]|1\\d|2[0-8])))",ge=new RegExp(`^${me}$`);function ve(e){const t="(?:[01]\\d|2[0-3]):[0-5]\\d";return"number"==typeof e.precision?-1===e.precision?`${t}`:0===e.precision?`${t}:[0-5]\\d`:`${t}:[0-5]\\d\\.\\d{${e.precision}}`:`${t}(?::[0-5]\\d(?:\\.\\d+)?)?`}const ye=/^(?:true|false)$/i,_e=/^[^A-Z]*$/,be=/^[^a-z]*$/,we=i("$ZodCheck",(e,t)=>{var n;e._zod??(e._zod={}),e._zod.def=t,(n=e._zod).onattach??(n.onattach=[])}),ke=i("$ZodCheckMaxLength",(e,t)=>{var n;we.init(e,t),(n=e._zod.def).when??(n.when=e=>{const t=e.value;return!h(t)&&void 0!==t.length}),e._zod.onattach.push(e=>{const n=e._zod.bag.maximum??Number.POSITIVE_INFINITY;t.maximum<n&&(e._zod.bag.maximum=t.maximum)}),e._zod.check=n=>{const r=n.value;if(r.length<=t.maximum)return;const o=$(r);n.issues.push({origin:o,code:"too_big",maximum:t.maximum,inclusive:!0,input:r,inst:e,continue:!t.abort})}}),Se=i("$ZodCheckMinLength",(e,t)=>{var n;we.init(e,t),(n=e._zod.def).when??(n.when=e=>{const t=e.value;return!h(t)&&void 0!==t.length}),e._zod.onattach.push(e=>{const n=e._zod.bag.minimum??Number.NEGATIVE_INFINITY;t.minimum>n&&(e._zod.bag.minimum=t.minimum)}),e._zod.check=n=>{const r=n.value;if(r.length>=t.minimum)return;const o=$(r);n.issues.push({origin:o,code:"too_small",minimum:t.minimum,inclusive:!0,input:r,inst:e,continue:!t.abort})}}),Pe=i("$ZodCheckLengthEquals",(e,t)=>{var n;we.init(e,t),(n=e._zod.def).when??(n.when=e=>{const t=e.value;return!h(t)&&void 0!==t.length}),e._zod.onattach.push(e=>{const n=e._zod.bag;n.minimum=t.length,n.maximum=t.length,n.length=t.length}),e._zod.check=n=>{const r=n.value,o=r.length;if(o===t.length)return;const i=$(r),s=o>t.length;n.issues.push({origin:i,...s?{code:"too_big",maximum:t.length}:{code:"too_small",minimum:t.length},inclusive:!0,exact:!0,input:n.value,inst:e,continue:!t.abort})}}),xe=i("$ZodCheckStringFormat",(e,t)=>{var n,r;we.init(e,t),e._zod.onattach.push(e=>{const n=e._zod.bag;n.format=t.format,t.pattern&&(n.patterns??(n.patterns=new Set),n.patterns.add(t.pattern))}),t.pattern?(n=e._zod).check??(n.check=n=>{t.pattern.lastIndex=0,t.pattern.test(n.value)||n.issues.push({origin:"string",code:"invalid_format",format:t.format,input:n.value,...t.pattern?{pattern:t.pattern.toString()}:{},inst:e,continue:!t.abort})}):(r=e._zod).check??(r.check=()=>{})}),Ee=i("$ZodCheckRegex",(e,t)=>{xe.init(e,t),e._zod.check=n=>{t.pattern.lastIndex=0,t.pattern.test(n.value)||n.issues.push({origin:"string",code:"invalid_format",format:"regex",input:n.value,pattern:t.pattern.toString(),inst:e,continue:!t.abort})}}),Ce=i("$ZodCheckLowerCase",(e,t)=>{t.pattern??(t.pattern=_e),xe.init(e,t)}),Ae=i("$ZodCheckUpperCase",(e,t)=>{t.pattern??(t.pattern=be),xe.init(e,t)}),Oe=i("$ZodCheckIncludes",(e,t)=>{we.init(e,t);const n=x(t.includes),r=new RegExp("number"==typeof t.position?`^.{${t.position}}${n}`:n);t.pattern=r,e._zod.onattach.push(e=>{const t=e._zod.bag;t.patterns??(t.patterns=new Set),t.patterns.add(r)}),e._zod.check=n=>{n.value.includes(t.includes,t.position)||n.issues.push({origin:"string",code:"invalid_format",format:"includes",includes:t.includes,input:n.value,inst:e,continue:!t.abort})}}),ze=i("$ZodCheckStartsWith",(e,t)=>{we.init(e,t);const n=new RegExp(`^${x(t.prefix)}.*`);t.pattern??(t.pattern=n),e._zod.onattach.push(e=>{const t=e._zod.bag;t.patterns??(t.patterns=new Set),t.patterns.add(n)}),e._zod.check=n=>{n.value.startsWith(t.prefix)||n.issues.push({origin:"string",code:"invalid_format",format:"starts_with",prefix:t.prefix,input:n.value,inst:e,continue:!t.abort})}}),Le=i("$ZodCheckEndsWith",(e,t)=>{we.init(e,t);const n=new RegExp(`.*${x(t.suffix)}$`);t.pattern??(t.pattern=n),e._zod.onattach.push(e=>{const t=e._zod.bag;t.patterns??(t.patterns=new Set),t.patterns.add(n)}),e._zod.check=n=>{n.value.endsWith(t.suffix)||n.issues.push({origin:"string",code:"invalid_format",format:"ends_with",suffix:t.suffix,input:n.value,inst:e,continue:!t.abort})}}),$e=i("$ZodCheckOverwrite",(e,t)=>{we.init(e,t),e._zod.check=e=>{e.value=t.tx(e.value)}});class Ie{constructor(e=[]){this.content=[],this.indent=0,this&&(this.args=e)}indented(e){this.indent+=1,e(this),this.indent-=1}write(e){if("function"==typeof e)return e(this,{execution:"sync"}),void e(this,{execution:"async"});const t=e.split("\n").filter(e=>e),n=Math.min(...t.map(e=>e.length-e.trimStart().length)),r=t.map(e=>e.slice(n)).map(e=>" ".repeat(2*this.indent)+e);for(const e of r)this.content.push(e)}compile(){const e=Function,t=this?.args;return new e(...t,[...(this?.content??[""]).map(e=>` ${e}`)].join("\n"))}}const Me={major:4,minor:1,patch:12},Te=i("$ZodType",(e,t)=>{var n;e??(e={}),e._zod.def=t,e._zod.bag=e._zod.bag||{},e._zod.version=Me;const r=[...e._zod.def.checks??[]];e._zod.traits.has("$ZodCheck")&&r.unshift(e);for(const t of r)for(const n of t._zod.onattach)n(e);if(0===r.length)(n=e._zod).deferred??(n.deferred=[]),e._zod.deferred?.push(()=>{e._zod.run=e._zod.parse});else{const t=(e,t,n)=>{let r,o=A(e);for(const i of t){if(i._zod.def.when){if(!i._zod.def.when(e))continue}else if(o)continue;const t=e.issues.length,a=i._zod.check(e);if(a instanceof Promise&&!1===n?.async)throw new s;if(r||a instanceof Promise)r=(r??Promise.resolve()).then(async()=>{await a;e.issues.length!==t&&(o||(o=A(e,t)))});else{if(e.issues.length===t)continue;o||(o=A(e,t))}}return r?r.then(()=>e):e},n=(n,o,i)=>{if(A(n))return n.aborted=!0,n;const a=t(o,r,i);if(a instanceof Promise){if(!1===i.async)throw new s;return a.then(t=>e._zod.parse(t,i))}return e._zod.parse(a,i)};e._zod.run=(o,i)=>{if(i.skipChecks)return e._zod.parse(o,i);if("backward"===i.direction){const t=e._zod.parse({value:o.value,issues:[]},{...i,skipChecks:!0});return t instanceof Promise?t.then(e=>n(e,o,i)):n(t,o,i)}const a=e._zod.parse(o,i);if(a instanceof Promise){if(!1===i.async)throw new s;return a.then(e=>t(e,r,i))}return t(a,r,i)}}e["~standard"]={validate:t=>{try{const n=B(e,t);return n.success?{value:n.data}:{issues:n.error?.issues}}catch(n){return F(e,t).then(e=>e.success?{value:e.data}:{issues:e.error?.issues})}},vendor:"zod",version:1}}),Ne=i("$ZodString",(e,t)=>{var n;Te.init(e,t),e._zod.pattern=[...e?._zod.bag?.patterns??[]].pop()??(n=e._zod.bag,new RegExp(`^${n?`[\\s\\S]{${n?.minimum??0},${n?.maximum??""}}`:"[\\s\\S]*"}$`)),e._zod.parse=(n,r)=>{if(t.coerce)try{n.value=String(n.value)}catch(r){}return"string"==typeof n.value||n.issues.push({expected:"string",code:"invalid_type",input:n.value,inst:e}),n}}),Re=i("$ZodStringFormat",(e,t)=>{xe.init(e,t),Ne.init(e,t)}),je=i("$ZodGUID",(e,t)=>{t.pattern??(t.pattern=oe),Re.init(e,t)}),De=i("$ZodUUID",(e,t)=>{if(t.version){const e={v1:1,v2:2,v3:3,v4:4,v5:5,v6:6,v7:7,v8:8}[t.version];if(void 0===e)throw new Error(`Invalid UUID version: "${t.version}"`);t.pattern??(t.pattern=ie(e))}else t.pattern??(t.pattern=ie());Re.init(e,t)}),Be=i("$ZodEmail",(e,t)=>{t.pattern??(t.pattern=se),Re.init(e,t)}),Ze=i("$ZodURL",(e,t)=>{Re.init(e,t),e._zod.check=n=>{try{const r=n.value.trim(),o=new URL(r);return t.hostname&&(t.hostname.lastIndex=0,t.hostname.test(o.hostname)||n.issues.push({code:"invalid_format",format:"url",note:"Invalid hostname",pattern:de.source,input:n.value,inst:e,continue:!t.abort})),t.protocol&&(t.protocol.lastIndex=0,t.protocol.test(o.protocol.endsWith(":")?o.protocol.slice(0,-1):o.protocol)||n.issues.push({code:"invalid_format",format:"url",note:"Invalid protocol",pattern:t.protocol.source,input:n.value,inst:e,continue:!t.abort})),void(t.normalize?n.value=o.href:n.value=r)}catch(r){n.issues.push({code:"invalid_format",format:"url",input:n.value,inst:e,continue:!t.abort})}}}),Fe=i("$ZodEmoji",(e,t)=>{t.pattern??(t.pattern=new RegExp("^(\\p{Extended_Pictographic}|\\p{Emoji_Component})+$","u")),Re.init(e,t)}),He=i("$ZodNanoID",(e,t)=>{t.pattern??(t.pattern=ne),Re.init(e,t)}),Ue=i("$ZodCUID",(e,t)=>{t.pattern??(t.pattern=Y),Re.init(e,t)}),Ve=i("$ZodCUID2",(e,t)=>{t.pattern??(t.pattern=X),Re.init(e,t)}),Ge=i("$ZodULID",(e,t)=>{t.pattern??(t.pattern=Q),Re.init(e,t)}),qe=i("$ZodXID",(e,t)=>{t.pattern??(t.pattern=ee),Re.init(e,t)}),We=i("$ZodKSUID",(e,t)=>{t.pattern??(t.pattern=te),Re.init(e,t)}),Ke=i("$ZodISODateTime",(e,t)=>{t.pattern??(t.pattern=function(e){const t=ve({precision:e.precision}),n=["Z"];e.local&&n.push(""),e.offset&&n.push("([+-](?:[01]\\d|2[0-3]):[0-5]\\d)");const r=`${t}(?:${n.join("|")})`;return new RegExp(`^${me}T(?:${r})$`)}(t)),Re.init(e,t)}),Je=i("$ZodISODate",(e,t)=>{t.pattern??(t.pattern=ge),Re.init(e,t)}),Ye=i("$ZodISOTime",(e,t)=>{t.pattern??(t.pattern=new RegExp(`^${ve(t)}$`)),Re.init(e,t)}),Xe=i("$ZodISODuration",(e,t)=>{t.pattern??(t.pattern=re),Re.init(e,t)}),Qe=i("$ZodIPv4",(e,t)=>{t.pattern??(t.pattern=ae),Re.init(e,t),e._zod.onattach.push(e=>{e._zod.bag.format="ipv4"})}),et=i("$ZodIPv6",(e,t)=>{t.pattern??(t.pattern=ue),Re.init(e,t),e._zod.onattach.push(e=>{e._zod.bag.format="ipv6"}),e._zod.check=n=>{try{new URL(`http://[${n.value}]`)}catch{n.issues.push({code:"invalid_format",format:"ipv6",input:n.value,inst:e,continue:!t.abort})}}}),tt=i("$ZodCIDRv4",(e,t)=>{t.pattern??(t.pattern=ce),Re.init(e,t)}),nt=i("$ZodCIDRv6",(e,t)=>{t.pattern??(t.pattern=le),Re.init(e,t),e._zod.check=n=>{const r=n.value.split("/");try{if(2!==r.length)throw new Error;const[e,t]=r;if(!t)throw new Error;const n=Number(t);if(`${n}`!==t)throw new Error;if(n<0||n>128)throw new Error;new URL(`http://[${e}]`)}catch{n.issues.push({code:"invalid_format",format:"cidrv6",input:n.value,inst:e,continue:!t.abort})}}});function rt(e){if(""===e)return!0;if(e.length%4!=0)return!1;try{return atob(e),!0}catch{return!1}}const ot=i("$ZodBase64",(e,t)=>{t.pattern??(t.pattern=pe),Re.init(e,t),e._zod.onattach.push(e=>{e._zod.bag.contentEncoding="base64"}),e._zod.check=n=>{rt(n.value)||n.issues.push({code:"invalid_format",format:"base64",input:n.value,inst:e,continue:!t.abort})}});const it=i("$ZodBase64URL",(e,t)=>{t.pattern??(t.pattern=he),Re.init(e,t),e._zod.onattach.push(e=>{e._zod.bag.contentEncoding="base64url"}),e._zod.check=n=>{(function(e){if(!he.test(e))return!1;const t=e.replace(/[-_]/g,e=>"-"===e?"+":"/");return rt(t.padEnd(4*Math.ceil(t.length/4),"="))})(n.value)||n.issues.push({code:"invalid_format",format:"base64url",input:n.value,inst:e,continue:!t.abort})}}),st=i("$ZodE164",(e,t)=>{t.pattern??(t.pattern=fe),Re.init(e,t)});const at=i("$ZodJWT",(e,t)=>{Re.init(e,t),e._zod.check=n=>{(function(e,t=null){try{const n=e.split(".");if(3!==n.length)return!1;const[r]=n;if(!r)return!1;const o=JSON.parse(atob(r));return!("typ"in o&&"JWT"!==o?.typ||!o.alg||t&&(!("alg"in o)||o.alg!==t))}catch{return!1}})(n.value,t.alg)||n.issues.push({code:"invalid_format",format:"jwt",input:n.value,inst:e,continue:!t.abort})}}),ut=i("$ZodBoolean",(e,t)=>{Te.init(e,t),e._zod.pattern=ye,e._zod.parse=(n,r)=>{if(t.coerce)try{n.value=Boolean(n.value)}catch(e){}const o=n.value;return"boolean"==typeof o||n.issues.push({expected:"boolean",code:"invalid_type",input:o,inst:e}),n}}),ct=i("$ZodUnknown",(e,t)=>{Te.init(e,t),e._zod.parse=e=>e}),lt=i("$ZodNever",(e,t)=>{Te.init(e,t),e._zod.parse=(t,n)=>(t.issues.push({expected:"never",code:"invalid_type",input:t.value,inst:e}),t)});function pt(e,t,n){e.issues.length&&t.issues.push(...O(n,e.issues)),t.value[n]=e.value}const ht=i("$ZodArray",(e,t)=>{Te.init(e,t),e._zod.parse=(n,r)=>{const o=n.value;if(!Array.isArray(o))return n.issues.push({expected:"array",code:"invalid_type",input:o,inst:e}),n;n.value=Array(o.length);const i=[];for(let e=0;e<o.length;e++){const s=o[e],a=t.element._zod.run({value:s,issues:[]},r);a instanceof Promise?i.push(a.then(t=>pt(t,n,e))):pt(a,n,e)}return i.length?Promise.all(i).then(()=>n):n}});function dt(e,t,n,r){e.issues.length&&t.issues.push(...O(n,e.issues)),void 0===e.value?n in r&&(t.value[n]=void 0):t.value[n]=e.value}function ft(e){const t=Object.keys(e.shape);for(const n of t)if(!e.shape?.[n]?._zod?.traits?.has("$ZodType"))throw new Error(`Invalid element at key "${n}": expected a Zod schema`);const n=(r=e.shape,Object.keys(r).filter(e=>"optional"===r[e]._zod.optin&&"optional"===r[e]._zod.optout));var r;return{...e,keys:t,keySet:new Set(t),numKeys:t.length,optionalKeys:new Set(n)}}function mt(e,t,n,r,o,i){const s=[],a=o.keySet,u=o.catchall._zod,c=u.def.type;for(const o of Object.keys(t)){if(a.has(o))continue;if("never"===c){s.push(o);continue}const i=u.run({value:t[o],issues:[]},r);i instanceof Promise?e.push(i.then(e=>dt(e,n,o,t))):dt(i,n,o,t)}return s.length&&n.issues.push({code:"unrecognized_keys",keys:s,input:t,inst:i}),e.length?Promise.all(e).then(()=>n):n}const gt=i("$ZodObject",(e,t)=>{Te.init(e,t);const n=Object.getOwnPropertyDescriptor(t,"shape");if(!n?.get){const e=t.shape;Object.defineProperty(t,"shape",{get:()=>{const n={...e};return Object.defineProperty(t,"shape",{value:n}),n}})}const r=p(()=>ft(t));m(e._zod,"propValues",()=>{const e=t.shape,n={};for(const t in e){const r=e[t]._zod;if(r.values){n[t]??(n[t]=new Set);for(const e of r.values)n[t].add(e)}}return n});const o=b,i=t.catchall;let s;e._zod.parse=(t,n)=>{s??(s=r.value);const a=t.value;if(!o(a))return t.issues.push({expected:"object",code:"invalid_type",input:a,inst:e}),t;t.value={};const u=[],c=s.shape;for(const e of s.keys){const r=c[e]._zod.run({value:a[e],issues:[]},n);r instanceof Promise?u.push(r.then(n=>dt(n,t,e,a))):dt(r,t,e,a)}return i?mt(u,a,t,n,r.value,e):u.length?Promise.all(u).then(()=>t):t}}),vt=i("$ZodObjectJIT",(e,t)=>{gt.init(e,t);const n=e._zod.parse,r=p(()=>ft(t));let o;const i=b,s=!u.jitless,a=s&&w.value,c=t.catchall;let l;e._zod.parse=(u,p)=>{l??(l=r.value);const h=u.value;return i(h)?s&&a&&!1===p?.async&&!0!==p.jitless?(o||(o=(e=>{const t=new Ie(["shape","payload","ctx"]),n=r.value,o=e=>{const t=y(e);return`shape[${t}]._zod.run({ value: input[${t}], issues: [] }, ctx)`};t.write("const input = payload.value;");const i=Object.create(null);let s=0;for(const e of n.keys)i[e]="key_"+s++;t.write("const newResult = {};");for(const e of n.keys){const n=i[e],r=y(e);t.write(`const ${n} = ${o(e)};`),t.write(`\n if (${n}.issues.length) {\n payload.issues = payload.issues.concat(${n}.issues.map(iss => ({\n ...iss,\n path: iss.path ? [${r}, ...iss.path] : [${r}]\n })));\n }\n \n \n if (${n}.value === undefined) {\n if (${r} in input) {\n newResult[${r}] = undefined;\n }\n } else {\n newResult[${r}] = ${n}.value;\n }\n \n `)}t.write("payload.value = newResult;"),t.write("return payload;");const a=t.compile();return(t,n)=>a(e,t,n)})(t.shape)),u=o(u,p),c?mt([],h,u,p,l,e):u):n(u,p):(u.issues.push({expected:"object",code:"invalid_type",input:h,inst:e}),u)}});function yt(e,t,n,r){for(const n of e)if(0===n.issues.length)return t.value=n.value,t;const o=e.filter(e=>!A(e));return 1===o.length?(t.value=o[0].value,o[0]):(t.issues.push({code:"invalid_union",input:t.value,inst:n,errors:e.map(e=>e.issues.map(e=>L(e,r,c())))}),t)}const _t=i("$ZodUnion",(e,t)=>{Te.init(e,t),m(e._zod,"optin",()=>t.options.some(e=>"optional"===e._zod.optin)?"optional":void 0),m(e._zod,"optout",()=>t.options.some(e=>"optional"===e._zod.optout)?"optional":void 0),m(e._zod,"values",()=>{if(t.options.every(e=>e._zod.values))return new Set(t.options.flatMap(e=>Array.from(e._zod.values)))}),m(e._zod,"pattern",()=>{if(t.options.every(e=>e._zod.pattern)){const e=t.options.map(e=>e._zod.pattern);return new RegExp(`^(${e.map(e=>d(e.source)).join("|")})$`)}});const n=1===t.options.length,r=t.options[0]._zod.run;e._zod.parse=(o,i)=>{if(n)return r(o,i);let s=!1;const a=[];for(const e of t.options){const t=e._zod.run({value:o.value,issues:[]},i);if(t instanceof Promise)a.push(t),s=!0;else{if(0===t.issues.length)return t;a.push(t)}}return s?Promise.all(a).then(t=>yt(t,o,e,i)):yt(a,o,e,i)}}),bt=i("$ZodIntersection",(e,t)=>{Te.init(e,t),e._zod.parse=(e,n)=>{const r=e.value,o=t.left._zod.run({value:r,issues:[]},n),i=t.right._zod.run({value:r,issues:[]},n);return o instanceof Promise||i instanceof Promise?Promise.all([o,i]).then(([t,n])=>kt(e,t,n)):kt(e,o,i)}});function wt(e,t){if(e===t)return{valid:!0,data:e};if(e instanceof Date&&t instanceof Date&&+e===+t)return{valid:!0,data:e};if(k(e)&&k(t)){const n=Object.keys(t),r=Object.keys(e).filter(e=>-1!==n.indexOf(e)),o={...e,...t};for(const n of r){const r=wt(e[n],t[n]);if(!r.valid)return{valid:!1,mergeErrorPath:[n,...r.mergeErrorPath]};o[n]=r.data}return{valid:!0,data:o}}if(Array.isArray(e)&&Array.isArray(t)){if(e.length!==t.length)return{valid:!1,mergeErrorPath:[]};const n=[];for(let r=0;r<e.length;r++){const o=wt(e[r],t[r]);if(!o.valid)return{valid:!1,mergeErrorPath:[r,...o.mergeErrorPath]};n.push(o.data)}return{valid:!0,data:n}}return{valid:!1,mergeErrorPath:[]}}function kt(e,t,n){if(t.issues.length&&e.issues.push(...t.issues),n.issues.length&&e.issues.push(...n.issues),A(e))return e;const r=wt(t.value,n.value);if(!r.valid)throw new Error(`Unmergable intersection. Error path: ${JSON.stringify(r.mergeErrorPath)}`);return e.value=r.data,e}const St=i("$ZodRecord",(e,t)=>{Te.init(e,t),e._zod.parse=(n,r)=>{const o=n.value;if(!k(o))return n.issues.push({expected:"record",code:"invalid_type",input:o,inst:e}),n;const i=[];if(t.keyType._zod.values){const s=t.keyType._zod.values;n.value={};for(const e of s)if("string"==typeof e||"number"==typeof e||"symbol"==typeof e){const s=t.valueType._zod.run({value:o[e],issues:[]},r);s instanceof Promise?i.push(s.then(t=>{t.issues.length&&n.issues.push(...O(e,t.issues)),n.value[e]=t.value})):(s.issues.length&&n.issues.push(...O(e,s.issues)),n.value[e]=s.value)}let a;for(const e in o)s.has(e)||(a=a??[],a.push(e));a&&a.length>0&&n.issues.push({code:"unrecognized_keys",input:o,inst:e,keys:a})}else{n.value={};for(const s of Reflect.ownKeys(o)){if("__proto__"===s)continue;const a=t.keyType._zod.run({value:s,issues:[]},r);if(a instanceof Promise)throw new Error("Async schemas not supported in object keys currently");if(a.issues.length){n.issues.push({code:"invalid_key",origin:"record",issues:a.issues.map(e=>L(e,r,c())),input:s,path:[s],inst:e}),n.value[a.value]=a.value;continue}const u=t.valueType._zod.run({value:o[s],issues:[]},r);u instanceof Promise?i.push(u.then(e=>{e.issues.length&&n.issues.push(...O(s,e.issues)),n.value[a.value]=e.value})):(u.issues.length&&n.issues.push(...O(s,u.issues)),n.value[a.value]=u.value)}}return i.length?Promise.all(i).then(()=>n):n}}),Pt=i("$ZodEnum",(e,t)=>{Te.init(e,t);const n=function(e){const t=Object.values(e).filter(e=>"number"==typeof e);return Object.entries(e).filter(([e,n])=>-1===t.indexOf(+e)).map(([e,t])=>t)}(t.entries),r=new Set(n);e._zod.values=r,e._zod.pattern=new RegExp(`^(${n.filter(e=>P.has(typeof e)).map(e=>"string"==typeof e?x(e):e.toString()).join("|")})$`),e._zod.parse=(t,o)=>{const i=t.value;return r.has(i)||t.issues.push({code:"invalid_value",values:n,input:i,inst:e}),t}}),xt=i("$ZodLiteral",(e,t)=>{if(Te.init(e,t),0===t.values.length)throw new Error("Cannot create literal schema with no valid values");e._zod.values=new Set(t.values),e._zod.pattern=new RegExp(`^(${t.values.map(e=>"string"==typeof e?x(e):e?x(e.toString()):String(e)).join("|")})$`),e._zod.parse=(n,r)=>{const o=n.value;return e._zod.values.has(o)||n.issues.push({code:"invalid_value",values:t.values,input:o,inst:e}),n}}),Et=i("$ZodTransform",(e,t)=>{Te.init(e,t),e._zod.parse=(n,r)=>{if("backward"===r.direction)throw new a(e.constructor.name);const o=t.transform(n.value,n);if(r.async){return(o instanceof Promise?o:Promise.resolve(o)).then(e=>(n.value=e,n))}if(o instanceof Promise)throw new s;return n.value=o,n}});function Ct(e,t){return e.issues.length&&void 0===t?{issues:[],value:void 0}:e}const At=i("$ZodOptional",(e,t)=>{Te.init(e,t),e._zod.optin="optional",e._zod.optout="optional",m(e._zod,"values",()=>t.innerType._zod.values?new Set([...t.innerType._zod.values,void 0]):void 0),m(e._zod,"pattern",()=>{const e=t.innerType._zod.pattern;return e?new RegExp(`^(${d(e.source)})?$`):void 0}),e._zod.parse=(e,n)=>{if("optional"===t.innerType._zod.optin){const r=t.innerType._zod.run(e,n);return r instanceof Promise?r.then(t=>Ct(t,e.value)):Ct(r,e.value)}return void 0===e.value?e:t.innerType._zod.run(e,n)}}),Ot=i("$ZodNullable",(e,t)=>{Te.init(e,t),m(e._zod,"optin",()=>t.innerType._zod.optin),m(e._zod,"optout",()=>t.innerType._zod.optout),m(e._zod,"pattern",()=>{const e=t.innerType._zod.pattern;return e?new RegExp(`^(${d(e.source)}|null)$`):void 0}),m(e._zod,"values",()=>t.innerType._zod.values?new Set([...t.innerType._zod.values,null]):void 0),e._zod.parse=(e,n)=>null===e.value?e:t.innerType._zod.run(e,n)}),zt=i("$ZodDefault",(e,t)=>{Te.init(e,t),e._zod.optin="optional",m(e._zod,"values",()=>t.innerType._zod.values),e._zod.parse=(e,n)=>{if("backward"===n.direction)return t.innerType._zod.run(e,n);if(void 0===e.value)return e.value=t.defaultValue,e;const r=t.innerType._zod.run(e,n);return r instanceof Promise?r.then(e=>Lt(e,t)):Lt(r,t)}});function Lt(e,t){return void 0===e.value&&(e.value=t.defaultValue),e}const $t=i("$ZodPrefault",(e,t)=>{Te.init(e,t),e._zod.optin="optional",m(e._zod,"values",()=>t.innerType._zod.values),e._zod.parse=(e,n)=>("backward"===n.direction||void 0===e.value&&(e.value=t.defaultValue),t.innerType._zod.run(e,n))}),It=i("$ZodNonOptional",(e,t)=>{Te.init(e,t),m(e._zod,"values",()=>{const e=t.innerType._zod.values;return e?new Set([...e].filter(e=>void 0!==e)):void 0}),e._zod.parse=(n,r)=>{const o=t.innerType._zod.run(n,r);return o instanceof Promise?o.then(t=>Mt(t,e)):Mt(o,e)}});function Mt(e,t){return e.issues.length||void 0!==e.value||e.issues.push({code:"invalid_type",expected:"nonoptional",input:e.value,inst:t}),e}const Tt=i("$ZodCatch",(e,t)=>{Te.init(e,t),m(e._zod,"optin",()=>t.innerType._zod.optin),m(e._zod,"optout",()=>t.innerType._zod.optout),m(e._zod,"values",()=>t.innerType._zod.values),e._zod.parse=(e,n)=>{if("backward"===n.direction)return t.innerType._zod.run(e,n);const r=t.innerType._zod.run(e,n);return r instanceof Promise?r.then(r=>(e.value=r.value,r.issues.length&&(e.value=t.catchValue({...e,error:{issues:r.issues.map(e=>L(e,n,c()))},input:e.value}),e.issues=[]),e)):(e.value=r.value,r.issues.length&&(e.value=t.catchValue({...e,error:{issues:r.issues.map(e=>L(e,n,c()))},input:e.value}),e.issues=[]),e)}}),Nt=i("$ZodPipe",(e,t)=>{Te.init(e,t),m(e._zod,"values",()=>t.in._zod.values),m(e._zod,"optin",()=>t.in._zod.optin),m(e._zod,"optout",()=>t.out._zod.optout),m(e._zod,"propValues",()=>t.in._zod.propValues),e._zod.parse=(e,n)=>{if("backward"===n.direction){const r=t.out._zod.run(e,n);return r instanceof Promise?r.then(e=>Rt(e,t.in,n)):Rt(r,t.in,n)}const r=t.in._zod.run(e,n);return r instanceof Promise?r.then(e=>Rt(e,t.out,n)):Rt(r,t.out,n)}});function Rt(e,t,n){return e.issues.length?(e.aborted=!0,e):t._zod.run({value:e.value,issues:e.issues},n)}const jt=i("$ZodReadonly",(e,t)=>{Te.init(e,t),m(e._zod,"propValues",()=>t.innerType._zod.propValues),m(e._zod,"values",()=>t.innerType._zod.values),m(e._zod,"optin",()=>t.innerType._zod.optin),m(e._zod,"optout",()=>t.innerType._zod.optout),e._zod.parse=(e,n)=>{if("backward"===n.direction)return t.innerType._zod.run(e,n);const r=t.innerType._zod.run(e,n);return r instanceof Promise?r.then(Dt):Dt(r)}});function Dt(e){return e.value=Object.freeze(e.value),e}const Bt=i("$ZodCustom",(e,t)=>{we.init(e,t),Te.init(e,t),e._zod.parse=(e,t)=>e,e._zod.check=n=>{const r=n.value,o=t.fn(r);if(o instanceof Promise)return o.then(t=>Zt(t,n,r,e));Zt(o,n,r,e)}});function Zt(e,t,n,r){if(!e){const e={code:"custom",input:n,inst:r,path:[...r._zod.def.path??[]],continue:!r._zod.def.abort};r._zod.def.params&&(e.params=r._zod.def.params),t.issues.push(I(e))}}class Ft{constructor(){this._map=new WeakMap,this._idmap=new Map}add(e,...t){const n=t[0];if(this._map.set(e,n),n&&"object"==typeof n&&"id"in n){if(this._idmap.has(n.id))throw new Error(`ID ${n.id} already exists in the registry`);this._idmap.set(n.id,e)}return this}clear(){return this._map=new WeakMap,this._idmap=new Map,this}remove(e){const t=this._map.get(e);return t&&"object"==typeof t&&"id"in t&&this._idmap.delete(t.id),this._map.delete(e),this}get(e){const t=e._zod.parent;if(t){const n={...this.get(t)??{}};delete n.id;const r={...n,...this._map.get(e)};return Object.keys(r).length?r:void 0}return this._map.get(e)}has(e){return this._map.has(e)}}function Ht(){return new Ft}const Ut=Ht();function Vt(e,t){return new e({type:"string",format:"guid",check:"string_format",abort:!1,...C(t)})}function Gt(e,t){return new ke({check:"max_length",...C(t),maximum:e})}function qt(e,t){return new Se({check:"min_length",...C(t),minimum:e})}function Wt(e,t){return new Pe({check:"length_equals",...C(t),length:e})}function Kt(e){return new $e({check:"overwrite",tx:e})}function Jt(e){const t=function(e,t){const n=new we({check:"custom",...C(t)});return n._zod.check=e,n}(n=>(n.addIssue=e=>{if("string"==typeof e)n.issues.push(I(e,n.value,t._zod.def));else{const r=e;r.fatal&&(r.continue=!1),r.code??(r.code="custom"),r.input??(r.input=n.value),r.inst??(r.inst=t),r.continue??(r.continue=!t._zod.def.abort),n.issues.push(I(r))}},e(n.value,n)));return t}const Yt=i("ZodISODateTime",(e,t)=>{Ke.init(e,t),Sn.init(e,t)});function Xt(e){return function(e,t){return new e({type:"string",format:"datetime",check:"string_format",offset:!1,local:!1,precision:null,...C(t)})}(Yt,e)}const Qt=i("ZodISODate",(e,t)=>{Je.init(e,t),Sn.init(e,t)});function en(e){return function(e,t){return new e({type:"string",format:"date",check:"string_format",...C(t)})}(Qt,e)}const tn=i("ZodISOTime",(e,t)=>{Ye.init(e,t),Sn.init(e,t)});function nn(e){return function(e,t){return new e({type:"string",format:"time",check:"string_format",precision:null,...C(t)})}(tn,e)}const rn=i("ZodISODuration",(e,t)=>{Xe.init(e,t),Sn.init(e,t)});function on(e){return function(e,t){return new e({type:"string",format:"duration",check:"string_format",...C(t)})}(rn,e)}const sn=i("ZodError",(e,t)=>{T.init(e,t),e.name="ZodError",Object.defineProperties(e,{format:{value:t=>function(e,t=e=>e.message){const n={_errors:[]},r=e=>{for(const o of e.issues)if("invalid_union"===o.code&&o.errors.length)o.errors.map(e=>r({issues:e}));else if("invalid_key"===o.code)r({issues:o.issues});else if("invalid_element"===o.code)r({issues:o.issues});else if(0===o.path.length)n._errors.push(t(o));else{let e=n,r=0;for(;r<o.path.length;){const n=o.path[r];r===o.path.length-1?(e[n]=e[n]||{_errors:[]},e[n]._errors.push(t(o))):e[n]=e[n]||{_errors:[]},e=e[n],r++}}};return r(e),n}(e,t)},flatten:{value:t=>function(e,t=e=>e.message){const n={},r=[];for(const o of e.issues)o.path.length>0?(n[o.path[0]]=n[o.path[0]]||[],n[o.path[0]].push(t(o))):r.push(t(o));return{formErrors:r,fieldErrors:n}}(e,t)},addIssue:{value:t=>{e.issues.push(t),e.message=JSON.stringify(e.issues,l,2)}},addIssues:{value:t=>{e.issues.push(...t),e.message=JSON.stringify(e.issues,l,2)}},isEmpty:{get:()=>0===e.issues.length}})},{Parent:Error}),an=R(sn),un=j(sn),cn=D(sn),ln=Z(sn),pn=H(sn),hn=U(sn),dn=V(sn),fn=G(sn),mn=q(sn),gn=W(sn),vn=K(sn),yn=J(sn),_n=i("ZodType",(e,t)=>(Te.init(e,t),e.def=t,e.type=t.type,Object.defineProperty(e,"_def",{value:t}),e.check=(...n)=>e.clone(v(t,{checks:[...t.checks??[],...n.map(e=>"function"==typeof e?{_zod:{check:e,def:{check:"custom"},onattach:[]}}:e)]})),e.clone=(t,n)=>E(e,t,n),e.brand=()=>e,e.register=(t,n)=>(t.add(e,n),e),e.parse=(t,n)=>an(e,t,n,{callee:e.parse}),e.safeParse=(t,n)=>cn(e,t,n),e.parseAsync=async(t,n)=>un(e,t,n,{callee:e.parseAsync}),e.safeParseAsync=async(t,n)=>ln(e,t,n),e.spa=e.safeParseAsync,e.encode=(t,n)=>pn(e,t,n),e.decode=(t,n)=>hn(e,t,n),e.encodeAsync=async(t,n)=>dn(e,t,n),e.decodeAsync=async(t,n)=>fn(e,t,n),e.safeEncode=(t,n)=>mn(e,t,n),e.safeDecode=(t,n)=>gn(e,t,n),e.safeEncodeAsync=async(t,n)=>vn(e,t,n),e.safeDecodeAsync=async(t,n)=>yn(e,t,n),e.refine=(t,n)=>e.check(function(e,t={}){return function(e,t,n){return new e({type:"custom",check:"custom",fn:t,...C(n)})}(br,e,t)}(t,n)),e.superRefine=t=>e.check(Jt(t)),e.overwrite=t=>e.check(Kt(t)),e.optional=()=>lr(e),e.nullable=()=>hr(e),e.nullish=()=>lr(hr(e)),e.nonoptional=t=>function(e,t){return new mr({type:"nonoptional",innerType:e,...C(t)})}(e,t),e.array=()=>Jn(e),e.or=t=>er([e,t]),e.and=t=>new tr({type:"intersection",left:e,right:t}),e.transform=t=>yr(e,new ur({type:"transform",transform:t})),e.default=t=>{return n=t,new dr({type:"default",innerType:e,get defaultValue(){return"function"==typeof n?n():S(n)}});var n},e.prefault=t=>{return n=t,new fr({type:"prefault",innerType:e,get defaultValue(){return"function"==typeof n?n():S(n)}});var n},e.catch=t=>{return new gr({type:"catch",innerType:e,catchValue:"function"==typeof(n=t)?n:()=>n});var n},e.pipe=t=>yr(e,t),e.readonly=()=>new _r({type:"readonly",innerType:e}),e.describe=t=>{const n=e.clone();return Ut.add(n,{description:t}),n},Object.defineProperty(e,"description",{get:()=>Ut.get(e)?.description,configurable:!0}),e.meta=(...t)=>{if(0===t.length)return Ut.get(e);const n=e.clone();return Ut.add(n,t[0]),n},e.isOptional=()=>e.safeParse(void 0).success,e.isNullable=()=>e.safeParse(null).success,e)),bn=i("_ZodString",(e,t)=>{Ne.init(e,t),_n.init(e,t);const n=e._zod.bag;e.format=n.format??null,e.minLength=n.minimum??null,e.maxLength=n.maximum??null,e.regex=(...t)=>e.check(function(e,t){return new Ee({check:"string_format",format:"regex",...C(t),pattern:e})}(...t)),e.includes=(...t)=>e.check(function(e,t){return new Oe({check:"string_format",format:"includes",...C(t),includes:e})}(...t)),e.startsWith=(...t)=>e.check(function(e,t){return new ze({check:"string_format",format:"starts_with",...C(t),prefix:e})}(...t)),e.endsWith=(...t)=>e.check(function(e,t){return new Le({check:"string_format",format:"ends_with",...C(t),suffix:e})}(...t)),e.min=(...t)=>e.check(qt(...t)),e.max=(...t)=>e.check(Gt(...t)),e.length=(...t)=>e.check(Wt(...t)),e.nonempty=(...t)=>e.check(qt(1,...t)),e.lowercase=t=>e.check(function(e){return new Ce({check:"string_format",format:"lowercase",...C(e)})}(t)),e.uppercase=t=>e.check(function(e){return new Ae({check:"string_format",format:"uppercase",...C(e)})}(t)),e.trim=()=>e.check(Kt(e=>e.trim())),e.normalize=(...t)=>e.check(function(e){return Kt(t=>t.normalize(e))}(...t)),e.toLowerCase=()=>e.check(Kt(e=>e.toLowerCase())),e.toUpperCase=()=>e.check(Kt(e=>e.toUpperCase()))}),wn=i("ZodString",(e,t)=>{Ne.init(e,t),bn.init(e,t),e.email=t=>e.check(function(e,t){return new e({type:"string",format:"email",check:"string_format",abort:!1,...C(t)})}(Pn,t)),e.url=t=>e.check(function(e,t){return new e({type:"string",format:"url",check:"string_format",abort:!1,...C(t)})}(Cn,t)),e.jwt=t=>e.check(function(e,t){return new e({type:"string",format:"jwt",check:"string_format",abort:!1,...C(t)})}(Fn,t)),e.emoji=t=>e.check(function(e,t){return new e({type:"string",format:"emoji",check:"string_format",abort:!1,...C(t)})}(An,t)),e.guid=t=>e.check(Vt(xn,t)),e.uuid=t=>e.check(function(e,t){return new e({type:"string",format:"uuid",check:"string_format",abort:!1,...C(t)})}(En,t)),e.uuidv4=t=>e.check(function(e,t){return new e({type:"string",format:"uuid",check:"string_format",abort:!1,version:"v4",...C(t)})}(En,t)),e.uuidv6=t=>e.check(function(e,t){return new e({type:"string",format:"uuid",check:"string_format",abort:!1,version:"v6",...C(t)})}(En,t)),e.uuidv7=t=>e.check(function(e,t){return new e({type:"string",format:"uuid",check:"string_format",abort:!1,version:"v7",...C(t)})}(En,t)),e.nanoid=t=>e.check(function(e,t){return new e({type:"string",format:"nanoid",check:"string_format",abort:!1,...C(t)})}(On,t)),e.guid=t=>e.check(Vt(xn,t)),e.cuid=t=>e.check(function(e,t){return new e({type:"string",format:"cuid",check:"string_format",abort:!1,...C(t)})}(zn,t)),e.cuid2=t=>e.check(function(e,t){return new e({type:"string",format:"cuid2",check:"string_format",abort:!1,...C(t)})}(Ln,t)),e.ulid=t=>e.check(function(e,t){return new e({type:"string",format:"ulid",check:"string_format",abort:!1,...C(t)})}($n,t)),e.base64=t=>e.check(function(e,t){return new e({type:"string",format:"base64",check:"string_format",abort:!1,...C(t)})}(Dn,t)),e.base64url=t=>e.check(function(e,t){return new e({type:"string",format:"base64url",check:"string_format",abort:!1,...C(t)})}(Bn,t)),e.xid=t=>e.check(function(e,t){return new e({type:"string",format:"xid",check:"string_format",abort:!1,...C(t)})}(In,t)),e.ksuid=t=>e.check(function(e,t){return new e({type:"string",format:"ksuid",check:"string_format",abort:!1,...C(t)})}(Mn,t)),e.ipv4=t=>e.check(function(e,t){return new e({type:"string",format:"ipv4",check:"string_format",abort:!1,...C(t)})}(Tn,t)),e.ipv6=t=>e.check(function(e,t){return new e({type:"string",format:"ipv6",check:"string_format",abort:!1,...C(t)})}(Nn,t)),e.cidrv4=t=>e.check(function(e,t){return new e({type:"string",format:"cidrv4",check:"string_format",abort:!1,...C(t)})}(Rn,t)),e.cidrv6=t=>e.check(function(e,t){return new e({type:"string",format:"cidrv6",check:"string_format",abort:!1,...C(t)})}(jn,t)),e.e164=t=>e.check(function(e,t){return new e({type:"string",format:"e164",check:"string_format",abort:!1,...C(t)})}(Zn,t)),e.datetime=t=>e.check(Xt(t)),e.date=t=>e.check(en(t)),e.time=t=>e.check(nn(t)),e.duration=t=>e.check(on(t))});function kn(e){return function(e,t){return new e({type:"string",...C(t)})}(wn,e)}const Sn=i("ZodStringFormat",(e,t)=>{Re.init(e,t),bn.init(e,t)}),Pn=i("ZodEmail",(e,t)=>{Be.init(e,t),Sn.init(e,t)}),xn=i("ZodGUID",(e,t)=>{je.init(e,t),Sn.init(e,t)}),En=i("ZodUUID",(e,t)=>{De.init(e,t),Sn.init(e,t)}),Cn=i("ZodURL",(e,t)=>{Ze.init(e,t),Sn.init(e,t)}),An=i("ZodEmoji",(e,t)=>{Fe.init(e,t),Sn.init(e,t)}),On=i("ZodNanoID",(e,t)=>{He.init(e,t),Sn.init(e,t)}),zn=i("ZodCUID",(e,t)=>{Ue.init(e,t),Sn.init(e,t)}),Ln=i("ZodCUID2",(e,t)=>{Ve.init(e,t),Sn.init(e,t)}),$n=i("ZodULID",(e,t)=>{Ge.init(e,t),Sn.init(e,t)}),In=i("ZodXID",(e,t)=>{qe.init(e,t),Sn.init(e,t)}),Mn=i("ZodKSUID",(e,t)=>{We.init(e,t),Sn.init(e,t)}),Tn=i("ZodIPv4",(e,t)=>{Qe.init(e,t),Sn.init(e,t)}),Nn=i("ZodIPv6",(e,t)=>{et.init(e,t),Sn.init(e,t)}),Rn=i("ZodCIDRv4",(e,t)=>{tt.init(e,t),Sn.init(e,t)}),jn=i("ZodCIDRv6",(e,t)=>{nt.init(e,t),Sn.init(e,t)}),Dn=i("ZodBase64",(e,t)=>{ot.init(e,t),Sn.init(e,t)}),Bn=i("ZodBase64URL",(e,t)=>{it.init(e,t),Sn.init(e,t)}),Zn=i("ZodE164",(e,t)=>{st.init(e,t),Sn.init(e,t)}),Fn=i("ZodJWT",(e,t)=>{at.init(e,t),Sn.init(e,t)}),Hn=i("ZodBoolean",(e,t)=>{ut.init(e,t),_n.init(e,t)});function Un(e){return function(e,t){return new e({type:"boolean",...C(t)})}(Hn,e)}const Vn=i("ZodUnknown",(e,t)=>{ct.init(e,t),_n.init(e,t)});function Gn(){return new Vn({type:"unknown"})}const qn=i("ZodNever",(e,t)=>{lt.init(e,t),_n.init(e,t)});function Wn(e){return function(e,t){return new e({type:"never",...C(t)})}(qn,e)}const Kn=i("ZodArray",(e,t)=>{ht.init(e,t),_n.init(e,t),e.element=t.element,e.min=(t,n)=>e.check(qt(t,n)),e.nonempty=t=>e.check(qt(1,t)),e.max=(t,n)=>e.check(Gt(t,n)),e.length=(t,n)=>e.check(Wt(t,n)),e.unwrap=()=>e.element});function Jn(e,t){return function(e,t,n){return new e({type:"array",element:t,...C(n)})}(Kn,e,t)}const Yn=i("ZodObject",(e,t)=>{vt.init(e,t),_n.init(e,t),m(e,"shape",()=>t.shape),e.keyof=()=>ir(Object.keys(e._zod.def.shape)),e.catchall=t=>e.clone({...e._zod.def,catchall:t}),e.passthrough=()=>e.clone({...e._zod.def,catchall:Gn()}),e.loose=()=>e.clone({...e._zod.def,catchall:Gn()}),e.strict=()=>e.clone({...e._zod.def,catchall:Wn()}),e.strip=()=>e.clone({...e._zod.def,catchall:void 0}),e.extend=t=>function(e,t){if(!k(t))throw new Error("Invalid input to extend: expected a plain object");const n=e._zod.def.checks;if(n&&n.length>0)throw new Error("Object schemas containing refinements cannot be extended. Use `.safeExtend()` instead.");const r=v(e._zod.def,{get shape(){const n={...e._zod.def.shape,...t};return g(this,"shape",n),n},checks:[]});return E(e,r)}(e,t),e.safeExtend=t=>function(e,t){if(!k(t))throw new Error("Invalid input to safeExtend: expected a plain object");const n={...e._zod.def,get shape(){const n={...e._zod.def.shape,...t};return g(this,"shape",n),n},checks:e._zod.def.checks};return E(e,n)}(e,t),e.merge=t=>function(e,t){const n=v(e._zod.def,{get shape(){const n={...e._zod.def.shape,...t._zod.def.shape};return g(this,"shape",n),n},get catchall(){return t._zod.def.catchall},checks:[]});return E(e,n)}(e,t),e.pick=t=>function(e,t){const n=e._zod.def;return E(e,v(e._zod.def,{get shape(){const e={};for(const r in t){if(!(r in n.shape))throw new Error(`Unrecognized key: "${r}"`);t[r]&&(e[r]=n.shape[r])}return g(this,"shape",e),e},checks:[]}))}(e,t),e.omit=t=>function(e,t){const n=e._zod.def,r=v(e._zod.def,{get shape(){const r={...e._zod.def.shape};for(const e in t){if(!(e in n.shape))throw new Error(`Unrecognized key: "${e}"`);t[e]&&delete r[e]}return g(this,"shape",r),r},checks:[]});return E(e,r)}(e,t),e.partial=(...t)=>function(e,t,n){const r=v(t._zod.def,{get shape(){const r=t._zod.def.shape,o={...r};if(n)for(const t in n){if(!(t in r))throw new Error(`Unrecognized key: "${t}"`);n[t]&&(o[t]=e?new e({type:"optional",innerType:r[t]}):r[t])}else for(const t in r)o[t]=e?new e({type:"optional",innerType:r[t]}):r[t];return g(this,"shape",o),o},checks:[]});return E(t,r)}(cr,e,t[0]),e.required=(...t)=>function(e,t,n){const r=v(t._zod.def,{get shape(){const r=t._zod.def.shape,o={...r};if(n)for(const t in n){if(!(t in o))throw new Error(`Unrecognized key: "${t}"`);n[t]&&(o[t]=new e({type:"nonoptional",innerType:r[t]}))}else for(const t in r)o[t]=new e({type:"nonoptional",innerType:r[t]});return g(this,"shape",o),o},checks:[]});return E(t,r)}(mr,e,t[0])});function Xn(e,t){const n={type:"object",shape:e??{},...C(t)};return new Yn(n)}const Qn=i("ZodUnion",(e,t)=>{_t.init(e,t),_n.init(e,t),e.options=t.options});function er(e,t){return new Qn({type:"union",options:e,...C(t)})}const tr=i("ZodIntersection",(e,t)=>{bt.init(e,t),_n.init(e,t)});const nr=i("ZodRecord",(e,t)=>{St.init(e,t),_n.init(e,t),e.keyType=t.keyType,e.valueType=t.valueType});function rr(e,t,n){return new nr({type:"record",keyType:e,valueType:t,...C(n)})}const or=i("ZodEnum",(e,t)=>{Pt.init(e,t),_n.init(e,t),e.enum=t.entries,e.options=Object.values(t.entries);const n=new Set(Object.keys(t.entries));e.extract=(e,r)=>{const o={};for(const r of e){if(!n.has(r))throw new Error(`Key ${r} not found in enum`);o[r]=t.entries[r]}return new or({...t,checks:[],...C(r),entries:o})},e.exclude=(e,r)=>{const o={...t.entries};for(const t of e){if(!n.has(t))throw new Error(`Key ${t} not found in enum`);delete o[t]}return new or({...t,checks:[],...C(r),entries:o})}});function ir(e,t){const n=Array.isArray(e)?Object.fromEntries(e.map(e=>[e,e])):e;return new or({type:"enum",entries:n,...C(t)})}const sr=i("ZodLiteral",(e,t)=>{xt.init(e,t),_n.init(e,t),e.values=new Set(t.values),Object.defineProperty(e,"value",{get(){if(t.values.length>1)throw new Error("This schema contains multiple valid literal values. Use `.values` instead.");return t.values[0]}})});function ar(e,t){return new sr({type:"literal",values:Array.isArray(e)?e:[e],...C(t)})}const ur=i("ZodTransform",(e,t)=>{Et.init(e,t),_n.init(e,t),e._zod.parse=(n,r)=>{if("backward"===r.direction)throw new a(e.constructor.name);n.addIssue=r=>{if("string"==typeof r)n.issues.push(I(r,n.value,t));else{const t=r;t.fatal&&(t.continue=!1),t.code??(t.code="custom"),t.input??(t.input=n.value),t.inst??(t.inst=e),n.issues.push(I(t))}};const o=t.transform(n.value,n);return o instanceof Promise?o.then(e=>(n.value=e,n)):(n.value=o,n)}});const cr=i("ZodOptional",(e,t)=>{At.init(e,t),_n.init(e,t),e.unwrap=()=>e._zod.def.innerType});function lr(e){return new cr({type:"optional",innerType:e})}const pr=i("ZodNullable",(e,t)=>{Ot.init(e,t),_n.init(e,t),e.unwrap=()=>e._zod.def.innerType});function hr(e){return new pr({type:"nullable",innerType:e})}const dr=i("ZodDefault",(e,t)=>{zt.init(e,t),_n.init(e,t),e.unwrap=()=>e._zod.def.innerType,e.removeDefault=e.unwrap});const fr=i("ZodPrefault",(e,t)=>{$t.init(e,t),_n.init(e,t),e.unwrap=()=>e._zod.def.innerType});const mr=i("ZodNonOptional",(e,t)=>{It.init(e,t),_n.init(e,t),e.unwrap=()=>e._zod.def.innerType});const gr=i("ZodCatch",(e,t)=>{Tt.init(e,t),_n.init(e,t),e.unwrap=()=>e._zod.def.innerType,e.removeCatch=e.unwrap});const vr=i("ZodPipe",(e,t)=>{Nt.init(e,t),_n.init(e,t),e.in=t.in,e.out=t.out});function yr(e,t){return new vr({type:"pipe",in:e,out:t})}const _r=i("ZodReadonly",(e,t)=>{jt.init(e,t),_n.init(e,t),e.unwrap=()=>e._zod.def.innerType});const br=i("ZodCustom",(e,t)=>{Bt.init(e,t),_n.init(e,t)});const wr="directus:extension",kr=Xn({app:kn(),api:kn()}),Sr=Xn({request:lr(Xn({urls:Jn(kn()),methods:Jn(er([ar("GET"),ar("POST"),ar("PATCH"),ar("PUT"),ar("DELETE")]))})),log:lr(Xn({})),sleep:lr(Xn({}))}),Pr=lr(Xn({enabled:Un(),requestedScopes:Sr})),xr=er([Xn({type:ir(r),name:kn(),source:kn()}),Xn({type:ir(n),name:kn(),source:kn()}),Xn({type:ir(o),name:kn(),source:kr})]),Er=Xn({host:kn(),hidden:Un().optional()}),Cr=Xn({type:ir(n),path:kn(),source:kn()}),Ar=Xn({type:ir(r),path:kn(),source:kn(),sandbox:Pr}),Or=Xn({type:ir(o),path:kr,source:kr,sandbox:Pr}),zr=Xn({type:ar("bundle"),partial:Un().optional(),path:kr,entries:Jn(xr)});Jn(xr);const Lr=Er.and(er([Cr,Ar,Or,zr]));function $r(e){throw new Error('Could not dynamically require "'+e+'". Please configure the dynamicRequireTargets or/and ignoreDynamicRequires option of @rollup/plugin-commonjs appropriately for this require call to work.')}Xn({name:kn(),version:kn(),type:er([ar("module"),ar("commonjs")]).optional(),description:kn().optional(),icon:kn().optional(),dependencies:rr(kn(),kn()).optional(),devDependencies:rr(kn(),kn()).optional(),[wr]:Lr});var Ir,Mr={exports:{}},Tr={exports:{}},Nr={},Rr={};function jr(){if(Ir)return Rr;Ir=1,Rr.__esModule=!0,Rr.extend=o,Rr.indexOf=function(e,t){for(var n=0,r=e.length;n<r;n++)if(e[n]===t)return n;return-1},Rr.escapeExpression=function(e){if("string"!=typeof e){if(e&&e.toHTML)return e.toHTML();if(null==e)return"";if(!e)return e+"";e=""+e}if(!n.test(e))return e;return e.replace(t,r)},Rr.isEmpty=function(e){return!e&&0!==e||!(!a(e)||0!==e.length)},Rr.createFrame=function(e){var t=o({},e);return t._parent=e,t},Rr.blockParams=function(e,t){return e.path=t,e},Rr.appendContextPath=function(e,t){return(e?e+".":"")+t};var e={"&":"&","<":"<",">":">",'"':""","'":"'","`":"`","=":"="},t=/[&<>"'`=]/g,n=/[&<>"'`=]/;function r(t){return e[t]}function o(e){for(var t=1;t<arguments.length;t++)for(var n in arguments[t])Object.prototype.hasOwnProperty.call(arguments[t],n)&&(e[n]=arguments[t][n]);return e}var i=Object.prototype.toString;Rr.toString=i;var s=function(e){return"function"==typeof e};s(/x/)&&(Rr.isFunction=s=function(e){return"function"==typeof e&&"[object Function]"===i.call(e)}),Rr.isFunction=s;var a=Array.isArray||function(e){return!(!e||"object"!=typeof e)&&"[object Array]"===i.call(e)};return Rr.isArray=a,Rr}var Dr,Br={exports:{}};function Zr(){return Dr||(Dr=1,function(e,t){t.__esModule=!0;var n=["description","fileName","lineNumber","endLineNumber","message","name","number","stack"];function r(e,t){var o=t&&t.loc,i=void 0,s=void 0,a=void 0,u=void 0;o&&(i=o.start.line,s=o.end.line,a=o.start.column,u=o.end.column,e+=" - "+i+":"+a);for(var c=Error.prototype.constructor.call(this,e),l=0;l<n.length;l++)this[n[l]]=c[n[l]];Error.captureStackTrace&&Error.captureStackTrace(this,r);try{o&&(this.lineNumber=i,this.endLineNumber=s,Object.defineProperty?(Object.defineProperty(this,"column",{value:a,enumerable:!0}),Object.defineProperty(this,"endColumn",{value:u,enumerable:!0})):(this.column=a,this.endColumn=u))}catch(e){}}r.prototype=new Error,t.default=r,e.exports=t.default}(Br,Br.exports)),Br.exports}var Fr,Hr={},Ur={exports:{}};var Vr,Gr={exports:{}};var qr,Wr={exports:{}};var Kr,Jr={exports:{}};var Yr,Xr={exports:{}};var Qr,eo={exports:{}};var to,no,ro={exports:{}};function oo(){if(no)return Hr;function e(e){return e&&e.__esModule?e:{default:e}}no=1,Hr.__esModule=!0,Hr.registerDefaultHelpers=function(e){o.default(e),s.default(e),u.default(e),l.default(e),h.default(e),f.default(e),g.default(e)},Hr.moveHelperToHooks=function(e,t,n){e.helpers[t]&&(e.hooks[t]=e.helpers[t],n||(e.helpers[t]=void 0))};var t,n,r=(Fr||(Fr=1,function(e,t){t.__esModule=!0;var n=jr();t.default=function(e){e.registerHelper("blockHelperMissing",function(t,r){var o=r.inverse,i=r.fn;if(!0===t)return i(this);if(!1===t||null==t)return o(this);if(n.isArray(t))return t.length>0?(r.ids&&(r.ids=[r.name]),e.helpers.each(t,r)):o(this);if(r.data&&r.ids){var s=n.createFrame(r.data);s.contextPath=n.appendContextPath(r.data.contextPath,r.name),r={data:s}}return i(t,r)})},e.exports=t.default}(Ur,Ur.exports)),Ur.exports),o=e(r),i=(Vr||(Vr=1,function(e,t){t.__esModule=!0;var n,r=jr(),o=(n=Zr())&&n.__esModule?n:{default:n};t.default=function(e){e.registerHelper("each",function(e,t){if(!t)throw new o.default("Must pass iterator to #each");var n,i=t.fn,s=t.inverse,a=0,u="",c=void 0,l=void 0;function p(t,n,o){c&&(c.key=t,c.index=n,c.first=0===n,c.last=!!o,l&&(c.contextPath=l+t)),u+=i(e[t],{data:c,blockParams:r.blockParams([e[t],t],[l+t,null])})}if(t.data&&t.ids&&(l=r.appendContextPath(t.data.contextPath,t.ids[0])+"."),r.isFunction(e)&&(e=e.call(this)),t.data&&(c=r.createFrame(t.data)),e&&"object"==typeof e)if(r.isArray(e))for(var h=e.length;a<h;a++)a in e&&p(a,a,a===e.length-1);else if("function"==typeof Symbol&&e[Symbol.iterator]){for(var d=[],f=e[Symbol.iterator](),m=f.next();!m.done;m=f.next())d.push(m.value);for(h=(e=d).length;a<h;a++)p(a,a,a===e.length-1)}else n=void 0,Object.keys(e).forEach(function(e){void 0!==n&&p(n,a-1),n=e,a++}),void 0!==n&&p(n,a-1,!0);return 0===a&&(u=s(this)),u})},e.exports=t.default}(Gr,Gr.exports)),Gr.exports),s=e(i),a=(qr||(qr=1,function(e,t){t.__esModule=!0;var n,r=(n=Zr())&&n.__esModule?n:{default:n};t.default=function(e){e.registerHelper("helperMissing",function(){if(1!==arguments.length)throw new r.default('Missing helper: "'+arguments[arguments.length-1].name+'"')})},e.exports=t.default}(Wr,Wr.exports)),Wr.exports),u=e(a),c=(Kr||(Kr=1,function(e,t){t.__esModule=!0;var n,r=jr(),o=(n=Zr())&&n.__esModule?n:{default:n};t.default=function(e){e.registerHelper("if",function(e,t){if(2!=arguments.length)throw new o.default("#if requires exactly one argument");return r.isFunction(e)&&(e=e.call(this)),!t.hash.includeZero&&!e||r.isEmpty(e)?t.inverse(this):t.fn(this)}),e.registerHelper("unless",function(t,n){if(2!=arguments.length)throw new o.default("#unless requires exactly one argument");return e.helpers.if.call(this,t,{fn:n.inverse,inverse:n.fn,hash:n.hash})})},e.exports=t.default}(Jr,Jr.exports)),Jr.exports),l=e(c),p=(Yr||(Yr=1,t=Xr,(n=Xr.exports).__esModule=!0,n.default=function(e){e.registerHelper("log",function(){for(var t=[void 0],n=arguments[arguments.length-1],r=0;r<arguments.length-1;r++)t.push(arguments[r]);var o=1;null!=n.hash.level?o=n.hash.level:n.data&&null!=n.data.level&&(o=n.data.level),t[0]=o,e.log.apply(e,t)})},t.exports=n.default),Xr.exports),h=e(p),d=function(){return Qr||(Qr=1,e=eo,(t=eo.exports).__esModule=!0,t.default=function(e){e.registerHelper("lookup",function(e,t,n){return e?n.lookupProperty(e,t):e})},e.exports=t.default),eo.exports;var e,t}(),f=e(d),m=(to||(to=1,function(e,t){t.__esModule=!0;var n,r=jr(),o=(n=Zr())&&n.__esModule?n:{default:n};t.default=function(e){e.registerHelper("with",function(e,t){if(2!=arguments.length)throw new o.default("#with requires exactly one argument");r.isFunction(e)&&(e=e.call(this));var n=t.fn;if(r.isEmpty(e))return t.inverse(this);var i=t.data;return t.data&&t.ids&&((i=r.createFrame(t.data)).contextPath=r.appendContextPath(t.data.contextPath,t.ids[0])),n(e,{data:i,blockParams:r.blockParams([e],[i&&i.contextPath])})})},e.exports=t.default}(ro,ro.exports)),ro.exports),g=e(m);return Hr}var io,so,ao={},uo={exports:{}};function co(){if(so)return ao;so=1,ao.__esModule=!0,ao.registerDefaultDecorators=function(e){n.default(e)};var e,t=(io||(io=1,function(e,t){t.__esModule=!0;var n=jr();t.default=function(e){e.registerDecorator("inline",function(e,t,r,o){var i=e;return t.partials||(t.partials={},i=function(o,i){var s=r.partials;r.partials=n.extend({},s,t.partials);var a=e(o,i);return r.partials=s,a}),t.partials[o.args[0]]=o.fn,i})},e.exports=t.default}(uo,uo.exports)),uo.exports),n=(e=t)&&e.__esModule?e:{default:e};return ao}var lo,po={exports:{}};function ho(){return lo||(lo=1,function(e,t){t.__esModule=!0;var n=jr(),r={methodMap:["debug","info","warn","error"],level:"info",lookupLevel:function(e){if("string"==typeof e){var t=n.indexOf(r.methodMap,e.toLowerCase());e=t>=0?t:parseInt(e,10)}return e},log:function(e){if(e=r.lookupLevel(e),"undefined"!=typeof console&&r.lookupLevel(r.level)<=e){var t=r.methodMap[e];console[t]||(t="log");for(var n=arguments.length,o=Array(n>1?n-1:0),i=1;i<n;i++)o[i-1]=arguments[i];console[t].apply(console,o)}}};t.default=r,e.exports=t.default}(po,po.exports)),po.exports}var fo,mo,go={};function vo(){if(fo)return go;fo=1,go.__esModule=!0,go.createProtoAccessControl=function(e){var n=Object.create(null);n.__proto__=!1,t.extend(n,e.allowedProtoProperties);var r=Object.create(null);return r.constructor=!1,r.__defineGetter__=!1,r.__defineSetter__=!1,r.__lookupGetter__=!1,r.__lookupSetter__=!1,t.extend(r,e.allowedProtoMethods),{properties:{whitelist:n,defaultValue:e.allowProtoPropertiesByDefault},methods:{whitelist:r,defaultValue:e.allowProtoMethodsByDefault}}},go.resultIsAllowed=function(e,t,n){return i("function"==typeof e?t.methods:t.properties,n)},go.resetLoggedProperties=function(){Object.keys(o).forEach(function(e){delete o[e]})};var e,t=jr(),n=ho(),r=(e=n)&&e.__esModule?e:{default:e},o=Object.create(null);function i(e,t){return void 0!==e.whitelist[t]?!0===e.whitelist[t]:void 0!==e.defaultValue?e.defaultValue:(function(e){!0!==o[e]&&(o[e]=!0,r.default.log("error",'Handlebars: Access has been denied to resolve the property "'+e+'" because it is not an "own property" of its parent.\nYou can add a runtime option to disable the check or this warning:\nSee https://handlebarsjs.com/api-reference/runtime-options.html#options-to-control-prototype-access for details'))}(t),!1)}return go}function yo(){if(mo)return Nr;function e(e){return e&&e.__esModule?e:{default:e}}mo=1,Nr.__esModule=!0,Nr.HandlebarsEnvironment=u;var t=jr(),n=e(Zr()),r=oo(),o=co(),i=e(ho()),s=vo();Nr.VERSION="4.7.9";Nr.COMPILER_REVISION=8;Nr.LAST_COMPATIBLE_COMPILER_REVISION=7;Nr.REVISION_CHANGES={1:"<= 1.0.rc.2",2:"== 1.0.0-rc.3",3:"== 1.0.0-rc.4",4:"== 1.x.x",5:"== 2.0.0-alpha.x",6:">= 2.0.0-beta.1",7:">= 4.0.0 <4.3.0",8:">= 4.3.0"};var a="[object Object]";function u(e,t,n){this.helpers=e||{},this.partials=t||{},this.decorators=n||{},r.registerDefaultHelpers(this),o.registerDefaultDecorators(this)}u.prototype={constructor:u,logger:i.default,log:i.default.log,registerHelper:function(e,r){if(t.toString.call(e)===a){if(r)throw new n.default("Arg not supported with multiple helpers");t.extend(this.helpers,e)}else this.helpers[e]=r},unregisterHelper:function(e){delete this.helpers[e]},registerPartial:function(e,r){if(t.toString.call(e)===a)t.extend(this.partials,e);else{if(void 0===r)throw new n.default('Attempting to register a partial called "'+e+'" as undefined');this.partials[e]=r}},unregisterPartial:function(e){delete this.partials[e]},registerDecorator:function(e,r){if(t.toString.call(e)===a){if(r)throw new n.default("Arg not supported with multiple decorators");t.extend(this.decorators,e)}else this.decorators[e]=r},unregisterDecorator:function(e){delete this.decorators[e]},resetLoggedPropertyAccesses:function(){s.resetLoggedProperties()}};var c=i.default.log;return Nr.log=c,Nr.createFrame=t.createFrame,Nr.logger=i.default,Nr}var _o,bo={exports:{}};var wo,ko,So={},Po={};function xo(){if(ko)return So;ko=1,So.__esModule=!0,So.checkRevision=function(e){var t=e&&e[0]||1,n=o.COMPILER_REVISION;if(t>=o.LAST_COMPATIBLE_COMPILER_REVISION&&t<=o.COMPILER_REVISION)return;if(t<o.LAST_COMPATIBLE_COMPILER_REVISION){var i=o.REVISION_CHANGES[n],s=o.REVISION_CHANGES[t];throw new r.default("Template was precompiled with an older version of Handlebars than the current runtime. Please update your precompiler to a newer version ("+i+") or downgrade your runtime to an older version ("+s+").")}throw new r.default("Template was precompiled with a newer version of Handlebars than the current runtime. Please update your runtime to a newer version ("+e[1]+").")},So.template=function(e,n){if(!n)throw new r.default("No environment passed to template");if(!e||!e.main)throw new r.default("Unknown template object: "+typeof e);e.main.decorator=e.main_d,n.VM.checkRevision(e.compiler);var s=e.compiler&&7===e.compiler[0];var c={strict:function(e,t,n){if(!e||!(t in e))throw new r.default('"'+t+'" not defined in '+e,{loc:n});return c.lookupProperty(e,t)},lookupProperty:function(e,t){var n=e[t];return null==n||Object.prototype.hasOwnProperty.call(e,t)||a.resultIsAllowed(n,c.protoAccessControl,t)?n:void 0},lookup:function(e,t){for(var n=e.length,r=0;r<n;r++){var o=e[r]&&c.lookupProperty(e[r],t);if(null!=o)return o}},lambda:function(e,t){return"function"==typeof e?e.call(t):e},escapeExpression:t.escapeExpression,invokePartial:function(o,i,s){s.hash&&(i=t.extend({},i,s.hash),s.ids&&(s.ids[0]=!0)),o=n.VM.resolvePartial.call(this,o,i,s),s.hooks=this.hooks,s.protoAccessControl=this.protoAccessControl;var a=n.VM.invokePartial.call(this,o,i,s);if(null==a&&n.compile&&(s.partials[s.name]=n.compile(o,e.compilerOptions,n),a=s.partials[s.name](i,s)),null!=a){if(s.indent){for(var u=a.split("\n"),c=0,l=u.length;c<l&&(u[c]||c+1!==l);c++)u[c]=s.indent+u[c];a=u.join("\n")}return a}throw new r.default("The partial "+s.name+" could not be compiled when running in runtime-only mode")},fn:function(t){var n=e[t];return n.decorator=e[t+"_d"],n},programs:[],program:function(e,t,n,r,o){var i=this.programs[e],s=this.fn(e);return t||o||r||n?i=u(this,e,s,t,n,r,o):i||(i=this.programs[e]=u(this,e,s)),i},data:function(e,t){for(;e&&t--;)e=e._parent;return e},mergeIfNeeded:function(e,n){var r=e||n;return e&&n&&e!==n&&(r=t.extend({},n,e)),r},nullContext:Object.seal({}),noop:n.VM.noop,compilerInfo:e.compiler};function l(t){var n=arguments.length<=1||void 0===arguments[1]?{}:arguments[1],r=n.data;l._setup(n),!n.partial&&e.useData&&(r=function(e,t){t&&"root"in t||((t=t?o.createFrame(t):{}).root=e);return t}(t,r));var i=void 0,s=e.useBlockParams?[]:void 0;function a(t){return""+e.main(c,t,c.helpers,c.partials,r,s,i)}return e.useDepths&&(i=n.depths?t!=n.depths[0]?[t].concat(n.depths):n.depths:[t]),(a=p(e.main,a,c,n.depths||[],r,s))(t,n)}return l.isTop=!0,l._setup=function(r){if(r.partial)c.protoAccessControl=r.protoAccessControl,c.helpers=r.helpers,c.partials=r.partials,c.decorators=r.decorators,c.hooks=r.hooks;else{var o={};h(o,n.helpers,c),h(o,r.helpers,c),c.helpers=o,e.usePartial&&(c.partials=c.mergeIfNeeded(r.partials,n.partials)),(e.usePartial||e.useDecorators)&&(c.decorators=t.extend({},n.decorators,r.decorators)),c.hooks={},c.protoAccessControl=a.createProtoAccessControl(r);var u=r.allowCallsToHelperMissing||s;i.moveHelperToHooks(c,"helperMissing",u),i.moveHelperToHooks(c,"blockHelperMissing",u)}},l._child=function(t,n,o,i){if(e.useBlockParams&&!o)throw new r.default("must pass block params");if(e.useDepths&&!i)throw new r.default("must pass parent depths");return u(c,t,e[t],n,0,o,i)},l},So.wrapProgram=u,So.resolvePartial=function(e,t,n){e?e.call||n.name||(n.name=e,e=l(n.partials,e)):e="@partial-block"===n.name?l(n.data,"partial-block"):l(n.partials,n.name);return e},So.invokePartial=function(e,n,i){var s=l(i.data,"partial-block");i.partial=!0,i.ids&&(i.data.contextPath=i.ids[0]||i.data.contextPath);var a=void 0;i.fn&&i.fn!==c&&function(){i.data=o.createFrame(i.data);var e=i.fn;a=i.data["partial-block"]=function(t){var n=arguments.length<=1||void 0===arguments[1]?{}:arguments[1];return n.data=o.createFrame(n.data),n.data["partial-block"]=s,e(t,n)},e.partials&&(i.partials=t.extend({},i.partials,e.partials))}();void 0===e&&a&&(e=a);if(void 0===e)throw new r.default("The partial "+i.name+" could not be found");if(e instanceof Function)return e(n,i)},So.noop=c;var e,t=function(e){if(e&&e.__esModule)return e;var t={};if(null!=e)for(var n in e)Object.prototype.hasOwnProperty.call(e,n)&&(t[n]=e[n]);return t.default=e,t}(jr()),n=Zr(),r=(e=n)&&e.__esModule?e:{default:e},o=yo(),i=oo(),s=(wo||(wo=1,Po.__esModule=!0,Po.wrapHelper=function(e,t){return"function"!=typeof e?e:function(){return arguments[arguments.length-1]=t(arguments[arguments.length-1]),e.apply(this,arguments)}}),Po),a=vo();function u(e,t,n,r,o,i,s){function a(t){var o=arguments.length<=1||void 0===arguments[1]?{}:arguments[1],a=s;return!s||t==s[0]||t===e.nullContext&&null===s[0]||(a=[t].concat(s)),n(e,t,e.helpers,e.partials,o.data||r,i&&[o.blockParams].concat(i),a)}return(a=p(n,a,e,s,r,i)).program=t,a.depth=s?s.length:0,a.blockParams=o||0,a}function c(){return""}function l(e,t){if(e&&Object.prototype.hasOwnProperty.call(e,t))return e[t]}function p(e,n,r,o,i,s){if(e.decorator){var a={};n=e.decorator(n,a,r,o&&o[0],i,s,o),t.extend(n,a)}return n}function h(e,t,n){t&&Object.keys(t).forEach(function(r){var o=t[r];e[r]=function(e,t){var n=t.lookupProperty;return s.wrapHelper(e,function(e){return e.lookupProperty=n,e})}(o,n)})}return So}var Eo,Co,Ao={exports:{}};function Oo(){return Eo||(Eo=1,e=Ao,(t=Ao.exports).__esModule=!0,t.default=function(e){"object"!=typeof globalThis&&(Object.prototype.__defineGetter__("__magic__",function(){return this}),__magic__.globalThis=__magic__,delete Object.prototype.__magic__);var t=globalThis.Handlebars;e.noConflict=function(){return globalThis.Handlebars===e&&(globalThis.Handlebars=t),e}},e.exports=t.default),Ao.exports;var e,t}function zo(){return Co||(Co=1,function(e,t){function n(e){return e&&e.__esModule?e:{default:e}}function r(e){if(e&&e.__esModule)return e;var t={};if(null!=e)for(var n in e)Object.prototype.hasOwnProperty.call(e,n)&&(t[n]=e[n]);return t.default=e,t}t.__esModule=!0;var o=r(yo()),i=(_o||(_o=1,function(e,t){function n(e){this.string=e}t.__esModule=!0,n.prototype.toString=n.prototype.toHTML=function(){return""+this.string},t.default=n,e.exports=t.default}(bo,bo.exports)),bo.exports),s=n(i),a=n(Zr()),u=r(jr()),c=r(xo()),l=n(Oo());function p(){var e=new o.HandlebarsEnvironment;return u.extend(e,o),e.SafeString=s.default,e.Exception=a.default,e.Utils=u,e.escapeExpression=u.escapeExpression,e.VM=c,e.template=function(t){return c.template(t,e)},e}var h=p();h.create=p,l.default(h),h.default=h,t.default=h,e.exports=t.default}(Tr,Tr.exports)),Tr.exports}var Lo,$o={exports:{}};function Io(){return Lo||(Lo=1,function(e,t){t.__esModule=!0;var n={helpers:{helperExpression:function(e){return"SubExpression"===e.type||("MustacheStatement"===e.type||"BlockStatement"===e.type)&&!!(e.params&&e.params.length||e.hash)},scopedId:function(e){return/^\.|this\b/.test(e.original)},simpleId:function(e){return 1===e.parts.length&&!n.helpers.scopedId(e)&&!e.depth}}};t.default=n,e.exports=t.default}($o,$o.exports)),$o.exports}var Mo,To={},No={exports:{}};var Ro,jo,Do={exports:{}},Bo={exports:{}};function Zo(){return Ro||(Ro=1,function(e,t){t.__esModule=!0;var n,r=Zr(),o=(n=r)&&n.__esModule?n:{default:n};function i(){this.parents=[]}function s(e){this.acceptRequired(e,"path"),this.acceptArray(e.params),this.acceptKey(e,"hash")}function a(e){s.call(this,e),this.acceptKey(e,"program"),this.acceptKey(e,"inverse")}function u(e){this.acceptRequired(e,"name"),this.acceptArray(e.params),this.acceptKey(e,"hash")}i.prototype={constructor:i,mutating:!1,acceptKey:function(e,t){var n=this.accept(e[t]);if(this.mutating){if(n&&!i.prototype[n.type])throw new o.default('Unexpected node type "'+n.type+'" found when accepting '+t+" on "+e.type);e[t]=n}},acceptRequired:function(e,t){if(this.acceptKey(e,t),!e[t])throw new o.default(e.type+" requires "+t)},acceptArray:function(e){for(var t=0,n=e.length;t<n;t++)this.acceptKey(e,t),e[t]||(e.splice(t,1),t--,n--)},accept:function(e){if(e){if(!this[e.type])throw new o.default("Unknown type: "+e.type,e);this.current&&this.parents.unshift(this.current),this.current=e;var t=this[e.type](e);return this.current=this.parents.shift(),!this.mutating||t?t:!1!==t?e:void 0}},Program:function(e){this.acceptArray(e.body)},MustacheStatement:s,Decorator:s,BlockStatement:a,DecoratorBlock:a,PartialStatement:u,PartialBlockStatement:function(e){u.call(this,e),this.acceptKey(e,"program")},ContentStatement:function(){},CommentStatement:function(){},SubExpression:s,PathExpression:function(){},StringLiteral:function(){},NumberLiteral:function(){},BooleanLiteral:function(){},UndefinedLiteral:function(){},NullLiteral:function(){},Hash:function(e){this.acceptArray(e.pairs)},HashPair:function(e){this.acceptRequired(e,"value")}},t.default=i,e.exports=t.default}(Bo,Bo.exports)),Bo.exports}var Fo,Ho,Uo={};function Vo(){if(Ho)return To;function e(e){return e&&e.__esModule?e:{default:e}}Ho=1,To.__esModule=!0,To.parseWithoutProcessing=l,To.parse=function(e,t){var n=l(e,t);return new o.default(t).accept(n)};var t=(Mo||(Mo=1,function(e,t){t.__esModule=!0;var n=function(){var e={trace:function(){},yy:{},symbols_:{error:2,root:3,program:4,EOF:5,program_repetition0:6,statement:7,mustache:8,block:9,rawBlock:10,partial:11,partialBlock:12,content:13,COMMENT:14,CONTENT:15,openRawBlock:16,rawBlock_repetition0:17,END_RAW_BLOCK:18,OPEN_RAW_BLOCK:19,helperName:20,openRawBlock_repetition0:21,openRawBlock_option0:22,CLOSE_RAW_BLOCK:23,openBlock:24,block_option0:25,closeBlock:26,openInverse:27,block_option1:28,OPEN_BLOCK:29,openBlock_repetition0:30,openBlock_option0:31,openBlock_option1:32,CLOSE:33,OPEN_INVERSE:34,openInverse_repetition0:35,openInverse_option0:36,openInverse_option1:37,openInverseChain:38,OPEN_INVERSE_CHAIN:39,openInverseChain_repetition0:40,openInverseChain_option0:41,openInverseChain_option1:42,inverseAndProgram:43,INVERSE:44,inverseChain:45,inverseChain_option0:46,OPEN_ENDBLOCK:47,OPEN:48,mustache_repetition0:49,mustache_option0:50,OPEN_UNESCAPED:51,mustache_repetition1:52,mustache_option1:53,CLOSE_UNESCAPED:54,OPEN_PARTIAL:55,partialName:56,partial_repetition0:57,partial_option0:58,openPartialBlock:59,OPEN_PARTIAL_BLOCK:60,openPartialBlock_repetition0:61,openPartialBlock_option0:62,param:63,sexpr:64,OPEN_SEXPR:65,sexpr_repetition0:66,sexpr_option0:67,CLOSE_SEXPR:68,hash:69,hash_repetition_plus0:70,hashSegment:71,ID:72,EQUALS:73,blockParams:74,OPEN_BLOCK_PARAMS:75,blockParams_repetition_plus0:76,CLOSE_BLOCK_PARAMS:77,path:78,dataName:79,STRING:80,NUMBER:81,BOOLEAN:82,UNDEFINED:83,NULL:84,DATA:85,pathSegments:86,SEP:87,$accept:0,$end:1},terminals_:{2:"error",5:"EOF",14:"COMMENT",15:"CONTENT",18:"END_RAW_BLOCK",19:"OPEN_RAW_BLOCK",23:"CLOSE_RAW_BLOCK",29:"OPEN_BLOCK",33:"CLOSE",34:"OPEN_INVERSE",39:"OPEN_INVERSE_CHAIN",44:"INVERSE",47:"OPEN_ENDBLOCK",48:"OPEN",51:"OPEN_UNESCAPED",54:"CLOSE_UNESCAPED",55:"OPEN_PARTIAL",60:"OPEN_PARTIAL_BLOCK",65:"OPEN_SEXPR",68:"CLOSE_SEXPR",72:"ID",73:"EQUALS",75:"OPEN_BLOCK_PARAMS",77:"CLOSE_BLOCK_PARAMS",80:"STRING",81:"NUMBER",82:"BOOLEAN",83:"UNDEFINED",84:"NULL",85:"DATA",87:"SEP"},productions_:[0,[3,2],[4,1],[7,1],[7,1],[7,1],[7,1],[7,1],[7,1],[7,1],[13,1],[10,3],[16,5],[9,4],[9,4],[24,6],[27,6],[38,6],[43,2],[45,3],[45,1],[26,3],[8,5],[8,5],[11,5],[12,3],[59,5],[63,1],[63,1],[64,5],[69,1],[71,3],[74,3],[20,1],[20,1],[20,1],[20,1],[20,1],[20,1],[20,1],[56,1],[56,1],[79,2],[78,1],[86,3],[86,1],[6,0],[6,2],[17,0],[17,2],[21,0],[21,2],[22,0],[22,1],[25,0],[25,1],[28,0],[28,1],[30,0],[30,2],[31,0],[31,1],[32,0],[32,1],[35,0],[35,2],[36,0],[36,1],[37,0],[37,1],[40,0],[40,2],[41,0],[41,1],[42,0],[42,1],[46,0],[46,1],[49,0],[49,2],[50,0],[50,1],[52,0],[52,2],[53,0],[53,1],[57,0],[57,2],[58,0],[58,1],[61,0],[61,2],[62,0],[62,1],[66,0],[66,2],[67,0],[67,1],[70,1],[70,2],[76,1],[76,2]],performAction:function(e,t,n,r,o,i,s){var a=i.length-1;switch(o){case 1:return i[a-1];case 2:this.$=r.prepareProgram(i[a]);break;case 3:case 4:case 5:case 6:case 7:case 8:case 20:case 27:case 28:case 33:case 34:case 40:case 41:this.$=i[a];break;case 9:this.$={type:"CommentStatement",value:r.stripComment(i[a]),strip:r.stripFlags(i[a],i[a]),loc:r.locInfo(this._$)};break;case 10:this.$={type:"ContentStatement",original:i[a],value:i[a],loc:r.locInfo(this._$)};break;case 11:this.$=r.prepareRawBlock(i[a-2],i[a-1],i[a],this._$);break;case 12:this.$={path:i[a-3],params:i[a-2],hash:i[a-1]};break;case 13:this.$=r.prepareBlock(i[a-3],i[a-2],i[a-1],i[a],!1,this._$);break;case 14:this.$=r.prepareBlock(i[a-3],i[a-2],i[a-1],i[a],!0,this._$);break;case 15:this.$={open:i[a-5],path:i[a-4],params:i[a-3],hash:i[a-2],blockParams:i[a-1],strip:r.stripFlags(i[a-5],i[a])};break;case 16:case 17:this.$={path:i[a-4],params:i[a-3],hash:i[a-2],blockParams:i[a-1],strip:r.stripFlags(i[a-5],i[a])};break;case 18:this.$={strip:r.stripFlags(i[a-1],i[a-1]),program:i[a]};break;case 19:var u=r.prepareBlock(i[a-2],i[a-1],i[a],i[a],!1,this._$),c=r.prepareProgram([u],i[a-1].loc);c.chained=!0,this.$={strip:i[a-2].strip,program:c,chain:!0};break;case 21:this.$={path:i[a-1],strip:r.stripFlags(i[a-2],i[a])};break;case 22:case 23:this.$=r.prepareMustache(i[a-3],i[a-2],i[a-1],i[a-4],r.stripFlags(i[a-4],i[a]),this._$);break;case 24:this.$={type:"PartialStatement",name:i[a-3],params:i[a-2],hash:i[a-1],indent:"",strip:r.stripFlags(i[a-4],i[a]),loc:r.locInfo(this._$)};break;case 25:this.$=r.preparePartialBlock(i[a-2],i[a-1],i[a],this._$);break;case 26:this.$={path:i[a-3],params:i[a-2],hash:i[a-1],strip:r.stripFlags(i[a-4],i[a])};break;case 29:this.$={type:"SubExpression",path:i[a-3],params:i[a-2],hash:i[a-1],loc:r.locInfo(this._$)};break;case 30:this.$={type:"Hash",pairs:i[a],loc:r.locInfo(this._$)};break;case 31:this.$={type:"HashPair",key:r.id(i[a-2]),value:i[a],loc:r.locInfo(this._$)};break;case 32:this.$=r.id(i[a-1]);break;case 35:this.$={type:"StringLiteral",value:i[a],original:i[a],loc:r.locInfo(this._$)};break;case 36:this.$={type:"NumberLiteral",value:Number(i[a]),original:Number(i[a]),loc:r.locInfo(this._$)};break;case 37:this.$={type:"BooleanLiteral",value:"true"===i[a],original:"true"===i[a],loc:r.locInfo(this._$)};break;case 38:this.$={type:"UndefinedLiteral",original:void 0,value:void 0,loc:r.locInfo(this._$)};break;case 39:this.$={type:"NullLiteral",original:null,value:null,loc:r.locInfo(this._$)};break;case 42:this.$=r.preparePath(!0,i[a],this._$);break;case 43:this.$=r.preparePath(!1,i[a],this._$);break;case 44:i[a-2].push({part:r.id(i[a]),original:i[a],separator:i[a-1]}),this.$=i[a-2];break;case 45:this.$=[{part:r.id(i[a]),original:i[a]}];break;case 46:case 48:case 50:case 58:case 64:case 70:case 78:case 82:case 86:case 90:case 94:this.$=[];break;case 47:case 49:case 51:case 59:case 65:case 71:case 79:case 83:case 87:case 91:case 95:case 99:case 101:i[a-1].push(i[a]);break;case 98:case 100:this.$=[i[a]]}},table:[{3:1,4:2,5:[2,46],6:3,14:[2,46],15:[2,46],19:[2,46],29:[2,46],34:[2,46],48:[2,46],51:[2,46],55:[2,46],60:[2,46]},{1:[3]},{5:[1,4]},{5:[2,2],7:5,8:6,9:7,10:8,11:9,12:10,13:11,14:[1,12],15:[1,20],16:17,19:[1,23],24:15,27:16,29:[1,21],34:[1,22],39:[2,2],44:[2,2],47:[2,2],48:[1,13],51:[1,14],55:[1,18],59:19,60:[1,24]},{1:[2,1]},{5:[2,47],14:[2,47],15:[2,47],19:[2,47],29:[2,47],34:[2,47],39:[2,47],44:[2,47],47:[2,47],48:[2,47],51:[2,47],55:[2,47],60:[2,47]},{5:[2,3],14:[2,3],15:[2,3],19:[2,3],29:[2,3],34:[2,3],39:[2,3],44:[2,3],47:[2,3],48:[2,3],51:[2,3],55:[2,3],60:[2,3]},{5:[2,4],14:[2,4],15:[2,4],19:[2,4],29:[2,4],34:[2,4],39:[2,4],44:[2,4],47:[2,4],48:[2,4],51:[2,4],55:[2,4],60:[2,4]},{5:[2,5],14:[2,5],15:[2,5],19:[2,5],29:[2,5],34:[2,5],39:[2,5],44:[2,5],47:[2,5],48:[2,5],51:[2,5],55:[2,5],60:[2,5]},{5:[2,6],14:[2,6],15:[2,6],19:[2,6],29:[2,6],34:[2,6],39:[2,6],44:[2,6],47:[2,6],48:[2,6],51:[2,6],55:[2,6],60:[2,6]},{5:[2,7],14:[2,7],15:[2,7],19:[2,7],29:[2,7],34:[2,7],39:[2,7],44:[2,7],47:[2,7],48:[2,7],51:[2,7],55:[2,7],60:[2,7]},{5:[2,8],14:[2,8],15:[2,8],19:[2,8],29:[2,8],34:[2,8],39:[2,8],44:[2,8],47:[2,8],48:[2,8],51:[2,8],55:[2,8],60:[2,8]},{5:[2,9],14:[2,9],15:[2,9],19:[2,9],29:[2,9],34:[2,9],39:[2,9],44:[2,9],47:[2,9],48:[2,9],51:[2,9],55:[2,9],60:[2,9]},{20:25,72:[1,35],78:26,79:27,80:[1,28],81:[1,29],82:[1,30],83:[1,31],84:[1,32],85:[1,34],86:33},{20:36,72:[1,35],78:26,79:27,80:[1,28],81:[1,29],82:[1,30],83:[1,31],84:[1,32],85:[1,34],86:33},{4:37,6:3,14:[2,46],15:[2,46],19:[2,46],29:[2,46],34:[2,46],39:[2,46],44:[2,46],47:[2,46],48:[2,46],51:[2,46],55:[2,46],60:[2,46]},{4:38,6:3,14:[2,46],15:[2,46],19:[2,46],29:[2,46],34:[2,46],44:[2,46],47:[2,46],48:[2,46],51:[2,46],55:[2,46],60:[2,46]},{15:[2,48],17:39,18:[2,48]},{20:41,56:40,64:42,65:[1,43],72:[1,35],78:26,79:27,80:[1,28],81:[1,29],82:[1,30],83:[1,31],84:[1,32],85:[1,34],86:33},{4:44,6:3,14:[2,46],15:[2,46],19:[2,46],29:[2,46],34:[2,46],47:[2,46],48:[2,46],51:[2,46],55:[2,46],60:[2,46]},{5:[2,10],14:[2,10],15:[2,10],18:[2,10],19:[2,10],29:[2,10],34:[2,10],39:[2,10],44:[2,10],47:[2,10],48:[2,10],51:[2,10],55:[2,10],60:[2,10]},{20:45,72:[1,35],78:26,79:27,80:[1,28],81:[1,29],82:[1,30],83:[1,31],84:[1,32],85:[1,34],86:33},{20:46,72:[1,35],78:26,79:27,80:[1,28],81:[1,29],82:[1,30],83:[1,31],84:[1,32],85:[1,34],86:33},{20:47,72:[1,35],78:26,79:27,80:[1,28],81:[1,29],82:[1,30],83:[1,31],84:[1,32],85:[1,34],86:33},{20:41,56:48,64:42,65:[1,43],72:[1,35],78:26,79:27,80:[1,28],81:[1,29],82:[1,30],83:[1,31],84:[1,32],85:[1,34],86:33},{33:[2,78],49:49,65:[2,78],72:[2,78],80:[2,78],81:[2,78],82:[2,78],83:[2,78],84:[2,78],85:[2,78]},{23:[2,33],33:[2,33],54:[2,33],65:[2,33],68:[2,33],72:[2,33],75:[2,33],80:[2,33],81:[2,33],82:[2,33],83:[2,33],84:[2,33],85:[2,33]},{23:[2,34],33:[2,34],54:[2,34],65:[2,34],68:[2,34],72:[2,34],75:[2,34],80:[2,34],81:[2,34],82:[2,34],83:[2,34],84:[2,34],85:[2,34]},{23:[2,35],33:[2,35],54:[2,35],65:[2,35],68:[2,35],72:[2,35],75:[2,35],80:[2,35],81:[2,35],82:[2,35],83:[2,35],84:[2,35],85:[2,35]},{23:[2,36],33:[2,36],54:[2,36],65:[2,36],68:[2,36],72:[2,36],75:[2,36],80:[2,36],81:[2,36],82:[2,36],83:[2,36],84:[2,36],85:[2,36]},{23:[2,37],33:[2,37],54:[2,37],65:[2,37],68:[2,37],72:[2,37],75:[2,37],80:[2,37],81:[2,37],82:[2,37],83:[2,37],84:[2,37],85:[2,37]},{23:[2,38],33:[2,38],54:[2,38],65:[2,38],68:[2,38],72:[2,38],75:[2,38],80:[2,38],81:[2,38],82:[2,38],83:[2,38],84:[2,38],85:[2,38]},{23:[2,39],33:[2,39],54:[2,39],65:[2,39],68:[2,39],72:[2,39],75:[2,39],80:[2,39],81:[2,39],82:[2,39],83:[2,39],84:[2,39],85:[2,39]},{23:[2,43],33:[2,43],54:[2,43],65:[2,43],68:[2,43],72:[2,43],75:[2,43],80:[2,43],81:[2,43],82:[2,43],83:[2,43],84:[2,43],85:[2,43],87:[1,50]},{72:[1,35],86:51},{23:[2,45],33:[2,45],54:[2,45],65:[2,45],68:[2,45],72:[2,45],75:[2,45],80:[2,45],81:[2,45],82:[2,45],83:[2,45],84:[2,45],85:[2,45],87:[2,45]},{52:52,54:[2,82],65:[2,82],72:[2,82],80:[2,82],81:[2,82],82:[2,82],83:[2,82],84:[2,82],85:[2,82]},{25:53,38:55,39:[1,57],43:56,44:[1,58],45:54,47:[2,54]},{28:59,43:60,44:[1,58],47:[2,56]},{13:62,15:[1,20],18:[1,61]},{33:[2,86],57:63,65:[2,86],72:[2,86],80:[2,86],81:[2,86],82:[2,86],83:[2,86],84:[2,86],85:[2,86]},{33:[2,40],65:[2,40],72:[2,40],80:[2,40],81:[2,40],82:[2,40],83:[2,40],84:[2,40],85:[2,40]},{33:[2,41],65:[2,41],72:[2,41],80:[2,41],81:[2,41],82:[2,41],83:[2,41],84:[2,41],85:[2,41]},{20:64,72:[1,35],78:26,79:27,80:[1,28],81:[1,29],82:[1,30],83:[1,31],84:[1,32],85:[1,34],86:33},{26:65,47:[1,66]},{30:67,33:[2,58],65:[2,58],72:[2,58],75:[2,58],80:[2,58],81:[2,58],82:[2,58],83:[2,58],84:[2,58],85:[2,58]},{33:[2,64],35:68,65:[2,64],72:[2,64],75:[2,64],80:[2,64],81:[2,64],82:[2,64],83:[2,64],84:[2,64],85:[2,64]},{21:69,23:[2,50],65:[2,50],72:[2,50],80:[2,50],81:[2,50],82:[2,50],83:[2,50],84:[2,50],85:[2,50]},{33:[2,90],61:70,65:[2,90],72:[2,90],80:[2,90],81:[2,90],82:[2,90],83:[2,90],84:[2,90],85:[2,90]},{20:74,33:[2,80],50:71,63:72,64:75,65:[1,43],69:73,70:76,71:77,72:[1,78],78:26,79:27,80:[1,28],81:[1,29],82:[1,30],83:[1,31],84:[1,32],85:[1,34],86:33},{72:[1,79]},{23:[2,42],33:[2,42],54:[2,42],65:[2,42],68:[2,42],72:[2,42],75:[2,42],80:[2,42],81:[2,42],82:[2,42],83:[2,42],84:[2,42],85:[2,42],87:[1,50]},{20:74,53:80,54:[2,84],63:81,64:75,65:[1,43],69:82,70:76,71:77,72:[1,78],78:26,79:27,80:[1,28],81:[1,29],82:[1,30],83:[1,31],84:[1,32],85:[1,34],86:33},{26:83,47:[1,66]},{47:[2,55]},{4:84,6:3,14:[2,46],15:[2,46],19:[2,46],29:[2,46],34:[2,46],39:[2,46],44:[2,46],47:[2,46],48:[2,46],51:[2,46],55:[2,46],60:[2,46]},{47:[2,20]},{20:85,72:[1,35],78:26,79:27,80:[1,28],81:[1,29],82:[1,30],83:[1,31],84:[1,32],85:[1,34],86:33},{4:86,6:3,14:[2,46],15:[2,46],19:[2,46],29:[2,46],34:[2,46],47:[2,46],48:[2,46],51:[2,46],55:[2,46],60:[2,46]},{26:87,47:[1,66]},{47:[2,57]},{5:[2,11],14:[2,11],15:[2,11],19:[2,11],29:[2,11],34:[2,11],39:[2,11],44:[2,11],47:[2,11],48:[2,11],51:[2,11],55:[2,11],60:[2,11]},{15:[2,49],18:[2,49]},{20:74,33:[2,88],58:88,63:89,64:75,65:[1,43],69:90,70:76,71:77,72:[1,78],78:26,79:27,80:[1,28],81:[1,29],82:[1,30],83:[1,31],84:[1,32],85:[1,34],86:33},{65:[2,94],66:91,68:[2,94],72:[2,94],80:[2,94],81:[2,94],82:[2,94],83:[2,94],84:[2,94],85:[2,94]},{5:[2,25],14:[2,25],15:[2,25],19:[2,25],29:[2,25],34:[2,25],39:[2,25],44:[2,25],47:[2,25],48:[2,25],51:[2,25],55:[2,25],60:[2,25]},{20:92,72:[1,35],78:26,79:27,80:[1,28],81:[1,29],82:[1,30],83:[1,31],84:[1,32],85:[1,34],86:33},{20:74,31:93,33:[2,60],63:94,64:75,65:[1,43],69:95,70:76,71:77,72:[1,78],75:[2,60],78:26,79:27,80:[1,28],81:[1,29],82:[1,30],83:[1,31],84:[1,32],85:[1,34],86:33},{20:74,33:[2,66],36:96,63:97,64:75,65:[1,43],69:98,70:76,71:77,72:[1,78],75:[2,66],78:26,79:27,80:[1,28],81:[1,29],82:[1,30],83:[1,31],84:[1,32],85:[1,34],86:33},{20:74,22:99,23:[2,52],63:100,64:75,65:[1,43],69:101,70:76,71:77,72:[1,78],78:26,79:27,80:[1,28],81:[1,29],82:[1,30],83:[1,31],84:[1,32],85:[1,34],86:33},{20:74,33:[2,92],62:102,63:103,64:75,65:[1,43],69:104,70:76,71:77,72:[1,78],78:26,79:27,80:[1,28],81:[1,29],82:[1,30],83:[1,31],84:[1,32],85:[1,34],86:33},{33:[1,105]},{33:[2,79],65:[2,79],72:[2,79],80:[2,79],81:[2,79],82:[2,79],83:[2,79],84:[2,79],85:[2,79]},{33:[2,81]},{23:[2,27],33:[2,27],54:[2,27],65:[2,27],68:[2,27],72:[2,27],75:[2,27],80:[2,27],81:[2,27],82:[2,27],83:[2,27],84:[2,27],85:[2,27]},{23:[2,28],33:[2,28],54:[2,28],65:[2,28],68:[2,28],72:[2,28],75:[2,28],80:[2,28],81:[2,28],82:[2,28],83:[2,28],84:[2,28],85:[2,28]},{23:[2,30],33:[2,30],54:[2,30],68:[2,30],71:106,72:[1,107],75:[2,30]},{23:[2,98],33:[2,98],54:[2,98],68:[2,98],72:[2,98],75:[2,98]},{23:[2,45],33:[2,45],54:[2,45],65:[2,45],68:[2,45],72:[2,45],73:[1,108],75:[2,45],80:[2,45],81:[2,45],82:[2,45],83:[2,45],84:[2,45],85:[2,45],87:[2,45]},{23:[2,44],33:[2,44],54:[2,44],65:[2,44],68:[2,44],72:[2,44],75:[2,44],80:[2,44],81:[2,44],82:[2,44],83:[2,44],84:[2,44],85:[2,44],87:[2,44]},{54:[1,109]},{54:[2,83],65:[2,83],72:[2,83],80:[2,83],81:[2,83],82:[2,83],83:[2,83],84:[2,83],85:[2,83]},{54:[2,85]},{5:[2,13],14:[2,13],15:[2,13],19:[2,13],29:[2,13],34:[2,13],39:[2,13],44:[2,13],47:[2,13],48:[2,13],51:[2,13],55:[2,13],60:[2,13]},{38:55,39:[1,57],43:56,44:[1,58],45:111,46:110,47:[2,76]},{33:[2,70],40:112,65:[2,70],72:[2,70],75:[2,70],80:[2,70],81:[2,70],82:[2,70],83:[2,70],84:[2,70],85:[2,70]},{47:[2,18]},{5:[2,14],14:[2,14],15:[2,14],19:[2,14],29:[2,14],34:[2,14],39:[2,14],44:[2,14],47:[2,14],48:[2,14],51:[2,14],55:[2,14],60:[2,14]},{33:[1,113]},{33:[2,87],65:[2,87],72:[2,87],80:[2,87],81:[2,87],82:[2,87],83:[2,87],84:[2,87],85:[2,87]},{33:[2,89]},{20:74,63:115,64:75,65:[1,43],67:114,68:[2,96],69:116,70:76,71:77,72:[1,78],78:26,79:27,80:[1,28],81:[1,29],82:[1,30],83:[1,31],84:[1,32],85:[1,34],86:33},{33:[1,117]},{32:118,33:[2,62],74:119,75:[1,120]},{33:[2,59],65:[2,59],72:[2,59],75:[2,59],80:[2,59],81:[2,59],82:[2,59],83:[2,59],84:[2,59],85:[2,59]},{33:[2,61],75:[2,61]},{33:[2,68],37:121,74:122,75:[1,120]},{33:[2,65],65:[2,65],72:[2,65],75:[2,65],80:[2,65],81:[2,65],82:[2,65],83:[2,65],84:[2,65],85:[2,65]},{33:[2,67],75:[2,67]},{23:[1,123]},{23:[2,51],65:[2,51],72:[2,51],80:[2,51],81:[2,51],82:[2,51],83:[2,51],84:[2,51],85:[2,51]},{23:[2,53]},{33:[1,124]},{33:[2,91],65:[2,91],72:[2,91],80:[2,91],81:[2,91],82:[2,91],83:[2,91],84:[2,91],85:[2,91]},{33:[2,93]},{5:[2,22],14:[2,22],15:[2,22],19:[2,22],29:[2,22],34:[2,22],39:[2,22],44:[2,22],47:[2,22],48:[2,22],51:[2,22],55:[2,22],60:[2,22]},{23:[2,99],33:[2,99],54:[2,99],68:[2,99],72:[2,99],75:[2,99]},{73:[1,108]},{20:74,63:125,64:75,65:[1,43],72:[1,35],78:26,79:27,80:[1,28],81:[1,29],82:[1,30],83:[1,31],84:[1,32],85:[1,34],86:33},{5:[2,23],14:[2,23],15:[2,23],19:[2,23],29:[2,23],34:[2,23],39:[2,23],44:[2,23],47:[2,23],48:[2,23],51:[2,23],55:[2,23],60:[2,23]},{47:[2,19]},{47:[2,77]},{20:74,33:[2,72],41:126,63:127,64:75,65:[1,43],69:128,70:76,71:77,72:[1,78],75:[2,72],78:26,79:27,80:[1,28],81:[1,29],82:[1,30],83:[1,31],84:[1,32],85:[1,34],86:33},{5:[2,24],14:[2,24],15:[2,24],19:[2,24],29:[2,24],34:[2,24],39:[2,24],44:[2,24],47:[2,24],48:[2,24],51:[2,24],55:[2,24],60:[2,24]},{68:[1,129]},{65:[2,95],68:[2,95],72:[2,95],80:[2,95],81:[2,95],82:[2,95],83:[2,95],84:[2,95],85:[2,95]},{68:[2,97]},{5:[2,21],14:[2,21],15:[2,21],19:[2,21],29:[2,21],34:[2,21],39:[2,21],44:[2,21],47:[2,21],48:[2,21],51:[2,21],55:[2,21],60:[2,21]},{33:[1,130]},{33:[2,63]},{72:[1,132],76:131},{33:[1,133]},{33:[2,69]},{15:[2,12],18:[2,12]},{14:[2,26],15:[2,26],19:[2,26],29:[2,26],34:[2,26],47:[2,26],48:[2,26],51:[2,26],55:[2,26],60:[2,26]},{23:[2,31],33:[2,31],54:[2,31],68:[2,31],72:[2,31],75:[2,31]},{33:[2,74],42:134,74:135,75:[1,120]},{33:[2,71],65:[2,71],72:[2,71],75:[2,71],80:[2,71],81:[2,71],82:[2,71],83:[2,71],84:[2,71],85:[2,71]},{33:[2,73],75:[2,73]},{23:[2,29],33:[2,29],54:[2,29],65:[2,29],68:[2,29],72:[2,29],75:[2,29],80:[2,29],81:[2,29],82:[2,29],83:[2,29],84:[2,29],85:[2,29]},{14:[2,15],15:[2,15],19:[2,15],29:[2,15],34:[2,15],39:[2,15],44:[2,15],47:[2,15],48:[2,15],51:[2,15],55:[2,15],60:[2,15]},{72:[1,137],77:[1,136]},{72:[2,100],77:[2,100]},{14:[2,16],15:[2,16],19:[2,16],29:[2,16],34:[2,16],44:[2,16],47:[2,16],48:[2,16],51:[2,16],55:[2,16],60:[2,16]},{33:[1,138]},{33:[2,75]},{33:[2,32]},{72:[2,101],77:[2,101]},{14:[2,17],15:[2,17],19:[2,17],29:[2,17],34:[2,17],39:[2,17],44:[2,17],47:[2,17],48:[2,17],51:[2,17],55:[2,17],60:[2,17]}],defaultActions:{4:[2,1],54:[2,55],56:[2,20],60:[2,57],73:[2,81],82:[2,85],86:[2,18],90:[2,89],101:[2,53],104:[2,93],110:[2,19],111:[2,77],116:[2,97],119:[2,63],122:[2,69],135:[2,75],136:[2,32]},parseError:function(e,t){throw new Error(e)},parse:function(e){var t=this,n=[0],r=[null],o=[],i=this.table,s="",a=0,u=0;this.lexer.setInput(e),this.lexer.yy=this.yy,this.yy.lexer=this.lexer,this.yy.parser=this,void 0===this.lexer.yylloc&&(this.lexer.yylloc={});var c=this.lexer.yylloc;o.push(c);var l=this.lexer.options&&this.lexer.options.ranges;function p(){var e;return"number"!=typeof(e=t.lexer.lex()||1)&&(e=t.symbols_[e]||e),e}"function"==typeof this.yy.parseError&&(this.parseError=this.yy.parseError);for(var h,d,f,m,g,v,y,_,b={};;){if(d=n[n.length-1],this.defaultActions[d]?f=this.defaultActions[d]:(null==h&&(h=p()),f=i[d]&&i[d][h]),void 0===f||!f.length||!f[0]){var w="";for(g in _=[],i[d])this.terminals_[g]&&g>2&&_.push("'"+this.terminals_[g]+"'");w=this.lexer.showPosition?"Parse error on line "+(a+1)+":\n"+this.lexer.showPosition()+"\nExpecting "+_.join(", ")+", got '"+(this.terminals_[h]||h)+"'":"Parse error on line "+(a+1)+": Unexpected "+(1==h?"end of input":"'"+(this.terminals_[h]||h)+"'"),this.parseError(w,{text:this.lexer.match,token:this.terminals_[h]||h,line:this.lexer.yylineno,loc:c,expected:_})}if(f[0]instanceof Array&&f.length>1)throw new Error("Parse Error: multiple actions possible at state: "+d+", token: "+h);switch(f[0]){case 1:n.push(h),r.push(this.lexer.yytext),o.push(this.lexer.yylloc),n.push(f[1]),h=null,u=this.lexer.yyleng,s=this.lexer.yytext,a=this.lexer.yylineno,c=this.lexer.yylloc;break;case 2:if(v=this.productions_[f[1]][1],b.$=r[r.length-v],b._$={first_line:o[o.length-(v||1)].first_line,last_line:o[o.length-1].last_line,first_column:o[o.length-(v||1)].first_column,last_column:o[o.length-1].last_column},l&&(b._$.range=[o[o.length-(v||1)].range[0],o[o.length-1].range[1]]),void 0!==(m=this.performAction.call(b,s,u,a,this.yy,f[1],r,o)))return m;v&&(n=n.slice(0,-1*v*2),r=r.slice(0,-1*v),o=o.slice(0,-1*v)),n.push(this.productions_[f[1]][0]),r.push(b.$),o.push(b._$),y=i[n[n.length-2]][n[n.length-1]],n.push(y);break;case 3:return!0}}return!0}},t={EOF:1,parseError:function(e,t){if(!this.yy.parser)throw new Error(e);this.yy.parser.parseError(e,t)},setInput:function(e){return this._input=e,this._more=this._less=this.done=!1,this.yylineno=this.yyleng=0,this.yytext=this.matched=this.match="",this.conditionStack=["INITIAL"],this.yylloc={first_line:1,first_column:0,last_line:1,last_column:0},this.options.ranges&&(this.yylloc.range=[0,0]),this.offset=0,this},input:function(){var e=this._input[0];return this.yytext+=e,this.yyleng++,this.offset++,this.match+=e,this.matched+=e,e.match(/(?:\r\n?|\n).*/g)?(this.yylineno++,this.yylloc.last_line++):this.yylloc.last_column++,this.options.ranges&&this.yylloc.range[1]++,this._input=this._input.slice(1),e},unput:function(e){var t=e.length,n=e.split(/(?:\r\n?|\n)/g);this._input=e+this._input,this.yytext=this.yytext.substr(0,this.yytext.length-t-1),this.offset-=t;var r=this.match.split(/(?:\r\n?|\n)/g);this.match=this.match.substr(0,this.match.length-1),this.matched=this.matched.substr(0,this.matched.length-1),n.length-1&&(this.yylineno-=n.length-1);var o=this.yylloc.range;return this.yylloc={first_line:this.yylloc.first_line,last_line:this.yylineno+1,first_column:this.yylloc.first_column,last_column:n?(n.length===r.length?this.yylloc.first_column:0)+r[r.length-n.length].length-n[0].length:this.yylloc.first_column-t},this.options.ranges&&(this.yylloc.range=[o[0],o[0]+this.yyleng-t]),this},more:function(){return this._more=!0,this},less:function(e){this.unput(this.match.slice(e))},pastInput:function(){var e=this.matched.substr(0,this.matched.length-this.match.length);return(e.length>20?"...":"")+e.substr(-20).replace(/\n/g,"")},upcomingInput:function(){var e=this.match;return e.length<20&&(e+=this._input.substr(0,20-e.length)),(e.substr(0,20)+(e.length>20?"...":"")).replace(/\n/g,"")},showPosition:function(){var e=this.pastInput(),t=new Array(e.length+1).join("-");return e+this.upcomingInput()+"\n"+t+"^"},next:function(){if(this.done)return this.EOF;var e,t,n,r,o;this._input||(this.done=!0),this._more||(this.yytext="",this.match="");for(var i=this._currentRules(),s=0;s<i.length&&(!(n=this._input.match(this.rules[i[s]]))||t&&!(n[0].length>t[0].length)||(t=n,r=s,this.options.flex));s++);return t?((o=t[0].match(/(?:\r\n?|\n).*/g))&&(this.yylineno+=o.length),this.yylloc={first_line:this.yylloc.last_line,last_line:this.yylineno+1,first_column:this.yylloc.last_column,last_column:o?o[o.length-1].length-o[o.length-1].match(/\r?\n?/)[0].length:this.yylloc.last_column+t[0].length},this.yytext+=t[0],this.match+=t[0],this.matches=t,this.yyleng=this.yytext.length,this.options.ranges&&(this.yylloc.range=[this.offset,this.offset+=this.yyleng]),this._more=!1,this._input=this._input.slice(t[0].length),this.matched+=t[0],e=this.performAction.call(this,this.yy,this,i[r],this.conditionStack[this.conditionStack.length-1]),this.done&&this._input&&(this.done=!1),e||void 0):""===this._input?this.EOF:this.parseError("Lexical error on line "+(this.yylineno+1)+". Unrecognized text.\n"+this.showPosition(),{text:"",token:null,line:this.yylineno})},lex:function(){var e=this.next();return void 0!==e?e:this.lex()},begin:function(e){this.conditionStack.push(e)},popState:function(){return this.conditionStack.pop()},_currentRules:function(){return this.conditions[this.conditionStack[this.conditionStack.length-1]].rules},topState:function(){return this.conditionStack[this.conditionStack.length-2]},pushState:function(e){this.begin(e)},options:{},performAction:function(e,t,n,r){function o(e,n){return t.yytext=t.yytext.substring(e,t.yyleng-n+e)}switch(n){case 0:if("\\\\"===t.yytext.slice(-2)?(o(0,1),this.begin("mu")):"\\"===t.yytext.slice(-1)?(o(0,1),this.begin("emu")):this.begin("mu"),t.yytext)return 15;break;case 1:case 5:return 15;case 2:return this.popState(),15;case 3:return this.begin("raw"),15;case 4:return this.popState(),"raw"===this.conditionStack[this.conditionStack.length-1]?15:(o(5,9),"END_RAW_BLOCK");case 6:case 22:return this.popState(),14;case 7:return 65;case 8:return 68;case 9:return 19;case 10:return this.popState(),this.begin("raw"),23;case 11:return 55;case 12:return 60;case 13:return 29;case 14:return 47;case 15:case 16:return this.popState(),44;case 17:return 34;case 18:return 39;case 19:return 51;case 20:case 23:return 48;case 21:this.unput(t.yytext),this.popState(),this.begin("com");break;case 24:return 73;case 25:case 26:case 41:return 72;case 27:return 87;case 28:break;case 29:return this.popState(),54;case 30:return this.popState(),33;case 31:return t.yytext=o(1,2).replace(/\\"/g,'"'),80;case 32:return t.yytext=o(1,2).replace(/\\'/g,"'"),80;case 33:return 85;case 34:case 35:return 82;case 36:return 83;case 37:return 84;case 38:return 81;case 39:return 75;case 40:return 77;case 42:return t.yytext=t.yytext.replace(/\\([\\\]])/g,"$1"),72;case 43:return"INVALID";case 44:return 5}},rules:[/^(?:[^\x00]*?(?=(\{\{)))/,/^(?:[^\x00]+)/,/^(?:[^\x00]{2,}?(?=(\{\{|\\\{\{|\\\\\{\{|$)))/,/^(?:\{\{\{\{(?=[^\/]))/,/^(?:\{\{\{\{\/[^\s!"#%-,\.\/;->@\[-\^`\{-~]+(?=[=}\s\/.])\}\}\}\})/,/^(?:[^\x00]+?(?=(\{\{\{\{)))/,/^(?:[\s\S]*?--(~)?\}\})/,/^(?:\()/,/^(?:\))/,/^(?:\{\{\{\{)/,/^(?:\}\}\}\})/,/^(?:\{\{(~)?>)/,/^(?:\{\{(~)?#>)/,/^(?:\{\{(~)?#\*?)/,/^(?:\{\{(~)?\/)/,/^(?:\{\{(~)?\^\s*(~)?\}\})/,/^(?:\{\{(~)?\s*else\s*(~)?\}\})/,/^(?:\{\{(~)?\^)/,/^(?:\{\{(~)?\s*else\b)/,/^(?:\{\{(~)?\{)/,/^(?:\{\{(~)?&)/,/^(?:\{\{(~)?!--)/,/^(?:\{\{(~)?![\s\S]*?\}\})/,/^(?:\{\{(~)?\*?)/,/^(?:=)/,/^(?:\.\.)/,/^(?:\.(?=([=~}\s\/.)|])))/,/^(?:[\/.])/,/^(?:\s+)/,/^(?:\}(~)?\}\})/,/^(?:(~)?\}\})/,/^(?:"(\\["]|[^"])*")/,/^(?:'(\\[']|[^'])*')/,/^(?:@)/,/^(?:true(?=([~}\s)])))/,/^(?:false(?=([~}\s)])))/,/^(?:undefined(?=([~}\s)])))/,/^(?:null(?=([~}\s)])))/,/^(?:-?[0-9]+(?:\.[0-9]+)?(?=([~}\s)])))/,/^(?:as\s+\|)/,/^(?:\|)/,/^(?:([^\s!"#%-,\.\/;->@\[-\^`\{-~]+(?=([=~}\s\/.)|]))))/,/^(?:\[(\\\]|[^\]])*\])/,/^(?:.)/,/^(?:$)/],conditions:{mu:{rules:[7,8,9,10,11,12,13,14,15,16,17,18,19,20,21,22,23,24,25,26,27,28,29,30,31,32,33,34,35,36,37,38,39,40,41,42,43,44],inclusive:!1},emu:{rules:[2],inclusive:!1},com:{rules:[6],inclusive:!1},raw:{rules:[3,4,5],inclusive:!1},INITIAL:{rules:[0,1,44],inclusive:!0}}};function n(){this.yy={}}return e.lexer=t,n.prototype=e,e.Parser=n,new n}();t.default=n,e.exports=t.default}(No,No.exports)),No.exports),n=e(t),r=(jo||(jo=1,function(e,t){t.__esModule=!0;var n,r=(n=Zo())&&n.__esModule?n:{default:n};function o(){var e=arguments.length<=0||void 0===arguments[0]?{}:arguments[0];this.options=e}function i(e,t,n){void 0===t&&(t=e.length);var r=e[t-1],o=e[t-2];return r?"ContentStatement"===r.type?(o||!n?/\r?\n\s*?$/:/(^|\r?\n)\s*?$/).test(r.original):void 0:n}function s(e,t,n){void 0===t&&(t=-1);var r=e[t+1],o=e[t+2];return r?"ContentStatement"===r.type?(o||!n?/^\s*?\r?\n/:/^\s*?(\r?\n|$)/).test(r.original):void 0:n}function a(e,t,n){var r=e[null==t?0:t+1];if(r&&"ContentStatement"===r.type&&(n||!r.rightStripped)){var o=r.value;r.value=r.value.replace(n?/^\s+/:/^[ \t]*\r?\n?/,""),r.rightStripped=r.value!==o}}function u(e,t,n){var r=e[null==t?e.length-1:t-1];if(r&&"ContentStatement"===r.type&&(n||!r.leftStripped)){var o=r.value;return r.value=r.value.replace(n?/\s+$/:/[ \t]+$/,""),r.leftStripped=r.value!==o,r.leftStripped}}o.prototype=new r.default,o.prototype.Program=function(e){var t=!this.options.ignoreStandalone,n=!this.isRootSeen;this.isRootSeen=!0;for(var r=e.body,o=0,c=r.length;o<c;o++){var l=r[o],p=this.accept(l);if(p){var h=i(r,o,n),d=s(r,o,n),f=p.openStandalone&&h,m=p.closeStandalone&&d,g=p.inlineStandalone&&h&&d;p.close&&a(r,o,!0),p.open&&u(r,o,!0),t&&g&&(a(r,o),u(r,o)&&"PartialStatement"===l.type&&(l.indent=/([ \t]+$)/.exec(r[o-1].original)[1])),t&&f&&(a((l.program||l.inverse).body),u(r,o)),t&&m&&(a(r,o),u((l.inverse||l.program).body))}}return e},o.prototype.BlockStatement=o.prototype.DecoratorBlock=o.prototype.PartialBlockStatement=function(e){this.accept(e.program),this.accept(e.inverse);var t=e.program||e.inverse,n=e.program&&e.inverse,r=n,o=n;if(n&&n.chained)for(r=n.body[0].program;o.chained;)o=o.body[o.body.length-1].program;var c={open:e.openStrip.open,close:e.closeStrip.close,openStandalone:s(t.body),closeStandalone:i((r||t).body)};if(e.openStrip.close&&a(t.body,null,!0),n){var l=e.inverseStrip;l.open&&u(t.body,null,!0),l.close&&a(r.body,null,!0),e.closeStrip.open&&u(o.body,null,!0),!this.options.ignoreStandalone&&i(t.body)&&s(r.body)&&(u(t.body),a(r.body))}else e.closeStrip.open&&u(t.body,null,!0);return c},o.prototype.Decorator=o.prototype.MustacheStatement=function(e){return e.strip},o.prototype.PartialStatement=o.prototype.CommentStatement=function(e){var t=e.strip||{};return{inlineStandalone:!0,open:t.open,close:t.close}},t.default=o,e.exports=t.default}(Do,Do.exports)),Do.exports),o=e(r),i=function(){if(Fo)return Uo;Fo=1,Uo.__esModule=!0,Uo.SourceLocation=function(e,t){this.source=e,this.start={line:t.first_line,column:t.first_column},this.end={line:t.last_line,column:t.last_column}},Uo.id=function(e){return/^\[.*\]$/.test(e)?e.substring(1,e.length-1):e},Uo.stripFlags=function(e,t){return{open:"~"===e.charAt(2),close:"~"===t.charAt(t.length-3)}},Uo.stripComment=function(e){return e.replace(/^\{\{~?!-?-?/,"").replace(/-?-?~?\}\}$/,"")},Uo.preparePath=function(e,t,r){r=this.locInfo(r);for(var o=e?"@":"",i=[],s=0,a=0,u=t.length;a<u;a++){var c=t[a].part,l=t[a].original!==c;if(o+=(t[a].separator||"")+c,l||".."!==c&&"."!==c&&"this"!==c)i.push(c);else{if(i.length>0)throw new n.default("Invalid path: "+o,{loc:r});".."===c&&s++}}return{type:"PathExpression",data:e,depth:s,parts:i,original:o,loc:r}},Uo.prepareMustache=function(e,t,n,r,o,i){var s=r.charAt(3)||r.charAt(2),a="{"!==s&&"&"!==s;return{type:/\*/.test(r)?"Decorator":"MustacheStatement",path:e,params:t,hash:n,escaped:a,strip:o,loc:this.locInfo(i)}},Uo.prepareRawBlock=function(e,t,n,o){r(e,n);var i={type:"Program",body:t,strip:{},loc:o=this.locInfo(o)};return{type:"BlockStatement",path:e.path,params:e.params,hash:e.hash,program:i,openStrip:{},inverseStrip:{},closeStrip:{},loc:o}},Uo.prepareBlock=function(e,t,o,i,s,a){i&&i.path&&r(e,i);var u=/\*/.test(e.open);t.blockParams=e.blockParams;var c=void 0,l=void 0;if(o){if(u)throw new n.default("Unexpected inverse block on decorator",o);o.chain&&(o.program.body[0].closeStrip=i.strip),l=o.strip,c=o.program}return s&&(s=c,c=t,t=s),{type:u?"DecoratorBlock":"BlockStatement",path:e.path,params:e.params,hash:e.hash,program:t,inverse:c,openStrip:e.strip,inverseStrip:l,closeStrip:i&&i.strip,loc:this.locInfo(a)}},Uo.prepareProgram=function(e,t){if(!t&&e.length){var n=e[0].loc,r=e[e.length-1].loc;n&&r&&(t={source:n.source,start:{line:n.start.line,column:n.start.column},end:{line:r.end.line,column:r.end.column}})}return{type:"Program",body:e,strip:{},loc:t}},Uo.preparePartialBlock=function(e,t,n,o){return r(e,n),{type:"PartialBlockStatement",name:e.path,params:e.params,hash:e.hash,program:t,openStrip:e.strip,closeStrip:n&&n.strip,loc:this.locInfo(o)}};var e,t=Zr(),n=(e=t)&&e.__esModule?e:{default:e};function r(e,t){if(t=t.path?t.path.original:t,e.path.original!==t){var r={loc:e.path.loc};throw new n.default(e.path.original+" doesn't match "+t,r)}}return Uo}(),s=function(e){if(e&&e.__esModule)return e;var t={};if(null!=e)for(var n in e)Object.prototype.hasOwnProperty.call(e,n)&&(t[n]=e[n]);return t.default=e,t}(i),a=e(Zr()),u=jr();To.parser=n.default;var c={};function l(e,t){return"Program"===e.type?(function(e){p(e)}(e),e):(n.default.yy=c,c.locInfo=function(e){return new c.SourceLocation(t&&t.srcName,e)},n.default.parse(e))}function p(e){if(null!=e)if(Array.isArray(e))e.forEach(p);else if("object"==typeof e){if("PathExpression"===e.type){if(!("number"==typeof(n=e.depth)&&isFinite(n)&&Math.floor(n)===n&&n>=0))throw new a.default("Invalid AST: PathExpression.depth must be an integer");if(!Array.isArray(e.parts))throw new a.default("Invalid AST: PathExpression.parts must be an array");for(var t=0;t<e.parts.length;t++)if("string"!=typeof e.parts[t])throw new a.default("Invalid AST: PathExpression.parts must only contain strings")}else if("NumberLiteral"===e.type){if("number"!=typeof e.value||!isFinite(e.value))throw new a.default("Invalid AST: NumberLiteral.value must be a number")}else if("BooleanLiteral"===e.type&&"boolean"!=typeof e.value)throw new a.default("Invalid AST: BooleanLiteral.value must be a boolean");var n;Object.keys(e).forEach(function(t){"loc"!==t&&p(e[t])})}}return u.extend(c,s),To}var Go,qo={};var Wo,Ko,Jo={exports:{}},Yo={exports:{}},Xo={},Qo={},ei={},ti={};function ni(){if(Wo)return ti;Wo=1;var e="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/".split("");return ti.encode=function(t){if(0<=t&&t<e.length)return e[t];throw new TypeError("Must be between 0 and 63: "+t)},ti.decode=function(e){return 65<=e&&e<=90?e-65:97<=e&&e<=122?e-97+26:48<=e&&e<=57?e-48+52:43==e?62:47==e?63:-1},ti}function ri(){if(Ko)return ei;Ko=1;var e=ni();return ei.encode=function(t){var n,r="",o=function(e){return e<0?1+(-e<<1):0+(e<<1)}(t);do{n=31&o,(o>>>=5)>0&&(n|=32),r+=e.encode(n)}while(o>0);return r},ei.decode=function(t,n,r){var o,i,s,a,u=t.length,c=0,l=0;do{if(n>=u)throw new Error("Expected more digits in base 64 VLQ value.");if(-1===(i=e.decode(t.charCodeAt(n++))))throw new Error("Invalid base64 digit: "+t.charAt(n-1));o=!!(32&i),c+=(i&=31)<<l,l+=5}while(o);r.value=(a=(s=c)>>1,1&~s?a:-a),r.rest=n},ei}var oi,ii={};function si(){return oi||(oi=1,function(e){e.getArg=function(e,t,n){if(t in e)return e[t];if(3===arguments.length)return n;throw new Error('"'+t+'" is a required argument.')};var t=/^(?:([\w+\-.]+):)?\/\/(?:(\w+:\w+)@)?([\w.-]*)(?::(\d+))?(.*)$/,n=/^data:.+\,.+$/;function r(e){var n=e.match(t);return n?{scheme:n[1],auth:n[2],host:n[3],port:n[4],path:n[5]}:null}function o(e){var t="";return e.scheme&&(t+=e.scheme+":"),t+="//",e.auth&&(t+=e.auth+"@"),e.host&&(t+=e.host),e.port&&(t+=":"+e.port),e.path&&(t+=e.path),t}function i(t){var n=t,i=r(t);if(i){if(!i.path)return t;n=i.path}for(var s,a=e.isAbsolute(n),u=n.split(/\/+/),c=0,l=u.length-1;l>=0;l--)"."===(s=u[l])?u.splice(l,1):".."===s?c++:c>0&&(""===s?(u.splice(l+1,c),c=0):(u.splice(l,2),c--));return""===(n=u.join("/"))&&(n=a?"/":"."),i?(i.path=n,o(i)):n}function s(e,t){""===e&&(e="."),""===t&&(t=".");var s=r(t),a=r(e);if(a&&(e=a.path||"/"),s&&!s.scheme)return a&&(s.scheme=a.scheme),o(s);if(s||t.match(n))return t;if(a&&!a.host&&!a.path)return a.host=t,o(a);var u="/"===t.charAt(0)?t:i(e.replace(/\/+$/,"")+"/"+t);return a?(a.path=u,o(a)):u}e.urlParse=r,e.urlGenerate=o,e.normalize=i,e.join=s,e.isAbsolute=function(e){return"/"===e.charAt(0)||t.test(e)},e.relative=function(e,t){""===e&&(e="."),e=e.replace(/\/$/,"");for(var n=0;0!==t.indexOf(e+"/");){var r=e.lastIndexOf("/");if(r<0)return t;if((e=e.slice(0,r)).match(/^([^\/]+:\/)?\/*$/))return t;++n}return Array(n+1).join("../")+t.substr(e.length+1)};var a=!("__proto__"in Object.create(null));function u(e){return e}function c(e){if(!e)return!1;var t=e.length;if(t<9)return!1;if(95!==e.charCodeAt(t-1)||95!==e.charCodeAt(t-2)||111!==e.charCodeAt(t-3)||116!==e.charCodeAt(t-4)||111!==e.charCodeAt(t-5)||114!==e.charCodeAt(t-6)||112!==e.charCodeAt(t-7)||95!==e.charCodeAt(t-8)||95!==e.charCodeAt(t-9))return!1;for(var n=t-10;n>=0;n--)if(36!==e.charCodeAt(n))return!1;return!0}function l(e,t){return e===t?0:null===e?1:null===t?-1:e>t?1:-1}e.toSetString=a?u:function(e){return c(e)?"$"+e:e},e.fromSetString=a?u:function(e){return c(e)?e.slice(1):e},e.compareByOriginalPositions=function(e,t,n){var r=l(e.source,t.source);return 0!==r||0!==(r=e.originalLine-t.originalLine)||0!==(r=e.originalColumn-t.originalColumn)||n||0!==(r=e.generatedColumn-t.generatedColumn)||0!==(r=e.generatedLine-t.generatedLine)?r:l(e.name,t.name)},e.compareByGeneratedPositionsDeflated=function(e,t,n){var r=e.generatedLine-t.generatedLine;return 0!==r||0!==(r=e.generatedColumn-t.generatedColumn)||n||0!==(r=l(e.source,t.source))||0!==(r=e.originalLine-t.originalLine)||0!==(r=e.originalColumn-t.originalColumn)?r:l(e.name,t.name)},e.compareByGeneratedPositionsInflated=function(e,t){var n=e.generatedLine-t.generatedLine;return 0!==n||0!==(n=e.generatedColumn-t.generatedColumn)||0!==(n=l(e.source,t.source))||0!==(n=e.originalLine-t.originalLine)||0!==(n=e.originalColumn-t.originalColumn)?n:l(e.name,t.name)},e.parseSourceMapInput=function(e){return JSON.parse(e.replace(/^\)]}'[^\n]*\n/,""))},e.computeSourceURL=function(e,t,n){if(t=t||"",e&&("/"!==e[e.length-1]&&"/"!==t[0]&&(e+="/"),t=e+t),n){var a=r(n);if(!a)throw new Error("sourceMapURL could not be parsed");if(a.path){var u=a.path.lastIndexOf("/");u>=0&&(a.path=a.path.substring(0,u+1))}t=s(o(a),t)}return i(t)}}(ii)),ii}var ai,ui={};function ci(){if(ai)return ui;ai=1;var e=si(),t=Object.prototype.hasOwnProperty,n="undefined"!=typeof Map;function r(){this._array=[],this._set=n?new Map:Object.create(null)}return r.fromArray=function(e,t){for(var n=new r,o=0,i=e.length;o<i;o++)n.add(e[o],t);return n},r.prototype.size=function(){return n?this._set.size:Object.getOwnPropertyNames(this._set).length},r.prototype.add=function(r,o){var i=n?r:e.toSetString(r),s=n?this.has(r):t.call(this._set,i),a=this._array.length;s&&!o||this._array.push(r),s||(n?this._set.set(r,a):this._set[i]=a)},r.prototype.has=function(r){if(n)return this._set.has(r);var o=e.toSetString(r);return t.call(this._set,o)},r.prototype.indexOf=function(r){if(n){var o=this._set.get(r);if(o>=0)return o}else{var i=e.toSetString(r);if(t.call(this._set,i))return this._set[i]}throw new Error('"'+r+'" is not in the set.')},r.prototype.at=function(e){if(e>=0&&e<this._array.length)return this._array[e];throw new Error("No element indexed by "+e)},r.prototype.toArray=function(){return this._array.slice()},ui.ArraySet=r,ui}var li,pi,hi={};function di(){if(li)return hi;li=1;var e=si();function t(){this._array=[],this._sorted=!0,this._last={generatedLine:-1,generatedColumn:0}}return t.prototype.unsortedForEach=function(e,t){this._array.forEach(e,t)},t.prototype.add=function(t){var n,r,o,i,s,a;n=this._last,r=t,o=n.generatedLine,i=r.generatedLine,s=n.generatedColumn,a=r.generatedColumn,i>o||i==o&&a>=s||e.compareByGeneratedPositionsInflated(n,r)<=0?(this._last=t,this._array.push(t)):(this._sorted=!1,this._array.push(t))},t.prototype.toArray=function(){return this._sorted||(this._array.sort(e.compareByGeneratedPositionsInflated),this._sorted=!0),this._array},hi.MappingList=t,hi}function fi(){if(pi)return Qo;pi=1;var e=ri(),t=si(),n=ci().ArraySet,r=di().MappingList;function o(e){e||(e={}),this._file=t.getArg(e,"file",null),this._sourceRoot=t.getArg(e,"sourceRoot",null),this._skipValidation=t.getArg(e,"skipValidation",!1),this._sources=new n,this._names=new n,this._mappings=new r,this._sourcesContents=null}return o.prototype._version=3,o.fromSourceMap=function(e){var n=e.sourceRoot,r=new o({file:e.file,sourceRoot:n});return e.eachMapping(function(e){var o={generated:{line:e.generatedLine,column:e.generatedColumn}};null!=e.source&&(o.source=e.source,null!=n&&(o.source=t.relative(n,o.source)),o.original={line:e.originalLine,column:e.originalColumn},null!=e.name&&(o.name=e.name)),r.addMapping(o)}),e.sources.forEach(function(o){var i=o;null!==n&&(i=t.relative(n,o)),r._sources.has(i)||r._sources.add(i);var s=e.sourceContentFor(o);null!=s&&r.setSourceContent(o,s)}),r},o.prototype.addMapping=function(e){var n=t.getArg(e,"generated"),r=t.getArg(e,"original",null),o=t.getArg(e,"source",null),i=t.getArg(e,"name",null);this._skipValidation||this._validateMapping(n,r,o,i),null!=o&&(o=String(o),this._sources.has(o)||this._sources.add(o)),null!=i&&(i=String(i),this._names.has(i)||this._names.add(i)),this._mappings.add({generatedLine:n.line,generatedColumn:n.column,originalLine:null!=r&&r.line,originalColumn:null!=r&&r.column,source:o,name:i})},o.prototype.setSourceContent=function(e,n){var r=e;null!=this._sourceRoot&&(r=t.relative(this._sourceRoot,r)),null!=n?(this._sourcesContents||(this._sourcesContents=Object.create(null)),this._sourcesContents[t.toSetString(r)]=n):this._sourcesContents&&(delete this._sourcesContents[t.toSetString(r)],0===Object.keys(this._sourcesContents).length&&(this._sourcesContents=null))},o.prototype.applySourceMap=function(e,r,o){var i=r;if(null==r){if(null==e.file)throw new Error('SourceMapGenerator.prototype.applySourceMap requires either an explicit source file, or the source map\'s "file" property. Both were omitted.');i=e.file}var s=this._sourceRoot;null!=s&&(i=t.relative(s,i));var a=new n,u=new n;this._mappings.unsortedForEach(function(n){if(n.source===i&&null!=n.originalLine){var r=e.originalPositionFor({line:n.originalLine,column:n.originalColumn});null!=r.source&&(n.source=r.source,null!=o&&(n.source=t.join(o,n.source)),null!=s&&(n.source=t.relative(s,n.source)),n.originalLine=r.line,n.originalColumn=r.column,null!=r.name&&(n.name=r.name))}var c=n.source;null==c||a.has(c)||a.add(c);var l=n.name;null==l||u.has(l)||u.add(l)},this),this._sources=a,this._names=u,e.sources.forEach(function(n){var r=e.sourceContentFor(n);null!=r&&(null!=o&&(n=t.join(o,n)),null!=s&&(n=t.relative(s,n)),this.setSourceContent(n,r))},this)},o.prototype._validateMapping=function(e,t,n,r){if(t&&"number"!=typeof t.line&&"number"!=typeof t.column)throw new Error("original.line and original.column are not numbers -- you probably meant to omit the original mapping entirely and only map the generated position. If so, pass null for the original mapping instead of an object with empty or null values.");if((!(e&&"line"in e&&"column"in e&&e.line>0&&e.column>=0)||t||n||r)&&!(e&&"line"in e&&"column"in e&&t&&"line"in t&&"column"in t&&e.line>0&&e.column>=0&&t.line>0&&t.column>=0&&n))throw new Error("Invalid mapping: "+JSON.stringify({generated:e,source:n,original:t,name:r}))},o.prototype._serializeMappings=function(){for(var n,r,o,i,s=0,a=1,u=0,c=0,l=0,p=0,h="",d=this._mappings.toArray(),f=0,m=d.length;f<m;f++){if(n="",(r=d[f]).generatedLine!==a)for(s=0;r.generatedLine!==a;)n+=";",a++;else if(f>0){if(!t.compareByGeneratedPositionsInflated(r,d[f-1]))continue;n+=","}n+=e.encode(r.generatedColumn-s),s=r.generatedColumn,null!=r.source&&(i=this._sources.indexOf(r.source),n+=e.encode(i-p),p=i,n+=e.encode(r.originalLine-1-c),c=r.originalLine-1,n+=e.encode(r.originalColumn-u),u=r.originalColumn,null!=r.name&&(o=this._names.indexOf(r.name),n+=e.encode(o-l),l=o)),h+=n}return h},o.prototype._generateSourcesContent=function(e,n){return e.map(function(e){if(!this._sourcesContents)return null;null!=n&&(e=t.relative(n,e));var r=t.toSetString(e);return Object.prototype.hasOwnProperty.call(this._sourcesContents,r)?this._sourcesContents[r]:null},this)},o.prototype.toJSON=function(){var e={version:this._version,sources:this._sources.toArray(),names:this._names.toArray(),mappings:this._serializeMappings()};return null!=this._file&&(e.file=this._file),null!=this._sourceRoot&&(e.sourceRoot=this._sourceRoot),this._sourcesContents&&(e.sourcesContent=this._generateSourcesContent(e.sources,e.sourceRoot)),e},o.prototype.toString=function(){return JSON.stringify(this.toJSON())},Qo.SourceMapGenerator=o,Qo}var mi,gi={},vi={};function yi(){return mi||(mi=1,function(e){function t(n,r,o,i,s,a){var u=Math.floor((r-n)/2)+n,c=s(o,i[u],!0);return 0===c?u:c>0?r-u>1?t(u,r,o,i,s,a):a==e.LEAST_UPPER_BOUND?r<i.length?r:-1:u:u-n>1?t(n,u,o,i,s,a):a==e.LEAST_UPPER_BOUND?u:n<0?-1:n}e.GREATEST_LOWER_BOUND=1,e.LEAST_UPPER_BOUND=2,e.search=function(n,r,o,i){if(0===r.length)return-1;var s=t(-1,r.length,n,r,o,i||e.GREATEST_LOWER_BOUND);if(s<0)return-1;for(;s-1>=0&&0===o(r[s],r[s-1],!0);)--s;return s}}(vi)),vi}var _i,bi,wi={};function ki(){if(_i)return wi;function e(e,t,n){var r=e[t];e[t]=e[n],e[n]=r}function t(n,r,o,i){if(o<i){var s=o-1;e(n,(l=o,p=i,Math.round(l+Math.random()*(p-l))),i);for(var a=n[i],u=o;u<i;u++)r(n[u],a)<=0&&e(n,s+=1,u);e(n,s+1,u);var c=s+1;t(n,r,o,c-1),t(n,r,c+1,i)}var l,p}return _i=1,wi.quickSort=function(e,n){t(e,n,0,e.length-1)},wi}var Si,Pi,xi,Ei,Ci,Ai={};function Oi(){return Pi||(Pi=1,Xo.SourceMapGenerator=fi().SourceMapGenerator,Xo.SourceMapConsumer=function(){if(bi)return gi;bi=1;var e=si(),t=yi(),n=ci().ArraySet,r=ri(),o=ki().quickSort;function i(t,n){var r=t;return"string"==typeof t&&(r=e.parseSourceMapInput(t)),null!=r.sections?new u(r,n):new s(r,n)}function s(t,r){var o=t;"string"==typeof t&&(o=e.parseSourceMapInput(t));var i=e.getArg(o,"version"),s=e.getArg(o,"sources"),a=e.getArg(o,"names",[]),u=e.getArg(o,"sourceRoot",null),c=e.getArg(o,"sourcesContent",null),l=e.getArg(o,"mappings"),p=e.getArg(o,"file",null);if(i!=this._version)throw new Error("Unsupported version: "+i);u&&(u=e.normalize(u)),s=s.map(String).map(e.normalize).map(function(t){return u&&e.isAbsolute(u)&&e.isAbsolute(t)?e.relative(u,t):t}),this._names=n.fromArray(a.map(String),!0),this._sources=n.fromArray(s,!0),this._absoluteSources=this._sources.toArray().map(function(t){return e.computeSourceURL(u,t,r)}),this.sourceRoot=u,this.sourcesContent=c,this._mappings=l,this._sourceMapURL=r,this.file=p}function a(){this.generatedLine=0,this.generatedColumn=0,this.source=null,this.originalLine=null,this.originalColumn=null,this.name=null}function u(t,r){var o=t;"string"==typeof t&&(o=e.parseSourceMapInput(t));var s=e.getArg(o,"version"),a=e.getArg(o,"sections");if(s!=this._version)throw new Error("Unsupported version: "+s);this._sources=new n,this._names=new n;var u={line:-1,column:0};this._sections=a.map(function(t){if(t.url)throw new Error("Support for url field in sections not implemented.");var n=e.getArg(t,"offset"),o=e.getArg(n,"line"),s=e.getArg(n,"column");if(o<u.line||o===u.line&&s<u.column)throw new Error("Section offsets must be ordered and non-overlapping.");return u=n,{generatedOffset:{generatedLine:o+1,generatedColumn:s+1},consumer:new i(e.getArg(t,"map"),r)}})}return i.fromSourceMap=function(e,t){return s.fromSourceMap(e,t)},i.prototype._version=3,i.prototype.__generatedMappings=null,Object.defineProperty(i.prototype,"_generatedMappings",{configurable:!0,enumerable:!0,get:function(){return this.__generatedMappings||this._parseMappings(this._mappings,this.sourceRoot),this.__generatedMappings}}),i.prototype.__originalMappings=null,Object.defineProperty(i.prototype,"_originalMappings",{configurable:!0,enumerable:!0,get:function(){return this.__originalMappings||this._parseMappings(this._mappings,this.sourceRoot),this.__originalMappings}}),i.prototype._charIsMappingSeparator=function(e,t){var n=e.charAt(t);return";"===n||","===n},i.prototype._parseMappings=function(e,t){throw new Error("Subclasses must implement _parseMappings")},i.GENERATED_ORDER=1,i.ORIGINAL_ORDER=2,i.GREATEST_LOWER_BOUND=1,i.LEAST_UPPER_BOUND=2,i.prototype.eachMapping=function(t,n,r){var o,s=n||null;switch(r||i.GENERATED_ORDER){case i.GENERATED_ORDER:o=this._generatedMappings;break;case i.ORIGINAL_ORDER:o=this._originalMappings;break;default:throw new Error("Unknown order of iteration.")}var a=this.sourceRoot;o.map(function(t){var n=null===t.source?null:this._sources.at(t.source);return{source:n=e.computeSourceURL(a,n,this._sourceMapURL),generatedLine:t.generatedLine,generatedColumn:t.generatedColumn,originalLine:t.originalLine,originalColumn:t.originalColumn,name:null===t.name?null:this._names.at(t.name)}},this).forEach(t,s)},i.prototype.allGeneratedPositionsFor=function(n){var r=e.getArg(n,"line"),o={source:e.getArg(n,"source"),originalLine:r,originalColumn:e.getArg(n,"column",0)};if(o.source=this._findSourceIndex(o.source),o.source<0)return[];var i=[],s=this._findMapping(o,this._originalMappings,"originalLine","originalColumn",e.compareByOriginalPositions,t.LEAST_UPPER_BOUND);if(s>=0){var a=this._originalMappings[s];if(void 0===n.column)for(var u=a.originalLine;a&&a.originalLine===u;)i.push({line:e.getArg(a,"generatedLine",null),column:e.getArg(a,"generatedColumn",null),lastColumn:e.getArg(a,"lastGeneratedColumn",null)}),a=this._originalMappings[++s];else for(var c=a.originalColumn;a&&a.originalLine===r&&a.originalColumn==c;)i.push({line:e.getArg(a,"generatedLine",null),column:e.getArg(a,"generatedColumn",null),lastColumn:e.getArg(a,"lastGeneratedColumn",null)}),a=this._originalMappings[++s]}return i},gi.SourceMapConsumer=i,s.prototype=Object.create(i.prototype),s.prototype.consumer=i,s.prototype._findSourceIndex=function(t){var n,r=t;if(null!=this.sourceRoot&&(r=e.relative(this.sourceRoot,r)),this._sources.has(r))return this._sources.indexOf(r);for(n=0;n<this._absoluteSources.length;++n)if(this._absoluteSources[n]==t)return n;return-1},s.fromSourceMap=function(t,r){var i=Object.create(s.prototype),u=i._names=n.fromArray(t._names.toArray(),!0),c=i._sources=n.fromArray(t._sources.toArray(),!0);i.sourceRoot=t._sourceRoot,i.sourcesContent=t._generateSourcesContent(i._sources.toArray(),i.sourceRoot),i.file=t._file,i._sourceMapURL=r,i._absoluteSources=i._sources.toArray().map(function(t){return e.computeSourceURL(i.sourceRoot,t,r)});for(var l=t._mappings.toArray().slice(),p=i.__generatedMappings=[],h=i.__originalMappings=[],d=0,f=l.length;d<f;d++){var m=l[d],g=new a;g.generatedLine=m.generatedLine,g.generatedColumn=m.generatedColumn,m.source&&(g.source=c.indexOf(m.source),g.originalLine=m.originalLine,g.originalColumn=m.originalColumn,m.name&&(g.name=u.indexOf(m.name)),h.push(g)),p.push(g)}return o(i.__originalMappings,e.compareByOriginalPositions),i},s.prototype._version=3,Object.defineProperty(s.prototype,"sources",{get:function(){return this._absoluteSources.slice()}}),s.prototype._parseMappings=function(t,n){for(var i,s,u,c,l,p=1,h=0,d=0,f=0,m=0,g=0,v=t.length,y=0,_={},b={},w=[],k=[];y<v;)if(";"===t.charAt(y))p++,y++,h=0;else if(","===t.charAt(y))y++;else{for((i=new a).generatedLine=p,c=y;c<v&&!this._charIsMappingSeparator(t,c);c++);if(u=_[s=t.slice(y,c)])y+=s.length;else{for(u=[];y<c;)r.decode(t,y,b),l=b.value,y=b.rest,u.push(l);if(2===u.length)throw new Error("Found a source, but no line and column");if(3===u.length)throw new Error("Found a source and line, but no column");_[s]=u}i.generatedColumn=h+u[0],h=i.generatedColumn,u.length>1&&(i.source=m+u[1],m+=u[1],i.originalLine=d+u[2],d=i.originalLine,i.originalLine+=1,i.originalColumn=f+u[3],f=i.originalColumn,u.length>4&&(i.name=g+u[4],g+=u[4])),k.push(i),"number"==typeof i.originalLine&&w.push(i)}o(k,e.compareByGeneratedPositionsDeflated),this.__generatedMappings=k,o(w,e.compareByOriginalPositions),this.__originalMappings=w},s.prototype._findMapping=function(e,n,r,o,i,s){if(e[r]<=0)throw new TypeError("Line must be greater than or equal to 1, got "+e[r]);if(e[o]<0)throw new TypeError("Column must be greater than or equal to 0, got "+e[o]);return t.search(e,n,i,s)},s.prototype.computeColumnSpans=function(){for(var e=0;e<this._generatedMappings.length;++e){var t=this._generatedMappings[e];if(e+1<this._generatedMappings.length){var n=this._generatedMappings[e+1];if(t.generatedLine===n.generatedLine){t.lastGeneratedColumn=n.generatedColumn-1;continue}}t.lastGeneratedColumn=1/0}},s.prototype.originalPositionFor=function(t){var n={generatedLine:e.getArg(t,"line"),generatedColumn:e.getArg(t,"column")},r=this._findMapping(n,this._generatedMappings,"generatedLine","generatedColumn",e.compareByGeneratedPositionsDeflated,e.getArg(t,"bias",i.GREATEST_LOWER_BOUND));if(r>=0){var o=this._generatedMappings[r];if(o.generatedLine===n.generatedLine){var s=e.getArg(o,"source",null);null!==s&&(s=this._sources.at(s),s=e.computeSourceURL(this.sourceRoot,s,this._sourceMapURL));var a=e.getArg(o,"name",null);return null!==a&&(a=this._names.at(a)),{source:s,line:e.getArg(o,"originalLine",null),column:e.getArg(o,"originalColumn",null),name:a}}}return{source:null,line:null,column:null,name:null}},s.prototype.hasContentsOfAllSources=function(){return!!this.sourcesContent&&this.sourcesContent.length>=this._sources.size()&&!this.sourcesContent.some(function(e){return null==e})},s.prototype.sourceContentFor=function(t,n){if(!this.sourcesContent)return null;var r=this._findSourceIndex(t);if(r>=0)return this.sourcesContent[r];var o,i=t;if(null!=this.sourceRoot&&(i=e.relative(this.sourceRoot,i)),null!=this.sourceRoot&&(o=e.urlParse(this.sourceRoot))){var s=i.replace(/^file:\/\//,"");if("file"==o.scheme&&this._sources.has(s))return this.sourcesContent[this._sources.indexOf(s)];if((!o.path||"/"==o.path)&&this._sources.has("/"+i))return this.sourcesContent[this._sources.indexOf("/"+i)]}if(n)return null;throw new Error('"'+i+'" is not in the SourceMap.')},s.prototype.generatedPositionFor=function(t){var n=e.getArg(t,"source");if((n=this._findSourceIndex(n))<0)return{line:null,column:null,lastColumn:null};var r={source:n,originalLine:e.getArg(t,"line"),originalColumn:e.getArg(t,"column")},o=this._findMapping(r,this._originalMappings,"originalLine","originalColumn",e.compareByOriginalPositions,e.getArg(t,"bias",i.GREATEST_LOWER_BOUND));if(o>=0){var s=this._originalMappings[o];if(s.source===r.source)return{line:e.getArg(s,"generatedLine",null),column:e.getArg(s,"generatedColumn",null),lastColumn:e.getArg(s,"lastGeneratedColumn",null)}}return{line:null,column:null,lastColumn:null}},gi.BasicSourceMapConsumer=s,u.prototype=Object.create(i.prototype),u.prototype.constructor=i,u.prototype._version=3,Object.defineProperty(u.prototype,"sources",{get:function(){for(var e=[],t=0;t<this._sections.length;t++)for(var n=0;n<this._sections[t].consumer.sources.length;n++)e.push(this._sections[t].consumer.sources[n]);return e}}),u.prototype.originalPositionFor=function(n){var r={generatedLine:e.getArg(n,"line"),generatedColumn:e.getArg(n,"column")},o=t.search(r,this._sections,function(e,t){return e.generatedLine-t.generatedOffset.generatedLine||e.generatedColumn-t.generatedOffset.generatedColumn}),i=this._sections[o];return i?i.consumer.originalPositionFor({line:r.generatedLine-(i.generatedOffset.generatedLine-1),column:r.generatedColumn-(i.generatedOffset.generatedLine===r.generatedLine?i.generatedOffset.generatedColumn-1:0),bias:n.bias}):{source:null,line:null,column:null,name:null}},u.prototype.hasContentsOfAllSources=function(){return this._sections.every(function(e){return e.consumer.hasContentsOfAllSources()})},u.prototype.sourceContentFor=function(e,t){for(var n=0;n<this._sections.length;n++){var r=this._sections[n].consumer.sourceContentFor(e,!0);if(r)return r}if(t)return null;throw new Error('"'+e+'" is not in the SourceMap.')},u.prototype.generatedPositionFor=function(t){for(var n=0;n<this._sections.length;n++){var r=this._sections[n];if(-1!==r.consumer._findSourceIndex(e.getArg(t,"source"))){var o=r.consumer.generatedPositionFor(t);if(o)return{line:o.line+(r.generatedOffset.generatedLine-1),column:o.column+(r.generatedOffset.generatedLine===o.line?r.generatedOffset.generatedColumn-1:0)}}}return{line:null,column:null}},u.prototype._parseMappings=function(t,n){this.__generatedMappings=[],this.__originalMappings=[];for(var r=0;r<this._sections.length;r++)for(var i=this._sections[r],s=i.consumer._generatedMappings,a=0;a<s.length;a++){var u=s[a],c=i.consumer._sources.at(u.source);c=e.computeSourceURL(i.consumer.sourceRoot,c,this._sourceMapURL),this._sources.add(c),c=this._sources.indexOf(c);var l=null;u.name&&(l=i.consumer._names.at(u.name),this._names.add(l),l=this._names.indexOf(l));var p={source:c,generatedLine:u.generatedLine+(i.generatedOffset.generatedLine-1),generatedColumn:u.generatedColumn+(i.generatedOffset.generatedLine===u.generatedLine?i.generatedOffset.generatedColumn-1:0),originalLine:u.originalLine,originalColumn:u.originalColumn,name:l};this.__generatedMappings.push(p),"number"==typeof p.originalLine&&this.__originalMappings.push(p)}o(this.__generatedMappings,e.compareByGeneratedPositionsDeflated),o(this.__originalMappings,e.compareByOriginalPositions)},gi.IndexedSourceMapConsumer=u,gi}().SourceMapConsumer,Xo.SourceNode=function(){if(Si)return Ai;Si=1;var e=fi().SourceMapGenerator,t=si(),n=/(\r?\n)/,r="$$$isSourceNode$$$";function o(e,t,n,o,i){this.children=[],this.sourceContents={},this.line=null==e?null:e,this.column=null==t?null:t,this.source=null==n?null:n,this.name=null==i?null:i,this[r]=!0,null!=o&&this.add(o)}return o.fromStringWithSourceMap=function(e,r,i){var s=new o,a=e.split(n),u=0,c=function(){return e()+(e()||"");function e(){return u<a.length?a[u++]:void 0}},l=1,p=0,h=null;return r.eachMapping(function(e){if(null!==h){if(!(l<e.generatedLine)){var t=(n=a[u]||"").substr(0,e.generatedColumn-p);return a[u]=n.substr(e.generatedColumn-p),p=e.generatedColumn,d(h,t),void(h=e)}d(h,c()),l++,p=0}for(;l<e.generatedLine;)s.add(c()),l++;if(p<e.generatedColumn){var n=a[u]||"";s.add(n.substr(0,e.generatedColumn)),a[u]=n.substr(e.generatedColumn),p=e.generatedColumn}h=e},this),u<a.length&&(h&&d(h,c()),s.add(a.splice(u).join(""))),r.sources.forEach(function(e){var n=r.sourceContentFor(e);null!=n&&(null!=i&&(e=t.join(i,e)),s.setSourceContent(e,n))}),s;function d(e,n){if(null===e||void 0===e.source)s.add(n);else{var r=i?t.join(i,e.source):e.source;s.add(new o(e.originalLine,e.originalColumn,r,n,e.name))}}},o.prototype.add=function(e){if(Array.isArray(e))e.forEach(function(e){this.add(e)},this);else{if(!e[r]&&"string"!=typeof e)throw new TypeError("Expected a SourceNode, string, or an array of SourceNodes and strings. Got "+e);e&&this.children.push(e)}return this},o.prototype.prepend=function(e){if(Array.isArray(e))for(var t=e.length-1;t>=0;t--)this.prepend(e[t]);else{if(!e[r]&&"string"!=typeof e)throw new TypeError("Expected a SourceNode, string, or an array of SourceNodes and strings. Got "+e);this.children.unshift(e)}return this},o.prototype.walk=function(e){for(var t,n=0,o=this.children.length;n<o;n++)(t=this.children[n])[r]?t.walk(e):""!==t&&e(t,{source:this.source,line:this.line,column:this.column,name:this.name})},o.prototype.join=function(e){var t,n,r=this.children.length;if(r>0){for(t=[],n=0;n<r-1;n++)t.push(this.children[n]),t.push(e);t.push(this.children[n]),this.children=t}return this},o.prototype.replaceRight=function(e,t){var n=this.children[this.children.length-1];return n[r]?n.replaceRight(e,t):"string"==typeof n?this.children[this.children.length-1]=n.replace(e,t):this.children.push("".replace(e,t)),this},o.prototype.setSourceContent=function(e,n){this.sourceContents[t.toSetString(e)]=n},o.prototype.walkSourceContents=function(e){for(var n=0,o=this.children.length;n<o;n++)this.children[n][r]&&this.children[n].walkSourceContents(e);var i=Object.keys(this.sourceContents);for(n=0,o=i.length;n<o;n++)e(t.fromSetString(i[n]),this.sourceContents[i[n]])},o.prototype.toString=function(){var e="";return this.walk(function(t){e+=t}),e},o.prototype.toStringWithSourceMap=function(t){var n={code:"",line:1,column:0},r=new e(t),o=!1,i=null,s=null,a=null,u=null;return this.walk(function(e,t){n.code+=e,null!==t.source&&null!==t.line&&null!==t.column?(i===t.source&&s===t.line&&a===t.column&&u===t.name||r.addMapping({source:t.source,original:{line:t.line,column:t.column},generated:{line:n.line,column:n.column},name:t.name}),i=t.source,s=t.line,a=t.column,u=t.name,o=!0):o&&(r.addMapping({generated:{line:n.line,column:n.column}}),i=null,o=!1);for(var c=0,l=e.length;c<l;c++)10===e.charCodeAt(c)?(n.line++,n.column=0,c+1===l?(i=null,o=!1):o&&r.addMapping({source:t.source,original:{line:t.line,column:t.column},generated:{line:n.line,column:n.column},name:t.name})):n.column++}),this.walkSourceContents(function(e,t){r.setSourceContent(e,t)}),{code:n.code,map:r}},Ai.SourceNode=o,Ai}().SourceNode),Xo}function zi(){return Ei||(Ei=1,function(e,t){function n(e){return e&&e.__esModule?e:{default:e}}t.__esModule=!0;var r=yo(),o=n(Zr()),i=jr(),s=(xi||(xi=1,function(e,t){t.__esModule=!0;var n=jr(),r=void 0;try{var o=Oi();r=o.SourceNode}catch(e){}function i(e,t,r){if(n.isArray(e)){for(var o=[],i=0,s=e.length;i<s;i++)o.push(t.wrap(e[i],r));return o}return"boolean"==typeof e||"number"==typeof e?e+"":e}function s(e){this.srcFile=e,this.source=[]}r||((r=function(e,t,n,r){this.src="",r&&this.add(r)}).prototype={add:function(e){n.isArray(e)&&(e=e.join("")),this.src+=e},prepend:function(e){n.isArray(e)&&(e=e.join("")),this.src=e+this.src},toStringWithSourceMap:function(){return{code:this.toString()}},toString:function(){return this.src}}),s.prototype={isEmpty:function(){return!this.source.length},prepend:function(e,t){this.source.unshift(this.wrap(e,t))},push:function(e,t){this.source.push(this.wrap(e,t))},merge:function(){var e=this.empty();return this.each(function(t){e.add([" ",t,"\n"])}),e},each:function(e){for(var t=0,n=this.source.length;t<n;t++)e(this.source[t])},empty:function(){var e=this.currentLocation||{start:{}};return new r(e.start.line,e.start.column,this.srcFile)},wrap:function(e){var t=arguments.length<=1||void 0===arguments[1]?this.currentLocation||{start:{}}:arguments[1];return e instanceof r?e:(e=i(e,this,t),new r(t.start.line,t.start.column,this.srcFile,e))},functionCall:function(e,t,n){return n=this.generateList(n),this.wrap([e,t?"."+t+"(":"(",n,")"])},quotedString:function(e){return'"'+(e+"").replace(/\\/g,"\\\\").replace(/"/g,'\\"').replace(/\n/g,"\\n").replace(/\r/g,"\\r").replace(/\u2028/g,"\\u2028").replace(/\u2029/g,"\\u2029")+'"'},objectLiteral:function(e){var t=this,n=[];Object.keys(e).forEach(function(r){var o=i(e[r],t);"undefined"!==o&&n.push([t.quotedString(r),":",o])});var r=this.generateList(n);return r.prepend("{"),r.add("}"),r},generateList:function(e){for(var t=this.empty(),n=0,r=e.length;n<r;n++)n&&t.add(","),t.add(i(e[n],this));return t},generateArray:function(e){var t=this.generateList(e);return t.prepend("["),t.add("]"),t}},t.default=s,e.exports=t.default}(Yo,Yo.exports)),Yo.exports),a=n(s);function u(e){this.value=e}function c(){}c.prototype={nameLookup:function(e,t){return this.internalNameLookup(e,t)},depthedLookup:function(e){return[this.aliasable("container.lookup"),"(depths, ",JSON.stringify(e),")"]},compilerInfo:function(){var e=r.COMPILER_REVISION;return[e,r.REVISION_CHANGES[e]]},appendToBuffer:function(e,t,n){return i.isArray(e)||(e=[e]),e=this.source.wrap(e,t),this.environment.isSimple?["return ",e,";"]:n?["buffer += ",e,";"]:(e.appendToBuffer=!0,e)},initializeBuffer:function(){return this.quotedString("")},internalNameLookup:function(e,t){return this.lookupPropertyFunctionIsUsed=!0,["lookupProperty(",e,",",JSON.stringify(t),")"]},lookupPropertyFunctionIsUsed:!1,compile:function(e,t,n,r){this.environment=e,this.options=t,this.stringParams=this.options.stringParams,this.trackIds=this.options.trackIds,this.precompile=!r,this.name=this.environment.name,this.isChild=!!n,this.context=n||{decorators:[],programs:[],environments:[]},this.preamble(),this.stackSlot=0,this.stackVars=[],this.aliases={},this.registers={list:[]},this.hashes=[],this.compileStack=[],this.inlineStack=[],this.blockParams=[],this.compileChildren(e,t),this.useDepths=this.useDepths||e.useDepths||e.useDecorators||this.options.compat,this.useBlockParams=this.useBlockParams||e.useBlockParams;var i=e.opcodes,s=void 0,a=void 0,u=void 0,c=void 0;for(u=0,c=i.length;u<c;u++)s=i[u],this.source.currentLocation=s.loc,a=a||s.loc,this[s.opcode].apply(this,s.args);if(this.source.currentLocation=a,this.pushSource(""),this.stackSlot||this.inlineStack.length||this.compileStack.length)throw new o.default("Compile completed with content left on stack");this.decorators.isEmpty()?this.decorators=void 0:(this.useDecorators=!0,this.decorators.prepend(["var decorators = container.decorators, ",this.lookupPropertyFunctionVarDeclaration(),";\n"]),this.decorators.push("return fn;"),r?this.decorators=Function.apply(this,["fn","props","container","depth0","data","blockParams","depths",this.decorators.merge()]):(this.decorators.prepend("function(fn, props, container, depth0, data, blockParams, depths) {\n"),this.decorators.push("}\n"),this.decorators=this.decorators.merge()));var l=this.createFunctionContext(r);if(this.isChild)return l;var p={compiler:this.compilerInfo(),main:l};this.decorators&&(p.main_d=this.decorators,p.useDecorators=!0);var h=this.context,d=h.programs,f=h.decorators;for(u=0,c=d.length;u<c;u++)p[u]=d[u],f[u]&&(p[u+"_d"]=f[u],p.useDecorators=!0);return this.environment.usePartial&&(p.usePartial=!0),this.options.data&&(p.useData=!0),this.useDepths&&(p.useDepths=!0),this.useBlockParams&&(p.useBlockParams=!0),this.options.compat&&(p.compat=!0),r?p.compilerOptions=this.options:(p.compiler=JSON.stringify(p.compiler),this.source.currentLocation={start:{line:1,column:0}},p=this.objectLiteral(p),t.srcName?(p=p.toStringWithSourceMap({file:t.destName})).map=p.map&&p.map.toString():p=p.toString()),p},preamble:function(){this.lastContext=0,this.source=new a.default(this.options.srcName),this.decorators=new a.default(this.options.srcName)},createFunctionContext:function(e){var t=this,n="",r=this.stackVars.concat(this.registers.list);r.length>0&&(n+=", "+r.join(", "));var o=0;Object.keys(this.aliases).forEach(function(e){var r=t.aliases[e];r.children&&r.referenceCount>1&&(n+=", alias"+ ++o+"="+e,r.children[0]="alias"+o)}),this.lookupPropertyFunctionIsUsed&&(n+=", "+this.lookupPropertyFunctionVarDeclaration());var i=["container","depth0","helpers","partials","data"];(this.useBlockParams||this.useDepths)&&i.push("blockParams"),this.useDepths&&i.push("depths");var s=this.mergeSource(n);return e?(i.push(s),Function.apply(this,i)):this.source.wrap(["function(",i.join(","),") {\n ",s,"}"])},mergeSource:function(e){var t=this.environment.isSimple,n=!this.forceBuffer,r=void 0,o=void 0,i=void 0,s=void 0;return this.source.each(function(e){e.appendToBuffer?(i?e.prepend(" + "):i=e,s=e):(i&&(o?i.prepend("buffer += "):r=!0,s.add(";"),i=s=void 0),o=!0,t||(n=!1))}),n?i?(i.prepend("return "),s.add(";")):o||this.source.push('return "";'):(e+=", buffer = "+(r?"":this.initializeBuffer()),i?(i.prepend("return buffer + "),s.add(";")):this.source.push("return buffer;")),e&&this.source.prepend("var "+e.substring(2)+(r?"":";\n")),this.source.merge()},lookupPropertyFunctionVarDeclaration:function(){return"\n lookupProperty = container.lookupProperty || function(parent, propertyName) {\n if (Object.prototype.hasOwnProperty.call(parent, propertyName)) {\n return parent[propertyName];\n }\n return undefined\n }\n ".trim()},blockValue:function(e){var t=this.aliasable("container.hooks.blockHelperMissing"),n=[this.contextName(0)];this.setupHelperArgs(e,0,n);var r=this.popStack();n.splice(1,0,r),this.push(this.source.functionCall(t,"call",n))},ambiguousBlockValue:function(){var e=this.aliasable("container.hooks.blockHelperMissing"),t=[this.contextName(0)];this.setupHelperArgs("",0,t,!0),this.flushInline();var n=this.topStack();t.splice(1,0,n),this.pushSource(["if (!",this.lastHelper,") { ",n," = ",this.source.functionCall(e,"call",t),"}"])},appendContent:function(e){this.pendingContent?e=this.pendingContent+e:this.pendingLocation=this.source.currentLocation,this.pendingContent=e},append:function(){if(this.isInline())this.replaceStack(function(e){return[" != null ? ",e,' : ""']}),this.pushSource(this.appendToBuffer(this.popStack()));else{var e=this.popStack();this.pushSource(["if (",e," != null) { ",this.appendToBuffer(e,void 0,!0)," }"]),this.environment.isSimple&&this.pushSource(["else { ",this.appendToBuffer("''",void 0,!0)," }"])}},appendEscaped:function(){this.pushSource(this.appendToBuffer([this.aliasable("container.escapeExpression"),"(",this.popStack(),")"]))},getContext:function(e){this.lastContext=e},pushContext:function(){this.pushStackLiteral(this.contextName(this.lastContext))},lookupOnContext:function(e,t,n,r){var o=0;r||!this.options.compat||this.lastContext?this.pushContext():this.push(this.depthedLookup(e[o++])),this.resolvePath("context",e,o,t,n)},lookupBlockParam:function(e,t){this.useBlockParams=!0,this.push(["blockParams[",e[0],"][",e[1],"]"]),this.resolvePath("context",t,1)},lookupData:function(e,t,n){e?this.pushStackLiteral("container.data(data, "+e+")"):this.pushStackLiteral("data"),this.resolvePath("data",t,0,!0,n)},resolvePath:function(e,t,n,r,o){var i=this;if(this.options.strict||this.options.assumeObjects)this.push(function(e,t,n,r,o){var i=t.popStack(),s=n.length;e&&s--;for(var a=r;a<s;a++)i=t.nameLookup(i,n[a],o);return e?[t.aliasable("container.strict"),"(",i,", ",t.quotedString(n[s]),", ",JSON.stringify(t.source.currentLocation)," )"]:i}(this.options.strict&&o,this,t,n,e));else for(var s=t.length,a=function(n){i.replaceStack(function(o){var s=i.nameLookup(o,t[n],e);return r?[" && ",s]:[" != null ? ",s," : ",o]})},u=n;u<s;u++)a(u)},resolvePossibleLambda:function(){this.push([this.aliasable("container.lambda"),"(",this.popStack(),", ",this.contextName(0),")"])},pushStringParam:function(e,t){this.pushContext(),this.pushString(t),"SubExpression"!==t&&("string"==typeof e?this.pushString(e):this.pushStackLiteral(e))},emptyHash:function(e){this.trackIds&&this.push("{}"),this.stringParams&&(this.push("{}"),this.push("{}")),this.pushStackLiteral(e?"undefined":"{}")},pushHash:function(){this.hash&&this.hashes.push(this.hash),this.hash={values:{},types:[],contexts:[],ids:[]}},popHash:function(){var e=this.hash;this.hash=this.hashes.pop(),this.trackIds&&this.push(this.objectLiteral(e.ids)),this.stringParams&&(this.push(this.objectLiteral(e.contexts)),this.push(this.objectLiteral(e.types))),this.push(this.objectLiteral(e.values))},pushString:function(e){this.pushStackLiteral(this.quotedString(e))},pushLiteral:function(e){this.pushStackLiteral(e)},pushProgram:function(e){null!=e?this.pushStackLiteral(this.programExpression(e)):this.pushStackLiteral(null)},registerDecorator:function(e,t){var n=this.nameLookup("decorators",t,"decorator"),r=this.setupHelperArgs(t,e);this.decorators.push(["var decorator = ",n,";"]),this.decorators.push(['if (typeof decorator !== "function") { throw new Error(',this.quotedString('Missing decorator: "'+t+'"'),"); }"]),this.decorators.push(["fn = ",this.decorators.functionCall("decorator","",["fn","props","container",r])," || fn;"])},invokeHelper:function(e,t,n){var r=this.popStack(),o=this.setupHelper(e,t),i=[];n&&i.push(o.name),i.push(r),this.options.strict||i.push(this.aliasable("container.hooks.helperMissing"));var s=["(",this.itemsSeparatedBy(i,"||"),")"],a=this.source.functionCall(s,"call",o.callParams);this.push(a)},itemsSeparatedBy:function(e,t){var n=[];n.push(e[0]);for(var r=1;r<e.length;r++)n.push(t,e[r]);return n},invokeKnownHelper:function(e,t){var n=this.setupHelper(e,t);this.push(this.source.functionCall(n.name,"call",n.callParams))},invokeAmbiguous:function(e,t){this.useRegister("helper");var n=this.popStack();this.emptyHash();var r=this.setupHelper(0,e,t),o=["(","(helper = ",this.lastHelper=this.nameLookup("helpers",e,"helper")," || ",n,")"];this.options.strict||(o[0]="(helper = ",o.push(" != null ? helper : ",this.aliasable("container.hooks.helperMissing"))),this.push(["(",o,r.paramsInit?["),(",r.paramsInit]:[],"),","(typeof helper === ",this.aliasable('"function"')," ? ",this.source.functionCall("helper","call",r.callParams)," : helper))"])},invokePartial:function(e,t,n){var r=[],o=this.setupParams(t,1,r);e&&(t=this.popStack(),delete o.name),n&&(o.indent=JSON.stringify(n)),o.helpers="helpers",o.partials="partials",o.decorators="container.decorators",e?r.unshift(t):r.unshift(this.nameLookup("partials",t,"partial")),this.options.compat&&(o.depths="depths"),o=this.objectLiteral(o),r.push(o),this.push(this.source.functionCall("container.invokePartial","",r))},assignToHash:function(e){var t=this.popStack(),n=void 0,r=void 0,o=void 0;this.trackIds&&(o=this.popStack()),this.stringParams&&(r=this.popStack(),n=this.popStack());var i=this.hash;n&&(i.contexts[e]=n),r&&(i.types[e]=r),o&&(i.ids[e]=o),i.values[e]=t},pushId:function(e,t,n){"BlockParam"===e?this.pushStackLiteral("blockParams["+t[0]+"].path["+t[1]+"]"+(n?" + "+JSON.stringify("."+n):"")):"PathExpression"===e?this.pushString(t):"SubExpression"===e?this.pushStackLiteral("true"):this.pushStackLiteral("null")},compiler:c,compileChildren:function(e,t){for(var n=e.children,r=void 0,o=void 0,i=0,s=n.length;i<s;i++){r=n[i],o=new this.compiler;var a=this.matchExistingProgram(r);if(null==a){var u=this.context.programs.push("")-1;r.index=u,r.name="program"+u,this.context.programs[u]=o.compile(r,t,this.context,!this.precompile),this.context.decorators[u]=o.decorators,this.context.environments[u]=r,this.useDepths=this.useDepths||o.useDepths,this.useBlockParams=this.useBlockParams||o.useBlockParams,r.useDepths=this.useDepths,r.useBlockParams=this.useBlockParams}else r.index=a.index,r.name="program"+a.index,this.useDepths=this.useDepths||a.useDepths,this.useBlockParams=this.useBlockParams||a.useBlockParams}},matchExistingProgram:function(e){for(var t=0,n=this.context.environments.length;t<n;t++){var r=this.context.environments[t];if(r&&r.equals(e))return r}},programExpression:function(e){var t=this.environment.children[e],n=[t.index,"data",t.blockParams];return(this.useBlockParams||this.useDepths)&&n.push("blockParams"),this.useDepths&&n.push("depths"),"container.program("+n.join(", ")+")"},useRegister:function(e){this.registers[e]||(this.registers[e]=!0,this.registers.list.push(e))},push:function(e){return e instanceof u||(e=this.source.wrap(e)),this.inlineStack.push(e),e},pushStackLiteral:function(e){this.push(new u(e))},pushSource:function(e){this.pendingContent&&(this.source.push(this.appendToBuffer(this.source.quotedString(this.pendingContent),this.pendingLocation)),this.pendingContent=void 0),e&&this.source.push(e)},replaceStack:function(e){var t=["("],n=void 0,r=void 0,i=void 0;if(!this.isInline())throw new o.default("replaceStack on non-inline");var s=this.popStack(!0);if(s instanceof u)t=["(",n=[s.value]],i=!0;else{r=!0;var a=this.incrStack();t=["((",this.push(a)," = ",s,")"],n=this.topStack()}var c=e.call(this,n);i||this.popStack(),r&&this.stackSlot--,this.push(t.concat(c,")"))},incrStack:function(){return this.stackSlot++,this.stackSlot>this.stackVars.length&&this.stackVars.push("stack"+this.stackSlot),this.topStackName()},topStackName:function(){return"stack"+this.stackSlot},flushInline:function(){var e=this.inlineStack;this.inlineStack=[];for(var t=0,n=e.length;t<n;t++){var r=e[t];if(r instanceof u)this.compileStack.push(r);else{var o=this.incrStack();this.pushSource([o," = ",r,";"]),this.compileStack.push(o)}}},isInline:function(){return this.inlineStack.length},popStack:function(e){var t=this.isInline(),n=(t?this.inlineStack:this.compileStack).pop();if(!e&&n instanceof u)return n.value;if(!t){if(!this.stackSlot)throw new o.default("Invalid stack pop");this.stackSlot--}return n},topStack:function(){var e=this.isInline()?this.inlineStack:this.compileStack,t=e[e.length-1];return t instanceof u?t.value:t},contextName:function(e){return this.useDepths&&e?"depths["+e+"]":"depth"+e},quotedString:function(e){return this.source.quotedString(e)},objectLiteral:function(e){return this.source.objectLiteral(e)},aliasable:function(e){var t=this.aliases[e];return t?(t.referenceCount++,t):((t=this.aliases[e]=this.source.wrap(e)).aliasable=!0,t.referenceCount=1,t)},setupHelper:function(e,t,n){var r=[];return{params:r,paramsInit:this.setupHelperArgs(t,e,r,n),name:this.nameLookup("helpers",t,"helper"),callParams:[this.aliasable(this.contextName(0)+" != null ? "+this.contextName(0)+" : (container.nullContext || {})")].concat(r)}},setupParams:function(e,t,n){var r={},o=[],i=[],s=[],a=!n,u=void 0;a&&(n=[]),r.name=this.quotedString(e),r.hash=this.popStack(),this.trackIds&&(r.hashIds=this.popStack()),this.stringParams&&(r.hashTypes=this.popStack(),r.hashContexts=this.popStack());var c=this.popStack(),l=this.popStack();(l||c)&&(r.fn=l||"container.noop",r.inverse=c||"container.noop");for(var p=t;p--;)u=this.popStack(),n[p]=u,this.trackIds&&(s[p]=this.popStack()),this.stringParams&&(i[p]=this.popStack(),o[p]=this.popStack());return a&&(r.args=this.source.generateArray(n)),this.trackIds&&(r.ids=this.source.generateArray(s)),this.stringParams&&(r.types=this.source.generateArray(i),r.contexts=this.source.generateArray(o)),this.options.data&&(r.data="data"),this.useBlockParams&&(r.blockParams="blockParams"),r},setupHelperArgs:function(e,t,n,r){var o=this.setupParams(e,t,n);return o.loc=JSON.stringify(this.source.currentLocation),o=this.objectLiteral(o),r?(this.useRegister("options"),n.push("options"),["options=",o]):n?(n.push(o),""):o}},function(){for(var e="break else new var case finally return void catch for switch while continue function this with default if throw delete in try do instanceof typeof abstract enum int short boolean export interface static byte extends long super char final native synchronized class float package throws const goto private transient debugger implements protected volatile double import public let yield await null true false".split(" "),t=c.RESERVED_WORDS={},n=0,r=e.length;n<r;n++)t[e[n]]=!0}(),c.isValidJavaScriptVariableName=function(e){return!c.RESERVED_WORDS[e]&&/^[a-zA-Z_$][0-9a-zA-Z_$]*$/.test(e)},t.default=c,e.exports=t.default}(Jo,Jo.exports)),Jo.exports}function Li(){return Ci||(Ci=1,function(e,t){function n(e){return e&&e.__esModule?e:{default:e}}t.__esModule=!0;var r=n(zo()),o=n(Io()),i=Vo(),s=function(){if(Go)return qo;function e(e){return e&&e.__esModule?e:{default:e}}Go=1,qo.__esModule=!0,qo.Compiler=i,qo.precompile=function(e,n,r){if(null==e||"string"!=typeof e&&"Program"!==e.type)throw new t.default("You must pass a string or Handlebars AST to Handlebars.precompile. You passed "+e);"data"in(n=n||{})||(n.data=!0),n.compat&&(n.useDepths=!0);var o=r.parse(e,n),i=(new r.Compiler).compile(o,n);return(new r.JavaScriptCompiler).compile(i,n)},qo.compile=function(e,r,o){if(void 0===r&&(r={}),null==e||"string"!=typeof e&&"Program"!==e.type)throw new t.default("You must pass a string or Handlebars AST to Handlebars.compile. You passed "+e);"data"in(r=n.extend({},r))||(r.data=!0),r.compat&&(r.useDepths=!0);var i=void 0;function s(){var t=o.parse(e,r),n=(new o.Compiler).compile(t,r),i=(new o.JavaScriptCompiler).compile(n,r,void 0,!0);return o.template(i)}function a(e,t){return i||(i=s()),i.call(this,e,t)}return a._setup=function(e){return i||(i=s()),i._setup(e)},a._child=function(e,t,n,r){return i||(i=s()),i._child(e,t,n,r)},a};var t=e(Zr()),n=jr(),r=e(Io()),o=[].slice;function i(){}function s(e,t){if(e===t)return!0;if(n.isArray(e)&&n.isArray(t)&&e.length===t.length){for(var r=0;r<e.length;r++)if(!s(e[r],t[r]))return!1;return!0}}function a(e){if(!e.path.parts){var t=e.path;e.path={type:"PathExpression",data:!1,depth:0,parts:[t.original+""],original:t.original+"",loc:t.loc}}}return i.prototype={compiler:i,equals:function(e){var t=this.opcodes.length;if(e.opcodes.length!==t)return!1;for(var n=0;n<t;n++){var r=this.opcodes[n],o=e.opcodes[n];if(r.opcode!==o.opcode||!s(r.args,o.args))return!1}for(t=this.children.length,n=0;n<t;n++)if(!this.children[n].equals(e.children[n]))return!1;return!0},guid:0,compile:function(e,t){return this.sourceNode=[],this.opcodes=[],this.children=[],this.options=t,this.stringParams=t.stringParams,this.trackIds=t.trackIds,t.blockParams=t.blockParams||[],t.knownHelpers=n.extend(Object.create(null),{helperMissing:!0,blockHelperMissing:!0,each:!0,if:!0,unless:!0,with:!0,log:!0,lookup:!0},t.knownHelpers),this.accept(e)},compileProgram:function(e){var t=(new this.compiler).compile(e,this.options),n=this.guid++;return this.usePartial=this.usePartial||t.usePartial,this.children[n]=t,this.useDepths=this.useDepths||t.useDepths,n},accept:function(e){if(!this[e.type])throw new t.default("Unknown type: "+e.type,e);this.sourceNode.unshift(e);var n=this[e.type](e);return this.sourceNode.shift(),n},Program:function(e){this.options.blockParams.unshift(e.blockParams);for(var t=e.body,n=t.length,r=0;r<n;r++)this.accept(t[r]);return this.options.blockParams.shift(),this.isSimple=1===n,this.blockParams=e.blockParams?e.blockParams.length:0,this},BlockStatement:function(e){a(e);var t=e.program,n=e.inverse;t=t&&this.compileProgram(t),n=n&&this.compileProgram(n);var r=this.classifySexpr(e);"helper"===r?this.helperSexpr(e,t,n):"simple"===r?(this.simpleSexpr(e),this.opcode("pushProgram",t),this.opcode("pushProgram",n),this.opcode("emptyHash"),this.opcode("blockValue",e.path.original)):(this.ambiguousSexpr(e,t,n),this.opcode("pushProgram",t),this.opcode("pushProgram",n),this.opcode("emptyHash"),this.opcode("ambiguousBlockValue")),this.opcode("append")},DecoratorBlock:function(e){var t=e.program&&this.compileProgram(e.program),n=this.setupFullMustacheParams(e,t,void 0),r=e.path;this.useDecorators=!0,this.opcode("registerDecorator",n.length,r.original)},PartialStatement:function(e){this.usePartial=!0;var n=e.program;n&&(n=this.compileProgram(e.program));var r=e.params;if(r.length>1)throw new t.default("Unsupported number of partial arguments: "+r.length,e);r.length||(this.options.explicitPartialContext?this.opcode("pushLiteral","undefined"):r.push({type:"PathExpression",parts:[],depth:0}));var o=e.name.original,i="SubExpression"===e.name.type;i&&this.accept(e.name),this.setupFullMustacheParams(e,n,void 0,!0);var s=e.indent||"";this.options.preventIndent&&s&&(this.opcode("appendContent",s),s=""),this.opcode("invokePartial",i,o,s),this.opcode("append")},PartialBlockStatement:function(e){this.PartialStatement(e)},MustacheStatement:function(e){this.SubExpression(e),e.escaped&&!this.options.noEscape?this.opcode("appendEscaped"):this.opcode("append")},Decorator:function(e){this.DecoratorBlock(e)},ContentStatement:function(e){e.value&&this.opcode("appendContent",e.value)},CommentStatement:function(){},SubExpression:function(e){a(e);var t=this.classifySexpr(e);"simple"===t?this.simpleSexpr(e):"helper"===t?this.helperSexpr(e):this.ambiguousSexpr(e)},ambiguousSexpr:function(e,t,n){var r=e.path,o=r.parts[0],i=null!=t||null!=n;this.opcode("getContext",r.depth),this.opcode("pushProgram",t),this.opcode("pushProgram",n),r.strict=!0,this.accept(r),this.opcode("invokeAmbiguous",o,i)},simpleSexpr:function(e){var t=e.path;t.strict=!0,this.accept(t),this.opcode("resolvePossibleLambda")},helperSexpr:function(e,n,o){var i=this.setupFullMustacheParams(e,n,o),s=e.path,a=s.parts[0];if(this.options.knownHelpers[a])this.opcode("invokeKnownHelper",i.length,a);else{if(this.options.knownHelpersOnly)throw new t.default("You specified knownHelpersOnly, but used the unknown helper "+a,e);s.strict=!0,s.falsy=!0,this.accept(s),this.opcode("invokeHelper",i.length,s.original,r.default.helpers.simpleId(s))}},PathExpression:function(e){this.addDepth(e.depth),this.opcode("getContext",e.depth);var t=e.parts[0],n=r.default.helpers.scopedId(e),o=!e.depth&&!n&&this.blockParamIndex(t);o?this.opcode("lookupBlockParam",o,e.parts):t?e.data?(this.options.data=!0,this.opcode("lookupData",e.depth,e.parts,e.strict)):this.opcode("lookupOnContext",e.parts,e.falsy,e.strict,n):this.opcode("pushContext")},StringLiteral:function(e){this.opcode("pushString",e.value)},NumberLiteral:function(e){this.opcode("pushLiteral",e.value)},BooleanLiteral:function(e){this.opcode("pushLiteral",e.value)},UndefinedLiteral:function(){this.opcode("pushLiteral","undefined")},NullLiteral:function(){this.opcode("pushLiteral","null")},Hash:function(e){var t=e.pairs,n=0,r=t.length;for(this.opcode("pushHash");n<r;n++)this.pushParam(t[n].value);for(;n--;)this.opcode("assignToHash",t[n].key);this.opcode("popHash")},opcode:function(e){this.opcodes.push({opcode:e,args:o.call(arguments,1),loc:this.sourceNode[0].loc})},addDepth:function(e){e&&(this.useDepths=!0)},classifySexpr:function(e){var t=r.default.helpers.simpleId(e.path),n=t&&!!this.blockParamIndex(e.path.parts[0]),o=!n&&r.default.helpers.helperExpression(e),i=!n&&(o||t);if(i&&!o){var s=e.path.parts[0],a=this.options;a.knownHelpers[s]?o=!0:a.knownHelpersOnly&&(i=!1)}return o?"helper":i?"ambiguous":"simple"},pushParams:function(e){for(var t=0,n=e.length;t<n;t++)this.pushParam(e[t])},pushParam:function(e){var t=null!=e.value?e.value:e.original||"";if(this.stringParams)t.replace&&(t=t.replace(/^(\.?\.\/)*/g,"").replace(/\//g,".")),e.depth&&this.addDepth(e.depth),this.opcode("getContext",e.depth||0),this.opcode("pushStringParam",t,e.type),"SubExpression"===e.type&&this.accept(e);else{if(this.trackIds){var n=void 0;if(!e.parts||r.default.helpers.scopedId(e)||e.depth||(n=this.blockParamIndex(e.parts[0])),n){var o=e.parts.slice(1).join(".");this.opcode("pushId","BlockParam",n,o)}else(t=e.original||t).replace&&(t=t.replace(/^this(?:\.|$)/,"").replace(/^\.\//,"").replace(/^\.$/,"")),this.opcode("pushId",e.type,t)}this.accept(e)}},setupFullMustacheParams:function(e,t,n,r){var o=e.params;return this.pushParams(o),this.opcode("pushProgram",t),this.opcode("pushProgram",n),e.hash?this.accept(e.hash):this.opcode("emptyHash",r),o},blockParamIndex:function(e){for(var t=0,r=this.options.blockParams.length;t<r;t++){var o=this.options.blockParams[t],i=o&&n.indexOf(o,e);if(o&&i>=0)return[t,i]}}},qo}(),a=n(zi()),u=n(Zo()),c=n(Oo()),l=r.default.create;function p(){var e=l();return e.compile=function(t,n){return s.compile(t,n,e)},e.precompile=function(t,n){return s.precompile(t,n,e)},e.AST=o.default,e.Compiler=s.Compiler,e.JavaScriptCompiler=a.default,e.Parser=i.parser,e.parse=i.parse,e.parseWithoutProcessing=i.parseWithoutProcessing,e}var h=p();h.create=p,c.default(h),h.Visitor=u.default,h.default=h,t.default=h,e.exports=t.default}(Mr,Mr.exports)),Mr.exports}var $i,Ii,Mi,Ti={};function Ni(){if($i)return Ti;$i=1,Ti.__esModule=!0,Ti.print=function(e){return(new r).accept(e)},Ti.PrintVisitor=r;var e,t=Zo(),n=(e=t)&&e.__esModule?e:{default:e};function r(){this.padding=0}return r.prototype=new n.default,r.prototype.pad=function(e){for(var t="",n=0,r=this.padding;n<r;n++)t+=" ";return t+=e+"\n"},r.prototype.Program=function(e){var t="",n=e.body,r=void 0,o=void 0;if(e.blockParams){var i="BLOCK PARAMS: [";for(r=0,o=e.blockParams.length;r<o;r++)i+=" "+e.blockParams[r];i+=" ]",t+=this.pad(i)}for(r=0,o=n.length;r<o;r++)t+=this.accept(n[r]);return this.padding--,t},r.prototype.MustacheStatement=function(e){return this.pad("{{ "+this.SubExpression(e)+" }}")},r.prototype.Decorator=function(e){return this.pad("{{ DIRECTIVE "+this.SubExpression(e)+" }}")},r.prototype.BlockStatement=r.prototype.DecoratorBlock=function(e){var t="";return t+=this.pad(("DecoratorBlock"===e.type?"DIRECTIVE ":"")+"BLOCK:"),this.padding++,t+=this.pad(this.SubExpression(e)),e.program&&(t+=this.pad("PROGRAM:"),this.padding++,t+=this.accept(e.program),this.padding--),e.inverse&&(e.program&&this.padding++,t+=this.pad("{{^}}"),this.padding++,t+=this.accept(e.inverse),this.padding--,e.program&&this.padding--),this.padding--,t},r.prototype.PartialStatement=function(e){var t="PARTIAL:"+e.name.original;return e.params[0]&&(t+=" "+this.accept(e.params[0])),e.hash&&(t+=" "+this.accept(e.hash)),this.pad("{{> "+t+" }}")},r.prototype.PartialBlockStatement=function(e){var t="PARTIAL BLOCK:"+e.name.original;return e.params[0]&&(t+=" "+this.accept(e.params[0])),e.hash&&(t+=" "+this.accept(e.hash)),t+=" "+this.pad("PROGRAM:"),this.padding++,t+=this.accept(e.program),this.padding--,this.pad("{{> "+t+" }}")},r.prototype.ContentStatement=function(e){return this.pad("CONTENT[ '"+e.value+"' ]")},r.prototype.CommentStatement=function(e){return this.pad("{{! '"+e.value+"' }}")},r.prototype.SubExpression=function(e){for(var t,n=e.params,r=[],o=0,i=n.length;o<i;o++)r.push(this.accept(n[o]));return n="["+r.join(", ")+"]",t=e.hash?" "+this.accept(e.hash):"",this.accept(e.path)+" "+n+t},r.prototype.PathExpression=function(e){var t=e.parts.join("/");return(e.data?"@":"")+"PATH:"+t},r.prototype.StringLiteral=function(e){return'"'+e.value+'"'},r.prototype.NumberLiteral=function(e){return"NUMBER{"+e.value+"}"},r.prototype.BooleanLiteral=function(e){return"BOOLEAN{"+e.value+"}"},r.prototype.UndefinedLiteral=function(){return"UNDEFINED"},r.prototype.NullLiteral=function(){return"NULL"},r.prototype.Hash=function(e){for(var t=e.pairs,n=[],r=0,o=t.length;r<o;r++)n.push(this.accept(t[r]));return"HASH{"+n.join(", ")+"}"},r.prototype.HashPair=function(e){return e.key+"="+this.accept(e.value)},Ti}var Ri=function(){if(Mi)return Ii;Mi=1;var t=Li().default,n=Ni();function r(n,r){var o=e.readFileSync(r,"utf8");n.exports=t.compile(o)}return t.PrintVisitor=n.PrintVisitor,t.print=n.print,Ii=t,void 0!==$r&&$r.extensions&&($r.extensions[".handlebars"]=r,$r.extensions[".hbs"]=r),Ii}(),ji=t(Ri);const Di={dv:{heading:"https://gute.itsymn.me/MVAWaheed-Bold.ttf",body:"https://gute.itsymn.me/MVFaseyha.ttf"},en:{heading:"https://gute.itsymn.me/inter.ttf",body:"https://gute.itsymn.me/inter.ttf"}},Bi={dv:{heading:'"MV A Waheed", "Inter", sans-serif',body:'"MV Faseyha", "Dhivehi", sans-serif'},en:{heading:'"Inter", sans-serif',body:'"Inter", sans-serif'}};function Zi(e){switch((e?.split(".").pop()??"").toLowerCase()){case"woff2":return"font/woff2";case"woff":return"font/woff";case"ttf":return"font/ttf";case"otf":return"font/otf";default:return"application/octet-stream"}}function Fi(e){const t=(e.split(".").pop()??"").toLowerCase();return"woff2"===t?"woff2":"woff"===t?"woff":"ttf"===t?"truetype":"opentype"}function Hi(e){const t="dv"===e,n=function(e){return Bi[e]}(e),r=n.heading,o=n.body;return`\n\t\t* { box-sizing: border-box; margin: 0; padding: 0; }\n\t\thtml, body { margin: 0; padding: 0; }\n\t\tbody {\n\t\t\tfont-family: 'PdfBody', ${o};\n\t\t\tpadding: 20px;\n\t\t\tdirection: ${t?"rtl":"ltr"};\n\t\t\ttext-align: ${t?"right":"left"};\n\t\t\tfont-size: 14px;\n\t\t\tcolor: #111;\n\t\t\tline-height: 1.75;\n\t\t}\n\t\th1 {\n\t\t\tfont-family: 'PdfHeading', ${r};\n\t\t\ttext-align: center;\n\t\t\tfont-size: 18px;\n\t\t\tmargin-bottom: 4px;\n\t\t\tline-height: 1.5;\n\t\t}\n\t\th2, h3, h4, h5, h6 {\n\t\t\tfont-family: 'PdfHeading', ${r};\n\t\t}\n\t\ttable {\n\t\t\twidth: 100%;\n\t\t\tborder-collapse: collapse;\n\t\t\tmargin-top: 16px;\n\t\t\tfont-family: 'PdfBody', ${o};\n\t\t\tfont-size: 14px;\n\t\t}\n\t\tth, td {\n\t\t\tborder: 1px solid #000;\n\t\t\tpadding: 6px 8px;\n\t\t\ttext-align: ${t?"right":"left"};\n\t\t\tvertical-align: top;\n\t\t}\n\t\tthead th {\n\t\t\tfont-family: 'PdfHeading', ${r};\n\t\t\tbackground-color: #f0f0f0;\n\t\t\tfont-weight: 600;\n\t\t}\n\t\timg {\n\t\t\tmax-width: 100%;\n\t\t\theight: auto;\n\t\t}\n\t\t.pdf-body {\n\t\t\tfont-family: 'PdfBody', ${o};\n\t\t}\n\t`}const Ui=/\{\{\{?\s*(?![#/!>])([^}]+?)\s*\}?\}\}/g,Vi=/\{\{\s*#(if|unless|with|each)\s+([^}]+)\}\}/g,Gi=/\{\{\s*else\s+if\s+([^}]+)\}\}/g,qi=/\b([a-zA-Z_][\w]*(?:\.[a-zA-Z_][\w]*){0,2})\b/g,Wi=new Set(["true","false","null","undefined","this","else","if","unless","with","each","lookup"]);function Ki(e){const t=new Set,n=e.replace(/['"`][^'"`]*['"`]/g," ");let r;for(qi.lastIndex=0;null!==(r=qi.exec(n));){const e=r[1].trim();if(!e||Wi.has(e))continue;if(!/^[a-zA-Z_][\w.]*$/.test(e))continue;const n=e.split(".");n.length>=3?t.add(`${n[0]}.${n[1]}.${n[2]}`):t.add(e)}return[...t]}const Ji=new Set(["host","connection","content-length","content-type","keep-alive","transfer-encoding","upgrade","te","trailer"].map(e=>e.toLowerCase()));function Yi(e){try{return function(e){const t=String(e??"").trim().replace(/\/+$/,"");if(!t)return"";let n;try{n=new URL(t)}catch{throw new Error(`Invalid Gotenberg base URL: ${e}`)}if("http:"!==n.protocol&&"https:"!==n.protocol)throw new Error("Gotenberg URL must use http or https.");return t}(e??"")}catch{return""}}const Xi=new Set(["paperWidth","paperHeight","marginTop","marginBottom","marginLeft","marginRight","landscape","scale","printBackground","waitDelay","emulatedMediaType","generateDocumentOutline"]),Qi=new Map;var es={id:"generate-pdf",handler:async({template_id:e},{services:t,database:n,getSchema:r,accountability:o,data:i,env:s,logger:a})=>{if(!o?.user)throw new Error("Unauthorized: PDF generation requires an authenticated user.");if(!e)throw new Error("Operation is missing template_id (configure the PDF template on the Flow operation).");const u=await r(),c={knex:n,schema:u,accountability:o},{ItemsService:l}=t;let p=null;if(u.collections.pdf_extension_settings){const e=new l("pdf_extension_settings",{knex:n,schema:u,accountability:null});try{p=await e.readSingleton({fields:["*"]})}catch{p=null}}const h=function(e,t){const n=Yi(e?.gotenberg_url??""),r=String(t??"").trim().replace(/\/+$/,""),o=n||r;if(!o)throw new Error("Gotenberg URL is not configured. Set it under PDF Templates → Extension setup, or set GOTENBERG_URL on the server.");return o}(p,s.GOTENBERG_URL),d=function(e){if(!e||"object"!=typeof e||Array.isArray(e))return{};const t={};for(const[n,r]of Object.entries(e)){const e=String(n).trim();e&&!Ji.has(e.toLowerCase())&&("string"!=typeof r&&"number"!=typeof r&&"boolean"!=typeof r||(t[e]=String(r)))}return t}(p?.gotenberg_headers),f=new l("pdf_templates",c),m=await f.readOne(e,{fields:["*","font_en_heading.id","font_en_heading.filename_download","font_en_body.id","font_en_body.filename_download","font_dv_heading.id","font_dv_heading.filename_download","font_dv_body.id","font_dv_body.filename_download"]}),{collection:g,keys:v}=function(e){const t=e.$trigger,n=t?.body??t,r=n?.collection||"",o=n?.keys;return{collection:r,keys:Array.isArray(o)?o:null!=o?[o]:[]}}(i),y="string"==typeof(_=m.target_collection)?_:_&&"object"==typeof _&&"collection"in _?String(_.collection??""):"";var _;if(!y)throw new Error("Template is missing target_collection.");if(g&&g!==y)throw new Error(`This template applies to "${y}" but the flow was run from "${g}".`);const b=v[0];if(null==b)throw new Error("No item key in flow trigger (open an item and run the flow from the item page).");const w=String(m.content??""),k=String(m.header_html??""),S=String(m.footer_html??""),P=function(e){const t=new Set(["*"]);for(const n of e){t.add(n);const e=n.split(".");for(let n=1;n<e.length;n++)t.add(e.slice(0,n).join("."))}return[...t]}(function(...e){const t=e.filter(Boolean).join("\n"),n=new Set;let r;for(Ui.lastIndex=0;null!==(r=Ui.exec(t));)for(const e of Ki(r[1]))n.add(e);for(Vi.lastIndex=0;null!==(r=Vi.exec(t));)for(const e of Ki(r[2]))n.add(e);for(Gi.lastIndex=0;null!==(r=Gi.exec(t));)for(const e of Ki(r[1]))n.add(e);return[...n]}(w,k,S)),x=new l(y,c),E=await x.readOne(b,{fields:P}),C=ji.create();let A,O,z;C.registerHelper("default",(e,t)=>null==e||""===e?t:e),C.registerHelper("eq",(e,t)=>e===t),C.registerHelper("ne",(e,t)=>e!==t),C.registerHelper("formatDate",(e,t,n)=>{if(null==e||""===e)return"";const r=e instanceof Date?e:new Date(String(e));if(Number.isNaN(r.getTime()))return"";const o="string"==typeof t&&t.trim()?t:"en-US",i=n&&"object"==typeof n&&"hash"in n?n.hash??{}:{};return new Intl.DateTimeFormat(o,i).format(r)});try{A=C.compile(w,{noEscape:!0})(E),O=k?C.compile(k,{noEscape:!0})(E):"",z=S?C.compile(S,{noEscape:!0})(E):""}catch(e){const t=e&&"object"==typeof e&&"lineNumber"in e?` (line ${String(e.lineNumber)})`:"",n=e&&"object"==typeof e&&"column"in e?`, column ${String(e.column)}`:"",r=e instanceof Error?e.message:String(e);throw new Error(`Handlebars template error${t}${n}: ${r}`)}const L="dv"===m.language?"dv":"en",$=Di[L];async function I(e){const t=Qi.get(e);if(t){const n=e.split("/").pop()||"font.ttf";return{buffer:t,filename:n,mime:Zi(n)}}const n=await fetch(e);if(!n.ok)throw new Error(`Could not load font from ${e} (${n.status}).`);const r=await n.arrayBuffer(),o=Buffer.from(r);Qi.set(e,o);const i=e.split("/").pop()||"font.ttf";return{buffer:o,filename:i,mime:Zi(i)}}const[M,T]=await Promise.all([I($.heading),I($.body)]);let N=M.buffer,R=T.buffer;!N?.length&&R?.length&&(N=R),!R?.length&&N?.length&&(R=N);const j=function(e){const t=[];if(e.headingBuffer?.length){const n=e.headingBuffer.toString("base64");t.push(`@font-face{font-family:'PdfHeading';src:url(data:${e.headingMime};charset=utf-8;base64,${n}) format('${Fi(e.headingFilename)}');font-weight:400;font-style:normal;}`)}if(e.bodyBuffer?.length){const n=e.bodyBuffer.toString("base64");t.push(`@font-face{font-family:'PdfBody';src:url(data:${e.bodyMime};charset=utf-8;base64,${n}) format('${Fi(e.bodyFilename)}');font-weight:400;font-style:normal;}`)}return t.join("\n")}({headingBuffer:N,bodyBuffer:R,headingMime:M.mime,bodyMime:T.mime,headingFilename:M.filename||"heading.ttf",bodyFilename:T.filename||"body.ttf"}),D=Hi(L),B=`<!DOCTYPE html>\n<html lang="${L}">\n<head>\n<meta charset="utf-8"/>\n<style>${j}\n${D}</style>\n</head>\n<body>\n<div class="pdf-body">${A}</div>\n</body>\n</html>`,Z=new FormData;if(Z.append("files",new Blob([B],{type:"text/html"}),"index.html"),O.trim()){const e=`<!DOCTYPE html><html><head><meta charset="utf-8"/><style>${j}\n${D}\nhtml,body{margin:0;padding:0;font-size:10px;}body{padding:0 12px;}img{max-width:100%;height:auto;} .pageNumber,.totalPages,.date,.title{-webkit-print-color-adjust:exact;}</style></head><body>${O}</body></html>`;Z.append("files",new Blob([e],{type:"text/html"}),"header.html")}if(z.trim()){const e=`<!DOCTYPE html><html><head><meta charset="utf-8"/><style>${j}\n${D}\nhtml,body{margin:0;padding:0;font-size:10px;}body{padding:0 12px;}img{max-width:100%;height:auto;} .pageNumber,.totalPages,.date,.title{-webkit-print-color-adjust:exact;}</style></head><body>${z}</body></html>`;Z.append("files",new Blob([e],{type:"text/html"}),"footer.html")}const F=m.gotenberg_config??{};for(const[e,t]of Object.entries(F))Xi.has(e)&&null!=t&&Z.append(e,String(t));const H=new AbortController,U=setTimeout(()=>H.abort(),3e4);let V;try{V=await fetch(`${h}/forms/chromium/convert/html`,{method:"POST",headers:d,body:Z,signal:H.signal})}catch(e){throw a?.warn?.(e,"Gotenberg request failed"),new Error("PDF service unavailable (could not reach Gotenberg).")}finally{clearTimeout(U)}if(!V.ok){const e=await V.text().catch(()=>"");throw a?.warn?.({status:V.status,errText:e},"Gotenberg error response"),new Error(`PDF service error (${V.status}). ${e.slice(0,200)}`)}const G=await V.arrayBuffer();return{base64:Buffer.from(G).toString("base64"),mimeType:"application/pdf"}}};const ts=new Map;function ns(e){return String(e??"").trim().replace(/[^a-zA-Z0-9._-]+/g,"-").replace(/-+/g,"-").replace(/^-|-$/g,"")||"document"}async function rs(e,t){const n=Date.now(),r=ts.get(e)??null;if(r&&n-r.fetchedAt<6e5)return r;const o=`https://cdnjs.cloudflare.com/ajax/libs/tinymce/8.1.2/${e}`;try{const t=await fetch(o,{headers:r?.etag?{"If-None-Match":r.etag}:void 0});if(304===t.status&&r){const t={...r,fetchedAt:n};return ts.set(e,t),t}if(!t.ok)throw new Error(`TinyMCE CDN returned HTTP ${t.status} for ${e}.`);const i={body:Buffer.from(await t.arrayBuffer()),contentType:t.headers.get("content-type")||"application/octet-stream",etag:t.headers.get("etag"),fetchedAt:n};return ts.set(e,i),i}catch(o){if(t?.warn?.({error:o,assetPath:e},"TinyMCE CDN asset fetch failed"),r){const t={...r,fetchedAt:n};return ts.set(e,t),t}throw o}}const os=[],is=[{name:"pdf-render",config:{id:"pdf-render",handler:(e,t)=>{e.get("/tinymce.min.js",async(e,n,r)=>{try{const e=await rs("tinymce.min.js",t.logger);n.setHeader("Content-Type",e.contentType),n.setHeader("Cache-Control","public, max-age=3600"),n.status(200).send(e.body)}catch(e){r(e)}}),e.get("/tinymce/*",async(e,n,r)=>{try{const r=function(e){const t=e.replace(/^\/+/,"").trim();if(!t)return"tinymce.min.js";if(t.includes(".."))throw new Error("Invalid TinyMCE asset path.");if(!/^[a-zA-Z0-9_./-]+$/.test(t))throw new Error("Unsupported TinyMCE asset path.");return t}(String(e.params[0]??"")),o=await rs(r,t.logger);n.setHeader("Content-Type",o.contentType),n.setHeader("Cache-Control","public, max-age=3600"),n.status(200).send(o.body)}catch(e){r(e)}}),e.post("/render",async(e,n,r)=>{try{const r=e.accountability;if(!r?.user)return void n.status(401).json({error:"Unauthorized"});const o=e.body??{},i=String(o.template_id??o.templateId??"").trim(),s=String(o.collection??"").trim(),a=o.item??o.key??o.primaryKey??(Array.isArray(o.keys)?o.keys[0]:void 0),u=String(a??"").trim();if(!i||!s||!u)return void n.status(400).json({error:"template_id, collection, and item are required."});const c=es;if("function"!=typeof c.handler)throw new Error("generate-pdf operation handler is unavailable.");const l=await c.handler({template_id:i},{services:t.services,database:t.database,getSchema:t.getSchema,accountability:r,data:{$trigger:{body:{collection:s,keys:[u]}}},env:t.env,logger:t.logger});if(!l?.base64)return void n.status(502).json({error:"PDF generation returned no content."});const p="string"==typeof l.mimeType&&l.mimeType?l.mimeType:"application/pdf",h=Buffer.from(l.base64,"base64"),d="open"===String(o.action_mode??o.actionMode??"download").toLowerCase()?"inline":"attachment",f=`${ns(s)}-${ns(u)}.pdf`;n.setHeader("Content-Type",p),n.setHeader("Content-Length",String(h.length)),n.setHeader("Content-Disposition",`${d}; filename="${f}"`),n.status(200).send(h)}catch(e){r(e)}})}}}],ss=[{name:"generate-pdf",config:es}];export{is as endpoints,os as hooks,ss as operations};
|
package/dist/app.js
ADDED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import{useApi as e,useStores as t,defineModule as a,defineInterface as n,defineOperationApp as l}from"@directus/extensions-sdk";import{defineComponent as o,ref as i,computed as r,onMounted as d,resolveComponent as s,resolveDirective as u,openBlock as c,createBlock as f,withCtx as p,createElementVNode as v,createTextVNode as m,toDisplayString as g,createCommentVNode as y,createElementBlock as b,createVNode as h,Fragment as _,renderList as w,withDirectives as x,vModelText as k,unref as C,inject as U,shallowRef as E,watch as S,onUnmounted as $,normalizeClass as D,nextTick as P}from"vue";import{useRouter as L}from"vue-router";const T={class:"nav-actions"},O={class:"page"},V={key:1,class:"create-card"},j={class:"create-grid"},F={class:"create-actions"},I={key:3,class:"table-wrap"},R={key:0,class:"templates-table"},M={class:"actions"};var N=o({__name:"module",setup(t){const a=e(),n=L(),l=i(!0),o=i(null),k=i([]),C=i(!1),U=i(!1),E=i(null),S=i(!1),$=i([]),D=i({name:"",target_collection:"",language:"en",content:"<p>{{name}}</p>"}),P=[{text:"English",value:"en"},{text:"Dhivehi",value:"dv"}],N=r(()=>$.value),B=r(()=>Boolean(D.value.name.trim()&&D.value.target_collection));function A(e,t){const a=e?.response?.status,n=e?.response?.data?.errors?.[0]?.code,l=e?.response?.data?.errors?.[0]?.message??(e instanceof Error?e.message:"");return 404===a||"COLLECTION_NOT_FOUND"===n||l.includes(`collection "${t}"`)||l.includes(`${t}`)&&l.includes("does not exist")}async function G(){try{const e=await a.get("/collections",{params:{limit:-1,sort:"collection",filter:{meta:{hidden:{_neq:!0}}}}});$.value=(e.data?.data??[]).map(e=>String(e.collection??"")).filter(e=>Boolean(e)&&!e.startsWith("directus_")).map(e=>({text:e,value:e}))}catch{$.value=[]}}async function q(){l.value=!0,o.value=null,C.value=!1;try{if(!await async function(e){try{return await a.get(`/fields/${e}`),!0}catch(t){return!A(t,e)}}("pdf_templates"))return C.value=!0,void(k.value=[]);const e=await a.get("/items/pdf_templates",{params:{limit:-1,sort:"name"}});k.value=e.data?.data??[]}catch(e){if(A(e,"pdf_templates"))return C.value=!0,k.value=[],void(o.value=null);const t=e&&"object"==typeof e&&"response"in e?e.response?.data?.errors?.[0]?.message:null;o.value=t||(e instanceof Error?e.message:"Could not load pdf_templates.")}finally{l.value=!1}}function H(){q()}function z(e){n.push(`/content/pdf_templates/${e}`)}function J(){n.push("/content/pdf_templates")}function K(){n.push("/pdf-templates-module/setup")}function W(){S.value=!S.value}async function Y(){if(B.value){U.value=!0,o.value=null;try{const e=await a.post("/items/pdf_templates",{name:D.value.name.trim(),target_collection:D.value.target_collection,language:D.value.language,content:D.value.content,header_html:"",footer_html:""}),t=String(e.data?.data?.id??"");await q(),S.value=!1,D.value={name:"",target_collection:"",language:"en",content:"<p>{{name}}</p>"},t&&z(t)}catch(e){o.value=e?.response?.data?.errors?.[0]?.message||(e instanceof Error?e.message:"Could not create template.")}finally{U.value=!1}}}return d(async()=>{await Promise.all([G(),q()])}),(e,t)=>{const n=s("v-breadcrumb"),i=s("v-icon"),r=s("v-button"),d=s("v-info"),$=s("v-notice"),L=s("v-input"),A=s("v-select"),G=s("v-progress-circular"),Q=s("private-view"),X=u("tooltip");return c(),f(Q,{title:"PDF Templates"},{headline:p(()=>[h(n,{items:[{name:"PDF Templates"}]})]),"title-outer:prepend":p(()=>[h(r,{class:"header-icon",rounded:"",disabled:"",icon:"",secondary:""},{default:p(()=>[h(i,{name:"picture_as_pdf"})]),_:1})]),actions:p(()=>[h(r,{rounded:"",onClick:W},{default:p(()=>[h(i,{name:"add",left:""}),m(" "+g(S.value?"Close":"New Template"),1)]),_:1}),x((c(),f(r,{rounded:"",icon:"",secondary:"",onClick:K},{default:p(()=>[h(i,{name:"settings"})]),_:1})),[[X,"Extension setup (Gotenberg URL & headers)",void 0,{bottom:!0}]]),x((c(),f(r,{rounded:"",icon:"",secondary:"",onClick:J},{default:p(()=>[h(i,{name:"open_in_new"})]),_:1})),[[X,"Open collection in Content",void 0,{bottom:!0}]]),h(r,{rounded:"",icon:"",onClick:H},{default:p(()=>[h(i,{name:"refresh"})]),_:1})]),navigation:p(()=>[h(d,{icon:"info",title:"About",class:"navigation-info"},{default:p(()=>[...t[3]||(t[3]=[m(" Manage ",-1),v("code",null,"pdf_templates",-1),m(" here or in ",-1),v("strong",null,"Content",-1),m(". Configure ",-1),v("strong",null,"Gotenberg",-1),m(" under Extension setup. Assign ",-1),v("strong",null,"PDF Liquid Editor",-1),m(" to template fields. ",-1)])]),_:1}),v("div",T,[h(r,{"full-width":"",secondary:"",small:"",onClick:K},{default:p(()=>[h(i,{name:"settings",left:""}),t[4]||(t[4]=m(" Extension setup ",-1))]),_:1})])]),default:p(()=>[v("div",O,[o.value?(c(),f($,{key:0,type:"danger"},{default:p(()=>[m(g(o.value),1)]),_:1})):y("v-if",!0),S.value&&!C.value?(c(),b("div",V,[v("div",j,[h(L,{modelValue:D.value.name,"onUpdate:modelValue":t[0]||(t[0]=e=>D.value.name=e),placeholder:"Template name"},null,8,["modelValue"]),h(A,{modelValue:D.value.target_collection,"onUpdate:modelValue":t[1]||(t[1]=e=>D.value.target_collection=e),items:N.value,"item-text":"text","item-value":"value",placeholder:"Target collection"},null,8,["modelValue","items"]),h(A,{modelValue:D.value.language,"onUpdate:modelValue":t[2]||(t[2]=e=>D.value.language=e),items:P,"item-text":"text","item-value":"value",placeholder:"Language"},null,8,["modelValue"])]),v("div",F,[h(r,{disabled:U.value||!B.value,loading:U.value,onClick:Y},{default:p(()=>[...t[5]||(t[5]=[m(" Create ",-1)])]),_:1},8,["disabled","loading"])])])):l.value?(c(),f(G,{key:2,indeterminate:""})):(c(),b("div",I,[k.value.length?(c(),b("table",R,[t[8]||(t[8]=v("thead",null,[v("tr",null,[v("th",null,"Name"),v("th",null,"Collection"),v("th",null,"Language"),v("th")])],-1)),v("tbody",null,[(c(!0),b(_,null,w(k.value,e=>(c(),b("tr",{key:e.id},[v("td",null,g(e.name),1),v("td",null,[v("code",null,g(e.target_collection),1)]),v("td",null,g(e.language),1),v("td",M,[h(r,{small:"",secondary:"",onClick:t=>z(e.id)},{default:p(()=>[h(i,{name:"edit",left:"",small:""}),t[6]||(t[6]=m(" Edit ",-1))]),_:1},8,["onClick"]),h(r,{small:"",danger:"",disabled:E.value===e.id,loading:E.value===e.id,onClick:t=>async function(e){E.value=e,o.value=null;try{await a.delete(`/items/pdf_templates/${e}`),await q()}catch(e){o.value=e?.response?.data?.errors?.[0]?.message||(e instanceof Error?e.message:"Could not delete template.")}finally{E.value=null}}(String(e.id))},{default:p(()=>[h(i,{name:"delete",left:"",small:""}),t[7]||(t[7]=m(" Delete ",-1))]),_:1},8,["disabled","loading","onClick"])])]))),128))])])):(c(),f(d,{key:1,icon:"inbox",title:"No templates"},{default:p(()=>[...t[9]||(t[9]=[m(" Create the ",-1),v("code",null,"pdf_templates",-1),m(" collection (see README), then add a template or use Content. ",-1)])]),_:1}))]))])]),_:1})}}}),B=[],A=[];function G(e,t){if(e&&"undefined"!=typeof document){var a,n=!0===t.prepend?"prepend":"append",l=!0===t.singleTag,o="string"==typeof t.container?document.querySelector(t.container):document.getElementsByTagName("head")[0];if(l){var i=B.indexOf(o);-1===i&&(i=B.push(o)-1,A[i]={}),a=A[i]&&A[i][n]?A[i][n]:A[i][n]=r()}else a=r();65279===e.charCodeAt(0)&&(e=e.substring(1)),a.styleSheet?a.styleSheet.cssText+=e:a.appendChild(document.createTextNode(e))}function r(){var e=document.createElement("style");if(e.setAttribute("type","text/css"),t.attributes)for(var a=Object.keys(t.attributes),l=0;l<a.length;l++)e.setAttribute(a[l],t.attributes[a[l]]);var i="prepend"===n?"afterbegin":"beforeend";return o.insertAdjacentElement(i,e),e}}G("\n.page[data-v-d67b5bd5] {\n\tpadding: var(--content-padding);\n}\n.create-card[data-v-d67b5bd5] {\n\tmargin-bottom: 20px;\n\tpadding: 16px;\n\tborder: 1px solid var(--border-normal);\n\tborder-radius: var(--border-radius);\n\tbackground: var(--background-page);\n}\n.create-grid[data-v-d67b5bd5] {\n\tdisplay: grid;\n\tgrid-template-columns: repeat(auto-fit, minmax(180px, 1fr));\n\tgap: 12px;\n}\n.create-actions[data-v-d67b5bd5] {\n\tmargin-top: 12px;\n}\n.table-wrap[data-v-d67b5bd5] {\n\toverflow: auto;\n}\n.templates-table[data-v-d67b5bd5] {\n\twidth: 100%;\n\tborder-collapse: collapse;\n}\n.templates-table th[data-v-d67b5bd5],\n.templates-table td[data-v-d67b5bd5] {\n\ttext-align: left;\n\tpadding: 12px;\n\tborder-bottom: 1px solid var(--border-normal);\n}\n.templates-table th[data-v-d67b5bd5] {\n\tfont-weight: 600;\n\tcolor: var(--foreground-subdued);\n}\n.actions[data-v-d67b5bd5] {\n\twidth: 220px;\n\ttext-align: right;\n\tdisplay: flex;\n\tgap: 8px;\n\tjustify-content: flex-end;\n}\n.navigation-info[data-v-d67b5bd5] {\n\tmargin: 12px;\n}\n.nav-actions[data-v-d67b5bd5] {\n\tmargin: 12px;\n}\n",{});var q=(e,t)=>{const a=e.__vccOpts||e;for(const[e,n]of t)a[e]=n;return a},H=q(N,[["__scopeId","data-v-d67b5bd5"]]);new Set(["host","connection","content-length","content-type","keep-alive","transfer-encoding","upgrade","te","trailer"].map(e=>e.toLowerCase()));const z={class:"page"},J={key:3,class:"mb"},K={key:4,class:"form"},W={class:"field"},Y={class:"field"},Q=["disabled"],X={class:"field"},Z={class:"field"},ee={class:"field"},te={class:"field"};var ae=o({__name:"setup",setup(a){const n=e(),l=L(),{useUserStore:o,usePermissionsStore:u}=t(),w=o(),U=u?u():null,E=r(()=>{const e=w.currentUser;return!!e&&(!0===e.admin_access||("function"!=typeof U?.hasPermission||Boolean(U.hasPermission("read","pdf_extension_settings")&&U.hasPermission("update","pdf_extension_settings"))))}),S=r(()=>[{name:"PDF Templates",to:"/pdf-templates-module"},{name:"Extension setup"}]),$=i(""),D=i("{}"),P=i(null),T=i(""),O=i(""),V=i(""),j=i(""),F=i([{text:"None",value:""}]),I=i(!0),R=i(!1),M=i(null),N=i(null),B=i(!1);function A(e,t){const a=e?.response?.status,n=e?.response?.data?.errors?.[0]?.code,l=e?.response?.data?.errors?.[0]?.message??(e instanceof Error?e.message:"");return 404===a||"COLLECTION_NOT_FOUND"===n||l.includes(`collection "${t}"`)||l.includes(`${t}`)&&l.includes("does not exist")}async function G(){I.value=!0,M.value=null,B.value=!1;try{try{await n.get("/fields/pdf_extension_settings")}catch(e){if(A(e,"pdf_extension_settings"))return B.value=!0,$.value="",void(D.value="{}")}const e=await n.get("/items/pdf_extension_settings",{params:{limit:1,fields:["*","font_en_heading.id","font_en_heading.filename_download","font_en_body.id","font_en_body.filename_download","font_dv_heading.id","font_dv_heading.filename_download","font_dv_body.id","font_dv_body.filename_download"]}}),t=Array.isArray(e.data?.data)?e.data?.data?.[0]:e.data?.data;P.value=null!=t?.id?t.id:1,$.value=String(t?.gotenberg_url??"");const a=t?.gotenberg_headers;D.value=JSON.stringify(a&&"object"==typeof a?a:{},null,2),T.value=H(t?.font_en_heading),O.value=H(t?.font_en_body),V.value=H(t?.font_dv_heading),j.value=H(t?.font_dv_body)}catch(e){const t=e?.response?.status,a=e?.response?.data?.errors?.[0]?.code;if(404===t||"ITEM_NOT_FOUND"===a)$.value="",D.value="{}";else if(403===t||"FORBIDDEN"===a)A(e,"pdf_extension_settings")?(B.value=!0,$.value="",D.value="{}"):M.value="You do not have permission to read pdf_extension_settings.";else{const a=e?.response?.data?.errors?.[0]?.message;a?.includes("pdf_extension_settings")||400===t?B.value=!0:M.value=a||(e instanceof Error?e.message:"Failed to load settings.")}}finally{I.value=!1}}async function q(){let e;M.value=null,N.value=null;try{if(e=JSON.parse(D.value||"{}"),!e||"object"!=typeof e||Array.isArray(e))throw new Error("Headers must be a JSON object.")}catch(e){return void(M.value=e instanceof Error?e.message:"Invalid JSON for headers.")}if($.value.trim())try{!function(e){const t=String(e??"").trim().replace(/\/+$/,"");if(!t)return"";let a;try{a=new URL(t)}catch{throw new Error(`Invalid Gotenberg base URL: ${e}`)}if("http:"!==a.protocol&&"https:"!==a.protocol)throw new Error("Gotenberg URL must use http or https.")}($.value)}catch(e){return void(M.value=e instanceof Error?e.message:"Invalid Gotenberg URL.")}R.value=!0;const t={gotenberg_url:$.value.trim()||null,gotenberg_headers:e,font_en_heading:T.value||null,font_en_body:O.value||null,font_dv_heading:V.value||null,font_dv_body:j.value||null};try{try{await n.patch(`/items/pdf_extension_settings/${P.value??1}`,t)}catch(e){const a=e?.response?.status;if(404!==a)throw e;try{await n.post("/items/pdf_extension_settings",{id:P.value??1,...t})}catch(e){throw e}}N.value="Saved."}catch(e){const t=e?.response?.data?.errors?.[0]?.message;M.value=t||(e instanceof Error?e.message:"Save failed.")}finally{R.value=!1}}function H(e){return e?"string"==typeof e?e:"number"==typeof e?String(e):"object"==typeof e&&"id"in e?String(e.id??""):"":""}async function ae(){try{const e=await n.get("/files",{params:{limit:-1,sort:"filename_download",fields:["id","title","filename_download"]}}),t=e.data?.data??[];F.value=[{text:"None",value:""},...t.map(e=>({text:String(e.title||e.filename_download||e.id),value:String(e.id??"")}))]}catch{F.value=[{text:"None",value:""}]}}return d(async()=>{await Promise.all([ae(),G()])}),(e,t)=>{const a=s("v-breadcrumb"),n=s("v-icon"),o=s("v-button"),i=s("v-info"),r=s("v-progress-circular"),d=s("v-notice"),u=s("v-input"),w=s("v-select"),U=s("private-view");return c(),f(U,{title:"Extension setup"},{headline:p(()=>[h(a,{items:S.value},null,8,["items"])]),"title-outer:prepend":p(()=>[h(o,{class:"header-icon",rounded:"",icon:"",secondary:"",onClick:t[0]||(t[0]=e=>C(l).push("/pdf-templates-module"))},{default:p(()=>[h(n,{name:"arrow_back"})]),_:1})]),navigation:p(()=>[h(i,{icon:"settings",title:"Gotenberg",class:"navigation-info"},{default:p(()=>[...t[7]||(t[7]=[m(" Base URL and optional headers apply to every PDF request from the ",-1),v("strong",null,"Generate PDF",-1),m(" operation. ",-1),v("code",null,"GOTENBERG_URL",-1),m(" env is only used if the URL field here is empty. ",-1)])]),_:1})]),default:p(()=>[v("div",z,[I.value?(c(),f(r,{key:0,indeterminate:"",class:"mb"})):(c(),b(_,{key:1},[E.value?y("v-if",!0):(c(),f(d,{key:0,type:"warning",class:"mb"},{default:p(()=>[...t[8]||(t[8]=[m(" Only administrators can change these settings. Contact an admin to configure Gotenberg. ",-1)])]),_:1})),M.value?(c(),f(d,{key:1,type:"danger",class:"mb"},{default:p(()=>[m(g(M.value),1)]),_:1})):y("v-if",!0),N.value?(c(),f(d,{key:2,type:"success",class:"mb"},{default:p(()=>[m(g(N.value),1)]),_:1})):y("v-if",!0),B.value?(c(),b("div",J,[h(d,{type:"warning"},{default:p(()=>[...t[9]||(t[9]=[m(" Create the ",-1),v("code",null,"pdf_extension_settings",-1),m(" singleton collection (see ",-1),v("code",null,"schema/pdf_extension_settings.collection.yaml",-1),m(") to enable this form. ",-1)])]),_:1})])):(c(),b("div",K,[v("div",W,[t[10]||(t[10]=v("div",{class:"type-label"},"Gotenberg base URL",-1)),h(u,{modelValue:$.value,"onUpdate:modelValue":t[1]||(t[1]=e=>$.value=e),disabled:!E.value||R.value,placeholder:"https://your-gotenberg-host:3000"},null,8,["modelValue","disabled"])]),v("div",Y,[t[11]||(t[11]=v("div",{class:"type-label"},"HTTP headers (JSON object)",-1)),x(v("textarea",{"onUpdate:modelValue":t[2]||(t[2]=e=>D.value=e),class:"raw-json",disabled:!E.value||R.value,rows:"12",spellcheck:"false"},null,8,Q),[[k,D.value]])]),v("div",X,[t[12]||(t[12]=v("div",{class:"type-label"},"Default English heading font",-1)),h(w,{modelValue:T.value,"onUpdate:modelValue":t[3]||(t[3]=e=>T.value=e),items:F.value,"item-text":"text","item-value":"value"},null,8,["modelValue","items"])]),v("div",Z,[t[13]||(t[13]=v("div",{class:"type-label"},"Default English body font",-1)),h(w,{modelValue:O.value,"onUpdate:modelValue":t[4]||(t[4]=e=>O.value=e),items:F.value,"item-text":"text","item-value":"value"},null,8,["modelValue","items"])]),v("div",ee,[t[14]||(t[14]=v("div",{class:"type-label"},"Default Dhivehi heading font",-1)),h(w,{modelValue:V.value,"onUpdate:modelValue":t[5]||(t[5]=e=>V.value=e),items:F.value,"item-text":"text","item-value":"value"},null,8,["modelValue","items"])]),v("div",te,[t[15]||(t[15]=v("div",{class:"type-label"},"Default Dhivehi body font",-1)),h(w,{modelValue:j.value,"onUpdate:modelValue":t[6]||(t[6]=e=>j.value=e),items:F.value,"item-text":"text","item-value":"value"},null,8,["modelValue","items"])]),h(o,{disabled:!E.value||R.value,loading:R.value,onClick:q},{default:p(()=>[...t[16]||(t[16]=[m(" Save ",-1)])]),_:1},8,["disabled","loading"])]))],64))])]),_:1})}}});G("\n.page[data-v-ff0d733d] {\n\tpadding: var(--content-padding);\n\tmax-width: 720px;\n}\n.mb[data-v-ff0d733d] {\n\tmargin-bottom: 16px;\n}\n.form[data-v-ff0d733d] {\n\tdisplay: flex;\n\tflex-direction: column;\n\tgap: 20px;\n}\n.field .type-label[data-v-ff0d733d] {\n\tfont-weight: 600;\n\tmargin-bottom: 8px;\n\tcolor: var(--foreground-normal);\n}\n.navigation-info[data-v-ff0d733d] {\n\tmargin: 12px;\n}\n.raw-json[data-v-ff0d733d] {\n\twidth: 100%;\n\tfont-family: var(--family-monospace);\n\tfont-size: 13px;\n\tpadding: 12px;\n\tborder-radius: var(--border-radius);\n\tborder: var(--border-width) solid var(--border-normal);\n\tbackground: var(--background-input);\n\tcolor: var(--foreground-normal);\n\tresize: vertical;\n}\n",{});var ne=a({id:"pdf-templates-module",name:"PDF Templates",icon:"picture_as_pdf",routes:[{path:"",component:H},{path:"setup",component:q(ae,[["__scopeId","data-v-ff0d733d"]])}],preRegisterCheck:e=>Boolean(e.admin_access||e.app_access)});const le=new Map;function oe(e){if((e.meta?.interface??"").includes("m2o")||e.meta?.special?.includes("m2o")){return(e.meta?.options?.collection??e.schema?.foreign_key_table)||null}return e.schema?.foreign_key_table??null}async function ie(e,t){const a=Date.now(),n=le.get(t);if(n&&a-n.fetched<6e4)return n.fields;const l=await e.get(`/fields/${t}`),o=l.data?.data??[];return le.set(t,{fields:o,fetched:a}),o}function re(e,t){const a=e.trim();return"#"===t?`{{#if ${a}}}{{/if}}`:"$"===t?`{{#each ${a}}}{{/each}}`:`{{${a}}}`}function de(e,t){return`${t}${e.trim()}`}async function se(e,t){const a=await ie(e,t),n=async(t,n)=>{const l=t.trim(),o=l.lastIndexOf(".");if(o>0){return(async(t,n,l)=>{const o=t.split(".").filter(Boolean);if(0===o.length||o.length>2)return[];let i=a,r="";for(let t=0;t<o.length;t++){const a=o[t],d=i.find(e=>e.field===a);if(!d)return[];r=r?`${r}.${a}`:a;const s=oe(d);if(!s)return[];if(i=await ie(e,s),t===o.length-1)return i.filter(e=>!n||e.field.toLowerCase().includes(n.toLowerCase())).map(e=>({id:de(`${r}.${e.field}`,l),text:re(`${r}.${e.field}`,l)}))}return[]})(l.slice(0,o),l.slice(o+1),n)}return((e,t)=>a.filter(t=>"id"!==t.field||e.length>0).filter(t=>!e||t.field.toLowerCase().includes(e.toLowerCase())).map(e=>({id:de(e.field,t),text:re(e.field,t)})))(l,n)};return[{marker:"@",feed:e=>n(e,"@")},{marker:"#",feed:e=>n(e,"#")},{marker:"$",feed:e=>n(e,"$")}]}const ue={dv:{heading:"https://gute.itsymn.me/MVAWaheed-Bold.ttf",body:"https://gute.itsymn.me/MVFaseyha.ttf"},en:{heading:"https://gute.itsymn.me/inter.ttf",body:"https://gute.itsymn.me/inter.ttf"}},ce={dv:{heading:'"MV A Waheed", "Inter", sans-serif',body:'"MV Faseyha", "Dhivehi", sans-serif'},en:{heading:'"Inter", sans-serif',body:'"Inter", sans-serif'}};const fe="/pdf-render/tinymce";var pe=o({__name:"interface",props:{value:{},disabled:{type:Boolean},field:{},collection:{},fallback_target_collection:{},fallbackTargetCollection:{}},emits:["input"],setup(t,{emit:a}){const n=`${fe}/tinymce.min.js`;let l=null;const o=t,u=a,y=e(),h=U("values",void 0),_=r(()=>(h?C(h):{})??{}),w=r(()=>String(_.value.target_collection??o.fallback_target_collection??o.fallbackTargetCollection??"")),x=r(()=>"dv"===_.value.language),k=i(null),L=E(null),T=i(!1),O=i(null),V=i(!1),j=i({}),F=i(fe);let I=0;function R(){const e=x.value?"dv":"en",t=ue[e];const a=function(e){return ce[e]}(e),n="en"===e?"100 900":"400",l="en"===e?"100 900":"700",o="dv"===e?"rtl":"ltr",i="dv"===e?"right":"left";return[`@font-face{font-family:'PdfHeadingPreview';src:url('${t.heading}') format('truetype');font-weight:${l};font-style:normal;}`,`@font-face{font-family:'PdfBodyPreview';src:url('${t.body}') format('truetype');font-weight:${n};font-style:normal;}`,`body{font-family:'PdfBodyPreview', ${a.body};font-size:14px;line-height:1.75;color:#111;direction:${o};text-align:${i};}`,`h1{font-family:'PdfHeadingPreview', ${a.heading};text-align:center;font-size:18px;margin-bottom:4px;line-height:1.5;}`,`h2,h3,h4,h5,h6{font-family:'PdfHeadingPreview', ${a.heading};}`,`table{width:100%;border-collapse:collapse;margin-top:16px;font-family:'PdfBodyPreview', ${a.body};font-size:14px;}`,`th,td{border:1px solid #000;padding:6px 8px;vertical-align:top;text-align:${i};}`,`thead th{font-family:'PdfHeadingPreview', ${a.heading};background:#f0f0f0;font-weight:600;}`,"img{max-width:100%;height:auto;}"].join("\n")}function M(e,t){const a=t?"readonly":"design";e.mode?.set?e.mode.set(a):"function"==typeof e.setMode&&e.setMode(a)}async function N(){if("undefined"==typeof window)throw new Error("TinyMCE can only be loaded in a browser environment.");const e=window;if(e.tinymce)return e.tinymce;if(l)return l;const t=(e,t)=>new Promise((a,n)=>{const l=document.createElement("script");l.src=e,l.async=!0,l.dataset.pdfTinymce="1",l.dataset.pdfTinymceSrc=e;let o=!1;const i=e=>{o||(o=!0,clearTimeout(r),e())},r=setTimeout(()=>{i(()=>{l.remove(),n(new Error(`Timed out loading TinyMCE (${t}).`))})},15e3);l.addEventListener("load",()=>{i(()=>{const e=window.tinymce;e?a(e):n(new Error(`TinyMCE script loaded from ${t}, but window.tinymce is unavailable.`))})}),l.addEventListener("error",()=>{i(()=>{l.remove(),n(new Error(`Failed to load TinyMCE (${t}).`))})}),document.head.appendChild(l)});return l=(async()=>{const e=[{src:n,label:"proxy",baseUrl:fe},{src:"https://cdnjs.cloudflare.com/ajax/libs/tinymce/8.1.2/tinymce.min.js",label:"cdn",baseUrl:"https://cdnjs.cloudflare.com/ajax/libs/tinymce/8.1.2"}];let a=null;for(const n of e)try{const e=await t(n.src,n.label);return F.value=n.baseUrl,e}catch(e){a=e}throw a instanceof Error?a:new Error("Failed to load TinyMCE from proxy and CDN.")})().catch(e=>{throw l=null,e}),l}async function B(){const e=L.value;if(e){L.value=null;try{e.remove?.()}catch{}}}async function A(){const e=++I;if(O.value=null,T.value&&w.value)try{const t=await se(y,w.value);if(e!==I)return;if(j.value=Object.fromEntries(t.map(e=>[e.marker,e.feed])),await P(),e!==I)return;if(!k.value)throw new Error("Editor host is not ready.");if(await B(),e!==I)return;const a=await N();if(e!==I)return;const n=await a.init({target:k.value,base_url:F.value,suffix:".min",license_key:"gpl",menubar:!1,branding:!1,promotion:!1,height:360,plugins:"lists link table image code autoresize",toolbar:"undo redo | blocks | bold italic | bullist numlist | link image table | code",directionality:x.value?"rtl":"ltr",readonly:o.disabled?1:0,content_style:R(),setup:e=>{!function(e){const t=e.ui?.registry?.addAutocompleter;if(t)for(const a of["@","#","$"]){const n=j.value[a];n&&t(`pdf-liquid-${a.charCodeAt(0)}`,{ch:a,trigger:a,minChars:0,columns:1,fetch:async e=>(await n(e??"")).slice(0,50).map(e=>({type:"autocompleteitem",value:e.text,text:e.text})),onAction:(t,a,n)=>{e.selection?.setRng?.(a),e.insertContent(n),t?.hide?.()}})}}(e),e.on?.("init",()=>{e.setContent(o.value??"")});e.on?.("input change keyup undo redo",()=>{V.value=!0,u("input",e.getContent().replace(/\u00a0/g," ")),V.value=!1})}}),l=n?.[0]??null;if(!l)throw new Error("TinyMCE did not create an editor instance.");if(e!==I)return void l.remove?.();L.value=l,M(l,Boolean(o.disabled))}catch(e){await B(),O.value=e instanceof Error?e.message:"Failed to initialize TinyMCE."}else await B()}return S(()=>o.value,e=>{if(V.value)return;const t=L.value;if(!t)return;const a=e??"";t.getContent()!==a&&t.setContent(a)}),S(()=>o.disabled,e=>{const t=L.value;t&&M(t,Boolean(e))}),S([w,x,T],()=>{A()},{immediate:!0}),d(async()=>{try{await N(),T.value=!0}catch(e){O.value=e instanceof Error?e.message:"Could not load TinyMCE."}}),$(()=>{B()}),(e,t)=>{const a=s("v-notice");return c(),b("div",{class:D(["pdf-liquid-editor",{rtl:x.value}])},[w.value?O.value?(c(),f(a,{key:1,type:"danger"},{default:p(()=>[m(g(O.value),1)]),_:1})):(c(),b("textarea",{key:2,ref_key:"editorHost",ref:k,class:"tiny-host"},null,512)):(c(),f(a,{key:0,type:"info"},{default:p(()=>[...t[0]||(t[0]=[m(" Select a ",-1),v("strong",null,"target collection",-1),m(" on this template to enable field mentions. ",-1)])]),_:1}))],2)}}});G("\n.pdf-liquid-editor[data-v-3a9531fe] {\n\tmin-height: 280px;\n}\n.tiny-host[data-v-3a9531fe] {\n\twidth: 100%;\n\tmin-height: 240px;\n}\n.pdf-liquid-editor[data-v-3a9531fe] .tox.tox-tinymce {\n\tborder-radius: var(--border-radius);\n\tborder-color: var(--border-normal);\n}\n.pdf-liquid-editor[data-v-3a9531fe] .tox .tox-toolbar,\n.pdf-liquid-editor[data-v-3a9531fe] .tox .tox-toolbar__overflow,\n.pdf-liquid-editor[data-v-3a9531fe] .tox .tox-toolbar__primary {\n\tbackground: var(--background-page);\n}\n.pdf-liquid-editor[data-v-3a9531fe] .tox .tox-edit-area__iframe {\n\tbackground: var(--background-input);\n}\n",{});var ve=n({id:"pdf-liquid-editor",name:"PDF Template Editor",icon:"html",description:"TinyMCE (CDN) editor with @ / # / $ field mentions (Handlebars syntax).",component:q(pe,[["__scopeId","data-v-3a9531fe"]]),options:[{field:"fallback_target_collection",type:"string",name:"Fallback target collection",meta:{width:"full",interface:"input",note:"Used when form values inject is unavailable (collection key for @ mentions)."}}],types:["text"],group:"standard"});const me={key:0,class:"pdf-flow-launcher"},ge={key:1,class:"hint"};var ye=o({__name:"interface",props:{value:{},disabled:{type:Boolean},collection:{},primaryKey:{},field:{},options:{},interfaceOptions:{},buttonLabel:{default:"Generate PDF"}},setup(t){const a=t,n=e(),l=U("values",void 0),o=r(()=>(l?C(l):{})??{}),u=i(!1),v=i(!1),_=i(null),w=i(!1),x=i([]);let k=null;function E(){v.value="undefined"!=typeof window&&window.matchMedia("(max-width: 768px)").matches}function D(e){return String(e??"").trim()}function P(){return"undefined"==typeof window?"":window.location.pathname||""}function L(e){if(!e)return{};if("string"==typeof e){if(!e.trim())return{};try{return L(JSON.parse(e))}catch{return{}}}if(Array.isArray(e)){for(const t of e){const e=L(t);if(Object.keys(e).length>0)return e}return{}}return"object"==typeof e?e:{}}function T(e){const t=L(e);if(0===Object.keys(t).length)return{};if("template_id"in t||"templateId"in t||"action_mode"in t||"actionMode"in t)return t;const a=[t.options,t.meta?.options,t.interfaceOptions];for(const e of a){const t=T(e);if(Object.keys(t).length>0)return t}return t}function O(e,t,a=0){if(null==e||a>5)return;if(Array.isArray(e)){for(const n of e){const e=O(n,t,a+1);if(void 0!==e)return e}return}if("object"!=typeof e)return;const n=e;for(const e of t)if(D(n[e]))return n[e];for(const e of Object.values(n)){const n=O(e,t,a+1);if(void 0!==n)return n}}const V=r(()=>{const e=a.field&&"object"==typeof a.field?a.field.meta?.options??a.field.options:void 0,t=[a.interfaceOptions,a.options,e];for(const e of t){const t=T(e);if(Object.keys(t).length>0)return t}return{}}),j=r(()=>{const e=D(O(V.value,["template_id","templateId"]));return e||function(...e){if("undefined"==typeof window)return"";const t=new URLSearchParams(window.location.search);for(const a of e){const e=D(t.get(a));if(e)return e}return""}("template_id","templateId")}),F=r(()=>"open"===D(O(V.value,["action_mode","actionMode"])).toLowerCase()?"open":"download"),I=r(()=>{if(a.collection)return D(a.collection);const e=a.field&&"object"==typeof a.field?D(a.field.collection):"";if(e)return e;const t=D(o.value.$collection??o.value.collection??o.value.target_collection);return t||function(e){const t=e.split("?")[0]?.split("/").filter(Boolean)??[];if(!t.length)return"";const a=t.indexOf("content");return a>=0?decodeURIComponent(String(t[a+1]??"")).trim():t.length>=2?decodeURIComponent(String(t[0]??"")).trim():""}(P())}),R=r(()=>{if(null!=a.primaryKey&&""!==a.primaryKey)return D(a.primaryKey);const e=D(o.value.id??o.value.uuid??o.value.pk??o.value.primaryKey);return e||function(e){const t=e.split("?")[0]?.split("/").filter(Boolean)??[];if(!t.length)return"";const a=t.indexOf("content");return a>=0?decodeURIComponent(String(t[a+2]??"")).trim():t.length>=2?decodeURIComponent(String(t[1]??"")).trim():""}(P())}),M=r(()=>D(O(V.value,["buttonLabel","button_label"]))||D(a.buttonLabel)||"Generate PDF"),N=r(()=>j.value?j.value:x.value.length>0?x.value[0]?.id??null:null),B=r(()=>Boolean(N.value&&I.value&&R.value&&"+"!==R.value)),A=r(()=>I.value?R.value&&"+"!==R.value?w.value?"Loading PDF templates...":N.value?!j.value&&x.value.length>1?"Multiple templates found. Using the first one; set template_id in options to pin one.":"":"No PDF template found for this collection. Configure template_id in options or create one.":"Save this item first to enable PDF generation.":"Could not detect the current collection context.");async function G(){if(B.value&&N.value){u.value=!0,_.value=null;try{const e=await n.post("/pdf-render/render",{template_id:N.value,collection:I.value,item:R.value,action_mode:F.value},{responseType:"blob"}),t=e.headers??{},a=D(t["content-type"])||"application/pdf",l=D(t["content-disposition"]),o=e.data instanceof Blob?e.data:new Blob([e.data],{type:a}),i=function(e){if(!e)return null;const t=e.match(/filename\*=UTF-8''([^;]+)/i);if(t?.[1])try{return decodeURIComponent(t[1])}catch{return t[1]}const a=e.match(/filename="?([^";]+)"?/i);return a?.[1]??null}(l)||`${I.value||"document"}-${R.value||"item"}.pdf`;"open"===F.value?function(e){const t=URL.createObjectURL(e);window.open(t,"_blank","noopener,noreferrer"),setTimeout(()=>URL.revokeObjectURL(t),6e4)}(o):function(e,t){const a=URL.createObjectURL(e),n=document.createElement("a");n.href=a,n.download=t,n.rel="noopener",document.body.appendChild(n),n.click(),n.remove(),setTimeout(()=>URL.revokeObjectURL(a),6e4)}(o,i)}catch(e){_.value=await async function(e){const t=e instanceof Error?e.message:"PDF generation failed.",a=e?.response;if(!a?.data)return t;if(a.data instanceof Blob)try{const e=await a.data.text(),n=JSON.parse(e);return n.error?n.error:n.errors?.[0]?.message?n.errors[0].message:e||t}catch{return t}if("object"==typeof a.data&&a.data){const e=a.data;if(e.error)return e.error;if(e.errors?.[0]?.message)return e.errors[0].message}return t}(e)}finally{u.value=!1}}}return S(I,()=>{!async function(){if(x.value=[],I.value){w.value=!0;try{const e=await n.get("/items/pdf_templates",{params:{limit:-1,sort:"name",fields:["id","name","target_collection","target_collection.collection"]}}),t=e.data?.data??[],a=I.value;x.value=t.map(e=>{return{id:D(e.id),name:D(e.name)||"Untitled template",targetCollection:(t=e.target_collection,"string"==typeof t?t:t&&"object"==typeof t&&"collection"in t?D(t.collection):"")};var t}).filter(e=>e.id&&e.targetCollection===a).map(e=>({id:e.id,name:e.name}))}catch{x.value=[]}finally{w.value=!1}}}()},{immediate:!0}),d(()=>{E(),"undefined"!=typeof window&&(k=window.matchMedia("(max-width: 768px)"),k.addEventListener("change",E))}),$(()=>{k?.removeEventListener("change",E)}),(e,a)=>{const n=s("v-notice"),l=s("v-icon"),o=s("v-button");return v.value?y("v-if",!0):(c(),b("div",me,[_.value?(c(),f(n,{key:0,type:"danger",class:"launch-error"},{default:p(()=>[m(g(_.value),1)]),_:1})):y("v-if",!0),h(o,{disabled:t.disabled||!B.value,loading:u.value,small:"",onClick:G},{default:p(()=>[h(l,{name:"picture_as_pdf",left:""}),m(" "+g(M.value),1)]),_:1},8,["disabled","loading"]),A.value?(c(),b("span",ge,g(A.value),1)):y("v-if",!0)]))}}});G("\n.pdf-flow-launcher[data-v-e2fad4fa] {\n display: flex;\n flex-direction: column;\n align-items: flex-start;\n gap: 8px;\n flex-wrap: wrap;\n}\n.launch-error[data-v-e2fad4fa] {\n width: 100%;\n}\n.hint[data-v-e2fad4fa] {\n font-size: 12px;\n color: var(--foreground-subdued);\n}\n",{});var be=q(ye,[["__scopeId","data-v-e2fad4fa"]]);const he={class:"pdf-flow-launcher-options"},_e={class:"field"},we={class:"field"},xe={class:"field"},ke={class:"field"};var Ce=o({__name:"options",props:{value:{}},emits:["input"],setup(t,{emit:a}){const n=t,l=a,o=e(),r=i(!1),u=i(null),_=i([]),w=i(String(n.value?.template_id??n.value?.templateId??"")),x=i(String(n.value?.buttonLabel??n.value?.button_label??"Generate PDF")),k=i(String(n.value?.action_mode??n.value?.actionMode??"open")),C=[{text:"Open in new tab",value:"open"},{text:"Download PDF",value:"download"}];function U(e){w.value=String(e??"").trim()}function E(e){x.value=String(e??"").trim()}return S(()=>n.value,e=>{w.value=String(e?.template_id??e?.templateId??""),x.value=String(e?.buttonLabel??e?.button_label??"Generate PDF"),k.value=String(e?.action_mode??e?.actionMode??"open")}),S([w,x,k],([e,t,a])=>{l("input",{...n.value??{},template_id:e||null,buttonLabel:t||"Generate PDF",action_mode:a||"open"})}),d(()=>{!async function(){r.value=!0,u.value=null;try{const e=await o.get("/items/pdf_templates",{params:{limit:-1,sort:"name",fields:["id","name","target_collection","target_collection.collection"]}}),t=e.data?.data??[];_.value=t.map(e=>{return{text:`${String(e.name??"Untitled template")} (${t=e.target_collection,("string"==typeof t?t:t&&"object"==typeof t&&"collection"in t?String(t.collection??""):"")||"-"})`,value:String(e.id??"")};var t})}catch(e){u.value=e?.response?.data?.errors?.[0]?.message||"Could not load pdf_templates. You can still paste the template UUID manually.",_.value=[]}finally{r.value=!1}}()}),(e,t)=>{const a=s("v-notice"),n=s("v-select"),l=s("v-input");return c(),b("div",he,[u.value?(c(),f(a,{key:0,type:"warning",class:"mb"},{default:p(()=>[m(g(u.value),1)]),_:1})):y("v-if",!0),v("div",_e,[t[2]||(t[2]=v("div",{class:"type-label"},"PDF template",-1)),h(n,{modelValue:w.value,"onUpdate:modelValue":t[0]||(t[0]=e=>w.value=e),items:_.value,"item-text":"text","item-value":"value",placeholder:"Select a template",disabled:r.value},null,8,["modelValue","items","disabled"])]),v("div",we,[t[3]||(t[3]=v("div",{class:"type-label"},"Template UUID",-1)),h(l,{"model-value":w.value,placeholder:"Paste template UUID","onUpdate:modelValue":U},null,8,["model-value"])]),v("div",xe,[t[4]||(t[4]=v("div",{class:"type-label"},"Button label",-1)),h(l,{"model-value":x.value,placeholder:"Generate PDF","onUpdate:modelValue":E},null,8,["model-value"])]),v("div",ke,[t[5]||(t[5]=v("div",{class:"type-label"},"Action",-1)),h(n,{modelValue:k.value,"onUpdate:modelValue":t[1]||(t[1]=e=>k.value=e),items:C,"item-text":"text","item-value":"value",placeholder:"Open in new tab"},null,8,["modelValue"])])])}}});G("\n.pdf-flow-launcher-options[data-v-2171a2e1] {\n display: flex;\n flex-direction: column;\n gap: 16px;\n}\n.field[data-v-2171a2e1] {\n display: flex;\n flex-direction: column;\n gap: 8px;\n}\n.type-label[data-v-2171a2e1] {\n font-weight: 600;\n color: var(--foreground-normal);\n}\n.mb[data-v-2171a2e1] {\n margin-bottom: 4px;\n}\n",{});var Ue=n({id:"pdf-flow-launcher",name:"PDF Flow Launcher",icon:"picture_as_pdf",description:"Generates a PDF for the current item and opens/downloads it directly.",component:be,options:q(Ce,[["__scopeId","data-v-2171a2e1"]]),types:["string","text","uuid"],group:"other",hideLabel:!0});const Ee={class:"pdf-operation-options"},Se={class:"field"},$e={class:"field"};var De=o({__name:"options",props:{value:{}},emits:["input"],setup(t,{emit:a}){const n=t,l=a,o=e(),r=i(!1),u=i(null),_=i([]),w=i(String(n.value?.template_id??""));function x(e){w.value=String(e??"").trim()}return S(()=>n.value,e=>{w.value=String(e?.template_id??"")}),S(w,e=>{l("input",{...n.value??{},template_id:e||null})}),d(()=>{!async function(){r.value=!0,u.value=null;try{const e=await o.get("/items/pdf_templates",{params:{limit:-1,sort:"name",fields:["id","name","target_collection"]}}),t=e.data?.data??[];_.value=t.map(e=>({text:`${String(e.name??"Untitled")} (${String("object"==typeof e.target_collection&&e.target_collection&&"collection"in e.target_collection?e.target_collection.collection:e.target_collection??"")})`,value:String(e.id??"")}))}catch(e){u.value=e?.response?.data?.errors?.[0]?.message||"Could not load pdf_templates. You can still paste the template UUID manually.",_.value=[]}finally{r.value=!1}}()}),(e,t)=>{const a=s("v-notice"),n=s("v-select"),l=s("v-input");return c(),b("div",Ee,[u.value?(c(),f(a,{key:0,type:"warning",class:"mb"},{default:p(()=>[m(g(u.value),1)]),_:1})):y("v-if",!0),v("div",Se,[t[1]||(t[1]=v("div",{class:"type-label"},"PDF template",-1)),h(n,{modelValue:w.value,"onUpdate:modelValue":t[0]||(t[0]=e=>w.value=e),items:_.value,"item-text":"text","item-value":"value",placeholder:"Select a template",disabled:r.value},null,8,["modelValue","items","disabled"])]),v("div",$e,[t[2]||(t[2]=v("div",{class:"type-label"},"Template UUID",-1)),h(l,{"model-value":w.value,placeholder:"Paste template UUID","onUpdate:modelValue":x},null,8,["model-value"])])])}}});G("\n.pdf-operation-options[data-v-d0a321c6] {\n\tdisplay: flex;\n\tflex-direction: column;\n\tgap: 16px;\n}\n.field[data-v-d0a321c6] {\n\tdisplay: flex;\n\tflex-direction: column;\n\tgap: 8px;\n}\n.type-label[data-v-d0a321c6] {\n\tfont-weight: 600;\n\tcolor: var(--foreground-normal);\n}\n.mb[data-v-d0a321c6] {\n\tmargin-bottom: 4px;\n}\n",{});const Pe=[ve,Ue],Le=[],Te=[],Oe=[ne],Ve=[],je=[],Fe=[l({id:"generate-pdf",name:"Generate PDF (Gotenberg)",icon:"picture_as_pdf",description:"Renders a pdf_templates row with Handlebars, then converts HTML via Gotenberg. Use with a Manual flow on the item page.",overview:({template_id:e})=>[{label:"Template",text:e||"—",copyable:!!e}],options:q(De,[["__scopeId","data-v-d0a321c6"]])})];export{Le as displays,Pe as interfaces,Te as layouts,Oe as modules,Fe as operations,Ve as panels,je as themes};
|
package/package.json
ADDED
|
@@ -0,0 +1,77 @@
|
|
|
1
|
+
{
|
|
2
|
+
"name": "directus-extension-gotenberg",
|
|
3
|
+
"description": "PDF templates with Handlebars, Directus-hosted fonts, and Gotenberg",
|
|
4
|
+
"icon": "picture_as_pdf",
|
|
5
|
+
"version": "1.0.0",
|
|
6
|
+
"license": "MIT",
|
|
7
|
+
"packageManager": "bun@1.3.0",
|
|
8
|
+
"keywords": [
|
|
9
|
+
"directus",
|
|
10
|
+
"directus-extension",
|
|
11
|
+
"directus-extension-bundle"
|
|
12
|
+
],
|
|
13
|
+
"engines": {
|
|
14
|
+
"bun": ">=1.1.0"
|
|
15
|
+
},
|
|
16
|
+
"type": "module",
|
|
17
|
+
"files": [
|
|
18
|
+
"dist"
|
|
19
|
+
],
|
|
20
|
+
"directus:extension": {
|
|
21
|
+
"type": "bundle",
|
|
22
|
+
"path": {
|
|
23
|
+
"app": "dist/app.js",
|
|
24
|
+
"api": "dist/api.js"
|
|
25
|
+
},
|
|
26
|
+
"entries": [
|
|
27
|
+
{
|
|
28
|
+
"type": "module",
|
|
29
|
+
"name": "pdf-templates-module",
|
|
30
|
+
"source": "src/pdf-templates-module/index.ts"
|
|
31
|
+
},
|
|
32
|
+
{
|
|
33
|
+
"type": "interface",
|
|
34
|
+
"name": "pdf-liquid-editor",
|
|
35
|
+
"source": "src/pdf-liquid-editor/index.ts"
|
|
36
|
+
},
|
|
37
|
+
{
|
|
38
|
+
"type": "interface",
|
|
39
|
+
"name": "pdf-flow-launcher",
|
|
40
|
+
"source": "src/pdf-flow-launcher/index.ts"
|
|
41
|
+
},
|
|
42
|
+
{
|
|
43
|
+
"type": "endpoint",
|
|
44
|
+
"name": "pdf-render",
|
|
45
|
+
"source": "src/pdf-render-endpoint/index.ts"
|
|
46
|
+
},
|
|
47
|
+
{
|
|
48
|
+
"type": "operation",
|
|
49
|
+
"name": "generate-pdf",
|
|
50
|
+
"source": {
|
|
51
|
+
"app": "src/generate-pdf-operation/app.ts",
|
|
52
|
+
"api": "src/generate-pdf-operation/api.ts"
|
|
53
|
+
}
|
|
54
|
+
}
|
|
55
|
+
],
|
|
56
|
+
"host": "^10.10.0"
|
|
57
|
+
},
|
|
58
|
+
"scripts": {
|
|
59
|
+
"build": "directus-extension build",
|
|
60
|
+
"dev": "directus-extension build -w --no-minify",
|
|
61
|
+
"link": "directus-extension link",
|
|
62
|
+
"validate": "directus-extension validate",
|
|
63
|
+
"add": "directus-extension add",
|
|
64
|
+
"test:setup": "bash dev/setup.sh",
|
|
65
|
+
"test:start": "bash dev/start.sh",
|
|
66
|
+
"test:reset": "bash dev/reset.sh"
|
|
67
|
+
},
|
|
68
|
+
"dependencies": {
|
|
69
|
+
"handlebars": "^4.7.9"
|
|
70
|
+
},
|
|
71
|
+
"devDependencies": {
|
|
72
|
+
"@directus/extensions-sdk": "17.1.1",
|
|
73
|
+
"@types/node": "^22.10.1",
|
|
74
|
+
"typescript": "^5.7.2",
|
|
75
|
+
"vue": "^3.5.13"
|
|
76
|
+
}
|
|
77
|
+
}
|