diff --git a/.github/workflows/main-docker.yml b/.github/workflows/main-docker.yml
index a9b7521671..4291c894ad 100644
--- a/.github/workflows/main-docker.yml
+++ b/.github/workflows/main-docker.yml
@@ -129,6 +129,8 @@ jobs:
type=ref,event=branch
type=ref,event=tag
type=sha
+ flavor: |
+ latest=false
- name: Set up QEMU
uses: docker/setup-qemu-action@v3
@@ -213,7 +215,9 @@ jobs:
images: |
${{ env.GHCR_REGISTRY }}/${{ env.IMAGE_NAME }}
${{ env.DOCKERHUB_REGISTRY }}/${{ env.IMAGE_NAME }}
-
+ flavor: |
+ latest=false
+
- name: Login to GHCR
uses: docker/login-action@v2
with:
@@ -246,6 +250,7 @@ jobs:
# If the ref is a tag, also tag the image as stable as this is part of a 'release'
# and only go in the `if` if there is NOT a `-` in the tag's name, due to tagging of `-alpha`, `-beta`, etc...
if [[ "${GITHUB_REF}" == refs/tags/* && ! "${REF_NAME}" =~ - ]]; then
+ # First create stable tags
docker buildx imagetools create $(jq -cr '.tags | map("-t " + .) | join(" ")' <<< "$DOCKER_METADATA_OUTPUT_JSON") \
-t ${{ env.GHCR_REGISTRY }}/${{ env.IMAGE_NAME }}:stable \
$(printf '${{ env.GHCR_REGISTRY }}/${{ env.IMAGE_NAME }}@sha256:%s ' *)
@@ -253,6 +258,19 @@ jobs:
docker buildx imagetools create $(jq -cr '.tags | map("-t " + .) | join(" ")' <<< "$DOCKER_METADATA_OUTPUT_JSON") \
-t ${{ env.DOCKERHUB_REGISTRY }}/${{ env.IMAGE_NAME }}:stable \
$(printf '${{ env.DOCKERHUB_REGISTRY }}/${{ env.IMAGE_NAME }}@sha256:%s ' *)
+
+ # Small delay to ensure stable tag is fully propagated
+ sleep 5
+
+ # Now update latest tags
+ docker buildx imagetools create \
+ -t ${{ env.GHCR_REGISTRY }}/${{ env.IMAGE_NAME }}:latest \
+ ${{ env.GHCR_REGISTRY }}/${{ env.IMAGE_NAME }}:stable
+
+ docker buildx imagetools create \
+ -t ${{ env.DOCKERHUB_REGISTRY }}/${{ env.IMAGE_NAME }}:latest \
+ ${{ env.DOCKERHUB_REGISTRY }}/${{ env.IMAGE_NAME }}:stable
+
fi
- name: Inspect image
diff --git a/.github/workflows/main.yml b/.github/workflows/main.yml
index 2628a4ebba..659040904d 100644
--- a/.github/workflows/main.yml
+++ b/.github/workflows/main.yml
@@ -43,7 +43,7 @@ jobs:
- name: Install dependencies
run: npm ci
- name: Update build info
- run: npm run update-build-info
+ run: npm run update-build-info
- name: Run electron-forge
run: npm run make-electron -- --arch=${{ matrix.arch }}
- name: Prepare artifacts (Unix)
diff --git a/.github/workflows/nightly.yml b/.github/workflows/nightly.yml
index 2e319ca408..9190ac4147 100644
--- a/.github/workflows/nightly.yml
+++ b/.github/workflows/nightly.yml
@@ -41,6 +41,8 @@ jobs:
run: npm ci
- name: Update build info
run: npm run update-build-info
+ - name: Update nightly version
+ run: npm run ci-update-nightly-version
- name: Run electron-forge
run: npm run make-electron -- --arch=${{ matrix.arch }}
- name: Prepare artifacts (Unix)
@@ -103,6 +105,7 @@ jobs:
- name: Run Linux server build (x86_64)
run: |
npm run update-build-info
+ npm run ci-update-nightly-version
./bin/build-server.sh
- name: Prepare artifacts
if: runner.os != 'windows'
diff --git a/Dockerfile b/Dockerfile
index 5173b60f34..fa3a738809 100644
--- a/Dockerfile
+++ b/Dockerfile
@@ -1,7 +1,7 @@
-# !!! Don't try to build this Dockerfile directly, run it through bin/build-docker.sh script !!!
-FROM node:20.15.1-bullseye-slim
+# Build stage
+FROM node:20.15.1-bullseye-slim AS builder
-# Configure system dependencies
+# Configure build dependencies in a single layer
RUN apt-get update && apt-get install -y --no-install-recommends \
autoconf \
automake \
@@ -12,49 +12,52 @@ RUN apt-get update && apt-get install -y --no-install-recommends \
nasm \
libpng-dev \
python3 \
- gosu \
&& rm -rf /var/lib/apt/lists/*
-# Create app directory
WORKDIR /usr/src/app
-# Bundle app source
+# Copy only necessary files for build
COPY . .
COPY server-package.json package.json
-# Copy TypeScript build artifacts into the original directory structure.
-# Copy the healthcheck
+# Build and cleanup in a single layer
RUN cp -R build/src/* src/. && \
cp build/docker_healthcheck.js . && \
rm -r build && \
- rm docker_healthcheck.ts
-
-# Install app dependencies
-RUN apt-get purge -y --auto-remove \
- autoconf \
- automake \
- g++ \
- gcc \
- libtool \
- make \
- nasm \
- libpng-dev \
- python3 \
- && rm -rf /var/lib/apt/lists/*
-RUN npm install && \
+ rm docker_healthcheck.ts && \
+ npm install && \
npm run webpack && \
- npm prune --omit=dev
-RUN cp src/public/app/share.js src/public/app-dist/. && \
+ npm prune --omit=dev && \
+ npm cache clean --force && \
+ cp src/public/app/share.js src/public/app-dist/. && \
cp -r src/public/app/doc_notes src/public/app-dist/. && \
- rm -rf src/public/app && rm src/services/asset_path.ts
+ rm -rf src/public/app && \
+ rm src/services/asset_path.ts
+
+# Runtime stage
+FROM node:20.15.1-bullseye-slim
-# Some setup tools need to be kept
+# Install only runtime dependencies
RUN apt-get update && apt-get install -y --no-install-recommends \
gosu \
- && rm -rf /var/lib/apt/lists/*
+ && rm -rf /var/lib/apt/lists/* && \
+ rm -rf /var/cache/apt/*
+
+WORKDIR /usr/src/app
-# Start the application
+# Copy only necessary files from builder
+COPY --from=builder /usr/src/app/node_modules ./node_modules
+COPY --from=builder /usr/src/app/src ./src
+COPY --from=builder /usr/src/app/db ./db
+COPY --from=builder /usr/src/app/docker_healthcheck.js .
+COPY --from=builder /usr/src/app/start-docker.sh .
+COPY --from=builder /usr/src/app/package.json .
+COPY --from=builder /usr/src/app/config-sample.ini .
+COPY --from=builder /usr/src/app/images ./images
+COPY --from=builder /usr/src/app/translations ./translations
+COPY --from=builder /usr/src/app/libraries ./libraries
+
+# Configure container
EXPOSE 8080
CMD [ "./start-docker.sh" ]
-
HEALTHCHECK --start-period=10s CMD exec gosu node node docker_healthcheck.js
\ No newline at end of file
diff --git a/Dockerfile.alpine b/Dockerfile.alpine
index 7ace8e964e..e4b7f4a7d8 100644
--- a/Dockerfile.alpine
+++ b/Dockerfile.alpine
@@ -1,7 +1,7 @@
-# !!! Don't try to build this Dockerfile directly, run it through bin/build-docker.sh script !!!
-FROM node:20.15.1-alpine
+# Build stage
+FROM node:20.15.1-alpine AS builder
-# Configure system dependencies
+# Configure build dependencies
RUN apk add --no-cache --virtual .build-dependencies \
autoconf \
automake \
@@ -11,43 +11,52 @@ RUN apk add --no-cache --virtual .build-dependencies \
make \
nasm \
libpng-dev \
- python3
+ python3
-# Create app directory
WORKDIR /usr/src/app
-# Bundle app source
+# Copy only necessary files for build
COPY . .
-
COPY server-package.json package.json
-# Copy TypeScript build artifacts into the original directory structure.
-# Copy the healthcheck
+# Build and cleanup in a single layer
RUN cp -R build/src/* src/. && \
cp build/docker_healthcheck.js . && \
rm -r build && \
- rm docker_healthcheck.ts
-
-# Install app dependencies
-RUN set -x && \
+ rm docker_healthcheck.ts && \
npm install && \
- apk del .build-dependencies && \
npm run webpack && \
npm prune --omit=dev && \
+ npm cache clean --force && \
cp src/public/app/share.js src/public/app-dist/. && \
cp -r src/public/app/doc_notes src/public/app-dist/. && \
rm -rf src/public/app && \
rm src/services/asset_path.ts
+# Runtime stage
+FROM node:20.15.1-alpine
-# Some setup tools need to be kept
+# Install runtime dependencies
RUN apk add --no-cache su-exec shadow
-# Add application user and setup proper volume permissions
+WORKDIR /usr/src/app
+
+# Copy only necessary files from builder
+COPY --from=builder /usr/src/app/node_modules ./node_modules
+COPY --from=builder /usr/src/app/src ./src
+COPY --from=builder /usr/src/app/db ./db
+COPY --from=builder /usr/src/app/docker_healthcheck.js .
+COPY --from=builder /usr/src/app/start-docker.sh .
+COPY --from=builder /usr/src/app/package.json .
+COPY --from=builder /usr/src/app/config-sample.ini .
+COPY --from=builder /usr/src/app/images ./images
+COPY --from=builder /usr/src/app/translations ./translations
+COPY --from=builder /usr/src/app/libraries ./libraries
+
+# Add application user
RUN adduser -s /bin/false node; exit 0
-# Start the application
+# Configure container
EXPOSE 8080
CMD [ "./start-docker.sh" ]
-
-HEALTHCHECK --start-period=10s CMD exec su-exec node node docker_healthcheck.js
+HEALTHCHECK --start-period=10s CMD exec su-exec node node docker_healthcheck.js
\ No newline at end of file
diff --git a/README.md b/README.md
index dc0e1f6621..f3eba273ce 100644
--- a/README.md
+++ b/README.md
@@ -18,6 +18,8 @@ See [screenshots](https://triliumnext.github.io/Docs/Wiki/screenshot-tour) for q
There are no special migration steps to migrate from a zadam/Trilium instance to a TriliumNext/Notes instance. Just upgrade your Trilium instance to the latest version and [install TriliumNext/Notes as usual](#-installation)
+Versions up to and including [v0.90.4](https://github.com/TriliumNext/Notes/releases/tag/v0.90.4) are compatible with the latest zadam/trilium version of [v0.63.7](https://github.com/zadam/trilium/releases/tag/v0.63.7). Any later versions of TriliumNext have their sync versions incremented.
+
## 💬 Discuss with us
Feel free to join our official conversations. We would love to hear what features, suggestions, or issues you may have!
@@ -65,6 +67,16 @@ To use TriliumNext on your desktop machine (Linux, MacOS, and Windows) you have
* Currently only the latest versions of Chrome & Firefox are supported (and tested).
* (Coming Soon) TriliumNext will also be provided as a Flatpak
+#### MacOS
+Currently when running TriliumNext/Notes on MacOS, you may get the following error:
+> Apple could not verify "TriliumNext Notes" is free of malware and may harm your Mac or compromise your privacy.
+
+You will need to run the command on your shell to resolve the error (documented [here](https://github.com/TriliumNext/Notes/issues/329#issuecomment-2287164137)):
+
+```bash
+xattr -c "/path/to/Trilium Next.app"
+```
+
### Mobile
To use TriliumNext on a mobile device:
diff --git a/bin/copy-dist.ts b/bin/copy-dist.ts
index 1927221fcb..554061c5e3 100644
--- a/bin/copy-dist.ts
+++ b/bin/copy-dist.ts
@@ -47,6 +47,15 @@ const copy = async () => {
await fs.copy(dir, path.join(DEST_DIR_SRC, path.basename(dir)));
}
+ /**
+ * Directories to be copied relative to the project root into /src/public/app-dist.
+ */
+ const publicDirsToCopy = [ "./src/public/app/doc_notes" ];
+ const PUBLIC_DIR = path.join(DEST_DIR, "src", "public", "app-dist");
+ for (const dir of publicDirsToCopy) {
+ await fs.copy(dir, path.join(PUBLIC_DIR, path.basename(dir)));
+ }
+
const nodeModulesFile = [
"node_modules/react/umd/react.production.min.js",
"node_modules/react/umd/react.development.js",
@@ -55,6 +64,7 @@ const copy = async () => {
"node_modules/katex/dist/katex.min.js",
"node_modules/katex/dist/contrib/mhchem.min.js",
"node_modules/katex/dist/contrib/auto-render.min.js",
+ "node_modules/@highlightjs/cdn-assets/highlight.min.js"
];
for (const file of nodeModulesFile) {
@@ -89,7 +99,9 @@ const copy = async () => {
"node_modules/codemirror/addon/",
"node_modules/codemirror/mode/",
"node_modules/codemirror/keymap/",
- "node_modules/mind-elixir/dist/"
+ "node_modules/mind-elixir/dist/",
+ "node_modules/@highlightjs/cdn-assets/languages",
+ "node_modules/@highlightjs/cdn-assets/styles"
];
for (const folder of nodeModulesFolder) {
diff --git a/bin/update-nightly-version.ts b/bin/update-nightly-version.ts
new file mode 100644
index 0000000000..aad8da3cf0
--- /dev/null
+++ b/bin/update-nightly-version.ts
@@ -0,0 +1,50 @@
+/**
+ * @module
+ *
+ * The nightly version works uses the version described in `package.json`, just like any release.
+ * The problem with this approach is that production builds have a very aggressive cache, and
+ * usually running the nightly with this cached version of the application will mean that the
+ * user might run into module not found errors or styling errors caused by an old cache.
+ *
+ * This script is supposed to be run in the CI, which will update locally the version field of
+ * `package.json` to contain the date. For example, `0.90.9-beta` will become `0.90.9-test-YYMMDD-HHMMSS`.
+ *
+ */
+
+import { fileURLToPath } from "url";
+import { dirname, join } from "path";
+import fs from "fs";
+
+function processVersion(version) {
+ // Remove the beta suffix if any.
+ version = version.replace("-beta", "");
+
+ // Add the nightly suffix, plus the date.
+ const referenceDate = new Date()
+ .toISOString()
+ .substring(2, 19)
+ .replace(/[-:]*/g, "")
+ .replace("T", "-");
+ version = `${version}-test-${referenceDate}`;
+
+ return version;
+}
+
+function main() {
+ const scriptDir = dirname(fileURLToPath(import.meta.url));
+ const packageJsonPath = join(scriptDir, "..", "package.json");
+
+ // Read the version from package.json and process it.
+ const packageJson = JSON.parse(fs.readFileSync(packageJsonPath, "utf-8"));
+ const currentVersion = packageJson.version;
+ const adjustedVersion = processVersion(currentVersion);
+ console.log("Current version is", currentVersion);
+ console.log("Adjusted version is", adjustedVersion);
+
+ // Write the adjusted version back in.
+ packageJson.version = adjustedVersion;
+ const formattedJson = JSON.stringify(packageJson, null, 4);
+ fs.writeFileSync(packageJsonPath, formattedJson);
+}
+
+main();
diff --git a/db/demo.zip b/db/demo.zip
index 3261b37780..40fa4aa7ca 100644
Binary files a/db/demo.zip and b/db/demo.zip differ
diff --git a/forge.config.cjs b/forge.config.cjs
index 8d2db5da56..3d29c84f03 100644
--- a/forge.config.cjs
+++ b/forge.config.cjs
@@ -15,7 +15,8 @@ module.exports = {
...getExtraResourcesForPlatform(),
// Moved to resources (TriliumNext Notes.app/Contents/Resources on macOS)
- "translations/"
+ "translations/",
+ "node_modules/@highlightjs/cdn-assets/styles"
],
afterComplete: [(buildPath, _electronVersion, platform, _arch, callback) => {
const extraResources = getExtraResourcesForPlatform();
diff --git a/libraries/ckeditor/ckeditor-content.css b/libraries/ckeditor/ckeditor-content.css
index 972c0775af..5340639b37 100644
--- a/libraries/ckeditor/ckeditor-content.css
+++ b/libraries/ckeditor/ckeditor-content.css
@@ -526,16 +526,19 @@
/* @ckeditor/ckeditor5-code-block/theme/codeblock.css */
.ck-content pre {
padding: 1em;
- color: hsl(0, 0%, 20.8%);
- background: hsla(0, 0%, 78%, 0.3);
- border: 1px solid hsl(0, 0%, 77%);
- border-radius: 2px;
text-align: left;
direction: ltr;
tab-size: 4;
white-space: pre-wrap;
font-style: normal;
min-width: 200px;
+ border: 0px;
+ border-radius: 6px;
+ box-shadow: 1px 1px 6px rgba(0, 0, 0, 0.2);
+}
+.ck-content pre:not(.hljs) {
+ color: hsl(0, 0%, 20.8%);
+ background: hsla(0, 0%, 78%, 0.3);
}
/* @ckeditor/ckeditor5-code-block/theme/codeblock.css */
.ck-content pre code {
diff --git a/libraries/ckeditor/ckeditor.d.ts b/libraries/ckeditor/ckeditor.d.ts
new file mode 100644
index 0000000000..eb57d994f7
--- /dev/null
+++ b/libraries/ckeditor/ckeditor.d.ts
@@ -0,0 +1,49 @@
+/**
+ * @license Copyright (c) 2003-2024, CKSource Holding sp. z o.o. All rights reserved.
+ * For licensing, see LICENSE.md or https://ckeditor.com/legal/ckeditor-oss-license
+ */
+import { DecoupledEditor as DecoupledEditorBase } from '@ckeditor/ckeditor5-editor-decoupled';
+import { Essentials } from '@ckeditor/ckeditor5-essentials';
+import { Alignment } from '@ckeditor/ckeditor5-alignment';
+import { FontSize, FontFamily, FontColor, FontBackgroundColor } from '@ckeditor/ckeditor5-font';
+import { CKFinderUploadAdapter } from '@ckeditor/ckeditor5-adapter-ckfinder';
+import { Autoformat } from '@ckeditor/ckeditor5-autoformat';
+import { Bold, Italic, Strikethrough, Underline } from '@ckeditor/ckeditor5-basic-styles';
+import { BlockQuote } from '@ckeditor/ckeditor5-block-quote';
+import { CKBox } from '@ckeditor/ckeditor5-ckbox';
+import { CKFinder } from '@ckeditor/ckeditor5-ckfinder';
+import { EasyImage } from '@ckeditor/ckeditor5-easy-image';
+import { Heading } from '@ckeditor/ckeditor5-heading';
+import { Image, ImageCaption, ImageResize, ImageStyle, ImageToolbar, ImageUpload, PictureEditing } from '@ckeditor/ckeditor5-image';
+import { Indent, IndentBlock } from '@ckeditor/ckeditor5-indent';
+import { Link } from '@ckeditor/ckeditor5-link';
+import { List, ListProperties } from '@ckeditor/ckeditor5-list';
+import { MediaEmbed } from '@ckeditor/ckeditor5-media-embed';
+import { Paragraph } from '@ckeditor/ckeditor5-paragraph';
+import { PasteFromOffice } from '@ckeditor/ckeditor5-paste-from-office';
+import { Table, TableToolbar } from '@ckeditor/ckeditor5-table';
+import { TextTransformation } from '@ckeditor/ckeditor5-typing';
+import { CloudServices } from '@ckeditor/ckeditor5-cloud-services';
+export default class DecoupledEditor extends DecoupledEditorBase {
+ static builtinPlugins: (typeof TextTransformation | typeof Essentials | typeof Alignment | typeof FontBackgroundColor | typeof FontColor | typeof FontFamily | typeof FontSize | typeof CKFinderUploadAdapter | typeof Paragraph | typeof Heading | typeof Autoformat | typeof Bold | typeof Italic | typeof Strikethrough | typeof Underline | typeof BlockQuote | typeof Image | typeof ImageCaption | typeof ImageResize | typeof ImageStyle | typeof ImageToolbar | typeof ImageUpload | typeof CloudServices | typeof CKBox | typeof CKFinder | typeof EasyImage | typeof List | typeof ListProperties | typeof Indent | typeof IndentBlock | typeof Link | typeof MediaEmbed | typeof PasteFromOffice | typeof Table | typeof TableToolbar | typeof PictureEditing)[];
+ static defaultConfig: {
+ toolbar: {
+ items: string[];
+ };
+ image: {
+ resizeUnit: "px";
+ toolbar: string[];
+ };
+ table: {
+ contentToolbar: string[];
+ };
+ list: {
+ properties: {
+ styles: boolean;
+ startIndex: boolean;
+ reversed: boolean;
+ };
+ };
+ language: string;
+ };
+}
diff --git a/libraries/ckeditor/ckeditor.js b/libraries/ckeditor/ckeditor.js
index e1c34aa45d..62c701b731 100644
--- a/libraries/ckeditor/ckeditor.js
+++ b/libraries/ckeditor/ckeditor.js
@@ -3,5 +3,5 @@
* @license Copyright (c) 2003-2024, CKSource Holding sp. z o.o. All rights reserved.
* For licensing, see LICENSE.md.
*/
-function(t,e){"object"==typeof exports&&"object"==typeof module?module.exports=e():"function"==typeof define&&define.amd?define([],e):"object"==typeof exports?exports.BalloonEditor=e():t.BalloonEditor=e()}(self,(()=>(()=>{var t={9246:(t,e,n)=>{const i=n(6931),o={};for(const t of Object.keys(i))o[i[t]]=t;const r={rgb:{channels:3,labels:"rgb"},hsl:{channels:3,labels:"hsl"},hsv:{channels:3,labels:"hsv"},hwb:{channels:3,labels:"hwb"},cmyk:{channels:4,labels:"cmyk"},xyz:{channels:3,labels:"xyz"},lab:{channels:3,labels:"lab"},lch:{channels:3,labels:"lch"},hex:{channels:1,labels:["hex"]},keyword:{channels:1,labels:["keyword"]},ansi16:{channels:1,labels:["ansi16"]},ansi256:{channels:1,labels:["ansi256"]},hcg:{channels:3,labels:["h","c","g"]},apple:{channels:3,labels:["r16","g16","b16"]},gray:{channels:1,labels:["gray"]}};t.exports=r;for(const t of Object.keys(r)){if(!("channels"in r[t]))throw new Error("missing channels property: "+t);if(!("labels"in r[t]))throw new Error("missing channel labels property: "+t);if(r[t].labels.length!==r[t].channels)throw new Error("channel and label counts mismatch: "+t);const{channels:e,labels:n}=r[t];delete r[t].channels,delete r[t].labels,Object.defineProperty(r[t],"channels",{value:e}),Object.defineProperty(r[t],"labels",{value:n})}r.rgb.hsl=function(t){const e=t[0]/255,n=t[1]/255,i=t[2]/255,o=Math.min(e,n,i),r=Math.max(e,n,i),s=r-o;let a,c;r===o?a=0:e===r?a=(n-i)/s:n===r?a=2+(i-e)/s:i===r&&(a=4+(e-n)/s),a=Math.min(60*a,360),a<0&&(a+=360);const l=(o+r)/2;return c=r===o?0:l<=.5?s/(r+o):s/(2-r-o),[a,100*c,100*l]},r.rgb.hsv=function(t){let e,n,i,o,r;const s=t[0]/255,a=t[1]/255,c=t[2]/255,l=Math.max(s,a,c),d=l-Math.min(s,a,c),h=function(t){return(l-t)/6/d+.5};return 0===d?(o=0,r=0):(r=d/l,e=h(s),n=h(a),i=h(c),s===l?o=i-n:a===l?o=1/3+e-i:c===l&&(o=2/3+n-e),o<0?o+=1:o>1&&(o-=1)),[360*o,100*r,100*l]},r.rgb.hwb=function(t){const e=t[0],n=t[1];let i=t[2];const o=r.rgb.hsl(t)[0],s=1/255*Math.min(e,Math.min(n,i));return i=1-1/255*Math.max(e,Math.max(n,i)),[o,100*s,100*i]},r.rgb.cmyk=function(t){const e=t[0]/255,n=t[1]/255,i=t[2]/255,o=Math.min(1-e,1-n,1-i);return[100*((1-e-o)/(1-o)||0),100*((1-n-o)/(1-o)||0),100*((1-i-o)/(1-o)||0),100*o]},r.rgb.keyword=function(t){const e=o[t];if(e)return e;let n,r=1/0;for(const e of Object.keys(i)){const o=i[e],c=(a=o,((s=t)[0]-a[0])**2+(s[1]-a[1])**2+(s[2]-a[2])**2);c.04045?((e+.055)/1.055)**2.4:e/12.92,n=n>.04045?((n+.055)/1.055)**2.4:n/12.92,i=i>.04045?((i+.055)/1.055)**2.4:i/12.92;return[100*(.4124*e+.3576*n+.1805*i),100*(.2126*e+.7152*n+.0722*i),100*(.0193*e+.1192*n+.9505*i)]},r.rgb.lab=function(t){const e=r.rgb.xyz(t);let n=e[0],i=e[1],o=e[2];n/=95.047,i/=100,o/=108.883,n=n>.008856?n**(1/3):7.787*n+16/116,i=i>.008856?i**(1/3):7.787*i+16/116,o=o>.008856?o**(1/3):7.787*o+16/116;return[116*i-16,500*(n-i),200*(i-o)]},r.hsl.rgb=function(t){const e=t[0]/360,n=t[1]/100,i=t[2]/100;let o,r,s;if(0===n)return s=255*i,[s,s,s];o=i<.5?i*(1+n):i+n-i*n;const a=2*i-o,c=[0,0,0];for(let t=0;t<3;t++)r=e+1/3*-(t-1),r<0&&r++,r>1&&r--,s=6*r<1?a+6*(o-a)*r:2*r<1?o:3*r<2?a+(o-a)*(2/3-r)*6:a,c[t]=255*s;return c},r.hsl.hsv=function(t){const e=t[0];let n=t[1]/100,i=t[2]/100,o=n;const r=Math.max(i,.01);i*=2,n*=i<=1?i:2-i,o*=r<=1?r:2-r;return[e,100*(0===i?2*o/(r+o):2*n/(i+n)),100*((i+n)/2)]},r.hsv.rgb=function(t){const e=t[0]/60,n=t[1]/100;let i=t[2]/100;const o=Math.floor(e)%6,r=e-Math.floor(e),s=255*i*(1-n),a=255*i*(1-n*r),c=255*i*(1-n*(1-r));switch(i*=255,o){case 0:return[i,c,s];case 1:return[a,i,s];case 2:return[s,i,c];case 3:return[s,a,i];case 4:return[c,s,i];case 5:return[i,s,a]}},r.hsv.hsl=function(t){const e=t[0],n=t[1]/100,i=t[2]/100,o=Math.max(i,.01);let r,s;s=(2-n)*i;const a=(2-n)*o;return r=n*o,r/=a<=1?a:2-a,r=r||0,s/=2,[e,100*r,100*s]},r.hwb.rgb=function(t){const e=t[0]/360;let n=t[1]/100,i=t[2]/100;const o=n+i;let r;o>1&&(n/=o,i/=o);const s=Math.floor(6*e),a=1-i;r=6*e-s,1&s&&(r=1-r);const c=n+r*(a-n);let l,d,h;switch(s){default:case 6:case 0:l=a,d=c,h=n;break;case 1:l=c,d=a,h=n;break;case 2:l=n,d=a,h=c;break;case 3:l=n,d=c,h=a;break;case 4:l=c,d=n,h=a;break;case 5:l=a,d=n,h=c}return[255*l,255*d,255*h]},r.cmyk.rgb=function(t){const e=t[0]/100,n=t[1]/100,i=t[2]/100,o=t[3]/100;return[255*(1-Math.min(1,e*(1-o)+o)),255*(1-Math.min(1,n*(1-o)+o)),255*(1-Math.min(1,i*(1-o)+o))]},r.xyz.rgb=function(t){const e=t[0]/100,n=t[1]/100,i=t[2]/100;let o,r,s;return o=3.2406*e+-1.5372*n+-.4986*i,r=-.9689*e+1.8758*n+.0415*i,s=.0557*e+-.204*n+1.057*i,o=o>.0031308?1.055*o**(1/2.4)-.055:12.92*o,r=r>.0031308?1.055*r**(1/2.4)-.055:12.92*r,s=s>.0031308?1.055*s**(1/2.4)-.055:12.92*s,o=Math.min(Math.max(0,o),1),r=Math.min(Math.max(0,r),1),s=Math.min(Math.max(0,s),1),[255*o,255*r,255*s]},r.xyz.lab=function(t){let e=t[0],n=t[1],i=t[2];e/=95.047,n/=100,i/=108.883,e=e>.008856?e**(1/3):7.787*e+16/116,n=n>.008856?n**(1/3):7.787*n+16/116,i=i>.008856?i**(1/3):7.787*i+16/116;return[116*n-16,500*(e-n),200*(n-i)]},r.lab.xyz=function(t){let e,n,i;n=(t[0]+16)/116,e=t[1]/500+n,i=n-t[2]/200;const o=n**3,r=e**3,s=i**3;return n=o>.008856?o:(n-16/116)/7.787,e=r>.008856?r:(e-16/116)/7.787,i=s>.008856?s:(i-16/116)/7.787,e*=95.047,n*=100,i*=108.883,[e,n,i]},r.lab.lch=function(t){const e=t[0],n=t[1],i=t[2];let o;o=360*Math.atan2(i,n)/2/Math.PI,o<0&&(o+=360);return[e,Math.sqrt(n*n+i*i),o]},r.lch.lab=function(t){const e=t[0],n=t[1],i=t[2]/360*2*Math.PI;return[e,n*Math.cos(i),n*Math.sin(i)]},r.rgb.ansi16=function(t,e=null){const[n,i,o]=t;let s=null===e?r.rgb.hsv(t)[2]:e;if(s=Math.round(s/50),0===s)return 30;let a=30+(Math.round(o/255)<<2|Math.round(i/255)<<1|Math.round(n/255));return 2===s&&(a+=60),a},r.hsv.ansi16=function(t){return r.rgb.ansi16(r.hsv.rgb(t),t[2])},r.rgb.ansi256=function(t){const e=t[0],n=t[1],i=t[2];if(e===n&&n===i)return e<8?16:e>248?231:Math.round((e-8)/247*24)+232;return 16+36*Math.round(e/255*5)+6*Math.round(n/255*5)+Math.round(i/255*5)},r.ansi16.rgb=function(t){let e=t%10;if(0===e||7===e)return t>50&&(e+=3.5),e=e/10.5*255,[e,e,e];const n=.5*(1+~~(t>50));return[(1&e)*n*255,(e>>1&1)*n*255,(e>>2&1)*n*255]},r.ansi256.rgb=function(t){if(t>=232){const e=10*(t-232)+8;return[e,e,e]}let e;t-=16;return[Math.floor(t/36)/5*255,Math.floor((e=t%36)/6)/5*255,e%6/5*255]},r.rgb.hex=function(t){const e=(((255&Math.round(t[0]))<<16)+((255&Math.round(t[1]))<<8)+(255&Math.round(t[2]))).toString(16).toUpperCase();return"000000".substring(e.length)+e},r.hex.rgb=function(t){const e=t.toString(16).match(/[a-f0-9]{6}|[a-f0-9]{3}/i);if(!e)return[0,0,0];let n=e[0];3===e[0].length&&(n=n.split("").map((t=>t+t)).join(""));const i=parseInt(n,16);return[i>>16&255,i>>8&255,255&i]},r.rgb.hcg=function(t){const e=t[0]/255,n=t[1]/255,i=t[2]/255,o=Math.max(Math.max(e,n),i),r=Math.min(Math.min(e,n),i),s=o-r;let a,c;return a=s<1?r/(1-s):0,c=s<=0?0:o===e?(n-i)/s%6:o===n?2+(i-e)/s:4+(e-n)/s,c/=6,c%=1,[360*c,100*s,100*a]},r.hsl.hcg=function(t){const e=t[1]/100,n=t[2]/100,i=n<.5?2*e*n:2*e*(1-n);let o=0;return i<1&&(o=(n-.5*i)/(1-i)),[t[0],100*i,100*o]},r.hsv.hcg=function(t){const e=t[1]/100,n=t[2]/100,i=e*n;let o=0;return i<1&&(o=(n-i)/(1-i)),[t[0],100*i,100*o]},r.hcg.rgb=function(t){const e=t[0]/360,n=t[1]/100,i=t[2]/100;if(0===n)return[255*i,255*i,255*i];const o=[0,0,0],r=e%1*6,s=r%1,a=1-s;let c=0;switch(Math.floor(r)){case 0:o[0]=1,o[1]=s,o[2]=0;break;case 1:o[0]=a,o[1]=1,o[2]=0;break;case 2:o[0]=0,o[1]=1,o[2]=s;break;case 3:o[0]=0,o[1]=a,o[2]=1;break;case 4:o[0]=s,o[1]=0,o[2]=1;break;default:o[0]=1,o[1]=0,o[2]=a}return c=(1-n)*i,[255*(n*o[0]+c),255*(n*o[1]+c),255*(n*o[2]+c)]},r.hcg.hsv=function(t){const e=t[1]/100,n=e+t[2]/100*(1-e);let i=0;return n>0&&(i=e/n),[t[0],100*i,100*n]},r.hcg.hsl=function(t){const e=t[1]/100,n=t[2]/100*(1-e)+.5*e;let i=0;return n>0&&n<.5?i=e/(2*n):n>=.5&&n<1&&(i=e/(2*(1-n))),[t[0],100*i,100*n]},r.hcg.hwb=function(t){const e=t[1]/100,n=e+t[2]/100*(1-e);return[t[0],100*(n-e),100*(1-n)]},r.hwb.hcg=function(t){const e=t[1]/100,n=1-t[2]/100,i=n-e;let o=0;return i<1&&(o=(n-i)/(1-i)),[t[0],100*i,100*o]},r.apple.rgb=function(t){return[t[0]/65535*255,t[1]/65535*255,t[2]/65535*255]},r.rgb.apple=function(t){return[t[0]/255*65535,t[1]/255*65535,t[2]/255*65535]},r.gray.rgb=function(t){return[t[0]/100*255,t[0]/100*255,t[0]/100*255]},r.gray.hsl=function(t){return[0,0,t[0]]},r.gray.hsv=r.gray.hsl,r.gray.hwb=function(t){return[0,100,t[0]]},r.gray.cmyk=function(t){return[0,0,0,t[0]]},r.gray.lab=function(t){return[t[0],0,0]},r.gray.hex=function(t){const e=255&Math.round(t[0]/100*255),n=((e<<16)+(e<<8)+e).toString(16).toUpperCase();return"000000".substring(n.length)+n},r.rgb.gray=function(t){return[(t[0]+t[1]+t[2])/3/255*100]}},9047:(t,e,n)=>{const i=n(9246),o=n(802),r={};Object.keys(i).forEach((t=>{r[t]={},Object.defineProperty(r[t],"channels",{value:i[t].channels}),Object.defineProperty(r[t],"labels",{value:i[t].labels});const e=o(t);Object.keys(e).forEach((n=>{const i=e[n];r[t][n]=function(t){const e=function(...e){const n=e[0];if(null==n)return n;n.length>1&&(e=n);const i=t(e);if("object"==typeof i)for(let t=i.length,e=0;e1&&(e=n),t(e))};return"conversion"in t&&(e.conversion=t.conversion),e}(i)}))})),t.exports=r},802:(t,e,n)=>{const i=n(9246);function o(t){const e=function(){const t={},e=Object.keys(i);for(let n=e.length,i=0;i{"use strict";t.exports={aliceblue:[240,248,255],antiquewhite:[250,235,215],aqua:[0,255,255],aquamarine:[127,255,212],azure:[240,255,255],beige:[245,245,220],bisque:[255,228,196],black:[0,0,0],blanchedalmond:[255,235,205],blue:[0,0,255],blueviolet:[138,43,226],brown:[165,42,42],burlywood:[222,184,135],cadetblue:[95,158,160],chartreuse:[127,255,0],chocolate:[210,105,30],coral:[255,127,80],cornflowerblue:[100,149,237],cornsilk:[255,248,220],crimson:[220,20,60],cyan:[0,255,255],darkblue:[0,0,139],darkcyan:[0,139,139],darkgoldenrod:[184,134,11],darkgray:[169,169,169],darkgreen:[0,100,0],darkgrey:[169,169,169],darkkhaki:[189,183,107],darkmagenta:[139,0,139],darkolivegreen:[85,107,47],darkorange:[255,140,0],darkorchid:[153,50,204],darkred:[139,0,0],darksalmon:[233,150,122],darkseagreen:[143,188,143],darkslateblue:[72,61,139],darkslategray:[47,79,79],darkslategrey:[47,79,79],darkturquoise:[0,206,209],darkviolet:[148,0,211],deeppink:[255,20,147],deepskyblue:[0,191,255],dimgray:[105,105,105],dimgrey:[105,105,105],dodgerblue:[30,144,255],firebrick:[178,34,34],floralwhite:[255,250,240],forestgreen:[34,139,34],fuchsia:[255,0,255],gainsboro:[220,220,220],ghostwhite:[248,248,255],gold:[255,215,0],goldenrod:[218,165,32],gray:[128,128,128],green:[0,128,0],greenyellow:[173,255,47],grey:[128,128,128],honeydew:[240,255,240],hotpink:[255,105,180],indianred:[205,92,92],indigo:[75,0,130],ivory:[255,255,240],khaki:[240,230,140],lavender:[230,230,250],lavenderblush:[255,240,245],lawngreen:[124,252,0],lemonchiffon:[255,250,205],lightblue:[173,216,230],lightcoral:[240,128,128],lightcyan:[224,255,255],lightgoldenrodyellow:[250,250,210],lightgray:[211,211,211],lightgreen:[144,238,144],lightgrey:[211,211,211],lightpink:[255,182,193],lightsalmon:[255,160,122],lightseagreen:[32,178,170],lightskyblue:[135,206,250],lightslategray:[119,136,153],lightslategrey:[119,136,153],lightsteelblue:[176,196,222],lightyellow:[255,255,224],lime:[0,255,0],limegreen:[50,205,50],linen:[250,240,230],magenta:[255,0,255],maroon:[128,0,0],mediumaquamarine:[102,205,170],mediumblue:[0,0,205],mediumorchid:[186,85,211],mediumpurple:[147,112,219],mediumseagreen:[60,179,113],mediumslateblue:[123,104,238],mediumspringgreen:[0,250,154],mediumturquoise:[72,209,204],mediumvioletred:[199,21,133],midnightblue:[25,25,112],mintcream:[245,255,250],mistyrose:[255,228,225],moccasin:[255,228,181],navajowhite:[255,222,173],navy:[0,0,128],oldlace:[253,245,230],olive:[128,128,0],olivedrab:[107,142,35],orange:[255,165,0],orangered:[255,69,0],orchid:[218,112,214],palegoldenrod:[238,232,170],palegreen:[152,251,152],paleturquoise:[175,238,238],palevioletred:[219,112,147],papayawhip:[255,239,213],peachpuff:[255,218,185],peru:[205,133,63],pink:[255,192,203],plum:[221,160,221],powderblue:[176,224,230],purple:[128,0,128],rebeccapurple:[102,51,153],red:[255,0,0],rosybrown:[188,143,143],royalblue:[65,105,225],saddlebrown:[139,69,19],salmon:[250,128,114],sandybrown:[244,164,96],seagreen:[46,139,87],seashell:[255,245,238],sienna:[160,82,45],silver:[192,192,192],skyblue:[135,206,235],slateblue:[106,90,205],slategray:[112,128,144],slategrey:[112,128,144],snow:[255,250,250],springgreen:[0,255,127],steelblue:[70,130,180],tan:[210,180,140],teal:[0,128,128],thistle:[216,191,216],tomato:[255,99,71],turquoise:[64,224,208],violet:[238,130,238],wheat:[245,222,179],white:[255,255,255],whitesmoke:[245,245,245],yellow:[255,255,0],yellowgreen:[154,205,50]}},7111:(t,e,n)=>{"use strict";n.d(e,{A:()=>a});var i=n(9372),o=n.n(i),r=n(935),s=n.n(r)()(o());s.push([t.id,".ck.ck-math-form{align-items:flex-start;display:flex;flex-direction:row;flex-wrap:nowrap}@media screen and (max-width:600px){.ck.ck-math-form{flex-wrap:wrap}.ck.ck-math-form .ck-math-view,.ck.ck-math-form .ck-math-view .ck-label,.ck.ck-math-form .ck-math-view .ck-labeled-view{flex-basis:100%}.ck.ck-math-form .ck-button{flex-basis:50%}}.ck-math-tex.ck-placeholder:before{display:none!important}.ck.ck-toolbar-container{z-index:calc(var(--ck-z-panel) + 2)}.ck.ck-math-form{padding:var(--ck-spacing-standard)}.ck.ck-math-form:focus{outline:none}[dir=ltr] .ck.ck-math-form>:not(:first-child),[dir=rtl] .ck.ck-math-form>:not(:last-child){margin-left:var(--ck-spacing-standard)}@media screen and (max-width:600px){.ck.ck-math-form{padding:0}.ck.ck-math-form .ck-labeled-input{margin:var(--ck-spacing-standard) var(--ck-spacing-standard) 0}.ck.ck-math-form .ck-labeled-input .ck-input-text{min-width:0;width:100%}.ck.ck-math-form .ck-label,.ck.ck-math-form .ck-math-view .ck-button,.ck.ck-math-form .ck-math-view .ck.ck-math-preview{margin:var(--ck-spacing-standard) var(--ck-spacing-standard) 0}.ck.ck-math-form>.ck-button{border:0;border-radius:0;border-top:1px solid var(--ck-color-base-border);margin-top:var(--ck-spacing-standard);padding:var(--ck-spacing-standard)}[dir=ltr] .ck.ck-math-form>.ck-button{margin-left:0}[dir=ltr] .ck.ck-math-form>.ck-button:first-of-type{border-right:1px solid var(--ck-color-base-border)}[dir=rtl] .ck.ck-math-form>.ck-button{margin-left:0}[dir=rtl] .ck.ck-math-form>.ck-button:last-of-type{border-right:1px solid var(--ck-color-base-border)}}","",{version:3,sources:["webpack://./../../node_modules/@triliumnext/ckeditor5-math/theme/mathform.css","webpack://./../ckeditor5-theme-lark/theme/ckeditor5-math/mathform.css","webpack://./../ckeditor5-ui/theme/mixins/_rwd.css"],names:[],mappings:"AAAA,iBAEC,sBAAuB,CADvB,YAAa,CAEb,kBAAmB,CACnB,gBAsBD,CAnBC,oCAPD,iBAQE,cAkBF,CATG,wHACC,eACD,CAGD,4BACC,cACD,CACD,CAGD,mCACC,sBACD,CAEA,yBACC,mCACD,CC/BA,iBACI,kCAsEJ,CApEI,uBAEF,YACD,CASC,2FACC,sCACD,CCdD,oCDHD,iBAqBE,SAkDF,CAhDE,mCACC,8DAMD,CAJC,kDACC,WAAY,CACZ,UACD,CAYA,wHACC,8DACD,CAGD,4BAKC,QAAS,CADT,eAAgB,CAEhB,gDAAiD,CAJjD,qCAAsC,CADtC,kCAsBD,CAvBA,sCASE,aAcF,CAZE,oDACC,kDACD,CAbF,sCAiBE,aAMF,CAJE,mDACC,kDACD,CC9DH",sourcesContent:[".ck.ck-math-form {\n\tdisplay: flex;\n\talign-items: flex-start;\n\tflex-direction: row;\n\tflex-wrap: nowrap;\n\tpadding: var(--ck-spacing-standard);\n\n\t@media screen and (max-width: 600px) {\n\t\tflex-wrap: wrap;\n\n\t\t& .ck-math-view {\n\t\t\tflex-basis: 100%;\n\n\t\t\t& .ck-labeled-view {\n\t\t\t\tflex-basis: 100%;\n\t\t\t}\n\n\t\t\t& .ck-label {\n\t\t\t\tflex-basis: 100%;\n\t\t\t}\n\t\t}\n\n\t\t& .ck-button {\n\t\t\tflex-basis: 50%;\n\t\t}\n\t}\n}\n\n.ck-math-tex.ck-placeholder::before {\n\tdisplay: none !important;\n}\n\n.ck.ck-toolbar-container {\n\tz-index: calc(var(--ck-z-panel) + 2);\n}\n",'@import "@ckeditor/ckeditor5-ui/theme/mixins/_rwd.css";\n@import "@ckeditor/ckeditor5-ui/theme/mixins/_dir.css";\n\n.ck.ck-math-form {\n padding: var(--ck-spacing-standard);\n\n &:focus {\n\t\t/* https://github.com/ckeditor/ckeditor5-link/issues/90 */\n\t\toutline: none;\n\t}\n\n @mixin ck-dir ltr {\n\t\t& > :not(:first-child) {\n\t\t\tmargin-left: var(--ck-spacing-standard);\n\t\t}\n\t}\n\n\t@mixin ck-dir rtl {\n\t\t& > :not(:last-child) {\n\t\t\tmargin-left: var(--ck-spacing-standard);\n\t\t}\n\t}\n\n\t@mixin ck-media-phone {\n\t\tpadding: 0;\n\n\t\t& .ck-labeled-input {\n\t\t\tmargin: var(--ck-spacing-standard) var(--ck-spacing-standard) 0;\n\n\t\t\t& .ck-input-text {\n\t\t\t\tmin-width: 0;\n\t\t\t\twidth: 100%;\n\t\t\t}\n\t\t}\n\n & .ck-label {\n margin: var(--ck-spacing-standard) var(--ck-spacing-standard) 0;\n }\n\n\t\t& .ck-math-view {\n\t\t\t& .ck-button {\n\t\t\t\tmargin: var(--ck-spacing-standard) var(--ck-spacing-standard) 0;\n\t\t\t}\n\n\t\t\t& .ck.ck-math-preview {\n\t\t\t\tmargin: var(--ck-spacing-standard) var(--ck-spacing-standard) 0;\n\t\t\t}\n\t\t}\n\n\t\t& > .ck-button {\n\t\t\tpadding: var(--ck-spacing-standard);\n\t\t\tmargin-top: var(--ck-spacing-standard);\n\n\t\t\tborder-radius: 0;\n\t\t\tborder: 0;\n\t\t\tborder-top: 1px solid var(--ck-color-base-border);\n\n\t\t\t@mixin ck-dir ltr {\n\t\t\t\tmargin-left: 0;\n\n\t\t\t\t&:first-of-type {\n\t\t\t\t\tborder-right: 1px solid var(--ck-color-base-border);\n\t\t\t\t}\n\t\t\t}\n\n\t\t\t@mixin ck-dir rtl {\n\t\t\t\tmargin-left: 0;\n\n\t\t\t\t&:last-of-type {\n\t\t\t\t\tborder-right: 1px solid var(--ck-color-base-border);\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\t}\n}\n',"/*\n * Copyright (c) 2003-2024, CKSource Holding sp. z o.o. All rights reserved.\n * For licensing, see LICENSE.md or https://ckeditor.com/legal/ckeditor-oss-license\n */\n\n@define-mixin ck-media-phone {\n\t@media screen and (max-width: 600px) {\n\t\t@mixin-content;\n\t}\n}\n"],sourceRoot:""}]);const a=s},4199:(t,e,n)=>{"use strict";n.d(e,{A:()=>a});var i=n(9372),o=n.n(i),r=n(935),s=n.n(r)()(o());s.push([t.id,".ck-content code{background-color:hsla(0,0%,78%,.3);border-radius:2px;padding:.15em}.ck.ck-editor__editable .ck-code_selected{background-color:hsla(0,0%,78%,.5)}","",{version:3,sources:["webpack://./../ckeditor5-basic-styles/theme/code.css"],names:[],mappings:"AAKA,iBACC,kCAAuC,CAEvC,iBAAkB,CADlB,aAED,CAEA,0CACC,kCACD",sourcesContent:["/*\n * Copyright (c) 2003-2024, CKSource Holding sp. z o.o. All rights reserved.\n * For licensing, see LICENSE.md or https://ckeditor.com/legal/ckeditor-oss-license\n */\n\n.ck-content code {\n\tbackground-color: hsla(0, 0%, 78%, 0.3);\n\tpadding: .15em;\n\tborder-radius: 2px;\n}\n\n.ck.ck-editor__editable .ck-code_selected {\n\tbackground-color: hsla(0, 0%, 78%, 0.5);\n}\n"],sourceRoot:""}]);const a=s},8708:(t,e,n)=>{"use strict";n.d(e,{A:()=>a});var i=n(9372),o=n.n(i),r=n(935),s=n.n(r)()(o());s.push([t.id,".ck-content blockquote{border-left:5px solid #ccc;font-style:italic;margin-left:0;margin-right:0;overflow:hidden;padding-left:1.5em;padding-right:1.5em}.ck-content[dir=rtl] blockquote{border-left:0;border-right:5px solid #ccc}","",{version:3,sources:["webpack://./../ckeditor5-block-quote/theme/blockquote.css"],names:[],mappings:"AAKA,uBAWC,0BAAsC,CADtC,iBAAkB,CAFlB,aAAc,CACd,cAAe,CAPf,eAAgB,CAIhB,kBAAmB,CADnB,mBAOD,CAEA,gCACC,aAAc,CACd,2BACD",sourcesContent:['/*\n * Copyright (c) 2003-2024, CKSource Holding sp. z o.o. All rights reserved.\n * For licensing, see LICENSE.md or https://ckeditor.com/legal/ckeditor-oss-license\n */\n\n.ck-content blockquote {\n\t/* See #12 */\n\toverflow: hidden;\n\n\t/* https://github.com/ckeditor/ckeditor5-block-quote/issues/15 */\n\tpadding-right: 1.5em;\n\tpadding-left: 1.5em;\n\n\tmargin-left: 0;\n\tmargin-right: 0;\n\tfont-style: italic;\n\tborder-left: solid 5px hsl(0, 0%, 80%);\n}\n\n.ck-content[dir="rtl"] blockquote {\n\tborder-left: 0;\n\tborder-right: solid 5px hsl(0, 0%, 80%);\n}\n'],sourceRoot:""}]);const a=s},9826:(t,e,n)=>{"use strict";n.d(e,{A:()=>a});var i=n(9372),o=n.n(i),r=n(935),s=n.n(r)()(o());s.push([t.id,".ck.ck-block-toolbar-button{transform:translateX(calc(var(--ck-spacing-large)*-1))}","",{version:3,sources:["webpack://./theme/theme.css"],names:[],mappings:"AAMA,4BACC,sDACD",sourcesContent:["/*\n * Copyright (c) 2003-2024, CKSource Holding sp. z o.o. All rights reserved.\n * For licensing, see LICENSE.md or https://ckeditor.com/legal/ckeditor-oss-license\n */\n\n/* Give the block toolbar button some space, moving it a few pixels away from the editable area. */\n.ck.ck-block-toolbar-button {\n\ttransform: translateX( calc(-1 * var(--ck-spacing-large)) );\n}\n"],sourceRoot:""}]);const a=s},7793:(t,e,n)=>{"use strict";n.d(e,{A:()=>a});var i=n(9372),o=n.n(i),r=n(935),s=n.n(r)()(o());s.push([t.id,'.ck.ck-editor__editable .ck.ck-clipboard-drop-target-position{display:inline;pointer-events:none;position:relative}.ck.ck-editor__editable .ck.ck-clipboard-drop-target-position span{position:absolute;width:0}.ck.ck-editor__editable .ck-widget:-webkit-drag>.ck-widget__selection-handle,.ck.ck-editor__editable .ck-widget:-webkit-drag>.ck-widget__type-around{display:none}.ck.ck-clipboard-drop-target-line{pointer-events:none;position:absolute}:root{--ck-clipboard-drop-target-dot-width:12px;--ck-clipboard-drop-target-dot-height:8px;--ck-clipboard-drop-target-color:var(--ck-color-focus-border)}.ck.ck-editor__editable .ck.ck-clipboard-drop-target-position span{background:var(--ck-clipboard-drop-target-color);border:1px solid var(--ck-clipboard-drop-target-color);bottom:calc(var(--ck-clipboard-drop-target-dot-height)*-.5);margin-left:-1px;top:calc(var(--ck-clipboard-drop-target-dot-height)*-.5)}.ck.ck-editor__editable .ck.ck-clipboard-drop-target-position span:after{border-color:var(--ck-clipboard-drop-target-color) transparent transparent transparent;border-style:solid;border-width:calc(var(--ck-clipboard-drop-target-dot-height)) calc(var(--ck-clipboard-drop-target-dot-width)*.5) 0 calc(var(--ck-clipboard-drop-target-dot-width)*.5);content:"";display:block;height:0;left:50%;position:absolute;top:calc(var(--ck-clipboard-drop-target-dot-height)*-.5);transform:translateX(-50%);width:0}.ck.ck-editor__editable .ck-widget.ck-clipboard-drop-target-range{outline:var(--ck-widget-outline-thickness) solid var(--ck-clipboard-drop-target-color)!important}.ck.ck-editor__editable .ck-widget:-webkit-drag{zoom:.6;outline:none!important}.ck.ck-clipboard-drop-target-line{background:var(--ck-clipboard-drop-target-color);border:1px solid var(--ck-clipboard-drop-target-color);height:0;margin-top:-1px}.ck.ck-clipboard-drop-target-line:before{border-style:solid;content:"";height:0;position:absolute;top:calc(var(--ck-clipboard-drop-target-dot-width)*-.5);width:0}[dir=ltr] .ck.ck-clipboard-drop-target-line:before{border-color:transparent transparent transparent var(--ck-clipboard-drop-target-color);border-width:calc(var(--ck-clipboard-drop-target-dot-width)*.5) 0 calc(var(--ck-clipboard-drop-target-dot-width)*.5) var(--ck-clipboard-drop-target-dot-height);left:-1px}[dir=rtl] .ck.ck-clipboard-drop-target-line:before{border-color:transparent var(--ck-clipboard-drop-target-color) transparent transparent;border-width:calc(var(--ck-clipboard-drop-target-dot-width)*.5) var(--ck-clipboard-drop-target-dot-height) calc(var(--ck-clipboard-drop-target-dot-width)*.5) 0;right:-1px}',"",{version:3,sources:["webpack://./../ckeditor5-clipboard/theme/clipboard.css","webpack://./../ckeditor5-theme-lark/theme/ckeditor5-clipboard/clipboard.css"],names:[],mappings:"AASC,8DACC,cAAe,CAEf,mBAAoB,CADpB,iBAOD,CAJC,mEACC,iBAAkB,CAClB,OACD,CAWA,qJACC,YACD,CAIF,kCAEC,mBAAoB,CADpB,iBAED,CC9BA,MACC,yCAA0C,CAC1C,yCAA0C,CAC1C,6DACD,CAOE,mEAIC,gDAAiD,CADjD,sDAAuD,CAFvD,2DAA8D,CAI9D,gBAAiB,CAHjB,wDAqBD,CAfC,yEAWC,sFAAuF,CAEvF,kBAAmB,CADnB,qKAA0K,CAX1K,UAAW,CAIX,aAAc,CAFd,QAAS,CAIT,QAAS,CADT,iBAAkB,CAElB,wDAA2D,CAE3D,0BAA2B,CAR3B,OAYD,CAOF,kEACC,gGACD,CAKA,gDACC,OAAS,CACT,sBACD,CAGD,kCAGC,gDAAiD,CADjD,sDAAuD,CADvD,QAAS,CAGT,eAwBD,CAtBC,yCAMC,kBAAmB,CALnB,UAAW,CAIX,QAAS,CAHT,iBAAkB,CAClB,uDAA0D,CAC1D,OAiBD,CArBA,mDAYE,sFAAuF,CADvF,+JAAoK,CAFpK,SAYF,CArBA,mDAmBE,sFAAuF,CADvF,+JAAmK,CAFnK,UAKF",sourcesContent:["/*\n * Copyright (c) 2003-2024, CKSource Holding sp. z o.o. All rights reserved.\n * For licensing, see LICENSE.md or https://ckeditor.com/legal/ckeditor-oss-license\n */\n\n.ck.ck-editor__editable {\n\t/*\n\t * Vertical drop target (in text).\n\t */\n\t& .ck.ck-clipboard-drop-target-position {\n\t\tdisplay: inline;\n\t\tposition: relative;\n\t\tpointer-events: none;\n\n\t\t& span {\n\t\t\tposition: absolute;\n\t\t\twidth: 0;\n\t\t}\n\t}\n\n\t/*\n\t * Styles of the widget being dragged (its preview).\n\t */\n\t& .ck-widget:-webkit-drag {\n\t\t& > .ck-widget__selection-handle {\n\t\t\tdisplay: none;\n\t\t}\n\n\t\t& > .ck-widget__type-around {\n\t\t\tdisplay: none;\n\t\t}\n\t}\n}\n\n.ck.ck-clipboard-drop-target-line {\n\tposition: absolute;\n\tpointer-events: none;\n}\n","/*\n * Copyright (c) 2003-2024, CKSource Holding sp. z o.o. All rights reserved.\n * For licensing, see LICENSE.md or https://ckeditor.com/legal/ckeditor-oss-license\n */\n\n@import \"@ckeditor/ckeditor5-ui/theme/mixins/_dir.css\";\n\n:root {\n\t--ck-clipboard-drop-target-dot-width: 12px;\n\t--ck-clipboard-drop-target-dot-height: 8px;\n\t--ck-clipboard-drop-target-color: var(--ck-color-focus-border);\n}\n\n.ck.ck-editor__editable {\n\t/*\n\t * Vertical drop target (in text).\n\t */\n\t& .ck.ck-clipboard-drop-target-position {\n\t\t& span {\n\t\t\tbottom: calc(-.5 * var(--ck-clipboard-drop-target-dot-height));\n\t\t\ttop: calc(-.5 * var(--ck-clipboard-drop-target-dot-height));\n\t\t\tborder: 1px solid var(--ck-clipboard-drop-target-color);\n\t\t\tbackground: var(--ck-clipboard-drop-target-color);\n\t\t\tmargin-left: -1px;\n\n\t\t\t/* The triangle above the marker */\n\t\t\t&::after {\n\t\t\t\tcontent: '';\n\t\t\t\twidth: 0;\n\t\t\t\theight: 0;\n\n\t\t\t\tdisplay: block;\n\t\t\t\tposition: absolute;\n\t\t\t\tleft: 50%;\n\t\t\t\ttop: calc(-.5 * var(--ck-clipboard-drop-target-dot-height));\n\n\t\t\t\ttransform: translateX(-50%);\n\t\t\t\tborder-color: var(--ck-clipboard-drop-target-color) transparent transparent transparent;\n\t\t\t\tborder-width: calc(var(--ck-clipboard-drop-target-dot-height)) calc(.5 * var(--ck-clipboard-drop-target-dot-width)) 0 calc(.5 * var(--ck-clipboard-drop-target-dot-width));\n\t\t\t\tborder-style: solid;\n\t\t\t}\n\t\t}\n\t}\n\n\t/*\n\t * Styles of the widget that it a drop target.\n\t */\n\t& .ck-widget.ck-clipboard-drop-target-range {\n\t\toutline: var(--ck-widget-outline-thickness) solid var(--ck-clipboard-drop-target-color) !important;\n\t}\n\n\t/*\n\t * Styles of the widget being dragged (its preview).\n\t */\n\t& .ck-widget:-webkit-drag {\n\t\tzoom: 0.6;\n\t\toutline: none !important;\n\t}\n}\n\n.ck.ck-clipboard-drop-target-line {\n\theight: 0;\n\tborder: 1px solid var(--ck-clipboard-drop-target-color);\n\tbackground: var(--ck-clipboard-drop-target-color);\n\tmargin-top: -1px;\n\n\t&::before {\n\t\tcontent: '';\n\t\tposition: absolute;\n\t\ttop: calc(-.5 * var(--ck-clipboard-drop-target-dot-width));\n\t\twidth: 0;\n\t\theight: 0;\n\t\tborder-style: solid;\n\n\t\t@mixin ck-dir ltr {\n\t\t\tleft: -1px;\n\n\t\t\tborder-width: calc(.5 * var(--ck-clipboard-drop-target-dot-width)) 0 calc(.5 * var(--ck-clipboard-drop-target-dot-width)) var(--ck-clipboard-drop-target-dot-height);\n\t\t\tborder-color: transparent transparent transparent var(--ck-clipboard-drop-target-color);\n\t\t}\n\n\t\t@mixin ck-dir rtl {\n\t\t\tright: -1px;\n\n\t\t\tborder-width:calc(.5 * var(--ck-clipboard-drop-target-dot-width)) var(--ck-clipboard-drop-target-dot-height) calc(.5 * var(--ck-clipboard-drop-target-dot-width)) 0;\n\t\t\tborder-color: transparent var(--ck-clipboard-drop-target-color) transparent transparent;\n\t\t}\n\t}\n}\n"],sourceRoot:""}]);const a=s},6610:(t,e,n)=>{"use strict";n.d(e,{A:()=>a});var i=n(9372),o=n.n(i),r=n(935),s=n.n(r)()(o());s.push([t.id,".ck-content pre{background:hsla(0,0%,78%,.3);border:1px solid #c4c4c4;border-radius:2px;color:#353535;direction:ltr;font-style:normal;min-width:200px;padding:1em;tab-size:4;text-align:left;white-space:pre-wrap}.ck-content pre code{background:unset;border-radius:0;padding:0}.ck.ck-editor__editable pre{position:relative}.ck.ck-editor__editable pre[data-language]:after{content:attr(data-language);position:absolute}:root{--ck-color-code-block-label-background:#757575}.ck.ck-editor__editable pre[data-language]:after{background:var(--ck-color-code-block-label-background);color:#fff;font-family:var(--ck-font-face);font-size:10px;line-height:16px;padding:var(--ck-spacing-tiny) var(--ck-spacing-medium);right:10px;top:-1px;white-space:nowrap}.ck.ck-code-block-dropdown .ck-dropdown__panel{max-height:250px;overflow-x:hidden;overflow-y:auto}","",{version:3,sources:["webpack://./../ckeditor5-code-block/theme/codeblock.css","webpack://./../ckeditor5-theme-lark/theme/ckeditor5-code-block/codeblock.css"],names:[],mappings:"AAKA,gBAGC,4BAAiC,CACjC,wBAAiC,CACjC,iBAAkB,CAHlB,aAAwB,CAOxB,aAAc,CAMd,iBAAkB,CAGlB,eAAgB,CAjBhB,WAAY,CAUZ,UAAW,CAHX,eAAgB,CAIhB,oBAaD,CALC,qBACC,gBAAiB,CAEjB,eAAgB,CADhB,SAED,CAGD,4BACC,iBAMD,CAJC,iDACC,2BAA4B,CAC5B,iBACD,CCjCD,MACC,8CACD,CAEA,iDAGC,sDAAuD,CAMvD,UAAuB,CAHvB,+BAAgC,CADhC,cAAe,CAEf,gBAAiB,CACjB,uDAAwD,CANxD,UAAW,CADX,QAAS,CAST,kBACD,CAEA,+CAEC,gBAAiB,CAEjB,iBAAkB,CADlB,eAED",sourcesContent:["/*\n * Copyright (c) 2003-2024, CKSource Holding sp. z o.o. All rights reserved.\n * For licensing, see LICENSE.md or https://ckeditor.com/legal/ckeditor-oss-license\n */\n\n.ck-content pre {\n\tpadding: 1em;\n\tcolor: hsl(0, 0%, 20.8%);\n\tbackground: hsla(0, 0%, 78%, 0.3);\n\tborder: 1px solid hsl(0, 0%, 77%);\n\tborder-radius: 2px;\n\n\t/* Code block are language direction–agnostic. */\n\ttext-align: left;\n\tdirection: ltr;\n\n\ttab-size: 4;\n\twhite-space: pre-wrap;\n\n\t/* Don't inherit the style, e.g. when in a block quote. */\n\tfont-style: normal;\n\n\t/* Don't let the code be squashed e.g. when in a table cell. */\n\tmin-width: 200px;\n\n\t& code {\n\t\tbackground: unset;\n\t\tpadding: 0;\n\t\tborder-radius: 0;\n\t}\n}\n\n.ck.ck-editor__editable pre {\n\tposition: relative;\n\n\t&[data-language]::after {\n\t\tcontent: attr(data-language);\n\t\tposition: absolute;\n\t}\n}\n","/*\n * Copyright (c) 2003-2024, CKSource Holding sp. z o.o. All rights reserved.\n * For licensing, see LICENSE.md or https://ckeditor.com/legal/ckeditor-oss-license\n */\n\n:root {\n\t--ck-color-code-block-label-background: hsl(0, 0%, 46%);\n}\n\n.ck.ck-editor__editable pre[data-language]::after {\n\ttop: -1px;\n\tright: 10px;\n\tbackground: var(--ck-color-code-block-label-background);\n\n\tfont-size: 10px;\n\tfont-family: var(--ck-font-face);\n\tline-height: 16px;\n\tpadding: var(--ck-spacing-tiny) var(--ck-spacing-medium);\n\tcolor: hsl(0, 0%, 100%);\n\twhite-space: nowrap;\n}\n\n.ck.ck-code-block-dropdown .ck-dropdown__panel {\n\t/* There could be dozens of languages available. Use scroll to prevent a 10e6px dropdown. */\n\tmax-height: 250px;\n\toverflow-y: auto;\n\toverflow-x: hidden;\n}\n"],sourceRoot:""}]);const a=s},4098:(t,e,n)=>{"use strict";n.d(e,{A:()=>a});var i=n(9372),o=n.n(i),r=n(935),s=n.n(r)()(o());s.push([t.id,".ck .ck-placeholder,.ck.ck-placeholder{position:relative}.ck .ck-placeholder:before,.ck.ck-placeholder:before{content:attr(data-placeholder);left:0;pointer-events:none;position:absolute;right:0}.ck.ck-read-only .ck-placeholder:before{display:none}.ck.ck-reset_all .ck-placeholder{position:relative}@media (forced-colors:active){.ck .ck-placeholder,.ck.ck-placeholder{forced-color-adjust:preserve-parent-color}}.ck .ck-placeholder:before,.ck.ck-placeholder:before{cursor:text}@media (forced-colors:none){.ck .ck-placeholder:before,.ck.ck-placeholder:before{color:var(--ck-color-engine-placeholder-text)}}@media (forced-colors:active){.ck .ck-placeholder:before,.ck.ck-placeholder:before{font-style:italic;margin-left:1px}}","",{version:3,sources:["webpack://./../ckeditor5-engine/theme/placeholder.css","webpack://./../ckeditor5-ui/theme/mixins/_mediacolors.css","webpack://./../ckeditor5-theme-lark/theme/ckeditor5-engine/placeholder.css"],names:[],mappings:"AAMA,uCAEC,iBAWD,CATC,qDAIC,8BAA+B,CAF/B,MAAO,CAKP,mBAAoB,CANpB,iBAAkB,CAElB,OAKD,CAKA,wCACC,YACD,CAQD,iCACC,iBACD,CC7BC,8BACC,uCCOA,yCDLA,CACD,CCOA,qDACC,WAmBD,CDvBA,4BACC,qDCMC,6CDJD,CACD,CAZA,8BACC,qDCsBC,iBAAkB,CAMlB,eD1BD,CACD",sourcesContent:["/*\n * Copyright (c) 2003-2024, CKSource Holding sp. z o.o. All rights reserved.\n * For licensing, see LICENSE.md or https://ckeditor.com/legal/ckeditor-oss-license\n */\n\n/* See ckeditor/ckeditor5#936. */\n.ck.ck-placeholder,\n.ck .ck-placeholder {\n\tposition: relative;\n\n\t&::before {\n\t\tposition: absolute;\n\t\tleft: 0;\n\t\tright: 0;\n\t\tcontent: attr(data-placeholder);\n\n\t\t/* See ckeditor/ckeditor5#469. */\n\t\tpointer-events: none;\n\t}\n}\n\n/* See ckeditor/ckeditor5#1987. */\n.ck.ck-read-only .ck-placeholder {\n\t&::before {\n\t\tdisplay: none;\n\t}\n}\n\n/*\n * Rules for the `ck-placeholder` are loaded before the rules for `ck-reset_all` in the base CKEditor 5 DLL build.\n * This fix overwrites the incorrectly set `position: static` from `ck-reset_all`.\n * See https://github.com/ckeditor/ckeditor5/issues/11418.\n */\n.ck.ck-reset_all .ck-placeholder {\n\tposition: relative;\n}\n","/*\n * Copyright (c) 2003-2024, CKSource Holding sp. z o.o. All rights reserved.\n * For licensing, see LICENSE.md or https://ckeditor.com/legal/ckeditor-oss-license\n */\n\n@define-mixin ck-media-forced-colors {\n\t@media (forced-colors: active) {\n\t\t& {\n\t\t\t@mixin-content;\n\t\t}\n\t}\n}\n\n@define-mixin ck-media-default-colors {\n\t@media (forced-colors: none) {\n\t\t& {\n\t\t\t@mixin-content;\n\t\t}\n\t}\n}\n",'/*\n * Copyright (c) 2003-2024, CKSource Holding sp. z o.o. All rights reserved.\n * For licensing, see LICENSE.md or https://ckeditor.com/legal/ckeditor-oss-license\n */\n\n@import "@ckeditor/ckeditor5-ui/theme/mixins/_mediacolors.css";\n\n/* See ckeditor/ckeditor5#936. */\n.ck.ck-placeholder, .ck .ck-placeholder {\n\t@mixin ck-media-forced-colors {\n\t\t/*\n\t\t * This is needed for Edge on Windows to use the right color for the placeholder content (::before).\n\t\t * See https://github.com/ckeditor/ckeditor5/issues/14907.\n\t\t */\n\t\tforced-color-adjust: preserve-parent-color;\n\t}\n\n\t&::before {\n\t\tcursor: text;\n\n\t\t@mixin ck-media-default-colors {\n\t\t\tcolor: var(--ck-color-engine-placeholder-text);\n\t\t}\n\n\t\t@mixin ck-media-forced-colors {\n\t\t\t/*\n\t\t\t * In the high contrast mode there is no telling between regular and placeholder text. Using\n\t\t\t * italic text to address that issue. See https://github.com/ckeditor/ckeditor5/issues/14907.\n\t\t\t */\n\t\t\tfont-style: italic;\n\n\t\t\t/*\n\t\t\t * Without this margin, the caret will not show up and blink when the user puts the selection\n\t\t\t * in the placeholder (Edge on Windows). See https://github.com/ckeditor/ckeditor5/issues/14907.\n\t\t\t */\n\t\t\tmargin-left: 1px;\n\t\t}\n\t}\n}\n'],sourceRoot:""}]);const a=s},8264:(t,e,n)=>{"use strict";n.d(e,{A:()=>a});var i=n(9372),o=n.n(i),r=n(935),s=n.n(r)()(o());s.push([t.id,".ck.ck-editor__editable span[data-ck-unsafe-element]{display:none}","",{version:3,sources:["webpack://./../ckeditor5-engine/theme/renderer.css"],names:[],mappings:"AAMA,qDACC,YACD",sourcesContent:["/*\n * Copyright (c) 2003-2024, CKSource Holding sp. z o.o. All rights reserved.\n * For licensing, see LICENSE.md or https://ckeditor.com/legal/ckeditor-oss-license\n */\n\n/* Elements marked by the Renderer as hidden should be invisible in the editor. */\n.ck.ck-editor__editable span[data-ck-unsafe-element] {\n\tdisplay: none;\n}\n"],sourceRoot:""}]);const a=s},4341:(t,e,n)=>{"use strict";n.d(e,{A:()=>a});var i=n(9372),o=n.n(i),r=n(935),s=n.n(r)()(o());s.push([t.id,".ck-find-result{background:var(--ck-color-highlight-background);color:var(--ck-color-text)}.ck-find-result_selected{background:#ff9633}","",{version:3,sources:["webpack://./../ckeditor5-find-and-replace/theme/findandreplace.css"],names:[],mappings:"AAKA,gBACC,+CAAgD,CAChD,0BACD,CAEA,yBACC,kBACD",sourcesContent:["/*\n * Copyright (c) 2003-2024, CKSource Holding sp. z o.o. All rights reserved.\n * For licensing, see LICENSE.md or https://ckeditor.com/legal/ckeditor-oss-license\n */\n\n.ck-find-result {\n\tbackground: var(--ck-color-highlight-background);\n\tcolor: var(--ck-color-text);\n}\n\n.ck-find-result_selected {\n\tbackground: hsl(29, 100%, 60%);\n}\n"],sourceRoot:""}]);const a=s},9627:(t,e,n)=>{"use strict";n.d(e,{A:()=>a});var i=n(9372),o=n.n(i),r=n(935),s=n.n(r)()(o());s.push([t.id,".ck.ck-find-and-replace-form{max-width:100%;& .ck-find-and-replace-form__inputs,.ck-find-and-replace-form__actions{display:flex}& .ck-find-and-replace-form__inputs.ck-find-and-replace-form__inputs .ck-results-counter,.ck-find-and-replace-form__actions.ck-find-and-replace-form__inputs .ck-results-counter{position:absolute}}.ck.ck-find-and-replace-form{width:400px}.ck.ck-find-and-replace-form:focus{outline:none}.ck.ck-find-and-replace-form .ck-find-and-replace-form__actions,.ck.ck-find-and-replace-form .ck-find-and-replace-form__inputs{align-content:stretch;align-items:center;flex:1 1 auto;flex-direction:row;flex-wrap:wrap;margin:0;padding:var(--ck-spacing-large)}.ck.ck-find-and-replace-form .ck-find-and-replace-form__actions>.ck-button,.ck.ck-find-and-replace-form .ck-find-and-replace-form__inputs>.ck-button{flex:0 0 auto}[dir=ltr] .ck.ck-find-and-replace-form .ck-find-and-replace-form__actions>*+*,[dir=ltr] .ck.ck-find-and-replace-form .ck-find-and-replace-form__inputs>*+*{margin-left:var(--ck-spacing-standard)}[dir=rtl] .ck.ck-find-and-replace-form .ck-find-and-replace-form__actions>*+*,[dir=rtl] .ck.ck-find-and-replace-form .ck-find-and-replace-form__inputs>*+*{margin-right:var(--ck-spacing-standard)}.ck.ck-find-and-replace-form .ck-find-and-replace-form__actions .ck-labeled-field-view,.ck.ck-find-and-replace-form .ck-find-and-replace-form__inputs .ck-labeled-field-view{flex:1 1 auto}.ck.ck-find-and-replace-form .ck-find-and-replace-form__actions .ck-labeled-field-view .ck-input,.ck.ck-find-and-replace-form .ck-find-and-replace-form__inputs .ck-labeled-field-view .ck-input{min-width:50px;width:100%}.ck.ck-find-and-replace-form .ck-find-and-replace-form__inputs{align-items:flex-start}.ck.ck-find-and-replace-form .ck-find-and-replace-form__inputs>.ck-button-prev>.ck-icon{transform:rotate(90deg)}.ck.ck-find-and-replace-form .ck-find-and-replace-form__inputs>.ck-button-next>.ck-icon{transform:rotate(-90deg)}.ck.ck-find-and-replace-form .ck-find-and-replace-form__inputs .ck-results-counter{top:50%;transform:translateY(-50%)}[dir=ltr] .ck.ck-find-and-replace-form .ck-find-and-replace-form__inputs .ck-results-counter{right:var(--ck-spacing-standard)}[dir=rtl] .ck.ck-find-and-replace-form .ck-find-and-replace-form__inputs .ck-results-counter{left:var(--ck-spacing-standard)}.ck.ck-find-and-replace-form .ck-find-and-replace-form__inputs .ck-results-counter{color:var(--ck-color-base-border)}.ck.ck-find-and-replace-form .ck-find-and-replace-form__inputs>.ck-labeled-field-replace{flex:0 0 100%;padding-top:var(--ck-spacing-standard)}[dir=ltr] .ck.ck-find-and-replace-form .ck-find-and-replace-form__inputs>.ck-labeled-field-replace{margin-left:0}[dir=rtl] .ck.ck-find-and-replace-form .ck-find-and-replace-form__inputs>.ck-labeled-field-replace{margin-right:0}.ck.ck-find-and-replace-form .ck-find-and-replace-form__actions{flex-wrap:wrap;justify-content:flex-end;margin-top:calc(var(--ck-spacing-large)*-1)}.ck.ck-find-and-replace-form .ck-find-and-replace-form__actions>.ck-button-find{font-weight:700}.ck.ck-find-and-replace-form .ck-find-and-replace-form__actions>.ck-button-find .ck-button__label{padding-left:var(--ck-spacing-large);padding-right:var(--ck-spacing-large)}.ck.ck-find-and-replace-form .ck-switchbutton{align-items:center;display:flex;flex-direction:row;flex-wrap:nowrap;justify-content:space-between;width:100%}@media screen and (max-width:600px){.ck.ck-find-and-replace-form{max-width:100%;width:300px}.ck.ck-find-and-replace-form.ck-find-and-replace-form__input{flex-wrap:wrap}.ck.ck-find-and-replace-form.ck-find-and-replace-form__input .ck-labeled-field-view{flex:1 0 auto;margin-bottom:var(--ck-spacing-standard);width:100%}.ck.ck-find-and-replace-form.ck-find-and-replace-form__input>.ck-button{text-align:center}.ck.ck-find-and-replace-form.ck-find-and-replace-form__input>.ck-button:first-of-type{flex:1 1 auto}[dir=ltr] .ck.ck-find-and-replace-form.ck-find-and-replace-form__input>.ck-button:first-of-type{margin-left:0}[dir=rtl] .ck.ck-find-and-replace-form.ck-find-and-replace-form__input>.ck-button:first-of-type{margin-right:0}.ck.ck-find-and-replace-form.ck-find-and-replace-form__input>.ck-button:first-of-type .ck-button__label{text-align:center;width:100%}.ck.ck-find-and-replace-form.ck-find-and-replace-form__actions>:not(.ck-labeled-field-view){flex:1 1 auto;flex-wrap:wrap}.ck.ck-find-and-replace-form.ck-find-and-replace-form__actions>:not(.ck-labeled-field-view)>.ck-button{text-align:center}.ck.ck-find-and-replace-form.ck-find-and-replace-form__actions>:not(.ck-labeled-field-view)>.ck-button:first-of-type{flex:1 1 auto}[dir=ltr] .ck.ck-find-and-replace-form.ck-find-and-replace-form__actions>:not(.ck-labeled-field-view)>.ck-button:first-of-type{margin-left:0}[dir=rtl] .ck.ck-find-and-replace-form.ck-find-and-replace-form__actions>:not(.ck-labeled-field-view)>.ck-button:first-of-type{margin-right:0}.ck.ck-find-and-replace-form.ck-find-and-replace-form__actions>:not(.ck-labeled-field-view)>.ck-button .ck-button__label{text-align:center;width:100%}}","",{version:3,sources:["webpack://./../ckeditor5-find-and-replace/theme/findandreplaceform.css","webpack://./../ckeditor5-theme-lark/theme/ckeditor5-find-and-replace/findandreplaceform.css","webpack://./../ckeditor5-ui/theme/mixins/_rwd.css"],names:[],mappings:"AAKA,6BACC,cAAe,CAEf,uEACC,YAMD,CAHC,iLACC,iBACD,CAEF,CCRA,6BACC,WAoHD,CA9GC,mCACC,YACD,CAGA,+HAMC,qBAAsB,CADtB,kBAAmB,CAHnB,aAAc,CACd,kBAAmB,CACnB,cAAe,CAKf,QAAS,CADT,+BA4BD,CAzBC,qJACC,aACD,CAGC,2JACC,sCACD,CAIA,2JACC,uCACD,CAGD,6KACC,aAMD,CAJC,iMAEC,cAAe,CADf,UAED,CAMF,+DAEC,sBAqCD,CAnCC,wFACC,uBACD,CAEA,wFACC,wBACD,CAEA,mFACC,OAAQ,CACR,0BAWD,CAbA,6FAKE,gCAQF,CAbA,6FASE,+BAIF,CAbA,mFAYC,iCACD,CAEA,yFACC,aAAc,CACd,sCASD,CAXA,mGAKE,aAMF,CAXA,mGASE,cAEF,CAID,gEACC,cAAe,CACf,wBAAyB,CACzB,2CAWD,CATC,gFACC,eAOD,CAJC,kGACC,oCAAqC,CACrC,qCACD,CAIF,8CAMC,kBAAmB,CAJnB,YAAa,CACb,kBAAmB,CACnB,gBAAiB,CACjB,6BAA8B,CAJ9B,UAMD,CCtHA,oCD0HA,6BAIC,cAAe,CAHf,WA+DD,CAzDC,6DACC,cA4BD,CA1BC,oFACC,aAAc,CAEd,wCAAyC,CADzC,UAED,CAEA,wEACC,iBAkBD,CAhBC,sFACC,aAcD,CAfA,gGAIE,aAWF,CAfA,gGAQE,cAOF,CAJC,wGAEC,iBAAkB,CADlB,UAED,CAMH,4FAEC,aAAc,CADd,cAuBD,CApBC,uGACC,iBAkBD,CAhBC,qHACC,aASD,CAVA,+HAIE,aAMF,CAVA,+HAQE,cAEF,CAEA,yHAEC,iBAAkB,CADlB,UAED,CCrLH",sourcesContent:["/*\n * Copyright (c) 2003-2024, CKSource Holding sp. z o.o. All rights reserved.\n * For licensing, see LICENSE.md or https://ckeditor.com/legal/ckeditor-oss-license\n */\n\n.ck.ck-find-and-replace-form {\n\tmax-width: 100%;\n\n\t& .ck-find-and-replace-form__inputs, .ck-find-and-replace-form__actions {\n\t\tdisplay: flex;\n\n\t\t/* The inputs area styles */\n\t\t&.ck-find-and-replace-form__inputs .ck-results-counter {\n\t\t\tposition: absolute;\n\t\t}\n\t}\n}\n",'/*\n * Copyright (c) 2003-2024, CKSource Holding sp. z o.o. All rights reserved.\n * For licensing, see LICENSE.md or https://ckeditor.com/legal/ckeditor-oss-license\n */\n\n@import "@ckeditor/ckeditor5-ui/theme/mixins/_rwd.css";\n@import "@ckeditor/ckeditor5-ui/theme/mixins/_dir.css";\n\n.ck.ck-find-and-replace-form {\n\twidth: 400px;\n\n\t/*\n\t * The
").replace(/\r?\n/g,"
").replace(/\t/g," ").replace(/^\s/," ").replace(/\s$/," ").replace(/\s\s/g," ")).includes("
")||r.includes("
"))&&(r=`
${r}
`),t=r),o=this.editor.data.htmlProcessor.toView(t)}var r;const s=new m(this,"inputTransformation");this.fire(s,{content:o,dataTransfer:i,targetRanges:e.targetRanges,method:e.method}),s.stop.called&&t.stop(),n.scrollToTheSelection()}),{priority:"low"}),this.listenTo(this,"inputTransformation",((t,n)=>{if(n.content.isEmpty)return;const i=this.editor.data.toModel(n.content,"$clipboardHolder");0!=i.childCount&&(t.stop(),e.change((()=>{this.fire("contentInsertion",{content:i,method:n.method,dataTransfer:n.dataTransfer,targetRanges:n.targetRanges})})))}),{priority:"low"}),this.listenTo(this,"contentInsertion",((t,e)=>{e.resultRange=o._pasteFragmentWithMarkers(e.content)}),{priority:"low"})}_setupCopyCut(){const t=this.editor,e=t.model.document,n=t.editing.view.document,i=(t,n)=>{const i=n.dataTransfer;n.preventDefault(),this._fireOutputTransformationEvent(i,e.selection,t.name)};this.listenTo(n,"copy",i,{priority:"low"}),this.listenTo(n,"cut",((e,n)=>{t.model.canEditAt(t.model.document.selection)?i(e,n):n.preventDefault()}),{priority:"low"}),this.listenTo(this,"outputTransformation",((e,i)=>{const o=t.data.toView(i.content);n.fire("clipboardOutput",{dataTransfer:i.dataTransfer,content:o,method:i.method})}),{priority:"low"}),this.listenTo(n,"clipboardOutput",((n,i)=>{i.content.isEmpty||(i.dataTransfer.setData("text/html",this.editor.data.htmlProcessor.toData(i.content)),i.dataTransfer.setData("text/plain",cC(i.content))),"cut"==i.method&&t.model.deleteContent(e.selection)}),{priority:"low"})}}class VC extends(S()){constructor(){super(...arguments),this._stack=[]}add(t,e){const n=this._stack,i=n[0];this._insertDescriptor(t);const o=n[0];i===o||FC(i,o)||this.fire("change:top",{oldDescriptor:i,newDescriptor:o,writer:e})}remove(t,e){const n=this._stack,i=n[0];this._removeDescriptor(t);const o=n[0];i===o||FC(i,o)||this.fire("change:top",{oldDescriptor:i,newDescriptor:o,writer:e})}_insertDescriptor(t){const e=this._stack,n=e.findIndex((e=>e.id===t.id));if(FC(t,e[n]))return;n>-1&&e.splice(n,1);let i=0;for(;e[i]&&LC(e[i],t);)i++;e.splice(i,0,t)}_removeDescriptor(t){const e=this._stack,n=e.findIndex((e=>e.id===t));n>-1&&e.splice(n,1)}}function FC(t,e){return t&&e&&t.priority==e.priority&&OC(t.classes)==OC(e.classes)}function LC(t,e){return t.priority>e.priority||!(t.priorityOC(e.classes)}function OC(t){return Array.isArray(t)?t.sort().join(","):t}const zC='',MC="ck-widget",NC="ck-widget_selected";function HC(t){return!!t.is("element")&&!!t.getCustomProperty("widget")}function jC(t,e,n={}){if(!t.is("containerElement"))throw new w("widget-to-widget-wrong-element-type",null,{element:t});return e.setAttribute("contenteditable","false",t),e.addClass(MC,t),e.setCustomProperty("widget",!0,t),t.getFillerOffset=JC,e.setCustomProperty("widgetLabel",[],t),n.label&&function(t,e){const n=t.getCustomProperty("widgetLabel");n.push(e)}(t,n.label),n.hasSelectionHandle&&function(t,e){const n=e.createUIElement("div",{class:"ck ck-widget__selection-handle"},(function(t){const e=this.toDomElement(t),n=new lg;return n.set("content",zC),n.render(),e.appendChild(n.element),e}));e.insert(e.createPositionAt(t,0),n),e.addClass(["ck-widget_with-selection-handle"],t)}(t,e),UC(t,e),t}function qC(t,e,n){if(e.classes&&n.addClass(_o(e.classes),t),e.attributes)for(const i in e.attributes)n.setAttribute(i,e.attributes[i],t)}function WC(t,e,n){if(e.classes&&n.removeClass(_o(e.classes),t),e.attributes)for(const i in e.attributes)n.removeAttribute(i,t)}function UC(t,e,n=qC,i=WC){const o=new VC;o.on("change:top",((e,o)=>{o.oldDescriptor&&i(t,o.oldDescriptor,o.writer),o.newDescriptor&&n(t,o.newDescriptor,o.writer)}));e.setCustomProperty("addHighlight",((t,e,n)=>o.add(e,n)),t),e.setCustomProperty("removeHighlight",((t,e,n)=>o.remove(e,n)),t)}function $C(t,e,n={}){return e.addClass(["ck-editor__editable","ck-editor__nested-editable"],t),e.setAttribute("role","textbox",t),e.setAttribute("tabindex","-1",t),n.label&&e.setAttribute("aria-label",n.label,t),e.setAttribute("contenteditable",t.isReadOnly?"false":"true",t),t.on("change:isReadOnly",((n,i,o)=>{e.setAttribute("contenteditable",o?"false":"true",t)})),t.on("change:isFocused",((n,i,o)=>{o?e.addClass("ck-editor__nested-editable_focused",t):e.removeClass("ck-editor__nested-editable_focused",t)})),UC(t,e),t}function GC(t,e){const n=t.getSelectedElement();if(n){const i=XC(t);if(i)return e.createRange(e.createPositionAt(n,i))}return e.schema.findOptimalInsertionRange(t)}function KC(t,e){return(n,i)=>{const{mapper:o,viewPosition:r}=i,s=o.findMappedViewAncestor(r);if(!e(s))return;const a=o.toModelElement(s);i.modelPosition=t.createPositionAt(a,r.isAtStart?"before":"after")}}function JC(){return null}function ZC(t){const e=t=>{const{width:e,paddingLeft:n,paddingRight:i}=t.ownerDocument.defaultView.getComputedStyle(t);return parseFloat(e)-(parseFloat(n)||0)-(parseFloat(i)||0)},n=t.parentElement;if(!n)return 0;let i=e(n);let o=0,r=n;for(;isNaN(i);){if(r=r.parentElement,++o>5)return 0;i=e(r)}return i}const YC="widget-type-around";function QC(t,e,n){return!!t&&HC(t)&&!n.isInline(e)}function XC(t){return t.getAttribute(YC)}var tv=n(8508),ev={injectType:"singletonStyleTag",attributes:{"data-cke":!0},insert:"head",singleton:!0};gr()(tv.A,ev);tv.A.locals;const nv=["before","after"],iv=(new DOMParser).parseFromString('',"image/svg+xml").firstChild,ov="ck-widget__type-around_disabled";class rv extends er{constructor(){super(...arguments),this._currentFakeCaretModelElement=null}static get pluginName(){return"WidgetTypeAround"}static get requires(){return[IA,v_]}init(){const t=this.editor,e=t.editing.view;this.on("change:isEnabled",((n,i,o)=>{e.change((t=>{for(const n of e.document.roots)o?t.removeClass(ov,n):t.addClass(ov,n)})),o||t.model.change((t=>{t.removeSelectionAttribute(YC)}))})),this._enableTypeAroundUIInjection(),this._enableInsertingParagraphsOnButtonClick(),this._enableInsertingParagraphsOnEnterKeypress(),this._enableInsertingParagraphsOnTypingKeystroke(),this._enableTypeAroundFakeCaretActivationUsingKeyboardArrows(),this._enableDeleteIntegration(),this._enableInsertContentIntegration(),this._enableInsertObjectIntegration(),this._enableDeleteContentIntegration()}destroy(){super.destroy(),this._currentFakeCaretModelElement=null}_insertParagraph(t,e){const n=this.editor,i=n.editing.view,o=n.model.schema.getAttributesWithProperty(t,"copyOnReplace",!0);n.execute("insertParagraph",{position:n.model.createPositionAt(t,e),attributes:o}),i.focus(),i.scrollToTheSelection()}_listenToIfEnabled(t,e,n,i){this.listenTo(t,e,((...t)=>{this.isEnabled&&n(...t)}),i)}_insertParagraphAccordingToFakeCaretPosition(){const t=this.editor.model.document.selection,e=XC(t);if(!e)return!1;const n=t.getSelectedElement();return this._insertParagraph(n,e),!0}_enableTypeAroundUIInjection(){const t=this.editor,e=t.model.schema,n=t.locale.t,i={before:n("Insert paragraph before block"),after:n("Insert paragraph after block")};t.editing.downcastDispatcher.on("insert",((t,o,r)=>{const s=r.mapper.toViewElement(o.item);if(s&&QC(s,o.item,e)){!function(t,e,n){const i=t.createUIElement("div",{class:"ck ck-reset_all ck-widget__type-around"},(function(t){const n=this.toDomElement(t);return function(t,e){for(const n of nv){const i=new Em({tag:"div",attributes:{class:["ck","ck-widget__type-around__button",`ck-widget__type-around__button_${n}`],title:e[n],"aria-hidden":"true"},children:[t.ownerDocument.importNode(iv,!0)]});t.appendChild(i.render())}}(n,e),function(t){const e=new Em({tag:"div",attributes:{class:["ck","ck-widget__type-around__fake-caret"]}});t.appendChild(e.render())}(n),n}));t.insert(t.createPositionAt(n,"end"),i)}(r.writer,i,s);s.getCustomProperty("widgetLabel").push((()=>this.isEnabled?n("Press Enter to type after or press Shift + Enter to type before the widget"):""))}}),{priority:"low"})}_enableTypeAroundFakeCaretActivationUsingKeyboardArrows(){const t=this.editor,e=t.model,n=e.document.selection,i=e.schema,o=t.editing.view;function r(t){return`ck-widget_type-around_show-fake-caret_${t}`}this._listenToIfEnabled(o.document,"arrowKey",((t,e)=>{this._handleArrowKeyPress(t,e)}),{context:[HC,"$text"],priority:"high"}),this._listenToIfEnabled(n,"change:range",((e,n)=>{n.directChange&&t.model.change((t=>{t.removeSelectionAttribute(YC)}))})),this._listenToIfEnabled(e.document,"change:data",(()=>{const e=n.getSelectedElement();if(e){if(QC(t.editing.mapper.toViewElement(e),e,i))return}t.model.change((t=>{t.removeSelectionAttribute(YC)}))})),this._listenToIfEnabled(t.editing.downcastDispatcher,"selection",((t,e,n)=>{const o=n.writer;if(this._currentFakeCaretModelElement){const t=n.mapper.toViewElement(this._currentFakeCaretModelElement);t&&(o.removeClass(nv.map(r),t),this._currentFakeCaretModelElement=null)}const s=e.selection.getSelectedElement();if(!s)return;const a=n.mapper.toViewElement(s);if(!QC(a,s,i))return;const c=XC(e.selection);c&&(o.addClass(r(c),a),this._currentFakeCaretModelElement=s)})),this._listenToIfEnabled(t.ui.focusTracker,"change:isFocused",((e,n,i)=>{i||t.model.change((t=>{t.removeSelectionAttribute(YC)}))}))}_handleArrowKeyPress(t,e){const n=this.editor,i=n.model,o=i.document.selection,r=i.schema,s=n.editing.view,a=function(t,e){const n=wo(t,e);return"down"===n||"right"===n}(e.keyCode,n.locale.contentLanguageDirection),c=s.document.selection.getSelectedElement();let l;QC(c,n.editing.mapper.toModelElement(c),r)?l=this._handleArrowKeyPressOnSelectedWidget(a):o.isCollapsed?l=this._handleArrowKeyPressWhenSelectionNextToAWidget(a):e.shiftKey||(l=this._handleArrowKeyPressWhenNonCollapsedSelection(a)),l&&(e.preventDefault(),t.stop())}_handleArrowKeyPressOnSelectedWidget(t){const e=this.editor.model,n=XC(e.document.selection);return e.change((e=>{if(!n)return e.setSelectionAttribute(YC,t?"after":"before"),!0;if(!(n===(t?"after":"before")))return e.removeSelectionAttribute(YC),!0;return!1}))}_handleArrowKeyPressWhenSelectionNextToAWidget(t){const e=this.editor,n=e.model,i=n.schema,o=e.plugins.get("Widget"),r=o._getObjectElementNextToSelection(t);return!!QC(e.editing.mapper.toViewElement(r),r,i)&&(n.change((e=>{o._setSelectionOverElement(r),e.setSelectionAttribute(YC,t?"before":"after")})),!0)}_handleArrowKeyPressWhenNonCollapsedSelection(t){const e=this.editor,n=e.model,i=n.schema,o=e.editing.mapper,r=n.document.selection,s=t?r.getLastPosition().nodeBefore:r.getFirstPosition().nodeAfter;return!!QC(o.toViewElement(s),s,i)&&(n.change((e=>{e.setSelection(s,"on"),e.setSelectionAttribute(YC,t?"after":"before")})),!0)}_enableInsertingParagraphsOnButtonClick(){const t=this.editor,e=t.editing.view;this._listenToIfEnabled(e.document,"mousedown",((n,i)=>{const o=i.domTarget.closest(".ck-widget__type-around__button");if(!o)return;const r=function(t){return t.classList.contains("ck-widget__type-around__button_before")?"before":"after"}(o),s=function(t,e){const n=t.closest(".ck-widget");return e.mapDomToView(n)}(o,e.domConverter),a=t.editing.mapper.toModelElement(s);this._insertParagraph(a,r),i.preventDefault(),n.stop()}))}_enableInsertingParagraphsOnEnterKeypress(){const t=this.editor,e=t.model.document.selection,n=t.editing.view;this._listenToIfEnabled(n.document,"enter",((n,i)=>{if("atTarget"!=n.eventPhase)return;const o=e.getSelectedElement(),r=t.editing.mapper.toViewElement(o),s=t.model.schema;let a;this._insertParagraphAccordingToFakeCaretPosition()?a=!0:QC(r,o,s)&&(this._insertParagraph(o,i.isSoft?"before":"after"),a=!0),a&&(i.preventDefault(),n.stop())}),{context:HC})}_enableInsertingParagraphsOnTypingKeystroke(){const t=this.editor.editing.view.document;this._listenToIfEnabled(t,"insertText",((e,n)=>{this._insertParagraphAccordingToFakeCaretPosition()&&(n.selection=t.selection)}),{priority:"high"}),s.isAndroid?this._listenToIfEnabled(t,"keydown",((t,e)=>{229==e.keyCode&&this._insertParagraphAccordingToFakeCaretPosition()})):this._listenToIfEnabled(t,"compositionstart",(()=>{this._insertParagraphAccordingToFakeCaretPosition()}),{priority:"high"})}_enableDeleteIntegration(){const t=this.editor,e=t.editing.view,n=t.model,i=n.schema;this._listenToIfEnabled(e.document,"delete",((e,o)=>{if("atTarget"!=e.eventPhase)return;const r=XC(n.document.selection);if(!r)return;const s=o.direction,a=n.document.selection.getSelectedElement(),c="forward"==s;if("before"===r===c)t.execute("delete",{selection:n.createSelection(a,"on")});else{const e=i.getNearestSelectionRange(n.createPositionAt(a,r),s);if(e)if(e.isCollapsed){const o=n.createSelection(e.start);if(n.modifySelection(o,{direction:s}),o.focus.isEqual(e.start)){const t=function(t,e){let n=e;for(const i of e.getAncestors({parentFirst:!0})){if(i.childCount>1||t.isLimit(i))break;n=i}return n}(i,e.start.parent);n.deleteContent(n.createSelection(t,"on"),{doNotAutoparagraph:!0})}else n.change((n=>{n.setSelection(e),t.execute(c?"deleteForward":"delete")}))}else n.change((n=>{n.setSelection(e),t.execute(c?"deleteForward":"delete")}))}o.preventDefault(),e.stop()}),{context:HC})}_enableInsertContentIntegration(){const t=this.editor,e=this.editor.model,n=e.document.selection;this._listenToIfEnabled(t.model,"insertContent",((t,[i,o])=>{if(o&&!o.is("documentSelection"))return;const r=XC(n);return r?(t.stop(),e.change((t=>{const o=n.getSelectedElement(),s=e.createPositionAt(o,r),a=t.createSelection(s),c=e.insertContent(i,a);return t.setSelection(a),c}))):void 0}),{priority:"high"})}_enableInsertObjectIntegration(){const t=this.editor,e=this.editor.model.document.selection;this._listenToIfEnabled(t.model,"insertObject",((t,n)=>{const[,i,o={}]=n;if(i&&!i.is("documentSelection"))return;const r=XC(e);r&&(o.findOptimalPosition=r,n[3]=o)}),{priority:"high"})}_enableDeleteContentIntegration(){const t=this.editor,e=this.editor.model.document.selection;this._listenToIfEnabled(t.model,"deleteContent",((t,[n])=>{if(n&&!n.is("documentSelection"))return;XC(e)&&t.stop()}),{priority:"high"})}}function sv(t){const e=t.model;return(n,i)=>{const o=i.keyCode==go.arrowup,r=i.keyCode==go.arrowdown,s=i.shiftKey,a=e.document.selection;if(!o&&!r)return;const c=r;if(s&&function(t,e){return!t.isCollapsed&&t.isBackward==e}(a,c))return;const l=function(t,e,n){const i=t.model;if(n){const t=e.isCollapsed?e.focus:e.getLastPosition(),n=av(i,t,"forward");if(!n)return null;const o=i.createRange(t,n),r=cv(i.schema,o,"backward");return r?i.createRange(t,r):null}{const t=e.isCollapsed?e.focus:e.getFirstPosition(),n=av(i,t,"backward");if(!n)return null;const o=i.createRange(n,t),r=cv(i.schema,o,"forward");return r?i.createRange(r,t):null}}(t,a,c);if(l){if(l.isCollapsed){if(a.isCollapsed)return;if(s)return}(l.isCollapsed||function(t,e,n){const i=t.model,o=t.view.domConverter;if(n){const t=i.createSelection(e.start);i.modifySelection(t),t.focus.isAtEnd||e.start.isEqual(t.focus)||(e=i.createRange(t.focus,e.end))}const r=t.mapper.toViewRange(e),s=o.viewRangeToDom(r),a=Li.getDomRangeRects(s);let c;for(const t of a)if(void 0!==c){if(Math.round(t.top)>=c)return!1;c=Math.max(c,Math.round(t.bottom))}else c=Math.round(t.bottom);return!0}(t,l,c))&&(e.change((t=>{const n=c?l.end:l.start;if(s){const i=e.createSelection(a.anchor);i.setFocus(n),t.setSelection(i)}else t.setSelection(n)})),n.stop(),i.preventDefault(),i.stopPropagation())}}}function av(t,e,n){const i=t.schema,o=t.createRangeIn(e.root),r="forward"==n?"elementStart":"elementEnd";for(const{previousPosition:t,item:s,type:a}of o.getWalker({startPosition:e,direction:n})){if(i.isLimit(s)&&!i.isInline(s))return t;if(a==r&&i.isBlock(s))return null}return null}function cv(t,e,n){const i="backward"==n?e.end:e.start;if(t.checkChild(i,"$text"))return i;for(const{nextPosition:i}of e.getWalker({direction:n}))if(t.checkChild(i,"$text"))return i;return null}var lv=n(695),dv={injectType:"singletonStyleTag",attributes:{"data-cke":!0},insert:"head",singleton:!0};gr()(lv.A,dv);lv.A.locals;class hv extends er{constructor(){super(...arguments),this._previouslySelected=new Set}static get pluginName(){return"Widget"}static get requires(){return[rv,v_]}init(){const t=this.editor,e=t.editing.view,n=e.document,i=t.t;this.editor.editing.downcastDispatcher.on("selection",((e,n,i)=>{const o=i.writer,r=n.selection;if(r.isCollapsed)return;const s=r.getSelectedElement();if(!s)return;const a=t.editing.mapper.toViewElement(s);var c;HC(a)&&(i.consumable.consume(r,"selection")&&o.setSelection(o.createRangeOn(a),{fake:!0,label:(c=a,c.getCustomProperty("widgetLabel").reduce(((t,e)=>"function"==typeof e?t?t+". "+e():e():t?t+". "+e:e),""))}))})),this.editor.editing.downcastDispatcher.on("selection",((t,e,n)=>{this._clearPreviouslySelectedWidgets(n.writer);const i=n.writer,o=i.document.selection;let r=null;for(const t of o.getRanges())for(const e of t){const t=e.item;HC(t)&&!uv(t,r)&&(i.addClass(NC,t),this._previouslySelected.add(t),r=t)}}),{priority:"low"}),e.addObserver(_u),this.listenTo(n,"mousedown",((...t)=>this._onMousedown(...t))),this.listenTo(n,"arrowKey",((...t)=>{this._handleSelectionChangeOnArrowKeyPress(...t)}),{context:[HC,"$text"]}),this.listenTo(n,"arrowKey",((...t)=>{this._preventDefaultOnArrowKeyPress(...t)}),{context:"$root"}),this.listenTo(n,"arrowKey",sv(this.editor.editing),{context:"$text"}),this.listenTo(n,"delete",((t,e)=>{this._handleDelete("forward"==e.direction)&&(e.preventDefault(),t.stop())}),{context:"$root"}),this.listenTo(n,"tab",((t,e)=>{"atTarget"==t.eventPhase&&(e.shiftKey||this._selectFirstNestedEditable()&&(e.preventDefault(),t.stop()))}),{context:HC,priority:"low"}),this.listenTo(n,"tab",((t,e)=>{e.shiftKey&&this._selectAncestorWidget()&&(e.preventDefault(),t.stop())}),{priority:"low"}),this.listenTo(n,"keydown",((t,e)=>{e.keystroke==go.esc&&this._selectAncestorWidget()&&(e.preventDefault(),t.stop())}),{priority:"low"}),t.accessibility.addKeystrokeInfoGroup({id:"widget",label:i("Keystrokes that can be used when a widget is selected (for example: image, table, etc.)"),keystrokes:[{label:i("Insert a new paragraph directly after a widget"),keystroke:"Enter"},{label:i("Insert a new paragraph directly before a widget"),keystroke:"Shift+Enter"},{label:i("Move the caret to allow typing directly before a widget"),keystroke:[["arrowup"],["arrowleft"]]},{label:i("Move the caret to allow typing directly after a widget"),keystroke:[["arrowdown"],["arrowright"]]}]})}_onMousedown(t,e){const n=this.editor,i=n.editing.view,o=i.document;let r=e.target;if(e.domEvent.detail>=3)return void(this._selectBlockContent(r)&&e.preventDefault());if(function(t){let e=t;for(;e;){if(e.is("editableElement")&&!e.is("rootElement"))return!0;if(HC(e))return!1;e=e.parent}return!1}(r))return;if(!HC(r)&&(r=r.findAncestor(HC),!r))return;s.isAndroid&&e.preventDefault(),o.isFocused||i.focus();const a=n.editing.mapper.toModelElement(r);this._setSelectionOverElement(a)}_selectBlockContent(t){const e=this.editor,n=e.model,i=e.editing.mapper,o=n.schema,r=i.findMappedViewAncestor(this.editor.editing.view.createPositionAt(t,0)),s=function(t,e){for(const n of t.getAncestors({includeSelf:!0,parentFirst:!0})){if(e.checkChild(n,"$text"))return n;if(e.isLimit(n)&&!e.isObject(n))break}return null}(i.toModelElement(r),n.schema);return!!s&&(n.change((t=>{const e=o.isLimit(s)?null:function(t,e){const n=new Ic({startPosition:t});for(const{item:t}of n){if(e.isLimit(t)||!t.is("element"))return null;if(e.checkChild(t,"$text"))return t}return null}(t.createPositionAfter(s),o),n=t.createPositionAt(s,0),i=e?t.createPositionAt(e,0):t.createPositionAt(s,"end");t.setSelection(t.createRange(n,i))})),!0)}_handleSelectionChangeOnArrowKeyPress(t,e){const n=e.keyCode,i=this.editor.model,o=i.schema,r=i.document.selection,s=r.getSelectedElement(),a=wo(n,this.editor.locale.contentLanguageDirection),c="down"==a||"right"==a,l="up"==a||"down"==a;if(s&&o.isObject(s)){const n=c?r.getLastPosition():r.getFirstPosition(),s=o.getNearestSelectionRange(n,c?"forward":"backward");return void(s&&(i.change((t=>{t.setSelection(s)})),e.preventDefault(),t.stop()))}if(!r.isCollapsed&&!e.shiftKey){const n=r.getFirstPosition(),s=r.getLastPosition(),a=n.nodeAfter,l=s.nodeBefore;return void((a&&o.isObject(a)||l&&o.isObject(l))&&(i.change((t=>{t.setSelection(c?s:n)})),e.preventDefault(),t.stop()))}if(!r.isCollapsed)return;const d=this._getObjectElementNextToSelection(c);if(d&&o.isObject(d)){if(o.isInline(d)&&l)return;this._setSelectionOverElement(d),e.preventDefault(),t.stop()}}_preventDefaultOnArrowKeyPress(t,e){const n=this.editor.model,i=n.schema,o=n.document.selection.getSelectedElement();o&&i.isObject(o)&&(e.preventDefault(),t.stop())}_handleDelete(t){const e=this.editor.model.document.selection;if(!this.editor.model.canEditAt(e))return;if(!e.isCollapsed)return;const n=this._getObjectElementNextToSelection(t);return n?(this.editor.model.change((t=>{let i=e.anchor.parent;for(;i.isEmpty;){const e=i;i=e.parent,t.remove(e)}this._setSelectionOverElement(n)})),!0):void 0}_setSelectionOverElement(t){this.editor.model.change((e=>{e.setSelection(e.createRangeOn(t))}))}_getObjectElementNextToSelection(t){const e=this.editor.model,n=e.schema,i=e.document.selection,o=e.createSelection(i);if(e.modifySelection(o,{direction:t?"forward":"backward"}),o.isEqual(i))return null;const r=t?o.focus.nodeBefore:o.focus.nodeAfter;return r&&n.isObject(r)?r:null}_clearPreviouslySelectedWidgets(t){for(const e of this._previouslySelected)t.removeClass(NC,e);this._previouslySelected.clear()}_selectFirstNestedEditable(){const t=this.editor,e=this.editor.editing.view.document;for(const n of e.selection.getFirstRange().getItems())if(n.is("editableElement")){const e=t.editing.mapper.toModelElement(n);if(!e)continue;const i=t.model.createPositionAt(e,0),o=t.model.schema.getNearestSelectionRange(i,"forward");return t.model.change((t=>{t.setSelection(o)})),!0}return!1}_selectAncestorWidget(){const t=this.editor,e=t.editing.mapper,n=t.editing.view.document.selection.getFirstPosition().parent,i=(n.is("$text")?n.parent:n).findAncestor(HC);if(!i)return!1;const o=e.toModelElement(i);return!!o&&(t.model.change((t=>{t.setSelection(o,"on")})),!0)}}function uv(t,e){return!!e&&Array.from(t.getAncestors()).includes(e)}class mv extends er{constructor(){super(...arguments),this._toolbarDefinitions=new Map}static get requires(){return[mk]}static get pluginName(){return"WidgetToolbarRepository"}init(){const t=this.editor;if(t.plugins.has("BalloonToolbar")){const e=t.plugins.get("BalloonToolbar");this.listenTo(e,"show",(e=>{(function(t){const e=t.getSelectedElement();return!(!e||!HC(e))})(t.editing.view.document.selection)&&e.stop()}),{priority:"high"})}this._balloon=this.editor.plugins.get("ContextualBalloon"),this.on("change:isEnabled",(()=>{this._updateToolbarsVisibility()})),this.listenTo(t.ui,"update",(()=>{this._updateToolbarsVisibility()})),this.listenTo(t.ui.focusTracker,"change:isFocused",(()=>{this._updateToolbarsVisibility()}),{priority:"low"})}destroy(){super.destroy();for(const t of this._toolbarDefinitions.values())t.view.destroy()}register(t,{ariaLabel:e,items:n,getRelatedElement:i,balloonClassName:o="ck-toolbar-container"}){if(!n.length)return void _("widget-toolbar-no-items",{toolbarId:t});const r=this.editor,s=r.t,a=new gp(r.locale);if(a.ariaLabel=e||s("Widget toolbar"),this._toolbarDefinitions.has(t))throw new w("widget-toolbar-duplicated",this,{toolbarId:t});const c={view:a,getRelatedElement:i,balloonClassName:o,itemsConfig:n,initialized:!1};r.ui.addToolbar(a,{isContextual:!0,beforeFocus:()=>{const t=i(r.editing.view.document.selection);t&&this._showToolbar(c,t)},afterBlur:()=>{this._hideToolbar(c)}}),this._toolbarDefinitions.set(t,c)}_updateToolbarsVisibility(){let t=0,e=null,n=null;for(const i of this._toolbarDefinitions.values()){const o=i.getRelatedElement(this.editor.editing.view.document.selection);if(this.isEnabled&&o)if(this.editor.ui.focusTracker.isFocused){const r=o.getAncestors().length;r>t&&(t=r,e=o,n=i)}else this._isToolbarVisible(i)&&this._hideToolbar(i);else this._isToolbarInBalloon(i)&&this._hideToolbar(i)}n&&this._showToolbar(n,e)}_hideToolbar(t){this._balloon.remove(t.view),this.stopListening(this._balloon,"change:visibleView")}_showToolbar(t,e){this._isToolbarVisible(t)?gv(this.editor,e):this._isToolbarInBalloon(t)||(t.initialized||(t.initialized=!0,t.view.fillFromConfig(t.itemsConfig,this.editor.ui.componentFactory)),this._balloon.add({view:t.view,position:pv(this.editor,e),balloonClassName:t.balloonClassName}),this.listenTo(this._balloon,"change:visibleView",(()=>{for(const t of this._toolbarDefinitions.values())if(this._isToolbarVisible(t)){const e=t.getRelatedElement(this.editor.editing.view.document.selection);gv(this.editor,e)}})))}_isToolbarVisible(t){return this._balloon.visibleView===t.view}_isToolbarInBalloon(t){return this._balloon.hasView(t.view)}}function gv(t,e){const n=t.plugins.get("ContextualBalloon"),i=pv(t,e);n.updatePosition(i)}function pv(t,e){const n=t.editing.view,i=kb.defaultPositions;return{target:n.domConverter.mapViewToDom(e),positions:[i.northArrowSouth,i.northArrowSouthWest,i.northArrowSouthEast,i.southArrowNorth,i.southArrowNorthWest,i.southArrowNorthEast,i.viewportStickyNorth]}}class fv extends(W()){constructor(t){super(),this.set("activeHandlePosition",null),this.set("proposedWidthPercents",null),this.set("proposedWidth",null),this.set("proposedHeight",null),this.set("proposedHandleHostWidth",null),this.set("proposedHandleHostHeight",null),this._options=t,this._referenceCoordinates=null}get originalWidth(){return this._originalWidth}get originalHeight(){return this._originalHeight}get originalWidthPercents(){return this._originalWidthPercents}get aspectRatio(){return this._aspectRatio}begin(t,e,n){const i=new Li(e);this.activeHandlePosition=function(t){const e=["top-left","top-right","bottom-right","bottom-left"];for(const n of e)if(t.classList.contains(bv(n)))return n}(t),this._referenceCoordinates=function(t,e){const n=new Li(t),i=e.split("-"),o={x:"right"==i[1]?n.right:n.left,y:"bottom"==i[0]?n.bottom:n.top};return o.x+=t.ownerDocument.defaultView.scrollX,o.y+=t.ownerDocument.defaultView.scrollY,o}(e,function(t){const e=t.split("-"),n={top:"bottom",bottom:"top",left:"right",right:"left"};return`${n[e[0]]}-${n[e[1]]}`}(this.activeHandlePosition)),this._originalWidth=i.width,this._originalHeight=i.height,this._aspectRatio=i.width/i.height;const o=n.style.width;o&&o.match(/^\d+(\.\d*)?%$/)?this._originalWidthPercents=parseFloat(o):this._originalWidthPercents=function(t,e=new Li(t)){const n=ZC(t);return n?e.width/n*100:0}(n,i)}update(t){this.proposedWidth=t.width,this.proposedHeight=t.height,this.proposedWidthPercents=t.widthPercents,this.proposedHandleHostWidth=t.handleHostWidth,this.proposedHandleHostHeight=t.handleHostHeight}}function bv(t){return`ck-widget__resizer__handle-${t}`}class kv extends Jm{constructor(){super();const t=this.bindTemplate;this.setTemplate({tag:"div",attributes:{class:["ck","ck-size-view",t.to("_viewPosition",(t=>t?`ck-orientation-${t}`:""))],style:{display:t.if("_isVisible","none",(t=>!t))}},children:[{text:t.to("_label")}]})}_bindToState(t,e){this.bind("_isVisible").to(e,"proposedWidth",e,"proposedHeight",((t,e)=>null!==t&&null!==e)),this.bind("_label").to(e,"proposedHandleHostWidth",e,"proposedHandleHostHeight",e,"proposedWidthPercents",((e,n,i)=>"px"===t.unit?`${e}×${n}`:`${i}%`)),this.bind("_viewPosition").to(e,"activeHandlePosition",e,"proposedHandleHostWidth",e,"proposedHandleHostHeight",((t,e,n)=>e<50||n<50?"above-center":t))}_dismiss(){this.unbind(),this._isVisible=!1}}var wv=Object.defineProperty,_v=Object.defineProperties,Av=Object.getOwnPropertyDescriptors,Cv=Object.getOwnPropertySymbols,vv=Object.prototype.hasOwnProperty,yv=Object.prototype.propertyIsEnumerable,xv=(t,e,n)=>e in t?wv(t,e,{enumerable:!0,configurable:!0,writable:!0,value:n}):t[e]=n;class Ev extends(W()){constructor(t){super(),this._viewResizerWrapper=null,this._options=t,this.set("isEnabled",!0),this.set("isSelected",!1),this.bind("isVisible").to(this,"isEnabled",this,"isSelected",((t,e)=>t&&e)),this.decorate("begin"),this.decorate("cancel"),this.decorate("commit"),this.decorate("updateSize"),this.on("commit",(t=>{this.state.proposedWidth||this.state.proposedWidthPercents||(this._cleanup(),t.stop())}),{priority:"high"})}get state(){return this._state}show(){this._options.editor.editing.view.change((t=>{t.removeClass("ck-hidden",this._viewResizerWrapper)}))}hide(){this._options.editor.editing.view.change((t=>{t.addClass("ck-hidden",this._viewResizerWrapper)}))}attach(){const t=this,e=this._options.viewElement;this._options.editor.editing.view.change((n=>{const i=n.createUIElement("div",{class:"ck ck-reset_all ck-widget__resizer"},(function(e){const n=this.toDomElement(e);return t._appendHandles(n),t._appendSizeUI(n),n}));n.insert(n.createPositionAt(e,"end"),i),n.addClass("ck-widget_with-resizer",e),this._viewResizerWrapper=i,this.isVisible||this.hide()})),this.on("change:isVisible",(()=>{this.isVisible?(this.show(),this.redraw()):this.hide()}))}begin(t){this._state=new fv(this._options),this._sizeView._bindToState(this._options,this.state),this._initialViewWidth=this._options.viewElement.getStyle("width"),this.state.begin(t,this._getHandleHost(),this._getResizeHost())}updateSize(t){const e=this._proposeNewSize(t);this._options.editor.editing.view.change((t=>{const n=this._options.unit||"%",i=("%"===n?e.widthPercents:e.width)+n;t.setStyle("width",i,this._options.viewElement)}));const n=this._getHandleHost(),i=new Li(n),o=Math.round(i.width),r=Math.round(i.height),s=new Li(n);var a;e.width=Math.round(s.width),e.height=Math.round(s.height),this.redraw(i),this.state.update((a=((t,e)=>{for(var n in e||(e={}))vv.call(e,n)&&xv(t,n,e[n]);if(Cv)for(var n of Cv(e))yv.call(e,n)&&xv(t,n,e[n]);return t})({},e),_v(a,Av({handleHostWidth:o,handleHostHeight:r}))))}commit(){const t=this._options.unit||"%",e=("%"===t?this.state.proposedWidthPercents:this.state.proposedWidth)+t;this._options.editor.editing.view.change((()=>{this._cleanup(),this._options.onCommit(e)}))}cancel(){this._cleanup()}destroy(){this.cancel()}redraw(t){const e=this._domResizerWrapper;if(!((n=e)&&n.ownerDocument&&n.ownerDocument.contains(n)))return;var n;const i=e.parentElement,o=this._getHandleHost(),r=this._viewResizerWrapper,s=[r.getStyle("width"),r.getStyle("height"),r.getStyle("left"),r.getStyle("top")];let a;if(i.isSameNode(o)){const e=t||new Li(o);a=[e.width+"px",e.height+"px",void 0,void 0]}else a=[o.offsetWidth+"px",o.offsetHeight+"px",o.offsetLeft+"px",o.offsetTop+"px"];"same"!==Q(s,a)&&this._options.editor.editing.view.change((t=>{t.setStyle({width:a[0],height:a[1],left:a[2],top:a[3]},r)}))}containsHandle(t){return this._domResizerWrapper.contains(t)}static isResizeHandle(t){return t.classList.contains("ck-widget__resizer__handle")}_cleanup(){this._sizeView._dismiss();this._options.editor.editing.view.change((t=>{t.setStyle("width",this._initialViewWidth,this._options.viewElement)}))}_proposeNewSize(t){const e=this.state,n={x:(i=t).pageX,y:i.pageY};var i;const o=!this._options.isCentered||this._options.isCentered(this),r={x:e._referenceCoordinates.x-(n.x+e.originalWidth),y:n.y-e.originalHeight-e._referenceCoordinates.y};o&&e.activeHandlePosition.endsWith("-right")&&(r.x=n.x-(e._referenceCoordinates.x+e.originalWidth)),o&&(r.x*=2);let s=Math.abs(e.originalWidth+r.x),a=Math.abs(e.originalHeight+r.y);return"width"==(s/e.aspectRatio>a?"width":"height")?a=s/e.aspectRatio:s=a*e.aspectRatio,{width:Math.round(s),height:Math.round(a),widthPercents:Math.min(Math.round(e.originalWidthPercents/e.originalWidth*s*100)/100,100)}}_getResizeHost(){const t=this._domResizerWrapper.parentElement;return this._options.getResizeHost(t)}_getHandleHost(){const t=this._domResizerWrapper.parentElement;return this._options.getHandleHost(t)}get _domResizerWrapper(){return this._options.editor.editing.view.domConverter.mapViewToDom(this._viewResizerWrapper)}_appendHandles(t){const e=["top-left","top-right","bottom-right","bottom-left"];for(const i of e)t.appendChild(new Em({tag:"div",attributes:{class:"ck-widget__resizer__handle "+(n=i,`ck-widget__resizer__handle-${n}`)}}).render());var n}_appendSizeUI(t){this._sizeView=new kv,this._sizeView.render(),t.appendChild(this._sizeView.element)}}var Dv=n(4095),Bv={injectType:"singletonStyleTag",attributes:{"data-cke":!0},insert:"head",singleton:!0};gr()(Dv.A,Bv);Dv.A.locals;class Sv extends er{constructor(){super(...arguments),this._resizers=new Map}static get pluginName(){return"WidgetResize"}init(){const t=this.editor.editing,n=e.window.document;this.set("selectedResizer",null),this.set("_activeResizer",null),t.view.addObserver(_u),this._observer=new(Bi()),this.listenTo(t.view.document,"mousedown",this._mouseDownListener.bind(this),{priority:"high"}),this._observer.listenTo(n,"mousemove",this._mouseMoveListener.bind(this)),this._observer.listenTo(n,"mouseup",this._mouseUpListener.bind(this)),this._redrawSelectedResizerThrottled=Bb((()=>this.redrawSelectedResizer()),200),this.editor.ui.on("update",this._redrawSelectedResizerThrottled),this.editor.model.document.on("change",(()=>{for(const[t,e]of this._resizers)t.isAttached()||(this._resizers.delete(t),e.destroy())}),{priority:"lowest"}),this._observer.listenTo(e.window,"resize",this._redrawSelectedResizerThrottled);const i=this.editor.editing.view.document.selection;i.on("change",(()=>{const t=i.getSelectedElement(),e=this.getResizerByViewElement(t)||null;e?this.select(e):this.deselect()}))}redrawSelectedResizer(){this.selectedResizer&&this.selectedResizer.isVisible&&this.selectedResizer.redraw()}destroy(){super.destroy(),this._observer.stopListening();for(const t of this._resizers.values())t.destroy();this._redrawSelectedResizerThrottled.cancel()}select(t){this.deselect(),this.selectedResizer=t,this.selectedResizer.isSelected=!0}deselect(){this.selectedResizer&&(this.selectedResizer.isSelected=!1),this.selectedResizer=null}attachTo(t){const e=new Ev(t),n=this.editor.plugins;if(e.attach(),n.has("WidgetToolbarRepository")){const t=n.get("WidgetToolbarRepository");e.on("begin",(()=>{t.forceDisabled("resize")}),{priority:"lowest"}),e.on("cancel",(()=>{t.clearForceDisabled("resize")}),{priority:"highest"}),e.on("commit",(()=>{t.clearForceDisabled("resize")}),{priority:"highest"})}this._resizers.set(t.viewElement,e);const i=this.editor.editing.view.document.selection.getSelectedElement();return this.getResizerByViewElement(i)==e&&this.select(e),e}getResizerByViewElement(t){return this._resizers.get(t)}_getResizerByHandle(t){for(const e of this._resizers.values())if(e.containsHandle(t))return e}_mouseDownListener(t,e){const n=e.domTarget;Ev.isResizeHandle(n)&&(this._activeResizer=this._getResizerByHandle(n)||null,this._activeResizer&&(this._activeResizer.begin(n),t.stop(),e.preventDefault()))}_mouseMoveListener(t,e){this._activeResizer&&this._activeResizer.updateSize(e)}_mouseUpListener(){this._activeResizer&&(this._activeResizer.commit(),this._activeResizer=null)}}const Tv=Wi("px");class Iv extends Jm{constructor(){super();const t=this.bindTemplate;this.set({isVisible:!1,left:null,top:null,width:null}),this.setTemplate({tag:"div",attributes:{class:["ck","ck-clipboard-drop-target-line",t.if("isVisible","ck-hidden",(t=>!t))],style:{left:t.to("left",(t=>Tv(t))),top:t.to("top",(t=>Tv(t))),width:t.to("width",(t=>Tv(t)))}}})}}class Pv extends er{constructor(){super(...arguments),this.removeDropMarkerDelayed=Zo((()=>this.removeDropMarker()),40),this._updateDropMarkerThrottled=Bb((t=>this._updateDropMarker(t)),40),this._reconvertMarkerThrottled=Bb((()=>{this.editor.model.markers.has("drop-target")&&this.editor.editing.reconvertMarker("drop-target")}),0),this._dropTargetLineView=new Iv,this._domEmitter=new(Bi()),this._scrollables=new Map}static get pluginName(){return"DragDropTarget"}init(){this._setupDropMarker()}destroy(){this._domEmitter.stopListening();for(const{resizeObserver:t}of this._scrollables.values())t.destroy();return this._updateDropMarkerThrottled.cancel(),this.removeDropMarkerDelayed.cancel(),this._reconvertMarkerThrottled.cancel(),super.destroy()}updateDropMarker(t,e,n,i,o,r){this.removeDropMarkerDelayed.cancel();const s=Rv(this.editor,t,e,n,i,o,r);if(s)return r&&r.containsRange(s)?this.removeDropMarker():void this._updateDropMarkerThrottled(s)}getFinalDropRange(t,e,n,i,o,r){const s=Rv(this.editor,t,e,n,i,o,r);return this.removeDropMarker(),s}removeDropMarker(){const t=this.editor.model;this.removeDropMarkerDelayed.cancel(),this._updateDropMarkerThrottled.cancel(),this._dropTargetLineView.isVisible=!1,t.markers.has("drop-target")&&t.change((t=>{t.removeMarker("drop-target")}))}_setupDropMarker(){const t=this.editor;t.ui.view.body.add(this._dropTargetLineView),t.conversion.for("editingDowncast").markerToHighlight({model:"drop-target",view:{classes:["ck-clipboard-drop-target-range"]}}),t.conversion.for("editingDowncast").markerToElement({model:"drop-target",view:(e,{writer:n})=>{if(t.model.schema.checkChild(e.markerRange.start,"$text"))return this._dropTargetLineView.isVisible=!1,this._createDropTargetPosition(n);e.markerRange.isCollapsed?this._updateDropTargetLine(e.markerRange):this._dropTargetLineView.isVisible=!1}})}_updateDropMarker(t){const e=this.editor,n=e.model.markers;e.model.change((e=>{n.has("drop-target")?n.get("drop-target").getRange().isEqual(t)||e.updateMarker("drop-target",{range:t}):e.addMarker("drop-target",{range:t,usingOperation:!1,affectsData:!1})}))}_createDropTargetPosition(t){return t.createUIElement("span",{class:"ck ck-clipboard-drop-target-position"},(function(t){const e=this.toDomElement(t);return e.append("",t.createElement("span"),""),e}))}_updateDropTargetLine(t){const n=this.editor.editing,i=t.start.nodeBefore,o=t.start.nodeAfter,r=t.start.parent,s=i?n.mapper.toViewElement(i):null,a=s?n.view.domConverter.mapViewToDom(s):null,c=o?n.mapper.toViewElement(o):null,l=c?n.view.domConverter.mapViewToDom(c):null,d=n.mapper.toViewElement(r);if(!d)return;const h=n.view.domConverter.mapViewToDom(d),u=this._getScrollableRect(d),{scrollX:m,scrollY:g}=e.window,p=a?new Li(a):null,f=l?new Li(l):null,b=new Li(h).excludeScrollbarsAndBorders(),k=p?p.bottom:b.top,w=f?f.top:b.bottom,_=e.window.getComputedStyle(h),A=k<=w?(k+w)/2:w;if(u.topa.schema.checkChild(r,t)))){if(a.schema.checkChild(r,"$text"))return a.createRange(r);if(e)return Fv(t,Ov(t,e.parent),i,o)}}}else if(a.schema.isInline(l))return Fv(t,l,i,o);if(a.schema.isBlock(l))return Fv(t,l,i,o);if(a.schema.checkChild(l,"$block")){const e=Array.from(l.getChildren()).filter((e=>e.is("element")&&!Vv(t,e)));let n=0,r=e.length;if(0==r)return a.createRange(a.createPositionAt(l,"end"));for(;ne in t?zv(t,e,{enumerable:!0,configurable:!0,writable:!0,value:n}):t[e]=n;class Uv extends er{constructor(){super(...arguments),this._isBlockDragging=!1,this._domEmitter=new(Bi())}static get pluginName(){return"DragDropBlockToolbar"}init(){const t=this.editor;if(this.listenTo(t,"change:isReadOnly",((t,e,n)=>{n?(this.forceDisabled("readOnlyMode"),this._isBlockDragging=!1):this.clearForceDisabled("readOnlyMode")})),s.isAndroid&&this.forceDisabled("noAndroidSupport"),t.plugins.has("BlockToolbar")){const n=t.plugins.get("BlockToolbar").buttonView.element;this._domEmitter.listenTo(n,"dragstart",((t,e)=>this._handleBlockDragStart(e))),this._domEmitter.listenTo(e.document,"dragover",((t,e)=>this._handleBlockDragging(e))),this._domEmitter.listenTo(e.document,"drop",((t,e)=>this._handleBlockDragging(e))),this._domEmitter.listenTo(e.document,"dragend",(()=>this._handleBlockDragEnd()),{useCapture:!0}),this.isEnabled&&n.setAttribute("draggable","true"),this.on("change:isEnabled",((t,e,i)=>{n.setAttribute("draggable",i?"true":"false")}))}}destroy(){return this._domEmitter.stopListening(),super.destroy()}_handleBlockDragStart(t){if(!this.isEnabled)return;const e=this.editor.model,n=e.document.selection,i=this.editor.editing.view,o=Array.from(n.getSelectedBlocks()),r=e.createRange(e.createPositionBefore(o[0]),e.createPositionAfter(o[o.length-1]));e.change((t=>t.setSelection(r))),this._isBlockDragging=!0,i.focus(),i.getObserver(rC).onDomEvent(t)}_handleBlockDragging(t){if(!this.isEnabled||!this._isBlockDragging)return;const e=t.clientX+("ltr"==this.editor.locale.contentLanguageDirection?100:-100),n=t.clientY,i=document.elementFromPoint(e,n),o=this.editor.editing.view;var r,s;i&&i.closest(".ck-editor__editable")&&o.getObserver(rC).onDomEvent((r=((t,e)=>{for(var n in e||(e={}))jv.call(e,n)&&Wv(t,n,e[n]);if(Hv)for(var n of Hv(e))qv.call(e,n)&&Wv(t,n,e[n]);return t})({},t),s={type:t.type,dataTransfer:t.dataTransfer,target:i,clientX:e,clientY:n,preventDefault:()=>t.preventDefault(),stopPropagation:()=>t.stopPropagation()},Mv(r,Nv(s))))}_handleBlockDragEnd(){this._isBlockDragging=!1}}var $v=n(7793),Gv={injectType:"singletonStyleTag",attributes:{"data-cke":!0},insert:"head",singleton:!0};gr()($v.A,Gv);$v.A.locals;class Kv extends er{constructor(){super(...arguments),this._clearDraggableAttributesDelayed=Zo((()=>this._clearDraggableAttributes()),40),this._blockMode=!1,this._domEmitter=new(Bi())}static get pluginName(){return"DragDrop"}static get requires(){return[RC,hv,Pv,Uv]}init(){const t=this.editor,e=t.editing.view;this._draggedRange=null,this._draggingUid="",this._draggableElement=null,e.addObserver(rC),e.addObserver(_u),this._setupDragging(),this._setupContentInsertionIntegration(),this._setupClipboardInputIntegration(),this._setupDraggableAttributeHandling(),this.listenTo(t,"change:isReadOnly",((t,e,n)=>{n?this.forceDisabled("readOnlyMode"):this.clearForceDisabled("readOnlyMode")})),this.on("change:isEnabled",((t,e,n)=>{n||this._finalizeDragging(!1)})),s.isAndroid&&this.forceDisabled("noAndroidSupport")}destroy(){return this._draggedRange&&(this._draggedRange.detach(),this._draggedRange=null),this._previewContainer&&this._previewContainer.remove(),this._domEmitter.stopListening(),this._clearDraggableAttributesDelayed.cancel(),super.destroy()}_setupDragging(){const t=this.editor,n=t.model,i=t.editing.view,o=i.document,r=t.plugins.get(Pv);this.listenTo(o,"dragstart",((t,e)=>{if(e.target&&e.target.is("editableElement"))return void e.preventDefault();if(this._prepareDraggedRange(e.target),!this._draggedRange)return void e.preventDefault();this._draggingUid=p(),e.dataTransfer.effectAllowed=this.isEnabled?"copyMove":"copy",e.dataTransfer.setData("application/ckeditor5-dragging-uid",this._draggingUid);const i=n.createSelection(this._draggedRange.toRange());this.editor.plugins.get("ClipboardPipeline")._fireOutputTransformationEvent(e.dataTransfer,i,"dragstart");const{dataTransfer:o,domTarget:r,domEvent:s}=e,{clientX:a}=s;this._updatePreview({dataTransfer:o,domTarget:r,clientX:a}),e.stopPropagation(),this.isEnabled||(this._draggedRange.detach(),this._draggedRange=null,this._draggingUid="")}),{priority:"low"}),this.listenTo(o,"dragend",((t,e)=>{this._finalizeDragging(!e.dataTransfer.isCanceled&&"move"==e.dataTransfer.dropEffect)}),{priority:"low"}),this._domEmitter.listenTo(e.document,"dragend",(()=>{this._blockMode=!1}),{useCapture:!0}),this.listenTo(o,"dragenter",(()=>{this.isEnabled&&i.focus()})),this.listenTo(o,"dragleave",(()=>{r.removeDropMarkerDelayed()})),this.listenTo(o,"dragging",((t,e)=>{if(!this.isEnabled)return void(e.dataTransfer.dropEffect="none");const{clientX:n,clientY:i}=e.domEvent;r.updateDropMarker(e.target,e.targetRanges,n,i,this._blockMode,this._draggedRange),this._draggedRange||(e.dataTransfer.dropEffect="copy"),s.isGecko||("copy"==e.dataTransfer.effectAllowed?e.dataTransfer.dropEffect="copy":["all","copyMove"].includes(e.dataTransfer.effectAllowed)&&(e.dataTransfer.dropEffect="move")),t.stop()}),{priority:"low"})}_setupClipboardInputIntegration(){const t=this.editor,e=t.editing.view.document,n=t.plugins.get(Pv);this.listenTo(e,"clipboardInput",((e,i)=>{if("drop"!=i.method)return;const{clientX:o,clientY:r}=i.domEvent,s=n.getFinalDropRange(i.target,i.targetRanges,o,r,this._blockMode,this._draggedRange);if(!s)return this._finalizeDragging(!1),void e.stop();this._draggedRange&&this._draggingUid!=i.dataTransfer.getData("application/ckeditor5-dragging-uid")&&(this._draggedRange.detach(),this._draggedRange=null,this._draggingUid="");if("move"==Jv(i.dataTransfer)&&this._draggedRange&&this._draggedRange.containsRange(s,!0))return this._finalizeDragging(!1),void e.stop();i.targetRanges=[t.editing.mapper.toViewRange(s)]}),{priority:"high"})}_setupContentInsertionIntegration(){const t=this.editor.plugins.get(RC);t.on("contentInsertion",((t,e)=>{if(!this.isEnabled||"drop"!==e.method)return;const n=e.targetRanges.map((t=>this.editor.editing.mapper.toModelRange(t)));this.editor.model.change((t=>t.setSelection(n)))}),{priority:"high"}),t.on("contentInsertion",((t,e)=>{if(!this.isEnabled||"drop"!==e.method)return;const n="move"==Jv(e.dataTransfer),i=!e.resultRange||!e.resultRange.isCollapsed;this._finalizeDragging(i&&n)}),{priority:"lowest"})}_setupDraggableAttributeHandling(){const t=this.editor,e=t.editing.view,n=e.document;this.listenTo(n,"mousedown",((i,o)=>{if(s.isAndroid||!o)return;this._clearDraggableAttributesDelayed.cancel();let r=Zv(o.target);if(s.isBlink&&!t.isReadOnly&&!r&&!n.selection.isCollapsed){const t=n.selection.getSelectedElement();t&&HC(t)||(r=n.selection.editableElement)}r&&(e.change((t=>{t.setAttribute("draggable","true",r)})),this._draggableElement=t.editing.mapper.toModelElement(r))})),this.listenTo(n,"mouseup",(()=>{s.isAndroid||this._clearDraggableAttributesDelayed()}))}_clearDraggableAttributes(){const t=this.editor.editing;t.view.change((e=>{this._draggableElement&&"$graveyard"!=this._draggableElement.root.rootName&&e.removeAttribute("draggable",t.mapper.toViewElement(this._draggableElement)),this._draggableElement=null}))}_finalizeDragging(t){const e=this.editor,n=e.model;if(e.plugins.get(Pv).removeDropMarker(),this._clearDraggableAttributes(),e.plugins.has("WidgetToolbarRepository")){e.plugins.get("WidgetToolbarRepository").clearForceDisabled("dragDrop")}this._draggingUid="",this._previewContainer&&(this._previewContainer.remove(),this._previewContainer=void 0),this._draggedRange&&(t&&this.isEnabled&&n.change((t=>{const e=n.createSelection(this._draggedRange);n.deleteContent(e,{doNotAutoparagraph:!0});const i=e.getFirstPosition().parent;i.isEmpty&&!n.schema.checkChild(i,"$text")&&n.schema.checkChild(i,"paragraph")&&t.insertElement("paragraph",i,0)})),this._draggedRange.detach(),this._draggedRange=null)}_prepareDraggedRange(t){const e=this.editor,n=e.model,i=n.document.selection,o=t?Zv(t):null;if(o){const t=e.editing.mapper.toModelElement(o);if(this._draggedRange=cl.fromRange(n.createRangeOn(t)),this._blockMode=n.schema.isBlock(t),e.plugins.has("WidgetToolbarRepository")){e.plugins.get("WidgetToolbarRepository").forceDisabled("dragDrop")}return}if(i.isCollapsed&&!i.getFirstPosition().parent.isEmpty)return;const r=Array.from(i.getSelectedBlocks()),s=i.getFirstRange();if(0==r.length)return void(this._draggedRange=cl.fromRange(s));const a=Yv(n,r);if(r.length>1)this._draggedRange=cl.fromRange(a),this._blockMode=!0;else if(1==r.length){const t=s.start.isTouching(a.start)&&s.end.isTouching(a.end);this._draggedRange=cl.fromRange(t?a:s),this._blockMode=t}n.change((t=>t.setSelection(this._draggedRange.toRange())))}_updatePreview({dataTransfer:t,domTarget:n,clientX:i}){const o=this.editor.editing.view,r=o.document.selection.editableElement,a=o.domConverter.mapViewToDom(r),c=e.window.getComputedStyle(a);this._previewContainer?this._previewContainer.firstElementChild&&this._previewContainer.removeChild(this._previewContainer.firstElementChild):(this._previewContainer=ft(e.document,"div",{style:"position: fixed; left: -999999px;"}),e.document.body.appendChild(this._previewContainer));const l=new Li(a);if(a.contains(n))return;const d=parseFloat(c.paddingLeft),h=ft(e.document,"div");h.className="ck ck-content",h.style.width=c.width,h.style.paddingLeft=`${l.left-i+d}px`,s.isiOS&&(h.style.backgroundColor="white"),h.innerHTML=t.getData("text/html"),t.setDragImage(h,0,0),this._previewContainer.appendChild(h)}}function Jv(t){return s.isGecko?t.dropEffect:["all","copyMove"].includes(t.effectAllowed)?"move":"copy"}function Zv(t){if(t.is("editableElement"))return null;if(t.hasClass("ck-widget__selection-handle"))return t.findAncestor(HC);if(HC(t))return t;const e=t.findAncestor((t=>HC(t)||t.is("editableElement")));return HC(e)?e:null}function Yv(t,e){const n=e[0],i=e[e.length-1],o=n.getCommonAncestor(i),r=t.createPositionBefore(n),s=t.createPositionAfter(i);if(o&&o.is("element")&&!t.schema.isLimit(o)){const e=t.createRangeOn(o),n=r.isTouching(e.start),i=s.isTouching(e.end);if(n&&i)return Yv(t,[o])}return t.createRange(r,s)}class Qv extends er{static get pluginName(){return"PastePlainText"}static get requires(){return[RC]}init(){const t=this.editor,e=t.model,n=t.editing.view,i=n.document,o=e.document.selection;let r=!1;n.addObserver(rC),this.listenTo(i,"keydown",((t,e)=>{r=e.shiftKey})),t.plugins.get(RC).on("contentInsertion",((t,n)=>{(r||function(t,e){if(t.childCount>1)return!1;const n=t.getChild(0);if(e.isObject(n))return!1;return 0==Array.from(n.getAttributeKeys()).length}(n.content,e.schema))&&e.change((t=>{const i=Array.from(o.getAttributes()).filter((([t])=>e.schema.getAttributeProperties(t).isFormatting));o.isCollapsed||e.deleteContent(o,{doNotAutoparagraph:!0}),i.push(...o.getAttributes());const r=t.createRangeIn(n.content);for(const e of r.getItems())e.is("$textProxy")&&t.setAttributes(i,e)}))}))}}class Xv extends er{static get pluginName(){return"Clipboard"}static get requires(){return[PC,RC,Kv,Qv]}init(){const t=this.editor,e=this.editor.t;t.accessibility.addKeystrokeInfos({keystrokes:[{label:e("Copy selected content"),keystroke:"CTRL+C"},{label:e("Paste content"),keystroke:"CTRL+V"},{label:e("Paste content as plain text"),keystroke:"CTRL+SHIFT+V"}]})}}var ty=Object.defineProperty,ey=Object.getOwnPropertySymbols,ny=Object.prototype.hasOwnProperty,iy=Object.prototype.propertyIsEnumerable,oy=(t,e,n)=>e in t?ty(t,e,{enumerable:!0,configurable:!0,writable:!0,value:n}):t[e]=n;class ry extends ir{constructor(t){super(t),this._stack=[],this._createdBatches=new WeakSet,this.refresh(),this._isEnabledBasedOnSelection=!1,this.listenTo(t.data,"set",((t,e)=>{e[1]=((t,e)=>{for(var n in e||(e={}))ny.call(e,n)&&oy(t,n,e[n]);if(ey)for(var n of ey(e))iy.call(e,n)&&oy(t,n,e[n]);return t})({},e[1]);const n=e[1];n.batchType||(n.batchType={isUndoable:!1})}),{priority:"high"}),this.listenTo(t.data,"set",((t,e)=>{e[1].batchType.isUndoable||this.clearStack()}))}refresh(){this.isEnabled=this._stack.length>0}get createdBatches(){return this._createdBatches}addBatch(t){const e=this.editor.model.document.selection,n={ranges:e.hasOwnRange?Array.from(e.getRanges()):[],isBackward:e.isBackward};this._stack.push({batch:t,selection:n}),this.refresh()}clearStack(){this._stack=[],this.refresh()}_restoreSelection(t,e,n){const i=this.editor.model,o=i.document,r=[],s=t.map((t=>t.getTransformedByOperations(n))),a=s.flat();for(const t of s){const e=t.filter((t=>t.root!=o.graveyard)).filter((t=>!ay(t,a)));e.length&&(sy(e),r.push(e[0]))}r.length&&i.change((t=>{t.setSelection(r,{backward:e})}))}_undo(t,e){const n=this.editor.model,i=n.document;this._createdBatches.add(e);const o=t.operations.slice().filter((t=>t.isDocumentOperation));o.reverse();for(const t of o){const o=t.baseVersion+1,r=Array.from(i.history.getOperations(o)),s=ih([t.getReversed()],r,{useRelations:!0,document:this.editor.model.document,padWithNoOps:!1,forceWeakRemove:!0}).operationsA;for(let o of s){const r=o.affectedSelectable;r&&!n.canEditAt(r)&&(o=new Gd(o.baseVersion)),e.addOperation(o),n.applyOperation(o),i.history.setOperationAsUndone(t,o)}}}}function sy(t){t.sort(((t,e)=>t.start.isBefore(e.start)?-1:1));for(let e=1;ee!==t&&e.containsRange(t,!0)))}class cy extends ry{execute(t=null){const e=t?this._stack.findIndex((e=>e.batch==t)):this._stack.length-1,n=this._stack.splice(e,1)[0],i=this.editor.model.createBatch({isUndo:!0});this.editor.model.enqueueChange(i,(()=>{this._undo(n.batch,i);const t=this.editor.model.document.history.getOperations(n.batch.baseVersion);this._restoreSelection(n.selection.ranges,n.selection.isBackward,t)})),this.fire("revert",n.batch,i),this.refresh()}}class ly extends ry{execute(){const t=this._stack.pop(),e=this.editor.model.createBatch({isUndo:!0});this.editor.model.enqueueChange(e,(()=>{const n=t.batch.operations[t.batch.operations.length-1].baseVersion+1,i=this.editor.model.document.history.getOperations(n);this._restoreSelection(t.selection.ranges,t.selection.isBackward,i),this._undo(t.batch,e)})),this.refresh()}}class dy extends er{constructor(){super(...arguments),this._batchRegistry=new WeakSet}static get pluginName(){return"UndoEditing"}init(){const t=this.editor,e=t.t;this._undoCommand=new cy(t),this._redoCommand=new ly(t),t.commands.add("undo",this._undoCommand),t.commands.add("redo",this._redoCommand),this.listenTo(t.model,"applyOperation",((t,e)=>{const n=e[0];if(!n.isDocumentOperation)return;const i=n.batch,o=this._redoCommand.createdBatches.has(i),r=this._undoCommand.createdBatches.has(i);this._batchRegistry.has(i)||(this._batchRegistry.add(i),i.isUndoable&&(o?this._undoCommand.addBatch(i):r||(this._undoCommand.addBatch(i),this._redoCommand.clearStack())))}),{priority:"highest"}),this.listenTo(this._undoCommand,"revert",((t,e,n)=>{this._redoCommand.addBatch(n)})),t.keystrokes.set("CTRL+Z","undo"),t.keystrokes.set("CTRL+Y","redo"),t.keystrokes.set("CTRL+SHIFT+Z","redo"),t.accessibility.addKeystrokeInfos({keystrokes:[{label:e("Undo"),keystroke:"CTRL+Z"},{label:e("Redo"),keystroke:[["CTRL+Y"],["CTRL+SHIFT+Z"]]}]})}}class hy extends er{static get pluginName(){return"UndoUI"}init(){const t=this.editor,e=t.locale,n=t.t,i="ltr"==e.uiLanguageDirection?ym.undo:ym.redo,o="ltr"==e.uiLanguageDirection?ym.redo:ym.undo;this._addButtonsToFactory("undo",n("Undo"),"CTRL+Z",i),this._addButtonsToFactory("redo",n("Redo"),"CTRL+Y",o)}_addButtonsToFactory(t,e,n,i){const o=this.editor;o.ui.componentFactory.add(t,(()=>{const o=this._createButton(mg,t,e,n,i);return o.set({tooltip:!0}),o})),o.ui.componentFactory.add("menuBar:"+t,(()=>this._createButton(mw,t,e,n,i)))}_createButton(t,e,n,i,o){const r=this.editor,s=r.locale,a=r.commands.get(e),c=new t(s);return c.set({label:n,icon:o,keystroke:i}),c.bind("isEnabled").to(a,"isEnabled"),this.listenTo(c,"execute",(()=>{r.execute(e),r.editing.view.focus()})),c}}class uy extends er{static get requires(){return[dy,hy]}static get pluginName(){return"Undo"}}function my(t){return t.createContainerElement("figure",{class:"image"},[t.createEmptyElement("img"),t.createSlot("children")])}function gy(t,e){const n=t.plugins.get("ImageUtils"),i=t.plugins.has("ImageInlineEditing")&&t.plugins.has("ImageBlockEditing");return t=>{if(!n.isInlineImageView(t))return null;if(!i)return o(t);return("block"==t.getStyle("display")||t.findAncestor(n.isBlockImageView)?"imageBlock":"imageInline")!==e?null:o(t)};function o(t){const e={name:!0};return t.hasAttribute("src")&&(e.attributes=["src"]),e}}function py(t,e){const n=$o(e.getSelectedBlocks());return!n||t.isObject(n)||n.isEmpty&&"listItem"!=n.name?"imageBlock":"imageInline"}function fy(t){return t&&t.endsWith("px")?parseInt(t):null}function by(t){const e=fy(t.getStyle("width")),n=fy(t.getStyle("height"));return!(!e||!n)}var ky=Object.defineProperty,wy=Object.getOwnPropertySymbols,_y=Object.prototype.hasOwnProperty,Ay=Object.prototype.propertyIsEnumerable,Cy=(t,e,n)=>e in t?ky(t,e,{enumerable:!0,configurable:!0,writable:!0,value:n}):t[e]=n,vy=(t,e)=>{for(var n in e||(e={}))_y.call(e,n)&&Cy(t,n,e[n]);if(wy)for(var n of wy(e))Ay.call(e,n)&&Cy(t,n,e[n]);return t};const yy=/^(image|image-inline)$/;class xy extends er{constructor(){super(...arguments),this._domEmitter=new(Bi())}static get pluginName(){return"ImageUtils"}isImage(t){return this.isInlineImage(t)||this.isBlockImage(t)}isInlineImageView(t){return!!t&&t.is("element","img")}isBlockImageView(t){return!!t&&t.is("element","figure")&&t.hasClass("image")}insertImage(t={},e=null,n=null,i={}){const o=this.editor,r=o.model,s=r.document.selection,a=Ey(o,e||s,n);t=vy(vy({},Object.fromEntries(s.getAttributes())),t);for(const e in t)r.schema.checkAttribute(a,e)||delete t[e];return r.change((n=>{const{setImageSizes:o=!0}=i,s=n.createElement(a,t);return r.insertObject(s,e,null,{setSelection:"on",findOptimalPosition:e||"imageInline"==a?void 0:"auto"}),s.parent?(o&&this.setImageNaturalSizeAttributes(s),s):null}))}setImageNaturalSizeAttributes(t){const n=t.getAttribute("src");n&&(t.getAttribute("width")||t.getAttribute("height")||this.editor.model.change((i=>{const o=new e.window.Image;this._domEmitter.listenTo(o,"load",(()=>{t.getAttribute("width")||t.getAttribute("height")||this.editor.model.enqueueChange(i.batch,(e=>{e.setAttribute("width",o.naturalWidth,t),e.setAttribute("height",o.naturalHeight,t)})),this._domEmitter.stopListening(o,"load")})),o.src=n})))}getClosestSelectedImageWidget(t){const e=t.getFirstPosition();if(!e)return null;const n=t.getSelectedElement();if(n&&this.isImageWidget(n))return n;let i=e.parent;for(;i;){if(i.is("element")&&this.isImageWidget(i))return i;i=i.parent}return null}getClosestSelectedImageElement(t){const e=t.getSelectedElement();return this.isImage(e)?e:t.getFirstPosition().findAncestor("imageBlock")}getImageWidgetFromImageView(t){return t.findAncestor({classes:yy})}isImageAllowed(){const t=this.editor.model.document.selection;return function(t,e){const n=Ey(t,e,null);if("imageBlock"==n){const n=function(t,e){const n=GC(t,e),i=n.start.parent;if(i.isEmpty&&!i.is("element","$root"))return i.parent;return i}(e,t.model);if(t.model.schema.checkChild(n,"imageBlock"))return!0}else if(t.model.schema.checkChild(e.focus,"imageInline"))return!0;return!1}(this.editor,t)&&function(t){return[...t.focus.getAncestors()].every((t=>!t.is("element","imageBlock")))}(t)}toImageWidget(t,e,n){e.setCustomProperty("image",!0,t);return jC(t,e,{label:()=>{const e=this.findViewImgElement(t).getAttribute("alt");return e?`${e} ${n}`:n}})}isImageWidget(t){return!!t.getCustomProperty("image")&&HC(t)}isBlockImage(t){return!!t&&t.is("element","imageBlock")}isInlineImage(t){return!!t&&t.is("element","imageInline")}findViewImgElement(t){if(this.isInlineImageView(t))return t;const e=this.editor.editing.view;for(const{item:n}of e.createRangeIn(t))if(this.isInlineImageView(n))return n}destroy(){return this._domEmitter.stopListening(),super.destroy()}}function Ey(t,e,n){const i=t.model.schema,o=t.config.get("image.insert.type");return t.plugins.has("ImageBlockEditing")?t.plugins.has("ImageInlineEditing")?n||("inline"===o?"imageInline":"auto"!==o?"imageBlock":e.is("selection")?py(i,e):i.checkChild(e,"imageInline")?"imageInline":"imageBlock"):"imageBlock":"imageInline"}Object.defineProperty,Object.defineProperties,Object.getOwnPropertyDescriptors,Object.getOwnPropertySymbols,Object.prototype.hasOwnProperty,Object.prototype.propertyIsEnumerable;new RegExp(String(/^(http(s)?:\/\/)?[\w-]+\.[\w.~:/[\]@!$&'()*+,;=%-]+/.source+/\.(jpg|jpeg|png|gif|ico|webp|JPG|JPEG|PNG|GIF|ICO|WEBP)/.source+/(\?[\w.~:/[\]@!$&'()*+,;=%-]*)?/.source+/(#[\w.~:/[\]@!$&'()*+,;=%-]*)?$/.source));class Dy extends ir{refresh(){const t=this.editor.plugins.get("ImageUtils").getClosestSelectedImageElement(this.editor.model.document.selection);this.isEnabled=!!t,this.isEnabled&&t.hasAttribute("alt")?this.value=t.getAttribute("alt"):this.value=!1}execute(t){const e=this.editor,n=e.plugins.get("ImageUtils"),i=e.model,o=n.getClosestSelectedImageElement(i.document.selection);i.change((e=>{e.setAttribute("alt",t.newValue,o)}))}}class By extends er{static get requires(){return[xy]}static get pluginName(){return"ImageTextAlternativeEditing"}init(){this.editor.commands.add("imageTextAlternative",new Dy(this.editor))}}var Sy=n(4062),Ty={injectType:"singletonStyleTag",attributes:{"data-cke":!0},insert:"head",singleton:!0};gr()(Sy.A,Ty);Sy.A.locals;class Iy extends Jm{constructor(t){super(t);const e=this.locale.t;this.focusTracker=new Go,this.keystrokes=new Ko,this.labeledInput=this._createLabeledInputView(),this.saveButtonView=this._createButton(e("Save"),ym.check,"ck-button-save"),this.saveButtonView.type="submit",this.cancelButtonView=this._createButton(e("Cancel"),ym.cancel,"ck-button-cancel","cancel"),this._focusables=new xm,this._focusCycler=new Xg({focusables:this._focusables,focusTracker:this.focusTracker,keystrokeHandler:this.keystrokes,actions:{focusPrevious:"shift + tab",focusNext:"tab"}}),this.setTemplate({tag:"form",attributes:{class:["ck","ck-text-alternative-form","ck-responsive-form"],tabindex:"-1"},children:[this.labeledInput,this.saveButtonView,this.cancelButtonView]})}render(){super.render(),this.keystrokes.listenTo(this.element),Qm({view:this}),[this.labeledInput,this.saveButtonView,this.cancelButtonView].forEach((t=>{this._focusables.add(t),this.focusTracker.add(t.element)}))}destroy(){super.destroy(),this.focusTracker.destroy(),this.keystrokes.destroy()}_createButton(t,e,n,i){const o=new mg(this.locale);return o.set({label:t,icon:e,tooltip:!0}),o.extendTemplate({attributes:{class:n}}),i&&o.delegate("execute").to(this,i),o}_createLabeledInputView(){const t=this.locale.t,e=new zg(this.locale,zp);return e.label=t("Text alternative"),e}}function Py(t){const e=t.editing.view,n=kb.defaultPositions,i=t.plugins.get("ImageUtils");return{target:e.domConverter.mapViewToDom(i.getClosestSelectedImageWidget(e.document.selection)),positions:[n.northArrowSouth,n.northArrowSouthWest,n.northArrowSouthEast,n.southArrowNorth,n.southArrowNorthWest,n.southArrowNorthEast,n.viewportStickyNorth]}}class Ry extends er{static get requires(){return[mk]}static get pluginName(){return"ImageTextAlternativeUI"}init(){this._createButton()}destroy(){super.destroy(),this._form&&this._form.destroy()}_createButton(){const t=this.editor,e=t.t;t.ui.componentFactory.add("imageTextAlternative",(n=>{const i=t.commands.get("imageTextAlternative"),o=new mg(n);return o.set({label:e("Change image text alternative"),icon:ym.textAlternative,tooltip:!0}),o.bind("isEnabled").to(i,"isEnabled"),o.bind("isOn").to(i,"value",(t=>!!t)),this.listenTo(o,"execute",(()=>{this._showForm()})),o}))}_createForm(){const t=this.editor,e=t.editing.view.document,n=t.plugins.get("ImageUtils");this._balloon=this.editor.plugins.get("ContextualBalloon"),this._form=new(Ym(Iy))(t.locale),this._form.render(),this.listenTo(this._form,"submit",(()=>{t.execute("imageTextAlternative",{newValue:this._form.labeledInput.fieldView.element.value}),this._hideForm(!0)})),this.listenTo(this._form,"cancel",(()=>{this._hideForm(!0)})),this._form.keystrokes.set("Esc",((t,e)=>{this._hideForm(!0),e()})),this.listenTo(t.ui,"update",(()=>{n.getClosestSelectedImageWidget(e.selection)?this._isVisible&&function(t){const e=t.plugins.get("ContextualBalloon");if(t.plugins.get("ImageUtils").getClosestSelectedImageWidget(t.editing.view.document.selection)){const n=Py(t);e.updatePosition(n)}}(t):this._hideForm(!0)})),Zm({emitter:this._form,activator:()=>this._isVisible,contextElements:()=>[this._balloon.view.element],callback:()=>this._hideForm()})}_showForm(){if(this._isVisible)return;this._form||this._createForm();const t=this.editor,e=t.commands.get("imageTextAlternative"),n=this._form.labeledInput;this._form.disableCssTransitions(),this._isInBalloon||this._balloon.add({view:this._form,position:Py(t)}),n.fieldView.value=n.fieldView.element.value=e.value||"",this._form.labeledInput.fieldView.select(),this._form.enableCssTransitions()}_hideForm(t=!1){this._isInBalloon&&(this._form.focusTracker.isFocused&&this._form.saveButtonView.focus(),this._balloon.remove(this._form),t&&this.editor.editing.view.focus())}get _isVisible(){return!!this._balloon&&this._balloon.visibleView===this._form}get _isInBalloon(){return!!this._balloon&&this._balloon.hasView(this._form)}}class Vy extends er{static get requires(){return[By,Ry]}static get pluginName(){return"ImageTextAlternative"}}function Fy(t,e){const n=(e,n,i)=>{if(!i.consumable.consume(n.item,e.name))return;const o=i.writer,r=i.mapper.toViewElement(n.item),s=t.findViewImgElement(r);null===n.attributeNewValue?(o.removeAttribute("srcset",s),o.removeAttribute("sizes",s)):n.attributeNewValue&&(o.setAttribute("srcset",n.attributeNewValue,s),o.setAttribute("sizes","100vw",s))};return t=>{t.on(`attribute:srcset:${e}`,n)}}function Ly(t,e,n){const i=(e,n,i)=>{if(!i.consumable.consume(n.item,e.name))return;const o=i.writer,r=i.mapper.toViewElement(n.item),s=t.findViewImgElement(r);o.setAttribute(n.attributeKey,n.attributeNewValue||"",s)};return t=>{t.on(`attribute:${n}:${e}`,i)}}class Oy extends Da{observe(t){this.listenTo(t,"load",((t,e)=>{const n=e.target;this.checkShouldIgnoreEventFromTarget(n)||"IMG"==n.tagName&&this._fireEvents(e)}),{useCapture:!0})}stopObserving(t){this.stopListening(t)}_fireEvents(t){this.isEnabled&&(this.document.fire("layoutChanged"),this.document.fire("imageLoaded",t))}}var zy=Object.defineProperty,My=Object.getOwnPropertySymbols,Ny=Object.prototype.hasOwnProperty,Hy=Object.prototype.propertyIsEnumerable,jy=(t,e,n)=>e in t?zy(t,e,{enumerable:!0,configurable:!0,writable:!0,value:n}):t[e]=n,qy=(t,e)=>{for(var n in e||(e={}))Ny.call(e,n)&&jy(t,n,e[n]);if(My)for(var n of My(e))Hy.call(e,n)&&jy(t,n,e[n]);return t};class Wy extends ir{constructor(t){super(t);const e=t.config.get("image.insert.type");t.plugins.has("ImageBlockEditing")||"block"===e&&_("image-block-plugin-required"),t.plugins.has("ImageInlineEditing")||"inline"===e&&_("image-inline-plugin-required")}refresh(){const t=this.editor.plugins.get("ImageUtils");this.isEnabled=t.isImageAllowed()}execute(t){const e=_o(t.source),n=this.editor.model.document.selection,i=this.editor.plugins.get("ImageUtils"),o=Object.fromEntries(n.getAttributes());e.forEach(((t,e)=>{const r=n.getSelectedElement();if("string"==typeof t&&(t={src:t}),e&&r&&i.isImage(r)){const e=this.editor.model.createPositionAfter(r);i.insertImage(qy(qy({},t),o),e)}else i.insertImage(qy(qy({},t),o))}))}}class Uy extends ir{constructor(t){super(t),this.decorate("cleanupImage")}refresh(){const t=this.editor.plugins.get("ImageUtils"),e=this.editor.model.document.selection.getSelectedElement();this.isEnabled=t.isImage(e),this.value=this.isEnabled?e.getAttribute("src"):null}execute(t){const e=this.editor.model.document.selection.getSelectedElement(),n=this.editor.plugins.get("ImageUtils");this.editor.model.change((i=>{i.setAttribute("src",t.source,e),this.cleanupImage(i,e),n.setImageNaturalSizeAttributes(e)}))}cleanupImage(t,e){t.removeAttribute("srcset",e),t.removeAttribute("sizes",e),t.removeAttribute("sources",e),t.removeAttribute("width",e),t.removeAttribute("height",e),t.removeAttribute("alt",e)}}class $y extends er{static get requires(){return[xy]}static get pluginName(){return"ImageEditing"}init(){const t=this.editor,e=t.conversion;t.editing.view.addObserver(Oy),e.for("upcast").attributeToAttribute({view:{name:"img",key:"alt"},model:"alt"}).attributeToAttribute({view:{name:"img",key:"srcset"},model:"srcset"});const n=new Wy(t),i=new Uy(t);t.commands.add("insertImage",n),t.commands.add("replaceImageSource",i),t.commands.add("imageInsert",n)}}class Gy extends er{static get requires(){return[xy]}static get pluginName(){return"ImageSizeAttributes"}afterInit(){this._registerSchema(),this._registerConverters("imageBlock"),this._registerConverters("imageInline")}_registerSchema(){this.editor.plugins.has("ImageBlockEditing")&&this.editor.model.schema.extend("imageBlock",{allowAttributes:["width","height"]}),this.editor.plugins.has("ImageInlineEditing")&&this.editor.model.schema.extend("imageInline",{allowAttributes:["width","height"]})}_registerConverters(t){const e=this.editor,n=e.plugins.get("ImageUtils"),i="imageBlock"===t?"figure":"img";function o(e,i,o,r){e.on(`attribute:${i}:${t}`,((e,i,s)=>{if(!s.consumable.consume(i.item,e.name))return;const a=s.writer,c=s.mapper.toViewElement(i.item),l=n.findViewImgElement(c);if(null!==i.attributeNewValue?a.setAttribute(o,i.attributeNewValue,l):a.removeAttribute(o,l),i.item.hasAttribute("sources"))return;const d=i.item.hasAttribute("resizedWidth");if("imageInline"===t&&!d&&!r)return;const h=i.item.getAttribute("width"),u=i.item.getAttribute("height");h&&u&&a.setStyle("aspect-ratio",`${h}/${u}`,l)}))}e.conversion.for("upcast").attributeToAttribute({view:{name:i,styles:{width:/.+/}},model:{key:"width",value:t=>by(t)?fy(t.getStyle("width")):null}}).attributeToAttribute({view:{name:i,key:"width"},model:"width"}).attributeToAttribute({view:{name:i,styles:{height:/.+/}},model:{key:"height",value:t=>by(t)?fy(t.getStyle("height")):null}}).attributeToAttribute({view:{name:i,key:"height"},model:"height"}),e.conversion.for("editingDowncast").add((t=>{o(t,"width","width",!0),o(t,"height","height",!0)})),e.conversion.for("dataDowncast").add((t=>{o(t,"width","width",!1),o(t,"height","height",!1)}))}}class Ky extends ir{constructor(t,e){super(t),this._modelElementName=e}refresh(){const t=this.editor.plugins.get("ImageUtils"),e=t.getClosestSelectedImageElement(this.editor.model.document.selection);"imageBlock"===this._modelElementName?this.isEnabled=t.isInlineImage(e):this.isEnabled=t.isBlockImage(e)}execute(t={}){const e=this.editor,n=this.editor.model,i=e.plugins.get("ImageUtils"),o=i.getClosestSelectedImageElement(n.document.selection),r=Object.fromEntries(o.getAttributes());return r.src||r.uploadId?n.change((e=>{const{setImageSizes:s=!0}=t,a=Array.from(n.markers).filter((t=>t.getRange().containsItem(o))),c=i.insertImage(r,n.createSelection(o,"on"),this._modelElementName,{setImageSizes:s});if(!c)return null;const l=e.createRangeOn(c);for(const t of a){const n=t.getRange(),i="$graveyard"!=n.root.rootName?n.getJoined(l,!0):l;e.updateMarker(t,{range:i})}return{oldElement:o,newElement:c}})):null}}var Jy=n(7378),Zy={injectType:"singletonStyleTag",attributes:{"data-cke":!0},insert:"head",singleton:!0};gr()(Jy.A,Zy);Jy.A.locals;class Yy extends er{static get requires(){return[xy]}static get pluginName(){return"ImagePlaceholder"}afterInit(){this._setupSchema(),this._setupConversion(),this._setupLoadListener()}_setupSchema(){const t=this.editor.model.schema;t.isRegistered("imageBlock")&&t.extend("imageBlock",{allowAttributes:["placeholder"]}),t.isRegistered("imageInline")&&t.extend("imageInline",{allowAttributes:["placeholder"]})}_setupConversion(){const t=this.editor,e=t.conversion,n=t.plugins.get("ImageUtils");e.for("editingDowncast").add((t=>{t.on("attribute:placeholder",((t,e,i)=>{if(!i.consumable.test(e.item,t.name))return;if(!e.item.is("element","imageBlock")&&!e.item.is("element","imageInline"))return;i.consumable.consume(e.item,t.name);const o=i.writer,r=i.mapper.toViewElement(e.item),s=n.findViewImgElement(r);e.attributeNewValue?(o.addClass("image_placeholder",s),o.setStyle("background-image",`url(${e.attributeNewValue})`,s),o.setCustomProperty("editingPipeline:doNotReuseOnce",!0,s)):(o.removeClass("image_placeholder",s),o.removeStyle("background-image",s))}))}))}_setupLoadListener(){const t=this.editor,e=t.model,n=t.editing,i=n.view,o=t.plugins.get("ImageUtils");i.addObserver(Oy),this.listenTo(i.document,"imageLoaded",((t,r)=>{const s=i.domConverter.mapDomToView(r.target);if(!s)return;const a=o.getImageWidgetFromImageView(s);if(!a)return;const c=n.mapper.toModelElement(a);c&&c.hasAttribute("placeholder")&&e.enqueueChange({isUndoable:!1},(t=>{t.removeAttribute("placeholder",c)}))}))}}class Qy extends er{static get requires(){return[$y,Gy,xy,Yy,RC]}static get pluginName(){return"ImageBlockEditing"}init(){const t=this.editor;t.model.schema.register("imageBlock",{inheritAllFrom:"$blockObject",allowAttributes:["alt","src","srcset"]}),this._setupConversion(),t.plugins.has("ImageInlineEditing")&&(t.commands.add("imageTypeBlock",new Ky(this.editor,"imageBlock")),this._setupClipboardIntegration())}_setupConversion(){const t=this.editor,e=t.t,n=t.conversion,i=t.plugins.get("ImageUtils");n.for("dataDowncast").elementToStructure({model:"imageBlock",view:(t,{writer:e})=>my(e)}),n.for("editingDowncast").elementToStructure({model:"imageBlock",view:(t,{writer:n})=>i.toImageWidget(my(n),n,e("image widget"))}),n.for("downcast").add(Ly(i,"imageBlock","src")).add(Ly(i,"imageBlock","alt")).add(Fy(i,"imageBlock")),n.for("upcast").elementToElement({view:gy(t,"imageBlock"),model:(t,{writer:e})=>e.createElement("imageBlock",t.hasAttribute("src")?{src:t.getAttribute("src")}:void 0)}).add(function(t){const e=(e,n,i)=>{if(!i.consumable.test(n.viewItem,{name:!0,classes:"image"}))return;const o=t.findViewImgElement(n.viewItem);if(!o||!i.consumable.test(o,{name:!0}))return;i.consumable.consume(n.viewItem,{name:!0,classes:"image"});const r=$o(i.convertItem(o,n.modelCursor).modelRange.getItems());r?(i.convertChildren(n.viewItem,r),i.updateConversionResult(r,n)):i.consumable.revert(n.viewItem,{name:!0,classes:"image"})};return t=>{t.on("element:figure",e)}}(i))}_setupClipboardIntegration(){const t=this.editor,e=t.model,n=t.editing.view,i=t.plugins.get("ImageUtils"),o=t.plugins.get("ClipboardPipeline");this.listenTo(o,"inputTransformation",((o,r)=>{const s=Array.from(r.content.getChildren());let a;if(!s.every(i.isInlineImageView))return;a=r.targetRanges?t.editing.mapper.toModelRange(r.targetRanges[0]):e.document.selection.getFirstRange();const c=e.createSelection(a);if("imageBlock"===py(e.schema,c)){const t=new Au(n.document),e=s.map((e=>t.createElement("figure",{class:"image"},e)));r.content=t.createDocumentFragment(e)}})),this.listenTo(o,"contentInsertion",((t,n)=>{"paste"===n.method&&e.change((t=>{const e=t.createRangeIn(n.content);for(const t of e.getItems())t.is("element","imageBlock")&&i.setImageNaturalSizeAttributes(t)}))}))}}var Xy=n(3350),tx={injectType:"singletonStyleTag",attributes:{"data-cke":!0},insert:"head",singleton:!0};gr()(Xy.A,tx);Xy.A.locals;class ex extends Jm{constructor(t,e=[]){super(t),this.focusTracker=new Go,this.keystrokes=new Ko,this._focusables=new xm,this.children=this.createCollection(),this._focusCycler=new Xg({focusables:this._focusables,focusTracker:this.focusTracker,keystrokeHandler:this.keystrokes,actions:{focusPrevious:"shift + tab",focusNext:"tab"}});for(const t of e)this.children.add(t),this._focusables.add(t),t instanceof Cg&&this._focusables.addMany(t.children);if(this._focusables.length>1)for(const t of this._focusables)nx(t)&&(t.focusCycler.on("forwardCycle",(t=>{this._focusCycler.focusNext(),t.stop()})),t.focusCycler.on("backwardCycle",(t=>{this._focusCycler.focusPrevious(),t.stop()})));this.setTemplate({tag:"form",attributes:{class:["ck","ck-image-insert-form"],tabindex:-1},children:this.children})}render(){super.render(),Qm({view:this});for(const t of this._focusables)this.focusTracker.add(t.element);this.keystrokes.listenTo(this.element);const t=t=>t.stopPropagation();this.keystrokes.set("arrowright",t),this.keystrokes.set("arrowleft",t),this.keystrokes.set("arrowup",t),this.keystrokes.set("arrowdown",t)}destroy(){super.destroy(),this.focusTracker.destroy(),this.keystrokes.destroy()}focus(){this._focusCycler.focusFirst()}}function nx(t){return"focusCycler"in t}class ix extends er{constructor(t){super(t),this._integrations=new Map,t.config.define("image.insert.integrations",["upload","assetManager","url"])}static get pluginName(){return"ImageInsertUI"}static get requires(){return[xy]}init(){const t=this.editor,e=t.model.document.selection,n=t.plugins.get("ImageUtils");this.set("isImageSelected",!1),this.listenTo(t.model.document,"change",(()=>{this.isImageSelected=n.isImage(e.getSelectedElement())}));const i=t=>this._createToolbarComponent(t);t.ui.componentFactory.add("insertImage",i),t.ui.componentFactory.add("imageInsert",i)}registerIntegration({name:t,observable:e,buttonViewCreator:n,formViewCreator:i,requiresForm:o}){this._integrations.has(t)&&_("image-insert-integration-exists",{name:t}),this._integrations.set(t,{observable:e,buttonViewCreator:n,formViewCreator:i,requiresForm:!!o})}_createToolbarComponent(t){const e=this.editor,n=t.t,i=this._prepareIntegrations();if(!i.length)return null;let o;const r=i[0];if(1==i.length){if(!r.requiresForm)return r.buttonViewCreator(!0);o=r.buttonViewCreator(!0)}else{const e=r.buttonViewCreator(!1);o=new Ep(t,e),o.tooltip=!0,o.bind("label").to(this,"isImageSelected",(t=>n(t?"Replace image":"Insert image")))}const s=this.dropdownView=Ip(t,o),a=i.map((({observable:t})=>"function"==typeof t?t():t));return s.bind("isEnabled").toMany(a,"isEnabled",((...t)=>t.some((t=>t)))),s.once("change:isOpen",(()=>{const t=i.map((({formViewCreator:t})=>t(1==i.length))),n=new ex(e.locale,t);s.panelView.children.add(n)})),s}_prepareIntegrations(){const t=this.editor.config.get("image.insert.integrations"),e=[];if(!t.length)return _("image-insert-integrations-not-specified"),e;for(const n of t)this._integrations.has(n)?e.push(this._integrations.get(n)):["upload","assetManager","url"].includes(n)||_("image-insert-unknown-integration",{item:n});return e.length||_("image-insert-integrations-not-registered"),e}}var ox=n(265),rx={injectType:"singletonStyleTag",attributes:{"data-cke":!0},insert:"head",singleton:!0};gr()(ox.A,rx);ox.A.locals;class sx extends er{static get requires(){return[Qy,hv,Vy,ix]}static get pluginName(){return"ImageBlock"}}class ax extends er{static get requires(){return[$y,Gy,xy,Yy,RC]}static get pluginName(){return"ImageInlineEditing"}init(){const t=this.editor,e=t.model.schema;e.register("imageInline",{inheritAllFrom:"$inlineObject",allowAttributes:["alt","src","srcset"]}),e.addChildCheck(((t,e)=>{if(t.endsWith("caption")&&"imageInline"===e.name)return!1})),this._setupConversion(),t.plugins.has("ImageBlockEditing")&&(t.commands.add("imageTypeInline",new Ky(this.editor,"imageInline")),this._setupClipboardIntegration())}_setupConversion(){const t=this.editor,e=t.t,n=t.conversion,i=t.plugins.get("ImageUtils");n.for("dataDowncast").elementToElement({model:"imageInline",view:(t,{writer:e})=>e.createEmptyElement("img")}),n.for("editingDowncast").elementToStructure({model:"imageInline",view:(t,{writer:n})=>i.toImageWidget(function(t){return t.createContainerElement("span",{class:"image-inline"},t.createEmptyElement("img"))}(n),n,e("image widget"))}),n.for("downcast").add(Ly(i,"imageInline","src")).add(Ly(i,"imageInline","alt")).add(Fy(i,"imageInline")),n.for("upcast").elementToElement({view:gy(t,"imageInline"),model:(t,{writer:e})=>e.createElement("imageInline",t.hasAttribute("src")?{src:t.getAttribute("src")}:void 0)})}_setupClipboardIntegration(){const t=this.editor,e=t.model,n=t.editing.view,i=t.plugins.get("ImageUtils"),o=t.plugins.get("ClipboardPipeline");this.listenTo(o,"inputTransformation",((o,r)=>{const s=Array.from(r.content.getChildren());let a;if(!s.every(i.isBlockImageView))return;a=r.targetRanges?t.editing.mapper.toModelRange(r.targetRanges[0]):e.document.selection.getFirstRange();const c=e.createSelection(a);if("imageInline"===py(e.schema,c)){const t=new Au(n.document),e=s.map((e=>1===e.childCount?(Array.from(e.getAttributes()).forEach((n=>t.setAttribute(...n,i.findViewImgElement(e)))),e.getChild(0)):e));r.content=t.createDocumentFragment(e)}})),this.listenTo(o,"contentInsertion",((t,n)=>{"paste"===n.method&&e.change((t=>{const e=t.createRangeIn(n.content);for(const t of e.getItems())t.is("element","imageInline")&&i.setImageNaturalSizeAttributes(t)}))}))}}class cx extends er{static get requires(){return[ax,hv,Vy,ix]}static get pluginName(){return"ImageInline"}}class lx extends er{static get pluginName(){return"ImageCaptionUtils"}static get requires(){return[xy]}getCaptionFromImageModelElement(t){for(const e of t.getChildren())if(e&&e.is("element","caption"))return e;return null}getCaptionFromModelSelection(t){const e=this.editor.plugins.get("ImageUtils"),n=t.getFirstPosition().findAncestor("caption");return n&&e.isBlockImage(n.parent)?n:null}matchImageCaptionViewElement(t){const e=this.editor.plugins.get("ImageUtils");return"figcaption"==t.name&&e.isBlockImageView(t.parent)?{name:!0}:null}}class dx extends ir{refresh(){const t=this.editor,e=t.plugins.get("ImageCaptionUtils"),n=t.plugins.get("ImageUtils");if(!t.plugins.has(Qy))return this.isEnabled=!1,void(this.value=!1);const i=t.model.document.selection,o=i.getSelectedElement();if(!o){const t=e.getCaptionFromModelSelection(i);return this.isEnabled=!!t,void(this.value=!!t)}this.isEnabled=n.isImage(o),this.isEnabled?this.value=!!e.getCaptionFromImageModelElement(o):this.value=!1}execute(t={}){const{focusCaptionOnShow:e}=t;this.editor.model.change((t=>{this.value?this._hideImageCaption(t):this._showImageCaption(t,e)}))}_showImageCaption(t,e){const n=this.editor.model.document.selection,i=this.editor.plugins.get("ImageCaptionEditing"),o=this.editor.plugins.get("ImageUtils");let r=n.getSelectedElement();const s=i._getSavedCaption(r);o.isInlineImage(r)&&(this.editor.execute("imageTypeBlock"),r=n.getSelectedElement());const a=s||t.createElement("caption");t.append(a,r),e&&t.setSelection(a,"in")}_hideImageCaption(t){const e=this.editor,n=e.model.document.selection,i=e.plugins.get("ImageCaptionEditing"),o=e.plugins.get("ImageCaptionUtils");let r,s=n.getSelectedElement();s?r=o.getCaptionFromImageModelElement(s):(r=o.getCaptionFromModelSelection(n),s=r.parent),i._saveCaption(s,r),t.setSelection(s,"on"),t.remove(r)}}class hx extends er{constructor(t){super(t),this._savedCaptionsMap=new WeakMap}static get requires(){return[xy,lx]}static get pluginName(){return"ImageCaptionEditing"}init(){const t=this.editor,e=t.model.schema;e.isRegistered("caption")?e.extend("caption",{allowIn:"imageBlock"}):e.register("caption",{allowIn:"imageBlock",allowContentOf:"$block",isLimit:!0}),t.commands.add("toggleImageCaption",new dx(this.editor)),this._setupConversion(),this._setupImageTypeCommandsIntegration(),this._registerCaptionReconversion()}_setupConversion(){const t=this.editor,e=t.editing.view,n=t.plugins.get("ImageUtils"),i=t.plugins.get("ImageCaptionUtils"),o=t.t;t.conversion.for("upcast").elementToElement({view:t=>i.matchImageCaptionViewElement(t),model:"caption"}),t.conversion.for("dataDowncast").elementToElement({model:"caption",view:(t,{writer:e})=>n.isBlockImage(t.parent)?e.createContainerElement("figcaption"):null}),t.conversion.for("editingDowncast").elementToElement({model:"caption",view:(t,{writer:i})=>{if(!n.isBlockImage(t.parent))return null;const r=i.createEditableElement("figcaption");i.setCustomProperty("imageCaption",!0,r),r.placeholder=o("Enter image caption"),wr({view:e,element:r,keepOnFocus:!0});const s=t.parent.getAttribute("alt");return $C(r,i,{label:s?o("Caption for image: %0",[s]):o("Caption for the image")})}})}_setupImageTypeCommandsIntegration(){const t=this.editor,e=t.plugins.get("ImageUtils"),n=t.plugins.get("ImageCaptionUtils"),i=t.commands.get("imageTypeInline"),o=t.commands.get("imageTypeBlock"),r=t=>{if(!t.return)return;const{oldElement:i,newElement:o}=t.return;if(!i)return;if(e.isBlockImage(i)){const t=n.getCaptionFromImageModelElement(i);if(t)return void this._saveCaption(o,t)}const r=this._getSavedCaption(i);r&&this._saveCaption(o,r)};i&&this.listenTo(i,"execute",r,{priority:"low"}),o&&this.listenTo(o,"execute",r,{priority:"low"})}_getSavedCaption(t){const e=this._savedCaptionsMap.get(t);return e?Tc.fromJSON(e):null}_saveCaption(t,e){this._savedCaptionsMap.set(t,e.toJSON())}_registerCaptionReconversion(){const t=this.editor,e=t.model,n=t.plugins.get("ImageUtils"),i=t.plugins.get("ImageCaptionUtils");e.document.on("change:data",(()=>{const o=e.document.differ.getChanges();for(const e of o){if("alt"!==e.attributeKey)continue;const o=e.range.start.nodeAfter;if(n.isBlockImage(o)){const e=i.getCaptionFromImageModelElement(o);if(!e)return;t.editing.reconvertItem(e)}}}))}}class ux extends er{static get requires(){return[lx]}static get pluginName(){return"ImageCaptionUI"}init(){const t=this.editor,e=t.editing.view,n=t.plugins.get("ImageCaptionUtils"),i=t.t;t.ui.componentFactory.add("toggleImageCaption",(o=>{const r=t.commands.get("toggleImageCaption"),s=new mg(o);return s.set({icon:ym.caption,tooltip:!0,isToggleable:!0}),s.bind("isOn","isEnabled").to(r,"value","isEnabled"),s.bind("label").to(r,"value",(t=>i(t?"Toggle caption off":"Toggle caption on"))),this.listenTo(s,"execute",(()=>{t.execute("toggleImageCaption",{focusCaptionOnShow:!0});const i=n.getCaptionFromModelSelection(t.model.document.selection);if(i){const n=t.editing.mapper.toViewElement(i);e.scrollToTheSelection(),e.change((t=>{t.addClass("image__caption_highlighted",n)}))}t.editing.view.focus()})),s}))}}var mx=n(5247),gx={injectType:"singletonStyleTag",attributes:{"data-cke":!0},insert:"head",singleton:!0};gr()(mx.A,gx);mx.A.locals;function px(t){const e=t.map((t=>t.replace("+","\\+")));return new RegExp(`^image\\/(${e.join("|")})$`)}function fx(t){return new Promise(((n,i)=>{const o=t.getAttribute("src");fetch(o).then((t=>t.blob())).then((t=>{const e=bx(t,o),i=e.replace("image/",""),r=new File([t],`image.${i}`,{type:e});n(r)})).catch((t=>t&&"TypeError"===t.name?function(t){return function(t){return new Promise(((n,i)=>{const o=e.document.createElement("img");o.addEventListener("load",(()=>{const t=e.document.createElement("canvas");t.width=o.width,t.height=o.height;t.getContext("2d").drawImage(o,0,0),t.toBlob((t=>t?n(t):i()))})),o.addEventListener("error",(()=>i())),o.src=t}))}(t).then((e=>{const n=bx(e,t),i=n.replace("image/","");return new File([e],`image.${i}`,{type:n})}))}(o).then(n).catch(i):i(t)))}))}function bx(t,e){return t.type?t.type:e.match(/data:(image\/\w+);base64/)?e.match(/data:(image\/\w+);base64/)[1].toLowerCase():"image/jpeg"}class kx extends er{static get pluginName(){return"ImageUploadUI"}init(){const t=this.editor,e=t.t,n=()=>{const t=this._createButton(bg);return t.set({label:e("Upload image from computer"),tooltip:!0}),t};if(t.ui.componentFactory.add("uploadImage",n),t.ui.componentFactory.add("imageUpload",n),t.ui.componentFactory.add("menuBar:uploadImage",(()=>{const t=this._createButton(gw);return t.label=e("Image from computer"),t})),t.plugins.has("ImageInsertUI")){const n=t.plugins.get("ImageInsertUI");n.registerIntegration({name:"upload",observable:()=>t.commands.get("uploadImage"),buttonViewCreator:()=>{const i=t.ui.componentFactory.create("uploadImage");return i.bind("label").to(n,"isImageSelected",(t=>e(t?"Replace image from computer":"Upload image from computer"))),i},formViewCreator:()=>{const i=t.ui.componentFactory.create("uploadImage");return i.withText=!0,i.bind("label").to(n,"isImageSelected",(t=>e(t?"Replace from computer":"Upload from computer"))),i.on("execute",(()=>{n.dropdownView.isOpen=!1})),i}})}}_createButton(t){const e=this.editor,n=e.locale,i=e.commands.get("uploadImage"),o=e.config.get("image.upload.types"),r=px(o),s=new t(e.locale),a=n.t;return s.set({acceptedType:o.map((t=>`image/${t}`)).join(","),allowMultipleFiles:!0,label:a("Upload image from computer"),icon:ym.imageUpload}),s.bind("isEnabled").to(i),s.on("done",((t,n)=>{const i=Array.from(n).filter((t=>r.test(t.type)));i.length&&(e.execute("uploadImage",{file:i}),e.editing.view.focus())})),s}}var wx=n(2267),_x={injectType:"singletonStyleTag",attributes:{"data-cke":!0},insert:"head",singleton:!0};gr()(wx.A,_x);wx.A.locals;var Ax=n(7693),Cx={injectType:"singletonStyleTag",attributes:{"data-cke":!0},insert:"head",singleton:!0};gr()(Ax.A,Cx);Ax.A.locals;var vx=n(1559),yx={injectType:"singletonStyleTag",attributes:{"data-cke":!0},insert:"head",singleton:!0};gr()(vx.A,yx);vx.A.locals;class xx extends er{constructor(t){super(t),this.uploadStatusChange=(t,e,n)=>{const i=this.editor,o=e.item,r=o.getAttribute("uploadId");if(!n.consumable.consume(e.item,t.name))return;const s=i.plugins.get("ImageUtils"),a=i.plugins.get(o_),c=r?e.attributeNewValue:null,l=this.placeholder,d=i.editing.mapper.toViewElement(o),h=n.writer;if("reading"==c)return Ex(d,h),void Dx(s,l,d,h);if("uploading"==c){const t=a.loaders.get(r);return Ex(d,h),void(t?(Bx(d,h),function(t,e,n,i){const o=function(t){const e=t.createUIElement("div",{class:"ck-progress-bar"});return t.setCustomProperty("progressBar",!0,e),e}(e);e.insert(e.createPositionAt(t,"end"),o),n.on("change:uploadedPercent",((t,e,n)=>{i.change((t=>{t.setStyle("width",n+"%",o)}))}))}(d,h,t,i.editing.view),function(t,e,n,i){if(i.data){const o=t.findViewImgElement(e);n.setAttribute("src",i.data,o)}}(s,d,h,t)):Dx(s,l,d,h))}"complete"==c&&a.loaders.get(r)&&function(t,e,n){const i=e.createUIElement("div",{class:"ck-image-upload-complete-icon"});e.insert(e.createPositionAt(t,"end"),i),setTimeout((()=>{n.change((t=>t.remove(t.createRangeOn(i))))}),3e3)}(d,h,i.editing.view),function(t,e){Tx(t,e,"progressBar")}(d,h),Bx(d,h),function(t,e){e.removeClass("ck-appear",t)}(d,h)},this.placeholder="data:image/gif;base64,R0lGODlhAQABAAAAACH5BAEKAAEALAAAAAABAAEAAAICTAEAOw=="}static get pluginName(){return"ImageUploadProgress"}init(){const t=this.editor;t.plugins.has("ImageBlockEditing")&&t.editing.downcastDispatcher.on("attribute:uploadStatus:imageBlock",this.uploadStatusChange),t.plugins.has("ImageInlineEditing")&&t.editing.downcastDispatcher.on("attribute:uploadStatus:imageInline",this.uploadStatusChange)}}function Ex(t,e){t.hasClass("ck-appear")||e.addClass("ck-appear",t)}function Dx(t,e,n,i){n.hasClass("ck-image-upload-placeholder")||i.addClass("ck-image-upload-placeholder",n);const o=t.findViewImgElement(n);o.getAttribute("src")!==e&&i.setAttribute("src",e,o),Sx(n,"placeholder")||i.insert(i.createPositionAfter(o),function(t){const e=t.createUIElement("div",{class:"ck-upload-placeholder-loader"});return t.setCustomProperty("placeholder",!0,e),e}(i))}function Bx(t,e){t.hasClass("ck-image-upload-placeholder")&&e.removeClass("ck-image-upload-placeholder",t),Tx(t,e,"placeholder")}function Sx(t,e){for(const n of t.getChildren())if(n.getCustomProperty(e))return n}function Tx(t,e,n){const i=Sx(t,n);i&&e.remove(e.createRangeOn(i))}var Ix=Object.defineProperty,Px=Object.defineProperties,Rx=Object.getOwnPropertyDescriptors,Vx=Object.getOwnPropertySymbols,Fx=Object.prototype.hasOwnProperty,Lx=Object.prototype.propertyIsEnumerable,Ox=(t,e,n)=>e in t?Ix(t,e,{enumerable:!0,configurable:!0,writable:!0,value:n}):t[e]=n;class zx extends ir{refresh(){const t=this.editor,e=t.plugins.get("ImageUtils"),n=t.model.document.selection.getSelectedElement();this.isEnabled=e.isImageAllowed()||e.isImage(n)}execute(t){const e=_o(t.file),n=this.editor.model.document.selection,i=this.editor.plugins.get("ImageUtils"),o=Object.fromEntries(n.getAttributes());e.forEach(((t,e)=>{const r=n.getSelectedElement();if(e&&r&&i.isImage(r)){const e=this.editor.model.createPositionAfter(r);this._uploadImage(t,o,e)}else this._uploadImage(t,o)}))}_uploadImage(t,e,n){const i=this.editor,o=i.plugins.get(o_).createLoader(t),r=i.plugins.get("ImageUtils");var s,a;o&&r.insertImage((s=((t,e)=>{for(var n in e||(e={}))Fx.call(e,n)&&Ox(t,n,e[n]);if(Vx)for(var n of Vx(e))Lx.call(e,n)&&Ox(t,n,e[n]);return t})({},e),a={uploadId:o.id},Px(s,Rx(a))),n)}}class Mx extends er{constructor(t){super(t),t.config.define("image",{upload:{types:["jpeg","png","gif","bmp","webp","tiff"]}}),this._uploadImageElements=new Map}static get requires(){return[o_,sk,RC,xy]}static get pluginName(){return"ImageUploadEditing"}init(){const t=this.editor,e=t.model.document,n=t.conversion,i=t.plugins.get(o_),o=t.plugins.get("ImageUtils"),r=t.plugins.get("ClipboardPipeline"),s=px(t.config.get("image.upload.types")),a=new zx(t);t.commands.add("uploadImage",a),t.commands.add("imageUpload",a),n.for("upcast").attributeToAttribute({view:{name:"img",key:"uploadId"},model:"uploadId"}),this.listenTo(t.editing.view.document,"clipboardInput",((e,n)=>{if(i=n.dataTransfer,Array.from(i.types).includes("text/html")&&""!==i.getData("text/html"))return;var i;const o=Array.from(n.dataTransfer.files).filter((t=>!!t&&s.test(t.type)));o.length&&(e.stop(),t.model.change((e=>{n.targetRanges&&e.setSelection(n.targetRanges.map((e=>t.editing.mapper.toModelRange(e)))),t.execute("uploadImage",{file:o})})))})),this.listenTo(r,"inputTransformation",((e,n)=>{const r=Array.from(t.editing.view.createRangeIn(n.content)).map((t=>t.item)).filter((t=>function(t,e){return!(!t.isInlineImageView(e)||!e.getAttribute("src")||!e.getAttribute("src").match(/^data:image\/\w+;base64,/g)&&!e.getAttribute("src").match(/^blob:/g))}(o,t)&&!t.getAttribute("uploadProcessed"))).map((t=>({promise:fx(t),imageElement:t})));if(!r.length)return;const s=new Au(t.editing.view.document);for(const t of r){s.setAttribute("uploadProcessed",!0,t.imageElement);const e=i.createLoader(t.promise);e&&(s.setAttribute("src","",t.imageElement),s.setAttribute("uploadId",e.id,t.imageElement))}})),t.editing.view.document.on("dragover",((t,e)=>{e.preventDefault()})),e.on("change",(()=>{const n=e.differ.getChanges({includeChangesInGraveyard:!0}).reverse(),o=new Set;for(const e of n)if("insert"==e.type&&"$text"!=e.name){const n=e.position.nodeAfter,r="$graveyard"==e.position.root.rootName;for(const e of Nx(t,n)){const t=e.getAttribute("uploadId");if(!t)continue;const n=i.loaders.get(t);n&&(r?o.has(t)||n.abort():(o.add(t),this._uploadImageElements.set(t,e),"idle"==n.status&&this._readAndUpload(n)))}}})),this.on("uploadComplete",((t,{imageElement:e,data:n})=>{const i=n.urls?n.urls:n;this.editor.model.change((t=>{t.setAttribute("src",i.default,e),this._parseAndSetSrcsetAttributeOnImage(i,e,t),o.setImageNaturalSizeAttributes(e)}))}),{priority:"low"})}afterInit(){const t=this.editor.model.schema;this.editor.plugins.has("ImageBlockEditing")&&t.extend("imageBlock",{allowAttributes:["uploadId","uploadStatus"]}),this.editor.plugins.has("ImageInlineEditing")&&t.extend("imageInline",{allowAttributes:["uploadId","uploadStatus"]})}_readAndUpload(t){const e=this.editor,n=e.model,i=e.locale.t,o=e.plugins.get(o_),r=e.plugins.get(sk),a=e.plugins.get("ImageUtils"),c=this._uploadImageElements;return n.enqueueChange({isUndoable:!1},(e=>{e.setAttribute("uploadStatus","reading",c.get(t.id))})),t.read().then((()=>{const o=t.upload(),r=c.get(t.id);if(s.isSafari){const t=e.editing.mapper.toViewElement(r),n=a.findViewImgElement(t);e.editing.view.once("render",(()=>{if(!n.parent)return;const t=e.editing.view.domConverter.mapViewToDom(n.parent);if(!t)return;const i=t.style.display;t.style.display="none",t._ckHack=t.offsetHeight,t.style.display=i}))}return e.ui&&e.ui.ariaLiveAnnouncer.announce(i("Uploading image")),n.enqueueChange({isUndoable:!1},(t=>{t.setAttribute("uploadStatus","uploading",r)})),o})).then((o=>{n.enqueueChange({isUndoable:!1},(n=>{const r=c.get(t.id);n.setAttribute("uploadStatus","complete",r),e.ui&&e.ui.ariaLiveAnnouncer.announce(i("Image upload complete")),this.fire("uploadComplete",{data:o,imageElement:r})})),l()})).catch((o=>{if(e.ui&&e.ui.ariaLiveAnnouncer.announce(i("Error during image upload")),"error"!==t.status&&"aborted"!==t.status)throw o;"error"==t.status&&o&&r.showWarning(o,{title:i("Upload failed"),namespace:"upload"}),n.enqueueChange({isUndoable:!1},(e=>{e.remove(c.get(t.id))})),l()}));function l(){n.enqueueChange({isUndoable:!1},(e=>{const n=c.get(t.id);e.removeAttribute("uploadId",n),e.removeAttribute("uploadStatus",n),c.delete(t.id)})),o.destroyLoader(t)}}_parseAndSetSrcsetAttributeOnImage(t,e,n){let i=0;const o=Object.keys(t).filter((t=>{const e=parseInt(t,10);if(!isNaN(e))return i=Math.max(i,e),!0})).map((e=>`${t[e]} ${e}w`)).join(", ");if(""!=o){const t={srcset:o};e.hasAttribute("width")||e.hasAttribute("height")||(t.width=i),n.setAttributes(t,e)}}}function Nx(t,e){const n=t.plugins.get("ImageUtils");return Array.from(t.model.createRangeOn(e)).filter((t=>n.isImage(t.item))).map((t=>t.item))}const Hx=function(t,e){return function(n,i){if(null==n)return n;if(!sn(n))return t(n,i);for(var o=n.length,r=e?o:-1,s=Object(n);(e?r--:++r{e.setAttribute("resizedWidth",t.width,o),e.removeAttribute("resizedHeight",o),i.setImageNaturalSizeAttributes(o)}))}}class Ux extends er{static get requires(){return[xy]}static get pluginName(){return"ImageResizeEditing"}constructor(t){super(t),t.config.define("image",{resizeUnit:"%",resizeOptions:[{name:"resizeImage:original",value:null,icon:"original"},{name:"resizeImage:custom",value:"custom",icon:"custom"},{name:"resizeImage:25",value:"25",icon:"small"},{name:"resizeImage:50",value:"50",icon:"medium"},{name:"resizeImage:75",value:"75",icon:"large"}]})}init(){const t=this.editor,e=new Wx(t);this._registerConverters("imageBlock"),this._registerConverters("imageInline"),t.commands.add("resizeImage",e),t.commands.add("imageResize",e)}afterInit(){this._registerSchema()}_registerSchema(){this.editor.plugins.has("ImageBlockEditing")&&this.editor.model.schema.extend("imageBlock",{allowAttributes:["resizedWidth","resizedHeight"]}),this.editor.plugins.has("ImageInlineEditing")&&this.editor.model.schema.extend("imageInline",{allowAttributes:["resizedWidth","resizedHeight"]})}_registerConverters(t){const e=this.editor,n=e.plugins.get("ImageUtils");e.conversion.for("downcast").add((e=>e.on(`attribute:resizedWidth:${t}`,((t,e,n)=>{if(!n.consumable.consume(e.item,t.name))return;const i=n.writer,o=n.mapper.toViewElement(e.item);null!==e.attributeNewValue?(i.setStyle("width",e.attributeNewValue,o),i.addClass("image_resized",o)):(i.removeStyle("width",o),i.removeClass("image_resized",o))})))),e.conversion.for("dataDowncast").attributeToAttribute({model:{name:t,key:"resizedHeight"},view:t=>({key:"style",value:{height:t}})}),e.conversion.for("editingDowncast").add((e=>e.on(`attribute:resizedHeight:${t}`,((e,i,o)=>{if(!o.consumable.consume(i.item,e.name))return;const r=o.writer,s=o.mapper.toViewElement(i.item),a="imageInline"===t?n.findViewImgElement(s):s;null!==i.attributeNewValue?r.setStyle("height",i.attributeNewValue,a):r.removeStyle("height",a)})))),e.conversion.for("upcast").attributeToAttribute({view:{name:"imageBlock"===t?"figure":"img",styles:{width:/.+/}},model:{key:"resizedWidth",value:t=>by(t)?null:t.getStyle("width")}}),e.conversion.for("upcast").attributeToAttribute({view:{name:"imageBlock"===t?"figure":"img",styles:{height:/.+/}},model:{key:"resizedHeight",value:t=>by(t)?null:t.getStyle("height")}})}}var $x=Object.defineProperty,Gx=Object.defineProperties,Kx=Object.getOwnPropertyDescriptors,Jx=Object.getOwnPropertySymbols,Zx=Object.prototype.hasOwnProperty,Yx=Object.prototype.propertyIsEnumerable,Qx=(t,e,n)=>e in t?$x(t,e,{enumerable:!0,configurable:!0,writable:!0,value:n}):t[e]=n,Xx=(t,e)=>{for(var n in e||(e={}))Zx.call(e,n)&&Qx(t,n,e[n]);if(Jx)for(var n of Jx(e))Yx.call(e,n)&&Qx(t,n,e[n]);return t},tE=(t,e)=>Gx(t,Kx(e));const eE={small:ym.objectSizeSmall,medium:ym.objectSizeMedium,large:ym.objectSizeLarge,custom:ym.objectSizeCustom,original:ym.objectSizeFull};class nE extends er{constructor(t){super(t),this._resizeUnit=t.config.get("image.resizeUnit")}static get requires(){return[Ux]}static get pluginName(){return"ImageResizeButtons"}init(){const t=this.editor,e=t.config.get("image.resizeOptions"),n=t.commands.get("resizeImage");this.bind("isEnabled").to(n);for(const t of e)this._registerImageResizeButton(t);this._registerImageResizeDropdown(e)}_registerImageResizeButton(t){const e=this.editor,{name:n,value:i,icon:o}=t;e.ui.componentFactory.add(n,(n=>{const r=new mg(n),s=e.commands.get("resizeImage"),a=this._getOptionLabelValue(t,!0);if(!eE[o])throw new w("imageresizebuttons-missing-icon",e,t);if(r.set({label:a,icon:eE[o],tooltip:a,isToggleable:!0}),r.bind("isEnabled").to(this),e.plugins.has("ImageCustomResizeUI")&&iE(t)){const t=e.plugins.get("ImageCustomResizeUI");this.listenTo(r,"execute",(()=>{t._showForm(this._resizeUnit)}))}else{const t=i?i+this._resizeUnit:null;r.bind("isOn").to(s,"value",oE(t)),this.listenTo(r,"execute",(()=>{e.execute("resizeImage",{width:t})}))}return r}))}_registerImageResizeDropdown(t){const e=this.editor,n=e.t,i=t.find((t=>!t.value)),o=o=>{const r=e.commands.get("resizeImage"),s=Ip(o,Qg),a=s.buttonView,c=n("Resize image");return a.set({tooltip:c,commandValue:i.value,icon:eE.medium,isToggleable:!0,label:this._getOptionLabelValue(i),withText:!0,class:"ck-resize-image-button",ariaLabel:c,ariaLabelledBy:void 0}),a.bind("label").to(r,"value",(t=>t&&t.width?t.width:this._getOptionLabelValue(i))),s.bind("isEnabled").to(this),Vp(s,(()=>this._getResizeDropdownListItemDefinitions(t,r)),{ariaLabel:n("Image resize list"),role:"menu"}),this.listenTo(s,"execute",(t=>{"onClick"in t.source?t.source.onClick():(e.execute(t.source.commandName,{width:t.source.commandValue}),e.editing.view.focus())})),s};e.ui.componentFactory.add("resizeImage",o),e.ui.componentFactory.add("imageResize",o)}_getOptionLabelValue(t,e=!1){const n=this.editor.t;return t.label?t.label:e?iE(t)?n("Custom image size"):t.value?n("Resize image to %0",t.value+this._resizeUnit):n("Resize image to the original size"):iE(t)?n("Custom"):t.value?t.value+this._resizeUnit:n("Original")}_getResizeDropdownListItemDefinitions(t,e){const{editor:n}=this,i=new Uo,o=t.map((t=>iE(t)?tE(Xx({},t),{valueWithUnits:"custom"}):t.value?tE(Xx({},t),{valueWithUnits:`${t.value}${this._resizeUnit}`}):tE(Xx({},t),{valueWithUnits:null})));for(const t of o){let r=null;if(n.plugins.has("ImageCustomResizeUI")&&iE(t)){const i=n.plugins.get("ImageCustomResizeUI");r={type:"button",model:new ak({label:this._getOptionLabelValue(t),role:"menuitemradio",withText:!0,icon:null,onClick:()=>{i._showForm(this._resizeUnit)}})};const s=qx(o,"valueWithUnits");r.model.bind("isOn").to(e,"value",rE(s))}else r={type:"button",model:new ak({commandName:"resizeImage",commandValue:t.valueWithUnits,label:this._getOptionLabelValue(t),role:"menuitemradio",withText:!0,icon:null})},r.model.bind("isOn").to(e,"value",oE(t.valueWithUnits));r.model.bind("isEnabled").to(e,"isEnabled"),i.add(r)}return i}}function iE(t){return"custom"===t.value}function oE(t){return e=>null===t&&e===t||null!==e&&e.width===t}function rE(t){return e=>!t.some((t=>oE(t)(e)))}const sE="image_resized";class aE extends er{static get requires(){return[Sv,xy]}static get pluginName(){return"ImageResizeHandles"}init(){const t=this.editor.commands.get("resizeImage");this.bind("isEnabled").to(t),this._setupResizerCreator()}_setupResizerCreator(){const t=this.editor,e=t.editing.view,n=t.plugins.get("ImageUtils");e.addObserver(Oy),this.listenTo(e.document,"imageLoaded",((i,o)=>{if(!o.target.matches("figure.image.ck-widget > img,figure.image.ck-widget > picture > img,figure.image.ck-widget > a > img,figure.image.ck-widget > a > picture > img,span.image-inline.ck-widget > img,span.image-inline.ck-widget > picture > img"))return;const r=t.editing.view.domConverter,s=r.domToView(o.target),a=n.getImageWidgetFromImageView(s);let c=this.editor.plugins.get(Sv).getResizerByViewElement(a);if(c)return void c.redraw();const l=t.editing.mapper,d=l.toModelElement(a);c=t.plugins.get(Sv).attachTo({unit:t.config.get("image.resizeUnit"),modelElement:d,viewElement:a,editor:t,getHandleHost:t=>t.querySelector("img"),getResizeHost:()=>r.mapViewToDom(l.toViewElement(d)),isCentered:()=>"alignCenter"==d.getAttribute("imageStyle"),onCommit(n){e.change((t=>{t.removeClass(sE,a)})),t.execute("resizeImage",{width:n})}}),c.on("updateSize",(()=>{a.hasClass(sE)||e.change((t=>{t.addClass(sE,a)}));const t="imageInline"===d.name?s:a;t.getStyle("height")&&e.change((e=>{e.removeStyle("height",t)}))})),c.bind("isEnabled").to(this)}))}}function cE(t){if(!t)return null;const[,e,n]=t.trim().match(/([.,\d]+)(%|px)$/)||[],i=Number.parseFloat(e);return Number.isNaN(i)?null:{value:i,unit:n}}function lE(t,e,n){return"px"===n?{value:e.value,unit:"px"}:{value:e.value/t*100,unit:"%"}}function dE(t){const{editing:e}=t,n=t.plugins.get("ImageUtils").getClosestSelectedImageElement(t.model.document.selection);if(!n)return null;const i=e.mapper.toViewElement(n);return{model:n,view:i,dom:e.view.domConverter.mapViewToDom(i)}}var hE=n(4642),uE={injectType:"singletonStyleTag",attributes:{"data-cke":!0},insert:"head",singleton:!0};gr()(hE.A,uE);hE.A.locals;class mE extends Jm{constructor(t,e,n){super(t);const i=this.locale.t;this.focusTracker=new Go,this.keystrokes=new Ko,this.unit=e,this.labeledInput=this._createLabeledInputView(),this.saveButtonView=this._createButton(i("Save"),ym.check,"ck-button-save"),this.saveButtonView.type="submit",this.cancelButtonView=this._createButton(i("Cancel"),ym.cancel,"ck-button-cancel","cancel"),this._focusables=new xm,this._validators=n,this._focusCycler=new Xg({focusables:this._focusables,focusTracker:this.focusTracker,keystrokeHandler:this.keystrokes,actions:{focusPrevious:"shift + tab",focusNext:"tab"}}),this.setTemplate({tag:"form",attributes:{class:["ck","ck-image-custom-resize-form","ck-responsive-form"],tabindex:"-1"},children:[this.labeledInput,this.saveButtonView,this.cancelButtonView]})}render(){super.render(),this.keystrokes.listenTo(this.element),Qm({view:this}),[this.labeledInput,this.saveButtonView,this.cancelButtonView].forEach((t=>{this._focusables.add(t),this.focusTracker.add(t.element)}))}destroy(){super.destroy(),this.focusTracker.destroy(),this.keystrokes.destroy()}_createButton(t,e,n,i){const o=new mg(this.locale);return o.set({label:t,icon:e,tooltip:!0}),o.extendTemplate({attributes:{class:n}}),i&&o.delegate("execute").to(this,i),o}_createLabeledInputView(){const t=this.locale.t,e=new zg(this.locale,Mp);return e.label=t("Resize image (in %0)",this.unit),e.fieldView.set({step:.1}),e}isValid(){this.resetFormStatus();for(const t of this._validators){const e=t(this);if(e)return this.labeledInput.errorText=e,!1}return!0}resetFormStatus(){this.labeledInput.errorText=null}get rawSize(){const{element:t}=this.labeledInput.fieldView;return t?t.value:null}get parsedSize(){const{rawSize:t}=this;if(null===t)return null;const e=Number.parseFloat(t);return Number.isNaN(e)?null:e}get sizeWithUnits(){const{parsedSize:t,unit:e}=this;return null===t?null:`${t}${e}`}}class gE extends er{static get requires(){return[mk]}static get pluginName(){return"ImageCustomResizeUI"}destroy(){super.destroy(),this._form&&this._form.destroy()}_createForm(t){const e=this.editor;this._balloon=this.editor.plugins.get("ContextualBalloon"),this._form=new(Ym(mE))(e.locale,t,function(t){const e=t.t;return[t=>""===t.rawSize.trim()?e("The value must not be empty."):null===t.parsedSize?e("The value should be a plain number."):void 0]}(e)),this._form.render(),this.listenTo(this._form,"submit",(()=>{this._form.isValid()&&(e.execute("resizeImage",{width:this._form.sizeWithUnits}),this._hideForm(!0))})),this.listenTo(this._form.labeledInput,"change:errorText",(()=>{e.ui.update()})),this.listenTo(this._form,"cancel",(()=>{this._hideForm(!0)})),this._form.keystrokes.set("Esc",((t,e)=>{this._hideForm(!0),e()})),Zm({emitter:this._form,activator:()=>this._isVisible,contextElements:()=>[this._balloon.view.element],callback:()=>this._hideForm()})}_showForm(t){if(this._isVisible)return;this._form||this._createForm(t);const e=this.editor,n=this._form.labeledInput;this._form.disableCssTransitions(),this._form.resetFormStatus(),this._isInBalloon||this._balloon.add({view:this._form,position:Py(e)});const i=function(t,e){const n=dE(t);if(!n)return null;const i=cE(n.model.getAttribute("resizedWidth")||null);return i?i.unit===e?i:lE(ZC(n.dom),{unit:"px",value:new Li(n.dom).width},e):null}(e,t),o=i?i.value.toFixed(1):"",r=function(t,e){const n=dE(t);if(!n)return null;const i=ZC(n.dom),o=cE(window.getComputedStyle(n.dom).minWidth)||{value:1,unit:"px"};return{unit:e,lower:Math.max(.1,lE(i,o,e).value),upper:"px"===e?i:100}}(e,t);n.fieldView.value=n.fieldView.element.value=o,r&&Object.assign(n.fieldView,{min:r.lower.toFixed(1),max:Math.ceil(r.upper).toFixed(1)}),this._form.labeledInput.fieldView.select(),this._form.enableCssTransitions()}_hideForm(t=!1){this._isInBalloon&&(this._form.focusTracker.isFocused&&this._form.saveButtonView.focus(),this._balloon.remove(this._form),t&&this.editor.editing.view.focus())}get _isVisible(){return!!this._balloon&&this._balloon.visibleView===this._form}get _isInBalloon(){return!!this._balloon&&this._balloon.hasView(this._form)}}var pE=n(3469),fE={injectType:"singletonStyleTag",attributes:{"data-cke":!0},insert:"head",singleton:!0};gr()(pE.A,fE);pE.A.locals;class bE extends ir{constructor(t,e){super(t),this._defaultStyles={imageBlock:!1,imageInline:!1},this._styles=new Map(e.map((t=>{if(t.isDefault)for(const e of t.modelElements)this._defaultStyles[e]=t.name;return[t.name,t]})))}refresh(){const t=this.editor.plugins.get("ImageUtils").getClosestSelectedImageElement(this.editor.model.document.selection);this.isEnabled=!!t,this.isEnabled?t.hasAttribute("imageStyle")?this.value=t.getAttribute("imageStyle"):this.value=this._defaultStyles[t.name]:this.value=!1}execute(t={}){const e=this.editor,n=e.model,i=e.plugins.get("ImageUtils");n.change((e=>{const o=t.value,{setImageSizes:r=!0}=t;let s=i.getClosestSelectedImageElement(n.document.selection);o&&this.shouldConvertImageType(o,s)&&(this.editor.execute(i.isBlockImage(s)?"imageTypeInline":"imageTypeBlock",{setImageSizes:r}),s=i.getClosestSelectedImageElement(n.document.selection)),!o||this._styles.get(o).isDefault?e.removeAttribute("imageStyle",s):e.setAttribute("imageStyle",o,s),r&&i.setImageNaturalSizeAttributes(s)}))}shouldConvertImageType(t,e){return!this._styles.get(t).modelElements.includes(e.name)}}var kE=Object.defineProperty,wE=Object.getOwnPropertySymbols,_E=Object.prototype.hasOwnProperty,AE=Object.prototype.propertyIsEnumerable,CE=(t,e,n)=>e in t?kE(t,e,{enumerable:!0,configurable:!0,writable:!0,value:n}):t[e]=n,vE=(t,e)=>{for(var n in e||(e={}))_E.call(e,n)&&CE(t,n,e[n]);if(wE)for(var n of wE(e))AE.call(e,n)&&CE(t,n,e[n]);return t};const{objectFullWidth:yE,objectInline:xE,objectLeft:EE,objectRight:DE,objectCenter:BE,objectBlockLeft:SE,objectBlockRight:TE}=ym,IE={get inline(){return{name:"inline",title:"In line",icon:xE,modelElements:["imageInline"],isDefault:!0}},get alignLeft(){return{name:"alignLeft",title:"Left aligned image",icon:EE,modelElements:["imageBlock","imageInline"],className:"image-style-align-left"}},get alignBlockLeft(){return{name:"alignBlockLeft",title:"Left aligned image",icon:SE,modelElements:["imageBlock"],className:"image-style-block-align-left"}},get alignCenter(){return{name:"alignCenter",title:"Centered image",icon:BE,modelElements:["imageBlock"],className:"image-style-align-center"}},get alignRight(){return{name:"alignRight",title:"Right aligned image",icon:DE,modelElements:["imageBlock","imageInline"],className:"image-style-align-right"}},get alignBlockRight(){return{name:"alignBlockRight",title:"Right aligned image",icon:TE,modelElements:["imageBlock"],className:"image-style-block-align-right"}},get block(){return{name:"block",title:"Centered image",icon:BE,modelElements:["imageBlock"],isDefault:!0}},get side(){return{name:"side",title:"Side image",icon:DE,modelElements:["imageBlock"],className:"image-style-side"}}},PE={full:yE,left:SE,right:TE,center:BE,inlineLeft:EE,inlineRight:DE,inline:xE},RE=[{name:"imageStyle:wrapText",title:"Wrap text",defaultItem:"imageStyle:alignLeft",items:["imageStyle:alignLeft","imageStyle:alignRight"]},{name:"imageStyle:breakText",title:"Break text",defaultItem:"imageStyle:block",items:["imageStyle:alignBlockLeft","imageStyle:block","imageStyle:alignBlockRight"]}];function VE(t){_("image-style-configuration-definition-invalid",t)}const FE={normalizeStyles:function(t){return(t.configuredStyles.options||[]).map((t=>function(t){t="string"==typeof t?IE[t]?vE({},IE[t]):{name:t}:function(t,e){const n=vE({},e);for(const i in t)Object.prototype.hasOwnProperty.call(e,i)||(n[i]=t[i]);return n}(IE[t.name],t);"string"==typeof t.icon&&(t.icon=PE[t.icon]||t.icon);return t}(t))).filter((e=>function(t,{isBlockPluginLoaded:e,isInlinePluginLoaded:n}){const{modelElements:i,name:o}=t;if(!(i&&i.length&&o))return VE({style:t}),!1;{const o=[e?"imageBlock":null,n?"imageInline":null];if(!i.some((t=>o.includes(t))))return _("image-style-missing-dependency",{style:t,missingPlugins:i.map((t=>"imageBlock"===t?"ImageBlockEditing":"ImageInlineEditing"))}),!1}return!0}(e,t)))},getDefaultStylesConfiguration:function(t,e){return t&&e?{options:["inline","alignLeft","alignRight","alignCenter","alignBlockLeft","alignBlockRight","block","side"]}:t?{options:["block","side"]}:e?{options:["inline","alignLeft","alignRight"]}:{}},getDefaultDropdownDefinitions:function(t){return t.has("ImageBlockEditing")&&t.has("ImageInlineEditing")?[...RE]:[]},warnInvalidStyle:VE,DEFAULT_OPTIONS:IE,DEFAULT_ICONS:PE,DEFAULT_DROPDOWN_DEFINITIONS:RE};function LE(t,e){for(const n of e)if(n.name===t)return n}class OE extends er{static get pluginName(){return"ImageStyleEditing"}static get requires(){return[xy]}init(){const{normalizeStyles:t,getDefaultStylesConfiguration:e}=FE,n=this.editor,i=n.plugins.has("ImageBlockEditing"),o=n.plugins.has("ImageInlineEditing");n.config.define("image.styles",e(i,o)),this.normalizedStyles=t({configuredStyles:n.config.get("image.styles"),isBlockPluginLoaded:i,isInlinePluginLoaded:o}),this._setupConversion(i,o),this._setupPostFixer(),n.commands.add("imageStyle",new bE(n,this.normalizedStyles))}_setupConversion(t,e){const n=this.editor,i=n.model.schema,o=(r=this.normalizedStyles,(t,e,n)=>{if(!n.consumable.consume(e.item,t.name))return;const i=LE(e.attributeNewValue,r),o=LE(e.attributeOldValue,r),s=n.mapper.toViewElement(e.item),a=n.writer;o&&a.removeClass(o.className,s),i&&a.addClass(i.className,s)});var r;const s=function(t){const e={imageInline:t.filter((t=>!t.isDefault&&t.modelElements.includes("imageInline"))),imageBlock:t.filter((t=>!t.isDefault&&t.modelElements.includes("imageBlock")))};return(t,n,i)=>{if(!n.modelRange)return;const o=n.viewItem,r=$o(n.modelRange.getItems());if(r&&i.schema.checkAttribute(r,"imageStyle"))for(const t of e[r.name])i.consumable.consume(o,{classes:t.className})&&i.writer.setAttribute("imageStyle",t.name,r)}}(this.normalizedStyles);n.editing.downcastDispatcher.on("attribute:imageStyle",o),n.data.downcastDispatcher.on("attribute:imageStyle",o),t&&(i.extend("imageBlock",{allowAttributes:"imageStyle"}),n.data.upcastDispatcher.on("element:figure",s,{priority:"low"})),e&&(i.extend("imageInline",{allowAttributes:"imageStyle"}),n.data.upcastDispatcher.on("element:img",s,{priority:"low"}))}_setupPostFixer(){const t=this.editor,e=t.model.document,n=t.plugins.get(xy),i=new Map(this.normalizedStyles.map((t=>[t.name,t])));e.registerPostFixer((t=>{let o=!1;for(const r of e.differ.getChanges())if("insert"==r.type||"attribute"==r.type&&"imageStyle"==r.attributeKey){let e="insert"==r.type?r.position.nodeAfter:r.range.start.nodeAfter;if(e&&e.is("element","paragraph")&&e.childCount>0&&(e=e.getChild(0)),!n.isImage(e))continue;const s=e.getAttribute("imageStyle");if(!s)continue;const a=i.get(s);a&&a.modelElements.includes(e.name)||(t.removeAttribute("imageStyle",e),o=!0)}return o}))}}var zE=n(6386),ME={injectType:"singletonStyleTag",attributes:{"data-cke":!0},insert:"head",singleton:!0};gr()(zE.A,ME);zE.A.locals;class NE extends er{static get requires(){return[OE]}static get pluginName(){return"ImageStyleUI"}get localizedDefaultStylesTitles(){const t=this.editor.t;return{"Wrap text":t("Wrap text"),"Break text":t("Break text"),"In line":t("In line"),"Full size image":t("Full size image"),"Side image":t("Side image"),"Left aligned image":t("Left aligned image"),"Centered image":t("Centered image"),"Right aligned image":t("Right aligned image")}}init(){const t=this.editor.plugins,e=this.editor.config.get("image.toolbar")||[],n=HE(t.get("ImageStyleEditing").normalizedStyles,this.localizedDefaultStylesTitles);for(const t of n)this._createButton(t);const i=HE([...e.filter(O),...FE.getDefaultDropdownDefinitions(t)],this.localizedDefaultStylesTitles);for(const t of i)this._createDropdown(t,n)}_createDropdown(t,e){const n=this.editor.ui.componentFactory;n.add(t.name,(i=>{let o;const{defaultItem:r,items:s,title:a}=t,c=s.filter((t=>e.find((({name:e})=>jE(e)===t)))).map((t=>{const e=n.create(t);return t===r&&(o=e),e}));s.length!==c.length&&FE.warnInvalidStyle({dropdown:t});const l=Ip(i,Ep),d=l.buttonView,h=d.arrowView;return Pp(l,c,{enableActiveItemFocusOnDropdownOpen:!0}),d.set({label:qE(a,o.label),class:null,tooltip:!0}),h.unbind("label"),h.set({label:a}),d.bind("icon").toMany(c,"isOn",((...t)=>{const e=t.findIndex(Bo);return e<0?o.icon:c[e].icon})),d.bind("label").toMany(c,"isOn",((...t)=>{const e=t.findIndex(Bo);return qE(a,e<0?o.label:c[e].label)})),d.bind("isOn").toMany(c,"isOn",((...t)=>t.some(Bo))),d.bind("class").toMany(c,"isOn",((...t)=>t.some(Bo)?"ck-splitbutton_flatten":void 0)),d.on("execute",(()=>{c.some((({isOn:t})=>t))?l.isOpen=!l.isOpen:o.fire("execute")})),l.bind("isEnabled").toMany(c,"isEnabled",((...t)=>t.some(Bo))),this.listenTo(l,"execute",(()=>{this.editor.editing.view.focus()})),l}))}_createButton(t){const e=t.name;this.editor.ui.componentFactory.add(jE(e),(n=>{const i=this.editor.commands.get("imageStyle"),o=new mg(n);return o.set({label:t.title,icon:t.icon,tooltip:!0,isToggleable:!0}),o.bind("isEnabled").to(i,"isEnabled"),o.bind("isOn").to(i,"value",(t=>t===e)),o.on("execute",this._executeCommand.bind(this,e)),o}))}_executeCommand(t){this.editor.execute("imageStyle",{value:t}),this.editor.editing.view.focus()}}function HE(t,e){for(const n of t)e[n.title]&&(n.title=e[n.title]);return t}function jE(t){return`imageStyle:${t}`}function qE(t,e){return(t?t+": ":"")+e}class WE{constructor(){this._definitions=new Set}get length(){return this._definitions.size}add(t){Array.isArray(t)?t.forEach((t=>this._definitions.add(t))):this._definitions.add(t)}getDispatcher(){return t=>{t.on("attribute:linkHref",((t,e,n)=>{if(!n.consumable.test(e.item,"attribute:linkHref"))return;if(!e.item.is("selection")&&!n.schema.isInline(e.item))return;const i=n.writer,o=i.document.selection;for(const t of this._definitions){const r=i.createAttributeElement("a",t.attributes,{priority:5});t.classes&&i.addClass(t.classes,r);for(const e in t.styles)i.setStyle(e,t.styles[e],r);i.setCustomProperty("link",!0,r),t.callback(e.attributeNewValue)?e.item.is("selection")?i.wrap(o.getFirstRange(),r):i.wrap(n.mapper.toViewRange(e.range),r):i.unwrap(n.mapper.toViewRange(e.range),r)}}),{priority:"high"})}}getDispatcherForLinkedImage(){return t=>{t.on("attribute:linkHref:imageBlock",((t,e,{writer:n,mapper:i})=>{const o=i.toViewElement(e.item),r=Array.from(o.getChildren()).find((t=>t.is("element","a")));for(const t of this._definitions){const i=Jo(t.attributes);if(t.callback(e.attributeNewValue)){for(const[t,e]of i)"class"===t?n.addClass(e,r):n.setAttribute(t,e,r);t.classes&&n.addClass(t.classes,r);for(const e in t.styles)n.setStyle(e,t.styles[e],r)}else{for(const[t,e]of i)"class"===t?n.removeClass(e,r):n.removeAttribute(t,r);t.classes&&n.removeClass(t.classes,r);for(const e in t.styles)n.removeStyle(e,r)}}}))}}}const UE=function(t,e,n){var i=t.length;return n=void 0===n?i:n,!e&&n>=i?t:ts(t,e,n)};var $E=RegExp("[\\u200d\\ud800-\\udfff\\u0300-\\u036f\\ufe20-\\ufe2f\\u20d0-\\u20ff\\ufe0e\\ufe0f]");const GE=function(t){return $E.test(t)};const KE=function(t){return t.split("")};var JE="\\ud800-\\udfff",ZE="["+JE+"]",YE="[\\u0300-\\u036f\\ufe20-\\ufe2f\\u20d0-\\u20ff]",QE="\\ud83c[\\udffb-\\udfff]",XE="[^"+JE+"]",tD="(?:\\ud83c[\\udde6-\\uddff]){2}",eD="[\\ud800-\\udbff][\\udc00-\\udfff]",nD="(?:"+YE+"|"+QE+")"+"?",iD="[\\ufe0e\\ufe0f]?",oD=iD+nD+("(?:\\u200d(?:"+[XE,tD,eD].join("|")+")"+iD+nD+")*"),rD="(?:"+[XE+YE+"?",YE,tD,eD,ZE].join("|")+")",sD=RegExp(QE+"(?="+QE+")|"+rD+oD,"g");const aD=function(t){return t.match(sD)||[]};const cD=function(t){return GE(t)?aD(t):KE(t)};const lD=function(t){return function(e){e=Jr(e);var n=GE(e)?cD(e):void 0,i=n?n[0]:e.charAt(0),o=n?UE(n,1).join(""):e.slice(1);return i[t]()+o}}("toUpperCase"),dD=/[\u0000-\u0020\u00A0\u1680\u180E\u2000-\u2029\u205f\u3000]/g,hD=/^[\S]+@((?![-_])(?:[-\w\u00a1-\uffff]{0,63}[^-_]\.))+(?:[a-z\u00a1-\uffff]{2,})$/i,uD=/^((\w+:(\/{2,})?)|(\W))/i,mD=["https?","ftps?","mailto"],gD="Ctrl+K";function pD(t,{writer:e}){const n=e.createAttributeElement("a",{href:t},{priority:5});return e.setCustomProperty("link",!0,n),n}function fD(t,e=mD){const n=String(t),i=e.join("|");return function(t,e){const n=t.replace(dD,"");return!!n.match(e)}(n,new RegExp(`${"^(?:(?:):|[^a-z]|[a-z+.-]+(?:[^a-z+.:-]|$))".replace("",i)}`,"i"))?n:"#"}function bD(t,e){return!!t&&e.checkAttribute(t.name,"linkHref")}function kD(t,e){const n=(i=t,hD.test(i)?"mailto:":e);var i;const o=!!n&&!wD(t);return t&&o?n+t:t}function wD(t){return uD.test(t)}function _D(t){window.open(t,"_blank","noopener")}class AD extends ir{constructor(){super(...arguments),this.manualDecorators=new Uo,this.automaticDecorators=new WE}restoreManualDecoratorStates(){for(const t of this.manualDecorators)t.value=this._getDecoratorStateFromModel(t.id)}refresh(){const t=this.editor.model,e=t.document.selection,n=e.getSelectedElement()||$o(e.getSelectedBlocks());bD(n,t.schema)?(this.value=n.getAttribute("linkHref"),this.isEnabled=t.schema.checkAttribute(n,"linkHref")):(this.value=e.getAttribute("linkHref"),this.isEnabled=t.schema.checkAttributeInSelection(e,"linkHref"));for(const t of this.manualDecorators)t.value=this._getDecoratorStateFromModel(t.id)}execute(t,e={}){const n=this.editor.model,i=n.document.selection,o=[],r=[];for(const t in e)e[t]?o.push(t):r.push(t);n.change((e=>{if(i.isCollapsed){const s=i.getFirstPosition();if(i.hasAttribute("linkHref")){const a=CD(i);let c=H_(s,"linkHref",i.getAttribute("linkHref"),n);i.getAttribute("linkHref")===a&&(c=this._updateLinkContent(n,e,c,t)),e.setAttribute("linkHref",t,c),o.forEach((t=>{e.setAttribute(t,!0,c)})),r.forEach((t=>{e.removeAttribute(t,c)})),e.setSelection(e.createPositionAfter(c.end.nodeBefore))}else if(""!==t){const r=Jo(i.getAttributes());r.set("linkHref",t),o.forEach((t=>{r.set(t,!0)}));const{end:a}=n.insertContent(e.createText(t,r),s);e.setSelection(a)}["linkHref",...o,...r].forEach((t=>{e.removeSelectionAttribute(t)}))}else{const s=n.schema.getValidRanges(i.getRanges(),"linkHref"),a=[];for(const t of i.getSelectedBlocks())n.schema.checkAttribute(t,"linkHref")&&a.push(e.createRangeOn(t));const c=a.slice();for(const t of s)this._isRangeToUpdate(t,a)&&c.push(t);for(const s of c){let a=s;if(1===c.length){const o=CD(i);i.getAttribute("linkHref")===o&&(a=this._updateLinkContent(n,e,s,t),e.setSelection(e.createSelection(a)))}e.setAttribute("linkHref",t,a),o.forEach((t=>{e.setAttribute(t,!0,a)})),r.forEach((t=>{e.removeAttribute(t,a)}))}}}))}_getDecoratorStateFromModel(t){const e=this.editor.model,n=e.document.selection,i=n.getSelectedElement();return bD(i,e.schema)?i.getAttribute(t):n.getAttribute(t)}_isRangeToUpdate(t,e){for(const n of e)if(n.containsRange(t))return!1;return!0}_updateLinkContent(t,e,n,i){const o=e.createText(i,{linkHref:i});return t.insertContent(o,n)}}function CD(t){if(t.isCollapsed){const e=t.getFirstPosition();return e.textNode&&e.textNode.data}{const e=Array.from(t.getFirstRange().getItems());if(e.length>1)return null;const n=e[0];return n.is("$text")||n.is("$textProxy")?n.data:null}}class vD extends ir{refresh(){const t=this.editor.model,e=t.document.selection,n=e.getSelectedElement();bD(n,t.schema)?this.isEnabled=t.schema.checkAttribute(n,"linkHref"):this.isEnabled=t.schema.checkAttributeInSelection(e,"linkHref")}execute(){const t=this.editor,e=this.editor.model,n=e.document.selection,i=t.commands.get("link");e.change((t=>{const o=n.isCollapsed?[H_(n.getFirstPosition(),"linkHref",n.getAttribute("linkHref"),e)]:e.schema.getValidRanges(n.getRanges(),"linkHref");for(const e of o)if(t.removeAttribute("linkHref",e),i)for(const n of i.manualDecorators)t.removeAttribute(n.id,e)}))}}class yD extends(W()){constructor({id:t,label:e,attributes:n,classes:i,styles:o,defaultValue:r}){super(),this.id=t,this.set("value",void 0),this.defaultValue=r,this.label=e,this.attributes=n,this.classes=i,this.styles=o}_createPattern(){return{attributes:this.attributes,classes:this.classes,styles:this.styles}}}var xD=n(7719),ED={injectType:"singletonStyleTag",attributes:{"data-cke":!0},insert:"head",singleton:!0};gr()(xD.A,ED);xD.A.locals;var DD=Object.defineProperty,BD=Object.getOwnPropertySymbols,SD=Object.prototype.hasOwnProperty,TD=Object.prototype.propertyIsEnumerable,ID=(t,e,n)=>e in t?DD(t,e,{enumerable:!0,configurable:!0,writable:!0,value:n}):t[e]=n,PD=(t,e)=>{for(var n in e||(e={}))SD.call(e,n)&&ID(t,n,e[n]);if(BD)for(var n of BD(e))TD.call(e,n)&&ID(t,n,e[n]);return t};const RD="automatic",VD=/^(https?:)?\/\//;class FD extends er{static get pluginName(){return"LinkEditing"}static get requires(){return[D_,g_,RC]}constructor(t){super(t),t.config.define("link",{allowCreatingEmptyLinks:!1,addTargetToExternalLinks:!1})}init(){const t=this.editor,e=this.editor.config.get("link.allowedProtocols");t.model.schema.extend("$text",{allowAttributes:"linkHref"}),t.conversion.for("dataDowncast").attributeToElement({model:"linkHref",view:pD}),t.conversion.for("editingDowncast").attributeToElement({model:"linkHref",view:(t,n)=>pD(fD(t,e),n)}),t.conversion.for("upcast").elementToAttribute({view:{name:"a",attributes:{href:!0}},model:{key:"linkHref",value:t=>t.getAttribute("href")}}),t.commands.add("link",new AD(t)),t.commands.add("unlink",new vD(t));const n=function(t,e){const n={"Open in a new tab":t("Open in a new tab"),Downloadable:t("Downloadable")};return e.forEach((t=>("label"in t&&n[t.label]&&(t.label=n[t.label]),t))),e}(t.t,function(t){const e=[];if(t)for(const[n,i]of Object.entries(t)){const t=Object.assign({},i,{id:`link${lD(n)}`});e.push(t)}return e}(t.config.get("link.decorators")));this._enableAutomaticDecorators(n.filter((t=>t.mode===RD))),this._enableManualDecorators(n.filter((t=>"manual"===t.mode)));t.plugins.get(D_).registerAttribute("linkHref"),q_(t,"linkHref","a","ck-link_selected"),this._enableSelectionAttributesFixer(),this._enableClipboardIntegration()}_enableAutomaticDecorators(t){const e=this.editor,n=e.commands.get("link").automaticDecorators;e.config.get("link.addTargetToExternalLinks")&&n.add({id:"linkIsExternal",mode:RD,callback:t=>!!t&&VD.test(t),attributes:{target:"_blank",rel:"noopener noreferrer"}}),n.add(t),n.length&&e.conversion.for("downcast").add(n.getDispatcher())}_enableManualDecorators(t){if(!t.length)return;const e=this.editor,n=e.commands.get("link").manualDecorators;t.forEach((t=>{e.model.schema.extend("$text",{allowAttributes:t.id});const i=new yD(t);n.add(i),e.conversion.for("downcast").attributeToElement({model:i.id,view:(t,{writer:e,schema:n},{item:o})=>{if((o.is("selection")||n.isInline(o))&&t){const t=e.createAttributeElement("a",i.attributes,{priority:5});i.classes&&e.addClass(i.classes,t);for(const n in i.styles)e.setStyle(n,i.styles[n],t);return e.setCustomProperty("link",!0,t),t}}}),e.conversion.for("upcast").elementToAttribute({view:PD({name:"a"},i._createPattern()),model:{key:i.id}})}))}_enableLinkOpen(){const t=this.editor,e=t.editing.view.document;this.listenTo(e,"click",((t,e)=>{if(!(s.isMac?e.domEvent.metaKey:e.domEvent.ctrlKey))return;let n=e.domTarget;if("a"!=n.tagName.toLowerCase()&&(n=n.closest("a")),!n)return;const i=n.getAttribute("href");i&&(t.stop(),e.preventDefault(),_D(i))}),{context:"$capture"}),this.listenTo(e,"keydown",((e,n)=>{const i=t.commands.get("link").value;!!i&&n.keyCode===go.enter&&n.altKey&&(e.stop(),_D(i))}))}_enableSelectionAttributesFixer(){const t=this.editor.model,e=t.document.selection;this.listenTo(e,"change:attribute",((n,{attributeKeys:i})=>{i.includes("linkHref")&&!e.hasAttribute("linkHref")&&t.change((e=>{var n;!function(t,e){t.removeSelectionAttribute("linkHref");for(const n of e)t.removeSelectionAttribute(n)}(e,(n=t.schema,n.getDefinition("$text").allowAttributes.filter((t=>t.startsWith("link")))))}))}))}_enableClipboardIntegration(){const t=this.editor,e=t.model,n=this.editor.config.get("link.defaultProtocol");n&&this.listenTo(t.plugins.get("ClipboardPipeline"),"contentInsertion",((t,i)=>{e.change((t=>{const e=t.createRangeIn(i.content);for(const i of e.getItems())if(i.hasAttribute("linkHref")){const e=kD(i.getAttribute("linkHref"),n);t.setAttribute("linkHref",e,i)}}))}))}}var LD=n(3817),OD={injectType:"singletonStyleTag",attributes:{"data-cke":!0},insert:"head",singleton:!0};gr()(LD.A,OD);LD.A.locals;class zD extends Jm{constructor(t,e,n){super(t),this.focusTracker=new Go,this.keystrokes=new Ko,this._focusables=new xm;const i=t.t;this._validators=n,this.urlInputView=this._createUrlInput(),this.saveButtonView=this._createButton(i("Save"),ym.check,"ck-button-save"),this.saveButtonView.type="submit",this.cancelButtonView=this._createButton(i("Cancel"),ym.cancel,"ck-button-cancel","cancel"),this._manualDecoratorSwitches=this._createManualDecoratorSwitches(e),this.children=this._createFormChildren(e.manualDecorators),this._focusCycler=new Xg({focusables:this._focusables,focusTracker:this.focusTracker,keystrokeHandler:this.keystrokes,actions:{focusPrevious:"shift + tab",focusNext:"tab"}});const o=["ck","ck-link-form","ck-responsive-form"];e.manualDecorators.length&&o.push("ck-link-form_layout-vertical","ck-vertical-form"),this.setTemplate({tag:"form",attributes:{class:o,tabindex:"-1"},children:this.children})}getDecoratorSwitchesState(){return Array.from(this._manualDecoratorSwitches).reduce(((t,e)=>(t[e.name]=e.isOn,t)),{})}render(){super.render(),Qm({view:this});[this.urlInputView,...this._manualDecoratorSwitches,this.saveButtonView,this.cancelButtonView].forEach((t=>{this._focusables.add(t),this.focusTracker.add(t.element)})),this.keystrokes.listenTo(this.element)}destroy(){super.destroy(),this.focusTracker.destroy(),this.keystrokes.destroy()}focus(){this._focusCycler.focusFirst()}isValid(){this.resetFormStatus();for(const t of this._validators){const e=t(this);if(e)return this.urlInputView.errorText=e,!1}return!0}resetFormStatus(){this.urlInputView.errorText=null}_createUrlInput(){const t=this.locale.t,e=new zg(this.locale,zp);return e.label=t("Link URL"),e}_createButton(t,e,n,i){const o=new mg(this.locale);return o.set({label:t,icon:e,tooltip:!0}),o.extendTemplate({attributes:{class:n}}),i&&o.delegate("execute").to(this,i),o}_createManualDecoratorSwitches(t){const e=this.createCollection();for(const n of t.manualDecorators){const i=new fg(this.locale);i.set({name:n.id,label:n.label,withText:!0}),i.bind("isOn").toMany([n,t],"value",((t,e)=>void 0===e&&void 0===t?!!n.defaultValue:!!t)),i.on("execute",(()=>{n.set("value",!i.isOn)})),e.add(i)}return e}_createFormChildren(t){const e=this.createCollection();if(e.add(this.urlInputView),t.length){const t=new Jm;t.setTemplate({tag:"ul",children:this._manualDecoratorSwitches.map((t=>({tag:"li",children:[t],attributes:{class:["ck","ck-list__item"]}}))),attributes:{class:["ck","ck-reset","ck-list"]}}),e.add(t)}return e.add(this.saveButtonView),e.add(this.cancelButtonView),e}get url(){const{element:t}=this.urlInputView.fieldView;return t?t.value.trim():null}}var MD=n(8762),ND={injectType:"singletonStyleTag",attributes:{"data-cke":!0},insert:"head",singleton:!0};gr()(MD.A,ND);MD.A.locals;class HD extends Jm{constructor(t,e={}){super(t),this.focusTracker=new Go,this.keystrokes=new Ko,this._focusables=new xm;const n=t.t;this.previewButtonView=this._createPreviewButton(),this.unlinkButtonView=this._createButton(n("Unlink"),'',"unlink"),this.editButtonView=this._createButton(n("Edit link"),ym.pencil,"edit"),this.set("href",void 0),this._linkConfig=e,this._focusCycler=new Xg({focusables:this._focusables,focusTracker:this.focusTracker,keystrokeHandler:this.keystrokes,actions:{focusPrevious:"shift + tab",focusNext:"tab"}}),this.setTemplate({tag:"div",attributes:{class:["ck","ck-link-actions","ck-responsive-form"],tabindex:"-1"},children:[this.previewButtonView,this.editButtonView,this.unlinkButtonView]})}render(){super.render();[this.previewButtonView,this.editButtonView,this.unlinkButtonView].forEach((t=>{this._focusables.add(t),this.focusTracker.add(t.element)})),this.keystrokes.listenTo(this.element)}destroy(){super.destroy(),this.focusTracker.destroy(),this.keystrokes.destroy()}focus(){this._focusCycler.focusFirst()}_createButton(t,e,n){const i=new mg(this.locale);return i.set({label:t,icon:e,tooltip:!0}),i.delegate("execute").to(this,n),i}_createPreviewButton(){const t=new mg(this.locale),e=this.bindTemplate,n=this.t;return t.set({withText:!0,tooltip:n("Open link in new tab")}),t.extendTemplate({attributes:{class:["ck","ck-link-actions__preview"],href:e.to("href",(t=>t&&fD(t,this._linkConfig.allowedProtocols))),target:"_blank",rel:"noopener noreferrer"}}),t.bind("label").to(this,"href",(t=>t||n("This link has no URL"))),t.bind("isEnabled").to(this,"href",(t=>!!t)),t.template.tag="a",t.template.eventListeners={},t}}const jD="link-ui";class qD extends er{constructor(){super(...arguments),this.actionsView=null,this.formView=null}static get requires(){return[mk]}static get pluginName(){return"LinkUI"}init(){const t=this.editor,e=this.editor.t;t.editing.view.addObserver(wu),this._balloon=t.plugins.get(mk),this._createToolbarLinkButton(),this._enableBalloonActivators(),t.conversion.for("editingDowncast").markerToHighlight({model:jD,view:{classes:["ck-fake-link-selection"]}}),t.conversion.for("editingDowncast").markerToElement({model:jD,view:{name:"span",classes:["ck-fake-link-selection","ck-fake-link-selection_collapsed"]}}),t.accessibility.addKeystrokeInfos({keystrokes:[{label:e("Create link"),keystroke:gD},{label:e("Move out of a link"),keystroke:[["arrowleft","arrowleft"],["arrowright","arrowright"]]}]})}destroy(){super.destroy(),this.formView&&this.formView.destroy(),this.actionsView&&this.actionsView.destroy()}_createViews(){this.actionsView=this._createActionsView(),this.formView=this._createFormView(),this._enableUserBalloonInteractions()}_createActionsView(){const t=this.editor,e=new HD(t.locale,t.config.get("link")),n=t.commands.get("link"),i=t.commands.get("unlink");return e.bind("href").to(n,"value"),e.editButtonView.bind("isEnabled").to(n),e.unlinkButtonView.bind("isEnabled").to(i),this.listenTo(e,"edit",(()=>{this._addFormView()})),this.listenTo(e,"unlink",(()=>{t.execute("unlink"),this._hideUI()})),e.keystrokes.set("Esc",((t,e)=>{this._hideUI(),e()})),e.keystrokes.set(gD,((t,e)=>{this._addFormView(),e()})),e}_createFormView(){const t=this.editor,e=t.commands.get("link"),n=t.config.get("link.defaultProtocol"),i=new(Ym(zD))(t.locale,e,function(t){const e=t.t,n=t.config.get("link.allowCreatingEmptyLinks");return[t=>{if(!n&&!t.url.length)return e("Link URL must not be empty.")}]}(t));return i.urlInputView.fieldView.bind("value").to(e,"value"),i.urlInputView.bind("isEnabled").to(e,"isEnabled"),i.saveButtonView.bind("isEnabled").to(e,"isEnabled"),this.listenTo(i,"submit",(()=>{if(i.isValid()){const{value:e}=i.urlInputView.fieldView.element,o=kD(e,n);t.execute("link",o,i.getDecoratorSwitchesState()),this._closeFormView()}})),this.listenTo(i.urlInputView,"change:errorText",(()=>{t.ui.update()})),this.listenTo(i,"cancel",(()=>{this._closeFormView()})),i.keystrokes.set("Esc",((t,e)=>{this._closeFormView(),e()})),i}_createToolbarLinkButton(){const t=this.editor,e=t.commands.get("link");t.ui.componentFactory.add("link",(()=>{const t=this._createButton(mg);return t.set({tooltip:!0,isToggleable:!0}),t.bind("isOn").to(e,"value",(t=>!!t)),t})),t.ui.componentFactory.add("menuBar:link",(()=>this._createButton(mw)))}_createButton(t){const e=this.editor,n=e.locale,i=e.commands.get("link"),o=new t(e.locale),r=n.t;return o.set({label:r("Link"),icon:'',keystroke:gD}),o.bind("isEnabled").to(i,"isEnabled"),this.listenTo(o,"execute",(()=>this._showUI(!0))),o}_enableBalloonActivators(){const t=this.editor,e=t.editing.view.document;this.listenTo(e,"click",(()=>{this._getSelectedLinkElement()&&this._showUI()})),t.keystrokes.set(gD,((e,n)=>{n(),t.commands.get("link").isEnabled&&this._showUI(!0)}))}_enableUserBalloonInteractions(){this.editor.keystrokes.set("Tab",((t,e)=>{this._areActionsVisible&&!this.actionsView.focusTracker.isFocused&&(this.actionsView.focus(),e())}),{priority:"high"}),this.editor.keystrokes.set("Esc",((t,e)=>{this._isUIVisible&&(this._hideUI(),e())})),Zm({emitter:this.formView,activator:()=>this._isUIInPanel,contextElements:()=>[this._balloon.view.element],callback:()=>this._hideUI()})}_addActionsView(){this.actionsView||this._createViews(),this._areActionsInPanel||this._balloon.add({view:this.actionsView,position:this._getBalloonPositionData()})}_addFormView(){if(this.formView||this._createViews(),this._isFormInPanel)return;const t=this.editor.commands.get("link");this.formView.disableCssTransitions(),this.formView.resetFormStatus(),this._balloon.add({view:this.formView,position:this._getBalloonPositionData()}),this.formView.urlInputView.fieldView.value=t.value||"",this._balloon.visibleView===this.formView&&this.formView.urlInputView.fieldView.select(),this.formView.enableCssTransitions()}_closeFormView(){const t=this.editor.commands.get("link");t.restoreManualDecoratorStates(),void 0!==t.value?this._removeFormView():this._hideUI()}_removeFormView(){this._isFormInPanel&&(this.formView.saveButtonView.focus(),this.formView.urlInputView.fieldView.reset(),this._balloon.remove(this.formView),this.editor.editing.view.focus(),this._hideFakeVisualSelection())}_showUI(t=!1){this.formView||this._createViews(),this._getSelectedLinkElement()?(this._areActionsVisible?this._addFormView():this._addActionsView(),t&&this._balloon.showStack("main")):(this._showFakeVisualSelection(),this._addActionsView(),t&&this._balloon.showStack("main"),this._addFormView()),this._startUpdatingUI()}_hideUI(){if(!this._isUIInPanel)return;const t=this.editor;this.stopListening(t.ui,"update"),this.stopListening(this._balloon,"change:visibleView"),t.editing.view.focus(),this._removeFormView(),this._balloon.remove(this.actionsView),this._hideFakeVisualSelection()}_startUpdatingUI(){const t=this.editor,e=t.editing.view.document;let n=this._getSelectedLinkElement(),i=r();const o=()=>{const t=this._getSelectedLinkElement(),e=r();n&&!t||!n&&e!==i?this._hideUI():this._isUIVisible&&this._balloon.updatePosition(this._getBalloonPositionData()),n=t,i=e};function r(){return e.selection.focus.getAncestors().reverse().find((t=>t.is("element")))}this.listenTo(t.ui,"update",o),this.listenTo(this._balloon,"change:visibleView",o)}get _isFormInPanel(){return!!this.formView&&this._balloon.hasView(this.formView)}get _areActionsInPanel(){return!!this.actionsView&&this._balloon.hasView(this.actionsView)}get _areActionsVisible(){return!!this.actionsView&&this._balloon.visibleView===this.actionsView}get _isUIInPanel(){return this._isFormInPanel||this._areActionsInPanel}get _isUIVisible(){const t=this._balloon.visibleView;return!!this.formView&&t==this.formView||this._areActionsVisible}_getBalloonPositionData(){const t=this.editor.editing.view,e=this.editor.model,n=t.document;let i;if(e.markers.has(jD)){const e=Array.from(this.editor.editing.mapper.markerNameToElements(jD)),n=t.createRange(t.createPositionBefore(e[0]),t.createPositionAfter(e[e.length-1]));i=t.domConverter.viewRangeToDom(n)}else i=()=>{const e=this._getSelectedLinkElement();return e?t.domConverter.mapViewToDom(e):t.domConverter.viewRangeToDom(n.selection.getFirstRange())};return{target:i}}_getSelectedLinkElement(){const t=this.editor.editing.view,e=t.document.selection,n=e.getSelectedElement();if(e.isCollapsed||n&&HC(n))return WD(e.getFirstPosition());{const n=e.getFirstRange().getTrimmed(),i=WD(n.start),o=WD(n.end);return i&&i==o&&t.createRangeIn(i).getTrimmed().isEqual(n)?i:null}}_showFakeVisualSelection(){const t=this.editor.model;t.change((e=>{const n=t.document.selection.getFirstRange();if(t.markers.has(jD))e.updateMarker(jD,{range:n});else if(n.start.isAtEnd){const i=n.start.getLastMatchingPosition((({item:e})=>!t.schema.isContent(e)),{boundaries:n});e.addMarker(jD,{usingOperation:!1,affectsData:!1,range:e.createRange(i,n.end)})}else e.addMarker(jD,{usingOperation:!1,affectsData:!1,range:n})}))}_hideFakeVisualSelection(){const t=this.editor.model;t.markers.has(jD)&&t.change((t=>{t.removeMarker(jD)}))}}function WD(t){return t.getAncestors().find((t=>{return(e=t).is("attributeElement")&&!!e.getCustomProperty("link");var e}))||null}const UD=new RegExp("(^|\\s)(((?:(?:(?:https?|ftp):)?\\/\\/)(?:\\S+(?::\\S*)?@)?(?:(?:[1-9]\\d?|1\\d\\d|2[01]\\d|22[0-3])(?:\\.(?:1?\\d{1,2}|2[0-4]\\d|25[0-5])){2}(?:\\.(?:[1-9]\\d?|1\\d\\d|2[0-4]\\d|25[0-4]))|(((?!www\\.)|(www\\.))(?![-_])(?:[-_a-z0-9\\u00a1-\\uffff]{1,63}\\.)+(?:[a-z\\u00a1-\\uffff]{2,63})))(?::\\d{2,5})?(?:[/?#]\\S*)?)|((www.|(\\S+@))((?![-_])(?:[-_a-z0-9\\u00a1-\\uffff]{1,63}\\.))+(?:[a-z\\u00a1-\\uffff]{2,63})))$","i");class $D extends er{static get requires(){return[v_,FD]}static get pluginName(){return"AutoLink"}init(){const t=this.editor.model.document.selection;t.on("change:range",(()=>{this.isEnabled=!t.anchor.parent.is("element","codeBlock")})),this._enableTypingHandling()}afterInit(){this._enableEnterHandling(),this._enableShiftEnterHandling(),this._enablePasteLinking()}_expandLinkRange(t,e){return e.textNode&&e.textNode.hasAttribute("linkHref")?H_(e,"linkHref",e.textNode.getAttribute("linkHref"),t):null}_selectEntireLinks(t,e){const n=this.editor.model,i=n.document.selection,o=i.getFirstPosition(),r=i.getLastPosition();let s=e.getJoined(this._expandLinkRange(n,o)||e);s&&(s=s.getJoined(this._expandLinkRange(n,r)||e)),s&&(s.start.isBefore(o)||s.end.isAfter(r))&&t.setSelection(s)}_enablePasteLinking(){const t=this.editor,e=t.model,n=e.document.selection,i=t.plugins.get("ClipboardPipeline"),o=t.commands.get("link");i.on("inputTransformation",((t,i)=>{if(!this.isEnabled||!o.isEnabled||n.isCollapsed||"paste"!==i.method)return;if(n.rangeCount>1)return;const r=n.getFirstRange(),s=i.dataTransfer.getData("text/plain");if(!s)return;const a=s.match(UD);a&&a[2]===s&&(e.change((t=>{this._selectEntireLinks(t,r),o.execute(s)})),t.stop())}),{priority:"high"})}_enableTypingHandling(){const t=this.editor,e=new E_(t.model,(t=>{if(!function(t){return t.length>4&&" "===t[t.length-1]&&" "!==t[t.length-2]}(t))return;const e=GD(t.substr(0,t.length-1));return e?{url:e}:void 0}));e.on("matched:data",((e,n)=>{const{batch:i,range:o,url:r}=n;if(!i.isTyping)return;const s=o.end.getShiftedBy(-1),a=s.getShiftedBy(-r.length),c=t.model.createRange(a,s);this._applyAutoLink(r,c)})),e.bind("isEnabled").to(this)}_enableEnterHandling(){const t=this.editor,e=t.model,n=t.commands.get("enter");n&&n.on("execute",(()=>{const t=e.document.selection.getFirstPosition();if(!t.parent.previousSibling)return;const n=e.createRangeIn(t.parent.previousSibling);this._checkAndApplyAutoLinkOnRange(n)}))}_enableShiftEnterHandling(){const t=this.editor,e=t.model,n=t.commands.get("shiftEnter");n&&n.on("execute",(()=>{const t=e.document.selection.getFirstPosition(),n=e.createRange(e.createPositionAt(t.parent,0),t.getShiftedBy(-1));this._checkAndApplyAutoLinkOnRange(n)}))}_checkAndApplyAutoLinkOnRange(t){const e=this.editor.model,{text:n,range:i}=x_(t,e),o=GD(n);if(o){const t=e.createRange(i.end.getShiftedBy(-o.length),i.end);this._applyAutoLink(o,t)}}_applyAutoLink(t,e){const n=this.editor.model,i=kD(t,this.editor.config.get("link.defaultProtocol"));this.isEnabled&&function(t,e){return e.schema.checkAttributeInSelection(e.createSelection(t),"linkHref")}(e,n)&&wD(i)&&!function(t){const e=t.start.nodeAfter;return!!e&&e.hasAttribute("linkHref")}(e)&&this._persistAutoLink(i,e)}_persistAutoLink(t,e){const n=this.editor.model,i=this.editor.plugins.get("Delete");n.enqueueChange((o=>{o.setAttribute("linkHref",t,e),n.enqueueChange((()=>{i.requestUndoOnBackspace()}))}))}}function GD(t){const e=UD.exec(t);return e?e[2]:null}var KD=n(4808),JD={injectType:"singletonStyleTag",attributes:{"data-cke":!0},insert:"head",singleton:!0};gr()(KD.A,JD);KD.A.locals;class ZD{constructor(t,e){this._startElement=t,this._referenceIndent=t.getAttribute("listIndent"),this._isForward="forward"==e.direction,this._includeSelf=!!e.includeSelf,this._sameAttributes=_o(e.sameAttributes||[]),this._sameIndent=!!e.sameIndent,this._lowerIndent=!!e.lowerIndent,this._higherIndent=!!e.higherIndent}static first(t,e){return $o(new this(t,e)[Symbol.iterator]())}*[Symbol.iterator](){const t=[];for(const{node:e}of YD(this._getStartNode(),this._isForward?"forward":"backward")){const n=e.getAttribute("listIndent");if(nthis._referenceIndent){if(!this._higherIndent)continue;if(!this._isForward){t.push(e);continue}}else{if(!this._sameIndent){if(this._higherIndent){t.length&&(yield*t,t.length=0);break}continue}if(this._sameAttributes.some((t=>e.getAttribute(t)!==this._startElement.getAttribute(t))))break}t.length&&(yield*t,t.length=0),yield e}}_getStartNode(){return this._includeSelf?this._startElement:this._isForward?this._startElement.nextSibling:this._startElement.previousSibling}}function*YD(t,e="forward"){const n="forward"==e,i=[];let o=null;for(;lB(t);){let e=null;if(o){const n=t.getAttribute("listIndent"),r=o.getAttribute("listIndent");n>r?i[r]=o:ne in t?XD(t,e,{enumerable:!0,configurable:!0,writable:!0,value:n}):t[e]=n,sB=(t,e)=>{for(var n in e||(e={}))iB.call(e,n)&&rB(t,n,e[n]);if(nB)for(var n of nB(e))oB.call(e,n)&&rB(t,n,e[n]);return t},aB=(t,e)=>tB(t,eB(e));class cB{static next(){return p()}}function lB(t){return!!t&&t.is("element")&&t.hasAttribute("listItemId")}function dB(t,e={}){return[...hB(t,aB(sB({},e),{direction:"backward"})),...hB(t,aB(sB({},e),{direction:"forward"}))]}function hB(t,e={}){const n="forward"==e.direction,i=Array.from(new ZD(t,aB(sB({},e),{includeSelf:n,sameIndent:!0,sameAttributes:"listItemId"})));return n?i:i.reverse()}function uB(t,e){const n=new ZD(t,sB({sameIndent:!0,sameAttributes:"listType"},e)),i=new ZD(t,sB({sameIndent:!0,sameAttributes:"listType",includeSelf:!0,direction:"forward"},e));return[...Array.from(n).reverse(),...i]}function mB(t){return!ZD.first(t,{sameIndent:!0,sameAttributes:"listItemId"})}function gB(t){return!ZD.first(t,{direction:"forward",sameIndent:!0,sameAttributes:"listItemId"})}function pB(t,e={}){t=_o(t);const n=!1!==e.withNested,i=new Set;for(const e of t)for(const t of dB(e,{higherIndent:n}))i.add(t);return CB(i)}function fB(t){t=_o(t);const e=new Set;for(const n of t)for(const t of uB(n))e.add(t);return CB(e)}function bB(t,e){const n=hB(t,{direction:"forward"}),i=cB.next();for(const t of n)e.setAttribute("listItemId",i,t);return n}function kB(t,e,n){const i={};for(const[t,n]of e.getAttributes())t.startsWith("list")&&(i[t]=n);const o=hB(t,{direction:"forward"});for(const t of o)n.setAttributes(i,t);return o}function wB(t,e,{expand:n,indentBy:i=1}={}){t=_o(t);const o=n?pB(t):t;for(const t of o){const n=t.getAttribute("listIndent")+i;n<0?_B(t,e):e.setAttribute("listIndent",n,t)}return o}function _B(t,e){t=_o(t);for(const n of t)n.is("element","listItem")&&e.rename(n,"paragraph");for(const n of t)for(const t of n.getAttributeKeys())t.startsWith("list")&&e.removeAttribute(t,n);return t}function AB(t){if(!t.length)return!1;const e=t[0].getAttribute("listItemId");return!!e&&!t.some((t=>t.getAttribute("listItemId")!=e))}function CB(t){return Array.from(t).filter((t=>"$graveyard"!==t.root.rootName)).sort(((t,e)=>t.index-e.index))}function vB(t){const e=t.document.selection.getSelectedElement();return e&&t.schema.isObject(e)&&t.schema.isBlock(e)?e:null}function yB(t,e){return e.checkChild(t.parent,"listItem")&&e.checkChild(t,"$text")&&!e.isObject(t)}function xB(t){return"numbered"==t||"customNumbered"==t}function EB(t,e,n){return hB(e,{direction:"forward"}).pop().index>t.index?kB(t,e,n):[]}class DB extends ir{constructor(t,e){super(t),this._direction=e}refresh(){this.isEnabled=this._checkEnabled()}execute(){const t=this.editor.model,e=BB(t.document.selection);t.change((t=>{const n=[];AB(e)&&!mB(e[0])?("forward"==this._direction&&n.push(...wB(e,t)),n.push(...bB(e[0],t))):"forward"==this._direction?n.push(...wB(e,t,{expand:!0})):n.push(...function(t,e){const n=pB(t=_o(t)),i=new Set,o=Math.min(...n.map((t=>t.getAttribute("listIndent")))),r=new Map;for(const t of n)r.set(t,ZD.first(t,{lowerIndent:!0}));for(const t of n){if(i.has(t))continue;i.add(t);const n=t.getAttribute("listIndent")-1;if(n<0)_B(t,e);else{if(t.getAttribute("listIndent")==o){const n=EB(t,r.get(t),e);for(const t of n)i.add(t);if(n.length)continue}e.setAttribute("listIndent",n,t)}}return CB(i)}(e,t));for(const e of n){if(!e.hasAttribute("listType"))continue;const n=ZD.first(e,{sameIndent:!0});n&&t.setAttribute("listType",n.getAttribute("listType"),e)}this._fireAfterExecute(n)}))}_fireAfterExecute(t){this.fire("afterExecute",CB(new Set(t)))}_checkEnabled(){let t=BB(this.editor.model.document.selection),e=t[0];if(!e)return!1;if("backward"==this._direction)return!0;if(AB(t)&&!mB(t[0]))return!0;t=pB(t),e=t[0];const n=ZD.first(e,{sameIndent:!0});return!!n&&n.getAttribute("listType")==e.getAttribute("listType")}}function BB(t){const e=Array.from(t.getSelectedBlocks()),n=e.findIndex((t=>!lB(t)));return-1!=n&&(e.length=n),e}var SB=Object.defineProperty,TB=Object.defineProperties,IB=Object.getOwnPropertyDescriptors,PB=Object.getOwnPropertySymbols,RB=Object.prototype.hasOwnProperty,VB=Object.prototype.propertyIsEnumerable,FB=(t,e,n)=>e in t?SB(t,e,{enumerable:!0,configurable:!0,writable:!0,value:n}):t[e]=n,LB=(t,e)=>{for(var n in e||(e={}))RB.call(e,n)&&FB(t,n,e[n]);if(PB)for(var n of PB(e))VB.call(e,n)&&FB(t,n,e[n]);return t},OB=(t,e)=>TB(t,IB(e));class zB extends ir{constructor(t,e,n={}){super(t),this.type=e,this._listWalkerOptions=n.multiLevel?{higherIndent:!0,lowerIndent:!0,sameAttributes:[]}:void 0}refresh(){this.value=this._getValue(),this.isEnabled=this._checkEnabled()}execute(t={}){const e=this.editor.model,n=e.document,i=vB(e),o=Array.from(n.selection.getSelectedBlocks()).filter((t=>e.schema.checkAttribute(t,"listType")||yB(t,e.schema))),r=void 0!==t.forceValue?!t.forceValue:this.value;e.change((s=>{if(r){const t=o[o.length-1],e=hB(t,{direction:"forward"}),n=[];e.length>1&&n.push(...bB(e[1],s)),n.push(..._B(o,s)),n.push(...function(t,e){const n=[];let i=Number.POSITIVE_INFINITY;for(const{node:o}of YD(t.nextSibling,"forward")){const t=o.getAttribute("listIndent");if(0==t)break;t{const{firstElement:r,lastElement:s}=this._getMergeSubjectElements(n,t),a=r.getAttribute("listIndent")||0,c=s.getAttribute("listIndent"),l=s.getAttribute("listItemId");if(a!=c){const t=(d=s,Array.from(new ZD(d,{direction:"forward",higherIndent:!0})));i.push(...wB([s,...t],o,{indentBy:a-c,expand:a{const e=bB(this._getStartBlock(),t);this._fireAfterExecute(e)}))}_fireAfterExecute(t){this.fire("afterExecute",CB(new Set(t)))}_checkEnabled(){const t=this.editor.model.document.selection,e=this._getStartBlock();return t.isCollapsed&&lB(e)&&!mB(e)}_getStartBlock(){const t=this.editor.model.document.selection.getFirstPosition().parent;return"before"==this._direction?t:t.nextSibling}}class HB extends er{static get pluginName(){return"ListUtils"}expandListBlocksToCompleteList(t){return fB(t)}isFirstBlockOfListItem(t){return mB(t)}isListItemBlock(t){return lB(t)}expandListBlocksToCompleteItems(t,e={}){return pB(t,e)}isNumberedListType(t){return xB(t)}}function jB(t){return t.is("element","ol")||t.is("element","ul")}function qB(t){return t.is("element","li")}function WB(t,e,n,i=GB(n,e)){return t.createAttributeElement($B(n),null,{priority:2*e/100-100,id:i})}function UB(t,e,n){return t.createAttributeElement("li",null,{priority:(2*e+1)/100-100,id:n})}function $B(t){return"numbered"==t||"customNumbered"==t?"ol":"ul"}function GB(t,e){return`list-${t}-${e}`}function KB(t,e){const n=t.nodeBefore;if(lB(n)){let t=n;for(const{node:n}of YD(t,"backward"))if(t=n,e.has(t))return;e.set(n,t)}else{const n=t.nodeAfter;lB(n)&&e.set(n,n)}}function JB(){return(t,e,n)=>{const{writer:i,schema:o}=n;if(!e.modelRange)return;const r=Array.from(e.modelRange.getItems({shallow:!0})).filter((t=>o.checkAttribute(t,"listItemId")));if(!r.length)return;const s=cB.next(),a=function(t){let e=0,n=t.parent;for(;n;){if(qB(n))e++;else{const t=n.previousSibling;t&&qB(t)&&e++}n=n.parent}return e}(e.viewItem);let c=e.viewItem.parent&&e.viewItem.parent.is("element","ol")?"numbered":"bulleted";const l=r[0].getAttribute("listType");l&&(c=l);const d={listItemId:s,listIndent:a,listType:c};for(const t of r)t.hasAttribute("listItemId")||i.setAttributes(d,t);r.length>1&&r[1].getAttribute("listItemId")!=d.listItemId&&n.keepEmptyElement(r[0])}}function ZB(){return(t,e,n)=>{if(!n.consumable.test(e.viewItem,{name:!0}))return;const i=new Au(e.viewItem.document);for(const t of Array.from(e.viewItem.getChildren()))qB(t)||jB(t)||i.remove(t)}}function YB(t,e,n,{dataPipeline:i}={}){const o=function(t){return(e,n)=>{const i=[];for(const n of t)e.hasAttribute(n)&&i.push(`attribute:${n}`);return!!i.every((t=>!1!==n.test(e,t)))&&(i.forEach((t=>n.consume(e,t))),!0)}}(t);return(r,s,a)=>{const{writer:c,mapper:l,consumable:d}=a,h=s.item;if(!t.includes(s.attributeKey))return;if(!o(h,d))return;const u=function(t,e,n){const i=n.createRangeOn(t),o=e.toViewRange(i).getTrimmed();return o.end.nodeBefore}(h,l,n);XB(u,c,l),function(t,e){let n=t.parent;for(;n.is("attributeElement")&&["ul","ol","li"].includes(n.name);){const i=n.parent;e.unwrap(e.createRangeOn(t),n),n=i}}(u,c);const m=function(t,e,n,i,{dataPipeline:o}){let r=i.createRangeOn(e);if(!mB(t))return r;for(const s of n){if("itemMarker"!=s.scope)continue;const n=s.createElement(i,t,{dataPipeline:o});if(!n)continue;if(i.setCustomProperty("listItemMarker",!0,n),s.canInjectMarkerIntoElement&&s.canInjectMarkerIntoElement(t)?i.insert(i.createPositionAt(e,0),n):(i.insert(r.start,n),r=i.createRange(i.createPositionBefore(n),i.createPositionAfter(e))),!s.createWrapperElement||!s.canWrapElement)continue;const a=s.createWrapperElement(i,t,{dataPipeline:o});i.setCustomProperty("listItemWrapper",!0,a),s.canWrapElement(t)?r=i.wrap(r,a):(r=i.wrap(i.createRangeOn(n),a),r=i.createRange(r.start,i.createPositionAfter(e)))}return r}(h,u,e,c,{dataPipeline:i});!function(t,e,n,i){if(!t.hasAttribute("listIndent"))return;const o=t.getAttribute("listIndent");let r=t;for(let t=o;t>=0;t--){const o=UB(i,t,r.getAttribute("listItemId")),s=WB(i,t,r.getAttribute("listType"));for(const t of n)"list"!=t.scope&&"item"!=t.scope||!r.hasAttribute(t.attributeName)||t.setAttributeOnDowncast(i,r.getAttribute(t.attributeName),"list"==t.scope?s:o);if(e=i.wrap(e,o),e=i.wrap(e,s),0==t)break;if(r=ZD.first(r,{lowerIndent:!0}),!r)break}}(h,m,e,c)}}function QB(t,{dataPipeline:e}={}){return(n,{writer:i})=>{if(!tS(n,t))return null;if(!e)return i.createContainerElement("span",{class:"ck-list-bogus-paragraph"});const o=i.createContainerElement("p");return i.setCustomProperty("dataPipeline:transparentRendering",!0,o),o}}function XB(t,e,n){for(;t.parent.is("attributeElement")&&t.parent.getCustomProperty("listItemWrapper");)e.unwrap(e.createRangeOn(t),t.parent);const i=[];o(e.createPositionBefore(t).getWalker({direction:"backward"})),o(e.createRangeIn(t).getWalker());for(const t of i)e.remove(t);function o(t){for(const{item:e}of t){if(e.is("element")&&n.toModelElement(e))break;e.is("element")&&e.getCustomProperty("listItemMarker")&&i.push(e)}}}function tS(t,e,n=dB(t)){if(!lB(t))return!1;for(const n of t.getAttributeKeys())if(!n.startsWith("selection:")&&!e.includes(n))return!1;return n.length<2}var eS=n(1232),nS={injectType:"singletonStyleTag",attributes:{"data-cke":!0},insert:"head",singleton:!0};gr()(eS.A,nS);eS.A.locals;var iS=n(6903),oS={injectType:"singletonStyleTag",attributes:{"data-cke":!0},insert:"head",singleton:!0};gr()(iS.A,oS);iS.A.locals;const rS=["listType","listIndent","listItemId"];class sS extends er{constructor(t){super(t),this._downcastStrategies=[],t.config.define("list.multiBlock",!0)}static get pluginName(){return"ListEditing"}static get requires(){return[IA,v_,HB,RC]}init(){const t=this.editor,e=t.model,n=t.config.get("list.multiBlock");if(t.plugins.has("LegacyListEditing"))throw new w("list-feature-conflict",this,{conflictPlugin:"LegacyListEditing"});e.schema.register("$listItem",{allowAttributes:rS}),n?(e.schema.extend("$container",{allowAttributesOf:"$listItem"}),e.schema.extend("$block",{allowAttributesOf:"$listItem"}),e.schema.extend("$blockObject",{allowAttributesOf:"$listItem"})):e.schema.register("listItem",{inheritAllFrom:"$block",allowAttributesOf:"$listItem"});for(const t of rS)e.schema.setAttributeProperties(t,{copyOnReplace:!0});t.commands.add("numberedList",new zB(t,"numbered")),t.commands.add("bulletedList",new zB(t,"bulleted")),t.commands.add("customNumberedList",new zB(t,"customNumbered",{multiLevel:!0})),t.commands.add("customBulletedList",new zB(t,"customBulleted",{multiLevel:!0})),t.commands.add("indentList",new DB(t,"forward")),t.commands.add("outdentList",new DB(t,"backward")),t.commands.add("splitListItemBefore",new NB(t,"before")),t.commands.add("splitListItemAfter",new NB(t,"after")),n&&(t.commands.add("mergeListItemBackward",new MB(t,"backward")),t.commands.add("mergeListItemForward",new MB(t,"forward"))),this._setupDeleteIntegration(),this._setupEnterIntegration(),this._setupTabIntegration(),this._setupClipboardIntegration(),this._setupAccessibilityIntegration()}afterInit(){const t=this.editor.commands,e=t.get("indent"),n=t.get("outdent");e&&e.registerChildCommand(t.get("indentList"),{priority:"high"}),n&&n.registerChildCommand(t.get("outdentList"),{priority:"lowest"}),this._setupModelPostFixing(),this._setupConversion()}registerDowncastStrategy(t){this._downcastStrategies.push(t)}getListAttributeNames(){return[...rS,...this._downcastStrategies.map((t=>t.attributeName))]}_setupDeleteIntegration(){const t=this.editor,e=t.commands.get("mergeListItemBackward"),n=t.commands.get("mergeListItemForward");this.listenTo(t.editing.view.document,"delete",((i,o)=>{const r=t.model.document.selection;vB(t.model)||t.model.change((()=>{const s=r.getFirstPosition();if(r.isCollapsed&&"backward"==o.direction){if(!s.isAtStart)return;const n=s.parent;if(!lB(n))return;if(ZD.first(n,{sameAttributes:"listType",sameIndent:!0})||0!==n.getAttribute("listIndent")){if(!e||!e.isEnabled)return;e.execute({shouldMergeOnBlocksContentLevel:aS(t.model,"backward")})}else gB(n)||t.execute("splitListItemAfter"),t.execute("outdentList");o.preventDefault(),i.stop()}else{if(r.isCollapsed&&!r.getLastPosition().isAtEnd)return;if(!n||!n.isEnabled)return;n.execute({shouldMergeOnBlocksContentLevel:aS(t.model,"forward")}),o.preventDefault(),i.stop()}}))}),{context:"li"})}_setupEnterIntegration(){const t=this.editor,e=t.model,n=t.commands,i=n.get("enter");this.listenTo(t.editing.view.document,"enter",((n,i)=>{const o=e.document,r=o.selection.getFirstPosition().parent;if(o.selection.isCollapsed&&lB(r)&&r.isEmpty&&!i.isSoft){const e=mB(r),o=gB(r);e&&o?(t.execute("outdentList"),i.preventDefault(),n.stop()):e&&!o?(t.execute("splitListItemAfter"),i.preventDefault(),n.stop()):o&&(t.execute("splitListItemBefore"),i.preventDefault(),n.stop())}}),{context:"li"}),this.listenTo(i,"afterExecute",(()=>{const e=n.get("splitListItemBefore");if(e.refresh(),!e.isEnabled)return;2===dB(t.model.document.selection.getLastPosition().parent).length&&e.execute()}))}_setupTabIntegration(){const t=this.editor;this.listenTo(t.editing.view.document,"tab",((e,n)=>{const i=n.shiftKey?"outdentList":"indentList";this.editor.commands.get(i).isEnabled&&(t.execute(i),n.stopPropagation(),n.preventDefault(),e.stop())}),{context:"li"})}_setupConversion(){const t=this.editor,e=t.model,n=this.getListAttributeNames(),i=t.config.get("list.multiBlock"),o=i?"paragraph":"listItem";t.conversion.for("upcast").elementToElement({view:"li",model:(t,{writer:e})=>e.createElement(o,{listType:""})}).elementToElement({view:"p",model:(t,{writer:e})=>t.parent&&t.parent.is("element","li")?e.createElement(o,{listType:""}):null,converterPriority:"high"}).add((t=>{t.on("element:li",JB()),t.on("element:ul",ZB(),{priority:"high"}),t.on("element:ol",ZB(),{priority:"high"})})),i||t.conversion.for("downcast").elementToElement({model:"listItem",view:"p"}),t.conversion.for("editingDowncast").elementToElement({model:o,view:QB(n),converterPriority:"high"}).add((t=>{var i;t.on("attribute",YB(n,this._downcastStrategies,e)),t.on("remove",(i=e.schema,(t,e,n)=>{const{writer:o,mapper:r}=n,s=t.name.split(":")[1];if(!i.checkAttribute(s,"listItemId"))return;const a=r.toViewPosition(e.position),c=e.position.getShiftedBy(e.length),l=r.toViewPosition(c,{isPhantom:!0}),d=o.createRange(a,l).getTrimmed().end.nodeBefore;d&&XB(d,o,r)}))})),t.conversion.for("dataDowncast").elementToElement({model:o,view:QB(n,{dataPipeline:!0}),converterPriority:"high"}).add((t=>{t.on("attribute",YB(n,this._downcastStrategies,e,{dataPipeline:!0}))}));const r=(s=this._downcastStrategies,a=t.editing.view,(t,e)=>{if(e.modelPosition.offset>0)return;const n=e.modelPosition.parent;if(!lB(n))return;if(!s.some((t=>"itemMarker"==t.scope&&t.canInjectMarkerIntoElement&&t.canInjectMarkerIntoElement(n))))return;const i=e.mapper.toViewElement(n),o=a.createRangeIn(i),r=o.getWalker();let c=o.start;for(const{item:t}of r){if(t.is("element")&&e.mapper.toModelElement(t)||t.is("$textProxy"))break;t.is("element")&&t.getCustomProperty("listItemMarker")&&(c=a.createPositionAfter(t),r.skip((({previousPosition:t})=>!t.isEqual(c))))}e.viewPosition=c});var s,a;t.editing.mapper.on("modelToViewPosition",r),t.data.mapper.on("modelToViewPosition",r),this.listenTo(e.document,"change:data",function(t,e,n,i){return()=>{const i=t.document.differ.getChanges(),s=[],a=new Map,c=new Set;for(const t of i)if("insert"==t.type&&"$text"!=t.name)KB(t.position,a),t.attributes.has("listItemId")?c.add(t.position.nodeAfter):KB(t.position.getShiftedBy(t.length),a);else if("remove"==t.type&&t.attributes.has("listItemId"))KB(t.position,a);else if("attribute"==t.type){const e=t.range.start.nodeAfter;n.includes(t.attributeKey)?(KB(t.range.start,a),null===t.attributeNewValue?(KB(t.range.start.getShiftedBy(1),a),r(e)&&s.push(e)):c.add(e)):lB(e)&&r(e)&&s.push(e)}for(const t of a.values())s.push(...o(t,c));for(const t of new Set(s))e.reconvertItem(t)};function o(t,e){const i=[],o=new Set,a=[];for(const{node:c,previous:l}of YD(t,"forward")){if(o.has(c))continue;const t=c.getAttribute("listIndent");l&&tn.includes(t))));const d=hB(c,{direction:"forward"});for(const t of d)o.add(t),(r(t,d)||s(t,a,e))&&i.push(t)}return i}function r(t,o){const r=e.mapper.toViewElement(t);if(!r)return!1;if(i.fire("checkElement",{modelElement:t,viewElement:r}))return!0;if(!t.is("element","paragraph")&&!t.is("element","listItem"))return!1;const s=tS(t,n,o);return!(!s||!r.is("element","p"))||!(s||!r.is("element","span"))}function s(t,n,o){if(o.has(t))return!1;const r=e.mapper.toViewElement(t);let s=n.length-1;for(let t=r.parent;!t.is("editableElement");t=t.parent){const e=qB(t),o=jB(t);if(!o&&!e)continue;const r="checkAttributes:"+(e?"item":"list");if(i.fire(r,{viewElement:t,modelAttributes:n[s]}))break;if(o&&(s--,s<0))return!1}return!0}}(e,t.editing,n,this),{priority:"high"}),this.on("checkAttributes:item",((t,{viewElement:e,modelAttributes:n})=>{e.id!=n.listItemId&&(t.return=!0,t.stop())})),this.on("checkAttributes:list",((t,{viewElement:e,modelAttributes:n})=>{e.name==$B(n.listType)&&e.id==GB(n.listType,n.listIndent)||(t.return=!0,t.stop())}))}_setupModelPostFixing(){const t=this.editor.model,e=this.getListAttributeNames();t.document.registerPostFixer((n=>function(t,e,n,i){const o=t.document.differ.getChanges(),r=new Map,s=i.editor.config.get("list.multiBlock");let a=!1;for(const i of o){if("insert"==i.type&&"$text"!=i.name){const o=i.position.nodeAfter;if(!t.schema.checkAttribute(o,"listItemId"))for(const t of Array.from(o.getAttributeKeys()))n.includes(t)&&(e.removeAttribute(t,o),a=!0);KB(i.position,r),i.attributes.has("listItemId")||KB(i.position.getShiftedBy(i.length),r);for(const{item:e,previousPosition:n}of t.createRangeIn(o))lB(e)&&KB(n,r)}else"remove"==i.type?KB(i.position,r):"attribute"==i.type&&n.includes(i.attributeKey)&&(KB(i.range.start,r),null===i.attributeNewValue&&KB(i.range.start.getShiftedBy(1),r));if(!s&&"attribute"==i.type&&rS.includes(i.attributeKey)){const t=i.range.start.nodeAfter;null===i.attributeNewValue&&t&&t.is("element","listItem")?(e.rename(t,"paragraph"),a=!0):null===i.attributeOldValue&&t&&t.is("element")&&"listItem"!=t.name&&(e.rename(t,"listItem"),a=!0)}}const c=new Set;for(const t of r.values())a=i.fire("postFixer",{listNodes:new QD(t),listHead:t,writer:e,seenIds:c})||a;return a}(t,n,e,this))),this.on("postFixer",((t,{listNodes:e,writer:n})=>{t.return=function(t,e){let n=0,i=-1,o=null,r=!1;for(const{node:s}of t){const t=s.getAttribute("listIndent");if(t>n){let a;null===o?(o=t-n,a=n):(o>t&&(o=t),a=t-o),a>i+1&&(a=i+1),e.setAttribute("listIndent",a,s),r=!0,i=a}else o=null,n=t+1,i=t}return r}(e,n)||t.return}),{priority:"high"}),this.on("postFixer",((t,{listNodes:e,writer:n,seenIds:i})=>{t.return=function(t,e,n){const i=new Set;let o=!1;for(const{node:r}of t){if(i.has(r))continue;let t=r.getAttribute("listType"),s=r.getAttribute("listItemId");if(e.has(s)&&(s=cB.next()),e.add(s),r.is("element","listItem"))r.getAttribute("listItemId")!=s&&(n.setAttribute("listItemId",s,r),o=!0);else for(const e of hB(r,{direction:"forward"}))i.add(e),e.getAttribute("listType")!=t&&(s=cB.next(),t=e.getAttribute("listType")),e.getAttribute("listItemId")!=s&&(n.setAttribute("listItemId",s,e),o=!0)}return o}(e,i,n)||t.return}),{priority:"high"})}_setupClipboardIntegration(){const t=this.editor.model,e=this.editor.plugins.get("ClipboardPipeline");this.listenTo(t,"insertContent",function(t){return(e,[n,i])=>{const o=n.is("documentFragment")?Array.from(n.getChildren()):[n];if(!o.length)return;const r=(i?t.createSelection(i):t.document.selection).getFirstPosition();let s;if(lB(r.parent))s=r.parent;else{if(!lB(r.nodeBefore))return;s=r.nodeBefore}t.change((t=>{const e=s.getAttribute("listType"),n=s.getAttribute("listIndent"),i=o[0].getAttribute("listIndent")||0,r=Math.max(n-i,0);for(const n of o){const i=lB(n);s.is("element","listItem")&&n.is("element","paragraph")&&t.rename(n,"listItem"),t.setAttributes({listIndent:(i?n.getAttribute("listIndent"):0)+r,listItemId:i?n.getAttribute("listItemId"):cB.next(),listType:e},n)}}))}}(t),{priority:"high"}),this.listenTo(e,"outputTransformation",((e,n)=>{t.change((t=>{const e=Array.from(n.content.getChildren()),i=e[e.length-1];if(e.length>1&&i.is("element")&&i.isEmpty){e.slice(0,-1).every(lB)&&t.remove(i)}if("copy"==n.method||"cut"==n.method){const e=Array.from(n.content.getChildren());AB(e)&&_B(e,t)}}))}))}_setupAccessibilityIntegration(){const t=this.editor,e=t.t;t.accessibility.addKeystrokeInfoGroup({id:"list",label:e("Keystrokes that can be used in a list"),keystrokes:[{label:e("Increase list item indent"),keystroke:"Tab"},{label:e("Decrease list item indent"),keystroke:"Shift+Tab"}]})}}function aS(t,e){const n=t.document.selection;if(!n.isCollapsed)return!vB(t);if("forward"===e)return!0;const i=n.getFirstPosition().parent,o=i.previousSibling;return!t.schema.isObject(o)&&(!!o.isEmpty||AB([i,o]))}function cS(t,e,n,i){t.ui.componentFactory.add(e,(()=>{const o=lS(mg,t,e,n,i);return o.set({tooltip:!0,isToggleable:!0}),o})),t.ui.componentFactory.add(`menuBar:${e}`,(()=>lS(mw,t,e,n,i)))}function lS(t,e,n,i,o){const r=e.commands.get(n),s=new t(e.locale);return s.set({label:i,icon:o}),s.bind("isOn","isEnabled").to(r,"value","isEnabled"),s.on("execute",(()=>{e.execute(n),e.editing.view.focus()})),s}class dS extends er{static get pluginName(){return"ListUI"}init(){const t=this.editor.t;this.editor.ui.componentFactory.has("numberedList")||cS(this.editor,"numberedList",t("Numbered List"),ym.numberedList),this.editor.ui.componentFactory.has("bulletedList")||cS(this.editor,"bulletedList",t("Bulleted List"),ym.bulletedList)}}class hS extends er{static get requires(){return[sS,dS]}static get pluginName(){return"List"}}const uS={},mS={},gS={},pS=[{listStyle:"disc",typeAttribute:"disc",listType:"bulleted"},{listStyle:"circle",typeAttribute:"circle",listType:"bulleted"},{listStyle:"square",typeAttribute:"square",listType:"bulleted"},{listStyle:"decimal",typeAttribute:"1",listType:"numbered"},{listStyle:"decimal-leading-zero",typeAttribute:null,listType:"numbered"},{listStyle:"lower-roman",typeAttribute:"i",listType:"numbered"},{listStyle:"upper-roman",typeAttribute:"I",listType:"numbered"},{listStyle:"lower-alpha",typeAttribute:"a",listType:"numbered"},{listStyle:"upper-alpha",typeAttribute:"A",listType:"numbered"},{listStyle:"lower-latin",typeAttribute:"a",listType:"numbered"},{listStyle:"upper-latin",typeAttribute:"A",listType:"numbered"}];for(const{listStyle:t,typeAttribute:e,listType:n}of pS)uS[t]=n,mS[t]=e,e&&(gS[e]=t);var fS=n(9968),bS={injectType:"singletonStyleTag",attributes:{"data-cke":!0},insert:"head",singleton:!0};gr()(fS.A,bS);fS.A.locals;var kS=n(7141),wS={injectType:"singletonStyleTag",attributes:{"data-cke":!0},insert:"head",singleton:!0};gr()(kS.A,wS);kS.A.locals;Object.defineProperty,Object.defineProperties,Object.getOwnPropertyDescriptors,Object.getOwnPropertySymbols,Object.prototype.hasOwnProperty,Object.prototype.propertyIsEnumerable;class _S extends ir{constructor(t){super(t),this.on("execute",(()=>{this.refresh()}),{priority:"highest"})}refresh(){const t=this._getSelectedItems();this.value=this._getValue(t),this.isEnabled=!!t.length}execute(t={}){this.editor.model.change((e=>{const n=this._getSelectedItems(),i=void 0===t.forceValue?!this._getValue(n):t.forceValue;for(const t of n)i?e.setAttribute("todoListChecked",!0,t):e.removeAttribute("todoListChecked",t)}))}_getValue(t){return t.every((t=>t.getAttribute("todoListChecked")))}_getSelectedItems(){const t=this.editor.model,e=t.schema,n=t.document.selection.getFirstRange(),i=n.start.parent,o=[];e.checkAttribute(i,"todoListChecked")&&o.push(...dB(i));for(const t of n.getItems({shallow:!0}))e.checkAttribute(t,"todoListChecked")&&!o.includes(t)&&o.push(...dB(t));return o}}class AS extends Ta{constructor(){super(...arguments),this.domEventType=["change"]}onDomEvent(t){if(t.target){const e=this.view.domConverter.mapDomToView(t.target);e&&e.is("element","input")&&"checkbox"==e.getAttribute("type")&&e.findAncestor({classes:"todo-list__label"})&&this.fire("todoCheckboxChange",t)}}}var CS=Object.defineProperty,vS=Object.getOwnPropertySymbols,yS=Object.prototype.hasOwnProperty,xS=Object.prototype.propertyIsEnumerable,ES=(t,e,n)=>e in t?CS(t,e,{enumerable:!0,configurable:!0,writable:!0,value:n}):t[e]=n,DS=(t,e)=>{for(var n in e||(e={}))yS.call(e,n)&&ES(t,n,e[n]);if(vS)for(var n of vS(e))xS.call(e,n)&&ES(t,n,e[n]);return t};const BS=bo("Ctrl+Enter");class SS extends er{static get pluginName(){return"TodoListEditing"}static get requires(){return[sS]}init(){const t=this.editor,e=t.model,n=t.editing,i=t.plugins.get(sS),o=t.config.get("list.multiBlock")?"paragraph":"listItem";t.commands.add("todoList",new zB(t,"todo")),t.commands.add("checkTodoList",new _S(t)),n.view.addObserver(AS),e.schema.extend("$listItem",{allowAttributes:"todoListChecked"}),e.schema.addAttributeCheck(((t,e)=>{const n=t.last;if("todoListChecked"==e)return!(!n.getAttribute("listItemId")||"todo"!=n.getAttribute("listType"))&&void 0})),t.conversion.for("upcast").add((t=>{t.on("element:input",((t,e,n)=>{const i=e.modelCursor,o=i.parent,r=e.viewItem;if(!n.consumable.test(r,{name:!0}))return;if("checkbox"!=r.getAttribute("type")||!i.isAtStart||!o.hasAttribute("listType"))return;n.consumable.consume(r,{name:!0});const s=n.writer;s.setAttribute("listType","todo",o),e.viewItem.hasAttribute("checked")&&s.setAttribute("todoListChecked",!0,o),e.modelRange=s.createRange(i)})),t.on("element:label",TS({name:"label",classes:"todo-list__label"})),t.on("element:label",TS({name:"label",classes:["todo-list__label","todo-list__label_without-description"]})),t.on("element:span",TS({name:"span",classes:"todo-list__label__description"})),t.on("element:ul",function(t){const e=new Ir(t);return(t,n,i)=>{const o=e.match(n.viewItem);if(!o)return;const r=o.match;r.name=!1,i.consumable.consume(n.viewItem,r)}}({name:"ul",classes:"todo-list"}))})),t.conversion.for("downcast").elementToElement({model:o,view:(t,{writer:e})=>{if(IS(t,i.getListAttributeNames()))return e.createContainerElement("span",{class:"todo-list__label__description"})},converterPriority:"highest"}),i.registerDowncastStrategy({scope:"list",attributeName:"listType",setAttributeOnDowncast(t,e,n){"todo"==e?t.addClass("todo-list",n):t.removeClass("todo-list",n)}}),i.registerDowncastStrategy({scope:"itemMarker",attributeName:"todoListChecked",createElement(t,e,{dataPipeline:n}){if("todo"!=e.getAttribute("listType"))return null;const i=t.createUIElement("input",DS(DS({type:"checkbox"},e.getAttribute("todoListChecked")?{checked:"checked"}:null),n?{disabled:"disabled"}:{tabindex:"-1"}));if(n)return i;const o=t.createContainerElement("span",{contenteditable:"false"},i);return o.getFillerOffset=()=>null,o},canWrapElement:t=>IS(t,i.getListAttributeNames()),createWrapperElement(t,e,{dataPipeline:n}){const o=["todo-list__label"];return IS(e,i.getListAttributeNames())||o.push("todo-list__label_without-description"),t.createAttributeElement(n?"label":"span",{class:o.join(" ")})}}),i.on("checkElement",((t,{modelElement:e,viewElement:n})=>{const o=IS(e,i.getListAttributeNames());n.hasClass("todo-list__label__description")!=o&&(t.return=!0,t.stop())})),i.on("checkElement",((e,{modelElement:n,viewElement:i})=>{const o="todo"==n.getAttribute("listType")&&mB(n);let r=!1;const s=t.editing.view.createPositionBefore(i).getWalker({direction:"backward"});for(const{item:e}of s){if(e.is("element")&&t.editing.mapper.toModelElement(e))break;e.is("element","input")&&"checkbox"==e.getAttribute("type")&&(r=!0)}r!=o&&(e.return=!0,e.stop())})),i.on("postFixer",((t,{listNodes:e,writer:n})=>{for(const{node:i,previousNodeInList:o}of e){if(!o)continue;if(o.getAttribute("listItemId")!=i.getAttribute("listItemId"))continue;const e=o.hasAttribute("todoListChecked"),r=i.hasAttribute("todoListChecked");r&&!e?(n.removeAttribute("todoListChecked",i),t.return=!0):!r&&e&&(n.setAttribute("todoListChecked",!0,i),t.return=!0)}})),e.document.registerPostFixer((t=>{const n=e.document.differ.getChanges();let i=!1;for(const e of n)if("attribute"==e.type&&"listType"==e.attributeKey){const n=e.range.start.nodeAfter;"todo"==e.attributeOldValue&&n.hasAttribute("todoListChecked")&&(t.removeAttribute("todoListChecked",n),i=!0)}else if("insert"==e.type&&"$text"!=e.name)for(const{item:n}of t.createRangeOn(e.position.nodeAfter))n.is("element")&&"todo"!=n.getAttribute("listType")&&n.hasAttribute("todoListChecked")&&(t.removeAttribute("todoListChecked",n),i=!0);return i})),this.listenTo(n.view.document,"keydown",((e,n)=>{fo(n)===BS&&(t.execute("checkTodoList"),e.stop())}),{priority:"high"}),this.listenTo(n.view.document,"todoCheckboxChange",((t,e)=>{const i=e.target;if(!i||!i.is("element","input"))return;const o=n.view.createPositionAfter(i),r=n.mapper.toModelPosition(o).parent;r&&lB(r)&&"todo"==r.getAttribute("listType")&&this._handleCheckmarkChange(r)})),this.listenTo(n.view.document,"arrowKey",function(t,e){return(n,i)=>{const o=wo(i.keyCode,e.contentLanguageDirection),r=t.schema,s=t.document.selection;if(!s.isCollapsed)return;const a=s.getFirstPosition(),c=a.parent;if("right"==o&&a.isAtEnd){const e=r.getNearestSelectionRange(t.createPositionAfter(c),"forward");if(!e)return;const o=e.start.parent;o&&lB(o)&&"todo"==o.getAttribute("listType")&&(t.change((t=>t.setSelection(e))),i.preventDefault(),i.stopPropagation(),n.stop())}else if("left"==o&&a.isAtStart&&lB(c)&&"todo"==c.getAttribute("listType")){const e=r.getNearestSelectionRange(t.createPositionBefore(c),"backward");if(!e)return;t.change((t=>t.setSelection(e))),i.preventDefault(),i.stopPropagation(),n.stop()}}}(e,t.locale),{context:"$text"}),this.listenTo(n.mapper,"viewToModelPosition",((t,n)=>{const i=n.viewPosition.parent,o=i.is("attributeElement","li")&&0==n.viewPosition.offset,r=PS(i)&&n.viewPosition.offset<=1,s=i.is("element","span")&&"false"==i.getAttribute("contenteditable")&&PS(i.parent);if(!o&&!r&&!s)return;const a=n.modelPosition.nodeAfter;a&&"todo"==a.getAttribute("listType")&&(n.modelPosition=e.createPositionAt(a,0))}),{priority:"low"}),this._initAriaAnnouncements()}_handleCheckmarkChange(t){const e=this.editor,n=e.model,i=Array.from(n.document.selection.getRanges());n.change((n=>{n.setSelection(t,"end"),e.execute("checkTodoList"),n.setSelection(i)}))}_initAriaAnnouncements(){const{model:t,ui:e,t:n}=this.editor;let i=null;e&&t.document.selection.on("change:range",(()=>{const o=t.document.selection.focus.parent,r=RS(i),s=RS(o);r&&!s?e.ariaLiveAnnouncer.announce(n("Leaving a to-do list")):!r&&s&&e.ariaLiveAnnouncer.announce(n("Entering a to-do list")),i=o}))}}function TS(t){const e=new Ir(t);return(t,n,i)=>{const o=e.match(n.viewItem);o&&i.consumable.consume(n.viewItem,o.match)&&Object.assign(n,i.convertChildren(n.viewItem,n.modelCursor))}}function IS(t,e){return(t.is("element","paragraph")||t.is("element","listItem"))&&"todo"==t.getAttribute("listType")&&mB(t)&&function(t,e){for(const n of t.getAttributeKeys())if(!n.startsWith("selection:")&&!e.includes(n))return!1;return!0}(t,e)}function PS(t){return!!t&&t.is("attributeElement")&&t.hasClass("todo-list__label")}function RS(t){return!!t&&(!(!t.is("element","paragraph")&&!t.is("element","listItem"))&&"todo"==t.getAttribute("listType"))}class VS extends er{static get pluginName(){return"TodoListUI"}init(){const t=this.editor.t;cS(this.editor,"todoList",t("To-do List"),ym.todoList)}}var FS=n(8991),LS={injectType:"singletonStyleTag",attributes:{"data-cke":!0},insert:"head",singleton:!0};gr()(FS.A,LS);FS.A.locals;class OS extends er{static get requires(){return[SS,VS]}static get pluginName(){return"TodoList"}}bo("Ctrl+Enter");function zS(t){return void 0!==t&&t.endsWith("px")}function MS(t){return t.toFixed(2).replace(/\.?0+$/,"")+"px"}var NS=Object.defineProperty,HS=Object.defineProperties,jS=Object.getOwnPropertyDescriptors,qS=Object.getOwnPropertySymbols,WS=Object.prototype.hasOwnProperty,US=Object.prototype.propertyIsEnumerable,$S=(t,e,n)=>e in t?NS(t,e,{enumerable:!0,configurable:!0,writable:!0,value:n}):t[e]=n,GS=(t,e)=>{for(var n in e||(e={}))WS.call(e,n)&&$S(t,n,e[n]);if(qS)for(var n of qS(e))US.call(e,n)&&$S(t,n,e[n]);return t};function KS(t,e,n){if(!t.childCount)return;const i=new Au(t.document),o=function(t,e){const n=e.createRangeIn(t),i=[],o=new Set;for(const t of n.getItems()){if(!t.is("element")||!t.name.match(/^(p|h\d+|li|div)$/))continue;let e=nT(t);if(void 0===e||0!=parseFloat(e)||Array.from(t.getClassNames()).find((t=>t.startsWith("MsoList")))||(e=void 0),t.hasStyle("mso-list")||void 0!==e&&o.has(e)){const n=tT(t);i.push({element:t,id:n.id,order:n.order,indent:n.indent,marginLeft:e}),void 0!==e&&o.add(e)}else o.clear()}return i}(t,i);if(!o.length)return;const r={},s=[];for(const t of o)if(void 0!==t.indent){JS(t)||(s.length=0);const o=`${t.id}:${t.indent}`,c=Math.min(t.indent-1,s.length);if(cs.length-1||s[c].listElement.name!=l.type){0==c&&"ol"==l.type&&void 0!==t.id&&r[o]&&(l.startIndex=r[o]);const e=XS(l,i,n);if(zS(t.marginLeft)&&(0==c||zS(s[c-1].marginLeft))){let n=t.marginLeft;c>0&&(n=MS(parseFloat(n)-parseFloat(s[c-1].marginLeft))),i.setStyle("padding-left",n,e)}if(0==s.length){const n=t.element.parent,o=n.getChildIndex(t.element)+1;i.insertChild(o,e,n)}else{const t=s[c-1].listItemElements;i.appendChild(e,t[t.length-1])}s[c]=(a=GS({},t),HS(a,jS({listElement:e,listItemElements:[]}))),0==c&&void 0!==t.id&&(r[o]=l.startIndex||1)}}const l="li"==t.element.name?t.element:i.createElement("li");i.appendChild(l,s[c].listElement),s[c].listItemElements.push(l),0==c&&void 0!==t.id&&r[o]++,t.element!=l&&i.appendChild(t.element,l),eT(t.element,i),i.removeStyle("text-indent",t.element),i.removeStyle("margin-left",t.element)}else{const e=s.find((e=>e.marginLeft==t.marginLeft));if(e){const n=e.listItemElements;i.appendChild(t.element,n[n.length-1]),i.removeStyle("margin-left",t.element)}else s.length=0}var a}function JS(t){const e=t.element.previousSibling;return ZS(e||t.element.parent)}function ZS(t){return t.is("element","ol")||t.is("element","ul")}function YS(t,e){const n=new RegExp(`@list l${t.id}:level${t.indent}\\s*({[^}]*)`,"gi"),i=/mso-level-number-format:([^;]{0,100});/gi,o=/mso-level-start-at:\s{0,100}([0-9]{0,10})\s{0,100};/gi,r=new RegExp(`@list\\s+l${t.id}:level\\d\\s*{[^{]*mso-level-text:"%\\d\\\\.`,"gi"),s=new RegExp(`@list l${t.id}:level\\d\\s*{[^{]*mso-level-number-format:`,"gi"),a=r.exec(e),c=s.exec(e),l=a&&!c,d=n.exec(e);let h="decimal",u="ol",m=null;if(d&&d[1]){const e=i.exec(d[1]);if(e&&e[1]&&(h=e[1].trim(),u="bullet"!==h&&"image"!==h?"ol":"ul"),"bullet"===h){const e=function(t){if("li"==t.name&&"ul"==t.parent.name&&t.parent.hasAttribute("type"))return t.parent.getAttribute("type");const e=function(t){if(t.getChild(0).is("$text"))return null;for(const e of t.getChildren()){if(!e.is("element","span"))continue;const t=e.getChild(0);if(t)return t.is("$text")?t:t.getChild(0)}return null}(t);if(!e)return null;const n=e._data;if("o"===n)return"circle";if("·"===n)return"disc";if("§"===n)return"square";return null}(t.element);e&&(h=e)}else{const t=o.exec(d[1]);t&&t[1]&&(m=parseInt(t[1]))}l&&(u="ol")}return{type:u,startIndex:m,style:QS(h),isLegalStyleList:l}}function QS(t){if(t.startsWith("arabic-leading-zero"))return"decimal-leading-zero";switch(t){case"alpha-upper":return"upper-alpha";case"alpha-lower":return"lower-alpha";case"roman-upper":return"upper-roman";case"roman-lower":return"lower-roman";case"circle":case"disc":case"square":return t;default:return null}}function XS(t,e,n){const i=e.createElement(t.type);return t.style&&e.setStyle("list-style-type",t.style,i),t.startIndex&&t.startIndex>1&&e.setAttribute("start",t.startIndex,i),t.isLegalStyleList&&n&&e.addClass("legal-list",i),i}function tT(t){const e=t.getStyle("mso-list");if(void 0===e)return{};const n=e.match(/(^|\s{1,100})l(\d+)/i),i=e.match(/\s{0,100}lfo(\d+)/i),o=e.match(/\s{0,100}level(\d+)/i);return n&&i&&o?{id:n[2],order:i[1],indent:parseInt(o[1])}:{indent:1}}function eT(t,e){const n=new Ir({name:"span",styles:{"mso-list":"Ignore"}}),i=e.createRangeIn(t);for(const t of i)"elementStart"===t.type&&n.match(t.item)&&e.remove(t.item)}function nT(t){const e=t.getStyle("margin-left");return void 0===e||e.endsWith("px")?e:function(t){const e=parseFloat(t);return t.endsWith("pt")?MS(96*e/72):t.endsWith("pc")?MS(12*e*96/72):t.endsWith("in")?MS(96*e):t.endsWith("cm")?MS(96*e/2.54):t.endsWith("mm")?MS(e/10*96/2.54):t}(e)}function iT(t,e){if(!t.childCount)return;const n=new Au(t.document),i=function(t,e){const n=e.createRangeIn(t),i=new Ir({name:/v:(.+)/}),o=[];for(const t of n){if("elementStart"!=t.type)continue;const e=t.item,n=e.previousSibling,r=n&&n.is("element")?n.name:null,s=["Chart"],a=i.match(e),c=e.getAttribute("o:gfxdata"),l="v:shapetype"===r,d=c&&s.some((t=>e.getAttribute("id").includes(t)));a&&c&&!l&&!d&&o.push(t.item.getAttribute("id"))}return o}(t,n);!function(t,e,n){const i=n.createRangeIn(e),o=new Ir({name:"img"}),r=[];for(const e of i)if(e.item.is("element")&&o.match(e.item)){const n=e.item,i=n.getAttribute("v:shapes")?n.getAttribute("v:shapes").split(" "):[];i.length&&i.every((e=>t.indexOf(e)>-1))?r.push(n):n.getAttribute("src")||r.push(n)}for(const t of r)n.remove(t)}(i,t,n),function(t,e,n){const i=n.createRangeIn(e),o=[];for(const e of i)if("elementStart"==e.type&&e.item.is("element","v:shape")){const n=e.item.getAttribute("id");if(t.includes(n))continue;r(e.item.parent.getChildren(),n)||o.push(e.item)}for(const t of o){const e={src:s(t)};t.hasAttribute("alt")&&(e.alt=t.getAttribute("alt"));const i=n.createElement("img",e);n.insertChild(t.index+1,i,t.parent)}function r(t,e){for(const n of t)if(n.is("element")){if("img"==n.name&&n.getAttribute("v:shapes")==e)return!0;if(r(n.getChildren(),e))return!0}return!1}function s(t){for(const e of t.getChildren())if(e.is("element")&&e.getAttribute("src"))return e.getAttribute("src")}}(i,t,n),function(t,e){const n=e.createRangeIn(t),i=new Ir({name:/v:(.+)/}),o=[];for(const t of n)"elementStart"==t.type&&i.match(t.item)&&o.push(t.item);for(const t of o)e.remove(t)}(t,n);const o=function(t,e){const n=e.createRangeIn(t),i=new Ir({name:"img"}),o=[];for(const t of n)t.item.is("element")&&i.match(t.item)&&t.item.getAttribute("src").startsWith("file://")&&o.push(t.item);return o}(t,n);o.length&&function(t,e,n){if(t.length===e.length)for(let i=0;iString.fromCharCode(parseInt(t,16)))).join(""))}const rT=//i,sT=/xmlns:o="urn:schemas-microsoft-com/i;class aT{constructor(t,e=!1){this.document=t,this.hasMultiLevelListPlugin=e}isActive(t){return rT.test(t)||sT.test(t)}execute(t){const{body:e,stylesString:n}=t._parsedData;KS(e,n,this.hasMultiLevelListPlugin),iT(e,t.dataTransfer.getData("text/rtf")),function(t){const e=[],n=new Au(t.document);for(const{item:i}of n.createRangeIn(t))if(i.is("element")){for(const t of i.getClassNames())/\bmso/gi.exec(t)&&n.removeClass(t,i);for(const t of i.getStyleNames())/\bmso/gi.exec(t)&&n.removeStyle(t,i);(i.is("element","w:sdt")||i.is("element","w:sdtpr")&&i.isEmpty||i.is("element","o:p")&&i.isEmpty)&&e.push(i)}for(const t of e){const e=t.parent,i=e.getChildIndex(t);n.insertChild(i,t.getChildren(),e),n.remove(t)}}(e),t.content=e}}function cT(t,e,n,{blockElements:i,inlineObjectElements:o}){let r=n.createPositionAt(t,"forward"==e?"after":"before");return r=r.getLastMatchingPosition((({item:t})=>t.is("element")&&!i.includes(t.name)&&!o.includes(t.name)),{direction:e}),"forward"==e?r.nodeAfter:r.nodeBefore}function lT(t,e){return!!t&&t.is("element")&&e.includes(t.name)}const dT=/id=("|')docs-internal-guid-[-0-9a-f]+("|')/i;class hT{constructor(t){this.document=t}isActive(t){return dT.test(t)}execute(t){const e=new Au(this.document),{body:n}=t._parsedData;!function(t,e){for(const n of t.getChildren())if(n.is("element","b")&&"normal"===n.getStyle("font-weight")){const i=t.getChildIndex(n);e.remove(n),e.insertChild(i,n.getChildren(),t)}}(n,e),function(t,e){for(const n of e.createRangeIn(t)){const t=n.item;if(t.is("element","li")){const n=t.getChild(0);n&&n.is("element","p")&&e.unwrapElement(n)}}}(n,e),function(t,e){const n=new Is(e.document.stylesProcessor),i=new Ca(n,{renderingMode:"data"}),o=i.blockElements,r=i.inlineObjectElements,s=[];for(const n of e.createRangeIn(t)){const t=n.item;if(t.is("element","br")){const n=cT(t,"forward",e,{blockElements:o,inlineObjectElements:r}),i=cT(t,"backward",e,{blockElements:o,inlineObjectElements:r}),a=lT(n,o);(lT(i,o)||a)&&s.push(t)}}for(const t of s)t.hasClass("Apple-interchange-newline")?e.remove(t):e.replace(t,e.createElement("p"))}(n,e),t.content=n}}const uT=/(\s+)<\/span>/g,((t,e)=>1===e.length?" ":Array(e.length+1).join(" ").substr(0,e.length)))}function pT(t,e){const n=new DOMParser,i=function(t){return gT(gT(t)).replace(/([^\S\r\n]*?)[\r\n]+([^\S\r\n]*<\/span>)/g,"$1$2").replace(/<\/span>/g,"").replace(/()[\r\n]+(<\/span>)/g,"$1 $2").replace(/ <\//g," ").replace(/ <\/o:p>/g," ").replace(/( |\u00A0)<\/o:p>/g,"").replace(/>([^\S\r\n]*[\r\n]\s*)<")}(function(t){const e="