Compare commits
46
Commits
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
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 | ||
|
|
f0d4686141 | ||
|
|
a482ab3c7e | ||
|
|
c580882ec0 | ||
|
|
2cf8379cbe | ||
|
|
c39ec469df | ||
|
|
232fcc8845 | ||
|
|
9d5d4dd930 | ||
|
|
c507dc6031 |
No files matched your search
@@ -6,3 +6,4 @@ front/node_modules
|
|||||||
front/npm-debug.log
|
front/npm-debug.log
|
||||||
/.idea
|
/.idea
|
||||||
/.vscode
|
/.vscode
|
||||||
|
/.claude
|
||||||
@@ -0,0 +1,4 @@
|
|||||||
|
{
|
||||||
|
"$schema": "/phpactor.schema.json",
|
||||||
|
"language_server_phpstan.enabled": false
|
||||||
|
}
|
||||||
+32
@@ -0,0 +1,32 @@
|
|||||||
|
# Upgrade from 1.1.* to 1.2.0
|
||||||
|
|
||||||
|
## lucent.php config file
|
||||||
|
|
||||||
|
There is now an array of commands, accepting more than one.
|
||||||
|
|
||||||
|
from
|
||||||
|
```php
|
||||||
|
"generateCommand" => env("LUCENT_GENERATE_COMMAND", "generate:static"),
|
||||||
|
```
|
||||||
|
|
||||||
|
to
|
||||||
|
```php
|
||||||
|
"commands" => [
|
||||||
|
"generate:static" => "Build Website",
|
||||||
|
],
|
||||||
|
```
|
||||||
|
## config/filesystems.php
|
||||||
|
|
||||||
|
Lucent has its own filesystem.
|
||||||
|
|
||||||
|
You should now add:
|
||||||
|
|
||||||
|
```
|
||||||
|
'lucent' => [
|
||||||
|
'driver' => 'local',
|
||||||
|
'root' => storage_path('app/public'),
|
||||||
|
'url' => env('APP_URL').'/storage',
|
||||||
|
'visibility' => 'public',
|
||||||
|
'throw' => false,
|
||||||
|
],
|
||||||
|
```
|
||||||
+5
-8
@@ -6,19 +6,17 @@
|
|||||||
"require": {
|
"require": {
|
||||||
"ext-xml": "*",
|
"ext-xml": "*",
|
||||||
"ext-zip": "*",
|
"ext-zip": "*",
|
||||||
"ext-sqlite3": "*",
|
|
||||||
"ext-imagick": "*",
|
"ext-imagick": "*",
|
||||||
"ext-pdo": "*",
|
"ext-pdo": "*",
|
||||||
"php": "^8.3",
|
"php": "^8.4",
|
||||||
|
"intervention/image": "^2.7",
|
||||||
"phpoption/phpoption": "^1.9",
|
"phpoption/phpoption": "^1.9",
|
||||||
"spatie/image-optimizer": "^1.6",
|
"spatie/image-optimizer": "^1.6",
|
||||||
"staudenmeir/laravel-cte": "^1.10",
|
"staudenmeir/laravel-cte": "^1.0"
|
||||||
"intervention/image": "^3.8",
|
|
||||||
"guzzlehttp/guzzle": "^7.9"
|
|
||||||
},
|
},
|
||||||
"require-dev": {
|
"require-dev": {
|
||||||
"laravel/framework": "^10.48",
|
"phpstan/phpstan": "^1.8",
|
||||||
"phpstan/phpstan": "^1.12"
|
"laravel/framework": "^10.10"
|
||||||
},
|
},
|
||||||
"autoload": {
|
"autoload": {
|
||||||
"psr-4": {
|
"psr-4": {
|
||||||
@@ -38,5 +36,4 @@
|
|||||||
},
|
},
|
||||||
"minimum-stability": "stable",
|
"minimum-stability": "stable",
|
||||||
"prefer-stable": true
|
"prefer-stable": true
|
||||||
|
|
||||||
}
|
}
|
||||||
Generated
+631
-916
File diff suppressed because it is too large.
Load diff
@@ -1,24 +0,0 @@
|
|||||||
<?php
|
|
||||||
|
|
||||||
return [
|
|
||||||
"env" => env("LUCENT_ENV", "production"),
|
|
||||||
"schemas_path" => env("LUCENT_SCHEMAS_PATH", "resources/lucent/schemas"),
|
|
||||||
"image_filters_path" => "app/Filters",
|
|
||||||
"database" => env('LUCENT_DB_CONNECTION', env('DB_CONNECTION', "sqlite")),
|
|
||||||
"name" => env("LUCENT_NAME", "Stoic"),
|
|
||||||
"url" => env("LUCENT_URL", env('APP_URL')),
|
|
||||||
"preview_target" => env("LUCENT_PREVIEW_TARGET", "previewTarget"),
|
|
||||||
/*
|
|
||||||
* Make available laravel artisan commands for admin users
|
|
||||||
* example:
|
|
||||||
* [
|
|
||||||
* "command1:signature" => "Description 1"
|
|
||||||
* "command2:signature" => "Description 2"
|
|
||||||
* ]
|
|
||||||
*
|
|
||||||
* */
|
|
||||||
"commands" => [],
|
|
||||||
"can_invite" => ["admin"],
|
|
||||||
"can_run_commands" => ["admin"],
|
|
||||||
"system_user_id" => ""
|
|
||||||
];
|
|
||||||
+145
-298
@@ -5,374 +5,221 @@ include_toc: true
|
|||||||
|
|
||||||
# Fields
|
# 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
|
### text
|
||||||
One-line text input
|
|
||||||
|
|
||||||
required
|
One-line text input.
|
||||||
|
|
||||||
- **name**: The id of the field
|
**Required:** `name`, `label`
|
||||||
- **label**: The friendly name of the field
|
|
||||||
|
|
||||||
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
|
||||||
textarea input
|
|
||||||
|
|
||||||
required
|
Multi-line text input.
|
||||||
|
|
||||||
- **name**: The id of the field
|
**Required:** `name`, `label`
|
||||||
- **label**: The friendly name of the field
|
|
||||||
|
|
||||||
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
|
||||||
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
|
**Required:** `name`, `label`, `source`
|
||||||
- **label**: The friendly name of the field
|
|
||||||
- **source**: The source field from which it generates
|
|
||||||
|
|
||||||
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
|
### rich
|
||||||
WYSIWYG editor
|
|
||||||
|
|
||||||
required
|
WYSIWYG rich text editor.
|
||||||
|
|
||||||
- **name**: The id of the field
|
**Required:** `name`, `label`
|
||||||
- **label**: The friendly name of the field
|
|
||||||
|
|
||||||
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
|
### markdown
|
||||||
- **max**: Maximum characters
|
|
||||||
- **help**: Help text
|
Markdown editor.
|
||||||
- **default**: Default value when creating new record
|
|
||||||
- **readonly**: Cannot edit this value from the UI
|
**Required:** `name`, `label`
|
||||||
- **group**: The group that this field belongs to
|
|
||||||
|
| Property | Description |
|
||||||
|
|---|---|
|
||||||
|
| `min` | Minimum character count |
|
||||||
|
| `max` | Maximum character count |
|
||||||
|
|
||||||
|
---
|
||||||
|
|
||||||
### number
|
### number
|
||||||
Any numeric value
|
|
||||||
|
|
||||||
required
|
Numeric input.
|
||||||
|
|
||||||
- **name**: The id of the field
|
**Required:** `name`, `label`
|
||||||
- **label**: The friendly name of the field
|
|
||||||
|
|
||||||
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
|
### checkbox
|
||||||
True or false
|
|
||||||
|
|
||||||
required
|
Boolean true/false toggle.
|
||||||
|
|
||||||
- **name**: The id of the field
|
**Required:** `name`, `label`
|
||||||
- **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
|
|
||||||
- **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
|
||||||
Color picker
|
|
||||||
|
|
||||||
required
|
Color picker.
|
||||||
|
|
||||||
- **name**: The id of the field
|
**Required:** `name`, `label`
|
||||||
- **label**: The friendly name of the field
|
|
||||||
|
|
||||||
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
|
||||||
Date select
|
|
||||||
|
|
||||||
required
|
Date selector. Stores as a date string.
|
||||||
|
|
||||||
- **name**: The id of the field
|
**Required:** `name`, `label`
|
||||||
- **label**: The friendly name of the field
|
|
||||||
|
|
||||||
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
|
### datetime
|
||||||
Date and time selector
|
|
||||||
|
|
||||||
required
|
Date and time selector. Stores as an ISO 8601 string.
|
||||||
|
|
||||||
- **name**: The id of the field
|
**Required:** `name`, `label`
|
||||||
- **label**: The friendly name of the field
|
|
||||||
|
|
||||||
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
|
### uuid
|
||||||
- **max**: Maximum date
|
|
||||||
- **help**: Help text
|
UUID text field. Stores an arbitrary UUID string. Typically used as a read-only external reference ID.
|
||||||
- **default**: Default value when creating new record
|
|
||||||
- **readonly**: Cannot edit this value from the UI
|
**Required:** `name`, `label`
|
||||||
- **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
|
|
||||||
|
|
||||||
### json
|
### 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
|
**Required:** `name`, `label`
|
||||||
- **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
|
|
||||||
- **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
|
### 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
|
**Required:** `name`, `label`, `collections`
|
||||||
- **label**: The friendly name of the field
|
|
||||||
- **collections**: File collections to choose from
|
|
||||||
|
|
||||||
optional
|
| Property | Description |
|
||||||
|
|---|---|
|
||||||
- **mime**: The mime types allowed to select
|
| `collections` | Array of file schema names to choose from |
|
||||||
- **nullable**: Can the field be saved as null
|
| `mime` | Allowed MIME types e.g. `["image/*"]` |
|
||||||
- **min**: Minimum files
|
| `min` | Minimum number of files |
|
||||||
- **max**: Maximum files
|
| `max` | Maximum number of files |
|
||||||
- **help**: Help text
|
|
||||||
- **group**: The group that this field belongs to
|
|
||||||
|
|
||||||
|
---
|
||||||
|
|
||||||
### reference
|
### reference
|
||||||
Reference other records
|
|
||||||
|
|
||||||
required
|
Reference records from another collection.
|
||||||
|
|
||||||
- **name**: The id of the field
|
**Required:** `name`, `label`, `collections`
|
||||||
- **label**: The friendly name of the field
|
|
||||||
- **collections**: Collections to choose from
|
|
||||||
|
|
||||||
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
|
```json
|
||||||
The block editor
|
{
|
||||||
|
"ui": "text",
|
||||||
required
|
"name": "title",
|
||||||
|
"label": "Title",
|
||||||
- **name**: The id of the field
|
"required": true,
|
||||||
- **label**: The friendly name of the field
|
"min": 3,
|
||||||
- **schema**: The block schema name
|
"max": 200,
|
||||||
|
"help": "The main title of the post"
|
||||||
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
|
|
||||||
+133
-52
@@ -5,88 +5,169 @@ include_toc: true
|
|||||||
|
|
||||||
# Queries
|
# Queries
|
||||||
|
|
||||||
## Graph or Tree
|
The `Query` class is the main way to fetch records. Inject it via the Laravel container.
|
||||||
|
|
||||||
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:
|
|
||||||
|
|
||||||
```php
|
```php
|
||||||
$query->childrenDepth(2);
|
public function __construct(private Query $query) {}
|
||||||
```
|
```
|
||||||
Maybe you only want to get a specific type of relationship:
|
|
||||||
|
|
||||||
```php
|
## Return Formats
|
||||||
$query->childrenDepth(2)->childrenFields(["categories"]);
|
|
||||||
```
|
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
|
## 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
|
```php
|
||||||
$query->filter(["field_operator" => "value"]);
|
$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
|
```php
|
||||||
$query
|
$query
|
||||||
->filter(["price_eqn" => 10])
|
->filter(["schema" => "blogPosts"])
|
||||||
->orFilter(["title_regex" => "search", "slug_regex" => "search"])
|
->orFilter(["title_regex" => "search", "slug_regex" => "search"]);
|
||||||
;
|
|
||||||
```
|
```
|
||||||
## Operator List
|
|
||||||
|
|
||||||
- regex
|
Each `orFilter` call groups its arguments with OR between them. Multiple `orFilter` / `filter` calls are AND-ed together.
|
||||||
- eq
|
|
||||||
- ne
|
|
||||||
- eqnum
|
|
||||||
- neqnum
|
|
||||||
- filter
|
|
||||||
- eqtrue
|
|
||||||
- eqfalse
|
|
||||||
- netrue
|
|
||||||
- nefalse
|
|
||||||
- in:
|
|
||||||
- innum
|
|
||||||
- nin
|
|
||||||
- ninnum
|
|
||||||
- lt
|
|
||||||
- lte
|
|
||||||
- gt
|
|
||||||
- gte
|
|
||||||
- null
|
|
||||||
- nnull
|
|
||||||
- exists
|
|
||||||
- nexists
|
|
||||||
|
|
||||||
## 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
|
```php
|
||||||
$posts = $query
|
$posts = $query
|
||||||
->filter([
|
->filter([
|
||||||
"schema" => "posts",
|
"schema" => "blogPosts",
|
||||||
"children.categories.data.slug" => "sports",
|
"children.categories.data.slug" => "sports",
|
||||||
]
|
])
|
||||||
)
|
|
||||||
->childrenDepth(1)
|
->childrenDepth(1)
|
||||||
|
->childrenFields(["categories"])
|
||||||
->limit(10)
|
->limit(10)
|
||||||
->tree();
|
->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
|
||||||
|
|
||||||
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
|
- **collection** — Regular data records
|
||||||
- Files: Images and files
|
- **files** — Images and file uploads
|
||||||
- Block: Used in the block editor
|
|
||||||
|
|
||||||
|
|
||||||
## Collection Reference
|
## Collection Reference
|
||||||
|
|
||||||
- **name**: The ID of the collection. Camelcase and plural is the recommended format ex. blogPosts
|
| Field | Required | Description |
|
||||||
- **label**: The friendly name of the schema
|
|---|---|---|
|
||||||
- **type**: The type of the collection. Should be "collection"
|
| `name` | yes | Unique ID. Use camelCase plural e.g. `blogPosts` |
|
||||||
- **visible**: An array of field id to show on the content browser _optional_
|
| `label` | yes | Friendly display name |
|
||||||
- **groups**: A list if group ids to separate your field in different tabs _optional_
|
| `type` | yes | Must be `"collection"` |
|
||||||
- **fields**: The list of your fields. Look the field reference for more
|
| `fields` | yes | Array of field definitions. See [Fields](Fields.md) |
|
||||||
- **isEntry**: If this schema is important, it will show be visible on the main the sidebar. Default: false _optional_
|
| `visible` | no | Field IDs to show in the content browser list |
|
||||||
- **sortBy**: The default sorting in the content browser _optional_
|
| `groups` | no | Group IDs to split fields into tabs |
|
||||||
- **cardTitle**: Mustache code to customize the preview field _optional_
|
| `isEntry` | no | Show in sidebar. Default: `false` |
|
||||||
- **cardImage**: Field name of image you want to use as a preview image _optional_
|
| `sortBy` | no | Default sort in browser. Prefix with `-` for descending e.g. `-_sys.updatedAt` |
|
||||||
- **revisions**: How many revisions are going to be kept for each record _optional_
|
| `cardTitle` | no | Mustache template for the record preview title e.g. `{{name}} - {{slug}}` |
|
||||||
- **read**: Array of user groups that have read permissions _optional_
|
| `cardImage` | no | Field name to use as the preview image |
|
||||||
- **write**: Array of user groups that have write permissions _optional_
|
| `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
|
## Files Reference
|
||||||
|
|
||||||
- **name**: The ID of the collection. Camelcase and plural is the recommended format ex. blogPosts
|
| Field | Required | Description |
|
||||||
- **label**: The friendly name of the schema
|
|---|---|---|
|
||||||
- **type**: The type of the collection. Should be "files"
|
| `name` | yes | Unique ID. Use camelCase plural e.g. `heroImages` |
|
||||||
- **path**: The relative directory that these files will be stored.
|
| `label` | yes | Friendly display name |
|
||||||
- **groups**: A list if group ids to separate your field in different tabs _optional_
|
| `type` | yes | Must be `"files"` |
|
||||||
- **fields**: The list of your fields. Look the field reference for more
|
| `fields` | yes | Array of field definitions. See [Fields](Fields.md) |
|
||||||
- **isEntry**: If this schema is important, it will show be visible on the main the sidebar _optional_
|
| `groups` | no | Group IDs to split fields into tabs |
|
||||||
- **sortBy**: The default sorting in the content browser _optional_
|
| `isEntry` | no | Show in sidebar. Default: `false` |
|
||||||
- **cardTitle**: Mustache code to customize the preview field _optional_
|
| `sortBy` | no | Default sort in browser |
|
||||||
- **revisions**: How many revisions are going to be kept for each record _optional_
|
| `cardTitle` | no | Mustache template for the record preview title |
|
||||||
- **read**: Array of user groups that have read permissions _optional_
|
| `cardImage` | no | Field name to use as the preview image |
|
||||||
- **write**: Array of user groups that have write permissions _optional_
|
| `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
|
```json
|
||||||
{
|
{
|
||||||
"label": "Departments",
|
"schemas": [
|
||||||
"name": "departments",
|
{
|
||||||
|
"label": "Blog Posts",
|
||||||
|
"name": "blogPosts",
|
||||||
"isEntry": true,
|
"isEntry": true,
|
||||||
"type": "collection",
|
"type": "collection",
|
||||||
"visible": [
|
"visible": [
|
||||||
|
"title",
|
||||||
"slug",
|
"slug",
|
||||||
"cover",
|
|
||||||
"_sys.updatedAt",
|
"_sys.updatedAt",
|
||||||
"status"
|
"status"
|
||||||
],
|
],
|
||||||
"groups": [
|
"groups": [
|
||||||
"Extra Info",
|
"Content",
|
||||||
"Metadata",
|
|
||||||
"SEO"
|
"SEO"
|
||||||
],
|
],
|
||||||
"sortBy": "-_sys.createdAt",
|
"sortBy": "-_sys.createdAt",
|
||||||
"schemaTitle": "{{name}} {{slug}}",
|
"cardTitle": "{{title}}",
|
||||||
"schemaImage": "cover",
|
"cardImage": "cover",
|
||||||
"revisions": 15,
|
"revisions": 15,
|
||||||
"read": [
|
"read": [
|
||||||
"admin",
|
"admin",
|
||||||
@@ -81,4 +117,7 @@ A full Collection example without the fields:
|
|||||||
],
|
],
|
||||||
"fields": []
|
"fields": []
|
||||||
}
|
}
|
||||||
|
],
|
||||||
|
"roles": ["admin", "editors", "reviewers"]
|
||||||
|
}
|
||||||
```
|
```
|
||||||
+87
-28
@@ -5,51 +5,94 @@ To generate the static content of the website, lucent provides a helper class.
|
|||||||
|
|
||||||
## Laravel Command
|
## 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
|
```php
|
||||||
|
class GenerateStatic extends Command
|
||||||
|
{
|
||||||
|
protected $signature = 'generate:static';
|
||||||
|
|
||||||
public function __construct(
|
public function __construct(
|
||||||
public StaticGenerator $staticGenerator,
|
public StaticGenerator $staticGenerator,
|
||||||
|
public Context $ctx,
|
||||||
) {
|
) {
|
||||||
parent::__construct();
|
parent::__construct();
|
||||||
}
|
}
|
||||||
```
|
|
||||||
|
|
||||||
## Redirect command
|
public function handle(): void
|
||||||
|
{
|
||||||
There are cases which is useful to create a redirect like when you have a multilingual website:
|
$this->staticGenerator->run('generate:static', function ($writer) {
|
||||||
|
|
||||||
```php
|
|
||||||
$this->staticGenerator->run(function ($writer) {
|
|
||||||
$writer->createRedirect("/", "/el");
|
|
||||||
});
|
|
||||||
```
|
|
||||||
|
|
||||||
## The Writer save command
|
|
||||||
|
|
||||||
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.
|
|
||||||
|
|
||||||
```php
|
|
||||||
$this->staticGenerator->run(function ($writer) {
|
|
||||||
$writer->save("/", $this->ctx->render("homepage"));
|
$writer->save("/", $this->ctx->render("homepage"));
|
||||||
$writer->save("/about", $this->ctx->render("about"));
|
$writer->save("/about", $this->ctx->render("about"));
|
||||||
});
|
});
|
||||||
|
}
|
||||||
|
}
|
||||||
```
|
```
|
||||||
|
|
||||||
|
`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.
|
||||||
|
|
||||||
|
|
||||||
|
## Writer: save
|
||||||
|
|
||||||
|
Writes an HTML file at the given path:
|
||||||
|
|
||||||
|
```php
|
||||||
|
$writer->save("/blog/my-post", $html);
|
||||||
|
// writes to: storage/lucent/build/blog/my-post/index.html
|
||||||
|
```
|
||||||
|
|
||||||
|
An optional third argument changes the file extension (default `"html"`).
|
||||||
|
|
||||||
|
|
||||||
|
## Writer: createRedirect
|
||||||
|
|
||||||
|
Generates an HTML meta-refresh redirect. Useful for root-level locale redirects:
|
||||||
|
|
||||||
|
```php
|
||||||
|
$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
|
## Storage and Permissions
|
||||||
|
|
||||||
All the generated html is stored on `storage/lucent/live`
|
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:
|
||||||
In order to make it accessible you have to create symlink:
|
|
||||||
|
|
||||||
```bash
|
```bash
|
||||||
php artisan lucent:livelink
|
php artisan lucent:livelink
|
||||||
```
|
```
|
||||||
|
|
||||||
Now your static website is accessible in http://localhost:8000/live
|
The static site is then accessible at `http://localhost:8000/live`. To serve it without the `/live` prefix, add this to your nginx vhost:
|
||||||
|
|
||||||
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
|
|
||||||
|
|
||||||
```nginxconf
|
```nginxconf
|
||||||
location / {
|
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
|
## 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
|
```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.
|
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`.
|
||||||
Whitespace-only changes.
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
-225
@@ -1,225 +0,0 @@
|
|||||||
var Lo=Object.defineProperty;var Io=(_n,ke,Ce)=>ke in _n?Lo(_n,ke,{enumerable:!0,configurable:!0,writable:!0,value:Ce}):_n[ke]=Ce;var co=(_n,ke,Ce)=>Io(_n,typeof ke!="symbol"?ke+"":ke,Ce);function bind$1(_n,ke){return function(){return _n.apply(ke,arguments)}}const{toString:toString$1}=Object.prototype,{getPrototypeOf}=Object,kindOf=(_n=>ke=>{const Ce=toString$1.call(ke);return _n[Ce]||(_n[Ce]=Ce.slice(8,-1).toLowerCase())})(Object.create(null)),kindOfTest=_n=>(_n=_n.toLowerCase(),ke=>kindOf(ke)===_n),typeOfTest=_n=>ke=>typeof ke===_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 ke;return typeof ArrayBuffer<"u"&&ArrayBuffer.isView?ke=ArrayBuffer.isView(_n):ke=_n&&_n.buffer&&isArrayBuffer(_n.buffer),ke}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 ke=getPrototypeOf(_n);return(ke===null||ke===Object.prototype||Object.getPrototypeOf(ke)===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 ke;return _n&&(typeof FormData=="function"&&_n instanceof FormData||isFunction$1(_n.append)&&((ke=kindOf(_n))==="formdata"||ke==="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,ke,{allOwnKeys:Ce=!1}={}){if(_n===null||typeof _n>"u")return;let $n,Mn;if(typeof _n!="object"&&(_n=[_n]),isArray$2(_n))for($n=0,Mn=_n.length;$n<Mn;$n++)ke.call(null,_n[$n],$n,_n);else{const Qn=Ce?Object.getOwnPropertyNames(_n):Object.keys(_n),Vn=Qn.length;let qn;for($n=0;$n<Vn;$n++)qn=Qn[$n],ke.call(null,_n[qn],qn,_n)}}function findKey$1(_n,ke){ke=ke.toLowerCase();const Ce=Object.keys(_n);let $n=Ce.length,Mn;for(;$n-- >0;)if(Mn=Ce[$n],ke===Mn.toLowerCase())return Mn;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||{},ke={},Ce=($n,Mn)=>{const Qn=_n&&findKey$1(ke,Mn)||Mn;isPlainObject(ke[Qn])&&isPlainObject($n)?ke[Qn]=merge(ke[Qn],$n):isPlainObject($n)?ke[Qn]=merge({},$n):isArray$2($n)?ke[Qn]=$n.slice():ke[Qn]=$n};for(let $n=0,Mn=arguments.length;$n<Mn;$n++)arguments[$n]&&forEach(arguments[$n],Ce);return ke}const extend$2=(_n,ke,Ce,{allOwnKeys:$n}={})=>(forEach(ke,(Mn,Qn)=>{Ce&&isFunction$1(Mn)?_n[Qn]=bind$1(Mn,Ce):_n[Qn]=Mn},{allOwnKeys:$n}),_n),stripBOM=_n=>(_n.charCodeAt(0)===65279&&(_n=_n.slice(1)),_n),inherits=(_n,ke,Ce,$n)=>{_n.prototype=Object.create(ke.prototype,$n),_n.prototype.constructor=_n,Object.defineProperty(_n,"super",{value:ke.prototype}),Ce&&Object.assign(_n.prototype,Ce)},toFlatObject=(_n,ke,Ce,$n)=>{let Mn,Qn,Vn;const qn={};if(ke=ke||{},_n==null)return ke;do{for(Mn=Object.getOwnPropertyNames(_n),Qn=Mn.length;Qn-- >0;)Vn=Mn[Qn],(!$n||$n(Vn,_n,ke))&&!qn[Vn]&&(ke[Vn]=_n[Vn],qn[Vn]=!0);_n=Ce!==!1&&getPrototypeOf(_n)}while(_n&&(!Ce||Ce(_n,ke))&&_n!==Object.prototype);return ke},endsWith=(_n,ke,Ce)=>{_n=String(_n),(Ce===void 0||Ce>_n.length)&&(Ce=_n.length),Ce-=ke.length;const $n=_n.indexOf(ke,Ce);return $n!==-1&&$n===Ce},toArray=_n=>{if(!_n)return null;if(isArray$2(_n))return _n;let ke=_n.length;if(!isNumber$1(ke))return null;const Ce=new Array(ke);for(;ke-- >0;)Ce[ke]=_n[ke];return Ce},isTypedArray=(_n=>ke=>_n&&ke instanceof _n)(typeof Uint8Array<"u"&&getPrototypeOf(Uint8Array)),forEachEntry=(_n,ke)=>{const $n=(_n&&_n[Symbol.iterator]).call(_n);let Mn;for(;(Mn=$n.next())&&!Mn.done;){const Qn=Mn.value;ke.call(_n,Qn[0],Qn[1])}},matchAll=(_n,ke)=>{let Ce;const $n=[];for(;(Ce=_n.exec(ke))!==null;)$n.push(Ce);return $n},isHTMLForm=kindOfTest("HTMLFormElement"),toCamelCase=_n=>_n.toLowerCase().replace(/[-_\s]([a-z\d])(\w*)/g,function(Ce,$n,Mn){return $n.toUpperCase()+Mn}),hasOwnProperty=(({hasOwnProperty:_n})=>(ke,Ce)=>_n.call(ke,Ce))(Object.prototype),isRegExp=kindOfTest("RegExp"),reduceDescriptors=(_n,ke)=>{const Ce=Object.getOwnPropertyDescriptors(_n),$n={};forEach(Ce,(Mn,Qn)=>{let Vn;(Vn=ke(Mn,Qn,_n))!==!1&&($n[Qn]=Vn||Mn)}),Object.defineProperties(_n,$n)},freezeMethods=_n=>{reduceDescriptors(_n,(ke,Ce)=>{if(isFunction$1(_n)&&["arguments","caller","callee"].indexOf(Ce)!==-1)return!1;const $n=_n[Ce];if(isFunction$1($n)){Line truncated
|
|
||||||
`).forEach(function(Vn){Mn=Vn.indexOf(":"),Ce=Vn.substring(0,Mn).trim().toLowerCase(),$n=Vn.substring(Mn+1).trim(),!(!Ce||ke[Ce]&&ignoreDuplicateOf[Ce])&&(Ce==="set-cookie"?ke[Ce]?ke[Ce].push($n):ke[Ce]=[$n]:ke[Ce]=ke[Ce]?ke[Ce]+", "+$n:$n)}),ke},$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 ke=Object.create(null),Ce=/([^\s,;=]+)\s*(?:=\s*([^,;]+))?/g;let $n;for(;$n=Ce.exec(_n);)ke[$n[1]]=$n[2];return ke}const isValidHeaderName=_n=>/^[-_a-zA-Z0-9^`|~,!#$%&'*+.]+$/.test(_n.trim());function matchHeaderValue(_n,ke,Ce,$n,Mn){if(utils$1.isFunction($n))return $n.call(this,ke,Ce);if(Mn&&(ke=Ce),!!utils$1.isString(ke)){if(utils$1.isString($n))return ke.indexOf($n)!==-1;if(utils$1.isRegExp($n))return $n.test(ke)}}function formatHeader(_n){return _n.trim().toLowerCase().replace(/([a-z\d])(\w*)/g,(ke,Ce,$n)=>Ce.toUpperCase()+$n)}function buildAccessors(_n,ke){const Ce=utils$1.toCamelCase(" "+ke);["get","set","has"].forEach($n=>{Object.defineProperty(_n,$n+Ce,{value:function(Mn,Qn,Vn){return this[$n].call(this,ke,Mn,Qn,Vn)},configurable:!0})})}class AxiosHeaders{constructor(ke){ke&&this.set(ke)}set(ke,Ce,$n){const Mn=this;function Qn(qn,Zn,jn){const Xn=normalizeHeader(Zn);if(!Xn)throw new Error("header name must be a non-empty string");const zn=utils$1.findKey(Mn,Xn);(!zn||Mn[zn]===void 0||jn===!0||jn===void 0&&Mn[zn]!==!1)&&(Mn[zn||Zn]=normalizeValue(qn))}const Vn=(qn,Zn)=>utils$1.forEach(qn,(jn,Xn)=>Qn(jn,Xn,Zn));if(utils$1.isPlainObject(ke)||ke instanceof this.constructor)Vn(ke,Ce);else if(utils$1.isString(ke)&&(ke=ke.trim())&&!isValidHeaderName(ke))Vn(parseHeaders(ke),Ce);else if(utils$1.isHeaders(ke))for(const[qn,Zn]of ke.entries())Qn(Zn,qn,$n);else ke!=null&&Qn(Ce,ke,$n);return this}get(ke,Ce){if(ke=normalizeHeader(ke),ke){const $n=utils$1.findKey(this,ke);if($n){const Mn=this[$n];if(!Ce)return Mn;if(Ce===!0)return parseTokens(Mn);if(utils$1.isFunction(Ce))return Ce.call(this,Mn,$n);if(utils$1.isRegExp(Ce))return Ce.exec(Mn);throw new TypeError("parser must be boolean|regexp|function")}}}has(ke,Ce){if(ke=normalizeHeader(ke),ke){const $n=utils$1.findKey(this,ke);return!!($n&&this[$n]!==void 0&&(!Ce||matchHeaderValue(this,this[$n],$n,Ce)))}return!1}delete(ke,Ce){const $n=this;let Mn=!1;function Qn(Vn){if(Vn=normalizeHeader(Vn),Vn){const qn=utils$1.findKey($n,Vn);qn&&(!Ce||matchHeaderValue($n,$n[qn],qn,Ce))&&(delete $n[qn],Mn=!0)}}return utils$1.isArray(ke)?ke.forEach(Qn):Qn(ke),Mn}clear(ke){const Ce=Object.keys(this);let $n=Ce.length,Mn=!1;for(;$n--;){const Qn=Ce[$n];(!ke||matchHeaderValue(this,this[Qn],Qn,ke,!0))&&(delete this[Qn],Mn=!0)}return Mn}normalize(ke){const Ce=this,$n={};return utils$1.forEach(this,(Mn,Qn)=>{const Vn=utils$1.findKey($n,Qn);if(Vn){Ce[Vn]=normalizeValue(Mn),delete Ce[Qn];return}const qn=ke?formatHeader(Qn):String(Qn).trim();qn!==Qn&&delete Ce[Qn],Ce[qn]=normalizeValue(Mn),$n[qn]=!0}),this}concat(...ke){return this.constructor.concat(this,...ke)}toJSON(ke){const Ce=Object.create(null);return utils$1.forEach(this,($n,Mn)=>{$n!=null&&$n!==!1&&(Ce[Mn]=ke&&utils$1.isArray($n)?$n.join(", "):$n)}),Ce}[Symbol.iterator](){return Object.entries(this.toJSON())[Symbol.iterator]()}toString(){return Object.entries(this.toJSON()).map(([ke,Ce])=>ke+": "+Ce).join(`
|
|
||||||
`)}get[Symbol.toStringTag](){return"AxiosHeaders"}static from(ke){return ke instanceof this?ke:new this(ke)}static concat(ke,...Ce){const $n=new this(ke);return Ce.forEach(Mn=>$n.set(Mn)),$n}static accessor(ke){const $n=(this[$internals]=this[$internals]={accessors:{}}).accessors,Mn=this.prototype;function Qn(Vn){const qn=normalizeHeader(Vn);$n[qn]||(buildAccessors(Mn,Vn),$n[qn]=!0)}return utils$1.isArray(ke)?ke.forEach(Qn):Qn(ke),this}}AxiosHeaders.accessor(["Content-Type","Content-Length","Accept","Accept-Encoding","User-Agent","Authorization"]);utils$1.reduceDescriptors(AxiosHeaders.prototype,({value:_n},ke)=>{let Ce=ke[0].toUpperCase()+ke.slice(1);return{get:()=>_n,set($n){this[Ce]=$n}}});utils$1.freezeMethods(AxiosHeaders);function transformData(_n,ke){const Ce=this||defaults$4,$n=ke||Ce,Mn=AxiosHeaders.from($n.headers);let Qn=$n.data;return utils$1.forEach(_n,function(qn){Qn=qn.call(Ce,Qn,Mn.normalize(),ke?ke.status:void 0)}),Mn.normalize(),Qn}function isCancel(_n){return!!(_n&&_n.__CANCEL__)}function CanceledError(_n,ke,Ce){AxiosError.call(this,_n??"canceled",AxiosError.ERR_CANCELED,ke,Ce),this.name="CanceledError"}utils$1.inherits(CanceledError,AxiosError,{__CANCEL__:!0});function settle(_n,ke,Ce){const $n=Ce.config.validateStatus;!Ce.status||!$n||$n(Ce.status)?_n(Ce):ke(new AxiosError("Request failed with status code "+Ce.status,[AxiosError.ERR_BAD_REQUEST,AxiosError.ERR_BAD_RESPONSE][Math.floor(Ce.status/100)-4],Ce.config,Ce.request,Ce))}function parseProtocol(_n){const ke=/^([-+\w]{1,25})(:?\/\/|:)/.exec(_n);return ke&&ke[1]||""}function speedometer(_n,ke){_n=_n||10;const Ce=new Array(_n),$n=new Array(_n);let Mn=0,Qn=0,Vn;return ke=ke!==void 0?ke:1e3,function(Zn){const jn=Date.now(),Xn=$n[Qn];Vn||(Vn=jn),Ce[Mn]=Zn,$n[Mn]=jn;let zn=Qn,Hn=0;for(;zn!==Mn;)Hn+=Ce[zn++],zn=zn%_n;if(Mn=(Mn+1)%_n,Mn===Qn&&(Qn=(Qn+1)%_n),jn-Vn<ke)return;const Wn=Xn&&jn-Xn;return Wn?Math.round(Hn*1e3/Wn):void 0}}function throttle$1(_n,ke){let Ce=0,$n=1e3/ke,Mn,Qn;const Vn=(jn,Xn=Date.now())=>{Ce=Xn,Mn=null,Qn&&(clearTimeout(Qn),Qn=null),_n.apply(null,jn)};return[(...jn)=>{const Xn=Date.now(),zn=Xn-Ce;zn>=$n?Vn(jn,Xn):(Mn=jn,Qn||(Qn=setTimeout(()=>{Qn=null,Vn(Mn)},$n-zn)))},()=>Mn&&Vn(Mn)]}const progressEventReducer=(_n,ke,Ce=3)=>{let $n=0;const Mn=speedometer(50,250);return throttle$1(Qn=>{const Vn=Qn.loaded,qn=Qn.lengthComputable?Qn.total:void 0,Zn=Vn-$n,jn=Mn(Zn),Xn=Vn<=qn;$n=Vn;const zn={loaded:Vn,total:qn,progress:qn?Vn/qn:void 0,bytes:Zn,rate:jn||void 0,estimated:jn&&qn&&Xn?(qn-Vn)/jn:void 0,event:Qn,lengthComputable:qn!=null,[ke?"download":"upload"]:!0};_n(zn)},Ce)},progressEventDecorator=(_n,ke)=>{const Ce=_n!=null;return[$n=>ke[0]({lengthComputable:Ce,total:_n,loaded:$n}),ke[1]]},asyncDecorator=_n=>(...ke)=>utils$1.asap(()=>_n(...ke)),isURLSameOrigin=platform.hasStandardBrowserEnv?function(){const ke=platform.navigator&&/(msie|trident)/i.test(platform.navigator.userAgent),Ce=document.createElement("a");let $n;function Mn(Qn){let Vn=Qn;return ke&&(Ce.setAttribute("href",Vn),Vn=Ce.href),Ce.setAttribute("href",Vn),{href:Ce.href,protocol:Ce.protocol?Ce.protocol.replace(/:$/,""):"",host:Ce.host,search:Ce.search?Ce.search.replace(/^\?/,""):"",hash:Ce.hash?Ce.hash.replace(/^#/,""):"",hostname:Ce.hostname,port:Ce.port,pathname:Ce.pathname.charAt(0)==="/"?Ce.pathname:"/"+Ce.pathname}}return $n=Mn(window.location.href),function(Vn){const qn=utils$1.isString(Vn)?Mn(Vn):Vn;return qn.protocol===$n.protocol&&qn.host===$n.host}}():function(){return function(){return!0}}(),cookies=platform.hasStandardBrowserEnv?{write(_n,ke,Ce,$n,Mn,Qn){const Vn=[_n+"="+encodeURIComponent(ke)];utils$1.isNumber(Ce)&&Vn.push("expires="+new Date(Ce).toGMTString()),utils$1.isString($n)&&Vn.push("path="+$n),utils$1.isString(Mn)&&Vn.push("domain="+Mn),Qn===!0&&Vn.push("secure"),document.cookie=Vn.join("; ")},read(_n){const ke=document.cookie.match(new RegExp("(^|;\\s*)("+_n+")=([^;]*)"));return ke?decodeURIComponent(ke[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,ke){return ke?_n.replace(/\/?\/$/,"")+"/"+ke.replace(/^\/+/,""):_n}function buildFullPath(_n,ke){return _n&&!isAbsoluteURL(ke)?combineURLs(_n,ke):ke}const headersToObject=_n=>_n instanceof AxiosHeaders?{..._n}:_n;function mergeConfig(_n,ke){ke=ke||{};const Ce={};function $n(jn,Xn,zn){return utils$1.isPlainObject(jn)&&utils$1.isPlainObject(Xn)?utils$1.merge.call({caseless:zn},jn,Xn):utils$1.isPlainObject(Xn)?utils$1.merge({},Xn):utils$1.isArray(Xn)?Xn.slice():Xn}function Mn(jn,Xn,zn){if(utils$1.isUndefined(Xn)){if(!utils$1.isUndefined(jn))return $n(void 0,jn,zn)}else return $n(jn,Xn,zn)}function Qn(jn,Xn){if(!utils$1.isUndefined(Xn))return $n(void 0,Xn)}function Vn(jn,Xn){if(utils$1.isUndefined(Xn)){if(!utils$1.isUndefined(jn))return $n(void 0,jn)}else return $n(void 0,Xn)}function qn(jn,Xn,zn){if(zn in ke)return $n(jn,Xn);if(zn in _n)return $n
Line truncated
|
|
||||||
`+Qn.map(renderReason).join(`
|
|
||||||
`):" "+renderReason(Qn[0]):"as no adapter specified";throw new AxiosError("There is no suitable adapter to dispatch the request "+Vn,"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.7",validators$1={};["object","boolean","number","function","string","symbol"].forEach((_n,ke)=>{validators$1[_n]=function($n){return typeof $n===_n||"a"+(ke<1?"n ":" ")+_n}});const deprecatedWarnings={};validators$1.transitional=function(ke,Ce,$n){function Mn(Qn,Vn){return"[Axios v"+VERSION+"] Transitional option '"+Qn+"'"+Vn+($n?". "+$n:"")}return(Qn,Vn,qn)=>{if(ke===!1)throw new AxiosError(Mn(Vn," has been removed"+(Ce?" in "+Ce:"")),AxiosError.ERR_DEPRECATED);return Ce&&!deprecatedWarnings[Vn]&&(deprecatedWarnings[Vn]=!0,console.warn(Mn(Vn," has been deprecated since v"+Ce+" and will be removed in the near future"))),ke?ke(Qn,Vn,qn):!0}};function assertOptions(_n,ke,Ce){if(typeof _n!="object")throw new AxiosError("options must be an object",AxiosError.ERR_BAD_OPTION_VALUE);const $n=Object.keys(_n);let Mn=$n.length;for(;Mn-- >0;){const Qn=$n[Mn],Vn=ke[Qn];if(Vn){const qn=_n[Qn],Zn=qn===void 0||Vn(qn,Qn,_n);if(Zn!==!0)throw new AxiosError("option "+Qn+" must be "+Zn,AxiosError.ERR_BAD_OPTION_VALUE);continue}if(Ce!==!0)throw new AxiosError("Unknown option "+Qn,AxiosError.ERR_BAD_OPTION)}}const validator={assertOptions,validators:validators$1},validators=validator.validators;class Axios{constructor(ke){this.defaults=ke,this.interceptors={request:new InterceptorManager,response:new InterceptorManager}}async request(ke,Ce){try{return await this._request(ke,Ce)}catch($n){if($n instanceof Error){let Mn;Error.captureStackTrace?Error.captureStackTrace(Mn={}):Mn=new Error;const Qn=Mn.stack?Mn.stack.replace(/^.+\n/,""):"";try{$n.stack?Qn&&!String($n.stack).endsWith(Qn.replace(/^.+\n.+\n/,""))&&($n.stack+=`
|
|
||||||
`+Qn):$n.stack=Qn}catch{}}throw $n}}_request(ke,Ce){typeof ke=="string"?(Ce=Ce||{},Ce.url=ke):Ce=ke||{},Ce=mergeConfig(this.defaults,Ce);const{transitional:$n,paramsSerializer:Mn,headers:Qn}=Ce;$n!==void 0&&validator.assertOptions($n,{silentJSONParsing:validators.transitional(validators.boolean),forcedJSONParsing:validators.transitional(validators.boolean),clarifyTimeoutError:validators.transitional(validators.boolean)},!1),Mn!=null&&(utils$1.isFunction(Mn)?Ce.paramsSerializer={serialize:Mn}:validator.assertOptions(Mn,{encode:validators.function,serialize:validators.function},!0)),Ce.method=(Ce.method||this.defaults.method||"get").toLowerCase();let Vn=Qn&&utils$1.merge(Qn.common,Qn[Ce.method]);Qn&&utils$1.forEach(["delete","get","head","post","put","patch","common"],Yn=>{delete Qn[Yn]}),Ce.headers=AxiosHeaders.concat(Vn,Qn);const qn=[];let Zn=!0;this.interceptors.request.forEach(function(Un){typeof Un.runWhen=="function"&&Un.runWhen(Ce)===!1||(Zn=Zn&&Un.synchronous,qn.unshift(Un.fulfilled,Un.rejected))});const jn=[];this.interceptors.response.forEach(function(Un){jn.push(Un.fulfilled,Un.rejected)});let Xn,zn=0,Hn;if(!Zn){const Yn=[dispatchRequest.bind(this),void 0];for(Yn.unshift.apply(Yn,qn),Yn.push.apply(Yn,jn),Hn=Yn.length,Xn=Promise.resolve(Ce);zn<Hn;)Xn=Xn.then(Yn[zn++],Yn[zn++]);return Xn}Hn=qn.length;let Wn=Ce;for(zn=0;zn<Hn;){const Yn=qn[zn++],Un=qn[zn++];try{Wn=Yn(Wn)}catch(Gn){Un.call(this,Gn);break}}try{Xn=dispatchRequest.call(this,Wn)}catch(Yn){return Promise.reject(Yn)}for(zn=0,Hn=jn.length;zn<Hn;)Xn=Xn.then(jn[zn++],jn[zn++]);return Xn}getUri(ke){ke=mergeConfig(this.defaults,ke);const Ce=buildFullPath(ke.baseURL,ke.url);return buildURL(Ce,ke.params,ke.paramsSerializer)}}utils$1.forEach(["delete","get","head","options"],function(ke){Axios.prototype[ke]=function(Ce,$n){return this.request(mergeConfig($n||{},{method:ke,url:Ce,data:($n||{}).data}))}});utils$1.forEach(["post","put","patch"],function(ke){function Ce($n){return function(Qn,Vn,qn){return this.request(mergeConfig(qn||{},{method:ke,headers:$n?{"Content-Type":"multipart/form-data"}:{},url:Qn,data:Vn}))}}Axios.prototype[ke]=Ce(),Axios.prototype[ke+"Form"]=Ce(!0)});class CancelToken{constructor(ke){if(typeof ke!="function")throw new TypeError("executor must be a function.");let Ce;this.promise=new Promise(function(Qn){Ce=Qn});const $n=this;this.promise.then(Mn=>{if(!$n._listeners)return;let Qn=$n._listeners.length;for(;Qn-- >0;)$n._listeners[Qn](Mn);$n._listeners=null}),this.promise.then=Mn=>{let Qn;const Vn=new Promise(qn=>{$n.subscribe(qn),Qn=qn}).then(Mn);return Vn.cancel=function(){$n.unsubscribe(Qn)},Vn},ke(function(Qn,Vn,qn){$n.reason||($n.reason=new CanceledError(Qn,Vn,qn),Ce($n.reason))})}throwIfRequested(){if(this.reason)throw this.reason}subscribe(ke){if(this.reason){ke(this.reason);return}this._listeners?this._listeners.push(ke):this._listeners=[ke]}unsubscribe(ke){if(!this._listeners)return;const Ce=this._listeners.indexOf(ke);Ce!==-1&&this._listeners.splice(Ce,1)}toAbortSignal(){const ke=new AbortController,Ce=$n=>{ke.abort($n)};return this.subscribe(Ce),ke.signal.unsubscribe=()=>this.unsubscribe(Ce),ke.signal}static source(){let ke;return{token:new CancelToken(function(Mn){ke=Mn}),cancel:ke}}}function spread(_n){return function(Ce){return _n.apply(null,Ce)}}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,ke])=>{HttpStatusCode[ke]=_n});function createInstance(_n){const ke=new Axios(_n),Ce=bind$1(Axios.prototype.request,ke);return utils$1.extend(Ce,Axios.prototype,ke,{allOwnKeys:!0}),utils$1.extend(Ce,ke,null,{allOwnKeys:!0}),Ce.create=function(Mn){return createInstance(mergeConfig(_n,Mn))},Ce}const axios$1=createInstance(defaults$4);axios$1.Axios=Axios;axios$1.Ca
Line truncated
|
|
||||||
`;for(let Gn=0;Gn<=1;Gn+=Zn){const Kn=ke+(Ce-ke)*Qn(Gn);jn+=Gn*100+`%{${Vn(Kn,1-Kn)}}
|
|
||||||
`}const Xn=jn+`100% {${Vn(Ce,1-Ce)}}
|
|
||||||
}`,zn=`__svelte_${hash$1(Xn)}_${qn}`,Hn=get_root_for_style(_n),{stylesheet:Wn,rules:Yn}=managed_styles.get(Hn)||create_style_information(Hn,_n);Yn[zn]||(Yn[zn]=!0,Wn.insertRule(`@keyframes ${zn} ${Xn}`,Wn.cssRules.length));const Un=_n.style.animation||"";return _n.style.animation=`${Un?`${Un}, `:""}${zn} ${$n}ms linear ${Mn}ms 1 both`,active+=1,zn}function delete_rule(_n,ke){const Ce=(_n.style.animation||"").split(", "),$n=Ce.filter(ke?Qn=>Qn.indexOf(ke)<0:Qn=>Qn.indexOf("__svelte")===-1),Mn=Ce.length-$n.length;Mn&&(_n.style.animation=$n.join(", "),active-=Mn,active||clear_rules())}function clear_rules(){raf(()=>{active||(managed_styles.forEach(_n=>{const{ownerNode:ke}=_n.stylesheet;ke&&detach(ke)}),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(ke,Ce,{cancelable:$n=!1}={})=>{const Mn=_n.$$.callbacks[ke];if(Mn){const Qn=custom_event(ke,Ce,{cancelable:$n});return Mn.slice().forEach(Vn=>{Vn.call(_n,Qn)}),!Qn.defaultPrevented}return!0}}function setContext(_n,ke){return get_current_component().$$.context.set(_n,ke),ke}function getContext$1(_n){return get_current_component().$$.context.get(_n)}function bubble(_n,ke){const Ce=_n.$$.callbacks[ke.type];Ce&&Ce.slice().forEach($n=>$n.call(this,ke))}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 ke=dirty_components[flushidx];flushidx++,set_current_component(ke),update(ke.$$)}}catch(ke){throw dirty_components.length=0,flushidx=0,ke}for(set_current_component(null),dirty_components.length=0,flushidx=0;binding_callbacks.length;)binding_callbacks.pop()();for(let ke=0;ke<render_callbacks.length;ke+=1){const Ce=render_callbacks[ke];seen_callbacks.has(Ce)||(seen_callbacks.add(Ce),Ce())}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 ke=_n.dirty;_n.dirty=[-1],_n.fragment&&_n.fragment.p(_n.ctx,ke),_n.after_update.forEach(add_render_callback)}}function flush_render_callbacks(_n){const ke=[],Ce=[];render_callbacks.forEach($n=>_n.indexOf($n)===-1?ke.push($n):Ce.push($n)),Ce.forEach($n=>$n()),render_callbacks=ke}let promise;function wait(){return promise||(promise=Promise.resolve(),promise.then(()=>{promise=null})),promise}function dispatch(_n,ke,Ce){_n.dispatchEvent(custom_event(`${ke?"intro":"outro"}${Ce}`))}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,ke){_n&&_n.i&&(outroing.delete(_n),_n.i(ke))}function transition_out(_n,ke,Ce,$n){if(_n&&_n.o){if(outroing.has(_n))return;outroing.add(_n),outros.c.push(()=>{outroing.delete(_n),$n&&(Ce&&_n.d(1),$n())}),_n.o(ke)}else $n&&$n()}const null_transition={duration:0};function create_bidirectional_transition(_n,ke,Ce,$n){let Qn=ke(_n,Ce,{direction:"both"}),Vn=$n?0:1,qn=null,Zn=null,jn=null,Xn;function zn(){jn&&delete_rule(_n,jn)}function Hn(Yn,Un){const Gn=Yn.b-Vn;return Un*=Math.abs(Gn),{a:Vn,b:Yn.b,d:Gn,duration:Un,start:Yn.start,end:Yn.start+Un,group:Yn.group}}function Wn(Yn){const{delay:Un=0,duration:Gn=300,easing:Kn=identity,tick:Jn=noop,css:tr}=Qn||null_transition,nr={start:now()+Un,b:Yn};Yn||(nr.group=outros,outros.r+=1),"inert"in _n&&(Yn?Xn!==void 0&&(_n.inert=Xn):(Xn=_n.inert,_n.inert=!0)),qn||Zn?Zn=nr:(tr&&(zn(),jn=create_rule(_n,Vn,Yn,Gn,Un,Kn,tr)),Yn&&Jn(0,1),qn=Hn(nr,Gn),add_render_callback(()=>dispatch(_n,Yn,"start")),loop(er=>{if(Zn&&er>Zn.start&&(qn=Hn(Zn,Gn),Zn=null,dispatch(_n,qn.b,"start"),tr&&(zn(),jn=create_rule(_n,Vn,qn.b,qn.duration,0,Kn,Qn.css))),qn){if(er>=qn.end)Jn(Vn=qn.b,1-Vn),dispatch(_n,qn.b,"end"),Zn||(qn.b?zn():--qn.group.r||run_all(qn.group.c)),qn=null;else if(er>=qn.start){const rr=er-qn.start;Vn=qn.a+qn.d*Kn(rr/qn.duration),Jn(Vn,1-Vn)}}return!!(qn||Zn)}))}return{run(Yn){is_function(Qn)?wait().then(()=>{Qn=Qn({direction:Yn?"in":"out"}),Wn(Yn)}):Wn(Yn)},end(){zn(),qn=Zn=null}}}function ensure_array_like(_n)
Line truncated
|
|
||||||
transform: ${jn} translate(${(1-Un)*zn}${Hn}, ${(1-Un)*Wn}${Yn});
|
|
||||||
opacity: ${Zn-Xn*Gn}`}}function create_if_block$S(_n){let ke,Ce,$n,Mn,Qn,Vn,qn;return{c(){ke=element("div"),Ce=element("div"),Ce.textContent="Success",$n=space$3(),Mn=element("div"),Qn=text(_n[1]),attr(Ce,"class","title"),attr(Mn,"class","content"),attr(ke,"class","notice notice-success"),attr(ke,"role","alert")},m(Zn,jn){insert$1(Zn,ke,jn),append(ke,Ce),append(ke,$n),append(ke,Mn),append(Mn,Qn),qn=!0},p(Zn,jn){(!qn||jn&2)&&set_data(Qn,Zn[1])},i(Zn){qn||(Zn&&add_render_callback(()=>{qn&&(Vn||(Vn=create_bidirectional_transition(ke,fly,{duration:500},!0)),Vn.run(1))}),qn=!0)},o(Zn){Zn&&(Vn||(Vn=create_bidirectional_transition(ke,fly,{duration:500},!1)),Vn.run(0)),qn=!1},d(Zn){Zn&&detach(ke),Zn&&Vn&&Vn.end()}}}function create_fragment$1j(_n){let ke,Ce=_n[0]&&create_if_block$S(_n);return{c(){Ce&&Ce.c(),ke=empty$1()},m($n,Mn){Ce&&Ce.m($n,Mn),insert$1($n,ke,Mn)},p($n,[Mn]){$n[0]?Ce?(Ce.p($n,Mn),Mn&1&&transition_in(Ce,1)):(Ce=create_if_block$S($n),Ce.c(),transition_in(Ce,1),Ce.m(ke.parentNode,ke)):Ce&&(group_outros(),transition_out(Ce,1,1,()=>{Ce=null}),check_outros())},i($n){transition_in(Ce)},o($n){transition_out(Ce)},d($n){$n&&detach(ke),Ce&&Ce.d($n)}}}function instance$1j(_n,ke,Ce){let $n,Mn;function Qn(Vn="Saved"){Ce(1,$n=Vn),Ce(0,Mn=!0),setTimeout(function(){Ce(0,Mn=!1)},2e3)}return Ce(1,$n="Saved"),Ce(0,Mn=!1),[Mn,$n,Qn]}class SuccessAlert extends SvelteComponent{constructor(ke){super(),init(this,ke,instance$1j,create_fragment$1j,safe_not_equal,{show:2})}get show(){return this.$$.ctx[2]}}function create_fragment$1i(_n){let ke,Ce,$n,Mn,Qn,Vn,qn,Zn,jn,Xn,zn,Hn,Wn,Yn,Un={};return ke=new SuccessAlert({props:Un}),_n[4](ke),zn=new SpinnerButton({props:{label:"Enter"}}),{c(){create_component(ke.$$.fragment),Ce=space$3(),$n=element("div"),Mn=element("form"),Qn=element("div"),Vn=element("h3"),qn=text("Login as "),Zn=text(_n[0]),jn=space$3(),Xn=element("div"),create_component(zn.$$.fragment),attr(Qn,"class","mb-3 text-center"),attr(Xn,"class","text-center mt-5 d-block"),attr($n,"class","wrapper-tiny")},m(Gn,Kn){mount_component(ke,Gn,Kn),insert$1(Gn,Ce,Kn),insert$1(Gn,$n,Kn),append($n,Mn),append(Mn,Qn),append(Qn,Vn),append(Vn,qn),append(Vn,Zn),append(Mn,jn),append(Mn,Xn),mount_component(zn,Xn,null),Hn=!0,Wn||(Yn=listen(Mn,"submit",_n[2]),Wn=!0)},p(Gn,[Kn]){const Jn={};ke.$set(Jn),(!Hn||Kn&1)&&set_data(Zn,Gn[0])},i(Gn){Hn||(transition_in(ke.$$.fragment,Gn),transition_in(zn.$$.fragment,Gn),Hn=!0)},o(Gn){transition_out(ke.$$.fragment,Gn),transition_out(zn.$$.fragment,Gn),Hn=!1},d(Gn){Gn&&(detach(Ce),detach($n)),_n[4](null),destroy_component(ke,Gn),destroy_component(zn),Wn=!1,Yn()}}}function instance$1i(_n,ke,Ce){const $n=getContext$1("channel");let{email:Mn}=ke,{token:Qn}=ke,Vn;function qn(jn){jn.preventDefault(),axios.post($n.lucentUrl+"/verify",{email:Mn,token:Qn}).then(Xn=>{window.location=$n.lucentUrl}).catch(Xn=>{})}function Zn(jn){binding_callbacks[jn?"unshift":"push"](()=>{Vn=jn,Ce(1,Vn)})}return _n.$$set=jn=>{"email"in jn&&Ce(0,Mn=jn.email),"token"in jn&&Ce(3,Qn=jn.token)},[Mn,Vn,qn,Qn,Zn]}class Verify extends SvelteComponent{constructor(ke){super(),init(this,ke,instance$1i,create_fragment$1i,safe_not_equal,{email:0,token:3})}}function create_fragment$1h(_n){let ke,Ce,$n;return{c(){ke=element("div"),Ce=element("div"),$n=text(_n[2]),attr(Ce,"class","avatar__letters"),attr(ke,"class","avatar"),attr(ke,"title",_n[0]),set_style(ke,"background-color",_n[3][_n[4]]),set_style(ke,"height",_n[1]+"px"),set_style(ke,"width",_n[1]+"px"),set_style(ke,"font-size",_n[1]/2+"px")},m(Mn,Qn){insert$1(Mn,ke,Qn),append(ke,Ce),append(Ce,$n)},p(Mn,[Qn]){Qn&4&&set_data($n,Mn[2]),Qn&1&&attr(ke,"title",Mn[0]),Qn&2&&set_style(ke,"height",Mn[1]+"px"),Qn&2&&set_style(ke,"width",Mn[1]+"px"),Qn&2&&set_style(ke,"font-size",Mn[1]/2+"px")},i:noop,o:noop,d(Mn){Mn&&detach(ke)}}}function instance$1h(_n,ke,Ce){let{name:$n}=ke,{side:Mn=48}=ke;const Qn=["#00AA55","#009FD4","#B381B3","#939393","#E3BC00","#D47500","#DC2A2A","#3ede91","#377dd4","#0256b0","#053d82","#3d026e","#b378e3","#c4065c","#543208","#d97811","#0c6b40"];let Vn="";$n.split(" ").length>1?Vn=$n.split(" ")[0].charAt(0).toUpperCase()+$n.split(" ")[1].charAt(0).toUpperCase():Vn=$n.split(" ")[0].charAt(0).toUpperCase()+$n.split(" ")[0].charAt(1).toUpperCase();let Zn=($n.charCodeAt(1)+$n.length)%19;return _n.$$set=jn=>{"name"in jn&&Ce(0,$n=jn.name),"side"in jn&&Ce(1,Mn=jn.side)},[$n,Mn,Vn,Qn,Zn]}class Avatar extends SvelteComponent{constructor(ke){super(),init(this,ke,instance$1h,create_fragment$1h,safe_not_equal,{name:0,side:1})}}function create_fragment$1g(_n){let ke,Ce,$n,Mn,Qn,Vn,qn,Zn,jn,Xn,zn,Hn,Wn,Yn,Un,Gn,Kn,Jn,tr,nr,er,rr,or,ir,sr,cr;Ce=new ErrorAlert({props:{message:_n[2]}});let ur={};return Mn=new SuccessAlert({props:ur}),_n[8](Mn),qn=new Avatar({props:{name:_n[4].name}}),Wn=new SpinnerButton({props:{label:"Update Name"}}),tr=new SpinnerButton({props:{label:"Update Email"}}),{c(){ke=element("div"),create_component(Ce.$$.fragment),$n=space$3(),create_component(Mn.$$.fragment),Qn
Line truncated
|
|
||||||
device`),attr(Vn,"class","header-small mb-5"),attr(zn,"type","text"),attr(zn,"class","form-control mb-3"),attr(zn,"placeholder","Name"),zn.required=!0,attr(Xn,"class","input-group mb-5"),attr(Kn,"type","email"),attr(Kn,"class","form-control mb-3"),attr(Kn,"placeholder","Email"),Kn.required=!0,attr(Gn,"class","input-group mb-5"),attr(rr,"class","list-group-item list-group-item-action"),attr(rr,"href",_n[5].lucentUrl+"/logout"),attr(er,"class","list-group"),attr(ke,"class","wrapper-tiny")},m(fr,pr){insert$1(fr,ke,pr),mount_component(Ce,ke,null),append(ke,$n),mount_component(Mn,ke,null),append(ke,Qn),append(ke,Vn),mount_component(qn,Vn,null),append(ke,Zn),append(ke,jn),append(jn,Xn),append(Xn,zn),set_input_value(zn,_n[0]),append(Xn,Hn),mount_component(Wn,Xn,null),append(ke,Yn),append(ke,Un),append(Un,Gn),append(Gn,Kn),set_input_value(Kn,_n[1]),append(Gn,Jn),mount_component(tr,Gn,null),append(ke,nr),append(ke,er),append(er,rr),append(rr,or),ir=!0,sr||(cr=[listen(zn,"input",_n[9]),listen(jn,"submit",_n[6]),listen(Kn,"input",_n[10]),listen(Un,"submit",_n[7])],sr=!0)},p(fr,[pr]){const mr={};pr&4&&(mr.message=fr[2]),Ce.$set(mr);const _r={};Mn.$set(_r),pr&1&&zn.value!==fr[0]&&set_input_value(zn,fr[0]),pr&2&&Kn.value!==fr[1]&&set_input_value(Kn,fr[1])},i(fr){ir||(transition_in(Ce.$$.fragment,fr),transition_in(Mn.$$.fragment,fr),transition_in(qn.$$.fragment,fr),transition_in(Wn.$$.fragment,fr),transition_in(tr.$$.fragment,fr),ir=!0)},o(fr){transition_out(Ce.$$.fragment,fr),transition_out(Mn.$$.fragment,fr),transition_out(qn.$$.fragment,fr),transition_out(Wn.$$.fragment,fr),transition_out(tr.$$.fragment,fr),ir=!1},d(fr){fr&&detach(ke),destroy_component(Ce),_n[8](null),destroy_component(Mn),destroy_component(qn),destroy_component(Wn),destroy_component(tr),sr=!1,run_all(cr)}}}function instance$1g(_n,ke,Ce){const $n=getContext$1("user"),Mn=getContext$1("channel");let Qn=$n.name,Vn=$n.email,qn="",Zn;function jn(Yn){Yn.preventDefault(),Ce(2,qn=""),axios$1.post(Mn.lucentUrl+"/account/update-name",{name:Qn}).then(Un=>{Zn.show()}).catch(Un=>{var Gn;Ce(2,qn=(Gn=Un.response)==null?void 0:Gn.data.error)})}function Xn(Yn){Yn.preventDefault(),Ce(2,qn=""),axios$1.post(Mn.lucentUrl+"/account/update-email",{email:Vn}).then(Un=>{Zn.show()}).catch(Un=>{var Gn;Ce(2,qn=(Gn=Un.response)==null?void 0:Gn.data.error)})}function zn(Yn){binding_callbacks[Yn?"unshift":"push"](()=>{Zn=Yn,Ce(3,Zn)})}function Hn(){Qn=this.value,Ce(0,Qn)}function Wn(){Vn=this.value,Ce(1,Vn)}return[Qn,Vn,qn,Zn,$n,Mn,jn,Xn,zn,Hn,Wn]}class Profile extends SvelteComponent{constructor(ke){super(),init(this,ke,instance$1g,create_fragment$1g,safe_not_equal,{})}}function create_fragment$1f(_n){let ke,Ce,$n,Mn=(_n[3].name??"Lucent Setup")+"",Qn,Vn,qn,Zn,jn,Xn;const zn=[{title:_n[0]},_n[2]];var Hn=_n[4][_n[1]];function Wn(Yn,Un){let Gn={};for(let Kn=0;Kn<zn.length;Kn+=1)Gn=assign(Gn,zn[Kn]);return Un!==void 0&&Un&5&&(Gn=assign(Gn,get_spread_update(zn,[Un&1&&{title:Yn[0]},Un&4&&get_spread_object(Yn[2])]))),{props:Gn}}return Hn&&(jn=construct_svelte_component(Hn,Wn(_n))),{c(){ke=element("div"),Ce=element("h1"),$n=element("a"),Qn=text(Mn),qn=space$3(),Zn=element("div"),jn&&create_component(jn.$$.fragment),attr($n,"class","text-decoration-none"),attr($n,"href",Vn=_n[3].lucentUrl),set_style(ke,"text-align","center"),set_style(ke,"background","var(--p20)"),set_style(ke,"padding","20px"),set_style(ke,"color","var(--p90)")},m(Yn,Un){insert$1(Yn,ke,Un),append(ke,Ce),append(Ce,$n),append($n,Qn),insert$1(Yn,qn,Un),insert$1(Yn,Zn,Un),jn&&mount_component(jn,Zn,null),Xn=!0},p(Yn,[Un]){if((!Xn||Un&8)&&Mn!==(Mn=(Yn[3].name??"Lucent Setup")+"")&&set_data(Qn,Mn),(!Xn||Un&8&&Vn!==(Vn=Yn[3].lucentUrl))&&attr($n,"href",Vn),Un&2&&Hn!==(Hn=Yn[4][Yn[1]])){if(jn){group_outros();const Gn=jn;transition_out(Gn.$$.fragment,1,0,()=>{destroy_component(Gn,1)}),check_outros()}Hn?(jn=construct_svelte_component(Hn,Wn(Yn,Un)),create_component(jn.$$.fragment),transition_in(jn.$$.fragment,1),mount_component(jn,Zn,null)):jn=null}else if(Hn){const Gn=Un&5?get_spread_update(zn,[Un&1&&{title:Yn[0]},Un&4&&get_spread_object(Yn[2])]):{};jn.$set(Gn)}},i(Yn){Xn||(jn&&transition_in(jn.$$.fragment,Yn),Xn=!0)},o(Yn){jn&&transition_out(jn.$$.fragment,Yn),Xn=!1},d(Yn){Yn&&(detach(ke),detach(qn),detach(Zn)),jn&&destroy_component(jn)}}}function instance$1f(_n,ke,Ce){const $n={register:Register,login:Login,verify:Verify,profile:Profile};let{title:Mn}=ke,{view:Qn}=ke,{user:Vn}=ke,{data:qn}=ke,{channel:Zn}=ke;return setContext("channel",Zn),setContext("user",Vn),_n.$$set=jn=>{"title"in jn&&Ce(0,Mn=jn.title),"view"in jn&&Ce(1,Qn=jn.view),"user"in jn&&Ce(5,Vn=jn.user),"data"in jn&&Ce(2,qn=jn.data),"channel"in jn&&Ce(3,Zn=jn.channel)},[Mn,Qn,qn,Zn,$n,Vn]}class Account extends SvelteComponent{constructor(ke){super(),init(this,ke,instance$1f,create_fragment$1f,safe_not_equal,{title:0,view:1,user:5,data:2,channel:3})}}function toDate(_n){const ke=Object.prototype.toString.call(_n);return _n instanceof Date||typeof _n=="objec
Line truncated
|
|
||||||
d="M5.75 8.00337C6.85315 7.36523 8.13392 7 9.5 7C13.6421 7 17 10.3579 17 14.5C17 18.6421 13.6421 22 9.5 22C5.35786 22 2 18.6421 2 14.5C2 13.1339 2.36523 11.8532 3.00337 10.75" stroke="#1C274C" stroke-width="1.5" stroke-linecap="round"/>`,viewBox:"0 0 24 24"}};let{width:Mn=16}=ke,{height:Qn=16}=ke,{icon:Vn=""}=ke,{fill:qn="currentColor"}=ke,{stroke:Zn="currentColor"}=ke,jn=$n[Vn];return _n.$$set=Xn=>{"width"in Xn&&Ce(0,Mn=Xn.width),"height"in Xn&&Ce(1,Qn=Xn.height),"icon"in Xn&&Ce(2,Vn=Xn.icon),"fill"in Xn&&Ce(3,qn=Xn.fill),"stroke"in Xn&&Ce(4,Zn=Xn.stroke)},[Mn,Qn,Vn,qn,Zn,jn]}class Icon extends SvelteComponent{constructor(ke){super(),init(this,ke,instance$1a,create_fragment$1a,safe_not_equal,{width:0,height:1,icon:2,fill:3,stroke:4})}}function create_fragment$19(_n){let ke,Ce,$n;return{c(){ke=element("input"),attr(ke,"type","checkbox"),ke.value=_n[0],attr(ke,"class","switch"),ke.checked=_n[1]},m(Mn,Qn){insert$1(Mn,ke,Qn),Ce||($n=listen(ke,"change",_n[2]),Ce=!0)},p(Mn,[Qn]){Qn&1&&(ke.value=Mn[0]),Qn&2&&(ke.checked=Mn[1])},i:noop,o:noop,d(Mn){Mn&&detach(ke),Ce=!1,$n()}}}function instance$19(_n,ke,Ce){let{value:$n}=ke,{checked:Mn=!1}=ke;function Qn(Vn){bubble.call(this,_n,Vn)}return _n.$$set=Vn=>{"value"in Vn&&Ce(0,$n=Vn.value),"checked"in Vn&&Ce(1,Mn=Vn.checked)},[$n,Mn,Qn]}class Switch extends SvelteComponent{constructor(ke){super(),init(this,ke,instance$19,create_fragment$19,safe_not_equal,{value:0,checked:1})}}function create_if_block_3$b(_n){let ke,Ce;return ke=new Switch({props:{value:"published",checked:_n[0].status==="published"}}),ke.$on("change",_n[1]),{c(){create_component(ke.$$.fragment)},m($n,Mn){mount_component(ke,$n,Mn),Ce=!0},p($n,Mn){const Qn={};Mn&1&&(Qn.checked=$n[0].status==="published"),ke.$set(Qn)},i($n){Ce||(transition_in(ke.$$.fragment,$n),Ce=!0)},o($n){transition_out(ke.$$.fragment,$n),Ce=!1},d($n){destroy_component(ke,$n)}}}function create_if_block_2$e(_n){let ke;return{c(){ke=text("Trashed")},m(Ce,$n){insert$1(Ce,ke,$n)},d(Ce){Ce&&detach(ke)}}}function create_if_block_1$s(_n){let ke;return{c(){ke=text("Draft")},m(Ce,$n){insert$1(Ce,ke,$n)},d(Ce){Ce&&detach(ke)}}}function create_if_block$Q(_n){let ke;return{c(){ke=text("Published")},m(Ce,$n){insert$1(Ce,ke,$n)},d(Ce){Ce&&detach(ke)}}}function create_fragment$18(_n){let ke,Ce,$n,Mn=_n[0].status!=="trashed"&&create_if_block_3$b(_n);function Qn(Zn,jn){if(Zn[0].status==="published")return create_if_block$Q;if(Zn[0].status==="draft")return create_if_block_1$s;if(Zn[0].status==="trashed")return create_if_block_2$e}let Vn=Qn(_n),qn=Vn&&Vn(_n);return{c(){Mn&&Mn.c(),ke=space$3(),qn&&qn.c(),Ce=empty$1()},m(Zn,jn){Mn&&Mn.m(Zn,jn),insert$1(Zn,ke,jn),qn&&qn.m(Zn,jn),insert$1(Zn,Ce,jn),$n=!0},p(Zn,[jn]){Zn[0].status!=="trashed"?Mn?(Mn.p(Zn,jn),jn&1&&transition_in(Mn,1)):(Mn=create_if_block_3$b(Zn),Mn.c(),transition_in(Mn,1),Mn.m(ke.parentNode,ke)):Mn&&(group_outros(),transition_out(Mn,1,1,()=>{Mn=null}),check_outros()),Vn!==(Vn=Qn(Zn))&&(qn&&qn.d(1),qn=Vn&&Vn(Zn),qn&&(qn.c(),qn.m(Ce.parentNode,Ce)))},i(Zn){$n||(transition_in(Mn),$n=!0)},o(Zn){transition_out(Mn),$n=!1},d(Zn){Zn&&(detach(ke),detach(Ce)),Mn&&Mn.d(Zn),qn&&qn.d(Zn)}}}function instance$18(_n,ke,Ce){let{status:$n="draft"}=ke,{record:Mn}=ke;function Qn(Vn){Vn.target.checked?Ce(2,$n="published"):Ce(2,$n="draft")}return _n.$$set=Vn=>{"status"in Vn&&Ce(2,$n=Vn.status),"record"in Vn&&Ce(0,Mn=Vn.record)},[Mn,Qn,$n]}class StatusSelect extends SvelteComponent{constructor(ke){super(),init(this,ke,instance$18,create_fragment$18,safe_not_equal,{status:2,record:0})}}function create_if_block$P(_n){let ke,Ce;return ke=new Dropdown({props:{$$slots:{button:[create_button_slot$8],default:[create_default_slot$9]},$$scope:{ctx:_n}}}),{c(){create_component(ke.$$.fragment)},m($n,Mn){mount_component(ke,$n,Mn),Ce=!0},p($n,Mn){const Qn={};Mn&270&&(Qn.$$scope={dirty:Mn,ctx:$n}),ke.$set(Qn)},i($n){Ce||(transition_in(ke.$$.fragment,$n),Ce=!0)},o($n){transition_out(ke.$$.fragment,$n),Ce=!1},d($n){destroy_component(ke,$n)}}}function create_if_block_1$r(_n){let ke,Ce,$n,Mn;return{c(){ke=element("a"),Ce=text("Clone"),attr(ke,"class","dropdown-item"),attr(ke,"href",_n[4].lucentUrl)},m(Qn,Vn){insert$1(Qn,ke,Vn),append(ke,Ce),$n||(Mn=listen(ke,"click",_n[5]),$n=!0)},p:noop,d(Qn){Qn&&detach(ke),$n=!1,Mn()}}}function create_default_slot$9(_n){let ke,Ce,$n,Mn,Qn,Vn,qn,Zn,jn,Xn,zn,Hn=!_n[3]&&create_if_block_1$r(_n);return{c(){ke=element("h6"),ke.textContent="Record Actions",Ce=space$3(),$n=element("a"),Mn=text("Create new"),Vn=space$3(),Hn&&Hn.c(),qn=space$3(),Zn=element("a"),jn=text("Revisions"),attr(ke,"class","dropdown-header"),attr($n,"class","dropdown-item"),attr($n,"href",Qn=_n[4].lucentUrl+"/records/new?schema="+_n[2].name),attr(Zn,"class","dropdown-item"),attr(Zn,"href",_n[4].lucentUrl)},m(Wn,Yn){insert$1(Wn,ke,Yn),insert$1(Wn,Ce,Yn),insert$1(Wn,$n,Yn),append($n,Mn),insert$1(Wn,Vn,Yn),Hn&&Hn.m(Wn,Yn),insert$1(Wn,qn,Yn),insert$1(Wn,Zn,Yn),append(Zn,jn),Xn||(zn=listen(Zn,"click",prevent_default(_n[6])),Xn=!0)}
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(ke){return objectToString.call(ke)==="[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,ke){return _n!=null&&typeof _n=="object"&&ke in _n}function primitiveHasOwnProperty(_n,ke){return _n!=null&&typeof _n!="object"&&_n.hasOwnProperty&&_n.hasOwnProperty(ke)}var regExpTest=RegExp.prototype.test;function testRegExp(_n,ke){return regExpTest.call(_n,ke)}var nonSpaceRe=/\S/;function isWhitespace(_n){return!testRegExp(nonSpaceRe,_n)}var entityMap={"&":"&","<":"<",">":">",'"':""","'":"'","/":"/","`":"`","=":"="};function escapeHtml(_n){return String(_n).replace(/[&<>"'`=\/]/g,function(Ce){return entityMap[Ce]})}var whiteRe=/\s*/,spaceRe=/\s+/,equalsRe=/\s*=/,curlyRe=/\s*\}/,tagRe=/#|\^|\/|>|\{|&|=|!/;function parseTemplate(_n,ke){if(!_n)return[];var Ce=!1,$n=[],Mn=[],Qn=[],Vn=!1,qn=!1,Zn="",jn=0;function Xn(){if(Vn&&!qn)for(;Qn.length;)delete Mn[Qn.pop()];else Qn=[];Vn=!1,qn=!1}var zn,Hn,Wn;function Yn(ir){if(typeof ir=="string"&&(ir=ir.split(spaceRe,2)),!isArray(ir)||ir.length!==2)throw new Error("Invalid tags: "+ir);zn=new RegExp(escapeRegExp(ir[0])+"\\s*"),Hn=new RegExp("\\s*"+escapeRegExp(ir[1])),Wn=new RegExp("\\s*"+escapeRegExp("}"+ir[1]))}Yn(ke||mustache.tags);for(var Un=new Scanner(_n),Gn,Kn,Jn,tr,nr,er;!Un.eos();){if(Gn=Un.pos,Jn=Un.scanUntil(zn),Jn)for(var rr=0,or=Jn.length;rr<or;++rr)tr=Jn.charAt(rr),isWhitespace(tr)?(Qn.push(Mn.length),Zn+=tr):(qn=!0,Ce=!0,Zn+=" "),Mn.push(["text",tr,Gn,Gn+1]),Gn+=1,tr===`
|
|
||||||
`&&(Xn(),Zn="",jn=0,Ce=!1);if(!Un.scan(zn))break;if(Vn=!0,Kn=Un.scan(tagRe)||"name",Un.scan(whiteRe),Kn==="="?(Jn=Un.scanUntil(equalsRe),Un.scan(equalsRe),Un.scanUntil(Hn)):Kn==="{"?(Jn=Un.scanUntil(Wn),Un.scan(curlyRe),Un.scanUntil(Hn),Kn="&"):Jn=Un.scanUntil(Hn),!Un.scan(Hn))throw new Error("Unclosed tag at "+Un.pos);if(Kn==">"?nr=[Kn,Jn,Gn,Un.pos,Zn,jn,Ce]:nr=[Kn,Jn,Gn,Un.pos],jn++,Mn.push(nr),Kn==="#"||Kn==="^")$n.push(nr);else if(Kn==="/"){if(er=$n.pop(),!er)throw new Error('Unopened section "'+Jn+'" at '+Gn);if(er[1]!==Jn)throw new Error('Unclosed section "'+er[1]+'" at '+Gn)}else Kn==="name"||Kn==="{"||Kn==="&"?qn=!0:Kn==="="&&Yn(Jn)}if(Xn(),er=$n.pop(),er)throw new Error('Unclosed section "'+er[1]+'" at '+Un.pos);return nestTokens(squashTokens(Mn))}function squashTokens(_n){for(var ke=[],Ce,$n,Mn=0,Qn=_n.length;Mn<Qn;++Mn)Ce=_n[Mn],Ce&&(Ce[0]==="text"&&$n&&$n[0]==="text"?($n[1]+=Ce[1],$n[3]=Ce[3]):(ke.push(Ce),$n=Ce));return ke}function nestTokens(_n){for(var ke=[],Ce=ke,$n=[],Mn,Qn,Vn=0,qn=_n.length;Vn<qn;++Vn)switch(Mn=_n[Vn],Mn[0]){case"#":case"^":Ce.push(Mn),$n.push(Mn),Ce=Mn[4]=[];break;case"/":Qn=$n.pop(),Qn[5]=Mn[2],Ce=$n.length>0?$n[$n.length-1][4]:ke;break;default:Ce.push(Mn)}return ke}function Scanner(_n){this.string=_n,this.tail=_n,this.pos=0}Scanner.prototype.eos=function(){return this.tail===""};Scanner.prototype.scan=function(ke){var Ce=this.tail.match(ke);if(!Ce||Ce.index!==0)return"";var $n=Ce[0];return this.tail=this.tail.substring($n.length),this.pos+=$n.length,$n};Scanner.prototype.scanUntil=function(ke){var Ce=this.tail.search(ke),$n;switch(Ce){case-1:$n=this.tail,this.tail="";break;case 0:$n="";break;default:$n=this.tail.substring(0,Ce),this.tail=this.tail.substring(Ce)}return this.pos+=$n.length,$n};function Context$1(_n,ke){this.view=_n,this.cache={".":this.view},this.parent=ke}Context$1.prototype.push=function(ke){return new Context$1(ke,this)};Context$1.prototype.lookup=function(ke){var Ce=this.cache,$n;if(Ce.hasOwnProperty(ke))$n=Ce[ke];else{for(var Mn=this,Qn,Vn,qn,Zn=!1;Mn;){if(ke.indexOf(".")>0)for(Qn=Mn.view,Vn=ke.split("."),qn=0;Qn!=null&&qn<Vn.length;)qn===Vn.length-1&&(Zn=hasProperty(Qn,Vn[qn])||primitiveHasOwnProperty(Qn,Vn[qn])),Qn=Qn[Vn[qn++]];else Qn=Mn.view[ke],Zn=hasProperty(Mn.view,ke);if(Zn){$n=Qn;break}Mn=Mn.parent}Ce[ke]=$n}return isFunction($n)&&($n=$n.call(this.view)),$n};function Writer(){this.templateCache={_cache:{},set:function(ke,Ce){this._cache[ke]=Ce},get:function(ke){return this._cache[ke]},clear:function(){this._cache={}}}}Writer.prototype.clearCache=function(){typeof this.templateCache<"u"&&this.templateCache.clear()};Writer.prototype.parse=function(ke,Ce){var $n=this.templateCache,Mn=ke+":"+(Ce||mustache.tags).join(":"),Qn=typeof $n<"u",Vn=Qn?$n.get(Mn):void 0;return Vn==null&&(Vn=parseTemplate(ke,Ce),Qn&&$n.set(Mn,Vn)),Vn};Writer.prototype.render=function(ke,Ce,$n,Mn){var Qn=this.getConfigTags(Mn),Vn=this.parse(ke,Qn),qn=Ce instanceof Context$1?Ce:new Context$1(Ce,void 0);return this.renderTokens(Vn,qn,$n,ke,Mn)};Writer.prototype.renderTokens=function(ke,Ce,$n,Mn,Qn){for(var Vn="",qn,Zn,jn,Xn=0,zn=ke.length;Xn<zn;++Xn)jn=void 0,qn=ke[Xn],Zn=qn[0],Zn==="#"?jn=this.renderSection(qn,Ce,$n,Mn,Qn):Zn==="^"?jn=this.renderInverted(qn,Ce,$n,Mn,Qn):Zn===">"?jn=this.renderPartial(qn,Ce,$n,Qn):Zn==="&"?jn=this.unescapedValue(qn,Ce):Zn==="name"?jn=this.escapedValue(qn,Ce,Qn):Zn==="text"&&(jn=this.rawValue(qn)),jn!==void 0&&(Vn+=jn);return Vn};Writer.prototype.renderSection=function(ke,Ce,$n,Mn,Qn){var Vn=this,qn="",Zn=Ce.lookup(ke[1]);function jn(Hn){return Vn.render(Hn,Ce,$n,Qn)}if(Zn){if(isArray(Zn))for(var Xn=0,zn=Zn.length;Xn<zn;++Xn)qn+=this.renderTokens(ke[4],Ce.push(Zn[Xn]),$n,Mn,Qn);else if(typeof Zn=="object"||typeof Zn=="string"||typeof Zn=="number")qn+=this.renderTokens(ke[4],Ce.push(Zn),$n,Mn,Qn);else if(isFunction(Zn)){if(typeof Mn!="string")throw new Error("Cannot use higher-order sections without the original template");Zn=Zn.call(Ce.view,Mn.slice(ke[3],ke[5]),jn),Zn!=null&&(qn+=Zn)}else qn+=this.renderTokens(ke[4],Ce,$n,Mn,Qn);return qn}};Writer.prototype.renderInverted=function(ke,Ce,$n,Mn,Qn){var Vn=Ce.lookup(ke[1]);if(!Vn||isArray(Vn)&&Vn.length===0)return this.renderTokens(ke[4],Ce,$n,Mn,Qn)};Writer.prototype.indentPartial=function(ke,Ce,$n){for(var Mn=Ce.replace(/[^ \t]/g,""),Qn=ke.split(`
|
|
||||||
`),Vn=0;Vn<Qn.length;Vn++)Qn[Vn].length&&(Vn>0||!$n)&&(Qn[Vn]=Mn+Qn[Vn]);return Qn.join(`
|
|
||||||
`)};Writer.prototype.renderPartial=function(ke,Ce,$n,Mn){if($n){var Qn=this.getConfigTags(Mn),Vn=isFunction($n)?$n(ke[1]):$n[ke[1]];if(Vn!=null){var qn=ke[6],Zn=ke[5],jn=ke[4],Xn=Vn;Zn==0&&jn&&(Xn=this.indentPartial(Vn,jn,qn));var zn=this.parse(Xn,Qn);return this.renderTokens(zn,Ce,$n,Xn,Mn)}}};Writer.prototype.unescapedValue=function(ke,Ce){var $n=Ce.lookup(ke[1]);if($n!=null)return $n};Writer.prototype.escapedValue=function(ke,Ce,$n){var Mn=this.getConfigEscape($n)||mustache.escape,Qn=Ce.lookup(ke[1]);if(Qn!=null)return typeof Qn=="number"&&Mn===mustache.escape?String(Qn):Mn(Qn)};Writer.prototype.rawValue=function(ke){return ke[1]};Writer.prototype.getConfigTags=function(ke){return isArray(ke)?ke:ke&&typeof ke=="object"?ke.tags:void 0};Writer.prototype.getConfigEscape=function(ke){if(ke&&typeof ke=="object"&&!isArray(ke))return ke.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(ke,Ce){return defaultWriter.parse(ke,Ce)};mustache.render=function(ke,Ce,$n,Mn){if(typeof ke!="string")throw new TypeError('Invalid template! Template should be a "string" but "'+typeStr(ke)+'" was given as the first argument for mustache#render(template, view, partials)');return defaultWriter.render(ke,Ce,$n,Mn)};mustache.escape=escapeHtml;mustache.Scanner=Scanner;mustache.Context=Context$1;mustache.Writer=Writer;function previewTitle(_n,ke,Ce){let $n=_n.find(Vn=>Vn.name===(ke==null?void 0:ke.schema));if(!($n!=null&&$n.cardTitle))return noTemplate($n,ke);let Mn=ke.data,Qn=mustache.render($n.cardTitle,Mn);return!Qn||Qn===""?noTemplate($n,ke):stripHtml(Qn.slice(0,300))}function noTemplate(_n,ke){var $n;if((_n==null?void 0:_n.type)==="files")return ke._file.path;let Ce=stripHtml(ke==null?void 0:ke.data[($n=_n.fields.filter(Mn=>Mn.info.name==="text")[0])==null?void 0:$n.name]).slice(0,300);return Ce.trim()===""?"~Untitled~":Ce}function create_else_block$l(_n){let ke;return{c(){ke=text("New Record")},m(Ce,$n){insert$1(Ce,ke,$n)},p:noop,d(Ce){Ce&&detach(ke)}}}function create_if_block$H(_n){let ke=previewTitle(_n[3].schemas,_n[1])+"",Ce;return{c(){Ce=text(ke)},m($n,Mn){insert$1($n,Ce,Mn)},p($n,Mn){Mn&2&&ke!==(ke=previewTitle($n[3].schemas,$n[1])+"")&&set_data(Ce,ke)},d($n){$n&&detach(Ce)}}}function create_fragment$$(_n){let ke,Ce,$n=_n[0].label.toUpperCase()+"",Mn,Qn,Vn,qn;function Zn(zn,Hn){return zn[2]?create_else_block$l:create_if_block$H}let jn=Zn(_n),Xn=jn(_n);return{c(){ke=element("div"),Ce=element("a"),Mn=text($n),Vn=space$3(),qn=element("span"),Xn.c(),attr(Ce,"class","schema-name"),attr(Ce,"href",Qn=_n[3].lucentUrl+"/content/"+_n[0].name),attr(qn,"class","record-title"),attr(ke,"class","record-header")},m(zn,Hn){insert$1(zn,ke,Hn),append(ke,Ce),append(Ce,Mn),append(ke,Vn),append(ke,qn),Xn.m(qn,null)},p(zn,[Hn]){Hn&1&&$n!==($n=zn[0].label.toUpperCase()+"")&&set_data(Mn,$n),Hn&1&&Qn!==(Qn=zn[3].lucentUrl+"/content/"+zn[0].name)&&attr(Ce,"href",Qn),jn===(jn=Zn(zn))&&Xn?Xn.p(zn,Hn):(Xn.d(1),Xn=jn(zn),Xn&&(Xn.c(),Xn.m(qn,null)))},i:noop,o:noop,d(zn){zn&&detach(ke),Xn.d()}}}function instance$$(_n,ke,Ce){const $n=getContext$1("channel");let{schema:Mn}=ke,{record:Qn}=ke,{isCreateMode:Vn}=ke;return _n.$$set=qn=>{"schema"in qn&&Ce(0,Mn=qn.schema),"record"in qn&&Ce(1,Qn=qn.record),"isCreateMode"in qn&&Ce(2,Vn=qn.isCreateMode)},[Mn,Qn,Vn,$n]}class Title extends SvelteComponent{constructor(ke){super(),init(this,ke,instance$$,create_fragment$$,safe_not_equal,{schema:0,record:1,isCreateMode:2})}}function get_each_context$m(_n,ke,Ce){const $n=_n.slice();return $n[24]=ke[Ce],$n}function create_if_block_2$c(_n){let ke,Ce,$n;return{c(){ke=element("button"),ke.innerHTML=`<span class="spinner-border spinner-border-sm" role="status" aria-hidden="true"></span>
|
|
||||||
Save`,attr(ke,"type","button"),attr(ke,"class","button primary ms-2 btn btn-primary btn-spinner")},m(Mn,Qn){insert$1(Mn,ke,Qn),Ce||($n=listen(ke,"click",_n[10]),Ce=!0)},p:noop,d(Mn){Mn&&detach(ke),Ce=!1,$n()}}}function create_if_block_1$m(_n){let ke,Ce,$n;return{c(){ke=element("button"),ke.innerHTML=`<span class="spinner-border spinner-border-sm" role="status" aria-hidden="true"></span>
|
|
||||||
Create`,attr(ke,"class","button primary btn-spinner")},m(Mn,Qn){insert$1(Mn,ke,Qn),Ce||($n=listen(ke,"click",_n[10]),Ce=!0)},p:noop,d(Mn){Mn&&detach(ke),Ce=!1,$n()}}}function create_if_block$G(_n){let ke,Ce,$n,Mn;function Qn(Zn){_n[14](Zn)}function Vn(Zn){_n[15](Zn)}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]),ke=new FormField({props:qn}),binding_callbacks.push(()=>bind(ke,"data",Qn)),binding_callbacks.push(()=>bind(ke,"graph",Vn)),{c(){create_component(ke.$$.fragment)},m(Zn,jn){mount_component(ke,Zn,jn),Mn=!0},p(Zn,jn){const Xn={};jn&4&&(Xn.schema=Zn[2]),jn&1&&(Xn.record=Zn[0]),jn&16&&(Xn.validationErrors=Zn[4]),jn&8&&(Xn.isCreateMode=Zn[3]),!Ce&&jn&1&&(Ce=!0,Xn.data=Zn[0].data,add_flush_callback(()=>Ce=!1)),!$n&&jn&2&&($n=!0,Xn.graph=Zn[1],add_flush_callback(()=>$n=!1)),ke.$set(Xn)},i(Zn){Mn||(transition_in(ke.$$.fragment,Zn),Mn=!0)},o(Zn){transition_out(ke.$$.fragment,Zn),Mn=!1},d(Zn){destroy_component(ke,Zn)}}}function create_each_block$m(_n,ke){let Ce,$n,Mn,Qn=ke[5]===ke[24].group&&create_if_block$G(ke);return{key:_n,first:null,c(){Ce=empty$1(),Qn&&Qn.c(),$n=empty$1(),this.first=Ce},m(Vn,qn){insert$1(Vn,Ce,qn),Qn&&Qn.m(Vn,qn),insert$1(Vn,$n,qn),Mn=!0},p(Vn,qn){ke=Vn,ke[5]===ke[24].group?Qn?(Qn.p(ke,qn),qn&32&&transition_in(Qn,1)):(Qn=create_if_block$G(ke),Qn.c(),transition_in(Qn,1),Qn.m($n.parentNode,$n)):Qn&&(group_outros(),transition_out(Qn,1,1,()=>{Qn=null}),check_outros())},i(Vn){Mn||(transition_in(Qn),Mn=!0)},o(Vn){transition_out(Qn),Mn=!1},d(Vn){Vn&&(detach(Ce),detach($n)),Qn&&Qn.d(Vn)}}}function create_fragment$_(_n){let ke,Ce,$n,Mn,Qn,Vn,qn,Zn,jn,Xn,zn,Hn,Wn,Yn,Un,Gn,Kn,Jn=[],tr=new Map,nr,er,rr;function or(hr){_n[11](hr)}function ir(hr){_n[12](hr)}let sr={schema:_n[2],isCreateMode:_n[3]};_n[0]!==void 0&&(sr.record=_n[0]),_n[5]!==void 0&&(sr.activeContentTab=_n[5]),$n=new EditHeader({props:sr}),binding_callbacks.push(()=>bind($n,"record",or)),binding_callbacks.push(()=>bind($n,"activeContentTab",ir));function cr(hr,br){if(hr[3])return create_if_block_1$m;if(hr[6])return create_if_block_2$c}let ur=cr(_n),fr=ur&&ur(_n);Zn=new Title({props:{schema:_n[2],record:_n[0],isCreateMode:_n[3]}}),Xn=new ErrorAlert({props:{message:_n[7]}});function pr(hr){_n[13](hr)}let mr={schema:_n[2],isCreateMode:_n[3]};_n[5]!==void 0&&(mr.active=_n[5]),Wn=new ContentTabs({props:mr}),binding_callbacks.push(()=>bind(Wn,"active",pr)),Gn=new FilePreview({props:{record:_n[0],schema:_n[2]}});let _r=ensure_array_like(_n[8]);const vr=hr=>hr[24].name;for(let hr=0;hr<_r.length;hr+=1){let br=get_each_context$m(_n,_r,hr),Er=vr(br);tr.set(Er,Jn[hr]=create_each_block$m(Er,br))}return{c(){ke=element("div"),Ce=element("div"),create_component($n.$$.fragment),Vn=space$3(),fr&&fr.c(),qn=space$3(),create_component(Zn.$$.fragment),jn=space$3(),create_component(Xn.$$.fragment),zn=space$3(),Hn=element("div"),create_component(Wn.$$.fragment),Un=space$3(),create_component(Gn.$$.fragment),Kn=space$3();for(let hr=0;hr<Jn.length;hr+=1)Jn[hr].c();attr(Ce,"class","tools-header"),attr(Hn,"class","mt-4"),set_style(Hn,"margin-bottom","150px"),set_style(Hn,"position","relative"),attr(ke,"class","inline-edit record-edit")},m(hr,br){insert$1(hr,ke,br),append(ke,Ce),mount_component($n,Ce,null),append(Ce,Vn),fr&&fr.m(Ce,null),append(ke,qn),mount_component(Zn,ke,null),append(ke,jn),mount_component(Xn,ke,null),append(ke,zn),append(ke,Hn),mount_component(Wn,Hn,null),append(Hn,Un),mount_component(Gn,Hn,null),append(Hn,Kn);for(let Er=0;Er<Jn.length;Er+=1)Jn[Er]&&Jn[Er].m(Hn,null);nr=!0,er||(rr=listen(window,"beforeunload",_n[9]),er=!0)},p(hr,[br]){const Er={};br&4&&(Er.schema=hr[2]),br&8&&(Er.isCreateMode=hr[3]),!Mn&&br&1&&(Mn=!0,Er.record=hr[0],add_flush_callback(()=>Mn=!1)),!Qn&&br&32&&(Qn=!0,Er.activeContentTab=hr[5],add_flush_callback(()=>Qn=!1)),$n.$set(Er),ur===(ur=cr(hr))&&fr?fr.p(hr,br):(fr&&fr.d(1),fr=ur&&ur(hr),fr&&(fr.c(),fr.m(Ce,null)));const Cr={};br&4&&(Cr.schema=hr[2]),br&1&&(Cr.record=hr[0]),br&8&&(Cr.isCreateMode=hr[3]),Zn.$set(Cr);const Mr={};br&128&&(Mr.message=hr[7]),Xn.$set(Mr);const yr={};br&4&&(yr.schema=hr[2]),br&8&&(yr.isCreateMode=hr[3]),!Yn&&br&32&&(Yn=!0,yr.active=hr[5],add_flush_callback(()=>Yn=!1)),Wn.$set(yr);const Pr={};br&1&&(Pr.record=hr[0]),br&4&&(Pr.schema=hr[2]),Gn.$set(Pr),br&319&&(_r=ensure_array_like(hr[8]),group_outros(),Jn=update_keyed_each(Jn,br,vr,1,hr,_r,tr,Hn,outro_and_destroy_block,create_each_block$m,null,get_each_context$m),check_outros())},i(hr){if(!nr){transition_in($n.$$.fragment,hr),transition_in(Zn.$$.fragment,hr),transition_in(Xn.$$.fragment,hr),transition_in(Wn.$$.fragment,hr),transition_in(Gn.$$.fragment,hr);for(let br=0;br<_r.length;br+=1)transition_in(Jn[br]);nr=!0}},o(hr){transition_out($n.$$.fragment,hr),transition_out(Zn.$$.fragment,hr),transition_out(Xn.$$.fragment,hr),transition_out(Wn.$$.fragment,hr),transition_out(Gn.$$.fragment,hr);for(let br=0;br<Jn.leng
Line truncated
|
|
||||||
`,attr(ke,"class","start-typing")},m(Ce,$n){insert$1(Ce,ke,$n)},p:noop,d(Ce){Ce&&detach(ke)}}}function create_each_block$l(_n,ke){let Ce,$n=previewTitle(ke[3].schemas,ke[11])+"",Mn,Qn,Vn,qn;function Zn(...Xn){return ke[8](ke[11],...Xn)}function jn(...Xn){return ke[9](ke[11],...Xn)}return{key:_n,first:null,c(){Ce=element("div"),Mn=text($n),Qn=space$3(),attr(Ce,"class","reference-tags-option"),attr(Ce,"role","button"),attr(Ce,"tabindex","0"),this.first=Ce},m(Xn,zn){insert$1(Xn,Ce,zn),append(Ce,Mn),append(Ce,Qn),Vn||(qn=[listen(Ce,"click",Zn),listen(Ce,"keypress",jn)],Vn=!0)},p(Xn,zn){ke=Xn,zn&4&&$n!==($n=previewTitle(ke[3].schemas,ke[11])+"")&&set_data(Mn,$n)},d(Xn){Xn&&detach(Ce),Vn=!1,run_all(qn)}}}function create_fragment$Z(_n){let ke,Ce,$n,Mn,Qn,Vn,qn,Zn=_n[2]&&create_if_block$F(_n);return{c(){ke=element("div"),Ce=element("input"),Mn=space$3(),Qn=element("div"),Zn&&Zn.c(),attr(Ce,"type","search"),attr(Ce,"placeholder",$n="Search for "+_n[0].label),attr(Ce,"autocomplete","off"),attr(Qn,"class","reference-tags-results"),attr(ke,"class","reference-tags")},m(jn,Xn){insert$1(jn,ke,Xn),append(ke,Ce),set_input_value(Ce,_n[1]),append(ke,Mn),append(ke,Qn),Zn&&Zn.m(Qn,null),Vn||(qn=[listen(Ce,"keyup",_n[4]),listen(Ce,"input",_n[7])],Vn=!0)},p(jn,[Xn]){Xn&1&&$n!==($n="Search for "+jn[0].label)&&attr(Ce,"placeholder",$n),Xn&2&&Ce.value!==jn[1]&&set_input_value(Ce,jn[1]),jn[2]?Zn?Zn.p(jn,Xn):(Zn=create_if_block$F(jn),Zn.c(),Zn.m(Qn,null)):Zn&&(Zn.d(1),Zn=null)},i:noop,o:noop,d(jn){jn&&detach(ke),Zn&&Zn.d(),Vn=!1,run_all(qn)}}}function instance$Z(_n,ke,Ce){let $n;const Mn=getContext$1("channel"),Qn=createEventDispatcher();let{value:Vn=""}=ke,{field:qn}=ke,Zn="";const jn=debounce$1(Yn=>{axios$1.get(Mn.lucentUrl+"/records/suggestions",{params:{schema:qn.collections[0],field:"search",value:Zn,ui:"search"}}).then(Un=>{Ce(2,$n=Un.data)}).catch(Un=>{Ce(2,$n=[]),console.log(Un)})},500);function Xn(Yn,Un){Yn.preventDefault(),Ce(6,Vn=Un.id),Qn("addFilter"),Ce(6,Vn="")}function zn(){Zn=this.value,Ce(1,Zn)}const Hn=(Yn,Un)=>Xn(Un,Yn),Wn=(Yn,Un)=>Xn(Un,Yn);return _n.$$set=Yn=>{"value"in Yn&&Ce(6,Vn=Yn.value),"field"in Yn&&Ce(0,qn=Yn.field)},Ce(2,$n=[]),[qn,Zn,$n,Mn,jn,Xn,Vn,zn,Hn,Wn]}class FilterReferenceInput extends SvelteComponent{constructor(ke){super(),init(this,ke,instance$Z,create_fragment$Z,safe_not_equal,{value:6,field:0})}}function get_each_context$k(_n,ke,Ce){const $n=_n.slice();return $n[39]=ke[Ce],$n}function get_each_context_1$8(_n,ke,Ce){const $n=_n.slice();return $n[42]=ke[Ce],$n}function get_each_context_2$2(_n,ke,Ce){const $n=_n.slice();return $n[39]=ke[Ce],$n}function create_if_block_4$8(_n){let ke,Ce,$n,Mn,Qn,Vn,qn,Zn;Ce=new Icon({props:{icon:"arrow-left"}});let jn=ensure_array_like(_n[9]),Xn=[];for(let zn=0;zn<jn.length;zn+=1)Xn[zn]=create_each_block_2$2(get_each_context_2$2(_n,jn,zn));return{c(){ke=element("button"),create_component(Ce.$$.fragment),$n=text(`
|
|
||||||
Back`),Mn=space$3();for(let zn=0;zn<Xn.length;zn+=1)Xn[zn].c();Qn=empty$1(),attr(ke,"class","dropdown-item button")},m(zn,Hn){insert$1(zn,ke,Hn),mount_component(Ce,ke,null),append(ke,$n),insert$1(zn,Mn,Hn);for(let Wn=0;Wn<Xn.length;Wn+=1)Xn[Wn]&&Xn[Wn].m(zn,Hn);insert$1(zn,Qn,Hn),Vn=!0,qn||(Zn=listen(ke,"click",_n[23]),qn=!0)},p(zn,Hn){if(Hn[0]&2560){jn=ensure_array_like(zn[9]);let Wn;for(Wn=0;Wn<jn.length;Wn+=1){const Yn=get_each_context_2$2(zn,jn,Wn);Xn[Wn]?Xn[Wn].p(Yn,Hn):(Xn[Wn]=create_each_block_2$2(Yn),Xn[Wn].c(),Xn[Wn].m(Qn.parentNode,Qn))}for(;Wn<Xn.length;Wn+=1)Xn[Wn].d(1);Xn.length=jn.length}},i(zn){Vn||(transition_in(Ce.$$.fragment,zn),Vn=!0)},o(zn){transition_out(Ce.$$.fragment,zn),Vn=!1},d(zn){zn&&(detach(ke),detach(Mn),detach(Qn)),destroy_component(Ce),destroy_each(Xn,zn),qn=!1,Zn()}}}function create_each_block_2$2(_n){let ke,Ce,$n;function Mn(...Qn){return _n[24](_n[39],...Qn)}return{c(){ke=element("button"),ke.textContent=`${_n[39].label} `,attr(ke,"class","dropdown-item button")},m(Qn,Vn){insert$1(Qn,ke,Vn),Ce||($n=listen(ke,"click",Mn),Ce=!0)},p(Qn,Vn){_n=Qn},d(Qn){Qn&&detach(ke),Ce=!1,$n()}}}function create_if_block_3$a(_n){let ke,Ce,$n,Mn,Qn,Vn,qn=_n[3].label+"",Zn,jn,Xn,zn,Hn,Wn;Ce=new Icon({props:{icon:"arrow-left"}});let Yn=ensure_array_like(_n[7]),Un=[];for(let Gn=0;Gn<Yn.length;Gn+=1)Un[Gn]=create_each_block_1$8(get_each_context_1$8(_n,Yn,Gn));return{c(){ke=element("button"),create_component(Ce.$$.fragment),$n=text(`
|
|
||||||
Back`),Mn=space$3(),Qn=element("div"),Vn=text("field: "),Zn=text(qn),jn=space$3();for(let Gn=0;Gn<Un.length;Gn+=1)Un[Gn].c();Xn=empty$1(),attr(ke,"class","dropdown-item button"),attr(Qn,"class","selected-filter")},m(Gn,Kn){insert$1(Gn,ke,Kn),mount_component(Ce,ke,null),append(ke,$n),insert$1(Gn,Mn,Kn),insert$1(Gn,Qn,Kn),append(Qn,Vn),append(Qn,Zn),insert$1(Gn,jn,Kn);for(let Jn=0;Jn<Un.length;Jn+=1)Un[Jn]&&Un[Jn].m(Gn,Kn);insert$1(Gn,Xn,Kn),zn=!0,Hn||(Wn=listen(ke,"click",_n[25]),Hn=!0)},p(Gn,Kn){if((!zn||Kn[0]&8)&&qn!==(qn=Gn[3].label+"")&&set_data(Zn,qn),Kn[0]&8320){Yn=ensure_array_like(Gn[7]);let Jn;for(Jn=0;Jn<Yn.length;Jn+=1){const tr=get_each_context_1$8(Gn,Yn,Jn);Un[Jn]?Un[Jn].p(tr,Kn):(Un[Jn]=create_each_block_1$8(tr),Un[Jn].c(),Un[Jn].m(Xn.parentNode,Xn))}for(;Jn<Un.length;Jn+=1)Un[Jn].d(1);Un.length=Yn.length}},i(Gn){zn||(transition_in(Ce.$$.fragment,Gn),zn=!0)},o(Gn){transition_out(Ce.$$.fragment,Gn),zn=!1},d(Gn){Gn&&(detach(ke),detach(Mn),detach(Qn),detach(jn),detach(Xn)),destroy_component(Ce),destroy_each(Un,Gn),Hn=!1,Wn()}}}function create_each_block_1$8(_n){let ke,Ce=_n[42].label+"",$n,Mn,Qn,Vn;function qn(...Zn){return _n[26](_n[42],...Zn)}return{c(){ke=element("button"),$n=text(Ce),Mn=space$3(),attr(ke,"class","dropdown-item button")},m(Zn,jn){insert$1(Zn,ke,jn),append(ke,$n),append(ke,Mn),Qn||(Vn=listen(ke,"click",qn),Qn=!0)},p(Zn,jn){_n=Zn,jn[0]&128&&Ce!==(Ce=_n[42].label+"")&&set_data($n,Ce)},d(Zn){Zn&&detach(ke),Qn=!1,Vn()}}}function create_if_block_2$b(_n){let ke,Ce,$n,Mn,Qn,Vn,qn=_n[3].label+"",Zn,jn,Xn=_n[5].label+"",zn,Hn,Wn,Yn,Un,Gn,Kn,Jn,tr;return Ce=new Icon({props:{icon:"arrow-left"}}),{c(){ke=element("button"),create_component(Ce.$$.fragment),$n=text(`
|
|
||||||
Back`),Mn=space$3(),Qn=element("div"),Vn=text("field: "),Zn=text(qn),jn=text(" operator: "),zn=text(Xn),Hn=space$3(),Wn=element("div"),Yn=element("input"),Un=space$3(),Gn=element("button"),Gn.textContent="Add filter",attr(ke,"class","dropdown-item button"),attr(Qn,"class","selected-filter"),attr(Yn,"type","text"),attr(Yn,"class","form-control"),attr(Wn,"class","filter-input"),attr(Gn,"class","button applied-filter"),attr(Gn,"type","button")},m(nr,er){insert$1(nr,ke,er),mount_component(Ce,ke,null),append(ke,$n),insert$1(nr,Mn,er),insert$1(nr,Qn,er),append(Qn,Vn),append(Qn,Zn),append(Qn,jn),append(Qn,zn),insert$1(nr,Hn,er),insert$1(nr,Wn,er),append(Wn,Yn),set_input_value(Yn,_n[2]),insert$1(nr,Un,er),insert$1(nr,Gn,er),Kn=!0,Jn||(tr=[listen(ke,"click",_n[27]),listen(Yn,"input",_n[28]),listen(Gn,"click",_n[14])],Jn=!0)},p(nr,er){(!Kn||er[0]&8)&&qn!==(qn=nr[3].label+"")&&set_data(Zn,qn),(!Kn||er[0]&32)&&Xn!==(Xn=nr[5].label+"")&&set_data(zn,Xn),er[0]&4&&Yn.value!==nr[2]&&set_input_value(Yn,nr[2])},i(nr){Kn||(transition_in(Ce.$$.fragment,nr),Kn=!0)},o(nr){transition_out(Ce.$$.fragment,nr),Kn=!1},d(nr){nr&&(detach(ke),detach(Mn),detach(Qn),detach(Hn),detach(Wn),detach(Un),detach(Gn)),destroy_component(Ce),Jn=!1,run_all(tr)}}}function create_if_block_1$l(_n){let ke,Ce,$n,Mn,Qn,Vn,qn,Zn;Ce=new Icon({props:{icon:"arrow-left"}});let jn=ensure_array_like(_n[10]),Xn=[];for(let zn=0;zn<jn.length;zn+=1)Xn[zn]=create_each_block$k(get_each_context$k(_n,jn,zn));return{c(){ke=element("button"),create_component(Ce.$$.fragment),$n=text(`
|
|
||||||
Back`),Mn=space$3();for(let zn=0;zn<Xn.length;zn+=1)Xn[zn].c();Qn=empty$1(),attr(ke,"class","dropdown-item button")},m(zn,Hn){insert$1(zn,ke,Hn),mount_component(Ce,ke,null),append(ke,$n),insert$1(zn,Mn,Hn);for(let Wn=0;Wn<Xn.length;Wn+=1)Xn[Wn]&&Xn[Wn].m(zn,Hn);insert$1(zn,Qn,Hn),Vn=!0,qn||(Zn=listen(ke,"click",_n[29]),qn=!0)},p(zn,Hn){if(Hn[0]&5120){jn=ensure_array_like(zn[10]);let Wn;for(Wn=0;Wn<jn.length;Wn+=1){const Yn=get_each_context$k(zn,jn,Wn);Xn[Wn]?Xn[Wn].p(Yn,Hn):(Xn[Wn]=create_each_block$k(Yn),Xn[Wn].c(),Xn[Wn].m(Qn.parentNode,Qn))}for(;Wn<Xn.length;Wn+=1)Xn[Wn].d(1);Xn.length=jn.length}},i(zn){Vn||(transition_in(Ce.$$.fragment,zn),Vn=!0)},o(zn){transition_out(Ce.$$.fragment,zn),Vn=!1},d(zn){zn&&(detach(ke),detach(Mn),detach(Qn)),destroy_component(Ce),destroy_each(Xn,zn),qn=!1,Zn()}}}function create_each_block$k(_n){let ke,Ce,$n;function Mn(...Qn){return _n[30](_n[39],...Qn)}return{c(){ke=element("button"),ke.textContent=`${_n[39].label} `,attr(ke,"class","dropdown-item button")},m(Qn,Vn){insert$1(Qn,ke,Vn),Ce||($n=listen(ke,"click",Mn),Ce=!0)},p(Qn,Vn){_n=Qn},d(Qn){Qn&&detach(ke),Ce=!1,$n()}}}function create_if_block$E(_n){let ke,Ce,$n,Mn,Qn,Vn,qn=_n[4].label+"",Zn,jn,Xn,zn,Hn,Wn,Yn,Un;Ce=new Icon({props:{icon:"arrow-left"}});function Gn(Jn){_n[32](Jn)}let Kn={field:_n[4]};return _n[2]!==void 0&&(Kn.value=_n[2]),zn=new FilterReferenceInput({props:Kn}),binding_callbacks.push(()=>bind(zn,"value",Gn)),zn.$on("addFilter",_n[14]),{c(){ke=element("button"),create_component(Ce.$$.fragment),$n=text(`
|
|
||||||
Back`),Mn=space$3(),Qn=element("div"),Vn=text("field: "),Zn=text(qn),jn=space$3(),Xn=element("div"),create_component(zn.$$.fragment),attr(ke,"class","dropdown-item button"),attr(Qn,"class","selected-filter"),attr(Xn,"class","mt-2")},m(Jn,tr){insert$1(Jn,ke,tr),mount_component(Ce,ke,null),append(ke,$n),insert$1(Jn,Mn,tr),insert$1(Jn,Qn,tr),append(Qn,Vn),append(Qn,Zn),insert$1(Jn,jn,tr),insert$1(Jn,Xn,tr),mount_component(zn,Xn,null),Wn=!0,Yn||(Un=listen(ke,"click",_n[31]),Yn=!0)},p(Jn,tr){(!Wn||tr[0]&16)&&qn!==(qn=Jn[4].label+"")&&set_data(Zn,qn);const nr={};tr[0]&16&&(nr.field=Jn[4]),!Hn&&tr[0]&4&&(Hn=!0,nr.value=Jn[2],add_flush_callback(()=>Hn=!1)),zn.$set(nr)},i(Jn){Wn||(transition_in(Ce.$$.fragment,Jn),transition_in(zn.$$.fragment,Jn),Wn=!0)},o(Jn){transition_out(Ce.$$.fragment,Jn),transition_out(zn.$$.fragment,Jn),Wn=!1},d(Jn){Jn&&(detach(ke),detach(Mn),detach(Qn),detach(jn),detach(Xn)),destroy_component(Ce),destroy_component(zn),Yn=!1,Un()}}}function create_default_slot$8(_n){let ke,Ce,$n,Mn,Qn,Vn,qn,Zn,jn,Xn,zn,Hn,Wn,Yn,Un,Gn,Kn,Jn,tr,nr,er,rr,or,ir,sr,cr,ur=!_n[3]&&create_if_block_4$8(_n),fr=_n[3]&&!_n[5]&&create_if_block_3$a(_n),pr=_n[3]&&_n[5]&&create_if_block_2$b(_n),mr=!_n[4]&&create_if_block_1$l(_n),_r=_n[4]&&create_if_block$E(_n);return Kn=new Icon({props:{icon:"arrow-left"}}),{c(){ke=element("div"),Ce=element("button"),Ce.textContent="Filter by field",$n=space$3(),Mn=element("button"),Mn.textContent="Filter by Reference",Qn=space$3(),Vn=element("button"),Vn.textContent="Advanced filter",qn=space$3(),Zn=element("div"),ur&&ur.c(),jn=space$3(),fr&&fr.c(),Xn=space$3(),pr&&pr.c(),zn=space$3(),Hn=element("div"),mr&&mr.c(),Wn=space$3(),_r&&_r.c(),Yn=space$3(),Un=element("div"),Gn=element("button"),create_component(Kn.$$.fragment),Jn=text(`
|
|
||||||
Back`),tr=space$3(),nr=element("form"),er=element("input"),rr=space$3(),or=element("button"),or.textContent="Submit",attr(Ce,"class","dropdown-item button"),attr(Mn,"class","dropdown-item button"),attr(Vn,"class","dropdown-item button"),toggle_class(ke,"hide",_n[6]!=="main"),toggle_class(Zn,"hide",_n[6]!=="byField"),toggle_class(Hn,"hide",_n[6]!=="byReference"),attr(Gn,"class","dropdown-item button"),attr(er,"type","search"),attr(er,"class","mb-2 mt-2"),attr(er,"placeholder","Advanced filters"),er.required=!0,attr(or,"class","button applied-filter"),toggle_class(Un,"hide",_n[6]!=="advanced")},m(vr,hr){insert$1(vr,ke,hr),append(ke,Ce),append(ke,$n),append(ke,Mn),append(ke,Qn),append(ke,Vn),insert$1(vr,qn,hr),insert$1(vr,Zn,hr),ur&&ur.m(Zn,null),append(Zn,jn),fr&&fr.m(Zn,null),append(Zn,Xn),pr&&pr.m(Zn,null),insert$1(vr,zn,hr),insert$1(vr,Hn,hr),mr&&mr.m(Hn,null),append(Hn,Wn),_r&&_r.m(Hn,null),insert$1(vr,Yn,hr),insert$1(vr,Un,hr),append(Un,Gn),mount_component(Kn,Gn,null),append(Gn,Jn),append(Un,tr),append(Un,nr),append(nr,er),set_input_value(er,_n[1]),append(nr,rr),append(nr,or),ir=!0,sr||(cr=[listen(Ce,"click",_n[20]),listen(Mn,"click",_n[21]),listen(Vn,"click",_n[22]),listen(Gn,"click",_n[33]),listen(er,"input",_n[34]),listen(nr,"submit",_n[8])],sr=!0)},p(vr,hr){(!ir||hr[0]&64)&&toggle_class(ke,"hide",vr[6]!=="main"),vr[3]?ur&&(group_outros(),transition_out(ur,1,1,()=>{ur=null}),check_outros()):ur?(ur.p(vr,hr),hr[0]&8&&transition_in(ur,1)):(ur=create_if_block_4$8(vr),ur.c(),transition_in(ur,1),ur.m(Zn,jn)),vr[3]&&!vr[5]?fr?(fr.p(vr,hr),hr[0]&40&&transition_in(fr,1)):(fr=create_if_block_3$a(vr),fr.c(),transition_in(fr,1),fr.m(Zn,Xn)):fr&&(group_outros(),transition_out(fr,1,1,()=>{fr=null}),check_outros()),vr[3]&&vr[5]?pr?(pr.p(vr,hr),hr[0]&40&&transition_in(pr,1)):(pr=create_if_block_2$b(vr),pr.c(),transition_in(pr,1),pr.m(Zn,null)):pr&&(group_outros(),transition_out(pr,1,1,()=>{pr=null}),check_outros()),(!ir||hr[0]&64)&&toggle_class(Zn,"hide",vr[6]!=="byField"),vr[4]?mr&&(group_outros(),transition_out(mr,1,1,()=>{mr=null}),check_outros()):mr?(mr.p(vr,hr),hr[0]&16&&transition_in(mr,1)):(mr=create_if_block_1$l(vr),mr.c(),transition_in(mr,1),mr.m(Hn,Wn)),vr[4]?_r?(_r.p(vr,hr),hr[0]&16&&transition_in(_r,1)):(_r=create_if_block$E(vr),_r.c(),transition_in(_r,1),_r.m(Hn,null)):_r&&(group_outros(),transition_out(_r,1,1,()=>{_r=null}),check_outros()),(!ir||hr[0]&64)&&toggle_class(Hn,"hide",vr[6]!=="byReference"),hr[0]&2&&er.value!==vr[1]&&set_input_value(er,vr[1]),(!ir||hr[0]&64)&&toggle_class(Un,"hide",vr[6]!=="advanced")},i(vr){ir||(transition_in(ur),transition_in(fr),transition_in(pr),transition_in(mr),transition_in(_r),transition_in(Kn.$$.fragment,vr),ir=!0)},o(vr){transition_out(ur),transition_out(fr),transition_out(pr),transition_out(mr),transition_out(_r),transition_out(Kn.$$.fragment,vr),ir=!1},d(vr){vr&&(detach(ke),detach(qn),detach(Zn),detach(zn),detach(Hn),detach(Yn),detach(Un)),ur&&ur.d(),fr&&fr.d(),pr&&pr.d(),mr&&mr.d(),_r&&_r.d(),destroy_component(Kn),sr=!1,run_all(cr)}}}function create_button_slot$7(_n){let ke,Ce,$n,Mn,Qn;return Ce=new Icon({props:{icon:"filter"}}),{c(){ke=element("div"),create_component(Ce.$$.fragment),$n=space$3(),Mn=element("span"),Mn.textContent="Filter",attr(Mn,"class","ms-1"),attr(ke,"slot","button")},m(Vn,qn){insert$1(Vn,ke,qn),mount_component(Ce,ke,null),append(ke,$n),append(ke,Mn),Qn=!0},p:noop,i(Vn){Qn||(transition_in(Ce.$$.fragment,Vn),Qn=!0)},o(Vn){transition_out(Ce.$$.fragment,Vn),Qn=!1},d(Vn){Vn&&detach(ke),destroy_component(Ce)}}}function create_fragment$Y(_n){let ke,Ce,$n,Mn={$$slots:{button:[create_button_slot$7],default:[create_default_slot$8]},$$scope:{ctx:_n}};return Ce=new Dropdown({props:Mn}),_n[35](Ce),{c(){ke=element("div"),create_component(Ce.$$.fragment)},m(Qn,Vn){insert$1(Qn,ke,Vn),mount_component(Ce,ke,null),$n=!0},p(Qn,Vn){const qn={};Vn[0]&254|Vn[1]&65536&&(qn.$$scope={dirty:Vn,ctx:Qn}),Ce.$set(qn)},i(Qn){$n||(transition_in(Ce.$$.fragment,Qn),$n=!0)},o(Qn){transition_out(Ce.$$.fragment,Qn),$n=!1},d(Qn){Qn&&detach(ke),_n[35](null),destroy_component(Ce)}}}function instance$Y(_n,ke,Ce){const $n=createEventDispatcher();let{schema:Mn}=ke,{systemFields:Qn=[]}=ke,{operators:Vn}=ke,{inModal:qn}=ke,{modalUrl:Zn}=ke,jn,Xn="",zn=Qn;Mn.type==="collection"&&(zn=Qn.filter(Or=>Or.files===!1));function Hn(Or){Or.preventDefault();let kr=Xn.split("=")[0]??"";if(!kr)return;let Ar=`filter[${kr}]`,jr=Xn.split("=")[1]??"";if(!jr)return;const qr=new URL(Zn??window.location.href);qr.searchParams.set("skip","0"),qr.searchParams.set(Ar,jr),qn?$n("refresh",qr):window.location.replace(qr),sr()}let Wn=null,Yn=null,Un=null,Gn=null,Kn="main",Jn=null,tr=[...Mn.fields,...zn].filter(Or=>{var kr;return!["file","json","reference"].includes(((kr=Or.info)==null?void 0:kr.name)??Or.ui)}),nr=[...Mn.fields].filter(Or=>{var kr;return["reference"].includes(((kr=Or.info)==null?void 0:kr.name)??Or.ui)});function er(Or,kr){Ce(3,Yn=kr),Ce(7,Jn=Vn.filter(Ar=>{var jr;return Ar.uis.inc
Line truncated
|
|
||||||
Upload file
|
|
||||||
|
|
||||||
`),Qn=element("input"),attr($n,"class","spinner-border spinner-border-sm"),attr($n,"role","status"),attr($n,"aria-hidden","true"),attr(Qn,"class","form-control"),attr(Qn,"type","file"),attr(Qn,"id","formFile"),Qn.multiple=!0,attr(Qn,"accept",mimeTypes),Qn.disabled=_n[0],Qn.hidden=!0,attr(Ce,"class","button primary btn-spinner "),attr(ke,"class","upload-button"),ke.disabled=_n[0]},m(Zn,jn){insert$1(Zn,ke,jn),append(ke,Ce),append(Ce,$n),append(Ce,Mn),append(Ce,Qn),Vn||(qn=listen(Qn,"input",_n[1]),Vn=!0)},p(Zn,[jn]){jn&1&&(Qn.disabled=Zn[0]),jn&1&&(ke.disabled=Zn[0])},i:noop,o:noop,d(Zn){Zn&&detach(ke),Vn=!1,qn()}}}let mimeTypes="";function instance$X(_n,ke,Ce){const $n=createEventDispatcher(),Mn=getContext$1("channel");let{schema:Qn}=ke,Vn=[],qn=!1;function Zn(jn){Ce(0,qn=!0),Vn=jn.target.files?[...jn.target.files]:[];let Xn=new FormData;Xn.append("schema",Qn.name),Array.from(Vn).forEach(function(zn){Xn.append("files[]",zn)}),$n("beforeUpload",Vn),axios.post(Mn.lucentUrl+"/files/upload",Xn,{headers:{"Content-Type":"multipart/form-data"}}).then(zn=>{zn.data.error?$n("uploadError",zn.data.error):$n("uploadComplete",zn.data),Ce(0,qn=!1)}).catch(zn=>{Ce(0,qn=!1),console.log(zn.response.data)})}return _n.$$set=jn=>{"schema"in jn&&Ce(2,Qn=jn.schema)},[qn,Zn,Qn]}class Uploader extends SvelteComponent{constructor(ke){super(),init(this,ke,instance$X,create_fragment$X,safe_not_equal,{schema:2})}}function get_each_context$j(_n,ke,Ce){const $n=_n.slice();return $n[18]=ke[Ce],$n}function get_each_context_1$7(_n,ke,Ce){const $n=_n.slice();return $n[18]=ke[Ce],$n}function create_each_block_1$7(_n){let ke,Ce,$n,Mn,Qn,Vn,qn,Zn,jn,Xn,zn=_n[18].label+"",Hn,Wn,Yn,Un;$n=new Icon({props:{icon:"arrow-up-short-wide"}});function Gn(...tr){return _n[10](_n[18],...tr)}qn=new Icon({props:{icon:"arrow-down-wide-short"}});function Kn(...tr){return _n[11](_n[18],...tr)}function Jn(...tr){return _n[12](_n[18],...tr)}return{c(){ke=element("div"),Ce=element("button"),create_component($n.$$.fragment),Qn=space$3(),Vn=element("button"),create_component(qn.$$.fragment),jn=space$3(),Xn=element("button"),Hn=text(zn),attr(Ce,"title","Sort Ascending"),attr(Ce,"class",Mn="button button-icon "+(_n[18].name==_n[1].name&&!_n[0].startsWith("-")?"active":"")),attr(Vn,"title","Sort Descending"),attr(Vn,"class",Zn="button button-icon "+(_n[18].name==_n[1].name&&_n[0].startsWith("-")?"active":"")),attr(Xn,"title","Sort Ascending"),attr(Xn,"class","button"),attr(ke,"class","dropdown-item")},m(tr,nr){insert$1(tr,ke,nr),append(ke,Ce),mount_component($n,Ce,null),append(ke,Qn),append(ke,Vn),mount_component(qn,Vn,null),append(ke,jn),append(ke,Xn),append(Xn,Hn),Wn=!0,Yn||(Un=[listen(Ce,"click",Gn),listen(Vn,"click",Kn),listen(Xn,"click",Jn)],Yn=!0)},p(tr,nr){_n=tr,(!Wn||nr&11&&Mn!==(Mn="button button-icon "+(_n[18].name==_n[1].name&&!_n[0].startsWith("-")?"active":"")))&&attr(Ce,"class",Mn),(!Wn||nr&11&&Zn!==(Zn="button button-icon "+(_n[18].name==_n[1].name&&_n[0].startsWith("-")?"active":"")))&&attr(Vn,"class",Zn),(!Wn||nr&8)&&zn!==(zn=_n[18].label+"")&&set_data(Hn,zn)},i(tr){Wn||(transition_in($n.$$.fragment,tr),transition_in(qn.$$.fragment,tr),Wn=!0)},o(tr){transition_out($n.$$.fragment,tr),transition_out(qn.$$.fragment,tr),Wn=!1},d(tr){tr&&detach(ke),destroy_component($n),destroy_component(qn),Yn=!1,run_all(Un)}}}function create_each_block$j(_n){let ke,Ce,$n,Mn,Qn,Vn,qn,Zn,jn,Xn,zn=_n[18].label+"",Hn,Wn,Yn,Un,Gn;$n=new Icon({props:{icon:"arrow-up-short-wide"}});function Kn(...nr){return _n[13](_n[18],...nr)}qn=new Icon({props:{icon:"arrow-down-wide-short"}});function Jn(...nr){return _n[14](_n[18],...nr)}function tr(...nr){return _n[15](_n[18],...nr)}return{c(){ke=element("div"),Ce=element("button"),create_component($n.$$.fragment),Qn=space$3(),Vn=element("button"),create_component(qn.$$.fragment),jn=space$3(),Xn=element("button"),Hn=text(zn),Wn=space$3(),attr(Ce,"title","Sort Ascending"),attr(Ce,"class",Mn="button button-icon "+(_n[18].name==_n[0]?"active":"")),attr(Vn,"title","Sort Descending"),attr(Vn,"class",Zn="button button-icon "+("-"+_n[18].name==_n[0]?"active":"")),attr(Xn,"title","Sort Ascending"),attr(Xn,"class","button"),attr(ke,"class","dropdown-item")},m(nr,er){insert$1(nr,ke,er),append(ke,Ce),mount_component($n,Ce,null),append(ke,Qn),append(ke,Vn),mount_component(qn,Vn,null),append(ke,jn),append(ke,Xn),append(Xn,Hn),append(ke,Wn),Yn=!0,Un||(Gn=[listen(Ce,"click",Kn),listen(Vn,"click",Jn),listen(Xn,"click",tr)],Un=!0)},p(nr,er){_n=nr,(!Yn||er&5&&Mn!==(Mn="button button-icon "+(_n[18].name==_n[0]?"active":"")))&&attr(Ce,"class",Mn),(!Yn||er&5&&Zn!==(Zn="button button-icon "+("-"+_n[18].name==_n[0]?"active":"")))&&attr(Vn,"class",Zn),(!Yn||er&4)&&zn!==(zn=_n[18].label+"")&&set_data(Hn,zn)},i(nr){Yn||(transition_in($n.$$.fragment,nr),transition_in(qn.$$.fragment,nr),Yn=!0)},o(nr){transition_out($n.$$.fragment,nr),transition_out(qn.$$.fragment,nr),Yn=!1},d(nr){nr&&detach(ke),destroy_component($n),destroy_component(qn),Un=!1,run_all(Gn)}}}func
Line truncated
|
|
||||||
|
|
||||||
`),$n=element("button"),create_component(Mn.$$.fragment),attr($n,"type","button"),attr($n,"class","button-text"),attr($n,"aria-label","Close"),attr(ke,"class","applied-filter")},m(Zn,jn){insert$1(Zn,ke,jn),append(ke,Ce),append(ke,$n),mount_component(Mn,$n,null),Qn=!0,Vn||(qn=listen($n,"click",prevent_default(_n[4])),Vn=!0)},p:noop,i(Zn){Qn||(transition_in(Mn.$$.fragment,Zn),Qn=!0)},o(Zn){transition_out(Mn.$$.fragment,Zn),Qn=!1},d(Zn){Zn&&detach(ke),destroy_component(Mn),Vn=!1,qn()}}}function create_fragment$U(_n){let ke=_n[0].searchParams.get("notlinked"),Ce,$n,Mn=ke&&create_if_block$B(_n);return{c(){Mn&&Mn.c(),Ce=empty$1()},m(Qn,Vn){Mn&&Mn.m(Qn,Vn),insert$1(Qn,Ce,Vn),$n=!0},p(Qn,[Vn]){ke&&Mn.p(Qn,Vn)},i(Qn){$n||(transition_in(Mn),$n=!0)},o(Qn){transition_out(Mn),$n=!1},d(Qn){Qn&&detach(Ce),Mn&&Mn.d(Qn)}}}function instance$U(_n,ke,Ce){getContext$1("channel");const $n=createEventDispatcher();let{inModal:Mn}=ke,{modalUrl:Qn}=ke;const Vn=new URL(Qn??window.location.href);function qn(jn){const Xn=new URL(Qn??window.location.href);Xn.searchParams.set("skip","0"),Xn.searchParams.delete("notlinked"),Mn?$n("refresh",Xn):window.location.replace(Xn)}const Zn=()=>qn();return _n.$$set=jn=>{"inModal"in jn&&Ce(2,Mn=jn.inModal),"modalUrl"in jn&&Ce(3,Qn=jn.modalUrl)},[Vn,qn,Mn,Qn,Zn]}class AppliedFilterNotLinked extends SvelteComponent{constructor(ke){super(),init(this,ke,instance$U,create_fragment$U,safe_not_equal,{inModal:2,modalUrl:3})}}function get_each_context$i(_n,ke,Ce){const $n=_n.slice();return $n[22]=ke[Ce][0],$n[23]=ke[Ce][1],$n}function create_else_block_1$2(_n){let ke,Ce,$n;return Ce=new Uploader({props:{schema:_n[0]}}),Ce.$on("uploadComplete",_n[13]),{c(){ke=element("div"),create_component(Ce.$$.fragment)},m(Mn,Qn){insert$1(Mn,ke,Qn),mount_component(Ce,ke,null),$n=!0},p(Mn,Qn){const Vn={};Qn&1&&(Vn.schema=Mn[0]),Ce.$set(Vn)},i(Mn){$n||(transition_in(Ce.$$.fragment,Mn),$n=!0)},o(Mn){transition_out(Ce.$$.fragment,Mn),$n=!1},d(Mn){Mn&&detach(ke),destroy_component(Ce)}}}function create_if_block_4$7(_n){let ke,Ce=!_n[5]&&_n[7]&&create_if_block_5$3(_n);return{c(){Ce&&Ce.c(),ke=empty$1()},m($n,Mn){Ce&&Ce.m($n,Mn),insert$1($n,ke,Mn)},p($n,Mn){!$n[5]&&$n[7]?Ce?Ce.p($n,Mn):(Ce=create_if_block_5$3($n),Ce.c(),Ce.m(ke.parentNode,ke)):Ce&&(Ce.d(1),Ce=null)},i:noop,o:noop,d($n){$n&&detach(ke),Ce&&Ce.d($n)}}}function create_if_block_5$3(_n){let ke,Ce,$n;return{c(){ke=element("a"),Ce=text("New Record"),attr(ke,"href",$n=_n[10].lucentUrl+"/records/new?schema="+_n[0].name),attr(ke,"class","button")},m(Mn,Qn){insert$1(Mn,ke,Qn),append(ke,Ce)},p(Mn,Qn){Qn&1&&$n!==($n=Mn[10].lucentUrl+"/records/new?schema="+Mn[0].name)&&attr(ke,"href",$n)},d(Mn){Mn&&detach(ke)}}}function create_if_block_1$k(_n){let ke,Ce;return ke=new Dropdown({props:{orientation:"right",$$slots:{button:[create_button_slot$5],default:[create_default_slot$6]},$$scope:{ctx:_n}}}),{c(){create_component(ke.$$.fragment)},m($n,Mn){mount_component(ke,$n,Mn),Ce=!0},p($n,Mn){const Qn={};Mn&67109009&&(Qn.$$scope={dirty:Mn,ctx:$n}),ke.$set(Qn)},i($n){Ce||(transition_in(ke.$$.fragment,$n),Ce=!0)},o($n){transition_out(ke.$$.fragment,$n),Ce=!1},d($n){destroy_component(ke,$n)}}}function create_else_block$h(_n){let ke,Ce,$n,Mn,Qn,Vn,qn,Zn,jn,Xn;return{c(){ke=element("a"),Ce=text("Export to CSV"),$n=space$3(),Mn=element("a"),Qn=text("View trashed records"),qn=space$3(),Zn=element("a"),jn=text("View unlinked records"),attr(ke,"class","dropdown-item"),attr(ke,"href",_n[11]),attr(Mn,"class","dropdown-item"),attr(Mn,"href",Vn=_n[10].lucentUrl+"/content/"+_n[0].name+"?filter[status_in]=trashed"),attr(Zn,"class","dropdown-item"),attr(Zn,"href",Xn=_n[10].lucentUrl+"/content/"+_n[0].name+"?notlinked=*")},m(zn,Hn){insert$1(zn,ke,Hn),append(ke,Ce),insert$1(zn,$n,Hn),insert$1(zn,Mn,Hn),append(Mn,Qn),insert$1(zn,qn,Hn),insert$1(zn,Zn,Hn),append(Zn,jn)},p(zn,Hn){Hn&1&&Vn!==(Vn=zn[10].lucentUrl+"/content/"+zn[0].name+"?filter[status_in]=trashed")&&attr(Mn,"href",Vn),Hn&1&&Xn!==(Xn=zn[10].lucentUrl+"/content/"+zn[0].name+"?notlinked=*")&&attr(Zn,"href",Xn)},d(zn){zn&&(detach(ke),detach($n),detach(Mn),detach(qn),detach(Zn))}}}function create_if_block_2$a(_n){let ke,Ce=_n[7]&&create_if_block_3$9(_n);return{c(){Ce&&Ce.c(),ke=empty$1()},m($n,Mn){Ce&&Ce.m($n,Mn),insert$1($n,ke,Mn)},p($n,Mn){$n[7]?Ce?Ce.p($n,Mn):(Ce=create_if_block_3$9($n),Ce.c(),Ce.m(ke.parentNode,ke)):Ce&&(Ce.d(1),Ce=null)},d($n){$n&&detach(ke),Ce&&Ce.d($n)}}}function create_if_block_3$9(_n){let ke,Ce,$n;return{c(){ke=element("a"),Ce=text("Empty trash"),attr(ke,"class","dropdown-item"),attr(ke,"href",$n=_n[10].lucentUrl+"/content/"+_n[0].name+"/emptyTrash")},m(Mn,Qn){insert$1(Mn,ke,Qn),append(ke,Ce)},p(Mn,Qn){Qn&1&&$n!==($n=Mn[10].lucentUrl+"/content/"+Mn[0].name+"/emptyTrash")&&attr(ke,"href",$n)},d(Mn){Mn&&detach(ke)}}}function create_default_slot$6(_n){let ke;function Ce(Qn,Vn){return Qn[4].status_in==="trashed"?create_if_block_2$a:create_else_block$h}let $n=Ce(_n),Mn=$n(_n);return{c(){Mn.c(),ke=empty$1()},m(Qn,Vn){Mn.m(
Line truncated
|
|
||||||
`),Vn=element("span"),Zn=text(qn),jn=text(`
|
|
||||||
to
|
|
||||||
`),Xn=element("span"),Hn=text(zn),Wn=text(`
|
|
||||||
of
|
|
||||||
`),Yn=element("span"),Un=text(_n[4]),Gn=text(`
|
|
||||||
total`),attr(Ce,"class","pagination"),attr(Vn,"class","font-medium"),attr(Xn,"class","font-medium"),attr(Yn,"class","font-medium"),set_style(Mn,"display","flex"),set_style(Mn,"justify-content","center"),set_style(Mn,"gap","4px")},m(tr,nr){insert$1(tr,ke,nr),append(ke,Ce),Jn&&Jn.m(Ce,null),insert$1(tr,$n,nr),insert$1(tr,Mn,nr),append(Mn,Qn),append(Mn,Vn),append(Vn,Zn),append(Mn,jn),append(Mn,Xn),append(Xn,Hn),append(Mn,Wn),append(Mn,Yn),append(Yn,Un),append(Mn,Gn),Kn=!0},p(tr,[nr]){tr[5]>1?Jn?(Jn.p(tr,nr),nr&32&&transition_in(Jn,1)):(Jn=create_if_block$y(tr),Jn.c(),transition_in(Jn,1),Jn.m(Ce,null)):Jn&&(group_outros(),transition_out(Jn,1,1,()=>{Jn=null}),check_outros()),(!Kn||nr&8)&&qn!==(qn=+tr[3]+1+"")&&set_data(Zn,qn),(!Kn||nr&28)&&zn!==(zn=(+tr[3]+tr[2]>tr[4]?tr[4]:+tr[3]+tr[2])+"")&&set_data(Hn,zn),(!Kn||nr&16)&&set_data(Un,tr[4])},i(tr){Kn||(transition_in(Jn),Kn=!0)},o(tr){transition_out(Jn),Kn=!1},d(tr){tr&&(detach(ke),detach($n),detach(Mn)),Jn&&Jn.d()}}}function instance$R(_n,ke,Ce){let $n,Mn,Qn;const Vn=createEventDispatcher();let{inModal:qn}=ke,{modalUrl:Zn}=ke,{limit:jn}=ke,{skip:Xn}=ke,{total:zn}=ke;function Hn(Gn){Gn.preventDefault(),Yn($n)}function Wn(Gn){Gn.preventDefault(),Yn(1)}function Yn(Gn){const Kn=new URL(Zn??window.location.href);let Jn=Gn*jn-jn;Kn.searchParams.set("skip",Jn),qn?Vn("refresh",Kn):window.location=Kn}function Un(Gn){bubble.call(this,_n,Gn)}return _n.$$set=Gn=>{"inModal"in Gn&&Ce(0,qn=Gn.inModal),"modalUrl"in Gn&&Ce(1,Zn=Gn.modalUrl),"limit"in Gn&&Ce(2,jn=Gn.limit),"skip"in Gn&&Ce(3,Xn=Gn.skip),"total"in Gn&&Ce(4,zn=Gn.total)},_n.$$.update=()=>{_n.$$.dirty&20&&Ce(5,$n=Math.ceil(zn/jn)),_n.$$.dirty&12&&Ce(6,Mn=Math.ceil((Xn-1)/jn)+1),_n.$$.dirty&96&&Ce(7,Qn=range(Mn-3,Mn+4).filter(Gn=>Gn>0&&Gn<=$n))},[qn,Zn,jn,Xn,zn,$n,Mn,Qn,Hn,Wn,Un]}class Pagination extends SvelteComponent{constructor(ke){super(),init(this,ke,instance$R,create_fragment$R,safe_not_equal,{inModal:0,modalUrl:1,limit:2,skip:3,total:4})}}function create_else_block$f(_n){let ke,Ce,$n;return{c(){ke=element("button"),ke.textContent="Move to trash",attr(ke,"type","button"),attr(ke,"class","button")},m(Mn,Qn){insert$1(Mn,ke,Qn),Ce||($n=listen(ke,"click",prevent_default(_n[7])),Ce=!0)},p:noop,d(Mn){Mn&&detach(ke),Ce=!1,$n()}}}function create_if_block$x(_n){let ke,Ce,$n;return{c(){ke=element("button"),ke.textContent="Delete forever",attr(ke,"type","button"),attr(ke,"class","button")},m(Mn,Qn){insert$1(Mn,ke,Qn),Ce||($n=listen(ke,"click",prevent_default(_n[2])),Ce=!0)},p:noop,d(Mn){Mn&&detach(ke),Ce=!1,$n()}}}function create_fragment$Q(_n){let ke,Ce,$n=_n[0].length+"",Mn,Qn,Vn,qn,Zn,jn,Xn,zn,Hn;function Wn(Gn,Kn){return Gn[1].status_in==="trashed"?create_if_block$x:create_else_block$f}let Yn=Wn(_n),Un=Yn(_n);return{c(){ke=element("div"),Ce=element("span"),Mn=text($n),Qn=text(" records selected"),Vn=space$3(),qn=element("button"),qn.textContent="Publish",Zn=space$3(),jn=element("button"),jn.textContent="Make Draft",Xn=space$3(),Un.c(),attr(Ce,"class","me-2"),attr(qn,"type","button"),attr(qn,"class","button"),attr(jn,"type","button"),attr(jn,"class","button"),set_style(ke,"display","flex"),set_style(ke,"align-items","center"),set_style(ke,"gap","8px")},m(Gn,Kn){insert$1(Gn,ke,Kn),append(ke,Ce),append(Ce,Mn),append(Ce,Qn),append(ke,Vn),append(ke,qn),append(ke,Zn),append(ke,jn),append(ke,Xn),Un.m(ke,null),zn||(Hn=[listen(qn,"click",prevent_default(_n[5])),listen(jn,"click",prevent_default(_n[6]))],zn=!0)},p(Gn,[Kn]){Kn&1&&$n!==($n=Gn[0].length+"")&&set_data(Mn,$n),Yn===(Yn=Wn(Gn))&&Un?Un.p(Gn,Kn):(Un.d(1),Un=Yn(Gn),Un&&(Un.c(),Un.m(ke,null)))},i:noop,o:noop,d(Gn){Gn&&detach(ke),Un.d(),zn=!1,run_all(Hn)}}}function instance$Q(_n,ke,Ce){const $n=getContext$1("channel");let{selected:Mn}=ke,{schema:Qn}=ke,{filter:Vn}=ke;function qn(Hn){Hn.preventDefault(),axios$1.post($n.lucentUrl+"/records/delete",{ids:Mn.map(Wn=>Wn.id)}).then(Wn=>{window.location.reload()}).catch(Wn=>{console.error(Wn)})}function Zn(Hn,Wn){axios$1.post($n.lucentUrl+"/records/status/"+Wn,{schemaName:Qn.name,records:Mn.map(Yn=>Yn.id)}).then(Yn=>{window.location.reload()}).catch(Yn=>{console.error(Yn)})}const jn=Hn=>Zn(Hn,"published"),Xn=Hn=>Zn(Hn,"draft"),zn=Hn=>Zn(Hn,"trashed");return _n.$$set=Hn=>{"selected"in Hn&&Ce(0,Mn=Hn.selected),"schema"in Hn&&Ce(4,Qn=Hn.schema),"filter"in Hn&&Ce(1,Vn=Hn.filter)},[Mn,Vn,qn,Zn,Qn,jn,Xn,zn]}class ActionsOnSelected extends SvelteComponent{constructor(ke){super(),init(this,ke,instance$Q,create_fragment$Q,safe_not_equal,{selected:0,schema:4,filter:1})}}function create_fragment$P(_n){let ke;return{c(){ke=text(_n[0])},m(Ce,$n){insert$1(Ce,ke,$n)},p(Ce,[$n]){$n&1&&set_data(ke,Ce[0])},i:noop,o:noop,d(Ce){Ce&&detach(ke)}}}function instance$P(_n,ke,Ce){let{value:$n}=ke;return _n.$$set=Mn=>{"value"in Mn&&Ce(0,$n=Mn.value)},[$n]}let Checkbox$2=class extends SvelteComponent{constructor(ke){super(),init(this,ke,instance$P,create_fragment$P,safe_not_equal,{value:0})}};function create_if_block$w(_n){let ke,Ce,$n,Mn;return{c(){ke=
Line truncated
|
|
||||||
* Sortable 1.15.3
|
|
||||||
* @author RubaXa <trash@rubaxa.org>
|
|
||||||
* @author owenm <owen23355@gmail.com>
|
|
||||||
* @license MIT
|
|
||||||
*/function ownKeys(_n,ke){var Ce=Object.keys(_n);if(Object.getOwnPropertySymbols){var $n=Object.getOwnPropertySymbols(_n);ke&&($n=$n.filter(function(Mn){return Object.getOwnPropertyDescriptor(_n,Mn).enumerable})),Ce.push.apply(Ce,$n)}return Ce}function _objectSpread2(_n){for(var ke=1;ke<arguments.length;ke++){var Ce=arguments[ke]!=null?arguments[ke]:{};ke%2?ownKeys(Object(Ce),!0).forEach(function($n){_defineProperty(_n,$n,Ce[$n])}):Object.getOwnPropertyDescriptors?Object.defineProperties(_n,Object.getOwnPropertyDescriptors(Ce)):ownKeys(Object(Ce)).forEach(function($n){Object.defineProperty(_n,$n,Object.getOwnPropertyDescriptor(Ce,$n))})}return _n}function _typeof(_n){"@babel/helpers - typeof";return typeof Symbol=="function"&&typeof Symbol.iterator=="symbol"?_typeof=function(ke){return typeof ke}:_typeof=function(ke){return ke&&typeof Symbol=="function"&&ke.constructor===Symbol&&ke!==Symbol.prototype?"symbol":typeof ke},_typeof(_n)}function _defineProperty(_n,ke,Ce){return ke in _n?Object.defineProperty(_n,ke,{value:Ce,enumerable:!0,configurable:!0,writable:!0}):_n[ke]=Ce,_n}function _extends(){return _extends=Object.assign||function(_n){for(var ke=1;ke<arguments.length;ke++){var Ce=arguments[ke];for(var $n in Ce)Object.prototype.hasOwnProperty.call(Ce,$n)&&(_n[$n]=Ce[$n])}return _n},_extends.apply(this,arguments)}function _objectWithoutPropertiesLoose(_n,ke){if(_n==null)return{};var Ce={},$n=Object.keys(_n),Mn,Qn;for(Qn=0;Qn<$n.length;Qn++)Mn=$n[Qn],!(ke.indexOf(Mn)>=0)&&(Ce[Mn]=_n[Mn]);return Ce}function _objectWithoutProperties(_n,ke){if(_n==null)return{};var Ce=_objectWithoutPropertiesLoose(_n,ke),$n,Mn;if(Object.getOwnPropertySymbols){var Qn=Object.getOwnPropertySymbols(_n);for(Mn=0;Mn<Qn.length;Mn++)$n=Qn[Mn],!(ke.indexOf($n)>=0)&&Object.prototype.propertyIsEnumerable.call(_n,$n)&&(Ce[$n]=_n[$n])}return Ce}var version="1.15.3";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,ke,Ce){_n.addEventListener(ke,Ce,!IE11OrLess&&captureMode)}function off(_n,ke,Ce){_n.removeEventListener(ke,Ce,!IE11OrLess&&captureMode)}function matches(_n,ke){if(ke){if(ke[0]===">"&&(ke=ke.substring(1)),_n)try{if(_n.matches)return _n.matches(ke);if(_n.msMatchesSelector)return _n.msMatchesSelector(ke);if(_n.webkitMatchesSelector)return _n.webkitMatchesSelector(ke)}catch{return!1}return!1}}function getParentOrHost(_n){return _n.host&&_n!==document&&_n.host.nodeType?_n.host:_n.parentNode}function closest(_n,ke,Ce,$n){if(_n){Ce=Ce||document;do{if(ke!=null&&(ke[0]===">"?_n.parentNode===Ce&&matches(_n,ke):matches(_n,ke))||$n&&_n===Ce)return _n;if(_n===Ce)break}while(_n=getParentOrHost(_n))}return null}var R_SPACE=/\s+/g;function toggleClass$1(_n,ke,Ce){if(_n&&ke)if(_n.classList)_n.classList[Ce?"add":"remove"](ke);else{var $n=(" "+_n.className+" ").replace(R_SPACE," ").replace(" "+ke+" "," ");_n.className=($n+(Ce?" "+ke:"")).replace(R_SPACE," ")}}function css$1(_n,ke,Ce){var $n=_n&&_n.style;if($n){if(Ce===void 0)return document.defaultView&&document.defaultView.getComputedStyle?Ce=document.defaultView.getComputedStyle(_n,""):_n.currentStyle&&(Ce=_n.currentStyle),ke===void 0?Ce:Ce[ke];!(ke in $n)&&ke.indexOf("webkit")===-1&&(ke="-webkit-"+ke),$n[ke]=Ce+(typeof Ce=="string"?"":"px")}}function matrix(_n,ke){var Ce="";if(typeof _n=="string")Ce=_n;else do{var $n=css$1(_n,"transform");$n&&$n!=="none"&&(Ce=$n+" "+Ce)}while(!ke&&(_n=_n.parentNode));var Mn=window.DOMMatrix||window.WebKitCSSMatrix||window.CSSMatrix||window.MSCSSMatrix;return Mn&&new Mn(Ce)}function find$1(_n,ke,Ce){if(_n){var $n=_n.getElementsByTagName(ke),Mn=0,Qn=$n.length;if(Ce)for(;Mn<Qn;Mn++)Ce($n[Mn],Mn);return $n}return[]}function getWindowScrollingElement(){var _n=document.scrollingElement;return _n||document.documentElement}function getRect(_n,ke,Ce,$n,Mn){if(!(!_n.getBoundingClientRect&&_n!==window)){var Qn,Vn,qn,Zn,jn,Xn,zn;if(_n!==window&&_n.parentNode&&_n!==getWindowScrollingElement()?(Qn=_n.getBoundingClientRect(),Vn=Qn.top,qn=Qn.left,Zn=Qn.bottom,jn=Qn.right,Xn=Qn.height,zn=Qn.width):(Vn=0,qn=0,Zn=window.innerHeight,jn=window.innerWidth,Xn=window.innerHeight,zn=window.innerWidth),(ke||Ce)&&_n!==window&&(Mn=Mn||_n.parentNode,!IE11OrLess))do if(Mn&&Mn.getBoundingClientRect&&(css$1(Mn,"transform")!=="none"||Ce&&css$1(Mn,"position")!=="static")){var Hn=Mn.getBoundingClientRect();Vn-=Hn.top+parseInt(css$1(Mn,"border-top-width")),qn-=Hn.left+parseInt(css$1(Mn,"border-left-width")),Zn=Vn+Qn.height,jn=qn+Qn.width;break}while(Mn=Mn.parentNode);if($n&&_n!==window){var Wn=matrix(Mn||_n),Yn=Wn&&Wn.a,Un=Wn&&Wn.d;Wn&&(Vn/=Un,qn/=Yn,zn/=Yn,Xn/=Un,Zn=Vn+Xn,jn=qn+zn)}return{top:Line truncated
|
|
||||||
<span class='flatpickr-weekday'>
|
|
||||||
`+lr.join("</span><span class='flatpickr-weekday'>")+`
|
|
||||||
</span>
|
|
||||||
`}}function Cr(){Ce.calendarContainer.classList.add("hasWeeks");var ar=createElement("div","flatpickr-weekwrapper");ar.appendChild(createElement("span","flatpickr-weekday",Ce.l10n.weekAbbreviation));var lr=createElement("div","flatpickr-weeks");return ar.appendChild(lr),{weekWrapper:ar,weekNumbers:lr}}function Mr(ar,lr){lr===void 0&&(lr=!0);var dr=lr?ar:ar-Ce.currentMonth;dr<0&&Ce._hidePrevMonthArrow===!0||dr>0&&Ce._hideNextMonthArrow===!0||(Ce.currentMonth+=dr,(Ce.currentMonth<0||Ce.currentMonth>11)&&(Ce.currentYear+=Ce.currentMonth>11?1:-1,Ce.currentMonth=(Ce.currentMonth+12)%12,Zr("onYearChange"),pr()),fr(),Zr("onMonthChange"),io())}function yr(ar,lr){if(ar===void 0&&(ar=!0),lr===void 0&&(lr=!0),Ce.input.value="",Ce.altInput!==void 0&&(Ce.altInput.value=""),Ce.mobileInput!==void 0&&(Ce.mobileInput.value=""),Ce.selectedDates=[],Ce.latestSelectedDateObj=void 0,lr===!0&&(Ce.currentYear=Ce._initialDate.getFullYear(),Ce.currentMonth=Ce._initialDate.getMonth()),Ce.config.enableTime===!0){var dr=getDefaultHours(Ce.config),gr=dr.hours,Sr=dr.minutes,wr=dr.seconds;Wn(gr,Sr,wr)}Ce.redraw(),ar&&Zr("onChange")}function Pr(){Ce.isOpen=!1,Ce.isMobile||(Ce.calendarContainer!==void 0&&Ce.calendarContainer.classList.remove("open"),Ce._input!==void 0&&Ce._input.classList.remove("active")),Zr("onClose")}function Qr(){Ce.config!==void 0&&Zr("onDestroy");for(var ar=Ce._handlers.length;ar--;)Ce._handlers[ar].remove();if(Ce._handlers=[],Ce.mobileInput)Ce.mobileInput.parentNode&&Ce.mobileInput.parentNode.removeChild(Ce.mobileInput),Ce.mobileInput=void 0;else if(Ce.calendarContainer&&Ce.calendarContainer.parentNode)if(Ce.config.static&&Ce.calendarContainer.parentNode){var lr=Ce.calendarContainer.parentNode;if(lr.lastChild&&lr.removeChild(lr.lastChild),lr.parentNode){for(;lr.firstChild;)lr.parentNode.insertBefore(lr.firstChild,lr);lr.parentNode.removeChild(lr)}}else Ce.calendarContainer.parentNode.removeChild(Ce.calendarContainer);Ce.altInput&&(Ce.input.type="text",Ce.altInput.parentNode&&Ce.altInput.parentNode.removeChild(Ce.altInput),delete Ce.altInput),Ce.input&&(Ce.input.type=Ce.input._type,Ce.input.classList.remove("flatpickr-input"),Ce.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(dr){try{delete Ce[dr]}catch{}})}function Nr(ar){return Ce.calendarContainer.contains(ar)}function Or(ar){if(Ce.isOpen&&!Ce.config.inline){var lr=getEventTarget(ar),dr=Nr(lr),gr=lr===Ce.input||lr===Ce.altInput||Ce.element.contains(lr)||ar.path&&ar.path.indexOf&&(~ar.path.indexOf(Ce.input)||~ar.path.indexOf(Ce.altInput)),Sr=!gr&&!dr&&!Nr(ar.relatedTarget),wr=!Ce.config.ignoredFocusElements.some(function(Dr){return Dr.contains(lr)});Sr&&wr&&(Ce.config.allowInput&&Ce.setDate(Ce._input.value,!1,Ce.config.altInput?Ce.config.altFormat:Ce.config.dateFormat),Ce.timeContainer!==void 0&&Ce.minuteElement!==void 0&&Ce.hourElement!==void 0&&Ce.input.value!==""&&Ce.input.value!==void 0&&Zn(),Ce.close(),Ce.config&&Ce.config.mode==="range"&&Ce.selectedDates.length===1&&Ce.clear(!1))}}function kr(ar){if(!(!ar||Ce.config.minDate&&ar<Ce.config.minDate.getFullYear()||Ce.config.maxDate&&ar>Ce.config.maxDate.getFullYear())){var lr=ar,dr=Ce.currentYear!==lr;Ce.currentYear=lr||Ce.currentYear,Ce.config.maxDate&&Ce.currentYear===Ce.config.maxDate.getFullYear()?Ce.currentMonth=Math.min(Ce.config.maxDate.getMonth(),Ce.currentMonth):Ce.config.minDate&&Ce.currentYear===Ce.config.minDate.getFullYear()&&(Ce.currentMonth=Math.max(Ce.config.minDate.getMonth(),Ce.currentMonth)),dr&&(Ce.redraw(),Zr("onYearChange"),pr())}}function Ar(ar,lr){var dr;lr===void 0&&(lr=!0);var gr=Ce.parseDate(ar,void 0,lr);if(Ce.config.minDate&&gr&&compareDates(gr,Ce.config.minDate,lr!==void 0?lr:!Ce.minDateHasTime)<0||Ce.config.maxDate&&gr&&compareDates(gr,Ce.config.maxDate,lr!==void 0?lr:!Ce.maxDateHasTime)>0)return!1;if(!Ce.config.enable&&Ce.config.disable.length===0)return!0;if(gr===void 0)return!1;for(var Sr=!!Ce.config.enable,wr=(dr=Ce.config.enable)!==null&&dr!==void 0?dr:Ce.config.disable,Dr=0,$r=void 0;Dr<wr.length;Dr++){if($r=wr[Dr],typeof $r=="function"&&$r(gr))return Sr;if($r instanceof Date&&gr!==void 0&&$r.getTime()===gr.getTime())return Sr;if(typeof $r=="string"){var Rr=Ce.parseDate($r,void 0,!0);return Rr&&Rr.getTime()===gr.getTime()?Sr:!Sr}else if(typeof $r=="object"&&gr!==void 0&&$r.from&&$r.to&&gr.getTime()>=$r.from.getTime()&&gr.getTime()<=$r.to.getTime())return Sr}return!Sr}function jr(ar){return Ce.daysContainer!==void 0?ar.className.indexOf("hidden")===-1&&ar.className.indexOf
Line truncated
|
|
||||||
`},W={bold:{tagName:"strong",inheritable:!0,parser(_n){const ke=window.getComputedStyle(_n);return ke.fontWeight==="bold"||ke.fontWeight>=600}},italic:{tagName:"em",inheritable:!0,parser:_n=>window.getComputedStyle(_n).fontStyle==="italic"},href:{groupTagName:"a",parser(_n){const ke="a:not(".concat(e,")"),Ce=_n.closest(ke);if(Ce)return Ce.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(ke){const{name:Ce,toMethod:$n,toProperty:Mn,optional:Qn}=z(ke);this.prototype[Ce]=function(){let Vn,qn;var Zn,jn;return $n?qn=Qn?(Zn=this[$n])===null||Zn===void 0?void 0:Zn.call(this):this[$n]():Mn&&(qn=this[Mn]),Qn?(Vn=(jn=qn)===null||jn===void 0?void 0:jn[Ce],Vn?_.call(Vn,qn,arguments):void 0):(Vn=qn[Ce],_.call(Vn,qn,arguments))}}}const z=function(_n){const ke=_n.match(J);if(!ke)throw new Error("can't parse @proxyMethod expression: ".concat(_n));const Ce={name:ke[4]};return ke[2]!=null?Ce.toMethod=ke[1]:Ce.toProperty=ke[1],ke[3]!=null&&(Ce.optional=!0),Ce},{apply:_}=Function.prototype,J=new RegExp("^(.+?)(\\(\\))?(\\?)?\\.(.+?)$");var K,G,$;class X extends H{static box(){let ke=arguments.length>0&&arguments[0]!==void 0?arguments[0]:"";return ke instanceof this?ke:this.fromUCS2String(ke==null?void 0:ke.toString())}static fromUCS2String(ke){return new this(ke,tt(ke))}static fromCodepoints(ke){return new this(et(ke),ke)}constructor(ke,Ce){super(...arguments),this.ucs2String=ke,this.codepoints=Ce,this.length=this.codepoints.length,this.ucs2Length=this.ucs2String.length}offsetToUCS2Offset(ke){return et(this.codepoints.slice(0,Math.max(0,ke))).length}offsetFromUCS2Offset(ke){return tt(this.ucs2String.slice(0,Math.max(0,ke))).length}slice(){return this.constructor.fromCodepoints(this.codepoints.slice(...arguments))}charAt(ke){return this.slice(ke,ke+1)}isEqualTo(ke){return this.constructor.box(ke).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(ke=>ke.codePointAt(0)):function(_n){const ke=[];let Ce=0;const{length:$n}=_n;for(;Ce<$n;){let Mn=_n.charCodeAt(Ce++);if(55296<=Mn&&Mn<=56319&&Ce<$n){const Qn=_n.charCodeAt(Ce++);(64512&Qn)==56320?Mn=((1023&Mn)<<10)+(1023&Qn)+65536:Ce--}ke.push(Mn)}return ke},et=Z?_n=>String.fromCodePoint(...Array.from(_n||[])):function(_n){return(()=>{const ke=[];return Array.from(_n).forEach(Ce=>{let $n="";Ce>65535&&(Ce-=65536,$n+=String.fromCharCode(Ce>>>10&1023|55296),Ce=56320|1023&Ce),ke.push($n+String.fromCharCode(Ce))}),ke})().join("")};let it=0;class nt extends H{static fromJSONString(ke){return this.fromJSON(JSON.parse(ke))}constructor(){super(...arguments),this.id=++it}hasSameConstructorAs(ke){return this.constructor===(ke==null?void 0:ke.constructor)}isEqualTo(ke){return this===ke}inspect(){const ke=[],Ce=this.contentsForInspection()||{};for(const $n in Ce){const Mn=Ce[$n];ke.push("".concat($n,"=").concat(Mn))}return"#<".concat(this.constructor.name,":").concat(this.id).concat(ke.length?" ".concat(ke.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]:[],ke=arguments.length>1&&arguments[1]!==void 0?arguments[1]:[];if(_n.length!==ke.length)return!1;for(let Ce=0;Ce<_n.length;Ce++)if(_n[Ce]!==ke[Ce])return!1;return!0},ot=function(_n){const ke=_n.slice(0);for(var Ce=arguments.length,$n=new Array(Ce>1?Ce-1:0),Mn=1;Mn<Ce;Mn++)$n[Mn-1]=arguments[Mn];return ke.splice(...$n),ke},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"}),ke=S$1("textarea",{dir:"auto",name:"y",dirName:"y.dir"}),Ce=S$1("form");Ce.appendChild(_n),Ce.appendChild(ke);const $n=function(){try{return new FormData(Ce).has(ke.dirName)}catch{return!1}}(),Mn=function(){try{return _n.matches(":dir(ltr),:dir(rtl)")}catch{return!1}}();return $n?function(Qn){return ke.value=Qn,new FormData(Ce).get(ke.dirName)}:Mn?function(Qn){return _n.value=Qn,_n.matches(":dir(rtl)")?"rtl":"ltr"}:functionLine truncated
|
|
||||||
`);for(let Mn=0;Mn<$n.length;Mn++){const Qn=$n[Mn];if(Mn>0){const Vn=S$1("br");Ce.push(Vn)}if(Qn.length){const Vn=document.createTextNode(this.preserveSpaces(Qn));Ce.push(Vn)}}return Ce}}createElement(){let ke,Ce,$n;const Mn={};for(Ce in this.attributes){$n=this.attributes[Ce];const Vn=pt(Ce);if(Vn){if(Vn.tagName){var Qn;const qn=S$1(Vn.tagName);Qn?(Qn.appendChild(qn),Qn=qn):ke=Qn=qn}if(Vn.styleProperty&&(Mn[Vn.styleProperty]=$n),Vn.style)for(Ce in Vn.style)$n=Vn.style[Ce],Mn[Ce]=$n}}if(Object.keys(Mn).length)for(Ce in ke||(ke=S$1("span")),Mn)$n=Mn[Ce],ke.style[Ce]=$n;return ke}createContainerElement(){for(const ke in this.attributes){const Ce=this.attributes[ke],$n=pt(ke);if($n&&$n.groupTagName){const Mn={};return Mn[ke]=Ce,S$1($n.groupTagName,Mn)}}}preserveSpaces(ke){return this.context.isLast&&(ke=ke.replace(/\ $/,d)),ke=ke.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)&&(ke=ke.replace(/^\ /,d)),ke}}class me extends ee{constructor(){super(...arguments),this.text=this.object,this.textConfig=this.options.textConfig}createNodes(){const ke=[],Ce=Xt.groupObjects(this.getPieces()),$n=Ce.length-1;for(let Qn=0;Qn<Ce.length;Qn++){const Vn=Ce[Qn],qn={};Qn===0&&(qn.isFirst=!0),Qn===$n&&(qn.isLast=!0),pe(Mn)&&(qn.followsWhitespace=!0);const Zn=this.findOrCreateCachedChildView(ge,Vn,{textConfig:this.textConfig,context:qn});ke.push(...Array.from(Zn.getNodes()||[]));var Mn=Vn}return ke}getPieces(){return Array.from(this.text.getPieces()).filter(ke=>!ke.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 ke=[document.createComment("block")];if(this.block.isEmpty())ke.push(S$1("br"));else{var Ce;const $n=(Ce=gt(this.block.getLastAttribute()))===null||Ce===void 0?void 0:Ce.text,Mn=this.findOrCreateCachedChildView(me,this.block.text,{textConfig:$n});ke.push(...Array.from(Mn.getNodes()||[])),this.shouldAddExtraNewlineElement()&&ke.push(S$1("br"))}if(this.attributes.length)return ke;{let $n;const{tagName:Mn}=n.default;this.block.isRTL()&&($n={dir:"rtl"});const Qn=S$1({tagName:Mn,attributes:$n});return ke.forEach(Vn=>Qn.appendChild(Vn)),[Qn]}}createContainerElement(ke){const Ce={};let $n;const Mn=this.attributes[ke],{tagName:Qn,htmlAttributes:Vn=[]}=gt(Mn);if(ke===0&&this.block.isRTL()&&Object.assign(Ce,{dir:"rtl"}),Mn==="attachmentGallery"){const qn=this.block.getBlockBreakPosition();$n="".concat(fe.attachmentGallery," ").concat(fe.attachmentGallery,"--").concat(qn)}return Object.entries(this.block.htmlAttributes).forEach(qn=>{let[Zn,jn]=qn;Vn.includes(Zn)&&(Ce[Zn]=jn)}),S$1({tagName:Qn,className:$n,attributes:Ce})}shouldAddExtraNewlineElement(){return/\n\n$/.test(this.block.toString())}}class ve extends ee{static render(ke){const Ce=S$1("div"),$n=new this(ke,{element:Ce});return $n.render(),$n.sync(),Ce}constructor(){super(...arguments),this.element=this.options.element,this.elementStore=new Qt,this.setDocument(this.object)}setDocument(ke){ke.isEqualTo(this.document)||(this.document=this.object=ke)}render(){if(this.childViews=[],this.shadowElement=S$1("div"),!this.document.isEmpty()){const ke=Xt.groupObjects(this.document.getBlocks(),{asTree:!0});Array.from(ke).forEach(Ce=>{const $n=this.findOrCreateCachedChildView(be,Ce);Array.from($n.getNodes()).map(Mn=>this.shadowElement.appendChild(Mn))})}}isSynced(){return xe(this.shadowElement,this.element)}sync(){const ke=this.createDocumentFragmentForSync();for(;this.element.lastChild;)this.element.removeChild(this.element.lastChild);return this.element.appendChild(ke),this.didSync()}didSync(){return this.elementStore.reset(Ae(this.element)),Rt(()=>this.garbageCollectCachedViews())}createDocumentFragmentForSync(){const ke=document.createDocumentFragment();return Array.from(this.shadowElement.childNodes).forEach(Ce=>{ke.appendChild(Ce.cloneNode(!0))}),Array.from(Ae(ke)).forEach(Ce=>{const $n=this.elementStore.remove(Ce);$n&&Ce.parentNode.replaceChild($n,Ce)}),ke}}const Ae=_n=>_n.querySelectorAll("[data-trix-store-key]"),xe=(_n,ke)=>ye(_n.innerHTML)===ye(ke.innerHTML),ye=_n=>_n.replace(/ /g," ");function Re(_n,ke,Ce){return(ke=Ee(ke))in _n?Object.defineProperty(_n,ke,{value:Ce,enumerable:!0,configurable:!0,writable:!0}):_n[ke]=Ce,_n}function Ee(_n){var ke=function(Ce,$n){if(typeof Ce!="object"||Ce===null)return Ce;var Mn=Ce[Symbol.toPrimitive];if(Mn!==void 0){var Qn=Mn.call(Ce,$n||"default");if(typeof Qn!="object")return Qn;throw new TypeError("@@toPrimitive must return a primitive value.")}return($n==="string"?String:Number)(Ce)}(_n,"string");return typeof ke=="symbol"?ke:String(ke)}class Se extends nt{static registerType(ke,Ce){Ce.type=ke,this.types[ke]=Ce}static fromJSON(ke){const Ce=this.types[ke.type];if(Ce)return Ce.fromJSON(ke)}constructor(ke){let Ce=arguments.length>1&&a
Line truncated
|
|
||||||
`))(ke),this.length=this.string.length}getValue(){return this.string}toString(){return this.string.toString()}isBlockBreak(){return this.toString()===`
|
|
||||||
`&&this.getAttribute("blockBreak")===!0}toJSON(){const ke=super.toJSON(...arguments);return ke.string=this.string,ke}canBeConsolidatedWith(ke){return ke&&this.hasSameConstructorAs(ke)&&this.hasSameAttributesAsPiece(ke)}consolidateWith(ke){return new this.constructor(this.toString()+ke.toString(),this.attributes)}splitAtOffset(ke){let Ce,$n;return ke===0?(Ce=null,$n=this):ke===this.length?(Ce=this,$n=null):(Ce=new this.constructor(this.string.slice(0,ke),this.attributes),$n=new this.constructor(this.string.slice(ke),this.attributes)),[Ce,$n]}toConsole(){let{string:ke}=this;return ke.length>15&&(ke=ke.slice(0,14)+"…"),JSON.stringify(ke.toString())}}Se.registerType("string",Te);class Be extends nt{static box(ke){return ke instanceof this?ke:new this(ke)}constructor(){let ke=arguments.length>0&&arguments[0]!==void 0?arguments[0]:[];super(...arguments),this.objects=ke.slice(0),this.length=this.objects.length}indexOf(ke){return this.objects.indexOf(ke)}splice(){for(var ke=arguments.length,Ce=new Array(ke),$n=0;$n<ke;$n++)Ce[$n]=arguments[$n];return new this.constructor(ot(this.objects,...Ce))}eachObject(ke){return this.objects.map((Ce,$n)=>ke(Ce,$n))}insertObjectAtIndex(ke,Ce){return this.splice(Ce,0,ke)}insertSplittableListAtIndex(ke,Ce){return this.splice(Ce,0,...ke.objects)}insertSplittableListAtPosition(ke,Ce){const[$n,Mn]=this.splitObjectAtPosition(Ce);return new this.constructor($n).insertSplittableListAtIndex(ke,Mn)}editObjectAtIndex(ke,Ce){return this.replaceObjectAtIndex(Ce(this.objects[ke]),ke)}replaceObjectAtIndex(ke,Ce){return this.splice(Ce,1,ke)}removeObjectAtIndex(ke){return this.splice(ke,1)}getObjectAtIndex(ke){return this.objects[ke]}getSplittableListInRange(ke){const[Ce,$n,Mn]=this.splitObjectsAtRange(ke);return new this.constructor(Ce.slice($n,Mn+1))}selectSplittableList(ke){const Ce=this.objects.filter($n=>ke($n));return new this.constructor(Ce)}removeObjectsInRange(ke){const[Ce,$n,Mn]=this.splitObjectsAtRange(ke);return new this.constructor(Ce).splice($n,Mn-$n+1)}transformObjectsInRange(ke,Ce){const[$n,Mn,Qn]=this.splitObjectsAtRange(ke),Vn=$n.map((qn,Zn)=>Mn<=Zn&&Zn<=Qn?Ce(qn):qn);return new this.constructor(Vn)}splitObjectsAtRange(ke){let Ce,[$n,Mn,Qn]=this.splitObjectAtPosition(Pe(ke));return[$n,Ce]=new this.constructor($n).splitObjectAtPosition(Ie(ke)+Qn),[$n,Mn,Ce-1]}getObjectAtPosition(ke){const{index:Ce}=this.findIndexAndOffsetAtPosition(ke);return this.objects[Ce]}splitObjectAtPosition(ke){let Ce,$n;const{index:Mn,offset:Qn}=this.findIndexAndOffsetAtPosition(ke),Vn=this.objects.slice(0);if(Mn!=null)if(Qn===0)Ce=Mn,$n=0;else{const qn=this.getObjectAtIndex(Mn),[Zn,jn]=qn.splitAtOffset(Qn);Vn.splice(Mn,1,Zn,jn),Ce=Mn+1,$n=Zn.getLength()-Qn}else Ce=Vn.length,$n=0;return[Vn,Ce,$n]}consolidate(){const ke=[];let Ce=this.objects[0];return this.objects.slice(1).forEach($n=>{var Mn,Qn;(Mn=(Qn=Ce).canBeConsolidatedWith)!==null&&Mn!==void 0&&Mn.call(Qn,$n)?Ce=Ce.consolidateWith($n):(ke.push(Ce),Ce=$n)}),Ce&&ke.push(Ce),new this.constructor(ke)}consolidateFromIndexToIndex(ke,Ce){const $n=this.objects.slice(0).slice(ke,Ce+1),Mn=new this.constructor($n).consolidate().toArray();return this.splice(ke,$n.length,...Mn)}findIndexAndOffsetAtPosition(ke){let Ce,$n=0;for(Ce=0;Ce<this.objects.length;Ce++){const Mn=$n+this.objects[Ce].getLength();if($n<=ke&&ke<Mn)return{index:Ce,offset:ke-$n};$n=Mn}return{index:null,offset:null}}findPositionAtIndexAndOffset(ke,Ce){let $n=0;for(let Mn=0;Mn<this.objects.length;Mn++){const Qn=this.objects[Mn];if(Mn<ke)$n+=Qn.getLength();else if(Mn===ke){$n+=Ce;break}}return $n}getEndPosition(){return this.endPosition==null&&(this.endPosition=0,this.objects.forEach(ke=>this.endPosition+=ke.getLength())),this.endPosition}toString(){return this.objects.join("")}toArray(){return this.objects.slice(0)}toJSON(){return this.toArray()}isEqualTo(ke){return super.isEqualTo(...arguments)||Fe(this.objects,ke==null?void 0:ke.objects)}contentsForInspection(){return{objects:"[".concat(this.objects.map(ke=>ke.inspect()).join(", "),"]")}}}const Fe=function(_n){let ke=arguments.length>1&&arguments[1]!==void 0?arguments[1]:[];if(_n.length!==ke.length)return!1;let Ce=!0;for(let $n=0;$n<_n.length;$n++){const Mn=_n[$n];Ce&&!Mn.isEqualTo(ke[$n])&&(Ce=!1)}return Ce},Pe=_n=>_n[0],Ie=_n=>_n[1];class Ne extends nt{static textForAttachmentWithAttributes(ke,Ce){return new this([new we(ke,Ce)])}static textForStringWithAttributes(ke,Ce){return new this([new Te(ke,Ce)])}static fromJSON(ke){return new this(Array.from(ke).map(Ce=>Se.fromJSON(Ce)))}constructor(){let ke=arguments.length>0&&arguments[0]!==void 0?arguments[0]:[];super(...arguments);const Ce=ke.filter($n=>!$n.isEmpty());this.pieceList=new Be(Ce)}copy(){return this.copyWithPieceList(this.pieceList)}copyWithPieceList(ke){return new this.constructor(ke.consolidate().toArray())}copyUsingObjectMap(ke){const Ce=this.getPieces().map($n=>ke.find($n)||$n);return new this.constructor(Ce)}appendText(ke){return this.insertTextAtPosition(ke,this.getLength())}
Line truncated
|
|
||||||
`,Ce);break;case"backward":Mn=$n.slice(0,Ce).lastIndexOf(`
|
|
||||||
`)}if(Mn!==-1)return Mn}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(ke){return!this.hasAttributes()&&!ke.hasAttributes()&&this.getDirection()===ke.getDirection()}consolidateWith(ke){const Ce=Ne.textForStringWithAttributes(`
|
|
||||||
`),$n=this.getTextWithoutBlockBreak().appendText(Ce);return this.copyWithText($n.appendText(ke.text))}splitAtOffset(ke){let Ce,$n;return ke===0?(Ce=null,$n=this):ke===this.getLength()?(Ce=this,$n=null):(Ce=this.copyWithText(this.text.getTextAtRange([0,ke])),$n=this.copyWithText(this.text.getTextAtRange([ke,this.getLength()]))),[Ce,$n]}getBlockBreakPosition(){return this.text.getLength()-1}getTextWithoutBlockBreak(){return qe(this.text)?this.text.getTextAtRange([0,this.getBlockBreakPosition()]):this.text.copy()}canBeGrouped(ke){return this.attributes[ke]}canBeGroupedWith(ke,Ce){const $n=ke.getAttributes(),Mn=$n[Ce],Qn=this.attributes[Ce];return Qn===Mn&&!(gt(Qn).group===!1&&!(()=>{if(!ht){ht=[];for(const Vn in n){const{listAttribute:qn}=n[Vn];qn!=null&&ht.push(qn)}}return ht})().includes($n[Ce+1]))&&(this.getDirection()===ke.getDirection()||ke.isEmpty())}}const Me=function(_n){return _n=je(_n),_n=Ue(_n)},je=function(_n){let ke=!1;const Ce=_n.getPieces();let $n=Ce.slice(0,Ce.length-1);const Mn=Ce[Ce.length-1];return Mn?($n=$n.map(Qn=>Qn.isBlockBreak()?(ke=!0,Ve(Qn)):Qn),ke?new Ne([...$n,Mn]):_n):_n},We=Ne.textForStringWithAttributes(`
|
|
||||||
`,{blockBreak:!0}),Ue=function(_n){return qe(_n)?_n:_n.appendText(We)},qe=function(_n){const ke=_n.getLength();return ke===0?!1:_n.getTextAtRange([ke-1,ke]).isBlockBreak()},Ve=_n=>_n.copyWithoutAttribute("blockBreak"),He=function(_n){const{listAttribute:ke}=gt(_n);return ke?[ke,_n]:[_n]},ze=_n=>_n.slice(-1)[0],_e=function(_n,ke){const Ce=_n.lastIndexOf(ke);return Ce===-1?_n:ot(_n,Ce,1)};class Je extends nt{static fromJSON(ke){return new this(Array.from(ke).map(Ce=>Oe.fromJSON(Ce)))}static fromString(ke,Ce){const $n=Ne.textForStringWithAttributes(ke,Ce);return new this([new Oe($n)])}constructor(){let ke=arguments.length>0&&arguments[0]!==void 0?arguments[0]:[];super(...arguments),ke.length===0&&(ke=[new Oe]),this.blockList=Be.box(ke)}isEmpty(){const ke=this.getBlockAtIndex(0);return this.blockList.length===1&&ke.isEmpty()&&!ke.hasAttributes()}copy(){const ke=(arguments.length>0&&arguments[0]!==void 0?arguments[0]:{}).consolidateBlocks?this.blockList.consolidate().toArray():this.blockList.toArray();return new this.constructor(ke)}copyUsingObjectsFromDocument(ke){const Ce=new Yt(ke.getObjects());return this.copyUsingObjectMap(Ce)}copyUsingObjectMap(ke){const Ce=this.getBlocks().map($n=>ke.find($n)||$n.copyUsingObjectMap(ke));return new this.constructor(Ce)}copyWithBaseBlockAttributes(){let ke=arguments.length>0&&arguments[0]!==void 0?arguments[0]:[];const Ce=this.getBlocks().map($n=>{const Mn=ke.concat($n.getAttributes());return $n.copyWithAttributes(Mn)});return new this.constructor(Ce)}replaceBlock(ke,Ce){const $n=this.blockList.indexOf(ke);return $n===-1?this:new this.constructor(this.blockList.replaceObjectAtIndex(Ce,$n))}insertDocumentAtRange(ke,Ce){const{blockList:$n}=ke;Ce=Lt(Ce);let[Mn]=Ce;const{index:Qn,offset:Vn}=this.locationFromPosition(Mn);let qn=this;const Zn=this.getBlockAtPosition(Mn);return Dt(Ce)&&Zn.isEmpty()&&!Zn.hasAttributes()?qn=new this.constructor(qn.blockList.removeObjectAtIndex(Qn)):Zn.getBlockBreakPosition()===Vn&&Mn++,qn=qn.removeTextAtRange(Ce),new this.constructor(qn.blockList.insertSplittableListAtPosition($n,Mn))}mergeDocumentAtRange(ke,Ce){let $n,Mn;Ce=Lt(Ce);const[Qn]=Ce,Vn=this.locationFromPosition(Qn),qn=this.getBlockAtIndex(Vn.index).getAttributes(),Zn=ke.getBaseBlockAttributes(),jn=qn.slice(-Zn.length);if(rt(Zn,jn)){const Hn=qn.slice(0,-Zn.length);$n=ke.copyWithBaseBlockAttributes(Hn)}else $n=ke.copy({consolidateBlocks:!0}).copyWithBaseBlockAttributes(qn);const Xn=$n.getBlockCount(),zn=$n.getBlockAtIndex(0);if(rt(qn,zn.getAttributes())){const Hn=zn.getTextWithoutBlockBreak();if(Mn=this.insertTextAtRange(Hn,Ce),Xn>1){$n=new this.constructor($n.getBlocks().slice(1));const Wn=Qn+Hn.getLength();Mn=Mn.insertDocumentAtRange($n,Wn)}}else Mn=this.insertDocumentAtRange($n,Ce);return Mn}insertTextAtRange(ke,Ce){Ce=Lt(Ce);const[$n]=Ce,{index:Mn,offset:Qn}=this.locationFromPosition($n),Vn=this.removeTextAtRange(Ce);return new this.constructor(Vn.blockList.editObjectAtIndex(Mn,qn=>qn.copyWithText(qn.text.insertTextAtPosition(ke,Qn))))}removeTextAtRange(ke){let Ce;ke=Lt(ke);const[$n,Mn]=ke;if(Dt(ke))return this;const[Qn,Vn]=Array.from(this.locationRangeFromRange(ke)),qn=Qn.index,Zn=Qn.offset,jn=this.getBlockAtIndex(qn),Xn=Vn.index,zn=Vn.offset,Hn=this.getBlockAtIndex(Xn);if(Mn-$n==1&&jn.getBlockBreakPosition()===Zn&&Hn.getBlockBreakPosition()!==zn&&Hn.text.getStringAtPosition(zn)===`
|
|
||||||
`)Ce=this.blockList.editObjectAtIndex(Xn,Wn=>Wn.copyWithText(Wn.text.removeTextAtRange([zn,zn+1])));else{let Wn;const Yn=jn.text.getTextAtRange([0,Zn]),Un=Hn.text.getTextAtRange([zn,Hn.getLength()]),Gn=Yn.appendText(Un);Wn=qn!==Xn&&Zn===0&&jn.getAttributeLevel()>=Hn.getAttributeLevel()?Hn.copyWithText(Gn):jn.copyWithText(Gn);const Kn=Xn+1-qn;Ce=this.blockList.splice(qn,Kn,Wn)}return new this.constructor(Ce)}moveTextFromRangeToPosition(ke,Ce){let $n;ke=Lt(ke);const[Mn,Qn]=ke;if(Mn<=Ce&&Ce<=Qn)return this;let Vn=this.getDocumentAtRange(ke),qn=this.removeTextAtRange(ke);const Zn=Mn<Ce;Zn&&(Ce-=Vn.getLength());const[jn,...Xn]=Vn.getBlocks();return Xn.length===0?($n=jn.getTextWithoutBlockBreak(),Zn&&(Ce+=1)):$n=jn.text,qn=qn.insertTextAtRange($n,Ce),Xn.length===0?qn:(Vn=new this.constructor(Xn),Ce+=$n.getLength(),qn.insertDocumentAtRange(Vn,Ce))}addAttributeAtRange(ke,Ce,$n){let{blockList:Mn}=this;return this.eachBlockAtRange($n,(Qn,Vn,qn)=>Mn=Mn.editObjectAtIndex(qn,function(){return gt(ke)?Qn.addAttribute(ke,Ce):Vn[0]===Vn[1]?Qn:Qn.copyWithText(Qn.text.addAttributeAtRange(ke,Ce,Vn))})),new this.constructor(Mn)}addAttribute(ke,Ce){let{blockList:$n}=this;return this.eachBlock((Mn,Qn)=>$n=$n.editObjectAtIndex(Qn,()=>Mn.addAttribute(ke,Ce))),new this.constructor($n)}removeAttributeAtRange(ke,Ce){let{blockList:$n}=this;return this.eachBlockAtRange(Ce,function(Mn,Qn,Vn){gt(ke)?$n=$n.editObjectAtIndex(Vn,()=>Mn.removeAttribute(ke)):Qn[0]!==Qn[1]&&($n=$n.editObjectAtIndex(Vn,()=>Mn.copyWithText(Mn.text.removeAttributeAtRange(ke,Qn))))}),new this.constructor($n)}updateAttributesForAttachment(ke,Ce){const $n=this.getRangeOfAttachment(Ce),[Mn]=Array.from($n),{index:Qn}=this.locationFromPosition(Mn),Vn=this.getTextAtIndex(Qn);return new this.constructor(this.blockList.editObjectAtIndex(Qn,qn=>qn.copyWithText(Vn.updateAttributesForAttachment(ke,Ce))))}removeAttributeForAttachment(ke,Ce){const $n=this.getRangeOfAttachment(Ce);return this.removeAttributeAtRange(ke,$n)}setHTMLAttributeAtPosition(ke,Ce,$n){const Mn=this.getBlockAtPosition(ke),Qn=Mn.addHTMLAttribute(Ce,$n);return this.replaceBlock(Mn,Qn)}insertBlockBreakAtRange(ke){let Ce;ke=Lt(ke);const[$n]=ke,{offset:Mn}=this.locationFromPosition($n),Qn=this.removeTextAtRange(ke);return Mn===0&&(Ce=[new Oe]),new this.constructor(Qn.blockList.insertSplittableListAtPosition(new Be(Ce),$n))}applyBlockAttributeAtRange(ke,Ce,$n){const Mn=this.expandRangeToLineBreaksAndSplitBlocks($n);let Qn=Mn.document;$n=Mn.range;const Vn=gt(ke);if(Vn.listAttribute){Qn=Qn.removeLastListAttributeAtRange($n,{exceptAttributeName:ke});const qn=Qn.convertLineBreaksToBlockBreaksInRange($n);Qn=qn.document,$n=qn.range}else Qn=Vn.exclusive?Qn.removeBlockAttributesAtRange($n):Vn.terminal?Qn.removeLastTerminalAttributeAtRange($n):Qn.consolidateBlocksAtRange($n);return Qn.addAttributeAtRange(ke,Ce,$n)}removeLastListAttributeAtRange(ke){let Ce=arguments.length>1&&arguments[1]!==void 0?arguments[1]:{},{blockList:$n}=this;return this.eachBlockAtRange(ke,function(Mn,Qn,Vn){const qn=Mn.getLastAttribute();qn&>(qn).listAttribute&&qn!==Ce.exceptAttributeName&&($n=$n.editObjectAtIndex(Vn,()=>Mn.removeAttribute(qn)))}),new this.constructor($n)}removeLastTerminalAttributeAtRange(ke){let{blockList:Ce}=this;return this.eachBlockAtRange(ke,function($n,Mn,Qn){const Vn=$n.getLastAttribute();Vn&>(Vn).terminal&&(Ce=Ce.editObjectAtIndex(Qn,()=>$n.removeAttribute(Vn)))}),new this.constructor(Ce)}removeBlockAttributesAtRange(ke){let{blockList:Ce}=this;return this.eachBlockAtRange(ke,function($n,Mn,Qn){$n.hasAttributes()&&(Ce=Ce.editObjectAtIndex(Qn,()=>$n.copyWithoutAttributes()))}),new this.constructor(Ce)}expandRangeToLineBreaksAndSplitBlocks(ke){let Ce;ke=Lt(ke);let[$n,Mn]=ke;const Qn=this.locationFromPosition($n),Vn=this.locationFromPosition(Mn);let qn=this;const Zn=qn.getBlockAtIndex(Qn.index);if(Qn.offset=Zn.findLineBreakInDirectionFromPosition("backward",Qn.offset),Qn.offset!=null&&(Ce=qn.positionFromLocation(Qn),qn=qn.insertBlockBreakAtRange([Ce,Ce+1]),Vn.index+=1,Vn.offset-=qn.getBlockAtIndex(Qn.index).getLength(),Qn.index+=1),Qn.offset=0,Vn.offset===0&&Vn.index>Qn.index)Vn.index-=1,Vn.offset=qn.getBlockAtIndex(Vn.index).getBlockBreakPosition();else{const jn=qn.getBlockAtIndex(Vn.index);jn.text.getStringAtRange([Vn.offset-1,Vn.offset])===`
|
|
||||||
`?Vn.offset-=1:Vn.offset=jn.findLineBreakInDirectionFromPosition("forward",Vn.offset),Vn.offset!==jn.getBlockBreakPosition()&&(Ce=qn.positionFromLocation(Vn),qn=qn.insertBlockBreakAtRange([Ce,Ce+1]))}return $n=qn.positionFromLocation(Qn),Mn=qn.positionFromLocation(Vn),{document:qn,range:ke=Lt([$n,Mn])}}convertLineBreaksToBlockBreaksInRange(ke){ke=Lt(ke);let[Ce]=ke;const $n=this.getStringAtRange(ke).slice(0,-1);let Mn=this;return $n.replace(/.*?\n/g,function(Qn){Ce+=Qn.length,Mn=Mn.insertBlockBreakAtRange([Ce-1,Ce])}),{document:Mn,range:ke}}consolidateBlocksAtRange(ke){ke=Lt(ke);const[Ce,$n]=ke,Mn=this.locationFromPosition(Ce).index,Qn=this.locationFromPosition($n).index;return new this.constructor(this.blockList.consolidateFromIndexToIndex(Mn,Qn))}getDocumentAtRange(ke){ke=Lt(ke);const Ce=this.blockList.getSplittableListInRange(ke).toArray();return new this.constructor(Ce)}getStringAtRange(ke){let Ce;const $n=ke=Lt(ke);return $n[$n.length-1]!==this.getLength()&&(Ce=-1),this.getDocumentAtRange(ke).toString().slice(0,Ce)}getBlockAtIndex(ke){return this.blockList.getObjectAtIndex(ke)}getBlockAtPosition(ke){const{index:Ce}=this.locationFromPosition(ke);return this.getBlockAtIndex(Ce)}getTextAtIndex(ke){var Ce;return(Ce=this.getBlockAtIndex(ke))===null||Ce===void 0?void 0:Ce.text}getTextAtPosition(ke){const{index:Ce}=this.locationFromPosition(ke);return this.getTextAtIndex(Ce)}getPieceAtPosition(ke){const{index:Ce,offset:$n}=this.locationFromPosition(ke);return this.getTextAtIndex(Ce).getPieceAtPosition($n)}getCharacterAtPosition(ke){const{index:Ce,offset:$n}=this.locationFromPosition(ke);return this.getTextAtIndex(Ce).getStringAtRange([$n,$n+1])}getLength(){return this.blockList.getEndPosition()}getBlocks(){return this.blockList.toArray()}getBlockCount(){return this.blockList.length}getEditCount(){return this.editCount}eachBlock(ke){return this.blockList.eachObject(ke)}eachBlockAtRange(ke,Ce){let $n,Mn;ke=Lt(ke);const[Qn,Vn]=ke,qn=this.locationFromPosition(Qn),Zn=this.locationFromPosition(Vn);if(qn.index===Zn.index)return $n=this.getBlockAtIndex(qn.index),Mn=[qn.offset,Zn.offset],Ce($n,Mn,qn.index);for(let jn=qn.index;jn<=Zn.index;jn++)if($n=this.getBlockAtIndex(jn),$n){switch(jn){case qn.index:Mn=[qn.offset,$n.text.getLength()];break;case Zn.index:Mn=[0,Zn.offset];break;default:Mn=[0,$n.text.getLength()]}Ce($n,Mn,jn)}}getCommonAttributesAtRange(ke){ke=Lt(ke);const[Ce]=ke;if(Dt(ke))return this.getCommonAttributesAtPosition(Ce);{const $n=[],Mn=[];return this.eachBlockAtRange(ke,function(Qn,Vn){if(Vn[0]!==Vn[1])return $n.push(Qn.text.getCommonAttributesAtRange(Vn)),Mn.push(Ke(Qn))}),zt.fromCommonAttributesOfObjects($n).merge(zt.fromCommonAttributesOfObjects(Mn)).toObject()}}getCommonAttributesAtPosition(ke){let Ce,$n;const{index:Mn,offset:Qn}=this.locationFromPosition(ke),Vn=this.getBlockAtIndex(Mn);if(!Vn)return{};const qn=Ke(Vn),Zn=Vn.text.getAttributesAtPosition(Qn),jn=Vn.text.getAttributesAtPosition(Qn-1),Xn=Object.keys(W).filter(zn=>W[zn].inheritable);for(Ce in jn)$n=jn[Ce],($n===Zn[Ce]||Xn.includes(Ce))&&(qn[Ce]=$n);return qn}getRangeOfCommonAttributeAtPosition(ke,Ce){const{index:$n,offset:Mn}=this.locationFromPosition(Ce),Qn=this.getTextAtIndex($n),[Vn,qn]=Array.from(Qn.getExpandedRangeForAttributeAtOffset(ke,Mn)),Zn=this.positionFromLocation({index:$n,offset:Vn}),jn=this.positionFromLocation({index:$n,offset:qn});return Lt([Zn,jn])}getBaseBlockAttributes(){let ke=this.getBlockAtIndex(0).getAttributes();for(let Ce=1;Ce<this.getBlockCount();Ce++){const $n=this.getBlockAtIndex(Ce).getAttributes(),Mn=Math.min(ke.length,$n.length);ke=(()=>{const Qn=[];for(let Vn=0;Vn<Mn&&$n[Vn]===ke[Vn];Vn++)Qn.push($n[Vn]);return Qn})()}return ke}getAttachmentById(ke){for(const Ce of this.getAttachments())if(Ce.id===ke)return Ce}getAttachmentPieces(){let ke=[];return this.blockList.eachObject(Ce=>{let{text:$n}=Ce;return ke=ke.concat($n.getAttachmentPieces())}),ke}getAttachments(){return this.getAttachmentPieces().map(ke=>ke.attachment)}getRangeOfAttachment(ke){let Ce=0;const $n=this.blockList.toArray();for(let Mn=0;Mn<$n.length;Mn++){const{text:Qn}=$n[Mn],Vn=Qn.getRangeOfAttachment(ke);if(Vn)return Lt([Ce+Vn[0],Ce+Vn[1]]);Ce+=Qn.getLength()}}getLocationRangeOfAttachment(ke){const Ce=this.getRangeOfAttachment(ke);return this.locationRangeFromRange(Ce)}getAttachmentPieceForAttachment(ke){for(const Ce of this.getAttachmentPieces())if(Ce.attachment===ke)return Ce}findRangesForBlockAttribute(ke){let Ce=0;const $n=[];return this.getBlocks().forEach(Mn=>{const Qn=Mn.getLength();Mn.hasAttribute(ke)&&$n.push([Ce,Ce+Qn]),Ce+=Qn}),$n}findRangesForTextAttribute(ke){let{withValue:Ce}=arguments.length>1&&arguments[1]!==void 0?arguments[1]:{},$n=0,Mn=[];const Qn=[];return this.getPieces().forEach(Vn=>{const qn=Vn.getLength();(function(Zn){return Ce?Zn.getAttribute(ke)===Ce:Zn.hasAttribute(ke)})(Vn)&&(Mn[1]===$n?Mn[1]=$n+qn:Qn.push(Mn=[$n,$n+qn])),$n+=qn}),Qn}locationFromPosition(ke){const Ce=this.blockList.findIndexAndOffsetAtPosition(Math
Line truncated
|
|
||||||
`);if(Ce===this.containerElement||this.isBlockElement(Ce)){var $n;const Mn=this.getBlockAttributes(Ce),Qn=this.getBlockHTMLAttributes(Ce);rt(Mn,($n=this.currentBlock)===null||$n===void 0?void 0:$n.attributes)||(this.currentBlock=this.appendBlockForAttributesWithElement(Mn,Ce,Qn),this.currentBlockElement=Ce)}}appendBlockForElement(ke){const Ce=this.isBlockElement(ke),$n=y(this.currentBlockElement,ke);if(Ce&&!this.isBlockElement(ke.firstChild)){if(!this.isInsignificantTextNode(ke.firstChild)||!this.isBlockElement(ke.firstElementChild)){const Mn=this.getBlockAttributes(ke),Qn=this.getBlockHTMLAttributes(ke);if(ke.firstChild){if($n&&rt(Mn,this.currentBlock.attributes))return this.appendStringWithAttributes(`
|
|
||||||
`);this.currentBlock=this.appendBlockForAttributesWithElement(Mn,ke,Qn),this.currentBlockElement=ke}}}else if(this.currentBlockElement&&!$n&&!Ce){const Mn=this.findParentBlockElement(ke);if(Mn)return this.appendBlockForElement(Mn);this.currentBlock=this.appendEmptyBlock(),this.currentBlockElement=null}}findParentBlockElement(ke){let{parentElement:Ce}=ke;for(;Ce&&Ce!==this.containerElement;){if(this.isBlockElement(Ce)&&this.blockElements.includes(Ce))return Ce;Ce=Ce.parentElement}return null}processTextNode(ke){let Ce=ke.data;var $n;return Ye(ke.parentNode)||(Ce=qt(Ce),ni(($n=ke.previousSibling)===null||$n===void 0?void 0:$n.textContent)&&(Ce=ei(Ce))),this.appendStringWithAttributes(Ce,this.getTextAttributes(ke.parentNode))}processElement(ke){let Ce;if(I(ke)){if(Ce=$e(ke,"attachment"),Object.keys(Ce).length){const $n=this.getTextAttributes(ke);this.appendAttachmentWithAttributes(Ce,$n),ke.innerHTML=""}return this.processedElements.push(ke)}switch(E(ke)){case"br":return this.isExtraBR(ke)||this.isBlockElement(ke.nextSibling)||this.appendStringWithAttributes(`
|
|
||||||
`,this.getTextAttributes(ke)),this.processedElements.push(ke);case"img":Ce={url:ke.getAttribute("src"),contentType:"image"};const $n=(Mn=>{const Qn=Mn.getAttribute("width"),Vn=Mn.getAttribute("height"),qn={};return Qn&&(qn.width=parseInt(Qn,10)),Vn&&(qn.height=parseInt(Vn,10)),qn})(ke);for(const Mn in $n){const Qn=$n[Mn];Ce[Mn]=Qn}return this.appendAttachmentWithAttributes(Ce,this.getTextAttributes(ke)),this.processedElements.push(ke);case"tr":if(this.needsTableSeparator(ke))return this.appendStringWithAttributes(j.tableRowSeparator);break;case"td":if(this.needsTableSeparator(ke))return this.appendStringWithAttributes(j.tableCellSeparator)}}appendBlockForAttributesWithElement(ke,Ce){let $n=arguments.length>2&&arguments[2]!==void 0?arguments[2]:{};this.blockElements.push(Ce);const Mn=function(){return{text:[],attributes:arguments.length>0&&arguments[0]!==void 0?arguments[0]:{},htmlAttributes:arguments.length>1&&arguments[1]!==void 0?arguments[1]:{}}}(ke,$n);return this.blocks.push(Mn),Mn}appendEmptyBlock(){return this.appendBlockForAttributesWithElement([],null)}appendStringWithAttributes(ke,Ce){return this.appendPiece(Ge(ke,Ce))}appendAttachmentWithAttributes(ke,Ce){return this.appendPiece(function($n){return{attachment:$n,attributes:arguments.length>1&&arguments[1]!==void 0?arguments[1]:{},type:"attachment"}}(ke,Ce))}appendPiece(ke){return this.blocks.length===0&&this.appendEmptyBlock(),this.blocks[this.blocks.length-1].text.push(ke)}appendStringToTextAtIndex(ke,Ce){const{text:$n}=this.blocks[Ce],Mn=$n[$n.length-1];if((Mn==null?void 0:Mn.type)!=="string")return $n.push(Ge(ke));Mn.string+=ke}prependStringToTextAtIndex(ke,Ce){const{text:$n}=this.blocks[Ce],Mn=$n[0];if((Mn==null?void 0:Mn.type)!=="string")return $n.unshift(Ge(ke));Mn.string=ke+Mn.string}getTextAttributes(ke){let Ce;const $n={};for(const Mn in W){const Qn=W[Mn];if(Qn.tagName&&A(ke,{matchingSelector:Qn.tagName,untilNode:this.containerElement}))$n[Mn]=!0;else if(Qn.parser){if(Ce=Qn.parser(ke),Ce){let Vn=!1;for(const qn of this.findBlockElementAncestors(ke))if(Qn.parser(qn)===Ce){Vn=!0;break}Vn||($n[Mn]=Ce)}}else Qn.styleProperty&&(Ce=ke.style[Qn.styleProperty],Ce&&($n[Mn]=Ce))}if(I(ke)){const Mn=$e(ke,"attributes");for(const Qn in Mn)Ce=Mn[Qn],$n[Qn]=Ce}return $n}getBlockAttributes(ke){const Ce=[];for(;ke&&ke!==this.containerElement;){for(const Mn in n){const Qn=n[Mn];var $n;Qn.parse!==!1&&E(ke)===Qn.tagName&&(($n=Qn.test)!==null&&$n!==void 0&&$n.call(Qn,ke)||!Qn.test)&&(Ce.push(Mn),Qn.listAttribute&&Ce.push(Qn.listAttribute))}ke=ke.parentNode}return Ce.reverse()}getBlockHTMLAttributes(ke){const Ce={},$n=Object.values(n).find(Mn=>Mn.tagName===E(ke));return(($n==null?void 0:$n.htmlAttributes)||[]).forEach(Mn=>{ke.hasAttribute(Mn)&&(Ce[Mn]=ke.getAttribute(Mn))}),Ce}findBlockElementAncestors(ke){const Ce=[];for(;ke&&ke!==this.containerElement;){const $n=E(ke);D().includes($n)&&Ce.push(ke),ke=ke.parentNode}return Ce}isBlockElement(ke){if((ke==null?void 0:ke.nodeType)===Node.ELEMENT_NODE&&!I(ke)&&!A(ke,{matchingSelector:"td",untilNode:this.containerElement}))return D().includes(E(ke))||window.getComputedStyle(ke).display==="block"}isInsignificantTextNode(ke){if((ke==null?void 0:ke.nodeType)!==Node.TEXT_NODE||!ii(ke.data))return;const{parentNode:Ce,previousSibling:$n,nextSibling:Mn}=ke;return Qe(Ce.previousSibling)&&!this.isBlockElement(Ce.previousSibling)||Ye(Ce)?void 0:!$n||this.isBlockElement($n)||!Mn||this.isBlockElement(Mn)}isExtraBR(ke){return E(ke)==="br"&&this.isBlockElement(ke.parentNode)&&ke.parentNode.lastChild===ke}needsTableSeparator(ke){if(j.removeBlankTableCells){var Ce;const $n=(Ce=ke.previousSibling)===null||Ce===void 0?void 0:Ce.textContent;return $n&&/\S/.test($n)}return ke.previousSibling}translateBlockElementMarginsToNewlines(){const ke=this.getMarginOfDefaultBlockElement();for(let Ce=0;Ce<this.blocks.length;Ce++){const $n=this.getMarginOfBlockElementAtIndex(Ce);$n&&($n.top>2*ke.top&&this.prependStringToTextAtIndex(`
|
|
||||||
`,Ce),$n.bottom>2*ke.bottom&&this.appendStringToTextAtIndex(`
|
|
||||||
`,Ce))}}getMarginOfBlockElementAtIndex(ke){const Ce=this.blockElements[ke];if(Ce&&Ce.textContent&&!D().includes(E(Ce))&&!this.processedElements.includes(Ce))return Ze(Ce)}getMarginOfDefaultBlockElement(){const ke=S$1(n.default.tagName);return this.containerElement.appendChild(ke),Ze(ke)}}const Ye=function(_n){const{whiteSpace:ke}=window.getComputedStyle(_n);return["pre","pre-wrap","pre-line"].includes(ke)},Qe=_n=>_n&&!ni(_n.textContent),Ze=function(_n){const ke=window.getComputedStyle(_n);if(ke.display==="block")return{top:parseInt(ke.marginTop),bottom:parseInt(ke.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 ke;if(_n instanceof Je)ke=_n;else{if(!(_n instanceof HTMLElement))throw new Error("unserializable object");ke=Xe.parse(_n.innerHTML).getDocument()}return ke.toSerializableDocument().toJSONString()},"text/html":function(_n){let ke;if(_n instanceof Je)ke=ve.render(_n);else{if(!(_n instanceof HTMLElement))throw new Error("unserializable object");ke=_n.cloneNode(!0)}return Array.from(ke.querySelectorAll("[data-trix-serialize=false]")).forEach(Ce=>{k(Ce)}),ri.forEach(Ce=>{Array.from(ke.querySelectorAll("[".concat(Ce,"]"))).forEach($n=>{$n.removeAttribute(Ce)})}),Array.from(ke.querySelectorAll(si)).forEach(Ce=>{try{const $n=JSON.parse(Ce.getAttribute(oi));Ce.removeAttribute(oi);for(const Mn in $n){const Qn=$n[Mn];Ce.setAttribute(Mn,Qn)}}catch{}}),ke.innerHTML.replace(ai,"")}};var ci=Object.freeze({__proto__:null});class ui extends H{constructor(ke,Ce){super(...arguments),this.attachmentManager=ke,this.attachment=Ce,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 ke=arguments.length>0&&arguments[0]!==void 0?arguments[0]:[];super(...arguments),this.managedAttachments={},Array.from(ke).forEach(Ce=>{this.manageAttachment(Ce)})}getAttachments(){const ke=[];for(const Ce in this.managedAttachments){const $n=this.managedAttachments[Ce];ke.push($n)}return ke}manageAttachment(ke){return this.managedAttachments[ke.id]||(this.managedAttachments[ke.id]=new ui(this,ke)),this.managedAttachments[ke.id]}attachmentIsManaged(ke){return ke.id in this.managedAttachments}requestRemovalOfAttachment(ke){var Ce,$n;if(this.attachmentIsManaged(ke))return(Ce=this.delegate)===null||Ce===void 0||($n=Ce.attachmentManagerDidRequestRemovalOfAttachment)===null||$n===void 0?void 0:$n.call(Ce,ke)}unmanageAttachment(ke){const Ce=this.managedAttachments[ke.id];return delete this.managedAttachments[ke.id],Ce}}class di{constructor(ke){this.composition=ke,this.document=this.composition.document;const Ce=this.composition.getSelectedRange();this.startPosition=Ce[0],this.endPosition=Ce[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(ke){var Ce,$n;if(!ke.isEqualTo(this.document))return this.document=ke,this.refreshAttachments(),this.revision++,(Ce=this.delegate)===null||Ce===void 0||($n=Ce.compositionDidChangeDocument)===null||$n===void 0?void 0:$n.call(Ce,ke)}getSnapshot(){return{document:this.document,selectedRange:this.getSelectedRange()}}loadSnapshot(ke){var Ce,$n,Mn,Qn;let{document:Vn,selectedRange:qn}=ke;return(Ce=this.delegate)===null||Ce===void 0||($n=Ce.compositionWillLoadSnapshot)===null||$n===void 0||$n.call(Ce),this.setDocument(Vn??new Je),this.setSelection(qn??[0,0]),(Mn=this.delegate)===null||Mn===void 0||(Qn=Mn.compositionDidLoadSnapshot)===null||Qn===void 0?void 0:Qn.call(Mn)}insertText(ke){let{updatePosition:Ce}=arguments.length>1&&arguments[1]!==void 0?arguments[1]:{updatePosition:!0};const $n=this.getSelectedRange();this.setDocument(this.document.insertTextAtRange(ke,$n));const Mn=$n[0],Qn=Mn+ke.getLength();return Ce&&this.setSelection(Qn),this.notifyDelegateOfInsertionAtRange([Mn,Qn])}insertBlock(){let ke=arguments.length>0&&arguments[0]!==void 0?arguments[0]:new Oe;const Ce=new Je([ke]);return this.insertDocument(Ce)}insertDocument(){let ke=arguments.length>0&&arguments[0]!==void 0?arguments[0]:new Je;const Ce=this.getSelectedRange();this.setDocument(this.document.insertDocumentAtRange(ke,Ce));const $n=Ce[0],Mn=$n+ke.getLength();return this.setSelection(Mn),this.notifyDelegateOfInsertionAtRange([$n,Mn])}insertString(ke,Ce){const $n=this.getCurrentTextAttributes(),Mn=Ne.textForStringWithAttributes(ke,$n);return this.insertText(Mn,Ce)}insertBlockBreak(){const ke=this.getSelectedRange();this.setDocument(this.document.insertBlockBreakAtRange(ke));const Ce=ke[0],$n=Ce+1;return this.setSelection($n),this.notifyDelegateOfInsertionAtRange([Ce,$n])}insertLineBreak(){const ke=new di(this);if(ke.shouldDecreaseListLevel())return this.decreaseListLevel(),this.setSelection(ke.startPosition);if(ke.shouldPrependListItem()){const Ce=new Je([ke.block.copyWithoutText()]);return this.insertDocument(Ce)}return ke.shouldInsertBlockBreak()?this.insertBlockBreak():ke.shouldRemoveLastBlockAttribute()?this.removeLastBlockAttribute():ke.shouldBreakFormattedBlock()?this.breakFormattedBlock(ke):this.insertString(`
|
|
||||||
`)}insertHTML(ke){const Ce=Xe.parse(ke).getDocument(),$n=this.getSelectedRange();this.setDocument(this.document.mergeDocumentAtRange(Ce,$n));const Mn=$n[0],Qn=Mn+Ce.getLength()-1;return this.setSelection(Qn),this.notifyDelegateOfInsertionAtRange([Mn,Qn])}replaceHTML(ke){const Ce=Xe.parse(ke).getDocument().copyUsingObjectsFromDocument(this.document),$n=this.getLocationRange({strict:!1}),Mn=this.document.rangeFromLocationRange($n);return this.setDocument(Ce),this.setSelection(Mn)}insertFile(ke){return this.insertFiles([ke])}insertFiles(ke){const Ce=[];return Array.from(ke).forEach($n=>{var Mn;if((Mn=this.delegate)!==null&&Mn!==void 0&&Mn.compositionShouldAcceptFile($n)){const Qn=De.attachmentForFile($n);Ce.push(Qn)}}),this.insertAttachments(Ce)}insertAttachment(ke){return this.insertAttachments([ke])}insertAttachments(ke){let Ce=new Ne;return Array.from(ke).forEach($n=>{var Mn;const Qn=$n.getType(),Vn=(Mn=i$1[Qn])===null||Mn===void 0?void 0:Mn.presentation,qn=this.getCurrentTextAttributes();Vn&&(qn.presentation=Vn);const Zn=Ne.textForAttachmentWithAttributes($n,qn);Ce=Ce.appendText(Zn)}),this.insertText(Ce)}shouldManageDeletingInDirection(ke){const Ce=this.getLocationRange();if(Dt(Ce)){if(ke==="backward"&&Ce[0].offset===0||this.shouldManageMovingCursorInDirection(ke))return!0}else if(Ce[0].index!==Ce[1].index)return!0;return!1}deleteInDirection(ke){let Ce,$n,Mn,{length:Qn}=arguments.length>1&&arguments[1]!==void 0?arguments[1]:{};const Vn=this.getLocationRange();let qn=this.getSelectedRange();const Zn=Dt(qn);if(Zn?$n=ke==="backward"&&Vn[0].offset===0:Mn=Vn[0].index!==Vn[1].index,$n&&this.canDecreaseBlockAttributeLevel()){const jn=this.getBlock();if(jn.isListItem()?this.decreaseListLevel():this.decreaseBlockAttributeLevel(),this.setSelection(qn[0]),jn.isEmpty())return!1}return Zn&&(qn=this.getExpandedRangeInDirection(ke,{length:Qn}),ke==="backward"&&(Ce=this.getAttachmentAtRange(qn))),Ce?(this.editAttachment(Ce),!1):(this.setDocument(this.document.removeTextAtRange(qn)),this.setSelection(qn[0]),!$n&&!Mn&&void 0)}moveTextFromRange(ke){const[Ce]=Array.from(this.getSelectedRange());return this.setDocument(this.document.moveTextFromRangeToPosition(ke,Ce)),this.setSelection(Ce)}removeAttachment(ke){const Ce=this.document.getRangeOfAttachment(ke);if(Ce)return this.stopEditingAttachment(),this.setDocument(this.document.removeTextAtRange(Ce)),this.setSelection(Ce[0])}removeLastBlockAttribute(){const[ke,Ce]=Array.from(this.getSelectedRange()),$n=this.document.getBlockAtPosition(Ce);return this.removeCurrentAttribute($n.getLastAttribute()),this.setSelection(ke)}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(ke){const Ce=this.currentAttributes[ke];return Ce!=null&&Ce!==!1}toggleCurrentAttribute(ke){const Ce=!this.currentAttributes[ke];return Ce?this.setCurrentAttribute(ke,Ce):this.removeCurrentAttribute(ke)}canSetCurrentAttribute(ke){return gt(ke)?this.canSetCurrentBlockAttribute(ke):this.canSetCurrentTextAttribute(ke)}canSetCurrentTextAttribute(ke){const Ce=this.getSelectedDocument();if(Ce){for(const $n of Array.from(Ce.getAttachments()))if(!$n.hasContent())return!1;return!0}}canSetCurrentBlockAttribute(ke){const Ce=this.getBlock();if(Ce)return!Ce.isTerminalBlock()}setCurrentAttribute(ke,Ce){return gt(ke)?this.setBlockAttribute(ke,Ce):(this.setTextAttribute(ke,Ce),this.currentAttributes[ke]=Ce,this.notifyDelegateOfCurrentAttributesChange())}setHTMLAtributeAtPosition(ke,Ce,$n){var Mn;const Qn=this.document.getBlockAtPosition(ke),Vn=(Mn=gt(Qn.getLastAttribute()))===null||Mn===void 0?void 0:Mn.htmlAttributes;if(Qn&&Vn!=null&&Vn.includes(Ce)){const qn=this.document.setHTMLAttributeAtPosition(ke,Ce,$n);this.setDocument(qn)}}setTextAttribute(ke,Ce){const $n=this.getSelectedRange();if(!$n)return;const[Mn,Qn]=Array.from($n);if(Mn!==Qn)return this.setDocument(this.document.addAttributeAtRange(ke,Ce,$n));if(ke==="href"){const Vn=Ne.textForStringWithAttributes(Ce,{href:Ce});return this.insertText(Vn)}}setBlockAttribute(ke,Ce){const $n=this.getSelectedRange();if(this.canSetCurrentAttribute(ke))return this.setDocument(this.document.applyBlockAttributeAtRange(ke,Ce,$n)),this.setSelection($n)}removeCurrentAttribute(ke){return gt(ke)?(this.removeBlockAttribute(ke),this.updateCurrentAttributes()):(this.removeTextAttribute(ke),delete this.currentAttributes[ke],this.notifyDelegateOfCurrentAttributesChange())}removeTextAttribute(ke){const Ce=this.getSelectedRange();if(Ce)return this.setDocument(this.document.removeAttributeAtRange(ke,Ce))}removeBlockAttribute(ke){const Ce=this.getSelectedRange();if(Ce)return this.setDocument(this.document.removeAttributeAtRange(ke,Ce))}canDecreaseNestingLevel(){var ke;return((ke=this.getBlock())===null||ke===void 0?void 0:ke.getNes
Line truncated
|
|
||||||
`?Mn+=1:Ce=Ce.removeTextAtRange(Qn),Qn=[Mn,Mn]):ke.nextCharacter===`
|
|
||||||
`?ke.previousCharacter===`
|
|
||||||
`?Qn=[Mn-1,Mn+1]:(Qn=[Mn,Mn+1],Mn+=1):ke.startLocation.offset-1!=0&&(Mn+=1);const Vn=new Je([$n.removeLastAttribute().copyWithoutText()]);return this.setDocument(Ce.insertDocumentAtRange(Vn,Qn)),this.setSelection(Mn)}getPreviousBlock(){const ke=this.getLocationRange();if(ke){const{index:Ce}=ke[0];if(Ce>0)return this.document.getBlockAtIndex(Ce-1)}}getBlock(){const ke=this.getLocationRange();if(ke)return this.document.getBlockAtIndex(ke[0].index)}getAttachmentAtRange(ke){const Ce=this.document.getDocumentAtRange(ke);if(Ce.toString()==="".concat("",`
|
|
||||||
`))return Ce.getAttachments()[0]}notifyDelegateOfCurrentAttributesChange(){var ke,Ce;return(ke=this.delegate)===null||ke===void 0||(Ce=ke.compositionDidChangeCurrentAttributes)===null||Ce===void 0?void 0:Ce.call(ke,this.currentAttributes)}notifyDelegateOfInsertionAtRange(ke){var Ce,$n;return(Ce=this.delegate)===null||Ce===void 0||($n=Ce.compositionDidPerformInsertionAtRange)===null||$n===void 0?void 0:$n.call(Ce,ke)}translateUTF16PositionFromOffset(ke,Ce){const $n=this.document.toUTF16String(),Mn=$n.offsetFromUCS2Offset(ke);return $n.offsetToUCS2Offset(Mn+Ce)}}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(ke){super(...arguments),this.composition=ke,this.undoEntries=[],this.redoEntries=[]}recordUndoEntry(ke){let{context:Ce,consolidatable:$n}=arguments.length>1&&arguments[1]!==void 0?arguments[1]:{};const Mn=this.undoEntries.slice(-1)[0];if(!$n||!pi(Mn,ke,Ce)){const Qn=this.createEntry({description:ke,context:Ce});this.undoEntries.push(Qn),this.redoEntries=[]}}undo(){const ke=this.undoEntries.pop();if(ke){const Ce=this.createEntry(ke);return this.redoEntries.push(Ce),this.composition.loadSnapshot(ke.snapshot)}}redo(){const ke=this.redoEntries.pop();if(ke){const Ce=this.createEntry(ke);return this.undoEntries.push(Ce),this.composition.loadSnapshot(ke.snapshot)}}canUndo(){return this.undoEntries.length>0}canRedo(){return this.redoEntries.length>0}createEntry(){let{description:ke,context:Ce}=arguments.length>0&&arguments[0]!==void 0?arguments[0]:{};return{description:ke==null?void 0:ke.toString(),context:JSON.stringify(Ce),snapshot:this.composition.getSnapshot()}}}const pi=(_n,ke,Ce)=>(_n==null?void 0:_n.description)===(ke==null?void 0:ke.toString())&&(_n==null?void 0:_n.context)===JSON.stringify(Ce),fi="attachmentGallery";class bi{constructor(ke){this.document=ke.document,this.selectedRange=ke.selectedRange}perform(){return this.removeBlockAttribute(),this.applyBlockAttribute()}getSnapshot(){return{document:this.document,selectedRange:this.selectedRange}}removeBlockAttribute(){return this.findRangesOfBlocks().map(ke=>this.document=this.document.removeAttributeAtRange(fi,ke))}applyBlockAttribute(){let ke=0;this.findRangesOfPieces().forEach(Ce=>{Ce[1]-Ce[0]>1&&(Ce[0]+=ke,Ce[1]+=ke,this.document.getCharacterAtPosition(Ce[1])!==`
|
|
||||||
`&&(this.document=this.document.insertBlockBreakAtRange(Ce[1]),Ce[1]<this.selectedRange[1]&&this.moveSelectedRangeForward(),Ce[1]++,ke++),Ce[0]!==0&&this.document.getCharacterAtPosition(Ce[0]-1)!==`
|
|
||||||
`&&(this.document=this.document.insertBlockBreakAtRange(Ce[0]),Ce[0]<this.selectedRange[0]&&this.moveSelectedRangeForward(),Ce[0]++,ke++),this.document=this.document.applyBlockAttributeAtRange(fi,!0,Ce))})}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 ke=new bi(_n);return ke.perform(),ke.getSnapshot()},Ai=[vi];class xi{constructor(ke,Ce,$n){this.insertFiles=this.insertFiles.bind(this),this.composition=ke,this.selectionManager=Ce,this.element=$n,this.undoManager=new mi(this.composition),this.filters=Ai.slice(0)}loadDocument(ke){return this.loadSnapshot({document:ke,selectedRange:[0,0]})}loadHTML(){let ke=arguments.length>0&&arguments[0]!==void 0?arguments[0]:"";const Ce=Xe.parse(ke,{referenceElement:this.element}).getDocument();return this.loadDocument(Ce)}loadJSON(ke){let{document:Ce,selectedRange:$n}=ke;return Ce=Je.fromJSON(Ce),this.loadSnapshot({document:Ce,selectedRange:$n})}loadSnapshot(ke){return this.undoManager=new mi(this.composition),this.composition.loadSnapshot(ke)}getDocument(){return this.composition.document}getSelectedDocument(){return this.composition.getSelectedDocument()}getSnapshot(){return this.composition.getSnapshot()}toJSON(){return this.getSnapshot()}deleteInDirection(ke){return this.composition.deleteInDirection(ke)}insertAttachment(ke){return this.composition.insertAttachment(ke)}insertAttachments(ke){return this.composition.insertAttachments(ke)}insertDocument(ke){return this.composition.insertDocument(ke)}insertFile(ke){return this.composition.insertFile(ke)}insertFiles(ke){return this.composition.insertFiles(ke)}insertHTML(ke){return this.composition.insertHTML(ke)}insertString(ke){return this.composition.insertString(ke)}insertText(ke){return this.composition.insertText(ke)}insertLineBreak(){return this.composition.insertLineBreak()}getSelectedRange(){return this.composition.getSelectedRange()}getPosition(){return this.composition.getPosition()}getClientRectAtPosition(ke){const Ce=this.getDocument().locationRangeFromRange([ke,ke+1]);return this.selectionManager.getClientRectAtLocationRange(Ce)}expandSelectionInDirection(ke){return this.composition.expandSelectionInDirection(ke)}moveCursorInDirection(ke){return this.composition.moveCursorInDirection(ke)}setSelectedRange(ke){return this.composition.setSelectedRange(ke)}activateAttribute(ke){let Ce=!(arguments.length>1&&arguments[1]!==void 0)||arguments[1];return this.composition.setCurrentAttribute(ke,Ce)}attributeIsActive(ke){return this.composition.hasCurrentAttribute(ke)}canActivateAttribute(ke){return this.composition.canSetCurrentAttribute(ke)}deactivateAttribute(ke){return this.composition.removeCurrentAttribute(ke)}setHTMLAtributeAtPosition(ke,Ce,$n){this.composition.setHTMLAtributeAtPosition(ke,Ce,$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(ke){let{context:Ce,consolidatable:$n}=arguments.length>1&&arguments[1]!==void 0?arguments[1]:{};return this.undoManager.recordUndoEntry(ke,{context:Ce,consolidatable:$n})}redo(){if(this.canRedo())return this.undoManager.redo()}undo(){if(this.canUndo())return this.undoManager.undo()}}class yi{constructor(ke){this.element=ke}findLocationFromContainerAndOffset(ke,Ce){let{strict:$n}=arguments.length>2&&arguments[2]!==void 0?arguments[2]:{strict:!0},Mn=0,Qn=!1;const Vn={index:0,offset:0},qn=this.findAttachmentElementParentForNode(ke);qn&&(ke=qn.parentNode,Ce=C$1(qn));const Zn=R(this.element,{usingFilter:Ei});for(;Zn.nextNode();){const jn=Zn.currentNode;if(jn===ke&&O(ke)){P(jn)||(Vn.offset+=Ce);break}if(jn.parentNode===ke){if(Mn++===Ce)break}else if(!y(ke,jn)&&Mn>0)break;T(jn,{strict:$n})?(Qn&&Vn.index++,Vn.offset=0,Qn=!0):Vn.offset+=Ci(jn)}return Vn}findContainerAndOffsetFromLocation(ke){let Ce,$n;if(ke.index===0&&ke.offset===0){for(Ce=this.element,$n=0;Ce.firstChild;)if(Ce=Ce.firstChild,w(Ce)){$n=1;break}return[Ce,$n]}let[Mn,Qn]=this.findNodeAndOffsetFromLocation(ke);if(Mn){if(O(Mn))Ci(Mn)===0?(Ce=Mn.parentNode.parentNode,$n=C$1(Mn.parentNode),P(Mn,{name:"right"})&&$n++):(Ce=Mn,$n=ke.offset-Qn);else{if(Ce=Mn.parentNode,!T(Mn.previousSibling)&&!w(Ce))for(;Mn===Ce.lastChild&&(Mn=Ce,Ce=Ce.parentNode,!w(Ce)););$n=C$1(Mn),ke.offset!==0&&$n++}return[Ce,$n]}}findNodeAndOffsetFromLocation(ke){let Ce,$n,Mn=0;for(const Qn of this.getSignificantNodesForIndex(ke.index)){const Vn=Ci(Qn);if(ke.offset<=Mn+Vn)if(O(Qn)){if(Ce=Qn,$n=Mn,ke.offset===$n&&P
Line truncated
|
|
||||||
`]):(ke=qi($n),Ce=qi(Mn)),{additions:ke.filter((Qn,Vn)=>Qn!==Ce[Vn]).map(Wt),deletions:Ce.filter((Qn,Vn)=>Qn!==ke[Vn]).map(Wt)}}getTextChangesFromCharacterData(){let ke,Ce;const $n=this.getMutationsByType("characterData");if($n.length){const Mn=$n[0],Qn=$n[$n.length-1],Vn=function(qn,Zn){let jn,Xn;return qn=X.box(qn),(Zn=X.box(Zn)).length<qn.length?[Xn,jn]=Vt(qn,Zn):[jn,Xn]=Vt(Zn,qn),{added:jn,removed:Xn}}(Wt(Mn.oldValue),Wt(Qn.target.data));ke=Vn.added,Ce=Vn.removed}return{additions:ke?[ke]:[],deletions:Ce?[Ce]:[]}}}const qi=function(){let _n=arguments.length>0&&arguments[0]!==void 0?arguments[0]:[];const ke=[];for(const Ce of Array.from(_n))switch(Ce.nodeType){case Node.TEXT_NODE:ke.push(Ce.data);break;case Node.ELEMENT_NODE:E(Ce)==="br"?ke.push(`
|
|
||||||
`):ke.push(...Array.from(qi(Ce.childNodes)||[]))}return ke};class Vi extends te{constructor(ke){super(...arguments),this.file=ke}perform(ke){const Ce=new FileReader;return Ce.onerror=()=>ke(!1),Ce.onload=()=>{Ce.onerror=null;try{Ce.abort()}catch{}return ke(!0,this.file)},Ce.readAsArrayBuffer(this.file)}}class Hi{constructor(ke){this.element=ke}shouldIgnore(ke){return!!a.samsungAndroid&&(this.previousEvent=this.event,this.event=ke,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 ke;return this.isBeforeInputInsertText()&&this.previousEventWasUnidentifiedKeydown()&&((ke=this.event.data)===null||ke===void 0?void 0:ke.length)>50}isBeforeInputInsertText(){return this.event.type==="beforeinput"&&this.event.inputType==="insertText"}previousEventWasUnidentifiedKeydown(){var ke,Ce;return((ke=this.previousEvent)===null||ke===void 0?void 0:ke.type)==="keydown"&&((Ce=this.previousEvent)===null||Ce===void 0?void 0:Ce.key)==="Unidentified"}}const zi=(_n,ke)=>Ji(_n)===Ji(ke),_i=new RegExp("(".concat("","|").concat(h,"|").concat(d,"|\\s)+"),"g"),Ji=_n=>_n.replace(_i," ").trim();class Ki extends H{constructor(ke){super(...arguments),this.element=ke,this.mutationObserver=new Ui(this.element),this.mutationObserver.delegate=this,this.flakyKeyboardDetector=new Hi(this.element);for(const Ce in this.constructor.events)f(Ce,{onElement:this.element,withCallback:this.handlerFor(Ce)})}elementDidMutate(ke){}editorWillSyncDocumentView(){return this.mutationObserver.stop()}editorDidSyncDocumentView(){return this.mutationObserver.start()}requestRender(){var ke,Ce;return(ke=this.delegate)===null||ke===void 0||(Ce=ke.inputControllerDidRequestRender)===null||Ce===void 0?void 0:Ce.call(ke)}requestReparse(){var ke,Ce;return(ke=this.delegate)===null||ke===void 0||(Ce=ke.inputControllerDidRequestReparse)===null||Ce===void 0||Ce.call(ke),this.requestRender()}attachFiles(ke){const Ce=Array.from(ke).map($n=>new Vi($n));return Promise.all(Ce).then($n=>{this.handleInput(function(){var Mn,Qn;return(Mn=this.delegate)===null||Mn===void 0||Mn.inputControllerWillAttachFiles(),(Qn=this.responder)===null||Qn===void 0||Qn.insertFiles($n),this.requestRender()})})}handlerFor(ke){return Ce=>{Ce.defaultPrevented||this.handleInput(()=>{if(!x(this.element)){if(this.flakyKeyboardDetector.shouldIgnore(Ce))return;this.eventName=ke,this.constructor.events[ke].call(this,Ce)}})}}handleInput(ke){try{var Ce;(Ce=this.delegate)===null||Ce===void 0||Ce.inputControllerWillHandleInput(),ke.call(this)}finally{var $n;($n=this.delegate)===null||$n===void 0||$n.inputControllerDidHandleInput()}}createLinkHTML(ke,Ce){const $n=document.createElement("a");return $n.href=ke,$n.textContent=Ce||ke,$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 ke=arguments.length>0&&arguments[0]!==void 0?arguments[0]:{};this.inputSummary.eventName=this.eventName;for(const Ce in ke){const $n=ke[Ce];this.inputSummary[Ce]=$n}return this.inputSummary}resetInputSummary(){this.inputSummary={}}reset(){return this.resetInputSummary(),Pt.reset()}elementDidMutate(ke){var Ce,$n;return this.isComposing()?(Ce=this.delegate)===null||Ce===void 0||($n=Ce.inputControllerDidAllowUnhandledInput)===null||$n===void 0?void 0:$n.call(Ce):this.handleInput(function(){return this.mutationIsSignificant(ke)&&(this.mutationIsExpected(ke)?this.requestRender():this.requestReparse()),this.reset()})}mutationIsExpected(ke){let{textAdded:Ce,textDeleted:$n}=ke;if(this.inputSummary.preferDocument)return!0;const Mn=Ce!=null?Ce===this.inputSummary.textAdded:!this.inputSummary.textAdded,Qn=$n!=null?this.inputSummary.didDelete:!this.inputSummary.didDelete,Vn=[`
|
|
||||||
`,`
|
|
||||||
`].includes(Ce)&&!Mn,qn=$n===`
|
|
||||||
`&&!Qn;if(Vn&&!qn||qn&&!Vn){const jn=this.getSelectedRange();if(jn){var Zn;const Xn=Vn?Ce.replace(/\n$/,"").length||-1:(Ce==null?void 0:Ce.length)||1;if((Zn=this.responder)!==null&&Zn!==void 0&&Zn.positionIsBlockBreak(jn[1]+Xn))return!0}}return Mn&&Qn}mutationIsSignificant(ke){var Ce;const $n=Object.keys(ke).length>0,Mn=((Ce=this.compositionInput)===null||Ce===void 0?void 0:Ce.getEndData())==="";return $n||!Mn}getCompositionInput(){if(this.isComposing())return this.compositionInput;this.compositionInput=new rn(this)}isComposing(){return this.compositionInput&&!this.compositionInput.isEnded()}deleteInDirection(ke,Ce){var $n;return(($n=this.responder)===null||$n===void 0?void 0:$n.deleteInDirection(ke))!==!1?this.setInputSummary({didDelete:!0}):Ce?(Ce.preventDefault(),this.requestRender()):void 0}serializeSelectionToDataTransfer(ke){var Ce;if(!function(Mn){if(Mn==null||!Mn.setData)return!1;for(const Qn in yt){const Vn=yt[Qn];try{if(Mn.setData(Qn,Vn),!Mn.getData(Qn)===Vn)return!1}catch{return!1}}return!0}(ke))return;const $n=(Ce=this.responder)===null||Ce===void 0?void 0:Ce.getSelectedDocument().toSerializableDocument();return ke.setData("application/x-trix-document",JSON.stringify($n)),ke.setData("text/html",ve.render($n).innerHTML),ke.setData("text/plain",$n.toString().replace(/\n$/,"")),!0}canAcceptDataTransfer(ke){const Ce={};return Array.from((ke==null?void 0:ke.types)||[]).forEach($n=>{Ce[$n]=!0}),Ce.Files||Ce["application/x-trix-document"]||Ce["text/html"]||Ce["text/plain"]}getPastedHTMLUsingHiddenElement(ke){const Ce=this.getSelectedRange(),$n={position:"absolute",left:"".concat(window.pageXOffset,"px"),top:"".concat(window.pageYOffset,"px"),opacity:0},Mn=S$1({style:$n,tagName:"div",editable:!0});return document.body.appendChild(Mn),Mn.focus(),requestAnimationFrame(()=>{const Qn=Mn.innerHTML;return k(Mn),this.setSelectedRange(Ce),ke(Qn)})}}Re(Qi,"events",{keydown(_n){this.isComposing()||this.resetInputSummary(),this.inputSummary.didInput=!0;const ke=Xi[_n.keyCode];if(ke){var Ce;let Mn=this.keys;["ctrl","alt","shift","meta"].forEach(Qn=>{var Vn;_n["".concat(Qn,"Key")]&&(Qn==="ctrl"&&(Qn="control"),Mn=(Vn=Mn)===null||Vn===void 0?void 0:Vn[Qn])}),((Ce=Mn)===null||Ce===void 0?void 0:Ce[ke])!=null&&(this.setInputSummary({keyName:ke}),Pt.reset(),Mn[ke].call(this,_n))}if(kt(_n)){const Mn=String.fromCharCode(_n.keyCode).toLowerCase();if(Mn){var $n;const Qn=["alt","shift"].map(Vn=>{if(_n["".concat(Vn,"Key")])return Vn}).filter(Vn=>Vn);Qn.push(Mn),($n=this.delegate)!==null&&$n!==void 0&&$n.inputControllerDidReceiveKeyboardCommand(Qn)&&_n.preventDefault()}}},keypress(_n){if(this.inputSummary.eventName!=null||_n.metaKey||_n.ctrlKey&&!_n.altKey)return;const ke=en(_n);var Ce,$n;return ke?((Ce=this.delegate)===null||Ce===void 0||Ce.inputControllerWillPerformTyping(),($n=this.responder)===null||$n===void 0||$n.insertString(ke),this.setInputSummary({textAdded:ke,didDelete:this.selectionIsExpanded()})):void 0},textInput(_n){const{data:ke}=_n,{textAdded:Ce}=this.inputSummary;if(Ce&&Ce!==ke&&Ce.toUpperCase()===ke){var $n;const Mn=this.getSelectedRange();return this.setSelectedRange([Mn[0],Mn[1]+Ce.length]),($n=this.responder)===null||$n===void 0||$n.insertString(ke),this.setInputSummary({textAdded:ke}),this.setSelectedRange(Mn)}},dragenter(_n){_n.preventDefault()},dragstart(_n){var ke,Ce;return this.serializeSelectionToDataTransfer(_n.dataTransfer),this.draggedRange=this.getSelectedRange(),(ke=this.delegate)===null||ke===void 0||(Ce=ke.inputControllerDidStartDrag)===null||Ce===void 0?void 0:Ce.call(ke)},dragover(_n){if(this.draggedRange||this.canAcceptDataTransfer(_n.dataTransfer)){_n.preventDefault();const $n={x:_n.clientX,y:_n.clientY};var ke,Ce;if(!St($n,this.draggingPoint))return this.draggingPoint=$n,(ke=this.delegate)===null||ke===void 0||(Ce=ke.inputControllerDidReceiveDragOverPoint)===null||Ce===void 0?void 0:Ce.call(ke,this.draggingPoint)}},dragend(_n){var ke,Ce;(ke=this.delegate)===null||ke===void 0||(Ce=ke.inputControllerDidCancelDrag)===null||Ce===void 0||Ce.call(ke),this.draggedRange=null,this.draggingPoint=null},drop(_n){var ke,Ce;_n.preventDefault();const $n=(ke=_n.dataTransfer)===null||ke===void 0?void 0:ke.files,Mn=_n.dataTransfer.getData("application/x-trix-document"),Qn={x:_n.clientX,y:_n.clientY};if((Ce=this.responder)===null||Ce===void 0||Ce.setLocationRangeFromPointRange(Qn),$n!=null&&$n.length)this.attachFiles($n);else if(this.draggedRange){var Vn,qn;(Vn=this.delegate)===null||Vn===void 0||Vn.inputControllerWillMoveText(),(qn=this.responder)===null||qn===void 0||qn.moveTextFromRange(this.draggedRange),this.draggedRange=null,this.requestRender()}else if(Mn){var Zn;const jn=Je.fromJSONString(Mn);(Zn=this.responder)===null||Zn===void 0||Zn.insertDocument(jn),this.requestRender()}this.draggedRange=null,this.draggingPoint=null},cut(_n){var ke,Ce;if((ke=this.responder)!==null&&ke!==void 0&&ke.selectionIsExpanded()&&(this.serializeSelectionToDataTransfer(_n.clipboardData)&&_n.preventDefault(),(Ce=this.del
Line truncated
|
|
||||||
`,{updatePosition:!1}),this.requestRender()}},shift:{return(_n){var ke,Ce;(ke=this.delegate)===null||ke===void 0||ke.inputControllerWillPerformTyping(),(Ce=this.responder)===null||Ce===void 0||Ce.insertString(`
|
|
||||||
`),this.requestRender(),_n.preventDefault()},tab(_n){var ke,Ce;(ke=this.responder)!==null&&ke!==void 0&&ke.canDecreaseNestingLevel()&&((Ce=this.responder)===null||Ce===void 0||Ce.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 ke;return this.setInputSummary({preferDocument:!1}),(ke=this.delegate)===null||ke===void 0?void 0:ke.inputControllerWillPerformTyping()}},meta:{backspace(_n){var ke;return this.setInputSummary({preferDocument:!1}),(ke=this.delegate)===null||ke===void 0?void 0:ke.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 ke;return(ke=_n.type)===null||ke===void 0||(ke=ke.match(/\/(\w+)$/))===null||ke===void 0?void 0:ke[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 ke;if(_n.which===null?ke=_n.keyCode:_n.which!==0&&_n.charCode!==0&&(ke=_n.charCode),ke!=null&&Xi[ke]!=="escape")return X.fromCodepoints([ke]).toString()}},nn=function(_n){const ke=_n.clipboardData;if(ke){if(ke.types.includes("text/html")){for(const Ce of ke.types){const $n=/^CorePasteboardFlavorType/.test(Ce),Mn=/^dyn\./.test(Ce)&&ke.getData(Ce);if($n||Mn)return!0}return!1}{const Ce=ke.types.includes("com.apple.webarchive"),$n=ke.types.includes("com.apple.flat-rtfd");return Ce||$n}}};class rn extends H{constructor(ke){super(...arguments),this.inputController=ke,this.responder=this.inputController.responder,this.delegate=this.inputController.delegate,this.inputSummary=this.inputController.inputSummary,this.data={}}start(ke){if(this.data.start=ke,this.isSignificant()){var Ce,$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=(Ce=this.responder)===null||Ce===void 0?void 0:Ce.getSelectedRange()}}update(ke){if(this.data.update=ke,this.isSignificant()){const Ce=this.selectPlaceholder();Ce&&(this.forgetPlaceholder(),this.range=Ce)}}end(ke){return this.data.end=ke,this.isSignificant()?(this.forgetPlaceholder(),this.canApplyToDocument()?(this.setInputSummary({preferDocument:!0,didInput:!1}),(Ce=this.delegate)===null||Ce===void 0||Ce.inputControllerWillPerformTyping(),($n=this.responder)===null||$n===void 0||$n.setSelectedRange(this.range),(Mn=this.responder)===null||Mn===void 0||Mn.insertString(this.data.end),(Qn=this.responder)===null||Qn===void 0?void 0:Qn.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 Ce,$n,Mn,Qn}getEndData(){return this.data.end}isEnded(){return this.getEndData()!=null}isSignificant(){return!$i.composesExistingText||this.inputSummary.didInput}canApplyToDocument(){var ke,Ce;return((ke=this.data.start)===null||ke===void 0?void 0:ke.length)===0&&((Ce=this.data.end)===null||Ce===void 0?void 0:Ce.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?(ke=this.delegate)===null||ke===void 0||(Ce=ke.inputControllerDidAllowUnhandledInput)===null||Ce===void 0?void 0:Ce.call(ke):void 0:this.reparse();var ke,Ce}scheduleRender(){return this.scheduledRender?this.scheduledRender:this.scheduledRender=requestAnimationFrame(this.render)}render(){var ke,Ce;cancelAnimationFrame(this.scheduledRender),this.scheduledRender=null,this.composing||(Ce=this.delegate)===null||Ce===void 0||Ce.render(),(ke=this.afterRender)===null||ke===void 0||ke.call(this),this.afterRender=null}reparse(){var ke;return(ke=this.delegate)===null||ke===void 0?void 0:ke.reparse()}insertString(){var ke;let Ce=arguments.length>0&&arguments[0]!==void 0?arguments[0]:"",$n=arguments.length>1?arguments[1]:void 0;return(ke=this.delegate)===null||ke===void 0||ke.inputControllerWillPerformTyping(),this.withTargetDOMRange(function(){var Mn;return(Mn=this.responder)===null||Mn===void 0?void 0:Mn.insertString(Ce,$n)})}toggleAttributeIfSupported(ke){var Ce;if(dt().includes(ke))return(Ce
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 ke;return(ke=this.responder)===null||ke===void 0?void 0:ke.insertLineBreak()})},insertReplacementText(){const _n=this.event.dataTransfer.getData("text/plain"),ke=this.event.getTargetRanges()[0];this.withTargetDOMRange(ke,()=>{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 ke=document.createRange();return ke.setStart(_n.startContainer,_n.startOffset),ke.setEnd(_n.endContainer,_n.endOffset),ke},an=_n=>{var ke;return Array.from(((ke=_n.dataTransfer)===null||ke===void 0?void 0:ke.types)||[]).includes("Files")},ln=_n=>{var ke;return((ke=_n.dataTransfer.files)===null||ke===void 0?void 0:ke[0])&&!cn(_n)&&!(Ce=>{let{dataTransfer:$n}=Ce;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 ke=_n.clipboardData;if(ke)return Array.from(ke.types).filter(Ce=>Ce.match(/file/i)).length===ke.types.length&&ke.files.length>=1},un=function(_n){const ke=_n.clipboardData;if(ke)return ke.types.includes("text/plain")&&ke.types.length===1},hn=function(_n){const ke=[];return _n.altKey&&ke.push("alt"),_n.shiftKey&&ke.push("shift"),ke.push(_n.key),ke},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,ke)=>(ke||(ke=Cn(_n)),_n.querySelector("[data-trix-input][name='".concat(ke,"']"))),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(ke){super(ke),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=ke,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(ke,Ce){var $n;($n=this.delegate)===null||$n===void 0||$n.toolbarDidClickButton(),ke.preventDefault();const Mn=yn(Ce);return this.getDialog(Mn)?this.toggleDialog(Mn):(Qn=this.delegate)===null||Qn===void 0?void 0:Qn.toolbarDidInvokeAction(Mn,Ce);var Qn}didClickAttributeButton(ke,Ce){var $n;($n=this.delegate)===null||$n===void 0||$n.toolbarDidClickButton(),ke.preventDefault();const Mn=Cn(Ce);var Qn;return this.getDialog(Mn)?this.toggleDialog(Mn):(Qn=this.delegate)===null||Qn===void 0||Qn.toolbarDidToggleAttribute(Mn),this.refreshAttributeButtons()}didClickDialogButton(ke,Ce){const $n=A(Ce,{matchingSelector:fn});return this[Ce.getAttribute("data-trix-method")].call(this,$n)}didKeyDownDialogInput(ke,Ce){if(ke.keyCode===13){ke.preventDefault();const $n=Ce.getAttribute("name"),Mn=this.getDialog($n);this.setAttribute(Mn)}if(ke.keyCode===27)return ke.preventDefault(),this.hideDialog()}updateActions(ke){return this.actions=ke,this.refreshActionButtons()}refreshActionButtons(){return this.eachActionButton((ke,Ce)=>{ke.disabled=this.actions[Ce]===!1})}eachActionButton(ke){return Array.from(this.element.querySelectorAll(mn)).map(Ce=>ke(Ce,yn(Ce)))}updateAttributes(ke){return this.attributes=ke,this.refreshAttributeButtons()}refreshAttributeButtons(){return this.eachAttributeButton((ke,Ce)=>(ke.disabled=this.attributes[Ce]===!1,this.attributes[Ce]||this.dialogIsVisible(Ce)?(ke.setAttribute("data-trix-active",""),ke.classList.add("trix-active")):(ke.removeAttribute("data-trix-active"),ke.classList.remove("trix-active"))))}eachAttributeButton(ke){return Array.from(this.element.querySelectorAll(gn)).map(Ce=>ke(Ce,Cn(Ce)))}applyKeyboardCommand(ke){const Ce=JSON.stringify(ke.sort());for(const $n of Array.from(this.element.querySelectorAll("[data-trix-key]"))){const Mn=$n.getAttribute("data-trix-key").split("+");if(JSON.stringify(Mn.sort())===Ce)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(ke){let Ce=arguments.length>1&&arguments[1]!==void 0?arguments[1]:{};return Ce.times=1,f(ke,Ce)}("focus",{onElement:_n,withCallback:()=>Bn(_n)})},Bn=function(_n){return Fn(_n),Pn()},Fn=function(_n){var ke,Ce;if((ke=(Ce=document).queryCommandSupported)!==null&&ke!==void 0&&ke.call(Ce,"enableObjectResizing"))return document.execCommand("enableObjectResizing",!1,!1),f("mscontrolselect",{onElement:_n,preventDefault:!0})},Pn=function(_n){var ke,Ce;if((ke=(Ce=document).queryCommandSupported)!==null&&ke!==void 0&&ke.call(Ce,"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 ke=[];this.id&&this.ownerDocument&&ke.push(...Array.from(this.ownerDocument.querySelectorAll("label[for='".concat(this.id,"']"))||[]));const Ce=A(this,{matchingSelector:"label"});return Ce&&[this,null].includes(Ce.control)&&ke.push(Ce),ke}get toolbarElement(){var ke;if(this.hasAttribute("toolbar"))return(ke=this.ownerDocument)===null||ke===void 0?void 0:ke.getElementById(this.getAttribute("toolbar"));if(this.parentNode){const Ce="trix-toolbar-".concat(this.trixId);this.setAttribute("toolbar",Ce);const $n=S$1("trix-toolbar",{id:Ce});return this.parentNode.insertBefore($n,this),$n}}get form(){var ke;return(ke=this.inputElement)===null||ke===void 0?void 0:ke.form}get inputElement(){var ke;if(this.hasAttribute("input"))return(ke=this.ownerDocument)===null||ke===void 0?void 0:ke.getElementById(this.getAttribute("input"));if(this.parentNode){const Ce="trix-input-".concat(this.trixId);this.setAttribute("input",Ce);const $n=S$1("input",{type:"hidden",id:Ce});return this.parentNode.insertBefore($n,this.nextElementSibling),$n}}get editor(){var ke;return(ke=this.editorController)===null||ke===void 0?void 0:ke.editor}get name(){var ke;return(ke=this.inputElement)===null||ke===void 0?void 0:ke.name}get value(){var ke;return(ke=this.inputElement)===null||ke===void 0?void 0:ke.value}set value(ke){var Ce;this.defaultValue=ke,(Ce=this.editor)===null||Ce===void 0||Ce.loadHTML(this.defaultValue)}notify(ke,Ce){if(this.editorController)return b("trix-".concat(ke),{onElement:this,attributes:Ce})}setInputElementValue(ke){this.inputElement&&(this.inputElement.value=ke)}connectedCallback(){this.hasAttribute("data-trix-internal")||(Tn(this),function(ke){ke.hasAttribute("role")||ke.setAttribute("role","textbox")}(this),function(ke){if(ke.hasAttribute("aria-label")||ke.hasAttribute("aria-labelledby"))return;const Ce=function(){const $n=Array.from(ke.labels).map(Qn=>{if(!Qn.contains(ke))return Qn.textContent}).filter(Qn=>Qn),Mn=$n.join(" ");return Mn?ke.setAttribute("aria-label",Mn):ke.removeAttribute("aria-label")};Ce(),f("focus",{onElement:ke,withCallback:Ce})}(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(ke){!document.querySelector(":focus")&&ke.hasAttribute("autofocus")&&document.querySelector("[autofocus]")===ke&&ke.focus()}(this))}disconnectedCallback(){var ke;return(ke=this.editorController)===null||ke===void 0||ke.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(ke){if(!ke.defaultPrevented&&ke.target===this.form)return this.reset()}clickBubbled(ke){if(ke.defaultPrevented||this.contains(ke.target))return;const Ce=A(ke.target,{matchingSelector:"label"});return Ce&&Array.from(this.labels).includes(Ce)?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 ke,Ce,$n,Mn,Qn,Vn,qn,Zn;return{c(){ke=element("div"),Ce=element("input"),Mn=space$3(),Qn=element("trix-editor"),attr(Ce,"id",$n="x-"+_n[1].name),Ce.value=_n[0],attr(Ce,"type","hidden"),set_custom_element_data(Qn,"class","content"),set_custom_element_data(Qn,"input",Vn="x-"+_n[1].name),set_custom_element_data(Qn,"role","textbox"),set_custom_element_data(Qn,"tabindex","0"),attr(ke,"class","tox-wrapper")},m(jn,Xn){insert$1(jn,ke,Xn),append(ke,Ce),append(ke,Mn),append(ke,Qn),_n[5](Qn),qn||(Zn=listen(Qn,"trix-change",_n[3]),qn=!0)},p(jn,[Xn]){Xn&2&&$n!==($n="x-"+jn[1].name)&&attr(Ce,"id",$n),Xn&1&&(Ce.value=jn[0]),Xn&2&&Vn!==(Vn="x-"+jn[1].name)&&set_custom_element_data(Qn,"input",Vn)},i:noop,o:noop,d(jn){jn&&detach(ke),_n[5](null),qn=!1,Zn()}}}function instance$k(_n,ke,Ce){let{value:$n=""}=ke,{field:Mn}=ke,Qn;functio
Line truncated
|
|
||||||
`){[ke,Ce]=clip(this,ke,Ce);let Mn="";for(let Qn=0,Vn=0;Qn<=Ce&&Vn<this.text.length;Vn++){let qn=this.text[Vn],Zn=Qn+qn.length;Qn>ke&&Vn&&(Mn+=$n),ke<Zn&&Ce>Qn&&(Mn+=qn.slice(Math.max(0,ke-Qn),Ce-Qn)),Qn=Zn+1}return Mn}flatten(ke){for(let Ce of this.text)ke.push(Ce)}scanIdentical(){return 0}static split(ke,Ce){let $n=[],Mn=-1;for(let Qn of ke)$n.push(Qn),Mn+=Qn.length+1,$n.length==32&&(Ce.push(new TextLeaf($n,Mn)),$n=[],Mn=-1);return Mn>-1&&Ce.push(new TextLeaf($n,Mn)),Ce}}class TextNode extends Text{constructor(ke,Ce){super(),this.children=ke,this.length=Ce,this.lines=0;for(let $n of ke)this.lines+=$n.lines}lineInner(ke,Ce,$n,Mn){for(let Qn=0;;Qn++){let Vn=this.children[Qn],qn=Mn+Vn.length,Zn=$n+Vn.lines-1;if((Ce?Zn:qn)>=ke)return Vn.lineInner(ke,Ce,$n,Mn);Mn=qn+1,$n=Zn+1}}decompose(ke,Ce,$n,Mn){for(let Qn=0,Vn=0;Vn<=Ce&&Qn<this.children.length;Qn++){let qn=this.children[Qn],Zn=Vn+qn.length;if(ke<=Zn&&Ce>=Vn){let jn=Mn&((Vn<=ke?1:0)|(Zn>=Ce?2:0));Vn>=ke&&Zn<=Ce&&!jn?$n.push(qn):qn.decompose(ke-Vn,Ce-Vn,$n,jn)}Vn=Zn+1}}replace(ke,Ce,$n){if([ke,Ce]=clip(this,ke,Ce),$n.lines<this.lines)for(let Mn=0,Qn=0;Mn<this.children.length;Mn++){let Vn=this.children[Mn],qn=Qn+Vn.length;if(ke>=Qn&&Ce<=qn){let Zn=Vn.replace(ke-Qn,Ce-Qn,$n),jn=this.lines-Vn.lines+Zn.lines;if(Zn.lines<jn>>4&&Zn.lines>jn>>6){let Xn=this.children.slice();return Xn[Mn]=Zn,new TextNode(Xn,this.length-(Ce-ke)+$n.length)}return super.replace(Qn,qn,Zn)}Qn=qn+1}return super.replace(ke,Ce,$n)}sliceString(ke,Ce=this.length,$n=`
|
|
||||||
`){[ke,Ce]=clip(this,ke,Ce);let Mn="";for(let Qn=0,Vn=0;Qn<this.children.length&&Vn<=Ce;Qn++){let qn=this.children[Qn],Zn=Vn+qn.length;Vn>ke&&Qn&&(Mn+=$n),ke<Zn&&Ce>Vn&&(Mn+=qn.sliceString(ke-Vn,Ce-Vn,$n)),Vn=Zn+1}return Mn}flatten(ke){for(let Ce of this.children)Ce.flatten(ke)}scanIdentical(ke,Ce){if(!(ke instanceof TextNode))return 0;let $n=0,[Mn,Qn,Vn,qn]=Ce>0?[0,0,this.children.length,ke.children.length]:[this.children.length-1,ke.children.length-1,-1,-1];for(;;Mn+=Ce,Qn+=Ce){if(Mn==Vn||Qn==qn)return $n;let Zn=this.children[Mn],jn=ke.children[Qn];if(Zn!=jn)return $n+Zn.scanIdentical(jn,Ce);$n+=Zn.length+1}}static from(ke,Ce=ke.reduce(($n,Mn)=>$n+Mn.length+1,-1)){let $n=0;for(let Wn of ke)$n+=Wn.lines;if($n<32){let Wn=[];for(let Yn of ke)Yn.flatten(Wn);return new TextLeaf(Wn,Ce)}let Mn=Math.max(32,$n>>5),Qn=Mn<<1,Vn=Mn>>1,qn=[],Zn=0,jn=-1,Xn=[];function zn(Wn){let Yn;if(Wn.lines>Qn&&Wn instanceof TextNode)for(let Un of Wn.children)zn(Un);else Wn.lines>Vn&&(Zn>Vn||!Zn)?(Hn(),qn.push(Wn)):Wn instanceof TextLeaf&&Zn&&(Yn=Xn[Xn.length-1])instanceof TextLeaf&&Wn.lines+Yn.lines<=32?(Zn+=Wn.lines,jn+=Wn.length+1,Xn[Xn.length-1]=new TextLeaf(Yn.text.concat(Wn.text),Yn.length+1+Wn.length)):(Zn+Wn.lines>Mn&&Hn(),Zn+=Wn.lines,jn+=Wn.length+1,Xn.push(Wn))}function Hn(){Zn!=0&&(qn.push(Xn.length==1?Xn[0]:TextNode.from(Xn,jn)),jn=-1,Zn=Xn.length=0)}for(let Wn of ke)zn(Wn);return Hn(),qn.length==1?qn[0]:new TextNode(qn,Ce)}}Text.empty=new TextLeaf([""],0);function textLength(_n){let ke=-1;for(let Ce of _n)ke+=Ce.length+1;return ke}function appendText(_n,ke,Ce=0,$n=1e9){for(let Mn=0,Qn=0,Vn=!0;Qn<_n.length&&Mn<=$n;Qn++){let qn=_n[Qn],Zn=Mn+qn.length;Zn>=Ce&&(Zn>$n&&(qn=qn.slice(0,$n-Mn)),Mn<Ce&&(qn=qn.slice(Ce-Mn)),Vn?(ke[ke.length-1]+=qn,Vn=!1):ke.push(qn)),Mn=Zn+1}return ke}function sliceText(_n,ke,Ce){return appendText(_n,[""],ke,Ce)}class RawTextCursor{constructor(ke,Ce=1){this.dir=Ce,this.done=!1,this.lineBreak=!1,this.value="",this.nodes=[ke],this.offsets=[Ce>0?1:(ke instanceof TextLeaf?ke.text.length:ke.children.length)<<1]}nextInner(ke,Ce){for(this.done=this.lineBreak=!1;;){let $n=this.nodes.length-1,Mn=this.nodes[$n],Qn=this.offsets[$n],Vn=Qn>>1,qn=Mn instanceof TextLeaf?Mn.text.length:Mn.children.length;if(Vn==(Ce>0?qn:0)){if($n==0)return this.done=!0,this.value="",this;Ce>0&&this.offsets[$n-1]++,this.nodes.pop(),this.offsets.pop()}else if((Qn&1)==(Ce>0?0:1)){if(this.offsets[$n]+=Ce,ke==0)return this.lineBreak=!0,this.value=`
|
|
||||||
`,this;ke--}else if(Mn instanceof TextLeaf){let Zn=Mn.text[Vn+(Ce<0?-1:0)];if(this.offsets[$n]+=Ce,Zn.length>Math.max(0,ke))return this.value=ke==0?Zn:Ce>0?Zn.slice(ke):Zn.slice(0,Zn.length-ke),this;ke-=Zn.length}else{let Zn=Mn.children[Vn+(Ce<0?-1:0)];ke>Zn.length?(ke-=Zn.length,this.offsets[$n]+=Ce):(Ce<0&&this.offsets[$n]--,this.nodes.push(Zn),this.offsets.push(Ce>0?1:(Zn instanceof TextLeaf?Zn.text.length:Zn.children.length)<<1))}}}next(ke=0){return ke<0&&(this.nextInner(-ke,-this.dir),ke=this.value.length),this.nextInner(ke,this.dir)}}class PartialTextCursor{constructor(ke,Ce,$n){this.value="",this.done=!1,this.cursor=new RawTextCursor(ke,Ce>$n?-1:1),this.pos=Ce>$n?ke.length:0,this.from=Math.min(Ce,$n),this.to=Math.max(Ce,$n)}nextInner(ke,Ce){if(Ce<0?this.pos<=this.from:this.pos>=this.to)return this.value="",this.done=!0,this;ke+=Math.max(0,Ce<0?this.pos-this.to:this.from-this.pos);let $n=Ce<0?this.pos-this.from:this.to-this.pos;ke>$n&&(ke=$n),$n-=ke;let{value:Mn}=this.cursor.next(ke);return this.pos+=(Mn.length+ke)*Ce,this.value=Mn.length<=$n?Mn:Ce<0?Mn.slice(Mn.length-$n):Mn.slice(0,$n),this.done=!this.value,this}next(ke=0){return ke<0?ke=Math.max(ke,this.from-this.pos):ke>0&&(ke=Math.min(ke,this.to-this.pos)),this.nextInner(ke,this.cursor.dir)}get lineBreak(){return this.cursor.lineBreak&&this.value!=""}}class LineCursor{constructor(ke){this.inner=ke,this.afterBreak=!0,this.value="",this.done=!1}next(ke=0){let{done:Ce,lineBreak:$n,value:Mn}=this.inner.next(ke);return Ce&&this.afterBreak?(this.value="",this.afterBreak=!1):Ce?(this.done=!0,this.value=""):$n?this.afterBreak?this.value="":(this.afterBreak=!0,this.next()):(this.value=Mn,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(ke,Ce,$n,Mn){this.from=ke,this.to=Ce,this.number=$n,this.text=Mn}get length(){return this.to-this.from}};function clip(_n,ke,Ce){return ke=Math.max(0,Math.min(_n.length,ke)),[ke,Math.max(ke,Math.min(_n.length,Ce))]}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 ke=1;ke<extend.length;ke+=2)if(extend[ke]>_n)return extend[ke-1]<=_n;return!1}function isRegionalIndicator(_n){return _n>=127462&&_n<=127487}const ZWJ=8205;function findClusterBreak(_n,ke,Ce=!0,$n=!0){return(Ce?nextClusterBreak:prevClusterBreak)(_n,ke,$n)}function nextClusterBreak(_n,ke,Ce){if(ke==_n.length)return ke;ke&&surrogateLow(_n.charCodeAt(ke))&&surrogateHigh(_n.charCodeAt(ke-1))&&ke--;let $n=codePointAt(_n,ke);for(ke+=codePointSize($n);ke<_n.length;){let Mn=codePointAt(_n,ke);if($n==ZWJ||Mn==ZWJ||Ce&&isExtendingChar(Mn))ke+=codePointSize(Mn),$n=Mn;else if(isRegionalIndicator(Mn)){let Qn=0,Vn=ke-2;for(;Vn>=0&&isRegionalIndicator(codePointAt(_n,Vn));)Qn++,Vn-=2;if(Qn%2==0)break;ke+=2}else break}return ke}function prevClusterBreak(_n,ke,Ce){for(;ke>0;){let $n=nextClusterBreak(_n,ke-2,Ce);if($n<ke)return $n;ke--}return 0}function surrogateLow(_n){return _n>=56320&&_n<57344}function surrogateHigh(_n){return _n>=55296&&_n<56320}function codePointAt(_n,ke){let Ce=_n.charCodeAt(ke);if(!surrogateHigh(Ce)||ke+1==_n.length)return Ce;let $n=_n.charCodeAt(ke+1);return surrogateLow($n)?(Ce-55296<<10)+($n-56320)+65536:Ce}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(ke,...Ce){for(let $n of this.facet(EditorState.phrases))if(Object.prototype.hasOwnProperty.call($n,ke)){ke=$n[ke];break}return Ce.length&&(ke=ke.replace(/\$(\$|\d*)/g,($n,Mn)=>{if(Mn=="$")return"$";let Qn=+(Mn||1);return!Qn||Qn>Ce.length?$n:Ce[Qn-1]})),ke}languageDataAt(ke,Ce,$n=-1){let Mn=[];for(let Qn of this.facet(languageData))for(let Vn of Qn(this,Ce,$n))Object.prototype.hasOwnProperty.call(Vn,ke)&&Mn.push(Vn[ke]);return Mn}charCategorizer(ke){return makeCategorizer(this.languageDataAt("wordChars",ke).join(""))}wordAt(ke){let{text:Ce,from:$n,length:Mn}=this.doc.lineAt(ke),Qn=this.charCategorizer(ke),Vn=ke-$n,qn=ke-$n;for(;Vn>0;){let Zn=findClusterBreak(Ce,Vn,!1);if(Qn(Ce.slice(Zn,Vn))!=CharCategory.Word)break;Vn=Zn}for(;qn<Mn;){let Zn=findClusterBreak(Ce,qn);if(Qn(Ce.slice(qn,Zn))!=CharCategory.Word)break;qn=Zn}return Vn==qn?null:EditorSelection.range(Vn+$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,ke){let Ce=Object.keys(_n),$n=Object.keys(ke);return Ce.length==$n.length&&Ce.every(Mn=>_n[Mn]==ke[Mn])}});EditorState.languageData=languageData;EditorState.changeFilter=changeFilter;EditorState.transactionFilter=transactionFilter;EditorState.transactionExtender=transactionExtender;Compartment.reconfigure=StateEffect.define();function combineConfig(_n,ke,Ce={}){let $n={};for(let Mn of _n)for(let Qn of Object.keys(Mn)){let Vn=Mn[Qn],qn=$n[Qn];if(qn===void 0)$n[Qn]=Vn;else if(!(qn===Vn||Vn===void 0))if(Object.hasOwnProperty.call(Ce,Qn))$n[Qn]=Ce[Qn](qn,Vn);else throw new Error("Config merge conflict for field "+Qn)}for(let Mn in ke)$n[Mn]===void 0&&($n[Mn]=ke[Mn]);return $n}class RangeValue{eq(ke){return this==ke}range(ke,Ce=ke){return Range$1.create(ke,Ce,this)}}RangeValue.prototype.startSide=RangeValue.prototype.endSide=0;RangeValue.prototype.point=!1;RangeValue.prototype.mapMode=MapMode.TrackDel;let Range$1=class go{constructor(ke,Ce,$n){this.from=ke,this.to=Ce,this.value=$n}static create(ke,Ce,$n){return new go(ke,Ce,$n)}};function cmpRange(_n,ke){return _n.from-ke.from||_n.value.startSide-ke.value.startSide}class Chunk{constructor(ke,Ce,$n,Mn){this.from=ke,this.to=Ce,this.value=$n,this.maxPoint=Mn}get length(){return this.to[this.to.length-1]}findIndex(ke,Ce,$n,Mn=0){let Qn=$n?this.to:this.from;for(let Vn=Mn,qn=Qn.length;;){if(Vn==qn)return Vn;let Zn=Vn+qn>>1,jn=Qn[Zn]-ke||($n?this.value[Zn].endSide:this.value[Zn].startSide)-Ce;if(Zn==Vn)return jn>=0?Vn:qn;jn>=0?qn=Zn:Vn=Zn+1}}between(ke,Ce,$n,Mn){for(let Qn=this.findIndex(Ce,-1e9,!0),Vn=this.findIndex($n,1e9,!1,Qn);Qn<Vn;Qn++)if(Mn(this.from[Qn]+ke,this.to[Qn]+ke,this.value[Qn])===!1)return!1}map(ke,Ce){let $n=[],Mn=[],Qn=[],Vn=-1,qn=-1;for(let Zn=0;Zn<this.value.length;Zn++){let jn=this.value[Zn],Xn=this.from[Zn]+ke,zn=this.to[Zn]+ke,Hn,Wn;if(Xn==zn){let Yn=Ce.mapPos(Xn,jn.startSide,jn.mapMode);if(Yn==null||(Hn=Wn=Yn,jn.startSide!=jn.endSide&&(Wn=Ce.mapPos(Xn,jn.endSide),Wn<Hn)))continue}else if(Hn=Ce.mapPos(Xn,jn.startSide),Wn=Ce.mapPos(zn,jn.endSide),Hn>Wn||Hn==Wn&&jn.startSide>0&&jn.endSide<=0)continue;(Wn-Hn||jn.endSide-jn.startSide)<0||(Vn<0&&(Vn=Hn),jn.point&&(qn=Math.max(qn,Wn-Hn)),$n.push(jn),Mn.push(Hn-Vn),Qn.push(Wn-Vn))}return{mapped:$n.length?new Chunk(Mn,Qn,$n,qn):null,pos:Vn}}}class RangeSet{constructor(ke,Ce,$n,Mn){this.chunkPos=ke,this.chunk=Ce,this.nextLayer=$n,this.maxPoint=Mn}static create(ke,Ce,$n,Mn){return new RangeSet(ke,Ce,$n,Mn)}get length(){let ke=this.chunk.length-1;return ke<0?0:Math.max(this.chunkEnd(ke),this.nextLayer.length)}get size(){if(this.isEmpty)return 0;let ke=this.nextLayer.size;for(let Ce of this.chunk)ke+=Ce.value.length;return ke}chunkEnd(ke){return this.chunkPos[ke]+this.chunk[ke].length}update(ke){let{add:Ce=[],sort:$n=!1,filterFrom:Mn=0,filterTo:Qn=this.length}=ke,Vn=ke.filter;if(Ce.length==0&&!Vn)return this;if($n&&(Ce=Ce.slice().sort(cmpRange)),this.isEmpty)return Ce.length?RangeSet.of(Ce):this;let qn=new LayerCursor(this,null,-1).goto(0),Zn=0,jn=[],Xn=new RangeSetBuilder;for(;qn.value||Zn<Ce.length;)if(Zn<Ce.length&&(qn.from-Ce[Zn].from||qn.startSide-Ce[Zn].value.startSide)>=0){let zn=Ce[Zn++];Xn.addInner(zn.from,zn.to,zn.value)||jn.push(zn)}else qn.rangeIndex==1&&qn.chunkIndex<this.chunk.length&&(Zn==Ce.length||this.chunkEnd(qn.chunkIndex)<Ce[Zn].from)&&(!Vn||Mn>this.chunkEnd(qn.chunkIndex)||Qn<this.chunkPos[qn.chunkIndex])&&Xn.addChunk(this.chunkPos[qn.chunkIndex],this.chunk[qn.chunkIndex])?qn.nextChunk():((!Vn||Mn>qn.to||Qn<qn.from||Vn(qn.from,qn.to,qn.value))&&(Xn.addInner(qn.from,qn.to,qn.value)||jn.push(Range$1.create(qn.from,qn.to,qn.value))),qn.next());return Xn.finishInner(this.nextLayer.isEmpty&&!jn.length?RangeSet.empty:this.nextLayer.update({add:jn,filter:Vn,filterFrom:Mn,filterTo:Qn}))}map(ke){if(ke.empty||this.isEmpty)return this;let Ce=
Line truncated
|
|
||||||
`)}static newName(){let ke=top[COUNT]||1;return top[COUNT]=ke+1,C+ke.toString(36)}static mount(ke,Ce,$n){let Mn=ke[SET],Qn=$n&&$n.nonce;Mn?Qn&&Mn.setNonce(Qn):Mn=new StyleSet(ke,Qn),Mn.mount(Array.isArray(Ce)?Ce:[Ce],ke)}}let adoptedSet=new Map;class StyleSet{constructor(ke,Ce){let $n=ke.ownerDocument||ke,Mn=$n.defaultView;if(!ke.head&&ke.adoptedStyleSheets&&Mn.CSSStyleSheet){let Qn=adoptedSet.get($n);if(Qn)return ke[SET]=Qn;this.sheet=new Mn.CSSStyleSheet,adoptedSet.set($n,this)}else this.styleTag=$n.createElement("style"),Ce&&this.styleTag.setAttribute("nonce",Ce);this.modules=[],ke[SET]=this}mount(ke,Ce){let $n=this.sheet,Mn=0,Qn=0;for(let Vn=0;Vn<ke.length;Vn++){let qn=ke[Vn],Zn=this.modules.indexOf(qn);if(Zn<Qn&&Zn>-1&&(this.modules.splice(Zn,1),Qn--,Zn=-1),Zn==-1){if(this.modules.splice(Qn++,0,qn),$n)for(let jn=0;jn<qn.rules.length;jn++)$n.insertRule(qn.rules[jn],Mn++)}else{for(;Qn<Zn;)Mn+=this.modules[Qn++].rules.length;Mn+=qn.rules.length,Qn++}}if($n)Ce.adoptedStyleSheets.indexOf(this.sheet)<0&&(Ce.adoptedStyleSheets=[this.sheet,...Ce.adoptedStyleSheets]);else{let Vn="";for(let Zn=0;Zn<this.modules.length;Zn++)Vn+=this.modules[Zn].getRules()+`
|
|
||||||
`;this.styleTag.textContent=Vn;let qn=Ce.head||Ce;this.styleTag.parentNode!=qn&&qn.insertBefore(this.styleTag,qn.firstChild)}}setNonce(ke){this.styleTag&&this.styleTag.getAttribute("nonce")!=ke&&this.styleTag.setAttribute("nonce",ke)}}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 ke=mac&&_n.metaKey&&_n.shiftKey&&!_n.ctrlKey&&!_n.altKey||ie$1&&_n.shiftKey&&_n.key&&_n.key.length==1||_n.key=="Unidentified",Ce=!ke&&_n.key||(_n.shiftKey?shift:base)[_n.keyCode]||_n.key||"Unidentified";return Ce=="Esc"&&(Ce="Escape"),Ce=="Del"&&(Ce="Delete"),Ce=="Left"&&(Ce="ArrowLeft"),Ce=="Up"&&(Ce="ArrowUp"),Ce=="Right"&&(Ce="ArrowRight"),Ce=="Down"&&(Ce="ArrowDown"),Ce}function getSelection(_n){let ke;return _n.nodeType==11?ke=_n.getSelection?_n:_n.ownerDocument:ke=_n,ke.getSelection()}function contains(_n,ke){return ke?_n==ke||_n.contains(ke.nodeType!=1?ke.parentNode:ke):!1}function hasSelection(_n,ke){if(!ke.anchorNode)return!1;try{return contains(_n,ke.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,ke,Ce,$n){return Ce?scanFor(_n,ke,Ce,$n,-1)||scanFor(_n,ke,Ce,$n,1):!1}function domIndex(_n){for(var ke=0;;ke++)if(_n=_n.previousSibling,!_n)return ke}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,ke,Ce,$n,Mn){for(;;){if(_n==Ce&&ke==$n)return!0;if(ke==(Mn<0?0:maxOffset(_n))){if(_n.nodeName=="DIV")return!1;let Qn=_n.parentNode;if(!Qn||Qn.nodeType!=1)return!1;ke=domIndex(_n)+(Mn<0?0:1),_n=Qn}else if(_n.nodeType==1){if(_n=_n.childNodes[ke+(Mn<0?-1:0)],_n.nodeType==1&&_n.contentEditable=="false")return!1;ke=Mn<0?maxOffset(_n):0}else return!1}}function maxOffset(_n){return _n.nodeType==3?_n.nodeValue.length:_n.childNodes.length}function flattenRect(_n,ke){let Ce=ke?_n.left:_n.right;return{left:Ce,right:Ce,top:_n.top,bottom:_n.bottom}}function windowRect(_n){let ke=_n.visualViewport;return ke?{left:0,right:ke.width,top:0,bottom:ke.height}:{left:0,right:_n.innerWidth,top:0,bottom:_n.innerHeight}}function getScale(_n,ke){let Ce=ke.width/_n.offsetWidth,$n=ke.height/_n.offsetHeight;return(Ce>.995&&Ce<1.005||!isFinite(Ce)||Math.abs(ke.width-_n.offsetWidth)<1)&&(Ce=1),($n>.995&&$n<1.005||!isFinite($n)||Math.abs(ke.height-_n.offsetHeight)<1)&&($n=1),{scaleX:Ce,scaleY:$n}}function scrollRectIntoView(_n,ke,Ce,$n,Mn,Qn,Vn,qn){let Zn=_n.ownerDocument,jn=Zn.defaultView||window;for(let Xn=_n,zn=!1;Xn&&!zn;)if(Xn.nodeType==1){let Hn,Wn=Xn==Zn.body,Yn=1,Un=1;if(Wn)Hn=windowRect(jn);else{if(/^(fixed|sticky)$/.test(getComputedStyle(Xn).position)&&(zn=!0),Xn.scrollHeight<=Xn.clientHeight&&Xn.scrollWidth<=Xn.clientWidth){Xn=Xn.assignedSlot||Xn.parentNode;continue}let Jn=Xn.getBoundingClientRect();({scaleX:Yn,scaleY:Un}=getScale(Xn,Jn)),Hn={left:Jn.left,right:Jn.left+Xn.clientWidth*Yn,top:Jn.top,bottom:Jn.top+Xn.clientHeight*Un}}let Gn=0,Kn=0;if(Mn=="nearest")ke.top<Hn.top?(Kn=-(Hn.top-ke.top+Vn),Ce>0&&ke.bottom>Hn.bottom+Kn&&(Kn=ke.bottom-Hn.bottom+Kn+Vn)):ke.bottom>Hn.bottom&&(Kn=ke.bottom-Hn.bottom+Vn,Ce<0&&ke.top-Kn<Hn.top&&(Kn=-(Hn.top+Kn-ke.top+Vn)));else{let Jn=ke.bottom-ke.top,tr=Hn.bottom-Hn.top;Kn=(Mn=="center"&&Jn<=tr?ke.top+Jn/2-tr/2:Mn=="start"||Mn=="center"&&Ce<0?ke.top-Vn:ke.bottom-tr+Vn)-Hn.top}if($n=="nearest"?ke.left<Hn.left?(Gn=-(Hn.left-ke.left+Qn),Ce>0&&ke.right>Hn.right+Gn&&(Gn=ke.right-Hn.right+Gn+Qn)):ke.right>Hn.right&&(Gn=ke.right-Hn.right+Qn,Ce<0&&ke.left<Hn.left+Gn&&(Gn=-(Hn.left+Gn-ke.left+Qn))):Gn=($n=="center"?ke.left+(ke.right-ke.left)/2-(Hn.right-Hn.left)/2:$n=="start"==qn?ke.left-Qn:ke.right-(Hn.right-Hn.left)+Qn)-Hn.left,Gn||Kn)if(Wn)jn.scrollBy(Gn,Kn);else{let Jn=0,tr=0;if(Kn){let nr=Xn.scrollTop;Xn.scrollTop+=Kn/Un,tr=(Xn.scrollTop-nr)*Un}if(Gn){let nLine truncated
|
|
||||||
`,Mn=_n.state.doc.line(Mn.number+(Ce?1:-1)),Qn=_n.bidiSpans(Mn),jn=_n.visualLineSide(Mn,!Ce)}if(Zn){if(!Zn(Xn))return qn}else{if(!$n)return jn;Zn=$n(Xn)}qn=jn}}function byGroup(_n,ke,Ce){let $n=_n.state.charCategorizer(ke),Mn=$n(Ce);return Qn=>{let Vn=$n(Qn);return Mn==CharCategory.Space&&(Mn=Vn),Mn==Vn}}function moveVertically(_n,ke,Ce,$n){let Mn=ke.head,Qn=Ce?1:-1;if(Mn==(Ce?_n.state.doc.length:0))return EditorSelection.cursor(Mn,ke.assoc);let Vn=ke.goalColumn,qn,Zn=_n.contentDOM.getBoundingClientRect(),jn=_n.coordsAtPos(Mn,ke.assoc||-1),Xn=_n.documentTop;if(jn)Vn==null&&(Vn=jn.left-Zn.left),qn=Qn<0?jn.top:jn.bottom;else{let Wn=_n.viewState.lineBlockAt(Mn);Vn==null&&(Vn=Math.min(Zn.right-Zn.left,_n.defaultCharacterWidth*(Mn-Wn.from))),qn=(Qn<0?Wn.top:Wn.bottom)+Xn}let zn=Zn.left+Vn,Hn=$n??_n.viewState.heightOracle.textHeight>>1;for(let Wn=0;;Wn+=10){let Yn=qn+(Hn+Wn)*Qn,Un=posAtCoords(_n,{x:zn,y:Yn},!1,Qn);if(Yn<Zn.top||Yn>Zn.bottom||(Qn<0?Un<Mn:Un>Mn)){let Gn=_n.docView.coordsForChar(Un),Kn=!Gn||Yn<Gn.top?-1:1;return EditorSelection.cursor(Un,Kn,void 0,Vn)}}}function skipAtomicRanges(_n,ke,Ce){for(;;){let $n=0;for(let Mn of _n)Mn.between(ke-1,ke+1,(Qn,Vn,qn)=>{if(ke>Qn&&ke<Vn){let Zn=$n||Ce||(ke-Qn<Vn-ke?-1:1);ke=Zn<0?Qn:Vn,$n=Zn}});if(!$n)return ke}}function skipAtoms(_n,ke,Ce){let $n=skipAtomicRanges(_n.state.facet(atomicRanges).map(Mn=>Mn(_n)),Ce.from,ke.head>Ce.from?-1:1);return $n==Ce.from?Ce:EditorSelection.cursor($n,$n<Ce.from?1:-1)}const LineBreakPlaceholder="";class DOMReader{constructor(ke,Ce){this.points=ke,this.text="",this.lineSeparator=Ce.facet(EditorState.lineSeparator)}append(ke){this.text+=ke}lineBreak(){this.text+=LineBreakPlaceholder}readRange(ke,Ce){if(!ke)return this;let $n=ke.parentNode;for(let Mn=ke;;){this.findPointBefore($n,Mn);let Qn=this.text.length;this.readNode(Mn);let Vn=Mn.nextSibling;if(Vn==Ce)break;let qn=ContentView.get(Mn),Zn=ContentView.get(Vn);(qn&&Zn?qn.breakAfter:(qn?qn.breakAfter:isBlockElement(Mn))||isBlockElement(Vn)&&(Mn.nodeName!="BR"||Mn.cmIgnore)&&this.text.length>Qn)&&this.lineBreak(),Mn=Vn}return this.findPointBefore($n,Ce),this}readTextNode(ke){let Ce=ke.nodeValue;for(let $n of this.points)$n.node==ke&&($n.pos=this.text.length+Math.min($n.offset,Ce.length));for(let $n=0,Mn=this.lineSeparator?null:/\r\n?|\n/g;;){let Qn=-1,Vn=1,qn;if(this.lineSeparator?(Qn=Ce.indexOf(this.lineSeparator,$n),Vn=this.lineSeparator.length):(qn=Mn.exec(Ce))&&(Qn=qn.index,Vn=qn[0].length),this.append(Ce.slice($n,Qn<0?Ce.length:Qn)),Qn<0)break;if(this.lineBreak(),Vn>1)for(let Zn of this.points)Zn.node==ke&&Zn.pos>this.text.length&&(Zn.pos-=Vn-1);$n=Qn+Vn}}readNode(ke){if(ke.cmIgnore)return;let Ce=ContentView.get(ke),$n=Ce&&Ce.overrideDOMText;if($n!=null){this.findPointInside(ke,$n.length);for(let Mn=$n.iter();!Mn.next().done;)Mn.lineBreak?this.lineBreak():this.append(Mn.value)}else ke.nodeType==3?this.readTextNode(ke):ke.nodeName=="BR"?ke.nextSibling&&this.lineBreak():ke.nodeType==1&&this.readRange(ke.firstChild,null)}findPointBefore(ke,Ce){for(let $n of this.points)$n.node==ke&&ke.childNodes[$n.offset]==Ce&&($n.pos=this.text.length)}findPointInside(ke,Ce){for(let $n of this.points)(ke.nodeType==3?$n.node==ke:ke.contains($n.node))&&($n.pos=this.text.length+(isAtEnd(ke,$n.node,$n.offset)?Ce:0))}}function isAtEnd(_n,ke,Ce){for(;;){if(!ke||Ce<maxOffset(ke))return!1;if(ke==_n)return!0;Ce=domIndex(ke)+1,ke=ke.parentNode}}class DOMPoint{constructor(ke,Ce){this.node=ke,this.offset=Ce,this.pos=-1}}class DOMChange{constructor(ke,Ce,$n,Mn){this.typeOver=Mn,this.bounds=null,this.text="",this.domChanged=Ce>-1;let{impreciseHead:Qn,impreciseAnchor:Vn}=ke.docView;if(ke.state.readOnly&&Ce>-1)this.newSel=null;else if(Ce>-1&&(this.bounds=ke.docView.domBoundsAround(Ce,$n,0))){let qn=Qn||Vn?[]:selectionPoints(ke),Zn=new DOMReader(qn,ke.state);Zn.readRange(this.bounds.startDOM,this.bounds.endDOM),this.text=Zn.text,this.newSel=selectionFromPoints(qn,this.bounds.from)}else{let qn=ke.observer.selectionRange,Zn=Qn&&Qn.node==qn.focusNode&&Qn.offset==qn.focusOffset||!contains(ke.contentDOM,qn.focusNode)?ke.state.selection.main.head:ke.docView.posFromDOM(qn.focusNode,qn.focusOffset),jn=Vn&&Vn.node==qn.anchorNode&&Vn.offset==qn.anchorOffset||!contains(ke.contentDOM,qn.anchorNode)?ke.state.selection.main.anchor:ke.docView.posFromDOM(qn.anchorNode,qn.anchorOffset),Xn=ke.viewport;if((browser.ios||browser.chrome)&&ke.state.selection.main.empty&&Zn!=jn&&(Xn.from>0||Xn.to<ke.state.doc.length)){let zn=Math.min(Zn,jn),Hn=Math.max(Zn,jn),Wn=Xn.from-zn,Yn=Xn.to-Hn;(Wn==0||Wn==1||zn==0)&&(Yn==0||Yn==-1||Hn==ke.state.doc.length)&&(Zn=0,jn=ke.state.doc.length)}this.newSel=EditorSelection.single(jn,Zn)}}}function applyDOMChange(_n,ke){let Ce,{newSel:$n}=ke,Mn=_n.state.selection.main,Qn=_n.inputState.lastKeyTime>Date.now()-100?_n.inputState.lastKeyCode:-1;if(ke.bounds){let{from:Vn,to:qn}=ke.bounds,Zn=Mn.from,jn=null;(Qn===8||browser.android&&ke.text.length<qn-Vn)&&(Zn=Mn.to,jn="end");let Xn=findDiff(_n.state.doc.sliceStr
Line truncated
|
|
||||||
`&&_n.lineWrapping&&($n&&($n=EditorSelection.single($n.main.anchor-1,$n.main.head-1)),Ce={from:Mn.from,to:Mn.to,insert:Text.of([" "])}),Ce)return applyDOMChangeInner(_n,Ce,$n,Qn);if($n&&!$n.main.eq(Mn)){let Vn=!1,qn="select";return _n.inputState.lastSelectionTime>Date.now()-50&&(_n.inputState.lastSelectionOrigin=="select"&&(Vn=!0),qn=_n.inputState.lastSelectionOrigin),_n.dispatch({selection:$n,scrollIntoView:Vn,userEvent:qn}),!0}else return!1}function applyDOMChangeInner(_n,ke,Ce,$n=-1){if(browser.ios&&_n.inputState.flushIOSKey(ke))return!0;let Mn=_n.state.selection.main;if(browser.android&&(ke.to==Mn.to&&(ke.from==Mn.from||ke.from==Mn.from-1&&_n.state.sliceDoc(ke.from,Mn.from)==" ")&&ke.insert.length==1&&ke.insert.lines==2&&dispatchKey(_n.contentDOM,"Enter",13)||(ke.from==Mn.from-1&&ke.to==Mn.to&&ke.insert.length==0||$n==8&&ke.insert.length<ke.to-ke.from&&ke.to>Mn.head)&&dispatchKey(_n.contentDOM,"Backspace",8)||ke.from==Mn.from&&ke.to==Mn.to+1&&ke.insert.length==0&&dispatchKey(_n.contentDOM,"Delete",46)))return!0;let Qn=ke.insert.toString();_n.inputState.composing>=0&&_n.inputState.composing++;let Vn,qn=()=>Vn||(Vn=applyDefaultInsert(_n,ke,Ce));return _n.state.facet(inputHandler$1).some(Zn=>Zn(_n,ke.from,ke.to,Qn,qn))||_n.dispatch(qn()),!0}function applyDefaultInsert(_n,ke,Ce){let $n,Mn=_n.state,Qn=Mn.selection.main;if(ke.from>=Qn.from&&ke.to<=Qn.to&&ke.to-ke.from>=(Qn.to-Qn.from)/3&&(!Ce||Ce.main.empty&&Ce.main.from==ke.from+ke.insert.length)&&_n.inputState.composing<0){let qn=Qn.from<ke.from?Mn.sliceDoc(Qn.from,ke.from):"",Zn=Qn.to>ke.to?Mn.sliceDoc(ke.to,Qn.to):"";$n=Mn.replaceSelection(_n.state.toText(qn+ke.insert.sliceString(0,void 0,_n.state.lineBreak)+Zn))}else{let qn=Mn.changes(ke),Zn=Ce&&Ce.main.to<=qn.newLength?Ce.main:void 0;if(Mn.selection.ranges.length>1&&_n.inputState.composing>=0&&ke.to<=Qn.to&&ke.to>=Qn.to-10){let jn=_n.state.sliceDoc(ke.from,ke.to),Xn,zn=Ce&&findCompositionNode(_n,Ce.main.head);if(zn){let Yn=ke.insert.length-(ke.to-ke.from);Xn={from:zn.from,to:zn.to-Yn}}else Xn=_n.state.doc.lineAt(Qn.head);let Hn=Qn.to-ke.to,Wn=Qn.to-Qn.from;$n=Mn.changeByRange(Yn=>{if(Yn.from==Qn.from&&Yn.to==Qn.to)return{changes:qn,range:Zn||Yn.map(qn)};let Un=Yn.to-Hn,Gn=Un-jn.length;if(Yn.to-Yn.from!=Wn||_n.state.sliceDoc(Gn,Un)!=jn||Yn.to>=Xn.from&&Yn.from<=Xn.to)return{range:Yn};let Kn=Mn.changes({from:Gn,to:Un,insert:ke.insert}),Jn=Yn.to-Qn.to;return{changes:Kn,range:Zn?EditorSelection.range(Math.max(0,Zn.anchor+Jn),Math.max(0,Zn.head+Jn)):Yn.map(Kn)}})}else $n={changes:qn,selection:Zn&&Mn.selection.replaceRange(Zn)}}let Vn="input.type";return(_n.composing||_n.inputState.compositionPendingChange&&_n.inputState.compositionEndedAt>Date.now()-50)&&(_n.inputState.compositionPendingChange=!1,Vn+=".compose",_n.inputState.compositionFirstChange&&(Vn+=".start",_n.inputState.compositionFirstChange=!1)),Mn.update($n,{userEvent:Vn,scrollIntoView:!0})}function findDiff(_n,ke,Ce,$n){let Mn=Math.min(_n.length,ke.length),Qn=0;for(;Qn<Mn&&_n.charCodeAt(Qn)==ke.charCodeAt(Qn);)Qn++;if(Qn==Mn&&_n.length==ke.length)return null;let Vn=_n.length,qn=ke.length;for(;Vn>0&&qn>0&&_n.charCodeAt(Vn-1)==ke.charCodeAt(qn-1);)Vn--,qn--;if($n=="end"){let Zn=Math.max(0,Qn-Math.min(Vn,qn));Ce-=Vn+Zn-Qn}if(Vn<Qn&&_n.length<ke.length){let Zn=Ce<=Qn&&Ce>=Vn?Qn-Ce:0;Qn-=Zn,qn=Qn+(qn-Vn),Vn=Qn}else if(qn<Qn){let Zn=Ce<=Qn&&Ce>=qn?Qn-Ce:0;Qn-=Zn,Vn=Qn+(Vn-qn),qn=Qn}return{from:Qn,toA:Vn,toB:qn}}function selectionPoints(_n){let ke=[];if(_n.root.activeElement!=_n.contentDOM)return ke;let{anchorNode:Ce,anchorOffset:$n,focusNode:Mn,focusOffset:Qn}=_n.observer.selectionRange;return Ce&&(ke.push(new DOMPoint(Ce,$n)),(Mn!=Ce||Qn!=$n)&&ke.push(new DOMPoint(Mn,Qn))),ke}function selectionFromPoints(_n,ke){if(_n.length==0)return null;let Ce=_n[0].pos,$n=_n.length==2?_n[1].pos:Ce;return Ce>-1&&$n>-1?EditorSelection.single(Ce+ke,$n+ke):null}class InputState{setSelectionOrigin(ke){this.lastSelectionOrigin=ke,this.lastSelectionTime=Date.now()}constructor(ke){this.view=ke,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=ke.hasFocus,browser.safari&&ke.contentDOM.addEventListener("input",()=>null),browser.gecko&&firefoxCopyCutHack(ke.contentDOM.ownerDocument)}handleEvent(ke){!eventBelongsToEditor(this.view,ke)||this.ignoreDuringComposition(ke)||ke.type=="keydown"&&this.keydown(ke)||this.runHandlers(ke.type,ke)}runHandlers(ke,Ce){let $n=this.handlers[ke];if($n){for(let Mn of $n.observers)Mn(this.view,Ce);for(let Mn of $n.handlers){if(Ce.defaultPrevente
Line truncated
|
|
||||||
`))};Qn.from==this.from&&Mn<this.from?Qn.from=Mn:Qn.to==this.to&&Mn>this.to&&(Qn.to=Mn),!(Qn.from==Qn.to&&!Qn.insert.length)&&(this.pendingContextChange=Qn,ke.state.readOnly||applyDOMChangeInner(ke,Qn,EditorSelection.single(this.toEditorPos($n.selectionStart),this.toEditorPos($n.selectionEnd))),this.pendingContextChange&&(this.revertPending(ke.state),this.setSelection(ke.state)))},this.handlers.characterboundsupdate=$n=>{let Mn=[],Qn=null;for(let Vn=this.toEditorPos($n.rangeStart),qn=this.toEditorPos($n.rangeEnd);Vn<qn;Vn++){let Zn=ke.coordsForChar(Vn);Qn=Zn&&new DOMRect(Zn.left,Zn.top,Zn.right-Zn.left,Zn.bottom-Zn.top)||Qn||new DOMRect,Mn.push(Qn)}Ce.updateCharacterBounds($n.rangeStart,Mn)},this.handlers.textformatupdate=$n=>{let Mn=[];for(let Qn of $n.getTextFormats()){let Vn=Qn.underlineStyle,qn=Qn.underlineThickness;if(Vn!="None"&&qn!="None"){let Zn=`text-decoration: underline ${Vn=="Dashed"?"dashed ":Vn=="Squiggle"?"wavy ":""}${qn=="Thin"?1:2}px`;Mn.push(Decoration.mark({attributes:{style:Zn}}).range(this.toEditorPos(Qn.rangeStart),this.toEditorPos(Qn.rangeEnd)))}}ke.dispatch({effects:setEditContextFormatting.of(Decoration.set(Mn))})},this.handlers.compositionstart=()=>{ke.inputState.composing<0&&(ke.inputState.composing=0,ke.inputState.compositionFirstChange=!0)},this.handlers.compositionend=()=>{ke.inputState.composing=-1,ke.inputState.compositionFirstChange=null};for(let $n in this.handlers)Ce.addEventListener($n,this.handlers[$n]);this.measureReq={read:$n=>{this.editContext.updateControlBounds($n.contentDOM.getBoundingClientRect());let Mn=getSelection($n.root);Mn&&Mn.rangeCount&&this.editContext.updateSelectionBounds(Mn.getRangeAt(0).getBoundingClientRect())}}}applyEdits(ke){let Ce=0,$n=!1,Mn=this.pendingContextChange;return ke.changes.iterChanges((Qn,Vn,qn,Zn,jn)=>{if($n)return;let Xn=jn.length-(Vn-Qn);if(Mn&&Vn>=Mn.to)if(Mn.from==Qn&&Mn.to==Vn&&Mn.insert.eq(jn)){Mn=this.pendingContextChange=null,Ce+=Xn,this.to+=Xn;return}else Mn=null,this.revertPending(ke.state);if(Qn+=Ce,Vn+=Ce,Vn<=this.from)this.from+=Xn,this.to+=Xn;else if(Qn<this.to){if(Qn<this.from||Vn>this.to||this.to-this.from+jn.length>3e4){$n=!0;return}this.editContext.updateText(this.toContextPos(Qn),this.toContextPos(Vn),jn.toString()),this.to+=Xn}Ce+=Xn}),Mn&&!$n&&this.revertPending(ke.state),!$n}update(ke){let Ce=this.pendingContextChange;!this.applyEdits(ke)||!this.rangeIsValid(ke.state)?(this.pendingContextChange=null,this.resetRange(ke.state),this.editContext.updateText(0,this.editContext.text.length,ke.state.doc.sliceString(this.from,this.to)),this.setSelection(ke.state)):(ke.docChanged||ke.selectionSet||Ce)&&this.setSelection(ke.state),(ke.geometryChanged||ke.docChanged||ke.selectionSet)&&ke.view.requestMeasure(this.measureReq)}resetRange(ke){let{head:Ce}=ke.selection.main;this.from=Math.max(0,Ce-1e4),this.to=Math.min(ke.doc.length,Ce+1e4)}revertPending(ke){let Ce=this.pendingContextChange;this.pendingContextChange=null,this.editContext.updateText(this.toContextPos(Ce.from),this.toContextPos(Ce.from+Ce.insert.length),ke.doc.sliceString(Ce.from,Ce.to))}setSelection(ke){let{main:Ce}=ke.selection,$n=this.toContextPos(Math.max(this.from,Math.min(this.to,Ce.anchor))),Mn=this.toContextPos(Ce.head);(this.editContext.selectionStart!=$n||this.editContext.selectionEnd!=Mn)&&this.editContext.updateSelection($n,Mn)}rangeIsValid(ke){let{head:Ce}=ke.selection.main;return!(this.from>0&&Ce-this.from<500||this.to<ke.doc.length&&this.to-Ce<500||this.to-this.from>1e4*3)}toEditorPos(ke){return ke+this.from}toContextPos(ke){return ke-this.from}destroy(){for(let ke in this.handlers)this.editContext.removeEventListener(ke,this.handlers[ke])}}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(ke={}){var Ce;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),ke.parent&&ke.parent.appendChild(this.dom);let{dispatch:$n}=ke;this.dispatchTransactions=ke.dispatchTransactions||$n&&(Mn=>Mn.forEach(Qn=>$n(Qn,this)))||(Mn=>this.update(Mn)),this.dispatch=this.dispatch.bind(this),this._root=ke.root||getRoot(ke.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 ke=document.body.style;_supportsTabSize=((_n=ke.tabSize)!==null&&_n!==void 0?_n:ke.MozTabSize)!=null}return _supportsTabSize||!1}const specialCharConfig=Facet.define({combine(_n){let ke=combineConfig(_n,{render:null,specialChars:Specials,addSpecialChars:null});return(ke.replaceTabs=!supportsTabSize())&&(ke.specialChars=new RegExp(" |"+ke.specialChars.source,UnicodeRegexpSupport)),ke.addSpecialChars&&(ke.specialChars=new RegExp(ke.specialChars.source+"|"+ke.addSpecialChars.source,UnicodeRegexpSupport)),ke}});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:(ke,Ce,$n)=>{let{doc:Mn}=Ce.state,Qn=codePointAt(ke[0],0);if(Qn==9){let Vn=Mn.lineAt($n),qn=Ce.state.tabSize,Zn=countColumn(Vn.text,qn,$n-Vn.from);return Decoration.replace({widget:new TabWidget((qn-Zn%qn)*this.view.defaultCharacterWidth/this.view.scaleX)})}return this.decorationCache[Qn]||(this.decorationCache[Qn]=Decoration.replace({widget:new SpecialCharWidget(_n,Qn)}))},boundary:_n.replaceTabs?void 0:/[^]/})}update(_n){let ke=_n.state.facet(specialCharConfig);_n.startState.facet(specialCharConfig)!=ke?(this.decorator=this.makeDecorator(ke),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(ke,Ce){super(),this.options=ke,this.code=Ce}eq(ke){return ke.code==this.code}toDOM(ke){let Ce=placeholder$1(this.code),$n=ke.state.phrase("Control character")+" "+(Names[this.code]||"0x"+this.code.toString(16)),Mn=this.options.render&&this.options.render(this.code,$n,Ce);if(Mn)return Mn;let Qn=document.createElement("span");return Qn.textContent=Ce,Qn.title=$n,Qn.setAttribute("aria-label",$n),Qn.className="cm-specialChar",Qn}ignoreEvent(){return!1}}class TabWidget extends WidgetType{constructor(ke){super(),this.width=ke}eq(ke){return ke.width==this.width}toDOM(){let ke=document.createElement("span");return ke.textContent=" ",ke.className="cm-tab",ke.style.width=this.width+"px",ke}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 ke=-1,Ce=[];for(let $n of _n.state.selection.ranges){let Mn=_n.lineBlockAt($n.head);Mn.from>ke&&(Ce.push(lineDeco.range(Mn.from)),ke=Mn.from)}return Decoration.set(Ce)}},{decorations:_n=>_n.decorations}),MaxOff=2e3;function rectangleFor(_n,ke,Ce){let $n=Math.min(ke.line,Ce.line),Mn=Math.max(ke.line,Ce.line),Qn=[];if(ke.off>MaxOff||Ce.off>MaxOff||ke.col<0||Ce.col<0){let Vn=Math.min(ke.off,Ce.off),qn=Math.max(ke.off,Ce.off);for(let Zn=$n;Zn<=Mn;Zn++){let jn=_n.doc.line(Zn);jn.length<=qn&&Qn.push(EditorSelection.range(jn.from+Vn,jn.to+qn))}}else{let Vn=Math.min(ke.col,Ce.col),qn=Math.max(ke.col,Ce.col);for(let Zn=$n;Zn<=Mn;Zn++){let jn=_n.doc.line(Zn),Xn=findColumn(jn.text,Vn,_n.tabSize,!0);if(Xn<0)Qn.push(EditorSelection.cursor(jn.to));else{let zn=findColumn(jn.text,qn,_n.tabSize);Qn.push(EditorSelection.range(jn.from+Xn,jn.from+zn))}}}return Qn}function absoluteColumn(_n,ke){let Ce=_n.coordsAtPos(_n.viewport.from);return Ce?Math.round(Math.abs((Ce.left-ke)/_n.defaultCharacterWidth)):-1}function getPos(_n,ke){let Ce=_n.posAtCoords({x:ke.clientX,y:ke.clientY},!1),$n=_n.state.doc.lineAt(Ce),Mn=Ce-$n.from,Qn=Mn>MaxOff?-1:Mn==$n.length?absoluteColumn(_n,ke.clientX):countColumn($n.text,_n.state.tabSize,Ce-$n.from);return{line:$n.number,col:Qn,off:Mn}}function rectangleSelectionStyle(_n,ke){let Ce=getPos(_n,ke),$n=_n.state.selection;return Ce?{update(Mn){if(M
Line truncated
|
|
||||||
`:$n=="r"?"\r":$n=="t"?" ":"\\")}eq(ke){return this.search==ke.search&&this.replace==ke.replace&&this.caseSensitive==ke.caseSensitive&&this.regexp==ke.regexp&&this.wholeWord==ke.wholeWord}create(){return this.regexp?new RegExpQuery(this):new StringQuery(this)}getCursor(ke,Ce=0,$n){let Mn=ke.doc?ke:EditorState.create({doc:ke});return $n==null&&($n=Mn.doc.length),this.regexp?regexpCursor(this,Mn,Ce,$n):stringCursor(this,Mn,Ce,$n)}}class QueryType{constructor(ke){this.spec=ke}}function stringCursor(_n,ke,Ce,$n){return new SearchCursor(ke.doc,_n.unquoted,Ce,$n,_n.caseSensitive?void 0:Mn=>Mn.toLowerCase(),_n.wholeWord?stringWordTest(ke.doc,ke.charCategorizer(ke.selection.main.head)):void 0)}function stringWordTest(_n,ke){return(Ce,$n,Mn,Qn)=>((Qn>Ce||Qn+Mn.length<$n)&&(Qn=Math.max(0,Ce-2),Mn=_n.sliceString(Qn,Math.min(_n.length,$n+2))),(ke(charBefore(Mn,Ce-Qn))!=CharCategory.Word||ke(charAfter(Mn,Ce-Qn))!=CharCategory.Word)&&(ke(charAfter(Mn,$n-Qn))!=CharCategory.Word||ke(charBefore(Mn,$n-Qn))!=CharCategory.Word))}class StringQuery extends QueryType{constructor(ke){super(ke)}nextMatch(ke,Ce,$n){let Mn=stringCursor(this.spec,ke,$n,ke.doc.length).nextOverlapping();return Mn.done&&(Mn=stringCursor(this.spec,ke,0,Ce).nextOverlapping()),Mn.done?null:Mn.value}prevMatchInRange(ke,Ce,$n){for(let Mn=$n;;){let Qn=Math.max(Ce,Mn-1e4-this.spec.unquoted.length),Vn=stringCursor(this.spec,ke,Qn,Mn),qn=null;for(;!Vn.nextOverlapping().done;)qn=Vn.value;if(qn)return qn;if(Qn==Ce)return null;Mn-=1e4}}prevMatch(ke,Ce,$n){return this.prevMatchInRange(ke,0,Ce)||this.prevMatchInRange(ke,$n,ke.doc.length)}getReplacement(ke){return this.spec.unquote(this.spec.replace)}matchAll(ke,Ce){let $n=stringCursor(this.spec,ke,0,ke.doc.length),Mn=[];for(;!$n.next().done;){if(Mn.length>=Ce)return null;Mn.push($n.value)}return Mn}highlight(ke,Ce,$n,Mn){let Qn=stringCursor(this.spec,ke,Math.max(0,Ce-this.spec.unquoted.length),Math.min($n+this.spec.unquoted.length,ke.doc.length));for(;!Qn.next().done;)Mn(Qn.value.from,Qn.value.to)}}function regexpCursor(_n,ke,Ce,$n){return new RegExpCursor(ke.doc,_n.search,{ignoreCase:!_n.caseSensitive,test:_n.wholeWord?regexpWordTest(ke.charCategorizer(ke.selection.main.head)):void 0},Ce,$n)}function charBefore(_n,ke){return _n.slice(findClusterBreak(_n,ke,!1),ke)}function charAfter(_n,ke){return _n.slice(ke,findClusterBreak(_n,ke))}function regexpWordTest(_n){return(ke,Ce,$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(ke,Ce,$n){let Mn=regexpCursor(this.spec,ke,$n,ke.doc.length).next();return Mn.done&&(Mn=regexpCursor(this.spec,ke,0,Ce).next()),Mn.done?null:Mn.value}prevMatchInRange(ke,Ce,$n){for(let Mn=1;;Mn++){let Qn=Math.max(Ce,$n-Mn*1e4),Vn=regexpCursor(this.spec,ke,Qn,$n),qn=null;for(;!Vn.next().done;)qn=Vn.value;if(qn&&(Qn==Ce||qn.from>Qn+10))return qn;if(Qn==Ce)return null}}prevMatch(ke,Ce,$n){return this.prevMatchInRange(ke,0,Ce)||this.prevMatchInRange(ke,$n,ke.doc.length)}getReplacement(ke){return this.spec.unquote(this.spec.replace).replace(/\$([$&\d+])/g,(Ce,$n)=>$n=="$"?"$":$n=="&"?ke.match[0]:$n!="0"&&+$n<ke.match.length?ke.match[$n]:Ce)}matchAll(ke,Ce){let $n=regexpCursor(this.spec,ke,0,ke.doc.length),Mn=[];for(;!$n.next().done;){if(Mn.length>=Ce)return null;Mn.push($n.value)}return Mn}highlight(ke,Ce,$n,Mn){let Qn=regexpCursor(this.spec,ke,Math.max(0,Ce-250),Math.min($n+250,ke.doc.length));for(;!Qn.next().done;)Mn(Qn.value.from,Qn.value.to)}}const setSearchQuery=StateEffect.define(),togglePanel$1=StateEffect.define(),searchState=StateField.define({create(_n){return new SearchState(defaultQuery(_n).create(),null)},update(_n,ke){for(let Ce of ke.effects)Ce.is(setSearchQuery)?_n=new SearchState(Ce.value.create(),_n.panel):Ce.is(togglePanel$1)&&(_n=new SearchState(_n.query,Ce.value?createSearchPanel:null));return _n},provide:_n=>showPanel.from(_n,ke=>ke.panel)});class SearchState{constructor(ke,Ce){this.query=ke,this.panel=Ce}}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 ke=_n.state.field(searchState);(ke!=_n.startState.field(searchState)||_n.docChanged||_n.selectionSet||_n.viewportChanged)&&(this.decorations=this.highlight(ke))}highlight({query:_n,panel:ke}){if(!ke||!_n.spec.valid)return Decoration.none;let{view:Ce}=this,$n=new RangeSetBuilder;for(let Mn=0,Qn=Ce.visibleRanges,Vn=Qn.length;Mn<Vn;Mn++){let{from:qn,to:Zn}=Qn[Mn];for(;Mn<Vn-1&&Zn>Qn[Mn+1].from-2*250;)Zn=Qn[++Mn].to;_n.highlight(Ce.state,qn,Zn,(jn,Xn)=>{let zn=Ce.state.selection.ranges.some(Hn=>Hn.from==jn&&Hn.to==Xn);$n.add(jn,Xn,zn?selectedM
Line truncated
|
|
||||||
`+Ce.scrub(),Qn=this.advance(Mn);return Qn>-1&&Qn<Mn.length?this.complete(ke,$n,Qn):!1}finish(ke,Ce){return(this.stage==2||this.stage==3)&&skipSpace(Ce.content,this.pos)==Ce.content.length?this.complete(ke,Ce,Ce.content.length):!1}complete(ke,Ce,$n){return ke.addLeafElement(Ce,elt(Type.LinkReference,this.start,this.start+$n,this.elts)),!0}nextStage(ke){return ke?(this.pos=ke.to-this.start,this.elts.push(ke),this.stage++,!0):(ke===!1&&(this.stage=-1),!1)}advance(ke){for(;;){if(this.stage==-1)return-1;if(this.stage==0){if(!this.nextStage(parseLinkLabel(ke,this.pos,this.start,!0)))return-1;if(ke.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(ke,skipSpace(ke,this.pos),this.start)))return-1}else if(this.stage==2){let Ce=skipSpace(ke,this.pos),$n=0;if(Ce>this.pos){let Mn=parseLinkTitle(ke,Ce,this.start);if(Mn){let Qn=lineEnd(ke,Mn.to-this.start);Qn>0&&(this.nextStage(Mn),$n=Qn)}}return $n||($n=lineEnd(ke,this.pos)),$n>0&&$n<ke.length?$n:-1}else return lineEnd(ke,this.pos)}}}function lineEnd(_n,ke){for(;ke<_n.length;ke++){let Ce=_n.charCodeAt(ke);if(Ce==10)break;if(!space$2(Ce))return-1}return ke}class SetextHeadingParser{nextLine(ke,Ce,$n){let Mn=Ce.depth<ke.stack.length?-1:isSetextUnderline(Ce),Qn=Ce.next;if(Mn<0)return!1;let Vn=elt(Type.HeaderMark,ke.lineStart+Ce.pos,ke.lineStart+Mn);return ke.nextLine(),ke.addLeafElement($n,elt(Qn==61?Type.SetextHeading1:Type.SetextHeading2,$n.start,ke.prevLineEnd(),[...ke.parser.parseInline($n.content,$n.start),Vn])),!0}finish(){return!1}}const DefaultLeafBlocks={LinkReference(_n,ke){return ke.content.charCodeAt(0)==91?new LinkReferenceParser(ke):null},SetextHeading(){return new SetextHeadingParser}},DefaultEndLeaf=[(_n,ke)=>isAtxHeading(ke)>=0,(_n,ke)=>isFencedCode(ke)>=0,(_n,ke)=>isBlockquote(ke)>=0,(_n,ke)=>isBulletList(ke,_n,!0)>=0,(_n,ke)=>isOrderedList(ke,_n,!0)>=0,(_n,ke)=>isHorizontalRule(ke,_n,!0)>=0,(_n,ke)=>isHTMLBlock(ke,_n,!0)>=0],scanLineResult={text:"",end:0};class BlockContext{constructor(ke,Ce,$n,Mn){this.parser=ke,this.input=Ce,this.ranges=Mn,this.line=new Line,this.atEnd=!1,this.reusePlaceholders=new Map,this.stoppedAt=null,this.rangeI=0,this.to=Mn[Mn.length-1].to,this.lineStart=this.absoluteLineStart=this.absoluteLineEnd=Mn[0].from,this.block=CompositeBlock.create(Type.Document,0,this.lineStart,0,0),this.stack=[this.block],this.fragments=$n.length?new FragmentCursor($n,Ce):null,this.readLine()}get parsedPos(){return this.absoluteLineStart}advance(){if(this.stoppedAt!=null&&this.absoluteLineStart>this.stoppedAt)return this.finish();let{line:ke}=this;for(;;){for(let $n=0;;){let Mn=ke.depth<this.stack.length?this.stack[this.stack.length-1]:null;for(;$n<ke.markers.length&&(!Mn||ke.markers[$n].from<Mn.end);){let Qn=ke.markers[$n++];this.addNode(Qn.type,Qn.from,Qn.to)}if(!Mn)break;this.finishContext()}if(ke.pos<ke.text.length)break;if(!this.nextLine())return this.finish()}if(this.fragments&&this.reuseFragment(ke.basePos))return null;e:for(;;){for(let $n of this.parser.blockParsers)if($n){let Mn=$n(this,ke);if(Mn!=!1){if(Mn==!0)return null;ke.forward();continue e}}break}let Ce=new LeafBlock(this.lineStart+ke.pos,ke.text.slice(ke.pos));for(let $n of this.parser.leafBlockParsers)if($n){let Mn=$n(this,Ce);Mn&&Ce.parsers.push(Mn)}e:for(;this.nextLine()&&ke.pos!=ke.text.length;){if(ke.indent<ke.baseIndent+4){for(let $n of this.parser.endLeafBlock)if($n(this,ke,Ce))break e}for(let $n of Ce.parsers)if($n.nextLine(this,ke,Ce))return null;Ce.content+=`
|
|
||||||
`+ke.scrub();for(let $n of ke.markers)Ce.marks.push($n)}return this.finishLeaf(Ce),null}stopAt(ke){if(this.stoppedAt!=null&&this.stoppedAt<ke)throw new RangeError("Can't move stoppedAt forward");this.stoppedAt=ke}reuseFragment(ke){if(!this.fragments.moveTo(this.absoluteLineStart+ke,this.absoluteLineStart)||!this.fragments.matches(this.block.hash))return!1;let Ce=this.fragments.takeNodes(this);return Ce?(this.absoluteLineStart+=Ce,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(ke=this.depth-1){return this.parser.nodeSet.types[this.stack[ke].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(ke){let Ce=scanLineResult;if(Ce.end=ke,ke>=this.to)Ce.text="";else if(Ce.text=this.lineChunkAt(ke),Ce.end+=Ce.text.length,this.ranges.length>1){let $n=this.absoluteLineStart,Mn=this.rangeI;for(;this.ranges[Mn].to<Ce.end;){Mn++;let Qn=this.ranges[Mn].from,Vn=this.lineChunkAt(Qn);Ce.end=Qn+Vn.length,Ce.text=Ce.text.slice(0,this.ranges[Mn-1].to-$n)+Vn,$n=Ce.end-Ce.text.length}}return Ce}readLine(){let{line:ke}=this,{text:Ce,end:$n}=this.scanLine(this.absoluteLineStart);for(this.absoluteLineEnd=$n,ke.reset(Ce);ke.depth<this.stack.length;ke.depth++){let Mn=this.stack[ke.depth],Qn=this.parser.skipContextMarkup[Mn.type];if(!Qn)throw new Error("Unhandled block context "+Type[Mn.type]);if(!Qn(Mn,this,ke))break;ke.forward()}}lineChunkAt(ke){let Ce=this.input.chunk(ke),$n;if(this.input.lineChunks)$n=Ce==`
|
|
||||||
`?"":Ce;else{let Mn=Ce.indexOf(`
|
|
||||||
`);$n=Mn<0?Ce:Ce.slice(0,Mn)}return ke+$n.length>this.to?$n.slice(0,this.to-ke):$n}prevLineEnd(){return this.atEnd?this.lineStart:this.lineStart-1}startContext(ke,Ce,$n=0){this.block=CompositeBlock.create(ke,$n,this.lineStart+Ce,this.block.hash,this.lineStart+this.line.text.length),this.stack.push(this.block)}startComposite(ke,Ce,$n=0){this.startContext(this.parser.getNodeType(ke),Ce,$n)}addNode(ke,Ce,$n){typeof ke=="number"&&(ke=new Tree(this.parser.nodeSet.types[ke],none,none,($n??this.prevLineEnd())-Ce)),this.block.addChild(ke,Ce-this.block.from)}addElement(ke){this.block.addChild(ke.toTree(this.parser.nodeSet),ke.from-this.block.from)}addLeafElement(ke,Ce){this.addNode(this.buffer.writeElements(injectMarks(Ce.children,ke.marks),-Ce.from).finish(Ce.type,Ce.to-Ce.from),Ce.from)}finishContext(){let ke=this.stack.pop(),Ce=this.stack[this.stack.length-1];Ce.addChild(ke.toTree(this.parser.nodeSet),ke.from-Ce.from),this.block=Ce}finish(){for(;this.stack.length>1;)this.finishContext();return this.addGaps(this.block.toTree(this.parser.nodeSet,this.lineStart))}addGaps(ke){return this.ranges.length>1?injectGaps(this.ranges,0,ke.topNode,this.ranges[0].from,this.reusePlaceholders):ke}finishLeaf(ke){for(let $n of ke.parsers)if($n.finish(this,ke))return;let Ce=injectMarks(this.parser.parseInline(ke.content,ke.start),ke.marks);this.addNode(this.buffer.writeElements(Ce,-ke.start).finish(Type.Paragraph,ke.content.length),ke.start)}elt(ke,Ce,$n,Mn){return typeof ke=="string"?elt(this.parser.getNodeType(ke),Ce,$n,Mn):new TreeElement(ke,Ce)}get buffer(){return new Buffer$1(this.parser.nodeSet)}}function injectGaps(_n,ke,Ce,$n,Mn){let Qn=_n[ke].to,Vn=[],qn=[],Zn=Ce.from+$n;function jn(Xn,zn){for(;zn?Xn>=Qn:Xn>Qn;){let Hn=_n[ke+1].from-Qn;$n+=Hn,Xn+=Hn,ke++,Qn=_n[ke].to}}for(let Xn=Ce.firstChild;Xn;Xn=Xn.nextSibling){jn(Xn.from+$n,!0);let zn=Xn.from+$n,Hn,Wn=Mn.get(Xn.tree);Wn?Hn=Wn:Xn.to+$n>Qn?(Hn=injectGaps(_n,ke,Xn,$n,Mn),jn(Xn.to+$n,!1)):Hn=Xn.toTree(),Vn.push(Hn),qn.push(zn-Zn)}return jn(Ce.to+$n,!1),new Tree(Ce.type,Vn,qn,Ce.to+$n-Zn,Ce.tree?Ce.tree.propValues:void 0)}class MarkdownParser extends Parser{constructor(ke,Ce,$n,Mn,Qn,Vn,qn,Zn,jn){super(),this.nodeSet=ke,this.blockParsers=Ce,this.leafBlockParsers=$n,this.blockNames=Mn,this.endLeafBlock=Qn,this.skipContextMarkup=Vn,this.inlineParsers=qn,this.inlineNames=Zn,this.wrappers=jn,this.nodeTypes=Object.create(null);for(let Xn of ke.types)this.nodeTypes[Xn.name]=Xn.id}createParse(ke,Ce,$n){let Mn=new BlockContext(this,ke,Ce,$n);for(let Qn of this.wrappers)Mn=Qn(Mn,ke,Ce,$n);return Mn}configure(ke){let Ce=resolveConfig(ke);if(!Ce)return this;let{nodeSet:$n,skipContextMarkup:Mn}=this,Qn=this.blockParsers.slice(),Vn=this.leafBlockParsers.slice(),qn=this.blockNames.slice(),Zn=this.inlineParsers.slice(),jn=this.inlineNames.slice(),Xn=this.endLeafBlock.slice(),zn=this.wrappers;if(nonEmpty(Ce.defineNodes)){Mn=Object.assign({},Mn);let Hn=$n.types.slice(),Wn;for(let Yn of Ce.defineNodes){let{name:Un,block:Gn,composite:Kn,style:Jn}=typeof Yn=="string"?{name:Yn}:Yn;if(Hn.some(er=>er.name==Un))continue;Kn&&(Mn[Hn.length]=(er,rr,or)=>Kn(rr,or,er.value));let tr=Hn.length,nr=Kn?["Block","BlockContext"]:Gn?tr>=Type.ATXHeading1&&tr<=Type.SetextHeading2?["Block","LeafBlock","Heading"]:["Block","LeafBlock"]:void 0;Hn.push(NodeType.define({id:tr,name:Un,props:nr&&[[NodeProp.group,nr]]})),Jn&&(Wn||(Wn={}),Array.isArray(Jn)||Jn instanceof Tag?Wn[Un]=Jn:Object.assign(Wn,Jn))}$n=new NodeSet(Hn),Wn&&($n=$n.extend(styleTags(Wn)))}if(nonEmpty(Ce.props)&&($n=$n.extend(...Ce.props)),nonEmpty(Ce.remove))for(let Hn of Ce.remove){let Wn=this.blockNames.indexOf(Hn),Yn=this.inlineNames.indexOf(Hn);Wn>-1&&(Qn[Wn]=Vn[Wn]=void 0),Yn>-1&&(Zn[Yn]=void 0)}if(nonEmpty(Ce.parseBlock))for(let Hn of Ce.parseBlock){let Wn=qn.indexOf(Hn.name);if(Wn>-1)Qn[Wn]=Hn.parse,Vn[Wn]=Hn.leaf;else{let Yn=Hn.before?findName(qn,Hn.before):Hn.after?findName(qn,Hn.after)+1:qn.length-1;Qn.splice(Yn,0,Hn.parse),Vn.splice(Yn,0,Hn.leaf),qn.splice(Yn,0,Hn.name)}Hn.endLeaf&&Xn.push(Hn.endLeaf)}if(nonEmpty(Ce.parseInline))for(let Hn of Ce.parseInline){let Wn=jn.indexOf(Hn.name);if(Wn>-1)Zn[Wn]=Hn.parse;else{let Yn=Hn.before?findName(jn,Hn.before):Hn.after?findName(jn,Hn.after)+1:jn.length-1;Zn.splice(Yn,0,Hn.parse),jn.splice(Yn,0,Hn.name)}}return Ce.wrap&&(zn=zn.concat(Ce.wrap)),new MarkdownParser($n,Qn,Vn,qn,Xn,Mn,Zn,jn,zn)}getNodeType(ke){let Ce=this.nodeTypes[ke];if(Ce==null)throw new RangeError(`Unknown node type '${ke}'`);return Ce}parseInline(ke,Ce){let $n=new InlineContext(this,ke,Ce);e:for(let Mn=Ce;Mn<$n.end;){let Qn=$n.char(Mn);for(let Vn of this.inlineParsers)if(Vn){let qn=Vn($n,Qn,Mn);if(qn>=0){Mn=qn;continue e}}Mn++}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 ke=resolveConfig(_n[0]);if(_n.length==1)return ke;let Ce=resolveConfig(_n.slice(1));if(!Ce||!ke)return ke||Ce;let $n=(Vn,qn)=>(Vn||none).co
Line truncated
|
|
||||||
`;)Qn--;this.fragmentEnd=Qn?Qn-1:0}let $n=this.cursor;$n||($n=this.cursor=this.fragment.tree.cursor(),$n.firstChild());let Mn=ke+this.fragment.offset;for(;$n.to<=Mn;)if(!$n.parent())return!1;for(;;){if($n.from>=Mn)return this.fragment.from<=Ce;if(!$n.childAfter(Mn))return!1}}matches(ke){let Ce=this.cursor.tree;return Ce&&Ce.prop(NodeProp.contextHash)==ke}takeNodes(ke){let Ce=this.cursor,$n=this.fragment.offset,Mn=this.fragmentEnd-(this.fragment.openEnd?1:0),Qn=ke.absoluteLineStart,Vn=Qn,qn=ke.block.children.length,Zn=Vn,jn=qn;for(;;){if(Ce.to-$n>Mn){if(Ce.type.isAnonymous&&Ce.firstChild())continue;break}let Xn=toRelative(Ce.from-$n,ke.ranges);if(Ce.to-$n<=ke.ranges[ke.rangeI].to)ke.addNode(Ce.tree,Xn);else{let zn=new Tree(ke.parser.nodeSet.types[Type.Paragraph],[],[],0,ke.block.hashProp);ke.reusePlaceholders.set(zn,Ce.tree),ke.addNode(zn,Xn)}if(Ce.type.is("Block")&&(NotLast.indexOf(Ce.type.id)<0?(Vn=Ce.to-$n,qn=ke.block.children.length):(Vn=Zn,qn=jn,Zn=Ce.to-$n,jn=ke.block.children.length)),!Ce.nextSibling())break}for(;ke.block.children.length>qn;)ke.block.children.pop(),ke.block.positions.pop();return Vn-Qn}}function toRelative(_n,ke){let Ce=_n;for(let $n=1;$n<ke.length;$n++){let Mn=ke[$n-1].to,Qn=ke[$n].from;Mn<_n&&(Ce-=Qn-Mn)}return Ce}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,ke,Ce){let $n=[];for(let Mn=_n.firstChild,Qn=ke;;Mn=Mn.nextSibling){let Vn=Mn?Mn.from:Ce;if(Vn>Qn&&$n.push({from:Qn,to:Vn}),!Mn)break;Qn=Mn.to}return $n}function parseCode(_n){let{codeParser:ke,htmlParser:Ce}=_n;return{wrap:parseMixed((Mn,Qn)=>{let Vn=Mn.type.id;if(ke&&(Vn==Type.CodeBlock||Vn==Type.FencedCode)){let qn="";if(Vn==Type.FencedCode){let jn=Mn.node.getChild(Type.CodeInfo);jn&&(qn=Qn.read(jn.from,jn.to))}let Zn=ke(qn);if(Zn)return{parser:Zn,overlay:jn=>jn.type.id==Type.CodeText}}else if(Ce&&(Vn==Type.HTMLBlock||Vn==Type.HTMLTag))return{parser:Ce,overlay:leftOverSpace(Mn.node,Mn.from,Mn.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,ke,Ce){if(ke!=126||_n.char(Ce+1)!=126||_n.char(Ce+2)==126)return-1;let $n=_n.slice(Ce-1,Ce),Mn=_n.slice(Ce+2,Ce+3),Qn=/\s|^$/.test($n),Vn=/\s|^$/.test(Mn),qn=Punctuation.test($n),Zn=Punctuation.test(Mn);return _n.addDelimiter(StrikethroughDelim,Ce,Ce+2,!Vn&&(!Zn||Qn||qn),!Qn&&(!qn||Vn||Zn))},after:"Emphasis"}]};function parseRow(_n,ke,Ce=0,$n,Mn=0){let Qn=0,Vn=!0,qn=-1,Zn=-1,jn=!1,Xn=()=>{$n.push(_n.elt("TableCell",Mn+qn,Mn+Zn,_n.parser.parseInline(ke.slice(qn,Zn),Mn+qn)))};for(let zn=Ce;zn<ke.length;zn++){let Hn=ke.charCodeAt(zn);Hn==124&&!jn?((!Vn||qn>-1)&&Qn++,Vn=!1,$n&&(qn>-1&&Xn(),$n.push(_n.elt("TableDelimiter",zn+Mn,zn+Mn+1))),qn=Zn=-1):(jn||Hn!=32&&Hn!=9)&&(qn<0&&(qn=zn),Zn=zn+1),jn=!jn&&Hn==92}return qn>-1&&(Qn++,$n&&Xn()),Qn}function hasPipe(_n,ke){for(let Ce=ke;Ce<_n.length;Ce++){let $n=_n.charCodeAt(Ce);if($n==124)return!0;$n==92&&Ce++}return!1}const delimiterLine=/^\|?(\s*:?-+:?\s*\|)+(\s*:?-+:?\s*)?$/;class TableParser{constructor(){this.rows=null}nextLine(ke,Ce,$n){if(this.rows==null){this.rows=!1;let Mn;if((Ce.next==45||Ce.next==58||Ce.next==124)&&delimiterLine.test(Mn=Ce.text.slice(Ce.pos))){let Qn=[];parseRow(ke,$n.content,0,Qn,$n.start)==parseRow(ke,Mn,Ce.pos)&&(this.rows=[ke.elt("TableHeader",$n.start,$n.start+$n.content.length,Qn),ke.elt("TableDelimiter",ke.lineStart+Ce.pos,ke.lineStart+Ce.text.length)])}}else if(this.rows){let Mn=[];parseRow(ke,Ce.text,Ce.pos,Mn,ke.lineStart),this.rows.push(ke.elt("TableRow",ke.lineStart+Ce.pos,ke.lineStart+Ce.text.length,Mn))}return!1}finish(ke,Ce){return this.rows?(ke.addLeafElement(Ce,ke.elt("Table",C
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(ke,Ce)=>{let $n=ke.node.getChild("VariableDefinition");return $n&&Ce($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,ke){_n.matchContext(functionContext)||ke(_n,"variable")},TypeDefinition(_n,ke){ke(_n,"type")},__proto__:null};function getScope(_n,ke){let Ce=cache.get(ke);if(Ce)return Ce;let $n=[],Mn=!0;function Qn(Vn,qn){let Zn=_n.sliceString(Vn.from,Vn.to);$n.push({label:Zn,type:qn})}return ke.cursor(IterMode.IncludeAnonymous).iterate(Vn=>{if(Mn)Mn=!1;else if(Vn.name){let qn=gatherCompletions[Vn.name];if(qn&&qn(Vn,Qn)||ScopeNodes.has(Vn.name))return!1}else if(Vn.to-Vn.from>8192){for(let qn of getScope(_n,Vn.node))$n.push(qn);return!1}}),cache.set(ke,$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 ke=syntaxTree(_n.state).resolveInner(_n.pos,-1);if(dontComplete.indexOf(ke.name)>-1)return null;let Ce=ke.name=="VariableName"||ke.to-ke.from<20&&Identifier.test(_n.state.sliceDoc(ke.from,ke.to));if(!Ce&&!_n.explicit)return null;let $n=[];for(let Mn=ke;Mn;Mn=Mn.parent)ScopeNodes.has(Mn.name)&&($n=$n.concat(getScope(_n.state.doc,Mn)));return{options:$n,from:Ce?ke.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 ke=_n.textAfter,Ce=/^\s*\}/.test(ke),$n=/^\s*(case|default)\b/.test(ke);return _n.baseIndent+(Ce?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 ke=/^\s*<\//.test(_n.textAfter);return _n.lineIndent(_n.node.from)+(ke?0:_n.unit)},JSXEscape(_n){let ke=/\s*\}/.test(_n.textAfter);return _n.lineIndent(_n.node.from)+(ke?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 ke=_n.jsx?_n.typescript?tsxLanguage:jsxLanguage:_n.typescript?typescriptLanguage:javascriptLanguage,Ce=_n.typescript?typescriptSnippets.concat(typescriptKeywords):snippets.concat(keywords);return new LanguageSupport(ke,[javascriptLanguage.data.of({autocomplete:ifNotIn(dontComplete,completeFromList(Ce))}),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(ke,"class","start-typing")},m(Ce,$n){insert$1(Ce,ke,$n)},p:noop,d(Ce){Ce&&detach(ke)}}}function create_each_block_1$2(_n,ke){let Ce,$n=previewTitle(ke[9].schemas,ke[24],ke[0])+"",Mn,Qn,Vn,qn;function Zn(...Xn){return ke[17](ke[24],...Xn)}function jn(...Xn){return ke[18](ke[24],...Xn)}return{key:_n,first:null,c(){Ce=element("div"),Mn=text($n),Qn=space$3(),attr(Ce,"class","reference-tags-option"),attr(Ce,"role","button"),attr(Ce,"tabindex","0"),this.first=Ce},m(Xn,zn){insert$1(Xn,Ce,zn),append(Ce,Mn),append(Ce,Qn),Vn||(qn=[listen(Ce,"click",Zn),listen(Ce,"keypress",jn)],Vn=!0)},p(Xn,zn){ke=Xn,zn&65&&$n!==($n=previewTitle(ke[9].schemas,ke[24],ke[0])+"")&&set_data(Mn,$n)},d(Xn){Xn&&detach(Ce),Vn=!1,run_all(qn)}}}function create_if_block_1$7(_n){let ke,Ce,$n,Mn,Qn,Vn;return{c(){ke=element("div"),Ce=text('Add "'),$n=text(_n[5]),Mn=text('"'),attr(ke,"class","reference-tags-option"),attr(ke,"role","button"),attr(ke,"tabindex","0")},m(qn,Zn){insert$1(qn,ke,Zn),append(ke,Ce),append(ke,$n),append(ke,Mn),Qn||(Vn=[listen(ke,"click",_n[19]),listen(ke,"keypress",_n[20])],Qn=!0)},p(qn,Zn){Zn&32&&set_data($n,qn[5])},d(qn){qn&&detach(ke),Qn=!1,run_all(Vn)}}}function create_if_block$9(_n){let ke,Ce=[],$n=new Map,Mn,Qn=ensure_array_like(_n[7]);const Vn=qn=>qn[3].id;for(let qn=0;qn<Qn.length;qn+=1){let Zn=get_each_context$7(_n,Qn,qn),jn=Vn(Zn);$n.set(jn,Ce[qn]=create_each_block$7(jn,Zn))}return{c(){ke=element("div");for(let qn=0;qn<Ce.length;qn+=1)Ce[qn].c();set_style(ke,"display","flex"),set_style(ke,"align-items","center"),set_style(ke,"gap","4px")},m(qn,Zn){insert$1(qn,ke,Zn);for(let jn=0;jn<Ce.length;jn+=1)Ce[jn]&&Ce[jn].m(ke,null);Mn=!0},p(qn,Zn){Zn&1664&&(Qn=ensure_array_like(qn[7]),group_outros(),Ce=update_keyed_each(Ce,Zn,Vn,1,qn,Qn,$n,ke,outro_and_destroy_block,create_each_block$7,null,get_each_context$7),check_outros())},i(qn){if(!Mn){for(let Zn=0;Zn<Qn.length;Zn+=1)transition_in(Ce[Zn]);Mn=!0}},o(qn){for(let Zn=0;Zn<Ce.length;Zn+=1)transition_out(Ce[Zn]);Mn=!1},d(qn){qn&&detach(ke);for(let Zn=0;Zn<Ce.length;Zn+=1)Ce[Zn].d()}}}function create_each_block$7(_n,ke){let Ce,$n,Mn=previewTitle(ke[9].schemas,ke[3])+"",Qn,Vn,qn,Zn,jn,Xn,zn,Hn,Wn;jn=new Icon({props:{width:12,height:12,icon:"close"}});function Yn(...Un){return ke[21](ke[3],...Un)}return{key:_n,first:null,c(){Ce=element("span"),$n=element("a"),Qn=text(Mn),qn=space$3(),Zn=element("button"),create_component(jn.$$.fragment),Xn=space$3(),attr($n,"class","record-title"),attr($n,"href",Vn=ke[9].lucentUrl+"/records/"+ke[3].id),attr(Zn,"type","button"),attr(Zn,"class","button-text"),attr(Zn,"aria-label","Close"),attr(Ce,"class","reference-tags-selected-value"),this.first=Ce},m(Un,Gn){insert$1(Un,Ce,Gn),append(Ce,$n),append($n,Qn),append(Ce,qn),append(Ce,Zn),mount_component(jn,Zn,null),append(Ce,Xn),zn=!0,Hn||(Wn=listen(Zn,"click",prevent_default(Yn)),Hn=!0)},p(Un,Gn){ke=Un,(!zn||Gn&128)&&Mn!==(Mn=previewTitle(ke[9].schemas,ke[3])+"")&&set_data(Qn,Mn),(!zn||Gn&128&&Vn!==(Vn=ke[9].lucentUrl+"/records/"+ke[3].id))&&attr($n,"href",Vn)},i(Un){zn||(transition_in(jn.$$.fragment,Un),zn=!0)},o(Un){transition_out(jn.$$.fragment,Un),zn=!1},d(Un){Un&&detach(Ce),destroy_component(jn),Hn=!1,Wn()}}}function create_fragment$d(_n){let ke,Ce,$n,Mn,Qn,Vn,qn,Zn,jn,Xn,zn,Hn,Wn=_n[8]&&create_if_block_3$4(_n),Yn=_n[6]&&create_if_block_2$5(_n),Un=_n[5]&&create_if_block_1$7(_n),Gn=_n[7].length>0&&create_if_block$9(_n);return{c(){ke=element("div"),Wn&&Wn.c(),Ce=space$3(),$n=element("input"),Qn=space$3(),Vn=element("div"),Yn&&Yn.c(),qn=space$3(),Un&&Un.c(),Zn=space$3(),Gn&&Gn.c(),jn=empty$1(),attr($n,"type","search"),attr($n,"id",_n[2]),attr($n,"placeholder",Mn="Search for "+_n[1].label),attr($n,"autocomplete","off"),toggle_class($n,"is-invalid",_n[8]),attr(Vn,"class","reference-tags-results"),attr(ke,"class","reference-tags")},m(Kn,Jn){insert$1(Kn,ke,Jn),Wn&&Wn.m(ke,null),append(ke,Ce),append(ke,$n),_n[15]($n),set_input_value($n,_n[5]),append(ke,Qn),append(ke,Vn),Yn&&Yn.m(Vn,null),append(Vn,qn),Un&&Un.m(Vn,null),insert$1(Kn,Zn,Jn),Gn&&Gn.m(Kn,Jn),insert$1(Kn,jn,Jn),Xn=!0,zn||(Hn=[listen($n,"keyup",_n[13]),listen($n,"input",_n[16])],zn=!0)},p(Kn,[Jn]){Kn[8]?Wn?Wn.p(Kn,Jn):(Wn=create_if_block_3$4(Kn),Wn.c(),Wn.m(ke,Ce)):Wn&&(Wn.d(1),Wn=null),(!Xn||Jn&4)&&attr($n,"id",Kn[2]),(!Xn||Jn&2&&Mn!==(Mn="Search for "+Kn[1].label))&&attr($n,"placeholder",Mn),Jn&32&&$n.value!==Kn[5]&&set_input_value($n,Kn[5]),(!Xn||Jn&256)&&toggle_class($n,"is-invalid",Kn[8]),Kn[6]?Yn?Yn.p(Kn,Jn):(Yn=create_if_block_2$5(Kn),Yn.c(),Yn.m(Vn,qn)):Yn&&(Yn.d(1),Yn=null),Kn[5]?Un?Un.p(Kn,Jn):(Un=create_if_block_1$7(Kn),Un.c(),Un.m(Vn,null)):Un&&(Un.d(1),Un=null),Kn[7].length>0?Gn?(Gn.p(Kn,Jn),Jn&128&&transition_in(Gn,1)):(Gn=create_if_block$9(Kn),Gn.c(),transition_in(Gn,1),Gn.m(jn.parentNode,jn)):Gn&&(group_outros(),transition_out(Gn,1,1,()=>{Gn=null}),check_outros())},i(Kn){Xn||(transition_in(Gn),Xn=!0)},o(Kn){transition_out(Gn),Xn=!1},d(Kn){Kn&&(detach(ke),detach(Zn),detach(jn)),Wn&&Wn.d(),_n[15](null),Yn
Line truncated
|
|
||||||
versions`),Nr=space$3(),Or=element("div"),Ar.c(),jr=space$3(),qr=element("div"),Vr&&Vr.c(),attr(Qn,"class","label text-end text-muted"),attr(Hn,"class","label text-end text-muted"),attr(Jn,"class","label text-end text-muted"),attr(cr,"class","label text-end text-muted"),attr($n,"class","col-8"),attr(br,"class","label d-block text-muted "),attr(hr,"class","col-4"),attr(Ce,"class","row"),attr(ke,"class","lx-card "),attr(Or,"class","revisions")},m(Lr,zr){insert$1(Lr,ke,zr),append(ke,Ce),append(Ce,$n),append($n,Mn),append(Mn,Qn),append(Mn,Vn),append(Mn,qn),append(qn,jn),append($n,Xn),append($n,zn),append(zn,Hn),append(zn,Wn),append(zn,Un),append($n,Gn),append($n,Kn),append(Kn,Jn),append(Kn,tr),mount_component(nr,Kn,null),append(Kn,er),append(Kn,or),append($n,ir),append($n,sr),append(sr,cr),append(sr,ur),mount_component(fr,sr,null),append(sr,pr),append(sr,_r),append(Ce,vr),append(Ce,hr),append(hr,br),append(hr,Er),append(hr,Cr),append(Cr,Mr),append(Cr,Pr),append(Cr,Qr),insert$1(Lr,Nr,zr),insert$1(Lr,Or,zr),Ir[kr].m(Or,null),insert$1(Lr,jr,zr),insert$1(Lr,qr,zr),Vr&&Vr.m(qr,null),_n[13](qr),Fr=!0},p(Lr,[zr]){(!Fr||zr&1)&&Zn!==(Zn=Lr[0].id+"")&&set_data(jn,Zn),(!Fr||zr&1)&&Yn!==(Yn=Lr[0]._sys.version+"")&&set_data(Un,Yn);const Jr={};zr&3&&(Jr.name=usernameById(Lr[1],Lr[0]._sys.createdBy)),nr.$set(Jr),(!Fr||zr&1)&&rr!==(rr=friendlyDate(Lr[0]._sys.createdAt)+"")&&set_data(or,rr);const Gr={};zr&3&&(Gr.name=usernameById(Lr[1],Lr[0]._sys.updatedBy)),fr.$set(Gr),(!Fr||zr&1)&&mr!==(mr=friendlyDate(Lr[0]._sys.updatedAt)+"")&&set_data(_r,mr),(!Fr||zr&4)&&yr!==(yr=Lr[2].revisions+"")&&set_data(Pr,yr);let eo=kr;kr=Hr(Lr),kr===eo?Ir[kr].p(Lr,zr):(group_outros(),transition_out(Ir[eo],1,1,()=>{Ir[eo]=null}),check_outros(),Ar=Ir[kr],Ar?Ar.p(Lr,zr):(Ar=Ir[kr]=Xr[kr](Lr),Ar.c()),transition_in(Ar,1),Ar.m(Or,null)),Lr[5]?Vr?(Vr.p(Lr,zr),zr&32&&transition_in(Vr,1)):(Vr=create_if_block$6(Lr),Vr.c(),transition_in(Vr,1),Vr.m(qr,null)):Vr&&(group_outros(),transition_out(Vr,1,1,()=>{Vr=null}),check_outros())},i(Lr){Fr||(transition_in(nr.$$.fragment,Lr),transition_in(fr.$$.fragment,Lr),transition_in(Ar),transition_in(Vr),Fr=!0)},o(Lr){transition_out(nr.$$.fragment,Lr),transition_out(fr.$$.fragment,Lr),transition_out(Ar),transition_out(Vr),Fr=!1},d(Lr){Lr&&(detach(ke),detach(Nr),detach(Or),detach(jr),detach(qr)),destroy_component(nr),destroy_component(fr),Ir[kr].d(),Vr&&Vr.d(),_n[13](null)}}}function instance$8(_n,ke,Ce){let $n,Mn,Qn,Vn;const qn=getContext$1("channel");let{record:Zn}=ke,{graph:jn}=ke,{users:Xn}=ke,{schema:zn}=ke,Hn,Wn="";axios$1.get(`${qn.lucentUrl}/records/${Zn.id}/revisions`).then(tr=>{Ce(8,$n=tr.data)}).catch(tr=>{console.log(tr)});function Yn(tr,nr){Ce(7,Vn=jn.edges.filter(er=>er.depth===1).reduce((er,rr)=>(er[rr.field]||(er[rr.field]={record:[],revision:[]}),er[rr.field].record.push(rr),er),{})),Ce(7,Vn=nr._edges.reduce((er,rr)=>(er[rr.field]||(er[rr.field]={record:[],revision:[]}),er[rr.field].revision.push(rr),er),Vn))}function Un(tr,nr){tr.preventDefault(),Ce(5,Qn=nr),Ce(6,Mn=zn.fields.filter(er=>hasDataChanged(!1,Qn.data[er.name],Zn.data[er.name]))),Yn(Mn,nr),Hn.scrollIntoView()}function Gn(tr){tr.preventDefault(),Ce(4,Wn=""),axios$1.post(`${qn.lucentUrl}/records/${Zn.id}/rollback/${Qn._sys.version}`).then(nr=>{window.location.reload()}).catch(nr=>{const er=nr.response.data.error;Ce(4,Wn=er.fieldLabel+": "+er.message)})}const Kn=(tr,nr)=>Un(nr,tr);function Jn(tr){binding_callbacks[tr?"unshift":"push"](()=>{Hn=tr,Ce(3,Hn)})}return _n.$$set=tr=>{"record"in tr&&Ce(0,Zn=tr.record),"graph"in tr&&Ce(11,jn=tr.graph),"users"in tr&&Ce(1,Xn=tr.users),"schema"in tr&&Ce(2,zn=tr.schema)},Ce(8,$n=[]),Ce(6,Mn=[]),Ce(5,Qn=null),Ce(7,Vn={}),[Zn,Xn,zn,Hn,Wn,Qn,Mn,Vn,$n,Un,Gn,jn,Kn,Jn]}class Info extends SvelteComponent{constructor(ke){super(),init(this,ke,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,ke,Ce){const $n=_n.slice();return $n[21]=ke[Ce],$n}function create_if_block_5(_n){let ke,Ce,$n;return{c(){ke=element("button"),ke.innerHTML=`<span class="spinner-border spinner-border-sm" role="status" aria-hidden="true"></span>
|
|
||||||
Save`,attr(ke,"type","button"),attr(ke,"class","button primary ms-2 btn btn-primary btn-spinner")},m(Mn,Qn){insert$1(Mn,ke,Qn),Ce||($n=listen(ke,"click",_n[11]),Ce=!0)},p:noop,d(Mn){Mn&&detach(ke),Ce=!1,$n()}}}function create_if_block_4(_n){let ke,Ce,$n;return{c(){ke=element("button"),ke.innerHTML=`<span class="spinner-border spinner-border-sm" role="status" aria-hidden="true"></span>
|
|
||||||
Create`,attr(ke,"class","button primary btn-spinner")},m(Mn,Qn){insert$1(Mn,ke,Qn),Ce||($n=listen(ke,"click",_n[11]),Ce=!0)},p:noop,d(Mn){Mn&&detach(ke),Ce=!1,$n()}}}function create_if_block_3(_n){let ke,Ce;return ke=new Info({props:{record:_n[0],graph:_n[1],users:_n[4],schema:_n[2]}}),{c(){create_component(ke.$$.fragment)},m($n,Mn){mount_component(ke,$n,Mn),Ce=!0},p($n,Mn){const Qn={};Mn&1&&(Qn.record=$n[0]),Mn&2&&(Qn.graph=$n[1]),Mn&16&&(Qn.users=$n[4]),Mn&4&&(Qn.schema=$n[2]),ke.$set(Qn)},i($n){Ce||(transition_in(ke.$$.fragment,$n),Ce=!0)},o($n){transition_out(ke.$$.fragment,$n),Ce=!1},d($n){destroy_component(ke,$n)}}}function create_if_block_2$1(_n){let ke,Ce;return ke=new Graph({props:{graph:_n[1],record:_n[0]}}),{c(){create_component(ke.$$.fragment)},m($n,Mn){mount_component(ke,$n,Mn),Ce=!0},p($n,Mn){const Qn={};Mn&2&&(Qn.graph=$n[1]),Mn&1&&(Qn.record=$n[0]),ke.$set(Qn)},i($n){Ce||(transition_in(ke.$$.fragment,$n),Ce=!0)},o($n){transition_out(ke.$$.fragment,$n),Ce=!1},d($n){destroy_component(ke,$n)}}}function create_if_block$5(_n){let ke,Ce,$n=[],Mn=new Map,Qn,Vn;ke=new FilePreview({props:{record:_n[0],schema:_n[2]}});let qn=ensure_array_like(_n[9]);const Zn=jn=>jn[21].name;for(let jn=0;jn<qn.length;jn+=1){let Xn=get_each_context$3(_n,qn,jn),zn=Zn(Xn);Mn.set(zn,$n[jn]=create_each_block$3(zn,Xn))}return{c(){create_component(ke.$$.fragment),Ce=space$3();for(let jn=0;jn<$n.length;jn+=1)$n[jn].c();Qn=empty$1()},m(jn,Xn){mount_component(ke,jn,Xn),insert$1(jn,Ce,Xn);for(let zn=0;zn<$n.length;zn+=1)$n[zn]&&$n[zn].m(jn,Xn);insert$1(jn,Qn,Xn),Vn=!0},p(jn,Xn){const zn={};Xn&1&&(zn.record=jn[0]),Xn&4&&(zn.schema=jn[2]),ke.$set(zn),Xn&623&&(qn=ensure_array_like(jn[9]),group_outros(),$n=update_keyed_each($n,Xn,Zn,1,jn,qn,Mn,Qn.parentNode,outro_and_destroy_block,create_each_block$3,Qn,get_each_context$3),check_outros())},i(jn){if(!Vn){transition_in(ke.$$.fragment,jn);for(let Xn=0;Xn<qn.length;Xn+=1)transition_in($n[Xn]);Vn=!0}},o(jn){transition_out(ke.$$.fragment,jn);for(let Xn=0;Xn<$n.length;Xn+=1)transition_out($n[Xn]);Vn=!1},d(jn){jn&&(detach(Ce),detach(Qn)),destroy_component(ke,jn);for(let Xn=0;Xn<$n.length;Xn+=1)$n[Xn].d(jn)}}}function create_if_block_1$3(_n){let ke,Ce,$n,Mn;function Qn(Zn){_n[15](Zn)}function Vn(Zn){_n[16](Zn)}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]),ke=new FormField({props:qn}),binding_callbacks.push(()=>bind(ke,"data",Qn)),binding_callbacks.push(()=>bind(ke,"graph",Vn)),{c(){create_component(ke.$$.fragment)},m(Zn,jn){mount_component(ke,Zn,jn),Mn=!0},p(Zn,jn){const Xn={};jn&4&&(Xn.schema=Zn[2]),jn&1&&(Xn.record=Zn[0]),jn&32&&(Xn.validationErrors=Zn[5]),jn&8&&(Xn.isCreateMode=Zn[3]),!Ce&&jn&1&&(Ce=!0,Xn.data=Zn[0].data,add_flush_callback(()=>Ce=!1)),!$n&&jn&2&&($n=!0,Xn.graph=Zn[1],add_flush_callback(()=>$n=!1)),ke.$set(Xn)},i(Zn){Mn||(transition_in(ke.$$.fragment,Zn),Mn=!0)},o(Zn){transition_out(ke.$$.fragment,Zn),Mn=!1},d(Zn){destroy_component(ke,Zn)}}}function create_each_block$3(_n,ke){let Ce,$n,Mn,Qn=ke[6]===ke[21].group&&create_if_block_1$3(ke);return{key:_n,first:null,c(){Ce=empty$1(),Qn&&Qn.c(),$n=empty$1(),this.first=Ce},m(Vn,qn){insert$1(Vn,Ce,qn),Qn&&Qn.m(Vn,qn),insert$1(Vn,$n,qn),Mn=!0},p(Vn,qn){ke=Vn,ke[6]===ke[21].group?Qn?(Qn.p(ke,qn),qn&64&&transition_in(Qn,1)):(Qn=create_if_block_1$3(ke),Qn.c(),transition_in(Qn,1),Qn.m($n.parentNode,$n)):Qn&&(group_outros(),transition_out(Qn,1,1,()=>{Qn=null}),check_outros())},i(Vn){Mn||(transition_in(Qn),Mn=!0)},o(Vn){transition_out(Qn),Mn=!1},d(Vn){Vn&&(detach(Ce),detach($n)),Qn&&Qn.d(Vn)}}}function create_fragment$7(_n){let ke,Ce,$n,Mn,Qn,Vn,qn,Zn,jn,Xn,zn,Hn,Wn,Yn,Un,Gn,Kn,Jn,tr,nr,er;function rr(hr){_n[12](hr)}function or(hr){_n[13](hr)}let ir={schema:_n[2],isCreateMode:_n[3]};_n[0]!==void 0&&(ir.record=_n[0]),_n[6]!==void 0&&(ir.activeContentTab=_n[6]),$n=new EditHeader({props:ir}),binding_callbacks.push(()=>bind($n,"record",rr)),binding_callbacks.push(()=>bind($n,"activeContentTab",or));function sr(hr,br){if(hr[3])return create_if_block_4;if(hr[8])return create_if_block_5}let cr=sr(_n),ur=cr&&cr(_n);Zn=new Title({props:{schema:_n[2],record:_n[0],isCreateMode:_n[3]}}),Xn=new ErrorAlert({props:{message:_n[7]}});function fr(hr){_n[14](hr)}let pr={schema:_n[2],isCreateMode:_n[3]};_n[6]!==void 0&&(pr.active=_n[6]),Wn=new ContentTabs({props:pr}),binding_callbacks.push(()=>bind(Wn,"active",fr));const mr=[create_if_block$5,create_if_block_2$1,create_if_block_3],_r=[];function vr(hr,br){return br&64&&(Gn=null),Gn==null&&(Gn=!["_graph","_info"].includes(hr[6])),Gn?0:hr[6]==="_graph"?1:hr[6]==="_info"?2:-1}return~(Kn=vr(_n,-1))&&(Jn=_r[Kn]=mr[Kn](_n)),{c(){ke=element("div"),Ce=element("div"),create_component($n.$$.fragment),Vn=space$3(),ur&&ur.c(),qn=space$3(),create_component(Zn.$$.fragment),jn=space$3(),create_component(Xn.$$.fragment),zn=space$3(),Hn=element("div"),create_component(Wn.$$.fragment),
Line truncated
|
|
||||||
`),Un=element("div"),Un.textContent=" ",Gn=text(`
|
|
||||||
`),attr($n,"class","header-small mb-5"),attr(Vn,"class","button primary mb-3"),Vn.disabled=_n[2],attr(jn,"class","mb-3"),attr(Hn,"class","logs svelte-a3cwpi"),attr(Ce,"class","lx-card mt-5"),attr(ke,"class","common-wrapper")},m(er,rr){insert$1(er,ke,rr),append(ke,Ce),append(Ce,$n),append($n,Mn),append(Ce,Qn),append(Ce,Vn),append(Vn,qn),append(Ce,Zn),append(Ce,jn),tr&&tr.m(jn,null),append(jn,Xn),nr&&nr.m(jn,null),append(Ce,zn),append(Ce,Hn),append(Hn,Wn),append(Hn,Yn),append(Hn,Un),_n[6](Un),append(Hn,Gn),Kn||(Jn=listen(Vn,"click",_n[4]),Kn=!0)},p(er,[rr]){rr&1&&set_data(Mn,er[0]),rr&4&&(Vn.disabled=er[2]),er[2]?tr||(tr=create_if_block_1(),tr.c(),tr.m(jn,Xn)):tr&&(tr.d(1),tr=null),!er[2]&&er[3]?nr||(nr=create_if_block$1(),nr.c(),nr.m(jn,null)):nr&&(nr.d(1),nr=null),rr&8&&set_data(Wn,er[3])},i:noop,o:noop,d(er){er&&detach(ke),tr&&tr.d(),nr&&nr.d(),_n[6](null),Kn=!1,Jn()}}}function instance$2(_n,ke,Ce){let $n;const Mn=getContext$1("channel");let{title:Qn}=ke,{command:Vn}=ke,qn,Zn=!1;function jn(){const Hn=new EventSource(Mn.lucentUrl+"/command-report-source/"+Vn.signature);Hn.onmessage=function(Wn){Ce(2,Zn=!0);const Yn=JSON.parse(Wn.data);Yn.date,Ce(3,$n=Yn.logs),qn.scrollIntoView()},Hn.onerror=Wn=>{Hn.close(),Ce(2,Zn=!1)}}function Xn(Hn){Hn.preventDefault(),Ce(2,Zn=!0),axios$1.post(Mn.lucentUrl+"/command/"+Vn.signature).then(Wn=>{jn()})}onMount(()=>{jn()});function zn(Hn){binding_callbacks[Hn?"unshift":"push"](()=>{qn=Hn,Ce(1,qn)})}return _n.$$set=Hn=>{"title"in Hn&&Ce(0,Qn=Hn.title),"command"in Hn&&Ce(5,Vn=Hn.command)},Ce(3,$n=""),[Qn,qn,Zn,$n,Xn,Vn,zn]}class Report extends SvelteComponent{constructor(ke){super(),init(this,ke,instance$2,create_fragment$2,safe_not_equal,{title:0,command:5})}}function get_each_context(_n,ke,Ce){const $n=_n.slice();return $n[2]=ke[Ce],$n}function create_if_block(_n){let ke,Ce;return ke=new Dropdown({props:{$$slots:{button:[create_button_slot],default:[create_default_slot]},$$scope:{ctx:_n}}}),{c(){create_component(ke.$$.fragment)},m($n,Mn){mount_component(ke,$n,Mn),Ce=!0},p($n,Mn){const Qn={};Mn&32&&(Qn.$$scope={dirty:Mn,ctx:$n}),ke.$set(Qn)},i($n){Ce||(transition_in(ke.$$.fragment,$n),Ce=!0)},o($n){transition_out(ke.$$.fragment,$n),Ce=!1},d($n){destroy_component(ke,$n)}}}function create_each_block(_n){let ke,Ce=_n[2].name+"",$n;return{c(){ke=element("a"),$n=text(Ce),attr(ke,"href",_n[0].lucentUrl+"/command-report/"+_n[2].signature),attr(ke,"class","top-nav-item")},m(Mn,Qn){insert$1(Mn,ke,Qn),append(ke,$n)},p:noop,d(Mn){Mn&&detach(ke)}}}function create_default_slot(_n){let ke,Ce=ensure_array_like(_n[0].commands),$n=[];for(let Mn=0;Mn<Ce.length;Mn+=1)$n[Mn]=create_each_block(get_each_context(_n,Ce,Mn));return{c(){for(let Mn=0;Mn<$n.length;Mn+=1)$n[Mn].c();ke=empty$1()},m(Mn,Qn){for(let Vn=0;Vn<$n.length;Vn+=1)$n[Vn]&&$n[Vn].m(Mn,Qn);insert$1(Mn,ke,Qn)},p(Mn,Qn){if(Qn&1){Ce=ensure_array_like(Mn[0].commands);let Vn;for(Vn=0;Vn<Ce.length;Vn+=1){const qn=get_each_context(Mn,Ce,Vn);$n[Vn]?$n[Vn].p(qn,Qn):($n[Vn]=create_each_block(qn),$n[Vn].c(),$n[Vn].m(ke.parentNode,ke))}for(;Vn<$n.length;Vn+=1)$n[Vn].d(1);$n.length=Ce.length}},d(Mn){Mn&&detach(ke),destroy_each($n,Mn)}}}function create_button_slot(_n){let ke;return{c(){ke=element("div"),ke.textContent="Actions",attr(ke,"slot","button")},m(Ce,$n){insert$1(Ce,ke,$n)},p:noop,d(Ce){Ce&&detach(ke)}}}function create_fragment$1(_n){let ke,Ce,$n,Mn,Qn,Vn,qn,Zn,jn=_n[0].commands.length>0&&create_if_block(_n);return qn=new Avatar({props:{side:"28",name:_n[1].name}}),{c(){ke=element("div"),Ce=element("a"),$n=text("Members"),Mn=space$3(),jn&&jn.c(),Qn=space$3(),Vn=element("a"),create_component(qn.$$.fragment),attr(Ce,"class","top-nav-item"),attr(Ce,"href",_n[0].lucentUrl+"/members"),attr(Vn,"href",_n[0].lucentUrl+"/profile"),attr(ke,"class","top-nav ")},m(Xn,zn){insert$1(Xn,ke,zn),append(ke,Ce),append(Ce,$n),append(ke,Mn),jn&&jn.m(ke,null),append(ke,Qn),append(ke,Vn),mount_component(qn,Vn,null),Zn=!0},p(Xn,[zn]){Xn[0].commands.length>0&&jn.p(Xn,zn)},i(Xn){Zn||(transition_in(jn),transition_in(qn.$$.fragment,Xn),Zn=!0)},o(Xn){transition_out(jn),transition_out(qn.$$.fragment,Xn),Zn=!1},d(Xn){Xn&&detach(ke),jn&&jn.d(),destroy_component(qn)}}}function instance$1(_n){const ke=getContext$1("channel"),Ce=getContext$1("user");return[ke,Ce]}class Header extends SvelteComponent{constructor(ke){super(),init(this,ke,instance$1,create_fragment$1,safe_not_equal,{})}}function create_fragment(_n){let ke,Ce,$n,Mn,Qn,Vn,qn,Zn,jn;$n=new Navbar({props:{schema:_n[2].schema}}),Vn=new Header({});const Xn=[{title:_n[0]},_n[2]];var zn=_n[3][_n[1]];function Hn(Wn,Yn){let Un={};for(let Gn=0;Gn<Xn.length;Gn+=1)Un=assign(Un,Xn[Gn]);return Yn!==void 0&&Yn&5&&(Un=assign(Un,get_spread_update(Xn,[Yn&1&&{title:Wn[0]},Yn&4&&get_spread_object(Wn[2])]))),{props:Un}}return zn&&(Zn=construct_svelte_component(zn,Hn(_n))),{c(){ke=element("div"),Ce=element("div"),create_component($n.$$.fragment),Mn=space$3(),Qn=element("div"),create_component(Vn.$$.fragment),qn=space$3(),Zn&&cr
Line truncated
|
|
||||||
Vendored
+212
@@ -0,0 +1,212 @@
|
|||||||
|
var bP=Object.defineProperty;var vP=(i,e,t)=>e in i?bP(i,e,{enumerable:!0,configurable:!0,writable:!0,value:t}):i[e]=t;var Qh=(i,e,t)=>(vP(i,typeof e!="symbol"?e+"":e,t),t);function U(){}const wP=i=>i;function Cs(i,e){for(const t in e)i[t]=e[t];return i}function ty(i){return i()}function tg(){return Object.create(null)}function ut(i){i.forEach(ty)}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 yP(i){return Object.keys(i).length===0}function Gl(i,e,t,n){if(i){const r=ny(i,e,t,n);return i[0](r)}}function ny(i,e,t,n){return i[1]&&n?Cs(t.ctx.slice(),i[1](n(e))):t.ctx}function Hl(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 Kl(i,e,t,n,r,s){if(r){const o=ny(e,t,n,s);i.p(o,r)}}function Jl(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 kP(i){return i&&nh(i.destroy)?i.destroy:U}function ng(i){const e=typeof i=="string"&&i.match(/^\s*(-?[\d.]+)([^\s]*)\s*$/);return e?[parseFloat(e[1]),e[2]||"px"]:[i,"px"]}const iy=typeof window<"u";let SP=iy?()=>window.performance.now():()=>Date.now(),Xm=iy?i=>requestAnimationFrame(i):U;const oo=new Set;function ry(i){oo.forEach(e=>{e.c(i)||(oo.delete(e),e.f())}),oo.size!==0&&Xm(ry)}function _P(i){let e;return oo.size===0&&Xm(ry),{promise:new Promise(t=>{oo.add(e={c:i,f:t})}),abort(){oo.delete(e)}}}const CP=typeof window<"u"?window:typeof globalThis<"u"?globalThis:global;function v(i,e){i.appendChild(e)}function sy(i){if(!i)return document;const e=i.getRootNode?i.getRootNode():i.ownerDocument;return e&&e.host?e:i.ownerDocument}function PP(i){const e=y("style");return e.textContent="/* empty */",AP(sy(i),e),e.sheet}function AP(i,e){return v(i.head||i,e),e.sheet}function A(i,e,t){i.insertBefore(e,t||null)}function P(i){i.parentNode&&i.parentNode.removeChild(i)}function mt(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 xP(i){return document.createElementNS("http://www.w3.org/2000/svg",i)}function W(i){return document.createTextNode(i)}function D(){return W(" ")}function De(){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 Ko(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 oy(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 ly(i){return i===""?null:+i}function TP(i){return Array.from(i.childNodes)}function K(i,e){e=""+e,i.data!==e&&(i.data=e)}function Ie(i,e){i.value=e??""}function fe(i,e,t,n){t==null?i.style.removeProperty(e):i.style.setProperty(e,t,"")}function ig(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 QP(i){const e=i.querySelector(":checked");return e&&e.__value}function Ae(i,e,t){i.classList.toggle(e,!!t)}function ay(i,e,{bubbles:t=!1,cancelable:n=!1}={}){return new CustomEvent(i,{detail:e,bubbles:t,cancelable:n})}function Fr(i,e){return new i(e)}const su=new Map;let ou=0;function MP(i){let e=5381,t=i.length;for(;t--;)e=(e<<5)-e^i.charCodeAt(t);return e>>>0}function EP(i,e){const t={stylesheet:PP(e),rules:{}};return su.set(i,t),t}function rg(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 b=e+(t-e)*s(g);c+=g*100+`%{${o(b,1-b)}}
|
||||||
|
`}const u=c+`100% {${o(t,1-t)}}
|
||||||
|
}`,h=`__svelte_${MP(u)}_${l}`,f=sy(i),{stylesheet:d,rules:m}=su.get(f)||EP(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 RP(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||DP())}function DP(){Xm(()=>{ou||(su.forEach(i=>{const{ownerNode:e}=i.stylesheet;e&&P(e)}),su.clear())})}let ea;function xl(i){ea=i}function Zo(){if(!ea)throw new Error("Function called outside component initialization");return ea}function Ti(i){Zo().$$.on_mount.push(i)}function cy(i){Zo().$$.after_update.push(i)}function uy(i){Zo().$$.on_destroy.push(i)}function nn(){const i=Zo();return(e,t,{cancelable:n=!1}={})=>{const r=i.$$.callbacks[e];if(r){const s=ay(e,t,{cancelable:n});return r.slice().forEach(o=>{o.call(i,s)}),!s.defaultPrevented}return!0}}function Tl(i,e){return Zo().$$.context.set(i,e),e}function je(i){return Zo().$$.context.get(i)}function Lr(i,e){const t=i.$$.callbacks[e.type];t&&t.slice().forEach(n=>n.call(this,e))}const Gs=[],Se=[];let lo=[];const cd=[],$P=Promise.resolve();let ud=!1;function LP(){ud||(ud=!0,$P.then(hy))}function Ps(i){lo.push(i)}function nt(i){cd.push(i)}const Mh=new Set;let zs=0;function hy(){if(zs!==0)return;const i=ea;do{try{for(;zs<Gs.length;){const e=Gs[zs];zs++,xl(e),IP(e.$$)}}catch(e){throw Gs.length=0,zs=0,e}for(xl(null),Gs.length=0,zs=0;Se.length;)Se.pop()();for(let e=0;e<lo.length;e+=1){const t=lo[e];Mh.has(t)||(Mh.add(t),t())}lo.length=0}while(Gs.length);for(;cd.length;)cd.pop()();ud=!1,Mh.clear(),xl(i)}function IP(i){if(i.fragment!==null){i.update(),ut(i.before_update);const e=i.dirty;i.dirty=[-1],i.fragment&&i.fragment.p(i.ctx,e),i.after_update.forEach(Ps)}}function NP(i){const e=[],t=[];lo.forEach(n=>i.indexOf(n)===-1?e.push(n):t.push(n)),t.forEach(n=>n()),lo=e}let Jo;function ZP(){return Jo||(Jo=Promise.resolve(),Jo.then(()=>{Jo=null})),Jo}function Eh(i,e,t){i.dispatchEvent(ay(`${e?"intro":"outro"}${t}`))}const Lc=new Set;let sr;function me(){sr={r:0,c:[],p:sr}}function pe(){sr.r||ut(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 BP={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&&RP(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:b=wP,tick:w=U,css:S}=s||BP,_={start:SP()+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=rg(i,o,m,g,p,b,S)),m&&w(0,1),l=f(_,g),Ps(()=>Eh(i,m,"start")),_P(k=>{if(a&&k>a.start&&(l=f(a,g),a=null,Eh(i,l.b,"start"),S&&(h(),c=rg(i,o,l.b,l.duration,0,b,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||ut(l.group.c)),l=null;else if(k>=l.start){const Q=k-l.start;o=l.a+l.d*b(Q/l.duration),w(o,1-o)}}return!!(l||a)}))}return{run(m){nh(s)?ZP().then(()=>{s=s({direction:m?"in":"out"}),d(m)}):d(m)},end(){h(),l=a=null}}}function ue(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 mr(i,e){R(i,1,1,()=>{e.delete(i.key)})}function di(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=[],b=new Map,w=new Map,S=[];for(m=d;m--;){const x=h(r,s,m),C=t(x);let M=o.get(C);M?S.push(()=>M.p(x,e)):(M=c(C,x),M.c()),b.set(C,g[m]=M),C in p&&w.set(C,Math.abs(m-p[C]))}const _=new Set,k=new Set;function Q(x){T(x,1),x.m(l,u),o.set(x.key,x),u=x.first,d--}for(;f&&d;){const x=g[d-1],C=i[f-1],M=x.key,$=C.key;x===C?(u=x.first,f--,d--):b.has($)?!o.has(M)||_.has(M)?Q(x):k.has($)?f--:w.get(M)>w.get($)?(k.add(M),Q(x)):(_.add($),f--):(a(C,o),f--)}for(;f--;){const x=i[f];b.has(x.key)||a(x,o)}for(;d;)Q(g[d-1]);return ut(S),g}function So(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 _o(i){return typeof i=="object"&&i!==null?i:{}}function He(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),Ps(()=>{const s=i.$$.on_mount.map(ty).filter(nh);i.$$.on_destroy?i.$$.on_destroy.push(...s):ut(s),i.$$.on_mount=[]}),r.forEach(Ps)}function z(i,e){const t=i.$$;t.fragment!==null&&(NP(t.after_update),ut(t.on_destroy),t.fragment&&t.fragment.d(e),t.on_destroy=t.fragment=null,t.ctx=[])}function WP(i,e){i.$$.dirty[0]===-1&&(Gs.push(i),LP(),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(b,w){A(b,e,w),v(e,t),v(e,n),v(e,r),v(r,s),v(r,o),v(r,l),v(r,a),v(r,c),v(c,u),v(c,h),v(c,f),Ie(f,i[0]),v(r,d),v(r,m),p||(g=[G(f,"input",i[3]),G(r,"submit",i[2])],p=!0)},p(b,w){w&1&&f.value!==b[0]&&Ie(f,b[0])},d(b){b&&P(e),p=!1,ut(g)}}}function dx(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){A(c,e,u),v(e,t),v(t,n),v(t,r),v(r,s),v(t,o),v(e,l),v(e,a)},p(c,u){u&1&&K(s,c[0])},d(c){c&&P(e)}}}function mx(i){let e,t,n,r;function s(a,c){return a[1]?dx:fx}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){A(a,e,c),v(e,t),v(e,n),v(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 px(i,e,t){const n=je("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 gx extends oe{constructor(e){super(),se(this,e,px,mx,re,{})}}function Ox(i){let e,t,n,r,s,o,l,a,c,u,h,f,d,m,p,g,b,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,_){A(S,e,_),v(e,t),v(e,n),v(e,r),v(r,s),v(s,o),v(s,l),v(s,a),v(a,c),v(c,u),v(c,h),v(c,f),v(c,d),v(s,p),v(s,g),b||(w=G(a,"submit",i[1]),b=!0)},p(S,[_]){_&1&&K(h,S[0])},i:U,o:U,d(S){S&&P(e),b=!1,w()}}}function bx(i,e,t){const n=je("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 vx extends oe{constructor(e){super(),se(this,e,bx,Ox,re,{email:0,token:2})}}function wx(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]),fe(e,"background-color",i[3][i[4]]),fe(e,"height",i[1]+"px"),fe(e,"width",i[1]+"px"),fe(e,"font-size",i[1]/2+"px")},m(r,s){A(r,e,s),v(e,t),v(t,n)},p(r,[s]){s&4&&K(n,r[2]),s&1&&O(e,"title",r[0]),s&2&&fe(e,"height",r[1]+"px"),s&2&&fe(e,"width",r[1]+"px"),s&2&&fe(e,"font-size",r[1]/2+"px")},i:U,o:U,d(r){r&&P(e)}}}function yx(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 Ci extends oe{constructor(e){super(),se(this,e,yx,wx,re,{name:0,side:1})}}function kx(i){const e=i-1;return e*e*e+1}function hu(i,{delay:e=0,duration:t=400,easing:n=kx,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]=ng(r),[d,m]=ng(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 pg(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){A(a,e,c),v(e,t),v(e,n),v(e,r),v(r,s),l=!0},p(a,c){(!l||c&2)&&K(s,a[1])},i(a){l||(a&&Ps(()=>{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 Sx(i){let e,t=i[0]&&pg(i);return{c(){t&&t.c(),e=De()},m(n,r){t&&t.m(n,r),A(n,e,r)},p(n,[r]){n[0]?t?(t.p(n,r),r&1&&T(t,1)):(t=pg(n),t.c(),T(t,1),t.m(e.parentNode,e)):t&&(me(),R(t,1,1,()=>{t=null}),pe())},i(n){T(t)},o(n){R(t)},d(n){n&&P(e),t&&t.d(n)}}}function _x(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 vy extends oe{constructor(e){super(),se(this,e,_x,Sx,re,{show:2})}get show(){return this.$$.ctx[2]}}function Cx(i){let e,t,n,r,s,o,l,a,c,u,h,f,d,m,p,g,b,w,S,_,k,Q,x,C,M,$;t=new Ma({props:{message:i[2]}});let N={};return r=new vy({props:N}),i[8](r),l=new Ci({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"),b=y("input"),w=D(),V(S.$$.fragment),_=D(),k=y("div"),Q=y("a"),x=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(b,"type","email"),O(b,"class","form-control mb-3"),O(b,"placeholder","Email"),b.required=!0,O(g,"class","input-group mb-5"),O(Q,"class","list-group-item list-group-item-action"),O(Q,"href",i[5].lucentUrl+"/logout"),O(k,"class","list-group"),O(e,"class","wrapper-tiny")},m(B,J){A(B,e,J),Y(t,e,null),v(e,n),Y(r,e,null),v(e,s),v(e,o),Y(l,o,null),v(e,a),v(e,c),v(c,u),v(u,h),Ie(h,i[0]),v(u,f),Y(d,u,null),v(e,m),v(e,p),v(p,g),v(g,b),Ie(b,i[1]),v(g,w),Y(S,g,null),v(e,_),v(e,k),v(k,Q),v(Q,x),C=!0,M||($=[G(h,"input",i[9]),G(c,"submit",i[6]),G(b,"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]&&Ie(h,B[0]),J&2&&b.value!==B[1]&&Ie(b,B[1])},i(B){C||(T(t.$$.fragment,B),T(r.$$.fragment,B),T(l.$$.fragment,B),T(d.$$.fragment,B),T(S.$$.fragment,B),C=!0)},o(B){R(t.$$.fragment,B),R(r.$$.fragment,B),R(l.$$.fragment,B),R(d.$$.fragment,B),R(S.$$.fragment,B),C=!1},d(B){B&&P(e),z(t),i[8](null),z(r),z(l),z(d),z(S),M=!1,ut($)}}}function Px(i,e,t){const n=je("user"),r=je("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){Se[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 Ax extends oe{constructor(e){super(),se(this,e,Px,Cx,re,{})}}function xx(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=Cs(c,r[u]);return a!==void 0&&a&13&&(c=Cs(c,So(r,[a&8&&{channel:l[3]},a&1&&{title:l[0]},a&4&&_o(l[2])]))),{props:c}}return s&&(t=Fr(s,o(i))),{c(){e=y("div"),t&&V(t.$$.fragment)},m(l,a){A(l,e,a),t&&Y(t,e,null),n=!0},p(l,[a]){if(a&2&&s!==(s=l[4][l[1]])){if(t){me();const c=t;R(c.$$.fragment,1,0,()=>{z(c,1)}),pe()}s?(t=Fr(s,o(l,a)),V(t.$$.fragment),T(t.$$.fragment,1),Y(t,e,null)):t=null}else if(s){const c=a&13?So(r,[a&8&&{channel:l[3]},a&1&&{title:l[0]},a&4&&_o(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 Tx(i,e,t){const n={register:hx,login:gx,verify:vx,profile:Ax};let{title:r}=e,{view:s}=e,{user:o}=e,{data:l}=e,{channel:a}=e;return Tl("channel",a),Tl("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 Qx extends oe{constructor(e){super(),se(this,e,Tx,xx,re,{title:0,view:1,user:5,data:2,channel:3})}}const Mx=i=>({}),gg=i=>({});function Ex(i){let e;return{c(){e=W("Dropdown")},m(t,n){A(t,e,n)},d(t){t&&P(e)}}}function Rx(i){let e,t,n,r,s,o,l,a;const c=i[6].button,u=Gl(c,i,i[5],gg),h=u||Ex(),f=i[6].default,d=Gl(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){A(r,e,s),t||(n=G(e,"click",i[10]),t=!0)},p:U,d(r){r&&P(e),t=!1,n()}}}function kT(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){A(r,e,s),t||(n=G(e,"click",i[10]),t=!0)},p:U,d(r){r&&P(e),t=!1,n()}}}function Hg(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 gP({props:l}),Se.push(()=>He(e,"data",s)),Se.push(()=>He(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,nt(()=>t=!1)),!n&&c&2&&(n=!0,u.graph=a[1],nt(()=>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 Kg(i,e){let t,n,r,s=e[5]===e[24].group&&Hg(e);return{key:i,first:null,c(){t=De(),s&&s.c(),n=De(),this.first=t},m(o,l){A(o,t,l),s&&s.m(o,l),A(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=Hg(e),s.c(),T(s,1),s.m(n.parentNode,n)):s&&(me(),R(s,1,1,()=>{s=null}),pe())},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 ST(i){let e,t,n,r,s,o,l,a,c,u,h,f,d,m,p,g,b,w=[],S=new Map,_,k,Q;function x(X){i[11](X)}function C(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 wy({props:M}),Se.push(()=>He(n,"record",x)),Se.push(()=>He(n,"activeContentTab",C));function $(X,ee){if(X[3])return kT;if(X[6])return yT}let N=$(i),B=N&&N(i);a=new Dy({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 yy({props:te}),Se.push(()=>He(d,"active",J)),g=new gT({props:{record:i[0],schema:i[2]}});let ie=ue(i[8]);const le=X=>X[24].name;for(let X=0;X<ie.length;X+=1){let ee=Gg(i,ie,X),Te=le(ee);S.set(Te,w[X]=Kg(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),b=D();for(let X=0;X<w.length;X+=1)w[X].c();O(t,"class","tools-header"),O(f,"class","mt-4"),fe(f,"margin-bottom","150px"),fe(f,"position","relative"),O(e,"class","inline-edit record-edit")},m(X,ee){A(X,e,ee),v(e,t),Y(n,t,null),v(t,o),B&&B.m(t,null),v(e,l),Y(a,e,null),v(e,c),Y(u,e,null),v(e,h),v(e,f),Y(d,f,null),v(f,p),Y(g,f,null),v(f,b);for(let Te=0;Te<w.length;Te+=1)w[Te]&&w[Te].m(f,null);_=!0,k||(Q=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],nt(()=>r=!1)),!s&&ee&32&&(s=!0,Te.activeContentTab=X[5],nt(()=>s=!1)),n.$set(Te),N===(N=$(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 Ue={};ee&128&&(Ue.message=X[7]),u.$set(Ue);const ne={};ee&4&&(ne.schema=X[2]),ee&8&&(ne.isCreateMode=X[3]),!m&&ee&32&&(m=!0,ne.active=X[5],nt(()=>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=ue(X[8]),me(),w=di(w,ee,le,1,X,ie,S,f,mr,Kg,null,Gg),pe())},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,Q()}}}function _T(i,e,t){let n,r;const s=je("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,$)=>$.ui==="tab"?(p=$.name,M):(M[p]=[...M[p]??[],$.name],M),[]),Ti(()=>{g()});function g(){h={data:JSON.parse(JSON.stringify(a.data)),schema:a.schema,status:a.status,edges:JSON.parse(JSON.stringify(c.edges))}}cy(()=>{t(6,d=w())});function b(M){return d?M.returnValue="You have unsaved changes. Are you sure you want to exit?":(delete M.returnValue,"...")}function w(){return u?!1:!na(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($,N){var B;if(!d&&!u){$(null);return}if(!a){$(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]}),$(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)),$(null)})})}function _(M){a=M,t(0,a)}function k(M){f=M,t(5,f)}function Q(M){f=M,t(5,f)}function x(M){i.$$.not_e
Line truncated
|
||||||
|
Back`),r=D();for(let h=0;h<u.length;h+=1)u[h].c();s=De(),O(e,"class","dropdown-item button")},m(h,f){A(h,e,f),Y(t,e,null),v(e,n),A(h,r,f);for(let d=0;d<u.length;d+=1)u[d]&&u[d].m(h,f);A(h,s,f),o=!0,l||(a=G(e,"click",i[23]),l=!0)},p(h,f){if(f[0]&2560){c=ue(h[9]);let d;for(d=0;d<c.length;d+=1){const m=sO(h,c,d);u[d]?u[d].p(m,f):(u[d]=lO(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),mt(u,h),l=!1,a()}}}function lO(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){A(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 aO(i){let e,t,n,r,s,o,l=i[3].label+"",a,c,u,h,f,d;t=new Ot({props:{icon:"arrow-left"}});let m=ue(i[7]),p=[];for(let g=0;g<m.length;g+=1)p[g]=cO(rO(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=De(),O(e,"class","dropdown-item button"),O(s,"class","selected-filter")},m(g,b){A(g,e,b),Y(t,e,null),v(e,n),A(g,r,b),A(g,s,b),v(s,o),v(s,a),A(g,c,b);for(let w=0;w<p.length;w+=1)p[w]&&p[w].m(g,b);A(g,u,b),h=!0,f||(d=G(e,"click",i[25]),f=!0)},p(g,b){if((!h||b[0]&8)&&l!==(l=g[3].label+"")&&K(a,l),b[0]&8320){m=ue(g[7]);let w;for(w=0;w<m.length;w+=1){const S=rO(g,m,w);p[w]?p[w].p(S,b):(p[w]=cO(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),mt(p,g),f=!1,d()}}}function cO(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){A(a,e,c),v(e,n),v(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 uO(i){let e,t,n,r,s,o,l=i[3].label+"",a,c,u=i[5].label+"",h,f,d,m,p,g,b,w,S;return t=new Ot({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){A(_,e,k),Y(t,e,null),v(e,n),A(_,r,k),A(_,s,k),v(s,o),v(s,a),v(s,c),v(s,h),A(_,f,k),A(_,d,k),v(d,m),Ie(m,i[2]),A(_,p,k),A(_,g,k),b=!0,w||(S=[G(e,"click",i[27]),G(m,"input",i[28]),G(g,"click",i[14])],w=!0)},p(_,k){(!b||k[0]&8)&&l!==(l=_[3].label+"")&&K(a,l),(!b||k[0]&32)&&u!==(u=_[5].label+"")&&K(h,u),k[0]&4&&m.value!==_[2]&&Ie(m,_[2])},i(_){b||(T(t.$$.fragment,_),b=!0)},o(_){R(t.$$.fragment,_),b=!1},d(_){_&&(P(e),P(r),P(s),P(f),P(d),P(p),P(g)),z(t),w=!1,ut(S)}}}function hO(i){let e,t,n,r,s,o,l,a;t=new Ot({props:{icon:"arrow-left"}});let c=ue(i[10]),u=[];for(let h=0;h<c.length;h+=1)u[h]=fO(iO(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=De(),O(e,"class","dropdown-item button")},m(h,f){A(h,e,f),Y(t,e,null),v(e,n),A(h,r,f);for(let d=0;d<u.length;d+=1)u[d]&&u[d].m(h,f);A(h,s,f),o=!0,l||(a=G(e,"click",i[29]),l=!0)},p(h,f){if(f[0]&5120){c=ue(h[10]);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]=fO(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),mt(u,h),l=!1,a()}}}function fO(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){A(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 dO(i){let e,t,n,r,s,o,l=i[4].label+"",a,c,u,h,f,d,m,p;t=new Ot({props:{icon:"arrow-left"}});function g(w){i[32](w)}let b={field:i[4]};return i[2]!==void 0&&(b.value=i[2]),h=new xT({props:b}),Se.push(()=>He(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){A(w,e,S),Y(t,e,null),v(e,n),A(w,r,S),A(w,s,S),v(s,o),v(s,a),A(w,c,S),A(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],nt(()=>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 TT(i){let e,t,n,r,s,o,l,a,c,u,h,f,d,m,p,g,b,w,S,_,k,Q,x,C,M,$,N=!i[3]&&oO(i),B=i[3]&&!i[5]&&aO(i),J=i[3]&&i[5]&&uO(i),te=!i[4]&&hO(i),ie=i[4]&&dO(i);return b=new Ot({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(b.$$.fragment),w=W(`
|
||||||
|
Back`),S=D(),_=y("form"),k=y("input"),Q=D(),x=y("button"),x.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(x,"class","button applied-filter"),Ae(p,"hide",i[6]!=="advanced")},m(le,X){A(le,e,X),v(e,t),v(e,n),v(e,r),v(e,s),v(e,o),A(le,l,X),A(le,a,X),N&&N.m(a,null),v(a,c),B&&B.m(a,null),v(a,u),J&&J.m(a,null),A(le,h,X),A(le,f,X),te&&te.m(f,null),v(f,d),ie&&ie.m(f,null),A(le,m,X),A(le,p,X),v(p,g),Y(b,g,null),v(g,w),v(p,S),v(p,_),v(_,k),Ie(k,i[1]),v(_,Q),v(_,x),C=!0,M||($=[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(le,X){(!C||X[0]&64)&&Ae(e,"hide",le[6]!=="main"),le[3]?N&&(me(),R(N,1,1,()=>{N=null}),pe()):N?(N.p(le,X),X[0]&8&&T(N,1)):(N=oO(le),N.c(),T(N,1),N.m(a,c)),le[3]&&!le[5]?B?(B.p(le,X),X[0]&40&&T(B,1)):(B=aO(le),B.c(),T(B,1),B.m(a,u)):B&&(me(),R(B,1,1,()=>{B=null}),pe()),le[3]&&le[5]?J?(J.p(le,X),X[0]&40&&T(J,1)):(J=uO(le),J.c(),T(J,1),J.m(a,null)):J&&(me(),R(J,1,1,()=>{J=null}),pe()),(!C||X[0]&64)&&Ae(a,"hide",le[6]!=="byField"),le[4]?te&&(me(),R(te,1,1,()=>{te=null}),pe()):te?(te.p(le,X),X[0]&16&&T(te,1)):(te=hO(le),te.c(),T(te,1),te.m(f,d)),le[4]?ie?(ie.p(le,X),X[0]&16&&T(ie,1)):(ie=dO(le),ie.c(),T(ie,1),ie.m(f,null)):ie&&(me(),R(ie,1,1,()=>{ie=null}),pe()),(!C||X[0]&64)&&Ae(f,"hide",le[6]!=="byReference"),X[0]&2&&k.value!==le[1]&&Ie(k,le[1]),(!C||X[0]&64)&&Ae(p,"hide",le[6]!=="advanced")},i(le){C||(T(N),T(B),T(J),T(te),T(ie),T(b.$$.fragment,le),C=!0)},o(le){R(N),R(B),R(J),R(te),R(ie),R(b.$$.fragment,le),C=!1},d(le){le&&(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(b),M=!1,ut($)}}}function QT(i){let e,t,n,r,s;return t=new Ot({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){A(o,e,l),Y(t,e,null),v(e,n),v(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 MT(i){let e,t,n,r={$$slots:{button:[QT],default:[TT]},$$scope:{ctx:i}};return t=new Gi({props:r}),i[35](t),{c(){e=y("div"),V(t.$$.fragment)},m(s,o){A(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 ET(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,b="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 Q(H,Pe){t(4,p=Pe),t(5,g=o.find(Ye=>Ye.name==="eq"))}function x(H,Pe){t(5,g=Pe),Pe.hasValue||C(H)}function C(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,b="main"),t(4,p=null)}const $=H=>t(6,b="byField"),N=H=>t(6,b="byReference"),B=H=>t(6,b="advanced"),J=H=>t(6,b="main"),te=(H,Pe)=>k(Pe,H),ie=H=>t(3,m=null),le=(H,Pe)=>x(Pe,H),X=H=>t(5,g=null);function ee(){d=this.value,t(2,d)}const Te=H=>t(6,b="main"),ve=(H,Pe)=>Q(Pe,H),Ue=H=>t(4,p=null);function ne(H){d=H,t(2,d)}const Ee=H=>t(6,b="main");function Re(){u=this.value,t(1,u)}function xt(H){Se[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,b,w,f,S,_,k,Q,x,C,r,s,o,l,a,$,N,B,J,te,ie,le,X,ee,Te,ve,Ue,ne,Ee,Re,xt]}class RT extends oe{constructor(e){super(),se(this,e,ET,MT,re,{schema:15,systemFields:16,operators:17,inModal:18,modalUrl:19},null,[-1,-1])}}function mO(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){A(a,e,c),v(e,t),v(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 qT(i){let e=i[0].searchParams.get("notlinked"),t,n,r=e&&jT(i);return{c(){r&&r.c(),t=De()},m(s,o){r&&r.m(s,o),A(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 GT(i,e,t){je("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 HT extends oe{constructor(e){super(),se(this,e,GT,qT,re,{inModal:2,modalUrl:3})}}function bO(i,e,t){const n=i.slice();return n[21]=e[t][0],n[22]=e[t][1],n}function vO(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){A(r,e,s),v(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 wO(i){let e,t;return e=new Gi({props:{orientation:"right",$$slots:{button:[tQ],default:[eQ]},$$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 KT(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){A(h,e,f),v(e,t),A(h,n,f),A(h,r,f),v(r,s),A(h,l,f),A(h,a,f),v(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 JT(i){let e,t=i[7]&&yO(i);return{c(){t&&t.c(),e=De()},m(n,r){t&&t.m(n,r),A(n,e,r)},p(n,r){n[7]?t?t.p(n,r):(t=yO(n),t.c(),t.m(e.parentNode,e)):t&&(t.d(1),t=null)},d(n){n&&P(e),t&&t.d(n)}}}function yO(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){A(r,e,s),v(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 eQ(i){let e;function t(s,o){return s[4].status_in==="trashed"?JT:KT}let n=t(i),r=n(i);return{c(){r.c(),e=De()},m(s,o){r.m(s,o),A(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 tQ(i){let e,t,n;return t=new Ot({props:{icon:"ellipsis-vertical"}}),{c(){e=y("div"),V(t.$$.fragment),O(e,"slot","button")},m(r,s){A(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 kO(i){let e,t,n=ue(Object.entries(i[4])),r=[];for(let o=0;o<n.length;o+=1)r[o]=SO(bO(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=De()},m(o,l){for(let a=0;a<r.length;a+=1)r[a]&&r[a].m(o,l);A(o,e,l),t=!0},p(o,l){if(l&377){n=ue(Object.entries(o[4]));let a;for(a=0;a<n.length;a+=1){const c=bO(o,n,a);r[a]?(r[a].p(c,l),T(r[a],1)):(r[a]=SO(c),r[a].c(),T(r[a],1),r[a].m(e.parentNode,e))}for(me(),a=n.length;a<r.length;a+=1)s(a);pe()}},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),mt(r,o)}}}function SO(i){let e,t;return e=new UT({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 nQ(i){let e,t,n,r,s,o,l,a,c,u,h,f,d,m,p,g=Object.entries(i[4]).length>0,b,w,S;n=new BT({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 RT({props:k}),Se.push(()=>He(s,"schema",_)),s.$on("refresh",i[16]);let Q=!i[5]&&i[7]&&vO(i),x=!i[5]&&wO(i);m=new HT({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"),fe(r,"display","flex"),fe(r,"justify-content","center"),fe(r,"gap","4px")},m(S,_){A(S,e,_),v(e,t),w&&w.m(t,null),A(S,n,_),A(S,r,_),v(r,s),v(r,o),v(o,a),v(r,c),v(r,u),v(u,f),v(r,d),v(r,m),v(m,p),v(r,g),b=!0},p(S,[_]){S[5]>1?w?(w.p(S,_),_&32&&T(w,1)):(w=PO(S),w.c(),T(w,1),w.m(t,null)):w&&(me(),R(w,1,1,()=>{w=null}),pe()),(!b||_&8)&&l!==(l=+S[3]+1+"")&&K(a,l),(!b||_&28)&&h!==(h=(+S[3]+S[2]>S[4]?S[4]:+S[3]+S[2])+"")&&K(f,h),(!b||_&16)&&K(p,S[4])},i(S){b||(T(w),b=!0)},o(S){R(w),b=!1},d(S){S&&(P(e),P(n),P(r)),w&&w.d()}}}function hQ(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=(b,w,S=1)=>Array.from({length:Math.ceil((w-b)/S)},(_,k)=>b+k*S);function d(b){b.preventDefault(),p(n)}function m(b){b.preventDefault(),p(1)}function p(b){const w=new URL(a??window.location.href);let S=b*c-c;w.searchParams.set("skip",S),l?o("refresh",w):window.location=w}function g(b){Lr.call(this,i,b)}return i.$$set=b=>{"inModal"in b&&t(0,l=b.inModal),"modalUrl"in b&&t(1,a=b.modalUrl),"limit"in b&&t(2,c=b.limit),"skip"in b&&t(3,u=b.skip),"total"in b&&t(4,h=b.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(b=>b>0&&b<=n))},[l,a,c,u,h,n,r,s,d,m,g]}class fQ extends oe{constructor(e){super(),se(this,e,hQ,uQ,re,{inModal:0,modalUrl:1,limit:2,skip:3,total:4})}}function dQ(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){A(r,e,s),t||(n=G(e,"click",Ln(i[9])),t=!0)},p:U,d(r){r&&P(e),t=!1,n()}}}function mQ(i){let e,t,n,r,s,o,l=i[1].hasDrafts&&AO(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){A(a,e,c),A(a,t,c),l&&l.m(a,c),A(a,n,c),A(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=AO(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,ut(o)}}}function AO(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){A(r,e,s),t||(n=G(e,"click",Ln(i[8])),t=!0)},p:U,d(r){r&&P(e),t=!1,n()}}}function pQ(i){let e,t,n=i[0].length+"",r,s,o,l,a,c,u,h,f;function d(g,b){return g[2].status_in==="trashed"?mQ:dQ}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"),fe(e,"display","flex"),fe(e,"align-items","center"),fe(e,"gap","8px")},m(g,b){A(g,e,b),v(e,t),v(t,r),v(t,s),v(e,o),v(e,l),v(e,a),v(e,c),v(e,u),p.m(e,null),h||(f=[G(l,"click",Ln(i[5])),G(c,"click",Ln(i[6]))],h=!0)},p(g,[b]){b&1&&n!==(n=g[0].length+"")&&K(r,n),m===(m=d(g))&&p?p.p(g,b):(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,ut(f)}}}function gQ(i,e,t){const n=je("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 OQ extends oe{constructor(e){super(),se(this,e,gQ,pQ,re,{selected:0,schema:1,filter:2})}}function bQ(i){let e;return{c(){e=W(i[0])},m(t,n){A(t,e,n)},p(t,[n]){n&1&&K(e,t[0])},i:U,o:U,d(t){t&&P(e)}}}function vQ(i,e,t){let{value:n}=e;return i.$$set=r=>{"value"in r&&t(0,n=r.value)},[n]}let wQ=class extends oe{constructor(e){super(),se(this,e,vQ,bQ,re,{value:0})}};function xO(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"),fe(t,"background",i[0]),O(e,"class","d-inline-flex")},m(s,o){A(s,e,o),v(e,t),v(e,n),v(e,r)},p(s,o){o&1&&fe(t,"background",s[0]),o&1&&K(r,s[0])},d(s){s&&P(e)}}}function yQ(i){let e,t=i[0]&&xO(i);return{c(){t&&t.c(),e=De()},m(n,r){t&&t.m(n,r),A(n,e,r)},p(n,[r]){n[0]?t?t.p(n,r):(t=xO(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 kQ(i,e,t){let{value:n}=e;return i.$$set=r=>{"value"in r&&t(0,n=r.value)},[n]}let SQ=class extends oe{constructor(e){super(),se(this,e,kQ,yQ,re,{value:0})}};function TO(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 i1(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?i1(Object(t),!0).forEach(function(n){DM(i,n,t[n])}):Object.getOwnPropertyDescriptors?Object.defineProperties(i,Object.getOwnPropertyDescriptors(t)):i1(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 DM(i,e,t){return e in i?Object.defineProperty(i,e,{value:t,enumerable:!0,configurable:!0,writable:!0}):i[e]=t,i}function hr(){return hr=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},hr.apply(this,arguments)}function $M(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 LM(i,e){if(i==null)return{};var t=$M(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 IM="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),r1=lr(/firefox/i),Ql=lr(/safari/i)&&!lr(/chrome/i)&&!lr(/android/i),Zy=lr(/iP(ad|od|hone)/i),By=lr(/chrome/i)&&lr(/android/i),Wy={capture:!1,passive:!1};function dt(i,e,t){i.addEventListener(e,t,!pr&&Wy)}function lt(i,e,t){i.removeEventListener(e,t,!pr&&Wy)}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 NM(i){return i.host&&i!==document&&i.host.nodeType?i.host:i.parentNode}function Si(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=NM(i))}return null}var s1=/\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(s1," ").replace(" "+e+" "," ");i.className=(n+(t?" "+e:"")).replace(s1," ")}}function $e(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 ao(i,e){var t="";if(typeof i=="string")t=i;else do{var n=$e(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 Xy(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&&($e(r,"transform")!=="none"||t&&$e(r,"position")!=="static")){var f=r.getBoundingClientRect();o-=f.top+parseInt($e(r,"border-top-width")),l-=f.left+parseInt($e(r,"border-left-width")),a=o+s.height,c=l+s.width;break}while(r=r.parentNode);if(n&&i!==window){var d=ao(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 o1(i,e,t){for(var n=Ir(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=Ir(n,!1)}return!1}function Co(i,e,t,n){for(var r=0,s=0,o=i.children;s<o.length;){if(o[s].style.display!=="none"&&o[s]!==Le.ghost&&(n||o[s]!==Le.dragged)&&Si(o[s],t.draggable,i,!1)){if(r===e)return o[s];r++}s++}return null}function Vm(i,e){for(var t=i.lastElementChild;t&&(t===Le.ghost||$e(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!==Le.clone&&(!e||du(i,e))&&t++;return t}function l1(i){var e=0,t=0,n=Ui();if(i)do{var r=ao(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'>
|
||||||
|
`+L.join("</span><span class='flatpickr-weekday'>")+`
|
||||||
|
</span>
|
||||||
|
`}}function ve(){t.calendarContainer.classList.add("hasWeeks");var E=ft("div","flatpickr-weekwrapper");E.appendChild(ft("span","flatpickr-weekday",t.l10n.weekAbbreviation));var L=ft("div","flatpickr-weeks");return E.appendChild(L),{weekWrapper:E,weekNumbers:L}}function Ue(E,L){L===void 0&&(L=!0);var F=L?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,L){if(E===void 0&&(E=!0),L===void 0&&(L=!0),t.input.value="",t.altInput!==void 0&&(t.altInput.value=""),t.mobileInput!==void 0&&(t.mobileInput.value=""),t.selectedDates=[],t.latestSelectedDateObj=void 0,L===!0&&(t.currentYear=t._initialDate.getFullYear(),t.currentMonth=t._initialDate.getMonth()),t.config.enableTime===!0){var F=qh(t.config),j=F.hours,ae=F.minutes,be=F.seconds;d(j,ae,be)}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 L=t.calendarContainer.parentNode;if(L.lastChild&&L.removeChild(L.lastChild),L.parentNode){for(;L.firstChild;)L.parentNode.insertBefore(L.firstChild,L);L.parentNode.removeChild(L)}}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 L=Zn(E),F=xt(L),j=L===t.input||L===t.altInput||t.element.contains(L)||E.path&&E.path.indexOf&&(~E.path.indexOf(t.input)||~E.path.indexOf(t.altInput)),ae=!j&&!F&&!xt(E.relatedTarget),be=!t.config.ignoredFocusElements.some(function(We){return We.contains(L)});ae&&be&&(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 L=E,F=t.currentYear!==L;t.currentYear=L||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,L){var F;L===void 0&&(L=!0);var j=t.parseDate(E,void 0,L);if(t.config.minDate&&j&&Yn(j,t.config.minDate,L!==void 0?L:!t.minDateHasTime)<0||t.config.maxDate&&j&&Yn(j,t.config.maxDate,L!==void 0?L:!t.maxDateHasTime)>0)return!1;if(!t.config.enable&&t.config.disable.length===0)return!0;if(j===void 0)return!1;for(var ae=!!t.config.enable,be=(F=t.config.enable)!==null&&F!==void 0?F:t.config.disable,We=0,we=void 0;We<be.length;We++){if(we=be[We],typeof we=="function"&&we(j))return ae;if(we instanceof Date&&j!==void 0&&we.getTime()===j.getTime())return ae;if(typeof we=="string"){var Ne=t.parseDate(we,void 0,!0);return Ne&&Ne.getTime()===j.getTime()?ae:!ae}else if(typeof we=="object"&&j!==void 0&&we.from&&we.to&&j.getTime()>=we.from.getTime()&&j.getTime()<=we.to.getTime())return ae}return!ae}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 L=E.target===t._input,F=t._input.value.trimEnd()!==yr();L&&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 L=Zn(E),F=t.config.
Line truncated
|
||||||
|
Upload file
|
||||||
|
|
||||||
|
`),s=y("input"),O(n,"class","spinner-border spinner-border-sm"),O(n,"role","status"),O(n,"aria-hidden","true"),O(s,"class","form-control"),O(s,"type","file"),O(s,"id","formFile"),s.multiple=!0,O(s,"accept",JE),s.disabled=i[0],s.hidden=!0,O(t,"class","button primary btn-spinner"),O(e,"class","upload-button"),e.disabled=i[0]},m(a,c){A(a,e,c),v(e,t),v(t,n),v(t,r),v(t,s),o||(l=G(s,"input",i[1]),o=!0)},p(a,[c]){c&1&&(s.disabled=a[0]),c&1&&(e.disabled=a[0])},i:U,o:U,d(a){a&&P(e),o=!1,l()}}}let JE="";function eR(i,e,t){const n=nn(),r=je("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 tR extends oe{constructor(e){super(),se(this,e,eR,KE,re,{recordId:2})}}function N1(i,e,t){const n=i.slice();return n[10]=e[t],n}function Z1(i){let e,t;return e=new Jy({props:{sortableClass:"mt-3",$$slots:{default:[nR]},$$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&8193&&(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 B1(i,e){let t,n,r,s;return n=new qm({props:{file:e[10],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){A(o,t,l),Y(n,t,null),v(t,r),s=!0},p(o,l){e=o;const a={};l&1&&(a.file=e[10]),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 nR(i){let e=[],t=new Map,n,r,s=ue(i[0]??[]);const o=l=>l[10].id;for(let l=0;l<s.length;l+=1){let a=N1(i,s,l),c=o(a);t.set(c,e[l]=B1(c,a))}return{c(){for(let l=0;l<e.length;l+=1)e[l].c();n=De()},m(l,a){for(let c=0;c<e.length;c+=1)e[c]&&e[c].m(l,a);A(l,n,a),r=!0},p(l,a){a&9&&(s=ue(l[0]??[]),me(),e=di(e,a,o,1,l,s,t,n.parentNode,mr,B1,n,N1),pe())},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 iR(i){let e,t,n,r,s,o,l,a,c,u,h;s=new tR({props:{recordId:i[1].id}}),s.$on("uploadComplete",rR);let f=i[0].length>0&&Z1(i),d={};return a=new HE({props:d}),i[9](a),a.$on("insert_files",i[5]),a.$on("replace_files",i[6]),{c(){e=y("div"),t=y("button"),t.textContent="Browse",n=D(),r=y("div"),V(s.$$.fragment),o=D(),f&&f.c(),l=D(),V(a.$$.fragment),O(t,"class","button"),O(e,"class","mb-0")},m(m,p){A(m,e,p),v(e,t),v(e,n),v(e,r),Y(s,r,null),A(m,o,p),f&&f.m(m,p),A(m,l,p),Y(a,m,p),c=!0,u||(h=G(t,"click",i[7]),u=!0)},p(m,[p]){const g={};p&2&&(g.recordId=m[1].id),s.$set(g),m[0].length>0?f?(f.p(m,p),p&1&&T(f,1)):(f=Z1(m),f.c(),T(f,1),f.m(l.parentNode,l)):f&&(me(),R(f,1,1,()=>{f=null}),pe());const b={};a.$set(b)},i(m){c||(T(s.$$.fragment,m),T(f),T(a.$$.fragment,m),c=!0)},o(m){R(s.$$.fragment,m),R(f),R(a.$$.fragment,m),c=!1},d(m){m&&(P(e),P(o),P(l)),z(s),f&&f.d(m),i[9](null),z(a,m),u=!1,h()}}}function rR(i){}function sR(i,e,t){let{field:n}=e,{record:r}=e,{value:s=[]}=e,o;function l(d){d.preventDefault(),t(0,s=s.filter(m=>m.id!==d.detail))}async function a(d){t(0,s=await Ry(s,d.detail.source,d.detail.target))}function c(d){d.preventDefault(),o.close(),t(0,s=[...s??[],...d.detail??[]])}function u(d){d.preventDefault(),o.close(),t(0,s=d.detail??[])}function h(d){d.preventDefault(),o.open(r.id)}function f(d){Se[d?"unshift":"push"](()=>{o=d,t(2,o)})}return i.$$set=d=>{"field"in d&&t(8,n=d.field),"record"in d&&t(1,r=d.record),"value"in d&&t(0,s=d.value)},[s,r,o,l,a,c,u,h,n,f]}class oR extends oe{constructor(e){super(),se(this,e,sR,iR,re,{field:8,record:1,value:0})}}function W1(i){let e,t;return{c(){e=y("div"),t=W(i[5]),O(e,"class","invalid-feedback d-block")},m(n,r){A(n,e,r),v(e,t)},p(n,r){r&32&&K(t,n[5])},d(n){n&&P(e)}}}function lR(i){let e,t,n,r,s,o,l=i[5]&&W1(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){A(a,e,c),v(e,t),Ie(t,i[0]),i[8](t),v(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&&Ie(t,a[0]),c&32&&Ae(t,"is-invalid",a[5]),a[5]?l?l.p(a,c):(l=W1(a),l.c(),l.m(e,null)):l&&(l.d(1),l=null)},i:U,o:U,d(a){a&&P(e),i[8](null),l&&l.d(),s=!1,ut(o)}}}function kd(i){let e;i.target?e=i.target:e=i,e.style.overflow="hidden",e.style.height="1px",e.style.height=+e.scrollHeight+"px"}function aR(i,e,t){let n,{field:r}=e,{value:s}=e,{isCreateMode:o}=e,{validationErrors:l}=e,a,{id:c}=e;Ti(()=>{kd(a)});function u
Line truncated
|
||||||
|
`},As={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(Ss,")"),t=i.closest(e);if(t)return t.getAttribute("href")}},strike:{tagName:"del",inheritable:!0},frozen:{style:{backgroundColor:"highlight"}}},hk={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:Gm,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:sk,fileSize:ok,input:Jm,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:As,toolbar:hk,undo:Sd});class Kt{static proxyMethod(e){const{name:t,toMethod:n,toProperty:r,optional:s}=kR(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?G1.call(o,l,arguments):void 0):(o=l[t],G1.call(o,l,arguments))}}}const kR=function(i){const e=i.match(SR);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:G1}=Function.prototype,SR=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 _R=((ef=Array.from)===null||ef===void 0?void 0:ef.call(Array,"👼").length)===1,CR=((tf=" ".codePointAt)===null||tf===void 0?void 0:tf.call(" ",0))!=null,PR=((nf=String.fromCodePoint)===null||nf===void 0?void 0:nf.call(String,32,128124))===" 👼";let _d,Cd;_d=_R&&CR?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=PR?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 AR=0;class Is extends Kt{static fromJSONString(e){return this.fromJSON(JSON.parse(e))}constructor(){super(...arguments),this.id=++AR}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 xs=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},ep=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},xR=/[\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]/,TR=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 xR.test(o)?"rtl":"ltr"}}();let rf=null,sf=null,of=null,rc=null;const Pd=()=>(rf||(rf=MR().concat(QR())),rLine truncated
|
||||||
|
`+Sr),Ke&&sc([J,te,ie],vi=>{Sr=sl(Sr,vi," ")}),k&&Ri?k.createHTML(Sr):Sr},t.setConfig=function(){ae(arguments.length>0&&arguments[0]!==void 0?arguments[0]:{}),qe=!0},t.clearConfig=function(){L=null,qe=!1},t.isValidAttribute=function(Z,Ce,ge){L||ae({});const Je=E(Z),ot=E(Ce);return tr(Je,ot,ge)},t.addHook=function(Z,Ce){typeof Ce=="function"&&rl(B[Z],Ce)},t.removeHook=function(Z,Ce){if(Ce!==void 0){const ge=YR(B[Z],Ce);return ge===-1?void 0:zR(B[Z],ge,1)[0]}return r0(B[Z])},t.removeHooks=function(Z){B[Z]=[]},t.removeAllHooks=function(){B={afterSanitizeAttributes:[],afterSanitizeElements:[],afterSanitizeShadowDOM:[],beforeSanitizeAttributes:[],beforeSanitizeElements:[],beforeSanitizeShadowDOM:[],uponSanitizeAttribute:[],uponSanitizeElement:[],uponSanitizeShadowNode:[]}},t}();Po.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 h4="style href src width height language class".split(" "),f4="javascript:".split(" "),d4="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||h4,this.forbiddenProtocols=n||f4,this.forbiddenElements=r||d4,this.purifyOptions=s||{},this.body=m4(e)}sanitize(){this.sanitizeElements(),this.normalizeListElementNesting();const e=Object.assign({},sk,this.purifyOptions);return Po.setConfig(e),this.body=Po.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=>Vr(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"&&!_s(e)}}const m4=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 sp extends Ns{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)),[h0("left"),t,h0("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 Ck extends Ns{constructor(){super(...arguments),this.text=this.object,this.textConfig=this.options.textConfig}createNodes(){const e=[],t=rp.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),g4(r)&&(l.followsWhitespace=!0);const a=this.findOrCreateCachedChildView(_k,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 g4=i=>/\s$/.test(i==null?void 0:i.toString()),{css:f0}=$a;class Pk extends Ns{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(Ck,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(f0.attachmentGallery," ").concat(f0.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 Ns{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 ZR,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=rp.groupObjects(this.document.getBlocks(),{asTree:!0});Array.from(e).forEach(t=>{const n=this.findOrCreateCachedChildView(Pk,t);Array.from(n.getNodes()).map(r=>this.shadowElement.appendChild(r))})}}isSynced(){return O4(this.shadowElement,this.element)}sync(){const e=ak("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(d0(this.element)),tp(()=>this.garbageCollectCachedViews())}createDocumentFragmentForSync(){const e=document.createDocumentFragment();return Array.from(this.shadowElement.childNodes).forEach(t=>{e.appendChild(t.cloneNode(!0))}),Array.from(d0(e)).forEach(t=>{const n=this.elementStore.remove(t);n&&t.parentNode.replaceChild(n,t)}),e}}const d0=i=>i.querySelectorAll("[data-trix-store-key]"),O4=(i,e)=>m0(i.innerHTML)===m0(e.innerHTML),m0=i=>i.replace(/ /g," ");function b4(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=b4(e))in i?Object.defineProperty(i,e,{value:t,enumerable:!0,configurable:!0,writable:!0}):i[e]=t,i}function rt(i,e){return v4(i,Ak(i,e,"get"))}function Bl(i,e,t){return w4(i,Ak(i,e,"set"),t),t}function Ak(i,e,t){if(!e.has(i))throw new TypeError("attempted to "+t+" private field on non-instance");return e.get(i)}function v4(i,e){return e.get?e.get.call(i):e.value}function w4(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())}}Zs.registerType("string",op);class ku extends Is{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(ep(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(k4(e));return[n,t]=new this.constructor(n).splitObjectAtPosition(S4(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)||y4(this.objects,e==null?void 0:e.objects)}contentsForInspection(){return{objects:"[".concat(this.objects.map(e=>e.inspect()).join(", "),"]")}}}const y4=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},k4=i=>i[0],S4=i=>i[1];class _i extends Is{static textForAttachmentWithAttributes(e,t){return new this([new Ao(e,t)])}static textForStringWithAttributes(e,t){return new this([new op(e,t)])}static fromJSON(e){return new this(Array.from(e).map(t=>Zs.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=_i.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 Qk(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 _4=function(i){return i=C4(i),i=A4(i)},C4=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,x4(s)):s),e?new _i([...n,r]):i):i},P4=_i.textForStringWithAttributes(`
|
||||||
|
`,{blockBreak:!0}),A4=function(i){return Qk(i)?i:i.appendText(P4)},Qk=function(i){const e=i.getLength();return e===0?!1:i.getTextAtRange([e-1,e]).isBlockBreak()},x4=i=>i.copyWithoutAttribute("blockBreak"),p0=function(i){const{listAttribute:e}=zt(i);return e?[e,i]:[i]},g0=i=>i.slice(-1)[0],O0=function(i,e){const t=i.lastIndexOf(e);return t===-1?i:ep(i,t,1)};class si extends Is{static fromJSON(e){return new this(Array.from(e).map(t=>Xi.fromJSON(t)))}static fromString(e,t){const n=_i.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 NR(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(xs(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(xs(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 b=u+1-l;t=this.blockList.splice(l,b,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(b0(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=b0(o),a=o.text.getAttributesAtPosition(s),c=o.text.getAttributesAtPosition(s-1),u=Object.keys(As).filter(h=>As[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);xs(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=vs(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&&xs(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 w0(e.parentNode)||(t=ip(t),Mk((n=e.previousSibling)===null||n===void 0?void 0:n.textContent)&&(t=M4(t))),this.appendStringWithAttributes(t,this.getTextAttributes(e.parentNode))}processElement(e){let t;if(_s(e)){if(t=v0(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 As){const s=As[r];if(s.tagName&&zr(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(_s(e)){const r=v0(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);Il().includes(n)&&t.push(e),e=e.parentNode}return t}isBlockElement(e){if((e==null?void 0:e.nodeType)===Node.ELEMENT_NODE&&!_s(e)&&!zr(e,{matchingSelector:"td",untilNode:this.containerElement}))return Il().includes(kn(e))||window.getComputedStyle(e).display==="block"}isInsignificantTextNode(e){if((e==null?void 0:e.nodeType)!==Node.TEXT_NODE||!E4(e.data))return;const{parentNode:t,previousSibling:n,nextSibling:r}=e;return T4(t.previousSibling)&&!this.isBlockElement(t.previousSibling)||w0(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&&!Il().includes(kn(t))&&!this.processedElements.includes(t))return y0(t)}getMarginOfDefaultBlockElement(){const e=Ge(Sn.default.tagName);return this.containerElement.appendChild(e),y0(e)}}const w0=function(i){const{whiteSpace:e}=window.getComputedStyle(i);return["pre","pre-wrap","pre-line"].includes(e)},T4=i=>i&&!Mk(i.textContent),y0=function(i){const e=window.getComputedStyle(i);if(e.display==="block")return{top:parseInt(e.marginTop),bottom:parseInt(e.marginBottom)}},Q4=function(i){return kn(i)==="style"?NodeFilter.FILTER_REJECT:NodeFilter.FILTER_ACCEPT},M4=i=>i.replace(new RegExp("^".concat(np.source,"+")),""),E4=i=>new RegExp("^".concat(np.source,"*$")).test(i),Mk=i=>/\s$/.test(i),R4=["contenteditable","data-trix-id","data-trix-store-key","data-trix-mutable","data-trix-placeholder","tabindex"],Md="data-trix-serialized-attributes",D4="[".concat(Md,"]"),$4=new RegExp("<!--block-->","g"),L4={"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=>{Vr(t)}),R4.forEach(t=>{Array.from(e.querySelectorAll("[".concat(t,"]"))).forEach(n=>{n.removeAttribute(t)})}),Array.from(e.querySelectorAll(D4)).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($4,"")}};var I4=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 Ek 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 Rk{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=_i.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 Rk(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=Fo.attachmentForFile(n);t.push(s)}}),this.insertAttachments(t)}insertAttachment(e){return this.insertAttachments([e])}insertAttachments(e){let t=new _i;return Array.from(e).forEach(n=>{var r;const s=n.getType(),o=(r=Gm[s])===null||r===void 0?void 0:r.presentation,l=this.getCurrentTextAttributes();o&&(l.presentation=o);const a=_i.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=_i.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||!N4(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 N4=(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 Dk{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 $k=function(i){const e=new Dk(i);return e.perform(),e.getSnapshot()},Z4=[$k];class Lk{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=Z4.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 Ik{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:Nk});for(;a.nextNode();){const c=a.currentNode;if(c===e&&Nl(e)){fo(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(!vs(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(Nl(r))gf(r)===0?(t=r.parentNode.parentNode,n=Hh(r.parentNode),fo(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(Nl(s)){if(t=s,n=r,e.offset===n&&fo(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(yl),o=t.filter((l,a)=>l!==e[a]).map(yl);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]=t0(l,a):[c,u]=t0(a,l),{added:c,removed:u}}(yl(r.oldValue),yl(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 Vk 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 V4{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()&&U4(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 U4=(i,e)=>k0(i)===k0(e),j4=new RegExp("(".concat("","|").concat(oh,"|").concat(Rr,"|\\s)+"),"g"),k0=i=>i.replace(j4," ").trim();class ch extends Kt{constructor(e){super(...arguments),this.element=e,this.mutationObserver=new zk(this.element),this.mutationObserver.delegate=this,this.flakyKeyboardDetector=new V4(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 Vk(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(!Km(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:q4,keyNames:Uk}=$a;let G4=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(),Ts.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 K1){const o=K1[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 Vr(r),this.setSelectedRange(t),e(s)})}}gn(ir,"events",{keydown(i){this.isComposing()||this.resetInputSummary(),this.inputSummary.didInput=!0;const e=Uk[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}),Ts.reset(),r[e].call(this,i))}if(mk(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=J4(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(!Xo(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 H4=i=>{var e;return(e=i.type)===null||e===void 0||(e=e.match(/\/(\w+)$/))===null||e===void 0?void 0:e[1]},K4=!((vf=" ".codePointAt)===null||vf===void 0||!vf.call(" ",0)),J4=function(i){if(i.key&&K4&&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&&Uk[e]!=="escape")return sa.fromCodepoints([e]).toString()}},eD=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!q4.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 Wl 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 tD=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")},nD=i=>{var e;return((e=i.dataTransfer.files)===null||e===void 0?void 0:e[0])&&!jk(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)},jk=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},iD=function(i){const e=i.clipboardData;if(e)return e.types.includes("text/plain")&&e.types.length===1},rD=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]",sD="".concat(Dd,", ").concat($d),uh="[data-trix-dialog]",oD="".concat(uh,"[data-trix-active]"),lD="".concat(uh," [data-trix-method]"),S0="".concat(uh," [data-trix-input]"),_0=(i,e)=>(e||(e=Ks(i)),i.querySelector("[data-trix-input][name='".concat(e,"']"))),C0=i=>i.getAttribute("data-trix-action"),Ks=i=>i.getAttribute("data-trix-attribute")||i.getAttribute("data-trix-dialog-attribute");class qk 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:sD,preventDefault:!0}),Zt("click",{onElement:this.element,matchingSelector:lD,withCallback:this.didClickDialogButton}),Zt("keydown",{onElement:this.element,matchingSelector:S0,withCallback:this.didKeyDownDialogInput})}didClickActionButton(e,t){var n;(n=this.delegate)===null||n===void 0||n.toolbarDidClickButton(),e.preventDefault();const r=C0(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=Ks(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=zr(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,C0(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,Ks(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 Ll("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 Gk extends HTMLElement{connectedCallback(){this.innerHTML===""&&(this.innerHTML=hk.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 hD=0;const fD=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:()=>dD(i)})},dD=function(i){return mD(i),pD()},mD=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})},pD=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)}},P0=Da.forcesObjectResizing?{display:"inline",width:"auto"}:{display:"inline-block",width:"1px"};fk("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(Ss,` figcaption textarea {
|
||||||
|
resize: none;
|
||||||
|
}
|
||||||
|
|
||||||
|
%t `).concat(Ss,` figcaption textarea.trix-autoresize-clone {
|
||||||
|
position: absolute;
|
||||||
|
left: -9999px;
|
||||||
|
max-height: 0px;
|
||||||
|
}
|
||||||
|
|
||||||
|
%t `).concat(Ss,` figcaption[data-trix-placeholder]:empty::before {
|
||||||
|
content: attr(data-trix-placeholder);
|
||||||
|
color: graytext;
|
||||||
|
}
|
||||||
|
|
||||||
|
%t [data-trix-cursor-target] {
|
||||||
|
display: `).concat(P0.display,` !important;
|
||||||
|
width: `).concat(P0.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 yi=new WeakMap,ac=new WeakMap,al=new WeakSet;class gD{constructor(e){var t,n;xk(t=this,n=al),n.add(t),gn(this,"value",""),mo(this,yi,{writable:!0,value:void 0}),mo(this,ac,{writable:!0,value:void 0}),this.element=e,Bl(this,yi,e.attachInternals()),Bl(this,ac,!1)}connectedCallback(){lc(this,al,cc).call(this)}disconnectedCallback(){}get form(){return rt(this,yi).form}get name(){return this.element.getAttribute("name")}set name(e){this.element.setAttribute("name",e)}get labels(){return rt(this,yi).labels}get disabled(){return rt(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,al,cc).call(this)}get validity(){return rt(this,yi).validity}get validationMessage(){return rt(this,yi).validationMessage}get willValidate(){return rt(this,yi).willValidate}formDisabledCallback(e){Bl(this,ac,e)}setFormValue(e){this.value=e,lc(this,al,cc).call(this),rt(this,yi).setFormValue(this.element.disabled?void 0:this.value)}checkValidity(){return rt(this,yi).checkValidity()}reportValidity(){return rt(this,yi).reportValidity()}setCustomValidity(e){lc(this,al,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;rt(this,yi).setValidity({valueMissing:n,customError:r},o)}var kf=new WeakMap,Sf=new WeakMap,_f=new WeakMap;class OD{constructor(e){mo(this,kf,{writable:!0,value:void 0}),mo(this,Sf,{writable:!0,value:t=>{t.defaultPrevented||t.target===this.element.form&&this.element.reset()}}),mo(this,_f,{writable:!0,value:t=>{if(t.defaultPrevented||this.element.contains(t.target))return;const n=zr(t.target,{matchingSelector:"label"});n&&Array.from(this.labels).includes(n)&&this.element.focus()}}),this.element=e}connectedCallback(){Bl(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",rt(this,Sf),!1),window.addEventListener("click",rt(this,_f),!1)}disconnectedCallback(){var e;(e=rt(this,kf))===null||e===void 0||e.destroy(),window.removeEventListener("reset",rt(this,Sf),!1),window.removeEventListener("click",rt(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=zr(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(),mo(this,Xt,{writable:!0,value:void 0}),this.willCreateInput=!0,Bl(this,Xt,this.constructor.formAssociated?new gD(this):new OD(this))}get trixId(){return this.hasAttribute("trix-id")?this.getAttribute("trix-id"):(this.setAttribute("trix-id",++hD),this.trixId)}get labels(){return rt(this,Xt).labels}get disabled(){const{inputElement:e}=this;return e?e.disabled:rt(this,Xt).disabled}set disabled(e){const{inputElement:t}=this;t&&(t.disabled=e
Line truncated
|
||||||
|
`){[e,t]=xo(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]=xo(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]=xo(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 SD(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 T0(i,e,t){return Vc(i,[""],e,t)}class Fl{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 Kk{constructor(e,t,n){this.value="",this.done=!1,this.cursor=new Fl(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 Jk{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()},Fl.prototype[Symbol.iterator]=Kk.prototype[Symbol.iterator]=Jk.prototype[Symbol.iterator]=function(){return this});let _D=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 xo(i,e,t){return e=Math.max(0,Math.min(i.length,e)),[e,Math.max(e,Math.min(i.length,t))]}let po="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<po.length;i++)po[i]+=po[i-1];function CD(i){for(let e=1;e<po.length;e+=2)if(po[e]>i)return po[e-1]<=i;return!1}function Q0(i){return i>=127462&&i<=127487}const M0=8205;function hn(i,e,t=!0,n=!0){return(t?eS:PD)(i,e,n)}function eS(i,e,t){if(e==i.length)return e;e&&tS(i.charCodeAt(e))&&nS(i.charCodeAt(e-1))&&e--;let n=ln(i,e);for(e+=oi(n);e<i.length;){let r=ln(i,e);if(n==M0||r==M0||t&&CD(r))e+=oi(r),n=r;else if(Q0(r)){let s=0,o=e-2;for(;o>=0&&Q0(ln(i,o));)s++,o-=2;if(s%2==0)break;e+=2}else break}return e}function PD(i,e,t){for(;e>0;){let n=eS(i,e-2,t);if(n<e)return n;e--}return 0}function tS(i){return i>=56320&&i<57344}function nS(i){return i>=55296&&i<56320}function ln(i,e){let t=i.charCodeAt(e);if(!nS(t)||e+1==i.length)return t;let n=i.charCodeAt(e+1);return tS(n)?(t-55296<<10)+(n-56320)+65536:t}function lp(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(hS)}phrase(e,...t){for(let n of this.facet(tt.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(oS))for(let o of s(this,t,n))Object.prototype.hasOwnProperty.call(o,e)&&r.push(o[e]);return r}charCategorizer(e){return ID(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)}}tt.allowMultipleSelections=Wd;tt.tabSize=ye.define({combine:i=>i.length?i[0]:4});tt.lineSeparator=lS;tt.readOnly=hS;tt.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])}});tt.languageData=oS;tt.changeFilter=aS;tt.transactionFilter=cS;tt.transactionExtender=uS;Ur.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 Qs{eq(e){return this==e}range(e,t=e){return Yd.create(e,t,this)}}Qs.prototype.startSide=Qs.prototype.endSide=0;Qs.prototype.point=!1;Qs.prototype.mapMode=cn.TrackDel;let Yd=class mS{constructor(e,t,n){this.from=e,this.to=t,this.value=n}static create(e,t,n){return new mS(e,t,n)}};function zd(i,e){return i.from-e.from||i.value.startSide-e.value.startSide}class up{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 up(r,s,n,l):null,pos:o}}}class it{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 it(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?it.of(t):this;let l=new pS(this,null,-1).goto(0),a=0,c=[],u=new jr;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?it.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 it(n,t,s||it.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=D0(o,l,n)
Line truncated
|
||||||
|
`)}static newName(){let e=N0[I0]||1;return N0[I0]=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 ZD(e,s),r.mount(Array.isArray(t)?t:[t],e)}}let Z0=new Map;class ZD{constructor(e,t){let n=e.ownerDocument||e,r=n.defaultView;if(!e.head&&e.adoptedStyleSheets&&r.CSSStyleSheet){let s=Z0.get(n);if(s)return e[qd]=s;this.sheet=new r.CSSStyleSheet,Z0.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 Gr={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:'"'},BD=typeof navigator<"u"&&/Mac/.test(navigator.platform),WD=typeof navigator<"u"&&/MSIE \d|Trident\/(?:[7-9]|\d{2,})\..*rv:(\d+)/.exec(navigator.userAgent);for(var an=0;an<10;an++)Gr[48+an]=Gr[96+an]=String(an);for(var an=1;an<=24;an++)Gr[an+111]="F"+an;for(var an=65;an<=90;an++)Gr[an]=String.fromCharCode(an+32),ca[an]=String.fromCharCode(an);for(var Pf in Gr)ca.hasOwnProperty(Pf)||(ca[Pf]=Gr[Pf]);function XD(i){var e=BD&&i.metaKey&&i.shiftKey&&!i.ctrlKey&&!i.altKey||WD&&i.shiftKey&&i.key&&i.key.length==1||i.key=="Unidentified",t=!e&&i.key||(i.shiftKey?ca:Gr)[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 FD(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?Es(i,0,i.nodeValue.length).getClientRects():i.nodeType==1?i.getClientRects():[]}function zl(i,e,t,n){return t?B0(i,e,t,n,-1)||B0(i,e,t,n,1):!1}function Ms(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 B0(i,e,t,n,r){for(;;){if(i==t&&e==n)return!0;if(e==(r<0?0:fr(i))){if(i.nodeName=="DIV")return!1;let s=i.parentNode;if(!s||s.nodeType!=1)return!1;e=Ms(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?fr(i):0}else return!1}}function fr(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 YD(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 gS(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 zD(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=YD(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}=gS(u,w)),f={left:w.left,right:w.left+u.clientWidth*m,top:w.top,bottom:w.top+u.clientHeight*p}}let g=0,b=0;if(r=="nearest")e.top<f.top?(b=-(f.top-e.top+o),t>0&&e.bottom>f.bottom+b&&(b=e.bottom-f.bottom+b+o)):e.bottom>f.bottom&&(b=e.bottom-f.bottom+o,t<0&&e.top-b<f.top&&(b=-(f.top+b-e.top+o)));else{let w=e.bottom-e.top,S=f.bottom-f.top;b=(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||b)if(d)c.scrollBy(g,b);else{let w=0,S=0;if(b){let _=u.scrollTop;u.scrollTop+=b/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-b)<1&&(r="nearest")}if(d)break;u=u.assignedSlot||u.parentNode}else if(u.nodeType==11)u=u.host;else break}function VD(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 C5(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 P5(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=KS(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),b=!g||m<g.top?-1:1;return q.cursor(p,b,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(mp).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 _l="";class A5{constructor(e,t){this.points=e,this.text="",this.lineSeparator=t.facet(tt.lineSeparator)}append(e){this.text+=e}lineBreak(){this.text+=_l}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+(x5(e,n.node,n.offset)?t:0))}}function x5(i,e,t){for(;;){if(!e||t<fr(e))return!1;if(e==i)return!0;t=Ms(e)+1,e=e.parentNode}}class J0{constructor(e,t){this.node=e,this.offset=t,this.pos=-1}}class T5{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?[]:E5(e),a=new A5(l,e.state);a.readRange(this.bounds.startDOM,this.bounds.endDOM),this.text=a.text,this.newSel=R5(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 JS(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=M5(i.state.doc.sliceString(o,l,_l),e.text,a-o,c);u&&(ke.chrome&&s==13&&u.toB==u.from+2&&e.text.slice(u.from,u.toB)==_l+_l&&u.toB--,t={from:o+u.from,to:o+u.toA,insert:at.of(e.text.slice(u.from,u.toB).split(_l))})}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 pp(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 pp(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&&Oo(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)&&Oo(i.contentDOM,"Backspace",8)||e.from==r.from&&e.to==r.to+1&&e.insert.length==0&&Oo(i.contentDOM,"Delete",46)))return!0;let s=e.insert.toString();i.inputState.composing>=0&&i.inputState.composing++;let o,l=()=>o||(o=Q5(i,e,t));return i.state.facet(BS).some(a=>a(i,e.from,e.to,s,l))||i.dispatch(l()),!0}function Q5(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&&HS(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 b=r.changes({from:g,to:p,insert:e.insert}),w=m.to-s.to;return{changes:b,range:a?q.range(Math.max(0,a.anchor+w),Math.max(0,a.head+w)):m.map(b)}})}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 M5(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 E5(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 J0(t,n)),(r!=t||s!=n)&&e.push(new J0(r,s))),e}function R5(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 D5{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&&G5(e.contentDOM.ownerDocument)}handleEvent(e){!X5(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=$5(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&&t2.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||pp(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:zS.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 Oe{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||jD(e.parent)||document,this.viewState=new fb(e.state||tt.create(e)),e.scrollTo&&e.scrollTo.is(dc)&&(this.viewState.scrollTarget=e.scrollTo.value.clip(this.viewState.state)),this.plugins=this.state.facet(kl).map(r=>new xf(r));for(let r of this.plugins)r.update(this);this.observer=new u$(this),this.inputState=new D5(this)
Line truncated
|
||||||
|
--\u2028\u2029\uFEFF-]`,gm),E$={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 R$(){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:M$,addSpecialChars:null});return(e.replaceTabs=!R$())&&(e.specialChars=new RegExp(" |"+e.specialChars.source,gm)),e.addSpecialChars&&(e.specialChars=new RegExp(e.specialChars.source+"|"+e.addSpecialChars.source,gm)),e}});function D$(i={}){return[Kc.of(i),$$()]}let kb=null;function $$(){return kb||(kb=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 Q$({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=Pi(o.text,l,n-o.from);return Qe.replace({widget:new Z$((l-a%l)*this.view.defaultCharacterWidth/this.view.scaleX)})}return this.decorationCache[s]||(this.decorationCache[s]=Qe.replace({widget:new N$(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 L$="•";function I$(i){return i>=32?L$:i==10?"":String.fromCharCode(9216+i)}class N$ extends br{constructor(e,t){super(),this.options=e,this.code=t}eq(e){return e.code==this.code}toDOM(e){let t=I$(this.code),n=e.state.phrase("Control character")+" "+(E$[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 Z$ 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 B$(){return X$}const W$=Qe.line({class:"cm-activeLine"}),X$=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(W$.range(r.from)),e=r.from)}return Qe.set(t)}},{decorations:i=>i.decorations}),Om=2e3;function F$(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 Y$(i,e){let t=i.coordsAtPos(i.viewport.from);return t?Math.round(Math.abs((t.left-e)/i.defaultCharacterWidth)):-1}function Sb(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?Y$(i,e.clientX):Pi(n.text,i.state.tabSize,t-n.from);return{line:n.number,col:s,off:r}}function z$(i,e){let t=Sb(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=Sb(i,r);if(!l)return n;let a=F$(i.state,t,l);return a.length?o?q.create(a.concat(n.ranges)):q.create(a):n}}:null}function V$(i){let e=t=>t.altKey&&t.button==0;return Oe.mouseSelectionStyle.of((t,n)=>e(n)?z$(t,n):null)}const U$={Alt:[18,i=>!!i.altKey],Control:[17,i=>!!i.ctrlKey],Shift:[16,i=>!!i.shiftKey],Meta:[91,i=>!!i.metaKey]},j$={style:"cursor: crosshair"};function q$(i={}){let[e,t]=U$[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,Oe.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 eI(this):new K7(this)}getCursor(e,t=0,n){let r=e.doc?e:tt.create({doc:e});return n==null&&(n=r.doc.length),this.regexp?eo(this,r,t,n):Js(this,r,t,n)}}class R_{constructor(e){this.spec=e}}function Js(i,e,t,n){return new Do(e.doc,i.unquoted,t,n,i.caseSensitive?void 0:r=>r.toLowerCase(),i.wholeWord?H7(e.doc,e.charCategorizer(e.selection.main.head)):void 0)}function H7(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 K7 extends R_{constructor(e){super(e)}nextMatch(e,t,n){let r=Js(this.spec,e,n,e.doc.length).nextOverlapping();return r.done&&(r=Js(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=Js(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=Js(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=Js(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 eo(i,e,t,n){return new Q_(e.doc,i.search,{ignoreCase:!i.caseSensitive,test:i.wholeWord?J7(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 J7(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 eI extends R_{nextMatch(e,t,n){let r=eo(this.spec,e,n,e.doc.length).next();return r.done&&(r=eo(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=eo(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=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-250),Math.min(n+250,e.doc.length));for(;!s.next().done;)r(s.value.from,s.value.to)}}const wa=Fe.define(),Ep=Fe.define(),Wr=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(Ep)&&(i=new zf(i.query,t.value?Rp:null));return i},provide:i=>pa.from(i,e=>e.panel)});class zf{constructor(e,t){this.query=e,this.panel=t}}const tI=Qe.mark({class:"cm-searchMatch"}),nI=Qe.mark({class:"cm-searchMatch cm-searchMatch-selected"}),iI=Vt.fromClass(class{constructor(i){this.view=i,this.decorations=this.highlight(i.state.field(Wr))}update(i){let e=i.state.field(Wr);(e!=i.startState.field(Wr)||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 jr;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?nI:tI)})}return n.finish()}},{decorations:i=>i.decorations});function Fa(i){return e=>{let t=e.state.field(Wr,!1);return t&&t.query.spec.valid?i(e,t):L_(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(Vo);return i.dispatch({selection:r,effects:[Dp(i,n),s.scrollToMatch(r.main,i)],userEvent:"select.search"}),$_(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(Vo);return i.dispatch({selection:s,effects:[Dp(i,r),o.scrollToMatch(s.main,i)],userEvent:"select.search"}),$_(i),!0}),rI=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)}),sI=({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 Do(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)&&jl(t.content,this.pos)==t.content.length?this.complete(e,t,t.content.length):!1}complete(e,t,n){return e.addLeafElement(t,st(ce.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(CC(e,this.pos,this.start,!0)))return-1;if(e.charCodeAt(this.pos)!=58)return this.stage=-1;this.elts.push(st(ce.LinkMark,this.pos+this.start,this.pos+this.start+1)),this.pos++}else if(this.stage==1){if(!this.nextStage(SC(e,jl(e,this.pos),this.start)))return-1}else if(this.stage==2){let t=jl(e,this.pos),n=0;if(t>this.pos){let r=_C(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(!pi(t))return-1}return e}class VN{nextLine(e,t,n){let r=t.depth<e.stack.length?-1:dC(t),s=t.next;if(r<0)return!1;let o=st(ce.HeaderMark,e.lineStart+t.pos,e.lineStart+r);return e.nextLine(),e.addLeafElement(n,st(s==61?ce.SetextHeading1:ce.SetextHeading2,n.start,e.prevLineEnd(),[...e.parser.parseInline(n.content,n.start),o])),!0}finish(){return!1}}const UN={LinkReference(i,e){return e.content.charCodeAt(0)==91?new zN(e):null},SetextHeading(){return new VN}},jN=[(i,e)=>fC(e)>=0,(i,e)=>cC(e)>=0,(i,e)=>uC(e)>=0,(i,e)=>Vp(e,i,!0)>=0,(i,e)=>Up(e,i,!0)>=0,(i,e)=>zp(e,i,!0)>=0,(i,e)=>gC(e,i,!0)>=0],qN={text:"",end:0};class GN{constructor(e,t,n,r){this.parser=e,this.input=t,this.ranges=r,this.line=new YN,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(ce.Document,0,this.lineStart,0,0),this.stack=[this.block],this.fragments=n.length?new eZ(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 FN(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=PC(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=qN;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 "+ce[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],Lo,Lo,(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?OC(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(ce.Paragraph,e.content.length),e.start)}elt(e,t,n,r){return typeof e=="string"?st(this.parser.getNodeType(e),t,n,r):new wC(e,t)}get buffer(){return new vC(this.parser.nodeSet)}}function OC(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=OC(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 kp{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 GN(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(pl(t.defineNodes)){r=Object.assign({},r);let f=n.types.slice(),d;for(let m of t.defineNodes){let{name:p,block:g,composite:b,style:w}=typeof m=="string"?{name:m}:m;if(f.some(k=>k.name==p))continue;b&&(r[f.length]=(k,Q,x)=>b(Q,x,k.value));let S=f.length,_=b?["Block","BlockContext"]:g?S>=ce.ATXHeading1&&S<=ce.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(Ws(d)))}if(pl(t.props)&&(n=n.extend(...t.props)),pl(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(pl(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(pl(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 KN(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 pl(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||Lo).concat(l||Lo),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 bC=[tn.none];for(let i=1,e;e=ce[i];i++)bC[i]=tn.define({id:i,name:e,props:i>=ce.Escape?[]:[[Ze.group,i in aC?["Block","BlockContext"]:["Block","LeafBlock"]]],top:e=="Document"});const Lo=[];class vC{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=PC(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[ce.Paragraph],[],[],0,e.block.hashProp);e.reusePlaceholders.set(h,t.tree),e.addNode(h,u)}if(t.type.is("Block")&&(JN.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 PC(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 tZ=Ws({"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}),nZ=new Ch(new Za(bC).extend(tZ),Object.keys(Ec).map(i=>Ec[i]),Object.keys(Ec).map(i=>UN[i]),Object.keys(Ec),jN,aC,Object.keys(Hf).map(i=>Hf[i]),Object.keys(Hf),[]);function iZ(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 rZ(i){let{codeParser:e,htmlParser:t}=i;return{wrap:Q2((r,s)=>{let o=r.type.id;if(e&&(o==ce.CodeBlock||o==ce.FencedCode)){let l="";if(o==ce.FencedCode){let c=r.node.getChild(ce.CodeInfo);c&&(l=s.read(c.from,c.to))}let a=e(l);if(a)return{parser:a,overlay:c=>c.type.id==ce.CodeText}}else if(t&&(o==ce.HTMLBlock||o==ce.HTMLTag))return{parser:t,overlay:iZ(r.node,r.from,r.to)};return null})}}const sZ={resolve:"Strikethrough",mark:"StrikethroughMark"},oZ={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(sZ,t,t+2,!o&&(!a||s||l),!s&&(!l||o||a))},after:"Emphasis"}]};function ql(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 Qv(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 AC=/^\|?(\s*:?-+:?\s*\|)+(\s*:?-+:?\s*)?$/;class Mv{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)&&AC.test(r=t.text.slice(t.pos))){let s=[];ql(e,n.content,0,s,n.start)==ql(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=[];ql(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 lZ={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 Qv(e.content,0)?new Mv:null},endLeaf(i,e,t){if(t.parsers.some(r=>r instanceof Mv)||!Qv(e.text,e.basePos))return!1;let n=i.scanLine(i.absoluteLineEnd+1).text;return AC.test(n)&&ql(i,e.text,e.basePos)==ql(i,n,e.basePos)},before:"SetextHeading"}]};class aZ{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 cZ={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"})],nB=zC.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"})]),Kv=new T2,VC=new Set(["Script","Block","FunctionExpression","FunctionDeclaration","ArrowFunction","MethodDeclaration","ForStatement"]);function gl(i){return(e,t)=>{let n=e.node.getChild("VariableDefinition");return n&&t(n,i),!0}}const iB=["FunctionDeclaration"],rB={FunctionDeclaration:gl("function"),ClassDeclaration:gl("class"),ClassExpression:()=>!0,EnumDeclaration:gl("constant"),TypeAliasDeclaration:gl("type"),NamespaceDeclaration:gl("namespace"),VariableDefinition(i,e){i.matchContext(iB)||e(i,"variable")},TypeDefinition(i,e){e(i,"type")},__proto__:null};function UC(i,e){let t=Kv.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=rB[o.name];if(l&&l(o,s)||VC.has(o.name))return!1}else if(o.to-o.from>8192){for(let l of UC(i,o.node))n.push(l);return!1}}),Kv.set(e,n),n}const Jv=/^[\w$\xa1-\uffff][\w$\d\xa1-\uffff]*$/,jC=["TemplateString","String","RegExp","LineComment","BlockComment","VariableDefinition","TypeDefinition","Label","PropertyDefinition","PropertyName","PrivatePropertyDefinition","PrivatePropertyName",".","?."];function sB(i){let e=At(i.state).resolveInner(i.pos,-1);if(jC.indexOf(e.name)>-1)return null;let t=e.name=="VariableName"||e.to-e.from<20&&Jv.test(i.state.sliceDoc(e.from,e.to));if(!t&&!i.explicit)return null;let n=[];for(let r=e;r;r=r.parent)VC.has(r.name)&&(n=n.concat(UC(i.state.doc,r)));return{options:n,from:t?e.from:i.pos,validFor:Jv}}const qi=Ds.define({name:"javascript",parser:tB.configure({props:[Yo.add({IfStatement:vo({except:/^\s*({|else\b)/}),TryStatement:vo({except:/^\s*({|catch\b|finally\b)/}),LabeledStatement:jL,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:UL({closing:"}"}),ArrowFunction:i=>i.baseIndent+i.unit,"TemplateString BlockComment":()=>null,"Statement Property":vo({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}}),Xs.add({"Block ClassBody SwitchBody EnumBody ObjectExpression ArrayExpression ObjectType":Ap,BlockComment(i){return{from:i.from+2,to:i.to-2}}})]}),languageData:{closeBrackets:{brackets:["(","[","{","'",'"',"`"]},commentTokens:{line:"//",block:{open:"/*",close:"*/"}},indentOnInput:/^\s*(?:case |default:|\{|\}|<\/)$/,wordChars:"$"}}),qC={test:i=>/^JSX/.test(i.name),facet:Sp({commentTokens:{block:{open:"{/*",close:"*/}"}}})},GC=qi.configure({dialect:"ts"},"typescript"),HC=qi.configure({dialect:"jsx",props:[_p.add(i=>i.isTop?[qC]:void 0)]}),KC=qi.configure({dialect:"jsx ts",props:[_p.add(i=>i.isTop?[qC]:void 0)]},"typescript");let JC=i=>({label:i,type:"keyword"});const eP="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(JC),oB=eP.concat(["declare","implements","private","protected","public"].map(JC));function lB(i={}){let e=i.jsx?i.typescript?KC:HC:i.typescript?GC:qi,t=i.typescript?nB.concat(oB):zC.concat(eP);return new Ro(e,[qi.data.of({autocomplete:fI(jC,N_(t))}),qi.data.of({autocomplete:sB}),i.jsx?uB:[]])}function aB(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 ew(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 cB=typeof navigator=="object"&&/Android\b/.test(navigator.userAgent),uB=Oe.inputHandler.of((i,e,t,n,r)=>{if((cB?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=ew(o.doc,m.firstChild,u))||((c=m.firstChild)===null||c===void 0?void 0:c.name)=="JSXFragmentTag")){let
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($,"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){A(qe,e,Mt),v(e,t),v(t,n),v(n,r),v(r,s),v(r,o),v(r,l),v(l,c),v(n,u),v(n,h),v(h,f),v(h,d),v(h,p),v(n,g),v(n,b),v(b,w),v(b,S),Y(_,b,null),v(b,k),v(b,x),v(n,C),v(n,M),v(M,$),v(M,N),Y(B,M,null),v(M,J),v(M,ie),v(t,le),v(t,X),v(X,ee),v(X,Te),v(X,ve),v(ve,Ue),v(ve,Ee),v(ve,Re),A(qe,xt,Mt),A(qe,H,Mt),Ke[Pe].m(H,null),A(qe,Tt,Mt),A(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)&&Q!==(Q=Bi(qe[0].createdAt)+"")&&K(x,Q);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?Ke[Pe].p(qe,Mt):(me(),R(Ke[Ri],1,1,()=>{Ke[Ri]=null}),pe(),Ye=Ke[Pe],Ye?Ye.p(qe,Mt):(Ye=Ke[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=Dw(qe),ct.c(),T(ct,1),ct.m(yt,null)):ct&&(me(),R(ct,1,1,()=>{ct=null}),pe())},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),Ke[Pe].d(),ct&&ct.d(),i[13](null)}}}function vW(i,e,t){let n,r,s,o;const l=je("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,Q)=>(k[Q.field]||(k[Q.field]={record:[],revision:[]}),k[Q.field].record.push(Q),k),{})),t(7,o=_._edges.reduce((k,Q)=>(k[Q.field]||(k[Q.field]={record:[],revision:[]}),k[Q.field].revision.push(Q),k),o))}function p(S,_){S.preventDefault(),t(5,s=_),t(6,r=h.fields.filter(k=>!na(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 b=(S,_)=>p(_,S);function w(S){Se[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,b,w]}class wW extends oe{constructor(e){super(),se(this,e,vW,bW,re,{record:0,graph:11,users:1,schema:2})}}const{window:yW}=CP;function Xw(i,e,t){const n=i.slice();return n[21]=e[t],n}function kW(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){A(r,e,s),t||(n=G(e,"click",i[11]),t=!0)},p:U,d(r){r&&P(e),t=!1,n()}}}function SW(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){A(r,e,s),t||(n=G(e,"click",i[11]),t=!0)},p:U,d(r){r&&P(e),t=!1,n()}}}function _W(i){let e,t;return e=new wW({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 CW(i){let e,t;return e=new rW({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 PW(i){let e=[],t=new Map,n,r,s=ue(i[9]);const o=l=>l[21].name;for(let l=0;l<s.length;l+=1){let a=Xw(i,s,l),c=o(a);t.set(c,e[l]=Yw(c,a))}return{c(){for(let l=0;l<e.length;l+=1)e[l].c();n=De()},m(l,a){for(let c=0;c<e.length;c+=1)e[c]&&e[c].m(l,a);A(l,n,a),r=!0},p(l,a){a&623&&(s=ue(l[9]),me(),e=di(e,a,o,1,l,s,t,n.parentNode,mr,Yw,n,Xw),pe())},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 Fw(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 gP({props:l}),Se.push(()=>He(e,"data",s)),Se.push(()=>He(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,nt(()=>t=!1)),!n&&c&2&&(n=!0,u.graph=a[1],nt(()=>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 Yw(i,e){let t,n,r,s=e[6]===e[21].group&&Fw(e);return{key:i,first:null,c(){t=De(),s&&s.c(),n=De(),this.first=t},m(o,l){A(o,t,l),s&&s.m(o,l),A(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=Fw(e),s.c(),T(s,1),s.m(n.parentNode,n)):s&&(me(),R(s,1,1,()=>{s=null}),pe())},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 AW(i){let e,t,n,r,s,o,l,a,c,u,h,f,d,m,p,g,b,w,S,_,k;function Q(X){i[12](X)}function x(X){i[13](X)}let C={schema:i[2],isCreateMode:i[3]};i[0]!==void 0&&(C.record=i[0]),i[6]!==void 0&&(C.activeContentTab=i[6]),n=new wy({props:C}),Se.push(()=>He(n,"record",Q)),Se.push(()=>He(n,"activeContentTab",x));function M(X,ee){if(X[3])return SW;if(X[8])return kW}let $=M(i),N=$&&$(i);a=new Dy({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 yy({props:J}),Se.push(()=>He(d,"active",B));const te=[PW,CW,_W],ie=[];function le(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~(b=le(i,-1))&&(w=ie[b]=te[b](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"),fe(f,"margin-bottom","150px"),fe(f,"position","relative"),O(e,"class","record-edit")},m(X,ee){A(X,e,ee),v(e,t),Y(n,t,null),v(t,o),N&&N.m(t,null),v(e,l),Y(a,e,null),v(e,c),Y(u,e,null),v(e,h),v(e,f),Y(d,f,null),v(f,p),~b&&ie[b].m(f,null),S=!0,_||(k=G(yW,"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],nt(()=>r=!1)),!s&&ee&64&&(s=!0,Te.activeContentTab=X[6],nt(()=>s=!1)),n.$set(Te),$===($=M(X))&&N?N.p(X,ee):(N&&N.d(1),N=$&&$(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 Ue={};ee&128&&(Ue.message=X[7]),u.$set(Ue);const ne={};ee&4&&(ne.schema=X[2]),ee&8&&(ne.isCreateMode=X[3]),!m&&ee&64&&(m=!0,ne.active=X[6],nt(()=>m=!1)),d.$set(ne);let Ee=b;b=le(X,ee),b===Ee?~b&&ie[b].p(X,ee):(w&&(me(),R(ie[Ee],1,1,()=>{ie[Ee]=null}),pe()),~b?(w=ie[b],w?w.p(X,ee):(w=ie[b]=te[b](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),~b&&ie[b].d(),_=!1,k()}}}function xW(i,e,t){let n,r,s;const o=je("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(C=>C.name!=="id");Ti(()=>{p()});function p(){f={data:JSON.parse(JSON.stringify(a.data)),status:a.status,edges:JSON.parse(JSON.stringify(c.edges))}}cy(()=>{t(8,n=b())});function g(C){return n?C.returnValue="You have unsaved changes. Are you sure you want to exit?":(delete C.returnValue,"...")}function b(){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,Q){A(k,e,Q),v(e,t),v(t,n),v(n,r),v(t,s),v(t,o),v(o,l),v(t,a),v(t,c),S&&S.m(c,null),v(c,u),_&&_.m(c,null),v(t,h),v(t,f),v(f,d),v(f,m),v(f,p),i[6](p),v(f,g),b||(w=G(o,"click",i[4]),b=!0)},p(k,[Q]){Q&1&&K(r,k[0]),Q&4&&(o.disabled=k[2]),k[2]?S||(S=Hw(),S.c(),S.m(c,u)):S&&(S.d(1),S=null),!k[2]&&k[3]?_||(_=Kw(),_.c(),_.m(c,null)):_&&(_.d(1),_=null),Q&8&&K(d,k[3])},i:U,o:U,d(k){k&&P(e),S&&S.d(),_&&_.d(),i[6](null),b=!1,w()}}}function XW(i,e,t){let n;const r=je("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()})}Ti(()=>{c()});function h(f){Se[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 FW extends oe{constructor(e){super(),se(this,e,XW,WW,re,{title:0,command:5})}}function Jw(i,e,t){const n=i.slice();return n[2]=e[t],n}function YW(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){A(n,e,r),v(e,t)},p:U,d(n){n&&P(e)}}}function zW(i){let e,t;return e=new Gi({props:{$$slots:{button:[UW],default:[VW]},$$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 ey(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){A(r,e,s),v(e,n)},p:U,d(r){r&&P(e)}}}function VW(i){let e,t=ue(i[0].commands),n=[];for(let r=0;r<t.length;r+=1)n[r]=ey(Jw(i,t,r));return{c(){for(let r=0;r<n.length;r+=1)n[r].c();e=De()},m(r,s){for(let o=0;o<n.length;o+=1)n[o]&&n[o].m(r,s);A(r,e,s)},p(r,s){if(s&1){t=ue(r[0].commands);let o;for(o=0;o<t.length;o+=1){const l=Jw(r,t,o);n[o]?n[o].p(l,s):(n[o]=ey(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),mt(n,r)}}}function UW(i){let e;return{c(){e=y("div"),e.textContent="Actions",O(e,"slot","button")},m(t,n){A(t,e,n)},p:U,d(t){t&&P(e)}}}function jW(i){let e,t;return e=new Ci({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 qW(i){let e,t,n;return t=new Ci({props:{side:"28",name:i[1].name}}),{c(){e=y("a"),V(t.$$.fragment),O(e,"href",i[0].lucentUrl+"/profile")},m(r,s){A(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 GW(i){let e,t,n,r,s,o,l=i[0].auth=="lucent"&&YW(i),a=i[0].commands.length>0&&zW(i);const c=[qW,jW],u=[];function h(f,d){return f[0].auth=="lucent"?0:1}return r=h(i),s=u[r]=c[r](i),{c(){e=y("div"),l&&l.c(),t=D(),a&&a.c(),n=D(),s.c(),O(e,"class","top-nav")},m(f,d){A(f,e,d),l&&l.m(e,null),v(e,t),a&&a.m(e,null),v(e,n),u[r].m(e,null),o=!0},p(f,[d]){f[0].auth=="lucent"&&l.p(f,d),f[0].commands.length>0&&a.p(f,d),s.p(f,d)},i(f){o||(T(a),T(s),o=!0)},o(f){R(a),R(s),o=!1},d(f){f&&P(e),l&&l.d(),a&&a.d(),u[r].d()}}}function HW(i){const e=je("channel"),t=je("user");return[e,t]}class KW extends oe{constructor(e){super(),se(this,e,HW,GW,re,{})}}function JW(i){let e,t,n,r,s,o,l,a,c;n=new EW({props:{schema:i[2].schema}}),o=new KW({});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=Cs(p,u[g]);return m!==void 0&&m&5&&(p=Cs(p,So(u,[m&1&&{title:d[0]},m&4&&_o(d[2])]))),{props:p}}return h&&(a=Fr(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){A(d,e,m),v(e,t),Y(n,t,null),v(e,r),v(e,s),Y(o,s,null),v(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){me();const g=a;R(g.$$.fragment,1,0,()=>{z(g,1)}),pe()}h?(a=Fr(h,f(d,m)),V(a.$$.fragment),T(a.$$.fragment,1),Y(a,s,null)):a=null}else if(h){const g=m&5?So(u,[m&1&&{title:d[0]},m&4&&_o(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 e9(i,e,t){const n={members:Xx,recordEdit:TW,recordNotFound:zx,contentIndex:Iy,homeIndex:BW,buildReport:FW};let{title:r}=e,{view:s}=e,{user:o}=e,{data:l}=e,{channel:a}=e,{readableSchemas:c}=e;return Tl("channel",a),Tl("rea
Line truncated
|
||||||
Vendored
+2
-2
@@ -1,11 +1,11 @@
|
|||||||
{
|
{
|
||||||
"main.js": {
|
"main.js": {
|
||||||
"file": "assets/main-C4XTQmaY.js",
|
"file": "assets/main-DH0OAeUr.js",
|
||||||
"name": "main",
|
"name": "main",
|
||||||
"src": "main.js",
|
"src": "main.js",
|
||||||
"isEntry": true,
|
"isEntry": true,
|
||||||
"css": [
|
"css": [
|
||||||
"assets/main-BJijircB.css"
|
"assets/main-BVNnoznq.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);
|
|
||||||
}
|
|
||||||
);
|
|
||||||
|
|
||||||
@@ -1,11 +0,0 @@
|
|||||||
export function debounce(callback, wait) {
|
|
||||||
let timeoutId = null;
|
|
||||||
|
|
||||||
return (...args) => {
|
|
||||||
window.clearTimeout(timeoutId);
|
|
||||||
|
|
||||||
timeoutId = window.setTimeout(() => {
|
|
||||||
callback.apply(null, args);
|
|
||||||
}, wait);
|
|
||||||
};
|
|
||||||
}
|
|
||||||
+114
-26
@@ -1,4 +1,4 @@
|
|||||||
import {format, formatDistanceToNow, parseJSON} from "date-fns";
|
import { formatDistanceToNow, parseJSON, format, parse } from "date-fns";
|
||||||
|
|
||||||
export function friendlyDate(date) {
|
export function friendlyDate(date) {
|
||||||
return formatDistanceToNow(parseJSON(date), { addSuffix: true });
|
return formatDistanceToNow(parseJSON(date), { addSuffix: true });
|
||||||
@@ -19,50 +19,138 @@ export function readableDatetime(date) {
|
|||||||
return format(parseJSON(date), "dd MMM yyyy HH:mm");
|
return format(parseJSON(date), "dd MMM yyyy HH:mm");
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
export function stripHtml(html = "") {
|
export function stripHtml(html = "") {
|
||||||
let tmp = document.createElement("div");
|
let tmp = document.createElement("div");
|
||||||
tmp.innerHTML = html;
|
tmp.innerHTML = html;
|
||||||
return tmp.textContent || tmp.innerText || "";
|
return tmp.textContent || tmp.innerText || "";
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
export function randomId(length = 10) {
|
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) {
|
export function clickOutside(node) {
|
||||||
|
const handleClick = (event) => {
|
||||||
const handleClick = event => {
|
|
||||||
if (node && !node.contains(event.target) && !event.defaultPrevented) {
|
if (node && !node.contains(event.target) && !event.defaultPrevented) {
|
||||||
node.dispatchEvent(
|
node.dispatchEvent(new CustomEvent("click_outside", node));
|
||||||
new CustomEvent('click_outside', node)
|
|
||||||
)
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
};
|
||||||
|
|
||||||
document.addEventListener('click', handleClick, true);
|
document.addEventListener("click", handleClick, true);
|
||||||
|
|
||||||
return {
|
return {
|
||||||
destroy() {
|
destroy() {
|
||||||
document.removeEventListener('click', handleClick, true);
|
document.removeEventListener("click", handleClick, true);
|
||||||
}
|
},
|
||||||
}
|
};
|
||||||
}
|
}
|
||||||
|
|
||||||
export function uniqueBy(list, callback) {
|
export function apiFetch(url, options = {}) {
|
||||||
const itemMap = list.reduce((c, item) => {
|
return fetch(url, {
|
||||||
c[callback(item)] = item;
|
...options,
|
||||||
return c;
|
headers: {
|
||||||
}, {});
|
"Content-Type": "application/json",
|
||||||
|
"X-CSRF-TOKEN": document.querySelector('meta[name="csrf-token"]').content,
|
||||||
return Object.values(itemMap);
|
...options.headers,
|
||||||
|
},
|
||||||
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
export function range(start, end) {
|
export function apiPost(url, body, options = {}) {
|
||||||
var ans = [];
|
return fetch(url, {
|
||||||
for (let i = start; i <= end; i++) {
|
...options,
|
||||||
ans.push(i);
|
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());
|
||||||
}
|
}
|
||||||
return ans;
|
|
||||||
|
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 || x == [];
|
||||||
|
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)) {
|
||||||
|
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;
|
||||||
|
|
||||||
|
// const ok = Object.keys,
|
||||||
|
// tx = typeof x,
|
||||||
|
// ty = typeof y;
|
||||||
|
// return x && y && tx === "object" && tx === ty
|
||||||
|
// ? ok(x).length === ok(y).length &&
|
||||||
|
// ok(x).every((key) => isEqual(x[key], y[key]))
|
||||||
|
// : x === y;
|
||||||
|
}
|
||||||
|
|
||||||
|
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");
|
|
||||||
}
|
|
||||||
});
|
|
||||||
|
|
||||||
}
|
|
||||||
+7
-12
@@ -1,13 +1,11 @@
|
|||||||
import {axiosInstance} from "./bootstrap";
|
import "../sass/app.scss";
|
||||||
import Account from "./svelte/Account.svelte";
|
import Account from "./svelte/Account.svelte";
|
||||||
import Channel from "./svelte/Channel.svelte";
|
import Channel from "./svelte/Channel.svelte";
|
||||||
import Mustache from "mustache";
|
// import Mustache from "mustache";
|
||||||
import 'htmx.org';
|
|
||||||
|
|
||||||
Mustache.escape = function (value) {
|
|
||||||
return value;
|
|
||||||
};
|
|
||||||
|
|
||||||
|
// Mustache.escape = function (value) {
|
||||||
|
// return value;
|
||||||
|
// };
|
||||||
|
|
||||||
// Define all components
|
// Define all components
|
||||||
const entryComponents = {
|
const entryComponents = {
|
||||||
@@ -28,17 +26,14 @@ let loadSvelte = function () {
|
|||||||
const loadElement = function (element) {
|
const loadElement = function (element) {
|
||||||
const componentId = element.attributes["data-layout"].value;
|
const componentId = element.attributes["data-layout"].value;
|
||||||
const [_, component] = Object.entries(entryComponents).find(
|
const [_, component] = Object.entries(entryComponents).find(
|
||||||
([key, _]) => componentId === key
|
([key, _]) => componentId === key,
|
||||||
);
|
);
|
||||||
if (!component) {
|
if (!component) {
|
||||||
return [];
|
return [];
|
||||||
}
|
}
|
||||||
|
|
||||||
const jsonData = document.getElementById(
|
const jsonData = document.getElementById("json-" + componentId).innerHTML;
|
||||||
"json-" + componentId
|
|
||||||
).innerHTML;
|
|
||||||
const props = JSON.parse(jsonData);
|
const props = JSON.parse(jsonData);
|
||||||
props.axios = axiosInstance;
|
|
||||||
const compOptions = {
|
const compOptions = {
|
||||||
target: element,
|
target: element,
|
||||||
props: props,
|
props: props,
|
||||||
|
|||||||
@@ -21,10 +21,7 @@
|
|||||||
setContext("channel", channel);
|
setContext("channel", channel);
|
||||||
setContext("user", user);
|
setContext("user", user);
|
||||||
</script>
|
</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>
|
||||||
@@ -25,18 +25,16 @@
|
|||||||
// export let layout;
|
// export let layout;
|
||||||
export let channel;
|
export let channel;
|
||||||
|
|
||||||
export let axios;
|
|
||||||
export let readableSchemas;
|
export let readableSchemas;
|
||||||
|
|
||||||
|
|
||||||
setContext("axios", axios);
|
|
||||||
setContext("channel", channel);
|
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);
|
setContext("user", user);
|
||||||
|
|
||||||
</script>
|
</script>
|
||||||
|
|
||||||
|
|
||||||
<div class="main-wrapper">
|
<div class="main-wrapper">
|
||||||
<div class="sidebar-content">
|
<div class="sidebar-content">
|
||||||
<Navbar schema={data.schema} />
|
<Navbar schema={data.schema} />
|
||||||
@@ -46,6 +44,3 @@
|
|||||||
<svelte:component this={components[view]} {title} {...data} />
|
<svelte:component this={components[view]} {title} {...data} />
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
@@ -1,39 +1,48 @@
|
|||||||
<script>
|
<script>
|
||||||
import { getContext } from "svelte";
|
import { getContext } from "svelte";
|
||||||
import SpinnerButton from "../common/SpinnerButton.svelte";
|
import { apiPost } from "../../helpers";
|
||||||
import axios from "axios";
|
|
||||||
|
|
||||||
const channel = getContext("channel");
|
const channel = getContext("channel");
|
||||||
let email = "";
|
let email = "";
|
||||||
let message = "";
|
let submitted = false;
|
||||||
|
|
||||||
function login(e) {
|
function login(e) {
|
||||||
e.preventDefault();
|
e.preventDefault();
|
||||||
|
|
||||||
axios
|
apiPost(channel.lucentUrl + "/login", { email: email })
|
||||||
.post(channel.lucentUrl + "/login", {
|
.then(() => {
|
||||||
email: email,
|
submitted = true;
|
||||||
})
|
})
|
||||||
.then((response) => {
|
.catch(() => {});
|
||||||
message = "You will receive an email with a login link"
|
|
||||||
})
|
|
||||||
.catch((error) => {
|
|
||||||
});
|
|
||||||
}
|
}
|
||||||
|
|
||||||
</script>
|
</script>
|
||||||
|
|
||||||
<div class="wrapper-tiny">
|
<div class="scope-login">
|
||||||
{#if message}
|
<div class="bg-image"></div>
|
||||||
|
<div class="login-form">
|
||||||
|
{#if submitted}
|
||||||
<div class="alert alert-info" role="alert">
|
<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>
|
</div>
|
||||||
|
|
||||||
{:else}
|
{:else}
|
||||||
|
<div class="form">
|
||||||
|
<h2 class="mb-5">Enter Lucent</h2>
|
||||||
|
|
||||||
<form on:submit={login}>
|
<form on:submit={login}>
|
||||||
<div class="mb-3">
|
<p>
|
||||||
<label for="emailaddress" class="form-label">Email address</label>
|
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
|
<input
|
||||||
type="email"
|
type="email"
|
||||||
bind:value={email}
|
bind:value={email}
|
||||||
@@ -43,12 +52,17 @@
|
|||||||
/>
|
/>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
|
<button class="bt bt-primary">
|
||||||
<div class="text-center mt-5 d-block">
|
Send email
|
||||||
<SpinnerButton label="Login"/>
|
<img
|
||||||
</div>
|
alt="indicator"
|
||||||
|
id="indicator"
|
||||||
|
class="htmx-indicator"
|
||||||
|
src="/img/spinner.svg"
|
||||||
|
/>
|
||||||
|
</button>
|
||||||
</form>
|
</form>
|
||||||
|
</div>
|
||||||
{/if}
|
{/if}
|
||||||
</div>
|
</div>
|
||||||
|
</div>
|
||||||
@@ -4,7 +4,7 @@
|
|||||||
import Avatar from "./Avatar.svelte";
|
import Avatar from "./Avatar.svelte";
|
||||||
import { getContext } from "svelte";
|
import { getContext } from "svelte";
|
||||||
import SuccessAlert from "../common/SuccessAlert.svelte";
|
import SuccessAlert from "../common/SuccessAlert.svelte";
|
||||||
import axios from "axios";
|
import { apiPost } from "../../helpers";
|
||||||
|
|
||||||
const user = getContext("user");
|
const user = getContext("user");
|
||||||
const channel = getContext("channel");
|
const channel = getContext("channel");
|
||||||
@@ -17,8 +17,7 @@
|
|||||||
e.preventDefault();
|
e.preventDefault();
|
||||||
errorMessage = "";
|
errorMessage = "";
|
||||||
|
|
||||||
axios
|
apiPost(channel.lucentUrl + "/account/update-name", {
|
||||||
.post(channel.lucentUrl + "/account/update-name", {
|
|
||||||
name: name,
|
name: name,
|
||||||
})
|
})
|
||||||
.then((response) => {
|
.then((response) => {
|
||||||
@@ -26,6 +25,7 @@
|
|||||||
})
|
})
|
||||||
.catch((error) => {
|
.catch((error) => {
|
||||||
errorMessage = error.response?.data.error;
|
errorMessage = error.response?.data.error;
|
||||||
|
console.log({ errorMessage });
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -33,8 +33,7 @@
|
|||||||
e.preventDefault();
|
e.preventDefault();
|
||||||
errorMessage = "";
|
errorMessage = "";
|
||||||
|
|
||||||
axios
|
apiPost(channel.lucentUrl + "/account/update-email", {
|
||||||
.post(channel.lucentUrl + "/account/update-email", {
|
|
||||||
email: email,
|
email: email,
|
||||||
})
|
})
|
||||||
.then((response) => {
|
.then((response) => {
|
||||||
@@ -42,11 +41,11 @@
|
|||||||
})
|
})
|
||||||
.catch((error) => {
|
.catch((error) => {
|
||||||
errorMessage = error.response?.data.error;
|
errorMessage = error.response?.data.error;
|
||||||
|
console.log({ errorMessage });
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
</script>
|
</script>
|
||||||
|
|
||||||
|
|
||||||
<div class="wrapper-tiny">
|
<div class="wrapper-tiny">
|
||||||
<ErrorAlert message={errorMessage} />
|
<ErrorAlert message={errorMessage} />
|
||||||
<SuccessAlert bind:this={successAlert} />
|
<SuccessAlert bind:this={successAlert} />
|
||||||
@@ -80,7 +79,9 @@
|
|||||||
</form>
|
</form>
|
||||||
|
|
||||||
<div class="list-group">
|
<div class="list-group">
|
||||||
<a class="list-group-item list-group-item-action" href="{ channel.lucentUrl }/logout">Logout from this
|
<a
|
||||||
device</a>
|
class="list-group-item list-group-item-action"
|
||||||
|
href="{channel.lucentUrl}/logout">Logout from this device</a
|
||||||
|
>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
@@ -1,4 +1,5 @@
|
|||||||
<script>
|
<script>
|
||||||
|
import { apiPost } from "../../helpers";
|
||||||
import ErrorAlert from "../common/ErrorAlert.svelte";
|
import ErrorAlert from "../common/ErrorAlert.svelte";
|
||||||
import SpinnerButton from "../common/SpinnerButton.svelte";
|
import SpinnerButton from "../common/SpinnerButton.svelte";
|
||||||
import { getContext } from "svelte";
|
import { getContext } from "svelte";
|
||||||
@@ -12,8 +13,7 @@
|
|||||||
e.preventDefault();
|
e.preventDefault();
|
||||||
errorMessage = "";
|
errorMessage = "";
|
||||||
|
|
||||||
axios
|
apiPost(channel.lucentUrl + "/register", {
|
||||||
.post(channel.lucentUrl + "/register", {
|
|
||||||
name: name,
|
name: name,
|
||||||
email: email,
|
email: email,
|
||||||
})
|
})
|
||||||
@@ -50,10 +50,8 @@
|
|||||||
/>
|
/>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
|
|
||||||
<div class="text-center mt-5 d-block">
|
<div class="text-center mt-5 d-block">
|
||||||
<SpinnerButton label="Register" />
|
<SpinnerButton label="Register" />
|
||||||
</div>
|
</div>
|
||||||
</form>
|
</form>
|
||||||
|
|
||||||
</div>
|
</div>
|
||||||
@@ -1,43 +1,42 @@
|
|||||||
<script>
|
<script>
|
||||||
import { getContext } from "svelte";
|
import { getContext } from "svelte";
|
||||||
import SpinnerButton from "../common/SpinnerButton.svelte";
|
import { apiPost } from "../../helpers";
|
||||||
import SuccessAlert from "../common/SuccessAlert.svelte";
|
|
||||||
|
|
||||||
const channel = getContext("channel");
|
const channel = getContext("channel");
|
||||||
export let email;
|
export let email;
|
||||||
export let token;
|
export let token;
|
||||||
let successAlert;
|
|
||||||
|
|
||||||
function login(e) {
|
function login(e) {
|
||||||
e.preventDefault();
|
e.preventDefault();
|
||||||
|
|
||||||
axios
|
apiPost(channel.lucentUrl + "/verify", {
|
||||||
.post(channel.lucentUrl + "/verify", {
|
|
||||||
email: email,
|
email: email,
|
||||||
token: token,
|
token: token,
|
||||||
})
|
})
|
||||||
.then((response) => {
|
.then((response) => {
|
||||||
window.location = channel.lucentUrl;
|
window.location = channel.lucentUrl;
|
||||||
})
|
})
|
||||||
.catch((error) => {
|
.catch((error) => {});
|
||||||
});
|
|
||||||
}
|
}
|
||||||
|
|
||||||
</script>
|
</script>
|
||||||
|
|
||||||
<SuccessAlert bind:this={successAlert}/>
|
<div class="scope-login">
|
||||||
<div class="wrapper-tiny">
|
<div class="bg-image"></div>
|
||||||
|
<div class="login-form">
|
||||||
|
<div class="form">
|
||||||
|
<h2 class="mb-5">Welcome to Lucent</h2>
|
||||||
<form on:submit={login}>
|
<form on:submit={login}>
|
||||||
<div class="mb-3 text-center">
|
<button class="bt bt-primary">
|
||||||
<h3>Login as {email}</h3>
|
Enter as {email}
|
||||||
|
<img
|
||||||
</div>
|
alt="indicator"
|
||||||
|
id="indicator"
|
||||||
|
class="htmx-indicator"
|
||||||
<div class="text-center mt-5 d-block">
|
src="/img/spinner.svg"
|
||||||
<SpinnerButton label="Enter"/>
|
/>
|
||||||
</div>
|
</button>
|
||||||
</form>
|
</form>
|
||||||
|
<div class="form-errors"></div>
|
||||||
|
</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>
|
<script>
|
||||||
import { getContext, onMount } from "svelte";
|
import { getContext, onMount } from "svelte";
|
||||||
import axios from "axios";
|
import { apiPost } from "../../helpers";
|
||||||
|
|
||||||
const channel = getContext("channel");
|
const channel = getContext("channel");
|
||||||
export let title;
|
export let title;
|
||||||
export let command;
|
export let command;
|
||||||
@@ -12,58 +11,57 @@
|
|||||||
let inProgress = false;
|
let inProgress = false;
|
||||||
|
|
||||||
function connect() {
|
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) {
|
eventSource.onmessage = function (event) {
|
||||||
inProgress = true;
|
inProgress = true;
|
||||||
const data = JSON.parse(event.data);
|
const data = JSON.parse(event.data);
|
||||||
date = data.date;
|
date = data.date;
|
||||||
logs = data.logs;
|
logs = data.logs;
|
||||||
anchorEl.scrollIntoView()
|
anchorEl.scrollIntoView();
|
||||||
}
|
};
|
||||||
eventSource.onerror = (e) => {
|
eventSource.onerror = (e) => {
|
||||||
|
console.log(e);
|
||||||
eventSource.close();
|
eventSource.close();
|
||||||
inProgress = false;
|
inProgress = false;
|
||||||
}
|
};
|
||||||
}
|
}
|
||||||
|
|
||||||
function buildWebsite(e) {
|
function buildWebsite(e) {
|
||||||
e.preventDefault();
|
e.preventDefault();
|
||||||
inProgress = true;
|
inProgress = true;
|
||||||
axios.post(channel.lucentUrl + "/command/" + command.signature).then(response => {
|
apiPost(channel.lucentUrl + "/command/" + command.signature).then(
|
||||||
connect()
|
(response) => {
|
||||||
})
|
connect();
|
||||||
|
},
|
||||||
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
onMount(() => {
|
onMount(() => {
|
||||||
connect()
|
connect();
|
||||||
})
|
});
|
||||||
|
|
||||||
</script>
|
</script>
|
||||||
|
|
||||||
<div class="common-wrapper">
|
<div class="common-wrapper">
|
||||||
<div class="lx-card mt-5">
|
<div class="lx-card mt-5">
|
||||||
|
|
||||||
<h3 class="header-small mb-5">{title}</h3>
|
<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>
|
</button>
|
||||||
|
|
||||||
|
|
||||||
<div class="mb-3">
|
<div class="mb-3">
|
||||||
{#if inProgress}
|
{#if inProgress}
|
||||||
<span class="badge text-bg-warning">
|
<span class="badge text-bg-warning"> Action in progress </span>
|
||||||
Action in progress
|
|
||||||
</span>
|
|
||||||
{/if}
|
{/if}
|
||||||
{#if !inProgress && logs}
|
{#if !inProgress && logs}
|
||||||
<span class="badge text-bg-info">
|
<span class="badge text-bg-info"> Action completed </span>
|
||||||
Action completed
|
|
||||||
</span>
|
|
||||||
{/if}
|
{/if}
|
||||||
|
|
||||||
|
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
<pre class="logs">{logs}
|
<pre class="logs">{logs}
|
||||||
@@ -71,6 +69,7 @@
|
|||||||
</pre>
|
</pre>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
<style>
|
<style>
|
||||||
.logs {
|
.logs {
|
||||||
max-height: 70vh;
|
max-height: 70vh;
|
||||||
|
|||||||
@@ -124,17 +124,10 @@
|
|||||||
"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"/>',
|
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",
|
viewBox: "0 0 24 24",
|
||||||
},
|
|
||||||
"undo": {
|
|
||||||
path: '<path fill-rule="evenodd" clip-rule="evenodd" d="M7.53033 3.46967C7.82322 3.76256 7.82322 4.23744 7.53033 4.53033L5.81066 6.25H15C18.1756 6.25 20.75 8.82436 20.75 12C20.75 15.1756 18.1756 17.75 15 17.75H8.00001C7.58579 17.75 7.25001 17.4142 7.25001 17C7.25001 16.5858 7.58579 16.25 8.00001 16.25H15C17.3472 16.25 19.25 14.3472 19.25 12C19.25 9.65279 17.3472 7.75 15 7.75H5.81066L7.53033 9.46967C7.82322 9.76256 7.82322 10.2374 7.53033 10.5303C7.23744 10.8232 6.76256 10.8232 6.46967 10.5303L3.46967 7.53033C3.17678 7.23744 3.17678 6.76256 3.46967 6.46967L6.46967 3.46967C6.76256 3.17678 7.23744 3.17678 7.53033 3.46967Z" fill="#1C274C"/>',
|
|
||||||
viewBox: "0 0 24 24",
|
|
||||||
},
|
|
||||||
"destroy": {
|
|
||||||
path: '<path d="M17 7L15 9" stroke="#1C274C" stroke-width="1.5" stroke-linecap="round"/><path d="M19.5 7.5L20.5 8" stroke="#1C274C" stroke-width="1.5" stroke-linecap="round"/><path d="M16 3.5L16.5 4.5" stroke="#1C274C" stroke-width="1.5" stroke-linecap="round"/><path d="M19 5L20 4" stroke="#1C274C" stroke-width="1.5" stroke-linecap="round"/><path\n'+' d="M5.75 8.00337C6.85315 7.36523 8.13392 7 9.5 7C13.6421 7 17 10.3579 17 14.5C17 18.6421 13.6421 22 9.5 22C5.35786 22 2 18.6421 2 14.5C2 13.1339 2.36523 11.8532 3.00337 10.75" stroke="#1C274C" stroke-width="1.5" stroke-linecap="round"/>',
|
|
||||||
viewBox: "0 0 24 24",
|
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
||||||
export let width = 16;
|
export let width = 16;
|
||||||
export let height = 16;
|
export let height = 16;
|
||||||
export let icon = "";
|
export let icon = "";
|
||||||
|
|||||||
@@ -1,6 +1,6 @@
|
|||||||
<script>
|
<script>
|
||||||
import { getContext } from "svelte";
|
import { getContext } from "svelte";
|
||||||
import axios from "axios";
|
import { apiPost } from "../../helpers";
|
||||||
|
|
||||||
const channel = getContext("channel");
|
const channel = getContext("channel");
|
||||||
export let selected;
|
export let selected;
|
||||||
@@ -9,29 +9,27 @@
|
|||||||
|
|
||||||
function deleteRecords(e) {
|
function deleteRecords(e) {
|
||||||
e.preventDefault();
|
e.preventDefault();
|
||||||
axios
|
apiPost(channel.lucentUrl + "/records/delete", {
|
||||||
.post(channel.lucentUrl + "/records/delete", {
|
|
||||||
ids: selected.map((s) => s.id),
|
ids: selected.map((s) => s.id),
|
||||||
})
|
})
|
||||||
.then((response) => {
|
.then((response) => {
|
||||||
window.location.reload();
|
window.location.reload();
|
||||||
})
|
})
|
||||||
.catch((error) => {
|
.catch((error) => {
|
||||||
console.error(error);
|
console.log(error);
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
function changeStatus(e, status) {
|
function changeStatus(e, status) {
|
||||||
axios
|
apiPost(channel.lucentUrl + "/records/status/" + status, {
|
||||||
.post(channel.lucentUrl + "/records/status/" + status, {
|
|
||||||
schemaName: schema.name,
|
schemaName: schema.name,
|
||||||
records: selected.map((s) => s.id),
|
records: selected,
|
||||||
})
|
})
|
||||||
.then((response) => {
|
.then((response) => {
|
||||||
window.location.reload();
|
window.location.reload();
|
||||||
})
|
})
|
||||||
.catch((error) => {
|
.catch((error) => {
|
||||||
console.error(error);
|
console.log(error);
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
</script>
|
</script>
|
||||||
@@ -41,28 +39,42 @@
|
|||||||
<button
|
<button
|
||||||
on:click|preventDefault={(e) => changeStatus(e, "published")}
|
on:click|preventDefault={(e) => changeStatus(e, "published")}
|
||||||
type="button"
|
type="button"
|
||||||
class="button">Publish
|
class="button"
|
||||||
</button
|
>Publish
|
||||||
>
|
</button>
|
||||||
<button
|
<button
|
||||||
on:click|preventDefault={(e) => changeStatus(e, "draft")}
|
on:click|preventDefault={(e) => changeStatus(e, "draft")}
|
||||||
type="button"
|
type="button"
|
||||||
class="button">Make Draft
|
class="button"
|
||||||
</button
|
>Make Draft
|
||||||
>
|
</button>
|
||||||
{#if filter["status_in"] === "trashed"}
|
{#if filter["status_in"] === "trashed"}
|
||||||
|
<button
|
||||||
|
on:click|preventDefault={(e) => changeStatus(e, "published")}
|
||||||
|
type="button"
|
||||||
|
class="button"
|
||||||
|
>Publish
|
||||||
|
</button>
|
||||||
|
{#if schema.hasDrafts}
|
||||||
|
<button
|
||||||
|
on:click|preventDefault={(e) => changeStatus(e, "draft")}
|
||||||
|
type="button"
|
||||||
|
class="button"
|
||||||
|
>Make Draft
|
||||||
|
</button>
|
||||||
|
{/if}
|
||||||
<button
|
<button
|
||||||
on:click|preventDefault={deleteRecords}
|
on:click|preventDefault={deleteRecords}
|
||||||
type="button"
|
type="button"
|
||||||
class="button">Delete forever
|
class="button"
|
||||||
</button
|
>Delete forever
|
||||||
>
|
</button>
|
||||||
{:else}
|
{:else}
|
||||||
<button
|
<button
|
||||||
type="button"
|
type="button"
|
||||||
on:click|preventDefault={(e) => changeStatus(e, "trashed")}
|
on:click|preventDefault={(e) => changeStatus(e, "trashed")}
|
||||||
class="button">Move to trash
|
class="button"
|
||||||
</button
|
>Move to trash
|
||||||
>
|
</button>
|
||||||
{/if}
|
{/if}
|
||||||
</div>
|
</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>
|
|
||||||
@@ -4,8 +4,8 @@
|
|||||||
import ActionsOnSelected from "./ActionsOnSelected.svelte";
|
import ActionsOnSelected from "./ActionsOnSelected.svelte";
|
||||||
import Table from "./Table.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 schema;
|
||||||
export let users;
|
export let users;
|
||||||
export let records;
|
export let records;
|
||||||
@@ -26,18 +26,17 @@
|
|||||||
|
|
||||||
function refresh(e) {
|
function refresh(e) {
|
||||||
const newUrl = e.detail;
|
const newUrl = e.detail;
|
||||||
axios
|
apiGet(newUrl)
|
||||||
.get(newUrl)
|
|
||||||
.then((response) => {
|
.then((response) => {
|
||||||
records = response.data.records;
|
records = response.records;
|
||||||
sortParam = response.data.sortParam;
|
sortParam = response.sortParam;
|
||||||
sortField = response.data.sortField;
|
sortField = response.sortField;
|
||||||
operators = response.data.operators;
|
operators = response.operators;
|
||||||
filter = response.data.filter;
|
filter = response.filter;
|
||||||
skip = response.data.skip;
|
skip = response.skip;
|
||||||
limit = response.data.limit;
|
limit = response.limit;
|
||||||
total = response.data.total;
|
total = response.total;
|
||||||
modalUrl = response.data.modalUrl;
|
modalUrl = response.modalUrl;
|
||||||
document.querySelector("dialog h3").scrollIntoView();
|
document.querySelector("dialog h3").scrollIntoView();
|
||||||
})
|
})
|
||||||
.catch((error) => {
|
.catch((error) => {
|
||||||
@@ -47,7 +46,7 @@
|
|||||||
</script>
|
</script>
|
||||||
|
|
||||||
<div class="">
|
<div class="">
|
||||||
<div class="{inModal ? 'mt-0' : 'mt-5'}">
|
<div class={inModal ? "mt-0" : "mt-5"}>
|
||||||
<h3 class="header-normal mb-5">
|
<h3 class="header-normal mb-5">
|
||||||
{schema.label}
|
{schema.label}
|
||||||
</h3>
|
</h3>
|
||||||
@@ -82,7 +81,6 @@
|
|||||||
{isWritable}
|
{isWritable}
|
||||||
bind:selected
|
bind:selected
|
||||||
/>
|
/>
|
||||||
|
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
<Pagination
|
<Pagination
|
||||||
@@ -94,4 +92,3 @@
|
|||||||
{modalUrl}
|
{modalUrl}
|
||||||
/>
|
/>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
@@ -12,7 +12,6 @@
|
|||||||
export let sortParam;
|
export let sortParam;
|
||||||
export let sortField;
|
export let sortField;
|
||||||
export let visibleColumns;
|
export let visibleColumns;
|
||||||
|
|
||||||
</script>
|
</script>
|
||||||
|
|
||||||
{#each visibleColumns as field, index}
|
{#each visibleColumns as field, index}
|
||||||
@@ -23,7 +22,7 @@
|
|||||||
<RenderField {record} {schema} {graph} {field} />
|
<RenderField {record} {schema} {graph} {field} />
|
||||||
</td>
|
</td>
|
||||||
{/each}
|
{/each}
|
||||||
{#if schema.visible?.includes("status")}
|
{#if schema.visible?.includes("_sys.status")}
|
||||||
<td
|
<td
|
||||||
class="text-center"
|
class="text-center"
|
||||||
class:is-sort={"-status" == sortParam || "status" == sortParam}
|
class:is-sort={"-status" == sortParam || "status" == sortParam}
|
||||||
@@ -34,26 +33,34 @@
|
|||||||
{#if schema.visible?.includes("_sys.createdBy")}
|
{#if schema.visible?.includes("_sys.createdBy")}
|
||||||
<td
|
<td
|
||||||
class="text-center"
|
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>
|
</td>
|
||||||
{/if}
|
{/if}
|
||||||
{#if schema.visible?.includes("_sys.updatedBy")}
|
{#if schema.visible?.includes("_sys.updatedBy")}
|
||||||
<td
|
<td
|
||||||
class="text-center"
|
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>
|
</td>
|
||||||
{/if}
|
{/if}
|
||||||
{#if schema.visible?.includes("_sys.createdAt")}
|
{#if schema.visible?.includes("_sys.createdAt")}
|
||||||
<td class:is-sort={"-_sys.createdAt" == sortParam || "_sys.createdAt" == sortParam}>
|
<td
|
||||||
{friendlyDate(record._sys.createdAt)}
|
class:is-sort={"-_sys.createdAt" == sortParam ||
|
||||||
|
"_sys.createdAt" == sortParam}
|
||||||
|
>
|
||||||
|
{friendlyDate(record.createdAt)}
|
||||||
</td>
|
</td>
|
||||||
{/if}
|
{/if}
|
||||||
{#if schema.visible?.includes("_sys.updatedAt")}
|
{#if schema.visible?.includes("_sys.updatedAt")}
|
||||||
<td class:is-sort={"-_sys.updatedAt" == sortParam || "_sys.updatedAt" == sortParam}>
|
<td
|
||||||
{friendlyDate(record._sys.updatedAt)}
|
class:is-sort={"-_sys.updatedAt" == sortParam ||
|
||||||
|
"_sys.updatedAt" == sortParam}
|
||||||
|
>
|
||||||
|
{friendlyDate(record.updatedAt)}
|
||||||
</td>
|
</td>
|
||||||
{/if}
|
{/if}
|
||||||
@@ -6,9 +6,11 @@
|
|||||||
import Number from "./elements/Number.svelte";
|
import Number from "./elements/Number.svelte";
|
||||||
|
|
||||||
import Text from "./elements/Text.svelte";
|
import Text from "./elements/Text.svelte";
|
||||||
|
import Url from "./elements/Url.svelte";
|
||||||
import Date from "./elements/Date.svelte";
|
import Date from "./elements/Date.svelte";
|
||||||
import Datetime from "./elements/Datetime.svelte";
|
import Datetime from "./elements/Datetime.svelte";
|
||||||
import File from "./elements/File.svelte";
|
import File from "./elements/File.svelte";
|
||||||
|
import Uuid from "./elements/UUID.svelte";
|
||||||
import Rich from "./elements/Rich.svelte";
|
import Rich from "./elements/Rich.svelte";
|
||||||
|
|
||||||
const renderElements = {
|
const renderElements = {
|
||||||
@@ -20,8 +22,10 @@
|
|||||||
checkbox: Checkbox,
|
checkbox: Checkbox,
|
||||||
reference: Reference,
|
reference: Reference,
|
||||||
number: Number,
|
number: Number,
|
||||||
|
url: Url,
|
||||||
date: Date,
|
date: Date,
|
||||||
datetime: Datetime,
|
datetime: Datetime,
|
||||||
|
uuid: Uuid,
|
||||||
file: File,
|
file: File,
|
||||||
};
|
};
|
||||||
export let field;
|
export let field;
|
||||||
|
|||||||
@@ -1,13 +1,10 @@
|
|||||||
<script>
|
<script>
|
||||||
import RecordRow from "./RecordRow.svelte";
|
import RecordRow from "./RecordRow.svelte";
|
||||||
import {previewTitle} from "../records/Preview";
|
|
||||||
import { usernameById } from "../account/users";
|
import { usernameById } from "../account/users";
|
||||||
import { getContext } from "svelte";
|
import { getContext } from "svelte";
|
||||||
import Avatar from "../account/Avatar.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 Checkbox from "../common/Checkbox.svelte";
|
||||||
import Preview from "../files/Preview.svelte";
|
|
||||||
import {fileurl} from "../files/imageserver.js";
|
|
||||||
|
|
||||||
const channel = getContext("channel");
|
const channel = getContext("channel");
|
||||||
|
|
||||||
@@ -23,14 +20,16 @@
|
|||||||
export let selected = [];
|
export let selected = [];
|
||||||
|
|
||||||
function eventToggleAll(e) {
|
function eventToggleAll(e) {
|
||||||
selected = toggleAll(e, records, selected)
|
selected = toggleAll(e, records, selected);
|
||||||
}
|
}
|
||||||
|
|
||||||
function select(record) {
|
function select(record) {
|
||||||
selected = selectRecord(record, selected)
|
selected = selectRecord(record, selected);
|
||||||
}
|
}
|
||||||
|
console.log(schema);
|
||||||
$: visibleColumns = schema.fields.filter(c => schema.visible?.includes(c.name) ?? [])
|
$: visibleColumns = schema.fields.filter(
|
||||||
|
(c) => schema.visible?.includes(c.name) ?? [],
|
||||||
|
);
|
||||||
</script>
|
</script>
|
||||||
|
|
||||||
<div class="table mt-5">
|
<div class="table mt-5">
|
||||||
@@ -42,10 +41,10 @@
|
|||||||
<Checkbox
|
<Checkbox
|
||||||
value=""
|
value=""
|
||||||
on:change={eventToggleAll}
|
on:change={eventToggleAll}
|
||||||
indeterminate={selected.length > 0 && selected.length < records.length}
|
indeterminate={selected.length > 0 &&
|
||||||
|
selected.length < records.length}
|
||||||
checked={selected.length === records.length}
|
checked={selected.length === records.length}
|
||||||
>
|
></Checkbox>
|
||||||
</Checkbox>
|
|
||||||
</th>
|
</th>
|
||||||
{/if}
|
{/if}
|
||||||
|
|
||||||
@@ -54,12 +53,13 @@
|
|||||||
class="field-ui-{field.info.name ?? field.ui}"
|
class="field-ui-{field.info.name ?? field.ui}"
|
||||||
class:is-sort={field.name === sortField.name}
|
class:is-sort={field.name === sortField.name}
|
||||||
scope="col"
|
scope="col"
|
||||||
title={field.help}
|
title={field.help}>{field.label}</th
|
||||||
>{field.label}</th
|
|
||||||
>
|
>
|
||||||
{/each}
|
{/each}
|
||||||
{#each systemFields.filter(c => schema.visible?.includes(c.name)) as sysField}
|
{#each systemFields.filter( (c) => schema.visible?.includes(c.name), ) as sysField}
|
||||||
<th class:is-sort={sysField.name === sortField.name}>{sysField.label}</th>
|
<th class:is-sort={sysField.name === sortField.name}
|
||||||
|
>{sysField.label}</th
|
||||||
|
>
|
||||||
{/each}
|
{/each}
|
||||||
<th></th>
|
<th></th>
|
||||||
</tr>
|
</tr>
|
||||||
@@ -68,59 +68,29 @@
|
|||||||
{#each records as record (record.id)}
|
{#each records as record (record.id)}
|
||||||
<tr>
|
<tr>
|
||||||
<td class="title-td">
|
<td class="title-td">
|
||||||
<div
|
<div class="title-td-contents">
|
||||||
class="title-td-contents"
|
|
||||||
>
|
|
||||||
{#if isWritable}
|
{#if isWritable}
|
||||||
<Checkbox
|
<Checkbox
|
||||||
on:change={() => select(record)}
|
on:change={() => select(record)}
|
||||||
checked={selected.find((r) => r.id === record.id)}
|
checked={selected.find(
|
||||||
|
(r) => r.id === record.id,
|
||||||
|
)}
|
||||||
value={record}
|
value={record}
|
||||||
>
|
></Checkbox>
|
||||||
</Checkbox>
|
|
||||||
|
|
||||||
{/if}
|
{/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
|
<a
|
||||||
href="{channel.lucentUrl}/records/{record.id}"
|
href="{channel.lucentUrl}/records/{record.id}"
|
||||||
target={inModal ? "_blank" : "_self"}
|
target={inModal ? "_blank" : "_self"}
|
||||||
>
|
>
|
||||||
{#if record.status === "draft"}
|
{#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}
|
{/if}
|
||||||
{previewTitle(channel.schemas, record, graph)}
|
{record.data.name}
|
||||||
</a>
|
</a>
|
||||||
{/if}
|
|
||||||
|
|
||||||
|
|
||||||
</div>
|
</div>
|
||||||
</td>
|
</td>
|
||||||
<RecordRow
|
<RecordRow
|
||||||
@@ -134,10 +104,7 @@
|
|||||||
/>
|
/>
|
||||||
<td>
|
<td>
|
||||||
<Avatar
|
<Avatar
|
||||||
name={usernameById(
|
name={usernameById(users, record.updatedBy)}
|
||||||
users,
|
|
||||||
record._sys.updatedBy
|
|
||||||
)}
|
|
||||||
side={24}
|
side={24}
|
||||||
/>
|
/>
|
||||||
</td>
|
</td>
|
||||||
@@ -146,4 +113,3 @@
|
|||||||
</tbody>
|
</tbody>
|
||||||
</table>
|
</table>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
@@ -0,0 +1,10 @@
|
|||||||
|
<script>
|
||||||
|
export let value;
|
||||||
|
</script>
|
||||||
|
<span
|
||||||
|
class="badge rounded-pill bg-primary bg-opacity-75"
|
||||||
|
style="max-width:64px; overflow:hidden; white-space: nowrap; text-overflow: ellipsis;"
|
||||||
|
title={value}
|
||||||
|
data-bs-toggle="tooltip"
|
||||||
|
>{value}</span
|
||||||
|
>
|
||||||
@@ -0,0 +1,5 @@
|
|||||||
|
<script>
|
||||||
|
export let value;
|
||||||
|
</script>
|
||||||
|
|
||||||
|
<a href={value} target="_blank">{value}</a>
|
||||||
@@ -1,7 +1,7 @@
|
|||||||
<script>
|
<script>
|
||||||
import { createEventDispatcher } from "svelte";
|
import { createEventDispatcher } from "svelte";
|
||||||
const dispatch = createEventDispatcher();
|
const dispatch = createEventDispatcher();
|
||||||
import { range } from "../../../helpers.js";
|
|
||||||
import NavItem from "./NavItem.svelte";
|
import NavItem from "./NavItem.svelte";
|
||||||
export let inModal;
|
export let inModal;
|
||||||
export let modalUrl;
|
export let modalUrl;
|
||||||
@@ -11,7 +11,11 @@
|
|||||||
|
|
||||||
$: totalPages = Math.ceil(total / limit);
|
$: totalPages = Math.ceil(total / limit);
|
||||||
$: currentPage = Math.ceil((skip - 1) / limit) + 1;
|
$: 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) => {
|
$: pageRange = range(currentPage - 3, currentPage + 4).filter((i) => {
|
||||||
return i > 0 && i <= totalPages;
|
return i > 0 && i <= totalPages;
|
||||||
});
|
});
|
||||||
|
|||||||
@@ -1,9 +1,7 @@
|
|||||||
<script>
|
<script>
|
||||||
import { createEventDispatcher, getContext } from "svelte";
|
import { createEventDispatcher, getContext } from "svelte";
|
||||||
import {previewTitle} from "../../records/Preview";
|
|
||||||
import Icon from "../../common/Icon.svelte";
|
import Icon from "../../common/Icon.svelte";
|
||||||
|
|
||||||
const channel = getContext("channel");
|
|
||||||
const dispatch = createEventDispatcher();
|
const dispatch = createEventDispatcher();
|
||||||
export let schema;
|
export let schema;
|
||||||
export let operators;
|
export let operators;
|
||||||
@@ -19,13 +17,10 @@
|
|||||||
isReference: key.startsWith("children"),
|
isReference: key.startsWith("children"),
|
||||||
};
|
};
|
||||||
|
|
||||||
filter = [
|
filter = [extractOperator(key), extractLabel(schema, key)].reduce(
|
||||||
extractOperator(key),
|
(mem, fn) => fn(mem),
|
||||||
extractLabel(schema, key),
|
filter,
|
||||||
].reduce((mem, fn) => fn(mem), filter);
|
);
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
function extractOperator(key) {
|
function extractOperator(key) {
|
||||||
return (filter) => {
|
return (filter) => {
|
||||||
@@ -50,18 +45,16 @@
|
|||||||
const filterField = schema.fields.find((f) => f.name === fieldName);
|
const filterField = schema.fields.find((f) => f.name === fieldName);
|
||||||
filter.label = filterField?.label ?? fieldName;
|
filter.label = filterField?.label ?? fieldName;
|
||||||
return filter;
|
return filter;
|
||||||
}
|
};
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
const filterRecord = extractFilterRecord(graph, value);
|
const filterRecord = extractFilterRecord(graph, value);
|
||||||
|
|
||||||
function extractFilterRecord(graph, value) {
|
function extractFilterRecord(graph, value) {
|
||||||
|
|
||||||
if (!filter.isReference) {
|
if (!filter.isReference) {
|
||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
return graph.records.find(r => r.id === value);
|
return graph.records.find((r) => r.id === value);
|
||||||
}
|
}
|
||||||
|
|
||||||
function removeFilter(k) {
|
function removeFilter(k) {
|
||||||
@@ -78,11 +71,14 @@
|
|||||||
</script>
|
</script>
|
||||||
|
|
||||||
<span class="applied-filter">
|
<span class="applied-filter">
|
||||||
|
|
||||||
{#if filter.isReference && filterRecord}
|
{#if filter.isReference && filterRecord}
|
||||||
{filter.label} is {previewTitle(channel.schemas, filterRecord)}
|
{filter.label} is {filterRecord.data.name}
|
||||||
{:else}
|
{: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}
|
{/if}
|
||||||
|
|
||||||
<button
|
<button
|
||||||
@@ -90,7 +86,6 @@
|
|||||||
type="button"
|
type="button"
|
||||||
class="button-text"
|
class="button-text"
|
||||||
aria-label="Close"
|
aria-label="Close"
|
||||||
><Icon width={12} height={12} icon="close"></Icon></button>
|
><Icon width={12} height={12} icon="close"></Icon></button
|
||||||
|
>
|
||||||
</span>
|
</span>
|
||||||
|
|
||||||
|
|
||||||
@@ -1,8 +1,6 @@
|
|||||||
<script>
|
<script>
|
||||||
import { createEventDispatcher, getContext } from "svelte";
|
import { createEventDispatcher, getContext } from "svelte";
|
||||||
import {debounce} from "../../../debounce.js";
|
import { apiGet, debounce } from "../../../helpers";
|
||||||
import {previewTitle} from "../../records/Preview";
|
|
||||||
import axios from "axios";
|
|
||||||
|
|
||||||
const channel = getContext("channel");
|
const channel = getContext("channel");
|
||||||
const dispatch = createEventDispatcher();
|
const dispatch = createEventDispatcher();
|
||||||
@@ -10,13 +8,11 @@
|
|||||||
export let value = "";
|
export let value = "";
|
||||||
export let field;
|
export let field;
|
||||||
|
|
||||||
let search = ""
|
let search = "";
|
||||||
$: searchOptions = []
|
$: searchOptions = [];
|
||||||
|
|
||||||
|
|
||||||
const updateResults = debounce((e) => {
|
const updateResults = debounce((e) => {
|
||||||
axios
|
apiGet(channel.lucentUrl + "/records/suggestions", {
|
||||||
.get(channel.lucentUrl + "/records/suggestions", {
|
|
||||||
params: {
|
params: {
|
||||||
schema: field.collections[0],
|
schema: field.collections[0],
|
||||||
field: "search",
|
field: "search",
|
||||||
@@ -25,7 +21,7 @@
|
|||||||
},
|
},
|
||||||
})
|
})
|
||||||
.then((response) => {
|
.then((response) => {
|
||||||
searchOptions = response.data;
|
searchOptions = response;
|
||||||
})
|
})
|
||||||
.catch((error) => {
|
.catch((error) => {
|
||||||
searchOptions = [];
|
searchOptions = [];
|
||||||
@@ -35,13 +31,12 @@
|
|||||||
|
|
||||||
function apply(e, newOption) {
|
function apply(e, newOption) {
|
||||||
e.preventDefault();
|
e.preventDefault();
|
||||||
value = newOption.id
|
value = newOption.id;
|
||||||
dispatch("addFilter");
|
dispatch("addFilter");
|
||||||
value = ""
|
value = "";
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
</script>
|
</script>
|
||||||
|
|
||||||
<div class="reference-tags">
|
<div class="reference-tags">
|
||||||
<input
|
<input
|
||||||
type="search"
|
type="search"
|
||||||
@@ -52,7 +47,6 @@
|
|||||||
/>
|
/>
|
||||||
|
|
||||||
<div class="reference-tags-results">
|
<div class="reference-tags-results">
|
||||||
|
|
||||||
{#if searchOptions}
|
{#if searchOptions}
|
||||||
{#each searchOptions as option (option.id)}
|
{#each searchOptions as option (option.id)}
|
||||||
<div
|
<div
|
||||||
@@ -62,19 +56,11 @@
|
|||||||
on:click={(e) => apply(e, option)}
|
on:click={(e) => apply(e, option)}
|
||||||
on:keypress={(e) => apply(e, option)}
|
on:keypress={(e) => apply(e, option)}
|
||||||
>
|
>
|
||||||
{previewTitle(channel.schemas, option)}
|
{option.data.name}
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
{:else}
|
{:else}
|
||||||
<div
|
<div class="start-typing">Start typing...</div>
|
||||||
class="start-typing">
|
|
||||||
Start typing...
|
|
||||||
</div>
|
|
||||||
{/each}
|
{/each}
|
||||||
{/if}
|
{/if}
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
@@ -1,6 +1,5 @@
|
|||||||
<script>
|
<script>
|
||||||
import FilterFields from "./FilterFields.svelte";
|
import FilterFields from "./FilterFields.svelte";
|
||||||
import Uploader from "../../files/Uploader.svelte";
|
|
||||||
import Icon from "../../common/Icon.svelte";
|
import Icon from "../../common/Icon.svelte";
|
||||||
import SortFields from "./SortFields.svelte";
|
import SortFields from "./SortFields.svelte";
|
||||||
import AppliedFilter from "./AppliedFilter.svelte";
|
import AppliedFilter from "./AppliedFilter.svelte";
|
||||||
@@ -41,17 +40,11 @@
|
|||||||
} else {
|
} else {
|
||||||
window.location = url;
|
window.location = url;
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
|
||||||
|
|
||||||
function uploadComplete(e) {
|
|
||||||
records = e.detail;
|
|
||||||
}
|
}
|
||||||
</script>
|
</script>
|
||||||
|
|
||||||
<div class="toolbar">
|
<div class="toolbar">
|
||||||
<div class="toolbar-filters">
|
<div class="toolbar-filters">
|
||||||
|
|
||||||
<SortFields
|
<SortFields
|
||||||
{schema}
|
{schema}
|
||||||
{sortParam}
|
{sortParam}
|
||||||
@@ -62,7 +55,6 @@
|
|||||||
on:refresh
|
on:refresh
|
||||||
/>
|
/>
|
||||||
|
|
||||||
|
|
||||||
<FilterFields
|
<FilterFields
|
||||||
bind:schema
|
bind:schema
|
||||||
{systemFields}
|
{systemFields}
|
||||||
@@ -74,15 +66,17 @@
|
|||||||
/>
|
/>
|
||||||
|
|
||||||
<form method="GET" on:submit={search}>
|
<form method="GET" on:submit={search}>
|
||||||
<input type="search" name="filter[search_regex]" placeholder="Search"
|
<input
|
||||||
class="search" required>
|
type="search"
|
||||||
|
name="filter[search_regex]"
|
||||||
|
placeholder="Search"
|
||||||
|
class="search"
|
||||||
|
required
|
||||||
|
/>
|
||||||
</form>
|
</form>
|
||||||
|
|
||||||
|
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
<div style="display:flex;align-items: center;gap:4px">
|
<div style="display:flex;align-items: center;gap:4px">
|
||||||
{#if schema.type === "collection"}
|
|
||||||
{#if !inModal && isWritable}
|
{#if !inModal && isWritable}
|
||||||
<a
|
<a
|
||||||
href="{channel.lucentUrl}/records/new?schema={schema.name}"
|
href="{channel.lucentUrl}/records/new?schema={schema.name}"
|
||||||
@@ -91,11 +85,7 @@
|
|||||||
New Record
|
New Record
|
||||||
</a>
|
</a>
|
||||||
{/if}
|
{/if}
|
||||||
{:else }
|
|
||||||
<div>
|
|
||||||
<Uploader {schema} on:uploadComplete={uploadComplete}/>
|
|
||||||
</div>
|
|
||||||
{/if}
|
|
||||||
{#if !inModal}
|
{#if !inModal}
|
||||||
<Dropdown orientation="right">
|
<Dropdown orientation="right">
|
||||||
<div slot="button">
|
<div slot="button">
|
||||||
@@ -111,12 +101,7 @@
|
|||||||
</a>
|
</a>
|
||||||
{/if}
|
{/if}
|
||||||
{:else}
|
{:else}
|
||||||
|
<a class="dropdown-item" href={csvUrl}>Export to CSV</a>
|
||||||
<a
|
|
||||||
class="dropdown-item"
|
|
||||||
href={csvUrl}
|
|
||||||
>Export to CSV</a
|
|
||||||
>
|
|
||||||
<a
|
<a
|
||||||
class="dropdown-item"
|
class="dropdown-item"
|
||||||
href="{channel.lucentUrl}/content/{schema.name}?filter[status_in]=trashed"
|
href="{channel.lucentUrl}/content/{schema.name}?filter[status_in]=trashed"
|
||||||
@@ -129,17 +114,12 @@
|
|||||||
>
|
>
|
||||||
{/if}
|
{/if}
|
||||||
</Dropdown>
|
</Dropdown>
|
||||||
|
|
||||||
{/if}
|
{/if}
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
|
|
||||||
<div class="applied-filters">
|
<div class="applied-filters">
|
||||||
<AppliedFilterNotLinked
|
<AppliedFilterNotLinked {inModal} {modalUrl} on:refresh
|
||||||
{inModal}
|
|
||||||
{modalUrl}
|
|
||||||
on:refresh
|
|
||||||
></AppliedFilterNotLinked>
|
></AppliedFilterNotLinked>
|
||||||
{#if Object.entries(filter).length > 0}
|
{#if Object.entries(filter).length > 0}
|
||||||
{#each Object.entries(filter) as [k, v]}
|
{#each Object.entries(filter) as [k, v]}
|
||||||
@@ -156,5 +136,3 @@
|
|||||||
{/each}
|
{/each}
|
||||||
{/if}
|
{/if}
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
|
|
||||||
@@ -1,9 +1,8 @@
|
|||||||
<script>
|
<script>
|
||||||
|
|
||||||
import { createEventDispatcher, getContext } from "svelte";
|
import { createEventDispatcher, getContext } from "svelte";
|
||||||
import Icon from "../common/Icon.svelte";
|
import Icon from "../common/Icon.svelte";
|
||||||
import Index from "../content/Index.svelte";
|
import Index from "../content/Index.svelte";
|
||||||
import axios from "axios";
|
import { apiGet } from "../../helpers";
|
||||||
|
|
||||||
let dialogEl;
|
let dialogEl;
|
||||||
|
|
||||||
@@ -15,21 +14,19 @@
|
|||||||
// load();
|
// load();
|
||||||
// });
|
// });
|
||||||
|
|
||||||
|
|
||||||
export function close(e) {
|
export function close(e) {
|
||||||
if (e) {
|
if (e) {
|
||||||
e.preventDefault();
|
e.preventDefault();
|
||||||
}
|
}
|
||||||
|
|
||||||
dialogEl.close()
|
dialogEl.close();
|
||||||
selectedRecords = [];
|
selectedRecords = [];
|
||||||
}
|
}
|
||||||
|
|
||||||
function load(schema) {
|
function load(schema) {
|
||||||
axios
|
apiGet(channel.lucentUrl + "/content/" + schema)
|
||||||
.get(channel.lucentUrl + "/content/" + schema)
|
|
||||||
.then((response) => {
|
.then((response) => {
|
||||||
data = response.data;
|
data = response;
|
||||||
})
|
})
|
||||||
.catch((error) => console.log(error));
|
.catch((error) => console.log(error));
|
||||||
}
|
}
|
||||||
@@ -52,12 +49,11 @@
|
|||||||
}
|
}
|
||||||
|
|
||||||
export function open(schema) {
|
export function open(schema) {
|
||||||
dialogEl.showModal()
|
dialogEl.showModal();
|
||||||
load(schema);
|
load(schema);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
</script>
|
</script>
|
||||||
|
|
||||||
<dialog bind:this={dialogEl}>
|
<dialog bind:this={dialogEl}>
|
||||||
{#if data.schema}
|
{#if data.schema}
|
||||||
<div class="dialog-header">
|
<div class="dialog-header">
|
||||||
@@ -96,6 +92,5 @@
|
|||||||
<div class="dialog-body">
|
<div class="dialog-body">
|
||||||
<Index {...data} bind:selected={selectedRecords}></Index>
|
<Index {...data} bind:selected={selectedRecords}></Index>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
{/if}
|
{/if}
|
||||||
</dialog>
|
</dialog>
|
||||||
@@ -0,0 +1,87 @@
|
|||||||
|
<script>
|
||||||
|
import { createEventDispatcher, getContext } from "svelte";
|
||||||
|
import Icon from "../common/Icon.svelte";
|
||||||
|
import FileIndex from "./FileIndex.svelte";
|
||||||
|
|
||||||
|
let dialogEl;
|
||||||
|
|
||||||
|
const dispatch = createEventDispatcher();
|
||||||
|
const channel = getContext("channel");
|
||||||
|
$: files = [];
|
||||||
|
$: selectedRecords = [];
|
||||||
|
// onMount(() => {
|
||||||
|
// load();
|
||||||
|
// });
|
||||||
|
|
||||||
|
export function close(e) {
|
||||||
|
if (e) {
|
||||||
|
e.preventDefault();
|
||||||
|
}
|
||||||
|
|
||||||
|
dialogEl.close();
|
||||||
|
selectedRecords = [];
|
||||||
|
}
|
||||||
|
|
||||||
|
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) {
|
||||||
|
e.preventDefault();
|
||||||
|
dispatch("insert_files", selectedRecords);
|
||||||
|
}
|
||||||
|
|
||||||
|
function replace(e) {
|
||||||
|
e.preventDefault();
|
||||||
|
dispatch("replace_files", selectedRecords);
|
||||||
|
}
|
||||||
|
|
||||||
|
export function open(recordId) {
|
||||||
|
dialogEl.showModal();
|
||||||
|
load(recordId);
|
||||||
|
}
|
||||||
|
</script>
|
||||||
|
|
||||||
|
<dialog bind:this={dialogEl}>
|
||||||
|
<div class="dialog-header">
|
||||||
|
<button
|
||||||
|
type="button"
|
||||||
|
class="button"
|
||||||
|
on:click={insert}
|
||||||
|
disabled={selectedRecords.length === 0}
|
||||||
|
>
|
||||||
|
Insert
|
||||||
|
</button>
|
||||||
|
<button
|
||||||
|
type="button"
|
||||||
|
class="button"
|
||||||
|
on:click={replace}
|
||||||
|
disabled={selectedRecords.length === 0}
|
||||||
|
>
|
||||||
|
Replace
|
||||||
|
</button>
|
||||||
|
{#if selectedRecords.length > 0}
|
||||||
|
<span class="">
|
||||||
|
{selectedRecords.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={selectedRecords}></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) {
|
export function sortByField(from, to, edges, fieldName, references) {
|
||||||
if (from === to) {
|
if (from === to) {
|
||||||
return edges;
|
return edges;
|
||||||
}
|
}
|
||||||
let referenceIds = references.map(r => r.record.id);
|
let referenceIds = references.map((r) => r.id);
|
||||||
let edgesTosort = edges?.filter((ed) => ed.field === fieldName && ed.depth === 1 && referenceIds.includes(ed.target)) ?? [];
|
let edgesTosort =
|
||||||
let remainingEdge = edges?.filter((ed) => !(ed.field === fieldName && ed.depth === 1)) ?? [];
|
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];
|
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) {
|
if (new_index >= arr.length) {
|
||||||
var k = new_index - arr.length + 1;
|
var k = new_index - arr.length + 1;
|
||||||
while (k--) {
|
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]);
|
arr.splice(new_index, 0, arr.splice(old_index, 1)[0]);
|
||||||
return arr; // for testing
|
return arr; // for testing
|
||||||
};
|
}
|
||||||
@@ -3,13 +3,15 @@
|
|||||||
import { imgurl } from "./imageserver.js";
|
import { imgurl } from "./imageserver.js";
|
||||||
import { getContext } from "svelte";
|
import { getContext } from "svelte";
|
||||||
|
|
||||||
export let record;
|
export let file;
|
||||||
const channel = getContext("channel");
|
const channel = getContext("channel");
|
||||||
export let size = "small";
|
export let size = "small";
|
||||||
export let showFilename = false;
|
export let showFilename = false;
|
||||||
let imageSide;
|
let imageSide;
|
||||||
let fileSide;
|
let fileSide;
|
||||||
let fontSize;
|
let fontSize;
|
||||||
|
|
||||||
|
console.log({ channel });
|
||||||
if (size == "large") {
|
if (size == "large") {
|
||||||
imageSide = 256;
|
imageSide = 256;
|
||||||
fileSide = 32;
|
fileSide = 32;
|
||||||
@@ -28,43 +30,43 @@
|
|||||||
fontSize = "13";
|
fontSize = "13";
|
||||||
}
|
}
|
||||||
</script>
|
</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)} -->
|
<!-- href={imgurl(record)} -->
|
||||||
<a
|
<a
|
||||||
href="{channel.lucentUrl}/records/{record.id}"
|
href="{channel.lucentUrl}/files/{file.id}"
|
||||||
title={record._file.originalName}
|
title={file.filename}
|
||||||
style="width:{imageSide}px;height:{imageSide}px"
|
style="width:{imageSide}px;height:{imageSide}px"
|
||||||
>
|
>
|
||||||
<img
|
<img
|
||||||
class="rounded w-100"
|
class="rounded w-100"
|
||||||
src={imgurl(channel,record)}
|
src={imgurl(channel, file)}
|
||||||
alt={record._file.path}
|
alt={file.path}
|
||||||
/>
|
/>
|
||||||
</a>
|
</a>
|
||||||
{:else}
|
{:else}
|
||||||
<a
|
<a
|
||||||
href="{channel.lucentUrl}/records/{record.id}"
|
href="{channel.lucentUrl}/files/{file.id}"
|
||||||
title={record._file.path}
|
title={file.path}
|
||||||
class="file-preview-small"
|
class="file-preview-small"
|
||||||
style="width:{imageSide}px;height:{imageSide}px"
|
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"
|
<span class="ms-2"
|
||||||
>.{record._file.path.split(".").pop().toLowerCase()}</span
|
>.{file.path.split(".").pop().toLowerCase()}</span
|
||||||
>
|
>
|
||||||
</a>
|
</a>
|
||||||
{/if}
|
{/if}
|
||||||
{/if}
|
{/if}
|
||||||
{#if showFilename}
|
{#if showFilename}
|
||||||
<a
|
<a
|
||||||
href="{channel.lucentUrl}/records/{record.id}"
|
href="{channel.lucentUrl}/files/{file.id}"
|
||||||
title={record._file.path}
|
title={file.path}
|
||||||
class="preview-file-filename lx-small-text text-decoration-none"
|
class="preview-file-filename lx-small-text text-decoration-none"
|
||||||
>{record._file.path} </a
|
>{file.path}
|
||||||
>
|
</a>
|
||||||
{/if}
|
{/if}
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
@@ -73,5 +75,4 @@
|
|||||||
border-radius: 12px;
|
border-radius: 12px;
|
||||||
padding: 4px;
|
padding: 4px;
|
||||||
}
|
}
|
||||||
|
|
||||||
</style>
|
</style>
|
||||||
@@ -4,7 +4,7 @@
|
|||||||
const dispatch = createEventDispatcher();
|
const dispatch = createEventDispatcher();
|
||||||
|
|
||||||
const channel = getContext("channel");
|
const channel = getContext("channel");
|
||||||
export let schema;
|
export let recordId;
|
||||||
let mimeTypes = "";
|
let mimeTypes = "";
|
||||||
let files = [];
|
let files = [];
|
||||||
let isLoading = false;
|
let isLoading = false;
|
||||||
@@ -17,28 +17,28 @@
|
|||||||
files = e.target.files ? [...e.target.files] : [];
|
files = e.target.files ? [...e.target.files] : [];
|
||||||
let formData = new FormData();
|
let formData = new FormData();
|
||||||
|
|
||||||
formData.append("schema", schema.name);
|
formData.append("recordId", recordId);
|
||||||
Array.from(files).forEach(function (file) {
|
Array.from(files).forEach(function (file) {
|
||||||
formData.append("files[]", file);
|
formData.append("files[]", file);
|
||||||
});
|
});
|
||||||
dispatch("beforeUpload", files);
|
dispatch("beforeUpload", files);
|
||||||
axios
|
fetch(channel.lucentUrl + "/files/upload", {
|
||||||
.post(channel.lucentUrl + "/files/upload", formData, {
|
method: "POST",
|
||||||
|
body: formData,
|
||||||
headers: {
|
headers: {
|
||||||
"Content-Type": "multipart/form-data",
|
"X-CSRF-TOKEN": document.querySelector(
|
||||||
|
'meta[name="csrf-token"]',
|
||||||
|
).content,
|
||||||
},
|
},
|
||||||
})
|
})
|
||||||
.then((response) => {
|
.then((response) => response.json())
|
||||||
if (response.data.error) {
|
.then((data) => {
|
||||||
dispatch("uploadError", response.data.error);
|
if (data.error) {
|
||||||
|
dispatch("uploadError", data.error);
|
||||||
} else {
|
} else {
|
||||||
dispatch("uploadComplete", response.data);
|
dispatch("uploadComplete", data);
|
||||||
}
|
}
|
||||||
isLoading = false;
|
isLoading = false;
|
||||||
})
|
|
||||||
.catch((error) => {
|
|
||||||
isLoading = false;
|
|
||||||
console.log(error.response.data);
|
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
</script>
|
</script>
|
||||||
|
|||||||
@@ -1,31 +1,28 @@
|
|||||||
export function imgurl(channel, record) {
|
export function imgurl(channel, file) {
|
||||||
if (record._file.mime === "image/svg+xml") {
|
if (file.mime === "image/svg+xml") {
|
||||||
return fileurl(channel, record);
|
return fileurl(channel, file);
|
||||||
}
|
}
|
||||||
const pathAr = record._file.path.split("/");
|
return channel.filesUrl + `/thumbs/${file.path}`;
|
||||||
return channel.disks[record._file.disk] + `/${pathAr[0]}/thumbs/${pathAr[1]}`;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
export function fileurl(channel, record) {
|
export function fileurl(channel, file) {
|
||||||
return channel.disks[record._file.disk] + `/${record._file.path}`;
|
return channel.filesUrl + `/${file.path}`;
|
||||||
}
|
}
|
||||||
|
|
||||||
export function htmlurl(channel, record, preset) {
|
export function htmlurl(channel, file, preset) {
|
||||||
|
|
||||||
let html = "";
|
let html = "";
|
||||||
let url = fileurl(channel, record)
|
let url = fileurl(channel, file);
|
||||||
|
|
||||||
if (record._file.width > 0) {
|
if (file.width > 0) {
|
||||||
let presetUrl = url;
|
let presetUrl = url;
|
||||||
if (preset) {
|
if (preset) {
|
||||||
const pathAr = record._file.path.split("/");
|
presetUrl = channel.filesUrl + `/templates/${preset}/${file.path}`;
|
||||||
presetUrl = channel.disks[record._file.disk] + `/${pathAr[0]}/templates/${preset}/${pathAr[1]}`;
|
|
||||||
}
|
}
|
||||||
html = `<img src="${presetUrl}" alt="${record._file.path}" />`
|
html = `<img src="${presetUrl}" alt="${file.path}" />`;
|
||||||
} else if (record._file.mime === "image/svg+xml") {
|
} else if (file.mime === "image/svg+xml") {
|
||||||
html = `<img src="${url}" alt="${record._file.path}"/>`
|
html = `<img src="${url}" alt="${file.path}"/>`;
|
||||||
} else {
|
} else {
|
||||||
html = `<a href="${url}">${record._file.originalName}</a>`
|
html = `<a href="${url}">${file.originalName}</a>`;
|
||||||
}
|
}
|
||||||
|
|
||||||
return html;
|
return html;
|
||||||
|
|||||||
@@ -1,19 +1,17 @@
|
|||||||
<script>
|
<script>
|
||||||
|
|
||||||
import { getContext, onMount } from "svelte";
|
import { getContext, onMount } from "svelte";
|
||||||
import RecordRow from "./RecordRow.svelte"
|
import RecordRow from "./RecordRow.svelte";
|
||||||
|
import { apiGet } from "../../helpers";
|
||||||
|
|
||||||
const channel = getContext("channel");
|
const channel = getContext("channel");
|
||||||
let records = [];
|
let records = [];
|
||||||
let graph = null;
|
let graph = null;
|
||||||
let users = [];
|
let users = [];
|
||||||
onMount(() => {
|
onMount(() => {
|
||||||
axios
|
apiGet(channel.lucentUrl + "/home/records")
|
||||||
.get(channel.lucentUrl + "/home/records")
|
.then((data) => {
|
||||||
.then((response) => {
|
records = data.records;
|
||||||
records = response.data.records;
|
users = data.users;
|
||||||
graph = response.data.graph;
|
|
||||||
users = response.data.users;
|
|
||||||
})
|
})
|
||||||
.catch((error) => {
|
.catch((error) => {
|
||||||
console.log(error);
|
console.log(error);
|
||||||
@@ -21,21 +19,17 @@
|
|||||||
});
|
});
|
||||||
</script>
|
</script>
|
||||||
|
|
||||||
|
|
||||||
<h3 class="header-small mb-4 mt-5">Latest Content changes</h3>
|
<h3 class="header-small mb-4 mt-5">Latest Content changes</h3>
|
||||||
{#if records.length > 0}
|
{#if records.length > 0}
|
||||||
|
|
||||||
<div class="table">
|
<div class="table">
|
||||||
<table class="">
|
<table class="">
|
||||||
<tbody>
|
<tbody>
|
||||||
{#each records as record (record.id)}
|
{#each records as record (record.id)}
|
||||||
<tr>
|
<tr>
|
||||||
<RecordRow {graph} {record} {users}/>
|
<RecordRow {record} {users} />
|
||||||
</tr>
|
</tr>
|
||||||
{/each}
|
{/each}
|
||||||
</tbody>
|
</tbody>
|
||||||
</table>
|
</table>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
{/if}
|
{/if}
|
||||||
|
|
||||||
@@ -1,20 +1,17 @@
|
|||||||
<script>
|
<script>
|
||||||
import { formatDistanceToNow, parseJSON } from "date-fns";
|
import { formatDistanceToNow, parseJSON } from "date-fns";
|
||||||
import Avatar from "../account/Avatar.svelte";
|
import Avatar from "../account/Avatar.svelte";
|
||||||
import {previewTitle} from "../records/Preview";
|
|
||||||
import Preview from "../files/Preview.svelte";
|
import Preview from "../files/Preview.svelte";
|
||||||
import { usernameById } from "../account/users";
|
import { usernameById } from "../account/users";
|
||||||
import { getContext } from "svelte";
|
import { getContext } from "svelte";
|
||||||
|
|
||||||
const channel = getContext("channel");
|
const channel = getContext("channel");
|
||||||
export let users;
|
export let users;
|
||||||
export let graph;
|
|
||||||
export let record;
|
export let record;
|
||||||
let schema = channel.schemas.find((s) => s.name === record.schema);
|
let schema = channel.schemas.find((s) => s.name === record.schema);
|
||||||
let frieldlyUpdatedAt = formatDistanceToNow(
|
let frieldlyUpdatedAt = formatDistanceToNow(parseJSON(record.updatedAt), {
|
||||||
parseJSON(record._sys.updatedAt),
|
addSuffix: true,
|
||||||
{addSuffix: true}
|
});
|
||||||
);
|
|
||||||
</script>
|
</script>
|
||||||
|
|
||||||
<td>
|
<td>
|
||||||
@@ -25,24 +22,17 @@
|
|||||||
{#if schema.type === "files"}
|
{#if schema.type === "files"}
|
||||||
<Preview {record} size="tiny" showFilename={true} />
|
<Preview {record} size="tiny" showFilename={true} />
|
||||||
{:else}
|
{:else}
|
||||||
<a
|
<a href="{channel.lucentUrl}/records/{record.id}">
|
||||||
href="{channel.lucentUrl}/records/{record.id}"
|
{record.data.name}
|
||||||
|
|
||||||
>
|
|
||||||
{previewTitle(channel.schemas, record, graph)}
|
|
||||||
</a>
|
</a>
|
||||||
{/if}
|
{/if}
|
||||||
</div>
|
</div>
|
||||||
</td>
|
</td>
|
||||||
<td><a
|
<td><a href="{channel.lucentUrl}/content/{schema.name}">{schema.label}</a> </td>
|
||||||
href="{channel.lucentUrl}/content/{schema.name}">{schema.label}</a
|
|
||||||
>
|
|
||||||
</td>
|
|
||||||
|
|
||||||
|
|
||||||
<td>
|
<td>
|
||||||
<div style="display: flex;gap: 14px">
|
<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">
|
<div class="ms-2">
|
||||||
{frieldlyUpdatedAt}
|
{frieldlyUpdatedAt}
|
||||||
</div>
|
</div>
|
||||||
|
|||||||
@@ -1,39 +0,0 @@
|
|||||||
<script>
|
|
||||||
import {getContext} from "svelte";
|
|
||||||
import Icon from "../common/Icon.svelte";
|
|
||||||
import Folder from "./Folder.svelte";
|
|
||||||
|
|
||||||
const channel = getContext("channel");
|
|
||||||
export let folder;
|
|
||||||
export let schema;
|
|
||||||
export let expanded = folder.shouldExpand;
|
|
||||||
|
|
||||||
function toggleExpand() {
|
|
||||||
expanded = !expanded;
|
|
||||||
}
|
|
||||||
</script>
|
|
||||||
<div class="sidebar-folder">
|
|
||||||
{#if folder.name !== ""}
|
|
||||||
<button class="sidebar-header" tabindex="0" on:click={toggleExpand}>
|
|
||||||
{folder.name.replaceAll("_", " ") ?? "Main"}
|
|
||||||
{#if expanded}
|
|
||||||
<Icon icon="circle-chevron-up"></Icon>
|
|
||||||
{:else}
|
|
||||||
<Icon icon="circle-chevron-down"></Icon>
|
|
||||||
{/if}
|
|
||||||
</button>
|
|
||||||
{/if}
|
|
||||||
{#if expanded}
|
|
||||||
{#each folder.folders as aFolder}
|
|
||||||
<Folder folder={aFolder} schema={schema}></Folder>
|
|
||||||
{/each}
|
|
||||||
|
|
||||||
{#each folder.files 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}
|
|
||||||
</div>
|
|
||||||
@@ -7,22 +7,32 @@
|
|||||||
const user = getContext("user");
|
const user = getContext("user");
|
||||||
</script>
|
</script>
|
||||||
|
|
||||||
|
|
||||||
<div class="top-nav">
|
<div class="top-nav">
|
||||||
|
{#if channel.auth == "lucent"}
|
||||||
<a class="top-nav-item" href="{channel.lucentUrl}/members">Members</a>
|
<a class="top-nav-item" href="{channel.lucentUrl}/members">Members</a>
|
||||||
|
{/if}
|
||||||
{#if channel.commands.length > 0}
|
{#if channel.commands.length > 0}
|
||||||
<Dropdown>
|
<Dropdown>
|
||||||
<div slot="button">Actions</div>
|
<div slot="button">Actions</div>
|
||||||
{#each channel.commands as command}
|
{#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}
|
{/each}
|
||||||
</Dropdown>
|
</Dropdown>
|
||||||
|
|
||||||
{/if}
|
{/if}
|
||||||
|
<!-- <div>-->
|
||||||
|
<!-- <form method="GET">-->
|
||||||
|
<!-- <input type="search" name="filter[search_regex]" placeholder="Search"-->
|
||||||
|
<!-- class="form-control" required/>-->
|
||||||
|
<!-- </form>-->
|
||||||
|
<!-- </div>-->
|
||||||
|
{#if channel.auth == "lucent"}
|
||||||
<a href="{channel.lucentUrl}/profile">
|
<a href="{channel.lucentUrl}/profile">
|
||||||
<Avatar side="28" name={user.name} />
|
<Avatar side="28" name={user.name} />
|
||||||
</a>
|
</a>
|
||||||
|
{:else}
|
||||||
|
<Avatar side="28" name={user.name} />
|
||||||
|
{/if}
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
@@ -1,45 +1,21 @@
|
|||||||
<script>
|
<script>
|
||||||
import { getContext } from "svelte";
|
import { getContext } from "svelte";
|
||||||
import Folder from "./Folder.svelte";
|
|
||||||
|
|
||||||
export let schema;
|
export let schema;
|
||||||
const channel = getContext("channel");
|
const channel = getContext("channel");
|
||||||
const readableSchemas = getContext("readableSchemas");
|
const readableSchemas = getContext("readableSchemas");
|
||||||
|
|
||||||
function addToFolder(tree, folderPath, aSchema) {
|
|
||||||
let shouldExpand = aSchema.name === schema?.name;
|
|
||||||
if (folderPath === "") {
|
|
||||||
tree.files.push(aSchema)
|
|
||||||
return tree
|
|
||||||
}
|
|
||||||
const folderNames = folderPath.split(".");
|
|
||||||
folderNames.forEach(folderName => {
|
|
||||||
let queriedFolder = tree.folders.find(folder => folder.name === folderName)
|
|
||||||
if (!queriedFolder) {
|
|
||||||
queriedFolder = {name: folderName, files: [], folders: [], shouldExpand: shouldExpand};
|
|
||||||
}
|
|
||||||
folderNames.shift()
|
|
||||||
let remainingFolderPath = folderNames.join(".");
|
|
||||||
queriedFolder = addToFolder(queriedFolder, remainingFolderPath, aSchema)
|
|
||||||
|
|
||||||
tree.folders = tree.folders.filter(f => f.name !== queriedFolder.name)
|
|
||||||
tree.folders.push(queriedFolder);
|
|
||||||
|
|
||||||
})
|
|
||||||
|
|
||||||
return tree;
|
|
||||||
}
|
|
||||||
|
|
||||||
const schemaTree = readableSchemas.reduce((carry, schema) => {
|
|
||||||
carry = addToFolder(carry, schema.folder,schema)
|
|
||||||
return carry;
|
|
||||||
}, {name: "", files: [], folders: [], shouldExpand:true});
|
|
||||||
</script>
|
</script>
|
||||||
|
|
||||||
<div class="sidebar-top">
|
<div class="sidebar-top">
|
||||||
<a class="logo" href="{channel.lucentUrl}">{channel.name}</a>
|
<a class="logo" href={channel.lucentUrl}>{channel.name}</a>
|
||||||
<a class="nav-item" href="{channel.lucentUrl}/profile">
|
|
||||||
</a>
|
|
||||||
</div>
|
</div>
|
||||||
<div class="sidebar">
|
<div class="sidebar">
|
||||||
<Folder folder={schemaTree} {schema} ></Folder>
|
{#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>
|
</div>
|
||||||
@@ -1,5 +1,4 @@
|
|||||||
<script>
|
<script>
|
||||||
|
|
||||||
// https://codesandbox.io/s/codemirror-remark-editor-4m4z9?file=/src/CodeEditor.js:374-387
|
// https://codesandbox.io/s/codemirror-remark-editor-4m4z9?file=/src/CodeEditor.js:374-387
|
||||||
import { onDestroy, onMount } from "svelte";
|
import { onDestroy, onMount } from "svelte";
|
||||||
import { basicSetup, EditorView } from "codemirror";
|
import { basicSetup, EditorView } from "codemirror";
|
||||||
@@ -17,10 +16,10 @@
|
|||||||
|
|
||||||
export function insertMedia(info) {
|
export function insertMedia(info) {
|
||||||
let insertText = "";
|
let insertText = "";
|
||||||
if (info.record._file.width > 0) {
|
if (info.file.width > 0) {
|
||||||
insertText = ``;
|
insertText = ``;
|
||||||
} else {
|
} else {
|
||||||
insertText = `[${info.record._file.originalName}](${info.originalUrl})`;
|
insertText = `[${info.file.filename}](${info.originalUrl})`;
|
||||||
}
|
}
|
||||||
const cursor = codeMirrorView.state.selection.main.head;
|
const cursor = codeMirrorView.state.selection.main.head;
|
||||||
const transaction = codeMirrorView.state.update({
|
const transaction = codeMirrorView.state.update({
|
||||||
@@ -46,11 +45,7 @@
|
|||||||
doc: value,
|
doc: value,
|
||||||
extensions: [
|
extensions: [
|
||||||
basicSetup,
|
basicSetup,
|
||||||
keymap.of([
|
keymap.of([indentWithTab, ...lintKeymap, ...completionKeymap]),
|
||||||
indentWithTab,
|
|
||||||
...lintKeymap,
|
|
||||||
...completionKeymap
|
|
||||||
]),
|
|
||||||
language.of(markdown()),
|
language.of(markdown()),
|
||||||
markdown(),
|
markdown(),
|
||||||
autocompletion(),
|
autocompletion(),
|
||||||
@@ -63,17 +58,14 @@
|
|||||||
}
|
}
|
||||||
}),
|
}),
|
||||||
EditorView.lineWrapping,
|
EditorView.lineWrapping,
|
||||||
EditorView.contentAttributes.of({spellcheck: "true"})
|
EditorView.contentAttributes.of({ spellcheck: "true" }),
|
||||||
],
|
],
|
||||||
});
|
});
|
||||||
|
|
||||||
|
|
||||||
codeMirrorView = new EditorView({
|
codeMirrorView = new EditorView({
|
||||||
state,
|
state,
|
||||||
parent: parentElement,
|
parent: parentElement,
|
||||||
});
|
});
|
||||||
|
|
||||||
|
|
||||||
});
|
});
|
||||||
|
|
||||||
onDestroy(() => {
|
onDestroy(() => {
|
||||||
|
|||||||
@@ -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>
|
|
||||||
@@ -0,0 +1,174 @@
|
|||||||
|
<script>
|
||||||
|
import {onDestroy, onMount} from 'svelte';
|
||||||
|
import {Editor} from '@tiptap/core'
|
||||||
|
import Document from '@tiptap/extension-document'
|
||||||
|
import Paragraph from '@tiptap/extension-paragraph'
|
||||||
|
import Dropcursor from '@tiptap/extension-dropcursor'
|
||||||
|
import Text from '@tiptap/extension-text'
|
||||||
|
import Heading from '@tiptap/extension-heading'
|
||||||
|
import HardBreak from '@tiptap/extension-hard-break'
|
||||||
|
import Blockquote from '@tiptap/extension-blockquote';
|
||||||
|
import CodeBlock from '@tiptap/extension-code-block';
|
||||||
|
import Bold from '@tiptap/extension-bold';
|
||||||
|
import BulletList from '@tiptap/extension-bullet-list';
|
||||||
|
import Code from '@tiptap/extension-code';
|
||||||
|
import History from '@tiptap/extension-history';
|
||||||
|
import Italic from '@tiptap/extension-italic';
|
||||||
|
import ListItem from '@tiptap/extension-list-item';
|
||||||
|
import OrderedList from '@tiptap/extension-ordered-list';
|
||||||
|
import Strike from '@tiptap/extension-strike';
|
||||||
|
import Table from '@tiptap/extension-table';
|
||||||
|
import TableRow from '@tiptap/extension-table-row';
|
||||||
|
import TableCell from '@tiptap/extension-table-cell';
|
||||||
|
import TableHeader from '@tiptap/extension-table-header';
|
||||||
|
import Underline from '@tiptap/extension-underline';
|
||||||
|
import Image from '@tiptap/extension-image';
|
||||||
|
import Icon from "../common/Icon.svelte";
|
||||||
|
|
||||||
|
let element;
|
||||||
|
let editor;
|
||||||
|
export let value = "";
|
||||||
|
|
||||||
|
onMount(() => {
|
||||||
|
editor = new Editor({
|
||||||
|
element: element,
|
||||||
|
extensions: [
|
||||||
|
Document,
|
||||||
|
Paragraph,
|
||||||
|
Text,
|
||||||
|
Bold,
|
||||||
|
ListItem,
|
||||||
|
BulletList,
|
||||||
|
Code,
|
||||||
|
CodeBlock,
|
||||||
|
History,
|
||||||
|
Italic,
|
||||||
|
HardBreak,
|
||||||
|
OrderedList,
|
||||||
|
Strike,
|
||||||
|
Table,
|
||||||
|
TableRow,
|
||||||
|
TableCell,
|
||||||
|
TableHeader,
|
||||||
|
Underline,
|
||||||
|
Dropcursor,
|
||||||
|
Image,
|
||||||
|
Heading.configure({
|
||||||
|
levels: [1, 2, 3],
|
||||||
|
}),
|
||||||
|
Blockquote
|
||||||
|
],
|
||||||
|
content: value,
|
||||||
|
editable: true,
|
||||||
|
onTransaction: () => {
|
||||||
|
// force re-render so `editor.isActive` works as expected
|
||||||
|
editor = editor;
|
||||||
|
},
|
||||||
|
onUpdate: ({editor}) => {
|
||||||
|
value = editor.getHTML()
|
||||||
|
},
|
||||||
|
});
|
||||||
|
|
||||||
|
});
|
||||||
|
|
||||||
|
onDestroy(() => {
|
||||||
|
if (editor) {
|
||||||
|
editor.destroy();
|
||||||
|
}
|
||||||
|
});
|
||||||
|
|
||||||
|
export function insertMedia(info){
|
||||||
|
editor.chain().focus().setImage({ src: info.url }).run()
|
||||||
|
}
|
||||||
|
</script>
|
||||||
|
|
||||||
|
{#if editor}
|
||||||
|
<div class="editor-toolbar">
|
||||||
|
<button
|
||||||
|
class="button"
|
||||||
|
on:click={() => editor.chain().focus().toggleHeading({ level: 1 }).run()}
|
||||||
|
class:active={editor.isActive('heading', { level: 1 })}
|
||||||
|
>
|
||||||
|
H1
|
||||||
|
</button>
|
||||||
|
<button
|
||||||
|
class="button"
|
||||||
|
on:click={() => editor.chain().focus().toggleHeading({ level: 2 }).run()}
|
||||||
|
class:active={editor.isActive('heading', { level: 2 })}
|
||||||
|
>
|
||||||
|
H2
|
||||||
|
</button>
|
||||||
|
|
||||||
|
<button
|
||||||
|
class="button"
|
||||||
|
on:click={() => editor.chain().focus().toggleBold().run()}
|
||||||
|
class:active={editor.isActive('bold')}
|
||||||
|
>
|
||||||
|
B
|
||||||
|
</button>
|
||||||
|
<button
|
||||||
|
class="button"
|
||||||
|
on:click={() => editor.chain().focus().toggleItalic().run()}
|
||||||
|
class:active={editor.isActive('italic')}
|
||||||
|
>
|
||||||
|
<em>IT</em>
|
||||||
|
</button>
|
||||||
|
<button
|
||||||
|
class="button"
|
||||||
|
on:click={() => editor.chain().focus().toggleUnderline().run()}
|
||||||
|
class:active={editor.isActive('underline')}
|
||||||
|
>
|
||||||
|
<u>U</u>
|
||||||
|
</button>
|
||||||
|
<button
|
||||||
|
class="button"
|
||||||
|
on:click={() => editor.chain().focus().toggleStrike().run()}
|
||||||
|
class:active={editor.isActive('strike')}
|
||||||
|
>
|
||||||
|
<s>S</s>
|
||||||
|
</button>
|
||||||
|
<button
|
||||||
|
class="button"
|
||||||
|
on:click={() => editor.commands.unsetAllMarks()}
|
||||||
|
>
|
||||||
|
Clear
|
||||||
|
</button>
|
||||||
|
<button
|
||||||
|
class="button"
|
||||||
|
on:click={() => editor.chain().focus().toggleCode().run()}
|
||||||
|
class:active={editor.isActive('code')}
|
||||||
|
>
|
||||||
|
Code
|
||||||
|
</button>
|
||||||
|
<button
|
||||||
|
class="button"
|
||||||
|
on:click={() => editor.chain().focus().toggleBulletList().run()}
|
||||||
|
class:active={editor.isActive('bulletList')}
|
||||||
|
>
|
||||||
|
<Icon icon="list"></Icon>
|
||||||
|
</button>
|
||||||
|
<button
|
||||||
|
class="button"
|
||||||
|
on:click={() => editor.chain().focus().toggleOrderedList().run()}
|
||||||
|
class:active={editor.isActive('orderedList')}
|
||||||
|
>
|
||||||
|
<Icon icon="ordered-list"></Icon>
|
||||||
|
</button>
|
||||||
|
<button
|
||||||
|
class="button"
|
||||||
|
on:click={() => editor.chain().focus().toggleBlockquote().run()}
|
||||||
|
class:active={editor.isActive('blockquote')}
|
||||||
|
>
|
||||||
|
""
|
||||||
|
</button>
|
||||||
|
<button
|
||||||
|
class="button"
|
||||||
|
on:click={() => editor.chain().focus().toggleCodeBlock().run()}
|
||||||
|
class:active={editor.isActive('codeBlock')}
|
||||||
|
>
|
||||||
|
cb
|
||||||
|
</button>
|
||||||
|
</div>
|
||||||
|
{/if}
|
||||||
|
|
||||||
|
<div bind:this={element} class="content"/>
|
||||||
@@ -1,60 +1,60 @@
|
|||||||
<script>
|
<script>
|
||||||
import { onDestroy, onMount } from "svelte";
|
import { onDestroy, onMount } from "svelte";
|
||||||
import Trix from "trix"
|
import Trix from "trix";
|
||||||
|
import "trix/dist/trix.css";
|
||||||
|
|
||||||
export let value = "";
|
export let value = "";
|
||||||
export let field;
|
export let field;
|
||||||
let editor;
|
let editor;
|
||||||
|
|
||||||
|
|
||||||
function updateValue(e) {
|
function updateValue(e) {
|
||||||
value = e.target.value;
|
value = e.target.value;
|
||||||
}
|
}
|
||||||
|
|
||||||
export function insertMedia(info) {
|
export function insertMedia(info) {
|
||||||
if(info.record._file.width > 0){
|
if (info.file.width > 0) {
|
||||||
var attachment = new Trix.Attachment({ content: info.html })
|
var attachment = new Trix.Attachment({ content: info.html });
|
||||||
editor.editor.insertAttachment(attachment)
|
editor.editor.insertAttachment(attachment);
|
||||||
} else {
|
} else {
|
||||||
editor.editor.insertHTML(`<a href="${info.originalUrl}">${info.record._file.originalName}</a>`)
|
editor.editor.insertHTML(
|
||||||
|
`<a href="${info.originalUrl}">${info.file.filename}</a>`,
|
||||||
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
onMount(() => {
|
onMount(() => {
|
||||||
editor.addEventListener("trix-file-accept", (e) => {
|
editor.addEventListener("trix-file-accept", (e) => {
|
||||||
e.preventDefault();
|
e.preventDefault();
|
||||||
})
|
});
|
||||||
|
|
||||||
editor.addEventListener("trix-before-initialize", (e) => {
|
editor.addEventListener("trix-before-initialize", (e) => {
|
||||||
Trix.config.blockAttributes.heading1.tagName = 'h2';
|
Trix.config.blockAttributes.heading1.tagName = "h2";
|
||||||
const { toolbarElement } = e.target
|
const { toolbarElement } = e.target;
|
||||||
const h1Button = toolbarElement.querySelector("[data-trix-attribute=heading1]")
|
const h1Button = toolbarElement.querySelector(
|
||||||
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>`)
|
"[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(() => {
|
// onDestroy(() => {
|
||||||
// editor.removeEventListener("trix-before-initialize")
|
// editor.removeEventListener("trix-before-initialize")
|
||||||
// })
|
// })
|
||||||
|
|
||||||
|
Trix.config.blockAttributes.default.breakOnReturn = false;
|
||||||
Trix.config.blockAttributes.default.breakOnReturn = false
|
|
||||||
Trix.config.blockAttributes.heading3 = {
|
Trix.config.blockAttributes.heading3 = {
|
||||||
tagName: 'h3',
|
tagName: "h3",
|
||||||
terminal: true,
|
terminal: true,
|
||||||
breakOnReturn: true,
|
breakOnReturn: true,
|
||||||
group: false
|
group: false,
|
||||||
}
|
};
|
||||||
// console.log(Trix.config)
|
// console.log(Trix.config)
|
||||||
|
|
||||||
</script>
|
</script>
|
||||||
|
|
||||||
<div class="tox-wrapper">
|
<div class="tox-wrapper">
|
||||||
<input id="x-{field.name}" {value} type="hidden">
|
<input id="x-{field.name}" {value} type="hidden" />
|
||||||
<trix-editor
|
<trix-editor
|
||||||
bind:this={editor}
|
bind:this={editor}
|
||||||
class=" content"
|
class=" content"
|
||||||
@@ -62,6 +62,5 @@
|
|||||||
role="textbox"
|
role="textbox"
|
||||||
tabindex="0"
|
tabindex="0"
|
||||||
on:trix-change={updateValue}
|
on:trix-change={updateValue}
|
||||||
|
|
||||||
></trix-editor>
|
></trix-editor>
|
||||||
</div>
|
</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;
|
|
||||||
}
|
|
||||||
@@ -22,6 +22,9 @@
|
|||||||
e.preventDefault();
|
e.preventDefault();
|
||||||
|
|
||||||
let newRoles = [...member.roles, aRole];
|
let newRoles = [...member.roles, aRole];
|
||||||
|
console.log(member.roles)
|
||||||
|
console.log(aRole)
|
||||||
|
console.log(newRoles)
|
||||||
dispatch("update", {
|
dispatch("update", {
|
||||||
user: member.id,
|
user: member.id,
|
||||||
roles: newRoles,
|
roles: newRoles,
|
||||||
|
|||||||
@@ -4,8 +4,7 @@
|
|||||||
import SpinnerButton from "../common/SpinnerButton.svelte";
|
import SpinnerButton from "../common/SpinnerButton.svelte";
|
||||||
import MemberSettingsCard from "./MemberSettingsCard.svelte";
|
import MemberSettingsCard from "./MemberSettingsCard.svelte";
|
||||||
import { getContext } from "svelte";
|
import { getContext } from "svelte";
|
||||||
import axios from "axios";
|
import { apiPost } from "../../helpers";
|
||||||
|
|
||||||
|
|
||||||
const channel = getContext("channel");
|
const channel = getContext("channel");
|
||||||
export let users;
|
export let users;
|
||||||
@@ -23,15 +22,14 @@
|
|||||||
function invite(newName, newEmail, newRole) {
|
function invite(newName, newEmail, newRole) {
|
||||||
errorMessage = "";
|
errorMessage = "";
|
||||||
|
|
||||||
axios
|
apiPost(channel.lucentUrl + "/members/invite", {
|
||||||
.post(channel.lucentUrl + "/members/invite", {
|
|
||||||
name: newName,
|
name: newName,
|
||||||
email: newEmail,
|
email: newEmail,
|
||||||
roles: [newRole],
|
roles: [newRole],
|
||||||
})
|
})
|
||||||
.then((response) => {
|
.then((response) => {
|
||||||
successAlert.show("User was invited");
|
successAlert.show("User was invited");
|
||||||
users = [...users, response.data.user];
|
users = [...users, response.user];
|
||||||
name = null;
|
name = null;
|
||||||
email = null;
|
email = null;
|
||||||
role = null;
|
role = null;
|
||||||
@@ -45,14 +43,13 @@
|
|||||||
e.preventDefault();
|
e.preventDefault();
|
||||||
errorMessage = "";
|
errorMessage = "";
|
||||||
|
|
||||||
axios
|
apiPost(channel.lucentUrl + "/members/update", {
|
||||||
.post(channel.lucentUrl + "/members/update", {
|
|
||||||
id: e.detail.user,
|
id: e.detail.user,
|
||||||
roles: e.detail.roles,
|
roles: e.detail.roles,
|
||||||
})
|
})
|
||||||
.then((response) => {
|
.then((response) => {
|
||||||
successAlert.show("Users updated");
|
successAlert.show("Users updated");
|
||||||
users = response.data.users;
|
users = response.users;
|
||||||
})
|
})
|
||||||
.catch((error) => {
|
.catch((error) => {
|
||||||
errorMessage = error.response?.data?.error ?? "";
|
errorMessage = error.response?.data?.error ?? "";
|
||||||
@@ -68,9 +65,7 @@
|
|||||||
|
|
||||||
<form on:submit={submitInvite}>
|
<form on:submit={submitInvite}>
|
||||||
<div class="mb-3">
|
<div class="mb-3">
|
||||||
<label for="inviteeName" class="form-label"
|
<label for="inviteeName" class="form-label">Invitee Name</label>
|
||||||
>Invitee Name</label
|
|
||||||
>
|
|
||||||
<input
|
<input
|
||||||
type="text"
|
type="text"
|
||||||
bind:value={name}
|
bind:value={name}
|
||||||
@@ -97,10 +92,7 @@
|
|||||||
<div class="me-3">
|
<div class="me-3">
|
||||||
<select bind:value={role}>
|
<select bind:value={role}>
|
||||||
{#each channel.roles.filter((r) => r !== "removed") as arole}
|
{#each channel.roles.filter((r) => r !== "removed") as arole}
|
||||||
<option
|
<option value={arole}>{arole}</option>
|
||||||
value={arole}
|
|
||||||
|
|
||||||
>{arole}</option>
|
|
||||||
{/each}
|
{/each}
|
||||||
</select>
|
</select>
|
||||||
</div>
|
</div>
|
||||||
|
|||||||
@@ -1,15 +1,13 @@
|
|||||||
<script>
|
<script>
|
||||||
import { afterUpdate, getContext, onMount } from "svelte";
|
import { afterUpdate, getContext, onMount } from "svelte";
|
||||||
import axios from "axios";
|
import EditHeader from "./header/EditHeader.svelte";
|
||||||
import EditHeader from "./header/EditHeader.svelte"
|
import ContentTabs from "./header/ContentTabs.svelte";
|
||||||
import FilePreview from "./FilePreview.svelte"
|
import FormField from "./FormField.svelte";
|
||||||
import ContentTabs from "./header/ContentTabs.svelte"
|
import Graph from "./Graph.svelte";
|
||||||
import FormField from "./FormField.svelte"
|
import Info from "./Info.svelte";
|
||||||
import Graph from "./Graph.svelte"
|
import ErrorAlert from "../common/ErrorAlert.svelte";
|
||||||
import Info from "./Info.svelte"
|
|
||||||
import ErrorAlert from "../common/ErrorAlert.svelte"
|
|
||||||
import Title from "./header/Title.svelte";
|
import Title from "./header/Title.svelte";
|
||||||
import {hasDataChanged} from "./editor.js";
|
import { apiPost, isEqual } from "../../helpers";
|
||||||
|
|
||||||
const channel = getContext("channel");
|
const channel = getContext("channel");
|
||||||
|
|
||||||
@@ -17,7 +15,7 @@
|
|||||||
export let record;
|
export let record;
|
||||||
export let graph = {
|
export let graph = {
|
||||||
records: [],
|
records: [],
|
||||||
edges: []
|
edges: [],
|
||||||
};
|
};
|
||||||
// export let recordHistory;
|
// export let recordHistory;
|
||||||
export let isCreateMode;
|
export let isCreateMode;
|
||||||
@@ -33,10 +31,7 @@
|
|||||||
} error(s)`
|
} error(s)`
|
||||||
: null;
|
: null;
|
||||||
|
|
||||||
let activeFields = schema.fields.filter(
|
let activeFields = schema.fields.filter((f) => f.name !== "id");
|
||||||
(f) => f.name !== "id"
|
|
||||||
);
|
|
||||||
|
|
||||||
|
|
||||||
onMount(() => {
|
onMount(() => {
|
||||||
setOriginalContent();
|
setOriginalContent();
|
||||||
@@ -45,10 +40,7 @@
|
|||||||
function setOriginalContent() {
|
function setOriginalContent() {
|
||||||
originalContent = {
|
originalContent = {
|
||||||
data: JSON.parse(JSON.stringify(record.data)),
|
data: JSON.parse(JSON.stringify(record.data)),
|
||||||
schema: record.schema,
|
|
||||||
status: record.status,
|
status: record.status,
|
||||||
_sys: JSON.parse(JSON.stringify(record._sys)),
|
|
||||||
_file: JSON.parse(JSON.stringify(record._file)),
|
|
||||||
edges: JSON.parse(JSON.stringify(graph.edges)),
|
edges: JSON.parse(JSON.stringify(graph.edges)),
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
@@ -74,12 +66,12 @@
|
|||||||
}
|
}
|
||||||
|
|
||||||
function checkUnsavedData() {
|
function checkUnsavedData() {
|
||||||
return hasDataChanged(isCreateMode,originalContent,{
|
if (isCreateMode) {
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
return !isEqual(originalContent, {
|
||||||
data: record.data,
|
data: record.data,
|
||||||
schema: record.schema,
|
|
||||||
status: record.status,
|
status: record.status,
|
||||||
_sys: record._sys,
|
|
||||||
_file: record._file,
|
|
||||||
edges: graph.edges,
|
edges: graph.edges,
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
@@ -101,9 +93,10 @@
|
|||||||
}
|
}
|
||||||
|
|
||||||
// remove trashed edges
|
// remove trashed edges
|
||||||
graph.edges = graph.edges?.filter((edge) => !edge._isTrashed && edge.source === record.id);
|
graph.edges = graph.edges?.filter(
|
||||||
axios
|
(edge) => !edge._isTrashed && edge.source === record.id,
|
||||||
.post(channel.lucentUrl + "/records", {
|
);
|
||||||
|
apiPost(channel.lucentUrl + "/records", {
|
||||||
record: record,
|
record: record,
|
||||||
edges: graph.edges,
|
edges: graph.edges,
|
||||||
isCreateMode: isCreateMode,
|
isCreateMode: isCreateMode,
|
||||||
@@ -112,16 +105,17 @@
|
|||||||
console.log("SAVE: SAVED");
|
console.log("SAVE: SAVED");
|
||||||
|
|
||||||
if (isCreateMode) {
|
if (isCreateMode) {
|
||||||
window.location = channel.lucentUrl + "/records/" + record.id;
|
window.location =
|
||||||
|
channel.lucentUrl + "/records/" + record.id;
|
||||||
} else {
|
} else {
|
||||||
record = response.data.records[0] ?? null;
|
record = response.records[0] ?? null;
|
||||||
if (!record) {
|
if (!record) {
|
||||||
// means trashed
|
// means trashed
|
||||||
hasUnsavedData = false;
|
hasUnsavedData = false;
|
||||||
window.location = channel.lucentUrl;
|
window.location = channel.lucentUrl;
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
graph = response.data;
|
graph = response;
|
||||||
setOriginalContent();
|
setOriginalContent();
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -134,7 +128,7 @@
|
|||||||
errorMessage = error.response.data.error;
|
errorMessage = error.response.data.error;
|
||||||
} else {
|
} else {
|
||||||
validationErrors = error.response.data.error;
|
validationErrors = error.response.data.error;
|
||||||
console.log(validationErrors)
|
console.log(validationErrors);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
resolve(null);
|
resolve(null);
|
||||||
@@ -153,10 +147,7 @@
|
|||||||
<!-- <Manager managerRecords={recordHistory} {graph}/>-->
|
<!-- <Manager managerRecords={recordHistory} {graph}/>-->
|
||||||
<EditHeader {schema} bind:record {isCreateMode} bind:activeContentTab />
|
<EditHeader {schema} bind:record {isCreateMode} bind:activeContentTab />
|
||||||
{#if isCreateMode}
|
{#if isCreateMode}
|
||||||
<button
|
<button class="button primary btn-spinner" on:click={save}>
|
||||||
class="button primary btn-spinner"
|
|
||||||
on:click={save}
|
|
||||||
>
|
|
||||||
<span
|
<span
|
||||||
class="spinner-border spinner-border-sm"
|
class="spinner-border spinner-border-sm"
|
||||||
role="status"
|
role="status"
|
||||||
@@ -178,26 +169,19 @@
|
|||||||
Save
|
Save
|
||||||
</button>
|
</button>
|
||||||
{/if}
|
{/if}
|
||||||
|
|
||||||
</div>
|
</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;">
|
<div class=" mt-4" style="margin-bottom:150px;position:relative;">
|
||||||
<ContentTabs
|
<ContentTabs {schema} {isCreateMode} bind:active={activeContentTab} />
|
||||||
{schema}
|
|
||||||
{isCreateMode}
|
|
||||||
bind:active={activeContentTab}
|
|
||||||
/>
|
|
||||||
{#if !["_graph", "_info"].includes(activeContentTab)}
|
{#if !["_graph", "_info"].includes(activeContentTab)}
|
||||||
<FilePreview {record} {schema}/>
|
|
||||||
{#each activeFields as field (field.name)}
|
{#each activeFields as field (field.name)}
|
||||||
{#if activeContentTab === field.group}
|
{#if activeContentTab === field.group}
|
||||||
<FormField
|
<FormField
|
||||||
bind:data={record.data}
|
bind:data={record.data}
|
||||||
bind:graph={graph}
|
bind:graph
|
||||||
{field}
|
{field}
|
||||||
{schema}
|
{schema}
|
||||||
{record}
|
{record}
|
||||||
|
|||||||
@@ -1,7 +1,7 @@
|
|||||||
<script>
|
<script>
|
||||||
import Preview from "../files/Preview.svelte";
|
import Preview from "../files/Preview.svelte";
|
||||||
import {fileurl} from "../files/imageserver"
|
import { fileurl } from "../files/imageserver";
|
||||||
import {getContext} from "svelte"
|
import { getContext } from "svelte";
|
||||||
|
|
||||||
const channel = getContext("channel");
|
const channel = getContext("channel");
|
||||||
export let record;
|
export let record;
|
||||||
@@ -14,7 +14,6 @@
|
|||||||
<Preview {record} size="large" />
|
<Preview {record} size="large" />
|
||||||
</div>
|
</div>
|
||||||
<div class="file-details">
|
<div class="file-details">
|
||||||
|
|
||||||
<div class="file-details-item">
|
<div class="file-details-item">
|
||||||
<span class="text-muted">Filename</span>
|
<span class="text-muted">Filename</span>
|
||||||
<span>{record._file.path}</span>
|
<span>{record._file.path}</span>
|
||||||
@@ -42,9 +41,13 @@
|
|||||||
<span>{record._file.checksum}</span>
|
<span>{record._file.checksum}</span>
|
||||||
</div>
|
</div>
|
||||||
<div class="file-details-item">
|
<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>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
{/if}
|
{/if}
|
||||||
|
|
||||||
@@ -5,7 +5,9 @@
|
|||||||
import Color from "./elements/Color.svelte";
|
import Color from "./elements/Color.svelte";
|
||||||
import Checkbox from "./elements/Checkbox.svelte";
|
import Checkbox from "./elements/Checkbox.svelte";
|
||||||
import Number from "./elements/Number.svelte";
|
import Number from "./elements/Number.svelte";
|
||||||
|
import Url from "./elements/Url.svelte";
|
||||||
import Date from "./elements/Date.svelte";
|
import Date from "./elements/Date.svelte";
|
||||||
|
import UUID from "./elements/UUID.svelte";
|
||||||
import File from "./elements/File.svelte";
|
import File from "./elements/File.svelte";
|
||||||
import Textarea from "./elements/Textarea.svelte";
|
import Textarea from "./elements/Textarea.svelte";
|
||||||
import Datetime from "./elements/Datetime.svelte";
|
import Datetime from "./elements/Datetime.svelte";
|
||||||
@@ -23,8 +25,10 @@
|
|||||||
color: Color,
|
color: Color,
|
||||||
checkbox: Checkbox,
|
checkbox: Checkbox,
|
||||||
number: Number,
|
number: Number,
|
||||||
|
url: Url,
|
||||||
date: Date,
|
date: Date,
|
||||||
datetime: Datetime,
|
datetime: Datetime,
|
||||||
|
uuid: UUID,
|
||||||
json: Json,
|
json: Json,
|
||||||
markdown: Markdown,
|
markdown: Markdown,
|
||||||
};
|
};
|
||||||
@@ -43,23 +47,18 @@
|
|||||||
<div class="editor-field">
|
<div class="editor-field">
|
||||||
<FieldHeader {field} {id} />
|
<FieldHeader {field} {id} />
|
||||||
{#if field.info.name === "reference" && field.layout === "tags"}
|
{#if field.info.name === "reference" && field.layout === "tags"}
|
||||||
<ReferenceTags
|
<ReferenceTags bind:graph {id} {record} {field} {validationErrors} />
|
||||||
bind:graph
|
|
||||||
{id}
|
|
||||||
{record}
|
|
||||||
{field}
|
|
||||||
{validationErrors}
|
|
||||||
/>
|
|
||||||
{:else if field.info.name === "reference"}
|
{:else if field.info.name === "reference"}
|
||||||
<Reference
|
<Reference bind:graph {id} {record} {field} {validationErrors} />
|
||||||
bind:graph
|
{:else if field.info.name === "file"}
|
||||||
{id}
|
<!-- <File bind:graph {record} {field} {validationErrors} /> -->
|
||||||
|
<File
|
||||||
|
bind:value={data[field.name]}
|
||||||
{record}
|
{record}
|
||||||
|
{id}
|
||||||
{field}
|
{field}
|
||||||
{validationErrors}
|
{validationErrors}
|
||||||
/>
|
/>
|
||||||
{:else if field.info.name === "file"}
|
|
||||||
<File bind:graph {record} {field} {validationErrors}/>
|
|
||||||
{:else if field.info.name === "text"}
|
{:else if field.info.name === "text"}
|
||||||
<Text
|
<Text
|
||||||
bind:value={data[field.name]}
|
bind:value={data[field.name]}
|
||||||
|
|||||||
@@ -13,16 +13,14 @@
|
|||||||
}
|
}
|
||||||
|
|
||||||
let backlinks = graph.parentEdges.map(edge => {
|
let backlinks = graph.parentEdges.map(edge => {
|
||||||
const parentRecord = graph.records.find( record => record.id === edge.source);
|
let schema = channel.schemas.find((s) => s.name === edge.sourceSchema);
|
||||||
|
|
||||||
let schema = channel.schemas.find((s) => s.name === parentRecord.schema);
|
|
||||||
let edgeField = findEdgeField(schema,edge.field);
|
let edgeField = findEdgeField(schema,edge.field);
|
||||||
if(!edgeField){
|
if(!edgeField){
|
||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
return {
|
return {
|
||||||
field: edgeField.label,
|
field: edgeField.label,
|
||||||
record: parentRecord
|
record: graph.records.find( record => record.id === edge.source)
|
||||||
}
|
}
|
||||||
}).filter( edgeOrNull => !!edgeOrNull)
|
}).filter( edgeOrNull => !!edgeOrNull)
|
||||||
</script>
|
</script>
|
||||||
|
|||||||
@@ -1,13 +1,12 @@
|
|||||||
<script>
|
<script>
|
||||||
import {friendlyDate} from "../../helpers";
|
import { friendlyDate, isEqual } from "../../helpers";
|
||||||
import Avatar from "../account/Avatar.svelte";
|
import Avatar from "../account/Avatar.svelte";
|
||||||
import { usernameById } from "../account/users";
|
import { usernameById } from "../account/users";
|
||||||
|
|
||||||
import Icon from "../common/Icon.svelte";
|
import Icon from "../common/Icon.svelte";
|
||||||
import RevisionCell from "./revisions/RevisionCell.svelte";
|
import RevisionCell from "./revisions/RevisionCell.svelte";
|
||||||
import { getContext } from "svelte";
|
import { getContext } from "svelte";
|
||||||
import RevisionEdgeRow from "./revisions/RevisionEdgeRow.svelte";
|
import RevisionEdgeRow from "./revisions/RevisionEdgeRow.svelte";
|
||||||
import axios from "axios";
|
|
||||||
import {hasDataChanged} from "./editor.js";
|
|
||||||
|
|
||||||
const channel = getContext("channel");
|
const channel = getContext("channel");
|
||||||
export let record;
|
export let record;
|
||||||
@@ -31,27 +30,27 @@
|
|||||||
});
|
});
|
||||||
|
|
||||||
function getEdgesByField(fieldsWithDiff, revision) {
|
function getEdgesByField(fieldsWithDiff, revision) {
|
||||||
|
edgeFieldsDiff = graph.edges
|
||||||
edgeFieldsDiff = graph.edges.filter((e) => e.depth === 1).reduce((c, e) => {
|
.filter((e) => e.depth === 1)
|
||||||
|
.reduce((c, e) => {
|
||||||
if (!c[e.field]) {
|
if (!c[e.field]) {
|
||||||
c[e.field] = {
|
c[e.field] = {
|
||||||
record: [],
|
record: [],
|
||||||
revision: [],
|
revision: [],
|
||||||
|
};
|
||||||
}
|
}
|
||||||
}
|
c[e.field]["record"].push(e);
|
||||||
c[e.field]["record"].push(e)
|
|
||||||
return c;
|
return c;
|
||||||
}, {});
|
}, {});
|
||||||
|
|
||||||
|
|
||||||
edgeFieldsDiff = revision._edges.reduce((c, e) => {
|
edgeFieldsDiff = revision._edges.reduce((c, e) => {
|
||||||
if (!c[e.field]) {
|
if (!c[e.field]) {
|
||||||
c[e.field] = {
|
c[e.field] = {
|
||||||
record: [],
|
record: [],
|
||||||
revision: [],
|
revision: [],
|
||||||
|
};
|
||||||
}
|
}
|
||||||
}
|
c[e.field]["revision"].push(e);
|
||||||
c[e.field]["revision"].push(e)
|
|
||||||
return c;
|
return c;
|
||||||
}, edgeFieldsDiff);
|
}, edgeFieldsDiff);
|
||||||
}
|
}
|
||||||
@@ -61,9 +60,9 @@
|
|||||||
selectedRevision = revision;
|
selectedRevision = revision;
|
||||||
|
|
||||||
fieldsWithDiff = schema.fields.filter((f) => {
|
fieldsWithDiff = schema.fields.filter((f) => {
|
||||||
return hasDataChanged(false,selectedRevision.data[f.name], record.data[f.name]);
|
return !isEqual(selectedRevision.data[f.name], record.data[f.name]);
|
||||||
});
|
});
|
||||||
getEdgesByField(fieldsWithDiff, revision)
|
getEdgesByField(fieldsWithDiff, revision);
|
||||||
revisionSection.scrollIntoView();
|
revisionSection.scrollIntoView();
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -72,7 +71,7 @@
|
|||||||
rollbackError = "";
|
rollbackError = "";
|
||||||
axios
|
axios
|
||||||
.post(
|
.post(
|
||||||
`${channel.lucentUrl}/records/${record.id}/rollback/${selectedRevision._sys.version}`
|
`${channel.lucentUrl}/records/${record.id}/rollback/${selectedRevision.version}`,
|
||||||
)
|
)
|
||||||
.then((response) => {
|
.then((response) => {
|
||||||
window.location.reload();
|
window.location.reload();
|
||||||
@@ -94,29 +93,27 @@
|
|||||||
</div>
|
</div>
|
||||||
<div>
|
<div>
|
||||||
<span class="label text-end text-muted">current version </span>
|
<span class="label text-end text-muted">current version </span>
|
||||||
{record._sys.version}
|
{record.version}
|
||||||
</div>
|
</div>
|
||||||
<div>
|
<div>
|
||||||
<span class="label text-end text-muted"> created </span>
|
<span class="label text-end text-muted"> created </span>
|
||||||
<Avatar
|
<Avatar
|
||||||
name={usernameById(users, record._sys.createdBy)}
|
name={usernameById(users, record.createdBy)}
|
||||||
side={24}
|
side={24}
|
||||||
/>
|
/>
|
||||||
{friendlyDate(record._sys.createdAt)}
|
{friendlyDate(record.createdAt)}
|
||||||
</div>
|
</div>
|
||||||
<div>
|
<div>
|
||||||
<span class="label text-end text-muted">updated </span>
|
<span class="label text-end text-muted">updated </span>
|
||||||
<Avatar
|
<Avatar
|
||||||
name={usernameById(users, record._sys.updatedBy)}
|
name={usernameById(users, record.updatedBy)}
|
||||||
side={24}
|
side={24}
|
||||||
/>
|
/>
|
||||||
{friendlyDate(record._sys.updatedAt)}
|
{friendlyDate(record.updatedAt)}
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
<div class="col-4">
|
<div class="col-4">
|
||||||
<span class="label d-block text-muted "
|
<span class="label d-block text-muted">Rules for this schema </span>
|
||||||
>Rules for this schema
|
|
||||||
</span>
|
|
||||||
<small>
|
<small>
|
||||||
Each record maintains the last {schema.revisions}
|
Each record maintains the last {schema.revisions}
|
||||||
versions
|
versions
|
||||||
@@ -128,31 +125,29 @@
|
|||||||
{#if schema.revisions > 0}
|
{#if schema.revisions > 0}
|
||||||
<div class="header-small mb-3">Revisions</div>
|
<div class="header-small mb-3">Revisions</div>
|
||||||
{#each revisions as revision}
|
{#each revisions as revision}
|
||||||
{#if revision._sys.version !== record._sys.version}
|
{#if revision.version !== record.version}
|
||||||
<div
|
<div
|
||||||
class="revision"
|
class="revision"
|
||||||
class:active={revision._sys.version ===
|
class:active={revision.version ===
|
||||||
selectedRevision?._sys.version}
|
selectedRevision?.version}
|
||||||
>
|
>
|
||||||
|
|
||||||
<div class="version">
|
<div class="version">
|
||||||
<span>version {revision._sys.version}</span>
|
<span>version {revision.version}</span>
|
||||||
<Avatar
|
<Avatar
|
||||||
name={usernameById(users, revision._sys.updatedBy)}
|
name={usernameById(users, revision.updatedBy)}
|
||||||
side={24}
|
side={24}
|
||||||
/>
|
/>
|
||||||
{friendlyDate(revision._sys.updatedAt)}
|
{friendlyDate(revision.updatedAt)}
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
<div class="col-3 text-center">
|
<div class="col-3 text-center">
|
||||||
<button
|
<button
|
||||||
disabled={revision._sys.version ===
|
disabled={revision.version ===
|
||||||
selectedRevision?._sys.version}
|
selectedRevision?.version}
|
||||||
class="button"
|
class="button"
|
||||||
on:click={(e) => compare(e, revision)}
|
on:click={(e) => compare(e, revision)}
|
||||||
>Compare
|
>Compare
|
||||||
</button
|
</button>
|
||||||
>
|
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
{/if}
|
{/if}
|
||||||
@@ -170,15 +165,13 @@
|
|||||||
<p class="text-center fw-bold mb-3 mt-5">
|
<p class="text-center fw-bold mb-3 mt-5">
|
||||||
If you choose to rollback to this revision
|
If you choose to rollback to this revision
|
||||||
</p>
|
</p>
|
||||||
<button
|
<button on:click={rollback} class="button">
|
||||||
on:click={rollback}
|
Rollback to version {selectedRevision.version}
|
||||||
class="button"
|
|
||||||
>
|
|
||||||
Rollback to version {selectedRevision._sys.version}
|
|
||||||
</button>
|
</button>
|
||||||
|
|
||||||
{#if rollbackError}
|
{#if rollbackError}
|
||||||
<span class="d-block text-danger mt-3">{rollbackError}</span>
|
<span class="d-block text-danger mt-3">{rollbackError}</span
|
||||||
|
>
|
||||||
{/if}
|
{/if}
|
||||||
<div class="mt-3">
|
<div class="mt-3">
|
||||||
{#each fieldsWithDiff as field}
|
{#each fieldsWithDiff as field}
|
||||||
@@ -189,10 +182,7 @@
|
|||||||
<!-- <div class="d-block" style="width:200px;">
|
<!-- <div class="d-block" style="width:200px;">
|
||||||
{field.label}
|
{field.label}
|
||||||
</div> -->
|
</div> -->
|
||||||
<div
|
<div class="revision-field" style="overflow:hidden">
|
||||||
class="revision-field"
|
|
||||||
style="overflow:hidden"
|
|
||||||
>
|
|
||||||
<div class="compare-left">
|
<div class="compare-left">
|
||||||
<RevisionCell
|
<RevisionCell
|
||||||
{field}
|
{field}
|
||||||
@@ -227,19 +217,13 @@
|
|||||||
{/if}
|
{/if}
|
||||||
|
|
||||||
<div class="mt-3">
|
<div class="mt-3">
|
||||||
<p class="text-center fw-bold mb-3 mt-5">
|
<p class="text-center fw-bold mb-3 mt-5">Record References</p>
|
||||||
Record References
|
|
||||||
</p>
|
|
||||||
{#each Object.entries(edgeFieldsDiff) as [field, edges]}
|
{#each Object.entries(edgeFieldsDiff) as [field, edges]}
|
||||||
<div
|
<div class="revision-references" style="overflow:hidden">
|
||||||
class="revision-references"
|
|
||||||
style="overflow:hidden"
|
|
||||||
>
|
|
||||||
<div class="reference-field">
|
<div class="reference-field">
|
||||||
{field}:
|
{field}:
|
||||||
</div>
|
</div>
|
||||||
<div class="reference-compare">
|
<div class="reference-compare">
|
||||||
|
|
||||||
<p class="">Record</p>
|
<p class="">Record</p>
|
||||||
{#each edges.record as edge}
|
{#each edges.record as edge}
|
||||||
<RevisionEdgeRow {edge} />
|
<RevisionEdgeRow {edge} />
|
||||||
@@ -259,7 +243,5 @@
|
|||||||
{/each}
|
{/each}
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
{/if}
|
{/if}
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
@@ -1,13 +1,18 @@
|
|||||||
<script>
|
<script>
|
||||||
import {afterUpdate, createEventDispatcher, getContext, onMount} from "svelte";
|
import {
|
||||||
import {hasDataChanged} from "./editor.js";
|
afterUpdate,
|
||||||
|
createEventDispatcher,
|
||||||
|
getContext,
|
||||||
|
onMount,
|
||||||
|
} from "svelte";
|
||||||
|
|
||||||
import FormField from "./FormField.svelte";
|
import FormField from "./FormField.svelte";
|
||||||
import FilePreview from "./FilePreview.svelte";
|
import FilePreview from "./FilePreview.svelte";
|
||||||
import ContentTabs from "./header/ContentTabs.svelte";
|
import ContentTabs from "./header/ContentTabs.svelte";
|
||||||
import ErrorAlert from "../common/ErrorAlert.svelte";
|
import ErrorAlert from "../common/ErrorAlert.svelte";
|
||||||
import EditHeader from "./header/EditHeader.svelte";
|
import EditHeader from "./header/EditHeader.svelte";
|
||||||
import axios from "axios";
|
|
||||||
import Title from "./header/Title.svelte";
|
import Title from "./header/Title.svelte";
|
||||||
|
import { apiPost, isEqual } from "../../helpers";
|
||||||
|
|
||||||
const channel = getContext("channel");
|
const channel = getContext("channel");
|
||||||
const dispatch = createEventDispatcher();
|
const dispatch = createEventDispatcher();
|
||||||
@@ -15,7 +20,7 @@
|
|||||||
export let record;
|
export let record;
|
||||||
export let graph = {
|
export let graph = {
|
||||||
records: [],
|
records: [],
|
||||||
edges: []
|
edges: [],
|
||||||
};
|
};
|
||||||
export let isCreateMode;
|
export let isCreateMode;
|
||||||
let originalContent;
|
let originalContent;
|
||||||
@@ -28,9 +33,7 @@
|
|||||||
} error(s)`
|
} error(s)`
|
||||||
: null;
|
: null;
|
||||||
|
|
||||||
let activeFields = schema.fields.filter(
|
let activeFields = schema.fields.filter((f) => f.name !== "id");
|
||||||
(f) => f.name !== "id"
|
|
||||||
);
|
|
||||||
|
|
||||||
let tabname = "_default";
|
let tabname = "_default";
|
||||||
let fieldToTabs = schema.fields.reduce((c, f) => {
|
let fieldToTabs = schema.fields.reduce((c, f) => {
|
||||||
@@ -52,8 +55,6 @@
|
|||||||
data: JSON.parse(JSON.stringify(record.data)),
|
data: JSON.parse(JSON.stringify(record.data)),
|
||||||
schema: record.schema,
|
schema: record.schema,
|
||||||
status: record.status,
|
status: record.status,
|
||||||
_sys: JSON.parse(JSON.stringify(record._sys)),
|
|
||||||
_file: JSON.parse(JSON.stringify(record._file)),
|
|
||||||
edges: JSON.parse(JSON.stringify(graph.edges)),
|
edges: JSON.parse(JSON.stringify(graph.edges)),
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
@@ -79,12 +80,13 @@
|
|||||||
}
|
}
|
||||||
|
|
||||||
function checkUnsavedData() {
|
function checkUnsavedData() {
|
||||||
return hasDataChanged(isCreateMode, originalContent, {
|
if (isCreateMode) {
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
return !isEqual(originalContent, {
|
||||||
data: record.data,
|
data: record.data,
|
||||||
schema: record.schema,
|
schema: record.schema,
|
||||||
status: record.status,
|
status: record.status,
|
||||||
_sys: record._sys,
|
|
||||||
_file: record._file,
|
|
||||||
edges: graph.edges,
|
edges: graph.edges,
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
@@ -110,11 +112,12 @@
|
|||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
// remove trashed edges
|
// 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,
|
||||||
|
) ?? [];
|
||||||
|
|
||||||
|
apiPost(channel.lucentUrl + "/records", {
|
||||||
axios
|
|
||||||
.post(channel.lucentUrl + "/records", {
|
|
||||||
record: record,
|
record: record,
|
||||||
edges: graph.edges,
|
edges: graph.edges,
|
||||||
isCreateMode: isCreateMode,
|
isCreateMode: isCreateMode,
|
||||||
@@ -122,8 +125,8 @@
|
|||||||
.then(function (response) {
|
.then(function (response) {
|
||||||
console.log("SAVE: SAVED INLINE");
|
console.log("SAVE: SAVED INLINE");
|
||||||
|
|
||||||
record = response.data.records[0];
|
record = response.records[0];
|
||||||
graph = response.data;
|
graph = response;
|
||||||
if (!isCreateMode) {
|
if (!isCreateMode) {
|
||||||
setOriginalContent();
|
setOriginalContent();
|
||||||
}
|
}
|
||||||
@@ -152,10 +155,7 @@
|
|||||||
<div class="tools-header">
|
<div class="tools-header">
|
||||||
<EditHeader {schema} bind:record {isCreateMode} bind:activeContentTab />
|
<EditHeader {schema} bind:record {isCreateMode} bind:activeContentTab />
|
||||||
{#if isCreateMode}
|
{#if isCreateMode}
|
||||||
<button
|
<button class="button primary btn-spinner" on:click={save}>
|
||||||
class="button primary btn-spinner"
|
|
||||||
on:click={save}
|
|
||||||
>
|
|
||||||
<span
|
<span
|
||||||
class="spinner-border spinner-border-sm"
|
class="spinner-border spinner-border-sm"
|
||||||
role="status"
|
role="status"
|
||||||
@@ -177,24 +177,19 @@
|
|||||||
Save
|
Save
|
||||||
</button>
|
</button>
|
||||||
{/if}
|
{/if}
|
||||||
|
|
||||||
</div>
|
</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;">
|
<div class=" mt-4" style="margin-bottom:150px;position:relative;">
|
||||||
<ContentTabs
|
<ContentTabs {schema} {isCreateMode} bind:active={activeContentTab} />
|
||||||
{schema}
|
|
||||||
{isCreateMode}
|
|
||||||
bind:active={activeContentTab}
|
|
||||||
/>
|
|
||||||
<FilePreview {record} {schema} />
|
<FilePreview {record} {schema} />
|
||||||
<!-- <fieldset disabled="disabled"> -->
|
<!-- <fieldset disabled="disabled"> -->
|
||||||
{#each activeFields as field (field.name)}
|
{#each activeFields as field (field.name)}
|
||||||
{#if activeContentTab === field.group}
|
{#if activeContentTab === field.group}
|
||||||
<FormField
|
<FormField
|
||||||
bind:data={record.data}
|
bind:data={record.data}
|
||||||
bind:graph={graph}
|
bind:graph
|
||||||
{field}
|
{field}
|
||||||
{schema}
|
{schema}
|
||||||
{record}
|
{record}
|
||||||
@@ -206,4 +201,3 @@
|
|||||||
<!-- </fieldset> -->
|
<!-- </fieldset> -->
|
||||||
</div>
|
</div>
|
||||||
</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>
|
<script>
|
||||||
import {previewTitle} from "./Preview";
|
|
||||||
import { getContext } from "svelte";
|
import { getContext } from "svelte";
|
||||||
|
|
||||||
const channel = getContext("channel");
|
const channel = getContext("channel");
|
||||||
export let record;
|
export let record;
|
||||||
export let graph;
|
$: title = record.data.name;
|
||||||
$: schema = channel.schemas.find((aschema) => aschema.name === record.schema);
|
|
||||||
|
|
||||||
$: title = previewTitle(channel.schemas, record, graph);
|
|
||||||
</script>
|
</script>
|
||||||
|
|
||||||
{#if record?.data}
|
{#if record?.data}
|
||||||
<a
|
<a href="{channel.lucentUrl}/records/{record.id}" {title} class="reference">
|
||||||
href="{channel.lucentUrl}/records/{record.id}"
|
|
||||||
{title}
|
|
||||||
class="reference"
|
|
||||||
>
|
|
||||||
{title}
|
{title}
|
||||||
</a>
|
</a>
|
||||||
{/if}
|
{/if}
|
||||||
|
|||||||
@@ -1,6 +0,0 @@
|
|||||||
export function hasDataChanged(isCreateMode, originalContent, newContent){
|
|
||||||
if (isCreateMode) {
|
|
||||||
return false;
|
|
||||||
}
|
|
||||||
return JSON.stringify(originalContent) !== JSON.stringify(newContent);
|
|
||||||
}
|
|
||||||
@@ -1,6 +1,8 @@
|
|||||||
<script>
|
<script>
|
||||||
import {onMount} from "svelte";
|
import {onMount} from "svelte";
|
||||||
import flatpickr from "flatpickr";
|
import flatpickr from "flatpickr";
|
||||||
|
import "flatpickr/dist/flatpickr.css";
|
||||||
|
import "flatpickr/dist/themes/light.css";
|
||||||
import {getErrorMessage} from "./errorMessage";
|
import {getErrorMessage} from "./errorMessage";
|
||||||
|
|
||||||
export let field;
|
export let field;
|
||||||
|
|||||||
@@ -1,6 +1,8 @@
|
|||||||
<script>
|
<script>
|
||||||
import {onMount} from "svelte";
|
import {onMount} from "svelte";
|
||||||
import flatpickr from "flatpickr";
|
import flatpickr from "flatpickr";
|
||||||
|
import "flatpickr/dist/flatpickr.css";
|
||||||
|
import "flatpickr/dist/themes/light.css";
|
||||||
import {getErrorMessage} from "./errorMessage";
|
import {getErrorMessage} from "./errorMessage";
|
||||||
|
|
||||||
export let field;
|
export let field;
|
||||||
|
|||||||
@@ -1,101 +1,69 @@
|
|||||||
<script>
|
<script>
|
||||||
import {sortByField} from "../../edges/sortEdges";
|
import { array_move } from "../../edges/sortEdges";
|
||||||
import Sortable from "../../libs/Sortable.svelte";
|
import Sortable from "../../libs/Sortable.svelte";
|
||||||
import PreviewFile from "../previews/PreviewFile.svelte";
|
import PreviewFile from "../previews/PreviewFile.svelte";
|
||||||
import Dropdown from "../../common/Dropdown.svelte";
|
import FileDialog from "../../dialog/FileDialog.svelte";
|
||||||
import Dialog from "../../dialog/Dialog.svelte";
|
import Uploader from "../../files/Uploader.svelte";
|
||||||
import {
|
|
||||||
fullDeleteRecord,
|
|
||||||
graphToReferences,
|
|
||||||
insertEdges,
|
|
||||||
removeReferenceFromGraph,
|
|
||||||
restoreReferenceToGraph
|
|
||||||
} from "./reference.js";
|
|
||||||
import {getContext} from "svelte";
|
|
||||||
|
|
||||||
const channel = getContext("channel");
|
|
||||||
export let field;
|
export let field;
|
||||||
export let record;
|
export let record;
|
||||||
export let graph
|
export let value = [];
|
||||||
let browseModal;
|
let browseModal;
|
||||||
$: references = graphToReferences(graph, record, field)
|
|
||||||
|
|
||||||
let collections = channel.schemas.filter((aschema) =>
|
function removeFile(e) {
|
||||||
field.collections.includes(aschema.name)
|
|
||||||
);
|
|
||||||
|
|
||||||
function removeReference(e) {
|
|
||||||
e.preventDefault();
|
e.preventDefault();
|
||||||
graph.edges = removeReferenceFromGraph(graph, field, e.detail)
|
value = value.filter((f) => !(f.id === e.detail));
|
||||||
}
|
|
||||||
|
|
||||||
function restoreReference(e) {
|
|
||||||
e.preventDefault();
|
|
||||||
graph.edges = restoreReferenceToGraph(graph, field, e.detail)
|
|
||||||
}
|
|
||||||
|
|
||||||
function fullDelete(e) {
|
|
||||||
e.preventDefault();
|
|
||||||
graph.edges = fullDeleteRecord(channel,graph, field, e.detail)
|
|
||||||
}
|
|
||||||
|
|
||||||
function openBrowseModal(e, schema) {
|
|
||||||
e.preventDefault();
|
|
||||||
browseModal.open(schema);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
async function reorder(e) {
|
async function reorder(e) {
|
||||||
|
value = await array_move(value, e.detail.source, e.detail.target);
|
||||||
graph.edges = await sortByField(e.detail.source, e.detail.target, graph.edges, field.name, references);
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
function insert(e) {
|
function insertFiles(e) {
|
||||||
e.preventDefault();
|
e.preventDefault();
|
||||||
browseModal.close();
|
browseModal.close();
|
||||||
graph = insertEdges(graph, record, e.detail.records, field.name, e.detail.action);
|
value = [...(value ?? []), ...(e.detail ?? [])];
|
||||||
|
}
|
||||||
|
|
||||||
|
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>
|
</script>
|
||||||
|
|
||||||
<div class="mb-0">
|
<div class="mb-0">
|
||||||
{#if field.collections.length === 1}
|
<button class="button" on:click={openBrowseModal}> Browse </button>
|
||||||
<button
|
|
||||||
class="button"
|
<div>
|
||||||
on:click={(e) => openBrowseModal(e, collections[0].name)}
|
<Uploader recordId={record.id} on:uploadComplete={uploadComplete} />
|
||||||
>
|
|
||||||
Browse
|
|
||||||
</button>
|
|
||||||
{:else}
|
|
||||||
<Dropdown>
|
|
||||||
<div slot="button">
|
|
||||||
Browse
|
|
||||||
</div>
|
</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}
|
|
||||||
</div>
|
</div>
|
||||||
{#if references.length > 0}
|
{#if value.length > 0}
|
||||||
<Sortable sortableClass="mt-3" on:update={reorder}>
|
<Sortable sortableClass="mt-3" on:update={reorder}>
|
||||||
{#each references as reference (reference.record.id)}
|
{#each value ?? [] as aFile (aFile.id)}
|
||||||
<!--This div helps the sorting thing-->
|
<!--This div helps the sorting thing-->
|
||||||
<div>
|
<div>
|
||||||
<PreviewFile
|
<PreviewFile
|
||||||
record={reference.record}
|
file={aFile}
|
||||||
edge={reference.edge}
|
|
||||||
hasDelete={true}
|
hasDelete={true}
|
||||||
on:remove={removeReference}
|
on:remove_file={removeFile}
|
||||||
on:restore={restoreReference}
|
|
||||||
on:fulldelete={fullDelete}
|
|
||||||
></PreviewFile>
|
></PreviewFile>
|
||||||
</div>
|
</div>
|
||||||
{/each}
|
{/each}
|
||||||
</Sortable>
|
</Sortable>
|
||||||
{/if}
|
{/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,6 @@
|
|||||||
<script>
|
<script>
|
||||||
import { getContext } from "svelte";
|
import { getContext } from "svelte";
|
||||||
import {
|
import { insertEdges } from "./reference";
|
||||||
fullDeleteRecord,
|
|
||||||
graphToReferences,
|
|
||||||
insertEdges,
|
|
||||||
removeReferenceFromGraph,
|
|
||||||
restoreReferenceToGraph
|
|
||||||
} from "./reference";
|
|
||||||
import { getErrorMessage } from "./errorMessage";
|
import { getErrorMessage } from "./errorMessage";
|
||||||
import { sortByField } from "../../edges/sortEdges";
|
import { sortByField } from "../../edges/sortEdges";
|
||||||
import ReferenceInlineButtons from "./ReferenceInlineButtons.svelte";
|
import ReferenceInlineButtons from "./ReferenceInlineButtons.svelte";
|
||||||
@@ -20,37 +14,57 @@
|
|||||||
export let validationErrors;
|
export let validationErrors;
|
||||||
$: errorMessage = getErrorMessage(validationErrors, field.name);
|
$: errorMessage = getErrorMessage(validationErrors, field.name);
|
||||||
|
|
||||||
|
$: references =
|
||||||
$: references = graphToReferences(graph,record,field)
|
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) =>
|
let collections = channel.schemas.filter((aschema) =>
|
||||||
field.collections.includes(aschema.name)
|
field.collections.includes(aschema.name),
|
||||||
);
|
);
|
||||||
|
|
||||||
function removeReference(e) {
|
function removeReference(e) {
|
||||||
e.preventDefault();
|
e.preventDefault();
|
||||||
graph.edges = removeReferenceFromGraph(graph,field,e.detail)
|
graph.edges = graph.edges.filter(
|
||||||
}
|
(edge) => !(edge.target === e.detail && edge.field === field.name),
|
||||||
|
);
|
||||||
function restoreReference(e) {
|
|
||||||
e.preventDefault();
|
|
||||||
graph.edges = restoreReferenceToGraph(graph,field,e.detail)
|
|
||||||
}
|
|
||||||
|
|
||||||
function fullDelete(e) {
|
|
||||||
e.preventDefault();
|
|
||||||
graph.edges = fullDeleteRecord(channel,graph, field, e.detail)
|
|
||||||
}
|
}
|
||||||
|
|
||||||
function reorder(e) {
|
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) {
|
function insert(e) {
|
||||||
e.preventDefault();
|
e.preventDefault();
|
||||||
graph = insertEdges(graph, record, e.detail.records, field.name, e.detail.action);
|
// axios.post(channel.lucentUrl + "/edges/insert-many", {
|
||||||
|
// source: record.id,
|
||||||
|
// sourceSchema: record.schema,
|
||||||
|
// targetSchema: e.detail.schema,
|
||||||
|
// field: field.name,
|
||||||
|
// targets: e.detail.records.map(r => r.id),
|
||||||
|
// }).then(function (response) {
|
||||||
|
// graph = response.data.graph;
|
||||||
|
// })
|
||||||
|
graph = insertEdges(
|
||||||
|
graph,
|
||||||
|
record,
|
||||||
|
e.detail.records,
|
||||||
|
field.name,
|
||||||
|
e.detail.action,
|
||||||
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
</script>
|
</script>
|
||||||
|
|
||||||
{#if errorMessage}
|
{#if errorMessage}
|
||||||
@@ -68,16 +82,13 @@
|
|||||||
</div>
|
</div>
|
||||||
{#if references.length > 0}
|
{#if references.length > 0}
|
||||||
<Sortable sortableClass="row row-cols-3 mt-3" on:update={reorder}>
|
<Sortable sortableClass="row row-cols-3 mt-3" on:update={reorder}>
|
||||||
{#each references as reference (reference.record.id)}
|
{#each references as reference (reference.id)}
|
||||||
<div>
|
<div>
|
||||||
<PreviewReference
|
<PreviewReference
|
||||||
{graph}
|
{graph}
|
||||||
record={reference.record}
|
record={reference}
|
||||||
edge={reference.edge}
|
|
||||||
hasDelete={true}
|
hasDelete={true}
|
||||||
on:remove={removeReference}
|
on:remove={removeReference}
|
||||||
on:restore={restoreReference}
|
|
||||||
on:fulldelete={fullDelete}
|
|
||||||
/>
|
/>
|
||||||
</div>
|
</div>
|
||||||
{/each}
|
{/each}
|
||||||
|
|||||||
@@ -4,8 +4,8 @@
|
|||||||
import InlineEdit from "../InlineEdit.svelte";
|
import InlineEdit from "../InlineEdit.svelte";
|
||||||
import Dialog from "../../dialog/Dialog.svelte";
|
import Dialog from "../../dialog/Dialog.svelte";
|
||||||
import DialogRecord from "../../dialog/DialogRecord.svelte";
|
import DialogRecord from "../../dialog/DialogRecord.svelte";
|
||||||
import axios from "axios";
|
|
||||||
import Dropdown from "../../common/Dropdown.svelte";
|
import Dropdown from "../../common/Dropdown.svelte";
|
||||||
|
import { apiGet } from "../../../helpers";
|
||||||
|
|
||||||
const dispatch = createEventDispatcher();
|
const dispatch = createEventDispatcher();
|
||||||
const channel = getContext("channel");
|
const channel = getContext("channel");
|
||||||
@@ -24,7 +24,7 @@
|
|||||||
e.preventDefault();
|
e.preventDefault();
|
||||||
console.log("Save inline");
|
console.log("Save inline");
|
||||||
inLineCreateRecord = null;
|
inLineCreateRecord = null;
|
||||||
dialogRecord.close()
|
dialogRecord.close();
|
||||||
dispatch("save", {
|
dispatch("save", {
|
||||||
records: e.detail.records,
|
records: e.detail.records,
|
||||||
after: recordId,
|
after: recordId,
|
||||||
@@ -44,11 +44,10 @@
|
|||||||
function createInlineReference(e, schemaUId) {
|
function createInlineReference(e, schemaUId) {
|
||||||
e.preventDefault();
|
e.preventDefault();
|
||||||
inLineCreateRecord = null;
|
inLineCreateRecord = null;
|
||||||
axios
|
apiGet(channel.lucentUrl + "/records/newInline?schema=" + schemaUId)
|
||||||
.get(channel.lucentUrl + "/records/newInline?schema=" + schemaUId)
|
|
||||||
.then((response) => {
|
.then((response) => {
|
||||||
inLineCreateRecord = response.data;
|
inLineCreateRecord = response;
|
||||||
dialogRecord.open()
|
dialogRecord.open();
|
||||||
})
|
})
|
||||||
.catch((error) => {
|
.catch((error) => {
|
||||||
console.log(error);
|
console.log(error);
|
||||||
@@ -57,20 +56,16 @@
|
|||||||
</script>
|
</script>
|
||||||
|
|
||||||
{#if schemas.length > 1}
|
{#if schemas.length > 1}
|
||||||
<div
|
<div style="display: flex;align-items: center;gap:4px">
|
||||||
style="display: flex;align-items: center;gap:4px"
|
|
||||||
>
|
|
||||||
<Dropdown>
|
<Dropdown>
|
||||||
<div slot="button">New</div>
|
<div slot="button">New</div>
|
||||||
{#each schemas as schema}
|
{#each schemas as schema}
|
||||||
<button
|
<button
|
||||||
class=" button"
|
class=" button"
|
||||||
on:click={(e) =>
|
on:click={(e) => createInlineReference(e, schema.name)}
|
||||||
createInlineReference(e, schema.name)}
|
|
||||||
>{schema.label}
|
>{schema.label}
|
||||||
</button>
|
</button>
|
||||||
{/each}
|
{/each}
|
||||||
|
|
||||||
</Dropdown>
|
</Dropdown>
|
||||||
<Dropdown>
|
<Dropdown>
|
||||||
<div slot="button"><Icon icon="magnifying-glass" /></div>
|
<div slot="button"><Icon icon="magnifying-glass" /></div>
|
||||||
@@ -81,7 +76,6 @@
|
|||||||
>{schema.label}
|
>{schema.label}
|
||||||
</button>
|
</button>
|
||||||
{/each}
|
{/each}
|
||||||
|
|
||||||
</Dropdown>
|
</Dropdown>
|
||||||
</div>
|
</div>
|
||||||
{:else}
|
{:else}
|
||||||
@@ -96,8 +90,7 @@
|
|||||||
on:click={(e) => openBrowseModal(e, schemas[0].name)}
|
on:click={(e) => openBrowseModal(e, schemas[0].name)}
|
||||||
>
|
>
|
||||||
<Icon icon="magnifying-glass" />
|
<Icon icon="magnifying-glass" />
|
||||||
</button
|
</button>
|
||||||
>
|
|
||||||
</div>
|
</div>
|
||||||
{/if}
|
{/if}
|
||||||
|
|
||||||
@@ -109,7 +102,6 @@
|
|||||||
on:cancel={(e) => (inLineCreateRecord = null)}
|
on:cancel={(e) => (inLineCreateRecord = null)}
|
||||||
on:inlinesaved={save}
|
on:inlinesaved={save}
|
||||||
/>
|
/>
|
||||||
|
|
||||||
{/if}
|
{/if}
|
||||||
</DialogRecord>
|
</DialogRecord>
|
||||||
|
|
||||||
|
|||||||
@@ -1,11 +1,8 @@
|
|||||||
<script>
|
<script>
|
||||||
import { getContext } from "svelte";
|
import { getContext } from "svelte";
|
||||||
import {debounce} from "../../../debounce.js";
|
|
||||||
import {previewTitle} from "../Preview";
|
|
||||||
import { getErrorMessage } from "./errorMessage";
|
import { getErrorMessage } from "./errorMessage";
|
||||||
import { insertEdges } from "./reference.js";
|
import { insertEdges } from "./reference.js";
|
||||||
import Icon from "../../common/Icon.svelte";
|
import Icon from "../../common/Icon.svelte";
|
||||||
import axios from "axios";
|
|
||||||
|
|
||||||
const channel = getContext("channel");
|
const channel = getContext("channel");
|
||||||
export let field;
|
export let field;
|
||||||
@@ -16,20 +13,24 @@
|
|||||||
export let validationErrors;
|
export let validationErrors;
|
||||||
$: errorMessage = getErrorMessage(validationErrors, field.name);
|
$: errorMessage = getErrorMessage(validationErrors, field.name);
|
||||||
|
|
||||||
$: references = graph.edges
|
$: references =
|
||||||
|
graph.edges
|
||||||
.filter((edge) => edge.field === field.name)
|
.filter((edge) => edge.field === field.name)
|
||||||
.map((edge) => {
|
.map((edge) => {
|
||||||
return graph.records.find((increc) => increc.id === edge.target && record.id === edge.source);
|
return graph.records.find(
|
||||||
}).filter((rec) => (rec?.id ? true : false)) ?? [];
|
(increc) =>
|
||||||
|
increc.id == edge.target && record.id == edge.source,
|
||||||
let search = ""
|
);
|
||||||
$: searchOptions = []
|
})
|
||||||
|
.filter((rec) => (rec?.id ? true : false)) ?? [];
|
||||||
|
|
||||||
|
let search = "";
|
||||||
|
$: searchOptions = [];
|
||||||
|
|
||||||
function removeReference(e, recordId) {
|
function removeReference(e, recordId) {
|
||||||
e.preventDefault();
|
e.preventDefault();
|
||||||
graph.edges = graph.edges.filter(
|
graph.edges = graph.edges.filter(
|
||||||
(edge) => !(edge.target === recordId && edge.field === field.name)
|
(edge) => !(edge.target === recordId && edge.field === field.name),
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -42,25 +43,33 @@
|
|||||||
schema: field.collections[0],
|
schema: field.collections[0],
|
||||||
status: "published",
|
status: "published",
|
||||||
data: {
|
data: {
|
||||||
[field.searchField]: newValue
|
[field.searchField]: newValue,
|
||||||
}
|
},
|
||||||
},
|
},
|
||||||
})
|
})
|
||||||
.then((response) => {
|
.then((response) => {
|
||||||
searchOptions = [];
|
searchOptions = [];
|
||||||
insert(e, response.data.records[0]);
|
insert(e, response.data.records[0]);
|
||||||
|
console.log(response);
|
||||||
})
|
})
|
||||||
.catch((error) => {
|
.catch((error) => {
|
||||||
searchOptions = [];
|
searchOptions = [];
|
||||||
|
console.log(error);
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
function insert(e, insertRecord) {
|
function insert(e, insertRecord) {
|
||||||
e.preventDefault();
|
e.preventDefault();
|
||||||
graph = insertEdges(graph, record, [insertRecord], field.name, e.detail.action);
|
graph = insertEdges(
|
||||||
search = ""
|
graph,
|
||||||
searchEl.focus()
|
record,
|
||||||
searchEl.blur()
|
[insertRecord],
|
||||||
|
field.name,
|
||||||
|
e.detail.action,
|
||||||
|
);
|
||||||
|
search = "";
|
||||||
|
searchEl.focus();
|
||||||
|
searchEl.blur();
|
||||||
}
|
}
|
||||||
|
|
||||||
const updateResults = debounce((e) => {
|
const updateResults = debounce((e) => {
|
||||||
@@ -78,11 +87,11 @@
|
|||||||
})
|
})
|
||||||
.catch((error) => {
|
.catch((error) => {
|
||||||
searchOptions = [];
|
searchOptions = [];
|
||||||
|
console.log(error);
|
||||||
});
|
});
|
||||||
}, 500);
|
}, 500);
|
||||||
|
|
||||||
|
|
||||||
</script>
|
</script>
|
||||||
|
|
||||||
<div class="reference-tags">
|
<div class="reference-tags">
|
||||||
{#if errorMessage}
|
{#if errorMessage}
|
||||||
<div class="invalid-feedback d-block mb-3">
|
<div class="invalid-feedback d-block mb-3">
|
||||||
@@ -102,7 +111,6 @@
|
|||||||
/>
|
/>
|
||||||
|
|
||||||
<div class="reference-tags-results">
|
<div class="reference-tags-results">
|
||||||
|
|
||||||
{#if searchOptions}
|
{#if searchOptions}
|
||||||
{#each searchOptions as option (option.id)}
|
{#each searchOptions as option (option.id)}
|
||||||
<div
|
<div
|
||||||
@@ -112,14 +120,10 @@
|
|||||||
on:click={(e) => insert(e, option)}
|
on:click={(e) => insert(e, option)}
|
||||||
on:keypress={(e) => insert(e, option)}
|
on:keypress={(e) => insert(e, option)}
|
||||||
>
|
>
|
||||||
{previewTitle(channel.schemas, option ,graph)}
|
{option.data.name}
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
{:else}
|
{:else}
|
||||||
<div
|
<div class="start-typing">Start typing...</div>
|
||||||
class="start-typing">
|
|
||||||
Start typing...
|
|
||||||
</div>
|
|
||||||
{/each}
|
{/each}
|
||||||
{/if}
|
{/if}
|
||||||
{#if search}
|
{#if search}
|
||||||
@@ -144,22 +148,19 @@
|
|||||||
class="record-title"
|
class="record-title"
|
||||||
href="{channel.lucentUrl}/records/{record.id}"
|
href="{channel.lucentUrl}/records/{record.id}"
|
||||||
>
|
>
|
||||||
{previewTitle(channel.schemas, record)}
|
{record.data.name}
|
||||||
</a>
|
</a>
|
||||||
|
|
||||||
<button
|
<button
|
||||||
on:click|preventDefault={(e) => removeReference(e, record.id)}
|
on:click|preventDefault={(e) =>
|
||||||
|
removeReference(e, record.id)}
|
||||||
type="button"
|
type="button"
|
||||||
class="button-text"
|
class="button-text"
|
||||||
aria-label="Close"
|
aria-label="Close"
|
||||||
>
|
>
|
||||||
<Icon width={12} height={12} icon="close"></Icon>
|
<Icon width={12} height={12} icon="close"></Icon>
|
||||||
</button>
|
</button>
|
||||||
|
|
||||||
</span>
|
</span>
|
||||||
{/each}
|
{/each}
|
||||||
</div>
|
</div>
|
||||||
{/if}
|
{/if}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
@@ -18,13 +18,13 @@
|
|||||||
};
|
};
|
||||||
|
|
||||||
function insertMedia(e) {
|
function insertMedia(e) {
|
||||||
editor.insertMedia(e.detail)
|
editor.insertMedia(e.detail);
|
||||||
}
|
}
|
||||||
</script>
|
</script>
|
||||||
|
|
||||||
<div class="mb-0">
|
<div class="mb-0">
|
||||||
|
|
||||||
<Trix {field} bind:this={editor} bind:value></Trix>
|
<Trix {field} bind:this={editor} bind:value></Trix>
|
||||||
|
<!-- <Tinymce bind:this={editor} bind:value {additionalConfig}/>-->
|
||||||
{#if field.collections.length > 0}
|
{#if field.collections.length > 0}
|
||||||
<RichEditorFiles
|
<RichEditorFiles
|
||||||
bind:graph
|
bind:graph
|
||||||
@@ -32,13 +32,9 @@
|
|||||||
{field}
|
{field}
|
||||||
{validationErrors}
|
{validationErrors}
|
||||||
on:editor-insert={insertMedia}
|
on:editor-insert={insertMedia}
|
||||||
>
|
></RichEditorFiles>
|
||||||
|
|
||||||
|
|
||||||
</RichEditorFiles>
|
|
||||||
{/if}
|
{/if}
|
||||||
|
|
||||||
|
|
||||||
{#if errorMessage}
|
{#if errorMessage}
|
||||||
<div class="invalid-feedback d-block">
|
<div class="invalid-feedback d-block">
|
||||||
{errorMessage}
|
{errorMessage}
|
||||||
|
|||||||
@@ -0,0 +1,47 @@
|
|||||||
|
<script>
|
||||||
|
import { getContext } from "svelte";
|
||||||
|
import Icon from "../../common/Icon.svelte";
|
||||||
|
import { getErrorMessage } from "./errorMessage";
|
||||||
|
const channelurl = getContext("channelurl");
|
||||||
|
export let validationErrors;
|
||||||
|
$: errorMessage = getErrorMessage(validationErrors, field.name);
|
||||||
|
export let field;
|
||||||
|
export let value;
|
||||||
|
export let id;
|
||||||
|
export let isCreateMode;
|
||||||
|
let readonly = field.readonly && !isCreateMode;
|
||||||
|
|
||||||
|
function generateId(e) {
|
||||||
|
e.preventDefault();
|
||||||
|
value = self.crypto.randomUUID();
|
||||||
|
}
|
||||||
|
</script>
|
||||||
|
|
||||||
|
<div class="mb-0">
|
||||||
|
<div class="d-flex justify-content-between">
|
||||||
|
<input
|
||||||
|
type="text"
|
||||||
|
{id}
|
||||||
|
class="form-control"
|
||||||
|
class:is-invalid={errorMessage}
|
||||||
|
bind:value
|
||||||
|
autocomplete="off"
|
||||||
|
{readonly}
|
||||||
|
/>
|
||||||
|
{#if !readonly}
|
||||||
|
<button
|
||||||
|
class="btn btn-primary ms-2"
|
||||||
|
title="Generate a new UUIDv4"
|
||||||
|
on:click={generateId}
|
||||||
|
>
|
||||||
|
<Icon icon="dice" />
|
||||||
|
</button>
|
||||||
|
{/if}
|
||||||
|
</div>
|
||||||
|
|
||||||
|
{#if errorMessage}
|
||||||
|
<div class="invalid-feedback d-block">
|
||||||
|
{errorMessage}
|
||||||
|
</div>
|
||||||
|
{/if}
|
||||||
|
</div>
|
||||||
@@ -0,0 +1,29 @@
|
|||||||
|
<script>
|
||||||
|
import { getContext } from "svelte";
|
||||||
|
const channelurl = getContext("channelurl");
|
||||||
|
export let field;
|
||||||
|
export let value;
|
||||||
|
export let schema;
|
||||||
|
let id = self.crypto.randomUUID();
|
||||||
|
</script>
|
||||||
|
|
||||||
|
<div class="mb-0">
|
||||||
|
<div class="d-flex justify-content-between">
|
||||||
|
<label for={id} class="form-label">{field.label}</label>
|
||||||
|
<a
|
||||||
|
class="text-decoration-none"
|
||||||
|
href="{channelurl}/schemas/{schema.name}/fields/edit/{field.name}"
|
||||||
|
><code class="text-primary opacity-50">{field.name}</code></a
|
||||||
|
>
|
||||||
|
</div>
|
||||||
|
<input
|
||||||
|
type="url"
|
||||||
|
{id}
|
||||||
|
class="form-control"
|
||||||
|
bind:value
|
||||||
|
placeholder="https://www.example.com"
|
||||||
|
/>
|
||||||
|
{#if field.help}
|
||||||
|
<small class=" text-primary opacity-50">{field.help}</small>
|
||||||
|
{/if}
|
||||||
|
</div>
|
||||||
@@ -1,14 +1,21 @@
|
|||||||
import {uniqueBy} from "../../../helpers.js";
|
import { arrayUniqueCb } from "../../../helpers";
|
||||||
import axios from "axios";
|
|
||||||
|
|
||||||
export function insertEdges(graph, sourceRecord, targetRecords, fieldName, action = "") {
|
export function insertEdges(
|
||||||
|
graph,
|
||||||
|
sourceRecord,
|
||||||
|
targetRecords,
|
||||||
|
fieldName,
|
||||||
|
action = "",
|
||||||
|
) {
|
||||||
let newEdges = targetRecords.map((r) => {
|
let newEdges = targetRecords.map((r) => {
|
||||||
return {
|
return {
|
||||||
target: r.id,
|
target: r.id,
|
||||||
source: sourceRecord.id,
|
source: sourceRecord.id,
|
||||||
|
sourceSchema: sourceRecord.schema,
|
||||||
|
targetSchema: r.schema,
|
||||||
field: fieldName,
|
field: fieldName,
|
||||||
depth: 1,
|
depth: 1,
|
||||||
rank: ""
|
rank: "",
|
||||||
};
|
};
|
||||||
});
|
});
|
||||||
|
|
||||||
@@ -17,53 +24,13 @@ export function insertEdges(graph, sourceRecord, targetRecords, fieldName, actio
|
|||||||
replacedEdges = replacedEdges.filter((edge) => edge.field !== field.name);
|
replacedEdges = replacedEdges.filter((edge) => edge.field !== field.name);
|
||||||
}
|
}
|
||||||
|
|
||||||
graph.records = uniqueBy([...graph.records, ...targetRecords], (r) => r.id);
|
graph.records = arrayUniqueCb(
|
||||||
graph.edges = uniqueBy([...replacedEdges, ...newEdges], (edge) => edge.source + edge.target + edge.field + edge.depth);
|
[...graph.records, ...targetRecords],
|
||||||
|
(r) => r.id,
|
||||||
|
);
|
||||||
|
graph.edges = arrayUniqueCb(
|
||||||
|
[...replacedEdges, ...newEdges],
|
||||||
|
(edge) => edge.source + edge.target + edge.field + edge.depth,
|
||||||
|
);
|
||||||
return graph;
|
return graph;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
export function graphToReferences(graph,record,field){
|
|
||||||
return graph.edges
|
|
||||||
.filter((edge) => edge.field === field.name)
|
|
||||||
.map((edge) => {
|
|
||||||
return {
|
|
||||||
record: graph.records.find((increc) => increc.id === edge.target && record.id === edge.source),
|
|
||||||
edge: edge
|
|
||||||
};
|
|
||||||
}).filter((rec) => (rec.record?.id ? true : false)) ?? [];
|
|
||||||
}
|
|
||||||
|
|
||||||
export function removeReferenceFromGraph(graph,field,id){
|
|
||||||
return graph.edges.map(
|
|
||||||
(edge) => {
|
|
||||||
if(edge.target === id && edge.field === field.name){
|
|
||||||
edge._isTrashed = true;
|
|
||||||
}
|
|
||||||
return edge;
|
|
||||||
}
|
|
||||||
);
|
|
||||||
}
|
|
||||||
|
|
||||||
export function restoreReferenceToGraph(graph,field,id){
|
|
||||||
return graph.edges.map(
|
|
||||||
(edge) => {
|
|
||||||
if(edge.target === id && edge.field === field.name){
|
|
||||||
edge._isTrashed = false;
|
|
||||||
}
|
|
||||||
return edge;
|
|
||||||
}
|
|
||||||
);
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
export function fullDeleteRecord(channel,graph,field,id){
|
|
||||||
axios
|
|
||||||
.post(channel.lucentUrl + "/records/status/trashed" , {
|
|
||||||
records: [id]
|
|
||||||
});
|
|
||||||
|
|
||||||
return graph.edges.filter(
|
|
||||||
(edge) => !(edge.target === id && edge.field === field.name)
|
|
||||||
);
|
|
||||||
}
|
|
||||||
@@ -3,6 +3,7 @@
|
|||||||
import Icon from "../../common/Icon.svelte";
|
import Icon from "../../common/Icon.svelte";
|
||||||
import Dropdown from "../../common/Dropdown.svelte";
|
import Dropdown from "../../common/Dropdown.svelte";
|
||||||
import StatusSelect from "./StatusSelect.svelte";
|
import StatusSelect from "./StatusSelect.svelte";
|
||||||
|
import { apiPost } from "../../../helpers";
|
||||||
|
|
||||||
const channel = getContext("channel");
|
const channel = getContext("channel");
|
||||||
export let schema;
|
export let schema;
|
||||||
@@ -12,16 +13,14 @@
|
|||||||
|
|
||||||
function clone(e) {
|
function clone(e) {
|
||||||
e.preventDefault();
|
e.preventDefault();
|
||||||
axios.post(channel.lucentUrl + "/records/clone/" + record.id).then(response => {
|
apiPost(channel.lucentUrl + "/records/clone/" + record.id)
|
||||||
window.location = channel.lucentUrl + "/records/" + response.data.id;
|
.then((response) => {
|
||||||
}).catch(error => {
|
window.location = channel.lucentUrl + "/records/" + response.id;
|
||||||
|
})
|
||||||
});
|
.catch((error) => {});
|
||||||
}
|
}
|
||||||
</script>
|
</script>
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
<div style="display: flex;align-items: center; gap:10px;">
|
<div style="display: flex;align-items: center; gap:10px;">
|
||||||
{#if !isCreateMode}
|
{#if !isCreateMode}
|
||||||
<Dropdown>
|
<Dropdown>
|
||||||
@@ -44,10 +43,9 @@
|
|||||||
</a>
|
</a>
|
||||||
{/if}
|
{/if}
|
||||||
<a
|
<a
|
||||||
on:click|preventDefault={(e) =>
|
on:click|preventDefault={(e) => (activeContentTab = "_info")}
|
||||||
(activeContentTab = "_info")}
|
|
||||||
class="dropdown-item"
|
class="dropdown-item"
|
||||||
href="{channel.lucentUrl}">Revisions</a
|
href={channel.lucentUrl}>Revisions</a
|
||||||
>
|
>
|
||||||
</Dropdown>
|
</Dropdown>
|
||||||
{/if}
|
{/if}
|
||||||
|
|||||||
@@ -1,27 +1,21 @@
|
|||||||
<script>
|
<script>
|
||||||
import { getContext } from "svelte";
|
import { getContext } from "svelte";
|
||||||
import {previewTitle} from "./../Preview";
|
|
||||||
|
|
||||||
const channel = getContext("channel");
|
const channel = getContext("channel");
|
||||||
export let schema;
|
export let schema;
|
||||||
export let record;
|
export let record;
|
||||||
export let isCreateMode;
|
export let isCreateMode;
|
||||||
|
|
||||||
</script>
|
</script>
|
||||||
|
|
||||||
<div class="record-header">
|
<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
|
>{schema.label.toUpperCase()}</a
|
||||||
>
|
>
|
||||||
<span class="record-title">
|
<span class="record-title">
|
||||||
{#if !isCreateMode}
|
{#if !isCreateMode}
|
||||||
{previewTitle(channel.schemas, record)}
|
{record.data.name}
|
||||||
{:else}
|
{:else}
|
||||||
New Record
|
New Record
|
||||||
{/if}
|
{/if}
|
||||||
</span>
|
</span>
|
||||||
|
|
||||||
</div>
|
</div>
|
||||||
@@ -3,121 +3,75 @@
|
|||||||
|
|
||||||
import { createEventDispatcher, getContext } from "svelte";
|
import { createEventDispatcher, getContext } from "svelte";
|
||||||
import Preview from "../../files/Preview.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";
|
import Dropdown from "../../common/Dropdown.svelte";
|
||||||
|
|
||||||
const dispatch = createEventDispatcher();
|
const dispatch = createEventDispatcher();
|
||||||
const channel = getContext("channel");
|
const channel = getContext("channel");
|
||||||
export let record;
|
export let file;
|
||||||
export let edge;
|
|
||||||
export let hasDelete = false;
|
export let hasDelete = false;
|
||||||
export let hasInsert = 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);
|
let imagePresets = Object.keys(channel.imageFilters);
|
||||||
|
|
||||||
function remove(e) {
|
function remove(e) {
|
||||||
e.preventDefault();
|
e.preventDefault();
|
||||||
dispatch("remove", record.id);
|
dispatch("remove_file", file.id);
|
||||||
}
|
|
||||||
|
|
||||||
function restore(e) {
|
|
||||||
e.preventDefault();
|
|
||||||
dispatch("restore", record.id);
|
|
||||||
}
|
|
||||||
|
|
||||||
function fullDelete(e) {
|
|
||||||
e.preventDefault();
|
|
||||||
dispatch("fulldelete", record.id);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
function insert(e, preset) {
|
function insert(e, preset) {
|
||||||
e.preventDefault();
|
e.preventDefault();
|
||||||
let html = htmlurl(channel, record, preset)
|
// let html = htmlurl(channel, record, preset);
|
||||||
let url = !preset ? `/${record._file.path}` : `/templates/${preset}/${record._file.path}`;
|
// let url = !preset
|
||||||
dispatch("editor-insert", {
|
// ? `/${record._file.path}`
|
||||||
html: html,
|
// : `/templates/${preset}/${record._file.path}`;
|
||||||
url: channel.filesUrl + url,
|
// dispatch("editor-insert", {
|
||||||
originalUrl: channel.filesUrl + "/" + record._file.path,
|
// html: html,
|
||||||
record: record
|
// url: channel.filesUrl + url,
|
||||||
});
|
// originalUrl: channel.filesUrl + "/" + record._file.path,
|
||||||
|
// record: record,
|
||||||
|
// });
|
||||||
}
|
}
|
||||||
|
|
||||||
</script>
|
</script>
|
||||||
|
|
||||||
<div class="preview-file" class:is-trashed={edge?._isTrashed}>
|
<div class="preview-file">
|
||||||
<div style="display: flex;align-items: center;gap: 10px;">
|
<div style="display: flex;align-items: center;gap: 10px;">
|
||||||
<div class="image">
|
<div class="image">
|
||||||
<Preview {record} size="small"/>
|
<Preview {file} size="small" />
|
||||||
</div>
|
</div>
|
||||||
<div class="title">
|
<div class="title">
|
||||||
<div>
|
<div>
|
||||||
<a
|
{file.filename}
|
||||||
class="record-title"
|
</div>
|
||||||
href="{channel.lucentUrl}/records/{record.id}"
|
</div>
|
||||||
|
</div>
|
||||||
|
<div
|
||||||
|
style="display: flex;gap:4px; align-items: center; margin-right: 10px;"
|
||||||
>
|
>
|
||||||
{cardTitle}
|
|
||||||
{#if edge?._isTrashed}
|
|
||||||
<span class="trashed-text">will remove on save</span>
|
|
||||||
{/if}
|
|
||||||
</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}
|
{#if hasInsert}
|
||||||
<div class="reference-action">
|
<div class="reference-action">
|
||||||
<Dropdown>
|
<Dropdown>
|
||||||
<div slot="button">
|
<div slot="button">
|
||||||
<Icon icon="photo-film" />
|
<Icon icon="photo-film" />
|
||||||
</div>
|
</div>
|
||||||
<button class="dropdown-item button" on:click={e => insert(e,null)}>original</button>
|
<button
|
||||||
|
class="dropdown-item button"
|
||||||
|
on:click={(e) => insert(e, null)}>original</button
|
||||||
|
>
|
||||||
{#each imagePresets as preset}
|
{#each imagePresets as preset}
|
||||||
<button class="dropdown-item button" on:click={e => insert(e,preset)}>{preset}</button>
|
<button
|
||||||
|
class="dropdown-item button"
|
||||||
|
on:click={(e) => insert(e, preset)}>{preset}</button
|
||||||
|
>
|
||||||
{/each}
|
{/each}
|
||||||
</Dropdown>
|
</Dropdown>
|
||||||
|
|
||||||
</div>
|
</div>
|
||||||
{/if}
|
{/if}
|
||||||
{#if hasDelete}
|
{#if hasDelete}
|
||||||
<div class="reference-action">
|
<div class="reference-action">
|
||||||
{#if edge?._isTrashed}
|
<button class="button" on:click={remove}>
|
||||||
<button
|
|
||||||
title="Restore"
|
|
||||||
class="button"
|
|
||||||
on:click={restore}
|
|
||||||
>
|
|
||||||
<Icon icon="undo"/>
|
|
||||||
</button>
|
|
||||||
<button
|
|
||||||
title="Delete from everywhere"
|
|
||||||
class="button"
|
|
||||||
on:click={fullDelete}
|
|
||||||
>
|
|
||||||
<Icon icon="destroy"/>
|
|
||||||
</button>
|
|
||||||
{:else}
|
|
||||||
<button
|
|
||||||
title="Remove"
|
|
||||||
class="button"
|
|
||||||
on:click={remove}
|
|
||||||
>
|
|
||||||
<Icon icon="trash-can" />
|
<Icon icon="trash-can" />
|
||||||
</button>
|
</button>
|
||||||
{/if}
|
|
||||||
</div>
|
</div>
|
||||||
{/if}
|
{/if}
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
@@ -2,7 +2,6 @@
|
|||||||
import Icon from "../../common/Icon.svelte";
|
import Icon from "../../common/Icon.svelte";
|
||||||
|
|
||||||
import { createEventDispatcher, getContext } from "svelte";
|
import { createEventDispatcher, getContext } from "svelte";
|
||||||
import {previewTitle} from "./../Preview";
|
|
||||||
import Status from "./../Status.svelte";
|
import Status from "./../Status.svelte";
|
||||||
import Preview from "../../files/Preview.svelte";
|
import Preview from "../../files/Preview.svelte";
|
||||||
|
|
||||||
@@ -10,34 +9,26 @@
|
|||||||
const channel = getContext("channel");
|
const channel = getContext("channel");
|
||||||
export let graph;
|
export let graph;
|
||||||
export let record;
|
export let record;
|
||||||
export let edge;
|
|
||||||
export let hasDelete = false;
|
export let hasDelete = false;
|
||||||
|
|
||||||
let schema = channel.schemas.find((aschema) => aschema.name === record.schema);
|
let schema = channel.schemas.find(
|
||||||
let cardTitle = previewTitle(channel.schemas, record, graph);
|
(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);
|
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) {
|
function remove(e) {
|
||||||
e.preventDefault();
|
e.preventDefault();
|
||||||
dispatch("remove", record.id);
|
dispatch("remove", record.id);
|
||||||
}
|
}
|
||||||
|
|
||||||
function restore(e) {
|
|
||||||
e.preventDefault();
|
|
||||||
dispatch("restore", record.id);
|
|
||||||
}
|
|
||||||
|
|
||||||
function fullDelete(e) {
|
|
||||||
e.preventDefault();
|
|
||||||
dispatch("fulldelete", record.id);
|
|
||||||
}
|
|
||||||
</script>
|
</script>
|
||||||
|
|
||||||
|
<div class="preview-reference">
|
||||||
<div class="preview-reference" class:is-trashed={edge?._isTrashed}>
|
|
||||||
<div style="display: flex;align-items: center;gap: 10px;">
|
<div style="display: flex;align-items: center;gap: 10px;">
|
||||||
|
|
||||||
{#if cardImageRecord}
|
{#if cardImageRecord}
|
||||||
<div class="image">
|
<div class="image">
|
||||||
<Preview record={cardImageRecord} size="small" />
|
<Preview record={cardImageRecord} size="small" />
|
||||||
@@ -49,12 +40,7 @@
|
|||||||
class="record-title"
|
class="record-title"
|
||||||
href="{channel.lucentUrl}/records/{record.id}"
|
href="{channel.lucentUrl}/records/{record.id}"
|
||||||
>
|
>
|
||||||
|
{record.data.name}
|
||||||
{cardTitle}
|
|
||||||
{#if edge?._isTrashed}
|
|
||||||
<span class="trashed-text">will remove on save</span>
|
|
||||||
{/if}
|
|
||||||
|
|
||||||
</a>
|
</a>
|
||||||
<small class="d-block">
|
<small class="d-block">
|
||||||
from {schema.label}
|
from {schema.label}
|
||||||
@@ -62,38 +48,14 @@
|
|||||||
<Status status={record.status} />
|
<Status status={record.status} />
|
||||||
{/if}
|
{/if}
|
||||||
</small>
|
</small>
|
||||||
|
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
{#if hasDelete}
|
{#if hasDelete}
|
||||||
<div class="reference-action">
|
<div class="reference-action">
|
||||||
{#if edge?._isTrashed}
|
<button class="button" on:click={remove}>
|
||||||
<button
|
|
||||||
title="Restore"
|
|
||||||
class="button"
|
|
||||||
on:click={restore}
|
|
||||||
>
|
|
||||||
<Icon icon="undo"/>
|
|
||||||
</button>
|
|
||||||
<button
|
|
||||||
title="Delete from everywhere"
|
|
||||||
class="button"
|
|
||||||
on:click={fullDelete}
|
|
||||||
>
|
|
||||||
<Icon icon="destroy"/>
|
|
||||||
</button>
|
|
||||||
{:else}
|
|
||||||
<button
|
|
||||||
title="Remove"
|
|
||||||
class="button"
|
|
||||||
on:click={remove}
|
|
||||||
>
|
|
||||||
<Icon icon="trash-can" />
|
<Icon icon="trash-can" />
|
||||||
</button>
|
</button>
|
||||||
{/if}
|
|
||||||
</div>
|
</div>
|
||||||
{/if}
|
{/if}
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
@@ -1,6 +1,6 @@
|
|||||||
<script>
|
<script>
|
||||||
import Preview from "../../files/Preview.svelte";
|
|
||||||
import PreviewCardSmall from "../PreviewCardSmall.svelte";
|
import PreviewCardSmall from "../PreviewCardSmall.svelte";
|
||||||
|
import PreviewFile from "../previews/PreviewFile.svelte";
|
||||||
|
|
||||||
export let field;
|
export let field;
|
||||||
export let side;
|
export let side;
|
||||||
@@ -8,26 +8,23 @@
|
|||||||
export let colorClass;
|
export let colorClass;
|
||||||
</script>
|
</script>
|
||||||
|
|
||||||
{#if ["reference", "file"].includes(field.info.name)}
|
{#if ["reference"].includes(field.info.name)}
|
||||||
<div class="{colorClass} field-content">
|
<div class="{colorClass} field-content">
|
||||||
<div class="d-flex align-items-center text-center flex-wrap">
|
<div class="d-flex align-items-center text-center flex-wrap">
|
||||||
{#each edges[field.name] as edgeRecord}
|
{#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>
|
|
||||||
{:else}
|
|
||||||
<div class="ms-2">
|
<div class="ms-2">
|
||||||
<PreviewCardSmall record={edgeRecord} />
|
<PreviewCardSmall record={edgeRecord} />
|
||||||
</div>
|
</div>
|
||||||
{/if}
|
{/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>
|
||||||
{/each}
|
{/each}
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
@@ -43,7 +40,6 @@
|
|||||||
|
|
||||||
<!-- {/if} -->
|
<!-- {/if} -->
|
||||||
<style>
|
<style>
|
||||||
|
|
||||||
.field-content {
|
.field-content {
|
||||||
max-height: 200px;
|
max-height: 200px;
|
||||||
overflow-y: scroll;
|
overflow-y: scroll;
|
||||||
|
|||||||
Generated
+584
-3530
File diff suppressed because it is too large.
Load diff
+2
-7
@@ -11,20 +11,15 @@
|
|||||||
"@codemirror/lang-markdown": "^6.2.5",
|
"@codemirror/lang-markdown": "^6.2.5",
|
||||||
"@codemirror/state": "^6.4.1",
|
"@codemirror/state": "^6.4.1",
|
||||||
"@sveltejs/vite-plugin-svelte": "^3.1.1",
|
"@sveltejs/vite-plugin-svelte": "^3.1.1",
|
||||||
"axios": "^1.7.4",
|
|
||||||
"codemirror": "^6.0.1",
|
"codemirror": "^6.0.1",
|
||||||
"date-fns": "^3.6.0",
|
"date-fns": "^3.6.0",
|
||||||
"flatpickr": "^4.6.13",
|
"flatpickr": "^4.6.13",
|
||||||
"fuse.js": "^7.0.0",
|
"fuse.js": "^7.0.0",
|
||||||
"htmx.org": "^2.0.1",
|
|
||||||
"install": "^0.13.0",
|
|
||||||
"laravel-vite-plugin": "^1.0.5",
|
"laravel-vite-plugin": "^1.0.5",
|
||||||
"mustache": "^4.2.0",
|
"sass": "^1.77.8",
|
||||||
"npm": "^10.8.2",
|
|
||||||
"sortablejs": "^1.15.2",
|
"sortablejs": "^1.15.2",
|
||||||
"svelte": "^4.2.18",
|
"svelte": "^4.2.18",
|
||||||
"tinymce": "^6.8.4",
|
|
||||||
"trix": "^2.1.5",
|
"trix": "^2.1.5",
|
||||||
"vite": "5.4.6"
|
"vite": "5.2.6"
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -1,22 +0,0 @@
|
|||||||
.scope-login {
|
|
||||||
display: flex;
|
|
||||||
height: 100vh;
|
|
||||||
|
|
||||||
.bg-image {
|
|
||||||
width: 50%;
|
|
||||||
background: url("/vendor/lucent/public/art.jpg");
|
|
||||||
background-repeat: no-repeat;
|
|
||||||
background-size: cover;
|
|
||||||
background-repeat: no-repeat;
|
|
||||||
background-position: center center;
|
|
||||||
}
|
|
||||||
|
|
||||||
.login-form{
|
|
||||||
width: 50%;
|
|
||||||
height: 100vh;
|
|
||||||
|
|
||||||
display: flex;
|
|
||||||
align-items: center;
|
|
||||||
justify-content: center;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
@@ -1,51 +0,0 @@
|
|||||||
.autocomplete {
|
|
||||||
position: relative;
|
|
||||||
z-index: 1000;
|
|
||||||
overflow: visible;
|
|
||||||
.autocomplete-option {
|
|
||||||
cursor: pointer;
|
|
||||||
font-size: 14px;
|
|
||||||
padding: 3px 10px;
|
|
||||||
&:hover {
|
|
||||||
background: var(--p40);
|
|
||||||
border-radius: 12px;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
&:focus-within {
|
|
||||||
.autocomplete-results{
|
|
||||||
display: flex;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
}
|
|
||||||
.autocomplete-selected-value {
|
|
||||||
font-size: 13px;
|
|
||||||
margin-top: 10px;
|
|
||||||
border-radius: 12px;
|
|
||||||
background: var(--p30);
|
|
||||||
padding: 3px 10px;
|
|
||||||
display: inline-flex;
|
|
||||||
justify-content: center;
|
|
||||||
gap: 4px;
|
|
||||||
line-height: 22px;
|
|
||||||
&:hover {
|
|
||||||
background: var(--p40);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
.autocomplete-results {
|
|
||||||
display: none;
|
|
||||||
flex-direction: column;
|
|
||||||
padding: 10px;
|
|
||||||
overflow: visible;
|
|
||||||
position: absolute;
|
|
||||||
border-radius: 12px;
|
|
||||||
z-index: 20;
|
|
||||||
background: var(--p30);
|
|
||||||
//border: 1px solid var(--p40);
|
|
||||||
transition: 600ms;
|
|
||||||
flex-grow: 1;
|
|
||||||
top: 45px;
|
|
||||||
width: 100%;
|
|
||||||
}
|
|
||||||
@@ -1,23 +0,0 @@
|
|||||||
.avatar {
|
|
||||||
/* Center the content */
|
|
||||||
display: inline-block;
|
|
||||||
vertical-align: middle;
|
|
||||||
|
|
||||||
/* Used to position the content */
|
|
||||||
position: relative;
|
|
||||||
|
|
||||||
/* Colors */
|
|
||||||
|
|
||||||
color: #fff;
|
|
||||||
|
|
||||||
/* Rounded border */
|
|
||||||
border-radius: 50%;
|
|
||||||
}
|
|
||||||
|
|
||||||
.avatar__letters {
|
|
||||||
/* Center the content */
|
|
||||||
left: 50%;
|
|
||||||
position: absolute;
|
|
||||||
top: 50%;
|
|
||||||
transform: translate(-50%, -50%);
|
|
||||||
}
|
|
||||||
@@ -1,94 +0,0 @@
|
|||||||
.button {
|
|
||||||
border-radius: 12px;
|
|
||||||
background: var(--p20);
|
|
||||||
padding: 3px 10px;
|
|
||||||
cursor: pointer;
|
|
||||||
border: 0px solid var(--p30);
|
|
||||||
font-size: 14px;
|
|
||||||
min-height: 27px;
|
|
||||||
display: flex;
|
|
||||||
align-items: center;
|
|
||||||
gap: 4px;
|
|
||||||
color: var(--text);
|
|
||||||
|
|
||||||
&:focus {
|
|
||||||
}
|
|
||||||
|
|
||||||
&:hover {
|
|
||||||
background: var(--p30);
|
|
||||||
}
|
|
||||||
|
|
||||||
&:active {
|
|
||||||
background: var(--p50) !important;
|
|
||||||
box-shadow: none;
|
|
||||||
}
|
|
||||||
|
|
||||||
&.active {
|
|
||||||
background: var(--p30);
|
|
||||||
}
|
|
||||||
|
|
||||||
&.secondary {
|
|
||||||
background: var(--p30);
|
|
||||||
|
|
||||||
&:hover {
|
|
||||||
background: var(--p40);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
&.primary {
|
|
||||||
background: var(--p70);
|
|
||||||
color: var(--p10);
|
|
||||||
|
|
||||||
&:hover {
|
|
||||||
background: var(--p90);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
&[disabled] {
|
|
||||||
pointer-events: none;
|
|
||||||
opacity: .7;
|
|
||||||
color: var(--text);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
.upload-button {
|
|
||||||
padding: 0;
|
|
||||||
border: none;
|
|
||||||
|
|
||||||
label {
|
|
||||||
font-size: 14px;
|
|
||||||
line-height: 14px;
|
|
||||||
font-weight: normal;
|
|
||||||
background: var(--p80) !important;
|
|
||||||
color: var(--p10);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
.button-text {
|
|
||||||
border: none;
|
|
||||||
padding: 0;
|
|
||||||
background: transparent;
|
|
||||||
cursor: pointer;
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
.spinner-border {
|
|
||||||
width: 12px;
|
|
||||||
height: 12px;
|
|
||||||
border: 2px solid var(--p10);
|
|
||||||
border-bottom-color: var(--p30);
|
|
||||||
border-radius: 50%;
|
|
||||||
display: inline-block;
|
|
||||||
box-sizing: border-box;
|
|
||||||
animation: rotation 1s linear infinite;
|
|
||||||
}
|
|
||||||
|
|
||||||
@keyframes rotation {
|
|
||||||
0% {
|
|
||||||
transform: rotate(0deg);
|
|
||||||
}
|
|
||||||
100% {
|
|
||||||
transform: rotate(360deg);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
@@ -1,104 +0,0 @@
|
|||||||
|
|
||||||
@supports (-webkit-appearance: none) or (-moz-appearance: none) {
|
|
||||||
.checkbox-wrapper input[type=checkbox] {
|
|
||||||
--active-inner: var(--p10);
|
|
||||||
--focus: 2px var(--p30);
|
|
||||||
--border-hover: var(--p30);
|
|
||||||
--disabled: #F6F8FF;
|
|
||||||
--disabled-inner: #E1E6F9;
|
|
||||||
-webkit-appearance: none;
|
|
||||||
-moz-appearance: none;
|
|
||||||
height: 21px;
|
|
||||||
outline: none;
|
|
||||||
display: inline-block;
|
|
||||||
vertical-align: top;
|
|
||||||
position: relative;
|
|
||||||
margin: 0;
|
|
||||||
cursor: pointer;
|
|
||||||
border: 1px solid var(--bc, var(--p30));
|
|
||||||
background: var(--b, var(--p10));
|
|
||||||
transition: background 0.3s, border-color 0.3s, box-shadow 0.2s;
|
|
||||||
}
|
|
||||||
.checkbox-wrapper input[type=checkbox]:after {
|
|
||||||
content: "";
|
|
||||||
display: block;
|
|
||||||
left: 0;
|
|
||||||
top: 0;
|
|
||||||
position: absolute;
|
|
||||||
transition: transform var(--d-t, 0.3s) var(--d-t-e, ease), opacity var(--d-o, 0.2s);
|
|
||||||
}
|
|
||||||
.checkbox-wrapper input[type=checkbox]:checked {
|
|
||||||
--b: var(--p40);
|
|
||||||
--bc: var(--p40);
|
|
||||||
--d-o: .3s;
|
|
||||||
--d-t: .6s;
|
|
||||||
--d-t-e: cubic-bezier(.2, .85, .32, 1.2);
|
|
||||||
}
|
|
||||||
.checkbox-wrapper input[type=checkbox]:disabled {
|
|
||||||
--b: var(--disabled);
|
|
||||||
cursor: not-allowed;
|
|
||||||
opacity: 0.9;
|
|
||||||
}
|
|
||||||
.checkbox-wrapper input[type=checkbox]:disabled:checked {
|
|
||||||
--b: var(--disabled-inner);
|
|
||||||
--bc: var(--p40);
|
|
||||||
}
|
|
||||||
.checkbox-wrapper input[type=checkbox]:disabled + label {
|
|
||||||
cursor: not-allowed;
|
|
||||||
}
|
|
||||||
.checkbox-wrapper input[type=checkbox]:hover:not(:checked):not(:disabled) {
|
|
||||||
--bc: var(--border-hover);
|
|
||||||
}
|
|
||||||
.checkbox-wrapper input[type=checkbox]:focus {
|
|
||||||
box-shadow: 0 0 0 var(--focus);
|
|
||||||
}
|
|
||||||
.checkbox-wrapper input[type=checkbox]:not(.switch) {
|
|
||||||
width: 21px;
|
|
||||||
}
|
|
||||||
.checkbox-wrapper input[type=checkbox]:not(.switch):after {
|
|
||||||
opacity: var(--o, 0);
|
|
||||||
}
|
|
||||||
.checkbox-wrapper input[type=checkbox]:not(.switch):checked {
|
|
||||||
--o: 1;
|
|
||||||
}
|
|
||||||
.checkbox-wrapper input[type=checkbox] + label {
|
|
||||||
display: inline-block;
|
|
||||||
vertical-align: middle;
|
|
||||||
cursor: pointer;
|
|
||||||
margin-left: 4px;
|
|
||||||
}
|
|
||||||
|
|
||||||
.checkbox-wrapper input[type=checkbox]:not(.switch) {
|
|
||||||
border-radius: 7px;
|
|
||||||
}
|
|
||||||
.checkbox-wrapper input[type=checkbox]:not(.switch):after {
|
|
||||||
width: 5px;
|
|
||||||
height: 9px;
|
|
||||||
border: 2px solid var(--active-inner);
|
|
||||||
border-top: 0;
|
|
||||||
border-left: 0;
|
|
||||||
left: 7px;
|
|
||||||
top: 4px;
|
|
||||||
transform: rotate(var(--r, 20deg));
|
|
||||||
}
|
|
||||||
.checkbox-wrapper input[type=checkbox]:not(.switch):checked {
|
|
||||||
--r: 43deg;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
.checkbox-wrapper * {
|
|
||||||
box-sizing: inherit;
|
|
||||||
}
|
|
||||||
.checkbox-wrapper *:before,
|
|
||||||
.checkbox-wrapper *:after {
|
|
||||||
box-sizing: inherit;
|
|
||||||
}
|
|
||||||
|
|
||||||
.checkbox-wrapper input[type=checkbox]:indeterminate {
|
|
||||||
--b: var(--p40);
|
|
||||||
--bc: var(--p40);
|
|
||||||
--d-o: .3s;
|
|
||||||
--d-t: .6s;
|
|
||||||
--d-t-e: cubic-bezier(.2, .85, .32, 1.2);
|
|
||||||
}
|
|
||||||
|
|
||||||
@@ -1,24 +0,0 @@
|
|||||||
.is-editable-false{
|
|
||||||
.cm-content{
|
|
||||||
background-color: var(--p10);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
.cm-focused{
|
|
||||||
|
|
||||||
.cm-content{
|
|
||||||
background-color: var(--p10);
|
|
||||||
color: var(--p100);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
.cm-content{
|
|
||||||
background-color: var(--p20);
|
|
||||||
|
|
||||||
}
|
|
||||||
.ͼ4 .cm-line ::selection, .ͼ4 .cm-line::selection{
|
|
||||||
background: var(--p40) !important;
|
|
||||||
}
|
|
||||||
|
|
||||||
.cm-activeLine{
|
|
||||||
background-color: var(--p20)!important;
|
|
||||||
}
|
|
||||||
@@ -1,43 +0,0 @@
|
|||||||
|
|
||||||
.flatpickr-wrapper {
|
|
||||||
display: block !important;
|
|
||||||
}
|
|
||||||
|
|
||||||
.editor-field {
|
|
||||||
.flatpickr-calendar {
|
|
||||||
border-radius: 12px !important;
|
|
||||||
}
|
|
||||||
|
|
||||||
.flatpickr-months .flatpickr-month {
|
|
||||||
background: var(--p30);
|
|
||||||
color: var(--text);
|
|
||||||
font-size: 12px;
|
|
||||||
}
|
|
||||||
|
|
||||||
.flatpickr-current-month .flatpickr-monthDropdown-months {
|
|
||||||
background: var(--p30);
|
|
||||||
}
|
|
||||||
|
|
||||||
.flatpickr-weekdays{
|
|
||||||
background: var(--p30);
|
|
||||||
color: var(--text);
|
|
||||||
|
|
||||||
}
|
|
||||||
|
|
||||||
.flatpickr-weekdaycontainer .flatpickr-weekday{
|
|
||||||
background: var(--p30);
|
|
||||||
color: var(--text);
|
|
||||||
}
|
|
||||||
|
|
||||||
.flatpickr-days{
|
|
||||||
background: var(--p10);
|
|
||||||
color: var(--text);
|
|
||||||
}
|
|
||||||
|
|
||||||
.flatpickr-time{
|
|
||||||
background: var(--p10);
|
|
||||||
color: var(--text);
|
|
||||||
}
|
|
||||||
|
|
||||||
}
|
|
||||||
|
|
||||||
@@ -1,54 +0,0 @@
|
|||||||
//
|
|
||||||
//:modal {
|
|
||||||
// background-color: beige;
|
|
||||||
// border: 2px solid burlywood;
|
|
||||||
// border-radius: 5px;
|
|
||||||
//}
|
|
||||||
|
|
||||||
html {
|
|
||||||
//scrollbar-gutter: stable;
|
|
||||||
}
|
|
||||||
|
|
||||||
body:has(dialog[open]) {
|
|
||||||
overflow: hidden;
|
|
||||||
}
|
|
||||||
|
|
||||||
dialog {
|
|
||||||
margin: 2vh auto;
|
|
||||||
background-color: var(--p10);
|
|
||||||
padding: 34px;
|
|
||||||
border: none;
|
|
||||||
border-radius: 12px;
|
|
||||||
overflow: auto;
|
|
||||||
max-height: 96vh;
|
|
||||||
box-shadow: none!important;
|
|
||||||
//position: relative;
|
|
||||||
|
|
||||||
.close {
|
|
||||||
position: absolute;
|
|
||||||
top: 10px;
|
|
||||||
right: 0px;
|
|
||||||
}
|
|
||||||
|
|
||||||
.dialog-body {
|
|
||||||
width: fit-content;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
dialog::backdrop {
|
|
||||||
|
|
||||||
backdrop-filter: blur(3px);
|
|
||||||
}
|
|
||||||
|
|
||||||
.dialog-header {
|
|
||||||
margin-bottom: 20px;
|
|
||||||
display: flex;
|
|
||||||
align-items: center;
|
|
||||||
gap: 8px;
|
|
||||||
position: sticky;
|
|
||||||
top: -34px;
|
|
||||||
z-index: 999;
|
|
||||||
background-color: var(--p10);
|
|
||||||
padding: 10px 0;
|
|
||||||
}
|
|
||||||
@@ -1,73 +0,0 @@
|
|||||||
.dropdown {
|
|
||||||
position: relative;
|
|
||||||
overflow: visible;
|
|
||||||
}
|
|
||||||
|
|
||||||
.dropdown-button > div {
|
|
||||||
display: flex;
|
|
||||||
align-items: center;
|
|
||||||
gap: 3px;
|
|
||||||
}
|
|
||||||
|
|
||||||
.dropdown-menu {
|
|
||||||
display: flex;
|
|
||||||
flex-direction: column;
|
|
||||||
padding: 10px;
|
|
||||||
overflow: visible;
|
|
||||||
position: absolute;
|
|
||||||
border-radius: 12px;
|
|
||||||
z-index: 22;
|
|
||||||
background: var(--p20);
|
|
||||||
transition: 600ms;
|
|
||||||
flex-grow: 1;
|
|
||||||
top: 35px;
|
|
||||||
min-width: max-content;
|
|
||||||
border: 1px solid var(--p30);
|
|
||||||
|
|
||||||
|
|
||||||
&.orientation-right {
|
|
||||||
right: 0;
|
|
||||||
}
|
|
||||||
|
|
||||||
&.orientation-left {
|
|
||||||
left: 0;
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
}
|
|
||||||
|
|
||||||
.dropdown-header, .dropdown-item {
|
|
||||||
display: flex;
|
|
||||||
align-items: center;
|
|
||||||
gap: 3px;
|
|
||||||
text-wrap: nowrap;
|
|
||||||
}
|
|
||||||
|
|
||||||
.dropdown-header {
|
|
||||||
padding: 10px;
|
|
||||||
}
|
|
||||||
|
|
||||||
.dropdown-item {
|
|
||||||
font-size: 14px;
|
|
||||||
padding: 3px 10px;
|
|
||||||
|
|
||||||
&:hover {
|
|
||||||
background: var(--p30);
|
|
||||||
border-radius: 12px;
|
|
||||||
|
|
||||||
button {
|
|
||||||
background: var(--p30);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
.button-icon {
|
|
||||||
flex-shrink: 0;
|
|
||||||
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
.editor-field{
|
|
||||||
.dropdown-menu {
|
|
||||||
background: var(--p30);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
@@ -1,95 +0,0 @@
|
|||||||
|
|
||||||
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;
|
|
||||||
&: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;
|
|
||||||
&:focus{
|
|
||||||
background: var(--p10);
|
|
||||||
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
.htmx-indicator {
|
|
||||||
display: none;
|
|
||||||
}
|
|
||||||
|
|
||||||
.htmx-request .htmx-indicator {
|
|
||||||
display: inline;
|
|
||||||
}
|
|
||||||
|
|
||||||
.htmx-request.htmx-indicator {
|
|
||||||
display: inline;
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
.bt {
|
|
||||||
appearance: none;
|
|
||||||
background-color: #000;
|
|
||||||
background-image: none;
|
|
||||||
border: 1px solid #000;
|
|
||||||
border-radius: 4px;
|
|
||||||
box-shadow: #fff 4px 4px 0 0, #000 4px 4px 0 1px;
|
|
||||||
box-sizing: border-box;
|
|
||||||
color: #fff;
|
|
||||||
cursor: pointer;
|
|
||||||
display: inline-block;
|
|
||||||
font-family: ITCAvantGardeStd-Bk, Arial, sans-serif;
|
|
||||||
font-size: 16px;
|
|
||||||
font-weight: 400;
|
|
||||||
line-height: 20px;
|
|
||||||
margin: 0 5px 10px 0;
|
|
||||||
overflow: visible;
|
|
||||||
padding: 8px 40px;
|
|
||||||
text-align: center;
|
|
||||||
text-transform: none;
|
|
||||||
touch-action: manipulation;
|
|
||||||
user-select: none;
|
|
||||||
-webkit-user-select: none;
|
|
||||||
vertical-align: middle;
|
|
||||||
white-space: nowrap;
|
|
||||||
}
|
|
||||||
|
|
||||||
.bt:focus {
|
|
||||||
text-decoration: none;
|
|
||||||
}
|
|
||||||
|
|
||||||
.bt:hover {
|
|
||||||
text-decoration: none;
|
|
||||||
}
|
|
||||||
|
|
||||||
.bt:active {
|
|
||||||
box-shadow: rgba(0, 0, 0, .125) 0 3px 5px inset;
|
|
||||||
outline: 0;
|
|
||||||
}
|
|
||||||
|
|
||||||
.bt:not([disabled]):active {
|
|
||||||
box-shadow: #fff 2px 2px 0 0, #000 2px 2px 0 1px;
|
|
||||||
transform: translate(2px, 2px);
|
|
||||||
}
|
|
||||||
@@ -1,52 +0,0 @@
|
|||||||
.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;
|
|
||||||
}
|
|
||||||
@@ -1,19 +0,0 @@
|
|||||||
.sidebar-content{
|
|
||||||
min-width: 300px;
|
|
||||||
max-width: 400px;
|
|
||||||
position: relative;
|
|
||||||
}
|
|
||||||
|
|
||||||
.main-content {
|
|
||||||
position: relative;
|
|
||||||
width: fit-content;
|
|
||||||
min-width: 900px;
|
|
||||||
}
|
|
||||||
|
|
||||||
.main-wrapper {
|
|
||||||
display: flex;
|
|
||||||
justify-content: center;
|
|
||||||
gap: 40px;
|
|
||||||
padding: 20px;
|
|
||||||
position: relative;
|
|
||||||
}
|
|
||||||
@@ -1,19 +0,0 @@
|
|||||||
.member-list{
|
|
||||||
display: flex;
|
|
||||||
flex-direction: column;
|
|
||||||
gap: 5px;
|
|
||||||
}
|
|
||||||
.member-item{
|
|
||||||
background: var(--p30);
|
|
||||||
border-radius: 12px;
|
|
||||||
padding: 12px;
|
|
||||||
display: flex;
|
|
||||||
justify-content: space-between;
|
|
||||||
align-items: center;
|
|
||||||
|
|
||||||
.member-name{
|
|
||||||
display: flex;
|
|
||||||
align-items: center;
|
|
||||||
gap: 10px;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
Loaded 100 of 247 files, more files were not shown because too many files have changed in this diff.
Show more
Reference in new issue
Block a user