Compare commits
86
Commits
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
f50ad504ff | ||
|
|
81e70de70f | ||
|
|
f9b2756456 | ||
|
|
eed538964e | ||
|
|
5ea33a0857 | ||
|
|
2d42d83851 | ||
|
|
d5dc3290cf | ||
|
|
efc2576c9e | ||
|
|
4e4a02c4ed | ||
|
|
0e7fbaf504 | ||
|
|
0a516fa681 | ||
|
|
f7e42f1056 | ||
|
|
6d88d53882 | ||
|
|
f0a1b928dd | ||
|
|
c1acc0067c | ||
|
|
bad5a7db69 | ||
|
|
1ff55ac015 | ||
|
|
702609da1e | ||
|
|
4fc7880187 | ||
|
|
6948c134e3 | ||
|
|
e4dccd0205 | ||
|
|
d31b423f2a | ||
|
|
87ff1c477f | ||
|
|
fb239a97cb | ||
|
|
9d7f92ebfc | ||
|
|
fff84f9a43 | ||
|
|
b2f53ea952 | ||
|
|
1e4da2c8cc | ||
|
|
50ec0eebf2 | ||
|
|
0ae5f49bcf | ||
|
|
9217960de0 | ||
|
|
d1d27a9ebd | ||
|
|
3bd8ce5aee | ||
|
|
4f56edc4fc | ||
|
|
623851bd70 | ||
|
|
39eda9726d | ||
|
|
f718ba57bc | ||
|
|
1de5668032 | ||
|
|
35bf421da8 | ||
|
|
a7cdfbd1cb | ||
|
|
92016256ce | ||
|
|
b96fb2800f | ||
|
|
d16ddd15eb | ||
|
|
aff53371d9 | ||
|
|
425510fb16 | ||
|
|
e3f9b3deb1 | ||
|
|
72ff4e5c76 | ||
|
|
5482ac07c6 | ||
|
|
7e38f05650 | ||
|
|
df29429257 | ||
|
|
f6bcd31bd8 | ||
|
|
77c9117556 | ||
|
|
8fdb399386 | ||
|
|
47f250d27f | ||
|
|
40c6b27ccb | ||
|
|
db01151ca3 | ||
|
|
9fcea8fb09 | ||
|
|
38e71927bc | ||
|
|
70787ace44 | ||
|
|
25021bdafb | ||
|
|
03b46e7bfb | ||
|
|
ec9ac92a95 | ||
|
|
8025bf2692 | ||
|
|
c48d3b1756 | ||
|
|
d053f57b10 | ||
|
|
b522d60954 | ||
|
|
b38e190714 | ||
|
|
d81adb4ddc | ||
|
|
094763fd86 | ||
|
|
a1a98c75c5 | ||
|
|
fb5ec85c9f | ||
|
|
e8054b2292 | ||
|
|
60ae6cf7a6 | ||
|
|
296d6001cd | ||
|
|
aa051525a1 | ||
|
|
b288513bb4 | ||
|
|
74930351f1 | ||
|
|
65d4603793 | ||
|
|
023c11019c | ||
|
|
88d8ae0954 | ||
|
|
ca362f81c8 | ||
|
|
4634e14924 | ||
|
|
69486f65ee | ||
|
|
060b6c647e | ||
|
|
8e186fc231 | ||
|
|
c7bd1efdaa |
No files matched your search
@@ -0,0 +1,18 @@
|
||||
{
|
||||
"extraKnownMarketplaces": {
|
||||
"re-skills": {
|
||||
"source": {
|
||||
"source": "git",
|
||||
"url": "git@code.radical-elements.com:radical/re-skills.git"
|
||||
},
|
||||
"autoUpdate": true
|
||||
}
|
||||
},
|
||||
"enabledPlugins": {
|
||||
"design@re-skills": true,
|
||||
"seo@re-skills": true,
|
||||
"studio@re-skills": true,
|
||||
"engineering@re-skills": true,
|
||||
"boboko@re-skills": true
|
||||
}
|
||||
}
|
||||
@@ -5,6 +5,7 @@ vendor
|
||||
public/build
|
||||
public/hot
|
||||
storage/app/public/*
|
||||
storage/app/private/*
|
||||
storage/framework/cache/*
|
||||
storage/framework/sessions/*
|
||||
storage/framework/views/*
|
||||
|
||||
+24
-9
@@ -4,6 +4,8 @@ COMPOSE_PROJECT_NAME=3dealer
|
||||
|
||||
APP_NAME=Laravel
|
||||
APP_ENV=local
|
||||
# Leave false everywhere except the live site (sends X-Robots-Tag: noindex, nofollow)
|
||||
APP_INDEXABLE=false
|
||||
APP_KEY=
|
||||
APP_DEBUG=true
|
||||
APP_URL=http://localhost
|
||||
@@ -31,7 +33,7 @@ DB_DATABASE=boboko
|
||||
DB_USERNAME=root
|
||||
DB_PASSWORD=dev
|
||||
|
||||
SESSION_DRIVER=database
|
||||
SESSION_DRIVER=redis
|
||||
SESSION_LIFETIME=120
|
||||
SESSION_ENCRYPT=false
|
||||
SESSION_PATH=/
|
||||
@@ -41,7 +43,7 @@ BROADCAST_CONNECTION=log
|
||||
FILESYSTEM_DISK=local
|
||||
QUEUE_CONNECTION=database
|
||||
|
||||
CACHE_STORE=database
|
||||
CACHE_STORE=redis
|
||||
# CACHE_PREFIX=
|
||||
|
||||
MEMCACHED_HOST=127.0.0.1
|
||||
@@ -58,8 +60,8 @@ MAIL_PORT=1025
|
||||
MAIL_USERNAME=null
|
||||
MAIL_PASSWORD=null
|
||||
MAIL_FROM_ADDRESS="hello@example.com"
|
||||
# Fallback only: the sender name comes from Store Details' "Mail from name" when set.
|
||||
MAIL_FROM_NAME="${APP_NAME}"
|
||||
CONTACT_EMAIL=
|
||||
|
||||
HCAPTCHA_SITEKEY=
|
||||
HCAPTCHA_SECRET=
|
||||
@@ -72,13 +74,9 @@ AWS_USE_PATH_STYLE_ENDPOINT=false
|
||||
|
||||
VITE_APP_NAME="${APP_NAME}"
|
||||
|
||||
OTEL_SERVICE_NAME=boboko-starter
|
||||
OTEL_EXPORTER_OTLP_PROTOCOL=http/protobuf
|
||||
OTEL_PROPAGATORS=baggage,tracecontext
|
||||
OTEL_PHP_AUTOLOAD_ENABLED=true
|
||||
OTEL_EXPORTER_OTLP_ENDPOINT=
|
||||
SESSION_SECURE_COOKIE=true
|
||||
|
||||
# Stoic is the headless CMS, proxied at /stoic/ behind the app in prod (see docker/nginx/prod.conf)
|
||||
# Stoic is the headless CMS, proxied at /stoic/ behind the app (see docker/caddy/common.caddy)
|
||||
STOIC_SECRET=dev-secret-change-me
|
||||
STOIC_SSO_SECRET=dev-sso-secret-change-me
|
||||
STOIC_HOST=http://localhost:2727
|
||||
@@ -88,6 +86,9 @@ SCOUT_QUEUE=true
|
||||
MEILISEARCH_KEY=dev-meilisearch-key-change-me
|
||||
MEILISEARCH_HOST=http://meilisearch:7700
|
||||
|
||||
# Lunar sets all prices inclusive of tax with these values
|
||||
LUNAR_STORE_INCLUSIVE_OF_TAX=true
|
||||
|
||||
# Host-side ports — change these if another project on this machine already uses the defaults
|
||||
APP_PORT=8090
|
||||
STOIC_PORT=2727
|
||||
@@ -96,3 +97,17 @@ POSTGRES_HOST_PORT=5436
|
||||
MAILPIT_PORT=8025
|
||||
VITE_PORT=5173
|
||||
MEILISEARCH_PORT=7700
|
||||
|
||||
STRIPE_SECRET=secret
|
||||
STRIPE_PUBLIC_KEY=public_key
|
||||
STRIPE_WEBHOOK_SECRET=webhook_secret
|
||||
|
||||
BOXNOW_BASE_URL=https://api-stage.boxnow.gr/api/v1
|
||||
BOXNOW_LOCATION_API_URL=https://locationapi-stage.boxnow.gr/api/v1
|
||||
BOXNOW_CLIENT_ID=box-client-id
|
||||
BOXNOW_CLIENT_SECRET=box-client-secret
|
||||
BOXNOW_PARTNER_ID=box-partner-id
|
||||
BOXNOW_ORIGIN_LOCATION_ID=box-location-id
|
||||
BOXNOW_SENDER_NAME=test
|
||||
BOXNOW_SENDER_EMAIL=test@test.com
|
||||
BOXNOW_SENDER_PHONE=+306912345678
|
||||
Executable
+2
@@ -0,0 +1,2 @@
|
||||
#!/bin/sh
|
||||
exec bin/check-core-mode
|
||||
+2
-4
@@ -17,11 +17,7 @@
|
||||
/public/build
|
||||
/public/hot
|
||||
/public/sitemap.xml
|
||||
/public/logos/core
|
||||
/public/storage
|
||||
/public/css/filament
|
||||
/public/js/filament
|
||||
/public/fonts/filament
|
||||
/storage/*.key
|
||||
/storage/framework/migrated
|
||||
/storage/pail
|
||||
@@ -31,3 +27,5 @@ Homestead.json
|
||||
Homestead.yaml
|
||||
Thumbs.db
|
||||
.exports
|
||||
|
||||
.claude/settings.local.json
|
||||
@@ -0,0 +1,329 @@
|
||||
# Caching transition: context and first tasks (for Claude)
|
||||
|
||||
> **Temporary roadmap.** Delete this file once the caching transition is
|
||||
> done; it's only needed while the work is in progress.
|
||||
|
||||
Written 2026-11-02 from a planning session in `boboko-research`, updated the
|
||||
same day with the team's decisions. Read this before working on the tasks
|
||||
below. Front-end conventions are still in [CLAUDE.md](CLAUDE.md), and that
|
||||
file wins on style, Greek register, localization and performance rules.
|
||||
|
||||
Source documents (outside this repo, read-only for context):
|
||||
- The research repo (`lexx/research` on code.radical-elements.com), `products/boboko/`:
|
||||
- `caching-islands.md`: the target design (partly superseded, see "Changed on 2026-11-06")
|
||||
- `tech-platform.md`: the platform plan
|
||||
- `manifesto.md`: the principles decisions are checked against
|
||||
- `tasks.md` (the full task list and **source of truth for task ids**) and `team-discussion.md`
|
||||
(open items D7, D10) were written in the same planning session but aren't in the research
|
||||
repo. Ask the team for them.
|
||||
|
||||
The rules that come out of this work are written up as skills in the **`boboko` Claude Code
|
||||
plugin** (re-skills marketplace): `cacheable-pages` above all, plus `storefront-frontend`,
|
||||
`storefront-performance` and `storefront-translations`.
|
||||
|
||||
Every task is also a card on the Planka board (3dealer.gr → Development,
|
||||
label **Transition**). The task id (A1, W1…) is in each card's description.
|
||||
|
||||
**boboko-core is paused** (the backend developer is on leave). Only do the
|
||||
tasks below that don't need core. A0 waits until core work resumes.
|
||||
|
||||
## Where we're going
|
||||
|
||||
**Every catalogue page becomes the same HTML for every visitor**, cached
|
||||
(probably as static files Caddy serves without PHP). Anything personal (cart,
|
||||
login state, wishlist, CSRF token) comes from **one small "islands" request**
|
||||
that runs only when the visitor has a state cookie, and is answered with
|
||||
**JSON** that Stimulus applies to elements already in the page.
|
||||
|
||||
- Cacheable routes (home, category, product, `/products`, FAQ, legal pages)
|
||||
will run **without a session**: no cookies, no CSRF token, no `auth()`, no
|
||||
flash, no `old()`, no `$errors`.
|
||||
- Session routes (cart, checkout, account, login, contact, islands, writes)
|
||||
stay in `web`.
|
||||
- Writes (add to cart, wishlist toggle, review) are normal forms enhanced with
|
||||
`fetch`, answered with JSON. New markup (e.g. a new review) is cloned from a
|
||||
Blade-rendered `<template>` of the same component.
|
||||
|
||||
**Changed on 2026-11-06 (these replace the matching 2026-11-02 decisions below):**
|
||||
- **No Turbo at all**: no Drive, Frames or Streams. Islands and writes answer with
|
||||
**JSON**; Stimulus applies it as text and attributes on existing targets. New
|
||||
markup comes from a Blade `<template>` of the same component, filled with
|
||||
`textContent`, the same pattern as the Meilisearch search cards. Existing Turbo
|
||||
code (listing/search Frames, the review Streams from A4) gets replaced.
|
||||
- **One hint cookie, `bb_state=1`** (has a cart, a login or a wishlist item), with
|
||||
no count in it. One `GET /{locale}/islands` when it's present, nothing otherwise.
|
||||
- **Speculation Rules: `prefetch`, not `prerender`.** Prerender runs every analytics,
|
||||
pixel and consent script on pages nobody may see. Revisit only once pages are
|
||||
cached and the pilot shows analytics stay correct.
|
||||
- **Where the standard storefront template lives** (core or starter) is decided once
|
||||
3dealer is ready.
|
||||
|
||||
**Decided (2026-11-02):**
|
||||
- ~~Turbo Streams for islands and writes~~ (replaced: JSON, see above); the cart
|
||||
badge starts as a fixed-size placeholder.
|
||||
- Laravel 13 (core C0, then A0 here), once core work resumes.
|
||||
- **Page cache: static files** served by Caddy (later tasks P1–P3).
|
||||
- **No Turbo Drive** (now: no Turbo at all). A normal multi-page site plus
|
||||
Speculation Rules, View Transitions and back/forward cache (A7–A9 here).
|
||||
- **Caddy** replaces nginx (W1, the last task in this file).
|
||||
- **Search and filters will run in the browser against Meilisearch** through
|
||||
Caddy on a subdomain, with the card as one Blade component reused through a
|
||||
`<template>` (Meilisearch track M1–M6, not in this list).
|
||||
- **URLs become id + slug** (`/el/products/123-blue-vase`), core C7 first,
|
||||
then A10 here (not in this file).
|
||||
- `view:cache` was commented out by mistake (A6).
|
||||
|
||||
## Where 3dealer is today (personal state found in catalogue pages)
|
||||
|
||||
| What | Where | Handled by |
|
||||
|---|---|---|
|
||||
| `auth()->check()` branching (4 places) | `resources/views/components/header.blade.php` | **A2** |
|
||||
| Cart badge count | header, `data-cart-count-target="badge"`; primed from the drawer's server-rendered count | **A1** (placeholder), core C2/C3 (content) |
|
||||
| Cart drawer body rendered on every page | `@include('checkout::drawer')` in `layouts/app.blade.php` (view lives in boboko-core) | core C3, **not here** |
|
||||
| Wishlist heart state | `components/wishlist-button.blade.php` calls `WishlistService::has()` | **A3** (target only), core C3 (state) |
|
||||
| Review flash, `old()`, `$errors`, `mergeJustSubmittedReview` | `product/show.blade.php`, `components/review-form.blade.php`, `ProductController` | **A4** |
|
||||
| `@csrf` in forms + `<meta name="csrf-token">` | add-to-cart (core), wishlist, review, newsletter, layout | Later (CS1 in core, CS2 here, after Laravel 13 and core C2). **Leave as is** |
|
||||
| Stoic staff embed (`@auth('staff')`) | `layouts/app.blade.php` | Core C2 (via islands), **not here**. Stoic itself may be dropped later |
|
||||
|
||||
Other facts worth knowing:
|
||||
- Turbo is installed, but **Drive is off** (`window.Turbo.session.drive = false`
|
||||
in `resources/js/app.js`). Frames drive the listing, search and sort. **The
|
||||
direction is no Turbo at all**: don't add to it; Frames go away with the
|
||||
Meilisearch track, and `@hotwired/turbo` is removed once nothing uses it.
|
||||
- Catalogue data comes from Meilisearch via boboko-core's `ProductService`.
|
||||
Listings use query-string filters. Don't change that in these tasks; the
|
||||
browser-side rewrite is the M track.
|
||||
- Product reviews have **no moderation**: they go live immediately. The index
|
||||
update is async, which is why `mergeJustSubmittedReview` exists.
|
||||
- URLs use numeric ids (`/products/{id}`). Don't change routes in these
|
||||
tasks; that's A10, after core C7.
|
||||
|
||||
## Rules for this work
|
||||
|
||||
- **3dealer only.** Don't edit `vendor/boboko/core` or `../boboko-core`. If a
|
||||
task turns out to need a core change, stop and write down what's needed
|
||||
instead (core tasks are planned separately in `tasks.md`).
|
||||
- **The site must keep working exactly as today** after each task. These
|
||||
tasks prepare the page; they don't switch on caching.
|
||||
- Only the tasks in this file (A1–A9, W1; A0 once core resumes). The other
|
||||
decided work (page cache, Meilisearch in the browser, URLs) needs core
|
||||
first and has its own tasks and order.
|
||||
- Follow the `{locale}` controller rule in CLAUDE.md (`$locale` is the first
|
||||
parameter).
|
||||
- UI strings: reuse existing `storefront.*` keys where possible. New keys are
|
||||
DB-backed Language Lines (the `storefront-translations` skill), never `lang/`
|
||||
files, and they must reach core's seeder (`boboko:translations:pull`).
|
||||
|
||||
## Status (2026-11-06)
|
||||
|
||||
| Task | Status |
|
||||
|---|---|
|
||||
| A0 Laravel 13 | Waiting for core C0 |
|
||||
| A1 Cart badge placeholder | Done (`6948c13`) |
|
||||
| A2 Header without login checks | Done (`702609d`) |
|
||||
| A3 Stable island targets | Done (`4fc7880`) |
|
||||
| A4 Reviews without a redirect | Done with Turbo Streams (`f0a1b92`). **Rework to JSON** (see A4 below) |
|
||||
| A5 Personal-state test | Not started |
|
||||
| A6 `view:cache` in deploy | Done (`1ff55ac`) |
|
||||
| A7 View Transitions | Done (`bad5a7d`) |
|
||||
| A8 Back/forward cache | No commit yet |
|
||||
| A9 Speculation Rules | Done with `prerender` (`c1acc00`). **Switch to `prefetch`** (see A9 below) |
|
||||
| W1 Caddy | Done (`6d88d53`) |
|
||||
|
||||
## Tasks to work on now
|
||||
|
||||
### A0. Laravel 13 (S, waits for core C0: skip for now)
|
||||
|
||||
**Only once boboko-core has a tagged release that allows `laravel/framework
|
||||
^13`.** Until then, skip it and do the others.
|
||||
|
||||
- Bump `laravel/framework` to `^13.0` and update `boboko/core` to that
|
||||
release. Lunar stays on 1.5.0.
|
||||
- Go through the Laravel 13 upgrade guide for app code (config, middleware in
|
||||
`bootstrap/app.php`, anything deprecated), and note what changed around
|
||||
CSRF (the `Sec-Fetch-Site` origin check) for later tasks CS1/CS2.
|
||||
- Click through: home, category, product, search, cart drawer, checkout with
|
||||
Stripe test mode, account, login/logout, the admin panel.
|
||||
- **Done when:** `composer.lock` is on Laravel 13, the tests pass, and the
|
||||
click-through shows nothing broken.
|
||||
|
||||
### A1. Cart badge as a fixed-size placeholder (S)
|
||||
|
||||
- The badge in `components/header.blade.php` (`data-cart-count-target="badge"`)
|
||||
is `absolute` inside the button, so its appearance probably doesn't shift
|
||||
the layout. **Verify** on mobile and desktop widths (CLS: no movement of the
|
||||
header or icons when the count appears or changes, including 1 → 2 digits).
|
||||
- Give it a stable `id` (e.g. `cart-badge`) so a Turbo Stream can target it.
|
||||
- Keep `cart-count-controller.js` working as today (it listens for
|
||||
`bbk-cart:updated`).
|
||||
- **Rule to record in a comment:** no island may change the size of its
|
||||
container.
|
||||
- **Done when:** a stable id exists, behaviour is unchanged, and no layout
|
||||
shift is measurable.
|
||||
|
||||
### A2. Header links that don't depend on login (S)
|
||||
|
||||
- The account icon always links to `route('account')`. The `auth` middleware
|
||||
already redirects guests to login (`redirectGuestsTo` in
|
||||
`bootstrap/app.php`).
|
||||
- The wishlist icon always links to `route('wishlist')`. Make
|
||||
`WishlistController::guest` redirect logged-in users to `account.wishlist`.
|
||||
- One neutral aria-label for the account link (`storefront.nav.account`)
|
||||
instead of switching to the login label.
|
||||
- Both the desktop and mobile parts of the header (≈ lines 50–62 and 175–189).
|
||||
- **Done when:** `header.blade.php` contains no `auth()` call, and guests and
|
||||
logged-in users still end up on the right pages.
|
||||
|
||||
### A3. Stable island targets in the markup (S)
|
||||
|
||||
- `x-wishlist-button`: add `data-wishlist-product="{{ $productId }}"` on the
|
||||
form root. **Keep** the current server-side `aria-pressed` state for now
|
||||
(core will move it to islands later).
|
||||
- The account link: a stable `id` (e.g. `header-account-link`) on both the
|
||||
desktop and mobile versions, or one shared attribute selector.
|
||||
- `<meta name="csrf-token">` in the layout: a stable `id` (e.g. `csrf-token`).
|
||||
- **Done when:** each personal element has a stable selector, with no visible
|
||||
change.
|
||||
|
||||
### A4. Review submission without a redirect (M)
|
||||
|
||||
Today `ProductController::storeReview` validates, creates a `ProductReview`,
|
||||
calls `searchableSync()`, and redirects to `?tab=reviews#product-tabs` with
|
||||
`withErrors`/`withInput` or a `reviewSubmitted` + `justSubmittedReview` flash.
|
||||
|
||||
Change it to (**updated 2026-11-06: JSON, no Turbo**; the first version used
|
||||
Turbo Streams and needs reworking):
|
||||
- A Stimulus controller that submits the form with `fetch` and
|
||||
`Accept: application/json`. Remove `data-turbo="true"` and the stream views
|
||||
(`product/streams/`).
|
||||
- **Success:** a JSON response (the review, display-ready, plus count and
|
||||
average). The controller clones a Blade-rendered `<template>` of the same
|
||||
review component, fills its slots with `textContent`, prepends it to the
|
||||
list, updates the count and average, and swaps the form for the thank-you.
|
||||
- **Validation errors:** 422 with `{ "errors": { … } }` (what
|
||||
`$request->validate()` already returns for a JSON request), filled into the
|
||||
form's existing error slots, with `aria-invalid`. No session `old()`/`$errors`.
|
||||
- Remove `session('reviewSubmitted')` from `product/show.blade.php`,
|
||||
`old()`/`$errors` from `review-form.blade.php`, and
|
||||
`mergeJustSubmittedReview` and the `justSubmittedReview` flash from the
|
||||
controller.
|
||||
- Keep `searchableSync()`.
|
||||
- **No-JS fallback:** a plain POST may still redirect back to the product
|
||||
page. That fallback may lose inline errors, which is acceptable.
|
||||
- Accessibility: announce the result in a live region, and move focus to the
|
||||
thank-you message or the first invalid field.
|
||||
- Leave the `?tab=reviews` query parameter alone for now, but note it: it's a
|
||||
query-string variant of the product page, which matters once pages are
|
||||
cached.
|
||||
- **Done when:** a submitted review appears immediately without a page load,
|
||||
errors show inline, and nothing on the product page reads the session.
|
||||
|
||||
### A5. Test for personal state on catalogue pages (S)
|
||||
|
||||
- A feature test (in this repo's existing `tests/` setup) that renders home, a
|
||||
category, a product, `/products`, FAQ and the legal pages **as a guest**, and
|
||||
asserts the HTML has no per-visitor content.
|
||||
- Start with assertions that pass after A2–A4 (no `auth()`-dependent markup,
|
||||
no review flash/old input), and **mark the rest as expected failures/skipped
|
||||
with a reason**: the drawer cart body and wishlist state (core C3), the CSRF
|
||||
token (CS1/CS2), and the Stoic staff embed (core C2).
|
||||
- It will need seeded catalogue data, or Meilisearch mocked through
|
||||
`ProductService`. Check how the app can be booted in tests first, and say
|
||||
so if that's harder than an S.
|
||||
- **Done when:** the test runs in CI/locally, passes for what's done, and lists
|
||||
what's still missing.
|
||||
|
||||
### A6. Turn `view:cache` back on in the deploy (S)
|
||||
|
||||
- In `Envoy.blade.php` (`artisan_optimize` task), uncomment the `view:cache`
|
||||
line and give it the same `< /dev/null` as its neighbours.
|
||||
- First run `php artisan view:cache` locally (in the app container). It
|
||||
compiles **every** view, vendor ones included, so a broken view that is
|
||||
never rendered would now fail the deploy. Fix or remove any that fail.
|
||||
- **Done when:** `view:cache` runs cleanly locally and is in the deploy.
|
||||
|
||||
### A7. Cross-document View Transitions (S)
|
||||
|
||||
- Add `@view-transition { navigation: auto; }` to the CSS, inside
|
||||
`@media (prefers-reduced-motion: no-preference)` so it's off for visitors
|
||||
who ask for less motion.
|
||||
- Check in Chrome that the header, the cart drawer and the cookie banner
|
||||
don't flash or jump during a transition. If the default cross-fade looks
|
||||
wrong on some element, give it a `view-transition-name` or exclude it;
|
||||
keep it minimal.
|
||||
- Browsers without support just navigate normally. Turbo Frame listing
|
||||
updates aren't document navigations, so they're unaffected.
|
||||
- **Done when:** page changes cross-fade in Chrome, nothing else changes
|
||||
visibly, and reduced-motion turns it off.
|
||||
|
||||
### A8. Back/forward cache eligibility (S)
|
||||
|
||||
- In Chrome DevTools → Application → Back/forward cache, run the test on
|
||||
home, a category, a product and `/products`, as a guest and logged in.
|
||||
- Fix every blocker it reports that lives in 3dealer: `unload` listeners
|
||||
(ours or a third-party script's), `Cache-Control: no-store` on catalogue
|
||||
pages, open connections. Use `pagehide` instead of `unload` where something
|
||||
needs to run on leave.
|
||||
- Known gap, **not here**: a restored page shows the cart as it was. Core's
|
||||
C2 refreshes on `pageshow` with `event.persisted`. Just note it.
|
||||
- Write down any blocker that only core or a vendor script can fix.
|
||||
- **Done when:** the DevTools test reports "restored from back/forward cache"
|
||||
on those pages, or each remaining blocker is listed with its owner.
|
||||
|
||||
### A9. Speculation Rules (S)
|
||||
|
||||
> **Updated 2026-11-06:** use `prefetch`, not `prerender` (see "Changed on
|
||||
> 2026-11-06"). The rest of this task stands; once Turbo Frames are gone, the
|
||||
> Frame-link exclusions can go too.
|
||||
|
||||
- In the layout, a `<script type="speculationrules">` with `prerender`,
|
||||
`eagerness: "moderate"` (hover or press), for same-origin links.
|
||||
- **Exclude:** cart, checkout, account, login, logout (it's a POST, but
|
||||
exclude the path anyway), wishlist, `/islands` (future), links with
|
||||
`rel~=nofollow`, links inside the Turbo Frame listing controls (filters,
|
||||
sort, pagination: those load into the frame, not as a new page), and
|
||||
anything marked `data-no-prerender`. Use `where` with `href_matches` /
|
||||
`selector_matches`.
|
||||
- Check that GA4 and the consent banner count a page view **only when the
|
||||
prerendered page is actually shown** (DevTools → Application → Speculative
|
||||
loads lets you inspect a prerendered page). If one doesn't, delay it on
|
||||
`document.prerendering` / `prerenderingchange`.
|
||||
- Until pages are cached, each prerender is a full PHP render with 8 FPM
|
||||
workers. Mention it in the commit message so production FPM is watched
|
||||
after the deploy.
|
||||
- **Done when:** hovering a product or category link in Chrome prerenders it
|
||||
(visible in DevTools), excluded links don't, and analytics counts are
|
||||
unchanged.
|
||||
|
||||
### W1. Caddy instead of nginx (M)
|
||||
|
||||
- Today: `docker/nginx/default.conf` (dev) and `prod.conf` (prod, with the
|
||||
FastCGI cache block), `nginx` service in `docker-compose.yml`.
|
||||
- A Caddy image built with `xcaddy`, including the `caddy-ratelimit` module
|
||||
(needed later for the search subdomain M3 and rate limits F7). Pin the
|
||||
Caddy and module versions.
|
||||
- Caddyfile: `php_fastcgi` to the app container, static assets from
|
||||
`public/` with the same long cache headers nginx sends, compression
|
||||
(zstd/gzip), the same security headers, the same upload size limit, the
|
||||
`/up` health check. Copy each rule over deliberately; list anything you
|
||||
drop and why.
|
||||
- **No page cache in Caddy** and no FastCGI-style cache: the static page
|
||||
cache comes later (P2).
|
||||
- **TLS:** find out first how it ends today (a host proxy, Cloudflare, or
|
||||
the container). Don't switch on Caddy's automatic TLS until that's clear;
|
||||
ask if it isn't findable in the repo or Envoy.
|
||||
- Dev stays usable (`docker compose up` works, Vite still proxied as today).
|
||||
- Remove the nginx files and service once Caddy works. boboko-test and the
|
||||
starter are separate repos: note them, don't edit them.
|
||||
- **Done when:** dev and a production-like local run serve every page,
|
||||
asset, upload and the admin panel through Caddy, response headers match
|
||||
today's (compare `curl -I` on a few URLs before and after), and no nginx
|
||||
config is left in this repo.
|
||||
|
||||
## Suggested order
|
||||
|
||||
1. A1 → A3 → A2 (small header/markup work, one commit each).
|
||||
2. A6, A7, A8, A9 (small, independent; one commit each).
|
||||
3. A4, then A5 (the test confirms A2–A4).
|
||||
4. W1.
|
||||
5. A0 only once core C0 is tagged.
|
||||
@@ -1,215 +1,56 @@
|
||||
# Front-end Guidelines
|
||||
# 3dealer
|
||||
|
||||
This is a Laravel 12 e-commerce project using Lunar PHP (headless). These guidelines apply to all front-end work.
|
||||
The storefront for 3dealer.gr: a boboko shop (Laravel + Lunar, on top of the shared
|
||||
`boboko/core` package). It's also the **reference shop**: boboko's standard storefront is being
|
||||
worked out here.
|
||||
|
||||
---
|
||||
## Shared rules: the `boboko` plugin
|
||||
|
||||
## Project Language Settings
|
||||
The rules for every boboko shop are in the **`boboko` Claude Code plugin** (re-skills
|
||||
marketplace, enabled in `.claude/settings.json`). Its skills load when the work calls for them:
|
||||
|
||||
<!-- CHANGE THESE PER PROJECT -->
|
||||
- **Greek register:** `singular` — use the informal second person (εσύ/σου/σε). e.g. "Η κριτική σου", "Το όνομά σου", "Το email σου"
|
||||
<!-- singular = informal (εσύ) | plural = formal (εσείς) -->
|
||||
|
||||
All UI text written for this project must follow the register above.
|
||||
|
||||
---
|
||||
|
||||
## Localization
|
||||
|
||||
Uses classic Laravel localization (https://laravel.com/docs/13.x/localization) — no third-party i18n routing package.
|
||||
|
||||
**Locales:** Greek (`el`) is primary/default, English (`en`) is secondary. Set in `config('app.available_locales')` (`config/app.php`).
|
||||
|
||||
**URL structure:** every route is prefixed with `{locale}`, including the default — `3dealer.gr/el/...` and `3dealer.gr/en/...`. Bare root (`/`) 301-redirects to `/el` (see `routes/web.php`). This avoids the ambiguity of an unprefixed default locale (see the reasoning in project memory / past conversation — prefixing every locale keeps hreflang symmetrical and scales cleanly to a third language later).
|
||||
|
||||
**URL slugs are the same across both locales, permanently** — e.g. `/el/products/{x}` and `/en/products/{x}`, not `/el/proionta/{x}` vs `/en/products/{x}`. This is a deliberate, standing decision for this project, not a placeholder to revisit later. Only the visible content is translated, not the slug. Do not introduce per-locale translated slugs (e.g. a `lang/{locale}/routes.php` segment map) unless the user explicitly asks for that to change.
|
||||
|
||||
**How it's wired:**
|
||||
- All routes live inside `Route::prefix('{locale}')->where('locale', ...)->middleware('setlocale')` in `routes/web.php`.
|
||||
- `App\Http\Middleware\SetLocale` validates the `{locale}` segment (404s if not in `available_locales`), calls `App::setLocale()`, and shares `$currentLocale`, `$altLocale`, and `$altLocaleUrl` (the same page in the other locale) to every view — this is what powers both the header's language switcher and the `<head>` hreflang tags in `resources/views/layouts/app.blade.php`. Don't recompute this logic elsewhere; read those shared variables instead.
|
||||
- When adding a new route, put it inside that `{locale}` group and give it a route `name()` — the alt-locale URL generation in the middleware depends on the current route being named (falls back to the locale root if unnamed).
|
||||
- When linking to a page in Blade, prefer `route('name', [...])` (locale is a normal route param, defaults to `app()->getLocale()` implicitly via the shared route group) over hand-built path strings, except for pages that don't have a controller/route yet (e.g. `/products`, `/contact`, `/cart` placeholders in the header currently use `url('/'.app()->getLocale().'/products')` — replace with `route()` once those pages exist).
|
||||
- **Every controller action for a route inside the `{locale}` group must declare `$locale` as its first parameter, even if unused** — e.g. `show(string $locale, Product $product)`. Laravel's `ControllerDispatcher` ultimately calls the controller with `...array_values($parameters)`, i.e. **positionally**. If a route-bound model parameter (like `$product`) isn't preceded by a matching `$locale` parameter in the method signature, the resolved values shift out of position and the wrong value (the locale string) gets passed where the model was expected — a `TypeError` that's easy to misread as a binding failure. Closures with zero declared parameters are unaffected (PHP just ignores the extra positional arg), so this only bites real controller methods.
|
||||
|
||||
**Where translatable strings go:**
|
||||
- Most UI copy is editable by the client/marketing team via **Stoic** (the headless CMS) — don't hardcode it here.
|
||||
- Small strings that don't need client editing (nav labels, aria-labels, tab labels, pluralized counts) go in Laravel's own lang files at **`lang/{locale}/*.php`** (project root, per Laravel 12+ convention — not `resources/lang`). Current file: `lang/el/general.php` / `lang/en/general.php`. Use `__('general.key')` or `trans_choice('general.key', $count, [...])` for pluralized strings.
|
||||
|
||||
---
|
||||
|
||||
## Tech Stack
|
||||
|
||||
- **Laravel 12** + **Lunar PHP 1.3** (headless e-commerce)
|
||||
- **Blade** for templating (`@extends`, `@section`, `@yield`, components)
|
||||
- **Tailwind CSS v4** via `@tailwindcss/vite` — zero config, `@import 'tailwindcss'` only
|
||||
- **Stimulus JS** for interactivity — controllers registered in `resources/js/stimulus/index.js`
|
||||
- **Popover API** (native browser) for overlays — no JS overlay libraries
|
||||
- SQLite database, `npm run dev` for local asset compilation
|
||||
|
||||
---
|
||||
|
||||
## Key File Locations
|
||||
|
||||
| What | Where |
|
||||
| Skill | For |
|
||||
|---|---|
|
||||
| CSS entry point | `resources/css/app.css` |
|
||||
| Font definitions | `resources/css/fonts.css` |
|
||||
| JS entry point | `resources/js/app.js` |
|
||||
| Stimulus controllers | `resources/js/stimulus/` |
|
||||
| JS utilities | `resources/js/utils/` |
|
||||
| Layout | `resources/views/layouts/app.blade.php` |
|
||||
| UI components (atomic) | `resources/views/components/ui/` |
|
||||
| Section components | `resources/views/components/` |
|
||||
| Page views | `resources/views/{page}/` |
|
||||
| Public assets | `public/images/` |
|
||||
| `boboko-platform` | How core, starter and the shops fit together; where new code goes; approved third-party scripts |
|
||||
| `cacheable-pages` | Catalogue pages identical for every visitor; islands; JSON writes. **Read before touching catalogue pages, the header, the layout or any form** |
|
||||
| `storefront-frontend` | Tailwind, tokens, components, Popover, Stimulus, ARIA, Greek capitals, forms |
|
||||
| `storefront-performance` | Core Web Vitals: bundling, fonts, LCP images, CLS, Speculation Rules, bfcache |
|
||||
| `locale-routes` | `{locale}` routes, `$locale` first in controllers, same slugs, hreflang |
|
||||
| `storefront-translations` | `storefront.*` labels as Language Lines; getting keys into core |
|
||||
| `core-local-dev`, `releasing-core` | Working on core alongside this shop; releasing and `bin/deploy` |
|
||||
|
||||
---
|
||||
If something below conflicts with a skill, this file wins for 3dealer. Say so, so the skill or
|
||||
this file gets fixed.
|
||||
|
||||
## Design Reference
|
||||
**Work in progress:** [CACHING-TRANSITION.md](CACHING-TRANSITION.md) has the current transition's
|
||||
decisions, task status and rules. Known problems: [README.md](README.md), "Known issues".
|
||||
|
||||
The Bluebeard template (`resources/css/bluebeard.css`) is used as a **reference only** for colors, spacing, typography, and effects. It is never imported or used directly. Everything is translated to Tailwind utilities or custom CSS where unavoidable.
|
||||
## Greek register
|
||||
|
||||
The boboko project at `/Users/farenoubi/Projects/boboko-test` can be referenced for CSS architecture patterns.
|
||||
- **Greek register:** `singular`. Use the informal second person (εσύ/σου/σε), e.g.
|
||||
"Η κριτική σου", "Το όνομά σου", "Το email σου".
|
||||
|
||||
---
|
||||
All UI text written for this project follows it, including labels added in the admin.
|
||||
|
||||
## Tailwind vs. Custom CSS
|
||||
## Design tokens
|
||||
|
||||
**Prefer Tailwind utilities by default.** Write custom CSS only when something genuinely cannot be expressed as a utility:
|
||||
In `@theme {}` in `resources/css/app.css`:
|
||||
|
||||
- Pseudo-elements (`::before`, `::after`) with dynamic transforms or transitions
|
||||
- Complex descendant/sibling selectors (e.g. `.group:hover .nav-dropdown`)
|
||||
- Keyframe animations
|
||||
- The underline-slide animation on nav links (background-size trick)
|
||||
- `--font-sans`: **Manrope** (body text).
|
||||
- `--font-display`: **Manrope** (headings, nav, buttons). Kept separate from `--font-sans` in
|
||||
case they diverge later.
|
||||
- `--color-brand` / `--color-brand-light`: the brand greens.
|
||||
- `--text-h1` … `--text-h4`: the heading sizes.
|
||||
|
||||
**Never** write inline CSS (`style="..."`). **Never** write custom CSS for something Tailwind already covers.
|
||||
Reuse these and the colours already in use (`neutral-200`, `black`) before adding anything.
|
||||
The Manrope weights used above the fold are preloaded in `layouts/app.blade.php`; a new heavy
|
||||
weight in a hero needs its own preload there.
|
||||
|
||||
When a component requires a CSS class (e.g. as a hook for a pseudo-element), still put all properties that can be Tailwind utilities as classes on the element in the component file. The CSS rule should contain only what genuinely cannot be a utility — pseudo-elements, complex selectors, keyframes. Do not default to putting all styles in the CSS class just because the class exists.
|
||||
## 3dealer specifics
|
||||
|
||||
When custom CSS is needed, add it to `resources/css/app.css` inside `@layer components`. Keep the rule minimal — only what can't be a utility.
|
||||
|
||||
---
|
||||
|
||||
## Design Tokens
|
||||
|
||||
Defined in `@theme {}` in `app.css`:
|
||||
|
||||
- `--font-sans`: Manrope (body text)
|
||||
- `--font-display`: Manrope (headings, nav, buttons) — kept separate from `--font-sans` in case they diverge later
|
||||
|
||||
Reuse existing colors (`neutral-200`, `black`), font sizes, spacing, and border styles as components are built. Do not invent new values — check what's already in use first.
|
||||
|
||||
---
|
||||
|
||||
## Component Structure
|
||||
|
||||
### `resources/views/components/ui/` — atomic, reusable UI elements
|
||||
|
||||
Single-purpose, stateless or minimally stateful elements used across many contexts:
|
||||
|
||||
- `button.blade.php` ✓
|
||||
- `input.blade.php`
|
||||
- `input-group.blade.php`
|
||||
- `icon.blade.php`
|
||||
- `image.blade.php`
|
||||
- `tabs.blade.php` / `tab.blade.php`
|
||||
- `accordion.blade.php`
|
||||
- `tooltip.blade.php`
|
||||
- `badge.blade.php`
|
||||
- etc.
|
||||
|
||||
### `resources/views/components/` — section-level or composite components
|
||||
|
||||
Larger reusable blocks made of several elements, often with real content:
|
||||
|
||||
- `header.blade.php` ✓
|
||||
- `footer.blade.php`
|
||||
- `cta.blade.php`
|
||||
- `product-card.blade.php`
|
||||
- `contact-section.blade.php`
|
||||
- etc.
|
||||
|
||||
---
|
||||
|
||||
## Interactivity
|
||||
|
||||
### Popover API for overlays
|
||||
|
||||
For **tooltips, modals, dropdowns, and any overlay**: use the native [Popover API](https://developer.mozilla.org/en-US/docs/Web/API/Popover_API) with CSS — no JS, no libraries.
|
||||
|
||||
```html
|
||||
<button popovertarget="my-popover">Open</button>
|
||||
<div id="my-popover" popover>...</div>
|
||||
```
|
||||
|
||||
Style open/closed states with `[popover]` and `:popover-open` selectors in CSS.
|
||||
|
||||
### Stimulus JS for behavior
|
||||
|
||||
Use Stimulus when JS is genuinely needed (form handling, cart updates, dynamic state, etc.).
|
||||
|
||||
- Keep controllers lean: manage state and coordinate the DOM, don't build UI inside them
|
||||
- Use Stimulus values, targets, and outlets — avoid reading from the DOM imperatively
|
||||
- **Never inject HTML strings or classes from inside a controller.** Instead, drive appearance via data attributes or CSS classes toggled on existing elements, and let CSS handle the visual result
|
||||
- Never write inline JS (`onclick="..."`, etc.)
|
||||
|
||||
### Pure CSS for simple interactions
|
||||
|
||||
Hover dropdowns, focus states, active states — handle with CSS (`:hover`, `:focus-within`, `.group:hover`) before reaching for Stimulus.
|
||||
|
||||
---
|
||||
|
||||
## Accessibility (ARIA)
|
||||
|
||||
Always add ARIA attributes. This is not optional:
|
||||
|
||||
- Interactive elements: `aria-label`, `aria-expanded`, `aria-controls`, `aria-haspopup` as appropriate
|
||||
- Images: meaningful `alt` text, or `alt=""` + `aria-hidden="true"` for decorative images
|
||||
- Icons used as buttons: `aria-label` on the button, `aria-hidden="true"` on the SVG
|
||||
- Form fields: always associated `<label>`, `aria-describedby` for hints/errors
|
||||
- Dynamic content: `aria-live` regions where content updates without navigation
|
||||
- When refactoring or adding interactivity, review ARIA impact — don't break existing roles
|
||||
|
||||
---
|
||||
|
||||
## Greek Typography
|
||||
|
||||
CSS `text-transform: uppercase` leaves Greek tonos accents in place (e.g. Ά instead of Α), which is incorrect. The utility at `resources/js/utils/strip-accents.js` handles this automatically for any element with the `uppercase` Tailwind class. **Always add the `uppercase` class to elements** rather than applying `text-transform: uppercase` in CSS — this keeps the strip-accents utility working without extra configuration.
|
||||
|
||||
---
|
||||
|
||||
## Performance & Core Web Vitals
|
||||
|
||||
Every frontend change should assume it will be measured by PageSpeed/Lighthouse. These rules exist because we hit each of these mistakes in production and had to fix them after the fact — bake them in up front instead.
|
||||
|
||||
### CSS bundling
|
||||
- Before adding a CSS import to a shared/global entry point (e.g. `app.css`), ask whether every page actually needs it. Page- or component-specific styles (date pickers, legal-page typography, admin-only widgets) should not ship on pages that don't use them.
|
||||
- Scope non-critical CSS to load only where it's used — either a dedicated build entry for that page, or import the `.css` file inside the same JS module that already lazy-loads that component (e.g. a Stimulus/JS controller), so the bundler emits it as a separate chunk fetched only when that component actually mounts.
|
||||
- Exception: never defer CSS for anything the page shows immediately on load (above-the-fold content, or a component that renders as soon as its JS runs — an FAQ accordion, a cookie-consent banner). Even a well-scoped async CSS chunk arrives a beat after the JS that displays the element, causing a visible flash of unstyled/wrong-state content and a layout shift. Keep that CSS in the blocking bundle on purpose.
|
||||
- Never import a full icon-font library (Phosphor, Font Awesome, etc.) — it ships every icon regardless of usage. Use inline SVGs for only the icons actually referenced; check the shared icon component for an existing icon before adding a new one.
|
||||
- Only declare design tokens / CSS custom properties that are actually used somewhere in the codebase (Tailwind v4 already tree-shakes unused `@theme` tokens from output, so this is for keeping the source legible, not for bytes).
|
||||
|
||||
### Fonts
|
||||
- `font-display: swap` means any text using a font weight will visibly reflow once that weight's file finishes downloading, if the fallback font's metrics differ. Preload every font weight used in above-the-fold text, not just the default body-copy weight — bold/black heading weights are usually the most visually prominent element on the page and cause the most visible reflow if not preloaded.
|
||||
- When introducing a new heavy-weight text utility (e.g. a bold/black heading class) in a hero or above-the-fold component, confirm that weight has a matching `<link rel="preload" as="font">` in the layout `<head>`.
|
||||
|
||||
### Images
|
||||
- Any image that could be the Largest Contentful Paint element (hero/banner images) must have: `fetchpriority="high"`, `loading="eager"`, explicit `width`/`height`, a responsive `srcset`/`sizes`, and a `<link rel="preload" as="image">` in `<head>` with matching `imagesrcset`/`imagesizes` — this lets the browser start the fetch as soon as it parses `<head>`, instead of waiting to discover the `<img>` tag in the body.
|
||||
- Every other image: `loading="lazy"` with explicit `width`/`height` to reserve its layout space.
|
||||
|
||||
### Layout shift (CLS)
|
||||
- Never animate `top`/`bottom`/`left`/`right`/`width`/`height`/`margin` on any element that appears or moves without direct user interaction (banners, toasts, slide-in modals, accordions). These are layout-affecting properties — the browser recalculates layout on every animation frame, and each frame's position delta counts toward CLS. Animate `transform` (translate/scale) and `opacity` instead — both are compositor-only and fully excluded from CLS scoring, no matter how far or long the animation runs.
|
||||
- This applies to vendor/third-party CSS too (cookie-consent widgets, modal libraries) — check its default show/hide mechanism before shipping, and override it if it animates a layout property directly.
|
||||
- Any element with a collapsed/expanded default state (accordions, dropdowns) needs its collapsed-state CSS in the blocking stylesheet, never a lazily-loaded chunk — otherwise it renders in its expanded/default state for a frame before the async CSS applies.
|
||||
|
||||
---
|
||||
|
||||
## Forms
|
||||
|
||||
Never add `novalidate` to forms. Always use the browser's default validation.
|
||||
|
||||
---
|
||||
|
||||
## Asking Questions
|
||||
|
||||
When the approach is unclear — layout structure, whether something should be a component, which Tailwind pattern fits — **ask before building**. A short question is cheaper than a refactor.
|
||||
- **Product custom fields** (text answers and photo uploads on the product page): how they work,
|
||||
limits and clean-up are in [README.md](README.md). Products with custom fields can't be
|
||||
quick-added from cards.
|
||||
- **hCaptcha** protects the contact and login forms only.
|
||||
- **Stoic** provides the FAQ, legal pages and other client-edited copy (`App\Services\Stoic`,
|
||||
`App\Models\Stoic*`).
|
||||
+21
-14
@@ -26,6 +26,9 @@ ENTRYPOINT ["/entrypoint-vite.sh"]
|
||||
|
||||
# ── Stage 2b: Node / Vite build ──────────────────────────────────────────────
|
||||
FROM node:22-alpine AS node-build
|
||||
# git: same reason as vite-dev above — npm needs it to resolve @boboko/core's
|
||||
# git+https tagged-VCS form.
|
||||
RUN apk add --no-cache git
|
||||
WORKDIR /app
|
||||
COPY package*.json ./
|
||||
RUN npm ci --ignore-scripts
|
||||
@@ -61,6 +64,7 @@ RUN apt-get update \
|
||||
php8.5-xml \
|
||||
php8.5-curl \
|
||||
php8.5-redis \
|
||||
php8.5-soap \
|
||||
postgresql-client-18 \
|
||||
&& rm -rf /var/lib/apt/lists/* \
|
||||
&& mkdir -p /run/php \
|
||||
@@ -91,27 +95,30 @@ COPY . .
|
||||
RUN chown -R www-data:www-data storage bootstrap/cache \
|
||||
&& chmod -R 775 storage bootstrap/cache
|
||||
|
||||
# Package discovery and asset publishing are fully determined by composer.lock + code,
|
||||
# so they belong in the image, not in every container's entrypoint. Only asset-type
|
||||
# tags are force-republished here — config tags (core-config, lunar) are a deliberate
|
||||
# one-time `vendor:publish` step you run and commit by hand, since re-running them would
|
||||
# silently overwrite any local edits to config/core.php or config/lunar/*.php.
|
||||
RUN php artisan package:discover --ansi \
|
||||
&& php artisan vendor:publish --tag=core-assets --force --ansi \
|
||||
&& php artisan vendor:publish --tag=public --force --ansi \
|
||||
&& php artisan filament:assets --ansi
|
||||
|
||||
COPY docker/entrypoint.sh /entrypoint.sh
|
||||
RUN chmod +x /entrypoint.sh
|
||||
COPY docker/entrypoint-worker.sh /entrypoint-worker.sh
|
||||
RUN chmod +x /entrypoint.sh /entrypoint-worker.sh
|
||||
|
||||
EXPOSE 9000
|
||||
ENTRYPOINT ["/entrypoint.sh"]
|
||||
CMD ["php-fpm8.5", "-F"]
|
||||
|
||||
# ── Stage 5: Nginx (public assets baked in from production) ──────────────────
|
||||
FROM nginx:alpine AS nginx
|
||||
# ── Stage 5a: Caddy binary (xcaddy, pinned versions) ─────────────────────────
|
||||
# caddy-ratelimit isn't used yet: it's for the search subdomain (M3) and the
|
||||
# PHP-route rate limits (F7). Its only tag (v0.1.0) is years old, so it's
|
||||
# pinned to a commit.
|
||||
FROM caddy:2.11.7-builder-alpine AS caddy-build
|
||||
RUN xcaddy build v2.11.7 \
|
||||
--with github.com/mholt/caddy-ratelimit@5625512f24f6f59d6f64fb3aafe5eecff0b286db
|
||||
|
||||
COPY docker/nginx/prod.conf /etc/nginx/conf.d/default.conf
|
||||
# Development uses this stage as is, with docker/caddy and public/ bind-mounted
|
||||
# (docker-compose.dev.yml).
|
||||
FROM caddy:2.11.7-alpine AS caddy-base
|
||||
COPY --from=caddy-build /usr/bin/caddy /usr/bin/caddy
|
||||
|
||||
# ── Stage 5b: Caddy for production (config + public assets baked in) ─────────
|
||||
FROM caddy-base AS caddy
|
||||
COPY docker/caddy/global.caddy docker/caddy/common.caddy docker/caddy/Caddyfile /etc/caddy/
|
||||
COPY --from=production /var/www/html/public /var/www/html/public
|
||||
|
||||
# ── Stage 6: Development ──────────────────────────────────────────────────────
|
||||
|
||||
+3
-9
@@ -19,7 +19,6 @@
|
||||
pull
|
||||
docker_build
|
||||
docker_up
|
||||
migrate
|
||||
artisan_optimize
|
||||
restart_workers
|
||||
stoic_generate_thumbs
|
||||
@@ -45,25 +44,20 @@
|
||||
{{ $compose }} up -d --remove-orphans
|
||||
@endtask
|
||||
|
||||
@task('migrate', ['on' => 'web'])
|
||||
echo ">>> Running migrations..."
|
||||
cd {{ $path }}
|
||||
{{ $compose }} exec -T app php artisan migrate --force < /dev/null
|
||||
@endtask
|
||||
|
||||
@task('artisan_optimize', ['on' => 'web'])
|
||||
echo ">>> Optimizing..."
|
||||
cd {{ $path }}
|
||||
{{ $compose }} exec -T app php artisan config:cache < /dev/null
|
||||
{{ $compose }} exec -T app php artisan route:cache < /dev/null
|
||||
{{-- {{ $compose }} exec -T app php artisan view:cache --}}
|
||||
{{ $compose }} exec -T app php artisan view:cache < /dev/null
|
||||
{{ $compose }} exec -T app php artisan event:cache < /dev/null
|
||||
@endtask
|
||||
|
||||
@task('restart_workers', ['on' => 'web'])
|
||||
echo ">>> Restarting queue workers..."
|
||||
echo ">>> Restarting queue workers and scheduler..."
|
||||
cd {{ $path }}
|
||||
{{ $compose }} restart queue
|
||||
{{ $compose }} restart scheduler
|
||||
@endtask
|
||||
|
||||
@task('password_protect', ['on' => 'web'])
|
||||
|
||||
@@ -27,3 +27,21 @@ ## Product custom fields
|
||||
- **Photos are cleaned up automatically.** Photos never added to a cart are deleted by `custom-fields:prune-uploads` (see above). A photo on a cart line is kept as long as that cart line exists, and a photo on an order is kept indefinitely.
|
||||
- **Products with custom fields can't be quick-added.** On product cards, the "add to cart" button becomes a link to the product page.
|
||||
- Field labels are entered once in the admin and aren't translated, so they appear as entered in both `/el` and `/en`.
|
||||
|
||||
## Known issues
|
||||
|
||||
Found 2026-11-06 while setting up the `boboko` Claude Code plugin. Remove an entry once it's fixed.
|
||||
|
||||
- **Storefront labels aren't seeded on boot.** `docker/entrypoint.sh` runs the `checkout` and
|
||||
`validation` translation seeders, but not `StorefrontTranslationsSeeder`, so new
|
||||
`storefront.*` keys released in core never reach an environment by themselves. Fix: add it
|
||||
next to the other two.
|
||||
- **About 20 `storefront.*` keys exist only in this shop's database**, not in core's seeder:
|
||||
all `footer.*` and `errors.*`, `nav.faq`, `nav.menu`, `search.no_results`,
|
||||
`search.results_count`, `shop.filters`, `contact.privacy_notice`. A fresh environment shows
|
||||
them as raw keys. Fix: `bin/core-mode local`, then
|
||||
`bin/dc-core.sh exec app php artisan boboko:translations:pull`, then commit and release core.
|
||||
- **Home hero carousel images (LCP).** In `resources/views/home.blade.php`, every slide gets
|
||||
`loading="eager"` and `fetchpriority="high"` (only the first visible one should), the
|
||||
`preload="…"` attribute on `<img>` does nothing (preloading is a `<link>` in `<head>`), and
|
||||
there's no `srcset`/`sizes` or `<head>` image preload.
|
||||
@@ -0,0 +1,47 @@
|
||||
<?php
|
||||
|
||||
namespace App\Catalog;
|
||||
|
||||
use Modules\Core\Catalog\Services\CollectionService;
|
||||
|
||||
/**
|
||||
* Breadcrumb items for a collection and its ancestors, root first, in the
|
||||
* shape <x-breadcrumb> takes. Home is added by the component itself.
|
||||
*
|
||||
* Interim: the indexed `ancestors` field gives the right ids and order, but
|
||||
* its names are translated once at index time (CollectionIndexer uses
|
||||
* translateAttribute('name') with no locale), so they'd show in the wrong
|
||||
* language on the other locale. Each ancestor is re-read via getById() for a
|
||||
* current-locale name instead. Trees are shallow, so it's one or two extra
|
||||
* index lookups. Drop the re-read once core indexes ancestor names per locale.
|
||||
*/
|
||||
final class CollectionTrail
|
||||
{
|
||||
public function __construct(
|
||||
private readonly CollectionService $collections,
|
||||
) {}
|
||||
|
||||
/**
|
||||
* @param array<string, mixed> $collection a localized CollectionService document
|
||||
* @param bool $linkLast false when the collection itself is the current page
|
||||
* @return array<int, array{label: string, href?: string}>
|
||||
*/
|
||||
public function for(array $collection, bool $linkLast = true): array
|
||||
{
|
||||
$ancestors = collect($collection['ancestors'] ?? [])
|
||||
->map(fn (array $ancestor) => [
|
||||
// Untranslated collections resolve to a null name, so keep the
|
||||
// index-time name as a fallback.
|
||||
'label' => $this->collections->getById((int) $ancestor['id'])['name'] ?? $ancestor['name'],
|
||||
'href' => route('category.show', ['id' => $ancestor['id']]),
|
||||
]);
|
||||
|
||||
$self = ['label' => $collection['name'] ?? ''];
|
||||
|
||||
if ($linkLast) {
|
||||
$self['href'] = route('category.show', ['id' => $collection['id']]);
|
||||
}
|
||||
|
||||
return [...$ancestors->values()->all(), $self];
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,43 @@
|
||||
<?php
|
||||
|
||||
namespace App\Catalog;
|
||||
|
||||
use Lunar\Base\StandardMediaDefinitions;
|
||||
use Spatie\Image\Enums\Constraint;
|
||||
use Spatie\MediaLibrary\HasMedia;
|
||||
use Spatie\MediaLibrary\MediaCollections\MediaCollection;
|
||||
use Spatie\MediaLibrary\MediaCollections\Models\Media;
|
||||
|
||||
/**
|
||||
* INTERIM — belongs in boboko-core (see the core task in the image
|
||||
* performance discussion). Delete this class and point
|
||||
* config/lunar/media.php back at core's definitions once it lands there.
|
||||
*
|
||||
* Storefront product image sizes for srcset: WebP at fixed widths, the
|
||||
* original's aspect ratio preserved and never upscaled. Replaces Lunar's
|
||||
* square white-padded zoom/large/medium conversions (nothing reads them);
|
||||
* the parent's `small` conversion stays for the admin panel.
|
||||
*/
|
||||
class ProductMediaDefinitions extends StandardMediaDefinitions
|
||||
{
|
||||
/** Conversion name => width in px. Named `w{width}` so the srcset can be built from the name. */
|
||||
public const WIDTHS = [
|
||||
'w160' => 160,
|
||||
'w400' => 400,
|
||||
'w800' => 800,
|
||||
'w1200' => 1200,
|
||||
'w1600' => 1600,
|
||||
];
|
||||
|
||||
protected function registerCollectionConversions(MediaCollection $collection, HasMedia $model): void
|
||||
{
|
||||
$collection->registerMediaConversions(function (Media $media) use ($model) {
|
||||
foreach (self::WIDTHS as $name => $width) {
|
||||
$model->addMediaConversion($name)
|
||||
->width($width, [Constraint::PreserveAspectRatio, Constraint::DoNotUpsize])
|
||||
->format('webp')
|
||||
->quality(80);
|
||||
}
|
||||
});
|
||||
}
|
||||
}
|
||||
@@ -44,7 +44,11 @@ public function show(string $locale, Request $request, int $orderId): View
|
||||
return view('account.orders.show', [
|
||||
'order' => $order,
|
||||
'paymentMethodName' => $paymentMethodName,
|
||||
'shipments' => $order->shipments->whereNull('cancelled_at')->whereNotNull('tracking_reference'),
|
||||
// Active shipments with a number; return vouchers are the shop's
|
||||
// business, not the customer's.
|
||||
'shipments' => $order->shipments
|
||||
->reject(fn ($shipment) => $shipment->isCancelled() || $shipment->isReturn() || blank($shipment->tracking_reference))
|
||||
->values(),
|
||||
]);
|
||||
}
|
||||
}
|
||||
@@ -2,6 +2,7 @@
|
||||
|
||||
namespace App\Http\Controllers;
|
||||
|
||||
use App\Catalog\CollectionTrail;
|
||||
use App\Catalog\ProductListing;
|
||||
use App\Catalog\ProductListingPage;
|
||||
use Illuminate\Http\Response;
|
||||
@@ -12,6 +13,7 @@ class CategoryController extends Controller
|
||||
public function __construct(
|
||||
private readonly ProductListingPage $listingPage,
|
||||
private readonly CollectionService $collections,
|
||||
private readonly CollectionTrail $trail,
|
||||
) {}
|
||||
|
||||
public function show(string $locale, int $collection)
|
||||
@@ -27,6 +29,10 @@ public function show(string $locale, int $collection)
|
||||
$collectionData['id'],
|
||||
);
|
||||
|
||||
return view('category.show', [...$data, 'collection' => $collectionData]);
|
||||
return view('category.show', [
|
||||
...$data,
|
||||
'collection' => $collectionData,
|
||||
'breadcrumb' => $this->trail->for($collectionData, linkLast: false),
|
||||
]);
|
||||
}
|
||||
}
|
||||
@@ -5,16 +5,18 @@
|
||||
use App\Http\Requests\ContactRequest;
|
||||
use App\Mail\ContactConfirmationMail;
|
||||
use App\Mail\ContactMessageMail;
|
||||
use App\Models\StoicPage;
|
||||
use Illuminate\Http\RedirectResponse;
|
||||
use Illuminate\Support\Facades\Log;
|
||||
use Illuminate\Support\Facades\Mail;
|
||||
use Illuminate\Support\Facades\RateLimiter;
|
||||
use Illuminate\View\View;
|
||||
use Modules\Core\Store\Services\StoreDetailsService;
|
||||
use Throwable;
|
||||
|
||||
/**
|
||||
* Contact form. Nothing is stored: the message is emailed to the store
|
||||
* (CONTACT_EMAIL) and the sender gets a generic confirmation. Both are sent
|
||||
* (Store Details' contact email) and the sender gets a generic confirmation. Both are sent
|
||||
* synchronously so a failed store email can be reported back on the form.
|
||||
*
|
||||
* Limited per IP in here rather than with throttle middleware, so the limit
|
||||
@@ -27,7 +29,16 @@ class ContactController extends Controller
|
||||
|
||||
public function index(string $locale): View
|
||||
{
|
||||
return view('contact');
|
||||
$page = StoicPage::localized('contact');
|
||||
|
||||
if (! $page) {
|
||||
abort(404);
|
||||
}
|
||||
|
||||
return view('contact', [
|
||||
'page' => $page,
|
||||
'store' => app(StoreDetailsService::class)->current(),
|
||||
]);
|
||||
}
|
||||
|
||||
public function send(string $locale, ContactRequest $request): RedirectResponse
|
||||
@@ -41,11 +52,11 @@ public function send(string $locale, ContactRequest $request): RedirectResponse
|
||||
RateLimiter::hit($key, self::SEND_DECAY_SECONDS);
|
||||
|
||||
$data = $request->validated();
|
||||
$to = config('services.contact.email');
|
||||
$to = app(StoreDetailsService::class)->current()->contact_email;
|
||||
|
||||
try {
|
||||
if (blank($to)) {
|
||||
throw new \RuntimeException('CONTACT_EMAIL is not set.');
|
||||
throw new \RuntimeException('Store Details has no contact email.');
|
||||
}
|
||||
|
||||
Mail::to($to)->send(new ContactMessageMail(
|
||||
|
||||
@@ -0,0 +1,45 @@
|
||||
<?php
|
||||
|
||||
namespace App\Http\Controllers;
|
||||
|
||||
use App\Models\StoicFaq;
|
||||
use App\Models\StoicFaqSection;
|
||||
use App\Models\StoicPage;
|
||||
use App\Services\Stoic;
|
||||
use App\Support\StorePlaceholders;
|
||||
use Illuminate\Support\Str;
|
||||
use Illuminate\View\View;
|
||||
|
||||
/**
|
||||
* FAQ page: pages/faq.md lists the sections, each section lists its FAQs
|
||||
* (both Stoic relations, so the order is the editor's). Answers are markdown
|
||||
* and can use the same store placeholders as the legal pages.
|
||||
*/
|
||||
class FaqController extends Controller
|
||||
{
|
||||
public function index(string $locale, StorePlaceholders $placeholders): View
|
||||
{
|
||||
$page = StoicPage::localized('faq');
|
||||
|
||||
if (! $page) {
|
||||
abort(404);
|
||||
}
|
||||
|
||||
$sections = Stoic::localizedRelation(StoicFaqSection::class, $page->sections, 'faq-sections')
|
||||
->map(function (StoicFaqSection $section) use ($placeholders) {
|
||||
$section->items = Stoic::localizedRelation(StoicFaq::class, $section->faqs, 'faqs')
|
||||
->map(fn (StoicFaq $faq) => $faq->forceFill([
|
||||
'answer' => Str::markdown($placeholders->fill($faq->content ?? '')),
|
||||
]));
|
||||
|
||||
return $section;
|
||||
})
|
||||
->filter(fn (StoicFaqSection $section) => $section->items->isNotEmpty())
|
||||
->values();
|
||||
|
||||
return view('faq', [
|
||||
'page' => $page,
|
||||
'sections' => $sections,
|
||||
]);
|
||||
}
|
||||
}
|
||||
@@ -4,27 +4,72 @@
|
||||
|
||||
use App\Catalog\ProductCard;
|
||||
use App\Models\StoicPage;
|
||||
use Modules\Core\Catalog\DTOs\ProductFilters;
|
||||
use Modules\Core\Catalog\Services\CollectionService;
|
||||
use Modules\Core\Catalog\Services\ProductService;
|
||||
|
||||
class HomeController extends Controller
|
||||
{
|
||||
public function __construct(private readonly ProductService $products) {}
|
||||
/** Slug of the hero collection in the "Homepage" collection group. */
|
||||
private const HERO_COLLECTION_SLUG = 'hero';
|
||||
|
||||
private const HERO_FALLBACK_COUNT = 5;
|
||||
|
||||
private const CLASSICS_COUNT = 8;
|
||||
|
||||
public function __construct(
|
||||
private readonly ProductService $products,
|
||||
private readonly CollectionService $collections,
|
||||
) {}
|
||||
|
||||
public function index(string $locale)
|
||||
{
|
||||
$page = StoicPage::firstWhere('slug', 'home');
|
||||
$page = StoicPage::localized('home');
|
||||
|
||||
if (! $page) {
|
||||
abort(404);
|
||||
}
|
||||
|
||||
$products = collect($this->products->random(13))
|
||||
->map(fn (array $product) => ProductCard::fromIndexed($product));
|
||||
// Random pool for the classics carousel, and for the hero too when the
|
||||
// hero collection is missing or empty. Oversized so hero products can be
|
||||
// excluded from it and still leave enough.
|
||||
$random = collect($this->products->random(self::HERO_FALLBACK_COUNT + self::CLASSICS_COUNT));
|
||||
|
||||
$hero = collect($this->heroCollectionProducts());
|
||||
|
||||
if ($hero->isEmpty()) {
|
||||
$hero = $random->take(self::HERO_FALLBACK_COUNT);
|
||||
}
|
||||
|
||||
$heroIds = $hero->pluck('id')->all();
|
||||
|
||||
$classics = $random
|
||||
->reject(fn (array $product) => in_array($product['id'], $heroIds))
|
||||
->take(self::CLASSICS_COUNT);
|
||||
|
||||
return view('home', [
|
||||
'page' => $page,
|
||||
'heroProducts' => $products->take(5)->values(),
|
||||
'classicsProducts' => $products->slice(5)->values(),
|
||||
'heroProducts' => $hero->map(fn (array $product) => ProductCard::fromIndexed($product))->values(),
|
||||
'classicsProducts' => $classics->map(fn (array $product) => ProductCard::fromIndexed($product))->values(),
|
||||
]);
|
||||
}
|
||||
|
||||
/**
|
||||
* Products the store owner picked for the hero, via the Lunar collection
|
||||
* with slug "hero". Not in the owner's drag order yet: the product index
|
||||
* doesn't carry per-collection position (pending a boboko-core task).
|
||||
*/
|
||||
private function heroCollectionProducts(): array
|
||||
{
|
||||
$collection = $this->collections->getBySlug(self::HERO_COLLECTION_SLUG);
|
||||
|
||||
if ($collection === null) {
|
||||
return [];
|
||||
}
|
||||
|
||||
return $this->products
|
||||
->list(new ProductFilters(collectionId: $collection['id']))
|
||||
->products
|
||||
->items();
|
||||
}
|
||||
}
|
||||
@@ -3,9 +3,14 @@
|
||||
namespace App\Http\Controllers;
|
||||
|
||||
use App\Models\StoicPage;
|
||||
use App\Support\StorePlaceholders;
|
||||
|
||||
class LegalPageController extends Controller
|
||||
{
|
||||
public function __construct(
|
||||
private readonly StorePlaceholders $placeholders,
|
||||
) {}
|
||||
|
||||
public function terms(string $locale)
|
||||
{
|
||||
return $this->show('terms-and-conditions');
|
||||
@@ -28,12 +33,15 @@ public function cookies(string $locale)
|
||||
|
||||
private function show(string $slug)
|
||||
{
|
||||
$page = StoicPage::firstWhere('slug', $slug);
|
||||
$page = StoicPage::localized($slug);
|
||||
|
||||
if (! $page) {
|
||||
abort(404);
|
||||
}
|
||||
|
||||
return view('legal', ['page' => $page]);
|
||||
return view('legal', [
|
||||
'page' => $page,
|
||||
'content' => $this->placeholders->fill($page->content ?? ''),
|
||||
]);
|
||||
}
|
||||
}
|
||||
@@ -2,6 +2,7 @@
|
||||
|
||||
namespace App\Http\Controllers;
|
||||
|
||||
use App\Catalog\CollectionTrail;
|
||||
use App\Catalog\ProductListing;
|
||||
use App\Catalog\ProductListingPage;
|
||||
use Illuminate\Http\JsonResponse;
|
||||
@@ -11,6 +12,7 @@
|
||||
use Illuminate\Support\Facades\Validator;
|
||||
use Lunar\Models\Product;
|
||||
use Lunar\Models\ProductVariant;
|
||||
use Modules\Core\Catalog\Services\CollectionService;
|
||||
use Modules\Core\Catalog\Services\ProductService;
|
||||
use Modules\Core\Review\Models\ProductReview;
|
||||
|
||||
@@ -19,6 +21,8 @@ class ProductController extends Controller
|
||||
public function __construct(
|
||||
private readonly ProductService $products,
|
||||
private readonly ProductListingPage $listingPage,
|
||||
private readonly CollectionService $collections,
|
||||
private readonly CollectionTrail $trail,
|
||||
) {}
|
||||
|
||||
/**
|
||||
@@ -42,20 +46,40 @@ public function show(string $locale, int $id)
|
||||
$product = $this->products->getById($id);
|
||||
abort_if($product === null, Response::HTTP_NOT_FOUND);
|
||||
|
||||
$product = $this->mergeJustSubmittedReview($product);
|
||||
|
||||
$collection = $product['collections'][0] ?? null;
|
||||
// dd($product);
|
||||
[$productOptions, $variantsData] = $this->buildOptionPicker($id);
|
||||
|
||||
return view('product.show', [
|
||||
'collection' => $collection,
|
||||
'breadcrumb' => [...$this->collectionTrail($product), ['label' => $product['name']]],
|
||||
'product' => $product,
|
||||
'productOptions' => $productOptions,
|
||||
'variantsData' => $variantsData,
|
||||
]);
|
||||
}
|
||||
|
||||
/**
|
||||
* The product's first directly-assigned collection with its ancestors, or
|
||||
* the all-products page when it has none. The product document's own
|
||||
* `collections` entries carry neither ancestors nor a current-locale name,
|
||||
* so the collection is re-read from the collection index.
|
||||
*
|
||||
* @return array<int, array{label: string, href?: string}>
|
||||
*/
|
||||
private function collectionTrail(array $product): array
|
||||
{
|
||||
$assigned = $product['collections'][0] ?? null;
|
||||
$collection = $assigned !== null ? $this->collections->getById((int) $assigned['id']) : null;
|
||||
|
||||
if ($collection === null) {
|
||||
return [['label' => __('storefront.nav.products'), 'href' => route('products')]];
|
||||
}
|
||||
|
||||
// Untranslated collections resolve to a null name; the product's own
|
||||
// index-time name is the fallback, same as CollectionTrail's ancestors.
|
||||
$collection['name'] ??= $assigned['name'];
|
||||
|
||||
return $this->trail->for($collection);
|
||||
}
|
||||
|
||||
/**
|
||||
* One button/swatch group per product option (a product can have several
|
||||
* — e.g. a custom-photo product with size + style + person-count, each
|
||||
@@ -121,40 +145,6 @@ private function buildOptionPicker(int $productId): array
|
||||
return [$productOptions, $variantsData];
|
||||
}
|
||||
|
||||
/**
|
||||
* Meilisearch's own write API is itself async — addDocuments() enqueues an
|
||||
* indexing task and returns immediately, and Laravel\Scout\Engines\
|
||||
* MeilisearchEngine::update() never waits on that task, so even
|
||||
* $product->searchableSync() (which only skips OUR queue) can still land
|
||||
* the shopper back on this page before Meilisearch has actually processed
|
||||
* the write. storeReview() flashes the review it just created for exactly
|
||||
* this one next request; splice it in here rather than trust the index is
|
||||
* already caught up. Guarded by id so a race the other way — the index
|
||||
* DID catch up in time — doesn't show the same review twice.
|
||||
*/
|
||||
private function mergeJustSubmittedReview(array $product): array
|
||||
{
|
||||
$justSubmitted = session('justSubmittedReview');
|
||||
|
||||
if (! $justSubmitted || (string) ($justSubmitted['product_id'] ?? null) !== (string) $product['id']) {
|
||||
return $product;
|
||||
}
|
||||
|
||||
$items = $product['reviews']['items'] ?? [];
|
||||
|
||||
if (collect($items)->contains('id', $justSubmitted['id'])) {
|
||||
return $product;
|
||||
}
|
||||
|
||||
$items = [$justSubmitted, ...$items];
|
||||
|
||||
$product['reviews']['items'] = $items;
|
||||
$product['reviews']['count'] = count($items);
|
||||
$product['reviews']['average_rating'] = round(collect($items)->avg('rating'), 1);
|
||||
|
||||
return $product;
|
||||
}
|
||||
|
||||
/**
|
||||
* A storefront-owned, checkout-module-independent stock check — the
|
||||
* product page's "Add to cart" calls this first and only submits to the
|
||||
@@ -188,14 +178,21 @@ public function checkStock(string $locale, Request $request): JsonResponse
|
||||
/**
|
||||
* boboko/core's product_reviews table has no moderation/status column, so
|
||||
* this goes live immediately — no approval queue to land in.
|
||||
*
|
||||
* The form submits through Turbo, so the answer is Turbo Streams: the new
|
||||
* review into the list, the updated count and average, the thank-you in
|
||||
* place of the form; or, on a validation error, the form again with inline
|
||||
* errors (422). Nothing goes through the session, so the product page
|
||||
* itself never reads one (it'll be cached). Without JS this is a plain
|
||||
* POST that redirects back to the product page, losing the inline errors
|
||||
* and the thank-you — accepted.
|
||||
*
|
||||
* The redirect's ?tab=reviews is a query-string variant of the product
|
||||
* page: keep that in mind once product pages are cached.
|
||||
*/
|
||||
public function storeReview(string $locale, Request $request, Product $product): RedirectResponse
|
||||
public function storeReview(string $locale, Request $request, Product $product): RedirectResponse|Response
|
||||
{
|
||||
$reviewsUrl = route('product.show', [
|
||||
'locale' => $locale,
|
||||
'id' => $product->id,
|
||||
'tab' => 'reviews',
|
||||
]).'#product-tabs';
|
||||
$wantsStream = str_contains((string) $request->header('Accept'), 'text/vnd.turbo-stream.html');
|
||||
|
||||
$validator = Validator::make($request->all(), [
|
||||
'rating' => ['required', 'integer', 'between:1,5'],
|
||||
@@ -205,7 +202,13 @@ public function storeReview(string $locale, Request $request, Product $product):
|
||||
]);
|
||||
|
||||
if ($validator->fails()) {
|
||||
return redirect($reviewsUrl)->withErrors($validator)->withInput();
|
||||
return $wantsStream
|
||||
? $this->turboStream('product.streams.review-invalid', [
|
||||
'productId' => $product->id,
|
||||
'messages' => $validator->errors(),
|
||||
'values' => $request->only('rating', 'content', 'name', 'email'),
|
||||
], Response::HTTP_UNPROCESSABLE_ENTITY)
|
||||
: redirect($this->reviewsUrl($locale, $product));
|
||||
}
|
||||
|
||||
$data = $validator->validated();
|
||||
@@ -225,17 +228,23 @@ public function storeReview(string $locale, Request $request, Product $product):
|
||||
]);
|
||||
|
||||
// ReviewServiceProvider also reindexes on the model's `created` event, but
|
||||
// queued (SCOUT_QUEUE=true) — it wouldn't land before this redirect's page
|
||||
// load. Syncing here skips our queue too, but Meilisearch's own write API
|
||||
// is itself async on top of that (see mergeJustSubmittedReview()), so this
|
||||
// alone still isn't a guarantee — it's the flash below that actually is.
|
||||
// queued (SCOUT_QUEUE=true). Syncing here skips our queue, so the next
|
||||
// product page load has it as soon as Meilisearch (itself async) catches
|
||||
// up. The stream below doesn't wait for the index: it renders the new
|
||||
// review and the count/average straight from the DB, which is exactly
|
||||
// what ProductIndexer builds the index's `reviews` from.
|
||||
$product->searchableSync();
|
||||
|
||||
return redirect($reviewsUrl)
|
||||
->with('reviewSubmitted', true)
|
||||
->with('justSubmittedReview', [
|
||||
if (! $wantsStream) {
|
||||
return redirect($this->reviewsUrl($locale, $product));
|
||||
}
|
||||
|
||||
$reviews = ProductReview::where('product_id', $product->id);
|
||||
|
||||
return $this->turboStream('product.streams.review-stored', [
|
||||
// Same shape as ProductIndexer::mapReview(), for the shared partial.
|
||||
'review' => [
|
||||
'id' => $review->id,
|
||||
'product_id' => $review->product_id,
|
||||
'title' => $review->title,
|
||||
'body' => $review->body,
|
||||
'rating' => $review->rating,
|
||||
@@ -244,6 +253,25 @@ public function storeReview(string $locale, Request $request, Product $product):
|
||||
'reply' => null,
|
||||
'replied_at' => null,
|
||||
'media' => [],
|
||||
]);
|
||||
],
|
||||
'count' => (clone $reviews)->count(),
|
||||
'averageRating' => round((float) (clone $reviews)->avg('rating'), 1),
|
||||
]);
|
||||
}
|
||||
|
||||
private function reviewsUrl(string $locale, Product $product): string
|
||||
{
|
||||
return route('product.show', [
|
||||
'locale' => $locale,
|
||||
'id' => $product->id,
|
||||
'tab' => 'reviews',
|
||||
]).'#product-tabs';
|
||||
}
|
||||
|
||||
private function turboStream(string $view, array $data, int $status = Response::HTTP_OK): Response
|
||||
{
|
||||
return response()
|
||||
->view($view, $data, $status)
|
||||
->header('Content-Type', 'text/vnd.turbo-stream.html');
|
||||
}
|
||||
}
|
||||
@@ -2,17 +2,34 @@
|
||||
|
||||
namespace App\Http\Controllers;
|
||||
|
||||
use App\Catalog\ProductCard;
|
||||
use App\Catalog\ProductListing;
|
||||
use App\Catalog\ProductListingPage;
|
||||
use Modules\Core\Catalog\Services\ProductSearchService;
|
||||
|
||||
class SearchController extends Controller
|
||||
{
|
||||
public function __construct(private readonly ProductListingPage $listingPage) {}
|
||||
/** Live search answers from this many characters on. */
|
||||
public const LIVE_MIN_CHARS = 3;
|
||||
|
||||
/** How many products the live search dropdown lists. */
|
||||
private const LIVE_LIMIT = 6;
|
||||
|
||||
public function __construct(
|
||||
private readonly ProductListingPage $listingPage,
|
||||
private readonly ProductSearchService $search,
|
||||
) {}
|
||||
|
||||
public function show(string $locale)
|
||||
{
|
||||
$query = trim((string) request()->query('q', ''));
|
||||
|
||||
// The search overlay's live results: the same endpoint, asked for by
|
||||
// its <turbo-frame id="search-suggestions"> as the shopper types.
|
||||
if (request()->header('Turbo-Frame') === 'search-suggestions') {
|
||||
return $this->suggestions($query);
|
||||
}
|
||||
|
||||
if ($query === '') {
|
||||
return redirect()->route('products');
|
||||
}
|
||||
@@ -28,4 +45,27 @@ public function show(string $locale)
|
||||
|
||||
return view('search.index', [...$data, 'query' => $query]);
|
||||
}
|
||||
|
||||
/**
|
||||
* The first few matches and how many there are in all — the dropdown
|
||||
* under the search overlay. Empty below LIVE_MIN_CHARS characters.
|
||||
*/
|
||||
private function suggestions(string $query)
|
||||
{
|
||||
$products = collect();
|
||||
$total = 0;
|
||||
|
||||
if (mb_strlen($query) >= self::LIVE_MIN_CHARS) {
|
||||
$result = $this->search->search($query, perPage: self::LIVE_LIMIT);
|
||||
$products = collect($result->products->items())->map(ProductCard::fromIndexed(...));
|
||||
$total = $result->products->total();
|
||||
}
|
||||
|
||||
return view('search.suggestions', [
|
||||
'query' => $query,
|
||||
'products' => $products,
|
||||
'total' => $total,
|
||||
'searched' => mb_strlen($query) >= self::LIVE_MIN_CHARS,
|
||||
]);
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,31 @@
|
||||
<?php
|
||||
|
||||
namespace App\Http\Middleware;
|
||||
|
||||
use Closure;
|
||||
use Illuminate\Http\Request;
|
||||
use Symfony\Component\HttpFoundation\Response;
|
||||
|
||||
/**
|
||||
* Sends `X-Robots-Tag: noindex, nofollow` on every Laravel response unless
|
||||
* config('app.indexable') is on. Opt-in rather than tied to APP_ENV, since
|
||||
* staging runs with APP_ENV=production too; only the live site sets
|
||||
* APP_INDEXABLE=true.
|
||||
*
|
||||
* robots.txt deliberately still allows crawling: a Disallow would stop
|
||||
* crawlers from fetching pages at all, so they'd never see this header and
|
||||
* already-indexed URLs would stay in the index.
|
||||
*/
|
||||
class PreventIndexing
|
||||
{
|
||||
public function handle(Request $request, Closure $next): Response
|
||||
{
|
||||
$response = $next($request);
|
||||
|
||||
if (! config('app.indexable')) {
|
||||
$response->headers->set('X-Robots-Tag', 'noindex, nofollow');
|
||||
}
|
||||
|
||||
return $response;
|
||||
}
|
||||
}
|
||||
@@ -8,7 +8,7 @@
|
||||
use Illuminate\Mail\Mailables\Envelope;
|
||||
|
||||
/**
|
||||
* A contact-form message, sent to the store's CONTACT_EMAIL. Reply-To is the
|
||||
* A contact-form message, sent to Store Details' contact email. Reply-To is the
|
||||
* sender, so replying from the inbox goes straight to them.
|
||||
*/
|
||||
class ContactMessageMail extends Mailable
|
||||
|
||||
@@ -0,0 +1,18 @@
|
||||
<?php
|
||||
|
||||
namespace App\Models;
|
||||
|
||||
use Illuminate\Database\Eloquent\Model;
|
||||
use JacobJoergensen\LaravelPaper\Attributes\ContentPath;
|
||||
use JacobJoergensen\LaravelPaper\Attributes\Driver;
|
||||
use JacobJoergensen\LaravelPaper\Paper;
|
||||
|
||||
// A question and its answer (markdown body), listed by an FAQ section.
|
||||
// Default-locale entries, like StoicPage; Stoic::localizedRelation() layers
|
||||
// the current locale's fields on top.
|
||||
#[Driver("markdown")]
|
||||
#[ContentPath("resources/stoic/content/el/faqs")]
|
||||
class StoicFaq extends Model
|
||||
{
|
||||
use Paper;
|
||||
}
|
||||
@@ -0,0 +1,18 @@
|
||||
<?php
|
||||
|
||||
namespace App\Models;
|
||||
|
||||
use Illuminate\Database\Eloquent\Model;
|
||||
use JacobJoergensen\LaravelPaper\Attributes\ContentPath;
|
||||
use JacobJoergensen\LaravelPaper\Attributes\Driver;
|
||||
use JacobJoergensen\LaravelPaper\Paper;
|
||||
|
||||
// A titled group of FAQs on the FAQ page, ordered by its faqs relation.
|
||||
// Default-locale entries, like StoicPage; Stoic::localizedRelation() layers
|
||||
// the current locale's fields on top.
|
||||
#[Driver("markdown")]
|
||||
#[ContentPath("resources/stoic/content/el/faq-sections")]
|
||||
class StoicFaqSection extends Model
|
||||
{
|
||||
use Paper;
|
||||
}
|
||||
@@ -2,16 +2,32 @@
|
||||
|
||||
namespace App\Models;
|
||||
|
||||
use App\Services\Stoic;
|
||||
use Illuminate\Database\Eloquent\Model;
|
||||
use JacobJoergensen\LaravelPaper\Attributes\ContentPath;
|
||||
use JacobJoergensen\LaravelPaper\Attributes\Driver;
|
||||
use JacobJoergensen\LaravelPaper\Attributes\Timestamps;
|
||||
use JacobJoergensen\LaravelPaper\Paper;
|
||||
|
||||
// Points at the default locale (el), which Stoic writes every field to. Other
|
||||
// locales hold only the translatable fields — use localized() to get a page
|
||||
// with those layered on top for the current locale.
|
||||
#[Driver("markdown")]
|
||||
#[ContentPath("resources/stoic/content/pages")]
|
||||
#[ContentPath("resources/stoic/content/el/pages")]
|
||||
#[Timestamps]
|
||||
class StoicPage extends Model
|
||||
{
|
||||
use Paper;
|
||||
|
||||
/**
|
||||
* The page in the current locale: the default-locale entry, with the
|
||||
* current locale's non-empty fields (and body) swapped in. Untranslated
|
||||
* fields fall back to the default locale.
|
||||
*/
|
||||
public static function localized(string $slug): ?static
|
||||
{
|
||||
$page = static::firstWhere('slug', $slug);
|
||||
|
||||
return $page?->forceFill(Stoic::localeOverrides("pages/{$slug}.md"));
|
||||
}
|
||||
}
|
||||
+16
-1
@@ -29,12 +29,26 @@ class User extends Authenticatable implements LunarUserInterface
|
||||
];
|
||||
|
||||
/**
|
||||
* The attributes that should be hidden for serialization.
|
||||
* The attributes that should be hidden for serialization. Every
|
||||
* secret-bearing OTP/pending-email-change field is included here,
|
||||
* not just remember_token — otp_code_hash and
|
||||
* pending_email_code_hash are bcrypt hashes rather than the raw
|
||||
* codes (see Modules\Core\Auth\Services\UserOtpService and
|
||||
* Modules\Core\Customer\Services\CustomerEmailChangeService), but a
|
||||
* hash is still not something any serialized response should leak,
|
||||
* and otp_attempts/pending_email_attempts reveal in-progress guess
|
||||
* counts.
|
||||
*
|
||||
* @var list<string>
|
||||
*/
|
||||
protected $hidden = [
|
||||
'remember_token',
|
||||
'otp_code_hash',
|
||||
'otp_expires_at',
|
||||
'otp_attempts',
|
||||
'pending_email_code_hash',
|
||||
'pending_email_expires_at',
|
||||
'pending_email_attempts',
|
||||
];
|
||||
|
||||
/**
|
||||
@@ -46,6 +60,7 @@ protected function casts(): array
|
||||
{
|
||||
return [
|
||||
'email_verified_at' => 'datetime',
|
||||
'otp_code_hash' => 'hashed',
|
||||
];
|
||||
}
|
||||
}
|
||||
@@ -4,34 +4,80 @@
|
||||
|
||||
use App\Models\Customer;
|
||||
use App\Models\Staff;
|
||||
use App\Services\StoicSettings;
|
||||
use Illuminate\Database\Eloquent\Relations\Relation;
|
||||
use Illuminate\Mail\Events\MessageSending;
|
||||
use Illuminate\Support\Facades\Event;
|
||||
use Illuminate\Support\Facades\URL;
|
||||
use Illuminate\Support\Facades\View;
|
||||
use Illuminate\Support\ServiceProvider;
|
||||
use Illuminate\View\View as ViewInstance;
|
||||
use Lunar\Facades\ModelManifest;
|
||||
use Lunar\Facades\Telemetry;
|
||||
use Lunar\Models\CollectionGroup;
|
||||
use Modules\Core\Catalog\DTOs\CollectionFilters;
|
||||
use Modules\Core\Catalog\Enums\CollectionSort;
|
||||
use Modules\Core\Catalog\Services\CollectionService;
|
||||
use Modules\Core\Store\Services\StoreDetailsService;
|
||||
use Symfony\Component\Mime\Address;
|
||||
|
||||
class AppServiceProvider extends ServiceProvider
|
||||
{
|
||||
public function register(): void
|
||||
{
|
||||
$this->app->scoped(StoicSettings::class);
|
||||
}
|
||||
|
||||
public function boot(): void
|
||||
{
|
||||
Telemetry::optOut();
|
||||
|
||||
// header.blade.php's category dropdown — root collections only, resolved
|
||||
// per-request so the composer runs after `locale` middleware has already
|
||||
// set App::getLocale(), which CollectionService's name resolution depends on.
|
||||
// header.blade.php's category dropdown — root collections of the catalog
|
||||
// group only, so merchandising groups (e.g. "Homepage") stay out of the
|
||||
// nav. Resolved per-request so the composer runs after `locale` middleware
|
||||
// has already set App::getLocale(), which CollectionService's name
|
||||
// resolution depends on. The group is looked up by handle, not id, since
|
||||
// ids can differ between environments.
|
||||
View::composer('components.header', function (ViewInstance $view) {
|
||||
$view->with('categories', app(CollectionService::class)->list(
|
||||
filters: new CollectionFilters(rootOnly: true),
|
||||
$groupId = CollectionGroup::where('handle', 'shopify')->value('id');
|
||||
|
||||
$view->with('categories', $groupId === null ? [] : app(CollectionService::class)->list(
|
||||
filters: new CollectionFilters(groupId: $groupId, rootOnly: true),
|
||||
perPage: 100,
|
||||
sort: CollectionSort::Position,
|
||||
)->items());
|
||||
});
|
||||
|
||||
// Site-wide settings edited in Stoic (settings.md): default meta
|
||||
// description, social links for the footer, emails and schema.org.
|
||||
View::composer(
|
||||
['layouts.app', 'components.footer', 'emails.layout', 'home'],
|
||||
fn (ViewInstance $view) => $view->with('stoicSettings', app(StoicSettings::class)),
|
||||
);
|
||||
|
||||
// INTERIM, belongs in boboko-core's Store module: the sender name on
|
||||
// outgoing emails comes from Store Details' "Mail from name", with
|
||||
// MAIL_FROM_NAME as the fallback when it's empty. Done per message
|
||||
// rather than by setting config at boot, so a long-running queue
|
||||
// worker picks up a changed name without a restart. Only the default
|
||||
// from address is renamed; a mailable with its own from is left alone.
|
||||
Event::listen(MessageSending::class, function (MessageSending $event) {
|
||||
$name = app(StoreDetailsService::class)->current()->mail_from_name;
|
||||
|
||||
if (blank($name)) {
|
||||
return;
|
||||
}
|
||||
|
||||
$defaultAddress = config('mail.from.address');
|
||||
|
||||
$event->message->from(...array_map(
|
||||
fn (Address $from) => $from->getAddress() === $defaultAddress
|
||||
? new Address($from->getAddress(), $name)
|
||||
: $from,
|
||||
$event->message->getFrom(),
|
||||
));
|
||||
});
|
||||
|
||||
if ($this->app->environment('production')) {
|
||||
URL::forceScheme('https');
|
||||
}
|
||||
|
||||
@@ -4,6 +4,7 @@
|
||||
|
||||
use Illuminate\Database\Eloquent\Model;
|
||||
use Illuminate\Support\Facades\Storage;
|
||||
use Spatie\YamlFrontMatter\YamlFrontMatter;
|
||||
use Symfony\Component\Yaml\Yaml;
|
||||
|
||||
class Stoic
|
||||
@@ -29,6 +30,42 @@ public static function presets(): array
|
||||
return static::$presets;
|
||||
}
|
||||
|
||||
// Stoic's default locale (first in i18n.locales), or null when i18n is off.
|
||||
// Its content folder holds every field; other locales only translatable ones.
|
||||
public static function defaultLocale(): ?string
|
||||
{
|
||||
static::loadConfig();
|
||||
return static::$config["i18n"]["locales"][0]["code"] ?? null;
|
||||
}
|
||||
|
||||
// The current locale's translated fields for a content file (path relative
|
||||
// to a locale folder, e.g. "pages/home.md"), with the markdown body as
|
||||
// `content`. Empty when the current locale is the default one (or i18n is
|
||||
// off), the file doesn't exist, or a field is left blank — so layering this
|
||||
// over the default-locale values falls back to them field by field.
|
||||
public static function localeOverrides(string $file): array
|
||||
{
|
||||
$default = static::defaultLocale();
|
||||
$locale = app()->getLocale();
|
||||
|
||||
if ($default === null || $locale === $default) {
|
||||
return [];
|
||||
}
|
||||
|
||||
$path = resource_path("stoic/content/{$locale}/{$file}");
|
||||
|
||||
if (!is_file($path)) {
|
||||
return [];
|
||||
}
|
||||
|
||||
$document = YamlFrontMatter::parse(file_get_contents($path));
|
||||
|
||||
return array_filter(
|
||||
[...$document->matter(), "content" => trim($document->body())],
|
||||
fn($value) => filled($value),
|
||||
);
|
||||
}
|
||||
|
||||
// Returns the public URL for a stoic image at a given preset.
|
||||
public static function image(string $filename, string $preset): string
|
||||
{
|
||||
@@ -142,6 +179,22 @@ public static function hasMany(
|
||||
));
|
||||
}
|
||||
|
||||
// hasMany() with each entry's current-locale fields layered on top (see
|
||||
// localeOverrides). $folder is both the relation prefix and the content
|
||||
// folder, e.g. "faqs". Refs pointing at deleted entries are dropped.
|
||||
public static function localizedRelation(
|
||||
string $relation,
|
||||
?array $slugs,
|
||||
string $folder,
|
||||
) {
|
||||
return static::hasMany($relation, $slugs ?? [], $folder)
|
||||
->filter()
|
||||
->map(fn($entry) => $entry->forceFill(
|
||||
static::localeOverrides("{$folder}/{$entry->slug}.md"),
|
||||
))
|
||||
->values();
|
||||
}
|
||||
|
||||
public static function hasOne(
|
||||
string $relation,
|
||||
string $slug,
|
||||
|
||||
@@ -0,0 +1,96 @@
|
||||
<?php
|
||||
|
||||
namespace App\Services;
|
||||
|
||||
use Spatie\YamlFrontMatter\YamlFrontMatter;
|
||||
|
||||
/**
|
||||
* Site-wide, marketing-editable settings from Stoic's `settings` singleton
|
||||
* (resources/stoic/content/{locale}/settings.md). Read directly rather than
|
||||
* through a Paper model: Paper models map to a folder of entries, and this is
|
||||
* one file per locale. Legal and transactional details (address, ΑΦΜ, phone)
|
||||
* live in boboko-core's StoreDetails instead.
|
||||
*
|
||||
* Stoic writes every field to the default locale's file and only the
|
||||
* translatable ones (e.g. meta_description) to the others, so the current
|
||||
* locale's file is layered over the default one; empty values fall through.
|
||||
*
|
||||
* Bound as scoped in AppServiceProvider, so files are parsed at most once per
|
||||
* locale per request (or queued job) and edits in Stoic show up on the next one.
|
||||
* The locale is read per call, not at construction, so a mail rendered with
|
||||
* ->locale() still gets its own locale's values.
|
||||
*/
|
||||
class StoicSettings
|
||||
{
|
||||
private const SOCIALS = [
|
||||
'facebook' => 'Facebook',
|
||||
'instagram' => 'Instagram',
|
||||
'tiktok' => 'TikTok',
|
||||
];
|
||||
|
||||
/** @var array<string, array<string, mixed>> keyed by locale */
|
||||
private array $data = [];
|
||||
|
||||
public function get(string $key, mixed $default = null): mixed
|
||||
{
|
||||
$value = $this->data()[$key] ?? null;
|
||||
|
||||
return filled($value) ? $value : $default;
|
||||
}
|
||||
|
||||
/**
|
||||
* Absolute og:image URL for a Stoic image field value (the page's own, else
|
||||
* the default from settings.md), or null. Image fields store a
|
||||
* comma-separated list; only the first is used.
|
||||
*/
|
||||
public function ogImageUrl(?string $pageImage = null): ?string
|
||||
{
|
||||
$filename = trim(explode(',', $pageImage ?: (string) $this->get('og_image', ''))[0]);
|
||||
|
||||
return $filename === '' ? null : url(Stoic::image($filename, 'large'));
|
||||
}
|
||||
|
||||
/**
|
||||
* Only the networks that have a URL set, in display order.
|
||||
*
|
||||
* @return list<array{icon: string, label: string, url: string}>
|
||||
*/
|
||||
public function socialLinks(): array
|
||||
{
|
||||
$links = [];
|
||||
|
||||
foreach (self::SOCIALS as $icon => $label) {
|
||||
if ($url = $this->get("{$icon}_url")) {
|
||||
$links[] = ['icon' => $icon, 'label' => $label, 'url' => $url];
|
||||
}
|
||||
}
|
||||
|
||||
return $links;
|
||||
}
|
||||
|
||||
private function data(): array
|
||||
{
|
||||
$locale = app()->getLocale();
|
||||
|
||||
return $this->data[$locale] ??= $this->load();
|
||||
}
|
||||
|
||||
private function load(): array
|
||||
{
|
||||
$default = Stoic::defaultLocale();
|
||||
|
||||
if ($default === null) {
|
||||
return $this->parse(resource_path('stoic/content/settings.md'));
|
||||
}
|
||||
|
||||
return array_merge(
|
||||
$this->parse(resource_path("stoic/content/{$default}/settings.md")),
|
||||
Stoic::localeOverrides('settings.md'),
|
||||
);
|
||||
}
|
||||
|
||||
private function parse(string $path): array
|
||||
{
|
||||
return is_file($path) ? YamlFrontMatter::parse(file_get_contents($path))->matter() : [];
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,74 @@
|
||||
<?php
|
||||
|
||||
namespace App\Support;
|
||||
|
||||
use Illuminate\Support\HtmlString;
|
||||
use Normalizer;
|
||||
|
||||
/**
|
||||
* Underlines the words of a product name that a search query matched, for
|
||||
* the live search dropdown: every word starting with one of the query's
|
||||
* words ("click" → "Edamame _Clicker_"), ignoring case and accents the way
|
||||
* Meilisearch does ("παπ" → "_Παπάκι_"). Typo matches aren't marked — the
|
||||
* name is shown as is.
|
||||
*/
|
||||
final class SearchHighlight
|
||||
{
|
||||
public static function name(string $name, string $query, string $class = 'underline underline-offset-4'): HtmlString
|
||||
{
|
||||
$terms = array_values(array_filter(preg_split('/[^\p{L}\p{N}]+/u', self::fold($query)) ?: []));
|
||||
$chars = mb_str_split($name);
|
||||
|
||||
if ($terms === [] || $chars === []) {
|
||||
return new HtmlString(e($name));
|
||||
}
|
||||
|
||||
// One folded character per original one, so positions line up.
|
||||
$folded = array_map(self::fold(...), $chars);
|
||||
$html = '';
|
||||
$i = 0;
|
||||
$count = count($chars);
|
||||
|
||||
while ($i < $count) {
|
||||
if (! self::isWordChar($chars[$i])) {
|
||||
$html .= e($chars[$i++]);
|
||||
|
||||
continue;
|
||||
}
|
||||
|
||||
$end = $i;
|
||||
while ($end < $count && self::isWordChar($chars[$end])) {
|
||||
$end++;
|
||||
}
|
||||
|
||||
$word = implode('', array_slice($chars, $i, $end - $i));
|
||||
$foldedWord = implode('', array_slice($folded, $i, $end - $i));
|
||||
$matched = collect($terms)->contains(fn (string $term) => str_starts_with($foldedWord, $term));
|
||||
|
||||
$html .= $matched ? '<span class="'.e($class).'">'.e($word).'</span>' : e($word);
|
||||
$i = $end;
|
||||
}
|
||||
|
||||
return new HtmlString($html);
|
||||
}
|
||||
|
||||
/**
|
||||
* Lower case, without accents; Greek final sigma as σ.
|
||||
*/
|
||||
private static function fold(string $text): string
|
||||
{
|
||||
if (class_exists(Normalizer::class)) {
|
||||
$text = preg_replace('/\p{Mn}+/u', '', Normalizer::normalize($text, Normalizer::FORM_D) ?: $text);
|
||||
}
|
||||
|
||||
return strtr(mb_strtolower($text), [
|
||||
'ά' => 'α', 'έ' => 'ε', 'ή' => 'η', 'ί' => 'ι', 'ό' => 'ο', 'ύ' => 'υ', 'ώ' => 'ω',
|
||||
'ϊ' => 'ι', 'ϋ' => 'υ', 'ΐ' => 'ι', 'ΰ' => 'υ', 'ς' => 'σ',
|
||||
]);
|
||||
}
|
||||
|
||||
private static function isWordChar(string $char): bool
|
||||
{
|
||||
return (bool) preg_match('/[\p{L}\p{N}]/u', $char);
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,41 @@
|
||||
<?php
|
||||
|
||||
namespace App\Support;
|
||||
|
||||
use Modules\Core\Store\Services\StoreDetailsService;
|
||||
|
||||
/**
|
||||
* {placeholder} => StoreDetails column, usable in Stoic markdown (legal pages,
|
||||
* FAQ answers).
|
||||
*/
|
||||
class StorePlaceholders
|
||||
{
|
||||
private const PLACEHOLDERS = [
|
||||
'{store_name}' => 'name',
|
||||
'{store_address}' => 'address',
|
||||
'{store_phone}' => 'phone',
|
||||
'{store_contact_email}' => 'contact_email',
|
||||
'{store_legal_name}' => 'legal_name',
|
||||
'{store_tax_identifier}' => 'tax_identifier',
|
||||
'{store_registration_number}' => 'registration_number',
|
||||
];
|
||||
|
||||
public function __construct(
|
||||
private readonly StoreDetailsService $storeDetails,
|
||||
) {}
|
||||
|
||||
/**
|
||||
* Swapped in before the markdown is rendered, so values are escaped: the
|
||||
* rendered markdown is printed unescaped. An empty field renders as
|
||||
* nothing rather than leaving the raw placeholder on the page.
|
||||
*/
|
||||
public function fill(string $content): string
|
||||
{
|
||||
$details = $this->storeDetails->current();
|
||||
|
||||
return strtr($content, array_map(
|
||||
fn (string $column) => e((string) ($details->translate($column) ?? '')),
|
||||
self::PLACEHOLDERS,
|
||||
));
|
||||
}
|
||||
}
|
||||
Executable
+49
@@ -0,0 +1,49 @@
|
||||
#!/usr/bin/env bash
|
||||
# Refuse to commit boboko-core "local mode" wiring (see bin/core-mode).
|
||||
#
|
||||
# Local mode points composer.json / package.json and both lockfiles at
|
||||
# ../boboko-core, which doesn't exist on the server, so committing any of them
|
||||
# breaks the build for everyone. Runs as the git pre-commit hook
|
||||
# (.githooks/pre-commit) and only looks at what is staged: you can keep working
|
||||
# in local mode and commit everything else — just leave these four unstaged.
|
||||
set -euo pipefail
|
||||
|
||||
cd "$(git rev-parse --show-toplevel)"
|
||||
|
||||
staged=$(git diff --cached --name-only --diff-filter=ACMR)
|
||||
is_staged() { printf '%s\n' "$staged" | grep -qx "$1"; }
|
||||
show() { git show ":$1"; }
|
||||
|
||||
problems=()
|
||||
|
||||
# Same detection as bin/core-mode. The leading quote keeps "_repositories"
|
||||
# (the parked block) out of the match.
|
||||
if is_staged composer.json &&
|
||||
show composer.json | sed -n '/"repositories": \[/,/"type"/p' | grep -q '"type": "path"'; then
|
||||
problems+=("composer.json: \"repositories\" is the local path repo")
|
||||
fi
|
||||
if is_staged package.json &&
|
||||
show package.json | sed -n '/"dependencies": {/,/}/p' | grep -q '"@boboko/core": "file:'; then
|
||||
problems+=("package.json: @boboko/core is file:../boboko-core")
|
||||
fi
|
||||
if is_staged composer.lock &&
|
||||
show composer.lock | grep -A14 '"name": "boboko/core"' | grep -q '"type": "path"'; then
|
||||
problems+=("composer.lock: boboko/core is locked to the local path")
|
||||
fi
|
||||
if is_staged package-lock.json &&
|
||||
show package-lock.json | grep -A6 '"node_modules/@boboko/core": {' | grep -q '"link": true'; then
|
||||
problems+=("package-lock.json: @boboko/core is a link to ../boboko-core")
|
||||
fi
|
||||
|
||||
[ ${#problems[@]} -eq 0 ] && exit 0
|
||||
|
||||
{
|
||||
echo "!!! Commit blocked: boboko-core local-mode wiring is staged."
|
||||
printf ' - %s\n' "${problems[@]}"
|
||||
echo
|
||||
echo " Unstage them and keep working in local mode:"
|
||||
echo " git restore --staged composer.json composer.lock package.json package-lock.json"
|
||||
echo " or switch back first:"
|
||||
echo " bin/core-mode repo"
|
||||
} >&2
|
||||
exit 1
|
||||
Executable
+158
@@ -0,0 +1,158 @@
|
||||
#!/usr/bin/env bash
|
||||
# Switch how this app consumes boboko-core, then restart the dev stack so the
|
||||
# entrypoints re-resolve it.
|
||||
#
|
||||
# bin/core-mode local ../boboko-core checkout (Composer path repo + npm file:)
|
||||
# bin/core-mode repo tagged releases from the forge (Composer VCS repo + npm git+semver)
|
||||
# bin/core-mode print the current mode
|
||||
#
|
||||
# Running it for the mode you're already in skips the file edits but still
|
||||
# restarts the stack — that's how repo mode picks up a newly pushed tag.
|
||||
#
|
||||
# The toggle lives in composer.json ("repositories" <-> "_repositories") and
|
||||
# package.json (@boboko/core in "dependencies" <-> "_dependencies"). The dev
|
||||
# entrypoints run `composer update boboko/*` and `npm update @boboko/core` on
|
||||
# every boot, which rewrites composer.lock / package-lock.json for the mode.
|
||||
set -euo pipefail
|
||||
|
||||
cd "$(dirname "$0")/.."
|
||||
|
||||
fail() { echo "!!! $*" >&2; exit 1; }
|
||||
|
||||
# Escape a string for use as a sed regex / replacement with "|" as delimiter.
|
||||
sed_pattern() { printf '%s' "$1" | sed 's/[][\.*^$|]/\\&/g'; }
|
||||
sed_replacement() { printf '%s' "$1" | sed 's/[\&|]/\\&/g'; }
|
||||
|
||||
current_mode() {
|
||||
local composer_type npm_dep composer_mode npm_mode
|
||||
# The live block is "repositories" — the leading quote keeps "_repositories" out.
|
||||
composer_type=$(sed -n '/"repositories": \[/,/"type"/p' composer.json | grep -o '"type": "[a-z]*"' | head -1)
|
||||
npm_dep=$(sed -n '/"dependencies": {/,/}/p' package.json | grep -o '"@boboko/core": "[^"]*"' | head -1)
|
||||
|
||||
case "$composer_type" in
|
||||
*'"path"') composer_mode=local ;;
|
||||
*'"vcs"') composer_mode=repo ;;
|
||||
*) fail "Can't tell the mode from composer.json's \"repositories\" block." ;;
|
||||
esac
|
||||
case "$npm_dep" in
|
||||
*'"file:'*) npm_mode=local ;;
|
||||
*'"git+'*) npm_mode=repo ;;
|
||||
*) fail "Can't tell the mode from package.json's @boboko/core dependency." ;;
|
||||
esac
|
||||
[ "$composer_mode" = "$npm_mode" ] ||
|
||||
fail "composer.json ($composer_mode) and package.json ($npm_mode) disagree — fix by hand first."
|
||||
|
||||
echo "$composer_mode"
|
||||
}
|
||||
|
||||
swap_files() {
|
||||
# composer.json: swap the key names, values stay where they are.
|
||||
sed -i \
|
||||
-e 's/"_repositories":/"__core_mode_swap__":/' \
|
||||
-e 's/"repositories":/"_repositories":/' \
|
||||
-e 's/"__core_mode_swap__":/"repositories":/' \
|
||||
composer.json
|
||||
|
||||
# package.json: swap the two @boboko/core values (live and parked).
|
||||
local a b
|
||||
a=$(grep -o '"@boboko/core": "[^"]*"' package.json | sed -n 1p)
|
||||
b=$(grep -o '"@boboko/core": "[^"]*"' package.json | sed -n 2p)
|
||||
[ -n "$a" ] && [ -n "$b" ] || fail "Expected two @boboko/core entries in package.json."
|
||||
sed -i \
|
||||
-e "s|$(sed_pattern "$a")|__core_mode_swap__|" \
|
||||
-e "s|$(sed_pattern "$b")|$(sed_replacement "$a")|" \
|
||||
-e "s|__core_mode_swap__|$(sed_replacement "$b")|" \
|
||||
package.json
|
||||
}
|
||||
|
||||
wrapper_for() {
|
||||
if [ "$1" = local ]; then echo bin/dc-core.sh; else echo bin/dc; fi
|
||||
}
|
||||
|
||||
# The app healthcheck (php-fpm -t) passes before the entrypoint finishes, so
|
||||
# wait on the entrypoints' own log lines instead: the app's composer block is
|
||||
# done once it clears caches, the vite container's npm block once Vite is up.
|
||||
wait_for_log() {
|
||||
local dc=$1 service=$2 pattern=$3 label=$4 waited=0
|
||||
printf '>>> Waiting for %s' "$label"
|
||||
until $dc logs --no-color "$service" 2>&1 | grep -q "$pattern"; do
|
||||
if [ -z "$($dc ps -q --status running "$service")" ]; then
|
||||
echo
|
||||
$dc logs --no-color --tail 40 "$service"
|
||||
fail "$service stopped before finishing (logs above)."
|
||||
fi
|
||||
if [ "$waited" -ge 600 ]; then
|
||||
echo
|
||||
$dc logs --no-color --tail 40 "$service"
|
||||
fail "Timed out after 600s waiting for $service (logs above)."
|
||||
fi
|
||||
printf '.'
|
||||
sleep 3
|
||||
waited=$((waited + 3))
|
||||
done
|
||||
echo " done"
|
||||
}
|
||||
|
||||
mode=$(current_mode)
|
||||
|
||||
if [ $# -eq 0 ]; then
|
||||
echo "$mode"
|
||||
exit 0
|
||||
fi
|
||||
|
||||
target=$1
|
||||
[ "$target" = local ] || [ "$target" = repo ] || fail "Usage: bin/core-mode [local|repo]"
|
||||
if [ "$target" = local ] && [ ! -d ../boboko-core ]; then
|
||||
fail "../boboko-core not found — local mode needs the core checkout next to this repo."
|
||||
fi
|
||||
|
||||
# Turn on the pre-commit guard (bin/check-core-mode) that stops local-mode
|
||||
# wiring from being committed. Git doesn't version hooks, so it's enabled here,
|
||||
# the first time anyone switches modes. Leaves a custom hooksPath alone.
|
||||
hooks_path=$(git config --get core.hooksPath || true)
|
||||
if [ -z "$hooks_path" ]; then
|
||||
git config core.hooksPath .githooks
|
||||
echo ">>> Enabled the pre-commit guard (git config core.hooksPath .githooks)"
|
||||
elif [ "$hooks_path" != .githooks ]; then
|
||||
echo "!!! core.hooksPath is '$hooks_path', so the pre-commit guard isn't active." >&2
|
||||
echo " Call bin/check-core-mode from your own pre-commit hook." >&2
|
||||
fi
|
||||
|
||||
old_dc=$(wrapper_for "$mode")
|
||||
new_dc=$(wrapper_for "$target")
|
||||
|
||||
echo ">>> Stopping stack ($mode mode)..."
|
||||
$old_dc down
|
||||
|
||||
if [ "$mode" != "$target" ]; then
|
||||
echo ">>> Switching composer.json / package.json: $mode -> $target"
|
||||
swap_files
|
||||
[ "$(current_mode)" = "$target" ] || fail "Switch didn't take — check composer.json / package.json."
|
||||
else
|
||||
echo ">>> Already in $target mode, restarting to re-resolve boboko-core"
|
||||
fi
|
||||
|
||||
# The entrypoints run `composer install` / `npm install` from the lockfiles
|
||||
# BEFORE re-resolving core. Local-mode lockfiles point at ../boboko-core,
|
||||
# which isn't mounted in repo mode, so the install fails. The committed
|
||||
# lockfiles are always repo mode — restore those and let the entrypoints bump
|
||||
# them to the newest tag.
|
||||
if [ "$target" = repo ]; then
|
||||
if grep -A14 '"name": "boboko/core"' composer.lock | grep -q '"type": "path"' ||
|
||||
grep -A6 '"node_modules/@boboko/core": {' package-lock.json | grep -q '"link": true'; then
|
||||
echo ">>> Lockfiles still point at ../boboko-core — restoring the committed ones"
|
||||
git checkout HEAD -- composer.lock package-lock.json
|
||||
fi
|
||||
fi
|
||||
|
||||
echo ">>> Starting stack ($target mode)..."
|
||||
if ! $new_dc up -d; then
|
||||
$new_dc logs --no-color --tail 40 app
|
||||
fail "Stack failed to start (app logs above)."
|
||||
fi
|
||||
|
||||
wait_for_log "$new_dc" app '\[entrypoint\] Caches cleared' "composer to re-resolve boboko/core"
|
||||
wait_for_log "$new_dc" vite 'ready in' "npm to re-resolve @boboko/core"
|
||||
|
||||
version=$(grep -A1 '"name": "boboko/core"' composer.lock | grep -o '"version": "[^"]*"' | cut -d'"' -f4)
|
||||
echo ">>> Now in $target mode — boboko/core $version"
|
||||
Executable
+120
@@ -0,0 +1,120 @@
|
||||
#!/usr/bin/env bash
|
||||
# Deploy this app to production with the latest boboko-core tag.
|
||||
#
|
||||
# 1. Refuses to run with uncommitted work (the server deploys what's pushed,
|
||||
# nothing else) — only the core wiring files are allowed to be dirty.
|
||||
# 2. Pulls translation lines added in the Language Lines UI into core's
|
||||
# seeders (boboko:translations:pull) — in local mode; if any are pulled,
|
||||
# stops so you can release core first. In repo mode it only checks.
|
||||
# 3. Switches to repo mode if you're on the local ../boboko-core checkout,
|
||||
# and restarts the stack either way so the lockfiles pick up the newest
|
||||
# tag (bin/core-mode repo).
|
||||
# 4. Commits the lockfile bump, if any, asks for confirmation, pushes.
|
||||
# 5. Runs `envoy run deploy` (see Envoy.blade.php) against .env.envoy's host.
|
||||
#
|
||||
# Leaves you in repo mode — run `bin/core-mode local` to go back.
|
||||
set -euo pipefail
|
||||
|
||||
cd "$(dirname "$0")/.."
|
||||
|
||||
fail() { echo "!!! $*" >&2; exit 1; }
|
||||
|
||||
[ -f .env.envoy ] || fail ".env.envoy not found — copy .env.envoy.example and fill it in."
|
||||
branch=$(grep -m1 '^DEPLOY_BRANCH=' .env.envoy | cut -d= -f2-)
|
||||
host=$(grep -m1 '^DEPLOY_SSH_HOST=' .env.envoy | cut -d= -f2-)
|
||||
branch=${branch:-master}
|
||||
|
||||
[ "$(git branch --show-current)" = "$branch" ] || fail "You're not on $branch (the branch Envoy deploys)."
|
||||
|
||||
# Anything tracked and modified other than the four core wiring files would be
|
||||
# silently left out of the deploy — make that a hard stop instead.
|
||||
dirty=$(git status --porcelain --untracked-files=no |
|
||||
grep -vE '^.. (composer\.json|composer\.lock|package\.json|package-lock\.json)$' || true)
|
||||
if [ -n "$dirty" ]; then
|
||||
echo "$dirty"
|
||||
fail "Commit or stash these first — the server only deploys what's pushed."
|
||||
fi
|
||||
|
||||
echo ">>> Fetching origin..."
|
||||
git fetch origin "$branch"
|
||||
[ "$(git rev-list --count "HEAD..origin/$branch")" -eq 0 ] || fail "origin/$branch has commits you don't — pull first."
|
||||
|
||||
# Translation lines added through the Language Lines UI only reach other apps
|
||||
# once they're in core's seeders. In local mode, pull them into
|
||||
# ../boboko-core; in repo mode the command can only report them.
|
||||
lines_in() { printf '%s\n' "$1" | sed -n 's/^\([0-9][0-9]*\) line(s).*/\1/p' | tail -1; }
|
||||
|
||||
if [ "$(bin/core-mode)" = local ]; then
|
||||
echo ">>> Pulling UI-added translations into ../boboko-core's seeders..."
|
||||
out=$(bin/dc-core.sh exec -T app php artisan boboko:translations:pull --no-ansi) ||
|
||||
fail "boboko:translations:pull failed — is the stack running (bin/dc-core.sh up -d)?"
|
||||
echo "$out"
|
||||
pulled=$(lines_in "$out")
|
||||
if [ "${pulled:-0}" -gt 0 ]; then
|
||||
fail "Pulled $pulled translation line(s) into ../boboko-core. Review, commit, tag and push core, then rerun bin/deploy."
|
||||
fi
|
||||
else
|
||||
echo ">>> Checking for UI-added translations missing from core's seeders..."
|
||||
if out=$(bin/dc exec -T app php artisan boboko:translations:pull --dry-run --no-ansi 2>&1); then
|
||||
missing=$(lines_in "$out")
|
||||
if [ "${missing:-0}" -gt 0 ]; then
|
||||
echo "$out"
|
||||
fail "These lines are only in this database — run bin/core-mode local and rerun bin/deploy to pull them into core."
|
||||
fi
|
||||
echo " nothing missing"
|
||||
else
|
||||
echo " skipped — the installed boboko/core doesn't have boboko:translations:pull yet"
|
||||
fi
|
||||
fi
|
||||
|
||||
# Switch to repo mode (or just restart if already there) so both lockfiles
|
||||
# resolve the newest boboko-core tag.
|
||||
bin/core-mode repo
|
||||
|
||||
git diff --quiet HEAD -- composer.json package.json ||
|
||||
fail "composer.json / package.json differ from HEAD in repo mode — they should only differ by the local/repo toggle."
|
||||
if grep -A14 '"name": "boboko/core"' composer.lock | grep -q '"type": "path"'; then
|
||||
fail "composer.lock still points boboko/core at the local path repo."
|
||||
fi
|
||||
if grep -A6 '"node_modules/@boboko/core": {' package-lock.json | grep -q '"link": true'; then
|
||||
fail "package-lock.json still links @boboko/core to the local checkout."
|
||||
fi
|
||||
|
||||
version=$(grep -A1 '"name": "boboko/core"' composer.lock | grep -o '"version": "[^"]*"' | cut -d'"' -f4)
|
||||
|
||||
# A tag you created in ../boboko-core but never pushed won't be resolved.
|
||||
if [ -d ../boboko-core ]; then
|
||||
latest=$(git -C ../boboko-core tag --sort=-v:refname | head -1)
|
||||
if [ -n "$latest" ] && [ "$latest" != "v$version" ]; then
|
||||
echo "!!! Warning: resolved boboko/core $version, but ../boboko-core's newest tag is $latest."
|
||||
echo "!!! Did you push it? (git -C ../boboko-core push origin $latest)"
|
||||
fi
|
||||
fi
|
||||
|
||||
if ! git diff --quiet HEAD -- composer.lock package-lock.json; then
|
||||
echo ">>> Committing lockfiles for boboko/core $version..."
|
||||
git add composer.lock package-lock.json
|
||||
git commit -m "Chore: Bumping boboko/core to $version"
|
||||
fi
|
||||
|
||||
echo
|
||||
echo ">>> Deploying $branch to $host with boboko/core $version."
|
||||
pending=$(git log --oneline "origin/$branch..HEAD")
|
||||
if [ -n "$pending" ]; then
|
||||
echo ">>> Commits to push:"
|
||||
echo "$pending"
|
||||
else
|
||||
echo ">>> Nothing new to push — this redeploys origin/$branch as-is."
|
||||
fi
|
||||
echo
|
||||
read -r -p "Push and deploy? [y/N] " answer
|
||||
[ "$answer" = y ] || [ "$answer" = Y ] || fail "Aborted."
|
||||
|
||||
if [ -n "$pending" ]; then
|
||||
git push origin "$branch"
|
||||
fi
|
||||
|
||||
vendor/bin/envoy run deploy
|
||||
|
||||
echo
|
||||
echo ">>> Done. You're in repo mode — run bin/core-mode local to go back to your ../boboko-core checkout."
|
||||
+30
-4
@@ -6,11 +6,28 @@
|
||||
|
||||
return Application::configure(basePath: dirname(__DIR__))
|
||||
->withRouting(
|
||||
web: __DIR__.'/../routes/web.php',
|
||||
commands: __DIR__.'/../routes/console.php',
|
||||
web: __DIR__ . '/../routes/web.php',
|
||||
commands: __DIR__ . '/../routes/console.php',
|
||||
health: '/up',
|
||||
)
|
||||
->withMiddleware(function (Middleware $middleware): void {
|
||||
// Caddy (docker/caddy) only listens on plain HTTP:80, behind the
|
||||
// host's TLS proxy, and passes that proxy's X-Forwarded-* headers on
|
||||
// (trusted_proxies in docker/caddy/global.caddy).
|
||||
// Without trusting the X-Forwarded-Proto header, Laravel sees every
|
||||
// request as http://, so url()/signed-route generation and
|
||||
// verification (URL::hasValidSignature()) both use the wrong
|
||||
// scheme — breaks any signed URL whose recipient hits it over
|
||||
// https (e.g. Modules\Core\Shipping\Http\Controllers\
|
||||
// DownloadShipmentLabelController's label links) with a 401.
|
||||
// '*' trusts whatever's immediately upstream, since that's
|
||||
// container-to-container inside the same deploy, not arbitrary
|
||||
// public traffic.
|
||||
$middleware->trustProxies(at: '*');
|
||||
|
||||
// Global, so error pages and non-`web` routes are covered too.
|
||||
$middleware->append(\App\Http\Middleware\PreventIndexing::class);
|
||||
|
||||
// Laravel's priority list would otherwise run `auth` before core's
|
||||
// `locale` middleware, so the redirects below would build URLs before
|
||||
// URL::defaults(['locale' => …]) is set, throwing a missing-parameter error.
|
||||
@@ -21,8 +38,17 @@
|
||||
|
||||
// Both resolve inside the {locale} group, after the `locale` middleware
|
||||
// has set URL::defaults(['locale' => …]), so route() needs no locale arg.
|
||||
$middleware->redirectGuestsTo(fn () => route('login'));
|
||||
$middleware->redirectUsersTo(fn () => route('home'));
|
||||
$middleware->redirectGuestsTo(fn() => route('login'));
|
||||
$middleware->redirectUsersTo(fn() => route('home'));
|
||||
|
||||
// Core's session registry (Modules\Core\Auth\Services\
|
||||
// UserSessionService) is enforcement-optional by design — see
|
||||
// EnsureSessionNotRevoked's own docblock — and this app never
|
||||
// wired it in. Without this, revokeAllSessions() only flips a DB
|
||||
// flag that nothing checks per-request: a leaked/stolen session
|
||||
// cookie keeps working even after being "revoked". Appended to
|
||||
// `web` (runs after `auth` resolves the user, which it needs).
|
||||
$middleware->appendToGroup('web', \Modules\Core\Auth\Http\Middleware\EnsureSessionNotRevoked::class);
|
||||
})
|
||||
->withExceptions(function (Exceptions $exceptions): void {
|
||||
//
|
||||
|
||||
+4
-4
@@ -12,9 +12,6 @@
|
||||
"artesaos/seotools": "^1.4",
|
||||
"boboko/core": "0.*",
|
||||
"jacobjoergensen/laravel-paper": "^1.12",
|
||||
"open-telemetry/exporter-otlp": "^1.4",
|
||||
"open-telemetry/opentelemetry-auto-laravel": "^1.7",
|
||||
"open-telemetry/sdk": "^1.14",
|
||||
"php-http/guzzle7-adapter": "^1.1",
|
||||
"spatie/laravel-sitemap": "^8.1",
|
||||
"spatie/laravel-webhook-server": "^3.10",
|
||||
@@ -100,5 +97,8 @@
|
||||
}
|
||||
},
|
||||
"minimum-stability": "stable",
|
||||
"prefer-stable": true
|
||||
"prefer-stable": true,
|
||||
"require-dev": {
|
||||
"laravel/envoy": "^2.12"
|
||||
}
|
||||
}
|
||||
Generated
+1160
-1268
File diff suppressed because it is too large.
Load diff
@@ -41,6 +41,19 @@
|
||||
|
||||
'debug' => (bool) env('APP_DEBUG', false),
|
||||
|
||||
/*
|
||||
|--------------------------------------------------------------------------
|
||||
| Search Engine Indexing
|
||||
|--------------------------------------------------------------------------
|
||||
|
|
||||
| Off by default, so every environment (local, staging, ...) sends
|
||||
| `X-Robots-Tag: noindex, nofollow` (App\Http\Middleware\PreventIndexing).
|
||||
| Set APP_INDEXABLE=true on the live site only.
|
||||
|
|
||||
*/
|
||||
|
||||
'indexable' => (bool) env('APP_INDEXABLE', false),
|
||||
|
||||
/*
|
||||
|--------------------------------------------------------------------------
|
||||
| Application URL
|
||||
|
||||
@@ -1,5 +1,6 @@
|
||||
<?php
|
||||
|
||||
use App\Catalog\ProductMediaDefinitions;
|
||||
use Lunar\Base\StandardMediaDefinitions;
|
||||
|
||||
return [
|
||||
@@ -8,7 +9,7 @@
|
||||
'asset' => StandardMediaDefinitions::class,
|
||||
'brand' => StandardMediaDefinitions::class,
|
||||
'collection' => StandardMediaDefinitions::class,
|
||||
'product' => StandardMediaDefinitions::class,
|
||||
'product' => ProductMediaDefinitions::class,
|
||||
'product-option' => StandardMediaDefinitions::class,
|
||||
'product-option-value' => StandardMediaDefinitions::class,
|
||||
],
|
||||
|
||||
@@ -74,7 +74,7 @@
|
||||
// ones that already worked, like collection_ids), not just the
|
||||
// new order_count one. Caught in practice, reverted.
|
||||
Lunar\Models\Product::class => Modules\Core\Catalog\Services\ProductIndexer::class,
|
||||
Lunar\Models\ProductOption::class => Lunar\Search\ProductOptionIndexer::class,
|
||||
Lunar\Models\ProductOption::class => Lunar\Search\ProductOptionIndexer::class
|
||||
],
|
||||
|
||||
];
|
||||
@@ -35,11 +35,6 @@
|
||||
],
|
||||
],
|
||||
|
||||
// Where contact-form messages are sent (ContactController).
|
||||
'contact' => [
|
||||
'email' => env('CONTACT_EMAIL'),
|
||||
],
|
||||
|
||||
// Bot check on guest forms (login, contact), verified by App\Rules\HCaptcha. For
|
||||
// local dev use hCaptcha's test keys, the real ones reject localhost:
|
||||
// sitekey 10000000-ffff-ffff-ffff-000000000001,
|
||||
|
||||
@@ -1,115 +0,0 @@
|
||||
<?php
|
||||
|
||||
namespace Database\Seeders;
|
||||
|
||||
use Illuminate\Database\Seeder;
|
||||
use Modules\Core\Localization\Services\TranslationService;
|
||||
use Spatie\TranslationLoader\LanguageLine;
|
||||
|
||||
/**
|
||||
* Default `validation` translation lines — Laravel's own error-message group
|
||||
* (`validation.required`, `validation.email`, `validation.attributes.*`, …),
|
||||
* resolved by every `Validator::make()`/`$request->validate()` call in the app
|
||||
* (see CheckoutController::saveAddress(), CartController, ProductController),
|
||||
* not just the checkout module.
|
||||
*
|
||||
* Spatie's DB loader (spatie/laravel-translation-loader, wired in boboko-core's
|
||||
* LocalizationServiceProvider) merges this group over Laravel's file-based
|
||||
* validation.php, which the project doesn't ship a `lang/` copy of — so without
|
||||
* this, Greek requests fall back to Laravel's untranslated English defaults.
|
||||
* Only the rule keys and field attributes actually in use are seeded; add more
|
||||
* as new rules/fields show up.
|
||||
*
|
||||
* Additive and idempotent: a key that already exists is left untouched, so
|
||||
* anything edited in the Filament Language Lines UI wins on a re-run. Runs
|
||||
* explicitly — `php artisan db:seed --class=ValidationTranslationsSeeder` — it
|
||||
* is not wired into DatabaseSeeder.
|
||||
*
|
||||
* Greek copy uses the project's informal register (εσύ/σου).
|
||||
*/
|
||||
class ValidationTranslationsSeeder extends Seeder
|
||||
{
|
||||
public function run(): void
|
||||
{
|
||||
$translations = app(TranslationService::class);
|
||||
|
||||
foreach ($this->lines() as $key => [$en, $el]) {
|
||||
$exists = LanguageLine::query()
|
||||
->where('group', 'validation')
|
||||
->where('key', $key)
|
||||
->exists();
|
||||
|
||||
if ($exists) {
|
||||
$this->command?->warn("validation.{$key} already exists — skipped");
|
||||
|
||||
continue;
|
||||
}
|
||||
|
||||
$translations->create('validation', $key, ['en' => $en, 'el' => $el]);
|
||||
$this->command?->info("validation.{$key} added");
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* key => [English, Greek].
|
||||
*
|
||||
* @return array<string, array{0: string, 1: string}>
|
||||
*/
|
||||
private function lines(): array
|
||||
{
|
||||
return [
|
||||
// ── Rule messages ─────────────────────────────────────────────
|
||||
'required' => ['The :attribute field is required.', 'Το πεδίο :attribute είναι υποχρεωτικό.'],
|
||||
'email' => ['The :attribute field must be a valid email address.', 'Το πεδίο :attribute πρέπει να είναι έγκυρη διεύθυνση email.'],
|
||||
'string' => ['The :attribute field must be a string.', 'Το πεδίο :attribute πρέπει να είναι κείμενο.'],
|
||||
'integer' => ['The :attribute field must be an integer.', 'Το πεδίο :attribute πρέπει να είναι ακέραιος αριθμός.'],
|
||||
'boolean' => ['The :attribute field must be true or false.', 'Το πεδίο :attribute πρέπει να είναι true ή false.'],
|
||||
'min.numeric' => ['The :attribute field must be at least :min.', 'Το πεδίο :attribute πρέπει να είναι τουλάχιστον :min.'],
|
||||
'max.string' => ['The :attribute field must not be greater than :max characters.', 'Το πεδίο :attribute δεν πρέπει να ξεπερνά τους :max χαρακτήρες.'],
|
||||
'between.numeric' => ['The :attribute field must be between :min and :max.', 'Το πεδίο :attribute πρέπει να είναι μεταξύ :min και :max.'],
|
||||
'exists' => ['The selected :attribute is invalid.', 'Η επιλεγμένη τιμή για το πεδίο :attribute δεν είναι έγκυρη.'],
|
||||
// Product custom-field photo uploads (CustomFieldUploadController, CartController).
|
||||
'file' => ['The :attribute field must be a file.', 'Το πεδίο :attribute πρέπει να είναι αρχείο.'],
|
||||
'mimes' => ['The :attribute field must be a file of type: :values.', 'Το πεδίο :attribute πρέπει να είναι αρχείο τύπου: :values.'],
|
||||
'max.file' => ['The :attribute field must not be greater than :max kilobytes.', 'Το αρχείο στο πεδίο :attribute δεν πρέπει να ξεπερνά τα :max kilobytes.'],
|
||||
'uploaded' => ['The :attribute failed to upload.', 'Η μεταφόρτωση στο πεδίο :attribute απέτυχε.'],
|
||||
|
||||
// ── Field names (checkout: billing/shipping address) ──────────
|
||||
'attributes.contact_email' => ['email', 'email'],
|
||||
'attributes.billing_first_name' => ['first name', 'όνομα'],
|
||||
'attributes.billing_last_name' => ['last name', 'επώνυμο'],
|
||||
'attributes.billing_company_name' => ['company name', 'επωνυμία εταιρείας'],
|
||||
'attributes.billing_tax_identifier' => ['tax ID', 'ΑΦΜ'],
|
||||
'attributes.billing_line_one' => ['address', 'διεύθυνση'],
|
||||
'attributes.billing_line_two' => ['address line 2', 'διεύθυνση (γραμμή 2)'],
|
||||
'attributes.billing_city' => ['city', 'πόλη'],
|
||||
'attributes.billing_state' => ['region', 'νομό / περιοχή'],
|
||||
'attributes.billing_postcode' => ['postcode', 'ταχυδρομικό κώδικα'],
|
||||
'attributes.billing_country_id' => ['country', 'χώρα'],
|
||||
'attributes.billing_contact_phone' => ['phone', 'τηλέφωνο'],
|
||||
'attributes.shipping_first_name' => ['first name', 'όνομα'],
|
||||
'attributes.shipping_last_name' => ['last name', 'επώνυμο'],
|
||||
'attributes.shipping_company_name' => ['company name', 'επωνυμία εταιρείας'],
|
||||
'attributes.shipping_line_one' => ['address', 'διεύθυνση'],
|
||||
'attributes.shipping_line_two' => ['address line 2', 'διεύθυνση (γραμμή 2)'],
|
||||
'attributes.shipping_city' => ['city', 'πόλη'],
|
||||
'attributes.shipping_state' => ['region', 'νομό / περιοχή'],
|
||||
'attributes.shipping_postcode' => ['postcode', 'ταχυδρομικό κώδικα'],
|
||||
'attributes.shipping_country_id' => ['country', 'χώρα'],
|
||||
'attributes.shipping_contact_phone' => ['phone', 'τηλέφωνο'],
|
||||
'attributes.shipping_delivery_instructions' => ['delivery notes', 'σχόλια για την παράδοση'],
|
||||
|
||||
// ── Field names (cart) ─────────────────────────────────────────
|
||||
'attributes.purchasable_id' => ['product', 'προϊόν'],
|
||||
'attributes.quantity' => ['quantity', 'ποσότητα'],
|
||||
'attributes.code' => ['coupon code', 'κωδικό κουπονιού'],
|
||||
|
||||
// ── Field names (product reviews / stock check) ────────────────
|
||||
'attributes.variant' => ['variant', 'παραλλαγή'],
|
||||
'attributes.rating' => ['rating', 'βαθμολογία'],
|
||||
'attributes.content' => ['review text', 'κείμενο κριτικής'],
|
||||
'attributes.name' => ['name', 'όνομα'],
|
||||
'attributes.email' => ['email', 'email'],
|
||||
];
|
||||
}
|
||||
}
|
||||
@@ -31,12 +31,16 @@ services:
|
||||
valkey:
|
||||
condition: service_started
|
||||
|
||||
nginx:
|
||||
image: nginx:alpine
|
||||
caddy:
|
||||
build:
|
||||
context: .
|
||||
target: caddy-base
|
||||
image: boboko-caddy
|
||||
command: caddy run --config /etc/caddy/Caddyfile.dev --adapter caddyfile
|
||||
ports:
|
||||
- "${APP_PORT:-8080}:80"
|
||||
volumes:
|
||||
- ./docker/nginx/default.conf:/etc/nginx/conf.d/default.conf:ro
|
||||
- ./docker/caddy:/etc/caddy:ro
|
||||
- ./public:/var/www/html/public:ro
|
||||
- ./storage/app/public:/var/www/html/storage/app/public:ro
|
||||
depends_on:
|
||||
|
||||
+32
-10
@@ -32,10 +32,12 @@ services:
|
||||
retries: 20
|
||||
start_period: 60s
|
||||
|
||||
nginx:
|
||||
# Caddy (docker/caddy/Caddyfile), plain HTTP on 127.0.0.1 behind the
|
||||
# host's TLS proxy, same port nginx used.
|
||||
caddy:
|
||||
build:
|
||||
context: .
|
||||
target: nginx
|
||||
target: caddy
|
||||
restart: unless-stopped
|
||||
ports:
|
||||
- "127.0.0.1:${APP_PORT:-8090}:80"
|
||||
@@ -47,6 +49,7 @@ services:
|
||||
|
||||
queue:
|
||||
image: ${COMPOSE_PROJECT_NAME:-boboko-starter}-app
|
||||
entrypoint: ["/entrypoint-worker.sh"]
|
||||
command: php artisan queue:work --tries=3 --max-jobs=500 --memory=256
|
||||
restart: unless-stopped
|
||||
env_file: .env
|
||||
@@ -68,6 +71,7 @@ services:
|
||||
|
||||
scheduler:
|
||||
image: ${COMPOSE_PROJECT_NAME:-boboko-starter}-app
|
||||
entrypoint: ["/entrypoint-worker.sh"]
|
||||
command: php artisan schedule:work
|
||||
restart: unless-stopped
|
||||
env_file: .env
|
||||
@@ -129,16 +133,15 @@ services:
|
||||
timeout: 5s
|
||||
retries: 10
|
||||
|
||||
otel-collector:
|
||||
image: otel/opentelemetry-collector-contrib:latest
|
||||
restart: unless-stopped
|
||||
environment:
|
||||
SIGNOZ_ENDPOINT: ${OTEL_EXPORTER_OTLP_ENDPOINT}
|
||||
volumes:
|
||||
- ./docker/otel/collector.yml:/etc/otelcol-contrib/config.yaml:ro
|
||||
|
||||
stoic:
|
||||
image: ghcr.io/lexx27/stoic:latest
|
||||
# Runs as root — the app container's entrypoint.sh chowns the whole
|
||||
# storage/ tree to www-data on every boot (docker/entrypoint.sh),
|
||||
# and Stoic's own image user isn't www-data or in its group, so it
|
||||
# can't write thumbnails into storage/app/public/stoic/ otherwise
|
||||
# (libvips reports this as "Failed to write VipsImage to file").
|
||||
# Same fix already applied in docker-compose.dev.yml.
|
||||
user: root
|
||||
ports:
|
||||
- "127.0.0.1:${STOIC_PORT:-2727}:2727"
|
||||
environment:
|
||||
@@ -153,6 +156,24 @@ services:
|
||||
- storage:/var/www/html/storage/app
|
||||
restart: unless-stopped
|
||||
|
||||
vector:
|
||||
image: timberio/vector:latest-alpine
|
||||
restart: unless-stopped
|
||||
environment:
|
||||
APP_ENV: ${APP_ENV:-production}
|
||||
VICTORIALOGS_ENDPOINT: ${VICTORIALOGS_ENDPOINT:?VICTORIALOGS_ENDPOINT is required}
|
||||
VICTORIALOGS_USER: ${VICTORIALOGS_USER:?VICTORIALOGS_USER is required}
|
||||
VICTORIALOGS_PASSWORD: ${VICTORIALOGS_PASSWORD:?VICTORIALOGS_PASSWORD is required}
|
||||
VECTOR_DANGEROUSLY_ALLOW_ENV_VAR_INTERPOLATION: "true"
|
||||
volumes:
|
||||
- ./docker/vector/vector.yaml:/etc/vector/vector.yaml:ro
|
||||
- logs:/var/www/html/storage/logs:ro
|
||||
- vector_data:/var/lib/vector
|
||||
depends_on:
|
||||
app:
|
||||
condition: service_healthy
|
||||
|
||||
|
||||
volumes:
|
||||
pgdata:
|
||||
storage:
|
||||
@@ -160,3 +181,4 @@ volumes:
|
||||
framework:
|
||||
valkeydata:
|
||||
meilidata:
|
||||
vector_data:
|
||||
@@ -0,0 +1,44 @@
|
||||
# Production. public/ is baked into the image (Dockerfile, target caddy);
|
||||
# storage/app is the shared `storage` volume, read-only.
|
||||
# No page cache here: nginx's FastCGI cache is dropped on purpose, the
|
||||
# static page cache comes later (P2).
|
||||
{
|
||||
import global.caddy
|
||||
}
|
||||
|
||||
import common.caddy
|
||||
|
||||
:80 {
|
||||
import site
|
||||
|
||||
route {
|
||||
import deny_dotfiles
|
||||
import stoic
|
||||
|
||||
# Content-hashed or versioned files: cache forever.
|
||||
@immutable path /build/* /static/* /packages/*
|
||||
handle @immutable {
|
||||
header Cache-Control "public, max-age=31536000, immutable"
|
||||
file_server
|
||||
}
|
||||
|
||||
# User media, straight from the storage volume (no symlink needed).
|
||||
handle_path /storage/* {
|
||||
root * /var/www/html/storage/app/public
|
||||
header Cache-Control "public, max-age=31536000, immutable"
|
||||
file_server
|
||||
}
|
||||
|
||||
# Generated by the app into storage/app.
|
||||
handle /sitemap.xml {
|
||||
root * /var/www/html/storage/app
|
||||
header Cache-Control "public, max-age=3600"
|
||||
header Content-Type "application/xml; charset=utf-8"
|
||||
file_server
|
||||
}
|
||||
|
||||
import laravel
|
||||
}
|
||||
|
||||
import static_404
|
||||
}
|
||||
@@ -0,0 +1,19 @@
|
||||
# Development. public/ and storage/app/public are bind-mounted
|
||||
# (docker-compose.dev.yml); /storage/ goes through the public/storage symlink.
|
||||
# No long cache headers in dev. Vite is reached directly on its own port
|
||||
# (public/hot), not through Caddy.
|
||||
{
|
||||
import global.caddy
|
||||
}
|
||||
|
||||
import common.caddy
|
||||
|
||||
:80 {
|
||||
import site
|
||||
|
||||
route {
|
||||
import deny_dotfiles
|
||||
import stoic
|
||||
import laravel
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,76 @@
|
||||
# Snippets shared by Caddyfile (prod) and Caddyfile.dev, imported right after
|
||||
# their global options block (global.caddy).
|
||||
|
||||
# Site-level settings shared by both environments.
|
||||
(site) {
|
||||
root * /var/www/html/public
|
||||
|
||||
# New with Caddy: nginx compressed nothing. Caddy only compresses text
|
||||
# types (HTML, CSS, JS, JSON, SVG…), never images or fonts.
|
||||
encode zstd gzip
|
||||
|
||||
# Same upload limit as nginx's client_max_body_size (and php.ini).
|
||||
request_body {
|
||||
max_size 100MiB
|
||||
}
|
||||
|
||||
# On every response. nginx only added these to static files and 2xx/3xx
|
||||
# (prod's PHP location dropped them).
|
||||
header {
|
||||
X-Frame-Options "SAMEORIGIN"
|
||||
X-Content-Type-Options "nosniff"
|
||||
# Caddy's proxy adds Via; nginx sent none. A deletion is applied as
|
||||
# the response goes out, so it also catches headers set later.
|
||||
-Via
|
||||
}
|
||||
|
||||
# Access log to stdout, as nginx did; favicon/robots skipped like nginx.
|
||||
log
|
||||
@quiet path /favicon.ico /robots.txt
|
||||
log_skip @quiet
|
||||
}
|
||||
|
||||
# Dotfiles (.env, .git…) are never served; /.well-known/ is allowed.
|
||||
# Use inside a route block, first.
|
||||
(deny_dotfiles) {
|
||||
@dotfiles {
|
||||
path */.*
|
||||
not path /.well-known/*
|
||||
}
|
||||
respond @dotfiles 403
|
||||
}
|
||||
|
||||
# Stoic (the headless CMS) under /stoic/, prefix stripped, cookies scoped to
|
||||
# /stoic/ (nginx: proxy_cookie_path / /stoic/).
|
||||
(stoic) {
|
||||
handle_path /stoic/* {
|
||||
reverse_proxy stoic:2727 {
|
||||
header_up X-Real-IP {client_ip}
|
||||
header_down Set-Cookie "(?i)(;\s*path=)/" "$1/stoic/"
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
# Laravel. php_fastcgi does the try_files (file, dir/index.php, index.php);
|
||||
# file_server serves the files that exist in public/.
|
||||
(laravel) {
|
||||
php_fastcgi app:9000 {
|
||||
read_timeout 300s
|
||||
# PHP-FPM's CGI status line; nginx didn't pass it on either.
|
||||
header_down -Status
|
||||
}
|
||||
file_server
|
||||
}
|
||||
|
||||
# A missing file under one of prod's static paths (/build/, /storage/…): a
|
||||
# plain 404, without the Cache-Control/Content-Type that path's handle already
|
||||
# set.
|
||||
# (nginx sent these to Laravel via `error_page 404 /index.php`, kept the 404
|
||||
# status and showed Laravel's page; nobody sees that page for an asset.)
|
||||
(static_404) {
|
||||
handle_errors 404 {
|
||||
header -Cache-Control
|
||||
header Content-Type "text/plain; charset=utf-8"
|
||||
respond "Not Found" 404
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,16 @@
|
||||
# Global options shared by Caddyfile (prod) and Caddyfile.dev, imported inside
|
||||
# their global options block.
|
||||
|
||||
# TLS ends in front of this container (a proxy on the host talks to it on
|
||||
# 127.0.0.1:8090), so Caddy serves plain HTTP and never tries to get
|
||||
# certificates. Revisit once it's settled where TLS should end.
|
||||
auto_https off
|
||||
|
||||
servers {
|
||||
# Keep the X-Forwarded-For/-Proto/-Host the host proxy sends: it
|
||||
# reaches the container from a private (docker) address. Without this
|
||||
# Caddy replaces them with its own, so Laravel (trustProxies '*')
|
||||
# would see every request as plain http. Narrow this to the proxy's
|
||||
# actual address once it's known.
|
||||
trusted_proxies static private_ranges
|
||||
}
|
||||
+23
-12
@@ -41,19 +41,17 @@ echo "[entrypoint] Caches cleared"
|
||||
|
||||
php artisan storage:link --quiet 2>/dev/null || true
|
||||
|
||||
if [ "$APP_ENV" != "production" ]; then
|
||||
# Dev-only for the same reason as the composer step above — production's
|
||||
# image already has these published at build time.
|
||||
php artisan vendor:publish --tag=core-assets --force --ansi --quiet
|
||||
php artisan vendor:publish --tag=public --force --ansi --quiet
|
||||
php artisan filament:assets --ansi --quiet
|
||||
# Dev-only for the same reason as the composer step above — production's
|
||||
# image already has these published at build time.
|
||||
php artisan vendor:publish --tag=core-assets --force --ansi --quiet
|
||||
php artisan vendor:publish --tag=public --force --ansi --quiet
|
||||
php artisan filament:assets --ansi --quiet
|
||||
|
||||
# No --force: core-views publishes editable Blade templates (order
|
||||
# notification emails), meant to be hand-customized per app — unlike
|
||||
# core-assets above, republishing must not silently wipe local edits.
|
||||
# Only fills in the vendor/core views directory if it doesn't exist yet.
|
||||
php artisan vendor:publish --tag=core-views --ansi --quiet
|
||||
fi
|
||||
# No --force: core-views publishes editable Blade templates (order
|
||||
# notification emails), meant to be hand-customized per app — unlike
|
||||
# core-assets above, republishing must not silently wipe local edits.
|
||||
# Only fills in the vendor/core views directory if it doesn't exist yet.
|
||||
php artisan vendor:publish --tag=core-views --ansi --quiet
|
||||
|
||||
# Everything below is universal, in both dev and production: application STATE
|
||||
# that must be current on every boot, not a build-time concern composer/assets
|
||||
@@ -79,6 +77,19 @@ echo "[entrypoint] Touched migrated file"
|
||||
echo "[entrypoint] Trying Lunar install"
|
||||
php artisan lunar:install --quiet || true
|
||||
|
||||
# Same idempotent per-key upsert as lunar:install's own seeding above, just kept
|
||||
# as separate seeder classes rather than folded into InstallLunarCommand — these
|
||||
# are Spatie translation-loader `validation`/`checkout` groups, not Lunar store
|
||||
# data, and each is safe to re-run on every boot.
|
||||
echo "[entrypoint] Seeding validation translations..."
|
||||
php artisan db:seed --class="Modules\Core\Localization\Database\Seeders\ValidationTranslationsSeeder" --force --quiet || true
|
||||
|
||||
echo "[entrypoint] Seeding checkout translations..."
|
||||
php artisan db:seed --class="Modules\Core\Checkout\Database\Seeders\CheckoutTranslationsSeeder" --force --quiet || true
|
||||
|
||||
echo "[entrypoint] Seeding storefront translations..."
|
||||
php artisan db:seed --class="Modules\Core\Localization\Database\Seeders\StorefrontTranslationsSeeder" --force --quiet || true
|
||||
|
||||
# Upserts by primary key (no --refresh), so this stays cheap and idempotent on
|
||||
# every boot rather than flushing and rebuilding the whole index each time. Runs
|
||||
# in production too — a deploy that changed an indexer's field list needs this
|
||||
|
||||
@@ -1,48 +0,0 @@
|
||||
server {
|
||||
listen 80;
|
||||
server_name _;
|
||||
root /var/www/html/public;
|
||||
index index.php;
|
||||
|
||||
client_max_body_size 100M;
|
||||
|
||||
add_header X-Frame-Options "SAMEORIGIN";
|
||||
add_header X-Content-Type-Options "nosniff";
|
||||
|
||||
charset utf-8;
|
||||
|
||||
location / {
|
||||
try_files $uri $uri/ /index.php?$query_string;
|
||||
}
|
||||
|
||||
location ~ \.php$ {
|
||||
resolver 127.0.0.11 valid=5s;
|
||||
set $upstream app:9000;
|
||||
fastcgi_pass $upstream;
|
||||
fastcgi_index index.php;
|
||||
include fastcgi_params;
|
||||
fastcgi_param SCRIPT_FILENAME $realpath_root$fastcgi_script_name;
|
||||
fastcgi_param DOCUMENT_ROOT $realpath_root;
|
||||
fastcgi_read_timeout 300;
|
||||
fastcgi_buffers 16 16k;
|
||||
fastcgi_buffer_size 32k;
|
||||
}
|
||||
|
||||
location /stoic/ {
|
||||
proxy_pass http://stoic:2727/;
|
||||
proxy_set_header Host $host;
|
||||
proxy_set_header X-Real-IP $remote_addr;
|
||||
proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
|
||||
proxy_set_header X-Forwarded-Proto $scheme;
|
||||
proxy_cookie_path / /stoic/;
|
||||
}
|
||||
|
||||
location ~ /\.(?!well-known).* {
|
||||
deny all;
|
||||
}
|
||||
|
||||
location = /favicon.ico { access_log off; log_not_found off; }
|
||||
location = /robots.txt { access_log off; log_not_found off; }
|
||||
|
||||
error_page 404 /index.php;
|
||||
}
|
||||
@@ -1,110 +0,0 @@
|
||||
fastcgi_cache_path /tmp/fcgi_cache levels=1:2 keys_zone=app_cache:10m max_size=256m inactive=10m use_temp_path=off;
|
||||
|
||||
upstream php_fpm {
|
||||
server app:9000;
|
||||
keepalive 16;
|
||||
}
|
||||
|
||||
server {
|
||||
listen 80;
|
||||
server_name _;
|
||||
root /var/www/html/public;
|
||||
index index.php;
|
||||
|
||||
client_max_body_size 100M;
|
||||
charset utf-8;
|
||||
|
||||
open_file_cache max=5000 inactive=30s;
|
||||
open_file_cache_valid 60s;
|
||||
open_file_cache_min_uses 2;
|
||||
open_file_cache_errors on;
|
||||
|
||||
# --- FastCGI cache bypass rules ---
|
||||
set $skip_cache 0;
|
||||
|
||||
if ($request_method = POST) { set $skip_cache 1; }
|
||||
if ($request_uri ~* "^/(boboko|up)") { set $skip_cache 1; }
|
||||
if ($query_string) { set $skip_cache 1; }
|
||||
|
||||
# Vite build assets — content-hashed filenames, safe to cache forever
|
||||
location /build/ {
|
||||
add_header Cache-Control "public, max-age=31536000, immutable";
|
||||
add_header X-Frame-Options "SAMEORIGIN";
|
||||
add_header X-Content-Type-Options "nosniff";
|
||||
try_files $uri =404;
|
||||
}
|
||||
|
||||
location /static/ {
|
||||
add_header Cache-Control "public, max-age=31536000, immutable";
|
||||
add_header X-Frame-Options "SAMEORIGIN";
|
||||
add_header X-Content-Type-Options "nosniff";
|
||||
try_files $uri =404;
|
||||
}
|
||||
|
||||
location /packages/ {
|
||||
add_header Cache-Control "public, max-age=31536000, immutable";
|
||||
add_header X-Frame-Options "SAMEORIGIN";
|
||||
add_header X-Content-Type-Options "nosniff";
|
||||
try_files $uri =404;
|
||||
}
|
||||
|
||||
# User media — served directly from the storage volume (no symlink needed)
|
||||
location /storage/ {
|
||||
alias /var/www/html/storage/app/public/;
|
||||
add_header Cache-Control "public, max-age=31536000, immutable";
|
||||
add_header X-Frame-Options "SAMEORIGIN";
|
||||
add_header X-Content-Type-Options "nosniff";
|
||||
try_files $uri =404;
|
||||
}
|
||||
|
||||
location / {
|
||||
add_header X-Frame-Options "SAMEORIGIN";
|
||||
add_header X-Content-Type-Options "nosniff";
|
||||
try_files $uri $uri/ /index.php?$query_string;
|
||||
}
|
||||
|
||||
location ~ \.php$ {
|
||||
fastcgi_pass php_fpm;
|
||||
fastcgi_index index.php;
|
||||
include fastcgi_params;
|
||||
fastcgi_param SCRIPT_FILENAME $realpath_root$fastcgi_script_name;
|
||||
fastcgi_param DOCUMENT_ROOT $realpath_root;
|
||||
fastcgi_read_timeout 300;
|
||||
fastcgi_buffers 16 16k;
|
||||
fastcgi_buffer_size 32k;
|
||||
fastcgi_keep_conn on;
|
||||
|
||||
fastcgi_cache app_cache;
|
||||
fastcgi_cache_key "$scheme$request_method$host$request_uri";
|
||||
fastcgi_cache_valid 200 10m;
|
||||
fastcgi_cache_bypass $skip_cache;
|
||||
fastcgi_no_cache $skip_cache;
|
||||
fastcgi_ignore_headers Cache-Control Expires Set-Cookie;
|
||||
add_header X-Cache-Status $upstream_cache_status;
|
||||
}
|
||||
|
||||
location /stoic/ {
|
||||
proxy_pass http://stoic:2727/;
|
||||
proxy_set_header Host $host;
|
||||
proxy_set_header X-Real-IP $remote_addr;
|
||||
proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
|
||||
proxy_set_header X-Forwarded-Proto $scheme;
|
||||
proxy_cookie_path / /stoic/;
|
||||
}
|
||||
|
||||
location ~ /\.(?!well-known).* {
|
||||
deny all;
|
||||
}
|
||||
|
||||
location = /sitemap.xml {
|
||||
root /var/www/html/storage/app;
|
||||
try_files /sitemap.xml =404;
|
||||
add_header Cache-Control "public, max-age=3600";
|
||||
add_header Content-Type "application/xml; charset=utf-8";
|
||||
}
|
||||
|
||||
location = /favicon.ico { access_log off; log_not_found off; }
|
||||
location = /robots.txt { access_log off; log_not_found off; }
|
||||
|
||||
error_page 404 /index.php;
|
||||
}
|
||||
@@ -1,30 +0,0 @@
|
||||
receivers:
|
||||
otlp:
|
||||
protocols:
|
||||
http:
|
||||
endpoint: 0.0.0.0:4318
|
||||
|
||||
processors:
|
||||
batch:
|
||||
timeout: 5s
|
||||
send_batch_size: 512
|
||||
|
||||
exporters:
|
||||
otlphttp:
|
||||
endpoint: ${env:SIGNOZ_ENDPOINT}
|
||||
compression: gzip
|
||||
|
||||
service:
|
||||
pipelines:
|
||||
traces:
|
||||
receivers: [otlp]
|
||||
processors: [batch]
|
||||
exporters: [otlphttp]
|
||||
metrics:
|
||||
receivers: [otlp]
|
||||
processors: [batch]
|
||||
exporters: [otlphttp]
|
||||
logs:
|
||||
receivers: [otlp]
|
||||
processors: [batch]
|
||||
exporters: [otlphttp]
|
||||
@@ -9,6 +9,14 @@ content_path: /content
|
||||
media_path: /media
|
||||
thumbs_path: /var/www/html/storage/app/public/stoic/
|
||||
repository_path: /app
|
||||
# First locale is Stoic's default: it holds every field, the others only the
|
||||
# translatable ones (content/{locale}/...). Codes match app.available_locales.
|
||||
i18n:
|
||||
locales:
|
||||
- code: el
|
||||
label: Ελληνικά
|
||||
- code: en
|
||||
label: English
|
||||
presets:
|
||||
- code: large
|
||||
mode: resize
|
||||
|
||||
@@ -0,0 +1,41 @@
|
||||
sources:
|
||||
laravel_logs:
|
||||
type: file
|
||||
include:
|
||||
- /var/www/html/storage/logs/laravel.log
|
||||
read_from: beginning
|
||||
|
||||
transforms:
|
||||
laravel_json:
|
||||
type: remap
|
||||
inputs:
|
||||
- laravel_logs
|
||||
source: |
|
||||
. = parse_json!(.message)
|
||||
.service = "boboko-app"
|
||||
.env = "${APP_ENV}"
|
||||
|
||||
sinks:
|
||||
victorialogs:
|
||||
type: http
|
||||
inputs:
|
||||
- laravel_json
|
||||
uri: "${VICTORIALOGS_ENDPOINT}/insert/jsonline?_stream_fields=service,env,channel,level_name&_msg_field=message&_time_field=datetime"
|
||||
encoding:
|
||||
codec: json
|
||||
framing:
|
||||
method: newline_delimited
|
||||
compression: gzip
|
||||
auth:
|
||||
strategy: basic
|
||||
user: "${VICTORIALOGS_USER}"
|
||||
password: "${VICTORIALOGS_PASSWORD}"
|
||||
batch:
|
||||
max_bytes: 1048576
|
||||
timeout_secs: 5
|
||||
buffer:
|
||||
type: disk
|
||||
max_size: 268435488
|
||||
when_full: block
|
||||
healthcheck:
|
||||
enabled: false
|
||||
@@ -0,0 +1,18 @@
|
||||
<?php
|
||||
|
||||
/**
|
||||
* lunarphp/table-rate-shipping v1.5.0 ships no Greek translations for this
|
||||
* namespace at all (only 'en' and a handful of other locales — no 'el'
|
||||
* directory exists in the package), so this override is the only source
|
||||
* for these keys in Greek, not a merge over an existing package file.
|
||||
* ManageShippingRates.php:58 calls the 'prices_inc_tax' key specifically
|
||||
* (missing the 'l' the package's own English file uses — see the 'en'
|
||||
* override's docblock), so that's the one included here.
|
||||
*/
|
||||
return [
|
||||
'shipping_rates' => [
|
||||
'notices' => [
|
||||
'prices_inc_tax' => 'Όλες οι τιμές περιλαμβάνουν ΦΠΑ, το οποίο θα ληφθεί υπόψη στον υπολογισμό της ελάχιστης αξίας παραγγελίας.',
|
||||
],
|
||||
],
|
||||
];
|
||||
@@ -0,0 +1,19 @@
|
||||
<?php
|
||||
|
||||
/**
|
||||
* Override for lunarphp/table-rate-shipping v1.5.0's own relationmanagers.php
|
||||
* (vendor/lunarphp/table-rate-shipping/resources/lang/en/relationmanagers.php)
|
||||
* — that file defines 'prices_incl_tax', but ManageShippingRates.php:58 calls
|
||||
* __('lunarpanel.shipping::relationmanagers.shipping_rates.notices.prices_inc_tax')
|
||||
* (missing the 'l'), so the key is genuinely never found. Merged over the
|
||||
* package's own file (array_replace_recursive, see Illuminate\Translation\
|
||||
* FileLoader::loadNamespaceOverrides()), so only the broken key needs
|
||||
* restating here — everything else in that file still applies.
|
||||
*/
|
||||
return [
|
||||
'shipping_rates' => [
|
||||
'notices' => [
|
||||
'prices_inc_tax' => 'All prices include tax, which will be considered when calculating minimum spend.',
|
||||
],
|
||||
],
|
||||
];
|
||||
Generated
+14
-47
@@ -5,6 +5,7 @@
|
||||
"packages": {
|
||||
"": {
|
||||
"dependencies": {
|
||||
"@boboko/core": "git+https://code.radical-elements.com/boboko/core.git#semver:0.x",
|
||||
"@hotwired/stimulus": "^3.2.2",
|
||||
"@hotwired/turbo": "^8.0.23",
|
||||
"axios": "^1.15.2",
|
||||
@@ -18,11 +19,21 @@
|
||||
"vite": "^8.0.0"
|
||||
}
|
||||
},
|
||||
"node_modules/@boboko/core": {
|
||||
"version": "0.31.4",
|
||||
"resolved": "git+https://code.radical-elements.com/boboko/core.git#5cce0e95d7b4c86d11ec0aaf3fa515f6e01e65bc",
|
||||
"dependencies": {
|
||||
"@hotwired/stimulus": "^3.2.2",
|
||||
"leaflet": "^1.9.4"
|
||||
},
|
||||
"peerDependencies": {
|
||||
"vite": "^8.0.0"
|
||||
}
|
||||
},
|
||||
"node_modules/@emnapi/core": {
|
||||
"version": "1.11.1",
|
||||
"resolved": "https://registry.npmjs.org/@emnapi/core/-/core-1.11.1.tgz",
|
||||
"integrity": "sha512-RSvbQmHzdKzNsLYa/wHrbc3KN4sYLKAdPZxqiM2HATqv/SBk2/ENSHpvXGaLOMcsAyz0poEGqkmmKYG3OWiJEQ==",
|
||||
"dev": true,
|
||||
"license": "MIT",
|
||||
"optional": true,
|
||||
"dependencies": {
|
||||
@@ -34,7 +45,6 @@
|
||||
"version": "1.11.1",
|
||||
"resolved": "https://registry.npmjs.org/@emnapi/runtime/-/runtime-1.11.1.tgz",
|
||||
"integrity": "sha512-vgj7R3y3Wgx24IQaGPA/R6YFXLHVMOZ0uVEyIQPaWs+rd1AzfEMXlAC22FYwO1XkKR6NPsq7mUandH8oIRdZFw==",
|
||||
"dev": true,
|
||||
"license": "MIT",
|
||||
"optional": true,
|
||||
"dependencies": {
|
||||
@@ -45,7 +55,6 @@
|
||||
"version": "1.2.2",
|
||||
"resolved": "https://registry.npmjs.org/@emnapi/wasi-threads/-/wasi-threads-1.2.2.tgz",
|
||||
"integrity": "sha512-c95qOXkHdydNKhscBTebqEC1CVAZpyqOfVfBzQ1qgzyl3gfeldUjIggDbIZgDKsHLgnsM+igH7TJ/eAasaVuMA==",
|
||||
"dev": true,
|
||||
"license": "MIT",
|
||||
"optional": true,
|
||||
"dependencies": {
|
||||
@@ -121,7 +130,6 @@
|
||||
"version": "1.1.6",
|
||||
"resolved": "https://registry.npmjs.org/@napi-rs/wasm-runtime/-/wasm-runtime-1.1.6.tgz",
|
||||
"integrity": "sha512-ZLv/JdUfkvOy9eCnnBaGfiO+XimbjebAeO+MRQqD/B+FR1tnRN0tpKSJHRbE8sFfS6aqsXZ67TQjfwfsxULVbg==",
|
||||
"dev": true,
|
||||
"license": "MIT",
|
||||
"optional": true,
|
||||
"dependencies": {
|
||||
@@ -140,7 +148,6 @@
|
||||
"version": "0.138.0",
|
||||
"resolved": "https://registry.npmjs.org/@oxc-project/types/-/types-0.138.0.tgz",
|
||||
"integrity": "sha512-1a7ZKmrRTCoN1XMZ4L0PyyqrMnrNlLyPuOkdSX2MZg7IiIGRUyurNhAm73ptDOraoBcIordsIGKNPKUzy3ZmfA==",
|
||||
"dev": true,
|
||||
"license": "MIT",
|
||||
"funding": {
|
||||
"url": "https://github.com/sponsors/Boshen"
|
||||
@@ -153,7 +160,6 @@
|
||||
"cpu": [
|
||||
"arm64"
|
||||
],
|
||||
"dev": true,
|
||||
"license": "MIT",
|
||||
"optional": true,
|
||||
"os": [
|
||||
@@ -170,7 +176,6 @@
|
||||
"cpu": [
|
||||
"arm64"
|
||||
],
|
||||
"dev": true,
|
||||
"license": "MIT",
|
||||
"optional": true,
|
||||
"os": [
|
||||
@@ -187,7 +192,6 @@
|
||||
"cpu": [
|
||||
"x64"
|
||||
],
|
||||
"dev": true,
|
||||
"license": "MIT",
|
||||
"optional": true,
|
||||
"os": [
|
||||
@@ -204,7 +208,6 @@
|
||||
"cpu": [
|
||||
"x64"
|
||||
],
|
||||
"dev": true,
|
||||
"license": "MIT",
|
||||
"optional": true,
|
||||
"os": [
|
||||
@@ -221,7 +224,6 @@
|
||||
"cpu": [
|
||||
"arm"
|
||||
],
|
||||
"dev": true,
|
||||
"license": "MIT",
|
||||
"optional": true,
|
||||
"os": [
|
||||
@@ -238,7 +240,6 @@
|
||||
"cpu": [
|
||||
"arm64"
|
||||
],
|
||||
"dev": true,
|
||||
"license": "MIT",
|
||||
"optional": true,
|
||||
"os": [
|
||||
@@ -255,7 +256,6 @@
|
||||
"cpu": [
|
||||
"arm64"
|
||||
],
|
||||
"dev": true,
|
||||
"license": "MIT",
|
||||
"optional": true,
|
||||
"os": [
|
||||
@@ -272,7 +272,6 @@
|
||||
"cpu": [
|
||||
"ppc64"
|
||||
],
|
||||
"dev": true,
|
||||
"license": "MIT",
|
||||
"optional": true,
|
||||
"os": [
|
||||
@@ -289,7 +288,6 @@
|
||||
"cpu": [
|
||||
"s390x"
|
||||
],
|
||||
"dev": true,
|
||||
"license": "MIT",
|
||||
"optional": true,
|
||||
"os": [
|
||||
@@ -306,7 +304,6 @@
|
||||
"cpu": [
|
||||
"x64"
|
||||
],
|
||||
"dev": true,
|
||||
"license": "MIT",
|
||||
"optional": true,
|
||||
"os": [
|
||||
@@ -323,7 +320,6 @@
|
||||
"cpu": [
|
||||
"x64"
|
||||
],
|
||||
"dev": true,
|
||||
"license": "MIT",
|
||||
"optional": true,
|
||||
"os": [
|
||||
@@ -340,7 +336,6 @@
|
||||
"cpu": [
|
||||
"arm64"
|
||||
],
|
||||
"dev": true,
|
||||
"license": "MIT",
|
||||
"optional": true,
|
||||
"os": [
|
||||
@@ -357,7 +352,6 @@
|
||||
"cpu": [
|
||||
"wasm32"
|
||||
],
|
||||
"dev": true,
|
||||
"license": "MIT",
|
||||
"optional": true,
|
||||
"dependencies": {
|
||||
@@ -376,7 +370,6 @@
|
||||
"cpu": [
|
||||
"arm64"
|
||||
],
|
||||
"dev": true,
|
||||
"license": "MIT",
|
||||
"optional": true,
|
||||
"os": [
|
||||
@@ -393,7 +386,6 @@
|
||||
"cpu": [
|
||||
"x64"
|
||||
],
|
||||
"dev": true,
|
||||
"license": "MIT",
|
||||
"optional": true,
|
||||
"os": [
|
||||
@@ -407,7 +399,6 @@
|
||||
"version": "1.0.1",
|
||||
"resolved": "https://registry.npmjs.org/@rolldown/pluginutils/-/pluginutils-1.0.1.tgz",
|
||||
"integrity": "sha512-2j9bGt5Jh8hj+vPtgzPtl72j0yRxHAyumoo6TNfAjsLB04UtpSvPbPcDcBMxz7n+9CYB0c1GxQFxYRg2jimqGw==",
|
||||
"dev": true,
|
||||
"license": "MIT"
|
||||
},
|
||||
"node_modules/@tailwindcss/node": {
|
||||
@@ -686,7 +677,6 @@
|
||||
"version": "0.10.3",
|
||||
"resolved": "https://registry.npmjs.org/@tybys/wasm-util/-/wasm-util-0.10.3.tgz",
|
||||
"integrity": "sha512-F3fo1MYrRJYL3zER0OUOmkutjr1Vp23m7OsSgp7nq4SP6OqX6C/56XFIPAl5bt3zaBRjmW7SGz3u/6LwFpYcOg==",
|
||||
"dev": true,
|
||||
"license": "MIT",
|
||||
"optional": true,
|
||||
"dependencies": {
|
||||
@@ -894,7 +884,6 @@
|
||||
"version": "2.1.2",
|
||||
"resolved": "https://registry.npmjs.org/detect-libc/-/detect-libc-2.1.2.tgz",
|
||||
"integrity": "sha512-Btj2BOOO83o3WyH59e8MgXsxEQVcarkUOpEYrubB0urwnN10yQ364rsiByU11nZlqWYZm05i/of7io4mzihBtQ==",
|
||||
"dev": true,
|
||||
"license": "Apache-2.0",
|
||||
"engines": {
|
||||
"node": ">=8"
|
||||
@@ -994,7 +983,6 @@
|
||||
"version": "6.5.0",
|
||||
"resolved": "https://registry.npmjs.org/fdir/-/fdir-6.5.0.tgz",
|
||||
"integrity": "sha512-tIbYtZbucOs0BRGqPJkshJUYdL+SDH7dVM8gjy+ERp3WAUjLEFJE+02kanyHtwjWOnwrKYBiwAmM0p4kLJAnXg==",
|
||||
"dev": true,
|
||||
"license": "MIT",
|
||||
"engines": {
|
||||
"node": ">=12.0.0"
|
||||
@@ -1048,7 +1036,6 @@
|
||||
"version": "2.3.3",
|
||||
"resolved": "https://registry.npmjs.org/fsevents/-/fsevents-2.3.3.tgz",
|
||||
"integrity": "sha512-5xoDfX+fL7faATnagmWPpbFtwh/R77WmMMqqHGS65C3vvB0YHrgF+B1YmZ3441tMj5n63k0212XNoJwzlhffQw==",
|
||||
"dev": true,
|
||||
"hasInstallScript": true,
|
||||
"license": "MIT",
|
||||
"optional": true,
|
||||
@@ -1210,7 +1197,7 @@
|
||||
"version": "2.7.0",
|
||||
"resolved": "https://registry.npmjs.org/jiti/-/jiti-2.7.0.tgz",
|
||||
"integrity": "sha512-AC/7JofJvZGrrneWNaEnJeOLUx+JlGt7tNa0wZiRPT4MY1wmfKjt2+6O2p2uz2+skll8OZZmJMNqeke7kKbNgQ==",
|
||||
"dev": true,
|
||||
"devOptional": true,
|
||||
"license": "MIT",
|
||||
"bin": {
|
||||
"jiti": "lib/jiti-cli.mjs"
|
||||
@@ -1253,7 +1240,6 @@
|
||||
"version": "1.32.0",
|
||||
"resolved": "https://registry.npmjs.org/lightningcss/-/lightningcss-1.32.0.tgz",
|
||||
"integrity": "sha512-NXYBzinNrblfraPGyrbPoD19C1h9lfI/1mzgWYvXUTe414Gz/X1FD2XBZSZM7rRTrMA8JL3OtAaGifrIKhQ5yQ==",
|
||||
"dev": true,
|
||||
"license": "MPL-2.0",
|
||||
"dependencies": {
|
||||
"detect-libc": "^2.0.3"
|
||||
@@ -1286,7 +1272,6 @@
|
||||
"cpu": [
|
||||
"arm64"
|
||||
],
|
||||
"dev": true,
|
||||
"license": "MPL-2.0",
|
||||
"optional": true,
|
||||
"os": [
|
||||
@@ -1307,7 +1292,6 @@
|
||||
"cpu": [
|
||||
"arm64"
|
||||
],
|
||||
"dev": true,
|
||||
"license": "MPL-2.0",
|
||||
"optional": true,
|
||||
"os": [
|
||||
@@ -1328,7 +1312,6 @@
|
||||
"cpu": [
|
||||
"x64"
|
||||
],
|
||||
"dev": true,
|
||||
"license": "MPL-2.0",
|
||||
"optional": true,
|
||||
"os": [
|
||||
@@ -1349,7 +1332,6 @@
|
||||
"cpu": [
|
||||
"x64"
|
||||
],
|
||||
"dev": true,
|
||||
"license": "MPL-2.0",
|
||||
"optional": true,
|
||||
"os": [
|
||||
@@ -1370,7 +1352,6 @@
|
||||
"cpu": [
|
||||
"arm"
|
||||
],
|
||||
"dev": true,
|
||||
"license": "MPL-2.0",
|
||||
"optional": true,
|
||||
"os": [
|
||||
@@ -1391,7 +1372,6 @@
|
||||
"cpu": [
|
||||
"arm64"
|
||||
],
|
||||
"dev": true,
|
||||
"license": "MPL-2.0",
|
||||
"optional": true,
|
||||
"os": [
|
||||
@@ -1412,7 +1392,6 @@
|
||||
"cpu": [
|
||||
"arm64"
|
||||
],
|
||||
"dev": true,
|
||||
"license": "MPL-2.0",
|
||||
"optional": true,
|
||||
"os": [
|
||||
@@ -1433,7 +1412,6 @@
|
||||
"cpu": [
|
||||
"x64"
|
||||
],
|
||||
"dev": true,
|
||||
"license": "MPL-2.0",
|
||||
"optional": true,
|
||||
"os": [
|
||||
@@ -1454,7 +1432,6 @@
|
||||
"cpu": [
|
||||
"x64"
|
||||
],
|
||||
"dev": true,
|
||||
"license": "MPL-2.0",
|
||||
"optional": true,
|
||||
"os": [
|
||||
@@ -1475,7 +1452,6 @@
|
||||
"cpu": [
|
||||
"arm64"
|
||||
],
|
||||
"dev": true,
|
||||
"license": "MPL-2.0",
|
||||
"optional": true,
|
||||
"os": [
|
||||
@@ -1496,7 +1472,6 @@
|
||||
"cpu": [
|
||||
"x64"
|
||||
],
|
||||
"dev": true,
|
||||
"license": "MPL-2.0",
|
||||
"optional": true,
|
||||
"os": [
|
||||
@@ -1560,7 +1535,6 @@
|
||||
"version": "3.3.15",
|
||||
"resolved": "https://registry.npmjs.org/nanoid/-/nanoid-3.3.15.tgz",
|
||||
"integrity": "sha512-y7Wygv/7mEOvxTuEQDB8StXdMRBWf1kR/tlhAzBRUFkB2jfcLOAxO/SHmOO2zgz1pVgK29/kyupn059/bCHdjA==",
|
||||
"dev": true,
|
||||
"funding": [
|
||||
{
|
||||
"type": "github",
|
||||
@@ -1579,14 +1553,12 @@
|
||||
"version": "1.1.1",
|
||||
"resolved": "https://registry.npmjs.org/picocolors/-/picocolors-1.1.1.tgz",
|
||||
"integrity": "sha512-xceH2snhtb5M9liqDsmEw56le376mTZkEX/jEb/RxNFyegNul7eNslCXP9FDj/Lcu0X8KEyMceP2ntpaHrDEVA==",
|
||||
"dev": true,
|
||||
"license": "ISC"
|
||||
},
|
||||
"node_modules/picomatch": {
|
||||
"version": "4.0.5",
|
||||
"resolved": "https://registry.npmjs.org/picomatch/-/picomatch-4.0.5.tgz",
|
||||
"integrity": "sha512-RvwwcruNjI1ncT5xRakeyS9Lf8lcItv34KD+aif+VH9kduAyfYBipGh12274xtenIPZ119/R9BdTBa8gAwSh0A==",
|
||||
"dev": true,
|
||||
"license": "MIT",
|
||||
"engines": {
|
||||
"node": ">=12"
|
||||
@@ -1599,7 +1571,6 @@
|
||||
"version": "8.5.16",
|
||||
"resolved": "https://registry.npmjs.org/postcss/-/postcss-8.5.16.tgz",
|
||||
"integrity": "sha512-vuwillviilfKZsg0VGj5R/YwwcHx4SLsIOI/7K6mQkWx+l5cUHTjj5g0AasTBcyXsbfTgrwsUNmVUb5xVwyPwg==",
|
||||
"dev": true,
|
||||
"funding": [
|
||||
{
|
||||
"type": "opencollective",
|
||||
@@ -1647,7 +1618,6 @@
|
||||
"version": "1.1.4",
|
||||
"resolved": "https://registry.npmjs.org/rolldown/-/rolldown-1.1.4.tgz",
|
||||
"integrity": "sha512-IjZYiLxZwpnhwhdBH2ugdTGVSdhCQUmLxLoqyjiL0JxYjyRst+5a0P3xfrTxJ5F638j4Mvvw5FAX5XE6eHpXbA==",
|
||||
"dev": true,
|
||||
"license": "MIT",
|
||||
"dependencies": {
|
||||
"@oxc-project/types": "=0.138.0",
|
||||
@@ -1704,7 +1674,6 @@
|
||||
"version": "1.2.1",
|
||||
"resolved": "https://registry.npmjs.org/source-map-js/-/source-map-js-1.2.1.tgz",
|
||||
"integrity": "sha512-UXWMKhLOwVKb728IUtQPXxfYU+usdybtUrK/8uGE8CQMvrhOpwvzDBwj0QhSL7MQc7vIsISBG8VQ8+IDQxpfQA==",
|
||||
"dev": true,
|
||||
"license": "BSD-3-Clause",
|
||||
"engines": {
|
||||
"node": ">=0.10.0"
|
||||
@@ -1779,7 +1748,6 @@
|
||||
"version": "0.2.17",
|
||||
"resolved": "https://registry.npmjs.org/tinyglobby/-/tinyglobby-0.2.17.tgz",
|
||||
"integrity": "sha512-wXR/dYpcqKmfWpEdZjiKJOwCNFndD0DMnrW/cYjVGttEkBfVgcLFHoNrlj47mjOVic9yyNu65alsgF4NQyTa2g==",
|
||||
"dev": true,
|
||||
"license": "MIT",
|
||||
"dependencies": {
|
||||
"fdir": "^6.5.0",
|
||||
@@ -1806,14 +1774,13 @@
|
||||
"version": "2.8.1",
|
||||
"resolved": "https://registry.npmjs.org/tslib/-/tslib-2.8.1.tgz",
|
||||
"integrity": "sha512-oJFu94HQb+KVduSUQL7wnpmqnfmLsOA/nAh6b6EH0wCEoK0/mPeXU6c3wKDV83MkOuHPRHtSXKKU99IBazS/2w==",
|
||||
"dev": true,
|
||||
"devOptional": true,
|
||||
"license": "0BSD"
|
||||
},
|
||||
"node_modules/vite": {
|
||||
"version": "8.1.3",
|
||||
"resolved": "https://registry.npmjs.org/vite/-/vite-8.1.3.tgz",
|
||||
"integrity": "sha512-Ds+gBRbj0lwRO2Y5hwnUBdxSwlAve9LeRyU4sNnAr0ewW0gWF0n5bgXgUzbgZ49MV9BVUAQUFYVcDUcilUExMA==",
|
||||
"dev": true,
|
||||
"license": "MIT",
|
||||
"dependencies": {
|
||||
"lightningcss": "^1.32.0",
|
||||
|
||||
+1
-1
@@ -22,6 +22,6 @@
|
||||
},
|
||||
"_comment_boboko_core": "Mirrors composer.json's repositories/_repositories toggle: swap @boboko/core above with the line in _dependencies below (and back) by hand to switch between the local path-repo checkout and a tagged VCS install. The #semver:0.x range mirrors composer.json's own \"boboko/core\": \"0.*\" constraint exactly — note ^0.23.0 would NOT be equivalent here, since npm's caret locks the minor version too below 1.0.0 (>=0.23.0 <0.24.0). 0.x matches any 0.y.z tag, same as Composer's 0.*. npm reads the repo's git tags, filters to valid semver ones, and resolves the best match, so `npm update @boboko/core` alone picks up a newly pushed tag within range, no manual edit here per release. See docker/entrypoint-vite.sh and CONTRIBUTE.md.",
|
||||
"_dependencies": {
|
||||
"@boboko/core": "file:../boboko-core"
|
||||
"@boboko/core": "file:../boboko-core"
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,2 @@
|
||||
/*! tailwindcss v4.3.0 | MIT License | https://tailwindcss.com */
|
||||
@layer properties{@supports (((-webkit-hyphens:none)) and (not (margin-trim:inline))) or ((-moz-orient:inline) and (not (color:rgb(from red r g b)))){*,:before,:after,::backdrop{--tw-font-weight:initial;--tw-shadow:0 0 #0000;--tw-shadow-color:initial;--tw-shadow-alpha:100%;--tw-inset-shadow:0 0 #0000;--tw-inset-shadow-color:initial;--tw-inset-shadow-alpha:100%;--tw-ring-color:initial;--tw-ring-shadow:0 0 #0000;--tw-inset-ring-color:initial;--tw-inset-ring-shadow:0 0 #0000;--tw-ring-inset:initial;--tw-ring-offset-width:0px;--tw-ring-offset-color:#fff;--tw-ring-offset-shadow:0 0 #0000;--tw-tracking:initial;--tw-duration:initial;--tw-translate-x:0;--tw-translate-y:0;--tw-translate-z:0;--tw-divide-y-reverse:0;--tw-border-style:solid;--tw-leading:initial;--tw-outline-style:solid;--tw-scale-x:1;--tw-scale-y:1;--tw-scale-z:1;--tw-ease:initial;--tw-rotate-x:initial;--tw-rotate-y:initial;--tw-rotate-z:initial;--tw-skew-x:initial;--tw-skew-y:initial;--tw-space-y-reverse:0;--tw-divide-x-reverse:0;--tw-content:"";--tw-space-x-reverse:0;--tw-ordinal:initial;--tw-slashed-zero:initial;--tw-numeric-figure:initial;--tw-numeric-spacing:initial;--tw-numeric-fraction:initial}}}@layer theme{:root,:host{--font-mono:var(--font-family-mono), ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, "Liberation Mono", "Courier New", monospace;--color-sky-400:oklch(74.6% .16 232.661);--color-gray-100:var(--gray-100);--color-gray-200:var(--gray-200);--color-gray-300:var(--gray-300);--color-gray-400:var(--gray-400);--color-gray-500:var(--gray-500);--color-gray-600:var(--gray-600);--color-gray-700:var(--gray-700);--color-gray-900:var(--gray-900);--color-gray-950:var(--gray-950);--color-black:#000;--color-white:#fff;--spacing:.25rem;--breakpoint-sm:40rem;--breakpoint-md:48rem;--breakpoint-lg:64rem;--breakpoint-xl:80rem;--breakpoint-2xl:96rem;--container-3xs:16rem;--container-2xs:18rem;--container-xs:20rem;--container-sm:24rem;--container-md:28rem;--container-lg:32rem;--container-xl:36rem;--container-2xl:42rem;--container-3xl:48rem;--container-4xl:56rem;--container-5xl:64rem;--container-6xl:72rem;--container-7xl:80rem;--text-xs:.75rem;--text-xs--line-height:calc(1 / .75);--text-sm:.875rem;--text-sm--line-height:calc(1.25 / .875);--text-base:1rem;--text-base--line-height:calc(1.5 / 1);--text-lg:1.125rem;--text-lg--line-height:calc(1.75 / 1.125);--text-xl:1.25rem;--text-xl--line-height:calc(1.75 / 1.25);--text-2xl:1.5rem;--text-2xl--line-height:calc(2 / 1.5);--text-3xl:1.875rem;--text-3xl--line-height:calc(2.25 / 1.875);--font-weight-thin:100;--font-weight-extralight:200;--font-weight-light:300;--font-weight-normal:400;--font-weight-medium:500;--font-weight-semibold:600;--font-weight-bold:700;--font-weight-extrabold:800;--font-weight-black:900;--tracking-tighter:-.05em;--tracking-tight:-.025em;--leading-loose:2;--radius-sm:.25rem;--radius-md:.375rem;--radius-lg:.5rem;--radius-xl:.75rem;--ease-in:cubic-bezier(.4, 0, 1, 1);--ease-out:cubic-bezier(0, 0, .2, 1);--ease-in-out:cubic-bezier(.4, 0, .2, 1);--animate-spin:spin 1s linear infinite;--animate-pulse:pulse 2s cubic-bezier(.4, 0, .6, 1) infinite;--default-transition-duration:.15s;--default-transition-timing-function:cubic-bezier(.4, 0, .2, 1);--default-font-family:var(--font-family), ui-sans-serif, system-ui, sans-serif, "Apple Color Emoji", "Segoe UI Emoji", "Segoe UI Symbol", "Noto Color Emoji";--default-mono-font-family:var(--font-family-mono), ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, "Liberation Mono", "Courier New", monospace;--color-primary-400:var(--primary-400);--color-primary-500:var(--primary-500);--color-primary-600:var(--primary-600)}}@layer base{*,:after,:before,::backdrop{box-sizing:border-box;border:0 solid;margin:0;padding:0}::file-selector-button{box-sizing:border-box;border:0 solid;margin:0;padding:0}html,:host{-webkit-text-size-adjust:100%;tab-size:4;line-height:1.5;font-family:var(--default-font-family,ui-sans-serif, system-ui, sans-serif, "Apple Color Emoji", "Segoe UI Emoji", "Segoe UI Symbol", "Noto Color Emoji");font-feature-settings:var(--default-font-feature-settings,normal);font-variation-settings:var(--default-font-variation-settings,normal);-webkit-tap-highlight-color:transparent}hr{height:0;color:inherit;border-top-width:1px}abbr:where([title]){-webkit-text-decoration:underline dotted;text-decoration:underline dotted}h1,h2,h3,h4,h5,h6{font-size:inherit;font-weight:inherit}a{color:inherit;-webkit-text-decoration:inherit;-webkit-text-decoration:inherit;-webkit-text-decoration:inherit;text-decoration:inherit}b,strong{font-weight:bolder}code,kbd,samp,pre{font-family:var(--default-mono-font-family,ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, "Liberation Mono", "Courier New", monospace);font-feature-settings:var(--default-mono-font-feature-settings,normal);font-variation-settings:var(--default-mono-font-variation-settings,normal);font-size:1em}small{font-size:80%}sub,sup{vertical-align:baseline;font-size:75%;line-height:0;position:relative}sub{Line truncated
|
||||
Executable → Regular
File mode changed.
@@ -0,0 +1 @@
|
||||
@font-face{font-family:Inter Variable;font-style:normal;font-display:swap;font-weight:100 900;src:url("./inter-cyrillic-ext-wght-normal-SP7Z6XGK.woff2") format("woff2-variations");unicode-range:U+0460-052F,U+1C80-1C8A,U+20B4,U+2DE0-2DFF,U+A640-A69F,U+FE2E-FE2F}@font-face{font-family:Inter Variable;font-style:normal;font-display:swap;font-weight:100 900;src:url("./inter-cyrillic-wght-normal-DR6K5BQD.woff2") format("woff2-variations");unicode-range:U+0301,U+0400-045F,U+0490-0491,U+04B0-04B1,U+2116}@font-face{font-family:Inter Variable;font-style:normal;font-display:swap;font-weight:100 900;src:url("./inter-greek-ext-wght-normal-A2J6H3EX.woff2") format("woff2-variations");unicode-range:U+1F00-1FFF}@font-face{font-family:Inter Variable;font-style:normal;font-display:swap;font-weight:100 900;src:url("./inter-greek-wght-normal-ZABHMKQG.woff2") format("woff2-variations");unicode-range:U+0370-0377,U+037A-037F,U+0384-038A,U+038C,U+038E-03A1,U+03A3-03FF}@font-face{font-family:Inter Variable;font-style:normal;font-display:swap;font-weight:100 900;src:url("./inter-vietnamese-wght-normal-VWEHJHBA.woff2") format("woff2-variations");unicode-range:U+0102-0103,U+0110-0111,U+0128-0129,U+0168-0169,U+01A0-01A1,U+01AF-01B0,U+0300-0301,U+0303-0304,U+0308-0309,U+0323,U+0329,U+1EA0-1EF9,U+20AB}@font-face{font-family:Inter Variable;font-style:normal;font-display:swap;font-weight:100 900;src:url("./inter-latin-ext-wght-normal-ZIT2UBIY.woff2") format("woff2-variations");unicode-range:U+0100-02BA,U+02BD-02C5,U+02C7-02CC,U+02CE-02D7,U+02DD-02FF,U+0304,U+0308,U+0329,U+1D00-1DBF,U+1E00-1E9F,U+1EF2-1EFF,U+2020,U+20A0-20AB,U+20AD-20C0,U+2113,U+2C60-2C7F,U+A720-A7FF}@font-face{font-family:Inter Variable;font-style:normal;font-display:swap;font-weight:100 900;src:url("./inter-latin-wght-normal-DIHYUR35.woff2") format("woff2-variations");unicode-range:U+0000-00FF,U+0131,U+0152-0153,U+02BB-02BC,U+02C6,U+02DA,U+02DC,U+0304,U+0308,U+0329,U+2000-206F,U+20AC,U+2122,U+2191,U+2193,U+2212,U+2215,U+FEFF,U+FFFD}
|
||||
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
@@ -0,0 +1 @@
|
||||
google-site-verification: googledd42b61d3393d4d5.html
|
||||
Executable → Regular
File mode changed.
@@ -0,0 +1 @@
|
||||
(()=>{var o=({livewireId:n})=>({actionNestingIndex:null,isDestroyed:!1,shouldOverlayParentActions:!1,closedActionNestingIndexes:[],focusTargetsByNestingIndex:{},boundSyncActionModals:null,boundOnModalClosed:null,boundFocusTarget:null,boundFocusTargetFinished:null,pendingFocusTarget:null,restoringFocusTarget:null,init(){this.boundFocusTarget=t=>{if(t.detail.id!==n)return;this.pendingFocusTarget?.controller.abort(),this.restoringFocusTarget?.controller.abort();let e=new AbortController;this.pendingFocusTarget={controller:e,create:t.detail.createFocusTarget,restore:t.detail.createFocusTarget(e.signal)}},this.boundFocusTargetFinished=t=>{t.detail.id!==n||this.pendingFocusTarget?.create!==t.detail.createFocusTarget||(this.pendingFocusTarget.controller.abort(),this.pendingFocusTarget=null)},this.boundSyncActionModals=t=>{t.detail.id===n&&this.syncActionModals(t.detail.newActionNestingIndex,t.detail.shouldOverlayParentActions??!1)},this.boundOnModalClosed=t=>{let e=this.getActionNestingIndexFromModalId(t.detail.id);e!==null&&((this.shouldOverlayParentActions||e===0)&&this.restorePreviouslyFocusedElement(e-1),this.closedActionNestingIndexes.push(e))},window.addEventListener("sync-action-modals",this.boundSyncActionModals),window.addEventListener("modal-closed",this.boundOnModalClosed),window.addEventListener("action-modal-focus-target",this.boundFocusTarget),window.addEventListener("action-modal-focus-target-finished",this.boundFocusTargetFinished)},syncActionModals(t,e=!1){if(this.actionNestingIndex===t){this.actionNestingIndex!==null&&this.$nextTick(()=>this.openModal());return}let s=this.actionNestingIndex!==null&&t!==null&&t>this.actionNestingIndex,i=this.actionNestingIndex!==null&&t!==null&&t<this.actionNestingIndex,r=this.actionNestingIndex===null&&t!==null;if((s||r)&&(this.restoringFocusTarget?.controller.abort(),this.rememberPreviouslyFocusedElement()),this.actionNestingIndex!==null&&!(e&&s)&&this.closeModal(),this.actionNestingIndex=t,this.actionNestingIndex===null){this.restorePreviouslyFocusedElement(-1),this.closedActionNestingIndexes=[],this.focusTargetsByNestingIndex={},this.shouldOverlayParentActions=!1;return}if(this.shouldOverlayParentActions=e,this.closedActionNestingIndexes=this.closedActionNestingIndexes.filter(l=>l<=this.actionNestingIndex),!this.closedActionNestingIndexes.includes(this.actionNestingIndex)){if(!this.$el.querySelector(`#${this.generateModalId(t)}`)){this.$nextTick(()=>{this.openModal(),i&&this.restorePreviouslyFocusedElement()});return}this.openModal(),i&&this.restorePreviouslyFocusedElement()}},rememberPreviouslyFocusedElement(){if(this.pendingFocusTarget){this.focusTargetsByNestingIndex[this.actionNestingIndex??-1]=this.pendingFocusTarget,this.pendingFocusTarget=null;return}let t=this.$focus.focused();if(!t)return;if(this.actionNestingIndex===null){this.focusTargetsByNestingIndex[-1]=t;return}this.$el.querySelector(`#${this.generateModalId(this.actionNestingIndex)}`)?.contains(t)&&(this.focusTargetsByNestingIndex[this.actionNestingIndex]=t)},restorePreviouslyFocusedElement(t=this.actionNestingIndex){let e=this.focusTargetsByNestingIndex[t];for(let s in this.focusTargetsByNestingIndex)if(Number(s)>=t){let i=this.focusTargetsByNestingIndex[s];i!==e&&i.controller?.abort(),delete this.focusTargetsByNestingIndex[s]}this.restoringFocusTarget?.nestingIndex>t&&(this.restoringFocusTarget.controller.abort(),this.restoringFocusTarget=null),e&&(this.restoringFocusTarget?.controller.abort(),this.restoringFocusTarget=e.restore?e:null,this.restoringFocusTarget&&(this.restoringFocusTarget.nestingIndex=t),this.$nextTick(()=>requestAnimationFrame(()=>requestAnimationFrame(()=>this.$nextTick(async()=>{if(this.isDestroyed)return;if(!e.restore){e.focus({preventScroll:!0});return}let{controller:s}=e;if(!s.signal.aborted)try{await e.restore()}finally{s.abort(),this.restoringFocusTarget===e&&(this.restoringFocusTarget=null)}})))))},generateModalId(t){return`fi-${n}-action-`+t},getActionNestingIndexFromModalId(t){let e=`fi-${n}-action-`;if(!t?.startsWith(e))return null;let s=Number(t.slice(e.length));return Number.isInteger(s)?s:null},openModal(){if(this.isDestroyed)return;let t=this.generateModalId(this.actionNestingIndex);document.dispatchEvent(new CustomEvent("open-modal",{bubbles:!0,composed:!0,detail:{id:t}}))},closeModal(){let t=this.generateModalId(this.actionNestingIndex);document.dispatchEvent(new CustomEvent("close-modal-quietly",{bubbles:!0,composed:!0,detail:{id:t}}))},destroy(){this.isDestroyed=!0,this.pendingFocusTarget?.controller.abort(),this.restoringFocusTarget?.controller.abort(),Object.values(this.focusTargetsByNestingIndex).forEach(t=>t.controller?.abort()),window.removeEventListener("action-modal-focus-target",this.boundFocusTarget),window.removeEventListener("action-modal-focus-target-finished",this.boundFocusTargetFinished),this.boundSyncActionModals&&(window.removeEventListener("sync-action-modals",this.boundSyncActionModals),this.boundSyncActionModals=null),this.boundOnModalLine truncated
|
||||
@@ -0,0 +1 @@
|
||||
(()=>{var le=Object.create,x=Object.defineProperty,ue=Object.getPrototypeOf,de=Object.prototype.hasOwnProperty,fe=Object.getOwnPropertyNames,ce=Object.getOwnPropertyDescriptor,he=e=>x(e,"__esModule",{value:!0}),pe=(e,n)=>()=>(n||(n={exports:{}},e(n.exports,n)),n.exports),me=(e,n,t)=>{if(n&&typeof n=="object"||typeof n=="function")for(let r of fe(n))!de.call(e,r)&&r!=="default"&&x(e,r,{get:()=>n[r],enumerable:!(t=ce(n,r))||t.enumerable});return e},ve=e=>me(he(x(e!=null?le(ue(e)):{},"default",e&&e.__esModule&&"default"in e?{get:()=>e.default,enumerable:!0}:{value:e,enumerable:!0})),e),ge=pe((e,n)=>{(function(t,r,o){if(!t)return;for(var l={8:"backspace",9:"tab",13:"enter",16:"shift",17:"ctrl",18:"alt",20:"capslock",27:"esc",32:"space",33:"pageup",34:"pagedown",35:"end",36:"home",37:"left",38:"up",39:"right",40:"down",45:"ins",46:"del",91:"meta",93:"meta",224:"meta"},g={106:"*",107:"+",109:"-",110:".",111:"/",186:";",187:"=",188:",",189:"-",190:".",191:"/",192:"`",219:"[",220:"\\",221:"]",222:"'"},p={"~":"`","!":"1","@":"2","#":"3",$:"4","%":"5","^":"6","&":"7","*":"8","(":"9",")":"0",_:"-","+":"=",":":";",'"':"'","<":",",">":".","?":"/","|":"\\"},_={option:"alt",command:"meta",return:"enter",escape:"esc",plus:"+",mod:/Mac|iPod|iPhone|iPad/.test(navigator.platform)?"meta":"ctrl"},k,b=1;b<20;++b)l[111+b]="f"+b;for(b=0;b<=9;++b)l[b+96]=b.toString();function C(i,s,u){if(i.addEventListener){i.addEventListener(s,u,!1);return}i.attachEvent("on"+s,u)}function U(i){if(i.type=="keypress"){var s=String.fromCharCode(i.which);return i.shiftKey||(s=s.toLowerCase()),s}return l[i.which]?l[i.which]:g[i.which]?g[i.which]:String.fromCharCode(i.which).toLowerCase()}function X(i,s){return i.sort().join(",")===s.sort().join(",")}function Y(i){var s=[];return i.shiftKey&&s.push("shift"),i.altKey&&s.push("alt"),i.ctrlKey&&s.push("ctrl"),i.metaKey&&s.push("meta"),s}function Z(i){if(i.preventDefault){i.preventDefault();return}i.returnValue=!1}function ee(i){if(i.stopPropagation){i.stopPropagation();return}i.cancelBubble=!0}function L(i){return i=="shift"||i=="ctrl"||i=="alt"||i=="meta"}function te(){if(!k){k={};for(var i in l)i>95&&i<112||l.hasOwnProperty(i)&&(k[l[i]]=i)}return k}function ie(i,s,u){return u||(u=te()[i]?"keydown":"keypress"),u=="keypress"&&s.length&&(u="keydown"),u}function se(i){return i==="+"?["+"]:(i=i.replace(/\+{2}/g,"+plus"),i.split("+"))}function N(i,s){var u,v,M,D=[];for(u=se(i),M=0;M<u.length;++M)v=u[M],_[v]&&(v=_[v]),s&&s!="keypress"&&p[v]&&(v=p[v],D.push("shift")),L(v)&&D.push(v);return s=ie(v,D,s),{key:v,modifiers:D,action:s}}function I(i,s){return i===null||i===r?!1:i===s?!0:I(i.parentNode,s)}function y(i){var s=this;if(i=i||r,!(s instanceof y))return new y(i);s.target=i,s._callbacks={},s._directMap={};var u={},v,M=!1,D=!1,T=!1;function P(a){a=a||{};var f=!1,h;for(h in u){if(a[h]){f=!0;continue}u[h]=0}f||(T=!1)}function G(a,f,h,d,m,O){var c,w,E=[],S=h.type;if(!s._callbacks[a])return[];for(S=="keyup"&&L(a)&&(f=[a]),c=0;c<s._callbacks[a].length;++c)if(w=s._callbacks[a][c],!(!d&&w.seq&&u[w.seq]!=w.level)&&S==w.action&&(S=="keypress"&&!h.metaKey&&!h.ctrlKey||X(f,w.modifiers))){var ae=!d&&w.combo==m,oe=d&&w.seq==d&&w.level==O;(ae||oe)&&s._callbacks[a].splice(c,1),E.push(w)}return E}function $(a,f,h,d){s.stopCallback(f,f.target||f.srcElement,h,d)||a(f,h)===!1&&(Z(f),ee(f))}s._handleKey=function(a,f,h){var d=G(a,f,h),m,O={},c=0,w=!1;for(m=0;m<d.length;++m)d[m].seq&&(c=Math.max(c,d[m].level));for(m=0;m<d.length;++m){if(d[m].seq){if(d[m].level!=c)continue;w=!0,O[d[m].seq]=1,$(d[m].callback,h,d[m].combo,d[m].seq);continue}w||$(d[m].callback,h,d[m].combo)}var E=h.type=="keypress"&&D;h.type==T&&!L(a)&&!E&&P(O),D=w&&h.type=="keydown"};function q(a){typeof a.which!="number"&&(a.which=a.keyCode);var f=U(a);if(f){if(a.type=="keyup"&&M===f){M=!1;return}s.handleKey(f,Y(a),a)}}function re(){clearTimeout(v),v=setTimeout(P,1e3)}function ne(a,f,h,d){u[a]=0;function m(S){return function(){T=S,++u[a],re()}}function O(S){$(h,S,a),d!=="keyup"&&(M=U(S)),setTimeout(P,10)}for(var c=0;c<f.length;++c){var w=c+1===f.length,E=w?O:m(d||N(f[c+1]).action);Q(f[c],E,d,a,c)}}function Q(a,f,h,d,m){s._directMap[a+":"+h]=f,a=a.replace(/\s+/g," ");var O=a.split(" "),c;if(O.length>1){ne(a,O,f,h);return}c=N(a,h),s._callbacks[c.key]=s._callbacks[c.key]||[],G(c.key,c.modifiers,{type:c.action},d,a,m),s._callbacks[c.key][d?"unshift":"push"]({callback:f,modifiers:c.modifiers,action:c.action,seq:d,level:m,combo:a})}s._bindMultiple=function(a,f,h){for(var d=0;d<a.length;++d)Q(a[d],f,h)},C(i,"keypress",q),C(i,"keydown",q),C(i,"keyup",q)}y.prototype.bind=function(i,s,u){var v=this;return i=i instanceof Array?i:[i],v._bindMultiple.call(v,i,s,u),v},y.prototype.unbind=function(i,s){var u=this;return u.bind.call(u,i,function(){},s)},y.prototype.trigger=function(i,s){var u=this;return u._directMap[i+":"+s]&&u._directMap[i+":"+s]({},i),u},y.prototype.reset=function(){var i=this;return i._callbacks={},i._directMap={},i},y.prototype.stopCallback=function(i,s){var u=tLine truncated
|
||||
@@ -0,0 +1,13 @@
|
||||
(()=>{var Ci=Object.create;var he=Object.defineProperty;var Ti=Object.getOwnPropertyDescriptor;var Pi=Object.getOwnPropertyNames;var xi=Object.getPrototypeOf,Oi=Object.prototype.hasOwnProperty;var Ai=(l,h)=>()=>{try{return h||l((h={exports:{}}).exports,h),h.exports}catch(a){throw h=0,a}};var Ei=(l,h,a,c)=>{if(h&&typeof h=="object"||typeof h=="function")for(let s of Pi(h))!Oi.call(l,s)&&s!==a&&he(l,s,{get:()=>h[s],enumerable:!(c=Ti(h,s))||c.enumerable});return l};var Li=(l,h,a)=>(a=l!=null?Ci(xi(l)):{},Ei(h||!l||!l.__esModule?he(a,"default",{value:l,enumerable:!0}):a,l));var me=Ai((vt,It)=>{(function(h,a){typeof vt=="object"&&typeof It=="object"?It.exports=a():typeof define=="function"&&define.amd?define([],a):typeof vt=="object"?vt.Pusher=a():h.Pusher=a()})(window,function(){return(function(l){var h={};function a(c){if(h[c])return h[c].exports;var s=h[c]={i:c,l:!1,exports:{}};return l[c].call(s.exports,s,s.exports,a),s.l=!0,s.exports}return a.m=l,a.c=h,a.d=function(c,s,f){a.o(c,s)||Object.defineProperty(c,s,{enumerable:!0,get:f})},a.r=function(c){typeof Symbol<"u"&&Symbol.toStringTag&&Object.defineProperty(c,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(c,"__esModule",{value:!0})},a.t=function(c,s){if(s&1&&(c=a(c)),s&8||s&4&&typeof c=="object"&&c&&c.__esModule)return c;var f=Object.create(null);if(a.r(f),Object.defineProperty(f,"default",{enumerable:!0,value:c}),s&2&&typeof c!="string")for(var d in c)a.d(f,d,function(N){return c[N]}.bind(null,d));return f},a.n=function(c){var s=c&&c.__esModule?function(){return c.default}:function(){return c};return a.d(s,"a",s),s},a.o=function(c,s){return Object.prototype.hasOwnProperty.call(c,s)},a.p="",a(a.s=2)})([(function(l,h,a){"use strict";var c=this&&this.__extends||(function(){var b=function(v,y){return b=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(w,O){w.__proto__=O}||function(w,O){for(var I in O)O.hasOwnProperty(I)&&(w[I]=O[I])},b(v,y)};return function(v,y){b(v,y);function w(){this.constructor=v}v.prototype=y===null?Object.create(y):(w.prototype=y.prototype,new w)}})();Object.defineProperty(h,"__esModule",{value:!0});var s=256,f=(function(){function b(v){v===void 0&&(v="="),this._paddingCharacter=v}return b.prototype.encodedLength=function(v){return this._paddingCharacter?(v+2)/3*4|0:(v*8+5)/6|0},b.prototype.encode=function(v){for(var y="",w=0;w<v.length-2;w+=3){var O=v[w]<<16|v[w+1]<<8|v[w+2];y+=this._encodeByte(O>>>18&63),y+=this._encodeByte(O>>>12&63),y+=this._encodeByte(O>>>6&63),y+=this._encodeByte(O>>>0&63)}var I=v.length-w;if(I>0){var O=v[w]<<16|(I===2?v[w+1]<<8:0);y+=this._encodeByte(O>>>18&63),y+=this._encodeByte(O>>>12&63),I===2?y+=this._encodeByte(O>>>6&63):y+=this._paddingCharacter||"",y+=this._paddingCharacter||""}return y},b.prototype.maxDecodedLength=function(v){return this._paddingCharacter?v/4*3|0:(v*6+7)/8|0},b.prototype.decodedLength=function(v){return this.maxDecodedLength(v.length-this._getPaddingLength(v))},b.prototype.decode=function(v){if(v.length===0)return new Uint8Array(0);for(var y=this._getPaddingLength(v),w=v.length-y,O=new Uint8Array(this.maxDecodedLength(w)),I=0,q=0,M=0,J=0,F=0,z=0,B=0;q<w-4;q+=4)J=this._decodeChar(v.charCodeAt(q+0)),F=this._decodeChar(v.charCodeAt(q+1)),z=this._decodeChar(v.charCodeAt(q+2)),B=this._decodeChar(v.charCodeAt(q+3)),O[I++]=J<<2|F>>>4,O[I++]=F<<4|z>>>2,O[I++]=z<<6|B,M|=J&s,M|=F&s,M|=z&s,M|=B&s;if(q<w-1&&(J=this._decodeChar(v.charCodeAt(q)),F=this._decodeChar(v.charCodeAt(q+1)),O[I++]=J<<2|F>>>4,M|=J&s,M|=F&s),q<w-2&&(z=this._decodeChar(v.charCodeAt(q+2)),O[I++]=F<<4|z>>>2,M|=z&s),q<w-3&&(B=this._decodeChar(v.charCodeAt(q+3)),O[I++]=z<<6|B,M|=B&s),M!==0)throw new Error("Base64Coder: incorrect characters for decoding");return O},b.prototype._encodeByte=function(v){var y=v;return y+=65,y+=25-v>>>8&6,y+=51-v>>>8&-75,y+=61-v>>>8&-15,y+=62-v>>>8&3,String.fromCharCode(y)},b.prototype._decodeChar=function(v){var y=s;return y+=(42-v&v-44)>>>8&-s+v-43+62,y+=(46-v&v-48)>>>8&-s+v-47+63,y+=(47-v&v-58)>>>8&-s+v-48+52,y+=(64-v&v-91)>>>8&-s+v-65+0,y+=(96-v&v-123)>>>8&-s+v-97+26,y},b.prototype._getPaddingLength=function(v){var y=0;if(this._paddingCharacter){for(var w=v.length-1;w>=0&&v[w]===this._paddingCharacter;w--)y++;if(v.length<4||y>2)throw new Error("Base64Coder: incorrect padding")}return y},b})();h.Coder=f;var d=new f;function N(b){return d.encode(b)}h.encode=N;function P(b){return d.decode(b)}h.decode=P;var T=(function(b){c(v,b);function v(){return b!==null&&b.apply(this,arguments)||this}return v.prototype._encodeByte=function(y){var w=y;return w+=65,w+=25-y>>>8&6,w+=51-y>>>8&-75,w+=61-y>>>8&-13,w+=62-y>>>8&49,String.fromCharCode(w)},v.prototype._decodeChar=function(y){var w=s;return w+=(44-y&y-46)>>>8&-s+y-45+62,w+=(94-y&y-96)>>>8&-s+y-95+63,w+=(47-y&y-58)>>>8&-s+y-48+52,w+=(64-y&y-91)>>>8&-s+y-65+0,w+=(96-y&y-123)>>>8&-s+y-97+26,w},v})(f);h.URLSafeCoder=T;var S=new T;function C(b){return S.encode(b)}h.encodeURLSafe=C;function x(b){return S.decode(b)}h.decodeURLSafe=x,h.encodeLine truncated
|
||||
`);return i!==-1?(this.position+=i+1,r.slice(0,i)):null},t.prototype.isBufferTooLong=function(n){return this.position===n.length&&n.length>br},t})(V),wr=mr,Ct;(function(e){e[e.CONNECTING=0]="CONNECTING",e[e.OPEN=1]="OPEN",e[e.CLOSED=3]="CLOSED"})(Ct||(Ct={}));var $=Ct,kr=1,Sr=(function(){function e(t,n){this.hooks=t,this.session=Yt(1e3)+"/"+xr(8),this.location=Cr(n),this.readyState=$.CONNECTING,this.openStream()}return e.prototype.send=function(t){return this.sendRaw(JSON.stringify([t]))},e.prototype.ping=function(){this.hooks.sendHeartbeat(this)},e.prototype.close=function(t,n){this.onClose(t,n,!0)},e.prototype.sendRaw=function(t){if(this.readyState===$.OPEN)try{return m.createSocketRequest("POST",Kt(Tr(this.location,this.session))).start(t),!0}catch{return!1}else return!1},e.prototype.reconnect=function(){this.closeStream(),this.openStream()},e.prototype.onClose=function(t,n,r){this.closeStream(),this.readyState=$.CLOSED,this.onclose&&this.onclose({code:t,reason:n,wasClean:r})},e.prototype.onChunk=function(t){if(t.status===200){this.readyState===$.OPEN&&this.onActivity();var n,r=t.data.slice(0,1);switch(r){case"o":n=JSON.parse(t.data.slice(1)||"{}"),this.onOpen(n);break;case"a":n=JSON.parse(t.data.slice(1)||"[]");for(var i=0;i<n.length;i++)this.onEvent(n[i]);break;case"m":n=JSON.parse(t.data.slice(1)||"null"),this.onEvent(n);break;case"h":this.hooks.onHeartbeat(this);break;case"c":n=JSON.parse(t.data.slice(1)||"[]"),this.onClose(n[0],n[1],!0);break}}},e.prototype.onOpen=function(t){this.readyState===$.CONNECTING?(t&&t.hostname&&(this.location.base=Pr(this.location.base,t.hostname)),this.readyState=$.OPEN,this.onopen&&this.onopen()):this.onClose(1006,"Server lost session",!0)},e.prototype.onEvent=function(t){this.readyState===$.OPEN&&this.onmessage&&this.onmessage({data:t})},e.prototype.onActivity=function(){this.onactivity&&this.onactivity()},e.prototype.onError=function(t){this.onerror&&this.onerror(t)},e.prototype.openStream=function(){var t=this;this.stream=m.createSocketRequest("POST",Kt(this.hooks.getReceiveURL(this.location,this.session))),this.stream.bind("chunk",function(n){t.onChunk(n)}),this.stream.bind("finished",function(n){t.hooks.onFinished(t,n)}),this.stream.bind("buffer_too_long",function(){t.reconnect()});try{this.stream.start()}catch(n){j.defer(function(){t.onError(n),t.onClose(1006,"Could not start streaming",!1)})}},e.prototype.closeStream=function(){this.stream&&(this.stream.unbind_all(),this.stream.close(),this.stream=null)},e})();function Cr(e){var t=/([^\?]*)\/*(\??.*)/.exec(e);return{base:t[1],queryString:t[2]}}function Tr(e,t){return e.base+"/"+t+"/xhr_send"}function Kt(e){var t=e.indexOf("?")===-1?"?":"&";return e+t+"t="+ +new Date+"&n="+kr++}function Pr(e,t){var n=/(https?:\/\/)([^\/:]+)((\/|:)?.*)/.exec(e);return n[1]+t+n[3]}function Yt(e){return m.randomInt(e)}function xr(e){for(var t=[],n=0;n<e;n++)t.push(Yt(32).toString(32));return t.join("")}var Or=Sr,Ar={getReceiveURL:function(e,t){return e.base+"/"+t+"/xhr_streaming"+e.queryString},onHeartbeat:function(e){e.sendRaw("[]")},sendHeartbeat:function(e){e.sendRaw("[]")},onFinished:function(e,t){e.onClose(1006,"Connection interrupted ("+t+")",!1)}},Er=Ar,Lr={getReceiveURL:function(e,t){return e.base+"/"+t+"/xhr"+e.queryString},onHeartbeat:function(){},sendHeartbeat:function(e){e.sendRaw("[]")},onFinished:function(e,t){t===200?e.reconnect():e.onClose(1006,"Connection interrupted ("+t+")",!1)}},Rr=Lr,Ir={getRequest:function(e){var t=m.getXHRAPI(),n=new t;return n.onreadystatechange=n.onprogress=function(){switch(n.readyState){case 3:n.responseText&&n.responseText.length>0&&e.onChunk(n.status,n.responseText);break;case 4:n.responseText&&n.responseText.length>0&&e.onChunk(n.status,n.responseText),e.emit("finished",n.status),e.close();break}},n},abortRequest:function(e){e.onreadystatechange=null,e.abort()}},jr=Ir,Nr={createStreamingSocket:function(e){return this.createSocket(Er,e)},createPollingSocket:function(e){return this.createSocket(Rr,e)},createSocket:function(e,t){return new Or(e,t)},createXHR:function(e,t){return this.createRequest(jr,e,t)},createRequest:function(e,t,n){return new wr(e,t,n)}},$t=Nr;$t.createXDR=function(e,t){return this.createRequest(gr,e,t)};var qr=$t,Ur={nextAuthCallbackID:1,auth_callbacks:{},ScriptReceivers:s,DependenciesReceivers:T,getDefaultStrategy:dr,Transports:_n,transportConnectionInitializer:vr,HTTPFactory:qr,TimelineTransport:Ze,getXHRAPI:function(){return window.XMLHttpRequest},getWebSocketAPI:function(){return window.WebSocket||window.MozWebSocket},setup:function(e){var t=this;window.Pusher=e;var n=function(){t.onDocumentBody(e.ready)};window.JSON?n():S.load("json2",{},n)},getDocument:function(){return document},getProtocol:function(){return this.getDocument().location.protocol},getAuthorizers:function(){return{ajax:Se,jsonp:We}},onDocumentBody:function(e){var t=this;document.body?e():setTimeout(function(){t.onDocumentBody(e)},0)},createJSONPRequest:function(e,t){return new Ke(e,t)},createScrip
Line truncated
|
||||
/*! Bundled license information:
|
||||
|
||||
pusher-js/dist/web/pusher.js:
|
||||
(*!
|
||||
* Pusher JavaScript Library v7.6.0
|
||||
* https://pusher.com/
|
||||
*
|
||||
* Copyright 2020, Pusher
|
||||
* Released under the MIT licence.
|
||||
*)
|
||||
*/
|
||||
@@ -0,0 +1 @@
|
||||
function $({statePath:s,isCollapsed:l,collapseKey:u}){return{isCollapsed:u?Alpine.$persist(l).as(u):l,collapseFromEvent(m){m.detail===s&&(this.isCollapsed=!0)},expandFromEvent(m){m.detail===s&&(this.isCollapsed=!1)},expand(){this.isCollapsed=!1},toggleCollapsed(){this.isCollapsed=!this.isCollapsed},get itemClasses(){return{"fi-collapsed":this.isCollapsed}}}}function y({schemaComponent:s,moveUpAction:l,moveDownAction:u,reorderAction:m,message:S,hasCustomReorderAction:x}){let A=e=>JSON.stringify({name:e?.name,arguments:e?.arguments,context:e?.context});return{pending:null,frame:null,destroyed:!1,listeners:[],removeCommitHook:null,init(){let e=(t,o,a,p=!0)=>{t.addEventListener(o,a,p),this.listeners.push(()=>t.removeEventListener(o,a,p))};e(document,"pointerdown",t=>{this.pending?.control?.contains(t.target)||this.relinquishFocus()}),e(document,"keydown",t=>{t.key==="Tab"&&this.relinquishFocus()}),e(document,"focusin",t=>{this.pending&&t.target!==this.pending.control&&this.relinquishFocus()}),e(this.$root,"click",t=>{let o=t.target.closest("[data-reorder-direction]");if(!(!o||!this.owns(o))){if(this.pending){t.preventDefault(),t.stopImmediatePropagation();return}!o.dataset.reorderAction?.startsWith("mountAction(")||o.getAttribute("wire:click")!==o.dataset.reorderAction||o.getAttributeNames().some(a=>a==="wire:confirm"||a.startsWith("wire:confirm."))||o.disabled||this.begin(o.closest("[x-sortable-item]").getAttribute("x-sortable-item"),o.dataset.reorderDirection,o)}}),e(this.$root,"start",t=>{t.target===this.$refs.reorderItems&&this.begin(t.item.getAttribute("x-sortable-item"),"drag")}),e(this.$root,"end",t=>{if(t.target===this.$refs.reorderItems){if(t.oldDraggableIndex===t.newDraggableIndex){this.finish(),t.stopImmediatePropagation();return}this.setSortingDisabled(!0)}}),this.removeCommitHook=Livewire.hook("commit",({component:t,commit:o,succeed:a,fail:p})=>{let r=this.pending;if(t.id!==this.$wire.$id)return;let n=[];for(let i=this.$root;i&&!(i.hasAttribute("wire:id")&&i.getAttribute("wire:id")!==t.id);i=i.parentElement){let h=i.getAttribute("wire:partial");if(h&&n.push(h),i===t.el)break}let g=i=>i.html||n.some(h=>i.partials?.[h]);if(a(({effects:i})=>{this.pending===r&&(r&&(!r.synchronizing||!g(i))||this.schedule(()=>{this.destroyed||!this.$root.isConnected||(this.updateHandles(),r?.synchronizing&&this.isCurrent(r)&&this.finish())}))}),!r||r.synchronizing)return;let c=t.canonical.mountedActions??[],d=i=>i?.context?.schemaComponent===s&&i.name===r.action&&(r.direction==="drag"||String(i.arguments?.item)===r.item),v=c.some(d)&&!d(c.at(-1));if(!o.calls.some(i=>i.method==="mountAction"?d({name:i.params[0],arguments:i.params[1],context:i.params[2]}):["callMountedAction","unmountAction"].includes(i.method)&&c.some(d)))return;let C=o.calls.some(i=>i.method==="unmountAction");a(({effects:i})=>{if(!this.isCurrent(r))return;let h=t.canonical.mountedActions??[],k=h.some(d);for(let[f,w]of r.reopenedModals??[])A(h[f])!==w&&r.reopenedModals.delete(f);if(k){r.focus=!1,r.modal=!0,this.setSortingDisabled(!0);let f=h.length-1;h.length<c.length&&r.reopenedModals?.has(f)&&this.schedule(()=>{if(!this.isCurrent(r))return;let w=t.canonical.mountedActions??[];w.length===f+1&&A(w[f])===r.reopenedModals.get(f)&&this.$dispatch("open-modal",{id:`fi-${t.id}-action-${f}`})});return}if(!g(i)||v){this.resynchronize(r);return}this.schedule(()=>this.reconcile(r))}),p(()=>{this.isCurrent(r)&&(r.focus=!1,r.modal&&C&&(r.reopenedModals??(r.reopenedModals=new Map),r.reopenedModals.set(c.length-1,A(c.at(-1))),this.$dispatch("open-modal",{id:`fi-${t.id}-action-${c.length-1}`})),!r.modal&&(r.direction==="drag"?this.resynchronize(r):this.finish()))})}),this.updateHandles()},owns(e){return e.closest("[data-reorder-owner]")===this.$root},order(){return JSON.parse(this.$root.dataset.reorderItems)},reorder(e){e.target===this.$refs.reorderItems&&this.$wire.mountAction(m,{items:e.target.sortable.toArray()},{schemaComponent:s})},begin(e,t,o=null){this.pending={item:e,direction:t,control:o,focus:!o?.hasAttribute("data-reorder-hidden")&&document.activeElement===o,before:this.order(),action:t==="drag"?m:t==="up"?l:u},t!=="drag"&&this.setSortingDisabled(!0)},relinquishFocus(){this.pending&&(this.pending.focus=!1)},isCurrent(e){return!this.destroyed&&this.$root.isConnected&&this.pending===e},schedule(e){cancelAnimationFrame(this.frame),this.frame=requestAnimationFrame(e)},resynchronize(e){this.setSortingDisabled(!0),e.synchronizing=!0,this.$wire.forceRender().catch(()=>{})},reconcile(e){if(!this.isCurrent(e))return;this.updateHandles();let t=this.order(),o=e.before.filter(n=>t.includes(n)),a=t.filter(n=>e.before.includes(n)),p=t.includes(e.item)&&o.indexOf(e.item)!==a.indexOf(e.item),r=[...this.$root.querySelectorAll("[data-reorder-description]")].find(n=>this.owns(n)&&n.dataset.reorderDescription===e.item);if(p&&r&&(this.$refs.reorderStatus.textContent=S.replace(/:label|:position|:count/g,n=>({":label":r.dataset.reorderLabel,":position":String(t.indexOf(e.item)+1Line truncated
|
||||
@@ -0,0 +1 @@
|
||||
function c(s){return s.normalize("NFD").replace(/[\u0300-\u036f]/g,"").toLowerCase()}function o({livewireId:s}){return{areAllCheckboxesChecked:!1,checkboxListOptions:[],search:"",unsubscribeLivewireHook:null,visibleCheckboxListOptions:[],init(){this.checkboxListOptions=Array.from(this.$root.querySelectorAll(".fi-fo-checkbox-list-option")),this.updateVisibleCheckboxListOptions(),this.$nextTick(()=>{this.checkIfAllCheckboxesAreChecked()}),this.unsubscribeLivewireHook=Livewire.hook("commit",({component:e,commit:t,succeed:i,fail:h,respond:r})=>{i(({snapshot:l,effect:n})=>{this.$nextTick(()=>{e.id===s&&(this.checkboxListOptions=Array.from(this.$root.querySelectorAll(".fi-fo-checkbox-list-option")),this.updateVisibleCheckboxListOptions(),this.checkIfAllCheckboxesAreChecked())})})}),this.$watch("search",()=>{this.updateVisibleCheckboxListOptions(),this.checkIfAllCheckboxesAreChecked()})},checkIfAllCheckboxesAreChecked(){this.areAllCheckboxesChecked=this.visibleCheckboxListOptions.length===this.visibleCheckboxListOptions.filter(e=>e.querySelector("input[type=checkbox]:checked, input[type=checkbox]:disabled")).length},toggleAllCheckboxes(){this.checkIfAllCheckboxesAreChecked();let e=!this.areAllCheckboxesChecked;this.visibleCheckboxListOptions.forEach(t=>{let i=t.querySelector("input[type=checkbox]");i.disabled||i.checked!==e&&(i.checked=e,i.dispatchEvent(new Event("change")))}),this.areAllCheckboxesChecked=e},updateVisibleCheckboxListOptions(){this.visibleCheckboxListOptions=this.checkboxListOptions.filter(e=>this.matchesSearch(e))},matchesSearch(e){if(["",null,void 0].includes(this.search))return!0;let t=c(this.search);return c(e.querySelector(".fi-fo-checkbox-list-option-label")?.innerText??"").includes(t)||c(e.querySelector(".fi-fo-checkbox-list-option-description")?.innerText??"").includes(t)},destroy(){this.unsubscribeLivewireHook?.()}}}export{o as default};
|
||||
@@ -0,0 +1,38 @@
|
||||
var Ms=[],bh=[];(()=>{let O="lc,34,7n,7,7b,19,,,,2,,2,,,20,b,1c,l,g,,2t,7,2,6,2,2,,4,z,,u,r,2j,b,1m,9,9,,o,4,,9,,3,,5,17,3,3b,f,,w,1j,,,,4,8,4,,3,7,a,2,t,,1m,,,,2,4,8,,9,,a,2,q,,2,2,1l,,4,2,4,2,2,3,3,,u,2,3,,b,2,1l,,4,5,,2,4,,k,2,m,6,,,1m,,,2,,4,8,,7,3,a,2,u,,1n,,,,c,,9,,14,,3,,1l,3,5,3,,4,7,2,b,2,t,,1m,,2,,2,,3,,5,2,7,2,b,2,s,2,1l,2,,,2,4,8,,9,,a,2,t,,20,,4,,2,3,,,8,,29,,2,7,c,8,2q,,2,9,b,6,22,2,r,,,,,,1j,e,,5,,2,5,b,,10,9,,2u,4,,6,,2,2,2,p,2,4,3,g,4,d,,2,2,6,,f,,jj,3,qa,3,t,3,t,2,u,2,1s,2,,7,8,,2,b,9,,19,3,3b,2,y,,3a,3,4,2,9,,6,3,63,2,2,,1m,,,7,,,,,2,8,6,a,2,,1c,h,1r,4,1c,7,,,5,,14,9,c,2,w,4,2,2,,3,1k,,,2,3,,,3,1m,8,2,2,48,3,,d,,7,4,,6,,3,2,5i,1m,,5,ek,,5f,x,2da,3,3x,,2o,w,fe,6,2x,2,n9w,4,,a,w,2,28,2,7k,,3,,4,,p,2,5,,47,2,q,i,d,,12,8,p,b,1a,3,1c,,2,4,2,2,13,,1v,6,2,2,2,2,c,,8,,1b,,1f,,,3,2,2,5,2,,,16,2,8,,6m,,2,,4,,fn4,,kh,g,g,g,a6,2,gt,,6a,,45,5,1ae,3,,2,5,4,14,3,4,,4l,2,fx,4,ar,2,49,b,4w,,1i,f,1k,3,1d,4,2,2,1x,3,10,5,,8,1q,,c,2,1g,9,a,4,2,,2n,3,2,,,2,6,,4g,,3,8,l,2,1l,2,,,,,m,,e,7,3,5,5f,8,2,3,,,n,,29,,2,6,,,2,,,2,,2,6j,,2,4,6,2,,2,r,2,2d,8,2,,,2,2y,,,,2,6,,,2t,3,2,4,,5,77,9,,2,6t,,a,2,,,4,,40,4,2,2,4,,w,a,14,6,2,4,8,,9,6,2,3,1a,d,,2,ba,7,,6,,,2a,m,2,7,,2,,2,3e,6,3,,,2,,7,,,20,2,3,,,,9n,2,f0b,5,1n,7,t4,,1r,4,29,,f5k,2,43q,,,3,4,5,8,8,2,7,u,4,44,3,1iz,1j,4,1e,8,,e,,m,5,,f,11s,7,,h,2,7,,2,,5,79,7,c5,4,15s,7,31,7,240,5,gx7k,2o,3k,6o".split(",").map(e=>e?parseInt(e,36):1);for(let e=0,t=0;e<O.length;e++)(e%2?bh:Ms).push(t=t+O[e])})();function Lg(O){if(O<768)return!1;for(let e=0,t=Ms.length;;){let i=e+t>>1;if(O<Ms[i])t=i;else if(O>=bh[i])e=i+1;else return!0;if(e==t)return!1}}function Xh(O){return O>=127462&&O<=127487}var Th=8205;function xh(O,e,t=!0,i=!0){return(t?wh:Mg)(O,e,i)}function wh(O,e,t){if(e==O.length)return e;e&&kh(O.charCodeAt(e))&&vh(O.charCodeAt(e-1))&&e--;let i=Ls(O,e);for(e+=yh(i);e<O.length;){let r=Ls(O,e);if(i==Th||r==Th||t&&Lg(r))e+=yh(r),i=r;else if(Xh(r)){let n=0,s=e-2;for(;s>=0&&Xh(Ls(O,s));)n++,s-=2;if(n%2==0)break;e+=2}else break}return e}function Mg(O,e,t){for(;e>0;){let i=wh(O,e-2,t);if(i<e)return i;e--}return 0}function Ls(O,e){let t=O.charCodeAt(e);if(!vh(t)||e+1==O.length)return t;let i=O.charCodeAt(e+1);return kh(i)?(t-55296<<10)+(i-56320)+65536:t}function kh(O){return O>=56320&&O<57344}function vh(O){return O>=55296&&O<56320}function yh(O){return O<65536?1:2}var E=class O{lineAt(e){if(e<0||e>this.length)throw new RangeError(`Invalid position ${e} in document of length ${this.length}`);return this.lineInner(e,!1,1,0)}line(e){if(e<1||e>this.lines)throw new RangeError(`Invalid line number ${e} in ${this.lines}-line document`);return this.lineInner(e,!0,1,0)}replace(e,t,i){[e,t]=HO(this,e,t);let r=[];return this.decompose(0,e,r,2),i.length&&i.decompose(0,i.length,r,3),this.decompose(t,this.length,r,1),BO.from(r,this.length-(t-e)+i.length)}append(e){return this.replace(this.length,this.length,e)}slice(e,t=this.length){[e,t]=HO(this,e,t);let i=[];return this.decompose(e,t,i,0),BO.from(i,t-e)}eq(e){if(e==this)return!0;if(e.length!=this.length||e.lines!=this.lines)return!1;let t=this.scanIdentical(e,1),i=this.length-this.scanIdentical(e,-1),r=new pO(this),n=new pO(e);for(let s=t,a=t;;){if(r.next(s),n.next(s),s=0,r.lineBreak!=n.lineBreak||r.done!=n.done||r.value!=n.value)return!1;if(a+=r.value.length,r.done||a>=i)return!0}}iter(e=1){return new pO(this,e)}iterRange(e,t=this.length){return new Mr(this,e,t)}iterLines(e,t){let i;if(e==null)i=this.iter();else{t==null&&(t=this.lines+1);let r=this.line(e).from;i=this.iterRange(r,Math.max(r,t==this.lines+1?this.length:t<=1?0:this.line(t-1).to))}return new Dr(i)}toString(){return this.sliceString(0)}toJSON(){let e=[];return this.flatten(e),e}constructor(){}static of(e){if(e.length==0)throw new RangeError("A document must have at least one line");return e.length==1&&!e[0]?O.empty:e.length<=32?new Le(e):BO.from(Le.split(e,[]))}},Le=class O extends E{constructor(e,t=Dg(e)){super(),this.text=e,this.length=t}get lines(){return this.text.length}get children(){return null}lineInner(e,t,i,r){for(let n=0;;n++){let s=this.text[n],a=r+s.length;if((t?i:a)>=e)return new Is(r,a,i,s);r=a+1,i++}}decompose(e,t,i,r){let n=e<=0&&t>=this.length?this:new O(Yh(this.text,e,t),Math.min(t,this.length)-Math.max(0,e));if(r&1){let s=i.pop(),a=Lr(n.text,s.text.slice(),0,n.length);if(a.length<=32)i.push(new O(a,s.length+n.length));else{let o=a.length>>1;i.push(new O(a.slice(0,o)),new O(a.slice(o)))}}else i.push(n)}replace(e,t,i){if(!(i instanceof O))return super.replace(e,t,i);[e,t]=HO(this,e,t);let r=Lr(this.text,Lr(i.text,Yh(this.text,0,e)),t),n=this.length+i.length-(t-e);return r.length<=32?new O(r,n):BO.from(O.split(r,[]),n)}sliceString(e,t=this.length,i=`
|
||||
`){[e,t]=HO(this,e,t);let r="";for(let n=0,s=0;n<=t&&s<this.text.length;s++){let a=this.text[s],o=n+a.length;n>e&&s&&(r+=i),e<o&&t>n&&(r+=a.slice(Math.max(0,e-n),t-n)),n=o+1}return r}flatten(e){for(let t of this.text)e.push(t)}scanIdentical(){return 0}static split(e,t){let i=[],r=-1;for(let n of e)i.push(n),r+=n.length+1,i.length==32&&(t.push(new O(i,r)),i=[],r=-1);return r>-1&&t.push(new O(i,r)),t}},BO=class O extends E{constructor(e,t){super(),this.children=e,this.length=t,this.lines=0;for(let i of e)this.lines+=i.lines}lineInner(e,t,i,r){for(let n=0;;n++){let s=this.children[n],a=r+s.length,o=i+s.lines-1;if((t?o:a)>=e)return s.lineInner(e,t,i,r);r=a+1,i=o+1}}decompose(e,t,i,r){for(let n=0,s=0;s<=t&&n<this.children.length;n++){let a=this.children[n],o=s+a.length;if(e<=o&&t>=s){let l=r&((s<=e?1:0)|(o>=t?2:0));s>=e&&o<=t&&!l?i.push(a):a.decompose(e-s,t-s,i,l)}s=o+1}}replace(e,t,i){if([e,t]=HO(this,e,t),i.lines<this.lines)for(let r=0,n=0;r<this.children.length;r++){let s=this.children[r],a=n+s.length;if(e>=n&&t<=a){let o=s.replace(e-n,t-n,i),l=this.lines-s.lines+o.lines;if(o.lines<l>>4&&o.lines>l>>6){let c=this.children.slice();return c[r]=o,new O(c,this.length-(t-e)+i.length)}return super.replace(n,a,o)}n=a+1}return super.replace(e,t,i)}sliceString(e,t=this.length,i=`
|
||||
`){[e,t]=HO(this,e,t);let r="";for(let n=0,s=0;n<this.children.length&&s<=t;n++){let a=this.children[n],o=s+a.length;s>e&&n&&(r+=i),e<o&&t>s&&(r+=a.sliceString(e-s,t-s,i)),s=o+1}return r}flatten(e){for(let t of this.children)t.flatten(e)}scanIdentical(e,t){if(!(e instanceof O))return 0;let i=0,[r,n,s,a]=t>0?[0,0,this.children.length,e.children.length]:[this.children.length-1,e.children.length-1,-1,-1];for(;;r+=t,n+=t){if(r==s||n==a)return i;let o=this.children[r],l=e.children[n];if(o!=l)return i+o.scanIdentical(l,t);i+=o.length+1}}static from(e,t=e.reduce((i,r)=>i+r.length+1,-1)){let i=0;for(let u of e)i+=u.lines;if(i<32){let u=[];for(let $ of e)$.flatten(u);return new Le(u,t)}let r=Math.max(32,i>>5),n=r<<1,s=r>>1,a=[],o=0,l=-1,c=[];function h(u){let $;if(u.lines>n&&u instanceof O)for(let Q of u.children)h(Q);else u.lines>s&&(o>s||!o)?(f(),a.push(u)):u instanceof Le&&o&&($=c[c.length-1])instanceof Le&&u.lines+$.lines<=32?(o+=u.lines,l+=u.length+1,c[c.length-1]=new Le($.text.concat(u.text),$.length+1+u.length)):(o+u.lines>r&&f(),o+=u.lines,l+=u.length+1,c.push(u))}function f(){o!=0&&(a.push(c.length==1?c[0]:O.from(c,l)),l=-1,o=c.length=0)}for(let u of e)h(u);return f(),a.length==1?a[0]:new O(a,t)}};E.empty=new Le([""],0);function Dg(O){let e=-1;for(let t of O)e+=t.length+1;return e}function Lr(O,e,t=0,i=1e9){for(let r=0,n=0,s=!0;n<O.length&&r<=i;n++){let a=O[n],o=r+a.length;o>=t&&(o>i&&(a=a.slice(0,i-r)),r<t&&(a=a.slice(t-r)),s?(e[e.length-1]+=a,s=!1):e.push(a)),r=o+1}return e}function Yh(O,e,t){return Lr(O,[""],e,t)}var pO=class{constructor(e,t=1){this.dir=t,this.done=!1,this.lineBreak=!1,this.value="",this.nodes=[e],this.offsets=[t>0?1:(e instanceof Le?e.text.length:e.children.length)<<1]}nextInner(e,t){for(this.done=this.lineBreak=!1;;){let i=this.nodes.length-1,r=this.nodes[i],n=this.offsets[i],s=n>>1,a=r instanceof Le?r.text.length:r.children.length;if(s==(t>0?a:0)){if(i==0)return this.done=!0,this.value="",this;t>0&&this.offsets[i-1]++,this.nodes.pop(),this.offsets.pop()}else if((n&1)==(t>0?0:1)){if(this.offsets[i]+=t,e==0)return this.lineBreak=!0,this.value=`
|
||||
`,this;e--}else if(r instanceof Le){let o=r.text[s+(t<0?-1:0)];if(this.offsets[i]+=t,o.length>Math.max(0,e))return this.value=e==0?o:t>0?o.slice(e):o.slice(0,o.length-e),this;e-=o.length}else{let o=r.children[s+(t<0?-1:0)];e>o.length?(e-=o.length,this.offsets[i]+=t):(t<0&&this.offsets[i]--,this.nodes.push(o),this.offsets.push(t>0?1:(o instanceof Le?o.text.length:o.children.length)<<1))}}}next(e=0){return e<0&&(this.nextInner(-e,-this.dir),e=this.value.length),this.nextInner(e,this.dir)}},Mr=class{constructor(e,t,i){this.value="",this.done=!1,this.cursor=new pO(e,t>i?-1:1),this.pos=t>i?e.length:0,this.from=Math.min(t,i),this.to=Math.max(t,i)}nextInner(e,t){if(t<0?this.pos<=this.from:this.pos>=this.to)return this.value="",this.done=!0,this;e+=Math.max(0,t<0?this.pos-this.to:this.from-this.pos);let i=t<0?this.pos-this.from:this.to-this.pos;e>i&&(e=i),i-=e;let{value:r}=this.cursor.next(e);return this.pos+=(r.length+e)*t,this.value=r.length<=i?r:t<0?r.slice(r.length-i):r.slice(0,i),this.done=!this.value,this}next(e=0){return e<0?e=Math.max(e,this.from-this.pos):e>0&&(e=Math.min(e,this.to-this.pos)),this.nextInner(e,this.cursor.dir)}get lineBreak(){return this.cursor.lineBreak&&this.value!=""}},Dr=class{constructor(e){this.inner=e,this.afterBreak=!0,this.value="",this.done=!1}next(e=0){let{done:t,lineBreak:i,value:r}=this.inner.next(e);return t&&this.afterBreak?(this.value="",this.afterBreak=!1):t?(this.done=!0,this.value=""):i?this.afterBreak?this.value="":(this.afterBreak=!0,this.next()):(this.value=r,this.afterBreak=!1),this}get lineBreak(){return!1}};typeof Symbol<"u"&&(E.prototype[Symbol.iterator]=function(){return this.iter()},pO.prototype[Symbol.iterator]=Mr.prototype[Symbol.iterator]=Dr.prototype[Symbol.iterator]=function(){return this});var Is=class{constructor(e,t,i,r){this.from=e,this.to=t,this.number=i,this.text=r}get length(){return this.to-this.from}};function HO(O,e,t){return e=Math.max(0,Math.min(O.length,e)),[e,Math.max(e,Math.min(O.length,t))]}function ue(O,e,t=!0,i=!0){return xh(O,e,t,i)}function Ig(O){return O>=56320&&O<57344}function Bg(O){return O>=55296&&O<56320}function Se(O,e){let t=O.charCodeAt(e);if(!Bg(t)||e+1==O.length)return t;let i=O.charCodeAt(e+1);return Ig(i)?(t-55296<<10)+(i-56320)+65536:t}function Ui(O){return O<=65535?String.fromCharCode(O):(O-=65536,String.fromCharCode((O>>10)+55296,(O&1023)+56320))}function De(O){return O<65536?1:2}var Bs=/\r\n?|\n/,pe=(function(O){return O[O.Simple=0]="Simple",O[O.TrackDel=1]="TrackDel",O[O.TrackBefore=2]="TrackBefore",O[O.TrackAfter=3]="TrackAfter",O})(pe||(pe={})),Yt=class O{constructor(e){this.sections=e}get length(){let e=0;for(let t=0;t<this.sections.length;t+=2)e+=this.sections[t];return e}get newLength(){let e=0;for(let t=0;t<this.sections.length;t+=2){let i=this.sections[t+1];e+=i<0?this.sections[t]:i}return e}get empty(){return this.sections.length==0||this.sections.length==2&&this.sections[1]<0}iterGaps(e){for(let t=0,i=0,r=0;t<this.sections.length;){let n=this.sections[t++],s=this.sections[t++];s<0?(e(i,r,n),r+=n):r+=s,i+=n}}iterChangedRanges(e,t=!1){Ns(this,e,t)}get invertedDesc(){let e=[];for(let t=0;t<this.sections.length;){let i=this.sections[t++],r=this.sections[t++];r<0?e.push(i,r):e.push(r,i)}return new O(e)}composeDesc(e){return this.empty?e:e.empty?this:Uh(this,e)}mapDesc(e,t=!1){return e.empty?this:Fs(this,e,t)}mapPos(e,t=-1,i=pe.Simple){let r=0,n=0;for(let s=0;s<this.sections.length;){let a=this.sections[s++],o=this.sections[s++],l=r+a;if(o<0){if(l>e)return n+(e-r);n+=a}else{if(i!=pe.Simple&&l>=e&&(i==pe.TrackDel&&r<e&&l>e||i==pe.TrackBefore&&r<e||i==pe.TrackAfter&&l>e))return null;if(l>e||l==e&&t<0&&!a)return e==r||t<0?n:n+o;n+=o}r=l}if(e>r)throw new RangeError(`Position ${e} is out of range for changeset of length ${r}`);return n}touchesRange(e,t=e){for(let i=0,r=0;i<this.sections.length&&r<=t;){let n=this.sections[i++],s=this.sections[i++],a=r+n;if(s>=0&&r<=t&&a>=e)return r<e&&a>t?"cover":!0;r=a}return!1}toString(){let e="";for(let t=0;t<this.sections.length;){let i=this.sections[t++],r=this.sections[t++];e+=(e?" ":"")+i+(r>=0?":"+r:"")}return e}toJSON(){return this.sections}static fromJSON(e){if(!Array.isArray(e)||e.length%2||e.some(t=>typeof t!="number"))throw new RangeError("Invalid JSON representation of ChangeDesc");return new O(e)}static create(e){return new O(e)}},ve=class O extends Yt{constructor(e,t){super(e),this.inserted=t}apply(e){if(this.length!=e.length)throw new RangeError("Applying change set to a document with the wrong length");return Ns(this,(t,i,r,n,s)=>e=e.replace(r,r+(i-t),s),!1),e}mapDesc(e,t=!1){return Fs(this,e,t,!0)}invert(e){let t=this.sections.slice(),i=[];for(let r=0,n=0;r<t.length;r+=2){let s=t[r],a=t[r+1];if(a>=0){t[r]=a,t[r+1]=s;let o=r>>1;for(;i.length<o;)i.push(E.empty);i.push(s?e.slice(n,n+s):E.empty)}n+=s}return new O(t,i)}compose(e){return this.empty?e:e.empty?this:Uh(this,e,!0)}map(e,t=!1){return e.empty?this:Fs(this,e,t,!0)}iterChanges(e,t=!1){Ns(this,e,t)}get desc(){return Yt
Line truncated
|
||||
`}get readOnly(){return this.facet(Eh)}phrase(e,...t){for(let i of this.facet(O.phrases))if(Object.prototype.hasOwnProperty.call(i,e)){e=i[e];break}return t.length&&(e=e.replace(/\$(\$|\d*)/g,(i,r)=>{if(r=="$")return"$";let n=+(r||1);return!n||n>t.length?i:t[n-1]})),e}languageDataAt(e,t,i=-1){let r=[];for(let n of this.facet(zh))for(let s of n(this,t,i))Object.prototype.hasOwnProperty.call(s,e)&&r.push(s[e]);return r}charCategorizer(e){let t=this.languageDataAt("wordChars",e);return iP(t.length?t[0]:"")}wordAt(e){let{text:t,from:i,length:r}=this.doc.lineAt(e),n=this.charCategorizer(e),s=e-i,a=e-i;for(;s>0;){let o=ue(t,s,!1);if(n(t.slice(o,s))!=ee.Word)break;s=o}for(;a<r;){let o=ue(t,a);if(n(t.slice(a,o))!=ee.Word)break;a=o}return s==a?null:S.range(s+i,a+i)}};I.allowMultipleSelections=Ks;I.tabSize=k.define({combine:O=>O.length?O[0]:4});I.lineSeparator=Wh;I.readOnly=Eh;I.phrases=k.define({compare(O,e){let t=Object.keys(O),i=Object.keys(e);return t.length==i.length&&t.every(r=>O[r]==e[r])}});I.languageData=zh;I.changeFilter=jh;I.transactionFilter=Ch;I.transactionExtender=Gh;gO.reconfigure=V.define();function xe(O,e,t={}){let i={};for(let r of O)for(let n of Object.keys(r)){let s=r[n],a=i[n];if(a===void 0)i[n]=s;else if(!(a===s||s===void 0))if(Object.hasOwnProperty.call(t,n))i[n]=t[n](a,s);else throw new Error("Config merge conflict for field "+n)}for(let r in e)i[r]===void 0&&(i[r]=e[r]);return i}var Ot=class{eq(e){return this==e}range(e,t=e){return Ri.create(e,t,this)}};Ot.prototype.startSide=Ot.prototype.endSide=0;Ot.prototype.point=!1;Ot.prototype.mapMode=pe.TrackDel;function oa(O,e){return O==e||O.constructor==e.constructor&&O.eq(e)}var Ri=class O{constructor(e,t,i){this.from=e,this.to=t,this.value=i}static create(e,t,i){return new O(e,t,i)}};function ia(O,e){return O.from-e.from||O.value.startSide-e.value.startSide}var ra=class O{constructor(e,t,i,r){this.from=e,this.to=t,this.value=i,this.maxPoint=r}get length(){return this.to[this.to.length-1]}findIndex(e,t,i,r=0){let n=i?this.to:this.from;for(let s=r,a=n.length;;){if(s==a)return s;let o=s+a>>1,l=n[o]-e||(i?this.value[o].endSide:this.value[o].startSide)-t;if(o==s)return l>=0?s:a;l>=0?a=o:s=o+1}}between(e,t,i,r){for(let n=this.findIndex(t,-1e9,!0),s=this.findIndex(i,1e9,!1,n);n<s;n++)if(r(this.from[n]+e,this.to[n]+e,this.value[n])===!1)return!1}map(e,t){let i=[],r=[],n=[],s=-1,a=-1;for(let o=0;o<this.value.length;o++){let l=this.value[o],c=this.from[o]+e,h=this.to[o]+e,f,u;if(c==h){let $=t.mapPos(c,l.startSide,l.mapMode);if($==null||(f=u=$,l.startSide!=l.endSide&&(u=t.mapPos(c,l.endSide),u<f)))continue}else if(f=t.mapPos(c,l.startSide),u=t.mapPos(h,l.endSide),f>u||f==u&&l.startSide>0&&l.endSide<=0)continue;(u-f||l.endSide-l.startSide)<0||(s<0&&(s=f),l.point&&(a=Math.max(a,u-f)),i.push(l),r.push(f-s),n.push(u-s))}return{mapped:i.length?new O(r,n,i,a):null,pos:s}}},L=class O{constructor(e,t,i,r){this.chunkPos=e,this.chunk=t,this.nextLayer=i,this.maxPoint=r}static create(e,t,i,r){return new O(e,t,i,r)}get length(){let e=this.chunk.length-1;return e<0?0:Math.max(this.chunkEnd(e),this.nextLayer.length)}get size(){if(this.isEmpty)return 0;let e=this.nextLayer.size;for(let t of this.chunk)e+=t.value.length;return e}chunkEnd(e){return this.chunkPos[e]+this.chunk[e].length}update(e){let{add:t=[],sort:i=!1,filterFrom:r=0,filterTo:n=this.length}=e,s=e.filter;if(t.length==0&&!s)return this;if(i&&(t=t.slice().sort(ia)),this.isEmpty)return t.length?O.of(t):this;let a=new Fr(this,null,-1).goto(0),o=0,l=[],c=new Me;for(;a.value||o<t.length;)if(o<t.length&&(a.from-t[o].from||a.startSide-t[o].value.startSide)>=0){let h=t[o++];c.addInner(h.from,h.to,h.value)||l.push(h)}else a.rangeIndex==1&&a.chunkIndex<this.chunk.length&&(o==t.length||this.chunkEnd(a.chunkIndex)<t[o].from)&&(!s||r>this.chunkEnd(a.chunkIndex)||n<this.chunkPos[a.chunkIndex])&&c.addChunk(this.chunkPos[a.chunkIndex],this.chunk[a.chunkIndex])?a.nextChunk():((!s||r>a.to||n<a.from||s(a.from,a.to,a.value))&&(c.addInner(a.from,a.to,a.value)||l.push(Ri.create(a.from,a.to,a.value))),a.next());return c.finishInner(this.nextLayer.isEmpty&&!l.length?O.empty:this.nextLayer.update({add:l,filter:s,filterFrom:r,filterTo:n}))}map(e){if(e.empty||this.isEmpty)return this;let t=[],i=[],r=-1;for(let s=0;s<this.chunk.length;s++){let a=this.chunkPos[s],o=this.chunk[s],l=e.touchesRange(a,a+o.length);if(l===!1)r=Math.max(r,o.maxPoint),t.push(o),i.push(e.mapPos(a));else if(l===!0){let{mapped:c,pos:h}=o.map(a,e);c&&(r=Math.max(r,c.maxPoint),t.push(c),i.push(h))}}let n=this.nextLayer.map(e);return t.length==0?n:new O(i,t,n||O.empty,r)}between(e,t,i){if(!this.isEmpty){for(let r=0;r<this.chunk.length;r++){let n=this.chunkPos[r],s=this.chunk[r];if(t>=n&&e<=n+s.length&&s.between(n,e-n,t-n,i)===!1)return}this.nextLayer.between(e,t,i)}}iter(e=0){return Vi.from([this]).goto(e)}get isEmpty(){return this.nextLayer==this}static iter(e,t=0){return Vi.from(e).goto(t)}static compare(e,t,i,r,n=-1){let s=e.filter(h=>h.maxPoint>0||!h.isEmpty&&h.maxP
Line truncated
|
||||
`)}static newName(){let e=Dh[Mh]||1;return Dh[Mh]=e+1,"\u037C"+e.toString(36)}static mount(e,t,i){let r=e[la],n=i&&i.nonce;r?n&&r.setNonce(n):r=new ca(e,n),r.mount(Array.isArray(t)?t:[t],e)}},Ih=new Map,ca=class{constructor(e,t){let i=e.ownerDocument||e,r=i.defaultView;if(!e.head&&e.adoptedStyleSheets&&r.CSSStyleSheet){let n=Ih.get(i);if(n)return e[la]=n;this.sheet=new r.CSSStyleSheet,Ih.set(i,this)}else this.styleTag=i.createElement("style"),t&&this.styleTag.setAttribute("nonce",t);this.modules=[],e[la]=this}mount(e,t){let i=this.sheet,r=0,n=0;for(let s=0;s<e.length;s++){let a=e[s],o=this.modules.indexOf(a);if(o<n&&o>-1&&(this.modules.splice(o,1),n--,o=-1),o==-1){if(this.modules.splice(n++,0,a),i)for(let l=0;l<a.rules.length;l++)i.insertRule(a.rules[l],r++)}else{for(;n<o;)r+=this.modules[n++].rules.length;r+=a.rules.length,n++}}if(i)t.adoptedStyleSheets.indexOf(this.sheet)<0&&(t.adoptedStyleSheets=[this.sheet,...t.adoptedStyleSheets]);else{let s="";for(let o=0;o<this.modules.length;o++)s+=this.modules[o].getRules()+`
|
||||
`;this.styleTag.textContent=s;let a=t.head||t;this.styleTag.parentNode!=a&&a.insertBefore(this.styleTag,a.firstChild)}}setNonce(e){this.styleTag&&this.styleTag.getAttribute("nonce")!=e&&this.styleTag.setAttribute("nonce",e)}};var _t={8:"Backspace",9:"Tab",10:"Enter",12:"NumLock",13:"Enter",16:"Shift",17:"Control",18:"Alt",20:"CapsLock",27:"Escape",32:" ",33:"PageUp",34:"PageDown",35:"End",36:"Home",37:"ArrowLeft",38:"ArrowUp",39:"ArrowRight",40:"ArrowDown",44:"PrintScreen",45:"Insert",46:"Delete",59:";",61:"=",91:"Meta",92:"Meta",106:"*",107:"+",108:",",109:"-",110:".",111:"/",144:"NumLock",145:"ScrollLock",160:"Shift",161:"Shift",162:"Control",163:"Control",164:"Alt",165:"Alt",173:"-",186:";",187:"=",188:",",189:"-",190:".",191:"/",192:"`",219:"[",220:"\\",221:"]",222:"'"},KO={48:")",49:"!",50:"@",51:"#",52:"$",53:"%",54:"^",55:"&",56:"*",57:"(",59:":",61:"+",173:"_",186:":",187:"+",188:"<",189:"_",190:">",191:"?",192:"~",219:"{",220:"|",221:"}",222:'"'},nP=typeof navigator<"u"&&/Mac/.test(navigator.platform),sP=typeof navigator<"u"&&/MSIE \d|Trident\/(?:[7-9]|\d{2,})\..*rv:(\d+)/.exec(navigator.userAgent);for(Qe=0;Qe<10;Qe++)_t[48+Qe]=_t[96+Qe]=String(Qe);var Qe;for(Qe=1;Qe<=24;Qe++)_t[Qe+111]="F"+Qe;var Qe;for(Qe=65;Qe<=90;Qe++)_t[Qe]=String.fromCharCode(Qe+32),KO[Qe]=String.fromCharCode(Qe);var Qe;for(Kr in _t)KO.hasOwnProperty(Kr)||(KO[Kr]=_t[Kr]);var Kr;function Bh(O){var e=nP&&O.metaKey&&O.shiftKey&&!O.ctrlKey&&!O.altKey||sP&&O.shiftKey&&O.key&&O.key.length==1||O.key=="Unidentified",t=!e&&O.key||(O.shiftKey?KO:_t)[O.keyCode]||O.key||"Unidentified";return t=="Esc"&&(t="Escape"),t=="Del"&&(t="Delete"),t=="Left"&&(t="ArrowLeft"),t=="Up"&&(t="ArrowUp"),t=="Right"&&(t="ArrowRight"),t=="Down"&&(t="ArrowDown"),t}function B(){var O=arguments[0];typeof O=="string"&&(O=document.createElement(O));var e=1,t=arguments[1];if(t&&typeof t=="object"&&t.nodeType==null&&!Array.isArray(t)){for(var i in t)if(Object.prototype.hasOwnProperty.call(t,i)){var r=t[i];typeof r=="string"?O.setAttribute(i,r):r!=null&&(O[i]=r)}e++}for(;e<arguments.length;e++)Nh(O,arguments[e]);return O}function Nh(O,e){if(typeof e=="string")O.appendChild(document.createTextNode(e));else if(e!=null)if(e.nodeType!=null)O.appendChild(e);else if(Array.isArray(e))for(var t=0;t<e.length;t++)Nh(O,e[t]);else throw new RangeError("Unsupported child node: "+e)}var _e=typeof navigator<"u"?navigator:{userAgent:"",vendor:"",platform:""},Pa=typeof document<"u"?document:{documentElement:{style:{}}},Sa=/Edge\/(\d+)/.exec(_e.userAgent),Uf=/MSIE \d/.test(_e.userAgent),Xa=/Trident\/(?:[7-9]|\d{2,})\..*rv:(\d+)/.exec(_e.userAgent),Zn=!!(Uf||Xa||Sa),Fh=!Zn&&/gecko\/(\d+)/i.test(_e.userAgent),ha=!Zn&&/Chrome\/(\d+)/.exec(_e.userAgent),Hh="webkitFontSmoothing"in Pa.documentElement.style,Ta=!Zn&&/Apple Computer/.test(_e.vendor),Kh=Ta&&(/Mobile\/\w+/.test(_e.userAgent)||_e.maxTouchPoints>2),Y={mac:Kh||/Mac/.test(_e.platform),windows:/Win/.test(_e.platform),linux:/Linux|X11/.test(_e.platform),ie:Zn,ie_version:Uf?Pa.documentMode||6:Xa?+Xa[1]:Sa?+Sa[1]:0,gecko:Fh,gecko_version:Fh?+(/Firefox\/(\d+)/.exec(_e.userAgent)||[0,0])[1]:0,chrome:!!ha,chrome_version:ha?+ha[1]:0,ios:Kh,android:/Android\b/.test(_e.userAgent),webkit:Hh,webkit_version:Hh?+(/\bAppleWebKit\/(\d+)/.exec(_e.userAgent)||[0,0])[1]:0,safari:Ta,safari_version:Ta?+(/\bVersion\/(\d+(\.\d+)?)/.exec(_e.userAgent)||[0,0])[1]:0,tabSize:Pa.documentElement.style.tabSize!=null?"tab-size":"-moz-tab-size"};function Qo(O,e){for(let t in O)t=="class"&&e.class?e.class+=" "+O.class:t=="style"&&e.style?e.style+=";"+O.style:e[t]=O[t];return e}var un=Object.create(null);function po(O,e,t){if(O==e)return!0;O||(O=un),e||(e=un);let i=Object.keys(O),r=Object.keys(e);if(i.length-(t&&i.indexOf(t)>-1?1:0)!=r.length-(t&&r.indexOf(t)>-1?1:0))return!1;for(let n of i)if(n!=t&&(r.indexOf(n)==-1||O[n]!==e[n]))return!1;return!0}function aP(O,e){for(let t=O.attributes.length-1;t>=0;t--){let i=O.attributes[t].name;e[i]==null&&O.removeAttribute(i)}for(let t in e){let i=e[t];t=="style"?O.style.cssText=i:O.getAttribute(t)!=i&&O.setAttribute(t,i)}}function Jh(O,e,t){let i=!1;if(e)for(let r in e)t&&r in t||(i=!0,r=="style"?O.style.cssText="":O.removeAttribute(r));if(t)for(let r in t)e&&e[r]==t[r]||(i=!0,r=="style"?O.style.cssText=t[r]:O.setAttribute(r,t[r]));return i}function oP(O){let e=Object.create(null);for(let t=0;t<O.attributes.length;t++){let i=O.attributes[t];e[i.name]=i.value}return e}var Ze=class{eq(e){return!1}updateDOM(e,t,i){return!1}compare(e){return this==e||this.constructor==e.constructor&&this.eq(e)}get estimatedHeight(){return-1}get lineBreaks(){return 0}ignoreEvent(e){return!0}coordsAt(e,t,i){return null}get isHidden(){return!1}get editable(){return!1}destroy(e){}},Te=(function(O){return O[O.Text=0]="Text",O[O.WidgetBefore=1]="WidgetBefore",O[O.WidgetAfter=2]="WidgetAfter",O[O.WidgetRange=3]="WidgetRange",O})(Te||(Te={})),_=class extends Ot{constructor(e,t,i,r){super(),this.startSide=e,this.endSide=t,this.widget=i,this.spec=r}get hLine truncated
|
||||
`,r=O.state.doc.line(r.number+(t?1:-1)),n=O.bidiSpans(r),l=O.visualLineSide(r,!t)}if(o){if(!o(c))return a}else{if(!i)return l;o=i(c)}a=l}}function GP(O,e,t){let i=O.state.charCategorizer(e),r=i(t);return n=>{let s=i(n);return r==ee.Space&&(r=s),r==s}}function EP(O,e,t,i){let r=e.head,n=t?1:-1;if(r==(t?O.state.doc.length:0))return S.cursor(r,e.assoc);let s=e.goalColumn,a,o=O.contentDOM.getBoundingClientRect(),l=O.coordsAtPos(r,e.assoc||((e.empty?t:e.head==e.from)?1:-1)),c=O.documentTop;if(l)s==null&&(s=l.left-o.left),a=n<0?l.top:l.bottom;else{let $=O.viewState.lineBlockAt(r);s==null&&(s=Math.min(o.right-o.left,O.defaultCharacterWidth*(r-$.from))),a=(n<0?$.top:$.bottom)+c}let h=o.left+s,f=O.viewState.heightOracle.textHeight>>1,u=i??f;for(let $=0;;$+=f){let Q=a+(u+$)*n,p=ja(O,{x:h,y:Q},!1,n);if(t?Q>o.bottom:Q<o.top)return S.cursor(p.pos,p.assoc);let m=O.coordsAtPos(p.pos,p.assoc),g=m?(m.top+m.bottom)/2:0;if(!m||(t?g>a:g<a))return S.cursor(p.pos,p.assoc,void 0,s)}}function Li(O,e,t){for(;;){let i=0;for(let r of O)r.between(e-1,e+1,(n,s,a)=>{if(e>n&&e<s){let o=i||t||(e-n<s-e?-1:1);e=o<0?n:s,i=o}});if(!i)return e}}function cd(O,e){let t=null;for(let i=0;i<e.ranges.length;i++){let r=e.ranges[i],n=null;if(r.empty){let s=Li(O,r.from,0);s!=r.from&&(n=S.cursor(s,-1))}else{let s=Li(O,r.from,-1),a=Li(O,r.to,1);(s!=r.from||a!=r.to)&&(n=S.range(r.from==r.anchor?s:a,r.from==r.head?s:a))}n&&(t||(t=e.ranges.slice()),t[i]=n)}return t?S.create(t,e.mainIndex):e}function ua(O,e,t){let i=Li(O.state.facet(Ki).map(r=>r(O)),t.from,e.head>t.from?-1:1);return i==t.from?t:S.cursor(i,i<t.from?1:-1)}var nt=class{constructor(e,t){this.pos=e,this.assoc=t}};function ja(O,e,t,i){let r=O.contentDOM.getBoundingClientRect(),n=r.top+O.viewState.paddingTop,{x:s,y:a}=e,o=a-n,l;for(;;){if(o<0)return new nt(0,1);if(o>O.viewState.docHeight)return new nt(O.state.doc.length,-1);if(l=O.elementAtHeight(o),i==null)break;if(l.type==Te.Text){if(i<0?l.to<O.viewport.from:l.from>O.viewport.to)break;let f=O.docView.coordsAt(i<0?l.from:l.to,i>0?-1:1);if(f&&(i<0?f.top<=o+n:f.bottom>=o+n))break}let h=O.viewState.heightOracle.textHeight/2;o=i>0?l.bottom+h:l.top-h}if(O.viewport.from>=l.to||O.viewport.to<=l.from){if(t)return null;if(l.type==Te.Text){let h=jP(O,r,l,s,a);return new nt(h,h==l.from?1:-1)}}if(l.type!=Te.Text)return o<(l.top+l.bottom)/2?new nt(l.from,1):new nt(l.to,-1);let c=O.docView.lineAt(l.from,2);return(!c||c.length!=l.length)&&(c=O.docView.lineAt(l.from,-2)),new Ca(O,s,a,O.textDirectionAt(l.from)).scanTile(c,l.from)}var Ca=class{constructor(e,t,i,r){this.view=e,this.x=t,this.y=i,this.baseDir=r,this.line=null,this.spans=null}bidiSpansAt(e){return(!this.line||this.line.from>e||this.line.to<e)&&(this.line=this.view.state.doc.lineAt(e),this.spans=this.view.bidiSpans(this.line)),this}baseDirAt(e,t){let{line:i,spans:r}=this.bidiSpansAt(e);return r[st.find(r,e-i.from,-1,t)].level==this.baseDir}dirAt(e,t){let{line:i,spans:r}=this.bidiSpansAt(e);return r[st.find(r,e-i.from,-1,t)].dir}bidiIn(e,t){let{spans:i,line:r}=this.bidiSpansAt(e);return i.length>1||i.length&&(i[0].level!=this.baseDir||i[0].to+r.from<t)}scan(e,t,i=!1){let r=0,n=e.length-1,s=new Set,a=this.bidiIn(e[0],e[n]),o,l,c=-1,h=1e9,f;e:for(;r<n;){let $=n-r,Q=r+n>>1;t:if(s.has(Q)){let m=r+Math.floor(Math.random()*$);for(let g=0;g<$;g++){if(!s.has(m)){Q=m;break t}m++,m==n&&(m=r)}break e}s.add(Q);let p=t(Q);if(p)for(let m=0;m<p.length;m++){let g=p[m],P=0;if(!(g.width==0&&p.length>1)){if(g.bottom<this.y)(!o||o.bottom<g.bottom)&&(o=g),P=1;else if(g.top>this.y)(!l||l.top>g.top)&&(l=g),P=-1;else{let x=g.left>this.x?this.x-g.left:g.right<this.x?this.x-g.right:0,X=Math.abs(x);X<h&&(c=Q,h=X,f=g),x&&(P=x<0==(this.baseDir==H.LTR)?-1:1)}P==-1&&(!a||this.baseDirAt(e[Q],1))?n=Q:P==1&&(!a||this.baseDirAt(e[Q+1],-1))&&(r=Q+1)}}}if(!f){let $=o&&(!l||this.y-o.bottom<l.top-this.y)?o:l;return this.y=($.top+$.bottom)/2,this.scan(e,t,!0)}if(h&&!i){let{top:$,bottom:Q}=f;if(o&&o.bottom>($+$+Q)/3)return this.y=o.bottom-1,this.scan(e,t,!0);if(l&&l.top<($+Q+Q)/3)return this.y=l.top+1,this.scan(e,t,!0)}let u=(a?this.dirAt(e[c],1):this.baseDir)==H.LTR;return{i:c,after:this.x>(f.left+f.right)/2==u}}scanText(e,t){let i=[];for(let n=0;n<e.length;n=ue(e.text,n))i.push(t+n);i.push(t+e.length);let r=this.scan(i,n=>{let s=i[n]-t,a=i[n+1]-t;return Hi(e.dom,s,a).getClientRects()});return r.after?new nt(i[r.i+1],-1):new nt(i[r.i],1)}scanTile(e,t){if(!e.length)return new nt(t,1);if(e.children.length==1){let a=e.children[0];if(a.isText())return this.scanText(a,t);if(a.isComposite())return this.scanTile(a,t)}let i=[t];for(let a=0,o=t;a<e.children.length;a++)i.push(o+=e.children[a].length);let r=this.scan(i,a=>{let o=e.children[a];return o.flags&48?null:(o.dom.nodeType==1?o.dom:Hi(o.dom,0,o.length)).getClientRects()}),n=e.children[r.i],s=i[r.i];return n.isText()?this.scanText(n,s):n.isComposite()?this.scanTile(n,s):r.after?new nt(i[r.i+1],-1):new nt(s,1)}},JO="\uFFFF",Ga=class{constructor(e,t){this.points=e,this.view=t,this.text="",this.line
Line truncated
|
||||
`&&O.lineWrapping&&(i&&(i=S.single(i.main.anchor-1,i.main.head-1)),t={from:n.from,to:n.to,insert:E.of([" "])}),t)return yo(O,t,i,s);if(i&&!Xn(i,n)){let a=!1,o="select";return O.inputState.lastSelectionTime>Date.now()-50&&(O.inputState.lastSelectionOrigin=="select"&&(a=!0),o=O.inputState.lastSelectionOrigin,o=="select.pointer"&&(i=cd(r.facet(Ki).map(l=>l(O)),i))),O.dispatch({selection:i,scrollIntoView:a,userEvent:o}),!0}else return!1}function yo(O,e,t,i=-1){if(Y.ios&&O.inputState.flushIOSKey(e))return!0;let r=O.state.selection.main;if(Y.android&&(e.to==r.to&&(e.from==r.from||e.from==r.from-1&&O.state.sliceDoc(e.from,r.from)==" ")&&e.insert.length==1&&e.insert.lines==2&&ni(O.contentDOM,"Enter",13)||(e.from==r.from-1&&e.to==r.to&&e.insert.length==0||i==8&&e.insert.length<e.to-e.from&&e.to>r.head)&&ni(O.contentDOM,"Backspace",8)||e.from==r.from&&e.to==r.to+1&&e.insert.length==0&&ni(O.contentDOM,"Delete",46)))return!0;let n=e.insert.toString();O.inputState.composing>=0&&O.inputState.composing++;let s,a=()=>s||(s=MP(O,e,t));return O.state.facet(Kf).some(o=>o(O,e.from,e.to,n,a))||O.dispatch(a()),!0}function MP(O,e,t){let i,r=O.state,n=r.selection.main,s=-1;if(e.from==e.to&&e.from<n.from||e.from>n.to){let o=e.from<n.from?-1:1,l=o<0?n.from:n.to,c=Li(r.facet(Ki).map(h=>h(O)),l,o);e.from==c&&(s=c)}if(s>-1)i={changes:e,selection:S.cursor(e.from+e.insert.length,-1)};else if(e.from>=n.from&&e.to<=n.to&&e.to-e.from>=(n.to-n.from)/3&&(!t||t.main.empty&&t.main.from==e.from+e.insert.length)&&O.inputState.composing<0){let o=n.from<e.from?r.sliceDoc(n.from,e.from):"",l=n.to>e.to?r.sliceDoc(e.to,n.to):"";i=r.replaceSelection(O.state.toText(o+e.insert.sliceString(0,void 0,O.state.lineBreak)+l))}else{let o=r.changes(e),l=t&&t.main.to<=o.newLength?t.main:void 0;if(r.selection.ranges.length>1&&(O.inputState.composing>=0||O.inputState.compositionPendingChange)&&e.to<=n.to+10&&e.to>=n.to-10){let c=O.state.sliceDoc(e.from,e.to),h,f=t&&ld(O,t.main.head);if(f){let $=e.insert.length-(e.to-e.from);h={from:f.from,to:f.to-$}}else h=O.state.doc.lineAt(n.head);let u=n.to-e.to;i=r.changeByRange($=>{if($.from==n.from&&$.to==n.to)return{changes:o,range:l||$.map(o)};let Q=$.to-u,p=Q-c.length;if(O.state.sliceDoc(p,Q)!=c||Q>=h.from&&p<=h.to)return{range:$};let m=r.changes({from:p,to:Q,insert:e.insert}),g=$.to-n.to;return{changes:m,range:l?S.range(Math.max(0,l.anchor+g),Math.max(0,l.head+g)):$.map(m)}})}else i={changes:o,selection:l&&r.selection.replaceRange(l)}}let a="input.type";return(O.composing||O.inputState.compositionPendingChange&&O.inputState.compositionEndedAt>Date.now()-50)&&(O.inputState.compositionPendingChange=!1,a+=".compose",O.inputState.compositionFirstChange&&(a+=".start",O.inputState.compositionFirstChange=!1)),r.update(i,{userEvent:a,scrollIntoView:!0})}function dd(O,e,t,i){let r=Math.min(O.length,e.length),n=0;for(;n<r&&O.charCodeAt(n)==e.charCodeAt(n);)n++;if(n==r&&O.length==e.length)return null;let s=O.length,a=e.length;for(;s>0&&a>0&&O.charCodeAt(s-1)==e.charCodeAt(a-1);)s--,a--;if(i=="end"){let o=Math.max(0,n-Math.min(s,a));t-=s+o-n}if(s<n&&O.length<e.length){let o=t<=n&&t>=s?n-t:0;n-=o,a=n+(a-s),s=n}else if(a<n){let o=t<=n&&t>=a?n-t:0;n-=o,s=n+(s-a),a=n}return{from:n,toA:s,toB:a}}function DP(O){let e=[];if(O.root.activeElement!=O.contentDOM)return e;let{anchorNode:t,anchorOffset:i,focusNode:r,focusOffset:n}=O.observer.selectionRange;return t&&(e.push(new Sn(t,i)),(r!=t||n!=i)&&e.push(new Sn(r,n))),e}function IP(O,e){if(O.length==0)return null;let t=O[0].pos,i=O.length==2?O[1].pos:t;return t>-1&&i>-1?S.single(t+e,i+e):null}function Xn(O,e){return e.head==O.main.head&&e.anchor==O.main.anchor}var Aa=class{setSelectionOrigin(e){this.lastSelectionOrigin=e,this.lastSelectionTime=Date.now()}constructor(e){this.view=e,this.lastKeyCode=0,this.lastKeyTime=0,this.lastTouchTime=0,this.lastTouchX=0,this.lastTouchY=0,this.lastFocusTime=0,this.lastScrollTop=0,this.lastScrollLeft=0,this.lastWheelEvent=0,this.pendingIOSKey=void 0,this.tabFocusMode=-1,this.lastSelectionOrigin=null,this.lastSelectionTime=0,this.lastContextMenu=0,this.scrollHandlers=[],this.handlers=Object.create(null),this.composing=-1,this.compositionFirstChange=null,this.compositionEndedAt=0,this.compositionPendingKey=!1,this.compositionPendingChange=!1,this.insertingText="",this.insertingTextAt=0,this.mouseSelection=null,this.draggedContent=null,this.handleEvent=this.handleEvent.bind(this),this.notifiedFocused=e.hasFocus,Y.safari&&e.contentDOM.addEventListener("input",()=>null),Y.gecko&&aS(e.contentDOM.ownerDocument)}handleEvent(e){!eS(this.view,e)||this.ignoreDuringComposition(e)||e.type=="keydown"&&this.keydown(e)||(this.view.updateState!=0?Promise.resolve().then(()=>this.runHandlers(e.type,e)):this.runHandlers(e.type,e))}runHandlers(e,t){let i=this.handlers[e];if(i){for(let r of i.observers)r(this.view,t);for(let r of i.handlers){if(t.defaultPrevented)break;if(r(this.view,t)){t.preventDefault();break}}}}ensureHandlers(e){let t=BP(e),i=this.handlers,r=this.view.content
Line truncated
|
||||
`))};if((Y.mac||Y.android)&&h.from==s-1&&/^\. ?$/.test(i.text)&&e.contentDOM.getAttribute("autocorrect")=="off"&&(h={from:a,to:o,insert:E.of([i.text.replace("."," ")])}),this.pendingContextChange=h,!e.state.readOnly){let f=this.to-this.from+(h.to-h.from+h.insert.length);yo(e,h,S.single(this.toEditorPos(i.selectionStart,f),this.toEditorPos(i.selectionEnd,f)))}this.pendingContextChange&&(this.revertPending(e.state),this.setSelection(e.state)),h.from<h.to&&!h.insert.length&&e.inputState.composing>=0&&!/[\\p{Alphabetic}\\p{Number}_]/.test(t.text.slice(Math.max(0,i.updateRangeStart-1),Math.min(t.text.length,i.updateRangeStart+1)))&&this.handlers.compositionend(i)},this.handlers.characterboundsupdate=i=>{let r=[],n=null;for(let s=this.toEditorPos(i.rangeStart),a=this.toEditorPos(i.rangeEnd);s<a;s++){let o=e.coordsForChar(s);n=o&&new DOMRect(o.left,o.top,o.right-o.left,o.bottom-o.top)||n||new DOMRect,r.push(n)}t.updateCharacterBounds(i.rangeStart,r)},this.handlers.textformatupdate=i=>{let r=[];for(let n of i.getTextFormats()){let s=n.underlineStyle,a=n.underlineThickness;if(!/none/i.test(s)&&!/none/i.test(a)){let o=this.toEditorPos(n.rangeStart),l=this.toEditorPos(n.rangeEnd);if(o<l){let c=`text-decoration: underline ${/^[a-z]/.test(s)?s+" ":s=="Dashed"?"dashed ":s=="Squiggle"?"wavy ":""}${/thin/i.test(a)?1:2}px`;r.push(_.mark({attributes:{style:c}}).range(o,l))}}}e.dispatch({effects:id.of(_.set(r))})},this.handlers.compositionstart=()=>{e.inputState.composing<0&&(e.inputState.composing=0,e.inputState.compositionFirstChange=!0)},this.handlers.compositionend=()=>{if(e.inputState.composing=-1,e.inputState.compositionFirstChange=null,this.composing){let{drifted:i}=this.composing;this.composing=null,i&&this.reset(e.state)}};for(let i in this.handlers)t.addEventListener(i,this.handlers[i]);this.measureReq={read:i=>{this.editContext.updateControlBounds(i.contentDOM.getBoundingClientRect());let r=Fi(i.root);r&&r.rangeCount&&this.editContext.updateSelectionBounds(r.getRangeAt(0).getBoundingClientRect())}}}applyEdits(e){let t=0,i=!1,r=this.pendingContextChange;return e.changes.iterChanges((n,s,a,o,l)=>{if(i)return;let c=l.length-(s-n);if(r&&s>=r.to)if(r.from==n&&r.to==s&&r.insert.eq(l)){r=this.pendingContextChange=null,t+=c,this.to+=c;return}else r=null,this.revertPending(e.state);if(n+=t,s+=t,s<=this.from)this.from+=c,this.to+=c;else if(n<this.to){if(n<this.from||s>this.to||this.to-this.from+l.length>3e4){i=!0;return}this.editContext.updateText(this.toContextPos(n),this.toContextPos(s),l.toString()),this.to+=c}t+=c}),r&&!i&&this.revertPending(e.state),!i}update(e){let t=this.pendingContextChange,i=e.startState.selection.main;this.composing&&(this.composing.drifted||!e.changes.touchesRange(i.from,i.to)&&e.transactions.some(r=>!r.isUserEvent("input.type")&&r.changes.touchesRange(this.from,this.to)))?(this.composing.drifted=!0,this.composing.editorBase=e.changes.mapPos(this.composing.editorBase)):!this.applyEdits(e)||!this.rangeIsValid(e.state)?(this.pendingContextChange=null,this.reset(e.state)):(e.docChanged||e.selectionSet||t)&&this.setSelection(e.state),(e.geometryChanged||e.docChanged||e.selectionSet)&&e.view.requestMeasure(this.measureReq)}resetRange(e){let{head:t}=e.selection.main;this.from=Math.max(0,t-1e4),this.to=Math.min(e.doc.length,t+1e4)}reset(e){this.resetRange(e),this.editContext.updateText(0,this.editContext.text.length,e.doc.sliceString(this.from,this.to)),this.setSelection(e)}revertPending(e){let t=this.pendingContextChange;this.pendingContextChange=null,this.editContext.updateText(this.toContextPos(t.from),this.toContextPos(t.from+t.insert.length),e.doc.sliceString(t.from,t.to))}setSelection(e){let{main:t}=e.selection,i=this.toContextPos(Math.max(this.from,Math.min(this.to,t.anchor))),r=this.toContextPos(t.head);(this.editContext.selectionStart!=i||this.editContext.selectionEnd!=r)&&this.editContext.updateSelection(i,r)}rangeIsValid(e){let{head:t}=e.selection.main;return!(this.from>0&&t-this.from<500||this.to<e.doc.length&&this.to-t<500||this.to-this.from>1e4*3)}toEditorPos(e,t=this.to-this.from){e=Math.min(e,t);let i=this.composing;return i&&i.drifted?i.editorBase+(e-i.contextBase):e+this.from}toContextPos(e){let t=this.composing;return t&&t.drifted?t.contextBase+(e-t.editorBase):e-this.from}destroy(){for(let e in this.handlers)this.editContext.removeEventListener(e,this.handlers[e])}},T=class O{get state(){return this.viewState.state}get viewport(){return this.viewState.viewport}get visibleRanges(){return this.viewState.visibleRanges}get inView(){return this.viewState.inView}get composing(){return!!this.inputState&&this.inputState.composing>0}get compositionStarted(){return!!this.inputState&&this.inputState.composing>=0}get root(){return this._root}get win(){return this.dom.ownerDocument.defaultView||window}constructor(e={}){var t;this.plugins=[],this.pluginMap=new Map,this.editorAttrs={},this.contentAttrs={},this.bidiCache=[],this.destroyed=!1,this.updateState=2,this.measureScheduled=-1,this.measureRe
Line truncated
|
||||
-\x7F-\x9F\xAD\u061C\u200B\u200E\u200F\u2028\u2029\u202D\u202E\u2066\u2067\u2069\uFEFF\uFFF9-\uFFFC]`,ao),RS={0:"null",7:"bell",8:"backspace",10:"newline",11:"vertical tab",13:"carriage return",27:"escape",8203:"zero width space",8204:"zero width non-joiner",8205:"zero width joiner",8206:"left-to-right mark",8207:"right-to-left mark",8232:"line separator",8237:"left-to-right override",8238:"right-to-left override",8294:"left-to-right isolate",8295:"right-to-left isolate",8297:"pop directional isolate",8233:"paragraph separator",65279:"zero width no-break space",65532:"object replacement"},Qa=null;function VS(){var O;if(Qa==null&&typeof document<"u"&&document.body){let e=document.body.style;Qa=((O=e.tabSize)!==null&&O!==void 0?O:e.MozTabSize)!=null}return Qa||!1}var fn=k.define({combine(O){let e=xe(O,{render:null,specialChars:ZS,addSpecialChars:null});return(e.replaceTabs=!VS())&&(e.specialChars=new RegExp(" |"+e.specialChars.source,ao)),e.addSpecialChars&&(e.specialChars=new RegExp(e.specialChars.source+"|"+e.addSpecialChars.source,ao)),e}});function Vd(O={}){return[fn.of(O),US()]}var wf=null;function US(){return wf||(wf=he.fromClass(class{constructor(O){this.view=O,this.decorations=_.none,this.decorationCache=Object.create(null),this.decorator=this.makeDecorator(O.state.facet(fn)),this.decorations=this.decorator.createDeco(O)}makeDecorator(O){return new so({regexp:O.specialChars,decoration:(e,t,i)=>{let{doc:r}=t.state,n=Se(e[0],0);if(n==9){let s=r.lineAt(i),a=t.state.tabSize,o=Ye(s.text,a,i-s.from);return _.replace({widget:new lo((a-o%a)*this.view.defaultCharacterWidth/this.view.scaleX)})}return this.decorationCache[n]||(this.decorationCache[n]=_.replace({widget:new oo(O,n)}))},boundary:O.replaceTabs?void 0:/[^]/})}update(O){let e=O.state.facet(fn);O.startState.facet(fn)!=e?(this.decorator=this.makeDecorator(e),this.decorations=this.decorator.createDeco(O.view)):this.decorations=this.decorator.updateDeco(O,this.decorations)}},{decorations:O=>O.decorations}))}var qS="\u2022";function zS(O){return O>=32?qS:O==10?"\u2424":String.fromCharCode(9216+O)}var oo=class extends Ze{constructor(e,t){super(),this.options=e,this.code=t}eq(e){return e.code==this.code}toDOM(e){let t=zS(this.code),i=e.state.phrase("Control character")+" "+(RS[this.code]||"0x"+this.code.toString(16)),r=this.options.render&&this.options.render(this.code,i,t);if(r)return r;let n=document.createElement("span");return n.textContent=t,n.title=i,n.setAttribute("aria-label",i),n.className="cm-specialChar",n}ignoreEvent(){return!1}},lo=class extends Ze{constructor(e){super(),this.width=e}eq(e){return e.width==this.width}toDOM(){let e=document.createElement("span");return e.textContent=" ",e.className="cm-tab",e.style.width=this.width+"px",e}ignoreEvent(){return!1}};function Ud(){return jS}var WS=_.line({class:"cm-activeLine"}),jS=he.fromClass(class{constructor(O){this.decorations=this.getDeco(O)}update(O){(O.docChanged||O.selectionSet)&&(this.decorations=this.getDeco(O.view))}getDeco(O){let e=-1,t=[];for(let i of O.state.selection.ranges){let r=O.lineBlockAt(i.head);r.from>e&&(t.push(WS.range(r.from)),e=r.from)}return _.set(t)}},{decorations:O=>O.decorations});var co=2e3;function CS(O,e,t){let i=Math.min(e.line,t.line),r=Math.max(e.line,t.line),n=[];if(e.off>co||t.off>co||e.col<0||t.col<0){let s=Math.min(e.off,t.off),a=Math.max(e.off,t.off);for(let o=i;o<=r;o++){let l=O.doc.line(o);l.length<=a&&n.push(S.range(l.from+s,l.to+a))}}else{let s=Math.min(e.col,t.col),a=Math.max(e.col,t.col);for(let o=i;o<=r;o++){let l=O.doc.line(o),c=Hr(l.text,s,O.tabSize,!0);if(c<0)n.push(S.cursor(l.to));else{let h=Hr(l.text,a,O.tabSize);n.push(S.range(l.from+c,l.from+h))}}}return n}function GS(O,e){let t=O.coordsAtPos(O.viewport.from);return t?Math.round(Math.abs((t.left-e)/O.defaultCharacterWidth)):-1}function kf(O,e){let t=O.posAtCoords({x:e.clientX,y:e.clientY},!1),i=O.state.doc.lineAt(t),r=t-i.from,n=r>co?-1:r==i.length?GS(O,e.clientX):Ye(i.text,O.state.tabSize,t-i.from);return{line:i.number,col:n,off:r}}function ES(O,e){let t=kf(O,e),i=O.state.selection;return t?{update(r){if(r.docChanged){let n=r.changes.mapPos(r.startState.doc.line(t.line).from),s=r.state.doc.lineAt(n);t={line:s.number,col:t.col,off:Math.min(t.off,s.length)},i=i.map(r.changes)}},get(r,n,s){let a=kf(O,r);if(!a)return i;let o=CS(O.state,t,a);return o.length?s?S.create(o.concat(i.ranges)):S.create(o):i}}:null}function qd(O){let e=O?.eventFilter||(t=>t.altKey&&t.button==0);return T.mouseSelectionStyle.of((t,i)=>e(i)?ES(t,i):null)}var AS={Alt:[18,O=>!!O.altKey],Control:[17,O=>!!O.ctrlKey],Shift:[16,O=>!!O.shiftKey],Meta:[91,O=>!!O.metaKey]},LS={style:"cursor: crosshair"};function zd(O={}){let[e,t]=AS[O.key||"Alt"],i=he.fromClass(class{constructor(r){this.view=r,this.isDown=!1}set(r){this.isDown!=r&&(this.isDown=r,this.view.update([]))}},{eventObservers:{keydown(r){this.set(r.keyCode==e||t(r))},keyup(r){(r.keyCode==e||!t(r))&&this.set(!1)},mousemove(r){this.set(t(r))}}});return[i,T.contentAttributes.o
Line truncated
|
||||
`:i=="r"?"\r":i=="t"?" ":"\\")}eq(e){return this.search==e.search&&this.replace==e.replace&&this.caseSensitive==e.caseSensitive&&this.regexp==e.regexp&&this.wholeWord==e.wholeWord&&this.test==e.test}create(){return this.regexp?new fl(this):new hl(this)}getCursor(e,t=0,i){let r=e.doc?e:I.create({doc:e});return i==null&&(i=r.doc.length),this.regexp?pi(this,r,t,i):Qi(this,r,t,i)}},ls=class{constructor(e){this.spec=e}};function mT(O,e,t){return(i,r,n,s)=>{if(t&&!t(i,r,n,s))return!1;let a=i>=s&&r<=s+n.length?n.slice(i-s,r-s):e.doc.sliceString(i,r);return O(a,e,i,r)}}function Qi(O,e,t,i){let r;return O.wholeWord&&(r=gT(e.doc,e.charCategorizer(e.selection.main.head))),O.test&&(r=mT(O.test,e,r)),new lO(e.doc,O.unquoted,t,i,O.caseSensitive?void 0:n=>n.toLowerCase(),r)}function gT(O,e){return(t,i,r,n)=>((n>t||n+r.length<i)&&(n=Math.max(0,t-2),r=O.sliceString(n,Math.min(O.length,i+2))),(e(cs(r,t-n))!=ee.Word||e(hs(r,t-n))!=ee.Word)&&(e(hs(r,i-n))!=ee.Word||e(cs(r,i-n))!=ee.Word))}var hl=class extends ls{constructor(e){super(e)}nextMatch(e,t,i){let r=Qi(this.spec,e,i,e.doc.length).nextOverlapping();if(r.done){let n=Math.min(e.doc.length,t+this.spec.unquoted.length);r=Qi(this.spec,e,0,n).nextOverlapping()}return r.done||r.value.from==t&&r.value.to==i?null:r.value}prevMatchInRange(e,t,i){for(let r=i;;){let n=Math.max(t,r-1e4-this.spec.unquoted.length),s=Qi(this.spec,e,n,r),a=null;for(;!s.nextOverlapping().done;)a=s.value;if(a)return a;if(n==t)return null;r-=1e4}}prevMatch(e,t,i){let r=this.prevMatchInRange(e,0,t);return r||(r=this.prevMatchInRange(e,Math.max(0,i-this.spec.unquoted.length),e.doc.length)),r&&(r.from!=t||r.to!=i)?r:null}getReplacement(e){return this.spec.unquote(this.spec.replace)}matchAll(e,t){let i=Qi(this.spec,e,0,e.doc.length),r=[];for(;!i.next().done;){if(r.length>=t)return null;r.push(i.value)}return r}highlight(e,t,i,r){let n=Qi(this.spec,e,Math.max(0,t-this.spec.unquoted.length),Math.min(i+this.spec.unquoted.length,e.doc.length));for(;!n.next().done;)r(n.value.from,n.value.to)}};function PT(O,e,t){return(i,r,n)=>(!t||t(i,r,n))&&O(n[0],e,i,r)}function pi(O,e,t,i){let r;return O.wholeWord&&(r=ST(e.charCategorizer(e.selection.main.head))),O.test&&(r=PT(O.test,e,r)),new rs(e.doc,O.search,{ignoreCase:!O.caseSensitive,test:r},t,i)}function cs(O,e){return O.slice(ue(O,e,!1),e)}function hs(O,e){return O.slice(e,ue(O,e))}function ST(O){return(e,t,i)=>!i[0].length||(O(cs(i.input,i.index))!=ee.Word||O(hs(i.input,i.index))!=ee.Word)&&(O(hs(i.input,i.index+i[0].length))!=ee.Word||O(cs(i.input,i.index+i[0].length))!=ee.Word)}var fl=class extends ls{nextMatch(e,t,i){let r=pi(this.spec,e,i,e.doc.length).next();return r.done&&(r=pi(this.spec,e,0,t).next()),r.done?null:r.value}prevMatchInRange(e,t,i){for(let r=1;;r++){let n=Math.max(t,i-r*1e4),s=pi(this.spec,e,n,i),a=null;for(;!s.next().done;)a=s.value;if(a&&(n==t||a.from>n+10))return a;if(n==t)return null}}prevMatch(e,t,i){return this.prevMatchInRange(e,0,t)||this.prevMatchInRange(e,i,e.doc.length)}getReplacement(e){return this.spec.unquote(this.spec.replace).replace(/\$([$&]|\d+)/g,(t,i)=>{if(i=="&")return e.match[0];if(i=="$")return"$";for(let r=i.length;r>0;r--){let n=+i.slice(0,r);if(n>0&&n<e.match.length)return e.match[n]+i.slice(r)}return t})}matchAll(e,t){let i=pi(this.spec,e,0,e.doc.length),r=[];for(;!i.next().done;){if(r.length>=t)return null;r.push(i.value)}return r}highlight(e,t,i,r){let n=pi(this.spec,e,Math.max(0,t-250),Math.min(i+250,e.doc.length));for(;!n.next().done;)r(n.value.from,n.value.to)}},$r=V.define(),Ql=V.define(),oO=fe.define({create(O){return new ur(dl(O).create(),null)},update(O,e){for(let t of e.effects)t.is($r)?O=new ur(t.value.create(),O.panel):t.is(Ql)&&(O=new ur(O.query,t.value?pl:null));return O},provide:O=>xO.from(O,e=>e.panel)});var ur=class{constructor(e,t){this.query=e,this.panel=t}},XT=_.mark({class:"cm-searchMatch"}),TT=_.mark({class:"cm-searchMatch cm-searchMatch-selected"}),yT=he.fromClass(class{constructor(O){this.view=O,this.decorations=this.highlight(O.state.field(oO))}update(O){let e=O.state.field(oO);(e!=O.startState.field(oO)||O.docChanged||O.selectionSet||O.viewportChanged)&&(this.decorations=this.highlight(e))}highlight({query:O,panel:e}){if(!e||!O.spec.valid)return _.none;let{view:t}=this,i=new Me;for(let r=0,n=t.visibleRanges,s=n.length;r<s;r++){let{from:a,to:o}=n[r];for(;r<s-1&&o>n[r+1].from-500;)o=n[++r].to;O.highlight(t.state,a,o,(l,c)=>{let h=t.state.selection.ranges.some(f=>f.from==l&&f.to==c);i.add(l,c,h?TT:XT)})}return i.finish()}},{decorations:O=>O.decorations});function Qr(O){return e=>{let t=e.state.field(oO,!1);return t&&t.query.spec.valid?O(e,t):Z$(e)}}var fs=Qr((O,{query:e})=>{let{to:t}=O.state.selection.main,i=e.nextMatch(O.state,t,t);if(!i)return!1;let r=S.single(i.from,i.to),n=O.state.facet(mi);return O.dispatch({selection:r,effects:[ml(O,i),n.scrollToMatch(r.main,O)],userEvent:"select.search"}),_$(O),!0}),ds=Qr((O,{query:e})=>{let{state:t}=O,{from:i}=t.selection.main,r=e.prevMatch(t,i,i);if(!r)ret
Line truncated
|
||||
\${}
|
||||
}`,{label:"select",detail:"statement",type:"keyword"}),j("case ${}:\n${}",{label:"case",type:"keyword"}),j("switch ${} {\n ${}\n}",{label:"switch",detail:"statement",type:"keyword"}),j("switch ${}.(${type}) {\n ${}\n}",{label:"switch",detail:"type statement",type:"keyword"}),j("if ${} {\n ${}\n}",{label:"if",detail:"block",type:"keyword"}),j(`if \${} {
|
||||
\${}
|
||||
} else {
|
||||
\${}
|
||||
}`,{label:"if",detail:"/ else block",type:"keyword"}),j('import ${name} "${module}"\n${}',{label:"import",detail:"declaration",type:"keyword"})],GQ=new yt,AQ=new Set(["SourceFile","Block","FunctionDecl","MethodDecl","FunctionLiteral","ForStatement","SwitchStatement","TypeSwitchStatement","IfStatement"]);function Xi(O,e){return(t,i)=>{e:for(let r=t.node.firstChild,n=0,s=null;;){for(;!r;){if(!n)break e;n--,r=s.nextSibling,s=s.parent}e&&r.name==e||r.name=="SpecList"?(n++,s=r,r=r.firstChild):(r.name=="DefName"&&i(r,O),r=r.nextSibling)}return!0}}var $b={FunctionDecl:Xi("function"),VarDecl:Xi("var","VarSpec"),ConstDecl:Xi("constant","ConstSpec"),TypeDecl:Xi("type","TypeSpec"),ImportDecl:Xi("constant","ImportSpec"),Parameter:Xi("var"),__proto__:null};function LQ(O,e){let t=GQ.get(e);if(t)return t;let i=[],r=!0;function n(s,a){let o=O.sliceString(s.from,s.to);i.push({label:o,type:a})}return e.cursor(C.IncludeAnonymous).iterate(s=>{if(r)r=!1;else if(s.name){let a=$b[s.name];if(a&&a(s,n)||AQ.has(s.name))return!1}else if(s.to-s.from>8192){for(let a of LQ(O,s.node))i.push(a);return!1}}),GQ.set(e,i),i}var EQ=/^[\w$\xa1-\uffff][\w$\d\xa1-\uffff]*$/,MQ=["String","LineComment","BlockComment","DefName","LabelName","FieldName",".","?."],Qb=O=>{let e=W(O.state).resolveInner(O.pos,-1);if(MQ.indexOf(e.name)>-1)return null;let t=e.name=="VariableName"||e.to-e.from<20&&EQ.test(O.state.sliceDoc(e.from,e.to));if(!t&&!O.explicit)return null;let i=[];for(let r=e;r;r=r.parent)AQ.has(r.name)&&(i=i.concat(LQ(O.state.doc,r)));return{options:i,from:t?e.from:O.pos,validFor:EQ}},Oc=ne.define({name:"go",parser:CQ.configure({props:[se.add({IfStatement:le({except:/^\s*({|else\b)/}),LabeledStatement:sO,"SwitchBlock SelectBlock":O=>{let e=O.textAfter,t=/^\s*\}/.test(e),i=/^\s*(case|default)\b/.test(e);return O.baseIndent+(t||i?0:O.unit)},Block:ye({closing:"}"}),BlockComment:()=>null,Statement:le({except:/^{/})}),te.add({"Block SwitchBlock SelectBlock LiteralValue InterfaceType StructType SpecList":me,BlockComment(O){return{from:O.from+2,to:O.to-2}}})]}),languageData:{closeBrackets:{brackets:["(","[","{","'",'"',"`"]},commentTokens:{line:"//",block:{open:"/*",close:"*/"}},indentOnInput:/^\s*(?:case\b|default\b|\})$/}}),pb=O=>({label:O,type:"keyword"}),mb="interface struct chan map package go return break continue goto fallthrough else defer range true false nil".split(" ").map(pb);function DQ(){let O=ub.concat(mb);return new J(Oc,[Oc.data.of({autocomplete:cO(MQ,zt(O))}),Oc.data.of({autocomplete:Qb})])}var gb=55,Pb=1,Sb=56,Xb=2,Tb=57,yb=3,IQ=4,bb=5,ac=6,tp=7,Op=8,ip=9,rp=10,xb=11,wb=12,kb=13,ic=58,vb=14,Yb=15,BQ=59,np=21,_b=23,sp=24,Zb=25,nc=27,ap=28,Rb=29,Vb=32,Ub=35,qb=37,zb=38,Wb=0,jb=1,Cb={area:!0,base:!0,br:!0,col:!0,command:!0,embed:!0,frame:!0,hr:!0,img:!0,input:!0,keygen:!0,link:!0,meta:!0,param:!0,source:!0,track:!0,wbr:!0,menuitem:!0},Gb={dd:!0,li:!0,optgroup:!0,option:!0,p:!0,rp:!0,rt:!0,tbody:!0,td:!0,tfoot:!0,th:!0,tr:!0},NQ={dd:{dd:!0,dt:!0},dt:{dd:!0,dt:!0},li:{li:!0},option:{option:!0,optgroup:!0},optgroup:{optgroup:!0},p:{address:!0,article:!0,aside:!0,blockquote:!0,dir:!0,div:!0,dl:!0,fieldset:!0,footer:!0,form:!0,h1:!0,h2:!0,h3:!0,h4:!0,h5:!0,h6:!0,header:!0,hgroup:!0,hr:!0,menu:!0,nav:!0,ol:!0,p:!0,pre:!0,section:!0,table:!0,ul:!0},rp:{rp:!0,rt:!0},rt:{rp:!0,rt:!0},tbody:{tbody:!0,tfoot:!0},td:{td:!0,th:!0},tfoot:{tbody:!0},th:{td:!0,th:!0},thead:{tbody:!0,tfoot:!0},tr:{tr:!0}};function Eb(O){return O==45||O==46||O==58||O>=65&&O<=90||O==95||O>=97&&O<=122||O>=161}var FQ=null,HQ=null,KQ=0;function sc(O,e){let t=O.pos+e;if(KQ==t&&HQ==O)return FQ;let i=O.peek(e),r="";for(;Eb(i);)r+=String.fromCharCode(i),i=O.peek(++e);return HQ=O,KQ=t,FQ=r?r.toLowerCase():i==Ab||i==Lb?void 0:null}var op=60,xs=62,oc=47,Ab=63,Lb=33,Mb=45;function JQ(O,e){this.name=O,this.parent=e}var Db=[ac,rp,tp,Op,ip],Ib=new Ee({start:null,shift(O,e,t,i){return Db.indexOf(e)>-1?new JQ(sc(i,1)||"",O):O},reduce(O,e){return e==np&&O?O.parent:O},reuse(O,e,t,i){let r=e.type.id;return r==ac||r==qb?new JQ(sc(i,1)||"",O):O},strict:!1}),Bb=new q((O,e)=>{if(O.next!=op){O.next<0&&e.context&&O.acceptToken(ic);return}O.advance();let t=O.next==oc;t&&O.advance();let i=sc(O,0);if(i===void 0)return;if(!i)return O.acceptToken(t?Yb:vb);let r=e.context?e.context.name:null;if(t){if(i==r)return O.acceptToken(xb);if(r&&Gb[r])return O.acceptToken(ic,-2);if(e.dialectEnabled(Wb))return O.acceptToken(wb);for(let n=e.context;n;n=n.parent)if(n.name==i)return;O.acceptToken(kb)}else{if(i=="script")return O.acceptToken(tp);if(i=="style")return O.acceptToken(Op);if(i=="textarea")return O.acceptToken(ip);if(Cb.hasOwnProperty(i))return O.acceptToken(rp);r&&NQ[r]&&NQ[r][i]?O.acceptToken(ic,-1):O.acceptToken(ac)}},{contextual:!0}),Nb=new q(O=>{for(let e=0,t=0;;t++){if(O.next<0){t&&O.acceptToken(BQ);break}if(O.next==Mb)e++;else if(O.next==xs&&e>=2){t>=3&&O.acceptToken(BQ,-2);break}else e=0;O.advance()}});function Fb(O){for(;O;O=O.parent)if(O.name=="svg"||O.name=="math")return!0;return!1}var Hb=new q((
Line truncated
|
||||
\${}
|
||||
} catch (\${error}) {
|
||||
\${}
|
||||
}`,{label:"try",detail:"/ catch block",type:"keyword"}),j("if (${}) {\n ${}\n}",{label:"if",detail:"block",type:"keyword"}),j(`if (\${}) {
|
||||
\${}
|
||||
} else {
|
||||
\${}
|
||||
}`,{label:"if",detail:"/ else block",type:"keyword"}),j(`class \${name} {
|
||||
constructor(\${params}) {
|
||||
\${}
|
||||
}
|
||||
}`,{label:"class",detail:"definition",type:"keyword"}),j('import {${names}} from "${module}"\n${}',{label:"import",detail:"named",type:"keyword"}),j('import ${name} from "${module}"\n${}',{label:"import",detail:"default",type:"keyword"})],Zx=pp.concat([j("interface ${name} {\n ${}\n}",{label:"interface",detail:"definition",type:"keyword"}),j("type ${name} = ${type}",{label:"type",detail:"definition",type:"keyword"}),j("enum ${name} {\n ${}\n}",{label:"enum",detail:"definition",type:"keyword"})]),up=new yt,mp=new Set(["Script","Block","FunctionExpression","FunctionDeclaration","ArrowFunction","MethodDeclaration","ForStatement"]);function xr(O){return(e,t)=>{let i=e.node.getChild("VariableDefinition");return i&&t(i,O),!0}}var Rx=["FunctionDeclaration"],Vx={FunctionDeclaration:xr("function"),ClassDeclaration:xr("class"),ClassExpression:()=>!0,EnumDeclaration:xr("constant"),TypeAliasDeclaration:xr("type"),NamespaceDeclaration:xr("namespace"),VariableDefinition(O,e){O.matchContext(Rx)||e(O,"variable")},TypeDefinition(O,e){e(O,"type")},__proto__:null};function gp(O,e){let t=up.get(e);if(t)return t;let i=[],r=!0;function n(s,a){let o=O.sliceString(s.from,s.to);i.push({label:o,type:a})}return e.cursor(C.IncludeAnonymous).iterate(s=>{if(r)r=!1;else if(s.name){let a=Vx[s.name];if(a&&a(s,n)||mp.has(s.name))return!1}else if(s.to-s.from>8192){for(let a of gp(O,s.node))i.push(a);return!1}}),up.set(e,i),i}var $p=/^[\w$\xa1-\uffff][\w$\d\xa1-\uffff]*$/,Pp=["TemplateString","String","RegExp","LineComment","BlockComment","VariableDefinition","TypeDefinition","Label","PropertyDefinition","PropertyName","PrivatePropertyDefinition","PrivatePropertyName","JSXText","JSXAttributeValue","JSXOpenTag","JSXCloseTag","JSXSelfClosingTag",".","?."];function Ux(O){let e=W(O.state).resolveInner(O.pos,-1);if(Pp.indexOf(e.name)>-1)return null;let t=e.name=="VariableName"||e.to-e.from<20&&$p.test(O.state.sliceDoc(e.from,e.to));if(!t&&!O.explicit)return null;let i=[];for(let r=e;r;r=r.parent)mp.has(r.name)&&(i=i.concat(gp(O.state.doc,r)));return{options:i,from:t?e.from:O.pos,validFor:$p}}var mt=ne.define({name:"javascript",parser:dp.configure({props:[se.add({IfStatement:le({except:/^\s*({|else\b)/}),TryStatement:le({except:/^\s*({|catch\b|finally\b)/}),LabeledStatement:sO,SwitchBody:O=>{let e=O.textAfter,t=/^\s*\}/.test(e),i=/^\s*(case|default)\b/.test(e);return O.baseIndent+(t?0:i?1:2)*O.unit},Block:ye({closing:"}"}),ArrowFunction:O=>O.baseIndent+O.unit,"TemplateString BlockComment":()=>null,"Statement Property":le({except:/^\s*{/}),JSXElement(O){let e=/^\s*<\//.test(O.textAfter);return O.lineIndent(O.node.from)+(e?0:O.unit)},JSXEscape(O){let e=/\s*\}/.test(O.textAfter);return O.lineIndent(O.node.from)+(e?0:O.unit)},"JSXOpenTag JSXSelfClosingTag"(O){return O.column(O.node.from)+O.unit}}),te.add({"Block ClassBody SwitchBody EnumBody ObjectExpression ArrayExpression ObjectType":me,BlockComment(O){return{from:O.from+2,to:O.to-2}},JSXElement(O){let e=O.firstChild;if(!e||e.name=="JSXSelfClosingTag")return null;let t=O.lastChild;return{from:e.to,to:t.type.isError?O.to:t.from}},"JSXSelfClosingTag JSXOpenTag"(O){var e;let t=(e=O.firstChild)===null||e===void 0?void 0:e.nextSibling,i=O.lastChild;return!t||t.type.isError?null:{from:t.to,to:i.type.isError?O.to:i.from}}})]}),languageData:{closeBrackets:{brackets:["(","[","{","'",'"',"`"]},commentTokens:{line:"//",block:{open:"/*",close:"*/"}},indentOnInput:/^\s*(?:case |default:|\{|\}|<\/)$/,wordChars:"$"}}),Sp={test:O=>/^JSX/.test(O.name),facet:or({commentTokens:{block:{open:"{/*",close:"*/}"}}})},uc=mt.configure({dialect:"ts"},"typescript"),$c=mt.configure({dialect:"jsx",props:[Dn.add(O=>O.isTop?[Sp]:void 0)]}),Qc=mt.configure({dialect:"jsx ts",props:[Dn.add(O=>O.isTop?[Sp]:void 0)]},"typescript"),Xp=O=>({label:O,type:"keyword"}),Tp="break case const continue default delete export extends false finally in instanceof let new return static super switch this throw true typeof var yield".split(" ").map(Xp),qx=Tp.concat(["declare","implements","private","protected","public"].map(Xp));function ws(O={}){let e=O.jsx?O.typescript?Qc:$c:O.typescript?uc:mt,t=O.typescript?Zx.concat(qx):pp.concat(Tp);return new J(e,[mt.data.of({autocomplete:cO(Pp,zt(t))}),mt.data.of({autocomplete:Ux}),O.jsx?jx:[]])}function zx(O){for(;;){if(O.name=="JSXOpenTag"||O.name=="JSXSelfClosingTag"||O.name=="JSXFragmentTag")return O;if(O.name=="JSXEscape"||!O.parent)return null;O=O.parent}}function Qp(O,e,t=O.length){for(let i=e?.firstChild;i;i=i.nextSibling)if(i.name=="JSXIdentifier"||i.name=="JSXBuiltin"||i.name=="JSXNamespacedName"||i.name=="JSXMemberExpression")return O.sliceString(i.from,Math.min(i.to,t));return""}var Wx=typeof navigator=="object"&&/Android\b/.test(navigator.userAgent),jx=T.inputHandler.of((O,e,t,i,r)=>{if((Wx?O.composing:O.compositionStarted)||O.state.readOnly||e!=t||i!=">"&&i!="/"||!mt.isActiveAt(O.state,e,-1))return!1;let n=r(),{state:s}=n,a=s.changeByRange(o=>{var l;let{head:c}=o,h=W(s).resolveInner(c-1,-1),f;if(h.
Line truncated
|
||||
`+t.scrub(),n=this.advance(r);return n>-1&&n<r.length?this.complete(e,i,n):!1}finish(e,t){return(this.stage==2||this.stage==3)&&vr(t.content,this.pos)==t.content.length?this.complete(e,t,t.content.length):!1}complete(e,t,i){return e.addLeafElement(t,M(y.LinkReference,this.start,this.start+i,this.elts)),!0}nextStage(e){return e?(this.pos=e.to-this.start,this.elts.push(e),this.stage++,!0):(e===!1&&(this.stage=-1),!1)}advance(e){for(;;){if(this.stage==-1)return-1;if(this.stage==0){if(!this.nextStage(dm(e,this.pos,this.start,!0)))return-1;if(e.charCodeAt(this.pos)!=58)return this.stage=-1;this.elts.push(M(y.LinkMark,this.pos+this.start,this.pos+this.start+1)),this.pos++}else if(this.stage==1){if(!this.nextStage(hm(e,vr(e,this.pos),this.start)))return-1}else if(this.stage==2){let t=vr(e,this.pos),i=0;if(t>this.pos){let r=fm(e,t,this.start);if(r){let n=Sc(e,r.to-this.start);n>0&&(this.nextStage(r),i=n)}}return i||(i=Sc(e,this.pos)),i>0&&i<e.length?i:-1}else return Sc(e,this.pos)}}};function Sc(O,e){for(;e<O.length;e++){let t=O.charCodeAt(e);if(t==10)break;if(!ct(t))return-1}return e}var kc=class{nextLine(e,t,i){let r=t.depth<e.stack.length?-1:Om(t),n=t.next;if(r<0)return!1;let s=M(y.HeaderMark,e.lineStart+t.pos,e.lineStart+r);return e.nextLine(),e.addLeafElement(i,M(n==61?y.SetextHeading1:y.SetextHeading2,i.start,e.prevLineEnd(),[...e.parser.parseInline(i.content,i.start),s])),!0}finish(){return!1}},sm={LinkReference(O,e){return e.content.charCodeAt(0)==91?new wc(e):null},SetextHeading(){return new kc}},Kx=[(O,e)=>tm(e)>=0,(O,e)=>Kp(e)>=0,(O,e)=>Jp(e)>=0,(O,e)=>Uc(e,O,!0)>=0,(O,e)=>qc(e,O,!0)>=0,(O,e)=>Vc(e,O,!0)>=0,(O,e)=>nm(e,O,!0)>=0],Jx={text:"",end:0},vc=class{constructor(e,t,i,r){this.parser=e,this.input=t,this.ranges=r,this.line=new yc,this.atEnd=!1,this.reusePlaceholders=new Map,this.stoppedAt=null,this.rangeI=0,this.to=r[r.length-1].to,this.lineStart=this.absoluteLineStart=this.absoluteLineEnd=r[0].from,this.block=_s.create(y.Document,0,this.lineStart,0,0),this.stack=[this.block],this.fragments=i.length?new Zc(i,t):null,this.readLine()}get parsedPos(){return this.absoluteLineStart}advance(){if(this.stoppedAt!=null&&this.absoluteLineStart>this.stoppedAt)return this.finish();let{line:e}=this;for(;;){for(let i=0;;){let r=e.depth<this.stack.length?this.stack[this.stack.length-1]:null;for(;i<e.markers.length&&(!r||e.markers[i].from<r.end);){let n=e.markers[i++];this.addNode(n.type,n.from,n.to)}if(!r)break;this.finishContext()}if(e.pos<e.text.length)break;if(!this.nextLine())return this.finish()}if(this.fragments&&this.reuseFragment(e.basePos))return null;e:for(;;){for(let i of this.parser.blockParsers)if(i){let r=i(this,e);if(r!=!1){if(r==!0)return null;e.forward();continue e}}break}let t=new Tc(this.lineStart+e.pos,e.text.slice(e.pos));for(let i of this.parser.leafBlockParsers)if(i){let r=i(this,t);r&&t.parsers.push(r)}e:for(;this.nextLine()&&e.pos!=e.text.length;){if(e.indent<e.baseIndent+4){for(let i of this.parser.endLeafBlock)if(i(this,e,t))break e}for(let i of t.parsers)if(i.nextLine(this,e,t))return null;t.content+=`
|
||||
`+e.scrub();for(let i of e.markers)t.marks.push(i)}return this.finishLeaf(t),null}stopAt(e){if(this.stoppedAt!=null&&this.stoppedAt<e)throw new RangeError("Can't move stoppedAt forward");this.stoppedAt=e}reuseFragment(e){if(!this.fragments.moveTo(this.absoluteLineStart+e,this.absoluteLineStart)||!this.fragments.matches(this.block.hash))return!1;let t=this.fragments.takeNodes(this);return t?(this.absoluteLineStart+=t,this.lineStart=um(this.absoluteLineStart,this.ranges),this.moveRangeI(),this.absoluteLineStart<this.to?(this.lineStart++,this.absoluteLineStart++,this.readLine()):(this.atEnd=!0,this.readLine()),!0):!1}get depth(){return this.stack.length}parentType(e=this.depth-1){return this.parser.nodeSet.types[this.stack[e].type]}nextLine(){return this.lineStart+=this.line.text.length,this.absoluteLineEnd>=this.to?(this.absoluteLineStart=this.absoluteLineEnd,this.atEnd=!0,this.readLine(),!1):(this.lineStart++,this.absoluteLineStart=this.absoluteLineEnd+1,this.moveRangeI(),this.readLine(),!0)}peekLine(){return this.scanLine(this.absoluteLineEnd+1).text}moveRangeI(){for(;this.rangeI<this.ranges.length-1&&this.absoluteLineStart>=this.ranges[this.rangeI].to;)this.rangeI++,this.absoluteLineStart=Math.max(this.absoluteLineStart,this.ranges[this.rangeI].from)}scanLine(e){let t=Jx;if(t.end=e,e>=this.to)t.text="";else if(t.text=this.lineChunkAt(e),t.end+=t.text.length,this.ranges.length>1){let i=this.absoluteLineStart,r=this.rangeI;for(;this.ranges[r].to<t.end;){r++;let n=this.ranges[r].from,s=this.lineChunkAt(n);t.end=n+s.length,t.text=t.text.slice(0,this.ranges[r-1].to-i)+s,i=t.end-t.text.length}}return t}readLine(){let{line:e}=this,{text:t,end:i}=this.scanLine(this.absoluteLineStart);for(this.absoluteLineEnd=i,e.reset(t);e.depth<this.stack.length;e.depth++){let r=this.stack[e.depth],n=this.parser.skipContextMarkup[r.type];if(!n)throw new Error("Unhandled block context "+y[r.type]);let s=this.line.markers.length;if(!n(r,this,e)){this.line.markers.length>s&&(r.end=this.line.markers[this.line.markers.length-1].to),e.forward();break}e.forward()}}lineChunkAt(e){let t=this.input.chunk(e),i;if(this.input.lineChunks)i=t==`
|
||||
`?"":t;else{let r=t.indexOf(`
|
||||
`);i=r<0?t:t.slice(0,r)}return e+i.length>this.to?i.slice(0,this.to-e):i}prevLineEnd(){return this.atEnd?this.lineStart:this.lineStart-1}startContext(e,t,i=0){this.block=_s.create(e,i,this.lineStart+t,this.block.hash,this.lineStart+this.line.text.length),this.stack.push(this.block)}startComposite(e,t,i=0){this.startContext(this.parser.getNodeType(e),t,i)}addNode(e,t,i){typeof e=="number"&&(e=new D(this.parser.nodeSet.types[e],xi,xi,(i??this.prevLineEnd())-t)),this.block.addChild(e,t-this.block.from)}addElement(e){this.block.addChild(e.toTree(this.parser.nodeSet),e.from-this.block.from)}addLeafElement(e,t){this.addNode(this.buffer.writeElements(_c(t.children,e.marks),-t.from).finish(t.type,t.to-t.from),t.from)}finishContext(){let e=this.stack.pop(),t=this.stack[this.stack.length-1];t.addChild(e.toTree(this.parser.nodeSet),e.from-t.from),this.block=t}finish(){for(;this.stack.length>1;)this.finishContext();return this.addGaps(this.block.toTree(this.parser.nodeSet,this.lineStart))}addGaps(e){return this.ranges.length>1?am(this.ranges,0,e.topNode,this.ranges[0].from,this.reusePlaceholders):e}finishLeaf(e){for(let i of e.parsers)if(i.finish(this,e))return;let t=_c(this.parser.parseInline(e.content,e.start),e.marks);this.addNode(this.buffer.writeElements(t,-e.start).finish(y.Paragraph,e.content.length),e.start)}elt(e,t,i,r){return typeof e=="string"?M(this.parser.getNodeType(e),t,i,r):new Rs(e,t)}get buffer(){return new Zs(this.parser.nodeSet)}};function am(O,e,t,i,r){let n=O[e].to,s=[],a=[],o=t.from+i;function l(c,h){for(;h?c>=n:c>n;){let f=O[e+1].from-n;i+=f,c+=f,e++,n=O[e].to}}for(let c=t.firstChild;c;c=c.nextSibling){l(c.from+i,!0);let h=c.from+i,f,u=r.get(c.tree);u?f=u:c.to+i>n?(f=am(O,e,c,i,r),l(c.to+i,!1)):f=c.toTree(),s.push(f),a.push(h-o)}return l(t.to+i,!1),new D(t.type,s,a,t.to+i-o,t.tree?t.tree.propValues:void 0)}var _r=class O extends eO{constructor(e,t,i,r,n,s,a,o,l){super(),this.nodeSet=e,this.blockParsers=t,this.leafBlockParsers=i,this.blockNames=r,this.endLeafBlock=n,this.skipContextMarkup=s,this.inlineParsers=a,this.inlineNames=o,this.wrappers=l,this.nodeTypes=Object.create(null);for(let c of e.types)this.nodeTypes[c.name]=c.id}createParse(e,t,i){let r=new vc(this,e,t,i);for(let n of this.wrappers)r=n(r,e,t,i);return r}configure(e){let t=Yc(e);if(!t)return this;let{nodeSet:i,skipContextMarkup:r}=this,n=this.blockParsers.slice(),s=this.leafBlockParsers.slice(),a=this.blockNames.slice(),o=this.inlineParsers.slice(),l=this.inlineNames.slice(),c=this.endLeafBlock.slice(),h=this.wrappers;if(kr(t.defineNodes)){r=Object.assign({},r);let f=i.types.slice(),u;for(let $ of t.defineNodes){let{name:Q,block:p,composite:m,style:g}=typeof $=="string"?{name:$}:$;if(f.some(X=>X.name==Q))continue;m&&(r[f.length]=(X,b,w)=>m(b,w,X.value));let P=f.length,x=m?["Block","BlockContext"]:p?P>=y.ATXHeading1&&P<=y.SetextHeading2?["Block","LeafBlock","Heading"]:["Block","LeafBlock"]:void 0;f.push(de.define({id:P,name:Q,props:x&&[[R.group,x]]})),g&&(u||(u={}),Array.isArray(g)||g instanceof Ne?u[Q]=g:Object.assign(u,g))}i=new Kt(f),u&&(i=i.extend(F(u)))}if(kr(t.props)&&(i=i.extend(...t.props)),kr(t.remove))for(let f of t.remove){let u=this.blockNames.indexOf(f),$=this.inlineNames.indexOf(f);u>-1&&(n[u]=s[u]=void 0),$>-1&&(o[$]=void 0)}if(kr(t.parseBlock))for(let f of t.parseBlock){let u=a.indexOf(f.name);if(u>-1)n[u]=f.parse,s[u]=f.leaf;else{let $=f.before?Ys(a,f.before):f.after?Ys(a,f.after)+1:a.length-1;n.splice($,0,f.parse),s.splice($,0,f.leaf),a.splice($,0,f.name)}f.endLeaf&&c.push(f.endLeaf)}if(kr(t.parseInline))for(let f of t.parseInline){let u=l.indexOf(f.name);if(u>-1)o[u]=f.parse;else{let $=f.before?Ys(l,f.before):f.after?Ys(l,f.after)+1:l.length-1;o.splice($,0,f.parse),l.splice($,0,f.name)}}return t.wrap&&(h=h.concat(t.wrap)),new O(i,n,s,a,c,r,o,l,h)}getNodeType(e){let t=this.nodeTypes[e];if(t==null)throw new RangeError(`Unknown node type '${e}'`);return t}parseInline(e,t){let i=new Rr(this,e,t);e:for(let r=t;r<i.end;){let n=i.char(r);for(let s of this.inlineParsers)if(s){let a=s(i,n,r);if(a>=0){r=a;continue e}}r++}return i.resolveMarkers(0)}};function kr(O){return O!=null&&O.length>0}function Yc(O){if(!Array.isArray(O))return O;if(O.length==0)return null;let e=Yc(O[0]);if(O.length==1)return e;let t=Yc(O.slice(1));if(!t||!e)return e||t;let i=(s,a)=>(s||xi).concat(a||xi),r=e.wrap,n=t.wrap;return{props:i(e.props,t.props),defineNodes:i(e.defineNodes,t.defineNodes),parseBlock:i(e.parseBlock,t.parseBlock),parseInline:i(e.parseInline,t.parseInline),remove:i(e.remove,t.remove),wrap:r?n?(s,a,o,l)=>r(n(s,a,o,l),a,o,l):r:n}}function Ys(O,e){let t=O.indexOf(e);if(t<0)throw new RangeError(`Position specified relative to unknown parser ${e}`);return t}var om=[de.none];for(let O=1,e;e=y[O];O++)om[O]=de.define({id:O,name:e,props:O>=y.Escape?[]:[[R.group,O in Hp?["Block","BlockContext"]:["Block","LeafBlock"]]],top:e=="Document"});var xi=[],Zs=class{constructor(e){this.nodeSet=e,this.content=[],this.nodes=[]}write(e,t,i,r=0){return t
Line truncated
|
||||
`;)n--;this.fragmentEnd=n?n-1:0}let i=this.cursor;i||(i=this.cursor=this.fragment.tree.cursor(),i.firstChild());let r=e+this.fragment.offset;for(;i.to<=r;)if(!i.parent())return!1;for(;;){if(i.from>=r)return this.fragment.from<=t;if(!i.childAfter(r))return!1}}matches(e){let t=this.cursor.tree;return t&&t.prop(R.contextHash)==e}takeNodes(e){let t=this.cursor,i=this.fragment.offset,r=this.fragmentEnd-(this.fragment.openEnd?1:0),n=e.absoluteLineStart,s=n,a=e.block.children.length,o=s,l=a;for(;;){if(t.to-i>r){if(t.type.isAnonymous&&t.firstChild())continue;break}let c=um(t.from-i,e.ranges);if(t.to-i<=e.ranges[e.rangeI].to)e.addNode(t.tree,c);else{let h=new D(e.parser.nodeSet.types[y.Paragraph],[],[],0,e.block.hashProp);e.reusePlaceholders.set(h,t.tree),e.addNode(h,c)}if(t.type.is("Block")&&(tw.indexOf(t.type.id)<0?(s=t.to-i,a=e.block.children.length):(s=o,a=l),o=t.to-i,l=e.block.children.length),!t.nextSibling())break}for(;e.block.children.length>a;)e.block.children.pop(),e.block.positions.pop();return s-n}};function um(O,e){let t=O;for(let i=1;i<e.length;i++){let r=e[i-1].to,n=e[i].from;r<O&&(t-=n-r)}return t}var Ow=F({"Blockquote/...":d.quote,HorizontalRule:d.contentSeparator,"ATXHeading1/... SetextHeading1/...":d.heading1,"ATXHeading2/... SetextHeading2/...":d.heading2,"ATXHeading3/...":d.heading3,"ATXHeading4/...":d.heading4,"ATXHeading5/...":d.heading5,"ATXHeading6/...":d.heading6,"Comment CommentBlock":d.comment,Escape:d.escape,Entity:d.character,"Emphasis/...":d.emphasis,"StrongEmphasis/...":d.strong,"Link/... Image/...":d.link,"OrderedList/... BulletList/...":d.list,"BlockQuote/...":d.quote,"InlineCode CodeText":d.monospace,"URL Autolink":d.url,"HeaderMark HardBreak QuoteMark ListMark LinkMark EmphasisMark CodeMark":d.processingInstruction,"CodeInfo LinkLabel":d.labelName,LinkTitle:d.string,Paragraph:d.content}),$m=new _r(new Kt(om).extend(Ow),Object.keys(vs).map(O=>vs[O]),Object.keys(vs).map(O=>sm[O]),Object.keys(vs),Kx,Hp,Object.keys(Xc).map(O=>Xc[O]),Object.keys(Xc),[]);function iw(O,e,t){let i=[];for(let r=O.firstChild,n=e;;r=r.nextSibling){let s=r?r.from:t;if(s>n&&i.push({from:n,to:s}),!r)break;n=r.to}return i}function Qm(O){let{codeParser:e,htmlParser:t}=O;return{wrap:kO((r,n)=>{let s=r.type.id;if(e&&(s==y.CodeBlock||s==y.FencedCode)){let a="";if(s==y.FencedCode){let l=r.node.getChild(y.CodeInfo);l&&(a=n.read(l.from,l.to))}let o=e(a);if(o)return{parser:o,overlay:l=>l.type.id==y.CodeText,bracketed:s==y.FencedCode}}else if(t&&(s==y.HTMLBlock||s==y.HTMLTag||s==y.CommentBlock))return{parser:t,overlay:iw(r.node,r.from,r.to)};return null})}}var rw={resolve:"Strikethrough",mark:"StrikethroughMark"},nw={defineNodes:[{name:"Strikethrough",style:{"Strikethrough/...":d.strikethrough}},{name:"StrikethroughMark",style:d.processingInstruction}],parseInline:[{name:"Strikethrough",parse(O,e,t){if(e!=126||O.char(t+1)!=126||O.char(t+2)==126)return-1;let i=O.slice(t-1,t),r=O.slice(t+2,t+3),n=/\s|^$/.test(i),s=/\s|^$/.test(r),a=Zr.test(i),o=Zr.test(r);return O.addDelimiter(rw,t,t+2,!s&&(!o||n||a),!n&&(!a||s||o))},after:"Emphasis"}]};function Yr(O,e,t=0,i,r=0){let n=0,s=!0,a=-1,o=-1,l=!1,c=()=>{i.push(O.elt("TableCell",r+a,r+o,O.parser.parseInline(e.slice(a,o),r+a)))};for(let h=t;h<e.length;h++){let f=e.charCodeAt(h);f==124&&!l?((!s||a>-1)&&n++,s=!1,i&&(a>-1&&c(),i.push(O.elt("TableDelimiter",h+r,h+r+1))),a=o=-1):(l||f!=32&&f!=9)&&(a<0&&(a=h),o=h+1),l=!l&&f==92}return a>-1&&(n++,i&&c()),n}function Lp(O,e){for(let t=e;t<O.length;t++){let i=O.charCodeAt(t);if(i==124)return!0;i==92&&t++}return!1}var pm=/^\|?(\s*:?-+:?\s*\|)+(\s*:?-+:?\s*)?$/,Us=class{constructor(){this.rows=null}nextLine(e,t,i){if(this.rows==null){this.rows=!1;let r;if((t.next==45||t.next==58||t.next==124)&&pm.test(r=t.text.slice(t.pos))){let n=[];Yr(e,i.content,0,n,i.start)==Yr(e,r,t.pos)&&(this.rows=[e.elt("TableHeader",i.start,i.start+i.content.length,n),e.elt("TableDelimiter",e.lineStart+t.pos,e.lineStart+t.text.length)])}}else if(this.rows){let r=[];Yr(e,t.text,t.pos,r,e.lineStart),this.rows.push(e.elt("TableRow",e.lineStart+t.pos,e.lineStart+t.text.length,r))}return!1}finish(e,t){return this.rows?(e.addLeafElement(t,e.elt("Table",t.start,t.start+t.content.length,this.rows)),!0):!1}},sw={defineNodes:[{name:"Table",block:!0},{name:"TableHeader",style:{"TableHeader/...":d.heading}},"TableRow",{name:"TableCell",style:d.content},{name:"TableDelimiter",style:d.processingInstruction}],parseBlock:[{name:"Table",leaf(O,e){return Lp(e.content,0)?new Us:null},endLeaf(O,e,t){if(t.parsers.some(r=>r instanceof Us)||!Lp(e.text,e.basePos))return!1;let i=O.peekLine();return pm.test(i)&&Yr(O,e.text,e.basePos)==Yr(O,i,e.basePos)},before:"SetextHeading"}]},Rc=class{nextLine(){return!1}finish(e,t){return e.addLeafElement(t,e.elt("Task",t.start,t.start+t.content.length,[e.elt("TaskMarker",t.start,t.start+3),...e.parser.parseInline(t.content.slice(3),t.start+3)])),!0}},aw={defineNodes:[{name:"Task",block:!0,style:d.list},{name:"TaskMarker",style:d.atom}],parseBlock:[{name
Line truncated
|
||||
|
||||
`,{label:"if",detail:"block",type:"keyword"}),j("if ${}:\n ${}\nelse:\n ${}",{label:"if",detail:"/ else block",type:"keyword"}),j("class ${name}:\n def __init__(self, ${params}):\n ${}",{label:"class",detail:"definition",type:"keyword"}),j("import ${module}",{label:"import",detail:"statement",type:"keyword"}),j("from ${module} import ${names}",{label:"from",detail:"import",type:"keyword"})],lY=cO(Og,zt(aY.concat(oY)));function Nc(O){let{node:e,pos:t}=O,i=O.lineIndent(t,-1),r=null;for(;;){let n=e.childBefore(t);if(n)if(n.name=="Comment")t=n.from;else if(n.name=="Body"||n.name=="MatchBody")O.baseIndentFor(n)+O.unit<=i&&(r=n),e=n;else if(n.name=="MatchClause")e=n;else if(n.type.is("Statement"))e=n;else break;else break}return r}function Fc(O,e){let t=O.baseIndentFor(e),i=O.lineAt(O.pos,-1),r=i.from+i.text.length;return/^\s*($|#)/.test(i.text)&&O.node.to<r+100&&!/\S/.test(O.state.sliceDoc(r,O.node.to))&&O.lineIndent(O.pos,-1)<=t||/^\s*(else:|elif |except |finally:|case\s+[^=:]+:)/.test(O.textAfter)&&O.lineIndent(O.pos,-1)>t?null:t+O.unit}var Hc=ne.define({name:"python",parser:Hm.configure({props:[se.add({Body:O=>{var e;let t=/^\s*(#|$)/.test(O.textAfter)&&Nc(O)||O.node;return(e=Fc(O,t))!==null&&e!==void 0?e:O.continue()},MatchBody:O=>{var e;let t=Nc(O);return(e=Fc(O,t||O.node))!==null&&e!==void 0?e:O.continue()},IfStatement:O=>/^\s*(else:|elif )/.test(O.textAfter)?O.baseIndent:O.continue(),"ForStatement WhileStatement":O=>/^\s*else:/.test(O.textAfter)?O.baseIndent:O.continue(),TryStatement:O=>/^\s*(except[ :]|finally:|else:)/.test(O.textAfter)?O.baseIndent:O.continue(),MatchStatement:O=>/^\s*case /.test(O.textAfter)?O.baseIndent+O.unit:O.continue(),"TupleExpression ComprehensionExpression ParamList ArgList ParenthesizedExpression":ye({closing:")"}),"DictionaryExpression DictionaryComprehensionExpression SetExpression SetComprehensionExpression":ye({closing:"}"}),"ArrayExpression ArrayComprehensionExpression":ye({closing:"]"}),MemberExpression:O=>O.baseIndent+O.unit,"String FormatString":()=>null,Script:O=>{var e;let t=Nc(O);return(e=t&&Fc(O,t))!==null&&e!==void 0?e:O.continue()}}),te.add({"ArrayExpression DictionaryExpression SetExpression TupleExpression":me,Body:(O,e)=>({from:O.from+1,to:O.to-(O.to==e.doc.length?0:1)}),"String FormatString":(O,e)=>({from:e.doc.lineAt(O.from).to,to:O.to})})]}),languageData:{closeBrackets:{brackets:["(","[","{","'",'"',"'''",'"""'],stringPrefixes:["f","fr","rf","r","u","b","br","rb","F","FR","RF","R","U","B","BR","RB"]},commentTokens:{line:"#"},indentOnInput:/^\s*([\}\]\)]|else:|elif |except |finally:|case\s+[^:]*:?)$/}});function ig(){return new J(Hc,[Hc.data.of({autocomplete:sY}),Hc.data.of({autocomplete:lY})])}var cY=36,rg=1,hY=2,wi=3,Kc=4,fY=5,dY=6,uY=7,$Y=8,QY=9,pY=10,mY=11,gY=12,PY=13,SY=14,XY=15,TY=16,yY=17,ng=18,bY=19,dg=20,ug=21,sg=22,xY=23,wY=24;function eh(O){return O>=65&&O<=90||O>=97&&O<=122||O>=48&&O<=57}function kY(O){return O>=48&&O<=57||O>=97&&O<=102||O>=65&&O<=70}function EO(O,e,t){for(let i=!1;;){if(O.next<0)return;if(O.next==e&&!i){O.advance();return}i=t&&!i&&O.next==92,O.advance()}}function vY(O,e){e:for(;;){if(O.next<0)return;if(O.next==36){O.advance();for(let t=0;t<e.length;t++){if(O.next!=e.charCodeAt(t))continue e;O.advance()}if(O.next==36){O.advance();return}}else O.advance()}}function YY(O,e){let t="[{<(".indexOf(String.fromCharCode(e)),i=t<0?e:"]}>)".charCodeAt(t);for(;;){if(O.next<0)return;if(O.next==i&&O.peek(1)==39){O.advance(2);return}O.advance()}}function th(O,e){for(;!(O.next!=95&&!eh(O.next));)e!=null&&(e+=String.fromCharCode(O.next)),O.advance();return e}function _Y(O){if(O.next==39||O.next==34||O.next==96){let e=O.next;O.advance(),EO(O,e,!1)}else th(O)}function ag(O,e){for(;O.next==48||O.next==49;)O.advance();e&&O.next==e&&O.advance()}function og(O,e){for(;;){if(O.next==46){if(e)break;e=!0}else if(O.next<48||O.next>57)break;O.advance()}if(O.next==69||O.next==101)for(O.advance(),(O.next==43||O.next==45)&&O.advance();O.next>=48&&O.next<=57;)O.advance()}function lg(O){for(;!(O.next<0||O.next==10);)O.advance()}function GO(O,e){for(let t=0;t<e.length;t++)if(e.charCodeAt(t)==O)return!0;return!1}var Jc=` \r
|
||||
`;function $g(O,e,t){let i=Object.create(null);i.true=i.false=fY,i.null=i.unknown=dY;for(let r of O.split(" "))r&&(i[r]=dg);for(let r of e.split(" "))r&&(i[r]=ug);for(let r of(t||"").split(" "))r&&(i[r]=wY);return i}var AO="array binary bit boolean char character clob date decimal double float int integer interval large national nchar nclob numeric object precision real smallint time timestamp varchar varying ",LO="absolute action add after all allocate alter and any are as asc assertion at authorization before begin between both breadth by call cascade cascaded case cast catalog check close collate collation column commit condition connect connection constraint constraints constructor continue corresponding count create cross cube current current_date current_default_transform_group current_transform_group_for_type current_path current_role current_time current_timestamp current_user cursor cycle data day deallocate declare default deferrable deferred delete depth deref desc describe descriptor deterministic diagnostics disconnect distinct do domain drop dynamic each else elseif end end-exec equals escape except exception exec execute exists exit external fetch first for foreign found from free full function general get global go goto grant group grouping handle having hold hour identity if immediate in indicator initially inner inout input insert intersect into is isolation join key language last lateral leading leave left level like limit local localtime localtimestamp locator loop map match method minute modifies module month names natural nesting new next no none not of old on only open option or order ordinality out outer output overlaps pad parameter partial path prepare preserve primary prior privileges procedure public read reads recursive redo ref references referencing relative release repeat resignal restrict result return returns revoke right role rollback rollup routine row rows savepoint schema scroll search second section select session session_user set sets signal similar size some space specific specifictype sql sqlexception sqlstate sqlwarning start state static system_user table temporary then timezone_hour timezone_minute to trailing transaction translation treat trigger under undo union unique unnest until update usage user using value values view when whenever where while with without work write year zone ",Oh={backslashEscapes:!1,hashComments:!1,spaceAfterDashes:!1,slashComments:!1,doubleQuotedStrings:!1,doubleDollarQuotedStrings:!1,unquotedBitLiterals:!1,treatBitsAsBytes:!1,charSetCasts:!1,plsqlQuotingMechanism:!1,operatorChars:"*+-%<>!=&|~^/",specialVar:"?",identifierQuotes:'"',caseInsensitiveIdentifiers:!1,words:$g(LO,AO)};function ZY(O,e,t,i){let r={};for(let n in Oh)r[n]=(O.hasOwnProperty(n)?O:Oh)[n];return e&&(r.words=$g(e,t||"",i)),r}function Qg(O){return new q(e=>{var t;let{next:i}=e;if(e.advance(),GO(i,Jc)){for(;GO(e.next,Jc);)e.advance();e.acceptToken(cY)}else if(i==36&&O.doubleDollarQuotedStrings){let r=th(e,"");e.next==36&&(e.advance(),vY(e,r),e.acceptToken(wi))}else if(i==39||i==34&&O.doubleQuotedStrings)EO(e,i,O.backslashEscapes),e.acceptToken(wi);else if(i==35&&O.hashComments||i==47&&e.next==47&&O.slashComments)lg(e),e.acceptToken(rg);else if(i==45&&e.next==45&&(!O.spaceAfterDashes||e.peek(1)==32))lg(e),e.acceptToken(rg);else if(i==47&&e.next==42){e.advance();for(let r=1;;){let n=e.next;if(e.next<0)break;if(e.advance(),n==42&&e.next==47){if(r--,e.advance(),!r)break}else n==47&&e.next==42&&(r++,e.advance())}e.acceptToken(hY)}else if((i==101||i==69)&&e.next==39)e.advance(),EO(e,39,!0),e.acceptToken(wi);else if((i==110||i==78)&&e.next==39&&O.charSetCasts)e.advance(),EO(e,39,O.backslashEscapes),e.acceptToken(wi);else if(i==95&&O.charSetCasts)for(let r=0;;r++){if(e.next==39&&r>1){e.advance(),EO(e,39,O.backslashEscapes),e.acceptToken(wi);break}if(!eh(e.next))break;e.advance()}else if(O.plsqlQuotingMechanism&&(i==113||i==81)&&e.next==39&&e.peek(1)>0&&!GO(e.peek(1),Jc)){let r=e.peek(1);e.advance(2),YY(e,r),e.acceptToken(wi)}else if(GO(i,O.identifierQuotes)){let r=i==91?93:i;EO(e,r,!1),e.acceptToken(bY)}else if(i==40)e.acceptToken(uY);else if(i==41)e.acceptToken($Y);else if(i==123)e.acceptToken(QY);else if(i==125)e.acceptToken(pY);else if(i==91)e.acceptToken(mY);else if(i==93)e.acceptToken(gY);else if(i==59)e.acceptToken(PY);else if(O.unquotedBitLiterals&&i==48&&e.next==98)e.advance(),ag(e),e.acceptToken(sg);else if((i==98||i==66)&&(e.next==39||e.next==34)){let r=e.next;e.advance(),O.treatBitsAsBytes?(EO(e,r,O.backslashEscapes),e.acceptToken(xY)):(ag(e,r),e.acceptToken(sg))}else if(i==48&&(e.next==120||e.next==88)||(i==120||i==88)&&e.next==39){let r=e.next==39;for(e.advance();kY(e.next);)e.advance();r&&e.next==39&&e.advance(),e.acceptToken(Kc)}else if(i==46&&e.next>=48&&e.next<=57)og(e,!0),e.acceptToken(Kc);else if(i==46)e.acceptToken(SY);else if(i>=48&&i<=57)og(e,!1),e.acceptToken(Kc);else if(GO(i,O.operatorChars)){for(;GO(e.next,O.operatorChars);)e.advance();e.acceptToken(XY
Line truncated
|
||||
@@ -0,0 +1 @@
|
||||
var c=(r,t=0,e=1)=>r>e?e:r<t?t:r,n=(r,t=0,e=Math.pow(10,t))=>Math.round(e*r)/e;var at={grad:360/400,turn:360,rad:360/(Math.PI*2)},F=r=>G($(r)),$=r=>(r[0]==="#"&&(r=r.substring(1)),r.length<6?{r:parseInt(r[0]+r[0],16),g:parseInt(r[1]+r[1],16),b:parseInt(r[2]+r[2],16),a:r.length===4?n(parseInt(r[3]+r[3],16)/255,2):1}:{r:parseInt(r.substring(0,2),16),g:parseInt(r.substring(2,4),16),b:parseInt(r.substring(4,6),16),a:r.length===8?n(parseInt(r.substring(6,8),16)/255,2):1}),it=(r,t="deg")=>Number(r)*(at[t]||1),lt=r=>{let e=/hsla?\(?\s*(-?\d*\.?\d+)(deg|rad|grad|turn)?[,\s]+(-?\d*\.?\d+)%?[,\s]+(-?\d*\.?\d+)%?,?\s*[/\s]*(-?\d*\.?\d+)?(%)?\s*\)?/i.exec(r);return e?ct({h:it(e[1],e[2]),s:Number(e[3]),l:Number(e[4]),a:e[5]===void 0?1:Number(e[5])/(e[6]?100:1)}):{h:0,s:0,v:0,a:1}},D=lt,ct=({h:r,s:t,l:e,a:o})=>(t*=(e<50?e:100-e)/100,{h:r,s:t>0?2*t/(e+t)*100:0,v:e+t,a:o}),J=r=>pt(O(r)),X=({h:r,s:t,v:e,a:o})=>{let s=(200-t)*e/100;return{h:n(r),s:n(s>0&&s<200?t*e/100/(s<=100?s:200-s)*100:0),l:n(s/2),a:n(o,2)}};var h=r=>{let{h:t,s:e,l:o}=X(r);return`hsl(${t}, ${e}%, ${o}%)`},S=r=>{let{h:t,s:e,l:o,a:s}=X(r);return`hsla(${t}, ${e}%, ${o}%, ${s})`},O=({h:r,s:t,v:e,a:o})=>{r=r/360*6,t=t/100,e=e/100;let s=Math.floor(r),a=e*(1-t),l=e*(1-(r-s)*t),u=e*(1-(1-r+s)*t),i=s%6;return{r:n([e,l,a,a,u,e][i]*255),g:n([u,e,e,l,a,a][i]*255),b:n([a,a,u,e,e,l][i]*255),a:n(o,2)}},Y=r=>{let{r:t,g:e,b:o}=O(r);return`rgb(${t}, ${e}, ${o})`},B=r=>{let{r:t,g:e,b:o,a:s}=O(r);return`rgba(${t}, ${e}, ${o}, ${s})`};var A=r=>{let e=/rgba?\(?\s*(-?\d*\.?\d+)(%)?[,\s]+(-?\d*\.?\d+)(%)?[,\s]+(-?\d*\.?\d+)(%)?,?\s*[/\s]*(-?\d*\.?\d+)?(%)?\s*\)?/i.exec(r);return e?G({r:Number(e[1])/(e[2]?100/255:1),g:Number(e[3])/(e[4]?100/255:1),b:Number(e[5])/(e[6]?100/255:1),a:e[7]===void 0?1:Number(e[7])/(e[8]?100:1)}):{h:0,s:0,v:0,a:1}},U=A,v=r=>{let t=r.toString(16);return t.length<2?"0"+t:t},pt=({r,g:t,b:e,a:o})=>{let s=o<1?v(n(o*255)):"";return"#"+v(r)+v(t)+v(e)+s},G=({r,g:t,b:e,a:o})=>{let s=Math.max(r,t,e),a=s-Math.min(r,t,e),l=a?s===r?(t-e)/a:s===t?2+(e-r)/a:4+(r-t)/a:0;return{h:n(60*(l<0?l+6:l)),s:n(s?a/s*100:0),v:n(s/255*100),a:o}};var L=(r,t)=>{if(r===t)return!0;for(let e in r)if(r[e]!==t[e])return!1;return!0},m=(r,t)=>r.replace(/\s/g,"")===t.replace(/\s/g,""),K=(r,t)=>r.toLowerCase()===t.toLowerCase()?!0:L($(r),$(t));var Q={},H=r=>{let t=Q[r];return t||(t=document.createElement("template"),t.innerHTML=r,Q[r]=t),t},g=(r,t,e)=>{r.dispatchEvent(new CustomEvent(t,{bubbles:!0,detail:e}))};var f=!1,I=r=>"touches"in r,ut=r=>f&&!I(r)?!1:(f||(f=I(r)),!0),W=(r,t)=>{let e=I(t)?t.touches[0]:t,o=r.el.getBoundingClientRect();g(r.el,"move",r.getMove({x:c((e.pageX-(o.left+window.pageXOffset))/o.width),y:c((e.pageY-(o.top+window.pageYOffset))/o.height)}))},dt=(r,t)=>{let e=t.keyCode;e>40||r.xy&&e<37||e<33||(t.preventDefault(),g(r.el,"move",r.getMove({x:e===39?.01:e===37?-.01:e===34?.05:e===33?-.05:e===35?1:e===36?-1:0,y:e===40?.01:e===38?-.01:0},!0)))},d=class{constructor(t,e,o,s){let a=H(`<div role="slider" tabindex="0" part="${e}" ${o}><div part="${e}-pointer"></div></div>`);t.appendChild(a.content.cloneNode(!0));let l=t.querySelector(`[part=${e}]`);l.addEventListener("mousedown",this),l.addEventListener("touchstart",this),l.addEventListener("keydown",this),this.el=l,this.xy=s,this.nodes=[l.firstChild,l]}set dragging(t){let e=t?document.addEventListener:document.removeEventListener;e(f?"touchmove":"mousemove",this),e(f?"touchend":"mouseup",this)}handleEvent(t){switch(t.type){case"mousedown":case"touchstart":if(t.preventDefault(),!ut(t)||!f&&t.button!=0)return;this.el.focus(),W(this,t),this.dragging=!0;break;case"mousemove":case"touchmove":t.preventDefault(),W(this,t);break;case"mouseup":case"touchend":this.dragging=!1;break;case"keydown":dt(this,t);break}}style(t){t.forEach((e,o)=>{for(let s in e)this.nodes[o].style.setProperty(s,e[s])})}};var w=class extends d{constructor(t){super(t,"hue",'aria-label="Hue" aria-valuemin="0" aria-valuemax="360"',!1)}update({h:t}){this.h=t,this.style([{left:`${t/360*100}%`,color:h({h:t,s:100,v:100,a:1})}]),this.el.setAttribute("aria-valuenow",`${n(t)}`)}getMove(t,e){return{h:e?c(this.h+t.x*360,0,360):360*t.x}}};var y=class extends d{constructor(t){super(t,"saturation",'aria-label="Color"',!0)}update(t){this.hsva=t,this.style([{top:`${100-t.v}%`,left:`${t.s}%`,color:h(t)},{"background-color":h({h:t.h,s:100,v:100,a:1})}]),this.el.setAttribute("aria-valuetext",`Saturation ${n(t.s)}%, Brightness ${n(t.v)}%`)}getMove(t,e){return{s:e?c(this.hsva.s+t.x*100,0,100):t.x*100,v:e?c(this.hsva.v-t.y*100,0,100):Math.round(100-t.y*100)}}};var Z=':host{display:flex;flex-direction:column;position:relative;width:200px;height:200px;user-select:none;-webkit-user-select:none;cursor:default}:host([hidden]){display:none!important}[role=slider]{position:relative;touch-action:none;user-select:none;-webkit-user-select:none;outline:0}[role=slider]:last-child{border-radius:0 0 8px 8px}[part$=pointer]{position:absolute;z-index:1;box-sizing:border-box;width:28px;height:28px;dLine truncated
|
||||
@@ -0,0 +1 @@
|
||||
var Mr=Object.create;var yi=Object.defineProperty;var yr=Object.getOwnPropertyDescriptor;var pr=Object.getOwnPropertyNames;var Yr=Object.getPrototypeOf,gr=Object.prototype.hasOwnProperty;var k=(t,e)=>()=>{try{return e||t((e={exports:{}}).exports,e),e.exports}catch(s){throw e=0,s}};var Lr=(t,e,s,i)=>{if(e&&typeof e=="object"||typeof e=="function")for(let n of pr(e))!gr.call(t,n)&&n!==s&&yi(t,n,{get:()=>e[n],enumerable:!(i=yr(e,n))||i.enumerable});return t};var Te=(t,e,s)=>(s=t!=null?Mr(Yr(t)):{},Lr(e||!t||!t.__esModule?yi(s,"default",{value:t,enumerable:!0}):s,t));var us=k((_t,mt)=>{(function(t,e){typeof _t=="object"&&typeof mt<"u"?mt.exports=e():typeof define=="function"&&define.amd?define(e):(t=typeof globalThis<"u"?globalThis:t||self).dayjs_plugin_advancedFormat=e()})(_t,(function(){"use strict";return function(t,e){var s=e.prototype,i=s.format;s.format=function(n){var r=this,a=this.$locale();if(!this.isValid())return i.bind(this)(n);var d=this.$utils(),l=(n||"YYYY-MM-DDTHH:mm:ssZ").replace(/\[([^\]]+)]|Q|wo|ww|w|WW|W|zzz|z|gggg|GGGG|Do|X|x|k{1,2}|S/g,(function(o){switch(o){case"Q":return Math.ceil((r.$M+1)/3);case"Do":return a.ordinal(r.$D);case"gggg":return r.weekYear();case"GGGG":return r.isoWeekYear();case"wo":return a.ordinal(r.week(),"W");case"w":case"ww":return d.s(r.week(),o==="w"?1:2,"0");case"W":case"WW":return d.s(r.isoWeek(),o==="W"?1:2,"0");case"k":case"kk":return d.s(String(r.$H===0?24:r.$H),o==="k"?1:2,"0");case"X":return Math.floor(r.$d.getTime()/1e3);case"x":return r.$d.getTime();case"z":return"["+r.offsetName()+"]";case"zzz":return"["+r.offsetName("long")+"]";default:return o}}));return i.bind(this)(l)}}}))});var ds=k((ht,Mt)=>{(function(t,e){typeof ht=="object"&&typeof Mt<"u"?Mt.exports=e():typeof define=="function"&&define.amd?define(e):(t=typeof globalThis<"u"?globalThis:t||self).dayjs_plugin_customParseFormat=e()})(ht,(function(){"use strict";var t={LTS:"h:mm:ss A",LT:"h:mm A",L:"MM/DD/YYYY",LL:"MMMM D, YYYY",LLL:"MMMM D, YYYY h:mm A",LLLL:"dddd, MMMM D, YYYY h:mm A"},e=/(\[[^[]*\])|([-_:/.,()\s]+)|(A|a|Q|YYYY|YY?|ww?|MM?M?M?|Do|DD?|hh?|HH?|mm?|ss?|S{1,3}|z|ZZ?)/g,s=/\d/,i=/\d\d/,n=/\d\d?/,r=/\d*[^-_:/,()\s\d]+/,a={},d=function(m){return(m=+m)+(m>68?1900:2e3)},l=function(m){return function(h){this[m]=+h}},o=[/[+-]\d\d:?(\d\d)?|Z/,function(m){(this.zone||(this.zone={})).offset=(function(h){if(!h||h==="Z")return 0;var p=h.match(/([+-]|\d\d)/g),M=60*p[1]+(+p[2]||0);return M===0?0:p[0]==="+"?-M:M})(m)}],u=function(m){var h=a[m];return h&&(h.indexOf?h:h.s.concat(h.f))},f=function(m,h){var p,M=a.meridiem;if(M){for(var D=1;D<=24;D+=1)if(m.indexOf(M(D,0,h))>-1){p=D>12;break}}else p=m===(h?"pm":"PM");return p},c={A:[r,function(m){this.afternoon=f(m,!1)}],a:[r,function(m){this.afternoon=f(m,!0)}],Q:[s,function(m){this.month=3*(m-1)+1}],S:[s,function(m){this.milliseconds=100*+m}],SS:[i,function(m){this.milliseconds=10*+m}],SSS:[/\d{3}/,function(m){this.milliseconds=+m}],s:[n,l("seconds")],ss:[n,l("seconds")],m:[n,l("minutes")],mm:[n,l("minutes")],H:[n,l("hours")],h:[n,l("hours")],HH:[n,l("hours")],hh:[n,l("hours")],D:[n,l("day")],DD:[i,l("day")],Do:[r,function(m){var h=a.ordinal,p=m.match(/\d+/);if(this.day=p[0],h)for(var M=1;M<=31;M+=1)h(M).replace(/\[|\]/g,"")===m&&(this.day=M)}],w:[n,l("week")],ww:[i,l("week")],M:[n,l("month")],MM:[i,l("month")],MMM:[r,function(m){var h=u("months"),p=(u("monthsShort")||h.map((function(M){return M.slice(0,3)}))).indexOf(m)+1;if(p<1)throw new Error;this.month=p%12||p}],MMMM:[r,function(m){var h=u("months").indexOf(m)+1;if(h<1)throw new Error;this.month=h%12||h}],Y:[/[+-]?\d+/,l("year")],YY:[i,function(m){this.year=d(m)}],YYYY:[/\d{4}/,l("year")],Z:o,ZZ:o};function _(m){var h,p;h=m,p=a&&a.formats;for(var M=(m=h.replace(/(\[[^\]]+])|(LTS?|l{1,4}|L{1,4})/g,(function(O,$,q){var I=q&&q.toUpperCase();return $||p[q]||t[q]||p[I].replace(/(\[[^\]]+])|(MMMM|MM|DD|dddd)/g,(function(S,g,y){return g||y.slice(1)}))}))).match(e),D=M.length,L=0;L<D;L+=1){var T=M[L],x=c[T],C=x&&x[0],A=x&&x[1];M[L]=A?{regex:C,parser:A}:T.replace(/^\[|\]$/g,"")}return function(O){for(var $={},q=0,I=0;q<D;q+=1){var S=M[q];if(typeof S=="string")I+=S.length;else{var g=S.regex,y=S.parser,v=O.slice(I),Y=g.exec(v)[0];y.call($,Y),O=O.replace(Y,"")}}return(function(w){var b=w.afternoon;if(b!==void 0){var H=w.hours;b?H<12&&(w.hours+=12):H===12&&(w.hours=0),delete w.afternoon}})($),$}}return function(m,h,p){p.p.customParseFormat=!0,m&&m.parseTwoDigitYear&&(d=m.parseTwoDigitYear);var M=h.prototype,D=M.parse;M.parse=function(L){var T=L.date,x=L.utc,C=L.args;this.$u=x;var A=C[1];if(typeof A=="string"){var O=C[2]===!0,$=C[3]===!0,q=O||$,I=C[2];$&&(I=C[2]),a=this.$locale(),!O&&I&&(a=p.Ls[I]),this.$d=(function(v,Y,w,b){try{if(["x","X"].indexOf(Y)>-1)return new Date((Y==="X"?1e3:1)*v);var H=_(Y)(v),R=H.year,F=H.month,P=H.day,J=H.hours,ue=H.minutes,ie=H.seconds,he=H.milliseconds,Q=H.zone,W=H.week,V=new Date,se=P||(R||F?1:V.getDate()),de=R||V.getFullYear(),Ee=0;R&&!F||(Ee=F>0?F-1:V.getMonth());var Fe,Xe=J||0,Qe=uLine truncated
|
||||
@@ -0,0 +1,116 @@
|
||||
var wr=Object.defineProperty;var Lr=(e,t)=>{for(var i in t)wr(e,i,{get:t[i],enumerable:!0})};var pa={};Lr(pa,{FileOrigin:()=>Gt,FileStatus:()=>Rt,OptionTypes:()=>Yi,Status:()=>pl,create:()=>It,destroy:()=>si,find:()=>Xi,getOptions:()=>Ki,parse:()=>$i,registerPlugin:()=>_e,setOptions:()=>Zi,supported:()=>qi});var Mr=e=>e instanceof HTMLElement,Ar=(e,t=[],i=[])=>{let a={...e},n=[],l=[],o=()=>({...a}),r=()=>{let g=[...n];return n.length=0,g},s=()=>{let g=[...l];l.length=0,g.forEach(({type:f,data:b})=>{p(f,b)})},p=(g,f,b)=>{if(b&&!document.hidden){l.push({type:g,data:f});return}u[g]&&u[g](f),n.push({type:g,data:f})},c=(g,...f)=>m[g]?m[g](...f):null,d={getState:o,processActionQueue:r,processDispatchQueue:s,dispatch:p,query:c},m={};t.forEach(g=>{m={...g(a),...m}});let u={};return i.forEach(g=>{u={...g(p,c,a),...u}}),d},Pr=(e,t,i)=>{if(typeof i=="function"){e[t]=i;return}Object.defineProperty(e,t,{...i})},ae=(e,t)=>{for(let i in e)e.hasOwnProperty(i)&&t(i,e[i])},Xe=e=>{let t={};return ae(e,i=>{Pr(t,i,e[i])}),t},pe=(e,t,i=null)=>{if(i===null)return e.getAttribute(t)||e.hasAttribute(t);e.setAttribute(t,i)},zr="http://www.w3.org/2000/svg",Fr=["svg","path"],ka=e=>Fr.includes(e),ci=(e,t,i={})=>{typeof t=="object"&&(i=t,t=null);let a=ka(e)?document.createElementNS(zr,e):document.createElement(e);return t&&(ka(e)?pe(a,"class",t):a.className=t),ae(i,(n,l)=>{pe(a,n,l)}),a},Or=e=>(t,i)=>{typeof i<"u"&&e.children[i]?e.insertBefore(t,e.children[i]):e.appendChild(t)},Dr=(e,t)=>(i,a)=>(typeof a<"u"?t.splice(a,0,i):t.push(i),i),Cr=(e,t)=>i=>(t.splice(t.indexOf(i),1),i.element.parentNode&&e.removeChild(i.element),i),Br=typeof window<"u"&&typeof window.document<"u",Rn=()=>Br,kr=Rn()?ci("svg"):{},Nr="children"in kr?e=>e.children.length:e=>e.childNodes.length,Sn=(e,t,i,a)=>{let n=i[0]||e.left,l=i[1]||e.top,o=n+e.width,r=l+e.height*(a[1]||1),s={element:{...e},inner:{left:e.left,top:e.top,right:e.right,bottom:e.bottom},outer:{left:n,top:l,right:o,bottom:r}};return t.filter(p=>!p.isRectIgnored()).map(p=>p.rect).forEach(p=>{Na(s.inner,{...p.inner}),Na(s.outer,{...p.outer})}),Va(s.inner),s.outer.bottom+=s.element.marginBottom,s.outer.right+=s.element.marginRight,Va(s.outer),s},Na=(e,t)=>{t.top+=e.top,t.right+=e.left,t.bottom+=e.top,t.left+=e.left,t.bottom>e.bottom&&(e.bottom=t.bottom),t.right>e.right&&(e.right=t.right)},Va=e=>{e.width=e.right-e.left,e.height=e.bottom-e.top},tt=e=>typeof e=="number",Vr=(e,t,i,a=.001)=>Math.abs(e-t)<a&&Math.abs(i)<a,Gr=({stiffness:e=.5,damping:t=.75,mass:i=10}={})=>{let a=null,n=null,l=0,o=!1,p=Xe({interpolate:(c,d)=>{if(o)return;if(!(tt(a)&&tt(n))){o=!0,l=0;return}let m=-(n-a)*e;l+=m/i,n+=l,l*=t,Vr(n,a,l)||d?(n=a,l=0,o=!0,p.onupdate(n),p.oncomplete(n)):p.onupdate(n)},target:{set:c=>{if(tt(c)&&!tt(n)&&(n=c),a===null&&(a=c,n=c),a=c,n===a||typeof a>"u"){o=!0,l=0,p.onupdate(n),p.oncomplete(n);return}o=!1},get:()=>a},resting:{get:()=>o},onupdate:c=>{},oncomplete:c=>{}});return p};var Ur=e=>e<.5?2*e*e:-1+(4-2*e)*e,Hr=({duration:e=500,easing:t=Ur,delay:i=0}={})=>{let a=null,n,l,o=!0,r=!1,s=null,c=Xe({interpolate:(d,m)=>{o||s===null||(a===null&&(a=d),!(d-a<i)&&(n=d-a-i,n>=e||m?(n=1,l=r?0:1,c.onupdate(l*s),c.oncomplete(l*s),o=!0):(l=n/e,c.onupdate((n>=0?t(r?1-l:l):0)*s))))},target:{get:()=>r?0:s,set:d=>{if(s===null){s=d,c.onupdate(d),c.oncomplete(d);return}d<s?(s=1,r=!0):(r=!1,s=d),o=!1,a=null}},resting:{get:()=>o},onupdate:d=>{},oncomplete:d=>{}});return c},Ga={spring:Gr,tween:Hr},Wr=(e,t,i)=>{let a=e[t]&&typeof e[t][i]=="object"?e[t][i]:e[t]||e,n=typeof a=="string"?a:a.type,l=typeof a=="object"?{...a}:{};return Ga[n]?Ga[n](l):null},Qi=(e,t,i,a=!1)=>{t=Array.isArray(t)?t:[t],t.forEach(n=>{e.forEach(l=>{let o=l,r=()=>i[l],s=p=>i[l]=p;typeof l=="object"&&(o=l.key,r=l.getter||r,s=l.setter||s),!(n[o]&&!a)&&(n[o]={get:r,set:s})})})},jr=({mixinConfig:e,viewProps:t,viewInternalAPI:i,viewExternalAPI:a})=>{let n={...t},l=[];return ae(e,(o,r)=>{let s=Wr(r);if(!s)return;s.onupdate=c=>{t[o]=c},s.target=n[o],Qi([{key:o,setter:c=>{s.target!==c&&(s.target=c)},getter:()=>t[o]}],[i,a],t,!0),l.push(s)}),{write:o=>{let r=document.hidden,s=!0;return l.forEach(p=>{p.resting||(s=!1),p.interpolate(o,r)}),s},destroy:()=>{}}},qr=e=>(t,i)=>{e.addEventListener(t,i)},Yr=e=>(t,i)=>{e.removeEventListener(t,i)},$r=({mixinConfig:e,viewProps:t,viewInternalAPI:i,viewExternalAPI:a,viewState:n,view:l})=>{let o=[],r=qr(l.element),s=Yr(l.element);return a.on=(p,c)=>{o.push({type:p,fn:c}),r(p,c)},a.off=(p,c)=>{o.splice(o.findIndex(d=>d.type===p&&d.fn===c),1),s(p,c)},{write:()=>!0,destroy:()=>{o.forEach(p=>{s(p.type,p.fn)})}}},Xr=({mixinConfig:e,viewProps:t,viewExternalAPI:i})=>{Qi(e,i,t)},be=e=>e!=null,Kr={opacity:1,scaleX:1,scaleY:1,translateX:0,translateY:0,rotateX:0,rotateY:0,rotateZ:0,originX:0,originY:0},Zr=({mixinConfig:e,viewProps:t,viewInternalAPI:i,viewExternalAPI:a,view:n})=>{let l={...t},o={};Qi(e,[i,a],t);let r=()=>[t.translateX||0,t.translateY||0],s=()=>[t.scaleX||0,t.scaleY||0],p=()=>n.rect?Sn(n.rect,n.childViews,r(),s()):null;return i.Line truncated
|
||||
`);for(let a of i){let n=Ws(a);if(n){t.name=n;continue}let l=js(a);if(l){t.size=l;continue}let o=qs(a);if(o){t.source=o;continue}}return t},Ys=e=>{let t={source:null,complete:!1,progress:0,size:null,timestamp:null,duration:0,request:null},i=()=>t.progress,a=()=>{t.request&&t.request.abort&&t.request.abort()},n=()=>{let r=t.source;o.fire("init",r),r instanceof File?o.fire("load",r):r instanceof Blob?o.fire("load",xt(r,r.name)):Ni(r)?o.fire("load",Hs(r)):l(r)},l=r=>{if(!e){o.fire("error",{type:"error",body:"Can't load URL",code:400});return}t.timestamp=Date.now(),t.request=e(r,s=>{t.duration=Date.now()-t.timestamp,t.complete=!0,s instanceof Blob&&(s=xt(s,s.name||Vt(r))),o.fire("load",s instanceof Blob?s:s?s.body:null)},s=>{o.fire("error",typeof s=="string"?{type:"error",code:0,body:s}:s)},(s,p,c)=>{if(c&&(t.size=c),t.duration=Date.now()-t.timestamp,!s){t.progress=null;return}t.progress=p/c,o.fire("progress",t.progress)},()=>{o.fire("abort")},s=>{let p=ia(typeof s=="string"?s:s.headers);o.fire("meta",{size:t.size||p.size,filename:p.name,source:p.source})})},o={...hi(),setSource:r=>t.source=r,getProgress:i,abort:a,load:n};return o},Xa=e=>/GET|HEAD/.test(e),nt=(e,t,i)=>{let a={onheaders:()=>{},onprogress:()=>{},onload:()=>{},ontimeout:()=>{},onerror:()=>{},onabort:()=>{},abort:()=>{n=!0,o.abort()}},n=!1,l=!1;i={method:"POST",headers:{},withCredentials:!1,...i},t=encodeURI(t),Xa(i.method)&&e&&(t=`${t}${encodeURIComponent(typeof e=="string"?e:JSON.stringify(e))}`);let o=new XMLHttpRequest,r=Xa(i.method)?o:o.upload;return r.onprogress=s=>{n||a.onprogress(s.lengthComputable,s.loaded,s.total)},o.onreadystatechange=()=>{o.readyState<2||o.readyState===4&&o.status===0||l||(l=!0,a.onheaders(o))},o.onload=()=>{o.status>=200&&o.status<300?a.onload(o):a.onerror(o)},o.onerror=()=>a.onerror(o),o.onabort=()=>{n=!0,a.onabort()},o.ontimeout=()=>a.ontimeout(o),o.open(i.method,t,!0),yt(i.timeout)&&(o.timeout=i.timeout),Object.keys(i.headers).forEach(s=>{let p=unescape(encodeURIComponent(i.headers[s]));o.setRequestHeader(s,p)}),i.responseType&&(o.responseType=i.responseType),i.withCredentials&&(o.withCredentials=!0),o.send(e),a},ne=(e,t,i,a)=>({type:e,code:t,body:i,headers:a}),lt=e=>t=>{e(ne("error",0,"Timeout",t.getAllResponseHeaders()))},Ka=e=>/\?/.test(e),Nt=(...e)=>{let t="";return e.forEach(i=>{t+=Ka(t)&&Ka(i)?i.replace(/\?/,"&"):i}),t},zi=(e="",t)=>{if(typeof t=="function")return t;if(!t||!Ee(t.url))return null;let i=t.onload||(n=>n),a=t.onerror||(n=>null);return(n,l,o,r,s,p)=>{let c=nt(n,Nt(e,t.url),{...t,responseType:"blob"});return c.onload=d=>{let m=d.getAllResponseHeaders(),u=ia(m).name||Vt(n);l(ne("load",d.status,t.method==="HEAD"?null:xt(i(d.response),u),m))},c.onerror=d=>{o(ne("error",d.status,a(d.response)||d.statusText,d.getAllResponseHeaders()))},c.onheaders=d=>{p(ne("headers",d.status,null,d.getAllResponseHeaders()))},c.ontimeout=lt(o),c.onprogress=r,c.onabort=s,c}},we={QUEUED:0,COMPLETE:1,PROCESSING:2,ERROR:3,WAITING:4},$s=(e,t,i,a,n,l,o,r,s,p,c)=>{let d=[],{chunkTransferId:m,chunkServer:u,chunkSize:g,chunkRetryDelays:f}=c,b={serverId:m,aborted:!1},v=t.ondata||(w=>w),h=t.onload||((w,F)=>F==="HEAD"?w.getResponseHeader("Upload-Offset"):w.response),E=t.onerror||(w=>null),I=w=>{let F=new FormData;me(n)&&F.append(i,JSON.stringify(n));let S=typeof t.headers=="function"?t.headers(a,n):{...t.headers,"Upload-Length":a.size},L={...t,headers:S},D=nt(v(F),Nt(e,t.url),L);D.onload=O=>w(h(O,L.method)),D.onerror=O=>o(ne("error",O.status,E(O.response)||O.statusText,O.getAllResponseHeaders())),D.ontimeout=lt(o)},y=w=>{let F=Nt(e,u.url,b.serverId),L={headers:typeof t.headers=="function"?t.headers(b.serverId):{...t.headers},method:"HEAD"},D=nt(null,F,L);D.onload=O=>w(h(O,L.method)),D.onerror=O=>o(ne("error",O.status,E(O.response)||O.statusText,O.getAllResponseHeaders())),D.ontimeout=lt(o)},T=Math.floor(a.size/g);for(let w=0;w<=T;w++){let F=w*g,S=a.slice(F,F+g,"application/offset+octet-stream");d[w]={index:w,size:S.size,offset:F,data:S,file:a,progress:0,retries:[...f],status:we.QUEUED,error:null,request:null,timeout:null}}let _=()=>l(b.serverId),x=w=>w.status===we.QUEUED||w.status===we.ERROR,R=w=>{if(b.aborted)return;if(w=w||d.find(x),!w){d.every(C=>C.status===we.COMPLETE)&&_();return}w.status=we.PROCESSING,w.progress=null;let F=u.ondata||(C=>C),S=u.onerror||(C=>null),L=u.onload||(()=>{}),D=Nt(e,u.url,b.serverId),O=typeof u.headers=="function"?u.headers(w):{...u.headers,"Content-Type":"application/offset+octet-stream","Upload-Offset":w.offset,"Upload-Length":a.size,"Upload-Name":a.name},G=w.request=nt(F(w.data),D,{...u,headers:O});G.onload=C=>{L(C,w.index,d.length),w.status=we.COMPLETE,w.request=null,A()},G.onprogress=(C,X,K)=>{w.progress=C?X:null,P()},G.onerror=C=>{w.status=we.ERROR,w.request=null,w.error=S(C.response)||C.statusText,z(w)||o(ne("error",C.status,S(C.response)||C.statusText,C.getAllResponseHeaders()))},G.ontimeout=C=>{w.status=we.ERROR,w.request=null,z(w)||lt(o)(C)},G.onabort=()=>{w.status=we.QUEUED,w.request=null,s()
Line truncated
|
||||
In order to be iterable, non-array objects must have a [Symbol.iterator]() method.`)}var yi=typeof window<"u"&&typeof window.document<"u",Ge=yi?window:{},Ra=yi&&Ge.document.documentElement?"ontouchstart"in Ge.document.documentElement:!1,Sa=yi?"PointerEvent"in Ge:!1,J="cropper",_a="all",Pl="crop",zl="move",Fl="zoom",dt="e",pt="w",St="s",Ke="n",Ut="ne",Ht="nw",Wt="se",jt="sw",ha="".concat(J,"-crop"),gl="".concat(J,"-disabled"),ye="".concat(J,"-hidden"),fl="".concat(J,"-hide"),Up="".concat(J,"-invisible"),xi="".concat(J,"-modal"),ba="".concat(J,"-move"),Yt="".concat(J,"Action"),vi="".concat(J,"Preview"),wa="crop",Ol="move",Dl="none",Ea="crop",Ta="cropend",va="cropmove",Ia="cropstart",hl="dblclick",Hp=Ra?"touchstart":"mousedown",Wp=Ra?"touchmove":"mousemove",jp=Ra?"touchend touchcancel":"mouseup",bl=Sa?"pointerdown":Hp,El=Sa?"pointermove":Wp,Tl=Sa?"pointerup pointercancel":jp,vl="ready",Il="resize",xl="wheel",xa="zoom",yl="image/jpeg",qp=/^e|w|s|n|se|sw|ne|nw|all|crop|move|zoom$/,Yp=/^data:/,$p=/^data:image\/jpeg;base64,/,Xp=/^img|canvas$/i,Cl=200,Bl=100,Rl={viewMode:0,dragMode:wa,initialAspectRatio:NaN,aspectRatio:NaN,data:null,preview:"",responsive:!0,restore:!0,checkCrossOrigin:!0,checkOrientation:!0,modal:!0,guides:!0,center:!0,highlight:!0,background:!0,autoCrop:!0,autoCropArea:.8,movable:!0,rotatable:!0,scalable:!0,zoomable:!0,zoomOnTouch:!0,zoomOnWheel:!0,wheelZoomRatio:.1,cropBoxMovable:!0,cropBoxResizable:!0,toggleDragModeOnDblclick:!0,minCanvasWidth:0,minCanvasHeight:0,minCropBoxWidth:0,minCropBoxHeight:0,minContainerWidth:Cl,minContainerHeight:Bl,ready:null,cropstart:null,cropmove:null,cropend:null,crop:null,zoom:null},Kp='<div class="cropper-container" touch-action="none"><div class="cropper-wrap-box"><div class="cropper-canvas"></div></div><div class="cropper-drag-box"></div><div class="cropper-crop-box"><span class="cropper-view-box"></span><span class="cropper-dashed dashed-h"></span><span class="cropper-dashed dashed-v"></span><span class="cropper-center"></span><span class="cropper-face"></span><span class="cropper-line line-e" data-cropper-action="e"></span><span class="cropper-line line-n" data-cropper-action="n"></span><span class="cropper-line line-w" data-cropper-action="w"></span><span class="cropper-line line-s" data-cropper-action="s"></span><span class="cropper-point point-e" data-cropper-action="e"></span><span class="cropper-point point-n" data-cropper-action="n"></span><span class="cropper-point point-w" data-cropper-action="w"></span><span class="cropper-point point-s" data-cropper-action="s"></span><span class="cropper-point point-ne" data-cropper-action="ne"></span><span class="cropper-point point-nw" data-cropper-action="nw"></span><span class="cropper-point point-sw" data-cropper-action="sw"></span><span class="cropper-point point-se" data-cropper-action="se"></span></div></div>',Zp=Number.isNaN||Ge.isNaN;function q(e){return typeof e=="number"&&!Zp(e)}var Sl=function(t){return t>0&&t<1/0};function ma(e){return typeof e>"u"}function mt(e){return ga(e)==="object"&&e!==null}var Qp=Object.prototype.hasOwnProperty;function _t(e){if(!mt(e))return!1;try{var t=e.constructor,i=t.prototype;return t&&i&&Qp.call(i,"isPrototypeOf")}catch{return!1}}function xe(e){return typeof e=="function"}var Jp=Array.prototype.slice;function kl(e){return Array.from?Array.from(e):Jp.call(e)}function se(e,t){return e&&xe(t)&&(Array.isArray(e)||q(e.length)?kl(e).forEach(function(i,a){t.call(e,i,a,e)}):mt(e)&&Object.keys(e).forEach(function(i){t.call(e,e[i],i,e)})),e}var ee=Object.assign||function(t){for(var i=arguments.length,a=new Array(i>1?i-1:0),n=1;n<i;n++)a[n-1]=arguments[n];return mt(t)&&a.length>0&&a.forEach(function(l){mt(l)&&Object.keys(l).forEach(function(o){t[o]=l[o]})}),t},em=/\.\d*(?:0|9){12}\d*$/;function Lt(e){var t=arguments.length>1&&arguments[1]!==void 0?arguments[1]:1e11;return em.test(e)?Math.round(e*t)/t:e}var tm=/^width|height|left|top|marginLeft|marginTop$/;function Ze(e,t){var i=e.style;se(t,function(a,n){tm.test(n)&&q(a)&&(a="".concat(a,"px")),i[n]=a})}function im(e,t){return e.classList?e.classList.contains(t):e.className.indexOf(t)>-1}function ue(e,t){if(t){if(q(e.length)){se(e,function(a){ue(a,t)});return}if(e.classList){e.classList.add(t);return}var i=e.className.trim();i?i.indexOf(t)<0&&(e.className="".concat(i," ").concat(t)):e.className=t}}function Ve(e,t){if(t){if(q(e.length)){se(e,function(i){Ve(i,t)});return}if(e.classList){e.classList.remove(t);return}e.className.indexOf(t)>=0&&(e.className=e.className.replace(t,""))}}function wt(e,t,i){if(t){if(q(e.length)){se(e,function(a){wt(a,t,i)});return}i?ue(e,t):Ve(e,t)}}var am=/([a-z\d])([A-Z])/g;function La(e){return e.replace(am,"$1-$2").toLowerCase()}function ya(e,t){return mt(e[t])?e[t]:e.dataset?e.dataset[t]:e.getAttribute("data-".concat(La(t)))}function $t(e,t,i){mt(i)?e[t]=i:e.dataset?e.dataset[t]=i:e.setAttribute("data-".concat(La(t)),i)}function nm(e,t){if(mt(e[t]))try{delete e[t]}catch{e[t]=void 0}else if(e.dataset)try
Line truncated
|
||||
<defs>
|
||||
<radialGradient id="gradient-__UID__" cx=".5" cy="1.25" r="1.15">
|
||||
<stop offset='50%' stop-color='#000000'/>
|
||||
<stop offset='56%' stop-color='#0a0a0a'/>
|
||||
<stop offset='63%' stop-color='#262626'/>
|
||||
<stop offset='69%' stop-color='#4f4f4f'/>
|
||||
<stop offset='75%' stop-color='#808080'/>
|
||||
<stop offset='81%' stop-color='#b1b1b1'/>
|
||||
<stop offset='88%' stop-color='#dadada'/>
|
||||
<stop offset='94%' stop-color='#f6f6f6'/>
|
||||
<stop offset='100%' stop-color='#ffffff'/>
|
||||
</radialGradient>
|
||||
<mask id="mask-__UID__">
|
||||
<rect x="0" y="0" width="500" height="200" fill="url(#gradient-__UID__)"></rect>
|
||||
</mask>
|
||||
</defs>
|
||||
<rect x="0" width="500" height="200" fill="currentColor" mask="url(#mask-__UID__)"></rect>
|
||||
</svg>`,uo=0,fu=e=>e.utils.createView({name:"image-preview-overlay",tag:"div",ignoreRect:!0,create:({root:t,props:i})=>{let a=gu;if(document.querySelector("base")){let n=new URL(window.location.href.replace(window.location.hash,"")).href;a=a.replace(/url\(\#/g,"url("+n+"#")}uo++,t.element.classList.add(`filepond--image-preview-overlay-${i.status}`),t.element.innerHTML=a.replace(/__UID__/g,uo)},mixins:{styles:["opacity"],animations:{opacity:{type:"spring",mass:25}}}}),hu=function(){self.onmessage=e=>{createImageBitmap(e.data.message.file).then(t=>{self.postMessage({id:e.data.id,message:t},[t])})}},bu=function(){self.onmessage=e=>{let t=e.data.message.imageData,i=e.data.message.colorMatrix,a=t.data,n=a.length,l=i[0],o=i[1],r=i[2],s=i[3],p=i[4],c=i[5],d=i[6],m=i[7],u=i[8],g=i[9],f=i[10],b=i[11],v=i[12],h=i[13],E=i[14],I=i[15],y=i[16],T=i[17],_=i[18],x=i[19],R=0,z=0,P=0,A=0,B=0;for(;R<n;R+=4)z=a[R]/255,P=a[R+1]/255,A=a[R+2]/255,B=a[R+3]/255,a[R]=Math.max(0,Math.min((z*l+P*o+A*r+B*s+p)*255,255)),a[R+1]=Math.max(0,Math.min((z*c+P*d+A*m+B*u+g)*255,255)),a[R+2]=Math.max(0,Math.min((z*f+P*b+A*v+B*h+E)*255,255)),a[R+3]=Math.max(0,Math.min((z*I+P*y+A*T+B*_+x)*255,255));self.postMessage({id:e.data.id,message:t},[t.data.buffer])}},Eu=(e,t)=>{let i=new Image;i.onload=()=>{let a=i.naturalWidth,n=i.naturalHeight;i=null,t(a,n)},i.src=e},Tu={1:()=>[1,0,0,1,0,0],2:e=>[-1,0,0,1,e,0],3:(e,t)=>[-1,0,0,-1,e,t],4:(e,t)=>[1,0,0,-1,0,t],5:()=>[0,1,1,0,0,0],6:(e,t)=>[0,1,-1,0,t,0],7:(e,t)=>[0,-1,-1,0,t,e],8:e=>[0,-1,1,0,0,e]},vu=(e,t,i,a)=>{a!==-1&&e.transform.apply(e,Tu[a](t,i))},Iu=(e,t,i,a)=>{t=Math.round(t),i=Math.round(i);let n=document.createElement("canvas");n.width=t,n.height=i;let l=n.getContext("2d");return a>=5&&a<=8&&([t,i]=[i,t]),vu(l,t,i,a),l.drawImage(e,0,0,t,i),n},ho=e=>/^image/.test(e.type)&&!/svg/.test(e.type),xu=10,yu=10,Ru=e=>{let t=Math.min(xu/e.width,yu/e.height),i=document.createElement("canvas"),a=i.getContext("2d"),n=i.width=Math.ceil(e.width*t),l=i.height=Math.ceil(e.height*t);a.drawImage(e,0,0,n,l);let o=null;try{o=a.getImageData(0,0,n,l).data}catch{return null}let r=o.length,s=0,p=0,c=0,d=0;for(;d<r;d+=4)s+=o[d]*o[d],p+=o[d+1]*o[d+1],c+=o[d+2]*o[d+2];return s=Fa(s,r),p=Fa(p,r),c=Fa(c,r),{r:s,g:p,b:c}},Fa=(e,t)=>Math.floor(Math.sqrt(e/(t/4))),Su=(e,t)=>(t=t||document.createElement("canvas"),t.width=e.width,t.height=e.height,t.getContext("2d").drawImage(e,0,0),t),_u=e=>{let t;try{t=new ImageData(e.width,e.height)}catch{t=document.createElement("canvas").getContext("2d").createImageData(e.width,e.height)}return t.data.set(new Uint8ClampedArray(e.data)),t},wu=e=>new Promise((t,i)=>{let a=new Image;a.crossOrigin="Anonymous",a.onload=()=>{t(a)},a.onerror=n=>{i(n)},a.src=e}),Lu=e=>{let t=fu(e),i=uu(e),{createWorker:a}=e.utils,n=(h,E,I)=>new Promise(y=>{h.ref.imageData||(h.ref.imageData=I.getContext("2d").getImageData(0,0,I.width,I.height));let T=_u(h.ref.imageData);if(!E||E.length!==20)return I.getContext("2d").putImageData(T,0,0),y();let _=a(bu);_.post({imageData:T,colorMatrix:E},x=>{I.getContext("2d").putImageData(x,0,0),_.terminate(),y()},[T.data.buffer])}),l=(h,E)=>{h.removeChildView(E),E.image.width=1,E.image.height=1,E._destroy()},o=({root:h})=>{let E=h.ref.images.shift();return E.opacity=0,E.translateY=-15,h.ref.imageViewBin.push(E),E},r=({root:h,props:E,image:I})=>{let y=E.id,T=h.query("GET_ITEM",{id:y});if(!T)return;let _=T.getMetadata("crop")||{center:{x:.5,y:.5},flip:{horizontal:!1,vertical:!1},zoom:1,rotation:0,aspectRatio:null},x=h.query("GET_IMAGE_TRANSFORM_CANVAS_BACKGROUND_COLOR"),R,z,P=!1;h.query("GET_IMAGE_PREVIEW_MARKUP_SHOW")&&(R=T.getMetadata("markup")||[],z=T.getMetadata("resize"),P=!0);let A=h.appendChildView(h.createChildView(i,{id:y,image:I,crop:_,resize:z,markup:R,dirty:P,background:x,opacity:0,scaleX:1.15,scaleY:1.15,translateY:15}),h.childViews.length);h.ref.images.push(A),A.opacity=1,A.scaleX=1,A.scaleY=1,A.translateY=0,setTimeout(()=>{h.dispatch("DID_IMAGE_PREVIEW_SHOW",{id:y})},250)},s=({root:h,props:E})=>{let I=h.query("GET_ITEM",{id:E.id});if(!I)return;let y=h.ref.images[h.ref.images.length-1];y.crop=I.getMetadata("crop"),y.background=h.query("GET_IMAGE_TRANSFORM_CANVAS_BACKGROUND_COLOR"),h.query("GET_IMAGE_PREVIEW_MARKUP_SHOW")&&(y.dirty=!0,y.resize=I.getMetadata("resize"),y.markup=I.getMetadata("markup"))},p=({root:h,props:E,action:I})=>{if(!/crop|filter|markup|resize/.test(I.change.key)||!h.ref.images.length)return;let y=h.query("GET_ITEM",{id:E.id});if(y){if(/filter/.test(I.change.key)){let T=h.ref.images[h.ref.images.length-1];n(h,I.change.value,T.image);return}if(/crop|markup|resize/.test(I.change.key)){let T=y.getMetadata("crop"),_=h.ref.images[h.ref.images.length-1];if(T&&T.aspectRatio&&_.crop&&_.crop.aspectRatio&&Math.abs(T.aspectRatio-_.crop.aspectRatio)>1e-5){let x=o({root:h});r({root:h,props:E,image:Su(x.image)})}else s({root:h,props:E})}}},c=h=>{let I=window.navigator.userAgent.match(/Firefox\/([0-9]+)\./),y=I?parseInt(I[1]):null;return y!==null&&y<=58?!1:"createImagLine truncated
|
||||
`+j.outerHTML+`
|
||||
`},""),_=`
|
||||
|
||||
<g>${_.replace(/ /g," ")}</g>
|
||||
|
||||
`}let x=t.aspectRatio||T/y,R=y,z=R*x,P=typeof t.scaleToFit>"u"||t.scaleToFit,A=t.center?t.center.x:.5,B=t.center?t.center.y:.5,w=_o({width:y,height:T},wo({width:R,height:z},x),t.rotation,P?{x:A,y:B}:{x:.5,y:.5}),F=t.zoom*w,S=t.rotation*(180/Math.PI),L={x:R*.5,y:z*.5},D={x:L.x-y*A,y:L.y-T*B},O=[`rotate(${S} ${L.x} ${L.y})`,`translate(${L.x} ${L.y})`,`scale(${F})`,`translate(${-L.x} ${-L.y})`,`translate(${D.x} ${D.y})`],G=t.flip&&t.flip.horizontal,C=t.flip&&t.flip.vertical,X=[`scale(${G?-1:1} ${C?-1:1})`,`translate(${G?-y:0} ${C?-T:0})`],K=`<?xml version="1.0" encoding="UTF-8"?>
|
||||
<svg width="${R}${v}" height="${z}${h}"
|
||||
viewBox="0 0 ${R} ${z}" ${l?'style="background:'+l+'" ':""}
|
||||
preserveAspectRatio="xMinYMin"
|
||||
xmlns:xlink="http://www.w3.org/1999/xlink"
|
||||
xmlns="http://www.w3.org/2000/svg">
|
||||
<!-- Generated by PQINA - https://pqina.nl/ -->
|
||||
<title>${d?d.textContent:""}</title>
|
||||
<g transform="${O.join(" ")}">
|
||||
<g transform="${X.join(" ")}">
|
||||
${p.outerHTML}${_}
|
||||
</g>
|
||||
</g>
|
||||
</svg>`;n(K)},o.readAsText(e)}),pg=e=>{let t;try{t=new ImageData(e.width,e.height)}catch{t=document.createElement("canvas").getContext("2d").createImageData(e.width,e.height)}return t.data.set(e.data),t},mg=()=>{let e={resize:c,filter:p},t=(d,m)=>(d.forEach(u=>{m=e[u.type](m,u.data)}),m),i=(d,m)=>{let u=d.transforms,g=null;if(u.forEach(f=>{f.type==="filter"&&(g=f)}),g){let f=null;u.forEach(b=>{b.type==="resize"&&(f=b)}),f&&(f.data.matrix=g.data,u=u.filter(b=>b.type!=="filter"))}m(t(u,d.imageData))};self.onmessage=d=>{i(d.data.message,m=>{self.postMessage({id:d.data.id,message:m},[m.data.buffer])})};let a=1,n=1,l=1;function o(d,m,u){let g=m[d]/255,f=m[d+1]/255,b=m[d+2]/255,v=m[d+3]/255,h=g*u[0]+f*u[1]+b*u[2]+v*u[3]+u[4],E=g*u[5]+f*u[6]+b*u[7]+v*u[8]+u[9],I=g*u[10]+f*u[11]+b*u[12]+v*u[13]+u[14],y=g*u[15]+f*u[16]+b*u[17]+v*u[18]+u[19],T=Math.max(0,h*y)+a*(1-y),_=Math.max(0,E*y)+n*(1-y),x=Math.max(0,I*y)+l*(1-y);m[d]=Math.max(0,Math.min(1,T))*255,m[d+1]=Math.max(0,Math.min(1,_))*255,m[d+2]=Math.max(0,Math.min(1,x))*255}let r=self.JSON.stringify([1,0,0,0,0,0,1,0,0,0,0,0,1,0,0,0,0,0,1,0]);function s(d){return self.JSON.stringify(d||[])===r}function p(d,m){if(!m||s(m))return d;let u=d.data,g=u.length,f=m[0],b=m[1],v=m[2],h=m[3],E=m[4],I=m[5],y=m[6],T=m[7],_=m[8],x=m[9],R=m[10],z=m[11],P=m[12],A=m[13],B=m[14],w=m[15],F=m[16],S=m[17],L=m[18],D=m[19],O=0,G=0,C=0,X=0,K=0,Z=0,ge=0,k=0,j=0,$=0,ce=0,te=0;for(;O<g;O+=4)G=u[O]/255,C=u[O+1]/255,X=u[O+2]/255,K=u[O+3]/255,Z=G*f+C*b+X*v+K*h+E,ge=G*I+C*y+X*T+K*_+x,k=G*R+C*z+X*P+K*A+B,j=G*w+C*F+X*S+K*L+D,$=Math.max(0,Z*j)+a*(1-j),ce=Math.max(0,ge*j)+n*(1-j),te=Math.max(0,k*j)+l*(1-j),u[O]=Math.max(0,Math.min(1,$))*255,u[O+1]=Math.max(0,Math.min(1,ce))*255,u[O+2]=Math.max(0,Math.min(1,te))*255;return d}function c(d,m){let{mode:u="contain",upscale:g=!1,width:f,height:b,matrix:v}=m;if(v=!v||s(v)?null:v,!f&&!b)return p(d,v);if(f===null?f=b:b===null&&(b=f),u!=="force"){let A=f/d.width,B=b/d.height,w=1;if(u==="cover"?w=Math.max(A,B):u==="contain"&&(w=Math.min(A,B)),w>1&&g===!1)return p(d,v);f=d.width*w,b=d.height*w}let h=d.width,E=d.height,I=Math.round(f),y=Math.round(b),T=d.data,_=new Uint8ClampedArray(I*y*4),x=h/I,R=E/y,z=Math.ceil(x*.5),P=Math.ceil(R*.5);for(let A=0;A<y;A++)for(let B=0;B<I;B++){let w=(B+A*I)*4,F=0,S=0,L=0,D=0,O=0,G=0,C=0,X=(A+.5)*R;for(let K=Math.floor(A*R);K<(A+1)*R;K++){let Z=Math.abs(X-(K+.5))/P,ge=(B+.5)*x,k=Z*Z;for(let j=Math.floor(B*x);j<(B+1)*x;j++){let $=Math.abs(ge-(j+.5))/z,ce=Math.sqrt(k+$*$);if(ce>=-1&&ce<=1&&(F=2*ce*ce*ce-3*ce*ce+1,F>0)){$=4*(j+K*h);let te=T[$+3];C+=F*te,L+=F,te<255&&(F=F*te/250),D+=F*T[$],O+=F*T[$+1],G+=F*T[$+2],S+=F}}}_[w]=D/S,_[w+1]=O/S,_[w+2]=G/S,_[w+3]=C/L,v&&o(w,_,v)}return{data:_,width:I,height:y}}},ug=(e,t)=>{if(e.getUint32(t+4,!1)!==1165519206)return;t+=4;let i=e.getUint16(t+=6,!1)===18761;t+=e.getUint32(t+4,i);let a=e.getUint16(t,i);t+=2;for(let n=0;n<a;n++)if(e.getUint16(t+n*12,i)===274)return e.setUint16(t+n*12+8,1,i),!0;return!1},gg=e=>{let t=new DataView(e);if(t.getUint16(0)!==65496)return null;let i=2,a,n,l=!1;for(;i<t.byteLength&&(a=t.getUint16(i,!1),n=t.getUint16(i+2,!1)+2,!(!(a>=65504&&a<=65519||a===65534)||(l||(l=ug(t,i,n)),i+n>t.byteLength)));)i+=n;return e.slice(0,i)},fg=e=>new Promise(t=>{let i=new FileReader;i.onload=()=>t(gg(i.result)||null),i.readAsArrayBuffer(e.slice(0,256*1024))}),hg=()=>window.BlobBuilder=window.BlobBuilder||window.WebKitBlobBuilder||window.MozBlobBuilder||window.MSBlobBuilder,bg=(e,t)=>{let i=hg();if(i){let a=new i;return a.append(e),a.getBlob(t)}return new Blob([e],{type:t})},Eg=()=>Math.random().toString(36).substr(2,9),Tg=e=>{let t=new Blob(["(",e.toString(),")()"],{type:"application/javascript"}),i=URL.createObjectURL(t),a=new Worker(i),n=[];return{transfer:()=>{},post:(l,o,r)=>{let s=Eg();n[s]=o,a.onmessage=p=>{let c=n[p.data.id];c&&(c(p.data.message),delete n[p.data.id])},a.postMessage({id:s,message:l},r)},terminate:()=>{a.terminate(),URL.revokeObjectURL(i)}}},vg=e=>new Promise((t,i)=>{let a=new Image;a.onload=()=>{t(a)},a.onerror=n=>{i(n)},a.src=e}),Ig=e=>e.reduce((t,i)=>t.then(a=>i().then(Array.prototype.concat.bind(a))),Promise.resolve([])),xg=(e,t)=>new Promise(i=>{let a={width:e.width,height:e.height},n=e.getContext("2d"),l=t.sort(Ao).map(o=>()=>new Promise(r=>{Mg[o[0]](n,a,o[1],r)&&r()}));Ig(l).then(()=>i(e))}),Ot=(e,t)=>{e.beginPath(),e.lineCap=t["stroke-linecap"],e.lineJoin=t["stroke-linejoin"],e.lineWidth=t["stroke-width"],t["stroke-dasharray"].length&&e.setLineDash(t["stroke-dasharray"].split(",")),e.fillStyle=t.fill,e.strokeStyle=t.stroke,e.globalAlpha=t.opacity||1},Dt=e=>{e.fill(),e.stroke(),e.globalAlpha=1},yg=(e,t,i)=>{let a=Ft(i,t),n=ht(i,t);return Ot(e,n),e.rect(a.x,a.y,a.width,a.height),Dt(e,n),!0},Rg=(e,t,i)=>{let a=Ft(i,t),n=ht(i,t);Ot(e,n);let l=a.x,o=a.y,r=a.width,s=a.height,p=.5522848,c=r/2*p,d=s/2*p,m=l+r,u=o+s,g=l+r/2,f=o+s/2;return e.moveTo(l,f),e.bezierCurveTo(l,f-d,g-c,o,g,o),e.bezierCurveTo(g+c,o,m,f-d,m,f),e.bezierCurveTo(m,f+d,g+c,u,g,u),e.bezierCurveTo(Line truncated
|
||||
/*! Bundled license information:
|
||||
|
||||
filepond/dist/filepond.esm.js:
|
||||
(*!
|
||||
* FilePond 4.32.12
|
||||
* Licensed under MIT, https://opensource.org/licenses/MIT/
|
||||
* Please visit https://pqina.nl/filepond/ for details.
|
||||
*)
|
||||
|
||||
cropperjs/dist/cropper.esm.js:
|
||||
(*!
|
||||
* Cropper.js v1.6.2
|
||||
* https://fengyuanchen.github.io/cropperjs
|
||||
*
|
||||
* Copyright 2015-present Chen Fengyuan
|
||||
* Released under the MIT license
|
||||
*
|
||||
* Date: 2024-04-21T07:43:05.335Z
|
||||
*)
|
||||
|
||||
filepond-plugin-file-validate-size/dist/filepond-plugin-file-validate-size.esm.js:
|
||||
(*!
|
||||
* FilePondPluginFileValidateSize 2.2.8
|
||||
* Licensed under MIT, https://opensource.org/licenses/MIT/
|
||||
* Please visit https://pqina.nl/filepond/ for details.
|
||||
*)
|
||||
|
||||
filepond-plugin-file-validate-type/dist/filepond-plugin-file-validate-type.esm.js:
|
||||
(*!
|
||||
* FilePondPluginFileValidateType 1.2.9
|
||||
* Licensed under MIT, https://opensource.org/licenses/MIT/
|
||||
* Please visit https://pqina.nl/filepond/ for details.
|
||||
*)
|
||||
|
||||
filepond-plugin-image-crop/dist/filepond-plugin-image-crop.esm.js:
|
||||
(*!
|
||||
* FilePondPluginImageCrop 2.0.6
|
||||
* Licensed under MIT, https://opensource.org/licenses/MIT/
|
||||
* Please visit https://pqina.nl/filepond/ for details.
|
||||
*)
|
||||
|
||||
filepond-plugin-image-edit/dist/filepond-plugin-image-edit.esm.js:
|
||||
(*!
|
||||
* FilePondPluginImageEdit 1.6.3
|
||||
* Licensed under MIT, https://opensource.org/licenses/MIT/
|
||||
* Please visit https://pqina.nl/filepond/ for details.
|
||||
*)
|
||||
|
||||
filepond-plugin-image-exif-orientation/dist/filepond-plugin-image-exif-orientation.esm.js:
|
||||
(*!
|
||||
* FilePondPluginImageExifOrientation 1.0.11
|
||||
* Licensed under MIT, https://opensource.org/licenses/MIT/
|
||||
* Please visit https://pqina.nl/filepond/ for details.
|
||||
*)
|
||||
|
||||
filepond-plugin-image-preview/dist/filepond-plugin-image-preview.esm.js:
|
||||
(*!
|
||||
* FilePondPluginImagePreview 4.6.12
|
||||
* Licensed under MIT, https://opensource.org/licenses/MIT/
|
||||
* Please visit https://pqina.nl/filepond/ for details.
|
||||
*)
|
||||
|
||||
filepond-plugin-image-resize/dist/filepond-plugin-image-resize.esm.js:
|
||||
(*!
|
||||
* FilePondPluginImageResize 2.0.10
|
||||
* Licensed under MIT, https://opensource.org/licenses/MIT/
|
||||
* Please visit https://pqina.nl/filepond/ for details.
|
||||
*)
|
||||
|
||||
filepond-plugin-image-transform/dist/filepond-plugin-image-transform.esm.js:
|
||||
(*!
|
||||
* FilePondPluginImageTransform 3.8.7
|
||||
* Licensed under MIT, https://opensource.org/licenses/MIT/
|
||||
* Please visit https://pqina.nl/filepond/ for details.
|
||||
*)
|
||||
*/
|
||||
@@ -0,0 +1 @@
|
||||
function h({state:o,reordering:r={}}){return{state:o,rows:[],nextRowId:0,init(){this.updateRows(),this.rows.length<=0?this.addRow():this.updateState(),this.$watch("state",(t,i)=>{if(!Array.isArray(t)||JSON.stringify(t)===JSON.stringify(this.getState()))return;let e=s=>s===null?0:Array.isArray(s)?s.length:typeof s!="object"?0:Object.keys(s).length;e(t)===0&&e(i)===0||this.updateRows()})},addRow(){this.rows.push({id:this.nextRowId++,key:"",value:""}),this.updateState()},deleteRow(t){this.rows.splice(t,1),this.rows.length<=0&&this.addRow(),this.updateState()},reorderRows(t){t.oldDraggableIndex!==t.newDraggableIndex&&this.moveRow(this.rows[t.oldDraggableIndex].id,t.newDraggableIndex)},moveRow(t,i,e=document.activeElement){let s=this.rows.findIndex(a=>a.id===t);if(s<0||i<0||i>=this.rows.length||s===i)return;let[n]=this.rows.splice(s,1);this.rows.splice(i,0,n),this.updateState(),r.moved&&(this.$refs.reorderStatus.textContent="",this.$nextTick(()=>{!this.$root.isConnected||!this.rows.includes(n)||(this.$refs.reorderStatus.textContent=this.rowDescription(n,this.rows.indexOf(n),r.moved),[document.body,e].includes(document.activeElement)&&e.isConnected&&this.$root.contains(e)&&!e.disabled&&!e.hasAttribute("data-reorder-hidden")&&e.focus({preventScroll:!0}))}))},rowDescription(t,i,e=r.position){return e.replace(/:label|:position|:count/g,s=>({":label":String(t.key??"").trim()||r.row,":position":String(i+1),":count":String(this.rows.length)})[s])},updateRows(){let i=Alpine.raw(this.state).map(({key:e,value:s})=>({id:this.nextRowId++,key:e,value:s}));this.rows.forEach(e=>{(e.key===""||e.key===null)&&i.push(e)}),this.rows=i},getState(){return this.rows.filter(t=>t.key!==""&&t.key!==null).map(({key:t,value:i})=>({key:t,value:i}))},updateState(){let t=this.getState();JSON.stringify(this.state)!==JSON.stringify(t)&&(this.state=t)}}}export{h as default};
|
||||
@@ -0,0 +1,51 @@
|
||||
var ss=Object.defineProperty;var Ld=Object.getOwnPropertyDescriptor;var Cd=Object.getOwnPropertyNames;var Ed=Object.prototype.hasOwnProperty;var zd=(o,p,m)=>()=>{if(m)throw m[0];try{return o&&(p=o(o=0)),p}catch(S){throw m=[S],S}};var Ke=(o,p)=>()=>{try{return p||o((p={exports:{}}).exports,p),p.exports}catch(m){throw p=0,m}};var Md=(o,p,m,S)=>{if(p&&typeof p=="object"||typeof p=="function")for(let b of Cd(p))!Ed.call(o,b)&&b!==m&&ss(o,b,{get:()=>p[b],enumerable:!(S=Ld(p,b))||S.enumerable});return o};var Ad=o=>Md(ss({},"__esModule",{value:!0}),o);var We=Ke((Yo,Qo)=>{(function(o,p){typeof Yo=="object"&&typeof Qo<"u"?Qo.exports=p():typeof define=="function"&&define.amd?define(p):(o=o||self,o.CodeMirror=p())})(Yo,(function(){"use strict";var o=navigator.userAgent,p=navigator.platform,m=/gecko\/\d/i.test(o),S=/MSIE \d/.test(o),b=/Trident\/(?:[7-9]|\d{2,})\..*rv:(\d+)/.exec(o),T=/Edge\/(\d+)/.exec(o),s=S||b||T,h=s&&(S?document.documentMode||6:+(T||b)[1]),g=!T&&/WebKit\//.test(o),C=g&&/Qt\/\d+\.\d+/.test(o),_=!T&&/Chrome\/(\d+)/.exec(o),c=_&&+_[1],d=/Opera\//.test(o),w=/Apple Computer/.test(navigator.vendor),E=/Mac OS X 1\d\D([8-9]|\d\d)\D/.test(o),z=/PhantomJS/.test(o),k=w&&(/Mobile\/\w+/.test(o)||navigator.maxTouchPoints>2),R=/Android/.test(o),M=k||R||/webOS|BlackBerry|Opera Mini|Opera Mobi|IEMobile/i.test(o),I=k||/Mac/.test(p),U=/\bCrOS\b/.test(o),J=/win/i.test(p),re=d&&o.match(/Version\/(\d*\.\d*)/);re&&(re=Number(re[1])),re&&re>=15&&(d=!1,g=!0);var F=I&&(C||d&&(re==null||re<12.11)),q=m||s&&h>=9;function D(e){return new RegExp("(^|\\s)"+e+"(?:$|\\s)\\s*")}var Q=function(e,t){var n=e.className,r=D(t).exec(n);if(r){var i=n.slice(r.index+r[0].length);e.className=n.slice(0,r.index)+(i?r[1]+i:"")}};function j(e){for(var t=e.childNodes.length;t>0;--t)e.removeChild(e.firstChild);return e}function V(e,t){return j(e).appendChild(t)}function y(e,t,n,r){var i=document.createElement(e);if(n&&(i.className=n),r&&(i.style.cssText=r),typeof t=="string")i.appendChild(document.createTextNode(t));else if(t)for(var a=0;a<t.length;++a)i.appendChild(t[a]);return i}function G(e,t,n,r){var i=y(e,t,n,r);return i.setAttribute("role","presentation"),i}var X;document.createRange?X=function(e,t,n,r){var i=document.createRange();return i.setEnd(r||e,n),i.setStart(e,t),i}:X=function(e,t,n){var r=document.body.createTextRange();try{r.moveToElementText(e.parentNode)}catch{return r}return r.collapse(!0),r.moveEnd("character",n),r.moveStart("character",t),r};function O(e,t){if(t.nodeType==3&&(t=t.parentNode),e.contains)return e.contains(t);do if(t.nodeType==11&&(t=t.host),t==e)return!0;while(t=t.parentNode)}function H(e){var t=e.ownerDocument||e,n;try{n=e.activeElement}catch{n=t.body||null}for(;n&&n.shadowRoot&&n.shadowRoot.activeElement;)n=n.shadowRoot.activeElement;return n}function se(e,t){var n=e.className;D(t).test(n)||(e.className+=(n?" ":"")+t)}function _e(e,t){for(var n=e.split(" "),r=0;r<n.length;r++)n[r]&&!D(n[r]).test(t)&&(t+=" "+n[r]);return t}var N=function(e){e.select()};k?N=function(e){e.selectionStart=0,e.selectionEnd=e.value.length}:s&&(N=function(e){try{e.select()}catch{}});function L(e){return e.display.wrapper.ownerDocument}function he(e){return ze(e.display.wrapper)}function ze(e){return e.getRootNode?e.getRootNode():e.ownerDocument}function de(e){return L(e).defaultView}function Ee(e){var t=Array.prototype.slice.call(arguments,1);return function(){return e.apply(null,t)}}function ge(e,t,n){t||(t={});for(var r in e)Object.prototype.hasOwnProperty.call(e,r)&&(n!==!1||!Object.prototype.hasOwnProperty.call(t,r))&&(t[r]=e[r]);return t}function Oe(e,t,n,r,i){t==null&&(t=e.search(/[^\s\u00a0]/),t==-1&&(t=e.length));for(var a=r||0,l=i||0;;){var u=e.indexOf(" ",a);if(u<0||u>=t)return l+(t-a);l+=u-a,l+=n-l%n,a=u+1}}var qe=function(){this.id=null,this.f=null,this.time=0,this.handler=Ee(this.onTimeout,this)};qe.prototype.onTimeout=function(e){e.id=0,e.time<=+new Date?e.f():setTimeout(e.handler,e.time-+new Date)},qe.prototype.set=function(e,t){this.f=t;var n=+new Date+e;(!this.id||n<this.time)&&(clearTimeout(this.id),this.id=setTimeout(this.handler,e),this.time=n)};function Se(e,t){for(var n=0;n<e.length;++n)if(e[n]==t)return n;return-1}var Be=50,Ze={toString:function(){return"CodeMirror.Pass"}},ke={scroll:!1},Je={origin:"*mouse"},Re={origin:"+move"};function Ge(e,t,n){for(var r=0,i=0;;){var a=e.indexOf(" ",r);a==-1&&(a=e.length);var l=a-r;if(a==e.length||i+l>=t)return r+Math.min(l,t-i);if(i+=a-r,i+=n-i%n,r=a+1,i>=t)return r}}var $=[""];function Z(e){for(;$.length<=e;)$.push(ce($)+" ");return $[e]}function ce(e){return e[e.length-1]}function He(e,t){for(var n=[],r=0;r<e.length;r++)n[r]=t(e[r],r);return n}function te(e,t,n){for(var r=0,i=n(t);r<e.length&&n(e[r])<=i;)r++;e.splice(r,0,t)}function fe(){}function oe(e,t){var n;return Object.create?n=Object.create(e):(fe.prototype=e,n=new fe),t&&ge(t,n),n}var Ue=/[\u00df\u0587\u0590-\u05f4\u0600-\u06ff\u3040-\u309f\u30a0-\u30ff\u3400-\u4db5\u4e00-\u9fcc\uac00-\ud7af]/;function we(e){return/\Line truncated
|
||||
|
||||
b`.split(/\n/).length!=3?function(e){for(var t=0,n=[],r=e.length;t<=r;){var i=e.indexOf(`
|
||||
`,t);i==-1&&(i=e.length);var a=e.slice(t,e.charAt(i-1)=="\r"?i-1:i),l=a.indexOf("\r");l!=-1?(n.push(a.slice(0,l)),t+=l+1):(n.push(a),t=i+1)}return n}:function(e){return e.split(/\r\n?|\n/)},hr=window.getSelection?function(e){try{return e.selectionStart!=e.selectionEnd}catch{return!1}}:function(e){var t;try{t=e.ownerDocument.selection.createRange()}catch{}return!t||t.parentElement()!=e?!1:t.compareEndPoints("StartToEnd",t)!=0},ti=(function(){var e=y("div");return"oncopy"in e?!0:(e.setAttribute("oncopy","return;"),typeof e.oncopy=="function")})(),$t=null;function to(e){if($t!=null)return $t;var t=V(e,y("span","x")),n=t.getBoundingClientRect(),r=X(t,0,1).getBoundingClientRect();return $t=Math.abs(n.left-r.left)>1}var Wr={},Kt={};function Gt(e,t){arguments.length>2&&(t.dependencies=Array.prototype.slice.call(arguments,2)),Wr[e]=t}function Cr(e,t){Kt[e]=t}function Ur(e){if(typeof e=="string"&&Kt.hasOwnProperty(e))e=Kt[e];else if(e&&typeof e.name=="string"&&Kt.hasOwnProperty(e.name)){var t=Kt[e.name];typeof t=="string"&&(t={name:t}),e=oe(t,e),e.name=t.name}else{if(typeof e=="string"&&/^[\w\-]+\/[\w\-]+\+xml$/.test(e))return Ur("application/xml");if(typeof e=="string"&&/^[\w\-]+\/[\w\-]+\+json$/.test(e))return Ur("application/json")}return typeof e=="string"?{name:e}:e||{name:"null"}}function $r(e,t){t=Ur(t);var n=Wr[t.name];if(!n)return $r(e,"text/plain");var r=n(e,t);if(gr.hasOwnProperty(t.name)){var i=gr[t.name];for(var a in i)i.hasOwnProperty(a)&&(r.hasOwnProperty(a)&&(r["_"+a]=r[a]),r[a]=i[a])}if(r.name=t.name,t.helperType&&(r.helperType=t.helperType),t.modeProps)for(var l in t.modeProps)r[l]=t.modeProps[l];return r}var gr={};function Kr(e,t){var n=gr.hasOwnProperty(e)?gr[e]:gr[e]={};ge(t,n)}function Vt(e,t){if(t===!0)return t;if(e.copyState)return e.copyState(t);var n={};for(var r in t){var i=t[r];i instanceof Array&&(i=i.concat([])),n[r]=i}return n}function _n(e,t){for(var n;e.innerMode&&(n=e.innerMode(t),!(!n||n.mode==e));)t=n.state,e=n.mode;return n||{mode:e,state:t}}function Gr(e,t,n){return e.startState?e.startState(t,n):!0}var at=function(e,t,n){this.pos=this.start=0,this.string=e,this.tabSize=t||8,this.lastColumnPos=this.lastColumnValue=0,this.lineStart=0,this.lineOracle=n};at.prototype.eol=function(){return this.pos>=this.string.length},at.prototype.sol=function(){return this.pos==this.lineStart},at.prototype.peek=function(){return this.string.charAt(this.pos)||void 0},at.prototype.next=function(){if(this.pos<this.string.length)return this.string.charAt(this.pos++)},at.prototype.eat=function(e){var t=this.string.charAt(this.pos),n;if(typeof e=="string"?n=t==e:n=t&&(e.test?e.test(t):e(t)),n)return++this.pos,t},at.prototype.eatWhile=function(e){for(var t=this.pos;this.eat(e););return this.pos>t},at.prototype.eatSpace=function(){for(var e=this.pos;/[\s\u00a0]/.test(this.string.charAt(this.pos));)++this.pos;return this.pos>e},at.prototype.skipToEnd=function(){this.pos=this.string.length},at.prototype.skipTo=function(e){var t=this.string.indexOf(e,this.pos);if(t>-1)return this.pos=t,!0},at.prototype.backUp=function(e){this.pos-=e},at.prototype.column=function(){return this.lastColumnPos<this.start&&(this.lastColumnValue=Oe(this.string,this.start,this.tabSize,this.lastColumnPos,this.lastColumnValue),this.lastColumnPos=this.start),this.lastColumnValue-(this.lineStart?Oe(this.string,this.lineStart,this.tabSize):0)},at.prototype.indentation=function(){return Oe(this.string,null,this.tabSize)-(this.lineStart?Oe(this.string,this.lineStart,this.tabSize):0)},at.prototype.match=function(e,t,n){if(typeof e=="string"){var r=function(l){return n?l.toLowerCase():l},i=this.string.substr(this.pos,e.length);if(r(i)==r(e))return t!==!1&&(this.pos+=e.length),!0}else{var a=this.string.slice(this.pos).match(e);return a&&a.index>0?null:(a&&t!==!1&&(this.pos+=a[0].length),a)}},at.prototype.current=function(){return this.string.slice(this.start,this.pos)},at.prototype.hideFirstChars=function(e,t){this.lineStart+=e;try{return t()}finally{this.lineStart-=e}},at.prototype.lookAhead=function(e){var t=this.lineOracle;return t&&t.lookAhead(e)},at.prototype.baseToken=function(){var e=this.lineOracle;return e&&e.baseToken(this.pos)};function Ae(e,t){if(t-=e.first,t<0||t>=e.size)throw new Error("There is no line "+(t+e.first)+" in the document.");for(var n=e;!n.lines;)for(var r=0;;++r){var i=n.children[r],a=i.chunkSize();if(t<a){n=i;break}t-=a}return n.lines[t]}function ir(e,t,n){var r=[],i=t.line;return e.iter(t.line,n.line+1,function(a){var l=a.text;i==n.line&&(l=l.slice(0,n.ch)),i==t.line&&(l=l.slice(t.ch)),r.push(l),++i}),r}function kn(e,t,n){var r=[];return e.iter(t,n,function(i){r.push(i.text)}),r}function Bt(e,t){var n=t-e.height;if(n)for(var r=e;r;r=r.parent)r.height+=n}function x(e){if(e.parent==null)return null;for(var t=e.parent,n=Se(t.lines,e),r=t.parent;r;t=r,r=r.parent)for(var i=0;r.children[i]!=t;++i)n+=r.children[i].chunkSize();return n+t.first}function P(e,t){var n=e.first;e:do{for(var r=0;r<e.children.length;++r){var
Line truncated
|
||||
`?(ue=A.appendChild(y("span",ee[0]=="\r"?"\u240D":"\u2424","cm-invalidchar")),ue.setAttribute("cm-text",ee[0]),e.col+=1):(ue=e.cm.options.specialCharPlaceholder(ee[0]),ue.setAttribute("cm-text",ee[0]),s&&h<9?A.appendChild(y("span",[ue])):A.appendChild(ue),e.col+=1);e.map.push(e.pos,e.pos+1,ue),e.pos++}}if(e.trailingSpace=u.charCodeAt(t.length-1)==32,n||r||i||v||a||l){var xe=n||"";r&&(xe+=r),i&&(xe+=i);var be=y("span",[A],xe,a);if(l)for(var Ce in l)l.hasOwnProperty(Ce)&&Ce!="style"&&Ce!="class"&&be.setAttribute(Ce,l[Ce]);return e.content.appendChild(be)}e.content.appendChild(A)}}function $c(e,t){if(e.length>1&&!/ /.test(e))return e;for(var n=t,r="",i=0;i<e.length;i++){var a=e.charAt(i);a==" "&&n&&(i==e.length-1||e.charCodeAt(i+1)==32)&&(a="\xA0"),r+=a,n=a==" "}return r}function Kc(e,t){return function(n,r,i,a,l,u,f){i=i?i+" cm-force-border":"cm-force-border";for(var v=n.pos,A=v+r.length;;){for(var B=void 0,ee=0;ee<t.length&&(B=t[ee],!(B.to>v&&B.from<=v));ee++);if(B.to>=A)return e(n,r,i,a,l,u,f);e(n,r.slice(0,B.to-v),i,a,null,u,f),a=null,r=r.slice(B.to-v),v=B.to}}}function Ea(e,t,n,r){var i=!r&&n.widgetNode;i&&e.map.push(e.pos,e.pos+t,i),!r&&e.cm.display.input.needsContentAttribute&&(i||(i=e.content.appendChild(document.createElement("span"))),i.setAttribute("cm-marker",n.id)),i&&(e.cm.display.input.setUneditable(i),e.content.appendChild(i)),e.pos+=t,e.trailingSpace=!1}function Gc(e,t,n){var r=e.markedSpans,i=e.text,a=0;if(!r){for(var l=1;l<n.length;l+=2)t.addToken(t,i.slice(a,a=n[l]),La(n[l+1],t.cm.options));return}for(var u=i.length,f=0,v=1,A="",B,ee,Y=0,ie,ue,me,ve,xe;;){if(Y==f){ie=ue=me=ee="",xe=null,ve=null,Y=1/0;for(var be=[],Ce=void 0,Ne=0;Ne<r.length;++Ne){var Fe=r[Ne],$e=Fe.marker;if($e.type=="bookmark"&&Fe.from==f&&$e.widgetNode)be.push($e);else if(Fe.from<=f&&(Fe.to==null||Fe.to>f||$e.collapsed&&Fe.to==f&&Fe.from==f)){if(Fe.to!=null&&Fe.to!=f&&Y>Fe.to&&(Y=Fe.to,ue=""),$e.className&&(ie+=" "+$e.className),$e.css&&(ee=(ee?ee+";":"")+$e.css),$e.startStyle&&Fe.from==f&&(me+=" "+$e.startStyle),$e.endStyle&&Fe.to==Y&&(Ce||(Ce=[])).push($e.endStyle,Fe.to),$e.title&&((xe||(xe={})).title=$e.title),$e.attributes)for(var Ve in $e.attributes)(xe||(xe={}))[Ve]=$e.attributes[Ve];$e.collapsed&&(!ve||oo(ve.marker,$e)<0)&&(ve=Fe)}else Fe.from>f&&Y>Fe.from&&(Y=Fe.from)}if(Ce)for(var vt=0;vt<Ce.length;vt+=2)Ce[vt+1]==Y&&(ue+=" "+Ce[vt]);if(!ve||ve.from==f)for(var rt=0;rt<be.length;++rt)Ea(t,0,be[rt]);if(ve&&(ve.from||0)==f){if(Ea(t,(ve.to==null?u+1:ve.to)-f,ve.marker,ve.from==null),ve.to==null)return;ve.to==f&&(ve=!1)}}if(f>=u)break;for(var Ot=Math.min(u,Y);;){if(A){var At=f+A.length;if(!ve){var ut=At>Ot?A.slice(0,Ot-f):A;t.addToken(t,ut,B?B+ie:ie,me,f+ut.length==Y?ue:"",ee,xe)}if(At>=Ot){A=A.slice(Ot-f),f=Ot;break}f=At,me=""}A=i.slice(a,a=n[v++]),B=La(n[v++],t.cm.options)}}}function za(e,t,n){this.line=t,this.rest=Pc(t),this.size=this.rest?x(ce(this.rest))-n+1:1,this.node=this.text=null,this.hidden=mr(e,t)}function si(e,t,n){for(var r=[],i,a=t;a<n;a=i){var l=new za(e.doc,Ae(e.doc,a),a);i=a+l.size,r.push(l)}return r}var Yr=null;function Zc(e){Yr?Yr.ops.push(e):e.ownsGroup=Yr={ops:[e],delayedCallbacks:[]}}function Xc(e){var t=e.delayedCallbacks,n=0;do{for(;n<t.length;n++)t[n].call(null);for(var r=0;r<e.ops.length;r++){var i=e.ops[r];if(i.cursorActivityHandlers)for(;i.cursorActivityCalled<i.cursorActivityHandlers.length;)i.cursorActivityHandlers[i.cursorActivityCalled++].call(null,i.cm)}}while(n<t.length)}function Yc(e,t){var n=e.ownsGroup;if(n)try{Xc(n)}finally{Yr=null,t(n)}}var Tn=null;function ht(e,t){var n=nr(e,t);if(n.length){var r=Array.prototype.slice.call(arguments,2),i;Yr?i=Yr.delayedCallbacks:Tn?i=Tn:(i=Tn=[],setTimeout(Qc,0));for(var a=function(u){i.push(function(){return n[u].apply(null,r)})},l=0;l<n.length;++l)a(l)}}function Qc(){var e=Tn;Tn=null;for(var t=0;t<e.length;++t)e[t]()}function Ma(e,t,n,r){for(var i=0;i<t.changes.length;i++){var a=t.changes[i];a=="text"?Jc(e,t):a=="gutter"?Da(e,t,n,r):a=="class"?uo(e,t):a=="widget"&&ef(e,t,r)}t.changes=null}function Ln(e){return e.node==e.text&&(e.node=y("div",null,null,"position: relative"),e.text.parentNode&&e.text.parentNode.replaceChild(e.node,e.text),e.node.appendChild(e.text),s&&h<8&&(e.node.style.zIndex=2)),e.node}function Vc(e,t){var n=t.bgClass?t.bgClass+" "+(t.line.bgClass||""):t.line.bgClass;if(n&&(n+=" CodeMirror-linebackground"),t.background)n?t.background.className=n:(t.background.parentNode.removeChild(t.background),t.background=null);else if(n){var r=Ln(t);t.background=r.insertBefore(y("div",null,n),r.firstChild),e.display.input.setUneditable(t.background)}}function Aa(e,t){var n=e.display.externalMeasured;return n&&n.line==t.line?(e.display.externalMeasured=null,t.measure=n.measure,n.built):Ca(e,t)}function Jc(e,t){var n=t.text.className,r=Aa(e,t);t.text==t.node&&(t.node=r.pre),t.text.parentNode.replaceChild(r.pre,t.text),t.text=r.pre,r.bgClass!=t.bgClass||r.textClass!=t.textClass?(t.bgClass=r.bgClass,t.textClass=r.textClass,uo(e,t)):n&&(t.te
Line truncated
|
||||
top: `+Ce+"px; width: "+(Ne??f-be)+`px;
|
||||
height: `+(Fe-Ce)+"px"))}function B(be,Ce,Ne){var Fe=Ae(i,be),$e=Fe.text.length,Ve,vt;function rt(ut,Dt){return fi(e,ne(be,ut),"div",Fe,Dt)}function Ot(ut,Dt,yt){var ft=Ga(e,Fe,null,ut),ct=Dt=="ltr"==(yt=="after")?"left":"right",lt=yt=="after"?ft.begin:ft.end-(/\s/.test(Fe.text.charAt(ft.end-1))?2:1);return rt(lt,ct)[ct]}var At=Pe(Fe,i.direction);return nt(At,Ce||0,Ne??$e,function(ut,Dt,yt,ft){var ct=yt=="ltr",lt=rt(ut,ct?"left":"right"),qt=rt(Dt-1,ct?"right":"left"),pn=Ce==null&&ut==0,Sr=Ne==null&&Dt==$e,St=ft==0,rr=!At||ft==At.length-1;if(qt.top-lt.top<=3){var bt=(v?pn:Sr)&&St,Zo=(v?Sr:pn)&&rr,cr=bt?u:(ct?lt:qt).left,Nr=Zo?f:(ct?qt:lt).right;A(cr,lt.top,Nr-cr,lt.bottom)}else{var Or,Lt,hn,Xo;ct?(Or=v&&pn&&St?u:lt.left,Lt=v?f:Ot(ut,yt,"before"),hn=v?u:Ot(Dt,yt,"after"),Xo=v&&Sr&&rr?f:qt.right):(Or=v?Ot(ut,yt,"before"):u,Lt=!v&&pn&&St?f:lt.right,hn=!v&&Sr&&rr?u:qt.left,Xo=v?Ot(Dt,yt,"after"):f),A(Or,lt.top,Lt-Or,lt.bottom),lt.bottom<qt.top&&A(u,lt.bottom,null,qt.top),A(hn,qt.top,Xo-hn,qt.bottom)}(!Ve||pi(lt,Ve)<0)&&(Ve=lt),pi(qt,Ve)<0&&(Ve=qt),(!vt||pi(lt,vt)<0)&&(vt=lt),pi(qt,vt)<0&&(vt=qt)}),{start:Ve,end:vt}}var ee=t.from(),Y=t.to();if(ee.line==Y.line)B(ee.line,ee.ch,Y.ch);else{var ie=Ae(i,ee.line),ue=Ae(i,Y.line),me=Zt(ie)==Zt(ue),ve=B(ee.line,ee.ch,me?ie.text.length+1:null).end,xe=B(Y.line,me?0:null,Y.ch).start;me&&(ve.top<xe.top-2?(A(ve.right,ve.top,null,ve.bottom),A(u,xe.top,xe.left,xe.bottom)):A(ve.right,ve.top,xe.left-ve.right,ve.bottom)),ve.bottom<xe.top&&A(u,ve.bottom,null,xe.top)}n.appendChild(a)}function ko(e){if(e.state.focused){var t=e.display;clearInterval(t.blinker);var n=!0;t.cursorDiv.style.visibility="",e.options.cursorBlinkRate>0?t.blinker=setInterval(function(){e.hasFocus()||en(e),t.cursorDiv.style.visibility=(n=!n)?"":"hidden"},e.options.cursorBlinkRate):e.options.cursorBlinkRate<0&&(t.cursorDiv.style.visibility="hidden")}}function Qa(e){e.hasFocus()||(e.display.input.focus(),e.state.focused||So(e))}function wo(e){e.state.delayingBlurEvent=!0,setTimeout(function(){e.state.delayingBlurEvent&&(e.state.delayingBlurEvent=!1,e.state.focused&&en(e))},100)}function So(e,t){e.state.delayingBlurEvent&&!e.state.draggingText&&(e.state.delayingBlurEvent=!1),e.options.readOnly!="nocursor"&&(e.state.focused||(it(e,"focus",e,t),e.state.focused=!0,se(e.display.wrapper,"CodeMirror-focused"),!e.curOp&&e.display.selForContextMenu!=e.doc.sel&&(e.display.input.reset(),g&&setTimeout(function(){return e.display.input.reset(!0)},20)),e.display.input.receivedFocus()),ko(e))}function en(e,t){e.state.delayingBlurEvent||(e.state.focused&&(it(e,"blur",e,t),e.state.focused=!1,Q(e.display.wrapper,"CodeMirror-focused")),clearInterval(e.display.blinker),setTimeout(function(){e.state.focused||(e.display.shift=!1)},150))}function hi(e){for(var t=e.display,n=t.lineDiv.offsetTop,r=Math.max(0,t.scroller.getBoundingClientRect().top),i=t.lineDiv.getBoundingClientRect().top,a=0,l=0;l<t.view.length;l++){var u=t.view[l],f=e.options.lineWrapping,v=void 0,A=0;if(!u.hidden){if(i+=u.line.height,s&&h<8){var B=u.node.offsetTop+u.node.offsetHeight;v=B-n,n=B}else{var ee=u.node.getBoundingClientRect();v=ee.bottom-ee.top,!f&&u.text.firstChild&&(A=u.text.firstChild.getBoundingClientRect().right-ee.left-1)}var Y=u.line.height-v;if((Y>.005||Y<-.005)&&(i<r&&(a-=Y),Bt(u.line,v),Va(u.line),u.rest))for(var ie=0;ie<u.rest.length;ie++)Va(u.rest[ie]);if(A>e.display.sizerWidth){var ue=Math.ceil(A/Jr(e.display));ue>e.display.maxLineLength&&(e.display.maxLineLength=ue,e.display.maxLine=u.line,e.display.maxLineChanged=!0)}}}Math.abs(a)>2&&(t.scroller.scrollTop+=a)}function Va(e){if(e.widgets)for(var t=0;t<e.widgets.length;++t){var n=e.widgets[t],r=n.node.parentNode;r&&(n.height=r.offsetHeight)}}function gi(e,t,n){var r=n&&n.top!=null?Math.max(0,n.top):e.scroller.scrollTop;r=Math.floor(r-ui(e));var i=n&&n.bottom!=null?n.bottom:r+e.wrapper.clientHeight,a=P(t,r),l=P(t,i);if(n&&n.ensure){var u=n.ensure.from.line,f=n.ensure.to.line;u<a?(a=u,l=P(t,ar(Ae(t,u))+e.wrapper.clientHeight)):Math.min(f,t.lastLine())>=l&&(a=P(t,ar(Ae(t,f))-e.wrapper.clientHeight),l=f)}return{from:a,to:Math.max(l,a+1)}}function hf(e,t){if(!ot(e,"scrollCursorIntoView")){var n=e.display,r=n.sizer.getBoundingClientRect(),i=null,a=n.wrapper.ownerDocument;if(t.top+r.top<0?i=!0:t.bottom+r.top>(a.defaultView.innerHeight||a.documentElement.clientHeight)&&(i=!1),i!=null&&!z){var l=y("div","\u200B",null,`position: absolute;
|
||||
top: `+(t.top-n.viewOffset-ui(e.display))+`px;
|
||||
height: `+(t.bottom-t.top+er(e)+n.barHeight)+`px;
|
||||
left: `+t.left+"px; width: "+Math.max(2,t.right-t.left)+"px;");e.display.lineSpace.appendChild(l),l.scrollIntoView(i),e.display.lineSpace.removeChild(l)}}}function gf(e,t,n,r){r==null&&(r=0);var i;!e.options.lineWrapping&&t==n&&(n=t.sticky=="before"?ne(t.line,t.ch+1,"before"):t,t=t.ch?ne(t.line,t.sticky=="before"?t.ch-1:t.ch,"after"):t);for(var a=0;a<5;a++){var l=!1,u=Xt(e,t),f=!n||n==t?u:Xt(e,n);i={left:Math.min(u.left,f.left),top:Math.min(u.top,f.top)-r,right:Math.max(u.left,f.left),bottom:Math.max(u.bottom,f.bottom)+r};var v=To(e,i),A=e.doc.scrollTop,B=e.doc.scrollLeft;if(v.scrollTop!=null&&(An(e,v.scrollTop),Math.abs(e.doc.scrollTop-A)>1&&(l=!0)),v.scrollLeft!=null&&(Dr(e,v.scrollLeft),Math.abs(e.doc.scrollLeft-B)>1&&(l=!0)),!l)break}return i}function mf(e,t){var n=To(e,t);n.scrollTop!=null&&An(e,n.scrollTop),n.scrollLeft!=null&&Dr(e,n.scrollLeft)}function To(e,t){var n=e.display,r=Vr(e.display);t.top<0&&(t.top=0);var i=e.curOp&&e.curOp.scrollTop!=null?e.curOp.scrollTop:n.scroller.scrollTop,a=fo(e),l={};t.bottom-t.top>a&&(t.bottom=t.top+a);var u=e.doc.height+co(n),f=t.top<r,v=t.bottom>u-r;if(t.top<i)l.scrollTop=f?0:t.top;else if(t.bottom>i+a){var A=Math.min(t.top,(v?u:t.bottom)-a);A!=i&&(l.scrollTop=A)}var B=e.options.fixedGutter?0:n.gutters.offsetWidth,ee=e.curOp&&e.curOp.scrollLeft!=null?e.curOp.scrollLeft:n.scroller.scrollLeft-B,Y=Er(e)-n.gutters.offsetWidth,ie=t.right-t.left>Y;return ie&&(t.right=t.left+Y),t.left<10?l.scrollLeft=0:t.left<ee?l.scrollLeft=Math.max(0,t.left+B-(ie?0:10)):t.right>Y+ee-3&&(l.scrollLeft=t.right+(ie?0:10)-Y),l}function Lo(e,t){t!=null&&(mi(e),e.curOp.scrollTop=(e.curOp.scrollTop==null?e.doc.scrollTop:e.curOp.scrollTop)+t)}function tn(e){mi(e);var t=e.getCursor();e.curOp.scrollToPos={from:t,to:t,margin:e.options.cursorScrollMargin}}function Mn(e,t,n){(t!=null||n!=null)&&mi(e),t!=null&&(e.curOp.scrollLeft=t),n!=null&&(e.curOp.scrollTop=n)}function vf(e,t){mi(e),e.curOp.scrollToPos=t}function mi(e){var t=e.curOp.scrollToPos;if(t){e.curOp.scrollToPos=null;var n=$a(e,t.from),r=$a(e,t.to);Ja(e,n,r,t.margin)}}function Ja(e,t,n,r){var i=To(e,{left:Math.min(t.left,n.left),top:Math.min(t.top,n.top)-r,right:Math.max(t.right,n.right),bottom:Math.max(t.bottom,n.bottom)+r});Mn(e,i.scrollLeft,i.scrollTop)}function An(e,t){Math.abs(e.doc.scrollTop-t)<2||(m||Eo(e,{top:t}),el(e,t,!0),m&&Eo(e),Fn(e,100))}function el(e,t,n){t=Math.max(0,Math.min(e.display.scroller.scrollHeight-e.display.scroller.clientHeight,t)),!(e.display.scroller.scrollTop==t&&!n)&&(e.doc.scrollTop=t,e.display.scrollbars.setScrollTop(t),e.display.scroller.scrollTop!=t&&(e.display.scroller.scrollTop=t))}function Dr(e,t,n,r){t=Math.max(0,Math.min(t,e.display.scroller.scrollWidth-e.display.scroller.clientWidth)),!((n?t==e.doc.scrollLeft:Math.abs(e.doc.scrollLeft-t)<2)&&!r)&&(e.doc.scrollLeft=t,ol(e),e.display.scroller.scrollLeft!=t&&(e.display.scroller.scrollLeft=t),e.display.scrollbars.setScrollLeft(t))}function Dn(e){var t=e.display,n=t.gutters.offsetWidth,r=Math.round(e.doc.height+co(e.display));return{clientHeight:t.scroller.clientHeight,viewHeight:t.wrapper.clientHeight,scrollWidth:t.scroller.scrollWidth,clientWidth:t.scroller.clientWidth,viewWidth:t.wrapper.clientWidth,barLeft:e.options.fixedGutter?n:0,docHeight:r,scrollHeight:r+er(e)+t.barHeight,nativeBarWidth:t.nativeBarWidth,gutterWidth:n}}var qr=function(e,t,n){this.cm=n;var r=this.vert=y("div",[y("div",null,null,"min-width: 1px")],"CodeMirror-vscrollbar"),i=this.horiz=y("div",[y("div",null,null,"height: 100%; min-height: 1px")],"CodeMirror-hscrollbar");r.tabIndex=i.tabIndex=-1,e(r),e(i),Ie(r,"scroll",function(){r.clientHeight&&t(r.scrollTop,"vertical")}),Ie(i,"scroll",function(){i.clientWidth&&t(i.scrollLeft,"horizontal")}),this.checkedZeroWidth=!1,s&&h<8&&(this.horiz.style.minHeight=this.vert.style.minWidth="18px")};qr.prototype.update=function(e){var t=e.scrollWidth>e.clientWidth+1,n=e.scrollHeight>e.clientHeight+1,r=e.nativeBarWidth;if(n){this.vert.style.display="block",this.vert.style.bottom=t?r+"px":"0";var i=e.viewHeight-(t?r:0);this.vert.firstChild.style.height=Math.max(0,e.scrollHeight-e.clientHeight+i)+"px"}else this.vert.scrollTop=0,this.vert.style.display="",this.vert.firstChild.style.height="0";if(t){this.horiz.style.display="block",this.horiz.style.right=n?r+"px":"0",this.horiz.style.left=e.barLeft+"px";var a=e.viewWidth-e.barLeft-(n?r:0);this.horiz.firstChild.style.width=Math.max(0,e.scrollWidth-e.clientWidth+a)+"px"}else this.horiz.style.display="",this.horiz.firstChild.style.width="0";return!this.checkedZeroWidth&&e.clientHeight>0&&(r==0&&this.zeroWidthHack(),this.checkedZeroWidth=!0),{right:n?r:0,bottom:t?r:0}},qr.prototype.setScrollLeft=function(e){this.horiz.scrollLeft!=e&&(this.horiz.scrollLeft=e),this.disableHoriz&&this.enableZeroWidthBar(this.horiz,this.disableHoriz,"horiz")},qr.prototype.setScrollTop=function(e){this.vert.scrollTop!=e&&(this.vert.scrollTop=e),this.disableVert&&this.enableZeroWidthBar(this.vert,this.di
Line truncated
|
||||
`},setDirection:mt(function(e){e!="rtl"&&(e="ltr"),e!=this.direction&&(this.direction=e,this.iter(function(t){return t.order=null}),this.cm&&qf(this.cm))})}),Mt.prototype.eachLine=Mt.prototype.iter;var Nl=0;function Kf(e){var t=this;if(Ol(t),!(ot(t,e)||lr(t.display,e))){kt(e),s&&(Nl=+new Date);var n=Mr(t,e,!0),r=e.dataTransfer.files;if(!(!n||t.isReadOnly()))if(r&&r.length&&window.FileReader&&window.File)for(var i=r.length,a=Array(i),l=0,u=function(){++l==i&>(t,function(){n=je(t.doc,n);var Y={from:n,to:n,text:t.doc.splitLines(a.filter(function(ie){return ie!=null}).join(t.doc.lineSeparator())),origin:"paste"};an(t.doc,Y),_l(t.doc,yr(je(t.doc,n),je(t.doc,xr(Y))))})()},f=function(Y,ie){if(t.options.allowDropFileTypes&&Se(t.options.allowDropFileTypes,Y.type)==-1){u();return}var ue=new FileReader;ue.onerror=function(){return u()},ue.onload=function(){var me=ue.result;if(/[\x00-\x08\x0e-\x1f]{2}/.test(me)){u();return}a[ie]=me,u()},ue.readAsText(Y)},v=0;v<r.length;v++)f(r[v],v);else{if(t.state.draggingText&&t.doc.sel.contains(n)>-1){t.state.draggingText(e),setTimeout(function(){return t.display.input.focus()},20);return}try{var A=e.dataTransfer.getData("Text");if(A){var B;if(t.state.draggingText&&!t.state.draggingText.copy&&(B=t.listSelections()),ki(t.doc,yr(n,n)),B)for(var ee=0;ee<B.length;++ee)ln(t.doc,"",B[ee].anchor,B[ee].head,"drag");t.replaceSelection(A,"around","paste"),t.display.input.focus()}}catch{}}}}function Gf(e,t){if(s&&(!e.state.draggingText||+new Date-Nl<100)){dr(t);return}if(!(ot(e,t)||lr(e.display,t))&&(t.dataTransfer.setData("Text",e.getSelection()),t.dataTransfer.effectAllowed="copyMove",t.dataTransfer.setDragImage&&!w)){var n=y("img",null,null,"position: fixed; left: 0; top: 0;");n.src="data:image/gif;base64,R0lGODlhAQABAAAAACH5BAEKAAEALAAAAAABAAEAAAICTAEAOw==",d&&(n.width=n.height=1,e.display.wrapper.appendChild(n),n._top=n.offsetTop),t.dataTransfer.setDragImage(n,0,0),d&&n.parentNode.removeChild(n)}}function Zf(e,t){var n=Mr(e,t);if(n){var r=document.createDocumentFragment();_o(e,n,r),e.display.dragCursor||(e.display.dragCursor=y("div",null,"CodeMirror-cursors CodeMirror-dragcursors"),e.display.lineSpace.insertBefore(e.display.dragCursor,e.display.cursorDiv)),V(e.display.dragCursor,r)}}function Ol(e){e.display.dragCursor&&(e.display.lineSpace.removeChild(e.display.dragCursor),e.display.dragCursor=null)}function Pl(e){if(document.getElementsByClassName){for(var t=document.getElementsByClassName("CodeMirror"),n=[],r=0;r<t.length;r++){var i=t[r].CodeMirror;i&&n.push(i)}n.length&&n[0].operation(function(){for(var a=0;a<n.length;a++)e(n[a])})}}var Bl=!1;function Xf(){Bl||(Yf(),Bl=!0)}function Yf(){var e;Ie(window,"resize",function(){e==null&&(e=setTimeout(function(){e=null,Pl(Qf)},100))}),Ie(window,"blur",function(){return Pl(en)})}function Qf(e){var t=e.display;t.cachedCharWidth=t.cachedTextHeight=t.cachedPaddingH=null,t.scrollbarsClipped=!1,e.setSize()}for(var wr={3:"Pause",8:"Backspace",9:"Tab",13:"Enter",16:"Shift",17:"Ctrl",18:"Alt",19:"Pause",20:"CapsLock",27:"Esc",32:"Space",33:"PageUp",34:"PageDown",35:"End",36:"Home",37:"Left",38:"Up",39:"Right",40:"Down",44:"PrintScrn",45:"Insert",46:"Delete",59:";",61:"=",91:"Mod",92:"Mod",93:"Mod",106:"*",107:"=",109:"-",110:".",111:"/",145:"ScrollLock",173:"-",186:";",187:"=",188:",",189:"-",190:".",191:"/",192:"`",219:"[",220:"\\",221:"]",222:"'",224:"Mod",63232:"Up",63233:"Down",63234:"Left",63235:"Right",63272:"Delete",63273:"Home",63275:"End",63276:"PageUp",63277:"PageDown",63302:"Insert"},Wn=0;Wn<10;Wn++)wr[Wn+48]=wr[Wn+96]=String(Wn);for(var Ti=65;Ti<=90;Ti++)wr[Ti]=String.fromCharCode(Ti);for(var Un=1;Un<=12;Un++)wr[Un+111]=wr[Un+63235]="F"+Un;var ur={};ur.basic={Left:"goCharLeft",Right:"goCharRight",Up:"goLineUp",Down:"goLineDown",End:"goLineEnd",Home:"goLineStartSmart",PageUp:"goPageUp",PageDown:"goPageDown",Delete:"delCharAfter",Backspace:"delCharBefore","Shift-Backspace":"delCharBefore",Tab:"defaultTab","Shift-Tab":"indentAuto",Enter:"newlineAndIndent",Insert:"toggleOverwrite",Esc:"singleSelection"},ur.pcDefault={"Ctrl-A":"selectAll","Ctrl-D":"deleteLine","Ctrl-Z":"undo","Shift-Ctrl-Z":"redo","Ctrl-Y":"redo","Ctrl-Home":"goDocStart","Ctrl-End":"goDocEnd","Ctrl-Up":"goLineUp","Ctrl-Down":"goLineDown","Ctrl-Left":"goGroupLeft","Ctrl-Right":"goGroupRight","Alt-Left":"goLineStart","Alt-Right":"goLineEnd","Ctrl-Backspace":"delGroupBefore","Ctrl-Delete":"delGroupAfter","Ctrl-S":"save","Ctrl-F":"find","Ctrl-G":"findNext","Shift-Ctrl-G":"findPrev","Shift-Ctrl-F":"replace","Shift-Ctrl-R":"replaceAll","Ctrl-[":"indentLess","Ctrl-]":"indentMore","Ctrl-U":"undoSelection","Shift-Ctrl-U":"redoSelection","Alt-U":"redoSelection",fallthrough:"basic"},ur.emacsy={"Ctrl-F":"goCharRight","Ctrl-B":"goCharLeft","Ctrl-P":"goLineUp","Ctrl-N":"goLineDown","Ctrl-A":"goLineStart","Ctrl-E":"goLineEnd","Ctrl-V":"goPageDown","Shift-Ctrl-V":"goPageUp","Ctrl-D":"delCharAfter","Ctrl-H":"delCharBefore","Alt-Backspace":"delWordBefore","Ctrl-K":"killLine","Ctrl-T":"transpoLine truncated
|
||||
`,"start")},toggleOverwrite:function(e){return e.toggleOverwrite()}};function Wl(e,t){var n=Ae(e.doc,t),r=Zt(n);return r!=n&&(t=x(r)),jo(!0,e,r,t,1)}function td(e,t){var n=Ae(e.doc,t),r=Oc(n);return r!=n&&(t=x(r)),jo(!0,e,n,t,-1)}function Ul(e,t){var n=Wl(e,t.line),r=Ae(e.doc,n.line),i=Pe(r,e.doc.direction);if(!i||i[0].level==0){var a=Math.max(n.ch,r.text.search(/\S/)),l=t.line==n.line&&t.ch<=a&&t.ch;return ne(n.line,l?0:a,n.sticky)}return n}function Ci(e,t,n){if(typeof t=="string"&&(t=$n[t],!t))return!1;e.display.input.ensurePolled();var r=e.display.shift,i=!1;try{e.isReadOnly()&&(e.state.suppressEdits=!0),n&&(e.display.shift=!1),i=t(e)!=Ze}finally{e.display.shift=r,e.state.suppressEdits=!1}return i}function rd(e,t,n){for(var r=0;r<e.state.keyMaps.length;r++){var i=un(t,e.state.keyMaps[r],n,e);if(i)return i}return e.options.extraKeys&&un(t,e.options.extraKeys,n,e)||un(t,e.options.keyMap,n,e)}var nd=new qe;function Kn(e,t,n,r){var i=e.state.keySeq;if(i){if(jl(t))return"handled";if(/\'$/.test(t)?e.state.keySeq=null:nd.set(50,function(){e.state.keySeq==i&&(e.state.keySeq=null,e.display.input.reset())}),$l(e,i+" "+t,n,r))return!0}return $l(e,t,n,r)}function $l(e,t,n,r){var i=rd(e,t,r);return i=="multi"&&(e.state.keySeq=t),i=="handled"&&ht(e,"keyHandled",e,t,n),(i=="handled"||i=="multi")&&(kt(n),ko(e)),!!i}function Kl(e,t){var n=Hl(t,!0);return n?t.shiftKey&&!e.state.keySeq?Kn(e,"Shift-"+n,t,function(r){return Ci(e,r,!0)})||Kn(e,n,t,function(r){if(typeof r=="string"?/^go[A-Z]/.test(r):r.motion)return Ci(e,r)}):Kn(e,n,t,function(r){return Ci(e,r)}):!1}function id(e,t,n){return Kn(e,"'"+n+"'",t,function(r){return Ci(e,r,!0)})}var Ro=null;function Gl(e){var t=this;if(!(e.target&&e.target!=t.display.input.getField())&&(t.curOp.focus=H(he(t)),!ot(t,e))){s&&h<11&&e.keyCode==27&&(e.returnValue=!1);var n=e.keyCode;t.display.shift=n==16||e.shiftKey;var r=Kl(t,e);d&&(Ro=r?n:null,!r&&n==88&&!ti&&(I?e.metaKey:e.ctrlKey)&&t.replaceSelection("",null,"cut")),m&&!I&&!r&&n==46&&e.shiftKey&&!e.ctrlKey&&document.execCommand&&document.execCommand("cut"),n==18&&!/\bCodeMirror-crosshair\b/.test(t.display.lineDiv.className)&&od(t)}}function od(e){var t=e.display.lineDiv;se(t,"CodeMirror-crosshair");function n(r){(r.keyCode==18||!r.altKey)&&(Q(t,"CodeMirror-crosshair"),_t(document,"keyup",n),_t(document,"mouseover",n))}Ie(document,"keyup",n),Ie(document,"mouseover",n)}function Zl(e){e.keyCode==16&&(this.doc.sel.shift=!1),ot(this,e)}function Xl(e){var t=this;if(!(e.target&&e.target!=t.display.input.getField())&&!(lr(t.display,e)||ot(t,e)||e.ctrlKey&&!e.altKey||I&&e.metaKey)){var n=e.keyCode,r=e.charCode;if(d&&n==Ro){Ro=null,kt(e);return}if(!(d&&(!e.which||e.which<10)&&Kl(t,e))){var i=String.fromCharCode(r??n);i!="\b"&&(id(t,e,i)||t.display.input.onKeyPress(e))}}}var ad=400,Ho=function(e,t,n){this.time=e,this.pos=t,this.button=n};Ho.prototype.compare=function(e,t,n){return this.time+ad>e&&ye(t,this.pos)==0&&n==this.button};var Gn,Zn;function ld(e,t){var n=+new Date;return Zn&&Zn.compare(n,e,t)?(Gn=Zn=null,"triple"):Gn&&Gn.compare(n,e,t)?(Zn=new Ho(n,e,t),Gn=null,"double"):(Gn=new Ho(n,e,t),Zn=null,"single")}function Yl(e){var t=this,n=t.display;if(!(ot(t,e)||n.activeTouch&&n.input.supportsTouch())){if(n.input.ensurePolled(),n.shift=e.shiftKey,lr(n,e)){g||(n.scroller.draggable=!1,setTimeout(function(){return n.scroller.draggable=!0},100));return}if(!Wo(t,e)){var r=Mr(t,e),i=Ut(e),a=r?ld(r,i):"single";de(t).focus(),i==1&&t.state.selectingText&&t.state.selectingText(e),!(r&&sd(t,i,r,a,e))&&(i==1?r?cd(t,r,a,e):yn(e)==n.scroller&&kt(e):i==2?(r&&_i(t.doc,r),setTimeout(function(){return n.input.focus()},20)):i==3&&(q?t.display.input.onContextMenu(e):wo(t)))}}}function sd(e,t,n,r,i){var a="Click";return r=="double"?a="Double"+a:r=="triple"&&(a="Triple"+a),a=(t==1?"Left":t==2?"Middle":"Right")+a,Kn(e,Rl(a,i),i,function(l){if(typeof l=="string"&&(l=$n[l]),!l)return!1;var u=!1;try{e.isReadOnly()&&(e.state.suppressEdits=!0),u=l(e,n)!=Ze}finally{e.state.suppressEdits=!1}return u})}function ud(e,t,n){var r=e.getOption("configureMouse"),i=r?r(e,t,n):{};if(i.unit==null){var a=U?n.shiftKey&&n.metaKey:n.altKey;i.unit=a?"rectangle":t=="single"?"char":t=="double"?"word":"line"}return(i.extend==null||e.doc.extend)&&(i.extend=e.doc.extend||n.shiftKey),i.addNew==null&&(i.addNew=I?n.metaKey:n.ctrlKey),i.moveOnDrag==null&&(i.moveOnDrag=!(I?n.altKey:n.ctrlKey)),i}function cd(e,t,n,r){s?setTimeout(Ee(Qa,e),0):e.curOp.focus=H(he(e));var i=ud(e,n,r),a=e.doc.sel,l;e.options.dragDrop&&eo&&!e.isReadOnly()&&n=="single"&&(l=a.contains(t))>-1&&(ye((l=a.ranges[l]).from(),t)<0||t.xRel>0)&&(ye(l.to(),t)>0||t.xRel<0)?fd(e,r,t,i):dd(e,r,t,i)}function fd(e,t,n,r){var i=e.display,a=!1,l=gt(e,function(v){g&&(i.scroller.draggable=!1),e.state.draggingText=!1,e.state.delayingBlurEvent&&(e.hasFocus()?e.state.delayingBlurEvent=!1:wo(e)),_t(i.wrapper.ownerDocument,"mouseup",l),_t(i.wrapper.ownerDocument,"mousemove",u),_t(i.scroller,"dragstart",f),_t(i.scroller,"drop",l),a||(kt(v),r.a
Line truncated
|
||||
`)==t){if(r.ranges.length%Qt.text.length==0){v=[];for(var A=0;A<Qt.text.length;A++)v.push(a.splitLines(Qt.text[A]))}}else f.length==r.ranges.length&&e.options.pasteLinesPerSelection&&(v=He(f,function(ve){return[ve]}));for(var B=e.curOp.updateInput,ee=r.ranges.length-1;ee>=0;ee--){var Y=r.ranges[ee],ie=Y.from(),ue=Y.to();Y.empty()&&(n&&n>0?ie=ne(ie.line,ie.ch-n):e.state.overwrite&&!u?ue=ne(ue.line,Math.min(Ae(a,ue.line).text.length,ue.ch+ce(f).length)):u&&Qt&&Qt.lineWise&&Qt.text.join(`
|
||||
`)==f.join(`
|
||||
`)&&(ie=ue=ne(ie.line,0)));var me={from:ie,to:ue,text:v?v[ee%v.length]:f,origin:i||(u?"paste":e.state.cutIncoming>l?"cut":"+input")};an(e.doc,me),ht(e,"inputRead",e,me)}t&&!u&&ns(e,t),tn(e),e.curOp.updateInput<2&&(e.curOp.updateInput=B),e.curOp.typing=!0,e.state.pasteIncoming=e.state.cutIncoming=-1}function rs(e,t){var n=e.clipboardData&&e.clipboardData.getData("Text");if(n)return e.preventDefault(),!t.isReadOnly()&&!t.options.disableInput&&t.hasFocus()&&Nt(t,function(){return $o(t,n,0,null,"paste")}),!0}function ns(e,t){if(!(!e.options.electricChars||!e.options.smartIndent))for(var n=e.doc.sel,r=n.ranges.length-1;r>=0;r--){var i=n.ranges[r];if(!(i.head.ch>100||r&&n.ranges[r-1].head.line==i.head.line)){var a=e.getModeAt(i.head),l=!1;if(a.electricChars){for(var u=0;u<a.electricChars.length;u++)if(t.indexOf(a.electricChars.charAt(u))>-1){l=Xn(e,i.head.line,"smart");break}}else a.electricInput&&a.electricInput.test(Ae(e.doc,i.head.line).text.slice(0,i.head.ch))&&(l=Xn(e,i.head.line,"smart"));l&&ht(e,"electricInput",e,i.head.line)}}}function is(e){for(var t=[],n=[],r=0;r<e.doc.sel.ranges.length;r++){var i=e.doc.sel.ranges[r].head.line,a={anchor:ne(i,0),head:ne(i+1,0)};n.push(a),t.push(e.getRange(a.anchor,a.head))}return{text:t,ranges:n}}function Ko(e,t,n,r){e.setAttribute("autocorrect",n?"on":"off"),e.setAttribute("autocapitalize",r?"on":"off"),e.setAttribute("spellcheck",!!t)}function os(){var e=y("textarea",null,null,"position: absolute; bottom: -1em; padding: 0; width: 1px; height: 1em; min-height: 1em; outline: none"),t=y("div",[e],null,"overflow: hidden; position: relative; width: 3px; height: 0px;");return g?e.style.width="1000px":e.setAttribute("wrap","off"),k&&(e.style.border="1px solid black"),t}function yd(e){var t=e.optionHandlers,n=e.helpers={};e.prototype={constructor:e,focus:function(){de(this).focus(),this.display.input.focus()},setOption:function(r,i){var a=this.options,l=a[r];a[r]==i&&r!="mode"||(a[r]=i,t.hasOwnProperty(r)&>(this,t[r])(this,i,l),it(this,"optionChange",this,r))},getOption:function(r){return this.options[r]},getDoc:function(){return this.doc},addKeyMap:function(r,i){this.state.keyMaps[i?"push":"unshift"](Li(r))},removeKeyMap:function(r){for(var i=this.state.keyMaps,a=0;a<i.length;++a)if(i[a]==r||i[a].name==r)return i.splice(a,1),!0},addOverlay:Tt(function(r,i){var a=r.token?r:e.getMode(this.options,r);if(a.startState)throw new Error("Overlays may not be stateful.");te(this.state.overlays,{mode:a,modeSpec:r,opaque:i&&i.opaque,priority:i&&i.priority||0},function(l){return l.priority}),this.state.modeGen++,zt(this)}),removeOverlay:Tt(function(r){for(var i=this.state.overlays,a=0;a<i.length;++a){var l=i[a].modeSpec;if(l==r||typeof r=="string"&&l.name==r){i.splice(a,1),this.state.modeGen++,zt(this);return}}}),indentLine:Tt(function(r,i,a){typeof i!="string"&&typeof i!="number"&&(i==null?i=this.options.smartIndent?"smart":"prev":i=i?"add":"subtract"),ae(this.doc,r)&&Xn(this,r,i,a)}),indentSelection:Tt(function(r){for(var i=this.doc.sel.ranges,a=-1,l=0;l<i.length;l++){var u=i[l];if(u.empty())u.head.line>a&&(Xn(this,u.head.line,r,!0),a=u.head.line,l==this.doc.sel.primIndex&&tn(this));else{var f=u.from(),v=u.to(),A=Math.max(a,f.line);a=Math.min(this.lastLine(),v.line-(v.ch?0:1))+1;for(var B=A;B<a;++B)Xn(this,B,r);var ee=this.doc.sel.ranges;f.ch==0&&i.length==ee.length&&ee[l].from().ch>0&&Oo(this.doc,l,new Ye(f,ee[l].to()),ke)}}}),getTokenAt:function(r,i){return ga(this,r,i)},getLineTokens:function(r,i){return ga(this,ne(r),i,!0)},getTokenTypeAt:function(r){r=je(this.doc,r);var i=da(this,Ae(this.doc,r.line)),a=0,l=(i.length-1)/2,u=r.ch,f;if(u==0)f=i[2];else for(;;){var v=a+l>>1;if((v?i[v*2-1]:0)>=u)l=v;else if(i[v*2+1]<u)a=v+1;else{f=i[v*2+2];break}}var A=f?f.indexOf("overlay "):-1;return A<0?f:A==0?null:f.slice(0,A-1)},getModeAt:function(r){var i=this.doc.mode;return i.innerMode?e.innerMode(i,this.getTokenAt(r).state).mode:i},getHelper:function(r,i){return this.getHelpers(r,i)[0]},getHelpers:function(r,i){var a=[];if(!n.hasOwnProperty(i))return a;var l=n[i],u=this.getModeAt(r);if(typeof u[i]=="string")l[u[i]]&&a.push(l[u[i]]);else if(u[i])for(var f=0;f<u[i].length;f++){var v=l[u[i][f]];v&&a.push(v)}else u.helperType&&l[u.helperType]?a.push(l[u.helperType]):l[u.name]&&a.push(l[u.name]);for(var A=0;A<l._global.length;A++){var B=l._global[A];B.pred(u,this)&&Se(a,B.val)==-1&&a.push(B.val)}return a},getStateAfter:function(r,i){var a=this.doc;return r=ua(a,r??a.first+a.size-1),wn(this,r+1,i).state},cursorCoords:function(r,i){var a,l=this.doc.sel.primary();return r==null?a=l.head:typeof r=="object"?a=je(this.doc,r):a=r?l.from():l.to(),Xt(this,a,i||"page")},charCoords:function(r,i){return fi(this,je(this.doc,r),i||"page")},coordsChar:function(r,i){return r=Ua(this,r,i||"page"),mo(this,r.left,r.top)},lineAtHeight:function(r,i){return r=Ua(this,{top:r,left:0},i||"page").top,P(this.doc,r+this.display.viewOffset)},heightAtLine:function(r,i,a){var l=!1,u;if(typeof r=="number"){var f=this.doc.first+
Line truncated
|
||||
`,me=Me(ue,Y)?"w":ee&&ue==`
|
||||
`?"n":!ee||/\s/.test(ue)?null:"p";if(ee&&!ie&&!me&&(me="s"),B&&B!=me){n<0&&(n=1,A(),t.sticky="after");break}if(me&&(B=me),n>0&&!A(!ie))break}var ve=wi(e,t,a,l,!0);return Xe(a,ve)&&(ve.hitSide=!0),ve}function as(e,t,n,r){var i=e.doc,a=t.left,l;if(r=="page"){var u=Math.min(e.display.wrapper.clientHeight,de(e).innerHeight||i(e).documentElement.clientHeight),f=Math.max(u-.5*Vr(e.display),3);l=(n>0?t.bottom:t.top)+n*f}else r=="line"&&(l=n>0?t.bottom+3:t.top-3);for(var v;v=mo(e,a,l),!!v.outside;){if(n<0?l<=0:l>=i.height){v.hitSide=!0;break}l+=n*5}return v}var Qe=function(e){this.cm=e,this.lastAnchorNode=this.lastAnchorOffset=this.lastFocusNode=this.lastFocusOffset=null,this.polling=new qe,this.composing=null,this.gracePeriod=!1,this.readDOMTimeout=null};Qe.prototype.init=function(e){var t=this,n=this,r=n.cm,i=n.div=e.lineDiv;i.contentEditable=!0,Ko(i,r.options.spellcheck,r.options.autocorrect,r.options.autocapitalize);function a(u){for(var f=u.target;f;f=f.parentNode){if(f==i)return!0;if(/\bCodeMirror-(?:line)?widget\b/.test(f.className))break}return!1}Ie(i,"paste",function(u){!a(u)||ot(r,u)||rs(u,r)||h<=11&&setTimeout(gt(r,function(){return t.updateFromDOM()}),20)}),Ie(i,"compositionstart",function(u){t.composing={data:u.data,done:!1}}),Ie(i,"compositionupdate",function(u){t.composing||(t.composing={data:u.data,done:!1})}),Ie(i,"compositionend",function(u){t.composing&&(u.data!=t.composing.data&&t.readFromDOMSoon(),t.composing.done=!0)}),Ie(i,"touchstart",function(){return n.forceCompositionEnd()}),Ie(i,"input",function(){t.composing||t.readFromDOMSoon()});function l(u){if(!(!a(u)||ot(r,u))){if(r.somethingSelected())zi({lineWise:!1,text:r.getSelections()}),u.type=="cut"&&r.replaceSelection("",null,"cut");else if(r.options.lineWiseCopyCut){var f=is(r);zi({lineWise:!0,text:f.text}),u.type=="cut"&&r.operation(function(){r.setSelections(f.ranges,0,ke),r.replaceSelection("",null,"cut")})}else return;if(u.clipboardData){u.clipboardData.clearData();var v=Qt.text.join(`
|
||||
`);if(u.clipboardData.setData("Text",v),u.clipboardData.getData("Text")==v){u.preventDefault();return}}var A=os(),B=A.firstChild;Ko(B),r.display.lineSpace.insertBefore(A,r.display.lineSpace.firstChild),B.value=Qt.text.join(`
|
||||
`);var ee=H(ze(i));N(B),setTimeout(function(){r.display.lineSpace.removeChild(A),ee.focus(),ee==i&&n.showPrimarySelection()},50)}}Ie(i,"copy",l),Ie(i,"cut",l)},Qe.prototype.screenReaderLabelChanged=function(e){e?this.div.setAttribute("aria-label",e):this.div.removeAttribute("aria-label")},Qe.prototype.prepareSelection=function(){var e=Ya(this.cm,!1);return e.focus=H(ze(this.div))==this.div,e},Qe.prototype.showSelection=function(e,t){!e||!this.cm.display.view.length||((e.focus||t)&&this.showPrimarySelection(),this.showMultipleSelections(e))},Qe.prototype.getSelection=function(){return this.cm.display.wrapper.ownerDocument.getSelection()},Qe.prototype.showPrimarySelection=function(){var e=this.getSelection(),t=this.cm,n=t.doc.sel.primary(),r=n.from(),i=n.to();if(t.display.viewTo==t.display.viewFrom||r.line>=t.display.viewTo||i.line<t.display.viewFrom){e.removeAllRanges();return}var a=Mi(t,e.anchorNode,e.anchorOffset),l=Mi(t,e.focusNode,e.focusOffset);if(!(a&&!a.bad&&l&&!l.bad&&ye(Zr(a,l),r)==0&&ye(Et(a,l),i)==0)){var u=t.display.view,f=r.line>=t.display.viewFrom&&ls(t,r)||{node:u[0].measure.map[2],offset:0},v=i.line<t.display.viewTo&&ls(t,i);if(!v){var A=u[u.length-1].measure,B=A.maps?A.maps[A.maps.length-1]:A.map;v={node:B[B.length-1],offset:B[B.length-2]-B[B.length-3]}}if(!f||!v){e.removeAllRanges();return}var ee=e.rangeCount&&e.getRangeAt(0),Y;try{Y=X(f.node,f.offset,v.offset,v.node)}catch{}Y&&(!m&&t.state.focused?(e.collapse(f.node,f.offset),Y.collapsed||(e.removeAllRanges(),e.addRange(Y))):(e.removeAllRanges(),e.addRange(Y)),ee&&e.anchorNode==null?e.addRange(ee):m&&this.startGracePeriod()),this.rememberSelection()}},Qe.prototype.startGracePeriod=function(){var e=this;clearTimeout(this.gracePeriod),this.gracePeriod=setTimeout(function(){e.gracePeriod=!1,e.selectionChanged()&&e.cm.operation(function(){return e.cm.curOp.selectionChanged=!0})},20)},Qe.prototype.showMultipleSelections=function(e){V(this.cm.display.cursorDiv,e.cursors),V(this.cm.display.selectionDiv,e.selection)},Qe.prototype.rememberSelection=function(){var e=this.getSelection();this.lastAnchorNode=e.anchorNode,this.lastAnchorOffset=e.anchorOffset,this.lastFocusNode=e.focusNode,this.lastFocusOffset=e.focusOffset},Qe.prototype.selectionInEditor=function(){var e=this.getSelection();if(!e.rangeCount)return!1;var t=e.getRangeAt(0).commonAncestorContainer;return O(this.div,t)},Qe.prototype.focus=function(){this.cm.options.readOnly!="nocursor"&&((!this.selectionInEditor()||H(ze(this.div))!=this.div)&&this.showSelection(this.prepareSelection(),!0),this.div.focus())},Qe.prototype.blur=function(){this.div.blur()},Qe.prototype.getField=function(){return this.div},Qe.prototype.supportsTouch=function(){return!0},Qe.prototype.receivedFocus=function(){var e=this,t=this;this.selectionInEditor()?setTimeout(function(){return e.pollSelection()},20):Nt(this.cm,function(){return t.cm.curOp.selectionChanged=!0});function n(){t.cm.state.focused&&(t.pollSelection(),t.polling.set(t.cm.options.pollInterval,n))}this.polling.set(this.cm.options.pollInterval,n)},Qe.prototype.selectionChanged=function(){var e=this.getSelection();return e.anchorNode!=this.lastAnchorNode||e.anchorOffset!=this.lastAnchorOffset||e.focusNode!=this.lastFocusNode||e.focusOffset!=this.lastFocusOffset},Qe.prototype.pollSelection=function(){if(!(this.readDOMTimeout!=null||this.gracePeriod||!this.selectionChanged())){var e=this.getSelection(),t=this.cm;if(R&&_&&this.cm.display.gutterSpecs.length&&xd(e.anchorNode)){this.cm.triggerOnKeyDown({type:"keydown",keyCode:8,preventDefault:Math.abs}),this.blur(),this.focus();return}if(!this.composing){this.rememberSelection();var n=Mi(t,e.anchorNode,e.anchorOffset),r=Mi(t,e.focusNode,e.focusOffset);n&&r&&Nt(t,function(){wt(t.doc,yr(n,r),ke),(n.bad||r.bad)&&(t.curOp.selectionChanged=!0)})}}},Qe.prototype.pollContent=function(){this.readDOMTimeout!=null&&(clearTimeout(this.readDOMTimeout),this.readDOMTimeout=null);var e=this.cm,t=e.display,n=e.doc.sel.primary(),r=n.from(),i=n.to();if(r.ch==0&&r.line>e.firstLine()&&(r=ne(r.line-1,Ae(e.doc,r.line-1).length)),i.ch==Ae(e.doc,i.line).text.length&&i.line<e.lastLine()&&(i=ne(i.line+1,0)),r.line<t.viewFrom||i.line>t.viewTo-1)return!1;var a,l,u;r.line==t.viewFrom||(a=Ar(e,r.line))==0?(l=x(t.view[0].line),u=t.view[0].node):(l=x(t.view[a].line),u=t.view[a-1].node.nextSibling);var f=Ar(e,i.line),v,A;if(f==t.view.length-1?(v=t.viewTo-1,A=t.lineDiv.lastChild):(v=x(t.view[f+1].line)-1,A=t.view[f+1].node.previousSibling),!u)return!1;for(var B=e.doc.splitLines(_d(e,u,A,l,v)),ee=ir(e.doc,ne(l,0),ne(v,Ae(e.doc,v).text.length));B.length>1&&ee.length>1;)if(ce(B)==ce(ee))B.pop(),ee.pop(),v--;else if(B[0]==ee[0])B.shift(),ee.shift(),l++;else break;for(var Y=0,ie=0,ue=B[0],me=ee[0],ve=Math.min(ue.length,me.length);Y<ve&&ue.charCodeAt(Y)==me.charCodeAt(Y);)++Y;for(var xe=ce(B),be=ce(ee),Ce=Math.min(xe.length-(B.length==1?Y:0),be.length-(ee.length==1?Y:0));ie<Ce&&xe.charCodeAt(xe.length-ie-1)==be.charCodeAt(be.length-ie-1);)++ie;if(B.l
Line truncated
|
||||
`),N(i))}else return;l.type=="cut"&&(r.state.cutIncoming=+new Date)}}Ie(i,"cut",a),Ie(i,"copy",a),Ie(e.scroller,"paste",function(l){if(!(lr(e,l)||ot(r,l))){if(!i.dispatchEvent){r.state.pasteIncoming=+new Date,n.focus();return}var u=new Event("paste");u.clipboardData=l.clipboardData,i.dispatchEvent(u)}}),Ie(e.lineSpace,"selectstart",function(l){lr(e,l)||kt(l)}),Ie(i,"compositionstart",function(){var l=r.getCursor("from");n.composing&&n.composing.range.clear(),n.composing={start:l,range:r.markText(l,r.getCursor("to"),{className:"CodeMirror-composing"})}}),Ie(i,"compositionend",function(){n.composing&&(n.poll(),n.composing.range.clear(),n.composing=null)})},st.prototype.createField=function(e){this.wrapper=os(),this.textarea=this.wrapper.firstChild;var t=this.cm.options;Ko(this.textarea,t.spellcheck,t.autocorrect,t.autocapitalize)},st.prototype.screenReaderLabelChanged=function(e){e?this.textarea.setAttribute("aria-label",e):this.textarea.removeAttribute("aria-label")},st.prototype.prepareSelection=function(){var e=this.cm,t=e.display,n=e.doc,r=Ya(e);if(e.options.moveInputWithCursor){var i=Xt(e,n.sel.primary().head,"div"),a=t.wrapper.getBoundingClientRect(),l=t.lineDiv.getBoundingClientRect();r.teTop=Math.max(0,Math.min(t.wrapper.clientHeight-10,i.top+l.top-a.top)),r.teLeft=Math.max(0,Math.min(t.wrapper.clientWidth-10,i.left+l.left-a.left))}return r},st.prototype.showSelection=function(e){var t=this.cm,n=t.display;V(n.cursorDiv,e.cursors),V(n.selectionDiv,e.selection),e.teTop!=null&&(this.wrapper.style.top=e.teTop+"px",this.wrapper.style.left=e.teLeft+"px")},st.prototype.reset=function(e){if(!(this.contextMenuPending||this.composing&&e)){var t=this.cm;if(this.resetting=!0,t.somethingSelected()){this.prevInput="";var n=t.getSelection();this.textarea.value=n,t.state.focused&&N(this.textarea),s&&h>=9&&(this.hasSelection=n)}else e||(this.prevInput=this.textarea.value="",s&&h>=9&&(this.hasSelection=null));this.resetting=!1}},st.prototype.getField=function(){return this.textarea},st.prototype.supportsTouch=function(){return!1},st.prototype.focus=function(){if(this.cm.options.readOnly!="nocursor"&&(!M||H(ze(this.textarea))!=this.textarea))try{this.textarea.focus()}catch{}},st.prototype.blur=function(){this.textarea.blur()},st.prototype.resetPosition=function(){this.wrapper.style.top=this.wrapper.style.left=0},st.prototype.receivedFocus=function(){this.slowPoll()},st.prototype.slowPoll=function(){var e=this;this.pollingFast||this.polling.set(this.cm.options.pollInterval,function(){e.poll(),e.cm.state.focused&&e.slowPoll()})},st.prototype.fastPoll=function(){var e=!1,t=this;t.pollingFast=!0;function n(){var r=t.poll();!r&&!e?(e=!0,t.polling.set(60,n)):(t.pollingFast=!1,t.slowPoll())}t.polling.set(20,n)},st.prototype.poll=function(){var e=this,t=this.cm,n=this.textarea,r=this.prevInput;if(this.contextMenuPending||this.resetting||!t.state.focused||hr(n)&&!r&&!this.composing||t.isReadOnly()||t.options.disableInput||t.state.keySeq)return!1;var i=n.value;if(i==r&&!t.somethingSelected())return!1;if(s&&h>=9&&this.hasSelection===i||I&&/[\uf700-\uf7ff]/.test(i))return t.display.input.reset(),!1;if(t.doc.sel==t.display.selForContextMenu){var a=i.charCodeAt(0);if(a==8203&&!r&&(r="\u200B"),a==8666)return this.reset(),this.cm.execCommand("undo")}for(var l=0,u=Math.min(r.length,i.length);l<u&&r.charCodeAt(l)==i.charCodeAt(l);)++l;return Nt(t,function(){$o(t,i.slice(l),r.length-l,null,e.composing?"*compose":null),i.length>1e3||i.indexOf(`
|
||||
`)>-1?n.value=e.prevInput="":e.prevInput=i,e.composing&&(e.composing.range.clear(),e.composing.range=t.markText(e.composing.start,t.getCursor("to"),{className:"CodeMirror-composing"}))}),!0},st.prototype.ensurePolled=function(){this.pollingFast&&this.poll()&&(this.pollingFast=!1)},st.prototype.onKeyPress=function(){s&&h>=9&&(this.hasSelection=null),this.fastPoll()},st.prototype.onContextMenu=function(e){var t=this,n=t.cm,r=n.display,i=t.textarea;t.contextMenuPending&&t.contextMenuPending();var a=Mr(n,e),l=r.scroller.scrollTop;if(!a||d)return;var u=n.options.resetSelectionOnContextMenu;u&&n.doc.sel.contains(a)==-1&>(n,wt)(n.doc,yr(a),ke);var f=i.style.cssText,v=t.wrapper.style.cssText,A=t.wrapper.offsetParent.getBoundingClientRect();t.wrapper.style.cssText="position: static",i.style.cssText=`position: absolute; width: 30px; height: 30px;
|
||||
top: `+(e.clientY-A.top-5)+"px; left: "+(e.clientX-A.left-5)+`px;
|
||||
z-index: 1000; background: `+(s?"rgba(255, 255, 255, .05)":"transparent")+`;
|
||||
outline: none; border-width: 0; outline: none; overflow: hidden; opacity: .05; filter: alpha(opacity=5);`;var B;g&&(B=i.ownerDocument.defaultView.scrollY),r.input.focus(),g&&i.ownerDocument.defaultView.scrollTo(null,B),r.input.reset(),n.somethingSelected()||(i.value=t.prevInput=" "),t.contextMenuPending=Y,r.selForContextMenu=n.doc.sel,clearTimeout(r.detectingSelectAll);function ee(){if(i.selectionStart!=null){var ue=n.somethingSelected(),me="\u200B"+(ue?i.value:"");i.value="\u21DA",i.value=me,t.prevInput=ue?"":"\u200B",i.selectionStart=1,i.selectionEnd=me.length,r.selForContextMenu=n.doc.sel}}function Y(){if(t.contextMenuPending==Y&&(t.contextMenuPending=!1,t.wrapper.style.cssText=v,i.style.cssText=f,s&&h<9&&r.scrollbars.setScrollTop(r.scroller.scrollTop=l),i.selectionStart!=null)){(!s||s&&h<9)&&ee();var ue=0,me=function(){r.selForContextMenu==n.doc.sel&&i.selectionStart==0&&i.selectionEnd>0&&t.prevInput=="\u200B"?gt(n,Ll)(n):ue++<10?r.detectingSelectAll=setTimeout(me,500):(r.selForContextMenu=null,r.input.reset())};r.detectingSelectAll=setTimeout(me,200)}}if(s&&h>=9&&ee(),q){dr(e);var ie=function(){_t(window,"mouseup",ie),setTimeout(Y,20)};Ie(window,"mouseup",ie)}else setTimeout(Y,50)},st.prototype.readOnlyChanged=function(e){e||this.reset(),this.textarea.disabled=e=="nocursor",this.textarea.readOnly=!!e},st.prototype.setUneditable=function(){},st.prototype.needsContentAttribute=!1;function wd(e,t){if(t=t?ge(t):{},t.value=e.value,!t.tabindex&&e.tabIndex&&(t.tabindex=e.tabIndex),!t.placeholder&&e.placeholder&&(t.placeholder=e.placeholder),t.autofocus==null){var n=H(ze(e));t.autofocus=n==e||e.getAttribute("autofocus")!=null&&n==document.body}function r(){e.value=u.getValue()}var i;if(e.form&&(Ie(e.form,"submit",r),!t.leaveSubmitMethodAlone)){var a=e.form;i=a.submit;try{var l=a.submit=function(){r(),a.submit=i,a.submit(),a.submit=l}}catch{}}t.finishInit=function(f){f.save=r,f.getTextArea=function(){return e},f.toTextArea=function(){f.toTextArea=isNaN,r(),e.parentNode.removeChild(f.getWrapperElement()),e.style.display="",e.form&&(_t(e.form,"submit",r),!t.leaveSubmitMethodAlone&&typeof e.form.submit=="function"&&(e.form.submit=i))}},e.style.display="none";var u=tt(function(f){return e.parentNode.insertBefore(f,e.nextSibling)},t);return u}function Sd(e){e.off=_t,e.on=Ie,e.wheelEventPixels=Af,e.Doc=Mt,e.splitLines=Ht,e.countColumn=Oe,e.findColumn=Ge,e.isWordChar=we,e.Pass=Ze,e.signal=it,e.Line=Xr,e.changeEnd=xr,e.scrollbarModel=rl,e.Pos=ne,e.cmpPos=ye,e.modes=Wr,e.mimeModes=Kt,e.resolveMode=Ur,e.getMode=$r,e.modeExtensions=gr,e.extendMode=Kr,e.copyState=Vt,e.startState=Gr,e.innerMode=_n,e.commands=$n,e.keyMap=ur,e.keyName=Hl,e.isModifierKey=jl,e.lookupKey=un,e.normalizeKeyMap=Jf,e.StringStream=at,e.SharedTextMarker=Hn,e.TextMarker=kr,e.LineWidget=Rn,e.e_preventDefault=kt,e.e_stopPropagation=Rr,e.e_stop=dr,e.addClass=se,e.contains=O,e.rmClass=Q,e.keyNames=wr}gd(tt),yd(tt);var Td="iter insert remove copy getEditor constructor".split(" ");for(var Ai in Mt.prototype)Mt.prototype.hasOwnProperty(Ai)&&Se(Td,Ai)<0&&(tt.prototype[Ai]=(function(e){return function(){return e.apply(this.doc,arguments)}})(Mt.prototype[Ai]));return Wt(Mt),tt.inputStyles={textarea:st,contenteditable:Qe},tt.defineMode=function(e){!tt.defaults.mode&&e!="null"&&(tt.defaults.mode=e),Gt.apply(this,arguments)},tt.defineMIME=Cr,tt.defineMode("null",function(){return{token:function(e){return e.skipToEnd()}}}),tt.defineMIME("text/plain","null"),tt.defineExtension=function(e,t){tt.prototype[e]=t},tt.defineDocExtension=function(e,t){Mt.prototype[e]=t},tt.fromTextArea=wd,Sd(tt),tt.version="5.65.21",tt}))});var Yn=Ke((fs,ds)=>{(function(o){typeof fs=="object"&&typeof ds=="object"?o(We()):typeof define=="function"&&define.amd?define(["../../lib/codemirror"],o):o(CodeMirror)})(function(o){"use strict";o.overlayMode=function(p,m,S){return{startState:function(){return{base:o.startState(p),overlay:o.startState(m),basePos:0,baseCur:null,overlayPos:0,overlayCur:null,streamSeen:null}},copyState:function(b){return{base:o.copyState(p,b.base),overlay:o.copyState(m,b.overlay),basePos:b.basePos,baseCur:null,overlayPos:b.overlayPos,overlayCur:null}},token:function(b,T){return(b!=T.streamSeen||Math.min(T.basePos,T.overlayPos)<b.start)&&(T.streamSeen=b,T.basePos=T.overlayPos=b.start),b.start==T.basePos&&(T.baseCur=p.token(b,T.base),T.basePos=b.pos),b.start==T.overlayPos&&(b.pos=b.start,T.overlayCur=m.token(b,T.overlay),T.overlayPos=b.pos),b.pos=Math.min(T.basePos,T.overlayPos),T.overlayCur==null?T.baseCur:T.baseCur!=null&&T.overlay.combineTokens||S&&T.overlay.combineTokens==null?T.baseCur+" "+T.overlayCur:T.overlayCur},indent:p.indent&&function(b,T,s){return p.indent(b.base,T,s)},electricChars:p.electricChars,innerMode:function(b){return{state:b.base,mode:p}},blankLine:function(b){var T,s;return p.blankLine&&(T=p.blankLine(b.base)),m.blankLine&&(s=m.blankLine(b.overlay)),s==null?T:S&&T!=null?T+" "+s:s}}}})});var gs=Ke((ps,hs)=>{(function(o){typeof ps=="object"&&type
Line truncated
|
||||
`}else{var I=z[1],U=z[5],J=!(S.test(z[2])||z[2].indexOf(">")>=0),re=J?parseInt(z[3],10)+1+z[4]:z[2].replace("x"," ");h[g]=`
|
||||
`+I+re+U,J&&b(T,C)}}T.replaceSelections(h)};function b(T,s){var h=s.line,g=0,C=0,_=p.exec(T.getLine(h)),c=_[1];do{g+=1;var d=h+g,w=T.getLine(d),E=p.exec(w);if(E){var z=E[1],k=parseInt(_[3],10)+g-C,R=parseInt(E[3],10),M=R;if(c===z&&!isNaN(R))k===R&&(M=R+1),k>R&&(M=k+1),T.replaceRange(w.replace(p,z+M+E[4]+E[5]),{line:d,ch:0},{line:d,ch:w.length});else{if(c.length>z.length||c.length<z.length&&g===1)return;C+=1}}}while(E)}})});var bs=Ke((ms,vs)=>{(function(o){typeof ms=="object"&&typeof vs=="object"?o(We()):typeof define=="function"&&define.amd?define(["../../lib/codemirror"],o):o(CodeMirror)})(function(o){o.defineOption("placeholder","",function(h,g,C){var _=C&&C!=o.Init;if(g&&!_)h.on("blur",b),h.on("change",T),h.on("swapDoc",T),o.on(h.getInputField(),"compositionupdate",h.state.placeholderCompose=function(){S(h)}),T(h);else if(!g&&_){h.off("blur",b),h.off("change",T),h.off("swapDoc",T),o.off(h.getInputField(),"compositionupdate",h.state.placeholderCompose),p(h);var c=h.getWrapperElement();c.className=c.className.replace(" CodeMirror-empty","")}g&&!h.hasFocus()&&b(h)});function p(h){h.state.placeholder&&(h.state.placeholder.parentNode.removeChild(h.state.placeholder),h.state.placeholder=null)}function m(h){p(h);var g=h.state.placeholder=document.createElement("pre");g.style.cssText="height: 0; overflow: visible",g.style.direction=h.getOption("direction"),g.className="CodeMirror-placeholder CodeMirror-line-like";var C=h.getOption("placeholder");typeof C=="string"&&(C=document.createTextNode(C)),g.appendChild(C),h.display.lineSpace.insertBefore(g,h.display.lineSpace.firstChild)}function S(h){setTimeout(function(){var g=!1;if(h.lineCount()==1){var C=h.getInputField();g=C.nodeName=="TEXTAREA"?!h.getLine(0).length:!/[^\u200b]/.test(C.querySelector(".CodeMirror-line").textContent)}g?m(h):p(h)},20)}function b(h){s(h)&&m(h)}function T(h){var g=h.getWrapperElement(),C=s(h);g.className=g.className.replace(" CodeMirror-empty","")+(C?" CodeMirror-empty":""),C?m(h):p(h)}function s(h){return h.lineCount()===1&&h.getLine(0)===""}})});var _s=Ke((ys,xs)=>{(function(o){typeof ys=="object"&&typeof xs=="object"?o(We()):typeof define=="function"&&define.amd?define(["../../lib/codemirror"],o):o(CodeMirror)})(function(o){"use strict";o.defineOption("styleSelectedText",!1,function(_,c,d){var w=d&&d!=o.Init;c&&!w?(_.state.markedSelection=[],_.state.markedSelectionStyle=typeof c=="string"?c:"CodeMirror-selectedtext",g(_),_.on("cursorActivity",p),_.on("change",m)):!c&&w&&(_.off("cursorActivity",p),_.off("change",m),h(_),_.state.markedSelection=_.state.markedSelectionStyle=null)});function p(_){_.state.markedSelection&&_.operation(function(){C(_)})}function m(_){_.state.markedSelection&&_.state.markedSelection.length&&_.operation(function(){h(_)})}var S=8,b=o.Pos,T=o.cmpPos;function s(_,c,d,w){if(T(c,d)!=0)for(var E=_.state.markedSelection,z=_.state.markedSelectionStyle,k=c.line;;){var R=k==c.line?c:b(k,0),M=k+S,I=M>=d.line,U=I?d:b(M,0),J=_.markText(R,U,{className:z});if(w==null?E.push(J):E.splice(w++,0,J),I)break;k=M}}function h(_){for(var c=_.state.markedSelection,d=0;d<c.length;++d)c[d].clear();c.length=0}function g(_){h(_);for(var c=_.listSelections(),d=0;d<c.length;d++)s(_,c[d].from(),c[d].to())}function C(_){if(!_.somethingSelected())return h(_);if(_.listSelections().length>1)return g(_);var c=_.getCursor("start"),d=_.getCursor("end"),w=_.state.markedSelection;if(!w.length)return s(_,c,d);var E=w[0].find(),z=w[w.length-1].find();if(!E||!z||d.line-c.line<=S||T(c,z.to)>=0||T(d,E.from)<=0)return g(_);for(;T(c,E.from)>0;)w.shift().clear(),E=w[0].find();for(T(c,E.from)<0&&(E.to.line-c.line<S?(w.shift().clear(),s(_,c,E.to,0)):s(_,c,E.from,0));T(d,z.to)<0;)w.pop().clear(),z=w[w.length-1].find();T(d,z.to)>0&&(d.line-z.from.line<S?(w.pop().clear(),s(_,z.from,d)):s(_,z.to,d))}})});var Ss=Ke((ks,ws)=>{(function(o){typeof ks=="object"&&typeof ws=="object"?o(We()):typeof define=="function"&&define.amd?define(["../../lib/codemirror"],o):o(CodeMirror)})(function(o){"use strict";var p=o.Pos;function m(k){var R=k.flags;return R??(k.ignoreCase?"i":"")+(k.global?"g":"")+(k.multiline?"m":"")}function S(k,R){for(var M=m(k),I=M,U=0;U<R.length;U++)I.indexOf(R.charAt(U))==-1&&(I+=R.charAt(U));return M==I?k:new RegExp(k.source,I)}function b(k){return/\\s|\\n|\n|\\W|\\D|\[\^/.test(k.source)}function T(k,R,M){R=S(R,"g");for(var I=M.line,U=M.ch,J=k.lastLine();I<=J;I++,U=0){R.lastIndex=U;var re=k.getLine(I),F=R.exec(re);if(F)return{from:p(I,F.index),to:p(I,F.index+F[0].length),match:F}}}function s(k,R,M){if(!b(R))return T(k,R,M);R=S(R,"gm");for(var I,U=1,J=M.line,re=k.lastLine();J<=re;){for(var F=0;F<U&&!(J>re);F++){var q=k.getLine(J++);I=I==null?q:I+`
|
||||
`+q}U=U*2,R.lastIndex=M.ch;var D=R.exec(I);if(D){var Q=I.slice(0,D.index).split(`
|
||||
`),j=D[0].split(`
|
||||
`),V=M.line+Q.length-1,y=Q[Q.length-1].length;return{from:p(V,y),to:p(V+j.length-1,j.length==1?y+j[0].length:j[j.length-1].length),match:D}}}}function h(k,R,M){for(var I,U=0;U<=k.length;){R.lastIndex=U;var J=R.exec(k);if(!J)break;var re=J.index+J[0].length;if(re>k.length-M)break;(!I||re>I.index+I[0].length)&&(I=J),U=J.index+1}return I}function g(k,R,M){R=S(R,"g");for(var I=M.line,U=M.ch,J=k.firstLine();I>=J;I--,U=-1){var re=k.getLine(I),F=h(re,R,U<0?0:re.length-U);if(F)return{from:p(I,F.index),to:p(I,F.index+F[0].length),match:F}}}function C(k,R,M){if(!b(R))return g(k,R,M);R=S(R,"gm");for(var I,U=1,J=k.getLine(M.line).length-M.ch,re=M.line,F=k.firstLine();re>=F;){for(var q=0;q<U&&re>=F;q++){var D=k.getLine(re--);I=I==null?D:D+`
|
||||
`+I}U*=2;var Q=h(I,R,J);if(Q){var j=I.slice(0,Q.index).split(`
|
||||
`),V=Q[0].split(`
|
||||
`),y=re+j.length,G=j[j.length-1].length;return{from:p(y,G),to:p(y+V.length-1,V.length==1?G+V[0].length:V[V.length-1].length),match:Q}}}}var _,c;String.prototype.normalize?(_=function(k){return k.normalize("NFD").toLowerCase()},c=function(k){return k.normalize("NFD")}):(_=function(k){return k.toLowerCase()},c=function(k){return k});function d(k,R,M,I){if(k.length==R.length)return M;for(var U=0,J=M+Math.max(0,k.length-R.length);;){if(U==J)return U;var re=U+J>>1,F=I(k.slice(0,re)).length;if(F==M)return re;F>M?J=re:U=re+1}}function w(k,R,M,I){if(!R.length)return null;var U=I?_:c,J=U(R).split(/\r|\n\r?/);e:for(var re=M.line,F=M.ch,q=k.lastLine()+1-J.length;re<=q;re++,F=0){var D=k.getLine(re).slice(F),Q=U(D);if(J.length==1){var j=Q.indexOf(J[0]);if(j==-1)continue e;var M=d(D,Q,j,U)+F;return{from:p(re,d(D,Q,j,U)+F),to:p(re,d(D,Q,j+J[0].length,U)+F)}}else{var V=Q.length-J[0].length;if(Q.slice(V)!=J[0])continue e;for(var y=1;y<J.length-1;y++)if(U(k.getLine(re+y))!=J[y])continue e;var G=k.getLine(re+J.length-1),X=U(G),O=J[J.length-1];if(X.slice(0,O.length)!=O)continue e;return{from:p(re,d(D,Q,V,U)+F),to:p(re+J.length-1,d(G,X,O.length,U))}}}}function E(k,R,M,I){if(!R.length)return null;var U=I?_:c,J=U(R).split(/\r|\n\r?/);e:for(var re=M.line,F=M.ch,q=k.firstLine()-1+J.length;re>=q;re--,F=-1){var D=k.getLine(re);F>-1&&(D=D.slice(0,F));var Q=U(D);if(J.length==1){var j=Q.lastIndexOf(J[0]);if(j==-1)continue e;return{from:p(re,d(D,Q,j,U)),to:p(re,d(D,Q,j+J[0].length,U))}}else{var V=J[J.length-1];if(Q.slice(0,V.length)!=V)continue e;for(var y=1,M=re-J.length+1;y<J.length-1;y++)if(U(k.getLine(M+y))!=J[y])continue e;var G=k.getLine(re+1-J.length),X=U(G);if(X.slice(X.length-J[0].length)!=J[0])continue e;return{from:p(re+1-J.length,d(G,X,G.length-J[0].length,U)),to:p(re,d(D,Q,V.length,U))}}}}function z(k,R,M,I){this.atOccurrence=!1,this.afterEmptyMatch=!1,this.doc=k,M=M?k.clipPos(M):p(0,0),this.pos={from:M,to:M};var U;typeof I=="object"?U=I.caseFold:(U=I,I=null),typeof R=="string"?(U==null&&(U=!1),this.matches=function(J,re){return(J?E:w)(k,R,re,U)}):(R=S(R,"gm"),!I||I.multiline!==!1?this.matches=function(J,re){return(J?C:s)(k,R,re)}:this.matches=function(J,re){return(J?g:T)(k,R,re)})}z.prototype={findNext:function(){return this.find(!1)},findPrevious:function(){return this.find(!0)},find:function(k){var R=this.doc.clipPos(k?this.pos.from:this.pos.to);if(this.afterEmptyMatch&&this.atOccurrence&&(R=p(R.line,R.ch),k?(R.ch--,R.ch<0&&(R.line--,R.ch=(this.doc.getLine(R.line)||"").length)):(R.ch++,R.ch>(this.doc.getLine(R.line)||"").length&&(R.ch=0,R.line++)),o.cmpPos(R,this.doc.clipPos(R))!=0))return this.atOccurrence=!1;var M=this.matches(k,R);if(this.afterEmptyMatch=M&&o.cmpPos(M.from,M.to)==0,M)return this.pos=M,this.atOccurrence=!0,this.pos.match||!0;var I=p(k?this.doc.firstLine():this.doc.lastLine()+1,0);return this.pos={from:I,to:I},this.atOccurrence=!1},from:function(){if(this.atOccurrence)return this.pos.from},to:function(){if(this.atOccurrence)return this.pos.to},replace:function(k,R){if(this.atOccurrence){var M=o.splitLines(k);this.doc.replaceRange(M,this.pos.from,this.pos.to,R),this.pos.to=p(this.pos.from.line+M.length-1,M[M.length-1].length+(M.length==1?this.pos.from.ch:0))}}},o.defineExtension("getSearchCursor",function(k,R,M){return new z(this.doc,k,R,M)}),o.defineDocExtension("getSearchCursor",function(k,R,M){return new z(this,k,R,M)}),o.defineExtension("selectMatches",function(k,R){for(var M=[],I=this.getSearchCursor(k,this.getCursor("from"),R);I.findNext()&&!(o.cmpPos(I.to(),this.getCursor("to"))>0);)M.push({anchor:I.from(),head:I.to()});M.length&&this.setSelections(M,0)})})});var Vo=Ke((Ts,Ls)=>{(function(o){typeof Ts=="object"&&typeof Ls=="object"?o(We()):typeof define=="function"&&define.amd?define(["../../lib/codemirror"],o):o(CodeMirror)})(function(o){"use strict";function p(O,H,se,_e,N,L){this.indented=O,this.column=H,this.type=se,this.info=_e,this.align=N,this.prev=L}function m(O,H,se,_e){var N=O.indented;return O.context&&O.context.type=="statement"&&se!="statement"&&(N=O.context.indented),O.context=new p(N,H,se,_e,null,O.context)}function S(O){var H=O.context.type;return(H==")"||H=="]"||H=="}")&&(O.indented=O.context.indented),O.context=O.context.prev}function b(O,H,se){if(H.prevToken=="variable"||H.prevToken=="type"||/\S(?:[^- ]>|[*\]])\s*$|\*$/.test(O.string.slice(0,se))||H.typeAtEndOfLine&&O.column()==O.indentation())return!0}function T(O){for(;;){if(!O||O.type=="top")return!0;if(O.type=="}"&&O.prev.info!="namespace")return!1;O=O.prev}}o.defineMode("clike",function(O,H){var se=O.indentUnit,_e=H.statementIndentUnit||se,N=H.dontAlignCalls,L=H.keywords||{},he=H.types||{},ze=H.builtin||{},de=H.blockKeywords||{},Ee=H.defKeywords||{},ge=H.atoms||{},Oe=H.hooks||{},qe=H.multiLineStrings,Se=H.indentStatements!==!1,Be=H.indentSwitch!==!1,Ze=H.namespaceSeparator,ke=H.isPunctuationChar||/[\[\]{}\(\),;\:\.]/,Je=H.numberStart||/[\d\.]/,Re=H.number||/^(?:0x[a-f\d]+|0b[01]+|(?:\d+\.?\d*|\.\d+)(?:e[-+]?\d+)?)(u|ll?|l|f)
Line truncated
|
||||
`&&(b.innerActive=b.inner=null);else for(var s=0;s<m.length;++s){var h=m[s];h.open===`
|
||||
`&&(b.innerActive=h,b.inner=o.startState(h.mode,T.indent?T.indent(b.outer,"",""):0))}},electricChars:p.electricChars,innerMode:function(b){return b.inner?{state:b.inner,mode:b.innerActive.mode}:{state:b.outer,mode:p}}}}})});var uc=Ke((lc,sc)=>{(function(o){typeof lc=="object"&&typeof sc=="object"?o(We(),Di(),ac()):typeof define=="function"&&define.amd?define(["../../lib/codemirror","../../addon/mode/simple","../../addon/mode/multiplex"],o):o(CodeMirror)})(function(o){"use strict";o.defineSimpleMode("handlebars-tags",{start:[{regex:/\{\{\{/,push:"handlebars_raw",token:"tag"},{regex:/\{\{!--/,push:"dash_comment",token:"comment"},{regex:/\{\{!/,push:"comment",token:"comment"},{regex:/\{\{/,push:"handlebars",token:"tag"}],handlebars_raw:[{regex:/\}\}\}/,pop:!0,token:"tag"}],handlebars:[{regex:/\}\}/,pop:!0,token:"tag"},{regex:/"(?:[^\\"]|\\.)*"?/,token:"string"},{regex:/'(?:[^\\']|\\.)*'?/,token:"string"},{regex:/>|[#\/]([A-Za-z_]\w*)/,token:"keyword"},{regex:/(?:else|this)\b/,token:"keyword"},{regex:/\d+/i,token:"number"},{regex:/=|~|@|true|false/,token:"atom"},{regex:/(?:\.\.\/)*(?:[A-Za-z_][\w\.]*)+/,token:"variable-2"}],dash_comment:[{regex:/--\}\}/,pop:!0,token:"comment"},{regex:/./,token:"comment"}],comment:[{regex:/\}\}/,pop:!0,token:"comment"},{regex:/./,token:"comment"}],meta:{blockCommentStart:"{{--",blockCommentEnd:"--}}"}}),o.defineMode("handlebars",function(p,m){var S=o.getMode(p,"handlebars-tags");return!m||!m.base?S:o.multiplexingMode(o.getMode(p,m.base),{open:"{{",close:/\}\}\}?/,mode:S,parseDelimiters:!0})}),o.defineMIME("text/x-handlebars-template","handlebars")})});var dc=Ke((cc,fc)=>{(function(o){"use strict";typeof cc=="object"&&typeof fc=="object"?o(We(),Yn(),mn(),vn(),ec(),gn(),ea(),ta(),nc(),uc()):typeof define=="function"&&define.amd?define(["../../lib/codemirror","../../addon/mode/overlay","../xml/xml","../javascript/javascript","../coffeescript/coffeescript","../css/css","../sass/sass","../stylus/stylus","../pug/pug","../handlebars/handlebars"],o):o(CodeMirror)})(function(o){var p={script:[["lang",/coffee(script)?/,"coffeescript"],["type",/^(?:text|application)\/(?:x-)?coffee(?:script)?$/,"coffeescript"],["lang",/^babel$/,"javascript"],["type",/^text\/babel$/,"javascript"],["type",/^text\/ecmascript-\d+$/,"javascript"]],style:[["lang",/^stylus$/i,"stylus"],["lang",/^sass$/i,"sass"],["lang",/^less$/i,"text/x-less"],["lang",/^scss$/i,"text/x-scss"],["type",/^(text\/)?(x-)?styl(us)?$/i,"stylus"],["type",/^text\/sass/i,"sass"],["type",/^(text\/)?(x-)?scss$/i,"text/x-scss"],["type",/^(text\/)?(x-)?less$/i,"text/x-less"]],template:[["lang",/^vue-template$/i,"vue"],["lang",/^pug$/i,"pug"],["lang",/^handlebars$/i,"handlebars"],["type",/^(text\/)?(x-)?pug$/i,"pug"],["type",/^text\/x-handlebars-template$/i,"handlebars"],[null,null,"vue-template"]]};o.defineMode("vue-template",function(m,S){var b={token:function(T){if(T.match(/^\{\{.*?\}\}/))return"meta mustache";for(;T.next()&&!T.match("{{",!1););return null}};return o.overlayMode(o.getMode(m,S.backdrop||"text/html"),b)}),o.defineMode("vue",function(m){return o.getMode(m,{name:"htmlmixed",tags:p})},"htmlmixed","xml","javascript","coffeescript","css","sass","stylus","pug","handlebars"),o.defineMIME("script/x-vue","vue"),o.defineMIME("text/x-vue","vue")})});var gc=Ke((pc,hc)=>{(function(o){typeof pc=="object"&&typeof hc=="object"?o(We()):typeof define=="function"&&define.amd?define(["../../lib/codemirror"],o):o(CodeMirror)})(function(o){"use strict";o.defineMode("yaml",function(){var p=["true","false","on","off","yes","no"],m=new RegExp("\\b(("+p.join(")|(")+"))$","i");return{token:function(S,b){var T=S.peek(),s=b.escaped;if(b.escaped=!1,T=="#"&&(S.pos==0||/\s/.test(S.string.charAt(S.pos-1))))return S.skipToEnd(),"comment";if(S.match(/^('([^']|\\.)*'?|"([^"]|\\.)*"?)/))return"string";if(b.literal&&S.indentation()>b.keyCol)return S.skipToEnd(),"string";if(b.literal&&(b.literal=!1),S.sol()){if(b.keyCol=0,b.pair=!1,b.pairStart=!1,S.match("---")||S.match("..."))return"def";if(S.match(/\s*-\s+/))return"meta"}if(S.match(/^(\{|\}|\[|\])/))return T=="{"?b.inlinePairs++:T=="}"?b.inlinePairs--:T=="["?b.inlineList++:b.inlineList--,"meta";if(b.inlineList>0&&!s&&T==",")return S.next(),"meta";if(b.inlinePairs>0&&!s&&T==",")return b.keyCol=0,b.pair=!1,b.pairStart=!1,S.next(),"meta";if(b.pairStart){if(S.match(/^\s*(\||\>)\s*/))return b.literal=!0,"meta";if(S.match(/^\s*(\&|\*)[a-z0-9\._-]+\b/i))return"variable-2";if(b.inlinePairs==0&&S.match(/^\s*-?[0-9\.\,]+\s?$/)||b.inlinePairs>0&&S.match(/^\s*-?[0-9\.\,]+\s?(?=(,|}))/))return"number";if(S.match(m))return"keyword"}return!b.pair&&S.match(/^\s*(?:[,\[\]{}&*!|>'"%@`][^\s'":]|[^\s,\[\]{}#&*!|>'"%@`])[^#:]*(?=:($|\s))/)?(b.pair=!0,b.keyCol=S.indentation(),"atom"):b.pair&&S.match(/^:\s*/)?(b.pairStart=!0,"meta"):(b.pairStart=!1,b.escaped=T=="\\",S.next(),null)},startState:function(){return{pair:!1,pairStart:!1,keyCol:0,inlinePairs:0,inlineList:0,literal:!1,escaped:!1}},lineComment:"#",fold:"indent"}}),o.defineMIME(Line truncated
|
||||
`,L=`
|
||||
`+O;_e&&se++,_e&&X.ch===0&&(L=O+`
|
||||
`,se--),jr(y,!1,[N,L]),y.setSelection({line:H,ch:0},{line:se,ch:0})}var s=o.codemirror,h=s.getCursor("start"),g=s.getCursor("end"),C=s.getTokenAt({line:h.line,ch:h.ch||1}),_=s.getLineHandle(h.line),c=b(s,h.line,_,C),d,w,E;if(c==="single"){var z=_.text.slice(0,h.ch).replace("`",""),k=_.text.slice(h.ch).replace("`","");s.replaceRange(z+k,{line:h.line,ch:0},{line:h.line,ch:99999999999999}),h.ch--,h!==g&&g.ch--,s.setSelection(h,g),s.focus()}else if(c==="fenced")if(h.line!==g.line||h.ch!==g.ch){for(d=h.line;d>=0&&(_=s.getLineHandle(d),!m(_));d--);var R=s.getTokenAt({line:d,ch:1}),M=S(R).fencedChars,I,U,J,re;m(s.getLineHandle(h.line))?(I="",U=h.line):m(s.getLineHandle(h.line-1))?(I="",U=h.line-1):(I=M+`
|
||||
`,U=h.line),m(s.getLineHandle(g.line))?(J="",re=g.line,g.ch===0&&(re+=1)):g.ch!==0&&m(s.getLineHandle(g.line+1))?(J="",re=g.line+1):(J=M+`
|
||||
`,re=g.line+1),g.ch===0&&(re-=1),s.operation(function(){s.replaceRange(J,{line:re,ch:0},{line:re+(J?0:1),ch:0}),s.replaceRange(I,{line:U,ch:0},{line:U+(I?0:1),ch:0})}),s.setSelection({line:U+(I?1:0),ch:0},{line:re+(I?1:-1),ch:0}),s.focus()}else{var F=h.line;if(m(s.getLineHandle(h.line))&&(b(s,h.line+1)==="fenced"?(d=h.line,F=h.line+1):(w=h.line,F=h.line-1)),d===void 0)for(d=F;d>=0&&(_=s.getLineHandle(d),!m(_));d--);if(w===void 0)for(E=s.lineCount(),w=F;w<E&&(_=s.getLineHandle(w),!m(_));w++);s.operation(function(){s.replaceRange("",{line:d,ch:0},{line:d+1,ch:0}),s.replaceRange("",{line:w-1,ch:0},{line:w,ch:0})}),s.focus()}else if(c==="indented"){if(h.line!==g.line||h.ch!==g.ch)d=h.line,w=g.line,g.ch===0&&w--;else{for(d=h.line;d>=0;d--)if(_=s.getLineHandle(d),!_.text.match(/^\s*$/)&&b(s,d,_)!=="indented"){d+=1;break}for(E=s.lineCount(),w=h.line;w<E;w++)if(_=s.getLineHandle(w),!_.text.match(/^\s*$/)&&b(s,w,_)!=="indented"){w-=1;break}}var q=s.getLineHandle(w+1),D=q&&s.getTokenAt({line:w+1,ch:q.text.length-1}),Q=D&&S(D).indentedCode;s.operation(function(){Q&&s.replaceRange(`
|
||||
`,{line:w+1,ch:0});for(var y=d;y<=w;y++)s.indentLine(y,"subtract")}),s.focus()}else{var j=h.line===g.line&&h.ch===g.ch&&h.ch===0,V=h.line!==g.line;j||V?T(s,h,g,p):jr(s,!1,["`","`"])}}function Bi(o){la(o.codemirror,"quote")}function Jn(o){Lr(o.codemirror,"smaller")}function ji(o){Lr(o.codemirror,"bigger")}function Ri(o){Lr(o.codemirror,void 0,1)}function Hi(o){Lr(o.codemirror,void 0,2)}function Wi(o){Lr(o.codemirror,void 0,3)}function na(o){Lr(o.codemirror,void 0,4)}function ia(o){Lr(o.codemirror,void 0,5)}function oa(o){Lr(o.codemirror,void 0,6)}function Ui(o){var p=o.codemirror,m="*";["-","+","*"].includes(o.options.unorderedListStyle)&&(m=o.options.unorderedListStyle),la(p,"unordered-list",m)}function $i(o){la(o.codemirror,"ordered-list")}function Ki(o){jd(o.codemirror)}function Gi(o){var p=o.options,m="https://";if(p.promptURLs){var S=prompt(p.promptTexts.link,m);if(!S)return!1;m=xc(S)}kc(o,"link",p.insertTexts.link,m)}function Zi(o){var p=o.options,m="https://";if(p.promptURLs){var S=prompt(p.promptTexts.image,m);if(!S)return!1;m=xc(S)}kc(o,"image",p.insertTexts.image,m)}function xc(o){return encodeURI(o).replace(/([\\()])/g,"\\$1")}function aa(o){o.openBrowseFileWindow()}function _c(o,p){var m=o.codemirror,S=Tr(m),b=o.options,T=p.substr(p.lastIndexOf("/")+1),s=T.substring(T.lastIndexOf(".")+1).replace(/\?.*$/,"").toLowerCase();if(["png","jpg","jpeg","gif","svg","apng","avif","webp"].includes(s))jr(m,S.image,b.insertTexts.uploadedImage,p);else{var h=b.insertTexts.link;h[0]="["+T,jr(m,S.link,h,p)}o.updateStatusBar("upload-image",o.options.imageTexts.sbOnUploaded.replace("#image_name#",T)),setTimeout(function(){o.updateStatusBar("upload-image",o.options.imageTexts.sbInit)},1e3)}function Xi(o){var p=o.codemirror,m=Tr(p),S=o.options;jr(p,m.table,S.insertTexts.table)}function Yi(o){var p=o.codemirror,m=Tr(p),S=o.options;jr(p,m.image,S.insertTexts.horizontalRule)}function Qi(o){var p=o.codemirror;p.undo(),p.focus()}function Vi(o){var p=o.codemirror;p.redo(),p.focus()}function bn(o){var p=o.codemirror,m=p.getWrapperElement(),S=m.nextSibling,b=o.toolbarElements&&o.toolbarElements["side-by-side"],T=!1,s=m.parentNode;S.classList.contains("editor-preview-active-side")?(o.options.sideBySideFullscreen===!1&&s.classList.remove("sided--no-fullscreen"),S.classList.remove("editor-preview-active-side"),b&&b.classList.remove("active"),m.classList.remove("CodeMirror-sided")):(setTimeout(function(){p.getOption("fullScreen")||(o.options.sideBySideFullscreen===!1?s.classList.add("sided--no-fullscreen"):Br(o)),S.classList.add("editor-preview-active-side")},1),b&&b.classList.add("active"),m.classList.add("CodeMirror-sided"),T=!0);var h=m.lastChild;if(h.classList.contains("editor-preview-active")){h.classList.remove("editor-preview-active");var g=o.toolbarElements.preview,C=o.toolbar_div;g.classList.remove("active"),C.classList.remove("disabled-for-preview")}var _=function(){var d=o.options.previewRender(o.value(),S);d!=null&&(S.innerHTML=d)};if(p.sideBySideRenderingFunction||(p.sideBySideRenderingFunction=_),T){var c=o.options.previewRender(o.value(),S);c!=null&&(S.innerHTML=c),p.on("update",p.sideBySideRenderingFunction)}else p.off("update",p.sideBySideRenderingFunction);p.refresh()}function Ji(o){var p=o.codemirror,m=p.getWrapperElement(),S=o.toolbar_div,b=o.options.toolbar?o.toolbarElements.preview:!1,T=m.lastChild,s=p.getWrapperElement().nextSibling;if(s.classList.contains("editor-preview-active-side")&&bn(o),!T||!T.classList.contains("editor-preview-full")){if(T=document.createElement("div"),T.className="editor-preview-full",o.options.previewClass)if(Array.isArray(o.options.previewClass))for(var h=0;h<o.options.previewClass.length;h++)T.classList.add(o.options.previewClass[h]);else typeof o.options.previewClass=="string"&&T.classList.add(o.options.previewClass);m.appendChild(T)}T.classList.contains("editor-preview-active")?(T.classList.remove("editor-preview-active"),b&&(b.classList.remove("active"),S.classList.remove("disabled-for-preview"))):(setTimeout(function(){T.classList.add("editor-preview-active")},1),b&&(b.classList.add("active"),S.classList.add("disabled-for-preview")));var g=o.options.previewRender(o.value(),T);g!==null&&(T.innerHTML=g)}function jr(o,p,m,S){if(!o.getWrapperElement().lastChild.classList.contains("editor-preview-active")){var b,T=m[0],s=m[1],h={},g={};Object.assign(h,o.getCursor("start")),Object.assign(g,o.getCursor("end")),S&&(T=T.replace("#url#",S),s=s.replace("#url#",S)),p?(b=o.getLine(h.line),T=b.slice(0,h.ch),s=b.slice(h.ch),o.replaceRange(T+s,{line:h.line,ch:0})):(b=o.getSelection(),o.replaceSelection(T+b+s),h.ch+=T.length,h!==g&&(g.ch+=T.length)),o.setSelection(h,g),o.focus()}}function Lr(o,p,m){if(!o.getWrapperElement().lastChild.classList.contains("editor-preview-active")){for(var S=o.getCursor("start"),b=o.getCursor("end"),T=S.line;T<=b.line;T++)(function(s){var h=o.getLine(s),g=h.search(/[^#]/);p!==void 0?g<=0?p=="bigger"?h="###### "+h:h="# "+h:g==6&&p=="smaller"?h=h.substr(7):g==1&&p
Line truncated
|
||||
|
||||
| Column 1 | Column 2 | Column 3 |
|
||||
| -------- | -------- | -------- |
|
||||
| Text | Text | Text |
|
||||
|
||||
`],horizontalRule:["",`
|
||||
|
||||
-----
|
||||
|
||||
`]},Hd={link:"URL for the link:",image:"URL of the image:"},Wd={locale:"en-US",format:{hour:"2-digit",minute:"2-digit"}},Ud={bold:"**",code:"```",italic:"*"},$d={sbInit:"Attach files by drag and dropping or pasting from clipboard.",sbOnDragEnter:"Drop image to upload it.",sbOnDrop:"Uploading image #images_names#...",sbProgress:"Uploading #file_name#: #progress#%",sbOnUploaded:"Uploaded #image_name#",sizeUnits:" B, KB, MB"},Kd={noFileGiven:"You must select a file.",typeNotAllowed:"This image type is not allowed.",fileTooLarge:`Image #image_name# is too big (#image_size#).
|
||||
Maximum file size is #image_max_size#.`,importError:"Something went wrong when uploading the image #image_name#."};Te.prototype.uploadImages=function(o,p,m){if(o.length!==0){for(var S=[],b=0;b<o.length;b++)S.push(o[b].name),this.uploadImage(o[b],p,m);this.updateStatusBar("upload-image",this.options.imageTexts.sbOnDrop.replace("#images_names#",S.join(", ")))}};Te.prototype.uploadImagesUsingCustomFunction=function(o,p){if(p.length!==0){for(var m=[],S=0;S<p.length;S++)m.push(p[S].name),this.uploadImageUsingCustomFunction(o,p[S]);this.updateStatusBar("upload-image",this.options.imageTexts.sbOnDrop.replace("#images_names#",m.join(", ")))}};Te.prototype.updateStatusBar=function(o,p){if(this.gui.statusbar){var m=this.gui.statusbar.getElementsByClassName(o);m.length===1?this.gui.statusbar.getElementsByClassName(o)[0].textContent=p:m.length===0?console.log("EasyMDE: status bar item "+o+" was not found."):console.log("EasyMDE: Several status bar items named "+o+" was found.")}};Te.prototype.markdown=function(o){if(marked){var p;if(this.options&&this.options.renderingConfig&&this.options.renderingConfig.markedOptions?p=this.options.renderingConfig.markedOptions:p={},this.options&&this.options.renderingConfig&&this.options.renderingConfig.singleLineBreaks===!1?p.breaks=!1:p.breaks=!0,this.options&&this.options.renderingConfig&&this.options.renderingConfig.codeSyntaxHighlighting===!0){var m=this.options.renderingConfig.hljs||window.hljs;m&&(p.highlight=function(b,T){return T&&m.getLanguage(T)?m.highlight(T,b).value:m.highlightAuto(b).value})}marked.setOptions(p);var S=marked.parse(o);return this.options.renderingConfig&&typeof this.options.renderingConfig.sanitizerFunction=="function"&&(S=this.options.renderingConfig.sanitizerFunction.call(this,S)),S=Id(S),S=Nd(S),S}};Te.prototype.render=function(o){if(o||(o=this.element||document.getElementsByTagName("textarea")[0]),this._rendered&&this._rendered===o)return;this.element=o;var p=this.options,m=this,S={};function b(I){let U=I.getInputField(),J=U.form;if(J){let re=Array.from(J.elements).filter(q=>!(q.closest&&q.closest(".editor-toolbar")||q.offsetParent===null)),F=re.indexOf(U);F!==-1&&F+1<re.length&&re[F+1]&&re[F+1].focus()}}function T(I){let U=I.getInputField(),J=U.form;if(J){let re=Array.from(J.elements).filter(q=>!(q.closest&&q.closest(".editor-toolbar")||q.offsetParent===null)),F=re.indexOf(U);if(F!==-1)for(let q=F-1;q>=0;q--){let D=re[q];if(D){D.focus();break}}}}for(var s in p.shortcuts)p.shortcuts[s]!==null&&Vn[s]!==null&&(function(I){S[yc(p.shortcuts[I])]=function(){var U=Vn[I];typeof U=="function"?U(m):typeof U=="string"&&window.open(U,"_blank")}})(s);S.Enter="newlineAndIndentContinueMarkdownList",S.Tab=I=>{let U=I.getSelection();U&&U.length>0?I.execCommand("indentMore"):b(I)},S["Shift-Tab"]=I=>{let U=I.getSelection();U&&U.length>0?I.execCommand("indentLess"):T(I)},S.Esc=function(I){I.getOption("fullScreen")&&Br(m)},this.documentOnKeyDown=function(I){I=I||window.event,I.keyCode==27&&m.codemirror.getOption("fullScreen")&&Br(m)},document.addEventListener("keydown",this.documentOnKeyDown,!1);var h,g;p.overlayMode?(CodeMirror.defineMode("overlay-mode",function(I){return CodeMirror.overlayMode(CodeMirror.getMode(I,p.spellChecker!==!1?"spell-checker":"gfm"),p.overlayMode.mode,p.overlayMode.combine)}),h="overlay-mode",g=p.parsingConfig,g.gitHubSpice=!1):(h=p.parsingConfig,h.name="gfm",h.gitHubSpice=!1),p.spellChecker!==!1&&(h="spell-checker",g=p.parsingConfig,g.name="gfm",g.gitHubSpice=!1,typeof p.spellChecker=="function"?p.spellChecker({codeMirrorInstance:CodeMirror}):CodeMirrorSpellChecker({codeMirrorInstance:CodeMirror}));function C(I,U,J){return{addNew:!1}}CodeMirror.getMode("php").mime="text/x-php",this.codemirror=CodeMirror.fromTextArea(o,{mode:h,backdrop:g,theme:p.theme!=null?p.theme:"easymde",tabSize:p.tabSize!=null?p.tabSize:2,indentUnit:p.tabSize!=null?p.tabSize:2,indentWithTabs:p.indentWithTabs!==!1,lineNumbers:p.lineNumbers===!0,autofocus:p.autofocus===!0,extraKeys:S,direction:p.direction,lineWrapping:p.lineWrapping!==!1,allowDropFileTypes:["text/plain"],placeholder:p.placeholder||o.getAttribute("placeholder")||"",styleSelectedText:p.styleSelectedText!=null?p.styleSelectedText:!ra(),scrollbarStyle:p.scrollbarStyle!=null?p.scrollbarStyle:"native",configureMouse:C,inputStyle:p.inputStyle!=null?p.inputStyle:ra()?"contenteditable":"textarea",spellcheck:p.nativeSpellcheck!=null?p.nativeSpellcheck:!0,autoRefresh:p.autoRefresh!=null?p.autoRefresh:!1,leaveSubmitMethodAlone:!0});var _=this.codemirror.getScrollerElement();if(_.style.minHeight=p.minHeight,typeof p.maxHeight<"u"&&(_.setAttribute("tabindex","0"),_.style.setProperty(this.hasExplicitMinHeight?"max-height":"height",p.maxHeight)),p.forceSync===!0){var c=this.codemirror;c.on("change",function(){c.save()})}this.gui={};var d=document.createElement("div");d.classList.add("EasyMDEContainer"),d.setAttribute("role","application");var w=this.codemirror.getWrapperElement();w.parentNode.insertBefore(d,w),d.appendChil
Line truncated
|
||||
@@ -0,0 +1 @@
|
||||
function $({statePath:l,isCollapsed:c,collapseKey:f}){return{isCollapsed:f?Alpine.$persist(c).as(f):c,collapseFromEvent(m){m.detail===l&&(this.isCollapsed=!0)},expandFromEvent(m){m.detail===l&&(this.isCollapsed=!1)},expand(){this.isCollapsed=!1},toggleCollapsed(){this.isCollapsed=!this.isCollapsed},get itemClasses(){return{"fi-collapsed":this.isCollapsed}}}}function x({schemaComponent:l,moveUpAction:c,moveDownAction:f,reorderAction:m,message:y,hasCustomReorderAction:w}){let A=e=>JSON.stringify({name:e?.name,arguments:e?.arguments,context:e?.context});return{pending:null,frame:null,destroyed:!1,listeners:[],removeCommitHook:null,init(){let e=(t,s,d,g=!0)=>{t.addEventListener(s,d,g),this.listeners.push(()=>t.removeEventListener(s,d,g))};e(document,"pointerdown",t=>{this.pending?.control?.contains(t.target)||this.relinquishFocus()}),e(document,"keydown",t=>{t.key==="Tab"&&this.relinquishFocus()}),e(document,"focusin",t=>{this.pending&&t.target!==this.pending.control&&this.relinquishFocus()}),e(this.$root,"click",t=>{let s=t.target.closest("[data-reorder-direction]");if(!(!s||!this.owns(s))){if(this.pending){t.preventDefault(),t.stopImmediatePropagation();return}!s.dataset.reorderAction?.startsWith("mountAction(")||s.getAttribute("wire:click")!==s.dataset.reorderAction||s.getAttributeNames().some(d=>d==="wire:confirm"||d.startsWith("wire:confirm."))||s.disabled||this.begin(s.closest("[x-sortable-item]").getAttribute("x-sortable-item"),s.dataset.reorderDirection,s)}}),e(this.$root,"start",t=>{t.target===this.$refs.reorderItems&&this.begin(t.item.getAttribute("x-sortable-item"),"drag")}),e(this.$root,"end",t=>{if(t.target===this.$refs.reorderItems){if(t.oldDraggableIndex===t.newDraggableIndex){this.finish(),t.stopImmediatePropagation();return}this.setSortingDisabled(!0)}}),this.removeCommitHook=Livewire.hook("commit",({component:t,commit:s,succeed:d,fail:g})=>{let i=this.pending;if(t.id!==this.$wire.$id)return;let n=[];for(let r=this.$root;r&&!(r.hasAttribute("wire:id")&&r.getAttribute("wire:id")!==t.id);r=r.parentElement){let u=r.getAttribute("wire:partial");if(u&&n.push(u),r===t.el)break}let b=r=>r.html||n.some(u=>r.partials?.[u]);if(d(({effects:r})=>{this.pending===i&&(i&&(!i.synchronizing||!b(r))||this.schedule(()=>{this.destroyed||!this.$root.isConnected||(this.updateHandles(),i?.synchronizing&&this.isCurrent(i)&&this.finish())}))}),!i||i.synchronizing)return;let a=t.canonical.mountedActions??[],o=r=>r?.context?.schemaComponent===l&&r.name===i.action&&(i.direction==="drag"||String(r.arguments?.item)===i.item),C=a.some(o)&&!o(a.at(-1));if(!s.calls.some(r=>r.method==="mountAction"?o({name:r.params[0],arguments:r.params[1],context:r.params[2]}):["callMountedAction","unmountAction"].includes(r.method)&&a.some(o)))return;let S=s.calls.some(r=>r.method==="unmountAction");d(({effects:r})=>{if(!this.isCurrent(i))return;let u=t.canonical.mountedActions??[],I=u.some(o);for(let[h,p]of i.reopenedModals??[])A(u[h])!==p&&i.reopenedModals.delete(h);if(I){i.focus=!1,i.modal=!0,this.setSortingDisabled(!0);let h=u.length-1;u.length<a.length&&i.reopenedModals?.has(h)&&this.schedule(()=>{if(!this.isCurrent(i))return;let p=t.canonical.mountedActions??[];p.length===h+1&&A(p[h])===i.reopenedModals.get(h)&&this.$dispatch("open-modal",{id:`fi-${t.id}-action-${h}`})});return}if(!b(r)||C){this.resynchronize(i);return}this.schedule(()=>this.reconcile(i))}),g(()=>{this.isCurrent(i)&&(i.focus=!1,i.modal&&S&&(i.reopenedModals??(i.reopenedModals=new Map),i.reopenedModals.set(a.length-1,A(a.at(-1))),this.$dispatch("open-modal",{id:`fi-${t.id}-action-${a.length-1}`})),!i.modal&&(i.direction==="drag"?this.resynchronize(i):this.finish()))})}),this.updateHandles()},owns(e){return e.closest("[data-reorder-owner]")===this.$root},order(){return JSON.parse(this.$root.dataset.reorderItems)},reorder(e){e.target===this.$refs.reorderItems&&this.$wire.mountAction(m,{items:e.target.sortable.toArray()},{schemaComponent:l})},begin(e,t,s=null){this.pending={item:e,direction:t,control:s,focus:!s?.hasAttribute("data-reorder-hidden")&&document.activeElement===s,before:this.order(),action:t==="drag"?m:t==="up"?c:f},t!=="drag"&&this.setSortingDisabled(!0)},relinquishFocus(){this.pending&&(this.pending.focus=!1)},isCurrent(e){return!this.destroyed&&this.$root.isConnected&&this.pending===e},schedule(e){cancelAnimationFrame(this.frame),this.frame=requestAnimationFrame(e)},resynchronize(e){this.setSortingDisabled(!0),e.synchronizing=!0,this.$wire.forceRender().catch(()=>{})},reconcile(e){if(!this.isCurrent(e))return;this.updateHandles();let t=this.order(),s=e.before.filter(n=>t.includes(n)),d=t.filter(n=>e.before.includes(n)),g=t.includes(e.item)&&s.indexOf(e.item)!==d.indexOf(e.item),i=[...this.$root.querySelectorAll("[data-reorder-description]")].find(n=>this.owns(n)&&n.dataset.reorderDescription===e.item);if(g&&i&&(this.$refs.reorderStatus.textContent=y.replace(/:label|:position|:count/g,n=>({":label":i.dataset.reorderLabel,":position":String(t.indexOf(e.item)+1Line truncated
|
||||
@@ -0,0 +1,161 @@
|
||||
var $g=Object.defineProperty;var Po=(t,e)=>{for(var n in e)$g(t,n,{get:e[n],enumerable:!0})};var Ni={};Po(Ni,{CommandManager:()=>On,DECORATION_MANAGER_PLUGIN_KEY:()=>En,Decoration:()=>ho,DecorationManager:()=>Qf,Editor:()=>Dx,Extendable:()=>Ai,Extension:()=>Z,Fragment:()=>Bx,InlineDecoration:()=>Sh,InputRule:()=>ln,MappablePosition:()=>Ca,Mark:()=>ie,MarkView:()=>vx,Node:()=>W,NodeDecoration:()=>Ch,NodePos:()=>kh,NodeView:()=>Wx,PasteRule:()=>yr,ResizableNodeView:()=>Oi,ResizableNodeview:()=>Vx,Tracker:()=>Ux,WidgetDecoration:()=>vh,attrsEqual:()=>Ma,callOrReturn:()=>G,canInsertNode:()=>Ta,combineTransactionSteps:()=>bi,commands:()=>jf,createAtomBlockMarkdownSpec:()=>oh,createBlockMarkdownSpec:()=>gr,createChainableState:()=>io,createDocument:()=>pi,createElement:()=>Hx,createInlineMarkdownSpec:()=>ih,createMappablePosition:()=>Ff,createNodeFromContent:()=>Rn,createStyleTag:()=>Zf,createWidgetDecoration:()=>Px,decodeHtmlEntities:()=>ax,defaultBlockAt:()=>pr,deleteProps:()=>ia,elementFromString:()=>dr,encodeHtmlEntities:()=>cx,escapeForRegEx:()=>Aa,extensions:()=>Ox,findChildren:()=>mr,findChildrenInRange:()=>ha,findDuplicates:()=>Df,findParentNode:()=>Ht,findParentNodeClosestToPos:()=>dt,flattenExtensions:()=>wi,fromString:()=>Rf,generateHTML:()=>aw,generateJSON:()=>cw,generateText:()=>dw,getAttributes:()=>Ci,getAttributesFromExtensions:()=>ma,getChangedRanges:()=>Ln,getDebugJSON:()=>Pf,getExtensionField:()=>B,getHTMLFromFragment:()=>lo,getMarkAttributes:()=>fa,getMarkRange:()=>yi,getMarkType:()=>xt,getMarksBetween:()=>ao,getNodeAtPosition:()=>wa,getNodeAttributes:()=>Lf,getNodeType:()=>ce,getPreviousBlockSibling:()=>xa,getRenderedAttributes:()=>zt,getSchema:()=>ki,getSchemaByResolvedExtensions:()=>ga,getSchemaTypeByName:()=>An,getSchemaTypeNameByName:()=>so,getSplittedAttributes:()=>no,getStyleProperty:()=>Ea,getText:()=>ba,getTextBetween:()=>ya,getTextContentFromNodes:()=>$f,getTextSerializersFromSchema:()=>Si,getUpdatedPosition:()=>Hf,h:()=>Hx,injectExtensionAttributesToParseRule:()=>sa,inputRulesPlugin:()=>sh,isActive:()=>vi,isAndroid:()=>oo,isAtEndOfNode:()=>ka,isAtStartOfNode:()=>Sa,isEmptyObject:()=>Nf,isExtensionRulesEnabled:()=>la,isFirefox:()=>dx,isFunction:()=>pa,isList:()=>fi,isMacOS:()=>ua,isMarkActive:()=>mi,isNodeActive:()=>ct,isNodeEmpty:()=>In,isNodeSelection:()=>co,isNodeViewSelected:()=>fw,isNumber:()=>eh,isPlainObject:()=>eo,isProseMirrorAddMarkStep:()=>hw,isProseMirrorAddNodeMarkStep:()=>pw,isProseMirrorAttrStep:()=>mw,isProseMirrorCellSelection:()=>gw,isProseMirrorDocAttrStep:()=>yw,isProseMirrorFragment:()=>Bf,isProseMirrorNodeSelection:()=>bw,isProseMirrorRemoveMarkStep:()=>ww,isProseMirrorRemoveNodeMarkStep:()=>xw,isProseMirrorReplaceAroundStep:()=>kw,isProseMirrorReplaceStep:()=>Sw,isProseMirrorSlice:()=>Cw,isProseMirrorStep:()=>Ft,isProseMirrorStepResult:()=>vw,isRegExp:()=>gi,isSafari:()=>Tf,isString:()=>fx,isTextSelection:()=>hr,isiOS:()=>Nn,liveWidgetKeys:()=>Yf,markInputRule:()=>Ie,markPasteRule:()=>Ne,markdown:()=>Sx,marksEqual:()=>Cx,mergeAttributes:()=>L,mergeDeep:()=>Na,minMax:()=>wt,nodeInputRule:()=>po,nodePasteRule:()=>jx,objectIncludes:()=>ro,parseAttributes:()=>Mi,parseIndentedBlocks:()=>uo,pasteRulesPlugin:()=>ah,posToDOMRect:()=>va,removeDuplicates:()=>If,renderNestedMarkdownContent:()=>fo,resolveExtensions:()=>xi,resolveFocusPosition:()=>hi,rewriteUnknownContent:()=>Mw,selectionToInsertionEnd:()=>da,serializeAttributes:()=>Ti,sortExtensions:()=>ur,splitExtensions:()=>Dn,textInputRule:()=>$x,textPasteRule:()=>_x,textblockTypeInputRule:()=>br,updateMarkViewAttributes:()=>Ra,wrappingInputRule:()=>Vt});var _c=Object.defineProperty,$o=(t,e)=>{let n={};for(var r in t)_c(n,r,{get:t[r],enumerable:!0});return e||_c(n,Symbol.toStringTag,{value:"Module"}),n};function Te(t){this.content=t}Te.prototype={constructor:Te,find:function(t){for(var e=0;e<this.content.length;e+=2)if(this.content[e]===t)return e;return-1},get:function(t){var e=this.find(t);return e==-1?void 0:this.content[e+1]},update:function(t,e,n){var r=n&&n!=t?this.remove(n):this,o=r.find(t),i=r.content.slice();return o==-1?i.push(n||t,e):(i[o+1]=e,n&&(i[o]=n)),new Te(i)},remove:function(t){var e=this.find(t);if(e==-1)return this;var n=this.content.slice();return n.splice(e,2),new Te(n)},addToStart:function(t,e){return new Te([t,e].concat(this.remove(t).content))},addToEnd:function(t,e){var n=this.remove(t).content.slice();return n.push(t,e),new Te(n)},addBefore:function(t,e,n){var r=this.remove(e),o=r.content.slice(),i=r.find(t);return o.splice(i==-1?o.length:i,0,e,n),new Te(o)},forEach:function(t){for(var e=0;e<this.content.length;e+=2)t(this.content[e],this.content[e+1])},prepend:function(t){return t=Te.from(t),t.size?new Te(t.content.concat(this.subtract(t).content)):this},append:function(t){return t=Te.from(t),t.size?new Te(this.subtract(t).content.concat(t.content)):this},subtract:function(t){var e=this;t=Te.from(t);for(var n=0;n<t.content.length;n+=2)e=e.remove(t.content[n]);return e},toObject:function(){vaLine truncated
|
||||
`)}};Qt.empty=new Qt(!0);var Ks=class{constructor(e,n){this.string=e,this.nodeTypes=n,this.inline=null,this.pos=0,this.tokens=e.split(/\s*(?=\b|\W|$)/),this.tokens[this.tokens.length-1]==""&&this.tokens.pop(),this.tokens[0]==""&&this.tokens.shift()}get next(){return this.tokens[this.pos]}eat(e){return this.next==e&&(this.pos++||!0)}err(e){throw new SyntaxError(e+" (in content expression '"+this.string+"')")}};function dd(t){let e=[];do e.push(Vg(t));while(t.eat("|"));return e.length==1?e[0]:{type:"choice",exprs:e}}function Vg(t){let e=[];do e.push(Wg(t));while(t.next&&t.next!=")"&&t.next!="|");return e.length==1?e[0]:{type:"seq",exprs:e}}function Wg(t){let e=Ug(t);for(;;)if(t.eat("+"))e={type:"plus",expr:e};else if(t.eat("*"))e={type:"star",expr:e};else if(t.eat("?"))e={type:"opt",expr:e};else if(t.eat("{"))e=jg(t,e);else break;return e}function Kc(t){/\D/.test(t.next)&&t.err("Expected number, got '"+t.next+"'");let e=Number(t.next);return t.pos++,e}function jg(t,e){let n=Kc(t),r=n;return t.eat(",")&&(t.next!="}"?r=Kc(t):r=-1),t.eat("}")||t.err("Unclosed braced range"),{type:"range",min:n,max:r,expr:e}}function _g(t,e){let n=t.nodeTypes,r=n[e];if(r)return[r];let o=[];for(let i in n){let s=n[i];s.isInGroup(e)&&o.push(s)}return o.length==0&&t.err("No node type or group '"+e+"' found"),o}function Ug(t){if(t.eat("(")){let e=dd(t);return t.eat(")")||t.err("Missing closing paren"),e}else if(/\W/.test(t.next))t.err("Unexpected token '"+t.next+"'");else{let e=_g(t,t.next).map(n=>(t.inline==null?t.inline=n.isInline:t.inline!=n.isInline&&t.err("Mixing inline and block content"),{type:"name",value:n}));return t.pos++,e.length==1?e[0]:{type:"choice",exprs:e}}}function Kg(t){let e=[[]];return o(i(t,0),n()),e;function n(){return e.push([])-1}function r(s,l,a){let c={term:a,to:l};return e[s].push(c),c}function o(s,l){s.forEach(a=>a.to=l)}function i(s,l){if(s.type=="choice")return s.exprs.reduce((a,c)=>a.concat(i(c,l)),[]);if(s.type=="seq")for(let a=0;;a++){let c=i(s.exprs[a],l);if(a==s.exprs.length-1)return c;o(c,l=n())}else if(s.type=="star"){let a=n();return r(l,a),o(i(s.expr,a),a),[r(a)]}else if(s.type=="plus"){let a=n();return o(i(s.expr,l),a),o(i(s.expr,a),a),[r(a)]}else{if(s.type=="opt")return[r(l)].concat(i(s.expr,l));if(s.type=="range"){let a=l;for(let c=0;c<s.min;c++){let d=n();o(i(s.expr,a),d),a=d}if(s.max==-1)o(i(s.expr,a),a);else for(let c=s.min;c<s.max;c++){let d=n();r(a,d),o(i(s.expr,a),d),a=d}return[r(a)]}else{if(s.type=="name")return[r(l,void 0,s.value)];throw new Error("Unknown expr type")}}}}function ud(t,e){return e-t}function qc(t,e){let n=[];return r(e),n.sort(ud);function r(o){let i=t[o];if(i.length==1&&!i[0].term)return r(i[0].to);n.push(o);for(let s=0;s<i.length;s++){let{term:l,to:a}=i[s];!l&&n.indexOf(a)==-1&&r(a)}}}function qg(t){let e=Object.create(null);return n(qc(t,0));function n(r){let o=[];r.forEach(s=>{t[s].forEach(({term:l,to:a})=>{if(!l)return;let c;for(let d=0;d<o.length;d++)o[d][0]==l&&(c=o[d][1]);qc(t,a).forEach(d=>{c||o.push([l,c=[]]),c.indexOf(d)==-1&&c.push(d)})})});let i=e[r.join(",")]=new Qt(r.indexOf(t.length-1)>-1);for(let s=0;s<o.length;s++){let l=o[s][1].sort(ud);i.next.push({type:o[s][0],next:e[l.join(",")]||n(l)})}return i}}function Jg(t,e){for(let n=0,r=[t];n<r.length;n++){let o=r[n],i=!o.validEnd,s=[];for(let l=0;l<o.next.length;l++){let{type:a,next:c}=o.next[l];s.push(a.name),i&&!(a.isText||a.hasRequiredAttrs())&&(i=!1),r.indexOf(c)==-1&&r.push(c)}i&&e.err("Only non-generatable nodes ("+s.join(", ")+") in a required position (see https://prosemirror.net/docs/guide/#generatable)")}}function fd(t){let e=Object.create(null);for(let n in t){let r=t[n];if(!r.hasDefault)return null;e[n]=r.default}return e}function hd(t,e){let n=Object.create(null);for(let r in t){let o=e&&e[r];if(o===void 0){let i=t[r];if(i.hasDefault)o=i.default;else throw new RangeError("No value supplied for attribute "+r)}n[r]=o}return n}function pd(t,e,n,r){for(let o in e)if(!(o in t))throw new RangeError(`Unsupported attribute ${o} for ${n} of type ${r}`);for(let o in t)t[o].validate&&t[o].validate(e[o])}function md(t,e){let n=Object.create(null);if(e)for(let r in e)n[r]=new qs(t,r,e[r]);return n}var Rr=class t{constructor(e,n,r){this.name=e,this.schema=n,this.spec=r,this.markSet=null,this.groups=r.group?r.group.split(" "):[],this.attrs=md(e,r.attrs),this.defaultAttrs=fd(this.attrs),this.contentMatch=null,this.inlineContent=null,this.isBlock=!(r.inline||e=="text"),this.isText=e=="text"}get isInline(){return!this.isBlock}get isTextblock(){return this.isBlock&&this.inlineContent}get isLeaf(){return this.contentMatch==Qt.empty}get isAtom(){return this.isLeaf||!!this.spec.atom}isInGroup(e){return this.groups.indexOf(e)>-1}get whitespace(){return this.spec.whitespace||(this.spec.code?"pre":"normal")}hasRequiredAttrs(){for(let e in this.attrs)if(this.attrs[e].isRequired)return!0;return!1}compatibleContent(e){return this==e||this.contentMatch.compatible(e.contentMatch)}computeAttrs(e){return!e&&this.defaultAtt
Line truncated
|
||||
`);else if(s.linebreakReplacement&&/[\r\n]/.test(r)&&this.top.findWrapping(s.linebreakReplacement.create())){let l=r.split(/\r?\n|\r/);for(let a=0;a<l.length;a++)a&&this.insertNode(s.linebreakReplacement.create(),n,!0),l[a]&&this.insertNode(s.text(l[a]),n,!/\S/.test(l[a]));r=""}else r=r.replace(/\r?\n|\r/g," ");else if(r=r.replace(/[ \t\r\n\u000c]+/g," "),/^[ \t\r\n\u000c]/.test(r)&&this.open==this.nodes.length-1){let l=o.content[o.content.length-1],a=e.previousSibling;(!l||a&&a.nodeName=="BR"||l.isText&&/[ \t\r\n\u000c]$/.test(l.text))&&(r=r.slice(1))}r&&this.insertNode(s.text(r),n,!/\S/.test(r)),this.findInText(e)}else this.findInside(e)}addElement(e,n,r){let o=this.localPreserveWS,i=this.top;(e.tagName=="PRE"||/pre/.test(e.style&&e.style.whiteSpace))&&(this.localPreserveWS=!0);let s=e.nodeName.toLowerCase(),l;yd.hasOwnProperty(s)&&this.parser.normalizeLists&&Zg(e);let a=this.options.ruleFromNode&&this.options.ruleFromNode(e)||(l=this.parser.matchTag(e,this,r));e:if(a?a.ignore:Qg.hasOwnProperty(s))this.findInside(e),this.ignoreFallback(e,n);else if(!a||a.skip||a.closeParent){a&&a.closeParent?this.open=Math.max(0,this.open-1):a&&a.skip.nodeType&&(e=a.skip);let c,d=this.needsBlock;if(gd.hasOwnProperty(s))i.content.length&&i.content[0].isInline&&this.open&&(this.open--,i=this.top),c=!0,i.type||(this.needsBlock=!0);else if(!e.firstChild){this.leafFallback(e,n);break e}let u=a&&a.skip?n:this.readStyles(e,n);u&&this.addAll(e,u),c&&this.sync(i),this.needsBlock=d}else{let c=this.readStyles(e,n);c&&this.addElementByRule(e,a,c,a.consuming===!1?l:void 0)}this.localPreserveWS=o}leafFallback(e,n){e.nodeName=="BR"&&this.top.type&&this.top.type.inlineContent&&this.addTextNode(e.ownerDocument.createTextNode(`
|
||||
`),n)}ignoreFallback(e,n){e.nodeName=="BR"&&(!this.top.type||!this.top.type.inlineContent)&&this.findPlace(this.parser.schema.text("-"),n,!0)}readStyles(e,n){let r=e.style;if(r&&r.length)for(let o=0;o<this.parser.matchedStyles.length;o++){let i=this.parser.matchedStyles[o],s=r.getPropertyValue(i);if(s)for(let l=void 0;;){let a=this.parser.matchStyle(i,s,this,l);if(!a)break;if(a.ignore)return null;if(a.clearMark?n=n.filter(c=>!a.clearMark(c)):n=n.concat(this.parser.schema.marks[a.mark].create(a.attrs)),a.consuming===!1)l=a;else break}}return n}addElementByRule(e,n,r,o){let i,s;if(n.node)if(s=this.parser.schema.nodes[n.node],s.isLeaf)this.insertNode(s.create(n.attrs),r,e.nodeName=="BR")||this.leafFallback(e,r);else{let a=this.enter(s,n.attrs||null,r,n.preserveWhitespace);a&&(i=!0,r=a)}else{let a=this.parser.schema.marks[n.mark];r=r.concat(a.create(n.attrs))}let l=this.top;if(s&&s.isLeaf)this.findInside(e);else if(o)this.addElement(e,r,o);else if(n.getContent)this.findInside(e),n.getContent(e,this.parser.schema).forEach(a=>this.insertNode(a,r,!1));else{let a=e;typeof n.contentElement=="string"?a=e.querySelector(n.contentElement):typeof n.contentElement=="function"?a=n.contentElement(e):n.contentElement&&(a=n.contentElement),this.findAround(e,a,!0),this.addAll(a,r),this.findAround(e,a,!1)}i&&this.sync(l)&&this.open--}addAll(e,n,r,o){let i=r||0;for(let s=r?e.childNodes[r]:e.firstChild,l=o==null?null:e.childNodes[o];s!=l;s=s.nextSibling,++i)this.findAtPoint(e,i),this.addDOM(s,n);this.findAtPoint(e,i)}findPlace(e,n,r){let o,i;for(let s=this.open,l=0;s>=0;s--){let a=this.nodes[s],c=a.findWrapping(e);if(c&&(!o||o.length>c.length+l)&&(o=c,i=a,!c.length))break;if(a.solid){if(r)break;l+=2}}if(!o)return null;this.sync(i);for(let s=0;s<o.length;s++)n=this.enterInner(o[s],null,n,!1);return n}insertNode(e,n,r){if(e.isInline&&this.needsBlock&&!this.top.type){let i=this.textblockFromContext();i&&(n=this.enterInner(i,null,n))}let o=this.findPlace(e,n,r);if(o){this.closeExtra();let i=this.top;i.match&&(i.match=i.match.matchType(e.type));let s=Q.none;for(let l of o.concat(e.marks))(i.type?i.type.allowsMarkType(l.type):Yc(l.type,e.type))&&(s=l.addToSet(s));return i.content.push(e.mark(s)),!0}return!1}enter(e,n,r,o){let i=this.findPlace(e.create(n),r,!1);return i&&(i=this.enterInner(e,n,r,!0,o)),i}enterInner(e,n,r,o=!1,i){this.closeExtra();let s=this.top;s.match=s.match&&s.match.matchType(e);let l=Gc(e,i,s.options);s.options&Or&&s.content.length==0&&(l|=Or);let a=Q.none;return r=r.filter(c=>(s.type?s.type.allowsMarkType(c.type):Yc(c.type,e))?(a=c.addToSet(a),!1):!0),this.nodes.push(new qn(e,n,a,o,null,l)),this.open++,r}closeExtra(e=!1){let n=this.nodes.length-1;if(n>this.open){for(;n>this.open;n--)this.nodes[n-1].content.push(this.nodes[n].finish(e));this.nodes.length=this.open+1}}finish(){return this.open=0,this.closeExtra(this.isOpen),this.nodes[0].finish(!!(this.isOpen||this.options.topOpen))}sync(e){for(let n=this.open;n>=0;n--){if(this.nodes[n]==e)return this.open=n,!0;this.localPreserveWS&&(this.nodes[n].options|=Dr)}return!1}get currentPos(){this.closeExtra();let e=0;for(let n=this.open;n>=0;n--){let r=this.nodes[n].content;for(let o=r.length-1;o>=0;o--)e+=r[o].nodeSize;n&&e++}return e}findAtPoint(e,n){if(this.find)for(let r=0;r<this.find.length;r++)this.find[r].node==e&&this.find[r].offset==n&&(this.find[r].pos=this.currentPos)}findInside(e){if(this.find)for(let n=0;n<this.find.length;n++)this.find[n].pos==null&&e.nodeType==1&&e.contains(this.find[n].node)&&(this.find[n].pos=this.currentPos)}findAround(e,n,r){if(e!=n&&this.find)for(let o=0;o<this.find.length;o++)this.find[o].pos==null&&e.nodeType==1&&e.contains(this.find[o].node)&&n.compareDocumentPosition(this.find[o].node)&(r?2:4)&&(this.find[o].pos=this.currentPos)}findInText(e){if(this.find)for(let n=0;n<this.find.length;n++)this.find[n].node==e&&(this.find[n].pos=this.currentPos-(e.nodeValue.length-this.find[n].offset))}matchesContext(e){if(e.indexOf("|")>-1)return e.split(/\s*\|\s*/).some(this.matchesContext,this);let n=e.split("/"),r=this.options.context,o=!this.isOpen&&(!r||r.parent.type==this.nodes[0].type),i=-(r?r.depth+1:0)+(o?0:1),s=(l,a)=>{for(;l>=0;l--){let c=n[l];if(c==""){if(l==n.length-1||l==0)continue;for(;a>=i;a--)if(s(l-1,a))return!0;return!1}else{let d=a>0||a==0&&o?this.nodes[a].type:r&&a>=i?r.node(a-i).type:null;if(!d||d.name!=c&&!d.isInGroup(c))return!1;a--}}return!0};return s(n.length-1,this.open)}textblockFromContext(){let e=this.options.context;if(e)for(let n=e.depth;n>=0;n--){let r=e.node(n).contentMatchAt(e.indexAfter(n)).defaultType;if(r&&r.isTextblock&&r.defaultAttrs)return r}for(let n in this.parser.schema.nodes){let r=this.parser.schema.nodes[n];if(r.isTextblock&&r.defaultAttrs)return r}}};function Zg(t){for(let e=t.firstChild,n=null;e;e=e.nextSibling){let r=e.nodeType==1?e.nodeName.toLowerCase():null;r&&yd.hasOwnProperty(r)&&n?(n.appendChild(e),e=n):r=="li"?n=e:r&&(n=null)}}function ey(t,e){return(t.matches||t.msMatchesSelector||t.webkitM
Line truncated
|
||||
`))}})}function hy(t,e,n){let r=t.resolve(e),o=r.index();return r.parent.canReplaceWith(o,o+1,n)}function py(t,e,n,r,o){let i=t.doc.nodeAt(e);if(!i)throw new RangeError("No node at given position");n||(n=i.type);let s=n.create(r,null,o||i.marks);if(i.isLeaf)return t.replaceWith(e,e+i.nodeSize,s);if(!n.validContent(i.content))throw new RangeError("Invalid content for node type "+n.name);t.step(new ue(e,e+i.nodeSize,e+1,e+i.nodeSize-1,new E(S.from(s),0,0),1,!0))}function Ke(t,e,n=1,r){let o=t.resolve(e),i=o.depth-n,s=r&&r[r.length-1]||o.parent;if(i<0||o.parent.type.spec.isolating||!o.parent.canReplace(o.index(),o.parent.childCount)||!s.type.validContent(o.parent.content.cutByIndex(o.index(),o.parent.childCount)))return!1;for(let c=o.depth-1,d=n-2;c>i;c--,d--){let u=o.node(c),f=o.index(c);if(u.type.spec.isolating)return!1;let h=u.content.cutByIndex(f,u.childCount),p=r&&r[d+1];p&&(h=h.replaceChild(0,p.type.create(p.attrs)));let g=r&&r[d]||u;if(!u.canReplace(f+1,u.childCount)||!g.type.validContent(h))return!1}let l=o.indexAfter(i),a=r&&r[0];return o.node(i).canReplaceWith(l,l,a?a.type:o.node(i+1).type)}function my(t,e,n=1,r){let o=t.doc.resolve(e),i=S.empty,s=S.empty;for(let l=o.depth,a=o.depth-n,c=n-1;l>a;l--,c--){i=S.from(o.node(l).copy(i));let d=r&&r[c];s=S.from(d?d.type.create(d.attrs,s):o.node(l).copy(s))}t.step(new be(e,e,new E(i.append(s),n,n),!0))}function lt(t,e){let n=t.resolve(e),r=n.index();return Ad(n.nodeBefore,n.nodeAfter)&&n.parent.canReplace(r,r+1)}function gy(t,e){e.content.size||t.type.compatibleContent(e.type);let n=t.contentMatchAt(t.childCount),{linebreakReplacement:r}=t.type.schema;for(let o=0;o<e.childCount;o++){let i=e.child(o),s=i.type==r?t.type.schema.nodes.text:i.type;if(n=n.matchType(s),!n||!t.type.allowsMarks(i.marks))return!1}return n.validEnd}function Ad(t,e){return!!(t&&e&&!t.isLeaf&&gy(t,e))}function Zn(t,e,n=-1){let r=t.resolve(e);for(let o=r.depth;;o--){let i,s,l=r.index(o);if(o==r.depth?(i=r.nodeBefore,s=r.nodeAfter):n>0?(i=r.node(o+1),l++,s=r.node(o).maybeChild(l)):(i=r.node(o).maybeChild(l-1),s=r.node(o+1)),i&&!i.isTextblock&&Ad(i,s)&&r.node(o).canReplace(l,l+1))return e;if(o==0)break;e=n<0?r.before(o):r.after(o)}}function yy(t,e,n){let r=null,{linebreakReplacement:o}=t.doc.type.schema,i=t.doc.resolve(e-n),s=i.node().type;if(o&&s.inlineContent){let d=s.whitespace=="pre",u=!!s.contentMatch.matchType(o);d&&!u?r=!1:!d&&u&&(r=!0)}let l=t.steps.length;if(r===!1){let d=t.doc.resolve(e+n);Td(t,d.node(),d.before(),l)}s.inlineContent&&tl(t,e+n-1,s,i.node().contentMatchAt(i.index()),r==null);let a=t.mapping.slice(l),c=a.map(e-n);if(t.step(new be(c,a.map(e+n,-1),E.empty,!0)),r===!0){let d=t.doc.resolve(c);Md(t,d.node(),d.before(),t.steps.length)}return t}function by(t,e,n){let r=t.resolve(e);if(r.parent.canReplaceWith(r.index(),r.index(),n))return e;if(r.parentOffset==0)for(let o=r.depth-1;o>=0;o--){let i=r.index(o);if(r.node(o).canReplaceWith(i,i,n))return r.before(o+1);if(i>0)return null}if(r.parentOffset==r.parent.content.size)for(let o=r.depth-1;o>=0;o--){let i=r.indexAfter(o);if(r.node(o).canReplaceWith(i,i,n))return r.after(o+1);if(i<r.node(o).childCount)return null}return null}function Ko(t,e,n){let r=t.resolve(e);if(!n.content.size)return e;let o=n.content;for(let i=0;i<n.openStart;i++)o=o.firstChild.content;for(let i=1;i<=(n.openStart==0&&n.size?2:1);i++)for(let s=r.depth;s>=0;s--){let l=s==r.depth?0:r.pos<=(r.start(s+1)+r.end(s+1))/2?-1:1,a=r.index(s)+(l>0?1:0),c=r.node(s),d=!1;if(i==1)d=c.canReplace(a,a,o);else{let u=c.contentMatchAt(a).findWrapping(o.firstChild.type);d=u&&c.canReplaceWith(a,a,u[0])}if(d)return l==0?r.pos:l<0?r.before(s+1):r.after(s+1)}return null}function Hr(t,e,n=e,r=E.empty){if(e==n&&!r.size)return null;let o=t.resolve(e),i=t.resolve(n);return Ed(o,i,r)?new be(e,n,r):new Zs(o,i,r).fit()}function Ed(t,e,n){return!n.openStart&&!n.openEnd&&t.start()==e.start()&&t.parent.canReplace(t.index(),e.index(),n.content)}var Zs=class{constructor(e,n,r){this.$from=e,this.$to=n,this.unplaced=r,this.frontier=[],this.placed=S.empty;for(let o=0;o<=e.depth;o++){let i=e.node(o);this.frontier.push({type:i.type,match:i.contentMatchAt(e.indexAfter(o))})}for(let o=e.depth;o>0;o--)this.placed=S.from(e.node(o).copy(this.placed))}get depth(){return this.frontier.length-1}fit(){for(;this.unplaced.size;){let c=this.findFittable();c?this.placeNodes(c):this.openMore()||this.dropNode()}let e=this.mustMoveInline(),n=this.placed.size-this.depth-this.$from.depth,r=this.$from,o=this.close(e<0?this.$to:r.doc.resolve(e));if(!o)return null;let i=this.placed,s=r.depth,l=o.depth;for(;s&&l&&i.childCount==1;)i=i.firstChild.content,s--,l--;let a=new E(i,s,l);return e>-1?new ue(r.pos,e,this.$to.pos,this.$to.end(),a,n):a.size||r.pos!=this.$to.pos?new be(r.pos,o.pos,a):null}findFittable(){let e=this.unplaced.openStart;for(let n=this.unplaced.content,r=0,o=this.unplaced.openEnd;r<e;r++){let i=n.firstChild;if(n.childCount>1&&(o=0),i.type.spec.isolating&&o<=r){e=r;break}n=i.content}for(let n=1;n<=2;n++
Line truncated
|
||||
`).scrollIntoView()),!0)};function hl(t){for(let e=0;e<t.edgeCount;e++){let{type:n}=t.edge(e);if(n.isTextblock&&!n.hasRequiredAttrs())return n}return null}var pl=(t,e)=>{let{$head:n,$anchor:r}=t.selection;if(!n.parent.type.spec.code||!n.sameParent(r))return!1;let o=n.node(-1),i=n.indexAfter(-1),s=hl(o.contentMatchAt(i));if(!s||!o.canReplaceWith(i,i,s))return!1;if(e){let l=n.after(),a=t.tr.replaceWith(l,l,s.createAndFill());a.setSelection(z.near(a.doc.resolve(l),1)),e(a.scrollIntoView())}return!0},ml=(t,e)=>{let n=t.selection,{$from:r,$to:o}=n;if(n instanceof Ae||r.parent.inlineContent||o.parent.inlineContent)return!1;let i=hl(o.parent.contentMatchAt(o.indexAfter()));if(!i||!i.isTextblock)return!1;if(e){let s=(!r.parentOffset&&o.index()<o.parent.childCount?r:o).pos,l=t.tr.insert(s,i.createAndFill());l.setSelection(R.create(l.doc,s+1)),e(l.scrollIntoView())}return!0},gl=(t,e)=>{let{$cursor:n}=t.selection;if(!n||n.parent.content.size)return!1;if(n.depth>1&&n.after()!=n.end(-1)){let i=n.before();if(Ke(t.doc,i))return e&&e(t.tr.split(i).scrollIntoView()),!0}let r=n.blockRange(),o=r&&Rt(r);return o==null?!1:(e&&e(t.tr.lift(r,o).scrollIntoView()),!0)};function Ty(t){return(e,n)=>{let{$from:r,$to:o}=e.selection;if(e.selection instanceof $&&e.selection.node.isBlock)return!r.parentOffset||!Ke(e.doc,r.pos)?!1:(n&&n(e.tr.split(r.pos).scrollIntoView()),!0);if(!r.depth)return!1;let i=[],s,l,a=!1,c=!1;for(let h=r.depth;;h--)if(r.node(h).isBlock){a=r.end(h)==r.pos+(r.depth-h),c=r.start(h)==r.pos-(r.depth-h),l=hl(r.node(h-1).contentMatchAt(r.indexAfter(h-1)));let g=t&&t(o.parent,a,r);i.unshift(g||(a&&l?{type:l}:null)),s=h;break}else{if(h==1)return!1;i.unshift(null)}let d=e.tr;(e.selection instanceof R||e.selection instanceof Ae)&&d.deleteSelection();let u=d.mapping.map(r.pos),f=Ke(d.doc,u,i.length,i);if(f||(i[0]=l?{type:l}:null,f=Ke(d.doc,u,i.length,i)),!f)return!1;if(d.split(u,i.length,i),!a&&c&&r.node(s).type!=l){let h=d.mapping.map(r.before(s)),p=d.doc.resolve(h);l&&r.node(s-1).canReplaceWith(p.index(),p.index()+1,l)&&d.setNodeMarkup(d.mapping.map(r.before(s)),l)}return n&&n(d.scrollIntoView()),!0}}var Ay=Ty();var Xd=(t,e)=>{let{$from:n,to:r}=t.selection,o,i=n.sharedDepth(r);return i==0?!1:(o=n.before(i),e&&e(t.tr.setSelection($.create(t.doc,o))),!0)},Ey=(t,e)=>(e&&e(t.tr.setSelection(new Ae(t.doc))),!0);function Oy(t,e,n){let r=e.nodeBefore,o=e.nodeAfter,i=e.index();return!r||!o||!r.type.compatibleContent(o.type)?!1:!r.content.size&&e.parent.canReplace(i-1,i)?(n&&n(t.tr.delete(e.pos-r.nodeSize,e.pos).scrollIntoView()),!0):!e.parent.canReplace(i,i+1)||!(o.isTextblock||lt(t.doc,e.pos))?!1:(n&&n(t.tr.join(e.pos).scrollIntoView()),!0)}function Yd(t,e,n,r){let o=e.nodeBefore,i=e.nodeAfter,s,l,a=o.type.spec.isolating||i.type.spec.isolating;if(!a&&Oy(t,e,n))return!0;let c=!a&&e.parent.canReplace(e.index(),e.index()+1);if(c&&(s=(l=o.contentMatchAt(o.childCount)).findWrapping(i.type))&&l.matchType(s[0]||i.type).validEnd){if(n){let h=e.pos+i.nodeSize,p=S.empty;for(let y=s.length-1;y>=0;y--)p=S.from(s[y].create(null,p));p=S.from(o.copy(p));let g=t.tr.step(new ue(e.pos-1,h,e.pos,h,new E(p,1,0),s.length,!0)),m=g.doc.resolve(h+2*s.length);m.nodeAfter&&m.nodeAfter.type==o.type&<(g.doc,m.pos)&&g.join(m.pos),n(g.scrollIntoView())}return!0}let d=i.type.spec.isolating||r>0&&a?null:z.findFrom(e,1),u=d&&d.$from.blockRange(d.$to),f=u&&Rt(u);if(f!=null&&f>=e.depth)return n&&n(t.tr.lift(u,f).scrollIntoView()),!0;if(c&&nr(i,"start",!0)&&nr(o,"end")){let h=o,p=[];for(;p.push(h),!h.isTextblock;)h=h.lastChild;let g=i,m=1;for(;!g.isTextblock;g=g.firstChild)m++;if(h.canReplace(h.childCount,h.childCount,g.content)){if(n){let y=S.empty;for(let x=p.length-1;x>=0;x--)y=S.from(p[x].copy(y));let w=t.tr.step(new ue(e.pos-p.length,e.pos+i.nodeSize,e.pos+m,e.pos+i.nodeSize-m,new E(y,p.length,0),0,!0));n(w.scrollIntoView())}return!0}}return!1}function Qd(t){return function(e,n){let r=e.selection,o=t<0?r.$from:r.$to,i=o.depth;for(;o.node(i).isInline;){if(!i)return!1;i--}return o.node(i).isTextblock?(n&&n(e.tr.setSelection(R.create(e.doc,t<0?o.start(i):o.end(i)))),!0):!1}}var yl=Qd(-1),bl=Qd(1);function Zd(t,e=null){return function(n,r){let{$from:o,$to:i}=n.selection,s=o.blockRange(i),l=s&&Qn(s,t,e);return l?(r&&r(n.tr.wrap(s,l).scrollIntoView()),!0):!1}}function wl(t,e=null){return function(n,r){let o=!1;for(let i=0;i<n.selection.ranges.length&&!o;i++){let{$from:{pos:s},$to:{pos:l}}=n.selection.ranges[i];n.doc.nodesBetween(s,l,(a,c)=>{if(o)return!1;if(!(!a.isTextblock||a.hasMarkup(t,e)))if(a.type==t)o=!0;else{let d=n.doc.resolve(c),u=d.index();o=d.parent.canReplaceWith(u,u+1,t)}})}if(!o)return!1;if(r){let i=n.tr;for(let s=0;s<n.selection.ranges.length;s++){let{$from:{pos:l},$to:{pos:a}}=n.selection.ranges[s];i.setBlockType(l,a,t,e)}r(i.scrollIntoView())}return!0}}function xl(...t){return function(e,n,r){for(let o=0;o<t.length;o++)if(t[o](e,n,r))return!0;return!1}}var il=xl(Vd,sl,ll),Fd=xl(Vd,cl,dl),en={Enter:xl(fl,ml,gl,Ay),"Mod-Enter":pl,Backspace:il,"Mod-
Line truncated
|
||||
`),u&&p==h.nodeValue.length)for(let g=h,m;g;g=g.parentNode){if(m=g.nextSibling){m.nodeName=="BR"&&(l=a={node:m.parentNode,offset:Se(m)+1});break}let y=g.pmViewDesc;if(y&&y.node&&y.node.isBlock)break}}else{let g=h.childNodes[p-1];u=g&&(g.nodeName=="BR"||g.contentEditable=="false")}}if(Ge&&d.focusNode&&d.focusNode!=a.node&&d.focusNode.nodeType==1){let h=d.focusNode.childNodes[d.focusOffset];h&&h.contentEditable=="false"&&(o=!0)}if(!(o||u&&Oe)&&vn(l.node,l.offset,d.anchorNode,d.anchorOffset)&&vn(a.node,a.offset,d.focusNode,d.focusOffset))return;let f=!1;if((c.extend||e==n)&&!(u&&Ge)){c.collapse(l.node,l.offset);try{e!=n&&c.extend(a.node,a.offset),f=!0}catch{}}if(!f){if(e>n){let p=l;l=a,a=p}let h=document.createRange();h.setEnd(a.node,a.offset),h.setStart(l.node,l.offset),c.removeAllRanges(),c.addRange(h)}}ignoreMutation(e){return!this.contentDOM&&e.type!="selection"}get contentLost(){return this.contentDOM&&this.contentDOM!=this.dom&&!this.dom.contains(this.contentDOM)}markDirty(e,n){for(let r=0,o=0;o<this.children.length;o++){let i=this.children[o],s=r+i.size;if(r==s?e<=s&&n>=r:e<s&&n>r){let l=r+i.border,a=s-i.border;if(e>=l&&n<=a){this.dirty=e==r||n==s?bn:cu,e==l&&n==a&&(i.contentLost||i.dom.parentNode!=this.contentDOM)?i.dirty=at:i.markDirty(e-l,n-l);return}else i.dirty=i.dom==i.contentDOM&&i.dom.parentNode==this.contentDOM&&!i.children.length?bn:at}r=s}this.dirty=bn}markParentsDirty(){let e=1;for(let n=this.parent;n;n=n.parent,e++){let r=e==1?bn:cu;n.dirty<r&&(n.dirty=r)}}get domAtom(){return!1}get ignoreForCoords(){return!1}get ignoreForSelection(){return!1}isText(e){return!1}},Yo=class extends Mn{constructor(e,n,r,o){let i,s=n.type.toDOM;if(typeof s=="function"&&(s=s(r,()=>{if(!i)return o;if(i.parent)return i.parent.posBeforeChild(i)})),!n.type.spec.raw){if(s.nodeType!=1){let l=document.createElement("span");l.appendChild(s),s=l}s.hasAttribute("contenteditable")||(s.contentEditable="false"),s.classList.add("ProseMirror-widget")}super(e,[],s,null),this.widget=n,this.widget=n,i=this}matchesWidget(e){return this.dirty==Xe&&e.type.eq(this.widget.type)}parseRule(){return{ignore:!0}}stopEvent(e){let n=this.widget.spec.stopEvent;return n?n(e):!1}ignoreMutation(e){return e.type!="selection"||this.widget.spec.ignoreSelection}destroy(){this.widget.type.destroy(this.dom),super.destroy()}get domAtom(){return!0}get ignoreForSelection(){return!!this.widget.type.spec.relaxedSide}get side(){return this.widget.type.side}},Rl=class extends Mn{constructor(e,n,r,o){super(e,[],n,null),this.textDOM=r,this.text=o}get size(){return this.text.length}localPosFromDOM(e,n){return e!=this.textDOM?this.posAtStart+(n?this.size:0):this.posAtStart+n}domFromPos(e){return{node:this.textDOM,offset:e}}ignoreMutation(e){return e.type==="characterData"&&e.target.nodeValue==e.oldValue}},xn=class t extends Mn{constructor(e,n,r,o,i){super(e,[],r,o),this.mark=n,this.spec=i}static create(e,n,r,o){let i=o.nodeViews[n.type.name],s=i&&i(n,o,r);return(!s||!s.dom)&&(s=yt.renderSpec(document,n.type.spec.toDOM(n,r),null,n.attrs)),new t(e,n,s.dom,s.contentDOM||s.dom,s)}parseRule(){return this.dirty&at||this.mark.type.spec.reparseInView?null:{mark:this.mark.type.name,attrs:this.mark.attrs,contentElement:this.contentDOM}}matchesMark(e){return this.dirty!=at&&this.mark.eq(e)}markDirty(e,n){if(super.markDirty(e,n),this.dirty!=Xe){let r=this.parent;for(;!r.node;)r=r.parent;r.dirty<this.dirty&&(r.dirty=this.dirty),this.dirty=Xe}}slice(e,n,r){let o=t.create(this.parent,this.mark,!0,r),i=this.children,s=this.size;n<s&&(i=Pl(i,n,s,r)),e>0&&(i=Pl(i,0,e,r));for(let l=0;l<i.length;l++)i[l].parent=o;return o.children=i,o}ignoreMutation(e){return this.spec.ignoreMutation?this.spec.ignoreMutation(e):super.ignoreMutation(e)}destroy(){this.spec.destroy&&this.spec.destroy(),super.destroy()}},on=class t extends Mn{constructor(e,n,r,o,i,s,l){super(e,[],i,s),this.node=n,this.outerDeco=r,this.innerDeco=o,this.nodeDOM=l}static create(e,n,r,o,i,s){let l=i.nodeViews[n.type.name],a,c=l&&l(n,i,()=>{if(!a)return s;if(a.parent)return a.parent.posBeforeChild(a)},r,o),d=c&&c.dom,u=c&&c.contentDOM;if(n.isText){if(!d)d=document.createTextNode(n.text);else if(d.nodeType!=3)throw new RangeError("Text must be rendered as a DOM text node")}else d||({dom:d,contentDOM:u}=yt.renderSpec(document,n.type.spec.toDOM(n),null,n.attrs));!u&&!n.isText&&d.nodeName!="BR"&&(d.hasAttribute("contenteditable")||(d.contentEditable="false"),n.type.spec.draggable&&(d.draggable=!0));let f=d;return d=_u(d,r,n),c?a=new Dl(e,n,r,o,d,u||null,f,c):n.isText?new Qo(e,n,r,o,d,f):new t(e,n,r,o,d,u||null,f)}parseRule(e){if(this.node.type.spec.reparseInView)return null;let n={node:this.node.type.name,attrs:this.node.attrs};if(this.node.type.whitespace=="pre"&&(n.preserveWhitespace="full"),!this.contentDOM)n.getContent=()=>this.node.content;else if(!this.contentLost)n.contentElement=this.contentDOM;else{for(let r=this.children.length-1;r>=0;r--){let o=this.children[r];if(this.dom.contains(o.dom.parentNode)){n.contentElemen
Line truncated
|
||||
|
||||
`);return{dom:a,text:f,slice:e}}function Xl(t,e,n,r,o){let i=o.parent.type.spec.code,s,l;if(!n&&!e)return null;let a=!!e&&(r||i||!n);if(a){if(t.someProp("transformPastedText",f=>{e=f(e,i||r,t)}),i)return l=new E(S.from(t.state.schema.text(e.replace(/\r\n?/g,`
|
||||
`))),0,0),t.someProp("transformPasted",f=>{l=f(l,t,!0)}),l;let u=t.someProp("clipboardTextParser",f=>f(e,o,r,t));if(u)l=u;else{let f=o.marks(),{schema:h}=t.state,p=yt.fromSchema(h);s=document.createElement("div"),e.split(/(?:\r\n?|\n)+/).forEach(g=>{let m=s.appendChild(document.createElement("p"));g&&m.appendChild(p.serializeNode(h.text(g,f)))})}}else t.someProp("transformPastedHTML",u=>{n=u(n,t)}),s=C0(n),Xr&&v0(s);let c=s&&s.querySelector("[data-pm-slice]"),d=c&&/^(\d+) (\d+)(?: -(\d+))? (.*)/.exec(c.getAttribute("data-pm-slice")||"");if(d&&d[3])for(let u=+d[3];u>0;u--){let f=s.firstChild;for(;f&&f.nodeType!=1;)f=f.nextSibling;if(!f)break;s=f}if(l||(l=(t.someProp("clipboardParser")||t.someProp("domParser")||Ve.fromSchema(t.state.schema)).parseSlice(s,{preserveWhitespace:!!(a||d),context:o,ruleFromNode(f){return f.nodeName=="BR"&&!f.nextSibling&&f.parentNode&&!x0.test(f.parentNode.nodeName)?{ignore:!0}:null}})),d)l=M0(Su(l,+d[1],+d[2]),d[4]);else if(l=E.maxOpen(k0(l.content,o),!0),l.openStart||l.openEnd){let u=0,f=0;for(let h=l.content.firstChild;u<l.openStart&&!h.type.spec.isolating;u++,h=h.firstChild);for(let h=l.content.lastChild;f<l.openEnd&&!h.type.spec.isolating;f++,h=h.lastChild);l=Su(l,u,f)}return t.someProp("transformPasted",u=>{l=u(l,t,a)}),l}var x0=/^(a|abbr|acronym|b|cite|code|del|em|i|ins|kbd|label|output|q|ruby|s|samp|span|strong|sub|sup|time|u|tt|var)$/i;function k0(t,e){if(t.childCount<2)return t;for(let n=e.depth;n>=0;n--){let o=e.node(n).contentMatchAt(e.index(n)),i,s=[];if(t.forEach(l=>{if(!s)return;let a=o.findWrapping(l.type),c;if(!a)return s=null;if(c=s.length&&i.length&&Xu(a,i,l,s[s.length-1],0))s[s.length-1]=c;else{s.length&&(s[s.length-1]=Yu(s[s.length-1],i.length));let d=Gu(l,a);s.push(d),o=o.matchType(d.type),i=a}}),s)return S.from(s)}return t}function Gu(t,e,n=0){for(let r=e.length-1;r>=n;r--)t=e[r].create(null,S.from(t));return t}function Xu(t,e,n,r,o){if(o<t.length&&o<e.length&&t[o]==e[o]){let i=Xu(t,e,n,r.lastChild,o+1);if(i)return r.copy(r.content.replaceChild(r.childCount-1,i));if(r.contentMatchAt(r.childCount).matchType(o==t.length-1?n.type:t[o+1]))return r.copy(r.content.append(S.from(Gu(n,t,o+1))))}}function Yu(t,e){if(e==0)return t;let n=t.content.replaceChild(t.childCount-1,Yu(t.lastChild,e-1)),r=t.contentMatchAt(t.childCount).fillBefore(S.empty,!0);return t.copy(n.append(r))}function zl(t,e,n,r,o,i){let s=e<0?t.firstChild:t.lastChild,l=s.content;return t.childCount>1&&(i=0),o<r-1&&(l=zl(l,e,n,r,o+1,i)),o>=n&&(l=e<0?s.contentMatchAt(0).fillBefore(l,i<=o).append(l):l.append(s.contentMatchAt(s.childCount).fillBefore(S.empty,!0))),t.replaceChild(e<0?0:t.childCount-1,s.copy(l))}function Su(t,e,n){return e<t.openStart&&(t=new E(zl(t.content,-1,e,t.openStart,0,t.openEnd),e,t.openEnd)),n<t.openEnd&&(t=new E(zl(t.content,1,n,t.openEnd,0,0),t.openStart,n)),t}var Qu={thead:["table"],tbody:["table"],tfoot:["table"],caption:["table"],colgroup:["table"],col:["table","colgroup"],tr:["table","tbody"],td:["table","tbody","tr"],th:["table","tbody","tr"]};function Zu(){return document.implementation.createHTMLDocument("title")}var Wr=null;function S0(t){let e=window.trustedTypes;if(!e)return t;if(!Wr){if(Wr=e.defaultPolicy)try{return Wr.createHTML(t)}catch{}Wr=e.createPolicy("ProseMirrorClipboard",{createHTML:n=>n})}return Wr.createHTML(t)}function C0(t){let e=/^(\s*<meta [^>]*>)*/.exec(t);e&&(t=t.slice(e[0].length));let n=Zu(),r=n.body,o=/<([a-z][^>\s]+)/i.exec(t),i;if((i=o&&Qu[o[1].toLowerCase()])&&(t=i.map(s=>"<"+s+">").join("")+t+i.map(s=>"</"+s+">").reverse().join("")),r.innerHTML=S0(t),i)for(let s=0;s<i.length;s++)r=r.querySelector(i[s])||r;for(let s=0;s<n.styleSheets.length;s++){let l=n.styleSheets[s];for(let a=0;a<l.rules.length;a++){let c=l.rules[a];if(c instanceof CSSStyleRule){let d=r.querySelectorAll(c.selectorText);for(let u=0;u<d.length;u++)d[u].style.cssText+=c.style.cssText}}}return r}function v0(t){let e=t.querySelectorAll(Ce?"span:not([class]):not([style])":"span.Apple-converted-space");for(let n=0;n<e.length;n++){let r=e[n];r.childNodes.length==1&&r.textContent=="\xA0"&&r.parentNode&&r.parentNode.replaceChild(t.ownerDocument.createTextNode(" "),r)}}function M0(t,e){if(!t.size)return t;let n=t.content.firstChild.type.schema,r;try{r=JSON.parse(e)}catch{return t}let{content:o,openStart:i,openEnd:s}=t;for(let l=r.length-2;l>=0;l-=2){let a=n.nodes[r[l]];if(!a||a.hasRequiredAttrs())break;try{a.checkAttrs(r[l+1])}catch{break}o=S.from(a.create(r[l+1],o)),i++,s++}return new E(o,i,s)}var De={},Le={},T0={touchstart:!0,touchmove:!0},Hl=class{constructor(){this.shiftKey=!1,this.mouseDown=null,this.lastKeyCode=null,this.lastKeyCodeTime=0,this.lastClick={time:0,x:0,y:0,type:"",button:0},this.lastSelectionOrigin=null,this.lastSelectionTime=0,this.lastIOSEnter=0,this.lastIOSEnterFallbackTimeout=-1,this.lastFocus=0,this.lastTouch=0,this.lastChromeDelete=0,this.composing=!1,this.compositionNode=null,this.composingTimeout=-1,this.compositionNodes=[],this.compositionEndedAt=-2e8,this.com
Line truncated
|
||||
|
||||
`,textSerializers:s={}}=n||{},l="";return t.nodesBetween(r,o,(a,c,d,u)=>{a.isBlock&&c>r&&(l+=i);let f=s?.[a.type.name];if(f)return d&&(l+=f({node:a,pos:c,parent:d,index:u,range:e})),!1;if(a.isText){var h;l+=a==null||(h=a.text)===null||h===void 0?void 0:h.slice(Math.max(r,c)-c,o-c)}}),l}function ba(t,e){return ya(t,{from:0,to:t.content.size},e)}function Si(t){return Object.fromEntries(Object.entries(t.nodes).filter(([,e])=>e.spec.toText).map(([e,n])=>[e,n.spec.toText]))}function dw(t,e,n){let{blockSeparator:r=`
|
||||
|
||||
`,textSerializers:o={}}=n||{},i=ki(e);return ba(ge.fromJSON(i,t),{blockSeparator:r,textSerializers:{...Si(i),...o}})}function Lf(t,e){let n=ce(e,t.schema),{from:r,to:o}=t.selection,i=[];t.doc.nodesBetween(r,o,l=>{i.push(l)});let s=i.reverse().find(l=>l.type.name===n.name);return s?{...s.attrs}:{}}function Ci(t,e){let n=so(typeof e=="string"?e:e.name,t.schema);return n==="node"?Lf(t,e):n==="mark"?fa(t,e):{}}function If(t,e=JSON.stringify){let n={};return t.filter(r=>{let o=e(r);return Object.prototype.hasOwnProperty.call(n,o)?!1:n[o]=!0})}function uw(t){let e=If(t);return e.length===1?e:e.filter((n,r)=>!e.filter((o,i)=>i!==r).some(o=>n.oldRange.from>=o.oldRange.from&&n.oldRange.to<=o.oldRange.to&&n.newRange.from>=o.newRange.from&&n.newRange.to<=o.newRange.to))}function Ln(t){let{mapping:e,steps:n}=t,r=[];return e.maps.forEach((o,i)=>{let s=[];if(o.ranges.length)o.forEach((l,a)=>{s.push({from:l,to:a})});else{let{from:l,to:a}=n[i];if(l===void 0||a===void 0)return;s.push({from:l,to:a})}s.forEach(({from:l,to:a})=>{let c=e.slice(i).map(l,-1),d=e.slice(i).map(a),u=e.invert().map(c,-1),f=e.invert().map(d);r.push({oldRange:{from:u,to:f},newRange:{from:c,to:d}})})}),uw(r)}function Pf(t,e=0){let n=t.type===t.type.schema.topNodeType?0:1,r=e,o=r+t.nodeSize,i=t.marks.map(a=>{let c={type:a.type.name};return Object.keys(a.attrs).length&&(c.attrs={...a.attrs}),c}),s={...t.attrs},l={type:t.type.name,from:r,to:o};return Object.keys(s).length&&(l.attrs=s),i.length&&(l.marks=i),t.content.childCount&&(l.content=[],t.forEach((a,c)=>{var d;(d=l.content)===null||d===void 0||d.push(Pf(a,e+c+n))})),t.text&&(l.text=t.text),l}function ao(t,e,n){let r=[];return t===e?n.resolve(t).marks().forEach(o=>{let i=yi(n.resolve(t),o.type);i&&r.push({mark:o,...i})}):n.nodesBetween(t,e,(o,i)=>{!o||o?.nodeSize===void 0||r.push(...o.marks.map(s=>({from:i,to:i+o.nodeSize,mark:s})))}),r}var wa=(t,e,n,r=20)=>{let o=t.doc.resolve(n),i=r,s=null;for(;i>0&&s===null;){let l=o.node(i);l?.type.name===e?s=l:i-=1}return[s,i]},xa=t=>{let e=t.depth-1;if(e<0)return null;let n=t.index(e);return n===0?null:t.node(e).child(n-1)};function An(t,e){return e.nodes[t]||e.marks[t]||null}function no(t,e,n){return Object.fromEntries(Object.entries(n).filter(([r])=>{let o=t.find(i=>i.type===e&&i.name===r);return o?o.attribute.keepOnSplit:!1}))}var $f=(t,e=500)=>{let n="",r=t.parentOffset;return t.parent.nodesBetween(Math.max(0,r-e),r,(o,i,s,l)=>{var a,c;let d=((a=(c=o.type.spec).toText)===null||a===void 0?void 0:a.call(c,{node:o,pos:i,parent:s,index:l}))||o.textContent||"%leaf%";n+=o.isAtom&&!o.isText?d:d.slice(0,Math.max(0,r-i))}),n};function mi(t,e,n={}){let{empty:r,ranges:o}=t.selection,i=e?xt(e,t.schema):null;if(r)return!!(t.storedMarks||t.selection.$from.marks()).filter(d=>i?i.name===d.type.name:!0).find(d=>ro(d.attrs,n,{strict:!1}));let s=0,l=[];if(o.forEach(({$from:d,$to:u})=>{let f=d.pos,h=u.pos;t.doc.nodesBetween(f,h,(p,g)=>{if(i&&p.inlineContent&&!p.type.allowsMarkType(i))return!1;if(!p.isText&&!p.marks.length)return;let m=Math.max(f,g),y=Math.min(h,g+p.nodeSize),w=y-m;s+=w,l.push(...p.marks.map(x=>({mark:x,from:m,to:y})))})}),s===0)return!1;let a=l.filter(d=>i?i.name===d.mark.type.name:!0).filter(d=>ro(d.mark.attrs,n,{strict:!1})).reduce((d,u)=>d+u.to-u.from,0),c=l.filter(d=>i?d.mark.type!==i&&d.mark.type.excludes(i):!0).reduce((d,u)=>d+u.to-u.from,0);return(a>0?a+c:a)>=s}function vi(t,e,n={}){if(!e)return ct(t,null,n)||mi(t,null,n);let r=so(e,t.schema);return r==="node"?ct(t,e,n):r==="mark"?mi(t,e,n):!1}var ka=(t,e)=>{let{$from:n,$to:r,$anchor:o}=t.selection;if(e){let i=Ht(l=>l.type.name===e)(t.selection);if(!i)return!1;let s=t.doc.resolve(i.pos+1);return o.pos+1===s.end()}return!(r.parentOffset<r.parent.nodeSize-2||n.pos!==r.pos)},Sa=t=>{let{$from:e,$to:n}=t.selection;return!(e.parentOffset>0||e.pos!==n.pos)};function la(t,e){return Array.isArray(e)?e.some(n=>(typeof n=="string"?n:n.name)===t.name):e}function fi(t,e){let{nodeExtensions:n}=Dn(e),r=n.find(i=>i.name===t);if(!r)return!1;let o=G(B(r,"group",{name:r.name,options:r.options,storage:r.storage}));return typeof o!="string"?!1:o.split(" ").includes("list")}function In(t,{checkChildren:e=!0,ignoreWhitespace:n=!1}={}){if(n){if(t.type.name==="hardBreak")return!0;if(t.isText){var r;return!/\S/.test((r=t.text)!==null&&r!==void 0?r:"")}}if(t.isText)return!t.text;if(t.isAtom||t.isLeaf)return!1;if(t.content.childCount===0)return!0;if(e){let o=!0;return t.content.forEach(i=>{o!==!1&&(In(i,{ignoreWhitespace:n,checkChildren:e})||(o=!1))}),o}return!1}function co(t){return t instanceof $}function fw({selection:t,pos:e,nodeSize:n,selectedOnTextSelection:r=!1}){let{from:o,to:i}=t;return!!(o<=e&&i>=e+n||r&&hr(t)&&o>e&&i<e+n)}function Ft(t){if(t===null||typeof t!="object")return!1;let e=t;return!(typeof e.apply!="function"||typeof e.getMap!="function"||typeof e.invert!="function"||typeof e.map!="function"||typeof e.merge!="function"||typeof e.toJSON!="function")}function hw(t){if(t===null||typeof t!="object")return!1;let e=t
Line truncated
|
||||
|
||||
`);return`:::${c}${g}
|
||||
|
||||
${m}
|
||||
|
||||
:::`}}}function xx(t){let e={};return rh(t,"shortcode").forEach(n=>{n.type==="keyValue"&&(e[n.name]=n.value)}),e}function kx(t){return Object.entries(t).filter(([,e])=>e!=null).map(([e,n])=>`${e}="${n}"`).join(" ")}function ih(t){let{nodeName:e,name:n,getContent:r,parseAttributes:o=xx,serializeAttributes:i=kx,defaultAttributes:s={},selfClosing:l=!1,allowedAttributes:a}=t,c=n||e,d=f=>{if(!a)return f;let h={};return a.forEach(p=>{let g=typeof p=="string"?p:p.name,m=typeof p=="string"?void 0:p.skipIfDefault;if(g in f){let y=f[g];if(m!==void 0&&y===m)return;h[g]=y}}),h},u=c.replace(/[.*+?^${}()|[\]\\]/g,"\\$&");return{parseMarkdown:(f,h)=>{let p={...s,...f.attributes};if(l)return h.createNode(e,p);let g=r?r(f):f.content||"";return g?h.createNode(e,p,[h.createTextNode(g)]):h.createNode(e,p,[])},markdownTokenizer:{name:e,level:"inline",start(f){let h=l?new RegExp(`\\[${u}\\s*[^\\]]*\\]`):new RegExp(`\\[${u}\\s*[^\\]]*\\][\\s\\S]*?\\[\\/${u}\\]`),p=f.match(h),g=p?.index;return g!==void 0?g:-1},tokenize(f,h,p){let g=l?new RegExp(`^\\[${u}\\s*([^\\]]*)\\]`):new RegExp(`^\\[${u}\\s*([^\\]]*)\\]([\\s\\S]*?)\\[\\/${u}\\]`),m=f.match(g);if(!m)return;let y="",w="";if(l){let[,b]=m;w=b}else{let[,b,k]=m;w=b,y=k||""}let x=o(w.trim());return{type:e,raw:m[0],content:y.trim(),attributes:x}}},renderMarkdown:f=>{let h="";r?h=r(f):f.content&&f.content.length>0&&(h=f.content.filter(y=>y.type==="text").map(y=>y.text).join(""));let p=d(f.attrs||{}),g=i(p),m=g?` ${g}`:"";return l?`[${c}${m}]`:`[${c}${m}]${h}[/${c}]`}}}function uo(t,e,n){let r=t.split(`
|
||||
`),o=[],i="",s=0,l=e.baseIndentSize||2;for(;s<r.length;){let d=r[s],u=d.match(e.itemPattern);if(!u){if(o.length>0)break;if(d.trim()===""){s+=1,i=`${i}${d}
|
||||
`;continue}else return}let f=e.extractItemData(u),{indentLevel:h,mainContent:p}=f;i=`${i}${d}
|
||||
`;let g=[p];for(s+=1;s<r.length;){var a;let x=r[s];if(x.trim()===""){var c;let b=r.slice(s+1).findIndex(k=>k.trim()!=="");if(b===-1)break;if((((c=r[s+1+b].match(/^(\s*)/))===null||c===void 0||(c=c[1])===null||c===void 0?void 0:c.length)||0)>h){g.push(x),i=`${i}${x}
|
||||
`,s+=1;continue}else break}if((((a=x.match(/^(\s*)/))===null||a===void 0||(a=a[1])===null||a===void 0?void 0:a.length)||0)>h)g.push(x),i=`${i}${x}
|
||||
`,s+=1;else break}let m,y=g.slice(1);if(y.length>0){let x=y.map(b=>b.slice(h+l)).join(`
|
||||
`);x.trim()&&(e.customNestedParser?m=e.customNestedParser(x):m=n.blockTokens(x))}let w=e.createToken(f,m);o.push(w)}if(o.length!==0)return{items:o,raw:i}}function fo(t,e,n,r){if(!t||!Array.isArray(t.content))return"";let o=typeof n=="function"?n(r):n,[i,...s]=t.content,l=`${o}${e.renderChildren([i])}`;return s&&s.length>0&&s.forEach((a,c)=>{var d,u;let f=(d=(u=e.renderChild)===null||u===void 0?void 0:u.call(e,a,c+1))!==null&&d!==void 0?d:e.renderChildren([a]);if(f!=null){let h=f.split(`
|
||||
`).map(p=>p?e.indent(p):e.indent("")).join(`
|
||||
`);l+=a.type==="paragraph"?`
|
||||
|
||||
${h}`:`
|
||||
${h}`}}),l}var Sx=$o({createAtomBlockMarkdownSpec:()=>oh,createBlockMarkdownSpec:()=>gr,createInlineMarkdownSpec:()=>ih,parseAttributes:()=>Mi,parseIndentedBlocks:()=>uo,renderNestedMarkdownContent:()=>fo,serializeAttributes:()=>Ti});function Sf(t){return typeof t.type=="string"?t.type:t.type.name}function Cx(t,e){if(t.length!==e.length)return!1;let n=Array.from({length:e.length},()=>!1);return t.every(r=>{let o=Sf(r),i=e.findIndex((s,l)=>!n[l]&&o===Sf(s)&&Ma(r.attrs,s.attrs));return i===-1?!1:(n[i]=!0,!0)})}function Na(t,e){let n={...t};return eo(t)&&eo(e)&&Object.keys(e).forEach(r=>{eo(e[r])&&eo(t[r])?n[r]=Na(t[r],e[r]):n[r]=e[r]}),n}function Ra(t,e,n={}){let{state:r}=e,{doc:o,tr:i}=r,s=t;o.descendants((l,a)=>{let c=i.mapping.map(a),d=i.mapping.map(a)+l.nodeSize,u=null;if(l.marks.forEach(h=>{if(h!==s)return!1;u=h}),!u)return;let f=!1;if(Object.keys(n).forEach(h=>{n[h]!==u.attrs[h]&&(f=!0)}),f){let h=t.type.create({...t.attrs,...n});i.removeMark(c,d,t.type),i.addMark(c,d,h)}}),i.docChanged&&e.view.dispatch(i)}var vx=class{constructor(t,e,n){this.component=t,this.editor=e.editor,this.options={...n},this.mark=e.mark,this.HTMLAttributes=e.HTMLAttributes}get dom(){return this.editor.view.dom}get contentDOM(){return null}updateAttributes(t,e){Ra(e||this.mark,this.editor,t)}ignoreMutation(t){return!this.dom||!this.contentDOM?!0:typeof this.options.ignoreMutation=="function"?this.options.ignoreMutation({mutation:t}):t.type==="selection"||this.dom.contains(t.target)&&t.type==="childList"&&(Nn()||oo())&&this.editor.isFocused&&[...Array.from(t.addedNodes),...Array.from(t.removedNodes)].every(e=>e.isContentEditable)?!1:this.contentDOM===t.target&&t.type==="attributes"?!0:!this.contentDOM.contains(t.target)}},ln=class{constructor(t){var e;this.find=t.find,this.handler=t.handler,this.undoable=(e=t.undoable)!==null&&e!==void 0?e:!0}},Mx=(t,e)=>{if(gi(e))return e.exec(t);let n=e(t);if(!n)return null;let r=[n.text];return r.index=n.index,r.input=t,r.data=n.data,n.replaceWith&&(n.text.includes(n.replaceWith)||console.warn('[tiptap warn]: "inputRuleMatch.replaceWith" must be part of "inputRuleMatch.text".'),r.push(n.replaceWith)),r};function di(t){var e;let{editor:n,from:r,to:o,text:i,rules:s,plugin:l}=t,{view:a}=n;if(a.composing)return!1;let c=a.state.doc.resolve(r);if(c.parent.type.spec.code||!((e=c.nodeBefore||c.nodeAfter)===null||e===void 0)&&e.marks.find(f=>f.type.spec.code))return!1;let d=!1,u=$f(c)+i;return s.forEach(f=>{if(d)return;let h=Mx(u,f.find);if(!h)return;let p=h[0].length-i.length;if(p>0){let k=c.parentOffset-p;if(k<0||c.parent.textBetween(k,c.parentOffset)!==h[0].slice(0,p))return}let g=a.state.tr,m=io({state:a.state,transaction:g}),y={from:r-(h[0].length-i.length),to:o},{commands:w,chain:x,can:b}=new On({editor:n,state:m});f.handler({state:m,range:y,match:h,commands:w,chain:x,can:b})===null||!g.steps.length||(f.undoable&&g.setMeta(l,{transform:g,from:r,to:o,text:i}),a.dispatch(g),d=!0)}),d}function sh(t){let{editor:e,rules:n}=t,r=new F({state:{init(){return null},apply(o,i,s){let l=o.getMeta(r);if(l)return l;let a=o.getMeta("applyInputRules");return a&&setTimeout(()=>{let{text:c}=a;typeof c=="string"?c=c:c=lo(S.from(c),s.schema);let{from:d}=a,u=d+c.length;di({editor:e,from:d,to:u,text:c,rules:n,plugin:r})}),o.selectionSet||o.docChanged?null:i}},props:{handleTextInput(o,i,s,l){return di({editor:e,from:i,to:s,text:l,rules:n,plugin:r})},handleDOMEvents:{compositionend:o=>(setTimeout(()=>{let{$cursor:i}=o.state.selection;i&&di({editor:e,from:i.pos,to:i.pos,text:"",rules:n,plugin:r})}),!1)},handleKeyDown(o,i){if(i.key!=="Enter")return!1;let{$cursor:s}=o.state.selection;return s?di({editor:e,from:s.pos,to:s.pos,text:`
|
||||
`,rules:n,plugin:r}):!1}},isInputRules:!0});return r}var Ai=class{constructor(t={}){this.type="extendable",this.parent=null,this.child=null,this.name="",this.config={name:this.name},this.config={...this.config,...t},this.name=this.config.name}get options(){return{...G(B(this,"addOptions",{name:this.name}))}}get storage(){return{...G(B(this,"addStorage",{name:this.name,options:this.options}))}}configure(t={}){let e=this.extend({...this.config,addOptions:()=>Na(this.options,t)});return e.name=this.name,e.parent=this.parent,this.child=null,e}extend(t={}){let e=new this.constructor({...this.config,...t});return e.parent=this,this.child=e,e.name="name"in t?t.name:e.parent.name,e}},ie=class lh extends Ai{constructor(...e){super(...e),this.type="mark"}static create(e={}){let n=typeof e=="function"?e():e;return new lh(n)}static handleExit({editor:e,mark:n}){let{tr:r}=e.state,o=e.state.selection.$from;if(o.pos===o.end()){let i=o.marks();if(!i.find(l=>l?.type.name===n.name))return!1;let s=i.find(l=>l?.type.name===n.name);return s&&r.removeStoredMark(s),r.insertText(" ",o.pos),e.view.dispatch(r),!0}return!1}configure(e){return super.configure(e)}extend(e){let n=typeof e=="function"?e():e;return super.extend(n)}},yr=class{constructor(t){this.find=t.find,this.handler=t.handler}},Tx=(t,e,n)=>{if(gi(e))return[...t.matchAll(e)];let r=e(t,n);return r?r.map(o=>{let i=[o.text];return i.index=o.index,i.input=t,i.data=o.data,o.replaceWith&&(o.text.includes(o.replaceWith)||console.warn('[tiptap warn]: "pasteRuleMatch.replaceWith" must be part of "pasteRuleMatch.text".'),i.push(o.replaceWith)),i}):[]};function Ax(t){let{editor:e,state:n,from:r,to:o,rule:i,pasteEvent:s,dropEvent:l}=t,{commands:a,chain:c,can:d}=new On({editor:e,state:n}),u=[];return n.doc.nodesBetween(r,o,(f,h)=>{var p,g,m,y;if(!((p=f.type)===null||p===void 0||(p=p.spec)===null||p===void 0)&&p.code||!(f.isText||f.isTextblock||f.isInline))return;let w=(g=(m=(y=f.content)===null||y===void 0?void 0:y.size)!==null&&m!==void 0?m:f.nodeSize)!==null&&g!==void 0?g:0,x=Math.max(r,h),b=Math.min(o,h+w);if(x>=b)return;let k=f.isText?f.text||"":f.textBetween(x-h,b-h,void 0,"\uFFFC");Tx(k,i.find,s).forEach(v=>{if(v.index===void 0)return;let C=x+v.index+1,O=C+v[0].length,P={from:n.tr.mapping.map(C),to:n.tr.mapping.map(O)},N=i.handler({state:n,range:P,match:v,commands:a,chain:c,can:d,pasteEvent:s,dropEvent:l});u.push(N)})}),u.every(f=>f!==null)}var ui=null,Ex=t=>{var e;let n=new ClipboardEvent("paste",{clipboardData:new DataTransfer});return(e=n.clipboardData)===null||e===void 0||e.setData("text/html",t),n};function ah(t){let{editor:e,rules:n}=t,r=null,o=!1,i=!1,s=typeof ClipboardEvent<"u"?new ClipboardEvent("paste"):null,l;try{l=typeof DragEvent<"u"?new DragEvent("drop"):null}catch{l=null}let a=({state:c,from:d,to:u,rule:f,pasteEvt:h})=>{let p=c.tr,g=io({state:c,transaction:p});if(!(!Ax({editor:e,state:g,from:Math.max(d-1,0),to:u.b-1,rule:f,pasteEvent:h,dropEvent:l})||!p.steps.length)){try{l=typeof DragEvent<"u"?new DragEvent("drop"):null}catch{l=null}return s=typeof ClipboardEvent<"u"?new ClipboardEvent("paste"):null,p}};return n.map(c=>new F({view(d){let u=h=>{var p;r=!((p=d.dom.parentElement)===null||p===void 0)&&p.contains(h.target)?d.dom.parentElement:null,r&&(ui=e)},f=()=>{ui&&(ui=null)};return window.addEventListener("dragstart",u),window.addEventListener("dragend",f),{destroy(){window.removeEventListener("dragstart",u),window.removeEventListener("dragend",f)}}},props:{handleDOMEvents:{drop:(d,u)=>{if(i=r===d.dom.parentElement,l=u,!i){let f=ui;f?.isEditable&&setTimeout(()=>{let h=f.state.selection;h&&f.commands.deleteRange({from:h.from,to:h.to})},10)}return!1},paste:(d,u)=>{var f;let h=(f=u.clipboardData)===null||f===void 0?void 0:f.getData("text/html");return s=u,o=!!h?.includes("data-pm-slice"),!1}}},appendTransaction:(d,u,f)=>{let h=d[0],p=h.getMeta("uiEvent")==="paste"&&!o,g=h.getMeta("uiEvent")==="drop"&&!i,m=h.getMeta("applyPasteRules"),y=!!m;if(!p&&!g&&!y)return;if(y){let{text:b}=m;typeof b=="string"?b=b:b=lo(S.from(b),f.schema);let{from:k}=m,v=k+b.length,C=Ex(b);return a({rule:c,state:f,from:k,to:{b:v},pasteEvt:C})}let w=u.doc.content.findDiffStart(f.doc.content),x=u.doc.content.findDiffEnd(f.doc.content);if(!(!eh(w)||!x||w===x.b))return a({rule:c,state:f,from:w,to:x,pasteEvt:s})}}))}var Ei=class{constructor(t,e){this.splittableMarks=[],this.nonClearableMarks=[],this.decorationManager=null,this.editor=e,this.baseExtensions=t,this.extensions=xi(t),this.schema=ga(this.extensions,e),this.setupExtensions()}get commands(){return this.extensions.reduce((t,e)=>{let n=B(e,"addCommands",{name:e.name,options:e.options,storage:this.editor.extensionStorage[e.name],editor:this.editor,type:An(e.name,this.schema)});return n?{...t,...n()}:t},{})}get plugins(){let{editor:t}=this,e=ur([...this.extensions].reverse()).flatMap(r=>{let o={name:r.name,options:r.options,storage:this.editor.extensionStorage[r.name],editor:t,type:An(r.name,this.schema)},i=[],s=B(r,"addKeyboardShortcuts",o)
Line truncated
|
||||
|
||||
`)}}})]}}),uh=Z.create({name:"commands",addCommands(){return{...jf}}}),fh=Z.create({name:"delete",onUpdate({transaction:t,appendedTransactions:e}){var n,r;let o=()=>{var i,s,l;if((i=(s=this.editor.options.coreExtensionOptions)===null||s===void 0||(s=s.delete)===null||s===void 0||(l=s.filterTransaction)===null||l===void 0?void 0:l.call(s,t))!==null&&i!==void 0?i:t.getMeta("y-sync$"))return;let a=bi(t.before,[t,...e]);Ln(a).forEach(d=>{a.mapping.mapResult(d.oldRange.from).deletedAfter&&a.mapping.mapResult(d.oldRange.to).deletedBefore&&a.before.nodesBetween(d.oldRange.from,d.oldRange.to,(u,f)=>{let h=f+u.nodeSize-2,p=d.oldRange.from<=f&&h<=d.oldRange.to;this.editor.emit("delete",{type:"node",node:u,from:f,to:h,newFrom:a.mapping.map(f),newTo:a.mapping.map(h),deletedRange:d.oldRange,newRange:d.newRange,partial:!p,editor:this.editor,transaction:t,combinedTransform:a})})});let c=a.mapping;a.steps.forEach((d,u)=>{if(d instanceof Nt){var f,h;let p=c.slice(u).map(d.from,-1),g=c.slice(u).map(d.to),m=c.invert().map(p,-1),y=c.invert().map(g),w=p>0?(f=a.doc.nodeAt(p-1))===null||f===void 0?void 0:f.marks.some(b=>b.eq(d.mark)):!1,x=(h=a.doc.nodeAt(g))===null||h===void 0?void 0:h.marks.some(b=>b.eq(d.mark));this.editor.emit("delete",{type:"mark",mark:d.mark,from:d.from,to:d.to,deletedRange:{from:m,to:y},newRange:{from:p,to:g},partial:!!(x||w),editor:this.editor,transaction:t,combinedTransform:a})}})};!((n=(r=this.editor.options.coreExtensionOptions)===null||r===void 0||(r=r.delete)===null||r===void 0?void 0:r.async)!==null&&n!==void 0)||n?setTimeout(o,0):o()}}),hh=Z.create({name:"drop",addProseMirrorPlugins(){return[new F({key:new j("tiptapDrop"),props:{handleDrop:(t,e,n,r)=>{this.editor.emit("drop",{editor:this.editor,event:e,slice:n,moved:r})}}})]}}),ph=Z.create({name:"editable",addProseMirrorPlugins(){return[new F({key:new j("editable"),props:{editable:()=>this.editor.options.editable}})]}}),mh=new j("focusEvents"),gh=Z.create({name:"focusEvents",addProseMirrorPlugins(){let{editor:t}=this;return[new F({key:mh,props:{handleDOMEvents:{focus:(e,n)=>{t.isFocused=!0;let r=t.state.tr.setMeta("focus",{event:n}).setMeta("addToHistory",!1);return e.dispatch(r),!1},blur:(e,n)=>{t.isFocused=!1;let r=t.state.tr.setMeta("blur",{event:n}).setMeta("addToHistory",!1);return e.dispatch(r),!1}}}})]}}),yh=Z.create({name:"keymap",addKeyboardShortcuts(){let t=()=>this.editor.commands.first(({commands:s})=>[()=>s.undoInputRule(),()=>s.command(({tr:l})=>{let{selection:a,doc:c}=l,{empty:d,$anchor:u}=a,{pos:f,parent:h}=u,p=u.parent.isTextblock&&f>0?l.doc.resolve(f-1):u,g=p.parent.type.spec.isolating,m=u.pos-u.parentOffset,y=g&&p.parent.childCount===1?m===u.pos:z.atStart(c).from===f;return!d||!h.type.isTextblock||h.textContent.length||!y||y&&u.parent.type.name==="paragraph"?!1:s.clearNodes()}),()=>s.deleteSelection(),()=>s.joinBackward(),()=>s.selectNodeBackward()]),e=()=>this.editor.commands.first(({commands:s})=>[()=>s.deleteSelection(),()=>s.deleteCurrentNode(),()=>s.joinForward(),()=>s.selectNodeForward()]),r={Enter:()=>this.editor.commands.first(({commands:s})=>[()=>s.newlineInCode(),()=>s.createParagraphNear(),()=>s.liftEmptyBlock(),()=>s.splitBlock()]),"Mod-Enter":()=>this.editor.commands.exitCode(),Backspace:t,"Mod-Backspace":t,"Shift-Backspace":t,Delete:e,"Mod-Delete":e,"Mod-a":()=>this.editor.commands.selectAll()},o={...r},i={...r,"Ctrl-h":t,"Alt-Backspace":t,"Ctrl-d":e,"Ctrl-Alt-Backspace":e,"Alt-Delete":e,"Alt-d":e,"Ctrl-a":()=>this.editor.commands.selectTextblockStart(),"Ctrl-e":()=>this.editor.commands.selectTextblockEnd()};return Nn()||ua()?i:o},addProseMirrorPlugins(){return[new F({key:new j("clearDocument"),appendTransaction:(t,e,n)=>{if(t.some(h=>h.getMeta("composition")))return;let r=t.some(h=>h.docChanged)&&!e.doc.eq(n.doc),o=t.some(h=>h.getMeta("preventClearDocument"));if(!r||o)return;let{empty:i,from:s,to:l}=e.selection,a=z.atStart(e.doc).from,c=z.atEnd(e.doc).to;if(i||!(s===a&&l===c)||!In(n.doc))return;let d=n.tr,u=io({state:n,transaction:d}),{commands:f}=new On({editor:this.editor,state:u});if(f.clearNodes(),!!d.steps.length)return d}})]}}),bh=Z.create({name:"paste",addProseMirrorPlugins(){return[new F({key:new j("tiptapPaste"),props:{handlePaste:(t,e,n)=>{this.editor.emit("paste",{editor:this.editor,event:e,slice:n})}}})]}}),wh=Z.create({name:"tabindex",addOptions(){return{value:void 0}},addProseMirrorPlugins(){return[new F({key:new j("tabindex"),props:{attributes:()=>{var t;return!this.editor.isEditable&&this.options.value===void 0?{}:{tabindex:(t=this.options.value)!==null&&t!==void 0?t:"0"}}}})]}}),xh=Z.create({name:"textDirection",addOptions(){return{direction:void 0}},addGlobalAttributes(){if(!this.options.direction)return[];let{nodeExtensions:t}=Dn(this.extensions);return[{types:t.filter(e=>e.name!=="text").map(e=>e.name),attributes:{dir:{default:this.options.direction,parseHTML:e=>{let n=e.getAttribute("dir");return n&&(n==="ltr"||n==="rtl"||n==="auto")?n:this.options.direction},renderHTML:e=>e.dir?{dir:e.dir}:{}}
Line truncated
|
||||
position: relative;
|
||||
}
|
||||
|
||||
.ProseMirror {
|
||||
word-wrap: break-word;
|
||||
white-space: pre-wrap;
|
||||
white-space: break-spaces;
|
||||
-webkit-font-variant-ligatures: none;
|
||||
font-variant-ligatures: none;
|
||||
font-feature-settings: "liga" 0; /* the above doesn't seem to work in Edge */
|
||||
}
|
||||
|
||||
.ProseMirror [contenteditable="false"] {
|
||||
white-space: normal;
|
||||
}
|
||||
|
||||
.ProseMirror [contenteditable="false"] [contenteditable="true"] {
|
||||
white-space: pre-wrap;
|
||||
}
|
||||
|
||||
.ProseMirror pre {
|
||||
white-space: pre-wrap;
|
||||
}
|
||||
|
||||
img.ProseMirror-separator {
|
||||
display: inline !important;
|
||||
border: none !important;
|
||||
margin: 0 !important;
|
||||
width: 0 !important;
|
||||
height: 0 !important;
|
||||
}
|
||||
|
||||
.ProseMirror-gapcursor {
|
||||
display: none;
|
||||
pointer-events: none;
|
||||
position: absolute;
|
||||
margin: 0;
|
||||
}
|
||||
|
||||
.ProseMirror-gapcursor:after {
|
||||
content: "";
|
||||
display: block;
|
||||
position: absolute;
|
||||
top: -2px;
|
||||
width: 20px;
|
||||
border-top: 1px solid black;
|
||||
animation: ProseMirror-cursor-blink 1.1s steps(2, start) infinite;
|
||||
}
|
||||
|
||||
@keyframes ProseMirror-cursor-blink {
|
||||
to {
|
||||
visibility: hidden;
|
||||
}
|
||||
}
|
||||
|
||||
.ProseMirror-hideselection *::selection {
|
||||
background: transparent;
|
||||
}
|
||||
|
||||
.ProseMirror-hideselection *::-moz-selection {
|
||||
background: transparent;
|
||||
}
|
||||
|
||||
.ProseMirror-hideselection * {
|
||||
caret-color: transparent;
|
||||
}
|
||||
|
||||
.ProseMirror-focused .ProseMirror-gapcursor {
|
||||
display: block;
|
||||
}`,Dx=class extends Yw{constructor(t={}){super(),this.css=null,this.className="tiptap",this.editorView=null,this.isFocused=!1,this.destroyed=!1,this.isInitialized=!1,this.extensionStorage={},this.instanceId=Math.random().toString(36).slice(2,9),this.hasWarnedStaleDecorationRead=!1,this.options={element:typeof document<"u"?document.createElement("div"):null,content:"",injectCSS:!0,injectNonce:void 0,extensions:[],autofocus:!1,editable:!0,textDirection:void 0,editorProps:{},parseOptions:{},coreExtensionOptions:{},enableInputRules:!0,enablePasteRules:!0,enableCoreExtensions:!0,enableContentCheck:!1,emitContentError:!1,onBeforeCreate:()=>null,onCreate:()=>null,onMount:()=>null,onUnmount:()=>null,onUpdate:()=>null,onSelectionUpdate:()=>null,onTransaction:()=>null,onFocus:()=>null,onBlur:()=>null,onDestroy:()=>null,onContentError:({error:n})=>{throw n},onPaste:()=>null,onDrop:()=>null,onDelete:()=>null,enableExtensionDispatchTransaction:!0},this.isCapturingTransaction=!1,this.capturedTransaction=null,this.utils={getUpdatedPosition:Hf,createMappablePosition:Ff},this.setOptions(t),this.createExtensionManager(),this.createCommandManager(),this.createSchema(),this.on("beforeCreate",this.options.onBeforeCreate),this.emit("beforeCreate",{editor:this}),this.on("mount",this.options.onMount),this.on("unmount",this.options.onUnmount),this.on("contentError",this.options.onContentError),this.on("create",this.options.onCreate),this.on("update",this.options.onUpdate),this.on("selectionUpdate",this.options.onSelectionUpdate),this.on("transaction",this.options.onTransaction),this.on("focus",this.options.onFocus),this.on("blur",this.options.onBlur),this.on("destroy",this.options.onDestroy),this.on("drop",({event:n,slice:r,moved:o})=>this.options.onDrop(n,r,o)),this.on("paste",({event:n,slice:r})=>this.options.onPaste(n,r)),this.on("delete",this.options.onDelete);let e=this.createDoc();if(!this.editorState){let n=hi(e,this.options.autofocus);this.editorState=tr.create({doc:e,schema:this.schema,selection:n||void 0})}Nx(this.schema),this.options.element&&this.mount(this.options.element)}mount(t){if(typeof document>"u")throw new Error("[tiptap error]: The editor cannot be mounted because there is no 'document' defined in this environment.");this.createView(t),this.emit("mount",{editor:this}),this.css&&!document.head.contains(this.css)&&document.head.appendChild(this.css),window.setTimeout(()=>{this.isDestroyed||(this.options.autofocus!==!1&&this.options.autofocus!==null&&this.commands.focus(this.options.autofocus),this.emit("create",{editor:this}),this.isInitialized=!0)},0)}unmount(){if(this.editorView){this.editorState=this.editorView.state;let t=this.editorView.dom;t?.editor&&delete t.editor,this.editorView.destroy()}if(this.editorView=null,this.isInitialized=!1,this.css&&!document.querySelectorAll(`.${this.className}`).length)try{typeof this.css.remove=="function"?this.css.remove():this.css.parentNode&&this.css.parentNode.removeChild(this.css)}catch(t){console.warn("Failed to remove CSS element:",t)}this.css=null,this.emit("unmount",{editor:this})}get storage(){return this.extensionStorage}get commands(){return this.commandManager.commands}chain(){return this.commandManager?this.commandManager.chain():On.createFakeChain()}can(){return this.commandManager?this.commandManager.can():On.createFallbackCan()}injectCSS(){this.options.injectCSS&&typeof document<"u"&&(this.css=Zf(Rx,this.options.injectNonce))}setOptions(t={}){this.options={...this.options,...t},!(!this.editorView||!this.state||this.isDestroyed)&&(this.options.editorProps&&this.view.setProps(this.options.editorProps),this.view.updateState(this.state))}setEditable(t,e=!0){this.setOptions({editable:t}),e&&this.emit("update",{editor:this,transaction:this.state.tr,appendedTransactions:[]})}get isEditable(){return this.options.editable&&this.view&&this.view.editable}get view(){return this.editorView?this.editorView:new Proxy({state:this.editorState,updateState:t=>{this.editorState=t},dispatch:t=>{this.dispatchTransaction(t)},composing:!1,dragging:null,editable:!0,isDestroyed:!1},{get:(t,e)=>{if(this.editorView)return this.editorView[e];if(e==="state")return this.editorState;if(e in t)return Reflect.get(t,e);throw new Error(`[tiptap error]: The editor view is not available. Cannot access view['${e}']. The editor may not be mounted yet.`)}})}get state(){return _f&&!this.hasWarnedStaleDecorationRead&&Xw(this)&&(this.hasWarnedStaleDecorationRead=!0,console.warn("[tiptap warn]: `editor.state` was read while decoration `create()` was running. It returns the pre-transaction document. Use the `state` argument passed to `create()` instead. Helpers like `editor.isActive()` read `editor.state` too, so pass `state` to their standalone versions instead of calling them on the editor.")),this.editorView&&(this.editorState=this.view.state),this.editorState}registerPlugin(t,e){let n=pa(e)?e(t,[...this.state.plugins]):[...this.state.plugins,t],r=this.state.reconfigure({plugins:n});return this.vi
Line truncated
|
||||
|
||||
`,textSerializers:n={}}=t||{};return ba(this.state.doc,{blockSeparator:e,textSerializers:{...Si(this.schema),...n}})}get isEmpty(){return In(this.state.doc)}destroy(){this.destroyed||(this.destroyed=!0,this.emit("destroy"),this.unmount(),this.removeAllListeners(),this.extensionManager.destroy(),this.extensionManager=null,this.schema=null,this.commandManager=null,this.extensionStorage={})}get isDestroyed(){var t,e;return(t=(e=this.editorView)===null||e===void 0?void 0:e.isDestroyed)!==null&&t!==void 0?t:!0}$node(t,e){var n;return((n=this.$doc)===null||n===void 0?void 0:n.querySelector(t,e))||null}$nodes(t,e){var n;return((n=this.$doc)===null||n===void 0?void 0:n.querySelectorAll(t,e))||null}$pos(t){let e=this.state.doc.resolve(t),n=t>0&&e.nodeAfter&&!e.nodeAfter.isText&&e.nodeAfter.isAtom?e.nodeAfter:null;return new kh(e,this,!1,n)}get $doc(){return this.$pos(0)}},ho=class{static Inline(t,e,n={},r){return new Sh(t,e,n,r)}static Node(t,e,n={},r){return new Ch(t,e,n,r)}static Widget(t,e,n){let{key:r,...o}=n;return new vh(t,e,r,o)}},Sh=class extends ho{constructor(t,e,n={},r){super(),this.kind="inline",this.from=t,this.to=e,this.attrs=n,this.spec=r}get anchor(){return this.from}toPMDecoration(t){let e=t?{...this.spec,extensionName:t}:this.spec;return re.inline(this.from,this.to,this.attrs,e)}},Ch=class extends ho{constructor(t,e,n={},r){super(),this.kind="node",this.from=t,this.to=e,this.attrs=n,this.spec=r}get anchor(){return this.from}toPMDecoration(t){let e=t?{...this.spec,extensionName:t}:this.spec;return re.node(this.from,this.to,this.attrs,e)}},vh=class extends ho{constructor(t,e,n,r){super(),this.kind="widget",this.pos=t,this.render=e,this.key=n,this.spec=r}get anchor(){return this.pos}toPMDecoration(t){let e=t?{...this.spec,key:this.key,extensionName:t}:{...this.spec,key:this.key};return re.widget(this.pos,this.render,e)}};function Lx(t,e){let n=t,r=n[e];if(!r){r={renderers:new Map,props:new Map,pendingProps:new Map,flushScheduled:!1},n[e]=r;let o=r;t.on("destroy",()=>{o.pendingProps.clear(),o.renderers.forEach(i=>i.destroy()),o.renderers.clear(),o.props.clear()})}return r}function Ix(t){t.flushScheduled=!1;for(let[e,n]of t.pendingProps){let r=t.renderers.get(e);r&&(r.updateProps(n),t.props.set(e,{...n}))}t.pendingProps.clear()}function Px(t){let{editor:e,pos:n,key:r,props:o,cacheKey:i,context:s,create:l,materialize:a,side:c,relaxedSide:d,marks:u,stopEvent:f,ignoreSelection:h,destroy:p}=t,g=Lx(e,i);if(g.renderers.has(r)){var m;let w=(m=g.pendingProps.get(r))!==null&&m!==void 0?m:g.props.get(r);(!w||!Ma(w,o))&&(g.pendingProps.set(r,o),g.flushScheduled||(g.flushScheduled=!0,queueMicrotask(()=>Ix(g))))}let y=(w,x)=>{let b={...o,...s(x)},k=g.renderers.get(r);return k?k.updateProps(b):(k=l(b),g.renderers.set(r,k),g.props.set(r,{...o})),a(k)};return ho.Widget(n,y,{key:r,side:c,relaxedSide:d,marks:u,stopEvent:f,ignoreSelection:h,destroy:w=>{if(!Yf(e).has(r))try{var x;(x=g.renderers.get(r))===null||x===void 0||x.destroy(),g.renderers.delete(r),g.props.delete(r),g.pendingProps.delete(r)}finally{p?.(w)}}})}function Ie(t){return new ln({find:t.find,handler:({state:e,range:n,match:r})=>{let o=G(t.getAttributes,void 0,r);if(o===!1||o===null)return null;let{tr:i}=e,s=r[r.length-1],l=r[0];if(s){let a=l.search(/\S/),c=n.from+l.indexOf(s),d=c+s.length;if(ao(n.from,n.to,e.doc).filter(f=>f.mark.type.excluded.find(h=>h===t.type&&h!==f.mark.type)).filter(f=>f.to>c).length)return null;d<n.to&&i.delete(d,n.to),c>n.from&&i.delete(n.from+a,c);let u=n.from+a+s.length;i.addMark(n.from+a,u,t.type.create(o||{})),i.removeStoredMark(t.type)}},undoable:t.undoable})}function po(t){return new ln({find:t.find,handler:({state:e,range:n,match:r})=>{let o=G(t.getAttributes,void 0,r)||{},{tr:i}=e,s=n.from,l=n.to,a=t.type.create(o);if(r[1]){let c=s+r[0].lastIndexOf(r[1]);c>l?c=l:l=c+r[1].length;let d=r[0][r[0].length-1];i.insertText(d,s+r[0].length-1),i.replaceWith(c,l,a)}else if(r[0]){let c=t.type.isInline?s:s-1;i.insert(c,t.type.create(o)).delete(i.mapping.map(s),i.mapping.map(l))}i.scrollIntoView()},undoable:t.undoable})}function br(t){return new ln({find:t.find,handler:({state:e,range:n,match:r})=>{let o=e.doc.resolve(n.from),i=G(t.getAttributes,void 0,r)||{};if(!o.node(-1).canReplaceWith(o.index(-1),o.indexAfter(-1),t.type))return null;e.tr.delete(n.from,n.to).setBlockType(n.from,n.from,t.type,i)},undoable:t.undoable})}function $x(t){return new ln({find:t.find,handler:({state:e,range:n,match:r})=>{let o=t.replace,i=n.from,s=n.to;if(r[1]){let l=r[0].lastIndexOf(r[1]);o+=r[0].slice(l+r[1].length),i+=l;let a=i-s;a>0&&(o=r[0].slice(l-a,l)+o,i=s)}e.tr.insertText(o,i,s)},undoable:t.undoable})}function Vt(t){return new ln({find:t.find,handler:({state:e,range:n,match:r,chain:o})=>{let i=G(t.getAttributes,void 0,r)||{},s=e.tr.delete(n.from,n.to),l=s.doc.resolve(n.from).blockRange(),a=l&&Qn(l,t.type,i);if(!a)return null;if(s.wrap(l,a),t.keepMarks&&t.editor){let{selection:d,storedMarks:u}=e,{splittableMarks:f}=t.editor.extensionManager,h=u||d.$to.
Line truncated
|
||||
`).map(c=>c.trim()===""?n:`${n} ${c}`);r.push(a.join(`
|
||||
`))}),r.join(`
|
||||
${n}
|
||||
`)},addCommands(){return{setBlockquote:()=>({commands:t})=>t.wrapIn(this.name),toggleBlockquote:()=>({commands:t})=>t.toggleWrap(this.name),unsetBlockquote:()=>({commands:t})=>t.lift(this.name)}},addKeyboardShortcuts(){return{"Mod-Shift-b":()=>this.editor.commands.toggleBlockquote(),Backspace:()=>wk(this.editor,this.type)}},addInputRules(){return[Vt({find:xk,type:this.type})]}}),Jh=kk;var Sk=/(?:^|\s)(\*\*(?!\s+\*\*)((?:[^*]+))\*\*(?!\s+\*\*))$/,Ck=/(?:^|\s)(\*\*(?!\s+\*\*)((?:[^*]+))\*\*(?!\s+\*\*))/g,vk=/(?:^|\s)(__(?!\s+__)((?:[^_]+))__(?!\s+__))$/,Mk=/(?:^|\s)(__(?!\s+__)((?:[^_]+))__(?!\s+__))/g,Tk=ie.create({name:"bold",addOptions(){return{HTMLAttributes:{}}},parseHTML(){return[{tag:"strong"},{tag:"b",getAttrs:t=>t.style.fontWeight!=="normal"&&null},{style:"font-weight=400",clearMark:t=>t.type.name===this.name},{style:"font-weight",getAttrs:t=>/^(bold(er)?|[5-9]\d{2,})$/.test(t)&&null}]},renderHTML({HTMLAttributes:t}){return wr("strong",{...L(this.options.HTMLAttributes,t),children:wr("slot",{})})},markdownTokenName:"strong",parseMarkdown:(t,e)=>e.applyMark("bold",e.parseInline(t.tokens||[])),markdownOptions:{htmlReopen:{open:"<strong>",close:"</strong>"}},renderMarkdown:(t,e)=>`**${e.renderChildren(t)}**`,addCommands(){return{setBold:()=>({commands:t})=>t.setMark(this.name),toggleBold:()=>({commands:t})=>t.toggleMark(this.name),unsetBold:()=>({commands:t})=>t.unsetMark(this.name)}},addKeyboardShortcuts(){return{"Mod-b":()=>this.editor.commands.toggleBold(),"Mod-B":()=>this.editor.commands.toggleBold()}},addInputRules(){return[Ie({find:Sk,type:this.type}),Ie({find:vk,type:this.type})]},addPasteRules(){return[Ne({find:Ck,type:this.type}),Ne({find:Mk,type:this.type})]}}),Gh=Tk;var Ak=t=>{let e=/`([^`]+)`(?!`)$/.exec(t);return!e||e.index>0&&t[e.index-1]==="`"?null:{index:e.index,text:e[0],replaceWith:e[1]}},Ek=t=>{let e=/`([^`]+)`(?!`)/g,n=[],r;for(;(r=e.exec(t))!==null;)r.index>0&&t[r.index-1]==="`"||n.push({index:r.index,text:r[0],replaceWith:r[1]});return n},Ok=ie.create({name:"code",addOptions(){return{HTMLAttributes:{}}},excludes:"_",code:!0,exitable:!0,parseHTML(){return[{tag:"code"}]},renderHTML({HTMLAttributes:t}){return["code",L(this.options.HTMLAttributes,t),0]},markdownTokenName:"codespan",parseMarkdown:(t,e)=>e.applyMark("code",[{type:"text",text:t.text||""}]),renderMarkdown:(t,e)=>t.content?`\`${e.renderChildren(t.content)}\``:"",addCommands(){return{setCode:()=>({commands:t})=>t.setMark(this.name),toggleCode:()=>({commands:t})=>t.toggleMark(this.name),unsetCode:()=>({commands:t})=>t.unsetMark(this.name)}},addKeyboardShortcuts(){return{"Mod-e":()=>this.editor.commands.toggleCode()}},addInputRules(){return[Ie({find:Ak,type:this.type})]},addPasteRules(){return[Ne({find:Ek,type:this.type})]}}),Xh=Ok;var ja=4,Nk=/^```([a-z]+)?[\s\n]$/,Rk=/^~~~([a-z]+)?[\s\n]$/,Dk=W.create({name:"codeBlock",addOptions(){return{languageClassPrefix:"language-",exitOnTripleEnter:!0,exitOnArrowDown:!0,exitOnArrowUp:!0,defaultLanguage:null,enableTabIndentation:!1,tabSize:ja,HTMLAttributes:{}}},content:"text*",marks:"",group:"block",code:!0,defining:!0,addAttributes(){return{language:{default:this.options.defaultLanguage,parseHTML:t=>{var e;let{languageClassPrefix:n}=this.options;if(!n)return null;let r=[...((e=t.firstElementChild)===null||e===void 0?void 0:e.classList)||[]].filter(o=>o.startsWith(n)).map(o=>o.replace(n,""))[0];return r||null},rendered:!1}}},parseHTML(){return[{tag:"pre",preserveWhitespace:"full"}]},renderHTML({node:t,HTMLAttributes:e}){return["pre",L(this.options.HTMLAttributes,e),["code",{class:t.attrs.language?this.options.languageClassPrefix+t.attrs.language:null},0]]},markdownTokenName:"code",parseMarkdown:(t,e)=>{var n,r;return((n=t.raw)===null||n===void 0?void 0:n.startsWith("```"))===!1&&((r=t.raw)===null||r===void 0?void 0:r.startsWith("~~~"))===!1&&t.codeBlockStyle!=="indented"?[]:e.createNode("codeBlock",{language:t.lang||null},t.text?[e.createTextNode(t.text)]:[])},renderMarkdown:(t,e)=>{var n;let r="",o=((n=t.attrs)===null||n===void 0?void 0:n.language)||"";return t.content?r=[`\`\`\`${o}`,e.renderChildren(t.content),"```"].join(`
|
||||
`):r=`\`\`\`${o}
|
||||
|
||||
\`\`\``,r},addCommands(){return{setCodeBlock:t=>({commands:e})=>e.setNode(this.name,t),toggleCodeBlock:t=>({commands:e})=>e.toggleNode(this.name,"paragraph",t)}},addKeyboardShortcuts(){return{"Mod-Alt-c":()=>this.editor.commands.toggleCodeBlock(),Backspace:()=>{let{empty:t,$anchor:e}=this.editor.state.selection,n=e.pos===1;return!t||e.parent.type.name!==this.name?!1:n||!e.parent.textContent.length?this.editor.commands.clearNodes():!1},Tab:({editor:t})=>{var e;if(!this.options.enableTabIndentation)return!1;let n=(e=this.options.tabSize)!==null&&e!==void 0?e:ja,{state:r}=t,{selection:o}=r,{$from:i,empty:s}=o;if(i.parent.type!==this.type)return!1;let l=" ".repeat(n);return s?t.commands.insertContent(l):t.commands.command(({tr:a})=>{let{from:c,to:d}=o,u=r.doc.textBetween(c,d,`
|
||||
`,`
|
||||
`).split(`
|
||||
`).map(f=>l+f).join(`
|
||||
`);return a.replaceWith(c,d,r.schema.text(u)),!0})},"Shift-Tab":({editor:t})=>{var e;if(!this.options.enableTabIndentation)return!1;let n=(e=this.options.tabSize)!==null&&e!==void 0?e:ja,{state:r}=t,{selection:o}=r,{$from:i,empty:s}=o;return i.parent.type!==this.type?!1:s?t.commands.command(({tr:l})=>{var a;let{pos:c}=i,d=i.start(),u=i.end(),f=r.doc.textBetween(d,u,`
|
||||
`,`
|
||||
`).split(`
|
||||
`),h=0,p=0,g=c-d;for(let x=0;x<f.length;x+=1){if(p+f[x].length>=g){h=x;break}p+=f[x].length+1}let m=((a=f[h].match(/^ */))===null||a===void 0?void 0:a[0])||"",y=Math.min(m.length,n);if(y===0)return!0;let w=d;for(let x=0;x<h;x+=1)w+=f[x].length+1;return l.delete(w,w+y),c-w<=y&&l.setSelection(R.create(l.doc,w)),!0}):t.commands.command(({tr:l})=>{let{from:a,to:c}=o,d=r.doc.textBetween(a,c,`
|
||||
`,`
|
||||
`).split(`
|
||||
`).map(u=>{var f;let h=((f=u.match(/^ */))===null||f===void 0?void 0:f[0])||"",p=Math.min(h.length,n);return u.slice(p)}).join(`
|
||||
`);return l.replaceWith(a,c,r.schema.text(d)),!0})},Enter:({editor:t})=>{if(!this.options.exitOnTripleEnter)return!1;let{state:e}=t,{selection:n}=e,{$from:r,empty:o}=n;if(!o||r.parent.type!==this.type)return!1;let i=r.parentOffset===r.parent.nodeSize-2,s=r.parent.textContent.endsWith(`
|
||||
|
||||
`);return!i||!s?!1:t.chain().command(({tr:l})=>(l.delete(r.pos-2,r.pos),!0)).exitCode().run()},ArrowUp:({editor:t})=>{if(!this.options.exitOnArrowUp)return!1;let{state:e}=t,{selection:n}=e,{$from:r,empty:o}=n;if(!o||r.parent.type!==this.type||r.parentOffset!==0)return!1;let i=r.before();return i>0?!1:t.commands.insertDefaultBlock({pos:i})},ArrowDown:({editor:t})=>{if(!this.options.exitOnArrowDown)return!1;let{state:e}=t,{selection:n,doc:r}=e,{$from:o,empty:i}=n;if(!i||o.parent.type!==this.type||o.parentOffset!==o.parent.nodeSize-2)return!1;let s=o.after();return s===void 0?!1:r.nodeAt(s)?t.commands.command(({tr:l})=>(l.setSelection(z.near(r.resolve(s))),!0)):t.commands.exitCode()}}},addInputRules(){return[br({find:Nk,type:this.type,getAttributes:t=>({language:t[1]})}),br({find:Rk,type:this.type,getAttributes:t=>({language:t[1]})})]},addProseMirrorPlugins(){return[new F({key:new j("codeBlockVSCodeHandler"),props:{handlePaste:(t,e)=>{if(!e.clipboardData||this.editor.isActive(this.type.name))return!1;let n=e.clipboardData.getData("text/plain"),r=e.clipboardData.getData("vscode-editor-data"),o=r?JSON.parse(r):void 0,i=o?.mode;if(!n||!i)return!1;let{tr:s,schema:l}=t.state,a=l.text(n.replace(/\r\n?/g,`
|
||||
`));return s.replaceSelectionWith(this.type.create({language:i},a)),s.selection.$from.parent.type!==this.type&&s.setSelection(R.near(s.doc.resolve(Math.max(0,s.selection.from-2)))),s.setMeta("paste",!0),t.dispatch(s),!0}}})]}}),Yh=Dk;var Qh=W.create({name:"customBlock",group:"block",atom:!0,defining:!0,draggable:!0,selectable:!0,isolating:!0,allowGapCursor:!0,inline:!1,addNodeView(){return({editor:t,node:e,getPos:n,HTMLAttributes:r,decorations:o,extension:i})=>{let s=document.createElement("div");s.setAttribute("data-config",JSON.stringify(e.attrs.config)),s.setAttribute("data-id",e.attrs.id),s.setAttribute("data-testid","rich-editor-custom-block"),s.setAttribute("data-type","customBlock"),i.options.hasMinimalCustomBlockControls&&e.attrs.preview&&s.classList.add("fi-fo-rich-editor-custom-block-minimal");let l=document.createElement("div");if(l.className="fi-fo-rich-editor-custom-block-header fi-not-prose",s.appendChild(l),t.isEditable&&typeof e.attrs.config=="object"&&e.attrs.config!==null&&Object.keys(e.attrs.config).length>0){let c=document.createElement("div");c.className="fi-fo-rich-editor-custom-block-edit-btn-ctn",l.appendChild(c);let d=document.createElement("button");d.className="fi-icon-btn",d.dataset.testid="rich-editor-custom-block-edit-button",d.type="button",i.options.editCustomBlockButtonLabel&&d.setAttribute("aria-label",i.options.editCustomBlockButtonLabel),d.innerHTML=i.options.editCustomBlockButtonIconHtml,d.addEventListener("click",()=>{t.commands.setNodeSelection(n()),i.options.editCustomBlockUsing(e.attrs.id,e.attrs.config)}),c.appendChild(d)}let a=document.createElement("p");if(a.className="fi-fo-rich-editor-custom-block-heading",a.textContent=e.attrs.label,l.appendChild(a),t.isEditable){let c=document.createElement("div");c.className="fi-fo-rich-editor-custom-block-delete-btn-ctn",l.appendChild(c);let d=document.createElement("button");d.className="fi-icon-btn",d.dataset.testid="rich-editor-custom-block-delete-button",d.type="button",i.options.deleteCustomBlockButtonLabel&&d.setAttribute("aria-label",i.options.deleteCustomBlockButtonLabel),d.innerHTML=i.options.deleteCustomBlockButtonIconHtml,d.addEventListener("click",()=>t.chain().focus().setNodeSelection(n()).deleteSelection().run()),c.appendChild(d)}if(e.attrs.preview){let c=document.createElement("div"),d=["fi-fo-rich-editor-custom-block-preview"];e.attrs.shouldApplyProseStylingToPreview||d.push("fi-not-prose"),c.className=d.join(" "),c.innerHTML=new TextDecoder().decode(Uint8Array.from(atob(e.attrs.preview),u=>u.charCodeAt(0))),s.appendChild(c)}return{dom:s,stopEvent:c=>c.target instanceof Element&&l.contains(c.target.closest("button"))}}},addOptions(){return{deleteCustomBlockButtonIconHtml:null,deleteCustomBlockButtonLabel:null,editCustomBlockButtonIconHtml:null,editCustomBlockButtonLabel:null,editCustomBlockUsing:()=>{},getCustomBlockPreviewsUsing:async()=>[],hasMinimalCustomBlockControls:!1,insertCustomBlockUsing:()=>{}}},addAttributes(){return{config:{default:null,parseHTML:t=>JSON.parse(t.getAttribute("data-config")),renderHTML:t=>t.config?{"data-config":JSON.stringify(t.config)}:{}},id:{default:null,parseHTML:t=>t.getAttribute("data-id"),renderHTML:t=>t.id?{"data-id":t.id}:{}},label:{default:null,parseHTML:()=>null,rendered:!1},preview:{default:null,parseHTML:()=>null,rendered:!1},shouldApplyProseStylingToPreview:{default:!1,parseHTML:()=>!1,rendered:!1}}},parseHTML(){return[{tag:`div[data-type="${this.name}"]`}]},renderHTML({HTMLAttributes:t}){return["div",L({"data-type":"customBlock"},t)]},addKeyboardShortcuts(){return{Backspace:()=>this.editor.commands.command(({state:t})=>{let e=!1,{selection:n}=t,{empty:r,anchor:o}=n;return r?(t.doc.nodesBetween(o-1,o,i=>{if(i.type.name===this.name)return e=!0,!1}),e):!1})}},addProseMirrorPlugins(){let{getCustomBlockPreviewsUsing:t,insertCustomBlockUsing:e}=this.options,n=new Map,r=new Set,o=s=>JSON.stringify([s.attrs.id,s.attrs.config]),i=async s=>{if(this.editor.isDestroyed)return;let l=[],a=[],c=new Map;if(s.state.doc.descendants(u=>{if(u.type.name!==this.name)return;let f=o(u);if(u.attrs.preview!==null){n.set(f,{label:u.attrs.label,preview:u.attrs.preview,shouldApplyProseStylingToPreview:u.attrs.shouldApplyProseStylingToPreview});return}!u.attrs.id||r.has(f)||c.set(f,{config:u.attrs.config,id:u.attrs.id})}),c.forEach((u,f)=>{n.has(f)||(r.add(f),a.push(f),l.push({...u,key:l.length}))}),l.length){let u,f;try{u=await Promise.race([t(l),new Promise((h,p)=>{f=setTimeout(()=>p(new Error("Preview request timed out")),3e4)})])}catch(h){this.editor.isDestroyed||console.error("Failed to hydrate custom block previews",h);return}finally{clearTimeout(f),a.forEach(h=>{r.delete(h)})}if(this.editor.isDestroyed)return;a.forEach(h=>{n.set(h,null)}),u.forEach(h=>{let p=a[h.key];p!==void 0&&n.set(p,{label:h.label,preview:h.preview,shouldApplyProseStylingToPreview:h.shouldApplyProseStylingToPreview})})}let d=s.state.tr;s.state.doc.descendants((u,f)=>{if(u.type.name!==this.name||u.attrs.preview!==null
Line truncated
|
||||
|
||||
`):""}),rp=Ik;var Pk=12,ip=(t,e)=>{let n=dt(t.$from,o=>o.type.name===e),r=t.node?.type.name==="gridColumn"?{node:t.node,pos:t.from,depth:t.$from.depth+1}:dt(t.$from,o=>o.type.name==="gridColumn");return n&&r&&r.depth===n.depth+1?{grid:n,column:r}:null},sp=t=>Math.max(1,Number(t.attrs["data-col-span"])||1),lp=(t,e)=>e?lp(e,t%e):t,$k=t=>{let e=!0;return t.forEach(n=>{sp(n)!==1&&(e=!1)}),e},op=({tr:t,dispatch:e,editor:n,gridNodeName:r,shouldInsertAfter:o})=>{let i=ip(t.selection,r);if(!i||!$k(i.grid.node)||i.grid.node.childCount>=Pk)return!1;if(e){let s=n.schema.nodes.gridColumn.createAndFill({"data-col-span":1}),l=o?i.column.pos+i.column.node.nodeSize:i.column.pos;t.setNodeMarkup(i.grid.pos,void 0,{...i.grid.node.attrs,"data-cols":i.grid.node.childCount+1}).insert(l,s).scrollIntoView()}return!0},ap=W.create({name:"grid",group:"block",defining:!0,isolating:!0,allowGapCursor:!1,content:"gridColumn+",addOptions(){return{HTMLAttributes:{class:"grid-layout"}}},addAttributes(){return{"data-cols":{default:2,parseHTML:t=>t.getAttribute("data-cols")},"data-from-breakpoint":{default:"md",parseHTML:t=>t.getAttribute("data-from-breakpoint")},style:{default:null,parseHTML:t=>t.getAttribute("style"),renderHTML:t=>({style:`--cols: repeat(${Math.max(1,Number(t["data-cols"])||1)}, minmax(0, 1fr))`})}}},parseHTML(){return[{tag:"div",getAttrs:t=>t.classList.contains("grid-layout")&&null}]},renderHTML({HTMLAttributes:t}){return["div",L(this.options.HTMLAttributes,t),0]},addCommands(){return{addGridColumnBefore:()=>({tr:t,dispatch:e,editor:n})=>op({tr:t,dispatch:e,editor:n,gridNodeName:this.name,shouldInsertAfter:!1}),addGridColumnAfter:()=>({tr:t,dispatch:e,editor:n})=>op({tr:t,dispatch:e,editor:n,gridNodeName:this.name,shouldInsertAfter:!0}),deleteGridColumn:()=>({tr:t,dispatch:e})=>{let n=ip(t.selection,this.name);if(!n||n.grid.node.childCount<=1)return!1;if(e){let r=[];n.grid.node.forEach((s,l)=>{let a=n.grid.pos+1+l;a!==n.column.pos&&r.push({column:s,position:a,span:sp(s)})});let o=r.map(s=>s.span).reduce(lp),i=r.reduce((s,l)=>s+l.span/o,0);r.forEach(({column:s,position:l,span:a})=>{t.setNodeMarkup(l,void 0,{...s.attrs,"data-col-span":a/o})}),t.setNodeMarkup(n.grid.pos,void 0,{...n.grid.node.attrs,"data-cols":i}).delete(n.column.pos,n.column.pos+n.column.node.nodeSize).setSelection(R.near(t.doc.resolve(n.column.pos))).scrollIntoView()}return!0},deleteGrid:()=>({tr:t,dispatch:e})=>{let n=dt(t.selection.$from,r=>r.type.name===this.name);if(!n)return!1;if(e){let r=[];n.node.forEach(o=>{o.forEach(i=>r.push(i))}),t.replaceWith(n.pos,n.pos+n.node.nodeSize,r).setSelection(R.near(t.doc.resolve(n.pos))).scrollIntoView()}return!0},insertGrid:({columns:t=[1,1],fromBreakpoint:e,coordinates:n=null}={})=>({tr:r,dispatch:o,editor:i})=>{let s=i.schema.nodes.gridColumn,l=Array.isArray(t)&&t.length?t:[1,1],a=[];for(let u=0;u<l.length;u+=1)a.push(s.createAndFill({"data-col-span":Number(l[u]??1)||1}));let c=l.map(u=>Number(u)||1).reduce((u,f)=>u+f,0),d=i.schema.nodes.grid.createChecked({"data-cols":c,"data-from-breakpoint":e},a);if(o){let u=r.selection.anchor+1;[null,void 0].includes(n?.from)?r.replaceSelectionWith(d).scrollIntoView().setSelection(R.near(r.doc.resolve(u))):r.replaceRangeWith(n.from,n.to,d).scrollIntoView().setSelection(R.near(r.doc.resolve(n.from)))}return!0}}}});var cp=W.create({name:"gridColumn",content:"block+",isolating:!0,addOptions(){return{HTMLAttributes:{class:"grid-layout-col"}}},addAttributes(){return{"data-col-span":{default:1,parseHTML:t=>t.getAttribute("data-col-span"),renderHTML:t=>({"data-col-span":t["data-col-span"]??1})},style:{default:null,parseHTML:t=>t.getAttribute("style"),renderHTML:t=>{let e=Math.max(1,Number(t["data-col-span"])||1);return{style:`--col-span: span ${e} / span ${e}`}}}}},parseHTML(){return[{tag:"div",getAttrs:t=>t.classList.contains("grid-layout-col")&&null}]},renderHTML({HTMLAttributes:t}){return["div",L(this.options.HTMLAttributes,t),0]}});var Bk=W.create({name:"hardBreak",markdownTokenName:"br",addOptions(){return{keepMarks:!0,HTMLAttributes:{}}},inline:!0,group:"inline",selectable:!1,linebreakReplacement:!0,parseHTML(){return[{tag:"br"}]},renderHTML({HTMLAttributes:t}){return["br",L(this.options.HTMLAttributes,t)]},renderText(){return`
|
||||
`},renderMarkdown:()=>`
|
||||
`,parseMarkdown:()=>({type:"hardBreak"}),addCommands(){return{setHardBreak:()=>({commands:t,chain:e,state:n,editor:r})=>t.first([()=>t.exitCode(),()=>t.command(()=>{let{selection:o,storedMarks:i}=n;if(o.$from.parent.type.spec.isolating)return!1;let{keepMarks:s}=this.options,{splittableMarks:l}=r.extensionManager,a=i||o.$to.parentOffset&&o.$from.marks();return e().insertContent({type:this.name}).command(({tr:c,dispatch:d})=>{if(d&&a&&s){let u=a.filter(f=>l.includes(f.type.name));c.ensureMarks(u)}return!0}).scrollIntoView().run()})])}},addKeyboardShortcuts(){return{"Mod-Enter":()=>this.editor.commands.setHardBreak(),"Shift-Enter":()=>this.editor.commands.setHardBreak()}}}),dp=Bk;var zk=W.create({name:"heading",addOptions(){return{levels:[1,2,3,4,5,6],HTMLAttributes:{}}},content:"inline*",group:"block",defining:!0,addAttributes(){return{level:{default:1,rendered:!1}}},parseHTML(){return this.options.levels.map(t=>({tag:`h${t}`,attrs:{level:t}}))},renderHTML({node:t,HTMLAttributes:e}){return[`h${this.options.levels.includes(t.attrs.level)?t.attrs.level:this.options.levels[0]}`,L(this.options.HTMLAttributes,e),0]},parseMarkdown:(t,e)=>e.createNode("heading",{level:t.depth||1},e.parseInline(t.tokens||[])),renderMarkdown:(t,e)=>{var n;let r=!((n=t.attrs)===null||n===void 0)&&n.level?parseInt(t.attrs.level,10):1,o="#".repeat(r);return t.content?`${o} ${e.renderChildren(t.content)}`:""},addCommands(){return{setHeading:t=>({commands:e})=>this.options.levels.includes(t.level)?e.setNode(this.name,t):!1,toggleHeading:t=>({commands:e})=>this.options.levels.includes(t.level)?e.toggleNode(this.name,"paragraph",t):!1}},addKeyboardShortcuts(){return this.options.levels.reduce((t,e)=>({...t,[`Mod-Alt-${e}`]:()=>this.editor.commands.toggleHeading({level:e})}),{})},addInputRules(){return this.options.levels.map(t=>br({find:new RegExp(`^(#{${Math.min(...this.options.levels)},${t}})\\s$`),type:this.type,getAttributes:{level:t}}))}}),up=zk;var Hk=/(?:^|\s)(==(?!\s+==)((?:[^=]+))==(?!\s+==))$/,Fk=/(?:^|\s)(==(?!\s+==)((?:[^=]+))==(?!\s+==))/g,Vk=ie.create({name:"highlight",addOptions(){return{multicolor:!1,HTMLAttributes:{}}},addAttributes(){return this.options.multicolor?{color:{default:null,parseHTML:t=>t.getAttribute("data-color")||Ea(t,"background-color")||t.style.backgroundColor,renderHTML:t=>t.color?{"data-color":t.color,style:`background-color: ${t.color}; color: inherit`}:{}}}:{}},parseHTML(){return[{tag:"mark"}]},renderHTML({HTMLAttributes:t}){return["mark",L(this.options.HTMLAttributes,t),0]},renderMarkdown:(t,e)=>`==${e.renderChildren(t)}==`,parseMarkdown:(t,e)=>e.applyMark("highlight",e.parseInline(t.tokens||[])),markdownTokenizer:{name:"highlight",level:"inline",start:t=>t.indexOf("=="),tokenize(t,e,n){let r=/^(==)([^=]+)(==)/.exec(t);if(r){let o=r[2].trim(),i=n.inlineTokens(o);return{type:"highlight",raw:r[0],text:o,tokens:i}}}},addCommands(){return{setHighlight:t=>({commands:e})=>e.setMark(this.name,t),toggleHighlight:t=>({commands:e})=>e.toggleMark(this.name,t),unsetHighlight:()=>({commands:t})=>t.unsetMark(this.name)}},addKeyboardShortcuts(){return{"Mod-Shift-h":()=>this.editor.commands.toggleHighlight()}},addInputRules(){return[Ie({find:Hk,type:this.type})]},addPasteRules(){return[Ne({find:Fk,type:this.type})]}}),fp=Vk;var Wk=W.create({name:"horizontalRule",addOptions(){return{HTMLAttributes:{},nextNodeType:"paragraph"}},group:"block",parseHTML(){return[{tag:"hr"}]},renderHTML({HTMLAttributes:t}){return["hr",L(this.options.HTMLAttributes,t)]},markdownTokenName:"hr",parseMarkdown:(t,e)=>e.createNode("horizontalRule"),renderMarkdown:()=>"---",addCommands(){return{setHorizontalRule:()=>({chain:t,state:e})=>{if(!Ta(e,e.schema.nodes[this.name]))return!1;let{selection:n}=e,{$to:r}=n,o=t();return co(n)?o.insertContentAt(r.pos,{type:this.name}):o.insertContent({type:this.name}),o.command(({state:i,tr:s,dispatch:l})=>{if(l){let{$to:a}=s.selection,c=a.end();if(a.nodeAfter)a.nodeAfter.isTextblock?s.setSelection(R.create(s.doc,a.pos+1)):a.nodeAfter.isBlock?s.setSelection($.create(s.doc,a.pos)):s.setSelection(R.create(s.doc,a.pos));else{let d=i.schema.nodes[this.options.nextNodeType]||a.parent.type.contentMatch.defaultType,u=d?.create();u&&(s.insert(c,u),s.setSelection(R.create(s.doc,c+1)))}s.scrollIntoView()}return!0}).run()}}},addInputRules(){return[po({find:/^(?:---|—-|___\s|\*\*\*\s)$/,type:this.type})]}}),hp=Wk;var jk=/(?:^|\s)(\*(?!\s+\*)((?:[^*]+))\*(?!\s+\*))$/,_k=/(?:^|\s)(\*(?!\s+\*)((?:[^*]+))\*(?!\s+\*))/g,Uk=/(?:^|\s)(_(?!\s+_)((?:[^_]+))_(?!\s+_))$/,Kk=/(?:^|\s)(_(?!\s+_)((?:[^_]+))_(?!\s+_))/g,qk=ie.create({name:"italic",addOptions(){return{HTMLAttributes:{}}},parseHTML(){return[{tag:"em"},{tag:"i",getAttrs:t=>t.style.fontStyle!=="normal"&&null},{style:"font-style=normal",clearMark:t=>t.type.name===this.name},{style:"font-style=italic"}]},renderHTML({HTMLAttributes:t}){return["em",L(this.options.HTMLAttributes,t),0]},addCommands(){return{setItalic:()=>({commands:t})=>t.setMark(this.name),toggleItalic:()=>({co
Line truncated
|
||||
`,nS="\uFE0F",rS="\u200D",Ja="\uFFFC",$i=null,Bi=null;function oS(t=[]){let e={};Be.groups=e;let n=new Be;$i==null&&($i=kp(Xk)),Bi==null&&(Bi=kp(Yk)),T(n,"'",ts),T(n,"{",xo),T(n,"}",ko),T(n,"[",Fi),T(n,"]",Vi),T(n,"(",Wi),T(n,")",ji),T(n,"<",_i),T(n,">",Ui),T(n,"\uFF08",Ki),T(n,"\uFF09",qi),T(n,"\u300C",Ji),T(n,"\u300D",Gi),T(n,"\u300E",Xi),T(n,"\u300F",Yi),T(n,"\uFF1C",Qi),T(n,"\uFF1E",Zi),T(n,"&",es),T(n,"*",ns),T(n,"@",cn),T(n,"`",is),T(n,"^",ss),T(n,":",Hn),T(n,",",sc),T(n,"$",ls),T(n,".",Ct),T(n,"=",as),T(n,"!",lc),T(n,"-",Qe),T(n,"%",So),T(n,"|",cs),T(n,"+",ds),T(n,"#",us),T(n,"?",Co),T(n,'"',ac),T(n,"/",vt),T(n,";",cc),T(n,"~",vo),T(n,"_",fs),T(n,"\\",rs),T(n,"\u30FB",Ap);let r=le(n,jt,oc,{[Xa]:!0});le(r,jt,r);let o=le(r,Wt,Mp,{[wo]:!0}),i=le(r,yo,Tp,{[bo]:!0}),s=le(n,Wt,_t,{[Ya]:!0});le(s,jt,o),le(s,Wt,s),le(o,jt,o),le(o,Wt,o);let l=le(n,yo,ec,{[Qa]:!0});le(l,Wt),le(l,jt,i),le(l,yo,l),le(i,jt,i),le(i,Wt),le(i,yo,i);let a=T(n,qa,ic,{[_a]:!0}),c=T(n,xp,rc,{[_a]:!0}),d=le(n,Ka,rc,{[_a]:!0});T(n,Ja,d),T(c,qa,a),T(c,Ja,d),le(c,Ka,d),T(d,xp),T(d,qa),le(d,Ka,d),T(d,Ja,d);let u=le(n,Ua,Ep,{[vp]:!0});T(u,"#"),le(u,Ua,u),T(u,nS,u);let f=T(u,rS);T(f,"#"),le(f,Ua,u);let h=[[Wt,s],[jt,o]],p=[[Wt,null],[yo,l],[jt,i]];for(let g=0;g<$i.length;g++)an(n,$i[g],tc,_t,h);for(let g=0;g<Bi.length;g++)an(n,Bi[g],nc,ec,p);zn(tc,{tld:!0,ascii:!0},e),zn(nc,{utld:!0,alpha:!0},e),an(n,"file",Hi,_t,h),an(n,"mailto",Hi,_t,h),an(n,"http",xr,_t,h),an(n,"https",xr,_t,h),an(n,"ftp",xr,_t,h),an(n,"ftps",xr,_t,h),zn(Hi,{scheme:!0,ascii:!0},e),zn(xr,{slashscheme:!0,ascii:!0},e),t=t.sort((g,m)=>g[0]>m[0]?1:-1);for(let g=0;g<t.length;g++){let m=t[g][0],w=t[g][1]?{[Qk]:!0}:{[Zk]:!0};m.indexOf("-")>=0?w[Za]=!0:Wt.test(m)?jt.test(m)?w[wo]=!0:w[Ya]=!0:w[Xa]=!0,wp(n,m,m,w)}return wp(n,"localhost",Mo,{ascii:!0}),n.jd=new Be(hs),{start:n,tokens:Object.assign({groups:e},Op)}}function Np(t,e){let n=iS(e.replace(/[A-Z]/g,l=>l.toLowerCase())),r=n.length,o=[],i=0,s=0;for(;s<r;){let l=t,a=null,c=0,d=null,u=-1,f=-1;for(;s<r&&(a=l.go(n[s]));)l=a,l.accepts()?(u=0,f=0,d=l):u>=0&&(u+=n[s].length,f++),c+=n[s].length,i+=n[s].length,s++;i-=u,s-=f,c-=u,o.push({t:d.t,v:e.slice(i-c,i),s:i-c,e:i})}return o}function iS(t){let e=[],n=t.length,r=0;for(;r<n;){let o=t.charCodeAt(r),i,s=o<55296||o>56319||r+1===n||(i=t.charCodeAt(r+1))<56320||i>57343?t[r]:t.slice(r,r+2);e.push(s),r+=s.length}return e}function an(t,e,n,r,o){let i,s=e.length;for(let l=0;l<s-1;l++){let a=e[l];t.j[a]?i=t.j[a]:(i=new Be(r),i.jr=o.slice(),t.j[a]=i),t=i}return i=new Be(n),i.jr=o.slice(),t.j[e[s-1]]=i,i}function kp(t){let e=[],n=[],r=0,o="0123456789";for(;r<t.length;){let i=0;for(;o.indexOf(t[r+i])>=0;)i++;if(i>0){e.push(n.join(""));for(let s=parseInt(t.substring(r,r+i),10);s>0;s--)n.pop();r+=i}else n.push(t[r]),r++}return e}var To={defaultProtocol:"http",events:null,format:Sp,formatHref:Sp,nl2br:!1,tagName:"a",target:null,rel:null,validate:!0,truncate:1/0,className:null,attributes:null,ignoreTags:[],render:null};function dc(t,e=null){let n=Object.assign({},To);t&&(n=Object.assign(n,t instanceof dc?t.o:t));let r=n.ignoreTags,o=[];for(let i=0;i<r.length;i++)o.push(r[i].toUpperCase());this.o=n,e&&(this.defaultRender=e),this.ignoreTags=o}dc.prototype={o:To,ignoreTags:[],defaultRender(t){return t},check(t){return this.get("validate",t.toString(),t)},get(t,e,n){let r=e!=null,o=this.o[t];return o&&(typeof o=="object"?(o=n.t in o?o[n.t]:To[t],typeof o=="function"&&r&&(o=o(e,n))):typeof o=="function"&&r&&(o=o(e,n.t,n)),o)},getObj(t,e,n){let r=this.o[t];return typeof r=="function"&&e!=null&&(r=r(e,n.t,n)),r},render(t){let e=t.render(this);return(this.get("render",null,t)||this.defaultRender)(e,t.t,t)}};function Sp(t){return t}function Rp(t,e){this.t="token",this.v=t,this.tk=e}Rp.prototype={isLink:!1,toString(){return this.v},toHref(t){return this.toString()},toFormattedString(t){let e=this.toString(),n=t.get("truncate",e,this),r=t.get("format",e,this);return n&&r.length>n?r.substring(0,n)+"\u2026":r},toFormattedHref(t){return t.get("formatHref",this.toHref(t.get("defaultProtocol")),this)},startIndex(){return this.tk[0].s},endIndex(){return this.tk[this.tk.length-1].e},toObject(t=To.defaultProtocol){return{type:this.t,value:this.toString(),isLink:this.isLink,href:this.toHref(t),start:this.startIndex(),end:this.endIndex()}},toFormattedObject(t){return{type:this.t,value:this.toFormattedString(t),isLink:this.isLink,href:this.toFormattedHref(t),start:this.startIndex(),end:this.endIndex()}},validate(t){return t.get("validate",this.toString(),this)},render(t){let e=this,n=this.toHref(t.get("defaultProtocol")),r=t.get("formatHref",n,this),o=t.get("tagName",n,e),i=this.toFormattedString(t),s={},l=t.get("className",n,e),a=t.get("target",n,e),c=t.get("rel",n,e),d=t.getObj("attributes",n,e),u=t.getObj("events",n,e);return s.href=r,l&&(s.class=l),a&&(s.target=a),c&&(s.rel=c),d&&Object.assign(s,d),{tagName:o,attributes:s,content:i,eventListeners:u}}};function ps(t,e){class n extends Rp{constructor(o,i){super(o,i),thLine truncated
|
||||
1. Must only contain digits, lowercase ASCII letters or "-"
|
||||
2. Cannot start or end with "-"
|
||||
3. "-" cannot repeat`);oe.customSchemes.push([t,e])}function fS(){oe.scanner=oS(oe.customSchemes);for(let t=0;t<oe.tokenQueue.length;t++)oe.tokenQueue[t][1]({scanner:oe.scanner});oe.parser=aS(oe.scanner.tokens);for(let t=0;t<oe.pluginQueue.length;t++)oe.pluginQueue[t][1]({scanner:oe.scanner,parser:oe.parser});return oe.initialized=!0,oe}function ms(t){return oe.initialized||fS(),cS(oe.parser.start,t,Np(oe.scanner.start,t))}ms.scan=Np;function fc(t,e=null,n=null){if(e&&typeof e=="object"){if(n)throw Error(`linkifyjs: Invalid link type ${e}; must be a string`);n=e,e=null}let r=new dc(n),o=ms(t),i=[];for(let s=0;s<o.length;s++){let l=o[s];l.isLink&&(!e||l.t===e)&&r.check(l)&&i.push(l.toFormattedObject(r))}return i}var hc="[\0- \xA0\u1680\u180E\u2000-\u2029\u205F\u3000]",hS=new RegExp(hc),pS=new RegExp(`${hc}$`),mS=new RegExp(hc,"g");function gS(t){return t.length===1?t[0].isLink:t.length===3&&t[1].isLink?["()","[]"].includes(t[0].value+t[2].value):!1}function yS(t){return new F({key:new j("autolink"),appendTransaction:(e,n,r)=>{let o=e.some(a=>a.docChanged)&&!n.doc.eq(r.doc),i=e.some(a=>a.getMeta("preventAutolink"));if(!o||i)return;let{tr:s}=r,l=bi(n.doc,[...e]);if(Ln(l).forEach(({newRange:a})=>{let c=ha(r.doc,a,f=>f.isTextblock),d,u;if(c.length>1)d=c[0],u=r.doc.textBetween(d.pos,d.pos+d.node.nodeSize,void 0," ");else if(c.length){let f=r.doc.textBetween(a.from,a.to," "," ");if(!pS.test(f))return;d=c[0],u=r.doc.textBetween(d.pos,a.to,void 0," ")}if(d&&u){let f=u.split(hS).filter(Boolean);if(f.length<=0)return!1;let h=f[f.length-1],p=d.pos+u.lastIndexOf(h);if(!h)return!1;let g=ms(h).map(m=>m.toObject(t.defaultProtocol));if(!gS(g))return!1;g.filter(m=>m.isLink).map(m=>({...m,from:p+m.start+1,to:p+m.end+1})).filter(m=>r.schema.marks.code?!r.doc.rangeHasMark(m.from,m.to,r.schema.marks.code):!0).filter(m=>t.validate(m.value)).filter(m=>t.shouldAutoLink(m.value)).forEach(m=>{ao(m.from,m.to,r.doc).some(y=>y.mark.type===t.type)||s.addMark(m.from,m.to,t.type.create({href:m.href}))})}}),!!s.steps.length)return s}})}function bS(t){return new F({key:new j("handleClickLink"),props:{handleClick:(e,n,r)=>{if(r.button!==0||!e.editable)return!1;let o=null;if(r.target instanceof HTMLAnchorElement)o=r.target;else{let a=r.target;if(!a)return!1;let c=t.editor.view.dom;o=a.closest("a"),o&&!c.contains(o)&&(o=null)}if(!o)return!1;let i=!1;if(t.enableClickSelection&&(i=t.editor.commands.extendMarkRange(t.type.name)),t.openOnClick){var s,l;let a=Ci(e.state,t.type.name),c=(s=o.href)!==null&&s!==void 0?s:a.href,d=(l=o.target)!==null&&l!==void 0?l:a.target;c&&(window.open(c,d),i=!0)}return i}}})}var wS=/\[([^[\]]+)\]\(((?:[^\s()]|\([^\s()]*\))+)(?:\s+(?:(["'])(.*?)\3|“(.*?)”|‘(.*?)’))?\)$/,xS=/\[([^[\]]+)\]\(((?:[^\s()]|\([^\s()]*\))+)(?:\s+(?:(["'])(.*?)\3|“(.*?)”|‘(.*?)’))?\)/g;function Lp(t,e){let n=0;for(let r=e-1;r>=0&&t[r]==="\\";r-=1)n+=1;return n%2===1}function kS(t,e){let n=0,r=0;for(;r<e;){if(t[r]!=="`"){r+=1;continue}if(n===0&&Lp(t,r)){r+=1;continue}let o=0;for(;r<e&&t[r]==="`";)o+=1,r+=1;n===0?n=o:o===n&&(n=0)}return n>0}function Ip(t,e,n){var r,o;let[,i,s]=e;return(e.index?t[e.index-1]:void 0)==="!"||Lp(t,(r=e.index)!==null&&r!==void 0?r:0)||kS(t,(o=e.index)!==null&&o!==void 0?o:0)?!1:!!i.trim()&&n(s)}function Pp(t){var e,n;let[r,o,i,,s,l,a]=t,c=(e=s??l)!==null&&e!==void 0?e:a;return{index:(n=t.index)!==null&&n!==void 0?n:0,text:r,replaceWith:o,data:{href:i,title:c||null,markdown:!0}}}function SS(t,e){return t.index<e.index+e.text.length&&e.index<t.index+t.text.length}function $p(t){var e,n,r;return{href:(e=t.data)===null||e===void 0?void 0:e.href,title:(n=(r=t.data)===null||r===void 0?void 0:r.title)!==null&&n!==void 0?n:null}}function CS(t){let e=Ie({find:n=>{let r=wS.exec(n);return!r||!Ip(n,r,t.isAllowedHref)?null:Pp(r)},type:t.type,getAttributes:$p});return new ln({find:e.find,handler:n=>{let r=e.handler(n);return r!==null&&n.state.tr.steps.length&&n.state.tr.setMeta("preventAutolink",!0),r}})}function vS(t){let e=Ne({find:n=>{var r,o;let i=[];for(let l of n.matchAll(xS))Ip(n,l,t.isAllowedHref)&&i.push(Pp(l));let s=((r=(o=t.findPlainUrls)===null||o===void 0?void 0:o.call(t,n))!==null&&r!==void 0?r:[]).filter(l=>!i.some(a=>SS(a,l)));return[...i,...s]},type:t.type,getAttributes:$p});return new yr({find:e.find,handler:n=>{var r;let o=e.handler(n);return o!==null&&n.state.tr.steps.length&&(!((r=n.match.data)===null||r===void 0)&&r.markdown)&&n.state.tr.setMeta("preventAutolink",!0),o}})}function MS(t){return new F({key:new j("handlePasteLink"),props:{handlePaste:(e,n,r)=>{let{shouldAutoLink:o}=t,{state:i}=e,{selection:s}=i,{empty:l}=s;if(l)return!1;let a="";r.content.forEach(d=>{a+=d.textContent});let c=fc(a,{defaultProtocol:t.defaultProtocol}).find(d=>d.isLink&&d.value===a);return!a||!c||o!==void 0&&!o(c.value)?!1:t.editor.commands.setMark(t.type,{href:c.href})}}})}function Ut(t,e){let n=["http","https","ftp","ftps","mailto","tel","callto","sms","cid","xmpp"];return e&&e.forEach(r=>{let o=typeof r=="string"?
Line truncated
|
||||
`):"",markdownOptions:{indentsContent:!0},addCommands(){return{toggleBulletList:()=>({commands:t,chain:e})=>this.options.keepAttributes?e().toggleList(this.name,this.options.itemTypeName,this.options.keepMarks).updateAttributes(AS,this.editor.getAttributes(zp)).run():t.toggleList(this.name,this.options.itemTypeName,this.options.keepMarks)}},addKeyboardShortcuts(){return{"Mod-Shift-8":()=>this.editor.commands.toggleBulletList()}},addInputRules(){let t=Vt({find:Hp,type:this.type});return(this.options.keepMarks||this.options.keepAttributes)&&(t=Vt({find:Hp,type:this.type,keepMarks:this.options.keepMarks,keepAttributes:this.options.keepAttributes,getAttributes:()=>this.editor.getAttributes(zp),editor:this.editor})),[t]}}),ES=(t,e,n)=>{let{selection:r}=t;if(!r.empty)return null;let{$from:o}=r;if(!o.parent.isTextblock||o.parentOffset!==o.parent.content.size)return null;let i=-1;for(let h=o.depth;h>0;h-=1)if(o.node(h).type.name===e){i=h;break}if(i<0)return null;let s=o.node(i),l=o.index(i);if(l+1>=s.childCount)return null;let a=s.child(l+1);if(!n.includes(a.type.name))return null;let c=t.schema.nodes[e],d=!1;if(a.forEach(h=>{h.type===c&&h.childCount>1&&(d=!0)}),!d)return null;let u=t.doc.resolve(o.after()).nodeAfter;if(!u||!n.includes(u.type.name))return null;let f=[];return u.forEach(h=>{f.push(h)}),f.length===0?null:{listItemDepth:i,nestedList:u,nestedListPos:o.after(),insertPos:o.after(i),items:f}},OS=(t,e,n,r)=>{let o=ES(t,n,r);if(!o)return!1;let{selection:i}=t,{nestedList:s,nestedListPos:l,insertPos:a,items:c}=o,d=t.tr;d.delete(l,l+s.nodeSize);let u=d.mapping.map(a);return d.insert(u,S.from(c)),d.setSelection(i.map(d.doc,d.mapping)),e&&e(d),!0},NS=(t,e,n)=>OS(t.state,t.view.dispatch,e,n),Up=(t,e)=>Z.create({name:`${t}BranchingDeleteKeymap`,priority:101,addKeyboardShortcuts(){let n=()=>NS(this.editor,t,e);return{Delete:n,"Mod-Delete":n}}}),Kp=[[1e3,"m"],[900,"cm"],[500,"d"],[400,"cd"],[100,"c"],[90,"xc"],[50,"l"],[40,"xl"],[10,"x"],[9,"ix"],[5,"v"],[4,"iv"],[1,"i"]],gs="abcdefghijklmnopqrstuvwxyz",qp=String.raw`\d+|[ivxlcdmIVXLCDM]+|${"[a-zA-Z]{1,2}"}`;function bs(t){let e=t,n="";for(let[r,o]of Kp)for(;e>=r;)n+=o,e-=r;return n}function gc(t){return bs(t).toUpperCase()}function Jp(t){let e=t.toLowerCase(),n=0,r=0;for(;n<e.length;){let o=!1;for(let[i,s]of Kp)if(e.startsWith(s,n)){r+=i,n+=s.length,o=!0;break}if(!o)return 0}return r}function RS(t){if(!/^[ivxlcdmIVXLCDM]+$/.test(t))return!1;let e=Jp(t);return e<=0?!1:(t===t.toLowerCase()?bs(e):gc(e))===t}function DS(t){let e=t.toLowerCase();if(e.length===1)return e.charCodeAt(0)-97+1;if(e.length===2){let n=e.charCodeAt(0)-97,r=e.charCodeAt(1)-97;return(n+1)*26+r+1}return 0}function ys(t){if(t<=26)return gs[t-1];let e=Math.floor((t-1)/26)-1,n=(t-1)%26;return e<0?gs[n]:gs[e]+gs[n]}function ws(t){if(!(!t||/^\d+$/.test(t))){if(RS(t))return t===t.toLowerCase()?"i":"I";if(/^[a-z]{1,2}$/.test(t))return"a";if(/^[A-Z]{1,2}$/.test(t))return"A"}}function yc(t){if(/^\d+$/.test(t))return parseInt(t,10);let e=ws(t);if(e==="i"||e==="I")return Jp(t);if(e==="a"||e==="A"){let r=DS(t);return r>0?r:1}let n=parseInt(t,10);return Number.isNaN(n)?1:n}function LS(t,e){if(t==="numeric")return String(e);switch(t){case"a":return ys(e);case"A":return ys(e).toUpperCase();case"i":return bs(e);case"I":return gc(e);default:return String(e)}}function IS(t){var e;if(t.length===0)return!1;let n=(e=ws(t[0]))!==null&&e!==void 0?e:"numeric",r=yc(t[0]);if(r<1)return!1;for(let o=0;o<t.length;o++){let i=LS(n,r+o);if(t[o]!==i)return!1}return!0}function PS(t){return{type:ws(t),start:yc(t)}}function $S(t){let{type:e,start:n}=PS(t),r={};return e&&(r.type=e),n!==1&&(r.start=n),r}function BS(t,e,n=". "){let r=e+1;if(!t||t==="1")return`${r}${n}`;switch(t){case"a":return`${ys(r)}${n}`;case"A":return`${ys(r).toUpperCase()}${n}`;case"i":return`${bs(r)}${n}`;case"I":return`${gc(r)}${n}`;default:return`${r}${n}`}}function zS(t){var e,n;let r=(e=t.tokens)===null||e===void 0?void 0:e[0];return!!(t.text&&((n=t.tokens)===null||n===void 0?void 0:n.length)===1&&r?.type==="list"&&r.ordered&&r.raw===t.text)}function HS(t,e){return e.tokenizeInline?e.parseInline(e.tokenizeInline(t)):e.parseInline([{type:"text",raw:t,text:t}])}var bc=W.create({name:"listItem",addOptions(){return{HTMLAttributes:{},bulletListTypeName:"bulletList",orderedListTypeName:"orderedList"}},content:"paragraph block*",defining:!0,parseHTML(){return[{tag:"li"}]},renderHTML({HTMLAttributes:t}){return["li",L(this.options.HTMLAttributes,t),0]},markdownTokenName:"list_item",parseMarkdown:(t,e)=>{var n;if(t.type!=="list_item")return[];let r=(n=e.parseBlockChildren)!==null&&n!==void 0?n:e.parseChildren,o=[];if(t.tokens&&t.tokens.length>0){if(zS(t))return{type:"listItem",content:[{type:"paragraph",content:HS(t.text||"",e)}]};if(t.tokens.some(i=>i.type==="paragraph"))o=r(t.tokens);else{let i=t.tokens[0];if(i&&i.type==="text"&&i.tokens&&i.tokens.length>0){if(o=[{type:"paragraph",content:e.parseInline(i.tokens)}],t.tokens.length>1){let s=r(t.tokens.slice(1));o.push
Line truncated
|
||||
`).trim(),contentLines:p,raw:m.join(`
|
||||
`)}),r=g,n=g}return[e,r]}var YS=new RegExp(`^(${qp})([.)])\\s+(.+)$`);function QS(t){let e=t.split(`
|
||||
`).filter(r=>r.trim().length>0);if(e.length===0)return null;let n=[];for(let r of e){let o=r.trim().match(YS);if(!o)return null;n.push({marker:o[1],content:o[3]})}return IS(n.map(r=>r.marker))?{type:"orderedList",attrs:$S(n[0].marker),content:n.map(r=>({type:"listItem",content:[{type:"paragraph",content:[{type:"text",text:r.content}]}]}))}:null}function Xp(t,e,n){let r=[],o=0;for(;o<t.length;){let i=t[o];if(i.indent===e){let{paragraphLines:s,blockLines:l}=GS(i.contentLines),a=s.join(`
|
||||
`).trim(),c=[];a&&c.push({type:"paragraph",raw:a,tokens:n.inlineTokens(a)});let d=l.join(`
|
||||
`).trim();if(d){let h=n.blockTokens(d);c.push(...h)}let u=o+1,f=[];for(;u<t.length&&t[u].indent>e;)f.push(t[u]),u+=1;if(f.length>0){let h=Xp(f,Math.min(...f.map(p=>p.indent)),n);c.push({type:"list",ordered:!0,start:f[0].number,typeMarker:f[0].type,items:h,raw:f.map(p=>p.raw).join(`
|
||||
`)})}r.push({type:"list_item",raw:i.raw,tokens:c}),o=u}else o+=1}return r}function ZS(t,e){return t.map(n=>{if(n.type!=="list_item")return e.parseChildren([n])[0];let r=[];return n.tokens&&n.tokens.length>0&&n.tokens.forEach(o=>{if(o.type==="paragraph"||o.type==="list"||o.type==="blockquote"||o.type==="code")r.push(...e.parseChildren([o]));else if(o.type==="text"&&o.tokens){let i=e.parseChildren([o]);r.push({type:"paragraph",content:i})}else{let i=e.parseChildren([o]);i.length>0&&r.push(...i)}}),{type:"listItem",content:r}})}var e1="listItem",Wp="textStyle",jp=/^(\d+)\.\s$/;function _p(t){let e=t.match(/list-style-type\s*:\s*([^;]+)/i);if(!e)return null;switch(e[1].trim().toLowerCase()){case"upper-roman":return"I";case"lower-roman":return"i";case"upper-alpha":case"upper-latin":return"A";case"lower-alpha":case"lower-latin":return"a";default:return null}}var xc=W.create({name:"orderedList",addOptions(){return{itemTypeName:"listItem",HTMLAttributes:{},keepMarks:!1,keepAttributes:!1}},group:"block list",content(){return`${this.options.itemTypeName}+`},addAttributes(){return{start:{default:1,parseHTML:t=>t.hasAttribute("start")?parseInt(t.getAttribute("start")||"",10):1},type:{default:null,parseHTML:t=>{let e=t.getAttribute("type");if(e)return e;let n=t.getAttribute("style");if(n){let o=_p(n);if(o)return o}let r=t.querySelector("li");if(r){let o=r.getAttribute("style");if(o){let i=_p(o);if(i)return i}}return null}}}},parseHTML(){return[{tag:"ol"}]},renderHTML({HTMLAttributes:t}){let{start:e,type:n,...r}=t,o=L(this.options.HTMLAttributes,r);return e!==1&&(o.start=e),n&&n!=="1"&&(o.type=n),["ol",o,0]},markdownTokenName:"list",parseMarkdown:(t,e)=>{if(t.type!=="list"||!t.ordered)return[];let n=t.start||1,r=t.typeMarker,o=t.items?ZS(t.items,e):[],i={};return n!==1&&(i.start=n),r&&(i.type=r),Object.keys(i).length>0?{type:"orderedList",attrs:i,content:o}:{type:"orderedList",content:o}},renderMarkdown:(t,e)=>t.content?e.renderChildren(t.content,`
|
||||
`):"",markdownTokenizer:{name:"orderedList",level:"block",start:()=>-1,tokenize:(t,e,n)=>{var r,o;let i=t.split(`
|
||||
`),[s,l]=XS(i);if(s.length===0)return;let a=Xp(s,s[0].indent,n);if(a.length!==0)return{type:"list",ordered:!0,start:((r=s[0])===null||r===void 0?void 0:r.number)||1,typeMarker:(o=s[0])===null||o===void 0?void 0:o.type,items:a,raw:i.slice(0,l).join(`
|
||||
`)}}},markdownOptions:{indentsContent:!0},addCommands(){return{toggleOrderedList:()=>({commands:t,chain:e})=>this.options.keepAttributes?e().toggleList(this.name,this.options.itemTypeName,this.options.keepMarks).updateAttributes(e1,this.editor.getAttributes(Wp)).run():t.toggleList(this.name,this.options.itemTypeName,this.options.keepMarks)}},addKeyboardShortcuts(){return{"Mod-Shift-7":()=>this.editor.commands.toggleOrderedList()}},addProseMirrorPlugins(){return[new F({props:{handlePaste:(t,e)=>{var n,r;let o=(n=e.clipboardData)===null||n===void 0?void 0:n.getData("text/html");if(o?.trim())return!1;let i=(r=e.clipboardData)===null||r===void 0?void 0:r.getData("text/plain");if(!i)return!1;let s=QS(i);if(!s)return!1;try{let l=t.state.schema.nodeFromJSON(s),a=t.state.tr.replaceSelectionWith(l);return t.dispatch(a),!0}catch{return!1}}}})]},addInputRules(){let t=(n,r)=>(!r.attrs.type||r.attrs.type==="1")&&r.childCount+r.attrs.start===+n[1],e=Vt({find:jp,type:this.type,getAttributes:n=>({start:+n[1]}),joinPredicate:t});return(this.options.keepMarks||this.options.keepAttributes)&&(e=Vt({find:jp,type:this.type,keepMarks:this.options.keepMarks,keepAttributes:this.options.keepAttributes,getAttributes:n=>({start:+n[1],...this.editor.getAttributes(Wp)}),joinPredicate:t,editor:this.editor})),[e]}}),t1=/^\s*(\[([( |x])?\])\s$/,n1="position:absolute;width:1px;height:1px;padding:0;margin:-1px;overflow:hidden;clip:rect(0,0,0,0);white-space:nowrap;border:0",r1=(t,e,n)=>{var r;return(n==null||(r=n.checkboxLabel)===null||r===void 0?void 0:r.call(n,t,e))||`Task item checkbox for ${t.textContent||"empty task item"}`},o1=W.create({name:"taskItem",addOptions(){return{nested:!1,HTMLAttributes:{},taskListTypeName:"taskList",a11y:void 0}},content(){return this.options.nested?"paragraph block*":"paragraph+"},defining:!0,addAttributes(){return{checked:{default:!1,keepOnSplit:!1,parseHTML:t=>{let e=t.getAttribute("data-checked");return e===""||e==="true"},renderHTML:t=>({"data-checked":t.checked})}}},parseHTML(){return[{tag:`li[data-type="${this.name}"]`,priority:51,contentElement:t=>{var e;return(e=t.querySelector("div"))!==null&&e!==void 0?e:t}}]},renderHTML({node:t,HTMLAttributes:e}){return["li",L(this.options.HTMLAttributes,e,{"data-type":this.name}),["label",["input",{type:"checkbox",checked:t.attrs.checked?"checked":null}],["span"]],["div",0]]},parseMarkdown:(t,e)=>{let n=[];if(t.tokens&&t.tokens.length>0?n.push(e.createNode("paragraph",{},e.parseInline(t.tokens))):t.text?n.push(e.createNode("paragraph",{},[e.createNode("text",{text:t.text})])):n.push(e.createNode("paragraph",{},[])),t.nestedTokens&&t.nestedTokens.length>0){let r=e.parseChildren(t.nestedTokens);n.push(...r)}return e.createNode("taskItem",{checked:t.checked||!1},n)},renderMarkdown:(t,e)=>{var n;let r=`- [${!((n=t.attrs)===null||n===void 0)&&n.checked?"x":" "}] `;return fo(t,e,r)},addExtensions(){return this.options.nested?[Up(this.name,[this.options.taskListTypeName])]:[]},addKeyboardShortcuts(){let t={Enter:()=>this.editor.commands.splitListItem(this.name),"Shift-Tab":()=>this.editor.commands.liftListItem(this.name)};return this.options.nested?{...t,Tab:()=>this.editor.commands.sinkListItem(this.name)}:t},addNodeView(){return({node:t,HTMLAttributes:e,getPos:n,editor:r})=>{let o=document.createElement("li"),i=document.createElement("label"),s=document.createElement("span"),l=document.createElement("input"),a=document.createElement("div");s.style.cssText=n1;let c=u=>{let f=r1(u,u.attrs.checked,this.options.a11y);l.setAttribute("aria-label",f),s.textContent=f};c(t),i.contentEditable="false",l.type="checkbox",l.addEventListener("mousedown",u=>u.preventDefault()),l.addEventListener("change",u=>{if(!r.isEditable&&!this.options.onReadOnlyChecked){l.checked=!l.checked;return}let{checked:f}=u.target;r.isEditable&&typeof n=="function"&&r.chain().focus(void 0,{scrollIntoView:!1}).command(({tr:h})=>{let p=n();if(typeof p!="number")return!1;let g=h.doc.nodeAt(p);return h.setNodeMarkup(p,void 0,{...g?.attrs,checked:f}),!0}).run(),!r.isEditable&&this.options.onReadOnlyChecked&&(this.options.onReadOnlyChecked(t,f)||(l.checked=!l.checked))}),Object.entries(this.options.HTMLAttributes).forEach(([u,f])=>{o.setAttribute(u,f)}),o.dataset.checked=t.attrs.checked,l.checked=t.attrs.checked,i.append(l,s),o.append(i,a),Object.entries(e).forEach(([u,f])=>{o.setAttribute(u,f)});let d=new Set(Object.keys(e));return{dom:o,contentDOM:a,update:u=>{if(u.type!==this.type)return!1;o.dataset.checked=u.attrs.checked,l.checked=u.attrs.checked,c(u);let f=r.extensionManager.attributes,h=zt(u,f),p=new Set(Object.keys(h)),g=this.options.HTMLAttributes;return d.forEach(m=>{p.has(m)||(m in g?o.setAttribute(m,g[m]):o.removeAttribute(m))}),Object.entries(h).forEach(([m,y])=>{y==null?m in g?o.setAttribute(m,g[m]):o.removeAttribute(m):o.setAttribute(m,y)}),d=p,!0}}}},addInputRules(){return[Vt({find:t1,type:this.type,getAttributes:t=>({checked:t[t.length-1]==="x"})})]}}),i1=W.create({name:"taskList",addOptions()
Line truncated
|
||||
`):"",markdownTokenizer:{name:"taskList",level:"block",start(t){var e;let n=(e=t.match(/^\s*[-+*]\s+\[([ xX])\]\s+/))===null||e===void 0?void 0:e.index;return n!==void 0?n:-1},tokenize(t,e,n){let r=i=>{let s=uo(i,{itemPattern:/^(\s*)([-+*])\s+\[([ xX])\]\s+(.*)$/,extractItemData:l=>({indentLevel:l[1].length,mainContent:l[4],checked:l[3].toLowerCase()==="x"}),createToken:(l,a)=>({type:"taskItem",raw:"",mainContent:l.mainContent,indentLevel:l.indentLevel,checked:l.checked,text:l.mainContent,tokens:n.inlineTokens(l.mainContent),nestedTokens:a}),customNestedParser:r},n);if(s){let l={type:"taskList",raw:s.raw,items:s.items},a=i.slice(s.raw.length);return a.trim()?[l,...n.blockTokens(a)]:[l]}return n.blockTokens(i)},o=uo(t,{itemPattern:/^(\s*)([-+*])\s+\[([ xX])\]\s+(.*)$/,extractItemData:i=>({indentLevel:i[1].length,mainContent:i[4],checked:i[3].toLowerCase()==="x"}),createToken:(i,s)=>({type:"taskItem",raw:"",mainContent:i.mainContent,indentLevel:i.indentLevel,checked:i.checked,text:i.mainContent,tokens:n.inlineTokens(i.mainContent),nestedTokens:s}),customNestedParser:r},n);if(o)return{type:"taskList",raw:o.raw,items:o.items}}},markdownOptions:{indentsContent:!0},addCommands(){return{toggleTaskList:()=>({commands:t})=>t.toggleList(this.name,this.options.itemTypeName)}},addKeyboardShortcuts(){return{"Mod-Shift-9":()=>this.editor.commands.toggleTaskList()}}}),nA=Z.create({name:"listKit",addExtensions(){let t=[];return this.options.bulletList!==!1&&t.push(mc.configure(this.options.bulletList)),this.options.listItem!==!1&&t.push(bc.configure(this.options.listItem)),this.options.listKeymap!==!1&&t.push(_S.configure(this.options.listKeymap)),this.options.orderedList!==!1&&t.push(xc.configure(this.options.orderedList)),this.options.taskItem!==!1&&t.push(o1.configure(this.options.taskItem)),this.options.taskList!==!1&&t.push(i1.configure(this.options.taskList)),t}});var Yp=(t,e,n={})=>{t?.dispatchEvent(new CustomEvent(e,{composed:!0,cancelable:!0,detail:n}))},kc=({files:t,acceptedTypes:e,acceptedTypesValidationMessage:n,maxSize:r,maxSizeValidationMessage:o})=>{for(let i of t){if(e&&!e.includes(i.type))return n;if(r&&i.size>+r*1024)return o}return null},s1=()=>("10000000-1000-4000-8000"+-1e11).replace(/[018]/g,t=>(t^crypto.getRandomValues(new Uint8Array(1))[0]&15>>t/4).toString(16)),l1=({editor:t,acceptedTypes:e,acceptedTypesValidationMessage:n,get$WireUsing:r,getFileAttachmentUrlUsing:o,key:i,maxSize:s,maxSizeValidationMessage:l,statePath:a,uploadingMessage:c})=>{let d=new Set,u,f=!1;t.on("destroy",()=>{f=!0,d.forEach(m=>m())});let h=m=>{let y=m.dom.closest("form");d.size||(u=t.isEditable);let w=()=>{d.delete(w)&&(!f&&!d.size&&(t.setEditable(u),m.dom.dispatchEvent(new CustomEvent("rich-editor-uploaded-file",{bubbles:!0,detail:{key:i,livewireId:r().id}}))),Yp(y,"form-processing-finished"))};return d.add(w),t.setEditable(!1),Yp(y,"form-processing-started",{message:c}),m.dom.dispatchEvent(new CustomEvent("rich-editor-uploading-file",{bubbles:!0,detail:{key:i,livewireId:r().id}})),{finish:w,isCurrent:()=>!f&&d.has(w)}},p=(m,y)=>new Promise(w=>{let x=s1();r().upload(`componentFileAttachments.${a}.${x}`,m,async()=>{if(!y.isCurrent()){w(null);return}try{let b=await o(x);w(b?{id:x,src:b}:null)}catch{w(null)}},()=>w(null),()=>{},()=>w(null))}).catch(()=>null),g=async(m,y,w)=>{let x=h(m);try{(await Promise.allSettled(y.map(async k=>{let v=await p(k,x);!v||!x.isCurrent()||t.chain().insertContentAt(w(),{type:"image",attrs:v}).run()}))).forEach(k=>{k.status==="rejected"&&console.error("Failed to insert uploaded file attachment",k.reason)})}finally{x.finish()}};return new F({key:new j("localFiles"),props:{handleDrop(m,y,w,x){if(x||!y.dataTransfer?.files.length)return!1;let b=Array.from(y.dataTransfer.files),k=kc({files:b,acceptedTypes:e,acceptedTypesValidationMessage:n,maxSize:s,maxSizeValidationMessage:l});if(k)return m.dom.dispatchEvent(new CustomEvent("rich-editor-file-validation-message",{bubbles:!0,detail:{key:i,livewireId:r().id,validationMessage:k}})),!1;if(!b.length)return!1;y.preventDefault(),y.stopPropagation();let v=m.posAtCoords({left:y.clientX,top:y.clientY});return g(m,b,()=>v?.pos??0),!0},handlePaste(m,y){let w=y.clipboardData?.files?.length?Array.from(y.clipboardData.files):[],x=y.clipboardData?.getData("text")?.length>0,b=y.clipboardData?.getData("text/html")||"";if(w.length&&!x){let k=kc({files:w,acceptedTypes:e,acceptedTypesValidationMessage:n,maxSize:s,maxSizeValidationMessage:l});return k?(m.dom.dispatchEvent(new CustomEvent("rich-editor-file-validation-message",{bubbles:!0,detail:{key:i,livewireId:r().id,validationMessage:k}})),!1):(y.preventDefault(),y.stopPropagation(),g(m,w,()=>t.state.selection.anchor),!0)}if(b){let v=new DOMParser().parseFromString(b,"text/html"),C=v.querySelectorAll("img[src]");if(C.length){y.stopPropagation();let{from:O,to:P}=t.state.selection,N=h(m);return(async()=>{try{for(let I of C){if(!N.isCurrent())return;let M=I.getAttribute("src");if(!M.startsWith("data:image/"))continue;let V;t
Line truncated
|
||||
`);return/\s/.test(r)}):!1}function B1(t){return()=>{let e=t.state.selection.$anchor.pos,{top:n,right:r,bottom:o,left:i}=t.view.coordsAtPos(e);try{return new DOMRect(i,n,r-i,o-n)}catch{return null}}}function z1(t,e,n,r){return n?()=>{let o=r.getState(t.state),i=o?.decorationId,s=e.dom.querySelector(`[data-decoration-id="${i}"]`);return s?.getBoundingClientRect()||null}:B1(t)}function H1({match:t,dismissedRange:e,state:n,transaction:r,editor:o,shouldResetDismissed:i,effectiveAllowSpaces:s}){return i?.({editor:o,state:n,range:e,match:t,transaction:r,allowSpaces:s})?!1:s?t.range.from===e.from:t.range.from===e.from&&!$1(r)}function F1({view:t,pluginKeyRef:e}){let n=t.state.tr.setMeta(e,{exit:!0});t.dispatch(n)}function V1({pluginKey:t,decorationTag:e,decorationClass:n,decorationContent:r,decorationEmptyClass:o,renderer:i,dispatchExit:s}){return{handleKeyDown(l,a){var c;let d=t.getState(l.state);if(!d.active)return!1;if(a.key==="Escape"||a.key==="Esc"){var u;return i==null||(u=i.onKeyDown)===null||u===void 0||u.call(i,{view:l,event:a,range:d.range}),s(l),!0}return(i==null||(c=i.onKeyDown)===null||c===void 0?void 0:c.call(i,{view:l,event:a,range:d.range}))||!1},decorations(l){let{active:a,range:c,decorationId:d,query:u}=t.getState(l);if(!a)return null;let f=!u?.length,h=[n];return f&&h.push(o),Y.create(l.doc,[re.inline(c.from,c.to,{nodeName:e,class:h.join(" "),"data-decoration-id":d||void 0,"data-decoration-content":r})])}}}function W1({editor:t,char:e,effectiveAllowSpaces:n,allowToIncludeChar:r,allowedPrefixes:o,startOfLine:i,findSuggestionMatch:s,allow:l,shouldShow:a,shouldKeepDismissed:c,pluginKey:d}){return{init(){return{active:!1,range:{from:0,to:0},query:null,text:null,composing:!1,dismissedRange:null}},apply(u,f,h,p){let{isEditable:g}=t,{composing:m}=t.view,{selection:y}=u,{empty:w,from:x}=y,b={...f},k=u.getMeta(d);if(k&&k.exit)return b.active=!1,b.decorationId=null,b.range={from:0,to:0},b.query=null,b.text=null,b.dismissedRange=f.active?{...f.range}:f.dismissedRange,b;if(b.composing=m,u.docChanged&&b.dismissedRange!==null&&(b.dismissedRange={from:u.mapping.map(b.dismissedRange.from),to:u.mapping.map(b.dismissedRange.to)}),g&&(w||t.view.composing)){(x<f.range.from||x>f.range.to)&&!m&&!f.composing&&(b.active=!1);let v=s({char:e,allowSpaces:n,allowToIncludeChar:r,allowedPrefixes:o,startOfLine:i,$position:y.$from}),C=`id_${Math.floor(Math.random()*4294967295)}`;v&&l({editor:t,state:p,range:v.range,isActive:f.active})&&(!a||a({editor:t,range:v.range,query:v.query,text:v.text,transaction:u}))?(b.dismissedRange!==null&&!c({match:v,dismissedRange:b.dismissedRange,state:p,transaction:u})&&(b.dismissedRange=null),b.dismissedRange===null?(b.active=!0,b.decorationId=f.decorationId||C,b.range=v.range,b.query=v.query,b.text=v.text):b.active=!1):(v||(b.dismissedRange=null),b.active=!1)}else b.active=!1;return b.active||(b.decorationId=null,b.range={from:0,to:0},b.query=null,b.text=null),b}}}function j1({editor:t,items:e}){let n=null,r=null,o=null,i=()=>{r!==null&&(clearTimeout(r),r=null),o?.(),o=null},s=c=>new Promise(d=>{o=d,r=setTimeout(()=>{r=null;let u=o;o=null,u?.()},c)}),l=()=>{n?.abort(),i(),n=null};return{abort:l,fetch:async(c,d)=>{l(),n=new AbortController;let u=n;if(d>0&&await s(d),n!==u||u.signal.aborted)return{status:"aborted"};try{let f=await e({editor:t,query:c,signal:u.signal});return n!==u||u.signal.aborted?{status:"aborted"}:{status:"resolved",items:f}}catch{return n!==u||u.signal.aborted?{status:"aborted"}:{status:"error"}}}}}function _1({placement:t,offset:e,flip:n,floatingUi:r}){var o,i,s,l;let a=[Os({mainAxis:(o=e.mainAxis)!==null&&o!==void 0?o:4,crossAxis:(i=e.crossAxis)!==null&&i!==void 0?i:0})];return n&&a.push(Mr()),!(r==null||(s=r.middleware)===null||s===void 0)&&s.length&&a.push(...r.middleware),{placement:t,strategy:(l=r?.strategy)!==null&&l!==void 0?l:"absolute",middleware:a}}function U1(t){if(t instanceof HTMLElement)return t;if(typeof t=="string")try{let e=document.querySelector(t);if(e)return e}catch{return document.body}return document.body}function K1({getReferenceRect:t,contextElement:e,config:n,container:r,dismissOnOutsideClick:o,dismiss:i}){return(s,l={})=>{let a={getBoundingClientRect:()=>{var p;return(p=t())!==null&&p!==void 0?p:new DOMRect},contextElement:e},c=!1,d=!s.isConnected;d&&U1(r).appendChild(s),l.onPosition||(s.style.visibility="hidden",s.style.width="max-content");let f=Dm(a,s,()=>{Tr(a,s,{placement:n.placement,strategy:n.strategy,middleware:n.middleware}).then(({x:p,y:g,placement:m,strategy:y})=>{if(l.onPosition){l.onPosition({x:p,y:g,placement:m,strategy:y});return}Object.assign(s.style,{position:y,left:`${p}px`,top:`${g}px`}),c||(c=!0,s.style.visibility="")})},l.autoUpdate),h;return o&&(h=p=>{let g=p.target;!(g instanceof Node)||s.contains(g)||e.contains(g)||i()},document.addEventListener("pointerdown",h,!0)),()=>{f(),h&&document.removeEventListener("pointerdown",h,!0),d&&s.remove()}}}function q1({editor:t,pluginKey:e,items:n,renderer:r,minQueryLength:o,debounce:i,in
Line truncated
|
||||
`).map(e=>!e.includes("|")||!e.includes("`")?e:nv(e)).join(`
|
||||
`)}function ov(t){return(t||"").replace(/\s+/g," ").trim()}function iv(t,e,n={}){var r;let o=(r=n.cellLineSeparator)!==null&&r!==void 0?r:"";if(!t||!t.content||t.content.length===0)return"";let i=[];t.content.forEach(p=>{let g=[];p.content&&p.content.forEach(m=>{let y="";m.content&&Array.isArray(m.content)&&m.content.length>1?y=m.content.map(k=>e.renderChildren(k)).join(o):y=m.content?e.renderChildren(m.content):"";let w=ov(y.split(o).join(`
|
||||
`).replace(/[ \t]*\r?\n[ \t]*/g,"<br>")),x=m.type==="tableHeader",b=UC(m.attrs);g.push({text:w,isHeader:x,align:b})}),i.push(g)});let s=i.reduce((p,g)=>Math.max(p,g.length),0);if(s===0)return"";let l=Array.from({length:s}).fill(0);i.forEach(p=>{for(let m=0;m<s;m+=1){var g;let y=(((g=p[m])===null||g===void 0?void 0:g.text)||"").length;y>l[m]&&(l[m]=y),l[m]<3&&(l[m]=3)}});let a=(p,g)=>p+" ".repeat(Math.max(0,g-p.length)),c=i[0],d=c.some(p=>p.isHeader),u=Array.from({length:s}).fill(null);i.forEach(p=>{for(let m=0;m<s;m+=1){var g;!u[m]&&(!((g=p[m])===null||g===void 0)&&g.align)&&(u[m]=p[m].align)}});let f=`
|
||||
`,h=Array.from({length:s}).map((p,g)=>d&&c[g]&&c[g].text||"");return f+=`| ${h.map((p,g)=>a(p,l[g])).join(" | ")} |
|
||||
`,f+=`| ${l.map((p,g)=>{let m=Math.max(3,p),y=u[g];return y==="left"?`:${"-".repeat(m)}`:y==="right"?`${"-".repeat(m)}:`:y==="center"?`:${"-".repeat(m)}:`:"-".repeat(m)}).join(" | ")} |
|
||||
`,(d?i.slice(1):i).forEach(p=>{f+=`| ${Array.from({length:s}).fill(0).map((g,m)=>a(p[m]&&p[m].text||"",l[m])).join(" | ")} |
|
||||
`}),f}var sv=W.create({name:"table",addOptions(){return{HTMLAttributes:{},resizable:!1,renderWrapper:!1,handleWidth:5,cellMinWidth:25,View:YC,lastColumnResizable:!0,allowTableNodeSelection:!1}},content:"tableRow+",tableRole:"table",isolating:!0,group:"block",parseHTML(){return[{tag:"table"}]},renderHTML({node:t,HTMLAttributes:e}){let{colgroup:n,tableWidth:r,tableMinWidth:o}=QC(t,this.options.cellMinWidth),i=e.style;function s(){return i||(r?`width: ${r}`:`min-width: ${o}`)}let l=["table",L(this.options.HTMLAttributes,e,{style:s()}),n,["tbody",0]];return this.options.renderWrapper?["div",{class:"tableWrapper"},l]:l},parseMarkdown:(t,e)=>{let n=[],r=Array.isArray(t.align)?t.align:[];if(t.header){let o=[];t.header.forEach((i,s)=>{var l;let a=Fs((l=r[s])!==null&&l!==void 0?l:i.align),c=a?{align:a}:{};o.push(e.createNode("tableHeader",c,[{type:"paragraph",content:e.parseInline(i.tokens)}]))}),n.push(e.createNode("tableRow",{},o))}return t.rows&&t.rows.forEach(o=>{let i=[];o.forEach((s,l)=>{var a;let c=Fs((a=r[l])!==null&&a!==void 0?a:s.align),d=c?{align:c}:{};i.push(e.createNode("tableCell",d,[{type:"paragraph",content:e.parseInline(s.tokens)}]))}),n.push(e.createNode("tableRow",{},i))}),e.createNode("table",void 0,n)},renderMarkdown:(t,e)=>iv(t,e),markdownTokenizer:{name:"table",level:"block",start:t=>{let e=t.split(`
|
||||
`);if(e.length<2)return-1;let n=e[1];return!/^[ \t|:]*-[ \t|:-]*$/.test(n)||!n.includes("|")?-1:e[0].includes("|")?0:-1},tokenize(t,e,n){let r=t.indexOf(`
|
||||
|
||||
`),o=r>=0?t.slice(0,r):t,i=o.split(`
|
||||
`);if(i.length<2)return;let s=i[1];if(!/^[ \t|:]*-[ \t|:-]*$/.test(s)||!s.includes("|"))return;let l=rv(o);if(l===o)return;let a=n.blockTokens(l)[0];if(a?.type!=="table"||!a.raw)return;let c=a.raw.split(`
|
||||
`).length,d=t.split(`
|
||||
`).slice(0,c).join(`
|
||||
`);return{...a,raw:d}}},addCommands(){return{insertTable:({rows:t=3,cols:e=3,withHeaderRow:n=!0}={})=>({tr:r,dispatch:o,editor:i})=>{let s=ev(i.schema,t,e,n);if(o){let l=r.selection.from+1;r.replaceSelectionWith(s).scrollIntoView().setSelection(R.near(r.doc.resolve(l)))}return!0},addColumnBefore:()=>({state:t,dispatch:e})=>lg(t,e),addColumnAfter:()=>({state:t,dispatch:e})=>ag(t,e),deleteColumn:()=>({state:t,dispatch:e})=>{let n=dt(t.selection.$from,r=>r.type.name==="table");return cg(t,e&&(r=>{n&&Cg(r,n.pos),e(r)}))},addRowBefore:()=>({state:t,dispatch:e})=>ug(t,e),addRowAfter:()=>({state:t,dispatch:e})=>fg(t,e),deleteRow:()=>({state:t,dispatch:e})=>{let n=dt(t.selection.$from,r=>r.type.name==="table");return hg(t,e&&(r=>{n&&Cg(r,n.pos),e(r)}))},deleteTable:()=>({state:t,dispatch:e})=>gg(t,e),mergeCells:()=>({state:t,dispatch:e})=>Hc(t,e),splitCell:()=>({state:t,dispatch:e})=>Fc(t,e),toggleHeaderColumn:()=>({state:t,dispatch:e})=>Ar("column")(t,e),toggleHeaderRow:()=>({state:t,dispatch:e})=>Ar("row")(t,e),toggleHeaderCell:()=>({state:t,dispatch:e})=>mg(t,e),mergeOrSplit:()=>({state:t,dispatch:e})=>Hc(t,e)?!0:Fc(t,e),setCellAttribute:(t,e)=>({state:n,dispatch:r})=>pg(t,e)(n,r),goToNextCell:()=>({state:t,dispatch:e})=>Vc(1)(t,e),goToPreviousCell:()=>({state:t,dispatch:e})=>Vc(-1)(t,e),fixTables:()=>({state:t,dispatch:e})=>(e&&zc(t),!0),setCellSelection:t=>({tr:e,dispatch:n})=>{if(n){let r=te.create(e.doc,t.anchorCell,t.headCell);e.setSelection(r)}return!0}}},addKeyboardShortcuts(){return{Tab:()=>this.editor.commands.goToNextCell()?!0:this.editor.can().addRowAfter()?this.editor.chain().addRowAfter().goToNextCell().run():!1,"Shift-Tab":()=>this.editor.commands.goToPreviousCell(),Backspace:Hs,"Mod-Backspace":Hs,Delete:Hs,"Mod-Delete":Hs}},addProseMirrorPlugins(){return[...this.options.resizable&&this.editor.isEditable?[bg({handleWidth:this.options.handleWidth,cellMinWidth:this.options.cellMinWidth,defaultCellMinWidth:this.options.cellMinWidth,View:this.options.View,lastColumnResizable:this.options.lastColumnResizable})]:[],xg({allowTableNodeSelection:this.options.allowTableNodeSelection})]},addNodeView(){let t=this.options.resizable&&this.editor.isEditable,e=this.options.View;return t||!e?null:({node:n,view:r,HTMLAttributes:o})=>{let i=L(this.options.HTMLAttributes,o);return new e(n,this.options.cellMinWidth,r,i)}},extendNodeSchema(t){let e={name:t.name,options:t.options,storage:t.storage};return{tableRole:G(B(t,"tableRole",e))}}}),Eg=Z.create({name:"tableKit",addExtensions(){let t=[];return this.options.table!==!1&&t.push(sv.configure(this.options.table)),this.options.tableCell!==!1&&t.push(JC.configure(this.options.tableCell)),this.options.tableHeader!==!1&&t.push(GC.configure(this.options.tableHeader)),this.options.tableRow!==!1&&t.push(XC.configure(this.options.tableRow)),t}});var lv=W.create({name:"text",group:"inline",parseMarkdown:t=>({type:"text",text:t.text||""}),renderMarkdown:t=>t.text||""}),Og=lv;var av=Z.create({name:"textAlign",addOptions(){return{types:[],alignments:["left","center","right","justify"],defaultAlignment:null}},addGlobalAttributes(){return[{types:this.options.types,attributes:{textAlign:{default:this.options.defaultAlignment,parseHTML:t=>{let e=t.style.textAlign;return this.options.alignments.includes(e)?e:this.options.defaultAlignment},renderHTML:t=>t.textAlign?{style:`text-align: ${t.textAlign}`}:{}}}}]},addCommands(){return{setTextAlign:t=>({commands:e})=>this.options.alignments.includes(t)?this.options.types.map(n=>e.updateAttributes(n,{textAlign:t})).some(n=>n):!1,unsetTextAlign:()=>({commands:t})=>this.options.types.map(e=>t.resetAttributes(e,"textAlign")).some(e=>e),toggleTextAlign:t=>({editor:e,commands:n})=>this.options.alignments.includes(t)?e.isActive({textAlign:t})?n.unsetTextAlign():n.setTextAlign(t):!1}},addKeyboardShortcuts(){return{"Mod-Shift-l":()=>this.editor.commands.setTextAlign("left"),"Mod-Shift-e":()=>this.editor.commands.setTextAlign("center"),"Mod-Shift-r":()=>this.editor.commands.setTextAlign("right"),"Mod-Shift-j":()=>this.editor.commands.setTextAlign("justify")}}}),Ng=av;var cv=ie.create({name:"underline",addOptions(){return{HTMLAttributes:{}}},parseHTML(){return[{tag:"u"},{style:"text-decoration",consuming:!1,getAttrs:t=>t.includes("underline")?{}:!1}]},renderHTML({HTMLAttributes:t}){return["u",L(this.options.HTMLAttributes,t),0]},parseMarkdown(t,e){return e.applyMark(this.name||"underline",e.parseInline(t.tokens||[]))},renderMarkdown(t,e){return`++${e.renderChildren(t)}++`},markdownTokenizer:{name:"underline",level:"inline",start(t){return t.indexOf("++")},tokenize(t,e,n){let r=/^(\+\+)([\s\S]+?)(\+\+)/.exec(t);if(!r)return;let o=r[2].trim();return{type:"underline",raw:r[0],text:o,tokens:n.inlineTokens(o)}}},addCommands(){return{setUnderline:()=>({commands:t})=>t.setMark(this.name),toggleUnderline:()=>({commands:t})=>t.toggleMark(this.name),unsetUnderline:()=>({commands:t})=>t.unsetMark(this.name)}},addKeyboardShortcuts(){return{"Mod-u":()=>this.editor.
Line truncated
|
||||
@@ -0,0 +1,11 @@
|
||||
var $t=Math.min,St=Math.max,zt=Math.round;var rt=n=>({x:n,y:n}),on={left:"right",right:"left",bottom:"top",top:"bottom"};function Te(n,t,e){return St(n,$t(t,e))}function Xt(n,t){return typeof n=="function"?n(t):n}function Ot(n){return n.split("-")[0]}function Yt(n){return n.split("-")[1]}function Ie(n){return n==="x"?"y":"x"}function Re(n){return n==="y"?"height":"width"}function mt(n){let t=n[0];return t==="t"||t==="b"?"y":"x"}function Me(n){return Ie(mt(n))}function ei(n,t,e){e===void 0&&(e=!1);let i=Yt(n),s=Me(n),o=Re(s),r=s==="x"?i===(e?"end":"start")?"right":"left":i==="start"?"bottom":"top";return t.reference[o]>t.floating[o]&&(r=Wt(r)),[r,Wt(r)]}function ii(n){let t=Wt(n);return[re(n),t,re(t)]}function re(n){return n.includes("start")?n.replace("start","end"):n.replace("end","start")}var Ze=["left","right"],ti=["right","left"],rn=["top","bottom"],an=["bottom","top"];function ln(n,t,e){switch(n){case"top":case"bottom":return e?t?ti:Ze:t?Ze:ti;case"left":case"right":return t?rn:an;default:return[]}}function ni(n,t,e,i){let s=Yt(n),o=ln(Ot(n),e==="start",i);return s&&(o=o.map(r=>r+"-"+s),t&&(o=o.concat(o.map(re)))),o}function Wt(n){let t=Ot(n);return on[t]+n.slice(t.length)}function cn(n){return{top:0,right:0,bottom:0,left:0,...n}}function si(n){return typeof n!="number"?cn(n):{top:n,right:n,bottom:n,left:n}}function At(n){let{x:t,y:e,width:i,height:s}=n;return{width:i,height:s,top:e,left:t,right:t+i,bottom:e+s,x:t,y:e}}function oi(n,t,e){let{reference:i,floating:s}=n,o=mt(t),r=Me(t),a=Re(r),l=Ot(t),c=o==="y",h=i.x+i.width/2-s.width/2,u=i.y+i.height/2-s.height/2,p=i[a]/2-s[a]/2,f;switch(l){case"top":f={x:h,y:i.y-s.height};break;case"bottom":f={x:h,y:i.y+i.height};break;case"right":f={x:i.x+i.width,y:u};break;case"left":f={x:i.x-s.width,y:u};break;default:f={x:i.x,y:i.y}}switch(Yt(t)){case"start":f[r]-=p*(e&&c?-1:1);break;case"end":f[r]+=p*(e&&c?-1:1);break}return f}async function ri(n,t){var e;t===void 0&&(t={});let{x:i,y:s,platform:o,rects:r,elements:a,strategy:l}=n,{boundary:c="clippingAncestors",rootBoundary:h="viewport",elementContext:u="floating",altBoundary:p=!1,padding:f=0}=Xt(t,n),m=si(f),S=a[p?u==="floating"?"reference":"floating":u],O=At(await o.getClippingRect({element:(e=await(o.isElement==null?void 0:o.isElement(S)))==null||e?S:S.contextElement||await(o.getDocumentElement==null?void 0:o.getDocumentElement(a.floating)),boundary:c,rootBoundary:h,strategy:l})),w=u==="floating"?{x:i,y:s,width:r.floating.width,height:r.floating.height}:r.reference,x=await(o.getOffsetParent==null?void 0:o.getOffsetParent(a.floating)),A=await(o.isElement==null?void 0:o.isElement(x))?await(o.getScale==null?void 0:o.getScale(x))||{x:1,y:1}:{x:1,y:1},M=At(o.convertOffsetParentRelativeRectToViewportRelativeRect?await o.convertOffsetParentRelativeRectToViewportRelativeRect({elements:a,rect:w,offsetParent:x,strategy:l}):w);return{top:(O.top-M.top+m.top)/A.y,bottom:(M.bottom-O.bottom+m.bottom)/A.y,left:(O.left-M.left+m.left)/A.x,right:(M.right-O.right+m.right)/A.x}}var un=50,ai=async(n,t,e)=>{let{placement:i="bottom",strategy:s="absolute",middleware:o=[],platform:r}=e,a=r.detectOverflow?r:{...r,detectOverflow:ri},l=await(r.isRTL==null?void 0:r.isRTL(t)),c=await r.getElementRects({reference:n,floating:t,strategy:s}),{x:h,y:u}=oi(c,i,l),p=i,f=0,m={};for(let g=0;g<o.length;g++){let S=o[g];if(!S)continue;let{name:O,fn:w}=S,{x,y:A,data:M,reset:C}=await w({x:h,y:u,initialPlacement:i,placement:p,strategy:s,middlewareData:m,rects:c,platform:a,elements:{reference:n,floating:t}});h=x??h,u=A??u,m[O]={...m[O],...M},C&&f<un&&(f++,typeof C=="object"&&(C.placement&&(p=C.placement),C.rects&&(c=C.rects===!0?await r.getElementRects({reference:n,floating:t,strategy:s}):C.rects),{x:h,y:u}=oi(c,p,l)),g=-1)}return{x:h,y:u,placement:p,strategy:s,middlewareData:m}};var li=function(n){return n===void 0&&(n={}),{name:"flip",options:n,async fn(t){var e,i;let{placement:s,middlewareData:o,rects:r,initialPlacement:a,platform:l,elements:c}=t,{mainAxis:h=!0,crossAxis:u=!0,fallbackPlacements:p,fallbackStrategy:f="bestFit",fallbackAxisSideDirection:m="none",flipAlignment:g=!0,...S}=Xt(n,t);if((e=o.arrow)!=null&&e.alignmentOffset)return{};let O=Ot(s),w=mt(a),x=Ot(a)===a,A=await(l.isRTL==null?void 0:l.isRTL(c.floating)),M=p||(x||!g?[Wt(a)]:ii(a)),C=m!=="none";!p&&C&&M.push(...ni(a,g,m,A));let J=[a,...M],Q=await l.detectOverflow(t,S),I=[],V=((i=o.flip)==null?void 0:i.overflows)||[];if(h&&I.push(Q[O]),u){let B=ei(s,r,A);I.push(Q[B[0]],Q[B[1]])}if(V=[...V,{placement:s,overflows:I}],!I.every(B=>B<=0)){var X,it;let B=(((X=o.flip)==null?void 0:X.index)||0)+1,Z=J[B];if(Z&&(!(u==="alignment"?w!==mt(Z):!1)||V.every(_=>mt(_.placement)===w?_.overflows[0]>0:!0)))return{data:{index:B,overflows:V},reset:{placement:Z}};let k=(it=V.filter($=>$.overflows[0]<=0).sort(($,_)=>$.overflows[1]-_.overflows[1])[0])==null?void 0:it.placement;if(!k)switch(f){case"bestFit":{var W;let $=(W=V.filter(_=>{if(C){let j=mt(_.placement);return j===w||j==="y"}return!0}).map(_=>[_.placement,_Line truncated
|
||||
/*! Bundled license information:
|
||||
|
||||
sortablejs/modular/sortable.esm.js:
|
||||
(**!
|
||||
* Sortable 1.15.7
|
||||
* @author RubaXa <trash@rubaxa.org>
|
||||
* @author owenm <owen23355@gmail.com>
|
||||
* @license MIT
|
||||
*)
|
||||
*/
|
||||
@@ -0,0 +1 @@
|
||||
var K;(function(r){r.Range="range",r.Steps="steps",r.Positions="positions",r.Count="count",r.Values="values"})(K||(K={}));var H;(function(r){r[r.None=-1]="None",r[r.NoValue=0]="NoValue",r[r.LargeValue=1]="LargeValue",r[r.SmallValue=2]="SmallValue"})(H||(H={}));function Ce(r){return rt(r)&&typeof r.from=="function"}function rt(r){return typeof r=="object"&&typeof r.to=="function"}function zt(r){r.parentElement.removeChild(r)}function bt(r){return r!=null}function jt(r){r.preventDefault()}function Ae(r){return r.filter(function(t){return this[t]?!1:this[t]=!0},{})}function ye(r,t){return Math.round(r/t)*t}function Pe(r,t){var s=r.getBoundingClientRect(),u=r.ownerDocument,f=u.documentElement,v=qt(u);return/webkit.*Chrome.*Mobile/i.test(navigator.userAgent)&&(v.x=0),t?s.top+v.y-f.clientTop:s.left+v.x-f.clientLeft}function j(r){return typeof r=="number"&&!isNaN(r)&&isFinite(r)}function Rt(r,t,s){s>0&&(L(r,t),setTimeout(function(){et(r,t)},s))}function Nt(r){return Math.max(Math.min(r,100),0)}function it(r){return Array.isArray(r)?r:[r]}function Ve(r){r=String(r);var t=r.split(".");return t.length>1?t[1].length:0}function L(r,t){r.classList&&!/\s/.test(t)?r.classList.add(t):r.className+=" "+t}function et(r,t){r.classList&&!/\s/.test(t)?r.classList.remove(t):r.className=r.className.replace(new RegExp("(^|\\b)"+t.split(" ").join("|")+"(\\b|$)","gi")," ")}function De(r,t){return r.classList?r.classList.contains(t):new RegExp("\\b"+t+"\\b").test(r.className)}function qt(r){var t=window.pageXOffset!==void 0,s=(r.compatMode||"")==="CSS1Compat",u=t?window.pageXOffset:s?r.documentElement.scrollLeft:r.body.scrollLeft,f=t?window.pageYOffset:s?r.documentElement.scrollTop:r.body.scrollTop;return{x:u,y:f}}function ke(){return window.navigator.pointerEnabled?{start:"pointerdown",move:"pointermove",end:"pointerup"}:window.navigator.msPointerEnabled?{start:"MSPointerDown",move:"MSPointerMove",end:"MSPointerUp"}:{start:"mousedown touchstart",move:"mousemove touchmove",end:"mouseup touchend"}}function Ue(){var r=!1;try{var t=Object.defineProperty({},"passive",{get:function(){r=!0}});window.addEventListener("test",null,t)}catch{}return r}function Me(){return window.CSS&&CSS.supports&&CSS.supports("touch-action","none")}function wt(r,t){return 100/(t-r)}function xt(r,t,s){return t*100/(r[s+1]-r[s])}function Oe(r,t){return xt(r,r[0]<0?t+Math.abs(r[0]):t-r[0],0)}function _e(r,t){return t*(r[1]-r[0])/100+r[0]}function J(r,t){for(var s=1;r>=t[s];)s+=1;return s}function Le(r,t,s){if(s>=r.slice(-1)[0])return 100;var u=J(s,r),f=r[u-1],v=r[u],d=t[u-1],w=t[u];return d+Oe([f,v],s)/wt(d,w)}function He(r,t,s){if(s>=100)return r.slice(-1)[0];var u=J(s,t),f=r[u-1],v=r[u],d=t[u-1],w=t[u];return _e([f,v],(s-d)*wt(d,w))}function Fe(r,t,s,u){if(u===100)return u;var f=J(u,r),v=r[f-1],d=r[f];return s?u-v>(d-v)/2?d:v:t[f-1]?r[f-1]+ye(u-r[f-1],t[f-1]):u}var Kt=(function(){function r(t,s,u){this.xPct=[],this.xVal=[],this.xSteps=[],this.xNumSteps=[],this.xHighestCompleteStep=[],this.xSteps=[u||!1],this.xNumSteps=[!1],this.snap=s;var f,v=[];for(Object.keys(t).forEach(function(d){v.push([it(t[d]),d])}),v.sort(function(d,w){return d[0][0]-w[0][0]}),f=0;f<v.length;f++)this.handleEntryPoint(v[f][1],v[f][0]);for(this.xNumSteps=this.xSteps.slice(0),f=0;f<this.xNumSteps.length;f++)this.handleStepPoint(f,this.xNumSteps[f])}return r.prototype.getDistance=function(t){for(var s=[],u=0;u<this.xNumSteps.length-1;u++)s[u]=xt(this.xVal,t,u);return s},r.prototype.getAbsoluteDistance=function(t,s,u){var f=0;if(t<this.xPct[this.xPct.length-1])for(;t>this.xPct[f+1];)f++;else t===this.xPct[this.xPct.length-1]&&(f=this.xPct.length-2);!u&&t===this.xPct[f+1]&&f++,s===null&&(s=[]);var v,d=1,w=s[f],E=0,p=0,V=0,D=0;for(u?v=(t-this.xPct[f])/(this.xPct[f+1]-this.xPct[f]):v=(this.xPct[f+1]-t)/(this.xPct[f+1]-this.xPct[f]);w>0;)E=this.xPct[f+1+D]-this.xPct[f+D],s[f+D]*d+100-v*100>100?(p=E*v,d=(w-100*v)/s[f+D],v=1):(p=s[f+D]*E/100*d,d=0),u?(V=V-p,this.xPct.length+D>=1&&D--):(V=V+p,this.xPct.length-D>=1&&D++),w=s[f+D]*d;return t+V},r.prototype.toStepping=function(t){return t=Le(this.xVal,this.xPct,t),t},r.prototype.fromStepping=function(t){return He(this.xVal,this.xPct,t)},r.prototype.getStep=function(t){return t=Fe(this.xPct,this.xSteps,this.snap,t),t},r.prototype.getDefaultStep=function(t,s,u){var f=J(t,this.xPct);return(t===100||s&&t===this.xPct[f-1])&&(f=Math.max(f-1,1)),(this.xVal[f]-this.xVal[f-1])/u},r.prototype.getNearbySteps=function(t){var s=J(t,this.xPct);return{stepBefore:{startValue:this.xVal[s-2],step:this.xNumSteps[s-2],highestStep:this.xHighestCompleteStep[s-2]},thisStep:{startValue:this.xVal[s-1],step:this.xNumSteps[s-1],highestStep:this.xHighestCompleteStep[s-1]},stepAfter:{startValue:this.xVal[s],step:this.xNumSteps[s],highestStep:this.xHighestCompleteStep[s]}}},r.prototype.countStepDecimals=function(){var t=this.xNumSteps.map(Ve);return Math.max.apply(null,t)},r.prototype.hasNoSize=function(){return this.xVal[0]===this.xVal[this.xVal.length-1]},r.prototype.convert=funLine truncated
|
||||
@@ -0,0 +1 @@
|
||||
function r({state:n,splitKeys:i,tagAddedMessage:a,tagRemovedMessage:s}){return{newTag:"",state:n,liveRegionClearTimeout:null,announce(e){let t=this.$refs.liveRegion;t&&(this.liveRegionClearTimeout!==null&&clearTimeout(this.liveRegionClearTimeout),t.textContent=e,this.liveRegionClearTimeout=setTimeout(()=>{t.textContent="",this.liveRegionClearTimeout=null},3e3))},createTag(){if(this.newTag=this.newTag.trim(),this.newTag!==""){if(this.state.includes(this.newTag)){this.newTag="";return}this.state.push(this.newTag),this.announce(a?.replace(":tag",()=>this.newTag)),this.newTag=""}},deleteTag(e){this.state=this.state.filter(t=>t!==e),this.announce(s?.replace(":tag",()=>e))},reorderTags(e){let t=this.state.splice(e.oldIndex,1)[0];this.state.splice(e.newIndex,0,t),this.state=[...this.state]},input:{"x-on:blur":"createTag()","x-model":"newTag","x-on:keydown"(e){["Enter",...i].includes(e.key)&&(e.preventDefault(),e.stopPropagation(),this.createTag())},"x-on:paste"(){this.$nextTick(()=>{if(i.length===0){this.createTag();return}let e=i.map(t=>t.replace(/[/\-\\^$*+?.()|[\]{}]/g,"\\$&")).join("|");this.newTag.split(new RegExp(e,"g")).forEach(t=>{this.newTag=t,this.createTag()})})}}}}export{r as default};
|
||||
@@ -0,0 +1 @@
|
||||
function u(){return{isPasswordRevealed:!1,passwordRevealFocusRequest:0,destroy(){this.passwordRevealFocusRequest++},setPasswordRevealed(s){let e=this.$root.querySelector("input.fi-input"),t=++this.passwordRevealFocusRequest,r=e.selectionStart,i=e.selectionEnd,c=e.selectionDirection;this.isPasswordRevealed=s,this.$nextTick(()=>{t===this.passwordRevealFocusRequest&&requestAnimationFrame(()=>{if(t!==this.passwordRevealFocusRequest)return;let a=s?"hidePasswordAction":"showPasswordAction",o=Array.from(this.$root.querySelectorAll(`[x-ref="${a}"]`)).find(n=>n.isConnected&&n.getClientRects().length);o&&(o.focus(),e.setSelectionRange(r,i,c))})})}}}export{u as default};
|
||||
@@ -0,0 +1 @@
|
||||
function n({initialHeight:e,shouldAutosize:s,state:i}){return{state:i,resizeObserver:null,wrapperEl:null,init(){this.wrapperEl=this.$el.parentNode,this.setInitialHeight(),s?this.$watch("state",()=>{this.resize()}):this.setUpResizeObserver()},setInitialHeight(){this.$el.scrollHeight<=0||(this.wrapperEl.style.height=e+"rem")},resize(){if(this.$el.scrollHeight<=0)return;let r=this.$el.style.height;this.$el.style.height="0px";let h=this.$el.scrollHeight;this.$el.style.height=r;let l=parseFloat(e)*parseFloat(getComputedStyle(document.documentElement).fontSize),t=Math.max(h,l)+"px";this.wrapperEl.style.height!==t&&(this.wrapperEl.style.height=t)},setUpResizeObserver(){this.resizeObserver=new ResizeObserver(()=>{this.wrapperEl.style.height=this.$el.style.height}),this.resizeObserver.observe(this.$el)},destroy(){this.resizeObserver?.disconnect()}}}export{n as default};
|
||||
@@ -0,0 +1 @@
|
||||
function l({state:r,stateBindingModifiers:e}){let t=!1,o,n=e.includes("blur"),u=e.some(s=>["live","lazy","change"].includes(s)),c=e.includes("debounce"),i=String(e[e.indexOf("debounce")+1]??250),b=i.endsWith("s")&&!i.endsWith("ms")?Number.parseFloat(i)*1e3:Number.parseFloat(i);return{state:r,submissionLocked:!1,submissionLockObserver:null,init(){this.submissionLocked=this.$refs.submissionLock.disabled,this.submissionLockObserver=new MutationObserver(()=>{this.submissionLocked=this.$refs.submissionLock.disabled}),this.submissionLockObserver.observe(this.$refs.submissionLock,{attributes:!0,attributeFilter:["disabled"]})},isSelected(s){return["string","number"].includes(typeof this.state)&&String(this.state)===s},select(s){this.$refs.submissionLock.disabled||(this.state=this.isSelected(s)?null:s,u&&!n&&this.$nextTick(()=>{t||(c?(clearTimeout(o),o=setTimeout(()=>{t||this.$wire.$commit()},b)):this.$wire.$commit())}))},blur(){n&&this.$wire.$commit()},destroy(){t=!0,clearTimeout(o),this.submissionLockObserver?.disconnect()}}}export{l as default};
|
||||
@@ -0,0 +1 @@
|
||||
(()=>{function C(i,t=()=>{}){let e=!1;return function(){e?t.apply(this,arguments):(e=!0,i.apply(this,arguments))}}function g({notification:i}){return{isShown:!1,computedStyle:null,transitionDuration:null,transitionEasing:null,closeTimeout:null,durationTimeout:null,remainingDuration:null,durationStartedAt:null,isHovered:!1,isFocusedWithin:!1,isClosing:!1,focusOrigin:null,unsubscribeLivewireHook:null,transitionEffect:null,isDestroyed:!1,init(){this.$el.classList.contains("fi-inline")?this.isShown=!0:(this.computedStyle=window.getComputedStyle(this.$el),this.transitionDuration=parseFloat(this.computedStyle.transitionDuration)*1e3,this.transitionEasing=this.computedStyle.transitionTimingFunction),this.configureTransitions(),this.configureAnimations(),i.duration&&i.duration!=="persistent"&&(this.$root.classList.contains("fi-inline")?this.durationTimeout=setTimeout(()=>{if(!this.$el.matches(":hover")){this.close();return}this.$el.addEventListener("mouseleave",()=>this.close())},i.duration):(this.remainingDuration=i.duration,this.isHovered=this.$el.matches(":hover"),this.isFocusedWithin=this.$el.contains(document.activeElement),!this.isHovered&&!this.isFocusedWithin&&this.resumeDuration())),this.isShown=!0},pauseDuration(t){if(this.isClosing)return;let e=this.isHovered||this.isFocusedWithin;t==="hover"?this.isHovered=!0:this.isFocusedWithin=!0,!(e||!this.durationTimeout)&&(this.remainingDuration=Math.max(0,this.remainingDuration-(performance.now()-this.durationStartedAt)),clearTimeout(this.durationTimeout),this.durationTimeout=null,this.durationStartedAt=null)},resumeDuration(t=null){t==="hover"?this.isHovered=!1:t==="focus"&&(this.isFocusedWithin=!1),!(this.isClosing||this.isHovered||this.isFocusedWithin||this.remainingDuration===null||this.durationTimeout)&&(this.durationStartedAt=performance.now(),this.durationTimeout=setTimeout(()=>{this.durationTimeout=null,this.durationStartedAt=null,this.remainingDuration=0,this.close()},this.remainingDuration))},handleFocusIn(t){this.$el.contains(t.relatedTarget)||(this.focusOrigin=t.relatedTarget instanceof HTMLElement?t.relatedTarget:null),this.pauseDuration("focus")},handleFocusOut(t){this.$el.contains(t.relatedTarget)||this.resumeDuration("focus")},handleEscape(t){this.$el.contains(document.activeElement)&&(t.preventDefault(),t.stopImmediatePropagation(),this.dismiss())},configureTransitions(){if(this.$el.classList.contains("fi-inline")){let r=this.$el.style.getPropertyValue("display"),h=this.$el.style.getPropertyPriority("display");this.transitionEffect=Alpine.effect(()=>{if(this.isDestroyed)return;let u=this.isShown;Alpine.mutateDom(()=>{u?(this.$el.style.setProperty("display",r,h),this.$el.style.setProperty("visibility","visible")):this.$el.style.setProperty("display","none","important")}),this.$el._x_isShown=u});return}let t=this.computedStyle.display,e=()=>{Alpine.mutateDom(()=>{this.$el.style.setProperty("display",t),this.$el.style.setProperty("visibility","visible")}),this.$el._x_isShown=!0},s=()=>{Alpine.mutateDom(()=>{this.$el._x_isShown?this.$el.style.setProperty("visibility","hidden"):this.$el.style.setProperty("display","none")})},n=C(r=>r?e():s(),r=>{this.$el._x_toggleAndCascadeWithTransitions(this.$el,r,e,s)});this.transitionEffect=Alpine.effect(()=>{this.isDestroyed||n(this.isShown)})},configureAnimations(){this.$el.classList.contains("fi-inline")||(this.unsubscribeLivewireHook=Livewire.hook("commit",({component:t,succeed:e})=>{t.snapshot.data.isFilamentNotificationsComponent&&requestAnimationFrame(()=>{if(this.isDestroyed)return;let s=()=>this.$el.getBoundingClientRect().top,n=s();e(()=>{this.isDestroyed||queueMicrotask(()=>queueMicrotask(()=>{if(this.isDestroyed||!this.isShown)return;this.$el.getAnimations().forEach(h=>h.finish());let r=s();n!==r&&(window.matchMedia("(prefers-reduced-motion: reduce)").matches||this.$el.animate([{transform:`translateY(${n-r}px)`},{transform:"translateY(0px)"}],{duration:this.transitionDuration,easing:this.transitionEasing}))}))})})}))},close(t=!1){if(this.isClosing)return;this.isClosing=!0,clearTimeout(this.closeTimeout),clearTimeout(this.durationTimeout),this.durationTimeout=null,this.durationStartedAt=null;let e=()=>window.dispatchEvent(new CustomEvent("notificationClosed",{detail:{id:i.id}}));if(t===!0){this.isShown=!1,e();return}if(this.$root.classList.contains("fi-inline")){e();return}let s=this.$el.closest("[wire\\:id]");this.isShown=!1,this.closeTimeout=setTimeout(()=>{s&&!s.isConnected||e()},this.transitionDuration)},dismiss(){let t=this.focusOrigin;this.focusOrigin=null,this.$el.contains(document.activeElement)&&t instanceof HTMLElement&&t.isConnected&&!this.$el.contains(t)&&t.focus({preventScroll:!0}),this.close()},markAsRead(){window.dispatchEvent(new CustomEvent("markedNotificationAsRead",{detail:{id:i.id}}))},markAsUnread(){window.dispatchEvent(new CustomEvent("markedNotificationAsUnread",{detail:{id:i.id}}))},destroy(){this.isDestroyed=!0,clearTimeout(this.durationTimeout),this.durationTimeout=null,this.uLine truncated
|
||||
@@ -0,0 +1 @@
|
||||
var i=()=>({isSticky:!1,width:0,resizeObserver:null,boundUpdateWidth:null,init(){let e=this.$el.parentElement;e&&(this.updateWidth(),this.resizeObserver=new ResizeObserver(()=>this.updateWidth()),this.resizeObserver.observe(e),this.boundUpdateWidth=this.updateWidth.bind(this),window.addEventListener("resize",this.boundUpdateWidth))},enableSticky(){this.isSticky=this.$el.getBoundingClientRect().top>0},disableSticky(){this.isSticky=!1},updateWidth(){let e=this.$el.parentElement;if(!e)return;let t=getComputedStyle(this.$root.querySelector(".fi-ac"));this.width=e.offsetWidth+parseInt(t.marginInlineStart,10)*-1+parseInt(t.marginInlineEnd,10)*-1},destroy(){this.resizeObserver&&(this.resizeObserver.disconnect(),this.resizeObserver=null),this.boundUpdateWidth&&(window.removeEventListener("resize",this.boundUpdateWidth),this.boundUpdateWidth=null)}});export{i as default};
|
||||
@@ -0,0 +1 @@
|
||||
var _=Math.min,R=Math.max,nt=Math.round,ot=Math.floor,H=t=>({x:t,y:t}),ee={left:"right",right:"left",bottom:"top",top:"bottom"};function mt(t,e,o){return R(t,_(e,o))}function X(t,e){return typeof t=="function"?t(e):t}function $(t){return t.split("-")[0]}function G(t){return t.split("-")[1]}function gt(t){return t==="x"?"y":"x"}function pt(t){return t==="y"?"height":"width"}function V(t){let e=t[0];return e==="t"||e==="b"?"y":"x"}function bt(t){return gt(V(t))}function Rt(t,e,o){o===void 0&&(o=!1);let n=G(t),r=bt(t),a=pt(r),c=r==="x"?n===(o?"end":"start")?"right":"left":n==="start"?"bottom":"top";return e.reference[a]>e.floating[a]&&(c=it(c)),[c,it(c)]}function St(t){let e=it(t);return[lt(t),e,lt(e)]}function lt(t){return t.includes("start")?t.replace("start","end"):t.replace("end","start")}var At=["left","right"],Et=["right","left"],ie=["top","bottom"],ne=["bottom","top"];function oe(t,e,o){switch(t){case"top":case"bottom":return o?e?Et:At:e?At:Et;case"left":case"right":return e?ie:ne;default:return[]}}function Ft(t,e,o,n){let r=G(t),a=oe($(t),o==="start",n);return r&&(a=a.map(c=>c+"-"+r),e&&(a=a.concat(a.map(lt)))),a}function it(t){let e=$(t);return ee[e]+t.slice(e.length)}function se(t){return{top:0,right:0,bottom:0,left:0,...t}}function Ct(t){return typeof t!="number"?se(t):{top:t,right:t,bottom:t,left:t}}function I(t){let{x:e,y:o,width:n,height:r}=t;return{width:n,height:r,top:o,left:e,right:e+n,bottom:o+r,x:e,y:o}}function Lt(t,e,o){let{reference:n,floating:r}=t,a=V(e),c=bt(e),f=pt(c),m=$(e),g=a==="y",h=n.x+n.width/2-r.width/2,i=n.y+n.height/2-r.height/2,l=n[f]/2-r[f]/2,s;switch(m){case"top":s={x:h,y:n.y-r.height};break;case"bottom":s={x:h,y:n.y+n.height};break;case"right":s={x:n.x+n.width,y:i};break;case"left":s={x:n.x-r.width,y:i};break;default:s={x:n.x,y:n.y}}switch(G(e)){case"start":s[c]-=l*(o&&g?-1:1);break;case"end":s[c]+=l*(o&&g?-1:1);break}return s}async function Pt(t,e){var o;e===void 0&&(e={});let{x:n,y:r,platform:a,rects:c,elements:f,strategy:m}=t,{boundary:g="clippingAncestors",rootBoundary:h="viewport",elementContext:i="floating",altBoundary:l=!1,padding:s=0}=X(e,t),u=Ct(s),y=f[l?i==="floating"?"reference":"floating":i],p=I(await a.getClippingRect({element:(o=await(a.isElement==null?void 0:a.isElement(y)))==null||o?y:y.contextElement||await(a.getDocumentElement==null?void 0:a.getDocumentElement(f.floating)),boundary:g,rootBoundary:h,strategy:m})),v=i==="floating"?{x:n,y:r,width:c.floating.width,height:c.floating.height}:c.reference,d=await(a.getOffsetParent==null?void 0:a.getOffsetParent(f.floating)),w=await(a.isElement==null?void 0:a.isElement(d))?await(a.getScale==null?void 0:a.getScale(d))||{x:1,y:1}:{x:1,y:1},O=I(a.convertOffsetParentRelativeRectToViewportRelativeRect?await a.convertOffsetParentRelativeRectToViewportRelativeRect({elements:f,rect:v,offsetParent:d,strategy:m}):v);return{top:(p.top-O.top+u.top)/w.y,bottom:(O.bottom-p.bottom+u.bottom)/w.y,left:(p.left-O.left+u.left)/w.x,right:(O.right-p.right+u.right)/w.x}}var re=50,Dt=async(t,e,o)=>{let{placement:n="bottom",strategy:r="absolute",middleware:a=[],platform:c}=o,f=c.detectOverflow?c:{...c,detectOverflow:Pt},m=await(c.isRTL==null?void 0:c.isRTL(e)),g=await c.getElementRects({reference:t,floating:e,strategy:r}),{x:h,y:i}=Lt(g,n,m),l=n,s=0,u={};for(let b=0;b<a.length;b++){let y=a[b];if(!y)continue;let{name:p,fn:v}=y,{x:d,y:w,data:O,reset:T}=await v({x:h,y:i,initialPlacement:n,placement:l,strategy:r,middlewareData:u,rects:g,platform:f,elements:{reference:t,floating:e}});h=d??h,i=w??i,u[p]={...u[p],...O},T&&s<re&&(s++,typeof T=="object"&&(T.placement&&(l=T.placement),T.rects&&(g=T.rects===!0?await c.getElementRects({reference:t,floating:e,strategy:r}):T.rects),{x:h,y:i}=Lt(g,l,m)),b=-1)}return{x:h,y:i,placement:l,strategy:r,middlewareData:u}};var Mt=function(t){return t===void 0&&(t={}),{name:"flip",options:t,async fn(e){var o,n;let{placement:r,middlewareData:a,rects:c,initialPlacement:f,platform:m,elements:g}=e,{mainAxis:h=!0,crossAxis:i=!0,fallbackPlacements:l,fallbackStrategy:s="bestFit",fallbackAxisSideDirection:u="none",flipAlignment:b=!0,...y}=X(t,e);if((o=a.arrow)!=null&&o.alignmentOffset)return{};let p=$(r),v=V(f),d=$(f)===f,w=await(m.isRTL==null?void 0:m.isRTL(g.floating)),O=l||(d||!b?[it(f)]:St(f)),T=u!=="none";!l&&T&&O.push(...Ft(f,b,u,w));let x=[f,...O],S=await m.detectOverflow(e,y),A=[],E=((n=a.flip)==null?void 0:n.overflows)||[];if(h&&A.push(S[p]),i){let K=Rt(r,c,w);A.push(S[K[0]],S[K[1]])}if(E=[...E,{placement:r,overflows:A}],!A.every(K=>K<=0)){var C,L;let K=(((C=a.flip)==null?void 0:C.index)||0)+1,ht=x[K];if(ht&&(!(i==="alignment"?v!==V(ht):!1)||E.every(M=>V(M.placement)===v?M.overflows[0]>0:!0)))return{data:{index:K,overflows:E},reset:{placement:ht}};let et=(L=E.filter(z=>z.overflows[0]<=0).sort((z,M)=>z.overflows[1]-M.overflows[1])[0])==null?void 0:L.placement;if(!et)switch(s){case"bestFit":{var tt;let z=(tt=E.filter(M=>{if(T){let N=V(M.placement);return N===v||N==="y"}return!0}).map(M=>[M.placement,M.overflows.Line truncated
|
||||
@@ -0,0 +1 @@
|
||||
function u({isSkippable:r,isStepPersistedInQueryString:n,livewireId:d,schemaKey:c,startStep:o,stepQueryStringKey:h}){let l;return{boundResetHandler:null,step:null,init(){l=this.$nextStep;let t=this.getSteps(),e=new URLSearchParams(window.location.search).get(h);this.step=n&&t.includes(e)?e:t.at(o-1),this.$watch("step",()=>{this.updateQueryString(),this.autofocusFields()}),this.autofocusFields(!0),this.boundResetHandler=s=>{s.detail.livewireId!==d||s.detail.schemaKey!==c||n||this.$nextTick(()=>{this.step=this.getSteps().at(o-1)??this.step})},window.addEventListener("reset-schema-component-state",this.boundResetHandler)},async requestNextStep(){await l({currentStepIndex:this.getStepIndex(this.step),currentStepKey:this.step})},goToNextStep(t=null,e=null){if(!(e!==null&&this.step!==e)){if(t===null){let s=this.getStepIndex(this.step);if(s===-1)return;t=this.getSteps()[s+1]}this.getSteps().includes(t)&&(this.step=t,this.scroll())}},goToPreviousStep(){let t=this.getStepIndex(this.step)-1;t<0||(this.step=this.getSteps()[t],this.scroll())},goToStep(t){let e=this.getStepIndex(t);e<=-1||!r&&e>this.getStepIndex(this.step)||(this.step=t,this.scroll())},scroll(){this.$nextTick(()=>{this.$refs.header?.children[this.getStepIndex(this.step)].scrollIntoView({behavior:"smooth",block:"start"})})},autofocusFields(t=!1){this.$nextTick(()=>{let e=this.$el.closest(".fi-sc-wizard");if(t&&document.activeElement&&document.activeElement!==document.body&&e.compareDocumentPosition(document.activeElement)&Node.DOCUMENT_POSITION_PRECEDING)return;let s=Array.from(e.children).find(i=>i.getAttribute("x-ref")===`step-${this.step}`)?.querySelectorAll("[autofocus]")??[];for(let i of s)if(i.focus(),document.activeElement===i)break})},getStepIndex(t){return this.getSteps().findIndex(e=>e===t)},getSteps(){return JSON.parse(this.$refs.stepsData.value)},isFirstStep(){return this.getStepIndex(this.step)<=0},isLastStep(){return this.getStepIndex(this.step)+1>=this.getSteps().length},isStepAccessible(t){return this.getStepIndex(t)!==-1&&(r||this.getStepIndex(this.step)>this.getStepIndex(t))},updateQueryString(){if(!n)return;let t=new URL(window.location.href);t.searchParams.set(h,this.step),history.replaceState(null,document.title,t.toString())},destroy(){this.boundResetHandler&&window.removeEventListener("reset-schema-component-state",this.boundResetHandler)}}}export{u as default};
|
||||
Loaded 100 of 253 files, more files were not shown because too many files have changed in this diff.
Show more
Reference in new issue
Block a user