Compare commits
56
Commits
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
454cece1d8 | ||
|
|
c49acd74de | ||
|
|
965b7e660b | ||
|
|
8c7f65abf5 | ||
|
|
507d643aee | ||
|
|
f1a0d6a2b1 | ||
|
|
f74c850e01 | ||
|
|
9d6d39fe62 | ||
|
|
a9851847fc | ||
|
|
d1c896acf4 | ||
|
|
f99aadee83 | ||
|
|
8cd80c016f | ||
|
|
ef29e4d261 | ||
|
|
0725366dd5 | ||
|
|
a2bcd10607 | ||
|
|
37ed966ac3 | ||
|
|
085c307137 | ||
|
|
d961d910d8 | ||
|
|
1dc6d541cc | ||
|
|
7fef89b778 | ||
|
|
6b713e4ffb | ||
|
|
b52a91bf52 | ||
|
|
e8d8340448 | ||
|
|
81371c41a7 | ||
|
|
3cf5f0173b | ||
|
|
65844e030d | ||
|
|
ba7e4ab151 | ||
|
|
ec4e578aee | ||
|
|
1a5f300a78 | ||
|
|
a04cdd753d | ||
|
|
daa4b268a6 | ||
|
|
a5161cb6b4 | ||
|
|
48e32bfdcb | ||
|
|
639ee895cd | ||
|
|
8cf1dd9bfd | ||
|
|
fcadc8d7a1 | ||
|
|
1e2f941f47 | ||
|
|
eeee2afc05 | ||
|
|
98efb76f7b | ||
|
|
dff3748623 | ||
|
|
93a16ee916 | ||
|
|
8b3a3964a5 | ||
|
|
43dd36e20e | ||
|
|
5587e8b4b6 | ||
|
|
16e50e2d49 | ||
|
|
bd01e5c32c | ||
|
|
e058ceadee | ||
|
|
4a7eb217a1 | ||
|
|
57b0727788 | ||
|
|
58b047edd2 | ||
|
|
a78b699a5e | ||
|
|
e910ae9878 | ||
|
|
362c649d36 | ||
|
|
852c4d608d | ||
|
|
aa59e55a41 | ||
|
|
348bad80e0 |
No files matched your search
@@ -6,3 +6,4 @@ front/node_modules
|
||||
front/npm-debug.log
|
||||
/.idea
|
||||
/.vscode
|
||||
/.claude
|
||||
@@ -0,0 +1,4 @@
|
||||
{
|
||||
"$schema": "/phpactor.schema.json",
|
||||
"language_server_phpstan.enabled": false
|
||||
}
|
||||
+3
-9
@@ -6,17 +6,12 @@
|
||||
"require": {
|
||||
"ext-xml": "*",
|
||||
"ext-zip": "*",
|
||||
"ext-sqlite3": "*",
|
||||
"ext-imagick": "*",
|
||||
"ext-pdo": "*",
|
||||
"php": "^8.3",
|
||||
"guzzlehttp/guzzle": "^7.2",
|
||||
"intervention/image": "^2.7",
|
||||
"phpoption/phpoption": "^1.9",
|
||||
"spatie/image-optimizer": "^1.6",
|
||||
"php": "^8.4",
|
||||
"spatie/image-optimizer": "^1.8",
|
||||
"staudenmeir/laravel-cte": "^1.0",
|
||||
"mustache/mustache": "^2.14"
|
||||
|
||||
"intervention/image": "^4.0"
|
||||
},
|
||||
"require-dev": {
|
||||
"phpstan/phpstan": "^1.8",
|
||||
@@ -40,5 +35,4 @@
|
||||
},
|
||||
"minimum-stability": "stable",
|
||||
"prefer-stable": true
|
||||
|
||||
}
|
||||
Generated
+724
-1282
File diff suppressed because it is too large.
Load diff
+145
-298
@@ -5,374 +5,221 @@ include_toc: true
|
||||
|
||||
# Fields
|
||||
|
||||
Fields are similar to a table's columns in a relational databases.
|
||||
Fields define the columns of a schema. Each field has a `ui` type that controls both storage and the admin UI component rendered.
|
||||
|
||||
## Available fields for Collections and Files
|
||||
## Common Optional Properties
|
||||
|
||||
Most fields share these optional properties:
|
||||
|
||||
| Property | Description |
|
||||
|---|---|
|
||||
| `required` | Whether the field must have a value to save as `published` |
|
||||
| `nullable` | Allow saving as `null` |
|
||||
| `help` | Help text shown below the input |
|
||||
| `default` | Default value when creating a new record |
|
||||
| `readonly` | Prevent editing from the UI |
|
||||
| `group` | Tab group this field belongs to |
|
||||
|
||||
|
||||
## Field Types
|
||||
|
||||
### text
|
||||
One-line text input
|
||||
|
||||
required
|
||||
One-line text input.
|
||||
|
||||
- **name**: The id of the field
|
||||
- **label**: The friendly name of the field
|
||||
**Required:** `name`, `label`
|
||||
|
||||
optional
|
||||
| Property | Description |
|
||||
|---|---|
|
||||
| `min` | Minimum character count |
|
||||
| `max` | Maximum character count |
|
||||
| `selectOptions` | Array of options. Strings or `[{value, label}]` objects |
|
||||
| `optionsFrom` | Schema name to load options from |
|
||||
| `optionsField` | Field from `optionsFrom` to use as the value |
|
||||
| `optionsSuggest` | Allow typing new values not in the options list |
|
||||
|
||||
- **required**: Is the field required to save the record
|
||||
- **nullable**: Can the field be saved as null
|
||||
- **min**: Minimum characters
|
||||
- **max**: Maximum characters
|
||||
- **help**: Help text
|
||||
- **default**: Default value when creating new record
|
||||
- **readonly**: Cannot edit this value from the UI
|
||||
- **optionsFrom**: Schema to choose options from
|
||||
- **optionsField**: Field's value to insert
|
||||
- **optionsSuggest**: Allow to insert new values
|
||||
- **selectOptions**: Array of options to select from. Or array of objects `[{value,label}]`
|
||||
- **group**: The group that this field belongs to
|
||||
---
|
||||
|
||||
### textarea
|
||||
textarea input
|
||||
|
||||
required
|
||||
Multi-line text input.
|
||||
|
||||
- **name**: The id of the field
|
||||
- **label**: The friendly name of the field
|
||||
**Required:** `name`, `label`
|
||||
|
||||
optional
|
||||
| Property | Description |
|
||||
|---|---|
|
||||
| `min` | Minimum character count |
|
||||
| `max` | Maximum character count |
|
||||
|
||||
- **required**: Is the field required to save the record
|
||||
- **nullable**: Can the field be saved as null
|
||||
- **min**: Minimum characters
|
||||
- **max**: Maximum characters
|
||||
- **help**: Help text
|
||||
- **default**: Default value when creating new record
|
||||
- **readonly**: Cannot edit this value from the UI
|
||||
- **group**: The group that this field belongs to
|
||||
---
|
||||
|
||||
### slug
|
||||
Slug input. Generates automatically if left empty
|
||||
|
||||
required
|
||||
Slug input. Auto-generates from a source field if left empty.
|
||||
|
||||
- **name**: The id of the field
|
||||
- **label**: The friendly name of the field
|
||||
- **source**: The source field from which it generates
|
||||
**Required:** `name`, `label`, `source`
|
||||
|
||||
optional
|
||||
| Property | Description |
|
||||
|---|---|
|
||||
| `source` | Field name to generate the slug from |
|
||||
| `min` | Minimum character count |
|
||||
| `max` | Maximum character count |
|
||||
|
||||
- **required**: Is the field required to save the record
|
||||
- **nullable**: Can the field be saved as null
|
||||
- **min**: Minimum characters
|
||||
- **max**: Maximum characters
|
||||
- **help**: Help text
|
||||
- **default**: Default value when creating new record
|
||||
- **readonly**: Cannot edit this value from the UI
|
||||
- **group**: The group that this field belongs to
|
||||
---
|
||||
|
||||
### rich
|
||||
WYSIWYG editor
|
||||
|
||||
required
|
||||
WYSIWYG rich text editor.
|
||||
|
||||
- **name**: The id of the field
|
||||
- **label**: The friendly name of the field
|
||||
**Required:** `name`, `label`
|
||||
|
||||
optional
|
||||
| Property | Description |
|
||||
|---|---|
|
||||
| `min` | Minimum character count |
|
||||
| `max` | Maximum character count |
|
||||
|
||||
- **required**: Is the field required to save the record
|
||||
- **nullable**: Can the field be saved as null
|
||||
- **min**: Minimum characters
|
||||
- **max**: Maximum characters
|
||||
- **help**: Help text
|
||||
- **default**: Default value when creating new record
|
||||
- **readonly**: Cannot edit this value from the UI
|
||||
- **group**: The group that this field belongs to
|
||||
---
|
||||
|
||||
### markdown
|
||||
|
||||
Markdown editor.
|
||||
|
||||
**Required:** `name`, `label`
|
||||
|
||||
| Property | Description |
|
||||
|---|---|
|
||||
| `min` | Minimum character count |
|
||||
| `max` | Maximum character count |
|
||||
|
||||
---
|
||||
|
||||
### number
|
||||
Any numeric value
|
||||
|
||||
required
|
||||
Numeric input.
|
||||
|
||||
- **name**: The id of the field
|
||||
- **label**: The friendly name of the field
|
||||
**Required:** `name`, `label`
|
||||
|
||||
optional
|
||||
| Property | Description |
|
||||
|---|---|
|
||||
| `decimals` | Number of decimal places. Default: `0` |
|
||||
| `min` | Minimum value |
|
||||
| `max` | Maximum value |
|
||||
| `optionsFrom` | Schema name to load options from |
|
||||
| `optionsField` | Field from `optionsFrom` to use as the value |
|
||||
| `optionsSuggest` | Allow typing new values not in the options list |
|
||||
|
||||
- **decimals**: default is 0
|
||||
- **required**: Is the field required to save the record
|
||||
- **nullable**: Can the field be saved as null
|
||||
- **min**: Minimum characters
|
||||
- **max**: Maximum characters
|
||||
- **help**: Help text
|
||||
- **default**: Default value when creating new record
|
||||
- **readonly**: Cannot edit this value from the UI
|
||||
- **optionsFrom**: Schema to choose options from
|
||||
- **optionsField**: Field's value to insert
|
||||
- **optionsSuggest**: Allow to insert new values
|
||||
- **group**: The group that this field belongs to
|
||||
---
|
||||
|
||||
### checkbox
|
||||
True or false
|
||||
|
||||
required
|
||||
Boolean true/false toggle.
|
||||
|
||||
- **name**: The id of the field
|
||||
- **label**: The friendly name of the field
|
||||
**Required:** `name`, `label`
|
||||
|
||||
optional
|
||||
|
||||
- **required**: Is the field required to save the record
|
||||
- **nullable**: Can the field be saved as null
|
||||
- **help**: Help text
|
||||
- **default**: Default value when creating new record
|
||||
- **readonly**: Cannot edit this value from the UI
|
||||
- **group**: The group that this field belongs to
|
||||
---
|
||||
|
||||
### color
|
||||
Color picker
|
||||
|
||||
required
|
||||
Color picker.
|
||||
|
||||
- **name**: The id of the field
|
||||
- **label**: The friendly name of the field
|
||||
**Required:** `name`, `label`
|
||||
|
||||
optional
|
||||
| Property | Description |
|
||||
|---|---|
|
||||
| `selectOptions` | Restrict to a predefined palette |
|
||||
| `optionsFrom` | Schema name to load options from |
|
||||
| `optionsField` | Field from `optionsFrom` to use as the value |
|
||||
| `optionsSuggest` | Allow typing new values not in the options list |
|
||||
|
||||
- **required**: Is the field required to save the record
|
||||
- **nullable**: Can the field be saved as null
|
||||
- **help**: Help text
|
||||
- **default**: Default value when creating new record
|
||||
- **readonly**: Cannot edit this value from the UI
|
||||
- **optionsFrom**: Schema to choose options from
|
||||
- **optionsField**: Field's value to insert
|
||||
- **optionsSuggest**: Allow to insert new values
|
||||
- **selectOptions**: Array of options to select from. Or array of objects `[{value,label}]`
|
||||
- **group**: The group that this field belongs to
|
||||
---
|
||||
|
||||
### date
|
||||
Date select
|
||||
|
||||
required
|
||||
Date selector. Stores as a date string.
|
||||
|
||||
- **name**: The id of the field
|
||||
- **label**: The friendly name of the field
|
||||
**Required:** `name`, `label`
|
||||
|
||||
optional
|
||||
| Property | Description |
|
||||
|---|---|
|
||||
| `min` | Minimum date |
|
||||
| `max` | Maximum date |
|
||||
| `selectOptions` | Predefined date options |
|
||||
| `optionsFrom` | Schema name to load options from |
|
||||
| `optionsField` | Field from `optionsFrom` to use as the value |
|
||||
|
||||
- **required**: Is the field required to save the record
|
||||
- **nullable**: Can the field be saved as null
|
||||
- **min**: Minimum date
|
||||
- **max**: Maximum date
|
||||
- **help**: Help text
|
||||
- **default**: Default value when creating new record
|
||||
- **readonly**: Cannot edit this value from the UI
|
||||
- **optionsFrom**: Schema to choose options from
|
||||
- **optionsField**: Field's value to insert
|
||||
- **optionsSuggest**: Allow to insert new values
|
||||
- **selectOptions**: Array of options to select from. Or array of objects `[{value,label}]`
|
||||
- **group**: The group that this field belongs to
|
||||
---
|
||||
|
||||
### datetime
|
||||
Date and time selector
|
||||
|
||||
required
|
||||
Date and time selector. Stores as an ISO 8601 string.
|
||||
|
||||
- **name**: The id of the field
|
||||
- **label**: The friendly name of the field
|
||||
**Required:** `name`, `label`
|
||||
|
||||
optional
|
||||
| Property | Description |
|
||||
|---|---|
|
||||
| `min` | Minimum datetime |
|
||||
| `max` | Maximum datetime |
|
||||
| `selectOptions` | Predefined datetime options |
|
||||
| `optionsFrom` | Schema name to load options from |
|
||||
| `optionsField` | Field from `optionsFrom` to use as the value |
|
||||
|
||||
- **required**: Is the field required to save the record
|
||||
- **nullable**: Can the field be saved as null
|
||||
- **min**: Minimum date
|
||||
- **max**: Maximum date
|
||||
- **help**: Help text
|
||||
- **default**: Default value when creating new record
|
||||
- **readonly**: Cannot edit this value from the UI
|
||||
- **optionsFrom**: Schema to choose options from
|
||||
- **optionsField**: Field's value to insert
|
||||
- **optionsSuggest**: Allow to insert new values
|
||||
- **selectOptions**: Array of options to select from. Or array of objects `[{value,label}]`
|
||||
- **group**: The group that this field belongs to
|
||||
---
|
||||
|
||||
### uuid
|
||||
|
||||
UUID text field. Stores an arbitrary UUID string. Typically used as a read-only external reference ID.
|
||||
|
||||
**Required:** `name`, `label`
|
||||
|
||||
---
|
||||
|
||||
### json
|
||||
Json data
|
||||
|
||||
required
|
||||
Raw JSON data field. Accepts either a JSON string or a plain array — both are stored as JSON.
|
||||
|
||||
- **name**: The id of the field
|
||||
- **label**: The friendly name of the field
|
||||
**Required:** `name`, `label`
|
||||
|
||||
optional
|
||||
|
||||
- **required**: Is the field required to save the record
|
||||
- **nullable**: Can the field be saved as null
|
||||
- **help**: Help text
|
||||
- **default**: Default value when creating new record
|
||||
- **readonly**: Cannot edit this value from the UI
|
||||
- **group**: The group that this field belongs to
|
||||
|
||||
### markdown
|
||||
Markdown editor
|
||||
|
||||
required
|
||||
|
||||
- **name**: The id of the field
|
||||
- **label**: The friendly name of the field
|
||||
|
||||
optional
|
||||
|
||||
- **required**: Is the field required to save the record
|
||||
- **nullable**: Can the field be saved as null
|
||||
- **min**: Minimum characters
|
||||
- **max**: Maximum characters
|
||||
- **help**: Help text
|
||||
- **default**: Default value when creating new record
|
||||
- **readonly**: Cannot edit this value from the UI
|
||||
- **group**: The group that this field belongs to
|
||||
---
|
||||
|
||||
### file
|
||||
Upload or select files
|
||||
|
||||
required
|
||||
Upload or select files from a files schema. Files can be uploaded directly or browsed from previously uploaded files. Image files (jpeg, png, webp, gif, tiff) automatically get a 300×300 thumbnail generated on upload.
|
||||
|
||||
- **name**: The id of the field
|
||||
- **label**: The friendly name of the field
|
||||
- **collections**: File collections to choose from
|
||||
**Required:** `name`, `label`, `collections`
|
||||
|
||||
optional
|
||||
|
||||
- **mime**: The mime types allowed to select
|
||||
- **nullable**: Can the field be saved as null
|
||||
- **min**: Minimum files
|
||||
- **max**: Maximum files
|
||||
- **help**: Help text
|
||||
- **group**: The group that this field belongs to
|
||||
| Property | Description |
|
||||
|---|---|
|
||||
| `collections` | Array of file schema names to choose from |
|
||||
| `mime` | Allowed MIME types e.g. `["image/*"]` |
|
||||
| `min` | Minimum number of files |
|
||||
| `max` | Maximum number of files |
|
||||
|
||||
---
|
||||
|
||||
### reference
|
||||
Reference other records
|
||||
|
||||
required
|
||||
Reference records from another collection.
|
||||
|
||||
- **name**: The id of the field
|
||||
- **label**: The friendly name of the field
|
||||
- **collections**: Collections to choose from
|
||||
**Required:** `name`, `label`, `collections`
|
||||
|
||||
optional
|
||||
| Property | Description |
|
||||
|---|---|
|
||||
| `collections` | Array of collection schema names to reference |
|
||||
| `min` | Minimum number of references |
|
||||
| `max` | Maximum number of references |
|
||||
|
||||
- **nullable**: Can the field be saved as null
|
||||
- **min**: Minimum files
|
||||
- **max**: Maximum files
|
||||
- **help**: Help text
|
||||
- **group**: The group that this field belongs to
|
||||
---
|
||||
|
||||
## Example Field
|
||||
|
||||
### block
|
||||
The block editor
|
||||
|
||||
required
|
||||
|
||||
- **name**: The id of the field
|
||||
- **label**: The friendly name of the field
|
||||
- **schema**: The block schema name
|
||||
|
||||
optional
|
||||
|
||||
- **required**: Is the field required to save the record
|
||||
- **nullable**: Can the field be saved as null
|
||||
- **help**: Help text
|
||||
- **default**: Default value when creating new record
|
||||
- **readonly**: Cannot edit this value from the UI
|
||||
- **group**: The group that this field belongs to
|
||||
|
||||
)
|
||||
## Available fields for the Block Editor
|
||||
|
||||
### heading
|
||||
Single-line text
|
||||
|
||||
required
|
||||
|
||||
- **name**: The id of the field
|
||||
- **label**: The friendly name of the field
|
||||
|
||||
optional
|
||||
|
||||
- **min**: Minimum date
|
||||
- **max**: Maximum date
|
||||
- **default**: Default value when creating new record
|
||||
|
||||
### textarea
|
||||
Multiline text
|
||||
|
||||
required
|
||||
|
||||
- **name**: The id of the field
|
||||
- **label**: The friendly name of the field
|
||||
|
||||
optional
|
||||
|
||||
- **min**: Minimum date
|
||||
- **max**: Maximum date
|
||||
- **default**: Default value when creating new record
|
||||
|
||||
### rich
|
||||
WYSIWYG editor
|
||||
|
||||
required
|
||||
|
||||
- **name**: The id of the field
|
||||
- **label**: The friendly name of the field
|
||||
|
||||
optional
|
||||
|
||||
- **min**: Minimum date
|
||||
- **max**: Maximum date
|
||||
- **default**: Default value when creating new record
|
||||
|
||||
|
||||
### markdown
|
||||
Markdown editor
|
||||
|
||||
required
|
||||
|
||||
- **name**: The id of the field
|
||||
- **label**: The friendly name of the field
|
||||
|
||||
optional
|
||||
|
||||
- **min**: Minimum date
|
||||
- **max**: Maximum date
|
||||
- **default**: Default value when creating new record
|
||||
|
||||
### file
|
||||
Choose files
|
||||
|
||||
required
|
||||
|
||||
- **name**: The id of the field
|
||||
- **label**: The friendly name of the field
|
||||
- **collections**: File collections to choose from
|
||||
|
||||
optional
|
||||
- **mime**: The mime types allowed to select
|
||||
- **min**: Minimum date
|
||||
- **max**: Maximum date
|
||||
- **default**: Default value when creating new record
|
||||
|
||||
### reference
|
||||
Choose files
|
||||
|
||||
required
|
||||
|
||||
- **name**: The id of the field
|
||||
- **label**: The friendly name of the field
|
||||
- **collections**: Collections to choose from
|
||||
|
||||
optional
|
||||
- **min**: Minimum date
|
||||
- **max**: Maximum date
|
||||
- **default**: Default value when creating new record
|
||||
```json
|
||||
{
|
||||
"ui": "text",
|
||||
"name": "title",
|
||||
"label": "Title",
|
||||
"required": true,
|
||||
"min": 3,
|
||||
"max": 200,
|
||||
"help": "The main title of the post"
|
||||
}
|
||||
```
|
||||
+133
-52
@@ -5,88 +5,169 @@ include_toc: true
|
||||
|
||||
# Queries
|
||||
|
||||
## Graph or Tree
|
||||
|
||||
Queries can return results in 2 formats. A graph or a tree.
|
||||
|
||||
Graphs results are a collection of records (nodes) and a collection of edges. This format is more useful for network visualization.
|
||||
|
||||
The tree format is more straightforward as it returns a collection of records. Each record has a **_children** and a **_parents** field and the tree can continue upwards or downwards according to the depth you have requested.
|
||||
|
||||
For example to request records with their children and their children's children:
|
||||
The `Query` class is the main way to fetch records. Inject it via the Laravel container.
|
||||
|
||||
```php
|
||||
$query->childrenDepth(2);
|
||||
public function __construct(private Query $query) {}
|
||||
```
|
||||
Maybe you only want to get a specific type of relationship:
|
||||
|
||||
```php
|
||||
$query->childrenDepth(2)->childrenFields(["categories"]);
|
||||
```
|
||||
## Return Formats
|
||||
|
||||
Queries return results in two formats:
|
||||
|
||||
**Graph** — via `->run()`. Returns a `Graph` object with `records` and `edges` collections. Useful for network-style data.
|
||||
|
||||
**Tree** — via `->tree()`. Returns a flat `Collection` of records where each record has `_children` and `_parents` arrays populated based on the requested depth. This is the most common format.
|
||||
|
||||
## Chaining Methods
|
||||
|
||||
All methods return `$this` and can be chained:
|
||||
|
||||
| Method | Description |
|
||||
|---|---|
|
||||
| `->filter(array)` | Add an AND filter |
|
||||
| `->orFilter(array)` | Add an OR filter (grouped) |
|
||||
| `->limit(int)` | Max number of root records to return |
|
||||
| `->skip(int)` | Offset for pagination |
|
||||
| `->sort(string)` | Sort by field. Prefix with `-` for descending e.g. `"-_sys.updatedAt"` |
|
||||
| `->status(array)` | Filter by status array e.g. `["published", "draft"]` |
|
||||
| `->onlyPublished()` | Shorthand for `->status(["published"])` |
|
||||
| `->childrenDepth(int)` | How many levels of children to load |
|
||||
| `->childrenLimit(int)` | Max children per record |
|
||||
| `->childrenFields(array)` | Only follow specific relationship fields |
|
||||
| `->parentsDepth(int)` | How many levels of parents to load |
|
||||
| `->parentsLimit(int)` | Max parents per record |
|
||||
| `->parentFields(array)` | Only follow specific relationship fields |
|
||||
| `->notLinked(string)` | Return only records with no parents |
|
||||
| `->run()` | Execute and return a `Graph` |
|
||||
| `->tree()` | Execute and return a `Collection` (tree format) |
|
||||
| `->runWithCount()` | Execute and return a `Graph` with a `total` count |
|
||||
|
||||
|
||||
## Filters
|
||||
|
||||
You can filter your query with the following format:
|
||||
Filter keys use the format `field_operator`. When no operator suffix is given, `eq` is assumed.
|
||||
|
||||
```php
|
||||
$query->filter(["field_operator" => "value"]);
|
||||
|
||||
// example:
|
||||
// No operator = eq
|
||||
$query->filter(["schema" => "blogPosts"]);
|
||||
|
||||
$query->filter(["date_lt" => "2020-09-15"]);
|
||||
// With operator
|
||||
$query->filter(["_sys.updatedAt_gte" => "2024-01-01"]);
|
||||
```
|
||||
|
||||
Or filters are also available:
|
||||
### Operator Reference
|
||||
|
||||
| Operator | Description |
|
||||
|---|---|
|
||||
| _(none)_ or `eq` | Equals (string) |
|
||||
| `ne` | Not equals (string) |
|
||||
| `eqnum` | Equals (numeric) |
|
||||
| `neqnum` | Not equals (numeric) |
|
||||
| `eqtrue` | Equals `true` |
|
||||
| `eqfalse` | Equals `false` |
|
||||
| `netrue` | Not equals `true` |
|
||||
| `nefalse` | Not equals `false` |
|
||||
| `regex` | Regular expression match |
|
||||
| `in` | Value is in array (strings) |
|
||||
| `nin` | Value is not in array (strings) |
|
||||
| `innum` | Value is in array (numeric) |
|
||||
| `ninnum` | Value is not in array (numeric) |
|
||||
| `lt` | Less than |
|
||||
| `lte` | Less than or equal |
|
||||
| `gt` | Greater than |
|
||||
| `gte` | Greater than or equal |
|
||||
| `null` | Field is null |
|
||||
| `nnull` | Field is not null |
|
||||
| `exists` | Field key exists |
|
||||
| `nexists` | Field key does not exist |
|
||||
| `filter` | Raw filter passthrough |
|
||||
|
||||
### OR Filters
|
||||
|
||||
```php
|
||||
$query
|
||||
->filter(["price_eqn" => 10])
|
||||
->orFilter(["title_regex" => "search", "slug_regex" => "search"])
|
||||
;
|
||||
->filter(["schema" => "blogPosts"])
|
||||
->orFilter(["title_regex" => "search", "slug_regex" => "search"]);
|
||||
```
|
||||
## Operator List
|
||||
|
||||
- regex
|
||||
- eq
|
||||
- ne
|
||||
- eqnum
|
||||
- neqnum
|
||||
- filter
|
||||
- eqtrue
|
||||
- eqfalse
|
||||
- netrue
|
||||
- nefalse
|
||||
- in:
|
||||
- innum
|
||||
- nin
|
||||
- ninnum
|
||||
- lt
|
||||
- lte
|
||||
- gt
|
||||
- gte
|
||||
- null
|
||||
- nnull
|
||||
- exists
|
||||
- nexists
|
||||
Each `orFilter` call groups its arguments with OR between them. Multiple `orFilter` / `filter` calls are AND-ed together.
|
||||
|
||||
## Example
|
||||
### Cross-Schema (Children) Filters
|
||||
|
||||
Get 10 posts from the sports category as a tree
|
||||
You can filter records by properties of their related records using the `children.` prefix:
|
||||
|
||||
```php
|
||||
$query->filter([
|
||||
"schema" => "blogPosts",
|
||||
"children.categories.data.slug" => "sports",
|
||||
]);
|
||||
```
|
||||
|
||||
This returns `blogPosts` that have a child in `categories` where `slug` equals `sports`.
|
||||
|
||||
|
||||
## Nested Data Fields
|
||||
|
||||
Use dot notation to filter on JSON data fields and system fields:
|
||||
|
||||
```php
|
||||
// Filter on a data field
|
||||
$query->filter(["data.status_eq" => "draft"]);
|
||||
|
||||
// Filter on a system field
|
||||
$query->filter(["_sys.updatedAt_gte" => "2024-01-01"]);
|
||||
```
|
||||
|
||||
|
||||
## Examples
|
||||
|
||||
**Get published blog posts, newest first:**
|
||||
|
||||
```php
|
||||
$posts = $query
|
||||
->filter(["schema" => "blogPosts"])
|
||||
->onlyPublished()
|
||||
->sort("-_sys.updatedAt")
|
||||
->limit(10)
|
||||
->tree();
|
||||
```
|
||||
|
||||
**Get posts from a specific category with children loaded:**
|
||||
|
||||
```php
|
||||
$posts = $query
|
||||
->filter([
|
||||
"schema" => "posts",
|
||||
"schema" => "blogPosts",
|
||||
"children.categories.data.slug" => "sports",
|
||||
]
|
||||
)
|
||||
])
|
||||
->childrenDepth(1)
|
||||
->childrenFields(["categories"])
|
||||
->limit(10)
|
||||
->tree();
|
||||
|
||||
$posts->map(...)->toArray();
|
||||
|
||||
```
|
||||
|
||||
**Paginate records:**
|
||||
|
||||
```php
|
||||
$graph = $query
|
||||
->filter(["schema" => "blogPosts"])
|
||||
->limit(20)
|
||||
->skip(40)
|
||||
->runWithCount();
|
||||
|
||||
$posts = $graph->tree();
|
||||
$total = $graph->total;
|
||||
```
|
||||
|
||||
**Search across fields:**
|
||||
|
||||
```php
|
||||
$results = $query
|
||||
->filter(["schema" => "blogPosts"])
|
||||
->orFilter(["title_regex" => $term, "slug_regex" => $term])
|
||||
->limit(10)
|
||||
->tree();
|
||||
```
|
||||
+77
-38
@@ -5,70 +5,106 @@ include_toc: true
|
||||
|
||||
# Schemas
|
||||
|
||||
Schemas define both the shape of your data and how the UI on the admin will behave.
|
||||
Schemas define both the shape of your data and how the admin UI behaves.
|
||||
|
||||
There are 3 types of schemas
|
||||
There are 2 types of schemas:
|
||||
|
||||
- Collections: Normal data
|
||||
- Files: Images and files
|
||||
- Block: Used in the block editor
|
||||
- **collection** — Regular data records
|
||||
- **files** — Images and file uploads
|
||||
|
||||
|
||||
## Collection Reference
|
||||
|
||||
- **name**: The ID of the collection. Camelcase and plural is the recommended format ex. blogPosts
|
||||
- **label**: The friendly name of the schema
|
||||
- **type**: The type of the collection. Should be "collection"
|
||||
- **visible**: An array of field id to show on the content browser _optional_
|
||||
- **groups**: A list if group ids to separate your field in different tabs _optional_
|
||||
- **fields**: The list of your fields. Look the field reference for more
|
||||
- **isEntry**: If this schema is important, it will show be visible on the main the sidebar. Default: false _optional_
|
||||
- **sortBy**: The default sorting in the content browser _optional_
|
||||
- **cardTitle**: Mustache code to customize the preview field _optional_
|
||||
- **cardImage**: Field name of image you want to use as a preview image _optional_
|
||||
- **revisions**: How many revisions are going to be kept for each record _optional_
|
||||
- **read**: Array of user groups that have read permissions _optional_
|
||||
- **write**: Array of user groups that have write permissions _optional_
|
||||
| Field | Required | Description |
|
||||
|---|---|---|
|
||||
| `name` | yes | Unique ID. Use camelCase plural e.g. `blogPosts` |
|
||||
| `label` | yes | Friendly display name |
|
||||
| `type` | yes | Must be `"collection"` |
|
||||
| `fields` | yes | Array of field definitions. See [Fields](Fields.md) |
|
||||
| `visible` | no | Field IDs to show in the content browser list |
|
||||
| `groups` | no | Group IDs to split fields into tabs |
|
||||
| `isEntry` | no | Show in sidebar. Default: `false` |
|
||||
| `sortBy` | no | Default sort in browser. Prefix with `-` for descending e.g. `-_sys.updatedAt` |
|
||||
| `cardTitle` | no | Mustache template for the record preview title e.g. `{{name}} - {{slug}}` |
|
||||
| `cardImage` | no | Field name to use as the preview image |
|
||||
| `revisions` | no | Number of revisions to keep per record. Default: `0` (disabled) |
|
||||
| `read` | no | Roles with read access. Empty means all roles can read |
|
||||
| `write` | no | Roles with write access. Empty means all roles can write |
|
||||
|
||||
|
||||
## Files Reference
|
||||
|
||||
- **name**: The ID of the collection. Camelcase and plural is the recommended format ex. blogPosts
|
||||
- **label**: The friendly name of the schema
|
||||
- **type**: The type of the collection. Should be "files"
|
||||
- **path**: The relative directory that these files will be stored.
|
||||
- **groups**: A list if group ids to separate your field in different tabs _optional_
|
||||
- **fields**: The list of your fields. Look the field reference for more
|
||||
- **isEntry**: If this schema is important, it will show be visible on the main the sidebar _optional_
|
||||
- **sortBy**: The default sorting in the content browser _optional_
|
||||
- **cardTitle**: Mustache code to customize the preview field _optional_
|
||||
- **revisions**: How many revisions are going to be kept for each record _optional_
|
||||
- **read**: Array of user groups that have read permissions _optional_
|
||||
- **write**: Array of user groups that have write permissions _optional_
|
||||
| Field | Required | Description |
|
||||
|---|---|---|
|
||||
| `name` | yes | Unique ID. Use camelCase plural e.g. `heroImages` |
|
||||
| `label` | yes | Friendly display name |
|
||||
| `type` | yes | Must be `"files"` |
|
||||
| `fields` | yes | Array of field definitions. See [Fields](Fields.md) |
|
||||
| `groups` | no | Group IDs to split fields into tabs |
|
||||
| `isEntry` | no | Show in sidebar. Default: `false` |
|
||||
| `sortBy` | no | Default sort in browser |
|
||||
| `cardTitle` | no | Mustache template for the record preview title |
|
||||
| `cardImage` | no | Field name to use as the preview image |
|
||||
| `revisions` | no | Number of revisions to keep per record |
|
||||
| `read` | no | Roles with read access |
|
||||
| `write` | no | Roles with write access |
|
||||
|
||||
### File Metadata
|
||||
|
||||
Every uploaded file is automatically stored with the following metadata (stored in `lucent_files`):
|
||||
|
||||
| Field | Description |
|
||||
|---|---|
|
||||
| `id` | Unique file ID |
|
||||
| `recordId` | ID of the record this file belongs to |
|
||||
| `originalName` | Original filename as uploaded |
|
||||
| `mime` | MIME type e.g. `image/webp` |
|
||||
| `path` | Storage path e.g. `files/{recordId}/{filename}` |
|
||||
| `size` | File size in bytes |
|
||||
| `width` | Image width in pixels (0 for non-images) |
|
||||
| `height` | Image height in pixels (0 for non-images) |
|
||||
| `checksum` | SHA-1 hash of the file contents |
|
||||
|
||||
Image files (jpeg, png, webp, gif, tiff) also get a 300×300 thumbnail generated automatically at `thumbs/{path}`, plus any image filter presets configured in `lucent.imageFilters`.
|
||||
|
||||
|
||||
A full Collection example without the fields:
|
||||
## System Fields
|
||||
|
||||
Every record automatically has these read-only system fields available in queries:
|
||||
|
||||
| Field | Description |
|
||||
|---|---|
|
||||
| `_sys.createdAt` | ISO 8601 creation timestamp |
|
||||
| `_sys.updatedAt` | ISO 8601 last update timestamp |
|
||||
| `_sys.createdBy` | User ID who created the record |
|
||||
| `_sys.updatedBy` | User ID who last updated the record |
|
||||
| `_sys.version` | Revision version number |
|
||||
| `status` | `draft` or `published` |
|
||||
|
||||
|
||||
## Example
|
||||
|
||||
```json
|
||||
{
|
||||
"label": "Departments",
|
||||
"name": "departments",
|
||||
"schemas": [
|
||||
{
|
||||
"label": "Blog Posts",
|
||||
"name": "blogPosts",
|
||||
"isEntry": true,
|
||||
"type": "collection",
|
||||
"visible": [
|
||||
"title",
|
||||
"slug",
|
||||
"cover",
|
||||
"_sys.updatedAt",
|
||||
"status"
|
||||
],
|
||||
"groups": [
|
||||
"Extra Info",
|
||||
"Metadata",
|
||||
"Content",
|
||||
"SEO"
|
||||
],
|
||||
"sortBy": "-_sys.createdAt",
|
||||
"schemaTitle": "{{name}} {{slug}}",
|
||||
"schemaImage": "cover",
|
||||
"cardTitle": "{{title}}",
|
||||
"cardImage": "cover",
|
||||
"revisions": 15,
|
||||
"read": [
|
||||
"admin",
|
||||
@@ -80,5 +116,8 @@ A full Collection example without the fields:
|
||||
"editors"
|
||||
],
|
||||
"fields": []
|
||||
}
|
||||
],
|
||||
"roles": ["admin", "editors", "reviewers"]
|
||||
}
|
||||
```
|
||||
+82
-23
@@ -5,51 +5,94 @@ To generate the static content of the website, lucent provides a helper class.
|
||||
|
||||
## Laravel Command
|
||||
|
||||
Just create a command and name it as you like. Make sure to inject the StaticGenerator class.
|
||||
Create an Artisan command and inject `StaticGenerator`:
|
||||
|
||||
```php
|
||||
public function __construct(
|
||||
class GenerateStatic extends Command
|
||||
{
|
||||
protected $signature = 'generate:static';
|
||||
|
||||
public function __construct(
|
||||
public StaticGenerator $staticGenerator,
|
||||
) {
|
||||
public Context $ctx,
|
||||
) {
|
||||
parent::__construct();
|
||||
}
|
||||
|
||||
public function handle(): void
|
||||
{
|
||||
$this->staticGenerator->run('generate:static', function ($writer) {
|
||||
$writer->save("/", $this->ctx->render("homepage"));
|
||||
$writer->save("/about", $this->ctx->render("about"));
|
||||
});
|
||||
}
|
||||
}
|
||||
```
|
||||
|
||||
## Redirect command
|
||||
`run(string $signature, callable $callback)` — the first argument must match the command's artisan signature. This is used to stream live build logs in the Lucent UI. The callback receives a `Writer` instance.
|
||||
|
||||
There are cases which is useful to create a redirect like when you have a multilingual website:
|
||||
|
||||
## Writer: save
|
||||
|
||||
Writes an HTML file at the given path:
|
||||
|
||||
```php
|
||||
$this->staticGenerator->run(function ($writer) {
|
||||
$writer->createRedirect("/", "/el");
|
||||
});
|
||||
$writer->save("/blog/my-post", $html);
|
||||
// writes to: storage/lucent/build/blog/my-post/index.html
|
||||
```
|
||||
|
||||
## The Writer save command
|
||||
An optional third argument changes the file extension (default `"html"`).
|
||||
|
||||
In order to create an html file, you have to use the writer's save command
|
||||
|
||||
The first argument is the url and the second is the rendered HTML. That's where the page classes do come handy.
|
||||
## Writer: createRedirect
|
||||
|
||||
Generates an HTML meta-refresh redirect. Useful for root-level locale redirects:
|
||||
|
||||
```php
|
||||
$this->staticGenerator->run(function ($writer) {
|
||||
$writer->save("/", $this->ctx->render("homepage"));
|
||||
$writer->save("/about", $this->ctx->render("about"));
|
||||
});
|
||||
$writer->createRedirect("/", "/el");
|
||||
$writer->createRedirect("/", "/el", "Redirecting", "Please wait...");
|
||||
```
|
||||
|
||||
Arguments: `from`, `to`, `title` (default `"Redirecting"`), `message` (default `"Redirecting Soon..."`).
|
||||
|
||||
|
||||
## Writer: recordIterator
|
||||
|
||||
Iterates over all records in paginated batches — useful when there are too many records to load at once:
|
||||
|
||||
```php
|
||||
$writer->recordIterator(
|
||||
query: fn(int $limit, int $skip) => $query
|
||||
->filter(["schema" => "blogPosts"])
|
||||
->onlyPublished()
|
||||
->limit($limit)
|
||||
->skip($skip)
|
||||
->tree(),
|
||||
parser: function ($records) use ($writer) {
|
||||
foreach ($records as $record) {
|
||||
$writer->save(
|
||||
"/blog/" . $record->data->slug,
|
||||
$this->ctx->render("blogPost", $record),
|
||||
);
|
||||
}
|
||||
},
|
||||
);
|
||||
```
|
||||
|
||||
Signature: `recordIterator(callable $query, callable $parser, int $skip = 0, int $limit = 100): int`
|
||||
|
||||
The `$query` callable receives `($limit, $skip)` and must return a collection. Iteration stops automatically when a batch returns zero records.
|
||||
|
||||
|
||||
## Storage and Permissions
|
||||
|
||||
All the generated html is stored on `storage/lucent/live`
|
||||
In order to make it accessible you have to create symlink:
|
||||
All generated HTML is written to `storage/lucent/build` during the run, then atomically swapped to `storage/lucent/live` on completion. Create the public symlink with:
|
||||
|
||||
```bash
|
||||
php artisan lucent:livelink
|
||||
```
|
||||
|
||||
Now your static website is accessible in http://localhost:8000/live
|
||||
|
||||
But it would not be nice to have the **live** prefix everywhere. That's why you need to make the following tweak in the nginx vhost
|
||||
The static site is then accessible at `http://localhost:8000/live`. To serve it without the `/live` prefix, add this to your nginx vhost:
|
||||
|
||||
```nginxconf
|
||||
location / {
|
||||
@@ -57,14 +100,30 @@ location / {
|
||||
}
|
||||
```
|
||||
|
||||
|
||||
## Artisan Commands
|
||||
|
||||
| Command | Description |
|
||||
|---|---|
|
||||
| `lucent:setup-db` | Create all Lucent database tables |
|
||||
| `lucent:schemas` | Compile schema JSON files |
|
||||
| `lucent:livelink` | Create the `public/live` symlink |
|
||||
| `lucent:rebuild:thumbnails` | Regenerate thumbnails for all uploaded images |
|
||||
| `lucent:removeOrphanEdges` | Remove edges pointing to deleted records |
|
||||
| `lucent:generate:collection {name}` | Scaffold a new collection schema JSON file |
|
||||
|
||||
|
||||
## Build from the Lucent UI
|
||||
|
||||
In your lucent.php config file you can define your command that is used to generate the static files:
|
||||
Register your generate command in `config/lucent.php` so admin users can trigger it from the UI:
|
||||
|
||||
```php
|
||||
"generateCommand" => "generate:static"
|
||||
"commands" => [
|
||||
"generate:static" => "Generate Static Site",
|
||||
],
|
||||
```
|
||||
That way, the users will be able to initiate the build command through the user interface.
|
||||
|
||||
Only roles listed in `canBuild` can trigger commands from the UI.
|
||||
|
||||
|
||||
|
||||
|
||||
@@ -99,3 +99,113 @@ class Context
|
||||
```
|
||||
|
||||
Add the middleware inside the HTTP Kernel file.
|
||||
|
||||
## Configuration
|
||||
|
||||
After publishing the config (`php artisan vendor:publish --tag=lucent-config`), configure `config/lucent.php` via `.env`:
|
||||
|
||||
| Key | Env var | Default | Description |
|
||||
|---|---|---|---|
|
||||
| `env` | `LUCENT_ENV` | `production` | `production` or `development` |
|
||||
| `auth` | `LUCENT_AUTH` | `lucent` | Auth driver: `lucent` or `lunar` |
|
||||
| `disk` | `LUCENT_DISK` | `public` | Laravel filesystem disk for uploads |
|
||||
| `schemas_path` | `LUCENT_SCHEMAS_PATH` | `resources/lucent/schemas` | Where schema JSON files live |
|
||||
| `database` | `LUCENT_DB_CONNECTION` | `DB_CONNECTION` | Database connection name |
|
||||
| `name` | `LUCENT_NAME` | `Lucent` | CMS display name |
|
||||
| `url` | `LUCENT_URL` | `APP_URL` | Base URL of the CMS |
|
||||
| `previewTarget` | `LUCENT_PREVIEW_TARGET` | `previewTarget` | Preview route parameter |
|
||||
| `commands` | — | `[]` | Artisan commands exposed to admin users (see [Static Generator](Static%20Generator.md)) |
|
||||
| `imageFilters` | — | `[]` | Image filter presets applied to uploads (see below) |
|
||||
| `canInvite` | — | `["admin"]` | Roles that can invite new users |
|
||||
| `canBuild` | — | `["admin"]` | Roles that can trigger static builds |
|
||||
| `systemUserId` | — | `""` | User ID used for console-initiated record writes |
|
||||
|
||||
|
||||
## Image Filters
|
||||
|
||||
Image filters are Intervention Image filter classes applied to every uploaded image, producing additional versions (e.g. a cropped or watermarked variant). Each preset is stored at `templates/{name}/{original-path}` on the configured disk.
|
||||
|
||||
Define filters in `config/lucent.php`:
|
||||
|
||||
```php
|
||||
"imageFilters" => [
|
||||
"hero" => \App\ImageFilters\HeroFilter::class,
|
||||
"thumb" => \App\ImageFilters\ThumbFilter::class,
|
||||
],
|
||||
```
|
||||
|
||||
A filter class must implement `Intervention\Image\Filters\FilterInterface`:
|
||||
|
||||
```php
|
||||
namespace App\ImageFilters;
|
||||
|
||||
use Intervention\Image\Filters\FilterInterface;
|
||||
use Intervention\Image\Image;
|
||||
|
||||
class HeroFilter implements FilterInterface
|
||||
{
|
||||
public function applyFilter(Image $image): Image
|
||||
{
|
||||
return $image->fit(1200, 600)->encode('webp', 80);
|
||||
}
|
||||
}
|
||||
```
|
||||
|
||||
Every uploaded image automatically gets a 300×300 WebP thumbnail at `thumbs/{path}` in addition to any configured presets.
|
||||
|
||||
|
||||
## Authentication
|
||||
|
||||
Lucent uses **email-link (magic link) login** — no passwords. Users receive a time-limited link by email.
|
||||
|
||||
### Auth modes
|
||||
|
||||
Set `LUCENT_AUTH` to choose how users are stored:
|
||||
|
||||
| Value | Description |
|
||||
|---|---|
|
||||
| `lucent` | Users stored in the `lucent_users` table. Supports roles. |
|
||||
| `lunar` | Delegates to Lunar's `lunar_staff` table. Roles not supported. |
|
||||
|
||||
### Login flow
|
||||
|
||||
1. User submits their email at `/lucent/login`
|
||||
2. A 32-character token is stored against the user with a timestamp
|
||||
3. Lucent emails a login link containing the token
|
||||
4. User clicks the link → token is validated (must be used within **1 hour**)
|
||||
5. Session is established; token is cleared
|
||||
|
||||
### First-time setup
|
||||
|
||||
The `/lucent/register` route is only available when **no users exist** in the system. Once the first admin registers, the route returns a redirect to `/lucent/login`. Registration automatically assigns the `admin` role and sends a login link.
|
||||
|
||||
### Middleware
|
||||
|
||||
Two middleware aliases are available for your routes:
|
||||
|
||||
| Alias | Description |
|
||||
|---|---|
|
||||
| `lucent.auth` | Requires an active Lucent session |
|
||||
| `lucent.guest` | Redirects authenticated users away |
|
||||
|
||||
### Roles
|
||||
|
||||
Roles are defined in your channel config. Only roles listed there are valid — anything else is silently stripped on assignment. The `canInvite` and `canBuild` config keys control which roles can invite users and trigger builds respectively.
|
||||
|
||||
On console commands and non-`/lucent` routes, `currentUserId()` returns `config("lucent.systemUserId")` instead of the session user.
|
||||
|
||||
|
||||
## Database Tables
|
||||
|
||||
All Lucent-managed tables use the `lucent_` prefix:
|
||||
|
||||
| Table | Description |
|
||||
|---|---|
|
||||
| `lucent_records` | All collection and file schema records |
|
||||
| `lucent_files` | Uploaded file metadata |
|
||||
| `lucent_edges` | Relationships between records |
|
||||
| `lucent_revisions` | Record revision history |
|
||||
| `lucent_users` | Users (when using `lucent` auth mode) |
|
||||
| `lucent_command_logs` | Background command execution logs |
|
||||
|
||||
These are created automatically by running `php artisan lucent:setup`.
|
||||
Vendored
-342
@@ -1,342 +0,0 @@
|
||||
var AK=Object.defineProperty;var PK=(_n,Ce,ke)=>Ce in _n?AK(_n,Ce,{enumerable:!0,configurable:!0,writable:!0,value:ke}):_n[Ce]=ke;var LY=(_n,Ce,ke)=>(PK(_n,typeof Ce!="symbol"?Ce+"":Ce,ke),ke);function bind$1(_n,Ce){return function(){return _n.apply(Ce,arguments)}}const{toString:toString$1}=Object.prototype,{getPrototypeOf}=Object,kindOf=(_n=>Ce=>{const ke=toString$1.call(Ce);return _n[ke]||(_n[ke]=ke.slice(8,-1).toLowerCase())})(Object.create(null)),kindOfTest=_n=>(_n=_n.toLowerCase(),Ce=>kindOf(Ce)===_n),typeOfTest=_n=>Ce=>typeof Ce===_n,{isArray:isArray$2}=Array,isUndefined=typeOfTest("undefined");function isBuffer(_n){return _n!==null&&!isUndefined(_n)&&_n.constructor!==null&&!isUndefined(_n.constructor)&&isFunction$1(_n.constructor.isBuffer)&&_n.constructor.isBuffer(_n)}const isArrayBuffer=kindOfTest("ArrayBuffer");function isArrayBufferView(_n){let Ce;return typeof ArrayBuffer<"u"&&ArrayBuffer.isView?Ce=ArrayBuffer.isView(_n):Ce=_n&&_n.buffer&&isArrayBuffer(_n.buffer),Ce}const isString$1=typeOfTest("string"),isFunction$1=typeOfTest("function"),isNumber$1=typeOfTest("number"),isObject$1=_n=>_n!==null&&typeof _n=="object",isBoolean$1=_n=>_n===!0||_n===!1,isPlainObject=_n=>{if(kindOf(_n)!=="object")return!1;const Ce=getPrototypeOf(_n);return(Ce===null||Ce===Object.prototype||Object.getPrototypeOf(Ce)===null)&&!(Symbol.toStringTag in _n)&&!(Symbol.iterator in _n)},isDate$1=kindOfTest("Date"),isFile=kindOfTest("File"),isBlob=kindOfTest("Blob"),isFileList=kindOfTest("FileList"),isStream=_n=>isObject$1(_n)&&isFunction$1(_n.pipe),isFormData=_n=>{let Ce;return _n&&(typeof FormData=="function"&&_n instanceof FormData||isFunction$1(_n.append)&&((Ce=kindOf(_n))==="formdata"||Ce==="object"&&isFunction$1(_n.toString)&&_n.toString()==="[object FormData]"))},isURLSearchParams=kindOfTest("URLSearchParams"),[isReadableStream,isRequest,isResponse,isHeaders]=["ReadableStream","Request","Response","Headers"].map(kindOfTest),trim=_n=>_n.trim?_n.trim():_n.replace(/^[\s\uFEFF\xA0]+|[\s\uFEFF\xA0]+$/g,"");function forEach(_n,Ce,{allOwnKeys:ke=!1}={}){if(_n===null||typeof _n>"u")return;let $n,Hn;if(typeof _n!="object"&&(_n=[_n]),isArray$2(_n))for($n=0,Hn=_n.length;$n<Hn;$n++)Ce.call(null,_n[$n],$n,_n);else{const zn=ke?Object.getOwnPropertyNames(_n):Object.keys(_n),Un=zn.length;let qn;for($n=0;$n<Un;$n++)qn=zn[$n],Ce.call(null,_n[qn],qn,_n)}}function findKey$1(_n,Ce){Ce=Ce.toLowerCase();const ke=Object.keys(_n);let $n=ke.length,Hn;for(;$n-- >0;)if(Hn=ke[$n],Ce===Hn.toLowerCase())return Hn;return null}const _global=typeof globalThis<"u"?globalThis:typeof self<"u"?self:typeof window<"u"?window:global,isContextDefined=_n=>!isUndefined(_n)&&_n!==_global;function merge(){const{caseless:_n}=isContextDefined(this)&&this||{},Ce={},ke=($n,Hn)=>{const zn=_n&&findKey$1(Ce,Hn)||Hn;isPlainObject(Ce[zn])&&isPlainObject($n)?Ce[zn]=merge(Ce[zn],$n):isPlainObject($n)?Ce[zn]=merge({},$n):isArray$2($n)?Ce[zn]=$n.slice():Ce[zn]=$n};for(let $n=0,Hn=arguments.length;$n<Hn;$n++)arguments[$n]&&forEach(arguments[$n],ke);return Ce}const extend$2=(_n,Ce,ke,{allOwnKeys:$n}={})=>(forEach(Ce,(Hn,zn)=>{ke&&isFunction$1(Hn)?_n[zn]=bind$1(Hn,ke):_n[zn]=Hn},{allOwnKeys:$n}),_n),stripBOM=_n=>(_n.charCodeAt(0)===65279&&(_n=_n.slice(1)),_n),inherits=(_n,Ce,ke,$n)=>{_n.prototype=Object.create(Ce.prototype,$n),_n.prototype.constructor=_n,Object.defineProperty(_n,"super",{value:Ce.prototype}),ke&&Object.assign(_n.prototype,ke)},toFlatObject=(_n,Ce,ke,$n)=>{let Hn,zn,Un;const qn={};if(Ce=Ce||{},_n==null)return Ce;do{for(Hn=Object.getOwnPropertyNames(_n),zn=Hn.length;zn-- >0;)Un=Hn[zn],(!$n||$n(Un,_n,Ce))&&!qn[Un]&&(Ce[Un]=_n[Un],qn[Un]=!0);_n=ke!==!1&&getPrototypeOf(_n)}while(_n&&(!ke||ke(_n,Ce))&&_n!==Object.prototype);return Ce},endsWith=(_n,Ce,ke)=>{_n=String(_n),(ke===void 0||ke>_n.length)&&(ke=_n.length),ke-=Ce.length;const $n=_n.indexOf(Ce,ke);return $n!==-1&&$n===ke},toArray=_n=>{if(!_n)return null;if(isArray$2(_n))return _n;let Ce=_n.length;if(!isNumber$1(Ce))return null;const ke=new Array(Ce);for(;Ce-- >0;)ke[Ce]=_n[Ce];return ke},isTypedArray=(_n=>Ce=>_n&&Ce instanceof _n)(typeof Uint8Array<"u"&&getPrototypeOf(Uint8Array)),forEachEntry=(_n,Ce)=>{const $n=(_n&&_n[Symbol.iterator]).call(_n);let Hn;for(;(Hn=$n.next())&&!Hn.done;){const zn=Hn.value;Ce.call(_n,zn[0],zn[1])}},matchAll=(_n,Ce)=>{let ke;const $n=[];for(;(ke=_n.exec(Ce))!==null;)$n.push(ke);return $n},isHTMLForm=kindOfTest("HTMLFormElement"),toCamelCase=_n=>_n.toLowerCase().replace(/[-_\s]([a-z\d])(\w*)/g,function(ke,$n,Hn){return $n.toUpperCase()+Hn}),hasOwnProperty=(({hasOwnProperty:_n})=>(Ce,ke)=>_n.call(Ce,ke))(Object.prototype),isRegExp=kindOfTest("RegExp"),reduceDescriptors=(_n,Ce)=>{const ke=Object.getOwnPropertyDescriptors(_n),$n={};forEach(ke,(Hn,zn)=>{let Un;(Un=Ce(Hn,zn,_n))!==!1&&($n[zn]=Un||Hn)}),Object.defineProperties(_n,$n)},freezeMethods=_n=>{reduceDescriptors(_n,(Ce,ke)=>{if(isFunction$1(_n)&&["arguments","caller","callee"].indexOf(ke)!==-1)return!1;const $n=_n[ke];if(isFunction$1(Line truncated
|
||||
`).forEach(function(Un){Hn=Un.indexOf(":"),ke=Un.substring(0,Hn).trim().toLowerCase(),$n=Un.substring(Hn+1).trim(),!(!ke||Ce[ke]&&ignoreDuplicateOf[ke])&&(ke==="set-cookie"?Ce[ke]?Ce[ke].push($n):Ce[ke]=[$n]:Ce[ke]=Ce[ke]?Ce[ke]+", "+$n:$n)}),Ce},$internals=Symbol("internals");function normalizeHeader(_n){return _n&&String(_n).trim().toLowerCase()}function normalizeValue(_n){return _n===!1||_n==null?_n:utils$1.isArray(_n)?_n.map(normalizeValue):String(_n)}function parseTokens(_n){const Ce=Object.create(null),ke=/([^\s,;=]+)\s*(?:=\s*([^,;]+))?/g;let $n;for(;$n=ke.exec(_n);)Ce[$n[1]]=$n[2];return Ce}const isValidHeaderName=_n=>/^[-_a-zA-Z0-9^`|~,!#$%&'*+.]+$/.test(_n.trim());function matchHeaderValue(_n,Ce,ke,$n,Hn){if(utils$1.isFunction($n))return $n.call(this,Ce,ke);if(Hn&&(Ce=ke),!!utils$1.isString(Ce)){if(utils$1.isString($n))return Ce.indexOf($n)!==-1;if(utils$1.isRegExp($n))return $n.test(Ce)}}function formatHeader(_n){return _n.trim().toLowerCase().replace(/([a-z\d])(\w*)/g,(Ce,ke,$n)=>ke.toUpperCase()+$n)}function buildAccessors(_n,Ce){const ke=utils$1.toCamelCase(" "+Ce);["get","set","has"].forEach($n=>{Object.defineProperty(_n,$n+ke,{value:function(Hn,zn,Un){return this[$n].call(this,Ce,Hn,zn,Un)},configurable:!0})})}class AxiosHeaders{constructor(Ce){Ce&&this.set(Ce)}set(Ce,ke,$n){const Hn=this;function zn(qn,Xn,Kn){const to=normalizeHeader(Xn);if(!to)throw new Error("header name must be a non-empty string");const io=utils$1.findKey(Hn,to);(!io||Hn[io]===void 0||Kn===!0||Kn===void 0&&Hn[io]!==!1)&&(Hn[io||Xn]=normalizeValue(qn))}const Un=(qn,Xn)=>utils$1.forEach(qn,(Kn,to)=>zn(Kn,to,Xn));if(utils$1.isPlainObject(Ce)||Ce instanceof this.constructor)Un(Ce,ke);else if(utils$1.isString(Ce)&&(Ce=Ce.trim())&&!isValidHeaderName(Ce))Un(parseHeaders(Ce),ke);else if(utils$1.isHeaders(Ce))for(const[qn,Xn]of Ce.entries())zn(Xn,qn,$n);else Ce!=null&&zn(ke,Ce,$n);return this}get(Ce,ke){if(Ce=normalizeHeader(Ce),Ce){const $n=utils$1.findKey(this,Ce);if($n){const Hn=this[$n];if(!ke)return Hn;if(ke===!0)return parseTokens(Hn);if(utils$1.isFunction(ke))return ke.call(this,Hn,$n);if(utils$1.isRegExp(ke))return ke.exec(Hn);throw new TypeError("parser must be boolean|regexp|function")}}}has(Ce,ke){if(Ce=normalizeHeader(Ce),Ce){const $n=utils$1.findKey(this,Ce);return!!($n&&this[$n]!==void 0&&(!ke||matchHeaderValue(this,this[$n],$n,ke)))}return!1}delete(Ce,ke){const $n=this;let Hn=!1;function zn(Un){if(Un=normalizeHeader(Un),Un){const qn=utils$1.findKey($n,Un);qn&&(!ke||matchHeaderValue($n,$n[qn],qn,ke))&&(delete $n[qn],Hn=!0)}}return utils$1.isArray(Ce)?Ce.forEach(zn):zn(Ce),Hn}clear(Ce){const ke=Object.keys(this);let $n=ke.length,Hn=!1;for(;$n--;){const zn=ke[$n];(!Ce||matchHeaderValue(this,this[zn],zn,Ce,!0))&&(delete this[zn],Hn=!0)}return Hn}normalize(Ce){const ke=this,$n={};return utils$1.forEach(this,(Hn,zn)=>{const Un=utils$1.findKey($n,zn);if(Un){ke[Un]=normalizeValue(Hn),delete ke[zn];return}const qn=Ce?formatHeader(zn):String(zn).trim();qn!==zn&&delete ke[zn],ke[qn]=normalizeValue(Hn),$n[qn]=!0}),this}concat(...Ce){return this.constructor.concat(this,...Ce)}toJSON(Ce){const ke=Object.create(null);return utils$1.forEach(this,($n,Hn)=>{$n!=null&&$n!==!1&&(ke[Hn]=Ce&&utils$1.isArray($n)?$n.join(", "):$n)}),ke}[Symbol.iterator](){return Object.entries(this.toJSON())[Symbol.iterator]()}toString(){return Object.entries(this.toJSON()).map(([Ce,ke])=>Ce+": "+ke).join(`
|
||||
`)}get[Symbol.toStringTag](){return"AxiosHeaders"}static from(Ce){return Ce instanceof this?Ce:new this(Ce)}static concat(Ce,...ke){const $n=new this(Ce);return ke.forEach(Hn=>$n.set(Hn)),$n}static accessor(Ce){const $n=(this[$internals]=this[$internals]={accessors:{}}).accessors,Hn=this.prototype;function zn(Un){const qn=normalizeHeader(Un);$n[qn]||(buildAccessors(Hn,Un),$n[qn]=!0)}return utils$1.isArray(Ce)?Ce.forEach(zn):zn(Ce),this}}AxiosHeaders.accessor(["Content-Type","Content-Length","Accept","Accept-Encoding","User-Agent","Authorization"]);utils$1.reduceDescriptors(AxiosHeaders.prototype,({value:_n},Ce)=>{let ke=Ce[0].toUpperCase()+Ce.slice(1);return{get:()=>_n,set($n){this[ke]=$n}}});utils$1.freezeMethods(AxiosHeaders);function transformData(_n,Ce){const ke=this||defaults$4,$n=Ce||ke,Hn=AxiosHeaders.from($n.headers);let zn=$n.data;return utils$1.forEach(_n,function(qn){zn=qn.call(ke,zn,Hn.normalize(),Ce?Ce.status:void 0)}),Hn.normalize(),zn}function isCancel(_n){return!!(_n&&_n.__CANCEL__)}function CanceledError(_n,Ce,ke){AxiosError.call(this,_n??"canceled",AxiosError.ERR_CANCELED,Ce,ke),this.name="CanceledError"}utils$1.inherits(CanceledError,AxiosError,{__CANCEL__:!0});function settle(_n,Ce,ke){const $n=ke.config.validateStatus;!ke.status||!$n||$n(ke.status)?_n(ke):Ce(new AxiosError("Request failed with status code "+ke.status,[AxiosError.ERR_BAD_REQUEST,AxiosError.ERR_BAD_RESPONSE][Math.floor(ke.status/100)-4],ke.config,ke.request,ke))}function parseProtocol(_n){const Ce=/^([-+\w]{1,25})(:?\/\/|:)/.exec(_n);return Ce&&Ce[1]||""}function speedometer(_n,Ce){_n=_n||10;const ke=new Array(_n),$n=new Array(_n);let Hn=0,zn=0,Un;return Ce=Ce!==void 0?Ce:1e3,function(Xn){const Kn=Date.now(),to=$n[zn];Un||(Un=Kn),ke[Hn]=Xn,$n[Hn]=Kn;let io=zn,uo=0;for(;io!==Hn;)uo+=ke[io++],io=io%_n;if(Hn=(Hn+1)%_n,Hn===zn&&(zn=(zn+1)%_n),Kn-Un<Ce)return;const ho=to&&Kn-to;return ho?Math.round(uo*1e3/ho):void 0}}function throttle$1(_n,Ce){let ke=0,$n=1e3/Ce,Hn,zn;const Un=(Kn,to=Date.now())=>{ke=to,Hn=null,zn&&(clearTimeout(zn),zn=null),_n.apply(null,Kn)};return[(...Kn)=>{const to=Date.now(),io=to-ke;io>=$n?Un(Kn,to):(Hn=Kn,zn||(zn=setTimeout(()=>{zn=null,Un(Hn)},$n-io)))},()=>Hn&&Un(Hn)]}const progressEventReducer=(_n,Ce,ke=3)=>{let $n=0;const Hn=speedometer(50,250);return throttle$1(zn=>{const Un=zn.loaded,qn=zn.lengthComputable?zn.total:void 0,Xn=Un-$n,Kn=Hn(Xn),to=Un<=qn;$n=Un;const io={loaded:Un,total:qn,progress:qn?Un/qn:void 0,bytes:Xn,rate:Kn||void 0,estimated:Kn&&qn&&to?(qn-Un)/Kn:void 0,event:zn,lengthComputable:qn!=null,[Ce?"download":"upload"]:!0};_n(io)},ke)},progressEventDecorator=(_n,Ce)=>{const ke=_n!=null;return[$n=>Ce[0]({lengthComputable:ke,total:_n,loaded:$n}),Ce[1]]},asyncDecorator=_n=>(...Ce)=>utils$1.asap(()=>_n(...Ce)),isURLSameOrigin=platform.hasStandardBrowserEnv?function(){const Ce=/(msie|trident)/i.test(navigator.userAgent),ke=document.createElement("a");let $n;function Hn(zn){let Un=zn;return Ce&&(ke.setAttribute("href",Un),Un=ke.href),ke.setAttribute("href",Un),{href:ke.href,protocol:ke.protocol?ke.protocol.replace(/:$/,""):"",host:ke.host,search:ke.search?ke.search.replace(/^\?/,""):"",hash:ke.hash?ke.hash.replace(/^#/,""):"",hostname:ke.hostname,port:ke.port,pathname:ke.pathname.charAt(0)==="/"?ke.pathname:"/"+ke.pathname}}return $n=Hn(window.location.href),function(Un){const qn=utils$1.isString(Un)?Hn(Un):Un;return qn.protocol===$n.protocol&&qn.host===$n.host}}():function(){return function(){return!0}}(),cookies=platform.hasStandardBrowserEnv?{write(_n,Ce,ke,$n,Hn,zn){const Un=[_n+"="+encodeURIComponent(Ce)];utils$1.isNumber(ke)&&Un.push("expires="+new Date(ke).toGMTString()),utils$1.isString($n)&&Un.push("path="+$n),utils$1.isString(Hn)&&Un.push("domain="+Hn),zn===!0&&Un.push("secure"),document.cookie=Un.join("; ")},read(_n){const Ce=document.cookie.match(new RegExp("(^|;\\s*)("+_n+")=([^;]*)"));return Ce?decodeURIComponent(Ce[3]):null},remove(_n){this.write(_n,"",Date.now()-864e5)}}:{write(){},read(){return null},remove(){}};function isAbsoluteURL(_n){return/^([a-z][a-z\d+\-.]*:)?\/\//i.test(_n)}function combineURLs(_n,Ce){return Ce?_n.replace(/\/?\/$/,"")+"/"+Ce.replace(/^\/+/,""):_n}function buildFullPath(_n,Ce){return _n&&!isAbsoluteURL(Ce)?combineURLs(_n,Ce):Ce}const headersToObject=_n=>_n instanceof AxiosHeaders?{..._n}:_n;function mergeConfig(_n,Ce){Ce=Ce||{};const ke={};function $n(Kn,to,io){return utils$1.isPlainObject(Kn)&&utils$1.isPlainObject(to)?utils$1.merge.call({caseless:io},Kn,to):utils$1.isPlainObject(to)?utils$1.merge({},to):utils$1.isArray(to)?to.slice():to}function Hn(Kn,to,io){if(utils$1.isUndefined(to)){if(!utils$1.isUndefined(Kn))return $n(void 0,Kn,io)}else return $n(Kn,to,io)}function zn(Kn,to){if(!utils$1.isUndefined(to))return $n(void 0,to)}function Un(Kn,to){if(utils$1.isUndefined(to)){if(!utils$1.isUndefined(Kn))return $n(void 0,Kn)}else return $n(void 0,to)}function qn(Kn,to,io){if(io in Ce)return $n(Kn,to);if(io in _n)return $n(void 0,Kn)}const Xn={url:zn,
Line truncated
|
||||
`+zn.map(renderReason).join(`
|
||||
`):" "+renderReason(zn[0]):"as no adapter specified";throw new AxiosError("There is no suitable adapter to dispatch the request "+Un,"ERR_NOT_SUPPORT")}return $n},adapters:knownAdapters};function throwIfCancellationRequested(_n){if(_n.cancelToken&&_n.cancelToken.throwIfRequested(),_n.signal&&_n.signal.aborted)throw new CanceledError(null,_n)}function dispatchRequest(_n){return throwIfCancellationRequested(_n),_n.headers=AxiosHeaders.from(_n.headers),_n.data=transformData.call(_n,_n.transformRequest),["post","put","patch"].indexOf(_n.method)!==-1&&_n.headers.setContentType("application/x-www-form-urlencoded",!1),adapters.getAdapter(_n.adapter||defaults$4.adapter)(_n).then(function($n){return throwIfCancellationRequested(_n),$n.data=transformData.call(_n,_n.transformResponse,$n),$n.headers=AxiosHeaders.from($n.headers),$n},function($n){return isCancel($n)||(throwIfCancellationRequested(_n),$n&&$n.response&&($n.response.data=transformData.call(_n,_n.transformResponse,$n.response),$n.response.headers=AxiosHeaders.from($n.response.headers))),Promise.reject($n)})}const VERSION="1.7.4",validators$1={};["object","boolean","number","function","string","symbol"].forEach((_n,Ce)=>{validators$1[_n]=function($n){return typeof $n===_n||"a"+(Ce<1?"n ":" ")+_n}});const deprecatedWarnings={};validators$1.transitional=function(Ce,ke,$n){function Hn(zn,Un){return"[Axios v"+VERSION+"] Transitional option '"+zn+"'"+Un+($n?". "+$n:"")}return(zn,Un,qn)=>{if(Ce===!1)throw new AxiosError(Hn(Un," has been removed"+(ke?" in "+ke:"")),AxiosError.ERR_DEPRECATED);return ke&&!deprecatedWarnings[Un]&&(deprecatedWarnings[Un]=!0,console.warn(Hn(Un," has been deprecated since v"+ke+" and will be removed in the near future"))),Ce?Ce(zn,Un,qn):!0}};function assertOptions(_n,Ce,ke){if(typeof _n!="object")throw new AxiosError("options must be an object",AxiosError.ERR_BAD_OPTION_VALUE);const $n=Object.keys(_n);let Hn=$n.length;for(;Hn-- >0;){const zn=$n[Hn],Un=Ce[zn];if(Un){const qn=_n[zn],Xn=qn===void 0||Un(qn,zn,_n);if(Xn!==!0)throw new AxiosError("option "+zn+" must be "+Xn,AxiosError.ERR_BAD_OPTION_VALUE);continue}if(ke!==!0)throw new AxiosError("Unknown option "+zn,AxiosError.ERR_BAD_OPTION)}}const validator={assertOptions,validators:validators$1},validators=validator.validators;class Axios{constructor(Ce){this.defaults=Ce,this.interceptors={request:new InterceptorManager,response:new InterceptorManager}}async request(Ce,ke){try{return await this._request(Ce,ke)}catch($n){if($n instanceof Error){let Hn;Error.captureStackTrace?Error.captureStackTrace(Hn={}):Hn=new Error;const zn=Hn.stack?Hn.stack.replace(/^.+\n/,""):"";try{$n.stack?zn&&!String($n.stack).endsWith(zn.replace(/^.+\n.+\n/,""))&&($n.stack+=`
|
||||
`+zn):$n.stack=zn}catch{}}throw $n}}_request(Ce,ke){typeof Ce=="string"?(ke=ke||{},ke.url=Ce):ke=Ce||{},ke=mergeConfig(this.defaults,ke);const{transitional:$n,paramsSerializer:Hn,headers:zn}=ke;$n!==void 0&&validator.assertOptions($n,{silentJSONParsing:validators.transitional(validators.boolean),forcedJSONParsing:validators.transitional(validators.boolean),clarifyTimeoutError:validators.transitional(validators.boolean)},!1),Hn!=null&&(utils$1.isFunction(Hn)?ke.paramsSerializer={serialize:Hn}:validator.assertOptions(Hn,{encode:validators.function,serialize:validators.function},!0)),ke.method=(ke.method||this.defaults.method||"get").toLowerCase();let Un=zn&&utils$1.merge(zn.common,zn[ke.method]);zn&&utils$1.forEach(["delete","get","head","post","put","patch","common"],bo=>{delete zn[bo]}),ke.headers=AxiosHeaders.concat(Un,zn);const qn=[];let Xn=!0;this.interceptors.request.forEach(function(Oo){typeof Oo.runWhen=="function"&&Oo.runWhen(ke)===!1||(Xn=Xn&&Oo.synchronous,qn.unshift(Oo.fulfilled,Oo.rejected))});const Kn=[];this.interceptors.response.forEach(function(Oo){Kn.push(Oo.fulfilled,Oo.rejected)});let to,io=0,uo;if(!Xn){const bo=[dispatchRequest.bind(this),void 0];for(bo.unshift.apply(bo,qn),bo.push.apply(bo,Kn),uo=bo.length,to=Promise.resolve(ke);io<uo;)to=to.then(bo[io++],bo[io++]);return to}uo=qn.length;let ho=ke;for(io=0;io<uo;){const bo=qn[io++],Oo=qn[io++];try{ho=bo(ho)}catch(So){Oo.call(this,So);break}}try{to=dispatchRequest.call(this,ho)}catch(bo){return Promise.reject(bo)}for(io=0,uo=Kn.length;io<uo;)to=to.then(Kn[io++],Kn[io++]);return to}getUri(Ce){Ce=mergeConfig(this.defaults,Ce);const ke=buildFullPath(Ce.baseURL,Ce.url);return buildURL(ke,Ce.params,Ce.paramsSerializer)}}utils$1.forEach(["delete","get","head","options"],function(Ce){Axios.prototype[Ce]=function(ke,$n){return this.request(mergeConfig($n||{},{method:Ce,url:ke,data:($n||{}).data}))}});utils$1.forEach(["post","put","patch"],function(Ce){function ke($n){return function(zn,Un,qn){return this.request(mergeConfig(qn||{},{method:Ce,headers:$n?{"Content-Type":"multipart/form-data"}:{},url:zn,data:Un}))}}Axios.prototype[Ce]=ke(),Axios.prototype[Ce+"Form"]=ke(!0)});class CancelToken{constructor(Ce){if(typeof Ce!="function")throw new TypeError("executor must be a function.");let ke;this.promise=new Promise(function(zn){ke=zn});const $n=this;this.promise.then(Hn=>{if(!$n._listeners)return;let zn=$n._listeners.length;for(;zn-- >0;)$n._listeners[zn](Hn);$n._listeners=null}),this.promise.then=Hn=>{let zn;const Un=new Promise(qn=>{$n.subscribe(qn),zn=qn}).then(Hn);return Un.cancel=function(){$n.unsubscribe(zn)},Un},Ce(function(zn,Un,qn){$n.reason||($n.reason=new CanceledError(zn,Un,qn),ke($n.reason))})}throwIfRequested(){if(this.reason)throw this.reason}subscribe(Ce){if(this.reason){Ce(this.reason);return}this._listeners?this._listeners.push(Ce):this._listeners=[Ce]}unsubscribe(Ce){if(!this._listeners)return;const ke=this._listeners.indexOf(Ce);ke!==-1&&this._listeners.splice(ke,1)}static source(){let Ce;return{token:new CancelToken(function(Hn){Ce=Hn}),cancel:Ce}}}function spread(_n){return function(ke){return _n.apply(null,ke)}}function isAxiosError(_n){return utils$1.isObject(_n)&&_n.isAxiosError===!0}const HttpStatusCode={Continue:100,SwitchingProtocols:101,Processing:102,EarlyHints:103,Ok:200,Created:201,Accepted:202,NonAuthoritativeInformation:203,NoContent:204,ResetContent:205,PartialContent:206,MultiStatus:207,AlreadyReported:208,ImUsed:226,MultipleChoices:300,MovedPermanently:301,Found:302,SeeOther:303,NotModified:304,UseProxy:305,Unused:306,TemporaryRedirect:307,PermanentRedirect:308,BadRequest:400,Unauthorized:401,PaymentRequired:402,Forbidden:403,NotFound:404,MethodNotAllowed:405,NotAcceptable:406,ProxyAuthenticationRequired:407,RequestTimeout:408,Conflict:409,Gone:410,LengthRequired:411,PreconditionFailed:412,PayloadTooLarge:413,UriTooLong:414,UnsupportedMediaType:415,RangeNotSatisfiable:416,ExpectationFailed:417,ImATeapot:418,MisdirectedRequest:421,UnprocessableEntity:422,Locked:423,FailedDependency:424,TooEarly:425,UpgradeRequired:426,PreconditionRequired:428,TooManyRequests:429,RequestHeaderFieldsTooLarge:431,UnavailableForLegalReasons:451,InternalServerError:500,NotImplemented:501,BadGateway:502,ServiceUnavailable:503,GatewayTimeout:504,HttpVersionNotSupported:505,VariantAlsoNegotiates:506,InsufficientStorage:507,LoopDetected:508,NotExtended:510,NetworkAuthenticationRequired:511};Object.entries(HttpStatusCode).forEach(([_n,Ce])=>{HttpStatusCode[Ce]=_n});function createInstance(_n){const Ce=new Axios(_n),ke=bind$1(Axios.prototype.request,Ce);return utils$1.extend(ke,Axios.prototype,Ce,{allOwnKeys:!0}),utils$1.extend(ke,Ce,null,{allOwnKeys:!0}),ke.create=function(Hn){return createInstance(mergeConfig(_n,Hn))},ke}const axios$1=createInstance(defaults$4);axios$1.Axios=Axios;axios$1.CanceledError=CanceledError;axios$1.CancelToken=CancelToken;axios$1.isCancel=isCancel;axios$1.VERSION=VERSION;axios$1.toFormData=toFormData;axios$1.Axio
Line truncated
|
||||
`;for(let So=0;So<=1;So+=Xn){const $o=Ce+(ke-Ce)*zn(So);Kn+=So*100+`%{${Un($o,1-$o)}}
|
||||
`}const to=Kn+`100% {${Un(ke,1-ke)}}
|
||||
}`,io=`__svelte_${hash$1(to)}_${qn}`,uo=get_root_for_style(_n),{stylesheet:ho,rules:bo}=managed_styles.get(uo)||create_style_information(uo,_n);bo[io]||(bo[io]=!0,ho.insertRule(`@keyframes ${io} ${to}`,ho.cssRules.length));const Oo=_n.style.animation||"";return _n.style.animation=`${Oo?`${Oo}, `:""}${io} ${$n}ms linear ${Hn}ms 1 both`,active+=1,io}function delete_rule(_n,Ce){const ke=(_n.style.animation||"").split(", "),$n=ke.filter(Ce?zn=>zn.indexOf(Ce)<0:zn=>zn.indexOf("__svelte")===-1),Hn=ke.length-$n.length;Hn&&(_n.style.animation=$n.join(", "),active-=Hn,active||clear_rules())}function clear_rules(){raf(()=>{active||(managed_styles.forEach(_n=>{const{ownerNode:Ce}=_n.stylesheet;Ce&&detach(Ce)}),managed_styles.clear())})}let current_component;function set_current_component(_n){current_component=_n}function get_current_component(){if(!current_component)throw new Error("Function called outside component initialization");return current_component}function onMount(_n){get_current_component().$$.on_mount.push(_n)}function afterUpdate(_n){get_current_component().$$.after_update.push(_n)}function onDestroy(_n){get_current_component().$$.on_destroy.push(_n)}function createEventDispatcher(){const _n=get_current_component();return(Ce,ke,{cancelable:$n=!1}={})=>{const Hn=_n.$$.callbacks[Ce];if(Hn){const zn=custom_event(Ce,ke,{cancelable:$n});return Hn.slice().forEach(Un=>{Un.call(_n,zn)}),!zn.defaultPrevented}return!0}}function setContext(_n,Ce){return get_current_component().$$.context.set(_n,Ce),Ce}function getContext$1(_n){return get_current_component().$$.context.get(_n)}function bubble(_n,Ce){const ke=_n.$$.callbacks[Ce.type];ke&&ke.slice().forEach($n=>$n.call(this,Ce))}const dirty_components=[],binding_callbacks=[];let render_callbacks=[];const flush_callbacks=[],resolved_promise=Promise.resolve();let update_scheduled=!1;function schedule_update(){update_scheduled||(update_scheduled=!0,resolved_promise.then(flush))}function add_render_callback(_n){render_callbacks.push(_n)}function add_flush_callback(_n){flush_callbacks.push(_n)}const seen_callbacks=new Set;let flushidx=0;function flush(){if(flushidx!==0)return;const _n=current_component;do{try{for(;flushidx<dirty_components.length;){const Ce=dirty_components[flushidx];flushidx++,set_current_component(Ce),update(Ce.$$)}}catch(Ce){throw dirty_components.length=0,flushidx=0,Ce}for(set_current_component(null),dirty_components.length=0,flushidx=0;binding_callbacks.length;)binding_callbacks.pop()();for(let Ce=0;Ce<render_callbacks.length;Ce+=1){const ke=render_callbacks[Ce];seen_callbacks.has(ke)||(seen_callbacks.add(ke),ke())}render_callbacks.length=0}while(dirty_components.length);for(;flush_callbacks.length;)flush_callbacks.pop()();update_scheduled=!1,seen_callbacks.clear(),set_current_component(_n)}function update(_n){if(_n.fragment!==null){_n.update(),run_all(_n.before_update);const Ce=_n.dirty;_n.dirty=[-1],_n.fragment&&_n.fragment.p(_n.ctx,Ce),_n.after_update.forEach(add_render_callback)}}function flush_render_callbacks(_n){const Ce=[],ke=[];render_callbacks.forEach($n=>_n.indexOf($n)===-1?Ce.push($n):ke.push($n)),ke.forEach($n=>$n()),render_callbacks=Ce}let promise;function wait(){return promise||(promise=Promise.resolve(),promise.then(()=>{promise=null})),promise}function dispatch(_n,Ce,ke){_n.dispatchEvent(custom_event(`${Ce?"intro":"outro"}${ke}`))}const outroing=new Set;let outros;function group_outros(){outros={r:0,c:[],p:outros}}function check_outros(){outros.r||run_all(outros.c),outros=outros.p}function transition_in(_n,Ce){_n&&_n.i&&(outroing.delete(_n),_n.i(Ce))}function transition_out(_n,Ce,ke,$n){if(_n&&_n.o){if(outroing.has(_n))return;outroing.add(_n),outros.c.push(()=>{outroing.delete(_n),$n&&(ke&&_n.d(1),$n())}),_n.o(Ce)}else $n&&$n()}const null_transition={duration:0};function create_bidirectional_transition(_n,Ce,ke,$n){let zn=Ce(_n,ke,{direction:"both"}),Un=$n?0:1,qn=null,Xn=null,Kn=null,to;function io(){Kn&&delete_rule(_n,Kn)}function uo(bo,Oo){const So=bo.b-Un;return Oo*=Math.abs(So),{a:Un,b:bo.b,d:So,duration:Oo,start:bo.start,end:bo.start+Oo,group:bo.group}}function ho(bo){const{delay:Oo=0,duration:So=300,easing:$o=identity,tick:Do=noop,css:xo}=zn||null_transition,Io={start:now()+Oo,b:bo};bo||(Io.group=outros,outros.r+=1),"inert"in _n&&(bo?to!==void 0&&(_n.inert=to):(to=_n.inert,_n.inert=!0)),qn||Xn?Xn=Io:(xo&&(io(),Kn=create_rule(_n,Un,bo,So,Oo,$o,xo)),bo&&Do(0,1),qn=uo(Io,So),add_render_callback(()=>dispatch(_n,bo,"start")),loop(Vo=>{if(Xn&&Vo>Xn.start&&(qn=uo(Xn,So),Xn=null,dispatch(_n,qn.b,"start"),xo&&(io(),Kn=create_rule(_n,Un,qn.b,qn.duration,0,$o,zn.css))),qn){if(Vo>=qn.end)Do(Un=qn.b,1-Un),dispatch(_n,qn.b,"end"),Xn||(qn.b?io():--qn.group.r||run_all(qn.group.c)),qn=null;else if(Vo>=qn.start){const Jo=Vo-qn.start;Un=qn.a+qn.d*$o(Jo/qn.duration),Do(Un,1-Un)}}return!!(qn||Xn)}))}return{run(bo){is_function(zn)?wait().then(()=>{zn=zn({direction:bo?"in":"out"}),ho(bo)}):ho(bo)},end(){io(),qn=Xn=null}}}function ensure_array_like(_n)
Line truncated
|
||||
transform: ${Kn} translate(${(1-Oo)*io}${uo}, ${(1-Oo)*ho}${bo});
|
||||
opacity: ${Xn-to*So}`}}function create_if_block$W(_n){let Ce,ke,$n,Hn,zn,Un,qn;return{c(){Ce=element("div"),ke=element("div"),ke.textContent="Success",$n=space$3(),Hn=element("div"),zn=text(_n[1]),attr(ke,"class","title"),attr(Hn,"class","content"),attr(Ce,"class","notice notice-success"),attr(Ce,"role","alert")},m(Xn,Kn){insert$1(Xn,Ce,Kn),append(Ce,ke),append(Ce,$n),append(Ce,Hn),append(Hn,zn),qn=!0},p(Xn,Kn){(!qn||Kn&2)&&set_data(zn,Xn[1])},i(Xn){qn||(Xn&&add_render_callback(()=>{qn&&(Un||(Un=create_bidirectional_transition(Ce,fly,{duration:500},!0)),Un.run(1))}),qn=!0)},o(Xn){Xn&&(Un||(Un=create_bidirectional_transition(Ce,fly,{duration:500},!1)),Un.run(0)),qn=!1},d(Xn){Xn&&detach(Ce),Xn&&Un&&Un.end()}}}function create_fragment$1p(_n){let Ce,ke=_n[0]&&create_if_block$W(_n);return{c(){ke&&ke.c(),Ce=empty$1()},m($n,Hn){ke&&ke.m($n,Hn),insert$1($n,Ce,Hn)},p($n,[Hn]){$n[0]?ke?(ke.p($n,Hn),Hn&1&&transition_in(ke,1)):(ke=create_if_block$W($n),ke.c(),transition_in(ke,1),ke.m(Ce.parentNode,Ce)):ke&&(group_outros(),transition_out(ke,1,1,()=>{ke=null}),check_outros())},i($n){transition_in(ke)},o($n){transition_out(ke)},d($n){$n&&detach(Ce),ke&&ke.d($n)}}}function instance$1p(_n,Ce,ke){let $n,Hn;function zn(Un="Saved"){ke(1,$n=Un),ke(0,Hn=!0),setTimeout(function(){ke(0,Hn=!1)},2e3)}return ke(1,$n="Saved"),ke(0,Hn=!1),[Hn,$n,zn]}class SuccessAlert extends SvelteComponent{constructor(Ce){super(),init(this,Ce,instance$1p,create_fragment$1p,safe_not_equal,{show:2})}get show(){return this.$$.ctx[2]}}function create_fragment$1o(_n){let Ce,ke,$n,Hn,zn,Un,qn,Xn,Kn,to,io,uo,ho,bo,Oo={};return Ce=new SuccessAlert({props:Oo}),_n[4](Ce),io=new SpinnerButton({props:{label:"Enter"}}),{c(){create_component(Ce.$$.fragment),ke=space$3(),$n=element("div"),Hn=element("form"),zn=element("div"),Un=element("h3"),qn=text("Login as "),Xn=text(_n[0]),Kn=space$3(),to=element("div"),create_component(io.$$.fragment),attr(zn,"class","mb-3 text-center"),attr(to,"class","text-center mt-5 d-block"),attr($n,"class","wrapper-tiny")},m(So,$o){mount_component(Ce,So,$o),insert$1(So,ke,$o),insert$1(So,$n,$o),append($n,Hn),append(Hn,zn),append(zn,Un),append(Un,qn),append(Un,Xn),append(Hn,Kn),append(Hn,to),mount_component(io,to,null),uo=!0,ho||(bo=listen(Hn,"submit",_n[2]),ho=!0)},p(So,[$o]){const Do={};Ce.$set(Do),(!uo||$o&1)&&set_data(Xn,So[0])},i(So){uo||(transition_in(Ce.$$.fragment,So),transition_in(io.$$.fragment,So),uo=!0)},o(So){transition_out(Ce.$$.fragment,So),transition_out(io.$$.fragment,So),uo=!1},d(So){So&&(detach(ke),detach($n)),_n[4](null),destroy_component(Ce,So),destroy_component(io),ho=!1,bo()}}}function instance$1o(_n,Ce,ke){const $n=getContext$1("channel");let{email:Hn}=Ce,{token:zn}=Ce,Un;function qn(Kn){Kn.preventDefault(),axios.post($n.lucentUrl+"/verify",{email:Hn,token:zn}).then(to=>{window.location=$n.lucentUrl}).catch(to=>{})}function Xn(Kn){binding_callbacks[Kn?"unshift":"push"](()=>{Un=Kn,ke(1,Un)})}return _n.$$set=Kn=>{"email"in Kn&&ke(0,Hn=Kn.email),"token"in Kn&&ke(3,zn=Kn.token)},[Hn,Un,qn,zn,Xn]}class Verify extends SvelteComponent{constructor(Ce){super(),init(this,Ce,instance$1o,create_fragment$1o,safe_not_equal,{email:0,token:3})}}function create_fragment$1n(_n){let Ce,ke,$n;return{c(){Ce=element("div"),ke=element("div"),$n=text(_n[2]),attr(ke,"class","avatar__letters"),attr(Ce,"class","avatar"),attr(Ce,"title",_n[0]),set_style(Ce,"background-color",_n[3][_n[4]]),set_style(Ce,"height",_n[1]+"px"),set_style(Ce,"width",_n[1]+"px"),set_style(Ce,"font-size",_n[1]/2+"px")},m(Hn,zn){insert$1(Hn,Ce,zn),append(Ce,ke),append(ke,$n)},p(Hn,[zn]){zn&4&&set_data($n,Hn[2]),zn&1&&attr(Ce,"title",Hn[0]),zn&2&&set_style(Ce,"height",Hn[1]+"px"),zn&2&&set_style(Ce,"width",Hn[1]+"px"),zn&2&&set_style(Ce,"font-size",Hn[1]/2+"px")},i:noop,o:noop,d(Hn){Hn&&detach(Ce)}}}function instance$1n(_n,Ce,ke){let{name:$n}=Ce,{side:Hn=48}=Ce;const zn=["#00AA55","#009FD4","#B381B3","#939393","#E3BC00","#D47500","#DC2A2A","#3ede91","#377dd4","#0256b0","#053d82","#3d026e","#b378e3","#c4065c","#543208","#d97811","#0c6b40"];let Un="";$n.split(" ").length>1?Un=$n.split(" ")[0].charAt(0).toUpperCase()+$n.split(" ")[1].charAt(0).toUpperCase():Un=$n.split(" ")[0].charAt(0).toUpperCase()+$n.split(" ")[0].charAt(1).toUpperCase();let Xn=($n.charCodeAt(1)+$n.length)%19;return _n.$$set=Kn=>{"name"in Kn&&ke(0,$n=Kn.name),"side"in Kn&&ke(1,Hn=Kn.side)},[$n,Hn,Un,zn,Xn]}class Avatar extends SvelteComponent{constructor(Ce){super(),init(this,Ce,instance$1n,create_fragment$1n,safe_not_equal,{name:0,side:1})}}function create_fragment$1m(_n){let Ce,ke,$n,Hn,zn,Un,qn,Xn,Kn,to,io,uo,ho,bo,Oo,So,$o,Do,xo,Io,Vo,Jo,Mo,Go,os,ms;ke=new ErrorAlert({props:{message:_n[2]}});let is={};return Hn=new SuccessAlert({props:is}),_n[8](Hn),qn=new Avatar({props:{name:_n[4].name}}),ho=new SpinnerButton({props:{label:"Update Name"}}),xo=new SpinnerButton({props:{label:"Update Email"}}),{c(){Ce=element("div"),create_component(ke.$$.fragment),$n=space$3(),create_component(Hn.$$.fragment),zn
Line truncated
|
||||
device`),attr(Un,"class","header-small mb-5"),attr(io,"type","text"),attr(io,"class","form-control mb-3"),attr(io,"placeholder","Name"),io.required=!0,attr(to,"class","input-group mb-5"),attr($o,"type","email"),attr($o,"class","form-control mb-3"),attr($o,"placeholder","Email"),$o.required=!0,attr(So,"class","input-group mb-5"),attr(Jo,"class","list-group-item list-group-item-action"),attr(Jo,"href",_n[5].lucentUrl+"/logout"),attr(Vo,"class","list-group"),attr(Ce,"class","wrapper-tiny")},m(Yo,Ys){insert$1(Yo,Ce,Ys),mount_component(ke,Ce,null),append(Ce,$n),mount_component(Hn,Ce,null),append(Ce,zn),append(Ce,Un),mount_component(qn,Un,null),append(Ce,Xn),append(Ce,Kn),append(Kn,to),append(to,io),set_input_value(io,_n[0]),append(to,uo),mount_component(ho,to,null),append(Ce,bo),append(Ce,Oo),append(Oo,So),append(So,$o),set_input_value($o,_n[1]),append(So,Do),mount_component(xo,So,null),append(Ce,Io),append(Ce,Vo),append(Vo,Jo),append(Jo,Mo),Go=!0,os||(ms=[listen(io,"input",_n[9]),listen(Kn,"submit",_n[6]),listen($o,"input",_n[10]),listen(Oo,"submit",_n[7])],os=!0)},p(Yo,[Ys]){const sr={};Ys&4&&(sr.message=Yo[2]),ke.$set(sr);const Js={};Hn.$set(Js),Ys&1&&io.value!==Yo[0]&&set_input_value(io,Yo[0]),Ys&2&&$o.value!==Yo[1]&&set_input_value($o,Yo[1])},i(Yo){Go||(transition_in(ke.$$.fragment,Yo),transition_in(Hn.$$.fragment,Yo),transition_in(qn.$$.fragment,Yo),transition_in(ho.$$.fragment,Yo),transition_in(xo.$$.fragment,Yo),Go=!0)},o(Yo){transition_out(ke.$$.fragment,Yo),transition_out(Hn.$$.fragment,Yo),transition_out(qn.$$.fragment,Yo),transition_out(ho.$$.fragment,Yo),transition_out(xo.$$.fragment,Yo),Go=!1},d(Yo){Yo&&detach(Ce),destroy_component(ke),_n[8](null),destroy_component(Hn),destroy_component(qn),destroy_component(ho),destroy_component(xo),os=!1,run_all(ms)}}}function instance$1m(_n,Ce,ke){const $n=getContext$1("user"),Hn=getContext$1("channel");let zn=$n.name,Un=$n.email,qn="",Xn;function Kn(bo){bo.preventDefault(),ke(2,qn=""),axios.post(Hn.lucentUrl+"/account/update-name",{name:zn}).then(Oo=>{Xn.show()}).catch(Oo=>{var So;ke(2,qn=(So=Oo.response)==null?void 0:So.data.error),console.log({errorMessage:qn})})}function to(bo){bo.preventDefault(),ke(2,qn=""),axios.post(Hn.lucentUrl+"/account/update-email",{email:Un}).then(Oo=>{Xn.show()}).catch(Oo=>{var So;ke(2,qn=(So=Oo.response)==null?void 0:So.data.error),console.log({errorMessage:qn})})}function io(bo){binding_callbacks[bo?"unshift":"push"](()=>{Xn=bo,ke(3,Xn)})}function uo(){zn=this.value,ke(0,zn)}function ho(){Un=this.value,ke(1,Un)}return[zn,Un,qn,Xn,$n,Hn,Kn,to,io,uo,ho]}class Profile extends SvelteComponent{constructor(Ce){super(),init(this,Ce,instance$1m,create_fragment$1m,safe_not_equal,{})}}function create_fragment$1l(_n){let Ce,ke=_n[5].path+"";return{c(){Ce=svg_element("svg"),attr(Ce,"class","bi svelte-r4pd9j"),attr(Ce,"xmlns","http://www.w3.org/2000/svg"),attr(Ce,"width",_n[0]),attr(Ce,"height",_n[1]),attr(Ce,"viewBox",_n[5].viewBox),attr(Ce,"aria-labelledby",_n[2]),attr(Ce,"role","presentation"),attr(Ce,"stroke",_n[4]),attr(Ce,"fill",_n[3])},m($n,Hn){insert$1($n,Ce,Hn),Ce.innerHTML=ke},p($n,[Hn]){Hn&1&&attr(Ce,"width",$n[0]),Hn&2&&attr(Ce,"height",$n[1]),Hn&4&&attr(Ce,"aria-labelledby",$n[2]),Hn&16&&attr(Ce,"stroke",$n[4]),Hn&8&&attr(Ce,"fill",$n[3])},i:noop,o:noop,d($n){$n&&detach(Ce)}}}function instance$1l(_n,Ce,ke){const $n={"trash-can":{path:'<path d="M135.2 17.69C140.6 6.848 151.7 0 163.8 0H284.2C296.3 0 307.4 6.848 312.8 17.69L320 32H416C433.7 32 448 46.33 448 64C448 81.67 433.7 96 416 96H32C14.33 96 0 81.67 0 64C0 46.33 14.33 32 32 32H128L135.2 17.69zM31.1 128H416V448C416 483.3 387.3 512 352 512H95.1C60.65 512 31.1 483.3 31.1 448V128zM111.1 208V432C111.1 440.8 119.2 448 127.1 448C136.8 448 143.1 440.8 143.1 432V208C143.1 199.2 136.8 192 127.1 192C119.2 192 111.1 199.2 111.1 208zM207.1 208V432C207.1 440.8 215.2 448 223.1 448C232.8 448 240 440.8 240 432V208C240 199.2 232.8 192 223.1 192C215.2 192 207.1 199.2 207.1 208zM304 208V432C304 440.8 311.2 448 320 448C328.8 448 336 440.8 336 432V208C336 199.2 328.8 192 320 192C311.2 192 304 199.2 304 208z"/>',viewBox:"0 0 448 512"},"circle-chevron-down":{path:'<path d="M256 0C114.6 0 0 114.6 0 256c0 141.4 114.6 256 256 256s256-114.6 256-256C512 114.6 397.4 0 256 0zM390.6 246.6l-112 112C272.4 364.9 264.2 368 256 368s-16.38-3.125-22.62-9.375l-112-112c-12.5-12.5-12.5-32.75 0-45.25s32.75-12.5 45.25 0L256 290.8l89.38-89.38c12.5-12.5 32.75-12.5 45.25 0S403.1 234.1 390.6 246.6z"/>',viewBox:"0 0 512 512"},"circle-chevron-up":{path:'<path d="M256 0C114.6 0 0 114.6 0 256c0 141.4 114.6 256 256 256s256-114.6 256-256C512 114.6 397.4 0 256 0zM390.6 310.6c-12.5 12.5-32.75 12.5-45.25 0L256 221.3L166.6 310.6c-12.5 12.5-32.75 12.5-45.25 0s-12.5-32.75 0-45.25l112-112C239.6 147.1 247.8 144 256 144s16.38 3.125 22.62 9.375l112 112C403.1 277.9 403.1 298.1 390.6 310.6z"/>',viewBox:"0 0 512 512"},ellipsis:{path:'<path d="M120 256C120 286.9 94.93 312 64 312C33.07 312 8 286.9 8 256C8 225.1 33.07 200 64 200C94.
Line truncated
|
||||
* @license
|
||||
* Lodash <https://lodash.com/>
|
||||
* Copyright OpenJS Foundation and other contributors <https://openjsf.org/>
|
||||
* Released under MIT license <https://lodash.com/license>
|
||||
* Based on Underscore.js 1.8.3 <http://underscorejs.org/LICENSE>
|
||||
* Copyright Jeremy Ashkenas, DocumentCloud and Investigative Reporters & Editors
|
||||
*/lodash.exports;(function(_n,Ce){(function(){var ke,$n="4.17.21",Hn=200,zn="Unsupported core-js use. Try https://npms.io/search?q=ponyfill.",Un="Expected a function",qn="Invalid `variable` option passed into `_.template`",Xn="__lodash_hash_undefined__",Kn=500,to="__lodash_placeholder__",io=1,uo=2,ho=4,bo=1,Oo=2,So=1,$o=2,Do=4,xo=8,Io=16,Vo=32,Jo=64,Mo=128,Go=256,os=512,ms=30,is="...",Yo=800,Ys=16,sr=1,Js=2,ko=3,gs=1/0,xs=9007199254740991,Qr=17976931348623157e292,cr=NaN,ws=4294967295,Fs=ws-1,Br=ws>>>1,_r=[["ary",Mo],["bind",So],["bindKey",$o],["curry",xo],["curryRight",Io],["flip",os],["partial",Vo],["partialRight",Jo],["rearg",Go]],ha="[object Arguments]",hs="[object Array]",Qs="[object AsyncFunction]",zo="[object Boolean]",el="[object Date]",ga="[object DOMException]",Ca="[object Error]",za="[object Function]",Il="[object GeneratorFunction]",Zs="[object Map]",Sr="[object Number]",Us="[object Null]",fs="[object Object]",dr="[object Promise]",Vr="[object Proxy]",nr="[object RegExp]",Kr="[object Set]",ra="[object String]",Ml="[object Symbol]",xa="[object Undefined]",Nl="[object WeakMap]",Zc="[object WeakSet]",cc="[object ArrayBuffer]",gc="[object DataView]",nc="[object Float32Array]",Ed="[object Float64Array]",Zl="[object Int8Array]",Vl="[object Int16Array]",Fc="[object Int32Array]",qa="[object Uint8Array]",Ya="[object Uint8ClampedArray]",kc="[object Uint16Array]",Yl="[object Uint32Array]",rd=/\b__p \+= '';/g,Al=/\b(__p \+=) '' \+/g,gd=/(__e\(.*?\)|\b__t\)) \+\n'';/g,Rr=/&(?:amp|lt|gt|quot|#39);/g,Pl=/[&<>"']/g,Su=RegExp(Rr.source),vs=RegExp(Pl.source),Es=/<%-([\s\S]+?)%>/g,Ks=/<%([\s\S]+?)%>/g,pr=/<%=([\s\S]+?)%>/g,ia=/\.|\[(?:[^[\]]*|(["'])(?:(?!\1)[^\\]|\\.)*?\1)\]/,ka=/^\w*$/,Ma=/[^.[\]]+|\[(?:(-?\d+(?:\.\d+)?)|(["'])((?:(?!\2)[^\\]|\\.)*?)\2)\]|(?=(?:\.|\[\])(?:\.|\[\]|$))/g,Mr=/[\\^$.*+?()[\]{}|]/g,il=RegExp(Mr.source),Na=/^\s+/,vl=/\s/,Rc=/\{(?:\n\/\* \[wrapped with .+\] \*\/)?\n?/,Vc=/\{\n\/\* \[wrapped with (.+)\] \*/,xc=/,? & /,zc=/[^\x00-\x2f\x3a-\x40\x5b-\x60\x7b-\x7f]+/g,ad=/[()=,{}\[\]\/\s]/,Bh=/\\(\\)?/g,Vu=/\$\{([^\\}]*(?:\\.[^\\}]*)*)\}/g,Ts=/\w*$/,ks=/^[-+]0x[0-9a-f]+$/i,ir=/^0b[01]+$/i,br=/^\[object .+?Constructor\]$/,Aa=/^0o[0-7]+$/i,Ba=/^(?:0|[1-9]\d*)$/,_l=/[\xc0-\xd6\xd8-\xf6\xf8-\xff\u0100-\u017f]/g,Hc=/($^)/,Ds=/['\n\r\u2028\u2029\\]/g,tl="\\ud800-\\udfff",wu="\\u0300-\\u036f",qu="\\ufe20-\\ufe2f",Md="\\u20d0-\\u20ff",bc=wu+qu+Md,nm="\\u2700-\\u27bf",Ff="a-z\\xdf-\\xf6\\xf8-\\xff",Ud="\\xac\\xb1\\xd7\\xf7",ld="\\x00-\\x2f\\x3a-\\x40\\x5b-\\x60\\x7b-\\xbf",oc="\\u2000-\\u206f",Dc=" \\t\\x0b\\f\\xa0\\ufeff\\n\\r\\u2028\\u2029\\u1680\\u180e\\u2000\\u2001\\u2002\\u2003\\u2004\\u2005\\u2006\\u2007\\u2008\\u2009\\u200a\\u202f\\u205f\\u3000",bd="A-Z\\xc0-\\xd6\\xd8-\\xde",Nd="\\ufe0e\\ufe0f",ih=Ud+ld+oc+Dc,om="['’]",sm="["+tl+"]",fc="["+ih+"]",Td="["+bc+"]",Jd="\\d+",Em="["+nm+"]",ef="["+Ff+"]",Cu="[^"+tl+ih+Jd+nm+Ff+bd+"]",Qc="\\ud83c[\\udffb-\\udfff]",Cf="(?:"+Td+"|"+Qc+")",qm="[^"+tl+"]",Oc="(?:\\ud83c[\\udde6-\\uddff]){2}",cd="[\\ud800-\\udbff][\\udc00-\\udfff]",vd="["+bd+"]",ju="\\u200d",Xf="(?:"+ef+"|"+Cu+")",Sh="(?:"+vd+"|"+Cu+")",Zd="(?:"+om+"(?:d|ll|m|re|s|t|ve))?",ah="(?:"+om+"(?:D|LL|M|RE|S|T|VE))?",lh=Cf+"?",Bp="["+Nd+"]?",ch="(?:"+ju+"(?:"+[qm,Oc,cd].join("|")+")"+Bp+lh+")*",bp="\\d*(?:1st|2nd|3rd|(?![123])\\dth)(?=\\b|[A-Z_])",kf="\\d*(?:1ST|2ND|3RD|(?![123])\\dTH)(?=\\b|[a-z_])",Fh=Bp+lh+ch,jm="(?:"+[Em,Oc,cd].join("|")+")"+Fh,Fp="(?:"+[qm+Td+"?",Td,Oc,cd,sm].join("|")+")",Eg=RegExp(om,"g"),rs=RegExp(Td,"g"),As=RegExp(Qc+"(?="+Qc+")|"+Fp+Fh,"g"),Ws=RegExp([vd+"?"+ef+"+"+Zd+"(?="+[fc,vd,"$"].join("|")+")",Sh+"+"+ah+"(?="+[fc,vd+Xf,"$"].join("|")+")",vd+"?"+Xf+"+"+Zd,vd+"+"+ah,kf,bp,Jd,jm].join("|"),"g"),rr=RegExp("["+ju+tl+bc+Nd+"]"),Fr=/[a-z][A-Z]|[A-Z]{2}[a-z]|[0-9][a-zA-Z]|[a-zA-Z][0-9]|[^a-zA-Z0-9 ]/,Wa=["Array","Buffer","DataView","Date","Error","Float32Array","Float64Array","Function","Int8Array","Int16Array","Int32Array","Map","Math","Object","Promise","RegExp","Set","String","Symbol","TypeError","Uint8Array","Uint8ClampedArray","Uint16Array","Uint32Array","WeakMap","_","clearTimeout","isFinite","parseInt","setTimeout"],Nc=-1,xl={};xl[nc]=xl[Ed]=xl[Zl]=xl[Vl]=xl[Fc]=xl[qa]=xl[Ya]=xl[kc]=xl[Yl]=!0,xl[ha]=xl[hs]=xl[cc]=xl[zo]=xl[gc]=xl[el]=xl[Ca]=xl[za]=xl[Zs]=xl[Sr]=xl[fs]=xl[nr]=xl[Kr]=xl[ra]=xl[Nl]=!1;var ul={};ul[ha]=ul[hs]=ul[cc]=ul[gc]=ul[zo]=ul[el]=ul[nc]=ul[Ed]=ul[Zl]=ul[Vl]=ul[Fc]=ul[Zs]=ul[Sr]=ul[fs]=ul[nr]=ul[Kr]=ul[ra]=ul[Ml]=ul[qa]=ul[Ya]=ul[kc]=ul[Yl]=!0,ul[Ca]=ul[za]=ul[Nl]=!1;var lu={À:"A",Á:"A",Â:"A",Ã:"A",Ä:"A",Å:"A",à:"a",á:"a",â:"a",ã:"a",ä:"a",å:"a",Ç:"C",ç:"c",Ð:"D",ð:"d",È:"E",É:"E",Ê:"E",Ë:"E",è:"e",é:"e",ê:"e",ë:"e",Ì:"I",Í:"I",Î:"I",Ï:"I",ì:"i",í:"i",î:"i",ï:"i",Ñ:"N",ñ:"n",Ò:"O",Ó:"O",Ô:"O",Õ:"O",Ö:"O",Ø:"O",ò:"o",ó:"o",ô:"o",õ:"o",ö:"o",ø:"o",Ù:"U",Ú:"U",Û:"U",Ü:"U",ù:"u",ú:"u",û:"u",ü:"u",Ý:"Y",ý:"y",ÿ:"y",Æ:"Ae",æ:"ae",Þ:"Th",þ:"th",ß:"ss",Ā:"A",Ă:"A",Ą:"A",ā:"a",ă:"a",ą:Line truncated
|
||||
/* [wrapped with `+co+`] */
|
||||
`)}function gS(so){return $l(so)||bf(so)||!!(Ag&&so&&so[Ag])}function K1(so,co){var wo=typeof so;return co=co??xs,!!co&&(wo=="number"||wo!="symbol"&&Ba.test(so))&&so>-1&&so%1==0&&so<co}function gm(so,co,wo){if(!Vd(wo))return!1;var Ho=typeof co;return(Ho=="number"?bu(wo)&&K1(co,wo.length):Ho=="string"&&co in wo)?Dd(wo[co],so):!1}function J1(so,co){if($l(so))return!1;var wo=typeof so;return wo=="number"||wo=="symbol"||wo=="boolean"||so==null||Cd(so)?!0:ka.test(so)||!ia.test(so)||co!=null&&so in Uc(co)}function Dv(so){var co=typeof so;return co=="string"||co=="number"||co=="symbol"||co=="boolean"?so!=="__proto__":so===null}function $0(so){var co=$v(so),wo=ss[co];if(typeof wo!="function"||!(co in Xc.prototype))return!1;if(so===wo)return!0;var Ho=ig(wo);return!!Ho&&so===Ho[0]}function Mv(so){return!!Af&&Af in so}var HO=Ku?f1:W0;function Ep(so){var co=so&&so.constructor,wo=typeof co=="function"&&co.prototype||Id;return so===wo}function ag(so){return so===so&&!Vd(so)}function Nv(so,co){return function(wo){return wo==null?!1:wo[so]===co&&(co!==ke||so in Uc(wo))}}function Tp(so){var co=Pp(so,function(Ho){return wo.size===Kn&&wo.clear(),Ho}),wo=co.cache;return co}function QO(so,co){var wo=so[1],Ho=co[1],ts=wo|Ho,Os=ts<(So|$o|Mo),Is=Ho==Mo&&wo==xo||Ho==Mo&&wo==Go&&so[7].length<=co[8]||Ho==(Mo|Go)&&co[7].length<=co[8]&&wo==xo;if(!(Os||Is))return so;Ho&So&&(so[2]=co[2],ts|=wo&So?0:Do);var qs=co[3];if(qs){var mr=so[3];so[3]=mr?Hy(mr,qs,co[4]):qs,so[4]=mr?Vf(so[3],to):co[4]}return qs=co[5],qs&&(mr=so[5],so[5]=mr?Z1(mr,qs,co[6]):qs,so[6]=mr?Vf(so[5],to):co[6]),qs=co[7],qs&&(so[7]=qs),Ho&Mo&&(so[8]=so[8]==null?co[8]:df(so[8],co[8])),so[9]==null&&(so[9]=co[9]),so[0]=co[0],so[1]=ts,so}function dC(so){var co=[];if(so!=null)for(var wo in Uc(so))co.push(wo);return co}function Lv(so){return e1.call(so)}function i1(so,co,wo){return co=Sd(co===ke?so.length-1:co,0),function(){for(var Ho=arguments,ts=-1,Os=Sd(Ho.length-co,0),Is=Tr(Os);++ts<Os;)Is[ts]=Ho[co+ts];ts=-1;for(var qs=Tr(co+1);++ts<co;)qs[ts]=Ho[ts];return qs[co]=wo(Is),jc(so,this,qs)}}function fC(so,co){return co.length<2?so:Pf(so,Fl(co,0,-1))}function Iv(so,co){for(var wo=so.length,Ho=df(co.length,wo),ts=Ah(so);Ho--;){var Os=co[Ho];so[Ho]=K1(Os,wo)?ts[Os]:ke}return so}function eb(so,co){if(!(co==="constructor"&&typeof so[co]=="function")&&co!="__proto__")return so[co]}var Ap=yS(mm),ph=tf||function(so,co){return Uo.setTimeout(so,co)},bS=yS(Nb);function vS(so,co,wo){var Ho=co+"";return bS(so,P2(Ho,VO(ET(Ho),wo)))}function yS(so){var co=0,wo=0;return function(){var Ho=vv(),ts=Ys-(Ho-wo);if(wo=Ho,ts>0){if(++co>=Yo)return arguments[0]}else co=0;return so.apply(ke,arguments)}}function Bv(so,co){var wo=-1,Ho=so.length,ts=Ho-1;for(co=co===ke?Ho:co;++wo<co;){var Os=Jp(wo,ts),Is=so[Os];so[Os]=so[wo],so[wo]=Is}return so.length=co,so}var bm=Tp(function(so){var co=[];return so.charCodeAt(0)===46&&co.push(""),so.replace(Ma,function(wo,Ho,ts,Os){co.push(ts?Os.replace(Bh,"$1"):Ho||wo)}),co});function Bm(so){if(typeof so=="string"||Cd(so))return so;var co=so+"";return co=="0"&&1/so==-gs?"-0":co}function a1(so){if(so!=null){try{return Rm.call(so)}catch{}try{return so+""}catch{}}return""}function VO(so,co){return El(_r,function(wo){var Ho="_."+wo[0];co&wo[1]&&!cu(so,Ho)&&so.push(Ho)}),so.sort()}function hC(so){if(so instanceof Xc)return so.clone();var co=new Ch(so.__wrapped__,so.__chain__);return co.__actions__=Ah(so.__actions__),co.__index__=so.__index__,co.__values__=so.__values__,co}function mC(so,co,wo){(wo?gm(so,co,wo):co===ke)?co=1:co=Sd(Ic(co),0);var Ho=so==null?0:so.length;if(!Ho||co<1)return[];for(var ts=0,Os=0,Is=Tr(lm(Ho/co));ts<Ho;)Is[Os++]=Fl(so,ts,ts+=co);return Is}function OS(so){for(var co=-1,wo=so==null?0:so.length,Ho=0,ts=[];++co<wo;){var Os=so[co];Os&&(ts[Ho++]=Os)}return ts}function Fv(){var so=arguments.length;if(!so)return[];for(var co=Tr(so-1),wo=arguments[0],Ho=so;Ho--;)co[Ho-1]=arguments[Ho];return vp($l(wo)?Ah(wo):[wo],hd(co,1))}var Hv=Sc(function(so,co){return vf(so)?Bd(so,hd(co,1,vf,!0)):[]}),zO=Sc(function(so,co){var wo=lg(co);return vf(wo)&&(wo=ke),vf(so)?Bd(so,hd(co,1,vf,!0),Ll(wo,2)):[]}),$2=Sc(function(so,co){var wo=lg(co);return vf(wo)&&(wo=ke),vf(so)?Bd(so,hd(co,1,vf,!0),ke,wo):[]});function WO(so,co,wo){var Ho=so==null?0:so.length;return Ho?(co=wo||co===ke?1:Ic(co),Fl(so,co<0?0:co,Ho)):[]}function Qv(so,co,wo){var Ho=so==null?0:so.length;return Ho?(co=wo||co===ke?1:Ic(co),co=Ho-co,Fl(so,0,co<0?0:co)):[]}function R2(so,co){return so&&so.length?o1(so,Ll(co,3),!0,!0):[]}function zy(so,co){return so&&so.length?o1(so,Ll(co,3),!0):[]}function _S(so,co,wo,Ho){var ts=so==null?0:so.length;return ts?(wo&&typeof wo!="number"&&gm(so,co,wo)&&(wo=0,Ho=ts),k0(so,co,wo,Ho)):[]}function vm(so,co,wo){var Ho=so==null?0:so.length;if(!Ho)return-1;var ts=wo==null?0:Ic(wo);return ts<0&&(ts=Sd(Ho+ts,0)),dd(so,Ll(co,3),ts)}function Wy(so,co,wo){var Ho=so==null?0:so.length;if(!Ho)return-1;var ts=Ho-1;return wo!==ke&&(ts=Ic(wo),ts=wo<0?Sd(Ho+ts,0):df(ts,Ho-1)),dd(so,Ll(co,3),ts,!0)
Line truncated
|
||||
`;so.replace(ja,function(Ul,nu,vu,nh,Mh,Rp){return vu||(vu=nh),ua+=so.slice(Xr,Rp).replace(Ds,Yf),nu&&(qs=!0,ua+=`' +
|
||||
__e(`+nu+`) +
|
||||
'`),Mh&&(mr=!0,ua+=`';
|
||||
`+Mh+`;
|
||||
__p += '`),vu&&(ua+=`' +
|
||||
((__t = (`+vu+`)) == null ? '' : __t) +
|
||||
'`),Xr=Rp+Ul.length,Ul}),ua+=`';
|
||||
`;var Kl=iu.call(co,"variable")&&co.variable;if(!Kl)ua=`with (obj) {
|
||||
`+ua+`
|
||||
}
|
||||
`;else if(ad.test(Kl))throw new zl(qn);ua=(mr?ua.replace(rd,""):ua).replace(Al,"$1").replace(gd,"$1;"),ua="function("+(Kl||"obj")+`) {
|
||||
`+(Kl?"":`obj || (obj = {});
|
||||
`)+"var __t, __p = ''"+(qs?", __e = _.escape":"")+(mr?`, __j = Array.prototype.join;
|
||||
function print() { __p += __j.call(arguments, '') }
|
||||
`:`;
|
||||
`)+ua+`return __p
|
||||
}`;var Pc=zC(function(){return _c(Os,wl+"return "+ua).apply(ke,Is)});if(Pc.source=ua,NS(Pc))throw Pc;return Pc}function lx(so){return Zu(so).toLowerCase()}function f_(so){return Zu(so).toUpperCase()}function cx(so,co,wo){if(so=Zu(so),so&&(wo||co===ke))return Tf(so);if(!so||!(co=Wu(co)))return so;var Ho=zf(so),ts=zf(co),Os=Vh(Ho,ts),Is=zp(Ho,ts)+1;return Cp(Ho,Os,Is).join("")}function VC(so,co,wo){if(so=Zu(so),so&&(wo||co===ke))return so.slice(0,b0(so)+1);if(!so||!(co=Wu(co)))return so;var Ho=zf(so),ts=zp(Ho,zf(co))+1;return Cp(Ho,0,ts).join("")}function sy(so,co,wo){if(so=Zu(so),so&&(wo||co===ke))return so.replace(Na,"");if(!so||!(co=Wu(co)))return so;var Ho=zf(so),ts=Vh(Ho,zf(co));return Cp(Ho,ts).join("")}function jS(so,co){var wo=ms,Ho=is;if(Vd(co)){var ts="separator"in co?co.separator:ts;wo="length"in co?Ic(co.length):wo,Ho="omission"in co?Wu(co.omission):Ho}so=Zu(so);var Os=so.length;if(jd(so)){var Is=zf(so);Os=Is.length}if(wo>=Os)return so;var qs=wo-Wp(Ho);if(qs<1)return Ho;var mr=Is?Cp(Is,0,qs).join(""):so.slice(0,qs);if(ts===ke)return mr+Ho;if(Is&&(qs+=mr.length-qs),Jy(ts)){if(so.slice(qs).search(ts)){var Xr,jr=mr;for(ts.global||(ts=D1(ts.source,Zu(Ts.exec(ts))+"g")),ts.lastIndex=0;Xr=ts.exec(jr);)var ua=Xr.index;mr=mr.slice(0,ua===ke?qs:ua)}}else if(so.indexOf(Wu(ts),qs)!=qs){var ja=mr.lastIndexOf(ts);ja>-1&&(mr=mr.slice(0,ja))}return mr+Ho}function XS(so){return so=Zu(so),so&&Su.test(so)?so.replace(Rr,Cs):so}var YS=j1(function(so,co,wo){return so+(wo?" ":"")+co.toUpperCase()}),h_=kv("toUpperCase");function m_(so,co,wo){return so=Zu(so),co=wo?ke:co,co===ke?$m(so)?Kg(so):A1(so):so.match(co)||[]}var zC=Sc(function(so,co){try{return jc(so,ke,co)}catch(wo){return NS(wo)?wo:new zl(wo)}}),p_=Y1(function(so,co){return El(co,function(wo){wo=Bm(wo),Nm(so,wo,Yd(so[wo],so))}),so});function g_(so){var co=so==null?0:so.length,wo=Ll();return so=co?ud(so,function(Ho){if(typeof Ho[1]!="function")throw new _d(Un);return[wo(Ho[0]),Ho[1]]}):[],Sc(function(Ho){for(var ts=-1;++ts<co;){var Os=so[ts];if(jc(Os[0],this,Ho))return jc(Os[1],this,Ho)}})}function ux(so){return Gf(td(so,io))}function rO(so){return function(){return so}}function WC(so,co){return so==null||so!==so?co:so}var dx=Tv(),GS=Tv(!0);function lp(so){return so}function jb(so){return _o(typeof so=="function"?so:td(so,io))}function fx(so){return vr(td(so,io))}function KS(so,co){return zr(so,td(co,io))}var hx=Sc(function(so,co){return function(wo){return np(wo,so,co)}}),mx=Sc(function(so,co){return function(wo){return np(so,wo,co)}});function JS(so,co,wo){var Ho=th(co),ts=Mb(co,Ho);wo==null&&!(Vd(co)&&(ts.length||!Ho.length))&&(wo=co,co=so,so=this,ts=Mb(co,th(co)));var Os=!(Vd(wo)&&"chain"in wo)||!!wo.chain,Is=f1(so);return El(ts,function(qs){var mr=co[qs];so[qs]=mr,Is&&(so.prototype[qs]=function(){var Xr=this.__chain__;if(Os||Xr){var jr=so(this.__wrapped__),ua=jr.__actions__=Ah(this.__actions__);return ua.push({func:mr,args:arguments,thisArg:so}),jr.__chain__=Xr,jr}return mr.apply(so,vp([this.value()],arguments))})}),so}function UC(){return Uo._===this&&(Uo._=M1),this}function ew(){}function Zf(so){return so=Ic(so),Sc(function(co){return Ol(co,so)})}var DT=Av(ud),ry=Av(hu),b_=Av(Pm);function tw(so){return J1(so)?qd(Bm(so)):Uh(so)}function nw(so){return function(co){return so==null?ke:Pf(so,co)}}var ZC=LO(),qC=LO(!0);function cb(){return[]}function W0(){return!1}function px(){return{}}function gx(){return""}function iO(){return!0}function ow(so,co){if(so=Ic(so),so<1||so>xs)return[];var wo=ws,Ho=df(so,ws);co=Ll(co),so-=ws;for(var ts=Gc(Ho,co);++wo<so;)co(wo);return ts}function jC(so){return $l(so)?ud(so,Bm):Cd(so)?[so]:Ah(bm(Zu(so)))}function _f(so){var co=++am;return Zu(so)+co}var XC=og(function(so,co){return so+co},0),sw=Qy("ceil"),MT=og(function(so,co){return so/co},1),iy=Qy("floor");function bx(so){return so&&so.length?Kf(so,lp,Mg):ke}function YC(so,co){return so&&so.length?Kf(so,Ll(co,2),Mg):ke}function rw(so){return lf(so,lp)}function aO(so,co){return lf(so,Ll(co,2))}function v_(so){return so&&so.length?Kf(so,lp,as):ke}function ay(so,co){return so&&so.length?Kf(so,Ll(co,2),as):ke}var vx=og(function(so,co){return so*co},1),Xb=Qy("round"),GC=og(function(so,co){return so-co},0);function Yb(so){return so&&so.length?Xg(so,lp):0}function Gb(so,co){return so&&so.length?Xg(so,Ll(co,2)):0}return ss.after=tu,ss.ary=Gv,ss.assign=U2,ss.assignIn=bh,ss.assignInWith=Zb,ss.assignWith=Z2,ss.at=q2,ss.before=e_,ss.bind=Yd,ss.bindAll=p_,ss.bindKey=Hg,ss.castArray=s_,ss.chain=Fm,ss.chunk=mC,ss.compact=OS,ss.concat=Fv,ss.cond=g_,ss.conforms=ux,ss.constant=rO,ss.countBy=qv,ss.create=HS,ss.curry=sb,ss.curryRight=t_,ss.debounce=jy,ss.defaults=j2,ss.defaultsDeep=AC,ss.defer=Xy,ss.delay=TS,ss.difference=Hv,ss.differenceBy=zO,ss.differenceWith=$2,ss.drop=WO,ss.dropRight=Qv,ss.dropRightWhile=R2,ss.dropWhile=zy,ss.fill=_S,ss.filter=I0,ss.flatMap=wC,ss.flatMapDeep=F0,ss.flatMapDepth=Vb,ss.flatten=SS,ss.flattenDeep=UO,ss.flattenDepth=TT,ss.flip=n_,ss.flow=dx,ss.flowRight=GS,ss.fromPai
Line truncated
|
||||
* mustache.js - Logic-less {{mustache}} templates with JavaScript
|
||||
* http://github.com/janl/mustache.js
|
||||
*/var objectToString=Object.prototype.toString,isArray=Array.isArray||function(Ce){return objectToString.call(Ce)==="[object Array]"};function isFunction(_n){return typeof _n=="function"}function typeStr(_n){return isArray(_n)?"array":typeof _n}function escapeRegExp(_n){return _n.replace(/[\-\[\]{}()*+?.,\\\^$|#\s]/g,"\\$&")}function hasProperty(_n,Ce){return _n!=null&&typeof _n=="object"&&Ce in _n}function primitiveHasOwnProperty(_n,Ce){return _n!=null&&typeof _n!="object"&&_n.hasOwnProperty&&_n.hasOwnProperty(Ce)}var regExpTest=RegExp.prototype.test;function testRegExp(_n,Ce){return regExpTest.call(_n,Ce)}var nonSpaceRe=/\S/;function isWhitespace(_n){return!testRegExp(nonSpaceRe,_n)}var entityMap={"&":"&","<":"<",">":">",'"':""","'":"'","/":"/","`":"`","=":"="};function escapeHtml(_n){return String(_n).replace(/[&<>"'`=\/]/g,function(ke){return entityMap[ke]})}var whiteRe=/\s*/,spaceRe=/\s+/,equalsRe=/\s*=/,curlyRe=/\s*\}/,tagRe=/#|\^|\/|>|\{|&|=|!/;function parseTemplate(_n,Ce){if(!_n)return[];var ke=!1,$n=[],Hn=[],zn=[],Un=!1,qn=!1,Xn="",Kn=0;function to(){if(Un&&!qn)for(;zn.length;)delete Hn[zn.pop()];else zn=[];Un=!1,qn=!1}var io,uo,ho;function bo(Go){if(typeof Go=="string"&&(Go=Go.split(spaceRe,2)),!isArray(Go)||Go.length!==2)throw new Error("Invalid tags: "+Go);io=new RegExp(escapeRegExp(Go[0])+"\\s*"),uo=new RegExp("\\s*"+escapeRegExp(Go[1])),ho=new RegExp("\\s*"+escapeRegExp("}"+Go[1]))}bo(Ce||mustache.tags);for(var Oo=new Scanner(_n),So,$o,Do,xo,Io,Vo;!Oo.eos();){if(So=Oo.pos,Do=Oo.scanUntil(io),Do)for(var Jo=0,Mo=Do.length;Jo<Mo;++Jo)xo=Do.charAt(Jo),isWhitespace(xo)?(zn.push(Hn.length),Xn+=xo):(qn=!0,ke=!0,Xn+=" "),Hn.push(["text",xo,So,So+1]),So+=1,xo===`
|
||||
`&&(to(),Xn="",Kn=0,ke=!1);if(!Oo.scan(io))break;if(Un=!0,$o=Oo.scan(tagRe)||"name",Oo.scan(whiteRe),$o==="="?(Do=Oo.scanUntil(equalsRe),Oo.scan(equalsRe),Oo.scanUntil(uo)):$o==="{"?(Do=Oo.scanUntil(ho),Oo.scan(curlyRe),Oo.scanUntil(uo),$o="&"):Do=Oo.scanUntil(uo),!Oo.scan(uo))throw new Error("Unclosed tag at "+Oo.pos);if($o==">"?Io=[$o,Do,So,Oo.pos,Xn,Kn,ke]:Io=[$o,Do,So,Oo.pos],Kn++,Hn.push(Io),$o==="#"||$o==="^")$n.push(Io);else if($o==="/"){if(Vo=$n.pop(),!Vo)throw new Error('Unopened section "'+Do+'" at '+So);if(Vo[1]!==Do)throw new Error('Unclosed section "'+Vo[1]+'" at '+So)}else $o==="name"||$o==="{"||$o==="&"?qn=!0:$o==="="&&bo(Do)}if(to(),Vo=$n.pop(),Vo)throw new Error('Unclosed section "'+Vo[1]+'" at '+Oo.pos);return nestTokens(squashTokens(Hn))}function squashTokens(_n){for(var Ce=[],ke,$n,Hn=0,zn=_n.length;Hn<zn;++Hn)ke=_n[Hn],ke&&(ke[0]==="text"&&$n&&$n[0]==="text"?($n[1]+=ke[1],$n[3]=ke[3]):(Ce.push(ke),$n=ke));return Ce}function nestTokens(_n){for(var Ce=[],ke=Ce,$n=[],Hn,zn,Un=0,qn=_n.length;Un<qn;++Un)switch(Hn=_n[Un],Hn[0]){case"#":case"^":ke.push(Hn),$n.push(Hn),ke=Hn[4]=[];break;case"/":zn=$n.pop(),zn[5]=Hn[2],ke=$n.length>0?$n[$n.length-1][4]:Ce;break;default:ke.push(Hn)}return Ce}function Scanner(_n){this.string=_n,this.tail=_n,this.pos=0}Scanner.prototype.eos=function(){return this.tail===""};Scanner.prototype.scan=function(Ce){var ke=this.tail.match(Ce);if(!ke||ke.index!==0)return"";var $n=ke[0];return this.tail=this.tail.substring($n.length),this.pos+=$n.length,$n};Scanner.prototype.scanUntil=function(Ce){var ke=this.tail.search(Ce),$n;switch(ke){case-1:$n=this.tail,this.tail="";break;case 0:$n="";break;default:$n=this.tail.substring(0,ke),this.tail=this.tail.substring(ke)}return this.pos+=$n.length,$n};function Context$1(_n,Ce){this.view=_n,this.cache={".":this.view},this.parent=Ce}Context$1.prototype.push=function(Ce){return new Context$1(Ce,this)};Context$1.prototype.lookup=function(Ce){var ke=this.cache,$n;if(ke.hasOwnProperty(Ce))$n=ke[Ce];else{for(var Hn=this,zn,Un,qn,Xn=!1;Hn;){if(Ce.indexOf(".")>0)for(zn=Hn.view,Un=Ce.split("."),qn=0;zn!=null&&qn<Un.length;)qn===Un.length-1&&(Xn=hasProperty(zn,Un[qn])||primitiveHasOwnProperty(zn,Un[qn])),zn=zn[Un[qn++]];else zn=Hn.view[Ce],Xn=hasProperty(Hn.view,Ce);if(Xn){$n=zn;break}Hn=Hn.parent}ke[Ce]=$n}return isFunction($n)&&($n=$n.call(this.view)),$n};function Writer(){this.templateCache={_cache:{},set:function(Ce,ke){this._cache[Ce]=ke},get:function(Ce){return this._cache[Ce]},clear:function(){this._cache={}}}}Writer.prototype.clearCache=function(){typeof this.templateCache<"u"&&this.templateCache.clear()};Writer.prototype.parse=function(Ce,ke){var $n=this.templateCache,Hn=Ce+":"+(ke||mustache.tags).join(":"),zn=typeof $n<"u",Un=zn?$n.get(Hn):void 0;return Un==null&&(Un=parseTemplate(Ce,ke),zn&&$n.set(Hn,Un)),Un};Writer.prototype.render=function(Ce,ke,$n,Hn){var zn=this.getConfigTags(Hn),Un=this.parse(Ce,zn),qn=ke instanceof Context$1?ke:new Context$1(ke,void 0);return this.renderTokens(Un,qn,$n,Ce,Hn)};Writer.prototype.renderTokens=function(Ce,ke,$n,Hn,zn){for(var Un="",qn,Xn,Kn,to=0,io=Ce.length;to<io;++to)Kn=void 0,qn=Ce[to],Xn=qn[0],Xn==="#"?Kn=this.renderSection(qn,ke,$n,Hn,zn):Xn==="^"?Kn=this.renderInverted(qn,ke,$n,Hn,zn):Xn===">"?Kn=this.renderPartial(qn,ke,$n,zn):Xn==="&"?Kn=this.unescapedValue(qn,ke):Xn==="name"?Kn=this.escapedValue(qn,ke,zn):Xn==="text"&&(Kn=this.rawValue(qn)),Kn!==void 0&&(Un+=Kn);return Un};Writer.prototype.renderSection=function(Ce,ke,$n,Hn,zn){var Un=this,qn="",Xn=ke.lookup(Ce[1]);function Kn(uo){return Un.render(uo,ke,$n,zn)}if(Xn){if(isArray(Xn))for(var to=0,io=Xn.length;to<io;++to)qn+=this.renderTokens(Ce[4],ke.push(Xn[to]),$n,Hn,zn);else if(typeof Xn=="object"||typeof Xn=="string"||typeof Xn=="number")qn+=this.renderTokens(Ce[4],ke.push(Xn),$n,Hn,zn);else if(isFunction(Xn)){if(typeof Hn!="string")throw new Error("Cannot use higher-order sections without the original template");Xn=Xn.call(ke.view,Hn.slice(Ce[3],Ce[5]),Kn),Xn!=null&&(qn+=Xn)}else qn+=this.renderTokens(Ce[4],ke,$n,Hn,zn);return qn}};Writer.prototype.renderInverted=function(Ce,ke,$n,Hn,zn){var Un=ke.lookup(Ce[1]);if(!Un||isArray(Un)&&Un.length===0)return this.renderTokens(Ce[4],ke,$n,Hn,zn)};Writer.prototype.indentPartial=function(Ce,ke,$n){for(var Hn=ke.replace(/[^ \t]/g,""),zn=Ce.split(`
|
||||
`),Un=0;Un<zn.length;Un++)zn[Un].length&&(Un>0||!$n)&&(zn[Un]=Hn+zn[Un]);return zn.join(`
|
||||
`)};Writer.prototype.renderPartial=function(Ce,ke,$n,Hn){if($n){var zn=this.getConfigTags(Hn),Un=isFunction($n)?$n(Ce[1]):$n[Ce[1]];if(Un!=null){var qn=Ce[6],Xn=Ce[5],Kn=Ce[4],to=Un;Xn==0&&Kn&&(to=this.indentPartial(Un,Kn,qn));var io=this.parse(to,zn);return this.renderTokens(io,ke,$n,to,Hn)}}};Writer.prototype.unescapedValue=function(Ce,ke){var $n=ke.lookup(Ce[1]);if($n!=null)return $n};Writer.prototype.escapedValue=function(Ce,ke,$n){var Hn=this.getConfigEscape($n)||mustache.escape,zn=ke.lookup(Ce[1]);if(zn!=null)return typeof zn=="number"&&Hn===mustache.escape?String(zn):Hn(zn)};Writer.prototype.rawValue=function(Ce){return Ce[1]};Writer.prototype.getConfigTags=function(Ce){return isArray(Ce)?Ce:Ce&&typeof Ce=="object"?Ce.tags:void 0};Writer.prototype.getConfigEscape=function(Ce){if(Ce&&typeof Ce=="object"&&!isArray(Ce))return Ce.escape};var mustache={name:"mustache.js",version:"4.2.0",tags:["{{","}}"],clearCache:void 0,escape:void 0,parse:void 0,render:void 0,Scanner:void 0,Context:void 0,Writer:void 0,set templateCache(_n){defaultWriter.templateCache=_n},get templateCache(){return defaultWriter.templateCache}},defaultWriter=new Writer;mustache.clearCache=function(){return defaultWriter.clearCache()};mustache.parse=function(Ce,ke){return defaultWriter.parse(Ce,ke)};mustache.render=function(Ce,ke,$n,Hn){if(typeof Ce!="string")throw new TypeError('Invalid template! Template should be a "string" but "'+typeStr(Ce)+'" was given as the first argument for mustache#render(template, view, partials)');return defaultWriter.render(Ce,ke,$n,Hn)};mustache.escape=escapeHtml;mustache.Scanner=Scanner;mustache.Context=Context$1;mustache.Writer=Writer;function previewTitle(_n,Ce,ke){let $n=_n.find(Un=>Un.name===(Ce==null?void 0:Ce.schema));if(!($n!=null&&$n.cardTitle))return noTemplate($n,Ce);let Hn=Ce.data,zn=mustache.render($n.cardTitle,Hn);return!zn||zn===""?noTemplate($n,Ce):stripHtml(zn.slice(0,300))}function noTemplate(_n,Ce){var $n;if((_n==null?void 0:_n.type)==="files")return Ce._file.path;let ke=stripHtml(Ce==null?void 0:Ce.data[($n=_n.fields.filter(Hn=>Hn.info.name==="text")[0])==null?void 0:$n.name]).slice(0,300);return ke.trim()===""?"~Untitled~":ke}function create_else_block$j(_n){let Ce;return{c(){Ce=text("New Record")},m(ke,$n){insert$1(ke,Ce,$n)},p:noop,d(ke){ke&&detach(Ce)}}}function create_if_block$J(_n){let Ce=previewTitle(_n[3].schemas,_n[1])+"",ke;return{c(){ke=text(Ce)},m($n,Hn){insert$1($n,ke,Hn)},p($n,Hn){Hn&2&&Ce!==(Ce=previewTitle($n[3].schemas,$n[1])+"")&&set_data(ke,Ce)},d($n){$n&&detach(ke)}}}function create_fragment$13(_n){let Ce,ke,$n=_n[0].label.toUpperCase()+"",Hn,zn,Un,qn;function Xn(io,uo){return io[2]?create_else_block$j:create_if_block$J}let Kn=Xn(_n),to=Kn(_n);return{c(){Ce=element("div"),ke=element("a"),Hn=text($n),Un=space$3(),qn=element("span"),to.c(),attr(ke,"class","schema-name"),attr(ke,"href",zn=_n[3].lucentUrl+"/content/"+_n[0].name),attr(qn,"class","record-title"),attr(Ce,"class","record-header")},m(io,uo){insert$1(io,Ce,uo),append(Ce,ke),append(ke,Hn),append(Ce,Un),append(Ce,qn),to.m(qn,null)},p(io,[uo]){uo&1&&$n!==($n=io[0].label.toUpperCase()+"")&&set_data(Hn,$n),uo&1&&zn!==(zn=io[3].lucentUrl+"/content/"+io[0].name)&&attr(ke,"href",zn),Kn===(Kn=Xn(io))&&to?to.p(io,uo):(to.d(1),to=Kn(io),to&&(to.c(),to.m(qn,null)))},i:noop,o:noop,d(io){io&&detach(Ce),to.d()}}}function instance$13(_n,Ce,ke){const $n=getContext$1("channel");let{schema:Hn}=Ce,{record:zn}=Ce,{isCreateMode:Un}=Ce;return _n.$$set=qn=>{"schema"in qn&&ke(0,Hn=qn.schema),"record"in qn&&ke(1,zn=qn.record),"isCreateMode"in qn&&ke(2,Un=qn.isCreateMode)},[Hn,zn,Un,$n]}class Title extends SvelteComponent{constructor(Ce){super(),init(this,Ce,instance$13,create_fragment$13,safe_not_equal,{schema:0,record:1,isCreateMode:2})}}function get_each_context$m(_n,Ce,ke){const $n=_n.slice();return $n[24]=Ce[ke],$n}function create_if_block_2$b(_n){let Ce,ke,$n;return{c(){Ce=element("button"),Ce.innerHTML=`<span class="spinner-border spinner-border-sm" role="status" aria-hidden="true"></span>
|
||||
Save`,attr(Ce,"type","button"),attr(Ce,"class","button primary ms-2 btn btn-primary btn-spinner")},m(Hn,zn){insert$1(Hn,Ce,zn),ke||($n=listen(Ce,"click",_n[10]),ke=!0)},p:noop,d(Hn){Hn&&detach(Ce),ke=!1,$n()}}}function create_if_block_1$o(_n){let Ce,ke,$n;return{c(){Ce=element("button"),Ce.innerHTML=`<span class="spinner-border spinner-border-sm" role="status" aria-hidden="true"></span>
|
||||
Create`,attr(Ce,"class","button primary btn-spinner")},m(Hn,zn){insert$1(Hn,Ce,zn),ke||($n=listen(Ce,"click",_n[10]),ke=!0)},p:noop,d(Hn){Hn&&detach(Ce),ke=!1,$n()}}}function create_if_block$I(_n){let Ce,ke,$n,Hn;function zn(Xn){_n[14](Xn)}function Un(Xn){_n[15](Xn)}let qn={field:_n[24],schema:_n[2],record:_n[0],validationErrors:_n[4],isCreateMode:_n[3]};return _n[0].data!==void 0&&(qn.data=_n[0].data),_n[1]!==void 0&&(qn.graph=_n[1]),Ce=new FormField({props:qn}),binding_callbacks.push(()=>bind(Ce,"data",zn)),binding_callbacks.push(()=>bind(Ce,"graph",Un)),{c(){create_component(Ce.$$.fragment)},m(Xn,Kn){mount_component(Ce,Xn,Kn),Hn=!0},p(Xn,Kn){const to={};Kn&4&&(to.schema=Xn[2]),Kn&1&&(to.record=Xn[0]),Kn&16&&(to.validationErrors=Xn[4]),Kn&8&&(to.isCreateMode=Xn[3]),!ke&&Kn&1&&(ke=!0,to.data=Xn[0].data,add_flush_callback(()=>ke=!1)),!$n&&Kn&2&&($n=!0,to.graph=Xn[1],add_flush_callback(()=>$n=!1)),Ce.$set(to)},i(Xn){Hn||(transition_in(Ce.$$.fragment,Xn),Hn=!0)},o(Xn){transition_out(Ce.$$.fragment,Xn),Hn=!1},d(Xn){destroy_component(Ce,Xn)}}}function create_each_block$m(_n,Ce){let ke,$n,Hn,zn=Ce[5]===Ce[24].group&&create_if_block$I(Ce);return{key:_n,first:null,c(){ke=empty$1(),zn&&zn.c(),$n=empty$1(),this.first=ke},m(Un,qn){insert$1(Un,ke,qn),zn&&zn.m(Un,qn),insert$1(Un,$n,qn),Hn=!0},p(Un,qn){Ce=Un,Ce[5]===Ce[24].group?zn?(zn.p(Ce,qn),qn&32&&transition_in(zn,1)):(zn=create_if_block$I(Ce),zn.c(),transition_in(zn,1),zn.m($n.parentNode,$n)):zn&&(group_outros(),transition_out(zn,1,1,()=>{zn=null}),check_outros())},i(Un){Hn||(transition_in(zn),Hn=!0)},o(Un){transition_out(zn),Hn=!1},d(Un){Un&&(detach(ke),detach($n)),zn&&zn.d(Un)}}}function create_fragment$12(_n){let Ce,ke,$n,Hn,zn,Un,qn,Xn,Kn,to,io,uo,ho,bo,Oo,So,$o,Do=[],xo=new Map,Io,Vo,Jo;function Mo(gs){_n[11](gs)}function Go(gs){_n[12](gs)}let os={schema:_n[2],isCreateMode:_n[3]};_n[0]!==void 0&&(os.record=_n[0]),_n[5]!==void 0&&(os.activeContentTab=_n[5]),$n=new EditHeader({props:os}),binding_callbacks.push(()=>bind($n,"record",Mo)),binding_callbacks.push(()=>bind($n,"activeContentTab",Go));function ms(gs,xs){if(gs[3])return create_if_block_1$o;if(gs[6])return create_if_block_2$b}let is=ms(_n),Yo=is&&is(_n);Xn=new Title({props:{schema:_n[2],record:_n[0],isCreateMode:_n[3]}}),to=new ErrorAlert({props:{message:_n[7]}});function Ys(gs){_n[13](gs)}let sr={schema:_n[2],isCreateMode:_n[3]};_n[5]!==void 0&&(sr.active=_n[5]),ho=new ContentTabs({props:sr}),binding_callbacks.push(()=>bind(ho,"active",Ys)),So=new FilePreview({props:{record:_n[0],schema:_n[2]}});let Js=ensure_array_like(_n[8]);const ko=gs=>gs[24].name;for(let gs=0;gs<Js.length;gs+=1){let xs=get_each_context$m(_n,Js,gs),Qr=ko(xs);xo.set(Qr,Do[gs]=create_each_block$m(Qr,xs))}return{c(){Ce=element("div"),ke=element("div"),create_component($n.$$.fragment),Un=space$3(),Yo&&Yo.c(),qn=space$3(),create_component(Xn.$$.fragment),Kn=space$3(),create_component(to.$$.fragment),io=space$3(),uo=element("div"),create_component(ho.$$.fragment),Oo=space$3(),create_component(So.$$.fragment),$o=space$3();for(let gs=0;gs<Do.length;gs+=1)Do[gs].c();attr(ke,"class","tools-header"),attr(uo,"class","mt-4"),set_style(uo,"margin-bottom","150px"),set_style(uo,"position","relative"),attr(Ce,"class","inline-edit record-edit")},m(gs,xs){insert$1(gs,Ce,xs),append(Ce,ke),mount_component($n,ke,null),append(ke,Un),Yo&&Yo.m(ke,null),append(Ce,qn),mount_component(Xn,Ce,null),append(Ce,Kn),mount_component(to,Ce,null),append(Ce,io),append(Ce,uo),mount_component(ho,uo,null),append(uo,Oo),mount_component(So,uo,null),append(uo,$o);for(let Qr=0;Qr<Do.length;Qr+=1)Do[Qr]&&Do[Qr].m(uo,null);Io=!0,Vo||(Jo=listen(window,"beforeunload",_n[9]),Vo=!0)},p(gs,[xs]){const Qr={};xs&4&&(Qr.schema=gs[2]),xs&8&&(Qr.isCreateMode=gs[3]),!Hn&&xs&1&&(Hn=!0,Qr.record=gs[0],add_flush_callback(()=>Hn=!1)),!zn&&xs&32&&(zn=!0,Qr.activeContentTab=gs[5],add_flush_callback(()=>zn=!1)),$n.$set(Qr),is===(is=ms(gs))&&Yo?Yo.p(gs,xs):(Yo&&Yo.d(1),Yo=is&&is(gs),Yo&&(Yo.c(),Yo.m(ke,null)));const cr={};xs&4&&(cr.schema=gs[2]),xs&1&&(cr.record=gs[0]),xs&8&&(cr.isCreateMode=gs[3]),Xn.$set(cr);const ws={};xs&128&&(ws.message=gs[7]),to.$set(ws);const Fs={};xs&4&&(Fs.schema=gs[2]),xs&8&&(Fs.isCreateMode=gs[3]),!bo&&xs&32&&(bo=!0,Fs.active=gs[5],add_flush_callback(()=>bo=!1)),ho.$set(Fs);const Br={};xs&1&&(Br.record=gs[0]),xs&4&&(Br.schema=gs[2]),So.$set(Br),xs&319&&(Js=ensure_array_like(gs[8]),group_outros(),Do=update_keyed_each(Do,xs,ko,1,gs,Js,xo,uo,outro_and_destroy_block,create_each_block$m,null,get_each_context$m),check_outros())},i(gs){if(!Io){transition_in($n.$$.fragment,gs),transition_in(Xn.$$.fragment,gs),transition_in(to.$$.fragment,gs),transition_in(ho.$$.fragment,gs),transition_in(So.$$.fragment,gs);for(let xs=0;xs<Js.length;xs+=1)transition_in(Do[xs]);Io=!0}},o(gs){transition_out($n.$$.fragment,gs),transition_out(Xn.$$.fragment,gs),transition_out(to.$$.fragment,gs),transition_out(ho.$$.fragment,gs),transition_out(So.$$.fragment,gs);for(let xs=0;xs<Do.len
Line truncated
|
||||
`,attr(Ce,"class","start-typing")},m(ke,$n){insert$1(ke,Ce,$n)},p:noop,d(ke){ke&&detach(Ce)}}}function create_each_block$l(_n,Ce){let ke,$n=previewTitle(Ce[3].schemas,Ce[11])+"",Hn,zn,Un,qn;function Xn(...to){return Ce[8](Ce[11],...to)}function Kn(...to){return Ce[9](Ce[11],...to)}return{key:_n,first:null,c(){ke=element("div"),Hn=text($n),zn=space$3(),attr(ke,"class","reference-tags-option"),attr(ke,"role","button"),attr(ke,"tabindex","0"),this.first=ke},m(to,io){insert$1(to,ke,io),append(ke,Hn),append(ke,zn),Un||(qn=[listen(ke,"click",Xn),listen(ke,"keypress",Kn)],Un=!0)},p(to,io){Ce=to,io&4&&$n!==($n=previewTitle(Ce[3].schemas,Ce[11])+"")&&set_data(Hn,$n)},d(to){to&&detach(ke),Un=!1,run_all(qn)}}}function create_fragment$11(_n){let Ce,ke,$n,Hn,zn,Un,qn,Xn=_n[2]&&create_if_block$H(_n);return{c(){Ce=element("div"),ke=element("input"),Hn=space$3(),zn=element("div"),Xn&&Xn.c(),attr(ke,"type","search"),attr(ke,"placeholder",$n="Search for "+_n[0].label),attr(ke,"autocomplete","off"),attr(zn,"class","reference-tags-results"),attr(Ce,"class","reference-tags")},m(Kn,to){insert$1(Kn,Ce,to),append(Ce,ke),set_input_value(ke,_n[1]),append(Ce,Hn),append(Ce,zn),Xn&&Xn.m(zn,null),Un||(qn=[listen(ke,"keyup",_n[4]),listen(ke,"input",_n[7])],Un=!0)},p(Kn,[to]){to&1&&$n!==($n="Search for "+Kn[0].label)&&attr(ke,"placeholder",$n),to&2&&ke.value!==Kn[1]&&set_input_value(ke,Kn[1]),Kn[2]?Xn?Xn.p(Kn,to):(Xn=create_if_block$H(Kn),Xn.c(),Xn.m(zn,null)):Xn&&(Xn.d(1),Xn=null)},i:noop,o:noop,d(Kn){Kn&&detach(Ce),Xn&&Xn.d(),Un=!1,run_all(qn)}}}function instance$11(_n,Ce,ke){let $n;const Hn=getContext$1("channel"),zn=createEventDispatcher();let{value:Un=""}=Ce,{field:qn}=Ce,Xn="";const Kn=lodashExports.debounce(bo=>{axios.get(Hn.lucentUrl+"/records/suggestions",{params:{schema:qn.collections[0],field:"search",value:Xn,ui:"search"}}).then(Oo=>{ke(2,$n=Oo.data)}).catch(Oo=>{ke(2,$n=[]),console.log(Oo)})},500);function to(bo,Oo){bo.preventDefault(),ke(6,Un=Oo.id),zn("addFilter"),ke(6,Un="")}function io(){Xn=this.value,ke(1,Xn)}const uo=(bo,Oo)=>to(Oo,bo),ho=(bo,Oo)=>to(Oo,bo);return _n.$$set=bo=>{"value"in bo&&ke(6,Un=bo.value),"field"in bo&&ke(0,qn=bo.field)},ke(2,$n=[]),[qn,Xn,$n,Hn,Kn,to,Un,io,uo,ho]}class FilterReferenceInput extends SvelteComponent{constructor(Ce){super(),init(this,Ce,instance$11,create_fragment$11,safe_not_equal,{value:6,field:0})}}function get_each_context$k(_n,Ce,ke){const $n=_n.slice();return $n[39]=Ce[ke],$n}function get_each_context_1$7(_n,Ce,ke){const $n=_n.slice();return $n[42]=Ce[ke],$n}function get_each_context_2$2(_n,Ce,ke){const $n=_n.slice();return $n[39]=Ce[ke],$n}function create_if_block_4$6(_n){let Ce,ke,$n,Hn,zn,Un,qn,Xn;ke=new Icon({props:{icon:"arrow-left"}});let Kn=ensure_array_like(_n[9]),to=[];for(let io=0;io<Kn.length;io+=1)to[io]=create_each_block_2$2(get_each_context_2$2(_n,Kn,io));return{c(){Ce=element("button"),create_component(ke.$$.fragment),$n=text(`
|
||||
Back`),Hn=space$3();for(let io=0;io<to.length;io+=1)to[io].c();zn=empty$1(),attr(Ce,"class","dropdown-item button")},m(io,uo){insert$1(io,Ce,uo),mount_component(ke,Ce,null),append(Ce,$n),insert$1(io,Hn,uo);for(let ho=0;ho<to.length;ho+=1)to[ho]&&to[ho].m(io,uo);insert$1(io,zn,uo),Un=!0,qn||(Xn=listen(Ce,"click",_n[23]),qn=!0)},p(io,uo){if(uo[0]&2560){Kn=ensure_array_like(io[9]);let ho;for(ho=0;ho<Kn.length;ho+=1){const bo=get_each_context_2$2(io,Kn,ho);to[ho]?to[ho].p(bo,uo):(to[ho]=create_each_block_2$2(bo),to[ho].c(),to[ho].m(zn.parentNode,zn))}for(;ho<to.length;ho+=1)to[ho].d(1);to.length=Kn.length}},i(io){Un||(transition_in(ke.$$.fragment,io),Un=!0)},o(io){transition_out(ke.$$.fragment,io),Un=!1},d(io){io&&(detach(Ce),detach(Hn),detach(zn)),destroy_component(ke),destroy_each(to,io),qn=!1,Xn()}}}function create_each_block_2$2(_n){let Ce,ke,$n;function Hn(...zn){return _n[24](_n[39],...zn)}return{c(){Ce=element("button"),Ce.textContent=`${_n[39].label} `,attr(Ce,"class","dropdown-item button")},m(zn,Un){insert$1(zn,Ce,Un),ke||($n=listen(Ce,"click",Hn),ke=!0)},p(zn,Un){_n=zn},d(zn){zn&&detach(Ce),ke=!1,$n()}}}function create_if_block_3$8(_n){let Ce,ke,$n,Hn,zn,Un,qn=_n[3].label+"",Xn,Kn,to,io,uo,ho;ke=new Icon({props:{icon:"arrow-left"}});let bo=ensure_array_like(_n[7]),Oo=[];for(let So=0;So<bo.length;So+=1)Oo[So]=create_each_block_1$7(get_each_context_1$7(_n,bo,So));return{c(){Ce=element("button"),create_component(ke.$$.fragment),$n=text(`
|
||||
Back`),Hn=space$3(),zn=element("div"),Un=text("field: "),Xn=text(qn),Kn=space$3();for(let So=0;So<Oo.length;So+=1)Oo[So].c();to=empty$1(),attr(Ce,"class","dropdown-item button"),attr(zn,"class","selected-filter")},m(So,$o){insert$1(So,Ce,$o),mount_component(ke,Ce,null),append(Ce,$n),insert$1(So,Hn,$o),insert$1(So,zn,$o),append(zn,Un),append(zn,Xn),insert$1(So,Kn,$o);for(let Do=0;Do<Oo.length;Do+=1)Oo[Do]&&Oo[Do].m(So,$o);insert$1(So,to,$o),io=!0,uo||(ho=listen(Ce,"click",_n[25]),uo=!0)},p(So,$o){if((!io||$o[0]&8)&&qn!==(qn=So[3].label+"")&&set_data(Xn,qn),$o[0]&8320){bo=ensure_array_like(So[7]);let Do;for(Do=0;Do<bo.length;Do+=1){const xo=get_each_context_1$7(So,bo,Do);Oo[Do]?Oo[Do].p(xo,$o):(Oo[Do]=create_each_block_1$7(xo),Oo[Do].c(),Oo[Do].m(to.parentNode,to))}for(;Do<Oo.length;Do+=1)Oo[Do].d(1);Oo.length=bo.length}},i(So){io||(transition_in(ke.$$.fragment,So),io=!0)},o(So){transition_out(ke.$$.fragment,So),io=!1},d(So){So&&(detach(Ce),detach(Hn),detach(zn),detach(Kn),detach(to)),destroy_component(ke),destroy_each(Oo,So),uo=!1,ho()}}}function create_each_block_1$7(_n){let Ce,ke=_n[42].label+"",$n,Hn,zn,Un;function qn(...Xn){return _n[26](_n[42],...Xn)}return{c(){Ce=element("button"),$n=text(ke),Hn=space$3(),attr(Ce,"class","dropdown-item button")},m(Xn,Kn){insert$1(Xn,Ce,Kn),append(Ce,$n),append(Ce,Hn),zn||(Un=listen(Ce,"click",qn),zn=!0)},p(Xn,Kn){_n=Xn,Kn[0]&128&&ke!==(ke=_n[42].label+"")&&set_data($n,ke)},d(Xn){Xn&&detach(Ce),zn=!1,Un()}}}function create_if_block_2$a(_n){let Ce,ke,$n,Hn,zn,Un,qn=_n[3].label+"",Xn,Kn,to=_n[5].label+"",io,uo,ho,bo,Oo,So,$o,Do,xo;return ke=new Icon({props:{icon:"arrow-left"}}),{c(){Ce=element("button"),create_component(ke.$$.fragment),$n=text(`
|
||||
Back`),Hn=space$3(),zn=element("div"),Un=text("field: "),Xn=text(qn),Kn=text(" operator: "),io=text(to),uo=space$3(),ho=element("div"),bo=element("input"),Oo=space$3(),So=element("button"),So.textContent="Add filter",attr(Ce,"class","dropdown-item button"),attr(zn,"class","selected-filter"),attr(bo,"type","text"),attr(bo,"class","form-control"),attr(ho,"class","filter-input"),attr(So,"class","button applied-filter"),attr(So,"type","button")},m(Io,Vo){insert$1(Io,Ce,Vo),mount_component(ke,Ce,null),append(Ce,$n),insert$1(Io,Hn,Vo),insert$1(Io,zn,Vo),append(zn,Un),append(zn,Xn),append(zn,Kn),append(zn,io),insert$1(Io,uo,Vo),insert$1(Io,ho,Vo),append(ho,bo),set_input_value(bo,_n[2]),insert$1(Io,Oo,Vo),insert$1(Io,So,Vo),$o=!0,Do||(xo=[listen(Ce,"click",_n[27]),listen(bo,"input",_n[28]),listen(So,"click",_n[14])],Do=!0)},p(Io,Vo){(!$o||Vo[0]&8)&&qn!==(qn=Io[3].label+"")&&set_data(Xn,qn),(!$o||Vo[0]&32)&&to!==(to=Io[5].label+"")&&set_data(io,to),Vo[0]&4&&bo.value!==Io[2]&&set_input_value(bo,Io[2])},i(Io){$o||(transition_in(ke.$$.fragment,Io),$o=!0)},o(Io){transition_out(ke.$$.fragment,Io),$o=!1},d(Io){Io&&(detach(Ce),detach(Hn),detach(zn),detach(uo),detach(ho),detach(Oo),detach(So)),destroy_component(ke),Do=!1,run_all(xo)}}}function create_if_block_1$n(_n){let Ce,ke,$n,Hn,zn,Un,qn,Xn;ke=new Icon({props:{icon:"arrow-left"}});let Kn=ensure_array_like(_n[10]),to=[];for(let io=0;io<Kn.length;io+=1)to[io]=create_each_block$k(get_each_context$k(_n,Kn,io));return{c(){Ce=element("button"),create_component(ke.$$.fragment),$n=text(`
|
||||
Back`),Hn=space$3();for(let io=0;io<to.length;io+=1)to[io].c();zn=empty$1(),attr(Ce,"class","dropdown-item button")},m(io,uo){insert$1(io,Ce,uo),mount_component(ke,Ce,null),append(Ce,$n),insert$1(io,Hn,uo);for(let ho=0;ho<to.length;ho+=1)to[ho]&&to[ho].m(io,uo);insert$1(io,zn,uo),Un=!0,qn||(Xn=listen(Ce,"click",_n[29]),qn=!0)},p(io,uo){if(uo[0]&5120){Kn=ensure_array_like(io[10]);let ho;for(ho=0;ho<Kn.length;ho+=1){const bo=get_each_context$k(io,Kn,ho);to[ho]?to[ho].p(bo,uo):(to[ho]=create_each_block$k(bo),to[ho].c(),to[ho].m(zn.parentNode,zn))}for(;ho<to.length;ho+=1)to[ho].d(1);to.length=Kn.length}},i(io){Un||(transition_in(ke.$$.fragment,io),Un=!0)},o(io){transition_out(ke.$$.fragment,io),Un=!1},d(io){io&&(detach(Ce),detach(Hn),detach(zn)),destroy_component(ke),destroy_each(to,io),qn=!1,Xn()}}}function create_each_block$k(_n){let Ce,ke,$n;function Hn(...zn){return _n[30](_n[39],...zn)}return{c(){Ce=element("button"),Ce.textContent=`${_n[39].label} `,attr(Ce,"class","dropdown-item button")},m(zn,Un){insert$1(zn,Ce,Un),ke||($n=listen(Ce,"click",Hn),ke=!0)},p(zn,Un){_n=zn},d(zn){zn&&detach(Ce),ke=!1,$n()}}}function create_if_block$G(_n){let Ce,ke,$n,Hn,zn,Un,qn=_n[4].label+"",Xn,Kn,to,io,uo,ho,bo,Oo;ke=new Icon({props:{icon:"arrow-left"}});function So(Do){_n[32](Do)}let $o={field:_n[4]};return _n[2]!==void 0&&($o.value=_n[2]),io=new FilterReferenceInput({props:$o}),binding_callbacks.push(()=>bind(io,"value",So)),io.$on("addFilter",_n[14]),{c(){Ce=element("button"),create_component(ke.$$.fragment),$n=text(`
|
||||
Back`),Hn=space$3(),zn=element("div"),Un=text("field: "),Xn=text(qn),Kn=space$3(),to=element("div"),create_component(io.$$.fragment),attr(Ce,"class","dropdown-item button"),attr(zn,"class","selected-filter"),attr(to,"class","mt-2")},m(Do,xo){insert$1(Do,Ce,xo),mount_component(ke,Ce,null),append(Ce,$n),insert$1(Do,Hn,xo),insert$1(Do,zn,xo),append(zn,Un),append(zn,Xn),insert$1(Do,Kn,xo),insert$1(Do,to,xo),mount_component(io,to,null),ho=!0,bo||(Oo=listen(Ce,"click",_n[31]),bo=!0)},p(Do,xo){(!ho||xo[0]&16)&&qn!==(qn=Do[4].label+"")&&set_data(Xn,qn);const Io={};xo[0]&16&&(Io.field=Do[4]),!uo&&xo[0]&4&&(uo=!0,Io.value=Do[2],add_flush_callback(()=>uo=!1)),io.$set(Io)},i(Do){ho||(transition_in(ke.$$.fragment,Do),transition_in(io.$$.fragment,Do),ho=!0)},o(Do){transition_out(ke.$$.fragment,Do),transition_out(io.$$.fragment,Do),ho=!1},d(Do){Do&&(detach(Ce),detach(Hn),detach(zn),detach(Kn),detach(to)),destroy_component(ke),destroy_component(io),bo=!1,Oo()}}}function create_default_slot$8(_n){let Ce,ke,$n,Hn,zn,Un,qn,Xn,Kn,to,io,uo,ho,bo,Oo,So,$o,Do,xo,Io,Vo,Jo,Mo,Go,os,ms,is=!_n[3]&&create_if_block_4$6(_n),Yo=_n[3]&&!_n[5]&&create_if_block_3$8(_n),Ys=_n[3]&&_n[5]&&create_if_block_2$a(_n),sr=!_n[4]&&create_if_block_1$n(_n),Js=_n[4]&&create_if_block$G(_n);return $o=new Icon({props:{icon:"arrow-left"}}),{c(){Ce=element("div"),ke=element("button"),ke.textContent="Filter by field",$n=space$3(),Hn=element("button"),Hn.textContent="Filter by Reference",zn=space$3(),Un=element("button"),Un.textContent="Advanced filter",qn=space$3(),Xn=element("div"),is&&is.c(),Kn=space$3(),Yo&&Yo.c(),to=space$3(),Ys&&Ys.c(),io=space$3(),uo=element("div"),sr&&sr.c(),ho=space$3(),Js&&Js.c(),bo=space$3(),Oo=element("div"),So=element("button"),create_component($o.$$.fragment),Do=text(`
|
||||
Back`),xo=space$3(),Io=element("form"),Vo=element("input"),Jo=space$3(),Mo=element("button"),Mo.textContent="Submit",attr(ke,"class","dropdown-item button"),attr(Hn,"class","dropdown-item button"),attr(Un,"class","dropdown-item button"),toggle_class(Ce,"hide",_n[6]!=="main"),toggle_class(Xn,"hide",_n[6]!=="byField"),toggle_class(uo,"hide",_n[6]!=="byReference"),attr(So,"class","dropdown-item button"),attr(Vo,"type","search"),attr(Vo,"class","mb-2 mt-2"),attr(Vo,"placeholder","Advanced filters"),Vo.required=!0,attr(Mo,"class","button applied-filter"),toggle_class(Oo,"hide",_n[6]!=="advanced")},m(ko,gs){insert$1(ko,Ce,gs),append(Ce,ke),append(Ce,$n),append(Ce,Hn),append(Ce,zn),append(Ce,Un),insert$1(ko,qn,gs),insert$1(ko,Xn,gs),is&&is.m(Xn,null),append(Xn,Kn),Yo&&Yo.m(Xn,null),append(Xn,to),Ys&&Ys.m(Xn,null),insert$1(ko,io,gs),insert$1(ko,uo,gs),sr&&sr.m(uo,null),append(uo,ho),Js&&Js.m(uo,null),insert$1(ko,bo,gs),insert$1(ko,Oo,gs),append(Oo,So),mount_component($o,So,null),append(So,Do),append(Oo,xo),append(Oo,Io),append(Io,Vo),set_input_value(Vo,_n[1]),append(Io,Jo),append(Io,Mo),Go=!0,os||(ms=[listen(ke,"click",_n[20]),listen(Hn,"click",_n[21]),listen(Un,"click",_n[22]),listen(So,"click",_n[33]),listen(Vo,"input",_n[34]),listen(Io,"submit",_n[8])],os=!0)},p(ko,gs){(!Go||gs[0]&64)&&toggle_class(Ce,"hide",ko[6]!=="main"),ko[3]?is&&(group_outros(),transition_out(is,1,1,()=>{is=null}),check_outros()):is?(is.p(ko,gs),gs[0]&8&&transition_in(is,1)):(is=create_if_block_4$6(ko),is.c(),transition_in(is,1),is.m(Xn,Kn)),ko[3]&&!ko[5]?Yo?(Yo.p(ko,gs),gs[0]&40&&transition_in(Yo,1)):(Yo=create_if_block_3$8(ko),Yo.c(),transition_in(Yo,1),Yo.m(Xn,to)):Yo&&(group_outros(),transition_out(Yo,1,1,()=>{Yo=null}),check_outros()),ko[3]&&ko[5]?Ys?(Ys.p(ko,gs),gs[0]&40&&transition_in(Ys,1)):(Ys=create_if_block_2$a(ko),Ys.c(),transition_in(Ys,1),Ys.m(Xn,null)):Ys&&(group_outros(),transition_out(Ys,1,1,()=>{Ys=null}),check_outros()),(!Go||gs[0]&64)&&toggle_class(Xn,"hide",ko[6]!=="byField"),ko[4]?sr&&(group_outros(),transition_out(sr,1,1,()=>{sr=null}),check_outros()):sr?(sr.p(ko,gs),gs[0]&16&&transition_in(sr,1)):(sr=create_if_block_1$n(ko),sr.c(),transition_in(sr,1),sr.m(uo,ho)),ko[4]?Js?(Js.p(ko,gs),gs[0]&16&&transition_in(Js,1)):(Js=create_if_block$G(ko),Js.c(),transition_in(Js,1),Js.m(uo,null)):Js&&(group_outros(),transition_out(Js,1,1,()=>{Js=null}),check_outros()),(!Go||gs[0]&64)&&toggle_class(uo,"hide",ko[6]!=="byReference"),gs[0]&2&&Vo.value!==ko[1]&&set_input_value(Vo,ko[1]),(!Go||gs[0]&64)&&toggle_class(Oo,"hide",ko[6]!=="advanced")},i(ko){Go||(transition_in(is),transition_in(Yo),transition_in(Ys),transition_in(sr),transition_in(Js),transition_in($o.$$.fragment,ko),Go=!0)},o(ko){transition_out(is),transition_out(Yo),transition_out(Ys),transition_out(sr),transition_out(Js),transition_out($o.$$.fragment,ko),Go=!1},d(ko){ko&&(detach(Ce),detach(qn),detach(Xn),detach(io),detach(uo),detach(bo),detach(Oo)),is&&is.d(),Yo&&Yo.d(),Ys&&Ys.d(),sr&&sr.d(),Js&&Js.d(),destroy_component($o),os=!1,run_all(ms)}}}function create_button_slot$7(_n){let Ce,ke,$n,Hn,zn;return ke=new Icon({props:{icon:"filter"}}),{c(){Ce=element("div"),create_component(ke.$$.fragment),$n=space$3(),Hn=element("span"),Hn.textContent="Filter",attr(Hn,"class","ms-1"),attr(Ce,"slot","button")},m(Un,qn){insert$1(Un,Ce,qn),mount_component(ke,Ce,null),append(Ce,$n),append(Ce,Hn),zn=!0},p:noop,i(Un){zn||(transition_in(ke.$$.fragment,Un),zn=!0)},o(Un){transition_out(ke.$$.fragment,Un),zn=!1},d(Un){Un&&detach(Ce),destroy_component(ke)}}}function create_fragment$10(_n){let Ce,ke,$n,Hn={$$slots:{button:[create_button_slot$7],default:[create_default_slot$8]},$$scope:{ctx:_n}};return ke=new Dropdown({props:Hn}),_n[35](ke),{c(){Ce=element("div"),create_component(ke.$$.fragment)},m(zn,Un){insert$1(zn,Ce,Un),mount_component(ke,Ce,null),$n=!0},p(zn,Un){const qn={};Un[0]&254|Un[1]&65536&&(qn.$$scope={dirty:Un,ctx:zn}),ke.$set(qn)},i(zn){$n||(transition_in(ke.$$.fragment,zn),$n=!0)},o(zn){transition_out(ke.$$.fragment,zn),$n=!1},d(zn){zn&&detach(Ce),_n[35](null),destroy_component(ke)}}}function instance$10(_n,Ce,ke){const $n=createEventDispatcher();let{schema:Hn}=Ce,{systemFields:zn=[]}=Ce,{operators:Un}=Ce,{inModal:qn}=Ce,{modalUrl:Xn}=Ce,Kn,to="",io=zn;Hn.type==="collection"&&(io=zn.filter(hs=>hs.files===!1));function uo(hs){hs.preventDefault();let Qs=to.split("=")[0]??"";if(!Qs)return;let zo=`filter[${Qs}]`,el=to.split("=")[1]??"";if(!el)return;const ga=new URL(Xn??window.location.href);ga.searchParams.set("skip","0"),ga.searchParams.set(zo,el),qn?$n("refresh",ga):window.location.replace(ga),os()}let ho=null,bo=null,Oo=null,So=null,$o="main",Do=null,xo=[...Hn.fields,...io].filter(hs=>{var Qs;return!["file","json","reference"].includes(((Qs=hs.info)==null?void 0:Qs.name)??hs.ui)}),Io=[...Hn.fields].filter(hs=>{var Qs;return["reference"].includes(((Qs=hs.info)==null?void 0:Qs.name)??hs.ui)});function Vo(hs,Qs){ke(3,bo=Qs),ke(7,Do=Un.filter(zo=>{var el;return zo.uis.i
Line truncated
|
||||
Upload file
|
||||
|
||||
`),zn=element("input"),attr($n,"class","spinner-border spinner-border-sm"),attr($n,"role","status"),attr($n,"aria-hidden","true"),attr(zn,"class","form-control"),attr(zn,"type","file"),attr(zn,"id","formFile"),zn.multiple=!0,attr(zn,"accept",mimeTypes),zn.disabled=_n[0],zn.hidden=!0,attr(ke,"class","button primary btn-spinner "),attr(Ce,"class","upload-button"),Ce.disabled=_n[0]},m(Xn,Kn){insert$1(Xn,Ce,Kn),append(Ce,ke),append(ke,$n),append(ke,Hn),append(ke,zn),Un||(qn=listen(zn,"input",_n[1]),Un=!0)},p(Xn,[Kn]){Kn&1&&(zn.disabled=Xn[0]),Kn&1&&(Ce.disabled=Xn[0])},i:noop,o:noop,d(Xn){Xn&&detach(Ce),Un=!1,qn()}}}let mimeTypes="";function instance$$(_n,Ce,ke){const $n=createEventDispatcher(),Hn=getContext$1("channel");let{schema:zn}=Ce,Un=[],qn=!1;function Xn(Kn){ke(0,qn=!0),Un=Kn.target.files?[...Kn.target.files]:[];let to=new FormData;to.append("schema",zn.name),Array.from(Un).forEach(function(io){to.append("files[]",io)}),$n("beforeUpload",Un),axios.post(Hn.lucentUrl+"/files/upload",to,{headers:{"Content-Type":"multipart/form-data"}}).then(io=>{io.data.error?$n("uploadError",io.data.error):$n("uploadComplete",io.data),ke(0,qn=!1)}).catch(io=>{ke(0,qn=!1),console.log(io.response.data)})}return _n.$$set=Kn=>{"schema"in Kn&&ke(2,zn=Kn.schema)},[qn,Xn,zn]}class Uploader extends SvelteComponent{constructor(Ce){super(),init(this,Ce,instance$$,create_fragment$$,safe_not_equal,{schema:2})}}function get_each_context$j(_n,Ce,ke){const $n=_n.slice();return $n[18]=Ce[ke],$n}function get_each_context_1$6(_n,Ce,ke){const $n=_n.slice();return $n[18]=Ce[ke],$n}function create_each_block_1$6(_n){let Ce,ke,$n,Hn,zn,Un,qn,Xn,Kn,to,io=_n[18].label+"",uo,ho,bo,Oo;$n=new Icon({props:{icon:"arrow-up-short-wide"}});function So(...xo){return _n[10](_n[18],...xo)}qn=new Icon({props:{icon:"arrow-down-wide-short"}});function $o(...xo){return _n[11](_n[18],...xo)}function Do(...xo){return _n[12](_n[18],...xo)}return{c(){Ce=element("div"),ke=element("button"),create_component($n.$$.fragment),zn=space$3(),Un=element("button"),create_component(qn.$$.fragment),Kn=space$3(),to=element("button"),uo=text(io),attr(ke,"title","Sort Ascending"),attr(ke,"class",Hn="button button-icon "+(_n[18].name==_n[1].name&&!_n[0].startsWith("-")?"active":"")),attr(Un,"title","Sort Descending"),attr(Un,"class",Xn="button button-icon "+(_n[18].name==_n[1].name&&_n[0].startsWith("-")?"active":"")),attr(to,"title","Sort Ascending"),attr(to,"class","button"),attr(Ce,"class","dropdown-item")},m(xo,Io){insert$1(xo,Ce,Io),append(Ce,ke),mount_component($n,ke,null),append(Ce,zn),append(Ce,Un),mount_component(qn,Un,null),append(Ce,Kn),append(Ce,to),append(to,uo),ho=!0,bo||(Oo=[listen(ke,"click",So),listen(Un,"click",$o),listen(to,"click",Do)],bo=!0)},p(xo,Io){_n=xo,(!ho||Io&11&&Hn!==(Hn="button button-icon "+(_n[18].name==_n[1].name&&!_n[0].startsWith("-")?"active":"")))&&attr(ke,"class",Hn),(!ho||Io&11&&Xn!==(Xn="button button-icon "+(_n[18].name==_n[1].name&&_n[0].startsWith("-")?"active":"")))&&attr(Un,"class",Xn),(!ho||Io&8)&&io!==(io=_n[18].label+"")&&set_data(uo,io)},i(xo){ho||(transition_in($n.$$.fragment,xo),transition_in(qn.$$.fragment,xo),ho=!0)},o(xo){transition_out($n.$$.fragment,xo),transition_out(qn.$$.fragment,xo),ho=!1},d(xo){xo&&detach(Ce),destroy_component($n),destroy_component(qn),bo=!1,run_all(Oo)}}}function create_each_block$j(_n){let Ce,ke,$n,Hn,zn,Un,qn,Xn,Kn,to,io=_n[18].label+"",uo,ho,bo,Oo,So;$n=new Icon({props:{icon:"arrow-up-short-wide"}});function $o(...Io){return _n[13](_n[18],...Io)}qn=new Icon({props:{icon:"arrow-down-wide-short"}});function Do(...Io){return _n[14](_n[18],...Io)}function xo(...Io){return _n[15](_n[18],...Io)}return{c(){Ce=element("div"),ke=element("button"),create_component($n.$$.fragment),zn=space$3(),Un=element("button"),create_component(qn.$$.fragment),Kn=space$3(),to=element("button"),uo=text(io),ho=space$3(),attr(ke,"title","Sort Ascending"),attr(ke,"class",Hn="button button-icon "+(_n[18].name==_n[0]?"active":"")),attr(Un,"title","Sort Descending"),attr(Un,"class",Xn="button button-icon "+("-"+_n[18].name==_n[0]?"active":"")),attr(to,"title","Sort Ascending"),attr(to,"class","button"),attr(Ce,"class","dropdown-item")},m(Io,Vo){insert$1(Io,Ce,Vo),append(Ce,ke),mount_component($n,ke,null),append(Ce,zn),append(Ce,Un),mount_component(qn,Un,null),append(Ce,Kn),append(Ce,to),append(to,uo),append(Ce,ho),bo=!0,Oo||(So=[listen(ke,"click",$o),listen(Un,"click",Do),listen(to,"click",xo)],Oo=!0)},p(Io,Vo){_n=Io,(!bo||Vo&5&&Hn!==(Hn="button button-icon "+(_n[18].name==_n[0]?"active":"")))&&attr(ke,"class",Hn),(!bo||Vo&5&&Xn!==(Xn="button button-icon "+("-"+_n[18].name==_n[0]?"active":"")))&&attr(Un,"class",Xn),(!bo||Vo&4)&&io!==(io=_n[18].label+"")&&set_data(uo,io)},i(Io){bo||(transition_in($n.$$.fragment,Io),transition_in(qn.$$.fragment,Io),bo=!0)},o(Io){transition_out($n.$$.fragment,Io),transition_out(qn.$$.fragment,Io),bo=!1},d(Io){Io&&detach(Ce),destroy_component($n),destroy_component(qn),Oo=!1,run_all(So)}}}func
Line truncated
|
||||
|
||||
`),$n=element("button"),create_component(Hn.$$.fragment),attr($n,"type","button"),attr($n,"class","button-text"),attr($n,"aria-label","Close"),attr(Ce,"class","applied-filter")},m(Xn,Kn){insert$1(Xn,Ce,Kn),append(Ce,ke),append(Ce,$n),mount_component(Hn,$n,null),zn=!0,Un||(qn=listen($n,"click",prevent_default(_n[4])),Un=!0)},p:noop,i(Xn){zn||(transition_in(Hn.$$.fragment,Xn),zn=!0)},o(Xn){transition_out(Hn.$$.fragment,Xn),zn=!1},d(Xn){Xn&&detach(Ce),destroy_component(Hn),Un=!1,qn()}}}function create_fragment$Y(_n){let Ce=_n[0].searchParams.get("notlinked"),ke,$n,Hn=Ce&&create_if_block$D(_n);return{c(){Hn&&Hn.c(),ke=empty$1()},m(zn,Un){Hn&&Hn.m(zn,Un),insert$1(zn,ke,Un),$n=!0},p(zn,[Un]){Ce&&Hn.p(zn,Un)},i(zn){$n||(transition_in(Hn),$n=!0)},o(zn){transition_out(Hn),$n=!1},d(zn){zn&&detach(ke),Hn&&Hn.d(zn)}}}function instance$Y(_n,Ce,ke){getContext$1("channel");const $n=createEventDispatcher();let{inModal:Hn}=Ce,{modalUrl:zn}=Ce;const Un=new URL(zn??window.location.href);function qn(Kn){const to=new URL(zn??window.location.href);to.searchParams.set("skip","0"),to.searchParams.delete("notlinked"),Hn?$n("refresh",to):window.location.replace(to)}const Xn=()=>qn();return _n.$$set=Kn=>{"inModal"in Kn&&ke(2,Hn=Kn.inModal),"modalUrl"in Kn&&ke(3,zn=Kn.modalUrl)},[Un,qn,Hn,zn,Xn]}class AppliedFilterNotLinked extends SvelteComponent{constructor(Ce){super(),init(this,Ce,instance$Y,create_fragment$Y,safe_not_equal,{inModal:2,modalUrl:3})}}function get_each_context$i(_n,Ce,ke){const $n=_n.slice();return $n[22]=Ce[ke][0],$n[23]=Ce[ke][1],$n}function create_else_block_1$2(_n){let Ce,ke,$n;return ke=new Uploader({props:{schema:_n[0]}}),ke.$on("uploadComplete",_n[13]),{c(){Ce=element("div"),create_component(ke.$$.fragment)},m(Hn,zn){insert$1(Hn,Ce,zn),mount_component(ke,Ce,null),$n=!0},p(Hn,zn){const Un={};zn&1&&(Un.schema=Hn[0]),ke.$set(Un)},i(Hn){$n||(transition_in(ke.$$.fragment,Hn),$n=!0)},o(Hn){transition_out(ke.$$.fragment,Hn),$n=!1},d(Hn){Hn&&detach(Ce),destroy_component(ke)}}}function create_if_block_4$5(_n){let Ce,ke=!_n[5]&&_n[7]&&create_if_block_5$3(_n);return{c(){ke&&ke.c(),Ce=empty$1()},m($n,Hn){ke&&ke.m($n,Hn),insert$1($n,Ce,Hn)},p($n,Hn){!$n[5]&&$n[7]?ke?ke.p($n,Hn):(ke=create_if_block_5$3($n),ke.c(),ke.m(Ce.parentNode,Ce)):ke&&(ke.d(1),ke=null)},i:noop,o:noop,d($n){$n&&detach(Ce),ke&&ke.d($n)}}}function create_if_block_5$3(_n){let Ce,ke,$n;return{c(){Ce=element("a"),ke=text("New Record"),attr(Ce,"href",$n=_n[10].lucentUrl+"/records/new?schema="+_n[0].name),attr(Ce,"class","button")},m(Hn,zn){insert$1(Hn,Ce,zn),append(Ce,ke)},p(Hn,zn){zn&1&&$n!==($n=Hn[10].lucentUrl+"/records/new?schema="+Hn[0].name)&&attr(Ce,"href",$n)},d(Hn){Hn&&detach(Ce)}}}function create_if_block_1$m(_n){let Ce,ke;return Ce=new Dropdown({props:{orientation:"right",$$slots:{button:[create_button_slot$5],default:[create_default_slot$6]},$$scope:{ctx:_n}}}),{c(){create_component(Ce.$$.fragment)},m($n,Hn){mount_component(Ce,$n,Hn),ke=!0},p($n,Hn){const zn={};Hn&67109009&&(zn.$$scope={dirty:Hn,ctx:$n}),Ce.$set(zn)},i($n){ke||(transition_in(Ce.$$.fragment,$n),ke=!0)},o($n){transition_out(Ce.$$.fragment,$n),ke=!1},d($n){destroy_component(Ce,$n)}}}function create_else_block$f(_n){let Ce,ke,$n,Hn,zn,Un,qn,Xn,Kn,to;return{c(){Ce=element("a"),ke=text("Export to CSV"),$n=space$3(),Hn=element("a"),zn=text("View trashed records"),qn=space$3(),Xn=element("a"),Kn=text("View unlinked records"),attr(Ce,"class","dropdown-item"),attr(Ce,"href",_n[11]),attr(Hn,"class","dropdown-item"),attr(Hn,"href",Un=_n[10].lucentUrl+"/content/"+_n[0].name+"?filter[status_in]=trashed"),attr(Xn,"class","dropdown-item"),attr(Xn,"href",to=_n[10].lucentUrl+"/content/"+_n[0].name+"?notlinked=*")},m(io,uo){insert$1(io,Ce,uo),append(Ce,ke),insert$1(io,$n,uo),insert$1(io,Hn,uo),append(Hn,zn),insert$1(io,qn,uo),insert$1(io,Xn,uo),append(Xn,Kn)},p(io,uo){uo&1&&Un!==(Un=io[10].lucentUrl+"/content/"+io[0].name+"?filter[status_in]=trashed")&&attr(Hn,"href",Un),uo&1&&to!==(to=io[10].lucentUrl+"/content/"+io[0].name+"?notlinked=*")&&attr(Xn,"href",to)},d(io){io&&(detach(Ce),detach($n),detach(Hn),detach(qn),detach(Xn))}}}function create_if_block_2$9(_n){let Ce,ke=_n[7]&&create_if_block_3$7(_n);return{c(){ke&&ke.c(),Ce=empty$1()},m($n,Hn){ke&&ke.m($n,Hn),insert$1($n,Ce,Hn)},p($n,Hn){$n[7]?ke?ke.p($n,Hn):(ke=create_if_block_3$7($n),ke.c(),ke.m(Ce.parentNode,Ce)):ke&&(ke.d(1),ke=null)},d($n){$n&&detach(Ce),ke&&ke.d($n)}}}function create_if_block_3$7(_n){let Ce,ke,$n;return{c(){Ce=element("a"),ke=text("Empty trash"),attr(Ce,"class","dropdown-item"),attr(Ce,"href",$n=_n[10].lucentUrl+"/content/"+_n[0].name+"/emptyTrash")},m(Hn,zn){insert$1(Hn,Ce,zn),append(Ce,ke)},p(Hn,zn){zn&1&&$n!==($n=Hn[10].lucentUrl+"/content/"+Hn[0].name+"/emptyTrash")&&attr(Ce,"href",$n)},d(Hn){Hn&&detach(Ce)}}}function create_default_slot$6(_n){let Ce;function ke(zn,Un){return zn[4].status_in==="trashed"?create_if_block_2$9:create_else_block$f}let $n=ke(_n),Hn=$n(_n);return{c(){Hn.c(),Ce=empty$1()},m(zn,Un){Hn.m(
Line truncated
|
||||
`),Un=element("span"),Xn=text(qn),Kn=text(`
|
||||
to
|
||||
`),to=element("span"),uo=text(io),ho=text(`
|
||||
of
|
||||
`),bo=element("span"),Oo=text(_n[4]),So=text(`
|
||||
total`),attr(ke,"class","pagination"),attr(Un,"class","font-medium"),attr(to,"class","font-medium"),attr(bo,"class","font-medium"),set_style(Hn,"display","flex"),set_style(Hn,"justify-content","center"),set_style(Hn,"gap","4px")},m(xo,Io){insert$1(xo,Ce,Io),append(Ce,ke),Do&&Do.m(ke,null),insert$1(xo,$n,Io),insert$1(xo,Hn,Io),append(Hn,zn),append(Hn,Un),append(Un,Xn),append(Hn,Kn),append(Hn,to),append(to,uo),append(Hn,ho),append(Hn,bo),append(bo,Oo),append(Hn,So),$o=!0},p(xo,[Io]){xo[5]>1?Do?(Do.p(xo,Io),Io&32&&transition_in(Do,1)):(Do=create_if_block$A(xo),Do.c(),transition_in(Do,1),Do.m(ke,null)):Do&&(group_outros(),transition_out(Do,1,1,()=>{Do=null}),check_outros()),(!$o||Io&8)&&qn!==(qn=+xo[3]+1+"")&&set_data(Xn,qn),(!$o||Io&28)&&io!==(io=(+xo[3]+xo[2]>xo[4]?xo[4]:+xo[3]+xo[2])+"")&&set_data(uo,io),(!$o||Io&16)&&set_data(Oo,xo[4])},i(xo){$o||(transition_in(Do),$o=!0)},o(xo){transition_out(Do),$o=!1},d(xo){xo&&(detach(Ce),detach($n),detach(Hn)),Do&&Do.d()}}}function instance$V(_n,Ce,ke){let $n,Hn,zn;const Un=createEventDispatcher();let{inModal:qn}=Ce,{modalUrl:Xn}=Ce,{limit:Kn}=Ce,{skip:to}=Ce,{total:io}=Ce;function uo(So){So.preventDefault(),bo($n)}function ho(So){So.preventDefault(),bo(1)}function bo(So){const $o=new URL(Xn??window.location.href);let Do=So*Kn-Kn;$o.searchParams.set("skip",Do),qn?Un("refresh",$o):window.location=$o}function Oo(So){bubble.call(this,_n,So)}return _n.$$set=So=>{"inModal"in So&&ke(0,qn=So.inModal),"modalUrl"in So&&ke(1,Xn=So.modalUrl),"limit"in So&&ke(2,Kn=So.limit),"skip"in So&&ke(3,to=So.skip),"total"in So&&ke(4,io=So.total)},_n.$$.update=()=>{_n.$$.dirty&20&&ke(5,$n=Math.ceil(io/Kn)),_n.$$.dirty&12&&ke(6,Hn=Math.ceil((to-1)/Kn)+1),_n.$$.dirty&96&&ke(7,zn=lodashExports.range(Hn-3,Hn+4).filter(So=>So>0&&So<=$n))},[qn,Xn,Kn,to,io,$n,Hn,zn,uo,ho,Oo]}class Pagination extends SvelteComponent{constructor(Ce){super(),init(this,Ce,instance$V,create_fragment$V,safe_not_equal,{inModal:0,modalUrl:1,limit:2,skip:3,total:4})}}function create_else_block$d(_n){let Ce,ke,$n;return{c(){Ce=element("button"),Ce.textContent="Move to trash",attr(Ce,"type","button"),attr(Ce,"class","button")},m(Hn,zn){insert$1(Hn,Ce,zn),ke||($n=listen(Ce,"click",prevent_default(_n[9])),ke=!0)},p:noop,d(Hn){Hn&&detach(Ce),ke=!1,$n()}}}function create_if_block$z(_n){let Ce,ke,$n,Hn,zn,Un,qn=_n[1].hasDrafts&&create_if_block_1$l(_n);return{c(){Ce=element("button"),Ce.textContent="Publish",ke=space$3(),qn&&qn.c(),$n=space$3(),Hn=element("button"),Hn.textContent="Delete forever",attr(Ce,"type","button"),attr(Ce,"class","button"),attr(Hn,"type","button"),attr(Hn,"class","button")},m(Xn,Kn){insert$1(Xn,Ce,Kn),insert$1(Xn,ke,Kn),qn&&qn.m(Xn,Kn),insert$1(Xn,$n,Kn),insert$1(Xn,Hn,Kn),zn||(Un=[listen(Ce,"click",prevent_default(_n[7])),listen(Hn,"click",prevent_default(_n[3]))],zn=!0)},p(Xn,Kn){Xn[1].hasDrafts?qn?qn.p(Xn,Kn):(qn=create_if_block_1$l(Xn),qn.c(),qn.m($n.parentNode,$n)):qn&&(qn.d(1),qn=null)},d(Xn){Xn&&(detach(Ce),detach(ke),detach($n),detach(Hn)),qn&&qn.d(Xn),zn=!1,run_all(Un)}}}function create_if_block_1$l(_n){let Ce,ke,$n;return{c(){Ce=element("button"),Ce.textContent="Make Draft",attr(Ce,"type","button"),attr(Ce,"class","button")},m(Hn,zn){insert$1(Hn,Ce,zn),ke||($n=listen(Ce,"click",prevent_default(_n[8])),ke=!0)},p:noop,d(Hn){Hn&&detach(Ce),ke=!1,$n()}}}function create_fragment$U(_n){let Ce,ke,$n=_n[0].length+"",Hn,zn,Un,qn,Xn,Kn,to,io,uo;function ho(So,$o){return So[2].status_in==="trashed"?create_if_block$z:create_else_block$d}let bo=ho(_n),Oo=bo(_n);return{c(){Ce=element("div"),ke=element("span"),Hn=text($n),zn=text(" records selected"),Un=space$3(),qn=element("button"),qn.textContent="Publish",Xn=space$3(),Kn=element("button"),Kn.textContent="Make Draft",to=space$3(),Oo.c(),attr(ke,"class","me-2"),attr(qn,"type","button"),attr(qn,"class","button"),attr(Kn,"type","button"),attr(Kn,"class","button"),set_style(Ce,"display","flex"),set_style(Ce,"align-items","center"),set_style(Ce,"gap","8px")},m(So,$o){insert$1(So,Ce,$o),append(Ce,ke),append(ke,Hn),append(ke,zn),append(Ce,Un),append(Ce,qn),append(Ce,Xn),append(Ce,Kn),append(Ce,to),Oo.m(Ce,null),io||(uo=[listen(qn,"click",prevent_default(_n[5])),listen(Kn,"click",prevent_default(_n[6]))],io=!0)},p(So,[$o]){$o&1&&$n!==($n=So[0].length+"")&&set_data(Hn,$n),bo===(bo=ho(So))&&Oo?Oo.p(So,$o):(Oo.d(1),Oo=bo(So),Oo&&(Oo.c(),Oo.m(Ce,null)))},i:noop,o:noop,d(So){So&&detach(Ce),Oo.d(),io=!1,run_all(uo)}}}function instance$U(_n,Ce,ke){const $n=getContext$1("channel");let{selected:Hn}=Ce,{schema:zn}=Ce,{filter:Un}=Ce;function qn(bo){bo.preventDefault(),axios.post($n.lucentUrl+"/records/delete",{ids:Hn.map(Oo=>Oo.id)}).then(Oo=>{window.location.reload()}).catch(Oo=>{console.log(Oo)})}function Xn(bo,Oo){axios.post($n.lucentUrl+"/records/status/"+Oo,{schemaName:zn.name,records:Hn}).then(So=>{window.location.reload()}).catch(So=>{console.log(So)})}const Kn=bo=>Xn(bo,"published"),to=bo=>Xn(bo,"draft"),io=bo=>Xn(bo,"published"),uo=bo=>Xn(bo,"draft"),ho=bo=>Xn(bo,"tr
Line truncated
|
||||
* Sortable 1.15.2
|
||||
* @author RubaXa <trash@rubaxa.org>
|
||||
* @author owenm <owen23355@gmail.com>
|
||||
* @license MIT
|
||||
*/function ownKeys(_n,Ce){var ke=Object.keys(_n);if(Object.getOwnPropertySymbols){var $n=Object.getOwnPropertySymbols(_n);Ce&&($n=$n.filter(function(Hn){return Object.getOwnPropertyDescriptor(_n,Hn).enumerable})),ke.push.apply(ke,$n)}return ke}function _objectSpread2(_n){for(var Ce=1;Ce<arguments.length;Ce++){var ke=arguments[Ce]!=null?arguments[Ce]:{};Ce%2?ownKeys(Object(ke),!0).forEach(function($n){_defineProperty(_n,$n,ke[$n])}):Object.getOwnPropertyDescriptors?Object.defineProperties(_n,Object.getOwnPropertyDescriptors(ke)):ownKeys(Object(ke)).forEach(function($n){Object.defineProperty(_n,$n,Object.getOwnPropertyDescriptor(ke,$n))})}return _n}function _typeof(_n){"@babel/helpers - typeof";return typeof Symbol=="function"&&typeof Symbol.iterator=="symbol"?_typeof=function(Ce){return typeof Ce}:_typeof=function(Ce){return Ce&&typeof Symbol=="function"&&Ce.constructor===Symbol&&Ce!==Symbol.prototype?"symbol":typeof Ce},_typeof(_n)}function _defineProperty(_n,Ce,ke){return Ce in _n?Object.defineProperty(_n,Ce,{value:ke,enumerable:!0,configurable:!0,writable:!0}):_n[Ce]=ke,_n}function _extends(){return _extends=Object.assign||function(_n){for(var Ce=1;Ce<arguments.length;Ce++){var ke=arguments[Ce];for(var $n in ke)Object.prototype.hasOwnProperty.call(ke,$n)&&(_n[$n]=ke[$n])}return _n},_extends.apply(this,arguments)}function _objectWithoutPropertiesLoose(_n,Ce){if(_n==null)return{};var ke={},$n=Object.keys(_n),Hn,zn;for(zn=0;zn<$n.length;zn++)Hn=$n[zn],!(Ce.indexOf(Hn)>=0)&&(ke[Hn]=_n[Hn]);return ke}function _objectWithoutProperties(_n,Ce){if(_n==null)return{};var ke=_objectWithoutPropertiesLoose(_n,Ce),$n,Hn;if(Object.getOwnPropertySymbols){var zn=Object.getOwnPropertySymbols(_n);for(Hn=0;Hn<zn.length;Hn++)$n=zn[Hn],!(Ce.indexOf($n)>=0)&&Object.prototype.propertyIsEnumerable.call(_n,$n)&&(ke[$n]=_n[$n])}return ke}var version="1.15.2";function userAgent(_n){if(typeof window<"u"&&window.navigator)return!!navigator.userAgent.match(_n)}var IE11OrLess=userAgent(/(?:Trident.*rv[ :]?11\.|msie|iemobile|Windows Phone)/i),Edge=userAgent(/Edge/i),FireFox=userAgent(/firefox/i),Safari=userAgent(/safari/i)&&!userAgent(/chrome/i)&&!userAgent(/android/i),IOS=userAgent(/iP(ad|od|hone)/i),ChromeForAndroid=userAgent(/chrome/i)&&userAgent(/android/i),captureMode={capture:!1,passive:!1};function on$1(_n,Ce,ke){_n.addEventListener(Ce,ke,!IE11OrLess&&captureMode)}function off(_n,Ce,ke){_n.removeEventListener(Ce,ke,!IE11OrLess&&captureMode)}function matches(_n,Ce){if(Ce){if(Ce[0]===">"&&(Ce=Ce.substring(1)),_n)try{if(_n.matches)return _n.matches(Ce);if(_n.msMatchesSelector)return _n.msMatchesSelector(Ce);if(_n.webkitMatchesSelector)return _n.webkitMatchesSelector(Ce)}catch{return!1}return!1}}function getParentOrHost(_n){return _n.host&&_n!==document&&_n.host.nodeType?_n.host:_n.parentNode}function closest(_n,Ce,ke,$n){if(_n){ke=ke||document;do{if(Ce!=null&&(Ce[0]===">"?_n.parentNode===ke&&matches(_n,Ce):matches(_n,Ce))||$n&&_n===ke)return _n;if(_n===ke)break}while(_n=getParentOrHost(_n))}return null}var R_SPACE=/\s+/g;function toggleClass$1(_n,Ce,ke){if(_n&&Ce)if(_n.classList)_n.classList[ke?"add":"remove"](Ce);else{var $n=(" "+_n.className+" ").replace(R_SPACE," ").replace(" "+Ce+" "," ");_n.className=($n+(ke?" "+Ce:"")).replace(R_SPACE," ")}}function css$1(_n,Ce,ke){var $n=_n&&_n.style;if($n){if(ke===void 0)return document.defaultView&&document.defaultView.getComputedStyle?ke=document.defaultView.getComputedStyle(_n,""):_n.currentStyle&&(ke=_n.currentStyle),Ce===void 0?ke:ke[Ce];!(Ce in $n)&&Ce.indexOf("webkit")===-1&&(Ce="-webkit-"+Ce),$n[Ce]=ke+(typeof ke=="string"?"":"px")}}function matrix(_n,Ce){var ke="";if(typeof _n=="string")ke=_n;else do{var $n=css$1(_n,"transform");$n&&$n!=="none"&&(ke=$n+" "+ke)}while(!Ce&&(_n=_n.parentNode));var Hn=window.DOMMatrix||window.WebKitCSSMatrix||window.CSSMatrix||window.MSCSSMatrix;return Hn&&new Hn(ke)}function find$1(_n,Ce,ke){if(_n){var $n=_n.getElementsByTagName(Ce),Hn=0,zn=$n.length;if(ke)for(;Hn<zn;Hn++)ke($n[Hn],Hn);return $n}return[]}function getWindowScrollingElement(){var _n=document.scrollingElement;return _n||document.documentElement}function getRect(_n,Ce,ke,$n,Hn){if(!(!_n.getBoundingClientRect&&_n!==window)){var zn,Un,qn,Xn,Kn,to,io;if(_n!==window&&_n.parentNode&&_n!==getWindowScrollingElement()?(zn=_n.getBoundingClientRect(),Un=zn.top,qn=zn.left,Xn=zn.bottom,Kn=zn.right,to=zn.height,io=zn.width):(Un=0,qn=0,Xn=window.innerHeight,Kn=window.innerWidth,to=window.innerHeight,io=window.innerWidth),(Ce||ke)&&_n!==window&&(Hn=Hn||_n.parentNode,!IE11OrLess))do if(Hn&&Hn.getBoundingClientRect&&(css$1(Hn,"transform")!=="none"||ke&&css$1(Hn,"position")!=="static")){var uo=Hn.getBoundingClientRect();Un-=uo.top+parseInt(css$1(Hn,"border-top-width")),qn-=uo.left+parseInt(css$1(Hn,"border-left-width")),Xn=Un+zn.height,Kn=qn+zn.width;break}while(Hn=Hn.parentNode);if($n&&_n!==window){var ho=matrix(Hn||_n),bo=ho&&ho.a,Oo=ho&&ho.d;ho&&(Un/=Oo,qn/=bo,io/=bo,to/=Oo,Xn=Un+to,Kn=qn+io)}return{top:Line truncated
|
||||
<span class='flatpickr-weekday'>
|
||||
`+Es.join("</span><span class='flatpickr-weekday'>")+`
|
||||
</span>
|
||||
`}}function cr(){ke.calendarContainer.classList.add("hasWeeks");var vs=createElement("div","flatpickr-weekwrapper");vs.appendChild(createElement("span","flatpickr-weekday",ke.l10n.weekAbbreviation));var Es=createElement("div","flatpickr-weeks");return vs.appendChild(Es),{weekWrapper:vs,weekNumbers:Es}}function ws(vs,Es){Es===void 0&&(Es=!0);var Ks=Es?vs:vs-ke.currentMonth;Ks<0&&ke._hidePrevMonthArrow===!0||Ks>0&&ke._hideNextMonthArrow===!0||(ke.currentMonth+=Ks,(ke.currentMonth<0||ke.currentMonth>11)&&(ke.currentYear+=ke.currentMonth>11?1:-1,ke.currentMonth=(ke.currentMonth+12)%12,Ya("onYearChange"),Ys()),Yo(),Ya("onMonthChange"),Al())}function Fs(vs,Es){if(vs===void 0&&(vs=!0),Es===void 0&&(Es=!0),ke.input.value="",ke.altInput!==void 0&&(ke.altInput.value=""),ke.mobileInput!==void 0&&(ke.mobileInput.value=""),ke.selectedDates=[],ke.latestSelectedDateObj=void 0,Es===!0&&(ke.currentYear=ke._initialDate.getFullYear(),ke.currentMonth=ke._initialDate.getMonth()),ke.config.enableTime===!0){var Ks=getDefaultHours(ke.config),pr=Ks.hours,ia=Ks.minutes,ka=Ks.seconds;ho(pr,ia,ka)}ke.redraw(),vs&&Ya("onChange")}function Br(){ke.isOpen=!1,ke.isMobile||(ke.calendarContainer!==void 0&&ke.calendarContainer.classList.remove("open"),ke._input!==void 0&&ke._input.classList.remove("active")),Ya("onClose")}function _r(){ke.config!==void 0&&Ya("onDestroy");for(var vs=ke._handlers.length;vs--;)ke._handlers[vs].remove();if(ke._handlers=[],ke.mobileInput)ke.mobileInput.parentNode&&ke.mobileInput.parentNode.removeChild(ke.mobileInput),ke.mobileInput=void 0;else if(ke.calendarContainer&&ke.calendarContainer.parentNode)if(ke.config.static&&ke.calendarContainer.parentNode){var Es=ke.calendarContainer.parentNode;if(Es.lastChild&&Es.removeChild(Es.lastChild),Es.parentNode){for(;Es.firstChild;)Es.parentNode.insertBefore(Es.firstChild,Es);Es.parentNode.removeChild(Es)}}else ke.calendarContainer.parentNode.removeChild(ke.calendarContainer);ke.altInput&&(ke.input.type="text",ke.altInput.parentNode&&ke.altInput.parentNode.removeChild(ke.altInput),delete ke.altInput),ke.input&&(ke.input.type=ke.input._type,ke.input.classList.remove("flatpickr-input"),ke.input.removeAttribute("readonly")),["_showTimeInput","latestSelectedDateObj","_hideNextMonthArrow","_hidePrevMonthArrow","__hideNextMonthArrow","__hidePrevMonthArrow","isMobile","isOpen","selectedDateElem","minDateHasTime","maxDateHasTime","days","daysContainer","_input","_positionElement","innerContainer","rContainer","monthNav","todayDateElem","calendarContainer","weekdayContainer","prevMonthNav","nextMonthNav","monthsDropdownContainer","currentMonthElement","currentYearElement","navigationCurrentMonth","selectedDateElem","config"].forEach(function(Ks){try{delete ke[Ks]}catch{}})}function ha(vs){return ke.calendarContainer.contains(vs)}function hs(vs){if(ke.isOpen&&!ke.config.inline){var Es=getEventTarget(vs),Ks=ha(Es),pr=Es===ke.input||Es===ke.altInput||ke.element.contains(Es)||vs.path&&vs.path.indexOf&&(~vs.path.indexOf(ke.input)||~vs.path.indexOf(ke.altInput)),ia=!pr&&!Ks&&!ha(vs.relatedTarget),ka=!ke.config.ignoredFocusElements.some(function(Ma){return Ma.contains(Es)});ia&&ka&&(ke.config.allowInput&&ke.setDate(ke._input.value,!1,ke.config.altInput?ke.config.altFormat:ke.config.dateFormat),ke.timeContainer!==void 0&&ke.minuteElement!==void 0&&ke.hourElement!==void 0&&ke.input.value!==""&&ke.input.value!==void 0&&Xn(),ke.close(),ke.config&&ke.config.mode==="range"&&ke.selectedDates.length===1&&ke.clear(!1))}}function Qs(vs){if(!(!vs||ke.config.minDate&&vs<ke.config.minDate.getFullYear()||ke.config.maxDate&&vs>ke.config.maxDate.getFullYear())){var Es=vs,Ks=ke.currentYear!==Es;ke.currentYear=Es||ke.currentYear,ke.config.maxDate&&ke.currentYear===ke.config.maxDate.getFullYear()?ke.currentMonth=Math.min(ke.config.maxDate.getMonth(),ke.currentMonth):ke.config.minDate&&ke.currentYear===ke.config.minDate.getFullYear()&&(ke.currentMonth=Math.max(ke.config.minDate.getMonth(),ke.currentMonth)),Ks&&(ke.redraw(),Ya("onYearChange"),Ys())}}function zo(vs,Es){var Ks;Es===void 0&&(Es=!0);var pr=ke.parseDate(vs,void 0,Es);if(ke.config.minDate&&pr&&compareDates(pr,ke.config.minDate,Es!==void 0?Es:!ke.minDateHasTime)<0||ke.config.maxDate&&pr&&compareDates(pr,ke.config.maxDate,Es!==void 0?Es:!ke.maxDateHasTime)>0)return!1;if(!ke.config.enable&&ke.config.disable.length===0)return!0;if(pr===void 0)return!1;for(var ia=!!ke.config.enable,ka=(Ks=ke.config.enable)!==null&&Ks!==void 0?Ks:ke.config.disable,Ma=0,Mr=void 0;Ma<ka.length;Ma++){if(Mr=ka[Ma],typeof Mr=="function"&&Mr(pr))return ia;if(Mr instanceof Date&&pr!==void 0&&Mr.getTime()===pr.getTime())return ia;if(typeof Mr=="string"){var il=ke.parseDate(Mr,void 0,!0);return il&&il.getTime()===pr.getTime()?ia:!ia}else if(typeof Mr=="object"&&pr!==void 0&&Mr.from&&Mr.to&&pr.getTime()>=Mr.from.getTime()&&pr.getTime()<=Mr.to.getTime())return ia}return!ia}function el(vs){return ke.daysContainer!==void 0?vs.className.indexOf("hidden")===-1&&vs.className.indexOf
Line truncated
|
||||
`||Mn==="\r",lC=(Mn,Vn)=>Vn<Mn.length&&Vn>=0?Lg(Mn[Vn]):!1,V1=(Mn,Vn=4,Wn=!0,jn=!0)=>{const Gn=Jd(" ",Vn),no=Mn.replace(/\t/g,Gn);return ra(no,(po,vo)=>E0(vo)||vo===hc?po.pcIsSpace||po.str===""&&Wn||po.str.length===no.length-1&&jn||lC(no,po.str.length+1)?{pcIsSpace:!1,str:po.str+hc}:{pcIsSpace:!0,str:po.str+" "}:{pcIsSpace:Lg(vo),str:po.str+vo},{pcIsSpace:!1,str:""}).str},By=(Mn,Vn)=>{const Wn=Cs.fromDom(Vn),jn=Cs.fromDom(Mn);return fS(jn,"pre,code",ws(Vs,Wn))},z1=(Mn,Vn)=>Ir(Mn)&&Q1(Mn.data)&&!By(Mn,Vn),Pd=Mn=>Oa(Mn)&&Mn.nodeName==="A"&&!Mn.hasAttribute("href")&&(Mn.hasAttribute("name")||Mn.hasAttribute("id")),Cp=(Mn,Vn)=>Xl(Mn)&&!z1(Mn,Vn)||Pd(Mn)||tg(Mn),tg=w0("data-mce-bookmark"),W1=w0("data-mce-bogus"),U1=nf("data-mce-bogus","all"),T0=Mn=>Uc(Cs.fromDom(Mn)).exists(Vn=>!yl(Vn)),Im=(Mn,Vn)=>{let Wn=0;if(Cp(Mn,Mn))return!1;{let jn=Mn.firstChild;if(!jn)return!0;const Gn=new mu(jn,Mn);do{if(Vn){if(U1(jn)){jn=Gn.next(!0);continue}if(W1(jn)){jn=Gn.next();continue}}if(Gf(jn)&&T0(jn))return!1;if(Ec(jn)){Wn++,jn=Gn.next();continue}if(Cp(jn,Mn))return!1;jn=Gn.next()}while(jn);return Wn<=1}},md=(Mn,Vn=!0)=>Im(Mn.dom,Vn),ng=Mn=>Mn.toLowerCase()==="svg",DO=Mn=>ng(Mn.nodeName),Fy=Mn=>(Mn==null?void 0:Mn.nodeName)==="svg"?"svg":"html",Hy=["svg"],Z1=()=>{let Mn=[];const Vn=()=>Mn[Mn.length-1];return{track:no=>{DO(no)&&Mn.push(no);let ao=Vn();return ao&&!ao.contains(no)&&(Mn.pop(),ao=Vn()),Fy(ao)},current:()=>Fy(Vn()),reset:()=>{Mn=[]}}},Ah="data-mce-block",kp=Mn=>nr(Al(Mn),Vn=>!/[A-Z]/.test(Vn)),s1=Mn=>Us(kp(Mn),Vn=>`${Vn}:`+Us(Hy,Wn=>`not(${Wn} ${Vn})`).join(":")).join(","),Ig=(Mn,Vn)=>is(Vn.querySelector(Mn))?(Vn.setAttribute(Ah,"true"),Vn.getAttribute("data-mce-selected")==="inline-boundary"&&Vn.removeAttribute("data-mce-selected"),!0):(Vn.removeAttribute(Ah),!1),Zh=(Mn,Vn)=>{const Wn=s1(Mn.getTransparentElements()),jn=s1(Mn.getBlockElements());return nr(Vn.querySelectorAll(Wn),Gn=>Ig(jn,Gn))},xp=(Mn,Vn)=>{var Wn;const jn=Vn?"lastChild":"firstChild";for(let Gn=Mn[jn];Gn;Gn=Gn[jn])if(md(Cs.fromDom(Gn))){(Wn=Gn.parentNode)===null||Wn===void 0||Wn.removeChild(Gn);return}},q1=(Mn,Vn)=>{const Wn=document.createRange(),jn=Mn.parentNode;if(jn){Wn.setStartBefore(Mn),Wn.setEndBefore(Vn);const Gn=Wn.extractContents();xp(Gn,!0),Wn.setStartAfter(Vn),Wn.setEndAfter(Mn);const no=Wn.extractContents();xp(no,!1),md(Cs.fromDom(Gn))||jn.insertBefore(Gn,Mn),md(Cs.fromDom(Vn))||jn.insertBefore(Vn,Mn),md(Cs.fromDom(no))||jn.insertBefore(no,Mn),jn.removeChild(Mn)}},hS=(Mn,Vn,Wn)=>{const jn=Mn.getBlockElements(),Gn=Cs.fromDom(Vn),no=po=>ql(po)in jn,ao=po=>Vs(po,Gn);fs(Km(Wn),po=>{au(po,no,ao).each(vo=>{const Ao=kh(po,Fo=>no(Fo)&&!Mn.isValidChild(ql(vo),ql(Fo)));if(Ao.length>0){const Fo=Uc(vo);fs(Ao,Qo=>{au(Qo,no,ao).each(qo=>{q1(qo.dom,Qo.dom)})}),Fo.each(Qo=>Zh(Mn,Qo.dom))}})})},MO=(Mn,Vn,Wn)=>{fs([...Wn,...Wl(Mn,Vn)?[Vn]:[]],jn=>fs(mf(Cs.fromDom(jn),jn.nodeName.toLowerCase()),Gn=>{Qa(Mn,Gn.dom)&&hf(Gn)}))},kv=(Mn,Vn)=>{const Wn=Zh(Mn,Vn);hS(Mn,Vn,Wn),MO(Mn,Vn,Wn)},j1=(Mn,Vn)=>{if(Tv(Mn,Vn)){const Wn=s1(Mn.getBlockElements());Ig(Wn,Vn)}},xv=(Mn,Vn,Wn)=>{const jn=no=>Vs(no,Cs.fromDom(Vn)),Gn=D1(Cs.fromDom(Wn),jn);Fc(Gn,Gn.length-2).filter(lf).fold(()=>kv(Mn,Vn),no=>kv(Mn,no.dom))},NO=Mn=>Mn.hasAttribute(Ah),Ev=(Mn,Vn)=>Mr(Mn.getTransparentElements(),Vn),Tv=(Mn,Vn)=>Oa(Vn)&&Ev(Mn,Vn.nodeName),Wl=(Mn,Vn)=>Tv(Mn,Vn)&&NO(Vn),Qa=(Mn,Vn)=>Tv(Mn,Vn)&&!NO(Vn),og=(Mn,Vn)=>Vn.type===1&&Ev(Mn,Vn.name)&&xo(Vn.attr(Ah)),Av=xl().browser,Lb=Mn=>xa(Mn,lf),T2=Mn=>Av.isFirefox()&&ql(Mn)==="table"?Lb(Ku(Mn)).filter(Vn=>ql(Vn)==="caption").bind(Vn=>Lb(Id(Vn)).map(Wn=>{const jn=Wn.dom.offsetTop,Gn=Vn.dom.offsetTop,no=Vn.dom.offsetHeight;return jn<=Gn?-no:0})).getOr(0):0,LO=(Mn,Vn)=>Mn.children&&Zs(Mn.children,Vn),Jc=(Mn,Vn,Wn)=>{let jn=0,Gn=0;const no=Mn.ownerDocument;if(Wn=Wn||Mn,Vn){if(Wn===Mn&&Vn.getBoundingClientRect&&Ju(Cs.fromDom(Mn),"position")==="static"){const po=Vn.getBoundingClientRect();return jn=po.left+(no.documentElement.scrollLeft||Mn.scrollLeft)-no.documentElement.clientLeft,Gn=po.top+(no.documentElement.scrollTop||Mn.scrollTop)-no.documentElement.clientTop,{x:jn,y:Gn}}let ao=Vn;for(;ao&&ao!==Wn&&ao.nodeType&&!LO(ao,Wn);){const po=ao;jn+=po.offsetLeft||0,Gn+=po.offsetTop||0,ao=po.offsetParent}for(ao=Vn.parentNode;ao&&ao!==Wn&&ao.nodeType&&!LO(ao,Wn);)jn-=ao.scrollLeft||0,Gn-=ao.scrollTop||0,ao=ao.parentNode;Gn+=T2(Cs.fromDom(Vn))}return{x:jn,y:Gn}},IO=(Mn,Vn={})=>{let Wn=0;const jn={},Gn=Cs.fromDom(Mn),no=Fa(Gn),ao=Ls=>{Vn.referrerPolicy=Ls},po=Ls=>{Vn.contentCssCors=Ls},vo=Ls=>{Fu(N1(Gn),Ls)},Ao=Ls=>{const zs=N1(Gn);uf(zs,"#"+Ls).each(sc)},Fo=Ls=>Ma(jn,Ls).getOrThunk(()=>({id:"mce-u"+Wn++,passed:[],failed:[],count:0})),Qo=Ls=>new Promise((zs,Hs)=>{let tr;const Pr=Lr._addCacheSuffix(Ls),Ur=Fo(Pr);jn[Pr]=Ur,Ur.count++;const fa=(wa,Va)=>{fs(wa,ha),Ur.status=Va,Ur.passed=[],Ur.failed=[],tr&&(tr.onload=null,tr.onerror=null,tr=null)},yr=()=>fa(Ur.passed,2),fr=()=>fa(Ur.failed,3);if(zs&&Ur.passed.push(zs),Hs&&Ur.failed.push(Hs),Ur.status===1)return
Line truncated
|
||||
Actual: `+qo.join(","));if(!gc(Vn,bs=>Zs(qo,bs)))throw new Error("Not all branches were specified when using match. Specified: "+qo.join(", ")+`
|
||||
Required: `+Vn.join(", "));return Qo[ao].apply(null,vo)},log:Qo=>{console.log(Qo,{constructors:Vn,constructor:ao,params:vo})}}}}),Wn}};Qg.generate([{bothErrors:["error1","error2"]},{firstError:["error1","value2"]},{secondError:["value1","error2"]},{bothValues:["value1","value2"]}]);const Zr=Mn=>{const Vn=[],Wn=[];return fs(Mn,jn=>{jn.fold(Gn=>{Vn.push(Gn)},Gn=>{Wn.push(Gn)})}),{errors:Vn,values:Wn}},LS=Mn=>Mn.type==="inline-command"||Mn.type==="inline-format",Of=Mn=>Mn.type==="block-command"||Mn.type==="block-format",IS=Mn=>{const Vn=jn=>ym.error({message:jn,pattern:Mn}),Wn=(jn,Gn,no)=>{if(Mn.format!==void 0){let ao;if(Jo(Mn.format)){if(!gc(Mn.format,xo))return Vn(jn+" pattern has non-string items in the `format` array");ao=Mn.format}else if(xo(Mn.format))ao=[Mn.format];else return Vn(jn+" pattern has non-string `format` parameter");return ym.value(Gn(ao))}else return Mn.cmd!==void 0?xo(Mn.cmd)?ym.value(no(Mn.cmd,Mn.value)):Vn(jn+" pattern has non-string `cmd` parameter"):Vn(jn+" pattern is missing both `format` and `cmd` parameters")};if(!Io(Mn))return Vn("Raw pattern is not an object");if(!xo(Mn.start))return Vn("Raw pattern is missing `start` parameter");if(Mn.end!==void 0){if(!xo(Mn.end))return Vn("Inline pattern has non-string `end` parameter");if(Mn.start.length===0&&Mn.end.length===0)return Vn("Inline pattern has empty `start` and `end` parameters");let jn=Mn.start,Gn=Mn.end;return Gn.length===0&&(Gn=jn,jn=""),Wn("Inline",no=>({type:"inline-format",start:jn,end:Gn,format:no}),(no,ao)=>({type:"inline-command",start:jn,end:Gn,cmd:no,value:ao}))}else return Mn.replacement!==void 0?xo(Mn.replacement)?Mn.start.length===0?Vn("Replacement pattern has empty `start` parameter"):ym.value({type:"inline-command",start:"",end:Mn.start,cmd:"mceInsertContent",value:Mn.replacement}):Vn("Replacement pattern has non-string `replacement` parameter"):Mn.start.length===0?Vn("Block pattern has empty `start` parameter"):Wn("Block",jn=>({type:"block-format",start:Mn.start,format:jn[0]}),(jn,Gn)=>({type:"block-command",start:Mn.start,cmd:jn,value:Gn}))},Ub=Mn=>nr(Mn,Of),Jy=Mn=>nr(Mn,LS),Om=(Mn,Vn)=>({inlinePatterns:Jy(Mn),blockPatterns:Ub(Mn),dynamicPatternsLookup:Vn}),TC=Mn=>{const Vn=Zr(Us(Mn,IS));return fs(Vn.errors,Wn=>console.error(Wn.message,Wn.pattern)),Vn.values},eO=Mn=>Vn=>{const Wn=Mn(Vn);return TC(Wn)},Cd=xl().deviceType,Vg=Cd.isTouch(),tO=Eu.DOM,h1=Mn=>{const Vn=Mn.indexOf("=")>0?Mn.split(/[;,](?![^=;,]*(?:[;,]|$))/):Mn.split(",");return ra(Vn,(Wn,jn)=>{const Gn=jn.split("="),no=Gn[0],ao=Gn.length>1?Gn[1]:no;return Wn[ih(no)]=ih(ao),Wn},{})},dg=Mn=>Do(Mn,RegExp),ma=Mn=>Vn=>Vn.options.get(Mn),ip=Mn=>xo(Mn)||Io(Mn),BS=(Mn,Vn="")=>Wn=>{const jn=xo(Wn);if(jn)if(Wn.indexOf("=")!==-1){const Gn=h1(Wn);return{value:Ma(Gn,Mn.id).getOr(Vn),valid:jn}}else return{value:Wn,valid:jn};else return{valid:!1,message:"Must be a string."}},m1=Mn=>{const Vn=Mn.options.register;Vn("id",{processor:"string",default:Mn.id}),Vn("selector",{processor:"string"}),Vn("target",{processor:"object"}),Vn("suffix",{processor:"string"}),Vn("cache_suffix",{processor:"string"}),Vn("base_url",{processor:"string"}),Vn("referrer_policy",{processor:"string",default:""}),Vn("language_load",{processor:"boolean",default:!0}),Vn("inline",{processor:"boolean",default:!1}),Vn("iframe_attrs",{processor:"object",default:{}}),Vn("doctype",{processor:"string",default:"<!DOCTYPE html>"}),Vn("document_base_url",{processor:"string",default:Mn.documentBaseUrl}),Vn("body_id",{processor:BS(Mn,"tinymce"),default:"tinymce"}),Vn("body_class",{processor:BS(Mn),default:""}),Vn("content_security_policy",{processor:"string",default:""}),Vn("br_in_pre",{processor:"boolean",default:!0}),Vn("forced_root_block",{processor:Wn=>{const jn=xo(Wn)&&fc(Wn);return jn?{value:Wn,valid:jn}:{valid:!1,message:"Must be a non-empty string."}},default:"p"}),Vn("forced_root_block_attrs",{processor:"object",default:{}}),Vn("newline_behavior",{processor:Wn=>{const jn=Zs(["block","linebreak","invert","default"],Wn);return jn?{value:Wn,valid:jn}:{valid:!1,message:"Must be one of: block, linebreak, invert or default."}},default:"default"}),Vn("br_newline_selector",{processor:"string",default:".mce-toc h2,figcaption,caption"}),Vn("no_newline_selector",{processor:"string",default:""}),Vn("keep_styles",{processor:"boolean",default:!0}),Vn("end_container_on_empty_block",{processor:Wn=>Go(Wn)?{valid:!0,value:Wn}:xo(Wn)?{valid:!0,value:Wn}:{valid:!1,message:"Must be boolean or a string"},default:"blockquote"}),Vn("font_size_style_values",{processor:"string",default:"xx-small,x-small,small,medium,large,x-large,xx-large"}),Vn("font_size_legacy_values",{processor:"string",default:"xx-small,small,medium,large,x-large,xx-large,300%"}),Vn("font_size_classes",{processor:"string",default:""}),Vn("automatic_uploads",{processor:"boolean",default:!0}),Vn("images_reuse_filename",{processor:"boolean",default:!1}),Vn("images_replace_blob_uris",{processor:"boolean",default:!0}),Vn("icons",{processor:"string",default:""})
Line truncated
|
||||
\r \v`.indexOf(Mn)!==-1,uy=Mn=>!k_(Mn)&&!ok(Mn)&&!hd(Mn),sk=Mn=>{const Vn=[];if(Mn)for(let Wn=0;Wn<Mn.rangeCount;Wn++)Vn.push(Mn.getRangeAt(Wn));return Vn},rk=Mn=>cc(Mn,Vn=>{const Wn=jv(Vn);return Wn?[Cs.fromDom(Wn)]:[]}),dO=Mn=>sk(Mn).length>1,y3=Mn=>nr(rk(Mn),Eh),QT=Mn=>mf(Mn,"td[data-mce-selected],th[data-mce-selected]"),O3=(Mn,Vn)=>{const Wn=QT(Vn);return Wn.length>0?Wn:y3(Mn)},x_=Mn=>O3(sk(Mn.selection.getSel()),Cs.fromDom(Mn.getBody())),q0=(Mn,Vn)=>lm(Mn,"table",Vn),_3=Mn=>{const Vn=Mn.startContainer,Wn=Mn.startOffset;return Ir(Vn)?Wn===0?zo.some(Cs.fromDom(Vn)):zo.none():zo.from(Vn.childNodes[Wn]).map(Cs.fromDom)},S3=Mn=>{const Vn=Mn.endContainer,Wn=Mn.endOffset;return Ir(Vn)?Wn===Vn.data.length?zo.some(Cs.fromDom(Vn)):zo.none():zo.from(Vn.childNodes[Wn-1]).map(Cs.fromDom)},VT=Mn=>iu(Mn).fold(xs([Mn]),Vn=>[Mn].concat(VT(Vn))),Cx=Mn=>am(Mn).fold(xs([Mn]),Vn=>ql(Vn)==="br"?_d(Vn).map(Wn=>[Mn].concat(Cx(Wn))).getOr([]):[Mn].concat(Cx(Vn))),kx=(Mn,Vn)=>jc(_3(Vn),S3(Vn),(Wn,jn)=>{const Gn=xa(VT(Mn),ws(Vs,Wn)),no=xa(Cx(Mn),ws(Vs,jn));return Gn.isSome()&&no.isSome()}).getOr(!1),xx=(Mn,Vn,Wn,jn)=>{const Gn=Wn,no=new mu(Wn,Gn),ao=pr(Mn.schema.getMoveCaretBeforeOnEnterElements(),(vo,Ao)=>!Zs(["td","th","table"],Ao.toLowerCase()));let po=Wn;do{if(Ir(po)&&Lr.trim(po.data).length!==0){jn?Vn.setStart(po,0):Vn.setEnd(po,po.data.length);return}if(ao[po.nodeName]){jn?Vn.setStartBefore(po):po.nodeName==="BR"?Vn.setEndBefore(po):Vn.setEndAfter(po);return}}while(po=jn?no.next():no.prev());Gn.nodeName==="BODY"&&(jn?Vn.setStart(Gn,0):Vn.setEnd(Gn,Gn.childNodes.length))},ik=Mn=>{const Vn=Mn.selection.getSel();return is(Vn)&&Vn.rangeCount>0},dy=(Mn,Vn)=>{const Wn=x_(Mn);Wn.length>0?fs(Wn,jn=>{const Gn=jn.dom,no=Mn.dom.createRng();no.setStartBefore(Gn),no.setEndAfter(Gn),Vn(no,!0)}):Vn(Mn.selection.getRng(),!1)},zT=(Mn,Vn,Wn)=>{const jn=f1(Mn,Vn);Wn(jn),Mn.moveToBookmark(jn)},uw=Mn=>Ys(Mn==null?void 0:Mn.nodeType),Ex=Mn=>Oa(Mn)&&!hg(Mn)&&!fg(Mn)&&!Jm(Mn),w3=(Mn,Vn)=>{if(Ex(Vn)&&!/^(TD|TH)$/.test(Vn.nodeName)){const Wn=Mn.getAttrib(Vn,"data-mce-selected"),jn=parseInt(Wn,10);return!isNaN(jn)&&jn>0}else return!1},dw=(Mn,Vn,Wn)=>{const{selection:jn,dom:Gn}=Mn,no=jn.getNode(),ao=jl(no);zT(jn,!0,()=>{Vn()}),ao&&jl(no)&&Gn.isChildOf(no,Mn.getBody())?Mn.selection.select(no):Wn(jn.getStart())&&C3(Gn,jn)},C3=(Mn,Vn)=>{var Wn,jn;const Gn=Vn.getRng(),{startContainer:no,startOffset:ao}=Gn,po=Vn.getNode();if(!w3(Mn,po)&&Oa(no)){const vo=no.childNodes,Ao=Mn.getRoot();let Fo;if(ao<vo.length){const Qo=vo[ao];Fo=new mu(Qo,(Wn=Mn.getParent(Qo,Mn.isBlock))!==null&&Wn!==void 0?Wn:Ao)}else{const Qo=vo[vo.length-1];Fo=new mu(Qo,(jn=Mn.getParent(Qo,Mn.isBlock))!==null&&jn!==void 0?jn:Ao),Fo.next(!0)}for(let Qo=Fo.current();Qo;Qo=Fo.next()){if(Mn.getContentEditable(Qo)==="false")return;if(Ir(Qo)&&!sf(Qo)){Gn.setStart(Qo,0),Vn.setRng(Gn);return}}}},da=(Mn,Vn,Wn)=>{if(Mn){const jn=Vn?"nextSibling":"previousSibling";for(Mn=Mn[jn];Mn;Mn=Mn[jn])if(Oa(Mn)||!sf(Mn))return Mn}},Nf=(Mn,Vn)=>!!Mn.getTextBlockElements()[Vn.nodeName.toLowerCase()]||Wl(Mn,Vn),j0=(Mn,Vn,Wn)=>Mn.schema.isValidChild(Vn,Wn),sf=(Mn,Vn=!1)=>{if(is(Mn)&&Ir(Mn)){const Wn=Vn?Mn.data.replace(/ /g," "):Mn.data;return Q1(Wn)}else return!1},Wg=Mn=>is(Mn)&&Ir(Mn)&&Mn.length===0,ak=(Mn,Vn)=>{const Wn="[data-mce-cef-wrappable]",jn=zg(Mn),Gn=Td(jn)?Wn:`${Wn},${jn}`;return zh(Cs.fromDom(Vn),Gn)},fw=(Mn,Vn)=>{const Wn=Mn.dom;return Ex(Vn)&&Wn.getContentEditable(Vn)==="false"&&ak(Mn,Vn)&&Wn.select('[contenteditable="true"]',Vn).length===0},fb=(Mn,Vn)=>Yo(Mn)?Mn(Vn):(is(Vn)&&(Mn=Mn.replace(/%(\w+)/g,(Wn,jn)=>Vn[jn]||Wn)),Mn),lk=(Mn,Vn)=>(Mn=Mn||"",Vn=Vn||"",Mn=""+(Mn.nodeName||Mn),Vn=""+(Vn.nodeName||Vn),Mn.toLowerCase()===Vn.toLowerCase()),ck=(Mn,Vn)=>{if(ms(Mn))return null;{let Wn=String(Mn);return(Vn==="color"||Vn==="backgroundColor")&&(Wn=Bm(Wn)),Vn==="fontWeight"&&Mn===700&&(Wn="bold"),Vn==="fontFamily"&&(Wn=Wn.replace(/[\'\"]/g,"").replace(/,\s+/g,",")),Wn}},E_=(Mn,Vn,Wn)=>{const jn=Mn.getStyle(Vn,Wn);return ck(jn,Wn)},WT=(Mn,Vn)=>{let Wn;return Mn.getParent(Vn,jn=>Oa(jn)?(Wn=Mn.getStyle(jn,"text-decoration"),!!Wn&&Wn!=="none"):!1),Wn},hw=(Mn,Vn,Wn)=>Mn.getParents(Vn,Wn,Mn.getRoot()),Tx=(Mn,Vn,Wn)=>{const jn=Mn.formatter.get(Vn);return is(jn)&&Sr(jn,Wn)},Ax=(Mn,Vn)=>Tx(Mn,Vn,jn=>{const Gn=no=>Yo(no)||no.length>1&&no.charAt(0)==="%";return Sr(["styles","attributes"],no=>Ma(jn,no).exists(ao=>{const po=Jo(ao)?ao:ka(ao);return Sr(po,Gn)}))}),k3=(Mn,Vn,Wn)=>{const jn=["inline","block","selector","attributes","styles","classes"],Gn=no=>pr(no,(ao,po)=>Sr(jn,vo=>vo===po));return Tx(Mn,Vn,no=>{const ao=Gn(no);return Tx(Mn,Wn,po=>{const vo=Gn(po);return Na(ao,vo)})})},hb=Mn=>il(Mn,"block"),uk=Mn=>hb(Mn)&&Mn.wrapper===!0,T_=Mn=>hb(Mn)&&Mn.wrapper!==!0,Nh=Mn=>il(Mn,"selector"),Sf=Mn=>il(Mn,"inline"),dk=Mn=>Nh(Mn)&&Sf(Mn)&&qc(Ma(Mn,"mixed"),!0),mw=Mn=>Nh(Mn)&&Mn.expand!==!1&&!Sf(Mn),fk=Mn=>{const Vn=[];let Wn=Mn;for(;Wn;){if(Ir(Wn)&&Wn.data!==_o||Wn.childNodes.length>1)return[];Oa(Wn)&&Vn.push(Wn),Wn=Wn.
Line truncated
|
||||
]*|<br \\/>[\r
|
||||
]*)$`);return Vn.replace(jn,"")},BY=(Mn,Vn)=>{const Wn=Mn.getDoc(),jn=Wf(Cs.fromDom(Mn.getBody())),Gn=Cs.fromTag("div",Wn);Gc(Gn,"data-mce-bogus","all"),ff(Gn,{position:"fixed",left:"-9999999px",top:"0"}),dm(Gn,Vn.innerHTML),Rl(Gn),eR(Gn);const no=Ny(jn);Fu(no,Gn);const ao=Xo(Gn.dom.innerText);return sc(Gn),ao},XH=(Mn,Vn,Wn)=>{let jn;return Vn.format==="raw"?jn=Lr.trim(Xo(s5(Wn,Mn.serializer.getTempAttrs()).innerHTML)):Vn.format==="text"?jn=BY(Mn,Wn):Vn.format==="tree"?jn=Mn.serializer.serialize(Wn,Vn):jn=IY(Mn,Mn.serializer.serialize(Wn,Vn)),Vn.format!=="text"&&!Xd(Cs.fromDom(Wn))&&xo(jn)?Lr.trim(jn):jn},FY=(Mn,Vn)=>zo.from(Mn.getBody()).fold(xs(Vn.format==="tree"?new fp("body",11):""),Wn=>XH(Mn,Vn,Wn)),YH=Lr.makeMap,r5=Mn=>{const Vn=[];Mn=Mn||{};const Wn=Mn.indent,jn=YH(Mn.indent_before||""),Gn=YH(Mn.indent_after||""),no=P0.getEncodeFunc(Mn.entity_encoding||"raw",Mn.entities),ao=Mn.element_format!=="xhtml";return{start:(po,vo,Ao)=>{if(Wn&&jn[po]&&Vn.length>0){const Fo=Vn[Vn.length-1];Fo.length>0&&Fo!==`
|
||||
`&&Vn.push(`
|
||||
`)}if(Vn.push("<",po),vo)for(let Fo=0,Qo=vo.length;Fo<Qo;Fo++){const qo=vo[Fo];Vn.push(" ",qo.name,'="',no(qo.value,!0),'"')}if(!Ao||ao?Vn[Vn.length]=">":Vn[Vn.length]=" />",Ao&&Wn&&Gn[po]&&Vn.length>0){const Fo=Vn[Vn.length-1];Fo.length>0&&Fo!==`
|
||||
`&&Vn.push(`
|
||||
`)}},end:po=>{let vo;Vn.push("</",po,">"),Wn&&Gn[po]&&Vn.length>0&&(vo=Vn[Vn.length-1],vo.length>0&&vo!==`
|
||||
`&&Vn.push(`
|
||||
`))},text:(po,vo)=>{po.length>0&&(Vn[Vn.length]=vo?po:no(po))},cdata:po=>{Vn.push("<![CDATA[",po,"]]>")},comment:po=>{Vn.push("<!--",po,"-->")},pi:(po,vo)=>{vo?Vn.push("<?",po," ",no(vo),"?>"):Vn.push("<?",po,"?>"),Wn&&Vn.push(`
|
||||
`)},doctype:po=>{Vn.push("<!DOCTYPE",po,">",Wn?`
|
||||
`:"")},reset:()=>{Vn.length=0},getContent:()=>Vn.join("").replace(/\n$/,"")}},I_=(Mn={},Vn=i1())=>{const Wn=r5(Mn);return Mn.validate="validate"in Mn?Mn.validate:!0,{serialize:Gn=>{const no=Mn.validate,ao={3:vo=>{var Ao;Wn.text((Ao=vo.value)!==null&&Ao!==void 0?Ao:"",vo.raw)},8:vo=>{var Ao;Wn.comment((Ao=vo.value)!==null&&Ao!==void 0?Ao:"")},7:vo=>{Wn.pi(vo.name,vo.value)},10:vo=>{var Ao;Wn.doctype((Ao=vo.value)!==null&&Ao!==void 0?Ao:"")},4:vo=>{var Ao;Wn.cdata((Ao=vo.value)!==null&&Ao!==void 0?Ao:"")},11:vo=>{let Ao=vo;if(Ao=Ao.firstChild)do po(Ao);while(Ao=Ao.next)}};Wn.reset();const po=vo=>{var Ao;const Fo=ao[vo.type];if(Fo)Fo(vo);else{const Qo=vo.name,qo=Qo in Vn.getVoidElements();let ds=vo.attributes;if(no&&ds&&ds.length>1){const bs=[];bs.map={};const ls=Vn.getElementRule(vo.name);if(ls){for(let ys=0,Ls=ls.attributesOrder.length;ys<Ls;ys++){const zs=ls.attributesOrder[ys];if(zs in ds.map){const Hs=ds.map[zs];bs.map[zs]=Hs,bs.push({name:zs,value:Hs})}}for(let ys=0,Ls=ds.length;ys<Ls;ys++){const zs=ds[ys].name;if(!(zs in bs.map)){const Hs=ds.map[zs];bs.map[zs]=Hs,bs.push({name:zs,value:Hs})}}ds=bs}}if(Wn.start(Qo,ds,qo),ng(Qo))xo(vo.value)&&Wn.text(vo.value,!0),Wn.end(Qo);else if(!qo){let bs=vo.firstChild;if(bs){(Qo==="pre"||Qo==="textarea")&&bs.type===3&&((Ao=bs.value)===null||Ao===void 0?void 0:Ao[0])===`
|
||||
`&&Wn.text(`
|
||||
`,!0);do po(bs);while(bs=bs.next)}Wn.end(Qo)}}};return Gn.type===1&&!Mn.inner?po(Gn):Gn.type===3?ao[3](Gn):ao[11](Gn),Wn.getContent()}}},ol=new Set;fs(["margin","margin-left","margin-right","margin-top","margin-bottom","padding","padding-left","padding-right","padding-top","padding-bottom","border","border-width","border-style","border-color","background","background-attachment","background-clip","background-color","background-image","background-origin","background-position","background-repeat","background-size","float","position","left","right","top","bottom","z-index","display","transform","width","max-width","min-width","height","max-height","min-height","overflow","overflow-x","overflow-y","text-overflow","vertical-align","transition","transition-delay","transition-duration","transition-property","transition-timing-function"],Vn=>{ol.add(Vn)});const i5=["font","text-decoration","text-emphasis"],tR=(Mn,Vn)=>Al(Mn.parseStyle(Mn.getAttrib(Vn,"style"))),GH=Mn=>ol.has(Mn),qx=(Mn,Vn)=>gc(tR(Mn,Vn),Wn=>!GH(Wn)),a5=Mn=>nr(Mn,Vn=>Sr(i5,Wn=>Dc(Vn,Wn))),KH=(Mn,Vn,Wn)=>{const jn=tR(Mn,Vn),Gn=tR(Mn,Wn),no=ao=>{var po,vo;const Ao=(po=Mn.getStyle(Vn,ao))!==null&&po!==void 0?po:"",Fo=(vo=Mn.getStyle(Wn,ao))!==null&&vo!==void 0?vo:"";return fc(Ao)&&fc(Fo)&&Ao!==Fo};return Sr(jn,ao=>{const po=vo=>Sr(vo,Ao=>Ao===ao);if(!po(Gn)&&po(i5)){const vo=a5(Gn);return Sr(vo,no)}else return no(ao)})},l5=(Mn,Vn,Wn)=>zo.from(Wn.container()).filter(Ir).exists(jn=>{const Gn=Mn?0:-1;return Vn(jn.data.charAt(Wn.offset()+Gn))}),nR=ws(l5,!0,k_),OA=ws(l5,!1,k_),JH=Mn=>{const Vn=Mn.container();return Ir(Vn)&&(Vn.data.length===0||Po(Vn.data)&&fO.isBookmarkNode(Vn.parentNode))},Aw=(Mn,Vn)=>Wn=>ua(Mn?0:-1,Wn).filter(Vn).isSome(),e9=Mn=>td(Mn)&&Ju(Cs.fromDom(Mn),"display")==="block",c5=Mn=>jl(Mn)&&!_v(Mn),t9=Aw(!0,e9),n9=Aw(!1,e9),jx=Aw(!0,pu),wk=Aw(!1,pu),u5=Aw(!0,Gp),Ql=Aw(!1,Gp),bO=Aw(!0,c5),tv=Aw(!1,c5),d5=Mn=>Mn.slice(0,-1),f5=(Mn,Vn,Wn)=>Dr(Vn,Mn)?d5(D1(Mn,jn=>Wn(jn)||Vs(jn,Vn))):[],oR=(Mn,Vn)=>f5(Mn,Vn,hs),py=(Mn,Vn)=>[Mn].concat(oR(Mn,Vn)),_A=(Mn,Vn,Wn)=>g1(Mn,Vn,Wn,JH),o9=Mn=>Vn=>Mn.isBlock(ql(Vn)),sR=(Mn,Vn,Wn)=>xa(py(Cs.fromDom(Vn.container()),Mn),o9(Wn)),h5=(Mn,Vn,Wn,jn)=>_A(Mn,Vn.dom,Wn).forall(Gn=>sR(Vn,Wn,jn).fold(()=>!jr(Gn,Wn,Vn.dom),no=>!jr(Gn,Wn,Vn.dom)&&Dr(no,Cs.fromDom(Gn.container())))),m5=(Mn,Vn,Wn,jn)=>sR(Vn,Wn,jn).fold(()=>_A(Mn,Vn.dom,Wn).forall(Gn=>!jr(Gn,Wn,Vn.dom)),Gn=>_A(Mn,Gn.dom,Wn).isNone()),rR=ws(m5,!1),p5=ws(m5,!0),s9=ws(h5,!1),r9=ws(h5,!0),i9=Mn=>Mh(Mn).exists(np),SA=(Mn,Vn,Wn,jn)=>{const Gn=nr(py(Cs.fromDom(Wn.container()),Vn),ao=>jn.isBlock(ql(ao))),no=qa(Gn).getOr(Vn);return vh(Mn,no.dom,Wn).filter(i9)},Xx=(Mn,Vn,Wn)=>Mh(Vn).exists(np)||SA(!0,Mn,Vn,Wn).isSome(),Yx=(Mn,Vn,Wn)=>Rp(Vn).exists(np)||SA(!1,Mn,Vn,Wn).isSome(),a9=ws(SA,!1),l9=ws(SA,!0),g5=Mn=>lr.isTextPosition(Mn)&&!Mn.isAtStart()&&!Mn.isAtEnd(),b5=(Mn,Vn,Wn)=>{const jn=nr(py(Cs.fromDom(Vn.container()),Mn),Gn=>Wn.isBlock(ql(Gn)));return qa(jn).getOr(Mn)},v5=(Mn,Vn,Wn)=>g5(Vn)?OA(Vn):OA(Vn)||cp(b5(Mn,Vn,Wn).dom,Vn).exists(OA),y5=(Mn,Vn,Wn)=>g5(Vn)?nR(Vn):nR(Vn)||Sm(b5(Mn,Vn,Wn).dom,Vn).exists(nR),c9=Mn=>Zs(["pre","pre-wrap"],Mn),iR=Mn=>Mh(Mn).bind(Vn=>cf(Vn,lf)).exists(Vn=>c9(Ju(Vn,"white-space"))),O5=(Mn,Vn)=>cp(Mn.dom,Vn).isNone(),u9=(Mn,Vn)=>Sm(Mn.dom,Vn).isNone(),d9=(Mn,Vn,Wn)=>O5(Mn,Vn)||u9(Mn,Vn)||rR(Mn,Vn,Wn)||p5(Mn,Vn,Wn)||Yx(Mn,Vn,Wn)||Xx(Mn,Vn,Wn),Pw=Mn=>is(Mn)&&jl(Mn)&&Yb(Mn),_5=(Mn,Vn)=>Wn=>Pw(new mu(Wn,Mn)[Vn]()),S5=(Mn,Vn)=>{const Wn=Sm(Mn.dom,Vn).getOr(Vn),jn=_5(Mn.dom,"next");return Vn.isAtEnd()&&(jn(Vn.container())||jn(Wn.container()))},f9=(Mn,Vn)=>{const Wn=cp(Mn.dom,Vn).getOr(Vn),jn=_5(Mn.dom,"prev");return Vn.isAtStart()&&(jn(Vn.container())||jn(Wn.container()))},w5=(Mn,Vn,Wn)=>iR(Vn)?!1:d9(Mn,Vn,Wn)||v5(Mn,Vn,Wn)||y5(Mn,Vn,Wn),Ck=(Mn,Vn,Wn)=>iR(Vn)?!1:rR(Mn,Vn,Wn)||s9(Mn,Vn,Wn)||Yx(Mn,Vn,Wn)||v5(Mn,Vn,Wn)||f9(Mn,Vn),C5=Mn=>{const Vn=Mn.container(),Wn=Mn.offset();return Ir(Vn)&&Wn<Vn.data.length?lr(Vn,Wn+1):Mn},kk=(Mn,Vn,Wn)=>iR(Vn)?!1:p5(Mn,Vn,Wn)||r9(Mn,Vn,Wn)||Xx(Mn,Vn,Wn)||y5(Mn,Vn,Wn)||S5(Mn,Vn),wA=(Mn,Vn,Wn)=>Ck(Mn,Vn,Wn)||kk(Mn,C5(Vn),Wn),hp=(Mn,Vn)=>ok(Mn.charAt(Vn)),k5=(Mn,Vn)=>k_(Mn.charAt(Vn)),h9=Mn=>{const Vn=Mn.container();return Ir(Vn)&&oc(Vn.data,hc)},m9=Mn=>{const Vn=Mn.split("");return Us(Vn,(Wn,jn)=>ok(Wn)&&jn>0&&jn<Vn.length-1&&uy(Vn[jn-1])&&uy(Vn[jn+1])?" ":Wn).join("")},x5=(Mn,Vn,Wn,jn)=>{const Gn=Vn.data,no=lr(Vn,0);return!Wn&&hp(Gn,0)&&!wA(Mn,no,jn)?(Vn.data=" "+Gn.slice(1),!0):Wn&&k5(Gn,0)&&Ck(Mn,no,jn)?(Vn.data=hc+Gn.slice(1),!0):!1},p9=Mn=>{const Vn=Mn.data,Wn=m9(Vn);return Wn!==Vn?(Mn.data=Wn,!0):!1},B_=(Mn,Vn,Wn,jn)=>{const Gn=Vn.data,no=lr(Vn,Gn.length-1);return!Wn&&hp(Gn,Gn.length-1)&&!wA(Mn,no,jn)?(Vn.data=Gn.slice(0,-1)+" ",!0):Wn&&k5(Gn,Gn.length-1)&&kk(Mn,no,jn)?(Vn.data=Gn.slice(0,-1)+hc,!0):!1},g9=(Mn,Vn,Wn)=>{const jn=Vn.container();if(!Ir(jn))return zo.none();if(h9(Vn)){const Gn=x5(Mn,jn,!1,Wn)||p9(jn)||B_(Mn,jn,!1,Wn);return El(Gn,Vn)}else if(wA(Mn,Vn,Wn)){const Gn=x5(Mn,jn,!0,Wn)||B_(Mn,jn,
Line truncated
|
||||
`+_h),du&&(_h=r0(_h,wa," "),_h=r0(_h,Va," "),_h=r0(_h,Tl," ")),Hs&&Sl?Hs.createHTML(_h):_h},Vn.setConfig=function(ec){ST(ec),h0=!0},Vn.clearConfig=function(){cS=null,h0=!1},Vn.isValidAttribute=function(ec,hr,Da){cS||ST({});const sl=xm(ec),af=xm(hr);return kN(sl,af,Da)},Vn.addHook=function(ec,hr){typeof hr=="function"&&(Ar[ec]=Ar[ec]||[],Sy(Ar[ec],hr))},Vn.removeHook=function(ec){if(Ar[ec])return Hk(Ar[ec])},Vn.removeHooks=function(ec){Ar[ec]&&(Ar[ec]=[])},Vn.removeAllHooks=function(){Ar={}},Vn}var oI=OE();const sI=Lr.each,Q_=Lr.trim,bD=["source","protocol","authority","userInfo","user","password","host","port","relative","path","directory","file","query","anchor"],rI={ftp:21,http:80,https:443,mailto:25},_E=["img","video"],iI=(Mn,Vn)=>is(Mn)?!Mn:is(Vn)?!Zs(_E,Vn):!0,vD=Mn=>{try{return decodeURIComponent(Mn)}catch{return unescape(Mn)}},yD=(Mn,Vn,Wn)=>{const jn=vD(Vn).replace(/\s/g,"");return Mn.allow_script_urls?!1:/((java|vb)script|mhtml):/i.test(jn)?!0:Mn.allow_html_data_urls?!1:/^data:image\//i.test(jn)?iI(Mn.allow_svg_data_urls,Wn)&&/^data:image\/svg\+xml/i.test(jn):/^data:/i.test(jn)};class bb{static parseDataUri(Vn){let Wn;const jn=decodeURIComponent(Vn).split(","),Gn=/data:([^;]+)/.exec(jn[0]);return Gn&&(Wn=Gn[1]),{type:Wn,data:jn[1]}}static isDomSafe(Vn,Wn,jn={}){if(jn.allow_script_urls)return!0;{const Gn=P0.decode(Vn).replace(/[\s\u0000-\u001F]+/g,"");return!yD(jn,Gn,Wn)}}static getDocumentBaseUrl(Vn){var Wn;let jn;return Vn.protocol.indexOf("http")!==0&&Vn.protocol!=="file:"?jn=(Wn=Vn.href)!==null&&Wn!==void 0?Wn:"":jn=Vn.protocol+"//"+Vn.host+Vn.pathname,/^[^:]+:\/\/\/?[^\/]+\//.test(jn)&&(jn=jn.replace(/[\?#].*$/,"").replace(/[\/\\][^\/]+$/,""),/[\/\\]$/.test(jn)||(jn+="/")),jn}constructor(Vn,Wn={}){this.path="",this.directory="",Vn=Q_(Vn),this.settings=Wn;const jn=Wn.base_uri,Gn=this;if(/^([\w\-]+):([^\/]{2})/i.test(Vn)||/^\s*#/.test(Vn)){Gn.source=Vn;return}const no=Vn.indexOf("//")===0;if(Vn.indexOf("/")===0&&!no&&(Vn=(jn&&jn.protocol||"http")+"://mce_host"+Vn),!/^[\w\-]*:?\/\//.test(Vn)){const po=jn?jn.path:new bb(document.location.href).directory;if((jn==null?void 0:jn.protocol)==="")Vn="//mce_host"+Gn.toAbsPath(po,Vn);else{const vo=/([^#?]*)([#?]?.*)/.exec(Vn);vo&&(Vn=(jn&&jn.protocol||"http")+"://mce_host"+Gn.toAbsPath(po,vo[1])+vo[2])}}Vn=Vn.replace(/@@/g,"(mce_at)");const ao=/^(?:(?![^:@]+:[^:@\/]*@)([^:\/?#.]+):)?(?:\/\/)?((?:(([^:@\/]*):?([^:@\/]*))?@)?(\[[a-zA-Z0-9:.%]+\]|[^:\/?#]*)(?::(\d*))?)(((\/(?:[^?#](?![^?#\/]*\.[^?#\/.]+(?:[?#]|$)))*\/?)?([^?#\/]*))(?:\?([^#]*))?(?:#(.*))?)/.exec(Vn);ao&&sI(bD,(po,vo)=>{let Ao=ao[vo];Ao&&(Ao=Ao.replace(/\(mce_at\)/g,"@@")),Gn[po]=Ao}),jn&&(Gn.protocol||(Gn.protocol=jn.protocol),Gn.userInfo||(Gn.userInfo=jn.userInfo),!Gn.port&&Gn.host==="mce_host"&&(Gn.port=jn.port),(!Gn.host||Gn.host==="mce_host")&&(Gn.host=jn.host),Gn.source=""),no&&(Gn.protocol="")}setPath(Vn){const Wn=/^(.*?)\/?(\w+)?$/.exec(Vn);Wn&&(this.path=Wn[0],this.directory=Wn[1],this.file=Wn[2]),this.source="",this.getURI()}toRelative(Vn){if(Vn==="./")return Vn;const Wn=new bb(Vn,{base_uri:this});if(Wn.host!=="mce_host"&&this.host!==Wn.host&&Wn.host||this.port!==Wn.port||this.protocol!==Wn.protocol&&Wn.protocol!=="")return Wn.getURI();const jn=this.getURI(),Gn=Wn.getURI();if(jn===Gn||jn.charAt(jn.length-1)==="/"&&jn.substr(0,jn.length-1)===Gn)return jn;let no=this.toRelPath(this.path,Wn.path);return Wn.query&&(no+="?"+Wn.query),Wn.anchor&&(no+="#"+Wn.anchor),no}toAbsolute(Vn,Wn){const jn=new bb(Vn,{base_uri:this});return jn.getURI(Wn&&this.isSameOrigin(jn))}isSameOrigin(Vn){if(this.host==Vn.host&&this.protocol==Vn.protocol){if(this.port==Vn.port)return!0;const Wn=this.protocol?rI[this.protocol]:null;if(Wn&&(this.port||Wn)==(Vn.port||Wn))return!0}return!1}toRelPath(Vn,Wn){let jn=0,Gn="",no,ao;const po=Vn.substring(0,Vn.lastIndexOf("/")).split("/"),vo=Wn.split("/");if(po.length>=vo.length){for(no=0,ao=po.length;no<ao;no++)if(no>=vo.length||po[no]!==vo[no]){jn=no+1;break}}if(po.length<vo.length){for(no=0,ao=vo.length;no<ao;no++)if(no>=po.length||po[no]!==vo[no]){jn=no+1;break}}if(jn===1)return Wn;for(no=0,ao=po.length-(jn-1);no<ao;no++)Gn+="../";for(no=jn-1,ao=vo.length;no<ao;no++)no!==jn-1?Gn+="/"+vo[no]:Gn+=vo[no];return Gn}toAbsPath(Vn,Wn){let jn=0;const Gn=/\/$/.test(Wn)?"/":"",no=Vn.split("/"),ao=Wn.split("/"),po=[];sI(no,Qo=>{Qo&&po.push(Qo)});const vo=[];for(let Qo=ao.length-1;Qo>=0;Qo--)if(!(ao[Qo].length===0||ao[Qo]===".")){if(ao[Qo]===".."){jn++;continue}if(jn>0){jn--;continue}vo.push(ao[Qo])}const Ao=po.length-jn;let Fo;return Ao<=0?Fo=nc(vo).join("/"):Fo=po.slice(0,Ao).join("/")+"/"+nc(vo).join("/"),Fo.indexOf("/")!==0&&(Fo="/"+Fo),Gn&&Fo.lastIndexOf("/")!==Fo.length-1&&(Fo+=Gn),Fo}getURI(Vn=!1){let Wn;return(!this.source||Vn)&&(Wn="",Vn||(this.protocol?Wn+=this.protocol+"://":Wn+="//",this.userInfo&&(Wn+=this.userInfo+"@"),this.host&&(Wn+=this.host),this.port&&(Wn+=":"+this.port)),this.path&&(Wn+=this.path),this.query&&(Wn+="?"+this.query),this.anchor&&(Wn+="#"+this.ancho
Line truncated
|
||||
`).replace(/^[\r\n]*|[\r\n]*$/g,"").replace(/^\s*((<!--)?(\s*\/\/)?\s*<!\[CDATA\[|(<!--\s*)?\/\*\s*<!\[CDATA\[\s*\*\/|(\/\/)?\s*<!--|\/\*\s*<!--\s*\*\/)\s*[\r\n]*/gi,"").replace(/\s*(\/\*\s*\]\]>\s*\*\/(-->)?|\s*\/\/\s*\]\]>(-->)?|\/\/\s*(-->)?|\]\]>|\/\*\s*-->\s*\*\/|\s*-->\s*)\s*$/g,"");let po=jn.length;for(;po--;){const vo=jn[po],Ao=vo.firstChild,Fo=(no=Ao==null?void 0:Ao.value)!==null&&no!==void 0?no:"";if(Gn==="script"){const Qo=vo.attr("type");Qo&&vo.attr("type",Qo==="mce-no/type"?null:Qo.replace(/^mce\-/,"")),Vn.element_format==="xhtml"&&Ao&&Fo.length>0&&(Ao.value=`// <![CDATA[
|
||||
`+ao(Fo)+`
|
||||
// ]]>`)}else Vn.element_format==="xhtml"&&Ao&&Fo.length>0&&(Ao.value=`<!--
|
||||
`+ao(Fo)+`
|
||||
-->`)}}),Mn.addNodeFilter("#comment",jn=>{let Gn=jn.length;for(;Gn--;){const no=jn[Gn],ao=no.value;Vn.preserve_cdata&&(ao==null?void 0:ao.indexOf("[CDATA["))===0?(no.name="#cdata",no.type=4,no.value=Wn.decode(ao.replace(/^\[CDATA\[|\]\]$/g,""))):(ao==null?void 0:ao.indexOf("mce:protected "))===0&&(no.name="#text",no.type=3,no.raw=!0,no.value=unescape(ao).substr(14))}}),Mn.addNodeFilter("xml:namespace,input",(jn,Gn)=>{let no=jn.length;for(;no--;){const ao=jn[no];ao.type===7?ao.remove():ao.type===1&&Gn==="input"&&!ao.attr("type")&&ao.attr("type","text")}}),Mn.addAttributeFilter("data-mce-type",jn=>{fs(jn,Gn=>{Gn.attr("data-mce-type")==="format-caret"&&(Gn.isEmpty(Mn.schema.getNonEmptyElements())?Gn.remove():Gn.unwrap())})}),Mn.addAttributeFilter("data-mce-src,data-mce-href,data-mce-style,data-mce-selected,data-mce-expando,data-mce-block,data-mce-type,data-mce-resize,data-mce-placeholder",(jn,Gn)=>{let no=jn.length;for(;no--;)jn[no].attr(Gn,null)}),Vn.remove_trailing_brs&&lD(Vn,Mn,Mn.schema)},xE=Mn=>{const Vn=jn=>(jn==null?void 0:jn.name)==="br",Wn=Mn.lastChild;if(Vn(Wn)){const jn=Wn.prev;Vn(jn)&&(Wn.remove(),jn.remove())}},FI=(Mn,Vn,Wn)=>{let jn;const Gn=Mn.dom;let no=Vn.cloneNode(!0);const ao=document.implementation;if(ao.createHTMLDocument){const po=ao.createHTMLDocument("");Lr.each(no.nodeName==="BODY"?no.childNodes:[no],vo=>{po.body.appendChild(po.importNode(vo,!0))}),no.nodeName!=="BODY"?no=po.body.firstChild:no=po.body,jn=Gn.doc,Gn.doc=po}return Nx(Mn,{...Wn,node:no}),jn&&(Gn.doc=jn),no},HI=(Mn,Vn)=>is(Mn)&&Mn.hasEventListeners("PreProcess")&&!Vn.no_events,NV=(Mn,Vn,Wn)=>HI(Mn,Wn)?FI(Mn,Vn,Wn):Vn,QI=(Mn,Vn,Wn)=>{Lr.inArray(Vn,Wn)===-1&&(Mn.addAttributeFilter(Wn,(jn,Gn)=>{let no=jn.length;for(;no--;)jn[no].attr(Gn,null)}),Vn.push(Wn))},LV=(Mn,Vn,Wn)=>!Vn.no_events&&Mn?E3(Mn,{...Vn,content:Wn}).content:Wn,IV=(Mn,Vn,Wn)=>{const jn=Xo(Wn.getInner?Vn.innerHTML:Mn.getOuterHTML(Vn));return Wn.selection||Xd(Cs.fromDom(Vn))?jn:Lr.trim(jn)},BV=(Mn,Vn,Wn)=>{const jn=Wn.selection?{forced_root_block:!1,...Wn}:Wn,Gn=Mn.parse(Vn,jn);return xE(Gn),Gn},FV=(Mn,Vn,Wn)=>I_(Mn,Vn).serialize(Wn),VI=(Mn,Vn,Wn,jn,Gn)=>{const no=FV(Vn,Wn,jn);return LV(Mn,Gn,no)},HV=(Mn,Vn)=>{const Wn=["data-mce-selected"],jn={entity_encoding:"named",remove_trailing_brs:!0,pad_empty_with_br:!1,...Mn},Gn=Vn&&Vn.dom?Vn.dom:Eu.DOM,no=Vn&&Vn.schema?Vn.schema:i1(jn),ao=a0(jn,no);Wk(ao,jn,Gn);const po=(vo,Ao={})=>{const Fo={format:"html",...Ao},Qo=NV(Vn,vo,Fo),qo=IV(Gn,Qo,Fo),ds=BV(ao,qo,Fo);return Fo.format==="tree"?ds:VI(Vn,jn,no,ds,Fo)};return{schema:no,addNodeFilter:ao.addNodeFilter,addAttributeFilter:ao.addAttributeFilter,serialize:po,addRules:no.addValidElements,setRules:no.setValidElements,addTempAttr:ws(QI,ao,Wn),getTempAttrs:xs(Wn),getNodeFilters:ao.getNodeFilters,getAttributeFilters:ao.getAttributeFilters,removeNodeFilter:ao.removeNodeFilter,removeAttributeFilter:ao.removeAttributeFilter}},zI=(Mn,Vn)=>{const Wn=HV(Mn,Vn);return{schema:Wn.schema,addNodeFilter:Wn.addNodeFilter,addAttributeFilter:Wn.addAttributeFilter,serialize:Wn.serialize,addRules:Wn.addRules,setRules:Wn.setRules,addTempAttr:Wn.addTempAttr,getTempAttrs:Wn.getTempAttrs,getNodeFilters:Wn.getNodeFilters,getAttributeFilters:Wn.getAttributeFilters,removeNodeFilter:Wn.removeNodeFilter,removeAttributeFilter:Wn.removeAttributeFilter}},EE="html",WI=(Mn,Vn)=>({...Mn,format:Vn,get:!0,getInner:!0}),UI=(Mn,Vn={})=>{const Wn=Vn.format?Vn.format:EE,jn=WI(Vn,Wn);return V_(Mn,jn).fold(Qr,Gn=>{const no=_V(Mn,Gn);return SD(Mn,no,Gn)})},QV="html",VV=(Mn,Vn)=>({format:QV,...Mn,set:!0,content:Vn}),ZD=(Mn,Vn,Wn={})=>{const jn=VV(Wn,Vn);return wD(Mn,jn).map(Gn=>{const no=SV(Mn,Gn.content,Gn);return iP(Mn,no.html,Gn),no.content}).getOr(Vn)},ZI="autoresize_on_init,content_editable_state,padd_empty_with_br,block_elements,boolean_attributes,editor_deselector,editor_selector,elements,file_browser_callback_types,filepicker_validator_handler,force_hex_style_colors,force_p_newlines,gecko_spellcheck,images_dataimg_filter,media_scripts,mode,move_caret_before_on_enter_elements,non_empty_elements,self_closing_elements,short_ended_elements,special,spellchecker_select_languages,spellchecker_whitelist,tab_focus,tabfocus_elements,table_responsive_width,text_block_elements,text_inline_elements,toolbar_drawer,types,validate,whitespace_elements,paste_enable_default_filters,paste_filter_drop,paste_word_valid_elements,paste_retain_style_properties,paste_convert_word_fake_lists".split(","),zV="template_cdate_classes,template_mdate_classes,template_selected_content_classes,template_preview_replace_values,template_replace_values,templates,template_cdate_format,template_mdate_format".split(","),WV="bbcode,colorpicker,contextmenu,fullpage,legacyoutput,spellchecker,textcolor".split(","),qI=[{name:"template",replacedWith:"Advanced Template"},{name:"rtc"}],jI=(Mn,Vn)=>{const Wn=nr(Vn,jn=>Mr(Mn,jn));return Vl(Wn)},JY=Mn=>{const Vn=jI(Mn,ZI),Wn=Mn.forced_root_block;return(Wn===!1||Wn==="")&&Vn.push("forced_root_block (false only
Line truncated
|
||||
- `,vo=ao?`
|
||||
|
||||
Themes:${po}mobile`:"",Ao=Gn?`
|
||||
|
||||
Plugins:${po}${jn.join(po)}`:"",Fo=no?`
|
||||
|
||||
Options:${po}${Wn.join(po)}`:"";console.warn("The following deprecated features are currently enabled and have been removed in TinyMCE 6.0. These features will no longer work and should be removed from the TinyMCE configuration. See https://www.tiny.cloud/docs/tinymce/6/migration-from-5x/ for more information."+vo+Ao+Fo)}},jV=Mn=>xa(qI,Vn=>Vn.name===Mn).fold(()=>Mn,Vn=>Vn.replacedWith?`${Mn}, replaced by ${Vn.replacedWith}`:Mn),su=(Mn,Vn)=>{const Wn=rv(Mn),jn=ZV(Vn),Gn=jn.length>0,no=Wn.length>0;if(Gn||no){const ao=`
|
||||
- `,po=Gn?`
|
||||
|
||||
Plugins:${ao}${jn.map(jV).join(ao)}`:"",vo=no?`
|
||||
|
||||
Options:${ao}${Wn.join(ao)}`:"";console.warn("The following deprecated features are currently enabled but will be removed soon."+po+vo)}},eG=(Mn,Vn)=>{qV(Mn,Vn),su(Mn,Vn)},vP=Eu.DOM,XV=Mn=>{vP.setStyle(Mn.id,"display",Mn.orgDisplay)},sd=Mn=>zo.from(Mn).each(Vn=>Vn.destroy()),YV=Mn=>{const Vn=Mn;Vn.contentAreaContainer=Vn.formElement=Vn.container=Vn.editorContainer=null,Vn.bodyElement=Vn.contentDocument=Vn.contentWindow=null,Vn.iframeElement=Vn.targetElm=null;const Wn=Mn.selection;if(Wn){const jn=Wn.dom;Vn.selection=Wn.win=Wn.dom=jn.doc=null}},TE=Mn=>{const Vn=Mn.formElement;Vn&&(Vn._mceOldSubmit&&(Vn.submit=Vn._mceOldSubmit,delete Vn._mceOldSubmit),vP.unbind(Vn,"submit reset",Mn.formEventDelegate))},GV=Mn=>{if(!Mn.removed){const{_selectionOverrides:Vn,editorUpload:Wn}=Mn,jn=Mn.getBody(),Gn=Mn.getElement();jn&&Mn.save({is_removing:!0}),Mn.removed=!0,Mn.unbindAllNativeEvents(),Mn.hasHiddenInput&&is(Gn==null?void 0:Gn.nextSibling)&&vP.remove(Gn.nextSibling),P_(Mn),Mn.editorManager.remove(Mn),!Mn.inline&&jn&&XV(Mn),$_(Mn),vP.remove(Mn.getContainer()),sd(Vn),sd(Wn),Mn.destroy()}},KV=(Mn,Vn)=>{const{selection:Wn,dom:jn}=Mn;if(!Mn.destroyed){if(!Vn&&!Mn.removed){Mn.remove();return}Vn||(Mn.editorManager.off("beforeunload",Mn._beforeUnload),Mn.theme&&Mn.theme.destroy&&Mn.theme.destroy(),sd(Wn),sd(jn)),TE(Mn),YV(Mn),Mn.destroyed=!0}},AE=(()=>{const Mn={};return{add:(Gn,no)=>{Mn[Gn]=no},get:Gn=>Mn[Gn]?Mn[Gn]:{icons:{}},has:Gn=>Mr(Mn,Gn)}})(),yb=$h.ModelManager,vg=(Mn,Vn)=>Vn.dom[Mn],Uk=(Mn,Vn)=>parseInt(Ju(Vn,Mn),10),U_=ws(vg,"clientWidth"),Cy=ws(vg,"clientHeight"),PE=ws(Uk,"margin-top"),qD=ws(Uk,"margin-left"),jD=Mn=>Mn.dom.getBoundingClientRect(),XI=(Mn,Vn,Wn)=>{const jn=U_(Mn),Gn=Cy(Mn);return Vn>=0&&Wn>=0&&Vn<=jn&&Wn<=Gn},YI=(Mn,Vn,Wn,jn)=>{const Gn=jD(Vn),no=Mn?Gn.left+Vn.dom.clientLeft+qD(Vn):0,ao=Mn?Gn.top+Vn.dom.clientTop+PE(Vn):0,po=Wn-no,vo=jn-ao;return{x:po,y:vo}},JV=(Mn,Vn,Wn)=>{const jn=Cs.fromDom(Mn.getBody()),Gn=Mn.inline?jn:zl(jn),no=YI(Mn.inline,Gn,Vn,Wn);return XI(Gn,no.x,no.y)},ez=Mn=>zo.from(Mn).map(Cs.fromDom),GI=Mn=>{const Vn=Mn.inline?Mn.getBody():Mn.getContentAreaContainer();return ez(Vn).map(Ag).getOr(!1)};var KI=()=>{const Mn=()=>{throw new Error("Theme did not provide a NotificationManager implementation.")};return{open:Mn,close:Mn,getArgs:Mn}};const XD=Mn=>{const Vn=[],Wn=()=>{const qo=Mn.theme;return qo&&qo.getNotificationManagerImpl?qo.getNotificationManagerImpl():KI()},jn=()=>zo.from(Vn[0]),Gn=(qo,ds)=>qo.type===ds.type&&qo.text===ds.text&&!qo.progressBar&&!qo.timeout&&!ds.progressBar&&!ds.timeout,no=()=>{fs(Vn,qo=>{qo.reposition()})},ao=qo=>{Vn.push(qo)},po=qo=>{Nl(Vn,ds=>ds===qo).each(ds=>{Vn.splice(ds,1)})},vo=(qo,ds=!0)=>Mn.removed||!GI(Mn)?{}:(ds&&Mn.dispatch("BeforeOpenNotification",{notification:qo}),xa(Vn,bs=>Gn(Wn().getArgs(bs),qo)).getOrThunk(()=>{Mn.editorManager.setActive(Mn);const bs=Wn().open(qo,()=>{po(bs),no(),UN(Mn)&&jn().fold(()=>Mn.focus(),ls=>lA(Cs.fromDom(ls.getEl())))});return ao(bs),no(),Mn.dispatch("OpenNotification",{notification:{...bs}}),bs})),Ao=()=>{jn().each(qo=>{Wn().close(qo),po(qo),no()})},Fo=xs(Vn);return(qo=>{qo.on("SkinLoaded",()=>{const ds=K2(qo);ds&&vo({text:ds,type:"warning",timeout:0},!1),no()}),qo.on("show ResizeEditor ResizeWindow NodeChange",()=>{requestAnimationFrame(no)}),qo.on("remove",()=>{fs(Vn.slice(),ds=>{Wn().close(ds)})})})(Mn),{open:vo,close:Ao,getNotifications:Fo}},Hw=$h.PluginManager,CO=$h.ThemeManager;var nG=()=>{const Mn=()=>{throw new Error("Theme did not provide a WindowManager implementation.")};return{open:Mn,openUrl:Mn,alert:Mn,confirm:Mn,close:Mn}};const JI=Mn=>{let Vn=[];const Wn=()=>{const ls=Mn.theme;return ls&&ls.getWindowManagerImpl?ls.getWindowManagerImpl():nG()},jn=(ls,ys)=>(...Ls)=>ys?ys.apply(ls,Ls):void 0,Gn=ls=>{Mn.dispatch("OpenWindow",{dialog:ls})},no=ls=>{Mn.dispatch("CloseWindow",{dialog:ls})},ao=ls=>{Vn.push(ls),Gn(ls)},po=ls=>{no(ls),Vn=nr(Vn,ys=>ys!==ls),Vn.length===0&&Mn.focus()},vo=()=>zo.from(Vn[Vn.length-1]),Ao=ls=>{Mn.editorManager.setActive(Mn),Sk(Mn),Mn.ui.show();const ys=ls();return ao(ys),ys},Fo=(ls,ys)=>Ao(()=>Wn().open(ls,ys,po)),Qo=ls=>Ao(()=>Wn().openUrl(ls,po)),qo=(ls,ys,Ls)=>{const zs=Wn();zs.alert(ls,jn(Ls||zs,ys))},ds=(ls,ys,Ls)=>{const zs=Wn();zs.confirm(ls,jn(Ls||zs,ys))},bs=()=>{vo().each(ls=>{Wn().close(ls),po(ls)})};return Mn.on("remove",()=>{fs(Vn,ls=>{Wn().close(ls)})}),{open:Fo,openUrl:Qo,alert:qo,confirm:ds,close:bs}},tz=(Mn,Vn)=>{Mn.notificationManager.open({type:"error",text:Vn})},yP=(Mn,Vn)=>{Mn._skinLoaded?tz(Mn,Vn):Mn.on("SkinLoaded",()=>{tz(Mn,Vn)})},nz=(Mn,Vn)=>{yP(Mn,cg.translate(["Failed to upload image: {0}",Vn]))},C1=(Mn,Vn,Wn)=>{Mp(Mn,Vn,{message:Wn}),console.error(Wn)},OP=(Mn,Vn,Wn)=>Wn?`Failed to load ${Mn}: ${Wn} from url ${Vn}`:`Failed to load ${Mn} url: ${Vn}`,oG=(Mn,Vn,Wn)=>{C1(Mn,"PluginLoadError",OP("plugin",Vn,Wn))},oz=(Mn,Vn,Wn)=>{C1(Mn,"IconsLoadError",OP("icons",Vn,Wn))},$E=(Mn,Vn,Wn)=>{C1(Mn,"LanguageLoadError",OP("language",Vn,Wn))},sz=(Mn,Vn,Wn)=>{C1(Mn,"
Line truncated
|
||||
\r \v`.indexOf(Mn)!==-1,Zw=(Mn,Vn)=>Mn.substring(Vn.length),GE=(Mn,Vn,Wn)=>{let jn;const Gn=Wn.charAt(0);for(jn=Vn-1;jn>=0;jn--){const no=Mn.charAt(jn);if(YE(no))return zo.none();if(Gn===no&&oc(Mn,Wn,jn,Vn))break}return zo.some(jn)},f0=(Mn,Vn,Wn,jn=0)=>{if(!FF(Vn))return zo.none();const Gn={text:"",offset:0},no=(po,vo,Ao)=>(Gn.text=Ao+Gn.text,Gn.offset+=vo,GE(Gn.text,Gn.offset,Wn).getOr(vo)),ao=Mn.getParent(Vn.startContainer,Mn.isBlock)||Mn.getRoot();return jE(Mn,Vn.startContainer,Vn.startOffset,no,ao).bind(po=>{const vo=Vn.cloneRange();if(vo.setStart(po.container,po.offset),vo.setEnd(Vn.endContainer,Vn.endOffset),vo.collapsed)return zo.none();const Ao=XE(vo);return Ao.lastIndexOf(Wn)!==0||Zw(Ao,Wn).length<jn?zo.none():zo.some({text:Zw(Ao,Wn),range:vo,trigger:Wn})})},s2=(Mn,Vn,Wn,jn=0)=>HH(Cs.fromDom(Vn.startContainer)).fold(()=>f0(Mn,Vn,Wn,jn),Gn=>{const no=Mn.createRng();no.selectNode(Gn.dom);const ao=XE(no);return zo.some({range:no,text:Zw(ao,Wn),trigger:Wn})}),HF=Mn=>Mn.nodeType===A1,QF=Mn=>Mn.nodeType===Hh,VF=Mn=>{if(HF(Mn))return d0(Mn,Mn.data.length);{const Vn=Mn.childNodes;return Vn.length>0?VF(Vn[Vn.length-1]):d0(Mn,Vn.length)}},GM=(Mn,Vn)=>{const Wn=Mn.childNodes;return Wn.length>0&&Vn<Wn.length?GM(Wn[Vn],0):Wn.length>0&&QF(Mn)&&Wn.length===Vn?VF(Wn[Wn.length-1]):d0(Mn,Vn)},SU=(Mn,Vn)=>{var Wn;const jn=(Wn=Mn.getParent(Vn.container,Mn.isBlock))!==null&&Wn!==void 0?Wn:Mn.getRoot();return jE(Mn,Vn.container,Vn.offset,(Gn,no)=>no===0?-1:no,jn).filter(Gn=>{const no=Gn.container.data.charAt(Gn.offset-1);return!YE(no)}).isSome()},wU=Mn=>Vn=>{const Wn=GM(Vn.startContainer,Vn.startOffset);return!SU(Mn,Wn)},KE=(Mn,Vn,Wn)=>Yl(Wn.triggers,jn=>s2(Mn,Vn,jn)),CU=(Mn,Vn)=>{const Wn=Vn(),jn=Mn.selection.getRng();return KE(Mn.dom,jn,Wn).bind(Gn=>zF(Mn,Vn,Gn))},zF=(Mn,Vn,Wn,jn={})=>{var Gn;const no=Vn(),po=(Gn=Mn.selection.getRng().startContainer.nodeValue)!==null&&Gn!==void 0?Gn:"",vo=nr(no.lookupByTrigger(Wn.trigger),Fo=>Wn.text.length>=Fo.minChars&&Fo.matches.getOrThunk(()=>wU(Mn.dom))(Wn.range,po,Wn.text));if(vo.length===0)return zo.none();const Ao=Promise.all(Us(vo,Fo=>Fo.fetch(Wn.text,Fo.maxResults,jn).then(qo=>({matchText:Wn.text,items:qo,columns:Fo.columns,onAction:Fo.onAction,highlightOn:Fo.highlightOn}))));return zo.some({lookupData:Ao,context:Wn})};var lv;(function(Mn){Mn[Mn.Error=0]="Error",Mn[Mn.Value=1]="Value"})(lv||(lv={}));const KM=(Mn,Vn,Wn)=>Mn.stype===lv.Error?Vn(Mn.serror):Wn(Mn.svalue),kU=Mn=>{const Vn=[],Wn=[];return fs(Mn,jn=>{KM(jn,Gn=>Wn.push(Gn),Gn=>Vn.push(Gn))}),{values:Vn,errors:Wn}},xU=(Mn,Vn)=>Mn.stype===lv.Error?{stype:lv.Error,serror:Vn(Mn.serror)}:Mn,EU=(Mn,Vn)=>Mn.stype===lv.Value?{stype:lv.Value,svalue:Vn(Mn.svalue)}:Mn,TU=(Mn,Vn)=>Mn.stype===lv.Value?Vn(Mn.svalue):Mn,AU=(Mn,Vn)=>Mn.stype===lv.Error?Vn(Mn.serror):Mn,WF=Mn=>({stype:lv.Value,svalue:Mn}),UF=Mn=>({stype:lv.Error,serror:Mn}),km={fromResult:Mn=>Mn.fold(UF,WF),toResult:Mn=>KM(Mn,ym.error,ym.value),svalue:WF,partition:kU,serror:UF,bind:TU,bindError:AU,map:EU,mapError:xU,fold:KM},KP=Mn=>Io(Mn)&&Al(Mn).length>100?" removed due to size":JSON.stringify(Mn,null,2),ZF=Mn=>{const Vn=Mn.length>10?Mn.slice(0,10).concat([{path:[],getErrorInfo:xs("... (only showing first ten failures)")}]):Mn;return Us(Vn,Wn=>"Failed path: ("+Wn.path.join(" > ")+`)
|
||||
`+Wn.getErrorInfo())},JE=(Mn,Vn)=>km.serror([{path:Mn,getErrorInfo:Vn}]),PU=(Mn,Vn,Wn)=>JE(Mn,()=>'Could not find valid *required* value for "'+Vn+'" in '+KP(Wn)),$U=(Mn,Vn)=>JE(Mn,()=>'Choice schema did not contain choice key: "'+Vn+'"'),RU=(Mn,Vn,Wn)=>JE(Mn,()=>'The chosen schema: "'+Wn+'" did not exist in branches: '+KP(Vn)),DU=(Mn,Vn)=>JE(Mn,xs(Vn)),qF=(Mn,Vn,Wn,jn)=>Ma(Wn,jn).fold(()=>RU(Mn,Wn,jn),no=>no.extract(Mn.concat(["branch: "+jn]),Vn)),MU=(Mn,Vn)=>({extract:(Gn,no)=>Ma(no,Mn).fold(()=>$U(Gn,Mn),po=>qF(Gn,no,Vn,po)),toString:()=>"chooseOn("+Mn+"). Possible values: "+Al(Vn)}),jF=(Mn,Vn)=>Vn,NU=(Mn,Vn)=>Vo(Mn)&&Vo(Vn)?eT(Mn,Vn):Vn,JM=Mn=>(...Vn)=>{if(Vn.length===0)throw new Error("Can't merge zero objects");const Wn={};for(let jn=0;jn<Vn.length;jn++){const Gn=Vn[jn];for(const no in Gn)Mr(Gn,no)&&(Wn[no]=Mn(Wn[no],Gn[no]))}return Wn},eT=JM(NU),LU=JM(jF),XF=()=>({tag:"required",process:{}}),IU=Mn=>({tag:"defaultedThunk",process:Mn}),e4=Mn=>IU(xs(Mn)),BU=()=>({tag:"option",process:{}}),FU=(Mn,Vn)=>Mn.length>0?km.svalue(eT(Vn,LU.apply(void 0,Mn))):km.svalue(Vn),t4=Mn=>ko(km.serror,Zc)(Mn),YF={consolidateObj:(Mn,Vn)=>{const Wn=km.partition(Mn);return Wn.errors.length>0?t4(Wn.errors):FU(Wn.values,Vn)},consolidateArr:Mn=>{const Vn=km.partition(Mn);return Vn.errors.length>0?t4(Vn.errors):km.svalue(Vn.values)}},HU=(Mn,Vn,Wn,jn)=>({tag:"field",key:Mn,newKey:Vn,presence:Wn,prop:jn}),QU=(Mn,Vn)=>({tag:"custom",newKey:Mn,instantiator:Vn}),GF=(Mn,Vn,Wn)=>{switch(Mn.tag){case"field":return Vn(Mn.key,Mn.newKey,Mn.presence,Mn.prop);case"custom":return Wn(Mn.newKey,Mn.instantiator)}},JP=Mn=>{const Vn=(jn,Gn)=>km.bindError(Mn(Gn),no=>DU(jn,no)),Wn=xs("val");return{extract:Vn,toString:Wn}},KF=JP(km.svalue),VU=(Mn,Vn,Wn,jn)=>Ma(Vn,Wn).fold(()=>PU(Mn,Wn,Vn),jn),JF=(Mn,Vn,Wn,jn)=>{const Gn=Ma(Mn,Vn).getOrThunk(()=>Wn(Mn));return jn(Gn)},zU=(Mn,Vn,Wn)=>Wn(Ma(Mn,Vn)),WU=(Mn,Vn,Wn,jn)=>{const Gn=Ma(Mn,Vn).map(no=>no===!0?Wn(Mn):no);return jn(Gn)},UU=(Mn,Vn,Wn,jn,Gn)=>{const no=po=>Gn.extract(Vn.concat([jn]),po),ao=po=>po.fold(()=>km.svalue(zo.none()),vo=>{const Ao=Gn.extract(Vn.concat([jn]),vo);return km.map(Ao,zo.some)});switch(Mn.tag){case"required":return VU(Vn,Wn,jn,no);case"defaultedThunk":return JF(Wn,jn,Mn.process,no);case"option":return zU(Wn,jn,ao);case"defaultedOptionThunk":return WU(Wn,jn,Mn.process,ao);case"mergeWithThunk":return JF(Wn,jn,xs({}),po=>{const vo=eT(Mn.process(Wn),po);return no(vo)})}},ZU=(Mn,Vn,Wn)=>{const jn={},Gn=[];for(const no of Wn)GF(no,(ao,po,vo,Ao)=>{const Fo=UU(vo,Mn,Vn,ao,Ao);km.fold(Fo,Qo=>{Gn.push(...Qo)},Qo=>{jn[po]=Qo})},(ao,po)=>{jn[ao]=po(Vn)});return Gn.length>0?km.serror(Gn):km.svalue(jn)},n4=Mn=>({extract:(jn,Gn)=>ZU(jn,Gn,Mn),toString:()=>`obj{
|
||||
`+Us(Mn,Gn=>GF(Gn,(no,ao,po,vo)=>no+" -> "+vo.toString(),(no,ao)=>"state("+no+")")).join(`
|
||||
`)+"}"}),e6=Mn=>({extract:(jn,Gn)=>{const no=Us(Gn,(ao,po)=>Mn.extract(jn.concat(["["+po+"]"]),ao));return YF.consolidateArr(no)},toString:()=>"array("+Mn.toString()+")"}),bG=Mn=>JP(Vn=>Mn(Vn).fold(km.serror,km.svalue)),qU=(Mn,Vn,Wn)=>{const jn=Vn.extract([Mn],Wn);return km.mapError(jn,Gn=>({input:Wn,errors:Gn}))},e$=(Mn,Vn,Wn)=>km.toResult(qU(Mn,Vn,Wn)),t6=Mn=>`Errors:
|
||||
`+ZF(Mn.errors).join(`
|
||||
`)+`
|
||||
|
||||
Input object: `+KP(Mn.input),o4=(Mn,Vn)=>MU(Mn,Pl(Vn,n4)),jU=xs(KF),tT=(Mn,Vn)=>JP(Wn=>{const jn=typeof Wn;return Mn(Wn)?km.svalue(Wn):km.serror(`Expected type: ${Vn} but got: ${jn}`)}),n6=tT(Ys,"number"),t$=tT(xo,"string"),XU=tT(Go,"boolean"),s4=tT(Yo,"function"),r2=HU,o6=QU,r4=Mn=>bG(Vn=>Zs(Mn,Vn)?ym.value(Vn):ym.error(`Unsupported value: "${Vn}", choose one of "${Mn.join(", ")}".`)),s6=(Mn,Vn)=>r2(Mn,Mn,XF(),Vn),r6=Mn=>s6(Mn,t$),i6=Mn=>s6(Mn,s4),a6=(Mn,Vn)=>r2(Mn,Mn,XF(),e6(Vn)),i4=(Mn,Vn)=>r2(Mn,Mn,BU(),Vn),n$=Mn=>i4(Mn,t$),YU=Mn=>i4(Mn,s4),GU=(Mn,Vn)=>r2(Mn,Mn,e4(Vn),jU()),i2=(Mn,Vn,Wn)=>r2(Mn,Mn,e4(Vn),Wn),rh=(Mn,Vn)=>i2(Mn,Vn,n6),Ty=(Mn,Vn)=>i2(Mn,Vn,t$),l6=(Mn,Vn,Wn)=>i2(Mn,Vn,r4(Wn)),c6=(Mn,Vn)=>i2(Mn,Vn,XU),a4=(Mn,Vn)=>i2(Mn,Vn,s4),KU=(Mn,Vn,Wn)=>i2(Mn,Vn,e6(Wn)),JU=r6("type"),eZ=i6("fetch"),o$=i6("onAction"),a2=a4("onSetup",()=>Js),vG=n$("text"),tZ=n$("icon"),nZ=n$("tooltip"),cv=n$("label"),oZ=c6("active",!1),sZ=c6("enabled",!0),l4=c6("primary",!1),rZ=Mn=>GU("columns",Mn),qw=Mn=>Ty("type",Mn),u6=n4([JU,r6("trigger"),rh("minChars",1),rZ(1),rh("maxResults",10),YU("matches"),eZ,o$,KU("highlightOn",[],t$)]),iZ=Mn=>e$("Autocompleter",u6,{trigger:Mn.ch,...Mn}),c4=[sZ,nZ,tZ,vG,a2],d6=[oZ].concat(c4),f6=[a4("predicate",hs),l6("scope","node",["node","editor"]),l6("position","selection",["node","selection","line"])],h6=c4.concat([qw("contextformbutton"),l4,o$,o6("original",Qr)]),u4=d6.concat([qw("contextformbutton"),l4,o$,o6("original",Qr)]),d4=c4.concat([qw("contextformbutton")]),f4=d6.concat([qw("contextformtogglebutton")]),aZ=o4("type",{contextformbutton:h6,contextformtogglebutton:u4});n4([qw("contextform"),a4("initValue",xs("")),cv,a6("commands",aZ),i4("launch",o4("type",{contextformbutton:d4,contextformtogglebutton:f4}))].concat(f6));const lZ=Mn=>{const Vn=Mn.ui.registry.getAll().popups,Wn=Pl(Vn,ao=>iZ(ao).fold(po=>{throw new Error(t6(po))},Qr)),jn=vl(ia(Wn,ao=>ao.trigger)),Gn=ka(Wn);return{dataset:Wn,triggers:jn,lookupByTrigger:ao=>nr(Gn,po=>po.trigger===ao)}},cZ=(Mn,Vn)=>{const Wn=jO(Vn.load,50);Mn.on("keypress compositionend",jn=>{jn.which!==27&&Wn.throttle()}),Mn.on("keydown",jn=>{const Gn=jn.which;Gn===8?Wn.throttle():Gn===27&&Vn.cancelIfNecessary()}),Mn.on("remove",Wn.cancel)},uZ=Mn=>{const Vn=Fb(),Wn=od(!1),jn=Vn.isSet,Gn=()=>{jn()&&(EV(Mn),Fx(Mn),Wn.set(!1),Vn.clear())},no=Ao=>{jn()||(xV(Mn,Ao.range),Vn.set({trigger:Ao.trigger,matchLength:Ao.text.length}))},ao=br(()=>lZ(Mn)),po=Ao=>Vn.get().map(Fo=>s2(Mn.dom,Mn.selection.getRng(),Fo.trigger).bind(Qo=>zF(Mn,ao,Qo,Ao))).getOrThunk(()=>CU(Mn,ao)),vo=Ao=>{po(Ao).fold(Gn,Fo=>{no(Fo.context),Fo.lookupData.then(Qo=>{Vn.get().map(qo=>{const ds=Fo.context;qo.trigger===ds.trigger&&(ds.text.length-qo.matchLength>=10?Gn():(Vn.set({...qo,matchLength:ds.text.length}),Wn.get()?eA(Mn,{lookupData:Qo}):(Wn.set(!0),Bx(Mn,{lookupData:Qo}))))})})})};Mn.addCommand("mceAutocompleterReload",(Ao,Fo)=>{const Qo=Io(Fo)?Fo.fetchOptions:{};vo(Qo)}),Mn.addCommand("mceAutocompleterClose",Gn),cZ(Mn,{cancelIfNecessary:Gn,load:vo})},p6=xl().browser.isSafari(),g6=Mn=>Kp(Cs.fromDom(Mn)),h4=(Mn,Vn)=>{var Wn;return Mn.startOffset===0&&Mn.endOffset===((Wn=Vn.textContent)===null||Wn===void 0?void 0:Wn.length)},s$=(Mn,Vn)=>zo.from(Mn.getParent(Vn.container(),"details")),r$=(Mn,Vn)=>s$(Mn,Vn).isSome(),dZ=(Mn,Vn)=>{const Wn=zo.from(Mn.getParent(Vn.startContainer,"details")),jn=zo.from(Mn.getParent(Vn.endContainer,"details"));if(Wn.isSome()||jn.isSome()){const Gn=Wn.bind(no=>zo.from(Mn.select("summary",no)[0]));return zo.some({startSummary:Gn,startDetails:Wn,endDetails:jn})}else return zo.none()},fZ=(Mn,Vn)=>zm(Vn).exists(Wn=>Wn.isEqual(Mn)),hZ=(Mn,Vn)=>b1(Vn).exists(Wn=>Ec(Wn.getNode())&&cp(Vn,Wn).exists(jn=>jn.isEqual(Mn))||Wn.isEqual(Mn)),mZ=(Mn,Vn)=>Vn.startSummary.exists(Wn=>fZ(Mn,Wn)),pZ=(Mn,Vn)=>Vn.startSummary.exists(Wn=>hZ(Mn,Wn)),b6=(Mn,Vn)=>Vn.startDetails.exists(Wn=>cp(Wn,Mn).forall(jn=>Vn.startSummary.exists(Gn=>!Gn.contains(Mn.container())&&Gn.contains(jn.container())))),m4=(Mn,Vn,Wn)=>Wn.startDetails.exists(jn=>Sm(Mn,Vn).forall(Gn=>!jn.contains(Gn.container()))),p4=(Mn,Vn)=>{const Wn=Vn.getNode();os(Wn)||Mn.selection.setCursorLocation(Wn,Vn.offset())},g4=(Mn,Vn,Wn)=>{const jn=Mn.dom.getParent(Vn.container(),"details");if(jn&&!jn.open){const Gn=Mn.dom.select("summary",jn)[0];Gn&&(Wn?zm(Gn):b1(Gn)).each(ao=>p4(Mn,ao))}else p4(Mn,Vn)},gZ=(Mn,Vn)=>{const Wn=vo=>vo.contains(Mn.startContainer),jn=vo=>vo.contains(Mn.endContainer),Gn=Vn.startSummary.exists(Wn),no=Vn.startSummary.exists(jn),ao=Vn.startDetails.forall(vo=>Vn.endDetails.forall(Ao=>vo!==Ao));return(Gn||no)&&!(Gn&&no)||ao},v6=(Mn,Vn,Wn)=>{const{dom:jn,selection:Gn}=Mn,no=Mn.getBody();if(Wn==="character"){const ao=lr.fromRangeStart(Gn.getRng()),po=jn.getParent(ao.container(),jn.isBlock),vo=s$(jn,ao),Ao=po&&jn.isEmpty(po),Fo=Mo(po==null?void 0:po.previousSibling),Qo=Mo(po==null?void 0:po.nextSibling);return Ao&&(Vn?Qo:Fo)&&Z0(!Vn,no,ao).exists(bs=>r$(jn,bs)&&!Ef(vo,s$(jn,bs)))?!0:Z0(Vn,no,ao).fold(hs,qo=>{const ds=s$(jn
Line truncated
|
||||
`;return}if(Ao!=="wbr"){if(Gn[Ao]&&(jn+=" "),no[Ao]){jn+=" ";return}if(vo.type===3&&(jn+=vo.value),!(vo.name in Vn.getVoidElements())){let Qo=vo.firstChild;if(Qo)do po(Qo);while(Qo=Qo.next)}ao[Ao]&&Fo.next&&(jn+=`
|
||||
`,Ao==="p"&&(jn+=`
|
||||
`))}};return Mn=s7(Mn,[/<!\[[^\]]+\]>/g]),po(Wn.parse(Mn)),jn},r7=Mn=>(Mn=s7(Mn,[/^[\s\S]*<body[^>]*>\s*|\s*<\/body[^>]*>[\s\S]*$/ig,/<!--StartFragment-->|<!--EndFragment-->/g,[/( ?)<span class="Apple-converted-space">\u00a0<\/span>( ?)/g,(Wn,jn,Gn)=>!jn&&!Gn?" ":hc],/<br class="Apple-interchange-newline">/g,/<br>$/i]),Mn),wq=Mn=>{let Vn=0;return()=>Mn+Vn++},Cq=Mn=>{const Vn=Mn.toLowerCase(),Wn={jpg:"jpeg",jpe:"jpeg",jfi:"jpeg",jif:"jpeg",jfif:"jpeg",pjpeg:"jpeg",pjp:"jpeg",svg:"svg+xml"};return Lr.hasOwn(Wn,Vn)?"image/"+Wn[Vn]:"image/"+Vn},Hu=(Mn,Vn)=>{const Wn=a0({sanitize:jb(Mn),sandbox_iframes:b_(Mn)},Mn.schema);Wn.addNodeFilter("meta",Gn=>{Lr.each(Gn,no=>{no.remove()})});const jn=Wn.parse(Vn,{forced_root_block:!1,isRootContent:!0});return I_({validate:!0},Mn.schema).serialize(jn)},i7=(Mn,Vn)=>({content:Mn,cancelled:Vn}),a7=(Mn,Vn,Wn)=>{const jn=Mn.dom.create("div",{style:"display:none"},Vn),Gn=R3(Mn,jn,Wn);return i7(Gn.node.innerHTML,Gn.isDefaultPrevented())},kq=(Mn,Vn,Wn)=>{const jn=$3(Mn,Vn,Wn),Gn=Hu(Mn,jn.content);return Mn.hasEventListeners("PastePostProcess")&&!jn.isDefaultPrevented()?a7(Mn,Gn,Wn):i7(Gn,jn.isDefaultPrevented())},F4=(Mn,Vn,Wn)=>kq(Mn,Vn,Wn),k$=(Mn,Vn)=>(Mn.insertContent(Vn,{merge:YS(Mn),paste:!0}),!0),H4=Mn=>/^https?:\/\/[\w\-\/+=.,!;:&%@^~(){}?#]+$/i.test(Mn),xq=(Mn,Vn)=>H4(Vn)&&Sr(UC(Mn),Wn=>bd(Vn.toLowerCase(),`.${Wn.toLowerCase()}`)),l7=(Mn,Vn,Wn)=>(Mn.undoManager.extra(()=>{Wn(Mn,Vn)},()=>{Mn.insertContent('<img src="'+Vn+'">')}),!0),Q4=(Mn,Vn,Wn)=>(Mn.undoManager.extra(()=>{Wn(Mn,Vn)},()=>{Mn.execCommand("mceInsertLink",!1,Vn)}),!0),Eq=(Mn,Vn,Wn)=>!Mn.selection.isCollapsed()&&H4(Vn)?Q4(Mn,Vn,Wn):!1,Tq=(Mn,Vn,Wn)=>xq(Mn,Vn)?l7(Mn,Vn,Wn):!1,Aq=(Mn,Vn)=>{Lr.each([Eq,Tq,k$],Wn=>!Wn(Mn,Vn,k$))},c7=(Mn,Vn,Wn)=>{Wn||!h_(Mn)?k$(Mn,Vn):Aq(Mn,Vn)},Pq=wq("mceclip"),$q=Mn=>{const Vn=N4();return J6(Vn,Mn),M4(Vn),Vn},Xw=(Mn,Vn,Wn,jn,Gn)=>{const no=F4(Mn,Vn,Wn);if(!no.cancelled){const ao=no.content,po=()=>c7(Mn,ao,jn);Gn?b4(Mn,"insertFromPaste",{dataTransfer:$q(ao)}).isDefaultPrevented()||(po(),nT(Mn,"insertFromPaste")):po()}},x$=(Mn,Vn,Wn,jn)=>{const Gn=Wn||t7(Vn);Xw(Mn,e7(Vn),Gn,!1,jn)},nS=(Mn,Vn,Wn)=>{const jn=Mn.dom.encode(Vn).replace(/\r\n/g,`
|
||||
`),Gn=V1(jn,zC(Mn)),no=C$(Gn,bh(Mn),Zb(Mn));Xw(Mn,no,!1,!0,Wn)},d2=Mn=>{const Vn={};if(Mn&&Mn.types)for(let Wn=0;Wn<Mn.types.length;Wn++){const jn=Mn.types[Wn];try{Vn[jn]=Mn.getData(jn)}catch{Vn[jn]=""}}return Vn},oS=(Mn,Vn)=>Vn in Mn&&Mn[Vn].length>0,u7=Mn=>oS(Mn,"text/html")||oS(Mn,"text/plain"),f2=(Mn,Vn)=>{const Wn=Vn.match(/([\s\S]+?)(?:\.[a-z0-9.]+)$/i);return is(Wn)?Mn.dom.encode(Wn[1]):void 0},Rq=(Mn,Vn,Wn,jn)=>{const Gn=Pq(),no=nO(Mn)&&is(Wn.name),ao=no?f2(Mn,Wn.name):Gn,po=no?Wn.name:void 0,vo=Vn.create(Gn,Wn,jn,ao,po);return Vn.add(vo),vo},V4=(Mn,Vn)=>{JA(Vn.uri).each(({data:Wn,type:jn,base64Encoded:Gn})=>{const no=Gn?Wn:btoa(Wn),ao=Vn.file,po=Mn.editorUpload.blobCache,vo=po.getByData(no,jn),Ao=vo??Rq(Mn,po,ao,no);x$(Mn,`<img src="${Ao.blobUri()}">`,!1,!0)})},Dq=Mn=>Mn.type==="paste",d7=Mn=>Promise.all(Us(Mn,Vn=>_Q(Vn).then(Wn=>({file:Vn,uri:Wn})))),f7=Mn=>{const Vn=UC(Mn);return Wn=>Dc(Wn.type,"image/")&&Sr(Vn,jn=>Cq(jn)===Wn.type)},z4=(Mn,Vn)=>{const Wn=Vn.items?cc(kc(Vn.items),Gn=>Gn.kind==="file"?[Gn.getAsFile()]:[]):[],jn=Vn.files?kc(Vn.files):[];return nr(Wn.length>0?Wn:jn,f7(Mn))},W4=(Mn,Vn,Wn)=>{const jn=Dq(Vn)?Vn.clipboardData:Vn.dataTransfer;if(f_(Mn)&&jn){const Gn=z4(Mn,jn);if(Gn.length>0)return Vn.preventDefault(),d7(Gn).then(no=>{Wn&&Mn.selection.setRng(Wn),fs(no,ao=>{V4(Mn,ao)})}),!0}return!1},Mq=Mn=>{var Vn,Wn;return aa.os.isAndroid()&&((Wn=(Vn=Mn.clipboardData)===null||Vn===void 0?void 0:Vn.items)===null||Wn===void 0?void 0:Wn.length)===0},Nq=Mn=>va.metaKeyPressed(Mn)&&Mn.keyCode===86||Mn.shiftKey&&Mn.keyCode===45,E$=(Mn,Vn,Wn,jn,Gn)=>{let no=r7(Wn);const ao=oS(Vn,w$())||t7(Wn),po=!ao&&gq(no),vo=H4(no);(o7(no)||!no.length||po&&!vo)&&(jn=!0),(jn||vo)&&(oS(Vn,"text/plain")&&po?no=Vn["text/plain"]:no=Sq(no)),!o7(no)&&(jn?nS(Mn,no,Gn):x$(Mn,no,ao,Gn))},Lq=(Mn,Vn,Wn)=>{let jn;const Gn=()=>Vn.getLastRng()||Mn.selection.getRng();Mn.on("keydown",no=>{Nq(no)&&!no.isDefaultPrevented()&&(jn=no.shiftKey&&no.keyCode===86)}),Mn.on("paste",no=>{if(no.isDefaultPrevented()||Mq(no))return;const ao=Wn.get()==="text"||jn;jn=!1;const po=d2(no.clipboardData);!u7(po)&&W4(Mn,no,Gn())||(oS(po,"text/html")?(no.preventDefault(),E$(Mn,po,po["text/html"],ao,!0)):oS(po,"text/plain")&&oS(po,"text/uri-list")?(no.preventDefault(),E$(Mn,po,po["text/plain"],ao,!0)):(Vn.create(),O1.setEditorTimeout(Mn,()=>{const vo=Vn.getHtml();Vn.remove(),E$(Mn,po,vo,ao,!1)},0)))})},h7=Mn=>{const Vn=Gn=>Dc(Gn,"webkit-fake-url"),Wn=Gn=>Dc(Gn,"data:"),jn=Gn=>{var no;return((no=Gn.data)===null||no===void 0?void 0:no.paste)===!0};Mn.parser.addNodeFilter("img",(Gn,no,ao)=>{if(!f_(Mn)&&jn(ao))for(const po of Gn){const vo=po.attr("src");xo(vo)&&!po.attr("data-mce-object")&&vo!==aa.transparentSrc&&(Vn(vo)||!p_(Mn)&&Wn(vo))&&po.remove()}})},U4=(Mn,Vn,Wn)=>{Lq(Mn,Vn,Wn),h7(Mn)},m7=(Mn,Vn)=>{Vn.get()==="text"?(Vn.set("html"),tA(Mn,!1)):(Vn.set("text"),tA(Mn,!0)),Mn.focus()},Iq=(Mn,Vn)=>{Mn.addCommand("mceTogglePlainTextPaste",()=>{m7(Mn,Vn)}),Mn.addCommand("mceInsertClipboardContent",(Wn,jn)=>{jn.html&&x$(Mn,jn.html,jn.internal,!1),jn.text&&nS(Mn,jn.text,!1)})},Bq=(Mn,Vn,Wn)=>{if(Mn)try{return Mn.clearData(),Mn.setData("text/html",Vn),Mn.setData("text/plain",Wn),Mn.setData(w$(),Vn),!0}catch{return!1}else return!1},p7=(Mn,Vn,Wn,jn)=>{Bq(Mn.clipboardData,Vn.html,Vn.text)?(Mn.preventDefault(),jn()):Wn(Vn.html,jn)},Z4=Mn=>(Vn,Wn)=>{const{dom:jn,selection:Gn}=Mn,no=jn.create("div",{contenteditable:"false","data-mce-bogus":"all"}),ao=jn.create("div",{contenteditable:"true"},Vn);jn.setStyles(no,{position:"fixed",top:"0",left:"-3000px",width:"1000px",overflow:"hidden"}),no.appendChild(ao),jn.add(Mn.getBody(),no);const po=Gn.getRng();ao.focus();const vo=jn.createRng();vo.selectNodeContents(ao),Gn.setRng(vo),O1.setEditorTimeout(Mn,()=>{Gn.setRng(po),jn.remove(no),Wn()},0)},T$=Mn=>({html:pq(Mn.selection.getContent({contextual:!0})),text:Mn.selection.getContent({format:"text"})}),Fq=Mn=>!!Mn.dom.getParent(Mn.selection.getStart(),"td[data-mce-selected],th[data-mce-selected]",Mn.getBody()),q4=Mn=>!Mn.selection.isCollapsed()||Fq(Mn),g7=Mn=>Vn=>{!Vn.isDefaultPrevented()&&q4(Mn)&&Mn.selection.isEditable()&&p7(Vn,T$(Mn),Z4(Mn),()=>{if(aa.browser.isChromium()||aa.browser.isFirefox()){const Wn=Mn.selection.getRng();O1.setEditorTimeout(Mn,()=>{Mn.selection.setRng(Wn),Mn.execCommand("Delete")},0)}else Mn.execCommand("Delete")})},Hq=Mn=>Vn=>{!Vn.isDefaultPrevented()&&q4(Mn)&&p7(Vn,T$(Mn),Z4(Mn),Js)},b7=Mn=>{Mn.on("cut",g7(Mn)),Mn.on("copy",Hq(Mn))},v7=(Mn,Vn)=>{var Wn,jn;return ns.getCaretRangeFromPoint((Wn=Vn.clientX)!==null&&Wn!==void 0?Wn:0,(jn=Vn.clientY)!==null&&jn!==void 0?jn:0,Mn.getDoc())},Qq=Mn=>{const Vn=Mn["text/plain"];return Vn?Vn.indexOf("file://")===0:!1},y7=(Mn,Vn)=>{Mn.focus(),Vn&&Mn.selection.setRng(Vn)},Vq=Mn=>Sr(Mn.files,Vn=>/^image\//.test(Vn.type)),zq=(Mn,Vn,Wn,jn)=>{const Gn=Mn.getParent(Wn,ao=>Wl(Vn,ao));if(!Mo(Mn.getParent(Wn,"summary")))return!0;if(Gn&&Mr(jn,"text/html")){const ao=new DOMParser().parseFromString(jn["text/html"],"text/html
Line truncated
|
||||
`}),Mn.dom.addStyle(vo)}const ao=Promise.all(Zj(Mn,jn,Wn)).then(no).catch(no),po=l_(Mn);return po&&Qj(Mn,po),ao},qj=Mn=>{const Vn=Mn.getDoc(),Wn=Mn.getBody();fy(Mn),ax(Mn)||(Vn.body.spellcheck=!1,Q$.setAttrib(Wn,"spellcheck","false")),Mn.quirks=Hj(Mn),T3(Mn);const jn=G2(Mn);jn!==void 0&&(Wn.dir=jn);const Gn=QC(Mn);Gn&&Mn.on("BeforeSetContent",no=>{Lr.each(Gn,ao=>{no.content=no.content.replace(ao,po=>"<!--mce:protected "+escape(po)+"-->")})}),Mn.on("SetContent",()=>{Mn.addVisual(Mn.getBody())}),Mn.on("compositionstart compositionend",no=>{Mn.composing=no.type==="compositionstart"})},jj=Mn=>{wO(Mn)||Mn.load({initial:!0,format:"html"}),Mn.startContent=Mn.getContent({format:"raw"})},aN=Mn=>{Mn.removed!==!0&&(jj(Mn),Uj(Mn))},Xj=Mn=>{let Vn=!1;const Wn=setTimeout(()=>{Vn||Mn.setProgressState(!0)},500);return()=>{clearTimeout(Wn),Vn=!0,Mn.setProgressState(!1)}},p8=Mn=>{const Vn=Mn.getElement();let Wn=Mn.getDoc();Mn.inline&&(Q$.addClass(Vn,"mce-content-body"),Mn.contentDocument=Wn=document,Mn.contentWindow=window,Mn.bodyElement=Vn,Mn.contentAreaContainer=Vn);const jn=Mn.getBody();jn.disabled=!0,Mn.readonly=oO(Mn),Mn._editableRoot=$p(Mn),!Mn.readonly&&Mn.hasEditableRoot()&&(Mn.inline&&Q$.getStyle(jn,"position",!0)==="static"&&(jn.style.position="relative"),jn.contentEditable="true"),jn.disabled=!1,Mn.editorUpload=vz(Mn),Mn.schema=i1(h8(Mn)),Mn.dom=Eu(Wn,{keep_values:!0,url_converter:Mn.convertURL,url_converter_scope:Mn,update_styles:!0,root_element:Mn.inline?Mn.getBody():null,collect:Mn.inline,schema:Mn.schema,contentCssCors:ab(Mn),referrerPolicy:Hl(Mn),onSetAttrib:ao=>{Mn.dispatch("SetAttrib",ao)},force_hex_color:ry(Mn)}),Mn.parser=zj(Mn),Mn.serializer=zI(Vj(Mn),Mn),Mn.selection=W_(Mn.dom,Mn.getWin(),Mn.serializer,Mn),Mn.annotator=Dx(Mn),Mn.formatter=eM(Mn),Mn.undoManager=tM(Mn),Mn._nodeChangeDispatcher=new U6(Mn),Mn._selectionOverrides=xj(Mn),BW(Mn),Gq(Mn),iG(Mn),wO(Mn)||(T7(Mn),Fj(Mn));const Gn=sq(Mn);Uw(Mn,Gn),VW(Mn),c0(Mn),jq(Mn);const no=hV(Mn);qj(Mn),no.fold(()=>{const ao=Xj(Mn);m8(Mn).then(()=>{aN(Mn),ao()})},ao=>{Mn.setProgressState(!0),m8(Mn).then(()=>{ao().then(po=>{Mn.setProgressState(!1),aN(Mn),WD(Mn)},po=>{Mn.notificationManager.open({type:"error",text:String(po)}),aN(Mn),WD(Mn)})})})},g8=Qs,Yj=(Mn,Vn,Wn)=>S0(Mn,Vn,g8,Wn),z$=Eu.DOM,Gj=(Mn,Vn,Wn,jn)=>{const Gn=Cs.fromTag("iframe");return jn.each(no=>Gc(Gn,"tabindex",no)),im(Gn,Wn),im(Gn,{id:Mn+"_ifr",frameBorder:"0",allowTransparency:"true",title:Vn}),Xm(Gn,"tox-edit-area__iframe"),Gn},Kj=Mn=>{let Vn=FS(Mn)+"<html><head>";ap(Mn)!==Mn.documentBaseUrl&&(Vn+='<base href="'+Mn.documentBaseURI.getURI()+'" />'),Vn+='<meta http-equiv="Content-Type" content="text/html; charset=UTF-8" />';const Wn=i_(Mn),jn=W2(Mn),Gn=Mn.translate(sx(Mn));return Zu(Mn)&&(Vn+='<meta http-equiv="Content-Security-Policy" content="'+Zu(Mn)+'" />'),Vn+=`</head><body id="${Wn}" class="mce-content-body ${jn}" data-id="${Mn.id}" aria-label="${Gn}"><br></body></html>`,Vn},b8=(Mn,Vn)=>{const Wn=Mn.translate("Rich Text Area"),jn=Ld(Cs.fromDom(Mn.getElement()),"tabindex").bind(Em),Gn=Gj(Mn.id,Wn,Ic(Mn),jn).dom;Gn.onload=()=>{Gn.onload=null,Mn.dispatch("load")},Mn.contentAreaContainer=Vn.iframeContainer,Mn.iframeElement=Gn,Mn.iframeHTML=Kj(Mn),z$.add(Vn.iframeContainer,Gn)},fT=Mn=>{const Vn=Mn.iframeElement,Wn=()=>{Mn.contentDocument=Vn.contentDocument,p8(Mn)};if(fx(Mn)||aa.browser.isFirefox()){const jn=Mn.getDoc();jn.open(),jn.write(Mn.iframeHTML),jn.close(),Wn()}else{const jn=Yj(Cs.fromDom(Vn),"load",()=>{jn.unbind(),Wn()});Vn.srcdoc=Mn.iframeHTML}},Jj=(Mn,Vn)=>{b8(Mn,Vn),Vn.editorContainer&&(Vn.editorContainer.style.display=Mn.orgDisplay,Mn.hidden=z$.isHidden(Vn.editorContainer)),Mn.getElement().style.display="none",z$.setAttrib(Mn.id,"aria-hidden","true"),Mn.getElement().style.visibility=Mn.orgVisibility,fT(Mn)},lN=Eu.DOM,eX=(Mn,Vn,Wn)=>{const jn=Hw.get(Wn),Gn=Hw.urls[Wn]||Mn.documentBaseUrl.replace(/\/$/,"");if(Wn=Lr.trim(Wn),jn&&Lr.inArray(Vn,Wn)===-1){if(Mn.plugins[Wn])return;try{const no=jn(Mn,Gn)||{};Mn.plugins[Wn]=no,Yo(no.init)&&(no.init(Mn,Gn),Vn.push(Wn))}catch(no){tB(Mn,Wn,no)}}},tX=Mn=>Mn.replace(/^\-/,""),nX=Mn=>{const Vn=[];fs(sO(Mn),Wn=>{eX(Mn,Vn,tX(Wn))})},oX=Mn=>{const Vn=Lr.trim(QS(Mn)),Wn=Mn.ui.registry.getAll().icons,jn={...AE.get("default").icons,...AE.get(Vn).icons};Rr(jn,(Gn,no)=>{Mr(Wn,no)||Mn.ui.registry.addIcon(no,Gn)})},v8=Mn=>{const Vn=ey(Mn);if(xo(Vn)){const Wn=CO.get(Vn);Mn.theme=Wn(Mn,CO.urls[Vn])||{},Yo(Mn.theme.init)&&Mn.theme.init(Mn,CO.urls[Vn]||Mn.documentBaseUrl.replace(/\/$/,""))}else Mn.theme={}},sX=Mn=>{const Vn=c_(Mn),Wn=yb.get(Vn);Mn.model=Wn(Mn,yb.urls[Vn])},y8=Mn=>{const Vn=Mn.theme.renderUI;return Vn?Vn():_8(Mn)},rX=Mn=>{const Vn=Mn.getElement(),jn=ey(Mn)(Mn,Vn);return jn.editorContainer.nodeType&&(jn.editorContainer.id=jn.editorContainer.id||Mn.id+"_parent"),jn.iframeContainer&&jn.iframeContainer.nodeType&&(jn.iframeContainer.id=jn.iframeContainer.id||Mn.id+"_iframecontainer"),jn.height=jn.iframeHeight?jn.iframeHeight:Vn.offsetHeight,jn},O8=(MLine truncated
|
||||
Actual: `+la.join(","));if(!za(ro,xr=>gs(la,xr)))throw new Error("Not all branches were specified when using match. Specified: "+la.join(", ")+`
|
||||
Required: `+ro.join(", "));return Nr[Zo].apply(null,ps)},log:Nr=>{console.log(Nr,{constructors:ro,constructor:Zo,params:ps})}}}}),fo}},Xv={...Qm.generate([{none:[]},{only:["index"]},{left:["index","next"]},{middle:["prev","index","next"]},{right:["prev","index"]}])},kC=(eo,ro)=>eo.length===0?Xv.none():eo.length===1?Xv.only(0):ro===0?Xv.left(0,1):ro===eo.length-1?Xv.right(ro-1,ro):ro>0&&ro<eo.length-1?Xv.middle(ro-1,ro,ro+1):Xv.none(),F2=(eo,ro,fo,go,To)=>{const No=eo.slice(0),Zo=kC(eo,ro),ns=xo(cr(No,xo(0))),ps=la=>go.singleColumnWidth(No[la],fo),$s=(la,sa)=>To.calcLeftEdgeDeltas(No,la,sa,fo,go.minCellWidth(),go.isRelative),js=(la,sa,xr)=>To.calcMiddleDeltas(No,la,sa,xr,fo,go.minCellWidth(),go.isRelative),Nr=(la,sa)=>To.calcRightEdgeDeltas(No,la,sa,fo,go.minCellWidth(),go.isRelative);return Zo.fold(ns,ps,$s,js,Nr)},qy=(eo,ro,fo)=>{let go=0;for(let To=eo;To<ro;To++)go+=fo[To]!==void 0?fo[To]:0;return go},Wb=(eo,ro)=>{const fo=ss.justCells(eo);return cr(fo,go=>{const To=qy(go.column,go.column+go.colspan,ro);return{element:go.element,width:To,colspan:go.colspan}})},JO=(eo,ro)=>{const fo=ss.justColumns(eo);return cr(fo,(go,To)=>({element:go.element,width:ro[To],colspan:go.colspan}))},rc=(eo,ro)=>{const fo=ss.justCells(eo);return cr(fo,go=>{const To=qy(go.row,go.row+go.rowspan,ro);return{element:go.element,height:To,rowspan:go.rowspan}})},Vm=(eo,ro)=>cr(eo.all,(fo,go)=>({element:fo.element,height:ro[go]})),Fg=eo=>ha(eo,(ro,fo)=>ro+fo,0),Yv=(eo,ro)=>ss.hasColumns(eo)?JO(eo,ro):Wb(eo,ro),tu=(eo,ro,fo)=>{const go=Yv(eo,ro);ws(go,To=>{fo.setElementWidth(To.element,To.width)})},Gv=(eo,ro,fo,go,To)=>{const No=ss.fromTable(eo),Zo=To.getCellDelta(ro),ns=To.getWidths(No,To),ps=fo===No.grid.columns-1,$s=go.clampTableDelta(ns,fo,Zo,To.minCellWidth(),ps),js=F2(ns,fo,$s,To,go),Nr=cr(js,(la,sa)=>la+ns[sa]);tu(No,Nr,To),go.resizeTable(To.adjustTableWidth,$s,ps)},e_=(eo,ro,fo,go)=>{const To=ss.fromTable(eo),No=Gs(To,eo,go),Zo=cr(No,(js,Nr)=>fo===Nr?Math.max(ro+js,Vh()):js),ns=rc(To,Zo),ps=Vm(To,Zo);ws(ps,js=>{Rg(js.element,js.height)}),ws(ns,js=>{Rg(js.element,js.height)});const $s=Fg(Zo);Rg(eo,$s)},Yd=(eo,ro,fo,go,To)=>{const No=ss.generate(ro),Zo=go.getWidths(No,go),ns=go.pixelWidth(),{newSizes:ps,delta:$s}=To.calcRedestributedWidths(Zo,ns,fo.pixelDelta,go.isRelative);tu(No,ps,go),go.adjustTableWidth($s)},Hg=(eo,ro,fo,go)=>{const To=ss.generate(ro),No=go.getWidths(To,go);tu(To,No,go)},sb=eo=>hs(eo,(fo,go)=>xs(fo,No=>No.column===go.column)?fo:fo.concat([go]),[]).sort((fo,go)=>fo.column-go.column),t_=Vc("col"),jy=Vc("colgroup"),Xy=eo=>pr(eo)==="tr"||jy(eo),TS=eo=>{const ro=Gc(eo,"colspan",1),fo=Gc(eo,"rowspan",1);return{element:eo,colspan:ro,rowspan:fo}},n_=(eo,ro=TS)=>{const fo=ns=>t_(ns.element)?eo.col(ns):eo.cell(ns),go=ns=>jy(ns.element)?eo.colgroup(ns):eo.row(ns),To=ns=>{if(Xy(ns))return go({element:ns});{const ps=ns,$s=fo(ro(ps));return No=Yo.some({item:ps,replacement:$s}),$s}};let No=Yo.none();return{getOrInit:(ns,ps)=>No.fold(()=>To(ns),$s=>ps(ns,$s.item)?$s.replacement:To(ns))}},Pp=eo=>ro=>{const fo=[],go=(Zo,ns)=>zo(fo,ps=>ns(ps.item,Zo)),To=Zo=>{const ns=eo==="td"?{scope:null}:{},ps=ro.replace(Zo,eo,ns);return fo.push({item:Zo,sub:ps}),ps};return{replaceOrInit:(Zo,ns)=>{if(Xy(Zo)||t_(Zo))return Zo;{const ps=Zo;return go(ps,ns).fold(()=>To(ps),$s=>ns(Zo,$s.item)?$s.sub:To(ps))}}}},ug=eo=>Ts(eo,"scope").map(ro=>ro.substr(0,3)),lr={modification:n_,transform:Pp,merging:eo=>({unmerge:go=>{const To=ug(go);return To.each(No=>zc(go,"scope",No)),()=>{const No=eo.cell({element:go,colspan:1,rowspan:1});return Qh(No,"width"),Qh(go,"width"),To.each(Zo=>zc(No,"scope",Zo)),No}},merge:go=>{const To=()=>{const No=cu(cr(go,ug));if(No.length===0)return Yo.none();{const Zo=No[0],ns=["row","col"];return xs(No,$s=>$s!==Zo&&gs(ns,$s))?Yo.none():Yo.from(Zo)}};return Qh(go[0],"width"),To().fold(()=>ks(go[0],"scope"),No=>zc(go[0],"scope",No+"group")),xo(go[0])}})},H0=["body","p","div","article","aside","figcaption","figure","footer","header","nav","section","ol","ul","table","thead","tfoot","tbody","caption","tr","td","th","h1","h2","h3","h4","h5","h6","blockquote","pre","address"],Q0=(eo,ro)=>{const fo=eo.property().name(ro);return gs(["ol","ul"],fo)},rp=(eo,ro)=>{const fo=eo.property().name(ro);return gs(H0,fo)},AS=(eo,ro)=>gs(["br","img","hr","input"],eo.property().name(ro)),Uu=wr(),o_=eo=>rp(Uu,eo),rb=eo=>Q0(Uu,eo),PS=eo=>AS(Uu,eo),s_=eo=>{const ro=Vc("br"),fo=ps=>za(ps,$s=>ro($s)||Na($s)&&La($s).trim().length===0),go=ps=>pr(ps)==="li"||qc(ps,rb).isSome(),To=ps=>sm(ps).map($s=>o_($s)?!0:PS($s)?pr($s)!=="img":!1).getOr(!1),No=ps=>wp(ps).bind($s=>{const js=To($s);return bd($s).map(Nr=>js===!0||go(Nr)||ro($s)||o_(Nr)&&!bc(ps,Nr)?[]:[Ds.fromTag("br")])}).getOr([]),ns=(()=>{const ps=Ca(eo,$s=>{const js=fc($s);return fo(js)?[]:js.concat(No($s))});return ps.length===0?[Ds.fromTag("br")]:ps})();vd(eo[0]),cd(eo[0],ns)},$S=eo=>Z1(eo,!0),Yy=eo=>{Yf(eo).length===0&&ju(eo)},Kv=(eo,ro)=>({grid:eo,cursor:ro}),RS=eo=>Vr(eo,ro=>Vr(ro.cells,fo=>{const go=
Line truncated
|
||||
`+Yn.getErrorInfo())},Eo=(Qn,Zn)=>xu.serror([{path:Qn,getErrorInfo:Zn}]),Bo=(Qn,Zn,Yn)=>Eo(Qn,()=>'Could not find valid *required* value for "'+Zn+'" in '+S0(Yn)),Ko=(Qn,Zn)=>Eo(Qn,()=>'Choice schema did not contain choice key: "'+Zn+'"'),Ss=(Qn,Zn,Yn)=>Eo(Qn,()=>'The chosen schema: "'+Yn+'" did not exist in branches: '+S0(Zn)),Rs=(Qn,Zn)=>Eo(Qn,()=>"There are unsupported fields: ["+Zn.join(", ")+"] specified"),$r=(Qn,Zn)=>Eo(Qn,Mo(Zn)),Ea=Qn=>{const Zn=(Jn,oo)=>xu.bindError(Qn(oo),lo=>$r(Jn,lo)),Yn=Mo("val");return{extract:Zn,toString:Yn}},ll=Ea(xu.svalue),nl=(Qn,Zn,Yn,Jn)=>Rr(Zn,Yn).fold(()=>Bo(Qn,Yn,Zn),Jn),Xa=(Qn,Zn,Yn,Jn)=>{const oo=Rr(Qn,Zn).getOrThunk(()=>Yn(Qn));return Jn(oo)},Nu=(Qn,Zn,Yn)=>Yn(Rr(Qn,Zn)),zu=(Qn,Zn,Yn,Jn)=>{const oo=Rr(Qn,Zn).map(lo=>lo===!0?Yn(Qn):lo);return Jn(oo)},kh=(Qn,Zn,Yn,Jn,oo)=>{const lo=yo=>oo.extract(Zn.concat([Jn]),yo),mo=yo=>yo.fold(()=>xu.svalue(ko.none()),Co=>{const Ro=oo.extract(Zn.concat([Jn]),Co);return xu.map(Ro,ko.some)});switch(Qn.tag){case"required":return nl(Zn,Yn,Jn,lo);case"defaultedThunk":return Xa(Yn,Jn,Qn.process,lo);case"option":return Nu(Yn,Jn,mo);case"defaultedOptionThunk":return zu(Yn,Jn,Qn.process,mo);case"mergeWithThunk":return Xa(Yn,Jn,Mo({}),yo=>{const Co=Lc(Qn.process(Yn),yo);return lo(Co)})}},Sp=(Qn,Zn,Yn)=>{const Jn={},oo=[];for(const lo of Yn)Gm(lo,(mo,yo,Co,Ro)=>{const Lo=kh(Co,Qn,Zn,mo,Ro);xu.fold(Lo,Wo=>{oo.push(...Wo)},Wo=>{Jn[yo]=Wo})},(mo,yo)=>{Jn[mo]=yo(Zn)});return oo.length>0?xu.serror(oo):xu.svalue(Jn)},mf=Qn=>({extract:(Jn,oo)=>Qn().extract(Jn,oo),toString:()=>Qn().toString()}),fS=Qn=>nc(Yl(Qn,Oo)),mu=Qn=>{const Zn=Ta(Qn),Yn=Ca(Qn,(oo,lo)=>Gm(lo,mo=>Lc(oo,{[mo]:!0}),Mo(oo)),{});return{extract:(oo,lo)=>{const mo=uo(lo)?[]:fS(lo),yo=ga(mo,Co=>!Su(Yn,Co));return yo.length===0?Zn.extract(oo,lo):Rs(oo,yo)},toString:Zn.toString}},Ta=Qn=>({extract:(Jn,oo)=>Sp(Jn,oo,Qn),toString:()=>`obj{
|
||||
`+hs(Qn,oo=>Gm(oo,(lo,mo,yo,Co)=>lo+" -> "+Co.toString(),(lo,mo)=>"state("+lo+")")).join(`
|
||||
`)+"}"}),Xp=Qn=>({extract:(Jn,oo)=>{const lo=hs(oo,(mo,yo)=>Qn.extract(Jn.concat(["["+yo+"]"]),mo));return Db.consolidateArr(lo)},toString:()=>"array("+Qn.toString()+")"}),Oa=(Qn,Zn)=>{const Yn=Zn!==void 0?Zn:Go;return{extract:(lo,mo)=>{const yo=[];for(const Co of Qn){const Ro=Co.extract(lo,mo);if(Ro.stype===dh.Value)return{stype:dh.Value,svalue:Yn(Ro.svalue)};yo.push(Ro)}return Db.consolidateArr(yo)},toString:()=>"oneOf("+hs(Qn,lo=>lo.toString()).join(", ")+")"}},pf=(Qn,Zn)=>{const Yn=(lo,mo)=>Xp(Ea(Qn)).extract(lo,mo);return{extract:(lo,mo)=>{const yo=nc(mo),Co=Yn(lo,yo);return xu.bind(Co,Ro=>{const Lo=hs(Ro,Wo=>ed(Wo,Wo,sc(),Zn));return Ta(Lo).extract(lo,mo)})},toString:()=>"setOf("+Zn.toString()+")"}},$O=(Qn,Zn)=>{const Yn=Du(Zn);return{extract:(lo,mo)=>Yn().extract(lo,mo),toString:()=>Yn().toString()}},Yp=Vo(Xp,Ta),Ad=Mo(ll),Pg=(Qn,Zn)=>Ea(Yn=>{const Jn=typeof Yn;return Qn(Yn)?xu.svalue(Yn):xu.serror(`Expected type: ${Zn} but got: ${Jn}`)}),w0=Pg($o,"number"),nf=Pg(qn,"string"),Jm=Pg(uo,"boolean"),_v=Pg(So,"function"),Gp=Qn=>{if(Object(Qn)!==Qn)return!0;switch({}.toString.call(Qn).slice(8,-1)){case"Boolean":case"Number":case"String":case"Date":case"RegExp":case"Blob":case"FileList":case"ImageData":case"ImageBitmap":case"ArrayBuffer":return!0;case"Array":case"Object":return Object.keys(Qn).every(Zn=>Gp(Qn[Zn]));default:return!1}},Sv=Ea(Qn=>Gp(Qn)?xu.svalue(Qn):xu.serror("Expected value to be acceptable for sending via postMessage")),$g=(Qn,Zn,Yn,Jn)=>Rr(Yn,Jn).fold(()=>Ss(Qn,Yn,Jn),lo=>lo.extract(Qn.concat(["branch: "+Jn]),Zn)),Ir=(Qn,Zn)=>({extract:(oo,lo)=>Rr(lo,Qn).fold(()=>Ko(oo,Qn),yo=>$g(oo,lo,Zn,yo)),toString:()=>"chooseOn("+Qn+"). Possible values: "+nc(Zn)}),RO=()=>Xp(ll),Rg=Qn=>Ea(Zn=>Qn(Zn).fold(xu.serror,xu.svalue)),Dg=(Qn,Zn)=>pf(Yn=>xu.fromResult(Qn(Yn)),Zn),Nm=(Qn,Zn,Yn)=>{const Jn=Zn.extract([Qn],Yn);return xu.mapError(Jn,oo=>({input:Yn,errors:oo}))},Lu=(Qn,Zn,Yn)=>xu.toResult(Nm(Qn,Zn,Yn)),Ec=Qn=>Qn.fold(Zn=>{throw new Error(Gf(Zn))},Go),td=(Qn,Zn,Yn)=>Ec(Lu(Qn,Zn,Yn)),Gf=Qn=>`Errors:
|
||||
`+Mm(Qn.errors).join(`
|
||||
`)+`
|
||||
|
||||
Input object: `+S0(Qn.input),jl=(Qn,Zn)=>Ir(Qn,Vl(Zn,Ta)),L1=(Qn,Zn)=>$O(Qn,Zn),Bd=ed,pu=fh,C0=Qn=>Rg(Zn=>Fs(Qn,Zn)?yl.value(Zn):yl.error(`Unsupported value: "${Zn}", choose one of "${Qn.join(", ")}".`)),Er=Qn=>Bd(Qn,Qn,sc(),Ad()),Kf=(Qn,Zn)=>Bd(Qn,Qn,sc(),Zn),k0=Qn=>Kf(Qn,w0),hc=Qn=>Kf(Qn,nf),hd=(Qn,Zn)=>Bd(Qn,Qn,sc(),C0(Zn)),wv=Qn=>Kf(Qn,Jm),ep=Qn=>Kf(Qn,_v),tp=(Qn,Zn)=>Bd(Qn,Qn,Km(),Ea(Yn=>xu.serror("The field: "+Qn+" is forbidden. "+Zn))),fm=(Qn,Zn)=>Bd(Qn,Qn,sc(),Ta(Zn)),Mb=(Qn,Zn)=>Bd(Qn,Qn,sc(),Yp(Zn)),Pf=(Qn,Zn)=>Bd(Qn,Qn,sc(),Xp(Zn)),Tc=Qn=>Bd(Qn,Qn,Km(),Ad()),Fd=(Qn,Zn)=>Bd(Qn,Qn,Km(),Zn),Mg=Qn=>Fd(Qn,w0),$f=Qn=>Fd(Qn,nf),Ly=(Qn,Zn)=>Fd(Qn,C0(Zn)),I1=Qn=>Fd(Qn,_v),Ng=(Qn,Zn)=>Fd(Qn,Xp(Zn)),hh=(Qn,Zn)=>Fd(Qn,Ta(Zn)),np=(Qn,Zn)=>Fd(Qn,mu(Zn)),Gs=(Qn,Zn)=>Bd(Qn,Qn,um(Zn),Ad()),xh=(Qn,Zn,Yn)=>Bd(Qn,Qn,um(Zn),Yn),Lm=(Qn,Zn)=>xh(Qn,Zn,w0),mh=(Qn,Zn)=>xh(Qn,Zn,nf),Eh=(Qn,Zn,Yn)=>xh(Qn,Zn,C0(Yn)),Xd=(Qn,Zn)=>xh(Qn,Zn,Jm),Hd=(Qn,Zn)=>xh(Qn,Zn,_v),Iy=(Qn,Zn)=>xh(Qn,Zn,Sv),Th=(Qn,Zn,Yn)=>xh(Qn,Zn,Xp(Yn)),Kp=(Qn,Zn,Yn)=>xh(Qn,Zn,Ta(Yn)),Ua=Qn=>{let Zn=Qn;return{get:()=>Zn,set:oo=>{Zn=oo}}},Po={generate:Qn=>{if(!to(Qn))throw new Error("cases must be an array");if(Qn.length===0)throw new Error("there must be at least one case");const Zn=[],Yn={};return Qs(Qn,(Jn,oo)=>{const lo=nc(Jn);if(lo.length!==1)throw new Error("one and only one name per case");const mo=lo[0],yo=Jn[mo];if(Yn[mo]!==void 0)throw new Error("duplicate key detected:"+mo);if(mo==="cata")throw new Error("cannot have a case named cata (sorry)");if(!to(yo))throw new Error("case arguments must be an array");Zn.push(mo),Yn[mo]=(...Co)=>{const Ro=Co.length;if(Ro!==yo.length)throw new Error("Wrong number of arguments to case "+mo+". Expected "+yo.length+" ("+yo+"), got "+Ro);return{fold:(...Wo)=>{if(Wo.length!==Qn.length)throw new Error("Wrong number of arguments to fold. Expected "+Qn.length+", got "+Wo.length);return Wo[oo].apply(null,Co)},match:Wo=>{const jo=nc(Wo);if(Zn.length!==jo.length)throw new Error("Wrong number of arguments to match. Expected: "+Zn.join(",")+`
|
||||
Actual: `+jo.join(","));if(!dr(Zn,us=>Fs(jo,us)))throw new Error("Not all branches were specified when using match. Specified: "+jo.join(", ")+`
|
||||
Required: `+Zn.join(", "));return Wo[mo].apply(null,Co)},log:Wo=>{console.log(Wo,{constructors:Zn,constructor:mo,params:Co})}}}}),Yn}};Po.generate([{bothErrors:["error1","error2"]},{firstError:["error1","value2"]},{secondError:["value1","error2"]},{bothValues:["value1","value2"]}]);const Xo=Qn=>{const Zn=[],Yn=[];return Qs(Qn,Jn=>{Jn.fold(oo=>{Zn.push(oo)},oo=>{Yn.push(oo)})}),{errors:Zn,values:Yn}},as=(Qn,Zn)=>{const Yn={};return Zl(Qn,(Jn,oo)=>{Fs(Zn,oo)||(Yn[oo]=Jn)}),Yn},Ms=(Qn,Zn)=>({[Qn]:Zn}),vr=Qn=>{const Zn={};return Qs(Qn,Yn=>{Zn[Yn.key]=Yn.value}),Zn},zr=(Qn,Zn)=>as(Qn,Zn),Jr=(Qn,Zn)=>Ms(Qn,Zn),La=Qn=>vr(Qn),Ol=(Qn,Zn)=>Qn.length===0?yl.value(Zn):yl.value(Lc(Zn,Dm.apply(void 0,Qn))),Xu=Qn=>yl.error(Us(Qn)),Ac=(Qn,Zn)=>{const Yn=Xo(Qn);return Yn.errors.length>0?Xu(Yn.errors):Ol(Yn.values,Zn)},gu=Qn=>So(Qn)?Qn:sr,Uh=(Qn,Zn,Yn)=>{let Jn=Qn.dom;const oo=gu(Yn);for(;Jn.parentNode;){Jn=Jn.parentNode;const lo=Ds.fromDom(Jn),mo=Zn(lo);if(mo.isSome())return mo;if(oo(lo))break}return ko.none()},Jf=(Qn,Zn,Yn)=>{const Jn=Zn(Qn),oo=gu(Yn);return Jn.orThunk(()=>oo(Qn)?ko.none():Uh(Qn,Zn,oo))},hm=(Qn,Zn)=>Oc(Qn.element,Zn.event.target),Jp={can:Js,abort:sr,run:xo},wp=Qn=>{if(!Su(Qn,"can")&&!Su(Qn,"abort")&&!Su(Qn,"run"))throw new Error("EventHandler defined by: "+JSON.stringify(Qn,null,2)+" does not have can, abort, or run!");return{...Jp,...Qn}},B1=(Qn,Zn)=>(...Yn)=>za(Qn,(Jn,oo)=>Jn&&Zn(oo).apply(void 0,Yn),!0),Sc=(Qn,Zn)=>(...Yn)=>za(Qn,(Jn,oo)=>Jn||Zn(oo).apply(void 0,Yn),!1),F1=Qn=>So(Qn)?{can:Js,abort:sr,run:Qn}:Qn,x0=Qn=>{const Zn=B1(Qn,oo=>oo.can),Yn=Sc(Qn,oo=>oo.abort);return{can:Zn,abort:Yn,run:(...oo)=>{Qs(Qn,lo=>{lo.run.apply(void 0,oo)})}}},nd=Mo,mm=nd("touchstart"),Nb=nd("touchmove"),H1=nd("touchend"),Fl=nd("touchcancel"),Xl=nd("mousedown"),Qd=nd("mousemove"),Rf=nd("mouseout"),Cv=nd("mouseup"),eg=nd("mouseover"),Wu=nd("focusin"),pm=nd("focusout"),op=nd("keydown"),Q1=nd("keyup"),o1=nd("input"),E0=nd("change"),Lg=nd("click"),lC=nd("transitioncancel"),V1=nd("transitionend"),By=nd("transitionstart"),z1=nd("selectstart"),Pd=Qn=>Mo("alloy."+Qn),Cp={tap:Pd("tap")},tg=Pd("focus"),W1=Pd("blur.post"),U1=Pd("paste.post"),T0=Pd("receive"),Im=Pd("execute"),md=Pd("focus.item"),ng=Cp.tap,DO=Pd("longpress"),Fy=Pd("sandbox.close"),Hy=Pd("typeahead.cancel"),Z1=Pd("system.init"),Ah=Pd("system.touchmove"),kp=Pd("system.touchend"),s1=Pd("system.scroll"),Ig=Pd("system.resize"),Zh=Pd("system.attached"),xp=Pd("system.detached"),q1=Pd("system.dismissRequested"),hS=Pd("system.repositionRequested"),MO=Pd("focusmanager.shifted"),kv=Pd("slotcontainer.visibility"),j1=Pd("system.external.element.scroll"),xv=Pd("change.tab"),NO=Pd("dismiss.tab"),Ev=Pd("highlight"),Tv=Pd("dehighlight"),Wl=(Qn,Zn)=>{Lb(Qn,Qn.element,Zn,{})},Qa=(Qn,Zn,Yn)=>{Lb(Qn,Qn.element,Zn,Yn)},og=Qn=>{Wl(Qn,Im())},Av=(Qn,Zn,Yn)=>{Lb(Qn,Zn,Yn,{})},Lb=(Qn,Zn,Yn,Jn)=>{const oo={target:Zn,...Jn};Qn.getSystem().triggerEvent(Yn,Zn,oo)},T2=(Qn,Zn,Yn,Jn)=>{const oo={...Jn,target:Zn};Qn.getSystem().triggerEvent(Yn,Zn,oo)},LO=(Qn,Zn,Yn,Jn)=>{Qn.getSystem().triggerEvent(Yn,Zn,Jn.event)},Jc=Qn=>La(Qn),IO=(Qn,Zn)=>({key:Qn,value:wp({abort:Zn})}),Qy=(Qn,Zn)=>({key:Qn,value:wp({can:Zn})}),mS=Qn=>({key:Qn,value:wp({run:(Zn,Yn)=>{Yn.event.prevent()}})}),wr=(Qn,Zn)=>({key:Qn,value:wp({run:Zn})}),sg=(Qn,Zn,Yn)=>({key:Qn,value:wp({run:(Jn,oo)=>{Zn.apply(void 0,[Jn,oo].concat(Yn))}})}),cC=Qn=>Zn=>wr(Qn,Zn),Pv=Qn=>Zn=>({key:Qn,value:wp({run:(Yn,Jn)=>{hm(Yn,Jn)&&Zn(Yn,Jn)}})}),A2=(Qn,Zn)=>wr(Qn,(Yn,Jn)=>{Yn.getSystem().getByUid(Zn).each(oo=>{LO(oo,oo.element,Qn,Jn)})}),A0=(Qn,Zn,Yn)=>{const Jn=Zn.partUids[Yn];return A2(Qn,Jn)},pS=(Qn,Zn)=>wr(Qn,(Yn,Jn)=>{const oo=Jn.event,lo=Yn.getSystem().getByDom(oo.target).getOrThunk(()=>Jf(oo.target,yo=>Yn.getSystem().getByDom(yo).toOptional(),sr).getOr(Yn));Zn(Yn,lo,Jn)}),X1=Qn=>wr(Qn,(Zn,Yn)=>{Yn.cut()}),Y1=Qn=>wr(Qn,(Zn,Yn)=>{Yn.stop()}),rg=(Qn,Zn)=>Pv(Qn)(Zn),eu=Pv(Zh()),ig=Pv(xp()),$v=Pv(Z1()),qh=cC(Im()),Ll=(Qn,Zn)=>{const Jn=(Zn||document).createElement("div");return Jn.innerHTML=Qn,kf(Ds.fromDom(Jn))},Rv=Qn=>Qn.dom.innerHTML,G1=(Qn,Zn)=>{const Jn=vd(Qn).dom,oo=Ds.fromDom(Jn.createDocumentFragment()),lo=Ll(Zn,Jn);Rm(oo,lo),iu(Qn),Id(Qn,oo)},Ib=Qn=>{const Zn=Ds.fromTag("div"),Yn=Ds.fromDom(Qn.dom.cloneNode(!0));return Id(Zn,Yn),Rv(Zn)},BO=(Qn,Zn)=>Ds.fromDom(Qn.dom.cloneNode(Zn)),Vy=Qn=>BO(Qn,!1),uC=Qn=>BO(Qn,!0),Ph=Qn=>{if(rs(Qn))return"#shadow-root";{const Zn=Vy(Qn);return Ib(Zn)}},r1=Qn=>Ph(Qn),ET=(Qn,Zn,Yn)=>Oc(Zn,Qn.element)&&!Oc(Zn,Yn),FO=Jc([Qy(tg(),(Qn,Zn)=>{const Yn=Zn.event,Jn=Yn.originator,oo=Yn.target;return ET(Qn,Jn,oo)?(console.warn(tg()+` did not get interpreted by the desired target.
|
||||
Originator: `+r1(Jn)+`
|
||||
Target: `+r1(oo)+`
|
||||
Check the `+tg()+" event handlers"),!1):!0})]);var P0=Object.freeze({__proto__:null,events:FO});let Uf=0;const ba=Qn=>{const Yn=new Date().getTime(),Jn=Math.floor(Math.random()*1e9);return Uf++,Qn+"_"+Jn+Uf+String(Yn)},P2=Mo("alloy-id-"),gS=Mo("data-alloy-id"),K1=P2(),gm=gS(),J1=(Qn,Zn)=>{const Yn=ba(K1+Qn);return Dv(Zn,Yn),Yn},Dv=(Qn,Zn)=>{Object.defineProperty(Qn.dom,gm,{value:Zn,writable:!0})},$0=Qn=>{const Zn=fc(Qn)?Qn.dom[gm]:null;return ko.from(Zn)},Mv=Qn=>ba(Qn),HO=Go,Ep=Qn=>{const Zn=oo=>`The component must be in a context to execute: ${oo}`+(Qn?`
|
||||
`+r1(Qn().element)+" is not in context.":""),Yn=oo=>()=>{throw new Error(Zn(oo))},Jn=oo=>()=>{console.warn(Zn(oo))};return{debugInfo:Mo("fake"),triggerEvent:Jn("triggerEvent"),triggerFocus:Jn("triggerFocus"),triggerEscape:Jn("triggerEscape"),broadcast:Jn("broadcast"),broadcastOn:Jn("broadcastOn"),broadcastEvent:Jn("broadcastEvent"),build:Yn("build"),buildOrPatch:Yn("buildOrPatch"),addToWorld:Yn("addToWorld"),removeFromWorld:Yn("removeFromWorld"),addToGui:Yn("addToGui"),removeFromGui:Yn("removeFromGui"),getByUid:Yn("getByUid"),getByDom:Yn("getByDom"),isConnected:sr}},ag=Ep(),Nv=(Qn,Zn,Yn)=>{const Jn=Yn.toString(),oo=Jn.indexOf(")")+1,lo=Jn.indexOf("("),mo=Jn.substring(lo+1,oo-1).split(/,\s*/);return Qn.toFunctionAnnotation=()=>({name:Zn,parameters:Tp(mo.slice(0,1).concat(mo.slice(3)))}),Qn},Tp=Qn=>hs(Qn,Zn=>ad(Zn,"/*")?Zn.substring(0,Zn.length-2):Zn),QO=(Qn,Zn)=>{const Yn=Qn.toString(),Jn=Yn.indexOf(")")+1,oo=Yn.indexOf("("),lo=Yn.substring(oo+1,Jn-1).split(/,\s*/);return Qn.toFunctionAnnotation=()=>({name:Zn,parameters:Tp(lo)}),Qn},dC=(Qn,Zn)=>{const Yn=Zn.toString(),Jn=Yn.indexOf(")")+1,oo=Yn.indexOf("("),lo=Yn.substring(oo+1,Jn-1).split(/,\s*/);return Qn.toFunctionAnnotation=()=>({name:"OVERRIDE",parameters:Tp(lo.slice(1))}),Qn},Lv=ba("alloy-premade"),i1=Qn=>(Object.defineProperty(Qn.element.dom,Lv,{value:Qn.uid,writable:!0}),Jr(Lv,Qn)),fC=Qn=>Pl(Qn.dom,Lv),Iv=Qn=>Rr(Qn,Lv),eb=Qn=>dC((Zn,...Yn)=>Qn(Zn.getApis(),Zn,...Yn),Qn),Ap={init:()=>ph({readState:Mo("No State required")})},ph=Qn=>Qn,bS=(Qn,Zn)=>{const Yn=hs(Zn,oo=>hh(oo.name(),[Er("config"),Gs("state",Ap)])),Jn=Lu("component.behaviours",Ta(Yn),Qn.behaviours).fold(oo=>{throw new Error(Gf(oo)+`
|
||||
Complete spec:
|
||||
`+JSON.stringify(Qn,null,2))},Go);return{list:Zn,data:Vl(Jn,oo=>{const lo=oo.map(mo=>({config:mo.config,state:mo.state.init(mo.config)}));return Mo(lo)})}},vS=Qn=>Qn.list,yS=Qn=>Qn.data,Bv=(Qn,Zn)=>{const Yn={};return Zl(Qn,(Jn,oo)=>{Zl(Jn,(lo,mo)=>{const yo=Rr(Yn,mo).getOr([]);Yn[mo]=yo.concat([Zn(oo,lo)])})}),Yn},bm=Qn=>({classes:ho(Qn.classes)?[]:Qn.classes,attributes:ho(Qn.attributes)?{}:Qn.attributes,styles:ho(Qn.styles)?{}:Qn.styles}),Bm=(Qn,Zn)=>({...Qn,attributes:{...Qn.attributes,...Zn.attributes},styles:{...Qn.styles,...Zn.styles},classes:Qn.classes.concat(Zn.classes)}),a1=(Qn,Zn,Yn,Jn)=>{const oo={...Zn};Qs(Yn,Lo=>{oo[Lo.name()]=Lo.exhibit(Qn,Jn)});const lo=Bv(oo,(Lo,Wo)=>({name:Lo,modification:Wo})),mo=Lo=>Ca(Lo,(Wo,jo)=>({...jo.modification,...Wo}),{}),yo=Ca(lo.classes,(Lo,Wo)=>Wo.modification.concat(Lo),[]),Co=mo(lo.attributes),Ro=mo(lo.styles);return bm({classes:yo,attributes:Co,styles:Ro})},VO=(Qn,Zn,Yn,Jn)=>{try{const oo=Ml(Yn,(lo,mo)=>{const yo=lo[Zn],Co=mo[Zn],Ro=Jn.indexOf(yo),Lo=Jn.indexOf(Co);if(Ro===-1)throw new Error("The ordering for "+Qn+" does not have an entry for "+yo+`.
|
||||
Order specified: `+JSON.stringify(Jn,null,2));if(Lo===-1)throw new Error("The ordering for "+Qn+" does not have an entry for "+Co+`.
|
||||
Order specified: `+JSON.stringify(Jn,null,2));return Ro<Lo?-1:Lo<Ro?1:0});return yl.value(oo)}catch(oo){return yl.error([oo])}},hC=(Qn,Zn)=>({handler:Qn,purpose:Zn}),mC=(Qn,Zn)=>({cHandler:Qn,purpose:Zn}),OS=(Qn,Zn)=>mC(ms.apply(void 0,[Qn.handler].concat(Zn)),Qn.purpose),Fv=Qn=>Qn.cHandler,Hv=(Qn,Zn)=>({name:Qn,handler:Zn}),zO=(Qn,Zn)=>{const Yn={};return Qs(Qn,Jn=>{Yn[Jn.name()]=Jn.handlers(Zn)}),Yn},$2=(Qn,Zn,Yn)=>{const Jn={...Yn,...zO(Zn,Qn)};return Bv(Jn,Hv)},WO=(Qn,Zn,Yn,Jn)=>{const oo=$2(Qn,Yn,Jn);return _S(oo,Zn)},Qv=Qn=>{const Zn=F1(Qn);return(Yn,Jn,...oo)=>{const lo=[Yn,Jn].concat(oo);Zn.abort.apply(void 0,lo)?Jn.stop():Zn.can.apply(void 0,lo)&&Zn.run.apply(void 0,lo)}},R2=(Qn,Zn)=>yl.error(["The event ("+Qn+`) has more than one behaviour that listens to it.
|
||||
When this occurs, you must specify an event ordering for the behaviours in your spec (e.g. [ "listing", "toggling" ]).
|
||||
The behaviours that can trigger it are: `+JSON.stringify(hs(Zn,Yn=>Yn.name),null,2)]),zy=(Qn,Zn,Yn)=>{const Jn=Zn[Yn];return Jn?VO("Event: "+Yn,"name",Qn,Jn).map(oo=>{const lo=hs(oo,mo=>mo.handler);return x0(lo)}):R2(Yn,Qn)},_S=(Qn,Zn)=>{const Yn=rd(Qn,(Jn,oo)=>(Jn.length===1?yl.value(Jn[0].handler):zy(Jn,Zn,oo)).map(mo=>{const yo=Qv(mo),Co=Jn.length>1?ga(Zn[oo],Ro=>Br(Jn,Lo=>Lo.name===Ro)).join(" > "):Jn[0].name;return Jr(oo,hC(yo,Co))}));return Ac(Yn,{})},vm="alloy.base.behaviour",Wy=Ta([Bd("dom","dom",sc(),Ta([Er("tag"),Gs("styles",{}),Gs("classes",[]),Gs("attributes",{}),Tc("value"),Tc("innerHtml")])),Er("components"),Er("uid"),Gs("events",{}),Gs("apis",{}),Bd("eventOrder","eventOrder",dm({[Im()]:["disabling",vm,"toggling","typeaheadevents"],[tg()]:[vm,"focusing","keying"],[Z1()]:[vm,"disabling","toggling","representing"],[o1()]:[vm,"representing","streaming","invalidating"],[xp()]:[vm,"representing","item-events","tooltipping"],[Xl()]:["focusing",vm,"item-type-events"],[mm()]:["focusing",vm,"item-type-events"],[eg()]:["item-type-events","tooltipping"],[T0()]:["receiving","reflecting","tooltipping"]}),Ad()),Tc("domModification")]),SS=Qn=>Lu("custom.definition",Wy,Qn),UO=Qn=>({...Qn.dom,uid:Qn.uid,domChildren:hs(Qn.components,Zn=>Zn.element)}),TT=Qn=>Qn.domModification.fold(()=>bm({}),bm),ZO=Qn=>Qn.events,tb=(Qn,Zn)=>{const Yn=Bu(Qn,Zn);return Yn===void 0||Yn===""?[]:Yn.split(" ")},l1=(Qn,Zn,Yn)=>{const oo=tb(Qn,Zn).concat([Yn]);return aa(Qn,Zn,oo.join(" ")),!0},wS=(Qn,Zn,Yn)=>{const Jn=ga(tb(Qn,Zn),oo=>oo!==Yn);return Jn.length>0?aa(Qn,Zn,Jn.join(" ")):_s(Qn,Zn),!1},Vv=Qn=>Qn.dom.classList!==void 0,qO=Qn=>tb(Qn,"class"),pC=(Qn,Zn)=>l1(Qn,"class",Zn),Eu=(Qn,Zn)=>wS(Qn,"class",Zn),lg=(Qn,Zn)=>Fs(qO(Qn),Zn)?Eu(Qn,Zn):pC(Qn,Zn),$d=(Qn,Zn)=>{Vv(Qn)?Qn.dom.classList.add(Zn):pC(Qn,Zn)},gC=Qn=>{(Vv(Qn)?Qn.dom.classList:qO(Qn)).length===0&&_s(Qn,"class")},Yu=(Qn,Zn)=>{Vv(Qn)?Qn.dom.classList.remove(Zn):Eu(Qn,Zn),gC(Qn)},R0=(Qn,Zn)=>{const Yn=Vv(Qn)?Qn.dom.classList.toggle(Zn):lg(Qn,Zn);return gC(Qn),Yn},of=(Qn,Zn)=>Vv(Qn)&&Qn.dom.classList.contains(Zn),od=(Qn,Zn)=>{Qs(Zn,Yn=>{$d(Qn,Yn)})},sp=(Qn,Zn)=>{Qs(Zn,Yn=>{Yu(Qn,Yn)})},CS=(Qn,Zn)=>{Qs(Zn,Yn=>{R0(Qn,Yn)})},Df=(Qn,Zn)=>dr(Zn,Yn=>of(Qn,Yn)),Uy=Qn=>{const Zn=Qn.dom.classList,Yn=new Array(Zn.length);for(let Jn=0;Jn<Zn.length;Jn++){const oo=Zn.item(Jn);oo!==null&&(Yn[Jn]=oo)}return Yn},zv=Qn=>Vv(Qn)?Uy(Qn):qO(Qn),c1=Qn=>Qn.dom.value,Wv=(Qn,Zn)=>{if(Zn===void 0)throw new Error("Value.set was undefined");Qn.dom.value=Zn},Bb=(Qn,Zn,Yn)=>Fh(Qn,Zn).map(oo=>{if(Yn.exists(mo=>!Oc(mo,oo))){const mo=Yn.map(Nd).getOr("span"),yo=Ds.fromTag(mo);return _d(oo,yo),yo}else return oo}),nb=(Qn,Zn,Yn)=>{Yn.fold(()=>Id(Qn,Zn),Jn=>{Oc(Jn,Zn)||(_d(Jn,Zn),am(Jn))})},D2=(Qn,Zn,Yn)=>{const Jn=hs(Zn,Yn),oo=kf(Qn);return Qs(oo.slice(Jn.length),am),Jn},bC=(Qn,Zn,Yn,Jn)=>{const oo=Fh(Qn,Zn),lo=Jn(Yn,oo),mo=Bb(Qn,Zn,oo);return nb(Qn,lo.element,mo),lo},AT=(Qn,Zn,Yn)=>D2(Qn,Zn,(Jn,oo)=>bC(Qn,oo,Jn,Yn)),PT=(Qn,Zn)=>D2(Qn,Zn,(Yn,Jn)=>{const oo=Fh(Qn,Jn);return nb(Qn,Yn,oo),Yn}),cg=(Qn,Zn)=>{const Yn=nc(Qn),Jn=nc(Zn),oo=nr(Jn,Yn),lo=kc(Qn,(mo,yo)=>!Pl(Zn,yo)||mo!==Zn[yo]).t;return{toRemove:oo,toSet:lo}},$h=(Qn,Zn)=>{const{class:Yn,style:Jn,...oo}=ar(Zn),{toSet:lo,toRemove:mo}=cg(Qn.attributes,oo),yo=()=>{Qs(mo,Xs=>_s(Zn,Xs)),Qp(Zn,lo)},Co=jc(Zn),{toSet:Ro,toRemove:Lo}=cg(Qn.styles,Co),Wo=()=>{Qs(Lo,Xs=>El(Zn,Xs)),fu(Zn,Ro)},jo=zv(Zn),es=nr(jo,Qn.classes),us=nr(Qn.classes,jo),Ps=()=>{od(Zn,us),sp(Zn,es)},er=Xs=>{G1(Zn,Xs)},Bs=()=>{const Xs=Qn.domChildren;PT(Zn,Xs)},Ns=()=>{const Xs=Zn,Hr=Qn.value.getOrUndefined();Hr!==c1(Xs)&&Wv(Xs,Hr??"")};return yo(),Ps(),Wo(),Qn.innerHtml.fold(Bs,er),Ns(),Zn},M2=Qn=>{const Zn=Ds.fromTag(Qn.tag);Qp(Zn,Qn.attributes),od(Zn,Qn.classes),fu(Zn,Qn.styles),Qn.innerHtml.each(Jn=>G1(Zn,Jn));const Yn=Qn.domChildren;return Rm(Zn,Yn),Qn.value.each(Jn=>{Wv(Zn,Jn)}),Zn},N2=(Qn,Zn)=>{try{const Yn=$h(Qn,Zn);return ko.some(Yn)}catch{return ko.none()}},Fb=Qn=>Qn.innerHtml.isSome()&&Qn.domChildren.length>0,Zy=(Qn,Zn)=>{const Yn=oo=>Nd(oo)===Qn.tag&&!Fb(Qn)&&!fC(oo),Jn=Zn.filter(Yn).bind(oo=>N2(Qn,oo)).getOrThunk(()=>M2(Qn));return Dv(Jn,Qn.uid),Jn},jO=Qn=>{const Zn=Rr(Qn,"behaviours").getOr({});return fs(nc(Zn),Yn=>{const Jn=Zn[Yn];return Oo(Jn)?[Jn.me]:[]})},XO=(Qn,Zn)=>bS(Qn,Zn),u1=Qn=>{const Zn=jO(Qn);return XO(Qn,Zn)},Uv=(Qn,Zn,Yn)=>{const Jn=UO(Qn),oo=TT(Qn),lo={"alloy.base.modification":oo},mo=Zn.length>0?a1(Yn,lo,Zn,Jn):oo;return Bm(Jn,mo)},Hb=(Qn,Zn,Yn)=>{const Jn={"alloy.base.behaviour":ZO(Qn)};return WO(Yn,Qn.eventOrder,Zn,Jn).getOrDie()},D0=(Qn,Zn)=>{const Yn=()=>Xs,Jn=Ua(ag),oo=Ec(SS(Qn)),lo=u1(Qn),mo=vS(lo),yo=yS(lo),Co=Uv(oo,mo,yo),Ro=Zy(Co,Zn),Lo=Hb(oo,mo,yo),Wo=Ua(oo.components),jo=Hr=>{Jn.set(Hr)},es=()=>{Jn.set(Ep(Yn))},us=()=>{const Hr=kf(Ro),kr=fs(Hr,Or=>Jn.get().getByDom(Or).fold(()=>[],ra));Wo.set(kr)},Ps=Hr=>{const kr=yo;return(So(kr[Hr.name()])?kr[Hr.name()]:()=>{throw new Error("Could not find "+Hr.name()+" in "+JSON.stringify(Qn,null,2))})()},er=Hr=>So(
Line truncated
|
||||
`);return Zs(Zn,Yn=>Yn.indexOf("alloy")>0&&!Br(I2,Jn=>Yn.indexOf(Jn)>-1)).getOr(wC)}else return wC},B2={logEventCut:xo,logEventStopped:xo,logNoParent:xo,logEventNoHandlers:xo,logEventResponse:xo,write:xo},KO=(Qn,Zn,Yn)=>xS(Qn,Zn,Yn),jv=Mo(B2),Qm=Mo([Er("menu"),Er("selectedMenu")]),CC=Mo([Er("item"),Er("selectedItem")]);Mo(Ta(CC().concat(Qm())));const Xv=Mo(Ta(CC())),kC=fm("initSize",[Er("numColumns"),Er("numRows")]),F2=()=>Kf("markers",Xv()),qy=()=>fm("markers",[Er("backgroundMenu")].concat(Qm()).concat(CC())),Wb=Qn=>fm("markers",hs(Qn,Er)),JO=(Qn,Zn,Yn)=>(ES(),Bd(Zn,Zn,Yn,Rg(Jn=>yl.value((...oo)=>Jn.apply(void 0,oo))))),rc=Qn=>JO("onHandler",Qn,um(xo)),Vm=Qn=>JO("onKeyboardHandler",Qn,um(ko.none)),Fg=Qn=>JO("onHandler",Qn,sc()),Yv=Qn=>JO("onKeyboardHandler",Qn,sc()),tu=(Qn,Zn)=>pu(Qn,Mo(Zn)),Gv=Qn=>pu(Qn,Go),e_=Mo(kC),Yd=(Qn,Zn,Yn,Jn,oo,lo,mo,yo=!1)=>({x:Qn,y:Zn,bubble:Yn,direction:Jn,placement:oo,restriction:lo,label:`${mo}-${oo}`,alwaysFit:yo}),Hg=Po.generate([{southeast:[]},{southwest:[]},{northeast:[]},{northwest:[]},{south:[]},{north:[]},{east:[]},{west:[]}]),sb=(Qn,Zn,Yn,Jn,oo,lo,mo,yo,Co)=>Qn.fold(Zn,Yn,Jn,oo,lo,mo,yo,Co),t_=(Qn,Zn,Yn,Jn)=>Qn.fold(Zn,Zn,Jn,Jn,Zn,Jn,Yn,Yn),jy=(Qn,Zn,Yn,Jn)=>Qn.fold(Zn,Jn,Zn,Jn,Yn,Yn,Zn,Jn),Xy=Hg.southeast,TS=Hg.southwest,n_=Hg.northeast,Pp=Hg.northwest,ug=Hg.south,H2=Hg.north,lr=Hg.east,H0=Hg.west,Q0=(Qn,Zn,Yn,Jn)=>{const oo=Qn+Zn;return oo>Jn?Yn:oo<Yn?Jn:oo},rp=(Qn,Zn,Yn)=>Math.min(Math.max(Qn,Zn),Yn),AS=(Qn,Zn)=>{switch(Zn){case 1:return Qn.x;case 0:return Qn.x+Qn.width;case 2:return Qn.y;case 3:return Qn.y+Qn.height}},Uu=(Qn,Zn)=>Kr(["left","right","top","bottom"],Yn=>Rr(Zn,Yn).map(Jn=>AS(Qn,Jn))),o_=(Qn,Zn,Yn)=>{const Jn=(Co,Ro)=>Zn[Co].map(Lo=>{const Wo=Co==="top"||Co==="bottom",jo=Wo?Yn.top:Yn.left,us=(Co==="left"||Co==="top"?Math.max:Math.min)(Lo,Ro)+jo;return Wo?rp(us,Qn.y,Qn.bottom):rp(us,Qn.x,Qn.right)}).getOr(Ro),oo=Jn("left",Qn.x),lo=Jn("top",Qn.y),mo=Jn("right",Qn.right),yo=Jn("bottom",Qn.bottom);return Kc(oo,lo,mo-oo,yo-lo)},rb="layout",PS=Qn=>Qn.x,s_=(Qn,Zn)=>Qn.x+Qn.width/2-Zn.width/2,$S=(Qn,Zn)=>Qn.x+Qn.width-Zn.width,Yy=(Qn,Zn)=>Qn.y-Zn.height,Kv=Qn=>Qn.y+Qn.height,RS=(Qn,Zn)=>Qn.y+Qn.height/2-Zn.height/2,Q2=Qn=>Qn.x+Qn.width,Dd=(Qn,Zn)=>Qn.x-Zn.width,gf=(Qn,Zn,Yn)=>Yd(PS(Qn),Kv(Qn),Yn.southeast(),Xy(),"southeast",Uu(Qn,{left:1,top:3}),rb),eh=(Qn,Zn,Yn)=>Yd($S(Qn,Zn),Kv(Qn),Yn.southwest(),TS(),"southwest",Uu(Qn,{right:0,top:3}),rb),bf=(Qn,Zn,Yn)=>Yd(PS(Qn),Yy(Qn,Zn),Yn.northeast(),n_(),"northeast",Uu(Qn,{left:1,bottom:2}),rb),$l=(Qn,Zn,Yn)=>Yd($S(Qn,Zn),Yy(Qn,Zn),Yn.northwest(),Pp(),"northwest",Uu(Qn,{right:0,bottom:2}),rb),Rh=(Qn,Zn,Yn)=>Yd(s_(Qn,Zn),Yy(Qn,Zn),Yn.north(),H2(),"north",Uu(Qn,{bottom:2}),rb),bu=(Qn,Zn,Yn)=>Yd(s_(Qn,Zn),Kv(Qn),Yn.south(),ug(),"south",Uu(Qn,{top:3}),rb),vf=(Qn,Zn,Yn)=>Yd(Q2(Qn),RS(Qn,Zn),Yn.east(),lr(),"east",Uu(Qn,{left:0}),rb),Gy=(Qn,Zn,Yn)=>Yd(Dd(Qn,Zn),RS(Qn,Zn),Yn.west(),H0(),"west",Uu(Qn,{right:1}),rb),d1=()=>[gf,eh,bf,$l,bu,Rh,vf,Gy],Ky=()=>[eh,gf,$l,bf,bu,Rh,vf,Gy],DS=()=>[bf,$l,gf,eh,Rh,bu],xC=()=>[$l,bf,eh,gf,Rh,bu],r_=()=>[gf,eh,bf,$l,bu,Rh],MS=()=>[eh,gf,$l,bf,bu,Rh],NS=(Qn,Zn)=>Zn.universal?Qn:ga(Qn,Yn=>Fs(Zn.channels,Yn));var f1=Object.freeze({__proto__:null,events:Qn=>Jc([wr(T0(),(Zn,Yn)=>{const Jn=Qn.channels,oo=nc(Jn),lo=Yn,mo=NS(oo,lo);Qs(mo,yo=>{const Co=Jn[yo],Ro=Co.schema,Lo=td("channel["+yo+`] data
|
||||
Receiver: `+r1(Zn.element),Ro,lo.data);Co.onReceive(Zn,Lo)})})])}),EC=[Kf("channels",Dg(yl.value,mu([Fg("onReceive"),Gs("schema",Ad())])))];const ib=(Qn,Zn,Yn)=>qh(Jn=>{Yn(Jn,Qn,Zn)}),Vd=(Qn,Zn,Yn)=>$v((Jn,oo)=>{Yn(Jn,Qn,Zn)}),yf=(Qn,Zn,Yn,Jn,oo,lo)=>{const mo=mu(Qn),yo=hh(Zn,[np("config",Qn)]);return Qg(mo,yo,Zn,Yn,Jn,oo,lo)},z2=(Qn,Zn,Yn,Jn,oo,lo)=>{const mo=Qn,yo=hh(Zn,[Fd("config",Qn)]);return Qg(mo,yo,Zn,Yn,Jn,oo,lo)},ym=(Qn,Zn,Yn)=>Nv((oo,...lo)=>{const mo=[oo].concat(lo);return oo.config({name:Mo(Qn)}).fold(()=>{throw new Error("We could not find any behaviour configuration for: "+Qn+". Using API: "+Yn)},yo=>{const Co=Array.prototype.slice.call(mo,1);return Zn.apply(void 0,[oo,yo.config,yo.state].concat(Co))})},Yn,Zn),$T=Qn=>({key:Qn,value:void 0}),Qg=(Qn,Zn,Yn,Jn,oo,lo,mo)=>{const yo=Wo=>Su(Wo,Yn)?Wo[Yn]():ko.none(),Co=Vl(oo,(Wo,jo)=>ym(Yn,Wo,jo)),Lo={...Vl(lo,(Wo,jo)=>QO(Wo,jo)),...Co,revoke:ms($T,Yn),config:Wo=>{const jo=td(Yn+"-config",Qn,Wo);return{key:Yn,value:{config:jo,me:Lo,configAsRaw:Du(()=>td(Yn+"-config",Qn,Wo)),initialConfig:Wo,state:mo}}},schema:Mo(Zn),exhibit:(Wo,jo)=>ia(yo(Wo),Rr(Jn,"exhibit"),(es,us)=>us(jo,es.config,es.state)).getOrThunk(()=>bm({})),name:Mo(Yn),handlers:Wo=>yo(Wo).map(jo=>Rr(Jn,"events").getOr(()=>({}))(jo.config,jo.state)).getOr({})};return Lo},Zr=Qn=>La(Qn),LS=mu([Er("fields"),Er("name"),Gs("active",{}),Gs("apis",{}),Gs("state",Ap),Gs("extra",{})]),Of=Qn=>{const Zn=td("Creating behaviour: "+Qn.name,LS,Qn);return yf(Zn.fields,Zn.name,Zn.active,Zn.apis,Zn.extra,Zn.state)},IS=mu([Er("branchKey"),Er("branches"),Er("name"),Gs("active",{}),Gs("apis",{}),Gs("state",Ap),Gs("extra",{})]),Ub=Qn=>{const Zn=td("Creating behaviour: "+Qn.name,IS,Qn);return z2(jl(Zn.branchKey,Zn.branches),Zn.name,Zn.active,Zn.apis,Zn.extra,Zn.state)},Jy=Mo(void 0),Om=Of({fields:EC,name:"receiving",active:f1});var eO=Object.freeze({__proto__:null,exhibit:(Qn,Zn)=>bm({classes:[],styles:Zn.useFixed()?{}:{position:"relative"}})});const Cd=(Qn,Zn=!1)=>Qn.dom.focus({preventScroll:Zn}),Vg=Qn=>Qn.dom.blur(),tO=Qn=>{const Zn=rr(Qn).dom;return Qn.dom===Zn.activeElement},h1=(Qn=Op())=>ko.from(Qn.dom.activeElement).map(Ds.fromDom),dg=Qn=>h1(rr(Qn)).filter(Zn=>Qn.dom.contains(Zn.dom)),ma=(Qn,Zn)=>{const Yn=rr(Zn),Jn=h1(Yn).bind(lo=>{const mo=yo=>Oc(lo,yo);return mo(Zn)?ko.some(Zn):SC(Zn,mo)}),oo=Qn(Zn);return Jn.each(lo=>{h1(Yn).filter(mo=>Oc(mo,lo)).fold(()=>{Cd(lo)},xo)}),oo},ip=(Qn,Zn,Yn,Jn,oo)=>{const lo=mo=>mo+"px";return{position:Qn,left:Zn.map(lo),top:Yn.map(lo),right:Jn.map(lo),bottom:oo.map(lo)}},BS=Qn=>({...Qn,position:ko.some(Qn.position)}),m1=(Qn,Zn)=>{Lr(Qn,BS(Zn))},Ic=Po.generate([{none:[]},{relative:["x","y","width","height"]},{fixed:["x","y","width","height"]}]),FS=(Qn,Zn,Yn,Jn,oo,lo)=>{const mo=Zn.rect,yo=mo.x-Yn,Co=mo.y-Jn,Ro=mo.width,Lo=mo.height,Wo=oo-(yo+Ro),jo=lo-(Co+Lo),es=ko.some(yo),us=ko.some(Co),Ps=ko.some(Wo),er=ko.some(jo),Bs=ko.none();return sb(Zn.direction,()=>ip(Qn,es,us,Bs,Bs),()=>ip(Qn,Bs,us,Ps,Bs),()=>ip(Qn,es,Bs,Bs,er),()=>ip(Qn,Bs,Bs,Ps,er),()=>ip(Qn,es,us,Bs,Bs),()=>ip(Qn,es,Bs,Bs,er),()=>ip(Qn,es,us,Bs,Bs),()=>ip(Qn,Bs,us,Ps,Bs))},ap=(Qn,Zn)=>Qn.fold(()=>{const Yn=Zn.rect;return ip("absolute",ko.some(Yn.x),ko.some(Yn.y),ko.none(),ko.none())},(Yn,Jn,oo,lo)=>FS("absolute",Zn,Yn,Jn,oo,lo),(Yn,Jn,oo,lo)=>FS("fixed",Zn,Yn,Jn,oo,lo)),i_=(Qn,Zn)=>{const Yn=ms(Zp,Zn),Jn=Qn.fold(Yn,Yn,()=>{const mo=Af();return Zp(Zn).translate(-mo.left,-mo.top)}),oo=yd(Zn),lo=Vp(Zn);return Kc(Jn.left,Jn.top,oo,lo)},W2=(Qn,Zn)=>Zn.fold(()=>Qn.fold(tf,tf,Kc),Yn=>Qn.fold(Mo(Yn),Mo(Yn),()=>{const Jn=Zu(Qn,Yn.x,Yn.y);return Kc(Jn.left,Jn.top,Yn.width,Yn.height)})),Zu=(Qn,Zn,Yn)=>{const Jn=vc(Zn,Yn),oo=()=>{const lo=Af();return Jn.translate(-lo.left,-lo.top)};return Qn.fold(Mo(Jn),Mo(Jn),oo)},U2=(Qn,Zn,Yn,Jn)=>Qn.fold(Zn,Yn,Jn);Ic.none;const bh=Ic.relative,Zb=Ic.fixed,Z2=(Qn,Zn)=>({anchorBox:Qn,origin:Zn}),q2=(Qn,Zn)=>Z2(Qn,Zn),HS="data-alloy-placement",j2=(Qn,Zn)=>{aa(Qn,HS,Zn)},AC=Qn=>Uo(Qn,HS),PC=Qn=>_s(Qn,HS),nO=Po.generate([{fit:["reposition"]},{nofit:["reposition","visibleW","visibleH","isVisible"]}]),$C=(Qn,Zn)=>{const{x:Yn,y:Jn,right:oo,bottom:lo}=Zn,{x:mo,y:yo,right:Co,bottom:Ro,width:Lo,height:Wo}=Qn,jo=mo>=Yn&&mo<=oo,es=yo>=Jn&&yo<=lo,us=jo&&es,Ps=Co<=oo&&Co>=Yn,er=Ro<=lo&&Ro>=Jn,Bs=Ps&&er,Ns=Math.min(Lo,mo>=Yn?oo-mo:Co-Yn),Xs=Math.min(Wo,yo>=Jn?lo-yo:Ro-Jn);return{originInBounds:us,sizeInBounds:Bs,visibleW:Ns,visibleH:Xs}},QS=(Qn,Zn)=>{const{x:Yn,y:Jn,right:oo,bottom:lo}=Zn,{x:mo,y:yo,width:Co,height:Ro}=Qn,Lo=Math.max(Yn,oo-Co),Wo=Math.max(Jn,lo-Ro),jo=rp(mo,Yn,Lo),es=rp(yo,Jn,Wo),us=Math.min(jo+Co,oo)-jo,Ps=Math.min(es+Ro,lo)-es;return Kc(jo,es,us,Ps)},V0=(Qn,Zn,Yn)=>{const Jn=Mo(Zn.bottom-Yn.y),oo=Mo(Yn.bottom-Zn.y),lo=t_(Qn,oo,oo,Jn),mo=Mo(Zn.right-Yn.x),yo=Mo(Yn.right-Zn.x);return{maxWidth:jy(Qn,yo,yo,mo),maxHeight:lo}},X2=(Qn,Zn,Yn,Jn)=>{const oo=Qn.bubble,lo=oo.offset,mo=o_(Jn,Qn.restriction,lo),yo=Qn.x+lo.left,Co=Qn.y+lo.top,Ro=Kc(yo,Co,Zn,Yn),{originInBounds:Lo,sizeInBounds:Wo,v
Line truncated
|
||||
Known: [`+nc(Jn)+`]
|
||||
Namespace: `+Qn.getOr("none")+`
|
||||
Spec: `+JSON.stringify(Yn,null,2))},oo=>oo.replace()),ck=(Qn,Zn,Yn,Jn)=>fb(Yn)&&Yn.uiType===ak?lk(Qn,Zn,Yn,Jn):fw.single(!1,Mo(Yn)),E_=(Qn,Zn,Yn,Jn)=>ck(Qn,Zn,Yn,Jn).fold((lo,mo)=>{const yo=fb(Yn)?mo(Zn,Yn.config,Yn.validated):mo(Zn),Co=Rr(yo,"components").getOr([]),Ro=fs(Co,Lo=>E_(Qn,Zn,Lo,Jn));return[{...yo,components:Ro}]},(lo,mo)=>{if(fb(Yn)){const yo=mo(Zn,Yn.config,Yn.validated);return Yn.validated.preprocess.getOr(Go)(yo)}else return mo(Zn)}),WT=(Qn,Zn,Yn,Jn)=>fs(Yn,oo=>E_(Qn,Zn,oo,Jn)),hw=(Qn,Zn)=>{let Yn=!1;const Jn=()=>Yn,oo=()=>{if(Yn)throw new Error("Trying to use the same placeholder more than once: "+Qn);return Yn=!0,Zn},lo=()=>Zn.fold((mo,yo)=>mo,(mo,yo)=>mo);return{name:Mo(Qn),required:lo,used:Jn,replace:oo}},Tx=(Qn,Zn,Yn,Jn)=>{const oo=Vl(Jn,(mo,yo)=>hw(yo,mo)),lo=WT(Qn,Zn,Yn,oo);return Zl(oo,mo=>{if(mo.used()===!1&&mo.required())throw new Error("Placeholder: "+mo.name()+` was not found in components list
|
||||
Namespace: `+Qn.getOr("none")+`
|
||||
Components: `+JSON.stringify(Zn.components,null,2))}),lo},Ax=fw.single,k3=fw.multiple,hb=Mo(ak),uk=Po.generate([{required:["data"]},{external:["data"]},{optional:["data"]},{group:["data"]}]),T_=Gs("factory",{sketch:Go}),Nh=Gs("schema",[]),Sf=Er("name"),dk=Bd("pname","pname",hf(Qn=>"<alloy."+ba(Qn.name)+">"),Ad()),mw=pu("schema",()=>[Tc("preprocess")]),fk=Gs("defaults",Mo({})),pw=Gs("overrides",Mo({})),gw=Ta([T_,Nh,Sf,dk,fk,pw]),A_=Ta([T_,Nh,Sf,fk,pw]),UT=Ta([T_,Nh,Sf,dk,fk,pw]),bw=Ta([T_,mw,Sf,Er("unit"),dk,fk,pw]),ZT=Qn=>Qn.fold(ko.some,ko.none,ko.some,ko.some),qT=Qn=>{const Zn=Yn=>Yn.name;return Qn.fold(Zn,Zn,Zn,Zn)},jT=Qn=>Qn.fold(Go,Go,Go,Go),Ug=(Qn,Zn)=>Yn=>{const Jn=td("Converting part type",Zn,Yn);return Qn(Jn)},Xh=Ug(uk.required,gw),v1=Ug(uk.external,A_),up=Ug(uk.optional,UT),vw=Ug(uk.group,bw),hk=Mo("entirety");var XT=Object.freeze({__proto__:null,required:Xh,external:v1,optional:up,group:vw,asNamedPart:ZT,name:qT,asCommon:jT,original:hk});const yw=(Qn,Zn,Yn,Jn)=>Lc(Zn.defaults(Qn,Yn,Jn),Yn,{uid:Qn.partUids[Zn.name]},Zn.overrides(Qn,Yn,Jn)),x3=(Qn,Zn,Yn)=>{const Jn={},oo={};return Qs(Yn,lo=>{lo.fold(mo=>{Jn[mo.pname]=Ax(!0,(yo,Co,Ro)=>mo.factory.sketch(yw(yo,mo,Co,Ro)))},mo=>{const yo=Zn.parts[mo.name];oo[mo.name]=Mo(mo.factory.sketch(yw(Zn,mo,yo[hk()]),yo))},mo=>{Jn[mo.pname]=Ax(!1,(yo,Co,Ro)=>mo.factory.sketch(yw(yo,mo,Co,Ro)))},mo=>{Jn[mo.pname]=k3(!0,(yo,Co,Ro)=>{const Lo=yo[mo.name];return hs(Lo,Wo=>mo.factory.sketch(Lc(mo.defaults(yo,Wo,Ro),Wo,mo.overrides(yo,Wo))))})})}),{internals:Mo(Jn),externals:Mo(oo)}},X0=(Qn,Zn)=>{const Yn={};return Qs(Zn,Jn=>{ZT(Jn).each(oo=>{const lo=Ow(Qn,oo.pname);Yn[oo.name]=mo=>{const yo=td("Part: "+oo.name+" in "+Qn,Ta(oo.schema),mo);return{...lo,config:mo,validated:yo}}})}),Yn},Ow=(Qn,Zn)=>({uiType:hb(),owner:Qn,name:Zn}),Px=(Qn,Zn,Yn)=>({uiType:hb(),owner:Qn,name:Zn,config:Yn,validated:{}}),YT=Qn=>fs(Qn,Zn=>Zn.fold(ko.none,ko.some,ko.none,ko.none).map(Yn=>fm(Yn.name,Yn.schema.concat([Gv(hk())]))).toArray()),GT=Qn=>hs(Qn,qT),$x=(Qn,Zn,Yn)=>x3(Qn,Zn,Yn),mk=(Qn,Zn,Yn)=>Tx(ko.some(Qn),Zn,Zn.components,Yn),Au=(Qn,Zn,Yn)=>{const Jn=Zn.partUids[Yn];return Qn.getSystem().getByUid(Jn).toOptional()},Y0=(Qn,Zn,Yn)=>Au(Qn,Zn,Yn).getOrDie("Could not find part: "+Yn),KT=(Qn,Zn,Yn)=>{const Jn={},oo=Zn.partUids,lo=Qn.getSystem();return Qs(Yn,mo=>{Jn[mo]=Mo(lo.getByUid(oo[mo]))}),Jn},Rx=(Qn,Zn)=>{const Yn=Qn.getSystem();return Vl(Zn.partUids,(Jn,oo)=>Mo(Yn.getByUid(Jn)))},Dx=Qn=>nc(Qn.partUids),fO=(Qn,Zn,Yn)=>{const Jn={},oo=Zn.partUids,lo=Qn.getSystem();return Qs(Yn,mo=>{Jn[mo]=Mo(lo.getByUid(oo[mo]).getOrDie())}),Jn},Mx=(Qn,Zn)=>{const Yn=GT(Zn);return La(hs(Yn,Jn=>({key:Jn,value:Qn+"-"+Jn})))},Nx=Qn=>Bd("partUids","partUids",ss(Zn=>Mx(Zn.uid,Qn)),Ad());var E3=Object.freeze({__proto__:null,generate:X0,generateOne:Px,schemas:YT,names:GT,substitutes:$x,components:mk,defaultUids:Mx,defaultUidsSchema:Nx,getAllParts:Rx,getAllPartNames:Dx,getPart:Au,getPartOrDie:Y0,getParts:KT,getPartsOrDie:fO});const P_=(Qn,Zn)=>(Qn.length>0?[fm("parts",Qn)]:[]).concat([Er("uid"),Gs("dom",{}),Gs("components",[]),Gv("originalSpec"),Gs("debug.sketcher",{})]).concat(Zn),$_=(Qn,Zn,Yn,Jn,oo)=>{const lo=P_(Jn,oo);return td(Qn+" [SpecSchema]",mu(lo.concat(Zn)),Yn)},Lx=(Qn,Zn,Yn,Jn)=>{const oo=fy(Jn),lo=$_(Qn,Zn,oo,[],[]);return Yn(lo,oo)},Ix=(Qn,Zn,Yn,Jn,oo)=>{const lo=fy(oo),mo=YT(Yn),yo=Nx(Yn),Co=$_(Qn,Zn,lo,mo,[yo]),Ro=$x(Qn,Co,Yn),Lo=mk(Qn,Co,Ro.internals());return Jn(Co,Lo,lo,Ro.externals())},y1=Qn=>Pl(Qn,"uid"),fy=Qn=>y1(Qn)?Qn:{...Qn,uid:Mv("uid")},T3=Qn=>Qn.uid!==void 0,_w=mu([Er("name"),Er("factory"),Er("configFields"),Gs("apis",{}),Gs("extraApis",{})]),A3=mu([Er("name"),Er("factory"),Er("configFields"),Er("partFields"),Gs("apis",{}),Gs("extraApis",{})]),Mp=Qn=>{const Zn=td("Sketcher for "+Qn.name,_w,Qn),Yn=lo=>Lx(Zn.name,Zn.configFields,Zn.factory,lo),Jn=Vl(Zn.apis,eb),oo=Vl(Zn.extraApis,(lo,mo)=>QO(lo,mo));return{name:Zn.name,configFields:Zn.configFields,sketch:Yn,...Jn,...oo}},Yh=Qn=>{const Zn=td("Sketcher for "+Qn.name,A3,Qn),Yn=mo=>Ix(Zn.name,Zn.configFields,Zn.partFields,Zn.factory,mo),Jn=X0(Zn.name,Zn.partFields),oo=Vl(Zn.apis,eb),lo=Vl(Zn.extraApis,(mo,yo)=>QO(mo,yo));return{name:Zn.name,partFields:Zn.partFields,configFields:Zn.configFields,sketch:Yn,parts:Jn,...oo,...lo}},hO=Qn=>ef("input")(Qn)&&Bu(Qn,"type")!=="radio"||ef("textarea")(Qn);var JT=Object.freeze({__proto__:null,getCurrent:(Qn,Zn,Yn)=>Zn.find(Qn)});const P3=[Er("find")],ic=Of({fields:P3,name:"composing",apis:JT}),Bx=["input","button","textarea","select"],eA=(Qn,Zn,Yn)=>{(Zn.disabled()?nA:Sw)(Qn,Zn)},Fx=(Qn,Zn)=>Zn.useNative===!0&&Fs(Bx,Nd(Qn.element)),$3=Qn=>cs(Qn.element,"disabled"),R3=Qn=>{aa(Qn.element,"disabled","disabled")},tA=Qn=>{_s(Qn.element,"disabled")},D3=Qn=>Bu(Qn.element,"aria-disabled")==="true",va=Qn=>{aa(Qn.element,"aria-disabled","true")},hy=Qn=>{aa(Qn.element,"aria-disabled","false")},nA=(Qn,Zn,Yn)=>{Zn.disableClass.each(oo=>{$d(Qn.element,oo)}),(Fx(Qn,Zn)?R3:va)(Qn),Zn.onDisabled(Qn)},Sw=(Qn,Zn,Yn)=>{Zn
Line truncated
|
||||
`+tm),hv&&(tm=ov(tm,fl," "),tm=ov(tm,rl," "),tm=ov(tm,Yc," ")),Xs&&sH?Xs.createHTML(tm):tm},Zn.setConfig=function(lc){DY(lc),CT=!0},Zn.clearConfig=function(){f3=null,CT=!1},Zn.isValidAttribute=function(lc,gr,Ia){f3||DY({});const bl=kg(lc),Bf=kg(gr);return tK(bl,Bf,Ia)},Zn.addHook=function(lc,gr){typeof gr=="function"&&(Sa[lc]=Sa[lc]||[],Gx(Sa[lc],gr))},Zn.removeHook=function(lc){if(Sa[lc])return k9(Sa[lc])},Zn.removeHooks=function(lc){Sa[lc]&&(Sa[lc]=[])},Zn.removeAllHooks=function(){Sa={}},Zn}var $5=oE();const gR=Qn=>$5().sanitize(Qn);var _1=tinymce.util.Tools.resolve("tinymce.util.I18n");const L9={indent:!0,outdent:!0,"table-insert-column-after":!0,"table-insert-column-before":!0,"paste-column-after":!0,"paste-column-before":!0,"unordered-list":!0,"list-bull-circle":!0,"list-bull-default":!0,"list-bull-square":!0},R5="temporary-placeholder",bR=Qn=>()=>Rr(Qn,R5).getOr("!not found!"),sE=(Qn,Zn)=>{const Yn=Qn.toLowerCase();if(_1.isRtl()){const Jn=Vc(Yn,"-rtl");return Pl(Zn,Jn)?Jn:Yn}else return Yn},vR=(Qn,Zn)=>Rr(Zn,sE(Qn,Zn)),yR=(Qn,Zn)=>{const Yn=Zn();return vR(Qn,Yn).getOrThunk(bR(Yn))},OR=(Qn,Zn,Yn)=>{const Jn=Zn();return vR(Qn,Jn).or(Yn).getOrThunk(bR(Jn))},I9=Qn=>_1.isRtl()?Pl(L9,Qn):!1,AA=()=>Rl("add-focusable",[eu(Qn=>{GO(Qn.element,"svg").each(Zn=>aa(Zn,"focusable","false"))})]),D5=(Qn,Zn,Yn,Jn)=>{var oo,lo;const mo=I9(Zn)?["tox-icon--flip"]:[],yo=Rr(Yn,sE(Zn,Yn)).or(Jn).getOrThunk(bR(Yn));return{dom:{tag:Qn.tag,attributes:(oo=Qn.attributes)!==null&&oo!==void 0?oo:{},classes:Qn.classes.concat(mo),innerHtml:yo},behaviours:Zr([...(lo=Qn.behaviours)!==null&&lo!==void 0?lo:[],AA()])}},s0=(Qn,Zn,Yn,Jn=ko.none())=>D5(Zn,Qn,Yn(),Jn),B9=(Qn,Zn,Yn)=>{const Jn=Yn(),oo=Zs(Qn,lo=>Pl(Jn,sE(lo,Jn)));return D5(Zn,oo.getOr(R5),Jn,ko.none())},M5={success:"checkmark",error:"warning",err:"error",warning:"warning",warn:"warning",info:"info"},_R=Mp({name:"Notification",factory:Qn=>{const Zn=ou({dom:vO(`<p>${gR(Qn.translationProvider(Qn.text))}</p>`),behaviours:Zr([Cl.config({})])}),Yn=es=>({dom:{tag:"div",classes:["tox-bar"],styles:{width:`${es}%`}}}),Jn=es=>({dom:{tag:"div",classes:["tox-text"],innerHtml:`${es}%`}}),oo=ou({dom:{tag:"div",classes:Qn.progress?["tox-progress-bar","tox-progress-indicator"]:["tox-progress-bar"]},components:[{dom:{tag:"div",classes:["tox-bar-container"]},components:[Yn(0)]},Jn(0)],behaviours:Zr([Cl.config({})])}),yo={updateProgress:(es,us)=>{es.getSystem().isConnected()&&oo.getOpt(es).each(Ps=>{Cl.set(Ps,[{dom:{tag:"div",classes:["tox-bar-container"]},components:[Yn(us)]},Jn(us)])})},updateText:(es,us)=>{if(es.getSystem().isConnected()){const Ps=Zn.get(es);Cl.set(Ps,[wd(us)])}}},Co=Us([Qn.icon.toArray(),Qn.level.toArray(),Qn.level.bind(es=>ko.from(M5[es])).toArray()]),Ro=ou(yh.sketch({dom:{tag:"button",classes:["tox-notification__dismiss","tox-button","tox-button--naked","tox-button--icon"]},components:[s0("close",{tag:"span",classes:["tox-icon"],attributes:{"aria-label":Qn.translationProvider("Close")}},Qn.iconProvider)],action:es=>{Qn.onAction(es)}})),Lo=B9(Co,{tag:"div",classes:["tox-notification__icon"]},Qn.iconProvider),Wo={dom:{tag:"div",classes:["tox-notification__body"]},components:[Zn.asSpec()],behaviours:Zr([Cl.config({})])},jo=[Lo,Wo];return{uid:Qn.uid,dom:{tag:"div",attributes:{role:"alert"},classes:Qn.level.map(es=>["tox-notification","tox-notification--in",`tox-notification--${es}`]).getOr(["tox-notification","tox-notification--in"])},behaviours:Zr([ol.config({}),Rl("notification-events",[wr(Wu(),es=>{Ro.getOpt(es).each(ol.focus)})])]),components:jo.concat(Qn.progress?[oo.asSpec()]:[]).concat(Qn.closeButton?[Ro.asSpec()]:[]),apis:yo}},configFields:[Tc("level"),Er("progress"),Tc("icon"),Er("onAction"),Er("text"),Er("iconProvider"),Er("translationProvider"),Xd("closeButton",!0)],apis:{updateProgress:(Qn,Zn,Yn)=>{Qn.updateProgress(Zn,Yn)},updateText:(Qn,Zn,Yn)=>{Qn.updateText(Zn,Yn)}}});var SR=(Qn,Zn,Yn)=>{const Jn=Zn.backstage.shared,oo=()=>{const Co=au(Ds.fromDom(Qn.getContentAreaContainer())),Ro=tf(),Lo=rp(Ro.x,Co.x,Co.right),Wo=rp(Ro.y,Co.y,Co.bottom),jo=Math.max(Co.right,Ro.right),es=Math.max(Co.bottom,Ro.bottom);return ko.some(Kc(Lo,Wo,jo-Lo,es-Wo))};return{open:(Co,Ro)=>{const Lo=()=>{Ro(),kd.hide(jo)},Wo=gh(_R.sketch({text:Co.text,level:Fs(["success","error","warning","warn","info"],Co.type)?Co.type:void 0,progress:Co.progressBar===!0,icon:Co.icon,closeButton:Co.closeButton,onAction:Lo,iconProvider:Jn.providers.icons,translationProvider:Jn.providers.translate})),jo=gh(kd.sketch({dom:{tag:"div",classes:["tox-notifications-container"]},lazySink:Jn.getSink,fireDismissalEventInstead:{},...Jn.header.isPositionedAtTop()?{}:{fireRepositionEventInstead:{}}}));Yn.add(jo),$o(Co.timeout)&&Co.timeout>0&&$w.setEditorTimeout(Qn,()=>{Lo()},Co.timeout);const us={close:Lo,reposition:()=>{const Ps=Fm(Wo),er={maxHeightFunction:zg()},Bs=Qn.notificationManager.getNotifications();if(Bs[0]===us){const Ns={...Jn.anchors.banner(),overrides:er};kd.showWithinBounds(jo,Ps,{anchor:Ns},oo)}else ws(Bs,Line truncated
|
||||
Cannot use it for: `+r1(Ro.element)+`
|
||||
The conflicting element is`+(Gl(Wo.element)?" ":" not ")+"already in the DOM")},oo=Ro=>{const Lo=Yn(Ro);Su(Zn,Lo)&&Jn(Ro,Lo);const Wo=[Ro];Qn.registerId(Wo,Lo,Ro.events),Zn[Lo]=Ro},lo=Ro=>{$0(Ro.element).each(Lo=>{delete Zn[Lo],Qn.unregisterId(Lo)})};return{find:(Ro,Lo,Wo)=>Qn.find(Ro,Lo,Wo),filter:Ro=>Qn.filterByType(Ro),register:oo,unregister:lo,getById:Ro=>Rr(Zn,Ro)}},rv=Mp({name:"Container",factory:Qn=>{const{attributes:Zn,...Yn}=Qn.dom;return{uid:Qn.uid,dom:{tag:"div",attributes:{role:"presentation",...Zn},...Yn},components:Qn.components,behaviours:j0(Qn.containerBehaviours),events:Qn.events,domModification:Qn.domModification,eventOrder:Qn.eventOrder}},configFields:[Gs("components",[]),Nf("containerBehaviours",[]),Gs("events",{}),Gs("domModification",{}),Gs("eventOrder",{})]}),bP=Qn=>{const Zn=Bs=>Zd(Qn.element).fold(Js,Ns=>Oc(Bs,Ns)),Yn=jI(),Jn=(Bs,Ns)=>Yn.find(Zn,Bs,Ns),oo=FV(Qn.element,{triggerEvent:(Bs,Ns)=>KO(Bs,Ns.target,Xs=>ZD(Jn,Bs,Ns,Xs))}),lo={debugInfo:Mo("real"),triggerEvent:(Bs,Ns,Xs)=>{KO(Bs,Ns,Hr=>ZI(Jn,Bs,Xs,Ns,Hr))},triggerFocus:(Bs,Ns)=>{$0(Bs).fold(()=>{Cd(Bs)},Xs=>{KO(tg(),Bs,Hr=>(QV(Jn,tg(),{originator:Ns,kill:xo,prevent:xo,target:Bs},Bs,Hr),!1))})},triggerEscape:(Bs,Ns)=>{lo.triggerEvent("keydown",Bs.element,Ns.event)},getByUid:Bs=>Ps(Bs),getByDom:Bs=>er(Bs),build:gh,buildOrPatch:YO,addToGui:Bs=>{Co(Bs)},removeFromGui:Bs=>{Ro(Bs)},addToWorld:Bs=>{mo(Bs)},removeFromWorld:Bs=>{yo(Bs)},broadcast:Bs=>{jo(Bs)},broadcastOn:(Bs,Ns)=>{es(Bs,Ns)},broadcastEvent:(Bs,Ns)=>{us(Bs,Ns)},isConnected:Js},mo=Bs=>{Bs.connect(lo),Td(Bs.element)||(Yn.register(Bs),Qs(Bs.components(),mo),lo.triggerEvent(Z1(),Bs.element,{target:Bs.element}))},yo=Bs=>{Td(Bs.element)||(Qs(Bs.components(),yo),Yn.unregister(Bs)),Bs.disconnect()},Co=Bs=>{cy(Qn,Bs)},Ro=Bs=>{Kb(Bs)},Lo=()=>{oo.unbind(),am(Qn.element)},Wo=Bs=>{const Ns=Yn.filter(T0());Qs(Ns,Xs=>{const Hr=Xs.descHandler;Fv(Hr)(Bs)})},jo=Bs=>{Wo({universal:!0,data:Bs})},es=(Bs,Ns)=>{Wo({universal:!1,channels:Bs,data:Ns})},us=(Bs,Ns)=>{const Xs=Yn.filter(Bs);return VV(Xs,Ns)},Ps=Bs=>Yn.getById(Bs).fold(()=>yl.error(new Error('Could not find component with uid: "'+Bs+'" in system.')),yl.value),er=Bs=>{const Ns=$0(Bs).getOr("not found");return Ps(Ns)};return mo(Qn),{root:Qn,element:Qn.element,destroy:Lo,add:Co,remove:Ro,getByUid:Ps,getByDom:er,addToWorld:mo,removeFromWorld:yo,broadcast:jo,broadcastOn:es,broadcastEvent:us}},UV=(Qn,Zn)=>({dom:{tag:"div",classes:["tox-bar","tox-form__controls-h-stack"]},components:hs(Qn.items,Zn.interpreter)}),ZV=Mo([Gs("prefix","form-field"),Nf("fieldBehaviours",[ic,da])]),qV=Mo([up({schema:[Er("dom")],name:"label"}),up({factory:{sketch:Qn=>({uid:Qn.uid,dom:{tag:"span",styles:{display:"none"},attributes:{"aria-hidden":"true"},innerHtml:Qn.text}})},schema:[Er("text")],name:"aria-descriptor"}),Xh({factory:{sketch:Qn=>{const Zn=zr(Qn,["factory"]);return Qn.factory.sketch(Zn)}},schema:[Er("factory")],name:"field"})]),jV=(Qn,Zn,Yn,Jn)=>{const oo=sf(Qn.fieldBehaviours,[ic.config({find:yo=>Au(yo,Qn,"field")}),da.config({store:{mode:"manual",getValue:yo=>ic.getCurrent(yo).bind(da.getValue),setValue:(yo,Co)=>{ic.getCurrent(yo).each(Ro=>{da.setValue(Ro,Co)})}}})]),lo=Jc([eu((yo,Co)=>{const Ro=KT(yo,Qn,["label","field","aria-descriptor"]);Ro.field().each(Lo=>{const Wo=ba(Qn.prefix);Ro.label().each(jo=>{aa(jo.element,"for",Wo),aa(Lo.element,"id",Wo)}),Ro["aria-descriptor"]().each(jo=>{const es=ba(Qn.prefix);aa(jo.element,"id",es),aa(Lo.element,"aria-describedby",es)})})})]),mo={getField:yo=>Au(yo,Qn,"field"),getLabel:yo=>Au(yo,Qn,"label")};return{uid:Qn.uid,dom:Qn.dom,components:Zn,behaviours:oo,events:lo,apis:mo}},su=Yh({name:"FormField",configFields:ZV(),partFields:qV(),factory:jV,apis:{getField:(Qn,Zn)=>Qn.getField(Zn),getLabel:(Qn,Zn)=>Qn.getLabel(Zn)}});var vP=Object.freeze({__proto__:null,exhibit:(Qn,Zn)=>bm({attributes:La([{key:Zn.tabAttr,value:"true"}])})}),XV=[Gs("tabAttr","data-alloy-tabstop")];const sd=Of({fields:XV,name:"tabstopping",active:vP});var YV=tinymce.util.Tools.resolve("tinymce.html.Entities");const TE=(Qn,Zn,Yn,Jn)=>{const oo=KV(Qn,Zn,Yn,Jn);return su.sketch(oo)},GV=(Qn,Zn)=>TE(Qn,Zn,[],[]),KV=(Qn,Zn,Yn,Jn)=>({dom:AE(Yn),components:Qn.toArray().concat([Zn]),fieldBehaviours:Zr(Jn)}),tG=()=>AE([]),AE=Qn=>({tag:"div",classes:["tox-form__group"].concat(Qn)}),yb=(Qn,Zn)=>su.parts.label({dom:{tag:"label",classes:["tox-label"]},components:[wd(Zn.translate(Qn))]}),vg=ba("form-component-change"),Uk=ba("form-close"),U_=ba("form-cancel"),Cy=ba("form-action"),PE=ba("form-submit"),qD=ba("form-block"),jD=ba("form-unblock"),XI=ba("form-tabchange"),YI=ba("form-resize"),JV=(Qn,Zn,Yn)=>{const Jn=Qn.label.map(es=>yb(es,Zn)),oo=Zn.icons(),lo=es=>{var us;return(us=oo[es])!==null&&us!==void 0?us:es},mo=es=>(us,Ps)=>{Bg(Ps.event.target,"[data-collection-item-value]").each(er=>{es(us,Ps,er,Bu(er,"data-collection-item-value"))})},yo=(es,us)=>{const Ps=hs(us,Ns=>{const Xs=_1.translate(Ns.text),Hr=Qn.columns===1?`<div class="tox-collection__item-labLine truncated
|
||||
`+JSON.stringify(Qn));V_.setItem(e$,JSON.stringify(Qn))},XU=Qn=>{const Zn=n6();return Rr(Zn,Qn).getOr([])},s4=(Qn,Zn)=>{if(!o4(Qn))return;const Yn=n6(),Jn=Rr(Yn,Zn).getOr([]),oo=ga(Jn,lo=>lo!==Qn);Yn[Zn]=[Qn].concat(oo).slice(0,t6),t$(Yn)},r2=Qn=>!!Qn,o6=Qn=>Vl(xO.makeMap(Qn,/[, ]/),r2),r4=Qn=>ko.from(W5(Qn)),s6=Qn=>{const Zn=ko.from(TR(Qn)).filter(r2).map(o6);return r4(Qn).fold(sr,Yn=>Zn.fold(Js,Jn=>nc(Jn).length>0?Jn:!1))},r6=(Qn,Zn)=>{const Yn=s6(Qn);return uo(Yn)?Yn?r4(Qn):ko.none():Yn[Zn]?r4(Qn):ko.none()},i6=(Qn,Zn)=>r6(Qn,Zn).map(Yn=>Jn=>Cm.nu(oo=>{const lo=(yo,Co)=>{if(!qn(yo))throw new Error("Expected value to be string");if(Co!==void 0&&!Xn(Co))throw new Error("Expected meta to be a object");oo({value:yo,meta:Co})},mo={filetype:Zn,fieldname:Jn.fieldname,...ko.from(Jn.meta).getOr({})};Yn.call(Qn,lo,Jn.value,mo)})),a6=Qn=>ko.from(Qn).filter(qn).getOrUndefined(),i4=Qn=>AR(Qn)?ko.some({targets:qU.find(Qn.getBody()),anchorTop:a6(MA(Qn)),anchorBottom:a6(Z5(Qn))}):ko.none(),n$=Qn=>ko.from(ER(Qn)),YU=Qn=>({getHistory:XU,addToHistory:s4,getLinkInformation:()=>i4(Qn),getValidationHandler:()=>n$(Qn),getUrlPicker:Zn=>i6(Qn,Zn)}),GU=(Qn,Zn,Yn,Jn)=>{const oo=Ua(!1),lo=km(Zn),mo={icons:()=>Zn.ui.registry.getAll().icons,menuItems:()=>Zn.ui.registry.getAll().menuItems,translate:_1.translate,isDisabled:()=>Zn.mode.isReadOnly()||!Zn.ui.isEnabled(),getOption:Zn.options.get},yo=YU(Zn),Co=LU(Zn),Ro=UF(Zn),Lo=mG(Zn),Wo=()=>oo.get(),jo=er=>oo.set(er),es={shared:{providers:mo,anchors:xU(Zn,Yn,Jn,lo.isPositionedAtTop),header:lo},urlinput:yo,styles:Co,colorinput:Ro,dialog:Lo,isContextMenuOpen:Wo,setContextMenuState:jo},us={...es,shared:{...es.shared,interpreter:er=>UE(er,{},us),getSink:Qn.popup}},Ps={...es,shared:{...es.shared,interpreter:er=>UE(er,{},Ps),getSink:Qn.dialog}};return{popup:us,dialog:Ps}},i2=(Qn,Zn,Yn)=>{const Jn=(Or,qr)=>{Qs([Zn,...Yn],na=>{na.broadcastEvent(Or,qr)})},oo=(Or,qr)=>{Qs([Zn,...Yn],na=>{na.broadcastOn([Or],qr)})},lo=Or=>oo(db(),{target:Or.target}),mo=Op(),yo=Dh(mo,"touchstart",lo),Co=Dh(mo,"touchmove",Or=>Jn(Ah(),Or)),Ro=Dh(mo,"touchend",Or=>Jn(kp(),Or)),Lo=Dh(mo,"mousedown",lo),Wo=Dh(mo,"mouseup",Or=>{Or.raw.button===0&&oo(wx(),{target:Or.target})}),jo=Or=>oo(db(),{target:Ds.fromDom(Or.target)}),es=Or=>{Or.button===0&&oo(wx(),{target:Ds.fromDom(Or.target)})},us=()=>{Qs(Qn.editorManager.get(),Or=>{Qn!==Or&&Or.dispatch("DismissPopups",{relatedTarget:Qn})})},Ps=Or=>Jn(s1(),th(Or)),er=Or=>{oo(uO(),{}),Jn(Ig(),th(Or))},Bs=rr(Ds.fromDom(Qn.getElement())),Ns=a_(Bs,"scroll",Or=>{requestAnimationFrame(()=>{const qr=Qn.getContainer();if(qr!=null){const Dl=W_(Qn,Zn.element).map(Sa=>[Sa.element,...Sa.others]).getOr([]);Br(Dl,Sa=>Oc(Sa,Or.target))&&(Qn.dispatch("ElementScroll",{target:Or.target.dom}),Jn(j1(),Or))}})}),Xs=()=>oo(uO(),{}),Hr=Or=>{Or.state&&oo(db(),{target:Ds.fromDom(Qn.getContainer())})},kr=Or=>{oo(db(),{target:Ds.fromDom(Or.relatedTarget.getContainer())})};Qn.on("PostRender",()=>{Qn.on("click",jo),Qn.on("tap",jo),Qn.on("mouseup",es),Qn.on("mousedown",us),Qn.on("ScrollWindow",Ps),Qn.on("ResizeWindow",er),Qn.on("ResizeEditor",Xs),Qn.on("AfterProgressState",Hr),Qn.on("DismissPopups",kr)}),Qn.on("remove",()=>{Qn.off("click",jo),Qn.off("tap",jo),Qn.off("mouseup",es),Qn.off("mousedown",us),Qn.off("ScrollWindow",Ps),Qn.off("ResizeWindow",er),Qn.off("ResizeEditor",Xs),Qn.off("AfterProgressState",Hr),Qn.off("DismissPopups",kr),Lo.unbind(),yo.unbind(),Co.unbind(),Ro.unbind(),Wo.unbind(),Ns.unbind()}),Qn.on("detach",()=>{Qs([Zn,...Yn],w_),Qs([Zn,...Yn],Or=>Or.destroy())})},rh=E3,Ty=XT,l6=Mo([Gs("shell",!1),Er("makeItem"),Gs("setupItem",xo),Wg.field("listBehaviours",[Cl])]),a4=up({name:"items",overrides:()=>({behaviours:Zr([Cl.config({})])})}),KU=Mo([a4]),JU=Mo("CustomList"),eZ=(Qn,Zn,Yn,Jn)=>{const oo=(yo,Co)=>{mo(yo).fold(()=>{throw console.error("Custom List was defined to not be a shell, but no item container was specified in components"),new Error("Custom List was defined to not be a shell, but no item container was specified in components")},Ro=>{const Lo=Cl.contents(Ro),Wo=Co.length,jo=Wo-Lo.length,es=jo>0?_r(jo,()=>Qn.makeItem()):[],us=Lo.slice(Wo);Qs(us,er=>Cl.remove(Ro,er)),Qs(es,er=>Cl.append(Ro,er));const Ps=Cl.contents(Ro);Qs(Ps,(er,Bs)=>{Qn.setupItem(yo,er,Co[Bs],Bs)})})},lo=Qn.shell?{behaviours:[Cl.config({})],components:[]}:{behaviours:[],components:Zn},mo=yo=>Qn.shell?ko.some(yo):Au(yo,Qn,"items");return{uid:Qn.uid,dom:Qn.dom,components:lo.components,behaviours:sf(Qn.listBehaviours,lo.behaviours),apis:{setItems:oo}}},o$=Yh({name:JU(),configFields:l6(),partFields:KU(),factory:eZ,apis:{setItems:(Qn,Zn,Yn)=>{Qn.setItems(Zn,Yn)}}}),a2=Mo([Er("dom"),Gs("shell",!0),Nf("toolbarBehaviours",[Cl])]),tZ=Mo([up({name:"groups",overrides:()=>({behaviours:Zr([Cl.config({})])})})]),nZ=(Qn,Zn,Yn,Jn)=>{const oo=(yo,Co)=>{lo(yo).fold(()=>{throw console.error("Toolbar was defined to not be a shell, but no groups container was specified in components"),new Error("Toolbar was defined to not be a shell, but n
Line truncated
|
||||
<path fill-rule="evenodd" clip-rule="evenodd" d="M10.143 0c2.608.015 5.186 2.178 5.186 5.331 0 0 .077 3.812-.084 4.87-.361 2.41-2.164 4.074-4.65 4.496-1.453.284-2.523.49-3.212.623-.373.071-.634.122-.785.152-.184.038-.997.145-1.35.145-2.732 0-5.21-2.04-5.248-5.33 0 0 0-3.514.03-4.442.093-2.4 1.758-4.342 4.926-4.963 0 0 3.875-.752 4.036-.782.368-.07.775-.1 1.15-.1Zm1.826 2.8L5.83 3.989v2.393l-2.455.475v5.968l6.137-1.189V9.243l2.456-.476V2.8ZM5.83 6.382l3.682-.713v3.574l-3.682.713V6.382Zm27.173-1.64-.084-1.066h-2.226v9.132h2.456V7.743c-.008-1.151.998-2.064 2.149-2.072 1.15-.008 1.987.92 1.995 2.072v5.065h2.455V7.359c-.015-2.18-1.657-3.929-3.837-3.913a3.993 3.993 0 0 0-2.908 1.296Zm-6.3-4.266L29.16 0v2.387l-2.456.475V.476Zm0 3.2v9.132h2.456V3.676h-2.456Zm18.179 11.787L49.11 3.676H46.58l-1.612 4.527-.46 1.382-.384-1.382-1.611-4.527H39.98l3.3 9.132L42.15 16l2.732-.537ZM22.867 9.738c0 .752.568 1.075.921 1.075.353 0 .668-.047.998-.154l.537 1.765c-.23.154-.92.537-2.225.537-1.305 0-2.655-.997-2.686-2.686a136.877 136.877 0 0 1 0-4.374H18.8V3.676h1.612v-1.98l2.455-.476v2.456h2.302V5.9h-2.302v3.837Z"/>
|
||||
</svg>
|
||||
`;const vN=Qn=>Qn.nodeName==="BR"||!!Qn.getAttribute("data-mce-bogus")||Qn.getAttribute("data-mce-type")==="bookmark",X$=(Qn,Zn,Yn)=>{var Jn;const oo=(Jn=Zn.delimiter)!==null&&Jn!==void 0?Jn:"›",lo=(Ro,Lo,Wo)=>yh.sketch({dom:{tag:"div",classes:["tox-statusbar__path-item"],attributes:{"data-index":Wo,"aria-level":Wo+1}},components:[wd(Ro)],action:jo=>{Qn.focus(),Qn.selection.select(Lo),Qn.nodeChanged()},buttonBehaviours:Zr([Lf.button(Yn.isDisabled),jf()])}),mo=()=>({dom:{tag:"div",classes:["tox-statusbar__path-divider"],attributes:{"aria-hidden":!0}},components:[wd(` ${oo} `)]}),yo=Ro=>za(Ro,(Lo,Wo,jo)=>{const es=lo(Wo.name,Wo.element,jo);return jo===0?Lo.concat([es]):Lo.concat([mo(),es])},[]),Co=Ro=>{const Lo=[];let Wo=Ro.length;for(;Wo-- >0;){const jo=Ro[Wo];if(jo.nodeType===1&&!vN(jo)){const es=cI(Qn,jo);if(es.isDefaultPrevented()||Lo.push({name:es.name,element:jo}),es.isPropagationStopped())break}}return Lo};return{dom:{tag:"div",classes:["tox-statusbar__path"],attributes:{role:"navigation"}},behaviours:Zr([Za.config({mode:"flow",selector:"div[role=button]"}),Ja.config({disabled:Yn.isDisabled}),jf(),sd.config({}),Cl.config({}),Rl("elementPathEvents",[eu((Ro,Lo)=>{Qn.shortcuts.add("alt+F11","focus statusbar elementpath",()=>Za.focusIn(Ro)),Qn.on("NodeChange",Wo=>{const jo=Co(Wo.parents),es=jo.length>0?yo(jo):[];Cl.set(Ro,es)})})])]),components:[]}};var rS;(function(Qn){Qn[Qn.None=0]="None",Qn[Qn.Both=1]="Both",Qn[Qn.Vertical=2]="Vertical"})(rS||(rS={}));const UX=(Qn,Zn,Yn,Jn,oo)=>{const lo={height:cT(Jn+Zn.top,Ek(Qn),CR(Qn))};return Yn===rS.Both&&(lo.width=cT(oo+Zn.left,wR(Qn),$A(Qn))),lo},H8=(Qn,Zn,Yn)=>{const Jn=Ds.fromDom(Qn.getContainer()),oo=UX(Qn,Zn,Yn,cu(Jn),dd(Jn));Zl(oo,(lo,mo)=>{$o(lo)&&ya(Jn,mo,Y4(lo))}),aI(Qn)},ZX=Qn=>{const Zn=j5(Qn);return Zn===!1?rS.None:Zn==="both"?rS.Both:rS.Vertical},Y$=(Qn,Zn,Yn,Jn)=>{const lo=vc(Yn*20,Jn*20);return H8(Qn,lo,Zn),ko.some(!0)},tC=(Qn,Zn)=>{const Yn=ZX(Qn);if(Yn===rS.None)return ko.none();const Jn=Yn===rS.Both?"Press the arrow keys to resize the editor.":"Press the Up and Down arrow keys to resize the editor.";return ko.some(s0("resize-handle",{tag:"div",classes:["tox-statusbar__resize-handle"],attributes:{title:Zn.translate("Resize"),"aria-label":Zn.translate(Jn)},behaviours:[Jw.config({mode:"mouse",repositionTarget:!1,onDrag:(oo,lo,mo)=>H8(Qn,mo,Yn),blockerClass:"tox-blocker"}),Za.config({mode:"special",onLeft:()=>Y$(Qn,Yn,-1,0),onRight:()=>Y$(Qn,Yn,1,0),onUp:()=>Y$(Qn,Yn,0,-1),onDown:()=>Y$(Qn,Yn,0,1)}),sd.config({}),ol.config({})]},Zn.icons))},Q8=(Qn,Zn)=>{const Yn=(Jn,oo,lo)=>Cl.set(Jn,[wd(Zn.translate(["{0} "+lo,oo[lo]]))]);return yh.sketch({dom:{tag:"button",classes:["tox-statusbar__wordcount"]},components:[],buttonBehaviours:Zr([Lf.button(Zn.isDisabled),jf(),sd.config({}),Cl.config({}),da.config({store:{mode:"memory",initialValue:{mode:"words",count:{words:0,characters:0}}}}),Rl("wordcount-events",[qh(Jn=>{const oo=da.getValue(Jn),lo=oo.mode==="words"?"characters":"words";da.setValue(Jn,{mode:lo,count:oo.count}),Yn(Jn,oo.count,lo)}),eu(Jn=>{Qn.on("wordCountUpdate",oo=>{const{mode:lo}=da.getValue(Jn);da.setValue(Jn,{mode:lo,count:oo.wordCount}),Yn(Jn,oo.wordCount,lo)})})])]),eventOrder:{[Im()]:["disabling","alloy.base.behaviour","wordcount-events"]}})},qX=(Qn,Zn)=>{const Yn=()=>({dom:{tag:"span",classes:["tox-statusbar__branding"]},components:[{dom:{tag:"a",attributes:{href:"https://www.tiny.cloud/powered-by-tiny?utm_campaign=poweredby&utm_source=tiny&utm_medium=referral&utm_content=v6",rel:"noopener",target:"_blank","aria-label":_1.translate(["Powered by {0}","Tiny"])},innerHtml:WX.trim()},behaviours:Zr([ol.config({})])}]}),Jn=()=>{const yo=tP("Alt+0");return{dom:{tag:"div",classes:["tox-statusbar__help-text"]},components:[wd(_1.translate(["Press {0} for help",yo]))]}},oo=()=>{const yo=[];return Qn.hasPlugin("wordcount")&&yo.push(Q8(Qn,Zn)),$R(Qn)&&yo.push(Yn()),{dom:{tag:"div",classes:["tox-statusbar__right-container"]},components:yo}},lo=()=>{const yo=[],Co=IA(Qn),Ro=Ak(Qn),Lo=$R(Qn)||Qn.hasPlugin("wordcount"),Wo=()=>{const jo="tox-statusbar__text-container--flex-start",es="tox-statusbar__text-container--flex-end",us="tox-statusbar__text-container--space-around";if(Co){const Ps="tox-statusbar__text-container-3-cols";return!Lo&&!Ro?[Ps,us]:Lo&&!Ro?[Ps,es]:[Ps,jo]}return[Lo&&!Ro?es:jo]};return Ro&&yo.push(X$(Qn,{},Zn)),Co&&yo.push(Jn()),Lo&&yo.push(oo()),yo.length>0?[{dom:{tag:"div",classes:["tox-statusbar__text-container",...Wo()]},components:yo}]:[]};return{dom:{tag:"div",classes:["tox-statusbar"]},components:(()=>{const yo=lo(),Co=tC(Qn,Zn);return yo.concat(Co.toArray())})()}},V8=(Qn,Zn)=>Zn.get().getOrDie(`UI for ${Qn} has not been rendered`),jX=(Qn,Zn)=>{const Yn=Qn.inline,Jn=Yn?U7:Q7,oo=uE(Qn)?C6:rZ,lo=wj(),mo=Hl(),yo=Hl(),Co=Hl(),jo=Tr().deviceType.isTouch()?["tox-platform-touch"]:[],es=MR(Qn),us=Tk(Qn),Ps=ou({dom:{tag:"div",classes:["tox-anchorbar"]}}),er=ou({dom:{tag:"div",classes:["tox-bottom-anchorbar"]}}),Bs=()=>lo.mainUi.get().map(K
Line truncated
|
||||
`+JSON.stringify(Zn,null,2)).message),getBounds:Qn.getDragBounds})])})}),Xh({schema:[Er("dom")],name:"title"}),Xh({factory:yN,schema:[Er("dom")],name:"close"}),Xh({factory:yN,schema:[Er("dom")],name:"body"}),up({factory:yN,schema:[Er("dom")],name:"footer"}),v1({factory:{sketch:(Qn,Zn)=>({...Qn,dom:Zn.dom,components:Zn.components})},schema:[Gs("dom",{tag:"div",styles:{position:"fixed",left:"0px",top:"0px",right:"0px",bottom:"0px"}}),Gs("components",[])],name:"blocker"})]),KX=(Qn,Zn,Yn,Jn)=>{const oo=Hl(),lo=es=>{oo.set(es);const us=Qn.lazySink(es).getOrDie(),Ps=Jn.blocker(),er=us.getSystem().build({...Ps,components:Ps.components.concat([Fm(es)]),behaviours:Zr([ol.config({}),Rl("dialog-blocker-events",[rg(Wu(),()=>{uv.isBlocked(es)?xo():Za.focusIn(es)})])])});cy(us,er),Za.focusIn(es)},mo=es=>{oo.clear(),Zd(es.element).each(us=>{es.getSystem().getByDom(us).each(Ps=>{Kb(Ps)})})},yo=es=>Y0(es,Qn,"body"),Co=es=>Au(es,Qn,"footer"),Ro=(es,us)=>{uv.block(es,us)},Lo=es=>{uv.unblock(es)},Wo=ba("modal-events"),jo={...Qn.eventOrder,[Zh()]:[Wo].concat(Qn.eventOrder["alloy.system.attached"]||[])};return{uid:Qn.uid,dom:Qn.dom,components:Zn,apis:{show:lo,hide:mo,getBody:yo,getFooter:Co,setIdle:Lo,setBusy:Ro},eventOrder:jo,domModification:{attributes:{role:"dialog","aria-modal":"true"}},behaviours:sf(Qn.modalBehaviours,[Cl.config({}),Za.config({mode:"cyclic",onEnter:Qn.onExecute,onEscape:Qn.onEscape,useTabstopAt:Qn.useTabstopAt,firstTabstop:Qn.firstTabstop}),uv.config({getRoot:oo.get}),Rl(Wo,[eu(es=>{XX(es.element,Y0(es,Qn,"title").element)})])])}},If=Yh({name:"ModalDialog",configFields:YX(),partFields:GX(),factory:KX,apis:{show:(Qn,Zn)=>{Qn.show(Zn)},hide:(Qn,Zn)=>{Qn.hide(Zn)},getBody:(Qn,Zn)=>Qn.getBody(Zn),getFooter:(Qn,Zn)=>Qn.getFooter(Zn),setBusy:(Qn,Zn,Yn)=>{Qn.setBusy(Zn,Yn)},setIdle:(Qn,Zn)=>{Qn.setIdle(Zn)}}}),gT=Ta([wf,KR].concat(Bw)),ON=Jm,v2=[GA("button"),S1,Eh("align","end",["start","end"]),Oy,pb,Ly("buttonType",["primary","secondary"])],iS=[...v2,_O],y2=[hd("type",["submit","cancel","custom"]),...iS],JX=[hd("type",["menu"]),yy,mE,S1,Pf("items",gT),...v2],z8=[...v2,hd("type",["togglebutton"]),hc("tooltip"),S1,yy,Xd("active",!1)],W8=jl("type",{submit:y2,cancel:y2,custom:y2,menu:JX,togglebutton:z8}),U8=[wf,_O,hd("level",["info","warn","error","success"]),JR,Gs("url","")],eY=Ta(U8),tY=Qn=>[wf,Qn],nY=[wf,_O,pb,GA("button"),S1,yL,Ly("buttonType",["primary","secondary","toolbar"]),Oy],Z8=Ta(nY),nC=[wf,KR],_b=nC.concat([XA]),oY=nC.concat([jA,pb]),sY=Ta(oY),rY=Jm,q8=_b.concat([OL("auto")]),iY=Ta(q8),aY=Yp([Nk,_O,JR]),lY=_b.concat([mh("storageKey","default")]),_N=Ta(lY),SN=nf,j8=Ta(_b),cY=nf,uY=nC.concat([mh("tag","textarea"),hc("scriptId"),hc("scriptUrl"),Iy("settings",void 0)]),X8=nC.concat([mh("tag","textarea"),ep("init")]),dY=Rg(Qn=>Lu("customeditor.old",mu(X8),Qn).orThunk(()=>Lu("customeditor.new",mu(uY),Qn))),fY=nf,Y8=Ta(_b),hY=RO(),G$=Qn=>[wf,k0("columns"),Qn],_2=[wf,hc("html"),Eh("presets","presentation",["presentation","document"])],K$=Ta(_2),G8=_b.concat([Xd("border",!1),Xd("sandboxed",!0),Xd("streamContent",!1),Xd("transparent",!0)]),J$=Ta(G8),Sg=nf,e3=Ta(nC.concat([$f("height")])),K8=Ta([hc("url"),Mg("zoom"),Mg("cachedWidth"),Mg("cachedHeight")]),J8=_b.concat([$f("inputMode"),$f("placeholder"),Xd("maximized",!1),pb]),mY=Ta(J8),pY=nf,aS=Qn=>[wf,jA,Qn,Eh("align","start",["start","center","end"])],LG=[_O,Nk],gY=[_O,Pf("items",L1("items",()=>wN))],wN=Oa([Ta(LG),Ta(gY)]),S2=_b.concat([Pf("items",wN),pb]),t3=Ta(S2),eH=nf,bY=_b.concat([Mb("items",[_O,Nk]),Lm("size",1),pb]),vY=Ta(bY),yY=nf,OY=_b.concat([Xd("constrain",!0),pb]),w2=Ta(OY),_Y=Ta([hc("width"),hc("height")]),SY=nC.concat([jA,Lm("min",0),Lm("max",0)]),wY=Ta(SY),IG=w0,CY=[wf,Pf("header",nf),Pf("cells",Xp(nf))],kY=Ta(CY),bT=_b.concat([$f("placeholder"),Xd("maximized",!1),pb]),xY=Ta(bT),EY=nf,CN=[hd("type",["directory","leaf"]),gL,hc("id"),Fd("menu",oT)],TY=Ta(CN),Mn=CN.concat([Pf("children",L1("children",()=>Ir("type",{directory:Vn,leaf:TY})))]),Vn=Ta(Mn),Wn=Ir("type",{directory:Vn,leaf:TY}),jn=[wf,Pf("items",Wn),I1("onLeafAction"),I1("onToggleExpand"),Th("defaultExpandedIds",[],nf),$f("defaultSelectedId")],Gn=Ta(jn),no=_b.concat([Eh("filetype","file",["image","media","file"]),pb,$f("picker_text")]),ao=Ta(no),po=Ta([Nk,pE]),vo=Qn=>Bd("items","items",sc(),Xp(Rg(Zn=>Lu(`Checking item of ${Qn}`,Ao,Zn).fold(Yn=>yl.error(Gf(Yn)),Yn=>yl.value(Yn))))),Ao=mf(()=>Ir("type",{alertbanner:eY,bar:Ta(tY(vo("bar"))),button:Z8,checkbox:sY,colorinput:_N,colorpicker:j8,dropzone:Y8,grid:Ta(G$(vo("grid"))),iframe:J$,input:mY,listbox:t3,selectbox:vY,sizeinput:w2,slider:wY,textarea:xY,urlinput:ao,customeditor:dY,htmlpanel:K$,imagepreview:e3,collection:iY,label:Ta(aS(vo("label"))),table:kY,tree:Gn,panel:Qo})),Fo=[wf,Gs("classes",[]),Pf("items",Ao)],Qo=Ta(Fo),qo=[GA("tab"),gL,Pf("items",Ao)],ds=[wf,Mb("tabs",qo)],bs=Ta(ds),ls=iS,ys=W8,Ls=Ta([hc("title"),Kf("body",Ir("type",{panel:Qo,tabpanel:bs})),mh("size","normal"),Th("buttons",[],ys),Gs("initialData",{}),Hd("onAction",xo),Hd(
Line truncated
|
||||
Actual: `+gu.join(","));if(!dr(Po,Jf=>_r(gu,Jf)))throw new Error("Not all branches were specified when using match. Specified: "+gu.join(", ")+`
|
||||
Required: `+Po.join(", "));return Ac[zr].apply(null,La)},log:Ac=>{console.log(Ac,{constructors:Po,constructor:zr,params:La})}}}}),Xo}}.generate([{none:[]},{only:["index"]},{left:["index","next"]},{middle:["prev","index","next"]},{right:["prev","index"]}])});const Oa=(_o,Po)=>{const Xo=Am.fromTable(_o);return Nu(Xo,Po).bind(Ms=>{const vr=Ms[Ms.length-1],zr=Ms[0].row,Jr=vr.row+vr.rowspan,La=Xo.all.slice(zr,Jr);return Rs(La)}).getOr("")},pf=_o=>ah(_o,"rgb")?fh(_o):_o,$O=_o=>{const Po=qa.fromDom(_o);return{borderwidth:rr(Po,"border-width").getOr(""),borderstyle:rr(Po,"border-style").getOr(""),bordercolor:rr(Po,"border-color").map(pf).getOr(""),backgroundcolor:rr(Po,"background-color").map(pf).getOr("")}},Yp=_o=>{const Po=_o[0],Xo=_o.slice(1);return zo(Xo,as=>{zo(Go(Po),Ms=>{ms(as,(vr,zr)=>{const Jr=Po[Ms];Jr!==""&&Ms===zr&&Jr!==vr&&(Po[Ms]="")})})}),Po},Ad=(_o,Po,Xo,as)=>Sr(_o,Ms=>!Kn(Xo.formatter.matchNode(as,Po+Ms))).getOr(""),Pg=xo(Ad,["left","center","right"],"align"),w0=xo(Ad,["top","middle","bottom"],"valign"),nf=(_o,Po)=>{const Xo=Wp(_o),as=zf(_o),Ms=()=>({borderstyle:gs(Xo,"border-style").getOr(""),bordercolor:pf(gs(Xo,"border-color").getOr("")),backgroundcolor:pf(gs(Xo,"background-color").getOr(""))}),vr={height:"",width:"100%",cellspacing:"",cellpadding:"",caption:!1,class:"",align:"",border:""},zr=()=>{const Xu=Xo["border-width"];return $m(_o)&&Xu?{border:Xu}:gs(as,"border").fold(()=>({}),Ac=>({border:Ac}))},Jr=Po?Ms():{},La=()=>{const Xu=gs(Xo,"border-spacing").or(gs(as,"cellspacing")).fold(()=>({}),gu=>({cellspacing:gu})),Ac=gs(Xo,"border-padding").or(gs(as,"cellpadding")).fold(()=>({}),gu=>({cellpadding:gu}));return{...Xu,...Ac}};return{...vr,...Xo,...as,...Jr,...zr(),...La()}},Jm=_o=>ta(qa.fromDom(_o)).map(Po=>{const Xo={selection:t1(_o.cells)};return Oa(Po,Xo)}).getOr(""),_v=(_o,Po,Xo)=>{const as=(Jr,La)=>{const Ol=rr(qa.fromDom(La),"border-width");return $m(_o)&&Ol.isSome()?Ol.getOr(""):Jr.getAttrib(La,"border")||uh(_o.dom,La,"border-width")||uh(_o.dom,La,"border")||""},Ms=_o.dom,vr=$m(_o)?Ms.getStyle(Po,"border-spacing")||Ms.getAttrib(Po,"cellspacing"):Ms.getAttrib(Po,"cellspacing")||Ms.getStyle(Po,"border-spacing"),zr=$m(_o)?uh(Ms,Po,"padding")||Ms.getAttrib(Po,"cellpadding"):Ms.getAttrib(Po,"cellpadding")||uh(Ms,Po,"padding");return{width:Ms.getStyle(Po,"width")||Ms.getAttrib(Po,"width"),height:Ms.getStyle(Po,"height")||Ms.getAttrib(Po,"height"),cellspacing:vr??"",cellpadding:zr??"",border:as(Ms,Po),caption:!!Ms.select("caption",Po)[0],class:Ms.getAttrib(Po,"class",""),align:Pg(_o,Po),...Xo?$O(Po):{}}},Gp=(_o,Po,Xo)=>{const as=_o.dom;return{height:as.getStyle(Po,"height")||as.getAttrib(Po,"height"),class:as.getAttrib(Po,"class",""),type:Jm(Po),align:Pg(_o,Po),...Xo?$O(Po):{}}},Sv=(_o,Po,Xo,as)=>{const Ms=_o.dom,vr=as.getOr(Po),zr=(Jr,La)=>Ms.getStyle(Jr,La)||Ms.getAttrib(Jr,La);return{width:zr(vr,"width"),height:zr(Po,"height"),scope:Ms.getAttrib(Po,"scope"),celltype:nm(Po),class:Ms.getAttrib(Po,"class",""),halign:Pg(_o,Po),valign:w0(_o,Po),...Xo?$O(Po):{}}},$g=(_o,Po)=>{const Xo=Am.fromTable(_o),as=Am.justCells(Xo),Ms=Ca(as,vr=>ha(Po,zr=>Al(vr.element,zr)));return Qs(Ms,vr=>({element:vr.element.dom,column:Am.getColumnAt(Xo,vr.column).map(zr=>zr.element.dom)}))},Ir=(_o,Po,Xo,as)=>{as("scope")&&_o.setAttrib("scope",Xo.scope),as("class")&&_o.setAttrib("class",Xo.class),as("height")&&_o.setStyle("height",oc(Xo.height)),as("width")&&Po.setStyle("width",oc(Xo.width))},RO=(_o,Po,Xo)=>{Xo("backgroundcolor")&&_o.setFormat("tablecellbackgroundcolor",Po.backgroundcolor),Xo("bordercolor")&&_o.setFormat("tablecellbordercolor",Po.bordercolor),Xo("borderstyle")&&_o.setFormat("tablecellborderstyle",Po.borderstyle),Xo("borderwidth")&&_o.setFormat("tablecellborderwidth",oc(Po.borderwidth))},Rg=(_o,Po,Xo,as)=>{const Ms=Po.length===1;zo(Po,vr=>{const zr=vr.element,Jr=Ms?Jo:as,La=Mm.normal(_o,zr),Ol=vr.column.map(Xu=>Mm.normal(_o,Xu)).getOr(La);Ir(La,Ol,Xo,Jr),Ab(_o)&&RO(La,Xo,Jr),as("halign")&&Hh(_o,zr,Xo.halign),as("valign")&&A1(_o,zr,Xo.valign)})},Dg=(_o,Po)=>{_o.execCommand("mceTableCellType",!1,{type:Po.celltype,no_events:!0})},Nm=(_o,Po,Xo,as)=>{const Ms=Ys(as,(vr,zr)=>Xo[zr]!==vr);ko(Ms)>0&&Po.length>=1&&ta(Po[0]).each(vr=>{const zr=$g(vr,Po),Jr=ko(Ys(Ms,(Ol,Xu)=>Xu!=="scope"&&Xu!=="celltype"))>0,La=xs(Ms,"celltype");(Jr||xs(Ms,"scope"))&&Rg(_o,zr,as,xo(xs,Ms)),La&&Dg(_o,as),ql(_o,vr.dom,{structure:La,style:Jr})})},Lu=(_o,Po,Xo,as)=>{const Ms=as.getData();as.close(),_o.undoManager.transact(()=>{Nm(_o,Po,Xo,Ms),_o.focus()})},Ec=(_o,Po)=>{const Xo=ta(Po[0]).map(as=>Qs($g(as,Po),Ms=>Sv(_o,Ms.element,Ab(_o),Ms.column)));return Yp(Xo.getOrDie())},td=_o=>{const Po=uf(_o);if(Po.length===0)return;const Xo=Ec(_o,Po),as={type:"tabpanel",tabs:[{title:"General",name:"general",items:Ov(_o)},Db(_o,"cell")]},Ms={type:"panel",items:[{type:"grid",columns:2,items:Ov(_o)}]};_o.windowManager.open({title:"Cell Properties",size:"normal",body:Ab(_o)?as:Ms,buttons:[{type:"cancel",name:"cancel",text:"Cancel"},{type:"submit",nam
Line truncated
|
||||
`),ws)}),Qr.innerHTML=gs.encode((cr=Qr.textContent)!==null&&cr!==void 0?cr:""),Oo(ko).highlightElement(Qr),gs.setAttrib(Qr,"data-mce-highlighted",!0),Qr.className=os(Qr.className)})})}),ko.on("PreInit",()=>{ko.parser.addNodeFilter("pre",gs=>{var xs;for(let Qr=0,cr=gs.length;Qr<cr;Qr++){const ws=gs[Qr];((xs=ws.attr("class"))!==null&&xs!==void 0?xs:"").indexOf("language-")!==-1&&(ws.attr("contenteditable","false"),ws.attr("data-mce-highlighted","false"))}})})},Yo=(ko,gs=$n)=>xs=>{const Qr=()=>{xs.setEnabled(ko.selection.isEditable()),gs(xs)};return ko.on("NodeChange",Qr),Qr(),()=>{ko.off("NodeChange",Qr)}},Ys=ko=>{const gs=ko.selection.getStart();return ko.dom.is(gs,'pre[class*="language-"]')},sr=ko=>{const gs=()=>ko.execCommand("codesample");ko.ui.registry.addToggleButton("codesample",{icon:"code-sample",tooltip:"Insert/edit code sample",onAction:gs,onSetup:Yo(ko,xs=>{xs.setActive(Ys(ko))})}),ko.ui.registry.addMenuItem("codesample",{text:"Code sample...",icon:"code-sample",onAction:gs,onSetup:Yo(ko)})};var Js=()=>{_n.add("codesample",ko=>{uo(ko),is(ko),sr(ko),Mo(ko),ko.on("dblclick",gs=>{So(gs.target)&&Jo(ko)})})};Js()})();(function(){var _n=tinymce.util.Tools.resolve("tinymce.PluginManager");const Ce=(Ts,ks,ir)=>{var br;return ir(Ts,ks.prototype)?!0:((br=Ts.constructor)===null||br===void 0?void 0:br.name)===ks.name},ke=Ts=>{const ks=typeof Ts;return Ts===null?"null":ks==="object"&&Array.isArray(Ts)?"array":ks==="object"&&Ce(Ts,String,(ir,br)=>br.isPrototypeOf(ir))?"string":ks},$n=Ts=>ks=>ke(ks)===Ts,Hn=$n("string"),zn=$n("object"),Un=$n("array"),qn=Ts=>Ts==null,Xn=Ts=>!qn(Ts);class Kn{constructor(ks,ir){this.tag=ks,this.value=ir}static some(ks){return new Kn(!0,ks)}static none(){return Kn.singletonNone}fold(ks,ir){return this.tag?ir(this.value):ks()}isSome(){return this.tag}isNone(){return!this.tag}map(ks){return this.tag?Kn.some(ks(this.value)):Kn.none()}bind(ks){return this.tag?ks(this.value):Kn.none()}exists(ks){return this.tag&&ks(this.value)}forall(ks){return!this.tag||ks(this.value)}filter(ks){return!this.tag||ks(this.value)?this:Kn.none()}getOr(ks){return this.tag?this.value:ks}or(ks){return this.tag?this:ks}getOrThunk(ks){return this.tag?this.value:ks()}orThunk(ks){return this.tag?this:ks()}getOrDie(ks){if(this.tag)return this.value;throw new Error(ks??"Called getOrDie on None")}static from(ks){return Xn(ks)?Kn.some(ks):Kn.none()}getOrNull(){return this.tag?this.value:null}getOrUndefined(){return this.value}each(ks){this.tag&&ks(this.value)}toArray(){return this.tag?[this.value]:[]}toString(){return this.tag?`some(${this.value})`:"none()"}}Kn.singletonNone=new Kn(!1);const to=Array.prototype.push,io=(Ts,ks)=>{for(let ir=0,br=Ts.length;ir<br;ir++){const Aa=Ts[ir];ks(Aa,ir)}},uo=Ts=>{const ks=[];for(let ir=0,br=Ts.length;ir<br;++ir){if(!Un(Ts[ir]))throw new Error("Arr.flatten item "+ir+" was not an array, input: "+Ts);to.apply(ks,Ts[ir])}return ks},ho=Ts=>{let ks=Ts;return{get:()=>ks,set:Aa=>{ks=Aa}}},bo=Object.keys,Oo=Object.hasOwnProperty,So=(Ts,ks)=>{const ir=bo(Ts);for(let br=0,Aa=ir.length;br<Aa;br++){const Ba=ir[br],_l=Ts[Ba];ks(_l,Ba)}},$o=(Ts,ks)=>Do(Ts,ks)?Kn.from(Ts[ks]):Kn.none(),Do=(Ts,ks)=>Oo.call(Ts,ks),xo=Ts=>ks=>ks.options.get(Ts),Io=Ts=>{const ks=Ts.options.register;ks("audio_template_callback",{processor:"function"}),ks("video_template_callback",{processor:"function"}),ks("iframe_template_callback",{processor:"function"}),ks("media_live_embeds",{processor:"boolean",default:!0}),ks("media_filter_html",{processor:"boolean",default:!0}),ks("media_url_resolver",{processor:"function"}),ks("media_alt_source",{processor:"boolean",default:!0}),ks("media_poster",{processor:"boolean",default:!0}),ks("media_dimensions",{processor:"boolean",default:!0})},Vo=xo("audio_template_callback"),Jo=xo("video_template_callback"),Mo=xo("iframe_template_callback"),Go=xo("media_live_embeds"),os=xo("media_filter_html"),ms=xo("media_url_resolver"),is=xo("media_alt_source"),Yo=xo("media_poster"),Ys=xo("media_dimensions");var sr=tinymce.util.Tools.resolve("tinymce.util.Tools"),Js=tinymce.util.Tools.resolve("tinymce.dom.DOMUtils"),ko=tinymce.util.Tools.resolve("tinymce.html.DomParser");const gs=Js.DOM,xs=Ts=>Ts.replace(/px$/,""),Qr=Ts=>{const ks=Ts.attr("style"),ir=ks?gs.parseStyle(ks):{};return{type:"ephox-embed-iri",source:Ts.attr("data-ephox-embed-iri"),altsource:"",poster:"",width:$o(ir,"max-width").map(xs).getOr(""),height:$o(ir,"max-height").map(xs).getOr("")}},cr=(Ts,ks)=>{let ir={};const Aa=ko({validate:!1,forced_root_block:!1},ks).parse(Ts);for(let Ba=Aa;Ba;Ba=Ba.walk())if(Ba.type===1){const _l=Ba.name;if(Ba.attr("data-ephox-embed-iri")){ir=Qr(Ba);break}else!ir.source&&_l==="param"&&(ir.source=Ba.attr("movie")),(_l==="iframe"||_l==="object"||_l==="embed"||_l==="video"||_l==="audio")&&(ir.type||(ir.type=_l),ir=sr.extend(Ba.attributes.map,ir)),_l==="source"&&(ir.source?ir.altsource||(ir.altsource=Ba.attr("src")):ir.source=Ba.attr("src")),_l==="img"&&!ir.poster&&(ir.poster=Ba.attr("src"))}return ir.source=
Line truncated
|
||||
<source src="`+Ts.altsource+'"'+(Ts.altsourcemime?' type="'+Ts.altsourcemime+'"':"")+` />
|
||||
`:"")+"</audio>",fs=(Ts,ks)=>ks?ks(Ts):'<video width="'+Ts.width+'" height="'+Ts.height+'"'+(Ts.poster?' poster="'+Ts.poster+'"':"")+` controls="controls">
|
||||
<source src="`+Ts.source+'"'+(Ts.sourcemime?' type="'+Ts.sourcemime+'"':"")+` />
|
||||
`+(Ts.altsource?'<source src="'+Ts.altsource+'"'+(Ts.altsourcemime?' type="'+Ts.altsourcemime+'"':"")+` />
|
||||
`:"")+"</video>",dr=(Ts,ks)=>{var ir;const br=sr.extend({},ks);if(!br.source&&(sr.extend(br,cr((ir=br.embed)!==null&&ir!==void 0?ir:"",Ts.schema)),!br.source))return"";br.altsource||(br.altsource=""),br.poster||(br.poster=""),br.source=Ts.convertURL(br.source,"source"),br.altsource=Ts.convertURL(br.altsource,"source"),br.sourcemime=ws(br.source),br.altsourcemime=ws(br.altsource),br.poster=Ts.convertURL(br.poster,"poster");const Aa=Il(br.source);if(Aa&&(br.source=Aa.url,br.type=Aa.type,br.allowfullscreen=Aa.allowFullscreen,br.width=br.width||String(Aa.w),br.height=br.height||String(Aa.h)),br.embed)return el(br.embed,br,!0,Ts.schema);{const Ba=Vo(Ts),_l=Jo(Ts),Hc=Mo(Ts);return br.width=br.width||"300",br.height=br.height||"150",sr.each(br,(Ds,tl)=>{br[tl]=Ts.dom.encode(""+Ds)}),br.type==="iframe"?Zs(br,Hc):br.sourcemime==="application/x-shockwave-flash"?Sr(br):br.sourcemime.indexOf("audio")!==-1?Us(br,Ba):fs(br,_l)}},Vr=Ts=>Ts.hasAttribute("data-mce-object")||Ts.hasAttribute("data-ephox-embed-iri"),nr=Ts=>{Ts.on("click keyup touchend",()=>{const ks=Ts.selection.getNode();ks&&Ts.dom.hasClass(ks,"mce-preview-object")&&Ts.dom.getAttrib(ks,"data-mce-selected")&&ks.setAttribute("data-mce-selected","2")}),Ts.on("ObjectResized",ks=>{const ir=ks.target;if(ir.getAttribute("data-mce-object")){let br=ir.getAttribute("data-mce-html");br&&(br=unescape(br),ir.setAttribute("data-mce-html",escape(el(br,{width:String(ks.width),height:String(ks.height)},!1,Ts.schema))))}})},Kr={},ra=(Ts,ks,ir)=>new Promise((br,Aa)=>{const Ba=_l=>(_l.html&&(Kr[Ts.source]=_l),br({url:Ts.source,html:_l.html?_l.html:ks(Ts)}));Kr[Ts.source]?Ba(Kr[Ts.source]):ir({url:Ts.source},Ba,Aa)}),Ml=(Ts,ks)=>Promise.resolve({html:ks(Ts),url:Ts.source}),xa=Ts=>ks=>dr(Ts,ks),Nl=(Ts,ks)=>{const ir=ms(Ts);return ir?ra(ks,xa(Ts),ir):Ml(ks,xa(Ts))},Zc=Ts=>Do(Kr,Ts),cc=(Ts,ks)=>$o(ks,Ts).bind(ir=>$o(ir,"meta")),gc=(Ts,ks,ir)=>br=>{const Aa=()=>$o(Ts,br),Ba=()=>$o(ks,br),_l=tl=>$o(tl,"value").bind(wu=>wu.length>0?Kn.some(wu):Kn.none()),Hc=()=>Aa().bind(tl=>zn(tl)?_l(tl).orThunk(Ba):Ba().orThunk(()=>Kn.from(tl))),Ds=()=>Ba().orThunk(()=>Aa().bind(tl=>zn(tl)?_l(tl):Kn.from(tl)));return{[br]:(br===ir?Hc():Ds()).getOr("")}},nc=(Ts,ks)=>{const ir={};return $o(Ts,"dimensions").each(br=>{io(["width","height"],Aa=>{$o(ks,Aa).orThunk(()=>$o(br,Aa)).each(Ba=>ir[Aa]=Ba)})}),ir},Ed=(Ts,ks)=>{const ir=ks&&ks!=="dimensions"?cc(ks,Ts).getOr({}):{},br=gc(Ts,ir,ks);return{...br("source"),...br("altsource"),...br("poster"),...br("embed"),...nc(Ts,ir)}},Zl=Ts=>{const ks={...Ts,source:{value:$o(Ts,"source").getOr("")},altsource:{value:$o(Ts,"altsource").getOr("")},poster:{value:$o(Ts,"poster").getOr("")}};return io(["width","height"],ir=>{$o(Ts,ir).each(br=>{const Aa=ks.dimensions||{};Aa[ir]=br,ks.dimensions=Aa})}),ks},Vl=Ts=>ks=>{const ir=ks&&ks.msg?"Media embed handler error: "+ks.msg:"Media embed handler threw unknown error.";Ts.notificationManager.open({type:"error",text:ir})},Fc=Ts=>{const ks=Ts.selection.getNode(),ir=Vr(ks)?Ts.serializer.serialize(ks,{selection:!0}):"",br=cr(ir,Ts.schema),Ba=(()=>{if(Yl(br.source,br.type)){const _l=Ts.dom.getRect(ks);return{width:_l.w.toString().replace(/px$/,""),height:_l.h.toString().replace(/px$/,"")}}else return{}})();return{embed:ir,...br,...Ba}},qa=(Ts,ks)=>ir=>{if(Hn(ir.url)&&ir.url.trim().length>0){const br=ir.html,Ba={...cr(br,ks.schema),source:ir.url,embed:br};Ts.setData(Zl(Ba))}},Ya=(Ts,ks)=>{const ir=Ts.dom.select("*[data-mce-object]");for(let br=0;br<ks.length;br++)for(let Aa=ir.length-1;Aa>=0;Aa--)ks[br]===ir[Aa]&&ir.splice(Aa,1);Ts.selection.select(ir[0])},kc=(Ts,ks)=>{const ir=Ts.dom.select("*[data-mce-object]");Ts.insertContent(ks),Ya(Ts,ir),Ts.nodeChanged()},Yl=(Ts,ks)=>Xn(ks)&&ks==="ephox-embed-iri"&&Xn(Il(Ts)),rd=(Ts,ks)=>((br,Aa)=>br.width!==Aa.width||br.height!==Aa.height)(Ts,ks)&&Yl(ks.source,Ts.type),Al=(Ts,ks,ir)=>{var br;ks.embed=rd(Ts,ks)&&Ys(ir)?dr(ir,{...ks,embed:""}):el((br=ks.embed)!==null&&br!==void 0?br:"",ks,!1,ir.schema),ks.embed&&(Ts.source===ks.source||Zc(ks.source))?kc(ir,ks.embed):Nl(ir,ks).then(Aa=>{kc(ir,Aa.html)}).catch(Vl(ir))},gd=Ts=>{const ks=Fc(Ts),ir=ho(ks),br=Zl(ks),Aa=(ld,oc)=>{const Dc=Ed(oc.getData(),"source");ld.source!==Dc.source&&(qa(Ud,Ts)({url:Dc.source,html:""}),Nl(Ts,Dc).then(qa(Ud,Ts)).catch(Vl(Ts)))},Ba=ld=>{var oc;const Dc=Ed(ld.getData()),bd=cr((oc=Dc.embed)!==null&&oc!==void 0?oc:"",Ts.schema);ld.setData(Zl(bd))},_l=(ld,oc,Dc)=>{const bd=Ed(ld.getData(),oc),Nd=rd(Dc,bd)&&Ys(Ts)?{...bd,embed:""}:bd,ih=dr(Ts,Nd);ld.setData(Zl({...Nd,embed:ih}))},Hc=[{name:"source",type:"urlinput",filetype:"media",label:"Source",picker_text:"Browse files"}],Ds=Ys(Ts)?[{type:"sizeinput",name:"dimensions",label:"Constrain proportions",constrain:!0}]:[],tl={title:"General",name:"general",items:uo([Hc,Ds])},qu={title:"Embed",items:[{type:"textarea",name:"embed",label:"Paste your embed code below:"}]},Md=[];is(Ts)&&Md.push({name:"altsource",type:"urlinput",filetype:"media",label:"Alternative source URL"}),Yo(
Line truncated
|
||||
`));return Yo(Us.split(""),$n).length},Qr=(Zs,Sr)=>{const Us=Js(Zs,Sr).join("");return gs(Us)},cr=(Zs,Sr)=>{const Us=Js(Zs,Sr).join("").replace(/\s/g,"");return gs(Us)},ws=(Zs,Sr)=>()=>Sr(Zs.getBody(),Zs.schema),Fs=(Zs,Sr)=>()=>Sr(Zs.selection.getRng().cloneContents(),Zs.schema),Br=Zs=>ws(Zs,xs),_r=Zs=>({body:{getWordCount:Br(Zs),getCharacterCount:ws(Zs,Qr),getCharacterCountWithoutSpaces:ws(Zs,cr)},selection:{getWordCount:Fs(Zs,xs),getCharacterCount:Fs(Zs,Qr),getCharacterCountWithoutSpaces:Fs(Zs,cr)},getCount:Br(Zs)}),ha=(Zs,Sr)=>{Zs.windowManager.open({title:"Word Count",body:{type:"panel",items:[{type:"table",header:["Count","Document","Selection"],cells:[["Words",String(Sr.body.getWordCount()),String(Sr.selection.getWordCount())],["Characters (no spaces)",String(Sr.body.getCharacterCountWithoutSpaces()),String(Sr.selection.getCharacterCountWithoutSpaces())],["Characters",String(Sr.body.getCharacterCount()),String(Sr.selection.getCharacterCount())]]}]},buttons:[{type:"cancel",name:"close",text:"Close",primary:!0}]})},hs=(Zs,Sr)=>{Zs.addCommand("mceWordCount",()=>ha(Zs,Sr))},Qs=(Zs,Sr)=>{let Us=null;return{cancel:()=>{ke(Us)||(clearTimeout(Us),Us=null)},throttle:(...Vr)=>{ke(Us)&&(Us=setTimeout(()=>{Us=null,Zs.apply(null,Vr)},Sr))}}};var zo=tinymce.util.Tools.resolve("tinymce.util.Delay");const el=(Zs,Sr)=>{Zs.dispatch("wordCountUpdate",{wordCount:{words:Sr.body.getWordCount(),characters:Sr.body.getCharacterCount(),charactersWithoutSpaces:Sr.body.getCharacterCountWithoutSpaces()}})},ga=(Zs,Sr)=>{el(Zs,Sr)},Ca=(Zs,Sr,Us)=>{const fs=Qs(()=>ga(Zs,Sr),Us);Zs.on("init",()=>{ga(Zs,Sr),zo.setEditorTimeout(Zs,()=>{Zs.on("SetContent BeforeAddUndo Undo Redo ViewUpdate keyup",fs.throttle)},0),Zs.on("remove",fs.cancel)})},za=Zs=>{const Sr=()=>Zs.execCommand("mceWordCount");Zs.ui.registry.addButton("wordcount",{tooltip:"Word count",icon:"character-count",onAction:Sr}),Zs.ui.registry.addMenuItem("wordcount",{text:"Word count",icon:"character-count",onAction:Sr})};var Il=(Zs=300)=>{_n.add("wordcount",Sr=>{const Us=_r(Sr);return hs(Sr,Us),za(Sr),Ca(Sr,Us,Zs),Us})};Il()})();function get_each_context$8(_n,Ce,ke){const $n=_n.slice();return $n[14]=Ce[ke],$n}function get_each_context_1$2(_n,Ce,ke){const $n=_n.slice();return $n[17]=Ce[ke],$n}function create_else_block$7(_n){let Ce,ke;return Ce=new Dropdown({props:{$$slots:{button:[create_button_slot$1],default:[create_default_slot$1]},$$scope:{ctx:_n}}}),{c(){create_component(Ce.$$.fragment)},m($n,Hn){mount_component(Ce,$n,Hn),ke=!0},p($n,Hn){const zn={};Hn&1048576&&(zn.$$scope={dirty:Hn,ctx:$n}),Ce.$set(zn)},i($n){ke||(transition_in(Ce.$$.fragment,$n),ke=!0)},o($n){transition_out(Ce.$$.fragment,$n),ke=!1},d($n){destroy_component(Ce,$n)}}}function create_if_block_1$a(_n){let Ce,ke,$n;return{c(){Ce=element("button"),Ce.textContent="Browse",attr(Ce,"class","button")},m(Hn,zn){insert$1(Hn,Ce,zn),ke||($n=listen(Ce,"click",_n[9]),ke=!0)},p:noop,i:noop,o:noop,d(Hn){Hn&&detach(Ce),ke=!1,$n()}}}function create_each_block_1$2(_n){let Ce,ke,$n;function Hn(...zn){return _n[10](_n[17],...zn)}return{c(){Ce=element("a"),Ce.textContent=`${_n[17].label}`,attr(Ce,"class","dropdown-item"),attr(Ce,"href","/")},m(zn,Un){insert$1(zn,Ce,Un),ke||($n=listen(Ce,"click",Hn),ke=!0)},p(zn,Un){_n=zn},d(zn){zn&&detach(Ce),ke=!1,$n()}}}function create_default_slot$1(_n){let Ce,ke=ensure_array_like(_n[3]),$n=[];for(let Hn=0;Hn<ke.length;Hn+=1)$n[Hn]=create_each_block_1$2(get_each_context_1$2(_n,ke,Hn));return{c(){for(let Hn=0;Hn<$n.length;Hn+=1)$n[Hn].c();Ce=empty$1()},m(Hn,zn){for(let Un=0;Un<$n.length;Un+=1)$n[Un]&&$n[Un].m(Hn,zn);insert$1(Hn,Ce,zn)},p(Hn,zn){if(zn&40){ke=ensure_array_like(Hn[3]);let Un;for(Un=0;Un<ke.length;Un+=1){const qn=get_each_context_1$2(Hn,ke,Un);$n[Un]?$n[Un].p(qn,zn):($n[Un]=create_each_block_1$2(qn),$n[Un].c(),$n[Un].m(Ce.parentNode,Ce))}for(;Un<$n.length;Un+=1)$n[Un].d(1);$n.length=ke.length}},d(Hn){Hn&&detach(Ce),destroy_each($n,Hn)}}}function create_button_slot$1(_n){let Ce;return{c(){Ce=element("div"),Ce.textContent="Browse",attr(Ce,"slot","button")},m(ke,$n){insert$1(ke,Ce,$n)},p:noop,d(ke){ke&&detach(Ce)}}}function create_if_block$e(_n){let Ce=[],ke=new Map,$n,Hn,zn=ensure_array_like(_n[2]);const Un=qn=>qn[14].id;for(let qn=0;qn<zn.length;qn+=1){let Xn=get_each_context$8(_n,zn,qn),Kn=Un(Xn);ke.set(Kn,Ce[qn]=create_each_block$8(Kn,Xn))}return{c(){for(let qn=0;qn<Ce.length;qn+=1)Ce[qn].c();$n=empty$1()},m(qn,Xn){for(let Kn=0;Kn<Ce.length;Kn+=1)Ce[Kn]&&Ce[Kn].m(qn,Xn);insert$1(qn,$n,Xn),Hn=!0},p(qn,Xn){Xn&20&&(zn=ensure_array_like(qn[2]),group_outros(),Ce=update_keyed_each(Ce,Xn,Un,1,qn,zn,ke,$n.parentNode,outro_and_destroy_block,create_each_block$8,$n,get_each_context$8),check_outros())},i(qn){if(!Hn){for(let Xn=0;Xn<zn.length;Xn+=1)transition_in(Ce[Xn]);Hn=!0}},o(qn){for(let Xn=0;Xn<Ce.length;Xn+=1)transition_out(Ce[Xn]);Hn=!1},d(qn){qn&&detach($n);for(let Xn=0;Xn<Ce.length;Xn+=1)Ce[Xn].d(qn)}}}function create_each_block$8(_n,Ce){let ke,$n,Hn,zn;return $n=new PreviewFile({p
Line truncated
|
||||
`},W={bold:{tagName:"strong",inheritable:!0,parser(_n){const Ce=window.getComputedStyle(_n);return Ce.fontWeight==="bold"||Ce.fontWeight>=600}},italic:{tagName:"em",inheritable:!0,parser:_n=>window.getComputedStyle(_n).fontStyle==="italic"},href:{groupTagName:"a",parser(_n){const Ce="a:not(".concat(e,")"),ke=_n.closest(Ce);if(ke)return ke.getAttribute("href")}},strike:{tagName:"del",inheritable:!0},frozen:{style:{backgroundColor:"highlight"}}},U={getDefaultHTML:()=>`<div class="trix-button-row">
|
||||
<span class="trix-button-group trix-button-group--text-tools" data-trix-button-group="text-tools">
|
||||
<button type="button" class="trix-button trix-button--icon trix-button--icon-bold" data-trix-attribute="bold" data-trix-key="b" title="`.concat(l.bold,'" tabindex="-1">').concat(l.bold,`</button>
|
||||
<button type="button" class="trix-button trix-button--icon trix-button--icon-italic" data-trix-attribute="italic" data-trix-key="i" title="`).concat(l.italic,'" tabindex="-1">').concat(l.italic,`</button>
|
||||
<button type="button" class="trix-button trix-button--icon trix-button--icon-strike" data-trix-attribute="strike" title="`).concat(l.strike,'" tabindex="-1">').concat(l.strike,`</button>
|
||||
<button type="button" class="trix-button trix-button--icon trix-button--icon-link" data-trix-attribute="href" data-trix-action="link" data-trix-key="k" title="`).concat(l.link,'" tabindex="-1">').concat(l.link,`</button>
|
||||
</span>
|
||||
|
||||
<span class="trix-button-group trix-button-group--block-tools" data-trix-button-group="block-tools">
|
||||
<button type="button" class="trix-button trix-button--icon trix-button--icon-heading-1" data-trix-attribute="heading1" title="`).concat(l.heading1,'" tabindex="-1">').concat(l.heading1,`</button>
|
||||
<button type="button" class="trix-button trix-button--icon trix-button--icon-quote" data-trix-attribute="quote" title="`).concat(l.quote,'" tabindex="-1">').concat(l.quote,`</button>
|
||||
<button type="button" class="trix-button trix-button--icon trix-button--icon-code" data-trix-attribute="code" title="`).concat(l.code,'" tabindex="-1">').concat(l.code,`</button>
|
||||
<button type="button" class="trix-button trix-button--icon trix-button--icon-bullet-list" data-trix-attribute="bullet" title="`).concat(l.bullets,'" tabindex="-1">').concat(l.bullets,`</button>
|
||||
<button type="button" class="trix-button trix-button--icon trix-button--icon-number-list" data-trix-attribute="number" title="`).concat(l.numbers,'" tabindex="-1">').concat(l.numbers,`</button>
|
||||
<button type="button" class="trix-button trix-button--icon trix-button--icon-decrease-nesting-level" data-trix-action="decreaseNestingLevel" title="`).concat(l.outdent,'" tabindex="-1">').concat(l.outdent,`</button>
|
||||
<button type="button" class="trix-button trix-button--icon trix-button--icon-increase-nesting-level" data-trix-action="increaseNestingLevel" title="`).concat(l.indent,'" tabindex="-1">').concat(l.indent,`</button>
|
||||
</span>
|
||||
|
||||
<span class="trix-button-group trix-button-group--file-tools" data-trix-button-group="file-tools">
|
||||
<button type="button" class="trix-button trix-button--icon trix-button--icon-attach" data-trix-action="attachFiles" title="`).concat(l.attachFiles,'" tabindex="-1">').concat(l.attachFiles,`</button>
|
||||
</span>
|
||||
|
||||
<span class="trix-button-group-spacer"></span>
|
||||
|
||||
<span class="trix-button-group trix-button-group--history-tools" data-trix-button-group="history-tools">
|
||||
<button type="button" class="trix-button trix-button--icon trix-button--icon-undo" data-trix-action="undo" data-trix-key="z" title="`).concat(l.undo,'" tabindex="-1">').concat(l.undo,`</button>
|
||||
<button type="button" class="trix-button trix-button--icon trix-button--icon-redo" data-trix-action="redo" data-trix-key="shift+z" title="`).concat(l.redo,'" tabindex="-1">').concat(l.redo,`</button>
|
||||
</span>
|
||||
</div>
|
||||
|
||||
<div class="trix-dialogs" data-trix-dialogs>
|
||||
<div class="trix-dialog trix-dialog--link" data-trix-dialog="href" data-trix-dialog-attribute="href">
|
||||
<div class="trix-dialog__link-fields">
|
||||
<input type="url" name="href" class="trix-input trix-input--dialog" placeholder="`).concat(l.urlPlaceholder,'" aria-label="').concat(l.url,`" required data-trix-input>
|
||||
<div class="trix-button-group">
|
||||
<input type="button" class="trix-button trix-button--dialog" value="`).concat(l.link,`" data-trix-method="setAttribute">
|
||||
<input type="button" class="trix-button trix-button--dialog" value="`).concat(l.unlink,`" data-trix-method="removeAttribute">
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>`)};const q={interval:5e3};var V=Object.freeze({__proto__:null,attachments:i$1,blockAttributes:n,browser:a,css:{attachment:"attachment",attachmentCaption:"attachment__caption",attachmentCaptionEditor:"attachment__caption-editor",attachmentMetadata:"attachment__metadata",attachmentMetadataContainer:"attachment__metadata-container",attachmentName:"attachment__name",attachmentProgress:"attachment__progress",attachmentSize:"attachment__size",attachmentToolbar:"attachment__toolbar",attachmentGallery:"attachment-gallery"},fileSize:u,input:M,keyNames:{8:"backspace",9:"tab",13:"return",27:"escape",37:"left",39:"right",46:"delete",68:"d",72:"h",79:"o"},lang:l,parser:j,textAttributes:W,toolbar:U,undo:q});class H{static proxyMethod(Ce){const{name:ke,toMethod:$n,toProperty:Hn,optional:zn}=z(Ce);this.prototype[ke]=function(){let Un,qn;var Xn,Kn;return $n?qn=zn?(Xn=this[$n])===null||Xn===void 0?void 0:Xn.call(this):this[$n]():Hn&&(qn=this[Hn]),zn?(Un=(Kn=qn)===null||Kn===void 0?void 0:Kn[ke],Un?_.call(Un,qn,arguments):void 0):(Un=qn[ke],_.call(Un,qn,arguments))}}}const z=function(_n){const Ce=_n.match(J);if(!Ce)throw new Error("can't parse @proxyMethod expression: ".concat(_n));const ke={name:Ce[4]};return Ce[2]!=null?ke.toMethod=Ce[1]:ke.toProperty=Ce[1],Ce[3]!=null&&(ke.optional=!0),ke},{apply:_}=Function.prototype,J=new RegExp("^(.+?)(\\(\\))?(\\?)?\\.(.+?)$");var K,G,$;class X extends H{static box(){let Ce=arguments.length>0&&arguments[0]!==void 0?arguments[0]:"";return Ce instanceof this?Ce:this.fromUCS2String(Ce==null?void 0:Ce.toString())}static fromUCS2String(Ce){return new this(Ce,tt(Ce))}static fromCodepoints(Ce){return new this(et(Ce),Ce)}constructor(Ce,ke){super(...arguments),this.ucs2String=Ce,this.codepoints=ke,this.length=this.codepoints.length,this.ucs2Length=this.ucs2String.length}offsetToUCS2Offset(Ce){return et(this.codepoints.slice(0,Math.max(0,Ce))).length}offsetFromUCS2Offset(Ce){return tt(this.ucs2String.slice(0,Math.max(0,Ce))).length}slice(){return this.constructor.fromCodepoints(this.codepoints.slice(...arguments))}charAt(Ce){return this.slice(Ce,Ce+1)}isEqualTo(Ce){return this.constructor.box(Ce).ucs2String===this.ucs2String}toJSON(){return this.ucs2String}getCacheKey(){return this.ucs2String}toString(){return this.ucs2String}}const Y=((K=Array.from)===null||K===void 0?void 0:K.call(Array,"👼").length)===1,Q=((G=" ".codePointAt)===null||G===void 0?void 0:G.call(" ",0))!=null,Z=(($=String.fromCodePoint)===null||$===void 0?void 0:$.call(String,32,128124))===" 👼";let tt,et;tt=Y&&Q?_n=>Array.from(_n).map(Ce=>Ce.codePointAt(0)):function(_n){const Ce=[];let ke=0;const{length:$n}=_n;for(;ke<$n;){let Hn=_n.charCodeAt(ke++);if(55296<=Hn&&Hn<=56319&&ke<$n){const zn=_n.charCodeAt(ke++);(64512&zn)==56320?Hn=((1023&Hn)<<10)+(1023&zn)+65536:ke--}Ce.push(Hn)}return Ce},et=Z?_n=>String.fromCodePoint(...Array.from(_n||[])):function(_n){return(()=>{const Ce=[];return Array.from(_n).forEach(ke=>{let $n="";ke>65535&&(ke-=65536,$n+=String.fromCharCode(ke>>>10&1023|55296),ke=56320|1023&ke),Ce.push($n+String.fromCharCode(ke))}),Ce})().join("")};let it=0;class nt extends H{static fromJSONString(Ce){return this.fromJSON(JSON.parse(Ce))}constructor(){super(...arguments),this.id=++it}hasSameConstructorAs(Ce){return this.constructor===(Ce==null?void 0:Ce.constructor)}isEqualTo(Ce){return this===Ce}inspect(){const Ce=[],ke=this.contentsForInspection()||{};for(const $n in ke){const Hn=ke[$n];Ce.push("".concat($n,"=").concat(Hn))}return"#<".concat(this.constructor.name,":").concat(this.id).concat(Ce.length?" ".concat(Ce.join(", ")):"",">")}contentsForInspection(){}toJSONString(){return JSON.stringify(this)}toUTF16String(){return X.box(this)}getCacheKey(){return this.id.toString()}}const rt=function(){let _n=arguments.length>0&&arguments[0]!==void 0?arguments[0]:[],Ce=arguments.length>1&&arguments[1]!==void 0?arguments[1]:[];if(_n.length!==Ce.length)return!1;for(let ke=0;ke<_n.length;ke++)if(_n[ke]!==Ce[ke])return!1;return!0},ot=function(_n){const Ce=_n.slice(0);for(var ke=arguments.length,$n=new Array(ke>1?ke-1:0),Hn=1;Hn<ke;Hn++)$n[Hn-1]=arguments[Hn];return Ce.splice(...$n),Ce},st=/[\u05BE\u05C0\u05C3\u05D0-\u05EA\u05F0-\u05F4\u061B\u061F\u0621-\u063A\u0640-\u064A\u066D\u0671-\u06B7\u06BA-\u06BE\u06C0-\u06CE\u06D0-\u06D5\u06E5\u06E6\u200F\u202B\u202E\uFB1F-\uFB28\uFB2A-\uFB36\uFB38-\uFB3C\uFB3E\uFB40\uFB41\uFB43\uFB44\uFB46-\uFBB1\uFBD3-\uFD3D\uFD50-\uFD8F\uFD92-\uFDC7\uFDF0-\uFDFB\uFE70-\uFE72\uFE74\uFE76-\uFEFC]/,at=function(){const _n=S$1("input",{dir:"auto",name:"x",dirName:"x.dir"}),Ce=S$1("textarea",{dir:"auto",name:"y",dirName:"y.dir"}),ke=S$1("form");ke.appendChild(_n),ke.appendChild(Ce);const $n=function(){try{return new FormData(ke).has(Ce.dirName)}catch{return!1}}(),Hn=function(){try{return _n.matches(":dir(ltr),:dir(rtl)")}catch{return!1}}();return $n?function(zn){return Ce.value=zn,new FormData(ke).get(Ce.dirName)}:Hn?function(zn){return _n.value=zn,_n.matches(":dir(rtl)")?"rtl":"ltr"}:functionLine truncated
|
||||
`);for(let Hn=0;Hn<$n.length;Hn++){const zn=$n[Hn];if(Hn>0){const Un=S$1("br");ke.push(Un)}if(zn.length){const Un=document.createTextNode(this.preserveSpaces(zn));ke.push(Un)}}return ke}}createElement(){let Ce,ke,$n;const Hn={};for(ke in this.attributes){$n=this.attributes[ke];const Un=pt(ke);if(Un){if(Un.tagName){var zn;const qn=S$1(Un.tagName);zn?(zn.appendChild(qn),zn=qn):Ce=zn=qn}if(Un.styleProperty&&(Hn[Un.styleProperty]=$n),Un.style)for(ke in Un.style)$n=Un.style[ke],Hn[ke]=$n}}if(Object.keys(Hn).length)for(ke in Ce||(Ce=S$1("span")),Hn)$n=Hn[ke],Ce.style[ke]=$n;return Ce}createContainerElement(){for(const Ce in this.attributes){const ke=this.attributes[Ce],$n=pt(Ce);if($n&&$n.groupTagName){const Hn={};return Hn[Ce]=ke,S$1($n.groupTagName,Hn)}}}preserveSpaces(Ce){return this.context.isLast&&(Ce=Ce.replace(/\ $/,d)),Ce=Ce.replace(/(\S)\ {3}(\S)/g,"$1 ".concat(d," $2")).replace(/\ {2}/g,"".concat(d," ")).replace(/\ {2}/g," ".concat(d)),(this.context.isFirst||this.context.followsWhitespace)&&(Ce=Ce.replace(/^\ /,d)),Ce}}class me extends ee{constructor(){super(...arguments),this.text=this.object,this.textConfig=this.options.textConfig}createNodes(){const Ce=[],ke=Xt.groupObjects(this.getPieces()),$n=ke.length-1;for(let zn=0;zn<ke.length;zn++){const Un=ke[zn],qn={};zn===0&&(qn.isFirst=!0),zn===$n&&(qn.isLast=!0),pe(Hn)&&(qn.followsWhitespace=!0);const Xn=this.findOrCreateCachedChildView(ge,Un,{textConfig:this.textConfig,context:qn});Ce.push(...Array.from(Xn.getNodes()||[]));var Hn=Un}return Ce}getPieces(){return Array.from(this.text.getPieces()).filter(Ce=>!Ce.hasAttribute("blockBreak"))}}const pe=_n=>/\s$/.test(_n==null?void 0:_n.toString()),{css:fe}=V;class be extends ee{constructor(){super(...arguments),this.block=this.object,this.attributes=this.block.getAttributes()}createNodes(){const Ce=[document.createComment("block")];if(this.block.isEmpty())Ce.push(S$1("br"));else{var ke;const $n=(ke=gt(this.block.getLastAttribute()))===null||ke===void 0?void 0:ke.text,Hn=this.findOrCreateCachedChildView(me,this.block.text,{textConfig:$n});Ce.push(...Array.from(Hn.getNodes()||[])),this.shouldAddExtraNewlineElement()&&Ce.push(S$1("br"))}if(this.attributes.length)return Ce;{let $n;const{tagName:Hn}=n.default;this.block.isRTL()&&($n={dir:"rtl"});const zn=S$1({tagName:Hn,attributes:$n});return Ce.forEach(Un=>zn.appendChild(Un)),[zn]}}createContainerElement(Ce){const ke={};let $n;const Hn=this.attributes[Ce],{tagName:zn,htmlAttributes:Un=[]}=gt(Hn);if(Ce===0&&this.block.isRTL()&&Object.assign(ke,{dir:"rtl"}),Hn==="attachmentGallery"){const qn=this.block.getBlockBreakPosition();$n="".concat(fe.attachmentGallery," ").concat(fe.attachmentGallery,"--").concat(qn)}return Object.entries(this.block.htmlAttributes).forEach(qn=>{let[Xn,Kn]=qn;Un.includes(Xn)&&(ke[Xn]=Kn)}),S$1({tagName:zn,className:$n,attributes:ke})}shouldAddExtraNewlineElement(){return/\n\n$/.test(this.block.toString())}}class ve extends ee{static render(Ce){const ke=S$1("div"),$n=new this(Ce,{element:ke});return $n.render(),$n.sync(),ke}constructor(){super(...arguments),this.element=this.options.element,this.elementStore=new Qt,this.setDocument(this.object)}setDocument(Ce){Ce.isEqualTo(this.document)||(this.document=this.object=Ce)}render(){if(this.childViews=[],this.shadowElement=S$1("div"),!this.document.isEmpty()){const Ce=Xt.groupObjects(this.document.getBlocks(),{asTree:!0});Array.from(Ce).forEach(ke=>{const $n=this.findOrCreateCachedChildView(be,ke);Array.from($n.getNodes()).map(Hn=>this.shadowElement.appendChild(Hn))})}}isSynced(){return xe(this.shadowElement,this.element)}sync(){const Ce=this.createDocumentFragmentForSync();for(;this.element.lastChild;)this.element.removeChild(this.element.lastChild);return this.element.appendChild(Ce),this.didSync()}didSync(){return this.elementStore.reset(Ae(this.element)),Rt(()=>this.garbageCollectCachedViews())}createDocumentFragmentForSync(){const Ce=document.createDocumentFragment();return Array.from(this.shadowElement.childNodes).forEach(ke=>{Ce.appendChild(ke.cloneNode(!0))}),Array.from(Ae(Ce)).forEach(ke=>{const $n=this.elementStore.remove(ke);$n&&ke.parentNode.replaceChild($n,ke)}),Ce}}const Ae=_n=>_n.querySelectorAll("[data-trix-store-key]"),xe=(_n,Ce)=>ye(_n.innerHTML)===ye(Ce.innerHTML),ye=_n=>_n.replace(/ /g," ");function Re(_n,Ce,ke){return(Ce=Ee(Ce))in _n?Object.defineProperty(_n,Ce,{value:ke,enumerable:!0,configurable:!0,writable:!0}):_n[Ce]=ke,_n}function Ee(_n){var Ce=function(ke,$n){if(typeof ke!="object"||ke===null)return ke;var Hn=ke[Symbol.toPrimitive];if(Hn!==void 0){var zn=Hn.call(ke,$n||"default");if(typeof zn!="object")return zn;throw new TypeError("@@toPrimitive must return a primitive value.")}return($n==="string"?String:Number)(ke)}(_n,"string");return typeof Ce=="symbol"?Ce:String(Ce)}class Se extends nt{static registerType(Ce,ke){ke.type=Ce,this.types[Ce]=ke}static fromJSON(Ce){const ke=this.types[Ce.type];if(ke)return ke.fromJSON(Ce)}constructor(Ce){let ke=arguments.length>1&&a
Line truncated
|
||||
`))(Ce),this.length=this.string.length}getValue(){return this.string}toString(){return this.string.toString()}isBlockBreak(){return this.toString()===`
|
||||
`&&this.getAttribute("blockBreak")===!0}toJSON(){const Ce=super.toJSON(...arguments);return Ce.string=this.string,Ce}canBeConsolidatedWith(Ce){return Ce&&this.hasSameConstructorAs(Ce)&&this.hasSameAttributesAsPiece(Ce)}consolidateWith(Ce){return new this.constructor(this.toString()+Ce.toString(),this.attributes)}splitAtOffset(Ce){let ke,$n;return Ce===0?(ke=null,$n=this):Ce===this.length?(ke=this,$n=null):(ke=new this.constructor(this.string.slice(0,Ce),this.attributes),$n=new this.constructor(this.string.slice(Ce),this.attributes)),[ke,$n]}toConsole(){let{string:Ce}=this;return Ce.length>15&&(Ce=Ce.slice(0,14)+"…"),JSON.stringify(Ce.toString())}}Se.registerType("string",Te);class Be extends nt{static box(Ce){return Ce instanceof this?Ce:new this(Ce)}constructor(){let Ce=arguments.length>0&&arguments[0]!==void 0?arguments[0]:[];super(...arguments),this.objects=Ce.slice(0),this.length=this.objects.length}indexOf(Ce){return this.objects.indexOf(Ce)}splice(){for(var Ce=arguments.length,ke=new Array(Ce),$n=0;$n<Ce;$n++)ke[$n]=arguments[$n];return new this.constructor(ot(this.objects,...ke))}eachObject(Ce){return this.objects.map((ke,$n)=>Ce(ke,$n))}insertObjectAtIndex(Ce,ke){return this.splice(ke,0,Ce)}insertSplittableListAtIndex(Ce,ke){return this.splice(ke,0,...Ce.objects)}insertSplittableListAtPosition(Ce,ke){const[$n,Hn]=this.splitObjectAtPosition(ke);return new this.constructor($n).insertSplittableListAtIndex(Ce,Hn)}editObjectAtIndex(Ce,ke){return this.replaceObjectAtIndex(ke(this.objects[Ce]),Ce)}replaceObjectAtIndex(Ce,ke){return this.splice(ke,1,Ce)}removeObjectAtIndex(Ce){return this.splice(Ce,1)}getObjectAtIndex(Ce){return this.objects[Ce]}getSplittableListInRange(Ce){const[ke,$n,Hn]=this.splitObjectsAtRange(Ce);return new this.constructor(ke.slice($n,Hn+1))}selectSplittableList(Ce){const ke=this.objects.filter($n=>Ce($n));return new this.constructor(ke)}removeObjectsInRange(Ce){const[ke,$n,Hn]=this.splitObjectsAtRange(Ce);return new this.constructor(ke).splice($n,Hn-$n+1)}transformObjectsInRange(Ce,ke){const[$n,Hn,zn]=this.splitObjectsAtRange(Ce),Un=$n.map((qn,Xn)=>Hn<=Xn&&Xn<=zn?ke(qn):qn);return new this.constructor(Un)}splitObjectsAtRange(Ce){let ke,[$n,Hn,zn]=this.splitObjectAtPosition(Pe(Ce));return[$n,ke]=new this.constructor($n).splitObjectAtPosition(Ie(Ce)+zn),[$n,Hn,ke-1]}getObjectAtPosition(Ce){const{index:ke}=this.findIndexAndOffsetAtPosition(Ce);return this.objects[ke]}splitObjectAtPosition(Ce){let ke,$n;const{index:Hn,offset:zn}=this.findIndexAndOffsetAtPosition(Ce),Un=this.objects.slice(0);if(Hn!=null)if(zn===0)ke=Hn,$n=0;else{const qn=this.getObjectAtIndex(Hn),[Xn,Kn]=qn.splitAtOffset(zn);Un.splice(Hn,1,Xn,Kn),ke=Hn+1,$n=Xn.getLength()-zn}else ke=Un.length,$n=0;return[Un,ke,$n]}consolidate(){const Ce=[];let ke=this.objects[0];return this.objects.slice(1).forEach($n=>{var Hn,zn;(Hn=(zn=ke).canBeConsolidatedWith)!==null&&Hn!==void 0&&Hn.call(zn,$n)?ke=ke.consolidateWith($n):(Ce.push(ke),ke=$n)}),ke&&Ce.push(ke),new this.constructor(Ce)}consolidateFromIndexToIndex(Ce,ke){const $n=this.objects.slice(0).slice(Ce,ke+1),Hn=new this.constructor($n).consolidate().toArray();return this.splice(Ce,$n.length,...Hn)}findIndexAndOffsetAtPosition(Ce){let ke,$n=0;for(ke=0;ke<this.objects.length;ke++){const Hn=$n+this.objects[ke].getLength();if($n<=Ce&&Ce<Hn)return{index:ke,offset:Ce-$n};$n=Hn}return{index:null,offset:null}}findPositionAtIndexAndOffset(Ce,ke){let $n=0;for(let Hn=0;Hn<this.objects.length;Hn++){const zn=this.objects[Hn];if(Hn<Ce)$n+=zn.getLength();else if(Hn===Ce){$n+=ke;break}}return $n}getEndPosition(){return this.endPosition==null&&(this.endPosition=0,this.objects.forEach(Ce=>this.endPosition+=Ce.getLength())),this.endPosition}toString(){return this.objects.join("")}toArray(){return this.objects.slice(0)}toJSON(){return this.toArray()}isEqualTo(Ce){return super.isEqualTo(...arguments)||Fe(this.objects,Ce==null?void 0:Ce.objects)}contentsForInspection(){return{objects:"[".concat(this.objects.map(Ce=>Ce.inspect()).join(", "),"]")}}}const Fe=function(_n){let Ce=arguments.length>1&&arguments[1]!==void 0?arguments[1]:[];if(_n.length!==Ce.length)return!1;let ke=!0;for(let $n=0;$n<_n.length;$n++){const Hn=_n[$n];ke&&!Hn.isEqualTo(Ce[$n])&&(ke=!1)}return ke},Pe=_n=>_n[0],Ie=_n=>_n[1];class Ne extends nt{static textForAttachmentWithAttributes(Ce,ke){return new this([new we(Ce,ke)])}static textForStringWithAttributes(Ce,ke){return new this([new Te(Ce,ke)])}static fromJSON(Ce){return new this(Array.from(Ce).map(ke=>Se.fromJSON(ke)))}constructor(){let Ce=arguments.length>0&&arguments[0]!==void 0?arguments[0]:[];super(...arguments);const ke=Ce.filter($n=>!$n.isEmpty());this.pieceList=new Be(ke)}copy(){return this.copyWithPieceList(this.pieceList)}copyWithPieceList(Ce){return new this.constructor(Ce.consolidate().toArray())}copyUsingObjectMap(Ce){const ke=this.getPieces().map($n=>Ce.find($n)||$n);return new this.constructor(ke)}appendText(Ce){return this.insertTextAtPosition(Ce,this.getLength())}
Line truncated
|
||||
`,ke);break;case"backward":Hn=$n.slice(0,ke).lastIndexOf(`
|
||||
`)}if(Hn!==-1)return Hn}contentsForInspection(){return{text:this.text.inspect(),attributes:this.attributes}}toString(){return this.text.toString()}toJSON(){return{text:this.text,attributes:this.attributes,htmlAttributes:this.htmlAttributes}}getDirection(){return this.text.getDirection()}isRTL(){return this.text.isRTL()}getLength(){return this.text.getLength()}canBeConsolidatedWith(Ce){return!this.hasAttributes()&&!Ce.hasAttributes()&&this.getDirection()===Ce.getDirection()}consolidateWith(Ce){const ke=Ne.textForStringWithAttributes(`
|
||||
`),$n=this.getTextWithoutBlockBreak().appendText(ke);return this.copyWithText($n.appendText(Ce.text))}splitAtOffset(Ce){let ke,$n;return Ce===0?(ke=null,$n=this):Ce===this.getLength()?(ke=this,$n=null):(ke=this.copyWithText(this.text.getTextAtRange([0,Ce])),$n=this.copyWithText(this.text.getTextAtRange([Ce,this.getLength()]))),[ke,$n]}getBlockBreakPosition(){return this.text.getLength()-1}getTextWithoutBlockBreak(){return qe(this.text)?this.text.getTextAtRange([0,this.getBlockBreakPosition()]):this.text.copy()}canBeGrouped(Ce){return this.attributes[Ce]}canBeGroupedWith(Ce,ke){const $n=Ce.getAttributes(),Hn=$n[ke],zn=this.attributes[ke];return zn===Hn&&!(gt(zn).group===!1&&!(()=>{if(!ht){ht=[];for(const Un in n){const{listAttribute:qn}=n[Un];qn!=null&&ht.push(qn)}}return ht})().includes($n[ke+1]))&&(this.getDirection()===Ce.getDirection()||Ce.isEmpty())}}const Me=function(_n){return _n=je(_n),_n=Ue(_n)},je=function(_n){let Ce=!1;const ke=_n.getPieces();let $n=ke.slice(0,ke.length-1);const Hn=ke[ke.length-1];return Hn?($n=$n.map(zn=>zn.isBlockBreak()?(Ce=!0,Ve(zn)):zn),Ce?new Ne([...$n,Hn]):_n):_n},We=Ne.textForStringWithAttributes(`
|
||||
`,{blockBreak:!0}),Ue=function(_n){return qe(_n)?_n:_n.appendText(We)},qe=function(_n){const Ce=_n.getLength();return Ce===0?!1:_n.getTextAtRange([Ce-1,Ce]).isBlockBreak()},Ve=_n=>_n.copyWithoutAttribute("blockBreak"),He=function(_n){const{listAttribute:Ce}=gt(_n);return Ce?[Ce,_n]:[_n]},ze=_n=>_n.slice(-1)[0],_e=function(_n,Ce){const ke=_n.lastIndexOf(Ce);return ke===-1?_n:ot(_n,ke,1)};class Je extends nt{static fromJSON(Ce){return new this(Array.from(Ce).map(ke=>Oe.fromJSON(ke)))}static fromString(Ce,ke){const $n=Ne.textForStringWithAttributes(Ce,ke);return new this([new Oe($n)])}constructor(){let Ce=arguments.length>0&&arguments[0]!==void 0?arguments[0]:[];super(...arguments),Ce.length===0&&(Ce=[new Oe]),this.blockList=Be.box(Ce)}isEmpty(){const Ce=this.getBlockAtIndex(0);return this.blockList.length===1&&Ce.isEmpty()&&!Ce.hasAttributes()}copy(){const Ce=(arguments.length>0&&arguments[0]!==void 0?arguments[0]:{}).consolidateBlocks?this.blockList.consolidate().toArray():this.blockList.toArray();return new this.constructor(Ce)}copyUsingObjectsFromDocument(Ce){const ke=new Yt(Ce.getObjects());return this.copyUsingObjectMap(ke)}copyUsingObjectMap(Ce){const ke=this.getBlocks().map($n=>Ce.find($n)||$n.copyUsingObjectMap(Ce));return new this.constructor(ke)}copyWithBaseBlockAttributes(){let Ce=arguments.length>0&&arguments[0]!==void 0?arguments[0]:[];const ke=this.getBlocks().map($n=>{const Hn=Ce.concat($n.getAttributes());return $n.copyWithAttributes(Hn)});return new this.constructor(ke)}replaceBlock(Ce,ke){const $n=this.blockList.indexOf(Ce);return $n===-1?this:new this.constructor(this.blockList.replaceObjectAtIndex(ke,$n))}insertDocumentAtRange(Ce,ke){const{blockList:$n}=Ce;ke=Lt(ke);let[Hn]=ke;const{index:zn,offset:Un}=this.locationFromPosition(Hn);let qn=this;const Xn=this.getBlockAtPosition(Hn);return Dt(ke)&&Xn.isEmpty()&&!Xn.hasAttributes()?qn=new this.constructor(qn.blockList.removeObjectAtIndex(zn)):Xn.getBlockBreakPosition()===Un&&Hn++,qn=qn.removeTextAtRange(ke),new this.constructor(qn.blockList.insertSplittableListAtPosition($n,Hn))}mergeDocumentAtRange(Ce,ke){let $n,Hn;ke=Lt(ke);const[zn]=ke,Un=this.locationFromPosition(zn),qn=this.getBlockAtIndex(Un.index).getAttributes(),Xn=Ce.getBaseBlockAttributes(),Kn=qn.slice(-Xn.length);if(rt(Xn,Kn)){const uo=qn.slice(0,-Xn.length);$n=Ce.copyWithBaseBlockAttributes(uo)}else $n=Ce.copy({consolidateBlocks:!0}).copyWithBaseBlockAttributes(qn);const to=$n.getBlockCount(),io=$n.getBlockAtIndex(0);if(rt(qn,io.getAttributes())){const uo=io.getTextWithoutBlockBreak();if(Hn=this.insertTextAtRange(uo,ke),to>1){$n=new this.constructor($n.getBlocks().slice(1));const ho=zn+uo.getLength();Hn=Hn.insertDocumentAtRange($n,ho)}}else Hn=this.insertDocumentAtRange($n,ke);return Hn}insertTextAtRange(Ce,ke){ke=Lt(ke);const[$n]=ke,{index:Hn,offset:zn}=this.locationFromPosition($n),Un=this.removeTextAtRange(ke);return new this.constructor(Un.blockList.editObjectAtIndex(Hn,qn=>qn.copyWithText(qn.text.insertTextAtPosition(Ce,zn))))}removeTextAtRange(Ce){let ke;Ce=Lt(Ce);const[$n,Hn]=Ce;if(Dt(Ce))return this;const[zn,Un]=Array.from(this.locationRangeFromRange(Ce)),qn=zn.index,Xn=zn.offset,Kn=this.getBlockAtIndex(qn),to=Un.index,io=Un.offset,uo=this.getBlockAtIndex(to);if(Hn-$n==1&&Kn.getBlockBreakPosition()===Xn&&uo.getBlockBreakPosition()!==io&&uo.text.getStringAtPosition(io)===`
|
||||
`)ke=this.blockList.editObjectAtIndex(to,ho=>ho.copyWithText(ho.text.removeTextAtRange([io,io+1])));else{let ho;const bo=Kn.text.getTextAtRange([0,Xn]),Oo=uo.text.getTextAtRange([io,uo.getLength()]),So=bo.appendText(Oo);ho=qn!==to&&Xn===0&&Kn.getAttributeLevel()>=uo.getAttributeLevel()?uo.copyWithText(So):Kn.copyWithText(So);const $o=to+1-qn;ke=this.blockList.splice(qn,$o,ho)}return new this.constructor(ke)}moveTextFromRangeToPosition(Ce,ke){let $n;Ce=Lt(Ce);const[Hn,zn]=Ce;if(Hn<=ke&&ke<=zn)return this;let Un=this.getDocumentAtRange(Ce),qn=this.removeTextAtRange(Ce);const Xn=Hn<ke;Xn&&(ke-=Un.getLength());const[Kn,...to]=Un.getBlocks();return to.length===0?($n=Kn.getTextWithoutBlockBreak(),Xn&&(ke+=1)):$n=Kn.text,qn=qn.insertTextAtRange($n,ke),to.length===0?qn:(Un=new this.constructor(to),ke+=$n.getLength(),qn.insertDocumentAtRange(Un,ke))}addAttributeAtRange(Ce,ke,$n){let{blockList:Hn}=this;return this.eachBlockAtRange($n,(zn,Un,qn)=>Hn=Hn.editObjectAtIndex(qn,function(){return gt(Ce)?zn.addAttribute(Ce,ke):Un[0]===Un[1]?zn:zn.copyWithText(zn.text.addAttributeAtRange(Ce,ke,Un))})),new this.constructor(Hn)}addAttribute(Ce,ke){let{blockList:$n}=this;return this.eachBlock((Hn,zn)=>$n=$n.editObjectAtIndex(zn,()=>Hn.addAttribute(Ce,ke))),new this.constructor($n)}removeAttributeAtRange(Ce,ke){let{blockList:$n}=this;return this.eachBlockAtRange(ke,function(Hn,zn,Un){gt(Ce)?$n=$n.editObjectAtIndex(Un,()=>Hn.removeAttribute(Ce)):zn[0]!==zn[1]&&($n=$n.editObjectAtIndex(Un,()=>Hn.copyWithText(Hn.text.removeAttributeAtRange(Ce,zn))))}),new this.constructor($n)}updateAttributesForAttachment(Ce,ke){const $n=this.getRangeOfAttachment(ke),[Hn]=Array.from($n),{index:zn}=this.locationFromPosition(Hn),Un=this.getTextAtIndex(zn);return new this.constructor(this.blockList.editObjectAtIndex(zn,qn=>qn.copyWithText(Un.updateAttributesForAttachment(Ce,ke))))}removeAttributeForAttachment(Ce,ke){const $n=this.getRangeOfAttachment(ke);return this.removeAttributeAtRange(Ce,$n)}setHTMLAttributeAtPosition(Ce,ke,$n){const Hn=this.getBlockAtPosition(Ce),zn=Hn.addHTMLAttribute(ke,$n);return this.replaceBlock(Hn,zn)}insertBlockBreakAtRange(Ce){let ke;Ce=Lt(Ce);const[$n]=Ce,{offset:Hn}=this.locationFromPosition($n),zn=this.removeTextAtRange(Ce);return Hn===0&&(ke=[new Oe]),new this.constructor(zn.blockList.insertSplittableListAtPosition(new Be(ke),$n))}applyBlockAttributeAtRange(Ce,ke,$n){const Hn=this.expandRangeToLineBreaksAndSplitBlocks($n);let zn=Hn.document;$n=Hn.range;const Un=gt(Ce);if(Un.listAttribute){zn=zn.removeLastListAttributeAtRange($n,{exceptAttributeName:Ce});const qn=zn.convertLineBreaksToBlockBreaksInRange($n);zn=qn.document,$n=qn.range}else zn=Un.exclusive?zn.removeBlockAttributesAtRange($n):Un.terminal?zn.removeLastTerminalAttributeAtRange($n):zn.consolidateBlocksAtRange($n);return zn.addAttributeAtRange(Ce,ke,$n)}removeLastListAttributeAtRange(Ce){let ke=arguments.length>1&&arguments[1]!==void 0?arguments[1]:{},{blockList:$n}=this;return this.eachBlockAtRange(Ce,function(Hn,zn,Un){const qn=Hn.getLastAttribute();qn&>(qn).listAttribute&&qn!==ke.exceptAttributeName&&($n=$n.editObjectAtIndex(Un,()=>Hn.removeAttribute(qn)))}),new this.constructor($n)}removeLastTerminalAttributeAtRange(Ce){let{blockList:ke}=this;return this.eachBlockAtRange(Ce,function($n,Hn,zn){const Un=$n.getLastAttribute();Un&>(Un).terminal&&(ke=ke.editObjectAtIndex(zn,()=>$n.removeAttribute(Un)))}),new this.constructor(ke)}removeBlockAttributesAtRange(Ce){let{blockList:ke}=this;return this.eachBlockAtRange(Ce,function($n,Hn,zn){$n.hasAttributes()&&(ke=ke.editObjectAtIndex(zn,()=>$n.copyWithoutAttributes()))}),new this.constructor(ke)}expandRangeToLineBreaksAndSplitBlocks(Ce){let ke;Ce=Lt(Ce);let[$n,Hn]=Ce;const zn=this.locationFromPosition($n),Un=this.locationFromPosition(Hn);let qn=this;const Xn=qn.getBlockAtIndex(zn.index);if(zn.offset=Xn.findLineBreakInDirectionFromPosition("backward",zn.offset),zn.offset!=null&&(ke=qn.positionFromLocation(zn),qn=qn.insertBlockBreakAtRange([ke,ke+1]),Un.index+=1,Un.offset-=qn.getBlockAtIndex(zn.index).getLength(),zn.index+=1),zn.offset=0,Un.offset===0&&Un.index>zn.index)Un.index-=1,Un.offset=qn.getBlockAtIndex(Un.index).getBlockBreakPosition();else{const Kn=qn.getBlockAtIndex(Un.index);Kn.text.getStringAtRange([Un.offset-1,Un.offset])===`
|
||||
`?Un.offset-=1:Un.offset=Kn.findLineBreakInDirectionFromPosition("forward",Un.offset),Un.offset!==Kn.getBlockBreakPosition()&&(ke=qn.positionFromLocation(Un),qn=qn.insertBlockBreakAtRange([ke,ke+1]))}return $n=qn.positionFromLocation(zn),Hn=qn.positionFromLocation(Un),{document:qn,range:Ce=Lt([$n,Hn])}}convertLineBreaksToBlockBreaksInRange(Ce){Ce=Lt(Ce);let[ke]=Ce;const $n=this.getStringAtRange(Ce).slice(0,-1);let Hn=this;return $n.replace(/.*?\n/g,function(zn){ke+=zn.length,Hn=Hn.insertBlockBreakAtRange([ke-1,ke])}),{document:Hn,range:Ce}}consolidateBlocksAtRange(Ce){Ce=Lt(Ce);const[ke,$n]=Ce,Hn=this.locationFromPosition(ke).index,zn=this.locationFromPosition($n).index;return new this.constructor(this.blockList.consolidateFromIndexToIndex(Hn,zn))}getDocumentAtRange(Ce){Ce=Lt(Ce);const ke=this.blockList.getSplittableListInRange(Ce).toArray();return new this.constructor(ke)}getStringAtRange(Ce){let ke;const $n=Ce=Lt(Ce);return $n[$n.length-1]!==this.getLength()&&(ke=-1),this.getDocumentAtRange(Ce).toString().slice(0,ke)}getBlockAtIndex(Ce){return this.blockList.getObjectAtIndex(Ce)}getBlockAtPosition(Ce){const{index:ke}=this.locationFromPosition(Ce);return this.getBlockAtIndex(ke)}getTextAtIndex(Ce){var ke;return(ke=this.getBlockAtIndex(Ce))===null||ke===void 0?void 0:ke.text}getTextAtPosition(Ce){const{index:ke}=this.locationFromPosition(Ce);return this.getTextAtIndex(ke)}getPieceAtPosition(Ce){const{index:ke,offset:$n}=this.locationFromPosition(Ce);return this.getTextAtIndex(ke).getPieceAtPosition($n)}getCharacterAtPosition(Ce){const{index:ke,offset:$n}=this.locationFromPosition(Ce);return this.getTextAtIndex(ke).getStringAtRange([$n,$n+1])}getLength(){return this.blockList.getEndPosition()}getBlocks(){return this.blockList.toArray()}getBlockCount(){return this.blockList.length}getEditCount(){return this.editCount}eachBlock(Ce){return this.blockList.eachObject(Ce)}eachBlockAtRange(Ce,ke){let $n,Hn;Ce=Lt(Ce);const[zn,Un]=Ce,qn=this.locationFromPosition(zn),Xn=this.locationFromPosition(Un);if(qn.index===Xn.index)return $n=this.getBlockAtIndex(qn.index),Hn=[qn.offset,Xn.offset],ke($n,Hn,qn.index);for(let Kn=qn.index;Kn<=Xn.index;Kn++)if($n=this.getBlockAtIndex(Kn),$n){switch(Kn){case qn.index:Hn=[qn.offset,$n.text.getLength()];break;case Xn.index:Hn=[0,Xn.offset];break;default:Hn=[0,$n.text.getLength()]}ke($n,Hn,Kn)}}getCommonAttributesAtRange(Ce){Ce=Lt(Ce);const[ke]=Ce;if(Dt(Ce))return this.getCommonAttributesAtPosition(ke);{const $n=[],Hn=[];return this.eachBlockAtRange(Ce,function(zn,Un){if(Un[0]!==Un[1])return $n.push(zn.text.getCommonAttributesAtRange(Un)),Hn.push(Ke(zn))}),zt.fromCommonAttributesOfObjects($n).merge(zt.fromCommonAttributesOfObjects(Hn)).toObject()}}getCommonAttributesAtPosition(Ce){let ke,$n;const{index:Hn,offset:zn}=this.locationFromPosition(Ce),Un=this.getBlockAtIndex(Hn);if(!Un)return{};const qn=Ke(Un),Xn=Un.text.getAttributesAtPosition(zn),Kn=Un.text.getAttributesAtPosition(zn-1),to=Object.keys(W).filter(io=>W[io].inheritable);for(ke in Kn)$n=Kn[ke],($n===Xn[ke]||to.includes(ke))&&(qn[ke]=$n);return qn}getRangeOfCommonAttributeAtPosition(Ce,ke){const{index:$n,offset:Hn}=this.locationFromPosition(ke),zn=this.getTextAtIndex($n),[Un,qn]=Array.from(zn.getExpandedRangeForAttributeAtOffset(Ce,Hn)),Xn=this.positionFromLocation({index:$n,offset:Un}),Kn=this.positionFromLocation({index:$n,offset:qn});return Lt([Xn,Kn])}getBaseBlockAttributes(){let Ce=this.getBlockAtIndex(0).getAttributes();for(let ke=1;ke<this.getBlockCount();ke++){const $n=this.getBlockAtIndex(ke).getAttributes(),Hn=Math.min(Ce.length,$n.length);Ce=(()=>{const zn=[];for(let Un=0;Un<Hn&&$n[Un]===Ce[Un];Un++)zn.push($n[Un]);return zn})()}return Ce}getAttachmentById(Ce){for(const ke of this.getAttachments())if(ke.id===Ce)return ke}getAttachmentPieces(){let Ce=[];return this.blockList.eachObject(ke=>{let{text:$n}=ke;return Ce=Ce.concat($n.getAttachmentPieces())}),Ce}getAttachments(){return this.getAttachmentPieces().map(Ce=>Ce.attachment)}getRangeOfAttachment(Ce){let ke=0;const $n=this.blockList.toArray();for(let Hn=0;Hn<$n.length;Hn++){const{text:zn}=$n[Hn],Un=zn.getRangeOfAttachment(Ce);if(Un)return Lt([ke+Un[0],ke+Un[1]]);ke+=zn.getLength()}}getLocationRangeOfAttachment(Ce){const ke=this.getRangeOfAttachment(Ce);return this.locationRangeFromRange(ke)}getAttachmentPieceForAttachment(Ce){for(const ke of this.getAttachmentPieces())if(ke.attachment===Ce)return ke}findRangesForBlockAttribute(Ce){let ke=0;const $n=[];return this.getBlocks().forEach(Hn=>{const zn=Hn.getLength();Hn.hasAttribute(Ce)&&$n.push([ke,ke+zn]),ke+=zn}),$n}findRangesForTextAttribute(Ce){let{withValue:ke}=arguments.length>1&&arguments[1]!==void 0?arguments[1]:{},$n=0,Hn=[];const zn=[];return this.getPieces().forEach(Un=>{const qn=Un.getLength();(function(Xn){return ke?Xn.getAttribute(Ce)===ke:Xn.hasAttribute(Ce)})(Un)&&(Hn[1]===$n?Hn[1]=$n+qn:zn.push(Hn=[$n,$n+qn])),$n+=qn}),zn}locationFromPosition(Ce){const ke=this.blockList.findIndexAndOffsetAtPosition(Math
Line truncated
|
||||
`);if(ke===this.containerElement||this.isBlockElement(ke)){var $n;const Hn=this.getBlockAttributes(ke),zn=this.getBlockHTMLAttributes(ke);rt(Hn,($n=this.currentBlock)===null||$n===void 0?void 0:$n.attributes)||(this.currentBlock=this.appendBlockForAttributesWithElement(Hn,ke,zn),this.currentBlockElement=ke)}}appendBlockForElement(Ce){const ke=this.isBlockElement(Ce),$n=y(this.currentBlockElement,Ce);if(ke&&!this.isBlockElement(Ce.firstChild)){if(!this.isInsignificantTextNode(Ce.firstChild)||!this.isBlockElement(Ce.firstElementChild)){const Hn=this.getBlockAttributes(Ce),zn=this.getBlockHTMLAttributes(Ce);if(Ce.firstChild){if($n&&rt(Hn,this.currentBlock.attributes))return this.appendStringWithAttributes(`
|
||||
`);this.currentBlock=this.appendBlockForAttributesWithElement(Hn,Ce,zn),this.currentBlockElement=Ce}}}else if(this.currentBlockElement&&!$n&&!ke){const Hn=this.findParentBlockElement(Ce);if(Hn)return this.appendBlockForElement(Hn);this.currentBlock=this.appendEmptyBlock(),this.currentBlockElement=null}}findParentBlockElement(Ce){let{parentElement:ke}=Ce;for(;ke&&ke!==this.containerElement;){if(this.isBlockElement(ke)&&this.blockElements.includes(ke))return ke;ke=ke.parentElement}return null}processTextNode(Ce){let ke=Ce.data;var $n;return Ye(Ce.parentNode)||(ke=qt(ke),ni(($n=Ce.previousSibling)===null||$n===void 0?void 0:$n.textContent)&&(ke=ei(ke))),this.appendStringWithAttributes(ke,this.getTextAttributes(Ce.parentNode))}processElement(Ce){let ke;if(I(Ce)){if(ke=$e(Ce,"attachment"),Object.keys(ke).length){const $n=this.getTextAttributes(Ce);this.appendAttachmentWithAttributes(ke,$n),Ce.innerHTML=""}return this.processedElements.push(Ce)}switch(E(Ce)){case"br":return this.isExtraBR(Ce)||this.isBlockElement(Ce.nextSibling)||this.appendStringWithAttributes(`
|
||||
`,this.getTextAttributes(Ce)),this.processedElements.push(Ce);case"img":ke={url:Ce.getAttribute("src"),contentType:"image"};const $n=(Hn=>{const zn=Hn.getAttribute("width"),Un=Hn.getAttribute("height"),qn={};return zn&&(qn.width=parseInt(zn,10)),Un&&(qn.height=parseInt(Un,10)),qn})(Ce);for(const Hn in $n){const zn=$n[Hn];ke[Hn]=zn}return this.appendAttachmentWithAttributes(ke,this.getTextAttributes(Ce)),this.processedElements.push(Ce);case"tr":if(this.needsTableSeparator(Ce))return this.appendStringWithAttributes(j.tableRowSeparator);break;case"td":if(this.needsTableSeparator(Ce))return this.appendStringWithAttributes(j.tableCellSeparator)}}appendBlockForAttributesWithElement(Ce,ke){let $n=arguments.length>2&&arguments[2]!==void 0?arguments[2]:{};this.blockElements.push(ke);const Hn=function(){return{text:[],attributes:arguments.length>0&&arguments[0]!==void 0?arguments[0]:{},htmlAttributes:arguments.length>1&&arguments[1]!==void 0?arguments[1]:{}}}(Ce,$n);return this.blocks.push(Hn),Hn}appendEmptyBlock(){return this.appendBlockForAttributesWithElement([],null)}appendStringWithAttributes(Ce,ke){return this.appendPiece(Ge(Ce,ke))}appendAttachmentWithAttributes(Ce,ke){return this.appendPiece(function($n){return{attachment:$n,attributes:arguments.length>1&&arguments[1]!==void 0?arguments[1]:{},type:"attachment"}}(Ce,ke))}appendPiece(Ce){return this.blocks.length===0&&this.appendEmptyBlock(),this.blocks[this.blocks.length-1].text.push(Ce)}appendStringToTextAtIndex(Ce,ke){const{text:$n}=this.blocks[ke],Hn=$n[$n.length-1];if((Hn==null?void 0:Hn.type)!=="string")return $n.push(Ge(Ce));Hn.string+=Ce}prependStringToTextAtIndex(Ce,ke){const{text:$n}=this.blocks[ke],Hn=$n[0];if((Hn==null?void 0:Hn.type)!=="string")return $n.unshift(Ge(Ce));Hn.string=Ce+Hn.string}getTextAttributes(Ce){let ke;const $n={};for(const Hn in W){const zn=W[Hn];if(zn.tagName&&A(Ce,{matchingSelector:zn.tagName,untilNode:this.containerElement}))$n[Hn]=!0;else if(zn.parser){if(ke=zn.parser(Ce),ke){let Un=!1;for(const qn of this.findBlockElementAncestors(Ce))if(zn.parser(qn)===ke){Un=!0;break}Un||($n[Hn]=ke)}}else zn.styleProperty&&(ke=Ce.style[zn.styleProperty],ke&&($n[Hn]=ke))}if(I(Ce)){const Hn=$e(Ce,"attributes");for(const zn in Hn)ke=Hn[zn],$n[zn]=ke}return $n}getBlockAttributes(Ce){const ke=[];for(;Ce&&Ce!==this.containerElement;){for(const Hn in n){const zn=n[Hn];var $n;zn.parse!==!1&&E(Ce)===zn.tagName&&(($n=zn.test)!==null&&$n!==void 0&&$n.call(zn,Ce)||!zn.test)&&(ke.push(Hn),zn.listAttribute&&ke.push(zn.listAttribute))}Ce=Ce.parentNode}return ke.reverse()}getBlockHTMLAttributes(Ce){const ke={},$n=Object.values(n).find(Hn=>Hn.tagName===E(Ce));return(($n==null?void 0:$n.htmlAttributes)||[]).forEach(Hn=>{Ce.hasAttribute(Hn)&&(ke[Hn]=Ce.getAttribute(Hn))}),ke}findBlockElementAncestors(Ce){const ke=[];for(;Ce&&Ce!==this.containerElement;){const $n=E(Ce);D().includes($n)&&ke.push(Ce),Ce=Ce.parentNode}return ke}isBlockElement(Ce){if((Ce==null?void 0:Ce.nodeType)===Node.ELEMENT_NODE&&!I(Ce)&&!A(Ce,{matchingSelector:"td",untilNode:this.containerElement}))return D().includes(E(Ce))||window.getComputedStyle(Ce).display==="block"}isInsignificantTextNode(Ce){if((Ce==null?void 0:Ce.nodeType)!==Node.TEXT_NODE||!ii(Ce.data))return;const{parentNode:ke,previousSibling:$n,nextSibling:Hn}=Ce;return Qe(ke.previousSibling)&&!this.isBlockElement(ke.previousSibling)||Ye(ke)?void 0:!$n||this.isBlockElement($n)||!Hn||this.isBlockElement(Hn)}isExtraBR(Ce){return E(Ce)==="br"&&this.isBlockElement(Ce.parentNode)&&Ce.parentNode.lastChild===Ce}needsTableSeparator(Ce){if(j.removeBlankTableCells){var ke;const $n=(ke=Ce.previousSibling)===null||ke===void 0?void 0:ke.textContent;return $n&&/\S/.test($n)}return Ce.previousSibling}translateBlockElementMarginsToNewlines(){const Ce=this.getMarginOfDefaultBlockElement();for(let ke=0;ke<this.blocks.length;ke++){const $n=this.getMarginOfBlockElementAtIndex(ke);$n&&($n.top>2*Ce.top&&this.prependStringToTextAtIndex(`
|
||||
`,ke),$n.bottom>2*Ce.bottom&&this.appendStringToTextAtIndex(`
|
||||
`,ke))}}getMarginOfBlockElementAtIndex(Ce){const ke=this.blockElements[Ce];if(ke&&ke.textContent&&!D().includes(E(ke))&&!this.processedElements.includes(ke))return Ze(ke)}getMarginOfDefaultBlockElement(){const Ce=S$1(n.default.tagName);return this.containerElement.appendChild(Ce),Ze(Ce)}}const Ye=function(_n){const{whiteSpace:Ce}=window.getComputedStyle(_n);return["pre","pre-wrap","pre-line"].includes(Ce)},Qe=_n=>_n&&!ni(_n.textContent),Ze=function(_n){const Ce=window.getComputedStyle(_n);if(Ce.display==="block")return{top:parseInt(Ce.marginTop),bottom:parseInt(Ce.marginBottom)}},ti=function(_n){return E(_n)==="style"?NodeFilter.FILTER_REJECT:NodeFilter.FILTER_ACCEPT},ei=_n=>_n.replace(new RegExp("^".concat(Ut.source,"+")),""),ii=_n=>new RegExp("^".concat(Ut.source,"*$")).test(_n),ni=_n=>/\s$/.test(_n),ri=["contenteditable","data-trix-id","data-trix-store-key","data-trix-mutable","data-trix-placeholder","tabindex"],oi="data-trix-serialized-attributes",si="[".concat(oi,"]"),ai=new RegExp("<!--block-->","g"),li={"application/json":function(_n){let Ce;if(_n instanceof Je)Ce=_n;else{if(!(_n instanceof HTMLElement))throw new Error("unserializable object");Ce=Xe.parse(_n.innerHTML).getDocument()}return Ce.toSerializableDocument().toJSONString()},"text/html":function(_n){let Ce;if(_n instanceof Je)Ce=ve.render(_n);else{if(!(_n instanceof HTMLElement))throw new Error("unserializable object");Ce=_n.cloneNode(!0)}return Array.from(Ce.querySelectorAll("[data-trix-serialize=false]")).forEach(ke=>{k(ke)}),ri.forEach(ke=>{Array.from(Ce.querySelectorAll("[".concat(ke,"]"))).forEach($n=>{$n.removeAttribute(ke)})}),Array.from(Ce.querySelectorAll(si)).forEach(ke=>{try{const $n=JSON.parse(ke.getAttribute(oi));ke.removeAttribute(oi);for(const Hn in $n){const zn=$n[Hn];ke.setAttribute(Hn,zn)}}catch{}}),Ce.innerHTML.replace(ai,"")}};var ci=Object.freeze({__proto__:null});class ui extends H{constructor(Ce,ke){super(...arguments),this.attachmentManager=Ce,this.attachment=ke,this.id=this.attachment.id,this.file=this.attachment.file}remove(){return this.attachmentManager.requestRemovalOfAttachment(this.attachment)}}ui.proxyMethod("attachment.getAttribute"),ui.proxyMethod("attachment.hasAttribute"),ui.proxyMethod("attachment.setAttribute"),ui.proxyMethod("attachment.getAttributes"),ui.proxyMethod("attachment.setAttributes"),ui.proxyMethod("attachment.isPending"),ui.proxyMethod("attachment.isPreviewable"),ui.proxyMethod("attachment.getURL"),ui.proxyMethod("attachment.getHref"),ui.proxyMethod("attachment.getFilename"),ui.proxyMethod("attachment.getFilesize"),ui.proxyMethod("attachment.getFormattedFilesize"),ui.proxyMethod("attachment.getExtension"),ui.proxyMethod("attachment.getContentType"),ui.proxyMethod("attachment.getFile"),ui.proxyMethod("attachment.setFile"),ui.proxyMethod("attachment.releaseFile"),ui.proxyMethod("attachment.getUploadProgress"),ui.proxyMethod("attachment.setUploadProgress");class hi extends H{constructor(){let Ce=arguments.length>0&&arguments[0]!==void 0?arguments[0]:[];super(...arguments),this.managedAttachments={},Array.from(Ce).forEach(ke=>{this.manageAttachment(ke)})}getAttachments(){const Ce=[];for(const ke in this.managedAttachments){const $n=this.managedAttachments[ke];Ce.push($n)}return Ce}manageAttachment(Ce){return this.managedAttachments[Ce.id]||(this.managedAttachments[Ce.id]=new ui(this,Ce)),this.managedAttachments[Ce.id]}attachmentIsManaged(Ce){return Ce.id in this.managedAttachments}requestRemovalOfAttachment(Ce){var ke,$n;if(this.attachmentIsManaged(Ce))return(ke=this.delegate)===null||ke===void 0||($n=ke.attachmentManagerDidRequestRemovalOfAttachment)===null||$n===void 0?void 0:$n.call(ke,Ce)}unmanageAttachment(Ce){const ke=this.managedAttachments[Ce.id];return delete this.managedAttachments[Ce.id],ke}}class di{constructor(Ce){this.composition=Ce,this.document=this.composition.document;const ke=this.composition.getSelectedRange();this.startPosition=ke[0],this.endPosition=ke[1],this.startLocation=this.document.locationFromPosition(this.startPosition),this.endLocation=this.document.locationFromPosition(this.endPosition),this.block=this.document.getBlockAtIndex(this.endLocation.index),this.breaksOnReturn=this.block.breaksOnReturn(),this.previousCharacter=this.block.text.getStringAtPosition(this.endLocation.offset-1),this.nextCharacter=this.block.text.getStringAtPosition(this.endLocation.offset)}shouldInsertBlockBreak(){return this.block.hasAttributes()&&this.block.isListItem()&&!this.block.isEmpty()?this.startLocation.offset!==0:this.breaksOnReturn&&this.nextCharacter!==`
|
||||
`}shouldBreakFormattedBlock(){return this.block.hasAttributes()&&!this.block.isListItem()&&(this.breaksOnReturn&&this.nextCharacter===`
|
||||
`||this.previousCharacter===`
|
||||
`)}shouldDecreaseListLevel(){return this.block.hasAttributes()&&this.block.isListItem()&&this.block.isEmpty()}shouldPrependListItem(){return this.block.isListItem()&&this.startLocation.offset===0&&!this.block.isEmpty()}shouldRemoveLastBlockAttribute(){return this.block.hasAttributes()&&!this.block.isListItem()&&this.block.isEmpty()}}class gi extends H{constructor(){super(...arguments),this.document=new Je,this.attachments=[],this.currentAttributes={},this.revision=0}setDocument(Ce){var ke,$n;if(!Ce.isEqualTo(this.document))return this.document=Ce,this.refreshAttachments(),this.revision++,(ke=this.delegate)===null||ke===void 0||($n=ke.compositionDidChangeDocument)===null||$n===void 0?void 0:$n.call(ke,Ce)}getSnapshot(){return{document:this.document,selectedRange:this.getSelectedRange()}}loadSnapshot(Ce){var ke,$n,Hn,zn;let{document:Un,selectedRange:qn}=Ce;return(ke=this.delegate)===null||ke===void 0||($n=ke.compositionWillLoadSnapshot)===null||$n===void 0||$n.call(ke),this.setDocument(Un??new Je),this.setSelection(qn??[0,0]),(Hn=this.delegate)===null||Hn===void 0||(zn=Hn.compositionDidLoadSnapshot)===null||zn===void 0?void 0:zn.call(Hn)}insertText(Ce){let{updatePosition:ke}=arguments.length>1&&arguments[1]!==void 0?arguments[1]:{updatePosition:!0};const $n=this.getSelectedRange();this.setDocument(this.document.insertTextAtRange(Ce,$n));const Hn=$n[0],zn=Hn+Ce.getLength();return ke&&this.setSelection(zn),this.notifyDelegateOfInsertionAtRange([Hn,zn])}insertBlock(){let Ce=arguments.length>0&&arguments[0]!==void 0?arguments[0]:new Oe;const ke=new Je([Ce]);return this.insertDocument(ke)}insertDocument(){let Ce=arguments.length>0&&arguments[0]!==void 0?arguments[0]:new Je;const ke=this.getSelectedRange();this.setDocument(this.document.insertDocumentAtRange(Ce,ke));const $n=ke[0],Hn=$n+Ce.getLength();return this.setSelection(Hn),this.notifyDelegateOfInsertionAtRange([$n,Hn])}insertString(Ce,ke){const $n=this.getCurrentTextAttributes(),Hn=Ne.textForStringWithAttributes(Ce,$n);return this.insertText(Hn,ke)}insertBlockBreak(){const Ce=this.getSelectedRange();this.setDocument(this.document.insertBlockBreakAtRange(Ce));const ke=Ce[0],$n=ke+1;return this.setSelection($n),this.notifyDelegateOfInsertionAtRange([ke,$n])}insertLineBreak(){const Ce=new di(this);if(Ce.shouldDecreaseListLevel())return this.decreaseListLevel(),this.setSelection(Ce.startPosition);if(Ce.shouldPrependListItem()){const ke=new Je([Ce.block.copyWithoutText()]);return this.insertDocument(ke)}return Ce.shouldInsertBlockBreak()?this.insertBlockBreak():Ce.shouldRemoveLastBlockAttribute()?this.removeLastBlockAttribute():Ce.shouldBreakFormattedBlock()?this.breakFormattedBlock(Ce):this.insertString(`
|
||||
`)}insertHTML(Ce){const ke=Xe.parse(Ce).getDocument(),$n=this.getSelectedRange();this.setDocument(this.document.mergeDocumentAtRange(ke,$n));const Hn=$n[0],zn=Hn+ke.getLength()-1;return this.setSelection(zn),this.notifyDelegateOfInsertionAtRange([Hn,zn])}replaceHTML(Ce){const ke=Xe.parse(Ce).getDocument().copyUsingObjectsFromDocument(this.document),$n=this.getLocationRange({strict:!1}),Hn=this.document.rangeFromLocationRange($n);return this.setDocument(ke),this.setSelection(Hn)}insertFile(Ce){return this.insertFiles([Ce])}insertFiles(Ce){const ke=[];return Array.from(Ce).forEach($n=>{var Hn;if((Hn=this.delegate)!==null&&Hn!==void 0&&Hn.compositionShouldAcceptFile($n)){const zn=De.attachmentForFile($n);ke.push(zn)}}),this.insertAttachments(ke)}insertAttachment(Ce){return this.insertAttachments([Ce])}insertAttachments(Ce){let ke=new Ne;return Array.from(Ce).forEach($n=>{var Hn;const zn=$n.getType(),Un=(Hn=i$1[zn])===null||Hn===void 0?void 0:Hn.presentation,qn=this.getCurrentTextAttributes();Un&&(qn.presentation=Un);const Xn=Ne.textForAttachmentWithAttributes($n,qn);ke=ke.appendText(Xn)}),this.insertText(ke)}shouldManageDeletingInDirection(Ce){const ke=this.getLocationRange();if(Dt(ke)){if(Ce==="backward"&&ke[0].offset===0||this.shouldManageMovingCursorInDirection(Ce))return!0}else if(ke[0].index!==ke[1].index)return!0;return!1}deleteInDirection(Ce){let ke,$n,Hn,{length:zn}=arguments.length>1&&arguments[1]!==void 0?arguments[1]:{};const Un=this.getLocationRange();let qn=this.getSelectedRange();const Xn=Dt(qn);if(Xn?$n=Ce==="backward"&&Un[0].offset===0:Hn=Un[0].index!==Un[1].index,$n&&this.canDecreaseBlockAttributeLevel()){const Kn=this.getBlock();if(Kn.isListItem()?this.decreaseListLevel():this.decreaseBlockAttributeLevel(),this.setSelection(qn[0]),Kn.isEmpty())return!1}return Xn&&(qn=this.getExpandedRangeInDirection(Ce,{length:zn}),Ce==="backward"&&(ke=this.getAttachmentAtRange(qn))),ke?(this.editAttachment(ke),!1):(this.setDocument(this.document.removeTextAtRange(qn)),this.setSelection(qn[0]),!$n&&!Hn&&void 0)}moveTextFromRange(Ce){const[ke]=Array.from(this.getSelectedRange());return this.setDocument(this.document.moveTextFromRangeToPosition(Ce,ke)),this.setSelection(ke)}removeAttachment(Ce){const ke=this.document.getRangeOfAttachment(Ce);if(ke)return this.stopEditingAttachment(),this.setDocument(this.document.removeTextAtRange(ke)),this.setSelection(ke[0])}removeLastBlockAttribute(){const[Ce,ke]=Array.from(this.getSelectedRange()),$n=this.document.getBlockAtPosition(ke);return this.removeCurrentAttribute($n.getLastAttribute()),this.setSelection(Ce)}insertPlaceholder(){return this.placeholderPosition=this.getPosition(),this.insertString(" ")}selectPlaceholder(){if(this.placeholderPosition!=null)return this.setSelectedRange([this.placeholderPosition,this.placeholderPosition+1]),this.getSelectedRange()}forgetPlaceholder(){this.placeholderPosition=null}hasCurrentAttribute(Ce){const ke=this.currentAttributes[Ce];return ke!=null&&ke!==!1}toggleCurrentAttribute(Ce){const ke=!this.currentAttributes[Ce];return ke?this.setCurrentAttribute(Ce,ke):this.removeCurrentAttribute(Ce)}canSetCurrentAttribute(Ce){return gt(Ce)?this.canSetCurrentBlockAttribute(Ce):this.canSetCurrentTextAttribute(Ce)}canSetCurrentTextAttribute(Ce){const ke=this.getSelectedDocument();if(ke){for(const $n of Array.from(ke.getAttachments()))if(!$n.hasContent())return!1;return!0}}canSetCurrentBlockAttribute(Ce){const ke=this.getBlock();if(ke)return!ke.isTerminalBlock()}setCurrentAttribute(Ce,ke){return gt(Ce)?this.setBlockAttribute(Ce,ke):(this.setTextAttribute(Ce,ke),this.currentAttributes[Ce]=ke,this.notifyDelegateOfCurrentAttributesChange())}setHTMLAtributeAtPosition(Ce,ke,$n){var Hn;const zn=this.document.getBlockAtPosition(Ce),Un=(Hn=gt(zn.getLastAttribute()))===null||Hn===void 0?void 0:Hn.htmlAttributes;if(zn&&Un!=null&&Un.includes(ke)){const qn=this.document.setHTMLAttributeAtPosition(Ce,ke,$n);this.setDocument(qn)}}setTextAttribute(Ce,ke){const $n=this.getSelectedRange();if(!$n)return;const[Hn,zn]=Array.from($n);if(Hn!==zn)return this.setDocument(this.document.addAttributeAtRange(Ce,ke,$n));if(Ce==="href"){const Un=Ne.textForStringWithAttributes(ke,{href:ke});return this.insertText(Un)}}setBlockAttribute(Ce,ke){const $n=this.getSelectedRange();if(this.canSetCurrentAttribute(Ce))return this.setDocument(this.document.applyBlockAttributeAtRange(Ce,ke,$n)),this.setSelection($n)}removeCurrentAttribute(Ce){return gt(Ce)?(this.removeBlockAttribute(Ce),this.updateCurrentAttributes()):(this.removeTextAttribute(Ce),delete this.currentAttributes[Ce],this.notifyDelegateOfCurrentAttributesChange())}removeTextAttribute(Ce){const ke=this.getSelectedRange();if(ke)return this.setDocument(this.document.removeAttributeAtRange(Ce,ke))}removeBlockAttribute(Ce){const ke=this.getSelectedRange();if(ke)return this.setDocument(this.document.removeAttributeAtRange(Ce,ke))}canDecreaseNestingLevel(){var Ce;return((Ce=this.getBlock())===null||Ce===void 0?void 0:Ce.getNes
Line truncated
|
||||
`?Hn+=1:ke=ke.removeTextAtRange(zn),zn=[Hn,Hn]):Ce.nextCharacter===`
|
||||
`?Ce.previousCharacter===`
|
||||
`?zn=[Hn-1,Hn+1]:(zn=[Hn,Hn+1],Hn+=1):Ce.startLocation.offset-1!=0&&(Hn+=1);const Un=new Je([$n.removeLastAttribute().copyWithoutText()]);return this.setDocument(ke.insertDocumentAtRange(Un,zn)),this.setSelection(Hn)}getPreviousBlock(){const Ce=this.getLocationRange();if(Ce){const{index:ke}=Ce[0];if(ke>0)return this.document.getBlockAtIndex(ke-1)}}getBlock(){const Ce=this.getLocationRange();if(Ce)return this.document.getBlockAtIndex(Ce[0].index)}getAttachmentAtRange(Ce){const ke=this.document.getDocumentAtRange(Ce);if(ke.toString()==="".concat("",`
|
||||
`))return ke.getAttachments()[0]}notifyDelegateOfCurrentAttributesChange(){var Ce,ke;return(Ce=this.delegate)===null||Ce===void 0||(ke=Ce.compositionDidChangeCurrentAttributes)===null||ke===void 0?void 0:ke.call(Ce,this.currentAttributes)}notifyDelegateOfInsertionAtRange(Ce){var ke,$n;return(ke=this.delegate)===null||ke===void 0||($n=ke.compositionDidPerformInsertionAtRange)===null||$n===void 0?void 0:$n.call(ke,Ce)}translateUTF16PositionFromOffset(Ce,ke){const $n=this.document.toUTF16String(),Hn=$n.offsetFromUCS2Offset(Ce);return $n.offsetToUCS2Offset(Hn+ke)}}gi.proxyMethod("getSelectionManager().getPointRange"),gi.proxyMethod("getSelectionManager().setLocationRangeFromPointRange"),gi.proxyMethod("getSelectionManager().createLocationRangeFromDOMRange"),gi.proxyMethod("getSelectionManager().locationIsCursorTarget"),gi.proxyMethod("getSelectionManager().selectionIsExpanded"),gi.proxyMethod("delegate?.getSelectionManager");class mi extends H{constructor(Ce){super(...arguments),this.composition=Ce,this.undoEntries=[],this.redoEntries=[]}recordUndoEntry(Ce){let{context:ke,consolidatable:$n}=arguments.length>1&&arguments[1]!==void 0?arguments[1]:{};const Hn=this.undoEntries.slice(-1)[0];if(!$n||!pi(Hn,Ce,ke)){const zn=this.createEntry({description:Ce,context:ke});this.undoEntries.push(zn),this.redoEntries=[]}}undo(){const Ce=this.undoEntries.pop();if(Ce){const ke=this.createEntry(Ce);return this.redoEntries.push(ke),this.composition.loadSnapshot(Ce.snapshot)}}redo(){const Ce=this.redoEntries.pop();if(Ce){const ke=this.createEntry(Ce);return this.undoEntries.push(ke),this.composition.loadSnapshot(Ce.snapshot)}}canUndo(){return this.undoEntries.length>0}canRedo(){return this.redoEntries.length>0}createEntry(){let{description:Ce,context:ke}=arguments.length>0&&arguments[0]!==void 0?arguments[0]:{};return{description:Ce==null?void 0:Ce.toString(),context:JSON.stringify(ke),snapshot:this.composition.getSnapshot()}}}const pi=(_n,Ce,ke)=>(_n==null?void 0:_n.description)===(Ce==null?void 0:Ce.toString())&&(_n==null?void 0:_n.context)===JSON.stringify(ke),fi="attachmentGallery";class bi{constructor(Ce){this.document=Ce.document,this.selectedRange=Ce.selectedRange}perform(){return this.removeBlockAttribute(),this.applyBlockAttribute()}getSnapshot(){return{document:this.document,selectedRange:this.selectedRange}}removeBlockAttribute(){return this.findRangesOfBlocks().map(Ce=>this.document=this.document.removeAttributeAtRange(fi,Ce))}applyBlockAttribute(){let Ce=0;this.findRangesOfPieces().forEach(ke=>{ke[1]-ke[0]>1&&(ke[0]+=Ce,ke[1]+=Ce,this.document.getCharacterAtPosition(ke[1])!==`
|
||||
`&&(this.document=this.document.insertBlockBreakAtRange(ke[1]),ke[1]<this.selectedRange[1]&&this.moveSelectedRangeForward(),ke[1]++,Ce++),ke[0]!==0&&this.document.getCharacterAtPosition(ke[0]-1)!==`
|
||||
`&&(this.document=this.document.insertBlockBreakAtRange(ke[0]),ke[0]<this.selectedRange[0]&&this.moveSelectedRangeForward(),ke[0]++,Ce++),this.document=this.document.applyBlockAttributeAtRange(fi,!0,ke))})}findRangesOfBlocks(){return this.document.findRangesForBlockAttribute(fi)}findRangesOfPieces(){return this.document.findRangesForTextAttribute("presentation",{withValue:"gallery"})}moveSelectedRangeForward(){this.selectedRange[0]+=1,this.selectedRange[1]+=1}}const vi=function(_n){const Ce=new bi(_n);return Ce.perform(),Ce.getSnapshot()},Ai=[vi];class xi{constructor(Ce,ke,$n){this.insertFiles=this.insertFiles.bind(this),this.composition=Ce,this.selectionManager=ke,this.element=$n,this.undoManager=new mi(this.composition),this.filters=Ai.slice(0)}loadDocument(Ce){return this.loadSnapshot({document:Ce,selectedRange:[0,0]})}loadHTML(){let Ce=arguments.length>0&&arguments[0]!==void 0?arguments[0]:"";const ke=Xe.parse(Ce,{referenceElement:this.element}).getDocument();return this.loadDocument(ke)}loadJSON(Ce){let{document:ke,selectedRange:$n}=Ce;return ke=Je.fromJSON(ke),this.loadSnapshot({document:ke,selectedRange:$n})}loadSnapshot(Ce){return this.undoManager=new mi(this.composition),this.composition.loadSnapshot(Ce)}getDocument(){return this.composition.document}getSelectedDocument(){return this.composition.getSelectedDocument()}getSnapshot(){return this.composition.getSnapshot()}toJSON(){return this.getSnapshot()}deleteInDirection(Ce){return this.composition.deleteInDirection(Ce)}insertAttachment(Ce){return this.composition.insertAttachment(Ce)}insertAttachments(Ce){return this.composition.insertAttachments(Ce)}insertDocument(Ce){return this.composition.insertDocument(Ce)}insertFile(Ce){return this.composition.insertFile(Ce)}insertFiles(Ce){return this.composition.insertFiles(Ce)}insertHTML(Ce){return this.composition.insertHTML(Ce)}insertString(Ce){return this.composition.insertString(Ce)}insertText(Ce){return this.composition.insertText(Ce)}insertLineBreak(){return this.composition.insertLineBreak()}getSelectedRange(){return this.composition.getSelectedRange()}getPosition(){return this.composition.getPosition()}getClientRectAtPosition(Ce){const ke=this.getDocument().locationRangeFromRange([Ce,Ce+1]);return this.selectionManager.getClientRectAtLocationRange(ke)}expandSelectionInDirection(Ce){return this.composition.expandSelectionInDirection(Ce)}moveCursorInDirection(Ce){return this.composition.moveCursorInDirection(Ce)}setSelectedRange(Ce){return this.composition.setSelectedRange(Ce)}activateAttribute(Ce){let ke=!(arguments.length>1&&arguments[1]!==void 0)||arguments[1];return this.composition.setCurrentAttribute(Ce,ke)}attributeIsActive(Ce){return this.composition.hasCurrentAttribute(Ce)}canActivateAttribute(Ce){return this.composition.canSetCurrentAttribute(Ce)}deactivateAttribute(Ce){return this.composition.removeCurrentAttribute(Ce)}setHTMLAtributeAtPosition(Ce,ke,$n){this.composition.setHTMLAtributeAtPosition(Ce,ke,$n)}canDecreaseNestingLevel(){return this.composition.canDecreaseNestingLevel()}canIncreaseNestingLevel(){return this.composition.canIncreaseNestingLevel()}decreaseNestingLevel(){if(this.canDecreaseNestingLevel())return this.composition.decreaseNestingLevel()}increaseNestingLevel(){if(this.canIncreaseNestingLevel())return this.composition.increaseNestingLevel()}canRedo(){return this.undoManager.canRedo()}canUndo(){return this.undoManager.canUndo()}recordUndoEntry(Ce){let{context:ke,consolidatable:$n}=arguments.length>1&&arguments[1]!==void 0?arguments[1]:{};return this.undoManager.recordUndoEntry(Ce,{context:ke,consolidatable:$n})}redo(){if(this.canRedo())return this.undoManager.redo()}undo(){if(this.canUndo())return this.undoManager.undo()}}class yi{constructor(Ce){this.element=Ce}findLocationFromContainerAndOffset(Ce,ke){let{strict:$n}=arguments.length>2&&arguments[2]!==void 0?arguments[2]:{strict:!0},Hn=0,zn=!1;const Un={index:0,offset:0},qn=this.findAttachmentElementParentForNode(Ce);qn&&(Ce=qn.parentNode,ke=C$1(qn));const Xn=R(this.element,{usingFilter:Ei});for(;Xn.nextNode();){const Kn=Xn.currentNode;if(Kn===Ce&&O(Ce)){P(Kn)||(Un.offset+=ke);break}if(Kn.parentNode===Ce){if(Hn++===ke)break}else if(!y(Ce,Kn)&&Hn>0)break;T(Kn,{strict:$n})?(zn&&Un.index++,Un.offset=0,zn=!0):Un.offset+=Ci(Kn)}return Un}findContainerAndOffsetFromLocation(Ce){let ke,$n;if(Ce.index===0&&Ce.offset===0){for(ke=this.element,$n=0;ke.firstChild;)if(ke=ke.firstChild,w(ke)){$n=1;break}return[ke,$n]}let[Hn,zn]=this.findNodeAndOffsetFromLocation(Ce);if(Hn){if(O(Hn))Ci(Hn)===0?(ke=Hn.parentNode.parentNode,$n=C$1(Hn.parentNode),P(Hn,{name:"right"})&&$n++):(ke=Hn,$n=Ce.offset-zn);else{if(ke=Hn.parentNode,!T(Hn.previousSibling)&&!w(ke))for(;Hn===ke.lastChild&&(Hn=ke,ke=ke.parentNode,!w(ke)););$n=C$1(Hn),Ce.offset!==0&&$n++}return[ke,$n]}}findNodeAndOffsetFromLocation(Ce){let ke,$n,Hn=0;for(const zn of this.getSignificantNodesForIndex(Ce.index)){const Un=Ci(zn);if(Ce.offset<=Hn+Un)if(O(zn)){if(ke=zn,$n=Hn,Ce.offset===$n&&P
Line truncated
|
||||
`]):(Ce=qi($n),ke=qi(Hn)),{additions:Ce.filter((zn,Un)=>zn!==ke[Un]).map(Wt),deletions:ke.filter((zn,Un)=>zn!==Ce[Un]).map(Wt)}}getTextChangesFromCharacterData(){let Ce,ke;const $n=this.getMutationsByType("characterData");if($n.length){const Hn=$n[0],zn=$n[$n.length-1],Un=function(qn,Xn){let Kn,to;return qn=X.box(qn),(Xn=X.box(Xn)).length<qn.length?[to,Kn]=Vt(qn,Xn):[Kn,to]=Vt(Xn,qn),{added:Kn,removed:to}}(Wt(Hn.oldValue),Wt(zn.target.data));Ce=Un.added,ke=Un.removed}return{additions:Ce?[Ce]:[],deletions:ke?[ke]:[]}}}const qi=function(){let _n=arguments.length>0&&arguments[0]!==void 0?arguments[0]:[];const Ce=[];for(const ke of Array.from(_n))switch(ke.nodeType){case Node.TEXT_NODE:Ce.push(ke.data);break;case Node.ELEMENT_NODE:E(ke)==="br"?Ce.push(`
|
||||
`):Ce.push(...Array.from(qi(ke.childNodes)||[]))}return Ce};class Vi extends te{constructor(Ce){super(...arguments),this.file=Ce}perform(Ce){const ke=new FileReader;return ke.onerror=()=>Ce(!1),ke.onload=()=>{ke.onerror=null;try{ke.abort()}catch{}return Ce(!0,this.file)},ke.readAsArrayBuffer(this.file)}}class Hi{constructor(Ce){this.element=Ce}shouldIgnore(Ce){return!!a.samsungAndroid&&(this.previousEvent=this.event,this.event=Ce,this.checkSamsungKeyboardBuggyModeStart(),this.checkSamsungKeyboardBuggyModeEnd(),this.buggyMode)}checkSamsungKeyboardBuggyModeStart(){this.insertingLongTextAfterUnidentifiedChar()&&zi(this.element.innerText,this.event.data)&&(this.buggyMode=!0,this.event.preventDefault())}checkSamsungKeyboardBuggyModeEnd(){this.buggyMode&&this.event.inputType!=="insertText"&&(this.buggyMode=!1)}insertingLongTextAfterUnidentifiedChar(){var Ce;return this.isBeforeInputInsertText()&&this.previousEventWasUnidentifiedKeydown()&&((Ce=this.event.data)===null||Ce===void 0?void 0:Ce.length)>50}isBeforeInputInsertText(){return this.event.type==="beforeinput"&&this.event.inputType==="insertText"}previousEventWasUnidentifiedKeydown(){var Ce,ke;return((Ce=this.previousEvent)===null||Ce===void 0?void 0:Ce.type)==="keydown"&&((ke=this.previousEvent)===null||ke===void 0?void 0:ke.key)==="Unidentified"}}const zi=(_n,Ce)=>Ji(_n)===Ji(Ce),_i=new RegExp("(".concat("","|").concat(h,"|").concat(d,"|\\s)+"),"g"),Ji=_n=>_n.replace(_i," ").trim();class Ki extends H{constructor(Ce){super(...arguments),this.element=Ce,this.mutationObserver=new Ui(this.element),this.mutationObserver.delegate=this,this.flakyKeyboardDetector=new Hi(this.element);for(const ke in this.constructor.events)f(ke,{onElement:this.element,withCallback:this.handlerFor(ke)})}elementDidMutate(Ce){}editorWillSyncDocumentView(){return this.mutationObserver.stop()}editorDidSyncDocumentView(){return this.mutationObserver.start()}requestRender(){var Ce,ke;return(Ce=this.delegate)===null||Ce===void 0||(ke=Ce.inputControllerDidRequestRender)===null||ke===void 0?void 0:ke.call(Ce)}requestReparse(){var Ce,ke;return(Ce=this.delegate)===null||Ce===void 0||(ke=Ce.inputControllerDidRequestReparse)===null||ke===void 0||ke.call(Ce),this.requestRender()}attachFiles(Ce){const ke=Array.from(Ce).map($n=>new Vi($n));return Promise.all(ke).then($n=>{this.handleInput(function(){var Hn,zn;return(Hn=this.delegate)===null||Hn===void 0||Hn.inputControllerWillAttachFiles(),(zn=this.responder)===null||zn===void 0||zn.insertFiles($n),this.requestRender()})})}handlerFor(Ce){return ke=>{ke.defaultPrevented||this.handleInput(()=>{if(!x(this.element)){if(this.flakyKeyboardDetector.shouldIgnore(ke))return;this.eventName=Ce,this.constructor.events[Ce].call(this,ke)}})}}handleInput(Ce){try{var ke;(ke=this.delegate)===null||ke===void 0||ke.inputControllerWillHandleInput(),Ce.call(this)}finally{var $n;($n=this.delegate)===null||$n===void 0||$n.inputControllerDidHandleInput()}}createLinkHTML(Ce,ke){const $n=document.createElement("a");return $n.href=Ce,$n.textContent=ke||Ce,$n.outerHTML}}var Gi;Re(Ki,"events",{});const{browser:$i,keyNames:Xi}=V;let Yi=0;class Qi extends Ki{constructor(){super(...arguments),this.resetInputSummary()}setInputSummary(){let Ce=arguments.length>0&&arguments[0]!==void 0?arguments[0]:{};this.inputSummary.eventName=this.eventName;for(const ke in Ce){const $n=Ce[ke];this.inputSummary[ke]=$n}return this.inputSummary}resetInputSummary(){this.inputSummary={}}reset(){return this.resetInputSummary(),Pt.reset()}elementDidMutate(Ce){var ke,$n;return this.isComposing()?(ke=this.delegate)===null||ke===void 0||($n=ke.inputControllerDidAllowUnhandledInput)===null||$n===void 0?void 0:$n.call(ke):this.handleInput(function(){return this.mutationIsSignificant(Ce)&&(this.mutationIsExpected(Ce)?this.requestRender():this.requestReparse()),this.reset()})}mutationIsExpected(Ce){let{textAdded:ke,textDeleted:$n}=Ce;if(this.inputSummary.preferDocument)return!0;const Hn=ke!=null?ke===this.inputSummary.textAdded:!this.inputSummary.textAdded,zn=$n!=null?this.inputSummary.didDelete:!this.inputSummary.didDelete,Un=[`
|
||||
`,`
|
||||
`].includes(ke)&&!Hn,qn=$n===`
|
||||
`&&!zn;if(Un&&!qn||qn&&!Un){const Kn=this.getSelectedRange();if(Kn){var Xn;const to=Un?ke.replace(/\n$/,"").length||-1:(ke==null?void 0:ke.length)||1;if((Xn=this.responder)!==null&&Xn!==void 0&&Xn.positionIsBlockBreak(Kn[1]+to))return!0}}return Hn&&zn}mutationIsSignificant(Ce){var ke;const $n=Object.keys(Ce).length>0,Hn=((ke=this.compositionInput)===null||ke===void 0?void 0:ke.getEndData())==="";return $n||!Hn}getCompositionInput(){if(this.isComposing())return this.compositionInput;this.compositionInput=new rn(this)}isComposing(){return this.compositionInput&&!this.compositionInput.isEnded()}deleteInDirection(Ce,ke){var $n;return(($n=this.responder)===null||$n===void 0?void 0:$n.deleteInDirection(Ce))!==!1?this.setInputSummary({didDelete:!0}):ke?(ke.preventDefault(),this.requestRender()):void 0}serializeSelectionToDataTransfer(Ce){var ke;if(!function(Hn){if(Hn==null||!Hn.setData)return!1;for(const zn in yt){const Un=yt[zn];try{if(Hn.setData(zn,Un),!Hn.getData(zn)===Un)return!1}catch{return!1}}return!0}(Ce))return;const $n=(ke=this.responder)===null||ke===void 0?void 0:ke.getSelectedDocument().toSerializableDocument();return Ce.setData("application/x-trix-document",JSON.stringify($n)),Ce.setData("text/html",ve.render($n).innerHTML),Ce.setData("text/plain",$n.toString().replace(/\n$/,"")),!0}canAcceptDataTransfer(Ce){const ke={};return Array.from((Ce==null?void 0:Ce.types)||[]).forEach($n=>{ke[$n]=!0}),ke.Files||ke["application/x-trix-document"]||ke["text/html"]||ke["text/plain"]}getPastedHTMLUsingHiddenElement(Ce){const ke=this.getSelectedRange(),$n={position:"absolute",left:"".concat(window.pageXOffset,"px"),top:"".concat(window.pageYOffset,"px"),opacity:0},Hn=S$1({style:$n,tagName:"div",editable:!0});return document.body.appendChild(Hn),Hn.focus(),requestAnimationFrame(()=>{const zn=Hn.innerHTML;return k(Hn),this.setSelectedRange(ke),Ce(zn)})}}Re(Qi,"events",{keydown(_n){this.isComposing()||this.resetInputSummary(),this.inputSummary.didInput=!0;const Ce=Xi[_n.keyCode];if(Ce){var ke;let Hn=this.keys;["ctrl","alt","shift","meta"].forEach(zn=>{var Un;_n["".concat(zn,"Key")]&&(zn==="ctrl"&&(zn="control"),Hn=(Un=Hn)===null||Un===void 0?void 0:Un[zn])}),((ke=Hn)===null||ke===void 0?void 0:ke[Ce])!=null&&(this.setInputSummary({keyName:Ce}),Pt.reset(),Hn[Ce].call(this,_n))}if(kt(_n)){const Hn=String.fromCharCode(_n.keyCode).toLowerCase();if(Hn){var $n;const zn=["alt","shift"].map(Un=>{if(_n["".concat(Un,"Key")])return Un}).filter(Un=>Un);zn.push(Hn),($n=this.delegate)!==null&&$n!==void 0&&$n.inputControllerDidReceiveKeyboardCommand(zn)&&_n.preventDefault()}}},keypress(_n){if(this.inputSummary.eventName!=null||_n.metaKey||_n.ctrlKey&&!_n.altKey)return;const Ce=en(_n);var ke,$n;return Ce?((ke=this.delegate)===null||ke===void 0||ke.inputControllerWillPerformTyping(),($n=this.responder)===null||$n===void 0||$n.insertString(Ce),this.setInputSummary({textAdded:Ce,didDelete:this.selectionIsExpanded()})):void 0},textInput(_n){const{data:Ce}=_n,{textAdded:ke}=this.inputSummary;if(ke&&ke!==Ce&&ke.toUpperCase()===Ce){var $n;const Hn=this.getSelectedRange();return this.setSelectedRange([Hn[0],Hn[1]+ke.length]),($n=this.responder)===null||$n===void 0||$n.insertString(Ce),this.setInputSummary({textAdded:Ce}),this.setSelectedRange(Hn)}},dragenter(_n){_n.preventDefault()},dragstart(_n){var Ce,ke;return this.serializeSelectionToDataTransfer(_n.dataTransfer),this.draggedRange=this.getSelectedRange(),(Ce=this.delegate)===null||Ce===void 0||(ke=Ce.inputControllerDidStartDrag)===null||ke===void 0?void 0:ke.call(Ce)},dragover(_n){if(this.draggedRange||this.canAcceptDataTransfer(_n.dataTransfer)){_n.preventDefault();const $n={x:_n.clientX,y:_n.clientY};var Ce,ke;if(!St($n,this.draggingPoint))return this.draggingPoint=$n,(Ce=this.delegate)===null||Ce===void 0||(ke=Ce.inputControllerDidReceiveDragOverPoint)===null||ke===void 0?void 0:ke.call(Ce,this.draggingPoint)}},dragend(_n){var Ce,ke;(Ce=this.delegate)===null||Ce===void 0||(ke=Ce.inputControllerDidCancelDrag)===null||ke===void 0||ke.call(Ce),this.draggedRange=null,this.draggingPoint=null},drop(_n){var Ce,ke;_n.preventDefault();const $n=(Ce=_n.dataTransfer)===null||Ce===void 0?void 0:Ce.files,Hn=_n.dataTransfer.getData("application/x-trix-document"),zn={x:_n.clientX,y:_n.clientY};if((ke=this.responder)===null||ke===void 0||ke.setLocationRangeFromPointRange(zn),$n!=null&&$n.length)this.attachFiles($n);else if(this.draggedRange){var Un,qn;(Un=this.delegate)===null||Un===void 0||Un.inputControllerWillMoveText(),(qn=this.responder)===null||qn===void 0||qn.moveTextFromRange(this.draggedRange),this.draggedRange=null,this.requestRender()}else if(Hn){var Xn;const Kn=Je.fromJSONString(Hn);(Xn=this.responder)===null||Xn===void 0||Xn.insertDocument(Kn),this.requestRender()}this.draggedRange=null,this.draggingPoint=null},cut(_n){var Ce,ke;if((Ce=this.responder)!==null&&Ce!==void 0&&Ce.selectionIsExpanded()&&(this.serializeSelectionToDataTransfer(_n.clipboardData)&&_n.preventDefault(),(ke=this.del
Line truncated
|
||||
`,{updatePosition:!1}),this.requestRender()}},shift:{return(_n){var Ce,ke;(Ce=this.delegate)===null||Ce===void 0||Ce.inputControllerWillPerformTyping(),(ke=this.responder)===null||ke===void 0||ke.insertString(`
|
||||
`),this.requestRender(),_n.preventDefault()},tab(_n){var Ce,ke;(Ce=this.responder)!==null&&Ce!==void 0&&Ce.canDecreaseNestingLevel()&&((ke=this.responder)===null||ke===void 0||ke.decreaseNestingLevel(),this.requestRender(),_n.preventDefault())},left(_n){if(this.selectionIsInCursorTarget())return _n.preventDefault(),this.expandSelectionInDirection("backward")},right(_n){if(this.selectionIsInCursorTarget())return _n.preventDefault(),this.expandSelectionInDirection("forward")}},alt:{backspace(_n){var Ce;return this.setInputSummary({preferDocument:!1}),(Ce=this.delegate)===null||Ce===void 0?void 0:Ce.inputControllerWillPerformTyping()}},meta:{backspace(_n){var Ce;return this.setInputSummary({preferDocument:!1}),(Ce=this.delegate)===null||Ce===void 0?void 0:Ce.inputControllerWillPerformTyping()}}}),Qi.proxyMethod("responder?.getSelectedRange"),Qi.proxyMethod("responder?.setSelectedRange"),Qi.proxyMethod("responder?.expandSelectionInDirection"),Qi.proxyMethod("responder?.selectionIsInCursorTarget"),Qi.proxyMethod("responder?.selectionIsExpanded");const Zi=_n=>{var Ce;return(Ce=_n.type)===null||Ce===void 0||(Ce=Ce.match(/\/(\w+)$/))===null||Ce===void 0?void 0:Ce[1]},tn=!((Gi=" ".codePointAt)===null||Gi===void 0||!Gi.call(" ",0)),en=function(_n){if(_n.key&&tn&&_n.key.codePointAt(0)===_n.keyCode)return _n.key;{let Ce;if(_n.which===null?Ce=_n.keyCode:_n.which!==0&&_n.charCode!==0&&(Ce=_n.charCode),Ce!=null&&Xi[Ce]!=="escape")return X.fromCodepoints([Ce]).toString()}},nn=function(_n){const Ce=_n.clipboardData;if(Ce){if(Ce.types.includes("text/html")){for(const ke of Ce.types){const $n=/^CorePasteboardFlavorType/.test(ke),Hn=/^dyn\./.test(ke)&&Ce.getData(ke);if($n||Hn)return!0}return!1}{const ke=Ce.types.includes("com.apple.webarchive"),$n=Ce.types.includes("com.apple.flat-rtfd");return ke||$n}}};class rn extends H{constructor(Ce){super(...arguments),this.inputController=Ce,this.responder=this.inputController.responder,this.delegate=this.inputController.delegate,this.inputSummary=this.inputController.inputSummary,this.data={}}start(Ce){if(this.data.start=Ce,this.isSignificant()){var ke,$n;this.inputSummary.eventName==="keypress"&&this.inputSummary.textAdded&&(($n=this.responder)===null||$n===void 0||$n.deleteInDirection("left")),this.selectionIsExpanded()||(this.insertPlaceholder(),this.requestRender()),this.range=(ke=this.responder)===null||ke===void 0?void 0:ke.getSelectedRange()}}update(Ce){if(this.data.update=Ce,this.isSignificant()){const ke=this.selectPlaceholder();ke&&(this.forgetPlaceholder(),this.range=ke)}}end(Ce){return this.data.end=Ce,this.isSignificant()?(this.forgetPlaceholder(),this.canApplyToDocument()?(this.setInputSummary({preferDocument:!0,didInput:!1}),(ke=this.delegate)===null||ke===void 0||ke.inputControllerWillPerformTyping(),($n=this.responder)===null||$n===void 0||$n.setSelectedRange(this.range),(Hn=this.responder)===null||Hn===void 0||Hn.insertString(this.data.end),(zn=this.responder)===null||zn===void 0?void 0:zn.setSelectedRange(this.range[0]+this.data.end.length)):this.data.start!=null||this.data.update!=null?(this.requestReparse(),this.inputController.reset()):void 0):this.inputController.reset();var ke,$n,Hn,zn}getEndData(){return this.data.end}isEnded(){return this.getEndData()!=null}isSignificant(){return!$i.composesExistingText||this.inputSummary.didInput}canApplyToDocument(){var Ce,ke;return((Ce=this.data.start)===null||Ce===void 0?void 0:Ce.length)===0&&((ke=this.data.end)===null||ke===void 0?void 0:ke.length)>0&&this.range}}rn.proxyMethod("inputController.setInputSummary"),rn.proxyMethod("inputController.requestRender"),rn.proxyMethod("inputController.requestReparse"),rn.proxyMethod("responder?.selectionIsExpanded"),rn.proxyMethod("responder?.insertPlaceholder"),rn.proxyMethod("responder?.selectPlaceholder"),rn.proxyMethod("responder?.forgetPlaceholder");class on extends Ki{constructor(){super(...arguments),this.render=this.render.bind(this)}elementDidMutate(){return this.scheduledRender?this.composing?(Ce=this.delegate)===null||Ce===void 0||(ke=Ce.inputControllerDidAllowUnhandledInput)===null||ke===void 0?void 0:ke.call(Ce):void 0:this.reparse();var Ce,ke}scheduleRender(){return this.scheduledRender?this.scheduledRender:this.scheduledRender=requestAnimationFrame(this.render)}render(){var Ce,ke;cancelAnimationFrame(this.scheduledRender),this.scheduledRender=null,this.composing||(ke=this.delegate)===null||ke===void 0||ke.render(),(Ce=this.afterRender)===null||Ce===void 0||Ce.call(this),this.afterRender=null}reparse(){var Ce;return(Ce=this.delegate)===null||Ce===void 0?void 0:Ce.reparse()}insertString(){var Ce;let ke=arguments.length>0&&arguments[0]!==void 0?arguments[0]:"",$n=arguments.length>1?arguments[1]:void 0;return(Ce=this.delegate)===null||Ce===void 0||Ce.inputControllerWillPerformTyping(),this.withTargetDOMRange(function(){var Hn;return(Hn=this.responder)===null||Hn===void 0?void 0:Hn.insertString(ke,$n)})}toggleAttributeIfSupported(Ce){var ke;if(dt().includes(Ce))return(ke
Line truncated
|
||||
`)},insertLink(){return this.activateAttributeIfSupported("href",this.event.data)},insertOrderedList(){return this.toggleAttributeIfSupported("number")},insertParagraph(){var _n;return(_n=this.delegate)===null||_n===void 0||_n.inputControllerWillPerformTyping(),this.withTargetDOMRange(function(){var Ce;return(Ce=this.responder)===null||Ce===void 0?void 0:Ce.insertLineBreak()})},insertReplacementText(){const _n=this.event.dataTransfer.getData("text/plain"),Ce=this.event.getTargetRanges()[0];this.withTargetDOMRange(Ce,()=>{this.insertString(_n,{updatePosition:!1})})},insertText(){var _n;return this.insertString(this.event.data||((_n=this.event.dataTransfer)===null||_n===void 0?void 0:_n.getData("text/plain")))},insertTranspose(){return this.insertString(this.event.data)},insertUnorderedList(){return this.toggleAttributeIfSupported("bullet")}});const sn=function(_n){const Ce=document.createRange();return Ce.setStart(_n.startContainer,_n.startOffset),Ce.setEnd(_n.endContainer,_n.endOffset),Ce},an=_n=>{var Ce;return Array.from(((Ce=_n.dataTransfer)===null||Ce===void 0?void 0:Ce.types)||[]).includes("Files")},ln=_n=>{var Ce;return((Ce=_n.dataTransfer.files)===null||Ce===void 0?void 0:Ce[0])&&!cn(_n)&&!(ke=>{let{dataTransfer:$n}=ke;return $n.types.includes("Files")&&$n.types.includes("text/html")&&$n.getData("text/html").includes("urn:schemas-microsoft-com:office:office")})(_n)},cn=function(_n){const Ce=_n.clipboardData;if(Ce)return Array.from(Ce.types).filter(ke=>ke.match(/file/i)).length===Ce.types.length&&Ce.files.length>=1},un=function(_n){const Ce=_n.clipboardData;if(Ce)return Ce.types.includes("text/plain")&&Ce.types.length===1},hn=function(_n){const Ce=[];return _n.altKey&&Ce.push("alt"),_n.shiftKey&&Ce.push("shift"),Ce.push(_n.key),Ce},dn=_n=>({x:_n.clientX,y:_n.clientY}),gn="[data-trix-attribute]",mn="[data-trix-action]",pn="".concat(gn,", ").concat(mn),fn="[data-trix-dialog]",bn="".concat(fn,"[data-trix-active]"),vn="".concat(fn," [data-trix-method]"),An="".concat(fn," [data-trix-input]"),xn=(_n,Ce)=>(Ce||(Ce=Cn(_n)),_n.querySelector("[data-trix-input][name='".concat(Ce,"']"))),yn=_n=>_n.getAttribute("data-trix-action"),Cn=_n=>_n.getAttribute("data-trix-attribute")||_n.getAttribute("data-trix-dialog-attribute");class kn extends H{constructor(Ce){super(Ce),this.didClickActionButton=this.didClickActionButton.bind(this),this.didClickAttributeButton=this.didClickAttributeButton.bind(this),this.didClickDialogButton=this.didClickDialogButton.bind(this),this.didKeyDownDialogInput=this.didKeyDownDialogInput.bind(this),this.element=Ce,this.attributes={},this.actions={},this.resetDialogInputs(),f("mousedown",{onElement:this.element,matchingSelector:mn,withCallback:this.didClickActionButton}),f("mousedown",{onElement:this.element,matchingSelector:gn,withCallback:this.didClickAttributeButton}),f("click",{onElement:this.element,matchingSelector:pn,preventDefault:!0}),f("click",{onElement:this.element,matchingSelector:vn,withCallback:this.didClickDialogButton}),f("keydown",{onElement:this.element,matchingSelector:An,withCallback:this.didKeyDownDialogInput})}didClickActionButton(Ce,ke){var $n;($n=this.delegate)===null||$n===void 0||$n.toolbarDidClickButton(),Ce.preventDefault();const Hn=yn(ke);return this.getDialog(Hn)?this.toggleDialog(Hn):(zn=this.delegate)===null||zn===void 0?void 0:zn.toolbarDidInvokeAction(Hn,ke);var zn}didClickAttributeButton(Ce,ke){var $n;($n=this.delegate)===null||$n===void 0||$n.toolbarDidClickButton(),Ce.preventDefault();const Hn=Cn(ke);var zn;return this.getDialog(Hn)?this.toggleDialog(Hn):(zn=this.delegate)===null||zn===void 0||zn.toolbarDidToggleAttribute(Hn),this.refreshAttributeButtons()}didClickDialogButton(Ce,ke){const $n=A(ke,{matchingSelector:fn});return this[ke.getAttribute("data-trix-method")].call(this,$n)}didKeyDownDialogInput(Ce,ke){if(Ce.keyCode===13){Ce.preventDefault();const $n=ke.getAttribute("name"),Hn=this.getDialog($n);this.setAttribute(Hn)}if(Ce.keyCode===27)return Ce.preventDefault(),this.hideDialog()}updateActions(Ce){return this.actions=Ce,this.refreshActionButtons()}refreshActionButtons(){return this.eachActionButton((Ce,ke)=>{Ce.disabled=this.actions[ke]===!1})}eachActionButton(Ce){return Array.from(this.element.querySelectorAll(mn)).map(ke=>Ce(ke,yn(ke)))}updateAttributes(Ce){return this.attributes=Ce,this.refreshAttributeButtons()}refreshAttributeButtons(){return this.eachAttributeButton((Ce,ke)=>(Ce.disabled=this.attributes[ke]===!1,this.attributes[ke]||this.dialogIsVisible(ke)?(Ce.setAttribute("data-trix-active",""),Ce.classList.add("trix-active")):(Ce.removeAttribute("data-trix-active"),Ce.classList.remove("trix-active"))))}eachAttributeButton(Ce){return Array.from(this.element.querySelectorAll(gn)).map(ke=>Ce(ke,Cn(ke)))}applyKeyboardCommand(Ce){const ke=JSON.stringify(Ce.sort());for(const $n of Array.from(this.element.querySelectorAll("[data-trix-key]"))){const Hn=$n.getAttribute("data-trix-key").split("+");if(JSON.stringify(Hn.sort())===ke)return b("mousedo
Line truncated
|
||||
display: block;
|
||||
}
|
||||
|
||||
%t {
|
||||
white-space: nowrap;
|
||||
}
|
||||
|
||||
%t [data-trix-dialog] {
|
||||
display: none;
|
||||
}
|
||||
|
||||
%t [data-trix-dialog][data-trix-active] {
|
||||
display: block;
|
||||
}
|
||||
|
||||
%t [data-trix-dialog] [data-trix-validate]:invalid {
|
||||
background-color: #ffdddd;
|
||||
}`);class Dn extends HTMLElement{connectedCallback(){this.innerHTML===""&&(this.innerHTML=U.getDefaultHTML())}}let wn=0;const Tn=function(_n){if(!_n.hasAttribute("contenteditable"))return _n.setAttribute("contenteditable",""),function(Ce){let ke=arguments.length>1&&arguments[1]!==void 0?arguments[1]:{};return ke.times=1,f(Ce,ke)}("focus",{onElement:_n,withCallback:()=>Bn(_n)})},Bn=function(_n){return Fn(_n),Pn()},Fn=function(_n){var Ce,ke;if((Ce=(ke=document).queryCommandSupported)!==null&&Ce!==void 0&&Ce.call(ke,"enableObjectResizing"))return document.execCommand("enableObjectResizing",!1,!1),f("mscontrolselect",{onElement:_n,preventDefault:!0})},Pn=function(_n){var Ce,ke;if((Ce=(ke=document).queryCommandSupported)!==null&&Ce!==void 0&&Ce.call(ke,"DefaultParagraphSeparator")){const{tagName:$n}=n.default;if(["div","p"].includes($n))return document.execCommand("DefaultParagraphSeparator",!1,$n)}},In=a.forcesObjectResizing?{display:"inline",width:"auto"}:{display:"inline-block",width:"1px"};bt("trix-editor",`%t {
|
||||
display: block;
|
||||
}
|
||||
|
||||
%t:empty::before {
|
||||
content: attr(placeholder);
|
||||
color: graytext;
|
||||
cursor: text;
|
||||
pointer-events: none;
|
||||
white-space: pre-line;
|
||||
}
|
||||
|
||||
%t a[contenteditable=false] {
|
||||
cursor: text;
|
||||
}
|
||||
|
||||
%t img {
|
||||
max-width: 100%;
|
||||
height: auto;
|
||||
}
|
||||
|
||||
%t `.concat(e,` figcaption textarea {
|
||||
resize: none;
|
||||
}
|
||||
|
||||
%t `).concat(e,` figcaption textarea.trix-autoresize-clone {
|
||||
position: absolute;
|
||||
left: -9999px;
|
||||
max-height: 0px;
|
||||
}
|
||||
|
||||
%t `).concat(e,` figcaption[data-trix-placeholder]:empty::before {
|
||||
content: attr(data-trix-placeholder);
|
||||
color: graytext;
|
||||
}
|
||||
|
||||
%t [data-trix-cursor-target] {
|
||||
display: `).concat(In.display,` !important;
|
||||
width: `).concat(In.width,` !important;
|
||||
padding: 0 !important;
|
||||
margin: 0 !important;
|
||||
border: none !important;
|
||||
}
|
||||
|
||||
%t [data-trix-cursor-target=left] {
|
||||
vertical-align: top !important;
|
||||
margin-left: -1px !important;
|
||||
}
|
||||
|
||||
%t [data-trix-cursor-target=right] {
|
||||
vertical-align: bottom !important;
|
||||
margin-right: -1px !important;
|
||||
}`));class Nn extends HTMLElement{get trixId(){return this.hasAttribute("trix-id")?this.getAttribute("trix-id"):(this.setAttribute("trix-id",++wn),this.trixId)}get labels(){const Ce=[];this.id&&this.ownerDocument&&Ce.push(...Array.from(this.ownerDocument.querySelectorAll("label[for='".concat(this.id,"']"))||[]));const ke=A(this,{matchingSelector:"label"});return ke&&[this,null].includes(ke.control)&&Ce.push(ke),Ce}get toolbarElement(){var Ce;if(this.hasAttribute("toolbar"))return(Ce=this.ownerDocument)===null||Ce===void 0?void 0:Ce.getElementById(this.getAttribute("toolbar"));if(this.parentNode){const ke="trix-toolbar-".concat(this.trixId);this.setAttribute("toolbar",ke);const $n=S$1("trix-toolbar",{id:ke});return this.parentNode.insertBefore($n,this),$n}}get form(){var Ce;return(Ce=this.inputElement)===null||Ce===void 0?void 0:Ce.form}get inputElement(){var Ce;if(this.hasAttribute("input"))return(Ce=this.ownerDocument)===null||Ce===void 0?void 0:Ce.getElementById(this.getAttribute("input"));if(this.parentNode){const ke="trix-input-".concat(this.trixId);this.setAttribute("input",ke);const $n=S$1("input",{type:"hidden",id:ke});return this.parentNode.insertBefore($n,this.nextElementSibling),$n}}get editor(){var Ce;return(Ce=this.editorController)===null||Ce===void 0?void 0:Ce.editor}get name(){var Ce;return(Ce=this.inputElement)===null||Ce===void 0?void 0:Ce.name}get value(){var Ce;return(Ce=this.inputElement)===null||Ce===void 0?void 0:Ce.value}set value(Ce){var ke;this.defaultValue=Ce,(ke=this.editor)===null||ke===void 0||ke.loadHTML(this.defaultValue)}notify(Ce,ke){if(this.editorController)return b("trix-".concat(Ce),{onElement:this,attributes:ke})}setInputElementValue(Ce){this.inputElement&&(this.inputElement.value=Ce)}connectedCallback(){this.hasAttribute("data-trix-internal")||(Tn(this),function(Ce){Ce.hasAttribute("role")||Ce.setAttribute("role","textbox")}(this),function(Ce){if(Ce.hasAttribute("aria-label")||Ce.hasAttribute("aria-labelledby"))return;const ke=function(){const $n=Array.from(Ce.labels).map(zn=>{if(!zn.contains(Ce))return zn.textContent}).filter(zn=>zn),Hn=$n.join(" ");return Hn?Ce.setAttribute("aria-label",Hn):Ce.removeAttribute("aria-label")};ke(),f("focus",{onElement:Ce,withCallback:ke})}(this),this.editorController||(b("trix-before-initialize",{onElement:this}),this.editorController=new Rn({editorElement:this,html:this.defaultValue=this.value}),requestAnimationFrame(()=>b("trix-initialize",{onElement:this}))),this.editorController.registerSelectionManager(),this.registerResetListener(),this.registerClickListener(),function(Ce){!document.querySelector(":focus")&&Ce.hasAttribute("autofocus")&&document.querySelector("[autofocus]")===Ce&&Ce.focus()}(this))}disconnectedCallback(){var Ce;return(Ce=this.editorController)===null||Ce===void 0||Ce.unregisterSelectionManager(),this.unregisterResetListener(),this.unregisterClickListener()}registerResetListener(){return this.resetListener=this.resetBubbled.bind(this),window.addEventListener("reset",this.resetListener,!1)}unregisterResetListener(){return window.removeEventListener("reset",this.resetListener,!1)}registerClickListener(){return this.clickListener=this.clickBubbled.bind(this),window.addEventListener("click",this.clickListener,!1)}unregisterClickListener(){return window.removeEventListener("click",this.clickListener,!1)}resetBubbled(Ce){if(!Ce.defaultPrevented&&Ce.target===this.form)return this.reset()}clickBubbled(Ce){if(Ce.defaultPrevented||this.contains(Ce.target))return;const ke=A(Ce.target,{matchingSelector:"label"});return ke&&Array.from(this.labels).includes(ke)?this.focus():void 0}reset(){this.value=this.defaultValue}}const On={VERSION:t$1,config:V,core:ci,models:Di,views:wi,controllers:En,observers:Sn,operations:Ln,elements:Object.freeze({__proto__:null,TrixEditorElement:Nn,TrixToolbarElement:Dn}),filters:Object.freeze({__proto__:null,Filter:bi,attachmentGalleryFilter:vi})};Object.assign(On,Di),window.Trix=On,setTimeout(function(){customElements.get("trix-toolbar")||customElements.define("trix-toolbar",Dn),customElements.get("trix-editor")||customElements.define("trix-editor",Nn)},0);function create_fragment$k(_n){let Ce,ke,$n,Hn,zn,Un,qn,Xn;return{c(){Ce=element("div"),ke=element("input"),Hn=space$3(),zn=element("trix-editor"),attr(ke,"id",$n="x-"+_n[1].name),ke.value=_n[0],attr(ke,"type","hidden"),set_custom_element_data(zn,"class","content"),set_custom_element_data(zn,"input",Un="x-"+_n[1].name),set_custom_element_data(zn,"role","textbox"),set_custom_element_data(zn,"tabindex","0"),attr(Ce,"class","tox-wrapper")},m(Kn,to){insert$1(Kn,Ce,to),append(Ce,ke),append(Ce,Hn),append(Ce,zn),_n[5](zn),qn||(Xn=listen(zn,"trix-change",_n[3]),qn=!0)},p(Kn,[to]){to&2&&$n!==($n="x-"+Kn[1].name)&&attr(ke,"id",$n),to&1&&(ke.value=Kn[0]),to&2&&Un!==(Un="x-"+Kn[1].name)&&set_custom_element_data(zn,"input",Un)},i:noop,o:noop,d(Kn){Kn&&detach(Ce),_n[5](null),qn=!1,Xn()}}}function instance$k(_n,Ce,ke){let{value:$n=""}=Ce,{field:Hn}=Ce,zn;functio
Line truncated
|
||||
`){[Ce,ke]=clip(this,Ce,ke);let Hn="";for(let zn=0,Un=0;zn<=ke&&Un<this.text.length;Un++){let qn=this.text[Un],Xn=zn+qn.length;zn>Ce&&Un&&(Hn+=$n),Ce<Xn&&ke>zn&&(Hn+=qn.slice(Math.max(0,Ce-zn),ke-zn)),zn=Xn+1}return Hn}flatten(Ce){for(let ke of this.text)Ce.push(ke)}scanIdentical(){return 0}static split(Ce,ke){let $n=[],Hn=-1;for(let zn of Ce)$n.push(zn),Hn+=zn.length+1,$n.length==32&&(ke.push(new TextLeaf($n,Hn)),$n=[],Hn=-1);return Hn>-1&&ke.push(new TextLeaf($n,Hn)),ke}}class TextNode extends Text{constructor(Ce,ke){super(),this.children=Ce,this.length=ke,this.lines=0;for(let $n of Ce)this.lines+=$n.lines}lineInner(Ce,ke,$n,Hn){for(let zn=0;;zn++){let Un=this.children[zn],qn=Hn+Un.length,Xn=$n+Un.lines-1;if((ke?Xn:qn)>=Ce)return Un.lineInner(Ce,ke,$n,Hn);Hn=qn+1,$n=Xn+1}}decompose(Ce,ke,$n,Hn){for(let zn=0,Un=0;Un<=ke&&zn<this.children.length;zn++){let qn=this.children[zn],Xn=Un+qn.length;if(Ce<=Xn&&ke>=Un){let Kn=Hn&((Un<=Ce?1:0)|(Xn>=ke?2:0));Un>=Ce&&Xn<=ke&&!Kn?$n.push(qn):qn.decompose(Ce-Un,ke-Un,$n,Kn)}Un=Xn+1}}replace(Ce,ke,$n){if([Ce,ke]=clip(this,Ce,ke),$n.lines<this.lines)for(let Hn=0,zn=0;Hn<this.children.length;Hn++){let Un=this.children[Hn],qn=zn+Un.length;if(Ce>=zn&&ke<=qn){let Xn=Un.replace(Ce-zn,ke-zn,$n),Kn=this.lines-Un.lines+Xn.lines;if(Xn.lines<Kn>>4&&Xn.lines>Kn>>6){let to=this.children.slice();return to[Hn]=Xn,new TextNode(to,this.length-(ke-Ce)+$n.length)}return super.replace(zn,qn,Xn)}zn=qn+1}return super.replace(Ce,ke,$n)}sliceString(Ce,ke=this.length,$n=`
|
||||
`){[Ce,ke]=clip(this,Ce,ke);let Hn="";for(let zn=0,Un=0;zn<this.children.length&&Un<=ke;zn++){let qn=this.children[zn],Xn=Un+qn.length;Un>Ce&&zn&&(Hn+=$n),Ce<Xn&&ke>Un&&(Hn+=qn.sliceString(Ce-Un,ke-Un,$n)),Un=Xn+1}return Hn}flatten(Ce){for(let ke of this.children)ke.flatten(Ce)}scanIdentical(Ce,ke){if(!(Ce instanceof TextNode))return 0;let $n=0,[Hn,zn,Un,qn]=ke>0?[0,0,this.children.length,Ce.children.length]:[this.children.length-1,Ce.children.length-1,-1,-1];for(;;Hn+=ke,zn+=ke){if(Hn==Un||zn==qn)return $n;let Xn=this.children[Hn],Kn=Ce.children[zn];if(Xn!=Kn)return $n+Xn.scanIdentical(Kn,ke);$n+=Xn.length+1}}static from(Ce,ke=Ce.reduce(($n,Hn)=>$n+Hn.length+1,-1)){let $n=0;for(let ho of Ce)$n+=ho.lines;if($n<32){let ho=[];for(let bo of Ce)bo.flatten(ho);return new TextLeaf(ho,ke)}let Hn=Math.max(32,$n>>5),zn=Hn<<1,Un=Hn>>1,qn=[],Xn=0,Kn=-1,to=[];function io(ho){let bo;if(ho.lines>zn&&ho instanceof TextNode)for(let Oo of ho.children)io(Oo);else ho.lines>Un&&(Xn>Un||!Xn)?(uo(),qn.push(ho)):ho instanceof TextLeaf&&Xn&&(bo=to[to.length-1])instanceof TextLeaf&&ho.lines+bo.lines<=32?(Xn+=ho.lines,Kn+=ho.length+1,to[to.length-1]=new TextLeaf(bo.text.concat(ho.text),bo.length+1+ho.length)):(Xn+ho.lines>Hn&&uo(),Xn+=ho.lines,Kn+=ho.length+1,to.push(ho))}function uo(){Xn!=0&&(qn.push(to.length==1?to[0]:TextNode.from(to,Kn)),Kn=-1,Xn=to.length=0)}for(let ho of Ce)io(ho);return uo(),qn.length==1?qn[0]:new TextNode(qn,ke)}}Text.empty=new TextLeaf([""],0);function textLength(_n){let Ce=-1;for(let ke of _n)Ce+=ke.length+1;return Ce}function appendText(_n,Ce,ke=0,$n=1e9){for(let Hn=0,zn=0,Un=!0;zn<_n.length&&Hn<=$n;zn++){let qn=_n[zn],Xn=Hn+qn.length;Xn>=ke&&(Xn>$n&&(qn=qn.slice(0,$n-Hn)),Hn<ke&&(qn=qn.slice(ke-Hn)),Un?(Ce[Ce.length-1]+=qn,Un=!1):Ce.push(qn)),Hn=Xn+1}return Ce}function sliceText(_n,Ce,ke){return appendText(_n,[""],Ce,ke)}class RawTextCursor{constructor(Ce,ke=1){this.dir=ke,this.done=!1,this.lineBreak=!1,this.value="",this.nodes=[Ce],this.offsets=[ke>0?1:(Ce instanceof TextLeaf?Ce.text.length:Ce.children.length)<<1]}nextInner(Ce,ke){for(this.done=this.lineBreak=!1;;){let $n=this.nodes.length-1,Hn=this.nodes[$n],zn=this.offsets[$n],Un=zn>>1,qn=Hn instanceof TextLeaf?Hn.text.length:Hn.children.length;if(Un==(ke>0?qn:0)){if($n==0)return this.done=!0,this.value="",this;ke>0&&this.offsets[$n-1]++,this.nodes.pop(),this.offsets.pop()}else if((zn&1)==(ke>0?0:1)){if(this.offsets[$n]+=ke,Ce==0)return this.lineBreak=!0,this.value=`
|
||||
`,this;Ce--}else if(Hn instanceof TextLeaf){let Xn=Hn.text[Un+(ke<0?-1:0)];if(this.offsets[$n]+=ke,Xn.length>Math.max(0,Ce))return this.value=Ce==0?Xn:ke>0?Xn.slice(Ce):Xn.slice(0,Xn.length-Ce),this;Ce-=Xn.length}else{let Xn=Hn.children[Un+(ke<0?-1:0)];Ce>Xn.length?(Ce-=Xn.length,this.offsets[$n]+=ke):(ke<0&&this.offsets[$n]--,this.nodes.push(Xn),this.offsets.push(ke>0?1:(Xn instanceof TextLeaf?Xn.text.length:Xn.children.length)<<1))}}}next(Ce=0){return Ce<0&&(this.nextInner(-Ce,-this.dir),Ce=this.value.length),this.nextInner(Ce,this.dir)}}class PartialTextCursor{constructor(Ce,ke,$n){this.value="",this.done=!1,this.cursor=new RawTextCursor(Ce,ke>$n?-1:1),this.pos=ke>$n?Ce.length:0,this.from=Math.min(ke,$n),this.to=Math.max(ke,$n)}nextInner(Ce,ke){if(ke<0?this.pos<=this.from:this.pos>=this.to)return this.value="",this.done=!0,this;Ce+=Math.max(0,ke<0?this.pos-this.to:this.from-this.pos);let $n=ke<0?this.pos-this.from:this.to-this.pos;Ce>$n&&(Ce=$n),$n-=Ce;let{value:Hn}=this.cursor.next(Ce);return this.pos+=(Hn.length+Ce)*ke,this.value=Hn.length<=$n?Hn:ke<0?Hn.slice(Hn.length-$n):Hn.slice(0,$n),this.done=!this.value,this}next(Ce=0){return Ce<0?Ce=Math.max(Ce,this.from-this.pos):Ce>0&&(Ce=Math.min(Ce,this.to-this.pos)),this.nextInner(Ce,this.cursor.dir)}get lineBreak(){return this.cursor.lineBreak&&this.value!=""}}class LineCursor{constructor(Ce){this.inner=Ce,this.afterBreak=!0,this.value="",this.done=!1}next(Ce=0){let{done:ke,lineBreak:$n,value:Hn}=this.inner.next(Ce);return ke&&this.afterBreak?(this.value="",this.afterBreak=!1):ke?(this.done=!0,this.value=""):$n?this.afterBreak?this.value="":(this.afterBreak=!0,this.next()):(this.value=Hn,this.afterBreak=!1),this}get lineBreak(){return!1}}typeof Symbol<"u"&&(Text.prototype[Symbol.iterator]=function(){return this.iter()},RawTextCursor.prototype[Symbol.iterator]=PartialTextCursor.prototype[Symbol.iterator]=LineCursor.prototype[Symbol.iterator]=function(){return this});let Line$1=class{constructor(Ce,ke,$n,Hn){this.from=Ce,this.to=ke,this.number=$n,this.text=Hn}get length(){return this.to-this.from}};function clip(_n,Ce,ke){return Ce=Math.max(0,Math.min(_n.length,Ce)),[Ce,Math.max(Ce,Math.min(_n.length,ke))]}let extend="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(_n=>_n?parseInt(_n,36):1);for(let _n=1;_n<extend.length;_n++)extend[_n]+=extend[_n-1];function isExtendingChar(_n){for(let Ce=1;Ce<extend.length;Ce+=2)if(extend[Ce]>_n)return extend[Ce-1]<=_n;return!1}function isRegionalIndicator(_n){return _n>=127462&&_n<=127487}const ZWJ=8205;function findClusterBreak(_n,Ce,ke=!0,$n=!0){return(ke?nextClusterBreak:prevClusterBreak)(_n,Ce,$n)}function nextClusterBreak(_n,Ce,ke){if(Ce==_n.length)return Ce;Ce&&surrogateLow(_n.charCodeAt(Ce))&&surrogateHigh(_n.charCodeAt(Ce-1))&&Ce--;let $n=codePointAt(_n,Ce);for(Ce+=codePointSize($n);Ce<_n.length;){let Hn=codePointAt(_n,Ce);if($n==ZWJ||Hn==ZWJ||ke&&isExtendingChar(Hn))Ce+=codePointSize(Hn),$n=Hn;else if(isRegionalIndicator(Hn)){let zn=0,Un=Ce-2;for(;Un>=0&&isRegionalIndicator(codePointAt(_n,Un));)zn++,Un-=2;if(zn%2==0)break;Ce+=2}else break}return Ce}function prevClusterBreak(_n,Ce,ke){for(;Ce>0;){let $n=nextClusterBreak(_n,Ce-2,ke);if($n<Ce)return $n;Ce--}return 0}function surrogateLow(_n){return _n>=56320&&_n<57344}function surrogateHigh(_n){return _n>=55296&&_n<56320}function codePointAt(_n,Ce){let ke=_n.charCodeAt(Ce);if(!surrogateHigh(ke)||Ce+1==_n.length)return ke;let $n=_n.charCodeAt(Ce+1);return surrogateLow($n)?(ke-55296<<10)+($n-56320)+65536:ke}function fromCodePoint(_n){return _n<=65535?String.fromCharCode(_n):(_n-=65536,String.fromCharCode((_n>>10)+55296,(_n&1023)+56320))}function codePointSize(_n){return _n<65536?1:2}const DefaultS
Line truncated
|
||||
`}get readOnly(){return this.facet(readOnly)}phrase(Ce,...ke){for(let $n of this.facet(EditorState.phrases))if(Object.prototype.hasOwnProperty.call($n,Ce)){Ce=$n[Ce];break}return ke.length&&(Ce=Ce.replace(/\$(\$|\d*)/g,($n,Hn)=>{if(Hn=="$")return"$";let zn=+(Hn||1);return!zn||zn>ke.length?$n:ke[zn-1]})),Ce}languageDataAt(Ce,ke,$n=-1){let Hn=[];for(let zn of this.facet(languageData))for(let Un of zn(this,ke,$n))Object.prototype.hasOwnProperty.call(Un,Ce)&&Hn.push(Un[Ce]);return Hn}charCategorizer(Ce){return makeCategorizer(this.languageDataAt("wordChars",Ce).join(""))}wordAt(Ce){let{text:ke,from:$n,length:Hn}=this.doc.lineAt(Ce),zn=this.charCategorizer(Ce),Un=Ce-$n,qn=Ce-$n;for(;Un>0;){let Xn=findClusterBreak(ke,Un,!1);if(zn(ke.slice(Xn,Un))!=CharCategory.Word)break;Un=Xn}for(;qn<Hn;){let Xn=findClusterBreak(ke,qn);if(zn(ke.slice(qn,Xn))!=CharCategory.Word)break;qn=Xn}return Un==qn?null:EditorSelection.range(Un+$n,qn+$n)}}EditorState.allowMultipleSelections=allowMultipleSelections;EditorState.tabSize=Facet.define({combine:_n=>_n.length?_n[0]:4});EditorState.lineSeparator=lineSeparator;EditorState.readOnly=readOnly;EditorState.phrases=Facet.define({compare(_n,Ce){let ke=Object.keys(_n),$n=Object.keys(Ce);return ke.length==$n.length&&ke.every(Hn=>_n[Hn]==Ce[Hn])}});EditorState.languageData=languageData;EditorState.changeFilter=changeFilter;EditorState.transactionFilter=transactionFilter;EditorState.transactionExtender=transactionExtender;Compartment.reconfigure=StateEffect.define();function combineConfig(_n,Ce,ke={}){let $n={};for(let Hn of _n)for(let zn of Object.keys(Hn)){let Un=Hn[zn],qn=$n[zn];if(qn===void 0)$n[zn]=Un;else if(!(qn===Un||Un===void 0))if(Object.hasOwnProperty.call(ke,zn))$n[zn]=ke[zn](qn,Un);else throw new Error("Config merge conflict for field "+zn)}for(let Hn in Ce)$n[Hn]===void 0&&($n[Hn]=Ce[Hn]);return $n}class RangeValue{eq(Ce){return this==Ce}range(Ce,ke=Ce){return Range$2.create(Ce,ke,this)}}RangeValue.prototype.startSide=RangeValue.prototype.endSide=0;RangeValue.prototype.point=!1;RangeValue.prototype.mapMode=MapMode.TrackDel;let Range$2=class rK{constructor(Ce,ke,$n){this.from=Ce,this.to=ke,this.value=$n}static create(Ce,ke,$n){return new rK(Ce,ke,$n)}};function cmpRange(_n,Ce){return _n.from-Ce.from||_n.value.startSide-Ce.value.startSide}class Chunk{constructor(Ce,ke,$n,Hn){this.from=Ce,this.to=ke,this.value=$n,this.maxPoint=Hn}get length(){return this.to[this.to.length-1]}findIndex(Ce,ke,$n,Hn=0){let zn=$n?this.to:this.from;for(let Un=Hn,qn=zn.length;;){if(Un==qn)return Un;let Xn=Un+qn>>1,Kn=zn[Xn]-Ce||($n?this.value[Xn].endSide:this.value[Xn].startSide)-ke;if(Xn==Un)return Kn>=0?Un:qn;Kn>=0?qn=Xn:Un=Xn+1}}between(Ce,ke,$n,Hn){for(let zn=this.findIndex(ke,-1e9,!0),Un=this.findIndex($n,1e9,!1,zn);zn<Un;zn++)if(Hn(this.from[zn]+Ce,this.to[zn]+Ce,this.value[zn])===!1)return!1}map(Ce,ke){let $n=[],Hn=[],zn=[],Un=-1,qn=-1;for(let Xn=0;Xn<this.value.length;Xn++){let Kn=this.value[Xn],to=this.from[Xn]+Ce,io=this.to[Xn]+Ce,uo,ho;if(to==io){let bo=ke.mapPos(to,Kn.startSide,Kn.mapMode);if(bo==null||(uo=ho=bo,Kn.startSide!=Kn.endSide&&(ho=ke.mapPos(to,Kn.endSide),ho<uo)))continue}else if(uo=ke.mapPos(to,Kn.startSide),ho=ke.mapPos(io,Kn.endSide),uo>ho||uo==ho&&Kn.startSide>0&&Kn.endSide<=0)continue;(ho-uo||Kn.endSide-Kn.startSide)<0||(Un<0&&(Un=uo),Kn.point&&(qn=Math.max(qn,ho-uo)),$n.push(Kn),Hn.push(uo-Un),zn.push(ho-Un))}return{mapped:$n.length?new Chunk(Hn,zn,$n,qn):null,pos:Un}}}class RangeSet{constructor(Ce,ke,$n,Hn){this.chunkPos=Ce,this.chunk=ke,this.nextLayer=$n,this.maxPoint=Hn}static create(Ce,ke,$n,Hn){return new RangeSet(Ce,ke,$n,Hn)}get length(){let Ce=this.chunk.length-1;return Ce<0?0:Math.max(this.chunkEnd(Ce),this.nextLayer.length)}get size(){if(this.isEmpty)return 0;let Ce=this.nextLayer.size;for(let ke of this.chunk)Ce+=ke.value.length;return Ce}chunkEnd(Ce){return this.chunkPos[Ce]+this.chunk[Ce].length}update(Ce){let{add:ke=[],sort:$n=!1,filterFrom:Hn=0,filterTo:zn=this.length}=Ce,Un=Ce.filter;if(ke.length==0&&!Un)return this;if($n&&(ke=ke.slice().sort(cmpRange)),this.isEmpty)return ke.length?RangeSet.of(ke):this;let qn=new LayerCursor(this,null,-1).goto(0),Xn=0,Kn=[],to=new RangeSetBuilder;for(;qn.value||Xn<ke.length;)if(Xn<ke.length&&(qn.from-ke[Xn].from||qn.startSide-ke[Xn].value.startSide)>=0){let io=ke[Xn++];to.addInner(io.from,io.to,io.value)||Kn.push(io)}else qn.rangeIndex==1&&qn.chunkIndex<this.chunk.length&&(Xn==ke.length||this.chunkEnd(qn.chunkIndex)<ke[Xn].from)&&(!Un||Hn>this.chunkEnd(qn.chunkIndex)||zn<this.chunkPos[qn.chunkIndex])&&to.addChunk(this.chunkPos[qn.chunkIndex],this.chunk[qn.chunkIndex])?qn.nextChunk():((!Un||Hn>qn.to||zn<qn.from||Un(qn.from,qn.to,qn.value))&&(to.addInner(qn.from,qn.to,qn.value)||Kn.push(Range$2.create(qn.from,qn.to,qn.value))),qn.next());return to.finishInner(this.nextLayer.isEmpty&&!Kn.length?RangeSet.empty:this.nextLayer.update({add:Kn,filter:Un,filterFrom:Hn,filterTo:zn}))}map(Ce){if(Ce.empty||this.isEmpty)return this;let ke=
Line truncated
|
||||
`)}static newName(){let Ce=top[COUNT]||1;return top[COUNT]=Ce+1,C+Ce.toString(36)}static mount(Ce,ke,$n){let Hn=Ce[SET],zn=$n&&$n.nonce;Hn?zn&&Hn.setNonce(zn):Hn=new StyleSet(Ce,zn),Hn.mount(Array.isArray(ke)?ke:[ke],Ce)}}let adoptedSet=new Map;class StyleSet{constructor(Ce,ke){let $n=Ce.ownerDocument||Ce,Hn=$n.defaultView;if(!Ce.head&&Ce.adoptedStyleSheets&&Hn.CSSStyleSheet){let zn=adoptedSet.get($n);if(zn)return Ce[SET]=zn;this.sheet=new Hn.CSSStyleSheet,adoptedSet.set($n,this)}else this.styleTag=$n.createElement("style"),ke&&this.styleTag.setAttribute("nonce",ke);this.modules=[],Ce[SET]=this}mount(Ce,ke){let $n=this.sheet,Hn=0,zn=0;for(let Un=0;Un<Ce.length;Un++){let qn=Ce[Un],Xn=this.modules.indexOf(qn);if(Xn<zn&&Xn>-1&&(this.modules.splice(Xn,1),zn--,Xn=-1),Xn==-1){if(this.modules.splice(zn++,0,qn),$n)for(let Kn=0;Kn<qn.rules.length;Kn++)$n.insertRule(qn.rules[Kn],Hn++)}else{for(;zn<Xn;)Hn+=this.modules[zn++].rules.length;Hn+=qn.rules.length,zn++}}if($n)ke.adoptedStyleSheets.indexOf(this.sheet)<0&&(ke.adoptedStyleSheets=[this.sheet,...ke.adoptedStyleSheets]);else{let Un="";for(let Xn=0;Xn<this.modules.length;Xn++)Un+=this.modules[Xn].getRules()+`
|
||||
`;this.styleTag.textContent=Un;let qn=ke.head||ke;this.styleTag.parentNode!=qn&&qn.insertBefore(this.styleTag,qn.firstChild)}}setNonce(Ce){this.styleTag&&this.styleTag.getAttribute("nonce")!=Ce&&this.styleTag.setAttribute("nonce",Ce)}}var base={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:"'"},shift={48:")",49:"!",50:"@",51:"#",52:"$",53:"%",54:"^",55:"&",56:"*",57:"(",59:":",61:"+",173:"_",186:":",187:"+",188:"<",189:"_",190:">",191:"?",192:"~",219:"{",220:"|",221:"}",222:'"'},mac=typeof navigator<"u"&&/Mac/.test(navigator.platform),ie$1=typeof navigator<"u"&&/MSIE \d|Trident\/(?:[7-9]|\d{2,})\..*rv:(\d+)/.exec(navigator.userAgent);for(var i=0;i<10;i++)base[48+i]=base[96+i]=String(i);for(var i=1;i<=24;i++)base[i+111]="F"+i;for(var i=65;i<=90;i++)base[i]=String.fromCharCode(i+32),shift[i]=String.fromCharCode(i);for(var code in base)shift.hasOwnProperty(code)||(shift[code]=base[code]);function keyName(_n){var Ce=mac&&_n.metaKey&&_n.shiftKey&&!_n.ctrlKey&&!_n.altKey||ie$1&&_n.shiftKey&&_n.key&&_n.key.length==1||_n.key=="Unidentified",ke=!Ce&&_n.key||(_n.shiftKey?shift:base)[_n.keyCode]||_n.key||"Unidentified";return ke=="Esc"&&(ke="Escape"),ke=="Del"&&(ke="Delete"),ke=="Left"&&(ke="ArrowLeft"),ke=="Up"&&(ke="ArrowUp"),ke=="Right"&&(ke="ArrowRight"),ke=="Down"&&(ke="ArrowDown"),ke}function getSelection(_n){let Ce;return _n.nodeType==11?Ce=_n.getSelection?_n:_n.ownerDocument:Ce=_n,Ce.getSelection()}function contains(_n,Ce){return Ce?_n==Ce||_n.contains(Ce.nodeType!=1?Ce.parentNode:Ce):!1}function deepActiveElement(_n){let Ce=_n.activeElement;for(;Ce&&Ce.shadowRoot;)Ce=Ce.shadowRoot.activeElement;return Ce}function hasSelection(_n,Ce){if(!Ce.anchorNode)return!1;try{return contains(_n,Ce.anchorNode)}catch{return!1}}function clientRectsFor(_n){return _n.nodeType==3?textRange(_n,0,_n.nodeValue.length).getClientRects():_n.nodeType==1?_n.getClientRects():[]}function isEquivalentPosition(_n,Ce,ke,$n){return ke?scanFor(_n,Ce,ke,$n,-1)||scanFor(_n,Ce,ke,$n,1):!1}function domIndex(_n){for(var Ce=0;;Ce++)if(_n=_n.previousSibling,!_n)return Ce}function isBlockElement(_n){return _n.nodeType==1&&/^(DIV|P|LI|UL|OL|BLOCKQUOTE|DD|DT|H\d|SECTION|PRE)$/.test(_n.nodeName)}function scanFor(_n,Ce,ke,$n,Hn){for(;;){if(_n==ke&&Ce==$n)return!0;if(Ce==(Hn<0?0:maxOffset(_n))){if(_n.nodeName=="DIV")return!1;let zn=_n.parentNode;if(!zn||zn.nodeType!=1)return!1;Ce=domIndex(_n)+(Hn<0?0:1),_n=zn}else if(_n.nodeType==1){if(_n=_n.childNodes[Ce+(Hn<0?-1:0)],_n.nodeType==1&&_n.contentEditable=="false")return!1;Ce=Hn<0?maxOffset(_n):0}else return!1}}function maxOffset(_n){return _n.nodeType==3?_n.nodeValue.length:_n.childNodes.length}function flattenRect(_n,Ce){let ke=Ce?_n.left:_n.right;return{left:ke,right:ke,top:_n.top,bottom:_n.bottom}}function windowRect(_n){let Ce=_n.visualViewport;return Ce?{left:0,right:Ce.width,top:0,bottom:Ce.height}:{left:0,right:_n.innerWidth,top:0,bottom:_n.innerHeight}}function getScale(_n,Ce){let ke=Ce.width/_n.offsetWidth,$n=Ce.height/_n.offsetHeight;return(ke>.995&&ke<1.005||!isFinite(ke)||Math.abs(Ce.width-_n.offsetWidth)<1)&&(ke=1),($n>.995&&$n<1.005||!isFinite($n)||Math.abs(Ce.height-_n.offsetHeight)<1)&&($n=1),{scaleX:ke,scaleY:$n}}function scrollRectIntoView(_n,Ce,ke,$n,Hn,zn,Un,qn){let Xn=_n.ownerDocument,Kn=Xn.defaultView||window;for(let to=_n,io=!1;to&&!io;)if(to.nodeType==1){let uo,ho=to==Xn.body,bo=1,Oo=1;if(ho)uo=windowRect(Kn);else{if(/^(fixed|sticky)$/.test(getComputedStyle(to).position)&&(io=!0),to.scrollHeight<=to.clientHeight&&to.scrollWidth<=to.clientWidth){to=to.assignedSlot||to.parentNode;continue}let Do=to.getBoundingClientRect();({scaleX:bo,scaleY:Oo}=getScale(to,Do)),uo={left:Do.left,right:Do.left+to.clientWidth*bo,top:Do.top,bottom:Do.top+to.clientHeight*Oo}}let So=0,$o=0;if(Hn=="nearest")Ce.top<uo.top?($o=-(uo.top-Ce.top+Un),ke>0&&Ce.bottom>uo.bottom+$o&&($o=Ce.bottom-uo.bottom+$o+Un)):Ce.bottom>uo.bottom&&($o=Ce.bottom-uo.bottom+Un,ke<0&&Ce.top-$o<uo.top&&($o=-(uo.top+$o-Ce.top+Un)));else{let Do=Ce.bottom-Ce.top,xo=uo.bottom-uo.top;$o=(Hn=="center"&&Do<=xo?Ce.top+Do/2-xo/2:Hn=="start"||Hn=="center"&&ke<0?Ce.top-Un:Ce.bottom-xo+Un)-uo.top}if($n=="nearest"?Ce.left<uo.left?(So=-(uo.left-Ce.left+zn),ke>0&&Ce.right>uo.right+So&&(So=Ce.right-uo.right+So+zn)):Ce.right>uo.right&&(So=Ce.right-uo.right+zn,ke<0&&Ce.left<uo.left+So&&(So=-(uo.left+So-Ce.left+zn))):So=($n=="center"?Ce.left+(Ce.right-Ce.left)/2-(uo.right-uo.left)/2:$n=="start"==qn?Ce.left-zn:Ce.right-(uo.right-uo.left)+zn)-uo.left,So||$o)if(ho)KLine truncated
|
||||
`,Hn=_n.state.doc.line(Hn.number+(ke?1:-1)),zn=_n.bidiSpans(Hn),Kn=_n.visualLineSide(Hn,!ke)}if(Xn){if(!Xn(to))return qn}else{if(!$n)return Kn;Xn=$n(to)}qn=Kn}}function byGroup(_n,Ce,ke){let $n=_n.state.charCategorizer(Ce),Hn=$n(ke);return zn=>{let Un=$n(zn);return Hn==CharCategory.Space&&(Hn=Un),Hn==Un}}function moveVertically(_n,Ce,ke,$n){let Hn=Ce.head,zn=ke?1:-1;if(Hn==(ke?_n.state.doc.length:0))return EditorSelection.cursor(Hn,Ce.assoc);let Un=Ce.goalColumn,qn,Xn=_n.contentDOM.getBoundingClientRect(),Kn=_n.coordsAtPos(Hn,Ce.assoc||-1),to=_n.documentTop;if(Kn)Un==null&&(Un=Kn.left-Xn.left),qn=zn<0?Kn.top:Kn.bottom;else{let ho=_n.viewState.lineBlockAt(Hn);Un==null&&(Un=Math.min(Xn.right-Xn.left,_n.defaultCharacterWidth*(Hn-ho.from))),qn=(zn<0?ho.top:ho.bottom)+to}let io=Xn.left+Un,uo=$n??_n.viewState.heightOracle.textHeight>>1;for(let ho=0;;ho+=10){let bo=qn+(uo+ho)*zn,Oo=posAtCoords(_n,{x:io,y:bo},!1,zn);if(bo<Xn.top||bo>Xn.bottom||(zn<0?Oo<Hn:Oo>Hn)){let So=_n.docView.coordsForChar(Oo),$o=!So||bo<So.top?-1:1;return EditorSelection.cursor(Oo,$o,void 0,Un)}}}function skipAtomicRanges(_n,Ce,ke){for(;;){let $n=0;for(let Hn of _n)Hn.between(Ce-1,Ce+1,(zn,Un,qn)=>{if(Ce>zn&&Ce<Un){let Xn=$n||ke||(Ce-zn<Un-Ce?-1:1);Ce=Xn<0?zn:Un,$n=Xn}});if(!$n)return Ce}}function skipAtoms(_n,Ce,ke){let $n=skipAtomicRanges(_n.state.facet(atomicRanges).map(Hn=>Hn(_n)),ke.from,Ce.head>ke.from?-1:1);return $n==ke.from?ke:EditorSelection.cursor($n,$n<ke.from?1:-1)}const LineBreakPlaceholder="";class DOMReader{constructor(Ce,ke){this.points=Ce,this.text="",this.lineSeparator=ke.facet(EditorState.lineSeparator)}append(Ce){this.text+=Ce}lineBreak(){this.text+=LineBreakPlaceholder}readRange(Ce,ke){if(!Ce)return this;let $n=Ce.parentNode;for(let Hn=Ce;;){this.findPointBefore($n,Hn);let zn=this.text.length;this.readNode(Hn);let Un=Hn.nextSibling;if(Un==ke)break;let qn=ContentView.get(Hn),Xn=ContentView.get(Un);(qn&&Xn?qn.breakAfter:(qn?qn.breakAfter:isBlockElement(Hn))||isBlockElement(Un)&&(Hn.nodeName!="BR"||Hn.cmIgnore)&&this.text.length>zn)&&this.lineBreak(),Hn=Un}return this.findPointBefore($n,ke),this}readTextNode(Ce){let ke=Ce.nodeValue;for(let $n of this.points)$n.node==Ce&&($n.pos=this.text.length+Math.min($n.offset,ke.length));for(let $n=0,Hn=this.lineSeparator?null:/\r\n?|\n/g;;){let zn=-1,Un=1,qn;if(this.lineSeparator?(zn=ke.indexOf(this.lineSeparator,$n),Un=this.lineSeparator.length):(qn=Hn.exec(ke))&&(zn=qn.index,Un=qn[0].length),this.append(ke.slice($n,zn<0?ke.length:zn)),zn<0)break;if(this.lineBreak(),Un>1)for(let Xn of this.points)Xn.node==Ce&&Xn.pos>this.text.length&&(Xn.pos-=Un-1);$n=zn+Un}}readNode(Ce){if(Ce.cmIgnore)return;let ke=ContentView.get(Ce),$n=ke&&ke.overrideDOMText;if($n!=null){this.findPointInside(Ce,$n.length);for(let Hn=$n.iter();!Hn.next().done;)Hn.lineBreak?this.lineBreak():this.append(Hn.value)}else Ce.nodeType==3?this.readTextNode(Ce):Ce.nodeName=="BR"?Ce.nextSibling&&this.lineBreak():Ce.nodeType==1&&this.readRange(Ce.firstChild,null)}findPointBefore(Ce,ke){for(let $n of this.points)$n.node==Ce&&Ce.childNodes[$n.offset]==ke&&($n.pos=this.text.length)}findPointInside(Ce,ke){for(let $n of this.points)(Ce.nodeType==3?$n.node==Ce:Ce.contains($n.node))&&($n.pos=this.text.length+(isAtEnd(Ce,$n.node,$n.offset)?ke:0))}}function isAtEnd(_n,Ce,ke){for(;;){if(!Ce||ke<maxOffset(Ce))return!1;if(Ce==_n)return!0;ke=domIndex(Ce)+1,Ce=Ce.parentNode}}class DOMPoint{constructor(Ce,ke){this.node=Ce,this.offset=ke,this.pos=-1}}class DOMChange{constructor(Ce,ke,$n,Hn){this.typeOver=Hn,this.bounds=null,this.text="",this.domChanged=ke>-1;let{impreciseHead:zn,impreciseAnchor:Un}=Ce.docView;if(Ce.state.readOnly&&ke>-1)this.newSel=null;else if(ke>-1&&(this.bounds=Ce.docView.domBoundsAround(ke,$n,0))){let qn=zn||Un?[]:selectionPoints(Ce),Xn=new DOMReader(qn,Ce.state);Xn.readRange(this.bounds.startDOM,this.bounds.endDOM),this.text=Xn.text,this.newSel=selectionFromPoints(qn,this.bounds.from)}else{let qn=Ce.observer.selectionRange,Xn=zn&&zn.node==qn.focusNode&&zn.offset==qn.focusOffset||!contains(Ce.contentDOM,qn.focusNode)?Ce.state.selection.main.head:Ce.docView.posFromDOM(qn.focusNode,qn.focusOffset),Kn=Un&&Un.node==qn.anchorNode&&Un.offset==qn.anchorOffset||!contains(Ce.contentDOM,qn.anchorNode)?Ce.state.selection.main.anchor:Ce.docView.posFromDOM(qn.anchorNode,qn.anchorOffset),to=Ce.viewport;if((browser.ios||browser.chrome)&&Ce.state.selection.main.empty&&Xn!=Kn&&(to.from>0||to.to<Ce.state.doc.length)){let io=Math.min(Xn,Kn),uo=Math.max(Xn,Kn),ho=to.from-io,bo=to.to-uo;(ho==0||ho==1||io==0)&&(bo==0||bo==-1||uo==Ce.state.doc.length)&&(Xn=0,Kn=Ce.state.doc.length)}this.newSel=EditorSelection.single(Kn,Xn)}}}function applyDOMChange(_n,Ce){let ke,{newSel:$n}=Ce,Hn=_n.state.selection.main,zn=_n.inputState.lastKeyTime>Date.now()-100?_n.inputState.lastKeyCode:-1;if(Ce.bounds){let{from:Un,to:qn}=Ce.bounds,Xn=Hn.from,Kn=null;(zn===8||browser.android&&Ce.text.length<qn-Un)&&(Xn=Hn.to,Kn="end");let to=findDiff(_n.state.doc.sliceStr
Line truncated
|
||||
`&&_n.lineWrapping&&($n&&($n=EditorSelection.single($n.main.anchor-1,$n.main.head-1)),ke={from:Hn.from,to:Hn.to,insert:Text.of([" "])}),ke)return applyDOMChangeInner(_n,ke,$n,zn);if($n&&!$n.main.eq(Hn)){let Un=!1,qn="select";return _n.inputState.lastSelectionTime>Date.now()-50&&(_n.inputState.lastSelectionOrigin=="select"&&(Un=!0),qn=_n.inputState.lastSelectionOrigin),_n.dispatch({selection:$n,scrollIntoView:Un,userEvent:qn}),!0}else return!1}function applyDOMChangeInner(_n,Ce,ke,$n=-1){if(browser.ios&&_n.inputState.flushIOSKey(Ce))return!0;let Hn=_n.state.selection.main;if(browser.android&&(Ce.to==Hn.to&&(Ce.from==Hn.from||Ce.from==Hn.from-1&&_n.state.sliceDoc(Ce.from,Hn.from)==" ")&&Ce.insert.length==1&&Ce.insert.lines==2&&dispatchKey(_n.contentDOM,"Enter",13)||(Ce.from==Hn.from-1&&Ce.to==Hn.to&&Ce.insert.length==0||$n==8&&Ce.insert.length<Ce.to-Ce.from&&Ce.to>Hn.head)&&dispatchKey(_n.contentDOM,"Backspace",8)||Ce.from==Hn.from&&Ce.to==Hn.to+1&&Ce.insert.length==0&&dispatchKey(_n.contentDOM,"Delete",46)))return!0;let zn=Ce.insert.toString();_n.inputState.composing>=0&&_n.inputState.composing++;let Un,qn=()=>Un||(Un=applyDefaultInsert(_n,Ce,ke));return _n.state.facet(inputHandler$1).some(Xn=>Xn(_n,Ce.from,Ce.to,zn,qn))||_n.dispatch(qn()),!0}function applyDefaultInsert(_n,Ce,ke){let $n,Hn=_n.state,zn=Hn.selection.main;if(Ce.from>=zn.from&&Ce.to<=zn.to&&Ce.to-Ce.from>=(zn.to-zn.from)/3&&(!ke||ke.main.empty&&ke.main.from==Ce.from+Ce.insert.length)&&_n.inputState.composing<0){let qn=zn.from<Ce.from?Hn.sliceDoc(zn.from,Ce.from):"",Xn=zn.to>Ce.to?Hn.sliceDoc(Ce.to,zn.to):"";$n=Hn.replaceSelection(_n.state.toText(qn+Ce.insert.sliceString(0,void 0,_n.state.lineBreak)+Xn))}else{let qn=Hn.changes(Ce),Xn=ke&&ke.main.to<=qn.newLength?ke.main:void 0;if(Hn.selection.ranges.length>1&&_n.inputState.composing>=0&&Ce.to<=zn.to&&Ce.to>=zn.to-10){let Kn=_n.state.sliceDoc(Ce.from,Ce.to),to,io=ke&&findCompositionNode(_n,ke.main.head);if(io){let bo=Ce.insert.length-(Ce.to-Ce.from);to={from:io.from,to:io.to-bo}}else to=_n.state.doc.lineAt(zn.head);let uo=zn.to-Ce.to,ho=zn.to-zn.from;$n=Hn.changeByRange(bo=>{if(bo.from==zn.from&&bo.to==zn.to)return{changes:qn,range:Xn||bo.map(qn)};let Oo=bo.to-uo,So=Oo-Kn.length;if(bo.to-bo.from!=ho||_n.state.sliceDoc(So,Oo)!=Kn||bo.to>=to.from&&bo.from<=to.to)return{range:bo};let $o=Hn.changes({from:So,to:Oo,insert:Ce.insert}),Do=bo.to-zn.to;return{changes:$o,range:Xn?EditorSelection.range(Math.max(0,Xn.anchor+Do),Math.max(0,Xn.head+Do)):bo.map($o)}})}else $n={changes:qn,selection:Xn&&Hn.selection.replaceRange(Xn)}}let Un="input.type";return(_n.composing||_n.inputState.compositionPendingChange&&_n.inputState.compositionEndedAt>Date.now()-50)&&(_n.inputState.compositionPendingChange=!1,Un+=".compose",_n.inputState.compositionFirstChange&&(Un+=".start",_n.inputState.compositionFirstChange=!1)),Hn.update($n,{userEvent:Un,scrollIntoView:!0})}function findDiff(_n,Ce,ke,$n){let Hn=Math.min(_n.length,Ce.length),zn=0;for(;zn<Hn&&_n.charCodeAt(zn)==Ce.charCodeAt(zn);)zn++;if(zn==Hn&&_n.length==Ce.length)return null;let Un=_n.length,qn=Ce.length;for(;Un>0&&qn>0&&_n.charCodeAt(Un-1)==Ce.charCodeAt(qn-1);)Un--,qn--;if($n=="end"){let Xn=Math.max(0,zn-Math.min(Un,qn));ke-=Un+Xn-zn}if(Un<zn&&_n.length<Ce.length){let Xn=ke<=zn&&ke>=Un?zn-ke:0;zn-=Xn,qn=zn+(qn-Un),Un=zn}else if(qn<zn){let Xn=ke<=zn&&ke>=qn?zn-ke:0;zn-=Xn,Un=zn+(Un-qn),qn=zn}return{from:zn,toA:Un,toB:qn}}function selectionPoints(_n){let Ce=[];if(_n.root.activeElement!=_n.contentDOM)return Ce;let{anchorNode:ke,anchorOffset:$n,focusNode:Hn,focusOffset:zn}=_n.observer.selectionRange;return ke&&(Ce.push(new DOMPoint(ke,$n)),(Hn!=ke||zn!=$n)&&Ce.push(new DOMPoint(Hn,zn))),Ce}function selectionFromPoints(_n,Ce){if(_n.length==0)return null;let ke=_n[0].pos,$n=_n.length==2?_n[1].pos:ke;return ke>-1&&$n>-1?EditorSelection.single(ke+Ce,$n+Ce):null}class InputState{setSelectionOrigin(Ce){this.lastSelectionOrigin=Ce,this.lastSelectionTime=Date.now()}constructor(Ce){this.view=Ce,this.lastKeyCode=0,this.lastKeyTime=0,this.lastTouchTime=0,this.lastFocusTime=0,this.lastScrollTop=0,this.lastScrollLeft=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.mouseSelection=null,this.draggedContent=null,this.handleEvent=this.handleEvent.bind(this),this.notifiedFocused=Ce.hasFocus,browser.safari&&Ce.contentDOM.addEventListener("input",()=>null),browser.gecko&&firefoxCopyCutHack(Ce.contentDOM.ownerDocument)}handleEvent(Ce){!eventBelongsToEditor(this.view,Ce)||this.ignoreDuringComposition(Ce)||Ce.type=="keydown"&&this.keydown(Ce)||this.runHandlers(Ce.type,Ce)}runHandlers(Ce,ke){let $n=this.handlers[Ce];if($n){for(let Hn of $n.observers)Hn(this.view,ke);for(let Hn of $n.handlers){if(ke.defaultPrevente
Line truncated
|
||||
`))};zn.from==this.from&&Hn<this.from?zn.from=Hn:zn.to==this.to&&Hn>this.to&&(zn.to=Hn),!(zn.from==zn.to&&!zn.insert.length)&&(this.pendingContextChange=zn,Ce.state.readOnly||applyDOMChangeInner(Ce,zn,EditorSelection.single(this.toEditorPos($n.selectionStart),this.toEditorPos($n.selectionEnd))),this.pendingContextChange&&(this.revertPending(Ce.state),this.setSelection(Ce.state)))},this.handlers.characterboundsupdate=$n=>{let Hn=[],zn=null;for(let Un=this.toEditorPos($n.rangeStart),qn=this.toEditorPos($n.rangeEnd);Un<qn;Un++){let Xn=Ce.coordsForChar(Un);zn=Xn&&new DOMRect(Xn.left,Xn.top,Xn.right-Xn.left,Xn.bottom-Xn.top)||zn||new DOMRect,Hn.push(zn)}ke.updateCharacterBounds($n.rangeStart,Hn)},this.handlers.textformatupdate=$n=>{let Hn=[];for(let zn of $n.getTextFormats()){let Un=zn.underlineStyle,qn=zn.underlineThickness;if(Un!="None"&&qn!="None"){let Xn=`text-decoration: underline ${Un=="Dashed"?"dashed ":Un=="Squiggle"?"wavy ":""}${qn=="Thin"?1:2}px`;Hn.push(Decoration.mark({attributes:{style:Xn}}).range(this.toEditorPos(zn.rangeStart),this.toEditorPos(zn.rangeEnd)))}}Ce.dispatch({effects:setEditContextFormatting.of(Decoration.set(Hn))})},this.handlers.compositionstart=()=>{Ce.inputState.composing<0&&(Ce.inputState.composing=0,Ce.inputState.compositionFirstChange=!0)},this.handlers.compositionend=()=>{Ce.inputState.composing=-1,Ce.inputState.compositionFirstChange=null};for(let $n in this.handlers)ke.addEventListener($n,this.handlers[$n]);this.measureReq={read:$n=>{this.editContext.updateControlBounds($n.contentDOM.getBoundingClientRect());let Hn=getSelection($n.root);Hn&&Hn.rangeCount&&this.editContext.updateSelectionBounds(Hn.getRangeAt(0).getBoundingClientRect())}}}applyEdits(Ce){let ke=0,$n=!1,Hn=this.pendingContextChange;return Ce.changes.iterChanges((zn,Un,qn,Xn,Kn)=>{if($n)return;let to=Kn.length-(Un-zn);if(Hn&&Un>=Hn.to)if(Hn.from==zn&&Hn.to==Un&&Hn.insert.eq(Kn)){Hn=this.pendingContextChange=null,ke+=to,this.to+=to;return}else Hn=null,this.revertPending(Ce.state);if(zn+=ke,Un+=ke,Un<=this.from)this.from+=to,this.to+=to;else if(zn<this.to){if(zn<this.from||Un>this.to||this.to-this.from+Kn.length>3e4){$n=!0;return}this.editContext.updateText(this.toContextPos(zn),this.toContextPos(Un),Kn.toString()),this.to+=to}ke+=to}),Hn&&!$n&&this.revertPending(Ce.state),!$n}update(Ce){let ke=this.pendingContextChange;!this.applyEdits(Ce)||!this.rangeIsValid(Ce.state)?(this.pendingContextChange=null,this.resetRange(Ce.state),this.editContext.updateText(0,this.editContext.text.length,Ce.state.doc.sliceString(this.from,this.to)),this.setSelection(Ce.state)):(Ce.docChanged||Ce.selectionSet||ke)&&this.setSelection(Ce.state),(Ce.geometryChanged||Ce.docChanged||Ce.selectionSet)&&Ce.view.requestMeasure(this.measureReq)}resetRange(Ce){let{head:ke}=Ce.selection.main;this.from=Math.max(0,ke-1e4),this.to=Math.min(Ce.doc.length,ke+1e4)}revertPending(Ce){let ke=this.pendingContextChange;this.pendingContextChange=null,this.editContext.updateText(this.toContextPos(ke.from),this.toContextPos(ke.from+ke.insert.length),Ce.doc.sliceString(ke.from,ke.to))}setSelection(Ce){let{main:ke}=Ce.selection,$n=this.toContextPos(Math.max(this.from,Math.min(this.to,ke.anchor))),Hn=this.toContextPos(ke.head);(this.editContext.selectionStart!=$n||this.editContext.selectionEnd!=Hn)&&this.editContext.updateSelection($n,Hn)}rangeIsValid(Ce){let{head:ke}=Ce.selection.main;return!(this.from>0&&ke-this.from<500||this.to<Ce.doc.length&&this.to-ke<500||this.to-this.from>1e4*3)}toEditorPos(Ce){return Ce+this.from}toContextPos(Ce){return Ce-this.from}destroy(){for(let Ce in this.handlers)this.editContext.removeEventListener(Ce,this.handlers[Ce])}}class EditorView{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.composing>0}get compositionStarted(){return this.inputState.composing>=0}get root(){return this._root}get win(){return this.dom.ownerDocument.defaultView||window}constructor(Ce={}){var ke;this.plugins=[],this.pluginMap=new Map,this.editorAttrs={},this.contentAttrs={},this.bidiCache=[],this.destroyed=!1,this.updateState=2,this.measureScheduled=-1,this.measureRequests=[],this.contentDOM=document.createElement("div"),this.scrollDOM=document.createElement("div"),this.scrollDOM.tabIndex=-1,this.scrollDOM.className="cm-scroller",this.scrollDOM.appendChild(this.contentDOM),this.announceDOM=document.createElement("div"),this.announceDOM.className="cm-announced",this.announceDOM.setAttribute("aria-live","polite"),this.dom=document.createElement("div"),this.dom.appendChild(this.announceDOM),this.dom.appendChild(this.scrollDOM),Ce.parent&&Ce.parent.appendChild(this.dom);let{dispatch:$n}=Ce;this.dispatchTransactions=Ce.dispatchTransactions||$n&&(Hn=>Hn.forEach(zn=>$n(zn,this)))||(Hn=>this.update(Hn)),this.dispatch=this.dispatch.bind(this),this._root=Ce.root||getRoot(Ce.parent)||document,th
Line truncated
|
||||
--\u2028\u2029\uFEFF-]`,UnicodeRegexpSupport),Names={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"};let _supportsTabSize=null;function supportsTabSize(){var _n;if(_supportsTabSize==null&&typeof document<"u"&&document.body){let Ce=document.body.style;_supportsTabSize=((_n=Ce.tabSize)!==null&&_n!==void 0?_n:Ce.MozTabSize)!=null}return _supportsTabSize||!1}const specialCharConfig=Facet.define({combine(_n){let Ce=combineConfig(_n,{render:null,specialChars:Specials,addSpecialChars:null});return(Ce.replaceTabs=!supportsTabSize())&&(Ce.specialChars=new RegExp(" |"+Ce.specialChars.source,UnicodeRegexpSupport)),Ce.addSpecialChars&&(Ce.specialChars=new RegExp(Ce.specialChars.source+"|"+Ce.addSpecialChars.source,UnicodeRegexpSupport)),Ce}});function highlightSpecialChars(_n={}){return[specialCharConfig.of(_n),specialCharPlugin()]}let _plugin=null;function specialCharPlugin(){return _plugin||(_plugin=ViewPlugin.fromClass(class{constructor(_n){this.view=_n,this.decorations=Decoration.none,this.decorationCache=Object.create(null),this.decorator=this.makeDecorator(_n.state.facet(specialCharConfig)),this.decorations=this.decorator.createDeco(_n)}makeDecorator(_n){return new MatchDecorator({regexp:_n.specialChars,decoration:(Ce,ke,$n)=>{let{doc:Hn}=ke.state,zn=codePointAt(Ce[0],0);if(zn==9){let Un=Hn.lineAt($n),qn=ke.state.tabSize,Xn=countColumn(Un.text,qn,$n-Un.from);return Decoration.replace({widget:new TabWidget((qn-Xn%qn)*this.view.defaultCharacterWidth/this.view.scaleX)})}return this.decorationCache[zn]||(this.decorationCache[zn]=Decoration.replace({widget:new SpecialCharWidget(_n,zn)}))},boundary:_n.replaceTabs?void 0:/[^]/})}update(_n){let Ce=_n.state.facet(specialCharConfig);_n.startState.facet(specialCharConfig)!=Ce?(this.decorator=this.makeDecorator(Ce),this.decorations=this.decorator.createDeco(_n.view)):this.decorations=this.decorator.updateDeco(_n,this.decorations)}},{decorations:_n=>_n.decorations}))}const DefaultPlaceholder="•";function placeholder$1(_n){return _n>=32?DefaultPlaceholder:_n==10?"":String.fromCharCode(9216+_n)}class SpecialCharWidget extends WidgetType{constructor(Ce,ke){super(),this.options=Ce,this.code=ke}eq(Ce){return Ce.code==this.code}toDOM(Ce){let ke=placeholder$1(this.code),$n=Ce.state.phrase("Control character")+" "+(Names[this.code]||"0x"+this.code.toString(16)),Hn=this.options.render&&this.options.render(this.code,$n,ke);if(Hn)return Hn;let zn=document.createElement("span");return zn.textContent=ke,zn.title=$n,zn.setAttribute("aria-label",$n),zn.className="cm-specialChar",zn}ignoreEvent(){return!1}}class TabWidget extends WidgetType{constructor(Ce){super(),this.width=Ce}eq(Ce){return Ce.width==this.width}toDOM(){let Ce=document.createElement("span");return Ce.textContent=" ",Ce.className="cm-tab",Ce.style.width=this.width+"px",Ce}ignoreEvent(){return!1}}function highlightActiveLine(){return activeLineHighlighter}const lineDeco=Decoration.line({class:"cm-activeLine"}),activeLineHighlighter=ViewPlugin.fromClass(class{constructor(_n){this.decorations=this.getDeco(_n)}update(_n){(_n.docChanged||_n.selectionSet)&&(this.decorations=this.getDeco(_n.view))}getDeco(_n){let Ce=-1,ke=[];for(let $n of _n.state.selection.ranges){let Hn=_n.lineBlockAt($n.head);Hn.from>Ce&&(ke.push(lineDeco.range(Hn.from)),Ce=Hn.from)}return Decoration.set(ke)}},{decorations:_n=>_n.decorations}),MaxOff=2e3;function rectangleFor(_n,Ce,ke){let $n=Math.min(Ce.line,ke.line),Hn=Math.max(Ce.line,ke.line),zn=[];if(Ce.off>MaxOff||ke.off>MaxOff||Ce.col<0||ke.col<0){let Un=Math.min(Ce.off,ke.off),qn=Math.max(Ce.off,ke.off);for(let Xn=$n;Xn<=Hn;Xn++){let Kn=_n.doc.line(Xn);Kn.length<=qn&&zn.push(EditorSelection.range(Kn.from+Un,Kn.to+qn))}}else{let Un=Math.min(Ce.col,ke.col),qn=Math.max(Ce.col,ke.col);for(let Xn=$n;Xn<=Hn;Xn++){let Kn=_n.doc.line(Xn),to=findColumn(Kn.text,Un,_n.tabSize,!0);if(to<0)zn.push(EditorSelection.cursor(Kn.to));else{let io=findColumn(Kn.text,qn,_n.tabSize);zn.push(EditorSelection.range(Kn.from+to,Kn.from+io))}}}return zn}function absoluteColumn(_n,Ce){let ke=_n.coordsAtPos(_n.viewport.from);return ke?Math.round(Math.abs((ke.left-Ce)/_n.defaultCharacterWidth)):-1}function getPos(_n,Ce){let ke=_n.posAtCoords({x:Ce.clientX,y:Ce.clientY},!1),$n=_n.state.doc.lineAt(ke),Hn=ke-$n.from,zn=Hn>MaxOff?-1:Hn==$n.length?absoluteColumn(_n,Ce.clientX):countColumn($n.text,_n.state.tabSize,ke-$n.from);return{line:$n.number,col:zn,off:Hn}}function rectangleSelectionStyle(_n,Ce){let ke=getPos(_n,Ce),$n=_n.state.selection;return ke?{update(Hn){if(H
Line truncated
|
||||
`:$n=="r"?"\r":$n=="t"?" ":"\\")}eq(Ce){return this.search==Ce.search&&this.replace==Ce.replace&&this.caseSensitive==Ce.caseSensitive&&this.regexp==Ce.regexp&&this.wholeWord==Ce.wholeWord}create(){return this.regexp?new RegExpQuery(this):new StringQuery(this)}getCursor(Ce,ke=0,$n){let Hn=Ce.doc?Ce:EditorState.create({doc:Ce});return $n==null&&($n=Hn.doc.length),this.regexp?regexpCursor(this,Hn,ke,$n):stringCursor(this,Hn,ke,$n)}}class QueryType{constructor(Ce){this.spec=Ce}}function stringCursor(_n,Ce,ke,$n){return new SearchCursor(Ce.doc,_n.unquoted,ke,$n,_n.caseSensitive?void 0:Hn=>Hn.toLowerCase(),_n.wholeWord?stringWordTest(Ce.doc,Ce.charCategorizer(Ce.selection.main.head)):void 0)}function stringWordTest(_n,Ce){return(ke,$n,Hn,zn)=>((zn>ke||zn+Hn.length<$n)&&(zn=Math.max(0,ke-2),Hn=_n.sliceString(zn,Math.min(_n.length,$n+2))),(Ce(charBefore(Hn,ke-zn))!=CharCategory.Word||Ce(charAfter(Hn,ke-zn))!=CharCategory.Word)&&(Ce(charAfter(Hn,$n-zn))!=CharCategory.Word||Ce(charBefore(Hn,$n-zn))!=CharCategory.Word))}class StringQuery extends QueryType{constructor(Ce){super(Ce)}nextMatch(Ce,ke,$n){let Hn=stringCursor(this.spec,Ce,$n,Ce.doc.length).nextOverlapping();return Hn.done&&(Hn=stringCursor(this.spec,Ce,0,ke).nextOverlapping()),Hn.done?null:Hn.value}prevMatchInRange(Ce,ke,$n){for(let Hn=$n;;){let zn=Math.max(ke,Hn-1e4-this.spec.unquoted.length),Un=stringCursor(this.spec,Ce,zn,Hn),qn=null;for(;!Un.nextOverlapping().done;)qn=Un.value;if(qn)return qn;if(zn==ke)return null;Hn-=1e4}}prevMatch(Ce,ke,$n){return this.prevMatchInRange(Ce,0,ke)||this.prevMatchInRange(Ce,$n,Ce.doc.length)}getReplacement(Ce){return this.spec.unquote(this.spec.replace)}matchAll(Ce,ke){let $n=stringCursor(this.spec,Ce,0,Ce.doc.length),Hn=[];for(;!$n.next().done;){if(Hn.length>=ke)return null;Hn.push($n.value)}return Hn}highlight(Ce,ke,$n,Hn){let zn=stringCursor(this.spec,Ce,Math.max(0,ke-this.spec.unquoted.length),Math.min($n+this.spec.unquoted.length,Ce.doc.length));for(;!zn.next().done;)Hn(zn.value.from,zn.value.to)}}function regexpCursor(_n,Ce,ke,$n){return new RegExpCursor(Ce.doc,_n.search,{ignoreCase:!_n.caseSensitive,test:_n.wholeWord?regexpWordTest(Ce.charCategorizer(Ce.selection.main.head)):void 0},ke,$n)}function charBefore(_n,Ce){return _n.slice(findClusterBreak(_n,Ce,!1),Ce)}function charAfter(_n,Ce){return _n.slice(Ce,findClusterBreak(_n,Ce))}function regexpWordTest(_n){return(Ce,ke,$n)=>!$n[0].length||(_n(charBefore($n.input,$n.index))!=CharCategory.Word||_n(charAfter($n.input,$n.index))!=CharCategory.Word)&&(_n(charAfter($n.input,$n.index+$n[0].length))!=CharCategory.Word||_n(charBefore($n.input,$n.index+$n[0].length))!=CharCategory.Word)}class RegExpQuery extends QueryType{nextMatch(Ce,ke,$n){let Hn=regexpCursor(this.spec,Ce,$n,Ce.doc.length).next();return Hn.done&&(Hn=regexpCursor(this.spec,Ce,0,ke).next()),Hn.done?null:Hn.value}prevMatchInRange(Ce,ke,$n){for(let Hn=1;;Hn++){let zn=Math.max(ke,$n-Hn*1e4),Un=regexpCursor(this.spec,Ce,zn,$n),qn=null;for(;!Un.next().done;)qn=Un.value;if(qn&&(zn==ke||qn.from>zn+10))return qn;if(zn==ke)return null}}prevMatch(Ce,ke,$n){return this.prevMatchInRange(Ce,0,ke)||this.prevMatchInRange(Ce,$n,Ce.doc.length)}getReplacement(Ce){return this.spec.unquote(this.spec.replace).replace(/\$([$&\d+])/g,(ke,$n)=>$n=="$"?"$":$n=="&"?Ce.match[0]:$n!="0"&&+$n<Ce.match.length?Ce.match[$n]:ke)}matchAll(Ce,ke){let $n=regexpCursor(this.spec,Ce,0,Ce.doc.length),Hn=[];for(;!$n.next().done;){if(Hn.length>=ke)return null;Hn.push($n.value)}return Hn}highlight(Ce,ke,$n,Hn){let zn=regexpCursor(this.spec,Ce,Math.max(0,ke-250),Math.min($n+250,Ce.doc.length));for(;!zn.next().done;)Hn(zn.value.from,zn.value.to)}}const setSearchQuery=StateEffect.define(),togglePanel$1=StateEffect.define(),searchState=StateField.define({create(_n){return new SearchState(defaultQuery(_n).create(),null)},update(_n,Ce){for(let ke of Ce.effects)ke.is(setSearchQuery)?_n=new SearchState(ke.value.create(),_n.panel):ke.is(togglePanel$1)&&(_n=new SearchState(_n.query,ke.value?createSearchPanel:null));return _n},provide:_n=>showPanel.from(_n,Ce=>Ce.panel)});class SearchState{constructor(Ce,ke){this.query=Ce,this.panel=ke}}const matchMark=Decoration.mark({class:"cm-searchMatch"}),selectedMatchMark=Decoration.mark({class:"cm-searchMatch cm-searchMatch-selected"}),searchHighlighter=ViewPlugin.fromClass(class{constructor(_n){this.view=_n,this.decorations=this.highlight(_n.state.field(searchState))}update(_n){let Ce=_n.state.field(searchState);(Ce!=_n.startState.field(searchState)||_n.docChanged||_n.selectionSet||_n.viewportChanged)&&(this.decorations=this.highlight(Ce))}highlight({query:_n,panel:Ce}){if(!Ce||!_n.spec.valid)return Decoration.none;let{view:ke}=this,$n=new RangeSetBuilder;for(let Hn=0,zn=ke.visibleRanges,Un=zn.length;Hn<Un;Hn++){let{from:qn,to:Xn}=zn[Hn];for(;Hn<Un-1&&Xn>zn[Hn+1].from-2*250;)Xn=zn[++Hn].to;_n.highlight(ke.state,qn,Xn,(Kn,to)=>{let io=ke.state.selection.ranges.some(uo=>uo.from==Kn&&uo.to==to);$n.add(Kn,to,io?selectedM
Line truncated
|
||||
`+ke.scrub(),zn=this.advance(Hn);return zn>-1&&zn<Hn.length?this.complete(Ce,$n,zn):!1}finish(Ce,ke){return(this.stage==2||this.stage==3)&&skipSpace(ke.content,this.pos)==ke.content.length?this.complete(Ce,ke,ke.content.length):!1}complete(Ce,ke,$n){return Ce.addLeafElement(ke,elt(Type.LinkReference,this.start,this.start+$n,this.elts)),!0}nextStage(Ce){return Ce?(this.pos=Ce.to-this.start,this.elts.push(Ce),this.stage++,!0):(Ce===!1&&(this.stage=-1),!1)}advance(Ce){for(;;){if(this.stage==-1)return-1;if(this.stage==0){if(!this.nextStage(parseLinkLabel(Ce,this.pos,this.start,!0)))return-1;if(Ce.charCodeAt(this.pos)!=58)return this.stage=-1;this.elts.push(elt(Type.LinkMark,this.pos+this.start,this.pos+this.start+1)),this.pos++}else if(this.stage==1){if(!this.nextStage(parseURL(Ce,skipSpace(Ce,this.pos),this.start)))return-1}else if(this.stage==2){let ke=skipSpace(Ce,this.pos),$n=0;if(ke>this.pos){let Hn=parseLinkTitle(Ce,ke,this.start);if(Hn){let zn=lineEnd(Ce,Hn.to-this.start);zn>0&&(this.nextStage(Hn),$n=zn)}}return $n||($n=lineEnd(Ce,this.pos)),$n>0&&$n<Ce.length?$n:-1}else return lineEnd(Ce,this.pos)}}}function lineEnd(_n,Ce){for(;Ce<_n.length;Ce++){let ke=_n.charCodeAt(Ce);if(ke==10)break;if(!space$2(ke))return-1}return Ce}class SetextHeadingParser{nextLine(Ce,ke,$n){let Hn=ke.depth<Ce.stack.length?-1:isSetextUnderline(ke),zn=ke.next;if(Hn<0)return!1;let Un=elt(Type.HeaderMark,Ce.lineStart+ke.pos,Ce.lineStart+Hn);return Ce.nextLine(),Ce.addLeafElement($n,elt(zn==61?Type.SetextHeading1:Type.SetextHeading2,$n.start,Ce.prevLineEnd(),[...Ce.parser.parseInline($n.content,$n.start),Un])),!0}finish(){return!1}}const DefaultLeafBlocks={LinkReference(_n,Ce){return Ce.content.charCodeAt(0)==91?new LinkReferenceParser(Ce):null},SetextHeading(){return new SetextHeadingParser}},DefaultEndLeaf=[(_n,Ce)=>isAtxHeading(Ce)>=0,(_n,Ce)=>isFencedCode(Ce)>=0,(_n,Ce)=>isBlockquote(Ce)>=0,(_n,Ce)=>isBulletList(Ce,_n,!0)>=0,(_n,Ce)=>isOrderedList(Ce,_n,!0)>=0,(_n,Ce)=>isHorizontalRule(Ce,_n,!0)>=0,(_n,Ce)=>isHTMLBlock(Ce,_n,!0)>=0],scanLineResult={text:"",end:0};class BlockContext{constructor(Ce,ke,$n,Hn){this.parser=Ce,this.input=ke,this.ranges=Hn,this.line=new Line,this.atEnd=!1,this.reusePlaceholders=new Map,this.stoppedAt=null,this.rangeI=0,this.to=Hn[Hn.length-1].to,this.lineStart=this.absoluteLineStart=this.absoluteLineEnd=Hn[0].from,this.block=CompositeBlock.create(Type.Document,0,this.lineStart,0,0),this.stack=[this.block],this.fragments=$n.length?new FragmentCursor($n,ke):null,this.readLine()}get parsedPos(){return this.absoluteLineStart}advance(){if(this.stoppedAt!=null&&this.absoluteLineStart>this.stoppedAt)return this.finish();let{line:Ce}=this;for(;;){for(let $n=0;;){let Hn=Ce.depth<this.stack.length?this.stack[this.stack.length-1]:null;for(;$n<Ce.markers.length&&(!Hn||Ce.markers[$n].from<Hn.end);){let zn=Ce.markers[$n++];this.addNode(zn.type,zn.from,zn.to)}if(!Hn)break;this.finishContext()}if(Ce.pos<Ce.text.length)break;if(!this.nextLine())return this.finish()}if(this.fragments&&this.reuseFragment(Ce.basePos))return null;e:for(;;){for(let $n of this.parser.blockParsers)if($n){let Hn=$n(this,Ce);if(Hn!=!1){if(Hn==!0)return null;Ce.forward();continue e}}break}let ke=new LeafBlock(this.lineStart+Ce.pos,Ce.text.slice(Ce.pos));for(let $n of this.parser.leafBlockParsers)if($n){let Hn=$n(this,ke);Hn&&ke.parsers.push(Hn)}e:for(;this.nextLine()&&Ce.pos!=Ce.text.length;){if(Ce.indent<Ce.baseIndent+4){for(let $n of this.parser.endLeafBlock)if($n(this,Ce,ke))break e}for(let $n of ke.parsers)if($n.nextLine(this,Ce,ke))return null;ke.content+=`
|
||||
`+Ce.scrub();for(let $n of Ce.markers)ke.marks.push($n)}return this.finishLeaf(ke),null}stopAt(Ce){if(this.stoppedAt!=null&&this.stoppedAt<Ce)throw new RangeError("Can't move stoppedAt forward");this.stoppedAt=Ce}reuseFragment(Ce){if(!this.fragments.moveTo(this.absoluteLineStart+Ce,this.absoluteLineStart)||!this.fragments.matches(this.block.hash))return!1;let ke=this.fragments.takeNodes(this);return ke?(this.absoluteLineStart+=ke,this.lineStart=toRelative(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(Ce=this.depth-1){return this.parser.nodeSet.types[this.stack[Ce].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)}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(Ce){let ke=scanLineResult;if(ke.end=Ce,Ce>=this.to)ke.text="";else if(ke.text=this.lineChunkAt(Ce),ke.end+=ke.text.length,this.ranges.length>1){let $n=this.absoluteLineStart,Hn=this.rangeI;for(;this.ranges[Hn].to<ke.end;){Hn++;let zn=this.ranges[Hn].from,Un=this.lineChunkAt(zn);ke.end=zn+Un.length,ke.text=ke.text.slice(0,this.ranges[Hn-1].to-$n)+Un,$n=ke.end-ke.text.length}}return ke}readLine(){let{line:Ce}=this,{text:ke,end:$n}=this.scanLine(this.absoluteLineStart);for(this.absoluteLineEnd=$n,Ce.reset(ke);Ce.depth<this.stack.length;Ce.depth++){let Hn=this.stack[Ce.depth],zn=this.parser.skipContextMarkup[Hn.type];if(!zn)throw new Error("Unhandled block context "+Type[Hn.type]);if(!zn(Hn,this,Ce))break;Ce.forward()}}lineChunkAt(Ce){let ke=this.input.chunk(Ce),$n;if(this.input.lineChunks)$n=ke==`
|
||||
`?"":ke;else{let Hn=ke.indexOf(`
|
||||
`);$n=Hn<0?ke:ke.slice(0,Hn)}return Ce+$n.length>this.to?$n.slice(0,this.to-Ce):$n}prevLineEnd(){return this.atEnd?this.lineStart:this.lineStart-1}startContext(Ce,ke,$n=0){this.block=CompositeBlock.create(Ce,$n,this.lineStart+ke,this.block.hash,this.lineStart+this.line.text.length),this.stack.push(this.block)}startComposite(Ce,ke,$n=0){this.startContext(this.parser.getNodeType(Ce),ke,$n)}addNode(Ce,ke,$n){typeof Ce=="number"&&(Ce=new Tree(this.parser.nodeSet.types[Ce],none,none,($n??this.prevLineEnd())-ke)),this.block.addChild(Ce,ke-this.block.from)}addElement(Ce){this.block.addChild(Ce.toTree(this.parser.nodeSet),Ce.from-this.block.from)}addLeafElement(Ce,ke){this.addNode(this.buffer.writeElements(injectMarks(ke.children,Ce.marks),-ke.from).finish(ke.type,ke.to-ke.from),ke.from)}finishContext(){let Ce=this.stack.pop(),ke=this.stack[this.stack.length-1];ke.addChild(Ce.toTree(this.parser.nodeSet),Ce.from-ke.from),this.block=ke}finish(){for(;this.stack.length>1;)this.finishContext();return this.addGaps(this.block.toTree(this.parser.nodeSet,this.lineStart))}addGaps(Ce){return this.ranges.length>1?injectGaps(this.ranges,0,Ce.topNode,this.ranges[0].from,this.reusePlaceholders):Ce}finishLeaf(Ce){for(let $n of Ce.parsers)if($n.finish(this,Ce))return;let ke=injectMarks(this.parser.parseInline(Ce.content,Ce.start),Ce.marks);this.addNode(this.buffer.writeElements(ke,-Ce.start).finish(Type.Paragraph,Ce.content.length),Ce.start)}elt(Ce,ke,$n,Hn){return typeof Ce=="string"?elt(this.parser.getNodeType(Ce),ke,$n,Hn):new TreeElement(Ce,ke)}get buffer(){return new Buffer$1(this.parser.nodeSet)}}function injectGaps(_n,Ce,ke,$n,Hn){let zn=_n[Ce].to,Un=[],qn=[],Xn=ke.from+$n;function Kn(to,io){for(;io?to>=zn:to>zn;){let uo=_n[Ce+1].from-zn;$n+=uo,to+=uo,Ce++,zn=_n[Ce].to}}for(let to=ke.firstChild;to;to=to.nextSibling){Kn(to.from+$n,!0);let io=to.from+$n,uo,ho=Hn.get(to.tree);ho?uo=ho:to.to+$n>zn?(uo=injectGaps(_n,Ce,to,$n,Hn),Kn(to.to+$n,!1)):uo=to.toTree(),Un.push(uo),qn.push(io-Xn)}return Kn(ke.to+$n,!1),new Tree(ke.type,Un,qn,ke.to+$n-Xn,ke.tree?ke.tree.propValues:void 0)}class MarkdownParser extends Parser{constructor(Ce,ke,$n,Hn,zn,Un,qn,Xn,Kn){super(),this.nodeSet=Ce,this.blockParsers=ke,this.leafBlockParsers=$n,this.blockNames=Hn,this.endLeafBlock=zn,this.skipContextMarkup=Un,this.inlineParsers=qn,this.inlineNames=Xn,this.wrappers=Kn,this.nodeTypes=Object.create(null);for(let to of Ce.types)this.nodeTypes[to.name]=to.id}createParse(Ce,ke,$n){let Hn=new BlockContext(this,Ce,ke,$n);for(let zn of this.wrappers)Hn=zn(Hn,Ce,ke,$n);return Hn}configure(Ce){let ke=resolveConfig(Ce);if(!ke)return this;let{nodeSet:$n,skipContextMarkup:Hn}=this,zn=this.blockParsers.slice(),Un=this.leafBlockParsers.slice(),qn=this.blockNames.slice(),Xn=this.inlineParsers.slice(),Kn=this.inlineNames.slice(),to=this.endLeafBlock.slice(),io=this.wrappers;if(nonEmpty(ke.defineNodes)){Hn=Object.assign({},Hn);let uo=$n.types.slice(),ho;for(let bo of ke.defineNodes){let{name:Oo,block:So,composite:$o,style:Do}=typeof bo=="string"?{name:bo}:bo;if(uo.some(Vo=>Vo.name==Oo))continue;$o&&(Hn[uo.length]=(Vo,Jo,Mo)=>$o(Jo,Mo,Vo.value));let xo=uo.length,Io=$o?["Block","BlockContext"]:So?xo>=Type.ATXHeading1&&xo<=Type.SetextHeading2?["Block","LeafBlock","Heading"]:["Block","LeafBlock"]:void 0;uo.push(NodeType.define({id:xo,name:Oo,props:Io&&[[NodeProp.group,Io]]})),Do&&(ho||(ho={}),Array.isArray(Do)||Do instanceof Tag?ho[Oo]=Do:Object.assign(ho,Do))}$n=new NodeSet(uo),ho&&($n=$n.extend(styleTags(ho)))}if(nonEmpty(ke.props)&&($n=$n.extend(...ke.props)),nonEmpty(ke.remove))for(let uo of ke.remove){let ho=this.blockNames.indexOf(uo),bo=this.inlineNames.indexOf(uo);ho>-1&&(zn[ho]=Un[ho]=void 0),bo>-1&&(Xn[bo]=void 0)}if(nonEmpty(ke.parseBlock))for(let uo of ke.parseBlock){let ho=qn.indexOf(uo.name);if(ho>-1)zn[ho]=uo.parse,Un[ho]=uo.leaf;else{let bo=uo.before?findName(qn,uo.before):uo.after?findName(qn,uo.after)+1:qn.length-1;zn.splice(bo,0,uo.parse),Un.splice(bo,0,uo.leaf),qn.splice(bo,0,uo.name)}uo.endLeaf&&to.push(uo.endLeaf)}if(nonEmpty(ke.parseInline))for(let uo of ke.parseInline){let ho=Kn.indexOf(uo.name);if(ho>-1)Xn[ho]=uo.parse;else{let bo=uo.before?findName(Kn,uo.before):uo.after?findName(Kn,uo.after)+1:Kn.length-1;Xn.splice(bo,0,uo.parse),Kn.splice(bo,0,uo.name)}}return ke.wrap&&(io=io.concat(ke.wrap)),new MarkdownParser($n,zn,Un,qn,to,Hn,Xn,Kn,io)}getNodeType(Ce){let ke=this.nodeTypes[Ce];if(ke==null)throw new RangeError(`Unknown node type '${Ce}'`);return ke}parseInline(Ce,ke){let $n=new InlineContext(this,Ce,ke);e:for(let Hn=ke;Hn<$n.end;){let zn=$n.char(Hn);for(let Un of this.inlineParsers)if(Un){let qn=Un($n,zn,Hn);if(qn>=0){Hn=qn;continue e}}Hn++}return $n.resolveMarkers(0)}}function nonEmpty(_n){return _n!=null&&_n.length>0}function resolveConfig(_n){if(!Array.isArray(_n))return _n;if(_n.length==0)return null;let Ce=resolveConfig(_n[0]);if(_n.length==1)return Ce;let ke=resolveConfig(_n.slice(1));if(!ke||!Ce)return Ce||ke;let $n=(Un,qn)=>(Un||none).co
Line truncated
|
||||
`;)zn--;this.fragmentEnd=zn?zn-1:0}let $n=this.cursor;$n||($n=this.cursor=this.fragment.tree.cursor(),$n.firstChild());let Hn=Ce+this.fragment.offset;for(;$n.to<=Hn;)if(!$n.parent())return!1;for(;;){if($n.from>=Hn)return this.fragment.from<=ke;if(!$n.childAfter(Hn))return!1}}matches(Ce){let ke=this.cursor.tree;return ke&&ke.prop(NodeProp.contextHash)==Ce}takeNodes(Ce){let ke=this.cursor,$n=this.fragment.offset,Hn=this.fragmentEnd-(this.fragment.openEnd?1:0),zn=Ce.absoluteLineStart,Un=zn,qn=Ce.block.children.length,Xn=Un,Kn=qn;for(;;){if(ke.to-$n>Hn){if(ke.type.isAnonymous&&ke.firstChild())continue;break}let to=toRelative(ke.from-$n,Ce.ranges);if(ke.to-$n<=Ce.ranges[Ce.rangeI].to)Ce.addNode(ke.tree,to);else{let io=new Tree(Ce.parser.nodeSet.types[Type.Paragraph],[],[],0,Ce.block.hashProp);Ce.reusePlaceholders.set(io,ke.tree),Ce.addNode(io,to)}if(ke.type.is("Block")&&(NotLast.indexOf(ke.type.id)<0?(Un=ke.to-$n,qn=Ce.block.children.length):(Un=Xn,qn=Kn,Xn=ke.to-$n,Kn=Ce.block.children.length)),!ke.nextSibling())break}for(;Ce.block.children.length>qn;)Ce.block.children.pop(),Ce.block.positions.pop();return Un-zn}}function toRelative(_n,Ce){let ke=_n;for(let $n=1;$n<Ce.length;$n++){let Hn=Ce[$n-1].to,zn=Ce[$n].from;Hn<_n&&(ke-=zn-Hn)}return ke}const markdownHighlighting=styleTags({"Blockquote/...":tags$1.quote,HorizontalRule:tags$1.contentSeparator,"ATXHeading1/... SetextHeading1/...":tags$1.heading1,"ATXHeading2/... SetextHeading2/...":tags$1.heading2,"ATXHeading3/...":tags$1.heading3,"ATXHeading4/...":tags$1.heading4,"ATXHeading5/...":tags$1.heading5,"ATXHeading6/...":tags$1.heading6,"Comment CommentBlock":tags$1.comment,Escape:tags$1.escape,Entity:tags$1.character,"Emphasis/...":tags$1.emphasis,"StrongEmphasis/...":tags$1.strong,"Link/... Image/...":tags$1.link,"OrderedList/... BulletList/...":tags$1.list,"BlockQuote/...":tags$1.quote,"InlineCode CodeText":tags$1.monospace,"URL Autolink":tags$1.url,"HeaderMark HardBreak QuoteMark ListMark LinkMark EmphasisMark CodeMark":tags$1.processingInstruction,"CodeInfo LinkLabel":tags$1.labelName,LinkTitle:tags$1.string,Paragraph:tags$1.content}),parser$3=new MarkdownParser(new NodeSet(nodeTypes).extend(markdownHighlighting),Object.keys(DefaultBlockParsers).map(_n=>DefaultBlockParsers[_n]),Object.keys(DefaultBlockParsers).map(_n=>DefaultLeafBlocks[_n]),Object.keys(DefaultBlockParsers),DefaultEndLeaf,DefaultSkipMarkup,Object.keys(DefaultInline).map(_n=>DefaultInline[_n]),Object.keys(DefaultInline),[]);function leftOverSpace(_n,Ce,ke){let $n=[];for(let Hn=_n.firstChild,zn=Ce;;Hn=Hn.nextSibling){let Un=Hn?Hn.from:ke;if(Un>zn&&$n.push({from:zn,to:Un}),!Hn)break;zn=Hn.to}return $n}function parseCode(_n){let{codeParser:Ce,htmlParser:ke}=_n;return{wrap:parseMixed((Hn,zn)=>{let Un=Hn.type.id;if(Ce&&(Un==Type.CodeBlock||Un==Type.FencedCode)){let qn="";if(Un==Type.FencedCode){let Kn=Hn.node.getChild(Type.CodeInfo);Kn&&(qn=zn.read(Kn.from,Kn.to))}let Xn=Ce(qn);if(Xn)return{parser:Xn,overlay:Kn=>Kn.type.id==Type.CodeText}}else if(ke&&(Un==Type.HTMLBlock||Un==Type.HTMLTag))return{parser:ke,overlay:leftOverSpace(Hn.node,Hn.from,Hn.to)};return null})}}const StrikethroughDelim={resolve:"Strikethrough",mark:"StrikethroughMark"},Strikethrough={defineNodes:[{name:"Strikethrough",style:{"Strikethrough/...":tags$1.strikethrough}},{name:"StrikethroughMark",style:tags$1.processingInstruction}],parseInline:[{name:"Strikethrough",parse(_n,Ce,ke){if(Ce!=126||_n.char(ke+1)!=126||_n.char(ke+2)==126)return-1;let $n=_n.slice(ke-1,ke),Hn=_n.slice(ke+2,ke+3),zn=/\s|^$/.test($n),Un=/\s|^$/.test(Hn),qn=Punctuation.test($n),Xn=Punctuation.test(Hn);return _n.addDelimiter(StrikethroughDelim,ke,ke+2,!Un&&(!Xn||zn||qn),!zn&&(!qn||Un||Xn))},after:"Emphasis"}]};function parseRow(_n,Ce,ke=0,$n,Hn=0){let zn=0,Un=!0,qn=-1,Xn=-1,Kn=!1,to=()=>{$n.push(_n.elt("TableCell",Hn+qn,Hn+Xn,_n.parser.parseInline(Ce.slice(qn,Xn),Hn+qn)))};for(let io=ke;io<Ce.length;io++){let uo=Ce.charCodeAt(io);uo==124&&!Kn?((!Un||qn>-1)&&zn++,Un=!1,$n&&(qn>-1&&to(),$n.push(_n.elt("TableDelimiter",io+Hn,io+Hn+1))),qn=Xn=-1):(Kn||uo!=32&&uo!=9)&&(qn<0&&(qn=io),Xn=io+1),Kn=!Kn&&uo==92}return qn>-1&&(zn++,$n&&to()),zn}function hasPipe(_n,Ce){for(let ke=Ce;ke<_n.length;ke++){let $n=_n.charCodeAt(ke);if($n==124)return!0;$n==92&&ke++}return!1}const delimiterLine=/^\|?(\s*:?-+:?\s*\|)+(\s*:?-+:?\s*)?$/;class TableParser{constructor(){this.rows=null}nextLine(Ce,ke,$n){if(this.rows==null){this.rows=!1;let Hn;if((ke.next==45||ke.next==58||ke.next==124)&&delimiterLine.test(Hn=ke.text.slice(ke.pos))){let zn=[];parseRow(Ce,$n.content,0,zn,$n.start)==parseRow(Ce,Hn,ke.pos)&&(this.rows=[Ce.elt("TableHeader",$n.start,$n.start+$n.content.length,zn),Ce.elt("TableDelimiter",Ce.lineStart+ke.pos,Ce.lineStart+ke.text.length)])}}else if(this.rows){let Hn=[];parseRow(Ce,ke.text,ke.pos,Hn,Ce.lineStart),this.rows.push(Ce.elt("TableRow",Ce.lineStart+ke.pos,Ce.lineStart+ke.text.length,Hn))}return!1}finish(Ce,ke){return this.rows?(Ce.addLeafElement(ke,Ce.elt("Table",k
Line truncated
|
||||
\${}
|
||||
} catch (\${error}) {
|
||||
\${}
|
||||
}`,{label:"try",detail:"/ catch block",type:"keyword"}),snippetCompletion("if (${}) {\n ${}\n}",{label:"if",detail:"block",type:"keyword"}),snippetCompletion(`if (\${}) {
|
||||
\${}
|
||||
} else {
|
||||
\${}
|
||||
}`,{label:"if",detail:"/ else block",type:"keyword"}),snippetCompletion(`class \${name} {
|
||||
constructor(\${params}) {
|
||||
\${}
|
||||
}
|
||||
}`,{label:"class",detail:"definition",type:"keyword"}),snippetCompletion('import {${names}} from "${module}"\n${}',{label:"import",detail:"named",type:"keyword"}),snippetCompletion('import ${name} from "${module}"\n${}',{label:"import",detail:"default",type:"keyword"})],typescriptSnippets=snippets.concat([snippetCompletion("interface ${name} {\n ${}\n}",{label:"interface",detail:"definition",type:"keyword"}),snippetCompletion("type ${name} = ${type}",{label:"type",detail:"definition",type:"keyword"}),snippetCompletion("enum ${name} {\n ${}\n}",{label:"enum",detail:"definition",type:"keyword"})]),cache=new NodeWeakMap,ScopeNodes=new Set(["Script","Block","FunctionExpression","FunctionDeclaration","ArrowFunction","MethodDeclaration","ForStatement"]);function defID(_n){return(Ce,ke)=>{let $n=Ce.node.getChild("VariableDefinition");return $n&&ke($n,_n),!0}}const functionContext=["FunctionDeclaration"],gatherCompletions={FunctionDeclaration:defID("function"),ClassDeclaration:defID("class"),ClassExpression:()=>!0,EnumDeclaration:defID("constant"),TypeAliasDeclaration:defID("type"),NamespaceDeclaration:defID("namespace"),VariableDefinition(_n,Ce){_n.matchContext(functionContext)||Ce(_n,"variable")},TypeDefinition(_n,Ce){Ce(_n,"type")},__proto__:null};function getScope(_n,Ce){let ke=cache.get(Ce);if(ke)return ke;let $n=[],Hn=!0;function zn(Un,qn){let Xn=_n.sliceString(Un.from,Un.to);$n.push({label:Xn,type:qn})}return Ce.cursor(IterMode.IncludeAnonymous).iterate(Un=>{if(Hn)Hn=!1;else if(Un.name){let qn=gatherCompletions[Un.name];if(qn&&qn(Un,zn)||ScopeNodes.has(Un.name))return!1}else if(Un.to-Un.from>8192){for(let qn of getScope(_n,Un.node))$n.push(qn);return!1}}),cache.set(Ce,$n),$n}const Identifier=/^[\w$\xa1-\uffff][\w$\d\xa1-\uffff]*$/,dontComplete=["TemplateString","String","RegExp","LineComment","BlockComment","VariableDefinition","TypeDefinition","Label","PropertyDefinition","PropertyName","PrivatePropertyDefinition","PrivatePropertyName",".","?."];function localCompletionSource(_n){let Ce=syntaxTree(_n.state).resolveInner(_n.pos,-1);if(dontComplete.indexOf(Ce.name)>-1)return null;let ke=Ce.name=="VariableName"||Ce.to-Ce.from<20&&Identifier.test(_n.state.sliceDoc(Ce.from,Ce.to));if(!ke&&!_n.explicit)return null;let $n=[];for(let Hn=Ce;Hn;Hn=Hn.parent)ScopeNodes.has(Hn.name)&&($n=$n.concat(getScope(_n.state.doc,Hn)));return{options:$n,from:ke?Ce.from:_n.pos,validFor:Identifier}}const javascriptLanguage=LRLanguage.define({name:"javascript",parser:parser.configure({props:[indentNodeProp.add({IfStatement:continuedIndent({except:/^\s*({|else\b)/}),TryStatement:continuedIndent({except:/^\s*({|catch\b|finally\b)/}),LabeledStatement:flatIndent,SwitchBody:_n=>{let Ce=_n.textAfter,ke=/^\s*\}/.test(Ce),$n=/^\s*(case|default)\b/.test(Ce);return _n.baseIndent+(ke?0:$n?1:2)*_n.unit},Block:delimitedIndent({closing:"}"}),ArrowFunction:_n=>_n.baseIndent+_n.unit,"TemplateString BlockComment":()=>null,"Statement Property":continuedIndent({except:/^{/}),JSXElement(_n){let Ce=/^\s*<\//.test(_n.textAfter);return _n.lineIndent(_n.node.from)+(Ce?0:_n.unit)},JSXEscape(_n){let Ce=/\s*\}/.test(_n.textAfter);return _n.lineIndent(_n.node.from)+(Ce?0:_n.unit)},"JSXOpenTag JSXSelfClosingTag"(_n){return _n.column(_n.node.from)+_n.unit}}),foldNodeProp.add({"Block ClassBody SwitchBody EnumBody ObjectExpression ArrayExpression ObjectType":foldInside,BlockComment(_n){return{from:_n.from+2,to:_n.to-2}}})]}),languageData:{closeBrackets:{brackets:["(","[","{","'",'"',"`"]},commentTokens:{line:"//",block:{open:"/*",close:"*/"}},indentOnInput:/^\s*(?:case |default:|\{|\}|<\/)$/,wordChars:"$"}}),jsxSublanguage={test:_n=>/^JSX/.test(_n.name),facet:defineLanguageFacet({commentTokens:{block:{open:"{/*",close:"*/}"}}})},typescriptLanguage=javascriptLanguage.configure({dialect:"ts"},"typescript"),jsxLanguage=javascriptLanguage.configure({dialect:"jsx",props:[sublanguageProp.add(_n=>_n.isTop?[jsxSublanguage]:void 0)]}),tsxLanguage=javascriptLanguage.configure({dialect:"jsx ts",props:[sublanguageProp.add(_n=>_n.isTop?[jsxSublanguage]:void 0)]},"typescript");let kwCompletion=_n=>({label:_n,type:"keyword"});const keywords="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(kwCompletion),typescriptKeywords=keywords.concat(["declare","implements","private","protected","public"].map(kwCompletion));function javascript(_n={}){let Ce=_n.jsx?_n.typescript?tsxLanguage:jsxLanguage:_n.typescript?typescriptLanguage:javascriptLanguage,ke=_n.typescript?typescriptSnippets.concat(typescriptKeywords):snippets.concat(keywords);return new LanguageSupport(Ce,[javascriptLanguage.data.of({autocomplete:ifNotIn(dontComplete,completeFromList(ke))}),javascriptLanguage.data.of({autocomplete:localCompletionSource}),_n.jsx?autoCloseTags$1:[]])}function findOpenTag(_n){for(;;){if(_n.name=="JSXOpenTag"||_n.name=="JSXSelfClosingTag"||_n.name=="JSXFragmentTag")return _n;if(_n
Line truncated
|
||||
`,attr(Ce,"class","start-typing")},m(ke,$n){insert$1(ke,Ce,$n)},p:noop,d(ke){ke&&detach(Ce)}}}function create_each_block_1$1(_n,Ce){let ke,$n=previewTitle(Ce[9].schemas,Ce[24],Ce[0])+"",Hn,zn,Un,qn;function Xn(...to){return Ce[17](Ce[24],...to)}function Kn(...to){return Ce[18](Ce[24],...to)}return{key:_n,first:null,c(){ke=element("div"),Hn=text($n),zn=space$3(),attr(ke,"class","reference-tags-option"),attr(ke,"role","button"),attr(ke,"tabindex","0"),this.first=ke},m(to,io){insert$1(to,ke,io),append(ke,Hn),append(ke,zn),Un||(qn=[listen(ke,"click",Xn),listen(ke,"keypress",Kn)],Un=!0)},p(to,io){Ce=to,io&65&&$n!==($n=previewTitle(Ce[9].schemas,Ce[24],Ce[0])+"")&&set_data(Hn,$n)},d(to){to&&detach(ke),Un=!1,run_all(qn)}}}function create_if_block_1$7(_n){let Ce,ke,$n,Hn,zn,Un;return{c(){Ce=element("div"),ke=text('Add "'),$n=text(_n[5]),Hn=text('"'),attr(Ce,"class","reference-tags-option"),attr(Ce,"role","button"),attr(Ce,"tabindex","0")},m(qn,Xn){insert$1(qn,Ce,Xn),append(Ce,ke),append(Ce,$n),append(Ce,Hn),zn||(Un=[listen(Ce,"click",_n[19]),listen(Ce,"keypress",_n[20])],zn=!0)},p(qn,Xn){Xn&32&&set_data($n,qn[5])},d(qn){qn&&detach(Ce),zn=!1,run_all(Un)}}}function create_if_block$9(_n){let Ce,ke=[],$n=new Map,Hn,zn=ensure_array_like(_n[7]);const Un=qn=>qn[3].id;for(let qn=0;qn<zn.length;qn+=1){let Xn=get_each_context$7(_n,zn,qn),Kn=Un(Xn);$n.set(Kn,ke[qn]=create_each_block$7(Kn,Xn))}return{c(){Ce=element("div");for(let qn=0;qn<ke.length;qn+=1)ke[qn].c();set_style(Ce,"display","flex"),set_style(Ce,"align-items","center"),set_style(Ce,"gap","4px")},m(qn,Xn){insert$1(qn,Ce,Xn);for(let Kn=0;Kn<ke.length;Kn+=1)ke[Kn]&&ke[Kn].m(Ce,null);Hn=!0},p(qn,Xn){Xn&1664&&(zn=ensure_array_like(qn[7]),group_outros(),ke=update_keyed_each(ke,Xn,Un,1,qn,zn,$n,Ce,outro_and_destroy_block,create_each_block$7,null,get_each_context$7),check_outros())},i(qn){if(!Hn){for(let Xn=0;Xn<zn.length;Xn+=1)transition_in(ke[Xn]);Hn=!0}},o(qn){for(let Xn=0;Xn<ke.length;Xn+=1)transition_out(ke[Xn]);Hn=!1},d(qn){qn&&detach(Ce);for(let Xn=0;Xn<ke.length;Xn+=1)ke[Xn].d()}}}function create_each_block$7(_n,Ce){let ke,$n,Hn=previewTitle(Ce[9].schemas,Ce[3])+"",zn,Un,qn,Xn,Kn,to,io,uo,ho;Kn=new Icon({props:{width:12,height:12,icon:"close"}});function bo(...Oo){return Ce[21](Ce[3],...Oo)}return{key:_n,first:null,c(){ke=element("span"),$n=element("a"),zn=text(Hn),qn=space$3(),Xn=element("button"),create_component(Kn.$$.fragment),to=space$3(),attr($n,"class","record-title"),attr($n,"href",Un=Ce[9].lucentUrl+"/records/"+Ce[3].id),attr(Xn,"type","button"),attr(Xn,"class","button-text"),attr(Xn,"aria-label","Close"),attr(ke,"class","reference-tags-selected-value"),this.first=ke},m(Oo,So){insert$1(Oo,ke,So),append(ke,$n),append($n,zn),append(ke,qn),append(ke,Xn),mount_component(Kn,Xn,null),append(ke,to),io=!0,uo||(ho=listen(Xn,"click",prevent_default(bo)),uo=!0)},p(Oo,So){Ce=Oo,(!io||So&128)&&Hn!==(Hn=previewTitle(Ce[9].schemas,Ce[3])+"")&&set_data(zn,Hn),(!io||So&128&&Un!==(Un=Ce[9].lucentUrl+"/records/"+Ce[3].id))&&attr($n,"href",Un)},i(Oo){io||(transition_in(Kn.$$.fragment,Oo),io=!0)},o(Oo){transition_out(Kn.$$.fragment,Oo),io=!1},d(Oo){Oo&&detach(ke),destroy_component(Kn),uo=!1,ho()}}}function create_fragment$d(_n){let Ce,ke,$n,Hn,zn,Un,qn,Xn,Kn,to,io,uo,ho=_n[8]&&create_if_block_3$4(_n),bo=_n[6]&&create_if_block_2$4(_n),Oo=_n[5]&&create_if_block_1$7(_n),So=_n[7].length>0&&create_if_block$9(_n);return{c(){Ce=element("div"),ho&&ho.c(),ke=space$3(),$n=element("input"),zn=space$3(),Un=element("div"),bo&&bo.c(),qn=space$3(),Oo&&Oo.c(),Xn=space$3(),So&&So.c(),Kn=empty$1(),attr($n,"type","search"),attr($n,"id",_n[2]),attr($n,"placeholder",Hn="Search for "+_n[1].label),attr($n,"autocomplete","off"),toggle_class($n,"is-invalid",_n[8]),attr(Un,"class","reference-tags-results"),attr(Ce,"class","reference-tags")},m($o,Do){insert$1($o,Ce,Do),ho&&ho.m(Ce,null),append(Ce,ke),append(Ce,$n),_n[15]($n),set_input_value($n,_n[5]),append(Ce,zn),append(Ce,Un),bo&&bo.m(Un,null),append(Un,qn),Oo&&Oo.m(Un,null),insert$1($o,Xn,Do),So&&So.m($o,Do),insert$1($o,Kn,Do),to=!0,io||(uo=[listen($n,"keyup",_n[13]),listen($n,"input",_n[16])],io=!0)},p($o,[Do]){$o[8]?ho?ho.p($o,Do):(ho=create_if_block_3$4($o),ho.c(),ho.m(Ce,ke)):ho&&(ho.d(1),ho=null),(!to||Do&4)&&attr($n,"id",$o[2]),(!to||Do&2&&Hn!==(Hn="Search for "+$o[1].label))&&attr($n,"placeholder",Hn),Do&32&&$n.value!==$o[5]&&set_input_value($n,$o[5]),(!to||Do&256)&&toggle_class($n,"is-invalid",$o[8]),$o[6]?bo?bo.p($o,Do):(bo=create_if_block_2$4($o),bo.c(),bo.m(Un,qn)):bo&&(bo.d(1),bo=null),$o[5]?Oo?Oo.p($o,Do):(Oo=create_if_block_1$7($o),Oo.c(),Oo.m(Un,null)):Oo&&(Oo.d(1),Oo=null),$o[7].length>0?So?(So.p($o,Do),Do&128&&transition_in(So,1)):(So=create_if_block$9($o),So.c(),transition_in(So,1),So.m(Kn.parentNode,Kn)):So&&(group_outros(),transition_out(So,1,1,()=>{So=null}),check_outros())},i($o){to||(transition_in(So),to=!0)},o($o){transition_out(So),to=!1},d($o){$o&&(detach(Ce),detach(Xn),detach(Kn)),ho&&ho.d(),_n[15](null),bo
Line truncated
|
||||
versions`),ha=space$3(),hs=element("div"),zo.c(),el=space$3(),ga=element("div"),Sr&&Sr.c(),attr(zn,"class","label text-end text-muted"),attr(uo,"class","label text-end text-muted"),attr(Do,"class","label text-end text-muted"),attr(ms,"class","label text-end text-muted"),attr($n,"class","col-8"),attr(xs,"class","label d-block text-muted "),attr(gs,"class","col-4"),attr(ke,"class","row"),attr(Ce,"class","lx-card "),attr(hs,"class","revisions")},m(Us,fs){insert$1(Us,Ce,fs),append(Ce,ke),append(ke,$n),append($n,Hn),append(Hn,zn),append(Hn,Un),append(Hn,qn),append(qn,Kn),append($n,to),append($n,io),append(io,uo),append(io,ho),append(io,Oo),append($n,So),append($n,$o),append($o,Do),append($o,xo),mount_component(Io,$o,null),append($o,Vo),append($o,Mo),append($n,Go),append($n,os),append(os,ms),append(os,is),mount_component(Yo,os,null),append(os,Ys),append(os,Js),append(ke,ko),append(ke,gs),append(gs,xs),append(gs,Qr),append(gs,cr),append(cr,ws),append(cr,Br),append(cr,_r),insert$1(Us,ha,fs),insert$1(Us,hs,fs),Il[Qs].m(hs,null),insert$1(Us,el,fs),insert$1(Us,ga,fs),Sr&&Sr.m(ga,null),_n[13](ga),Ca=!0},p(Us,[fs]){(!Ca||fs&1)&&Xn!==(Xn=Us[0].id+"")&&set_data(Kn,Xn),(!Ca||fs&1)&&bo!==(bo=Us[0]._sys.version+"")&&set_data(Oo,bo);const dr={};fs&3&&(dr.name=usernameById(Us[1],Us[0]._sys.createdBy)),Io.$set(dr),(!Ca||fs&1)&&Jo!==(Jo=friendlyDate(Us[0]._sys.createdAt)+"")&&set_data(Mo,Jo);const Vr={};fs&3&&(Vr.name=usernameById(Us[1],Us[0]._sys.updatedBy)),Yo.$set(Vr),(!Ca||fs&1)&&sr!==(sr=friendlyDate(Us[0]._sys.updatedAt)+"")&&set_data(Js,sr),(!Ca||fs&4)&&Fs!==(Fs=Us[2].revisions+"")&&set_data(Br,Fs);let nr=Qs;Qs=Zs(Us),Qs===nr?Il[Qs].p(Us,fs):(group_outros(),transition_out(Il[nr],1,1,()=>{Il[nr]=null}),check_outros(),zo=Il[Qs],zo?zo.p(Us,fs):(zo=Il[Qs]=za[Qs](Us),zo.c()),transition_in(zo,1),zo.m(hs,null)),Us[5]?Sr?(Sr.p(Us,fs),fs&32&&transition_in(Sr,1)):(Sr=create_if_block$6(Us),Sr.c(),transition_in(Sr,1),Sr.m(ga,null)):Sr&&(group_outros(),transition_out(Sr,1,1,()=>{Sr=null}),check_outros())},i(Us){Ca||(transition_in(Io.$$.fragment,Us),transition_in(Yo.$$.fragment,Us),transition_in(zo),transition_in(Sr),Ca=!0)},o(Us){transition_out(Io.$$.fragment,Us),transition_out(Yo.$$.fragment,Us),transition_out(zo),transition_out(Sr),Ca=!1},d(Us){Us&&(detach(Ce),detach(ha),detach(hs),detach(el),detach(ga)),destroy_component(Io),destroy_component(Yo),Il[Qs].d(),Sr&&Sr.d(),_n[13](null)}}}function instance$8(_n,Ce,ke){let $n,Hn,zn,Un;const qn=getContext$1("channel");let{record:Xn}=Ce,{graph:Kn}=Ce,{users:to}=Ce,{schema:io}=Ce,uo,ho="";axios.get(`${qn.lucentUrl}/records/${Xn.id}/revisions`).then(xo=>{ke(8,$n=xo.data)}).catch(xo=>{console.log(xo)});function bo(xo,Io){ke(7,Un=Kn.edges.filter(Vo=>Vo.depth===1).reduce((Vo,Jo)=>(Vo[Jo.field]||(Vo[Jo.field]={record:[],revision:[]}),Vo[Jo.field].record.push(Jo),Vo),{})),ke(7,Un=Io._edges.reduce((Vo,Jo)=>(Vo[Jo.field]||(Vo[Jo.field]={record:[],revision:[]}),Vo[Jo.field].revision.push(Jo),Vo),Un))}function Oo(xo,Io){xo.preventDefault(),ke(5,zn=Io),ke(6,Hn=io.fields.filter(Vo=>!lodashExports.isEqual(zn.data[Vo.name],Xn.data[Vo.name]))),bo(Hn,Io),uo.scrollIntoView()}function So(xo){xo.preventDefault(),ke(4,ho=""),axios.post(`${qn.lucentUrl}/records/${Xn.id}/rollback/${zn._sys.version}`).then(Io=>{window.location.reload()}).catch(Io=>{const Vo=Io.response.data.error;ke(4,ho=Vo.fieldLabel+": "+Vo.message)})}const $o=(xo,Io)=>Oo(Io,xo);function Do(xo){binding_callbacks[xo?"unshift":"push"](()=>{uo=xo,ke(3,uo)})}return _n.$$set=xo=>{"record"in xo&&ke(0,Xn=xo.record),"graph"in xo&&ke(11,Kn=xo.graph),"users"in xo&&ke(1,to=xo.users),"schema"in xo&&ke(2,io=xo.schema)},ke(8,$n=[]),ke(6,Hn=[]),ke(5,zn=null),ke(7,Un={}),[Xn,to,io,uo,ho,zn,Hn,Un,$n,Oo,So,Kn,$o,Do]}class Info extends SvelteComponent{constructor(Ce){super(),init(this,Ce,instance$8,create_fragment$8,safe_not_equal,{record:0,graph:11,users:1,schema:2})}}const{window:window_1}=globals;function get_each_context$3(_n,Ce,ke){const $n=_n.slice();return $n[21]=Ce[ke],$n}function create_if_block_5(_n){let Ce,ke,$n;return{c(){Ce=element("button"),Ce.innerHTML=`<span class="spinner-border spinner-border-sm" role="status" aria-hidden="true"></span>
|
||||
Save`,attr(Ce,"type","button"),attr(Ce,"class","button primary ms-2 btn btn-primary btn-spinner")},m(Hn,zn){insert$1(Hn,Ce,zn),ke||($n=listen(Ce,"click",_n[11]),ke=!0)},p:noop,d(Hn){Hn&&detach(Ce),ke=!1,$n()}}}function create_if_block_4(_n){let Ce,ke,$n;return{c(){Ce=element("button"),Ce.innerHTML=`<span class="spinner-border spinner-border-sm" role="status" aria-hidden="true"></span>
|
||||
Create`,attr(Ce,"class","button primary btn-spinner")},m(Hn,zn){insert$1(Hn,Ce,zn),ke||($n=listen(Ce,"click",_n[11]),ke=!0)},p:noop,d(Hn){Hn&&detach(Ce),ke=!1,$n()}}}function create_if_block_3(_n){let Ce,ke;return Ce=new Info({props:{record:_n[0],graph:_n[1],users:_n[4],schema:_n[2]}}),{c(){create_component(Ce.$$.fragment)},m($n,Hn){mount_component(Ce,$n,Hn),ke=!0},p($n,Hn){const zn={};Hn&1&&(zn.record=$n[0]),Hn&2&&(zn.graph=$n[1]),Hn&16&&(zn.users=$n[4]),Hn&4&&(zn.schema=$n[2]),Ce.$set(zn)},i($n){ke||(transition_in(Ce.$$.fragment,$n),ke=!0)},o($n){transition_out(Ce.$$.fragment,$n),ke=!1},d($n){destroy_component(Ce,$n)}}}function create_if_block_2(_n){let Ce,ke;return Ce=new Graph({props:{graph:_n[1],record:_n[0]}}),{c(){create_component(Ce.$$.fragment)},m($n,Hn){mount_component(Ce,$n,Hn),ke=!0},p($n,Hn){const zn={};Hn&2&&(zn.graph=$n[1]),Hn&1&&(zn.record=$n[0]),Ce.$set(zn)},i($n){ke||(transition_in(Ce.$$.fragment,$n),ke=!0)},o($n){transition_out(Ce.$$.fragment,$n),ke=!1},d($n){destroy_component(Ce,$n)}}}function create_if_block$5(_n){let Ce,ke,$n=[],Hn=new Map,zn,Un;Ce=new FilePreview({props:{record:_n[0],schema:_n[2]}});let qn=ensure_array_like(_n[9]);const Xn=Kn=>Kn[21].name;for(let Kn=0;Kn<qn.length;Kn+=1){let to=get_each_context$3(_n,qn,Kn),io=Xn(to);Hn.set(io,$n[Kn]=create_each_block$3(io,to))}return{c(){create_component(Ce.$$.fragment),ke=space$3();for(let Kn=0;Kn<$n.length;Kn+=1)$n[Kn].c();zn=empty$1()},m(Kn,to){mount_component(Ce,Kn,to),insert$1(Kn,ke,to);for(let io=0;io<$n.length;io+=1)$n[io]&&$n[io].m(Kn,to);insert$1(Kn,zn,to),Un=!0},p(Kn,to){const io={};to&1&&(io.record=Kn[0]),to&4&&(io.schema=Kn[2]),Ce.$set(io),to&623&&(qn=ensure_array_like(Kn[9]),group_outros(),$n=update_keyed_each($n,to,Xn,1,Kn,qn,Hn,zn.parentNode,outro_and_destroy_block,create_each_block$3,zn,get_each_context$3),check_outros())},i(Kn){if(!Un){transition_in(Ce.$$.fragment,Kn);for(let to=0;to<qn.length;to+=1)transition_in($n[to]);Un=!0}},o(Kn){transition_out(Ce.$$.fragment,Kn);for(let to=0;to<$n.length;to+=1)transition_out($n[to]);Un=!1},d(Kn){Kn&&(detach(ke),detach(zn)),destroy_component(Ce,Kn);for(let to=0;to<$n.length;to+=1)$n[to].d(Kn)}}}function create_if_block_1$3(_n){let Ce,ke,$n,Hn;function zn(Xn){_n[15](Xn)}function Un(Xn){_n[16](Xn)}let qn={field:_n[21],schema:_n[2],record:_n[0],validationErrors:_n[5],isCreateMode:_n[3]};return _n[0].data!==void 0&&(qn.data=_n[0].data),_n[1]!==void 0&&(qn.graph=_n[1]),Ce=new FormField({props:qn}),binding_callbacks.push(()=>bind(Ce,"data",zn)),binding_callbacks.push(()=>bind(Ce,"graph",Un)),{c(){create_component(Ce.$$.fragment)},m(Xn,Kn){mount_component(Ce,Xn,Kn),Hn=!0},p(Xn,Kn){const to={};Kn&4&&(to.schema=Xn[2]),Kn&1&&(to.record=Xn[0]),Kn&32&&(to.validationErrors=Xn[5]),Kn&8&&(to.isCreateMode=Xn[3]),!ke&&Kn&1&&(ke=!0,to.data=Xn[0].data,add_flush_callback(()=>ke=!1)),!$n&&Kn&2&&($n=!0,to.graph=Xn[1],add_flush_callback(()=>$n=!1)),Ce.$set(to)},i(Xn){Hn||(transition_in(Ce.$$.fragment,Xn),Hn=!0)},o(Xn){transition_out(Ce.$$.fragment,Xn),Hn=!1},d(Xn){destroy_component(Ce,Xn)}}}function create_each_block$3(_n,Ce){let ke,$n,Hn,zn=Ce[6]===Ce[21].group&&create_if_block_1$3(Ce);return{key:_n,first:null,c(){ke=empty$1(),zn&&zn.c(),$n=empty$1(),this.first=ke},m(Un,qn){insert$1(Un,ke,qn),zn&&zn.m(Un,qn),insert$1(Un,$n,qn),Hn=!0},p(Un,qn){Ce=Un,Ce[6]===Ce[21].group?zn?(zn.p(Ce,qn),qn&64&&transition_in(zn,1)):(zn=create_if_block_1$3(Ce),zn.c(),transition_in(zn,1),zn.m($n.parentNode,$n)):zn&&(group_outros(),transition_out(zn,1,1,()=>{zn=null}),check_outros())},i(Un){Hn||(transition_in(zn),Hn=!0)},o(Un){transition_out(zn),Hn=!1},d(Un){Un&&(detach(ke),detach($n)),zn&&zn.d(Un)}}}function create_fragment$7(_n){let Ce,ke,$n,Hn,zn,Un,qn,Xn,Kn,to,io,uo,ho,bo,Oo,So,$o,Do,xo,Io,Vo;function Jo(gs){_n[12](gs)}function Mo(gs){_n[13](gs)}let Go={schema:_n[2],isCreateMode:_n[3]};_n[0]!==void 0&&(Go.record=_n[0]),_n[6]!==void 0&&(Go.activeContentTab=_n[6]),$n=new EditHeader({props:Go}),binding_callbacks.push(()=>bind($n,"record",Jo)),binding_callbacks.push(()=>bind($n,"activeContentTab",Mo));function os(gs,xs){if(gs[3])return create_if_block_4;if(gs[8])return create_if_block_5}let ms=os(_n),is=ms&&ms(_n);Xn=new Title({props:{schema:_n[2],record:_n[0],isCreateMode:_n[3]}}),to=new ErrorAlert({props:{message:_n[7]}});function Yo(gs){_n[14](gs)}let Ys={schema:_n[2],isCreateMode:_n[3]};_n[6]!==void 0&&(Ys.active=_n[6]),ho=new ContentTabs({props:Ys}),binding_callbacks.push(()=>bind(ho,"active",Yo));const sr=[create_if_block$5,create_if_block_2,create_if_block_3],Js=[];function ko(gs,xs){return xs&64&&(So=null),So==null&&(So=!["_graph","_info"].includes(gs[6])),So?0:gs[6]==="_graph"?1:gs[6]==="_info"?2:-1}return~($o=ko(_n,-1))&&(Do=Js[$o]=sr[$o](_n)),{c(){Ce=element("div"),ke=element("div"),create_component($n.$$.fragment),Un=space$3(),is&&is.c(),qn=space$3(),create_component(Xn.$$.fragment),Kn=space$3(),create_component(to.$$.fragment),io=space$3(),uo=element("div"),create_component(ho.$$.fragment),Oo=s
Line truncated
|
||||
`),Oo=element("div"),Oo.textContent=" ",So=text(`
|
||||
`),attr($n,"class","header-small mb-5"),attr(Un,"class","button primary mb-3"),Un.disabled=_n[2],attr(Kn,"class","mb-3"),attr(uo,"class","logs svelte-a3cwpi"),attr(ke,"class","lx-card mt-5"),attr(Ce,"class","common-wrapper")},m(Vo,Jo){insert$1(Vo,Ce,Jo),append(Ce,ke),append(ke,$n),append($n,Hn),append(ke,zn),append(ke,Un),append(Un,qn),append(ke,Xn),append(ke,Kn),xo&&xo.m(Kn,null),append(Kn,to),Io&&Io.m(Kn,null),append(ke,io),append(ke,uo),append(uo,ho),append(uo,bo),append(uo,Oo),_n[6](Oo),append(uo,So),$o||(Do=listen(Un,"click",_n[4]),$o=!0)},p(Vo,[Jo]){Jo&1&&set_data(Hn,Vo[0]),Jo&4&&(Un.disabled=Vo[2]),Vo[2]?xo||(xo=create_if_block_1(),xo.c(),xo.m(Kn,to)):xo&&(xo.d(1),xo=null),!Vo[2]&&Vo[3]?Io||(Io=create_if_block$1(),Io.c(),Io.m(Kn,null)):Io&&(Io.d(1),Io=null),Jo&8&&set_data(ho,Vo[3])},i:noop,o:noop,d(Vo){Vo&&detach(Ce),xo&&xo.d(),Io&&Io.d(),_n[6](null),$o=!1,Do()}}}function instance$2(_n,Ce,ke){let $n;const Hn=getContext$1("channel");let{title:zn}=Ce,{command:Un}=Ce,qn,Xn=!1;function Kn(){const uo=new EventSource(Hn.lucentUrl+"/command-report-source/"+Un.signature);uo.onmessage=function(ho){ke(2,Xn=!0);const bo=JSON.parse(ho.data);bo.date,ke(3,$n=bo.logs),qn.scrollIntoView()},uo.onerror=ho=>{console.log(ho),uo.close(),ke(2,Xn=!1)}}function to(uo){uo.preventDefault(),ke(2,Xn=!0),axios$1.post(Hn.lucentUrl+"/command/"+Un.signature).then(ho=>{Kn()})}onMount(()=>{Kn()});function io(uo){binding_callbacks[uo?"unshift":"push"](()=>{qn=uo,ke(1,qn)})}return _n.$$set=uo=>{"title"in uo&&ke(0,zn=uo.title),"command"in uo&&ke(5,Un=uo.command)},ke(3,$n=""),[zn,qn,Xn,$n,to,Un,io]}class Report extends SvelteComponent{constructor(Ce){super(),init(this,Ce,instance$2,create_fragment$2,safe_not_equal,{title:0,command:5})}}function get_each_context(_n,Ce,ke){const $n=_n.slice();return $n[2]=Ce[ke],$n}function create_if_block(_n){let Ce,ke;return Ce=new Dropdown({props:{$$slots:{button:[create_button_slot],default:[create_default_slot]},$$scope:{ctx:_n}}}),{c(){create_component(Ce.$$.fragment)},m($n,Hn){mount_component(Ce,$n,Hn),ke=!0},p($n,Hn){const zn={};Hn&32&&(zn.$$scope={dirty:Hn,ctx:$n}),Ce.$set(zn)},i($n){ke||(transition_in(Ce.$$.fragment,$n),ke=!0)},o($n){transition_out(Ce.$$.fragment,$n),ke=!1},d($n){destroy_component(Ce,$n)}}}function create_each_block(_n){let Ce,ke=_n[2].name+"",$n;return{c(){Ce=element("a"),$n=text(ke),attr(Ce,"href",_n[0].lucentUrl+"/command-report/"+_n[2].signature),attr(Ce,"class","top-nav-item")},m(Hn,zn){insert$1(Hn,Ce,zn),append(Ce,$n)},p:noop,d(Hn){Hn&&detach(Ce)}}}function create_default_slot(_n){let Ce,ke=ensure_array_like(_n[0].commands),$n=[];for(let Hn=0;Hn<ke.length;Hn+=1)$n[Hn]=create_each_block(get_each_context(_n,ke,Hn));return{c(){for(let Hn=0;Hn<$n.length;Hn+=1)$n[Hn].c();Ce=empty$1()},m(Hn,zn){for(let Un=0;Un<$n.length;Un+=1)$n[Un]&&$n[Un].m(Hn,zn);insert$1(Hn,Ce,zn)},p(Hn,zn){if(zn&1){ke=ensure_array_like(Hn[0].commands);let Un;for(Un=0;Un<ke.length;Un+=1){const qn=get_each_context(Hn,ke,Un);$n[Un]?$n[Un].p(qn,zn):($n[Un]=create_each_block(qn),$n[Un].c(),$n[Un].m(Ce.parentNode,Ce))}for(;Un<$n.length;Un+=1)$n[Un].d(1);$n.length=ke.length}},d(Hn){Hn&&detach(Ce),destroy_each($n,Hn)}}}function create_button_slot(_n){let Ce;return{c(){Ce=element("div"),Ce.textContent="Actions",attr(Ce,"slot","button")},m(ke,$n){insert$1(ke,Ce,$n)},p:noop,d(ke){ke&&detach(Ce)}}}function create_fragment$1(_n){let Ce,ke,$n,Hn,zn,Un,qn,Xn,Kn=_n[0].commands.length>0&&create_if_block(_n);return qn=new Avatar({props:{side:"28",name:_n[1].name}}),{c(){Ce=element("div"),ke=element("a"),$n=text("Members"),Hn=space$3(),Kn&&Kn.c(),zn=space$3(),Un=element("a"),create_component(qn.$$.fragment),attr(ke,"class","top-nav-item"),attr(ke,"href",_n[0].lucentUrl+"/members"),attr(Un,"href",_n[0].lucentUrl+"/profile"),attr(Ce,"class","top-nav ")},m(to,io){insert$1(to,Ce,io),append(Ce,ke),append(ke,$n),append(Ce,Hn),Kn&&Kn.m(Ce,null),append(Ce,zn),append(Ce,Un),mount_component(qn,Un,null),Xn=!0},p(to,[io]){to[0].commands.length>0&&Kn.p(to,io)},i(to){Xn||(transition_in(Kn),transition_in(qn.$$.fragment,to),Xn=!0)},o(to){transition_out(Kn),transition_out(qn.$$.fragment,to),Xn=!1},d(to){to&&detach(Ce),Kn&&Kn.d(),destroy_component(qn)}}}function instance$1(_n){const Ce=getContext$1("channel"),ke=getContext$1("user");return console.log(Ce.commands),[Ce,ke]}class Header extends SvelteComponent{constructor(Ce){super(),init(this,Ce,instance$1,create_fragment$1,safe_not_equal,{})}}function create_fragment(_n){let Ce,ke,$n,Hn,zn,Un,qn,Xn,Kn;$n=new Navbar({props:{schema:_n[2].schema}}),Un=new Header({});const to=[{title:_n[0]},_n[2]];var io=_n[3][_n[1]];function uo(ho,bo){let Oo={};for(let So=0;So<to.length;So+=1)Oo=assign(Oo,to[So]);return bo!==void 0&&bo&5&&(Oo=assign(Oo,get_spread_update(to,[bo&1&&{title:ho[0]},bo&4&&get_spread_object(ho[2])]))),{props:Oo}}return io&&(Xn=construct_svelte_component(io,uo(_n))),{c(){Ce=element("div"),ke=element("div"),create_component($n.$$.fragment),Hn=space$3(),zn=element("div"),create_com
Line truncated
|
||||
Vendored
+1
@@ -0,0 +1 @@
|
||||
@charset "UTF-8";:root{--p10: #f4f9ff;--p20: #eaf1f9;--p30: #b3ceff;--p40: #8db5ff;--p50: #70a2ff;--p60: #679cff;--p70: #4284ff;--p80: #1c6bff;--p90: #002b7a;--p100: #000C23;--suc10: #d1ffb8;--suc20: #d1ffb8;--suc30: #b5ff8d;--suc40: #a2ff70;--suc50: #82cc5a;--suc80: #71b34e;--suc90: #314c22;--err10: #ffb9d0;--err20: #ff9bb3;--err30: #fe7e97;--err40: #de617b;--err50: #be4461;--err80: #61001a;--err90: #560012;--grey-dark: #424656;--grey-light: #a6abbd;--text: var(--p100);--text-light: var(--grey-dark);--text-error: var(--err50);--main-font: ‘Open Sans‘, Arial, Helvetica, sans-serif}*,*:before,*:after{box-sizing:border-box}*{margin:0}body{line-height:1.5;-webkit-font-smoothing:antialiased}img,picture,video,canvas,svg{display:block;max-width:100%}input,button,textarea,select{font:inherit}p,h1,h2,h3,h4,h5,h6{overflow-wrap:break-word}#root,#__next{isolation:isolate}.mt-1{margin-top:4px}.mt-2{margin-top:8px}.mt-3{margin-top:12px}.mt-4{margin-top:16px}.mt-5{margin-top:20px}.mb-1{margin-bottom:4px}.mb-2{margin-bottom:8px}.mb-3{margin-bottom:12px}.mb-4{margin-bottom:16px}.mb-5{margin-bottom:20px}.pt-1{padding-top:4px}.pt-2{padding-top:8px}.pt-3{padding-top:12px}.pt-4{padding-top:16px}.pt-5{padding-top:20px}.pb-1{padding-bottom:4px}.pb-2{padding-bottom:8px}.pb-3{padding-bottom:12px}.pb-4{padding-bottom:16px}.pb-5{padding-bottom:20px}.gap-1{gap:4px}.gap-2{gap:8px}.gap-3{gap:12px}.gap-4{gap:16px}.gap-5{gap:20px}.hide{display:none!important}.hidden{visibility:hidden}.d-block{display:block}.d-inline-block{display:inline-block}.is-bold{font-weight:700}.in-place{padding:36px}.notice{background-color:var(--p20);padding:14px;margin:2rem 0;position:relative;font-size:16px;line-height:24px;border-radius:12px}.notice .title{content:"NOTE";border-radius:12px;display:block;font-weight:700}.notice.notice-success{background:var(--suc20)}.notice.notice-error{background:var(--err10)}.scope-login{display:flex;height:100vh}.scope-login .bg-image{width:50%;background:url(/vendor/lucent/public/art.jpg);background-size:cover;background-repeat:no-repeat;background-position:center center}.scope-login .login-form{width:50%;height:100vh;display:flex;align-items:center;justify-content:center}.content{font-size:16px;line-height:20px;font-family:var(--main-font);color:var(--text)}.content p{margin-bottom:14px}.content p:last-child{margin-bottom:0}.content h1{font-size:24px;line-height:34px}.content h2{font-size:20px;line-height:30px}.content h3{font-size:18px;line-height:28px}.content ul{padding:0 0 0 16px;list-style:none outside none}.content ul li:before{content:"—";opacity:.5;font-size:12px;padding-right:6px;vertical-align:10%}.content ul li{list-style:none;padding:0}.content code{background:var(--p30);padding:0 6px;border-radius:12px}.content img{margin-bottom:14px}.content blockquote{border:1px solid var(--p30);border-radius:12px;padding:12px 40px;position:relative}.content blockquote:before{content:"“";color:var(--p60);font-size:4em;position:absolute;left:10px;top:20px}.content blockquote:after{content:""}.content pre{background:var(--grey-light);border-radius:.5rem;color:var(--white);font-family:JetBrainsMono,monospace;margin:1.5rem 0;padding:.75rem 1rem}.content pre code{background:none;color:inherit;font-size:.8rem;padding:0}.lx-small-text{font-size:12px;line-height:15px}.light-text{color:var(--text-light)}.sidebar-top{border:0px solid var(--p30);font-size:18px;padding:20px;display:flex;align-items:center;justify-content:space-between;background:var(--p20);margin-bottom:15px;border-radius:12px}.sidebar{border-radius:12px;font-size:15px;line-height:28px;padding:20px;background:var(--p20);display:flex;flex-direction:column;gap:3px}.sidebar-header{display:flex;cursor:pointer;justify-content:space-between;align-items:center;background:var(--p30);font-size:16px;padding:3px 12px;color:var(--text);border:none;border-radius:12px}.sidebar-header:focus{box-shadow:none}.sidebar-header:hover{background:var(--p40)}.sidebar-header:last-child{border-bottom:none}.sidebar-item{color:var(--text);display:block;font-size:14px;padding:3px 12px;text-decoration:none;transition:.6s;border-radius:12px}.sidebar-item:last-child{border-bottom:none}.sidebar-item:hover{background:var(--p30)}.sidebar-item.active{background:var(--p40)}.top-nav{display:flex;justify-content:end;align-items:center;gap:10px}.top-nav-item{border-radius:12px;font-size:14px;background:var(--p20);padding:3px 10px}.top-nav-item:hover{background:var(--p30)}label{display:block;font-weight:700;margin-bottom:4px}input[type=text],input[type=number],input[type=search],input[type=email],textarea{width:100%;background:var(--p20);border:1px solid var(--p50);border-radius:5px;padding:5px 7px;font-size:16px}input[type=text]:focus,input[type=number]:focus,input[type=search]:focus,input[type=email]:focus,textarea:focus{background:var(--p10)}textarea{resize:none}select{width:100%;background:var(--p20);border:1px solid var(--p50);border-radius:5px;padding:5px 7px;font-size:16px}select:focus{backgrouLine truncated
|
||||
Vendored
-1
@@ -1 +0,0 @@
|
||||
@charset "UTF-8";:root{--p10: #f4f9ff;--p20: #eaf1f9;--p30: #b3ceff;--p40: #8db5ff;--p50: #70a2ff;--p60: #679cff;--p70: #4284ff;--p80: #1c6bff;--p90: #002b7a;--p100: #000C23;--suc10: #d1ffb8;--suc20: #d1ffb8;--suc30: #b5ff8d;--suc40: #a2ff70;--suc50: #82cc5a;--suc80: #71b34e;--suc90: #314c22;--err10: #ffb9d0;--err20: #ff9bb3;--err30: #fe7e97;--err40: #de617b;--err50: #be4461;--err80: #61001a;--err90: #560012;--grey-dark: #424656;--grey-light: #a6abbd;--text: var(--p100);--text-light: var(--grey-dark);--text-error: var(--err50);--main-font: ‘Open Sans‘, Arial, Helvetica, sans-serif}*,*:before,*:after{box-sizing:border-box}*{margin:0}body{line-height:1.5;-webkit-font-smoothing:antialiased}img,picture,video,canvas,svg{display:block;max-width:100%}input,button,textarea,select{font:inherit}p,h1,h2,h3,h4,h5,h6{overflow-wrap:break-word}#root,#__next{isolation:isolate}.mt-1{margin-top:4px}.mt-2{margin-top:8px}.mt-3{margin-top:12px}.mt-4{margin-top:16px}.mt-5{margin-top:20px}.mb-1{margin-bottom:4px}.mb-2{margin-bottom:8px}.mb-3{margin-bottom:12px}.mb-4{margin-bottom:16px}.mb-5{margin-bottom:20px}.pt-1{padding-top:4px}.pt-2{padding-top:8px}.pt-3{padding-top:12px}.pt-4{padding-top:16px}.pt-5{padding-top:20px}.pb-1{padding-bottom:4px}.pb-2{padding-bottom:8px}.pb-3{padding-bottom:12px}.pb-4{padding-bottom:16px}.pb-5{padding-bottom:20px}.gap-1{gap:4px}.gap-2{gap:8px}.gap-3{gap:12px}.gap-4{gap:16px}.gap-5{gap:20px}.hide{display:none!important}.hidden{visibility:hidden}.d-block{display:block}.d-inline-block{display:inline-block}.is-bold{font-weight:700}.in-place{padding:36px}.notice{background-color:var(--p20);padding:14px;margin:2rem 0;position:relative;font-size:16px;line-height:24px;border-radius:12px}.notice .title{content:"NOTE";border-radius:12px;display:block;font-weight:700}.notice.notice-success{background:var(--suc20)}.notice.notice-error{background:var(--err10)}.scope-login{display:flex;height:100vh}.scope-login .bg-image{width:50%;background:url(/vendor/lucent/public/art.jpg);background-size:cover;background-repeat:no-repeat;background-position:center center}.scope-login .login-form{width:50%;height:100vh;display:flex;align-items:center;justify-content:center}.content{font-size:16px;line-height:20px;font-family:var(--main-font);color:var(--text)}.content p{margin-bottom:14px}.content p:last-child{margin-bottom:0}.content h1{font-size:24px;line-height:34px}.content h2{font-size:20px;line-height:30px}.content h3{font-size:18px;line-height:28px}.content ul{padding:0 0 0 16px;list-style:none outside none}.content ul li:before{content:"—";opacity:.5;font-size:12px;padding-right:6px;vertical-align:10%}.content ul li{list-style:none;padding:0}.content code{background:var(--p30);padding:0 6px;border-radius:12px}.content img{margin-bottom:14px}.content blockquote{border:1px solid var(--p30);border-radius:12px;padding:12px 40px;position:relative}.content blockquote:before{content:"“";color:var(--p60);font-size:4em;position:absolute;left:10px;top:20px}.content blockquote:after{content:""}.content pre{background:var(--grey-light);border-radius:.5rem;color:var(--white);font-family:JetBrainsMono,monospace;margin:1.5rem 0;padding:.75rem 1rem}.content pre code{background:none;color:inherit;font-size:.8rem;padding:0}.lx-small-text{font-size:12px;line-height:15px}.light-text{color:var(--text-light)}.sidebar-top{border:0px solid var(--p30);font-size:18px;padding:20px;display:flex;align-items:center;justify-content:space-between;background:var(--p20);margin-bottom:15px;border-radius:12px}.sidebar{border-radius:12px;font-size:15px;line-height:28px;padding:20px;background:var(--p20);display:flex;flex-direction:column;gap:3px}.sidebar-header{display:flex;cursor:pointer;justify-content:space-between;align-items:center;background:var(--p30);font-size:16px;padding:3px 12px;color:var(--text);border:none;border-radius:12px}.sidebar-header:focus{box-shadow:none}.sidebar-header:hover{background:var(--p40)}.sidebar-header:last-child{border-bottom:none}.sidebar-item{color:var(--text);display:block;font-size:14px;padding:3px 12px;text-decoration:none;transition:.6s;border-radius:12px}.sidebar-item:last-child{border-bottom:none}.sidebar-item:hover{background:var(--p30)}.sidebar-item.active{background:var(--p40)}.top-nav{display:flex;justify-content:end;align-items:center;gap:10px}.top-nav-item{border-radius:12px;font-size:14px;background:var(--p20);padding:3px 10px}.top-nav-item:hover{background:var(--p30)}label{display:block;font-weight:700;margin-bottom:4px}input[type=text],input[type=number],input[type=search],input[type=email],textarea{width:100%;background:var(--p20);border:1px solid var(--p50);border-radius:5px;padding:5px 7px;font-size:16px}input[type=text]:focus,input[type=number]:focus,input[type=search]:focus,input[type=email]:focus,textarea:focus{background:var(--p10)}textarea{resize:none}select{width:100%;background:var(--p20);border:1px solid var(--p50);border-radius:5px;padding:5px 7px;font-size:16px}select:focus{backgrouLine truncated
|
||||
Vendored
+213
@@ -0,0 +1,213 @@
|
||||
var uP=Object.defineProperty;var hP=(i,e,t)=>e in i?uP(i,e,{enumerable:!0,configurable:!0,writable:!0,value:t}):i[e]=t;var Qh=(i,e,t)=>(hP(i,typeof e!="symbol"?e+"":e,t),t);function U(){}const fP=i=>i;function Ps(i,e){for(const t in e)i[t]=e[t];return i}function Yw(i){return i()}function Jp(){return Object.create(null)}function ht(i){i.forEach(Yw)}function nh(i){return typeof i=="function"}function re(i,e){return i!=i?e==e:i!==e||i&&typeof i=="object"||typeof i=="function"}let qa;function ad(i,e){return i===e?!0:(qa||(qa=document.createElement("a")),qa.href=e,i===qa.href)}function dP(i){return Object.keys(i).length===0}function Hl(i,e,t,n){if(i){const r=zw(i,e,t,n);return i[0](r)}}function zw(i,e,t,n){return i[1]&&n?Ps(t.ctx.slice(),i[1](n(e))):t.ctx}function Kl(i,e,t,n){if(i[2]&&n){const r=i[2](n(t));if(e.dirty===void 0)return r;if(typeof r=="object"){const s=[],o=Math.max(e.dirty.length,r.length);for(let l=0;l<o;l+=1)s[l]=e.dirty[l]|r[l];return s}return e.dirty|r}return e.dirty}function Jl(i,e,t,n,r,s){if(r){const o=zw(e,t,n,s);i.p(o,r)}}function ea(i){if(i.ctx.length>32){const e=[],t=i.ctx.length/32;for(let n=0;n<t;n++)e[n]=-1;return e}return-1}function mP(i){return i&&nh(i.destroy)?i.destroy:U}function eg(i){const e=typeof i=="string"&&i.match(/^\s*(-?[\d.]+)([^\s]*)\s*$/);return e?[parseFloat(e[1]),e[2]||"px"]:[i,"px"]}const Vw=typeof window<"u";let pP=Vw?()=>window.performance.now():()=>Date.now(),Xm=Vw?i=>requestAnimationFrame(i):U;const lo=new Set;function Uw(i){lo.forEach(e=>{e.c(i)||(lo.delete(e),e.f())}),lo.size!==0&&Xm(Uw)}function gP(i){let e;return lo.size===0&&Xm(Uw),{promise:new Promise(t=>{lo.add(e={c:i,f:t})}),abort(){lo.delete(e)}}}const OP=typeof window<"u"?window:typeof globalThis<"u"?globalThis:global;function b(i,e){i.appendChild(e)}function jw(i){if(!i)return document;const e=i.getRootNode?i.getRootNode():i.ownerDocument;return e&&e.host?e:i.ownerDocument}function bP(i){const e=y("style");return e.textContent="/* empty */",vP(jw(i),e),e.sheet}function vP(i,e){return b(i.head||i,e),e.sheet}function x(i,e,t){i.insertBefore(e,t||null)}function P(i){i.parentNode&&i.parentNode.removeChild(i)}function Ot(i,e){for(let t=0;t<i.length;t+=1)i[t]&&i[t].d(e)}function y(i){return document.createElement(i)}function wP(i){return document.createElementNS("http://www.w3.org/2000/svg",i)}function W(i){return document.createTextNode(i)}function D(){return W(" ")}function Ie(){return W("")}function G(i,e,t,n){return i.addEventListener(e,t,n),()=>i.removeEventListener(e,t,n)}function Ln(i){return function(e){return e.preventDefault(),i.call(this,e)}}function O(i,e,t){t==null?i.removeAttribute(e):i.getAttribute(e)!==t&&i.setAttribute(e,t)}function Jo(i,e,t){const n=e.toLowerCase();n in i?i[n]=typeof i[n]=="boolean"&&t===""?!0:t:e in i?i[e]=typeof i[e]=="boolean"&&t===""?!0:t:O(i,e,t)}function qw(i){let e;return{p(...t){e=t,e.forEach(n=>i.push(n))},r(){e.forEach(t=>i.splice(i.indexOf(t),1))}}}function Gw(i){return i===""?null:+i}function yP(i){return Array.from(i.childNodes)}function K(i,e){e=""+e,i.data!==e&&(i.data=e)}function Le(i,e){i.value=e??""}function le(i,e,t,n){t==null?i.style.removeProperty(e):i.style.setProperty(e,t,"")}function tg(i,e,t){for(let n=0;n<i.options.length;n+=1){const r=i.options[n];if(r.__value===e){r.selected=!0;return}}(!t||e!==void 0)&&(i.selectedIndex=-1)}function kP(i){const e=i.querySelector(":checked");return e&&e.__value}function Ae(i,e,t){i.classList.toggle(e,!!t)}function Hw(i,e,{bubbles:t=!1,cancelable:n=!1}={}){return new CustomEvent(i,{detail:e,bubbles:t,cancelable:n})}function Xr(i,e){return new i(e)}const su=new Map;let ou=0;function SP(i){let e=5381,t=i.length;for(;t--;)e=(e<<5)-e^i.charCodeAt(t);return e>>>0}function _P(i,e){const t={stylesheet:bP(e),rules:{}};return su.set(i,t),t}function ng(i,e,t,n,r,s,o,l=0){const a=16.666/n;let c=`{
|
||||
`;for(let g=0;g<=1;g+=a){const v=e+(t-e)*s(g);c+=g*100+`%{${o(v,1-v)}}
|
||||
`}const u=c+`100% {${o(t,1-t)}}
|
||||
}`,h=`__svelte_${SP(u)}_${l}`,f=jw(i),{stylesheet:d,rules:m}=su.get(f)||_P(f,i);m[h]||(m[h]=!0,d.insertRule(`@keyframes ${h} ${u}`,d.cssRules.length));const p=i.style.animation||"";return i.style.animation=`${p?`${p}, `:""}${h} ${n}ms linear ${r}ms 1 both`,ou+=1,h}function CP(i,e){const t=(i.style.animation||"").split(", "),n=t.filter(e?s=>s.indexOf(e)<0:s=>s.indexOf("__svelte")===-1),r=t.length-n.length;r&&(i.style.animation=n.join(", "),ou-=r,ou||PP())}function PP(){Xm(()=>{ou||(su.forEach(i=>{const{ownerNode:e}=i.stylesheet;e&&P(e)}),su.clear())})}let ta;function Tl(i){ta=i}function Bo(){if(!ta)throw new Error("Function called outside component initialization");return ta}function xi(i){Bo().$$.on_mount.push(i)}function Kw(i){Bo().$$.after_update.push(i)}function Jw(i){Bo().$$.on_destroy.push(i)}function nn(){const i=Bo();return(e,t,{cancelable:n=!1}={})=>{const r=i.$$.callbacks[e];if(r){const s=Hw(e,t,{cancelable:n});return r.slice().forEach(o=>{o.call(i,s)}),!s.defaultPrevented}return!0}}function Ql(i,e){return Bo().$$.context.set(i,e),e}function Ue(i){return Bo().$$.context.get(i)}function vs(i,e){const t=i.$$.callbacks[e.type];t&&t.slice().forEach(n=>n.call(this,e))}const Hs=[],Ce=[];let ao=[];const cd=[],AP=Promise.resolve();let ud=!1;function xP(){ud||(ud=!0,AP.then(ey))}function As(i){ao.push(i)}function st(i){cd.push(i)}const Mh=new Set;let Vs=0;function ey(){if(Vs!==0)return;const i=ta;do{try{for(;Vs<Hs.length;){const e=Hs[Vs];Vs++,Tl(e),TP(e.$$)}}catch(e){throw Hs.length=0,Vs=0,e}for(Tl(null),Hs.length=0,Vs=0;Ce.length;)Ce.pop()();for(let e=0;e<ao.length;e+=1){const t=ao[e];Mh.has(t)||(Mh.add(t),t())}ao.length=0}while(Hs.length);for(;cd.length;)cd.pop()();ud=!1,Mh.clear(),Tl(i)}function TP(i){if(i.fragment!==null){i.update(),ht(i.before_update);const e=i.dirty;i.dirty=[-1],i.fragment&&i.fragment.p(i.ctx,e),i.after_update.forEach(As)}}function QP(i){const e=[],t=[];ao.forEach(n=>i.indexOf(n)===-1?e.push(n):t.push(n)),t.forEach(n=>n()),ao=e}let el;function MP(){return el||(el=Promise.resolve(),el.then(()=>{el=null})),el}function Eh(i,e,t){i.dispatchEvent(Hw(`${e?"intro":"outro"}${t}`))}const Lc=new Set;let sr;function Oe(){sr={r:0,c:[],p:sr}}function be(){sr.r||ht(sr.c),sr=sr.p}function T(i,e){i&&i.i&&(Lc.delete(i),i.i(e))}function R(i,e,t,n){if(i&&i.o){if(Lc.has(i))return;Lc.add(i),sr.c.push(()=>{Lc.delete(i),n&&(t&&i.d(1),n())}),i.o(e)}else n&&n()}const EP={duration:0};function lu(i,e,t,n){let s=e(i,t,{direction:"both"}),o=n?0:1,l=null,a=null,c=null,u;function h(){c&&CP(i,c)}function f(m,p){const g=m.b-o;return p*=Math.abs(g),{a:o,b:m.b,d:g,duration:p,start:m.start,end:m.start+p,group:m.group}}function d(m){const{delay:p=0,duration:g=300,easing:v=fP,tick:w=U,css:S}=s||EP,_={start:pP()+p,b:m};m||(_.group=sr,sr.r+=1),"inert"in i&&(m?u!==void 0&&(i.inert=u):(u=i.inert,i.inert=!0)),l||a?a=_:(S&&(h(),c=ng(i,o,m,g,p,v,S)),m&&w(0,1),l=f(_,g),As(()=>Eh(i,m,"start")),gP(k=>{if(a&&k>a.start&&(l=f(a,g),a=null,Eh(i,l.b,"start"),S&&(h(),c=ng(i,o,l.b,l.duration,0,v,s.css))),l){if(k>=l.end)w(o=l.b,1-o),Eh(i,l.b,"end"),a||(l.b?h():--l.group.r||ht(l.group.c)),l=null;else if(k>=l.start){const A=k-l.start;o=l.a+l.d*v(A/l.duration),w(o,1-o)}}return!!(l||a)}))}return{run(m){nh(s)?MP().then(()=>{s=s({direction:m?"in":"out"}),d(m)}):d(m)},end(){h(),l=a=null}}}function fe(i){return(i==null?void 0:i.length)!==void 0?i:Array.from(i)}function Fm(i,e){i.d(1),e.delete(i.key)}function Jr(i,e){R(i,1,1,()=>{e.delete(i.key)})}function Ti(i,e,t,n,r,s,o,l,a,c,u,h){let f=i.length,d=s.length,m=f;const p={};for(;m--;)p[i[m].key]=m;const g=[],v=new Map,w=new Map,S=[];for(m=d;m--;){const C=h(r,s,m),Q=t(C);let M=o.get(Q);M?S.push(()=>M.p(C,e)):(M=c(Q,C),M.c()),v.set(Q,g[m]=M),Q in p&&w.set(Q,Math.abs(m-p[Q]))}const _=new Set,k=new Set;function A(C){T(C,1),C.m(l,u),o.set(C.key,C),u=C.first,d--}for(;f&&d;){const C=g[d-1],Q=i[f-1],M=C.key,L=Q.key;C===Q?(u=C.first,f--,d--):v.has(L)?!o.has(M)||_.has(M)?A(C):k.has(L)?f--:w.get(M)>w.get(L)?(k.add(M),A(C)):(_.add(L),f--):(a(Q,o),f--)}for(;f--;){const C=i[f];v.has(C.key)||a(C,o)}for(;d;)A(g[d-1]);return ht(S),g}function _o(i,e){const t={},n={},r={$$scope:1};let s=i.length;for(;s--;){const o=i[s],l=e[s];if(l){for(const a in o)a in l||(n[a]=1);for(const a in l)r[a]||(t[a]=l[a],r[a]=1);i[s]=l}else for(const a in o)r[a]=1}for(const o in n)o in t||(t[o]=void 0);return t}function Co(i){return typeof i=="object"&&i!==null?i:{}}function nt(i,e,t){const n=i.$$.props[e];n!==void 0&&(i.$$.bound[n]=t,t(i.$$.ctx[n]))}function V(i){i&&i.c()}function Y(i,e,t){const{fragment:n,after_update:r}=i.$$;n&&n.m(e,t),As(()=>{const s=i.$$.on_mount.map(Yw).filter(nh);i.$$.on_destroy?i.$$.on_destroy.push(...s):ht(s),i.$$.on_mount=[]}),r.forEach(As)}function z(i,e){const t=i.$$;t.fragment!==null&&(QP(t.after_update),ht(t.on_destroy),t.fragment&&t.fragment.d(e),t.on_destroy=t.fragment=null,t.ctx=[])}function RP(i,e){i.$$.dirty[0]===-1&&(Hs.push(i),xP(),i.$$.dirty.fill(0)),i.$$.dirty[e/31|0]|=1<<e%31}function se(i,e,t,n,r,
Line truncated
|
||||
<img alt="indicator" id="indicator" class="htmx-indicator" src="/img/spinner.svg"/>`,O(t,"class","mb-5"),O(u,"for","emailaddress"),O(u,"class","form-label"),O(f,"type","email"),O(f,"class","form-control"),O(f,"id","emailaddress"),f.required=!0,O(c,"class","mt-5 mb-3"),O(m,"class","bt bt-primary"),O(e,"class","form")},m(v,w){x(v,e,w),b(e,t),b(e,n),b(e,r),b(r,s),b(r,o),b(r,l),b(r,a),b(r,c),b(c,u),b(c,h),b(c,f),Le(f,i[0]),b(r,d),b(r,m),p||(g=[G(f,"input",i[3]),G(r,"submit",i[2])],p=!0)},p(v,w){w&1&&f.value!==v[0]&&Le(f,v[0])},d(v){v&&P(e),p=!1,ht(g)}}}function sx(i){let e,t,n,r,s,o,l,a;return{c(){e=y("div"),t=y("p"),n=W("You will receive an email with a login link at "),r=y("b"),s=W(i[0]),o=W("."),l=D(),a=y("p"),a.textContent="Check your spam folder",O(e,"class","alert alert-info"),O(e,"role","alert")},m(c,u){x(c,e,u),b(e,t),b(t,n),b(t,r),b(r,s),b(t,o),b(e,l),b(e,a)},p(c,u){u&1&&K(s,c[0])},d(c){c&&P(e)}}}function ox(i){let e,t,n,r;function s(a,c){return a[1]?sx:rx}let o=s(i),l=o(i);return{c(){e=y("div"),t=y("div"),n=D(),r=y("div"),l.c(),O(t,"class","bg-image"),O(r,"class","login-form"),O(e,"class","scope-login")},m(a,c){x(a,e,c),b(e,t),b(e,n),b(e,r),l.m(r,null)},p(a,[c]){o===(o=s(a))&&l?l.p(a,c):(l.d(1),l=o(a),l&&(l.c(),l.m(r,null)))},i:U,o:U,d(a){a&&P(e),l.d()}}}function lx(i,e,t){const n=Ue("channel");let r="",s=!1;function o(a){a.preventDefault(),Jn(n.lucentUrl+"/login",{email:r}).then(()=>{t(1,s=!0)}).catch(()=>{})}function l(){r=this.value,t(0,r)}return[r,s,o,l]}class ax extends oe{constructor(e){super(),se(this,e,lx,ox,re,{})}}function cx(i){let e,t,n,r,s,o,l,a,c,u,h,f,d,m,p,g,v,w;return{c(){e=y("div"),t=y("div"),n=D(),r=y("div"),s=y("div"),o=y("h2"),o.textContent="Welcome to Lucent",l=D(),a=y("form"),c=y("button"),u=W("Enter as "),h=W(i[0]),f=D(),d=y("img"),p=D(),g=y("div"),O(t,"class","bg-image"),O(o,"class","mb-5"),O(d,"alt","indicator"),O(d,"id","indicator"),O(d,"class","htmx-indicator"),ad(d.src,m="/img/spinner.svg")||O(d,"src",m),O(c,"class","bt bt-primary"),O(g,"class","form-errors"),O(s,"class","form"),O(r,"class","login-form"),O(e,"class","scope-login")},m(S,_){x(S,e,_),b(e,t),b(e,n),b(e,r),b(r,s),b(s,o),b(s,l),b(s,a),b(a,c),b(c,u),b(c,h),b(c,f),b(c,d),b(s,p),b(s,g),v||(w=G(a,"submit",i[1]),v=!0)},p(S,[_]){_&1&&K(h,S[0])},i:U,o:U,d(S){S&&P(e),v=!1,w()}}}function ux(i,e,t){const n=Ue("channel");let{email:r}=e,{token:s}=e;function o(l){l.preventDefault(),Jn(n.lucentUrl+"/verify",{email:r,token:s}).then(a=>{window.location=n.lucentUrl}).catch(a=>{})}return i.$$set=l=>{"email"in l&&t(0,r=l.email),"token"in l&&t(2,s=l.token)},[r,o,s]}class hx extends oe{constructor(e){super(),se(this,e,ux,cx,re,{email:0,token:2})}}function fx(i){let e,t,n;return{c(){e=y("div"),t=y("div"),n=W(i[2]),O(t,"class","avatar__letters"),O(e,"class","avatar"),O(e,"title",i[0]),le(e,"background-color",i[3][i[4]]),le(e,"height",i[1]+"px"),le(e,"width",i[1]+"px"),le(e,"font-size",i[1]/2+"px")},m(r,s){x(r,e,s),b(e,t),b(t,n)},p(r,[s]){s&4&&K(n,r[2]),s&1&&O(e,"title",r[0]),s&2&&le(e,"height",r[1]+"px"),s&2&&le(e,"width",r[1]+"px"),s&2&&le(e,"font-size",r[1]/2+"px")},i:U,o:U,d(r){r&&P(e)}}}function dx(i,e,t){let{name:n}=e,{side:r=48}=e;const s=["#00AA55","#009FD4","#B381B3","#939393","#E3BC00","#D47500","#DC2A2A","#3ede91","#377dd4","#0256b0","#053d82","#3d026e","#b378e3","#c4065c","#543208","#d97811","#0c6b40"];let o="";n.split(" ").length>1?o=n.split(" ")[0].charAt(0).toUpperCase()+n.split(" ")[1].charAt(0).toUpperCase():o=n.split(" ")[0].charAt(0).toUpperCase()+n.split(" ")[0].charAt(1).toUpperCase();let a=(n.charCodeAt(1)+n.length)%19;return i.$$set=c=>{"name"in c&&t(0,n=c.name),"side"in c&&t(1,r=c.side)},[n,r,o,s,a]}class _i extends oe{constructor(e){super(),se(this,e,dx,fx,re,{name:0,side:1})}}function mx(i){const e=i-1;return e*e*e+1}function hu(i,{delay:e=0,duration:t=400,easing:n=mx,x:r=0,y:s=0,opacity:o=0}={}){const l=getComputedStyle(i),a=+l.opacity,c=l.transform==="none"?"":l.transform,u=a*(1-o),[h,f]=eg(r),[d,m]=eg(s);return{delay:e,duration:t,easing:n,css:(p,g)=>`
|
||||
transform: ${c} translate(${(1-p)*h}${f}, ${(1-p)*d}${m});
|
||||
opacity: ${a-u*g}`}}function dg(i){let e,t,n,r,s,o,l;return{c(){e=y("div"),t=y("div"),t.textContent="Success",n=D(),r=y("div"),s=W(i[1]),O(t,"class","title"),O(r,"class","content"),O(e,"class","notice notice-success"),O(e,"role","alert")},m(a,c){x(a,e,c),b(e,t),b(e,n),b(e,r),b(r,s),l=!0},p(a,c){(!l||c&2)&&K(s,a[1])},i(a){l||(a&&As(()=>{l&&(o||(o=lu(e,hu,{duration:500},!0)),o.run(1))}),l=!0)},o(a){a&&(o||(o=lu(e,hu,{duration:500},!1)),o.run(0)),l=!1},d(a){a&&P(e),a&&o&&o.end()}}}function px(i){let e,t=i[0]&&dg(i);return{c(){t&&t.c(),e=Ie()},m(n,r){t&&t.m(n,r),x(n,e,r)},p(n,[r]){n[0]?t?(t.p(n,r),r&1&&T(t,1)):(t=dg(n),t.c(),T(t,1),t.m(e.parentNode,e)):t&&(Oe(),R(t,1,1,()=>{t=null}),be())},i(n){T(t)},o(n){R(t)},d(n){n&&P(e),t&&t.d(n)}}}function gx(i,e,t){let n,r;function s(o="Saved"){t(1,n=o),t(0,r=!0),setTimeout(function(){t(0,r=!1)},2e3)}return t(1,n="Saved"),t(0,r=!1),[r,n,s]}class ay extends oe{constructor(e){super(),se(this,e,gx,px,re,{show:2})}get show(){return this.$$.ctx[2]}}function Ox(i){let e,t,n,r,s,o,l,a,c,u,h,f,d,m,p,g,v,w,S,_,k,A,C,Q,M,L;t=new Ma({props:{message:i[2]}});let N={};return r=new ay({props:N}),i[8](r),l=new _i({props:{name:i[4].name}}),d=new uu({props:{label:"Update Name"}}),S=new uu({props:{label:"Update Email"}}),{c(){e=y("div"),V(t.$$.fragment),n=D(),V(r.$$.fragment),s=D(),o=y("h3"),V(l.$$.fragment),a=D(),c=y("form"),u=y("div"),h=y("input"),f=D(),V(d.$$.fragment),m=D(),p=y("form"),g=y("div"),v=y("input"),w=D(),V(S.$$.fragment),_=D(),k=y("div"),A=y("a"),C=W("Logout from this device"),O(o,"class","header-small mb-5"),O(h,"type","text"),O(h,"class","form-control mb-3"),O(h,"placeholder","Name"),h.required=!0,O(u,"class","input-group mb-5"),O(v,"type","email"),O(v,"class","form-control mb-3"),O(v,"placeholder","Email"),v.required=!0,O(g,"class","input-group mb-5"),O(A,"class","list-group-item list-group-item-action"),O(A,"href",i[5].lucentUrl+"/logout"),O(k,"class","list-group"),O(e,"class","wrapper-tiny")},m(B,J){x(B,e,J),Y(t,e,null),b(e,n),Y(r,e,null),b(e,s),b(e,o),Y(l,o,null),b(e,a),b(e,c),b(c,u),b(u,h),Le(h,i[0]),b(u,f),Y(d,u,null),b(e,m),b(e,p),b(p,g),b(g,v),Le(v,i[1]),b(g,w),Y(S,g,null),b(e,_),b(e,k),b(k,A),b(A,C),Q=!0,M||(L=[G(h,"input",i[9]),G(c,"submit",i[6]),G(v,"input",i[10]),G(p,"submit",i[7])],M=!0)},p(B,[J]){const te={};J&4&&(te.message=B[2]),t.$set(te);const ie={};r.$set(ie),J&1&&h.value!==B[0]&&Le(h,B[0]),J&2&&v.value!==B[1]&&Le(v,B[1])},i(B){Q||(T(t.$$.fragment,B),T(r.$$.fragment,B),T(l.$$.fragment,B),T(d.$$.fragment,B),T(S.$$.fragment,B),Q=!0)},o(B){R(t.$$.fragment,B),R(r.$$.fragment,B),R(l.$$.fragment,B),R(d.$$.fragment,B),R(S.$$.fragment,B),Q=!1},d(B){B&&P(e),z(t),i[8](null),z(r),z(l),z(d),z(S),M=!1,ht(L)}}}function bx(i,e,t){const n=Ue("user"),r=Ue("channel");let s=n.name,o=n.email,l="",a;function c(m){m.preventDefault(),t(2,l=""),Jn(r.lucentUrl+"/account/update-name",{name:s}).then(p=>{a.show()}).catch(p=>{var g;t(2,l=(g=p.response)==null?void 0:g.data.error),console.log({errorMessage:l})})}function u(m){m.preventDefault(),t(2,l=""),Jn(r.lucentUrl+"/account/update-email",{email:o}).then(p=>{a.show()}).catch(p=>{var g;t(2,l=(g=p.response)==null?void 0:g.data.error),console.log({errorMessage:l})})}function h(m){Ce[m?"unshift":"push"](()=>{a=m,t(3,a)})}function f(){s=this.value,t(0,s)}function d(){o=this.value,t(1,o)}return[s,o,l,a,n,r,c,u,h,f,d]}class vx extends oe{constructor(e){super(),se(this,e,bx,Ox,re,{})}}function wx(i){let e,t,n;const r=[{channel:i[3]},{title:i[0]},i[2]];var s=i[4][i[1]];function o(l,a){let c={};for(let u=0;u<r.length;u+=1)c=Ps(c,r[u]);return a!==void 0&&a&13&&(c=Ps(c,_o(r,[a&8&&{channel:l[3]},a&1&&{title:l[0]},a&4&&Co(l[2])]))),{props:c}}return s&&(t=Xr(s,o(i))),{c(){e=y("div"),t&&V(t.$$.fragment)},m(l,a){x(l,e,a),t&&Y(t,e,null),n=!0},p(l,[a]){if(a&2&&s!==(s=l[4][l[1]])){if(t){Oe();const c=t;R(c.$$.fragment,1,0,()=>{z(c,1)}),be()}s?(t=Xr(s,o(l,a)),V(t.$$.fragment),T(t.$$.fragment,1),Y(t,e,null)):t=null}else if(s){const c=a&13?_o(r,[a&8&&{channel:l[3]},a&1&&{title:l[0]},a&4&&Co(l[2])]):{};t.$set(c)}},i(l){n||(t&&T(t.$$.fragment,l),n=!0)},o(l){t&&R(t.$$.fragment,l),n=!1},d(l){l&&P(e),t&&z(t)}}}function yx(i,e,t){const n={register:ix,login:ax,verify:hx,profile:vx};let{title:r}=e,{view:s}=e,{user:o}=e,{data:l}=e,{channel:a}=e;return Ql("channel",a),Ql("user",o),i.$$set=c=>{"title"in c&&t(0,r=c.title),"view"in c&&t(1,s=c.view),"user"in c&&t(5,o=c.user),"data"in c&&t(2,l=c.data),"channel"in c&&t(3,a=c.channel)},[r,s,l,a,n,o]}class kx extends oe{constructor(e){super(),se(this,e,yx,wx,re,{title:0,view:1,user:5,data:2,channel:3})}}const Sx=i=>({}),mg=i=>({});function _x(i){let e;return{c(){e=W("Dropdown")},m(t,n){x(t,e,n)},d(t){t&&P(e)}}}function Cx(i){let e,t,n,r,s,o,l,a;const c=i[6].button,u=Hl(c,i,i[5],mg),h=u||_x(),f=i[6].default,d=Hl(f,i,i[5],null);return{c(){e=y("div"),t=y("button"),h&&h.c(),n=D(),r=y("div"),d&&d.c(),O(t,"class","button dropdown-button"),O(t,"type","button"),O(t,"aria-expanded","false"),O(r,"class",s="dropdown-menu hide ori
Line truncated
|
||||
Save`,O(e,"type","button"),O(e,"class","button primary ms-2 btn btn-primary btn-spinner")},m(r,s){x(r,e,s),t||(n=G(e,"click",i[10]),t=!0)},p:U,d(r){r&&P(e),t=!1,n()}}}function gT(i){let e,t,n;return{c(){e=y("button"),e.innerHTML=`<span class="spinner-border spinner-border-sm" role="status" aria-hidden="true"></span>
|
||||
Create`,O(e,"class","button primary btn-spinner")},m(r,s){x(r,e,s),t||(n=G(e,"click",i[10]),t=!0)},p:U,d(r){r&&P(e),t=!1,n()}}}function qg(i){let e,t,n,r;function s(a){i[14](a)}function o(a){i[15](a)}let l={field:i[24],schema:i[2],record:i[0],validationErrors:i[4],isCreateMode:i[3]};return i[0].data!==void 0&&(l.data=i[0].data),i[1]!==void 0&&(l.graph=i[1]),e=new aP({props:l}),Ce.push(()=>nt(e,"data",s)),Ce.push(()=>nt(e,"graph",o)),{c(){V(e.$$.fragment)},m(a,c){Y(e,a,c),r=!0},p(a,c){const u={};c&4&&(u.schema=a[2]),c&1&&(u.record=a[0]),c&16&&(u.validationErrors=a[4]),c&8&&(u.isCreateMode=a[3]),!t&&c&1&&(t=!0,u.data=a[0].data,st(()=>t=!1)),!n&&c&2&&(n=!0,u.graph=a[1],st(()=>n=!1)),e.$set(u)},i(a){r||(T(e.$$.fragment,a),r=!0)},o(a){R(e.$$.fragment,a),r=!1},d(a){z(e,a)}}}function Gg(i,e){let t,n,r,s=e[5]===e[24].group&&qg(e);return{key:i,first:null,c(){t=Ie(),s&&s.c(),n=Ie(),this.first=t},m(o,l){x(o,t,l),s&&s.m(o,l),x(o,n,l),r=!0},p(o,l){e=o,e[5]===e[24].group?s?(s.p(e,l),l&32&&T(s,1)):(s=qg(e),s.c(),T(s,1),s.m(n.parentNode,n)):s&&(Oe(),R(s,1,1,()=>{s=null}),be())},i(o){r||(T(s),r=!0)},o(o){R(s),r=!1},d(o){o&&(P(t),P(n)),s&&s.d(o)}}}function OT(i){let e,t,n,r,s,o,l,a,c,u,h,f,d,m,p,g,v,w=[],S=new Map,_,k,A;function C(X){i[11](X)}function Q(X){i[12](X)}let M={schema:i[2],isCreateMode:i[3]};i[0]!==void 0&&(M.record=i[0]),i[5]!==void 0&&(M.activeContentTab=i[5]),n=new cy({props:M}),Ce.push(()=>nt(n,"record",C)),Ce.push(()=>nt(n,"activeContentTab",Q));function L(X,ee){if(X[3])return gT;if(X[6])return pT}let N=L(i),B=N&&N(i);a=new _y({props:{schema:i[2],record:i[0],isCreateMode:i[3]}}),u=new Ma({props:{message:i[7]}});function J(X){i[13](X)}let te={schema:i[2],isCreateMode:i[3]};i[5]!==void 0&&(te.active=i[5]),d=new uy({props:te}),Ce.push(()=>nt(d,"active",J)),g=new uT({props:{record:i[0],schema:i[2]}});let ie=fe(i[8]);const ae=X=>X[24].name;for(let X=0;X<ie.length;X+=1){let ee=jg(i,ie,X),Te=ae(ee);S.set(Te,w[X]=Gg(Te,ee))}return{c(){e=y("div"),t=y("div"),V(n.$$.fragment),o=D(),B&&B.c(),l=D(),V(a.$$.fragment),c=D(),V(u.$$.fragment),h=D(),f=y("div"),V(d.$$.fragment),p=D(),V(g.$$.fragment),v=D();for(let X=0;X<w.length;X+=1)w[X].c();O(t,"class","tools-header"),O(f,"class","mt-4"),le(f,"margin-bottom","150px"),le(f,"position","relative"),O(e,"class","inline-edit record-edit")},m(X,ee){x(X,e,ee),b(e,t),Y(n,t,null),b(t,o),B&&B.m(t,null),b(e,l),Y(a,e,null),b(e,c),Y(u,e,null),b(e,h),b(e,f),Y(d,f,null),b(f,p),Y(g,f,null),b(f,v);for(let Te=0;Te<w.length;Te+=1)w[Te]&&w[Te].m(f,null);_=!0,k||(A=G(window,"beforeunload",i[9]),k=!0)},p(X,[ee]){const Te={};ee&4&&(Te.schema=X[2]),ee&8&&(Te.isCreateMode=X[3]),!r&&ee&1&&(r=!0,Te.record=X[0],st(()=>r=!1)),!s&&ee&32&&(s=!0,Te.activeContentTab=X[5],st(()=>s=!1)),n.$set(Te),N===(N=L(X))&&B?B.p(X,ee):(B&&B.d(1),B=N&&N(X),B&&(B.c(),B.m(t,null)));const ve={};ee&4&&(ve.schema=X[2]),ee&1&&(ve.record=X[0]),ee&8&&(ve.isCreateMode=X[3]),a.$set(ve);const je={};ee&128&&(je.message=X[7]),u.$set(je);const ne={};ee&4&&(ne.schema=X[2]),ee&8&&(ne.isCreateMode=X[3]),!m&&ee&32&&(m=!0,ne.active=X[5],st(()=>m=!1)),d.$set(ne);const Ee={};ee&1&&(Ee.record=X[0]),ee&4&&(Ee.schema=X[2]),g.$set(Ee),ee&319&&(ie=fe(X[8]),Oe(),w=Ti(w,ee,ae,1,X,ie,S,f,Jr,Gg,null,jg),be())},i(X){if(!_){T(n.$$.fragment,X),T(a.$$.fragment,X),T(u.$$.fragment,X),T(d.$$.fragment,X),T(g.$$.fragment,X);for(let ee=0;ee<ie.length;ee+=1)T(w[ee]);_=!0}},o(X){R(n.$$.fragment,X),R(a.$$.fragment,X),R(u.$$.fragment,X),R(d.$$.fragment,X),R(g.$$.fragment,X);for(let ee=0;ee<w.length;ee+=1)R(w[ee]);_=!1},d(X){X&&P(e),z(n),B&&B.d(),z(a),z(u),z(d),z(g);for(let ee=0;ee<w.length;ee+=1)w[ee].d();k=!1,A()}}}function bT(i,e,t){let n,r;const s=Ue("channel"),o=nn();let{schema:l}=e,{record:a}=e,{graph:c={records:[],edges:[]}}=e,{isCreateMode:u}=e,h,f="",d=!1,m=l.fields.filter(M=>M.name!=="id"),p="_default";l.fields.reduce((M,L)=>L.ui==="tab"?(p=L.name,M):(M[p]=[...M[p]??[],L.name],M),[]),xi(()=>{g()});function g(){h={data:JSON.parse(JSON.stringify(a.data)),schema:a.schema,status:a.status,edges:JSON.parse(JSON.stringify(c.edges))}}Kw(()=>{t(6,d=w())});function v(M){return d?M.returnValue="You have unsaved changes. Are you sure you want to exit?":(delete M.returnValue,"...")}function w(){return u?!1:!ia(h,{data:a.data,schema:a.schema,status:a.status,edges:c.edges})}function S(M){return M.preventDefault(),console.log("SAVE: Attempt"),t(4,n=null),t(7,r=""),new Promise(function(L,N){var B;if(!d&&!u){L(null);return}if(!a){L(null);return}t(1,c.edges=((B=c.edges)==null?void 0:B.filter(J=>!J._isTrashed&&J.source===a.id))??[],c),Jn(s.lucentUrl+"/records",{record:a,edges:c.edges,isCreateMode:u}).then(function(J){console.log("SAVE: SAVED INLINE"),t(0,a=J.records[0]),t(1,c=J),u||g(),o("inlinesaved",{records:[a]}),L(null)}).catch(function(J){J.response&&(typeof J.response.data.error=="string"?t(7,r=J.response.data.error):t(4,n=J.response.data.error)),L(null)})})}function _(M){a=M,t(0,a)}function k(M){f=M,t(5,f)}function A(M){f=M,t(5,f)}function C(M){i.$$.not_e
Line truncated
|
||||
Back`),r=D();for(let h=0;h<u.length;h+=1)u[h].c();s=Ie(),O(e,"class","dropdown-item button")},m(h,f){x(h,e,f),Y(t,e,null),b(e,n),x(h,r,f);for(let d=0;d<u.length;d+=1)u[d]&&u[d].m(h,f);x(h,s,f),o=!0,l||(a=G(e,"click",i[23]),l=!0)},p(h,f){if(f[0]&2560){c=fe(h[9]);let d;for(d=0;d<c.length;d+=1){const m=iO(h,c,d);u[d]?u[d].p(m,f):(u[d]=sO(m),u[d].c(),u[d].m(s.parentNode,s))}for(;d<u.length;d+=1)u[d].d(1);u.length=c.length}},i(h){o||(T(t.$$.fragment,h),o=!0)},o(h){R(t.$$.fragment,h),o=!1},d(h){h&&(P(e),P(r),P(s)),z(t),Ot(u,h),l=!1,a()}}}function sO(i){let e,t,n;function r(...s){return i[24](i[39],...s)}return{c(){e=y("button"),e.textContent=`${i[39].label} `,O(e,"class","dropdown-item button")},m(s,o){x(s,e,o),t||(n=G(e,"click",r),t=!0)},p(s,o){i=s},d(s){s&&P(e),t=!1,n()}}}function oO(i){let e,t,n,r,s,o,l=i[3].label+"",a,c,u,h,f,d;t=new ut({props:{icon:"arrow-left"}});let m=fe(i[7]),p=[];for(let g=0;g<m.length;g+=1)p[g]=lO(nO(i,m,g));return{c(){e=y("button"),V(t.$$.fragment),n=W(`
|
||||
Back`),r=D(),s=y("div"),o=W("field: "),a=W(l),c=D();for(let g=0;g<p.length;g+=1)p[g].c();u=Ie(),O(e,"class","dropdown-item button"),O(s,"class","selected-filter")},m(g,v){x(g,e,v),Y(t,e,null),b(e,n),x(g,r,v),x(g,s,v),b(s,o),b(s,a),x(g,c,v);for(let w=0;w<p.length;w+=1)p[w]&&p[w].m(g,v);x(g,u,v),h=!0,f||(d=G(e,"click",i[25]),f=!0)},p(g,v){if((!h||v[0]&8)&&l!==(l=g[3].label+"")&&K(a,l),v[0]&8320){m=fe(g[7]);let w;for(w=0;w<m.length;w+=1){const S=nO(g,m,w);p[w]?p[w].p(S,v):(p[w]=lO(S),p[w].c(),p[w].m(u.parentNode,u))}for(;w<p.length;w+=1)p[w].d(1);p.length=m.length}},i(g){h||(T(t.$$.fragment,g),h=!0)},o(g){R(t.$$.fragment,g),h=!1},d(g){g&&(P(e),P(r),P(s),P(c),P(u)),z(t),Ot(p,g),f=!1,d()}}}function lO(i){let e,t=i[42].label+"",n,r,s,o;function l(...a){return i[26](i[42],...a)}return{c(){e=y("button"),n=W(t),r=D(),O(e,"class","dropdown-item button")},m(a,c){x(a,e,c),b(e,n),b(e,r),s||(o=G(e,"click",l),s=!0)},p(a,c){i=a,c[0]&128&&t!==(t=i[42].label+"")&&K(n,t)},d(a){a&&P(e),s=!1,o()}}}function aO(i){let e,t,n,r,s,o,l=i[3].label+"",a,c,u=i[5].label+"",h,f,d,m,p,g,v,w,S;return t=new ut({props:{icon:"arrow-left"}}),{c(){e=y("button"),V(t.$$.fragment),n=W(`
|
||||
Back`),r=D(),s=y("div"),o=W("field: "),a=W(l),c=W(" operator: "),h=W(u),f=D(),d=y("div"),m=y("input"),p=D(),g=y("button"),g.textContent="Add filter",O(e,"class","dropdown-item button"),O(s,"class","selected-filter"),O(m,"type","text"),O(m,"class","form-control"),O(d,"class","filter-input"),O(g,"class","button applied-filter"),O(g,"type","button")},m(_,k){x(_,e,k),Y(t,e,null),b(e,n),x(_,r,k),x(_,s,k),b(s,o),b(s,a),b(s,c),b(s,h),x(_,f,k),x(_,d,k),b(d,m),Le(m,i[2]),x(_,p,k),x(_,g,k),v=!0,w||(S=[G(e,"click",i[27]),G(m,"input",i[28]),G(g,"click",i[14])],w=!0)},p(_,k){(!v||k[0]&8)&&l!==(l=_[3].label+"")&&K(a,l),(!v||k[0]&32)&&u!==(u=_[5].label+"")&&K(h,u),k[0]&4&&m.value!==_[2]&&Le(m,_[2])},i(_){v||(T(t.$$.fragment,_),v=!0)},o(_){R(t.$$.fragment,_),v=!1},d(_){_&&(P(e),P(r),P(s),P(f),P(d),P(p),P(g)),z(t),w=!1,ht(S)}}}function cO(i){let e,t,n,r,s,o,l,a;t=new ut({props:{icon:"arrow-left"}});let c=fe(i[10]),u=[];for(let h=0;h<c.length;h+=1)u[h]=uO(tO(i,c,h));return{c(){e=y("button"),V(t.$$.fragment),n=W(`
|
||||
Back`),r=D();for(let h=0;h<u.length;h+=1)u[h].c();s=Ie(),O(e,"class","dropdown-item button")},m(h,f){x(h,e,f),Y(t,e,null),b(e,n),x(h,r,f);for(let d=0;d<u.length;d+=1)u[d]&&u[d].m(h,f);x(h,s,f),o=!0,l||(a=G(e,"click",i[29]),l=!0)},p(h,f){if(f[0]&5120){c=fe(h[10]);let d;for(d=0;d<c.length;d+=1){const m=tO(h,c,d);u[d]?u[d].p(m,f):(u[d]=uO(m),u[d].c(),u[d].m(s.parentNode,s))}for(;d<u.length;d+=1)u[d].d(1);u.length=c.length}},i(h){o||(T(t.$$.fragment,h),o=!0)},o(h){R(t.$$.fragment,h),o=!1},d(h){h&&(P(e),P(r),P(s)),z(t),Ot(u,h),l=!1,a()}}}function uO(i){let e,t,n;function r(...s){return i[30](i[39],...s)}return{c(){e=y("button"),e.textContent=`${i[39].label} `,O(e,"class","dropdown-item button")},m(s,o){x(s,e,o),t||(n=G(e,"click",r),t=!0)},p(s,o){i=s},d(s){s&&P(e),t=!1,n()}}}function hO(i){let e,t,n,r,s,o,l=i[4].label+"",a,c,u,h,f,d,m,p;t=new ut({props:{icon:"arrow-left"}});function g(w){i[32](w)}let v={field:i[4]};return i[2]!==void 0&&(v.value=i[2]),h=new kT({props:v}),Ce.push(()=>nt(h,"value",g)),h.$on("addFilter",i[14]),{c(){e=y("button"),V(t.$$.fragment),n=W(`
|
||||
Back`),r=D(),s=y("div"),o=W("field: "),a=W(l),c=D(),u=y("div"),V(h.$$.fragment),O(e,"class","dropdown-item button"),O(s,"class","selected-filter"),O(u,"class","mt-2")},m(w,S){x(w,e,S),Y(t,e,null),b(e,n),x(w,r,S),x(w,s,S),b(s,o),b(s,a),x(w,c,S),x(w,u,S),Y(h,u,null),d=!0,m||(p=G(e,"click",i[31]),m=!0)},p(w,S){(!d||S[0]&16)&&l!==(l=w[4].label+"")&&K(a,l);const _={};S[0]&16&&(_.field=w[4]),!f&&S[0]&4&&(f=!0,_.value=w[2],st(()=>f=!1)),h.$set(_)},i(w){d||(T(t.$$.fragment,w),T(h.$$.fragment,w),d=!0)},o(w){R(t.$$.fragment,w),R(h.$$.fragment,w),d=!1},d(w){w&&(P(e),P(r),P(s),P(c),P(u)),z(t),z(h),m=!1,p()}}}function ST(i){let e,t,n,r,s,o,l,a,c,u,h,f,d,m,p,g,v,w,S,_,k,A,C,Q,M,L,N=!i[3]&&rO(i),B=i[3]&&!i[5]&&oO(i),J=i[3]&&i[5]&&aO(i),te=!i[4]&&cO(i),ie=i[4]&&hO(i);return v=new ut({props:{icon:"arrow-left"}}),{c(){e=y("div"),t=y("button"),t.textContent="Filter by field",n=D(),r=y("button"),r.textContent="Filter by Reference",s=D(),o=y("button"),o.textContent="Advanced filter",l=D(),a=y("div"),N&&N.c(),c=D(),B&&B.c(),u=D(),J&&J.c(),h=D(),f=y("div"),te&&te.c(),d=D(),ie&&ie.c(),m=D(),p=y("div"),g=y("button"),V(v.$$.fragment),w=W(`
|
||||
Back`),S=D(),_=y("form"),k=y("input"),A=D(),C=y("button"),C.textContent="Submit",O(t,"class","dropdown-item button"),O(r,"class","dropdown-item button"),O(o,"class","dropdown-item button"),Ae(e,"hide",i[6]!=="main"),Ae(a,"hide",i[6]!=="byField"),Ae(f,"hide",i[6]!=="byReference"),O(g,"class","dropdown-item button"),O(k,"type","search"),O(k,"class","mb-2 mt-2"),O(k,"placeholder","Advanced filters"),k.required=!0,O(C,"class","button applied-filter"),Ae(p,"hide",i[6]!=="advanced")},m(ae,X){x(ae,e,X),b(e,t),b(e,n),b(e,r),b(e,s),b(e,o),x(ae,l,X),x(ae,a,X),N&&N.m(a,null),b(a,c),B&&B.m(a,null),b(a,u),J&&J.m(a,null),x(ae,h,X),x(ae,f,X),te&&te.m(f,null),b(f,d),ie&&ie.m(f,null),x(ae,m,X),x(ae,p,X),b(p,g),Y(v,g,null),b(g,w),b(p,S),b(p,_),b(_,k),Le(k,i[1]),b(_,A),b(_,C),Q=!0,M||(L=[G(t,"click",i[20]),G(r,"click",i[21]),G(o,"click",i[22]),G(g,"click",i[33]),G(k,"input",i[34]),G(_,"submit",i[8])],M=!0)},p(ae,X){(!Q||X[0]&64)&&Ae(e,"hide",ae[6]!=="main"),ae[3]?N&&(Oe(),R(N,1,1,()=>{N=null}),be()):N?(N.p(ae,X),X[0]&8&&T(N,1)):(N=rO(ae),N.c(),T(N,1),N.m(a,c)),ae[3]&&!ae[5]?B?(B.p(ae,X),X[0]&40&&T(B,1)):(B=oO(ae),B.c(),T(B,1),B.m(a,u)):B&&(Oe(),R(B,1,1,()=>{B=null}),be()),ae[3]&&ae[5]?J?(J.p(ae,X),X[0]&40&&T(J,1)):(J=aO(ae),J.c(),T(J,1),J.m(a,null)):J&&(Oe(),R(J,1,1,()=>{J=null}),be()),(!Q||X[0]&64)&&Ae(a,"hide",ae[6]!=="byField"),ae[4]?te&&(Oe(),R(te,1,1,()=>{te=null}),be()):te?(te.p(ae,X),X[0]&16&&T(te,1)):(te=cO(ae),te.c(),T(te,1),te.m(f,d)),ae[4]?ie?(ie.p(ae,X),X[0]&16&&T(ie,1)):(ie=hO(ae),ie.c(),T(ie,1),ie.m(f,null)):ie&&(Oe(),R(ie,1,1,()=>{ie=null}),be()),(!Q||X[0]&64)&&Ae(f,"hide",ae[6]!=="byReference"),X[0]&2&&k.value!==ae[1]&&Le(k,ae[1]),(!Q||X[0]&64)&&Ae(p,"hide",ae[6]!=="advanced")},i(ae){Q||(T(N),T(B),T(J),T(te),T(ie),T(v.$$.fragment,ae),Q=!0)},o(ae){R(N),R(B),R(J),R(te),R(ie),R(v.$$.fragment,ae),Q=!1},d(ae){ae&&(P(e),P(l),P(a),P(h),P(f),P(m),P(p)),N&&N.d(),B&&B.d(),J&&J.d(),te&&te.d(),ie&&ie.d(),z(v),M=!1,ht(L)}}}function _T(i){let e,t,n,r,s;return t=new ut({props:{icon:"filter"}}),{c(){e=y("div"),V(t.$$.fragment),n=D(),r=y("span"),r.textContent="Filter",O(r,"class","ms-1"),O(e,"slot","button")},m(o,l){x(o,e,l),Y(t,e,null),b(e,n),b(e,r),s=!0},p:U,i(o){s||(T(t.$$.fragment,o),s=!0)},o(o){R(t.$$.fragment,o),s=!1},d(o){o&&P(e),z(t)}}}function CT(i){let e,t,n,r={$$slots:{button:[_T],default:[ST]},$$scope:{ctx:i}};return t=new ur({props:r}),i[35](t),{c(){e=y("div"),V(t.$$.fragment)},m(s,o){x(s,e,o),Y(t,e,null),n=!0},p(s,o){const l={};o[0]&254|o[1]&65536&&(l.$$scope={dirty:o,ctx:s}),t.$set(l)},i(s){n||(T(t.$$.fragment,s),n=!0)},o(s){R(t.$$.fragment,s),n=!1},d(s){s&&P(e),i[35](null),z(t)}}}function PT(i,e,t){const n=nn();let{schema:r}=e,{systemFields:s=[]}=e,{operators:o}=e,{inModal:l}=e,{modalUrl:a}=e,c,u="",h=s;r.type==="collection"&&(h=s.filter(H=>H.files===!1));function f(H){H.preventDefault();let Pe=u.split("=")[0]??"";if(!Pe)return;let Ye=`filter[${Pe}]`,Tt=u.split("=")[1]??"";if(!Tt)return;const yt=new URL(a??window.location.href);yt.searchParams.set("skip","0"),yt.searchParams.set(Ye,Tt),l?n("refresh",yt):window.location.replace(yt),M()}let d=null,m=null,p=null,g=null,v="main",w=null,S=[...r.fields,...h].filter(H=>{var Pe;return!["file","json","reference"].includes(((Pe=H.info)==null?void 0:Pe.name)??H.ui)}),_=[...r.fields].filter(H=>{var Pe;return["reference"].includes(((Pe=H.info)==null?void 0:Pe.name)??H.ui)});function k(H,Pe){t(3,m=Pe),t(7,w=o.filter(Ye=>{var Tt;return Ye.uis.includes((Tt=m==null?void 0:m.info)==null?void 0:Tt.name)||Ye.uis[0]==="*"}))}function A(H,Pe){t(4,p=Pe),t(5,g=o.find(Ye=>Ye.name==="eq"))}function C(H,Pe){t(5,g=Pe),Pe.hasValue||Q(H)}function Q(H){H.preventDefault();let Pe="",Ye,Tt=m??p;r.fields.find(wt=>wt.name===Tt.name)&&(Tt.info.name==="reference"&&g.name==="eq"?(Pe="children."+Tt.name+".id",Ye=`filter[${Pe}]`):(Pe="data.",Ye=`filter[${Pe+Tt.name}_${g.name}]`));const yt=new URL(a??window.location.href);yt.searchParams.set("skip","0"),yt.searchParams.set(Ye,d),l?(n("refresh",yt),c.close()):window.location.href=yt.toString(),M()}function M(){t(3,m=null),t(5,g=null),t(6,v="main"),t(4,p=null)}const L=H=>t(6,v="byField"),N=H=>t(6,v="byReference"),B=H=>t(6,v="advanced"),J=H=>t(6,v="main"),te=(H,Pe)=>k(Pe,H),ie=H=>t(3,m=null),ae=(H,Pe)=>C(Pe,H),X=H=>t(5,g=null);function ee(){d=this.value,t(2,d)}const Te=H=>t(6,v="main"),ve=(H,Pe)=>A(Pe,H),je=H=>t(4,p=null);function ne(H){d=H,t(2,d)}const Ee=H=>t(6,v="main");function Re(){u=this.value,t(1,u)}function xt(H){Ce[H?"unshift":"push"](()=>{c=H,t(0,c)})}return i.$$set=H=>{"schema"in H&&t(15,r=H.schema),"systemFields"in H&&t(16,s=H.systemFields),"operators"in H&&t(17,o=H.operators),"inModal"in H&&t(18,l=H.inModal),"modalUrl"in H&&t(19,a=H.modalUrl)},[c,u,d,m,p,g,v,w,f,S,_,k,A,C,Q,r,s,o,l,a,L,N,B,J,te,ie,ae,X,ee,Te,ve,je,ne,Ee,Re,xt]}class AT extends oe{constructor(e){super(),se(this,e,PT,CT,re,{schema:15,systemFields:16,operators:17,inModal:18,modalUrl:19},null,[-1,-1])}}function fO(i,e,t){const n=i.slice();return n[18]=e[t],n}func
Line truncated
|
||||
|
||||
`),n=y("button"),V(r.$$.fragment),O(n,"type","button"),O(n,"class","button-text"),O(n,"aria-label","Close"),O(e,"class","applied-filter")},m(a,c){x(a,e,c),b(e,t),b(e,n),Y(r,n,null),s=!0,o||(l=G(n,"click",Ln(i[4])),o=!0)},p:U,i(a){s||(T(r.$$.fragment,a),s=!0)},o(a){R(r.$$.fragment,a),s=!1},d(a){a&&P(e),z(r),o=!1,l()}}}function FT(i){let e=i[0].searchParams.get("notlinked"),t,n,r=e&&XT(i);return{c(){r&&r.c(),t=Ie()},m(s,o){r&&r.m(s,o),x(s,t,o),n=!0},p(s,[o]){e&&r.p(s,o)},i(s){n||(T(r),n=!0)},o(s){R(r),n=!1},d(s){s&&P(t),r&&r.d(s)}}}function YT(i,e,t){Ue("channel");const n=nn();let{inModal:r}=e,{modalUrl:s}=e;const o=new URL(s??window.location.href);function l(c){const u=new URL(s??window.location.href);u.searchParams.set("skip","0"),u.searchParams.delete("notlinked"),r?n("refresh",u):window.location.replace(u)}const a=()=>l();return i.$$set=c=>{"inModal"in c&&t(2,r=c.inModal),"modalUrl"in c&&t(3,s=c.modalUrl)},[o,l,r,s,a]}class zT extends oe{constructor(e){super(),se(this,e,YT,FT,re,{inModal:2,modalUrl:3})}}function gO(i,e,t){const n=i.slice();return n[21]=e[t][0],n[22]=e[t][1],n}function OO(i){let e,t,n;return{c(){e=y("a"),t=W("New Record"),O(e,"href",n=i[10].lucentUrl+"/records/new?schema="+i[0].name),O(e,"class","button")},m(r,s){x(r,e,s),b(e,t)},p(r,s){s&1&&n!==(n=r[10].lucentUrl+"/records/new?schema="+r[0].name)&&O(e,"href",n)},d(r){r&&P(e)}}}function bO(i){let e,t;return e=new ur({props:{orientation:"right",$$slots:{button:[qT],default:[jT]},$$scope:{ctx:i}}}),{c(){V(e.$$.fragment)},m(n,r){Y(e,n,r),t=!0},p(n,r){const s={};r&33554577&&(s.$$scope={dirty:r,ctx:n}),e.$set(s)},i(n){t||(T(e.$$.fragment,n),t=!0)},o(n){R(e.$$.fragment,n),t=!1},d(n){z(e,n)}}}function VT(i){let e,t,n,r,s,o,l,a,c,u;return{c(){e=y("a"),t=W("Export to CSV"),n=D(),r=y("a"),s=W("View trashed records"),l=D(),a=y("a"),c=W("View unlinked records"),O(e,"class","dropdown-item"),O(e,"href",i[11]),O(r,"class","dropdown-item"),O(r,"href",o=i[10].lucentUrl+"/content/"+i[0].name+"?filter[status_in]=trashed"),O(a,"class","dropdown-item"),O(a,"href",u=i[10].lucentUrl+"/content/"+i[0].name+"?notlinked=*")},m(h,f){x(h,e,f),b(e,t),x(h,n,f),x(h,r,f),b(r,s),x(h,l,f),x(h,a,f),b(a,c)},p(h,f){f&1&&o!==(o=h[10].lucentUrl+"/content/"+h[0].name+"?filter[status_in]=trashed")&&O(r,"href",o),f&1&&u!==(u=h[10].lucentUrl+"/content/"+h[0].name+"?notlinked=*")&&O(a,"href",u)},d(h){h&&(P(e),P(n),P(r),P(l),P(a))}}}function UT(i){let e,t=i[7]&&vO(i);return{c(){t&&t.c(),e=Ie()},m(n,r){t&&t.m(n,r),x(n,e,r)},p(n,r){n[7]?t?t.p(n,r):(t=vO(n),t.c(),t.m(e.parentNode,e)):t&&(t.d(1),t=null)},d(n){n&&P(e),t&&t.d(n)}}}function vO(i){let e,t,n;return{c(){e=y("a"),t=W("Empty trash"),O(e,"class","dropdown-item"),O(e,"href",n=i[10].lucentUrl+"/content/"+i[0].name+"/emptyTrash")},m(r,s){x(r,e,s),b(e,t)},p(r,s){s&1&&n!==(n=r[10].lucentUrl+"/content/"+r[0].name+"/emptyTrash")&&O(e,"href",n)},d(r){r&&P(e)}}}function jT(i){let e;function t(s,o){return s[4].status_in==="trashed"?UT:VT}let n=t(i),r=n(i);return{c(){r.c(),e=Ie()},m(s,o){r.m(s,o),x(s,e,o)},p(s,o){n===(n=t(s))&&r?r.p(s,o):(r.d(1),r=n(s),r&&(r.c(),r.m(e.parentNode,e)))},d(s){s&&P(e),r.d(s)}}}function qT(i){let e,t,n;return t=new ut({props:{icon:"ellipsis-vertical"}}),{c(){e=y("div"),V(t.$$.fragment),O(e,"slot","button")},m(r,s){x(r,e,s),Y(t,e,null),n=!0},p:U,i(r){n||(T(t.$$.fragment,r),n=!0)},o(r){R(t.$$.fragment,r),n=!1},d(r){r&&P(e),z(t)}}}function wO(i){let e,t,n=fe(Object.entries(i[4])),r=[];for(let o=0;o<n.length;o+=1)r[o]=yO(gO(i,n,o));const s=o=>R(r[o],1,1,()=>{r[o]=null});return{c(){for(let o=0;o<r.length;o+=1)r[o].c();e=Ie()},m(o,l){for(let a=0;a<r.length;a+=1)r[a]&&r[a].m(o,l);x(o,e,l),t=!0},p(o,l){if(l&377){n=fe(Object.entries(o[4]));let a;for(a=0;a<n.length;a+=1){const c=gO(o,n,a);r[a]?(r[a].p(c,l),T(r[a],1)):(r[a]=yO(c),r[a].c(),T(r[a],1),r[a].m(e.parentNode,e))}for(Oe(),a=n.length;a<r.length;a+=1)s(a);be()}},i(o){if(!t){for(let l=0;l<n.length;l+=1)T(r[l]);t=!0}},o(o){r=r.filter(Boolean);for(let l=0;l<r.length;l+=1)R(r[l]);t=!1},d(o){o&&P(e),Ot(r,o)}}}function yO(i){let e,t;return e=new WT({props:{schema:i[0],operators:i[3],key:i[21],value:i[22],inModal:i[5],modalUrl:i[6],graph:i[8]}}),e.$on("refresh",i[18]),{c(){V(e.$$.fragment)},m(n,r){Y(e,n,r),t=!0},p(n,r){const s={};r&1&&(s.schema=n[0]),r&8&&(s.operators=n[3]),r&16&&(s.key=n[21]),r&16&&(s.value=n[22]),r&32&&(s.inModal=n[5]),r&64&&(s.modalUrl=n[6]),r&256&&(s.graph=n[8]),e.$set(s)},i(n){t||(T(e.$$.fragment,n),t=!0)},o(n){R(e.$$.fragment,n),t=!1},d(n){z(e,n)}}}function GT(i){let e,t,n,r,s,o,l,a,c,u,h,f,d,m,p,g=Object.entries(i[4]).length>0,v,w,S;n=new DT({props:{schema:i[0],sortParam:i[1],sortField:i[2],systemFields:i[9],inModal:i[5],modalUrl:i[6]}}),n.$on("refresh",i[14]);function _(M){i[15](M)}let k={systemFields:i[9],operators:i[3],filter:i[4],inModal:i[5],modalUrl:i[6]};i[0]!==void 0&&(k.schema=i[0]),s=new AT({props:k}),Ce.push(()=>nt(s,"schema",_)),s.$on("refresh",i[16]);let A=!i[5]&&i[7]&&OO(i),C=!i[5]&&bO(i);m=new zT({props:{inModal:i[5],modalUrl:
Line truncated
|
||||
`),o=y("span"),a=W(l),c=W(`
|
||||
to
|
||||
`),u=y("span"),f=W(h),d=W(`
|
||||
of
|
||||
`),m=y("span"),p=W(i[4]),g=W(`
|
||||
total`),O(t,"class","pagination"),O(o,"class","font-medium"),O(u,"class","font-medium"),O(m,"class","font-medium"),le(r,"display","flex"),le(r,"justify-content","center"),le(r,"gap","4px")},m(S,_){x(S,e,_),b(e,t),w&&w.m(t,null),x(S,n,_),x(S,r,_),b(r,s),b(r,o),b(o,a),b(r,c),b(r,u),b(u,f),b(r,d),b(r,m),b(m,p),b(r,g),v=!0},p(S,[_]){S[5]>1?w?(w.p(S,_),_&32&&T(w,1)):(w=_O(S),w.c(),T(w,1),w.m(t,null)):w&&(Oe(),R(w,1,1,()=>{w=null}),be()),(!v||_&8)&&l!==(l=+S[3]+1+"")&&K(a,l),(!v||_&28)&&h!==(h=(+S[3]+S[2]>S[4]?S[4]:+S[3]+S[2])+"")&&K(f,h),(!v||_&16)&&K(p,S[4])},i(S){v||(T(w),v=!0)},o(S){R(w),v=!1},d(S){S&&(P(e),P(n),P(r)),w&&w.d()}}}function sQ(i,e,t){let n,r,s;const o=nn();let{inModal:l}=e,{modalUrl:a}=e,{limit:c}=e,{skip:u}=e,{total:h}=e;const f=(v,w,S=1)=>Array.from({length:Math.ceil((w-v)/S)},(_,k)=>v+k*S);function d(v){v.preventDefault(),p(n)}function m(v){v.preventDefault(),p(1)}function p(v){const w=new URL(a??window.location.href);let S=v*c-c;w.searchParams.set("skip",S),l?o("refresh",w):window.location=w}function g(v){vs.call(this,i,v)}return i.$$set=v=>{"inModal"in v&&t(0,l=v.inModal),"modalUrl"in v&&t(1,a=v.modalUrl),"limit"in v&&t(2,c=v.limit),"skip"in v&&t(3,u=v.skip),"total"in v&&t(4,h=v.total)},i.$$.update=()=>{i.$$.dirty&20&&t(5,n=Math.ceil(h/c)),i.$$.dirty&12&&t(6,r=Math.ceil((u-1)/c)+1),i.$$.dirty&96&&t(7,s=f(r-3,r+4).filter(v=>v>0&&v<=n))},[l,a,c,u,h,n,r,s,d,m,g]}class oQ extends oe{constructor(e){super(),se(this,e,sQ,rQ,re,{inModal:0,modalUrl:1,limit:2,skip:3,total:4})}}function lQ(i){let e,t,n;return{c(){e=y("button"),e.textContent="Move to trash",O(e,"type","button"),O(e,"class","button")},m(r,s){x(r,e,s),t||(n=G(e,"click",Ln(i[9])),t=!0)},p:U,d(r){r&&P(e),t=!1,n()}}}function aQ(i){let e,t,n,r,s,o,l=i[1].hasDrafts&&CO(i);return{c(){e=y("button"),e.textContent="Publish",t=D(),l&&l.c(),n=D(),r=y("button"),r.textContent="Delete forever",O(e,"type","button"),O(e,"class","button"),O(r,"type","button"),O(r,"class","button")},m(a,c){x(a,e,c),x(a,t,c),l&&l.m(a,c),x(a,n,c),x(a,r,c),s||(o=[G(e,"click",Ln(i[7])),G(r,"click",Ln(i[3]))],s=!0)},p(a,c){a[1].hasDrafts?l?l.p(a,c):(l=CO(a),l.c(),l.m(n.parentNode,n)):l&&(l.d(1),l=null)},d(a){a&&(P(e),P(t),P(n),P(r)),l&&l.d(a),s=!1,ht(o)}}}function CO(i){let e,t,n;return{c(){e=y("button"),e.textContent="Make Draft",O(e,"type","button"),O(e,"class","button")},m(r,s){x(r,e,s),t||(n=G(e,"click",Ln(i[8])),t=!0)},p:U,d(r){r&&P(e),t=!1,n()}}}function cQ(i){let e,t,n=i[0].length+"",r,s,o,l,a,c,u,h,f;function d(g,v){return g[2].status_in==="trashed"?aQ:lQ}let m=d(i),p=m(i);return{c(){e=y("div"),t=y("span"),r=W(n),s=W(" records selected"),o=D(),l=y("button"),l.textContent="Publish",a=D(),c=y("button"),c.textContent="Make Draft",u=D(),p.c(),O(t,"class","me-2"),O(l,"type","button"),O(l,"class","button"),O(c,"type","button"),O(c,"class","button"),le(e,"display","flex"),le(e,"align-items","center"),le(e,"gap","8px")},m(g,v){x(g,e,v),b(e,t),b(t,r),b(t,s),b(e,o),b(e,l),b(e,a),b(e,c),b(e,u),p.m(e,null),h||(f=[G(l,"click",Ln(i[5])),G(c,"click",Ln(i[6]))],h=!0)},p(g,[v]){v&1&&n!==(n=g[0].length+"")&&K(r,n),m===(m=d(g))&&p?p.p(g,v):(p.d(1),p=m(g),p&&(p.c(),p.m(e,null)))},i:U,o:U,d(g){g&&P(e),p.d(),h=!1,ht(f)}}}function uQ(i,e,t){const n=Ue("channel");let{selected:r}=e,{schema:s}=e,{filter:o}=e;function l(m){m.preventDefault(),Jn(n.lucentUrl+"/records/delete",{ids:r.map(p=>p.id)}).then(p=>{window.location.reload()}).catch(p=>{console.log(p)})}function a(m,p){Jn(n.lucentUrl+"/records/status/"+p,{schemaName:s.name,records:r}).then(g=>{window.location.reload()}).catch(g=>{console.log(g)})}const c=m=>a(m,"published"),u=m=>a(m,"draft"),h=m=>a(m,"published"),f=m=>a(m,"draft"),d=m=>a(m,"trashed");return i.$$set=m=>{"selected"in m&&t(0,r=m.selected),"schema"in m&&t(1,s=m.schema),"filter"in m&&t(2,o=m.filter)},[r,s,o,l,a,c,u,h,f,d]}class hQ extends oe{constructor(e){super(),se(this,e,uQ,cQ,re,{selected:0,schema:1,filter:2})}}function fQ(i){let e;return{c(){e=W(i[0])},m(t,n){x(t,e,n)},p(t,[n]){n&1&&K(e,t[0])},i:U,o:U,d(t){t&&P(e)}}}function dQ(i,e,t){let{value:n}=e;return i.$$set=r=>{"value"in r&&t(0,n=r.value)},[n]}let mQ=class extends oe{constructor(e){super(),se(this,e,dQ,fQ,re,{value:0})}};function PO(i){let e,t,n,r;return{c(){e=y("div"),t=y("span"),n=D(),r=W(i[0]),O(t,"class","color border border-2 svelte-78o2k4"),le(t,"background",i[0]),O(e,"class","d-inline-flex")},m(s,o){x(s,e,o),b(e,t),b(e,n),b(e,r)},p(s,o){o&1&&le(t,"background",s[0]),o&1&&K(r,s[0])},d(s){s&&P(e)}}}function pQ(i){let e,t=i[0]&&PO(i);return{c(){t&&t.c(),e=Ie()},m(n,r){t&&t.m(n,r),x(n,e,r)},p(n,[r]){n[0]?t?t.p(n,r):(t=PO(n),t.c(),t.m(e.parentNode,e)):t&&(t.d(1),t=null)},i:U,o:U,d(n){n&&P(e),t&&t.d(n)}}}function gQ(i,e,t){let{value:n}=e;return i.$$set=r=>{"value"in r&&t(0,n=r.value)},[n]}let OQ=class extends oe{constructor(e){super(),se(this,e,gQ,pQ,re,{value:0})}};function AO(i){let e,t,n;return{c(){e=y("a"),t=W(i[1]),O(e,"href",n=i[2].lucentUrl+"/records/"+i[0].id),O(e,"title",i[1]),O(e,"class","reference svel
Line truncated
|
||||
* Sortable 1.15.2
|
||||
* @author RubaXa <trash@rubaxa.org>
|
||||
* @author owenm <owen23355@gmail.com>
|
||||
* @license MIT
|
||||
*/function t1(i,e){var t=Object.keys(i);if(Object.getOwnPropertySymbols){var n=Object.getOwnPropertySymbols(i);e&&(n=n.filter(function(r){return Object.getOwnPropertyDescriptor(i,r).enumerable})),t.push.apply(t,n)}return t}function Hi(i){for(var e=1;e<arguments.length;e++){var t=arguments[e]!=null?arguments[e]:{};e%2?t1(Object(t),!0).forEach(function(n){TM(i,n,t[n])}):Object.getOwnPropertyDescriptors?Object.defineProperties(i,Object.getOwnPropertyDescriptors(t)):t1(Object(t)).forEach(function(n){Object.defineProperty(i,n,Object.getOwnPropertyDescriptor(t,n))})}return i}function Nc(i){"@babel/helpers - typeof";return typeof Symbol=="function"&&typeof Symbol.iterator=="symbol"?Nc=function(e){return typeof e}:Nc=function(e){return e&&typeof Symbol=="function"&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e},Nc(i)}function TM(i,e,t){return e in i?Object.defineProperty(i,e,{value:t,enumerable:!0,configurable:!0,writable:!0}):i[e]=t,i}function fr(){return fr=Object.assign||function(i){for(var e=1;e<arguments.length;e++){var t=arguments[e];for(var n in t)Object.prototype.hasOwnProperty.call(t,n)&&(i[n]=t[n])}return i},fr.apply(this,arguments)}function QM(i,e){if(i==null)return{};var t={},n=Object.keys(i),r,s;for(s=0;s<n.length;s++)r=n[s],!(e.indexOf(r)>=0)&&(t[r]=i[r]);return t}function MM(i,e){if(i==null)return{};var t=QM(i,e),n,r;if(Object.getOwnPropertySymbols){var s=Object.getOwnPropertySymbols(i);for(r=0;r<s.length;r++)n=s[r],!(e.indexOf(n)>=0)&&Object.prototype.propertyIsEnumerable.call(i,n)&&(t[n]=i[n])}return t}var EM="1.15.2";function lr(i){if(typeof window<"u"&&window.navigator)return!!navigator.userAgent.match(i)}var pr=lr(/(?:Trident.*rv[ :]?11\.|msie|iemobile|Windows Phone)/i),Ea=lr(/Edge/i),n1=lr(/firefox/i),Ml=lr(/safari/i)&&!lr(/chrome/i)&&!lr(/android/i),xy=lr(/iP(ad|od|hone)/i),Ty=lr(/chrome/i)&&lr(/android/i),Qy={capture:!1,passive:!1};function mt(i,e,t){i.addEventListener(e,t,!pr&&Qy)}function lt(i,e,t){i.removeEventListener(e,t,!pr&&Qy)}function du(i,e){if(e){if(e[0]===">"&&(e=e.substring(1)),i)try{if(i.matches)return i.matches(e);if(i.msMatchesSelector)return i.msMatchesSelector(e);if(i.webkitMatchesSelector)return i.webkitMatchesSelector(e)}catch{return!1}return!1}}function RM(i){return i.host&&i!==document&&i.host.nodeType?i.host:i.parentNode}function ki(i,e,t,n){if(i){t=t||document;do{if(e!=null&&(e[0]===">"?i.parentNode===t&&du(i,e):du(i,e))||n&&i===t)return i;if(i===t)break}while(i=RM(i))}return null}var i1=/\s+/g;function Fn(i,e,t){if(i&&e)if(i.classList)i.classList[t?"add":"remove"](e);else{var n=(" "+i.className+" ").replace(i1," ").replace(" "+e+" "," ");i.className=(n+(t?" "+e:"")).replace(i1," ")}}function De(i,e,t){var n=i&&i.style;if(n){if(t===void 0)return document.defaultView&&document.defaultView.getComputedStyle?t=document.defaultView.getComputedStyle(i,""):i.currentStyle&&(t=i.currentStyle),e===void 0?t:t[e];!(e in n)&&e.indexOf("webkit")===-1&&(e="-webkit-"+e),n[e]=t+(typeof t=="string"?"":"px")}}function co(i,e){var t="";if(typeof i=="string")t=i;else do{var n=De(i,"transform");n&&n!=="none"&&(t=n+" "+t)}while(!e&&(i=i.parentNode));var r=window.DOMMatrix||window.WebKitCSSMatrix||window.CSSMatrix||window.MSCSSMatrix;return r&&new r(t)}function My(i,e,t){if(i){var n=i.getElementsByTagName(e),r=0,s=n.length;if(t)for(;r<s;r++)t(n[r],r);return n}return[]}function Ui(){var i=document.scrollingElement;return i||document.documentElement}function Gt(i,e,t,n,r){if(!(!i.getBoundingClientRect&&i!==window)){var s,o,l,a,c,u,h;if(i!==window&&i.parentNode&&i!==Ui()?(s=i.getBoundingClientRect(),o=s.top,l=s.left,a=s.bottom,c=s.right,u=s.height,h=s.width):(o=0,l=0,a=window.innerHeight,c=window.innerWidth,u=window.innerHeight,h=window.innerWidth),(e||t)&&i!==window&&(r=r||i.parentNode,!pr))do if(r&&r.getBoundingClientRect&&(De(r,"transform")!=="none"||t&&De(r,"position")!=="static")){var f=r.getBoundingClientRect();o-=f.top+parseInt(De(r,"border-top-width")),l-=f.left+parseInt(De(r,"border-left-width")),a=o+s.height,c=l+s.width;break}while(r=r.parentNode);if(n&&i!==window){var d=co(r||i),m=d&&d.a,p=d&&d.d;d&&(o/=p,l/=m,h/=m,u/=p,a=o+u,c=l+h)}return{top:o,left:l,bottom:a,right:c,width:h,height:u}}}function r1(i,e,t){for(var n=Lr(i,!0),r=Gt(i)[e];n;){var s=Gt(n)[t],o=void 0;if(o=r>=s,!o)return n;if(n===Ui())break;n=Lr(n,!1)}return!1}function Po(i,e,t,n){for(var r=0,s=0,o=i.children;s<o.length;){if(o[s].style.display!=="none"&&o[s]!==$e.ghost&&(n||o[s]!==$e.dragged)&&ki(o[s],t.draggable,i,!1)){if(r===e)return o[s];r++}s++}return null}function zm(i,e){for(var t=i.lastElementChild;t&&(t===$e.ghost||De(t,"display")==="none"||e&&!du(t,e));)t=t.previousElementSibling;return t||null}function ii(i,e){var t=0;if(!i||!i.parentNode)return-1;for(;i=i.previousElementSibling;)i.nodeName.toUpperCase()!=="TEMPLATE"&&i!==$e.clone&&(!e||du(i,e))&&t++;return t}function s1(i){var e=0,t=0,n=Ui();if(i)do{var r=co(i),s=r.a,o=r.d;e+=i.scrollLeft*s,t+=i.scrollTop*o}while(i!==n&&(i=i.parentNode));returLine truncated
|
||||
<span class='flatpickr-weekday'>
|
||||
`+$.join("</span><span class='flatpickr-weekday'>")+`
|
||||
</span>
|
||||
`}}function ve(){t.calendarContainer.classList.add("hasWeeks");var E=dt("div","flatpickr-weekwrapper");E.appendChild(dt("span","flatpickr-weekday",t.l10n.weekAbbreviation));var $=dt("div","flatpickr-weeks");return E.appendChild($),{weekWrapper:E,weekNumbers:$}}function je(E,$){$===void 0&&($=!0);var F=$?E:E-t.currentMonth;F<0&&t._hidePrevMonthArrow===!0||F>0&&t._hideNextMonthArrow===!0||(t.currentMonth+=F,(t.currentMonth<0||t.currentMonth>11)&&(t.currentYear+=t.currentMonth>11?1:-1,t.currentMonth=(t.currentMonth+12)%12,pt("onYearChange"),J()),B(),pt("onMonthChange"),er())}function ne(E,$){if(E===void 0&&(E=!0),$===void 0&&($=!0),t.input.value="",t.altInput!==void 0&&(t.altInput.value=""),t.mobileInput!==void 0&&(t.mobileInput.value=""),t.selectedDates=[],t.latestSelectedDateObj=void 0,$===!0&&(t.currentYear=t._initialDate.getFullYear(),t.currentMonth=t._initialDate.getMonth()),t.config.enableTime===!0){var F=qh(t.config),j=F.hours,ce=F.minutes,ge=F.seconds;d(j,ce,ge)}t.redraw(),E&&pt("onChange")}function Ee(){t.isOpen=!1,t.isMobile||(t.calendarContainer!==void 0&&t.calendarContainer.classList.remove("open"),t._input!==void 0&&t._input.classList.remove("active")),pt("onClose")}function Re(){t.config!==void 0&&pt("onDestroy");for(var E=t._handlers.length;E--;)t._handlers[E].remove();if(t._handlers=[],t.mobileInput)t.mobileInput.parentNode&&t.mobileInput.parentNode.removeChild(t.mobileInput),t.mobileInput=void 0;else if(t.calendarContainer&&t.calendarContainer.parentNode)if(t.config.static&&t.calendarContainer.parentNode){var $=t.calendarContainer.parentNode;if($.lastChild&&$.removeChild($.lastChild),$.parentNode){for(;$.firstChild;)$.parentNode.insertBefore($.firstChild,$);$.parentNode.removeChild($)}}else t.calendarContainer.parentNode.removeChild(t.calendarContainer);t.altInput&&(t.input.type="text",t.altInput.parentNode&&t.altInput.parentNode.removeChild(t.altInput),delete t.altInput),t.input&&(t.input.type=t.input._type,t.input.classList.remove("flatpickr-input"),t.input.removeAttribute("readonly")),["_showTimeInput","latestSelectedDateObj","_hideNextMonthArrow","_hidePrevMonthArrow","__hideNextMonthArrow","__hidePrevMonthArrow","isMobile","isOpen","selectedDateElem","minDateHasTime","maxDateHasTime","days","daysContainer","_input","_positionElement","innerContainer","rContainer","monthNav","todayDateElem","calendarContainer","weekdayContainer","prevMonthNav","nextMonthNav","monthsDropdownContainer","currentMonthElement","currentYearElement","navigationCurrentMonth","selectedDateElem","config"].forEach(function(F){try{delete t[F]}catch{}})}function xt(E){return t.calendarContainer.contains(E)}function H(E){if(t.isOpen&&!t.config.inline){var $=Zn(E),F=xt($),j=$===t.input||$===t.altInput||t.element.contains($)||E.path&&E.path.indexOf&&(~E.path.indexOf(t.input)||~E.path.indexOf(t.altInput)),ce=!j&&!F&&!xt(E.relatedTarget),ge=!t.config.ignoredFocusElements.some(function(We){return We.contains($)});ce&&ge&&(t.config.allowInput&&t.setDate(t._input.value,!1,t.config.altInput?t.config.altFormat:t.config.dateFormat),t.timeContainer!==void 0&&t.minuteElement!==void 0&&t.hourElement!==void 0&&t.input.value!==""&&t.input.value!==void 0&&a(),t.close(),t.config&&t.config.mode==="range"&&t.selectedDates.length===1&&t.clear(!1))}}function Pe(E){if(!(!E||t.config.minDate&&E<t.config.minDate.getFullYear()||t.config.maxDate&&E>t.config.maxDate.getFullYear())){var $=E,F=t.currentYear!==$;t.currentYear=$||t.currentYear,t.config.maxDate&&t.currentYear===t.config.maxDate.getFullYear()?t.currentMonth=Math.min(t.config.maxDate.getMonth(),t.currentMonth):t.config.minDate&&t.currentYear===t.config.minDate.getFullYear()&&(t.currentMonth=Math.max(t.config.minDate.getMonth(),t.currentMonth)),F&&(t.redraw(),pt("onYearChange"),J())}}function Ye(E,$){var F;$===void 0&&($=!0);var j=t.parseDate(E,void 0,$);if(t.config.minDate&&j&&Yn(j,t.config.minDate,$!==void 0?$:!t.minDateHasTime)<0||t.config.maxDate&&j&&Yn(j,t.config.maxDate,$!==void 0?$:!t.maxDateHasTime)>0)return!1;if(!t.config.enable&&t.config.disable.length===0)return!0;if(j===void 0)return!1;for(var ce=!!t.config.enable,ge=(F=t.config.enable)!==null&&F!==void 0?F:t.config.disable,We=0,we=void 0;We<ge.length;We++){if(we=ge[We],typeof we=="function"&&we(j))return ce;if(we instanceof Date&&j!==void 0&&we.getTime()===j.getTime())return ce;if(typeof we=="string"){var Ne=t.parseDate(we,void 0,!0);return Ne&&Ne.getTime()===j.getTime()?ce:!ce}else if(typeof we=="object"&&j!==void 0&&we.from&&we.to&&j.getTime()>=we.from.getTime()&&j.getTime()<=we.to.getTime())return ce}return!ce}function Tt(E){return t.daysContainer!==void 0?E.className.indexOf("hidden")===-1&&E.className.indexOf("flatpickr-disabled")===-1&&t.daysContainer.contains(E):!1}function yt(E){var $=E.target===t._input,F=t._input.value.trimEnd()!==yr();$&&F&&!(E.relatedTarget&&xt(E.relatedTarget))&&t.setDate(t._input.value,!0,E.target===t.altInput?t.config.altFormat:t.config.dateFormat)}function wt(E){var $=Zn(E),F=t.config.
Line truncated
|
||||
Upload file
|
||||
|
||||
`),l=y("input"),O(s,"class","spinner-border spinner-border-sm"),O(s,"role","status"),O(s,"aria-hidden","true"),O(l,"class","form-control"),O(l,"type","file"),O(l,"id","formFile"),l.multiple=!0,O(l,"accept",qE),l.disabled=i[0],l.hidden=!0,O(t,"class","button primary btn-spinner"),O(e,"class","upload-button"),e.disabled=i[0]},m(h,f){x(h,e,f),b(e,t),Y(n,t,null),b(t,r),b(t,s),b(t,o),b(t,l),a=!0,c||(u=G(l,"input",i[1]),c=!0)},p(h,[f]){(!a||f&1)&&(l.disabled=h[0]),(!a||f&1)&&(e.disabled=h[0])},i(h){a||(T(n.$$.fragment,h),a=!0)},o(h){R(n.$$.fragment,h),a=!1},d(h){h&&P(e),z(n),c=!1,u()}}}let qE="";function GE(i,e,t){const n=nn(),r=Ue("channel");let{recordId:s}=e,o=[],l=!1;function a(c){t(0,l=!0),o=c.target.files?[...c.target.files]:[];let u=new FormData;u.append("recordId",s),Array.from(o).forEach(function(h){u.append("files[]",h)}),n("beforeUpload",o),fetch(r.lucentUrl+"/files/upload",{method:"POST",body:u,headers:{"X-CSRF-TOKEN":document.querySelector('meta[name="csrf-token"]').content}}).then(h=>h.json()).then(h=>{h.error?n("uploadError",h.error):n("uploadComplete",h),t(0,l=!1)})}return i.$$set=c=>{"recordId"in c&&t(2,s=c.recordId)},[l,a,s]}class jy extends oe{constructor(e){super(),se(this,e,GE,jE,re,{recordId:2})}}function D1(i,e,t){const n=i.slice();return n[11]=e[t],n}function $1(i){let e,t;return e=new Xy({props:{sortableClass:"mt-3",$$slots:{default:[HE]},$$scope:{ctx:i}}}),e.$on("update",i[4]),{c(){V(e.$$.fragment)},m(n,r){Y(e,n,r),t=!0},p(n,r){const s={};r&16385&&(s.$$scope={dirty:r,ctx:n}),e.$set(s)},i(n){t||(T(e.$$.fragment,n),t=!0)},o(n){R(e.$$.fragment,n),t=!1},d(n){z(e,n)}}}function L1(i,e){let t,n,r,s;return n=new Vy({props:{file:e[11],hasDelete:!0}}),n.$on("remove_file",e[3]),{key:i,first:null,c(){t=y("div"),V(n.$$.fragment),r=D(),this.first=t},m(o,l){x(o,t,l),Y(n,t,null),b(t,r),s=!0},p(o,l){e=o;const a={};l&1&&(a.file=e[11]),n.$set(a)},i(o){s||(T(n.$$.fragment,o),s=!0)},o(o){R(n.$$.fragment,o),s=!1},d(o){o&&P(t),z(n)}}}function HE(i){let e=[],t=new Map,n,r,s=fe(i[0]??[]);const o=l=>l[11].id;for(let l=0;l<s.length;l+=1){let a=D1(i,s,l),c=o(a);t.set(c,e[l]=L1(c,a))}return{c(){for(let l=0;l<e.length;l+=1)e[l].c();n=Ie()},m(l,a){for(let c=0;c<e.length;c+=1)e[c]&&e[c].m(l,a);x(l,n,a),r=!0},p(l,a){a&9&&(s=fe(l[0]??[]),Oe(),e=Ti(e,a,o,1,l,s,t,n.parentNode,Jr,L1,n,D1),be())},i(l){if(!r){for(let a=0;a<s.length;a+=1)T(e[a]);r=!0}},o(l){for(let a=0;a<e.length;a+=1)R(e[a]);r=!1},d(l){l&&P(n);for(let a=0;a<e.length;a+=1)e[a].d(l)}}}function KE(i){let e,t,n,r,s,o,l,a,c,u,h,f;n=new ut({props:{icon:"photo-film"}}),o=new jy({props:{recordId:i[1].id}}),o.$on("uploadComplete",i[7]);let d=i[0].length>0&&$1(i),m={};return c=new Uy({props:m}),i[10](c),c.$on("insert_files",i[5]),c.$on("replace_files",i[6]),{c(){e=y("div"),t=y("button"),V(n.$$.fragment),r=W(" Browse"),s=D(),V(o.$$.fragment),l=D(),d&&d.c(),a=D(),V(c.$$.fragment),O(t,"class","button"),O(e,"class","mb-0"),le(e,"display","flex"),le(e,"align-items","start"),le(e,"justify-content","start"),le(e,"gap","6px")},m(p,g){x(p,e,g),b(e,t),Y(n,t,null),b(t,r),b(e,s),Y(o,e,null),x(p,l,g),d&&d.m(p,g),x(p,a,g),Y(c,p,g),u=!0,h||(f=G(t,"click",i[8]),h=!0)},p(p,[g]){const v={};g&2&&(v.recordId=p[1].id),o.$set(v),p[0].length>0?d?(d.p(p,g),g&1&&T(d,1)):(d=$1(p),d.c(),T(d,1),d.m(a.parentNode,a)):d&&(Oe(),R(d,1,1,()=>{d=null}),be());const w={};c.$set(w)},i(p){u||(T(n.$$.fragment,p),T(o.$$.fragment,p),T(d),T(c.$$.fragment,p),u=!0)},o(p){R(n.$$.fragment,p),R(o.$$.fragment,p),R(d),R(c.$$.fragment,p),u=!1},d(p){p&&(P(e),P(l),P(a)),z(n),z(o),d&&d.d(p),i[10](null),z(c,p),h=!1,f()}}}function JE(i,e,t){let{field:n}=e,{record:r}=e,{value:s=[]}=e,o;function l(m){m.preventDefault(),t(0,s=s.filter(p=>p.id!==m.detail))}async function a(m){t(0,s=await Sy(s,m.detail.source,m.detail.target))}function c(m){m.preventDefault(),o.close(),t(0,s=[...s??[],...m.detail.files??[]])}function u(m){m.preventDefault(),o.close(),t(0,s=m.detail??[])}function h(m){t(0,s=[...s,...m.detail])}function f(m){m.preventDefault(),o.open(r.id)}function d(m){Ce[m?"unshift":"push"](()=>{o=m,t(2,o)})}return i.$$set=m=>{"field"in m&&t(9,n=m.field),"record"in m&&t(1,r=m.record),"value"in m&&t(0,s=m.value)},[s,r,o,l,a,c,u,h,f,n,d]}class eR extends oe{constructor(e){super(),se(this,e,JE,KE,re,{field:9,record:1,value:0})}}function I1(i){let e,t;return{c(){e=y("div"),t=W(i[5]),O(e,"class","invalid-feedback d-block")},m(n,r){x(n,e,r),b(e,t)},p(n,r){r&32&&K(t,n[5])},d(n){n&&P(e)}}}function tR(i){let e,t,n,r,s,o,l=i[5]&&I1(i);return{c(){e=y("div"),t=y("textarea"),r=D(),l&&l.c(),O(t,"id",i[3]),O(t,"class","form-control svelte-1er4ovm"),O(t,"rows","2"),t.readOnly=n=i[1].readonly&&!i[2],Ae(t,"is-invalid",i[5]),O(e,"class","mb-0")},m(a,c){x(a,e,c),b(e,t),Le(t,i[0]),i[8](t),b(e,r),l&&l.m(e,null),s||(o=[G(t,"input",i[7]),G(t,"input",kd),G(t,"focus",kd)],s=!0)},p(a,[c]){c&8&&O(t,"id",a[3]),c&6&&n!==(n=a[1].readonly&&!a[2])&&(t.readOnly=n),c&1&&Le(t,a[0]),c&32&&Ae(t,"is-invalid",a[5]),a[5]?l?l.p(a,c):(l=I1(a),l.c(),l.m(e,null)):l
Line truncated
|
||||
`},xs={bold:{tagName:"strong",inheritable:!0,parser(i){const e=window.getComputedStyle(i);return e.fontWeight==="bold"||e.fontWeight>=600}},italic:{tagName:"em",inheritable:!0,parser:i=>window.getComputedStyle(i).fontStyle==="italic"},href:{groupTagName:"a",parser(i){const e="a:not(".concat(_s,")"),t=i.closest(e);if(t)return t.getAttribute("href")}},strike:{tagName:"del",inheritable:!0},frozen:{style:{backgroundColor:"highlight"}}},ik={getDefaultHTML:()=>`<div class="trix-button-row">
|
||||
<span class="trix-button-group trix-button-group--text-tools" data-trix-button-group="text-tools">
|
||||
<button type="button" class="trix-button trix-button--icon trix-button--icon-bold" data-trix-attribute="bold" data-trix-key="b" title="`.concat(Ve.bold,'" tabindex="-1">').concat(Ve.bold,`</button>
|
||||
<button type="button" class="trix-button trix-button--icon trix-button--icon-italic" data-trix-attribute="italic" data-trix-key="i" title="`).concat(Ve.italic,'" tabindex="-1">').concat(Ve.italic,`</button>
|
||||
<button type="button" class="trix-button trix-button--icon trix-button--icon-strike" data-trix-attribute="strike" title="`).concat(Ve.strike,'" tabindex="-1">').concat(Ve.strike,`</button>
|
||||
<button type="button" class="trix-button trix-button--icon trix-button--icon-link" data-trix-attribute="href" data-trix-action="link" data-trix-key="k" title="`).concat(Ve.link,'" tabindex="-1">').concat(Ve.link,`</button>
|
||||
</span>
|
||||
|
||||
<span class="trix-button-group trix-button-group--block-tools" data-trix-button-group="block-tools">
|
||||
<button type="button" class="trix-button trix-button--icon trix-button--icon-heading-1" data-trix-attribute="heading1" title="`).concat(Ve.heading1,'" tabindex="-1">').concat(Ve.heading1,`</button>
|
||||
<button type="button" class="trix-button trix-button--icon trix-button--icon-quote" data-trix-attribute="quote" title="`).concat(Ve.quote,'" tabindex="-1">').concat(Ve.quote,`</button>
|
||||
<button type="button" class="trix-button trix-button--icon trix-button--icon-code" data-trix-attribute="code" title="`).concat(Ve.code,'" tabindex="-1">').concat(Ve.code,`</button>
|
||||
<button type="button" class="trix-button trix-button--icon trix-button--icon-bullet-list" data-trix-attribute="bullet" title="`).concat(Ve.bullets,'" tabindex="-1">').concat(Ve.bullets,`</button>
|
||||
<button type="button" class="trix-button trix-button--icon trix-button--icon-number-list" data-trix-attribute="number" title="`).concat(Ve.numbers,'" tabindex="-1">').concat(Ve.numbers,`</button>
|
||||
<button type="button" class="trix-button trix-button--icon trix-button--icon-decrease-nesting-level" data-trix-action="decreaseNestingLevel" title="`).concat(Ve.outdent,'" tabindex="-1">').concat(Ve.outdent,`</button>
|
||||
<button type="button" class="trix-button trix-button--icon trix-button--icon-increase-nesting-level" data-trix-action="increaseNestingLevel" title="`).concat(Ve.indent,'" tabindex="-1">').concat(Ve.indent,`</button>
|
||||
</span>
|
||||
|
||||
<span class="trix-button-group trix-button-group--file-tools" data-trix-button-group="file-tools">
|
||||
<button type="button" class="trix-button trix-button--icon trix-button--icon-attach" data-trix-action="attachFiles" title="`).concat(Ve.attachFiles,'" tabindex="-1">').concat(Ve.attachFiles,`</button>
|
||||
</span>
|
||||
|
||||
<span class="trix-button-group-spacer"></span>
|
||||
|
||||
<span class="trix-button-group trix-button-group--history-tools" data-trix-button-group="history-tools">
|
||||
<button type="button" class="trix-button trix-button--icon trix-button--icon-undo" data-trix-action="undo" data-trix-key="z" title="`).concat(Ve.undo,'" tabindex="-1">').concat(Ve.undo,`</button>
|
||||
<button type="button" class="trix-button trix-button--icon trix-button--icon-redo" data-trix-action="redo" data-trix-key="shift+z" title="`).concat(Ve.redo,'" tabindex="-1">').concat(Ve.redo,`</button>
|
||||
</span>
|
||||
</div>
|
||||
|
||||
<div class="trix-dialogs" data-trix-dialogs>
|
||||
<div class="trix-dialog trix-dialog--link" data-trix-dialog="href" data-trix-dialog-attribute="href">
|
||||
<div class="trix-dialog__link-fields">
|
||||
<input type="url" name="href" class="trix-input trix-input--dialog" placeholder="`).concat(Ve.urlPlaceholder,'" aria-label="').concat(Ve.url,`" data-trix-validate-href required data-trix-input>
|
||||
<div class="trix-button-group">
|
||||
<input type="button" class="trix-button trix-button--dialog" value="`).concat(Ve.link,`" data-trix-method="setAttribute">
|
||||
<input type="button" class="trix-button trix-button--dialog" value="`).concat(Ve.unlink,`" data-trix-method="removeAttribute">
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>`)};const Sd={interval:5e3};var $a=Object.freeze({__proto__:null,attachments:jm,blockAttributes:Sn,browser:Da,css:{attachment:"attachment",attachmentCaption:"attachment__caption",attachmentCaptionEditor:"attachment__caption-editor",attachmentMetadata:"attachment__metadata",attachmentMetadataContainer:"attachment__metadata-container",attachmentName:"attachment__name",attachmentProgress:"attachment__progress",attachmentSize:"attachment__size",attachmentToolbar:"attachment__toolbar",attachmentGallery:"attachment-gallery"},dompurify:Hy,fileSize:Ky,input:Hm,keyNames:{8:"backspace",9:"tab",13:"return",27:"escape",37:"left",39:"right",46:"delete",68:"d",72:"h",79:"o"},lang:Ve,parser:Fc,textAttributes:xs,toolbar:ik,undo:Sd});class Kt{static proxyMethod(e){const{name:t,toMethod:n,toProperty:r,optional:s}=dR(e);this.prototype[t]=function(){let o,l;var a,c;return n?l=s?(a=this[n])===null||a===void 0?void 0:a.call(this):this[n]():r&&(l=this[r]),s?(o=(c=l)===null||c===void 0?void 0:c[t],o?W1.call(o,l,arguments):void 0):(o=l[t],W1.call(o,l,arguments))}}}const dR=function(i){const e=i.match(mR);if(!e)throw new Error("can't parse @proxyMethod expression: ".concat(i));const t={name:e[4]};return e[2]!=null?t.toMethod=e[1]:t.toProperty=e[1],e[3]!=null&&(t.optional=!0),t},{apply:W1}=Function.prototype,mR=new RegExp("^(.+?)(\\(\\))?(\\?)?\\.(.+?)$");var ef,tf,nf;class sa extends Kt{static box(){let e=arguments.length>0&&arguments[0]!==void 0?arguments[0]:"";return e instanceof this?e:this.fromUCS2String(e==null?void 0:e.toString())}static fromUCS2String(e){return new this(e,_d(e))}static fromCodepoints(e){return new this(Cd(e),e)}constructor(e,t){super(...arguments),this.ucs2String=e,this.codepoints=t,this.length=this.codepoints.length,this.ucs2Length=this.ucs2String.length}offsetToUCS2Offset(e){return Cd(this.codepoints.slice(0,Math.max(0,e))).length}offsetFromUCS2Offset(e){return _d(this.ucs2String.slice(0,Math.max(0,e))).length}slice(){return this.constructor.fromCodepoints(this.codepoints.slice(...arguments))}charAt(e){return this.slice(e,e+1)}isEqualTo(e){return this.constructor.box(e).ucs2String===this.ucs2String}toJSON(){return this.ucs2String}getCacheKey(){return this.ucs2String}toString(){return this.ucs2String}}const pR=((ef=Array.from)===null||ef===void 0?void 0:ef.call(Array,"👼").length)===1,gR=((tf=" ".codePointAt)===null||tf===void 0?void 0:tf.call(" ",0))!=null,OR=((nf=String.fromCodePoint)===null||nf===void 0?void 0:nf.call(String,32,128124))===" 👼";let _d,Cd;_d=pR&&gR?i=>Array.from(i).map(e=>e.codePointAt(0)):function(i){const e=[];let t=0;const{length:n}=i;for(;t<n;){let r=i.charCodeAt(t++);if(55296<=r&&r<=56319&&t<n){const s=i.charCodeAt(t++);(64512&s)==56320?r=((1023&r)<<10)+(1023&s)+65536:t--}e.push(r)}return e},Cd=OR?i=>String.fromCodePoint(...Array.from(i||[])):function(i){return(()=>{const e=[];return Array.from(i).forEach(t=>{let n="";t>65535&&(t-=65536,n+=String.fromCharCode(t>>>10&1023|55296),t=56320|1023&t),e.push(n+String.fromCharCode(t))}),e})().join("")};let bR=0;class Ns extends Kt{static fromJSONString(e){return this.fromJSON(JSON.parse(e))}constructor(){super(...arguments),this.id=++bR}hasSameConstructorAs(e){return this.constructor===(e==null?void 0:e.constructor)}isEqualTo(e){return this===e}inspect(){const e=[],t=this.contentsForInspection()||{};for(const n in t){const r=t[n];e.push("".concat(n,"=").concat(r))}return"#<".concat(this.constructor.name,":").concat(this.id).concat(e.length?" ".concat(e.join(", ")):"",">")}contentsForInspection(){}toJSONString(){return JSON.stringify(this)}toUTF16String(){return sa.box(this)}getCacheKey(){return this.id.toString()}}const Ts=function(){let i=arguments.length>0&&arguments[0]!==void 0?arguments[0]:[],e=arguments.length>1&&arguments[1]!==void 0?arguments[1]:[];if(i.length!==e.length)return!1;for(let t=0;t<i.length;t++)if(i[t]!==e[t])return!1;return!0},Km=function(i){const e=i.slice(0);for(var t=arguments.length,n=new Array(t>1?t-1:0),r=1;r<t;r++)n[r-1]=arguments[r];return e.splice(...n),e},vR=/[\u05BE\u05C0\u05C3\u05D0-\u05EA\u05F0-\u05F4\u061B\u061F\u0621-\u063A\u0640-\u064A\u066D\u0671-\u06B7\u06BA-\u06BE\u06C0-\u06CE\u06D0-\u06D5\u06E5\u06E6\u200F\u202B\u202E\uFB1F-\uFB28\uFB2A-\uFB36\uFB38-\uFB3C\uFB3E\uFB40\uFB41\uFB43\uFB44\uFB46-\uFBB1\uFBD3-\uFD3D\uFD50-\uFD8F\uFD92-\uFDC7\uFDF0-\uFDFB\uFE70-\uFE72\uFE74\uFE76-\uFEFC]/,wR=function(){const i=Ge("input",{dir:"auto",name:"x",dirName:"x.dir"}),e=Ge("textarea",{dir:"auto",name:"y",dirName:"y.dir"}),t=Ge("form");t.appendChild(i),t.appendChild(e);const n=function(){try{return new FormData(t).has(e.dirName)}catch{return!1}}(),r=function(){try{return i.matches(":dir(ltr),:dir(rtl)")}catch{return!1}}();return n?function(s){return e.value=s,new FormData(t).get(e.dirName)}:r?function(s){return i.value=s,i.matches(":dir(rtl)")?"rtl":"ltr"}:function(s){const o=s.trim().charAt(0);return vR.test(o)?"rtl":"ltr"}}();let rf=null,sf=null,of=null,rc=null;const Pd=()=>(rf||(rf=kR().concat(yR())),rLine truncated
|
||||
`+Sr),He&&sc([J,te,ie],bi=>{Sr=ol(Sr,bi," ")}),k&&Ri?k.createHTML(Sr):Sr},t.setConfig=function(){ce(arguments.length>0&&arguments[0]!==void 0?arguments[0]:{}),qe=!0},t.clearConfig=function(){$=null,qe=!1},t.isValidAttribute=function(Z,_e,me){$||ce({});const Ke=E(Z),ot=E(_e);return tr(Ke,ot,me)},t.addHook=function(Z,_e){typeof _e=="function"&&sl(B[Z],_e)},t.removeHook=function(Z,_e){if(_e!==void 0){const me=$R(B[Z],_e);return me===-1?void 0:LR(B[Z],me,1)[0]}return q1(B[Z])},t.removeHooks=function(Z){B[Z]=[]},t.removeAllHooks=function(){B={afterSanitizeAttributes:[],afterSanitizeElements:[],afterSanitizeShadowDOM:[],beforeSanitizeAttributes:[],beforeSanitizeElements:[],beforeSanitizeShadowDOM:[],uponSanitizeAttribute:[],uponSanitizeElement:[],uponSanitizeShadowNode:[]}},t}();Ao.addHook("uponSanitizeAttribute",function(i,e){if(e.attrName==="data-trix-serialized-attributes")return void(e.keepAttr=!1);/^data-trix-/.test(e.attrName)&&(e.forceKeepAttr=!0)});const n4="style href src width height language class".split(" "),i4="javascript:".split(" "),r4="script iframe form noscript".split(" ");class lh extends Kt{static setHTML(e,t,n){const r=new this(t,n).sanitize(),s=r.getHTML?r.getHTML():r.outerHTML;e.innerHTML=s}static sanitize(e,t){const n=new this(e,t);return n.sanitize(),n}constructor(e){let{allowedAttributes:t,forbiddenProtocols:n,forbiddenElements:r,purifyOptions:s}=arguments.length>1&&arguments[1]!==void 0?arguments[1]:{};super(...arguments),this.allowedAttributes=t||n4,this.forbiddenProtocols=n||i4,this.forbiddenElements=r||r4,this.purifyOptions=s||{},this.body=s4(e)}sanitize(){this.sanitizeElements(),this.normalizeListElementNesting();const e=Object.assign({},Hy,this.purifyOptions);return Ao.setConfig(e),this.body=Ao.sanitize(this.body),this.body}getHTML(){return this.body.innerHTML}getBody(){return this.body}sanitizeElements(){const e=vu(this.body),t=[];for(;e.nextNode();){const n=e.currentNode;switch(n.nodeType){case Node.ELEMENT_NODE:this.elementIsRemovable(n)?t.push(n):this.sanitizeElement(n);break;case Node.COMMENT_NODE:t.push(n)}}return t.forEach(n=>zr(n)),this.body}sanitizeElement(e){return e.hasAttribute("href")&&this.forbiddenProtocols.includes(e.protocol)&&e.removeAttribute("href"),Array.from(e.attributes).forEach(t=>{let{name:n}=t;this.allowedAttributes.includes(n)||n.indexOf("data-trix")===0||e.removeAttribute(n)}),e}normalizeListElementNesting(){return Array.from(this.body.querySelectorAll("ul,ol")).forEach(e=>{const t=e.previousElementSibling;t&&kn(t)==="li"&&t.appendChild(e)}),this.body}elementIsRemovable(e){if((e==null?void 0:e.nodeType)===Node.ELEMENT_NODE)return this.elementIsForbidden(e)||this.elementIsntSerializable(e)}elementIsForbidden(e){return this.forbiddenElements.includes(kn(e))}elementIsntSerializable(e){return e.getAttribute("data-trix-serialize")==="false"&&!Cs(e)}}const s4=function(){let i=arguments.length>0&&arguments[0]!==void 0?arguments[0]:"";i=i.replace(/<\/html[^>]*>[^]*$/i,"</html>");const e=document.implementation.createHTMLDocument("");return e.documentElement.innerHTML=i,Array.from(e.head.querySelectorAll("style")).forEach(t=>{e.body.appendChild(t)}),e.body},{css:Cr}=$a;class ip extends Zs{constructor(){super(...arguments),this.attachment=this.object,this.attachment.uploadProgressDelegate=this,this.attachmentPiece=this.options.piece}createContentNodes(){return[]}createNodes(){let e;const t=e=Ge({tagName:"figure",className:this.getClassName(),data:this.getData(),editable:!1}),n=this.getHref();return n&&(e=Ge({tagName:"a",editable:!1,attributes:{href:n,tabindex:-1}}),t.appendChild(e)),this.attachment.hasContent()?lh.setHTML(e,this.attachment.getContent()):this.createContentNodes().forEach(r=>{e.appendChild(r)}),e.appendChild(this.createCaptionElement()),this.attachment.isPending()&&(this.progressElement=Ge({tagName:"progress",attributes:{class:Cr.attachmentProgress,value:this.attachment.getUploadProgress(),max:100},data:{trixMutable:!0,trixStoreKey:["progressElement",this.attachment.id].join("/")}}),t.appendChild(this.progressElement)),[n0("left"),t,n0("right")]}createCaptionElement(){const e=Ge({tagName:"figcaption",className:Cr.attachmentCaption}),t=this.attachmentPiece.getCaption();if(t)e.classList.add("".concat(Cr.attachmentCaption,"--edited")),e.textContent=t;else{let n,r;const s=this.getCaptionConfig();if(s.name&&(n=this.attachment.getFilename()),s.size&&(r=this.attachment.getFormattedFilesize()),n){const o=Ge({tagName:"span",className:Cr.attachmentName,textContent:n});e.appendChild(o)}if(r){n&&e.appendChild(document.createTextNode(" "));const o=Ge({tagName:"span",className:Cr.attachmentSize,textContent:r});e.appendChild(o)}}return e}getClassName(){const e=[Cr.attachment,"".concat(Cr.attachment,"--").concat(this.attachment.getType())],t=this.attachment.getExtension();return t&&e.push("".concat(Cr.attachment,"--").concat(t)),e.join(" ")}getData(){const e={trixAttachment:JSON.stringify(this.attachment),trixContentType:this.attachment.getContentType(),trixId:thi
Line truncated
|
||||
`);for(let r=0;r<n.length;r++){const s=n[r];if(r>0){const o=Ge("br");t.push(o)}if(s.length){const o=document.createTextNode(this.preserveSpaces(s));t.push(o)}}return t}}createElement(){let e,t,n;const r={};for(t in this.attributes){n=this.attributes[t];const o=Ad(t);if(o){if(o.tagName){var s;const l=Ge(o.tagName);s?(s.appendChild(l),s=l):e=s=l}if(o.styleProperty&&(r[o.styleProperty]=n),o.style)for(t in o.style)n=o.style[t],r[t]=n}}if(Object.keys(r).length)for(t in e||(e=Ge("span")),r)n=r[t],e.style[t]=n;return e}createContainerElement(){for(const e in this.attributes){const t=this.attributes[e],n=Ad(e);if(n&&n.groupTagName){const r={};return r[e]=t,Ge(n.groupTagName,r)}}}preserveSpaces(e){return this.context.isLast&&(e=e.replace(/\ $/,Rr)),e=e.replace(/(\S)\ {3}(\S)/g,"$1 ".concat(Rr," $2")).replace(/\ {2}/g,"".concat(Rr," ")).replace(/\ {2}/g," ".concat(Rr)),(this.context.isFirst||this.context.followsWhitespace)&&(e=e.replace(/^\ /,Rr)),e}}class Ok extends Zs{constructor(){super(...arguments),this.text=this.object,this.textConfig=this.options.textConfig}createNodes(){const e=[],t=np.groupObjects(this.getPieces()),n=t.length-1;for(let s=0;s<t.length;s++){const o=t[s],l={};s===0&&(l.isFirst=!0),s===n&&(l.isLast=!0),l4(r)&&(l.followsWhitespace=!0);const a=this.findOrCreateCachedChildView(gk,o,{textConfig:this.textConfig,context:l});e.push(...Array.from(a.getNodes()||[]));var r=o}return e}getPieces(){return Array.from(this.text.getPieces()).filter(e=>!e.hasAttribute("blockBreak"))}}const l4=i=>/\s$/.test(i==null?void 0:i.toString()),{css:i0}=$a;class bk extends Zs{constructor(){super(...arguments),this.block=this.object,this.attributes=this.block.getAttributes()}createNodes(){const e=[document.createComment("block")];if(this.block.isEmpty())e.push(Ge("br"));else{var t;const n=(t=zt(this.block.getLastAttribute()))===null||t===void 0?void 0:t.text,r=this.findOrCreateCachedChildView(Ok,this.block.text,{textConfig:n});e.push(...Array.from(r.getNodes()||[])),this.shouldAddExtraNewlineElement()&&e.push(Ge("br"))}if(this.attributes.length)return e;{let n;const{tagName:r}=Sn.default;this.block.isRTL()&&(n={dir:"rtl"});const s=Ge({tagName:r,attributes:n});return e.forEach(o=>s.appendChild(o)),[s]}}createContainerElement(e){const t={};let n;const r=this.attributes[e],{tagName:s,htmlAttributes:o=[]}=zt(r);if(e===0&&this.block.isRTL()&&Object.assign(t,{dir:"rtl"}),r==="attachmentGallery"){const l=this.block.getBlockBreakPosition();n="".concat(i0.attachmentGallery," ").concat(i0.attachmentGallery,"--").concat(l)}return Object.entries(this.block.htmlAttributes).forEach(l=>{let[a,c]=l;o.includes(a)&&(t[a]=c)}),Ge({tagName:s,className:n,attributes:t})}shouldAddExtraNewlineElement(){return/\n\n$/.test(this.block.toString())}}class ah extends Zs{static render(e){const t=Ge("div"),n=new this(e,{element:t});return n.render(),n.sync(),t}constructor(){super(...arguments),this.element=this.options.element,this.elementStore=new QR,this.setDocument(this.object)}setDocument(e){e.isEqualTo(this.document)||(this.document=this.object=e)}render(){if(this.childViews=[],this.shadowElement=Ge("div"),!this.document.isEmpty()){const e=np.groupObjects(this.document.getBlocks(),{asTree:!0});Array.from(e).forEach(t=>{const n=this.findOrCreateCachedChildView(bk,t);Array.from(n.getNodes()).map(r=>this.shadowElement.appendChild(r))})}}isSynced(){return a4(this.shadowElement,this.element)}sync(){const e=ek("trix-before-render",{cancelable:!1,attributes:{render:(n,r)=>{for(;n.lastChild;)n.removeChild(n.lastChild);n.appendChild(r)}}});this.element.dispatchEvent(e);const t=this.createDocumentFragmentForSync();return e.render(this.element,t),this.didSync()}didSync(){return this.elementStore.reset(r0(this.element)),Jm(()=>this.garbageCollectCachedViews())}createDocumentFragmentForSync(){const e=document.createDocumentFragment();return Array.from(this.shadowElement.childNodes).forEach(t=>{e.appendChild(t.cloneNode(!0))}),Array.from(r0(e)).forEach(t=>{const n=this.elementStore.remove(t);n&&t.parentNode.replaceChild(n,t)}),e}}const r0=i=>i.querySelectorAll("[data-trix-store-key]"),a4=(i,e)=>s0(i.innerHTML)===s0(e.innerHTML),s0=i=>i.replace(/ /g," ");function c4(i){var e=function(t,n){if(typeof t!="object"||!t)return t;var r=t[Symbol.toPrimitive];if(r!==void 0){var s=r.call(t,n);if(typeof s!="object")return s;throw new TypeError("@@toPrimitive must return a primitive value.")}return(n==="string"?String:Number)(t)}(i,"string");return typeof e=="symbol"?e:String(e)}function gn(i,e,t){return(e=c4(e))in i?Object.defineProperty(i,e,{value:t,enumerable:!0,configurable:!0,writable:!0}):i[e]=t,i}function it(i,e){return u4(i,vk(i,e,"get"))}function Wl(i,e,t){return h4(i,vk(i,e,"set"),t),t}function vk(i,e,t){if(!e.has(i))throw new TypeError("attempted to "+t+" private field on non-instance");return e.get(i)}function u4(i,e){return e.get?e.get.call(i):e.value}function h4(i,e,t){if(e.set)e.set.call(i,t);else{if(!e.writable)throw new TypeError("attempted to set read
Line truncated
|
||||
`))(e),this.length=this.string.length}getValue(){return this.string}toString(){return this.string.toString()}isBlockBreak(){return this.toString()===`
|
||||
`&&this.getAttribute("blockBreak")===!0}toJSON(){const e=super.toJSON(...arguments);return e.string=this.string,e}canBeConsolidatedWith(e){return e&&this.hasSameConstructorAs(e)&&this.hasSameAttributesAsPiece(e)}consolidateWith(e){return new this.constructor(this.toString()+e.toString(),this.attributes)}splitAtOffset(e){let t,n;return e===0?(t=null,n=this):e===this.length?(t=this,n=null):(t=new this.constructor(this.string.slice(0,e),this.attributes),n=new this.constructor(this.string.slice(e),this.attributes)),[t,n]}toConsole(){let{string:e}=this;return e.length>15&&(e=e.slice(0,14)+"…"),JSON.stringify(e.toString())}}Bs.registerType("string",rp);class ku extends Ns{static box(e){return e instanceof this?e:new this(e)}constructor(){let e=arguments.length>0&&arguments[0]!==void 0?arguments[0]:[];super(...arguments),this.objects=e.slice(0),this.length=this.objects.length}indexOf(e){return this.objects.indexOf(e)}splice(){for(var e=arguments.length,t=new Array(e),n=0;n<e;n++)t[n]=arguments[n];return new this.constructor(Km(this.objects,...t))}eachObject(e){return this.objects.map((t,n)=>e(t,n))}insertObjectAtIndex(e,t){return this.splice(t,0,e)}insertSplittableListAtIndex(e,t){return this.splice(t,0,...e.objects)}insertSplittableListAtPosition(e,t){const[n,r]=this.splitObjectAtPosition(t);return new this.constructor(n).insertSplittableListAtIndex(e,r)}editObjectAtIndex(e,t){return this.replaceObjectAtIndex(t(this.objects[e]),e)}replaceObjectAtIndex(e,t){return this.splice(t,1,e)}removeObjectAtIndex(e){return this.splice(e,1)}getObjectAtIndex(e){return this.objects[e]}getSplittableListInRange(e){const[t,n,r]=this.splitObjectsAtRange(e);return new this.constructor(t.slice(n,r+1))}selectSplittableList(e){const t=this.objects.filter(n=>e(n));return new this.constructor(t)}removeObjectsInRange(e){const[t,n,r]=this.splitObjectsAtRange(e);return new this.constructor(t).splice(n,r-n+1)}transformObjectsInRange(e,t){const[n,r,s]=this.splitObjectsAtRange(e),o=n.map((l,a)=>r<=a&&a<=s?t(l):l);return new this.constructor(o)}splitObjectsAtRange(e){let t,[n,r,s]=this.splitObjectAtPosition(d4(e));return[n,t]=new this.constructor(n).splitObjectAtPosition(m4(e)+s),[n,r,t-1]}getObjectAtPosition(e){const{index:t}=this.findIndexAndOffsetAtPosition(e);return this.objects[t]}splitObjectAtPosition(e){let t,n;const{index:r,offset:s}=this.findIndexAndOffsetAtPosition(e),o=this.objects.slice(0);if(r!=null)if(s===0)t=r,n=0;else{const l=this.getObjectAtIndex(r),[a,c]=l.splitAtOffset(s);o.splice(r,1,a,c),t=r+1,n=a.getLength()-s}else t=o.length,n=0;return[o,t,n]}consolidate(){const e=[];let t=this.objects[0];return this.objects.slice(1).forEach(n=>{var r,s;(r=(s=t).canBeConsolidatedWith)!==null&&r!==void 0&&r.call(s,n)?t=t.consolidateWith(n):(e.push(t),t=n)}),t&&e.push(t),new this.constructor(e)}consolidateFromIndexToIndex(e,t){const n=this.objects.slice(0).slice(e,t+1),r=new this.constructor(n).consolidate().toArray();return this.splice(e,n.length,...r)}findIndexAndOffsetAtPosition(e){let t,n=0;for(t=0;t<this.objects.length;t++){const r=n+this.objects[t].getLength();if(n<=e&&e<r)return{index:t,offset:e-n};n=r}return{index:null,offset:null}}findPositionAtIndexAndOffset(e,t){let n=0;for(let r=0;r<this.objects.length;r++){const s=this.objects[r];if(r<e)n+=s.getLength();else if(r===e){n+=t;break}}return n}getEndPosition(){return this.endPosition==null&&(this.endPosition=0,this.objects.forEach(e=>this.endPosition+=e.getLength())),this.endPosition}toString(){return this.objects.join("")}toArray(){return this.objects.slice(0)}toJSON(){return this.toArray()}isEqualTo(e){return super.isEqualTo(...arguments)||f4(this.objects,e==null?void 0:e.objects)}contentsForInspection(){return{objects:"[".concat(this.objects.map(e=>e.inspect()).join(", "),"]")}}}const f4=function(i){let e=arguments.length>1&&arguments[1]!==void 0?arguments[1]:[];if(i.length!==e.length)return!1;let t=!0;for(let n=0;n<i.length;n++){const r=i[n];t&&!r.isEqualTo(e[n])&&(t=!1)}return t},d4=i=>i[0],m4=i=>i[1];class Si extends Ns{static textForAttachmentWithAttributes(e,t){return new this([new xo(e,t)])}static textForStringWithAttributes(e,t){return new this([new rp(e,t)])}static fromJSON(e){return new this(Array.from(e).map(t=>Bs.fromJSON(t)))}constructor(){let e=arguments.length>0&&arguments[0]!==void 0?arguments[0]:[];super(...arguments);const t=e.filter(n=>!n.isEmpty());this.pieceList=new ku(t)}copy(){return this.copyWithPieceList(this.pieceList)}copyWithPieceList(e){return new this.constructor(e.consolidate().toArray())}copyUsingObjectMap(e){const t=this.getPieces().map(n=>e.find(n)||n);return new this.constructor(t)}appendText(e){return this.insertTextAtPosition(e,this.getLength())}insertTextAtPosition(e,t){return this.copyWithPieceList(this.pieceList.insertSplittableListAtPosition(e.pieceList,t))}removeTextAtRange(e){return this.copyWithPieceList(this.pieceList.removeObjectsInRange(e))}replaceTextAtRange(e,t){return this.removeTextAtRange(t).insertTextAtPosition(e,t[0])}moveTe
Line truncated
|
||||
`,t);break;case"backward":r=n.slice(0,t).lastIndexOf(`
|
||||
`)}if(r!==-1)return r}contentsForInspection(){return{text:this.text.inspect(),attributes:this.attributes}}toString(){return this.text.toString()}toJSON(){return{text:this.text,attributes:this.attributes,htmlAttributes:this.htmlAttributes}}getDirection(){return this.text.getDirection()}isRTL(){return this.text.isRTL()}getLength(){return this.text.getLength()}canBeConsolidatedWith(e){return!this.hasAttributes()&&!e.hasAttributes()&&this.getDirection()===e.getDirection()}consolidateWith(e){const t=Si.textForStringWithAttributes(`
|
||||
`),n=this.getTextWithoutBlockBreak().appendText(t);return this.copyWithText(n.appendText(e.text))}splitAtOffset(e){let t,n;return e===0?(t=null,n=this):e===this.getLength()?(t=this,n=null):(t=this.copyWithText(this.text.getTextAtRange([0,e])),n=this.copyWithText(this.text.getTextAtRange([e,this.getLength()]))),[t,n]}getBlockBreakPosition(){return this.text.getLength()-1}getTextWithoutBlockBreak(){return kk(this.text)?this.text.getTextAtRange([0,this.getBlockBreakPosition()]):this.text.copy()}canBeGrouped(e){return this.attributes[e]}canBeGroupedWith(e,t){const n=e.getAttributes(),r=n[t],s=this.attributes[t];return s===r&&!(zt(s).group===!1&&!(()=>{if(!rc){rc=[];for(const o in Sn){const{listAttribute:l}=Sn[o];l!=null&&rc.push(l)}}return rc})().includes(n[t+1]))&&(this.getDirection()===e.getDirection()||e.isEmpty())}}const p4=function(i){return i=g4(i),i=b4(i)},g4=function(i){let e=!1;const t=i.getPieces();let n=t.slice(0,t.length-1);const r=t[t.length-1];return r?(n=n.map(s=>s.isBlockBreak()?(e=!0,v4(s)):s),e?new Si([...n,r]):i):i},O4=Si.textForStringWithAttributes(`
|
||||
`,{blockBreak:!0}),b4=function(i){return kk(i)?i:i.appendText(O4)},kk=function(i){const e=i.getLength();return e===0?!1:i.getTextAtRange([e-1,e]).isBlockBreak()},v4=i=>i.copyWithoutAttribute("blockBreak"),o0=function(i){const{listAttribute:e}=zt(i);return e?[e,i]:[i]},l0=i=>i.slice(-1)[0],a0=function(i,e){const t=i.lastIndexOf(e);return t===-1?i:Km(i,t,1)};class si extends Ns{static fromJSON(e){return new this(Array.from(e).map(t=>Xi.fromJSON(t)))}static fromString(e,t){const n=Si.textForStringWithAttributes(e,t);return new this([new Xi(n)])}constructor(){let e=arguments.length>0&&arguments[0]!==void 0?arguments[0]:[];super(...arguments),e.length===0&&(e=[new Xi]),this.blockList=ku.box(e)}isEmpty(){const e=this.getBlockAtIndex(0);return this.blockList.length===1&&e.isEmpty()&&!e.hasAttributes()}copy(){const e=(arguments.length>0&&arguments[0]!==void 0?arguments[0]:{}).consolidateBlocks?this.blockList.consolidate().toArray():this.blockList.toArray();return new this.constructor(e)}copyUsingObjectsFromDocument(e){const t=new TR(e.getObjects());return this.copyUsingObjectMap(t)}copyUsingObjectMap(e){const t=this.getBlocks().map(n=>e.find(n)||n.copyUsingObjectMap(e));return new this.constructor(t)}copyWithBaseBlockAttributes(){let e=arguments.length>0&&arguments[0]!==void 0?arguments[0]:[];const t=this.getBlocks().map(n=>{const r=e.concat(n.getAttributes());return n.copyWithAttributes(r)});return new this.constructor(t)}replaceBlock(e,t){const n=this.blockList.indexOf(e);return n===-1?this:new this.constructor(this.blockList.replaceObjectAtIndex(t,n))}insertDocumentAtRange(e,t){const{blockList:n}=e;t=bt(t);let[r]=t;const{index:s,offset:o}=this.locationFromPosition(r);let l=this;const a=this.getBlockAtPosition(r);return or(t)&&a.isEmpty()&&!a.hasAttributes()?l=new this.constructor(l.blockList.removeObjectAtIndex(s)):a.getBlockBreakPosition()===o&&r++,l=l.removeTextAtRange(t),new this.constructor(l.blockList.insertSplittableListAtPosition(n,r))}mergeDocumentAtRange(e,t){let n,r;t=bt(t);const[s]=t,o=this.locationFromPosition(s),l=this.getBlockAtIndex(o.index).getAttributes(),a=e.getBaseBlockAttributes(),c=l.slice(-a.length);if(Ts(a,c)){const f=l.slice(0,-a.length);n=e.copyWithBaseBlockAttributes(f)}else n=e.copy({consolidateBlocks:!0}).copyWithBaseBlockAttributes(l);const u=n.getBlockCount(),h=n.getBlockAtIndex(0);if(Ts(l,h.getAttributes())){const f=h.getTextWithoutBlockBreak();if(r=this.insertTextAtRange(f,t),u>1){n=new this.constructor(n.getBlocks().slice(1));const d=s+f.getLength();r=r.insertDocumentAtRange(n,d)}}else r=this.insertDocumentAtRange(n,t);return r}insertTextAtRange(e,t){t=bt(t);const[n]=t,{index:r,offset:s}=this.locationFromPosition(n),o=this.removeTextAtRange(t);return new this.constructor(o.blockList.editObjectAtIndex(r,l=>l.copyWithText(l.text.insertTextAtPosition(e,s))))}removeTextAtRange(e){let t;e=bt(e);const[n,r]=e;if(or(e))return this;const[s,o]=Array.from(this.locationRangeFromRange(e)),l=s.index,a=s.offset,c=this.getBlockAtIndex(l),u=o.index,h=o.offset,f=this.getBlockAtIndex(u);if(r-n==1&&c.getBlockBreakPosition()===a&&f.getBlockBreakPosition()!==h&&f.text.getStringAtPosition(h)===`
|
||||
`)t=this.blockList.editObjectAtIndex(u,d=>d.copyWithText(d.text.removeTextAtRange([h,h+1])));else{let d;const m=c.text.getTextAtRange([0,a]),p=f.text.getTextAtRange([h,f.getLength()]),g=m.appendText(p);d=l!==u&&a===0&&c.getAttributeLevel()>=f.getAttributeLevel()?f.copyWithText(g):c.copyWithText(g);const v=u+1-l;t=this.blockList.splice(l,v,d)}return new this.constructor(t)}moveTextFromRangeToPosition(e,t){let n;e=bt(e);const[r,s]=e;if(r<=t&&t<=s)return this;let o=this.getDocumentAtRange(e),l=this.removeTextAtRange(e);const a=r<t;a&&(t-=o.getLength());const[c,...u]=o.getBlocks();return u.length===0?(n=c.getTextWithoutBlockBreak(),a&&(t+=1)):n=c.text,l=l.insertTextAtRange(n,t),u.length===0?l:(o=new this.constructor(u),t+=n.getLength(),l.insertDocumentAtRange(o,t))}addAttributeAtRange(e,t,n){let{blockList:r}=this;return this.eachBlockAtRange(n,(s,o,l)=>r=r.editObjectAtIndex(l,function(){return zt(e)?s.addAttribute(e,t):o[0]===o[1]?s:s.copyWithText(s.text.addAttributeAtRange(e,t,o))})),new this.constructor(r)}addAttribute(e,t){let{blockList:n}=this;return this.eachBlock((r,s)=>n=n.editObjectAtIndex(s,()=>r.addAttribute(e,t))),new this.constructor(n)}removeAttributeAtRange(e,t){let{blockList:n}=this;return this.eachBlockAtRange(t,function(r,s,o){zt(e)?n=n.editObjectAtIndex(o,()=>r.removeAttribute(e)):s[0]!==s[1]&&(n=n.editObjectAtIndex(o,()=>r.copyWithText(r.text.removeAttributeAtRange(e,s))))}),new this.constructor(n)}updateAttributesForAttachment(e,t){const n=this.getRangeOfAttachment(t),[r]=Array.from(n),{index:s}=this.locationFromPosition(r),o=this.getTextAtIndex(s);return new this.constructor(this.blockList.editObjectAtIndex(s,l=>l.copyWithText(o.updateAttributesForAttachment(e,t))))}removeAttributeForAttachment(e,t){const n=this.getRangeOfAttachment(t);return this.removeAttributeAtRange(e,n)}setHTMLAttributeAtPosition(e,t,n){const r=this.getBlockAtPosition(e),s=r.addHTMLAttribute(t,n);return this.replaceBlock(r,s)}insertBlockBreakAtRange(e){let t;e=bt(e);const[n]=e,{offset:r}=this.locationFromPosition(n),s=this.removeTextAtRange(e);return r===0&&(t=[new Xi]),new this.constructor(s.blockList.insertSplittableListAtPosition(new ku(t),n))}applyBlockAttributeAtRange(e,t,n){const r=this.expandRangeToLineBreaksAndSplitBlocks(n);let s=r.document;n=r.range;const o=zt(e);if(o.listAttribute){s=s.removeLastListAttributeAtRange(n,{exceptAttributeName:e});const l=s.convertLineBreaksToBlockBreaksInRange(n);s=l.document,n=l.range}else s=o.exclusive?s.removeBlockAttributesAtRange(n):o.terminal?s.removeLastTerminalAttributeAtRange(n):s.consolidateBlocksAtRange(n);return s.addAttributeAtRange(e,t,n)}removeLastListAttributeAtRange(e){let t=arguments.length>1&&arguments[1]!==void 0?arguments[1]:{},{blockList:n}=this;return this.eachBlockAtRange(e,function(r,s,o){const l=r.getLastAttribute();l&&zt(l).listAttribute&&l!==t.exceptAttributeName&&(n=n.editObjectAtIndex(o,()=>r.removeAttribute(l)))}),new this.constructor(n)}removeLastTerminalAttributeAtRange(e){let{blockList:t}=this;return this.eachBlockAtRange(e,function(n,r,s){const o=n.getLastAttribute();o&&zt(o).terminal&&(t=t.editObjectAtIndex(s,()=>n.removeAttribute(o)))}),new this.constructor(t)}removeBlockAttributesAtRange(e){let{blockList:t}=this;return this.eachBlockAtRange(e,function(n,r,s){n.hasAttributes()&&(t=t.editObjectAtIndex(s,()=>n.copyWithoutAttributes()))}),new this.constructor(t)}expandRangeToLineBreaksAndSplitBlocks(e){let t;e=bt(e);let[n,r]=e;const s=this.locationFromPosition(n),o=this.locationFromPosition(r);let l=this;const a=l.getBlockAtIndex(s.index);if(s.offset=a.findLineBreakInDirectionFromPosition("backward",s.offset),s.offset!=null&&(t=l.positionFromLocation(s),l=l.insertBlockBreakAtRange([t,t+1]),o.index+=1,o.offset-=l.getBlockAtIndex(s.index).getLength(),s.index+=1),s.offset=0,o.offset===0&&o.index>s.index)o.index-=1,o.offset=l.getBlockAtIndex(o.index).getBlockBreakPosition();else{const c=l.getBlockAtIndex(o.index);c.text.getStringAtRange([o.offset-1,o.offset])===`
|
||||
`?o.offset-=1:o.offset=c.findLineBreakInDirectionFromPosition("forward",o.offset),o.offset!==c.getBlockBreakPosition()&&(t=l.positionFromLocation(o),l=l.insertBlockBreakAtRange([t,t+1]))}return n=l.positionFromLocation(s),r=l.positionFromLocation(o),{document:l,range:e=bt([n,r])}}convertLineBreaksToBlockBreaksInRange(e){e=bt(e);let[t]=e;const n=this.getStringAtRange(e).slice(0,-1);let r=this;return n.replace(/.*?\n/g,function(s){t+=s.length,r=r.insertBlockBreakAtRange([t-1,t])}),{document:r,range:e}}consolidateBlocksAtRange(e){e=bt(e);const[t,n]=e,r=this.locationFromPosition(t).index,s=this.locationFromPosition(n).index;return new this.constructor(this.blockList.consolidateFromIndexToIndex(r,s))}getDocumentAtRange(e){e=bt(e);const t=this.blockList.getSplittableListInRange(e).toArray();return new this.constructor(t)}getStringAtRange(e){let t;const n=e=bt(e);return n[n.length-1]!==this.getLength()&&(t=-1),this.getDocumentAtRange(e).toString().slice(0,t)}getBlockAtIndex(e){return this.blockList.getObjectAtIndex(e)}getBlockAtPosition(e){const{index:t}=this.locationFromPosition(e);return this.getBlockAtIndex(t)}getTextAtIndex(e){var t;return(t=this.getBlockAtIndex(e))===null||t===void 0?void 0:t.text}getTextAtPosition(e){const{index:t}=this.locationFromPosition(e);return this.getTextAtIndex(t)}getPieceAtPosition(e){const{index:t,offset:n}=this.locationFromPosition(e);return this.getTextAtIndex(t).getPieceAtPosition(n)}getCharacterAtPosition(e){const{index:t,offset:n}=this.locationFromPosition(e);return this.getTextAtIndex(t).getStringAtRange([n,n+1])}getLength(){return this.blockList.getEndPosition()}getBlocks(){return this.blockList.toArray()}getBlockCount(){return this.blockList.length}getEditCount(){return this.editCount}eachBlock(e){return this.blockList.eachObject(e)}eachBlockAtRange(e,t){let n,r;e=bt(e);const[s,o]=e,l=this.locationFromPosition(s),a=this.locationFromPosition(o);if(l.index===a.index)return n=this.getBlockAtIndex(l.index),r=[l.offset,a.offset],t(n,r,l.index);for(let c=l.index;c<=a.index;c++)if(n=this.getBlockAtIndex(c),n){switch(c){case l.index:r=[l.offset,n.text.getLength()];break;case a.index:r=[0,a.offset];break;default:r=[0,n.text.getLength()]}t(n,r,c)}}getCommonAttributesAtRange(e){e=bt(e);const[t]=e;if(or(e))return this.getCommonAttributesAtPosition(t);{const n=[],r=[];return this.eachBlockAtRange(e,function(s,o){if(o[0]!==o[1])return n.push(s.text.getCommonAttributesAtRange(o)),r.push(c0(s))}),Kn.fromCommonAttributesOfObjects(n).merge(Kn.fromCommonAttributesOfObjects(r)).toObject()}}getCommonAttributesAtPosition(e){let t,n;const{index:r,offset:s}=this.locationFromPosition(e),o=this.getBlockAtIndex(r);if(!o)return{};const l=c0(o),a=o.text.getAttributesAtPosition(s),c=o.text.getAttributesAtPosition(s-1),u=Object.keys(xs).filter(h=>xs[h].inheritable);for(t in c)n=c[t],(n===a[t]||u.includes(t))&&(l[t]=n);return l}getRangeOfCommonAttributeAtPosition(e,t){const{index:n,offset:r}=this.locationFromPosition(t),s=this.getTextAtIndex(n),[o,l]=Array.from(s.getExpandedRangeForAttributeAtOffset(e,r)),a=this.positionFromLocation({index:n,offset:o}),c=this.positionFromLocation({index:n,offset:l});return bt([a,c])}getBaseBlockAttributes(){let e=this.getBlockAtIndex(0).getAttributes();for(let t=1;t<this.getBlockCount();t++){const n=this.getBlockAtIndex(t).getAttributes(),r=Math.min(e.length,n.length);e=(()=>{const s=[];for(let o=0;o<r&&n[o]===e[o];o++)s.push(n[o]);return s})()}return e}getAttachmentById(e){for(const t of this.getAttachments())if(t.id===e)return t}getAttachmentPieces(){let e=[];return this.blockList.eachObject(t=>{let{text:n}=t;return e=e.concat(n.getAttachmentPieces())}),e}getAttachments(){return this.getAttachmentPieces().map(e=>e.attachment)}getRangeOfAttachment(e){let t=0;const n=this.blockList.toArray();for(let r=0;r<n.length;r++){const{text:s}=n[r],o=s.getRangeOfAttachment(e);if(o)return bt([t+o[0],t+o[1]]);t+=s.getLength()}}getLocationRangeOfAttachment(e){const t=this.getRangeOfAttachment(e);return this.locationRangeFromRange(t)}getAttachmentPieceForAttachment(e){for(const t of this.getAttachmentPieces())if(t.attachment===e)return t}findRangesForBlockAttribute(e){let t=0;const n=[];return this.getBlocks().forEach(r=>{const s=r.getLength();r.hasAttribute(e)&&n.push([t,t+s]),t+=s}),n}findRangesForTextAttribute(e){let{withValue:t}=arguments.length>1&&arguments[1]!==void 0?arguments[1]:{},n=0,r=[];const s=[];return this.getPieces().forEach(o=>{const l=o.getLength();(function(a){return t?a.getAttribute(e)===t:a.hasAttribute(e)})(o)&&(r[1]===n?r[1]=n+l:s.push(r=[n,n+l])),n+=l}),s}locationFromPosition(e){const t=this.blockList.findIndexAndOffsetAtPosition(Math.max(0,e));if(t.index!=null)return t;{const n=this.getBlocks();return{index:n.length-1,offset:n[n.length-1].getLength()}}}positionFromLocation(e){return this.blockList.findPositionAtIndexAndOffset(e.index,e.offset)}locationRangeFromPosition(e){return bt(this.locationFromPosition(e))}locationRangeFromRange(e){if(!(e=bt(e)))return;co
Line truncated
|
||||
`);if(t===this.containerElement||this.isBlockElement(t)){var n;const r=this.getBlockAttributes(t),s=this.getBlockHTMLAttributes(t);Ts(r,(n=this.currentBlock)===null||n===void 0?void 0:n.attributes)||(this.currentBlock=this.appendBlockForAttributesWithElement(r,t,s),this.currentBlockElement=t)}}appendBlockForElement(e){const t=this.isBlockElement(e),n=ws(this.currentBlockElement,e);if(t&&!this.isBlockElement(e.firstChild)){if(!this.isInsignificantTextNode(e.firstChild)||!this.isBlockElement(e.firstElementChild)){const r=this.getBlockAttributes(e),s=this.getBlockHTMLAttributes(e);if(e.firstChild){if(n&&Ts(r,this.currentBlock.attributes))return this.appendStringWithAttributes(`
|
||||
`);this.currentBlock=this.appendBlockForAttributesWithElement(r,e,s),this.currentBlockElement=e}}}else if(this.currentBlockElement&&!n&&!t){const r=this.findParentBlockElement(e);if(r)return this.appendBlockForElement(r);this.currentBlock=this.appendEmptyBlock(),this.currentBlockElement=null}}findParentBlockElement(e){let{parentElement:t}=e;for(;t&&t!==this.containerElement;){if(this.isBlockElement(t)&&this.blockElements.includes(t))return t;t=t.parentElement}return null}processTextNode(e){let t=e.data;var n;return h0(e.parentNode)||(t=tp(t),Sk((n=e.previousSibling)===null||n===void 0?void 0:n.textContent)&&(t=k4(t))),this.appendStringWithAttributes(t,this.getTextAttributes(e.parentNode))}processElement(e){let t;if(Cs(e)){if(t=u0(e,"attachment"),Object.keys(t).length){const n=this.getTextAttributes(e);this.appendAttachmentWithAttributes(t,n),e.innerHTML=""}return this.processedElements.push(e)}switch(kn(e)){case"br":return this.isExtraBR(e)||this.isBlockElement(e.nextSibling)||this.appendStringWithAttributes(`
|
||||
`,this.getTextAttributes(e)),this.processedElements.push(e);case"img":t={url:e.getAttribute("src"),contentType:"image"};const n=(r=>{const s=r.getAttribute("width"),o=r.getAttribute("height"),l={};return s&&(l.width=parseInt(s,10)),o&&(l.height=parseInt(o,10)),l})(e);for(const r in n){const s=n[r];t[r]=s}return this.appendAttachmentWithAttributes(t,this.getTextAttributes(e)),this.processedElements.push(e);case"tr":if(this.needsTableSeparator(e))return this.appendStringWithAttributes(Fc.tableRowSeparator);break;case"td":if(this.needsTableSeparator(e))return this.appendStringWithAttributes(Fc.tableCellSeparator)}}appendBlockForAttributesWithElement(e,t){let n=arguments.length>2&&arguments[2]!==void 0?arguments[2]:{};this.blockElements.push(t);const r=function(){return{text:[],attributes:arguments.length>0&&arguments[0]!==void 0?arguments[0]:{},htmlAttributes:arguments.length>1&&arguments[1]!==void 0?arguments[1]:{}}}(e,n);return this.blocks.push(r),r}appendEmptyBlock(){return this.appendBlockForAttributesWithElement([],null)}appendStringWithAttributes(e,t){return this.appendPiece(mf(e,t))}appendAttachmentWithAttributes(e,t){return this.appendPiece(function(n){return{attachment:n,attributes:arguments.length>1&&arguments[1]!==void 0?arguments[1]:{},type:"attachment"}}(e,t))}appendPiece(e){return this.blocks.length===0&&this.appendEmptyBlock(),this.blocks[this.blocks.length-1].text.push(e)}appendStringToTextAtIndex(e,t){const{text:n}=this.blocks[t],r=n[n.length-1];if((r==null?void 0:r.type)!=="string")return n.push(mf(e));r.string+=e}prependStringToTextAtIndex(e,t){const{text:n}=this.blocks[t],r=n[0];if((r==null?void 0:r.type)!=="string")return n.unshift(mf(e));r.string=e+r.string}getTextAttributes(e){let t;const n={};for(const r in xs){const s=xs[r];if(s.tagName&&Yr(e,{matchingSelector:s.tagName,untilNode:this.containerElement}))n[r]=!0;else if(s.parser){if(t=s.parser(e),t){let o=!1;for(const l of this.findBlockElementAncestors(e))if(s.parser(l)===t){o=!0;break}o||(n[r]=t)}}else s.styleProperty&&(t=e.style[s.styleProperty],t&&(n[r]=t))}if(Cs(e)){const r=u0(e,"attributes");for(const s in r)t=r[s],n[s]=t}return n}getBlockAttributes(e){const t=[];for(;e&&e!==this.containerElement;){for(const r in Sn){const s=Sn[r];var n;s.parse!==!1&&kn(e)===s.tagName&&((n=s.test)!==null&&n!==void 0&&n.call(s,e)||!s.test)&&(t.push(r),s.listAttribute&&t.push(s.listAttribute))}e=e.parentNode}return t.reverse()}getBlockHTMLAttributes(e){const t={},n=Object.values(Sn).find(r=>r.tagName===kn(e));return((n==null?void 0:n.htmlAttributes)||[]).forEach(r=>{e.hasAttribute(r)&&(t[r]=e.getAttribute(r))}),t}findBlockElementAncestors(e){const t=[];for(;e&&e!==this.containerElement;){const n=kn(e);Nl().includes(n)&&t.push(e),e=e.parentNode}return t}isBlockElement(e){if((e==null?void 0:e.nodeType)===Node.ELEMENT_NODE&&!Cs(e)&&!Yr(e,{matchingSelector:"td",untilNode:this.containerElement}))return Nl().includes(kn(e))||window.getComputedStyle(e).display==="block"}isInsignificantTextNode(e){if((e==null?void 0:e.nodeType)!==Node.TEXT_NODE||!S4(e.data))return;const{parentNode:t,previousSibling:n,nextSibling:r}=e;return w4(t.previousSibling)&&!this.isBlockElement(t.previousSibling)||h0(t)?void 0:!n||this.isBlockElement(n)||!r||this.isBlockElement(r)}isExtraBR(e){return kn(e)==="br"&&this.isBlockElement(e.parentNode)&&e.parentNode.lastChild===e}needsTableSeparator(e){if(Fc.removeBlankTableCells){var t;const n=(t=e.previousSibling)===null||t===void 0?void 0:t.textContent;return n&&/\S/.test(n)}return e.previousSibling}translateBlockElementMarginsToNewlines(){const e=this.getMarginOfDefaultBlockElement();for(let t=0;t<this.blocks.length;t++){const n=this.getMarginOfBlockElementAtIndex(t);n&&(n.top>2*e.top&&this.prependStringToTextAtIndex(`
|
||||
`,t),n.bottom>2*e.bottom&&this.appendStringToTextAtIndex(`
|
||||
`,t))}}getMarginOfBlockElementAtIndex(e){const t=this.blockElements[e];if(t&&t.textContent&&!Nl().includes(kn(t))&&!this.processedElements.includes(t))return f0(t)}getMarginOfDefaultBlockElement(){const e=Ge(Sn.default.tagName);return this.containerElement.appendChild(e),f0(e)}}const h0=function(i){const{whiteSpace:e}=window.getComputedStyle(i);return["pre","pre-wrap","pre-line"].includes(e)},w4=i=>i&&!Sk(i.textContent),f0=function(i){const e=window.getComputedStyle(i);if(e.display==="block")return{top:parseInt(e.marginTop),bottom:parseInt(e.marginBottom)}},y4=function(i){return kn(i)==="style"?NodeFilter.FILTER_REJECT:NodeFilter.FILTER_ACCEPT},k4=i=>i.replace(new RegExp("^".concat(ep.source,"+")),""),S4=i=>new RegExp("^".concat(ep.source,"*$")).test(i),Sk=i=>/\s$/.test(i),_4=["contenteditable","data-trix-id","data-trix-store-key","data-trix-mutable","data-trix-placeholder","tabindex"],Md="data-trix-serialized-attributes",C4="[".concat(Md,"]"),P4=new RegExp("<!--block-->","g"),A4={"application/json":function(i){let e;if(i instanceof si)e=i;else{if(!(i instanceof HTMLElement))throw new Error("unserializable object");e=oa.parse(i.innerHTML).getDocument()}return e.toSerializableDocument().toJSONString()},"text/html":function(i){let e;if(i instanceof si)e=ah.render(i);else{if(!(i instanceof HTMLElement))throw new Error("unserializable object");e=i.cloneNode(!0)}return Array.from(e.querySelectorAll("[data-trix-serialize=false]")).forEach(t=>{zr(t)}),_4.forEach(t=>{Array.from(e.querySelectorAll("[".concat(t,"]"))).forEach(n=>{n.removeAttribute(t)})}),Array.from(e.querySelectorAll(C4)).forEach(t=>{try{const n=JSON.parse(t.getAttribute(Md));t.removeAttribute(Md);for(const r in n){const s=n[r];t.setAttribute(r,s)}}catch{}}),e.innerHTML.replace(P4,"")}};var x4=Object.freeze({__proto__:null});class Nt extends Kt{constructor(e,t){super(...arguments),this.attachmentManager=e,this.attachment=t,this.id=this.attachment.id,this.file=this.attachment.file}remove(){return this.attachmentManager.requestRemovalOfAttachment(this.attachment)}}Nt.proxyMethod("attachment.getAttribute"),Nt.proxyMethod("attachment.hasAttribute"),Nt.proxyMethod("attachment.setAttribute"),Nt.proxyMethod("attachment.getAttributes"),Nt.proxyMethod("attachment.setAttributes"),Nt.proxyMethod("attachment.isPending"),Nt.proxyMethod("attachment.isPreviewable"),Nt.proxyMethod("attachment.getURL"),Nt.proxyMethod("attachment.getPreviewURL"),Nt.proxyMethod("attachment.setPreviewURL"),Nt.proxyMethod("attachment.getHref"),Nt.proxyMethod("attachment.getFilename"),Nt.proxyMethod("attachment.getFilesize"),Nt.proxyMethod("attachment.getFormattedFilesize"),Nt.proxyMethod("attachment.getExtension"),Nt.proxyMethod("attachment.getContentType"),Nt.proxyMethod("attachment.getFile"),Nt.proxyMethod("attachment.setFile"),Nt.proxyMethod("attachment.releaseFile"),Nt.proxyMethod("attachment.getUploadProgress"),Nt.proxyMethod("attachment.setUploadProgress");class _k extends Kt{constructor(){let e=arguments.length>0&&arguments[0]!==void 0?arguments[0]:[];super(...arguments),this.managedAttachments={},Array.from(e).forEach(t=>{this.manageAttachment(t)})}getAttachments(){const e=[];for(const t in this.managedAttachments){const n=this.managedAttachments[t];e.push(n)}return e}manageAttachment(e){return this.managedAttachments[e.id]||(this.managedAttachments[e.id]=new Nt(this,e)),this.managedAttachments[e.id]}attachmentIsManaged(e){return e.id in this.managedAttachments}requestRemovalOfAttachment(e){var t,n;if(this.attachmentIsManaged(e))return(t=this.delegate)===null||t===void 0||(n=t.attachmentManagerDidRequestRemovalOfAttachment)===null||n===void 0?void 0:n.call(t,e)}unmanageAttachment(e){const t=this.managedAttachments[e.id];return delete this.managedAttachments[e.id],t}}class Ck{constructor(e){this.composition=e,this.document=this.composition.document;const t=this.composition.getSelectedRange();this.startPosition=t[0],this.endPosition=t[1],this.startLocation=this.document.locationFromPosition(this.startPosition),this.endLocation=this.document.locationFromPosition(this.endPosition),this.block=this.document.getBlockAtIndex(this.endLocation.index),this.breaksOnReturn=this.block.breaksOnReturn(),this.previousCharacter=this.block.text.getStringAtPosition(this.endLocation.offset-1),this.nextCharacter=this.block.text.getStringAtPosition(this.endLocation.offset)}shouldInsertBlockBreak(){return this.block.hasAttributes()&&this.block.isListItem()&&!this.block.isEmpty()?this.startLocation.offset!==0:this.breaksOnReturn&&this.nextCharacter!==`
|
||||
`}shouldBreakFormattedBlock(){return this.block.hasAttributes()&&!this.block.isListItem()&&(this.breaksOnReturn&&this.nextCharacter===`
|
||||
`||this.previousCharacter===`
|
||||
`)}shouldDecreaseListLevel(){return this.block.hasAttributes()&&this.block.isListItem()&&this.block.isEmpty()}shouldPrependListItem(){return this.block.isListItem()&&this.startLocation.offset===0&&!this.block.isEmpty()}shouldRemoveLastBlockAttribute(){return this.block.hasAttributes()&&!this.block.isListItem()&&this.block.isEmpty()}}class Tr extends Kt{constructor(){super(...arguments),this.document=new si,this.attachments=[],this.currentAttributes={},this.revision=0}setDocument(e){var t,n;if(!e.isEqualTo(this.document))return this.document=e,this.refreshAttachments(),this.revision++,(t=this.delegate)===null||t===void 0||(n=t.compositionDidChangeDocument)===null||n===void 0?void 0:n.call(t,e)}getSnapshot(){return{document:this.document,selectedRange:this.getSelectedRange()}}loadSnapshot(e){var t,n,r,s;let{document:o,selectedRange:l}=e;return(t=this.delegate)===null||t===void 0||(n=t.compositionWillLoadSnapshot)===null||n===void 0||n.call(t),this.setDocument(o??new si),this.setSelection(l??[0,0]),(r=this.delegate)===null||r===void 0||(s=r.compositionDidLoadSnapshot)===null||s===void 0?void 0:s.call(r)}insertText(e){let{updatePosition:t}=arguments.length>1&&arguments[1]!==void 0?arguments[1]:{updatePosition:!0};const n=this.getSelectedRange();this.setDocument(this.document.insertTextAtRange(e,n));const r=n[0],s=r+e.getLength();return t&&this.setSelection(s),this.notifyDelegateOfInsertionAtRange([r,s])}insertBlock(){let e=arguments.length>0&&arguments[0]!==void 0?arguments[0]:new Xi;const t=new si([e]);return this.insertDocument(t)}insertDocument(){let e=arguments.length>0&&arguments[0]!==void 0?arguments[0]:new si;const t=this.getSelectedRange();this.setDocument(this.document.insertDocumentAtRange(e,t));const n=t[0],r=n+e.getLength();return this.setSelection(r),this.notifyDelegateOfInsertionAtRange([n,r])}insertString(e,t){const n=this.getCurrentTextAttributes(),r=Si.textForStringWithAttributes(e,n);return this.insertText(r,t)}insertBlockBreak(){const e=this.getSelectedRange();this.setDocument(this.document.insertBlockBreakAtRange(e));const t=e[0],n=t+1;return this.setSelection(n),this.notifyDelegateOfInsertionAtRange([t,n])}insertLineBreak(){const e=new Ck(this);if(e.shouldDecreaseListLevel())return this.decreaseListLevel(),this.setSelection(e.startPosition);if(e.shouldPrependListItem()){const t=new si([e.block.copyWithoutText()]);return this.insertDocument(t)}return e.shouldInsertBlockBreak()?this.insertBlockBreak():e.shouldRemoveLastBlockAttribute()?this.removeLastBlockAttribute():e.shouldBreakFormattedBlock()?this.breakFormattedBlock(e):this.insertString(`
|
||||
`)}insertHTML(e){const t=oa.parse(e,{purifyOptions:{SAFE_FOR_XML:!0}}).getDocument(),n=this.getSelectedRange();this.setDocument(this.document.mergeDocumentAtRange(t,n));const r=n[0],s=r+t.getLength()-1;return this.setSelection(s),this.notifyDelegateOfInsertionAtRange([r,s])}replaceHTML(e){const t=oa.parse(e).getDocument().copyUsingObjectsFromDocument(this.document),n=this.getLocationRange({strict:!1}),r=this.document.rangeFromLocationRange(n);return this.setDocument(t),this.setSelection(r)}insertFile(e){return this.insertFiles([e])}insertFiles(e){const t=[];return Array.from(e).forEach(n=>{var r;if((r=this.delegate)!==null&&r!==void 0&&r.compositionShouldAcceptFile(n)){const s=Yo.attachmentForFile(n);t.push(s)}}),this.insertAttachments(t)}insertAttachment(e){return this.insertAttachments([e])}insertAttachments(e){let t=new Si;return Array.from(e).forEach(n=>{var r;const s=n.getType(),o=(r=jm[s])===null||r===void 0?void 0:r.presentation,l=this.getCurrentTextAttributes();o&&(l.presentation=o);const a=Si.textForAttachmentWithAttributes(n,l);t=t.appendText(a)}),this.insertText(t)}shouldManageDeletingInDirection(e){const t=this.getLocationRange();if(or(t)){if(e==="backward"&&t[0].offset===0||this.shouldManageMovingCursorInDirection(e))return!0}else if(t[0].index!==t[1].index)return!0;return!1}deleteInDirection(e){let t,n,r,{length:s}=arguments.length>1&&arguments[1]!==void 0?arguments[1]:{};const o=this.getLocationRange();let l=this.getSelectedRange();const a=or(l);if(a?n=e==="backward"&&o[0].offset===0:r=o[0].index!==o[1].index,n&&this.canDecreaseBlockAttributeLevel()){const c=this.getBlock();if(c.isListItem()?this.decreaseListLevel():this.decreaseBlockAttributeLevel(),this.setSelection(l[0]),c.isEmpty())return!1}return a&&(l=this.getExpandedRangeInDirection(e,{length:s}),e==="backward"&&(t=this.getAttachmentAtRange(l))),t?(this.editAttachment(t),!1):(this.setDocument(this.document.removeTextAtRange(l)),this.setSelection(l[0]),!n&&!r&&void 0)}moveTextFromRange(e){const[t]=Array.from(this.getSelectedRange());return this.setDocument(this.document.moveTextFromRangeToPosition(e,t)),this.setSelection(t)}removeAttachment(e){const t=this.document.getRangeOfAttachment(e);if(t)return this.stopEditingAttachment(),this.setDocument(this.document.removeTextAtRange(t)),this.setSelection(t[0])}removeLastBlockAttribute(){const[e,t]=Array.from(this.getSelectedRange()),n=this.document.getBlockAtPosition(t);return this.removeCurrentAttribute(n.getLastAttribute()),this.setSelection(e)}insertPlaceholder(){return this.placeholderPosition=this.getPosition(),this.insertString(" ")}selectPlaceholder(){if(this.placeholderPosition!=null)return this.setSelectedRange([this.placeholderPosition,this.placeholderPosition+1]),this.getSelectedRange()}forgetPlaceholder(){this.placeholderPosition=null}hasCurrentAttribute(e){const t=this.currentAttributes[e];return t!=null&&t!==!1}toggleCurrentAttribute(e){const t=!this.currentAttributes[e];return t?this.setCurrentAttribute(e,t):this.removeCurrentAttribute(e)}canSetCurrentAttribute(e){return zt(e)?this.canSetCurrentBlockAttribute(e):this.canSetCurrentTextAttribute(e)}canSetCurrentTextAttribute(e){const t=this.getSelectedDocument();if(t){for(const n of Array.from(t.getAttachments()))if(!n.hasContent())return!1;return!0}}canSetCurrentBlockAttribute(e){const t=this.getBlock();if(t)return!t.isTerminalBlock()}setCurrentAttribute(e,t){return zt(e)?this.setBlockAttribute(e,t):(this.setTextAttribute(e,t),this.currentAttributes[e]=t,this.notifyDelegateOfCurrentAttributesChange())}setHTMLAtributeAtPosition(e,t,n){var r;const s=this.document.getBlockAtPosition(e),o=(r=zt(s.getLastAttribute()))===null||r===void 0?void 0:r.htmlAttributes;if(s&&o!=null&&o.includes(t)){const l=this.document.setHTMLAttributeAtPosition(e,t,n);this.setDocument(l)}}setTextAttribute(e,t){const n=this.getSelectedRange();if(!n)return;const[r,s]=Array.from(n);if(r!==s)return this.setDocument(this.document.addAttributeAtRange(e,t,n));if(e==="href"){const o=Si.textForStringWithAttributes(t,{href:t});return this.insertText(o)}}setBlockAttribute(e,t){const n=this.getSelectedRange();if(this.canSetCurrentAttribute(e))return this.setDocument(this.document.applyBlockAttributeAtRange(e,t,n)),this.setSelection(n)}removeCurrentAttribute(e){return zt(e)?(this.removeBlockAttribute(e),this.updateCurrentAttributes()):(this.removeTextAttribute(e),delete this.currentAttributes[e],this.notifyDelegateOfCurrentAttributesChange())}removeTextAttribute(e){const t=this.getSelectedRange();if(t)return this.setDocument(this.document.removeAttributeAtRange(e,t))}removeBlockAttribute(e){const t=this.getSelectedRange();if(t)return this.setDocument(this.document.removeAttributeAtRange(e,t))}canDecreaseNestingLevel(){var e;return((e=this.getBlock())===null||e===void 0?void 0:e.getNestingLevel())>0}canIncreaseNestingLevel(){var e;const t=this.getBlock();if(t){if((e=zt(t.getLastNestableAttribute()))===null||e===void 0||!e.listAttribute)return t.getNestingLevel()>0;{cons
Line truncated
|
||||
`?r+=1:t=t.removeTextAtRange(s),s=[r,r]):e.nextCharacter===`
|
||||
`?e.previousCharacter===`
|
||||
`?s=[r-1,r+1]:(s=[r,r+1],r+=1):e.startLocation.offset-1!=0&&(r+=1);const o=new si([n.removeLastAttribute().copyWithoutText()]);return this.setDocument(t.insertDocumentAtRange(o,s)),this.setSelection(r)}getPreviousBlock(){const e=this.getLocationRange();if(e){const{index:t}=e[0];if(t>0)return this.document.getBlockAtIndex(t-1)}}getBlock(){const e=this.getLocationRange();if(e)return this.document.getBlockAtIndex(e[0].index)}getAttachmentAtRange(e){const t=this.document.getDocumentAtRange(e);if(t.toString()==="".concat("",`
|
||||
`))return t.getAttachments()[0]}notifyDelegateOfCurrentAttributesChange(){var e,t;return(e=this.delegate)===null||e===void 0||(t=e.compositionDidChangeCurrentAttributes)===null||t===void 0?void 0:t.call(e,this.currentAttributes)}notifyDelegateOfInsertionAtRange(e){var t,n;return(t=this.delegate)===null||t===void 0||(n=t.compositionDidPerformInsertionAtRange)===null||n===void 0?void 0:n.call(t,e)}translateUTF16PositionFromOffset(e,t){const n=this.document.toUTF16String(),r=n.offsetFromUCS2Offset(e);return n.offsetToUCS2Offset(r+t)}}Tr.proxyMethod("getSelectionManager().getPointRange"),Tr.proxyMethod("getSelectionManager().setLocationRangeFromPointRange"),Tr.proxyMethod("getSelectionManager().createLocationRangeFromDOMRange"),Tr.proxyMethod("getSelectionManager().locationIsCursorTarget"),Tr.proxyMethod("getSelectionManager().selectionIsExpanded"),Tr.proxyMethod("delegate?.getSelectionManager");class Ed extends Kt{constructor(e){super(...arguments),this.composition=e,this.undoEntries=[],this.redoEntries=[]}recordUndoEntry(e){let{context:t,consolidatable:n}=arguments.length>1&&arguments[1]!==void 0?arguments[1]:{};const r=this.undoEntries.slice(-1)[0];if(!n||!T4(r,e,t)){const s=this.createEntry({description:e,context:t});this.undoEntries.push(s),this.redoEntries=[]}}undo(){const e=this.undoEntries.pop();if(e){const t=this.createEntry(e);return this.redoEntries.push(t),this.composition.loadSnapshot(e.snapshot)}}redo(){const e=this.redoEntries.pop();if(e){const t=this.createEntry(e);return this.undoEntries.push(t),this.composition.loadSnapshot(e.snapshot)}}canUndo(){return this.undoEntries.length>0}canRedo(){return this.redoEntries.length>0}createEntry(){let{description:e,context:t}=arguments.length>0&&arguments[0]!==void 0?arguments[0]:{};return{description:e==null?void 0:e.toString(),context:JSON.stringify(t),snapshot:this.composition.getSnapshot()}}}const T4=(i,e,t)=>(i==null?void 0:i.description)===(e==null?void 0:e.toString())&&(i==null?void 0:i.context)===JSON.stringify(t),pf="attachmentGallery";class Pk{constructor(e){this.document=e.document,this.selectedRange=e.selectedRange}perform(){return this.removeBlockAttribute(),this.applyBlockAttribute()}getSnapshot(){return{document:this.document,selectedRange:this.selectedRange}}removeBlockAttribute(){return this.findRangesOfBlocks().map(e=>this.document=this.document.removeAttributeAtRange(pf,e))}applyBlockAttribute(){let e=0;this.findRangesOfPieces().forEach(t=>{t[1]-t[0]>1&&(t[0]+=e,t[1]+=e,this.document.getCharacterAtPosition(t[1])!==`
|
||||
`&&(this.document=this.document.insertBlockBreakAtRange(t[1]),t[1]<this.selectedRange[1]&&this.moveSelectedRangeForward(),t[1]++,e++),t[0]!==0&&this.document.getCharacterAtPosition(t[0]-1)!==`
|
||||
`&&(this.document=this.document.insertBlockBreakAtRange(t[0]),t[0]<this.selectedRange[0]&&this.moveSelectedRangeForward(),t[0]++,e++),this.document=this.document.applyBlockAttributeAtRange(pf,!0,t))})}findRangesOfBlocks(){return this.document.findRangesForBlockAttribute(pf)}findRangesOfPieces(){return this.document.findRangesForTextAttribute("presentation",{withValue:"gallery"})}moveSelectedRangeForward(){this.selectedRange[0]+=1,this.selectedRange[1]+=1}}const Ak=function(i){const e=new Pk(i);return e.perform(),e.getSnapshot()},Q4=[Ak];class xk{constructor(e,t,n){this.insertFiles=this.insertFiles.bind(this),this.composition=e,this.selectionManager=t,this.element=n,this.undoManager=new Ed(this.composition),this.filters=Q4.slice(0)}loadDocument(e){return this.loadSnapshot({document:e,selectedRange:[0,0]})}loadHTML(){let e=arguments.length>0&&arguments[0]!==void 0?arguments[0]:"";const t=oa.parse(e,{referenceElement:this.element}).getDocument();return this.loadDocument(t)}loadJSON(e){let{document:t,selectedRange:n}=e;return t=si.fromJSON(t),this.loadSnapshot({document:t,selectedRange:n})}loadSnapshot(e){return this.undoManager=new Ed(this.composition),this.composition.loadSnapshot(e)}getDocument(){return this.composition.document}getSelectedDocument(){return this.composition.getSelectedDocument()}getSnapshot(){return this.composition.getSnapshot()}toJSON(){return this.getSnapshot()}deleteInDirection(e){return this.composition.deleteInDirection(e)}insertAttachment(e){return this.composition.insertAttachment(e)}insertAttachments(e){return this.composition.insertAttachments(e)}insertDocument(e){return this.composition.insertDocument(e)}insertFile(e){return this.composition.insertFile(e)}insertFiles(e){return this.composition.insertFiles(e)}insertHTML(e){return this.composition.insertHTML(e)}insertString(e){return this.composition.insertString(e)}insertText(e){return this.composition.insertText(e)}insertLineBreak(){return this.composition.insertLineBreak()}getSelectedRange(){return this.composition.getSelectedRange()}getPosition(){return this.composition.getPosition()}getClientRectAtPosition(e){const t=this.getDocument().locationRangeFromRange([e,e+1]);return this.selectionManager.getClientRectAtLocationRange(t)}expandSelectionInDirection(e){return this.composition.expandSelectionInDirection(e)}moveCursorInDirection(e){return this.composition.moveCursorInDirection(e)}setSelectedRange(e){return this.composition.setSelectedRange(e)}activateAttribute(e){let t=!(arguments.length>1&&arguments[1]!==void 0)||arguments[1];return this.composition.setCurrentAttribute(e,t)}attributeIsActive(e){return this.composition.hasCurrentAttribute(e)}canActivateAttribute(e){return this.composition.canSetCurrentAttribute(e)}deactivateAttribute(e){return this.composition.removeCurrentAttribute(e)}setHTMLAtributeAtPosition(e,t,n){this.composition.setHTMLAtributeAtPosition(e,t,n)}canDecreaseNestingLevel(){return this.composition.canDecreaseNestingLevel()}canIncreaseNestingLevel(){return this.composition.canIncreaseNestingLevel()}decreaseNestingLevel(){if(this.canDecreaseNestingLevel())return this.composition.decreaseNestingLevel()}increaseNestingLevel(){if(this.canIncreaseNestingLevel())return this.composition.increaseNestingLevel()}canRedo(){return this.undoManager.canRedo()}canUndo(){return this.undoManager.canUndo()}recordUndoEntry(e){let{context:t,consolidatable:n}=arguments.length>1&&arguments[1]!==void 0?arguments[1]:{};return this.undoManager.recordUndoEntry(e,{context:t,consolidatable:n})}redo(){if(this.canRedo())return this.undoManager.redo()}undo(){if(this.canUndo())return this.undoManager.undo()}}class Tk{constructor(e){this.element=e}findLocationFromContainerAndOffset(e,t){let{strict:n}=arguments.length>2&&arguments[2]!==void 0?arguments[2]:{strict:!0},r=0,s=!1;const o={index:0,offset:0},l=this.findAttachmentElementParentForNode(e);l&&(e=l.parentNode,t=Hh(l));const a=vu(this.element,{usingFilter:Qk});for(;a.nextNode();){const c=a.currentNode;if(c===e&&Zl(e)){mo(c)||(o.offset+=t);break}if(c.parentNode===e){if(r++===t){!n&&Jh(c,{strict:n})&&(s&&o.index++,o.offset=0,s=!0);break}}else if(!ws(e,c)&&r>0)break;Jh(c,{strict:n})?(s&&o.index++,o.offset=0,s=!0):o.offset+=gf(c)}return o}findContainerAndOffsetFromLocation(e){let t,n;if(e.index===0&&e.offset===0){for(t=this.element,n=0;t.firstChild;)if(t=t.firstChild,Kh(t)){n=1;break}return[t,n]}let[r,s]=this.findNodeAndOffsetFromLocation(e);if(r){if(Zl(r))gf(r)===0?(t=r.parentNode.parentNode,n=Hh(r.parentNode),mo(r,{name:"right"})&&n++):(t=r,n=e.offset-s);else{if(t=r.parentNode,!Jh(r.previousSibling)&&!Kh(t))for(;r===t.lastChild&&(r=t,t=t.parentNode,!Kh(t)););n=Hh(r),e.offset!==0&&n++}return[t,n]}}findNodeAndOffsetFromLocation(e){let t,n,r=0;for(const s of this.getSignificantNodesForIndex(e.index)){const o=gf(s);if(e.offset<=r+o)if(Zl(s)){if(t=s,n=r,e.offset===n&&mo(t))break}else t||(t=s,n=r);if(r+=o,r>e.offset)break}return[t,n]}findAttachmentElementParentForNode(e){for(;e&&e!==this.eleme
Line truncated
|
||||
`]):(e=Rd(n),t=Rd(r));const s=e.filter((l,a)=>l!==t[a]).map(kl),o=t.filter((l,a)=>l!==e[a]).map(kl);return{additions:s,deletions:o}}getTextChangesFromCharacterData(){let e,t;const n=this.getMutationsByType("characterData");if(n.length){const r=n[0],s=n[n.length-1],o=function(l,a){let c,u;return l=sa.box(l),(a=sa.box(a)).length<l.length?[u,c]=V1(l,a):[c,u]=V1(a,l),{added:c,removed:u}}(kl(r.oldValue),kl(s.target.data));e=o.added,t=o.removed}return{additions:e?[e]:[],deletions:t?[t]:[]}}}const Rd=function(){let i=arguments.length>0&&arguments[0]!==void 0?arguments[0]:[];const e=[];for(const t of Array.from(i))switch(t.nodeType){case Node.TEXT_NODE:e.push(t.data);break;case Node.ELEMENT_NODE:kn(t)==="br"?e.push(`
|
||||
`):e.push(...Array.from(Rd(t.childNodes)||[]))}return e};class Nk extends yu{constructor(e){super(...arguments),this.file=e}perform(e){const t=new FileReader;return t.onerror=()=>e(!1),t.onload=()=>{t.onerror=null;try{t.abort()}catch{}return e(!0,this.file)},t.readAsArrayBuffer(this.file)}}class I4{constructor(e){this.element=e}shouldIgnore(e){return!!Da.samsungAndroid&&(this.previousEvent=this.event,this.event=e,this.checkSamsungKeyboardBuggyModeStart(),this.checkSamsungKeyboardBuggyModeEnd(),this.buggyMode)}checkSamsungKeyboardBuggyModeStart(){this.insertingLongTextAfterUnidentifiedChar()&&N4(this.element.innerText,this.event.data)&&(this.buggyMode=!0,this.event.preventDefault())}checkSamsungKeyboardBuggyModeEnd(){this.buggyMode&&this.event.inputType!=="insertText"&&(this.buggyMode=!1)}insertingLongTextAfterUnidentifiedChar(){var e;return this.isBeforeInputInsertText()&&this.previousEventWasUnidentifiedKeydown()&&((e=this.event.data)===null||e===void 0?void 0:e.length)>50}isBeforeInputInsertText(){return this.event.type==="beforeinput"&&this.event.inputType==="insertText"}previousEventWasUnidentifiedKeydown(){var e,t;return((e=this.previousEvent)===null||e===void 0?void 0:e.type)==="keydown"&&((t=this.previousEvent)===null||t===void 0?void 0:t.key)==="Unidentified"}}const N4=(i,e)=>d0(i)===d0(e),Z4=new RegExp("(".concat("","|").concat(oh,"|").concat(Rr,"|\\s)+"),"g"),d0=i=>i.replace(Z4," ").trim();class ch extends Kt{constructor(e){super(...arguments),this.element=e,this.mutationObserver=new Ik(this.element),this.mutationObserver.delegate=this,this.flakyKeyboardDetector=new I4(this.element);for(const t in this.constructor.events)Zt(t,{onElement:this.element,withCallback:this.handlerFor(t)})}elementDidMutate(e){}editorWillSyncDocumentView(){return this.mutationObserver.stop()}editorDidSyncDocumentView(){return this.mutationObserver.start()}requestRender(){var e,t;return(e=this.delegate)===null||e===void 0||(t=e.inputControllerDidRequestRender)===null||t===void 0?void 0:t.call(e)}requestReparse(){var e,t;return(e=this.delegate)===null||e===void 0||(t=e.inputControllerDidRequestReparse)===null||t===void 0||t.call(e),this.requestRender()}attachFiles(e){const t=Array.from(e).map(n=>new Nk(n));return Promise.all(t).then(n=>{this.handleInput(function(){var r,s;return(r=this.delegate)===null||r===void 0||r.inputControllerWillAttachFiles(),(s=this.responder)===null||s===void 0||s.insertFiles(n),this.requestRender()})})}handlerFor(e){return t=>{t.defaultPrevented||this.handleInput(()=>{if(!Gm(this.element)){if(this.flakyKeyboardDetector.shouldIgnore(t))return;this.eventName=e,this.constructor.events[e].call(this,t)}})}}handleInput(e){try{var t;(t=this.delegate)===null||t===void 0||t.inputControllerWillHandleInput(),e.call(this)}finally{var n;(n=this.delegate)===null||n===void 0||n.inputControllerDidHandleInput()}}createLinkHTML(e,t){const n=document.createElement("a");return n.href=e,n.textContent=t||e,n.outerHTML}}var vf;gn(ch,"events",{});const{browser:B4,keyNames:Zk}=$a;let W4=0;class ir extends ch{constructor(){super(...arguments),this.resetInputSummary()}setInputSummary(){let e=arguments.length>0&&arguments[0]!==void 0?arguments[0]:{};this.inputSummary.eventName=this.eventName;for(const t in e){const n=e[t];this.inputSummary[t]=n}return this.inputSummary}resetInputSummary(){this.inputSummary={}}reset(){return this.resetInputSummary(),Qs.reset()}elementDidMutate(e){var t,n;return this.isComposing()?(t=this.delegate)===null||t===void 0||(n=t.inputControllerDidAllowUnhandledInput)===null||n===void 0?void 0:n.call(t):this.handleInput(function(){return this.mutationIsSignificant(e)&&(this.mutationIsExpected(e)?this.requestRender():this.requestReparse()),this.reset()})}mutationIsExpected(e){let{textAdded:t,textDeleted:n}=e;if(this.inputSummary.preferDocument)return!0;const r=t!=null?t===this.inputSummary.textAdded:!this.inputSummary.textAdded,s=n!=null?this.inputSummary.didDelete:!this.inputSummary.didDelete,o=[`
|
||||
`,`
|
||||
`].includes(t)&&!r,l=n===`
|
||||
`&&!s;if(o&&!l||l&&!o){const c=this.getSelectedRange();if(c){var a;const u=o?t.replace(/\n$/,"").length||-1:(t==null?void 0:t.length)||1;if((a=this.responder)!==null&&a!==void 0&&a.positionIsBlockBreak(c[1]+u))return!0}}return r&&s}mutationIsSignificant(e){var t;const n=Object.keys(e).length>0,r=((t=this.compositionInput)===null||t===void 0?void 0:t.getEndData())==="";return n||!r}getCompositionInput(){if(this.isComposing())return this.compositionInput;this.compositionInput=new Ar(this)}isComposing(){return this.compositionInput&&!this.compositionInput.isEnded()}deleteInDirection(e,t){var n;return((n=this.responder)===null||n===void 0?void 0:n.deleteInDirection(e))!==!1?this.setInputSummary({didDelete:!0}):t?(t.preventDefault(),this.requestRender()):void 0}serializeSelectionToDataTransfer(e){var t;if(!function(r){if(r==null||!r.setData)return!1;for(const s in F1){const o=F1[s];try{if(r.setData(s,o),!r.getData(s)===o)return!1}catch{return!1}}return!0}(e))return;const n=(t=this.responder)===null||t===void 0?void 0:t.getSelectedDocument().toSerializableDocument();return e.setData("application/x-trix-document",JSON.stringify(n)),e.setData("text/html",ah.render(n).innerHTML),e.setData("text/plain",n.toString().replace(/\n$/,"")),!0}canAcceptDataTransfer(e){const t={};return Array.from((e==null?void 0:e.types)||[]).forEach(n=>{t[n]=!0}),t.Files||t["application/x-trix-document"]||t["text/html"]||t["text/plain"]}getPastedHTMLUsingHiddenElement(e){const t=this.getSelectedRange(),n={position:"absolute",left:"".concat(window.pageXOffset,"px"),top:"".concat(window.pageYOffset,"px"),opacity:0},r=Ge({style:n,tagName:"div",editable:!0});return document.body.appendChild(r),r.focus(),requestAnimationFrame(()=>{const s=r.innerHTML;return zr(r),this.setSelectedRange(t),e(s)})}}gn(ir,"events",{keydown(i){this.isComposing()||this.resetInputSummary(),this.inputSummary.didInput=!0;const e=Zk[i.keyCode];if(e){var t;let r=this.keys;["ctrl","alt","shift","meta"].forEach(s=>{var o;i["".concat(s,"Key")]&&(s==="ctrl"&&(s="control"),r=(o=r)===null||o===void 0?void 0:o[s])}),((t=r)===null||t===void 0?void 0:t[e])!=null&&(this.setInputSummary({keyName:e}),Qs.reset(),r[e].call(this,i))}if(ok(i)){const r=String.fromCharCode(i.keyCode).toLowerCase();if(r){var n;const s=["alt","shift"].map(o=>{if(i["".concat(o,"Key")])return o}).filter(o=>o);s.push(r),(n=this.delegate)!==null&&n!==void 0&&n.inputControllerDidReceiveKeyboardCommand(s)&&i.preventDefault()}}},keypress(i){if(this.inputSummary.eventName!=null||i.metaKey||i.ctrlKey&&!i.altKey)return;const e=Y4(i);var t,n;return e?((t=this.delegate)===null||t===void 0||t.inputControllerWillPerformTyping(),(n=this.responder)===null||n===void 0||n.insertString(e),this.setInputSummary({textAdded:e,didDelete:this.selectionIsExpanded()})):void 0},textInput(i){const{data:e}=i,{textAdded:t}=this.inputSummary;if(t&&t!==e&&t.toUpperCase()===e){var n;const r=this.getSelectedRange();return this.setSelectedRange([r[0],r[1]+t.length]),(n=this.responder)===null||n===void 0||n.insertString(e),this.setInputSummary({textAdded:e}),this.setSelectedRange(r)}},dragenter(i){i.preventDefault()},dragstart(i){var e,t;return this.serializeSelectionToDataTransfer(i.dataTransfer),this.draggedRange=this.getSelectedRange(),(e=this.delegate)===null||e===void 0||(t=e.inputControllerDidStartDrag)===null||t===void 0?void 0:t.call(e)},dragover(i){if(this.draggedRange||this.canAcceptDataTransfer(i.dataTransfer)){i.preventDefault();const n={x:i.clientX,y:i.clientY};var e,t;if(!Fo(n,this.draggingPoint))return this.draggingPoint=n,(e=this.delegate)===null||e===void 0||(t=e.inputControllerDidReceiveDragOverPoint)===null||t===void 0?void 0:t.call(e,this.draggingPoint)}},dragend(i){var e,t;(e=this.delegate)===null||e===void 0||(t=e.inputControllerDidCancelDrag)===null||t===void 0||t.call(e),this.draggedRange=null,this.draggingPoint=null},drop(i){var e,t;i.preventDefault();const n=(e=i.dataTransfer)===null||e===void 0?void 0:e.files,r=i.dataTransfer.getData("application/x-trix-document"),s={x:i.clientX,y:i.clientY};if((t=this.responder)===null||t===void 0||t.setLocationRangeFromPointRange(s),n!=null&&n.length)this.attachFiles(n);else if(this.draggedRange){var o,l;(o=this.delegate)===null||o===void 0||o.inputControllerWillMoveText(),(l=this.responder)===null||l===void 0||l.moveTextFromRange(this.draggedRange),this.draggedRange=null,this.requestRender()}else if(r){var a;const c=si.fromJSONString(r);(a=this.responder)===null||a===void 0||a.insertDocument(c),this.requestRender()}this.draggedRange=null,this.draggingPoint=null},cut(i){var e,t;if((e=this.responder)!==null&&e!==void 0&&e.selectionIsExpanded()&&(this.serializeSelectionToDataTransfer(i.clipboardData)&&i.preventDefault(),(t=this.delegate)===null||t===void 0||t.inputControllerWillCutText(),this.deleteInDirection("backward"),i.defaultPrevented))return this.requestRender()},copy(i){var e;(e=this.responder)!==null&&e!==void 0&&e.selectionIsExpanded()&&this.serializeSelectionToDataTransfer
Line truncated
|
||||
`,{updatePosition:!1}),this.requestRender()}},shift:{return(i){var e,t;(e=this.delegate)===null||e===void 0||e.inputControllerWillPerformTyping(),(t=this.responder)===null||t===void 0||t.insertString(`
|
||||
`),this.requestRender(),i.preventDefault()},tab(i){var e,t;(e=this.responder)!==null&&e!==void 0&&e.canDecreaseNestingLevel()&&((t=this.responder)===null||t===void 0||t.decreaseNestingLevel(),this.requestRender(),i.preventDefault())},left(i){if(this.selectionIsInCursorTarget())return i.preventDefault(),this.expandSelectionInDirection("backward")},right(i){if(this.selectionIsInCursorTarget())return i.preventDefault(),this.expandSelectionInDirection("forward")}},alt:{backspace(i){var e;return this.setInputSummary({preferDocument:!1}),(e=this.delegate)===null||e===void 0?void 0:e.inputControllerWillPerformTyping()}},meta:{backspace(i){var e;return this.setInputSummary({preferDocument:!1}),(e=this.delegate)===null||e===void 0?void 0:e.inputControllerWillPerformTyping()}}}),ir.proxyMethod("responder?.getSelectedRange"),ir.proxyMethod("responder?.setSelectedRange"),ir.proxyMethod("responder?.expandSelectionInDirection"),ir.proxyMethod("responder?.selectionIsInCursorTarget"),ir.proxyMethod("responder?.selectionIsExpanded");const X4=i=>{var e;return(e=i.type)===null||e===void 0||(e=e.match(/\/(\w+)$/))===null||e===void 0?void 0:e[1]},F4=!((vf=" ".codePointAt)===null||vf===void 0||!vf.call(" ",0)),Y4=function(i){if(i.key&&F4&&i.key.codePointAt(0)===i.keyCode)return i.key;{let e;if(i.which===null?e=i.keyCode:i.which!==0&&i.charCode!==0&&(e=i.charCode),e!=null&&Zk[e]!=="escape")return sa.fromCodepoints([e]).toString()}},z4=function(i){const e=i.clipboardData;if(e){if(e.types.includes("text/html")){for(const t of e.types){const n=/^CorePasteboardFlavorType/.test(t),r=/^dyn\./.test(t)&&e.getData(t);if(n||r)return!0}return!1}{const t=e.types.includes("com.apple.webarchive"),n=e.types.includes("com.apple.flat-rtfd");return t||n}}};class Ar extends Kt{constructor(e){super(...arguments),this.inputController=e,this.responder=this.inputController.responder,this.delegate=this.inputController.delegate,this.inputSummary=this.inputController.inputSummary,this.data={}}start(e){if(this.data.start=e,this.isSignificant()){var t,n;this.inputSummary.eventName==="keypress"&&this.inputSummary.textAdded&&((n=this.responder)===null||n===void 0||n.deleteInDirection("left")),this.selectionIsExpanded()||(this.insertPlaceholder(),this.requestRender()),this.range=(t=this.responder)===null||t===void 0?void 0:t.getSelectedRange()}}update(e){if(this.data.update=e,this.isSignificant()){const t=this.selectPlaceholder();t&&(this.forgetPlaceholder(),this.range=t)}}end(e){return this.data.end=e,this.isSignificant()?(this.forgetPlaceholder(),this.canApplyToDocument()?(this.setInputSummary({preferDocument:!0,didInput:!1}),(t=this.delegate)===null||t===void 0||t.inputControllerWillPerformTyping(),(n=this.responder)===null||n===void 0||n.setSelectedRange(this.range),(r=this.responder)===null||r===void 0||r.insertString(this.data.end),(s=this.responder)===null||s===void 0?void 0:s.setSelectedRange(this.range[0]+this.data.end.length)):this.data.start!=null||this.data.update!=null?(this.requestReparse(),this.inputController.reset()):void 0):this.inputController.reset();var t,n,r,s}getEndData(){return this.data.end}isEnded(){return this.getEndData()!=null}isSignificant(){return!B4.composesExistingText||this.inputSummary.didInput}canApplyToDocument(){var e,t;return((e=this.data.start)===null||e===void 0?void 0:e.length)===0&&((t=this.data.end)===null||t===void 0?void 0:t.length)>0&&this.range}}Ar.proxyMethod("inputController.setInputSummary"),Ar.proxyMethod("inputController.requestRender"),Ar.proxyMethod("inputController.requestReparse"),Ar.proxyMethod("responder?.selectionIsExpanded"),Ar.proxyMethod("responder?.insertPlaceholder"),Ar.proxyMethod("responder?.selectPlaceholder"),Ar.proxyMethod("responder?.forgetPlaceholder");class Xl extends ch{constructor(){super(...arguments),this.render=this.render.bind(this)}elementDidMutate(){return this.scheduledRender?this.composing?(e=this.delegate)===null||e===void 0||(t=e.inputControllerDidAllowUnhandledInput)===null||t===void 0?void 0:t.call(e):void 0:this.reparse();var e,t}scheduleRender(){return this.scheduledRender?this.scheduledRender:this.scheduledRender=requestAnimationFrame(this.render)}render(){var e,t;cancelAnimationFrame(this.scheduledRender),this.scheduledRender=null,this.composing||(t=this.delegate)===null||t===void 0||t.render(),(e=this.afterRender)===null||e===void 0||e.call(this),this.afterRender=null}reparse(){var e;return(e=this.delegate)===null||e===void 0?void 0:e.reparse()}insertString(){var e;let t=arguments.length>0&&arguments[0]!==void 0?arguments[0]:"",n=arguments.length>1?arguments[1]:void 0;return(e=this.delegate)===null||e===void 0||e.inputControllerWillPerformTyping(),this.withTargetDOMRange(function(){var r;return(r=this.responder)===null||r===void 0?void 0:r.insertString(t,n)})}toggleAttributeIfSupported(e){var t;if(Pd().includes(e))return(t=this.delegate)===null||t===void 0||t.inputControllerWillPerformFormatting(e),this.withTargetDOMRange(function(){var n;return(n=this.responder)===nul
Line truncated
|
||||
`)},insertLink(){return this.activateAttributeIfSupported("href",this.event.data)},insertOrderedList(){return this.toggleAttributeIfSupported("number")},insertParagraph(){var i;return(i=this.delegate)===null||i===void 0||i.inputControllerWillPerformTyping(),this.withTargetDOMRange(function(){var e;return(e=this.responder)===null||e===void 0?void 0:e.insertLineBreak()})},insertReplacementText(){const i=this.event.dataTransfer.getData("text/plain"),e=this.event.getTargetRanges()[0];this.withTargetDOMRange(e,()=>{this.insertString(i,{updatePosition:!1})})},insertText(){var i;return this.insertString(this.event.data||((i=this.event.dataTransfer)===null||i===void 0?void 0:i.getData("text/plain")))},insertTranspose(){return this.insertString(this.event.data)},insertUnorderedList(){return this.toggleAttributeIfSupported("bullet")}});const V4=function(i){const e=document.createRange();return e.setStart(i.startContainer,i.startOffset),e.setEnd(i.endContainer,i.endOffset),e},wf=i=>{var e;return Array.from(((e=i.dataTransfer)===null||e===void 0?void 0:e.types)||[]).includes("Files")},U4=i=>{var e;return((e=i.dataTransfer.files)===null||e===void 0?void 0:e[0])&&!Bk(i)&&!(t=>{let{dataTransfer:n}=t;return n.types.includes("Files")&&n.types.includes("text/html")&&n.getData("text/html").includes("urn:schemas-microsoft-com:office:office")})(i)},Bk=function(i){const e=i.clipboardData;if(e)return Array.from(e.types).filter(t=>t.match(/file/i)).length===e.types.length&&e.files.length>=1},j4=function(i){const e=i.clipboardData;if(e)return e.types.includes("text/plain")&&e.types.length===1},q4=function(i){const e=[];return i.altKey&&e.push("alt"),i.shiftKey&&e.push("shift"),e.push(i.key),e},yf=i=>({x:i.clientX,y:i.clientY}),Dd="[data-trix-attribute]",$d="[data-trix-action]",G4="".concat(Dd,", ").concat($d),uh="[data-trix-dialog]",H4="".concat(uh,"[data-trix-active]"),K4="".concat(uh," [data-trix-method]"),m0="".concat(uh," [data-trix-input]"),p0=(i,e)=>(e||(e=Js(i)),i.querySelector("[data-trix-input][name='".concat(e,"']"))),g0=i=>i.getAttribute("data-trix-action"),Js=i=>i.getAttribute("data-trix-attribute")||i.getAttribute("data-trix-dialog-attribute");class Wk extends Kt{constructor(e){super(e),this.didClickActionButton=this.didClickActionButton.bind(this),this.didClickAttributeButton=this.didClickAttributeButton.bind(this),this.didClickDialogButton=this.didClickDialogButton.bind(this),this.didKeyDownDialogInput=this.didKeyDownDialogInput.bind(this),this.element=e,this.attributes={},this.actions={},this.resetDialogInputs(),Zt("mousedown",{onElement:this.element,matchingSelector:$d,withCallback:this.didClickActionButton}),Zt("mousedown",{onElement:this.element,matchingSelector:Dd,withCallback:this.didClickAttributeButton}),Zt("click",{onElement:this.element,matchingSelector:G4,preventDefault:!0}),Zt("click",{onElement:this.element,matchingSelector:K4,withCallback:this.didClickDialogButton}),Zt("keydown",{onElement:this.element,matchingSelector:m0,withCallback:this.didKeyDownDialogInput})}didClickActionButton(e,t){var n;(n=this.delegate)===null||n===void 0||n.toolbarDidClickButton(),e.preventDefault();const r=g0(t);return this.getDialog(r)?this.toggleDialog(r):(s=this.delegate)===null||s===void 0?void 0:s.toolbarDidInvokeAction(r,t);var s}didClickAttributeButton(e,t){var n;(n=this.delegate)===null||n===void 0||n.toolbarDidClickButton(),e.preventDefault();const r=Js(t);var s;return this.getDialog(r)?this.toggleDialog(r):(s=this.delegate)===null||s===void 0||s.toolbarDidToggleAttribute(r),this.refreshAttributeButtons()}didClickDialogButton(e,t){const n=Yr(t,{matchingSelector:uh});return this[t.getAttribute("data-trix-method")].call(this,n)}didKeyDownDialogInput(e,t){if(e.keyCode===13){e.preventDefault();const n=t.getAttribute("name"),r=this.getDialog(n);this.setAttribute(r)}if(e.keyCode===27)return e.preventDefault(),this.hideDialog()}updateActions(e){return this.actions=e,this.refreshActionButtons()}refreshActionButtons(){return this.eachActionButton((e,t)=>{e.disabled=this.actions[t]===!1})}eachActionButton(e){return Array.from(this.element.querySelectorAll($d)).map(t=>e(t,g0(t)))}updateAttributes(e){return this.attributes=e,this.refreshAttributeButtons()}refreshAttributeButtons(){return this.eachAttributeButton((e,t)=>(e.disabled=this.attributes[t]===!1,this.attributes[t]||this.dialogIsVisible(t)?(e.setAttribute("data-trix-active",""),e.classList.add("trix-active")):(e.removeAttribute("data-trix-active"),e.classList.remove("trix-active"))))}eachAttributeButton(e){return Array.from(this.element.querySelectorAll(Dd)).map(t=>e(t,Js(t)))}applyKeyboardCommand(e){const t=JSON.stringify(e.sort());for(const n of Array.from(this.element.querySelectorAll("[data-trix-key]"))){const r=n.getAttribute("data-trix-key").split("+");if(JSON.stringify(r.sort())===t)return Il("mousedown",{onElement:n}),!0}return!1}dialogIsVisible(e){const t=this.getDialog(e);if(t)return t.hasAttribute("data-trix-active")}toggleDialog(e){return this.dialogIsVisibl
Line truncated
|
||||
display: block;
|
||||
}
|
||||
|
||||
%t {
|
||||
white-space: nowrap;
|
||||
}
|
||||
|
||||
%t [data-trix-dialog] {
|
||||
display: none;
|
||||
}
|
||||
|
||||
%t [data-trix-dialog][data-trix-active] {
|
||||
display: block;
|
||||
}
|
||||
|
||||
%t [data-trix-dialog] [data-trix-validate]:invalid {
|
||||
background-color: #ffdddd;
|
||||
}`);class Xk extends HTMLElement{connectedCallback(){this.innerHTML===""&&(this.innerHTML=ik.getDefaultHTML())}get editorElements(){if(this.id){var e;const t=(e=this.ownerDocument)===null||e===void 0?void 0:e.querySelectorAll('trix-editor[toolbar="'.concat(this.id,'"]'));return Array.from(t)}return[]}get editorElement(){const[e]=this.editorElements;return e}}let nD=0;const iD=function(i){if(!i.hasAttribute("contenteditable"))return i.toggleAttribute("contenteditable",!i.disabled),function(e){let t=arguments.length>1&&arguments[1]!==void 0?arguments[1]:{};return t.times=1,Zt(e,t)}("focus",{onElement:i,withCallback:()=>rD(i)})},rD=function(i){return sD(i),oD()},sD=function(i){var e,t;if((e=(t=document).queryCommandSupported)!==null&&e!==void 0&&e.call(t,"enableObjectResizing"))return document.execCommand("enableObjectResizing",!1,!1),Zt("mscontrolselect",{onElement:i,preventDefault:!0})},oD=function(i){var e,t;if((e=(t=document).queryCommandSupported)!==null&&e!==void 0&&e.call(t,"DefaultParagraphSeparator")){const{tagName:n}=Sn.default;if(["div","p"].includes(n))return document.execCommand("DefaultParagraphSeparator",!1,n)}},O0=Da.forcesObjectResizing?{display:"inline",width:"auto"}:{display:"inline-block",width:"1px"};rk("trix-editor",`%t {
|
||||
display: block;
|
||||
}
|
||||
|
||||
%t:empty::before {
|
||||
content: attr(placeholder);
|
||||
color: graytext;
|
||||
cursor: text;
|
||||
pointer-events: none;
|
||||
white-space: pre-line;
|
||||
}
|
||||
|
||||
%t a[contenteditable=false] {
|
||||
cursor: text;
|
||||
}
|
||||
|
||||
%t img {
|
||||
max-width: 100%;
|
||||
height: auto;
|
||||
}
|
||||
|
||||
%t `.concat(_s,` figcaption textarea {
|
||||
resize: none;
|
||||
}
|
||||
|
||||
%t `).concat(_s,` figcaption textarea.trix-autoresize-clone {
|
||||
position: absolute;
|
||||
left: -9999px;
|
||||
max-height: 0px;
|
||||
}
|
||||
|
||||
%t `).concat(_s,` figcaption[data-trix-placeholder]:empty::before {
|
||||
content: attr(data-trix-placeholder);
|
||||
color: graytext;
|
||||
}
|
||||
|
||||
%t [data-trix-cursor-target] {
|
||||
display: `).concat(O0.display,` !important;
|
||||
width: `).concat(O0.width,` !important;
|
||||
padding: 0 !important;
|
||||
margin: 0 !important;
|
||||
border: none !important;
|
||||
}
|
||||
|
||||
%t [data-trix-cursor-target=left] {
|
||||
vertical-align: top !important;
|
||||
margin-left: -1px !important;
|
||||
}
|
||||
|
||||
%t [data-trix-cursor-target=right] {
|
||||
vertical-align: bottom !important;
|
||||
margin-right: -1px !important;
|
||||
}`));var wi=new WeakMap,ac=new WeakMap,cl=new WeakSet;class lD{constructor(e){var t,n;wk(t=this,n=cl),n.add(t),gn(this,"value",""),po(this,wi,{writable:!0,value:void 0}),po(this,ac,{writable:!0,value:void 0}),this.element=e,Wl(this,wi,e.attachInternals()),Wl(this,ac,!1)}connectedCallback(){lc(this,cl,cc).call(this)}disconnectedCallback(){}get form(){return it(this,wi).form}get name(){return this.element.getAttribute("name")}set name(e){this.element.setAttribute("name",e)}get labels(){return it(this,wi).labels}get disabled(){return it(this,ac)||this.element.hasAttribute("disabled")}set disabled(e){this.element.toggleAttribute("disabled",e)}get required(){return this.element.hasAttribute("required")}set required(e){this.element.toggleAttribute("required",e),lc(this,cl,cc).call(this)}get validity(){return it(this,wi).validity}get validationMessage(){return it(this,wi).validationMessage}get willValidate(){return it(this,wi).willValidate}formDisabledCallback(e){Wl(this,ac,e)}setFormValue(e){this.value=e,lc(this,cl,cc).call(this),it(this,wi).setFormValue(this.element.disabled?void 0:this.value)}checkValidity(){return it(this,wi).checkValidity()}reportValidity(){return it(this,wi).reportValidity()}setCustomValidity(e){lc(this,cl,cc).call(this,e)}}function cc(){let i=arguments.length>0&&arguments[0]!==void 0?arguments[0]:"";const{required:e,value:t}=this.element,n=e&&!t,r=!!i,s=Ge("input",{required:e}),o=i||s.validationMessage;it(this,wi).setValidity({valueMissing:n,customError:r},o)}var kf=new WeakMap,Sf=new WeakMap,_f=new WeakMap;class aD{constructor(e){po(this,kf,{writable:!0,value:void 0}),po(this,Sf,{writable:!0,value:t=>{t.defaultPrevented||t.target===this.element.form&&this.element.reset()}}),po(this,_f,{writable:!0,value:t=>{if(t.defaultPrevented||this.element.contains(t.target))return;const n=Yr(t.target,{matchingSelector:"label"});n&&Array.from(this.labels).includes(n)&&this.element.focus()}}),this.element=e}connectedCallback(){Wl(this,kf,function(e){if(e.hasAttribute("aria-label")||e.hasAttribute("aria-labelledby"))return;const t=function(){const n=Array.from(e.labels).map(s=>{if(!s.contains(e))return s.textContent}).filter(s=>s),r=n.join(" ");return r?e.setAttribute("aria-label",r):e.removeAttribute("aria-label")};return t(),Zt("focus",{onElement:e,withCallback:t})}(this.element)),window.addEventListener("reset",it(this,Sf),!1),window.addEventListener("click",it(this,_f),!1)}disconnectedCallback(){var e;(e=it(this,kf))===null||e===void 0||e.destroy(),window.removeEventListener("reset",it(this,Sf),!1),window.removeEventListener("click",it(this,_f),!1)}get labels(){const e=[];this.element.id&&this.element.ownerDocument&&e.push(...Array.from(this.element.ownerDocument.querySelectorAll("label[for='".concat(this.element.id,"']"))||[]));const t=Yr(this.element,{matchingSelector:"label"});return t&&[this.element,null].includes(t.control)&&e.push(t),e}get form(){return console.warn("This browser does not support the .form property for trix-editor elements."),null}get name(){return console.warn("This browser does not support the .name property for trix-editor elements."),null}set name(e){console.warn("This browser does not support the .name property for trix-editor elements.")}get disabled(){return console.warn("This browser does not support the [disabled] attribute for trix-editor elements."),!1}set disabled(e){console.warn("This browser does not support the [disabled] attribute for trix-editor elements.")}get required(){return console.warn("This browser does not support the [required] attribute for trix-editor elements."),!1}set required(e){console.warn("This browser does not support the [required] attribute for trix-editor elements.")}get validity(){return console.warn("This browser does not support the validity property for trix-editor elements."),null}get validationMessage(){return console.warn("This browser does not support the validationMessage property for trix-editor elements."),""}get willValidate(){return console.warn("This browser does not support the willValidate property for trix-editor elements."),!1}formDisabledCallback(e){}setFormValue(e){}checkValidity(){return console.warn("This browser does not support checkValidity() for trix-editor elements."),!0}reportValidity(){return console.warn("This browser does not support reportValidity() for trix-editor elements."),!0}setCustomValidity(e){console.warn("This browser does not support setCustomValidity(validationMessage) for trix-editor elements.")}}var Xt=new WeakMap;class Su extends HTMLElement{constructor(){super(),po(this,Xt,{writable:!0,value:void 0}),this.willCreateInput=!0,Wl(this,Xt,this.constructor.formAssociated?new lD(this):new aD(this))}get trixId(){return this.hasAttribute("trix-id")?this.getAttribute("trix-id"):(this.setAttribute("trix-id",++nD),this.trixId)}get labels(){return it(this,Xt).labels}get disabled(){const{inputElement:e}=this;return e?e.disabled:it(this,Xt).disabled}set disabled(e){const{inputElement:t}=this;t&&(t.disabled=e
Line truncated
|
||||
`){[e,t]=To(this,e,t);let r="";for(let s=0,o=0;s<=t&&o<this.text.length;o++){let l=this.text[o],a=s+l.length;s>e&&o&&(r+=n),e<a&&t>s&&(r+=l.slice(Math.max(0,e-s),t-s)),s=a+1}return r}flatten(e){for(let t of this.text)e.push(t)}scanIdentical(){return 0}static split(e,t){let n=[],r=-1;for(let s of e)n.push(s),r+=s.length+1,n.length==32&&(t.push(new Ft(n,r)),n=[],r=-1);return r>-1&&t.push(new Ft(n,r)),t}}class Ni extends at{constructor(e,t){super(),this.children=e,this.length=t,this.lines=0;for(let n of e)this.lines+=n.lines}lineInner(e,t,n,r){for(let s=0;;s++){let o=this.children[s],l=r+o.length,a=n+o.lines-1;if((t?a:l)>=e)return o.lineInner(e,t,n,r);r=l+1,n=a+1}}decompose(e,t,n,r){for(let s=0,o=0;o<=t&&s<this.children.length;s++){let l=this.children[s],a=o+l.length;if(e<=a&&t>=o){let c=r&((o<=e?1:0)|(a>=t?2:0));o>=e&&a<=t&&!c?n.push(l):l.decompose(e-o,t-o,n,c)}o=a+1}}replace(e,t,n){if([e,t]=To(this,e,t),n.lines<this.lines)for(let r=0,s=0;r<this.children.length;r++){let o=this.children[r],l=s+o.length;if(e>=s&&t<=l){let a=o.replace(e-s,t-s,n),c=this.lines-o.lines+a.lines;if(a.lines<c>>4&&a.lines>c>>6){let u=this.children.slice();return u[r]=a,new Ni(u,this.length-(t-e)+n.length)}return super.replace(s,l,a)}s=l+1}return super.replace(e,t,n)}sliceString(e,t=this.length,n=`
|
||||
`){[e,t]=To(this,e,t);let r="";for(let s=0,o=0;s<this.children.length&&o<=t;s++){let l=this.children[s],a=o+l.length;o>e&&s&&(r+=n),e<a&&t>o&&(r+=l.sliceString(e-o,t-o,n)),o=a+1}return r}flatten(e){for(let t of this.children)t.flatten(e)}scanIdentical(e,t){if(!(e instanceof Ni))return 0;let n=0,[r,s,o,l]=t>0?[0,0,this.children.length,e.children.length]:[this.children.length-1,e.children.length-1,-1,-1];for(;;r+=t,s+=t){if(r==o||s==l)return n;let a=this.children[r],c=e.children[s];if(a!=c)return n+a.scanIdentical(c,t);n+=a.length+1}}static from(e,t=e.reduce((n,r)=>n+r.length+1,-1)){let n=0;for(let d of e)n+=d.lines;if(n<32){let d=[];for(let m of e)m.flatten(d);return new Ft(d,t)}let r=Math.max(32,n>>5),s=r<<1,o=r>>1,l=[],a=0,c=-1,u=[];function h(d){let m;if(d.lines>s&&d instanceof Ni)for(let p of d.children)h(p);else d.lines>o&&(a>o||!a)?(f(),l.push(d)):d instanceof Ft&&a&&(m=u[u.length-1])instanceof Ft&&d.lines+m.lines<=32?(a+=d.lines,c+=d.length+1,u[u.length-1]=new Ft(m.text.concat(d.text),m.length+1+d.length)):(a+d.lines>r&&f(),a+=d.lines,c+=d.length+1,u.push(d))}function f(){a!=0&&(l.push(u.length==1?u[0]:Ni.from(u,c)),c=-1,a=u.length=0)}for(let d of e)h(d);return f(),l.length==1?l[0]:new Ni(l,t)}}at.empty=new Ft([""],0);function mD(i){let e=-1;for(let t of i)e+=t.length+1;return e}function Vc(i,e,t=0,n=1e9){for(let r=0,s=0,o=!0;s<i.length&&r<=n;s++){let l=i[s],a=r+l.length;a>=t&&(a>n&&(l=l.slice(0,n-r)),r<t&&(l=l.slice(t-r)),o?(e[e.length-1]+=l,o=!1):e.push(l)),r=a+1}return e}function v0(i,e,t){return Vc(i,[""],e,t)}class Yl{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 Ft?e.text.length:e.children.length)<<1]}nextInner(e,t){for(this.done=this.lineBreak=!1;;){let n=this.nodes.length-1,r=this.nodes[n],s=this.offsets[n],o=s>>1,l=r instanceof Ft?r.text.length:r.children.length;if(o==(t>0?l:0)){if(n==0)return this.done=!0,this.value="",this;t>0&&this.offsets[n-1]++,this.nodes.pop(),this.offsets.pop()}else if((s&1)==(t>0?0:1)){if(this.offsets[n]+=t,e==0)return this.lineBreak=!0,this.value=`
|
||||
`,this;e--}else if(r instanceof Ft){let a=r.text[o+(t<0?-1:0)];if(this.offsets[n]+=t,a.length>Math.max(0,e))return this.value=e==0?a:t>0?a.slice(e):a.slice(0,a.length-e),this;e-=a.length}else{let a=r.children[o+(t<0?-1:0)];e>a.length?(e-=a.length,this.offsets[n]+=t):(t<0&&this.offsets[n]--,this.nodes.push(a),this.offsets.push(t>0?1:(a instanceof Ft?a.text.length:a.children.length)<<1))}}}next(e=0){return e<0&&(this.nextInner(-e,-this.dir),e=this.value.length),this.nextInner(e,this.dir)}}class Yk{constructor(e,t,n){this.value="",this.done=!1,this.cursor=new Yl(e,t>n?-1:1),this.pos=t>n?e.length:0,this.from=Math.min(t,n),this.to=Math.max(t,n)}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 n=t<0?this.pos-this.from:this.to-this.pos;e>n&&(e=n),n-=e;let{value:r}=this.cursor.next(e);return this.pos+=(r.length+e)*t,this.value=r.length<=n?r:t<0?r.slice(r.length-n):r.slice(0,n),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!=""}}class zk{constructor(e){this.inner=e,this.afterBreak=!0,this.value="",this.done=!1}next(e=0){let{done:t,lineBreak:n,value:r}=this.inner.next(e);return t&&this.afterBreak?(this.value="",this.afterBreak=!1):t?(this.done=!0,this.value=""):n?this.afterBreak?this.value="":(this.afterBreak=!0,this.next()):(this.value=r,this.afterBreak=!1),this}get lineBreak(){return!1}}typeof Symbol<"u"&&(at.prototype[Symbol.iterator]=function(){return this.iter()},Yl.prototype[Symbol.iterator]=Yk.prototype[Symbol.iterator]=zk.prototype[Symbol.iterator]=function(){return this});let pD=class{constructor(e,t,n,r){this.from=e,this.to=t,this.number=n,this.text=r}get length(){return this.to-this.from}};function To(i,e,t){return e=Math.max(0,Math.min(i.length,e)),[e,Math.max(e,Math.min(i.length,t))]}let go="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(i=>i?parseInt(i,36):1);for(let i=1;i<go.length;i++)go[i]+=go[i-1];function gD(i){for(let e=1;e<go.length;e+=2)if(go[e]>i)return go[e-1]<=i;return!1}function w0(i){return i>=127462&&i<=127487}const y0=8205;function hn(i,e,t=!0,n=!0){return(t?Vk:OD)(i,e,n)}function Vk(i,e,t){if(e==i.length)return e;e&&Uk(i.charCodeAt(e))&&jk(i.charCodeAt(e-1))&&e--;let n=ln(i,e);for(e+=oi(n);e<i.length;){let r=ln(i,e);if(n==y0||r==y0||t&&gD(r))e+=oi(r),n=r;else if(w0(r)){let s=0,o=e-2;for(;o>=0&&w0(ln(i,o));)s++,o-=2;if(s%2==0)break;e+=2}else break}return e}function OD(i,e,t){for(;e>0;){let n=Vk(i,e-2,t);if(n<e)return n;e--}return 0}function Uk(i){return i>=56320&&i<57344}function jk(i){return i>=55296&&i<56320}function ln(i,e){let t=i.charCodeAt(e);if(!jk(t)||e+1==i.length)return t;let n=i.charCodeAt(e+1);return Uk(n)?(t-55296<<10)+(n-56320)+65536:t}function sp(i){return i<=65535?String.fromCharCode(i):(i-=65536,String.fromCharCode((i>>10)+55296,(i&1023)+56320))}function oi(i){return i<65536?1:2}const Ld=/\r\n?|\n/;var cn=function(i){return i[i.Simple=0]="Simple",i[i.TrackDel=1]="TrackDel",i[i.TrackBefore=2]="TrackBefore",i[i.TrackAfter=3]="TrackAfter",i}(cn||(cn={}));class ji{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 n=this.sections[t+1];e+=n<0?this.sections[t]:n}return e}get empty(){return this.sections.length==0||this.sections.length==2&&this.sections[1]<0}iterGaps(e){for(let t=0,n=0,r=0;t<this.sections.length;){let s=this.sections[t++],o=this.sections[t++];o<0?(e(n,r,s),r+=s):r+=o,n+=s}}iterChangedRan
Line truncated
|
||||
`}get readOnly(){return this.facet(iS)}phrase(e,...t){for(let n of this.facet(et.phrases))if(Object.prototype.hasOwnProperty.call(n,e)){e=n[e];break}return t.length&&(e=e.replace(/\$(\$|\d*)/g,(n,r)=>{if(r=="$")return"$";let s=+(r||1);return!s||s>t.length?n:t[s-1]})),e}languageDataAt(e,t,n=-1){let r=[];for(let s of this.facet(Kk))for(let o of s(this,t,n))Object.prototype.hasOwnProperty.call(o,e)&&r.push(o[e]);return r}charCategorizer(e){return xD(this.languageDataAt("wordChars",e).join(""))}wordAt(e){let{text:t,from:n,length:r}=this.doc.lineAt(e),s=this.charCategorizer(e),o=e-n,l=e-n;for(;o>0;){let a=hn(t,o,!1);if(s(t.slice(a,o))!=$t.Word)break;o=a}for(;l<r;){let a=hn(t,l);if(s(t.slice(l,a))!=$t.Word)break;l=a}return o==l?null:q.range(o+n,l+n)}}et.allowMultipleSelections=Wd;et.tabSize=ye.define({combine:i=>i.length?i[0]:4});et.lineSeparator=Jk;et.readOnly=iS;et.phrases=ye.define({compare(i,e){let t=Object.keys(i),n=Object.keys(e);return t.length==n.length&&t.every(r=>i[r]==e[r])}});et.languageData=Kk;et.changeFilter=eS;et.transactionFilter=tS;et.transactionExtender=nS;Vr.reconfigure=Fe.define();function Qi(i,e,t={}){let n={};for(let r of i)for(let s of Object.keys(r)){let o=r[s],l=n[s];if(l===void 0)n[s]=o;else if(!(l===o||o===void 0))if(Object.hasOwnProperty.call(t,s))n[s]=t[s](l,o);else throw new Error("Config merge conflict for field "+s)}for(let r in e)n[r]===void 0&&(n[r]=e[r]);return n}class Ms{eq(e){return this==e}range(e,t=e){return Yd.create(e,t,this)}}Ms.prototype.startSide=Ms.prototype.endSide=0;Ms.prototype.point=!1;Ms.prototype.mapMode=cn.TrackDel;let Yd=class oS{constructor(e,t,n){this.from=e,this.to=t,this.value=n}static create(e,t,n){return new oS(e,t,n)}};function zd(i,e){return i.from-e.from||i.value.startSide-e.value.startSide}class ap{constructor(e,t,n,r){this.from=e,this.to=t,this.value=n,this.maxPoint=r}get length(){return this.to[this.to.length-1]}findIndex(e,t,n,r=0){let s=n?this.to:this.from;for(let o=r,l=s.length;;){if(o==l)return o;let a=o+l>>1,c=s[a]-e||(n?this.value[a].endSide:this.value[a].startSide)-t;if(a==o)return c>=0?o:l;c>=0?l=a:o=a+1}}between(e,t,n,r){for(let s=this.findIndex(t,-1e9,!0),o=this.findIndex(n,1e9,!1,s);s<o;s++)if(r(this.from[s]+e,this.to[s]+e,this.value[s])===!1)return!1}map(e,t){let n=[],r=[],s=[],o=-1,l=-1;for(let a=0;a<this.value.length;a++){let c=this.value[a],u=this.from[a]+e,h=this.to[a]+e,f,d;if(u==h){let m=t.mapPos(u,c.startSide,c.mapMode);if(m==null||(f=d=m,c.startSide!=c.endSide&&(d=t.mapPos(u,c.endSide),d<f)))continue}else if(f=t.mapPos(u,c.startSide),d=t.mapPos(h,c.endSide),f>d||f==d&&c.startSide>0&&c.endSide<=0)continue;(d-f||c.endSide-c.startSide)<0||(o<0&&(o=f),c.point&&(l=Math.max(l,d-f)),n.push(c),r.push(f-o),s.push(d-o))}return{mapped:n.length?new ap(r,s,n,l):null,pos:o}}}class tt{constructor(e,t,n,r){this.chunkPos=e,this.chunk=t,this.nextLayer=n,this.maxPoint=r}static create(e,t,n,r){return new tt(e,t,n,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:n=!1,filterFrom:r=0,filterTo:s=this.length}=e,o=e.filter;if(t.length==0&&!o)return this;if(n&&(t=t.slice().sort(zd)),this.isEmpty)return t.length?tt.of(t):this;let l=new lS(this,null,-1).goto(0),a=0,c=[],u=new Ur;for(;l.value||a<t.length;)if(a<t.length&&(l.from-t[a].from||l.startSide-t[a].value.startSide)>=0){let h=t[a++];u.addInner(h.from,h.to,h.value)||c.push(h)}else l.rangeIndex==1&&l.chunkIndex<this.chunk.length&&(a==t.length||this.chunkEnd(l.chunkIndex)<t[a].from)&&(!o||r>this.chunkEnd(l.chunkIndex)||s<this.chunkPos[l.chunkIndex])&&u.addChunk(this.chunkPos[l.chunkIndex],this.chunk[l.chunkIndex])?l.nextChunk():((!o||r>l.to||s<l.from||o(l.from,l.to,l.value))&&(u.addInner(l.from,l.to,l.value)||c.push(Yd.create(l.from,l.to,l.value))),l.next());return u.finishInner(this.nextLayer.isEmpty&&!c.length?tt.empty:this.nextLayer.update({add:c,filter:o,filterFrom:r,filterTo:s}))}map(e){if(e.empty||this.isEmpty)return this;let t=[],n=[],r=-1;for(let o=0;o<this.chunk.length;o++){let l=this.chunkPos[o],a=this.chunk[o],c=e.touchesRange(l,l+a.length);if(c===!1)r=Math.max(r,a.maxPoint),t.push(a),n.push(e.mapPos(l));else if(c===!0){let{mapped:u,pos:h}=a.map(l,e);u&&(r=Math.max(r,u.maxPoint),t.push(u),n.push(h))}}let s=this.nextLayer.map(e);return t.length==0?s:new tt(n,t,s||tt.empty,r)}between(e,t,n){if(!this.isEmpty){for(let r=0;r<this.chunk.length;r++){let s=this.chunkPos[r],o=this.chunk[r];if(t>=s&&e<=s+o.length&&o.between(s,e-s,t-s,n)===!1)return}this.nextLayer.between(e,t,n)}}iter(e=0){return aa.from([this]).goto(e)}get isEmpty(){return this.nextLayer==this}static iter(e,t=0){return aa.from(e).goto(t)}static compare(e,t,n,r,s=-1){let o=e.filter(h=>h.maxPoint>0||!h.isEmpty&&h.maxPoint>=s),l=t.filter(h=>h.maxPoint>0||!h.isEmpty&&h.maxPoint>=s),a=_0(o,l,n)
Line truncated
|
||||
`)}static newName(){let e=x0[A0]||1;return x0[A0]=e+1,jd+e.toString(36)}static mount(e,t,n){let r=e[qd],s=n&&n.nonce;r?s&&r.setNonce(s):r=new QD(e,s),r.mount(Array.isArray(t)?t:[t],e)}}let T0=new Map;class QD{constructor(e,t){let n=e.ownerDocument||e,r=n.defaultView;if(!e.head&&e.adoptedStyleSheets&&r.CSSStyleSheet){let s=T0.get(n);if(s)return e[qd]=s;this.sheet=new r.CSSStyleSheet,T0.set(n,this)}else this.styleTag=n.createElement("style"),t&&this.styleTag.setAttribute("nonce",t);this.modules=[],e[qd]=this}mount(e,t){let n=this.sheet,r=0,s=0;for(let o=0;o<e.length;o++){let l=e[o],a=this.modules.indexOf(l);if(a<s&&a>-1&&(this.modules.splice(a,1),s--,a=-1),a==-1){if(this.modules.splice(s++,0,l),n)for(let c=0;c<l.rules.length;c++)n.insertRule(l.rules[c],r++)}else{for(;s<a;)r+=this.modules[s++].rules.length;r+=l.rules.length,s++}}if(n)t.adoptedStyleSheets.indexOf(this.sheet)<0&&(t.adoptedStyleSheets=[this.sheet,...t.adoptedStyleSheets]);else{let o="";for(let a=0;a<this.modules.length;a++)o+=this.modules[a].getRules()+`
|
||||
`;this.styleTag.textContent=o;let l=t.head||t;this.styleTag.parentNode!=l&&l.insertBefore(this.styleTag,l.firstChild)}}setNonce(e){this.styleTag&&this.styleTag.getAttribute("nonce")!=e&&this.styleTag.setAttribute("nonce",e)}}var qr={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:"'"},ca={48:")",49:"!",50:"@",51:"#",52:"$",53:"%",54:"^",55:"&",56:"*",57:"(",59:":",61:"+",173:"_",186:":",187:"+",188:"<",189:"_",190:">",191:"?",192:"~",219:"{",220:"|",221:"}",222:'"'},MD=typeof navigator<"u"&&/Mac/.test(navigator.platform),ED=typeof navigator<"u"&&/MSIE \d|Trident\/(?:[7-9]|\d{2,})\..*rv:(\d+)/.exec(navigator.userAgent);for(var an=0;an<10;an++)qr[48+an]=qr[96+an]=String(an);for(var an=1;an<=24;an++)qr[an+111]="F"+an;for(var an=65;an<=90;an++)qr[an]=String.fromCharCode(an+32),ca[an]=String.fromCharCode(an);for(var Pf in qr)ca.hasOwnProperty(Pf)||(ca[Pf]=qr[Pf]);function RD(i){var e=MD&&i.metaKey&&i.shiftKey&&!i.ctrlKey&&!i.altKey||ED&&i.shiftKey&&i.key&&i.key.length==1||i.key=="Unidentified",t=!e&&i.key||(i.shiftKey?ca:qr)[i.keyCode]||i.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 ua(i){let e;return i.nodeType==11?e=i.getSelection?i:i.ownerDocument:e=i,e.getSelection()}function Gd(i,e){return e?i==e||i.contains(e.nodeType!=1?e.parentNode:e):!1}function DD(i){let e=i.activeElement;for(;e&&e.shadowRoot;)e=e.shadowRoot.activeElement;return e}function jc(i,e){if(!e.anchorNode)return!1;try{return Gd(i,e.anchorNode)}catch{return!1}}function ha(i){return i.nodeType==3?Rs(i,0,i.nodeValue.length).getClientRects():i.nodeType==1?i.getClientRects():[]}function Vl(i,e,t,n){return t?Q0(i,e,t,n,-1)||Q0(i,e,t,n,1):!1}function Es(i){for(var e=0;;e++)if(i=i.previousSibling,!i)return e}function Pu(i){return i.nodeType==1&&/^(DIV|P|LI|UL|OL|BLOCKQUOTE|DD|DT|H\d|SECTION|PRE)$/.test(i.nodeName)}function Q0(i,e,t,n,r){for(;;){if(i==t&&e==n)return!0;if(e==(r<0?0:dr(i))){if(i.nodeName=="DIV")return!1;let s=i.parentNode;if(!s||s.nodeType!=1)return!1;e=Es(i)+(r<0?0:1),i=s}else if(i.nodeType==1){if(i=i.childNodes[e+(r<0?-1:0)],i.nodeType==1&&i.contentEditable=="false")return!1;e=r<0?dr(i):0}else return!1}}function dr(i){return i.nodeType==3?i.nodeValue.length:i.childNodes.length}function hh(i,e){let t=e?i.left:i.right;return{left:t,right:t,top:i.top,bottom:i.bottom}}function $D(i){let e=i.visualViewport;return e?{left:0,right:e.width,top:0,bottom:e.height}:{left:0,right:i.innerWidth,top:0,bottom:i.innerHeight}}function aS(i,e){let t=e.width/i.offsetWidth,n=e.height/i.offsetHeight;return(t>.995&&t<1.005||!isFinite(t)||Math.abs(e.width-i.offsetWidth)<1)&&(t=1),(n>.995&&n<1.005||!isFinite(n)||Math.abs(e.height-i.offsetHeight)<1)&&(n=1),{scaleX:t,scaleY:n}}function LD(i,e,t,n,r,s,o,l){let a=i.ownerDocument,c=a.defaultView||window;for(let u=i,h=!1;u&&!h;)if(u.nodeType==1){let f,d=u==a.body,m=1,p=1;if(d)f=$D(c);else{if(/^(fixed|sticky)$/.test(getComputedStyle(u).position)&&(h=!0),u.scrollHeight<=u.clientHeight&&u.scrollWidth<=u.clientWidth){u=u.assignedSlot||u.parentNode;continue}let w=u.getBoundingClientRect();({scaleX:m,scaleY:p}=aS(u,w)),f={left:w.left,right:w.left+u.clientWidth*m,top:w.top,bottom:w.top+u.clientHeight*p}}let g=0,v=0;if(r=="nearest")e.top<f.top?(v=-(f.top-e.top+o),t>0&&e.bottom>f.bottom+v&&(v=e.bottom-f.bottom+v+o)):e.bottom>f.bottom&&(v=e.bottom-f.bottom+o,t<0&&e.top-v<f.top&&(v=-(f.top+v-e.top+o)));else{let w=e.bottom-e.top,S=f.bottom-f.top;v=(r=="center"&&w<=S?e.top+w/2-S/2:r=="start"||r=="center"&&t<0?e.top-o:e.bottom-S+o)-f.top}if(n=="nearest"?e.left<f.left?(g=-(f.left-e.left+s),t>0&&e.right>f.right+g&&(g=e.right-f.right+g+s)):e.right>f.right&&(g=e.right-f.right+s,t<0&&e.left<f.left+g&&(g=-(f.left+g-e.left+s))):g=(n=="center"?e.left+(e.right-e.left)/2-(f.right-f.left)/2:n=="start"==l?e.left-s:e.right-(f.right-f.left)+s)-f.left,g||v)if(d)c.scrollBy(g,v);else{let w=0,S=0;if(v){let _=u.scrollTop;u.scrollTop+=v/p,S=(u.scrollTop-_)*p}if(g){let _=u.scrollLeft;u.scrollLeft+=g/m,w=(u.scrollLeft-_)*m}e={left:e.left-w,top:e.top-S,right:e.right-w,bottom:e.bottom-S},w&&Math.abs(w-g)<1&&(n="nearest"),S&&Math.abs(S-v)<1&&(r="nearest")}if(d)break;u=u.assignedSlot||u.parentNode}else if(u.nodeType==11)u=u.host;else break}function ID(i){let e=i.ownerDocument,t,n;for(let r=i.parentNode;r&&!(r==e.body||t&&n);)if(r.nodeType==1)!n&&r.scrollHeight>r.clientHeight&&(n=r),!t&&r.scrollWidth>r.clientWidth&&(t=r),r=rLine truncated
|
||||
`,r=i.state.doc.line(r.number+(t?1:-1)),s=i.bidiSpans(r),c=i.visualLineSide(r,!t)}if(a){if(!a(u))return l}else{if(!n)return c;a=n(u)}l=c}}function g5(i,e,t){let n=i.state.charCategorizer(e),r=n(t);return s=>{let o=n(s);return r==$t.Space&&(r=o),r==o}}function O5(i,e,t,n){let r=e.head,s=t?1:-1;if(r==(t?i.state.doc.length:0))return q.cursor(r,e.assoc);let o=e.goalColumn,l,a=i.contentDOM.getBoundingClientRect(),c=i.coordsAtPos(r,e.assoc||-1),u=i.documentTop;if(c)o==null&&(o=c.left-a.left),l=s<0?c.top:c.bottom;else{let d=i.viewState.lineBlockAt(r);o==null&&(o=Math.min(a.right-a.left,i.defaultCharacterWidth*(r-d.from))),l=(s<0?d.top:d.bottom)+u}let h=a.left+o,f=n??i.viewState.heightOracle.textHeight>>1;for(let d=0;;d+=10){let m=l+(f+d)*s,p=YS(i,{x:h,y:m},!1,s);if(m<a.top||m>a.bottom||(s<0?p<r:p>r)){let g=i.docView.coordsForChar(p),v=!g||m<g.top?-1:1;return q.cursor(p,v,void 0,o)}}}function qc(i,e,t){for(;;){let n=0;for(let r of i)r.between(e-1,e+1,(s,o,l)=>{if(e>s&&e<o){let a=n||t||(e-s<o-e?-1:1);e=a<0?s:o,n=a}});if(!n)return e}}function Qf(i,e,t){let n=qc(i.state.facet(fp).map(r=>r(i)),t.from,e.head>t.from?-1:1);return n==t.from?t:q.cursor(n,n<t.from?1:-1)}const Cl="";class b5{constructor(e,t){this.points=e,this.text="",this.lineSeparator=t.facet(et.lineSeparator)}append(e){this.text+=e}lineBreak(){this.text+=Cl}readRange(e,t){if(!e)return this;let n=e.parentNode;for(let r=e;;){this.findPointBefore(n,r);let s=this.text.length;this.readNode(r);let o=r.nextSibling;if(o==t)break;let l=St.get(r),a=St.get(o);(l&&a?l.breakAfter:(l?l.breakAfter:Pu(r))||Pu(o)&&(r.nodeName!="BR"||r.cmIgnore)&&this.text.length>s)&&this.lineBreak(),r=o}return this.findPointBefore(n,t),this}readTextNode(e){let t=e.nodeValue;for(let n of this.points)n.node==e&&(n.pos=this.text.length+Math.min(n.offset,t.length));for(let n=0,r=this.lineSeparator?null:/\r\n?|\n/g;;){let s=-1,o=1,l;if(this.lineSeparator?(s=t.indexOf(this.lineSeparator,n),o=this.lineSeparator.length):(l=r.exec(t))&&(s=l.index,o=l[0].length),this.append(t.slice(n,s<0?t.length:s)),s<0)break;if(this.lineBreak(),o>1)for(let a of this.points)a.node==e&&a.pos>this.text.length&&(a.pos-=o-1);n=s+o}}readNode(e){if(e.cmIgnore)return;let t=St.get(e),n=t&&t.overrideDOMText;if(n!=null){this.findPointInside(e,n.length);for(let r=n.iter();!r.next().done;)r.lineBreak?this.lineBreak():this.append(r.value)}else e.nodeType==3?this.readTextNode(e):e.nodeName=="BR"?e.nextSibling&&this.lineBreak():e.nodeType==1&&this.readRange(e.firstChild,null)}findPointBefore(e,t){for(let n of this.points)n.node==e&&e.childNodes[n.offset]==t&&(n.pos=this.text.length)}findPointInside(e,t){for(let n of this.points)(e.nodeType==3?n.node==e:e.contains(n.node))&&(n.pos=this.text.length+(v5(e,n.node,n.offset)?t:0))}}function v5(i,e,t){for(;;){if(!e||t<dr(e))return!1;if(e==i)return!0;t=Es(e)+1,e=e.parentNode}}class F0{constructor(e,t){this.node=e,this.offset=t,this.pos=-1}}class w5{constructor(e,t,n,r){this.typeOver=r,this.bounds=null,this.text="",this.domChanged=t>-1;let{impreciseHead:s,impreciseAnchor:o}=e.docView;if(e.state.readOnly&&t>-1)this.newSel=null;else if(t>-1&&(this.bounds=e.docView.domBoundsAround(t,n,0))){let l=s||o?[]:S5(e),a=new b5(l,e.state);a.readRange(this.bounds.startDOM,this.bounds.endDOM),this.text=a.text,this.newSel=_5(l,this.bounds.from)}else{let l=e.observer.selectionRange,a=s&&s.node==l.focusNode&&s.offset==l.focusOffset||!Gd(e.contentDOM,l.focusNode)?e.state.selection.main.head:e.docView.posFromDOM(l.focusNode,l.focusOffset),c=o&&o.node==l.anchorNode&&o.offset==l.anchorOffset||!Gd(e.contentDOM,l.anchorNode)?e.state.selection.main.anchor:e.docView.posFromDOM(l.anchorNode,l.anchorOffset),u=e.viewport;if((ke.ios||ke.chrome)&&e.state.selection.main.empty&&a!=c&&(u.from>0||u.to<e.state.doc.length)){let h=Math.min(a,c),f=Math.max(a,c),d=u.from-h,m=u.to-f;(d==0||d==1||h==0)&&(m==0||m==-1||f==e.state.doc.length)&&(a=0,c=e.state.doc.length)}this.newSel=q.single(c,a)}}}function zS(i,e){let t,{newSel:n}=e,r=i.state.selection.main,s=i.inputState.lastKeyTime>Date.now()-100?i.inputState.lastKeyCode:-1;if(e.bounds){let{from:o,to:l}=e.bounds,a=r.from,c=null;(s===8||ke.android&&e.text.length<l-o)&&(a=r.to,c="end");let u=k5(i.state.doc.sliceString(o,l,Cl),e.text,a-o,c);u&&(ke.chrome&&s==13&&u.toB==u.from+2&&e.text.slice(u.from,u.toB)==Cl+Cl&&u.toB--,t={from:o+u.from,to:o+u.toA,insert:at.of(e.text.slice(u.from,u.toB).split(Cl))})}else n&&(!i.hasFocus&&i.state.facet(Dr)||n.main.eq(r))&&(n=null);if(!t&&!n)return!1;if(!t&&e.typeOver&&!r.empty&&n&&n.main.empty?t={from:r.from,to:r.to,insert:i.state.doc.slice(r.from,r.to)}:t&&t.from>=r.from&&t.to<=r.to&&(t.from!=r.from||t.to!=r.to)&&r.to-r.from-(t.to-t.from)<=4?t={from:r.from,to:r.to,insert:i.state.doc.slice(r.from,t.from).append(t.insert).append(i.state.doc.slice(t.to,r.to))}:(ke.mac||ke.android)&&t&&t.from==t.to&&t.from==r.head-1&&/^\. ?$/.test(t.insert.toString())&&i.contentDOM.getAttribute("autocorrect")=="off"?(n&&t.insert.length==2&&(n=q.single(n.main.anchor-
Line truncated
|
||||
`&&i.lineWrapping&&(n&&(n=q.single(n.main.anchor-1,n.main.head-1)),t={from:r.from,to:r.to,insert:at.of([" "])}),t)return dp(i,t,n,s);if(n&&!n.main.eq(r)){let o=!1,l="select";return i.inputState.lastSelectionTime>Date.now()-50&&(i.inputState.lastSelectionOrigin=="select"&&(o=!0),l=i.inputState.lastSelectionOrigin),i.dispatch({selection:n,scrollIntoView:o,userEvent:l}),!0}else return!1}function dp(i,e,t,n=-1){if(ke.ios&&i.inputState.flushIOSKey(e))return!0;let r=i.state.selection.main;if(ke.android&&(e.to==r.to&&(e.from==r.from||e.from==r.from-1&&i.state.sliceDoc(e.from,r.from)==" ")&&e.insert.length==1&&e.insert.lines==2&&bo(i.contentDOM,"Enter",13)||(e.from==r.from-1&&e.to==r.to&&e.insert.length==0||n==8&&e.insert.length<e.to-e.from&&e.to>r.head)&&bo(i.contentDOM,"Backspace",8)||e.from==r.from&&e.to==r.to+1&&e.insert.length==0&&bo(i.contentDOM,"Delete",46)))return!0;let s=e.insert.toString();i.inputState.composing>=0&&i.inputState.composing++;let o,l=()=>o||(o=y5(i,e,t));return i.state.facet(ES).some(a=>a(i,e.from,e.to,s,l))||i.dispatch(l()),!0}function y5(i,e,t){let n,r=i.state,s=r.selection.main;if(e.from>=s.from&&e.to<=s.to&&e.to-e.from>=(s.to-s.from)/3&&(!t||t.main.empty&&t.main.from==e.from+e.insert.length)&&i.inputState.composing<0){let l=s.from<e.from?r.sliceDoc(s.from,e.from):"",a=s.to>e.to?r.sliceDoc(e.to,s.to):"";n=r.replaceSelection(i.state.toText(l+e.insert.sliceString(0,void 0,i.state.lineBreak)+a))}else{let l=r.changes(e),a=t&&t.main.to<=l.newLength?t.main:void 0;if(r.selection.ranges.length>1&&i.inputState.composing>=0&&e.to<=s.to&&e.to>=s.to-10){let c=i.state.sliceDoc(e.from,e.to),u,h=t&&FS(i,t.main.head);if(h){let m=e.insert.length-(e.to-e.from);u={from:h.from,to:h.to-m}}else u=i.state.doc.lineAt(s.head);let f=s.to-e.to,d=s.to-s.from;n=r.changeByRange(m=>{if(m.from==s.from&&m.to==s.to)return{changes:l,range:a||m.map(l)};let p=m.to-f,g=p-c.length;if(m.to-m.from!=d||i.state.sliceDoc(g,p)!=c||m.to>=u.from&&m.from<=u.to)return{range:m};let v=r.changes({from:g,to:p,insert:e.insert}),w=m.to-s.to;return{changes:v,range:a?q.range(Math.max(0,a.anchor+w),Math.max(0,a.head+w)):m.map(v)}})}else n={changes:l,selection:a&&r.selection.replaceRange(a)}}let o="input.type";return(i.composing||i.inputState.compositionPendingChange&&i.inputState.compositionEndedAt>Date.now()-50)&&(i.inputState.compositionPendingChange=!1,o+=".compose",i.inputState.compositionFirstChange&&(o+=".start",i.inputState.compositionFirstChange=!1)),r.update(n,{userEvent:o,scrollIntoView:!0})}function k5(i,e,t,n){let r=Math.min(i.length,e.length),s=0;for(;s<r&&i.charCodeAt(s)==e.charCodeAt(s);)s++;if(s==r&&i.length==e.length)return null;let o=i.length,l=e.length;for(;o>0&&l>0&&i.charCodeAt(o-1)==e.charCodeAt(l-1);)o--,l--;if(n=="end"){let a=Math.max(0,s-Math.min(o,l));t-=o+a-s}if(o<s&&i.length<e.length){let a=t<=s&&t>=o?s-t:0;s-=a,l=s+(l-o),o=s}else if(l<s){let a=t<=s&&t>=l?s-t:0;s-=a,o=s+(o-l),l=s}return{from:s,toA:o,toB:l}}function S5(i){let e=[];if(i.root.activeElement!=i.contentDOM)return e;let{anchorNode:t,anchorOffset:n,focusNode:r,focusOffset:s}=i.observer.selectionRange;return t&&(e.push(new F0(t,n)),(r!=t||s!=n)&&e.push(new F0(r,s))),e}function _5(i,e){if(i.length==0)return null;let t=i[0].pos,n=i.length==2?i[1].pos:t;return t>-1&&n>-1?q.single(t+e,n+e):null}class C5{setSelectionOrigin(e){this.lastSelectionOrigin=e,this.lastSelectionTime=Date.now()}constructor(e){this.view=e,this.lastKeyCode=0,this.lastKeyTime=0,this.lastTouchTime=0,this.lastFocusTime=0,this.lastScrollTop=0,this.lastScrollLeft=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.mouseSelection=null,this.draggedContent=null,this.handleEvent=this.handleEvent.bind(this),this.notifiedFocused=e.hasFocus,ke.safari&&e.contentDOM.addEventListener("input",()=>null),ke.gecko&&W5(e.contentDOM.ownerDocument)}handleEvent(e){!R5(this.view,e)||this.ignoreDuringComposition(e)||e.type=="keydown"&&this.keydown(e)||this.runHandlers(e.type,e)}runHandlers(e,t){let n=this.handlers[e];if(n){for(let r of n.observers)r(this.view,t);for(let r of n.handlers){if(t.defaultPrevented)break;if(r(this.view,t)){t.preventDefault();break}}}}ensureHandlers(e){let t=P5(e),n=this.handlers,r=this.view.contentDOM;for(let s in t)if(s!="scroll"){let o=!t[s].handlers.length,l=n[s];l&&o!=!l.handlers.length&&(r.removeEventListener(s,this.handleEvent),l=null),l||r.addEventListener(s,this.handleEvent,{passive:o})}for(let s in n)s!="scroll"&&!t[s]&&r.removeEventListener(s,this.handleEvent);this.handlers=t}keydown(e){if(this.lastKeyCode=e.keyCode,this.lastKeyTime=Date.now(),e.keyCode==9&&this.tabFocusMode>-1&&(!this.tabFocusMode||Date.now()<=this.tabFocusMode))return!0;if(this.tabFocusMode>0&&e.keyCode!=27&&US.indexOf(e.keyCode)<0&&(thi
Line truncated
|
||||
`))};s.from==this.from&&r<this.from?s.from=r:s.to==this.to&&r>this.to&&(s.to=r),!(s.from==s.to&&!s.insert.length)&&(this.pendingContextChange=s,e.state.readOnly||dp(e,s,q.single(this.toEditorPos(n.selectionStart),this.toEditorPos(n.selectionEnd))),this.pendingContextChange&&(this.revertPending(e.state),this.setSelection(e.state)))},this.handlers.characterboundsupdate=n=>{let r=[],s=null;for(let o=this.toEditorPos(n.rangeStart),l=this.toEditorPos(n.rangeEnd);o<l;o++){let a=e.coordsForChar(o);s=a&&new DOMRect(a.left,a.top,a.right-a.left,a.bottom-a.top)||s||new DOMRect,r.push(s)}t.updateCharacterBounds(n.rangeStart,r)},this.handlers.textformatupdate=n=>{let r=[];for(let s of n.getTextFormats()){let o=s.underlineStyle,l=s.underlineThickness;if(o!="None"&&l!="None"){let a=`text-decoration: underline ${o=="Dashed"?"dashed ":o=="Squiggle"?"wavy ":""}${l=="Thin"?1:2}px`;r.push(Qe.mark({attributes:{style:a}}).range(this.toEditorPos(s.rangeStart),this.toEditorPos(s.rangeEnd)))}}e.dispatch({effects:IS.of(Qe.set(r))})},this.handlers.compositionstart=()=>{e.inputState.composing<0&&(e.inputState.composing=0,e.inputState.compositionFirstChange=!0)},this.handlers.compositionend=()=>{e.inputState.composing=-1,e.inputState.compositionFirstChange=null};for(let n in this.handlers)t.addEventListener(n,this.handlers[n]);this.measureReq={read:n=>{this.editContext.updateControlBounds(n.contentDOM.getBoundingClientRect());let r=ua(n.root);r&&r.rangeCount&&this.editContext.updateSelectionBounds(r.getRangeAt(0).getBoundingClientRect())}}}applyEdits(e){let t=0,n=!1,r=this.pendingContextChange;return e.changes.iterChanges((s,o,l,a,c)=>{if(n)return;let u=c.length-(o-s);if(r&&o>=r.to)if(r.from==s&&r.to==o&&r.insert.eq(c)){r=this.pendingContextChange=null,t+=u,this.to+=u;return}else r=null,this.revertPending(e.state);if(s+=t,o+=t,o<=this.from)this.from+=u,this.to+=u;else if(s<this.to){if(s<this.from||o>this.to||this.to-this.from+c.length>3e4){n=!0;return}this.editContext.updateText(this.toContextPos(s),this.toContextPos(o),c.toString()),this.to+=u}t+=u}),r&&!n&&this.revertPending(e.state),!n}update(e){let t=this.pendingContextChange;!this.applyEdits(e)||!this.rangeIsValid(e.state)?(this.pendingContextChange=null,this.resetRange(e.state),this.editContext.updateText(0,this.editContext.text.length,e.state.doc.sliceString(this.from,this.to)),this.setSelection(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)}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,n=this.toContextPos(Math.max(this.from,Math.min(this.to,t.anchor))),r=this.toContextPos(t.head);(this.editContext.selectionStart!=n||this.editContext.selectionEnd!=r)&&this.editContext.updateSelection(n,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){return e+this.from}toContextPos(e){return e-this.from}destroy(){for(let e in this.handlers)this.editContext.removeEventListener(e,this.handlers[e])}}class pe{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.composing>0}get compositionStarted(){return 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.measureRequests=[],this.contentDOM=document.createElement("div"),this.scrollDOM=document.createElement("div"),this.scrollDOM.tabIndex=-1,this.scrollDOM.className="cm-scroller",this.scrollDOM.appendChild(this.contentDOM),this.announceDOM=document.createElement("div"),this.announceDOM.className="cm-announced",this.announceDOM.setAttribute("aria-live","polite"),this.dom=document.createElement("div"),this.dom.appendChild(this.announceDOM),this.dom.appendChild(this.scrollDOM),e.parent&&e.parent.appendChild(this.dom);let{dispatch:n}=e;this.dispatchTransactions=e.dispatchTransactions||n&&(r=>r.forEach(s=>n(s,this)))||(r=>this.update(r)),this.dispatch=this.dispatch.bind(this),this._root=e.root||ZD(e.parent)||document,this.viewState=new nb(e.state||et.create(e)),e.scrollTo&&e.scrollTo.is(dc)&&(this.viewState.scrollTarget=e.scrollTo.value.clip(this.viewState.state)),this.plugins=this.state.facet(Sl).map(r=>new xf(r));for(let r of this.plugins)r.update(this);this.observer=new t$(this),this.inputState=new C5(this)
Line truncated
|
||||
--\u2028\u2029\uFEFF-]`,gm),S$={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"};let Rf=null;function _$(){var i;if(Rf==null&&typeof document<"u"&&document.body){let e=document.body.style;Rf=((i=e.tabSize)!==null&&i!==void 0?i:e.MozTabSize)!=null}return Rf||!1}const Kc=ye.define({combine(i){let e=Qi(i,{render:null,specialChars:k$,addSpecialChars:null});return(e.replaceTabs=!_$())&&(e.specialChars=new RegExp(" |"+e.specialChars.source,gm)),e.addSpecialChars&&(e.specialChars=new RegExp(e.specialChars.source+"|"+e.addSpecialChars.source,gm)),e}});function C$(i={}){return[Kc.of(i),P$()]}let fb=null;function P$(){return fb||(fb=Vt.fromClass(class{constructor(i){this.view=i,this.decorations=Qe.none,this.decorationCache=Object.create(null),this.decorator=this.makeDecorator(i.state.facet(Kc)),this.decorations=this.decorator.createDeco(i)}makeDecorator(i){return new y$({regexp:i.specialChars,decoration:(e,t,n)=>{let{doc:r}=t.state,s=ln(e[0],0);if(s==9){let o=r.lineAt(n),l=t.state.tabSize,a=Ci(o.text,l,n-o.from);return Qe.replace({widget:new Q$((l-a%l)*this.view.defaultCharacterWidth/this.view.scaleX)})}return this.decorationCache[s]||(this.decorationCache[s]=Qe.replace({widget:new T$(i,s)}))},boundary:i.replaceTabs?void 0:/[^]/})}update(i){let e=i.state.facet(Kc);i.startState.facet(Kc)!=e?(this.decorator=this.makeDecorator(e),this.decorations=this.decorator.createDeco(i.view)):this.decorations=this.decorator.updateDeco(i,this.decorations)}},{decorations:i=>i.decorations}))}const A$="•";function x$(i){return i>=32?A$:i==10?"":String.fromCharCode(9216+i)}class T$ extends br{constructor(e,t){super(),this.options=e,this.code=t}eq(e){return e.code==this.code}toDOM(e){let t=x$(this.code),n=e.state.phrase("Control character")+" "+(S$[this.code]||"0x"+this.code.toString(16)),r=this.options.render&&this.options.render(this.code,n,t);if(r)return r;let s=document.createElement("span");return s.textContent=t,s.title=n,s.setAttribute("aria-label",n),s.className="cm-specialChar",s}ignoreEvent(){return!1}}class Q$ extends br{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 M$(){return R$}const E$=Qe.line({class:"cm-activeLine"}),R$=Vt.fromClass(class{constructor(i){this.decorations=this.getDeco(i)}update(i){(i.docChanged||i.selectionSet)&&(this.decorations=this.getDeco(i.view))}getDeco(i){let e=-1,t=[];for(let n of i.state.selection.ranges){let r=i.lineBlockAt(n.head);r.from>e&&(t.push(E$.range(r.from)),e=r.from)}return Qe.set(t)}},{decorations:i=>i.decorations}),Om=2e3;function D$(i,e,t){let n=Math.min(e.line,t.line),r=Math.max(e.line,t.line),s=[];if(e.off>Om||t.off>Om||e.col<0||t.col<0){let o=Math.min(e.off,t.off),l=Math.max(e.off,t.off);for(let a=n;a<=r;a++){let c=i.doc.line(a);c.length<=l&&s.push(q.range(c.from+o,c.to+l))}}else{let o=Math.min(e.col,t.col),l=Math.max(e.col,t.col);for(let a=n;a<=r;a++){let c=i.doc.line(a),u=Ud(c.text,o,i.tabSize,!0);if(u<0)s.push(q.cursor(c.to));else{let h=Ud(c.text,l,i.tabSize);s.push(q.range(c.from+u,c.from+h))}}}return s}function $$(i,e){let t=i.coordsAtPos(i.viewport.from);return t?Math.round(Math.abs((t.left-e)/i.defaultCharacterWidth)):-1}function db(i,e){let t=i.posAtCoords({x:e.clientX,y:e.clientY},!1),n=i.state.doc.lineAt(t),r=t-n.from,s=r>Om?-1:r==n.length?$$(i,e.clientX):Ci(n.text,i.state.tabSize,t-n.from);return{line:n.number,col:s,off:r}}function L$(i,e){let t=db(i,e),n=i.state.selection;return t?{update(r){if(r.docChanged){let s=r.changes.mapPos(r.startState.doc.line(t.line).from),o=r.state.doc.lineAt(s);t={line:o.number,col:t.col,off:Math.min(t.off,o.length)},n=n.map(r.changes)}},get(r,s,o){let l=db(i,r);if(!l)return n;let a=D$(i.state,t,l);return a.length?o?q.create(a.concat(n.ranges)):q.create(a):n}}:null}function I$(i){let e=t=>t.altKey&&t.button==0;return pe.mouseSelectionStyle.of((t,n)=>e(n)?L$(t,n):null)}const N$={Alt:[18,i=>!!i.altKey],Control:[17,i=>!!i.ctrlKey],Shift:[16,i=>!!i.shiftKey],Meta:[91,i=>!!i.metaKey]},Z$={style:"cursor: crosshair"};function B$(i={}){let[e,t]=N$[i.key||"Alt"],n=Vt.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[n,pe.contentAttributes.of(r=>{var s;return!((s=r.plugin(n))===null||s===void 0)
Line truncated
|
||||
`:n=="r"?"\r":n=="t"?" ":"\\")}eq(e){return this.search==e.search&&this.replace==e.replace&&this.caseSensitive==e.caseSensitive&&this.regexp==e.regexp&&this.wholeWord==e.wholeWord}create(){return this.regexp?new z7(this):new F7(this)}getCursor(e,t=0,n){let r=e.doc?e:et.create({doc:e});return n==null&&(n=r.doc.length),this.regexp?to(this,r,t,n):eo(this,r,t,n)}}class C_{constructor(e){this.spec=e}}function eo(i,e,t,n){return new $o(e.doc,i.unquoted,t,n,i.caseSensitive?void 0:r=>r.toLowerCase(),i.wholeWord?X7(e.doc,e.charCategorizer(e.selection.main.head)):void 0)}function X7(i,e){return(t,n,r,s)=>((s>t||s+r.length<n)&&(s=Math.max(0,t-2),r=i.sliceString(s,Math.min(i.length,n+2))),(e(Xu(r,t-s))!=$t.Word||e(Fu(r,t-s))!=$t.Word)&&(e(Fu(r,n-s))!=$t.Word||e(Xu(r,n-s))!=$t.Word))}class F7 extends C_{constructor(e){super(e)}nextMatch(e,t,n){let r=eo(this.spec,e,n,e.doc.length).nextOverlapping();return r.done&&(r=eo(this.spec,e,0,t).nextOverlapping()),r.done?null:r.value}prevMatchInRange(e,t,n){for(let r=n;;){let s=Math.max(t,r-1e4-this.spec.unquoted.length),o=eo(this.spec,e,s,r),l=null;for(;!o.nextOverlapping().done;)l=o.value;if(l)return l;if(s==t)return null;r-=1e4}}prevMatch(e,t,n){return this.prevMatchInRange(e,0,t)||this.prevMatchInRange(e,n,e.doc.length)}getReplacement(e){return this.spec.unquote(this.spec.replace)}matchAll(e,t){let n=eo(this.spec,e,0,e.doc.length),r=[];for(;!n.next().done;){if(r.length>=t)return null;r.push(n.value)}return r}highlight(e,t,n,r){let s=eo(this.spec,e,Math.max(0,t-this.spec.unquoted.length),Math.min(n+this.spec.unquoted.length,e.doc.length));for(;!s.next().done;)r(s.value.from,s.value.to)}}function to(i,e,t,n){return new k_(e.doc,i.search,{ignoreCase:!i.caseSensitive,test:i.wholeWord?Y7(e.charCategorizer(e.selection.main.head)):void 0},t,n)}function Xu(i,e){return i.slice(hn(i,e,!1),e)}function Fu(i,e){return i.slice(e,hn(i,e))}function Y7(i){return(e,t,n)=>!n[0].length||(i(Xu(n.input,n.index))!=$t.Word||i(Fu(n.input,n.index))!=$t.Word)&&(i(Fu(n.input,n.index+n[0].length))!=$t.Word||i(Xu(n.input,n.index+n[0].length))!=$t.Word)}class z7 extends C_{nextMatch(e,t,n){let r=to(this.spec,e,n,e.doc.length).next();return r.done&&(r=to(this.spec,e,0,t).next()),r.done?null:r.value}prevMatchInRange(e,t,n){for(let r=1;;r++){let s=Math.max(t,n-r*1e4),o=to(this.spec,e,s,n),l=null;for(;!o.next().done;)l=o.value;if(l&&(s==t||l.from>s+10))return l;if(s==t)return null}}prevMatch(e,t,n){return this.prevMatchInRange(e,0,t)||this.prevMatchInRange(e,n,e.doc.length)}getReplacement(e){return this.spec.unquote(this.spec.replace).replace(/\$([$&\d+])/g,(t,n)=>n=="$"?"$":n=="&"?e.match[0]:n!="0"&&+n<e.match.length?e.match[n]:t)}matchAll(e,t){let n=to(this.spec,e,0,e.doc.length),r=[];for(;!n.next().done;){if(r.length>=t)return null;r.push(n.value)}return r}highlight(e,t,n,r){let s=to(this.spec,e,Math.max(0,t-250),Math.min(n+250,e.doc.length));for(;!s.next().done;)r(s.value.from,s.value.to)}}const wa=Fe.define(),Qp=Fe.define(),Br=Jt.define({create(i){return new zf(Qm(i).create(),null)},update(i,e){for(let t of e.effects)t.is(wa)?i=new zf(t.value.create(),i.panel):t.is(Qp)&&(i=new zf(i.query,t.value?Mp:null));return i},provide:i=>pa.from(i,e=>e.panel)});class zf{constructor(e,t){this.query=e,this.panel=t}}const V7=Qe.mark({class:"cm-searchMatch"}),U7=Qe.mark({class:"cm-searchMatch cm-searchMatch-selected"}),j7=Vt.fromClass(class{constructor(i){this.view=i,this.decorations=this.highlight(i.state.field(Br))}update(i){let e=i.state.field(Br);(e!=i.startState.field(Br)||i.docChanged||i.selectionSet||i.viewportChanged)&&(this.decorations=this.highlight(e))}highlight({query:i,panel:e}){if(!e||!i.spec.valid)return Qe.none;let{view:t}=this,n=new Ur;for(let r=0,s=t.visibleRanges,o=s.length;r<o;r++){let{from:l,to:a}=s[r];for(;r<o-1&&a>s[r+1].from-2*250;)a=s[++r].to;i.highlight(t.state,l,a,(c,u)=>{let h=t.state.selection.ranges.some(f=>f.from==c&&f.to==u);n.add(c,u,h?U7:V7)})}return n.finish()}},{decorations:i=>i.decorations});function Fa(i){return e=>{let t=e.state.field(Br,!1);return t&&t.query.spec.valid?i(e,t):x_(e)}}const Yu=Fa((i,{query:e})=>{let{to:t}=i.state.selection.main,n=e.nextMatch(i.state,t,t);if(!n)return!1;let r=q.single(n.from,n.to),s=i.state.facet(Uo);return i.dispatch({selection:r,effects:[Ep(i,n),s.scrollToMatch(r.main,i)],userEvent:"select.search"}),A_(i),!0}),zu=Fa((i,{query:e})=>{let{state:t}=i,{from:n}=t.selection.main,r=e.prevMatch(t,n,n);if(!r)return!1;let s=q.single(r.from,r.to),o=i.state.facet(Uo);return i.dispatch({selection:s,effects:[Ep(i,r),o.scrollToMatch(s.main,i)],userEvent:"select.search"}),A_(i),!0}),q7=Fa((i,{query:e})=>{let t=e.matchAll(i.state,1e3);return!t||!t.length?!1:(i.dispatch({selection:q.create(t.map(n=>q.range(n.from,n.to))),userEvent:"select.search.matches"}),!0)}),G7=({state:i,dispatch:e})=>{let t=i.selection;if(t.ranges.length>1||t.main.empty)return!1;let{from:n,to:r}=t.main,s=[],o=0;for(let l=new $o(i.doc,i.sliceDoc(n,r));!l.next().done;){if(s.length>1e3)return!1;l.va
Line truncated
|
||||
`+t.scrub(),s=this.advance(r);return s>-1&&s<r.length?this.complete(e,n,s):!1}finish(e,t){return(this.stage==2||this.stage==3)&&ql(t.content,this.pos)==t.content.length?this.complete(e,t,t.content.length):!1}complete(e,t,n){return e.addLeafElement(t,rt(ue.LinkReference,this.start,this.start+n,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(OC(e,this.pos,this.start,!0)))return-1;if(e.charCodeAt(this.pos)!=58)return this.stage=-1;this.elts.push(rt(ue.LinkMark,this.pos+this.start,this.pos+this.start+1)),this.pos++}else if(this.stage==1){if(!this.nextStage(pC(e,ql(e,this.pos),this.start)))return-1}else if(this.stage==2){let t=ql(e,this.pos),n=0;if(t>this.pos){let r=gC(e,t,this.start);if(r){let s=Gf(e,r.to-this.start);s>0&&(this.nextStage(r),n=s)}}return n||(n=Gf(e,this.pos)),n>0&&n<e.length?n:-1}else return Gf(e,this.pos)}}}function Gf(i,e){for(;e<i.length;e++){let t=i.charCodeAt(e);if(t==10)break;if(!mi(t))return-1}return e}class IN{nextLine(e,t,n){let r=t.depth<e.stack.length?-1:sC(t),s=t.next;if(r<0)return!1;let o=rt(ue.HeaderMark,e.lineStart+t.pos,e.lineStart+r);return e.nextLine(),e.addLeafElement(n,rt(s==61?ue.SetextHeading1:ue.SetextHeading2,n.start,e.prevLineEnd(),[...e.parser.parseInline(n.content,n.start),o])),!0}finish(){return!1}}const NN={LinkReference(i,e){return e.content.charCodeAt(0)==91?new LN(e):null},SetextHeading(){return new IN}},ZN=[(i,e)=>rC(e)>=0,(i,e)=>tC(e)>=0,(i,e)=>nC(e)>=0,(i,e)=>Yp(e,i,!0)>=0,(i,e)=>zp(e,i,!0)>=0,(i,e)=>Fp(e,i,!0)>=0,(i,e)=>aC(e,i,!0)>=0],BN={text:"",end:0};class WN{constructor(e,t,n,r){this.parser=e,this.input=t,this.ranges=r,this.line=new $N,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=Ku.create(ue.Document,0,this.lineStart,0,0),this.stack=[this.block],this.fragments=n.length?new zN(n,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 n=0;;){let r=e.depth<this.stack.length?this.stack[this.stack.length-1]:null;for(;n<e.markers.length&&(!r||e.markers[n].from<r.end);){let s=e.markers[n++];this.addNode(s.type,s.from,s.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 n of this.parser.blockParsers)if(n){let r=n(this,e);if(r!=!1){if(r==!0)return null;e.forward();continue e}}break}let t=new DN(this.lineStart+e.pos,e.text.slice(e.pos));for(let n of this.parser.leafBlockParsers)if(n){let r=n(this,t);r&&t.parsers.push(r)}e:for(;this.nextLine()&&e.pos!=e.text.length;){if(e.indent<e.baseIndent+4){for(let n of this.parser.endLeafBlock)if(n(this,e,t))break e}for(let n of t.parsers)if(n.nextLine(this,e,t))return null;t.content+=`
|
||||
`+e.scrub();for(let n of e.markers)t.marks.push(n)}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=bC(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)}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=BN;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 n=this.absoluteLineStart,r=this.rangeI;for(;this.ranges[r].to<t.end;){r++;let s=this.ranges[r].from,o=this.lineChunkAt(s);t.end=s+o.length,t.text=t.text.slice(0,this.ranges[r-1].to-n)+o,n=t.end-t.text.length}}return t}readLine(){let{line:e}=this,{text:t,end:n}=this.scanLine(this.absoluteLineStart);for(this.absoluteLineEnd=n,e.reset(t);e.depth<this.stack.length;e.depth++){let r=this.stack[e.depth],s=this.parser.skipContextMarkup[r.type];if(!s)throw new Error("Unhandled block context "+ue[r.type]);if(!s(r,this,e))break;e.forward()}}lineChunkAt(e){let t=this.input.chunk(e),n;if(this.input.lineChunks)n=t==`
|
||||
`?"":t;else{let r=t.indexOf(`
|
||||
`);n=r<0?t:t.slice(0,r)}return e+n.length>this.to?n.slice(0,this.to-e):n}prevLineEnd(){return this.atEnd?this.lineStart:this.lineStart-1}startContext(e,t,n=0){this.block=Ku.create(e,n,this.lineStart+t,this.block.hash,this.lineStart+this.line.text.length),this.stack.push(this.block)}startComposite(e,t,n=0){this.startContext(this.parser.getNodeType(e),t,n)}addNode(e,t,n){typeof e=="number"&&(e=new gt(this.parser.nodeSet.types[e],Io,Io,(n??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($m(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?cC(this.ranges,0,e.topNode,this.ranges[0].from,this.reusePlaceholders):e}finishLeaf(e){for(let n of e.parsers)if(n.finish(this,e))return;let t=$m(this.parser.parseInline(e.content,e.start),e.marks);this.addNode(this.buffer.writeElements(t,-e.start).finish(ue.Paragraph,e.content.length),e.start)}elt(e,t,n,r){return typeof e=="string"?rt(this.parser.getNodeType(e),t,n,r):new fC(e,t)}get buffer(){return new hC(this.parser.nodeSet)}}function cC(i,e,t,n,r){let s=i[e].to,o=[],l=[],a=t.from+n;function c(u,h){for(;h?u>=s:u>s;){let f=i[e+1].from-s;n+=f,u+=f,e++,s=i[e].to}}for(let u=t.firstChild;u;u=u.nextSibling){c(u.from+n,!0);let h=u.from+n,f,d=r.get(u.tree);d?f=d:u.to+n>s?(f=cC(i,e,u,n,r),c(u.to+n,!1)):f=u.toTree(),o.push(f),l.push(h-a)}return c(t.to+n,!1),new gt(t.type,o,l,t.to+n-a,t.tree?t.tree.propValues:void 0)}class Ch extends wp{constructor(e,t,n,r,s,o,l,a,c){super(),this.nodeSet=e,this.blockParsers=t,this.leafBlockParsers=n,this.blockNames=r,this.endLeafBlock=s,this.skipContextMarkup=o,this.inlineParsers=l,this.inlineNames=a,this.wrappers=c,this.nodeTypes=Object.create(null);for(let u of e.types)this.nodeTypes[u.name]=u.id}createParse(e,t,n){let r=new WN(this,e,t,n);for(let s of this.wrappers)r=s(r,e,t,n);return r}configure(e){let t=Rm(e);if(!t)return this;let{nodeSet:n,skipContextMarkup:r}=this,s=this.blockParsers.slice(),o=this.leafBlockParsers.slice(),l=this.blockNames.slice(),a=this.inlineParsers.slice(),c=this.inlineNames.slice(),u=this.endLeafBlock.slice(),h=this.wrappers;if(gl(t.defineNodes)){r=Object.assign({},r);let f=n.types.slice(),d;for(let m of t.defineNodes){let{name:p,block:g,composite:v,style:w}=typeof m=="string"?{name:m}:m;if(f.some(k=>k.name==p))continue;v&&(r[f.length]=(k,A,C)=>v(A,C,k.value));let S=f.length,_=v?["Block","BlockContext"]:g?S>=ue.ATXHeading1&&S<=ue.SetextHeading2?["Block","LeafBlock","Heading"]:["Block","LeafBlock"]:void 0;f.push(tn.define({id:S,name:p,props:_&&[[Ze.group,_]]})),w&&(d||(d={}),Array.isArray(w)||w instanceof jn?d[p]=w:Object.assign(d,w))}n=new Za(f),d&&(n=n.extend(Xs(d)))}if(gl(t.props)&&(n=n.extend(...t.props)),gl(t.remove))for(let f of t.remove){let d=this.blockNames.indexOf(f),m=this.inlineNames.indexOf(f);d>-1&&(s[d]=o[d]=void 0),m>-1&&(a[m]=void 0)}if(gl(t.parseBlock))for(let f of t.parseBlock){let d=l.indexOf(f.name);if(d>-1)s[d]=f.parse,o[d]=f.leaf;else{let m=f.before?Rc(l,f.before):f.after?Rc(l,f.after)+1:l.length-1;s.splice(m,0,f.parse),o.splice(m,0,f.leaf),l.splice(m,0,f.name)}f.endLeaf&&u.push(f.endLeaf)}if(gl(t.parseInline))for(let f of t.parseInline){let d=c.indexOf(f.name);if(d>-1)a[d]=f.parse;else{let m=f.before?Rc(c,f.before):f.after?Rc(c,f.after)+1:c.length-1;a.splice(m,0,f.parse),c.splice(m,0,f.name)}}return t.wrap&&(h=h.concat(t.wrap)),new Ch(n,s,o,l,u,r,a,c,h)}getNodeType(e){let t=this.nodeTypes[e];if(t==null)throw new RangeError(`Unknown node type '${e}'`);return t}parseInline(e,t){let n=new FN(this,e,t);e:for(let r=t;r<n.end;){let s=n.char(r);for(let o of this.inlineParsers)if(o){let l=o(n,s,r);if(l>=0){r=l;continue e}}r++}return n.resolveMarkers(0)}}function gl(i){return i!=null&&i.length>0}function Rm(i){if(!Array.isArray(i))return i;if(i.length==0)return null;let e=Rm(i[0]);if(i.length==1)return e;let t=Rm(i.slice(1));if(!t||!e)return e||t;let n=(o,l)=>(o||Io).concat(l||Io),r=e.wrap,s=t.wrap;return{props:n(e.props,t.props),defineNodes:n(e.defineNodes,t.defineNodes),parseBlock:n(e.parseBlock,t.parseBlock),parseInline:n(e.parseInline,t.parseInline),remove:n(e.remove,t.remove),wrap:r?s?(o,l,a,c)=>r(s(o,l,a,c),l,a,c):r:s}}function Rc(i,e){let t=i.indexOf(e);if(t<0)throw new RangeError(`Position specified relative to unknown parser ${e}`);return t}let uC=[tn.none];for(let i=1,e;e=ue[i];i++)uC[i]=tn.define({id:i,name:e,props:i>=ue.Escape?[]:[[Ze.group,i in eC?["Block","BlockContext"]:["Block","LeafBlock"]]],top:e=="Document"});const Io=[];class hC{constructor(e){this.nodeSet=e,this.content=[],this.nodes=[]}write(e,t,n,r=0){re
Line truncated
|
||||
`;)s--;this.fragmentEnd=s?s-1:0}let n=this.cursor;n||(n=this.cursor=this.fragment.tree.cursor(),n.firstChild());let r=e+this.fragment.offset;for(;n.to<=r;)if(!n.parent())return!1;for(;;){if(n.from>=r)return this.fragment.from<=t;if(!n.childAfter(r))return!1}}matches(e){let t=this.cursor.tree;return t&&t.prop(Ze.contextHash)==e}takeNodes(e){let t=this.cursor,n=this.fragment.offset,r=this.fragmentEnd-(this.fragment.openEnd?1:0),s=e.absoluteLineStart,o=s,l=e.block.children.length,a=o,c=l;for(;;){if(t.to-n>r){if(t.type.isAnonymous&&t.firstChild())continue;break}let u=bC(t.from-n,e.ranges);if(t.to-n<=e.ranges[e.rangeI].to)e.addNode(t.tree,u);else{let h=new gt(e.parser.nodeSet.types[ue.Paragraph],[],[],0,e.block.hashProp);e.reusePlaceholders.set(h,t.tree),e.addNode(h,u)}if(t.type.is("Block")&&(YN.indexOf(t.type.id)<0?(o=t.to-n,l=e.block.children.length):(o=a,l=c,a=t.to-n,c=e.block.children.length)),!t.nextSibling())break}for(;e.block.children.length>l;)e.block.children.pop(),e.block.positions.pop();return o-s}}function bC(i,e){let t=i;for(let n=1;n<e.length;n++){let r=e[n-1].to,s=e[n].from;r<i&&(t-=s-r)}return t}const VN=Xs({"Blockquote/...":I.quote,HorizontalRule:I.contentSeparator,"ATXHeading1/... SetextHeading1/...":I.heading1,"ATXHeading2/... SetextHeading2/...":I.heading2,"ATXHeading3/...":I.heading3,"ATXHeading4/...":I.heading4,"ATXHeading5/...":I.heading5,"ATXHeading6/...":I.heading6,"Comment CommentBlock":I.comment,Escape:I.escape,Entity:I.character,"Emphasis/...":I.emphasis,"StrongEmphasis/...":I.strong,"Link/... Image/...":I.link,"OrderedList/... BulletList/...":I.list,"BlockQuote/...":I.quote,"InlineCode CodeText":I.monospace,"URL Autolink":I.url,"HeaderMark HardBreak QuoteMark ListMark LinkMark EmphasisMark CodeMark":I.processingInstruction,"CodeInfo LinkLabel":I.labelName,LinkTitle:I.string,Paragraph:I.content}),UN=new Ch(new Za(uC).extend(VN),Object.keys(Ec).map(i=>Ec[i]),Object.keys(Ec).map(i=>NN[i]),Object.keys(Ec),ZN,eC,Object.keys(Hf).map(i=>Hf[i]),Object.keys(Hf),[]);function jN(i,e,t){let n=[];for(let r=i.firstChild,s=e;;r=r.nextSibling){let o=r?r.from:t;if(o>s&&n.push({from:s,to:o}),!r)break;s=r.to}return n}function qN(i){let{codeParser:e,htmlParser:t}=i;return{wrap:k2((r,s)=>{let o=r.type.id;if(e&&(o==ue.CodeBlock||o==ue.FencedCode)){let l="";if(o==ue.FencedCode){let c=r.node.getChild(ue.CodeInfo);c&&(l=s.read(c.from,c.to))}let a=e(l);if(a)return{parser:a,overlay:c=>c.type.id==ue.CodeText}}else if(t&&(o==ue.HTMLBlock||o==ue.HTMLTag))return{parser:t,overlay:jN(r.node,r.from,r.to)};return null})}}const GN={resolve:"Strikethrough",mark:"StrikethroughMark"},HN={defineNodes:[{name:"Strikethrough",style:{"Strikethrough/...":I.strikethrough}},{name:"StrikethroughMark",style:I.processingInstruction}],parseInline:[{name:"Strikethrough",parse(i,e,t){if(e!=126||i.char(t+1)!=126||i.char(t+2)==126)return-1;let n=i.slice(t-1,t),r=i.slice(t+2,t+3),s=/\s|^$/.test(n),o=/\s|^$/.test(r),l=Pa.test(n),a=Pa.test(r);return i.addDelimiter(GN,t,t+2,!o&&(!a||s||l),!s&&(!l||o||a))},after:"Emphasis"}]};function Gl(i,e,t=0,n,r=0){let s=0,o=!0,l=-1,a=-1,c=!1,u=()=>{n.push(i.elt("TableCell",r+l,r+a,i.parser.parseInline(e.slice(l,a),r+l)))};for(let h=t;h<e.length;h++){let f=e.charCodeAt(h);f==124&&!c?((!o||l>-1)&&s++,o=!1,n&&(l>-1&&u(),n.push(i.elt("TableDelimiter",h+r,h+r+1))),l=a=-1):(c||f!=32&&f!=9)&&(l<0&&(l=h),a=h+1),c=!c&&f==92}return l>-1&&(s++,n&&u()),s}function wv(i,e){for(let t=e;t<i.length;t++){let n=i.charCodeAt(t);if(n==124)return!0;n==92&&t++}return!1}const vC=/^\|?(\s*:?-+:?\s*\|)+(\s*:?-+:?\s*)?$/;class yv{constructor(){this.rows=null}nextLine(e,t,n){if(this.rows==null){this.rows=!1;let r;if((t.next==45||t.next==58||t.next==124)&&vC.test(r=t.text.slice(t.pos))){let s=[];Gl(e,n.content,0,s,n.start)==Gl(e,r,t.pos)&&(this.rows=[e.elt("TableHeader",n.start,n.start+n.content.length,s),e.elt("TableDelimiter",e.lineStart+t.pos,e.lineStart+t.text.length)])}}else if(this.rows){let r=[];Gl(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}}const KN={defineNodes:[{name:"Table",block:!0},{name:"TableHeader",style:{"TableHeader/...":I.heading}},"TableRow",{name:"TableCell",style:I.content},{name:"TableDelimiter",style:I.processingInstruction}],parseBlock:[{name:"Table",leaf(i,e){return wv(e.content,0)?new yv:null},endLeaf(i,e,t){if(t.parsers.some(r=>r instanceof yv)||!wv(e.text,e.basePos))return!1;let n=i.scanLine(i.absoluteLineEnd+1).text;return vC.test(n)&&Gl(i,e.text,e.basePos)==Gl(i,n,e.basePos)},before:"SetextHeading"}]};class JN{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}}const eZ={defineNodes:[{name:"Task",block:!0,style:I.list},{name:"TaskMarker",style:I.atom}],parseBlock:[
Line truncated
|
||||
\${}
|
||||
} catch (\${error}) {
|
||||
\${}
|
||||
}`,{label:"try",detail:"/ catch block",type:"keyword"}),Qn("if (${}) {\n ${}\n}",{label:"if",detail:"block",type:"keyword"}),Qn(`if (\${}) {
|
||||
\${}
|
||||
} else {
|
||||
\${}
|
||||
}`,{label:"if",detail:"/ else block",type:"keyword"}),Qn(`class \${name} {
|
||||
constructor(\${params}) {
|
||||
\${}
|
||||
}
|
||||
}`,{label:"class",detail:"definition",type:"keyword"}),Qn('import {${names}} from "${module}"\n${}',{label:"import",detail:"named",type:"keyword"}),Qn('import ${name} from "${module}"\n${}',{label:"import",detail:"default",type:"keyword"})],U8=IC.concat([Qn("interface ${name} {\n ${}\n}",{label:"interface",detail:"definition",type:"keyword"}),Qn("type ${name} = ${type}",{label:"type",detail:"definition",type:"keyword"}),Qn("enum ${name} {\n ${}\n}",{label:"enum",detail:"definition",type:"keyword"})]),Xv=new y2,NC=new Set(["Script","Block","FunctionExpression","FunctionDeclaration","ArrowFunction","MethodDeclaration","ForStatement"]);function Ol(i){return(e,t)=>{let n=e.node.getChild("VariableDefinition");return n&&t(n,i),!0}}const j8=["FunctionDeclaration"],q8={FunctionDeclaration:Ol("function"),ClassDeclaration:Ol("class"),ClassExpression:()=>!0,EnumDeclaration:Ol("constant"),TypeAliasDeclaration:Ol("type"),NamespaceDeclaration:Ol("namespace"),VariableDefinition(i,e){i.matchContext(j8)||e(i,"variable")},TypeDefinition(i,e){e(i,"type")},__proto__:null};function ZC(i,e){let t=Xv.get(e);if(t)return t;let n=[],r=!0;function s(o,l){let a=i.sliceString(o.from,o.to);n.push({label:a,type:l})}return e.cursor(Pt.IncludeAnonymous).iterate(o=>{if(r)r=!1;else if(o.name){let l=q8[o.name];if(l&&l(o,s)||NC.has(o.name))return!1}else if(o.to-o.from>8192){for(let l of ZC(i,o.node))n.push(l);return!1}}),Xv.set(e,n),n}const Fv=/^[\w$\xa1-\uffff][\w$\d\xa1-\uffff]*$/,BC=["TemplateString","String","RegExp","LineComment","BlockComment","VariableDefinition","TypeDefinition","Label","PropertyDefinition","PropertyName","PrivatePropertyDefinition","PrivatePropertyName",".","?."];function G8(i){let e=At(i.state).resolveInner(i.pos,-1);if(BC.indexOf(e.name)>-1)return null;let t=e.name=="VariableName"||e.to-e.from<20&&Fv.test(i.state.sliceDoc(e.from,e.to));if(!t&&!i.explicit)return null;let n=[];for(let r=e;r;r=r.parent)NC.has(r.name)&&(n=n.concat(ZC(i.state.doc,r)));return{options:n,from:t?e.from:i.pos,validFor:Fv}}const qi=$s.define({name:"javascript",parser:V8.configure({props:[zo.add({IfStatement:wo({except:/^\s*({|else\b)/}),TryStatement:wo({except:/^\s*({|catch\b|finally\b)/}),LabeledStatement:ZL,SwitchBody:i=>{let e=i.textAfter,t=/^\s*\}/.test(e),n=/^\s*(case|default)\b/.test(e);return i.baseIndent+(t?0:n?1:2)*i.unit},Block:NL({closing:"}"}),ArrowFunction:i=>i.baseIndent+i.unit,"TemplateString BlockComment":()=>null,"Statement Property":wo({except:/^{/}),JSXElement(i){let e=/^\s*<\//.test(i.textAfter);return i.lineIndent(i.node.from)+(e?0:i.unit)},JSXEscape(i){let e=/\s*\}/.test(i.textAfter);return i.lineIndent(i.node.from)+(e?0:i.unit)},"JSXOpenTag JSXSelfClosingTag"(i){return i.column(i.node.from)+i.unit}}),Fs.add({"Block ClassBody SwitchBody EnumBody ObjectExpression ArrayExpression ObjectType":Cp,BlockComment(i){return{from:i.from+2,to:i.to-2}}})]}),languageData:{closeBrackets:{brackets:["(","[","{","'",'"',"`"]},commentTokens:{line:"//",block:{open:"/*",close:"*/"}},indentOnInput:/^\s*(?:case |default:|\{|\}|<\/)$/,wordChars:"$"}}),WC={test:i=>/^JSX/.test(i.name),facet:yp({commentTokens:{block:{open:"{/*",close:"*/}"}}})},XC=qi.configure({dialect:"ts"},"typescript"),FC=qi.configure({dialect:"jsx",props:[kp.add(i=>i.isTop?[WC]:void 0)]}),YC=qi.configure({dialect:"jsx ts",props:[kp.add(i=>i.isTop?[WC]:void 0)]},"typescript");let zC=i=>({label:i,type:"keyword"});const VC="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(zC),H8=VC.concat(["declare","implements","private","protected","public"].map(zC));function K8(i={}){let e=i.jsx?i.typescript?YC:FC:i.typescript?XC:qi,t=i.typescript?U8.concat(H8):IC.concat(VC);return new Do(e,[qi.data.of({autocomplete:iI(BC,Q_(t))}),qi.data.of({autocomplete:G8}),i.jsx?tB:[]])}function J8(i){for(;;){if(i.name=="JSXOpenTag"||i.name=="JSXSelfClosingTag"||i.name=="JSXFragmentTag")return i;if(i.name=="JSXEscape"||!i.parent)return null;i=i.parent}}function Yv(i,e,t=i.length){for(let n=e==null?void 0:e.firstChild;n;n=n.nextSibling)if(n.name=="JSXIdentifier"||n.name=="JSXBuiltin"||n.name=="JSXNamespacedName"||n.name=="JSXMemberExpression")return i.sliceString(n.from,Math.min(n.to,t));return""}const eB=typeof navigator=="object"&&/Android\b/.test(navigator.userAgent),tB=pe.inputHandler.of((i,e,t,n,r)=>{if((eB?i.composing:i.compositionStarted)||i.state.readOnly||e!=t||n!=">"&&n!="/"||!qi.isActiveAt(i.state,e,-1))return!1;let s=r(),{state:o}=s,l=o.changeByRange(a=>{var c;let{head:u}=a,h=At(o).resolveInner(u-1,-1),f;if(h.name=="JSXStartTag"&&(h=h.parent),!(o.doc.sliceString(u-1,u)!=n||h.name=="JSXAttributeValue"&&h.to>u)){if(n==">"&&h.name=="JSXFragmentTag")return{range:a,changes:{from:u,insert:"</>"}};if(n=="/"&&h.name=="JSXStartCloseTag"){let d=h.parent,m=d.parent;if(m&&d.from==u-2&&((f=Yv(o.doc,m.firstChild,u))||((c=m.firstChild)===null||c===void 0?void 0:c.name)=="JSXFragmentTag")){let
Line truncated
|
||||
`+w},""),d=r.state.selection.main.head,m=r.state.update({changes:{from:d,insert:f},selection:{anchor:d+1},scrollIntoView:!0});m&&r.dispatch(m)}xi(()=>{let c=new Vr,u=new Vr,h=et.create({doc:s,extensions:[ju,Ws.of([v_,...V_,...Bp]),c.of(Gv()),Gv(),W_(),u.of(et.tabSize.of(4)),ju,pe.editable.of(o),pe.updateListener.of(function(f){f.docChanged&&t(2,s=f.state.doc.toString())}),pe.lineWrapping,pe.contentAttributes.of({spellcheck:"true"})]});r=new pe({state:h,parent:n})}),Jw(()=>{r&&r.destroy()});function a(c){Ce[c?"unshift":"push"](()=>{n=c,t(1,n)})}return i.$$set=c=>{"value"in c&&t(2,s=c.value),"editable"in c&&t(0,o=c.editable)},[o,n,s,l,a]}class PB extends oe{constructor(e){super(),se(this,e,CB,_B,re,{value:2,editable:0,insertMedia:3})}get insertMedia(){return this.$$.ctx[3]}}function Hv(i){let e,t;return{c(){e=y("div"),t=W(i[6]),O(e,"class","invalid-feedback d-block")},m(n,r){x(n,e,r),b(e,t)},p(n,r){r&64&&K(t,n[6])},d(n){n&&P(e)}}}function AB(i){let e,t,n,r,s,o,l;t=new Gy({props:{record:i[2],field:i[1],validationErrors:i[4],onFilesInserted:i[7]}});function a(h){i[9](h)}let c={editable:!i[1].readonly||i[3]};i[0]!==void 0&&(c.value=i[0]),r=new PB({props:c}),i[8](r),Ce.push(()=>nt(r,"value",a));let u=i[6]&&Hv(i);return{c(){e=y("div"),V(t.$$.fragment),n=D(),V(r.$$.fragment),o=D(),u&&u.c(),O(e,"class","mb-3")},m(h,f){x(h,e,f),Y(t,e,null),b(e,n),Y(r,e,null),b(e,o),u&&u.m(e,null),l=!0},p(h,[f]){const d={};f&4&&(d.record=h[2]),f&2&&(d.field=h[1]),f&16&&(d.validationErrors=h[4]),t.$set(d);const m={};f&10&&(m.editable=!h[1].readonly||h[3]),!s&&f&1&&(s=!0,m.value=h[0],st(()=>s=!1)),r.$set(m),h[6]?u?u.p(h,f):(u=Hv(h),u.c(),u.m(e,null)):u&&(u.d(1),u=null)},i(h){l||(T(t.$$.fragment,h),T(r.$$.fragment,h),l=!0)},o(h){R(t.$$.fragment,h),R(r.$$.fragment,h),l=!1},d(h){h&&P(e),z(t),i[8](null),z(r),u&&u.d()}}}function xB(i,e,t){let n;const r=Ue("channel");let{value:s}=e,{field:o}=e,{record:l}=e,{isCreateMode:a}=e,{validationErrors:c}=e,u;function h(m){const p=m.detail.preset.path;u.insertMedia(r,m.detail.files,p)}function f(m){Ce[m?"unshift":"push"](()=>{u=m,t(5,u)})}function d(m){s=m,t(0,s)}return i.$$set=m=>{"value"in m&&t(0,s=m.value),"field"in m&&t(1,o=m.field),"record"in m&&t(2,l=m.record),"isCreateMode"in m&&t(3,a=m.isCreateMode),"validationErrors"in m&&t(4,c=m.validationErrors)},i.$$.update=()=>{i.$$.dirty&18&&t(6,n=In(c,o.name))},[s,o,l,a,c,u,n,h,f,d]}class lP extends oe{constructor(e){super(),se(this,e,xB,AB,re,{value:0,field:1,record:2,isCreateMode:3,validationErrors:4})}}function Kv(i){let e,t=i[0].help+"",n;return{c(){e=y("small"),n=W(t),O(e,"class","help-text light-text")},m(r,s){x(r,e,s),b(e,n)},p(r,s){s&1&&t!==(t=r[0].help+"")&&K(n,t)},d(r){r&&P(e)}}}function TB(i){let e,t,n,r,s=i[0].label+"",o,l,a,c,u,h=i[0].name+"",f,d=i[0].help&&Kv(i);return{c(){e=y("div"),t=y("div"),n=y("div"),r=y("label"),o=W(s),l=D(),d&&d.c(),a=D(),c=y("span"),u=y("code"),f=W(h),O(r,"for",i[1]),O(n,"class","label-and-help"),O(u,"class","field-id"),O(c,"tabindex","-1"),O(c,"class","text-decoration-none"),O(t,"class","labels"),O(e,"class","field-header")},m(m,p){x(m,e,p),b(e,t),b(t,n),b(n,r),b(r,o),b(n,l),d&&d.m(n,null),b(t,a),b(t,c),b(c,u),b(u,f)},p(m,[p]){p&1&&s!==(s=m[0].label+"")&&K(o,s),p&2&&O(r,"for",m[1]),m[0].help?d?d.p(m,p):(d=Kv(m),d.c(),d.m(n,null)):d&&(d.d(1),d=null),p&1&&h!==(h=m[0].name+"")&&K(f,h)},i:U,o:U,d(m){m&&P(e),d&&d.d()}}}function QB(i,e,t){let{field:n}=e,{id:r}=e;return i.$$set=s=>{"field"in s&&t(0,n=s.field),"id"in s&&t(1,r=s.id)},[n,r]}class MB extends oe{constructor(e){super(),se(this,e,QB,TB,re,{field:0,id:1})}}function Jv(i,e,t){const n=i.slice();return n[2]=e[t],n}function ew(i,e,t){const n=i.slice();return n[24]=e[t],n}function tw(i){let e,t;return{c(){e=y("div"),t=W(i[7]),O(e,"class","invalid-feedback d-block mb-3")},m(n,r){x(n,e,r),b(e,t)},p(n,r){r&128&&K(t,n[7])},d(n){n&&P(e)}}}function nw(i){let e=[],t=new Map,n,r=fe(i[5]);const s=l=>l[24].id;for(let l=0;l<r.length;l+=1){let a=ew(i,r,l),c=s(a);t.set(c,e[l]=rw(c,a))}let o=null;return r.length||(o=iw()),{c(){for(let l=0;l<e.length;l+=1)e[l].c();n=Ie(),o&&o.c()},m(l,a){for(let c=0;c<e.length;c+=1)e[c]&&e[c].m(l,a);x(l,n,a),o&&o.m(l,a)},p(l,a){a&2080&&(r=fe(l[5]),e=Ti(e,a,s,1,l,r,t,n.parentNode,Fm,rw,n,ew),!r.length&&o?o.p(l,a):r.length?o&&(o.d(1),o=null):(o=iw(),o.c(),o.m(n.parentNode,n)))},d(l){l&&P(n);for(let a=0;a<e.length;a+=1)e[a].d(l);o&&o.d(l)}}}function iw(i){let e;return{c(){e=y("div"),e.textContent="Start typing...",O(e,"class","start-typing")},m(t,n){x(t,e,n)},p:U,d(t){t&&P(e)}}}function rw(i,e){let t,n=e[24].data.name+"",r,s,o,l;function a(...u){return e[17](e[24],...u)}function c(...u){return e[18](e[24],...u)}return{key:i,first:null,c(){t=y("div"),r=W(n),s=D(),O(t,"class","reference-tags-option"),O(t,"role","button"),O(t,"tabindex","0"),this.first=t},m(u,h){x(u,t,h),b(t,r),b(t,s),o||(l=[G(t,"click",a),G(t,"keypress",c)],o=!0)},p(u,h){e=u,h&32&&n!==(n=e[24].data.name+"")&&K(r,n)},d(u){u&&P(t),o=!1,ht(l)}}}function sw(i){let e,t,n,r,s,o;return{c(){e=y
Line truncated
|
||||
versions`),xt=D(),H=y("div"),Ye.c(),Tt=D(),yt=y("div"),ct&&ct.c(),O(s,"class","label text-end text-muted"),O(f,"class","label text-end text-muted"),O(w,"class","label text-end text-muted"),O(L,"class","label text-end text-muted"),O(n,"class","col-8"),O(ee,"class","label d-block text-muted"),O(X,"class","col-4"),O(t,"class","row"),O(e,"class","lx-card"),O(H,"class","revisions")},m(qe,Mt){x(qe,e,Mt),b(e,t),b(t,n),b(n,r),b(r,s),b(r,o),b(r,l),b(l,c),b(n,u),b(n,h),b(h,f),b(h,d),b(h,p),b(n,g),b(n,v),b(v,w),b(v,S),Y(_,v,null),b(v,k),b(v,C),b(n,Q),b(n,M),b(M,L),b(M,N),Y(B,M,null),b(M,J),b(M,ie),b(t,ae),b(t,X),b(X,ee),b(X,Te),b(X,ve),b(ve,je),b(ve,Ee),b(ve,Re),x(qe,xt,Mt),x(qe,H,Mt),He[Pe].m(H,null),x(qe,Tt,Mt),x(qe,yt,Mt),ct&&ct.m(yt,null),i[13](yt),wt=!0},p(qe,[Mt]){(!wt||Mt&1)&&a!==(a=qe[0].id+"")&&K(c,a),(!wt||Mt&1)&&m!==(m=qe[0].version+"")&&K(p,m);const ei={};Mt&3&&(ei.name=Dn(qe[1],qe[0].createdBy)),_.$set(ei),(!wt||Mt&1)&&A!==(A=Bi(qe[0].createdAt)+"")&&K(C,A);const ti={};Mt&3&&(ti.name=Dn(qe[1],qe[0].updatedBy)),B.$set(ti),(!wt||Mt&1)&&te!==(te=Bi(qe[0].updatedAt)+"")&&K(ie,te),(!wt||Mt&4)&&ne!==(ne=qe[2].revisions+"")&&K(Ee,ne);let Ri=Pe;Pe=Ut(qe),Pe===Ri?He[Pe].p(qe,Mt):(Oe(),R(He[Ri],1,1,()=>{He[Ri]=null}),be(),Ye=He[Pe],Ye?Ye.p(qe,Mt):(Ye=He[Pe]=Qt[Pe](qe),Ye.c()),T(Ye,1),Ye.m(H,null)),qe[5]?ct?(ct.p(qe,Mt),Mt&32&&T(ct,1)):(ct=Sw(qe),ct.c(),T(ct,1),ct.m(yt,null)):ct&&(Oe(),R(ct,1,1,()=>{ct=null}),be())},i(qe){wt||(T(_.$$.fragment,qe),T(B.$$.fragment,qe),T(Ye),T(ct),wt=!0)},o(qe){R(_.$$.fragment,qe),R(B.$$.fragment,qe),R(Ye),R(ct),wt=!1},d(qe){qe&&(P(e),P(xt),P(H),P(Tt),P(yt)),z(_),z(B),He[Pe].d(),ct&&ct.d(),i[13](null)}}}function uW(i,e,t){let n,r,s,o;const l=Ue("channel");let{record:a}=e,{graph:c}=e,{users:u}=e,{schema:h}=e,f,d="";axios.get(`${l.lucentUrl}/records/${a.id}/revisions`).then(S=>{t(8,n=S.data)}).catch(S=>{console.log(S)});function m(S,_){t(7,o=c.edges.filter(k=>k.depth===1).reduce((k,A)=>(k[A.field]||(k[A.field]={record:[],revision:[]}),k[A.field].record.push(A),k),{})),t(7,o=_._edges.reduce((k,A)=>(k[A.field]||(k[A.field]={record:[],revision:[]}),k[A.field].revision.push(A),k),o))}function p(S,_){S.preventDefault(),t(5,s=_),t(6,r=h.fields.filter(k=>!ia(s.data[k.name],a.data[k.name]))),m(r,_),f.scrollIntoView()}function g(S){S.preventDefault(),t(4,d=""),axios.post(`${l.lucentUrl}/records/${a.id}/rollback/${s.version}`).then(_=>{window.location.reload()}).catch(_=>{const k=_.response.data.error;t(4,d=k.fieldLabel+": "+k.message)})}const v=(S,_)=>p(_,S);function w(S){Ce[S?"unshift":"push"](()=>{f=S,t(3,f)})}return i.$$set=S=>{"record"in S&&t(0,a=S.record),"graph"in S&&t(11,c=S.graph),"users"in S&&t(1,u=S.users),"schema"in S&&t(2,h=S.schema)},t(8,n=[]),t(6,r=[]),t(5,s=null),t(7,o={}),[a,u,h,f,d,s,r,o,n,p,g,c,v,w]}class hW extends oe{constructor(e){super(),se(this,e,uW,cW,re,{record:0,graph:11,users:1,schema:2})}}const{window:fW}=OP;function Mw(i,e,t){const n=i.slice();return n[21]=e[t],n}function dW(i){let e,t,n;return{c(){e=y("button"),e.innerHTML=`<span class="spinner-border spinner-border-sm" role="status" aria-hidden="true"></span>
|
||||
Save`,O(e,"type","button"),O(e,"class","button primary ms-2 btn btn-primary btn-spinner")},m(r,s){x(r,e,s),t||(n=G(e,"click",i[11]),t=!0)},p:U,d(r){r&&P(e),t=!1,n()}}}function mW(i){let e,t,n;return{c(){e=y("button"),e.innerHTML=`<span class="spinner-border spinner-border-sm" role="status" aria-hidden="true"></span>
|
||||
Create`,O(e,"class","button primary btn-spinner")},m(r,s){x(r,e,s),t||(n=G(e,"click",i[11]),t=!0)},p:U,d(r){r&&P(e),t=!1,n()}}}function pW(i){let e,t;return e=new hW({props:{record:i[0],graph:i[1],users:i[4],schema:i[2]}}),{c(){V(e.$$.fragment)},m(n,r){Y(e,n,r),t=!0},p(n,r){const s={};r&1&&(s.record=n[0]),r&2&&(s.graph=n[1]),r&16&&(s.users=n[4]),r&4&&(s.schema=n[2]),e.$set(s)},i(n){t||(T(e.$$.fragment,n),t=!0)},o(n){R(e.$$.fragment,n),t=!1},d(n){z(e,n)}}}function gW(i){let e,t;return e=new qB({props:{graph:i[1],record:i[0]}}),{c(){V(e.$$.fragment)},m(n,r){Y(e,n,r),t=!0},p(n,r){const s={};r&2&&(s.graph=n[1]),r&1&&(s.record=n[0]),e.$set(s)},i(n){t||(T(e.$$.fragment,n),t=!0)},o(n){R(e.$$.fragment,n),t=!1},d(n){z(e,n)}}}function OW(i){let e=[],t=new Map,n,r,s=fe(i[9]);const o=l=>l[21].name;for(let l=0;l<s.length;l+=1){let a=Mw(i,s,l),c=o(a);t.set(c,e[l]=Rw(c,a))}return{c(){for(let l=0;l<e.length;l+=1)e[l].c();n=Ie()},m(l,a){for(let c=0;c<e.length;c+=1)e[c]&&e[c].m(l,a);x(l,n,a),r=!0},p(l,a){a&623&&(s=fe(l[9]),Oe(),e=Ti(e,a,o,1,l,s,t,n.parentNode,Jr,Rw,n,Mw),be())},i(l){if(!r){for(let a=0;a<s.length;a+=1)T(e[a]);r=!0}},o(l){for(let a=0;a<e.length;a+=1)R(e[a]);r=!1},d(l){l&&P(n);for(let a=0;a<e.length;a+=1)e[a].d(l)}}}function Ew(i){let e,t,n,r;function s(a){i[15](a)}function o(a){i[16](a)}let l={field:i[21],schema:i[2],record:i[0],validationErrors:i[5],isCreateMode:i[3]};return i[0].data!==void 0&&(l.data=i[0].data),i[1]!==void 0&&(l.graph=i[1]),e=new aP({props:l}),Ce.push(()=>nt(e,"data",s)),Ce.push(()=>nt(e,"graph",o)),{c(){V(e.$$.fragment)},m(a,c){Y(e,a,c),r=!0},p(a,c){const u={};c&4&&(u.schema=a[2]),c&1&&(u.record=a[0]),c&32&&(u.validationErrors=a[5]),c&8&&(u.isCreateMode=a[3]),!t&&c&1&&(t=!0,u.data=a[0].data,st(()=>t=!1)),!n&&c&2&&(n=!0,u.graph=a[1],st(()=>n=!1)),e.$set(u)},i(a){r||(T(e.$$.fragment,a),r=!0)},o(a){R(e.$$.fragment,a),r=!1},d(a){z(e,a)}}}function Rw(i,e){let t,n,r,s=e[6]===e[21].group&&Ew(e);return{key:i,first:null,c(){t=Ie(),s&&s.c(),n=Ie(),this.first=t},m(o,l){x(o,t,l),s&&s.m(o,l),x(o,n,l),r=!0},p(o,l){e=o,e[6]===e[21].group?s?(s.p(e,l),l&64&&T(s,1)):(s=Ew(e),s.c(),T(s,1),s.m(n.parentNode,n)):s&&(Oe(),R(s,1,1,()=>{s=null}),be())},i(o){r||(T(s),r=!0)},o(o){R(s),r=!1},d(o){o&&(P(t),P(n)),s&&s.d(o)}}}function bW(i){let e,t,n,r,s,o,l,a,c,u,h,f,d,m,p,g,v,w,S,_,k;function A(X){i[12](X)}function C(X){i[13](X)}let Q={schema:i[2],isCreateMode:i[3]};i[0]!==void 0&&(Q.record=i[0]),i[6]!==void 0&&(Q.activeContentTab=i[6]),n=new cy({props:Q}),Ce.push(()=>nt(n,"record",A)),Ce.push(()=>nt(n,"activeContentTab",C));function M(X,ee){if(X[3])return mW;if(X[8])return dW}let L=M(i),N=L&&L(i);a=new _y({props:{schema:i[2],record:i[0],isCreateMode:i[3]}}),u=new Ma({props:{message:i[7]}});function B(X){i[14](X)}let J={schema:i[2],isCreateMode:i[3]};i[6]!==void 0&&(J.active=i[6]),d=new uy({props:J}),Ce.push(()=>nt(d,"active",B));const te=[OW,gW,pW],ie=[];function ae(X,ee){return ee&64&&(g=null),g==null&&(g=!["_graph","_info"].includes(X[6])),g?0:X[6]==="_graph"?1:X[6]==="_info"?2:-1}return~(v=ae(i,-1))&&(w=ie[v]=te[v](i)),{c(){e=y("div"),t=y("div"),V(n.$$.fragment),o=D(),N&&N.c(),l=D(),V(a.$$.fragment),c=D(),V(u.$$.fragment),h=D(),f=y("div"),V(d.$$.fragment),p=D(),w&&w.c(),O(t,"class","tools-header"),O(f,"class","mt-4"),le(f,"margin-bottom","150px"),le(f,"position","relative"),O(e,"class","record-edit")},m(X,ee){x(X,e,ee),b(e,t),Y(n,t,null),b(t,o),N&&N.m(t,null),b(e,l),Y(a,e,null),b(e,c),Y(u,e,null),b(e,h),b(e,f),Y(d,f,null),b(f,p),~v&&ie[v].m(f,null),S=!0,_||(k=G(fW,"beforeunload",i[10]),_=!0)},p(X,[ee]){const Te={};ee&4&&(Te.schema=X[2]),ee&8&&(Te.isCreateMode=X[3]),!r&&ee&1&&(r=!0,Te.record=X[0],st(()=>r=!1)),!s&&ee&64&&(s=!0,Te.activeContentTab=X[6],st(()=>s=!1)),n.$set(Te),L===(L=M(X))&&N?N.p(X,ee):(N&&N.d(1),N=L&&L(X),N&&(N.c(),N.m(t,null)));const ve={};ee&4&&(ve.schema=X[2]),ee&1&&(ve.record=X[0]),ee&8&&(ve.isCreateMode=X[3]),a.$set(ve);const je={};ee&128&&(je.message=X[7]),u.$set(je);const ne={};ee&4&&(ne.schema=X[2]),ee&8&&(ne.isCreateMode=X[3]),!m&&ee&64&&(m=!0,ne.active=X[6],st(()=>m=!1)),d.$set(ne);let Ee=v;v=ae(X,ee),v===Ee?~v&&ie[v].p(X,ee):(w&&(Oe(),R(ie[Ee],1,1,()=>{ie[Ee]=null}),be()),~v?(w=ie[v],w?w.p(X,ee):(w=ie[v]=te[v](X),w.c()),T(w,1),w.m(f,null)):w=null)},i(X){S||(T(n.$$.fragment,X),T(a.$$.fragment,X),T(u.$$.fragment,X),T(d.$$.fragment,X),T(w),S=!0)},o(X){R(n.$$.fragment,X),R(a.$$.fragment,X),R(u.$$.fragment,X),R(d.$$.fragment,X),R(w),S=!1},d(X){X&&P(e),z(n),N&&N.d(),z(a),z(u),z(d),~v&&ie[v].d(),_=!1,k()}}}function vW(i,e,t){let n,r,s;const o=Ue("channel");let{schema:l}=e,{record:a}=e,{graph:c={records:[],edges:[]}}=e,{isCreateMode:u}=e,{users:h}=e,f,d="",m=l.fields.filter(Q=>Q.name!=="id");xi(()=>{p()});function p(){f={data:JSON.parse(JSON.stringify(a.data)),status:a.status,edges:JSON.parse(JSON.stringify(c.edges))}}Kw(()=>{t(8,n=v())});function g(Q){return n?Q.returnValue="You have unsaved changes. Are you sure you want to exit?":(delete Q.returnValue,"...")}function v(){retu
Line truncated
|
||||
`),p=y("div"),p.textContent=" ",g=W(`
|
||||
`),O(n,"class","header-small mb-5"),O(o,"class","button primary mb-3"),o.disabled=i[2],O(c,"class","mb-3"),O(f,"class","logs svelte-16mig2w"),O(t,"class","lx-card mt-5"),O(e,"class","common-wrapper")},m(k,A){x(k,e,A),b(e,t),b(t,n),b(n,r),b(t,s),b(t,o),b(o,l),b(t,a),b(t,c),S&&S.m(c,null),b(c,u),_&&_.m(c,null),b(t,h),b(t,f),b(f,d),b(f,m),b(f,p),i[6](p),b(f,g),v||(w=G(o,"click",i[4]),v=!0)},p(k,[A]){A&1&&K(r,k[0]),A&4&&(o.disabled=k[2]),k[2]?S||(S=Bw(),S.c(),S.m(c,u)):S&&(S.d(1),S=null),!k[2]&&k[3]?_||(_=Ww(),_.c(),_.m(c,null)):_&&(_.d(1),_=null),A&8&&K(d,k[3])},i:U,o:U,d(k){k&&P(e),S&&S.d(),_&&_.d(),i[6](null),v=!1,w()}}}function RW(i,e,t){let n;const r=Ue("channel");let{title:s}=e,{command:o}=e,l,a=!1;function c(){const f=new EventSource(r.lucentUrl+"/command-report-source/"+o.signature);f.onmessage=function(d){t(2,a=!0);const m=JSON.parse(d.data);m.date,t(3,n=m.logs),l.scrollIntoView()},f.onerror=d=>{console.log(d),f.close(),t(2,a=!1)}}function u(f){f.preventDefault(),t(2,a=!0),Jn(r.lucentUrl+"/command/"+o.signature).then(d=>{c()})}xi(()=>{c()});function h(f){Ce[f?"unshift":"push"](()=>{l=f,t(1,l)})}return i.$$set=f=>{"title"in f&&t(0,s=f.title),"command"in f&&t(5,o=f.command)},t(3,n=""),[s,l,a,n,u,o,h]}class DW extends oe{constructor(e){super(),se(this,e,RW,EW,re,{title:0,command:5})}}function Xw(i,e,t){const n=i.slice();return n[2]=e[t],n}function $W(i){let e;return{c(){e=y("a"),e.textContent="Store admin",O(e,"href","/lunar")},m(t,n){x(t,e,n)},p:U,d(t){t&&P(e)}}}function LW(i){let e,t;return{c(){e=y("a"),t=W("Members"),O(e,"class","top-nav-item"),O(e,"href",i[0].lucentUrl+"/members")},m(n,r){x(n,e,r),b(e,t)},p:U,d(n){n&&P(e)}}}function IW(i){let e,t;return e=new ur({props:{$$slots:{button:[ZW],default:[NW]},$$scope:{ctx:i}}}),{c(){V(e.$$.fragment)},m(n,r){Y(e,n,r),t=!0},p(n,r){const s={};r&32&&(s.$$scope={dirty:r,ctx:n}),e.$set(s)},i(n){t||(T(e.$$.fragment,n),t=!0)},o(n){R(e.$$.fragment,n),t=!1},d(n){z(e,n)}}}function Fw(i){let e,t=i[2].name+"",n;return{c(){e=y("a"),n=W(t),O(e,"href",i[0].lucentUrl+"/command-report/"+i[2].signature),O(e,"class","top-nav-item")},m(r,s){x(r,e,s),b(e,n)},p:U,d(r){r&&P(e)}}}function NW(i){let e,t=fe(i[0].commands),n=[];for(let r=0;r<t.length;r+=1)n[r]=Fw(Xw(i,t,r));return{c(){for(let r=0;r<n.length;r+=1)n[r].c();e=Ie()},m(r,s){for(let o=0;o<n.length;o+=1)n[o]&&n[o].m(r,s);x(r,e,s)},p(r,s){if(s&1){t=fe(r[0].commands);let o;for(o=0;o<t.length;o+=1){const l=Xw(r,t,o);n[o]?n[o].p(l,s):(n[o]=Fw(l),n[o].c(),n[o].m(e.parentNode,e))}for(;o<n.length;o+=1)n[o].d(1);n.length=t.length}},d(r){r&&P(e),Ot(n,r)}}}function ZW(i){let e;return{c(){e=y("div"),e.textContent="Actions",O(e,"slot","button")},m(t,n){x(t,e,n)},p:U,d(t){t&&P(e)}}}function BW(i){let e,t;return e=new _i({props:{side:"28",name:i[1].name}}),{c(){V(e.$$.fragment)},m(n,r){Y(e,n,r),t=!0},p:U,i(n){t||(T(e.$$.fragment,n),t=!0)},o(n){R(e.$$.fragment,n),t=!1},d(n){z(e,n)}}}function WW(i){let e,t,n;return t=new _i({props:{side:"28",name:i[1].name}}),{c(){e=y("a"),V(t.$$.fragment),O(e,"href",i[0].lucentUrl+"/profile")},m(r,s){x(r,e,s),Y(t,e,null),n=!0},p:U,i(r){n||(T(t.$$.fragment,r),n=!0)},o(r){R(t.$$.fragment,r),n=!1},d(r){r&&P(e),z(t)}}}function XW(i){let e,t,n,r,s,o;function l(m,p){return m[0].auth=="lucent"?LW:$W}let c=l(i)(i),u=i[0].commands.length>0&&IW(i);const h=[WW,BW],f=[];function d(m,p){return m[0].auth=="lucent"?0:1}return r=d(i),s=f[r]=h[r](i),{c(){e=y("div"),c.c(),t=D(),u&&u.c(),n=D(),s.c(),O(e,"class","top-nav")},m(m,p){x(m,e,p),c.m(e,null),b(e,t),u&&u.m(e,null),b(e,n),f[r].m(e,null),o=!0},p(m,[p]){c.p(m,p),m[0].commands.length>0&&u.p(m,p),s.p(m,p)},i(m){o||(T(u),T(s),o=!0)},o(m){R(u),R(s),o=!1},d(m){m&&P(e),c.d(),u&&u.d(),f[r].d()}}}function FW(i){const e=Ue("channel"),t=Ue("user");return[e,t]}class YW extends oe{constructor(e){super(),se(this,e,FW,XW,re,{})}}function zW(i){let e,t,n,r,s,o,l,a,c;n=new SW({props:{schema:i[2].schema}}),o=new YW({});const u=[{title:i[0]},i[2]];var h=i[3][i[1]];function f(d,m){let p={};for(let g=0;g<u.length;g+=1)p=Ps(p,u[g]);return m!==void 0&&m&5&&(p=Ps(p,_o(u,[m&1&&{title:d[0]},m&4&&Co(d[2])]))),{props:p}}return h&&(a=Xr(h,f(i))),{c(){e=y("div"),t=y("div"),V(n.$$.fragment),r=D(),s=y("div"),V(o.$$.fragment),l=D(),a&&V(a.$$.fragment),O(t,"class","sidebar-content"),O(s,"class","main-content"),O(e,"class","main-wrapper")},m(d,m){x(d,e,m),b(e,t),Y(n,t,null),b(e,r),b(e,s),Y(o,s,null),b(s,l),a&&Y(a,s,null),c=!0},p(d,[m]){const p={};if(m&4&&(p.schema=d[2].schema),n.$set(p),m&2&&h!==(h=d[3][d[1]])){if(a){Oe();const g=a;R(g.$$.fragment,1,0,()=>{z(g,1)}),be()}h?(a=Xr(h,f(d,m)),V(a.$$.fragment),T(a.$$.fragment,1),Y(a,s,null)):a=null}else if(h){const g=m&5?_o(u,[m&1&&{title:d[0]},m&4&&Co(d[2])]):{};a.$set(g)}},i(d){c||(T(n.$$.fragment,d),T(o.$$.fragment,d),a&&T(a.$$.fragment,d),c=!0)},o(d){R(n.$$.fragment,d),R(o.$$.fragment,d),a&&R(a.$$.fragment,d),c=!1},d(d){d&&P(e),z(n),z(o),a&&z(a)}}}function VW(i,e,t){const n={members:Dx,recordEdit:wW,recordNotFound:Ix,contentIndex:Ay,homeIndex:MW
Line truncated
|
||||
Vendored
+2
-2
@@ -1,11 +1,11 @@
|
||||
{
|
||||
"main.js": {
|
||||
"file": "assets/main-BJyanQ7P.js",
|
||||
"file": "assets/main-DtbuHUXl.js",
|
||||
"name": "main",
|
||||
"src": "main.js",
|
||||
"isEntry": true,
|
||||
"css": [
|
||||
"assets/main-Dk7njt4m.css"
|
||||
"assets/main-BadhVKbO.css"
|
||||
]
|
||||
}
|
||||
}
|
||||
Vendored
-51
@@ -1,51 +0,0 @@
|
||||
/**
|
||||
* We'll load the axios HTTP library which allows us to easily issue requests
|
||||
* to our Laravel back-end. This library automatically handles sending the
|
||||
* CSRF token as a header based on the value of the "XSRF" token cookie.
|
||||
*/
|
||||
|
||||
import axios from "axios";
|
||||
import {loadHtmxFormsBehaviour} from "./htmx-form.js";
|
||||
|
||||
loadHtmxFormsBehaviour();
|
||||
window.axios = axios;
|
||||
export const axiosInstance = axios;
|
||||
|
||||
window.axios.defaults.headers.common["X-Requested-With"] = "XMLHttpRequest";
|
||||
window.axios.interceptors.request.use(
|
||||
function (config) {
|
||||
let list;
|
||||
list = document.querySelectorAll(".btn-spinner");
|
||||
for (let i = 0; i < list.length; ++i) {
|
||||
list[i].classList.add("spinner-on");
|
||||
list[i].disabled = true;
|
||||
}
|
||||
|
||||
return config;
|
||||
},
|
||||
function (error) {
|
||||
return Promise.reject(error);
|
||||
}
|
||||
);
|
||||
|
||||
window.axios.interceptors.response.use(
|
||||
function (response) {
|
||||
let list;
|
||||
list = document.querySelectorAll(".btn-spinner");
|
||||
for (let i = 0; i < list.length; ++i) {
|
||||
list[i].classList.remove("spinner-on");
|
||||
list[i].disabled = false;
|
||||
}
|
||||
return response;
|
||||
},
|
||||
function (error) {
|
||||
let list;
|
||||
list = document.querySelectorAll(".btn-spinner");
|
||||
for (let i = 0; i < list.length; ++i) {
|
||||
list[i].classList.remove("spinner-on");
|
||||
list[i].disabled = false;
|
||||
}
|
||||
return Promise.reject(error);
|
||||
}
|
||||
);
|
||||
|
||||
+116
-17
@@ -1,52 +1,151 @@
|
||||
import {formatDistanceToNow, parseJSON, format, parse} from "date-fns";
|
||||
import { formatDistanceToNow, parseJSON, format, parse } from "date-fns";
|
||||
|
||||
export function friendlyDate(date) {
|
||||
return formatDistanceToNow(parseJSON(date), {addSuffix: true});
|
||||
return formatDistanceToNow(parseJSON(date), { addSuffix: true });
|
||||
}
|
||||
|
||||
export function readableDate(date) {
|
||||
if(!date){
|
||||
if (!date) {
|
||||
return "";
|
||||
}
|
||||
return format(parseJSON(date), "dd MMM yyyy");
|
||||
}
|
||||
|
||||
export function readableDatetime(date) {
|
||||
if(!date){
|
||||
if (!date) {
|
||||
return "";
|
||||
}
|
||||
|
||||
return format(parseJSON(date), "dd MMM yyyy HH:mm");
|
||||
}
|
||||
|
||||
|
||||
export function stripHtml(html = "") {
|
||||
let tmp = document.createElement("div");
|
||||
tmp.innerHTML = html;
|
||||
return tmp.textContent || tmp.innerText || "";
|
||||
}
|
||||
|
||||
|
||||
export function randomId(length = 10) {
|
||||
return Math.random().toString(36).substring(2, length + 2);
|
||||
return Math.random()
|
||||
.toString(36)
|
||||
.substring(2, length + 2);
|
||||
}
|
||||
|
||||
export function clickOutside(node) {
|
||||
|
||||
const handleClick = event => {
|
||||
const handleClick = (event) => {
|
||||
if (node && !node.contains(event.target) && !event.defaultPrevented) {
|
||||
node.dispatchEvent(
|
||||
new CustomEvent('click_outside', node)
|
||||
)
|
||||
}
|
||||
node.dispatchEvent(new CustomEvent("click_outside", node));
|
||||
}
|
||||
};
|
||||
|
||||
document.addEventListener('click', handleClick, true);
|
||||
document.addEventListener("click", handleClick, true);
|
||||
|
||||
return {
|
||||
destroy() {
|
||||
document.removeEventListener('click', handleClick, true);
|
||||
}
|
||||
}
|
||||
document.removeEventListener("click", handleClick, true);
|
||||
},
|
||||
};
|
||||
}
|
||||
|
||||
export function apiFetch(url, options = {}) {
|
||||
return fetch(url, {
|
||||
...options,
|
||||
headers: {
|
||||
"Content-Type": "application/json",
|
||||
"X-CSRF-TOKEN": document.querySelector('meta[name="csrf-token"]').content,
|
||||
...options.headers,
|
||||
},
|
||||
});
|
||||
}
|
||||
|
||||
export function apiPost(url, body, options = {}) {
|
||||
return fetch(url, {
|
||||
...options,
|
||||
method: "POST",
|
||||
body: JSON.stringify(body),
|
||||
headers: {
|
||||
"Content-Type": "application/json",
|
||||
"X-Requested-With": "XMLHttpRequest",
|
||||
"X-CSRF-TOKEN": document.querySelector('meta[name="csrf-token"]').content,
|
||||
...options.headers,
|
||||
},
|
||||
}).then((r) => r.json());
|
||||
}
|
||||
|
||||
export function apiGet(url, options = {}) {
|
||||
return fetch(url, {
|
||||
...options,
|
||||
method: "GET",
|
||||
headers: {
|
||||
"X-CSRF-TOKEN": document.querySelector('meta[name="csrf-token"]').content,
|
||||
"X-Requested-With": "XMLHttpRequest",
|
||||
...options.headers,
|
||||
},
|
||||
}).then((r) => r.json());
|
||||
}
|
||||
|
||||
export function isEqual(db, ed) {
|
||||
let isObject = (x) =>
|
||||
typeof x === "object" && !Array.isArray(x) && x !== null;
|
||||
let isArray = (x) => x?.constructor === Array;
|
||||
let isEmpty = (x) => x === null || x === undefined;
|
||||
const db_value = db ?? null;
|
||||
const ed_value = ed ?? null;
|
||||
|
||||
if (isObject(db_value)) {
|
||||
let keys = Object.keys(db_value);
|
||||
return keys.reduce((acc, k) => {
|
||||
if (acc === false) {
|
||||
return false;
|
||||
}
|
||||
return isEqual(db_value?.[k], ed_value?.[k]);
|
||||
}, true);
|
||||
}
|
||||
if (isArray(db_value)) {
|
||||
if (!isArray(ed_value) || db_value.length !== ed_value.length) {
|
||||
return false;
|
||||
}
|
||||
return db_value.reduce((c, v, i) => {
|
||||
if (c === false) {
|
||||
return false;
|
||||
}
|
||||
return isEqual(v, ed_value[i]);
|
||||
}, true);
|
||||
}
|
||||
|
||||
if (isEmpty(db_value) && isEmpty(ed_value)) {
|
||||
return true;
|
||||
}
|
||||
|
||||
if (db_value == ed_value) {
|
||||
return true;
|
||||
}
|
||||
|
||||
return false;
|
||||
}
|
||||
|
||||
export function debounce(fn, delay) {
|
||||
let timer;
|
||||
return (...args) => {
|
||||
clearTimeout(timer);
|
||||
timer = setTimeout(() => fn(...args), delay);
|
||||
};
|
||||
}
|
||||
|
||||
export function arrayUnique(array) {
|
||||
return array.filter((value, index) => array.indexOf(value) === index);
|
||||
}
|
||||
|
||||
export function arrayUniqueBy(items, uniqueBy) {
|
||||
const ids = new Set(items.map((item) => item[uniqueBy]));
|
||||
return [...ids].map((id) => items.find((i) => i[uniqueBy] === id));
|
||||
}
|
||||
export function arrayUniqueCb(items, aFilter) {
|
||||
const cache = new Set();
|
||||
return items.filter((item) => {
|
||||
const cacheValue = aFilter(item);
|
||||
if (cache.has(cacheValue)) return false;
|
||||
cache.add(cacheValue);
|
||||
return true;
|
||||
});
|
||||
}
|
||||
@@ -1,24 +0,0 @@
|
||||
export function loadHtmxFormsBehaviour(){
|
||||
document.querySelectorAll(".form").forEach(el => {
|
||||
initHtmxForm(el);
|
||||
})
|
||||
|
||||
}
|
||||
|
||||
function initHtmxForm(el){
|
||||
el.addEventListener("htmx:responseError", (e) => {
|
||||
el.querySelector(".form-errors").innerHTML = e.detail.xhr.response;
|
||||
});
|
||||
|
||||
const formEl = el.querySelector("form");
|
||||
|
||||
if(!formEl.getAttribute("hx-redirect")){
|
||||
return;
|
||||
}
|
||||
el.addEventListener("htmx:afterOnLoad", (e) => {
|
||||
if(e.detail.successful){
|
||||
return window.location.href = formEl.getAttribute("hx-redirect");
|
||||
}
|
||||
});
|
||||
|
||||
}
|
||||
+6
-12
@@ -1,14 +1,11 @@
|
||||
import {axiosInstance} from "./bootstrap";
|
||||
import "../sass/app.scss";
|
||||
import Account from "./svelte/Account.svelte";
|
||||
import Channel from "./svelte/Channel.svelte";
|
||||
import Mustache from "mustache";
|
||||
import 'htmx.org';
|
||||
|
||||
Mustache.escape = function (value) {
|
||||
return value;
|
||||
};
|
||||
// import Mustache from "mustache";
|
||||
|
||||
// Mustache.escape = function (value) {
|
||||
// return value;
|
||||
// };
|
||||
|
||||
// Define all components
|
||||
const entryComponents = {
|
||||
@@ -29,17 +26,14 @@ let loadSvelte = function () {
|
||||
const loadElement = function (element) {
|
||||
const componentId = element.attributes["data-layout"].value;
|
||||
const [_, component] = Object.entries(entryComponents).find(
|
||||
([key, _]) => componentId === key
|
||||
([key, _]) => componentId === key,
|
||||
);
|
||||
if (!component) {
|
||||
return [];
|
||||
}
|
||||
|
||||
const jsonData = document.getElementById(
|
||||
"json-" + componentId
|
||||
).innerHTML;
|
||||
const jsonData = document.getElementById("json-" + componentId).innerHTML;
|
||||
const props = JSON.parse(jsonData);
|
||||
props.axios = axiosInstance;
|
||||
const compOptions = {
|
||||
target: element,
|
||||
props: props,
|
||||
|
||||
@@ -3,15 +3,13 @@
|
||||
import Login from "./account/Login.svelte";
|
||||
import Verify from "./account/Verify.svelte";
|
||||
import Profile from "./account/Profile.svelte";
|
||||
import SetupIndex from "./setup/Index.svelte";
|
||||
import {setContext} from "svelte";
|
||||
import { setContext } from "svelte";
|
||||
|
||||
const components = {
|
||||
register: Register,
|
||||
login: Login,
|
||||
verify: Verify,
|
||||
profile: Profile,
|
||||
setup: SetupIndex,
|
||||
};
|
||||
|
||||
export let title;
|
||||
@@ -23,10 +21,7 @@
|
||||
setContext("channel", channel);
|
||||
setContext("user", user);
|
||||
</script>
|
||||
<div style="text-align: center;background: var(--p20);padding: 20px;color: var(--p90)">
|
||||
<h1><a class="text-decoration-none" href="{channel.lucentUrl}">{channel.name ?? "Lucent Setup"}</a></h1>
|
||||
</div>
|
||||
<div>
|
||||
<svelte:component this={components[view]} {title} {...data}/>
|
||||
</div>
|
||||
|
||||
<div>
|
||||
<svelte:component this={components[view]} {channel} {title} {...data} />
|
||||
</div>
|
||||
@@ -3,7 +3,7 @@
|
||||
import RecordNotFound from "./records/NotFound.svelte";
|
||||
import RecordEdit from "./records/Edit.svelte";
|
||||
import ContentIndex from "./content/Index.svelte";
|
||||
import {setContext} from "svelte";
|
||||
import { setContext } from "svelte";
|
||||
import Navbar from "./layout/Navbar.svelte";
|
||||
import HomeIndex from "./home/Index.svelte";
|
||||
import BuildReport from "./build/Report.svelte";
|
||||
@@ -25,27 +25,22 @@
|
||||
// export let layout;
|
||||
export let channel;
|
||||
|
||||
export let axios;
|
||||
export let readableSchemas;
|
||||
|
||||
|
||||
setContext("axios", axios);
|
||||
setContext("channel", channel);
|
||||
setContext("readableSchemas", channel.schemas.filter((s) => readableSchemas.includes(s.name)));
|
||||
setContext(
|
||||
"readableSchemas",
|
||||
channel.schemas.filter((s) => readableSchemas.includes(s.name)),
|
||||
);
|
||||
setContext("user", user);
|
||||
|
||||
</script>
|
||||
|
||||
|
||||
<div class="main-wrapper">
|
||||
<div class="sidebar-content">
|
||||
<Navbar schema={data.schema}/>
|
||||
</div>
|
||||
<div class="main-content">
|
||||
<div class="sidebar-content">
|
||||
<Navbar schema={data.schema} />
|
||||
</div>
|
||||
<div class="main-content">
|
||||
<Header />
|
||||
<svelte:component this={components[view]} {title} {...data}/>
|
||||
<svelte:component this={components[view]} {title} {...data} />
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
|
||||
|
||||
@@ -1,39 +1,48 @@
|
||||
<script>
|
||||
import {getContext} from "svelte";
|
||||
import SpinnerButton from "../common/SpinnerButton.svelte";
|
||||
import { getContext } from "svelte";
|
||||
import { apiPost } from "../../helpers";
|
||||
|
||||
const channel = getContext("channel");
|
||||
let email = "";
|
||||
let message = "";
|
||||
let submitted = false;
|
||||
|
||||
function login(e) {
|
||||
e.preventDefault();
|
||||
|
||||
axios
|
||||
.post(channel.lucentUrl + "/login", {
|
||||
email: email,
|
||||
apiPost(channel.lucentUrl + "/login", { email: email })
|
||||
.then(() => {
|
||||
submitted = true;
|
||||
})
|
||||
.then((response) => {
|
||||
console.log(response)
|
||||
message = "You will receive an email with a login link"
|
||||
})
|
||||
.catch((error) => {
|
||||
});
|
||||
.catch(() => {});
|
||||
}
|
||||
|
||||
</script>
|
||||
|
||||
<div class="wrapper-tiny">
|
||||
{#if message}
|
||||
<div class="scope-login">
|
||||
<div class="bg-image"></div>
|
||||
<div class="login-form">
|
||||
{#if submitted}
|
||||
<div class="alert alert-info" role="alert">
|
||||
{message}
|
||||
<p>
|
||||
You will receive an email with a login link at <b>{email}</b
|
||||
>.
|
||||
</p>
|
||||
<p>Check your spam folder</p>
|
||||
</div>
|
||||
|
||||
{:else}
|
||||
<div class="form">
|
||||
<h2 class="mb-5">Enter Lucent</h2>
|
||||
|
||||
<form on:submit={login}>
|
||||
<div class="mb-3">
|
||||
<label for="emailaddress" class="form-label">Email address</label>
|
||||
<p>
|
||||
Submit your email address and you will receive a <b
|
||||
>login link</b
|
||||
> to your email
|
||||
</p>
|
||||
<p>Don't forget to check your spam folder</p>
|
||||
<div class="mt-5 mb-3">
|
||||
<label for="emailaddress" class="form-label"
|
||||
>Email address</label
|
||||
>
|
||||
<input
|
||||
type="email"
|
||||
bind:value={email}
|
||||
@@ -43,12 +52,17 @@
|
||||
/>
|
||||
</div>
|
||||
|
||||
|
||||
<div class="text-center mt-5 d-block">
|
||||
<SpinnerButton label="Login"/>
|
||||
</div>
|
||||
|
||||
|
||||
<button class="bt bt-primary">
|
||||
Send email
|
||||
<img
|
||||
alt="indicator"
|
||||
id="indicator"
|
||||
class="htmx-indicator"
|
||||
src="/img/spinner.svg"
|
||||
/>
|
||||
</button>
|
||||
</form>
|
||||
</div>
|
||||
{/if}
|
||||
</div>
|
||||
</div>
|
||||
@@ -2,8 +2,9 @@
|
||||
import ErrorAlert from "../common/ErrorAlert.svelte";
|
||||
import SpinnerButton from "../common/SpinnerButton.svelte";
|
||||
import Avatar from "./Avatar.svelte";
|
||||
import {getContext} from "svelte";
|
||||
import { getContext } from "svelte";
|
||||
import SuccessAlert from "../common/SuccessAlert.svelte";
|
||||
import { apiPost } from "../../helpers";
|
||||
|
||||
const user = getContext("user");
|
||||
const channel = getContext("channel");
|
||||
@@ -16,8 +17,7 @@
|
||||
e.preventDefault();
|
||||
errorMessage = "";
|
||||
|
||||
axios
|
||||
.post(channel.lucentUrl + "/account/update-name", {
|
||||
apiPost(channel.lucentUrl + "/account/update-name", {
|
||||
name: name,
|
||||
})
|
||||
.then((response) => {
|
||||
@@ -25,7 +25,7 @@
|
||||
})
|
||||
.catch((error) => {
|
||||
errorMessage = error.response?.data.error;
|
||||
console.log({errorMessage});
|
||||
console.log({ errorMessage });
|
||||
});
|
||||
}
|
||||
|
||||
@@ -33,8 +33,7 @@
|
||||
e.preventDefault();
|
||||
errorMessage = "";
|
||||
|
||||
axios
|
||||
.post(channel.lucentUrl + "/account/update-email", {
|
||||
apiPost(channel.lucentUrl + "/account/update-email", {
|
||||
email: email,
|
||||
})
|
||||
.then((response) => {
|
||||
@@ -42,17 +41,16 @@
|
||||
})
|
||||
.catch((error) => {
|
||||
errorMessage = error.response?.data.error;
|
||||
console.log({errorMessage});
|
||||
console.log({ errorMessage });
|
||||
});
|
||||
}
|
||||
</script>
|
||||
|
||||
|
||||
<div class="wrapper-tiny">
|
||||
<ErrorAlert message={errorMessage}/>
|
||||
<ErrorAlert message={errorMessage} />
|
||||
<SuccessAlert bind:this={successAlert} />
|
||||
<h3 class="header-small mb-5">
|
||||
<Avatar name={user.name}/>
|
||||
<Avatar name={user.name} />
|
||||
</h3>
|
||||
<form on:submit={saveName}>
|
||||
<div class="input-group mb-5">
|
||||
@@ -63,7 +61,7 @@
|
||||
placeholder="Name"
|
||||
required
|
||||
/>
|
||||
<SpinnerButton label="Update Name"/>
|
||||
<SpinnerButton label="Update Name" />
|
||||
</div>
|
||||
</form>
|
||||
|
||||
@@ -76,12 +74,14 @@
|
||||
placeholder="Email"
|
||||
required
|
||||
/>
|
||||
<SpinnerButton label="Update Email"/>
|
||||
<SpinnerButton label="Update Email" />
|
||||
</div>
|
||||
</form>
|
||||
|
||||
<div class="list-group">
|
||||
<a class="list-group-item list-group-item-action" href="{ channel.lucentUrl }/logout">Logout from this
|
||||
device</a>
|
||||
<a
|
||||
class="list-group-item list-group-item-action"
|
||||
href="{channel.lucentUrl}/logout">Logout from this device</a
|
||||
>
|
||||
</div>
|
||||
</div>
|
||||
@@ -1,7 +1,8 @@
|
||||
<script>
|
||||
import { apiPost } from "../../helpers";
|
||||
import ErrorAlert from "../common/ErrorAlert.svelte";
|
||||
import SpinnerButton from "../common/SpinnerButton.svelte";
|
||||
import {getContext} from "svelte";
|
||||
import { getContext } from "svelte";
|
||||
|
||||
const channel = getContext("channel");
|
||||
let name = "";
|
||||
@@ -12,8 +13,7 @@
|
||||
e.preventDefault();
|
||||
errorMessage = "";
|
||||
|
||||
axios
|
||||
.post(channel.lucentUrl + "/register", {
|
||||
apiPost(channel.lucentUrl + "/register", {
|
||||
name: name,
|
||||
email: email,
|
||||
})
|
||||
@@ -22,13 +22,13 @@
|
||||
})
|
||||
.catch((error) => {
|
||||
errorMessage = error.response?.data.error;
|
||||
console.log({errorMessage});
|
||||
console.log({ errorMessage });
|
||||
});
|
||||
}
|
||||
</script>
|
||||
|
||||
<div class="wrapper-tiny">
|
||||
<ErrorAlert message={errorMessage}/>
|
||||
<ErrorAlert message={errorMessage} />
|
||||
|
||||
<form on:submit={register}>
|
||||
<div class="mb-3">
|
||||
@@ -50,10 +50,8 @@
|
||||
/>
|
||||
</div>
|
||||
|
||||
|
||||
<div class="text-center mt-5 d-block">
|
||||
<SpinnerButton label="Register"/>
|
||||
<SpinnerButton label="Register" />
|
||||
</div>
|
||||
</form>
|
||||
|
||||
</div>
|
||||
@@ -1,43 +1,42 @@
|
||||
<script>
|
||||
import {getContext} from "svelte";
|
||||
import SpinnerButton from "../common/SpinnerButton.svelte";
|
||||
import SuccessAlert from "../common/SuccessAlert.svelte";
|
||||
import { getContext } from "svelte";
|
||||
import { apiPost } from "../../helpers";
|
||||
|
||||
const channel = getContext("channel");
|
||||
export let email;
|
||||
export let token;
|
||||
let successAlert;
|
||||
|
||||
function login(e) {
|
||||
e.preventDefault();
|
||||
|
||||
axios
|
||||
.post(channel.lucentUrl + "/verify", {
|
||||
apiPost(channel.lucentUrl + "/verify", {
|
||||
email: email,
|
||||
token: token,
|
||||
})
|
||||
.then((response) => {
|
||||
window.location = channel.lucentUrl;
|
||||
})
|
||||
.catch((error) => {
|
||||
});
|
||||
.catch((error) => {});
|
||||
}
|
||||
|
||||
</script>
|
||||
|
||||
<SuccessAlert bind:this={successAlert}/>
|
||||
<div class="wrapper-tiny">
|
||||
|
||||
<div class="scope-login">
|
||||
<div class="bg-image"></div>
|
||||
<div class="login-form">
|
||||
<div class="form">
|
||||
<h2 class="mb-5">Welcome to Lucent</h2>
|
||||
<form on:submit={login}>
|
||||
<div class="mb-3 text-center">
|
||||
<h3>Login as {email}</h3>
|
||||
|
||||
</div>
|
||||
|
||||
|
||||
<div class="text-center mt-5 d-block">
|
||||
<SpinnerButton label="Enter"/>
|
||||
</div>
|
||||
<button class="bt bt-primary">
|
||||
Enter as {email}
|
||||
<img
|
||||
alt="indicator"
|
||||
id="indicator"
|
||||
class="htmx-indicator"
|
||||
src="/img/spinner.svg"
|
||||
/>
|
||||
</button>
|
||||
</form>
|
||||
|
||||
<div class="form-errors"></div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
@@ -0,0 +1,139 @@
|
||||
/* eslint-disable no-undefined,no-param-reassign,no-shadow */
|
||||
|
||||
/**
|
||||
* Throttle execution of a function. Especially useful for rate limiting
|
||||
* execution of handlers on events like resize and scroll.
|
||||
*
|
||||
* @param {number} delay - A zero-or-greater delay in milliseconds. For event callbacks, values around 100 or 250 (or even higher)
|
||||
* are most useful.
|
||||
* @param {Function} callback - A function to be executed after delay milliseconds. The `this` context and all arguments are passed through,
|
||||
* as-is, to `callback` when the throttled-function is executed.
|
||||
* @param {object} [options] - An object to configure options.
|
||||
* @param {boolean} [options.noTrailing] - Optional, defaults to false. If noTrailing is true, callback will only execute every `delay` milliseconds
|
||||
* while the throttled-function is being called. If noTrailing is false or unspecified, callback will be executed
|
||||
* one final time after the last throttled-function call. (After the throttled-function has not been called for
|
||||
* `delay` milliseconds, the internal counter is reset).
|
||||
* @param {boolean} [options.noLeading] - Optional, defaults to false. If noLeading is false, the first throttled-function call will execute callback
|
||||
* immediately. If noLeading is true, the first the callback execution will be skipped. It should be noted that
|
||||
* callback will never executed if both noLeading = true and noTrailing = true.
|
||||
* @param {boolean} [options.debounceMode] - If `debounceMode` is true (at begin), schedule `clear` to execute after `delay` ms. If `debounceMode` is
|
||||
* false (at end), schedule `callback` to execute after `delay` ms.
|
||||
*
|
||||
* @returns {Function} A new, throttled, function.
|
||||
*/
|
||||
export function throttle(delay, callback, options) {
|
||||
const {
|
||||
noTrailing = false,
|
||||
noLeading = false,
|
||||
debounceMode = undefined,
|
||||
} = options || {};
|
||||
/*
|
||||
* After wrapper has stopped being called, this timeout ensures that
|
||||
* `callback` is executed at the proper times in `throttle` and `end`
|
||||
* debounce modes.
|
||||
*/
|
||||
let timeoutID;
|
||||
let cancelled = false;
|
||||
|
||||
// Keep track of the last time `callback` was executed.
|
||||
let lastExec = 0;
|
||||
|
||||
// Function to clear existing timeout
|
||||
function clearExistingTimeout() {
|
||||
if (timeoutID) {
|
||||
clearTimeout(timeoutID);
|
||||
}
|
||||
}
|
||||
|
||||
// Function to cancel next exec
|
||||
function cancel(options) {
|
||||
const { upcomingOnly = false } = options || {};
|
||||
clearExistingTimeout();
|
||||
cancelled = !upcomingOnly;
|
||||
}
|
||||
|
||||
/*
|
||||
* The `wrapper` function encapsulates all of the throttling / debouncing
|
||||
* functionality and when executed will limit the rate at which `callback`
|
||||
* is executed.
|
||||
*/
|
||||
function wrapper(...arguments_) {
|
||||
let self = this;
|
||||
let elapsed = Date.now() - lastExec;
|
||||
|
||||
if (cancelled) {
|
||||
return;
|
||||
}
|
||||
|
||||
// Execute `callback` and update the `lastExec` timestamp.
|
||||
function exec() {
|
||||
lastExec = Date.now();
|
||||
callback.apply(self, arguments_);
|
||||
}
|
||||
|
||||
/*
|
||||
* If `debounceMode` is true (at begin) this is used to clear the flag
|
||||
* to allow future `callback` executions.
|
||||
*/
|
||||
function clear() {
|
||||
timeoutID = undefined;
|
||||
}
|
||||
|
||||
if (!noLeading && debounceMode && !timeoutID) {
|
||||
/*
|
||||
* Since `wrapper` is being called for the first time and
|
||||
* `debounceMode` is true (at begin), execute `callback`
|
||||
* and noLeading != true.
|
||||
*/
|
||||
exec();
|
||||
}
|
||||
|
||||
clearExistingTimeout();
|
||||
|
||||
if (debounceMode === undefined && elapsed > delay) {
|
||||
if (noLeading) {
|
||||
/*
|
||||
* In throttle mode with noLeading, if `delay` time has
|
||||
* been exceeded, update `lastExec` and schedule `callback`
|
||||
* to execute after `delay` ms.
|
||||
*/
|
||||
lastExec = Date.now();
|
||||
if (!noTrailing) {
|
||||
timeoutID = setTimeout(debounceMode ? clear : exec, delay);
|
||||
}
|
||||
} else {
|
||||
/*
|
||||
* In throttle mode without noLeading, if `delay` time has been exceeded, execute
|
||||
* `callback`.
|
||||
*/
|
||||
exec();
|
||||
}
|
||||
} else if (noTrailing !== true) {
|
||||
/*
|
||||
* In trailing throttle mode, since `delay` time has not been
|
||||
* exceeded, schedule `callback` to execute `delay` ms after most
|
||||
* recent execution.
|
||||
*
|
||||
* If `debounceMode` is true (at begin), schedule `clear` to execute
|
||||
* after `delay` ms.
|
||||
*
|
||||
* If `debounceMode` is false (at end), schedule `callback` to
|
||||
* execute after `delay` ms.
|
||||
*/
|
||||
timeoutID = setTimeout(
|
||||
debounceMode ? clear : exec,
|
||||
debounceMode === undefined ? delay - elapsed : delay,
|
||||
);
|
||||
}
|
||||
}
|
||||
|
||||
wrapper.cancel = cancel;
|
||||
|
||||
// Return the wrapper function.
|
||||
return wrapper;
|
||||
}
|
||||
|
||||
export function debounce(delay, callback, options) {
|
||||
const { atBegin = false } = options || {};
|
||||
return throttle(delay, callback, { debounceMode: atBegin !== false });
|
||||
}
|
||||
@@ -1,7 +1,6 @@
|
||||
<script>
|
||||
import {getContext, onMount} from "svelte";
|
||||
import axios from "axios";
|
||||
|
||||
import { getContext, onMount } from "svelte";
|
||||
import { apiPost } from "../../helpers";
|
||||
const channel = getContext("channel");
|
||||
export let title;
|
||||
export let command;
|
||||
@@ -12,59 +11,57 @@
|
||||
let inProgress = false;
|
||||
|
||||
function connect() {
|
||||
const eventSource = new EventSource(channel.lucentUrl + "/command-report-source/" + command.signature );
|
||||
const eventSource = new EventSource(
|
||||
channel.lucentUrl + "/command-report-source/" + command.signature,
|
||||
);
|
||||
|
||||
eventSource.onmessage = function (event) {
|
||||
inProgress = true;
|
||||
const data = JSON.parse(event.data);
|
||||
date = data.date;
|
||||
logs = data.logs;
|
||||
anchorEl.scrollIntoView()
|
||||
}
|
||||
anchorEl.scrollIntoView();
|
||||
};
|
||||
eventSource.onerror = (e) => {
|
||||
console.log(e)
|
||||
console.log(e);
|
||||
eventSource.close();
|
||||
inProgress = false;
|
||||
}
|
||||
};
|
||||
}
|
||||
|
||||
function buildWebsite(e) {
|
||||
e.preventDefault();
|
||||
inProgress = true;
|
||||
axios.post(channel.lucentUrl + "/command/" + command.signature).then(response => {
|
||||
connect()
|
||||
})
|
||||
|
||||
apiPost(channel.lucentUrl + "/command/" + command.signature).then(
|
||||
(response) => {
|
||||
connect();
|
||||
},
|
||||
);
|
||||
}
|
||||
|
||||
onMount(() => {
|
||||
connect()
|
||||
})
|
||||
|
||||
connect();
|
||||
});
|
||||
</script>
|
||||
|
||||
<div class="common-wrapper">
|
||||
<div class="lx-card mt-5">
|
||||
|
||||
<h3 class="header-small mb-5">{title}</h3>
|
||||
|
||||
<button on:click={buildWebsite} class="button primary mb-3" disabled={inProgress}>Start
|
||||
<button
|
||||
on:click={buildWebsite}
|
||||
class="button primary mb-3"
|
||||
disabled={inProgress}
|
||||
>Start
|
||||
</button>
|
||||
|
||||
|
||||
<div class="mb-3">
|
||||
{#if inProgress}
|
||||
<span class="badge text-bg-warning">
|
||||
Action in progress
|
||||
</span>
|
||||
<span class="badge text-bg-warning"> Action in progress </span>
|
||||
{/if}
|
||||
{#if !inProgress && logs}
|
||||
<span class="badge text-bg-info">
|
||||
Action completed
|
||||
</span>
|
||||
<span class="badge text-bg-info"> Action completed </span>
|
||||
{/if}
|
||||
|
||||
|
||||
</div>
|
||||
|
||||
<pre class="logs">{logs}
|
||||
@@ -72,8 +69,9 @@
|
||||
</pre>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<style>
|
||||
.logs{
|
||||
.logs {
|
||||
max-height: 70vh;
|
||||
overflow: scroll;
|
||||
background: var(--p90);
|
||||
|
||||
@@ -56,23 +56,23 @@
|
||||
path: '<path d="M416 288h-95.1c-17.67 0-32 14.33-32 32s14.33 32 32 32H416c17.67 0 32-14.33 32-32S433.7 288 416 288zM544 32h-223.1c-17.67 0-32 14.33-32 32s14.33 32 32 32H544c17.67 0 32-14.33 32-32S561.7 32 544 32zM352 416h-32c-17.67 0-32 14.33-32 32s14.33 32 32 32h32c17.67 0 31.1-14.33 31.1-32S369.7 416 352 416zM480 160h-159.1c-17.67 0-32 14.33-32 32s14.33 32 32 32H480c17.67 0 32-14.33 32-32S497.7 160 480 160zM192.4 330.7L160 366.1V64.03C160 46.33 145.7 32 128 32S96 46.33 96 64.03v302L63.6 330.7c-6.312-6.883-14.94-10.38-23.61-10.38c-7.719 0-15.47 2.781-21.61 8.414c-13.03 11.95-13.9 32.22-1.969 45.27l87.1 96.09c12.12 13.26 35.06 13.26 47.19 0l87.1-96.09c11.94-13.05 11.06-33.31-1.969-45.27C224.6 316.8 204.4 317.7 192.4 330.7z"/>',
|
||||
viewBox: "0 0 576 512",
|
||||
},
|
||||
"filter": {
|
||||
filter: {
|
||||
path: '<path d="M3.853 54.87C10.47 40.9 24.54 32 40 32H472C487.5 32 501.5 40.9 508.1 54.87C514.8 68.84 512.7 85.37 502.1 97.33L320 320.9V448C320 460.1 313.2 471.2 302.3 476.6C291.5 482 278.5 480.9 268.8 473.6L204.8 425.6C196.7 419.6 192 410.1 192 400V320.9L9.042 97.33C-.745 85.37-2.765 68.84 3.854 54.87L3.853 54.87z"/>',
|
||||
viewBox: "0 0 512 512",
|
||||
},
|
||||
"calendar": {
|
||||
calendar: {
|
||||
path: '<path d="M96 32C96 14.33 110.3 0 128 0C145.7 0 160 14.33 160 32V64H288V32C288 14.33 302.3 0 320 0C337.7 0 352 14.33 352 32V64H400C426.5 64 448 85.49 448 112V160H0V112C0 85.49 21.49 64 48 64H96V32zM448 464C448 490.5 426.5 512 400 512H48C21.49 512 0 490.5 0 464V192H448V464z"/>',
|
||||
viewBox: "0 0 448 512",
|
||||
},
|
||||
"pencil": {
|
||||
pencil: {
|
||||
path: '<path d="M421.7 220.3L188.5 453.4L154.6 419.5L158.1 416H112C103.2 416 96 408.8 96 400V353.9L92.51 357.4C87.78 362.2 84.31 368 82.42 374.4L59.44 452.6L137.6 429.6C143.1 427.7 149.8 424.2 154.6 419.5L188.5 453.4C178.1 463.8 165.2 471.5 151.1 475.6L30.77 511C22.35 513.5 13.24 511.2 7.03 504.1C.8198 498.8-1.502 489.7 .976 481.2L36.37 360.9C40.53 346.8 48.16 333.9 58.57 323.5L291.7 90.34L421.7 220.3zM492.7 58.75C517.7 83.74 517.7 124.3 492.7 149.3L444.3 197.7L314.3 67.72L362.7 19.32C387.7-5.678 428.3-5.678 453.3 19.32L492.7 58.75z"/>',
|
||||
viewBox: "0 0 512 512",
|
||||
},
|
||||
"database": {
|
||||
database: {
|
||||
path: '<path d="M448 80V128C448 172.2 347.7 208 224 208C100.3 208 0 172.2 0 128V80C0 35.82 100.3 0 224 0C347.7 0 448 35.82 448 80zM393.2 214.7C413.1 207.3 433.1 197.8 448 186.1V288C448 332.2 347.7 368 224 368C100.3 368 0 332.2 0 288V186.1C14.93 197.8 34.02 207.3 54.85 214.7C99.66 230.7 159.5 240 224 240C288.5 240 348.3 230.7 393.2 214.7V214.7zM54.85 374.7C99.66 390.7 159.5 400 224 400C288.5 400 348.3 390.7 393.2 374.7C413.1 367.3 433.1 357.8 448 346.1V432C448 476.2 347.7 512 224 512C100.3 512 0 476.2 0 432V346.1C14.93 357.8 34.02 367.3 54.85 374.7z"/>',
|
||||
viewBox: "0 0 448 512",
|
||||
},
|
||||
"dice": {
|
||||
dice: {
|
||||
path: '<path d="M447.1 224c0-12.56-4.781-25.13-14.35-34.76l-174.9-174.9C249.1 4.786 236.5 0 223.1 0C211.4 0 198.9 4.786 189.2 14.35L14.35 189.2C4.783 198.9-.0011 211.4-.0011 223.1c0 12.56 4.785 25.17 14.35 34.8l174.9 174.9c9.625 9.562 22.19 14.35 34.75 14.35s25.13-4.783 34.75-14.35l174.9-174.9C443.2 249.1 447.1 236.6 447.1 224zM96 248c-13.25 0-23.1-10.75-23.1-23.1s10.75-23.1 23.1-23.1S120 210.8 120 224S109.3 248 96 248zM224 376c-13.25 0-23.1-10.75-23.1-23.1s10.75-23.1 23.1-23.1s23.1 10.75 23.1 23.1S237.3 376 224 376zM224 248c-13.25 0-23.1-10.75-23.1-23.1s10.75-23.1 23.1-23.1S248 210.8 248 224S237.3 248 224 248zM224 120c-13.25 0-23.1-10.75-23.1-23.1s10.75-23.1 23.1-23.1s23.1 10.75 23.1 23.1S237.3 120 224 120zM352 248c-13.25 0-23.1-10.75-23.1-23.1s10.75-23.1 23.1-23.1s23.1 10.75 23.1 23.1S365.3 248 352 248zM591.1 192l-118.7 0c4.418 10.27 6.604 21.25 6.604 32.23c0 20.7-7.865 41.38-23.63 57.14l-136.2 136.2v46.37C320 490.5 341.5 512 368 512h223.1c26.5 0 47.1-21.5 47.1-47.1V240C639.1 213.5 618.5 192 591.1 192zM479.1 376c-13.25 0-23.1-10.75-23.1-23.1s10.75-23.1 23.1-23.1s23.1 10.75 23.1 23.1S493.2 376 479.1 376z"/>',
|
||||
viewBox: "0 0 640 512",
|
||||
},
|
||||
@@ -81,7 +81,7 @@
|
||||
path: '<path d="M506.3 417l-213.3-364c-16.33-28-57.54-28-73.98 0l-213.2 364C-10.59 444.9 9.849 480 42.74 480h426.6C502.1 480 522.6 445 506.3 417zM232 168c0-13.25 10.75-24 24-24S280 154.8 280 168v128c0 13.25-10.75 24-23.1 24S232 309.3 232 296V168zM256 416c-17.36 0-31.44-14.08-31.44-31.44c0-17.36 14.07-31.44 31.44-31.44s31.44 14.08 31.44 31.44C287.4 401.9 273.4 416 256 416z"/>',
|
||||
viewBox: "0 0 512 512",
|
||||
},
|
||||
"eye": {
|
||||
eye: {
|
||||
path: '<path d="M279.6 160.4C282.4 160.1 285.2 160 288 160C341 160 384 202.1 384 256C384 309 341 352 288 352C234.1 352 192 309 192 256C192 253.2 192.1 250.4 192.4 247.6C201.7 252.1 212.5 256 224 256C259.3 256 288 227.3 288 192C288 180.5 284.1 169.7 279.6 160.4zM480.6 112.6C527.4 156 558.7 207.1 573.5 243.7C576.8 251.6 576.8 260.4 573.5 268.3C558.7 304 527.4 355.1 480.6 399.4C433.5 443.2 368.8 480 288 480C207.2 480 142.5 443.2 95.42 399.4C48.62 355.1 17.34 304 2.461 268.3C-.8205 260.4-.8205 251.6 2.461 243.7C17.34 207.1 48.62 156 95.42 112.6C142.5 68.84 207.2 32 288 32C368.8 32 433.5 68.84 480.6 112.6V112.6zM288 112C208.5 112 144 176.5 144 256C144 335.5 208.5 400 288 400C367.5 400 432 335.5 432 256C432 176.5 367.5 112 288 112z"/>',
|
||||
viewBox: "0 0 576 512",
|
||||
},
|
||||
@@ -93,19 +93,19 @@
|
||||
path: '<path d="M500.3 443.7l-119.7-119.7c27.22-40.41 40.65-90.9 33.46-144.7C401.8 87.79 326.8 13.32 235.2 1.723C99.01-15.51-15.51 99.01 1.724 235.2c11.6 91.64 86.08 166.7 177.6 178.9c53.8 7.189 104.3-6.236 144.7-33.46l119.7 119.7c15.62 15.62 40.95 15.62 56.57 0C515.9 484.7 515.9 459.3 500.3 443.7zM79.1 208c0-70.58 57.42-128 128-128s128 57.42 128 128c0 70.58-57.42 128-128 128S79.1 278.6 79.1 208z"/>',
|
||||
viewBox: "0 0 512 512",
|
||||
},
|
||||
"expand": {
|
||||
expand: {
|
||||
path: '<path d="M128 32H32C14.31 32 0 46.31 0 64v96c0 17.69 14.31 32 32 32s32-14.31 32-32V96h64c17.69 0 32-14.31 32-32S145.7 32 128 32zM416 32h-96c-17.69 0-32 14.31-32 32s14.31 32 32 32h64v64c0 17.69 14.31 32 32 32s32-14.31 32-32V64C448 46.31 433.7 32 416 32zM128 416H64v-64c0-17.69-14.31-32-32-32s-32 14.31-32 32v96c0 17.69 14.31 32 32 32h96c17.69 0 32-14.31 32-32S145.7 416 128 416zM416 320c-17.69 0-32 14.31-32 32v64h-64c-17.69 0-32 14.31-32 32s14.31 32 32 32h96c17.69 0 32-14.31 32-32v-96C448 334.3 433.7 320 416 320z"/>',
|
||||
viewBox: "0 0 448 512",
|
||||
},
|
||||
"compress": {
|
||||
compress: {
|
||||
path: '<path d="M128 320H32c-17.69 0-32 14.31-32 32s14.31 32 32 32h64v64c0 17.69 14.31 32 32 32s32-14.31 32-32v-96C160 334.3 145.7 320 128 320zM416 320h-96c-17.69 0-32 14.31-32 32v96c0 17.69 14.31 32 32 32s32-14.31 32-32v-64h64c17.69 0 32-14.31 32-32S433.7 320 416 320zM320 192h96c17.69 0 32-14.31 32-32s-14.31-32-32-32h-64V64c0-17.69-14.31-32-32-32s-32 14.31-32 32v96C288 177.7 302.3 192 320 192zM128 32C110.3 32 96 46.31 96 64v64H32C14.31 128 0 142.3 0 160s14.31 32 32 32h96c17.69 0 32-14.31 32-32V64C160 46.31 145.7 32 128 32z"/>',
|
||||
viewBox: "0 0 448 512",
|
||||
},
|
||||
"check": {
|
||||
check: {
|
||||
path: '<path d="M438.6 105.4C451.1 117.9 451.1 138.1 438.6 150.6L182.6 406.6C170.1 419.1 149.9 419.1 137.4 406.6L9.372 278.6C-3.124 266.1-3.124 245.9 9.372 233.4C21.87 220.9 42.13 220.9 54.63 233.4L159.1 338.7L393.4 105.4C405.9 92.88 426.1 92.88 438.6 105.4H438.6z"/>',
|
||||
viewBox: "0 0 448 512",
|
||||
},
|
||||
"close": {
|
||||
close: {
|
||||
path: '<path stroke="currentColor" stroke-linecap="round" stroke-linejoin="round" stroke-width="2" d="M6 18 17.94 6M18 18 6.06 6"/>',
|
||||
viewBox: "0 0 24 24",
|
||||
},
|
||||
@@ -113,7 +113,7 @@
|
||||
path: '<path stroke="currentColor" stroke-linecap="round" stroke-linejoin="round" stroke-width="2" d="M5 12h14M5 12l4-4m-4 4 4 4"/>',
|
||||
viewBox: "0 0 24 24",
|
||||
},
|
||||
"list": {
|
||||
list: {
|
||||
path: '<path stroke="currentColor" stroke-linecap="round" stroke-width="2" d="M9 8h10M9 12h10M9 16h10M4.99 8H5m-.02 4h.01m0 4H5"/>',
|
||||
viewBox: "0 0 24 24",
|
||||
},
|
||||
@@ -121,13 +121,16 @@
|
||||
path: '<path stroke="currentColor" stroke-linecap="round" stroke-linejoin="round" stroke-width="2" d="M12 6h8m-8 6h8m-8 6h8M4 16a2 2 0 1 1 3.321 1.5L4 20h5M4 5l2-1v6m-2 0h4"/>',
|
||||
viewBox: "0 0 24 24",
|
||||
},
|
||||
"italic": {
|
||||
italic: {
|
||||
path: '<path stroke="currentColor" stroke-linecap="round" stroke-linejoin="round" stroke-width="2" d="m8.874 19 6.143-14M6 19h6.33m-.66-14H18"/>',
|
||||
viewBox: "0 0 24 24",
|
||||
}
|
||||
},
|
||||
upload: {
|
||||
path: '<path d="M.5 9.9a.5.5 0 0 1 .5.5v2.5a1 1 0 0 0 1 1h12a1 1 0 0 0 1-1v-2.5a.5.5 0 0 1 1 0v2.5a2 2 0 0 1-2 2H2a2 2 0 0 1-2-2v-2.5a.5.5 0 0 1 .5-.5"/> <path d="M7.646 1.146a.5.5 0 0 1 .708 0l3 3a.5.5 0 0 1-.708.708L8.5 2.707V11.5a.5.5 0 0 1-1 0V2.707L5.354 4.854a.5.5 0 1 1-.708-.708z"/>',
|
||||
viewBox: "0 0 16 16",
|
||||
},
|
||||
};
|
||||
|
||||
|
||||
export let width = 16;
|
||||
export let height = 16;
|
||||
export let icon = "";
|
||||
@@ -147,7 +150,6 @@
|
||||
role="presentation"
|
||||
{stroke}
|
||||
{fill}
|
||||
|
||||
>
|
||||
{@html selectedIcon.path}
|
||||
</svg>
|
||||
@@ -155,6 +157,5 @@
|
||||
<style>
|
||||
svg {
|
||||
vertical-align: text-top;
|
||||
|
||||
}
|
||||
</style>
|
||||
@@ -3,11 +3,11 @@
|
||||
export let disabled = false;
|
||||
</script>
|
||||
|
||||
<button type="submit" class="button secondary btn-spinner" {disabled}>
|
||||
<button type="submit" class="button secondary btn-spinner" {disabled}>
|
||||
<span
|
||||
class="spinner-border spinner-border-sm"
|
||||
role="status"
|
||||
aria-hidden="true"
|
||||
/>
|
||||
{label}
|
||||
</button>
|
||||
</button>
|
||||
@@ -1,5 +1,6 @@
|
||||
<script>
|
||||
import {getContext} from "svelte";
|
||||
import { getContext } from "svelte";
|
||||
import { apiPost } from "../../helpers";
|
||||
|
||||
const channel = getContext("channel");
|
||||
export let selected;
|
||||
@@ -8,8 +9,7 @@
|
||||
|
||||
function deleteRecords(e) {
|
||||
e.preventDefault();
|
||||
axios
|
||||
.post(channel.lucentUrl + "/records/delete", {
|
||||
apiPost(channel.lucentUrl + "/records/delete", {
|
||||
ids: selected.map((s) => s.id),
|
||||
})
|
||||
.then((response) => {
|
||||
@@ -21,10 +21,9 @@
|
||||
}
|
||||
|
||||
function changeStatus(e, status) {
|
||||
axios
|
||||
.post(channel.lucentUrl + "/records/status/" + status, {
|
||||
apiPost(channel.lucentUrl + "/records/status/" + status, {
|
||||
schemaName: schema.name,
|
||||
records: selected
|
||||
records: selected,
|
||||
})
|
||||
.then((response) => {
|
||||
window.location.reload();
|
||||
@@ -40,42 +39,42 @@
|
||||
<button
|
||||
on:click|preventDefault={(e) => changeStatus(e, "published")}
|
||||
type="button"
|
||||
class="button">Publish
|
||||
</button
|
||||
>
|
||||
class="button"
|
||||
>Publish
|
||||
</button>
|
||||
<button
|
||||
on:click|preventDefault={(e) => changeStatus(e, "draft")}
|
||||
type="button"
|
||||
class="button">Make Draft
|
||||
</button
|
||||
>
|
||||
class="button"
|
||||
>Make Draft
|
||||
</button>
|
||||
{#if filter["status_in"] === "trashed"}
|
||||
<button
|
||||
on:click|preventDefault={(e) => changeStatus(e, "published")}
|
||||
type="button"
|
||||
class="button">Publish
|
||||
</button
|
||||
>
|
||||
class="button"
|
||||
>Publish
|
||||
</button>
|
||||
{#if schema.hasDrafts}
|
||||
<button
|
||||
on:click|preventDefault={(e) => changeStatus(e, "draft")}
|
||||
type="button"
|
||||
class="button">Make Draft
|
||||
</button
|
||||
>
|
||||
class="button"
|
||||
>Make Draft
|
||||
</button>
|
||||
{/if}
|
||||
<button
|
||||
on:click|preventDefault={deleteRecords}
|
||||
type="button"
|
||||
class="button">Delete forever
|
||||
</button
|
||||
>
|
||||
class="button"
|
||||
>Delete forever
|
||||
</button>
|
||||
{:else}
|
||||
<button
|
||||
type="button"
|
||||
on:click|preventDefault={(e) => changeStatus(e, "trashed")}
|
||||
class="button">Move to trash
|
||||
</button
|
||||
>
|
||||
class="button"
|
||||
>Move to trash
|
||||
</button>
|
||||
{/if}
|
||||
</div>
|
||||
@@ -1,68 +0,0 @@
|
||||
<script>
|
||||
import {getContext} from "svelte";
|
||||
import Preview from "../files/Preview.svelte";
|
||||
import {selectRecord} from "./functions/recordSelect.js";
|
||||
|
||||
const channel = getContext("channel");
|
||||
|
||||
export let schema;
|
||||
export let records;
|
||||
export let isWritable;
|
||||
export let selected = [];
|
||||
|
||||
function select(record) {
|
||||
selected = selectRecord(record, selected)
|
||||
}
|
||||
|
||||
|
||||
</script>
|
||||
<div class="row" style="max-width:1000px">
|
||||
{#each records as record (record.id)}
|
||||
<div class="col-6 col-md-4">
|
||||
<div
|
||||
class="file-wrapper rounded p-2 mb-4 bg-light"
|
||||
class:selected={selected.includes(record)}
|
||||
>
|
||||
{#if isWritable}
|
||||
<div class="form-check">
|
||||
<input
|
||||
on:change={() => select(record)}
|
||||
class="form-check-input "
|
||||
type="checkbox"
|
||||
checked={selected.find(
|
||||
(r) => r.id === record.id
|
||||
)}
|
||||
value={record}
|
||||
/>
|
||||
</div>
|
||||
{/if}
|
||||
<div class="d-flex justify-content-center">
|
||||
<Preview {record} size="medium"/>
|
||||
</div>
|
||||
|
||||
<a
|
||||
href="{channel.lucentUrl}/records/{record.id}"
|
||||
title={record._file.path}
|
||||
class="d-block text-center overflow-hidden text-nowrap my-2 "
|
||||
style="
|
||||
text-overflow: ellipsis;
|
||||
font-size: 13px;
|
||||
color: #333;
|
||||
">{record._file.path}</a
|
||||
>
|
||||
<span
|
||||
class="lx-small-text text-muted d-block text-center"
|
||||
>{record._file.mime}</span
|
||||
>
|
||||
</div>
|
||||
</div>
|
||||
{/each}
|
||||
</div>
|
||||
|
||||
|
||||
<style>
|
||||
.form-check {
|
||||
display: inline-block;
|
||||
margin-bottom: 0;
|
||||
}
|
||||
</style>
|
||||
@@ -3,9 +3,9 @@
|
||||
import Pagination from "./pagination/Pagination.svelte";
|
||||
import ActionsOnSelected from "./ActionsOnSelected.svelte";
|
||||
import Table from "./Table.svelte";
|
||||
import {getContext} from "svelte";
|
||||
import { getContext } from "svelte";
|
||||
import { apiGet } from "../../helpers";
|
||||
|
||||
const axios = getContext("axios");
|
||||
export let schema;
|
||||
export let users;
|
||||
export let records;
|
||||
@@ -26,18 +26,17 @@
|
||||
|
||||
function refresh(e) {
|
||||
const newUrl = e.detail;
|
||||
axios
|
||||
.get(newUrl)
|
||||
apiGet(newUrl)
|
||||
.then((response) => {
|
||||
records = response.data.records;
|
||||
sortParam = response.data.sortParam;
|
||||
sortField = response.data.sortField;
|
||||
operators = response.data.operators;
|
||||
filter = response.data.filter;
|
||||
skip = response.data.skip;
|
||||
limit = response.data.limit;
|
||||
total = response.data.total;
|
||||
modalUrl = response.data.modalUrl;
|
||||
records = response.records;
|
||||
sortParam = response.sortParam;
|
||||
sortField = response.sortField;
|
||||
operators = response.operators;
|
||||
filter = response.filter;
|
||||
skip = response.skip;
|
||||
limit = response.limit;
|
||||
total = response.total;
|
||||
modalUrl = response.modalUrl;
|
||||
document.querySelector("dialog h3").scrollIntoView();
|
||||
})
|
||||
.catch((error) => {
|
||||
@@ -47,12 +46,12 @@
|
||||
</script>
|
||||
|
||||
<div class="">
|
||||
<div class="{inModal ? 'mt-0' : 'mt-5'}">
|
||||
<h3 class="header-normal mb-5 ">
|
||||
<div class={inModal ? "mt-0" : "mt-5"}>
|
||||
<h3 class="header-normal mb-5">
|
||||
{schema.label}
|
||||
</h3>
|
||||
{#if selected.length > 0 && !inModal && isWritable}
|
||||
<ActionsOnSelected {schema} {selected} {filter}/>
|
||||
<ActionsOnSelected {schema} {selected} {filter} />
|
||||
{:else}
|
||||
<Tools
|
||||
bind:schema
|
||||
@@ -82,7 +81,6 @@
|
||||
{isWritable}
|
||||
bind:selected
|
||||
/>
|
||||
|
||||
</div>
|
||||
|
||||
<Pagination
|
||||
@@ -94,4 +92,3 @@
|
||||
{modalUrl}
|
||||
/>
|
||||
</div>
|
||||
|
||||
@@ -2,8 +2,8 @@
|
||||
import RenderField from "./RenderField.svelte";
|
||||
import Avatar from "../account/Avatar.svelte";
|
||||
import Status from "../records/Status.svelte";
|
||||
import {usernameById} from "../account/users";
|
||||
import {friendlyDate} from "../../helpers";
|
||||
import { usernameById } from "../account/users";
|
||||
import { friendlyDate } from "../../helpers";
|
||||
|
||||
export let schema;
|
||||
export let users;
|
||||
@@ -12,7 +12,6 @@
|
||||
export let sortParam;
|
||||
export let sortField;
|
||||
export let visibleColumns;
|
||||
|
||||
</script>
|
||||
|
||||
{#each visibleColumns as field, index}
|
||||
@@ -20,40 +19,48 @@
|
||||
class="field-ui-{field.info.name}"
|
||||
class:is-sort={field.name === sortField.name}
|
||||
>
|
||||
<RenderField {record} {schema} {graph} {field}/>
|
||||
<RenderField {record} {schema} {graph} {field} />
|
||||
</td>
|
||||
{/each}
|
||||
{#if schema.visible?.includes("status")}
|
||||
{#if schema.visible?.includes("_sys.status")}
|
||||
<td
|
||||
class="text-center"
|
||||
class:is-sort={"-status" == sortParam || "status" == sortParam}
|
||||
>
|
||||
<Status status={record.status}/>
|
||||
<Status status={record.status} />
|
||||
</td>
|
||||
{/if}
|
||||
{#if schema.visible?.includes("_sys.createdBy")}
|
||||
<td
|
||||
class="text-center"
|
||||
class:is-sort={"-_sys.createdBy" == sortParam || "_sys.createdBy" == sortParam}
|
||||
class:is-sort={"-_sys.createdBy" == sortParam ||
|
||||
"_sys.createdBy" == sortParam}
|
||||
>
|
||||
<Avatar name={usernameById(users, record._sys.createdBy)} side={24}/>
|
||||
<Avatar name={usernameById(users, record.createdBy)} side={24} />
|
||||
</td>
|
||||
{/if}
|
||||
{#if schema.visible?.includes("_sys.updatedBy")}
|
||||
<td
|
||||
class="text-center"
|
||||
class:is-sort={"-_sys.updatedBy" == sortParam || "_sys.updatedBy" == sortParam}
|
||||
class:is-sort={"-_sys.updatedBy" == sortParam ||
|
||||
"_sys.updatedBy" == sortParam}
|
||||
>
|
||||
<Avatar name={usernameById(users, record._sys.updatedBy)} side={24}/>
|
||||
<Avatar name={usernameById(users, record.updatedBy)} side={24} />
|
||||
</td>
|
||||
{/if}
|
||||
{#if schema.visible?.includes("_sys.createdAt")}
|
||||
<td class:is-sort={"-_sys.createdAt" == sortParam || "_sys.createdAt" == sortParam}>
|
||||
{friendlyDate(record._sys.createdAt)}
|
||||
<td
|
||||
class:is-sort={"-_sys.createdAt" == sortParam ||
|
||||
"_sys.createdAt" == sortParam}
|
||||
>
|
||||
{friendlyDate(record.createdAt)}
|
||||
</td>
|
||||
{/if}
|
||||
{#if schema.visible?.includes("_sys.updatedAt")}
|
||||
<td class:is-sort={"-_sys.updatedAt" == sortParam || "_sys.updatedAt" == sortParam}>
|
||||
{friendlyDate(record._sys.updatedAt)}
|
||||
<td
|
||||
class:is-sort={"-_sys.updatedAt" == sortParam ||
|
||||
"_sys.updatedAt" == sortParam}
|
||||
>
|
||||
{friendlyDate(record.updatedAt)}
|
||||
</td>
|
||||
{/if}
|
||||
@@ -1,13 +1,10 @@
|
||||
<script>
|
||||
import RecordRow from "./RecordRow.svelte";
|
||||
import {previewTitle} from "../records/Preview";
|
||||
import {usernameById} from "../account/users";
|
||||
import {getContext} from "svelte";
|
||||
import { usernameById } from "../account/users";
|
||||
import { getContext } from "svelte";
|
||||
import Avatar from "../account/Avatar.svelte";
|
||||
import {selectRecord, toggleAll} from "./functions/recordSelect.js";
|
||||
import { selectRecord, toggleAll } from "./functions/recordSelect.js";
|
||||
import Checkbox from "../common/Checkbox.svelte";
|
||||
import Preview from "../files/Preview.svelte";
|
||||
import {fileurl} from "../files/imageserver.js";
|
||||
|
||||
const channel = getContext("channel");
|
||||
|
||||
@@ -23,17 +20,19 @@
|
||||
export let selected = [];
|
||||
|
||||
function eventToggleAll(e) {
|
||||
selected = toggleAll(e, records, selected)
|
||||
selected = toggleAll(e, records, selected);
|
||||
}
|
||||
|
||||
function select(record) {
|
||||
selected = selectRecord(record, selected)
|
||||
selected = selectRecord(record, selected);
|
||||
}
|
||||
|
||||
$: visibleColumns = schema.fields.filter(c => schema.visible?.includes(c.name) ?? [])
|
||||
console.log(schema);
|
||||
$: visibleColumns = schema.fields.filter(
|
||||
(c) => schema.visible?.includes(c.name) ?? [],
|
||||
);
|
||||
</script>
|
||||
|
||||
<div class="table mt-5 ">
|
||||
<div class="table mt-5">
|
||||
<table>
|
||||
<thead>
|
||||
<tr>
|
||||
@@ -42,10 +41,10 @@
|
||||
<Checkbox
|
||||
value=""
|
||||
on:change={eventToggleAll}
|
||||
indeterminate={selected.length > 0 && selected.length < records.length}
|
||||
indeterminate={selected.length > 0 &&
|
||||
selected.length < records.length}
|
||||
checked={selected.length === records.length}
|
||||
>
|
||||
</Checkbox>
|
||||
></Checkbox>
|
||||
</th>
|
||||
{/if}
|
||||
|
||||
@@ -54,12 +53,13 @@
|
||||
class="field-ui-{field.info.name ?? field.ui}"
|
||||
class:is-sort={field.name === sortField.name}
|
||||
scope="col"
|
||||
title={field.help}
|
||||
>{field.label}</th
|
||||
title={field.help}>{field.label}</th
|
||||
>
|
||||
{/each}
|
||||
{#each systemFields.filter(c => schema.visible?.includes(c.name)) as sysField}
|
||||
<th class:is-sort={sysField.name === sortField.name}>{sysField.label}</th>
|
||||
{#each systemFields.filter( (c) => schema.visible?.includes(c.name), ) as sysField}
|
||||
<th class:is-sort={sysField.name === sortField.name}
|
||||
>{sysField.label}</th
|
||||
>
|
||||
{/each}
|
||||
<th></th>
|
||||
</tr>
|
||||
@@ -68,59 +68,29 @@
|
||||
{#each records as record (record.id)}
|
||||
<tr>
|
||||
<td class="title-td">
|
||||
<div
|
||||
class="title-td-contents"
|
||||
>
|
||||
<div class="title-td-contents">
|
||||
{#if isWritable}
|
||||
<Checkbox
|
||||
on:change={() => select(record)}
|
||||
checked={selected.find((r) => r.id === record.id)}
|
||||
checked={selected.find(
|
||||
(r) => r.id === record.id,
|
||||
)}
|
||||
value={record}
|
||||
>
|
||||
</Checkbox>
|
||||
|
||||
></Checkbox>
|
||||
{/if}
|
||||
{#if record._file?.path}
|
||||
<div class="file-table-row">
|
||||
<Preview record={record} size={record._file?.width > 0 ? "medium" : "small"}/>
|
||||
|
||||
<div>
|
||||
{#if record.status === "draft"}
|
||||
<span style="text-transform: uppercase;font-size:10px">{record.status}</span>
|
||||
{/if}
|
||||
<a
|
||||
href="{channel.lucentUrl}/records/{record.id}"
|
||||
target={inModal ? "_blank" : "_self"}
|
||||
>
|
||||
{previewTitle(channel.schemas, record, graph)}
|
||||
</a>
|
||||
<span>{(record._file.size / 1024).toFixed(1)}kB</span>
|
||||
|
||||
{#if record._file.width > 0}
|
||||
<span>{record._file.width + "x" + record._file.height}</span>
|
||||
{/if}
|
||||
<a
|
||||
href="{fileurl(channel,record)}"
|
||||
target="_blank"
|
||||
>
|
||||
Download
|
||||
</a>
|
||||
</div>
|
||||
|
||||
</div>
|
||||
{:else}
|
||||
<a
|
||||
href="{channel.lucentUrl}/records/{record.id}"
|
||||
target={inModal ? "_blank" : "_self"}
|
||||
>
|
||||
{#if record.status === "draft"}
|
||||
<span style="text-transform: uppercase;font-size:10px">{record.status}</span>
|
||||
<span
|
||||
style="text-transform: uppercase;font-size:10px"
|
||||
>{record.status}</span
|
||||
>
|
||||
{/if}
|
||||
{previewTitle(channel.schemas, record, graph)}
|
||||
{record.data.name}
|
||||
</a>
|
||||
{/if}
|
||||
|
||||
|
||||
</div>
|
||||
</td>
|
||||
<RecordRow
|
||||
@@ -134,10 +104,7 @@
|
||||
/>
|
||||
<td>
|
||||
<Avatar
|
||||
name={usernameById(
|
||||
users,
|
||||
record._sys.updatedBy
|
||||
)}
|
||||
name={usernameById(users, record.updatedBy)}
|
||||
side={24}
|
||||
/>
|
||||
</td>
|
||||
@@ -146,4 +113,3 @@
|
||||
</tbody>
|
||||
</table>
|
||||
</div>
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
<script>
|
||||
import { createEventDispatcher } from "svelte";
|
||||
const dispatch = createEventDispatcher();
|
||||
import { range } from "lodash";
|
||||
|
||||
import NavItem from "./NavItem.svelte";
|
||||
export let inModal;
|
||||
export let modalUrl;
|
||||
@@ -11,7 +11,11 @@
|
||||
|
||||
$: totalPages = Math.ceil(total / limit);
|
||||
$: currentPage = Math.ceil((skip - 1) / limit) + 1;
|
||||
|
||||
const range = (start, end, step = 1) =>
|
||||
Array.from(
|
||||
{ length: Math.ceil((end - start) / step) },
|
||||
(_, i) => start + i * step,
|
||||
);
|
||||
$: pageRange = range(currentPage - 3, currentPage + 4).filter((i) => {
|
||||
return i > 0 && i <= totalPages;
|
||||
});
|
||||
|
||||
@@ -1,9 +1,7 @@
|
||||
<script>
|
||||
import {createEventDispatcher, getContext} from "svelte";
|
||||
import {previewTitle} from "../../records/Preview";
|
||||
import { createEventDispatcher, getContext } from "svelte";
|
||||
import Icon from "../../common/Icon.svelte";
|
||||
|
||||
const channel = getContext("channel");
|
||||
const dispatch = createEventDispatcher();
|
||||
export let schema;
|
||||
export let operators;
|
||||
@@ -19,13 +17,10 @@
|
||||
isReference: key.startsWith("children"),
|
||||
};
|
||||
|
||||
filter = [
|
||||
extractOperator(key),
|
||||
extractLabel(schema, key),
|
||||
].reduce((mem, fn) => fn(mem), filter);
|
||||
|
||||
|
||||
|
||||
filter = [extractOperator(key), extractLabel(schema, key)].reduce(
|
||||
(mem, fn) => fn(mem),
|
||||
filter,
|
||||
);
|
||||
|
||||
function extractOperator(key) {
|
||||
return (filter) => {
|
||||
@@ -50,18 +45,16 @@
|
||||
const filterField = schema.fields.find((f) => f.name === fieldName);
|
||||
filter.label = filterField?.label ?? fieldName;
|
||||
return filter;
|
||||
}
|
||||
|
||||
};
|
||||
}
|
||||
|
||||
const filterRecord = extractFilterRecord(graph, value);
|
||||
|
||||
function extractFilterRecord(graph, value) {
|
||||
|
||||
if (!filter.isReference) {
|
||||
return null;
|
||||
}
|
||||
return graph.records.find(r => r.id === value);
|
||||
return graph.records.find((r) => r.id === value);
|
||||
}
|
||||
|
||||
function removeFilter(k) {
|
||||
@@ -78,11 +71,14 @@
|
||||
</script>
|
||||
|
||||
<span class="applied-filter">
|
||||
|
||||
{#if filter.isReference && filterRecord}
|
||||
{filter.label} is {previewTitle(channel.schemas, filterRecord)}
|
||||
{filter.label} is {filterRecord.data.name}
|
||||
{:else}
|
||||
{filter.label} {operators.find((o) => o.name === filter.operator)?.symbol ?? ""} {operators.find((o) => o.name === filter.operator)?.hasValue ? value : ""}
|
||||
{filter.label}
|
||||
{operators.find((o) => o.name === filter.operator)?.symbol ?? ""}
|
||||
{operators.find((o) => o.name === filter.operator)?.hasValue
|
||||
? value
|
||||
: ""}
|
||||
{/if}
|
||||
|
||||
<button
|
||||
@@ -90,7 +86,6 @@
|
||||
type="button"
|
||||
class="button-text"
|
||||
aria-label="Close"
|
||||
><Icon width={12} height={12} icon="close"></Icon></button>
|
||||
><Icon width={12} height={12} icon="close"></Icon></button
|
||||
>
|
||||
</span>
|
||||
|
||||
|
||||
@@ -1,8 +1,6 @@
|
||||
<script>
|
||||
import {createEventDispatcher, getContext} from "svelte";
|
||||
import {debounce} from "lodash";
|
||||
import {previewTitle} from "../../records/Preview";
|
||||
|
||||
import { createEventDispatcher, getContext } from "svelte";
|
||||
import { apiGet, debounce } from "../../../helpers";
|
||||
|
||||
const channel = getContext("channel");
|
||||
const dispatch = createEventDispatcher();
|
||||
@@ -10,13 +8,11 @@
|
||||
export let value = "";
|
||||
export let field;
|
||||
|
||||
let search = ""
|
||||
$: searchOptions = []
|
||||
|
||||
let search = "";
|
||||
$: searchOptions = [];
|
||||
|
||||
const updateResults = debounce((e) => {
|
||||
axios
|
||||
.get(channel.lucentUrl + "/records/suggestions", {
|
||||
apiGet(channel.lucentUrl + "/records/suggestions", {
|
||||
params: {
|
||||
schema: field.collections[0],
|
||||
field: "search",
|
||||
@@ -25,7 +21,7 @@
|
||||
},
|
||||
})
|
||||
.then((response) => {
|
||||
searchOptions = response.data;
|
||||
searchOptions = response;
|
||||
})
|
||||
.catch((error) => {
|
||||
searchOptions = [];
|
||||
@@ -35,24 +31,22 @@
|
||||
|
||||
function apply(e, newOption) {
|
||||
e.preventDefault();
|
||||
value = newOption.id
|
||||
value = newOption.id;
|
||||
dispatch("addFilter");
|
||||
value = ""
|
||||
|
||||
value = "";
|
||||
}
|
||||
|
||||
</script>
|
||||
|
||||
<div class="reference-tags">
|
||||
<input
|
||||
type="search"
|
||||
on:keyup={updateResults}
|
||||
bind:value={search}
|
||||
placeholder={"Search for "+field.label}
|
||||
placeholder={"Search for " + field.label}
|
||||
autocomplete="off"
|
||||
/>
|
||||
|
||||
<div class="reference-tags-results">
|
||||
|
||||
{#if searchOptions}
|
||||
{#each searchOptions as option (option.id)}
|
||||
<div
|
||||
@@ -62,19 +56,11 @@
|
||||
on:click={(e) => apply(e, option)}
|
||||
on:keypress={(e) => apply(e, option)}
|
||||
>
|
||||
{previewTitle(channel.schemas, option)}
|
||||
{option.data.name}
|
||||
</div>
|
||||
|
||||
{:else}
|
||||
<div
|
||||
class="start-typing">
|
||||
Start typing...
|
||||
</div>
|
||||
<div class="start-typing">Start typing...</div>
|
||||
{/each}
|
||||
{/if}
|
||||
</div>
|
||||
</div>
|
||||
|
||||
|
||||
|
||||
|
||||
@@ -1,10 +1,9 @@
|
||||
<script>
|
||||
import FilterFields from "./FilterFields.svelte";
|
||||
import Uploader from "../../files/Uploader.svelte";
|
||||
import Icon from "../../common/Icon.svelte";
|
||||
import SortFields from "./SortFields.svelte";
|
||||
import AppliedFilter from "./AppliedFilter.svelte";
|
||||
import {createEventDispatcher, getContext} from "svelte";
|
||||
import { createEventDispatcher, getContext } from "svelte";
|
||||
import Dropdown from "../../common/Dropdown.svelte";
|
||||
import AppliedFilterNotLinked from "./AppliedFilterNotLinked.svelte";
|
||||
|
||||
@@ -41,17 +40,11 @@
|
||||
} else {
|
||||
window.location = url;
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
function uploadComplete(e) {
|
||||
records = e.detail;
|
||||
}
|
||||
</script>
|
||||
|
||||
<div class="toolbar">
|
||||
<div class="toolbar-filters">
|
||||
|
||||
<SortFields
|
||||
{schema}
|
||||
{sortParam}
|
||||
@@ -62,7 +55,6 @@
|
||||
on:refresh
|
||||
/>
|
||||
|
||||
|
||||
<FilterFields
|
||||
bind:schema
|
||||
{systemFields}
|
||||
@@ -74,15 +66,17 @@
|
||||
/>
|
||||
|
||||
<form method="GET" on:submit={search}>
|
||||
<input type="search" name="filter[search_regex]" placeholder="Search"
|
||||
class="search" required>
|
||||
<input
|
||||
type="search"
|
||||
name="filter[search_regex]"
|
||||
placeholder="Search"
|
||||
class="search"
|
||||
required
|
||||
/>
|
||||
</form>
|
||||
|
||||
|
||||
</div>
|
||||
|
||||
<div style="display:flex;align-items: center;gap:4px">
|
||||
{#if schema.type === "collection"}
|
||||
{#if !inModal && isWritable}
|
||||
<a
|
||||
href="{channel.lucentUrl}/records/new?schema={schema.name}"
|
||||
@@ -91,15 +85,11 @@
|
||||
New Record
|
||||
</a>
|
||||
{/if}
|
||||
{:else }
|
||||
<div>
|
||||
<Uploader {schema} on:uploadComplete={uploadComplete}/>
|
||||
</div>
|
||||
{/if}
|
||||
|
||||
{#if !inModal}
|
||||
<Dropdown orientation="right">
|
||||
<div slot="button">
|
||||
<Icon icon="ellipsis-vertical"/>
|
||||
<Icon icon="ellipsis-vertical" />
|
||||
</div>
|
||||
{#if filter["status_in"] === "trashed"}
|
||||
{#if isWritable}
|
||||
@@ -111,12 +101,7 @@
|
||||
</a>
|
||||
{/if}
|
||||
{:else}
|
||||
|
||||
<a
|
||||
class="dropdown-item"
|
||||
href={csvUrl}
|
||||
>Export to CSV</a
|
||||
>
|
||||
<a class="dropdown-item" href={csvUrl}>Export to CSV</a>
|
||||
<a
|
||||
class="dropdown-item"
|
||||
href="{channel.lucentUrl}/content/{schema.name}?filter[status_in]=trashed"
|
||||
@@ -129,17 +114,12 @@
|
||||
>
|
||||
{/if}
|
||||
</Dropdown>
|
||||
|
||||
{/if}
|
||||
</div>
|
||||
</div>
|
||||
|
||||
|
||||
<div class="applied-filters">
|
||||
<AppliedFilterNotLinked
|
||||
{inModal}
|
||||
{modalUrl}
|
||||
on:refresh
|
||||
<AppliedFilterNotLinked {inModal} {modalUrl} on:refresh
|
||||
></AppliedFilterNotLinked>
|
||||
{#if Object.entries(filter).length > 0}
|
||||
{#each Object.entries(filter) as [k, v]}
|
||||
@@ -156,5 +136,3 @@
|
||||
{/each}
|
||||
{/if}
|
||||
</div>
|
||||
|
||||
|
||||
@@ -1,9 +1,8 @@
|
||||
<script>
|
||||
|
||||
import {createEventDispatcher, getContext} from "svelte";
|
||||
import { createEventDispatcher, getContext } from "svelte";
|
||||
import Icon from "../common/Icon.svelte";
|
||||
import Index from "../content/Index.svelte";
|
||||
import axios from "axios";
|
||||
import { apiGet } from "../../helpers";
|
||||
|
||||
let dialogEl;
|
||||
|
||||
@@ -15,21 +14,19 @@
|
||||
// load();
|
||||
// });
|
||||
|
||||
|
||||
export function close(e) {
|
||||
if(e){
|
||||
if (e) {
|
||||
e.preventDefault();
|
||||
}
|
||||
|
||||
dialogEl.close()
|
||||
dialogEl.close();
|
||||
selectedRecords = [];
|
||||
}
|
||||
|
||||
function load(schema) {
|
||||
axios
|
||||
.get(channel.lucentUrl + "/content/" + schema)
|
||||
apiGet(channel.lucentUrl + "/content/" + schema)
|
||||
.then((response) => {
|
||||
data = response.data;
|
||||
data = response;
|
||||
})
|
||||
.catch((error) => console.log(error));
|
||||
}
|
||||
@@ -52,12 +49,11 @@
|
||||
}
|
||||
|
||||
export function open(schema) {
|
||||
dialogEl.showModal()
|
||||
dialogEl.showModal();
|
||||
load(schema);
|
||||
}
|
||||
|
||||
|
||||
</script>
|
||||
|
||||
<dialog bind:this={dialogEl}>
|
||||
{#if data.schema}
|
||||
<div class="dialog-header">
|
||||
@@ -96,6 +92,5 @@
|
||||
<div class="dialog-body">
|
||||
<Index {...data} bind:selected={selectedRecords}></Index>
|
||||
</div>
|
||||
|
||||
{/if}
|
||||
</dialog>
|
||||
@@ -0,0 +1,102 @@
|
||||
<script>
|
||||
import { createEventDispatcher, getContext } from "svelte";
|
||||
import Icon from "../common/Icon.svelte";
|
||||
import FileIndex from "./FileIndex.svelte";
|
||||
import Dropdown from "../common/Dropdown.svelte";
|
||||
|
||||
let dialogEl;
|
||||
export let presetMode = false;
|
||||
|
||||
const dispatch = createEventDispatcher();
|
||||
const channel = getContext("channel");
|
||||
$: files = [];
|
||||
$: selectedFiles = [];
|
||||
// onMount(() => {
|
||||
// load();
|
||||
// });
|
||||
|
||||
export function close(e) {
|
||||
if (e) {
|
||||
e.preventDefault();
|
||||
}
|
||||
|
||||
dialogEl.close();
|
||||
selectedFiles = [];
|
||||
}
|
||||
|
||||
function load(recordId) {
|
||||
fetch(channel.lucentUrl + "/records/files/?recordId=" + recordId)
|
||||
.then((response) => response.json())
|
||||
.then((json) => {
|
||||
files = json;
|
||||
})
|
||||
.catch((error) => console.log(error));
|
||||
}
|
||||
|
||||
function insert(e, preset) {
|
||||
e.preventDefault();
|
||||
dispatch("insert_files", { files: selectedFiles, preset: preset });
|
||||
}
|
||||
|
||||
function replace(e) {
|
||||
e.preventDefault();
|
||||
dispatch("replace_files", selectedFiles);
|
||||
}
|
||||
|
||||
export function open(recordId) {
|
||||
dialogEl.showModal();
|
||||
load(recordId);
|
||||
}
|
||||
</script>
|
||||
|
||||
<dialog bind:this={dialogEl}>
|
||||
<div class="dialog-header">
|
||||
{#if presetMode}
|
||||
<Dropdown>
|
||||
<div slot="button">Insert Preset</div>
|
||||
{#each channel.imagePresets as preset}
|
||||
<button
|
||||
class=" dropdown-item button"
|
||||
on:click={(e) => insert(e, preset)}
|
||||
>{preset.name}</button
|
||||
>
|
||||
{/each}
|
||||
</Dropdown>
|
||||
{:else}
|
||||
<button
|
||||
type="button"
|
||||
class="button"
|
||||
on:click={insert}
|
||||
disabled={selectedFiles.length === 0}
|
||||
>
|
||||
Insert
|
||||
</button>
|
||||
<button
|
||||
type="button"
|
||||
class="button"
|
||||
on:click={replace}
|
||||
disabled={selectedFiles.length === 0}
|
||||
>
|
||||
Replace
|
||||
</button>
|
||||
{/if}
|
||||
{#if selectedFiles.length > 0}
|
||||
<span class="">
|
||||
{selectedFiles.length} records selected
|
||||
</span>
|
||||
{/if}
|
||||
|
||||
<button
|
||||
on:click|preventDefault={close}
|
||||
type="button"
|
||||
class="button close"
|
||||
aria-label="Close"
|
||||
>
|
||||
<Icon icon="close"></Icon>
|
||||
</button>
|
||||
</div>
|
||||
|
||||
<div class="dialog-body">
|
||||
<FileIndex {files} bind:selected={selectedFiles}></FileIndex>
|
||||
</div>
|
||||
</dialog>
|
||||
@@ -0,0 +1,104 @@
|
||||
<script>
|
||||
import { getContext } from "svelte";
|
||||
import Icon from "../common/Icon.svelte";
|
||||
import Checkbox from "../common/Checkbox.svelte";
|
||||
import Preview from "../files/Preview.svelte";
|
||||
import { fileurl } from "../files/imageserver";
|
||||
|
||||
const channel = getContext("channel");
|
||||
|
||||
export let files = [];
|
||||
export let selected = [];
|
||||
export let isWritable = true;
|
||||
|
||||
function eventToggleAll(e) {
|
||||
selected = toggleAll(e, files, selected);
|
||||
}
|
||||
|
||||
function select(file) {
|
||||
selected = selectFile(file, selected);
|
||||
}
|
||||
|
||||
export const toggleAll = (e, files, selected) => {
|
||||
if (selected.length === files.length) {
|
||||
return [];
|
||||
}
|
||||
e.currentTarget.checked = selected.length > 0;
|
||||
return files;
|
||||
};
|
||||
|
||||
export const selectFile = (file, selected) => {
|
||||
let fileExists = selected.find((r) => r.id === file.id);
|
||||
if (fileExists) {
|
||||
return selected.filter((r) => r.id !== file.id);
|
||||
}
|
||||
return [...selected, file];
|
||||
};
|
||||
</script>
|
||||
|
||||
<div class="table mt-5">
|
||||
<table>
|
||||
<thead>
|
||||
<tr>
|
||||
{#if isWritable}
|
||||
<th>
|
||||
<Checkbox
|
||||
value=""
|
||||
on:change={eventToggleAll}
|
||||
indeterminate={selected.length > 0 &&
|
||||
selected.length < files.length}
|
||||
checked={selected.length === files.length}
|
||||
></Checkbox>
|
||||
</th>
|
||||
{/if}
|
||||
<th></th>
|
||||
</tr>
|
||||
</thead>
|
||||
<tbody>
|
||||
{#each files as file (file.id)}
|
||||
<tr>
|
||||
<td class="title-td">
|
||||
<div class="title-td-contents">
|
||||
{#if isWritable}
|
||||
<Checkbox
|
||||
on:change={() => select(file)}
|
||||
checked={selected.find(
|
||||
(s) => s.id === file.id,
|
||||
)}
|
||||
value={file}
|
||||
></Checkbox>
|
||||
{/if}
|
||||
<div class="file-table-row">
|
||||
<Preview
|
||||
{file}
|
||||
size={file.width > 0 ? "medium" : "small"}
|
||||
/>
|
||||
|
||||
<div>
|
||||
{file.filename}
|
||||
<span
|
||||
>{(file.size / 1024).toFixed(1)}kB</span
|
||||
>
|
||||
|
||||
{#if file.width > 0}
|
||||
<span
|
||||
>{file.width +
|
||||
"x" +
|
||||
file.height}</span
|
||||
>
|
||||
{/if}
|
||||
<a
|
||||
href={fileurl(channel, file)}
|
||||
target="_blank"
|
||||
>
|
||||
Download
|
||||
</a>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</td>
|
||||
</tr>
|
||||
{/each}
|
||||
</tbody>
|
||||
</table>
|
||||
</div>
|
||||
@@ -1,19 +1,23 @@
|
||||
|
||||
|
||||
|
||||
export function sortByField(from, to, edges, fieldName, references) {
|
||||
if (from === to) {
|
||||
return edges;
|
||||
}
|
||||
let referenceIds = references.map(r => r.id);
|
||||
let edgesTosort = edges?.filter((ed) => ed.field === fieldName && ed.depth === 1 && referenceIds.includes(ed.target)) ?? [];
|
||||
let remainingEdge = edges?.filter((ed) => !(ed.field === fieldName && ed.depth === 1)) ?? [];
|
||||
let referenceIds = references.map((r) => r.id);
|
||||
let edgesTosort =
|
||||
edges?.filter(
|
||||
(ed) =>
|
||||
ed.field === fieldName &&
|
||||
ed.depth === 1 &&
|
||||
referenceIds.includes(ed.target),
|
||||
) ?? [];
|
||||
let remainingEdge =
|
||||
edges?.filter((ed) => !(ed.field === fieldName && ed.depth === 1)) ?? [];
|
||||
|
||||
edgesTosort = array_move(edgesTosort,from, to);
|
||||
edgesTosort = array_move(edgesTosort, from, to);
|
||||
return [...remainingEdge, ...edgesTosort];
|
||||
}
|
||||
|
||||
function array_move(arr, old_index, new_index) {
|
||||
export function array_move(arr, old_index, new_index) {
|
||||
if (new_index >= arr.length) {
|
||||
var k = new_index - arr.length + 1;
|
||||
while (k--) {
|
||||
@@ -22,4 +26,4 @@ function array_move(arr, old_index, new_index) {
|
||||
}
|
||||
arr.splice(new_index, 0, arr.splice(old_index, 1)[0]);
|
||||
return arr; // for testing
|
||||
};
|
||||
}
|
||||
@@ -1,15 +1,16 @@
|
||||
<script>
|
||||
import Icon from "../common/Icon.svelte";
|
||||
import {imgurl} from "./imageserver.js";
|
||||
import {getContext} from "svelte";
|
||||
import { fileurl, imgurl } from "./imageserver.js";
|
||||
import { getContext } from "svelte";
|
||||
|
||||
export let record;
|
||||
export let file;
|
||||
const channel = getContext("channel");
|
||||
export let size = "small";
|
||||
export let showFilename = false;
|
||||
let imageSide;
|
||||
let fileSide;
|
||||
let fontSize;
|
||||
|
||||
if (size == "large") {
|
||||
imageSide = 256;
|
||||
fileSide = 32;
|
||||
@@ -28,50 +29,50 @@
|
||||
fontSize = "13";
|
||||
}
|
||||
</script>
|
||||
<div style="display: flex;align-items: center;gap: 5px;">
|
||||
{#if record}
|
||||
|
||||
{#if record._file.mime.startsWith("image")}
|
||||
<div style="display: flex;align-items: center;gap: 5px;">
|
||||
{#if file}
|
||||
{#if file.mime.startsWith("image")}
|
||||
<!-- href={imgurl(record)} -->
|
||||
<a
|
||||
href="{channel.lucentUrl}/records/{record.id}"
|
||||
title={record._file.originalName}
|
||||
target="_blank"
|
||||
href={fileurl(channel, file)}
|
||||
title={file.filename}
|
||||
style="width:{imageSide}px;height:{imageSide}px"
|
||||
>
|
||||
<img
|
||||
class="rounded w-100"
|
||||
src={imgurl(channel,record)}
|
||||
alt={record._file.path}
|
||||
src={imgurl(channel, file)}
|
||||
alt={file.path}
|
||||
/>
|
||||
</a>
|
||||
{:else}
|
||||
<a
|
||||
href="{channel.lucentUrl}/records/{record.id}"
|
||||
title={record._file.path}
|
||||
href="{channel.lucentUrl}/files/{file.id}"
|
||||
title={file.path}
|
||||
class="file-preview-small"
|
||||
style="width:{imageSide}px;height:{imageSide}px"
|
||||
>
|
||||
<Icon icon="file" width={fileSide} height={fileSide}/>
|
||||
<Icon icon="file" width={fileSide} height={fileSide} />
|
||||
<span class="ms-2"
|
||||
>.{record._file.path.split(".").pop().toLowerCase()}</span
|
||||
>.{file.path.split(".").pop().toLowerCase()}</span
|
||||
>
|
||||
</a>
|
||||
{/if}
|
||||
{/if}
|
||||
{#if showFilename}
|
||||
<a
|
||||
href="{channel.lucentUrl}/records/{record.id}"
|
||||
title={record._file.path}
|
||||
href="{channel.lucentUrl}/files/{file.id}"
|
||||
title={file.path}
|
||||
class="preview-file-filename lx-small-text text-decoration-none"
|
||||
>{record._file.path} </a
|
||||
>
|
||||
>{file.path}
|
||||
</a>
|
||||
{/if}
|
||||
</div>
|
||||
|
||||
<style>
|
||||
img{
|
||||
img {
|
||||
border-radius: 12px;
|
||||
padding: 4px;
|
||||
}
|
||||
|
||||
</style>
|
||||
@@ -1,10 +1,11 @@
|
||||
<script>
|
||||
import {createEventDispatcher, getContext} from "svelte";
|
||||
import { createEventDispatcher, getContext } from "svelte";
|
||||
import Icon from "../common/Icon.svelte";
|
||||
|
||||
const dispatch = createEventDispatcher();
|
||||
|
||||
const channel = getContext("channel");
|
||||
export let schema;
|
||||
export let recordId;
|
||||
let mimeTypes = "";
|
||||
let files = [];
|
||||
let isLoading = false;
|
||||
@@ -17,34 +18,35 @@
|
||||
files = e.target.files ? [...e.target.files] : [];
|
||||
let formData = new FormData();
|
||||
|
||||
formData.append("schema", schema.name);
|
||||
formData.append("recordId", recordId);
|
||||
Array.from(files).forEach(function (file) {
|
||||
formData.append("files[]", file);
|
||||
});
|
||||
dispatch("beforeUpload", files);
|
||||
axios
|
||||
.post(channel.lucentUrl + "/files/upload", formData, {
|
||||
fetch(channel.lucentUrl + "/files/upload", {
|
||||
method: "POST",
|
||||
body: formData,
|
||||
headers: {
|
||||
"Content-Type": "multipart/form-data",
|
||||
"X-CSRF-TOKEN": document.querySelector(
|
||||
'meta[name="csrf-token"]',
|
||||
).content,
|
||||
},
|
||||
})
|
||||
.then((response) => {
|
||||
if (response.data.error) {
|
||||
dispatch("uploadError", response.data.error);
|
||||
.then((response) => response.json())
|
||||
.then((data) => {
|
||||
if (data.error) {
|
||||
dispatch("uploadError", data.error);
|
||||
} else {
|
||||
dispatch("uploadComplete", response.data);
|
||||
dispatch("uploadComplete", data);
|
||||
}
|
||||
isLoading = false;
|
||||
})
|
||||
.catch((error) => {
|
||||
isLoading = false;
|
||||
console.log(error.response.data);
|
||||
});
|
||||
}
|
||||
</script>
|
||||
|
||||
<fieldset class="upload-button" disabled={isLoading}>
|
||||
<label class="button primary btn-spinner ">
|
||||
<label class="button primary btn-spinner">
|
||||
<Icon icon="upload"></Icon>
|
||||
<span
|
||||
class="spinner-border spinner-border-sm"
|
||||
role="status"
|
||||
|
||||
@@ -1,29 +1,38 @@
|
||||
export function imgurl(channel, record) {
|
||||
if (record._file.mime === "image/svg+xml") {
|
||||
return fileurl(channel, record);
|
||||
export function imgurl(channel, file) {
|
||||
if (file.mime === "image/svg+xml") {
|
||||
return fileurl(channel, file);
|
||||
}
|
||||
return channel.disks[record._file.disk] + `/thumbs/${record._file.path}`;
|
||||
const webpPath = file.path.slice(0, file.path.lastIndexOf(".")) + ".webp";
|
||||
return channel.filesUrl + `/thumbs/${webpPath}`;
|
||||
}
|
||||
|
||||
export function fileurl(channel, record) {
|
||||
return channel.disks[record._file.disk] + `/${record._file.path}`;
|
||||
export function presetUrl(channel, file, preset) {
|
||||
if (file.mime === "image/svg+xml") {
|
||||
return fileurl(channel, file);
|
||||
}
|
||||
const webpPath = file.path.slice(0, file.path.lastIndexOf(".")) + ".webp";
|
||||
return channel.filesUrl + `/templates/${preset}/${webpPath}`;
|
||||
}
|
||||
|
||||
export function htmlurl(channel, record, preset) {
|
||||
export function fileurl(channel, file) {
|
||||
return channel.filesUrl + `/${file.path}`;
|
||||
}
|
||||
|
||||
export function htmlurl(channel, file, preset) {
|
||||
let html = "";
|
||||
let url = fileurl(channel, record)
|
||||
let url = fileurl(channel, file);
|
||||
|
||||
if (record._file.width > 0) {
|
||||
if (file.width > 0) {
|
||||
let presetUrl = url;
|
||||
if (preset) {
|
||||
presetUrl = channel.disks[record._file.disk] + `/templates/${preset}/${record._file.path}`;
|
||||
const webpPath = file.path.slice(0, file.path.lastIndexOf(".")) + ".webp";
|
||||
presetUrl = channel.filesUrl + `/templates/${preset}/${webpPath}`;
|
||||
}
|
||||
html = `<img src="${presetUrl}" alt="${record._file.path}" />`
|
||||
} else if (record._file.mime === "image/svg+xml") {
|
||||
html = `<img src="${url}" alt="${record._file.path}"/>`
|
||||
html = `<img src="${presetUrl}" alt="${file.path}" />`;
|
||||
} else if (file.mime === "image/svg+xml") {
|
||||
html = `<img src="${url}" alt="${file.path}"/>`;
|
||||
} else {
|
||||
html = `<a href="${url}">${record._file.originalName}</a>`
|
||||
html = `<a href="${url}">${file.filename}</a>`;
|
||||
}
|
||||
|
||||
return html;
|
||||
|
||||
@@ -1,19 +1,17 @@
|
||||
<script>
|
||||
|
||||
import {getContext, onMount} from "svelte";
|
||||
import RecordRow from "./RecordRow.svelte"
|
||||
import { getContext, onMount } from "svelte";
|
||||
import RecordRow from "./RecordRow.svelte";
|
||||
import { apiGet } from "../../helpers";
|
||||
|
||||
const channel = getContext("channel");
|
||||
let records = [];
|
||||
let graph = null;
|
||||
let users = [];
|
||||
onMount(() => {
|
||||
axios
|
||||
.get(channel.lucentUrl + "/home/records")
|
||||
.then((response) => {
|
||||
records = response.data.records;
|
||||
graph = response.data.graph;
|
||||
users = response.data.users;
|
||||
apiGet(channel.lucentUrl + "/home/records")
|
||||
.then((data) => {
|
||||
records = data.records;
|
||||
users = data.users;
|
||||
})
|
||||
.catch((error) => {
|
||||
console.log(error);
|
||||
@@ -21,21 +19,17 @@
|
||||
});
|
||||
</script>
|
||||
|
||||
|
||||
<h3 class="header-small mb-4 mt-5">Latest Content changes</h3>
|
||||
{#if records.length > 0}
|
||||
|
||||
<div class="table">
|
||||
<table class="">
|
||||
<tbody>
|
||||
{#each records as record (record.id)}
|
||||
<tr>
|
||||
<RecordRow {graph} {record} {users}/>
|
||||
<RecordRow {record} {users} />
|
||||
</tr>
|
||||
{/each}
|
||||
</tbody>
|
||||
</table>
|
||||
</div>
|
||||
|
||||
{/if}
|
||||
|
||||
@@ -1,20 +1,17 @@
|
||||
<script>
|
||||
import {formatDistanceToNow, parseJSON} from "date-fns";
|
||||
import { formatDistanceToNow, parseJSON } from "date-fns";
|
||||
import Avatar from "../account/Avatar.svelte";
|
||||
import {previewTitle} from "../records/Preview";
|
||||
import Preview from "../files/Preview.svelte";
|
||||
import {usernameById} from "../account/users";
|
||||
import {getContext} from "svelte";
|
||||
import { usernameById } from "../account/users";
|
||||
import { getContext } from "svelte";
|
||||
|
||||
const channel = getContext("channel");
|
||||
export let users;
|
||||
export let graph;
|
||||
export let record;
|
||||
let schema = channel.schemas.find((s) => s.name === record.schema);
|
||||
let frieldlyUpdatedAt = formatDistanceToNow(
|
||||
parseJSON(record._sys.updatedAt),
|
||||
{addSuffix: true}
|
||||
);
|
||||
let frieldlyUpdatedAt = formatDistanceToNow(parseJSON(record.updatedAt), {
|
||||
addSuffix: true,
|
||||
});
|
||||
</script>
|
||||
|
||||
<td>
|
||||
@@ -23,26 +20,19 @@
|
||||
<span class="status">DRAFT</span>
|
||||
{/if}
|
||||
{#if schema.type === "files"}
|
||||
<Preview {record} size="tiny" showFilename={true}/>
|
||||
<Preview {record} size="tiny" showFilename={true} />
|
||||
{:else}
|
||||
<a
|
||||
href="{channel.lucentUrl}/records/{record.id}"
|
||||
|
||||
>
|
||||
{previewTitle(channel.schemas, record, graph)}
|
||||
<a href="{channel.lucentUrl}/records/{record.id}">
|
||||
{record.data.name}
|
||||
</a>
|
||||
{/if}
|
||||
</div>
|
||||
</td>
|
||||
<td><a
|
||||
href="{channel.lucentUrl}/content/{schema.name}">{schema.label}</a
|
||||
>
|
||||
</td>
|
||||
|
||||
<td><a href="{channel.lucentUrl}/content/{schema.name}">{schema.label}</a> </td>
|
||||
|
||||
<td>
|
||||
<div style="display: flex;gap: 14px">
|
||||
<Avatar name={usernameById(users, record._sys.updatedBy)} side={24}/>
|
||||
<Avatar name={usernameById(users, record.updatedBy)} side={24} />
|
||||
<div class="ms-2">
|
||||
{frieldlyUpdatedAt}
|
||||
</div>
|
||||
|
||||
@@ -1,25 +1,28 @@
|
||||
<script>
|
||||
import Avatar from "../account/Avatar.svelte";
|
||||
import {getContext} from "svelte";
|
||||
import { getContext } from "svelte";
|
||||
import Dropdown from "../common/Dropdown.svelte";
|
||||
|
||||
const channel = getContext("channel");
|
||||
const user = getContext("user");
|
||||
console.log( channel.commands)
|
||||
</script>
|
||||
|
||||
|
||||
<div class="top-nav ">
|
||||
<div class="top-nav">
|
||||
{#if channel.auth == "lucent"}
|
||||
<a class="top-nav-item" href="{channel.lucentUrl}/members">Members</a>
|
||||
|
||||
{:else}
|
||||
<a href="/lunar">Store admin</a>
|
||||
{/if}
|
||||
{#if channel.commands.length > 0}
|
||||
<Dropdown>
|
||||
<div slot="button">Actions</div>
|
||||
{#each channel.commands as command}
|
||||
<a href="{channel.lucentUrl}/command-report/{command.signature}" class="top-nav-item">{command.name}</a>
|
||||
<a
|
||||
href="{channel.lucentUrl}/command-report/{command.signature}"
|
||||
class="top-nav-item">{command.name}</a
|
||||
>
|
||||
{/each}
|
||||
</Dropdown>
|
||||
|
||||
{/if}
|
||||
<!-- <div>-->
|
||||
<!-- <form method="GET">-->
|
||||
@@ -27,8 +30,11 @@
|
||||
<!-- class="form-control" required/>-->
|
||||
<!-- </form>-->
|
||||
<!-- </div>-->
|
||||
{#if channel.auth == "lucent"}
|
||||
<a href="{channel.lucentUrl}/profile">
|
||||
<Avatar side="28" name={user.name}/>
|
||||
<Avatar side="28" name={user.name} />
|
||||
</a>
|
||||
{:else}
|
||||
<Avatar side="28" name={user.name} />
|
||||
{/if}
|
||||
</div>
|
||||
|
||||
@@ -1,39 +1,21 @@
|
||||
<script>
|
||||
import NavbarMenu from "./NavbarMenu.svelte";
|
||||
import {getContext} from "svelte";
|
||||
import { getContext } from "svelte";
|
||||
|
||||
export let schema;
|
||||
const channel = getContext("channel");
|
||||
const readableSchemas = getContext("readableSchemas");
|
||||
|
||||
const fileSchemas = readableSchemas.filter((sc) => sc.type === "files");
|
||||
const otherSchemas = readableSchemas.filter((sc) => !sc.isEntry && sc.type === "collection");
|
||||
|
||||
</script>
|
||||
|
||||
<div class="sidebar-top">
|
||||
<a class="logo" href="{channel.lucentUrl}">{channel.name}</a>
|
||||
<a class="nav-item" href="{channel.lucentUrl}/profile">
|
||||
</a>
|
||||
<a class="logo" href={channel.lucentUrl}>{channel.name}</a>
|
||||
</div>
|
||||
<div class="sidebar">
|
||||
|
||||
|
||||
<NavbarMenu
|
||||
title="Content"
|
||||
schemas={ readableSchemas.filter((sc) => sc.isEntry)}
|
||||
schema={schema}
|
||||
expanded={true}
|
||||
/>
|
||||
|
||||
<NavbarMenu
|
||||
title="Files"
|
||||
schemas={ fileSchemas}
|
||||
schema={schema}
|
||||
/>
|
||||
|
||||
<NavbarMenu
|
||||
title="Other"
|
||||
schemas={ otherSchemas}
|
||||
schema={schema}
|
||||
/>
|
||||
{#each readableSchemas as aschema}
|
||||
<a
|
||||
class="sidebar-item"
|
||||
class:active={aschema.name === schema?.name}
|
||||
aria-current="page"
|
||||
href="{channel.lucentUrl}/content/{aschema.name}">{aschema.label}</a
|
||||
>
|
||||
{/each}
|
||||
</div>
|
||||
@@ -1,34 +0,0 @@
|
||||
<script>
|
||||
import {getContext} from "svelte";
|
||||
import Icon from "../common/Icon.svelte";
|
||||
|
||||
const channel = getContext("channel");
|
||||
export let schemas;
|
||||
export let title;
|
||||
export let schema;
|
||||
export let expanded = false;
|
||||
|
||||
if(schemas.find(s => s.name === schema?.name)){
|
||||
expanded = true;
|
||||
}
|
||||
|
||||
function toggleExpand(){
|
||||
expanded = !expanded;
|
||||
}
|
||||
</script>
|
||||
|
||||
<button class="sidebar-header" tabindex="0" on:click={toggleExpand}>
|
||||
{title}
|
||||
{#if expanded}
|
||||
<Icon icon="circle-chevron-up"></Icon>
|
||||
{:else}
|
||||
<Icon icon="circle-chevron-down"></Icon>
|
||||
{/if}
|
||||
</button>
|
||||
{#if expanded}
|
||||
{#each schemas as aschema}
|
||||
<a class="sidebar-item" class:active={aschema.name === schema?.name}
|
||||
aria-current="page"
|
||||
href="{channel.lucentUrl}/content/{aschema.name}">{aschema.label}</a>
|
||||
{/each}
|
||||
{/if}
|
||||
@@ -1,27 +1,32 @@
|
||||
<script>
|
||||
|
||||
// https://codesandbox.io/s/codemirror-remark-editor-4m4z9?file=/src/CodeEditor.js:374-387
|
||||
import {onDestroy, onMount} from "svelte";
|
||||
import {basicSetup, EditorView} from "codemirror";
|
||||
import {autocompletion, completionKeymap} from "@codemirror/autocomplete";
|
||||
import {Compartment, EditorState} from "@codemirror/state";
|
||||
import {keymap} from "@codemirror/view";
|
||||
import {indentWithTab} from "@codemirror/commands";
|
||||
import {markdown} from "@codemirror/lang-markdown";
|
||||
import {lintKeymap} from "@codemirror/lint";
|
||||
import { onDestroy, onMount } from "svelte";
|
||||
import { basicSetup, EditorView } from "codemirror";
|
||||
import { autocompletion, completionKeymap } from "@codemirror/autocomplete";
|
||||
import { Compartment, EditorState } from "@codemirror/state";
|
||||
import { keymap } from "@codemirror/view";
|
||||
import { indentWithTab } from "@codemirror/commands";
|
||||
import { markdown } from "@codemirror/lang-markdown";
|
||||
import { lintKeymap } from "@codemirror/lint";
|
||||
import { fileurl, presetUrl } from "../files/imageserver";
|
||||
|
||||
let parentElement;
|
||||
let codeMirrorView;
|
||||
export let value;
|
||||
export let editable = true;
|
||||
|
||||
export function insertMedia(info) {
|
||||
let insertText = "";
|
||||
if (info.record._file.width > 0) {
|
||||
insertText = ``;
|
||||
} else {
|
||||
insertText = `[${info.record._file.originalName}](${info.originalUrl})`;
|
||||
}
|
||||
export function insertMedia(channel, files, presetPath) {
|
||||
const insertText = files.reduce((text, aFile) => {
|
||||
const url =
|
||||
aFile.width > 0
|
||||
? presetUrl(channel, aFile, presetPath)
|
||||
: fileurl(channel, aFile);
|
||||
|
||||
let addTest = ``;
|
||||
|
||||
return text + "\n" + addTest;
|
||||
}, "");
|
||||
|
||||
const cursor = codeMirrorView.state.selection.main.head;
|
||||
const transaction = codeMirrorView.state.update({
|
||||
changes: {
|
||||
@@ -29,7 +34,7 @@
|
||||
insert: insertText,
|
||||
},
|
||||
// the next 2 lines will set the appropriate cursor position after inserting the new text.
|
||||
selection: {anchor: cursor + 1},
|
||||
selection: { anchor: cursor + 1 },
|
||||
scrollIntoView: true,
|
||||
});
|
||||
|
||||
@@ -46,11 +51,7 @@
|
||||
doc: value,
|
||||
extensions: [
|
||||
basicSetup,
|
||||
keymap.of([
|
||||
indentWithTab,
|
||||
...lintKeymap,
|
||||
...completionKeymap
|
||||
]),
|
||||
keymap.of([indentWithTab, ...lintKeymap, ...completionKeymap]),
|
||||
language.of(markdown()),
|
||||
markdown(),
|
||||
autocompletion(),
|
||||
@@ -63,17 +64,14 @@
|
||||
}
|
||||
}),
|
||||
EditorView.lineWrapping,
|
||||
EditorView.contentAttributes.of({spellcheck: "true"})
|
||||
EditorView.contentAttributes.of({ spellcheck: "true" }),
|
||||
],
|
||||
});
|
||||
|
||||
|
||||
codeMirrorView = new EditorView({
|
||||
state,
|
||||
parent: parentElement,
|
||||
});
|
||||
|
||||
|
||||
});
|
||||
|
||||
onDestroy(() => {
|
||||
@@ -83,4 +81,4 @@
|
||||
});
|
||||
</script>
|
||||
|
||||
<div class="is-editable-{editable}" bind:this={parentElement}/>
|
||||
<div class="is-editable-{editable}" bind:this={parentElement} />
|
||||
@@ -1,129 +0,0 @@
|
||||
<script>
|
||||
import {onDestroy, onMount} from "svelte";
|
||||
|
||||
import tinymce from "tinymce/tinymce";
|
||||
import "tinymce/models/dom";
|
||||
import "tinymce/icons/default";
|
||||
import "tinymce/themes/silver";
|
||||
import "tinymce/skins/ui/oxide/skin.css";
|
||||
import contentUiSkinCss from "tinymce/skins/ui/oxide/content.css?inline";
|
||||
import customcss from "./tinymce.css?inline";
|
||||
|
||||
import "tinymce/plugins/link";
|
||||
import "tinymce/plugins/code";
|
||||
import "tinymce/plugins/image";
|
||||
import "tinymce/plugins/table";
|
||||
import "tinymce/plugins/codesample";
|
||||
import "tinymce/plugins/media";
|
||||
|
||||
import "tinymce/plugins/lists";
|
||||
import "tinymce/plugins/autoresize";
|
||||
import "tinymce/plugins/wordcount";
|
||||
|
||||
export let value = "";
|
||||
export let additionalConfig = {};
|
||||
let lastVal = "";
|
||||
let textareaEl;
|
||||
let activeEditor;
|
||||
let editorWrapper;
|
||||
const plugins = [
|
||||
"autoresize",
|
||||
"code",
|
||||
"image",
|
||||
"table",
|
||||
"codesample",
|
||||
"link",
|
||||
"lists",
|
||||
"media",
|
||||
"wordcount",
|
||||
];
|
||||
const toolbar =
|
||||
"bold italic underline strikethrough removeformat | link | subscript superscript bullist numlist media image codesample table code wordcount blockquote indent outdent blocks";
|
||||
|
||||
onDestroy(() => {
|
||||
if (activeEditor) {
|
||||
activeEditor.destroy();
|
||||
}
|
||||
});
|
||||
|
||||
onMount(() => {
|
||||
const config = {
|
||||
target: textareaEl,
|
||||
toolbar_mode: "sliding",
|
||||
toolbar_sticky: true,
|
||||
skin: false,
|
||||
content_css: false,
|
||||
content_style: contentUiSkinCss.toString() + customcss.toString(),
|
||||
branding: false,
|
||||
inline: false,
|
||||
plugins: plugins,
|
||||
contextmenu: false,
|
||||
menubar: false,
|
||||
statusbar: false,
|
||||
entity_encoding: "raw",
|
||||
convert_urls: false,
|
||||
toolbar: toolbar,
|
||||
image_caption: true,
|
||||
relative_urls: false,
|
||||
browser_spellcheck: true,
|
||||
max_height: 600,
|
||||
// media_poster: false,
|
||||
|
||||
setup: function (editor) {
|
||||
activeEditor = editor;
|
||||
|
||||
editor.on("init", function (e) {
|
||||
editor.setContent(value ?? "");
|
||||
});
|
||||
|
||||
// editor.on("blur", function (e) {
|
||||
// let content = setImageDimensions(editor.getContent());
|
||||
// dispatch("editorBlur", content);
|
||||
// editorWrapper.classList.remove("editorFocus");
|
||||
// // return false;
|
||||
// });
|
||||
|
||||
// editor.on("focus", function (e) {
|
||||
// editorWrapper.classList.add("editorFocus");
|
||||
// // return false;
|
||||
// });
|
||||
|
||||
editor.on("change input undo redo", function (e) {
|
||||
lastVal = editor.getContent();
|
||||
if (lastVal !== value) {
|
||||
value = lastVal;
|
||||
}
|
||||
});
|
||||
},
|
||||
};
|
||||
|
||||
tinymce.init({...config, ...additionalConfig});
|
||||
});
|
||||
|
||||
export function insertMedia(info){
|
||||
activeEditor.execCommand('InsertHTML', false, info.html);
|
||||
}
|
||||
|
||||
</script>
|
||||
|
||||
<div bind:this={editorWrapper} class="tox-wrapper">
|
||||
<div class="form-control" bind:this={textareaEl}>
|
||||
{@html value}
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<style>
|
||||
:global(.tox:not(.tox-tinymce-inline) .tox-editor-header) {
|
||||
background-color: #fff;
|
||||
border-bottom: 1px solid #ced4da;
|
||||
box-shadow: none;
|
||||
padding: 4px 0;
|
||||
transition: box-shadow 0.5s;
|
||||
}
|
||||
|
||||
:global(.tox-tinymce) {
|
||||
border: 1px solid #ced4da;
|
||||
}
|
||||
|
||||
|
||||
</style>
|
||||
@@ -1,61 +1,61 @@
|
||||
<script>
|
||||
import {onDestroy, onMount} from "svelte";
|
||||
import Trix from "trix"
|
||||
import "trix/dist/trix.css"
|
||||
import { onDestroy, onMount } from "svelte";
|
||||
import Trix from "trix";
|
||||
import "trix/dist/trix.css";
|
||||
|
||||
export let value = "";
|
||||
export let field;
|
||||
let editor;
|
||||
|
||||
|
||||
function updateValue(e) {
|
||||
value = e.target.value;
|
||||
}
|
||||
|
||||
export function insertMedia(info){
|
||||
if(info.record._file.width > 0){
|
||||
var attachment = new Trix.Attachment({ content: info.html })
|
||||
editor.editor.insertAttachment(attachment)
|
||||
}else{
|
||||
editor.editor.insertHTML(`<a href="${info.originalUrl}">${info.record._file.originalName}</a>`)
|
||||
|
||||
}
|
||||
|
||||
|
||||
export function insertMedia(html) {
|
||||
console.log({ html });
|
||||
var attachment = new Trix.Attachment({ content: html });
|
||||
editor.editor.insertAttachment(attachment);
|
||||
// if (info.file.width > 0) {
|
||||
// var attachment = new Trix.Attachment({ content: html });
|
||||
// editor.editor.insertAttachment(attachment);
|
||||
// } else {
|
||||
// editor.editor.insertHTML(html);
|
||||
// }
|
||||
}
|
||||
|
||||
onMount(() => {
|
||||
editor.addEventListener("trix-file-accept", (e) => {
|
||||
e.preventDefault();
|
||||
})
|
||||
});
|
||||
|
||||
editor.addEventListener("trix-before-initialize", (e) => {
|
||||
Trix.config.blockAttributes.heading1.tagName = 'h2';
|
||||
const { toolbarElement } = e.target
|
||||
const h1Button = toolbarElement.querySelector("[data-trix-attribute=heading1]")
|
||||
h1Button.insertAdjacentHTML("afterend", `<button style="text-indent: initial;padding: 14px 10px !important;" type="button" class="trix-button trix-button--icon" data-trix-attribute="heading3" title="Heading 3" tabindex="-1" data-trix-active="">H3</button>`)
|
||||
})
|
||||
|
||||
|
||||
})
|
||||
Trix.config.blockAttributes.heading1.tagName = "h2";
|
||||
const { toolbarElement } = e.target;
|
||||
const h1Button = toolbarElement.querySelector(
|
||||
"[data-trix-attribute=heading1]",
|
||||
);
|
||||
h1Button.insertAdjacentHTML(
|
||||
"afterend",
|
||||
`<button style="text-indent: initial;padding: 14px 10px !important;" type="button" class="trix-button trix-button--icon" data-trix-attribute="heading3" title="Heading 3" tabindex="-1" data-trix-active="">H3</button>`,
|
||||
);
|
||||
});
|
||||
});
|
||||
// onDestroy(() => {
|
||||
// editor.removeEventListener("trix-before-initialize")
|
||||
// })
|
||||
|
||||
|
||||
Trix.config.blockAttributes.default.breakOnReturn = false
|
||||
Trix.config.blockAttributes.default.breakOnReturn = false;
|
||||
Trix.config.blockAttributes.heading3 = {
|
||||
tagName: 'h3',
|
||||
tagName: "h3",
|
||||
terminal: true,
|
||||
breakOnReturn: true,
|
||||
group: false
|
||||
}
|
||||
group: false,
|
||||
};
|
||||
// console.log(Trix.config)
|
||||
|
||||
</script>
|
||||
|
||||
<div class="tox-wrapper">
|
||||
<input id="x-{field.name}" {value} type="hidden">
|
||||
<input id="x-{field.name}" {value} type="hidden" />
|
||||
<trix-editor
|
||||
bind:this={editor}
|
||||
class=" content"
|
||||
@@ -63,6 +63,5 @@
|
||||
role="textbox"
|
||||
tabindex="0"
|
||||
on:trix-change={updateValue}
|
||||
|
||||
></trix-editor>
|
||||
</div>
|
||||
@@ -1,37 +0,0 @@
|
||||
.mce-content-body .img {
|
||||
max-width: 100%;
|
||||
height: auto;
|
||||
}
|
||||
|
||||
.mce-content-body{
|
||||
font-size: 16px;
|
||||
line-height: 20px;
|
||||
}
|
||||
.mce-content-body p{
|
||||
|
||||
margin-bottom: 14px;
|
||||
&:last-child{
|
||||
margin-bottom: 0;
|
||||
}
|
||||
}
|
||||
|
||||
.mce-content-body ul {
|
||||
padding: 0 0 0 16px;
|
||||
list-style: none outside none;
|
||||
|
||||
|
||||
|
||||
}
|
||||
|
||||
.mce-content-body li::before {
|
||||
content: "—";
|
||||
opacity: .5;
|
||||
font-size: 12px;
|
||||
padding-right: 6px;
|
||||
vertical-align: 10%;
|
||||
}
|
||||
|
||||
.mce-content-body li {
|
||||
list-style: none;
|
||||
padding: 0;
|
||||
}
|
||||
@@ -3,9 +3,8 @@
|
||||
import SuccessAlert from "../common/SuccessAlert.svelte";
|
||||
import SpinnerButton from "../common/SpinnerButton.svelte";
|
||||
import MemberSettingsCard from "./MemberSettingsCard.svelte";
|
||||
import {getContext} from "svelte";
|
||||
import axios from "axios";
|
||||
|
||||
import { getContext } from "svelte";
|
||||
import { apiPost } from "../../helpers";
|
||||
|
||||
const channel = getContext("channel");
|
||||
export let users;
|
||||
@@ -23,15 +22,14 @@
|
||||
function invite(newName, newEmail, newRole) {
|
||||
errorMessage = "";
|
||||
|
||||
axios
|
||||
.post(channel.lucentUrl + "/members/invite", {
|
||||
apiPost(channel.lucentUrl + "/members/invite", {
|
||||
name: newName,
|
||||
email: newEmail,
|
||||
roles: [newRole],
|
||||
})
|
||||
.then((response) => {
|
||||
successAlert.show("User was invited");
|
||||
users = [...users, response.data.user];
|
||||
users = [...users, response.user];
|
||||
name = null;
|
||||
email = null;
|
||||
role = null;
|
||||
@@ -45,14 +43,13 @@
|
||||
e.preventDefault();
|
||||
errorMessage = "";
|
||||
|
||||
axios
|
||||
.post(channel.lucentUrl + "/members/update", {
|
||||
apiPost(channel.lucentUrl + "/members/update", {
|
||||
id: e.detail.user,
|
||||
roles: e.detail.roles,
|
||||
})
|
||||
.then((response) => {
|
||||
successAlert.show("Users updated");
|
||||
users = response.data.users;
|
||||
users = response.users;
|
||||
})
|
||||
.catch((error) => {
|
||||
errorMessage = error.response?.data?.error ?? "";
|
||||
@@ -63,14 +60,12 @@
|
||||
<div class="common-wrapper">
|
||||
<div class="lx-card mt-5">
|
||||
<h3 class="header-small mb-5">Invite people</h3>
|
||||
<ErrorAlert message={errorMessage}/>
|
||||
<SuccessAlert bind:this={successAlert}/>
|
||||
<ErrorAlert message={errorMessage} />
|
||||
<SuccessAlert bind:this={successAlert} />
|
||||
|
||||
<form on:submit={submitInvite}>
|
||||
<div class="mb-3">
|
||||
<label for="inviteeName" class="form-label"
|
||||
>Invitee Name</label
|
||||
>
|
||||
<label for="inviteeName" class="form-label">Invitee Name</label>
|
||||
<input
|
||||
type="text"
|
||||
bind:value={name}
|
||||
@@ -97,16 +92,13 @@
|
||||
<div class="me-3">
|
||||
<select bind:value={role}>
|
||||
{#each channel.roles.filter((r) => r !== "removed") as arole}
|
||||
<option
|
||||
value={arole}
|
||||
|
||||
>{arole}</option>
|
||||
<option value={arole}>{arole}</option>
|
||||
{/each}
|
||||
</select>
|
||||
</div>
|
||||
|
||||
<div class="mt-5 d-block text-center">
|
||||
<SpinnerButton label="Invite"/>
|
||||
<SpinnerButton label="Invite" />
|
||||
</div>
|
||||
</form>
|
||||
</div>
|
||||
|
||||
@@ -1,15 +1,13 @@
|
||||
<script>
|
||||
import {afterUpdate, getContext, onMount} from "svelte";
|
||||
import {isEqual} from "lodash";
|
||||
import axios from "axios";
|
||||
import EditHeader from "./header/EditHeader.svelte"
|
||||
import FilePreview from "./FilePreview.svelte"
|
||||
import ContentTabs from "./header/ContentTabs.svelte"
|
||||
import FormField from "./FormField.svelte"
|
||||
import Graph from "./Graph.svelte"
|
||||
import Info from "./Info.svelte"
|
||||
import ErrorAlert from "../common/ErrorAlert.svelte"
|
||||
import { afterUpdate, getContext, onMount } from "svelte";
|
||||
import EditHeader from "./header/EditHeader.svelte";
|
||||
import ContentTabs from "./header/ContentTabs.svelte";
|
||||
import FormField from "./FormField.svelte";
|
||||
import Graph from "./Graph.svelte";
|
||||
import Info from "./Info.svelte";
|
||||
import ErrorAlert from "../common/ErrorAlert.svelte";
|
||||
import Title from "./header/Title.svelte";
|
||||
import { apiPost, isEqual } from "../../helpers";
|
||||
|
||||
const channel = getContext("channel");
|
||||
|
||||
@@ -17,7 +15,7 @@
|
||||
export let record;
|
||||
export let graph = {
|
||||
records: [],
|
||||
edges: []
|
||||
edges: [],
|
||||
};
|
||||
// export let recordHistory;
|
||||
export let isCreateMode;
|
||||
@@ -33,10 +31,7 @@
|
||||
} error(s)`
|
||||
: null;
|
||||
|
||||
let activeFields = schema.fields.filter(
|
||||
(f) => f.name !== "id"
|
||||
);
|
||||
|
||||
let activeFields = schema.fields.filter((f) => f.name !== "id");
|
||||
|
||||
onMount(() => {
|
||||
setOriginalContent();
|
||||
@@ -45,10 +40,7 @@
|
||||
function setOriginalContent() {
|
||||
originalContent = {
|
||||
data: JSON.parse(JSON.stringify(record.data)),
|
||||
schema: record.schema,
|
||||
status: record.status,
|
||||
_sys: JSON.parse(JSON.stringify(record._sys)),
|
||||
_file: JSON.parse(JSON.stringify(record._file)),
|
||||
edges: JSON.parse(JSON.stringify(graph.edges)),
|
||||
};
|
||||
}
|
||||
@@ -77,12 +69,10 @@
|
||||
if (isCreateMode) {
|
||||
return false;
|
||||
}
|
||||
|
||||
return !isEqual(originalContent, {
|
||||
data: record.data,
|
||||
schema: record.schema,
|
||||
status: record.status,
|
||||
_sys: record._sys,
|
||||
_file: record._file,
|
||||
edges: graph.edges,
|
||||
});
|
||||
}
|
||||
@@ -104,9 +94,10 @@
|
||||
}
|
||||
|
||||
// remove trashed edges
|
||||
graph.edges = graph.edges?.filter((edge) => !edge._isTrashed && edge.source === record.id);
|
||||
axios
|
||||
.post(channel.lucentUrl + "/records", {
|
||||
graph.edges = graph.edges?.filter(
|
||||
(edge) => !edge._isTrashed && edge.source === record.id,
|
||||
);
|
||||
apiPost(channel.lucentUrl + "/records", {
|
||||
record: record,
|
||||
edges: graph.edges,
|
||||
isCreateMode: isCreateMode,
|
||||
@@ -115,16 +106,17 @@
|
||||
console.log("SAVE: SAVED");
|
||||
|
||||
if (isCreateMode) {
|
||||
window.location = channel.lucentUrl + "/records/" + record.id;
|
||||
window.location =
|
||||
channel.lucentUrl + "/records/" + record.id;
|
||||
} else {
|
||||
record = response.data.records[0] ?? null;
|
||||
record = response.records[0] ?? null;
|
||||
if (!record) {
|
||||
// means trashed
|
||||
hasUnsavedData = false;
|
||||
window.location = channel.lucentUrl;
|
||||
return;
|
||||
}
|
||||
graph = response.data;
|
||||
graph = response;
|
||||
setOriginalContent();
|
||||
}
|
||||
|
||||
@@ -137,7 +129,7 @@
|
||||
errorMessage = error.response.data.error;
|
||||
} else {
|
||||
validationErrors = error.response.data.error;
|
||||
console.log(validationErrors)
|
||||
console.log(validationErrors);
|
||||
}
|
||||
}
|
||||
resolve(null);
|
||||
@@ -149,17 +141,14 @@
|
||||
}
|
||||
</script>
|
||||
|
||||
<svelte:window on:beforeunload={beforeUnload}/>
|
||||
<svelte:window on:beforeunload={beforeUnload} />
|
||||
|
||||
<div class="record-edit">
|
||||
<div class="tools-header">
|
||||
<!-- <Manager managerRecords={recordHistory} {graph}/>-->
|
||||
<EditHeader {schema} bind:record {isCreateMode} bind:activeContentTab/>
|
||||
<EditHeader {schema} bind:record {isCreateMode} bind:activeContentTab />
|
||||
{#if isCreateMode}
|
||||
<button
|
||||
class="button primary btn-spinner"
|
||||
on:click={save}
|
||||
>
|
||||
<button class="button primary btn-spinner" on:click={save}>
|
||||
<span
|
||||
class="spinner-border spinner-border-sm"
|
||||
role="status"
|
||||
@@ -181,26 +170,19 @@
|
||||
Save
|
||||
</button>
|
||||
{/if}
|
||||
|
||||
</div>
|
||||
<Title {schema} {record} {isCreateMode}/>
|
||||
<Title {schema} {record} {isCreateMode} />
|
||||
|
||||
|
||||
<ErrorAlert message={errorMessage}/>
|
||||
<ErrorAlert message={errorMessage} />
|
||||
|
||||
<div class=" mt-4" style="margin-bottom:150px;position:relative;">
|
||||
<ContentTabs
|
||||
{schema}
|
||||
{isCreateMode}
|
||||
bind:active={activeContentTab}
|
||||
/>
|
||||
<ContentTabs {schema} {isCreateMode} bind:active={activeContentTab} />
|
||||
{#if !["_graph", "_info"].includes(activeContentTab)}
|
||||
<FilePreview {record} {schema}/>
|
||||
{#each activeFields as field (field.name)}
|
||||
{#if activeContentTab === field.group}
|
||||
<FormField
|
||||
bind:data={record.data}
|
||||
bind:graph={graph}
|
||||
bind:graph
|
||||
{field}
|
||||
{schema}
|
||||
{record}
|
||||
@@ -210,9 +192,9 @@
|
||||
{/if}
|
||||
{/each}
|
||||
{:else if activeContentTab === "_graph"}
|
||||
<Graph {graph} {record}/>
|
||||
<Graph {graph} {record} />
|
||||
{:else if activeContentTab === "_info"}
|
||||
<Info {record} {graph} {users} {schema}/>
|
||||
<Info {record} {graph} {users} {schema} />
|
||||
{/if}
|
||||
</div>
|
||||
</div>
|
||||
@@ -1,7 +1,7 @@
|
||||
<script>
|
||||
import Preview from "../files/Preview.svelte";
|
||||
import {fileurl} from "../files/imageserver"
|
||||
import {getContext} from "svelte"
|
||||
import { fileurl } from "../files/imageserver";
|
||||
import { getContext } from "svelte";
|
||||
|
||||
const channel = getContext("channel");
|
||||
export let record;
|
||||
@@ -11,10 +11,9 @@
|
||||
{#if schema.type === "files"}
|
||||
<div class="record-edit-file-preview">
|
||||
<div>
|
||||
<Preview {record} size="large"/>
|
||||
<Preview {record} size="large" />
|
||||
</div>
|
||||
<div class="file-details">
|
||||
|
||||
<div class="file-details-item">
|
||||
<span class="text-muted">Filename</span>
|
||||
<span>{record._file.path}</span>
|
||||
@@ -42,9 +41,13 @@
|
||||
<span>{record._file.checksum}</span>
|
||||
</div>
|
||||
<div class="file-details-item">
|
||||
<a class="button primary" target="_blank" style="display: inline-flex" href="{fileurl(channel,record)}">Download</a>
|
||||
<a
|
||||
class="button primary"
|
||||
target="_blank"
|
||||
style="display: inline-flex"
|
||||
href={fileurl(channel, record)}>Download</a
|
||||
>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
{/if}
|
||||
|
||||
@@ -45,25 +45,20 @@
|
||||
</script>
|
||||
|
||||
<div class="editor-field">
|
||||
<FieldHeader {field} {id}/>
|
||||
<FieldHeader {field} {id} />
|
||||
{#if field.info.name === "reference" && field.layout === "tags"}
|
||||
<ReferenceTags
|
||||
bind:graph
|
||||
{id}
|
||||
{record}
|
||||
{field}
|
||||
{validationErrors}
|
||||
/>
|
||||
<ReferenceTags bind:graph {id} {record} {field} {validationErrors} />
|
||||
{:else if field.info.name === "reference"}
|
||||
<Reference
|
||||
bind:graph
|
||||
{id}
|
||||
<Reference bind:graph {id} {record} {field} {validationErrors} />
|
||||
{:else if field.info.name === "file"}
|
||||
<!-- <File bind:graph {record} {field} {validationErrors} /> -->
|
||||
<File
|
||||
bind:value={data[field.name]}
|
||||
{record}
|
||||
{id}
|
||||
{field}
|
||||
{validationErrors}
|
||||
/>
|
||||
{:else if field.info.name === "file"}
|
||||
<File bind:graph {record} {field} {validationErrors}/>
|
||||
{:else if field.info.name === "text"}
|
||||
<Text
|
||||
bind:value={data[field.name]}
|
||||
@@ -91,11 +86,8 @@
|
||||
{:else if field.info.name === "rich"}
|
||||
<RichEditor
|
||||
bind:value={data[field.name]}
|
||||
{schema}
|
||||
{field}
|
||||
{validationErrors}
|
||||
{isCreateMode}
|
||||
bind:graph
|
||||
{record}
|
||||
/>
|
||||
{:else if field.info.name === "markdown"}
|
||||
|
||||
@@ -1,11 +1,11 @@
|
||||
<script>
|
||||
import {friendlyDate} from "../../helpers";
|
||||
import { friendlyDate, isEqual } from "../../helpers";
|
||||
import Avatar from "../account/Avatar.svelte";
|
||||
import {usernameById} from "../account/users";
|
||||
import {isEqual} from "lodash";
|
||||
import { usernameById } from "../account/users";
|
||||
|
||||
import Icon from "../common/Icon.svelte";
|
||||
import RevisionCell from "./revisions/RevisionCell.svelte";
|
||||
import {getContext} from "svelte";
|
||||
import { getContext } from "svelte";
|
||||
import RevisionEdgeRow from "./revisions/RevisionEdgeRow.svelte";
|
||||
|
||||
const channel = getContext("channel");
|
||||
@@ -30,27 +30,27 @@
|
||||
});
|
||||
|
||||
function getEdgesByField(fieldsWithDiff, revision) {
|
||||
|
||||
edgeFieldsDiff = graph.edges.filter((e) => e.depth === 1).reduce((c, e) => {
|
||||
edgeFieldsDiff = graph.edges
|
||||
.filter((e) => e.depth === 1)
|
||||
.reduce((c, e) => {
|
||||
if (!c[e.field]) {
|
||||
c[e.field] = {
|
||||
record: [],
|
||||
revision: [],
|
||||
};
|
||||
}
|
||||
}
|
||||
c[e.field]["record"].push(e)
|
||||
c[e.field]["record"].push(e);
|
||||
return c;
|
||||
}, {});
|
||||
|
||||
|
||||
edgeFieldsDiff = revision._edges.reduce((c, e) => {
|
||||
if (!c[e.field]) {
|
||||
c[e.field] = {
|
||||
record: [],
|
||||
revision: [],
|
||||
};
|
||||
}
|
||||
}
|
||||
c[e.field]["revision"].push(e)
|
||||
c[e.field]["revision"].push(e);
|
||||
return c;
|
||||
}, edgeFieldsDiff);
|
||||
}
|
||||
@@ -62,7 +62,7 @@
|
||||
fieldsWithDiff = schema.fields.filter((f) => {
|
||||
return !isEqual(selectedRevision.data[f.name], record.data[f.name]);
|
||||
});
|
||||
getEdgesByField(fieldsWithDiff, revision)
|
||||
getEdgesByField(fieldsWithDiff, revision);
|
||||
revisionSection.scrollIntoView();
|
||||
}
|
||||
|
||||
@@ -71,7 +71,7 @@
|
||||
rollbackError = "";
|
||||
axios
|
||||
.post(
|
||||
`${channel.lucentUrl}/records/${record.id}/rollback/${selectedRevision._sys.version}`
|
||||
`${channel.lucentUrl}/records/${record.id}/rollback/${selectedRevision.version}`,
|
||||
)
|
||||
.then((response) => {
|
||||
window.location.reload();
|
||||
@@ -84,7 +84,7 @@
|
||||
}
|
||||
</script>
|
||||
|
||||
<div class="lx-card ">
|
||||
<div class="lx-card">
|
||||
<div class="row">
|
||||
<div class="col-8">
|
||||
<div>
|
||||
@@ -93,29 +93,27 @@
|
||||
</div>
|
||||
<div>
|
||||
<span class="label text-end text-muted">current version </span>
|
||||
{record._sys.version}
|
||||
{record.version}
|
||||
</div>
|
||||
<div>
|
||||
<span class="label text-end text-muted"> created </span>
|
||||
<Avatar
|
||||
name={usernameById(users, record._sys.createdBy)}
|
||||
name={usernameById(users, record.createdBy)}
|
||||
side={24}
|
||||
/>
|
||||
{friendlyDate(record._sys.createdAt)}
|
||||
{friendlyDate(record.createdAt)}
|
||||
</div>
|
||||
<div>
|
||||
<span class="label text-end text-muted">updated </span>
|
||||
<Avatar
|
||||
name={usernameById(users, record._sys.updatedBy)}
|
||||
name={usernameById(users, record.updatedBy)}
|
||||
side={24}
|
||||
/>
|
||||
{friendlyDate(record._sys.updatedAt)}
|
||||
{friendlyDate(record.updatedAt)}
|
||||
</div>
|
||||
</div>
|
||||
<div class="col-4">
|
||||
<span class="label d-block text-muted "
|
||||
>Rules for this schema
|
||||
</span>
|
||||
<span class="label d-block text-muted">Rules for this schema </span>
|
||||
<small>
|
||||
Each record maintains the last {schema.revisions}
|
||||
versions
|
||||
@@ -127,31 +125,29 @@
|
||||
{#if schema.revisions > 0}
|
||||
<div class="header-small mb-3">Revisions</div>
|
||||
{#each revisions as revision}
|
||||
{#if revision._sys.version !== record._sys.version}
|
||||
{#if revision.version !== record.version}
|
||||
<div
|
||||
class="revision"
|
||||
class:active={revision._sys.version ===
|
||||
selectedRevision?._sys.version}
|
||||
class:active={revision.version ===
|
||||
selectedRevision?.version}
|
||||
>
|
||||
|
||||
<div class="version">
|
||||
<span>version {revision._sys.version}</span>
|
||||
<span>version {revision.version}</span>
|
||||
<Avatar
|
||||
name={usernameById(users, revision._sys.updatedBy)}
|
||||
name={usernameById(users, revision.updatedBy)}
|
||||
side={24}
|
||||
/>
|
||||
{friendlyDate(revision._sys.updatedAt)}
|
||||
{friendlyDate(revision.updatedAt)}
|
||||
</div>
|
||||
|
||||
<div class="col-3 text-center">
|
||||
<button
|
||||
disabled={revision._sys.version ===
|
||||
selectedRevision?._sys.version}
|
||||
disabled={revision.version ===
|
||||
selectedRevision?.version}
|
||||
class="button"
|
||||
on:click={(e) => compare(e, revision)}
|
||||
>Compare
|
||||
</button
|
||||
>
|
||||
</button>
|
||||
</div>
|
||||
</div>
|
||||
{/if}
|
||||
@@ -169,15 +165,13 @@
|
||||
<p class="text-center fw-bold mb-3 mt-5">
|
||||
If you choose to rollback to this revision
|
||||
</p>
|
||||
<button
|
||||
on:click={rollback}
|
||||
class="button"
|
||||
>
|
||||
Rollback to version {selectedRevision._sys.version}
|
||||
<button on:click={rollback} class="button">
|
||||
Rollback to version {selectedRevision.version}
|
||||
</button>
|
||||
|
||||
{#if rollbackError}
|
||||
<span class="d-block text-danger mt-3">{rollbackError}</span>
|
||||
<span class="d-block text-danger mt-3">{rollbackError}</span
|
||||
>
|
||||
{/if}
|
||||
<div class="mt-3">
|
||||
{#each fieldsWithDiff as field}
|
||||
@@ -188,10 +182,7 @@
|
||||
<!-- <div class="d-block" style="width:200px;">
|
||||
{field.label}
|
||||
</div> -->
|
||||
<div
|
||||
class="revision-field"
|
||||
style="overflow:hidden"
|
||||
>
|
||||
<div class="revision-field" style="overflow:hidden">
|
||||
<div class="compare-left">
|
||||
<RevisionCell
|
||||
{field}
|
||||
@@ -226,22 +217,16 @@
|
||||
{/if}
|
||||
|
||||
<div class="mt-3">
|
||||
<p class="text-center fw-bold mb-3 mt-5">
|
||||
Record References
|
||||
</p>
|
||||
<p class="text-center fw-bold mb-3 mt-5">Record References</p>
|
||||
{#each Object.entries(edgeFieldsDiff) as [field, edges]}
|
||||
<div
|
||||
class="revision-references"
|
||||
style="overflow:hidden"
|
||||
>
|
||||
<div class="revision-references" style="overflow:hidden">
|
||||
<div class="reference-field">
|
||||
{field}:
|
||||
</div>
|
||||
<div class="reference-compare">
|
||||
|
||||
<p class="">Record</p>
|
||||
{#each edges.record as edge}
|
||||
<RevisionEdgeRow {edge}/>
|
||||
<RevisionEdgeRow {edge} />
|
||||
{:else}
|
||||
<p>No references</p>
|
||||
{/each}
|
||||
@@ -249,7 +234,7 @@
|
||||
<div class="reference-compare">
|
||||
<p class="text-success">Revision</p>
|
||||
{#each edges.revision as edge}
|
||||
<RevisionEdgeRow {edge}/>
|
||||
<RevisionEdgeRow {edge} />
|
||||
{:else}
|
||||
<p>No references</p>
|
||||
{/each}
|
||||
@@ -258,7 +243,5 @@
|
||||
{/each}
|
||||
</div>
|
||||
</div>
|
||||
|
||||
{/if}
|
||||
</div>
|
||||
|
||||
@@ -1,14 +1,18 @@
|
||||
<script>
|
||||
import {afterUpdate, createEventDispatcher, getContext, onMount} from "svelte";
|
||||
import {
|
||||
afterUpdate,
|
||||
createEventDispatcher,
|
||||
getContext,
|
||||
onMount,
|
||||
} from "svelte";
|
||||
|
||||
import {isEqual} from "lodash";
|
||||
import FormField from "./FormField.svelte";
|
||||
import FilePreview from "./FilePreview.svelte";
|
||||
import ContentTabs from "./header/ContentTabs.svelte";
|
||||
import ErrorAlert from "../common/ErrorAlert.svelte";
|
||||
import EditHeader from "./header/EditHeader.svelte";
|
||||
import axios from "axios";
|
||||
import Title from "./header/Title.svelte";
|
||||
import { apiPost, isEqual } from "../../helpers";
|
||||
|
||||
const channel = getContext("channel");
|
||||
const dispatch = createEventDispatcher();
|
||||
@@ -16,7 +20,7 @@
|
||||
export let record;
|
||||
export let graph = {
|
||||
records: [],
|
||||
edges: []
|
||||
edges: [],
|
||||
};
|
||||
export let isCreateMode;
|
||||
let originalContent;
|
||||
@@ -29,9 +33,7 @@
|
||||
} error(s)`
|
||||
: null;
|
||||
|
||||
let activeFields = schema.fields.filter(
|
||||
(f) => f.name !== "id"
|
||||
);
|
||||
let activeFields = schema.fields.filter((f) => f.name !== "id");
|
||||
|
||||
let tabname = "_default";
|
||||
let fieldToTabs = schema.fields.reduce((c, f) => {
|
||||
@@ -53,8 +55,6 @@
|
||||
data: JSON.parse(JSON.stringify(record.data)),
|
||||
schema: record.schema,
|
||||
status: record.status,
|
||||
_sys: JSON.parse(JSON.stringify(record._sys)),
|
||||
_file: JSON.parse(JSON.stringify(record._file)),
|
||||
edges: JSON.parse(JSON.stringify(graph.edges)),
|
||||
};
|
||||
}
|
||||
@@ -87,8 +87,6 @@
|
||||
data: record.data,
|
||||
schema: record.schema,
|
||||
status: record.status,
|
||||
_sys: record._sys,
|
||||
_file: record._file,
|
||||
edges: graph.edges,
|
||||
});
|
||||
}
|
||||
@@ -114,11 +112,12 @@
|
||||
return;
|
||||
}
|
||||
// remove trashed edges
|
||||
graph.edges = graph.edges?.filter((edge) => !edge._isTrashed && edge.source === record.id) ?? [];
|
||||
graph.edges =
|
||||
graph.edges?.filter(
|
||||
(edge) => !edge._isTrashed && edge.source === record.id,
|
||||
) ?? [];
|
||||
|
||||
|
||||
axios
|
||||
.post(channel.lucentUrl + "/records", {
|
||||
apiPost(channel.lucentUrl + "/records", {
|
||||
record: record,
|
||||
edges: graph.edges,
|
||||
isCreateMode: isCreateMode,
|
||||
@@ -126,8 +125,8 @@
|
||||
.then(function (response) {
|
||||
console.log("SAVE: SAVED INLINE");
|
||||
|
||||
record = response.data.records[0];
|
||||
graph = response.data;
|
||||
record = response.records[0];
|
||||
graph = response;
|
||||
if (!isCreateMode) {
|
||||
setOriginalContent();
|
||||
}
|
||||
@@ -150,16 +149,13 @@
|
||||
}
|
||||
</script>
|
||||
|
||||
<svelte:window on:beforeunload={beforeUnload}/>
|
||||
<svelte:window on:beforeunload={beforeUnload} />
|
||||
|
||||
<div class="inline-edit record-edit">
|
||||
<div class="tools-header">
|
||||
<EditHeader {schema} bind:record {isCreateMode} bind:activeContentTab/>
|
||||
<EditHeader {schema} bind:record {isCreateMode} bind:activeContentTab />
|
||||
{#if isCreateMode}
|
||||
<button
|
||||
class="button primary btn-spinner"
|
||||
on:click={save}
|
||||
>
|
||||
<button class="button primary btn-spinner" on:click={save}>
|
||||
<span
|
||||
class="spinner-border spinner-border-sm"
|
||||
role="status"
|
||||
@@ -181,24 +177,19 @@
|
||||
Save
|
||||
</button>
|
||||
{/if}
|
||||
|
||||
</div>
|
||||
<Title {schema} {record} {isCreateMode}/>
|
||||
<ErrorAlert message={errorMessage}/>
|
||||
<Title {schema} {record} {isCreateMode} />
|
||||
<ErrorAlert message={errorMessage} />
|
||||
|
||||
<div class=" mt-4" style="margin-bottom:150px;position:relative;">
|
||||
<ContentTabs
|
||||
{schema}
|
||||
{isCreateMode}
|
||||
bind:active={activeContentTab}
|
||||
/>
|
||||
<FilePreview {record} {schema}/>
|
||||
<ContentTabs {schema} {isCreateMode} bind:active={activeContentTab} />
|
||||
<FilePreview {record} {schema} />
|
||||
<!-- <fieldset disabled="disabled"> -->
|
||||
{#each activeFields as field (field.name)}
|
||||
{#if activeContentTab === field.group}
|
||||
<FormField
|
||||
bind:data={record.data}
|
||||
bind:graph={graph}
|
||||
bind:graph
|
||||
{field}
|
||||
{schema}
|
||||
{record}
|
||||
@@ -210,4 +201,3 @@
|
||||
<!-- </fieldset> -->
|
||||
</div>
|
||||
</div>
|
||||
|
||||
@@ -1,33 +0,0 @@
|
||||
import Mustache from "mustache";
|
||||
import {stripHtml} from "../../helpers";
|
||||
|
||||
export function previewTitle(schemas, record, graph) {
|
||||
let schema = schemas.find((aSchema) => aSchema.name === record?.schema);
|
||||
if (!schema?.cardTitle) {
|
||||
return noTemplate(schema, record);
|
||||
}
|
||||
|
||||
let recordData = record.data;
|
||||
let render = Mustache.render(schema.cardTitle, recordData);
|
||||
if (!render || render === "") {
|
||||
return noTemplate(schema, record);
|
||||
}
|
||||
|
||||
return stripHtml(render.slice(0, 300));
|
||||
}
|
||||
|
||||
function noTemplate(schema, record) {
|
||||
if (schema?.type === "files") {
|
||||
return record._file.path;
|
||||
}
|
||||
|
||||
let title = stripHtml(
|
||||
record?.data[schema.fields.filter((f) => f.info.name === "text")[0]?.name]
|
||||
).slice(0, 300);
|
||||
|
||||
if(title.trim() === ""){
|
||||
return "~Untitled~";
|
||||
}
|
||||
|
||||
return title;
|
||||
}
|
||||
@@ -1,21 +1,13 @@
|
||||
<script>
|
||||
import {previewTitle} from "./Preview";
|
||||
import {getContext} from "svelte";
|
||||
import { getContext } from "svelte";
|
||||
|
||||
const channel = getContext("channel");
|
||||
export let record;
|
||||
export let graph;
|
||||
$: schema = channel.schemas.find((aschema) => aschema.name === record.schema);
|
||||
|
||||
$: title = previewTitle(channel.schemas, record, graph);
|
||||
$: title = record.data.name;
|
||||
</script>
|
||||
|
||||
{#if record?.data}
|
||||
<a
|
||||
href="{channel.lucentUrl}/records/{record.id}"
|
||||
{title}
|
||||
class="reference"
|
||||
>
|
||||
<a href="{channel.lucentUrl}/records/{record.id}" {title} class="reference">
|
||||
{title}
|
||||
</a>
|
||||
{/if}
|
||||
|
||||
@@ -1,84 +1,73 @@
|
||||
<script>
|
||||
import {sortByField} from "../../edges/sortEdges";
|
||||
import { array_move } from "../../edges/sortEdges";
|
||||
import Sortable from "../../libs/Sortable.svelte";
|
||||
import PreviewFile from "../previews/PreviewFile.svelte";
|
||||
import Dropdown from "../../common/Dropdown.svelte";
|
||||
import Dialog from "../../dialog/Dialog.svelte";
|
||||
import {insertEdges} from "./reference.js";
|
||||
import {getContext} from "svelte";
|
||||
import FileDialog from "../../dialog/FileDialog.svelte";
|
||||
import Uploader from "../../files/Uploader.svelte";
|
||||
import Icon from "../../common/Icon.svelte";
|
||||
|
||||
const channel = getContext("channel");
|
||||
export let field;
|
||||
export let record;
|
||||
export let graph
|
||||
export let value = [];
|
||||
let browseModal;
|
||||
$: references = graph?.edges
|
||||
.filter((edge) => edge.field === field.name)
|
||||
.map((edge) => {
|
||||
return graph.records.find((increc) => increc.id === edge.target && record.id === edge.source);
|
||||
}).filter((rec) => (rec?.id ? true : false)) ?? [];
|
||||
|
||||
let collections = channel.schemas.filter((aschema) =>
|
||||
field.collections.includes(aschema.name)
|
||||
);
|
||||
|
||||
function removeReference(e) {
|
||||
function removeFile(e) {
|
||||
e.preventDefault();
|
||||
graph.edges = graph.edges.filter(
|
||||
(edge) => !(edge.target === e.detail && edge.field === field.name)
|
||||
);
|
||||
}
|
||||
|
||||
function openBrowseModal(e, schema) {
|
||||
e.preventDefault();
|
||||
browseModal.open(schema);
|
||||
value = value.filter((f) => !(f.id === e.detail));
|
||||
}
|
||||
|
||||
async function reorder(e) {
|
||||
|
||||
graph.edges = await sortByField(e.detail.source, e.detail.target, graph.edges, field.name, references);
|
||||
|
||||
value = await array_move(value, e.detail.source, e.detail.target);
|
||||
}
|
||||
|
||||
function insert(e) {
|
||||
function insertFiles(e) {
|
||||
e.preventDefault();
|
||||
browseModal.close();
|
||||
graph = insertEdges(graph, record, e.detail.records, field.name, e.detail.action);
|
||||
value = [...(value ?? []), ...(e.detail.files ?? [])];
|
||||
}
|
||||
|
||||
function replaceFiles(e) {
|
||||
e.preventDefault();
|
||||
browseModal.close();
|
||||
value = e.detail ?? [];
|
||||
}
|
||||
|
||||
function uploadComplete(e) {
|
||||
value = [...value, ...e.detail];
|
||||
}
|
||||
|
||||
function openBrowseModal(e) {
|
||||
e.preventDefault();
|
||||
browseModal.open(record.id);
|
||||
}
|
||||
</script>
|
||||
|
||||
<div class="mb-0">
|
||||
{#if field.collections.length === 1}
|
||||
<button
|
||||
class="button"
|
||||
on:click={(e) => openBrowseModal(e, collections[0].name)}
|
||||
>
|
||||
Browse
|
||||
<div
|
||||
class="mb-0"
|
||||
style="display: flex; align-items: start; justify-content: start; gap:6px"
|
||||
>
|
||||
<button class="button" on:click={openBrowseModal}>
|
||||
<Icon icon="photo-film"></Icon> Browse
|
||||
</button>
|
||||
{:else}
|
||||
<Dropdown>
|
||||
<div slot="button">
|
||||
Browse
|
||||
</div>
|
||||
{#each collections as collection}
|
||||
<!-- {`${channelurl}/content/${collection.name}?parent=${record.id}&parentfield=${field.name}`} -->
|
||||
<a
|
||||
class="dropdown-item"
|
||||
on:click={(e) => openBrowseModal(e, collection.name)}
|
||||
href="/">{collection.label}</a
|
||||
>
|
||||
{/each}
|
||||
</Dropdown>
|
||||
{/if}
|
||||
|
||||
<Uploader recordId={record.id} on:uploadComplete={uploadComplete} />
|
||||
</div>
|
||||
{#if references.length > 0}
|
||||
{#if value.length > 0}
|
||||
<Sortable sortableClass="mt-3" on:update={reorder}>
|
||||
{#each references as reference (reference.id)}
|
||||
{#each value ?? [] as aFile (aFile.id)}
|
||||
<!--This div helps the sorting thing-->
|
||||
<div>
|
||||
<PreviewFile record={reference} hasDelete={true} on:remove={removeReference}></PreviewFile>
|
||||
<PreviewFile
|
||||
file={aFile}
|
||||
hasDelete={true}
|
||||
on:remove_file={removeFile}
|
||||
></PreviewFile>
|
||||
</div>
|
||||
{/each}
|
||||
</Sortable>
|
||||
{/if}
|
||||
<Dialog bind:this={browseModal} on:insert={insert}></Dialog>
|
||||
<FileDialog
|
||||
bind:this={browseModal}
|
||||
on:insert_files={insertFiles}
|
||||
on:replace_files={replaceFiles}
|
||||
></FileDialog>
|
||||
@@ -1,12 +1,13 @@
|
||||
<script>
|
||||
import { getContext } from "svelte";
|
||||
import { htmlurl, presetUrl } from "../../files/imageserver";
|
||||
import Codemirror from "../../libs/CodemirrorMarkdown.svelte";
|
||||
import { getErrorMessage } from "./errorMessage";
|
||||
import RichEditorFiles from "./RichEditorFiles.svelte";
|
||||
|
||||
|
||||
const channel = getContext("channel");
|
||||
export let value;
|
||||
export let field;
|
||||
export let graph;
|
||||
|
||||
export let record;
|
||||
export let isCreateMode;
|
||||
// export let id;
|
||||
@@ -14,24 +15,21 @@
|
||||
$: errorMessage = getErrorMessage(validationErrors, field.name);
|
||||
let editor;
|
||||
|
||||
function insertMedia(e){
|
||||
editor.insertMedia(e.detail)
|
||||
function onFilesInserted(e) {
|
||||
const presetPath = e.detail.preset.path;
|
||||
editor.insertMedia(channel, e.detail.files, presetPath);
|
||||
}
|
||||
</script>
|
||||
|
||||
<div class="mb-3">
|
||||
<RichEditorFiles {record} {field} {validationErrors} {onFilesInserted}
|
||||
></RichEditorFiles>
|
||||
<Codemirror
|
||||
bind:this={editor}
|
||||
bind:value
|
||||
editable={!field.readonly || isCreateMode}
|
||||
/>
|
||||
|
||||
<Codemirror bind:this={editor} bind:value editable={!field.readonly || isCreateMode} />
|
||||
{#if field.collections.length > 0}
|
||||
<RichEditorFiles
|
||||
bind:graph
|
||||
{record}
|
||||
{field}
|
||||
{validationErrors}
|
||||
on:editor-insert={insertMedia}
|
||||
>
|
||||
</RichEditorFiles>
|
||||
{/if}
|
||||
{#if errorMessage}
|
||||
<div class="invalid-feedback d-block">
|
||||
{errorMessage}
|
||||
|
||||
@@ -1,12 +1,11 @@
|
||||
<script>
|
||||
import {getContext} from "svelte";
|
||||
import {insertEdges} from "./reference";
|
||||
import {getErrorMessage} from "./errorMessage";
|
||||
import {sortByField} from "../../edges/sortEdges";
|
||||
import { getContext } from "svelte";
|
||||
import { insertEdges } from "./reference";
|
||||
import { getErrorMessage } from "./errorMessage";
|
||||
import { sortByField } from "../../edges/sortEdges";
|
||||
import ReferenceInlineButtons from "./ReferenceInlineButtons.svelte";
|
||||
import Sortable from "../../libs/Sortable.svelte";
|
||||
import PreviewReference from "../previews/PreviewReference.svelte";
|
||||
import axios from "axios";
|
||||
|
||||
const channel = getContext("channel");
|
||||
export let record;
|
||||
@@ -15,27 +14,36 @@
|
||||
export let validationErrors;
|
||||
$: errorMessage = getErrorMessage(validationErrors, field.name);
|
||||
|
||||
|
||||
$: references = graph.edges
|
||||
$: references =
|
||||
graph.edges
|
||||
.filter((edge) => edge.field === field.name)
|
||||
.map((edge) => {
|
||||
return graph.records.find((increc) => increc.id === edge.target && record.id === edge.source);
|
||||
}).filter((rec) => (rec?.id ? true : false)) ?? [];
|
||||
return graph.records.find(
|
||||
(increc) =>
|
||||
increc.id === edge.target && record.id === edge.source,
|
||||
);
|
||||
})
|
||||
.filter((rec) => (rec?.id ? true : false)) ?? [];
|
||||
|
||||
let collections = channel.schemas.filter((aschema) =>
|
||||
field.collections.includes(aschema.name)
|
||||
field.collections.includes(aschema.name),
|
||||
);
|
||||
|
||||
function removeReference(e) {
|
||||
e.preventDefault();
|
||||
graph.edges = graph.edges.filter(
|
||||
(edge) => !(edge.target === e.detail && edge.field === field.name)
|
||||
(edge) => !(edge.target === e.detail && edge.field === field.name),
|
||||
);
|
||||
}
|
||||
|
||||
function reorder(e) {
|
||||
|
||||
graph.edges = sortByField(e.detail.source, e.detail.target, graph.edges, field.name, references);
|
||||
graph.edges = sortByField(
|
||||
e.detail.source,
|
||||
e.detail.target,
|
||||
graph.edges,
|
||||
field.name,
|
||||
references,
|
||||
);
|
||||
}
|
||||
|
||||
function insert(e) {
|
||||
@@ -49,9 +57,14 @@
|
||||
// }).then(function (response) {
|
||||
// graph = response.data.graph;
|
||||
// })
|
||||
graph = insertEdges(graph, record, e.detail.records, field.name, e.detail.action);
|
||||
graph = insertEdges(
|
||||
graph,
|
||||
record,
|
||||
e.detail.records,
|
||||
field.name,
|
||||
e.detail.action,
|
||||
);
|
||||
}
|
||||
|
||||
</script>
|
||||
|
||||
{#if errorMessage}
|
||||
|
||||
@@ -1,11 +1,11 @@
|
||||
<script>
|
||||
import {createEventDispatcher, getContext} from "svelte";
|
||||
import { createEventDispatcher, getContext } from "svelte";
|
||||
import Icon from "../../common/Icon.svelte";
|
||||
import InlineEdit from "../InlineEdit.svelte";
|
||||
import Dialog from "../../dialog/Dialog.svelte";
|
||||
import DialogRecord from "../../dialog/DialogRecord.svelte";
|
||||
import axios from "axios";
|
||||
import Dropdown from "../../common/Dropdown.svelte";
|
||||
import { apiGet } from "../../../helpers";
|
||||
|
||||
const dispatch = createEventDispatcher();
|
||||
const channel = getContext("channel");
|
||||
@@ -24,7 +24,7 @@
|
||||
e.preventDefault();
|
||||
console.log("Save inline");
|
||||
inLineCreateRecord = null;
|
||||
dialogRecord.close()
|
||||
dialogRecord.close();
|
||||
dispatch("save", {
|
||||
records: e.detail.records,
|
||||
after: recordId,
|
||||
@@ -44,11 +44,10 @@
|
||||
function createInlineReference(e, schemaUId) {
|
||||
e.preventDefault();
|
||||
inLineCreateRecord = null;
|
||||
axios
|
||||
.get(channel.lucentUrl + "/records/newInline?schema=" + schemaUId)
|
||||
apiGet(channel.lucentUrl + "/records/newInline?schema=" + schemaUId)
|
||||
.then((response) => {
|
||||
inLineCreateRecord = response.data;
|
||||
dialogRecord.open()
|
||||
inLineCreateRecord = response;
|
||||
dialogRecord.open();
|
||||
})
|
||||
.catch((error) => {
|
||||
console.log(error);
|
||||
@@ -57,23 +56,19 @@
|
||||
</script>
|
||||
|
||||
{#if schemas.length > 1}
|
||||
<div
|
||||
style="display: flex;align-items: center;gap:4px"
|
||||
>
|
||||
<div style="display: flex;align-items: center;gap:4px">
|
||||
<Dropdown>
|
||||
<div slot="button">New</div>
|
||||
{#each schemas as schema}
|
||||
<button
|
||||
class=" button"
|
||||
on:click={(e) =>
|
||||
createInlineReference(e, schema.name)}
|
||||
on:click={(e) => createInlineReference(e, schema.name)}
|
||||
>{schema.label}
|
||||
</button>
|
||||
{/each}
|
||||
|
||||
</Dropdown>
|
||||
<Dropdown>
|
||||
<div slot="button"> <Icon icon="magnifying-glass"/></div>
|
||||
<div slot="button"><Icon icon="magnifying-glass" /></div>
|
||||
{#each schemas as schema}
|
||||
<button
|
||||
class="button"
|
||||
@@ -81,7 +76,6 @@
|
||||
>{schema.label}
|
||||
</button>
|
||||
{/each}
|
||||
|
||||
</Dropdown>
|
||||
</div>
|
||||
{:else}
|
||||
@@ -95,9 +89,8 @@
|
||||
class="button"
|
||||
on:click={(e) => openBrowseModal(e, schemas[0].name)}
|
||||
>
|
||||
<Icon icon="magnifying-glass"/>
|
||||
</button
|
||||
>
|
||||
<Icon icon="magnifying-glass" />
|
||||
</button>
|
||||
</div>
|
||||
{/if}
|
||||
|
||||
@@ -109,8 +102,7 @@
|
||||
on:cancel={(e) => (inLineCreateRecord = null)}
|
||||
on:inlinesaved={save}
|
||||
/>
|
||||
|
||||
{/if}
|
||||
</DialogRecord>
|
||||
|
||||
<Dialog bind:this={browseModal} on:insert={insert}/>
|
||||
<Dialog bind:this={browseModal} on:insert={insert} />
|
||||
@@ -1,9 +1,7 @@
|
||||
<script>
|
||||
import {getContext} from "svelte";
|
||||
import {debounce} from "lodash";
|
||||
import {previewTitle} from "../Preview";
|
||||
import {getErrorMessage} from "./errorMessage";
|
||||
import {insertEdges} from "./reference.js";
|
||||
import { getContext } from "svelte";
|
||||
import { getErrorMessage } from "./errorMessage";
|
||||
import { insertEdges } from "./reference.js";
|
||||
import Icon from "../../common/Icon.svelte";
|
||||
|
||||
const channel = getContext("channel");
|
||||
@@ -15,20 +13,24 @@
|
||||
export let validationErrors;
|
||||
$: errorMessage = getErrorMessage(validationErrors, field.name);
|
||||
|
||||
$: references = graph.edges
|
||||
$: references =
|
||||
graph.edges
|
||||
.filter((edge) => edge.field === field.name)
|
||||
.map((edge) => {
|
||||
return graph.records.find((increc) => increc.id == edge.target && record.id == edge.source);
|
||||
}).filter((rec) => (rec?.id ? true : false)) ?? [];
|
||||
|
||||
let search = ""
|
||||
$: searchOptions = []
|
||||
return graph.records.find(
|
||||
(increc) =>
|
||||
increc.id == edge.target && record.id == edge.source,
|
||||
);
|
||||
})
|
||||
.filter((rec) => (rec?.id ? true : false)) ?? [];
|
||||
|
||||
let search = "";
|
||||
$: searchOptions = [];
|
||||
|
||||
function removeReference(e, recordId) {
|
||||
e.preventDefault();
|
||||
graph.edges = graph.edges.filter(
|
||||
(edge) => !(edge.target === recordId && edge.field === field.name)
|
||||
(edge) => !(edge.target === recordId && edge.field === field.name),
|
||||
);
|
||||
}
|
||||
|
||||
@@ -41,14 +43,14 @@
|
||||
schema: field.collections[0],
|
||||
status: "published",
|
||||
data: {
|
||||
[field.searchField]: newValue
|
||||
}
|
||||
[field.searchField]: newValue,
|
||||
},
|
||||
},
|
||||
})
|
||||
.then((response) => {
|
||||
searchOptions = [];
|
||||
insert(e, response.data.records[0]);
|
||||
console.log(response)
|
||||
console.log(response);
|
||||
})
|
||||
.catch((error) => {
|
||||
searchOptions = [];
|
||||
@@ -58,10 +60,16 @@
|
||||
|
||||
function insert(e, insertRecord) {
|
||||
e.preventDefault();
|
||||
graph = insertEdges(graph, record, [insertRecord], field.name, e.detail.action);
|
||||
search = ""
|
||||
searchEl.focus()
|
||||
searchEl.blur()
|
||||
graph = insertEdges(
|
||||
graph,
|
||||
record,
|
||||
[insertRecord],
|
||||
field.name,
|
||||
e.detail.action,
|
||||
);
|
||||
search = "";
|
||||
searchEl.focus();
|
||||
searchEl.blur();
|
||||
}
|
||||
|
||||
const updateResults = debounce((e) => {
|
||||
@@ -82,9 +90,8 @@
|
||||
console.log(error);
|
||||
});
|
||||
}, 500);
|
||||
|
||||
|
||||
</script>
|
||||
|
||||
<div class="reference-tags">
|
||||
{#if errorMessage}
|
||||
<div class="invalid-feedback d-block mb-3">
|
||||
@@ -99,12 +106,11 @@
|
||||
on:keyup={updateResults}
|
||||
class:is-invalid={errorMessage}
|
||||
bind:value={search}
|
||||
placeholder={"Search for "+field.label}
|
||||
placeholder={"Search for " + field.label}
|
||||
autocomplete="off"
|
||||
/>
|
||||
|
||||
<div class="reference-tags-results">
|
||||
|
||||
{#if searchOptions}
|
||||
{#each searchOptions as option (option.id)}
|
||||
<div
|
||||
@@ -114,23 +120,19 @@
|
||||
on:click={(e) => insert(e, option)}
|
||||
on:keypress={(e) => insert(e, option)}
|
||||
>
|
||||
{previewTitle(channel.schemas, option ,graph)}
|
||||
{option.data.name}
|
||||
</div>
|
||||
|
||||
{:else}
|
||||
<div
|
||||
class="start-typing">
|
||||
Start typing...
|
||||
</div>
|
||||
<div class="start-typing">Start typing...</div>
|
||||
{/each}
|
||||
{/if}
|
||||
{#if search }
|
||||
{#if search}
|
||||
<div
|
||||
class="reference-tags-option"
|
||||
role="button"
|
||||
tabindex="0"
|
||||
on:click={(e) => saveNew(e,search)}
|
||||
on:keypress={(e) => saveNew(e,search)}
|
||||
on:click={(e) => saveNew(e, search)}
|
||||
on:keypress={(e) => saveNew(e, search)}
|
||||
>
|
||||
Add "{search}"
|
||||
</div>
|
||||
@@ -146,22 +148,19 @@
|
||||
class="record-title"
|
||||
href="{channel.lucentUrl}/records/{record.id}"
|
||||
>
|
||||
{previewTitle(channel.schemas, record)}
|
||||
{record.data.name}
|
||||
</a>
|
||||
|
||||
<button
|
||||
on:click|preventDefault={(e) => removeReference(e, record.id)}
|
||||
on:click|preventDefault={(e) =>
|
||||
removeReference(e, record.id)}
|
||||
type="button"
|
||||
class="button-text"
|
||||
aria-label="Close"
|
||||
>
|
||||
<Icon width={12} height={12} icon="close"></Icon>
|
||||
</button>
|
||||
|
||||
</span>
|
||||
{/each}
|
||||
</div>
|
||||
{/if}
|
||||
|
||||
|
||||
|
||||
@@ -1,45 +1,32 @@
|
||||
<script>
|
||||
import Tinymce from "../../libs/Tinymce.svelte";
|
||||
import RichEditorFiles from "./RichEditorFiles.svelte";
|
||||
import {getErrorMessage} from "./errorMessage";
|
||||
import { getErrorMessage } from "./errorMessage";
|
||||
import Trix from "../../libs/Trix.svelte";
|
||||
import { htmlurl } from "../../files/imageserver";
|
||||
import { getContext } from "svelte";
|
||||
|
||||
const channel = getContext("channel");
|
||||
export let value;
|
||||
export let field;
|
||||
export let isCreateMode;
|
||||
export let graph;
|
||||
export let record;
|
||||
export let validationErrors;
|
||||
|
||||
let editor;
|
||||
|
||||
$: errorMessage = getErrorMessage(validationErrors, field.name);
|
||||
let additionalConfig = {
|
||||
readonly: field.readonly && !isCreateMode,
|
||||
};
|
||||
|
||||
function insertMedia(e){
|
||||
editor.insertMedia(e.detail)
|
||||
function onFilesInserted(e) {
|
||||
const presetPath = e.detail.preset.path;
|
||||
e.detail.files.map((aFile) => {
|
||||
const html = htmlurl(channel, aFile, presetPath);
|
||||
editor.insertMedia(html);
|
||||
});
|
||||
}
|
||||
</script>
|
||||
|
||||
<div class="mb-0">
|
||||
|
||||
<Trix {field} bind:this={editor} bind:value></Trix>
|
||||
<!-- <Tinymce bind:this={editor} bind:value {additionalConfig}/>-->
|
||||
{#if field.collections.length > 0}
|
||||
<RichEditorFiles
|
||||
bind:graph
|
||||
{record}
|
||||
{field}
|
||||
{validationErrors}
|
||||
on:editor-insert={insertMedia}
|
||||
>
|
||||
|
||||
|
||||
</RichEditorFiles>
|
||||
{/if}
|
||||
|
||||
<RichEditorFiles {record} {field} {onFilesInserted}></RichEditorFiles>
|
||||
|
||||
{#if errorMessage}
|
||||
<div class="invalid-feedback d-block">
|
||||
|
||||
@@ -1,76 +1,48 @@
|
||||
<script>
|
||||
import PreviewFile from "../previews/PreviewFile.svelte";
|
||||
import Dropdown from "../../common/Dropdown.svelte";
|
||||
import Dialog from "../../dialog/Dialog.svelte";
|
||||
import {insertEdges} from "./reference.js";
|
||||
import {getContext} from "svelte";
|
||||
import { getContext } from "svelte";
|
||||
import FileDialog from "../../dialog/FileDialog.svelte";
|
||||
import Uploader from "../../files/Uploader.svelte";
|
||||
import Icon from "../../common/Icon.svelte";
|
||||
|
||||
const channel = getContext("channel");
|
||||
export let field;
|
||||
export let record;
|
||||
export let graph
|
||||
export let onFilesInserted;
|
||||
let browseModal;
|
||||
$: references = graph?.edges
|
||||
.filter((edge) => edge.field === field.name)
|
||||
.map((edge) => {
|
||||
return graph.records.find((increc) => increc.id === edge.target && record.id === edge.source);
|
||||
}).filter((rec) => (rec?.id ? true : false)) ?? [];
|
||||
|
||||
let collections = channel.schemas.filter((aschema) =>
|
||||
field.collections.includes(aschema.name)
|
||||
);
|
||||
|
||||
function removeReference(e) {
|
||||
function openBrowseModal(e) {
|
||||
e.preventDefault();
|
||||
graph.edges = graph.edges.filter(
|
||||
(edge) => !(edge.target === e.detail && edge.field === field.name)
|
||||
);
|
||||
browseModal.open(record.id);
|
||||
}
|
||||
|
||||
function openBrowseModal(e, schema) {
|
||||
function insertFiles(e) {
|
||||
e.preventDefault();
|
||||
browseModal.open(schema);
|
||||
onFilesInserted(e);
|
||||
browseModal.close();
|
||||
}
|
||||
|
||||
function insert(e) {
|
||||
function replaceFiles(e) {
|
||||
e.preventDefault();
|
||||
browseModal.close();
|
||||
graph = insertEdges(graph, record, e.detail.records, field.name, e.detail.action);
|
||||
}
|
||||
|
||||
function uploadComplete(e) {}
|
||||
</script>
|
||||
|
||||
<div class="mb-3">
|
||||
<label class="mt-4 mb-3">Rich editor files</label>
|
||||
{#if field.collections.length === 1}
|
||||
<button
|
||||
class="button"
|
||||
on:click={(e) => openBrowseModal(e, collections[0].name)}
|
||||
>
|
||||
Browse
|
||||
<div
|
||||
class="mb-0"
|
||||
style="display: flex; align-items: start; justify-content: start; gap:6px"
|
||||
>
|
||||
<button class="button" on:click={openBrowseModal}>
|
||||
<Icon icon="photo-film"></Icon> Browse
|
||||
</button>
|
||||
{:else}
|
||||
<Dropdown>
|
||||
<div slot="button">
|
||||
Browse
|
||||
</div>
|
||||
{#each collections as collection}
|
||||
<!-- {`${channelurl}/content/${collection.name}?parent=${record.id}&parentfield=${field.name}`} -->
|
||||
<a
|
||||
class="dropdown-item"
|
||||
on:click={(e) => openBrowseModal(e, collection.name)}
|
||||
href="/">{collection.label}</a
|
||||
>
|
||||
{/each}
|
||||
</Dropdown>
|
||||
{/if}
|
||||
|
||||
<Uploader recordId={record.id} on:uploadComplete={uploadComplete} />
|
||||
</div>
|
||||
{#if references.length > 0}
|
||||
{#each references as reference (reference.id)}
|
||||
<!--This div helps the sorting thing-->
|
||||
<div>
|
||||
<PreviewFile record={reference} hasDelete={true} hasInsert={true} on:remove={removeReference}
|
||||
on:editor-insert></PreviewFile>
|
||||
</div>
|
||||
{/each}
|
||||
{/if}
|
||||
<Dialog bind:this={browseModal} on:insert={insert}></Dialog>
|
||||
|
||||
<FileDialog
|
||||
bind:this={browseModal}
|
||||
on:insert_files={insertFiles}
|
||||
on:replace_files={replaceFiles}
|
||||
presetMode={true}
|
||||
></FileDialog>
|
||||
@@ -1,5 +1,4 @@
|
||||
<script>
|
||||
import { v4 as uuidv4 } from "uuid";
|
||||
import { getContext } from "svelte";
|
||||
import Icon from "../../common/Icon.svelte";
|
||||
import { getErrorMessage } from "./errorMessage";
|
||||
@@ -14,12 +13,11 @@
|
||||
|
||||
function generateId(e) {
|
||||
e.preventDefault();
|
||||
value = uuidv4();
|
||||
value = self.crypto.randomUUID();
|
||||
}
|
||||
</script>
|
||||
|
||||
<div class="mb-0">
|
||||
|
||||
<div class="d-flex justify-content-between">
|
||||
<input
|
||||
type="text"
|
||||
|
||||
@@ -1,11 +1,10 @@
|
||||
<script>
|
||||
import { uniqueId } from "lodash";
|
||||
import { getContext } from "svelte";
|
||||
const channelurl = getContext("channelurl");
|
||||
export let field;
|
||||
export let value;
|
||||
export let schema;
|
||||
let id = uniqueId();
|
||||
let id = self.crypto.randomUUID();
|
||||
</script>
|
||||
|
||||
<div class="mb-0">
|
||||
|
||||
@@ -1,6 +1,12 @@
|
||||
import {uniqBy} from "lodash";
|
||||
import { arrayUniqueCb } from "../../../helpers";
|
||||
|
||||
export function insertEdges(graph, sourceRecord, targetRecords, fieldName, action = "") {
|
||||
export function insertEdges(
|
||||
graph,
|
||||
sourceRecord,
|
||||
targetRecords,
|
||||
fieldName,
|
||||
action = "",
|
||||
) {
|
||||
let newEdges = targetRecords.map((r) => {
|
||||
return {
|
||||
target: r.id,
|
||||
@@ -9,7 +15,7 @@ export function insertEdges(graph, sourceRecord, targetRecords, fieldName, actio
|
||||
targetSchema: r.schema,
|
||||
field: fieldName,
|
||||
depth: 1,
|
||||
rank: ""
|
||||
rank: "",
|
||||
};
|
||||
});
|
||||
|
||||
@@ -18,7 +24,13 @@ export function insertEdges(graph, sourceRecord, targetRecords, fieldName, actio
|
||||
replacedEdges = replacedEdges.filter((edge) => edge.field !== field.name);
|
||||
}
|
||||
|
||||
graph.records = uniqBy([...graph.records, ...targetRecords], (r) => r.id);
|
||||
graph.edges = uniqBy([...replacedEdges, ...newEdges], (edge) => edge.source + edge.target + edge.field + edge.depth);
|
||||
graph.records = arrayUniqueCb(
|
||||
[...graph.records, ...targetRecords],
|
||||
(r) => r.id,
|
||||
);
|
||||
graph.edges = arrayUniqueCb(
|
||||
[...replacedEdges, ...newEdges],
|
||||
(edge) => edge.source + edge.target + edge.field + edge.depth,
|
||||
);
|
||||
return graph;
|
||||
}
|
||||
@@ -1,8 +1,9 @@
|
||||
<script>
|
||||
import {getContext} from "svelte";
|
||||
import { getContext } from "svelte";
|
||||
import Icon from "../../common/Icon.svelte";
|
||||
import Dropdown from "../../common/Dropdown.svelte";
|
||||
import StatusSelect from "./StatusSelect.svelte";
|
||||
import { apiPost } from "../../../helpers";
|
||||
|
||||
const channel = getContext("channel");
|
||||
export let schema;
|
||||
@@ -12,21 +13,19 @@
|
||||
|
||||
function clone(e) {
|
||||
e.preventDefault();
|
||||
axios.post(channel.lucentUrl + "/records/clone/" + record.id).then(response => {
|
||||
window.location = channel.lucentUrl + "/records/" + response.data.id;
|
||||
}).catch(error => {
|
||||
|
||||
});
|
||||
apiPost(channel.lucentUrl + "/records/clone/" + record.id)
|
||||
.then((response) => {
|
||||
window.location = channel.lucentUrl + "/records/" + response.id;
|
||||
})
|
||||
.catch((error) => {});
|
||||
}
|
||||
</script>
|
||||
|
||||
|
||||
|
||||
<div style="display: flex;align-items: center; gap:10px;">
|
||||
{#if !isCreateMode}
|
||||
<Dropdown >
|
||||
<Dropdown>
|
||||
<div slot="button">
|
||||
<Icon icon="ellipsis"/>
|
||||
<Icon icon="ellipsis" />
|
||||
</div>
|
||||
<h6 class="dropdown-header">Record Actions</h6>
|
||||
<a
|
||||
@@ -44,13 +43,12 @@
|
||||
</a>
|
||||
{/if}
|
||||
<a
|
||||
on:click|preventDefault={(e) =>
|
||||
(activeContentTab = "_info")}
|
||||
on:click|preventDefault={(e) => (activeContentTab = "_info")}
|
||||
class="dropdown-item"
|
||||
href="{channel.lucentUrl}">Revisions</a
|
||||
href={channel.lucentUrl}>Revisions</a
|
||||
>
|
||||
</Dropdown>
|
||||
{/if}
|
||||
|
||||
<StatusSelect bind:status={record.status} {record}></StatusSelect>
|
||||
<StatusSelect bind:status={record.status} {record}></StatusSelect>
|
||||
</div>
|
||||
@@ -1,27 +1,21 @@
|
||||
<script>
|
||||
import {getContext} from "svelte";
|
||||
import {previewTitle} from "./../Preview";
|
||||
import { getContext } from "svelte";
|
||||
|
||||
const channel = getContext("channel");
|
||||
export let schema;
|
||||
export let record;
|
||||
export let isCreateMode;
|
||||
|
||||
</script>
|
||||
|
||||
<div class="record-header">
|
||||
|
||||
<a
|
||||
class="schema-name"
|
||||
href="{channel.lucentUrl}/content/{schema.name}"
|
||||
<a class="schema-name" href="{channel.lucentUrl}/content/{schema.name}"
|
||||
>{schema.label.toUpperCase()}</a
|
||||
>
|
||||
<span class="record-title">
|
||||
{#if !isCreateMode}
|
||||
{previewTitle(channel.schemas, record)}
|
||||
{record.data.name}
|
||||
{:else}
|
||||
New Record
|
||||
{/if}
|
||||
</span>
|
||||
|
||||
</div>
|
||||
@@ -1,91 +1,40 @@
|
||||
<script>
|
||||
import Icon from "../../common/Icon.svelte";
|
||||
|
||||
import {createEventDispatcher, getContext} from "svelte";
|
||||
import { createEventDispatcher } from "svelte";
|
||||
import Preview from "../../files/Preview.svelte";
|
||||
import {previewTitle} from "./../Preview";
|
||||
import {fileurl, htmlurl} from "../../files/imageserver.js"
|
||||
import Status from "./../Status.svelte";
|
||||
import Dropdown from "../../common/Dropdown.svelte";
|
||||
|
||||
const dispatch = createEventDispatcher();
|
||||
const channel = getContext("channel");
|
||||
export let record;
|
||||
export let hasDelete = false;
|
||||
export let hasInsert = false;
|
||||
|
||||
let schema = channel.schemas.find((aschema) => aschema.name === record.schema);
|
||||
let cardTitle = previewTitle(channel.schemas, record);
|
||||
let imagePresets = Object.keys(channel.imageFilters);
|
||||
export let file;
|
||||
export let hasDelete = false;
|
||||
|
||||
function remove(e) {
|
||||
e.preventDefault();
|
||||
dispatch("remove", record.id);
|
||||
dispatch("remove_file", file.id);
|
||||
}
|
||||
|
||||
function insert(e, preset) {
|
||||
e.preventDefault();
|
||||
let html = htmlurl(channel, record, preset)
|
||||
let url = !preset ? `/${record._file.path}` : `/templates/${preset}/${record._file.path}`;
|
||||
dispatch("editor-insert", {
|
||||
html: html,
|
||||
url: channel.filesUrl + url,
|
||||
originalUrl: channel.filesUrl + "/" + record._file.path,
|
||||
record: record
|
||||
});
|
||||
}
|
||||
|
||||
</script>
|
||||
|
||||
<div class="preview-file">
|
||||
<div style="display: flex;align-items: center;gap: 10px;">
|
||||
<div class="image">
|
||||
<Preview {record} size="small"/>
|
||||
<Preview {file} size="small" />
|
||||
</div>
|
||||
<div class="title">
|
||||
<div>
|
||||
<a
|
||||
class="record-title"
|
||||
href="{channel.lucentUrl}/records/{record.id}"
|
||||
{file.filename}
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
<div
|
||||
style="display: flex;gap:4px; align-items: center; margin-right: 10px;"
|
||||
>
|
||||
{cardTitle}
|
||||
</a>
|
||||
<small class="d-block">
|
||||
from {schema.label}
|
||||
{#if record.status === "draft"}
|
||||
<Status status={record.status}/>
|
||||
{/if}
|
||||
</small>
|
||||
|
||||
</div>
|
||||
|
||||
</div>
|
||||
</div>
|
||||
<div style="display: flex;gap:4px; align-items: center; margin-right: 10px;">
|
||||
{#if hasInsert}
|
||||
<div class="reference-action">
|
||||
<Dropdown>
|
||||
<div slot="button">
|
||||
<Icon icon="photo-film"/>
|
||||
</div>
|
||||
<button class="dropdown-item button" on:click={e => insert(e,null)}>original</button>
|
||||
{#each imagePresets as preset}
|
||||
<button class="dropdown-item button" on:click={e => insert(e,preset)}>{preset}</button>
|
||||
{/each}
|
||||
</Dropdown>
|
||||
|
||||
</div>
|
||||
{/if}
|
||||
{#if hasDelete}
|
||||
<div class="reference-action">
|
||||
<button
|
||||
class="button"
|
||||
on:click={remove}
|
||||
>
|
||||
<Icon icon="trash-can"/>
|
||||
<button class="button" on:click={remove}>
|
||||
<Icon icon="trash-can" />
|
||||
</button>
|
||||
</div>
|
||||
{/if}
|
||||
</div>
|
||||
</div>
|
||||
|
||||
@@ -1,8 +1,7 @@
|
||||
<script>
|
||||
import Icon from "../../common/Icon.svelte";
|
||||
|
||||
import {createEventDispatcher, getContext} from "svelte";
|
||||
import {previewTitle} from "./../Preview";
|
||||
import { createEventDispatcher, getContext } from "svelte";
|
||||
import Status from "./../Status.svelte";
|
||||
import Preview from "../../files/Preview.svelte";
|
||||
|
||||
@@ -12,10 +11,15 @@
|
||||
export let record;
|
||||
export let hasDelete = false;
|
||||
|
||||
let schema = channel.schemas.find((aschema) => aschema.name === record.schema);
|
||||
let cardTitle = previewTitle(channel.schemas, record, graph);
|
||||
const cardImageEdge = graph.edges.find(e => e.source === record.id && e.field === schema.cardImage);
|
||||
let cardImageRecord = graph.records.find(r => r.id === cardImageEdge?.target);
|
||||
let schema = channel.schemas.find(
|
||||
(aschema) => aschema.name === record.schema,
|
||||
);
|
||||
const cardImageEdge = graph.edges.find(
|
||||
(e) => e.source === record.id && e.field === schema.cardImage,
|
||||
);
|
||||
let cardImageRecord = graph.records.find(
|
||||
(r) => r.id === cardImageEdge?.target,
|
||||
);
|
||||
|
||||
function remove(e) {
|
||||
e.preventDefault();
|
||||
@@ -23,13 +27,11 @@
|
||||
}
|
||||
</script>
|
||||
|
||||
|
||||
<div class="preview-reference">
|
||||
<div style="display: flex;align-items: center;gap: 10px;">
|
||||
|
||||
{#if cardImageRecord}
|
||||
<div class="image">
|
||||
<Preview record={cardImageRecord} size="small"/>
|
||||
<Preview record={cardImageRecord} size="small" />
|
||||
</div>
|
||||
{/if}
|
||||
<div class="title">
|
||||
@@ -38,28 +40,22 @@
|
||||
class="record-title"
|
||||
href="{channel.lucentUrl}/records/{record.id}"
|
||||
>
|
||||
{cardTitle}
|
||||
{record.data.name}
|
||||
</a>
|
||||
<small class="d-block">
|
||||
from {schema.label}
|
||||
{#if record.status === "draft"}
|
||||
<Status status={record.status}/>
|
||||
<Status status={record.status} />
|
||||
{/if}
|
||||
</small>
|
||||
|
||||
</div>
|
||||
|
||||
</div>
|
||||
</div>
|
||||
{#if hasDelete}
|
||||
<div class="reference-action">
|
||||
<button
|
||||
class="button"
|
||||
on:click={remove}
|
||||
>
|
||||
<Icon icon="trash-can"/>
|
||||
<button class="button" on:click={remove}>
|
||||
<Icon icon="trash-can" />
|
||||
</button>
|
||||
</div>
|
||||
{/if}
|
||||
</div>
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
<script>
|
||||
import Preview from "../../files/Preview.svelte";
|
||||
import PreviewCardSmall from "../PreviewCardSmall.svelte";
|
||||
import PreviewFile from "../previews/PreviewFile.svelte";
|
||||
|
||||
export let field;
|
||||
export let side;
|
||||
@@ -8,26 +8,23 @@
|
||||
export let colorClass;
|
||||
</script>
|
||||
|
||||
{#if ["reference", "file"].includes(field.info.name)}
|
||||
{#if ["reference"].includes(field.info.name)}
|
||||
<div class="{colorClass} field-content">
|
||||
<div class="d-flex align-items-center text-center flex-wrap">
|
||||
{#each edges[field.name] as edgeRecord}
|
||||
{#if edgeRecord._file?.path}
|
||||
<div
|
||||
class="ms-2 "
|
||||
style="max-width:64px;overflow:hidden;white-space: nowrap;text-overflow: ellipsis;"
|
||||
>
|
||||
<Preview
|
||||
record={edgeRecord}
|
||||
size="small"
|
||||
showFilename={true}
|
||||
/>
|
||||
<div class="ms-2">
|
||||
<PreviewCardSmall record={edgeRecord} />
|
||||
</div>
|
||||
{:else}
|
||||
<div class="ms-2 ">
|
||||
<PreviewCardSmall record={edgeRecord}/>
|
||||
{/each}
|
||||
</div>
|
||||
</div>
|
||||
{:else if ["file"].includes(field.info.name)}
|
||||
<div class="{colorClass} field-content">
|
||||
<div class="d-flex align-items-center text-center flex-wrap">
|
||||
{#each side as aFile}
|
||||
<div class="ms-2">
|
||||
<PreviewFile file={aFile} />
|
||||
</div>
|
||||
{/if}
|
||||
{/each}
|
||||
</div>
|
||||
</div>
|
||||
@@ -43,7 +40,6 @@
|
||||
|
||||
<!-- {/if} -->
|
||||
<style>
|
||||
|
||||
.field-content {
|
||||
max-height: 200px;
|
||||
overflow-y: scroll;
|
||||
|
||||
@@ -1,20 +0,0 @@
|
||||
<script>
|
||||
import Step from "./Step.svelte"
|
||||
|
||||
export let steps;
|
||||
export let allSuccess = false;
|
||||
|
||||
console.log(steps);
|
||||
</script>
|
||||
<div class="wrapper-tiny">
|
||||
|
||||
{#each steps as step}
|
||||
<Step {step}></Step>
|
||||
{/each}
|
||||
|
||||
<div style="text-align: center;margin-top: 30px;">
|
||||
{#if allSuccess}
|
||||
<a href="/lucent/register" class="bt">Create the first user</a>
|
||||
{/if}
|
||||
</div>
|
||||
</div>
|
||||
@@ -1,67 +0,0 @@
|
||||
<script>
|
||||
import Icon from "../common/Icon.svelte"
|
||||
|
||||
export let step;
|
||||
|
||||
</script>
|
||||
|
||||
|
||||
<div class="step step-{step.status}">
|
||||
<div class="step-icon">
|
||||
{#if step.status === "success"}
|
||||
<Icon icon="check"></Icon>
|
||||
{:else}
|
||||
<Icon icon="close"></Icon>
|
||||
{/if}
|
||||
</div>
|
||||
<div style="width:100%">
|
||||
<h4>{step.name}</h4>
|
||||
<details>
|
||||
<summary>Instuctions</summary>
|
||||
<code class="instructions">{step.instructions}</code>
|
||||
</details>
|
||||
</div>
|
||||
|
||||
|
||||
</div>
|
||||
|
||||
<style>
|
||||
.step-success .step-icon{
|
||||
background: var(--suc10);
|
||||
color: var(--suc100);
|
||||
}
|
||||
|
||||
.step-fail .step-icon{
|
||||
background: var(--err10);
|
||||
color: var(--err100);
|
||||
}
|
||||
|
||||
.step-icon{
|
||||
padding: 12px;
|
||||
border-radius: 12px;
|
||||
}
|
||||
|
||||
.step {
|
||||
width: 100%;
|
||||
display: flex;
|
||||
align-items: start;
|
||||
gap: 10px;
|
||||
justify-content: space-between;
|
||||
|
||||
padding: 12px;
|
||||
border-radius: 12px;
|
||||
}
|
||||
|
||||
details {
|
||||
width: 100%;
|
||||
}
|
||||
|
||||
.instructions {
|
||||
margin-top: 20px;
|
||||
padding: 12px;
|
||||
border-radius: 12px;
|
||||
background: var(--p10);
|
||||
white-space: break-spaces;
|
||||
display: block;
|
||||
}
|
||||
</style>
|
||||
Generated
+294
-2841
File diff suppressed because it is too large.
Load diff
@@ -11,24 +11,15 @@
|
||||
"@codemirror/lang-markdown": "^6.2.5",
|
||||
"@codemirror/state": "^6.4.1",
|
||||
"@sveltejs/vite-plugin-svelte": "^3.1.1",
|
||||
"axios": "^1.7.4",
|
||||
"codemirror": "^6.0.1",
|
||||
"date-fns": "^3.6.0",
|
||||
"flatpickr": "^4.6.13",
|
||||
"fuse.js": "^7.0.0",
|
||||
"htmx.org": "^2.0.1",
|
||||
"install": "^0.13.0",
|
||||
"laravel-vite-plugin": "^1.0.5",
|
||||
"lodash": "^4.17.21",
|
||||
"mustache": "^4.2.0",
|
||||
"npm": "^10.8.2",
|
||||
"postcss": "8.4.31",
|
||||
"sass": "^1.77.8",
|
||||
"sortablejs": "^1.15.2",
|
||||
"svelte": "^4.2.18",
|
||||
"tinymce": "^6.8.4",
|
||||
"trix": "^2.1.5",
|
||||
"uuid": "^10.0.0",
|
||||
"vite": "5.2.6"
|
||||
}
|
||||
}
|
||||
@@ -1,5 +1,4 @@
|
||||
.autocomplete {
|
||||
position: relative;
|
||||
z-index: 1000;
|
||||
overflow: visible;
|
||||
.autocomplete-option {
|
||||
@@ -12,12 +11,10 @@
|
||||
}
|
||||
}
|
||||
&:focus-within {
|
||||
.autocomplete-results{
|
||||
.autocomplete-results {
|
||||
display: flex;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
.autocomplete-selected-value {
|
||||
font-size: 13px;
|
||||
|
||||
+10
-13
@@ -1,4 +1,4 @@
|
||||
.button{
|
||||
.button {
|
||||
border-radius: 12px;
|
||||
background: var(--p20);
|
||||
padding: 3px 10px;
|
||||
@@ -11,7 +11,6 @@
|
||||
gap: 4px;
|
||||
color: var(--text);
|
||||
|
||||
|
||||
&:focus {
|
||||
}
|
||||
|
||||
@@ -20,20 +19,20 @@
|
||||
}
|
||||
|
||||
&:active {
|
||||
background: var(--p50)!important;
|
||||
background: var(--p50) !important;
|
||||
box-shadow: none;
|
||||
}
|
||||
&.active {
|
||||
background: var(--p30);
|
||||
}
|
||||
|
||||
&.secondary{
|
||||
&.secondary {
|
||||
background: var(--p30);
|
||||
&:hover {
|
||||
background: var(--p40);
|
||||
}
|
||||
}
|
||||
&.primary{
|
||||
&.primary {
|
||||
background: var(--p70);
|
||||
color: var(--p10);
|
||||
|
||||
@@ -42,36 +41,34 @@
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
&[disabled] {
|
||||
pointer-events: none;
|
||||
opacity: .7;
|
||||
opacity: 0.7;
|
||||
color: var(--text);
|
||||
}
|
||||
}
|
||||
|
||||
.upload-button{
|
||||
.upload-button {
|
||||
padding: 0;
|
||||
border: none;
|
||||
|
||||
|
||||
label{
|
||||
label {
|
||||
margin: 0;
|
||||
font-size: 14px;
|
||||
line-height: 14px;
|
||||
font-weight: normal;
|
||||
background: var(--p80)!important;
|
||||
background: var(--p80) !important;
|
||||
color: var(--p10);
|
||||
}
|
||||
}
|
||||
|
||||
.button-text{
|
||||
.button-text {
|
||||
border: none;
|
||||
padding: 0;
|
||||
background: transparent;
|
||||
cursor: pointer;
|
||||
}
|
||||
|
||||
|
||||
.spinner-border {
|
||||
width: 12px;
|
||||
height: 12px;
|
||||
|
||||
Whitespace-only changes.
@@ -1,9 +0,0 @@
|
||||
|
||||
|
||||
<x-lucent::notice type="success" title="Success">
|
||||
<p>
|
||||
If you have provided a valid email you should receive in the following seconds a login email
|
||||
</p>
|
||||
|
||||
<p>You can safely close this tab</p>
|
||||
</x-lucent::notice>
|
||||
@@ -1,37 +0,0 @@
|
||||
@extends("lucent::layouts.account")
|
||||
|
||||
@section("content")
|
||||
<div class="scope-login">
|
||||
<div class="bg-image">
|
||||
|
||||
</div>
|
||||
<div class="login-form">
|
||||
<div class="form">
|
||||
<h2 class="mb-5">Enter Lucent</h2>
|
||||
|
||||
<form hx-post="{{url('lucent/login')}}" >
|
||||
@csrf
|
||||
<p>Submit your email address and you will receive a <b>login link</b> to your email</p>
|
||||
<p>Don't forget to check your spam folder</p>
|
||||
<div class="mt-5 mb-3">
|
||||
<label for="emailaddress" class="form-label">Email address</label>
|
||||
<input
|
||||
type="email"
|
||||
name="email"
|
||||
class="form-control"
|
||||
id="emailaddress"
|
||||
required
|
||||
/>
|
||||
</div>
|
||||
|
||||
|
||||
|
||||
<x-lucent::button-indicator>
|
||||
Send email
|
||||
</x-lucent::button-indicator>
|
||||
|
||||
</form>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
@endsection
|
||||
@@ -1,24 +0,0 @@
|
||||
@extends("lucent::layouts.account")
|
||||
|
||||
@section("content")
|
||||
<div class="scope-login">
|
||||
<div class="bg-image">
|
||||
|
||||
</div>
|
||||
<div class="login-form">
|
||||
<div class="form">
|
||||
<h2 class="mb-5">Welcome to Lucent</h2>
|
||||
|
||||
<form hx-post="{{url('lucent/verify')}}" hx-redirect="{{url('lucent')}}" hx-target-error=".form-errors" >
|
||||
<input type="hidden" value="{{$email}}" name="email" />
|
||||
<input type="hidden" value="{{$token}}" name="token" />
|
||||
@csrf
|
||||
<x-lucent::button-indicator>
|
||||
Enter as {{$email}}
|
||||
</x-lucent::button-indicator>
|
||||
</form>
|
||||
<div class="form-errors"></div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
@endsection
|
||||
@@ -1,43 +0,0 @@
|
||||
@php
|
||||
$side = $side ?? 48;
|
||||
|
||||
$colors = [
|
||||
"#00AA55",
|
||||
"#009FD4",
|
||||
"#B381B3",
|
||||
"#939393",
|
||||
"#E3BC00",
|
||||
"#D47500",
|
||||
"#DC2A2A",
|
||||
"#3ede91",
|
||||
"#377dd4",
|
||||
"#0256b0",
|
||||
"#053d82",
|
||||
"#3d026e",
|
||||
"#b378e3",
|
||||
"#c4065c",
|
||||
"#543208",
|
||||
"#d97811",
|
||||
"#0c6b40",
|
||||
];
|
||||
$initials = function($name){
|
||||
$segs = explode(" ",$name);
|
||||
if(count($segs) > 1){
|
||||
return strtoupper($segs[0][0]).strtoupper($segs[1][0]);
|
||||
}
|
||||
return strtoupper($segs[0][0]).strtoupper($segs[0][1]);
|
||||
};
|
||||
|
||||
$name = $user["name"];
|
||||
$charIndex = ord($name[1]) + strlen($name);
|
||||
$colorIndex = $charIndex % 19;
|
||||
$bgColor = $colors[$colorIndex];
|
||||
@endphp
|
||||
|
||||
<div
|
||||
class="avatar"
|
||||
title="{{$name}}"
|
||||
style="background-color:{{$bgColor}};height: {{$side}}px;width: {{$side}}px; font-size:{{$side / 2}}px"
|
||||
>
|
||||
<div class="avatar__letters">{{$initials($user["name"])}}</div>
|
||||
</div>
|
||||
@@ -1,4 +0,0 @@
|
||||
<button class="bt bt-primary">
|
||||
{{$slot}}
|
||||
<img alt="indicator" id="indicator" class="htmx-indicator" src="/img/spinner.svg"/>
|
||||
</button>
|
||||
@@ -1,4 +0,0 @@
|
||||
<div class="notice {{$type ?? "info"}}">
|
||||
<div class="title">{{$title}}</div>
|
||||
<div class="content">{{ $slot }}</div>
|
||||
</div>
|
||||
@@ -1,9 +0,0 @@
|
||||
@if (count($errors) > 0)
|
||||
<x-lucent::notice type="error" title="🛑 Submission failed">
|
||||
<ul>
|
||||
@foreach ($errors as $error)
|
||||
<li>{{ $error }}</li>
|
||||
@endforeach
|
||||
</ul>
|
||||
</x-lucent::notice>
|
||||
@endif
|
||||
@@ -1,23 +0,0 @@
|
||||
@extends("lucent::layouts.channel")
|
||||
|
||||
@section("content")
|
||||
<h3 class="header-small mb-4">Latest Content changes</h3>
|
||||
|
||||
|
||||
@if($records->isNotEmpty())
|
||||
<div class="lx-card mb-4">
|
||||
<div class="lx-table p-0">
|
||||
<table class="">
|
||||
<tbody>
|
||||
@foreach($records as $record)
|
||||
<tr>
|
||||
@include("lucent::records.card-row")
|
||||
</tr>
|
||||
@endforeach
|
||||
</tbody>
|
||||
</table>
|
||||
</div>
|
||||
</div>
|
||||
@endif
|
||||
|
||||
@endsection
|
||||
@@ -1,21 +0,0 @@
|
||||
<div class="d-flex align-items-center ">
|
||||
|
||||
<a class="nav-item" href="{channel.lucentUrl}/members">Members</a>
|
||||
|
||||
@if($channel->generateCommand)
|
||||
<a href="{channel.lucentUrl}/build-report" class="btn btn-outline-primary btn-sm d-">Build website</a>
|
||||
@endif
|
||||
|
||||
<!-- <div>-->
|
||||
<!-- <form method="GET">-->
|
||||
<!-- <input type="search" name="filter[search_regex]" placeholder="Search"-->
|
||||
<!-- class="form-control" required/>-->
|
||||
<!-- </form>-->
|
||||
<!-- </div>-->
|
||||
</div>
|
||||
<div>
|
||||
<a class="nav-item" href="/lucent/profile">
|
||||
<x-lucent::avatar side="28" :user="$user"></x-lucent::avatar>
|
||||
|
||||
</a>
|
||||
</div>
|
||||
@@ -1,34 +0,0 @@
|
||||
<!DOCTYPE html>
|
||||
<html lang="en">
|
||||
|
||||
<head>
|
||||
<meta charset="utf-8">
|
||||
<meta name="viewport" content="width=device-width, initial-scale=1">
|
||||
<meta name="csrf-token" content="{{ csrf_token() }}">
|
||||
<title>@yield('title') - Lucent Data Platform</title>
|
||||
|
||||
@if(config("lucent.env") === "production")
|
||||
<!-- if production -->
|
||||
<link rel="stylesheet" href="{{url('vendor/lucent/dist/'.$manifest['main.js']["css"][0])}}"/>
|
||||
<script type="module" src="{{url('vendor/lucent/dist/'.$manifest['main.js']["file"])}}"></script>
|
||||
@else
|
||||
<!-- if development -->
|
||||
@php
|
||||
echo '<script type="module" crossorigin src="http://127.0.0.1:5173/@vite/client"></script>';
|
||||
@endphp
|
||||
<script type="module" crossorigin src="http://127.0.0.1:5173/main.js"></script>
|
||||
@endif
|
||||
|
||||
|
||||
<link rel="icon" type="image/x-icon" href="{{url('favicon.ico')}}">
|
||||
|
||||
</head>
|
||||
|
||||
<body>
|
||||
<div>
|
||||
@yield('content')
|
||||
</div>
|
||||
|
||||
</body>
|
||||
|
||||
</html>
|
||||
@@ -1,31 +0,0 @@
|
||||
<!DOCTYPE html>
|
||||
<html lang="{{ str_replace('_', '-', app()->getLocale()) }}">
|
||||
|
||||
<head>
|
||||
<meta charset="utf-8">
|
||||
<meta name="viewport" content="width=device-width, initial-scale=1">
|
||||
<meta name="csrf-token" content="{{ csrf_token() }}">
|
||||
<title>@yield('title') - Lucent Data Platform</title>
|
||||
@if(config("lucent.env") == "production")
|
||||
<!-- if production -->
|
||||
<link rel="stylesheet" href="{{url('vendor/lucent/dist/'.$manifest['main.js']["css"][0])}}"/>
|
||||
<script type="module" src="{{url('vendor/lucent/dist/'.$manifest['main.js']["file"])}}"></script>
|
||||
@else
|
||||
<!-- if development -->
|
||||
@php
|
||||
echo '<script type="module" crossorigin src="http://127.0.0.1:5173/@vite/client"></script>';
|
||||
@endphp
|
||||
<script type="module" crossorigin src="http://127.0.0.1:5173/main.js"></script>
|
||||
@endif
|
||||
|
||||
|
||||
<link rel="icon" type="image/x-icon" href="{{url('favicon.ico')}}">
|
||||
|
||||
|
||||
</head>
|
||||
|
||||
<body>
|
||||
@yield('content')
|
||||
</body>
|
||||
|
||||
</html>
|
||||
@@ -1,33 +0,0 @@
|
||||
@php
|
||||
$schema = $schemas->where("name",$record->schema)->first();
|
||||
@endphp
|
||||
<td>
|
||||
@if($schema->type === "files")
|
||||
<Preview {record} size="tiny"/>
|
||||
@else
|
||||
<a
|
||||
href="/lucent/records/{{$record->id}}"
|
||||
class="text-decoration-none text-dark d-block"
|
||||
>
|
||||
{{$viewModel->getRecordName($record, $schemas)}}
|
||||
</a>
|
||||
|
||||
{{$record->status->value === "draft" ? "Draft" : ""}}
|
||||
@endif
|
||||
|
||||
</td>
|
||||
<td><a
|
||||
class="text-decoration-none lx-small-text"
|
||||
href="/lucent/content/{{$schema->name}}">{{$schema->label}}</a
|
||||
>
|
||||
</td>
|
||||
|
||||
|
||||
<td>
|
||||
{{-- <div class="d-flex">--}}
|
||||
{{-- <Avatar name={usernameById(users, record._sys.updatedBy)} side={24}/>--}}
|
||||
{{-- <div class="ms-2">--}}
|
||||
{{-- {frieldlyUpdatedAt}--}}
|
||||
{{-- </div>--}}
|
||||
{{-- </div>--}}
|
||||
</td>
|
||||
@@ -1,7 +0,0 @@
|
||||
@php
|
||||
$currentSchema = $currentSchema ?? null;
|
||||
$activeClass = $schema->name === $currentSchema?->name ? "active" : "";
|
||||
@endphp
|
||||
|
||||
<a class="sidebar-item {{$activeClass}}" aria-current="page"
|
||||
href="/lucent/content/{{$schema->name}}">{{$schema->label}}</a>
|
||||
@@ -1,22 +0,0 @@
|
||||
<a class="nav-item" href="/lucent">{{$channel->name}}</a>
|
||||
<div class="sidebar">
|
||||
|
||||
<div class="sidebar-header">
|
||||
Content
|
||||
</div>
|
||||
@foreach($schemas->where("type.value", "collection")->where("isEntry",true) as $schema)
|
||||
@include("lucent::sidebar.sidebar-item", ["schema" => $schema])
|
||||
@endforeach
|
||||
<div class="sidebar-header">
|
||||
Files
|
||||
</div>
|
||||
@foreach($schemas->where("type.value", "files") as $schema)
|
||||
@include("lucent::sidebar.sidebar-item", ["schema" => $schema])
|
||||
@endforeach
|
||||
<div class="sidebar-header">
|
||||
Other
|
||||
</div>
|
||||
@foreach($schemas->where("type.value", "collection")->where("isEntry",false) as $schema)
|
||||
@include("lucent::sidebar.sidebar-item", ["schema" => $schema])
|
||||
@endforeach
|
||||
</div>
|
||||
@@ -1,7 +1,33 @@
|
||||
@extends('lucent::layouts.'.$layout)
|
||||
@section('title')
|
||||
{{ $title }}
|
||||
@endsection
|
||||
@section('content')
|
||||
<!DOCTYPE html>
|
||||
<html lang="en">
|
||||
|
||||
<head>
|
||||
<meta charset="utf-8">
|
||||
<meta name="viewport" content="width=device-width, initial-scale=1">
|
||||
<meta name="csrf-token" content="{{ csrf_token() }}">
|
||||
<title> {{ $title }} - Lucent Data Platform</title>
|
||||
@if(config("lucent.env") === "production")
|
||||
<!-- if production -->
|
||||
<link rel="stylesheet" href="{{url('vendor/lucent/dist/'.$manifest['main.js']["css"][0])}}"/>
|
||||
<script type="module" src="{{url('vendor/lucent/dist/'.$manifest['main.js']["file"])}}"></script>
|
||||
@else
|
||||
<!-- if development -->
|
||||
@php
|
||||
echo '<script type="module" crossorigin src="http://127.0.0.1:5173/@vite/client"></script>';
|
||||
@endphp
|
||||
<script type="module" crossorigin src="http://127.0.0.1:5173/main.js"></script>
|
||||
@endif
|
||||
|
||||
|
||||
<link rel="icon" type="image/x-icon" href="{{url('favicon.ico')}}">
|
||||
|
||||
</head>
|
||||
|
||||
<body>
|
||||
<div>
|
||||
{!! $svelte !!}
|
||||
@endsection
|
||||
</div>
|
||||
|
||||
</body>
|
||||
|
||||
</html>
|
||||
Generated
+6
@@ -0,0 +1,6 @@
|
||||
{
|
||||
"name": "lucent-laravel",
|
||||
"lockfileVersion": 3,
|
||||
"requires": true,
|
||||
"packages": {}
|
||||
}
|
||||
@@ -7,15 +7,11 @@ use Lucent\Primitive\Collection;
|
||||
|
||||
readonly class AccountService
|
||||
{
|
||||
|
||||
public function __construct(
|
||||
private AuthService $authService,
|
||||
private ChannelService $channelService,
|
||||
private UserRepo $userRepo,
|
||||
)
|
||||
{
|
||||
|
||||
}
|
||||
) {}
|
||||
|
||||
/**
|
||||
* @return Collection<User>
|
||||
@@ -25,13 +21,11 @@ readonly class AccountService
|
||||
return $this->userRepo->all();
|
||||
}
|
||||
|
||||
|
||||
public function countUsers(): int
|
||||
{
|
||||
return $this->userRepo->count();
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* @return Collection<UserProfile>
|
||||
*/
|
||||
@@ -54,6 +48,4 @@ readonly class AccountService
|
||||
$roles = $this->authService->currentUserRoles();
|
||||
return $this->channelService->schemasWritableByRoles($roles);
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
Loaded 100 of 182 files, more files were not shown because too many files have changed in this diff.
Show more
Reference in new issue
Block a user