diff --git a/Addon.ini b/Addon.ini index a9aff57..de82517 100644 --- a/Addon.ini +++ b/Addon.ini @@ -1,5 +1,5 @@ -Addon_Name = 'Typesetter Core' +Addon_Name = 'Typesetter Core' Addon_Unique_ID = 40 -Addon_Version = 5.3-p8-b2 \ No newline at end of file +Addon_Version = 5.3-p8 b3 \ No newline at end of file diff --git a/README.md b/README.md index 9d304b0..755f4f3 100644 --- a/README.md +++ b/README.md @@ -1,4 +1,4 @@ -*** beta1 +*** beta3 - RC will be the version with php8.2

Typesetter CMS

diff --git a/include/common.php b/include/common.php index 5e99496..aca641c 100644 --- a/include/common.php +++ b/include/common.php @@ -50,7 +50,7 @@ gp_defined('CMS_NAME_FULL', 'Typesetter CMS'); gp_defined('addon_browse_path', CMS_DOMAIN . '/index.php'); gp_defined('debug_path', CMS_DOMAIN . '/index.php/Debug'); -gp_defined('gpversion', '5.3-p8 b2'); +gp_defined('gpversion', '5.3-p8 b3'); gp_defined('gp_random', \gp\tool::RandomString()); diff --git a/include/thirdparty/ckeditor/CHANGES.md b/include/thirdparty/ckeditor/CHANGES.md index 74ebc5b..b936527 100644 --- a/include/thirdparty/ckeditor/CHANGES.md +++ b/include/thirdparty/ckeditor/CHANGES.md @@ -1,11 +1,131 @@ CKEditor 4 Changelog ==================== -## CKEditor 4.17.1 +## CKEditor 4.19.1 + +Fixed Issues: + +* [#5125](https://github.com/ckeditor/ckeditor4/issues/5125): Fixed: Deleting a widget with disabled [autoParagraph](https://ckeditor.com/docs/ckeditor4/latest/api/CKEDITOR_config.html#cfg-autoParagraph) by the keyboard `backspace` key removes the editor editable area and crashes the editor. +* [#5135](https://github.com/ckeditor/ckeditor4/issues/5135): Fixed: The [`checkbox.setValue`](https://ckeditor.com/docs/ckeditor4/latest/api/CKEDITOR_ui_dialog_checkbox.html#method-setValue) and [`radio.setValue`](https://ckeditor.com/docs/ckeditor4/latest/api/CKEDITOR_ui_dialog_radio.html#method-setValue) methods are not chainable as stated in the documentation. Thanks to [Jordan Bradford](https://github.com/LordPachelbel)! +* [#5085](https://github.com/ckeditor/ckeditor4/issues/5085): Fixed: The [Language](https://ckeditor.com/cke4/addon/language) plugin removes the element marking the text in foreign language if said element does not have an information about the text direction. +* [#4284](https://github.com/ckeditor/ckeditor4/issues/4284): Fixed: [Tableselection](https://ckeditor.com/cke4/addon/tableselection) Merging cells with a rowspan throws an unexpected error and does not create an undo step. +* [#5184](https://github.com/ckeditor/ckeditor4/issues/5184): Fixed: The [Editor Placeholder](https://ckeditor.com/cke4/addon/wysiwygarea) plugin degrades typing performance. +* [#5158](https://github.com/ckeditor/ckeditor4/issues/5158): Fixed: [`CKEDITOR.tools#convertToPx()`](https://ckeditor.com/docs/ckeditor4/latest/api/CKEDITOR_tools.html#method-convertToPx) gives invalid results if the helper calculator element was deleted from the DOM. +* [#5234](https://github.com/ckeditor/ckeditor4/issues/5234): Fixed: [Easy Image](https://ckeditor.com/cke4/addon/easyimage) doesn't allow to upload images files using toolbar button. +* [#438](https://github.com/ckeditor/ckeditor4/issues/438): Fixed: It is impossible to navigate to the [elementspath](https://ckeditor.com/cke4/addon/elementspath) from the [toolbar](https://ckeditor.com/cke4/addon/toolbar) by keyboard and vice versa. +* [#4449](https://github.com/ckeditor/ckeditor4/issues/4449): Fixed: [`dialog.validate#functions`](https://ckeditor.com/docs/ckeditor4/latest/api/CKEDITOR_dialog_validate.html#method-functions) incorrectly composes functions that return an optional error message, like e.g. [`dialog.validate.number`](https://ckeditor.com/docs/ckeditor4/latest/api/CKEDITOR_dialog_validate.html#method-number) due to unnecessary return type coercion. +* [#4473](https://github.com/ckeditor/ckeditor4/issues/4473): Fixed: The [dialog.validate](https://ckeditor.com/docs/ckeditor4/latest/api/CKEDITOR_dialog_validate.html) method does not accept parameter value. The issue originated in [dialog.validate.functions](https://ckeditor.com/docs/ckeditor4/latest/api/CKEDITOR_dialog_validate.html#method-functions) method that did not properly propagate parameter value to validator. Affected validators: + * [`functions`](https://ckeditor.com/docs/ckeditor4/latest/api/CKEDITOR_dialog_validate.html#method-functions) + * [`equals`](https://ckeditor.com/docs/ckeditor4/latest/api/CKEDITOR_dialog_validate.html#method-equals) + * [`notEqual`](https://ckeditor.com/docs/ckeditor4/latest/api/CKEDITOR_dialog_validate.html#method-notEqual) + * [`cssLength`](https://ckeditor.com/docs/ckeditor4/latest/api/CKEDITOR_dialog_validate.html#method-cssLength) + * [`htmlLength`](https://ckeditor.com/docs/ckeditor4/latest/api/CKEDITOR_dialog_validate.html#method-htmlLength) + * [`inlineStyle`](https://ckeditor.com/docs/ckeditor4/latest/api/CKEDITOR_dialog_validate.html#method-inlineStyle) +* [#5147](https://github.com/ckeditor/ckeditor4/issues/5147): Fixed: The [Accessibility Help](https://ckeditor.com/cke4/addon/a11yhelp) dialog does not contain info about focus being moved back to the editing area upon leaving dialogs. +* [#5144](https://github.com/ckeditor/ckeditor4/issues/5144): Fixed: [Menu buttons](https://ckeditor.com/cke4/addon/menubutton) and [panel buttons](https://ckeditor.com/cke4/addon/panelbutton) incorrectly indicate the open status of their associated pop-up menus in the browser's accessibility tree. +* [#5022](https://github.com/ckeditor/ckeditor4/issues/5022): Fixed: [Find and Replace](https://ckeditor.com/cke4/addon/find) does not respond to the `Enter` key. + +API changes: + +* [#5184](https://github.com/ckeditor/ckeditor4/issues/5184): Added the [`config.editorplaceholder_delay`](https://ckeditor.com/docs/ckeditor4/latest/api/CKEDITOR_config.html#cfg-editorplaceholder_delay) configuration option allowing to delay placeholder before it is toggled when changing editor content. +* [#5184](https://github.com/ckeditor/ckeditor4/issues/5184): Added the [`CKEDITOR.tools#debounce()`](https://ckeditor.com/docs/ckeditor4/latest/api/CKEDITOR_tools.html#method-debounce) function allowing to postpone a passed function execution until the given milliseconds have elapsed since the last time it was invoked. + +## CKEditor 4.19.0 + +New features: + +* [#2444](https://github.com/ckeditor/ckeditor4/issues/2444): Togglable toolbar buttons are now exposed as toggle buttons in the browser's accessibility tree. +* [#4641](https://github.com/ckeditor/ckeditor4/issues/4641): Added an option allowing to cancel the [Delayed Editor Creation](https://ckeditor.com/docs/ckeditor4/latest/features/delayed_creation.html) feature as a function handle for editor creators ([`CKEDITOR.replace`](https://ckeditor.com/docs/ckeditor4/latest/api/CKEDITOR.html#method-replace), [`CKEDITOR.inline`](https://ckeditor.com/docs/ckeditor4/latest/api/CKEDITOR.html#method-inline), [`CKEDITOR.appendTo`](https://ckeditor.com/docs/ckeditor4/latest/api/CKEDITOR.html#method-appendTo)). +* [#4986](https://github.com/ckeditor/ckeditor4/issues/4986): Added [`config.shiftLineBreaks`](https://ckeditor.com/docs/ckeditor4/latest/api/CKEDITOR_config.html#cfg-shiftLineBreaks) allowing to preserve inline elements formatting when the `shift`+`enter` keystroke is used. +* [#2445](https://github.com/ckeditor/ckeditor4/issues/2445): Added [`config.applicationTitle`](https://ckeditor.com/docs/ckeditor4/latest/api/CKEDITOR_config.html#cfg-applicationTitle) configuration option allowing to customize or disable the editor's application region label. This option, combined with [`config.title`](https://ckeditor.com/docs/ckeditor4/latest/api/CKEDITOR_config.html#cfg-title), gives much better control over the editor's labels read by screen readers. + +Fixed Issues: + +* [#4543](https://github.com/ckeditor/ckeditor4/issues/4543): Fixed: Toolbar buttons toggle state is not correctly announced by screen readers lacking the information whether the feature is on or off. +* [#4052](https://github.com/ckeditor/ckeditor4/issues/4052): Fixed: Editor labels are read incorrectly by screen readers due to invalid editor control type for the [Iframe Editing Area](https://ckeditor.com/cke4/addon/wysiwygarea) editors. +* [#1904](https://github.com/ckeditor/ckeditor4/issues/1904): Fixed: Screen readers are not announcing the read-only editor state. +* [#4904](https://github.com/ckeditor/ckeditor4/issues/4904): Fixed: Table cell selection and navigation with the `tab` key behavior is inconsistent after adding a new row. +* [#3394](https://github.com/ckeditor/ckeditor4/issues/3394): Fixed: [Enhanced image](https://ckeditor.com/cke4/addon/image2) plugin dialog is not supporting URL with query string parameters. Thanks to [Simon Urli](https://github.com/surli)! +* [#5049](https://github.com/ckeditor/ckeditor4/issues/5049): Fixed: The editor fails in strict mode due to not following the `use strict` directives in a core editor module. +* [#5095](https://github.com/ckeditor/ckeditor4/issues/5095): Fixed: The [clipboard](https://ckeditor.com/cke4/addon/clipboard) plugin shows notification about unsupported file format when the file type is different than `jpg`, `gif`, `png`, not respecting [supported types](https://ckeditor.com/docs/ckeditor4/latest/api/CKEDITOR_fileTools_uploadWidgetDefinition.html#property-supportedTypes) by the [Upload Widget](https://ckeditor.com/cke4/addon/uploadwidget) plugin. +* [#4855](https://github.com/ckeditor/ckeditor4/issues/4855): [iOS] Fixed: Focusing toolbar buttons with an enabled VoiceOver screen reader moves the browser focus into an editable area and interrupts button functionality. + +API changes: + +* [#4641](https://github.com/ckeditor/ckeditor4/issues/4641): The [`CKEDITOR.replace`](https://ckeditor.com/docs/ckeditor4/latest/api/CKEDITOR.html#method-replace), [`CKEDITOR.inline`](https://ckeditor.com/docs/ckeditor4/latest/api/CKEDITOR.html#method-inline), [`CKEDITOR.appendTo`](https://ckeditor.com/docs/ckeditor4/latest/api/CKEDITOR.html#method-appendTo) functions are now returning a handle function allowing to cancel the [Delayed Editor Creation](https://ckeditor.com/docs/ckeditor4/latest/features/delayed_creation.html) feature. +* [#5095](https://github.com/ckeditor/ckeditor4/issues/5095): Added the [CKEDITOR.plugins.clipboard.addFileMatcher](https://ckeditor.com/docs/ckeditor4/latest/api/CKEDITOR_plugins_clipboard.html#method-addFileMatcher) function allowing to define file formats supported by the [clipboard](https://ckeditor.com/cke4/addon/clipboard) plugin. Trying to paste unsupported files will result in a notification that a file cannot be dropped or pasted into the editor. +* [#2445](https://github.com/ckeditor/ckeditor4/issues/2445): Added [`config.applicationTitle`](https://ckeditor.com/docs/ckeditor4/latest/api/CKEDITOR_config.html#cfg-applicationTitle) alongside [`CKEDITOR.editor#applicationTitle`](https://ckeditor.com/docs/ckeditor4/latest/api/CKEDITOR_editor.html#property-applicationTitle) to allow customizing editor's application region label. + +## CKEditor 4.18.0 + +**Security Updates:** + +* Fixed an XSS vulnerability in the core module reported by GitHub Security Lab team member [Kevin Backhouse](https://github.com/kevinbackhouse). + + Issue summary: The vulnerability allowed to inject malformed HTML bypassing content sanitization, which could result in executing a JavaScript code. See [CVE-2022-24728](https://github.com/ckeditor/ckeditor4/security/advisories/GHSA-4fc4-4p5g-6w89) for more details. + +* Fixed a Regular expression Denial of Service (ReDoS) vulnerability in dialog plugin discovered by the CKEditor 4 team during our regular security audit. + + Issue summary: The vulnerability allowed to abuse a dialog input validator regular expression, which could cause a significant performance drop resulting in a browser tab freeze. See [CVE-2022-24729](https://github.com/ckeditor/ckeditor4/security/advisories/GHSA-f6rf-9m92-x2hh) for more details. + +You can read more details in the relevant security advisory and [contact us](security@cksource.com) if you have more questions. + +**An upgrade is highly recommended!** + +**Highlights:** + +[Web Spell Checker](https://webspellchecker.com/) ended support for WebSpellChecker Dialog on December 31st, 2021. This means the plugin is not supported any longer. Therefore, we decided to deprecate and remove the WebSpellChecker Dialog plugin from CKEditor 4 presets. + +We strongly encourage everyone to choose one of the other available spellchecking solutions - [Spell Check As You Type (SCAYT)](https://ckeditor.com/cke4/addon/scayt) or [WProofreader](https://ckeditor.com/cke4/addon/wproofreader). Fixed issues: -* [#4979](https://github.com/ckeditor/ckeditor4/issues/3757): Added cache key in [#4761](https://github.com/ckeditor/ckeditor4/issues/4761) started to breaking relative links for external CSS resources. The fix had been reverted and will be corrected in the upcoming release. +* [#5097](https://github.com/ckeditor/ckeditor4/issues/5097): [Chrome] Fixed: Incorrect conversion of points to pixels while using [`CKEDITOR.tools.convertToPx()`](https://ckeditor.com/docs/ckeditor4/latest/api/CKEDITOR_tools.html#method-convertToPx). +* [#5044](https://github.com/ckeditor/ckeditor4/issues/5044): Fixed: `select` elements with `multiple` attribute had incorrect styling. Thanks to [John R. D'Orazio](https://github.com/JohnRDOrazio)! + +Other changes: + +* [#5093](https://github.com/ckeditor/ckeditor4/issues/5093): Deprecated and removed WebSpellChecker Dialog from presets. +* [#5127](https://github.com/ckeditor/ckeditor4/issues/5127): Deprecated the [`CKEDITOR.rnd`](https://ckeditor.com/docs/ckeditor4/latest/api/CKEDITOR.html#property-rnd) property to discourage using it in a security-sensitive context. +* [#5087](https://github.com/ckeditor/ckeditor4/issues/5087): Improved the jQuery adapter by replacing a deprecated jQuery API with existing counterparts. Thanks to [Fran Boon](https://github.com/flavour)! +* [#5128](https://github.com/ckeditor/ckeditor4/issues/5128): Improved the [Emoji](https://ckeditor.com/cke4/addon/emoji) definitions encoding set by the [`config.emoji_emojiListUrl`](https://ckeditor.com/docs/ckeditor4/latest/api/CKEDITOR_config.html#cfg-emoji_emojiListUrl) configuration option. + +## CKEditor 4.17.2 + +Fixed issues: + +* [#4934](https://github.com/ckeditor/ckeditor4/issues/4934): Fixed: Active focus in dialog tabs is not visible in the High Contrast mode. +* [#547](https://github.com/ckeditor/ckeditor4/issues/547): Fixed: Dragging and dropping elements like images within a table is no longer available. +* [#4875](https://github.com/ckeditor/ckeditor4/issues/4875): Fixed: It is not possible to delete multiple selected lists. +* [#4873](https://github.com/ckeditor/ckeditor4/issues/4873): Fixed: Pasting content from MS Word and Outlook with horizontal lines prevents images from being uploaded. +* [#4952](https://github.com/ckeditor/ckeditor4/issues/4952): Fixed: Dragging and dropping images within a table cell appends additional elements. +* [#4761](https://github.com/ckeditor/ckeditor4/issues/4761): Fixed: Some CSS files are missing unique timestamp used to prevent browser to cache static resources between editor releases. +* [#4987](https://github.com/ckeditor/ckeditor4/issues/4987): Fixed: [Find/Replace](https://ckeditor.com/cke4/addon/find) is not recognizing more than one space character. +* [#5061](https://github.com/ckeditor/ckeditor4/issues/5061): Fixed: [Find/Replace](https://ckeditor.com/cke4/addon/find) plugin incorrectly handles multiple whitespace during replacing text. +* [#5004](https://github.com/ckeditor/ckeditor4/issues/5004): Fixed: `MutationObserver` used in [IFrame Editing Area](https://ckeditor.com/cke4/addon/wysiwygarea) plugin causes memory leaks. +* [#4994](https://github.com/ckeditor/ckeditor4/issues/4994): Fixed: [Easy Image](https://ckeditor.com/cke4/addon/easyimage) plugin caused content pasted from Word to turn into an image. + +API changes: + +* [#4918](https://github.com/ckeditor/ckeditor4/issues/4918): Explicitly set the [`config.useComputedState`](https://ckeditor.com/docs/ckeditor4/latest/api/CKEDITOR_config.html#cfg-useComputedState) default value to `true`. Thanks to [Shabab Karim](https://github.com/shabab477)! +* [#4761](https://github.com/ckeditor/ckeditor4/issues/4761): The [`CKEDITOR.appendTimestamp()`](https://ckeditor.com/docs/ckeditor4/latest/api/CKEDITOR.html#method-appendTimestamp) function was added. +* [#4761](https://github.com/ckeditor/ckeditor4/issues/4761): [`CKEDITOR.dom.document#appendStyleSheet()`](https://ckeditor.com/docs/ckeditor4/latest/api/CKEDITOR_dom_document.html#method-appendStyleSheet) and [`CKEDITOR.tools.buildStyleHtml()`](https://ckeditor.com/docs/ckeditor4/latest/api/CKEDITOR_tools.html#method-buildStyleHtml) now use the newly added [`CKEDITOR.appendTimestamp()`](https://ckeditor.com/docs/ckeditor4/latest/api/CKEDITOR.html#method-appendTimestamp) function to correctly handle caching of CSS files. + +Other changes: + +* [#5014](https://github.com/ckeditor/ckeditor4/issues/5014): Fixed: Toolbar configurator fails when plugin does not define a toolbar group. Thanks to [SuperPat](https://github.com/SuperPat45)! + +## CKEditor 4.17.1 + +**Highlights:** + +Due to a regression in CKEeditor 4.17.0 version that was only revealed after the release and affected a limited area of operation, CSS assets loaded via relative links started to point into invalid location when loaded from external resources. + +We have therefore decided to immediately release CKEditor 4.17.1 that fixed this problem. If you have already upgraded to v4.17.0, make sure to upgrade to v4.17.1 to avoid this regression. + +Fixed issues: + +* [#4979](https://github.com/ckeditor/ckeditor4/issues/3757): Fixed: Added cache key in [#4761](https://github.com/ckeditor/ckeditor4/issues/4761) started to breaking relative links for external CSS resources. The fix has been reverted and will be corrected in the next editor version. ## CKEditor 4.17 @@ -13,11 +133,11 @@ Fixed issues: * Fixed XSS vulnerability in the core module reported by [William Bowling](https://github.com/wbowling). - Issue summary: The vulnerability allowed to inject malformed comments HTML bypassing content sanitization, which could result in executing JavaScript code. See [security advisory](https://github.com/ckeditor/ckeditor4/security/advisories/GHSA-7h26-63m7-qhf2) for more details. + Issue summary: The vulnerability allowed to inject malformed comments HTML bypassing content sanitization, which could result in executing JavaScript code. See [CVE-2021-41165](https://github.com/ckeditor/ckeditor4/security/advisories/GHSA-7h26-63m7-qhf2) for more details. * Fixed XSS vulnerability in the core module reported by [Maurice Dauer](https://twitter.com/laytonctf). - Issue summary: The vulnerability allowed to inject malformed HTML bypassing content sanitization, which could result in executing JavaScript code. See [security advisory](https://github.com/ckeditor/ckeditor4/security/advisories/GHSA-pvmx-g8h5-cprj) for more details. + Issue summary: The vulnerability allowed to inject malformed HTML bypassing content sanitization, which could result in executing JavaScript code. See [CVE-2021-41164](https://github.com/ckeditor/ckeditor4/security/advisories/GHSA-pvmx-g8h5-cprj) for more details. You can read more details in the relevant security advisory and [contact us](security@cksource.com) if you have more questions. @@ -79,15 +199,15 @@ Other Changes: * Fixed XSS vulnerability in the [Clipboard](https://ckeditor.com/cke4/addon/clipboard) plugin reported by [Anton Subbotin](https://github.com/skavans). - Issue summary: The vulnerability allowed to abuse paste functionality using malformed HTML, which could result in injecting arbitrary HTML into the editor. See [security advisory](https://github.com/ckeditor/ckeditor4/security/advisories/GHSA-7889-rm5j-hpgg) for more details. + Issue summary: The vulnerability allowed to abuse paste functionality using malformed HTML, which could result in injecting arbitrary HTML into the editor. See [CVE-2021-32809](https://github.com/ckeditor/ckeditor4/security/advisories/GHSA-7889-rm5j-hpgg) for more details. * Fixed XSS vulnerability in the [Widget](https://ckeditor.com/cke4/addon/widget) plugin reported by [Anton Subbotin](https://github.com/skavans). - Issue summary: The vulnerability allowed to abuse undo functionality using malformed [Widget](https://ckeditor.com/cke4/addon/widget) HTML, which could result in executing JavaScript code. See [security advisory](https://github.com/ckeditor/ckeditor4/security/advisories/GHSA-6226-h7ff-ch6c) for more details. + Issue summary: The vulnerability allowed to abuse undo functionality using malformed [Widget](https://ckeditor.com/cke4/addon/widget) HTML, which could result in executing JavaScript code. See [CVE-2021-32808](https://github.com/ckeditor/ckeditor4/security/advisories/GHSA-6226-h7ff-ch6c) for more details. * Fixed XSS vulnerability in the [Fake Objects](https://ckeditor.com/cke4/addon/fakeobjects) plugin reported by [Mika Kulmala](https://github.com/kulmik). - Issue summary: The vulnerability allowed to inject malformed [Fake Objects](https://ckeditor.com/cke4/addon/fakeobjects) HTML, which could result in executing JavaScript code. See [security advisory](https://github.com/ckeditor/ckeditor4/security/advisories/GHSA-m94c-37g6-cjhc) for more details. + Issue summary: The vulnerability allowed to inject malformed [Fake Objects](https://ckeditor.com/cke4/addon/fakeobjects) HTML, which could result in executing JavaScript code. See [CVE-2021-37695](https://github.com/ckeditor/ckeditor4/security/advisories/GHSA-m94c-37g6-cjhc) for more details. You can read more details in the relevant security advisory and [contact us](security@cksource.com) if you have more questions. @@ -117,7 +237,7 @@ Fixed Issues: * [#4351](https://github.com/ckeditor/ckeditor4/issues/4351): Fixed: Incorrect values for RGBA/HSLA colors in [Color Dialog](https://ckeditor.com/cke4/addon/colordialog). * [#4509](https://github.com/ckeditor/ckeditor4/issues/4509): Fixed: Incorrect handling of drag & drop inside [widgets](https://ckeditor.com/cke4/addon/widget) and nested editables. * [#4611](https://github.com/ckeditor/ckeditor4/issues/4611): [Android, iOS] Fixed: Incorrect hover styles for buttons in the toolbar on mobile devices. -* [#4652](https://github.com/ckeditor/ckeditor4/issues/4652): Fixed: [Event data](https://ckeditor.com/docs/ckeditor4/latest/api/CKEDITOR_eventInfo.html) set to `false` is treated as an event cancelation. +* [#4652](https://github.com/ckeditor/ckeditor4/issues/4652): Fixed: [Event data](https://ckeditor.com/docs/ckeditor4/latest/api/CKEDITOR_eventInfo.html) set to `false` is treated as an event cancellation. * [#4659](https://github.com/ckeditor/ckeditor4/issues/4659): Fixed: [`CKEDITOR.htmlParser`](https://ckeditor.com/docs/ckeditor4/latest/api/CKEDITOR_htmlParser.html) does not treat `--!>` as a comment end tag correctly. ## CKEditor 4.16 @@ -1616,7 +1736,7 @@ Other Changes: New Features: -* [#11297](https://dev.ckeditor.com/ticket/11297): Styles can now be applied to widgets. The definition of a style which can be applied to a specific widget must contain two additional properties — `type` and `widget`. Read more in the [Widget Styles](https://ckeditor.com/docs/ckeditor4/latest/guide/dev_styles.html#widget-styles) section of the "Syles Drop-down" guide. Note that by default, widgets support only classes and no other attributes or styles. Related changes and features: +* [#11297](https://dev.ckeditor.com/ticket/11297): Styles can now be applied to widgets. The definition of a style which can be applied to a specific widget must contain two additional properties — `type` and `widget`. Read more in the [Widget Styles](https://ckeditor.com/docs/ckeditor4/latest/guide/dev_styles.html#widget-styles) section of the "Styles Drop-down" guide. Note that by default, widgets support only classes and no other attributes or styles. Related changes and features: * Introduced the [`CKEDITOR.style.addCustomHandler()`](https://ckeditor.com/docs/ckeditor4/latest/api/CKEDITOR_style.html#static-method-addCustomHandler) method for registering custom style handlers. * The [`CKEDITOR.style.apply()`](https://ckeditor.com/docs/ckeditor4/latest/api/CKEDITOR_style.html#method-apply) and [`CKEDITOR.style.remove()`](https://ckeditor.com/docs/ckeditor4/latest/api/CKEDITOR_style.html#method-remove) methods are now called with an editor instance instead of the document so they can be reused by the [`CKEDITOR.editor.applyStyle()`](https://ckeditor.com/docs/ckeditor4/latest/api/CKEDITOR_editor.html#method-applyStyle) and [`CKEDITOR.editor.removeStyle()`](https://ckeditor.com/docs/ckeditor4/latest/api/CKEDITOR_editor.html#method-removeStyle) methods. Backward compatibility was preserved, but from CKEditor 4.4 it is highly recommended to pass an editor instead of a document to these methods. * Many new methods and properties were introduced in the [Widget API](https://ckeditor.com/docs/ckeditor4/latest/api/CKEDITOR.plugins.widget.html) to make the handling of styles by widgets fully customizable. See: [`widget.definition.styleableElements`](https://ckeditor.com/docs/ckeditor4/latest/api/CKEDITOR_plugins_widget_definition.html#property-styleableElements), [`widget.definition.styleToAllowedContentRule`](https://ckeditor.com/docs/ckeditor4/latest/api/CKEDITOR_plugins_widget_definition.html#property-styleToAllowedContentRules), [`widget.addClass()`](https://ckeditor.com/docs/ckeditor4/latest/api/CKEDITOR_plugins_widget.html#method-addClass), [`widget.removeClass()`](https://ckeditor.com/docs/ckeditor4/latest/api/CKEDITOR_plugins_widget.html#method-removeClass), [`widget.getClasses()`](https://ckeditor.com/docs/ckeditor4/latest/api/CKEDITOR_plugins_widget.html#method-getClasses), [`widget.hasClass()`](https://ckeditor.com/docs/ckeditor4/latest/api/CKEDITOR_plugins_widget.html#method-hasClass), [`widget.applyStyle()`](https://ckeditor.com/docs/ckeditor4/latest/api/CKEDITOR_plugins_widget.html#method-applyStyle), [`widget.removeStyle()`](https://ckeditor.com/docs/ckeditor4/latest/api/CKEDITOR_plugins_widget.html#method-removeStyle), [`widget.checkStyleActive()`](https://ckeditor.com/docs/ckeditor4/latest/api/CKEDITOR_plugins_widget.html#method-checkStyleActive). diff --git a/include/thirdparty/ckeditor/LICENSE.md b/include/thirdparty/ckeditor/LICENSE.md index ad7b9d1..4056b1f 100644 --- a/include/thirdparty/ckeditor/LICENSE.md +++ b/include/thirdparty/ckeditor/LICENSE.md @@ -2,7 +2,7 @@ Software License Agreement ========================== CKEditor - The text editor for Internet - https://ckeditor.com/ -Copyright (c) 2003-2021, CKSource - Frederico Knabben. All rights reserved. +Copyright (c) 2003-2022, CKSource Holding sp. z o.o. All rights reserved. Licensed under the terms of any of the following licenses at your choice: @@ -37,7 +37,7 @@ done by developers outside of CKSource with their express permission. The following libraries are included in CKEditor under the MIT license (see Appendix D): -* CKSource Samples Framework (included in the samples) - Copyright (c) 2014-2021, CKSource - Frederico Knabben. +* CKSource Samples Framework (included in the samples) - Copyright (c) 2014-2022, CKSource Holding sp. z o.o. * PicoModal (included in `samples/js/sf.js`) - Copyright (c) 2012 James Frasca. * CodeMirror (included in the samples) - Copyright (C) 2014 by Marijn Haverbeke and others. * ES6Promise - Copyright (c) 2014 Yehuda Katz, Tom Dale, Stefan Penner and contributors. @@ -60,7 +60,7 @@ The following libraries are included in CKEditor under the BSD-3 License (see Ap Trademarks ---------- -CKEditor is a trademark of CKSource - Frederico Knabben. All other brand +CKEditor is a trademark of CKSource Holding sp. z o.o. All other brand and product names are trademarks, registered trademarks or service marks of their respective holders. diff --git a/include/thirdparty/ckeditor/README.md b/include/thirdparty/ckeditor/README.md index e0ea70e..25a1e60 100644 --- a/include/thirdparty/ckeditor/README.md +++ b/include/thirdparty/ckeditor/README.md @@ -1,7 +1,7 @@ CKEditor 4 ========== -Copyright (c) 2003-2021, CKSource - Frederico Knabben. All rights reserved. +Copyright (c) 2003-2022, CKSource Holding sp. z o.o. All rights reserved. https://ckeditor.com - See LICENSE.md for license information. CKEditor 4 is a text editor to be used inside web pages. It's not a replacement diff --git a/include/thirdparty/ckeditor/adapters/jquery.js b/include/thirdparty/ckeditor/adapters/jquery.js index 0f6e64f..0defc72 100644 --- a/include/thirdparty/ckeditor/adapters/jquery.js +++ b/include/thirdparty/ckeditor/adapters/jquery.js @@ -1,10 +1,10 @@ /* - Copyright (c) 2003-2021, CKSource - Frederico Knabben. All rights reserved. + Copyright (c) 2003-2022, CKSource Holding sp. z o.o. All rights reserved. For licensing, see LICENSE.md or https://ckeditor.com/legal/ckeditor-oss-license */ (function(a){if("undefined"==typeof a)throw Error("jQuery should be loaded before CKEditor jQuery adapter.");if("undefined"==typeof CKEDITOR)throw Error("CKEditor should be loaded before CKEditor jQuery adapter.");CKEDITOR.config.jqueryOverrideVal="undefined"==typeof CKEDITOR.config.jqueryOverrideVal?!0:CKEDITOR.config.jqueryOverrideVal;a.extend(a.fn,{ckeditorGet:function(){var a=this.eq(0).data("ckeditorInstance");if(!a)throw"CKEditor is not initialized yet, use ckeditor() with a callback.";return a}, -ckeditor:function(g,e){if(!CKEDITOR.env.isCompatible)throw Error("The environment is incompatible.");if(!a.isFunction(g)){var m=e;e=g;g=m}var k=[];e=e||{};this.each(function(){var b=a(this),c=b.data("ckeditorInstance"),f=b.data("_ckeditorInstanceLock"),h=this,l=new a.Deferred;k.push(l.promise());if(c&&!f)g&&g.apply(c,[this]),l.resolve();else if(f)c.once("instanceReady",function(){setTimeout(function d(){c.element?(c.element.$==h&&g&&g.apply(c,[h]),l.resolve()):setTimeout(d,100)},0)},null,null,9999); -else{if(e.autoUpdateElement||"undefined"==typeof e.autoUpdateElement&&CKEDITOR.config.autoUpdateElement)e.autoUpdateElementJquery=!0;e.autoUpdateElement=!1;b.data("_ckeditorInstanceLock",!0);c=a(this).is("textarea")?CKEDITOR.replace(h,e):CKEDITOR.inline(h,e);b.data("ckeditorInstance",c);c.on("instanceReady",function(e){var d=e.editor;setTimeout(function n(){if(d.element){e.removeListener();d.on("dataReady",function(){b.trigger("dataReady.ckeditor",[d])});d.on("setData",function(a){b.trigger("setData.ckeditor", -[d,a.data])});d.on("getData",function(a){b.trigger("getData.ckeditor",[d,a.data])},999);d.on("destroy",function(){b.trigger("destroy.ckeditor",[d])});d.on("save",function(){a(h.form).submit();return!1},null,null,20);if(d.config.autoUpdateElementJquery&&b.is("textarea")&&a(h.form).length){var c=function(){b.ckeditor(function(){d.updateElement()})};a(h.form).submit(c);a(h.form).bind("form-pre-serialize",c);b.bind("destroy.ckeditor",function(){a(h.form).unbind("submit",c);a(h.form).unbind("form-pre-serialize", +ckeditor:function(g,e){if(!CKEDITOR.env.isCompatible)throw Error("The environment is incompatible.");if("function"!==typeof g){var m=e;e=g;g=m}var k=[];e=e||{};this.each(function(){var b=a(this),c=b.data("ckeditorInstance"),f=b.data("_ckeditorInstanceLock"),h=this,l=new a.Deferred;k.push(l.promise());if(c&&!f)g&&g.apply(c,[this]),l.resolve();else if(f)c.once("instanceReady",function(){setTimeout(function d(){c.element?(c.element.$==h&&g&&g.apply(c,[h]),l.resolve()):setTimeout(d,100)},0)},null,null, +9999);else{if(e.autoUpdateElement||"undefined"==typeof e.autoUpdateElement&&CKEDITOR.config.autoUpdateElement)e.autoUpdateElementJquery=!0;e.autoUpdateElement=!1;b.data("_ckeditorInstanceLock",!0);c=a(this).is("textarea")?CKEDITOR.replace(h,e):CKEDITOR.inline(h,e);b.data("ckeditorInstance",c);c.on("instanceReady",function(e){var d=e.editor;setTimeout(function n(){if(d.element){e.removeListener();d.on("dataReady",function(){b.trigger("dataReady.ckeditor",[d])});d.on("setData",function(a){b.trigger("setData.ckeditor", +[d,a.data])});d.on("getData",function(a){b.trigger("getData.ckeditor",[d,a.data])},999);d.on("destroy",function(){b.trigger("destroy.ckeditor",[d])});d.on("save",function(){a(h.form).trigger("submit");return!1},null,null,20);if(d.config.autoUpdateElementJquery&&b.is("textarea")&&a(h.form).length){var c=function(){b.ckeditor(function(){d.updateElement()})};a(h.form).on("submit",c);a(h.form).on("form-pre-serialize",c);b.on("destroy.ckeditor",function(){a(h.form).off("submit",c);a(h.form).off("form-pre-serialize", c)})}d.on("destroy",function(){b.removeData("ckeditorInstance")});b.removeData("_ckeditorInstanceLock");b.trigger("instanceReady.ckeditor",[d]);g&&g.apply(d,[h]);l.resolve()}else setTimeout(n,100)},0)},null,null,9999)}});var f=new a.Deferred;this.promise=f.promise();a.when.apply(this,k).then(function(){f.resolve()});this.editor=this.eq(0).data("ckeditorInstance");return this}});CKEDITOR.config.jqueryOverrideVal&&(a.fn.val=CKEDITOR.tools.override(a.fn.val,function(g){return function(e){if(arguments.length){var m= this,k=[],f=this.each(function(){var b=a(this),c=b.data("ckeditorInstance");if(b.is("textarea")&&c){var f=new a.Deferred;c.setData(e,function(){f.resolve()});k.push(f.promise());return!0}return g.call(b,e)});if(k.length){var b=new a.Deferred;a.when.apply(this,k).done(function(){b.resolveWith(m)});return b.promise()}return f}var f=a(this).eq(0),c=f.data("ckeditorInstance");return f.is("textarea")&&c?c.getData():g.call(f)}}))})(window.jQuery); \ No newline at end of file diff --git a/include/thirdparty/ckeditor/build-config.js b/include/thirdparty/ckeditor/build-config.js index 8122e7b..40cf3fe 100644 --- a/include/thirdparty/ckeditor/build-config.js +++ b/include/thirdparty/ckeditor/build-config.js @@ -1,6 +1,6 @@ /** - * @license Copyright (c) 2003-2021, CKSource - Frederico Knabben. All rights reserved. - * For licensing, see LICENSE.md or https://ckeditor.com/license + * @license Copyright (c) 2003-2022, CKSource Holding sp. z o.o. All rights reserved. + * For licensing, see LICENSE.md or https://ckeditor.com/legal/ckeditor-oss-license/ */ /** diff --git a/include/thirdparty/ckeditor/ckeditor.js b/include/thirdparty/ckeditor/ckeditor.js index 3d8809f..cda1936 100644 --- a/include/thirdparty/ckeditor/ckeditor.js +++ b/include/thirdparty/ckeditor/ckeditor.js @@ -1,15 +1,15 @@ /* -Copyright (c) 2003-2021, CKSource - Frederico Knabben. All rights reserved. -For licensing, see LICENSE.md or https://ckeditor.com/legal/ckeditor-oss-license +Copyright (c) 2003-2022, CKSource Holding sp. z o.o. All rights reserved. +For licensing, see LICENSE.md or https://ckeditor.com/legal/ckeditor-oss-license/ */ -(function(){if(window.CKEDITOR&&window.CKEDITOR.dom)return;window.CKEDITOR||(window.CKEDITOR=function(){var a=/(^|.*[\\\/])ckeditor\.js(?:\?.*|;.*)?$/i,d={timestamp:"LAHF",version:"4.17.1",revision:"f6dd30807a",rnd:Math.floor(900*Math.random())+100,_:{pending:[],basePathSrcPattern:a},status:"unloaded",basePath:function(){var b=window.CKEDITOR_BASEPATH||"";if(!b)for(var c=document.getElementsByTagName("script"),d=0;dz.getListenerIndex(c)){z=z.listeners;k||(k=this);isNaN(l)&&(l=10);q.fn=c;q.priority=l;for(var x=z.length-1;0<=x;x--)if(z[x].priority<=l)return z.splice(x+1,0,q),{removeListener:g}; -z.unshift(q)}return{removeListener:g}},once:function(){var a=Array.prototype.slice.call(arguments),b=a[1];a[1]=function(a){a.removeListener();return b.apply(this,arguments)};return this.on.apply(this,a)},capture:function(){CKEDITOR.event.useCapture=1;var a=this.on.apply(this,arguments);CKEDITOR.event.useCapture=0;return a},fire:function(){var c=0,e=function(){c=1},d=0,h=function(){d=1};return function(l,q,g){var y=b(this)[l];l=c;var z=d;c=d=0;if(y){var x=y.listeners;if(x.length)for(var x=x.slice(0), -E,v=0;vy.getListenerIndex(c)){y=y.listeners;k||(k=this);isNaN(p)&&(p=10);m.fn=c;m.priority=p;for(var A=y.length-1;0<=A;A--)if(y[A].priority<=p)return y.splice(A+1,0,m),{removeListener:g}; +y.unshift(m)}return{removeListener:g}},once:function(){var a=Array.prototype.slice.call(arguments),b=a[1];a[1]=function(a){a.removeListener();return b.apply(this,arguments)};return this.on.apply(this,a)},capture:function(){CKEDITOR.event.useCapture=1;var a=this.on.apply(this,arguments);CKEDITOR.event.useCapture=0;return a},fire:function(){var c=0,e=function(){c=1},d=0,h=function(){d=1};return function(p,m,g){var x=b(this)[p];p=c;var y=d;c=d=0;if(x){var A=x.listeners;if(A.length)for(var A=A.slice(0), +F,v=0;vdocument.documentMode),mobile:-1c||b.quirks);b.gecko&&(d=a.match(/rv:([\d\.]+)/))&&(d=d[1].split("."),c=1E4*d[0]+100*(d[1]||0)+1*(d[2]||0));b.air&&(c=parseFloat(a.match(/ adobeair\/(\d+)/)[1])); @@ -19,46 +19,46 @@ b.iOS&&(b.cssClass+=" cke_browser_ios");b.hidpi&&(b.cssClass+=" cke_hidpi");retu CKEDITOR.loadFullCore,d=CKEDITOR.loadFullCoreTimeout;a&&(CKEDITOR.status="basic_ready",a&&a._load?a():d&&setTimeout(function(){CKEDITOR.loadFullCore&&CKEDITOR.loadFullCore()},1E3*d))})})();CKEDITOR.status="basic_loaded"}();"use strict";CKEDITOR.VERBOSITY_WARN=1;CKEDITOR.VERBOSITY_ERROR=2;CKEDITOR.verbosity=CKEDITOR.VERBOSITY_WARN|CKEDITOR.VERBOSITY_ERROR;CKEDITOR.warn=function(a,d){CKEDITOR.verbosity&CKEDITOR.VERBOSITY_WARN&&CKEDITOR.fire("log",{type:"warn",errorCode:a,additionalData:d})}; CKEDITOR.error=function(a,d){CKEDITOR.verbosity&CKEDITOR.VERBOSITY_ERROR&&CKEDITOR.fire("log",{type:"error",errorCode:a,additionalData:d})}; CKEDITOR.on("log",function(a){if(window.console&&window.console.log){var d=console[a.data.type]?a.data.type:"log",b=a.data.errorCode;if(a=a.data.additionalData)console[d]("[CKEDITOR] Error code: "+b+".",a);else console[d]("[CKEDITOR] Error code: "+b+".");console[d]("[CKEDITOR] For more information about this error go to https://ckeditor.com/docs/ckeditor4/latest/guide/dev_errors.html#"+b)}},null,null,999);CKEDITOR.dom={}; -(function(){function a(a,z,b){this._minInterval=a;this._context=b;this._lastOutput=this._scheduledTimer=0;this._output=CKEDITOR.tools.bind(z,b||{});var c=this;this.input=function(){function a(){c._lastOutput=(new Date).getTime();c._scheduledTimer=0;c._call()}if(!c._scheduledTimer||!1!==c._reschedule()){var y=(new Date).getTime()-c._lastOutput;y/g,k=//g,k=/|\s) /g,function(a,b){return b+"\x26nbsp;"}).replace(/ (?=<)/g,"\x26nbsp;")},getNextNumber:function(){var a=0;return function(){return++a}}(),getNextId:function(){return"cke_"+this.getNextNumber()},getUniqueId:function(){for(var a="e",b=0;8>b;b++)a+=Math.floor(65536*(1+Math.random())).toString(16).substring(1);return a},override:function(a, -b){var c=b(a);c.prototype=a.prototype;return c},setTimeout:function(a,b,c,g,h){h||(h=window);c||(c=h);return h.setTimeout(function(){g?a.apply(c,[].concat(g)):a.apply(c)},b||0)},throttle:function(a,b,c){return new this.buffers.throttle(a,b,c)},trim:function(){var a=/(?:^[ \t\n\r]+)|(?:[ \t\n\r]+$)/g;return function(b){return b.replace(a,"")}}(),ltrim:function(){var a=/^[ \t\n\r]+/g;return function(b){return b.replace(a,"")}}(),rtrim:function(){var a=/[ \t\n\r]+$/g;return function(b){return b.replace(a, -"")}}(),indexOf:function(a,b){if("function"==typeof b)for(var c=0,g=a.length;cparseFloat(b);c&&(b=b.replace("-",""));a.setStyle("width",b);b=a.$.clientWidth;return c?-b:b}return b}}(),repeat:function(a,b){return Array(b+1).join(a)},tryThese:function(){for(var a,b=0,c=arguments.length;bb;b++)a[b]=("0"+parseInt(a[b],10).toString(16)).slice(-2);return"#"+a.join("")})},normalizeHex:function(a){return a.replace(/#(([0-9a-f]{3}){1,2})($|;|\s+)/gi,function(a,b,c,g){a=b.toLowerCase();3==a.length&& -(a=a.split(""),a=[a[0],a[0],a[1],a[1],a[2],a[2]].join(""));return"#"+a+g})},_isValidColorFormat:function(a){if(!a)return!1;a=a.replace(/\s+/g,"");return/^[a-z0-9()#%,./]+$/i.test(a)},parseCssText:function(a,b,c){var g={};c&&(a=(new CKEDITOR.dom.element("span")).setAttribute("style",a).getAttribute("style")||"");a&&(a=CKEDITOR.tools.normalizeHex(CKEDITOR.tools.convertRgbToHex(a)));if(!a||";"==a)return g;a.replace(/"/g,'"').replace(/\s*([^:;\s]+)\s*:\s*([^;]+)\s*(?=;|$)/g,function(a,c,y){b&&(c= -c.toLowerCase(),"font-family"==c&&(y=y.replace(/\s*,\s*/g,",")),y=CKEDITOR.tools.trim(y));g[c]=y});return g},writeCssText:function(a,b){var c,g=[];for(c in a)g.push(c+":"+a[c]);b&&g.sort();return g.join("; ")},objectCompare:function(a,b,c){var g;if(!a&&!b)return!0;if(!a||!b)return!1;for(g in a)if(a[g]!=b[g])return!1;if(!c)for(g in b)if(a[g]!=b[g])return!1;return!0},objectKeys:function(a){return CKEDITOR.tools.object.keys(a)},convertArrayToObject:function(a,b){var c={};1==arguments.length&&(b=!0); -for(var g=0,h=a.length;gc;c++)a.push(Math.floor(256*Math.random()));for(c=0;c=g||0==c&&48<= -g&&57>=g||1==c&&48<=g&&57>=g&&45==n?h+("\\"+g.toString(16)+" "):0==c&&1==b&&45==g?h+("\\"+a.charAt(c)):128<=g||45==g||95==g||48<=g&&57>=g||65<=g&&90>=g||97<=g&&122>=g?h+a.charAt(c):h+("\\"+a.charAt(c));a=h}else a="";return a},getMouseButton:function(a){return(a=a&&a.data?a.data.$:a)?CKEDITOR.tools.normalizeMouseButton(a.button):!1},normalizeMouseButton:function(a,b){if(!CKEDITOR.env.ie||9<=CKEDITOR.env.version&&!CKEDITOR.env.ie6Compat)return a;for(var c=[[CKEDITOR.MOUSE_BUTTON_LEFT,1],[CKEDITOR.MOUSE_BUTTON_MIDDLE, -4],[CKEDITOR.MOUSE_BUTTON_RIGHT,2]],g=0;gn)for(d=n;3>d;d++)h[d]=0;e[0]=(h[0]&252)>>2;e[1]=(h[0]&3)<<4|h[1]>>4;e[2]=(h[1]&15)<<2|(h[2]&192)>>6;e[3]=h[2]&63;for(d=0;4>d;d++)b=d<=n? -b+"ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/".charAt(e[d]):b+"\x3d"}return b},style:{parse:{_borderStyle:"none hidden dotted dashed solid double groove ridge inset outset".split(" "),_widthRegExp:/^(thin|medium|thick|[\+-]?\d+(\.\d+)?[a-z%]+|[\+-]?0+(\.0+)?|\.\d+[a-z%]+)$/,_rgbaRegExp:/rgba?\(\s*\d+%?\s*,\s*\d+%?\s*,\s*\d+%?\s*(?:,\s*[0-9.]+\s*)?\)/gi,_hslaRegExp:/hsla?\(\s*[0-9.]+\s*,\s*\d+%\s*,\s*\d+%\s*(?:,\s*[0-9.]+\s*)?\)/gi,background:function(a){var b={},c=this._findColor(a); -c.length&&(b.color=c[0],CKEDITOR.tools.array.forEach(c,function(b){a=a.replace(b,"")}));if(a=CKEDITOR.tools.trim(a))b.unprocessed=a;return b},margin:function(a){return CKEDITOR.tools.style.parse.sideShorthand(a,function(a){return a.match(/(?:\-?[\.\d]+(?:%|\w*)|auto|inherit|initial|unset|revert)/g)||["0px"]})},sideShorthand:function(a,b){function c(a){g.top=h[a[0]];g.right=h[a[1]];g.bottom=h[a[2]];g.left=h[a[3]]}var g={},h=b?b(a):a.split(/\s+/);switch(h.length){case 1:c([0,0,0,0]);break;case 2:c([0, -1,0,1]);break;case 3:c([0,1,2,1]);break;case 4:c([0,1,2,3])}return g},border:function(a){return CKEDITOR.tools.style.border.fromCssRule(a)},_findColor:function(a){var b=[],c=CKEDITOR.tools.array,b=b.concat(a.match(this._rgbaRegExp)||[]),b=b.concat(a.match(this._hslaRegExp)||[]);return b=b.concat(c.filter(a.split(/\s+/),function(a){return a.match(/^\#[a-f0-9]{3}(?:[a-f0-9]{3})?$/gi)?!0:a.toLowerCase()in CKEDITOR.tools.style.parse._colors}))}}},array:{filter:function(a,b,c){var g=[];this.forEach(a, -function(h,n){b.call(c,h,n,a)&&g.push(h)});return g},find:function(a,b,c){for(var g=a.length,h=0;hCKEDITOR.env.version&&(!a||"object"!==typeof a)){b=[];if("string"===typeof a)for(c=0;cCKEDITOR.env.version)for(h=0;h|\s) /g,function(a,b){return b+"\x26nbsp;"}).replace(/ (?=<)/g,"\x26nbsp;")},getNextNumber:function(){var a=0;return function(){return++a}}(),getNextId:function(){return"cke_"+this.getNextNumber()},getUniqueId:function(){for(var a="e",b=0;8>b;b++)a+=Math.floor(65536*(1+Math.random())).toString(16).substring(1); +return a},override:function(a,b){var c=b(a);c.prototype=a.prototype;return c},setTimeout:function(a,b,c,g,h){h||(h=window);c||(c=h);return h.setTimeout(function(){g?a.apply(c,[].concat(g)):a.apply(c)},b||0)},debounce:function(a,b){var c;return function(){var g=this,h=arguments;clearTimeout(c);c=setTimeout(function(){c=null;a.apply(g,h)},b)}},throttle:function(a,b,c){return new this.buffers.throttle(a,b,c)},trim:function(){var a=/(?:^[ \t\n\r]+)|(?:[ \t\n\r]+$)/g;return function(b){return b.replace(a, +"")}}(),ltrim:function(){var a=/^[ \t\n\r]+/g;return function(b){return b.replace(a,"")}}(),rtrim:function(){var a=/[ \t\n\r]+$/g;return function(b){return b.replace(a,"")}}(),indexOf:function(a,b){if("function"==typeof b)for(var c=0,g=a.length;cparseFloat(c);g&&(c=c.replace("-",""));a.setStyle("width",c);b=a.getClientRect();c=Math.round(b.width);return g?-c:c}return c}}(),repeat:function(a,b){return Array(b+1).join(a)},tryThese:function(){for(var a, +b=0,c=arguments.length;bb;b++)a[b]=("0"+parseInt(a[b],10).toString(16)).slice(-2);return"#"+a.join("")})},normalizeHex:function(a){return a.replace(/#(([0-9a-f]{3}){1,2})($|;|\s+)/gi,function(a,b,c,g){a=b.toLowerCase();3==a.length&&(a=a.split(""),a=[a[0],a[0],a[1],a[1],a[2],a[2]].join(""));return"#"+a+g})},_isValidColorFormat:function(a){if(!a)return!1;a=a.replace(/\s+/g,"");return/^[a-z0-9()#%,./]+$/i.test(a)},parseCssText:function(a,b,c){var g={};c&&(a=(new CKEDITOR.dom.element("span")).setAttribute("style", +a).getAttribute("style")||"");a&&(a=CKEDITOR.tools.normalizeHex(CKEDITOR.tools.convertRgbToHex(a)));if(!a||";"==a)return g;a.replace(/"/g,'"').replace(/\s*([^:;\s]+)\s*:\s*([^;]+)\s*(?=;|$)/g,function(a,c,x){b&&(c=c.toLowerCase(),"font-family"==c&&(x=x.replace(/\s*,\s*/g,",")),x=CKEDITOR.tools.trim(x));g[c]=x});return g},writeCssText:function(a,b){var c,g=[];for(c in a)g.push(c+":"+a[c]);b&&g.sort();return g.join("; ")},objectCompare:function(a,b,c){var g;if(!a&&!b)return!0;if(!a||!b)return!1; +for(g in a)if(a[g]!=b[g])return!1;if(!c)for(g in b)if(a[g]!=b[g])return!1;return!0},objectKeys:function(a){return CKEDITOR.tools.object.keys(a)},convertArrayToObject:function(a,b){var c={};1==arguments.length&&(b=!0);for(var g=0,h=a.length;gc;c++)a.push(Math.floor(256*Math.random()));for(c=0;c=g||0==c&&48<=g&&57>=g||1==c&&48<=g&&57>=g&&45==l?h+("\\"+g.toString(16)+" "):0==c&&1==b&&45==g?h+("\\"+a.charAt(c)):128<=g||45==g||95==g||48<=g&&57>=g||65<=g&&90>=g||97<=g&&122>=g?h+a.charAt(c):h+("\\"+a.charAt(c));a=h}else a="";return a}, +getMouseButton:function(a){return(a=a&&a.data?a.data.$:a)?CKEDITOR.tools.normalizeMouseButton(a.button):!1},normalizeMouseButton:function(a,b){if(!CKEDITOR.env.ie||9<=CKEDITOR.env.version&&!CKEDITOR.env.ie6Compat)return a;for(var c=[[CKEDITOR.MOUSE_BUTTON_LEFT,1],[CKEDITOR.MOUSE_BUTTON_MIDDLE,4],[CKEDITOR.MOUSE_BUTTON_RIGHT,2]],g=0;gl)for(d=l;3>d;d++)h[d]=0;e[0]=(h[0]&252)>>2;e[1]=(h[0]&3)<<4|h[1]>>4;e[2]=(h[1]&15)<<2|(h[2]&192)>>6;e[3]=h[2]&63;for(d=0;4>d;d++)b=d<=l?b+"ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/".charAt(e[d]):b+"\x3d"}return b},style:{parse:{_borderStyle:"none hidden dotted dashed solid double groove ridge inset outset".split(" "),_widthRegExp:/^(thin|medium|thick|[\+-]?\d+(\.\d+)?[a-z%]+|[\+-]?0+(\.0+)?|\.\d+[a-z%]+)$/, +_rgbaRegExp:/rgba?\(\s*\d+%?\s*,\s*\d+%?\s*,\s*\d+%?\s*(?:,\s*[0-9.]+\s*)?\)/gi,_hslaRegExp:/hsla?\(\s*[0-9.]+\s*,\s*\d+%\s*,\s*\d+%\s*(?:,\s*[0-9.]+\s*)?\)/gi,background:function(a){var b={},c=this._findColor(a);c.length&&(b.color=c[0],CKEDITOR.tools.array.forEach(c,function(b){a=a.replace(b,"")}));if(a=CKEDITOR.tools.trim(a))b.unprocessed=a;return b},margin:function(a){return CKEDITOR.tools.style.parse.sideShorthand(a,function(a){return a.match(/(?:\-?[\.\d]+(?:%|\w*)|auto|inherit|initial|unset|revert)/g)|| +["0px"]})},sideShorthand:function(a,b){function c(a){g.top=h[a[0]];g.right=h[a[1]];g.bottom=h[a[2]];g.left=h[a[3]]}var g={},h=b?b(a):a.split(/\s+/);switch(h.length){case 1:c([0,0,0,0]);break;case 2:c([0,1,0,1]);break;case 3:c([0,1,2,1]);break;case 4:c([0,1,2,3])}return g},border:function(a){return CKEDITOR.tools.style.border.fromCssRule(a)},_findColor:function(a){var b=[],c=CKEDITOR.tools.array,b=b.concat(a.match(this._rgbaRegExp)||[]),b=b.concat(a.match(this._hslaRegExp)||[]);return b=b.concat(c.filter(a.split(/\s+/), +function(a){return a.match(/^\#[a-f0-9]{3}(?:[a-f0-9]{3})?$/gi)?!0:a.toLowerCase()in CKEDITOR.tools.style.parse._colors}))}}},array:{filter:function(a,b,c){var g=[];this.forEach(a,function(h,l){b.call(c,h,l,a)&&g.push(h)});return g},find:function(a,b,c){for(var g=a.length,h=0;hCKEDITOR.env.version&&(!a||"object"!==typeof a)){b=[];if("string"===typeof a)for(c=0;cCKEDITOR.env.version)for(h=0;h=document.documentMode||!d||(a=d+":"+a);return new CKEDITOR.dom.nodeList(this.$.getElementsByTagName(a))},getHead:function(){var a=this.$.getElementsByTagName("head")[0]; -return a=a?new CKEDITOR.dom.element(a):this.getDocumentElement().append(new CKEDITOR.dom.element("head"),!0)},getBody:function(){return new CKEDITOR.dom.element(this.$.body)},getDocumentElement:function(){return new CKEDITOR.dom.element(this.$.documentElement)},getWindow:function(){return new CKEDITOR.dom.window(this.$.parentWindow||this.$.defaultView)},write:function(a){this.$.open("text/html","replace");CKEDITOR.env.ie&&(a=a.replace(/(?:^\s*]*?>)|^/i,'$\x26\n\x3cscript data-cke-temp\x3d"1"\x3e('+ -CKEDITOR.tools.fixDomain+")();\x3c/script\x3e"));this.$.write(a);this.$.close()},find:function(a){return new CKEDITOR.dom.nodeList(this.$.querySelectorAll(a))},findOne:function(a){return(a=this.$.querySelector(a))?new CKEDITOR.dom.element(a):null},_getHtml5ShivFrag:function(){var a=this.getCustomData("html5ShivFrag");a||(a=this.$.createDocumentFragment(),CKEDITOR.tools.enableHtml5Elements(a,!0),this.setCustomData("html5ShivFrag",a));return a}});CKEDITOR.dom.nodeList=function(a){this.$=a}; -CKEDITOR.dom.nodeList.prototype={count:function(){return this.$.length},getItem:function(a){return 0>a||a>=this.$.length?null:(a=this.$[a])?new CKEDITOR.dom.node(a):null},toArray:function(){return CKEDITOR.tools.array.map(this.$,function(a){return new CKEDITOR.dom.node(a)})}};CKEDITOR.dom.element=function(a,d){"string"==typeof a&&(a=(d?d.$:document).createElement(a));CKEDITOR.dom.domObject.call(this,a)}; +CKEDITOR.tools.extend(CKEDITOR.dom.document.prototype,{type:CKEDITOR.NODE_DOCUMENT,appendStyleSheet:function(a){a=CKEDITOR.appendTimestamp(a);if(this.$.createStyleSheet)this.$.createStyleSheet(a);else{var d=new CKEDITOR.dom.element("link");d.setAttributes({rel:"stylesheet",type:"text/css",href:a});this.getHead().append(d)}},appendStyleText:function(a){if(this.$.createStyleSheet){var d=this.$.createStyleSheet("");d.cssText=a}else{var b=new CKEDITOR.dom.element("style",this);b.append(new CKEDITOR.dom.text(a, +this));this.getHead().append(b)}return d||b.$.sheet},createElement:function(a,d){var b=new CKEDITOR.dom.element(a,this);d&&(d.attributes&&b.setAttributes(d.attributes),d.styles&&b.setStyles(d.styles));return b},createText:function(a){return new CKEDITOR.dom.text(a,this)},focus:function(){this.getWindow().focus()},getActive:function(){var a;try{a=this.$.activeElement}catch(d){return null}return new CKEDITOR.dom.element(a)},getById:function(a){return(a=this.$.getElementById(a))?new CKEDITOR.dom.element(a): +null},getByAddress:function(a,d){for(var b=this.$.documentElement,c=0;b&&c=document.documentMode||!d||(a=d+":"+a);return new CKEDITOR.dom.nodeList(this.$.getElementsByTagName(a))},getHead:function(){var a= +this.$.getElementsByTagName("head")[0];return a=a?new CKEDITOR.dom.element(a):this.getDocumentElement().append(new CKEDITOR.dom.element("head"),!0)},getBody:function(){return new CKEDITOR.dom.element(this.$.body)},getDocumentElement:function(){return new CKEDITOR.dom.element(this.$.documentElement)},getWindow:function(){return new CKEDITOR.dom.window(this.$.parentWindow||this.$.defaultView)},write:function(a){this.$.open("text/html","replace");CKEDITOR.env.ie&&(a=a.replace(/(?:^\s*]*?>)|^/i, +'$\x26\n\x3cscript data-cke-temp\x3d"1"\x3e('+CKEDITOR.tools.fixDomain+")();\x3c/script\x3e"));this.$.write(a);this.$.close()},find:function(a){return new CKEDITOR.dom.nodeList(this.$.querySelectorAll(a))},findOne:function(a){return(a=this.$.querySelector(a))?new CKEDITOR.dom.element(a):null},_getHtml5ShivFrag:function(){var a=this.getCustomData("html5ShivFrag");a||(a=this.$.createDocumentFragment(),CKEDITOR.tools.enableHtml5Elements(a,!0),this.setCustomData("html5ShivFrag",a));return a}}); +CKEDITOR.dom.nodeList=function(a){this.$=a};CKEDITOR.dom.nodeList.prototype={count:function(){return this.$.length},getItem:function(a){return 0>a||a>=this.$.length?null:(a=this.$[a])?new CKEDITOR.dom.node(a):null},toArray:function(){return CKEDITOR.tools.array.map(this.$,function(a){return new CKEDITOR.dom.node(a)})}};CKEDITOR.dom.element=function(a,d){"string"==typeof a&&(a=(d?d.$:document).createElement(a));CKEDITOR.dom.domObject.call(this,a)}; CKEDITOR.dom.element.get=function(a){return(a="string"==typeof a?document.getElementById(a)||document.getElementsByName(a)[0]:a)&&(a.$?a:new CKEDITOR.dom.element(a))};CKEDITOR.dom.element.prototype=new CKEDITOR.dom.node;CKEDITOR.dom.element.createFromHtml=function(a,d){var b=new CKEDITOR.dom.element("div",d);b.setHtml(a);return b.getFirst().remove()}; CKEDITOR.dom.element.setMarker=function(a,d,b,c){var f=d.getCustomData("list_marker_id")||d.setCustomData("list_marker_id",CKEDITOR.tools.getNextNumber()).getCustomData("list_marker_id"),e=d.getCustomData("list_marker_names")||d.setCustomData("list_marker_names",{}).getCustomData("list_marker_names");a[f]=d;e[b]=1;return d.setCustomData(b,c)};CKEDITOR.dom.element.clearAllMarkers=function(a){for(var d in a)CKEDITOR.dom.element.clearMarkers(a,a[d],1)}; CKEDITOR.dom.element.clearMarkers=function(a,d,b){var c=d.getCustomData("list_marker_names"),f=d.getCustomData("list_marker_id"),e;for(e in c)d.removeCustomData(e);d.removeCustomData("list_marker_names");b&&(d.removeCustomData("list_marker_id"),delete a[f])}; @@ -120,11 +120,11 @@ arguments)}catch(g){}else a.apply(this,arguments);return this}:a}(),setAttribute 0;bCKEDITOR.env.version?(a=Math.round(100*a),this.setStyle("filter",100<=a?"":"progid:DXImageTransform.Microsoft.Alpha(opacity\x3d"+a+")")):this.setStyle("opacity",a)},unselectable:function(){this.setStyles(CKEDITOR.tools.cssVendorPrefix("user-select", "none"));if(CKEDITOR.env.ie){this.setAttribute("unselectable","on");for(var a,b=this.getElementsByTag("*"),c=0,g=b.count();cf||0f?f:d);c&&(0>e||0e?e:g,0)},setState:function(a,b,c){b=b||"cke";switch(a){case CKEDITOR.TRISTATE_ON:this.addClass(b+"_on");this.removeClass(b+ +a.getWindow().$.scrollBy(b,c):(a.$.scrollLeft+=b,a.$.scrollTop+=c)}function v(a,b){var c={x:0,y:0};if(!a.is(L?"body":"html")){var g=a.$.getBoundingClientRect();c.x=g.left;c.y=g.top}g=a.getWindow();g.equals(b)||(g=v(CKEDITOR.dom.element.get(g.$.frameElement),b),c.x+=g.x,c.y+=g.y);return c}function l(a,b){return parseInt(a.getComputedStyle("margin-"+b)||0,10)||0}!a&&(a=this.getWindow());e=a.getDocument();var L="BackCompat"==e.$.compatMode;a instanceof CKEDITOR.dom.window&&(a=L?e.getBody():e.getDocumentElement()); +CKEDITOR.env.webkit&&(e=this.getEditor(!1))&&(e._.previousScrollTop=null);e=a.getWindow();d=v(this,e);var w=v(a,e),J=this.$.offsetHeight;g=this.$.offsetWidth;var G=a.$.clientHeight,q=a.$.clientWidth;e=d.x-l(this,"left")-w.x||0;f=d.y-l(this,"top")-w.y||0;g=d.x+g+l(this,"right")-(w.x+q)||0;d=d.y+J+l(this,"bottom")-(w.y+G)||0;(0>f||0f?f:d);c&&(0>e||0e?e:g,0)},setState:function(a,b,c){b=b||"cke";switch(a){case CKEDITOR.TRISTATE_ON:this.addClass(b+"_on");this.removeClass(b+ "_off");this.removeClass(b+"_disabled");c&&this.setAttribute("aria-pressed",!0);c&&this.removeAttribute("aria-disabled");break;case CKEDITOR.TRISTATE_DISABLED:this.addClass(b+"_disabled");this.removeClass(b+"_off");this.removeClass(b+"_on");c&&this.setAttribute("aria-disabled",!0);c&&this.removeAttribute("aria-pressed");break;default:this.addClass(b+"_off"),this.removeClass(b+"_on"),this.removeClass(b+"_disabled"),c&&this.removeAttribute("aria-pressed"),c&&this.removeAttribute("aria-disabled")}}, getFrameDocument:function(){var a=this.$;try{a.contentWindow.document}catch(b){a.src=a.src}return a&&new CKEDITOR.dom.document(a.contentWindow.document)},copyAttributes:function(a,b){var c=this.$.attributes;b=b||{};for(var g=0;g=C.getChildCount()?(C=C.getChild(A-1),r=!0):C=C.getChild(A):D=r=!0;m.type==CKEDITOR.NODE_TEXT?l?w=!0:m.split(K):0fa)for(;aa;)aa=f(aa, -G,!0);G=F}l||h()}}function b(){var a=!1,b=CKEDITOR.dom.walker.whitespaces(),c=CKEDITOR.dom.walker.bookmark(!0),d=CKEDITOR.dom.walker.bogus();return function(f){return c(f)||b(f)?!0:d(f)&&!a?a=!0:f.type==CKEDITOR.NODE_TEXT&&(f.hasAscendant("pre")||CKEDITOR.tools.trim(f.getText()).length)||f.type==CKEDITOR.NODE_ELEMENT&&!f.is(e)?!1:!0}}function c(a){var b=CKEDITOR.dom.walker.whitespaces(),c=CKEDITOR.dom.walker.bookmark(1);return function(d){return c(d)||b(d)?!0:!a&&k(d)||d.type==CKEDITOR.NODE_ELEMENT&& -d.is(CKEDITOR.dtd.$removeEmpty)}}function f(a){return function(){var b;return this[a?"getPreviousNode":"getNextNode"](function(a){!b&&q(a)&&(b=a);return l(a)&&!(k(a)&&a.equals(b))})}}var e={abbr:1,acronym:1,b:1,bdo:1,big:1,cite:1,code:1,del:1,dfn:1,em:1,font:1,i:1,ins:1,label:1,kbd:1,q:1,samp:1,small:1,span:1,strike:1,strong:1,sub:1,sup:1,tt:1,u:1,"var":1},k=CKEDITOR.dom.walker.bogus(),h=/^[\t\r\n ]*(?: |\xa0)$/,l=CKEDITOR.dom.walker.editable(),q=CKEDITOR.dom.walker.ignored(!0);CKEDITOR.dom.range.prototype= -{clone:function(){var a=new CKEDITOR.dom.range(this.root);a._setStartContainer(this.startContainer);a.startOffset=this.startOffset;a._setEndContainer(this.endContainer);a.endOffset=this.endOffset;a.collapsed=this.collapsed;return a},collapse:function(a){a?(this._setEndContainer(this.startContainer),this.endOffset=this.startOffset):(this._setStartContainer(this.endContainer),this.startOffset=this.endOffset);this.collapsed=!0},cloneContents:function(a){var b=new CKEDITOR.dom.documentFragment(this.document); -this.collapsed||d(this,2,b,!1,"undefined"==typeof a?!0:a);return b},deleteContents:function(a){this.collapsed||d(this,0,null,a)},extractContents:function(a,b){var c=new CKEDITOR.dom.documentFragment(this.document);this.collapsed||d(this,1,c,a,"undefined"==typeof b?!0:b);return c},equals:function(a){return this.startOffset===a.startOffset&&this.endOffset===a.endOffset&&this.startContainer.equals(a.startContainer)&&this.endContainer.equals(a.endContainer)},createBookmark:function(a){function b(a){return a.getAscendant(function(a){var b; -if(b=a.data&&a.data("cke-temp"))b=-1===CKEDITOR.tools.array.indexOf(["cke_copybin","cke_pastebin"],a.getAttribute("id"));return b},!0)}var c=this.startContainer,d=this.endContainer,e=this.collapsed,f,n,h,k;f=this.document.createElement("span");f.data("cke-bookmark",1);f.setStyle("display","none");f.setHtml("\x26nbsp;");a&&(h="cke_bm_"+CKEDITOR.tools.getNextNumber(),f.setAttribute("id",h+(e?"C":"S")));e||(n=f.clone(),n.setHtml("\x26nbsp;"),a&&n.setAttribute("id",h+"E"),k=this.clone(),b(d)&&(d=b(d), -k.moveToPosition(d,CKEDITOR.POSITION_AFTER_END)),k.collapse(),k.insertNode(n));k=this.clone();b(c)&&(d=b(c),k.moveToPosition(d,CKEDITOR.POSITION_BEFORE_START));k.collapse(!0);k.insertNode(f);n?(this.setStartAfter(f),this.setEndBefore(n)):this.moveToPosition(f,CKEDITOR.POSITION_AFTER_END);return{startNode:a?h+(e?"C":"S"):f,endNode:a?h+"E":n,serializable:a,collapsed:e}},createBookmark2:function(){function a(b){var g=b.container,d=b.offset,e;e=g;var f=d;e=e.type!=CKEDITOR.NODE_ELEMENT||0===f||f==e.getChildCount()? +(function(){function a(a){a.collapsed=a.startContainer&&a.endContainer&&a.startContainer.equals(a.endContainer)&&a.startOffset==a.endOffset}function d(a,b,c,d,e){function f(a,b,c,g){var R=c?a.getPrevious():a.getNext();if(g&&k)return R;p||g?b.append(a.clone(!0,e),c):(a.remove(),m&&b.append(a,c));return R}function l(){var a,b,c,g=Math.min(O.length,r.length);for(a=0;a=u.getChildCount()?(u=u.getChild(E-1),t=!0):u=u.getChild(E):z=t=!0;q.type==CKEDITOR.NODE_TEXT?p?H=!0:q.split(K):0ea)for(;X;)X=f(X,D,!0);D=R}p|| +h()}}function b(){var a=!1,b=CKEDITOR.dom.walker.whitespaces(),c=CKEDITOR.dom.walker.bookmark(!0),d=CKEDITOR.dom.walker.bogus();return function(f){return c(f)||b(f)?!0:d(f)&&!a?a=!0:f.type==CKEDITOR.NODE_TEXT&&(f.hasAscendant("pre")||CKEDITOR.tools.trim(f.getText()).length)||f.type==CKEDITOR.NODE_ELEMENT&&!f.is(e)?!1:!0}}function c(a){var b=CKEDITOR.dom.walker.whitespaces(),c=CKEDITOR.dom.walker.bookmark(1);return function(d){return c(d)||b(d)?!0:!a&&k(d)||d.type==CKEDITOR.NODE_ELEMENT&&d.is(CKEDITOR.dtd.$removeEmpty)}} +function f(a){return function(){var b;return this[a?"getPreviousNode":"getNextNode"](function(a){!b&&m(a)&&(b=a);return p(a)&&!(k(a)&&a.equals(b))})}}var e={abbr:1,acronym:1,b:1,bdo:1,big:1,cite:1,code:1,del:1,dfn:1,em:1,font:1,i:1,ins:1,label:1,kbd:1,q:1,samp:1,small:1,span:1,strike:1,strong:1,sub:1,sup:1,tt:1,u:1,"var":1},k=CKEDITOR.dom.walker.bogus(),h=/^[\t\r\n ]*(?: |\xa0)$/,p=CKEDITOR.dom.walker.editable(),m=CKEDITOR.dom.walker.ignored(!0);CKEDITOR.dom.range.prototype={clone:function(){var a= +new CKEDITOR.dom.range(this.root);a._setStartContainer(this.startContainer);a.startOffset=this.startOffset;a._setEndContainer(this.endContainer);a.endOffset=this.endOffset;a.collapsed=this.collapsed;return a},collapse:function(a){a?(this._setEndContainer(this.startContainer),this.endOffset=this.startOffset):(this._setStartContainer(this.endContainer),this.startOffset=this.endOffset);this.collapsed=!0},cloneContents:function(a){var b=new CKEDITOR.dom.documentFragment(this.document);this.collapsed|| +d(this,2,b,!1,"undefined"==typeof a?!0:a);return b},deleteContents:function(a){this.collapsed||d(this,0,null,a)},extractContents:function(a,b){var c=new CKEDITOR.dom.documentFragment(this.document);this.collapsed||d(this,1,c,a,"undefined"==typeof b?!0:b);return c},equals:function(a){return this.startOffset===a.startOffset&&this.endOffset===a.endOffset&&this.startContainer.equals(a.startContainer)&&this.endContainer.equals(a.endContainer)},createBookmark:function(a){function b(a){return a.getAscendant(function(a){var b; +if(b=a.data&&a.data("cke-temp"))b=-1===CKEDITOR.tools.array.indexOf(["cke_copybin","cke_pastebin"],a.getAttribute("id"));return b},!0)}var c=this.startContainer,d=this.endContainer,e=this.collapsed,f,l,h,k;f=this.document.createElement("span");f.data("cke-bookmark",1);f.setStyle("display","none");f.setHtml("\x26nbsp;");a&&(h="cke_bm_"+CKEDITOR.tools.getNextNumber(),f.setAttribute("id",h+(e?"C":"S")));e||(l=f.clone(),l.setHtml("\x26nbsp;"),a&&l.setAttribute("id",h+"E"),k=this.clone(),b(d)&&(d=b(d), +k.moveToPosition(d,CKEDITOR.POSITION_AFTER_END)),k.collapse(),k.insertNode(l));k=this.clone();b(c)&&(d=b(c),k.moveToPosition(d,CKEDITOR.POSITION_BEFORE_START));k.collapse(!0);k.insertNode(f);l?(this.setStartAfter(f),this.setEndBefore(l)):this.moveToPosition(f,CKEDITOR.POSITION_AFTER_END);return{startNode:a?h+(e?"C":"S"):f,endNode:a?h+"E":l,serializable:a,collapsed:e}},createBookmark2:function(){function a(b){var g=b.container,d=b.offset,e;e=g;var f=d;e=e.type!=CKEDITOR.NODE_ELEMENT||0===f||f==e.getChildCount()? 0:e.getChild(f-1).type==CKEDITOR.NODE_TEXT&&e.getChild(f).type==CKEDITOR.NODE_TEXT;e&&(g=g.getChild(d-1),d=g.getLength());if(g.type==CKEDITOR.NODE_ELEMENT&&0=a.offset&&(a.offset=d.getIndex(),a.container=d.getParent()))}}var c=CKEDITOR.dom.walker.nodeType(CKEDITOR.NODE_TEXT,!0);return function(c){var d=this.collapsed,e={container:this.startContainer,offset:this.startOffset},n={container:this.endContainer,offset:this.endOffset};c&&(a(e),b(e,this.root), -d||(a(n),b(n,this.root)));return{start:e.container.getAddress(c),end:d?null:n.container.getAddress(c),startOffset:e.offset,endOffset:n.offset,normalized:c,collapsed:d,is2:!0}}}(),moveToBookmark:function(a){if(a.is2){var b=this.document.getByAddress(a.start,a.normalized),c=a.startOffset,d=a.end&&this.document.getByAddress(a.end,a.normalized);a=a.endOffset;this.setStart(b,c);d?this.setEnd(d,a):this.collapse(!0)}else b=(c=a.serializable)?this.document.getById(a.startNode):a.startNode,a=c?this.document.getById(a.endNode): +d=f?f.getIndex(!0)+1:0)):d+=e}b.container=g;b.offset=d}function b(a,c){var g=c.getCustomData("cke-fillingChar");if(g){var d=a.container;g.equals(d)&&(a.offset-=CKEDITOR.dom.selection.FILLING_CHAR_SEQUENCE.length,0>=a.offset&&(a.offset=d.getIndex(),a.container=d.getParent()))}}var c=CKEDITOR.dom.walker.nodeType(CKEDITOR.NODE_TEXT,!0);return function(c){var d=this.collapsed,e={container:this.startContainer,offset:this.startOffset},l={container:this.endContainer,offset:this.endOffset};c&&(a(e),b(e,this.root), +d||(a(l),b(l,this.root)));return{start:e.container.getAddress(c),end:d?null:l.container.getAddress(c),startOffset:e.offset,endOffset:l.offset,normalized:c,collapsed:d,is2:!0}}}(),moveToBookmark:function(a){if(a.is2){var b=this.document.getByAddress(a.start,a.normalized),c=a.startOffset,d=a.end&&this.document.getByAddress(a.end,a.normalized);a=a.endOffset;this.setStart(b,c);d?this.setEnd(d,a):this.collapse(!0)}else b=(c=a.serializable)?this.document.getById(a.startNode):a.startNode,a=c?this.document.getById(a.endNode): a.endNode,this.setStartBefore(b),b.remove(),a?(this.setEndBefore(a),a.remove()):this.collapse(!0)},getBoundaryNodes:function(){var a=this.startContainer,b=this.endContainer,c=this.startOffset,d=this.endOffset,e;if(a.type==CKEDITOR.NODE_ELEMENT)if(e=a.getChildCount(),e>c)a=a.getChild(c);else if(1>e)a=a.getPreviousSourceNode();else{for(a=a.$;a.lastChild;)a=a.lastChild;a=new CKEDITOR.dom.node(a);a=a.getNextSourceNode()||a}if(b.type==CKEDITOR.NODE_ELEMENT)if(e=b.getChildCount(),e>d)b=b.getChild(d).getPreviousSourceNode(!0); else if(1>e)b=b.getPreviousSourceNode();else{for(b=b.$;b.lastChild;)b=b.lastChild;b=new CKEDITOR.dom.node(b)}a.getPosition(b)&CKEDITOR.POSITION_FOLLOWING&&(a=b);return{startNode:a,endNode:b}},getCommonAncestor:function(a,b){var c=this.startContainer,d=this.endContainer,c=c.equals(d)?a&&c.type==CKEDITOR.NODE_ELEMENT&&this.startOffset==this.endOffset-1?c.getChild(this.startOffset):c:c.getCommonAncestor(d);return b&&!c.is?c.getParent():c},optimize:function(){var a=this.startContainer,b=this.startOffset; a.type!=CKEDITOR.NODE_ELEMENT&&(b?b>=a.getLength()&&this.setStartAfter(a):this.setStartBefore(a));a=this.endContainer;b=this.endOffset;a.type!=CKEDITOR.NODE_ELEMENT&&(b?b>=a.getLength()&&this.setEndAfter(a):this.setEndBefore(a))},optimizeBookmark:function(){var a=this.startContainer,b=this.endContainer;a.is&&a.is("span")&&a.data("cke-bookmark")&&this.setStartAt(a,CKEDITOR.POSITION_BEFORE_START);b&&b.is&&b.is("span")&&b.data("cke-bookmark")&&this.setEndAt(b,CKEDITOR.POSITION_AFTER_END)},trim:function(a, b){var c=this.startContainer,d=this.startOffset,e=this.collapsed;if((!a||e)&&c&&c.type==CKEDITOR.NODE_TEXT){if(d)if(d>=c.getLength())d=c.getIndex()+1,c=c.getParent();else{var f=c.split(d),d=c.getIndex()+1,c=c.getParent();this.startContainer.equals(this.endContainer)?this.setEnd(f,this.endOffset-this.startOffset):c.equals(this.endContainer)&&(this.endOffset+=1)}else d=c.getIndex(),c=c.getParent();this.setStart(c,d);if(e){this.collapse(!0);return}}c=this.endContainer;d=this.endOffset;b||e||!c||c.type!= -CKEDITOR.NODE_TEXT||(d?(d>=c.getLength()||c.split(d),d=c.getIndex()+1):d=c.getIndex(),c=c.getParent(),this.setEnd(c,d))},enlarge:function(a,b){function c(a){return a&&a.type==CKEDITOR.NODE_ELEMENT&&a.hasAttribute("contenteditable")?null:a}var d=new RegExp(/[^\s\ufeff]/);switch(a){case CKEDITOR.ENLARGE_INLINE:var e=1;case CKEDITOR.ENLARGE_ELEMENT:var f=function(a,b){var c=new CKEDITOR.dom.range(h);c.setStart(a,b);c.setEndAt(h,CKEDITOR.POSITION_BEFORE_END);var c=new CKEDITOR.dom.walker(c),g;for(c.guard= -function(a){return!(a.type==CKEDITOR.NODE_ELEMENT&&a.isBlockBoundary())};g=c.next();){if(g.type!=CKEDITOR.NODE_TEXT)return!1;L=g!=a?g.getText():g.substring(b);if(d.test(L))return!1}return!0};if(this.collapsed)break;var n=this.getCommonAncestor(),h=this.root,k,q,l,m,C,K=!1,A,L;A=this.startContainer;var r=this.startOffset;A.type==CKEDITOR.NODE_TEXT?(r&&(A=!CKEDITOR.tools.trim(A.substring(0,r)).length&&A,K=!!A),A&&((m=A.getPrevious())||(l=A.getParent()))):(r&&(m=A.getChild(r-1)||A.getLast()),m||(l=A)); -for(l=c(l);l||m;){if(l&&!m){!C&&l.equals(n)&&(C=!0);if(e?l.isBlockBoundary():!h.contains(l))break;K&&"inline"==l.getComputedStyle("display")||(K=!1,C?k=l:this.setStartBefore(l));m=l.getPrevious()}for(;m;)if(A=!1,m.type==CKEDITOR.NODE_COMMENT)m=m.getPrevious();else{if(m.type==CKEDITOR.NODE_TEXT)L=m.getText(),d.test(L)&&(m=null),A=/[\s\ufeff]$/.test(L);else if((m.$.offsetWidth>(CKEDITOR.env.webkit?1:0)||b&&m.is("br"))&&!m.data("cke-bookmark"))if(K&&CKEDITOR.dtd.$removeEmpty[m.getName()]){L=m.getText(); -if(d.test(L))m=null;else for(var r=m.$.getElementsByTagName("*"),B=0,D;D=r[B++];)if(!CKEDITOR.dtd.$removeEmpty[D.nodeName.toLowerCase()]){m=null;break}m&&(A=!!L.length)}else m=null;A&&(K?C?k=l:l&&this.setStartBefore(l):K=!0);if(m){A=m.getPrevious();if(!l&&!A){l=m;m=null;break}m=A}else l=null}l&&(l=c(l.getParent()))}A=this.endContainer;r=this.endOffset;l=m=null;C=K=!1;A.type==CKEDITOR.NODE_TEXT?CKEDITOR.tools.trim(A.substring(r)).length?K=!0:(K=!A.getLength(),r==A.getLength()?(m=A.getNext())||(l=A.getParent()): -f(A,r)&&(l=A.getParent())):(m=A.getChild(r))||(l=A);for(;l||m;){if(l&&!m){!C&&l.equals(n)&&(C=!0);if(e?l.isBlockBoundary():!h.contains(l))break;K&&"inline"==l.getComputedStyle("display")||(K=!1,C?q=l:l&&this.setEndAfter(l));m=l.getNext()}for(;m;){A=!1;if(m.type==CKEDITOR.NODE_TEXT)L=m.getText(),f(m,0)||(m=null),A=/^[\s\ufeff]/.test(L);else if(m.type==CKEDITOR.NODE_ELEMENT){if((0=n.getLength()?f.setStartAfter(n):(f.setStartBefore(n),c=0):f.setStartBefore(n));h&&h.type==CKEDITOR.NODE_TEXT&&(l?l>=h.getLength()?f.setEndAfter(h):(f.setEndAfter(h),q=0):f.setEndBefore(h));var f=new CKEDITOR.dom.walker(f),m=CKEDITOR.dom.walker.bookmark(),C=CKEDITOR.dom.walker.bogus();f.evaluator=function(b){return b.type==(a==CKEDITOR.SHRINK_ELEMENT?CKEDITOR.NODE_ELEMENT:CKEDITOR.NODE_TEXT)};var K;f.guard=function(b,c){if(e&&C(b)||m(b))return!0;if(a==CKEDITOR.SHRINK_ELEMENT&& -b.type==CKEDITOR.NODE_TEXT||c&&b.equals(K)||!1===d&&b.type==CKEDITOR.NODE_ELEMENT&&b.isBlockBoundary()||b.type==CKEDITOR.NODE_ELEMENT&&b.hasAttribute("contenteditable"))return!1;c||b.type!=CKEDITOR.NODE_ELEMENT||(K=b);return!0};c&&(n=f[a==CKEDITOR.SHRINK_ELEMENT?"lastForward":"next"]())&&this.setStartAt(n,b?CKEDITOR.POSITION_AFTER_START:CKEDITOR.POSITION_BEFORE_START);q&&(f.reset(),(f=f[a==CKEDITOR.SHRINK_ELEMENT?"lastBackward":"previous"]())&&this.setEndAt(f,b?CKEDITOR.POSITION_BEFORE_END:CKEDITOR.POSITION_AFTER_END)); -return!(!c&&!q)}},insertNode:function(a){this.optimizeBookmark();this.trim(!1,!0);var b=this.startContainer,c=b.getChild(this.startOffset);c?a.insertBefore(c):b.append(a);a.getParent()&&a.getParent().equals(this.endContainer)&&this.endOffset++;this.setStartBefore(a)},moveToPosition:function(a,b){this.setStartAt(a,b);this.collapse(!0)},moveToRange:function(a){this.setStart(a.startContainer,a.startOffset);this.setEnd(a.endContainer,a.endOffset)},selectNodeContents:function(a){this.setStart(a,0);this.setEnd(a, +CKEDITOR.NODE_TEXT||(d?(d>=c.getLength()||c.split(d),d=c.getIndex()+1):d=c.getIndex(),c=c.getParent(),this.setEnd(c,d))},enlarge:function(a,b){function c(a){return a&&a.type==CKEDITOR.NODE_ELEMENT&&a.hasAttribute("contenteditable")?null:a}function d(a,b,c){var g=new CKEDITOR.dom.range(c);g.setStart(a,b);g.setEndAt(c,CKEDITOR.POSITION_BEFORE_END);c=new CKEDITOR.dom.walker(g);for(c.guard=function(a){return!(a.type==CKEDITOR.NODE_ELEMENT&&a.isBlockBoundary())};g=c.next();){if(g.type!=CKEDITOR.NODE_TEXT)return!1; +f=g!=a?g.getText():g.substring(b);if(e.test(f))return!1}return!0}var e=new RegExp(/[^\s\ufeff]/),f,l;switch(a){case CKEDITOR.ENLARGE_INLINE:var h=1;case CKEDITOR.ENLARGE_ELEMENT:if(this.collapsed)break;var k=this.getCommonAncestor();l=this.root;var m,p,q,u,K,E=!1,C;C=this.startContainer;var t=this.startOffset;C.type==CKEDITOR.NODE_TEXT?(t&&(C=!CKEDITOR.tools.trim(C.substring(0,t)).length&&C,E=!!C),C&&((u=C.getPrevious())||(q=C.getParent()))):(t&&(u=C.getChild(t-1)||C.getLast()),u||(q=C));for(q=c(q);q|| +u;){if(q&&!u){!K&&q.equals(k)&&(K=!0);if(h?q.isBlockBoundary():!l.contains(q))break;E&&"inline"==q.getComputedStyle("display")||(E=!1,K?m=q:this.setStartBefore(q));u=q.getPrevious()}for(;u;)if(C=!1,u.type==CKEDITOR.NODE_COMMENT)u=u.getPrevious();else{if(u.type==CKEDITOR.NODE_TEXT)f=u.getText(),e.test(f)&&(u=null),C=/[\s\ufeff]$/.test(f);else if((u.$.offsetWidth>(CKEDITOR.env.webkit?1:0)||b&&u.is("br"))&&!u.data("cke-bookmark"))if(E&&CKEDITOR.dtd.$removeEmpty[u.getName()]){f=u.getText();if(e.test(f))u= +null;else for(var t=u.$.getElementsByTagName("*"),B=0,z;z=t[B++];)if(!CKEDITOR.dtd.$removeEmpty[z.nodeName.toLowerCase()]){u=null;break}u&&(C=!!f.length)}else u=null;C&&(E?K?m=q:q&&this.setStartBefore(q):E=!0);if(u){C=u.getPrevious();if(!q&&!C){q=u;u=null;break}u=C}else q=null}q&&(q=c(q.getParent()))}C=this.endContainer;t=this.endOffset;q=u=null;K=E=!1;C.type==CKEDITOR.NODE_TEXT?CKEDITOR.tools.trim(C.substring(t)).length?E=!0:(E=!C.getLength(),t==C.getLength()?(u=C.getNext())||(q=C.getParent()):d(C, +t,l)&&(q=C.getParent())):(u=C.getChild(t))||(q=C);for(;q||u;){if(q&&!u){!K&&q.equals(k)&&(K=!0);if(h?q.isBlockBoundary():!l.contains(q))break;E&&"inline"==q.getComputedStyle("display")||(E=!1,K?p=q:q&&this.setEndAfter(q));u=q.getNext()}for(;u;){C=!1;if(u.type==CKEDITOR.NODE_TEXT)f=u.getText(),d(u,0,l)||(u=null),C=/^[\s\ufeff]/.test(f);else if(u.type==CKEDITOR.NODE_ELEMENT){if((0=l.getLength()?f.setStartAfter(l):(f.setStartBefore(l),c=0):f.setStartBefore(l));h&&h.type==CKEDITOR.NODE_TEXT&&(m?m>=h.getLength()?f.setEndAfter(h):(f.setEndAfter(h),p=0):f.setEndBefore(h));var f=new CKEDITOR.dom.walker(f),q=CKEDITOR.dom.walker.bookmark(),u=CKEDITOR.dom.walker.bogus();f.evaluator=function(b){return b.type==(a==CKEDITOR.SHRINK_ELEMENT?CKEDITOR.NODE_ELEMENT:CKEDITOR.NODE_TEXT)};var K;f.guard=function(b,c){if(e&&u(b)||q(b))return!0;if(a==CKEDITOR.SHRINK_ELEMENT&& +b.type==CKEDITOR.NODE_TEXT||c&&b.equals(K)||!1===d&&b.type==CKEDITOR.NODE_ELEMENT&&b.isBlockBoundary()||b.type==CKEDITOR.NODE_ELEMENT&&b.hasAttribute("contenteditable"))return!1;c||b.type!=CKEDITOR.NODE_ELEMENT||(K=b);return!0};c&&(l=f[a==CKEDITOR.SHRINK_ELEMENT?"lastForward":"next"]())&&this.setStartAt(l,b?CKEDITOR.POSITION_AFTER_START:CKEDITOR.POSITION_BEFORE_START);p&&(f.reset(),(f=f[a==CKEDITOR.SHRINK_ELEMENT?"lastBackward":"previous"]())&&this.setEndAt(f,b?CKEDITOR.POSITION_BEFORE_END:CKEDITOR.POSITION_AFTER_END)); +return!(!c&&!p)}},insertNode:function(a){this.optimizeBookmark();this.trim(!1,!0);var b=this.startContainer,c=b.getChild(this.startOffset);c?a.insertBefore(c):b.append(a);a.getParent()&&a.getParent().equals(this.endContainer)&&this.endOffset++;this.setStartBefore(a)},moveToPosition:function(a,b){this.setStartAt(a,b);this.collapse(!0)},moveToRange:function(a){this.setStart(a.startContainer,a.startOffset);this.setEnd(a.endContainer,a.endOffset)},selectNodeContents:function(a){this.setStart(a,0);this.setEnd(a, a.type==CKEDITOR.NODE_TEXT?a.getLength():a.getChildCount())},setStart:function(b,c){b.type==CKEDITOR.NODE_ELEMENT&&CKEDITOR.dtd.$empty[b.getName()]&&(c=b.getIndex(),b=b.getParent());this._setStartContainer(b);this.startOffset=c;this.endContainer||(this._setEndContainer(b),this.endOffset=c);a(this)},setEnd:function(b,c){b.type==CKEDITOR.NODE_ELEMENT&&CKEDITOR.dtd.$empty[b.getName()]&&(c=b.getIndex()+1,b=b.getParent());this._setEndContainer(b);this.endOffset=c;this.startContainer||(this._setStartContainer(b), this.startOffset=c);a(this)},setStartAfter:function(a){this.setStart(a.getParent(),a.getIndex()+1)},setStartBefore:function(a){this.setStart(a.getParent(),a.getIndex())},setEndAfter:function(a){this.setEnd(a.getParent(),a.getIndex()+1)},setEndBefore:function(a){this.setEnd(a.getParent(),a.getIndex())},setStartAt:function(b,c){switch(c){case CKEDITOR.POSITION_AFTER_START:this.setStart(b,0);break;case CKEDITOR.POSITION_BEFORE_END:b.type==CKEDITOR.NODE_TEXT?this.setStart(b,b.getLength()):this.setStart(b, b.getChildCount());break;case CKEDITOR.POSITION_BEFORE_START:this.setStartBefore(b);break;case CKEDITOR.POSITION_AFTER_END:this.setStartAfter(b)}a(this)},setEndAt:function(b,c){switch(c){case CKEDITOR.POSITION_AFTER_START:this.setEnd(b,0);break;case CKEDITOR.POSITION_BEFORE_END:b.type==CKEDITOR.NODE_TEXT?this.setEnd(b,b.getLength()):this.setEnd(b,b.getChildCount());break;case CKEDITOR.POSITION_BEFORE_START:this.setEndBefore(b);break;case CKEDITOR.POSITION_AFTER_END:this.setEndAfter(b)}a(this)},fixBlock:function(a, -b){var c=this.createBookmark(),d=this.document.createElement(b);this.collapse(a);this.enlarge(CKEDITOR.ENLARGE_BLOCK_CONTENTS);this.extractContents().appendTo(d);d.trim();this.insertNode(d);var e=d.getBogus();e&&e.remove();d.appendBogus();this.moveToBookmark(c);return d},splitBlock:function(a,b){var c=new CKEDITOR.dom.elementPath(this.startContainer,this.root),d=new CKEDITOR.dom.elementPath(this.endContainer,this.root),e=c.block,f=d.block,n=null;if(!c.blockLimit.equals(d.blockLimit))return null;"br"!= -a&&(e||(e=this.fixBlock(!0,a),f=(new CKEDITOR.dom.elementPath(this.endContainer,this.root)).block),f||(f=this.fixBlock(!1,a)));c=e&&this.checkStartOfBlock();d=f&&this.checkEndOfBlock();this.deleteContents();e&&e.equals(f)&&(d?(n=new CKEDITOR.dom.elementPath(this.startContainer,this.root),this.moveToPosition(f,CKEDITOR.POSITION_AFTER_END),f=null):c?(n=new CKEDITOR.dom.elementPath(this.startContainer,this.root),this.moveToPosition(e,CKEDITOR.POSITION_BEFORE_START),e=null):(f=this.splitElement(e,b|| -!1),e.is("ul","ol")||e.appendBogus()));return{previousBlock:e,nextBlock:f,wasStartOfBlock:c,wasEndOfBlock:d,elementPath:n}},splitElement:function(a,b){if(!this.collapsed)return null;this.setEndAt(a,CKEDITOR.POSITION_BEFORE_END);var c=this.extractContents(!1,b||!1),d=a.clone(!1,b||!1);c.appendTo(d);d.insertAfter(a);this.moveToPosition(a,CKEDITOR.POSITION_AFTER_END);return d},removeEmptyBlocksAtEnd:function(){function a(d){return function(a){return b(a)||c(a)||a.type==CKEDITOR.NODE_ELEMENT&&a.isEmptyInlineRemoveable()|| -d.is("table")&&a.is("caption")?!1:!0}}var b=CKEDITOR.dom.walker.whitespaces(),c=CKEDITOR.dom.walker.bookmark(!1);return function(b){for(var c=this.createBookmark(),d=this[b?"endPath":"startPath"](),e=d.block||d.blockLimit,f;e&&!e.equals(d.root)&&!e.getFirst(a(e));)f=e.getParent(),this[b?"setEndAt":"setStartAt"](e,CKEDITOR.POSITION_AFTER_END),e.remove(1),e=f;this.moveToBookmark(c)}}(),startPath:function(){return new CKEDITOR.dom.elementPath(this.startContainer,this.root)},endPath:function(){return new CKEDITOR.dom.elementPath(this.endContainer, +b){var c=this.createBookmark(),d=this.document.createElement(b);this.collapse(a);this.enlarge(CKEDITOR.ENLARGE_BLOCK_CONTENTS);this.extractContents().appendTo(d);d.trim();this.insertNode(d);var e=d.getBogus();e&&e.remove();d.appendBogus();this.moveToBookmark(c);return d},splitBlock:function(a,b){var c=new CKEDITOR.dom.elementPath(this.startContainer,this.root),d=new CKEDITOR.dom.elementPath(this.endContainer,this.root),e=c.block,f=d.block,l=null;if(!c.blockLimit.equals(d.blockLimit))return null;"br"!= +a&&(e||(e=this.fixBlock(!0,a),f=(new CKEDITOR.dom.elementPath(this.endContainer,this.root)).block),f||(f=this.fixBlock(!1,a)));c=e&&this.checkStartOfBlock();d=f&&this.checkEndOfBlock();this.deleteContents();e&&e.equals(f)&&(d?(l=new CKEDITOR.dom.elementPath(this.startContainer,this.root),this.moveToPosition(f,CKEDITOR.POSITION_AFTER_END),f=null):c?(l=new CKEDITOR.dom.elementPath(this.startContainer,this.root),this.moveToPosition(e,CKEDITOR.POSITION_BEFORE_START),e=null):(f=this.splitElement(e,b|| +!1),e.is("ul","ol")||e.appendBogus()));return{previousBlock:e,nextBlock:f,wasStartOfBlock:c,wasEndOfBlock:d,elementPath:l}},splitElement:function(a,b){if(!this.collapsed)return null;this.setEndAt(a,CKEDITOR.POSITION_BEFORE_END);var c=this.extractContents(!1,b||!1),d=a.clone(!1,b||!1);c.appendTo(d);d.insertAfter(a);this.moveToPosition(a,CKEDITOR.POSITION_AFTER_END);return d},removeEmptyBlocksAtEnd:function(){function a(g){return function(a){return b(a)||c(a)||a.type==CKEDITOR.NODE_ELEMENT&&a.isEmptyInlineRemoveable()|| +g.is("table")&&a.is("caption")?!1:!0}}var b=CKEDITOR.dom.walker.whitespaces(),c=CKEDITOR.dom.walker.bookmark(!1);return function(b){for(var c=this.createBookmark(),d=this[b?"endPath":"startPath"](),e=d.block||d.blockLimit,f;e&&!e.equals(d.root)&&!e.getFirst(a(e));)f=e.getParent(),this[b?"setEndAt":"setStartAt"](e,CKEDITOR.POSITION_AFTER_END),e.remove(1),e=f;this.moveToBookmark(c)}}(),startPath:function(){return new CKEDITOR.dom.elementPath(this.startContainer,this.root)},endPath:function(){return new CKEDITOR.dom.elementPath(this.endContainer, this.root)},checkBoundaryOfElement:function(a,b){var d=b==CKEDITOR.START,e=this.clone();e.collapse(d);e[d?"setStartAt":"setEndAt"](a,d?CKEDITOR.POSITION_AFTER_START:CKEDITOR.POSITION_BEFORE_END);e=new CKEDITOR.dom.walker(e);e.evaluator=c(d);return e[d?"checkBackward":"checkForward"]()},checkStartOfBlock:function(a){var c=this.startContainer,d=this.startOffset;CKEDITOR.env.ie&&d&&c.type==CKEDITOR.NODE_TEXT&&(c=CKEDITOR.tools.ltrim(c.substring(0,d)),h.test(c)&&this.trim(0,1));a||this.trim();a=new CKEDITOR.dom.elementPath(this.startContainer, this.root);c=this.clone();c.collapse(!0);c.setStartAt(a.block||a.blockLimit,CKEDITOR.POSITION_AFTER_START);a=new CKEDITOR.dom.walker(c);a.evaluator=b();return a.checkBackward()},checkEndOfBlock:function(a){var c=this.endContainer,d=this.endOffset;CKEDITOR.env.ie&&c.type==CKEDITOR.NODE_TEXT&&(c=CKEDITOR.tools.rtrim(c.substring(d)),h.test(c)&&this.trim(1,0));a||this.trim();a=new CKEDITOR.dom.elementPath(this.endContainer,this.root);c=this.clone();c.collapse(!1);c.setEndAt(a.block||a.blockLimit,CKEDITOR.POSITION_BEFORE_END); a=new CKEDITOR.dom.walker(c);a.evaluator=b();return a.checkForward()},getPreviousNode:function(a,b,c){var d=this.clone();d.collapse(1);d.setStartAt(c||this.root,CKEDITOR.POSITION_AFTER_START);c=new CKEDITOR.dom.walker(d);c.evaluator=a;c.guard=b;return c.previous()},getNextNode:function(a,b,c){var d=this.clone();d.collapse();d.setEndAt(c||this.root,CKEDITOR.POSITION_BEFORE_END);c=new CKEDITOR.dom.walker(d);c.evaluator=a;c.guard=b;return c.next()},checkReadOnly:function(){function a(b,c){for(;b;){if(b.type== CKEDITOR.NODE_ELEMENT){if("false"==b.getAttribute("contentEditable")&&!b.data("cke-editable"))return 0;if(b.is("html")||"true"==b.getAttribute("contentEditable")&&(b.contains(c)||b.equals(c)))break}b=b.getParent()}return 1}return function(){var b=this.startContainer,c=this.endContainer;return!(a(b,c)&&a(c,b))}}(),moveToElementEditablePosition:function(a,b){if(a.type==CKEDITOR.NODE_ELEMENT&&!a.isEditable(!1))return this.moveToPosition(a,b?CKEDITOR.POSITION_AFTER_END:CKEDITOR.POSITION_BEFORE_START), !0;for(var c=0;a;){if(a.type==CKEDITOR.NODE_TEXT){b&&this.endContainer&&this.checkEndOfBlock()&&h.test(a.getText())?this.moveToPosition(a,CKEDITOR.POSITION_BEFORE_START):this.moveToPosition(a,b?CKEDITOR.POSITION_AFTER_END:CKEDITOR.POSITION_BEFORE_START);c=1;break}if(a.type==CKEDITOR.NODE_ELEMENT)if(a.isEditable())this.moveToPosition(a,b?CKEDITOR.POSITION_BEFORE_END:CKEDITOR.POSITION_AFTER_START),c=1;else if(b&&a.is("br")&&this.endContainer&&this.checkEndOfBlock())this.moveToPosition(a,CKEDITOR.POSITION_BEFORE_START); -else if("false"==a.getAttribute("contenteditable")&&a.is(CKEDITOR.dtd.$block))return this.setStartBefore(a),this.setEndAfter(a),!0;var d=a,e=c,f=void 0;d.type==CKEDITOR.NODE_ELEMENT&&d.isEditable(!1)&&(f=d[b?"getLast":"getFirst"](q));e||f||(f=d[b?"getPrevious":"getNext"](q));a=f}return!!c},moveToClosestEditablePosition:function(a,b){var c,d=0,e,f,n=[CKEDITOR.POSITION_AFTER_END,CKEDITOR.POSITION_BEFORE_START];a?(c=new CKEDITOR.dom.range(this.root),c.moveToPosition(a,n[b?0:1])):c=this.clone();if(a&& -!a.is(CKEDITOR.dtd.$block))d=1;else if(e=c[b?"getNextEditableNode":"getPreviousEditableNode"]())d=1,(f=e.type==CKEDITOR.NODE_ELEMENT)&&e.is(CKEDITOR.dtd.$block)&&"false"==e.getAttribute("contenteditable")?(c.setStartAt(e,CKEDITOR.POSITION_BEFORE_START),c.setEndAt(e,CKEDITOR.POSITION_AFTER_END)):!CKEDITOR.env.needsBrFiller&&f&&e.is(CKEDITOR.dom.walker.validEmptyBlockContainers)?(c.setEnd(e,0),c.collapse()):c.moveToPosition(e,n[b?1:0]);d&&this.moveToRange(c);return!!d},moveToElementEditStart:function(a){return this.moveToElementEditablePosition(a)}, +else if("false"==a.getAttribute("contenteditable")&&a.is(CKEDITOR.dtd.$block))return this.setStartBefore(a),this.setEndAfter(a),!0;var d=a,e=c,f=void 0;d.type==CKEDITOR.NODE_ELEMENT&&d.isEditable(!1)&&(f=d[b?"getLast":"getFirst"](m));e||f||(f=d[b?"getPrevious":"getNext"](m));a=f}return!!c},moveToClosestEditablePosition:function(a,b){var c,d=0,e,f,l=[CKEDITOR.POSITION_AFTER_END,CKEDITOR.POSITION_BEFORE_START];a?(c=new CKEDITOR.dom.range(this.root),c.moveToPosition(a,l[b?0:1])):c=this.clone();if(a&& +!a.is(CKEDITOR.dtd.$block))d=1;else if(e=c[b?"getNextEditableNode":"getPreviousEditableNode"]())d=1,(f=e.type==CKEDITOR.NODE_ELEMENT)&&e.is(CKEDITOR.dtd.$block)&&"false"==e.getAttribute("contenteditable")?(c.setStartAt(e,CKEDITOR.POSITION_BEFORE_START),c.setEndAt(e,CKEDITOR.POSITION_AFTER_END)):!CKEDITOR.env.needsBrFiller&&f&&e.is(CKEDITOR.dom.walker.validEmptyBlockContainers)?(c.setEnd(e,0),c.collapse()):c.moveToPosition(e,l[b?1:0]);d&&this.moveToRange(c);return!!d},moveToElementEditStart:function(a){return this.moveToElementEditablePosition(a)}, moveToElementEditEnd:function(a){return this.moveToElementEditablePosition(a,!0)},getEnclosedNode:function(){var a=this.clone();a.optimize();if(a.startContainer.type!=CKEDITOR.NODE_ELEMENT||a.endContainer.type!=CKEDITOR.NODE_ELEMENT)return null;var a=new CKEDITOR.dom.walker(a),b=CKEDITOR.dom.walker.bookmark(!1,!0),c=CKEDITOR.dom.walker.whitespaces(!0);a.evaluator=function(a){return c(a)&&b(a)};var d=a.next();a.reset();return d&&d.equals(a.previous())?d:null},getTouchedStartNode:function(){var a=this.startContainer; return this.collapsed||a.type!=CKEDITOR.NODE_ELEMENT?a:a.getChild(this.startOffset)||a},getTouchedEndNode:function(){var a=this.endContainer;return this.collapsed||a.type!=CKEDITOR.NODE_ELEMENT?a:a.getChild(this.endOffset-1)||a},getNextEditableNode:f(),getPreviousEditableNode:f(1),_getTableElement:function(a){a=a||{td:1,th:1,tr:1,tbody:1,thead:1,tfoot:1,table:1};var b=this.getTouchedStartNode(),c=this.getTouchedEndNode(),d=b.getAscendant("table",!0),c=c.getAscendant("table",!0);return d&&!this.root.contains(d)? null:this.getEnclosedNode()?this.getEnclosedNode().getAscendant(a,!0):d&&c&&(d.equals(c)||d.contains(c)||c.contains(d))?b.getAscendant(a,!0):null},scrollIntoView:function(){var a=new CKEDITOR.dom.element.createFromHtml("\x3cspan\x3e\x26nbsp;\x3c/span\x3e",this.document),b,c,d,e=this.clone();e.optimize();(d=e.startContainer.type==CKEDITOR.NODE_TEXT)?(c=e.startContainer.getText(),b=e.startContainer.split(e.startOffset),a.insertAfter(e.startContainer)):e.insertNode(a);a.scrollIntoView();d&&(e.startContainer.setText(c), @@ -197,60 +197,60 @@ c.startContainer.getIndex());h&&e.setEnd(c.endContainer.getParent(),c.endContain g.setEnd(b.getParent().$,b.getIndex()+1);b=g.getClientRects();b.widgetRect=a.getClientRect();return b},c),CKEDITOR.tools.array.forEach(e,function(a){function b(e){CKEDITOR.tools.array.forEach(d,function(b,g){var f=CKEDITOR.tools.objectCompare(a[e],b);f||(f=CKEDITOR.tools.objectCompare(a.widgetRect,b));f&&(Array.prototype.splice.call(d,g,a.length-e,a.widgetRect),c=!0)});c||(earguments.length||(this.range=a,this.forceBrBreak=0,this.enlargeBr=1,this.enforceRealBlocks=0,this._||(this._={}))}function d(a){var b=[];a.forEach(function(a){if("true"==a.getAttribute("contenteditable"))return b.push(a),!1},CKEDITOR.NODE_ELEMENT,!0);return b}function b(a,c,e,f){a:{null==f&&(f=d(e));for(var h;h=f.shift();)if(h.getDtd().p){f={element:h,remaining:f};break a}f=null}if(!f)return 0;if((h=CKEDITOR.filter.instances[f.element.data("cke-filter")])&&!h.check(c))return b(a, c,e,f.remaining);c=new CKEDITOR.dom.range(f.element);c.selectNodeContents(f.element);c=c.createIterator();c.enlargeBr=a.enlargeBr;c.enforceRealBlocks=a.enforceRealBlocks;c.activeFilter=c.filter=h;a._.nestedEditable={element:f.element,container:e,remaining:f.remaining,iterator:c};return 1}function c(a,b,c){if(!b)return!1;a=a.clone();a.collapse(!c);return a.checkBoundaryOfElement(b,c?CKEDITOR.START:CKEDITOR.END)}var f=/^[\r\n\t ]+$/,e=CKEDITOR.dom.walker.bookmark(!1,!0),k=CKEDITOR.dom.walker.whitespaces(!0), -h=function(a){return e(a)&&k(a)},l={dd:1,dt:1,li:1};a.prototype={getNextParagraph:function(a){var d,k,z,x,E;a=a||"p";if(this._.nestedEditable){if(d=this._.nestedEditable.iterator.getNextParagraph(a))return this.activeFilter=this._.nestedEditable.iterator.activeFilter,d;this.activeFilter=this.filter;if(b(this,a,this._.nestedEditable.container,this._.nestedEditable.remaining))return this.activeFilter=this._.nestedEditable.iterator.activeFilter,this._.nestedEditable.iterator.getNextParagraph(a);this._.nestedEditable= -null}if(!this.range.root.getDtd()[a])return null;if(!this._.started){var v=this.range.clone();k=v.startPath();var n=v.endPath(),H=!v.collapsed&&c(v,k.block),u=!v.collapsed&&c(v,n.block,1);v.shrink(CKEDITOR.SHRINK_ELEMENT,!0);H&&v.setStartAt(k.block,CKEDITOR.POSITION_BEFORE_END);u&&v.setEndAt(n.block,CKEDITOR.POSITION_AFTER_START);k=v.endContainer.hasAscendant("pre",!0)||v.startContainer.hasAscendant("pre",!0);v.enlarge(this.forceBrBreak&&!k||!this.enlargeBr?CKEDITOR.ENLARGE_LIST_ITEM_CONTENTS:CKEDITOR.ENLARGE_BLOCK_CONTENTS); -v.collapsed||(k=new CKEDITOR.dom.walker(v.clone()),n=CKEDITOR.dom.walker.bookmark(!0,!0),k.evaluator=n,this._.nextNode=k.next(),k=new CKEDITOR.dom.walker(v.clone()),k.evaluator=n,k=k.previous(),this._.lastNode=k.getNextSourceNode(!0,null,v.root),this._.lastNode&&this._.lastNode.type==CKEDITOR.NODE_TEXT&&!CKEDITOR.tools.trim(this._.lastNode.getText())&&this._.lastNode.getParent().isBlockBoundary()&&(n=this.range.clone(),n.moveToPosition(this._.lastNode,CKEDITOR.POSITION_AFTER_END),n.checkEndOfBlock()&& -(n=new CKEDITOR.dom.elementPath(n.endContainer,n.root),this._.lastNode=(n.block||n.blockLimit).getNextSourceNode(!0))),this._.lastNode&&v.root.contains(this._.lastNode)||(this._.lastNode=this._.docEndMarker=v.document.createText(""),this._.lastNode.insertAfter(k)),v=null);this._.started=1;k=v}n=this._.nextNode;v=this._.lastNode;for(this._.nextNode=null;n;){var H=0,u=n.hasAscendant("pre"),I=n.type!=CKEDITOR.NODE_ELEMENT,J=0;if(I)n.type==CKEDITOR.NODE_TEXT&&f.test(n.getText())&&(I=0);else{var m=n.getName(); -if(CKEDITOR.dtd.$block[m]&&"false"==n.getAttribute("contenteditable")){d=n;b(this,a,d);break}else if(n.isBlockBoundary(this.forceBrBreak&&!u&&{br:1})){if("br"==m)I=1;else if(!k&&!n.getChildCount()&&"hr"!=m){d=n;z=n.equals(v);break}k&&(k.setEndAt(n,CKEDITOR.POSITION_BEFORE_START),"br"!=m&&(this._.nextNode=n));H=1}else{if(n.getFirst()){k||(k=this.range.clone(),k.setStartAt(n,CKEDITOR.POSITION_BEFORE_START));n=n.getFirst();continue}I=1}}I&&!k&&(k=this.range.clone(),k.setStartAt(n,CKEDITOR.POSITION_BEFORE_START)); -z=(!H||I)&&n.equals(v);if(k&&!H)for(;!n.getNext(h)&&!z;){m=n.getParent();if(m.isBlockBoundary(this.forceBrBreak&&!u&&{br:1})){H=1;I=0;z||m.equals(v);k.setEndAt(m,CKEDITOR.POSITION_BEFORE_END);break}n=m;I=1;z=n.equals(v);J=1}I&&k.setEndAt(n,CKEDITOR.POSITION_AFTER_END);n=this._getNextSourceNode(n,J,v);if((z=!n)||H&&k)break}if(!d){if(!k)return this._.docEndMarker&&this._.docEndMarker.remove(),this._.nextNode=null;d=new CKEDITOR.dom.elementPath(k.startContainer,k.root);n=d.blockLimit;H={div:1,th:1,td:1}; -d=d.block;!d&&n&&!this.enforceRealBlocks&&H[n.getName()]&&k.checkStartOfBlock()&&k.checkEndOfBlock()&&!n.equals(k.root)?d=n:!d||this.enforceRealBlocks&&d.is(l)?(d=this.range.document.createElement(a),k.extractContents().appendTo(d),d.trim(),k.insertNode(d),x=E=!0):"li"!=d.getName()?k.checkStartOfBlock()&&k.checkEndOfBlock()||(d=d.clone(!1),k.extractContents().appendTo(d),d.trim(),E=k.splitBlock(),x=!E.wasStartOfBlock,E=!E.wasEndOfBlock,k.insertNode(d)):z||(this._.nextNode=d.equals(v)?null:this._getNextSourceNode(k.getBoundaryNodes().endNode, -1,v))}x&&(x=d.getPrevious())&&x.type==CKEDITOR.NODE_ELEMENT&&("br"==x.getName()?x.remove():x.getLast()&&"br"==x.getLast().$.nodeName.toLowerCase()&&x.getLast().remove());E&&(x=d.getLast())&&x.type==CKEDITOR.NODE_ELEMENT&&"br"==x.getName()&&(!CKEDITOR.env.needsBrFiller||x.getPrevious(e)||x.getNext(e))&&x.remove();this._.nextNode||(this._.nextNode=z||d.equals(v)||!v?null:this._getNextSourceNode(d,1,v));return d},_getNextSourceNode:function(a,b,c){function d(a){return!(a.equals(c)||a.equals(f))}var f= +h=function(a){return e(a)&&k(a)},p={dd:1,dt:1,li:1};a.prototype={getNextParagraph:function(a){var d,k,y,A,F;a=a||"p";if(this._.nestedEditable){if(d=this._.nestedEditable.iterator.getNextParagraph(a))return this.activeFilter=this._.nestedEditable.iterator.activeFilter,d;this.activeFilter=this.filter;if(b(this,a,this._.nestedEditable.container,this._.nestedEditable.remaining))return this.activeFilter=this._.nestedEditable.iterator.activeFilter,this._.nestedEditable.iterator.getNextParagraph(a);this._.nestedEditable= +null}if(!this.range.root.getDtd()[a])return null;if(!this._.started){var v=this.range.clone();k=v.startPath();var l=v.endPath(),L=!v.collapsed&&c(v,k.block),w=!v.collapsed&&c(v,l.block,1);v.shrink(CKEDITOR.SHRINK_ELEMENT,!0);L&&v.setStartAt(k.block,CKEDITOR.POSITION_BEFORE_END);w&&v.setEndAt(l.block,CKEDITOR.POSITION_AFTER_START);k=v.endContainer.hasAscendant("pre",!0)||v.startContainer.hasAscendant("pre",!0);v.enlarge(this.forceBrBreak&&!k||!this.enlargeBr?CKEDITOR.ENLARGE_LIST_ITEM_CONTENTS:CKEDITOR.ENLARGE_BLOCK_CONTENTS); +v.collapsed||(k=new CKEDITOR.dom.walker(v.clone()),l=CKEDITOR.dom.walker.bookmark(!0,!0),k.evaluator=l,this._.nextNode=k.next(),k=new CKEDITOR.dom.walker(v.clone()),k.evaluator=l,k=k.previous(),this._.lastNode=k.getNextSourceNode(!0,null,v.root),this._.lastNode&&this._.lastNode.type==CKEDITOR.NODE_TEXT&&!CKEDITOR.tools.trim(this._.lastNode.getText())&&this._.lastNode.getParent().isBlockBoundary()&&(l=this.range.clone(),l.moveToPosition(this._.lastNode,CKEDITOR.POSITION_AFTER_END),l.checkEndOfBlock()&& +(l=new CKEDITOR.dom.elementPath(l.endContainer,l.root),this._.lastNode=(l.block||l.blockLimit).getNextSourceNode(!0))),this._.lastNode&&v.root.contains(this._.lastNode)||(this._.lastNode=this._.docEndMarker=v.document.createText(""),this._.lastNode.insertAfter(k)),v=null);this._.started=1;k=v}l=this._.nextNode;v=this._.lastNode;for(this._.nextNode=null;l;){var L=0,w=l.hasAscendant("pre"),J=l.type!=CKEDITOR.NODE_ELEMENT,G=0;if(J)l.type==CKEDITOR.NODE_TEXT&&f.test(l.getText())&&(J=0);else{var q=l.getName(); +if(CKEDITOR.dtd.$block[q]&&"false"==l.getAttribute("contenteditable")){d=l;b(this,a,d);break}else if(l.isBlockBoundary(this.forceBrBreak&&!w&&{br:1})){if("br"==q)J=1;else if(!k&&!l.getChildCount()&&"hr"!=q){d=l;y=l.equals(v);break}k&&(k.setEndAt(l,CKEDITOR.POSITION_BEFORE_START),"br"!=q&&(this._.nextNode=l));L=1}else{if(l.getFirst()){k||(k=this.range.clone(),k.setStartAt(l,CKEDITOR.POSITION_BEFORE_START));l=l.getFirst();continue}J=1}}J&&!k&&(k=this.range.clone(),k.setStartAt(l,CKEDITOR.POSITION_BEFORE_START)); +y=(!L||J)&&l.equals(v);if(k&&!L)for(;!l.getNext(h)&&!y;){q=l.getParent();if(q.isBlockBoundary(this.forceBrBreak&&!w&&{br:1})){L=1;J=0;y||q.equals(v);k.setEndAt(q,CKEDITOR.POSITION_BEFORE_END);break}l=q;J=1;y=l.equals(v);G=1}J&&k.setEndAt(l,CKEDITOR.POSITION_AFTER_END);l=this._getNextSourceNode(l,G,v);if((y=!l)||L&&k)break}if(!d){if(!k)return this._.docEndMarker&&this._.docEndMarker.remove(),this._.nextNode=null;d=new CKEDITOR.dom.elementPath(k.startContainer,k.root);l=d.blockLimit;L={div:1,th:1,td:1}; +d=d.block;!d&&l&&!this.enforceRealBlocks&&L[l.getName()]&&k.checkStartOfBlock()&&k.checkEndOfBlock()&&!l.equals(k.root)?d=l:!d||this.enforceRealBlocks&&d.is(p)?(d=this.range.document.createElement(a),k.extractContents().appendTo(d),d.trim(),k.insertNode(d),A=F=!0):"li"!=d.getName()?k.checkStartOfBlock()&&k.checkEndOfBlock()||(d=d.clone(!1),k.extractContents().appendTo(d),d.trim(),F=k.splitBlock(),A=!F.wasStartOfBlock,F=!F.wasEndOfBlock,k.insertNode(d)):y||(this._.nextNode=d.equals(v)?null:this._getNextSourceNode(k.getBoundaryNodes().endNode, +1,v))}A&&(A=d.getPrevious())&&A.type==CKEDITOR.NODE_ELEMENT&&("br"==A.getName()?A.remove():A.getLast()&&"br"==A.getLast().$.nodeName.toLowerCase()&&A.getLast().remove());F&&(A=d.getLast())&&A.type==CKEDITOR.NODE_ELEMENT&&"br"==A.getName()&&(!CKEDITOR.env.needsBrFiller||A.getPrevious(e)||A.getNext(e))&&A.remove();this._.nextNode||(this._.nextNode=y||d.equals(v)||!v?null:this._getNextSourceNode(d,1,v));return d},_getNextSourceNode:function(a,b,c){function d(a){return!(a.equals(c)||a.equals(f))}var f= this.range.root;for(a=a.getNextSourceNode(b,null,d);!e(a);)a=a.getNextSourceNode(b,null,d);return a}};CKEDITOR.dom.range.prototype.createIterator=function(){return new a(this)}})(); CKEDITOR.command=function(a,d){this.uiItems=[];this.exec=function(b){if(this.state==CKEDITOR.TRISTATE_DISABLED||!this.checkAllowed())return!1;this.editorFocus&&a.focus();return!1===this.fire("exec")?!0:!1!==d.exec.call(this,a,b)};this.refresh=function(a,b){if(!this.readOnly&&a.readOnly)return!0;if(this.context&&!b.isContextFor(this.context)||!this.checkAllowed(!0))return this.disable(),!0;this.startDisabled||this.enable();this.modes&&!this.modes[a.mode]&&this.disable();return!1===this.fire("refresh", {editor:a,path:b})?!0:d.refresh&&!1!==d.refresh.apply(this,arguments)};var b;this.checkAllowed=function(c){return c||"boolean"!=typeof b?b=a.activeFilter.checkFeature(this):b};CKEDITOR.tools.extend(this,d,{modes:{wysiwyg:1},editorFocus:1,contextSensitive:!!d.context,state:CKEDITOR.TRISTATE_DISABLED});CKEDITOR.event.call(this)}; CKEDITOR.command.prototype={enable:function(){this.state==CKEDITOR.TRISTATE_DISABLED&&this.checkAllowed()&&this.setState(this.preserveState&&"undefined"!=typeof this.previousState?this.previousState:CKEDITOR.TRISTATE_OFF)},disable:function(){this.setState(CKEDITOR.TRISTATE_DISABLED)},setState:function(a){if(this.state==a||a!=CKEDITOR.TRISTATE_DISABLED&&!this.checkAllowed())return!1;this.previousState=this.state;this.state=a;this.fire("state");return!0},toggleState:function(){this.state==CKEDITOR.TRISTATE_OFF? this.setState(CKEDITOR.TRISTATE_ON):this.state==CKEDITOR.TRISTATE_ON&&this.setState(CKEDITOR.TRISTATE_OFF)}};CKEDITOR.event.implementOn(CKEDITOR.command.prototype);CKEDITOR.ENTER_P=1;CKEDITOR.ENTER_BR=2;CKEDITOR.ENTER_DIV=3; -CKEDITOR.config={customConfig:"config.js",autoUpdateElement:!0,language:"",defaultLanguage:"en",contentsLangDirection:"",enterMode:CKEDITOR.ENTER_P,forceEnterMode:!1,shiftEnterMode:CKEDITOR.ENTER_BR,docType:"\x3c!DOCTYPE html\x3e",bodyId:"",bodyClass:"",fullPage:!1,height:200,contentsCss:CKEDITOR.getUrl("contents.css"),extraPlugins:"",removePlugins:"",protectedSource:[],tabIndex:0,width:"",baseFloatZIndex:1E4,blockedKeystrokes:[CKEDITOR.CTRL+66,CKEDITOR.CTRL+73,CKEDITOR.CTRL+85]}; -(function(){function a(a,b,c,d,e){var f,g;a=[];for(f in b){g=b[f];g="boolean"==typeof g?{}:"function"==typeof g?{match:g}:B(g);"$"!=f.charAt(0)&&(g.elements=f);c&&(g.featureName=c.toLowerCase());var m=g;m.elements=k(m.elements,/\s+/)||null;m.propertiesOnly=m.propertiesOnly||!0===m.elements;var p=/\s*,\s*/,r=void 0;for(r in Q){m[r]=k(m[r],p)||null;var D=m,n=S[r],t=k(m[S[r]],p),h=m[r],w=[],G=!0,O=void 0;t?G=!1:t={};for(O in h)"!"==O.charAt(0)&&(O=O.slice(1),w.push(O),t[O]=!0,G=!1);for(;O=w.pop();)h[O]= -h["!"+O],delete h["!"+O];D[n]=(G?!1:t)||null}m.match=m.match||null;d.push(g);a.push(g)}b=e.elements;e=e.generic;var C;c=0;for(d=a.length;c=--l&&(e&&CKEDITOR.document.getDocumentElement().removeStyle("cursor"),y(b))},x=function(b,c){a[b]=1;var e=d[b];delete d[b];for(var f=0;f=CKEDITOR.env.version||CKEDITOR.env.ie9Compat)?f.$.onreadystatechange=function(){if("loaded"==f.$.readyState||"complete"==f.$.readyState)f.$.onreadystatechange=null,x(b,!0)}:(f.$.onload=function(){setTimeout(function(){f.$.onload=null;f.$.onerror=null;x(b,!0)},0)},f.$.onerror=function(){f.$.onload=null;f.$.onerror=null;x(b,!1)}));f.appendTo(CKEDITOR.document.getHead())}}};e&&CKEDITOR.document.getDocumentElement().setStyle("cursor", -"wait");for(var v=0;v=--p&&(e&&CKEDITOR.document.getDocumentElement().removeStyle("cursor"),x(b))},A=function(b,c){a[b]=1;var e=d[b];delete d[b];for(var f=0;f=CKEDITOR.env.version||CKEDITOR.env.ie9Compat)?f.$.onreadystatechange=function(){if("loaded"==f.$.readyState||"complete"==f.$.readyState)f.$.onreadystatechange=null,A(b,!0)}:(f.$.onload=function(){setTimeout(function(){f.$.onload=null;f.$.onerror=null;A(b,!0)},0)},f.$.onerror=function(){f.$.onload=null;f.$.onerror=null;A(b,!1)}));f.appendTo(CKEDITOR.document.getHead())}}};e&&CKEDITOR.document.getDocumentElement().setStyle("cursor", +"wait");for(var v=0;v]+)>)|(?:!--([\S|\s]*?)--!?>)|(?:([^\/\s>]+)((?:\s+[\w\-:.]+(?:\s*=\s*?(?:(?:"[^"]*")|(?:'[^']*')|[^\s"'\/>]+))?)*)[\S\s]*?(\/?)>))/g}}; +!1;a.tabIndex=c.tabIndex||a.element&&a.element.getAttribute("tabindex")||0;a.activeEnterMode=a.enterMode=a.blockless?CKEDITOR.ENTER_BR:c.enterMode;a.activeShiftEnterMode=a.shiftEnterMode=a.blockless?CKEDITOR.ENTER_BR:c.shiftEnterMode;c.skin&&(CKEDITOR.skinName=c.skin);a.fireOnce("configLoaded");a.dataProcessor=new CKEDITOR.htmlDataProcessor(a);a.filter=a.activeFilter=new CKEDITOR.filter(a);p(a)});b&&null!=b.customConfig&&(a.config.customConfig=b.customConfig);k(a)||a.fireOnce("customConfigLoaded")} +function p(a){CKEDITOR.skin.loadPart("editor",function(){m(a)})}function m(a){CKEDITOR.lang.load(a.config.language,a.config.defaultLanguage,function(b,c){var d=a.config.title,e=a.config.applicationTitle;a.langCode=b;a.lang=CKEDITOR.tools.prototypedCopy(c);a.title="string"==typeof d||!1===d?d:[a.lang.editor,a.name].join(", ");a.applicationTitle="string"==typeof e||!1===e?e:[a.lang.application,a.name].join(", ");a.config.contentsLangDirection||(a.config.contentsLangDirection=a.elementMode==CKEDITOR.ELEMENT_MODE_INLINE? +a.element.getDirection(1):a.lang.dir);a.fire("langLoaded");g(a)})}function g(a){a.getStylesSet(function(b){a.once("loaded",function(){a.fire("stylesSet",{styles:b})},null,null,1);x(a)})}function x(a){function b(a){if(!a)return"";CKEDITOR.tools.isArray(a)&&(a=a.join(","));return a.replace(/\s/g,"")}var c=a.config,d=b(c.plugins),e=b(c.extraPlugins),f=b(c.removePlugins);if(e)var g=new RegExp("(?:^|,)(?:"+e.replace(/,/g,"|")+")(?\x3d,|$)","g"),d=d.replace(g,""),d=d+(","+e);if(f)var h=new RegExp("(?:^|,)(?:"+ +f.replace(/,/g,"|")+")(?\x3d,|$)","g"),d=d.replace(h,"");CKEDITOR.env.air&&(d+=",adobeair");CKEDITOR.plugins.load(d.split(","),function(b){var d=[],e=[],f=[];a.plugins=CKEDITOR.tools.extend({},a.plugins,b);for(var g in b){var k=b[g],N=k.lang,O=null,r=k.requires,I;CKEDITOR.tools.isArray(r)&&(r=r.join(","));if(r&&(I=r.match(h)))for(;r=I.pop();)CKEDITOR.error("editor-plugin-required",{plugin:r.replace(",",""),requiredBy:g});N&&!a.lang[g]&&(N.split&&(N=N.split(",")),0<=CKEDITOR.tools.indexOf(N,a.langCode)? +O=a.langCode:(O=a.langCode.replace(/-.*/,""),O=O!=a.langCode&&0<=CKEDITOR.tools.indexOf(N,O)?O:0<=CKEDITOR.tools.indexOf(N,"en")?"en":N[0]),k.langEntries&&k.langEntries[O]?(a.lang[g]=k.langEntries[O],O=null):f.push(CKEDITOR.getUrl(k.path+"lang/"+O+".js")));e.push(O);d.push(k)}CKEDITOR.scriptLoader.load(f,function(){if(!a.isDestroyed()&&!a.isDetached()){for(var b=["beforeInit","init","afterInit"],f=0;f]+)>)|(?:!--([\S|\s]*?)--!?>)|(?:([^\/\s>]+)((?:\s+[\w\-:.]+(?:\s*=\s*?(?:(?:"[^"]*")|(?:'[^']*')|[^\s"'\/>]+))?)*)[\S\s]*?(\/?)>))/g}}; (function(){var a=/([\w\-:.]+)(?:(?:\s*=\s*(?:(?:"([^"]*)")|(?:'([^']*)')|([^\s>]+)))|(?=\s|$))/g,d={checked:1,compact:1,declare:1,defer:1,disabled:1,ismap:1,multiple:1,nohref:1,noresize:1,noshade:1,nowrap:1,readonly:1,selected:1};CKEDITOR.htmlParser.prototype={onTagOpen:function(){},onTagClose:function(){},onText:function(){},onCDATA:function(){},onComment:function(){},parse:function(b){for(var c,f,e=0,k;c=this._.htmlPartsRegex.exec(b);){f=c.index;if(f>e)if(e=b.substring(e,f),k)k.push(e);else this.onText(e); -e=this._.htmlPartsRegex.lastIndex;if(f=c[1])if(f=f.toLowerCase(),k&&CKEDITOR.dtd.$cdata[f]&&(this.onCDATA(k.join("")),k=null),!k){this.onTagClose(f);continue}if(k)k.push(c[0]);else if(f=c[3]){if(f=f.toLowerCase(),!/="/.test(f)){var h={},l,q=c[4];c=!!c[5];if(q)for(;l=a.exec(q);){var g=l[1].toLowerCase();l=l[2]||l[3]||l[4]||"";h[g]=!l&&d[g]?g:CKEDITOR.tools.htmlDecodeAttr(l)}this.onTagOpen(f,h,c);!k&&CKEDITOR.dtd.$cdata[f]&&(k=[])}}else if(f=c[2])this.onComment(f)}if(b.length>e)this.onText(b.substring(e, +e=this._.htmlPartsRegex.lastIndex;if(f=c[1])if(f=f.toLowerCase(),k&&CKEDITOR.dtd.$cdata[f]&&(this.onCDATA(k.join("")),k=null),!k){this.onTagClose(f);continue}if(k)k.push(c[0]);else if(f=c[3]){if(f=f.toLowerCase(),!/="/.test(f)){var h={},p,m=c[4];c=!!c[5];if(m)for(;p=a.exec(m);){var g=p[1].toLowerCase();p=p[2]||p[3]||p[4]||"";h[g]=!p&&d[g]?g:CKEDITOR.tools.htmlDecodeAttr(p)}this.onTagOpen(f,h,c);!k&&CKEDITOR.dtd.$cdata[f]&&(k=[])}}else if(f=c[2])this.onComment(f)}if(b.length>e)this.onText(b.substring(e, b.length))}}})(); CKEDITOR.htmlParser.basicWriter=CKEDITOR.tools.createClass({$:function(){this._={output:[]}},proto:{openTag:function(a){this._.output.push("\x3c",a)},openTagClose:function(a,d){d?this._.output.push(" /\x3e"):this._.output.push("\x3e")},attribute:function(a,d){"string"==typeof d&&(d=CKEDITOR.tools.htmlEncodeAttr(d));this._.output.push(" ",a,'\x3d"',d,'"')},closeTag:function(a){this._.output.push("\x3c/",a,"\x3e")},text:function(a){this._.output.push(a)},comment:function(a){this._.output.push("\x3c!--",a, "--\x3e")},write:function(a){this._.output.push(a)},reset:function(){this._.output=[];this._.indent=!1},getHtml:function(a){var d=this._.output.join("");a&&this.reset();return d}}});"use strict"; @@ -309,50 +310,50 @@ CKEDITOR.htmlParser.comment.prototype=CKEDITOR.tools.extend(new CKEDITOR.htmlPar (function(){CKEDITOR.htmlParser.cdata=function(a){this.value=a};CKEDITOR.htmlParser.cdata.prototype=CKEDITOR.tools.extend(new CKEDITOR.htmlParser.node,{type:CKEDITOR.NODE_TEXT,filter:function(a){var d=this.getAscendant("style");if(d&&d.getAscendant({math:1,svg:1})){var d=CKEDITOR.htmlParser.fragment.fromHtml(this.value),b=new CKEDITOR.htmlParser.basicWriter;a.applyTo(d);d.writeHtml(b);this.value=b.getHtml()}},writeHtml:function(a){a.write(this.value)}})})();"use strict"; CKEDITOR.htmlParser.fragment=function(){this.children=[];this.parent=null;this._={isBlockLike:!0,hasInlineStarted:!1}}; (function(){function a(a){return a.attributes["data-cke-survive"]?!1:"a"==a.name&&a.attributes.href||CKEDITOR.dtd.$removeEmpty[a.name]}var d=CKEDITOR.tools.extend({table:1,ul:1,ol:1,dl:1},CKEDITOR.dtd.table,CKEDITOR.dtd.ul,CKEDITOR.dtd.ol,CKEDITOR.dtd.dl),b={ol:1,ul:1},c=CKEDITOR.tools.extend({},{html:1},CKEDITOR.dtd.html,CKEDITOR.dtd.body,CKEDITOR.dtd.head,{style:1,script:1}),f={ul:"li",ol:"li",dl:"dd",table:"tbody",tbody:"tr",thead:"tr",tfoot:"tr",tr:"td"};CKEDITOR.htmlParser.fragment.fromHtml= -function(e,k,h){function l(a){var b;if(0k;k++)if(e=d[k]){e=e.exec(a,c,this);if(!1===e)return null;if(e&&e!=c)return this.onNode(a,e);if(c.parent&&!c.name)break}return c}, onNode:function(a,c){var d=c.type;return d==CKEDITOR.NODE_ELEMENT?this.onElement(a,c):d==CKEDITOR.NODE_TEXT?new CKEDITOR.htmlParser.text(this.onText(a,c.value,c)):d==CKEDITOR.NODE_COMMENT?new CKEDITOR.htmlParser.comment(this.onComment(a,c.value,c)):null},onAttribute:function(a,c,d,e){return(d=this.attributesRules[d])?d.exec(a,e,c,this):e}}});CKEDITOR.htmlParser.filterRulesGroup=a;a.prototype={add:function(a,c,d){this.rules.splice(this.findIndex(c),0,{value:a,priority:c,options:d})},addMany:function(a, -c,d){for(var e=[this.findIndex(c),0],k=0,h=a.length;k/g,"\x26gt;")+"\x3c/textarea\x3e");return"\x3ccke:encoded\x3e"+encodeURIComponent(a)+"\x3c/cke:encoded\x3e"})}function y(a){return a.replace(S,function(a,b){return decodeURIComponent(b)})}function z(a){return a.replace(/\x3c!--(?!{cke_protected})[\s\S]+?--\x3e/g, -function(a){return"\x3c!--"+u+"{C}"+encodeURIComponent(a).replace(/--/g,"%2D%2D")+"--\x3e"})}function x(a){return a.replace(/\x3c!--\{cke_protected\}\{C\}([\s\S]+?)--\x3e/g,function(a,b){return decodeURIComponent(b)})}function E(a,b){var c=b._.dataStore;return a.replace(/\x3c!--\{cke_protected\}([\s\S]+?)--\x3e/g,function(a,b){return decodeURIComponent(b)}).replace(/\{cke_protected_(\d+)\}/g,function(a,b){return c&&c[b]||""})}function v(a,b){var c=[],d=b.config.protectedSource,e=b._.dataStore||(b._.dataStore= -{id:1}),f=/<\!--\{cke_temp(comment)?\}(\d*?)--\x3e/g,d=[/|$)/gi,//gi,//gi].concat(d);a=a.replace(/\x3c!--[\s\S]*?--\x3e/g,function(a){return"\x3c!--{cke_tempcomment}"+(c.push(a)-1)+"--\x3e"});for(var g=0;g]+\s*=\s*(?:[^'"\s>]+|'[^']*'|"[^"]*"))|[^\s=\/>]+))+\s*\/?>/g,function(a){return a.replace(/\x3c!--\{cke_protected\}([^>]*)--\x3e/g,function(a,b){e[e.id]=decodeURIComponent(b);return"{cke_protected_"+e.id++ +"}"})});return a=a.replace(/<(title|iframe|textarea)([^>]*)>([\s\S]*?)<\/\1>/g,function(a,c,d,e){return"\x3c"+c+d+"\x3e"+E(x(e),b)+"\x3c/"+c+"\x3e"})}var n;CKEDITOR.htmlDataProcessor=function(b){var c, -e,f=this;this.editor=b;this.dataFilter=c=new CKEDITOR.htmlParser.filter;this.htmlFilter=e=new CKEDITOR.htmlParser.filter;this.writer=new CKEDITOR.htmlParser.basicWriter;c.addRules(C);c.addRules(K,{applyToAll:!0});c.addRules(a(b,"data"),{applyToAll:!0});e.addRules(A);e.addRules(L,{applyToAll:!0});e.addRules(a(b,"html"),{applyToAll:!0});b.on("toHtml",function(a){a=a.data;var c=a.dataValue,e,c=n(c),c=v(c,b),c=g(c,Q),c=q(c),c=g(c,w),c=c.replace(t,"$1cke:$2"),c=c.replace(N,"\x3ccke:$1$2\x3e\x3c/cke:$1\x3e"), -c=c.replace(/(]*>)(\r\n|\n)/g,"$1$2$2"),c=c.replace(/([^a-z0-9<\-])(on\w{3,})(?!>)/gi,"$1data-cke-"+CKEDITOR.rnd+"-$2");e=a.context||b.editable().getName();var f;CKEDITOR.env.ie&&9>CKEDITOR.env.version&&"pre"==e&&(e="div",c="\x3cpre\x3e"+c+"\x3c/pre\x3e",f=1);e=b.document.createElement(e);e.setHtml("a"+c);c=e.getHtml().substr(1);c=c.replace(new RegExp("data-cke-"+CKEDITOR.rnd+"-","ig"),"");f&&(c=c.replace(/^
|<\/pre>$/gi,""));c=c.replace(O,"$1$2");c=y(c);c=x(c);e=!1===a.fixForBody?!1:
-d(a.enterMode,b.config.autoParagraph);c=CKEDITOR.htmlParser.fragment.fromHtml(c,a.context,e);e&&(f=c,!f.children.length&&CKEDITOR.dtd[f.name][e]&&(e=new CKEDITOR.htmlParser.element(e),f.add(e)));a.dataValue=c},null,null,5);b.on("toHtml",function(a){a.data.filter.applyTo(a.data.dataValue,!0,a.data.dontFilter,a.data.enterMode)&&b.fire("dataFiltered")},null,null,6);b.on("toHtml",function(a){a.data.dataValue.filterChildren(f.dataFilter,!0)},null,null,10);b.on("toHtml",function(a){a=a.data;var b=a.dataValue,
-c=new CKEDITOR.htmlParser.basicWriter;b.writeChildrenHtml(c);b=c.getHtml(!0);a.dataValue=z(b)},null,null,15);b.on("toDataFormat",function(a){var c=a.data.dataValue;a.data.enterMode!=CKEDITOR.ENTER_BR&&(c=c.replace(/^
/i,""));a.data.dataValue=CKEDITOR.htmlParser.fragment.fromHtml(c,a.data.context,d(a.data.enterMode,b.config.autoParagraph))},null,null,5);b.on("toDataFormat",function(a){a.data.dataValue.filterChildren(f.htmlFilter,!0)},null,null,10);b.on("toDataFormat",function(a){a.data.filter.applyTo(a.data.dataValue, -!1,!0)},null,null,11);b.on("toDataFormat",function(a){var c=a.data.dataValue,d=f.writer;d.reset();c.writeChildrenHtml(d);c=d.getHtml(!0);c=x(c);c=E(c,b);a.data.dataValue=c},null,null,15)};CKEDITOR.htmlDataProcessor.prototype={toHtml:function(a,b,c,d){var e=this.editor,f,g,m,t;b&&"object"==typeof b?(f=b.context,c=b.fixForBody,d=b.dontFilter,g=b.filter,m=b.enterMode,t=b.protectedWhitespaces):f=b;f||null===f||(f=e.editable().getName());return e.fire("toHtml",{dataValue:a,context:f,fixForBody:c,dontFilter:d, -filter:g||e.filter,enterMode:m||e.enterMode,protectedWhitespaces:t}).dataValue},toDataFormat:function(a,b){var c,d,e;b&&(c=b.context,d=b.filter,e=b.enterMode);c||null===c||(c=this.editor.editable().getName());return this.editor.fire("toDataFormat",{dataValue:a,filter:d||this.editor.filter,context:c,enterMode:e||this.editor.enterMode}).dataValue},protectSource:function(a){return v(a,this.editor)},unprotectSource:function(a){return E(a,this.editor)},unprotectRealComments:function(a){return x(a)}};var H= -/(?: |\xa0)$/,u="{cke_protected}",I=CKEDITOR.dtd,J="caption colgroup col thead tfoot tbody".split(" "),m=CKEDITOR.tools.extend({},I.$blockLimit,I.$block),C={elements:{input:h,textarea:h}},K={attributeNames:[[/^on/,"data-cke-pa-on"],[/^srcdoc/,"data-cke-pa-srcdoc"],[/^data-cke-expando$/,""]],elements:{iframe:function(a){if(a.attributes&&a.attributes.src){var b=a.attributes.src.toLowerCase().replace(/[^a-z]/gi,"");if(0===b.indexOf("javascript")||0===b.indexOf("data"))a.attributes["data-cke-pa-src"]= -a.attributes.src,delete a.attributes.src}}}},A={elements:{embed:function(a){var b=a.parent;if(b&&"object"==b.name){var c=b.attributes.width,b=b.attributes.height;c&&(a.attributes.width=c);b&&(a.attributes.height=b)}},a:function(a){var b=a.attributes;if(!(a.children.length||b.name||b.id||a.attributes["data-cke-saved-name"]))return!1}}},L={elementNames:[[/^cke:/,""],[/^\?xml:namespace$/,""]],attributeNames:[[/^data-cke-(saved|pa)-/,""],[/^data-cke-.*/,""],["hidefocus",""]],elements:{$:function(a){var b= -a.attributes;if(b){if(b["data-cke-temp"])return!1;for(var c=["name","href","src"],d,e=0;ed?1:-1})},param:function(a){a.children=[];a.isEmpty=!0;return a},span:function(a){"Apple-style-span"== -a.attributes["class"]&&delete a.name},html:function(a){delete a.attributes.contenteditable;delete a.attributes["class"]},body:function(a){delete a.attributes.spellcheck;delete a.attributes.contenteditable},style:function(a){var b=a.children[0];b&&b.value&&(b.value=CKEDITOR.tools.trim(b.value));a.attributes.type||(a.attributes.type="text/css")},title:function(a){var b=a.children[0];!b&&k(a,b=new CKEDITOR.htmlParser.text);b.value=a.attributes["data-cke-title"]||""},input:l,textarea:l},attributes:{"class":function(a){return CKEDITOR.tools.ltrim(a.replace(/(?:^|\s+)cke_[^\s]*/g, -""))||!1}}};CKEDITOR.env.ie&&(L.attributes.style=function(a){return a.replace(/(^|;)([^\:]+)/g,function(a){return a.toLowerCase()})});var r=/<(a|area|img|input|source)\b([^>]*)>/gi,B=/([\w-:]+)\s*=\s*(?:(?:"[^"]*")|(?:'[^']*')|(?:[^ "'>]+))/gi,D=/^(href|src|name)$/i,w=/(?:])[^>]*>[\s\S]*?<\/style>)|(?:<(:?link|meta|base)[^>]*>)/gi,Q=/(])[^>]*>)([\s\S]*?)(?:<\/textarea>)/gi,S=/([^<]*)<\/cke:encoded>/gi,t=/(<\/?)((?:object|embed|param|html|body|head|title)([\s][^>]*)?>)/gi, -O=/(<\/?)cke:((?:html|body|head|title)[^>]*>)/gi,N=/]*?)\/?>(?!\s*<\/cke:\1)/gi;n=function(){function a(b,c){for(var d=0;d/g];return function(b){for(;a(d,b);)for(var c=d,e=0;e/g,"\x26gt;")+"\x3c/textarea\x3e");return"\x3ccke:encoded\x3e"+encodeURIComponent(a)+"\x3c/cke:encoded\x3e"})}function x(a){return a.replace(O,function(a,b){return decodeURIComponent(b)})}function y(a){return a.replace(/\x3c!--(?!{cke_protected})[\s\S]+?--\x3e/g, +function(a){return"\x3c!--"+w+"{C}"+encodeURIComponent(a).replace(/--/g,"%2D%2D")+"--\x3e"})}function A(a){return a.replace(/\x3c!--\{cke_protected\}\{C\}([\s\S]+?)--\x3e/g,function(a,b){return decodeURIComponent(b)})}function F(a,b){var c=b._.dataStore;return a.replace(/\x3c!--\{cke_protected\}([\s\S]+?)--\x3e/g,function(a,b){return decodeURIComponent(b)}).replace(/\{cke_protected_(\d+)\}/g,function(a,b){return c&&c[b]||""})}function v(a,b,c){var d=[],e=b.config.protectedSource,f=b._.dataStore|| +(b._.dataStore={id:1}),g=new RegExp("\x3c\\!--\\{cke_temp_"+c+"(comment)?\\}(\\d*?)--\x3e","g"),e=[/|$)/gi,//gi,//gi].concat(e);a=a.replace(/\x3c!--[\s\S]*?--\x3e/g,function(a){return"\x3c!--{cke_temp_"+c+"comment}"+(d.push(a)-1)+"--\x3e"});for(var t=0;t]+\s*=\s*(?:[^'"\s>]+|'[^']*'|"[^"]*"))|[^\s=\/>]+))+\s*\/?>/g,function(a){return a.replace(/\x3c!--\{cke_protected\}([^>]*)--\x3e/g,function(a,b){f[f.id]=decodeURIComponent(b);return"{cke_protected_"+f.id++ +"}"})});return a=a.replace(/<(title|iframe|textarea)([^>]*)>([\s\S]*?)<\/\1>/g,function(a,c,d,e){return"\x3c"+c+d+"\x3e"+F(A(e),b)+"\x3c/"+c+"\x3e"})}var l;CKEDITOR.htmlDataProcessor= +function(b){var c,e,f=this;this.editor=b;this.dataFilter=c=new CKEDITOR.htmlParser.filter;this.htmlFilter=e=new CKEDITOR.htmlParser.filter;this.writer=new CKEDITOR.htmlParser.basicWriter;c.addRules(u);c.addRules(K,{applyToAll:!0});c.addRules(a(b,"data"),{applyToAll:!0});e.addRules(E);e.addRules(C,{applyToAll:!0});e.addRules(a(b,"html"),{applyToAll:!0});b.on("toHtml",function(a){var c;var e=window.crypto||window.msCrypto;c=e?e.getRandomValues(new Uint32Array(1))[0]:Math.floor(9E9*Math.random()+1E9); +a=a.data;var e=a.dataValue,e=l(e),e=v(e,b,c),e=g(e,N),e=m(e,c),e=g(e,H),e=e.replace(r,"$1cke:$2"),e=e.replace(M,"\x3ccke:$1$2\x3e\x3c/cke:$1\x3e"),e=e.replace(/(]*>)(\r\n|\n)/g,"$1$2$2"),e=e.replace(/([^a-z0-9<\-])(on\w{3,})(?!>)/gi,"$1data-cke-"+c+"-$2"),f=a.context||b.editable().getName(),t;CKEDITOR.env.ie&&9>CKEDITOR.env.version&&"pre"==f&&(f="div",e="\x3cpre\x3e"+e+"\x3c/pre\x3e",t=1);f=b.document.createElement(f);f.setHtml("a"+e);e=f.getHtml().substr(1);e=e.replace(new RegExp("data-cke-"+ +c+"-","ig"),"");t&&(e=e.replace(/^
|<\/pre>$/gi,""));e=e.replace(I,"$1$2");e=x(e);e=A(e);c=!1===a.fixForBody?!1:d(a.enterMode,b.config.autoParagraph);e=CKEDITOR.htmlParser.fragment.fromHtml(e,a.context,c);c&&(t=e,!t.children.length&&CKEDITOR.dtd[t.name][c]&&(c=new CKEDITOR.htmlParser.element(c),t.add(c)));a.dataValue=e},null,null,5);b.on("toHtml",function(a){a.data.filter.applyTo(a.data.dataValue,!0,a.data.dontFilter,a.data.enterMode)&&b.fire("dataFiltered")},null,null,6);b.on("toHtml",function(a){a.data.dataValue.filterChildren(f.dataFilter,
+!0)},null,null,10);b.on("toHtml",function(a){a=a.data;var b=a.dataValue,c=new CKEDITOR.htmlParser.basicWriter;b.writeChildrenHtml(c);b=c.getHtml(!0);a.dataValue=y(b)},null,null,15);b.on("toDataFormat",function(a){var c=a.data.dataValue;a.data.enterMode!=CKEDITOR.ENTER_BR&&(c=c.replace(/^
/i,""));a.data.dataValue=CKEDITOR.htmlParser.fragment.fromHtml(c,a.data.context,d(a.data.enterMode,b.config.autoParagraph))},null,null,5);b.on("toDataFormat",function(a){a.data.dataValue.filterChildren(f.htmlFilter, +!0)},null,null,10);b.on("toDataFormat",function(a){a.data.filter.applyTo(a.data.dataValue,!1,!0)},null,null,11);b.on("toDataFormat",function(a){var c=a.data.dataValue,d=f.writer;d.reset();c.writeChildrenHtml(d);c=d.getHtml(!0);c=A(c);c=F(c,b);a.data.dataValue=c},null,null,15)};CKEDITOR.htmlDataProcessor.prototype={toHtml:function(a,b,c,d){var e=this.editor,f,g,t,r;b&&"object"==typeof b?(f=b.context,c=b.fixForBody,d=b.dontFilter,g=b.filter,t=b.enterMode,r=b.protectedWhitespaces):f=b;f||null===f||(f= +e.editable().getName());return e.fire("toHtml",{dataValue:a,context:f,fixForBody:c,dontFilter:d,filter:g||e.filter,enterMode:t||e.enterMode,protectedWhitespaces:r}).dataValue},toDataFormat:function(a,b){var c,d,e;b&&(c=b.context,d=b.filter,e=b.enterMode);c||null===c||(c=this.editor.editable().getName());return this.editor.fire("toDataFormat",{dataValue:a,filter:d||this.editor.filter,context:c,enterMode:e||this.editor.enterMode}).dataValue},protectSource:function(a){return v(a,this.editor)},unprotectSource:function(a){return F(a, +this.editor)},unprotectRealComments:function(a){return A(a)}};var L=/(?: |\xa0)$/,w="{cke_protected}",J=CKEDITOR.dtd,G="caption colgroup col thead tfoot tbody".split(" "),q=CKEDITOR.tools.extend({},J.$blockLimit,J.$block),u={elements:{input:h,textarea:h}},K={attributeNames:[[/^on/,"data-cke-pa-on"],[/^srcdoc/,"data-cke-pa-srcdoc"],[/^data-cke-expando$/,""]],elements:{iframe:function(a){if(a.attributes&&a.attributes.src){var b=a.attributes.src.toLowerCase().replace(/[^a-z]/gi,"");if(0===b.indexOf("javascript")|| +0===b.indexOf("data"))a.attributes["data-cke-pa-src"]=a.attributes.src,delete a.attributes.src}}}},E={elements:{embed:function(a){var b=a.parent;if(b&&"object"==b.name){var c=b.attributes.width,b=b.attributes.height;c&&(a.attributes.width=c);b&&(a.attributes.height=b)}},a:function(a){var b=a.attributes;if(!(a.children.length||b.name||b.id||a.attributes["data-cke-saved-name"]))return!1}}},C={elementNames:[[/^cke:/,""],[/^\?xml:namespace$/,""]],attributeNames:[[/^data-cke-(saved|pa)-/,""],[/^data-cke-.*/, +""],["hidefocus",""]],elements:{$:function(a){var b=a.attributes;if(b){if(b["data-cke-temp"])return!1;for(var c=["name","href","src"],d,e=0;ed?1:-1})},param:function(a){a.children= +[];a.isEmpty=!0;return a},span:function(a){"Apple-style-span"==a.attributes["class"]&&delete a.name},html:function(a){delete a.attributes.contenteditable;delete a.attributes["class"]},body:function(a){delete a.attributes.spellcheck;delete a.attributes.contenteditable},style:function(a){var b=a.children[0];b&&b.value&&(b.value=CKEDITOR.tools.trim(b.value));a.attributes.type||(a.attributes.type="text/css")},title:function(a){var b=a.children[0];!b&&k(a,b=new CKEDITOR.htmlParser.text);b.value=a.attributes["data-cke-title"]|| +""},input:p,textarea:p},attributes:{"class":function(a){return CKEDITOR.tools.ltrim(a.replace(/(?:^|\s+)cke_[^\s]*/g,""))||!1}}};CKEDITOR.env.ie&&(C.attributes.style=function(a){return a.replace(/(^|;)([^\:]+)/g,function(a){return a.toLowerCase()})});var t=/<(a|area|img|input|source)\b([^>]*)>/gi,B=/([\w-:]+)\s*=\s*(?:(?:"[^"]*")|(?:'[^']*')|(?:[^ "'>]+))/gi,z=/^(href|src|name)$/i,H=/(?:])[^>]*>[\s\S]*?<\/style>)|(?:<(:?link|meta|base)[^>]*>)/gi,N=/(])[^>]*>)([\s\S]*?)(?:<\/textarea>)/gi, +O=/([^<]*)<\/cke:encoded>/gi,r=/(<\/?)((?:object|embed|param|html|body|head|title)([\s][^>]*)?>)/gi,I=/(<\/?)cke:((?:html|body|head|title)[^>]*>)/gi,M=/]*?)\/?>(?!\s*<\/cke:\1)/gi;l=function(){function a(b,c){for(var d=0;d/g];return function(b){for(;a(d,b);)for(var c=d,e=0;eb?1:0},b=CKEDITOR.htmlParser.fragment.prototype;CKEDITOR.htmlParser.element.prototype=CKEDITOR.tools.extend(new CKEDITOR.htmlParser.node,{type:CKEDITOR.NODE_ELEMENT,add:b.add,clone:function(){return new CKEDITOR.htmlParser.element(this.name,this.attributes)},filter:function(a,b){var d=this,k,h;b=d.getFilterContext(b);if(!d.parent)a.onRoot(b, -d);for(;;){k=d.name;if(!(h=a.onElementName(b,k)))return this.remove(),!1;d.name=h;if(!(d=a.onElement(b,d)))return this.remove(),!1;if(d!==this)return this.replaceWith(d),!1;if(d.name==k)break;if(d.type!=CKEDITOR.NODE_ELEMENT)return this.replaceWith(d),!1;if(!d.name)return this.replaceWithChildren(),!1}k=d.attributes;var l,q;for(l in k){for(h=k[l];;)if(q=a.onAttributeName(b,l))if(q!=l)delete k[l],l=q;else break;else{delete k[l];break}q&&(!1===(h=a.onAttribute(b,d,q,h))?delete k[q]:k[q]=h)}d.isEmpty|| -this.filterChildren(a,!1,b);return!0},filterChildren:b.filterChildren,writeHtml:function(a,b){b&&this.filter(b);var e=this.name,k=[],h=this.attributes,l,q;a.openTag(e,h);for(l in h)k.push([l,h[l]]);a.sortAttributes&&k.sort(d);l=0;for(q=k.length;lCKEDITOR.env.version||CKEDITOR.env.quirks))this.hasFocus&&(this.focus(),b());else if(this.hasFocus)this.focus(),a();else this.once("focus",function(){a()},null,null,-999)},getHtmlFromRange:function(a){if(a.collapsed)return new CKEDITOR.dom.documentFragment(a.document); -a={doc:this.getDocument(),range:a.clone()};I.eol.detect(a,this);I.bogus.exclude(a);I.cell.shrink(a);a.fragment=a.range.cloneContents();I.tree.rebuild(a,this);I.eol.fix(a,this);return new CKEDITOR.dom.documentFragment(a.fragment.$)},extractHtmlFromRange:function(a,b){var c=J,d={range:a,doc:a.document},e=this.getHtmlFromRange(a);if(a.collapsed)return a.optimize(),e;a.enlarge(CKEDITOR.ENLARGE_INLINE,1);c.table.detectPurge(d);d.bookmark=a.createBookmark();delete d.range;var g=this.editor.createRange(); -g.moveToPosition(d.bookmark.startNode,CKEDITOR.POSITION_BEFORE_START);d.targetBookmark=g.createBookmark();c.list.detectMerge(d,this);c.table.detectRanges(d,this);c.block.detectMerge(d,this);d.tableContentsRanges?(c.table.deleteRanges(d),a.moveToBookmark(d.bookmark),d.range=a):(a.moveToBookmark(d.bookmark),d.range=a,a.extractContents(c.detectExtractMerge(d)));a.moveToBookmark(d.targetBookmark);a.optimize();c.fixUneditableRangePosition(a);c.list.merge(d,this);c.table.purge(d,this);c.block.merge(d,this); -if(b){c=a.startPath();if(d=a.checkStartOfBlock()&&a.checkEndOfBlock()&&c.block&&!a.root.equals(c.block)){a:{var d=c.block.getElementsByTag("span"),g=0,f;if(d)for(;f=d.getItem(g++);)if(!z(f)){d=!0;break a}d=!1}d=!d}d&&(a.moveToPosition(c.block,CKEDITOR.POSITION_BEFORE_START),c.block.remove())}else c.autoParagraph(this.editor,a),x(a.startContainer)&&a.startContainer.appendBogus();a.startContainer.mergeSiblings();return e},setup:function(){var a=this.editor;this.attachListener(a,"beforeGetData",function(){var b= -this.getData();this.is("textarea")||!1!==a.config.ignoreEmptyParagraph&&(b=b.replace(v,function(a,b){return b}));a.setData(b,null,1)},this);this.attachListener(a,"getSnapshot",function(a){a.data=this.getData(1)},this);this.attachListener(a,"afterSetData",function(){this.setData(a.getData(1))},this);this.attachListener(a,"loadSnapshot",function(a){this.setData(a.data,1)},this);this.attachListener(a,"beforeFocus",function(){var b=a.getSelection();(b=b&&b.getNative())&&"Control"==b.type||this.focus()}, -this);this.attachListener(a,"insertHtml",function(a){this.insertHtml(a.data.dataValue,a.data.mode,a.data.range)},this);this.attachListener(a,"insertElement",function(a){this.insertElement(a.data)},this);this.attachListener(a,"insertText",function(a){this.insertText(a.data)},this);this.setReadOnly(a.readOnly);this.attachClass("cke_editable");a.elementMode==CKEDITOR.ELEMENT_MODE_INLINE?this.attachClass("cke_editable_inline"):a.elementMode!=CKEDITOR.ELEMENT_MODE_REPLACE&&a.elementMode!=CKEDITOR.ELEMENT_MODE_APPENDTO|| -this.attachClass("cke_editable_themed");this.attachClass("cke_contents_"+a.config.contentsLangDirection);a.keystrokeHandler.blockedKeystrokes[8]=+a.readOnly;a.keystrokeHandler.attach(this);this.on("blur",function(){this.hasFocus=!1},null,null,-1);this.on("focus",function(){this.hasFocus=!0},null,null,-1);if(CKEDITOR.env.webkit)this.on("scroll",function(){a._.previousScrollTop=a.editable().$.scrollTop},null,null,-1);if(CKEDITOR.env.edge&&14CKEDITOR.env.version?r.$.styleSheet.cssText=k:r.setText(k)):(k=f.appendStyleText(k),k=new CKEDITOR.dom.element(k.ownerNode||k.owningElement),h.setCustomData("stylesheet",k),k.data("cke-temp",1))}h=f.getCustomData("stylesheet_ref")||0;f.setCustomData("stylesheet_ref", -h+1);this.setCustomData("cke_includeReadonly",!a.config.disableReadonlyStyling);this.attachListener(this,"click",function(a){a=a.data;var b=(new CKEDITOR.dom.elementPath(a.getTarget(),this)).contains("a");b&&2!=a.$.button&&b.isReadOnly()&&a.preventDefault()});var B={8:1,46:1};this.attachListener(a,"key",function(b){if(a.readOnly)return!0;var c=b.data.domEvent.getKey(),d;b=a.getSelection();if(0!==b.getRanges().length){if(c in B){var g,f=b.getRanges()[0],h=f.startPath(),r,k,l,c=8==c;CKEDITOR.env.ie&& -11>CKEDITOR.env.version&&(g=b.getSelectedElement())||(g=e(b))?(a.fire("saveSnapshot"),f.moveToPosition(g,CKEDITOR.POSITION_BEFORE_START),g.remove(),f.select(),a.fire("saveSnapshot"),d=1):f.collapsed&&((r=h.block)&&(l=r[c?"getPrevious":"getNext"](y))&&l.type==CKEDITOR.NODE_ELEMENT&&l.is("table")&&f[c?"checkStartOfBlock":"checkEndOfBlock"]()?(a.fire("saveSnapshot"),f[c?"checkEndOfBlock":"checkStartOfBlock"]()&&r.remove(),f["moveToElementEdit"+(c?"End":"Start")](l),f.select(),a.fire("saveSnapshot"), -d=1):h.blockLimit&&h.blockLimit.is("td")&&(k=h.blockLimit.getAscendant("table"))&&f.checkBoundaryOfElement(k,c?CKEDITOR.START:CKEDITOR.END)&&(l=k[c?"getPrevious":"getNext"](y))?(a.fire("saveSnapshot"),f["moveToElementEdit"+(c?"End":"Start")](l),f.checkStartOfBlock()&&f.checkEndOfBlock()?l.remove():f.select(),a.fire("saveSnapshot"),d=1):(k=h.contains(["td","th","caption"]))&&f.checkBoundaryOfElement(k,c?CKEDITOR.START:CKEDITOR.END)&&(d=1))}return!d}});a.blockless&&CKEDITOR.env.ie&&CKEDITOR.env.needsBrFiller&& -this.attachListener(this,"keyup",function(b){b.data.getKeystroke()in B&&!this.getFirst(c)&&(this.appendBogus(),b=a.createRange(),b.moveToPosition(this,CKEDITOR.POSITION_AFTER_START),b.select())});this.attachListener(this,"dblclick",function(b){if(a.readOnly)return!1;b={element:b.data.getTarget()};a.fire("doubleclick",b)});CKEDITOR.env.ie&&this.attachListener(this,"click",b);CKEDITOR.env.ie&&!CKEDITOR.env.edge||this.attachListener(this,"mousedown",function(b){var c=b.data.getTarget();c.is("img","hr", -"input","textarea","select")&&!c.isReadOnly()&&(a.getSelection().selectElement(c),c.is("input","textarea","select")&&b.data.preventDefault())});CKEDITOR.env.edge&&this.attachListener(this,"mouseup",function(b){(b=b.data.getTarget())&&b.is("img")&&!b.isReadOnly()&&a.getSelection().selectElement(b)});CKEDITOR.env.gecko&&this.attachListener(this,"mouseup",function(b){if(2==b.data.$.button&&(b=b.data.getTarget(),!b.getAscendant("table")&&!b.getOuterHtml().replace(v,""))){var c=a.createRange();c.moveToElementEditStart(b); -c.select(!0)}});CKEDITOR.env.webkit&&(this.attachListener(this,"click",function(a){a.data.getTarget().is("input","select")&&a.data.preventDefault()}),this.attachListener(this,"mouseup",function(a){a.data.getTarget().is("input","textarea")&&a.data.preventDefault()}));CKEDITOR.env.webkit&&this.attachListener(a,"key",function(b){if(a.readOnly)return!0;var c=b.data.domEvent.getKey();if(c in B&&(b=a.getSelection(),0!==b.getRanges().length)){var c=8==c,d=b.getRanges()[0];b=d.startPath();if(d.collapsed)a:{var e= -b.block;if(e&&d[c?"checkStartOfBlock":"checkEndOfBlock"](!0)&&d.moveToClosestEditablePosition(e,!c)&&d.collapsed){if(d.startContainer.type==CKEDITOR.NODE_ELEMENT){var f=d.startContainer.getChild(d.startOffset-(c?1:0));if(f&&f.type==CKEDITOR.NODE_ELEMENT&&f.is("hr")){a.fire("saveSnapshot");f.remove();b=!0;break a}}d=d.startPath().block;if(!d||d&&d.contains(e))b=void 0;else{a.fire("saveSnapshot");var h;(h=(c?d:e).getBogus())&&h.remove();h=a.getSelection();f=h.createBookmarks();(c?e:d).moveChildren(c? -d:e,!1);b.lastElement.mergeSiblings();g(e,d,!c);h.selectBookmarks(f);b=!0}}else b=!1}else c=d,h=b.block,d=c.endPath().block,h&&d&&!h.equals(d)?(a.fire("saveSnapshot"),(e=h.getBogus())&&e.remove(),c.enlarge(CKEDITOR.ENLARGE_INLINE),c.deleteContents(),d.getParent()&&(d.moveChildren(h,!1),b.lastElement.mergeSiblings(),g(h,d,!0)),c=a.getSelection().getRanges()[0],c.collapse(1),c.optimize(),""===c.startContainer.getHtml()&&c.startContainer.appendBogus(),c.select(),b=!0):b=!1;if(!b)return;a.getSelection().scrollIntoView(); -a.fire("saveSnapshot");return!1}},this,null,100)}},getUniqueId:function(){var a;try{this._.expandoNumber=a=CKEDITOR.dom.domObject.prototype.getUniqueId.call(this)}catch(b){a=this._&&this._.expandoNumber}return a}},_:{cleanCustomData:function(){this.removeClass("cke_editable");this.restoreAttrs();for(var a=this.removeCustomData("classes");a&&a.length;)this.removeClass(a.pop());if(!this.is("textarea")){var a=this.getDocument(),b=a.getHead();if(b.getCustomData("stylesheet")){var c=a.getCustomData("stylesheet_ref"); ---c?a.setCustomData("stylesheet_ref",c):(a.removeCustomData("stylesheet_ref"),b.removeCustomData("stylesheet").remove())}}}}});CKEDITOR.editor.prototype.editable=function(a){var b=this._.editable;if(b&&a)return 0;if(!arguments.length)return b;a?b=a instanceof CKEDITOR.editable?a:new CKEDITOR.editable(this,a):(b&&b.detach(),b=null);return this._.editable=b};CKEDITOR.on("instanceLoaded",function(b){var c=b.editor;c.on("insertElement",function(a){a=a.data;a.type==CKEDITOR.NODE_ELEMENT&&(a.is("input")|| -a.is("textarea"))&&("false"!=a.getAttribute("contentEditable")&&a.data("cke-editable",a.hasAttribute("contenteditable")?"true":"1"),a.setAttribute("contentEditable",!1))});c.on("selectionChange",function(b){if(!c.readOnly){var d=c.getSelection();d&&!d.isLocked&&(d=c.checkDirty(),c.fire("lockSnapshot"),a(b),c.fire("unlockSnapshot"),!d&&c.resetDirty())}})});CKEDITOR.on("instanceCreated",function(a){var b=a.editor;b.on("mode",function(){var a=b.editable();if(a&&a.isInline()){var c=b.title;a.changeAttr("role", -"textbox");a.changeAttr("aria-multiline","true");a.changeAttr("aria-label",c);c&&a.changeAttr("title",c);var d=b.fire("ariaEditorHelpLabel",{}).label;if(d&&(c=this.ui.space(this.elementMode==CKEDITOR.ELEMENT_MODE_INLINE?"top":"contents"))){var e=CKEDITOR.tools.getNextId(),d=CKEDITOR.dom.element.createFromHtml('\x3cspan id\x3d"'+e+'" class\x3d"cke_voice_label"\x3e'+d+"\x3c/span\x3e");c.append(d);a.changeAttr("aria-describedby",e)}}})});CKEDITOR.addCss(".cke_editable{cursor:text}.cke_editable img,.cke_editable input,.cke_editable textarea{cursor:default}"); -y=CKEDITOR.dom.walker.whitespaces(!0);z=CKEDITOR.dom.walker.bookmark(!1,!0);x=CKEDITOR.dom.walker.empty();E=CKEDITOR.dom.walker.bogus();v=/(^|]*>)\s*<(p|div|address|h\d|center|pre)[^>]*>\s*(?:]*>| |\u00A0| )?\s*(:?<\/\2>)?\s*(?=$|<\/body>)/gi;n=function(){function a(b){return b.type==CKEDITOR.NODE_ELEMENT}function b(c,d){var e,g,f,h,r=[],k=d.range.startContainer;e=d.range.startPath();for(var k=D[k.getName()],B=0,w=c.getChildren(),l=w.count(),q=-1,n=-1,Q=0,A=e.contains(D.$list);B< -l;++B)e=w.getItem(B),a(e)?(f=e.getName(),A&&f in CKEDITOR.dtd.$list?r=r.concat(b(e,d)):(h=!!k[f],"br"!=f||!e.data("cke-eol")||B&&B!=l-1||(Q=(g=B?r[B-1].node:w.getItem(B+1))&&(!a(g)||!g.is("br")),g=g&&a(g)&&D.$block[g.getName()]),-1!=q||h||(q=B),h||(n=B),r.push({isElement:1,isLineBreak:Q,isBlock:e.isBlockBoundary(),hasBlockSibling:g,node:e,name:f,allowed:h}),g=Q=0)):r.push({isElement:0,node:e,allowed:1});-1CKEDITOR.env.version&&d.getChildCount()&&d.getFirst().remove())}return function(d){var e=d.startContainer,g=e.getAscendant("table",1),f=!1;c(g.getElementsByTag("td"));c(g.getElementsByTag("th"));g=d.clone();g.setStart(e,0);g=a(g).lastBackward();g||(g=d.clone(),g.setEndAt(e,CKEDITOR.POSITION_BEFORE_END),g=a(g).lastForward(),f=!0);g||(g=e);g.is("table")?(d.setStartAt(g,CKEDITOR.POSITION_BEFORE_START),d.collapse(!0),g.remove()):(g.is({tbody:1,thead:1,tfoot:1})&&(g= -b(g,"tr",f)),g.is("tr")&&(g=b(g,g.getParent().is("thead")?"th":"td",f)),(e=g.getBogus())&&e.remove(),d.moveToPosition(g,f?CKEDITOR.POSITION_AFTER_START:CKEDITOR.POSITION_BEFORE_END))}}();u=function(){function a(b){b=new CKEDITOR.dom.walker(b);b.guard=function(a,b){if(b)return!1;if(a.type==CKEDITOR.NODE_ELEMENT)return a.is(CKEDITOR.dtd.$list)||a.is(CKEDITOR.dtd.$listItem)};b.evaluator=function(a){return a.type==CKEDITOR.NODE_ELEMENT&&a.is(CKEDITOR.dtd.$listItem)};return b}return function(b){var c= -b.startContainer,d=!1,e;e=b.clone();e.setStart(c,0);e=a(e).lastBackward();e||(e=b.clone(),e.setEndAt(c,CKEDITOR.POSITION_BEFORE_END),e=a(e).lastForward(),d=!0);e||(e=c);e.is(CKEDITOR.dtd.$list)?(b.setStartAt(e,CKEDITOR.POSITION_BEFORE_START),b.collapse(!0),e.remove()):((c=e.getBogus())&&c.remove(),b.moveToPosition(e,d?CKEDITOR.POSITION_AFTER_START:CKEDITOR.POSITION_BEFORE_END),b.select())}}();I={eol:{detect:function(a,b){var c=a.range,d=c.clone(),e=c.clone(),g=new CKEDITOR.dom.elementPath(c.startContainer, -b),f=new CKEDITOR.dom.elementPath(c.endContainer,b);d.collapse(1);e.collapse();g.block&&d.checkBoundaryOfElement(g.block,CKEDITOR.END)&&(c.setStartAfter(g.block),a.prependEolBr=1);f.block&&e.checkBoundaryOfElement(f.block,CKEDITOR.START)&&(c.setEndBefore(f.block),a.appendEolBr=1)},fix:function(a,b){var c=b.getDocument(),d;a.appendEolBr&&(d=this.createEolBr(c),a.fragment.append(d));!a.prependEolBr||d&&!d.getPrevious()||a.fragment.append(this.createEolBr(c),1)},createEolBr:function(a){return a.createElement("br", -{attributes:{"data-cke-eol":1}})}},bogus:{exclude:function(a){var b=a.range.getBoundaryNodes(),c=b.startNode,b=b.endNode;!b||!E(b)||c&&c.equals(b)||a.range.setEndBefore(b)}},tree:{rebuild:function(a,b){var c=a.range,d=c.getCommonAncestor(),e=new CKEDITOR.dom.elementPath(d,b),g=new CKEDITOR.dom.elementPath(c.startContainer,b),c=new CKEDITOR.dom.elementPath(c.endContainer,b),f;d.type==CKEDITOR.NODE_TEXT&&(d=d.getParent());if(e.blockLimit.is({tr:1,table:1})){var h=e.contains("table").getParent();f=function(a){return!a.equals(h)}}else if(e.block&& -e.block.is(CKEDITOR.dtd.$listItem)&&(g=g.contains(CKEDITOR.dtd.$list),c=c.contains(CKEDITOR.dtd.$list),!g.equals(c))){var k=e.contains(CKEDITOR.dtd.$list).getParent();f=function(a){return!a.equals(k)}}f||(f=function(a){return!a.equals(e.block)&&!a.equals(e.blockLimit)});this.rebuildFragment(a,b,d,f)},rebuildFragment:function(a,b,c,d){for(var e;c&&!c.equals(b)&&d(c);)e=c.clone(0,1),a.fragment.appendTo(e),a.fragment=e,c=c.getParent()}},cell:{shrink:function(a){a=a.range;var b=a.startContainer,c=a.endContainer, -d=a.startOffset,e=a.endOffset;b.type==CKEDITOR.NODE_ELEMENT&&b.equals(c)&&b.is("tr")&&++d==e&&a.shrink(CKEDITOR.SHRINK_TEXT)}}};J=function(){function a(b,c){var d=b.getParent();if(d.is(CKEDITOR.dtd.$inline))b[c?"insertBefore":"insertAfter"](d)}function b(c,d,e){a(d);a(e,1);for(var g;g=e.getNext();)g.insertAfter(d),d=g;x(c)&&c.remove()}function c(a,b){var d=new CKEDITOR.dom.range(a);d.setStartAfter(b.startNode);d.setEndBefore(b.endNode);return d}return{list:{detectMerge:function(a,b){var d=c(b,a.bookmark), -e=d.startPath(),g=d.endPath(),f=e.contains(CKEDITOR.dtd.$list),h=g.contains(CKEDITOR.dtd.$list);a.mergeList=f&&h&&f.getParent().equals(h.getParent())&&!f.equals(h);a.mergeListItems=e.block&&g.block&&e.block.is(CKEDITOR.dtd.$listItem)&&g.block.is(CKEDITOR.dtd.$listItem);if(a.mergeList||a.mergeListItems)d=d.clone(),d.setStartBefore(a.bookmark.startNode),d.setEndAfter(a.bookmark.endNode),a.mergeListBookmark=d.createBookmark()},merge:function(a,c){if(a.mergeListBookmark){var d=a.mergeListBookmark.startNode, -e=a.mergeListBookmark.endNode,g=new CKEDITOR.dom.elementPath(d,c),f=new CKEDITOR.dom.elementPath(e,c);if(a.mergeList){var h=g.contains(CKEDITOR.dtd.$list),k=f.contains(CKEDITOR.dtd.$list);h.equals(k)||(k.moveChildren(h),k.remove())}a.mergeListItems&&(g=g.contains(CKEDITOR.dtd.$listItem),f=f.contains(CKEDITOR.dtd.$listItem),g.equals(f)||b(f,d,e));d.remove();e.remove()}}},block:{detectMerge:function(a,b){if(!a.tableContentsRanges&&!a.mergeListBookmark){var c=new CKEDITOR.dom.range(b);c.setStartBefore(a.bookmark.startNode); -c.setEndAfter(a.bookmark.endNode);a.mergeBlockBookmark=c.createBookmark()}},merge:function(a,c){if(a.mergeBlockBookmark&&!a.purgeTableBookmark){var d=a.mergeBlockBookmark.startNode,e=a.mergeBlockBookmark.endNode,g=new CKEDITOR.dom.elementPath(d,c),f=new CKEDITOR.dom.elementPath(e,c),g=g.block,f=f.block;g&&f&&!g.equals(f)&&b(f,d,e);d.remove();e.remove()}}},table:function(){function a(c){var e=[],g,f=new CKEDITOR.dom.walker(c),h=c.startPath().contains(d),k=c.endPath().contains(d),l={};f.guard=function(a, -f){if(a.type==CKEDITOR.NODE_ELEMENT){var q="visited_"+(f?"out":"in");if(a.getCustomData(q))return;CKEDITOR.dom.element.setMarker(l,a,q,1)}if(f&&h&&a.equals(h))g=c.clone(),g.setEndAt(h,CKEDITOR.POSITION_BEFORE_END),e.push(g);else if(!f&&k&&a.equals(k))g=c.clone(),g.setStartAt(k,CKEDITOR.POSITION_AFTER_START),e.push(g);else{if(q=!f)q=a.type==CKEDITOR.NODE_ELEMENT&&a.is(d)&&(!h||b(a,h))&&(!k||b(a,k));if(!q&&(q=f))if(a.is(d))var q=h&&h.getAscendant("table",!0),m=k&&k.getAscendant("table",!0),n=a.getAscendant("table", -!0),q=q&&q.contains(n)||m&&m.contains(n);else q=void 0;q&&(g=c.clone(),g.selectNodeContents(a),e.push(g))}};f.lastForward();CKEDITOR.dom.element.clearAllMarkers(l);return e}function b(a,c){var d=CKEDITOR.POSITION_CONTAINS+CKEDITOR.POSITION_IS_CONTAINED,e=a.getPosition(c);return e===CKEDITOR.POSITION_IDENTICAL?!1:0===(e&d)}var d={td:1,th:1,caption:1};return{detectPurge:function(a){var b=a.range,c=b.clone();c.enlarge(CKEDITOR.ENLARGE_ELEMENT);var c=new CKEDITOR.dom.walker(c),e=0;c.evaluator=function(a){a.type== -CKEDITOR.NODE_ELEMENT&&a.is(d)&&++e};c.checkForward();if(1CKEDITOR.env.version||CKEDITOR.env.quirks))this.hasFocus&&(this.focus(),b());else if(this.hasFocus)this.focus(), +a();else this.once("focus",function(){a()},null,null,-999)},getHtmlFromRange:function(a){if(a.collapsed)return new CKEDITOR.dom.documentFragment(a.document);a={doc:this.getDocument(),range:a.clone()};q.eol.detect(a,this);q.bogus.exclude(a);q.cell.shrink(a);a.fragment=a.range.cloneContents();q.tree.rebuild(a,this);q.eol.fix(a,this);return new CKEDITOR.dom.documentFragment(a.fragment.$)},extractHtmlFromRange:function(a,b){var c=u,d={range:a,doc:a.document},e=this.getHtmlFromRange(a);if(a.collapsed)return a.optimize(), +e;a.enlarge(CKEDITOR.ENLARGE_INLINE,1);c.table.detectPurge(d);d.bookmark=a.createBookmark();delete d.range;var g=this.editor.createRange();g.moveToPosition(d.bookmark.startNode,CKEDITOR.POSITION_BEFORE_START);d.targetBookmark=g.createBookmark();c.list.detectMerge(d,this);c.table.detectRanges(d,this);c.block.detectMerge(d,this);d.tableContentsRanges?(c.table.deleteRanges(d),a.moveToBookmark(d.bookmark),d.range=a):(a.moveToBookmark(d.bookmark),d.range=a,a.extractContents(c.detectExtractMerge(d)));a.moveToBookmark(d.targetBookmark); +a.optimize();c.fixUneditableRangePosition(a);c.list.merge(d,this);c.table.purge(d,this);c.block.merge(d,this);if(b){c=a.startPath();if(d=a.checkStartOfBlock()&&a.checkEndOfBlock()&&c.block&&!a.root.equals(c.block)){a:{var d=c.block.getElementsByTag("span"),g=0,f;if(d)for(;f=d.getItem(g++);)if(!F(f)){d=!0;break a}d=!1}d=!d}d&&(a.moveToPosition(c.block,CKEDITOR.POSITION_BEFORE_START),c.block.remove())}else c.autoParagraph(this.editor,a),v(a.startContainer)&&a.startContainer.appendBogus();a.startContainer.mergeSiblings(); +return e},setup:function(){var a=this.editor;this.attachListener(a,"beforeGetData",function(){var b=this.getData();this.is("textarea")||!1!==a.config.ignoreEmptyParagraph&&(b=b.replace(L,function(a,b){return b}));a.setData(b,null,1)},this);this.attachListener(a,"getSnapshot",function(a){a.data=this.getData(1)},this);this.attachListener(a,"afterSetData",function(){this.setData(a.getData(1))},this);this.attachListener(a,"loadSnapshot",function(a){this.setData(a.data,1)},this);this.attachListener(a, +"beforeFocus",function(){var b=a.getSelection();(b=b&&b.getNative())&&"Control"==b.type||this.focus()},this);this.attachListener(a,"insertHtml",function(a){this.insertHtml(a.data.dataValue,a.data.mode,a.data.range)},this);this.attachListener(a,"insertElement",function(a){this.insertElement(a.data)},this);this.attachListener(a,"insertText",function(a){this.insertText(a.data)},this);this.setReadOnly(a.readOnly);this.attachClass("cke_editable");a.elementMode==CKEDITOR.ELEMENT_MODE_INLINE?this.attachClass("cke_editable_inline"): +a.elementMode!=CKEDITOR.ELEMENT_MODE_REPLACE&&a.elementMode!=CKEDITOR.ELEMENT_MODE_APPENDTO||this.attachClass("cke_editable_themed");this.attachClass("cke_contents_"+a.config.contentsLangDirection);a.keystrokeHandler.blockedKeystrokes[8]=+a.readOnly;a.keystrokeHandler.attach(this);this.on("blur",function(){this.hasFocus=!1},null,null,-1);this.on("focus",function(){this.hasFocus=!0},null,null,-1);if(CKEDITOR.env.webkit)this.on("scroll",function(){a._.previousScrollTop=a.editable().$.scrollTop},null, +null,-1);if(CKEDITOR.env.edge&&14CKEDITOR.env.version?H.$.styleSheet.cssText=z:H.setText(z)):(z=g.appendStyleText(z),z=new CKEDITOR.dom.element(z.ownerNode||z.owningElement),f.setCustomData("stylesheet", +z),z.data("cke-temp",1))}f=g.getCustomData("stylesheet_ref")||0;g.setCustomData("stylesheet_ref",f+1);this.setCustomData("cke_includeReadonly",!a.config.disableReadonlyStyling);this.attachListener(this,"click",function(a){a=a.data;var b=(new CKEDITOR.dom.elementPath(a.getTarget(),this)).contains("a");b&&2!=a.$.button&&b.isReadOnly()&&a.preventDefault()});var N={8:1,46:1};this.attachListener(a,"key",function(b){if(a.readOnly)return!0;var c=b.data.domEvent.getKey(),d,g=a.getSelection();if(0!==g.getRanges().length){if(c in +N){var f;b=g.getRanges()[0];var t=b.startPath(),z,B,H,c=8==c,m=!1;if(CKEDITOR.env.ie&&11>CKEDITOR.env.version&&g.getSelectedElement())f=g.getSelectedElement();else if(e(g)){var l=new CKEDITOR.dom.walker(b),p=b.collapsed?b.startContainer:l.next(),m=!1,C;if(b.checkStartOfBlock()){C=b.startPath().block||b.startPath().blockLimit;var q=C.getName();C=-1!==CKEDITOR.tools.array.indexOf(["dd","dt","li"],q)&&null===C.getPrevious()}else C=!1;if(C){for(;p&&!m;)m=p.$.nodeName.toLowerCase(),m=!!K[m],p=l.next(); +l=h(b.startPath());p=h(b.endPath());m=m||l!==p}else m=void 0;m||(f=k(g))}f||m?(a.fire("saveSnapshot"),m?((d=b.startContainer.getAscendant(K,!0))?(b.setStart(d,0),b.enlarge(CKEDITOR.ENLARGE_ELEMENT),f=b):f=null,f.deleteContents()):(b.moveToPosition(f,CKEDITOR.POSITION_BEFORE_START),f.remove()),b.select(),a.fire("saveSnapshot"),d=1):b.collapsed&&((z=t.block)&&(H=z[c?"getPrevious":"getNext"](A))&&H.type==CKEDITOR.NODE_ELEMENT&&H.is("table")&&b[c?"checkStartOfBlock":"checkEndOfBlock"]()?(a.fire("saveSnapshot"), +b[c?"checkEndOfBlock":"checkStartOfBlock"]()&&z.remove(),b["moveToElementEdit"+(c?"End":"Start")](H),b.select(),a.fire("saveSnapshot"),d=1):t.blockLimit&&t.blockLimit.is("td")&&(B=t.blockLimit.getAscendant("table"))&&b.checkBoundaryOfElement(B,c?CKEDITOR.START:CKEDITOR.END)&&(H=B[c?"getPrevious":"getNext"](A))?(a.fire("saveSnapshot"),b["moveToElementEdit"+(c?"End":"Start")](H),b.checkStartOfBlock()&&b.checkEndOfBlock()?H.remove():b.select(),a.fire("saveSnapshot"),d=1):(B=t.contains(["td","th","caption"]))&& +b.checkBoundaryOfElement(B,c?CKEDITOR.START:CKEDITOR.END)&&(d=1))}return!d}});a.blockless&&CKEDITOR.env.ie&&CKEDITOR.env.needsBrFiller&&this.attachListener(this,"keyup",function(b){b.data.getKeystroke()in N&&!this.getFirst(c)&&(this.appendBogus(),b=a.createRange(),b.moveToPosition(this,CKEDITOR.POSITION_AFTER_START),b.select())});this.attachListener(this,"dblclick",function(b){if(a.readOnly)return!1;b={element:b.data.getTarget()};a.fire("doubleclick",b)});CKEDITOR.env.ie&&this.attachListener(this, +"click",b);CKEDITOR.env.ie&&!CKEDITOR.env.edge||this.attachListener(this,"mousedown",function(b){var c=b.data.getTarget();c.is("img","hr","input","textarea","select")&&!c.isReadOnly()&&(a.getSelection().selectElement(c),c.is("input","textarea","select")&&b.data.preventDefault())});CKEDITOR.env.edge&&this.attachListener(this,"mouseup",function(b){(b=b.data.getTarget())&&b.is("img")&&!b.isReadOnly()&&a.getSelection().selectElement(b)});CKEDITOR.env.gecko&&this.attachListener(this,"mouseup",function(b){if(2== +b.data.$.button&&(b=b.data.getTarget(),!b.getAscendant("table")&&!b.getOuterHtml().replace(L,""))){var c=a.createRange();c.moveToElementEditStart(b);c.select(!0)}});CKEDITOR.env.webkit&&(this.attachListener(this,"click",function(a){a.data.getTarget().is("input","select")&&a.data.preventDefault()}),this.attachListener(this,"mouseup",function(a){a.data.getTarget().is("input","textarea")&&a.data.preventDefault()}));CKEDITOR.env.webkit&&this.attachListener(a,"key",function(b){if(a.readOnly)return!0;var c= +b.data.domEvent.getKey();if(c in N&&(b=a.getSelection(),0!==b.getRanges().length)){var c=8==c,d=b.getRanges()[0];b=d.startPath();if(d.collapsed)a:{var e=b.block;if(e&&d[c?"checkStartOfBlock":"checkEndOfBlock"](!0)&&d.moveToClosestEditablePosition(e,!c)&&d.collapsed){if(d.startContainer.type==CKEDITOR.NODE_ELEMENT){var g=d.startContainer.getChild(d.startOffset-(c?1:0));if(g&&g.type==CKEDITOR.NODE_ELEMENT&&g.is("hr")){a.fire("saveSnapshot");g.remove();b=!0;break a}}d=d.startPath().block;if(!d||d&&d.contains(e))b= +void 0;else{a.fire("saveSnapshot");var f;(f=(c?d:e).getBogus())&&f.remove();f=a.getSelection();g=f.createBookmarks();(c?e:d).moveChildren(c?d:e,!1);b.lastElement.mergeSiblings();y(e,d,!c);f.selectBookmarks(g);b=!0}}else b=!1}else c=d,f=b.block,d=c.endPath().block,f&&d&&!f.equals(d)?(a.fire("saveSnapshot"),(e=f.getBogus())&&e.remove(),c.enlarge(CKEDITOR.ENLARGE_INLINE),c.deleteContents(),d.getParent()&&(d.moveChildren(f,!1),b.lastElement.mergeSiblings(),y(f,d,!0)),c=a.getSelection().getRanges()[0], +c.collapse(1),c.optimize(),""===c.startContainer.getHtml()&&c.startContainer.appendBogus(),c.select(),b=!0):b=!1;if(!b)return;a.getSelection().scrollIntoView();a.fire("saveSnapshot");return!1}},this,null,100)}},getUniqueId:function(){var a;try{this._.expandoNumber=a=CKEDITOR.dom.domObject.prototype.getUniqueId.call(this)}catch(b){a=this._&&this._.expandoNumber}return a}},_:{cleanCustomData:function(){this.removeClass("cke_editable");this.restoreAttrs();for(var a=this.removeCustomData("classes");a&& +a.length;)this.removeClass(a.pop());if(!this.is("textarea")){var a=this.getDocument(),b=a.getHead();if(b.getCustomData("stylesheet")){var c=a.getCustomData("stylesheet_ref");--c?a.setCustomData("stylesheet_ref",c):(a.removeCustomData("stylesheet_ref"),b.removeCustomData("stylesheet").remove())}}}}});CKEDITOR.editor.prototype.editable=function(a){var b=this._.editable;if(b&&a)return 0;if(!arguments.length)return b;a?b=a instanceof CKEDITOR.editable?a:new CKEDITOR.editable(this,a):(b&&b.detach(),b= +null);return this._.editable=b};CKEDITOR.on("instanceLoaded",function(b){var c=b.editor;c.on("insertElement",function(a){a=a.data;a.type==CKEDITOR.NODE_ELEMENT&&(a.is("input")||a.is("textarea"))&&("false"!=a.getAttribute("contentEditable")&&a.data("cke-editable",a.hasAttribute("contenteditable")?"true":"1"),a.setAttribute("contentEditable",!1))});c.on("selectionChange",function(b){if(!c.readOnly){var d=c.getSelection();d&&!d.isLocked&&(d=c.checkDirty(),c.fire("lockSnapshot"),a(b),c.fire("unlockSnapshot"), +!d&&c.resetDirty())}})});CKEDITOR.on("instanceCreated",function(a){var b=a.editor;b.on("mode",function(){var a=b.editable();if(a&&a.isInline()){var c=b.title;a.changeAttr("role","textbox");a.changeAttr("aria-multiline","true");c&&a.changeAttr("aria-label",c);c&&a.changeAttr("title",c);var d=b.fire("ariaEditorHelpLabel",{}).label;if(d&&(c=this.ui.space(this.elementMode==CKEDITOR.ELEMENT_MODE_INLINE?"top":"contents"))){var e=CKEDITOR.tools.getNextId(),d=CKEDITOR.dom.element.createFromHtml('\x3cspan id\x3d"'+ +e+'" class\x3d"cke_voice_label"\x3e'+d+"\x3c/span\x3e");c.append(d);a.changeAttr("aria-describedby",e)}}})});CKEDITOR.addCss(".cke_editable{cursor:text}.cke_editable img,.cke_editable input,.cke_editable textarea{cursor:default}");A=CKEDITOR.dom.walker.whitespaces(!0);F=CKEDITOR.dom.walker.bookmark(!1,!0);v=CKEDITOR.dom.walker.empty();l=CKEDITOR.dom.walker.bogus();L=/(^|]*>)\s*<(p|div|address|h\d|center|pre)[^>]*>\s*(?:]*>| |\u00A0| )?\s*(:?<\/\2>)?\s*(?=$|<\/body>)/gi;w= +function(){function a(b){return b.type==CKEDITOR.NODE_ELEMENT}function b(c,d){var e,g,f,h,r=[],t=d.range.startContainer;e=d.range.startPath();for(var t=l[t.getName()],k=0,z=c.getChildren(),B=z.count(),H=-1,I=-1,M=0,N=e.contains(l.$list);kCKEDITOR.env.version&&d.getChildCount()&&d.getFirst().remove())}return function(d){var e=d.startContainer,g=e.getAscendant("table",1),f=!1;c(g.getElementsByTag("td"));c(g.getElementsByTag("th"));g=d.clone();g.setStart(e,0);g=a(g).lastBackward();g||(g=d.clone(),g.setEndAt(e, +CKEDITOR.POSITION_BEFORE_END),g=a(g).lastForward(),f=!0);g||(g=e);g.is("table")?(d.setStartAt(g,CKEDITOR.POSITION_BEFORE_START),d.collapse(!0),g.remove()):(g.is({tbody:1,thead:1,tfoot:1})&&(g=b(g,"tr",f)),g.is("tr")&&(g=b(g,g.getParent().is("thead")?"th":"td",f)),(e=g.getBogus())&&e.remove(),d.moveToPosition(g,f?CKEDITOR.POSITION_AFTER_START:CKEDITOR.POSITION_BEFORE_END))}}();G=function(){function a(b){b=new CKEDITOR.dom.walker(b);b.guard=function(a,b){if(b)return!1;if(a.type==CKEDITOR.NODE_ELEMENT)return a.is(CKEDITOR.dtd.$list)|| +a.is(CKEDITOR.dtd.$listItem)};b.evaluator=function(a){return a.type==CKEDITOR.NODE_ELEMENT&&a.is(CKEDITOR.dtd.$listItem)};return b}return function(b){var c=b.startContainer,d=!1,e;e=b.clone();e.setStart(c,0);e=a(e).lastBackward();e||(e=b.clone(),e.setEndAt(c,CKEDITOR.POSITION_BEFORE_END),e=a(e).lastForward(),d=!0);e||(e=c);e.is(CKEDITOR.dtd.$list)?(b.setStartAt(e,CKEDITOR.POSITION_BEFORE_START),b.collapse(!0),e.remove()):((c=e.getBogus())&&c.remove(),b.moveToPosition(e,d?CKEDITOR.POSITION_AFTER_START: +CKEDITOR.POSITION_BEFORE_END),b.select())}}();q={eol:{detect:function(a,b){var c=a.range,d=c.clone(),e=c.clone(),g=new CKEDITOR.dom.elementPath(c.startContainer,b),f=new CKEDITOR.dom.elementPath(c.endContainer,b);d.collapse(1);e.collapse();g.block&&d.checkBoundaryOfElement(g.block,CKEDITOR.END)&&(c.setStartAfter(g.block),a.prependEolBr=1);f.block&&e.checkBoundaryOfElement(f.block,CKEDITOR.START)&&(c.setEndBefore(f.block),a.appendEolBr=1)},fix:function(a,b){var c=b.getDocument(),d;a.appendEolBr&&(d= +this.createEolBr(c),a.fragment.append(d));!a.prependEolBr||d&&!d.getPrevious()||a.fragment.append(this.createEolBr(c),1)},createEolBr:function(a){return a.createElement("br",{attributes:{"data-cke-eol":1}})}},bogus:{exclude:function(a){var b=a.range.getBoundaryNodes(),c=b.startNode,b=b.endNode;!b||!l(b)||c&&c.equals(b)||a.range.setEndBefore(b)}},tree:{rebuild:function(a,b){var c=a.range,d=c.getCommonAncestor(),e=new CKEDITOR.dom.elementPath(d,b),g=new CKEDITOR.dom.elementPath(c.startContainer,b), +c=new CKEDITOR.dom.elementPath(c.endContainer,b),f;d.type==CKEDITOR.NODE_TEXT&&(d=d.getParent());if(e.blockLimit.is({tr:1,table:1})){var h=e.contains("table").getParent();f=function(a){return!a.equals(h)}}else if(e.block&&e.block.is(CKEDITOR.dtd.$listItem)&&(g=g.contains(CKEDITOR.dtd.$list),c=c.contains(CKEDITOR.dtd.$list),!g.equals(c))){var r=e.contains(CKEDITOR.dtd.$list).getParent();f=function(a){return!a.equals(r)}}f||(f=function(a){return!a.equals(e.block)&&!a.equals(e.blockLimit)});this.rebuildFragment(a, +b,d,f)},rebuildFragment:function(a,b,c,d){for(var e;c&&!c.equals(b)&&d(c);)e=c.clone(0,1),a.fragment.appendTo(e),a.fragment=e,c=c.getParent()}},cell:{shrink:function(a){a=a.range;var b=a.startContainer,c=a.endContainer,d=a.startOffset,e=a.endOffset;b.type==CKEDITOR.NODE_ELEMENT&&b.equals(c)&&b.is("tr")&&++d==e&&a.shrink(CKEDITOR.SHRINK_TEXT)}}};u=function(){function a(b,c){var d=b.getParent();if(d.is(CKEDITOR.dtd.$inline))b[c?"insertBefore":"insertAfter"](d)}function b(c,d,e){a(d);a(e,1);for(var g;g= +e.getNext();)g.insertAfter(d),d=g;v(c)&&c.remove()}function c(a,b){var d=new CKEDITOR.dom.range(a);d.setStartAfter(b.startNode);d.setEndBefore(b.endNode);return d}return{list:{detectMerge:function(a,b){var d=c(b,a.bookmark),e=d.startPath(),g=d.endPath(),f=e.contains(CKEDITOR.dtd.$list),h=g.contains(CKEDITOR.dtd.$list);a.mergeList=f&&h&&f.getParent().equals(h.getParent())&&!f.equals(h);a.mergeListItems=e.block&&g.block&&e.block.is(CKEDITOR.dtd.$listItem)&&g.block.is(CKEDITOR.dtd.$listItem);if(a.mergeList|| +a.mergeListItems)d=d.clone(),d.setStartBefore(a.bookmark.startNode),d.setEndAfter(a.bookmark.endNode),a.mergeListBookmark=d.createBookmark()},merge:function(a,c){if(a.mergeListBookmark){var d=a.mergeListBookmark.startNode,e=a.mergeListBookmark.endNode,g=new CKEDITOR.dom.elementPath(d,c),f=new CKEDITOR.dom.elementPath(e,c);if(a.mergeList){var h=g.contains(CKEDITOR.dtd.$list),k=f.contains(CKEDITOR.dtd.$list);h.equals(k)||(k.moveChildren(h),k.remove())}a.mergeListItems&&(g=g.contains(CKEDITOR.dtd.$listItem), +f=f.contains(CKEDITOR.dtd.$listItem),g.equals(f)||b(f,d,e));d.remove();e.remove()}}},block:{detectMerge:function(a,b){if(!a.tableContentsRanges&&!a.mergeListBookmark){var c=new CKEDITOR.dom.range(b);c.setStartBefore(a.bookmark.startNode);c.setEndAfter(a.bookmark.endNode);a.mergeBlockBookmark=c.createBookmark()}},merge:function(a,c){if(a.mergeBlockBookmark&&!a.purgeTableBookmark){var d=a.mergeBlockBookmark.startNode,e=a.mergeBlockBookmark.endNode,g=new CKEDITOR.dom.elementPath(d,c),f=new CKEDITOR.dom.elementPath(e, +c),g=g.block,f=f.block;g&&f&&!g.equals(f)&&b(f,d,e);d.remove();e.remove()}}},table:function(){function a(c){var e=[],g,f=new CKEDITOR.dom.walker(c),h=c.startPath().contains(d),k=c.endPath().contains(d),t={};f.guard=function(a,f){if(a.type==CKEDITOR.NODE_ELEMENT){var B="visited_"+(f?"out":"in");if(a.getCustomData(B))return;CKEDITOR.dom.element.setMarker(t,a,B,1)}if(f&&h&&a.equals(h))g=c.clone(),g.setEndAt(h,CKEDITOR.POSITION_BEFORE_END),e.push(g);else if(!f&&k&&a.equals(k))g=c.clone(),g.setStartAt(k, +CKEDITOR.POSITION_AFTER_START),e.push(g);else{if(B=!f)B=a.type==CKEDITOR.NODE_ELEMENT&&a.is(d)&&(!h||b(a,h))&&(!k||b(a,k));if(!B&&(B=f))if(a.is(d))var B=h&&h.getAscendant("table",!0),I=k&&k.getAscendant("table",!0),m=a.getAscendant("table",!0),B=B&&B.contains(m)||I&&I.contains(m);else B=void 0;B&&(g=c.clone(),g.selectNodeContents(a),e.push(g))}};f.lastForward();CKEDITOR.dom.element.clearAllMarkers(t);return e}function b(a,c){var d=CKEDITOR.POSITION_CONTAINS+CKEDITOR.POSITION_IS_CONTAINED,e=a.getPosition(c); +return e===CKEDITOR.POSITION_IDENTICAL?!1:0===(e&d)}var d={td:1,th:1,caption:1};return{detectPurge:function(a){var b=a.range,c=b.clone();c.enlarge(CKEDITOR.ENLARGE_ELEMENT);var c=new CKEDITOR.dom.walker(c),e=0;c.evaluator=function(a){a.type==CKEDITOR.NODE_ELEMENT&&a.is(d)&&++e};c.checkForward();if(1g&&e&&e.intersectsNode(c.$)){var f=[{node:d.anchorNode,offset:d.anchorOffset}, -{node:d.focusNode,offset:d.focusOffset}];d.anchorNode==c.$&&d.anchorOffset>g&&(f[0].offset-=g);d.focusNode==c.$&&d.focusOffset>g&&(f[1].offset-=g)}}c.setText(z(c.getText(),1));f&&(c=a.getDocument().$,d=c.getSelection(),c=c.createRange(),c.setStart(f[0].node,f[0].offset),c.collapse(!0),d.removeAllRanges(),d.addRange(c),d.extend(f[1].node,f[1].offset))}}function z(a,b){return b?a.replace(I,function(a,b){return b?" ":""}):a.replace(u,"")}function x(a,b){var c=b&&CKEDITOR.tools.htmlEncode(b)||"\x26nbsp;", +return c+=d.join("\t")}function f(a){var b=this.root.editor,d=b.getSelection(1);this.reset();G=!0;d.root.once("selectionchange",function(a){a.cancel()},null,null,0);d.selectRanges([a[0]]);d=this._.cache;d.ranges=new CKEDITOR.dom.rangeList(a);d.type=CKEDITOR.SELECTION_TEXT;d.selectedElement=a[0]._getTableElement();d.selectedText=c(a);d.nativeSel=null;this.isFake=1;this.rev=L++;b._.fakeSelection=this;G=!1;this.root.fire("selectionchange")}function e(){var b=this._.fakeSelection,c;if(b){c=this.getSelection(1); +var e;if(!(e=!c)&&(e=!c.isHidden())){e=b;var g=c.getRanges(),f=e.getRanges(),h=g.length&&g[0]._getTableElement()&&g[0]._getTableElement().getAscendant("table",!0),k=f.length&&f[0]._getTableElement()&&f[0]._getTableElement().getAscendant("table",!0),m=1===g.length&&g[0]._getTableElement()&&g[0]._getTableElement().is("table"),M=1===f.length&&f[0]._getTableElement()&&f[0]._getTableElement().is("table");if(a(e.getSelectedElement()))e=!1;else{var n=1===g.length&&g[0].collapsed,f=d(g,!!CKEDITOR.env.webkit)&& +d(f);h=h&&k?h.equals(k)||k.contains(h):!1;h&&(n||f)?(m&&!M&&e.selectRanges(g),e=!0):e=!1}e=!e}e&&(b.reset(),b=0)}if(!b&&(b=c||this.getSelection(1),!b||b.getType()==CKEDITOR.SELECTION_NONE))return;this.fire("selectionCheck",b);c=this.elementPath();c.compare(this._.selectionPreviousPath)||(e=this._.selectionPreviousPath&&this._.selectionPreviousPath.blockLimit.equals(c.blockLimit),!CKEDITOR.env.webkit&&!CKEDITOR.env.gecko||e||(this._.previousActive=this.document.getActive()),this._.selectionPreviousPath= +c,this.fire("selectionChange",{selection:b,path:c}))}function k(){u=!0;q||(h.call(this),q=CKEDITOR.tools.setTimeout(h,200,this))}function h(){q=null;u&&(CKEDITOR.tools.setTimeout(e,0,this),u=!1)}function p(a){return K(a)||a.type==CKEDITOR.NODE_ELEMENT&&!a.is(CKEDITOR.dtd.$empty)?!0:!1}function m(a){function b(c,d){return c&&c.type!=CKEDITOR.NODE_TEXT?a.clone()["moveToElementEdit"+(d?"End":"Start")](c):!1}if(!(a.root instanceof CKEDITOR.editable))return!1;var c=a.startContainer,d=a.getPreviousNode(p, +null,c),e=a.getNextNode(p,null,c);return b(d)||b(e,1)||!(d||e||c.type==CKEDITOR.NODE_ELEMENT&&c.isBlockBoundary()&&c.getBogus())?!0:!1}function g(a){x(a,!1);var b=a.getDocument().createText(w);a.setCustomData("cke-fillingChar",b);return b}function x(a,b){var c=a&&a.removeCustomData("cke-fillingChar");if(c){if(!1!==b){var d=a.getDocument().getSelection().getNative(),e=d&&"None"!=d.type&&d.getRangeAt(0),g=w.length;if(c.getLength()>g&&e&&e.intersectsNode(c.$)){var f=[{node:d.anchorNode,offset:d.anchorOffset}, +{node:d.focusNode,offset:d.focusOffset}];d.anchorNode==c.$&&d.anchorOffset>g&&(f[0].offset-=g);d.focusNode==c.$&&d.focusOffset>g&&(f[1].offset-=g)}}c.setText(y(c.getText(),1));f&&(c=a.getDocument().$,d=c.getSelection(),c=c.createRange(),c.setStart(f[0].node,f[0].offset),c.collapse(!0),d.removeAllRanges(),d.addRange(c),d.extend(f[1].node,f[1].offset))}}function y(a,b){return b?a.replace(J,function(a,b){return b?" ":""}):a.replace(w,"")}function A(a,b){var c=b&&CKEDITOR.tools.htmlEncode(b)||"\x26nbsp;", c=CKEDITOR.dom.element.createFromHtml('\x3cdiv data-cke-hidden-sel\x3d"1" data-cke-temp\x3d"1" style\x3d"'+(CKEDITOR.env.ie&&14>CKEDITOR.env.version?"display:none":"position:fixed;top:0;left:-1000px;width:0;height:0;overflow:hidden;")+'"\x3e'+c+"\x3c/div\x3e",a.document);a.fire("lockSnapshot");a.editable().append(c);var d=a.getSelection(1),e=a.createRange(),g=d.root.on("selectionchange",function(a){a.cancel()},null,null,0);e.setStartAt(c,CKEDITOR.POSITION_AFTER_START);e.setEndAt(c,CKEDITOR.POSITION_BEFORE_END); -d.selectRanges([e]);g.removeListener();a.fire("unlockSnapshot");a._.hiddenSelectionContainer=c}function E(a){var b={37:1,39:1,8:1,46:1};return function(c){var d=c.data.getKeystroke();if(b[d]){var e=a.getSelection(),g=e.getRanges()[0];e.isCollapsed()&&(g=g[38>d?"getPreviousEditableNode":"getNextEditableNode"]())&&g.type==CKEDITOR.NODE_ELEMENT&&"false"==g.getAttribute("contenteditable")&&(e=e.getStartElement(),!e.isBlockBoundary()||""!==(void 0===e.$.textContent?e.$.innerText:e.$.textContent)||8!== -d&&46!==d||(e.remove(),a.fire("saveSnapshot")),a.getSelection().fake(g),c.data.preventDefault(),c.cancel())}}}function v(a){for(var b=0;b=d.getLength()?h.setStartAfter(d):h.setStartBefore(d));e&&e.type==CKEDITOR.NODE_TEXT&&(f?h.setEndAfter(e):h.setEndBefore(e));d=new CKEDITOR.dom.walker(h);d.evaluator=function(d){if(d.type==CKEDITOR.NODE_ELEMENT&&d.isReadOnly()){var e=c.clone();c.setEndBefore(d);c.collapsed&&a.splice(b--,1);d.getPosition(h.endContainer)&CKEDITOR.POSITION_CONTAINS||(e.setStartAfter(d),e.collapsed||a.splice(b+1,0,e));return!0}return!1};d.next()}}return a}var n= -"function"!=typeof window.getSelection,H=1,u=CKEDITOR.tools.repeat("​",7),I=new RegExp(u+"( )?","g"),J,m,C,K=CKEDITOR.dom.walker.invisible(1),A=function(){function a(b){return function(a){var c=a.editor.createRange();c.moveToClosestEditablePosition(a.selected,b)&&a.editor.getSelection().selectRanges([c]);return!1}}function b(a){return function(b){var c=b.editor,d=c.createRange(),e;if(!c.readOnly)return(e=d.moveToClosestEditablePosition(b.selected,a))||(e=d.moveToClosestEditablePosition(b.selected, -!a)),e&&c.getSelection().selectRanges([d]),c.fire("saveSnapshot"),b.selected.remove(),e||(d.moveToElementEditablePosition(c.editable()),c.getSelection().selectRanges([d])),c.fire("saveSnapshot"),!1}}var c=a(),d=a(1);return{37:c,38:c,39:d,40:d,8:b(),46:b(1)}}();CKEDITOR.on("instanceCreated",function(a){function b(){var a=c.getSelection();a&&a.removeAllRanges()}var c=a.editor;c.on("contentDom",function(){function a(){B=new CKEDITOR.dom.selection(c.getSelection());B.lock()}function b(){h.removeListener("mouseup", -b);r.removeListener("mouseup",b);var a=CKEDITOR.document.$.selection,c=a.createRange();"None"!=a.type&&c.parentElement()&&c.parentElement().ownerDocument==f.$&&c.select()}function d(a){var b,c;b=(b=this.document.getActive())?"input"===b.getName()||"textarea"===b.getName():!1;b||(b=this.getSelection(1),(c=g(b))&&!c.equals(p)&&(b.selectElement(c),a.data.preventDefault()))}function g(a){a=a.getRanges()[0];return a?(a=a.startContainer.getAscendant(function(a){return a.type==CKEDITOR.NODE_ELEMENT&&a.hasAttribute("contenteditable")}, -!0))&&"false"===a.getAttribute("contenteditable")?a:null:null}var f=c.document,h=CKEDITOR.document,p=c.editable(),l=f.getBody(),r=f.getDocumentElement(),q=p.isInline(),m,B;CKEDITOR.env.gecko&&p.attachListener(p,"focus",function(a){a.removeListener();0!==m&&(a=c.getSelection().getNative())&&a.isCollapsed&&a.anchorNode==p.$&&(a=c.createRange(),a.moveToElementEditStart(p),a.select())},null,null,-2);p.attachListener(p,CKEDITOR.env.webkit||CKEDITOR.env.gecko?"focusin":"focus",function(){if(m&&(CKEDITOR.env.webkit|| -CKEDITOR.env.gecko)){m=c._.previousActive&&c._.previousActive.equals(f.getActive());var a=null!=c._.previousScrollTop&&c._.previousScrollTop!=p.$.scrollTop;CKEDITOR.env.webkit&&m&&a&&(p.$.scrollTop=c._.previousScrollTop)}c.unlockSelection(m);m=0},null,null,-1);p.attachListener(p,"mousedown",function(){m=0});if(CKEDITOR.env.ie||CKEDITOR.env.gecko||q)n?p.attachListener(p,"beforedeactivate",a,null,null,-1):p.attachListener(c,"selectionCheck",a,null,null,-1),p.attachListener(p,CKEDITOR.env.webkit||CKEDITOR.env.gecko? -"focusout":"blur",function(){var a=B&&(B.isFake||2>B.getRanges().length);CKEDITOR.env.gecko&&!q&&a||(c.lockSelection(B),m=1)},null,null,-1),p.attachListener(p,"mousedown",function(){m=0});if(CKEDITOR.env.ie&&!q){var x;p.attachListener(p,"mousedown",function(a){2==a.data.$.button&&((a=c.document.getSelection())&&a.getType()!=CKEDITOR.SELECTION_NONE||(x=c.window.getScrollPosition()))});p.attachListener(p,"mouseup",function(a){2==a.data.$.button&&x&&(c.document.$.documentElement.scrollLeft=x.x,c.document.$.documentElement.scrollTop= -x.y);x=null});if("BackCompat"!=f.$.compatMode){if(CKEDITOR.env.ie7Compat||CKEDITOR.env.ie6Compat){var z,u;r.on("mousedown",function(a){function b(a){a=a.data.$;if(z){var c=l.$.createTextRange();try{c.moveToPoint(a.clientX,a.clientY)}catch(d){}z.setEndPoint(0>u.compareEndPoints("StartToStart",c)?"EndToEnd":"StartToStart",c);z.select()}}function c(){r.removeListener("mousemove",b);h.removeListener("mouseup",c);r.removeListener("mouseup",c);z.select()}a=a.data;if(a.getTarget().is("html")&&a.$.yCKEDITOR.env.version)r.on("mousedown",function(a){a.data.getTarget().is("html")&&(h.on("mouseup",b),r.on("mouseup",b))})}}p.attachListener(p,"selectionchange",e,c);p.attachListener(p,"keyup",k,c);p.attachListener(p,"touchstart",k,c);p.attachListener(p,"touchend",k,c);CKEDITOR.env.ie&&p.attachListener(p, -"keydown",d,c);p.attachListener(p,CKEDITOR.env.webkit||CKEDITOR.env.gecko?"focusin":"focus",function(){c.forceNextSelectionCheck();c.selectionChange(1)});if(q&&(CKEDITOR.env.webkit||CKEDITOR.env.gecko)){var v;p.attachListener(p,"mousedown",function(){v=1});p.attachListener(f.getDocumentElement(),"mouseup",function(){v&&k.call(c);v=0})}else p.attachListener(CKEDITOR.env.ie?p:f.getDocumentElement(),"mouseup",k,c);CKEDITOR.env.webkit&&p.attachListener(f,"keydown",function(a){switch(a.data.getKey()){case 13:case 33:case 34:case 35:case 36:case 37:case 39:case 8:case 45:case 46:p.hasFocus&& -y(p)}},null,null,-1);p.attachListener(p,"keydown",E(c),null,null,-1)});c.on("setData",function(){c.unlockSelection();CKEDITOR.env.webkit&&b()});c.on("contentDomUnload",function(){c.unlockSelection()});if(CKEDITOR.env.ie9Compat)c.on("beforeDestroy",b,null,null,9);c.on("dataReady",function(){delete c._.fakeSelection;delete c._.hiddenSelectionContainer;c.selectionChange(1)});c.on("loadSnapshot",function(){var a=CKEDITOR.dom.walker.nodeType(CKEDITOR.NODE_ELEMENT),b=c.editable().getLast(a);b&&b.hasAttribute("data-cke-hidden-sel")&& -(b.remove(),CKEDITOR.env.gecko&&(a=c.editable().getFirst(a))&&a.is("br")&&a.getAttribute("_moz_editor_bogus_node")&&a.remove())},null,null,100);c.on("key",function(a){if("wysiwyg"==c.mode){var b=c.getSelection();if(b.isFake){var d=A[a.data.keyCode];if(d)return d({editor:c,selected:b.getSelectedElement(),selection:b,keyEvent:a})}}})});if(CKEDITOR.env.webkit)CKEDITOR.on("instanceReady",function(a){var b=a.editor;b.on("selectionChange",function(){var a=b.editable(),c=a.getCustomData("cke-fillingChar"); -c&&(c.getCustomData("ready")?(y(a),a.editor.fire("selectionCheck")):c.setCustomData("ready",1))},null,null,-1);b.on("beforeSetMode",function(){y(b.editable())},null,null,-1);b.on("getSnapshot",function(a){a.data&&(a.data=z(a.data))},b,null,20);b.on("toDataFormat",function(a){a.data.dataValue=z(a.data.dataValue)},null,null,0)});CKEDITOR.editor.prototype.selectionChange=function(a){(a?e:k).call(this)};CKEDITOR.editor.prototype.getSelection=function(a){return!this._.savedSelection&&!this._.fakeSelection|| +d.selectRanges([e]);g.removeListener();a.fire("unlockSnapshot");a._.hiddenSelectionContainer=c}function F(b){var c={37:1,39:1,8:1,46:1};return function(d){var e=d.data.getKeystroke();if(c[e]){var g=b.getSelection(),f=g.getRanges()[0];g.isCollapsed()&&(f=f[38>e?"getPreviousEditableNode":"getNextEditableNode"]())&&f.type==CKEDITOR.NODE_ELEMENT&&"false"==f.getAttribute("contenteditable")&&(g=g.getStartElement(),!g.isBlockBoundary()||""!==(void 0===g.$.textContent?g.$.innerText:g.$.textContent)||a(g.getFirst())|| +8!==e&&46!==e||(g.remove(),b.fire("saveSnapshot")),b.getSelection().fake(f),d.data.preventDefault(),d.cancel())}}}function v(a){for(var b=0;b=d.getLength()?h.setStartAfter(d):h.setStartBefore(d));e&&e.type==CKEDITOR.NODE_TEXT&&(f?h.setEndAfter(e):h.setEndBefore(e));d=new CKEDITOR.dom.walker(h);d.evaluator=function(d){if(d.type==CKEDITOR.NODE_ELEMENT&&d.isReadOnly()){var e=c.clone();c.setEndBefore(d);c.collapsed&&a.splice(b--,1);d.getPosition(h.endContainer)&CKEDITOR.POSITION_CONTAINS||(e.setStartAfter(d),e.collapsed||a.splice(b+1,0,e));return!0}return!1};d.next()}}return a}var l= +"function"!=typeof window.getSelection,L=1,w=CKEDITOR.tools.repeat("​",7),J=new RegExp(w+"( )?","g"),G,q,u,K=CKEDITOR.dom.walker.invisible(1),E=function(){function a(b){return function(a){var c=a.editor.createRange();c.moveToClosestEditablePosition(a.selected,b)&&a.editor.getSelection().selectRanges([c]);return!1}}function b(a){return function(b){var c=b.editor,d=c.createRange(),e;if(!c.readOnly)return(e=d.moveToClosestEditablePosition(b.selected,a))||(e=d.moveToClosestEditablePosition(b.selected, +!a)),e&&c.getSelection().selectRanges([d]),c.fire("saveSnapshot"),b.selected.remove(),e||(d.moveToElementEditablePosition(c.editable()),c.getSelection().selectRanges([d])),c.fire("saveSnapshot"),!1}}var c=a(),d=a(1);return{37:c,38:c,39:d,40:d,8:b(),46:b(1)}}();CKEDITOR.on("instanceCreated",function(a){function b(){var a=c.getSelection();a&&a.removeAllRanges()}var c=a.editor;c.on("contentDom",function(){function a(){q=new CKEDITOR.dom.selection(c.getSelection());q.lock()}function b(){h.removeListener("mouseup", +b);m.removeListener("mouseup",b);var a=CKEDITOR.document.$.selection,c=a.createRange();"None"!=a.type&&c.parentElement()&&c.parentElement().ownerDocument==f.$&&c.select()}function d(a){var b,c;b=(b=this.document.getActive())?"input"===b.getName()||"textarea"===b.getName():!1;b||(b=this.getSelection(1),(c=g(b))&&!c.equals(n)&&(b.selectElement(c),a.data.preventDefault()))}function g(a){a=a.getRanges()[0];return a?(a=a.startContainer.getAscendant(function(a){return a.type==CKEDITOR.NODE_ELEMENT&&a.hasAttribute("contenteditable")}, +!0))&&"false"===a.getAttribute("contenteditable")?a:null:null}var f=c.document,h=CKEDITOR.document,n=c.editable(),t=f.getBody(),m=f.getDocumentElement(),B=n.isInline(),p,q;CKEDITOR.env.gecko&&n.attachListener(n,"focus",function(a){a.removeListener();0!==p&&(a=c.getSelection().getNative())&&a.isCollapsed&&a.anchorNode==n.$&&(a=c.createRange(),a.moveToElementEditStart(n),a.select())},null,null,-2);n.attachListener(n,CKEDITOR.env.webkit||CKEDITOR.env.gecko?"focusin":"focus",function(){if(p&&(CKEDITOR.env.webkit|| +CKEDITOR.env.gecko)){p=c._.previousActive&&c._.previousActive.equals(f.getActive());var a=null!=c._.previousScrollTop&&c._.previousScrollTop!=n.$.scrollTop;CKEDITOR.env.webkit&&p&&a&&(n.$.scrollTop=c._.previousScrollTop)}c.unlockSelection(p);p=0},null,null,-1);n.attachListener(n,"mousedown",function(){p=0});if(CKEDITOR.env.ie||CKEDITOR.env.gecko||B)l?n.attachListener(n,"beforedeactivate",a,null,null,-1):n.attachListener(c,"selectionCheck",a,null,null,-1),n.attachListener(n,CKEDITOR.env.webkit||CKEDITOR.env.gecko? +"focusout":"blur",function(){var a=q&&(q.isFake||2>q.getRanges().length);CKEDITOR.env.gecko&&!B&&a||(c.lockSelection(q),p=1)},null,null,-1),n.attachListener(n,"mousedown",function(){p=0});if(CKEDITOR.env.ie&&!B){var v;n.attachListener(n,"mousedown",function(a){2==a.data.$.button&&((a=c.document.getSelection())&&a.getType()!=CKEDITOR.SELECTION_NONE||(v=c.window.getScrollPosition()))});n.attachListener(n,"mouseup",function(a){2==a.data.$.button&&v&&(c.document.$.documentElement.scrollLeft=v.x,c.document.$.documentElement.scrollTop= +v.y);v=null});if("BackCompat"!=f.$.compatMode){if(CKEDITOR.env.ie7Compat||CKEDITOR.env.ie6Compat){var u,w;m.on("mousedown",function(a){function b(a){a=a.data.$;if(u){var c=t.$.createTextRange();try{c.moveToPoint(a.clientX,a.clientY)}catch(d){}u.setEndPoint(0>w.compareEndPoints("StartToStart",c)?"EndToEnd":"StartToStart",c);u.select()}}function c(){m.removeListener("mousemove",b);h.removeListener("mouseup",c);m.removeListener("mouseup",c);u.select()}a=a.data;if(a.getTarget().is("html")&&a.$.yCKEDITOR.env.version)m.on("mousedown",function(a){a.data.getTarget().is("html")&&(h.on("mouseup",b),m.on("mouseup",b))})}}n.attachListener(n,"selectionchange",e,c);n.attachListener(n,"keyup",k,c);n.attachListener(n,"touchstart",k,c);n.attachListener(n,"touchend",k,c);CKEDITOR.env.ie&&n.attachListener(n, +"keydown",d,c);n.attachListener(n,CKEDITOR.env.webkit||CKEDITOR.env.gecko?"focusin":"focus",function(){c.forceNextSelectionCheck();c.selectionChange(1)});if(B&&(CKEDITOR.env.webkit||CKEDITOR.env.gecko)){var y;n.attachListener(n,"mousedown",function(){y=1});n.attachListener(f.getDocumentElement(),"mouseup",function(){y&&k.call(c);y=0})}else n.attachListener(CKEDITOR.env.ie?n:f.getDocumentElement(),"mouseup",k,c);CKEDITOR.env.webkit&&n.attachListener(f,"keydown",function(a){switch(a.data.getKey()){case 13:case 33:case 34:case 35:case 36:case 37:case 39:case 8:case 45:case 46:n.hasFocus&& +x(n)}},null,null,-1);n.attachListener(n,"keydown",F(c),null,null,-1)});c.on("setData",function(){c.unlockSelection();CKEDITOR.env.webkit&&b()});c.on("contentDomUnload",function(){c.unlockSelection()});if(CKEDITOR.env.ie9Compat)c.on("beforeDestroy",b,null,null,9);c.on("dataReady",function(){delete c._.fakeSelection;delete c._.hiddenSelectionContainer;c.selectionChange(1)});c.on("loadSnapshot",function(){var a=CKEDITOR.dom.walker.nodeType(CKEDITOR.NODE_ELEMENT),b=c.editable().getLast(a);b&&b.hasAttribute("data-cke-hidden-sel")&& +(b.remove(),CKEDITOR.env.gecko&&(a=c.editable().getFirst(a))&&a.is("br")&&a.getAttribute("_moz_editor_bogus_node")&&a.remove())},null,null,100);c.on("key",function(a){if("wysiwyg"==c.mode){var b=c.getSelection();if(b.isFake){var d=E[a.data.keyCode];if(d)return d({editor:c,selected:b.getSelectedElement(),selection:b,keyEvent:a})}}})});if(CKEDITOR.env.webkit)CKEDITOR.on("instanceReady",function(a){var b=a.editor;b.on("selectionChange",function(){var a=b.editable(),c=a.getCustomData("cke-fillingChar"); +c&&(c.getCustomData("ready")?(x(a),a.editor.fire("selectionCheck")):c.setCustomData("ready",1))},null,null,-1);b.on("beforeSetMode",function(){x(b.editable())},null,null,-1);b.on("getSnapshot",function(a){a.data&&(a.data=y(a.data))},b,null,20);b.on("toDataFormat",function(a){a.data.dataValue=y(a.data.dataValue)},null,null,0)});CKEDITOR.editor.prototype.selectionChange=function(a){(a?e:k).call(this)};CKEDITOR.editor.prototype.getSelection=function(a){return!this._.savedSelection&&!this._.fakeSelection|| a?(a=this.editable())&&"wysiwyg"==this.mode&&"recreating"!==this.status?new CKEDITOR.dom.selection(a):null:this._.savedSelection||this._.fakeSelection};CKEDITOR.editor.prototype.getSelectedRanges=function(a){var b=this.getSelection();return b&&b.getRanges(a)||[]};CKEDITOR.editor.prototype.lockSelection=function(a){a=a||this.getSelection(1);return a.getType()!=CKEDITOR.SELECTION_NONE?(!a.isLocked&&a.lock(),this._.savedSelection=a,!0):!1};CKEDITOR.editor.prototype.unlockSelection=function(a){var b= this._.savedSelection;return b?(b.unlock(a),delete this._.savedSelection,!0):!1};CKEDITOR.editor.prototype.forceNextSelectionCheck=function(){delete this._.selectionPreviousPath};CKEDITOR.dom.document.prototype.getSelection=function(){return new CKEDITOR.dom.selection(this)};CKEDITOR.dom.range.prototype.select=function(){var a=this.root instanceof CKEDITOR.editable?this.root.editor.getSelection():new CKEDITOR.dom.selection(this.root);a.selectRanges([this]);return a};CKEDITOR.SELECTION_NONE=1;CKEDITOR.SELECTION_TEXT= -2;CKEDITOR.SELECTION_ELEMENT=3;CKEDITOR.dom.selection=function(a){if(a instanceof CKEDITOR.dom.selection){var b=a;a=a.root}var c=a instanceof CKEDITOR.dom.element;this.rev=b?b.rev:H++;this.document=a instanceof CKEDITOR.dom.document?a:a.getDocument();this.root=c?a:this.document.getBody();this.isLocked=0;this._={cache:{}};if(b)return CKEDITOR.tools.extend(this._.cache,b._.cache),this.isFake=b.isFake,this.isLocked=b.isLocked,this;a=this.getNative();var d,e;if(a)if(a.getRangeAt)d=(e=a.rangeCount&&a.getRangeAt(0))&& -new CKEDITOR.dom.node(e.commonAncestorContainer);else{try{e=a.createRange()}catch(g){}d=e&&CKEDITOR.dom.element.get(e.item&&e.item(0)||e.parentElement())}if(!d||d.type!=CKEDITOR.NODE_ELEMENT&&d.type!=CKEDITOR.NODE_TEXT||!this.root.equals(d)&&!this.root.contains(d))this._.cache.type=CKEDITOR.SELECTION_NONE,this._.cache.startElement=null,this._.cache.selectedElement=null,this._.cache.selectedText="",this._.cache.ranges=new CKEDITOR.dom.rangeList;return this};var L={img:1,hr:1,li:1,table:1,tr:1,td:1, -th:1,embed:1,object:1,ol:1,ul:1,a:1,input:1,form:1,select:1,textarea:1,button:1,fieldset:1,thead:1,tfoot:1};CKEDITOR.tools.extend(CKEDITOR.dom.selection,{_removeFillingCharSequenceString:z,_createFillingCharSequenceNode:g,FILLING_CHAR_SEQUENCE:u});CKEDITOR.dom.selection.prototype={getNative:function(){return void 0!==this._.cache.nativeSel?this._.cache.nativeSel:this._.cache.nativeSel=n?this.document.$.selection:this.document.getWindow().$.getSelection()},getType:n?function(){var a=this._.cache;if(a.type)return a.type; +2;CKEDITOR.SELECTION_ELEMENT=3;CKEDITOR.dom.selection=function(a){if(a instanceof CKEDITOR.dom.selection){var b=a;a=a.root}var c=a instanceof CKEDITOR.dom.element;this.rev=b?b.rev:L++;this.document=a instanceof CKEDITOR.dom.document?a:a.getDocument();this.root=c?a:this.document.getBody();this.isLocked=0;this._={cache:{}};if(b)return CKEDITOR.tools.extend(this._.cache,b._.cache),this.isFake=b.isFake,this.isLocked=b.isLocked,this;a=this.getNative();var d,e;if(a)if(a.getRangeAt)d=(e=a.rangeCount&&a.getRangeAt(0))&& +new CKEDITOR.dom.node(e.commonAncestorContainer);else{try{e=a.createRange()}catch(g){}d=e&&CKEDITOR.dom.element.get(e.item&&e.item(0)||e.parentElement())}if(!d||d.type!=CKEDITOR.NODE_ELEMENT&&d.type!=CKEDITOR.NODE_TEXT||!this.root.equals(d)&&!this.root.contains(d))this._.cache.type=CKEDITOR.SELECTION_NONE,this._.cache.startElement=null,this._.cache.selectedElement=null,this._.cache.selectedText="",this._.cache.ranges=new CKEDITOR.dom.rangeList;return this};var C={img:1,hr:1,li:1,table:1,tr:1,td:1, +th:1,embed:1,object:1,ol:1,ul:1,a:1,input:1,form:1,select:1,textarea:1,button:1,fieldset:1,thead:1,tfoot:1};CKEDITOR.tools.extend(CKEDITOR.dom.selection,{_removeFillingCharSequenceString:y,_createFillingCharSequenceNode:g,FILLING_CHAR_SEQUENCE:w});CKEDITOR.dom.selection.prototype={getNative:function(){return void 0!==this._.cache.nativeSel?this._.cache.nativeSel:this._.cache.nativeSel=l?this.document.$.selection:this.document.getWindow().$.getSelection()},getType:l?function(){var a=this._.cache;if(a.type)return a.type; var b=CKEDITOR.SELECTION_NONE;try{var c=this.getNative(),d=c.type;"Text"==d&&(b=CKEDITOR.SELECTION_TEXT);"Control"==d&&(b=CKEDITOR.SELECTION_ELEMENT);c.createRange().parentElement()&&(b=CKEDITOR.SELECTION_TEXT)}catch(e){}return a.type=b}:function(){var a=this._.cache;if(a.type)return a.type;var b=CKEDITOR.SELECTION_TEXT,c=this.getNative();if(!c||!c.rangeCount)b=CKEDITOR.SELECTION_NONE;else if(1==c.rangeCount){var c=c.getRangeAt(0),d=c.startContainer;d==c.endContainer&&1==d.nodeType&&1==c.endOffset- -c.startOffset&&L[d.childNodes[c.startOffset].nodeName.toLowerCase()]&&(b=CKEDITOR.SELECTION_ELEMENT)}return a.type=b},getRanges:function(){var a=n?function(){function a(b){return(new CKEDITOR.dom.node(b)).getIndex()}var b=function(b,c){b=b.duplicate();b.collapse(c);var d=b.parentElement();if(!d.hasChildNodes())return{container:d,offset:0};for(var e=d.children,g,f,h=b.duplicate(),k=0,l=e.length-1,r=-1,q,m;k<=l;)if(r=Math.floor((k+l)/2),g=e[r],h.moveToElementText(g),q=h.compareEndPoints("StartToStart", -b),0q)k=r+1;else return{container:d,offset:a(g)};if(-1==r||r==e.length-1&&0>q){h.moveToElementText(d);h.setEndPoint("StartToStart",b);h=h.text.replace(/(\r\n|\r)/g,"\n").length;e=d.childNodes;if(!h)return g=e[e.length-1],g.nodeType!=CKEDITOR.NODE_TEXT?{container:d,offset:e.length}:{container:g,offset:g.nodeValue.length};for(d=e.length;0l)k=t+1;else return{container:d,offset:a(g)};if(-1==t||t==e.length-1&&0>l){h.moveToElementText(d);h.setEndPoint("StartToStart",b);h=h.text.replace(/(\r\n|\r)/g,"\n").length;e=d.childNodes;if(!h)return g=e[e.length-1],g.nodeType!=CKEDITOR.NODE_TEXT?{container:d,offset:e.length}:{container:g,offset:g.nodeValue.length};for(d=e.length;0c.length?this.selectElement(b):this.selectRanges(c))}},reset:function(){this._.cache={};this.isFake=0;var a=this.root.editor;if(a&&a._.fakeSelection)if(this.rev== -a._.fakeSelection.rev){delete a._.fakeSelection;var b=a._.hiddenSelectionContainer;if(b){var c=a.checkDirty();a.fire("lockSnapshot");b.remove();a.fire("unlockSnapshot");!c&&a.resetDirty()}delete a._.hiddenSelectionContainer}else CKEDITOR.warn("selection-fake-reset");this.rev=H++},selectElement:function(a){var b=new CKEDITOR.dom.range(this.root);b.setStartBefore(a);b.setEndAfter(a);this.selectRanges([b])},selectRanges:function(a){var b=this.root.editor,c=b&&b._.hiddenSelectionContainer;this.reset(); -if(c)for(var c=this.root,e,h=0;h]*>)[ \t\r\n]*/gi,"$1");f=f.replace(/([ \t\n\r]+| )/g," ");f=f.replace(/]*>/gi,"\n");if(CKEDITOR.env.ie){var h=a.getDocument().createElement("div");h.append(e);e.$.outerHTML="\x3cpre\x3e"+f+"\x3c/pre\x3e";e.copyAttributes(h.getFirst());e=h.getFirst().remove()}else e.setHtml(f);b=e}else f?b=z(c?[a.getHtml()]:g(a),b):a.moveChildren(b);b.replace(a);if(d){var c=b,k;(k=c.getPrevious(w))&& -k.type==CKEDITOR.NODE_ELEMENT&&k.is("pre")&&(d=y(k.getHtml(),/\n$/,"")+"\n\n"+y(c.getHtml(),/^\n/,""),CKEDITOR.env.ie?c.$.outerHTML="\x3cpre\x3e"+d+"\x3c/pre\x3e":c.setHtml(d),k.remove())}else c&&n(b)}function g(a){var b=[];y(a.getOuterHtml(),/(\S\s*)\n(?:\s|(]+data-cke-bookmark.*?\/span>))*\n(?!$)/gi,function(a,b,c){return b+"\x3c/pre\x3e"+c+"\x3cpre\x3e"}).replace(/([\s\S]*?)<\/pre>/gi,function(a,c){b.push(c)});return b}function y(a,b,c){var d="",e="";a=a.replace(/(^]+data-cke-bookmark.*?\/span>)|(]+data-cke-bookmark.*?\/span>$)/gi, -function(a,b,c){b&&(d=b);c&&(e=c);return""});return d+a.replace(b,c)+e}function z(a,b){var c;1]*>)[ \t\r\n]*/gi,"$1");f=f.replace(/([ \t\n\r]+| )/g," ");f=f.replace(/]*>/gi,"\n");if(CKEDITOR.env.ie){var h=a.getDocument().createElement("div");h.append(e);e.$.outerHTML="\x3cpre\x3e"+f+"\x3c/pre\x3e";e.copyAttributes(h.getFirst());e=h.getFirst().remove()}else e.setHtml(f);b=e}else f?b=y(c?[a.getHtml()]:g(a),b):a.moveChildren(b);b.replace(a);if(d){var c=b,k;(k=c.getPrevious(H))&& +k.type==CKEDITOR.NODE_ELEMENT&&k.is("pre")&&(d=x(k.getHtml(),/\n$/,"")+"\n\n"+x(c.getHtml(),/^\n/,""),CKEDITOR.env.ie?c.$.outerHTML="\x3cpre\x3e"+d+"\x3c/pre\x3e":c.setHtml(d),k.remove())}else c&&l(b)}function g(a){var b=[];x(a.getOuterHtml(),/(\S\s*)\n(?:\s|(]+data-cke-bookmark.*?\/span>))*\n(?!$)/gi,function(a,b,c){return b+"\x3c/pre\x3e"+c+"\x3cpre\x3e"}).replace(/([\s\S]*?)<\/pre>/gi,function(a,c){b.push(c)});return b}function x(a,b,c){var d="",e="";a=a.replace(/(^]+data-cke-bookmark.*?\/span>)|(]+data-cke-bookmark.*?\/span>$)/gi, +function(a,b,c){b&&(d=b);c&&(e=c);return""});return d+a.replace(b,c)+e}function y(a,b){var c;1c.length||4c.length||4c.length||4c.length||4=c?(e=f.createText(""),e.insertAfter(this)):(a=f.createText(""),a.insertAfter(e),a.remove()));return e},substring:function(a,d){return"number"!=typeof d?this.$.nodeValue.substr(a):this.$.nodeValue.substring(a,d)}}); -(function(){function a(a,c,d){var e=a.serializable,k=c[d?"endContainer":"startContainer"],h=d?"endOffset":"startOffset",l=e?c.document.getById(a.startNode):a.startNode;a=e?c.document.getById(a.endNode):a.endNode;k.equals(l.getPrevious())?(c.startOffset=c.startOffset-k.getLength()-a.getPrevious().getLength(),k=a.getNext()):k.equals(a.getPrevious())&&(c.startOffset-=k.getLength(),k=a.getNext());k.equals(l.getParent())&&c[h]++;k.equals(a.getParent())&&c[h]++;c[d?"endContainer":"startContainer"]=k;return c} -CKEDITOR.dom.rangeList=function(a){if(a instanceof CKEDITOR.dom.rangeList)return a;a?a instanceof CKEDITOR.dom.range&&(a=[a]):a=[];return CKEDITOR.tools.extend(a,d)};var d={createIterator:function(){var a=this,c=CKEDITOR.dom.walker.bookmark(),d=[],e;return{getNextRange:function(k){e=void 0===e?0:e+1;var h=a[e];if(h&&1b?-1:1}),e=0,f;eCKEDITOR.env.version? a[h].$.styleSheet.cssText+=f:a[h].$.innerHTML+=f}}var e={};CKEDITOR.skin={path:a,loadPart:function(c,d){CKEDITOR.skin.name!=CKEDITOR.skinName.split(",")[0]?CKEDITOR.scriptLoader.load(CKEDITOR.getUrl(a()+"skin.js"),function(){b(c,d)}):b(c,d)},getPath:function(a){return CKEDITOR.getUrl(d(a))},icons:{},addIcon:function(a,b,c,d){a=a.toLowerCase();this.icons[a]||(this.icons[a]={path:b,offset:c||0,bgsize:d||"16px"})},getIconStyle:function(a,b,c,d,e){var f;a&&(a=a.toLowerCase(),b&&(f=this.icons[a+"-rtl"]), f||(f=this.icons[a]));a=c||f&&f.path||"";d=d||f&&f.offset;e=e||f&&f.bgsize||"16px";a&&(a=a.replace(/'/g,"\\'"));return a&&"background-image:url('"+CKEDITOR.getUrl(a)+"');background-position:0 "+d+"px;background-size:"+e+";"}};CKEDITOR.tools.extend(CKEDITOR.editor.prototype,{getUiColor:function(){return this.uiColor},setUiColor:function(a){var b=c(CKEDITOR.document);return(this.setUiColor=function(a){this.uiColor=a;var c=CKEDITOR.skin.chameleon,d="",e="";"function"==typeof c&&(d=c(this,"editor"),e= -c(this,"panel"));a=[[l,a]];f([b],d,a);f(h,e,a)}).call(this,a)}});var k="cke_ui_color",h=[],l=/\$color/g;CKEDITOR.on("instanceLoaded",function(a){if(!CKEDITOR.env.ie||!CKEDITOR.env.quirks){var b=a.editor;a=function(a){a=(a.data[0]||a.data).element.getElementsByTag("iframe").getItem(0).getFrameDocument();if(!a.getById("cke_ui_color")){var d=c(a);h.push(d);b.on("destroy",function(){h=CKEDITOR.tools.array.filter(h,function(a){return d!==a})});(a=b.getUiColor())&&f([d],CKEDITOR.skin.chameleon(b,"panel"), -[[l,a]])}};b.on("panelShow",a);b.on("menuShow",a);b.config.uiColor&&b.setUiColor(b.config.uiColor)}})})(); +c(this,"panel"));a=[[p,a]];f([b],d,a);f(h,e,a)}).call(this,a)}});var k="cke_ui_color",h=[],p=/\$color/g;CKEDITOR.on("instanceLoaded",function(a){if(!CKEDITOR.env.ie||!CKEDITOR.env.quirks){var b=a.editor;a=function(a){a=(a.data[0]||a.data).element.getElementsByTag("iframe").getItem(0).getFrameDocument();if(!a.getById("cke_ui_color")){var d=c(a);h.push(d);b.on("destroy",function(){h=CKEDITOR.tools.array.filter(h,function(a){return d!==a})});(a=b.getUiColor())&&f([d],CKEDITOR.skin.chameleon(b,"panel"), +[[p,a]])}};b.on("panelShow",a);b.on("menuShow",a);b.config.uiColor&&b.setUiColor(b.config.uiColor)}})})(); (function(){var a=CKEDITOR.dom.element.createFromHtml('\x3cdiv style\x3d"width:0;height:0;position:absolute;left:-10000px;border:1px solid;border-color:red blue"\x3e\x3c/div\x3e',CKEDITOR.document);a.appendTo(CKEDITOR.document.getHead());try{var d=a.getComputedStyle("border-top-color"),b=a.getComputedStyle("border-right-color");CKEDITOR.env.hc=!(!d||d!=b)}catch(c){CKEDITOR.env.hc=!1}a.remove();CKEDITOR.env.hc&&(CKEDITOR.env.cssClass+=" cke_hc");CKEDITOR.document.appendStyleText(".cke{visibility:hidden;}"); CKEDITOR.status="loaded";CKEDITOR.fireOnce("loaded");if(a=CKEDITOR._.pending)for(delete CKEDITOR._.pending,d=0;dk.width-c.width-g?k.width-c.width+("rtl"==f.lang.dir?0:h[1]):d.x;c=d.y+h[0]k.height-c.height-g?k.height-c.height+h[2]:d.y;q=Math.floor(q);c=Math.floor(c);a.move(q,c,1);b.data.preventDefault()}function c(){CKEDITOR.document.removeListener("mousemove",b);CKEDITOR.document.removeListener("mouseup",c);if(CKEDITOR.env.ie6Compat){var a=u.getChild(0).getFrameDocument();a.removeListener("mousemove",b);a.removeListener("mouseup", -c)}}var e=null,d=null,f=a.getParentEditor(),g=f.config.dialog_magnetDistance,h=CKEDITOR.skin.margins||[0,0,0,0];"undefined"==typeof g&&(g=20);a.parts.title.on("mousedown",function(g){if(!a._.moved){var f=a._.element;f.getFirst().setStyle("position","absolute");f.removeStyle("display");a._.moved=!0;a.layout()}e={x:g.data.$.screenX,y:g.data.$.screenY};CKEDITOR.document.on("mousemove",b);CKEDITOR.document.on("mouseup",c);d=a.getPosition();CKEDITOR.env.ie6Compat&&(f=u.getChild(0).getFrameDocument(),f.on("mousemove", -b),f.on("mouseup",c));g.data.preventDefault()},a)}function da(a){function b(b){var c="rtl"==f.lang.dir,q=k.width,l=k.height,w=q+(b.data.$.screenX-m.x)*(c?-1:1)*(a._.moved?1:2),A=l+(b.data.$.screenY-m.y)*(a._.moved?1:2),C=a._.element.getFirst(),C=c&&parseInt(C.getComputedStyle("right"),10),v=a.getPosition();v.x=v.x||0;v.y=v.y||0;v.y+A>p.height&&(A=p.height-v.y);(c?C:v.x)+w>p.width&&(w=p.width-(c?C:v.x));A=Math.floor(A);w=Math.floor(w);if(d==CKEDITOR.DIALOG_RESIZE_WIDTH||d==CKEDITOR.DIALOG_RESIZE_BOTH)q= -Math.max(e.minWidth||0,w-g);if(d==CKEDITOR.DIALOG_RESIZE_HEIGHT||d==CKEDITOR.DIALOG_RESIZE_BOTH)l=Math.max(e.minHeight||0,A-h);a.resize(q,l);a._.moved&&O(a,a._.position.x,a._.position.y);a._.moved||a.layout();b.data.preventDefault()}function c(){CKEDITOR.document.removeListener("mouseup",c);CKEDITOR.document.removeListener("mousemove",b);q&&(q.remove(),q=null);if(CKEDITOR.env.ie6Compat){var a=u.getChild(0).getFrameDocument();a.removeListener("mouseup",c);a.removeListener("mousemove",b)}}var e=a.definition, -d=e.resizable;if(d!=CKEDITOR.DIALOG_RESIZE_NONE){var f=a.getParentEditor(),g,h,p,m,k,q,l=CKEDITOR.tools.addFunction(function(d){function e(a){return a.isVisible()}k=a.getSize();var f=a.parts.contents,l=f.$.getElementsByTagName("iframe").length,w=!(CKEDITOR.env.gecko||CKEDITOR.env.ie&&CKEDITOR.env.quirks);l&&(q=CKEDITOR.dom.element.createFromHtml('\x3cdiv class\x3d"cke_dialog_resize_cover" style\x3d"height: 100%; position: absolute; width: 100%; left:0; top:0;"\x3e\x3c/div\x3e'),f.append(q));h=k.height- -a.parts.contents.getFirst(e).getSize("height",w);g=k.width-a.parts.contents.getFirst(e).getSize("width",1);m={x:d.screenX,y:d.screenY};p=CKEDITOR.document.getWindow().getViewPaneSize();CKEDITOR.document.on("mousemove",b);CKEDITOR.document.on("mouseup",c);CKEDITOR.env.ie6Compat&&(f=u.getChild(0).getFrameDocument(),f.on("mousemove",b),f.on("mouseup",c));d.preventDefault&&d.preventDefault()});a.on("load",function(){var b="";d==CKEDITOR.DIALOG_RESIZE_WIDTH?b=" cke_resizer_horizontal":d==CKEDITOR.DIALOG_RESIZE_HEIGHT&& -(b=" cke_resizer_vertical");b=CKEDITOR.dom.element.createFromHtml('\x3cdiv class\x3d"cke_resizer'+b+" cke_resizer_"+f.lang.dir+'" title\x3d"'+CKEDITOR.tools.htmlEncode(f.lang.common.resize)+'" onmousedown\x3d"CKEDITOR.tools.callFunction('+l+', event )"\x3e'+("ltr"==f.lang.dir?"◢":"◣")+"\x3c/div\x3e");a.parts.footer.append(b,1)});f.on("destroy",function(){CKEDITOR.tools.removeFunction(l)})}}function O(a,b,c){var e=a.parts.dialog.getParent().getClientSize(),d=a.getSize(),f=a._.viewportRatio,g=Math.max(e.width- +b.on("blur",function(){this.fire("mouseout")})}function ba(a){function b(){a.layout()}var c=CKEDITOR.document.getWindow();c.on("resize",b);a.on("hide",function(){c.removeListener("resize",b)})}function M(a,b){this.dialog=a;for(var c=b.contents,e=0,d;d=c[e];e++)c[e]=d&&new N(a,d);CKEDITOR.tools.extend(this,b)}function N(a,b){this._={dialog:a};CKEDITOR.tools.extend(this,b)}function ca(a){function b(b){var c=a.getSize(),h=a.parts.dialog.getParent().getClientSize(),q=b.data.$.screenX,m=b.data.$.screenY, +r=q-e.x,n=m-e.y;e={x:q,y:m};d.x+=r;d.y+=n;q=d.x+k[3]h.width-c.width-g?h.width-c.width+("rtl"==f.lang.dir?0:k[1]):d.x;c=d.y+k[0]h.height-c.height-g?h.height-c.height+k[2]:d.y;q=Math.floor(q);c=Math.floor(c);a.move(q,c,1);b.data.preventDefault()}function c(){CKEDITOR.document.removeListener("mousemove",b);CKEDITOR.document.removeListener("mouseup",c);if(CKEDITOR.env.ie6Compat){var a=u.getChild(0).getFrameDocument();a.removeListener("mousemove",b);a.removeListener("mouseup", +c)}}var e=null,d=null,f=a.getParentEditor(),g=f.config.dialog_magnetDistance,k=CKEDITOR.skin.margins||[0,0,0,0];"undefined"==typeof g&&(g=20);a.parts.title.on("mousedown",function(f){if(!a._.moved){var g=a._.element;g.getFirst().setStyle("position","absolute");g.removeStyle("display");a._.moved=!0;a.layout()}e={x:f.data.$.screenX,y:f.data.$.screenY};CKEDITOR.document.on("mousemove",b);CKEDITOR.document.on("mouseup",c);d=a.getPosition();CKEDITOR.env.ie6Compat&&(g=u.getChild(0).getFrameDocument(),g.on("mousemove", +b),g.on("mouseup",c));f.data.preventDefault()},a)}function da(a){function b(b){var c="rtl"==f.lang.dir,m=h.width,q=h.height,w=m+(b.data.$.screenX-l.x)*(c?-1:1)*(a._.moved?1:2),A=q+(b.data.$.screenY-l.y)*(a._.moved?1:2),C=a._.element.getFirst(),C=c&&parseInt(C.getComputedStyle("right"),10),v=a.getPosition();v.x=v.x||0;v.y=v.y||0;v.y+A>p.height&&(A=p.height-v.y);(c?C:v.x)+w>p.width&&(w=p.width-(c?C:v.x));A=Math.floor(A);w=Math.floor(w);if(d==CKEDITOR.DIALOG_RESIZE_WIDTH||d==CKEDITOR.DIALOG_RESIZE_BOTH)m= +Math.max(e.minWidth||0,w-g);if(d==CKEDITOR.DIALOG_RESIZE_HEIGHT||d==CKEDITOR.DIALOG_RESIZE_BOTH)q=Math.max(e.minHeight||0,A-k);a.resize(m,q);a._.moved&&O(a,a._.position.x,a._.position.y);a._.moved||a.layout();b.data.preventDefault()}function c(){CKEDITOR.document.removeListener("mouseup",c);CKEDITOR.document.removeListener("mousemove",b);q&&(q.remove(),q=null);if(CKEDITOR.env.ie6Compat){var a=u.getChild(0).getFrameDocument();a.removeListener("mouseup",c);a.removeListener("mousemove",b)}}var e=a.definition, +d=e.resizable;if(d!=CKEDITOR.DIALOG_RESIZE_NONE){var f=a.getParentEditor(),g,k,p,l,h,q,m=CKEDITOR.tools.addFunction(function(d){function e(a){return a.isVisible()}h=a.getSize();var f=a.parts.contents,m=f.$.getElementsByTagName("iframe").length,w=!(CKEDITOR.env.gecko||CKEDITOR.env.ie&&CKEDITOR.env.quirks);m&&(q=CKEDITOR.dom.element.createFromHtml('\x3cdiv class\x3d"cke_dialog_resize_cover" style\x3d"height: 100%; position: absolute; width: 100%; left:0; top:0;"\x3e\x3c/div\x3e'),f.append(q));k=h.height- +a.parts.contents.getFirst(e).getSize("height",w);g=h.width-a.parts.contents.getFirst(e).getSize("width",1);l={x:d.screenX,y:d.screenY};p=CKEDITOR.document.getWindow().getViewPaneSize();CKEDITOR.document.on("mousemove",b);CKEDITOR.document.on("mouseup",c);CKEDITOR.env.ie6Compat&&(f=u.getChild(0).getFrameDocument(),f.on("mousemove",b),f.on("mouseup",c));d.preventDefault&&d.preventDefault()});a.on("load",function(){var b="";d==CKEDITOR.DIALOG_RESIZE_WIDTH?b=" cke_resizer_horizontal":d==CKEDITOR.DIALOG_RESIZE_HEIGHT&& +(b=" cke_resizer_vertical");b=CKEDITOR.dom.element.createFromHtml('\x3cdiv class\x3d"cke_resizer'+b+" cke_resizer_"+f.lang.dir+'" title\x3d"'+CKEDITOR.tools.htmlEncode(f.lang.common.resize)+'" onmousedown\x3d"CKEDITOR.tools.callFunction('+m+', event )"\x3e'+("ltr"==f.lang.dir?"◢":"◣")+"\x3c/div\x3e");a.parts.footer.append(b,1)});f.on("destroy",function(){CKEDITOR.tools.removeFunction(m)})}}function O(a,b,c){var e=a.parts.dialog.getParent().getClientSize(),d=a.getSize(),f=a._.viewportRatio,g=Math.max(e.width- d.width,0),e=Math.max(e.height-d.height,0);f.width=g?b/g:f.width;f.height=e?c/e:f.height;a._.viewportRatio=f}function H(a){a.data.preventDefault(1)}function P(a){var b=a.config,c=CKEDITOR.skinName||a.config.skin,e=b.dialog_backgroundCoverColor||("moono-lisa"==c?"black":"white"),c=b.dialog_backgroundCoverOpacity,d=b.baseFloatZIndex,b=CKEDITOR.tools.genKey(e,c,d),f=B[b];CKEDITOR.document.getBody().addClass("cke_dialog_open");f?f.show():(d=['\x3cdiv tabIndex\x3d"-1" style\x3d"position: ',CKEDITOR.env.ie6Compat? "absolute":"fixed","; z-index: ",d,"; top: 0px; left: 0px; ","; width: 100%; height: 100%;",CKEDITOR.env.ie6Compat?"":"background-color: "+e,'" class\x3d"cke_dialog_background_cover"\x3e'],CKEDITOR.env.ie6Compat&&(e="\x3chtml\x3e\x3cbody style\x3d\\'background-color:"+e+";\\'\x3e\x3c/body\x3e\x3c/html\x3e",d.push('\x3ciframe hidefocus\x3d"true" frameborder\x3d"0" id\x3d"cke_dialog_background_iframe" src\x3d"javascript:'),d.push("void((function(){"+encodeURIComponent("document.open();("+CKEDITOR.tools.fixDomain+ ")();document.write( '"+e+"' );document.close();")+"})())"),d.push('" style\x3d"position:absolute;left:0;top:0;width:100%;height: 100%;filter: progid:DXImageTransform.Microsoft.Alpha(opacity\x3d0)"\x3e\x3c/iframe\x3e')),d.push("\x3c/div\x3e"),f=CKEDITOR.dom.element.createFromHtml(d.join("")),f.setOpacity(void 0!==c?c:.5),f.on("keydown",H),f.on("keypress",H),f.on("keyup",H),f.appendTo(CKEDITOR.document.getBody()),B[b]=f);a.focusManager.add(f);u=f;CKEDITOR.env.mac&&CKEDITOR.env.webkit||f.focus()}function Q(a){CKEDITOR.document.getBody().removeClass("cke_dialog_open"); u&&(a.focusManager.remove(u),u.hide())}function R(a){var b=a.data.$.ctrlKey||a.data.$.metaKey,c=a.data.$.altKey,e=a.data.$.shiftKey,d=String.fromCharCode(a.data.$.keyCode);(b=x[(b?"CTRL+":"")+(c?"ALT+":"")+(e?"SHIFT+":"")+d])&&b.length&&(b=b[b.length-1],b.keydown&&b.keydown.call(b.uiElement,b.dialog,b.key),a.data.preventDefault())}function S(a){var b=a.data.$.ctrlKey||a.data.$.metaKey,c=a.data.$.altKey,e=a.data.$.shiftKey,d=String.fromCharCode(a.data.$.keyCode);(b=x[(b?"CTRL+":"")+(c?"ALT+":"")+(e? "SHIFT+":"")+d])&&b.length&&(b=b[b.length-1],b.keyup&&(b.keyup.call(b.uiElement,b.dialog,b.key),a.data.preventDefault()))}function T(a,b,c,e,d){(x[c]||(x[c]=[])).push({uiElement:a,dialog:b,key:c,keyup:d||a.accessKeyUp,keydown:e||a.accessKeyDown})}function ea(a){for(var b in x){for(var c=x[b],e=c.length-1;0<=e;e--)c[e].dialog!=a&&c[e].uiElement!=a||c.splice(e,1);0===c.length&&delete x[b]}}function fa(a,b){a._.accessKeyMap[b]&&a.selectPage(a._.accessKeyMap[b])}function ga(){}var y=CKEDITOR.tools.cssLength, U,u,V=!1,D=!CKEDITOR.env.ie||CKEDITOR.env.edge,aa='\x3cdiv class\x3d"cke_reset_all cke_dialog_container {editorId} {editorDialogClass} {hidpi}" dir\x3d"{langDir}" style\x3d"'+(D?"display:flex":"")+'" lang\x3d"{langCode}" role\x3d"dialog" aria-labelledby\x3d"cke_dialog_title_{id}"\x3e\x3ctable class\x3d"cke_dialog '+CKEDITOR.env.cssClass+' cke_{langDir}" style\x3d"'+(D?"margin:auto":"position:absolute")+'" role\x3d"presentation"\x3e\x3ctr\x3e\x3ctd role\x3d"presentation"\x3e\x3cdiv class\x3d"cke_dialog_body" role\x3d"presentation"\x3e\x3cdiv id\x3d"cke_dialog_title_{id}" class\x3d"cke_dialog_title" role\x3d"presentation"\x3e\x3c/div\x3e\x3ca id\x3d"cke_dialog_close_button_{id}" class\x3d"cke_dialog_close_button" href\x3d"javascript:void(0)" title\x3d"{closeTitle}" role\x3d"button"\x3e\x3cspan class\x3d"cke_label"\x3eX\x3c/span\x3e\x3c/a\x3e\x3cdiv id\x3d"cke_dialog_tabs_{id}" class\x3d"cke_dialog_tabs" role\x3d"tablist"\x3e\x3c/div\x3e\x3ctable class\x3d"cke_dialog_contents" role\x3d"presentation"\x3e\x3ctr\x3e\x3ctd id\x3d"cke_dialog_contents_{id}" class\x3d"cke_dialog_contents_body" role\x3d"presentation"\x3e\x3c/td\x3e\x3c/tr\x3e\x3ctr\x3e\x3ctd id\x3d"cke_dialog_footer_{id}" class\x3d"cke_dialog_footer" role\x3d"presentation"\x3e\x3c/td\x3e\x3c/tr\x3e\x3c/table\x3e\x3c/div\x3e\x3c/td\x3e\x3c/tr\x3e\x3c/table\x3e\x3c/div\x3e'; -CKEDITOR.dialog=function(a,b){function c(){var a=n._.focusList;a.sort(function(a,b){return a.tabIndex!=b.tabIndex?b.tabIndex-a.tabIndex:a.focusIndex-b.focusIndex});for(var b=a.length,c=0;cb.length)){var c=n._.currentFocusIndex;n._.tabBarMode&&0>a&&(c=0);try{b[c].getInputElement().$.blur()}catch(d){}var e=c,g=1b.length)){var c=n._.currentFocusIndex;n._.tabBarMode&&0>a&&(c=0);try{b[c].getInputElement().$.blur()}catch(d){}var e=c,f=1arguments.length)){var h=(e.call?e(b):e)||"div",p=["\x3c",h," "],m=(d&&d.call?d(b):d)||{},k=(f&&f.call?f(b):f)||{},q=(g&&g.call?g.call(this,a,b):g)||"",l=this.domId=k.id||CKEDITOR.tools.getNextId()+"_uiElement";b.requiredContent&&!a.getParentEditor().filter.check(b.requiredContent)&&(m.display="none",this.notAllowed= -!0);k.id=l;var r={};b.type&&(r["cke_dialog_ui_"+b.type]=1);b.className&&(r[b.className]=1);b.disabled&&(r.cke_disabled=1);for(var n=k["class"]&&k["class"].split?k["class"].split(" "):[],l=0;larguments.length)){var k=(e.call?e(b):e)||"div",p=["\x3c",k," "],l=(d&&d.call?d(b):d)||{},h=(f&&f.call?f(b):f)||{},q=(g&&g.call?g.call(this,a,b):g)||"",m=this.domId=h.id||CKEDITOR.tools.getNextId()+"_uiElement";b.requiredContent&&!a.getParentEditor().filter.check(b.requiredContent)&&(l.display="none",this.notAllowed= +!0);h.id=m;var r={};b.type&&(r["cke_dialog_ui_"+b.type]=1);b.className&&(r[b.className]=1);b.disabled&&(r.cke_disabled=1);for(var n=h["class"]&&h["class"].split?h["class"].split(" "):[],m=0;mCKEDITOR.env.version?"cke_dialog_ui_focused":"";b.on("focus", -function(){a._.tabBarMode=!1;a._.hasFocus=!0;t.fire("focus");c&&this.addClass(c)});b.on("blur",function(){t.fire("blur");c&&this.removeClass(c)})}});CKEDITOR.tools.extend(this,b);this.keyboardFocusable&&(this.tabIndex=b.tabIndex||0,this.focusIndex=a._.focusList.push(this)-1,this.on("focus",function(){a._.currentFocusIndex=t.focusIndex}))}},hbox:function(a,b,c,e,d){if(!(4>arguments.length)){this._||(this._={});var f=this._.children=b,g=d&&d.widths||null,h=d&&d.height||null,p,m={role:"presentation"}; -d&&d.align&&(m.align=d.align);CKEDITOR.ui.dialog.uiElement.call(this,a,d||{type:"hbox"},e,"table",{},m,function(){var a=['\x3ctbody\x3e\x3ctr class\x3d"cke_dialog_ui_hbox"\x3e'];for(p=0;parguments.length)){this._||(this._={});var f=this._.children=b,g=d&&d.width||null,h=d&&d.heights||null;CKEDITOR.ui.dialog.uiElement.call(this,a,d||{type:"vbox"},e,"div",null,{role:"presentation"},function(){var b= -['\x3ctable role\x3d"presentation" cellspacing\x3d"0" border\x3d"0" '];b.push('style\x3d"');d&&d.expand&&b.push("height:100%;");b.push("width:"+y(g||"100%"),";");CKEDITOR.env.webkit&&b.push("float:none;");b.push('"');b.push('align\x3d"',CKEDITOR.tools.htmlEncode(d&&d.align||("ltr"==a.getParentEditor().lang.dir?"left":"right")),'" ');b.push("\x3e\x3ctbody\x3e");for(var e=0;earguments.length)){this._||(this._={});var f=this._.children=b,g=d&&d.widths||null,k=d&&d.height||null,p,l={role:"presentation"}; +d&&d.align&&(l.align=d.align);CKEDITOR.ui.dialog.uiElement.call(this,a,d||{type:"hbox"},e,"table",{},l,function(){var a=['\x3ctbody\x3e\x3ctr class\x3d"cke_dialog_ui_hbox"\x3e'];for(p=0;parguments.length)){this._||(this._={});var f=this._.children=b,g=d&&d.width||null,k=d&&d.heights||null;CKEDITOR.ui.dialog.uiElement.call(this,a,d||{type:"vbox"},e,"div",null,{role:"presentation"},function(){var b= +['\x3ctable role\x3d"presentation" cellspacing\x3d"0" border\x3d"0" '];b.push('style\x3d"');d&&d.expand&&b.push("height:100%;");b.push("width:"+y(g||"100%"),";");CKEDITOR.env.webkit&&b.push("float:none;");b.push('"');b.push('align\x3d"',CKEDITOR.tools.htmlEncode(d&&d.align||("ltr"==a.getParentEditor().lang.dir?"left":"right")),'" ');b.push("\x3e\x3ctbody\x3e");for(var e=0;earguments.length)return this._.children.concat();a.splice||(a=[a]);return 2>a.length?this._.children[a[0]]:this._.children[a[0]]&&this._.children[a[0]].getChild?this._.children[a[0]].getChild(a.slice(1,a.length)):null}},!0);CKEDITOR.ui.dialog.vbox.prototype=new CKEDITOR.ui.dialog.hbox;(function(){var a={build:function(a, -c,e){for(var d=c.children,f,g=[],h=[],p=0;pe.length&&(a=g.document.createElement(g.config.enterMode==CKEDITOR.ENTER_P?"p":"div"),b=h.shift(),c.insertNode(a),a.append(new CKEDITOR.dom.text("",g.document)),c.moveToBookmark(b),c.selectNodeContents(a),c.collapse(!0),b=c.createBookmark(),e.push(a),h.unshift(b));d=e[0].getParent();c=[];for(b=0;b=c.mode.indexOf("bbcode")&&(c.mode="bbcode");var r="function"===typeof require&&"function"===typeof require.config,t;if(r){var q=c.requireContext||"_",l=CKEDITOR.getUrl("plugins/codemirror/js/"),l=l.substring(0,l.length-1);t=require.config({context:q,packages:[{name:"codemirror",location:l,main:"codemirror.min.js"},{name:"codemirror-mode-handlebars",location:l,main:"codemirror.mode.handlebars.min.js"},{name:"codemirror-mode-twig", -location:l,main:"codemirror.mode.twig.min.js"},{name:"codemirror-mode-html",location:l,main:"codemirror.mode.htmlmixed.min.js"},{name:"codemirror-mode-php",location:l,main:"codemirror.mode.php.min.js"},{name:"codemirror-mode-js",location:l,main:"codemirror.mode.js.min.js"},{name:"codemirror-addons",location:l,main:"codemirror.addons.min.js"},{name:"codemirror-addon-search",location:l,main:"codemirror.addons.search.min.js"},{name:"codemirror-beautify",location:l,main:"beautify.min.js"}],bundles:{codemirror:["core", -"codemirror.js"],"codemirror-mode-handlebars":["modeHandlebars"],"codemirror-mode-twig":["modeTwig"],"codemirror-mode-html":["modeHtml"],"codemirror-mode-php":["modePHP"],"codemirror-mode-js":["modeJS"],"codemirror-addons":["addons"],"codemirror-addon-search":["addonSearch"],"codemirror-beautify":["beautifyModule"]},map:{"*":{"lib/codemirror":"codemirror.js"}}})}(b.elementMode===CKEDITOR.ELEMENT_MODE_INLINE||b.plugins.sourcedialog)&&CKEDITOR.dialog.add("sourcedialog",function(a){function b(a,d,e){var g= -e.getSize();e=g.width;g=g.height/1.5;window["codemirror_"+a.id]=CodeMirror.fromTextArea(d,{direction:a.lang.dir,mode:"handlebars"===c.mode?{name:"handlebars",base:"text/html"}:c.mode,matchBrackets:c.matchBrackets,maxHighlightLineLength:c.maxHighlightLineLength,matchTags:c.matchTags,workDelay:300,workTime:35,readOnly:a.readOnly,lineNumbers:c.lineNumbers,lineWrapping:c.lineWrapping,autoCloseTags:c.autoCloseTags,autoCloseBrackets:c.autoCloseBrackets,highlightSelectionMatches:c.highlightMatches,continueComments:c.continueComments, +{beforeInit:function(a){a.ui.addHandler(CKEDITOR.UI_BUTTON,CKEDITOR.ui.button.handler)}});CKEDITOR.UI_BUTTON="button";CKEDITOR.ui.button=function(a){CKEDITOR.tools.extend(this,a,{isToggle:a.isToggle||!1,title:a.label,click:a.click||function(b){b.execCommand(a.command)}});this._={}};CKEDITOR.ui.button.handler={create:function(a){return new CKEDITOR.ui.button(a)}};CKEDITOR.ui.button.prototype={render:function(a,b){function c(){var f=a.mode;f&&(f=this.modes[f]?void 0!==p[f]?p[f]:CKEDITOR.TRISTATE_OFF: +CKEDITOR.TRISTATE_DISABLED,f=a.readOnly&&!this.readOnly?CKEDITOR.TRISTATE_DISABLED:f,this.setState(f),this.refresh&&this.refresh())}var p=null,q=CKEDITOR.env,r=this._.id=CKEDITOR.tools.getNextId(),g="",d=this.command,l,m,k;this._.editor=a;var e={id:r,button:this,editor:a,focus:function(){CKEDITOR.document.getById(r).focus()},execute:function(){this.button.click(a)},attach:function(a){this.button.attach(a)}},x=CKEDITOR.tools.addFunction(function(a){if(e.onkey)return a=new CKEDITOR.dom.event(a),!1!== +e.onkey(e,a.getKeystroke())}),y=CKEDITOR.tools.addFunction(function(a){var b;e.onfocus&&(b=!1!==e.onfocus(e,new CKEDITOR.dom.event(a)));return b}),u=0;e.clickFn=l=CKEDITOR.tools.addFunction(function(){u&&(a.unlockSelection(1),u=0);e.execute();q.iOS&&a.focus()});this.modes?(p={},a.on("beforeModeUnload",function(){a.mode&&this._.state!=CKEDITOR.TRISTATE_DISABLED&&(p[a.mode]=this._.state)},this),a.on("activeFilterChange",c,this),a.on("mode",c,this),!this.readOnly&&a.on("readOnly",c,this)):d&&(d=a.getCommand(d))&& +(d.on("state",function(){this.setState(d.state)},this),g+=d.state==CKEDITOR.TRISTATE_ON?"on":d.state==CKEDITOR.TRISTATE_DISABLED?"disabled":"off");var n;if(this.directional)a.on("contentDirChanged",function(b){var c=CKEDITOR.document.getById(this._.id),d=c.getFirst();b=b.data;b!=a.lang.dir?c.addClass("cke_"+b):c.removeClass("cke_ltr").removeClass("cke_rtl");d.setAttribute("style",CKEDITOR.skin.getIconStyle(n,"rtl"==b,this.icon,this.iconOffset))},this);d?(m=a.getCommandKeystroke(d))&&(k=CKEDITOR.tools.keystrokeToString(a.lang.common.keyboard, +m)):g+="off";m=this.name||this.command;var h=null,t=this.icon;n=m;this.icon&&!/\./.test(this.icon)?(n=this.icon,t=null):(this.icon&&(h=this.icon),CKEDITOR.env.hidpi&&this.iconHiDpi&&(h=this.iconHiDpi));h?(CKEDITOR.skin.addIcon(h,h),t=null):h=n;g={id:r,name:m,iconName:n,label:this.label,cls:(this.hasArrow?"cke_button_expandable ":"")+(this.className||""),state:g,ariaDisabled:"disabled"==g?"true":"false",title:this.title+(k?" ("+k.display+")":""),ariaShortcutSpace:k?"\x26nbsp;":"",ariaShortcut:k?a.lang.common.keyboardShortcut+ +" "+k.aria:"",titleJs:q.gecko&&!q.hc?"":(this.title||"").replace("'",""),hasArrow:"string"===typeof this.hasArrow&&this.hasArrow||(this.hasArrow?"true":"false"),keydownFn:x,focusFn:y,clickFn:l,style:CKEDITOR.skin.getIconStyle(h,"rtl"==a.lang.dir,t,this.iconOffset),arrowHtml:this.hasArrow?v.output():"",hasArrowAriaHtml:this.hasArrow?' aria-expanded\x3d"false"':"",toggleAriaHtml:this.isToggle?'aria-pressed\x3d"false"':""};w.output(g,b);if(this.onRender)this.onRender();return e},setState:function(a){if(this._.state== +a)return!1;this._.state=a;var b=CKEDITOR.document.getById(this._.id);return b?(b.setState(a,"cke_button"),b.setAttribute("aria-disabled",a==CKEDITOR.TRISTATE_DISABLED),this.isToggle&&!this.hasArrow&&b.setAttribute("aria-pressed",a===CKEDITOR.TRISTATE_ON),!0):!1},getState:function(){return this._.state},toFeature:function(a){if(this._.feature)return this._.feature;var b=this;this.allowedContent||this.requiredContent||!this.command||(b=a.getCommand(this.command)||b);return this._.feature=b}};CKEDITOR.ui.prototype.addButton= +function(a,b){this.add(a,CKEDITOR.UI_BUTTON,b)}})();(function(){CKEDITOR.plugins.add("codemirror",{version:"1.18.4",init:function(b){function h(){var a=["core","addons"];switch(c.mode){case "bbcode":case "bbcodemixed":a.push("modeHtml");break;case "application/x-httpd-php":a.push("modePHP");break;case "text/javascript":a.push("modeJs");break;case "handlebars":a.push("modeHandlebars");break;case "twig":a.push("modeTwig");break;default:a.push("modeHtml")}c.useBeautifyOnStart&&a.push("beautifyModule");c.enableSearchTools&&a.push("addonSearch");return a} +function p(){var a=[e+"js/codemirror.addons.min.js"];switch(c.mode){case "handlebars":a.push(e+"js/codemirror.mode.handlebars.min.js");case "bbcode":a.push(e+"js/codemirror.mode.bbcode.min.js");break;case "bbcodemixed":a.push(e+"js/codemirror.mode.bbcodemixed.min.js");break;case "htmlmixed":a.push(e+"js/codemirror.mode.htmlmixed.min.js");break;case "text/html":a.push(e+"js/codemirror.mode.htmlmixed.min.js");break;case "application/x-httpd-php":a.push(e+"js/codemirror.mode.php.min.js");break;case "text/javascript":a.push(e+ +"js/codemirror.mode.javascript.min.js");break;case "twig":a.push(e+"js/codemirror.mode.twig.min.js");break;case "twig":a.push(e+"js/codemirror.mode.twig.min.js");break;case "text/x-mssql":case "text/x-mysql":case "text/x-pgsql":case "text/x-sql":a.push(e+"js/codemirror.mode.sql.min.js");break;default:a.push(e+"js/codemirror.mode.htmlmixed.min.js")}c.useBeautifyOnStart&&a.push(e+"js/beautify.min.js");c.enableSearchTools&&a.push(e+"js/codemirror.addons.search.min.js");return a}function n(a){function b(a){for(var c= +[[CKEDITOR.SHIFT,"Shift-"],[CKEDITOR.CTRL,"Ctrl-"],[CKEDITOR.ALT,"Alt-"]],d="",g=0;g=c.mode.indexOf("bbcode")&&(c.mode="bbcode");var r="function"===typeof require&&"function"===typeof require.config,t;if(r){var q=c.requireContext||"_",l=CKEDITOR.getUrl("plugins/codemirror/js/"),l=l.substring(0,l.length-1);t=require.config({context:q,packages:[{name:"codemirror",location:l,main:"codemirror.min.js"},{name:"codemirror-mode-handlebars",location:l,main:"codemirror.mode.handlebars.min.js"},{name:"codemirror-mode-twig",location:l,main:"codemirror.mode.twig.min.js"}, +{name:"codemirror-mode-html",location:l,main:"codemirror.mode.htmlmixed.min.js"},{name:"codemirror-mode-php",location:l,main:"codemirror.mode.php.min.js"},{name:"codemirror-mode-js",location:l,main:"codemirror.mode.js.min.js"},{name:"codemirror-addons",location:l,main:"codemirror.addons.min.js"},{name:"codemirror-addon-search",location:l,main:"codemirror.addons.search.min.js"},{name:"codemirror-beautify",location:l,main:"beautify.min.js"}],bundles:{codemirror:["core","codemirror.js"],"codemirror-mode-handlebars":["modeHandlebars"], +"codemirror-mode-twig":["modeTwig"],"codemirror-mode-html":["modeHtml"],"codemirror-mode-php":["modePHP"],"codemirror-mode-js":["modeJS"],"codemirror-addons":["addons"],"codemirror-addon-search":["addonSearch"],"codemirror-beautify":["beautifyModule"]},map:{"*":{"lib/codemirror":"codemirror.js"}}})}(b.elementMode===CKEDITOR.ELEMENT_MODE_INLINE||b.plugins.sourcedialog)&&CKEDITOR.dialog.add("sourcedialog",function(a){function b(a,d,e){var g=e.getSize();e=g.width;var g=g.height/1.5,k=c.mode;"handlebars"== +k?k={name:"handlebars",base:"text/html"}:"twig"==k&&(k={name:"twig",base:"text/html"});window["codemirror_"+a.id]=CodeMirror.fromTextArea(d,{direction:a.lang.dir,mode:k,matchBrackets:c.matchBrackets,maxHighlightLineLength:c.maxHighlightLineLength,matchTags:c.matchTags,workDelay:300,workTime:35,readOnly:a.readOnly,lineNumbers:c.lineNumbers,lineWrapping:c.lineWrapping,autoCloseTags:c.autoCloseTags,autoCloseBrackets:c.autoCloseBrackets,highlightSelectionMatches:c.highlightMatches,continueComments:c.continueComments, indentWithTabs:c.indentWithTabs,theme:c.theme,showTrailingSpace:c.showTrailingSpace,showCursorWhenSelecting:!0,styleActiveLine:c.styleActiveLine,hintOptions:c.hintOptions,viewportMargin:Infinity,extraKeys:c.extraKeys,foldGutter:!0,gutters:["CodeMirror-linenumbbers","CodeMirror-foldgutter"]});window["codemirror_"+a.id].display.wrapper.classList.add("cke_enable_context_menu");d=g+"px";e+="px";window["codemirror_"+a.id].config=c;c.autoFormatOnStart&&(c.useBeautifyOnStart?(g=window["codemirror_"+a.id].getValue(), window["codemirror_"+a.id].setValue(html_beautify(g,4," ",120,"collapse"))):window["codemirror_"+a.id].autoFormatAll({line:0,ch:0},{line:window["codemirror_"+a.id].lineCount(),ch:0}));window["codemirror_"+a.id].on("change",function(){window["codemirror_"+a.id].save();a.fire("change",this)});window["codemirror_"+a.id].setSize(e,d);if(c.lineNumbers&&c.enableCodeFolding)window["codemirror_"+a.id].on("gutterClick",window["foldFunc_"+a.id]);if("function"===typeof c.onLoad)c.onLoad(window["codemirror_"+ -a.id],a);window["codemirror_"+a.id].on("blur",function(){a.fire("blur",this)});window["codemirror_"+a.id].on("keypress",function(b,d){if(c.enableCodeFormatting){var e=window["codemirror_"+a.id].getCursor(!0),h=window["codemirror_"+a.id].getCursor(!1);"keydown"!==d.type||!d.ctrlKey||75!==d.keyCode||d.shiftKey||d.altKey?"keydown"===d.type&&d.ctrlKey&&75===d.keyCode&&d.shiftKey&&!d.altKey?(window["codemirror_"+a.id].commentRange(!1,e,h),c.autoFormatOnUncomment&&window["codemirror_"+a.id].autoFormatRange(e, -h)):"keydown"===d.type&&d.ctrlKey&&75===d.keyCode&&!d.shiftKey&&d.altKey&&window["codemirror_"+a.id].autoFormatRange(e,h):window["codemirror_"+a.id].commentRange(!0,e,h)}});a.plugins.textselection&&textRange&&!a.config.fullPage&&(d=OffSetToLineChannel(window["codemirror_"+a.id],textRange.startOffset),"undefined"==typeof textRange.endOffset?(window["codemirror_"+a.id].focus(),window["codemirror_"+a.id].setCursor(d)):(window["codemirror_"+a.id].focus(),e=OffSetToLineChannel(window["codemirror_"+a.id], -textRange.endOffset),window["codemirror_"+a.id].setSelection(d,e)))}var d=CKEDITOR.document.getWindow().getViewPaneSize(),l=Math.min(d.width-70,800),d=d.height/1.5,m;return{title:a.lang.sourcedialog.title,minWidth:l,minHeight:d,resizable:CKEDITOR.DIALOG_RESIZE_BOTH,onLoad:function(){this.on("resize",function(b){var c=b.sender.parts;window["codemirror_"+a.id].setSize(b.data.width+"px",b.data.height-c.title.$.offsetHeight-c.footer.$.offsetHeight+"px")},this)},onShow:function(d){this.getContentElement("main", -"data").focus();this.getContentElement("main","AutoComplete").setValue(c.autoCloseTags,!0);var h=this.getContentElement("main","data").getInputElement().$;this.setValueOf("main","data",m=a.getData());c.autoLoadCodeMirror&&(IsStyleSheetAlreadyLoaded(e+"css/codemirror.min.css")||CKEDITOR.document.appendStyleSheet(e+"css/codemirror.min.css"),c.theme.length&&"default"!=c.theme&&!IsStyleSheetAlreadyLoaded(e+"theme/"+c.theme+".css")&&CKEDITOR.document.appendStyleSheet(e+"theme/"+c.theme+".css"),r?t(k(), -function(c,e){b(a,h,d.sender)}):"undefined"==typeof CodeMirror?CKEDITOR.scriptLoader.load(e+"js/codemirror.min.js",function(){CKEDITOR.scriptLoader.load(n(),function(){b(a,h,d.sender)})}):CodeMirror.prototype.autoFormatAll?b(a,h,d.sender):CKEDITOR.scriptLoader.load(n(),function(){b(a,h,d.sender)}))},onCancel:function(b){b.data.hide&&(window["codemirror_"+a.id].toTextArea(),window["codemirror_"+a.id]=null,a.fire("blur",this),a.fire("focus",this))},onOk:function(){function b(c){var d=this;a.setData(c, -function(){d.hide();var b=a.createRange();b.moveToElementEditStart(a.editable());b.select()})}return function(){window["codemirror_"+a.id].toTextArea();window["codemirror_"+a.id]=null;var c=this.getValueOf("main","data").replace(/\r/g,"");if(c===m)return a.fire("blur",this),a.fire("focus",this),!0;CKEDITOR.env.ie?CKEDITOR.tools.setTimeout(b,0,this,c):b.call(this,c);a.fire("blur",this);a.fire("focus",this);return!1}}(),contents:[{id:"main",label:a.lang.sourcedialog.title,elements:[{type:"hbox",style:"width: 80px;margin:0;", -widths:["20px","20px","20px","20px"],children:[{type:"button",id:"searchCode",label:"",title:p.searchCode,"class":"searchCodeButton",onClick:function(){CodeMirror.commands.find(window["codemirror_"+a.id])}},{type:"button",id:"autoFormat",label:"",title:p.autoFormat,"class":"autoFormat",onClick:function(){var b=window["codemirror_"+a.id].getCursor(!0),c=window["codemirror_"+a.id].getCursor(!1);window["codemirror_"+a.id].autoFormatRange(b,c)}},{type:"button",id:"CommentSelectedRange",label:"",title:p.commentSelectedRange, -"class":"CommentSelectedRange",onClick:function(){var b=window["codemirror_"+a.id].getCursor(!0),c=window["codemirror_"+a.id].getCursor(!1);window["codemirror_"+a.id].commentRange(!0,b,c)}},{type:"button",id:"UncommentSelectedRange",label:"",title:p.uncommentSelectedRange,"class":"UncommentSelectedRange",onClick:function(){var b=window["codemirror_"+a.id].getCursor(!0),c=window["codemirror_"+a.id].getCursor(!1);window["codemirror_"+a.id].commentRange(!1,b,c);window["codemirror_"+a.id].config.autoFormatOnUncomment&& -window["codemirror_"+a.id].autoFormatRange(b,c)}}]},{type:"checkbox",id:"AutoComplete",label:p.autoCompleteToggle,title:p.autoCompleteToggle,onChange:function(){window["codemirror_"+a.id].setOption("autoCloseTags",this.getValue())}},{type:"textarea",id:"data",dir:"ltr",inputStyle:"cursor:auto;width:"+l+"px;height:"+d+"px;tab-size:4;text-align:left;","class":"cke_source cke_enable_context_menu"}]}]}});b.commands.find&&(b.commands.find.modes={wysiwyg:1,source:1},b.commands.find.exec=function(){"wysiwyg"=== -b.mode?b.openDialog("find"):CodeMirror.commands.find(window["codemirror_"+b.id])});b.commands.replace&&(b.commands.replace.modes={wysiwyg:1,source:1},b.commands.replace.exec=function(){"wysiwyg"===b.mode?b.openDialog("find",function(){this.selectPage("replace")}):CodeMirror.commands.replace(window["codemirror_"+b.id])});q=CKEDITOR.plugins.sourcearea;q.commands.searchCode||(CKEDITOR.plugins.sourcearea.commands={source:{modes:{wysiwyg:1,source:1},editorFocus:!1,readOnly:1,exec:function(a){"wysiwyg"=== -a.mode&&a.fire("saveSnapshot");a.getCommand("source").setState(CKEDITOR.TRISTATE_DISABLED);a.setMode("source"===a.mode?"wysiwyg":"source")},canUndo:!1},searchCode:{modes:{wysiwyg:0,source:1},editorFocus:!1,readOnly:1,exec:function(a){CodeMirror.commands.find(window["codemirror_"+a.id])},canUndo:!0},autoFormat:{modes:{wysiwyg:0,source:1},editorFocus:!1,readOnly:1,exec:function(a){var b=window["codemirror_"+a.id].getCursor(!0),c=window["codemirror_"+a.id].getCursor(!1);window["codemirror_"+a.id].autoFormatRange(b, -c)},canUndo:!0},commentSelectedRange:{modes:{wysiwyg:0,source:1},editorFocus:!1,readOnly:1,exec:function(a){var b=window["codemirror_"+a.id].getCursor(!0),c=window["codemirror_"+a.id].getCursor(!1);window["codemirror_"+a.id].commentRange(!0,b,c)},canUndo:!0},uncommentSelectedRange:{modes:{wysiwyg:0,source:1},editorFocus:!1,readOnly:1,exec:function(a){var b=window["codemirror_"+a.id].getCursor(!0),c=window["codemirror_"+a.id].getCursor(!1);window["codemirror_"+a.id].commentRange(!1,b,c);window["codemirror_"+ -a.id].config.autoFormatOnUncomment&&window["codemirror_"+a.id].autoFormatRange(b,c)},canUndo:!0},autoCompleteToggle:{modes:{wysiwyg:0,source:1},editorFocus:!1,readOnly:1,exec:function(a){this.state==CKEDITOR.TRISTATE_ON?window["codemirror_"+a.id].setOption("autoCloseTags",!1):this.state==CKEDITOR.TRISTATE_OFF&&window["codemirror_"+a.id].setOption("autoCloseTags",!0);this.toggleState()},canUndo:!0}});b.addMode("source",function(a){c.autoLoadCodeMirror&&(IsStyleSheetAlreadyLoaded(e+"css/codemirror.min.css")|| -CKEDITOR.document.appendStyleSheet(e+"css/codemirror.min.css"),c.theme.length&&"default"!=c.theme&&!IsStyleSheetAlreadyLoaded(e+"theme/"+c.theme+".css")&&CKEDITOR.document.appendStyleSheet(e+"theme/"+c.theme+".css"),r?t(k(),function(){m(b);a()}):"undefined"==typeof CodeMirror?CKEDITOR.scriptLoader.load(e+"js/codemirror.min.js",function(){CKEDITOR.scriptLoader.load(n(),function(){m(b);a()})}):CodeMirror.prototype.autoFormatAll?(m(b),a()):CKEDITOR.scriptLoader.load(n(),function(){m(b);a()}))});b.addCommand("source", -q.commands.source);b.ui.addButton&&b.ui.addButton("Source",{label:b.lang.codemirror.toolbar,command:"source",toolbar:"mode,10"});c.enableCodeFormatting&&(b.addCommand("searchCode",q.commands.searchCode),b.addCommand("autoFormat",q.commands.autoFormat),b.addCommand("commentSelectedRange",q.commands.commentSelectedRange),b.addCommand("uncommentSelectedRange",q.commands.uncommentSelectedRange),b.addCommand("autoCompleteToggle",q.commands.autoCompleteToggle),b.ui.addButton&&((c.showFormatButton||c.showCommentButton|| -c.showUncommentButton||c.showSearchButton)&&b.ui.add("-",CKEDITOR.UI_SEPARATOR,{toolbar:"mode,30"}),c.showSearchButton&&c.enableSearchTools&&b.ui.addButton("searchCode",{label:p.searchCode,command:"searchCode",toolbar:"mode,40"}),c.showFormatButton&&b.ui.addButton("autoFormat",{label:p.autoFormat,command:"autoFormat",toolbar:"mode,50"}),c.showCommentButton&&b.ui.addButton("CommentSelectedRange",{label:p.commentSelectedRange,command:"commentSelectedRange",toolbar:"mode,60"}),c.showUncommentButton&& -b.ui.addButton("UncommentSelectedRange",{label:p.uncommentSelectedRange,command:"uncommentSelectedRange",toolbar:"mode,70"}),c.showAutoCompleteButton&&b.ui.addButton("AutoComplete",{label:p.autoCompleteToggle,command:"autoCompleteToggle",toolbar:"mode,80"})));b.on("beforeModeUnload",function(a){if("source"===b.mode&&b.plugins.textselection&&!b.config.fullPage){var c=b.getTextSelection();c.startOffset=LineChannelToOffSet(window["codemirror_"+b.id],window["codemirror_"+b.id].getCursor(!0));c.endOffset= +a.id],a);window["codemirror_"+a.id].on("blur",function(){a.fire("blur",this)});window["codemirror_"+a.id].on("keypress",function(b,d){if(c.enableCodeFormatting){var e=window["codemirror_"+a.id].getCursor(!0),f=window["codemirror_"+a.id].getCursor(!1);"keydown"!==d.type||!d.ctrlKey||75!==d.keyCode||d.shiftKey||d.altKey?"keydown"===d.type&&d.ctrlKey&&75===d.keyCode&&d.shiftKey&&!d.altKey?(window["codemirror_"+a.id].commentRange(!1,e,f),c.autoFormatOnUncomment&&window["codemirror_"+a.id].autoFormatRange(e, +f)):"keydown"===d.type&&d.ctrlKey&&75===d.keyCode&&!d.shiftKey&&d.altKey&&window["codemirror_"+a.id].autoFormatRange(e,f):window["codemirror_"+a.id].commentRange(!0,e,f)}});a.plugins.textselection&&textRange&&!a.config.fullPage&&(d=OffSetToLineChannel(window["codemirror_"+a.id],textRange.startOffset),"undefined"==typeof textRange.endOffset?(window["codemirror_"+a.id].focus(),window["codemirror_"+a.id].setCursor(d)):(window["codemirror_"+a.id].focus(),e=OffSetToLineChannel(window["codemirror_"+a.id], +textRange.endOffset),window["codemirror_"+a.id].setSelection(d,e)))}var d=CKEDITOR.document.getWindow().getViewPaneSize(),l=Math.min(d.width-70,800),d=d.height/1.5,n;return{title:a.lang.sourcedialog.title,minWidth:l,minHeight:d,resizable:CKEDITOR.DIALOG_RESIZE_BOTH,onLoad:function(){this.on("resize",function(b){var c=b.sender.parts;window["codemirror_"+a.id].setSize(b.data.width+"px",b.data.height-c.title.$.offsetHeight-c.footer.$.offsetHeight+"px")},this)},onShow:function(d){this.getContentElement("main", +"data").focus();this.getContentElement("main","AutoComplete").setValue(c.autoCloseTags,!0);var f=this.getContentElement("main","data").getInputElement().$;this.setValueOf("main","data",n=a.getData());c.autoLoadCodeMirror&&(IsStyleSheetAlreadyLoaded(e+"css/codemirror.min.css")||CKEDITOR.document.appendStyleSheet(e+"css/codemirror.min.css"),c.theme.length&&"default"!=c.theme&&!IsStyleSheetAlreadyLoaded(e+"theme/"+c.theme+".css")&&CKEDITOR.document.appendStyleSheet(e+"theme/"+c.theme+".css"),r?t(h(), +function(c,e){b(a,f,d.sender)}):"undefined"==typeof CodeMirror?CKEDITOR.scriptLoader.load(e+"js/codemirror.min.js",function(){CKEDITOR.scriptLoader.load(p(),function(){b(a,f,d.sender)})}):CodeMirror.prototype.autoFormatAll?b(a,f,d.sender):CKEDITOR.scriptLoader.load(p(),function(){b(a,f,d.sender)}))},onCancel:function(b){b.data.hide&&(window["codemirror_"+a.id].toTextArea(),window["codemirror_"+a.id]=null,a.fire("blur",this),a.fire("focus",this))},onOk:function(){function b(c){var d=this;a.setData(c, +function(){d.hide();var b=a.createRange();b.moveToElementEditStart(a.editable());b.select()})}return function(){window["codemirror_"+a.id].toTextArea();window["codemirror_"+a.id]=null;var c=this.getValueOf("main","data").replace(/\r/g,"");if(c===n)return a.fire("blur",this),a.fire("focus",this),!0;CKEDITOR.env.ie?CKEDITOR.tools.setTimeout(b,0,this,c):b.call(this,c);a.fire("blur",this);a.fire("focus",this);return!1}}(),contents:[{id:"main",label:a.lang.sourcedialog.title,elements:[{type:"hbox",style:"width: 80px;margin:0;", +widths:["20px","20px","20px","20px"],children:[{type:"button",id:"searchCode",label:"",title:m.searchCode,"class":"searchCodeButton cke_button_icon",onClick:function(){CodeMirror.commands.find(window["codemirror_"+a.id])}},{type:"button",id:"replaceCode",label:"",title:m.replaceCode,"class":"replaceCodeButton",onClick:function(){CodeMirror.commands.replace(window["codemirror_"+a.id])}},{type:"button",id:"autoFormat",label:"",title:m.autoFormat,"class":"autoFormat",onClick:function(){var b=window["codemirror_"+ +a.id].getCursor(!0),c=window["codemirror_"+a.id].getCursor(!1);window["codemirror_"+a.id].autoFormatRange(b,c)}},{type:"button",id:"CommentSelectedRange",label:"",title:m.commentSelectedRange,"class":"CommentSelectedRange",onClick:function(){var b=window["codemirror_"+a.id].getCursor(!0),c=window["codemirror_"+a.id].getCursor(!1);window["codemirror_"+a.id].commentRange(!0,b,c)}},{type:"button",id:"UncommentSelectedRange",label:"",title:m.uncommentSelectedRange,"class":"UncommentSelectedRange",onClick:function(){var b= +window["codemirror_"+a.id].getCursor(!0),c=window["codemirror_"+a.id].getCursor(!1);window["codemirror_"+a.id].commentRange(!1,b,c);window["codemirror_"+a.id].config.autoFormatOnUncomment&&window["codemirror_"+a.id].autoFormatRange(b,c)}},{type:"button",id:"codemirrorAbout",label:"",title:m.dlgTitle,"class":"codemirrorAbout",onClick:function(){a.execCommand("codemirrorAbout")}}]},{type:"checkbox",id:"AutoComplete",label:m.autoCompleteToggle,title:m.autoCompleteToggle,onChange:function(){window["codemirror_"+ +a.id].setOption("autoCloseTags",this.getValue())}},{type:"textarea",id:"data",dir:"ltr",inputStyle:"cursor:auto;width:"+l+"px;height:"+d+"px;tab-size:4;text-align:left;","class":"cke_source cke_enable_context_menu"}]}]}});b.commands.find&&(b.commands.find.modes={wysiwyg:1,source:1},b.commands.find.exec=function(){"wysiwyg"===b.mode?b.openDialog("find"):CodeMirror.commands.find(window["codemirror_"+b.id])});b.commands.replace&&(b.commands.replace.modes={wysiwyg:1,source:1},b.commands.replace.exec= +function(){"wysiwyg"===b.mode?b.openDialog("find",function(){this.selectPage("replace")}):CodeMirror.commands.replace(window["codemirror_"+b.id])});q=CKEDITOR.plugins.sourcearea;q.commands.searchCode||(CKEDITOR.plugins.sourcearea.commands={source:{modes:{wysiwyg:1,source:1},editorFocus:!1,readOnly:1,exec:function(a){"wysiwyg"===a.mode&&a.fire("saveSnapshot");a.getCommand("source").setState(CKEDITOR.TRISTATE_DISABLED);a.setMode("source"===a.mode?"wysiwyg":"source")},canUndo:!1},searchCode:{modes:{wysiwyg:0, +source:1},editorFocus:!1,readOnly:1,exec:function(a){CodeMirror.commands.find(window["codemirror_"+a.id])},canUndo:!0},autoFormat:{modes:{wysiwyg:0,source:1},editorFocus:!1,readOnly:1,exec:function(a){var b=window["codemirror_"+a.id].getCursor(!0),c=window["codemirror_"+a.id].getCursor(!1);window["codemirror_"+a.id].autoFormatRange(b,c)},canUndo:!0},commentSelectedRange:{modes:{wysiwyg:0,source:1},editorFocus:!1,readOnly:1,exec:function(a){var b=window["codemirror_"+a.id].getCursor(!0),c=window["codemirror_"+ +a.id].getCursor(!1);window["codemirror_"+a.id].commentRange(!0,b,c)},canUndo:!0},uncommentSelectedRange:{modes:{wysiwyg:0,source:1},editorFocus:!1,readOnly:1,exec:function(a){var b=window["codemirror_"+a.id].getCursor(!0),c=window["codemirror_"+a.id].getCursor(!1);window["codemirror_"+a.id].commentRange(!1,b,c);window["codemirror_"+a.id].config.autoFormatOnUncomment&&window["codemirror_"+a.id].autoFormatRange(b,c)},canUndo:!0},autoCompleteToggle:{modes:{wysiwyg:0,source:1},editorFocus:!1,readOnly:1, +exec:function(a){this.state==CKEDITOR.TRISTATE_ON?window["codemirror_"+a.id].setOption("autoCloseTags",!1):this.state==CKEDITOR.TRISTATE_OFF&&window["codemirror_"+a.id].setOption("autoCloseTags",!0);this.toggleState()},canUndo:!0}});b.addMode("source",function(a){c.autoLoadCodeMirror&&(IsStyleSheetAlreadyLoaded(e+"css/codemirror.min.css")||CKEDITOR.document.appendStyleSheet(e+"css/codemirror.min.css"),c.theme.length&&"default"!=c.theme&&!IsStyleSheetAlreadyLoaded(e+"theme/"+c.theme+".css")&&CKEDITOR.document.appendStyleSheet(e+ +"theme/"+c.theme+".css"),r?t(h(),function(){n(b);a()}):"undefined"==typeof CodeMirror?CKEDITOR.scriptLoader.load(e+"js/codemirror.min.js",function(){CKEDITOR.scriptLoader.load(p(),function(){n(b);a()})}):CodeMirror.prototype.autoFormatAll?(n(b),a()):CKEDITOR.scriptLoader.load(p(),function(){n(b);a()}))});b.addCommand("source",q.commands.source);b.ui.addButton&&b.ui.addButton("Source",{label:b.lang.codemirror.toolbar,command:"source",toolbar:"mode,10"});c.enableCodeFormatting&&(b.addCommand("searchCode", +q.commands.searchCode),b.addCommand("autoFormat",q.commands.autoFormat),b.addCommand("commentSelectedRange",q.commands.commentSelectedRange),b.addCommand("uncommentSelectedRange",q.commands.uncommentSelectedRange),b.addCommand("autoCompleteToggle",q.commands.autoCompleteToggle),b.ui.addButton&&((c.showFormatButton||c.showCommentButton||c.showUncommentButton||c.showSearchButton)&&b.ui.add("-",CKEDITOR.UI_SEPARATOR,{toolbar:"mode,30"}),c.showFormatButton&&b.ui.addButton("autoFormat",{icon:this.path+ +"images/autoformat.svg",label:m.autoFormat,command:"autoFormat",toolbar:"mode,50"}),c.showCommentButton&&b.ui.addButton("CommentSelectedRange",{icon:this.path+"images/commentselectedrange.svg",label:m.commentSelectedRange,command:"commentSelectedRange",toolbar:"mode,60"}),c.showUncommentButton&&b.ui.addButton("UncommentSelectedRange",{icon:this.path+"images/uncommentselectedrange.svg",label:m.uncommentSelectedRange,command:"uncommentSelectedRange",toolbar:"mode,70"}),c.showAutoCompleteButton&&b.ui.addButton("AutoComplete", +{icon:this.path+"images/autocomplete.svg",label:m.autoCompleteToggle,command:"autoCompleteToggle",toolbar:"mode,80"}),b.ui.addButton("codemirrorAbout",{icon:this.path+"images/codemirror.svg",label:m.dlgTitle,command:"codemirrorAbout",toolbar:"mode,90"})));b.on("beforeModeUnload",function(a){if("source"===b.mode&&b.plugins.textselection&&!b.config.fullPage){var c=b.getTextSelection();c.startOffset=LineChannelToOffSet(window["codemirror_"+b.id],window["codemirror_"+b.id].getCursor(!0));c.endOffset= LineChannelToOffSet(window["codemirror_"+b.id],window["codemirror_"+b.id].getCursor(!1));delete c.element;c.createBookmark(b);sourceBookmark=!0;b.undoManager&&b.undoManager.unlock();a.data=c.content}});b.on("mode",function(){b.getCommand("source").setState("source"===b.mode?CKEDITOR.TRISTATE_ON:CKEDITOR.TRISTATE_OFF);if("source"===b.mode&&("autoCompleteToggle"in b.commands&&b.getCommand("autoCompleteToggle").setState(window["codemirror_"+b.id].config.autoCloseTags?CKEDITOR.TRISTATE_ON:CKEDITOR.TRISTATE_OFF), b.plugins.textselection&&textRange&&!b.config.fullPage)){var a,c;a=OffSetToLineChannel(window["codemirror_"+b.id],textRange.startOffset);"undefined"==typeof textRange.endOffset?(window["codemirror_"+b.id].focus(),window["codemirror_"+b.id].setCursor(a)):(window["codemirror_"+b.id].focus(),c=OffSetToLineChannel(window["codemirror_"+b.id],textRange.endOffset),window["codemirror_"+b.id].setSelection(a,c))}});b.on("resize",function(){if(window["editable_"+b.id]&&"source"===b.mode){var a=window["editable_"+ b.id].getParent();window["codemirror_"+b.id].setSize(a.$.clientWidth+"px",a.$.clientHeight+"px")}});b.on("readOnly",function(){window["editable_"+b.id]&&"source"===b.mode&&window["codemirror_"+b.id].setOption("readOnly",this.readOnly)});b.on("instanceReady",function(a){a=b.commands.selectAll;null!=a&&(a.exec=function(){if("source"===b.mode)window["codemirror_"+b.id].setSelection({line:0,ch:0},{line:window["codemirror_"+b.id].lineCount(),ch:0});else{var a=b.editable();if(a.is("body"))b.document.$.execCommand("SelectAll", @@ -754,12 +758,12 @@ b.id].getParent();window["codemirror_"+b.id].setSize(a.$.clientWidth+"px",a.$.cl proto:{setData:function(b){this.setValue(b);window["editable_"+this.editor.id]&&"source"===this.editor.mode&&window["codemirror_"+this.editor.id].setValue(b);this.editor.fire("dataReady")},getData:function(){return this.getValue()},insertHtml:function(){},insertElement:function(){},insertText:function(){},setReadOnly:function(b){this[(b?"set":"remove")+"Attribute"]("readOnly","readonly")},editorID:null,detach:function(){window["codemirror_"+this.editorID].toTextArea();window["editable_"+this.editorID]= null;window["codemirror_"+this.editorID]=null;d.baseProto.detach.call(this);this.clearCustomData();this.remove()}}})})(); CKEDITOR.plugins.sourcearea={commands:{source:{modes:{wysiwyg:1,source:1},editorFocus:!1,readOnly:1,exec:function(d){"wysiwyg"===d.mode&&d.fire("saveSnapshot");d.getCommand("source").setState(CKEDITOR.TRISTATE_DISABLED);d.setMode("source"===d.mode?"wysiwyg":"source")},canUndo:!1},searchCode:{modes:{wysiwyg:0,source:1},editorFocus:!1,readOnly:1,exec:function(d){CodeMirror.commands.find(window["codemirror_"+d.id])},canUndo:!0},autoFormat:{modes:{wysiwyg:0,source:1},editorFocus:!1,readOnly:0,exec:function(d){var b= -window["codemirror_"+d.id].getCursor(!0),k=window["codemirror_"+d.id].getCursor(!1);window["codemirror_"+d.id].autoFormatRange(b,k)},canUndo:!0},commentSelectedRange:{modes:{wysiwyg:0,source:1},editorFocus:!1,readOnly:0,exec:function(d){var b=window["codemirror_"+d.id].getCursor(!0),k=window["codemirror_"+d.id].getCursor(!1);window["codemirror_"+d.id].commentRange(!0,b,k)},canUndo:!0},uncommentSelectedRange:{modes:{wysiwyg:0,source:1},editorFocus:!1,readOnly:0,exec:function(d){var b=window["codemirror_"+ -d.id].getCursor(!0),k=window["codemirror_"+d.id].getCursor(!1);window["codemirror_"+d.id].commentRange(!1,b,k);window["codemirror_"+d.id].config.autoFormatOnUncomment&&window["codemirror_"+d.id].autoFormatRange(b,k)},canUndo:!0},autoCompleteToggle:{modes:{wysiwyg:0,source:1},editorFocus:!1,readOnly:1,exec:function(d){this.state==CKEDITOR.TRISTATE_ON?window["codemirror_"+d.id].setOption("autoCloseTags",!1):this.state==CKEDITOR.TRISTATE_OFF&&window["codemirror_"+d.id].setOption("autoCloseTags",!0); -this.toggleState()},canUndo:!0}}};function LineChannelToOffSet(d,b){var k=b.line,n=k+b.ch;for(i=0;ig.length)){f=g[g.length-1].getNext();b=e.createElement(this.type);for(d.push(b);g.length;)d=g.shift(),a=e.createElement("li"),c=d,c.is("pre")||M.test(c.getName())||"false"==c.getAttribute("contenteditable")?d.appendTo(a):(d.copyAttributes(a),h&&d.getDirection()&&(a.removeStyle("direction"), +a=a.config.useComputedState;for(var h,k,b=0;bg.length)){f=g[g.length-1].getNext();b=e.createElement(this.type);for(d.push(b);g.length;)d=g.shift(),a=e.createElement("li"),c=d,c.is("pre")||M.test(c.getName())||"false"==c.getAttribute("contenteditable")?d.appendTo(a):(d.copyAttributes(a),h&&d.getDirection()&&(a.removeStyle("direction"), a.removeAttribute("dir")),d.moveChildren(a),d.remove()),a.appendTo(b);h&&k&&b.setAttribute("dir",h);f?b.insertBefore(f):b.appendTo(l)}}function N(a,l,d){function f(b){if(!(!(c=k[b?"getFirst":"getLast"]())||c.is&&c.isBlockBoundary()||!(p=l.root[b?"getPrevious":"getNext"](CKEDITOR.dom.walker.invisible(!0)))||p.is&&p.isBlockBoundary({br:1})))a.document.createElement("br")[b?"insertBefore":"insertAfter"](c)}for(var e=CKEDITOR.plugins.list.listToArray(l.root,d),g=[],b=0;be[b-1].indent+1){g=e[b-1].indent+1-e[b].indent;for(h=e[b].indent;e[b]&&e[b].indent>=h;)e[b].indent+=g,b++;b--}var k=CKEDITOR.plugins.list.arrayToList(e,d,null,a.config.enterMode,l.root.getAttribute("dir")).listNode,c,p; f(!0);f();k.replace(l.root);a.fire("contentDomInvalidated")}function C(a,l){this.name=a;this.context=this.type=l;this.allowedContent=l+" li";this.requiredContent=l}function F(a,l,d,f){for(var e,g;e=a[f?"getLast":"getFirst"](O);)(g=e.getDirection(1))!==l.getDirection(1)&&e.setAttribute("dir",g),e.remove(),d?e[f?"insertBefore":"insertAfter"](d):l.append(e,f),d=e}function G(a){function l(d){var f=a[d?"getPrevious":"getNext"](t);f&&f.type==CKEDITOR.NODE_ELEMENT&&f.is(a.getName())&&(F(a,f,null,!d),a.remove(), @@ -988,22 +992,22 @@ function(a){return-1===CKEDITOR.tools.array.indexOf(b,a.type)}).length}function CKEDITOR.ENTER_BR?h.appendBogus():b[0].fixBlock(1,e.enterMode==CKEDITOR.ENTER_P?"p":"div"),g.selectRanges(b)}for(var e=g.createBookmarks(!0),h=[],c={},b=b.createIterator(),p=0;(k=b.getNextRange())&&++p;){var m=k.getBoundaryNodes(),n=m.startNode,r=m.endNode;n.type==CKEDITOR.NODE_ELEMENT&&"td"==n.getName()&&k.setStartAt(m.startNode,CKEDITOR.POSITION_AFTER_START);r.type==CKEDITOR.NODE_ELEMENT&&"td"==r.getName()&&k.setEndAt(m.endNode,CKEDITOR.POSITION_BEFORE_END);k=k.createIterator();for(k.forceBrBreak= this.state==CKEDITOR.TRISTATE_OFF;m=k.getNextParagraph();)if(!m.getCustomData("list_block")&&!f(m)){CKEDITOR.dom.element.setMarker(c,m,"list_block",1);for(var y=a.elementPath(m),n=y.elements,r=0,y=y.blockLimit,q,w=n.length-1;0<=w&&(q=n[w]);w--)if(u[q.getName()]&&y.contains(q)){y.removeCustomData("list_group_object_"+p);(n=q.getCustomData("list_group_object"))?n.contents.push(m):(n={root:q,contents:[m]},h.push(n),CKEDITOR.dom.element.setMarker(c,q,"list_group_object",n));r=1;break}r||(r=y,r.getCustomData("list_group_object_"+ p)?r.getCustomData("list_group_object_"+p).contents.push(m):(n={root:r,contents:[m]},CKEDITOR.dom.element.setMarker(c,r,"list_group_object_"+p,n),h.push(n)))}}for(q=[];0p.x+t.width?b():a.setStyle("left",k(n)):e.x+g+h>p.x+t.width?a.setStyle("left",k(n)):e.x+d.width/2+g/2+h>p.x+t.width?a.setStyle("left",k(n-e.x+p.x+t.width-g-h)):0>d.left+d.width-g-h?b():0>d.left+d.width/2-g/2?a.setStyle("left",k(n-e.x+p.x)):a.setStyle("left",k(n+d.width/2-g/2-h/2))}};CKEDITOR.plugins.notification=q})();(function(){function D(a){function d(){for(var b=f(),e=CKEDITOR.tools.clone(a.config.toolbarGroups)||v(a),n=0;na.order?-1:0>b.order?1:b.order]+data-cke-bookmark[^<]*?<\/span>/ig, -"");d&&u(a,c)})}function q(){if("wysiwyg"==a.mode){var b=t("paste");a.getCommand("cut").setState(t("cut"));a.getCommand("copy").setState(t("copy"));a.getCommand("paste").setState(b);a.fire("pasteState",b)}}function t(b){var c=a.getSelection(),c=c&&c.getRanges()[0];if((a.readOnly||c&&c.checkReadOnly())&&b in{paste:1,cut:1})return CKEDITOR.TRISTATE_DISABLED;if("paste"==b)return CKEDITOR.TRISTATE_OFF;b=a.getSelection();c=b.getRanges();return b.getType()==CKEDITOR.SELECTION_NONE||1==c.length&&c[0].collapsed? -CKEDITOR.TRISTATE_DISABLED:CKEDITOR.TRISTATE_OFF}var n=CKEDITOR.plugins.clipboard,v=0,p=0;(function(){a.on("key",h);a.on("contentDom",b);a.on("selectionChange",q);if(a.contextMenu){a.contextMenu.addListener(function(){return{cut:t("cut"),copy:t("copy"),paste:t("paste")}});var c=null;a.on("menuShow",function(){c&&(c.removeListener(),c=null);var b=a.contextMenu.findItemByCommandName("paste");b&&b.element&&(c=b.element.on("touchend",function(){a._.forcePasteDialog=!0}))})}if(a.ui.addButton)a.once("instanceReady", -function(){a._.pasteButtons&&CKEDITOR.tools.array.forEach(a._.pasteButtons,function(b){if(b=a.ui.get(b))if(b=CKEDITOR.document.getById(b._.id))b.on("touchend",function(){a._.forcePasteDialog=!0})})})})();(function(){function b(c,d,h,k,f){var m=a.lang.clipboard[d];a.addCommand(d,h);a.ui.addButton&&a.ui.addButton(c,{label:m,command:d,toolbar:"clipboard,"+k});a.addMenuItems&&a.addMenuItem(d,{label:m,command:d,group:"clipboard",order:f})}b("Cut","cut",c("cut"),10,1);b("Copy","copy",c("copy"),20,4);b("Paste", -"paste",d(),30,8);a._.pasteButtons||(a._.pasteButtons=[]);a._.pasteButtons.push("Paste")})();a.getClipboardData=function(b,c){function d(a){a.removeListener();a.cancel();c(a.data)}function h(a){a.removeListener();a.cancel();c({type:f,dataValue:a.data.dataValue,dataTransfer:a.data.dataTransfer,method:"paste"})}var k=!1,f="auto";c||(c=b,b=null);a.on("beforePaste",function(a){a.removeListener();k=!0;f=a.data.type},null,null,1E3);a.on("paste",d,null,null,0);!1===r()&&(a.removeListener("paste",d),a._.forcePasteDialog&& -k&&a.fire("pasteDialog")?(a.on("pasteDialogCommit",h),a.on("dialogHide",function(a){a.removeListener();a.data.removeListener("pasteDialogCommit",h);a.data._.committed||c(null)})):c(null))}}function y(a){if(CKEDITOR.env.webkit){if(!a.match(/^[^<]*$/g)&&!a.match(/^(
<\/div>|
[^<]*<\/div>)*$/gi))return"html"}else if(CKEDITOR.env.ie){if(!a.match(/^([^<]|)*$/gi)&&!a.match(/^(

([^<]|)*<\/p>|(\r\n))*$/gi))return"html"}else if(CKEDITOR.env.gecko){if(!a.match(/^([^<]|)*$/gi))return"html"}else return"html"; -return"htmlifiedtext"}function z(a,b){function c(a){return CKEDITOR.tools.repeat("\x3c/p\x3e\x3cp\x3e",~~(a/2))+(1==a%2?"\x3cbr\x3e":"")}b=b.replace(/(?!\u3000)\s+/g," ").replace(/> +/gi,"\x3cbr\x3e");b=b.replace(/<\/?[A-Z]+>/g,function(a){return a.toLowerCase()});if(b.match(/^[^<]$/))return b;CKEDITOR.env.webkit&&-1(
|)<\/div>)(?!$|(

(
|)<\/div>))/g,"\x3cbr\x3e").replace(/^(
(
|)<\/div>){2}(?!$)/g,"\x3cdiv\x3e\x3c/div\x3e"), -b.match(/
(
|)<\/div>/)&&(b="\x3cp\x3e"+b.replace(/(
(
|)<\/div>)+/g,function(a){return c(a.split("\x3c/div\x3e\x3cdiv\x3e").length+1)})+"\x3c/p\x3e"),b=b.replace(/<\/div>
/g,"\x3cbr\x3e"),b=b.replace(/<\/?div>/g,""));CKEDITOR.env.gecko&&a.enterMode!=CKEDITOR.ENTER_BR&&(CKEDITOR.env.gecko&&(b=b.replace(/^

$/,"\x3cbr\x3e")),-1){2,}/g,function(a){return c(a.length/4)})+"\x3c/p\x3e"));return A(a,b)}function B(a){function b(){var a= -{},b;for(b in CKEDITOR.dtd)"$"!=b.charAt(0)&&"div"!=b&&"span"!=b&&(a[b]=1);return a}var c={};return{get:function(d){return"plain-text"==d?c.plainText||(c.plainText=new CKEDITOR.filter(a,"br")):"semantic-content"==d?((d=c.semanticContent)||(d=new CKEDITOR.filter(a,{}),d.allow({$1:{elements:b(),attributes:!0,styles:!1,classes:!1}}),d=c.semanticContent=d),d):d?new CKEDITOR.filter(a,d):null}}}function w(a,b,c){b=CKEDITOR.htmlParser.fragment.fromHtml(b);var d=new CKEDITOR.htmlParser.basicWriter;c.applyTo(b, -!0,!1,a.activeEnterMode);b.writeHtml(d);return d.getHtml()}function A(a,b){a.enterMode==CKEDITOR.ENTER_BR?b=b.replace(/(<\/p>

)+/g,function(a){return CKEDITOR.tools.repeat("\x3cbr\x3e",a.length/7*2)}).replace(/<\/?p>/g,""):a.enterMode==CKEDITOR.ENTER_DIV&&(b=b.replace(/<(\/)?p>/g,"\x3c$1div\x3e"));return b}function C(a){a.data.preventDefault();a.data.$.dataTransfer.dropEffect="none"}function D(a){var b=CKEDITOR.plugins.clipboard;a.on("contentDom",function(){function c(b,c,d){c.select();u(a,{dataTransfer:d, -method:"drop"},1);d.sourceEditor.fire("saveSnapshot");d.sourceEditor.editable().extractHtmlFromRange(b);d.sourceEditor.getSelection().selectRanges([b]);d.sourceEditor.fire("saveSnapshot")}function d(c,d){c.select();u(a,{dataTransfer:d,method:"drop"},1);b.resetDragDataTransfer()}function e(b,c,d){var k={$:b.data.$,target:b.data.getTarget()};c&&(k.dragRange=c);d&&(k.dropRange=d);!1===a.fire(b.name,k)&&b.data.preventDefault()}function g(a){a.type!=CKEDITOR.NODE_ELEMENT&&(a=a.getParent());return a.getChildCount()} -var f=a.editable(),l=CKEDITOR.plugins.clipboard.getDropTarget(a),k=a.ui.space("top"),r=a.ui.space("bottom");b.preventDefaultDropOnElement(k);b.preventDefaultDropOnElement(r);f.attachListener(l,"dragstart",e);f.attachListener(a,"dragstart",b.resetDragDataTransfer,b,null,1);f.attachListener(a,"dragstart",function(c){b.initDragDataTransfer(c,a)},null,null,2);f.attachListener(a,"dragstart",function(){var c=b.dragRange=a.getSelection().getRanges()[0];CKEDITOR.env.ie&&10>CKEDITOR.env.version&&(b.dragStartContainerChildCount= -c?g(c.startContainer):null,b.dragEndContainerChildCount=c?g(c.endContainer):null)},null,null,100);f.attachListener(l,"dragend",e);f.attachListener(a,"dragend",b.initDragDataTransfer,b,null,1);f.attachListener(a,"dragend",b.resetDragDataTransfer,b,null,100);f.attachListener(l,"dragover",function(a){if(CKEDITOR.env.edge)a.data.preventDefault();else{var b=a.data.getTarget();b&&b.is&&b.is("html")?a.data.preventDefault():CKEDITOR.env.ie&&CKEDITOR.plugins.clipboard.isFileApiSupported&&a.data.$.dataTransfer.types.contains("Files")&& -a.data.preventDefault()}});f.attachListener(l,"drop",function(c){if(!c.data.$.defaultPrevented&&(c.data.preventDefault(),!a.readOnly)){var d=c.data.getTarget();if(!d.isReadOnly()||d.type==CKEDITOR.NODE_ELEMENT&&d.is("html")){var d=b.getRangeAtDropPosition(c,a),k=b.dragRange;d&&e(c,k,d)}}},null,null,9999);f.attachListener(a,"drop",b.initDragDataTransfer,b,null,1);f.attachListener(a,"drop",function(k){if(k=k.data){var f=k.dropRange,r=k.dragRange,e=k.dataTransfer;e.getTransferType(a)==CKEDITOR.DATA_TRANSFER_INTERNAL? -setTimeout(function(){b.internalDrop(r,f,e,a)},0):e.getTransferType(a)==CKEDITOR.DATA_TRANSFER_CROSS_EDITORS?c(r,f,e):d(f,e)}},null,null,9999)})}var p;CKEDITOR.plugins.add("clipboard",{requires:"dialog,notification,toolbar",init:function(a){function b(b){b=CKEDITOR.tools.array.map(b,function(a){return a.split("/")[1].toUpperCase()}).join(", ");return a.lang.clipboard.fileFormatNotSupportedNotification.replace(/\${formats\}/g,b)}function c(a,b){return CKEDITOR.env.ie&&a.data.fileTransferCancel||!(CKEDITOR.env.ie|| -b&&l!==b.id)?!1:b.isFileTransfer()&&1===b.getFilesCount()}var d,e=B(a);a.config.forcePasteAsPlainText?d="plain-text":a.config.pasteFilter?d=a.config.pasteFilter:!CKEDITOR.env.webkit||"pasteFilter"in a.config||(d="semantic-content");a.pasteFilter=e.get(d);x(a);D(a);CKEDITOR.dialog.add("paste",CKEDITOR.getUrl(this.path+"dialogs/paste.js"));if((CKEDITOR.plugins.clipboard.isCustomDataTypesSupported||CKEDITOR.plugins.clipboard.isFileApiSupported)&&a.config.clipboard_handleImages){var g=["image/png","image/jpeg", -"image/gif"],f=b(g),l;a.on("paste",function(b){var d=b.data,h=d.dataTransfer;if(!d.dataValue&&c(b,h))if(h=h.getFile(0),-1===CKEDITOR.tools.indexOf(g,h.type))a.showNotification(f,"info",a.config.clipboard_notificationDuration);else{var e=new FileReader;e.addEventListener("load",function(){b.data.dataValue='\x3cimg src\x3d"'+e.result+'" /\x3e';a.fire("paste",b.data)},!1);e.addEventListener("abort",function(){CKEDITOR.env.ie&&(b.data.fileTransferCancel=!0);a.fire("paste",b.data)},!1);e.addEventListener("error", -function(){CKEDITOR.env.ie&&(b.data.fileTransferCancel=!0);a.fire("paste",b.data)},!1);e.readAsDataURL(h);l=d.dataTransfer.id;b.stop()}},null,null,1)}a.on("paste",function(b){b.data.dataTransfer||(b.data.dataTransfer=new CKEDITOR.plugins.clipboard.dataTransfer);if(!b.data.dataValue){var c=b.data.dataTransfer,d=c.getData("text/html");if(d)b.data.dataValue=d,b.data.type="html";else if(d=c.getData("text/plain"))b.data.dataValue=a.editable().transformPlainTextToHtml(d),b.data.type="text"}},null,null, -1);a.on("paste",function(a){var b=a.data.dataValue,c=CKEDITOR.dtd.$block;-1 <\/span>/gi," "),"html"!=a.data.type&&(b=b.replace(/]*>([^<]*)<\/span>/gi,function(a,b){return b.replace(/\t/g,"\x26nbsp;\x26nbsp; \x26nbsp;")})),-1/,"")), -b=b.replace(/(<[^>]+) class="Apple-[^"]*"/gi,"$1"));if(b.match(/^<[^<]+cke_(editable|contents)/i)){var d,f,e=new CKEDITOR.dom.element("div");for(e.setHtml(b);1==e.getChildCount()&&(d=e.getFirst())&&d.type==CKEDITOR.NODE_ELEMENT&&(d.hasClass("cke_editable")||d.hasClass("cke_contents"));)e=f=d;f&&(b=f.getHtml().replace(/
$/i,""))}CKEDITOR.env.ie?b=b.replace(/^ (?: |\r\n)?<(\w+)/g,function(b,d){return d.toLowerCase()in c?(a.data.preSniffing="html","\x3c"+d):b}):CKEDITOR.env.webkit?b=b.replace(/<\/(\w+)>


<\/div>$/, -function(b,d){return d in c?(a.data.endsWithEOL=1,"\x3c/"+d+"\x3e"):b}):CKEDITOR.env.gecko&&(b=b.replace(/(\s)
$/,"$1"));a.data.dataValue=b},null,null,3);a.on("paste",function(b){b=b.data;var c=a._.nextPasteType||b.type,d=b.dataValue,f,g=a.config.clipboard_defaultContentType||"html",l=b.dataTransfer.getTransferType(a)==CKEDITOR.DATA_TRANSFER_EXTERNAL,n=!0===a.config.forcePasteAsPlainText;f="html"==c||"html"==b.preSniffing?"html":y(d);delete a._.nextPasteType;"htmlifiedtext"==f&&(d=z(a.config,d)); -if("text"==c&&"html"==f)d=w(a,d,e.get("plain-text"));else if(l&&a.pasteFilter&&!b.dontFilter||n)d=w(a,d,a.pasteFilter);b.startsWithEOL&&(d='\x3cbr data-cke-eol\x3d"1"\x3e'+d);b.endsWithEOL&&(d+='\x3cbr data-cke-eol\x3d"1"\x3e');"auto"==c&&(c="html"==f||"html"==g?"html":"text");b.type=c;b.dataValue=d;delete b.preSniffing;delete b.startsWithEOL;delete b.endsWithEOL},null,null,6);a.on("paste",function(b){b=b.data;b.dataValue&&(a.insertHtml(b.dataValue,b.type,b.range),setTimeout(function(){a.fire("afterPaste")}, -0))},null,null,1E3);a.on("pasteDialog",function(b){setTimeout(function(){a.openDialog("paste",b.data)},0)})}});CKEDITOR.plugins.clipboard={isCustomCopyCutSupported:CKEDITOR.env.ie&&16>CKEDITOR.env.version||CKEDITOR.env.iOS&&605>CKEDITOR.env.version?!1:!0,isCustomDataTypesSupported:!CKEDITOR.env.ie||16<=CKEDITOR.env.version,isFileApiSupported:!CKEDITOR.env.ie||9CKEDITOR.env.version||b.isInline()?b:a.document},fixSplitNodesAfterDrop:function(a,b,c,d){function e(a,c,d){var e=a;e.type==CKEDITOR.NODE_TEXT&&(e=a.getParent());if(e.equals(c)&&d!=c.getChildCount())return a=b.startContainer.getChild(b.startOffset-1),c=b.startContainer.getChild(b.startOffset),a&&a.type==CKEDITOR.NODE_TEXT&&c&&c.type==CKEDITOR.NODE_TEXT&&(d=a.getLength(),a.setText(a.getText()+c.getText()),c.remove(),b.setStart(a,d),b.collapse(!0)),!0}var g=b.startContainer;"number"==typeof d&&"number"== -typeof c&&g.type==CKEDITOR.NODE_ELEMENT&&(e(a.startContainer,g,c)||e(a.endContainer,g,d))},isDropRangeAffectedByDragRange:function(a,b){var c=b.startContainer,d=b.endOffset;return a.endContainer.equals(c)&&a.endOffset<=d||a.startContainer.getParent().equals(c)&&a.startContainer.getIndex()CKEDITOR.env.version&&this.fixSplitNodesAfterDrop(a,b,e.dragStartContainerChildCount,e.dragEndContainerChildCount);(l=this.isDropRangeAffectedByDragRange(a,b))||(f=a.createBookmark(!1));e=b.clone().createBookmark(!1);l&&(f=a.createBookmark(!1));a=f.startNode;b=f.endNode;l=e.startNode;b&&a.getPosition(l)&CKEDITOR.POSITION_PRECEDING&&b.getPosition(l)&CKEDITOR.POSITION_FOLLOWING&&l.insertBefore(a);a=d.createRange();a.moveToBookmark(f);g.extractHtmlFromRange(a,1);b=d.createRange(); -e.startNode.getCommonAncestor(g)||(e=d.getSelection().createBookmarks()[0]);b.moveToBookmark(e);u(d,{dataTransfer:c,method:"drop",range:b},1);d.fire("unlockSnapshot")},getRangeAtDropPosition:function(a,b){var c=a.data.$,d=c.clientX,e=c.clientY,g=b.getSelection(!0).getRanges()[0],f=b.createRange();if(a.data.testRange)return a.data.testRange;if(document.caretRangeFromPoint&&b.document.$.caretRangeFromPoint(d,e))c=b.document.$.caretRangeFromPoint(d,e),f.setStart(CKEDITOR.dom.node(c.startContainer),c.startOffset), -f.collapse(!0);else if(c.rangeParent)f.setStart(CKEDITOR.dom.node(c.rangeParent),c.rangeOffset),f.collapse(!0);else{if(CKEDITOR.env.ie&&8k&&!l;k++){if(!l)try{c.moveToPoint(d,e-k),l=!0}catch(p){}if(!l)try{c.moveToPoint(d,e+k),l=!0}catch(h){}}if(l){var m="cke-temp-"+(new Date).getTime();c.pasteHTML('\x3cspan id\x3d"'+m+'"\x3e​\x3c/span\x3e'); -var q=b.document.getById(m);f.moveToPosition(q,CKEDITOR.POSITION_BEFORE_START);q.remove()}else{var t=b.document.$.elementFromPoint(d,e),n=new CKEDITOR.dom.element(t),v;if(n.equals(b.editable())||"html"==n.getName())return g&&g.startContainer&&!g.startContainer.equals(b.editable())?g:null;v=n.getClientRect();d/i,fragmentRegExp:/\s*\x3c!--StartFragment--\x3e|\x3c!--EndFragment--\x3e\s*/g, -types:[],data:{},files:[],nativeHtmlCache:"",normalizeType:function(a){a=a.toLowerCase();return"text"==a||"text/plain"==a?"Text":"url"==a?"URL":"files"===a?"Files":a}};this._.fallbackDataTransfer=new CKEDITOR.plugins.clipboard.fallbackDataTransfer(this);this.id=this.getData(p);this.id||(this.id="Text"==p?"":"cke-"+CKEDITOR.tools.getUniqueId());b&&(this.sourceEditor=b,this.setData("text/html",b.getSelectedHtml(1)),"Text"==p||this.getData("text/plain")||this.setData("text/plain",b.getSelection().getSelectedText()))}; +for(var q=a.toolbox.toolbars,n=D(a),g=n.length,l=0;l]+data-cke-bookmark[^<]*?<\/span>/ig, +"");h&&t(a,c)})}function p(){if("wysiwyg"==a.mode){var b=k("paste");a.getCommand("cut").setState(k("cut"));a.getCommand("copy").setState(k("copy"));a.getCommand("paste").setState(b);a.fire("pasteState",b)}}function k(b){var c=a.getSelection(),c=c&&c.getRanges()[0];if((a.readOnly||c&&c.checkReadOnly())&&b in{paste:1,cut:1})return CKEDITOR.TRISTATE_DISABLED;if("paste"==b)return CKEDITOR.TRISTATE_OFF;b=a.getSelection();c=b.getRanges();return b.getType()==CKEDITOR.SELECTION_NONE||1==c.length&&c[0].collapsed? +CKEDITOR.TRISTATE_DISABLED:CKEDITOR.TRISTATE_OFF}var n=CKEDITOR.plugins.clipboard,u=0,w=0;(function(){a.on("key",h);a.on("contentDom",b);a.on("selectionChange",p);if(a.contextMenu){a.contextMenu.addListener(function(){return{cut:k("cut"),copy:k("copy"),paste:k("paste")}});var c=null;a.on("menuShow",function(){c&&(c.removeListener(),c=null);var b=a.contextMenu.findItemByCommandName("paste");b&&b.element&&(c=b.element.on("touchend",function(){a._.forcePasteDialog=!0}))})}if(a.ui.addButton)a.once("instanceReady", +function(){a._.pasteButtons&&CKEDITOR.tools.array.forEach(a._.pasteButtons,function(b){if(b=a.ui.get(b))if(b=CKEDITOR.document.getById(b._.id))b.on("touchend",function(){a._.forcePasteDialog=!0})})})})();(function(){function b(c,h,d,m,e){var p=a.lang.clipboard[h];a.addCommand(h,d);a.ui.addButton&&a.ui.addButton(c,{label:p,command:h,toolbar:"clipboard,"+m});a.addMenuItems&&a.addMenuItem(h,{label:p,command:h,group:"clipboard",order:e})}b("Cut","cut",c("cut"),10,1);b("Copy","copy",c("copy"),20,4);b("Paste", +"paste",d(),30,8);a._.pasteButtons||(a._.pasteButtons=[]);a._.pasteButtons.push("Paste")})();a.getClipboardData=function(b,c){function h(a){a.removeListener();a.cancel();c(a.data)}function d(a){a.removeListener();a.cancel();c({type:e,dataValue:a.data.dataValue,dataTransfer:a.data.dataTransfer,method:"paste"})}var m=!1,e="auto";c||(c=b,b=null);a.on("beforePaste",function(a){a.removeListener();m=!0;e=a.data.type},null,null,1E3);a.on("paste",h,null,null,0);!1===v()&&(a.removeListener("paste",h),a._.forcePasteDialog&& +m&&a.fire("pasteDialog")?(a.on("pasteDialogCommit",d),a.on("dialogHide",function(a){a.removeListener();a.data.removeListener("pasteDialogCommit",d);a.data._.committed||c(null)})):c(null))}}function z(a){if(CKEDITOR.env.webkit){if(!a.match(/^[^<]*$/g)&&!a.match(/^(
<\/div>|
[^<]*<\/div>)*$/gi))return"html"}else if(CKEDITOR.env.ie){if(!a.match(/^([^<]|)*$/gi)&&!a.match(/^(

([^<]|)*<\/p>|(\r\n))*$/gi))return"html"}else if(CKEDITOR.env.gecko){if(!a.match(/^([^<]|)*$/gi))return"html"}else return"html"; +return"htmlifiedtext"}function A(a,b){function c(a){return CKEDITOR.tools.repeat("\x3c/p\x3e\x3cp\x3e",~~(a/2))+(1==a%2?"\x3cbr\x3e":"")}b=b.replace(/(?!\u3000)\s+/g," ").replace(/> +/gi,"\x3cbr\x3e");b=b.replace(/<\/?[A-Z]+>/g,function(a){return a.toLowerCase()});if(b.match(/^[^<]$/))return b;CKEDITOR.env.webkit&&-1(
|)<\/div>)(?!$|(

(
|)<\/div>))/g,"\x3cbr\x3e").replace(/^(
(
|)<\/div>){2}(?!$)/g,"\x3cdiv\x3e\x3c/div\x3e"), +b.match(/
(
|)<\/div>/)&&(b="\x3cp\x3e"+b.replace(/(
(
|)<\/div>)+/g,function(a){return c(a.split("\x3c/div\x3e\x3cdiv\x3e").length+1)})+"\x3c/p\x3e"),b=b.replace(/<\/div>
/g,"\x3cbr\x3e"),b=b.replace(/<\/?div>/g,""));CKEDITOR.env.gecko&&a.enterMode!=CKEDITOR.ENTER_BR&&(CKEDITOR.env.gecko&&(b=b.replace(/^

$/,"\x3cbr\x3e")),-1){2,}/g,function(a){return c(a.length/4)})+"\x3c/p\x3e"));return B(a,b)}function C(a){function b(){var a= +{},b;for(b in CKEDITOR.dtd)"$"!=b.charAt(0)&&"div"!=b&&"span"!=b&&(a[b]=1);return a}var c={};return{get:function(d){return"plain-text"==d?c.plainText||(c.plainText=new CKEDITOR.filter(a,"br")):"semantic-content"==d?((d=c.semanticContent)||(d=new CKEDITOR.filter(a,{}),d.allow({$1:{elements:b(),attributes:!0,styles:!1,classes:!1}}),d=c.semanticContent=d),d):d?new CKEDITOR.filter(a,d):null}}}function x(a,b,c){b=CKEDITOR.htmlParser.fragment.fromHtml(b);var d=new CKEDITOR.htmlParser.basicWriter;c.applyTo(b, +!0,!1,a.activeEnterMode);b.writeHtml(d);return d.getHtml()}function B(a,b){a.enterMode==CKEDITOR.ENTER_BR?b=b.replace(/(<\/p>

)+/g,function(a){return CKEDITOR.tools.repeat("\x3cbr\x3e",a.length/7*2)}).replace(/<\/?p>/g,""):a.enterMode==CKEDITOR.ENTER_DIV&&(b=b.replace(/<(\/)?p>/g,"\x3c$1div\x3e"));return b}function D(a){a.data.preventDefault();a.data.$.dataTransfer.dropEffect="none"}function E(a){var b=CKEDITOR.plugins.clipboard;a.on("contentDom",function(){function c(b,c,d){c.select();t(a,{dataTransfer:d, +method:"drop"},1);d.sourceEditor.fire("saveSnapshot");d.sourceEditor.editable().extractHtmlFromRange(b);d.sourceEditor.getSelection().selectRanges([b]);d.sourceEditor.fire("saveSnapshot")}function d(c,d){c.select();t(a,{dataTransfer:d,method:"drop"},1);b.resetDragDataTransfer()}function g(b,c,d){var e={$:b.data.$,target:b.data.getTarget()};c&&(e.dragRange=c);d&&(e.dropRange=d);!1===a.fire(b.name,e)&&b.data.preventDefault()}function f(a){a.type!=CKEDITOR.NODE_ELEMENT&&(a=a.getParent());return a.getChildCount()} +var e=a.editable(),l=CKEDITOR.plugins.clipboard.getDropTarget(a),q=a.ui.space("top"),v=a.ui.space("bottom");b.preventDefaultDropOnElement(q);b.preventDefaultDropOnElement(v);e.attachListener(l,"dragstart",g);e.attachListener(a,"dragstart",b.resetDragDataTransfer,b,null,1);e.attachListener(a,"dragstart",function(c){b.initDragDataTransfer(c,a)},null,null,2);e.attachListener(a,"dragstart",function(){var c=b.dragRange=a.getSelection().getRanges()[0];CKEDITOR.env.ie&&10>CKEDITOR.env.version&&(b.dragStartContainerChildCount= +c?f(c.startContainer):null,b.dragEndContainerChildCount=c?f(c.endContainer):null)},null,null,100);e.attachListener(l,"dragend",g);e.attachListener(a,"dragend",b.initDragDataTransfer,b,null,1);e.attachListener(a,"dragend",b.resetDragDataTransfer,b,null,100);e.attachListener(l,"dragover",function(a){if(CKEDITOR.env.edge)a.data.preventDefault();else{var b=a.data.getTarget();b&&b.is&&b.is("html")?a.data.preventDefault():CKEDITOR.env.ie&&CKEDITOR.plugins.clipboard.isFileApiSupported&&a.data.$.dataTransfer.types.contains("Files")&& +a.data.preventDefault()}});e.attachListener(l,"drop",function(c){if(!c.data.$.defaultPrevented&&(c.data.preventDefault(),!a.readOnly)){var d=c.data.getTarget();if(!d.isReadOnly()||d.type==CKEDITOR.NODE_ELEMENT&&d.is("html")){var d=b.getRangeAtDropPosition(c,a),e=b.dragRange;d&&g(c,e,d)}}},null,null,9999);e.attachListener(a,"drop",b.initDragDataTransfer,b,null,1);e.attachListener(a,"drop",function(h){if(h=h.data){var e=h.dropRange,p=h.dragRange,k=h.dataTransfer;k.getTransferType(a)==CKEDITOR.DATA_TRANSFER_INTERNAL? +setTimeout(function(){b.internalDrop(p,e,k,a)},0):k.getTransferType(a)==CKEDITOR.DATA_TRANSFER_CROSS_EDITORS?c(p,e,k):d(e,k)}},null,null,9999)})}var r;CKEDITOR.plugins.add("clipboard",{requires:"dialog,notification,toolbar",_supportedFileMatchers:[],init:function(a){function b(a){return-1!==CKEDITOR.tools.indexOf(["image/png","image/jpeg","image/gif"],a.type)}function c(b){return CKEDITOR.tools.array.some(a.plugins.clipboard._supportedFileMatchers,function(a){return a(b)})}function d(b){b.length&& +(b=CKEDITOR.tools.array.unique(b),b=CKEDITOR.tools.array.filter(b,function(a){return!!CKEDITOR.tools.trim(a)}),b=g(b.join(", ")),a.showNotification(b,"info",a.config.clipboard_notificationDuration))}function g(b){return b?a.lang.clipboard.fileFormatNotSupportedNotification.replace(/\${formats\}/g,"\x3cem\x3e"+b+"\x3c/em\x3e"):a.lang.clipboard.fileWithoutFormatNotSupportedNotification}function f(a,b){return CKEDITOR.env.ie&&a.data.fileTransferCancel||!(CKEDITOR.env.ie||b&&v!==b.id)?!1:b.isFileTransfer()&& +1===b.getFilesCount()}var e,l=C(a);a.config.forcePasteAsPlainText?e="plain-text":a.config.pasteFilter?e=a.config.pasteFilter:!CKEDITOR.env.webkit||"pasteFilter"in a.config||(e="semantic-content");a.pasteFilter=l.get(e);y(a);E(a);CKEDITOR.dialog.add("paste",CKEDITOR.getUrl(this.path+"dialogs/paste.js"));var q=CKEDITOR.plugins.clipboard.isCustomDataTypesSupported||CKEDITOR.plugins.clipboard.isFileApiSupported,v;CKEDITOR.plugins.clipboard.addFileMatcher(a,b);a.on("paste",function(a){if(q){var b=a.data; +a=b.dataTransfer;if(!b.dataValue){for(var b=[],e=0;e <\/span>/gi," "),"html"!=a.data.type&&(b=b.replace(/]*>([^<]*)<\/span>/gi,function(a,b){return b.replace(/\t/g,"\x26nbsp;\x26nbsp; \x26nbsp;")})),-1/, +"")),b=b.replace(/(<[^>]+) class="Apple-[^"]*"/gi,"$1"));if(b.match(/^<[^<]+cke_(editable|contents)/i)){var d,e,f=new CKEDITOR.dom.element("div");for(f.setHtml(b);1==f.getChildCount()&&(d=f.getFirst())&&d.type==CKEDITOR.NODE_ELEMENT&&(d.hasClass("cke_editable")||d.hasClass("cke_contents"));)f=e=d;e&&(b=e.getHtml().replace(/
$/i,""))}CKEDITOR.env.ie?b=b.replace(/^ (?: |\r\n)?<(\w+)/g,function(b,d){return d.toLowerCase()in c?(a.data.preSniffing="html","\x3c"+d):b}):CKEDITOR.env.webkit?b=b.replace(/<\/(\w+)>


<\/div>$/, +function(b,d){return d in c?(a.data.endsWithEOL=1,"\x3c/"+d+"\x3e"):b}):CKEDITOR.env.gecko&&(b=b.replace(/(\s)
$/,"$1"));a.data.dataValue=b},null,null,3);a.on("paste",function(b){b=b.data;var c=a._.nextPasteType||b.type,d=b.dataValue,e,f=a.config.clipboard_defaultContentType||"html",g=b.dataTransfer.getTransferType(a)==CKEDITOR.DATA_TRANSFER_EXTERNAL,q=!0===a.config.forcePasteAsPlainText;e="html"==c||"html"==b.preSniffing?"html":z(d);delete a._.nextPasteType;"htmlifiedtext"==e&&(d=A(a.config,d)); +if("text"==c&&"html"==e)d=x(a,d,l.get("plain-text"));else if(g&&a.pasteFilter&&!b.dontFilter||q)d=x(a,d,a.pasteFilter);b.startsWithEOL&&(d='\x3cbr data-cke-eol\x3d"1"\x3e'+d);b.endsWithEOL&&(d+='\x3cbr data-cke-eol\x3d"1"\x3e');"auto"==c&&(c="html"==e||"html"==f?"html":"text");b.type=c;b.dataValue=d;delete b.preSniffing;delete b.startsWithEOL;delete b.endsWithEOL},null,null,6);a.on("paste",function(b){b=b.data;b.dataValue&&(a.insertHtml(b.dataValue,b.type,b.range),setTimeout(function(){a.fire("afterPaste")}, +0))},null,null,1E3);a.on("pasteDialog",function(b){setTimeout(function(){a.openDialog("paste",b.data)},0)})}});CKEDITOR.plugins.clipboard={addFileMatcher:function(a,b){a.plugins.clipboard._supportedFileMatchers.push(b)},isCustomCopyCutSupported:CKEDITOR.env.ie&&16>CKEDITOR.env.version||CKEDITOR.env.iOS&&605>CKEDITOR.env.version?!1:!0,isCustomDataTypesSupported:!CKEDITOR.env.ie||16<=CKEDITOR.env.version,isFileApiSupported:!CKEDITOR.env.ie||9CKEDITOR.env.version||b.isInline()?b:a.document},fixSplitNodesAfterDrop:function(a,b,c,d){function g(a,c,d){var f=a;f.type==CKEDITOR.NODE_TEXT&&(f=a.getParent());if(f.equals(c)&&d!=c.getChildCount())return a=b.startContainer.getChild(b.startOffset-1),c=b.startContainer.getChild(b.startOffset),a&&a.type==CKEDITOR.NODE_TEXT&&c&&c.type==CKEDITOR.NODE_TEXT&&(d=a.getLength(),a.setText(a.getText()+c.getText()),c.remove(),b.setStart(a, +d),b.collapse(!0)),!0}var f=b.startContainer;"number"==typeof d&&"number"==typeof c&&f.type==CKEDITOR.NODE_ELEMENT&&(g(a.startContainer,f,c)||g(a.endContainer,f,d))},isDropRangeAffectedByDragRange:function(a,b){var c=b.startContainer,d=b.endOffset;return a.endContainer.equals(c)&&a.endOffset<=d||a.startContainer.getParent().equals(c)&&a.startContainer.getIndex()CKEDITOR.env.version&&this.fixSplitNodesAfterDrop(a,b,g.dragStartContainerChildCount,g.dragEndContainerChildCount);(l=this.isDropRangeAffectedByDragRange(a,b))||(e=a.createBookmark(!1));g=b.clone().createBookmark(!1);l&&(e=a.createBookmark(!1));a=e.startNode;b=e.endNode;l=g.startNode;b&&a.getPosition(l)&CKEDITOR.POSITION_PRECEDING&&b.getPosition(l)&CKEDITOR.POSITION_FOLLOWING&&l.insertBefore(a);a=d.createRange(); +a.moveToBookmark(e);f.extractHtmlFromRange(a,1);b=d.createRange();g.startNode.getCommonAncestor(f)||(g=d.getSelection().createBookmarks()[0]);b.moveToBookmark(g);t(d,{dataTransfer:c,method:"drop",range:b},1);d.fire("unlockSnapshot")},getRangeAtDropPosition:function(a,b){var c=a.data.$,d=c.clientX,g=c.clientY,f=b.getSelection(!0).getRanges()[0],e=b.createRange();if(a.data.testRange)return a.data.testRange;if(document.caretRangeFromPoint&&b.document.$.caretRangeFromPoint(d,g))c=b.document.$.caretRangeFromPoint(d, +g),e.setStart(CKEDITOR.dom.node(c.startContainer),c.startOffset),e.collapse(!0);else if(c.rangeParent)e.setStart(CKEDITOR.dom.node(c.rangeParent),c.rangeOffset),e.collapse(!0);else{if(CKEDITOR.env.ie&&8q&&!l;q++){if(!l)try{c.moveToPoint(d,g-q),l=!0}catch(r){}if(!l)try{c.moveToPoint(d,g+q),l=!0}catch(h){}}if(l){var m="cke-temp-"+(new Date).getTime(); +c.pasteHTML('\x3cspan id\x3d"'+m+'"\x3e​\x3c/span\x3e');var p=b.document.getById(m);e.moveToPosition(p,CKEDITOR.POSITION_BEFORE_START);p.remove()}else{var k=b.document.$.elementFromPoint(d,g),n=new CKEDITOR.dom.element(k),u;if(n.equals(b.editable())||"html"==n.getName())return f&&f.startContainer&&!f.startContainer.equals(b.editable())?f:null;u=n.getClientRect();d/i,fragmentRegExp:/\s*\x3c!--StartFragment--\x3e|\x3c!--EndFragment--\x3e\s*/g, +types:[],data:{},files:[],nativeHtmlCache:"",normalizeType:function(a){a=a.toLowerCase();return"text"==a||"text/plain"==a?"Text":"url"==a?"URL":"files"===a?"Files":a}};this._.fallbackDataTransfer=new CKEDITOR.plugins.clipboard.fallbackDataTransfer(this);this.id=this.getData(r);this.id||(this.id="Text"==r?"":"cke-"+CKEDITOR.tools.getUniqueId());b&&(this.sourceEditor=b,this.setData("text/html",b.getSelectedHtml(1)),"Text"==r||this.getData("text/plain")||this.setData("text/plain",b.getSelection().getSelectedText()))}; CKEDITOR.DATA_TRANSFER_INTERNAL=1;CKEDITOR.DATA_TRANSFER_CROSS_EDITORS=2;CKEDITOR.DATA_TRANSFER_EXTERNAL=3;CKEDITOR.plugins.clipboard.dataTransfer.prototype={getData:function(a,b){a=this._.normalizeType(a);var c="text/html"==a&&b?this._.nativeHtmlCache:this._.data[a];if(void 0===c||null===c||""===c){if(this._.fallbackDataTransfer.isRequired())c=this._.fallbackDataTransfer.getData(a,b);else try{c=this.$.getData(a)||""}catch(d){c=""}"text/html"!=a||b||(c=this._stripHtml(c))}"Text"==a&&CKEDITOR.env.gecko&& -this.getFilesCount()&&"file://"==c.substring(0,7)&&(c="");if("string"===typeof c)var e=c.indexOf("\x3c/html\x3e"),c=-1!==e?c.substring(0,e+7):c;return c},setData:function(a,b){a=this._.normalizeType(a);"text/html"==a?(this._.data[a]=this._stripHtml(b),this._.nativeHtmlCache=b):this._.data[a]=b;if(CKEDITOR.plugins.clipboard.isCustomDataTypesSupported||"URL"==a||"Text"==a)if("Text"==p&&"Text"==a&&(this.id=b),this._.fallbackDataTransfer.isRequired())this._.fallbackDataTransfer.setData(a,b);else try{this.$.setData(a, -b)}catch(c){}},storeId:function(){"Text"!==p&&this.setData(p,this.id)},getTransferType:function(a){return this.sourceEditor?this.sourceEditor==a?CKEDITOR.DATA_TRANSFER_INTERNAL:CKEDITOR.DATA_TRANSFER_CROSS_EDITORS:CKEDITOR.DATA_TRANSFER_EXTERNAL},cacheData:function(){function a(a){a=b._.normalizeType(a);var c=b.getData(a);"text/html"==a&&(b._.nativeHtmlCache=b.getData(a,!0),c=b._stripHtml(c));c&&(b._.data[a]=c);b._.types.push(a)}if(this.$){var b=this,c,d,e;if(CKEDITOR.plugins.clipboard.isCustomDataTypesSupported){if(this.$.types)for(c= -0;c$/gi,"")}a&&a.length&&(a=b(a),a=a.replace(this._.metaRegExp,""),a=a.replace(this._.fragmentRegExp,""));return a}};CKEDITOR.plugins.clipboard.fallbackDataTransfer=function(a){this._dataTransfer=a;this._customDataFallbackType="text/html"};CKEDITOR.plugins.clipboard.fallbackDataTransfer._isCustomMimeTypeSupported= +0;c$/gi,"")}a&&a.length&&(a=b(a),a=a.replace(this._.metaRegExp,""),a=a.replace(this._.fragmentRegExp,""));return a}};CKEDITOR.plugins.clipboard.fallbackDataTransfer=function(a){this._dataTransfer=a;this._customDataFallbackType="text/html"};CKEDITOR.plugins.clipboard.fallbackDataTransfer._isCustomMimeTypeSupported= null;CKEDITOR.plugins.clipboard.fallbackDataTransfer._customTypes=[];CKEDITOR.plugins.clipboard.fallbackDataTransfer.prototype={isRequired:function(){var a=CKEDITOR.plugins.clipboard.fallbackDataTransfer,b=this._dataTransfer.$;if(null===a._isCustomMimeTypeSupported)if(b){a._isCustomMimeTypeSupported=!1;if(CKEDITOR.env.edge&&17<=CKEDITOR.env.version)return!0;try{b.setData("cke/mimetypetest","cke test value"),a._isCustomMimeTypeSupported="cke test value"===b.getData("cke/mimetypetest"),b.clearData("cke/mimetypetest")}catch(c){}}else return!1; -return!a._isCustomMimeTypeSupported},getData:function(a,b){var c=this._getData(this._customDataFallbackType,!0);if(b)return c;var c=this._extractDataComment(c),d=null,d=a===this._customDataFallbackType?c.content:c.data&&c.data[a]?c.data[a]:this._getData(a,!0);return null!==d?d:""},setData:function(a,b){var c=a===this._customDataFallbackType;c&&(b=this._applyDataComment(b,this._getFallbackTypeData()));var d=b,e=this._dataTransfer.$;try{e.setData(a,d),c&&(this._dataTransfer._.nativeHtmlCache=d)}catch(g){if(this._isUnsupportedMimeTypeError(g)){c= -CKEDITOR.plugins.clipboard.fallbackDataTransfer;-1===CKEDITOR.tools.indexOf(c._customTypes,a)&&c._customTypes.push(a);var c=this._getFallbackTypeContent(),f=this._getFallbackTypeData();f[a]=d;try{d=this._applyDataComment(c,f),e.setData(this._customDataFallbackType,d),this._dataTransfer._.nativeHtmlCache=d}catch(l){d=""}}}return d},_getData:function(a,b){var c=this._dataTransfer._.data;if(!b&&c[a])return c[a];try{return this._dataTransfer.$.getData(a)}catch(d){return null}},_getFallbackTypeContent:function(){var a= +return!a._isCustomMimeTypeSupported},getData:function(a,b){var c=this._getData(this._customDataFallbackType,!0);if(b)return c;var c=this._extractDataComment(c),d=null,d=a===this._customDataFallbackType?c.content:c.data&&c.data[a]?c.data[a]:this._getData(a,!0);return null!==d?d:""},setData:function(a,b){var c=a===this._customDataFallbackType;c&&(b=this._applyDataComment(b,this._getFallbackTypeData()));var d=b,g=this._dataTransfer.$;try{g.setData(a,d),c&&(this._dataTransfer._.nativeHtmlCache=d)}catch(f){if(this._isUnsupportedMimeTypeError(f)){c= +CKEDITOR.plugins.clipboard.fallbackDataTransfer;-1===CKEDITOR.tools.indexOf(c._customTypes,a)&&c._customTypes.push(a);var c=this._getFallbackTypeContent(),e=this._getFallbackTypeData();e[a]=d;try{d=this._applyDataComment(c,e),g.setData(this._customDataFallbackType,d),this._dataTransfer._.nativeHtmlCache=d}catch(l){d=""}}}return d},_getData:function(a,b){var c=this._dataTransfer._.data;if(!b&&c[a])return c[a];try{return this._dataTransfer.$.getData(a)}catch(d){return null}},_getFallbackTypeContent:function(){var a= this._dataTransfer._.data[this._customDataFallbackType];a||(a=this._extractDataComment(this._getData(this._customDataFallbackType,!0)).content);return a},_getFallbackTypeData:function(){var a=CKEDITOR.plugins.clipboard.fallbackDataTransfer._customTypes,b=this._extractDataComment(this._getData(this._customDataFallbackType,!0)).data||{},c=this._dataTransfer._.data;CKEDITOR.tools.array.forEach(a,function(a){void 0!==c[a]?b[a]=c[a]:void 0!==b[a]&&(b[a]=b[a])},this);return b},_isUnsupportedMimeTypeError:function(a){return a.message&& -1!==a.message.search(/element not found/gi)},_extractDataComment:function(a){var b={data:null,content:a||""};if(a&&16|\+|~)/g," ");a=a.replace(/\[[^\]]*/g,"");a=a.replace(/#[^\s]*/g,"");a=a.replace(/\:{1,2}[^\s]*/g,"");a=a.replace(/\s+/g," ");a=a.split(" ");b=[];for(g=0;g=g)for(b=this.getNextSourceNode(k,CKEDITOR.NODE_ELEMENT);b;){if(b.isVisible()&&0===b.getTabIndex()){d=b;break}b=b.getNextSourceNode(!1,CKEDITOR.NODE_ELEMENT)}else for(b=this.getDocument().getBody().getFirst();b=b.getNextSourceNode(!1,CKEDITOR.NODE_ELEMENT);){if(!f)if(!c&&b.equals(this)){if(c=!0,k){if(!(b=b.getNextSourceNode(!0,CKEDITOR.NODE_ELEMENT)))break;f=1}}else c&&!this.contains(b)&& @@ -1193,22 +1198,23 @@ null};k.prototype={onKeydown:function(a){var b=a.data.getKey();if(229!==b)if(-1< !0))))if(0CKEDITOR.env.version&&b.enterMode!=CKEDITOR.ENTER_DIV&&d("div");if(CKEDITOR.env.webkit||CKEDITOR.env.ie&&10this.$.offsetHeight){var e=b.createRange();e[33==c?"moveToElementEditStart":"moveToElementEditEnd"](this);e.select();a.data.preventDefault()}});CKEDITOR.env.ie&&this.attachListener(c,"blur",function(){try{c.$.selection.empty()}catch(a){}});CKEDITOR.env.iOS&&this.attachListener(c,"touchend",function(){a.focus()});f=b.document.getElementsByTag("title").getItem(0); -f.data("cke-title",f.getText());CKEDITOR.env.ie&&(b.document.$.title=this._.docTitle);CKEDITOR.tools.setTimeout(function(){"unloaded"==this.status&&(this.status="ready");b.fire("contentDom");this._.isPendingFocus&&(b.focus(),this._.isPendingFocus=!1);setTimeout(function(){b.fire("dataReady")},0)},0,this)}}function y(a){function d(){var c;a.editable().attachListener(a,"selectionChange",function(){var d=a.getSelection().getSelectedElement();d&&(c&&(c.detachEvent("onresizestart",b),c=null),d.$.attachEvent("onresizestart", -b),c=d.$)})}function b(a){a.returnValue=!1}if(CKEDITOR.env.gecko)try{var c=a.document.$;c.execCommand("enableObjectResizing",!1,!a.config.disableObjectResizing);c.execCommand("enableInlineTableEditing",!1,!a.config.disableNativeTableHandles)}catch(f){}else CKEDITOR.env.ie&&11>CKEDITOR.env.version&&a.config.disableObjectResizing&&d()}function z(){var a=[];if(8<=CKEDITOR.document.$.documentMode){a.push("html.CSS1Compat [contenteditable\x3dfalse]{min-height:0 !important}");var d=[],b;for(b in CKEDITOR.dtd.$removeEmpty)d.push("html.CSS1Compat "+ -b+"[contenteditable\x3dfalse]");a.push(d.join(",")+"{display:inline-block}")}else CKEDITOR.env.gecko&&(a.push("html{height:100% !important}"),a.push("img:-moz-broken{-moz-force-broken-image-icon:1;min-width:24px;min-height:24px}"));a.push("html{cursor:text;*cursor:auto}");a.push("img,input,textarea{cursor:default}");return a.join("\n")}var n;CKEDITOR.plugins.add("wysiwygarea",{init:function(a){a.config.fullPage&&a.addFeature({allowedContent:"html head title; style [media,type]; body (*)[id]; meta link [*]", -requiredContent:"body"});a.addMode("wysiwyg",function(d){function b(b){b&&b.removeListener();if(!a.isDestroyed()&&!a.isDetached()&&(a.editable(new n(a,g.getFrameDocument().getBody())),a.setData(a.getData(1),d),v)){if(w)a.on("mode",c,{iframe:g,editor:a,callback:d});a.on("mode",function(){a.status="ready"});f()}}function c(a){a&&a.removeListener();g.on("load",function(){q&&(q=!1,l())})}function f(){r=new MutationObserver(function(a){CKEDITOR.tools.array.forEach(a,e)});r.observe(a.config.observableParent, -{childList:!0,subtree:!0})}function e(a){"childList"===a.type&&0!==a.addedNodes.length&&CKEDITOR.tools.array.forEach(a.addedNodes,h)}function h(b){b.contains&&b.contains(a.container.$)&&(w?q=!0:l())}function l(){var b=a.getData(!1),c;a.editable().preserveIframe=!0;a.editable(null);c=new n(a,g.getFrameDocument().getBody());a.editable(c);a.status="recreating";a.setData(b,{callback:d,internal:!1,noSnapshot:!1})}var k="document.open();"+(CKEDITOR.env.ie?"("+CKEDITOR.tools.fixDomain+")();":"")+"document.close();", -k=CKEDITOR.env.air?"javascript:void(0)":CKEDITOR.env.ie&&!CKEDITOR.env.edge?"javascript:void(function(){"+encodeURIComponent(k)+"}())":"",g=CKEDITOR.dom.element.createFromHtml('\x3ciframe src\x3d"'+k+'" frameBorder\x3d"0"\x3e\x3c/iframe\x3e');g.setStyles({width:"100%",height:"100%"});g.addClass("cke_wysiwyg_frame").addClass("cke_reset");k=a.ui.space("contents");k.append(g);var u=CKEDITOR.env.ie&&!CKEDITOR.env.edge||CKEDITOR.env.gecko;if(u)g.on("load",b);var m=a.title,p=a.fire("ariaEditorHelpLabel", -{}).label,q=!1,w=CKEDITOR.env.ie&&11===CKEDITOR.env.version,v=!!window.MutationObserver,r;m&&(CKEDITOR.env.ie&&p&&(m+=", "+p),g.setAttribute("title",m));if(p){var m=CKEDITOR.tools.getNextId(),t=CKEDITOR.dom.element.createFromHtml('\x3cspan id\x3d"'+m+'" class\x3d"cke_voice_label"\x3e'+p+"\x3c/span\x3e");k.append(t,1);g.setAttribute("aria-describedby",m)}a.on("beforeModeUnload",function(a){a.removeListener();t&&t.remove();v&&r.disconnect()});g.setAttributes({tabIndex:a.tabIndex,allowTransparency:"true"}); -!u&&b();a.fire("ariaWidget",g)})}});CKEDITOR.editor.prototype.addContentsCss=function(a){var d=this.config,b=d.contentsCss;CKEDITOR.tools.isArray(b)||(d.contentsCss=b?[b]:[]);d.contentsCss.push(a)};n=CKEDITOR.tools.createClass({$:function(){this.base.apply(this,arguments);this._.frameLoadedHandler=CKEDITOR.tools.addFunction(function(a){CKEDITOR.tools.setTimeout(x,0,this,a)},this);this._.docTitle=this.getWindow().getFrame().getAttribute("title")},base:CKEDITOR.editable,proto:{preserveIframe:!1,setData:function(a, -d){var b=this.editor;if(d)this.setHtml(a),this.fixInitialSelection(),b.fire("dataReady");else{this._.isLoadingData=!0;b._.dataStore={id:1};var c=b.config,f=c.fullPage,e=c.docType,h=CKEDITOR.tools.buildStyleHtml(z()).replace(/")),e("head").append(m.data("cssautoloadHide")),u.options.themes["default"]||(u.options.themes=Object.assign({"default":{name:"default",cssurls:"css/theme.css",author:"elFinder Project",license:"3-clauses BSD"}},u.options.themes),u.options.theme||(u.options.theme="default")),requestAnimationFrame(function(){"hidden"===m.css("visibility")?u.loadCss([t+"css/elfinder.min.css"],{dfd:e.Deferred().done(function(){a()}).fail(function(){i(),u.cssloaded||(u.cssloaded=!1,u.bind("init",function(){u.cssloaded||u.error(["errRead","CSS (elfinder.min)"])}))})}):a()}))}(),function(){var e,t=u.options.themes,n=Object.keys(t||{});n.length&&(e=u.storage("theme")||u.options.theme,t[e]||(e=n[0]),u.cssloaded?u.changeTheme(e):u.bind("cssloaded",function(){u.changeTheme(e)}))}(),this.optionProperties={icon:void 0,csscls:void 0,tmbUrl:void 0,uiCmdMap:{},netkey:void 0,disabled:[]},re||this.options.enableAlways||2!==e("body").children().length||(this.options.enableAlways=!0),this.options.debug===!0?this.options.debug="all":Array.isArray(this.options.debug)?!function(){var t={};e.each(u.options.debug,function(){t[this]=!0}),u.options.debug=t}():this.options.debug=!1,this.noConflicts={},this.noConflict=function(){e.each(f,function(t,n){e.fn[n]&&"function"==typeof e.fn[n].noConflict&&(u.noConflicts[n]=e.fn[n].noConflict())})},this.noConflict(),this.isCORS=!1,function(){if("undefined"!=typeof u.options.cors&&null!==u.options.cors)u.isCORS=!!u.options.cors;else{var t,i=document.createElement("a"),a=window.location.protocol,o=function(e){return e=e&&":"!==e?e:a,"https:"===e?/\:443$/:/\:80$/},r=window.location.host.replace(o(a),"");i.href=n.url,n.urlUpload&&n.urlUpload!==n.url&&(t=document.createElement("a"),t.href=n.urlUpload),(r!==i.host.replace(o(i.protocol),"")||":"!==i.protocol&&""!==i.protocol&&a!==i.protocol||t&&(r!==t.host.replace(o(t.protocol),"")||":"!==t.protocol&&""!==t.protocol&&a!==t.protocol))&&(u.isCORS=!0)}u.isCORS&&(e.isPlainObject(u.options.customHeaders)||(u.options.customHeaders={}),e.isPlainObject(u.options.xhrFields)||(u.options.xhrFields={}),u.options.requestType="post",u.options.customHeaders["X-Requested-With"]="XMLHttpRequest",u.options.xhrFields.withCredentials=!0)}(),this.requestType=/^(get|post)$/i.test(this.options.requestType)?this.options.requestType.toLowerCase():"get",s=Math.max(parseInt(this.options.requestMaxConn),1),this.optsCustomData=e.isPlainObject(this.options.customData)?this.options.customData:{},this.customData=Object.assign({},this.optsCustomData),this.prevCustomData=null,this.customHeaders=e.isPlainObject(this.options.customHeaders)?this.options.customHeaders:{},this.xhrFields=e.isPlainObject(this.options.xhrFields)?this.options.xhrFields:{},this.replaceXhrSend=function(){p||(p=XMLHttpRequest.prototype.send),XMLHttpRequest.prototype.send=function(){var t=this;return u.customHeaders&&e.each(u.customHeaders,function(e){t.setRequestHeader(e,this)}),u.xhrFields&&e.each(u.xhrFields,function(e){e in t&&(t[e]=this)}),p.apply(this,arguments)}},this.restoreXhrSend=function(){p&&(XMLHttpRequest.prototype.send=p)},this.abortCmdsOnOpen=this.options.abortCmdsOnOpen||["tmb","parents"],this.navPrefix="nav"+(i.prototype.uniqueid?i.prototype.uniqueid:"")+"-",this.cwdPrefix=i.prototype.uniqueid?"cwd"+i.prototype.uniqueid+"-":"",++i.prototype.uniqueid,this.uploadURL=n.urlUpload||n.url,this.namespace=y,this.today=new Date(oe.getFullYear(),oe.getMonth(),oe.getDate()).getTime()/1e3,this.yesterday=this.today-86400,l=this.options.UTCDate?"UTC":"",this.getHours="get"+l+"Hours",this.getMinutes="get"+l+"Minutes",this.getSeconds="get"+l+"Seconds",this.getDate="get"+l+"Date",this.getDay="get"+l+"Day",this.getMonth="get"+l+"Month",this.getFullYear="get"+l+"FullYear",this.zIndex,this.searchStatus={state:0,query:"",target:"",mime:"",mixed:!1,ininc:!1},this.lang=this.storage("lang")||this.options.lang,"jp"===this.lang&&(this.lang=this.options.lang="ja"),this.viewType=this.storage("view")||this.options.defaultView||"icons",this.sortType=this.storage("sortType")||this.options.sortType||"name",this.sortOrder=this.storage("sortOrder")||this.options.sortOrder||"asc",this.sortStickFolders=this.storage("sortStickFolders"),null===this.sortStickFolders?this.sortStickFolders=!!this.options.sortStickFolders:this.sortStickFolders=!!this.sortStickFolders,this.sortAlsoTreeview=this.storage("sortAlsoTreeview"),null===this.sortAlsoTreeview||null===this.options.sortAlsoTreeview?this.sortAlsoTreeview=!!this.options.sortAlsoTreeview:this.sortAlsoTreeview=!!this.sortAlsoTreeview,this.sortRules=e.extend(!0,{},this._sortRules,this.options.sortRules),e.each(this.sortRules,function(e,t){"function"!=typeof t&&delete u.sortRules[e]}),this.compare=e.proxy(this.compare,this),this.notifyDelay=this.options.notifyDelay>0?parseInt(this.options.notifyDelay):500,this.draggingUiHelper=null,this.droppable={greedy:!0,tolerance:"pointer",accept:".elfinder-cwd-file-wrapper,.elfinder-navbar-dir,.elfinder-cwd-file,.elfinder-cwd-filename",hoverClass:this.res("class","adroppable"),classes:{"ui-droppable-hover":this.res("class","adroppable")},autoDisable:!0,drop:function(t,n){var i,a,o,r=e(this),s=e.grep(n.helper.data("files")||[],function(e){return!!e}),l=[],c=[],d=[],p=n.helper.hasClass("elfinder-drag-helper-plus"),h="class";if("undefined"==typeof t.button||n.helper.data("namespace")!==y||!u.insideWorkzone(t.pageX,t.pageY))return!1;for(a=r.hasClass(u.res(h,"cwdfile"))?u.cwdId2Hash(r.attr("id")):r.hasClass(u.res(h,"navdir"))?u.navId2Hash(r.attr("id")):j,i=s.length;i--;)o=s[i],o!=a&&I[o].phash!=a?l.push(o):(p&&o!==a&&I[a].write?c:d).push(o);return!d.length&&(n.helper.data("droped",!0),c.length&&(n.helper.hide(),u.exec("duplicate",c,{_userAction:!0})),void(l.length&&(n.helper.hide(),u.clipboard(l,!p),u.exec("paste",a,{_userAction:!0},a).always(function(){u.clipboard([]),u.trigger("unlockfiles",{files:s})}),u.trigger("drop",{files:s}))))}},this.enabled=function(){return z&&this.visible()},this.visible=function(){return m[0].elfinder&&m.is(":visible")},this.isRoot=function(e){return!(!e.isroot&&e.phash)},this.root=function(t,n){t=t||j;var i,a;if(!n&&(e.each(u.roots,function(e,n){if(0===t.indexOf(e))return i=n,!1}),i))return i;for(i=I[t];i&&i.phash&&(n||!i.isroot);)i=I[i.phash];if(i)return i.hash;for(;a in I&&I.hasOwnProperty(a);)if(i=I[a],"directory"===i.mime&&!i.phash&&i.read)return i.hash;return""},this.cwd=function(){return I[j]||{}},this.option=function(t,n){var i,a;return n=n||j,u.optionsByHashes[n]&&"undefined"!=typeof u.optionsByHashes[n][t]?u.optionsByHashes[n][t]:!u.hasVolOptions||j===n||(a=u.file(n))&&a.phash===j?O[t]||"":(i="",e.each(u.volOptions,function(e,a){if(0===n.indexOf(e))return i=a[t]||"",!1}),i)},this.getDisabledCmds=function(t,n){var i={hidden:!0};return Array.isArray(t)||(t=[t]),e.each(t,function(e,t){var n=u.option("disabledFlip",t);n&&Object.assign(i,n)}),n?i:Object.keys(i)},this.file=function(e,t){return e?I[e]||(t?M[e]:void 0):void 0},this.files=function(t){var n={};return t?E[t]?(e.each(E[t],function(e){I[e]?n[e]=I[e]:delete E[t][e]}),Object.assign({},n)):{}:Object.assign({},I)},this.parents=function(e){for(var t,n=[];e&&(t=this.file(e));)n.unshift(t.hash),e=t.phash;return n},this.path2array=function(e,t){for(var n,i=[];e;){if(!(n=I[e])||!n.hash){i=[];break}i.unshift(t&&n.i18?n.i18:n.name),e=n.isroot?null:n.phash}return i},this.path=function(t,n,i){var a=I[t]&&I[t].path?I[t].path:this.path2array(t,n).join(O.separator);if(i&&I[t]){i=Object.assign({notify:{type:"parents",cnt:1,hideCnt:!0}},i);var o,r=e.Deferred(),s=i.notify,l=!1,c=function(){u.request({data:{cmd:"parents",target:I[t].phash},notify:s,preventFail:!0}).done(d).fail(function(){r.reject()})},d=function(){u.one("parentsdone",function(){a=u.path(t,n),""===a&&l?(l=!1,c()):(s&&(clearTimeout(o),s.cnt=-parseInt(s.cnt||0),u.notify(s)),r.resolve(a))})};return a?r.resolve(a):(u.ui.tree?(s&&(o=setTimeout(function(){u.notify(s)},u.notifyDelay)),l=!0,d(!0)):c(),r)}return a},this.url=function(t,n){var i,a=I[t],o=n||{},r=o.async||!1,s=o.temporary||!1,l=o.onetime&&u.option("onetimeUrl",t)||!1,c=o.absurl||!1,d=r||l?e.Deferred():null,p=function(e){return e&&c&&(e=u.convAbsUrl(e)),e},h=function(n){if(n)return p(n);if(a.url)return p(a.url);if("undefined"==typeof i&&(i=f()),i)return p(i+e.map(u.path2array(t),function(e){return encodeURIComponent(e)}).slice(1).join("/"));var o=Object.assign({},u.customData,{cmd:"file",target:a.hash});return u.oldAPI&&(o.cmd="open",o.current=a.phash),p(u.options.url+(u.options.url.indexOf("?")===-1?"?":"&")+e.param(o,!0))},f=function(){return u.option("url",!u.isRoot(a)&&a.phash||a.hash)};if(!a||!a.read)return r?d.resolve(""):"";if(!l||a.url&&"1"!=a.url||(i=f()))if("1"==a.url||s&&!a.url&&!(i=f()))this.request({data:{cmd:"url",target:t,options:{temporary:s?1:0}},preventDefault:!0,options:{async:r},notify:r?{type:s?"file":"url",cnt:1,hideCnt:!0}:{},progressBar:o.progressBar}).done(function(e){a.url=e.url||""}).fail(function(){a.url=""}).always(function(){var e;return a.url&&s&&(e=a.url,a.url="1"),r?void d.resolve(h(e)):h(e)});else{if(!r)return h();d.resolve(h())}else r=!0,this.request({data:{cmd:"url",target:t,options:{onetime:1}},preventDefault:!0,options:{async:r},notify:{type:"file",cnt:1,hideCnt:!0},progressBar:o.progressBar}).done(function(e){d.resolve(p(e.url||""))}).fail(function(){d.resolve("")});return r?d:void 0},this.forExternalUrl=function(e,t){var n=u.option("onetimeUrl",e),i={async:!0,absurl:!0};return i[n?"onetime":"temporary"]=!0,u.url(e,Object.assign({},t,i))},this.openUrl=function(t,n,i,a){var o=I[t],r="",s=(a||{}).onetimeSize||5242880;return o&&o.read?n&&"sameorigin"!==n||(o.url?1!=o.url&&(r=o.url):O.url&&0===o.hash.indexOf(u.cwd().volumeid)&&(r=O.url+e.map(this.path2array(t),function(e){return encodeURIComponent(e)}).slice(1).join("/")),n&&!this.isSameOrigin(r)||!r)?i&&this.hasParrotHeaders()?(a?delete a.onetimeSize:a={},!a.onetime&&!a.temporary&&o.size>s&&(o.mime.match(/^video|audio/)?a.temporary=!0:a.onetime=!0),a.onetime||a.temporary?this.url(o.hash,Object.assign({async:!0},a)).done(function(e){i(e)}).fail(function(){i("")}):this.getContents(t,"blob",a).done(function(e){r=(window.URL||window.webkitURL).createObjectURL(e),i(r)}).fail(function(){i("")})):(r=this.options.url,r=r+(r.indexOf("?")===-1?"?":"&")+(this.oldAPI?"cmd=open¤t="+o.phash:"cmd=file")+"&target="+o.hash+"&_t="+(o.ts||parseInt(+new Date/1e3)),n===!0&&(r+="&download=1"),e.each(this.customData,function(e,t){r+="&"+encodeURIComponent(e)+"="+encodeURIComponent(t)}),i?void i(r):r):(r+=(r.match(/\?/)?"&":"?")+"_".repeat((r.match(/[\?&](_+)t=/g)||["&t="]).sort().shift().match(/[\?&](_*)t=/)[1].length+1)+"t="+(o.ts||parseInt(+new Date/1e3)),i?void i(r):r):""},this.tmb=function(t){var n,i,a="elfinder-cwd-bgurl",o="",r={},s=0;return!(!e.isPlainObject(t)||(u.searchStatus.state&&0!==t.hash.indexOf(u.cwd().volumeid)?(n=u.option("tmbUrl",t.hash),i=u.option("tmbCrop",t.hash)):(n=O.tmbUrl,i=O.tmbCrop),i&&(a+=" elfinder-cwd-bgurl-crop"),"self"===n&&0===t.mime.indexOf("image/")?(o=u.openUrl(t.hash),a+=" elfinder-cwd-bgself"):(u.oldAPI||n)&&t&&t.tmb&&1!=t.tmb?o=n+t.tmb:u.newAPI&&t&&t.tmb&&1!=t.tmb&&(o=t.tmb),!o))&&("self"!==n&&(t.ts&&(r._t=t.ts),O.tmbReqCustomData&&Object.keys(this.customData).length&&(r=Object.assign(r,this.customData)),Object.keys(r).length&&(o+=o.match(/\?/)?"&":"?",e.each(r,function(e,t){o+=(0===s++?"":"&")+encodeURIComponent(e)+"="+encodeURIComponent(t)}))),{url:o,className:a})},this.selected=function(){return F.slice(0)},this.selectedFiles=function(){return e.map(F,function(e){return I[e]?Object.assign({},I[e]):null})},this.fileByName=function(e,t){var n;for(n in I)if(I.hasOwnProperty(n)&&I[n].phash==t&&I[n].name==e)return I[n]},this.validResponse=function(e,t){return t.error||this.rules[this.rules[e]?e:"defaults"](t)},this.returnBytes=function(e){var t;return isNaN(e)?(e||(e=""),e=e.replace(/b$/i,""),t=e.charAt(e.length-1).toLowerCase(),e=e.replace(/[tgmk]$/i,""),"t"==t?e=1024*e*1024*1024*1024:"g"==t?e=1024*e*1024*1024:"m"==t?e=1024*e*1024:"k"==t&&(e=1024*e),e=isNaN(e)?0:parseInt(e)):(e=parseInt(e),e<1&&(e=0)),e},this.request=function(t){var n,i,a,o,r=this,l=this.options,c=e.Deferred(),d=(+new Date).toString(16)+Math.floor(1e3*Math.random()).toString(16),p=Object.assign({},r.customData,{mimes:l.onlyMimes},t.data||t),u=p.cmd,h="binary"===(t.options||{}).dataType,f=!t.asNotOpen&&"open"===u,m=!(h||t.preventDefault||t.preventFail),g=!(h||t.preventDefault||t.preventDone),v=t.progressVal||20,b=null,y=!1,w=t.progressBar?{}:t.notify?Object.assign({progress:v*t.notify.cnt},t.notify):{},x=!!t.cancel,k=h||!!t.raw,C=t.syncOnFail,z=!!t.lazy,T=t.prepare,A=t.navigate,I=(t.options||{}).cache,M=Object.assign({url:l.url,async:!0,type:this.requestType,dataType:"json",cache:r.api>=2.1029,data:p,headers:this.customHeaders,xhrFields:this.xhrFields,progress:function(e){var n=e.loaded/e.total*100;if(b&&clearTimeout(b),t.progressBar)try{t.progressBar.width(n+"%")}catch(e){}else y&&w.type&&(n*=w.cnt,v=500)n=["errResponse","errServerError","HTTP error "+e.status];else{if(414==e.status&&"get"===M.type)return M.type="post",r.abortXHR(e),void(c.xhr=e=r.transport.send(M).fail(n).done(D));n=e.quiet?"":["errConnect","HTTP error "+e.status]}}r.trigger(u+"done"),c.reject({error:n},e,t)},D=function(t){if(r.currentReqCmd=u,t.debug&&r.responseDebug(t),r.setCustomHeaderByXhr(i),k)return r.abortXHR(i),t&&t.debug&&r.debug("backend-debug",t),c.resolve(t);if(!t)return c.reject({error:["errResponse","errDataEmpty"]},i,t);if(!e.isPlainObject(t))return c.reject({error:["errResponse","errDataNotJSON"]},i,t);if(t.error)return f&&e.each(r.leafRoots,function(t,n){r.leafRoots[t]=e.grep(n,function(e){return e!==p.target})}),c.reject({error:t.error},i,t);var n=function(){var n,a=function(n){r.leafRoots[p.target]&&t[n]&&e.each(r.leafRoots[p.target],function(e,i){var a;(a=r.file(i))&&t[n].push(a)})},o=function(){r.textMimes={},e.each(r.res("mimes","text"),function(){r.textMimes[this.toLowerCase()]=!0})};return f?a("files"):"tree"===u&&a("tree"),t=r.normalize(t),r.validResponse(u,t)?(f&&(r.api||(r.api=t.api||1,"2.0"==r.api&&"undefined"!=typeof t.options.uploadMaxSize&&(r.api="2.1"),r.newAPI=r.api>=2,r.oldAPI=!r.newAPI),t.textMimes&&Array.isArray(t.textMimes)&&(r.resources.mimes.text=t.textMimes,o()),!r.textMimes&&o(),t.options&&(O=Object.assign({},S,t.options)),t.netDrivers&&(r.netDrivers=t.netDrivers),t.maxTargets&&(r.maxTargets=t.maxTargets),p.init&&(r.uplMaxSize=r.returnBytes(t.uplMaxSize),r.uplMaxFile=t.uplMaxFile?Math.min(parseInt(t.uplMaxFile),50):20)),"function"==typeof T&&T(t),A&&(n=A.target||"added",t[n]&&t[n].length&&r.one(u+"done",function(){var i=t[n],a=r.findCwdNodes(i),o=function(){var t=r.cwd().hash;return e.map(i,function(e){return e.phash&&t===e.phash?e.hash:null})},s=o(),l=function(t){var n,i,a,l=void 0,c=t.action?t.action.data:void 0;return(c||s.length)&&t.action&&(i=t.action.msg)&&(n=t.action.cmd)&&(!t.action.cwdNot||t.action.cwdNot!==r.cwd().hash)&&(a=t.action.done,c=t.action.data,l=e("
").append(e('").on("mouseenter mouseleave",function(t){e(this).toggleClass("ui-state-hover","mouseenter"==t.type)}).on("click",function(){r.exec(n,c||s,{_userAction:!0,_currentType:"toast",_currentNode:e(this)}),a&&r.one(n+"done",function(){"function"==typeof a?a():"select"===a&&r.trigger("selectfiles",{files:o()})})}))),delete t.action,t.extNode=l,t};A.toast||(A.toast={}),!A.noselect&&r.trigger("selectfiles",{files:r.searchStatus.state>1?e.map(i,function(e){return e.hash}):s}),a.length?(A.noscroll||(a.first().trigger("scrolltoview",{blink:!1}),r.resources.blink(a,"lookme")),e.isPlainObject(A.toast.incwd)&&r.toast(l(A.toast.incwd))):e.isPlainObject(A.toast.inbuffer)&&r.toast(l(A.toast.inbuffer))})),c.resolve(t),void(t.debug&&r.debug("backend-debug",t))):c.reject({error:t.norError||"errResponse"},i,t)};r.abortXHR(i),z?r.lazy(n):n()},U=function(e){i&&"pending"===i.state()&&(r.abortXHR(i,{quiet:!0,abort:!0}),(!e||"unload"!==e.type&&"destroy"!==e.type)&&r.autoSync())},P=function(e){if(r.trigger(u+"done"),"autosync"==e.type){if("stop"!=e.data.action)return}else if(!("unload"==e.type||"destroy"==e.type||"openxhrabort"==e.type||e.data.added&&e.data.added.length))return;U(e)},q=function(t){var n=function(){C=!1,c.reject()};if(t&&"cmd"===t)return u;if(f){if(ie&&"pending"===ie.state()){if(ie._target===p.target)return c.reject("openabort");ie.xhr?ie.xhr.queueAbort():ie.reject("openabort")}ie=c,ie._target=p.target}if(c.always(function(){delete M.headers["X-elFinderReqid"],f&&(ie=null)}).fail(function(t,n,i){var a,s;f&&"openabort"===t&&(t="",C=!1),a={cmd:u,err:t,xhr:n,rc:i},0===t&&ne.length&&(ne=e.grep(ne,function(e){return e("cmd")!==u})),r.trigger("requestError",a),a._getEvent&&a._getEvent().isDefaultPrevented()&&(m=!1,C=!1,t&&(t.error="")),U(),f&&(o=r.file(p.target),o&&o.volumeid&&r.isRoot(o)&&delete r.volumeExpires[o.volumeid]),r.trigger(u+"fail",i),s="object"==typeof t?t.error:t,s&&(m?r.error(s):r.debug("error",r.i18n(s))),C&&r.sync()}),!u)return C=!1,c.reject({error:"errCmdReq"});if(r.maxTargets&&p.targets&&p.targets.length>r.maxTargets)return C=!1,c.reject({error:["errMaxTargets",r.maxTargets]});if(g&&c.done(E),f){for(;a=R.pop();)a.queueAbort();if(j!==p.target)for(;a=H.pop();)a.queueAbort()}return e.inArray(u,(r.cmdsToAdd+" autosync").split(" "))!==-1&&("autosync"!==u&&(r.autoSync("stop"),c.always(function(){r.autoSync()})),r.trigger("openxhrabort")),delete M.preventFail,r.api>=2.1029&&(I?M.headers["X-elFinderReqid"]=d:Object.assign(M.data,{reqid:d})),c.syncOnFail=function(e){C=!!e},te++,c.xhr=i=r.transport.send(M).always(function(){M._xhr&&"undefined"!=typeof M._xhr.responseURL&&(i.responseURL=M._xhr.responseURL||""),--te,ne.length&&ne.shift()()}).fail(F).done(D),r.api>=2.1029&&(i._requestId=d),f||p.compare&&"info"===u?(i.queueAbort=n,R.unshift(i),p.compare&&r.bind(r.cmdsToAdd+" autosync openxhrabort",P),c.always(function(){var t=e.inArray(i,R);p.compare&&r.unbind(r.cmdsToAdd+" autosync openxhrabort",P),t!==-1&&R.splice(t,1)})):e.inArray(u,r.abortCmdsOnOpen)!==-1&&(i.queueAbort=n,H.unshift(i),c.always(function(){var t=e.inArray(i,H);t!==-1&&H.splice(t,1)})),r.bind("unload destroy",P),c.always(function(){r.unbind("unload destroy",P)}),c},_=function(){return w.type&&w.cnt&&(x&&(w.cancel=c,t.eachCancel&&(w.id=+new Date)),n=setTimeout(function(){b=setTimeout(N,1e3),r.notify(w),y=!0,c.always(function(){w.cnt=-(parseInt(w.cnt)||0),r.notify(w),y=!1})},r.notifyDelay),c.always(function(){clearTimeout(n)})),te=2&&(j!==this.root()&&l.push(this.request({ -data:{cmd:"parents",target:j},preventDefault:!0})),e.each(c(),function(e,t){l.push(a.request({data:{cmd:t.cmd,target:t.target},preventDefault:!0}))})),e.when.apply(e,l).fail(function(t,o){i=o&&200!=o.status,n&&e.inArray("errOpen",t)===-1?s.reject(t&&0!=o.status?t:void 0):(s.reject(t),a.parseError(t)&&a.request({data:{cmd:"open",target:a.lastDir("")||a.root(),tree:1,init:1},notify:{type:"open",cnt:1,hideCnt:!0}}))}).done(function(e){var n,i,o;if(e.cwd.compare&&r===e.cwd.compare)return s.reject();if(n={tree:[]},i=arguments.length,i>1)for(o=1;o0?a:a.charCodeAt(0):a>0?a:e.ui.keyCode[a],a&&!U[i]&&(U[i]={keyCode:a,altKey:e.inArray("ALT",r)!=-1,ctrlKey:e.inArray("CTRL",r)!=-1,shiftKey:e.inArray("SHIFT",r)!=-1,type:t.type||"keydown",callback:t.callback,description:t.description,pattern:i});return this},this.shortcuts=function(){var t=[];return e.each(U,function(e,n){t.push([n.pattern,u.i18n(n.description)])}),t},this.clipboard=function(t,n){var i=function(){return e.map(P,function(e){return e.hash})};return void 0!==t&&(P.length&&this.trigger("unlockfiles",{files:i()}),q={},P=e.map(t||[],function(e){var t=I[e];return t?(q[e]=!0,{hash:e,phash:t.phash,name:t.name,mime:t.mime,read:t.read,locked:t.locked,cut:!!n}):null}),this.trigger("changeclipboard",{clipboard:P.slice(0,P.length)}),n&&this.trigger("lockfiles",{files:i()})),P.slice(0,P.length)},this.isCommandEnabled=function(e,t){var n,i,a=u.cwd().volumeid||"";return!t&&u.searchStatus.state>1&&u.selected().length&&(t=u.selected()[0]),n=!t||a&&0===t.indexOf(a)?O.disabledFlip:u.option("disabledFlip",t),i=this._commands[e],!!i&&(i.alwaysEnabled||!n[e])},this.exec=function(t,n,i,a){var o,r;return!a&&this.commandMap[t]&&"hidden"!==this.commandMap[t]&&(t=this.commandMap[t]),"open"===t&&((this.searchStatus.state||this.searchStatus.ininc)&&this.trigger("searchend",{noupdate:!0}),this.autoSync("stop")),!a&&n&&(e.isArray(n)?n.length&&(a=n[0]):a=n),o=this._commands[t]&&this.isCommandEnabled(t,a)?this._commands[t].exec(n,i):e.Deferred().reject("errUnknownCmd"),r=typeof o,"object"===r&&o.promise||(u.debug("warning",'"cmd.exec()" should be returned "$.Deferred" but cmd "'+t+'" returned "'+r+'"'),o=e.Deferred().resolve()),this.trigger("exec",{dfrd:o,cmd:t,files:n,opts:i,dstHash:a}),o},this.dialog=function(t,n){var i=e("
").append(t).appendTo(m).elfinderdialog(n,u),a=i.closest(".ui-dialog"),o=function(){!i.data("draged")&&i.is(":visible")&&i.elfinderdialog("posInit")};return a.length&&(u.bind("resize",o),a.on("remove",function(){u.unbind("resize",o)})),i},this.toast=function(t){return e('
').appendTo(this.ui.toast).elfindertoast(t||{},this)},this.getUI=function(t){return t?this.ui[t]||e():m},this.getCommand=function(e){return void 0===e?this._commands:this._commands[e]},this.resize=function(t,n){var i,a=function(){for(var e=m.outerHeight(!0)-m.innerHeight(),t=m;t.get(0)!==W.get(0)&&(t=t.parent(),e+=t.outerHeight(!0)-t.innerHeight(),t.parent().length););return e},o=!m.hasClass("ui-resizable"),r=m.data("resizeSize")||{w:0,h:0},s={};W&&W.data("resizeTm")&&clearTimeout(W.data("resizeTm")),u.options.noResizeBySelf||("string"==typeof n&&(i=n.match(/^([0-9.]+)%$/))&&(W&&W.length||(W=e(window)),W.data("marginToMyNode")||W.data("marginToMyNode",a()),W.data("fitToBaseFunc")||W.data("fitToBaseFunc",function(e){var t=W.data("resizeTm");e.preventDefault(),e.stopPropagation(),t&&cancelAnimationFrame(t),m.hasClass("elfinder-fullscreen")||u.UA.Mobile&&W.data("rotated")===u.UA.Rotated||(W.data("rotated",u.UA.Rotated),W.data("resizeTm",requestAnimationFrame(function(){u.restoreSize()})))}),"undefined"==typeof W.data("rotated")&&W.data("rotated",u.UA.Rotated),n=W.height()*(i[1]/100)-W.data("marginToMyNode"),W.off("resize."+u.namespace,W.data("fitToBaseFunc")),o&&W.on("resize."+u.namespace,W.data("fitToBaseFunc"))),m.css({width:t,height:parseInt(n)})),s.w=Math.round(m.width()),s.h=Math.round(m.height()),m.data("resizeSize",s),s.w===r.w&&s.h===r.h||(m.trigger("resize"),this.trigger("resize",{width:s.w,height:s.h}))},this.restoreSize=function(){this.resize(N,L)},this.show=function(){m.show(),this.enable().trigger("show")},this.hide=function(){this.options.enableAlways&&(T=z,z=!1),this.disable(),this.trigger("hide"),m.hide()},this.lazy=function(t,n,i){var a=function(e){var t,n=m.data("lazycnt");e?(t=!m.data("lazyrepaint")&&i.repaint,n?m.data("lazycnt",++n):m.data("lazycnt",1).addClass("elfinder-processing"),t&&m.data("lazyrepaint",!0).css("display")):n&&n>1?m.data("lazycnt",--n):(t=m.data("lazyrepaint"),m.data("lazycnt",0).removeData("lazyrepaint").removeClass("elfinder-processing"),t&&m.css("display"),u.trigger("lazydone"))},o=e.Deferred(),r=function(){o.resolve(t.call(o)),a(!1)};return n=n||0,i=i||{},a(!0),n?setTimeout(r,n):requestAnimationFrame(r),o},this.destroy=function(){m&&m[0].elfinder&&(m.hasClass("elfinder-fullscreen")&&u.toggleFullscreen(m),this.options.syncStart=!1,this.autoSync("forcestop"),this.trigger("destroy").disable(),P=[],F=[],D={},U={},e(window).off("."+y),e(document).off("."+y),u.trigger=function(){},e(K).remove(),m.off().removeData().empty().append(v.contents()).attr("class",v.attr("class")).attr("style",v.attr("style")),delete m[0].elfinder,e.each(g,function(t,n){e.each(n,function(e,t){m.on(t.type+(t.namespace?"."+t.namespace:""),t.selector,t.handler)})}))},this.autoSync=function(t){var n;if(u.options.sync>=1e3){if(r&&(clearTimeout(r),r=null,u.trigger("autosync",{action:"stop"})),"stop"===t?++X:X=Math.max(0,--X),X||"forcestop"===t||!u.options.syncStart)return;n=function(t){var i;O.syncMinMs&&(t||r)&&(t&&u.trigger("autosync",{action:"start"}),i=Math.max(u.options.sync,O.syncMinMs),r&&clearTimeout(r),r=setTimeout(function(){var t,a=!0,o=j;O.syncChkAsTs&&I[o]&&(t=I[o].ts)?u.request({data:{cmd:"info",targets:[o],compare:t,reload:1},preventDefault:!0}).done(function(e){var i;a=!0,e.compare&&(i=e.compare,i==t&&(a=!1)),a?u.sync(o).always(function(){i&&(I[o].ts=i),n()}):n()}).fail(function(t,a){var o=u.parseError(t);o&&0!=a.status?(u.error(o),Array.isArray(o)&&e.inArray("errOpen",o)!==-1&&u.request({data:{cmd:"open",target:u.lastDir("")||u.root(),tree:1,init:1},notify:{type:"open",cnt:1,hideCnt:!0}})):r=setTimeout(function(){n()},i)}):u.sync(j,!0).always(function(){n()})},i))},n(!0)}},this.insideWorkzone=function(e,t,n){var i=this.getUI("workzone").data("rectangle");return n=n||1,!(ei.left+i.width+n||ti.top+i.height+n)},this.toFront=function(t){var n=m.children(".ui-front").removeClass("elfinder-frontmost"),i=n.last();n.css("z-index",""),e(t).addClass("ui-front elfinder-frontmost").css("z-index",i.css("z-index")+1)},this.toHide=function(t,n){var i,a=e(t);!n&&a.hide(),a.hasClass("elfinder-frontmost")&&(a.removeClass("elfinder-frontmost"),i=m.children(".ui-front:visible:not(.elfinder-frontmost)").last(),i.length&&requestAnimationFrame(function(){m.children(".elfinder-frontmost:visible").length||(u.toFront(i),i.trigger("frontmost"))}))},this.getMaximizeCss=function(){return{width:"100%",height:"100%",margin:0,top:0,left:0,display:"block",position:"fixed",zIndex:Math.max(u.zIndex?u.zIndex+1:0,1e3),maxWidth:"",maxHeight:""}},function(){re&&u.UA.Fullscreen&&(u.UA.Fullscreen=!1,se&&"undefined"!=typeof se.attr("allowfullscreen")&&(u.UA.Fullscreen=!0));var t,n,i,a,o="elfinder-fullscreen",r="elfinder-fullscreen-native",s=function(){var t=0,n=0;e.each(m.children(".ui-dialog,.ui-draggable"),function(i,a){var o=e(a),r=o.position();r.top<0&&(o.css("top",t),t+=20),r.left<0&&(o.css("left",n),n+=20)})},l=function(){var i=u.storage("useFullscreen");a=u.UA.Fullscreen&&(i?i>0:"screen"===u.options.commandsOptions.fullscreen.mode)?{fullElm:function(){return document.fullscreenElement||document.webkitFullscreenElement||document.mozFullScreenElement||document.msFullscreenElement||null},exitFull:function(){return document.exitFullscreen?document.exitFullscreen():document.webkitExitFullscreen?document.webkitExitFullscreen():document.mozCancelFullScreen?document.mozCancelFullScreen():document.msExitFullscreen?document.msExitFullscreen():void 0},toFull:function(e){return e.requestFullscreen?e.requestFullscreen():e.webkitRequestFullscreen?e.webkitRequestFullscreen():e.mozRequestFullScreen?e.mozRequestFullScreen():!!e.msRequestFullscreen&&e.msRequestFullscreen()}}:{fullElm:function(){var e;return m.hasClass(o)?m.get(0):(e=m.find("."+o),e.length?e.get(0):null)},exitFull:function(){var i;e(window).off("resize."+y,d),void 0!==n&&e("body").css("overflow",n),n=void 0,t&&(i=t.elm,c(i),e(i).trigger("resize",{fullscreen:"off"})),e(window).trigger("resize")},toFull:function(t){return n=e("body").css("overflow")||"",e("body").css("overflow","hidden"),e(t).css(u.getMaximizeCss()).addClass(o).trigger("resize",{fullscreen:"on"}),s(),e(window).on("resize."+y,d).trigger("resize"),!0}}},c=function(n){t&&t.elm==n&&(e(n).removeClass(o+" "+r).attr("style",t.style),t=null)},d=function(t){var n;t.target===window&&(i&&cancelAnimationFrame(i),i=requestAnimationFrame(function(){(n=a.fullElm())&&e(n).trigger("resize",{fullscreen:"on"})}))};l(),e(document).on("fullscreenchange."+y+" webkitfullscreenchange."+y+" mozfullscreenchange."+y+" MSFullscreenChange."+y,function(n){if(u.UA.Fullscreen){var l=a.fullElm(),p=e(window);i&&cancelAnimationFrame(i),null===l?(p.off("resize."+y,d),t&&(l=t.elm,c(l),e(l).trigger("resize",{fullscreen:"off"}))):(e(l).addClass(o+" "+r).attr("style","width:100%; height:100%; margin:0; padding:0;").trigger("resize",{fullscreen:"on"}),p.on("resize."+y,d),s()),p.trigger("resize")}}),u.toggleFullscreen=function(n,i){var o=e(n).get(0),r=null;if(r=a.fullElm()){if(r==o){if(i===!0)return r}else if(i===!1)return r;return a.exitFull(),null}return i===!1?null:(l(),t={elm:o,style:e(o).attr("style")},a.toFull(o)!==!1?o:(t=null,null))}}(),function(){var t,n="elfinder-maximized",i=function(e){if(e.target===window&&e.data&&e.data.elm){var n=e.data.elm;t&&cancelAnimationFrame(t),t=requestAnimationFrame(function(){n.trigger("resize",{maximize:"on"})})}},a=function(t){e(window).off("resize."+y,i),e("body").css("overflow",t.data("bodyOvf")),t.removeClass(n).attr("style",t.data("orgStyle")).removeData("bodyOvf").removeData("orgStyle"),t.trigger("resize",{maximize:"off"})},o=function(t){t.data("bodyOvf",e("body").css("overflow")||"").data("orgStyle",t.attr("style")).addClass(n).css(u.getMaximizeCss()),e("body").css("overflow","hidden"),e(window).on("resize."+y,{elm:t},i),t.trigger("resize",{maximize:"on"})};u.toggleMaximize=function(t,i){var r=e(t),s=r.hasClass(n);if(s){if(i===!0)return;a(r)}else{if(i===!1)return;o(r)}}}(),Object.assign(e.ui.keyCode,{F1:112,F2:113,F3:114,F4:115,F5:116,F6:117,F7:118,F8:119,F9:120,F10:121,F11:122,F12:123,DIG0:48,DIG1:49,DIG2:50,DIG3:51,DIG4:52,DIG5:53,DIG6:54,DIG7:55,DIG8:56,DIG9:57,NUM0:96,NUM1:97,NUM2:98,NUM3:99,NUM4:100,NUM5:101,NUM6:102,NUM7:103,NUM8:104,NUM9:105,CONTEXTMENU:93,DOT:190}),this.dragUpload=!1,this.xhrUpload=("undefined"!=typeof XMLHttpRequestUpload||"undefined"!=typeof XMLHttpRequestEventTarget)&&"undefined"!=typeof File&&"undefined"!=typeof FormData,this.transport={},"object"==typeof this.options.transport&&(this.transport=this.options.transport,"function"==typeof this.transport.init&&this.transport.init(this)),"function"!=typeof this.transport.send&&(this.transport.send=function(t){return u.UA.IE||(t._xhr=new XMLHttpRequest,t.xhr=function(){return t.progress&&t._xhr.addEventListener("progress",t.progress),t._xhr}),e.ajax(t)}),"iframe"==this.transport.upload?this.transport.upload=e.proxy(this.uploads.iframe,this):"function"==typeof this.transport.upload?this.dragUpload=!!this.options.dragUploadAllow:this.xhrUpload&&this.options.dragUploadAllow?(this.transport.upload=e.proxy(this.uploads.xhr,this),this.dragUpload=!0):this.transport.upload=e.proxy(this.uploads.iframe,this),this.decodeRawString=function(e){var t=function(e){var t,n,i;for(t=0,n=e.length,i=[];t=55296&&a<=56319?o.push((1023&a)+64<<10|1023&e[++n]):o.push(a);return o},i=function(e){var t,n,i,a,o=String.fromCharCode;for(t=0,n=e.length,a="";i=e[t],t=194?o((31&i)<<6|63&e[++t]):i<=239&&i>=224?o((15&i)<<12|(63&e[++t])<<6|63&e[++t]):i<=247&&i>=240?o(55296|((7&i)<<8|(63&e[++t])<<2|e[++t]>>>4&3)-64,56320|(15&e[t++])<<6|63&e[t]):o(65533);return a};return i(n(e))},this.getContents=function(t,n,i){var a,o,r=this,s=e.Deferred(),l=n||"arraybuffer";return s.fail(function(){o&&"pending"===o.state()&&o.reject()}),a=r.openUrl(t),r.isSameOrigin(a)||(a=r.openUrl(t,!0)),o=r.request(Object.assign({data:{cmd:"get"},options:{url:a,type:"get",cache:!0,dataType:"binary",responseType:l,processData:!1},notify:{type:"file",cnt:1,hideCnt:!0},cancel:!0},i||{})).fail(function(){s.reject()}).done(function(e){s.resolve(e)}),s},this.getBinaryByUrl=function(t,n,i){var a,o=this,r=e.Deferred();return r.fail(function(){a&&"pending"===a.state()&&a.reject()}),a=o.request(Object.assign({data:{cmd:"get"},options:Object.assign({type:"get",cache:!0,dataType:"binary",responseType:"blob",processData:!1},t)},i||{})).fail(function(){r.reject()}).done(function(e){n&&n(e),r.resolve(e)}),r},this.getMimetype=function(e,t){var n,i,a=t;return i=(e+"").match(/\.([^.]+)$/),i&&(n=i[1])&&(o||(o=u.arrayFlip(u.mimeTypes)),(a=o[n.toLowerCase()])||(a=t)),a},u.hashCheckers=[],function(t){var n={};window.Worker&&window.ArrayBuffer&&(t.options.cdns.sparkmd5&&(n.SparkMD5=!0,t.hashCheckers.push("md5")),t.options.cdns.jssha&&(n.jsSHA=!0,t.hashCheckers=t.hashCheckers.concat(["sha1","sha224","sha256","sha384","sha512","sha3-224","sha3-256","sha3-384","sha3-512","shake128","shake256"]))),t.getContentsHashes=function(i,a,o,r){var s,l=e.Deferred(),c=t.arrayFlip(a||["md5"],!0),d=[],p={},u=o?o:{shake128len:256,shake256len:512};return l.fail(function(){s&&s.reject()}),Object.keys(n).length?s=t.getContents(i,"arraybuffer",r).done(function(a){c.md5&&n.SparkMD5&&d.push(function(){var o=e.Deferred();try{var r=t.getWorker();o.fail(function(){r&&r.terminate()}),r.onmessage=function(e){if(r&&r.terminate(),e.data.hash){var n;p.md5=e.data.hash,(n=t.file(i))&&(n.md5=p.md5)}else e.data.error&&(p.md5=e.data.error);l.notify(p),o.resolve()},r.onerror=function(e){o.reject()},r.postMessage({scripts:[t.options.cdns.sparkmd5,t.getWorkerUrl("calcfilehash.js")],data:{type:"md5",bin:a}}),l.fail(function(){o.reject()})}catch(s){o.reject(),delete n.SparkMD5}return o}()),n.jsSHA&&e.each(["1","224","256","384","512","3-224","3-256","3-384","3-512","ke128","ke256"],function(o,r){c["sha"+r]&&d.push(function(){var o=e.Deferred();try{var s=t.getWorker();o.fail(function(){s&&s.terminate()}),s.onmessage=function(e){if(s&&s.terminate(),e.data.hash){var n;p["sha"+r]=e.data.hash,(n=t.file(i))&&(n["sha"+r]=p["sha"+r])}else e.data.error&&(p["sha"+r]=e.data.error);l.notify(p),o.resolve()},s.onerror=function(e){o.reject()},s.postMessage({scripts:[t.options.cdns.jssha,t.getWorkerUrl("calcfilehash.js")],data:{type:r,bin:a,hashOpts:u}}),l.fail(function(){o.reject()})}catch(c){o.reject(),delete n.jsSHA}return o}())}),d.length?e.when.apply(null,d).always(function(){l.resolve(p)}):l.reject()}).fail(function(){l.reject()}):l.reject(),l}}(this),this.parseError=function(t){var n=t;return e.isPlainObject(n)&&(n=n.error),n},this.error=function(){var e,t=arguments[0],n=arguments[1]||null;return 1==arguments.length&&"function"==typeof t?u.bind("error",t):(e=this.parseError(t),e!==!0&&e?u.trigger("error",{error:e,opts:n}):this)},e.each(A,function(t,n){u[n]=function(){var t=arguments[0];return 1==arguments.length&&"function"==typeof t?u.bind(n,t):u.trigger(n,e.isPlainObject(t)?t:{})}}),this.enable(function(){!z&&u.api&&u.visible()&&u.ui.overlay.is(":hidden")&&!m.children(".elfinder-dialog."+u.res("class","editing")+":visible").length&&(z=!0,document.activeElement&&document.activeElement.blur(),m.removeClass("elfinder-disabled"))}).disable(function(){T=z,z=!1,m.addClass("elfinder-disabled")}).open(function(){F=[]}).select(function(t){var n=0,i=[];F=e.grep(t.data.selected||t.data.value||[],function(e){return i.length||u.maxTargets&&++n>u.maxTargets?(i.push(e),!1):!!I[e]}),i.length&&(u.trigger("unselectfiles",{files:i,inselect:!0}),u.toast({mode:"warning",msg:u.i18n(["errMaxTargets",u.maxTargets])}))}).error(function(t){var n,i,a={cssClass:"elfinder-dialog-error",title:u.i18n("error"),resizable:!1,destroyOnClose:!0,buttons:{}},o=u.getUI(),r=o.children(".elfinder-dialog-error").length;r'+u.i18n(t.data.error),a)):(n=o.children(".elfinder-dialog-error:last").children(".ui-dialog-content:first"),i=n.children(".elfinder-error-counter"),i.length?i.data("cnt",parseInt(i.data("cnt"))+1).html(u.i18n(["moreErrors",i.data("cnt")])):(i=e(''+u.i18n(["moreErrors",1])+"").data("cnt",1),n.append("
",i)))}).bind("tmb",function(t){e.each(t.data.images||[],function(e,t){I[e]&&(I[e].tmb=t)})}).bind("searchstart",function(e){Object.assign(u.searchStatus,e.data),u.searchStatus.state=1}).bind("search",function(e){u.searchStatus.state=2}).bind("searchend",function(){u.searchStatus.state=0,u.searchStatus.ininc=!1,u.searchStatus.mixed=!1}).bind("canMakeEmptyFile",function(t){var n=t.data,i={};n&&Array.isArray(n.mimes)&&(n.unshift||(i=u.mimesCanMakeEmpty),e.each(n.mimes,function(){i[this]||(i[this]=u.mimeTypes[this])}),n.unshift&&(u.mimesCanMakeEmpty=Object.assign(i,u.mimesCanMakeEmpty)))}).bind("themechange",function(){requestAnimationFrame(function(){u.trigger("uiresize")})}),!0===this.options.sound&&this.bind("playsound",function(t){var n=K.canPlayType&&K.canPlayType('audio/wav; codecs="1"'),i=t.data&&t.data.soundFile;n&&i&&""!=n&&"no"!=n&&e(K).html('')[0].play()}),e.each(this.options.handlers,function(e,t){u.bind(e,t)}),this.history=new this.history(this),this.roots={},this.leafRoots={},this.volumeExpires={},this._commands={},Array.isArray(this.options.commands)||(this.options.commands=[]),e.inArray("*",this.options.commands)!==-1&&(this.options.commands=Object.keys(this.commands)),this.commandMap={},this.volOptions={},this.hasVolOptions=!1,this.trashes={},this.optionsByHashes={},this.uiAutoHide=[],this.one("open",function(){u.uiAutoHide.length&&setTimeout(function(){u.trigger("uiautohide")},500)}),this.bind("uiautohide",function(){u.uiAutoHide.length&&u.uiAutoHide.shift()()}),this.options.width&&(N=this.options.width),this.options.height&&(L=this.options.height),this.options.heightBase&&(W=e(this.options.heightBase)),B=this.options.soundPath?this.options.soundPath.replace(/\/+$/,"")+"/":this.baseUrl+B,this.options.parrotHeaders&&Array.isArray(this.options.parrotHeaders)&&this.options.parrotHeaders.length?(this.parrotHeaders=this.options.parrotHeaders,e.each(this.parrotHeaders,function(e,t){var n=u.sessionStorage("core-ph:"+t);n&&(u.customHeaders[t]=n)})):this.parrotHeaders=[],u.one("opendone",function(){var t;e(document).on("click."+y,function(t){z&&!u.options.enableAlways&&!e(t.target).closest(m).length&&u.disable()}).on(x+" "+k+" "+C+" "+w,ae),u.options.useBrowserHistory&&e(window).on("popstate."+y,function(t){var n,i,a=t.originalEvent.state||{},o=!!a.thash,r=m.find(".elfinder-frontmost:visible"),s=m.find(".elfinder-navbar-dir,.elfinder-cwd-filename").find("input,textarea");o||(a={thash:u.cwd().hash},e("html,body").animate({scrollTop:m.offset().top})),r.length||s.length?(history.pushState(a,null,location.pathname+location.search+"#elf_"+a.thash),r.length?r.hasClass(u.res("class","preventback"))||(r.hasClass("elfinder-contextmenu")?e(document).trigger(e.Event("keydown",{keyCode:e.ui.keyCode.ESCAPE,ctrlKey:!1,shiftKey:!1,altKey:!1,metaKey:!1})):r.hasClass("elfinder-dialog")?r.elfinderdialog("close"):r.trigger("close")):s.trigger(e.Event("keydown",{keyCode:e.ui.keyCode.ESCAPE,ctrlKey:!1,shiftKey:!1,altKey:!1,metaKey:!1}))):o?!e.isEmptyObject(u.files())&&u.request({data:{cmd:"open",target:a.thash,onhistory:1},notify:{type:"open",cnt:1,hideCnt:!0},syncOnFail:!0}):(n=function(){i.trigger("click")},u.one("open",n,!0),i=u.toast({msg:u.i18n("pressAgainToExit"),onHidden:function(){u.unbind("open",n),history.pushState(a,null,location.pathname+location.search+"#elf_"+a.thash)}}))}),e(window).on("resize."+y,function(e){e.target===this&&(t&&cancelAnimationFrame(t),t=requestAnimationFrame(function(){var e=m.data("resizeSize")||{w:0,h:0},t={w:Math.round(m.width()),h:Math.round(m.height())};m.data("resizeSize",t),t.w===e.w&&t.h===e.h||(m.trigger("resize"),u.trigger("resize",{width:t.w,height:t.h}))}))}).on("beforeunload."+y,function(t){var n,i;if(!u.pauseUnloadCheck()){if(m.is(":visible")&&(u.ui.notify.children().length&&e.inArray("hasNotifyDialog",u.options.windowCloseConfirm)!==-1?n=u.i18n("ntfsmth"):m.find("."+u.res("class","editing")).length&&e.inArray("editingFile",u.options.windowCloseConfirm)!==-1?n=u.i18n("editingFile"):(i=Object.keys(u.selected()).length)&&e.inArray("hasSelectedItem",u.options.windowCloseConfirm)!==-1?n=u.i18n("hasSelected",""+i):(i=Object.keys(u.clipboard()).length)&&e.inArray("hasClipboardData",u.options.windowCloseConfirm)!==-1&&(n=u.i18n("hasClipboard",""+i)),n))return t.returnValue=n,n;u.trigger("unload")}}),e(window).on("message."+y,function(e){var t,n,i=e.originalEvent||null;if(i&&(0===u.convAbsUrl(u.options.url).indexOf(i.origin)||0===u.convAbsUrl(u.uploadURL).indexOf(i.origin)))try{t=JSON.parse(i.data),n=t.data||null,n&&(n.error?(t.bind&&u.trigger(t.bind+"fail",n),u.error(n.error)):(n.warning&&u.error(n.warning),u.updateCache(n),n.removed&&n.removed.length&&u.remove(n),n.added&&n.added.length&&u.add(n),n.changed&&n.changed.length&&u.change(n),t.bind&&(u.trigger(t.bind,n),u.trigger(t.bind+"done")),n.sync&&u.sync()))}catch(e){u.sync()}}),u.options.enableAlways?(e(window).on("focus."+y,function(e){e.target===this&&u.enable()}),re&&e(window.top).on("focus."+y,function(){!u.enable()||se&&!se.is(":visible")||requestAnimationFrame(function(){e(window).trigger("focus")})})):re&&e(window).on("blur."+y,function(e){z&&e.target===this&&u.disable()}),re&&m.on("click",function(t){e(window).trigger("focus")}),u.options.enableByMouseOver&&m.on("mouseenter touchstart",function(t){re&&e(window).trigger("focus"),!u.enabled()&&u.enable()}),e(window).on("visibilitychange."+y,function(e){var t=document.hidden||document.webkitHidden||document.msHidden;u.options.syncStart&&u.autoSync(t?"stop":void 0)})}),m[0].elfinder=this,h.push(function(){var t=u.lang,n=u.i18nBaseUrl+"elfinder."+t+".js",i=e.Deferred().done(function(){u.i18[t]&&(u.lang=t),u.trigger("i18load"),c="en"===u.lang?u.i18.en:e.extend(!0,{},u.i18.en,u.i18[u.lang])});return u.i18[t]?i.resolve():(u.lang="en",u.hasRequire?require([n],function(){i.resolve()},function(){i.resolve()}):u.loadScript([n],function(){i.resolve()},{loadType:"tag",error:function(){i.resolve()}})),i}()),d=function(){var t;return u.messages=c.messages,e.fn.selectable&&e.fn.draggable&&e.fn.droppable&&e.fn.resizable&&e.fn.button&&e.fn.slider?m.length?u.options.url?(t=Object.assign({name:u.i18n("name"),perm:u.i18n("perms"),date:u.i18n("modify"),size:u.i18n("size"),kind:u.i18n("kind"),modestr:u.i18n("mode"),modeoct:u.i18n("mode"),modeboth:u.i18n("mode")},u.options.uiOptions.cwd.listView.columnsCustomName),u.getColumnName=function(e){var n=t[e]||u.i18n(e);return"function"==typeof n?n():n},u.direction=c.direction,u.dateFormat=u.options.dateFormat||c.dateFormat,u.fancyFormat=u.options.fancyDateFormat||c.fancyDateFormat,u.nonameDateFormat=(u.options.nonameDateFormat||c.nonameDateFormat).replace(/[\/\\]/g,"_"),u.cssClass="ui-helper-reset ui-helper-clearfix ui-widget ui-widget-content ui-corner-all elfinder elfinder-"+("rtl"==u.direction?"rtl":"ltr")+(u.UA.Touch?" elfinder-touch"+(u.options.resizable?" touch-punch":""):"")+(u.UA.Mobile?" elfinder-mobile":"")+(u.UA.iOS?" elfinder-ios":"")+" "+u.options.cssClass,m.addClass(u.cssClass).on(w,function(){!z&&u.enable()}),function(){var t,n,i,a,o,r=x+"draggable keyup."+y+"draggable";u.draggable={appendTo:m,addClasses:!1,distance:4,revert:!0,refreshPositions:!1,cursor:"crosshair",cursorAt:{left:50,top:47},scroll:!1,start:function(r,s){var l,c,d=s.helper,p=e.grep(d.data("files")||[],function(e){return!!e&&(q[e]=!0,!0)}),h=!1;for(o=m.attr("style"),m.width(m.width()).height(m.height()),t="ltr"===u.direction,n=u.getUI("workzone").data("rectangle"),i=n.top+n.height,a=i-u.getUI("navdock").outerHeight(!0),u.draggingUiHelper=d,l=p.length;l--;)if(c=p[l],I[c].locked){h=!0,d.data("locked",!0);break}!h&&u.trigger("lockfiles",{files:p}),d.data("autoScrTm",setInterval(function(){d.data("autoScr")&&u.autoScroll[d.data("autoScr")](d.data("autoScrVal"))},50))},drag:function(o,r){var s,l,c,d=r.helper;((l=n.top>o.pageY)||ao.pageX?(t?"navbar":"cwd")+(l?"Up":"Down"):(t?"cwd":"navbar")+(l?"Up":"Down"),l||("cwd"===s.substr(0,3)?i0?(e(this).draggable("option",{refreshPositions:!0,elfRefresh:!0}),d.data("refreshPositions",-1)):(e(this).draggable("option",{refreshPositions:!1,elfRefresh:!1}),d.data("refreshPositions",null)))},stop:function(t,n){var i,a=n.helper;e(document).off(r),e(this).elfUiWidgetInstance("draggable")&&e(this).draggable("option",{refreshPositions:!1}),u.draggingUiHelper=null,u.trigger("focus").trigger("dragstop"),a.data("droped")||(i=e.grep(a.data("files")||[],function(e){return!!e}),u.trigger("unlockfiles",{files:i}),u.trigger("selectfiles",{files:u.selected()})),u.enable(),m.attr("style",o),a.data("autoScrTm")&&clearInterval(a.data("autoScrTm"))},helper:function(t,n){var i,a,o,s=this.id?e(this):e(this).parents("[id]:first"),l=e('
'),c=function(t){var n,i=t.mime,a=u.tmb(t);return n='
',a?n=e(n).addClass(a.className).css("background-image","url('"+a.url+"')").get(0).outerHTML:t.icon&&(n=e(n).css(u.getIconStyle(t,!0)).get(0).outerHTML),t.csscls&&(n='
'+n+"
"),n};return u.draggingUiHelper&&u.draggingUiHelper.stop(!0,!0),u.trigger("dragstart",{target:s[0],originalEvent:t},!0),i=s.hasClass(u.res("class","cwdfile"))?u.selected():[u.navId2Hash(s.attr("id"))],l.append(c(I[i[0]])).data("files",i).data("locked",!1).data("droped",!1).data("namespace",y).data("dropover",0),(a=i.length)>1&&l.append(c(I[i[a-1]])+''+a+""),e(document).on(r,function(e){if(u._commands.copy){var t=e.shiftKey||e.ctrlKey||e.metaKey;o!==t&&(o=t,l.is(":visible")&&l.data("dropover")&&!l.data("droped")&&(l.toggleClass("elfinder-drag-helper-plus",!!l.data("locked")||o),u.trigger(o?"unlockfiles":"lockfiles",{files:i,helper:l})))}}),l}}}(),u.commands.getfile&&("function"==typeof u.options.getFileCallback?(u.bind("dblclick",function(e){e.preventDefault(),u.exec("getfile").fail(function(){u.exec("open",e.data&&e.data.file?[e.data.file]:void 0)})}),u.shortcut({pattern:"enter",description:u.i18n("cmdgetfile"),callback:function(){u.exec("getfile").fail(function(){u.exec("mac"==u.OS?"rename":"open")})}}).shortcut({pattern:"ctrl+enter",description:u.i18n("mac"==u.OS?"cmdrename":"cmdopen"),callback:function(){u.exec("mac"==u.OS?"rename":"open")}})):u.options.getFileCallback=null),e.each(u.commands,function(t,n){var i,a,o=Object.assign({},n.prototype);if(e.isFunction(n)&&!u._commands[t]&&(n.prototype.forceLoad||e.inArray(t,u.options.commands)!==-1)){if(i=n.prototype.extendsCmd||""){if(!e.isFunction(u.commands[i]))return!0;n.prototype=Object.assign({},_,new u.commands[i],n.prototype)}else n.prototype=Object.assign({},_,n.prototype);u._commands[t]=new n,n.prototype=o,a=u.options.commandsOptions[t]||{},i&&u.options.commandsOptions[i]&&(a=e.extend(!0,{},u.options.commandsOptions[i],a)),u._commands[t].setup(t,a),u._commands[t].linkedCmds.length&&e.each(u._commands[t].linkedCmds,function(t,n){var i=u.commands[n];e.isFunction(i)&&!u._commands[n]&&(i.prototype=_,u._commands[n]=new i,u._commands[n].setup(n,u.options.commandsOptions[n]||{}))})}}),u.ui={workzone:e("
").appendTo(m).elfinderworkzone(u),navbar:e("
").appendTo(m).elfindernavbar(u,u.options.uiOptions.navbar||{}),navdock:e("
").appendTo(m).elfindernavdock(u,u.options.uiOptions.navdock||{}),contextmenu:e("
").appendTo(m).elfindercontextmenu(u),overlay:e("
").appendTo(m).elfinderoverlay({show:function(){u.disable()},hide:function(){T&&u.enable()}}),cwd:e("
").appendTo(m).elfindercwd(u,u.options.uiOptions.cwd||{}),notify:u.dialog("",{cssClass:"elfinder-dialog-notify"+(u.options.notifyDialog.canClose?"":" elfinder-titlebar-button-hide"),position:u.options.notifyDialog.position,absolute:!0,resizable:!1,autoOpen:!1,allowMinimize:!0,closeOnEscape:!!u.options.notifyDialog.canClose,title:" ",width:u.options.notifyDialog.width?parseInt(u.options.notifyDialog.width):null,minHeight:null,minimize:function(){u.ui.notify.trigger("minimize")}}),statusbar:e('
').hide().appendTo(m),toast:e('
').appendTo(m),bottomtray:e('
').appendTo(m),progressbar:e('
').appendTo(m)},u.trigger("uiready"),e.each(u.options.ui||[],function(t,n){var i="elfinder"+n,a=u.options.uiOptions[n]||{};!u.ui[n]&&e.fn[i]&&(u.ui[n]=e("<"+(a.tag||"div")+"/>").appendTo(m),u.ui[n][i](u,a))}),u.ui.progressbar.appendTo(u.ui.workzone),u.ui.notify.prev(".ui-dialog-titlebar").append('
'),u.resize(N,L),u.options.resizable&&(m.resizable({resize:function(e,t){u.resize(t.size.width,t.size.height)},handles:"se",minWidth:300,minHeight:200}),u.UA.Touch&&m.addClass("touch-punch")),function(){var e=u.getUI("navbar"),t=u.getUI("cwd").parent();u.autoScroll={navbarUp:function(t){e.scrollTop(Math.max(0,e.scrollTop()-t))},navbarDown:function(t){e.scrollTop(e.scrollTop()+t)},cwdUp:function(e){t.scrollTop(Math.max(0,t.scrollTop()-e))},cwdDown:function(e){t.scrollTop(t.scrollTop()+e)}}}(),u.UA.Touch&&!function(){var e,t,n,i,a,o,r,s,l,c=u.getUI("navbar"),d=u.getUI("toolbar"),p="touchmove.stopscroll",h=function(e){var n=e.originalEvent.touches||[{}],i=n[0].pageY||null;(!t||i1||("touchstart"===s.type?(n=m.offset(),i=m.width(),c&&(e=!1,c.is(":hidden")?(l||(l=Math.max(50,i/10)),(A?z-n.left:i+n.left-z)n.left+i-o,y?(l=Math.max(50,i/10),e=z):e=!1)),d&&(t=!1,s.originalEvent._preventSwipeY||(r=d.height(),a=n.top,T-a<(d.is(":hidden")?v:r+30)&&(t=T,m.on(p,d.is(":hidden")?f:h))))):(c&&e!==!1&&(b=(A?e>z:e.6*o||w>("navhide"===b?o/3:45)&&("navshow"===b||(A?zn.left+i-20)))&&(u.getUI("navbar").trigger(b,{handleW:l}),e=!1)),d&&t!==!1&&(x=d.offset().top,Math.abs(t-T)>Math.min(45,r/3)&&(k=t>T?"slideUp":"slideDown",("slideDown"===k||x+20>T)&&(d.is("slideDown"===k?":hidden":":visible")&&d.stop(!0,!0).trigger("toggle",{duration:100,handleH:v}),t=!1)))))})}(),u.dragUpload&&!function(){var t,n,i=function(t){return"TEXTAREA"!==t.target.nodeName&&"INPUT"!==t.target.nodeName&&0===e(t.target).closest("div.ui-dialog-content").length},a="native-drag-enter",o="native-drag-disable",r="class",s=u.res(r,"navdir"),l=(u.res(r,"droppable"),u.res(r,"adroppable"),u.res(r,"navarrow"),u.res(r,"adroppable")),c=u.getUI("workzone"),d="ltr"===u.direction,p=function(){n&&cancelAnimationFrame(n),n=null};m.on("dragenter",function(e){p(),i(e)&&(e.preventDefault(),e.stopPropagation(),t=c.data("rectangle"))}).on("dragleave",function(e){p(),i(e)&&(e.preventDefault(),e.stopPropagation())}).on("dragover",function(e){var a;i(e)?(e.preventDefault(),e.stopPropagation(),e.originalEvent.dataTransfer.dropEffect="none",n||(n=requestAnimationFrame(function(){var i,o=t.top+t.height,r=o-u.getUI("navdock").outerHeight(!0);((a=e.pageYr)&&(i=t.cwdEdge>e.pageX?(d?"navbar":"cwd")+(a?"Up":"Down"):(d?"cwd":"navbar")+(a?"Up":"Down"),a||"cwd"===i.substr(0,3)&&(o=11,IE:document.uniqueID,Firefox:window.sidebar,Opera:window.opera,Webkit:e,Chrome:t,Edge:!(!t||!window.msCredentials),Safari:e&&!window.chrome,Mobile:"undefined"!=typeof window.orientation,Touch:"undefined"!=typeof window.ontouchstart,iOS:navigator.platform.match(/^iP(?:[ao]d|hone)/),Mac:navigator.platform.match(/^Mac/),Fullscreen:"undefined"!=typeof(document.exitFullscreen||document.webkitExitFullscreen||document.mozCancelFullScreen||document.msExitFullscreen),Angle:0,Rotated:!1,CSS:function(){var e,t=document.createElement("a").style,n=document.createElement("p").style;return e="position:sticky;position:-webkit-sticky;",e+="width:-webkit-max-content;width:-moz-max-content;width:-ms-max-content;width:max-content;",t.cssText=e,{positionSticky:t.position.indexOf("sticky")!==-1,widthMaxContent:t.width.indexOf("max-content")!==-1,flex:"undefined"!=typeof n.flex}}()};return n}(),cookieEnabled:window.navigator.cookieEnabled,hasRequire:"function"==typeof define&&define.amd,currentReqCmd:"",keyState:{},i18:{en:{translator:"",language:"English",direction:"ltr",dateFormat:"d.m.Y H:i",fancyDateFormat:"$1 H:i",nonameDateFormat:"ymd-His",messages:{}},months:["January","February","March","April","May","June","July","August","September","October","November","December"],monthsShort:["msJan","msFeb","msMar","msApr","msMay","msJun","msJul","msAug","msSep","msOct","msNov","msDec"],days:["Sunday","Monday","Tuesday","Wednesday","Thursday","Friday","Saturday"],daysShort:["Sun","Mon","Tue","Wed","Thu","Fri","Sat"]},kinds:{unknown:"Unknown",directory:"Folder",group:"Selects",symlink:"Alias","symlink-broken":"AliasBroken","application/x-empty":"TextPlain","application/postscript":"Postscript","application/vnd.ms-office":"MsOffice","application/msword":"MsWord","application/vnd.ms-word":"MsWord","application/vnd.openxmlformats-officedocument.wordprocessingml.document":"MsWord","application/vnd.ms-word.document.macroEnabled.12":"MsWord","application/vnd.openxmlformats-officedocument.wordprocessingml.template":"MsWord","application/vnd.ms-word.template.macroEnabled.12":"MsWord","application/vnd.ms-excel":"MsExcel","application/vnd.openxmlformats-officedocument.spreadsheetml.sheet":"MsExcel","application/vnd.ms-excel.sheet.macroEnabled.12":"MsExcel","application/vnd.openxmlformats-officedocument.spreadsheetml.template":"MsExcel","application/vnd.ms-excel.template.macroEnabled.12":"MsExcel","application/vnd.ms-excel.sheet.binary.macroEnabled.12":"MsExcel","application/vnd.ms-excel.addin.macroEnabled.12":"MsExcel","application/vnd.ms-powerpoint":"MsPP","application/vnd.openxmlformats-officedocument.presentationml.presentation":"MsPP","application/vnd.ms-powerpoint.presentation.macroEnabled.12":"MsPP","application/vnd.openxmlformats-officedocument.presentationml.slideshow":"MsPP","application/vnd.ms-powerpoint.slideshow.macroEnabled.12":"MsPP","application/vnd.openxmlformats-officedocument.presentationml.template":"MsPP","application/vnd.ms-powerpoint.template.macroEnabled.12":"MsPP","application/vnd.ms-powerpoint.addin.macroEnabled.12":"MsPP","application/vnd.openxmlformats-officedocument.presentationml.slide":"MsPP","application/vnd.ms-powerpoint.slide.macroEnabled.12":"MsPP","application/pdf":"PDF","application/xml":"XML","application/vnd.oasis.opendocument.text":"OO","application/vnd.oasis.opendocument.text-template":"OO","application/vnd.oasis.opendocument.text-web":"OO","application/vnd.oasis.opendocument.text-master":"OO","application/vnd.oasis.opendocument.graphics":"OO","application/vnd.oasis.opendocument.graphics-template":"OO","application/vnd.oasis.opendocument.presentation":"OO","application/vnd.oasis.opendocument.presentation-template":"OO","application/vnd.oasis.opendocument.spreadsheet":"OO","application/vnd.oasis.opendocument.spreadsheet-template":"OO","application/vnd.oasis.opendocument.chart":"OO","application/vnd.oasis.opendocument.formula":"OO","application/vnd.oasis.opendocument.database":"OO","application/vnd.oasis.opendocument.image":"OO","application/vnd.openofficeorg.extension":"OO","application/x-shockwave-flash":"AppFlash","application/flash-video":"Flash video","application/x-bittorrent":"Torrent","application/javascript":"JS","application/rtf":"RTF","application/rtfd":"RTF","application/x-font-ttf":"TTF","application/x-font-otf":"OTF","application/x-rpm":"RPM","application/x-web-config":"TextPlain","application/xhtml+xml":"HTML","application/docbook+xml":"DOCBOOK","application/x-awk":"AWK","application/x-gzip":"GZIP","application/x-bzip2":"BZIP","application/x-xz":"XZ","application/zip":"ZIP","application/x-zip":"ZIP","application/x-rar":"RAR","application/x-tar":"TAR","application/x-7z-compressed":"7z","application/x-jar":"JAR","text/plain":"TextPlain","text/x-php":"PHP","text/html":"HTML","text/javascript":"JS","text/css":"CSS","text/rtf":"RTF","text/rtfd":"RTF","text/x-c":"C","text/x-csrc":"C","text/x-chdr":"CHeader","text/x-c++":"CPP","text/x-c++src":"CPP","text/x-c++hdr":"CPPHeader","text/x-shellscript":"Shell","application/x-csh":"Shell","text/x-python":"Python","text/x-java":"Java","text/x-java-source":"Java","text/x-ruby":"Ruby","text/x-perl":"Perl","text/x-sql":"SQL","text/xml":"XML","text/x-comma-separated-values":"CSV","text/x-markdown":"Markdown","image/x-ms-bmp":"BMP","image/jpeg":"JPEG","image/gif":"GIF","image/png":"PNG","image/tiff":"TIFF","image/x-targa":"TGA","image/vnd.adobe.photoshop":"PSD","image/xbm":"XBITMAP","image/pxm":"PXM","audio/mpeg":"AudioMPEG","audio/midi":"AudioMIDI","audio/ogg":"AudioOGG","audio/mp4":"AudioMPEG4","audio/x-m4a":"AudioMPEG4","audio/wav":"AudioWAV","audio/x-mp3-playlist":"AudioPlaylist","video/x-dv":"VideoDV","video/mp4":"VideoMPEG4","video/mpeg":"VideoMPEG","video/x-msvideo":"VideoAVI","video/quicktime":"VideoMOV","video/x-ms-wmv":"VideoWM","video/x-flv":"VideoFlash","video/x-matroska":"VideoMKV","video/ogg":"VideoOGG"},mimeTypes:{},rules:{defaults:function(e){return!(!e||e.added&&!Array.isArray(e.added)||e.removed&&!Array.isArray(e.removed)||e.changed&&!Array.isArray(e.changed))},open:function(t){return t&&t.cwd&&t.files&&e.isPlainObject(t.cwd)&&Array.isArray(t.files)},tree:function(e){return e&&e.tree&&Array.isArray(e.tree)},parents:function(e){return e&&e.tree&&Array.isArray(e.tree)},tmb:function(t){return t&&t.images&&(e.isPlainObject(t.images)||Array.isArray(t.images))},upload:function(t){return t&&(e.isPlainObject(t.added)||Array.isArray(t.added))},search:function(e){return e&&e.files&&Array.isArray(e.files)}},commands:{},cmdsToAdd:"archive duplicate extract mkdir mkfile paste rm upload",parseUploadData:function(t){var n,i=this;if(!e.trim(t))return{error:["errResponse","errDataEmpty"]};try{n=JSON.parse(t)}catch(a){return{error:["errResponse","errDataNotJSON"]}}return n=i.normalize(n),i.validResponse("upload",n)?(n.removed=e.merge(n.removed||[],e.map(n.added||[],function(e){return i.file(e.hash)?e.hash:null})),n):{error:n.norError||["errResponse"]}},iframeCnt:0,uploads:{xhrUploading:!1,failSyncTm:null,chunkfailReq:{},checkExists:function(t,n,i,a){var o,r=e.Deferred(),s=[],l={},c=function(){for(var e=t.length;--e>-1;)t[e]._remove=!0},d=function(){r.resolve(s,l)},p=function(){var r=[],p=[],u=n!==i.cwd().hash?i.path(n,!0)+i.option("separator",n):"",h=function(e){var n=e==p.length-1,o={cssClass:"elfinder-confirm-upload",title:i.i18n("cmdupload"),text:["errExists",u+p[e].name,"confirmRepl"],all:!n,accept:{label:"btnYes",callback:function(t){n||t?d():h(++e)}},reject:{label:"btnNo",callback:function(i){var a;if(i)for(a=p.length;e0&&delete o.reject,i.confirm(o)};return i.file(n).read?(o=e.map(t,function(e,t){return!e.name||i.UA.iOS&&"image.jpg"===e.name?null:{i:t,name:e.name}}),void i.request({data:{cmd:"ls",target:n,intersect:e.map(o,function(e){return e.name})},notify:{type:"preupload",cnt:1,hideCnt:!0},preventDefault:!0}).done(function(t){var a,s;t&&(t.error?c():i.options.overwriteUploadConfirm&&i.option("uploadOverwrite",n)&&t.list&&(Array.isArray(t.list)?r=t.list||[]:(a=[],r=e.map(t.list,function(e){return"string"==typeof e?e:(a=a.concat(e),!1)}),a.length&&(r=r.concat(a)),l=t.list),p=e.grep(o,function(t){return e.inArray(t.name,r)!==-1}),p.length&&r.length&&n==i.cwd().hash&&(s=e.map(i.files(n),function(e){return e.name}),e.grep(r,function(t){return e.inArray(t,s)===-1}).length&&i.sync()))),p.length>0?h(0):d()}).fail(function(e){c(),d(),e&&i.error(e)})):void d()};return i.api>=2.1&&"object"==typeof t[0]?p():d(),r},checkFile:function(t,n,i){if(t.checked||"files"==t.type)return t.files;if("data"==t.type){var a,o,r=e.Deferred(),s=e.Deferred(),l=[],c=[],d=0,p=[],u=!1,h=function(e){return Array.prototype.slice.call(e||[],0)},f=function(e){var t,i,a=n.options.folderUploadExclude[n.OS]||null,o=e.length,r=function(){--d<1&&"pending"===s.state()&&s.resolve()},m=function(e){a&&e.name.match(a)||(c.push(t.fullPath||""),l.push(e)),r()},i=function(e){var t=[],n=function(){e.readEntries(function(e){if(u||!e.length){for(var i=0;i=2.1&&(d++,p.push(t.fullPath),i(t.createReader())))}return r(),s};return a=e.map(t.files.items,function(e){return e.getAsEntry?e.getAsEntry():e.webkitGetAsEntry()}),e.each(a,function(e,t){if(t.isDirectory)return o=!0,!1}),a.length>0?(n.uploads.checkExists(a,i,n,o).done(function(o,s){var d=[];n.options.overwriteUploadConfirm&&n.option("uploadOverwrite",i)&&(null===o&&(t.overwrite=0,o=[]),a=e.grep(a,function(t){var a,r,l,c;return t.isDirectory&&o.length&&(a=e.inArray(t.name,o),a!==-1&&(o.splice(a,1),r=n.uniqueName(t.name+n.options.backupSuffix,null,""),e.each(s,function(e,n){if(t.name==n)return l=e,!1}),l||(l=n.fileByName(t.name,i).hash),n.lockfiles({files:[l]}),c=n.request({data:{cmd:"rename",target:l,name:r},notify:{type:"rename",cnt:1}}).fail(function(){t._remove=!0,n.sync()}).always(function(){n.unlockfiles({files:[l]})}),d.push(c))),!t._remove})),e.when.apply(e,d).done(function(){var e,t,i=+new Date;a.length>0?(t=n.escape(a[0].name),a.length>1&&(t+=" ... "+a.length+n.i18n("items")),e=setTimeout(function(){n.notify({type:"readdir",id:i,cnt:1,hideCnt:!0,msg:n.i18n("ntfreaddir")+" ("+t+")",cancel:function(){u=!0}})},n.options.notifyDelay),f(a).done(function(){e&&clearTimeout(e),n.notify({type:"readdir",id:i,cnt:-1}),u?r.reject():r.resolve([l,c,o,s,p])}).fail(function(){r.reject()})):r.reject()})}),r.promise()):r.reject()}var m=[],g=[],v=t.files[0];if("html"==t.type){var b,y=e("").append(e.parseHTML(v.replace(/ src=/gi," _elfsrc=")));e("img[_elfsrc]",y).each(function(){var n,i,a=e(this),o=a.closest("a");o&&o.attr("href")&&o.attr("href").match(/\.(?:jpe?g|gif|bmp|png)/i)&&(i=o.attr("href")),n=a.attr("_elfsrc"),n&&(i?(e.inArray(i,m)==-1&&m.push(i),e.inArray(n,g)==-1&&g.push(n)):e.inArray(n,m)==-1&&m.push(n)),1===m.length&&m[0].match(/^data:image\/png/)&&(t.clipdata=!0)}),b=e("a[href]",y),b.each(function(){var t,n,i=function(e){var t=document.createElement("a");return t.href=e,t};(t=e(this).text())&&(n=i(e(this).attr("href")),n.href&&n.href.match(/^(?:ht|f)tp/i)&&(1===b.length||!n.pathname.match(/(?:\.html?|\/[^\/.]*)$/i)||e.trim(t).match(/\.[a-z0-9-]{1,10}$/i))&&e.inArray(n.href,m)==-1&&e.inArray(n.href,g)==-1&&m.push(n.href))})}else{var w,x,k;for(w=/((?:ht|f)tps?:\/\/[-_.!~*\'()a-z0-9;\/?:\@&=+\$,%#\*\[\]]+)/gi;x=w.exec(v);)k=x[1].replace(/&/g,"&"),e.inArray(k,m)==-1&&m.push(k)}return m},xhr:function(t,n){var i=n?n:this,a=i.getUI(),o=new XMLHttpRequest,r=null,s=null,l=null,c=t.checked,d=t.isDataType||"data"==t.type,p=t.target||i.cwd().hash,u=t.dropEvt||null,h=t.extraData||null,f=i.option("uploadMaxConn",p)!=-1,m=Math.min(5,Math.max(1,i.option("uploadMaxConn",p))),g=1e4,v=30,b=0,y=function(t){var n=e.Deferred();return t.promise?t.always(function(e){n.resolve(Array.isArray(e)&&e.length?d?e[0][0]:e[0]:{})}):n.resolve(t.length?d?t[0][0]:t[0]:{}),n},w=e.Deferred().fail(function(e){var t,a=i.parseError(e);"userabort"===a&&(t=!0,a=void 0),k&&(i.uploads.xhrUploading||t)?y(k).done(function(e){t||H(a,e),e._cid?i.uploads.chunkfailReq[e._cid]||(i.uploads.chunkfailReq[e._cid]=!0,setTimeout(function(){n.request({data:{cmd:"upload",target:p,chunk:e._chunk,cid:e._cid,upload:["chunkfail"],mimes:"chunkfail"},options:{type:"post",url:i.uploadURL},preventDefault:!0}).always(function(){delete i.uploads.chunkfailReq[e._chunk]})},1e3)):(i.uploads.failSyncTm&&clearTimeout(i.uploads.failSyncTm),i.uploads.failSyncTm=setTimeout(function(){i.sync(p)},1e3))}):H(a),!t&&i.sync(),i.uploads.xhrUploading=!1,k=null}).done(function(t){i.uploads.xhrUploading=!1,k=null,t&&(i.currentReqCmd="upload",t.warning&&H(t.warning),i.updateCache(t),t.removed&&t.removed.length&&i.remove(t),t.added&&t.added.length&&i.add(t),t.changed&&t.changed.length&&i.change(t),i.trigger("upload",t,!1),i.trigger("uploaddone"),t.toasts&&Array.isArray(t.toasts)&&e.each(t.toasts,function(){this.msg&&i.toast(this)}),t.sync&&i.sync(),t.debug&&(i.responseDebug(t),n.debug("backend-debug",t)))}).always(function(){i.abortXHR(o),a.off("uploadabort",D),e(window).off("unload",D),r&&clearTimeout(r),s&&clearTimeout(s),l&&clearTimeout(l),c&&!t.multiupload&&F()&&i.notify({type:"upload",cnt:-C,progress:0,size:0}),s&&M&&i.notify({type:"chunkmerge",cnt:-C}),B&&O.children(".elfinder-notify-chunkmerge").length&&i.notify({type:"chunkmerge",cnt:-1})}),x=new FormData,k=t.input?t.input.files:i.uploads.checkFile(t,i,p),C=t.checked&&d?k[0].length:k.length,z=!1,T=0,A=0,j=0,S=!1,O=i.ui.notify,I=!0,M=!1,E=!1,F=function(){return!S&&($=O.children(".elfinder-notify-upload")).length&&(S=!0),S},D=function(e,t){E=!0,i.abortXHR(o,{quiet:!0,abort:!0}),w.reject(t),F()&&i.notify({type:"upload",cnt:$.data("cnt")*-1,progress:0,size:0})},U=function(e,t){$.children(".elfinder-notify-cancel")[e?"show":"hide"](),I=e},P=function(e){return e||(e=j),setTimeout(function(){S=!0,i.notify({type:"upload",cnt:C,progress:T-A,size:e,cancel:function(){a.trigger("uploadabort","userabort")}}),$=O.children(".elfinder-notify-upload"),A=T,t.multiupload?I&&U(!0):U(I&&T=2.1029&&(e=(+new Date).toString(16)+Math.floor(1e3*Math.random()).toString(16),"function"==typeof x["delete"]&&x["delete"]("reqid"),x.append("reqid",e),o._requestId=e),o.send(x))},g)):a.trigger("uploadabort",["errAbort","errTimeout"])},R=function(){S&&w.notifyWith($,[{cnt:$.data("cnt"),progress:$.data("progress"),total:$.data("total")}])},H=function(e,t,n){e&&i.trigger("xhruploadfail",{error:e,file:t}),n?e&&(N=i.options.maxErrorDialogs&&(_=_.concat("moreErrors",N-i.options.maxErrorDialogs)),i.error(_)),_=[],N=0)},_=[],N=0,L=t.renames||null,W=t.hashes||null,B=!1,$=e();if(a.one("uploadabort",D),e(window).one("unload."+n.namespace,D),!B&&(A=T),!d&&!C)return w.reject(["errUploadNoFiles"]);o.addEventListener("error",function(){0==o.status?E?w.reject():!d&&t.files&&e.grep(t.files,function(e){return!e.type&&e.size===(i.UA.Safari?1802:0)}).length?w.reject(["errAbort","errFolderUpload"]):t.input&&e.grep(t.input.files,function(e){return!e.type&&e.size===(i.UA.Safari?1802:0)}).length?w.reject(["errUploadNoFiles"]):q():a.trigger("uploadabort","errConnect")},!1),o.addEventListener("load",function(e){var n,s,c=o.status,p=0,u="";if(i.setCustomHeaderByXhr(o),c>=400?u=c>500?"errResponse":["errResponse","errServerError"]:o.responseText||(u=["errResponse","errDataEmpty"]),u&&(a.trigger("uploadabort"),y(k||{}).done(function(e){return w.reject(e._cid?null:u)})),T=j,F()&&(p=T-A)&&(i.notify({type:"upload",cnt:0,progress:p,size:0}),R()),n=i.parseUploadData(o.responseText),n._chunkmerged){x=new FormData;var h=[{_chunkmerged:n._chunkmerged,_name:n._name,_mtime:n._mtime}];return B=!0,a.off("uploadabort",D),l=setTimeout(function(){i.notify({type:"chunkmerge",cnt:1})},i.options.notifyDelay),void(d?V(h,k[1]):V(h))}n._multiupload=!!t.multiupload,n.error?(s={cmd:"upload",err:n,xhr:o,rc:o.status},i.trigger("uploadfail",n),i.trigger("requestError",s),s._getEvent&&s._getEvent().isDefaultPrevented()&&(n.error=""),n._chunkfailure||n._multiupload?(E=!0,i.uploads.xhrUploading=!1,r&&clearTimeout(r),$.length?(i.notify({type:"upload",cnt:-C,progress:0,size:0}),w.reject(n)):w.reject()):w.reject(n)):w.resolve(n)},!1),o.upload.addEventListener("loadstart",function(e){!B&&e.lengthComputable&&(T=e.loaded,b&&(T=0),j=e.total,T||(T=parseInt(.05*j)),F()&&(i.notify({type:"upload",cnt:0,progress:T-A,size:t.multiupload?0:j}),A=T,R()))},!1),o.upload.addEventListener("progress",function(e){var n;e.lengthComputable&&!B&&o.readyState<2&&(T=e.loaded,!t.checked&&T>0&&!r&&(r=P(o._totalSize-T)),j||(j=e.total,T||(T=parseInt(.05*j))),n=T-A,F()&&n/e.total>=.05&&(i.notify({type:"upload",cnt:0,progress:n,size:0}),A=T,R()),!M&&T>=j&&!z&&(M=!0,s=setTimeout(function(){i.notify({type:"chunkmerge",cnt:C})},i.options.notifyDelay)),I&&!t.multiupload&&T>=j&&F()&&U(!1))},!1);var V=function(a,s){var l,g,v,b,y,k,T,A,j,S,O,M,D,q,R,N=0,B=1,$=[],V=0,K=C,X=0,J=[],G=(new Date).getTime().toString().substr(-9),Y=Math.min((n.uplMaxSize?n.uplMaxSize:2097152)-8190,n.options.uploadMaxChunkSize),Q=!f&&"",Z=function(a,o){var s,l,c,h=[],f=0;if(!E){for(;a.length&&h.length=2.1&&("slice"in j?Q="slice":"mozSlice"in j?Q="mozSlice":"webkitSlice"in j&&(Q="webkitSlice")))}catch(te){C--,K--;continue}if(l&&g>l||!Q&&n.uplMaxSize&&g>n.uplMaxSize)H(["errUploadFile",j.name,"errUploadFileSize"],j,!0),C--,K--;else if(!j.type||i.uploadMimeCheck(j.type,p))if(Q&&g>Y){for(k=0,T=Y,A=-1,K=Math.floor((g-1)/Y),v=j.lastModified?Math.round(j.lastModified/1e3):0,b=t.clipdata?n.date(n.nonameDateFormat)+".png":j.name,X+=g,J[G]=0;kn.uplMaxSize||B>n.uplMaxFile)&&(N=0,B=1,V++),"undefined"==typeof $[V]&&($[V]=[],d&&($[V][0]=[],$[V][1]=[])),d?($[V][0].push(j),$[V][1].push(s[y])):$[V].push(j),N+=g,X+=g,B++;else H(["errUploadFile",j.name,"errUploadMime","("+j.type+")"],j,!0),C--,K--}if(_.length&&H(),0==$.length)return t.checked=!0,!1;if($.length>1)return r=P(X),O=[],M=0,D=$.length,q=[],ee(),!0;d?(a=$[0][0],s=$[0][1]):a=$[0]}return c||(n.UA.Safari&&t.files?o._totalSize=X:r=P(X)),c=!0,a.length||w.reject(["errUploadNoFiles"]),o.open("POST",i.uploadURL,!0),n.customHeaders&&e.each(n.customHeaders,function(e){o.setRequestHeader(e,this)}),n.xhrFields&&e.each(n.xhrFields,function(e){e in o&&(o[e]=this)}),i.api>=2.1029&&(R=(+new Date).toString(16)+Math.floor(1e3*Math.random()).toString(16),x.append("reqid",R),o._requestId=R),x.append("cmd","upload"),x.append(i.newAPI?"target":"current",p),L&&L.length&&(e.each(L,function(e,t){x.append("renames[]",t)}),x.append("suffix",n.options.backupSuffix)),W&&e.each(W,function(e,t){x.append("hashes["+e+"]",t)}),e.each(i.customData,function(e,t){x.append(e,t)}),e.each(i.options.onlyMimes,function(e,t){x.append("mimes[]",t)}),e.each(a,function(e,i){var a,o;i._chunkmerged?(x.append("chunk",i._chunkmerged),x.append("upload[]",i._name),x.append("mtime[]",i._mtime),t.clipdata&&x.append("overwrite",0),z=!0):(i._chunkfail?(x.append("upload[]","chunkfail"),x.append("mimes","chunkfail")):(t.clipdata?i._chunk||(t.overwrite=0,a=n.date(n.nonameDateFormat)+".png"):i.name&&(a=i.name,n.UA.iOS&&(a.match(/^image\.jpe?g$/i)?(t.overwrite=0,a=n.date(n.nonameDateFormat)+".jpg"):a.match(/^capturedvideo\.mov$/i)&&(t.overwrite=0,a=n.date(n.nonameDateFormat)+".mov")),o=(i.webkitRelativePath||i.relativePath||i._relativePath||"").replace(/[^\/]+$/,""),a=o+a),a?x.append("upload[]",i,a):x.append("upload[]",i)),i._chunk?(x.append("chunk",i._chunk),x.append("cid",i._cid),x.append("range",i._range),x.append("mtime[]",i._mtime),z=!0):x.append("mtime[]",i.lastModified?Math.round(i.lastModified/1e3):0))}),d&&e.each(s,function(e,t){x.append("upload_path[]",t)}),0===t.overwrite&&x.append("overwrite",0),u&&x.append("dropWith",parseInt((u.altKey?"1":"0")+(u.ctrlKey?"1":"0")+(u.metaKey?"1":"0")+(u.shiftKey?"1":"0"),2)),h&&e.each(h,function(e,t){x.append(e,t)}),o.send(x),!0};if(d)c?V(k[0],k[1]):k.done(function(t){if(L=[],C=t[0].length){if(t[4]&&t[4].length)return void n.request({data:{cmd:"mkdir",target:p,dirs:t[4]},notify:{type:"mkdir",cnt:t[4].length},preventFail:!0}).fail(function(e){e=e||["errUnknown"],"errCmdParams"===e[0]?m=1:(m=0,w.reject(e))}).done(function(n){var i=!1;n.hashes||(n.hashes={}),t[1]=e.map(t[1],function(e,a){return t[0][a]._relativePath=e.replace(/^\//,""),e=e.replace(/\/[^\/]*$/,""),""===e?p:n.hashes[e]?n.hashes[e]:(i=!0,t[0][a]._remove=!0,null)}),i&&(t[0]=e.grep(t[0],function(e){return!e._remove}))}).always(function(e){m&&(L=t[2],W=t[3],V(t[0],t[1]))});t[1]=e.map(t[1],function(){return p}),L=t[2],W=t[3],V(t[0],t[1])}else w.reject(["errUploadNoFiles"])}).fail(function(){w.reject()});else if(k.length>0)if(t.clipdata||null!=L)V(k)||w.reject();else{var K=[],X=[],J=n.options.folderUploadExclude[n.OS]||null;e.each(k,function(t,n){var i,a,o=n.webkitRelativePath||n.relativePath||"";return!!o&&(J&&n.name.match(J)?(n._remove=!0,o=void 0):(o="/"+o.replace(/\/[^\/]*$/,"").replace(/^\//,""),o&&e.inArray(o,K)===-1&&(K.push(o),i=o.substr(1).indexOf("/"),i!==-1&&(a=o.substr(0,i+1))&&e.inArray(a,K)===-1&&K.unshift(a))),void X.push(o))}),L=[],W={},K.length?!function(){var t=e.map(K,function(e){return e.substr(1).indexOf("/")===-1?{name:e.substr(1)}:null}),i=[];n.uploads.checkExists(t,p,n,!0).done(function(a,o){var r,s,l,c=[];n.options.overwriteUploadConfirm&&n.option("uploadOverwrite",p)&&(i=e.map(t,function(e){return e._remove?e.name:null}),t=e.grep(t,function(e){return!e._remove})),i.length&&e.each(X.concat(),function(t,n){0===e.inArray(n,i)&&(k[t]._remove=!0,X[t]=void 0)}),k=e.grep(k,function(e){return!e._remove}),X=e.grep(X,function(e){return void 0!==e}),t.length?(r=e.Deferred(),a.length?e.each(a,function(t,i){s=n.uniqueName(i+n.options.backupSuffix,null,""),e.each(o,function(e,t){if(a[0]==t)return l=e,!1}),l||(l=n.fileByName(a[0],p).hash),n.lockfiles({files:[l]}),c.push(n.request({data:{cmd:"rename",target:l,name:s},notify:{type:"rename",cnt:1}}).fail(function(e){w.reject(e),n.sync()}).always(function(){n.unlockfiles({files:[l]})}))}):c.push(null),e.when.apply(e,c).done(function(){n.request({data:{cmd:"mkdir",target:p,dirs:K},notify:{type:"mkdir",cnt:K.length},preventFail:!0}).fail(function(e){e=e||["errUnknown"],"errCmdParams"===e[0]?m=1:(m=0,w.reject(e))}).done(function(t){var n=!1;t.hashes||(t.hashes={}),X=e.map(X.concat(),function(e,i){return"/"===e?p:t.hashes[e]?t.hashes[e]:(n=!0,k[i]._remove=!0,null)}),n&&(k=e.grep(k,function(e){return!e._remove}))}).always(function(e){m&&(d=!0,V(k,X)||w.reject())})})):w.reject()})}():n.uploads.checkExists(k,p,n).done(function(i,a){n.options.overwriteUploadConfirm&&n.option("uploadOverwrite",p)&&(W=a,null===i?t.overwrite=0:L=i,k=e.grep(k,function(e){return!e._remove})),C=k.length,C>0?V(k)||w.reject():w.reject()})}else w.reject();return w},iframe:function(t,n){var i,a,o,r,s=n?n:this,l=!!t.input&&t.input,c=!l&&s.uploads.checkFile(t,s),d=e.Deferred().fail(function(e){e&&s.error(e)}),p="iframe-"+n.namespace+ ++s.iframeCnt,u=e('
'),h=this.UA.IE,f=function(){r&&clearTimeout(r),o&&clearTimeout(o),a&&s.notify({type:"upload",cnt:-i}),setTimeout(function(){h&&e('').appendTo(u),u.remove(),m.remove()},100)},m=e('').on("load",function(){m.off("load").on("load",function(){f(),d.resolve()}),o=setTimeout(function(){a=!0,s.notify({type:"upload",cnt:i})},s.options.notifyDelay),s.options.iframeTimeout>0&&(r=setTimeout(function(){f(),d.reject(["errConnect","errTimeout"])},s.options.iframeTimeout)),u.submit()}),g=t.target||s.cwd().hash,v=[],b=[],y=[],w={};if(c&&c.length)e.each(c,function(e,t){u.append('')}),i=1;else{if(!(l&&e(l).is(":file")&&e(l).val()))return d.reject();n.options.overwriteUploadConfirm&&n.option("uploadOverwrite",g)&&(v=l.files?l.files:[{name:e(l).val().replace(/^(?:.+[\\\/])?([^\\\/]+)$/,"$1")}],b.push(s.uploads.checkExists(v,g,s).done(function(n,a){w=a,null===n?t.overwrite=0:(y=n,i=e.grep(v,function(e){return!e._remove}).length,i!=v.length&&(i=0))}))),i=l.files?l.files.length:1,u.append(l)}return e.when.apply(e,b).done(function(){ -return i<1?d.reject():(u.append('').append('').append('').append(e(l).attr("name","upload[]")),y.length>0&&(e.each(y,function(e,t){u.append('')}),u.append('')),w&&e.each(y,function(e,t){u.append('')}),0===t.overwrite&&u.append(''),e.each(s.options.onlyMimes||[],function(e,t){u.append('')}),e.each(s.customData,function(e,t){u.append('')}),u.appendTo("body"),void m.appendTo("body"))}),d}},one:function(e,t,n){var i=this,a=e.toLowerCase(),o=function(e,n){return i.toUnbindEvents[a]||(i.toUnbindEvents[a]=[]),i.toUnbindEvents[a].push({type:a,callback:o}),(t.done?t.done:t).apply(this,arguments)};return t.done&&(o={done:o}),this.bind(a,o,n)},localStorage:function(t,n){var i,a,o,r,s,l=this,c=window.localStorage,d="elfinder-"+(t||"")+this.id,p=window.location.pathname+"-elfinder-",u=this.id,h=[];if("undefined"==typeof t)return r=p.length,s=u.length*-1,e.each(c,function(e){e.substr(0,r)===p&&e.substr(s)===u&&h.push(e)}),e.each(h,function(e,t){c.removeItem(t)}),!0;if(t=p+t+u,null===n)return c.removeItem(t);if(void 0===n&&!(i=c.getItem(t))&&(a=c.getItem(d))&&(n=a,c.removeItem(d)),void 0!==n){o=typeof n,"string"!==o&&"number"!==o&&(n=JSON.stringify(n));try{c.setItem(t,n)}catch(f){try{c.clear(),c.setItem(t,n)}catch(f){l.debug("error",f.toString())}}i=c.getItem(t)}if(i&&("{"===i.substr(0,1)||"["===i.substr(0,1)))try{return JSON.parse(i)}catch(f){}return i},sessionStorage:function(e,t){var n,i,a,o=this;try{n=window.sessionStorage}catch(r){}if(n){if(null===t)return n.removeItem(e);if(void 0!==t){a=typeof t,"string"!==a&&"number"!==a&&(t=JSON.stringify(t));try{n.setItem(e,t)}catch(r){try{n.clear(),n.setItem(e,t)}catch(r){o.debug("error",r.toString())}}}if(i=n.getItem(e),i&&("{"===i.substr(0,1)||"["===i.substr(0,1)))try{return JSON.parse(i)}catch(r){}return i}},cookie:function(t,n){var i,a,o,r,s,l;if(t="elfinder-"+t+this.id,void 0===n){if(this.cookieEnabled&&document.cookie&&""!=document.cookie)for(o=document.cookie.split(";"),t+="=",r=0;r"),escape:function(e){return this._node.text(e).html().replace(/"/g,""").replace(/'/g,"'")},normalize:function(t){var n,i,a,o,r,s=this,l=function(){var e,t;return(t=s.options.fileFilter)&&("function"==typeof t?e=function(e){return t.call(s,e)}:t instanceof RegExp&&(e=function(e){return t.test(e.name)})),e?e:null}(),c=function(t){var n;t.uiCmdMap&&(e.isPlainObject(t.uiCmdMap)&&Object.keys(t.uiCmdMap).length?(t.disabledFlip||(t.disabledFlip={}),n=t.disabledFlip,e.each(t.uiCmdMap,function(e,i){"hidden"!==i||n[e]||(t.disabled.push(e),t.disabledFlip[e]=!0)})):delete t.uiCmdMap)},d=function(t){var n=function(e){var t=typeof e;return"object"===t&&Array.isArray(e)&&(t="array"),t};return e.each(s.optionProperties,function(e,i){void 0!==i&&t[e]&&n(t[e])!==n(i)&&(t[e]=i)}),t.disabled?(t.disabledFlip=s.arrayFlip(t.disabled,!0),e.each(s.options.disabledCmdsRels,function(n,i){var a,o;t.disabledFlip[n]?o=!0:(a=n.match(/^([^&]+)&([^=]+)=(.*)$/))&&t.disabledFlip[a[1]]&&t[a[2]]==a[3]&&(o=!0),o&&e.each(i,function(e,n){t.disabledFlip[n]||(t.disabledFlip[n]=!0,t.disabled.push(n))})})):t.disabledFlip={},t},p=function(t,r,p){var u,h,m,g,v=!r||t,b=!!r&&null;if(t&&t.hash&&t.name&&t.mime){if("application/x-empty"===t.mime&&(t.mime="text/plain"),m=s.isRoot(t),m&&!t.volumeid&&s.debug("warning","The volume root statuses requires `volumeid` property."),m||"directory"===t.mime){if(t.phash){if(t.phash===t.hash)return f=f.concat(['Parent folder of "$1" is itself.',t.name]),b;if(m&&t.volumeid&&0===t.phash.indexOf(t.volumeid))return f=f.concat(['Parent folder of "$1" is inner itself.',t.name]),b}t.volumeid&&(u=t.volumeid,m&&(t.phash&&(s.leafRoots[t.phash]?e.inArray(t.hash,s.leafRoots[t.phash])===-1&&s.leafRoots[t.phash].push(t.hash):s.leafRoots[t.phash]=[t.hash]),s.hasVolOptions=!0,s.volOptions[u]||(s.volOptions[u]={dispInlineRegex:s.options.dispInlineRegex}),h=s.volOptions[u],t.options&&Object.assign(h,t.options),t.disabled&&(h.disabled=t.disabled,h.disabledFlip=s.arrayFlip(t.disabled,!0)),t.tmbUrl&&(h.tmbUrl=t.tmbUrl),h.url&&"/"!==h.url.substr(-1)&&(h.url+="/"),c(h),h.trashHash&&(s.trashes[h.trashHash]===!1?delete h.trashHash:s.trashes[h.trashHash]=t.hash),e.each(s.optionProperties,function(e){h[e]&&(t[e]=h[e])}),"cwd"!==p&&(s.roots[u]=t.hash),t.expires&&(s.volumeExpires[u]=t.expires)),o!==u&&(o=u,a=s.option("i18nFolderName",u))),m&&!t.i18&&(n="volume_"+t.name,i=s.i18n(!1,n),n!==i&&(t.i18=i)),a&&!t.i18&&(n="folder_"+t.name,i=s.i18n(!1,n),n!==i&&(t.i18=i)),m&&(g=s.storage("rootNames"))&&(g[t.hash]&&(t._name=t.name,t._i18=t.i18,t.name=g[t.hash]=g[t.hash],delete t.i18),s.storage("rootNames",g)),s.trashes[t.hash]&&(t.locked=!0)}else{if(l)try{if(!l(t))return b}catch(y){s.debug(y)}0==t.size&&(t.mime=s.getMimetype(t.name,t.mime))}return t.options&&(s.optionsByHashes[t.hash]=d(t.options)),delete t.options,v}return b},u=function(t){var n=[];return e.each(s.files(),function(i,a){e.each(s.parents(i),function(a,o){if(e.inArray(o,t)!==-1&&e.inArray(i,t)===-1)return n.push(i),!1})}),n},h=function(n,i){e.each(n,function(n,a){var o,r;s.leafRoots[a.hash]&&s.applyLeafRootStats(a),"change"!==i&&a.phash&&s.isRoot(a)&&(o=s.file(a.phash))&&(s.applyLeafRootStats(o),t.changed?(e.each(t.changed,function(e,n){if(n.hash===o.hash)return t.changed[e]=o,r=!0,!1}),r||t.changed.push(o)):t.changed=[o])})},f=[];if(t.customData&&(!s.prevCustomData||JSON.stringify(t.customData)!==JSON.stringify(s.prevCustomData))){s.prevCustomData=t.customData;try{r=JSON.parse(t.customData),e.isPlainObject(r)&&(s.prevCustomData=r,e.each(Object.keys(r),function(e,t){null===r[t]&&(delete r[t],delete s.optsCustomData[t])}),s.customData=Object.assign({},s.optsCustomData,r))}catch(m){}}return t.options&&d(t.options),t.cwd&&(t.cwd.volumeid&&t.options&&Object.keys(t.options).length&&s.isRoot(t.cwd)&&(s.hasVolOptions=!0,s.volOptions[t.cwd.volumeid]=t.options),t.cwd=p(t.cwd,!0,"cwd")),t.files&&(t.files=e.grep(t.files,p)),t.tree&&(t.tree=e.grep(t.tree,p)),t.added&&(t.added=e.grep(t.added,p)),t.changed&&(t.changed=e.grep(t.changed,p)),t.removed&&t.removed.length&&2===s.searchStatus.state&&(t.removed=t.removed.concat(u(t.removed))),t.api&&(t.init=!0),Object.keys(s.leafRoots).length&&(t.files&&h(t.files),t.tree&&h(t.tree),t.added&&h(t.added),t.changed&&h(t.changed,"change")),t.cwd&&t.cwd.options&&t.options&&Object.assign(t.options,d(t.cwd.options)),t.options&&t.options.url&&"/"!==t.options.url.substr(-1)&&(t.options.url+="/"),f.length&&(t.norError=["errResponse"].concat(f)),t},setSort:function(e,t,n,i){this.storage("sortType",this.sortType=this.sortRules[e]?e:"name"),this.storage("sortOrder",this.sortOrder=/asc|desc/.test(t)?t:"asc"),this.storage("sortStickFolders",(this.sortStickFolders=!!n)?1:""),this.storage("sortAlsoTreeview",(this.sortAlsoTreeview=!!i)?1:""),this.trigger("sortchange")},_sortRules:{name:function(e,t){return i.prototype.naturalCompare(e.i18||e.name,t.i18||t.name)},size:function(e,t){var n=parseInt(e.size)||0,i=parseInt(t.size)||0;return n===i?0:n>i?1:-1},kind:function(e,t){return i.prototype.naturalCompare(e.mime,t.mime)},date:function(e,t){var n=e.ts||e.date||0,i=t.ts||t.date||0;return n===i?0:n>i?1:-1},perm:function(e,t){var n=function(e){return(e.write?2:0)+(e.read?1:0)},i=n(e),a=n(t);return i===a?0:i>a?1:-1},mode:function(e,t){var n=e.mode||e.perm||"",a=t.mode||t.perm||"";return i.prototype.naturalCompare(n,a)},owner:function(e,t){var n=e.owner||"",a=t.owner||"";return i.prototype.naturalCompare(n,a)},group:function(e,t){var n=e.group||"",a=t.group||"";return i.prototype.naturalCompare(n,a)}},sorters:{},naturalCompare:function(e,t){var n=i.prototype.naturalCompare;return"undefined"==typeof n.loc&&(n.loc=navigator.userLanguage||navigator.browserLanguage||navigator.language||"en-US"),"undefined"==typeof n.sort&&("11".localeCompare("2",n.loc,{numeric:!0})>0?window.Intl&&window.Intl.Collator?n.sort=new Intl.Collator(n.loc,{numeric:!0}).compare:n.sort=function(e,t){return e.localeCompare(t,n.loc,{numeric:!0})}:(n.sort=function(e,t){var i,a,o=/(^-?[0-9]+(\.?[0-9]*)[df]?e?[0-9]?$|^0x[0-9a-f]+$|[0-9]+)/gi,r=/(^[ ]*|[ ]*$)/g,s=/(^([\w ]+,?[\w ]+)?[\w ]+,?[\w ]+\d+:\d+(:\d+)?[\w ]?|^\d{1,4}[\/\-]\d{1,4}[\/\-]\d{1,4}|^\w+, \w+ \d+, \d{4})/,l=/^0x[0-9a-f]+$/i,c=/^0/,d=/^[\x01\x21-\x2f\x3a-\x40\x5b-\x60\x7b-\x7e]/,p=function(e){return n.sort.insensitive&&(""+e).toLowerCase()||""+e},u=p(e).replace(r,"").replace(/^_/,"")||"",h=p(t).replace(r,"").replace(/^_/,"")||"",f=u.replace(o,"\0$1\0").replace(/\0$/,"").replace(/^\0/,"").split("\0"),m=h.replace(o,"\0$1\0").replace(/\0$/,"").replace(/^\0/,"").split("\0"),g=parseInt(u.match(l))||1!=f.length&&u.match(s)&&Date.parse(u),v=parseInt(h.match(l))||g&&h.match(s)&&Date.parse(h)||null,b=0;if(v){if(gv)return 1}for(var y=0,w=Math.max(f.length,m.length);ya)return 1}return 0},n.sort.insensitive=!0)),n.sort(e,t)},compare:function(e,t){var n,i=this,a=i.sortType,o="asc"==i.sortOrder,r=i.sortStickFolders,s=i.sortRules,l=s[a],c="directory"==e.mime,d="directory"==t.mime;if(r){if(c&&!d)return-1;if(!c&&d)return 1}return n=o?l(e,t):l(t,e),"name"!==a&&0===n?n=o?s.name(e,t):s.name(t,e):n},sortFiles:function(e){return e.sort(this.compare)},notify:function(t){var n,i,a,o=this,r=t.type,s=t.id?"elfinder-notify-"+t.id:"",l=this.i18n("undefined"!=typeof t.msg?t.msg:this.messages["ntf"+r]?"ntf"+r:"ntfsmth"),c=this.arrayFlip(this.options.notifyDialog.hiddens||[]),d=this.ui.notify,p=d.closest(".ui-dialog"),u=d.children(".elfinder-notify-"+r+(s?"."+s:"")),h=u.children("div.elfinder-notify-cancel").children("button"),f='
{msg}
',m=t.cnt+0,g="undefined"!=typeof t.size?parseInt(t.size):null,v="undefined"!=typeof t.progress&&t.progress>=0?t.progress:null,b=t.fakeinterval||200,y=t.cancel,w="ui-state-hover",x=function(){var t=u.find(".elfinder-notify-progress"),n=function(){u.remove(),d.children(p.data("minimized")?void 0:":visible").length||(p.data("minimized")?p.data("minimized").hide():d.elfinderdialog("close")),C()};u._esc&&e(document).off("keydown",u._esc),u.data("cur")<100?t.animate({width:"100%"},50,function(){requestAnimationFrame(function(){n()})}):n()},k=function(e){var t;u.length&&(t=u.data("cur")+1,t<=98&&(u.find(".elfinder-notify-progress").width(t+"%"),u.data("cur",t),C(),setTimeout(function(){e*=1.05,k(e)},e)))},C=function(){var t,n=0,i=0,a=d.children(".elfinder-notify");a.length?(a.each(function(){n++,i+=Math.min(e(this).data("cur"),100)}),t=n?Math.floor(i/(100*n)*100)+"%":0,o.ui.progressbar.width(t),p.data("minimized")&&(p.data("minimized").title(t),p.data("minimized").dialog().children(".ui-dialog-titlebar").children(".elfinder-ui-progressbar").width(t))):(o.ui.progressbar.width(0),p.data("minimized")&&p.data("minimized").hide())};return r?(u.length?"undefined"!=typeof t.msg&&u.children("span.elfinder-notify-msg").html(l):(u=e(f.replace(/\{type\}/g,r).replace(/\{msg\}/g,l)),c[r]?u.hide():d.on("minimize",function(e){p.data("minimized")&&C()}),u.appendTo(d).data("cnt",0),null!=v?u.data({progress:0,total:0,cur:0}):(u.data({cur:0}),k(b)),y&&(h=e('').on("mouseenter mouseleave",function(t){e(this).toggleClass(w,"mouseenter"===t.type)}),u.children("div.elfinder-notify-cancel").append(h)),d.trigger("resize")),n=m+parseInt(u.data("cnt")),n>0?(y&&h.length&&(e.isFunction(y)||"object"==typeof y&&y.promise)&&(u._esc=function(t){"keydown"==t.type&&t.keyCode!=e.ui.keyCode.ESCAPE||(t.preventDefault(),t.stopPropagation(),x(),y.promise?y.reject(0):y(t))},h.on("click",function(e){u._esc(e)}),e(document).on("keydown."+this.namespace,u._esc)),!t.hideCnt&&u.children(".elfinder-notify-cnt").text("("+n+")"),m>0&&d.is(":hidden")&&!c[r]&&(p.data("minimized")?p.data("minimized").show():d.elfinderdialog("open",this).height("auto")),u.data("cnt",n),null!=v&&(i=u.data("total"))>=0&&(a=u.data("progress"))>=0&&(i+=null!=g?g:m,a+=v,null==g&&m<0&&(a+=100*m),u.data({progress:a,total:i}),null!=g&&(a*=100,i=Math.max(1,i)),v=Math.min(parseInt(a/i),100),u.find(".elfinder-notify-progress").animate({width:(v<100?v:100)+"%"},20,function(){u.data("cur",v),C()}))):x(),this):this},confirm:function(t){var n,i,a=this,o=!1,r={cssClass:"elfinder-dialog-confirm",modal:!0,resizable:!1,title:this.i18n(t.title||"confirmReq"),buttons:{},close:function(){!o&&t.cancel.callback(),e(this).elfinderdialog("destroy")}},s=this.i18n("apllyAll");return t.cssClass&&(r.cssClass+=" "+t.cssClass),r.buttons[this.i18n(t.accept.label)]=function(){t.accept.callback(!(!n||!n.prop("checked"))),o=!0,e(this).elfinderdialog("close")},r.buttons[this.i18n(t.accept.label)]._cssClass="elfinder-confirm-accept",t.reject&&(r.buttons[this.i18n(t.reject.label)]=function(){t.reject.callback(!(!n||!n.prop("checked"))),o=!0,e(this).elfinderdialog("close")},r.buttons[this.i18n(t.reject.label)]._cssClass="elfinder-confirm-reject"),t.buttons&&t.buttons.length>0&&(i=1,e.each(t.buttons,function(t,s){r.buttons[a.i18n(s.label)]=function(){s.callback(!(!n||!n.prop("checked"))),o=!0,e(this).elfinderdialog("close")},r.buttons[a.i18n(s.label)]._cssClass="elfinder-confirm-extbtn"+i++,s.cssClass&&(r.buttons[a.i18n(s.label)]._cssClass+=" "+s.cssClass)})),r.buttons[this.i18n(t.cancel.label)]=function(){e(this).elfinderdialog("close")},r.buttons[this.i18n(t.cancel.label)]._cssClass="elfinder-confirm-cancel",t.all&&(r.create=function(){var t=e('
');n=e(''),e(this).next().find(".ui-dialog-buttonset").prepend(t.append(e("").prepend(n)))}),t.optionsCallback&&e.isFunction(t.optionsCallback)&&t.optionsCallback(r),this.dialog(''+this.i18n(t.text),r)},uniqueName:function(e,t,n){var i,a,o=0,r="";if(e=this.i18n(!1,e),t=t||this.cwd().hash,n="undefined"==typeof n?" ":n,(i=e.match(/^(.+)(\.[^.]+)$/))&&(r=i[2],e=i[1]),a=e+r,!this.fileByName(a,t))return a;for(;o<1e4;)if(a=e+n+ ++o+r,!this.fileByName(a,t))return a;return e+Math.random()+r},i18n:function(){var t,n,i,a,o,r=this,s=this.messages,l=[],c=[],d=function(e){var t;return 0===e.indexOf("#")&&(t=r.file(e.substr(1)))?t.name:e},p=0;for(arguments.length&&arguments[0]===!1&&(a=function(e){return e},p=1),t=p;t0&&l[n]&&c.push(n),i=a?a(l[n]):r.escape(l[n]),o&&(i=''+i+""),i})):i=i.get(0).outerHTML,l[t]=i);return e.grep(l,function(t,n){return e.inArray(n,c)===-1}).join("
")},getIconStyle:function(t,n){var i=this,a={background:"url('{url}') 0 0 no-repeat","background-size":"contain"},o="",r={},s=0;return t.icon&&(o='style="',e.each(a,function(e,a){0===s++&&(a=a.replace("{url}",i.escape(t.icon))),n?r[e]=a:o+=e+":"+a+";"}),o+='"'),n?r:o},mime2class:function(e){var t="elfinder-cwd-icon-",n=e.toLowerCase(),i=this.textMimes[n];return n=n.split("/"),i?n[0]+=" "+t+"text":n[1]&&n[1].match(/\+xml$/)&&(n[0]+=" "+t+"xml"),t+n[0]+(n[1]?" "+t+n[1].replace(/(\.|\+)/g,"-"):"")},mime2kind:function(e){var t,n="object"==typeof e,i=n?e.mime:e;return n&&e.alias&&"symlink-broken"!=i?t="Alias":this.kinds[i]&&(t=!n||"directory"!==i||e.phash&&!e.isroot?this.kinds[i]:"Root"),t||(t=0===i.indexOf("text")?"Text":0===i.indexOf("image")?"Image":0===i.indexOf("audio")?"Audio":0===i.indexOf("video")?"Video":0===i.indexOf("application")?"App":i),this.messages["kind"+t]?this.i18n("kind"+t):i},mimeIsText:function(e){return!!(this.textMimes[e.toLowerCase()]||0===e.indexOf("text/")&&"rtf"!==e.substr(5,3)||e.match(/^application\/.+\+xml$/))},date:function(e,t){var n,i,a,o,r,s,l,c,d,p=this;return t||(t=new Date),s=t[p.getHours](),l=s>12?s-12:s,c=t[p.getMinutes](),d=t[p.getSeconds](),i=t[p.getDate](),a=t[p.getDay](),o=t[p.getMonth]()+1,r=t[p.getFullYear](),n=e.replace(/[a-z]/gi,function(e){switch(e){case"d":return i>9?i:"0"+i;case"j":return i;case"D":return p.i18n(p.i18.daysShort[a]);case"l":return p.i18n(p.i18.days[a]);case"m":return o>9?o:"0"+o;case"n":return o;case"M":return p.i18n(p.i18.monthsShort[o-1]);case"F":return p.i18n(p.i18.months[o-1]);case"Y":return r;case"y":return(""+r).substr(2);case"H":return s>9?s:"0"+s;case"G":return s;case"g":return l;case"h":return l>9?l:"0"+l;case"a":return s>=12?"pm":"am";case"A":return s>=12?"PM":"AM";case"i":return c>9?c:"0"+c;case"s":return d>9?d:"0"+d}return e})},formatDate:function(e,t){var n,i,a,o=this,r=t||e.ts;o.i18;return o.options.clientFormatDate&&r>0?(n=new Date(1e3*r),i=r>=this.yesterday?this.fancyFormat:this.dateFormat,a=o.date(i,n),r>=this.yesterday?a.replace("$1",this.i18n(r>=this.today?"Today":"Yesterday")):a):e.date?e.date.replace(/([a-z]+)\s/i,function(e,t){return o.i18n(t)+" "}):o.i18n("dateUnknown")},toLocaleString:function(e){var t=new Number(e);return t?t.toLocaleString?t.toLocaleString():String(e).replace(/(\d)(?=(\d\d\d)+(?!\d))/g,"$1,"):e},perms2class:function(e){var t="";return e.read||e.write?e.read?e.write||(t="elfinder-ro"):t="elfinder-wo":t="elfinder-na",e.type&&(t+=" elfinder-"+this.escape(e.type)),t},formatPermissions:function(e){var t=[];return e.read&&t.push(this.i18n("read")),e.write&&t.push(this.i18n("write")),t.length?t.join(" "+this.i18n("and")+" "):this.i18n("noaccess")},formatSize:function(e){var t=1,n="b";return"unknown"==e?this.i18n("unknown"):(e>1073741824?(t=1073741824,n="GB"):e>1048576?(t=1048576,n="MB"):e>1024&&(t=1024,n="KB"),e/=t,(e>0?t>=1048576?e.toFixed(2):Math.round(e):0)+" "+n)},formatFileMode:function(t,n){var i,a,o,r,s,l,c,d,p;if(n||(n=this.options.fileModeStyle.toLowerCase()),t=e.trim(t),t.match(/[rwxs-]{9}$/i)){if(d=t=t.substr(-9),"string"==n)return d;for(p="",o=0,i=0;i<7;i+=3)a=t.substr(i,3),r=0,a.match(/[r]/i)&&(r+=4),a.match(/[w]/i)&&(r+=2),a.match(/[xs]/i)&&(a.match(/[xs]/)&&(r+=1),a.match(/[s]/i)&&(0==i?o+=4:3==i&&(o+=2))),p+=r.toString(8);o&&(p=o.toString(8)+p)}else{if(t=parseInt(t,8),p=t?t.toString(8):"",!t||"octal"==n)return p;for(a=t.toString(8),o=0,a.length>3&&(a=a.substr(-4),o=parseInt(a.substr(0,1),8),a=a.substr(1)),s=1==(1&o),c=2==(2&o),l=4==(4&o),d="",i=0;i<3;i++)d+=4==(4&parseInt(a.substr(i,1),8))?"r":"-",d+=2==(2&parseInt(a.substr(i,1),8))?"w":"-",d+=1==(1&parseInt(a.substr(i,1),8))?0==i&&l||1==i&&c?"s":"x":"-"}return"both"==n?d+" ("+p+")":"string"==n?d:p},registRawStringDecoder:function(t){e.isFunction(t)&&(this.decodeRawString=this.options.rawStringDecoder=t)},uploadMimeCheck:function(t,n){n=n||this.cwd().hash;var i,a,o=!0,r=this.option("uploadMime",n),s=function(n){var i=!1;return"string"==typeof n&&"all"===n.toLowerCase()?i=!0:Array.isArray(n)&&n.length&&e.each(n,function(e,n){if(n=n.toLowerCase(),"all"===n||0===t.indexOf(n))return i=!0,!1}),i};return t&&e.isPlainObject(r)&&(t=t.toLowerCase(),i=s(r.allow),a=s(r.deny),"allow"===r.firstOrder?(o=!1,a||i!==!0||(o=!0)):(o=!0,a!==!0||i||(o=!1))),o},sequence:function(e){var t=e.length,n=function(t,i){return++i,e[i]?n(t.then(e[i]),i):t};return t>1?n(e[0](),0):e[0]()},reloadContents:function(t){var n,i=e.Deferred();try{n=e('';d.remove(),e(x).appendTo("body").ready(function(){setTimeout(function(){e(x).each(function(){e("#"+e(this).attr("id")).remove()})},2e4+1e4*i)}),b.trigger("download",{files:y}),w.resolve()}),u=y.length,g=[],i=0;i');return t&&e.each(t,function(e,t){a=i.escape(t.value),o.append('")}),e.each(n.options.encodings,function(e,t){o.append('")}),o},d=function(){var t,a,o=i.options.dialogContained?i.getUI():e(window);return a="string"==typeof n.options.dialogWidth&&(t=n.options.dialogWidth.match(/(\d+)%/))?parseInt(o.width()*(t[1]/100)):parseInt(n.options.dialogWidth||650),Math.min(a,o.width())},p=function(){if(n.options.dialogHeight){var t,a,o=i.options.dialogContained?i.getUI():e(window);return a="string"==typeof n.options.dialogHeight&&(t=n.options.dialogHeight.match(/(\d+)%/))?parseInt(o.height()*(t[1]/100)):parseInt(n.options.dialogHeight||o.height()),Math.min(a,o.height())}},u=function(t){var a,l,c,d=t.length;return d>1&&(a=t[0].mime,l=t[0].name.replace(/^.*(\.[^.]+)$/,"$1")),e.grep(t,function(t){var p;return!c&&"directory"!==t.mime&&(p=t.read&&(s||i.mimeIsText(t.mime)||e.inArray(t.mime,1===d?o:r)!==-1)&&(!n.onlyMimes.length||e.inArray(t.mime,n.onlyMimes)!==-1)&&(1===d||t.mime===a&&t.name.substr(l.length*-1)===l)&&!!i.uploadMimeCheck(t.mime,t.phash)&&b(t,d)&&Object.keys(g).length,p||(c=!0),p)})},h=function(e){var t,n=i.file(e);i.request({cmd:"info",targets:[e],preventDefault:!0}).done(function(e){var a;e&&e.files&&e.files.length&&(t=e.files[0],n.ts==t.ts&&n.size==t.size||(a={changed:[t]},i.updateCache(a),i.change(a)))})},f=function(t,o,r,s,u,f){var g,v,b,y,w,k,C=e.Deferred(),z=!1,T=function(){return!!z||(i.toast({mode:"warning",msg:i.i18n("nowLoading")}),!1)},A=function(){f&&Array.isArray(f)&&e.each(f,function(){this.msg&&i.toast(this)})},j=function(){var t,n,a,o=y?y.val():void 0,r=e.Deferred().fail(function(e){b.show().find("button.elfinder-btncnt-0,button.elfinder-btncnt-1").hide()});return T()?(g.editor&&(g.editor.save(g[0],g.editor.instance),t=g.editor.confObj,t.info&&(t.info.schemeContent||t.info.arrayBufferContent)&&(o="scheme")),n=D(),U(n),n.promise?(a=setTimeout(function(){i.notify({type:"chkcontent",cnt:1,hideCnt:!0,cancel:function(){n.reject()}})},100),n.always(function(){a&&clearTimeout(a),i.notify({type:"chkcontent",cnt:-1})}).done(function(e){C.notifyWith(g,[o,g.data("hash"),v,r])}).fail(function(e){r.reject(e)})):C.notifyWith(g,[o,g.data("hash"),v,r]),r):r.resolve()},S=function(){T()&&j().fail(function(e){e&&i.error(e)})},O=function(){g.elfinderdialog("close")},I=function(){T()&&(b.hide(),j().done(function(){z=!1,b.show(),O()}).fail(function(e){b.show(),e&&i.error(e)}))},M=function(){if(T()){var t=v,r=o.phash,s=function(e){p.addClass(a).fadeIn(function(){e&&i.error(e)}),v=t,i.disable()},l=function(){n.mime=R.mime||o.mime,n.prefix=(R.name||o.name).replace(/ \d+(\.[^.]+)?$/,"$1"),n.requestCmd="mkfile",n.nextAction={},n.data={target:r},e.proxy(i.res("mixin","make"),n)().done(function(e){var t;e.added&&e.added.length?(t=g.data("hash"),g.data("hash",e.added[0].hash),j().done(function(){z=!1,b.show(),O(),p.fadeIn()}).fail(function(){i.exec("rm",[e.added[0].hash],{forceRm:!0,quiet:!0}),g.data("hash",t),b.find("button.elfinder-btncnt-2").hide(),s()})):s()}).progress(function(e){e&&"errUploadMime"===e&&g.trigger("saveAsFail")}).fail(s).always(function(){delete n.mime,delete n.prefix,delete n.nextAction,delete n.data}),i.trigger("unselectfiles",{files:[o.hash]})},c=null,d=null,p=i.getUI().children("."+n.dialogClass+":visible");b.is(":hidden")&&(p=p.add(b)),p.removeClass(a).fadeOut(),i.enable(),i.searchStatus.state<2&&r!==i.cwd().hash?c=i.exec("open",[r],{thash:r}):i.file(r)||(d=i.request({cmd:"info",targets:[r]})),e.when([c,d]).done(function(){d?i.one("infodone",function(){i.file(r)?l():s("errFolderNotFound")}):c?i.one("cwdrender",l):l()}).fail(s)}},E=function(){var t,n,a=e.Deferred();return z?(g.editor&&g.editor.save(g[0],g.editor.instance),t=D(),t&&t.promise?(n=setTimeout(function(){i.notify({type:"chkcontent",cnt:1,hideCnt:!0,cancel:function(){t.reject()}})},100),t.always(function(){n&&clearTimeout(n),i.notify({type:"chkcontent",cnt:-1})}).done(function(e){a.resolve(v!==e)}).fail(function(e){a.resolve(e||void 0!==v)})):a.resolve(v!==t),a):a.resolve(!1)},F={title:i.escape(o.name),width:d(),height:p(),buttons:{},cssClass:a,maxWidth:"window",maxHeight:"window",allowMinimize:!0,allowMaximize:!0,openMaximized:x()||u&&u.info&&u.info.openMaximized,btnHoverFocus:!1,closeOnEscape:!1,propagationEvents:["mousemove","mouseup","click"],minimize:function(){var e;g.editor&&b.closest(".ui-dialog").is(":hidden")&&(e=g.editor.confObj,e.info&&e.info.syncInterval&&h(o.hash))},close:function(){var e=function(){var e;C.resolve(),g.editor&&(g.editor.close(g[0],g.editor.instance),e=g.editor.confObj,e.info&&e.info.syncInterval&&h(o.hash)),g.elfinderdialog("destroy")},t="undefined"!=typeof R.name,a=t?{label:"btnSaveAs",callback:function(){requestAnimationFrame(M)}}:{label:"btnSaveClose",callback:function(){j().done(function(){e()})}};E().done(function(o){var r=["confirmNotSave"];o?("string"==typeof o&&r.unshift(o),i.confirm({title:n.title,text:r,accept:a,cancel:{label:"btnClose",callback:e},buttons:t?null:[{label:"btnSaveAs",callback:function(){requestAnimationFrame(M)}}]})):e()})},open:function(){var e,n,a;if(g.initEditArea.call(g,t,o,r,i),g.editor){if(e=g.editor.load(g[0])||null,e&&e.done)e.always(function(){z=!0}).done(function(e){g.editor.instance=e,g.editor.focus(g[0],g.editor.instance),U(D()),requestAnimationFrame(function(){b.trigger("resize")})}).fail(function(e){e&&i.error(e),g.elfinderdialog("destroy")}).always(A);else{if(z=!0,e&&("string"==typeof e||Array.isArray(e)))return i.error(e),void g.elfinderdialog("destroy");g.editor.instance=e,g.editor.focus(g[0],g.editor.instance),U(D()),requestAnimationFrame(function(){b.trigger("resize")}),A()}n=g.editor.confObj,n.info&&n.info.syncInterval&&(a=parseInt(n.info.syncInterval))&&setTimeout(function(){P(a)},a)}else z=!0,U(D())},resize:function(e,t){g.editor&&g.editor.resize(g[0],g.editor.instance,e,t||{})}},D=function(){var t=g.getContent.call(g,g[0]);return void 0!==t&&t!==!1&&null!==t||(t=e.Deferred().reject()),t},U=function(e){e&&e.promise?e.done(function(e){v=e}):v=e},P=function(e){b.is(":visible")&&(h(o.hash),setTimeout(function(){P(e)},e))},q=function(){y&&E().done(function(e){e?y.attr("title",i.i18n("saveAsEncoding")).addClass("elfinder-edit-changed"):y.attr("title",i.i18n("openAsEncoding")).removeClass("elfinder-edit-changed")})},R={};if(u&&(u.html&&(g=e(u.html)),w={init:u.init||null,load:u.load,getContent:u.getContent||null,save:u.save,beforeclose:"function"==typeof u.beforeclose?u.beforeclose:void 0,close:"function"==typeof u.close?u.close:function(){},focus:"function"==typeof u.focus?u.focus:function(){},resize:"function"==typeof u.resize?u.resize:function(){},instance:null,doSave:S,doCancel:O,doClose:I,file:o,fm:i,confObj:u,trigger:function(e,t){i.trigger("editEditor"+e,Object.assign({},u.info||{},t))}}),!g){if(!i.mimeIsText(o.mime))return C.reject("errEditorNotFound");!function(){g=e('').on("input propertychange",q),u&&u.info&&!u.info.useTextAreaEvent||g.on("keydown",function(t){var n,i,a=t.keyCode;t.stopPropagation(),a==e.ui.keyCode.TAB&&(t.preventDefault(),this.setSelectionRange&&(n=this.value,i=this.selectionStart,this.value=n.substr(0,i)+"\t"+n.substr(this.selectionEnd),i+=1,this.setSelectionRange(i,i))),(t.ctrlKey||t.metaKey)&&(a!="Q".charCodeAt(0)&&a!="W".charCodeAt(0)||(t.preventDefault(),O()),a=="S".charCodeAt(0)&&(t.preventDefault(),S()))}).on("mouseenter",function(){this.focus()}),g.initEditArea=function(e,t,n){g.hide().val(n),this._setupSelEncoding(n)}}()}return g._setupSelEncoding=function(t){var n=s&&"unknown"!==s?[{value:s}]:[],a=e("").hide(),r=function(t){t&&a.appendTo(y.parent()),a.empty().append(e("").text(y.val())),y.width(a.width())};""!==t&&s&&"UTF-8"===s||n.push({value:"UTF-8"}),y=c(n).on("touchstart",function(e){e.stopPropagation()}).on("change",function(){E().done(function(e){e||""===D()||(O(),m(o,y.val(),u).fail(function(e){e&&i.error(e)}))}),r()}).on("mouseover",q),g.parent().next().prepend(e('
').append(y)),r(!0)},g.data("hash",o.hash),w&&(g.editor=w,"function"==typeof w.beforeclose&&(F.beforeclose=function(){return w.beforeclose(g[0],w.instance)}),"function"==typeof w.init&&(g.initEditArea=w.init),"function"==typeof w.getContent&&(g.getContent=w.getContent)),g.initEditArea||(g.initEditArea=function(){}),g.getContent||(g.getContent=function(){return l(g.val())}),u&&u.info&&u.info.preventGet||(F.buttons[i.i18n("btnSave")]=S,F.buttons[i.i18n("btnSaveClose")]=I,F.buttons[i.i18n("btnSaveAs")]=M,F.buttons[i.i18n("btnCancel")]=O),u&&"function"==typeof u.prepare&&u.prepare(g,F,o),b=n.fmDialog(g,F).attr("id",t).on("keydown keyup keypress",function(e){e.stopPropagation()}).css({overflow:"hidden",minHeight:"7em"}).addClass("elfinder-edit-editor").closest(".ui-dialog").on("changeType",function(t,n){if(n.extention&&n.mime){var a=(n.extention,n.mime,e(this).children(".ui-dialog-buttonpane").children(".ui-dialog-buttonset"));a.children(".elfinder-btncnt-0,.elfinder-btncnt-1").hide(),R.name=i.splitFileExtention(o.name)[0]+"."+n.extention,R.mime=n.mime,n.keepEditor||a.children(".elfinder-btncnt-2").trigger("click")}}),k=(i.options.dialogContained?i.getUI():e(window)).width(),b.width()>k&&b.width(k),C.promise()},m=function(t,a,o){var r,s,l,d=t.hash,p=(i.options,e.Deferred()),u="edit-"+i.namespace+"-"+t.hash,h=i.getUI().find("#"+u),g=a?a:0,v=!1;if(h.length)return h.elfinderdialog("toTop"),p.resolve();if(!(t.read&&(t.write||o.info&&o.info.converter)))return s=["errOpen",t.name,"errPerm"],p.reject(s);if(o&&o.info){if("function"==typeof o.info.edit)return l=o.info.edit.call(i,t,o),l.promise?l.done(function(){p.resolve()}).fail(function(e){p.reject(e)}):l?p.resolve():p.reject(),p;v=o.info.preventGet||o.info.noContent,o.info.urlAsContent||v?(r=e.Deferred(),o.info.urlAsContent?i.url(d,{async:!0,onetime:!0,temporary:!0}).done(function(e){r.resolve({content:e})}):r.resolve({})):(g&&(t.encoding=g,i.cache(t,"change")),r=i.request({data:{cmd:"get",target:d,conv:g,_t:t.ts},options:{type:"get",cache:!0},notify:{type:"file",cnt:1},preventDefault:!0})),r.done(function(a){var r,s,l;a.doconv?i.confirm({title:n.title,text:"unknown"===a.doconv?"confirmNonUTF8":"confirmConvUTF8",accept:{label:"btnConv",callback:function(){p=m(t,r.val(),o)}},cancel:{label:"btnCancel",callback:function(){p.reject()}},optionsCallback:function(t){t.create=function(){var t=e('
'),n={value:a.doconv};"unknown"===a.doconv&&(n.caption="-"),r=c([n]),e(this).next().find(".ui-dialog-buttonset").prepend(t.append(e("").append(r)))}}}):(!v&&i.mimeIsText(t.mime)&&(s=new RegExp("^(data:"+t.mime.replace(/([.+])/g,"\\$1")+";base64,)","i"),o.info.dataScheme?window.btoa&&!a.content.match(s)&&(a.content="data:"+t.mime+";base64,"+btoa(a.content)):window.atob&&(l=a.content.match(s))&&(a.content=atob(a.content.substr(l[1].length)))),f(u,t,a.content,a.encoding,o,a.toasts).done(function(e){p.resolve(e)}).progress(function(e,t,n,a){var o=this;t&&(d=t),i.request({options:{type:"post"},data:{cmd:"put",target:d,encoding:e||n.encoding,content:n},notify:{type:"save",cnt:1},syncOnFail:!0,preventFail:!0,navigate:{target:"changed",toast:{inbuffer:{msg:i.i18n(["complete",i.i18n("btnSave")])}}}}).fail(function(e){p.reject(e),a.reject()}).done(function(e){requestAnimationFrame(function(){o.trigger("focus"),o.editor&&o.editor.focus(o[0],o.editor.instance)}),a.resolve()})}).fail(function(e){p.reject(e)}))}).fail(function(e){var n=i.parseError(e);n=Array.isArray(n)?n[0]:n,t.encoding&&(t.encoding="",i.cache(t,"change")),"errConvUTF8"!==n&&i.sync(),p.reject(e)})}return p.promise()},g={},v={info:{id:"textarea",name:"TextArea",useTextAreaEvent:!0},load:function(t){this.trigger("Prepare",{node:t,editorObj:void 0,instance:void 0,opts:{}}),t.setSelectionRange&&t.setSelectionRange(0,0),e(t).trigger("focus").show()},save:function(){}},b=function(a,o){var r=function(t,n){if(n){if("*"===n[0]||e.inArray(t,n)!==-1)return!0;var a,o;for(o=n.length,a=0;a0||!t.info.converter&&t.info.canMakeEmpty!==!1&&i.mimesCanMakeEmpty[a.mime])&&(!t.info.maxSize||a.size<=t.info.maxSize)&&r(a.mime,t.mimes||null)&&s(a.name,t.exts||null)&&"function"==typeof t.load&&"function"==typeof t.save&&(n=t.info.name?t.info.name:"Editor "+e,t.id=t.info.id?t.info.id:"editor"+e,t.name=n,t.i18n=i.i18n(n),g[t.id]=t)}),!!Object.keys(g).length},y=function(n,a){n&&a&&(e.isPlainObject(t)||(t={}),t[n]=a.id,i.storage("storedEditors",t),i.trigger("selectfiles",{files:i.selected()}))},w=function(){var e=i.storage("useStoredEditor");return e?e>0:n.options.useStoredEditor},x=function(){var e=i.storage("editorMaximized");return e?e>0:n.options.editorMaximized},k=function(t,n){var a=[];return e.each(g,function(e,o){a.push({label:i.escape(o.i18n),icon:o.info&&o.info.icon?o.info.icon:"edit",options:{iconImg:o.info&&o.info.iconImg?i.baseUrl+o.info.iconImg:void 0},callback:function(){y(t[0].mime,o),n&&n.call(o)}})}),a},C=function(e){return e.toLowerCase().replace(/ +/g,"")},z=function(e){var n=t[e];return n&&Object.keys(g).length?g[C(n)]:void 0};this.getEncSelect=c,this.shortcuts=[{pattern:"ctrl+e"}],this.init=function(){var t,n,i=this,a=this.fm,l=this.options,c=[];this.onlyMimes=this.options.mimes||[],a.one("open",function(){l.editors&&Array.isArray(l.editors)&&(a.trigger("canMakeEmptyFile",{mimes:Object.keys(a.storage("mkfileTextMimes")||{}).concat(l.makeTextMimes||["text/plain"])}),e.each(l.editors,function(e,t){t.info&&t.info.cmdCheck&&c.push(t.info.cmdCheck)}),c.length?a.api>=2.103?n=a.request({data:{cmd:"editor",name:c,method:"enabled"},preventDefault:!0}).done(function(e){t=e}).fail(function(){t={}}):(t={},n=e.Deferred().resolve()):n=e.Deferred().resolve(),n.always(function(){t&&(l.editors=e.grep(l.editors,function(e){return!e.info||!e.info.cmdCheck||!!t[e.info.cmdCheck]})),e.each(l.editors,function(e,t){t.setup&&"function"==typeof t.setup&&t.setup.call(t,l,a),t.disabled||(t.mimes&&Array.isArray(t.mimes)&&(o=o.concat(t.mimes),t.info&&t.info.single||(r=r.concat(t.mimes))),!s&&t.mimes&&"*"===t.mimes[0]&&(s=!0),t.info||(t.info={}),t.info.integrate&&a.trigger("helpIntegration",Object.assign({cmd:"edit"},t.info.integrate)),t.info.canMakeEmpty&&a.trigger("canMakeEmptyFile",{mimes:Array.isArray(t.info.canMakeEmpty)?t.info.canMakeEmpty:t.mimes}))}),o=(e.uniqueSort||e.unique)(o),r=(e.uniqueSort||e.unique)(r),l.editors=e.grep(l.editors,function(e){return!e.disabled})}))}).bind("select",function(){g=null}).bind("contextmenucreate",function(t){var n,o,r=function(e){var t=i.title;a.one("contextmenucreatedone",function(){i.title=t}),i.title=a.escape(e.i18n),e.info&&e.info.iconImg&&(i.contextmenuOpts={iconImg:a.baseUrl+e.info.iconImg}),delete i.variants};i.contextmenuOpts=void 0,"files"===t.data.type&&i.enabled()&&(n=a.file(t.data.targets[0]),b(n,t.data.targets.length)&&(Object.keys(g).length>1?w()&&(o=z(n.mime))?(r(o),i.extra={icon:"menu",node:e("").attr({title:a.i18n("select")}).on("click touchstart",function(t){if(!("touchstart"===t.type&&t.originalEvent.touches.length>1)){var n=e(this);t.stopPropagation(),t.preventDefault(),a.trigger("contextmenu",{raw:k(a.selectedFiles(),function(){var e=a.selected();a.exec("edit",e,{editor:this}),a.trigger("selectfiles",{files:e})}),x:n.offset().left,y:n.offset().top})}})}):(delete i.extra,i.variants=[],e.each(g,function(e,t){i.variants.push([{editor:t},t.i18n,t.info&&t.info.iconImg?a.baseUrl+t.info.iconImg:"edit"])})):(r(g[Object.keys(g)[0]]),delete i.extra)))}).bind("canMakeEmptyFile",function(t){if(t.data&&t.data.resetTexts){var n=a.arrayFlip(i.options.makeTextMimes||["text/plain"]),o=i.getMkfileHides();e.each(a.storage("mkfileTextMimes")||{},function(e,t){n[e]||(delete a.mimesCanMakeEmpty[e],delete o[e])}),a.storage("mkfileTextMimes",null),Object.keys(o).length?a.storage("mkfileHides",o):a.storage("mkfileHides",null)}})},this.getstate=function(e){var t=this.files(e),n=t.length;return n&&u(t).length==n?0:-1},this.exec=function(t,n){var i,a=this.fm,o=u(this.files(t)),r=e.map(o,function(e){return e.hash}),s=[],l=n&&n.editor?n.editor:null,c=e(n&&n._currentNode?n._currentNode:a.cwdHash2Elm(r[0])),d=function(){var t=e.Deferred();return!l&&Object.keys(g).length>1?w()&&(l=z(o[0].mime))?t.resolve(l):(a.trigger("contextmenu",{raw:k(o,function(){t.resolve(this)}),x:c.offset().left,y:c.offset().top+22,opened:function(){a.one("closecontextmenu",function(){requestAnimationFrame(function(){"pending"===t.state()&&t.reject()})})}}),a.trigger("selectfiles",{files:r}),t):(Object.keys(g).length>1&&l&&y(o[0].mime,l),t.resolve(l?l:Object.keys(g).length?g[Object.keys(g)[0]]:null))},p=e.Deferred();return null===g&&b(o[0],r.length),c.length||(c=a.getUI("cwd")),d().done(function(t){for(;i=o.shift();)s.push(m(i,i.encoding||void 0,t).fail(function(e){e&&a.error(e)}));s.length?e.when.apply(null,s).done(function(){p.resolve()}).fail(function(){p.reject()}):p.reject()}).fail(function(){p.reject()}),p},this.getMkfileHides=function(){return i.storage("mkfileHides")||i.arrayFlip(n.options.mkfileHideMimes||[])}},i.prototype.commands.empty=function(){var t,n,i=function(e){var i=t.files(e);return i.length||(i=[n.cwd()]),i};this.linkedCmds=["rm"],this.init=function(){t=this,n=this.fm},this.getstate=function(t){var n,a=i(t),o=function(t){var n=!0;return e.grep(t,function(e){return n=!!(n&&e.read&&e.write&&"directory"===e.mime)})};return n=a.length,o(a).length==n?0:-1},this.exec=function(t){var a=i(t),o=a.length,r=e.Deferred().done(function(){var t={changed:{}};n.toast({msg:n.i18n(['"'+s.join('", ')+'"',"complete",n.i18n("cmdempty")])}),e.each(a,function(e,n){t.changed[n.hash]=n}),n.change(t)}).always(function(){var t=n.cwd().hash;n.trigger("selectfiles",{files:e.map(a,function(e){return t===e.phash?e.hash:null})})}),s=[],l=function(e){"number"==typeof e?(s.push(a[e].name),delete a[e].dirs):e&&n.error(e),--o<1&&r[s.length?"resolve":"reject"]()};return e.each(a,function(t,i){var a;return i.write&&"directory"===i.mime?n.isCommandEnabled("rm",i.hash)?(a=setTimeout(function(){n.notify({type:"search",cnt:1,hideCnt:!(o>1)})},n.notifyDelay),void n.request({data:{cmd:"open",target:i.hash},preventDefault:!0,asNotOpen:!0}).done(function(r){var s=[];a&&clearTimeout(a),n.ui.notify.children(".elfinder-notify-search").length&&n.notify({type:"search",cnt:-1,hideCnt:!(o>1)}),r&&r.files&&r.files.length?r.files.length>n.maxTargets?l(["errEmpty",i.name,"errMaxTargets",n.maxTargets]):(n.updateCache(r),e.each(r.files,function(e,t){return!t.write||t.locked?(l(["errEmpty",i.name,"errRm",t.name,"errPerm"]),s=[],!1):void s.push(t.hash)}),s.length&&n.exec("rm",s,{_userAction:!0,addTexts:[n.i18n("folderToEmpty",i.name)]}).fail(function(e){n.trigger("unselectfiles",{files:n.selected()}),l(n.parseError(e)||"")}).done(function(){l(t)})):(n.toast({mode:"warning",msg:n.i18n("filderIsEmpty",i.name)}),l(""))}).fail(function(e){l(n.parseError(e)||"")})):(l(["errCmdNoSupport",'"rm"']),null):(l(["errEmpty",i.name,"errPerm"]),null)}),r}},i.prototype.commands.extract=function(){var t=this,n=t.fm,i=[],a=function(t){var n=!0;return e.grep(t,function(t){return n=!(!n||!t.read||e.inArray(t.mime,i)===-1)})};this.variants=[],this.disableOnSearch=!0,n.bind("open reload",function(){i=n.option("archivers").extract||[],n.api>2?t.variants=[[{makedir:!0},n.i18n("cmdmkdir")],[{},n.i18n("btnCwd")]]:t.variants=[[{},n.i18n("btnCwd")]],t.change()}),this.getstate=function(t){var i,o,r=this.files(t),s=r.length;return s&&a(r).length==s?n.searchStatus.state>0?(i=this.fm.cwd().hash,e.each(r,function(e,t){return o=t.phash===i}),o?0:-1):this.fm.cwd().write?0:-1:-1},this.exec=function(t,a){var o,r,s,l=this.files(t),c=e.Deferred(),d=l.length,p=a&&a.makedir?1:0,u=!1,h=!1,f=0,m=n.files(l[0].phash),g=[],v={};e.each(m,function(e,t){v[t.name]=t,g.push(t.name)});var b=function(e){switch(e){case"overwrite_all":u=!0;break;case"omit_all":h=!0}},y=function(t){t.read&&n.file(t.phash).write?e.inArray(t.mime,i)===-1?(r=["errExtract",t.name,"errNoArchive"],n.error(r),c.reject(r)):n.request({data:{cmd:"extract",target:t.hash,makedir:p},notify:{type:"extract",cnt:1},syncOnFail:!0,navigate:{toast:p?{incwd:{msg:n.i18n(["complete",n.i18n("cmdextract")]),action:{cmd:"open",msg:"cmdopen"}},inbuffer:{msg:n.i18n(["complete",n.i18n("cmdextract")]),action:{cmd:"open",msg:"cmdopen"}}}:{inbuffer:{msg:n.i18n(["complete",n.i18n("cmdextract")])}}}}).fail(function(e){"rejected"!=c.state()&&c.reject(e)}).done(function(){}):(r=["errExtract",t.name,"errPerm"],n.error(r),c.reject(r))},w=function(t,i){var a=t[i],r=n.splitFileExtention(a.name)[0],l=e.inArray(r,g)>=0,m=function(){i+10&&y(a),m())};return this.enabled()&&d&&i.length?(d>0&&w(l,0),c):c.reject()}},(i.prototype.commands.forward=function(){this.alwaysEnabled=!0,this.updateOnSelect=!0,this.shortcuts=[{pattern:"ctrl+right"}],this.getstate=function(){return this.fm.history.canForward()?0:-1},this.exec=function(){return this.fm.history.forward()}}).prototype={forceLoad:!0},i.prototype.commands.fullscreen=function(){var t=this,n=this.fm,i=function(e,i){var a;e.preventDefault(),e.stopPropagation(),i&&i.fullscreen&&(a="on"===i.fullscreen,t.update(void 0,a),t.title=n.i18n(a?"reinstate":"cmdfullscreen"))};this.alwaysEnabled=!0,this.updateOnSelect=!1,this.syncTitleOnChange=!0,this.value=!1,this.options={ui:"fullscreenbutton"},this.getstate=function(){return 0},this.exec=function(){var i=n.getUI().get(0),a=i===n.toggleFullscreen(i);return t.title=n.i18n(a?"reinstate":"cmdfullscreen"),t.update(void 0,a),e.Deferred().resolve()},n.bind("init",function(){n.getUI().off("resize."+n.namespace,i).on("resize."+n.namespace,i)})},(i.prototype.commands.getfile=function(){var t=this,n=this.fm,i=function(n){var i=t.options,a=!0;return n=e.grep(n,function(e){return a=!(!a||"directory"==e.mime&&!i.folders||!e.read)}),i.multiple||1==n.length?n:[]};this.alwaysEnabled=!0,this.callback=n.options.getFileCallback,this._disabled="function"==typeof this.callback,this.getstate=function(e){var t=this.files(e),n=t.length;return this.callback&&n&&i(t).length==n?0:-1},this.exec=function(n){var i,a,o,r=this.fm,s=this.options,l=this.files(n),c=l.length,d=r.option("url"),p=r.option("tmbUrl"),u=e.Deferred().done(function(e){var n,i=function(){"close"==s.oncomplete?r.hide():"destroy"==s.oncomplete&&r.destroy()},a=function(e){"close"==s.onerror?r.hide():"destroy"==s.onerror?r.destroy():e&&r.error(e)};r.trigger("getfile",{files:e});try{n=t.callback(e,r)}catch(o){return void a(["Error in `getFileCallback`.",o.message])}"object"==typeof n&&"function"==typeof n.done?n.done(i).fail(a):i()}),h=function(t){return s.onlyURL?s.multiple?e.map(l,function(e){return e.url}):l[0].url:s.multiple?l:l[0]},f=[];for(i=0;i {link}
',d='
{author}
{work}
',p=/\{url\}/,u=/\{link\}/,h=/\{author\}/,f=/\{work\}/,m="replace",g="ui-priority-primary",v="ui-priority-secondary",b="elfinder-help-license",y='
  • {title}
  • ',w=['
    ','
      '],x='
      {pattern}
      {descrip}
      ',k='
      ',C=e("base").length?s.escape(document.location.href.replace(/#.*$/,"")):"",z=s.res("class","tabsactive"),T=function(){var e;return e=s.theme&&s.theme.author?d[m]("elfinder-help-team","elfinder-help-team elfinder-help-term-theme")[m](h,s.i18n(s.theme.author)+(s.theme.email?" <"+s.theme.email+">":""))[m](f,s.i18n("theme")+" ("+s.i18n(s.theme.name)+")"):''},A=function(){w.push('
      '),w.push("

      elFinder

      "),w.push('
      '+s.i18n("webfm")+"
      "),w.push('
      '+s.i18n("ver")+": "+s.version+"
      "),w.push('
      '+s.i18n("protocolver")+':
      '),w.push('
      jQuery/jQuery UI: '+e().jquery+"/"+e.ui.version+"
      "),w.push(k),w.push(c[m](p,"https://studio-42.github.io/elFinder/")[m](u,s.i18n("homepage"))),w.push(c[m](p,"https://github.com/Studio-42/elFinder/wiki")[m](u,s.i18n("docs"))),w.push(c[m](p,"https://github.com/Studio-42/elFinder")[m](u,s.i18n("github"))),w.push(k),w.push('
      '+s.i18n("team")+"
      "),w.push(d[m](h,'Dmitry "dio" Levashov <dio@std42.ru>')[m](f,s.i18n("chiefdev"))),w.push(d[m](h,"Naoki Sawada <hypweb+elfinder@gmail.com>")[m](f,s.i18n("developer"))),w.push(d[m](h,"Troex Nevelin <troex@fury.scancode.ru>")[m](f,s.i18n("maintainer"))),w.push(d[m](h,"Alexey Sukhotin <strogg@yandex.ru>")[m](f,s.i18n("contributor"))),s.i18[s.lang].translator&&e.each(s.i18[s.lang].translator.split(", "),function(){w.push(d[m](h,e.trim(this))[m](f,s.i18n("translator")+" ("+s.i18[s.lang].language+")"))}),w.push(T()),w.push(k),w.push('
      '+s.i18n("icons")+': Pixelmixer, Fugue, Icons8
      '),w.push(k),w.push('
      Licence: 3-clauses BSD Licence
      '),w.push('
      Copyright © 2009-2021, Studio 42
      '),w.push('
      „ …'+s.i18n("dontforget")+" ”
      "),w.push("
      ")},j=function(){var t=s.shortcuts();w.push('
      '),t.length?(w.push('
      '),e.each(t,function(e,t){w.push(x.replace(/\{pattern\}/,t[0]).replace(/\{descrip\}/,t[1]))}),w.push("
      ")):w.push('
      '+s.i18n("shortcutsof")+"
      "),w.push("
      ")},S=function(){w.push('
      '),w.push('DON\'T PANIC'),w.push("
      ")},O=!1,I=function(){O=!0,w.push('
      ')},M=!1,E=function(){M=!0,w.push('
      '),w.push('
        '),w.push("
        ")},F=function(){var n,i,a,c,d,p,u=function(t,n){return e.each(n,function(n,i){t.append(e("
        ").text(n)),"undefined"==typeof i?t.append(e("
        ").append(e("").text("undfined"))):"object"!=typeof i||i?"object"==typeof i&&(e.isPlainObject(i)||i.length)?t.append(e("
        ").append(u(e("
        "),i))):t.append(e("
        ").append(e("").text(i&&"object"==typeof i?"[]":i?i:'""'))):t.append(e("
        ").append(e("").text("null")))}),t},h=r.children("li").length;(l.debug.options||l.debug.debug)&&(h>=5&&(d=r.children("li:last"),p=o.children("div:last"),p.is(":hidden")?(d.remove(),p.remove()):(d.prev().remove(),p.prev().remove())),a=s.namespace+"-help-debug-"+ +new Date,n=e("
      • ").html(''+l.debug.debug.cmd+"").prependTo(r),i=e('
        ').data("debug",l.debug),n.on("click.debugrender",function(){var t=i.data("debug");i.removeData("debug"), -t&&(i.hide(),t.debug&&(c=e("
        ").append(e("").text("debug"),u(e("
        "),t.debug)),i.append(c)),t.options&&(c=e("
        ").append(e("").text("options"),u(e("
        "),t.options)),i.append(c)),i.show()),n.off("click.debugrender")}),r.after(i),t&&o.tabs("refresh"))},D="";this.alwaysEnabled=!0,this.updateOnSelect=!1,this.state=-1,this.shortcuts=[{pattern:"f1",description:this.title}],s.bind("load",function(){var c,d,p,u,h,f,g=l.options.view||["about","shortcuts","help","integrations","debug"];(c=e.inArray("preference",g))!==-1&&g.splice(c,1),e.fn.tabs||(c=e.inArray(g,"debug"))!==-1&&g.splice(c,1),e.each(g,function(e,t){w.push(y[m](/\{id\}/g,t)[m](/\{title\}/,s.i18n(t)))}),w.push("
      "),e.inArray("about",g)!==-1&&A(),e.inArray("shortcuts",g)!==-1&&j(),e.inArray("help",g)!==-1&&(d=s.i18nBaseUrl+"help/%s.html.js",S()),e.inArray("integrations",g)!==-1&&I(),e.inArray("debug",g)!==-1&&E(),w.push("
      "),D=e(w.join("")),D.find(".ui-tabs-nav li").on("mouseenter mouseleave",function(t){e(this).toggleClass("ui-state-hover","mouseenter"===t.type)}).on("focus blur","a",function(t){e(t.delegateTarget).toggleClass("ui-state-focus","focusin"===t.type)}).children().on("click",function(t){var n=e(this);t.preventDefault(),t.stopPropagation(),n.parent().addClass(z).siblings().removeClass(z),D.children(".ui-tabs-panel").hide().filter(n.attr("href")).show()}).filter(":first").trigger("click"),O&&(n=D.find(".elfinder-help-tab-integrations").hide(),i=D.find("#"+s.namespace+"-help-integrations").hide().append(e('
      ').html(s.i18n("integrationWith"))),s.bind("helpIntegration",function(t){var a,o,r,l,c=i.children("ul:first");t.data&&(e.isPlainObject(t.data)?(a=Object.assign({link:"",title:"",banner:""},t.data),(a.title||a.link)&&(a.title||(a.title=a.link),o=a.link?e("").attr("href",a.link).attr("target","_blank").text(a.title):e("").text(a.title),a.banner&&(o=e("").append(e("").attr(a.banner),o)))):(o=e(t.data),o.filter("a").each(function(){var t=e(this);t.attr("target")||t.attr("target","_blank")})),o&&(n.show(),c.length||(c=e('
        ').appendTo(i)),a&&a.cmd?(l="elfinder-help-integration-"+a.cmd,r=c.find("ul."+l),r.length||(r=e('
          '),c.append(e("
        • ").append(e("").html(s.i18n("cmd"+a.cmd))).append(r))),o=r.append(e("
        • ").append(o))):c.append(e("
        • ").append(o))))}).bind("themechange",function(){D.find("div.elfinder-help-term-theme").replaceWith(T())})),M&&(a=D.find(".elfinder-help-tab-debug").hide(),o=D.find("#"+s.namespace+"-help-debug").children("div:first"),r=o.children("ul:first").on("click",function(e){e.preventDefault(),e.stopPropagation()}),l.debug={},s.bind("backenddebug",function(e){M&&e.data&&e.data.debug&&(l.debug={options:e.data.options,debug:Object.assign({cmd:s.currentReqCmd},e.data.debug)},l.dialog&&F())})),D.find("#"+s.namespace+"-help-about").find(".apiver").text(s.api),l.dialog=l.fmDialog(D,{title:l.title,width:530,maxWidth:"window",maxHeight:"window",autoOpen:!1,destroyOnClose:!1,close:function(){M&&(a.hide(),o.tabs("destroy")),t=!1}}).on("click",function(e){e.stopPropagation()}).css({overflow:"hidden"}),p=l.dialog.children(".ui-tabs"),u=p.children(".ui-tabs-nav:first"),h=p.children(".ui-tabs-panel"),f=l.dialog.outerHeight(!0)-l.dialog.height(),l.dialog.closest(".ui-dialog").on("resize",function(){h.height(l.dialog.height()-f-u.outerHeight(!0)-20)}),d&&l.dialog.one("initContents",function(){e.ajax({url:l.options.helpSource?l.options.helpSource:d.replace("%s",s.lang),dataType:"html"}).done(function(t){e("#"+s.namespace+"-help-help").html(t)}).fail(function(){e.ajax({url:d.replace("%s","en"),dataType:"html"}).done(function(t){e("#"+s.namespace+"-help-help").html(t)})})}),l.state=0,s.trigger("helpBuilded",l.dialog)}).one("open",function(){var e=!1;s.one("backenddebug",function(){e=!0}).one("opendone",function(){requestAnimationFrame(function(){!e&&M&&(M=!1,a.hide(),o.hide(),r.hide())})})}),this.getstate=function(){return 0},this.exec=function(n,i){var s=i?i.tab:void 0,l=function(){M&&(o.tabs(),r.find("a:first").trigger("click"),a.show(),t=!0)};return l(),this.dialog.trigger("initContents").elfinderdialog("open").find((s?".elfinder-help-tab-"+s:".ui-tabs-nav li")+" a:first").trigger("click"),e.Deferred().resolve()}}).prototype={forceLoad:!0},i.prototype.commands.hidden=function(){this.hidden=!0,this.updateOnSelect=!1,this.getstate=function(){return-1}},i.prototype.commands.hide=function(){var t,n,i,a,o=this,r={};this.syncTitleOnChange=!0,this.shortcuts=[{pattern:"ctrl+shift+dot",description:this.fm.i18n("toggleHidden")}],this.init=function(){var e=this.fm;t=e.storage("hide")||{items:{}},n=Object.keys(t.items).length,this.title=e.i18n(t.show?"hideHidden":"showHidden"),o.update(void 0,o.title)},this.fm.bind("select contextmenucreate closecontextmenu",function(e,r){var s=(e.data?e.data.selected||e.data.targets:null)||r.selected();"select"===e.type&&e.data?a=e.data.origin:"contextmenucreate"===e.type&&(i=e.data.type),!s.length||("contextmenucreate"!==e.type&&"navbar"!==a||"cwd"===i)&&s[0]===r.cwd().hash?o.title=r.i18n(t.show?"hideHidden":"showHidden"):o.title=r.i18n("cmdhide"),"closecontextmenu"!==e.type?o.update("cwd"===i?n?0:-1:void 0,o.title):(i="",requestAnimationFrame(function(){o.update(void 0,o.title)}))}),this.getstate=function(e){return this.fm.cookieEnabled&&"cwd"!==i&&(e||this.fm.selected()).length||n?0:-1},this.exec=function(i,s){var l,c,d=this.fm,p=e.Deferred().done(function(){d.trigger("hide",{items:h,opts:s})}).fail(function(e){d.error(e)}),u=s||{},h=u.targets?u.targets:i||d.selected(),f=[];if(t=d.storage("hide")||{},e.isPlainObject(t)||(t={}),e.isPlainObject(t.items)||(t.items={}),("shortcut"===s._currentType||!h.length||"navbar"!==s._currentType&&"navbar"!==a&&h[0]===d.cwd().hash)&&(t.show?u.hide=!0:Object.keys(t.items).length&&(u.show=!0)),u.reset&&(u.show=!0,n=0),u.show||u.hide){if(u.show?t.show=!0:delete t.show,u.show)return d.storage("hide",u.reset?null:t),o.title=d.i18n("hideHidden"),o.update(u.reset?-1:void 0,o.title),e.each(t.items,function(e){var t=d.file(e,!0);t&&(d.searchStatus.state||!t.phash||d.file(t.phash))&&f.push(t)}),f.length&&(d.updateCache({added:f}),d.add({added:f})),u.reset&&(t={items:{}}),p.resolve();h=Object.keys(t.items)}return h.length&&(e.each(h,function(e,n){var i;t.items[n]||(i=d.file(n),i&&(r[n]=i.i18||i.name),t.items[n]=r[n]?r[n]:n)}),n=Object.keys(t.items).length,l=this.files(h),d.storage("hide",t),d.remove({removed:h}),t.show&&this.exec(void 0,{hide:!0}),u.hide||(c={},c.undo={cmd:"hide",callback:function(){var t=d.storage("hide");t&&(e.each(h,function(e,n){delete t.items[n]}),n=Object.keys(t.items).length,d.storage("hide",t),d.trigger("hide",{items:h,opts:{}}),o.update(n?0:-1)),d.updateCache({added:l}),d.add({added:l})}},c.redo={cmd:"hide",callback:function(){return d.exec("hide",void 0,{targets:h})}})),"rejected"==p.state()?p:p.resolve(c)}},(i.prototype.commands.home=function(){this.title="Home",this.alwaysEnabled=!0,this.updateOnSelect=!1,this.shortcuts=[{pattern:"ctrl+home ctrl+shift+up",description:"Home"}],this.getstate=function(){var e=this.fm.root(),t=this.fm.cwd().hash;return e&&t&&e!=t?0:-1},this.exec=function(){return this.fm.exec("open",this.fm.root())}}).prototype={forceLoad:!0},(i.prototype.commands.info=function(){var t=this.fm,n="elfinder-spinner",i="elfinder-info-button",a={calc:t.i18n("calc"),size:t.i18n("size"),unknown:t.i18n("unknown"),path:t.i18n("path"),aliasfor:t.i18n("aliasfor"),modify:t.i18n("modify"),perms:t.i18n("perms"),locked:t.i18n("locked"),dim:t.i18n("dim"),kind:t.i18n("kind"),files:t.i18n("files"),folders:t.i18n("folders"),roots:t.i18n("volumeRoots"),items:t.i18n("items"),yes:t.i18n("yes"),no:t.i18n("no"),link:t.i18n("link"),owner:t.i18n("owner"),group:t.i18n("group"),perm:t.i18n("perm"),getlink:t.i18n("getLink")},o=function(e,t){return t?e.replace(/\u200B/g,""):e.replace(/(\/|\\)/g,"$1​")};this.items=["size","aliasfor","path","link","dim","modify","perms","locked","owner","group","perm"],this.options.custom&&Object.keys(this.options.custom).length&&e.each(this.options.custom,function(e,t){t.label&&this.items.push(t.label)}),this.tpl={main:'
          {title}
          {content}
          ',itemTitle:'{name}{kind}',groupTitle:"{items}: {num}",row:'{label} : {value}',spinner:'{text} '},this.alwaysEnabled=!0,this.updateOnSelect=!1,this.shortcuts=[{pattern:"ctrl+i"}],this.init=function(){e.each(a,function(e,n){a[e]=t.i18n(n)})},this.getstate=function(){return 0},this.exec=function(t){var r=this.files(t);r.length||(r=this.files([this.fm.cwd().hash]));var s,l,c,d,p,u,h,f,m,g=this,v=this.fm,b=this.options,y=this.tpl,w=y.row,x=r.length,k=[],C=y.main,z="{label}",T="{value}",A=[],j=null,S={title:v.i18n("selectionInfo"),width:"auto",close:function(){e(this).elfinderdialog("destroy"),j&&"pending"===j.state()&&j.reject(),e.grep(A,function(e){e&&"pending"===e.state()&&e.reject()})}},O=[],I=function(e,t,i){E.find("."+n+"-"+t).parent().html(e).addClass(i||"")},M=v.namespace+"-info-"+e.map(r,function(e){return e.hash}).join("-"),E=v.getUI().find("#"+M),F=[],D="",U="elfinder-font-mono elfinder-info-hash",P=[],q=v.ui.notify;if(q.is(":hidden")&&q.children(".elfinder-notify").length&&q.elfinderdialog("open").height("auto"),!x)return e.Deferred().reject();if(E.length)return E.elfinderdialog("toTop"),e.Deferred().resolve();if(f=v.storage("infohides")||v.arrayFlip(b.hideItems,!0),1===x){if(c=r[0],c.icon&&(D=" "+v.getIconStyle(c)),C=C.replace("{dirclass}",c.csscls?v.escape(c.csscls):"").replace("{class}",v.mime2class(c.mime)).replace("{style}",D),d=y.itemTitle.replace("{name}",v.escape(c.i18||c.name)).replace("{kind}",''+v.mime2kind(c)+""),l=v.tmb(c),c.read?"directory"!=c.mime||c.alias?s=v.formatSize(c.size):(s=y.spinner.replace("{text}",a.calc).replace("{name}","size"),O.push(c.hash)):s=a.unknown,!f.size&&k.push(w.replace(z,a.size).replace(T,s)),!f.aleasfor&&c.alias&&k.push(w.replace(z,a.aliasfor).replace(T,c.alias)),f.path||((h=v.path(c.hash,!0))?k.push(w.replace(z,a.path).replace(T,o(v.escape(h))).replace("{class}","elfinder-info-path")):(k.push(w.replace(z,a.path).replace(T,y.spinner.replace("{text}",a.calc).replace("{name}","path")).replace("{class}","elfinder-info-path")),A.push(v.path(c.hash,!0,{notify:null}).fail(function(){I(a.unknown,"path")}).done(function(e){I(o(e),"path")})))),!f.link&&c.read){var R,H=v.escape(c.name);if("1"==c.url)k.push(w.replace(z,a.link).replace(T,'"));else{if(c.url)R=c.url;else if("directory"===c.mime)if(b.nullUrlDirLinkSelf&&null===c.url){var _=window.location;R=_.pathname+_.search+"#elf_"+c.hash}else""!==c.url&&v.option("url",!v.isRoot(c)&&c.phash||c.hash)&&(R=v.url(c.hash));else R=v.url(c.hash);R&&k.push(w.replace(z,a.link).replace(T,''+H+""))}}f.dim||(c.dim?k.push(w.replace(z,a.dim).replace(T,c.dim)):c.mime.indexOf("image")!==-1&&(c.width&&c.height?k.push(w.replace(z,a.dim).replace(T,c.width+"x"+c.height)):c.size&&"0"!==c.size&&(k.push(w.replace(z,a.dim).replace(T,y.spinner.replace("{text}",a.calc).replace("{name}","dim"))),A.push(v.request({data:{cmd:"dim",target:c.hash},preventDefault:!0}).fail(function(){I(a.unknown,"dim")}).done(function(e){if(I(e.dim||a.unknown,"dim"),e.dim){var t=e.dim.split("x"),n=v.file(c.hash);n.width=t[0],n.height=t[1]}}))))),!f.modify&&k.push(w.replace(z,a.modify).replace(T,v.formatDate(c))),!f.perms&&k.push(w.replace(z,a.perms).replace(T,v.formatPermissions(c))),!f.locked&&k.push(w.replace(z,a.locked).replace(T,c.locked?a.yes:a.no)),!f.owner&&c.owner&&k.push(w.replace(z,a.owner).replace(T,c.owner)),!f.group&&c.group&&k.push(w.replace(z,a.group).replace(T,c.group)),!f.perm&&c.perm&&k.push(w.replace(z,a.perm).replace(T,v.formatFileMode(c.perm))),window.ArrayBuffer&&(v.options.cdns.sparkmd5||v.options.cdns.jssha)&&"directory"!==c.mime&&c.size>0&&(!b.showHashMaxsize||c.size<=b.showHashMaxsize)&&(P=[],e.each(v.storage("hashchekcer")||b.showHashAlgorisms,function(e,t){c[t]?k.push(w.replace(z,v.i18n(t)).replace(T,c[t]).replace("{class}",U)):(k.push(w.replace(z,v.i18n(t)).replace(T,y.spinner.replace("{text}",a.calc).replace("{name}",t))),P.push(t))}),P.length&&(m=e('
          '),A.push(v.getContentsHashes(c.hash,P,b.showHashOpts,{progressBar:m}).progress(function(t){e.each(P,function(e,n){t[n]&&I(t[n],n,U)})}).always(function(){e.each(P,function(e,t){I(a.unknown,t)})})))),b.custom&&e.each(b.custom,function(t,n){f[n.label]||n.mimes&&!e.grep(n.mimes,function(e){return c.mime===e||0===c.mime.indexOf(e+"/")}).length||n.hashRegex&&!c.hash.match(n.hashRegex)||(k.push(w.replace(z,v.i18n(n.label)).replace(T,n.tpl.replace("{id}",M))),n.action&&"function"==typeof n.action&&F.push(n.action))})}else C=C.replace("{class}","elfinder-cwd-icon-group"),d=y.groupTitle.replace("{items}",a.items).replace("{num}",x),p=e.grep(r,function(e){return"directory"==e.mime}).length,p?(u=e.grep(r,function(e){return!("directory"!==e.mime||e.phash&&!e.isroot)}).length,p-=u,k.push(w.replace(z,a.kind).replace(T,u===x||p===x?a[u?"roots":"folders"]:e.map({roots:u,folders:p,files:x-u-p},function(e,t){return e?a[t]+" "+e:null}).join(", "))),!f.size&&k.push(w.replace(z,a.size).replace(T,y.spinner.replace("{text}",a.calc).replace("{name}","size"))),O=e.map(r,function(e){return e.hash})):(s=0,e.each(r,function(e,t){var n=parseInt(t.size);n>=0&&s>=0?s+=n:s="unknown"}),k.push(w.replace(z,a.kind).replace(T,a.files)),!f.size&&k.push(w.replace(z,a.size).replace(T,v.formatSize(s))));return C=C.replace("{title}",d).replace("{content}",k.join("").replace(/{class}/g,"")),E=g.fmDialog(C,S),E.attr("id",M).one("mousedown",".elfinder-info-path",function(){e(this).html(o(e(this).html(),!0))}),P.length&&m.appendTo(E.find("."+n+"-"+P[0]).parent()),v.UA.Mobile&&e.fn.tooltip&&E.children(".ui-dialog-content .elfinder-info-title").tooltip({classes:{"ui-tooltip":"elfinder-ui-tooltip ui-widget-shadow"},tooltipClass:"elfinder-ui-tooltip ui-widget-shadow",track:!0}),c&&"1"==c.url&&E.on("click","."+n+"-url",function(){e(this).parent().html(y.spinner.replace("{text}",v.i18n("ntfurl")).replace("{name}","url")),v.request({data:{cmd:"url",target:c.hash},preventDefault:!0}).fail(function(){I(H,"url")}).done(function(e){if(e.url){I(''+H+""||H,"url");var t=v.file(c.hash);t.url=e.url}else I(H,"url")})}),l&&e("").on("load",function(){E.find(".elfinder-cwd-icon").addClass(l.className).css("background-image","url('"+l.url+"')")}).attr("src",l.url),O.length&&(j=v.getSize(O).done(function(e){I(e.formated,"size")}).fail(function(){I(a.unknown,"size")})),F.length&&e.each(F,function(e,t){try{t(c,v,E)}catch(n){v.debug("error",n)}}),e.Deferred().resolve()}}).prototype={forceLoad:!0},i.prototype.commands.mkdir=function(){var t,n=this.fm,i=this;this.value="",this.disableOnSearch=!0,this.updateOnSelect=!1,this.syncTitleOnChange=!0,this.mime="directory",this.prefix="untitled folder",this.exec=function(a,o){var r;return a&&a.length&&o&&o._currentType&&"navbar"===o._currentType?(this.origin=o._currentType,this.data={target:a[0]}):(r=n.cwd().hash===a[0],this.origin=t&&!r?t:"cwd",delete this.data),a||this.options.intoNewFolderToolbtn||n.getUI("cwd").trigger("unselectall"),this.move=this.value===n.i18n("cmdmkdirin"),e.proxy(n.res("mixin","make"),i)()},this.shortcuts=[{pattern:"ctrl+shift+n"}],this.init=function(){this.options.intoNewFolderToolbtn&&(this.syncTitleOnChange=!0)},n.bind("select contextmenucreate closecontextmenu",function(e){var a=(e.data?e.data.selected||e.data.targets:null)||n.selected();i.className="mkdir",t=e.data&&a.length?e.data.origin||e.data.type||"":"",i.options.intoNewFolderToolbtn||""!==t||(t="cwd"),a.length&&"navbar"!==t&&"cwd"!==t&&n.cwd().hash!==a[0]?(i.title=n.i18n("cmdmkdirin"),i.className+=" elfinder-button-icon-mkdirin"):i.title=n.i18n("cmdmkdir"),"closecontextmenu"!==e.type?i.update(void 0,i.title):requestAnimationFrame(function(){i.update(void 0,i.title)})}),this.getstate=function(i){var a=n.cwd(),o="navbar"===t||i&&i[0]!==a.hash?this.files(i||n.selected()):[],r=o.length,s=function(t){var n=!0;return e.grep(t,function(e){return n=!(!n||!e.read||e.locked)})};return"navbar"===t?r&&o[0].write&&o[0].read?0:-1:!a.write||r&&s(o).length!=r?-1:0}},i.prototype.commands.mkfile=function(){var t=this;this.disableOnSearch=!0,this.updateOnSelect=!1,this.mime="text/plain",this.prefix="untitled file.txt",this.variants=[],this.getTypeName=function(e,n){var i,a=t.fm;return i=(i=a.messages["kind"+a.kinds[e]])?a.i18n(["extentiontype",n.toUpperCase(),i]):a.i18n(["extentionfile",n.toUpperCase()])},this.fm.bind("open reload canMakeEmptyFile",function(){var n=t.fm,i=n.getCommand("edit").getMkfileHides();t.variants=[],n.mimesCanMakeEmpty&&e.each(n.mimesCanMakeEmpty,function(e,a){a&&!i[e]&&n.uploadMimeCheck(e)&&t.variants.push([e,t.getTypeName(e,a)])}),t.change()}),this.getstate=function(){return this.fm.cwd().write?0:-1},this.exec=function(n,i){var a,o,r=t.fm;if(a=r.mimesCanMakeEmpty[i]){if(r.uploadMimeCheck(i))return this.mime=i,this.prefix=r.i18n(["untitled file",a]),e.proxy(r.res("mixin","make"),t)();o=["errMkfile",t.getTypeName(i,a)]}return e.Deferred().reject(o)}},i.prototype.commands.netmount=function(){var t,n=this,i=!1;this.alwaysEnabled=!0,this.updateOnSelect=!1,this.drivers=[],this.handlers={load:function(){var t=n.fm;t.cookieEnabled&&t.one("open",function(){n.drivers=t.netDrivers,n.drivers.length&&e.each(n.drivers,function(){var e=n.options[this];e&&(i=!0,e.integrateInfo&&t.trigger("helpIntegration",Object.assign({cmd:"netmount"},e.integrateInfo)))})})}},this.getstate=function(){return i?0:-1},this.exec=function(){var i,a=n.fm,o=e.Deferred(),r=n.options,s=function(){var s,l=function(){c.protocol.trigger("change","winfocus")},c={protocol:e("").on("change",function(e,n){var o=this.value;t.find(".elfinder-netmount-tr").hide(),t.find(".elfinder-netmount-tr-"+o).show(),i&&i.children(".ui-dialog-buttonpane:first").find("button").show(),"function"==typeof r[o].select&&r[o].select(a,e,n)}).addClass("ui-corner-all")},d={title:a.i18n("netMountDialogTitle"),resizable:!0,modal:!0,destroyOnClose:!1,open:function(){e(window).on("focus."+a.namespace,l),c.protocol.trigger("change")},close:function(){"pending"==o.state()&&o.reject(),e(window).off("focus."+a.namespace,l)},buttons:{}},p=function(){var i,s=c.protocol.val(),l={cmd:"netmount",protocol:s},d=r[s];return e.each(t.find("input.elfinder-netmount-inputs-"+s),function(t,n){var i,a;a=e(n),a.is(":radio,:checkbox")?a.is(":checked")&&(i=e.trim(a.val())):i=e.trim(a.val()),i&&(l[n.name]=i)}),l.host?(l.mnt2res&&(i=!0),a.request({data:l,notify:{type:"netmount",cnt:1,hideCnt:!0}}).done(function(e){var t;e.added&&e.added.length&&(i&&c.protocol.trigger("change","reset"),e.added[0].phash&&(t=a.file(e.added[0].phash))&&(t.dirs||(t.dirs=1,a.change({changed:[t]}))),a.one("netmountdone",function(){a.exec("open",e.added[0].hash)})),o.resolve()}).fail(function(e){d.fail&&"function"==typeof d.fail&&d.fail(a,a.parseError(e)),o.reject(e)}),void n.dialog.elfinderdialog("close")):a.trigger("error",{error:"errNetMountHostReq",opts:{modal:!0}})},u=e('
          ').on("keydown","input",function(t){var n,i=!0;t.keyCode===e.ui.keyCode.ENTER&&(e.each(u.find("input:visible:not(.elfinder-input-optional)"),function(){if(""===e(this).val())return i=!1,n=e(this),!1}),i?p():n.trigger("focus"))}),h=e("
          ");return t=e('
          ').append(e("").append(e(""+a.i18n("protocol")+"")).append(e("").append(c.protocol))),e.each(n.drivers,function(n,i){r[i]&&(c.protocol.append('"),e.each(r[i].inputs,function(n,o){o.attr("name",n),"hidden"!=o.attr("type")?(o.addClass("ui-corner-all elfinder-netmount-inputs-"+i),t.append(e("").addClass("elfinder-netmount-tr elfinder-netmount-tr-"+i).append(e(""+a.i18n(n)+"")).append(e("").append(o)))):(o.addClass("elfinder-netmount-inputs-"+i),h.append(o))}),r[i].protocol=c.protocol)}),t.append(h),t.find(".elfinder-netmount-tr").hide(),t.find(".elfinder-netmount-tr-"+n.drivers[0]).show(),d.buttons[a.i18n("btnMount")]=p,d.buttons[a.i18n("btnCancel")]=function(){n.dialog.elfinderdialog("close")},t.find("select,input").addClass("elfinder-tabstop"),s=n.fmDialog(u.append(t),d).ready(function(){c.protocol.trigger("change"),s.elfinderdialog("posInit")}),i=s.closest(".ui-dialog"),s};return n.dialog?n.dialog.elfinderdialog("open"):n.dialog=s(),o.promise()},n.fm.bind("netmount",function(e){var i=e.data||null,a=n.options,o=function(){a[i.protocol]&&"function"==typeof a[i.protocol].done&&(a[i.protocol].done(n.fm,i),t.find("select,input").addClass("elfinder-tabstop"),n.dialog.elfinderdialog("tabstopsInit"))};i&&i.protocol&&(i.mode&&"redirect"===i.mode?n.fm.request({data:{cmd:"netmount",protocol:i.protocol,host:i.host,user:"init",pass:"return",options:i.options},preventDefault:!0}).done(function(e){i=JSON.parse(e.body),o()}):o())})},i.prototype.commands.netunmount=function(){this.alwaysEnabled=!0,this.updateOnSelect=!1,this.drivers=[],this.handlers={load:function(){this.drivers=this.fm.netDrivers}},this.getstate=function(e){var t,n=this.fm;return e&&this.drivers.length&&!this._disabled&&(t=n.file(e[0]))&&t.netkey?0:-1},this.exec=function(t){var n=this,i=this.fm,a=e.Deferred().fail(function(e){e&&i.error(e)}),o=i.file(t[0]),r=function(t){var n,a=[];return i.leafRoots&&(n=[],e.each(i.leafRoots,function(a,o){var r,s=i.parents(a);(r=e.inArray(t,s))!==-1&&(r=s.length-r,e.each(o,function(e,t){n.push({i:r,hash:t})}))}),n.length&&(n.sort(function(e,t){return e.i').hide().appendTo(e("body"));if(t.UA.Mobile||!h){if(u)h?p.attr("target","_blank"):p.attr("download",a.name),p.attr("href",n).get(0).click();else if(i=window.open(n),!i)return g.reject("errPopup")}else{if(m="string"==typeof w.method&&"get"===w.method.toLowerCase(),!m&&0===n.indexOf(t.options.url)&&t.customData&&Object.keys(t.customData).length&&!a.mime.match(/^(?:video|audio)/)&&(n=""),"window"===x?(s=c=Math.round(2*screen.availWidth/3),l=d=Math.round(2*screen.availHeight/3),parseInt(a.width)&&parseInt(a.height)?(s=parseInt(a.width),l=parseInt(a.height)):a.dim&&(o=a.dim.split("x"),s=parseInt(o[0]),l=parseInt(o[1])),c>=s&&d>=l?(c=s,d=l):s-c>l-d?d=Math.round(l*(c/s)):c=Math.round(s*(d/l)),r="width="+c+",height="+d,i=window.open(n,f,r+",top=50,left=50,scrollbars=yes,resizable=yes,titlebar=no")):("tabs"===x&&(f=a.hash),i=window.open("about:blank",f)),!i)return g.reject("errPopup");if(""===n){var v=document.createElement("form");v.action=t.options.url,v.method="POST",v.target=f,v.style.display="none";var b=Object.assign({},t.customData,{cmd:"file",target:a.hash,_t:a.ts||parseInt(+new Date/1e3)});e.each(b,function(e,t){var n=document.createElement("input");n.name=e,n.value=t,v.appendChild(n)}),document.body.appendChild(v),v.submit()}else"window"!==x&&(i.location=n);e(i).trigger("focus")}p.remove()};try{p=new RegExp(t.option("dispInlineRegex"),"i")}catch(k){p=!1}for(u="string"==typeof e("").get(0).download,b=v.length;b--;){if(f="elf_open_window",a=v[b],!a.read)return g.reject(["errOpen",a.name,"errPerm"]);h=p&&a.mime.match(p),t.openUrl(a.hash,!h,y)}return g.resolve(n)};if(b>1)t.confirm({title:"openMulti",text:["openMultiConfirm",b+""],accept:{label:"cmdopen",callback:function(){k()}},cancel:{label:"btnCancel",callback:function(){g.reject()}},buttons:t.getCommand("zipdl")&&t.isCommandEnabled("zipdl",t.cwd().hash)?[{label:"cmddownload",callback:function(){t.exec("download",n),g.reject()}}]:[]});else{if(f=t.storage("selectAction")||w.selectAction,f&&(e.each(f.split("/"),function(){var e=this.valueOf();return("open"===e||!(m=t.getCommand(e))||!m.enabled())&&void(m=null)}),m))return t.exec(m.name);k()}return g}}).prototype={forceLoad:!0},i.prototype.commands.opendir=function(){this.alwaysEnabled=!0,this.getstate=function(){var e,t=this.fm.selected(),n=t.length;return 1!==n?-1:(e=this.fm.getUI("workzone"),e.hasClass("elfinder-search-result")?0:-1)},this.exec=function(t){var n,i=this.fm,a=e.Deferred(),o=this.files(t),r=o.length;return r&&o[0].phash?(n=o[0].phash,i.trigger("searchend",{noupdate:!0}),i.request({data:{cmd:"open",target:n},notify:{type:"open",cnt:1,hideCnt:!0},syncOnFail:!1}),a):a.reject()}},i.prototype.commands.opennew=function(){var t=this.fm;this.shortcuts=[{pattern:("function"==typeof t.options.getFileCallback?"shift+":"")+"ctrl+enter"}],this.getstate=function(e){var t=this.files(e),n=t.length;return 1===n&&"directory"===t[0].mime&&t[0].read?0:-1},this.exec=function(t){var n,i,a,o,r=e.Deferred(),s=this.files(t),l=s.length,c=this.options;return 1===l&&(n=s[0])&&"directory"===n.mime?(i=window.location,a=c.url?c.url:i.pathname,c.useOriginQuery&&(a.match(/\?/)?i.search&&(a+="&"+i.search.substr(1)):a+=i.search),a+="#elf_"+n.hash,o=window.open(a,"_blank"),setTimeout(function(){o.focus()},1e3),r.resolve()):r.reject()}},i.prototype.commands.paste=function(){this.updateOnSelect=!1,this.handlers={changeclipboard:function(){this.update()}},this.shortcuts=[{pattern:"ctrl+v shift+insert"}],this.getstate=function(e){if(this._disabled)return-1;if(e){if(Array.isArray(e)){if(1!=e.length)return-1;e=this.fm.file(e[0])}}else e=this.fm.cwd();return this.fm.clipboard().length&&"directory"==e.mime&&e.write?0:-1},this.exec=function(t,n){var i,a,o,r=this,s=r.fm,l=n||{},c=t?this.files(t)[0]:s.cwd(),d=s.clipboard(),p=d.length,u=!!p&&d[0].cut,h=l._cmd?l._cmd:u?"move":"copy",f="err"+h.charAt(0).toUpperCase()+h.substr(1),m=[],g=[],v=e.Deferred().fail(function(e){e&&s.error(e)}).always(function(){s.unlockfiles({files:e.map(d,function(e){return e.hash})})}),b=function(t){return t.length&&s._commands.duplicate?s.exec("duplicate",t):e.Deferred().resolve()},y=function(t){var n,i=e.Deferred(),a=[],o={},d=function(t,n){for(var i=[],a=t.length;a--;)e.inArray(t[a].name,n)!==-1&&i.unshift(a);return i},p=function(e){var n=a[e],o=t[n],r=e==a.length-1;o&&s.confirm({title:s.i18n(h+"Files"),text:["errExists",o.name,"restore"===h?"confirmRest":"confirmRepl"],all:!r,accept:{label:"btnYes",callback:function(n){r||n?m(t):p(++e)}},reject:{label:"btnNo",callback:function(n){var i;if(n)for(i=a.length;e{title}',s=e('
          '),l=e('
            '),c=e('
            '),d=(e("base").length?document.location.href.replace(/#.*$/,""):"",function(t){e("#"+a.namespace+"-preference-tab-"+t).trigger("mouseover").trigger("click"),n=t}),p=a.res("class","tabsactive"),u=function(){var u=i.options.categories||{language:["language"],theme:["theme"],toolbar:["toolbarPref"],workspace:["iconSize","columnPref","selectAction","makefileTypes","useStoredEditor","editorMaximized","useFullscreen","showHidden"],dialog:["autoFocusDialog"],selectionInfo:["infoItems","hashChecker"],reset:["clearBrowserData"],all:!0},h=i.options.prefs||["language","theme","toolbarPref","iconSize","columnPref","selectAction","makefileTypes","useStoredEditor","editorMaximized","useFullscreen","showHidden","infoItems","hashChecker","autoFocusDialog","clearBrowserData"];a.cookieEnabled||delete u.language,h=a.arrayFlip(h,!0),a.options.getFileCallback&&delete h.selectAction,a.UA.Fullscreen||delete h.useFullscreen,h.language&&(h.language=function(){var t=e("").on("change",function(){var t=e(this).val();a.storage("lang",t),e("#"+a.id).elfinder("reload")}),n=[],o=i.options.langs||{ar:"العربية",bg:"Български",ca:"Català",cs:"Čeština",da:"Dansk",de:"Deutsch",el:"Ελληνικά",en:"English",es:"Español",fa:"فارسی",fo:"Føroyskt",fr:"Français",fr_CA:"Français (Canada)",he:"עברית",hr:"Hrvatski",hu:"Magyar",id:"Bahasa Indonesia",it:"Italiano",ja:"日本語",ko:"한국어",nl:"Nederlands",no:"Norsk",pl:"Polski",pt_BR:"Português",ro:"Română",ru:"Pусский",si:"සිංහල",sk:"Slovenčina",sl:"Slovenščina",sr:"Srpski",sv:"Svenska",tr:"Türkçe",ug_CN:"ئۇيغۇرچە",uk:"Український",vi:"Tiếng Việt",zh_CN:"简体中文",zh_TW:"正體中文"};return a.cookieEnabled?(e.each(o,function(e,t){n.push('")}),t.append(n.join("")).val(a.lang)):e()}()),h.theme&&(h.theme=function(){var t=a.options.themes?Object.keys(a.options.themes).length:0;if(0===t||1===t&&a.options.themes["default"])return null;var n=e("").on("change",function(){var t=e(this).val();a.changeTheme(t).storage("theme",t)}),i={image:'',link:'$2',data:'
            $1
            $2
            '},o=["image","description","author","email","license"],r=e('').text(a.i18n("default")).on("click",function(e){n.val("default").trigger("change")}),s=e('
            ').on("click","button",function(){var t=e(this).data("themeid");n.val(t).trigger("change")});return a.options.themes["default"]||n.append('"),e.each(a.options.themes,function(t,r){var l,c=e('"),d=e('
            '+a.i18n(t)+'
            ');n.append(c),s.append(d),l=setTimeout(function(){d.find("span.elfinder-spinner").replaceWith(a.i18n(["errRead",t]))},1e4),a.getTheme(t).always(function(){l&&clearTimeout(l)}).done(function(r){var s,l=e(),p=e("
            ");s=r.link?i.link.replace(/\$1/g,r.link).replace(/\$3/g,a.i18n("website")):"$2",r.name&&c.html(a.i18n(r.name)),d.children("legend").html(s.replace(/\$2/g,a.i18n(r.name)||t)),e.each(o,function(o,s){var l,c=i[s]||i.data;r[s]&&(l=c.replace(/\$0/g,a.escape(s)).replace(/\$1/g,a.i18n(s)).replace(/\$2/g,a.i18n(r[s])),"image"===s&&r.link&&(l=e(l).on("click",function(){n.val(t).trigger("change")}).attr("title",a.i18n("select"))),p.append(l))}),l=l.add(p),l=l.add(e('
            ').append(e('').data("themeid",t).html(a.i18n("select")))),d.find("span.elfinder-spinner").replaceWith(l)}).fail(function(){d.find("span.elfinder-spinner").replaceWith(a.i18n(["errRead",t]))})}),e("
            ").append(n.val(a.theme&&a.theme.id?a.theme.id:"default"),r,s)}()),h.toolbarPref&&(h.toolbarPref=function(){var t=e.map(a.options.uiOptions.toolbar,function(t){return e.isArray(t)?t:null}),n=[],i=a.storage("toolbarhides")||{};return e.each(t,function(){var e=this,t=a.i18n("cmd"+e);t==="cmd"+e&&(t=a.i18n(e)),n.push('")}),e(n.join(" ")).on("change","input",function(){var t=e(this).val(),n=e(this).is(":checked");n||i[t]?n&&i[t]&&delete i[t]:i[t]=!0,a.storage("toolbarhides",i),a.trigger("toolbarpref")})}()),h.iconSize&&(h.iconSize=function(){var t=a.options.uiOptions.cwd.iconsView.sizeMax||3,n=a.storage("iconsize")||a.options.uiOptions.cwd.iconsView.size||0,i=e('
            ').slider({classes:{"ui-slider-handle":"elfinder-tabstop"},value:n,max:t,slide:function(e,t){a.getUI("cwd").trigger("iconpref",{size:t.value})},change:function(e,t){a.storage("iconsize",t.value)}});return a.getUI("cwd").on("iconpref",function(e,t){i.slider("option","value",t.size)}),i}()),h.columnPref&&(h.columnPref=function(){var t=a.options.uiOptions.cwd.listView.columns,n=[],i=a.storage("columnhides")||{};return e.each(t,function(){var e=this,t=a.getColumnName(e);n.push('")}),e(n.join(" ")).on("change","input",function(){var t=e(this).val(),n=e(this).is(":checked");n||i[t]?n&&i[t]&&delete i[t]:i[t]=!0,a.storage("columnhides",i),a.trigger("columnpref",{repaint:!0})})}()),h.selectAction&&(h.selectAction=function(){var t=e("").on("change",function(){var t=e(this).val();a.storage("selectAction","default"===t?null:t)}),n=[],o=i.options.selectActions,r=a.getCommand("open").options.selectAction||"open";return e.inArray(r,o)===-1&&o.unshift(r),e.each(o,function(t,i){var o=e.map(i.split("/"),function(e){var t=a.i18n("cmd"+e);return t==="cmd"+e&&(t=a.i18n(e)),t});n.push('")}),t.append(n.join("")).val(a.storage("selectAction")||r)}()),h.makefileTypes&&(h.makefileTypes=function(){var t=a.getCommand("edit").getMkfileHides(),n=function(){var n=[];return t=a.getCommand("edit").getMkfileHides(),e.each(a.mimesCanMakeEmpty,function(e,i){var o=a.getCommand("mkfile").getTypeName(e,i);n.push('")}),n.join(" ")},i=e("
            ").on("change","input",function(){var n=e(this).val(),i=e(this).is(":checked");i||t[n]?i&&t[n]&&delete t[n]:t[n]=!0,a.storage("mkfileHides",t),a.trigger("canMakeEmptyFile")}).append(n()),o=e("
            ").append(e('').on("keydown",function(t){t.keyCode===e.ui.keyCode.ENTER&&e(this).next().trigger("click")}),e('').html(a.i18n("add")).on("click",function(){var t,n=e(this).prev(),i=n.val(),o=a.getUI("toast"),r=function(){return o.appendTo(n.closest(".ui-dialog")),a.toast({msg:a.i18n("errUsupportType"),mode:"warning",onHidden:function(){1===o.children().length&&o.appendTo(a.getUI())}}),n.trigger("focus"),!1};if(!i.match(/\//)){if(i=a.arrayFlip(a.mimeTypes)[i],!i)return r();n.val(i)}return a.mimeIsText(i)&&a.mimeTypes[i]?(a.trigger("canMakeEmptyFile",{mimes:[i],unshift:!0}),t={},t[i]=a.mimeTypes[i],a.storage("mkfileTextMimes",Object.assign(t,a.storage("mkfileTextMimes")||{})),n.val(""),o.appendTo(n.closest(".ui-dialog")),void a.toast({msg:a.i18n(["complete",i+" ("+t[i]+")"]),onHidden:function(){1===o.children().length&&o.appendTo(a.getUI())}})):r()}),e('').html(a.i18n("reset")).on("click",function(){a.one("canMakeEmptyFile",{done:function(){i.empty().append(n())}}),a.trigger("canMakeEmptyFile",{resetTexts:!0})}));return a.bind("canMakeEmptyFile",{done:function(e){e.data&&e.data.mimes&&e.data.mimes.length&&i.empty().append(n())}}),e("
            ").append(i,o)}()),h.useStoredEditor&&(h.useStoredEditor=e('').prop("checked",function(){var e=a.storage("useStoredEditor");return e?e>0:a.options.commandsOptions.edit.useStoredEditor}()).on("change",function(t){a.storage("useStoredEditor",e(this).is(":checked")?1:-1)})),h.editorMaximized&&(h.editorMaximized=e('').prop("checked",function(){var e=a.storage("editorMaximized");return e?e>0:a.options.commandsOptions.edit.editorMaximized}()).on("change",function(t){a.storage("editorMaximized",e(this).is(":checked")?1:-1)})),h.useFullscreen&&(h.useFullscreen=e('').prop("checked",function(){var e=a.storage("useFullscreen");return e?e>0:"screen"===a.options.commandsOptions.fullscreen.mode}()).on("change",function(t){a.storage("useFullscreen",e(this).is(":checked")?1:-1)})),h.showHidden&&!function(){var t,n=function(){var n,i=a.storage("hide"),o=[];i&&i.items&&e.each(i.items,function(e,t){o.push(a.escape(t))}),r.prop("disabled",!o.length)[o.length?"removeClass":"addClass"]("ui-state-disabled"),n=o.length?o.join("\n"):"",h.showHidden.attr("title",n),t&&h.showHidden.tooltip("option","content",n.replace(/\n/g,"
            ")).tooltip("close")},i=e('').prop("checked",function(){var e=a.storage("hide");return e&&e.show}()).on("change",function(t){var n={};n[e(this).is(":checked")?"show":"hide"]=!0,a.exec("hide",void 0,n)}),o=e('').append(a.i18n("reset")).on("click",function(){a.exec("hide",void 0,{reset:!0}),e(this).parent().find("input:first").prop("checked",!1),n()}),r=e().add(i).add(o);h.showHidden=e("
            ").append(i,o),a.bind("hide",function(e){var t=e.data;t.opts&&(t.opts.show||t.opts.hide)||n()}),a.UA.Mobile&&e.fn.tooltip&&(t=!0,h.showHidden.tooltip({classes:{"ui-tooltip":"elfinder-ui-tooltip ui-widget-shadow"},tooltipClass:"elfinder-ui-tooltip ui-widget-shadow",track:!0}).css("user-select","none"),o.css("user-select","none")),n()}(),h.infoItems&&(h.infoItems=function(){var t=a.getCommand("info").items,n=[],i=a.storage("infohides")||a.arrayFlip(a.options.commandsOptions.info.hideItems,!0);return e.each(t,function(){var e=this,t=a.i18n(e);n.push('")}),e(n.join(" ")).on("change","input",function(){var t=e(this).val(),n=e(this).is(":checked");n||i[t]?n&&i[t]&&delete i[t]:i[t]=!0,a.storage("infohides",i),a.trigger("infopref",{repaint:!0})})}()),h.hashChecker&&a.hashCheckers.length&&(h.hashChecker=function(){var t=[],n=a.arrayFlip(a.storage("hashchekcer")||a.options.commandsOptions.info.showHashAlgorisms,!0);return e.each(a.hashCheckers,function(){var e=this,i=a.i18n(e);t.push('")}),e(t.join(" ")).on("change","input",function(){var t=e(this).val(),i=e(this).is(":checked");i?n[t]=!0:n[t]&&delete n[t],a.storage("hashchekcer",e.grep(a.hashCheckers,function(e){return n[e]}))})}()),h.autoFocusDialog&&(h.autoFocusDialog=e('').prop("checked",function(){var e=a.storage("autoFocusDialog");return e?e>0:a.options.uiOptions.dialog.focusOnMouseOver}()).on("change",function(t){a.storage("autoFocusDialog",e(this).is(":checked")?1:-1)})),h.clearBrowserData&&(h.clearBrowserData=e("").text(a.i18n("reset")).button().on("click",function(t){t.preventDefault(),a.storage(),e("#"+a.id).elfinder("reload")})),e.each(u,function(t,i){var s,d;i===!0?d=1:i&&(s=e(),e.each(i,function(t,n){var i,o,r,l="";(i=h[n])&&(d=2,o=a.i18n(n),r=e(i).filter('input[type="checkbox"]'),r.length||(r=e(i).find('input[type="checkbox"]')),1===r.length?(r.attr("id")||r.attr("id","elfinder-preference-"+n+"-checkbox"),o='"):r.length>1&&(l=" elfinder-preference-checkboxes"),s=s.add(e('
            '+o+"
            ")).add(e('
            ').append(i)))})),d&&(l.append(r[o](/\{id\}/g,t)[o](/\{title\}/,a.i18n(t))[o](/\{class\}/,n===t?"elfinder-focus":"")),2===d&&c.append(e('
            ').hide().append(e("
            ").append(s))))}),l.on("click","a",function(t){var n=e(t.target),i=n.attr("href");t.preventDefault(),t.stopPropagation(),l.children().removeClass(p),n.removeClass("ui-state-hover").parent().addClass(p),i.match(/all$/)?c.addClass("elfinder-preference-taball").children().show():(c.removeClass("elfinder-preference-taball").children().hide(),e(i).show())}).on("focus blur","a",function(t){e(this).parent().toggleClass("ui-state-focus","focusin"===t.type)}).on("mouseenter mouseleave","li",function(t){e(this).toggleClass("ui-state-hover","mouseenter"===t.type)}),c.find("a,input,select,button").addClass("elfinder-tabstop"),s.append(l,c),t=i.fmDialog(s,{title:i.title,width:i.options.width||600,height:i.options.height||400,maxWidth:"window",maxHeight:"window",autoOpen:!1,destroyOnClose:!1,allowMinimize:!1,open:function(){n&&d(n),n=null},resize:function(){c.height(t.height()-l.outerHeight(!0)-(c.outerHeight(!0)-c.height())-5)}}).on("click",function(e){e.stopPropagation()}).css({overflow:"hidden"}),t.closest(".ui-dialog").css({overflow:"hidden"}).addClass("elfinder-bg-translucent"),n="all"};this.shortcuts=[{pattern:"ctrl+comma",description:this.title}],this.alwaysEnabled=!0,this.getstate=function(){return 0},this.exec=function(n,i){return!t&&u(),i&&(i.tab?d(i.tab):"cwd"===i._currentType&&d("workspace")),t.elfinderdialog("open"),e.Deferred().resolve()}},(i.prototype.commands.quicklook=function(){var t,n,i,a,o,r,s,l,c,d,p=this,u=p.fm,h=0,f=1,m=2,g=3,v=4,b=h,y=Element.update?"quicklookupdate":"update",w="elfinder-quicklook-navbar-icon",x="elfinder-quicklook-fullscreen",k="elfinder-quicklook-info-wrapper",C=function(t){e(document).trigger(e.Event("keydown",{keyCode:t,ctrlKey:!1,shiftKey:!1,altKey:!1,metaKey:!1}))},z=function(e){var t=u.getUI().offset(),n=function(){var t=e.find(".elfinder-cwd-file-wrapper");return t.length?t:e}(),i=n.offset()||{top:0,left:0};return{opacity:0,width:n.width(),height:n.height()-30,top:i.top-t.top,left:i.left-t.left}},T=function(){var i=p.options.contain||u.options.dialogContained,a=i?u.getUI():e(window),o=u.getUI().offset(),r=Math.min(t,a.width()-10),s=Math.min(n,a.height()-80);return{opacity:1,width:r,height:s,top:parseInt((a.height()-s-60)/2+(i?0:a.scrollTop()-o.top)),left:parseInt((a.width()-r)/2+(i?0:a.scrollLeft()-o.left))}},A={},j=function(e,t){var n=t||e.substr(0,e.indexOf("/")),i=A[n]?A[n]:A[n]=document.createElement(n),a=!1;try{a=i.canPlayType&&i.canPlayType(e)}catch(o){}return!(!a||""===a||"no"==a)},S=window.navigator.platform.indexOf("Win")!=-1,O=!1,I=!1,M=!1,E=null,F=e.ui.keyCode.LEFT,D=e.ui.keyCode.RIGHT,U="mousemove touchstart "+("onwheel"in document?"wheel":"onmousewheel"in document?"mousewheel":"DOMMouseScroll"),P=e(''),q=e("
            "),R=e('
            '),H=e('
            '),_=e('
            ').on("click touchstart",function(t){if(!M){var n=p.window,i=n.hasClass(x),o=e(window),r=function(){p.preview.trigger("changesize")};t.stopPropagation(),t.preventDefault(),i?(G="",L(),n.toggleClass(x).css(n.data("position")),o.trigger(p.resize).off(p.resize,r),V.off("mouseenter mouseleave"),H.off(U)):(n.toggleClass(x).data("position",{left:n.css("left"),top:n.css("top"),width:n.width(),height:n.height(),display:"block"}).removeAttr("style"),e(window).on(p.resize,r).trigger(p.resize),H.on(U,function(e){I||("mousemove"!==e.type&&"touchstart"!==e.type||(L(),E=setTimeout(function(){(u.UA.Mobile||V.parent().find(".elfinder-quicklook-navbar:hover").length<1)&&V.fadeOut("slow",function(){H.show()})},3e3)),H.is(":visible")&&(W(),H.data("tm",setTimeout(function(){H.show()},3e3))))}).show().trigger("mousemove"),V.on("mouseenter mouseleave",function(e){I||("mouseenter"===e.type?L():H.trigger("mousemove"))})),u.zIndex&&n.css("z-index",u.zIndex+1),u.UA.Mobile?V.attr("style",G):V.attr("style",G).draggable(i?"destroy":{start:function(){I=!0,M=!0,H.show(),L()},stop:function(){I=!1,G=p.navbar.attr("style"),requestAnimationFrame(function(){M=!1})}}),e(this).toggleClass(w+"-fullscreen-off");var s=n;a.is(".ui-resizable")&&(s=s.add(a)),s.resizable(i?"enable":"disable").removeClass("ui-state-disabled"),n.trigger("viewchange")}}),N=function(){p.update(void 0,function(){var t=p.fm,n=t.selectedFiles(),i=n.length,a=(p.docked(),function(){var a=0;return e.each(n,function(e,t){var n=parseInt(t.ts);a>=0?n>a&&(a=n):a="unknown"}),{hash:n[0].hash+"/"+ +new Date,name:t.i18n("items")+": "+i,mime:"group",size:J,ts:a,files:e.map(n,function(e){return e.hash}),getSize:!0}});return i||(i=1,n=[t.cwd()]),1===i?n[0]:a()}())},L=function(){p.window.hasClass(x)&&(E&&clearTimeout(E),E=null,V.stop(!0,!0).css("display","block"),W())},W=function(){H.data("tm")&&clearTimeout(H.data("tm")),H.removeData("tm"),H.hide()},B=e('
            ').on("click touchstart",function(e){return!M&&C(F),!1}),$=e('
            ').on("click touchstart",function(e){return!M&&C(D),!1}),V=e('
            ').append(B).append(_).append($).append('
            ').append(e('
            ').on("click touchstart",function(e){return!M&&p.window.trigger("close"),!1})),K=e('').on("mousedown",function(e){e.stopPropagation(),p.window.trigger("close")}),X=e('').on("mousedown",function(e){e.stopPropagation(),p.docked()?p.window.trigger("navdockout"):p.window.trigger("navdockin")}),J=''+u.i18n("calc")+'',G="",Y=!0;this.flags={},this.cover=H,this.evUpdate=y,(this.navbar=V)._show=L,this.resize="resize."+u.namespace,this.info=e("
            ").addClass(k).append(q).append(R),this.autoPlay=function(){return!!p.opened()&&!!p.options[p.docked()?"dockAutoplay":"autoplay"]},this.preview=e('
            ').on("change",function(){L(),V.attr("style",G),p.docked()&&V.hide(),p.preview.attr("style","").removeClass("elfinder-overflow-auto"),p.info.attr("style","").hide(),p.cover.removeClass("elfinder-quicklook-coverbg"),q.removeAttr("class").attr("style",""),R.html("")}).on(y,function(t){var n,i,a=(p.preview,t.file),r='
            {value}
            ',s=function(){var s=p.window.css("overflow","hidden");i=u.escape(a.i18||a.name),!a.read&&t.stopImmediatePropagation(),p.window.data("hash",a.hash),p.preview.off("changesize").trigger("change").children().remove(),P.html(i),B.css("visibility",""),$.css("visibility",""),a.hash===u.cwdId2Hash(o.find("[id]:not(.elfinder-cwd-parent):first").attr("id"))&&B.css("visibility","hidden"),a.hash===u.cwdId2Hash(o.find("[id]:last").attr("id"))&&$.css("visibility","hidden"),"directory"===a.mime?c=[a.hash]:"group"===a.mime&&a.getSize&&(c=a.files),R.html(r.replace(/\{value\}/,i)+r.replace(/\{value\}/,u.mime2kind(a))+r.replace(/\{value\}/,c.length?J:u.formatSize(a.size))+r.replace(/\{value\}/,u.i18n("modify")+": "+u.formatDate(a))),c.length&&(l=u.getSize(c).done(function(e){R.find("span.elfinder-spinner").parent().html(e.formated)}).fail(function(){R.find("span.elfinder-spinner").parent().html(u.i18n("unknown"))}).always(function(){l=null}),l._hash=a.hash),q.addClass("elfinder-cwd-icon ui-corner-all "+u.mime2class(a.mime)),a.icon&&q.css(u.getIconStyle(a,!0)),p.info.attr("class",k),a.csscls&&p.info.addClass(a.csscls),a.read&&(n=u.tmb(a))&&e("").hide().appendTo(p.preview).on("load",function(){q.addClass(n.className).css("background-image","url('"+n.url+"')"),e(this).remove()}).attr("src",n.url),p.info.delay(100).fadeIn(10),p.window.hasClass(x)&&H.trigger("mousemove"),s.css("overflow","")},c=[];a&&!Object.keys(a).length&&(a=u.cwd()),a&&l&&"pending"===l.state()&&l._hash!==a.hash&&l.reject(),a&&(t.forceUpdate||p.window.data("hash")!==a.hash)?s():t.stopImmediatePropagation()}),this.window=e('
            ').hide().addClass(u.UA.Touch?"elfinder-touch":"").on("click",function(e){var t=this;e.stopPropagation(),b===m&&requestAnimationFrame(function(){b===m&&u.toFront(t)})}).append(e('
            ').append(e('').append(K,X),P),this.preview,p.info.hide(),H.hide(),V).draggable({handle:"div.elfinder-quicklook-titlebar"}).on("open",function(e,t){var n=p.window,i=p.value,a=u.getUI("cwd"),o=function(e){b=e,p.update(1,p.value),p.change(),n.trigger("resize."+u.namespace)};Y||b!==h?b===v&&(u.getUI("navdock").data("addNode")(c),o(g),p.preview.trigger("changesize"),u.storage("previewDocked","1"),0===u.getUI("navdock").width()&&n.trigger("navdockout")):(i&&i.hash!==r&&(a=u.cwdHash2Elm(i.hash.split("/",2)[0])),G="",V.attr("style",""),b=f,a.trigger("scrolltoview"),W(),n.css(t||z(a)).show().animate(T(),550,function(){o(m),L()}),u.toFront(n))}).on("close",function(e,t){var n,i=p.window,a=p.preview.trigger("change"),r=(p.value,(i.data("hash")||"").split("/",2)[0]),s=function(e,n){b=e,n&&u.toHide(i),a.children().remove(),p.update(0,p.value),i.data("hash",""),t&&t.resolve()};p.opened()&&(l&&"pending"===l.state()&&l.reject(),p.docked()?(c=u.getUI("navdock").data("removeNode")(p.window.attr("id"),"detach"),s(v),u.storage("previewDocked","2")):(b=f,i.hasClass(x)&&_.click(),r&&(n=o.find("#"+r)).length?i.animate(z(n),500,function(){a.off("changesize"),s(h,!0)}):s(h,!0)))}).on("navdockin",function(e,t){var n=p.window,a=u.getUI("navdock"),o=s||a.width(),r=t||{};Y&&(r.init=!0),b=g,i=n.attr("style"),n.toggleClass("ui-front").removeClass("ui-widget").draggable("disable").resizable("disable").removeAttr("style").css({width:"100%",height:o,boxSizing:"border-box",paddingBottom:0,zIndex:"unset"}),V.hide(),X.toggleClass("ui-icon-plusthick ui-icon-minusthick elfinder-icon-full elfinder-icon-minimize"),u.toHide(n,!0),a.data("addNode")(n,r),p.preview.trigger("changesize"),u.storage("previewDocked","1")}).on("navdockout",function(t){var n=p.window,a=u.getUI("navdock"),o=(e.Deferred(),z(p.preview));s=n.outerHeight(),a.data("removeNode")(n.attr("id"),u.getUI()),n.toggleClass("ui-front").addClass("ui-widget").draggable("enable").resizable("enable").attr("style",i),X.toggleClass("ui-icon-plusthick ui-icon-minusthick elfinder-icon-full elfinder-icon-minimize"),b=h,n.trigger("open",o),u.storage("previewDocked","0")}).on("resize."+u.namespace,function(){p.preview.trigger("changesize")}),this.alwaysEnabled=!0,this.value=null,this.handlers={select:function(e,t){d&&cancelAnimationFrame(d),e.data&&e.data.selected&&e.data.selected.length?p.opened()&&N():d=requestAnimationFrame(function(){p.opened()&&N()})},error:function(){p.window.is(":visible")&&p.window.trigger("close")},"searchshow searchhide":function(){this.opened()&&this.window.trigger("close")},navbarshow:function(){requestAnimationFrame(function(){p.docked()&&p.preview.trigger("changesize")})},destroy:function(){p.window.remove()}},this.shortcuts=[{pattern:"space"}],this.support={audio:{ogg:j("audio/ogg;"),webm:j("audio/webm;"),mp3:j("audio/mpeg;"),wav:j("audio/wav;"),m4a:j("audio/mp4;")||j("audio/x-m4a;")||j("audio/aac;"),flac:j("audio/flac;"),amr:j("audio/amr;")},video:{ogg:j("video/ogg;"),webm:j("video/webm;"),mp4:j("video/mp4;"),mkv:j("video/x-matroska;")||j("video/webm;"),"3gp":j("video/3gpp;")||j("video/mp4;"),m3u8:j("application/x-mpegURL","video")||j("application/vnd.apple.mpegURL","video"),mpd:j("application/dash+xml","video")}},A={},this.closed=function(){return b==h||b==v},this.opened=function(){return b==m||b==g},this.docked=function(){return b==g},this.addIntegration=function(e){requestAnimationFrame(function(){u.trigger("helpIntegration",Object.assign({cmd:"quicklook"},e))})},this.init=function(){var i,l=this.options,c=this.window,d=this.preview;t=l.width>0?parseInt(l.width):450,n=l.height>0?parseInt(l.height):300,"auto"!==l.dockHeight&&(s=parseInt(l.dockHeight),s||(s=void 0)),u.one("load",function(){O=u.getUI("navdock").data("dockEnabled"),!O&&X.hide(),a=u.getUI(),o=u.getUI("cwd"),u.zIndex&&c.css("z-index",u.zIndex+1),c.appendTo(a),e(document).on("keydown."+u.namespace,function(t){t.keyCode==e.ui.keyCode.ESCAPE&&p.opened()&&!p.docked()&&c.hasClass("elfinder-frontmost")&&c.trigger("close")}),c.resizable({handles:"se",minWidth:350,minHeight:120,resize:function(){d.trigger("changesize")}}),p.change(function(){p.opened()&&p.value&&(p.value.tmb&&1==p.value.tmb&&(p.value=Object.assign({},u.file(p.value.hash))),d.trigger(e.Event(y,{file:p.value})))}),d.on(y,function(e){var t,n,a;if(t=e.file){if(n=t.hash,a=u.searchStatus.mixed&&u.searchStatus.state>1,"directory"!==t.mime)if(parseInt(t.size)||t.mime.match(l.mimeRegexNotEmptyCheck)){if(p.dispInlineRegex=i,a||u.optionsByHashes[n])try{p.dispInlineRegex=new RegExp(u.option("dispInlineRegex",n),"i")}catch(e){try{p.dispInlineRegex=new RegExp(u.isRoot(t)?u.options.dispInlineRegex:u.option("dispInlineRegex",t.phash),"i")}catch(e){p.dispInlineRegex=/^$/}}}else e.stopImmediatePropagation();else p.dispInlineRegex=/^$/;p.info.show()}else e.stopImmediatePropagation()}),e.each(u.commands.quicklook.plugins||[],function(e,t){"function"==typeof t&&new t(p)})}).one("open",function(){var e,t=Number(u.storage("previewDocked")||l.docked);O&&t>=1&&(e=p.window,p.exec(),e.trigger("navdockin",{init:!0}),2===t?e.trigger("close"):(p.update(void 0,u.cwd()),p.change())),Y=!1}).bind("open",function(){r=u.cwd().hash,p.value=u.cwd();try{i=new RegExp(u.option("dispInlineRegex"),"i")}catch(e){i=/^$/}}).bind("change",function(t){t.data&&t.data.changed&&p.opened()&&e.each(t.data.changed,function(){if(p.window.data("hash")===this.hash)return p.window.data("hash",null),p.preview.trigger(y),!1})}).bind("navdockresizestart navdockresizestop",function(e){H["navdockresizestart"===e.type?"show":"hide"]()})},this.getstate=function(){return p.opened()?1:0},this.exec=function(){return p.closed()&&N(),p.enabled()&&p.window.trigger(p.opened()?"close":"open"),e.Deferred().resolve()},this.hideinfo=function(){this.info.stop(!0,!0).hide()}}).prototype={forceLoad:!0},i.prototype.commands.quicklook.plugins=[function(t){var n,i,a=["image/jpeg","image/png","image/gif","image/svg+xml","image/x-ms-bmp"],o=t.fm.returnBytes(t.options.getDimThreshold||0),r=t.preview;n=new Image,n.onload=n.onerror=function(){2==n.height&&a.push("image/webp")},n.src="data:image/webp;base64,UklGRjoAAABXRUJQVlA4IC4AAACyAgCdASoCAAIALmk0mk0iIiIiIgBoSygABc6WWgAA/veff/0PP8bA//LwYAAA",e.each(navigator.mimeTypes,function(t,n){var i=n.type;0===i.indexOf("image/")&&e.inArray(i,a)&&a.push(i)}),r.on(t.evUpdate,function(n){var s,l,c,d,p=t.fm,u=n.file,h=!1,f=null,m=function(e){var t=p.file(u.hash);t.width=e[0],t.height=e[1]},g=function(){var e,t,n,i,a;f&&f.state&&"pending"===f.state()&&f.reject(),h||(h=!0,e=s.get(0),t=u.width&&u.height?{w:u.width,h:u.height}:e.naturalWidth?null:{w:s.width(),h:s.height()},t&&s.removeAttr("width").removeAttr("height"),n=u.width||e.naturalWidth||e.width||s.width(),i=u.height||e.naturalHeight||e.height||s.height(),u.width&&u.height||m([n,i]),t&&s.width(t.w).height(t.h),a=(n/i).toFixed(2),r.on("changesize",function(){var e,t,n=parseInt(r.width()),i=parseInt(r.height());a<(n/i).toFixed(2)?(t=i,e=Math.floor(t*a)):(e=n,t=Math.floor(e/a)),s.width(e).height(t).css("margin-top",t'+p.i18n("nowLoading")+'
          ').appendTo(t.info.find(".elfinder-quicklook-info")),c=e('
          ').appendTo(l),s=e("").hide().appendTo(r).on("load",function(){v(),g()}).on("error",function(){l.remove()}),d=p.openUrl(u.hash,!1,function(e){s.attr("src",e)},{progressBar:c}),r.one("change",function(){d&&d.state&&"pending"===d.state()&&d.reject()}),u.width&&u.height?g():u.size>o&&(f=p.request({data:{cmd:"dim",target:u.hash},preventDefault:!0}).done(function(e){if(e.dim){var t=e.dim.split("x");u.width=t[0],u.height=t[1],m(t),g()}})))})},function(t){var n=t.fm,i="image/tiff",a=t.preview;window.Worker&&window.Uint8Array&&a.on(t.evUpdate,function(o){var r,s,l,c,d,p=o.file,u=function(e){c&&c.terminate(),r.remove(),n.debug("error",e)},h=function(e){var t=n.file(p.hash);t.width=e[0],t.height=e[1]};p.mime===i&&(o.stopImmediatePropagation(),r=e('
          '+n.i18n("nowLoading")+'
          ').appendTo(t.info.find(".elfinder-quicklook-info")),s=e('
          ').appendTo(r),a.one("change",function(){c&&c.terminate(),r.remove()}),d=n.getContents(p.hash,"arraybuffer",{progressBar:s}).done(function(i){if(i){l=e("
          ").css({width:"100%",height:"100%"}).hide().appendTo(a);try{c=n.getWorker(),c.onmessage=function(n){var i,o,s,d,u=n.data;c&&c.terminate(),i=document.createElement("canvas"),o=i.getContext("2d"),i.width=u.width,i.height=u.height,s=o.createImageData(u.width,u.height),s.data.set(new Uint8Array(u.image)),o.putImageData(s,0,0),l.append(i).show(),r.remove(),d=(u.width/u.height).toFixed(2),a.on("changesize",function(){var t,n,o=parseInt(a.width()),r=parseInt(a.height());d<(o/r).toFixed(2)?(n=r,t=Math.floor(n*d)):(t=o,n=Math.floor(t/d)),e(i).width(t).height(n).css("margin-top",n'+i.i18n("nowLoading")+'
          ').appendTo(t.info.find(".elfinder-quicklook-info")),d=e('
          ').appendTo(c),h=i.openUrl(f.hash,"sameorigin",function(t){t&&(l=e("").hide().appendTo(o),n?r(t,l,c):(p=window.define,u=window.require,window.require=null,window.define=null,i.loadScript([i.options.cdns.psd],function(){n=require("psd"),p?window.define=p:delete window.define,u?window.require=u:delete window.require,r(t,l,c)})))},{progressBar:d}),o.one("change",function(){h&&h.state&&"pending"===h.state()&&h.reject()}))})},function(t){var n=t.fm,i=n.arrayFlip(["text/html","application/xhtml+xml"]),a=t.preview;a.on(t.evUpdate,function(o){var r,s,l,c=o.file;i[c.mime]&&t.dispInlineRegex.test(c.mime)&&(!t.options.getSizeMax||c.size<=t.options.getSizeMax)&&(o.stopImmediatePropagation(),s=e('
          '+n.i18n("nowLoading")+'
          ').appendTo(t.info.find(".elfinder-quicklook-info")),l=e('
          ').appendTo(s),a.one("change",function(){"pending"==r.state()&&r.reject()}).addClass("elfinder-overflow-auto"),r=n.request({data:{cmd:"get",target:c.hash,conv:1,_t:c.ts},options:{type:"get",cache:!0},preventDefault:!0,progressBar:l}).done(function(n){t.hideinfo();var i=e('').appendTo(a)[0].contentWindow.document;i.open(),i.write(n.content),i.close()}).always(function(){s.remove()}))})},function(t){var n=t.fm,i=n.arrayFlip(["text/x-markdown"]),a=t.preview,o=null,r=function(n,i){t.hideinfo();var r=e('').appendTo(a)[0].contentWindow.document;r.open(),r.write(o(n.content)),r.close(),i.remove()},s=function(e){o=!1,e.remove()};a.on(t.evUpdate,function(l){var c,d,p,u=l.file;i[u.mime]&&n.options.cdns.marked&&o!==!1&&t.dispInlineRegex.test(u.mime)&&(!t.options.getSizeMax||u.size<=t.options.getSizeMax)&&(l.stopImmediatePropagation(),d=e('
          '+n.i18n("nowLoading")+'
          ').appendTo(t.info.find(".elfinder-quicklook-info")),p=e('
          ').appendTo(d),a.one("change",function(){"pending"==c.state()&&c.reject()}).addClass("elfinder-overflow-auto"),c=n.request({data:{cmd:"get",target:u.hash,conv:1,_t:u.ts},options:{type:"get",cache:!0},preventDefault:!0,progressBar:p}).done(function(e){o||window.marked?(o||(o=window.marked),r(e,d)):n.loadScript([n.options.cdns.marked],function(t){o=t||window.marked||!1,delete window.marked,o?r(e,d):s(d)},{tryRequire:!0,error:function(){s(d)}})}).fail(function(){s(d)}))})},function(t){if(t.options.viewerjs){var n=t.fm,i=t.preview,a=t.options.viewerjs,o=a.url?n.arrayFlip(a.mimes||[]):[],r=t.window,s=t.navbar,l=function(){s.css("bottom",r.hasClass("elfinder-quicklook-fullscreen")?"30px":"")};a.url&&i.on("update",function(s){var c,d,p,u,h=s.file;!o[h.mime]||"application/pdf"===h.mime&&a.pdfNative&&t.flags.pdfNative||(s.stopImmediatePropagation(),d=e('
          '+n.i18n("nowLoading")+'
          ').appendTo(t.info.find(".elfinder-quicklook-info")),p=e('
          ').appendTo(d),u=n.openUrl(h.hash,"sameorigin",function(n){n&&(c=e('').css("background-color","transparent").on("load",function(){t.hideinfo(),d.remove(),c.css("background-color","#fff")}).on("error",function(){d.remove(),c.remove()}).appendTo(i).attr("src",a.url+"#"+n),r.on("viewchange.viewerjs",l),l(),i.one("change",function(){r.off("viewchange.viewerjs"),d.remove(),c.off("load").remove()}))},{progressBar:p}),i.one("change",function(){u&&u.state&&"pending"===u.state()&&u.reject()}))})}},function(t){var n=t.fm,i="application/pdf",a=t.preview,o=!1,r="";n.UA.Safari&&"mac"===n.OS&&!n.UA.iOS||n.UA.IE||n.UA.Firefox?o=!0:e.each(navigator.plugins,function(t,n){e.each(n,function(e,t){if(t.type===i)return!(o=!0)})}),t.flags.pdfNative=o,o&&("undefined"==typeof t.options.pdfToolbar||t.options.pdfToolbar||(r="#toolbar=0"),a.on(t.evUpdate,function(s){var l,c=s.file;o&&c.mime===i&&t.dispInlineRegex.test(c.mime)&&(s.stopImmediatePropagation(),l=n.openUrl(c.hash,!1,function(i){i&&(t.hideinfo(),t.cover.addClass("elfinder-quicklook-coverbg"),e('').on("error",function(e){o=!1,t.update(void 0,n.cwd()),t.update(void 0,c)}).appendTo(a))}),a.one("change",function(){l&&l.state&&"pending"===l.state()&&l.reject()}))}))},function(t){var n=t.fm,i="application/x-shockwave-flash",a=t.preview,o=!1;e.each(navigator.plugins,function(t,n){e.each(n,function(e,t){if(t.type===i)return!(o=!0)})}),o&&a.on(t.evUpdate,function(o){var r,s,l=o.file;l.mime===i&&t.dispInlineRegex.test(l.mime)&&(o.stopImmediatePropagation(),s=n.openUrl(l.hash,!1,function(n){n&&(t.hideinfo(),r=e('').appendTo(a))}),a.one("change",function(){s&&s.state&&"pending"===s.state()&&s.reject()}))})},function(t){var n,i,a,o,r,s,l=t.fm,c=t.preview,d={"audio/mpeg":"mp3","audio/mpeg3":"mp3","audio/mp3":"mp3","audio/x-mpeg3":"mp3","audio/x-mp3":"mp3","audio/x-wav":"wav","audio/wav":"wav","audio/x-m4a":"m4a","audio/aac":"m4a","audio/mp4":"m4a","audio/x-mp4":"m4a","audio/ogg":"ogg","audio/webm":"webm","audio/flac":"flac","audio/x-flac":"flac","audio/amr":"amr"},p=t.window,u=t.navbar,h="string"==typeof t.options.mediaControlsList&&t.options.mediaControlsList?' controlsList="'+l.escape(t.options.mediaControlsList)+'"':"",f=function(){u.css("bottom",p.hasClass("elfinder-quicklook-fullscreen")?"50px":"")},m=function(t,i){return e('').on("change",function(e){e.stopPropagation()}).on("error",function(e){n&&n.data("hash")===i&&b()}).data("hash",i).appendTo(c)},g=function(t){var n,i=e.Deferred(),o=e.Deferred().done(function(){var e;e=l.getContents(t,"arraybuffer",{progressBar:s}).done(function(e){try{var t=a.toWAV(new Uint8Array(e));t?i.resolve(URL.createObjectURL(new Blob([t],{type:"audio/x-wav"}))):i.reject()}catch(n){i.reject()}}).fail(function(){i.reject()}),c.one("change",function(){e&&e.state&&"pending"===e.state()&&e.reject()})}).fail(function(){a=!1,i.reject()});return window.TextEncoder&&window.URL&&URL.createObjectURL&&"undefined"==typeof a?(n=window.AMR,delete window.AMR,l.loadScript([l.options.cdns.amr],function(){a=!!window.AMR&&window.AMR,window.AMR=n,o[a?"resolve":"reject"]()},{error:function(){o.reject()}})):o[a?"resolve":"reject"](),i},v=function(e){var t,i=n.data("hash");o&&(t=e.play()),t&&t["catch"]&&t["catch"](function(t){e.paused||n&&n.data("hash")===i&&b()})},b=function(){if(n&&n.parent().length){var e=n[0],t=n.children("source").attr("src");p.off("viewchange.audio");try{e.pause(),n.empty(),t.match(/^blob:/)&&URL.revokeObjectURL(t),e.src="",e.load()}catch(i){}n.remove(),n=null}};c.on(t.evUpdate,function(u){var h,b,y=u.file,w=d[y.mime];d[y.mime]&&t.dispInlineRegex.test(y.mime)&&((h=t.support.audio[w])||"amr"===w)&&(o=t.autoPlay(),i=y.hash,h?(u.stopImmediatePropagation(),r=e('
          '+l.i18n("nowLoading")+'
          ').appendTo(t.info.find(".elfinder-quicklook-info")),s=e('
          ').appendTo(r),b=l.openUrl(i,!1,function(e){r.remove(),e?(n=m(e,i),v(n[0]),p.on("viewchange.audio",f),f()):n.remove()},{progressBar:s}),c.one("change",function(){b&&b.state&&"pending"===b.state()&&b.reject()})):l.options.cdns.amr&&"amr"===w&&a!==!1&&(u.stopImmediatePropagation(),r=e('
          '+l.i18n("nowLoading")+'
          ').appendTo(t.info.find(".elfinder-quicklook-info")),s=e('
          ').appendTo(r),n=m("",i),g(y.hash).done(function(e){if(r.remove(),i===y.hash){var t=n[0];try{n.children("source").attr("src",e),t.pause(),t.load(),v(t),p.on("viewchange.audio",f),f()}catch(a){URL.revokeObjectURL(e),n.remove()}}else URL.revokeObjectURL(e)}).fail(function(){n.remove()})))}).one("change",b)},function(t){var n,i,a,o,r,s,l,c,d,p,u=t.fm,h=t.preview,f={"video/mp4":"mp4","video/x-m4v":"mp4","video/quicktime":"mp4","video/mpeg":"mpeg","video/ogg":"ogg","application/ogg":"ogg","video/webm":"webm","video/x-matroska":"mkv","video/3gpp":"3gp","application/vnd.apple.mpegurl":"m3u8","application/x-mpegurl":"m3u8","application/dash+xml":"mpd","video/x-flv":"flv","video/x-msvideo":"avi"},m=t.window,g=t.navbar,v="string"==typeof t.options.mediaControlsList&&t.options.mediaControlsList?' controlsList="'+u.escape(t.options.mediaControlsList)+'"':"",b=function(){u.UA.iOS?m.hasClass("elfinder-quicklook-fullscreen")?(h.css("height","-webkit-calc(100% - 50px)"),g._show()):h.css("height",""):g.css("bottom",m.hasClass("elfinder-quicklook-fullscreen")?"50px":"")},y=function(i,a){var r,s=function(e){l>1&&(c&&clearTimeout(c),c=setTimeout(function(){!r&&T(!0)},800))},l=0;o=null,a=a||{},t.hideinfo(),n=e('').on("change",function(e){e.stopPropagation()}).on("timeupdate progress",s).on("canplay",function(){r=!0}).data("hash",i.hash),n[0].addEventListener("error",function(e){a.src&&u.convAbsUrl(a.src)===u.convAbsUrl(e.target.src)&&(++l,s())},!0),a.src&&n.append(''),n.appendTo(h),m.on("viewchange.video",b),b()},w=function(e){var t,a;a=u.openUrl(e.hash,!1,function(a){d.remove(),a&&(y(e),t=new i,t.loadSource(a),t.attachMedia(n[0]),l&&t.on(i.Events.MANIFEST_PARSED,function(){z(n[0])}))},{progressBar:p}),h.one("change",function(){a&&a.state&&"pending"===a.state()&&a.reject()})},x=function(e){var t;t=u.openUrl(e.hash,!1,function(t){var i;d.remove(),t&&(y(e),o=window.dashjs.MediaPlayer().create(),i=o.getDebug(),i.setLogLevel?i.setLogLevel(dashjs.Debug.LOG_LEVEL_FATAL):i.setLogToBrowserConsole&&i.setLogToBrowserConsole(!1),o.initialize(n[0],t,l),o.on("error",function(e){T(!0)}))},{progressBar:p}),h.one("change",function(){t&&t.state&&"pending"===t.state()&&t.reject()})},k=function(e){var t;return r.isSupported()?(t=u.openUrl(e.hash,!1,function(t){if(d.remove(),t){var i=r.createPlayer({type:"flv",url:t});y(e),i.on(r.Events.ERROR,function(){i.destroy(),T(!0)}),i.attachMediaElement(n[0]),i.load(),z(i)}},{progressBar:p}),void h.one("change",function(){t&&t.state&&"pending"===t.state()&&t.reject()})):void(r=!1)},C=function(e){var t;t=u.openUrl(e.hash,!1,function(t){d.remove(),t&&(y(e),n[0].src=t,s(n[0],{src:t}))},{progressBar:p}),h.one("change",function(){t&&t.state&&"pending"===t.state()&&t.reject()})},z=function(e){var t,i=n.data("hash");l&&(t=e.play()),t&&t["catch"]&&t["catch"](function(t){e.paused||n&&n.data("hash")===i&&T(!0)})},T=function(e){if(c&&clearTimeout(c),n&&n.parent().length){var i=n[0];m.off("viewchange.video"),o&&o.reset();try{i.pause(),n.empty(),i.src="",i.load()}catch(a){}n.remove(),n=null}e&&t.info.show()};h.on(t.evUpdate,function(o){var c,m,g=o.file,v=g.mime.toLowerCase(),b=f[v];f[v]&&t.dispInlineRegex.test(g.mime)&&(l=t.autoPlay(),d=e('
          '+u.i18n("nowLoading")+'
          '),p=e('
          ').appendTo(d),t.support.video[b]&&("m3u8"!==b||u.UA.Safari)?(o.stopImmediatePropagation(),d.appendTo(t.info.find(".elfinder-quicklook-info")),m=u.openUrl(g.hash,!1,function(e){d.remove(),e&&(y(g,{src:e}),z(n[0]))},{progressBar:p}),h.one("change",function(){m&&m.state&&"pending"===m.state()&&m.reject()})):i!==!1&&u.options.cdns.hls&&"m3u8"===b?(o.stopImmediatePropagation(),d.appendTo(t.info.find(".elfinder-quicklook-info")),i?w(g):(c=window.Hls,delete window.Hls,u.loadScript([u.options.cdns.hls],function(e){i=e||window.Hls||!1,window.Hls=c,i&&w(g)},{tryRequire:!0,error:function(){i=!1}}))):a!==!1&&u.options.cdns.dash&&"mpd"===b?(o.stopImmediatePropagation(),d.appendTo(t.info.find(".elfinder-quicklook-info")),a?x(g):u.loadScript([u.options.cdns.dash],function(){a=!!window.dashjs,a&&x(g)},{tryRequire:!0,error:function(){a=!1}})):r!==!1&&u.options.cdns.flv&&"flv"===b?(o.stopImmediatePropagation(),d.appendTo(t.info.find(".elfinder-quicklook-info")),r?k(g):(c=window.flvjs,delete window.flvjs,u.loadScript([u.options.cdns.flv],function(e){r=e||window.flvjs||!1,window.flvjs=c,r&&k(g)},{tryRequire:!0,error:function(){r=!1}}))):u.options.cdns.videojs&&(o.stopImmediatePropagation(),d.appendTo(t.info.find(".elfinder-quicklook-info")),s?C(g):u.loadScript([u.options.cdns.videojs+"/video.min.js"],function(e){s=e||window.videojs||!1,s&&C(g)},{tryRequire:!0,error:function(){s=!1}}).loadCss([u.options.cdns.videojs+"/video-js.min.css"])))}).one("change",T)},function(t){var n,i=t.preview,a=[],o=t.window,r=t.navbar;e.each(navigator.plugins,function(t,n){e.each(n,function(e,t){(0===t.type.indexOf("audio/")||0===t.type.indexOf("video/"))&&a.push(t.type)})}),a=t.fm.arrayFlip(a),i.on(t.evUpdate,function(s){var l,c,d,p,u=s.file,h=u.mime,f=function(){r.css("bottom",o.hasClass("elfinder-quicklook-fullscreen")?"50px":"")};a[u.mime]&&t.dispInlineRegex.test(u.mime)&&(s.stopImmediatePropagation(),d=e('
          '+fm.i18n("nowLoading")+'
          ').appendTo(t.info.find(".elfinder-quicklook-info")),p=e('
          ').appendTo(d),c=t.fm.openUrl(u.hash,!1,function(a){d.remove(),a&&((l=0===h.indexOf("video/"))&&t.hideinfo(),n=e('').appendTo(i),o.on("viewchange.embed",f),f())},{progressBar:p}),i.one("change",function(){c&&c.state&&"pending"===c.state()&&c.reject()}))}).one("change",function(){n&&n.parent().length&&(o.off("viewchange.embed"),n.remove(),n=null)})},function(t){var n=t.fm,i=n.arrayFlip(["application/zip","application/x-gzip","application/x-tar","application/x-bzip2"]),a=t.preview,o=n.returnBytes(t.options.unzipMaxSize||0),r=!(!n.options.cdns.zlibUnzip||!n.options.cdns.zlibGunzip),s=!!n.options.cdns.bzip2;window.Worker&&window.Uint8Array&&window.DataView&&a.on(t.evUpdate,function(l){var c=l.file,d="application/x-tar"===c.mime,p="application/x-bzip2"===c.mime,u="application/zip"===c.mime||"application/x-gzip"===c.mime;if(i[c.mime]&&(!o||c.size<=o)&&(d||p&&s||u&&r)){var h,f,m,g,v=function(){h=n.getContents(c.hash,"arraybuffer",{progressBar:g}).fail(function(){m.remove()}).done(function(e){var t=function(e){f&&f.terminate(),m.remove(),u?r=!1:p&&(s=!1),n.debug("error",e)};try{f=n.getWorker(),f.onmessage=function(e){f&&f.terminate(),m.remove(),!e.data||e.data.error?new Error(e.data&&e.data.error?e.data.error:""):b(e.data.files)},f.onerror=t,"application/x-tar"===c.mime?f.postMessage({scripts:[n.getWorkerUrl("quicklook.unzip.js")],data:{type:"tar",bin:e}}):"application/zip"===c.mime?f.postMessage({scripts:[n.options.cdns.zlibUnzip,n.getWorkerUrl("quicklook.unzip.js")],data:{type:"zip",bin:e}}):"application/x-gzip"===c.mime?f.postMessage({scripts:[n.options.cdns.zlibGunzip,n.getWorkerUrl("quicklook.unzip.js")],data:{type:"gzip",bin:e}}):"application/x-bzip2"===c.mime&&f.postMessage({scripts:[n.options.cdns.bzip2,n.getWorkerUrl("quicklook.unzip.js")],data:{type:"bzip2",bin:e}})}catch(i){t(i)}})},b=function(i){var o,r,s,l=0;i&&i.length&&(i=e.map(i,function(e){return n.decodeRawString(e)}),i.sort(),r=n.escape(i.join("\n").replace(/\{formatSize\((\d+)\)\}/g,function(e,t){return l+=parseInt(t),n.formatSize(t)})),o=""+n.escape(c.mime)+" ("+n.formatSize(c.size)+" / "+n.formatSize(l)+")
          ",s=e('
          '+o+'
          '+r+"
          ").on("touchstart",function(t){e(this)["scroll"+("ltr"===n.direction?"Right":"Left")]()>5&&(t.originalEvent._preventSwipeX=!0)}).appendTo(a),t.hideinfo()),m.remove()};l.stopImmediatePropagation(),m=e('
          '+n.i18n("nowLoading")+'
          ').appendTo(t.info.find(".elfinder-quicklook-info")),g=e('
          ').appendTo(m),a.one("change",function(){"pending"===h.state()&&h.reject(),f&&f.terminate(),m.remove()}),v()}})},function(t){var n,i=t.fm,a=i.arrayFlip(["application/x-rar"]),o=t.preview;window.DataView&&o.on(t.evUpdate,function(r){var s=r.file;if(a[s.mime]&&i.options.cdns.rar&&n!==!1){var l,c,d,p,u,h,f=function(a){if(p)return void l.remove();try{d=n({file:a,type:2,xhrHeaders:i.customHeaders,xhrFields:i.xhrFields},function(n){l.remove();var a,r,c=[];return p||n?void(n&&i.debug("error",n)):(e.each(d.entries,function(){c.push(this.path+(this.size?" ("+i.formatSize(this.size)+")":""))}),void(c.length&&(c=e.map(c,function(e){return i.decodeRawString(e)}),c.sort(),a=""+i.escape(s.mime)+" ("+i.formatSize(s.size)+")
          ",r=e('
          '+a+'
          '+i.escape(c.join("\n"))+"
          ").on("touchstart",function(t){e(this)["scroll"+("ltr"===i.direction?"Right":"Left")]()>5&&(t.originalEvent._preventSwipeX=!0)}).appendTo(o),t.hideinfo())))})}catch(r){l.remove()}},m=function(){n=!1,l.remove()};r.stopImmediatePropagation(),l=e('
          '+i.i18n("nowLoading")+'
          ').appendTo(t.info.find(".elfinder-quicklook-info")),c=e('
          ').appendTo(l),o.one("change",function(){d&&(d.abort=!0),l.remove(),p=!0}),h=i.openUrl(s.hash,"sameorigin",function(e){e&&(n?f(e):(window.RarArchive&&(u=window.RarArchive,delete window.RarArchive),i.loadScript([i.options.cdns.rar],function(){i.hasRequire?require(["rar"],function(t){n=t,f(e)},m):(n=window.RarArchive)?(u?window.RarArchive=u:delete window.RarArchive,f(e)):m()},{tryRequire:!0,error:m})))},{progressBar:c,temporary:!0}),o.one("change",function(){h&&h.state&&"pending"===h.state()&&h.reject()})}})},function(t){var n,i=t.fm,a=i.arrayFlip(t.options.sharecadMimes||[]),o=t.preview;t.window;t.options.sharecadMimes.length&&t.addIntegration({title:"ShareCAD.org CAD and 3D-Models viewer",link:"https://sharecad.org/DWGOnlinePlugin"}),o.on(t.evUpdate,function(r){var s=r.file;if(a[s.mime.toLowerCase()]&&i.option("onetimeUrl",s.hash)){var l,c,d;t.window;r.stopImmediatePropagation(),"1"==s.url&&(o.hide(),e('
          ").appendTo(t.info.find(".elfinder-quicklook-info")).on("click",function(){var n=e(this);n.html(''),i.request({data:{cmd:"url",target:s.hash},preventDefault:!0,progressBar:c}).always(function(){n.html("")}).done(function(e){var n=i.file(s.hash);s.url=n.url=e.url||"",s.url&&o.trigger({type:t.evUpdate,file:s,forceUpdate:!0})})})),""!==s.url&&"1"!=s.url&&(o.one("change",function(){l.remove(),n.off("load").remove(),n=null}).addClass("elfinder-overflow-auto"),l=e('
          '+i.i18n("nowLoading")+'
          ').appendTo(t.info.find(".elfinder-quicklook-info")),c=e('
          ').appendTo(l),d=i.convAbsUrl(i.url(s.hash)),n=e('').css("background-color","transparent").appendTo(o).on("load",function(){t.hideinfo(),l.remove(),t.preview.after(t.info),e(this).css("background-color","#fff").show()}).on("error",function(){l.remove(),t.preview.after(t.info)}).attr("src","//sharecad.org/cadframe/load?url="+encodeURIComponent(d)),t.info.after(t.preview))}})},function(t){var n,i,a,o,r,s=t.fm,l={"application/vnd.google-earth.kml+xml":!0,"application/vnd.google-earth.kmz":!0},c=t.preview;t.options.googleMapsApiKey&&(t.addIntegration({title:"Google Maps",link:"https://www.google.com/intl/"+s.lang.replace("_","-")+"/help/terms_maps.html"}),n=window.google&&google.maps,i=function(e,i,a){var r=t.options.googleMapsOpts.maps;s.forExternalUrl(e.hash,{progressBar:a}).done(function(e){if(e)try{new n.KmlLayer(e,Object.assign({map:new n.Map(i.get(0),r)},t.options.googleMapsOpts.kml)),t.hideinfo()}catch(a){o()}else o()})},a=window.gm_authFailure,o=function(){r=null},r="https://maps.googleapis.com/maps/api/js?key="+t.options.googleMapsApiKey,window.gm_authFailure=function(){o(),a&&a()},c.on(t.evUpdate,function(a){var o=a.file;if(r&&l[o.mime.toLowerCase()]){var d,p,u,h=(t.window,"1"==o.url&&!s.option("onetimeUrl",o.hash));a.stopImmediatePropagation(),d=e('
          '+s.i18n("nowLoading")+'
          ').appendTo(t.info.find(".elfinder-quicklook-info")),p=e('
          ').appendTo(d),h&&(c.hide(),e('
          ").appendTo(t.info.find(".elfinder-quicklook-info")).on("click",function(){var n=e(this);n.html(''),s.request({data:{cmd:"url",target:o.hash},preventDefault:!0,progressBar:p}).always(function(){d.remove(),n.html("")}).done(function(e){var n=s.file(o.hash);o.url=n.url=e.url||"",o.url&&c.trigger({type:t.evUpdate,file:o,forceUpdate:!0})})})),""===o.url||h||(u=e('
          ').appendTo(c),c.one("change",function(){u.remove(),u=null}),n?i(o,u,p):s.loadScript([r],function(){n=window.google&&google.maps,n&&i(o,u,p)}))}}))},function(t){var n,i,a=t.fm,o=Object.assign(a.arrayFlip(t.options.googleDocsMimes||[],"g"),a.arrayFlip(t.options.officeOnlineMimes||[],"m")),r=t.preview,s=(t.window,t.navbar),l={g:"docs.google.com/gview?embedded=true&url=",m:"view.officeapps.live.com/op/embed.aspx?wdStartOn=0&src="},c={g:"56px",m:"24px"},d={xls:5242880,xlsb:5242880,xlsx:5242880,xlsm:5242880,other:10485760};t.options.googleDocsMimes.length&&(i=!0,t.addIntegration({title:"Google Docs Viewer",link:"https://docs.google.com/"})),t.options.officeOnlineMimes.length&&(i=!0,t.addIntegration({title:"MS Online Doc Viewer",link:"https://products.office.com/office-online/view-office-documents-online"})),i&&r.on(t.evUpdate,function(i){var p,u,h=i.file;if(h.size<=26214400&&(p=o[h.mime])){var f,m,g,v=t.window,b=function(){s.css("bottom",v.hasClass("elfinder-quicklook-fullscreen")?c[p]:"")},y=a.mimeTypes[h.mime],w="1"==h.url&&!a.option("onetimeUrl",h.hash);"m"===p&&(d[y]&&h.size>d[y]||h.size>d.other)&&(p="g"),w&&(r.hide(),e('
          ").appendTo(t.info.find(".elfinder-quicklook-info")).on("click",function(){var n=e(this);n.html(''),a.request({data:{cmd:"url",target:h.hash},preventDefault:!0}).always(function(){n.html("")}).done(function(e){var n=a.file(h.hash);h.url=n.url=e.url||"",h.url&&r.trigger({type:t.evUpdate,file:h,forceUpdate:!0})})})),""===h.url||w||(i.stopImmediatePropagation(),r.one("change",function(){u&&u.status&&"pending"===u.status()&&u.reject(),v.off("viewchange.googledocs"),f.remove(),n.off("load").remove(),n=null}).addClass("elfinder-overflow-auto"),f=e('
          '+a.i18n("nowLoading")+'
          ').appendTo(t.info.find(".elfinder-quicklook-info")),m=e('
          ').appendTo(f),n=e('').css("background-color","transparent").appendTo(r),u=a.forExternalUrl(h.hash,{progressBar:m}).done(function(i){var a=function(){try{!n||n.attr("src")&&!n.get(0).contentWindow.document||(n.attr("src","https://"+l[p]+encodeURIComponent(i)),g=setTimeout(a,2e3))}catch(e){}};i?(h.ts&&(i+=(i.match(/\?/)?"&":"?")+"_t="+h.ts),n.on("load",function(){g&&clearTimeout(g),t.hideinfo(),f.remove(),t.preview.after(t.info),e(this).css("background-color","#fff").show()}).on("error",function(){g&&clearTimeout(g),f.remove(),t.preview.after(t.info)}),a()):(f.remove(),n.remove())}),v.on("viewchange.googledocs",b),b(),t.info.after(t.preview))}})},function(t){"use strict";var n,i,a=t.fm,o=t.preview,r=parseInt(t.options.textInitialLines)||150,s=parseInt(t.options.prettifyMaxLines)||500,l=function(){c=function(){return!1},i&&(window.PR=i),n=!1},c=function(e){a.options.cdns.prettify?(c=function(e){return setTimeout(function(){p(e)},100),"pending"},window.PR&&(i=window.PR),a.loadScript([a.options.cdns.prettify+(a.options.cdns.prettify.match(/\?/)?"&":"?")+"autorun=false"],function(t){n=t||window.PR,"object"==typeof n?(c=function(){return!0},i?window.PR=i:delete window.PR,d(e)):l()},{tryRequire:!0,error:l})):l()},d=function(e){e&&!e.hasClass("prettyprinted")&&(e.css("cursor","wait"),requestAnimationFrame(function(){n.prettyPrint&&n.prettyPrint(null,e.get(0)),e.css("cursor","")}))},p=function(e){var t=c(e);t===!0&&d(e)};o.on(t.evUpdate,function(i){var l,c,d,u,h=i.file;h.mime;a.mimeIsText(h.mime)&&(!t.options.getSizeMax||h.size<=t.options.getSizeMax)&&n!==!1&&(i.stopImmediatePropagation(),c=e('
          '+a.i18n("nowLoading")+'
          ').appendTo(t.info.find(".elfinder-quicklook-info")),d=e('
          ').appendTo(c),o.one("change",function(){"pending"==l.state()&&l.reject(),u&&u.remove()}),l=a.request({data:{cmd:"get",target:h.hash,conv:h.encoding||1,_t:h.ts},options:{type:"get",cache:!0},preventDefault:!0,progressBar:d}).done(function(n){var i,l,c,d,u,f=new RegExp("^(data:"+h.mime.replace(/([.+])/g,"\\$1")+";base64,)","i"),m=n.content;"string"==typeof m&&(t.hideinfo(),window.atob&&(u=m.match(f))&&(m=atob(m.substr(u[1].length))),d=m.match(/([^\r\n]{1,100}[\r\n]*)/g),l=d.length-r,l>10?i=d.splice(0,r).join(""):l=0,c=e('
          '),l&&c.append(e('

          '+a.i18n("linesLeft",a.toLocaleString(l))+"
          ").on("click",function(){var t=c.scrollTop();e(this).remove(),c.children("pre").removeClass("prettyprinted").text(m).scrollTop(t),d.length<=s&&p(c)})),c.children("pre").text(i||m),c.on("touchstart",function(t){e(this)["scroll"+("ltr"===a.direction?"Right":"Left")]()>5&&(t.originalEvent._preventSwipeX=!0)}).appendTo(o),n.toasts&&Array.isArray(n.toasts)&&e.each(n.toasts,function(){this.msg&&a.toast(this)}),p(c))}).always(function(n){var i,r,s;(i=a.getCommand("edit"))&&(s=[],n&&n.encoding&&s.push({value:n.encoding}),s.push({value:"UTF-8"}),r=i.getEncSelect(s),r.on("change",function(){h.encoding=r.val(),a.cache(h,"change"),o.trigger({type:t.evUpdate,file:h,forceUpdate:!0})}),u=e('
          ').append(r),t.window.append(u)),c.remove()}))})}],(i.prototype.commands.reload=function(){"use strict";var t=this,n=!1;this.alwaysEnabled=!0,this.updateOnSelect=!0,this.shortcuts=[{pattern:"ctrl+shift+r f5"}],this.getstate=function(){return 0},this.init=function(){this.fm.bind("search searchend",function(){n="search"==this.type})},this.fm.bind("contextmenu",function(){var n=t.fm;n.options.sync>=1e3&&(t.extra={icon:"accept",node:e("").attr({title:n.i18n("autoSync")}).on("click touchstart",function(t){"touchstart"===t.type&&t.originalEvent.touches.length>1||(t.stopPropagation(),t.preventDefault(),e(this).parent().toggleClass("ui-state-disabled",n.options.syncStart).parent().removeClass("ui-state-hover"),n.options.syncStart=!n.options.syncStart,n.autoSync(n.options.syncStart?null:"stop"))}).on("ready",function(){e(this).parent().toggleClass("ui-state-disabled",!n.options.syncStart).css("pointer-events","auto")})})}),this.exec=function(){var t=this.fm;if(!n){var i=t.sync(),a=setTimeout(function(){t.notify({type:"reload",cnt:1,hideCnt:!0}),i.always(function(){t.notify({type:"reload",cnt:-1})})},t.notifyDelay);return i.always(function(){clearTimeout(a),t.trigger("reload")})}e("div.elfinder-toolbar > div."+t.res("class","searchbtn")+" > span.ui-icon-search").click()}}).prototype={forceLoad:!0},i.prototype.commands.rename=function(){"use strict";this.alwaysEnabled=!0,this.syncTitleOnChange=!0;var t=this,n=t.fm,i=function(t,i,a,o){var r,s=i?[a.hash].concat(i):[a.hash],l=s.length,c={};if(n.lockfiles({files:s}),n.isRoot(a)&&!a.netkey){if((r=n.storage("rootNames"))||(r={}),""===o){if(!r[a.hash])return t&&t.reject(),void n.unlockfiles({files:s}).trigger("selectfiles",{files:s});a.name=a._name,a.i18=a._i18,delete r[a.hash],delete a._name,delete a._i18}else"undefined"==typeof a._name&&(a._name=a.name,a._i18=a.i18),a.name=r[a.hash]=o,delete a.i18;return n.storage("rootNames",r),c={changed:[a]},n.updateCache(c),n.change(c),t&&t.resolve(c),void n.unlockfiles({files:s}).trigger("selectfiles",{files:s})}c={cmd:"rename",name:o,target:a.hash},l>1&&(c.targets=i,o.match(/\*/)&&(c.q=o)),n.request({data:c,notify:{type:"rename",cnt:l},navigate:{}}).fail(function(e){var i=n.parseError(e);t&&t.reject(),i&&Array.isArray(i)&&"errRename"===i[0]||n.sync()}).done(function(i){var r;i.added&&i.added.length&&1===l&&(i.undo={cmd:"rename",callback:function(){return n.request({data:{cmd:"rename",target:i.added[0].hash,name:a.name},notify:{type:"undo",cnt:1}})}},i.redo={cmd:"rename",callback:function(){return n.request({data:{cmd:"rename",target:a.hash,name:o},notify:{type:"rename",cnt:1}})}}),t&&t.resolve(i),(r=n.cwd().hash)&&r!==a.hash||n.exec("open",e.map(i.added,function(e){return"directory"===e.mime?e.hash:null})[0])}).always(function(){n.unlockfiles({files:s}).trigger("selectfiles",{files:s})})},a=function(e,t){var i,a,o,r=t||n.selected(),s=n.splitFileExtention(e),l=n.file(r[0]),c=n.file(r[1]); -return i=s[1]?"."+s[1]:"",s[1]&&"*"===s[0]?(a='"'+n.splitFileExtention(l.name)[0]+i+'", ',a+='"'+n.splitFileExtention(c.name)[0]+i+'"'):s[0].length>1&&("*"===s[0].substr(-1)?(o=s[0].substr(0,s[0].length-1),a='"'+o+l.name+'", ',a+='"'+o+c.name+'"'):"*"===s[0].substr(0,1)&&(o=s[0].substr(1),a='"'+n.splitFileExtention(l.name)[0]+o+i+'", ',a+='"'+n.splitFileExtention(c.name)[0]+o+i+'"')),a||(a='"'+s[0]+"1"+i+'", "'+s[0]+"2"+i+'"'),r.length>2&&(a+=" ..."),a},o=function(){var o,r=n.selected(),s='',l=function(t,i){return e('").prepend(t)},c=e(''),d=e(s),p=e(s),u=e(s),h=e(s),f=e("
          ").append(l(d,"plusNumber"),l(p,"asPrefix"),l(u,"asSuffix"),l(h,"changeExtention")),m=e('
          '),g=e('
          ').append(e('
          ').append(c),e('
          ').append(f),m),v={title:n.i18n("batchRename"),modal:!0,destroyOnClose:!0,width:Math.min(380,n.getUI().width()-20),buttons:{},open:function(){c.on("input",y).trigger("focus")}},b=function(){var e=c.val(),t=n.splitFileExtention(n.file(r[0]).name)[1];return(""!==e||d.is(":checked"))&&(p.is(":checked")?e+="*":u.is(":checked")?e="*"+e+"."+t:h.is(":checked")?e="*."+e:t&&(e+="."+t)),e},y=function(){var e=b();""!==e?m.html(n.i18n(["renameMultiple",r.length,a(e)])):m.empty()},w=f.find("input:radio").on("change",y);v.buttons[n.i18n("btnApply")]=function(){var e,t,a=b();""!==a&&(o.elfinderdialog("close"),t=r,e=n.file(t.shift()),i(void 0,t,e,a))},v.buttons[n.i18n("btnCancel")]=function(){o.elfinderdialog("close")},e.fn.checkboxradio?w.checkboxradio({create:function(e,t){this===d.get(0)&&d.prop("checked",!0).change()}}):f.buttonset({create:function(e,t){d.prop("checked",!0).change()}}),o=t.fmDialog(g,v)};this.noChangeDirOnRemovedCwd=!0,this.shortcuts=[{pattern:"f2"+("mac"==n.OS?" enter":"")},{pattern:"shift+f2",description:"batchRename",callback:function(){n.selected().length>1&&o()}}],this.getstate=function(i){var a,r,s,l,c,d,p=this.files(i),u=p.length;return u?(u>1&&p[0].phash&&(a=p[0].phash,r=n.splitFileExtention(p[0].name)[1].toLowerCase(),s=p[0].mime),1===u&&(d=n.isRoot(p[0])),c=1===u&&(n.cookieEnabled&&d||!p[0].locked)||n.api>2.103&&u===e.grep(p,function(e){return!(l||e.locked||e.phash!==a||n.isRoot(e)||s!==e.mime&&r!==n.splitFileExtention(e.name)[1].toLowerCase())||(l&&(l=!0),!1)}).length?0:-1,!d&&0===c&&n.option("disabledFlip",p[0].hash).rename&&(c=-1),c!==-1&&u>1?t.extra={icon:"preference",node:e("").attr({title:n.i18n("batchRename")}).on("click touchstart",function(e){"touchstart"===e.type&&e.originalEvent.touches.length>1||(e.stopPropagation(),e.preventDefault(),n.getUI().trigger("click"),o())})}:delete t.extra,c):-1},this.exec=function(t,o){var r,s=(n.getUI("cwd"),t||!!n.selected().length&&n.selected()||[n.cwd().hash]),l=s.length,c=n.file(s.shift()),d=".elfinder-cwd-filename",p=o||{},u=n.cwd().hash==c.hash,h="navbar"===p._currentType||"files"===p._currentType?p._currentType:u?"navbar":"files",f="files"!==h,m=n[f?"navHash2Elm":"cwdHash2Elm"](c.hash),g=!f&&"list"!=n.storage("view"),v=function(){requestAnimationFrame(function(){x&&x.trigger("blur")})},b=function(){T.is(":hidden")||T.elfinderoverlay("hide").off("click close",A),z.removeClass("ui-front").css("position","").off("unselect."+n.namespace,v),g?C&&C.css("max-height",""):f||z.css("width","").parent("td").css("overflow","")},y=e.Deferred().fail(function(e){var t=x.parent(),i=n.escape(c.i18||c.name);x.off(),g&&(i=i.replace(/([_.])/g,"​$1")),requestAnimationFrame(function(){f?x.replaceWith(i):t.length?(x.remove(),t.html(i)):m.find(d).html(i)}),e&&n.error(e)}).always(function(){b(),n.unbind("resize",j),n.enable()}),w=function(t){var o=e.trim(x.val()),r=(n.splitFileExtention(o),!0),d=function(){x.off(),b(),f?x.replaceWith(n.escape(o)):C.html(n.escape(o)),i(y,s,c,o)};if(T.is(":hidden")||z.css("z-index",""),""===o){if(!n.isRoot(c))return A();f?x.replaceWith(n.escape(c.name)):C.html(n.escape(c.name))}if(!S&&z.length){if(x.off("blur"),1===l&&o===c.name)return y.reject();if(n.options.validName&&n.options.validName.test)try{r=n.options.validName.test(o)}catch(t){r=!1}if("."===o||".."===o||!r)return S=!0,n.error("directory"===c.mime?"errInvDirname":"errInvName",{modal:!0,close:function(){setTimeout(k,120)}}),!1;if(1===l&&n.fileByName(o,c.phash))return S=!0,n.error(["errExists",o],{modal:!0,close:function(){setTimeout(k,120)}}),!1;1===l?d():(n.confirm({title:"cmdrename",text:["renameMultiple",l,a(o,[c.hash].concat(s))],accept:{label:"btnYes",callback:d},cancel:{label:"btnCancel",callback:function(){setTimeout(function(){S=!0,k()},120)}}}),setTimeout(function(){n.trigger("unselectfiles",{files:n.selected()}).trigger("selectfiles",{files:[c.hash].concat(s)})},120))}},x=e(g?"":'').on("keyup text",function(){g?(this.style.height="1px",this.style.height=this.scrollHeight+"px"):r&&(this.style.width=r+"px",this.scrollWidth>r&&(this.style.width=this.scrollWidth+10+"px"))}).on("keydown",function(t){t.stopImmediatePropagation(),t.keyCode==e.ui.keyCode.ESCAPE?y.reject():t.keyCode==e.ui.keyCode.ENTER&&(t.preventDefault(),x.trigger("blur"))}).on("mousedown click dblclick",function(e){e.stopPropagation(),"dblclick"===e.type&&e.preventDefault()}).on("blur",w).on("dragenter dragleave dragover drop",function(e){e.stopPropagation()}),k=function(){var e=n.splitFileExtention(x.val())[0];S||!n.UA.Mobile||n.UA.iOS||(T.on("click close",A).elfinderoverlay("show"),z.css("z-index",T.css("z-index")+1)),!n.enabled()&&n.enable(),S&&(S=!1,x.on("blur",w)),x.trigger("focus").trigger("select"),x[0].setSelectionRange&&x[0].setSelectionRange(0,e.length)},C=f?m.contents().filter(function(){return 3==this.nodeType&&e(this).parent().attr("id")===n.navHash2Id(c.hash)}):m.find(d),z=C.parent(),T=n.getUI("overlay"),A=function(e){T.is(":hidden")||z.css("z-index",""),S||(y.reject(),e&&(e.stopPropagation(),e.preventDefault()))},j=function(){m.trigger("scrolltoview",{blink:!1})},S=!1;return z.addClass("ui-front").css("position","relative").on("unselect."+n.namespace,v),n.bind("resize",j),f?C.replaceWith(x.val(c.name)):(g?C.css("max-height","none"):f||(r=z.width(),z.width(r-15).parent("td").css("overflow","visible")),C.empty().append(x.val(c.name))),l>1&&n.api<=2.103?y.reject():c&&C.length?c.locked&&!n.isRoot(c)?y.reject(["errLocked",c.name]):(n.one("select",function(){x.parent().length&&c&&e.inArray(c.hash,n.selected())===-1&&x.trigger("blur")}),x.trigger("keyup"),k(),y):y.reject("errCmdParams",this.title)},n.bind("select contextmenucreate closecontextmenu",function(e){var i,a=(e.data?e.data.selected||e.data.targets:null)||n.selected();a&&1===a.length&&(i=n.file(a[0]))&&n.isRoot(i)?t.title=n.i18n("kindAlias")+" ("+n.i18n("preference")+")":t.title=n.i18n("cmdrename"),"closecontextmenu"!==e.type?t.update(void 0,t.title):requestAnimationFrame(function(){t.update(void 0,t.title)})}).remove(function(t){var i;t.data&&t.data.removed&&(i=n.storage("rootNames"))&&(e.each(t.data.removed,function(e,t){i[t]&&delete i[t]}),n.storage("rootNames",i))})},i.prototype.commands.resize=function(){"use strict";var t=this.fm,n=0,i=function(t,n,i){var a=[{x:t/2,y:n/2},{x:-t/2,y:n/2},{x:-t/2,y:-n/2},{x:t/2,y:-n/2}],o=[],r={x:Number.MAX_VALUE,y:Number.MAX_VALUE},s={x:Number.MIN_VALUE,y:Number.MIN_VALUE};return e.each(a,function(e,t){o.push({x:t.x*Math.cos(i)-t.y*Math.sin(i),y:t.x*Math.sin(i)+t.y*Math.cos(i)})}),e.each(o,function(e,t){r.x=Math.min(r.x,t.x),r.y=Math.min(r.y,t.y),s.x=Math.max(s.x,t.x),s.y=Math.max(s.y,t.y)}),{width:s.x-r.x,height:s.y-r.y}};this.updateOnSelect=!1,this.getstate=function(){var e=t.selectedFiles();return 1==e.length&&e[0].read&&e[0].write&&e[0].mime.indexOf("image/")!==-1?0:-1},this.resizeRequest=function(n,i,a){var o=i||t.file(n.target),r=(o?o.tmb:null,t.isCommandEnabled("resize",n.target));if(r&&(!o||o&&o.read&&o.write&&o.mime.indexOf("image/")!==-1))return t.request({data:Object.assign(n,{cmd:"resize"}),notify:{type:"resize",cnt:1}}).fail(function(e){a&&a.reject(e)}).done(function(){n.quality&&t.storage("jpgQuality",n.quality===t.option("jpgQuality")?null:n.quality),a&&a.resolve()});var s;return s=o?o.mime.indexOf("image/")===-1?["errResize",o.name,"errUsupportType"]:["errResize",o.name,"errPerm"]:["errResize",n.target,"errPerm"],a?a.reject(s):t.error(s),e.Deferred().reject(s)},this.exec=function(a){var o,r,s,l,c=this,d=this.files(a),p=e.Deferred(),u=t.api>1,h=this.options,f=650,m=t.getUI(),g=e().controlgroup?"controlgroup":"buttonset",v="undefined"==typeof h.grid8px||"disable"!==h.grid8px,b=Array.isArray(h.presetSize)?h.presetSize:[],y="elfinder-dialog-active",w=t.res("class","editing"),x=function(a,o,r){var d,x,k,C,z,T="image/jpeg"===a.mime,A=e('
          '),j='',S='
          ',O='
          ',I=null,M=!1,E=function(){M=!0},F=function(){M&&(M=!1,D.trigger("change"))},D=e('
          ').on("focus","input[type=text],input[type=number]",function(){e(this).trigger("select")}).on("change",function(){I&&cancelAnimationFrame(I),I=requestAnimationFrame(function(){var e,n,a,o,r,s,c,d,p,u,h,f;at&&!M&&(a=at.data("canvas"))&&(e=D.children("div.elfinder-resize-control-panel:visible"),n=e.find("input.elfinder-resize-quality"),n.is(":visible")&&(o=at.data("ctx"),r=at.get(0),e.hasClass("elfinder-resize-uiresize")?(d=a.width=X.val(),p=a.height=J.val(),o.drawImage(r,0,0,d,p)):e.hasClass("elfinder-resize-uicrop")?(s=G.val(),c=Y.val(),d=Q.val(),p=Z.val(),a.width=d,a.height=p,o.drawImage(r,s,c,d,p,0,0,d,p)):(u=te.val(),h=te.val()*Math.PI/180,f=i(fe,me,h),d=a.width=f.width,p=a.height=f.height,o.save(),u%90!==0&&(o.fillStyle=de.val()||"#FFF",o.fillRect(0,0,d,p)),o.translate(d/2,p/2),o.rotate(h),o.drawImage(r,-r.width/2,-r.height/2,fe,me),o.restore()),a.toBlob(function(e){e&&(l=e.size,n.next("span").text(" ("+t.formatSize(e.size)+")"))},"image/jpeg",Math.max(Math.min(n.val(),100),1)/100)))})}).on("mouseup","input",function(t){e(t.target).trigger("change")}),U=e('
          ').on("touchmove",function(t){e(t.target).hasClass("touch-punch")&&(t.stopPropagation(),t.preventDefault())}),P=e('
          '+t.i18n("ntfloadimg")+"
          "),q=e('
          '),R=e('
          '),H=e('
          '),_=e('
          '),N=e('
          '),L=e("").attr("title",t.i18n("rotate-cw")).append(e('')),W=e("").attr("title",t.i18n("rotate-ccw")).append(e('')),B=e(""),$=e('").on("mouseenter mouseleave",function(t){e(this).toggleClass("ui-state-hover","mouseenter"==t.type)}).on("click",function(){d.exec("open",f).done(function(){d.one("opendone",function(){d.trigger("selectfiles",{files:e.map(t.added,function(e){return e.hash})})})})})):d.trigger("selectfiles",{files:e.map(t.added,function(e){return e.hash})}),d.toast({msg:d.i18n(["complete",d.i18n("cmdupload")]),extNode:n}))}}).progress(function(){w.notifyWith(this,Array.from(arguments))})},v=function(e){i.elfinderdialog("close"),h&&(e.target=h[0]),g(e)},b=function(){var t=m.hash,n=e.map(d.files(t),function(e){return"directory"===e.mime&&e.write?e:null});return n.length?e('
          ').on("click",function(t){t.stopPropagation(),t.preventDefault(),n=d.sortFiles(n);var a=e(this),o=(d.cwd(),i.closest("div.ui-dialog")),r=function(e,t){return{label:d.escape(e.i18||e.name),icon:t,remain:!1,callback:function(){var t=o.children(".ui-dialog-titlebar:first").find("span.elfinder-upload-target");h=[e.hash],t.html(" - "+d.escape(e.i18||e.name)),a.trigger("focus")},options:{className:h&&h.length&&e.hash===h[0]?"ui-state-active":"",iconClass:e.csscls||"",iconImg:e.icon||""}}},s=[r(m,"opendir"),"|"];e.each(n,function(e,t){s.push(r(t,"dir"))}),a.trigger("blur"),d.trigger("contextmenu",{raw:s,x:t.pageX||e(this).offset().left,y:t.pageY||e(this).offset().top,prevNode:o,fitHeight:!0})}).append(''):e()},y=function(n,i){var a=e('").on("click",function(){d.UA.IE&&setTimeout(function(){o.css("display","none").css("position","relative"),requestAnimationFrame(function(){o.css("display","").css("position","")})},100)}).on("change",function(){v({input:a.get(0),type:"files"})}).on("dragover",function(e){e.originalEvent.dataTransfer.dropEffect="copy"}),o=e("
          ").append(a).on("click",function(e){e.stopPropagation()});return e('
          '+d.i18n(i)+"
          ").append(o).on("click",function(e){e.stopPropagation(),e.preventDefault(),a.trigger("click")}).on("mouseenter mouseleave",function(n){e(this).toggleClass(t,"mouseenter"===n.type)})},w=e.Deferred();return r=function(t){t.stopPropagation(),t.preventDefault();var n,i=!1,a="",o=null,r="",s=null,l=t._target||null,c=t.dataTransfer||null,p="";if(c){c.types&&c.types.length&&e.inArray("Files",c.types)!==-1?p="file":c.items&&c.items.length&&c.items[0].kind&&(p=c.items[0].kind);try{if(o=c.getData("elfinderfrom"),o&&(r=window.location.href+d.cwd().hash,!l&&o===r||l===r))return void w.reject()}catch(t){}if("file"===p&&(c.items[0].getAsEntry||c.items[0].webkitGetAsEntry))i=c,a="data";else if("string"!==p&&c.files&&c.files.length&&e.inArray("Text",c.types)===-1)i=c.files,a="files";else{try{(s=c.getData("text/html"))&&s.match(/<(?:img|a)/i)&&(i=[s],a="html")}catch(t){}i||((s=c.getData("text"))?(i=[s],a="text"):c&&c.files&&(p="file"))}}i?g({files:i,type:a,target:l,dropEvt:t}):(n=["errUploadNoFiles"],"file"===p&&n.push("errFolderUpload"),d.error(n),w.reject())},!h&&n?(n.input||n.files?(n.type="files",g(n)):n.dropEvt&&r(n.dropEvt),w):(s=function(t){var n,i=t.originalEvent||t,a=[],o=[];if(i.clipboardData){if(i.clipboardData.items&&i.clipboardData.items.length){o=i.clipboardData.items;for(var r=0;r
          ').append(y("multiple","selectForUpload")),!d.UA.Mobile&&function(e){return"undefined"!=typeof e.webkitdirectory||"undefined"!=typeof e.directory}(document.createElement("input"))&&i.append(y("multiple webkitdirectory directory","selectFolder")),m.dirs&&(m.hash===p||d.navHash2Elm(m.hash).hasClass("elfinder-subtree-loaded")?b().appendTo(i):(l=e('
          ').append('').appendTo(i),d.request({cmd:"tree",target:m.hash}).done(function(){d.one("treedone",function(){l.replaceWith(b()),c.elfinderdialog("tabstopsInit")})}).fail(function(){l.remove()}))),d.dragUpload?a=e('
          ').on("paste",function(e){s(e)}).on("mousedown click",function(){e(this).trigger("focus")}).on("focus",function(){this.innerHTML=""}).on("mouseover",function(){e(this).addClass(t)}).on("mouseout",function(){e(this).removeClass(t)}).on("dragenter",function(n){n.stopPropagation(),n.preventDefault(),e(this).addClass(t)}).on("dragleave",function(n){n.stopPropagation(),n.preventDefault(),e(this).removeClass(t)}).on("dragover",function(n){n.stopPropagation(),n.preventDefault(),n.originalEvent.dataTransfer.dropEffect="copy",e(this).addClass(t)}).on("drop",function(e){i.elfinderdialog("close"),h&&(e.originalEvent._target=h[0]),r(e.originalEvent)}).prependTo(i).after('
          '+d.i18n("or")+"
          ")[0]:o=e('
          '+d.i18n("dropFilesBrowser")+"
          ").on("paste drop",function(e){s(e)}).on("mousedown click",function(){e(this).trigger("focus")}).on("focus",function(){this.innerHTML=""}).on("dragenter mouseover",function(){e(this).addClass(t)}).on("dragleave mouseout",function(){e(this).removeClass(t)}).prependTo(i).after('
          '+d.i18n("or")+"
          ")[0],c=this.fmDialog(i,{title:this.title+''+(m?" - "+d.escape(m.i18||m.name):"")+"",modal:!0,resizable:!1,destroyOnClose:!0,propagationEvents:["mousemove","mouseup","click"],close:function(){var e=d.getUI("contextmenu");e.is(":visible")&&e.click()}}),w)}},i.prototype.commands.view=function(){"use strict";var t,n=this,i=this.fm;this.value=i.viewType,this.alwaysEnabled=!0,this.updateOnSelect=!1,this.options={ui:"viewbutton"},this.getstate=function(){return 0},this.extra={icon:"menu",node:e("").attr({title:i.i18n("viewtype")}).on("click touchstart",function(t){if(!("touchstart"===t.type&&t.originalEvent.touches.length>1)){var n=e(this);t.stopPropagation(),t.preventDefault(),i.trigger("contextmenu",{raw:getSubMenuRaw(),x:n.offset().left,y:n.offset().top})}})},this.exec=function(){var e=this,t="list"==this.value?"icons":"list";return i.storage("view",t),i.lazy(function(){i.viewchange(),e.update(void 0,t),this.resolve()})},i.bind("init",function(){t=function(){var e,t=i.getUI("cwd"),a=[],o=i.options.uiOptions.cwd.iconsView.sizeNames,r=i.options.uiOptions.cwd.iconsView.sizeMax;for(e=0;e<=r;e++)a.push({label:i.i18n(o[e]||"Size-"+e+" icons"),icon:"view",callback:function(e){return function(){t.trigger("iconpref",{size:e}),i.storage("iconsize",e),"list"===n.value&&n.exec()}}(e)});return a.push("|"),a.push({label:i.i18n("viewlist"),icon:"view-list",callback:function(){"list"!==n.value&&n.exec()}}),a}()}).bind("contextmenucreate",function(){n.extra={icon:"menu",node:e("").attr({title:i.i18n("cmdview")}).on("click touchstart",function(a){if(!("touchstart"===a.type&&a.originalEvent.touches.length>1)){var o,r,s=e(this);t.concat();for(o="list"===n.value?t.length-1:parseInt(i.storage("iconsize")||0),r=0;r
          ").append(m.contents()).attr("class",m.attr("class")||"").attr("style",m.attr("style")||""),b=m.attr("id")||m.attr("id","elfauto"+e(".elfinder").length).attr("id"),y="elfinder-"+b,w="mousedown."+y,x="keydown."+y,k="keypress."+y,C="keyup."+y,z=!1,T=!1,A=["enable","disable","load","open","reload","select","add","remove","change","dblclick","getfile","lockfiles","unlockfiles","selectfiles","unselectfiles","dragstart","dragstop","search","searchend","viewchange"],j="",S={path:"",url:"",tmbUrl:"",disabled:[],separator:"/",archives:[],extract:[],copyOverwrite:!0,uploadOverwrite:!0,uploadMaxSize:0,jpgQuality:100,tmbCrop:!1,tmbReqCustomData:!1,tmb:!1},O={},I={},M={},E={},F=[],D={},U={},P=[],q={},R=[],H=[],_=new u.command(u),N="auto",L=400,W=null,B="sounds/",$="",V=!1,K=e(document.createElement("audio")).hide().appendTo("body")[0],X=0,J="",G=null,Y=function(t){var n,i,a,o,r,s,l,c,d={},p={};u.api>=2.1?(u.commandMap=t.options.uiCmdMap&&Object.keys(t.options.uiCmdMap).length?t.options.uiCmdMap:{},J!==JSON.stringify(u.commandMap)&&(J=JSON.stringify(u.commandMap))):u.options.sync=0,t.init?(I={},E={}):(s=j,n="elfinder-subtree-loaded "+u.res("class","navexpand"),r=u.res("class","navcollapse"),i=Object.keys(I),a=function(e){if(!I[e])return!0;var t="directory"===I[e].mime,i=I[e].phash;!(!t||d[i]||!p[i]&&u.navHash2Elm(I[e].hash).is(":hidden")&&u.navHash2Elm(i).next(".elfinder-navbar-subtree").children().length>100)||!t&&i===j||q[e]?t&&(p[i]=!0):(t&&!d[i]&&(d[i]=!0,u.navHash2Elm(i).removeClass(n).next(".elfinder-navbar-subtree").empty()),ee(I[e]))},o=function(){i.length&&(G&&G._abort(),G=u.asyncJob(a,i,{interval:20,numPerOnce:100}).done(function(){var t=u.storage("hide")||{items:{}};Object.keys(M).length&&e.each(M,function(e){t.items[e]||delete M[e]})}))},u.trigger("filesgc").one("filesgc",function(){i=[]}),u.one("opendone",function(){s!==j&&(m.data("lazycnt")?u.one("lazydone",o):o())})),u.sorters={},j=t.cwd.hash,Q(t.files),I[j]?(c=u.diff([t.cwd],!0),c.changed.length&&(Q(c.changed,"change"),u.change({changed:c.changed}))):Q([t.cwd]),t.changed&&t.changed.length&&Q(t.changed,"change"),l=JSON.stringify(u.sorters),$!==l&&(u.trigger("sorterupdate"),$=l),u.lastDir(j),u.autoSync()},Q=function(t,n){var i,a,o,r,s,n=n||"files",l=["sizeInfo","encoding"],c={name:!0,perm:!0,date:!0,size:!0,kind:!0},d=!u.sorters._checked&&"files"===n,p=t.length,h=function(t){var n=t||{},i=[];e.each(u.sortRules,function(e){(c[e]||"undefined"!=typeof n[e]||"mode"===e&&"undefined"!=typeof n.perm)&&i.push(e)}),u.sorters=u.arrayFlip(i,!0),u.sorters._checked=!0},f={},m=u.storage("hide")||{},g=m.items||{};for(a=0;a-1&&o.splice(r,1));return n=null,this},this.trigger=function(t,n,i){var a,o,r,s,l=t.toLowerCase(),c="object"==typeof n,d=D[l]||[],p=[];if(this.debug("event-"+l,n),c&&"undefined"!=typeof i||(i=!0),o=d.length){for(s=e.Event(l),n&&(n._getEvent=function(){return s}),i&&(s.data=n),a=0;a script").each(function(){if(this.src&&this.src.match(/js\/elfinder(?:-[a-z0-9_-]+)?\.(?:min|full)\.js(?:$|\?)/i))return t=e(this),!1}),t&&(i=t.attr("src").replace(/js\/[^\/]+$/,""),i.match(/^(https?\/\/|\/)/)||(n=e("head > base[href]").attr("href"))&&(i=n.replace(/\/$/,"")+"/"+i)),""!==i?u.options.baseUrl=i:(u.options.baseUrl||(u.options.baseUrl="./"),i=u.options.baseUrl),i)}(),this.i18nBaseUrl=(this.options.i18nBaseUrl||this.baseUrl+"js/i18n").replace(/\/$/,"")+"/",this.workerBaseUrl=(this.options.workerBaseUrl||this.baseUrl+"js/worker").replace(/\/$/,"")+"/",this.options.maxErrorDialogs=Math.max(1,parseInt(this.options.maxErrorDialogs||5)),S.dispInlineRegex=this.options.dispInlineRegex,this.options.cssAutoLoad&&!function(){var t=u.baseUrl,n=e('head > link[href$="css/elfinder.min.css"],link[href$="css/elfinder.full.css"]:first').length,i=function(){m.data("cssautoloadHide")&&(m.data("cssautoloadHide").remove(),m.removeData("cssautoloadHide"))},a=function(){u.cssloaded||(i(),u.cssloaded=!0,u.trigger("cssloaded"))};n||(u.cssloaded=null),Array.isArray(u.options.cssAutoLoad)&&(u.options.themes["default"]?u.cssloaded===!0?u.loadCss(u.options.cssAutoLoad):u.bind("cssloaded",function(){u.loadCss(u.options.cssAutoLoad)}):(u.options.themes=Object.assign({"default":{name:"default",cssurls:u.options.cssAutoLoad}},u.options.themes),u.options.theme||(u.options.theme="default"))),null===u.cssloaded&&(m.addClass("elfinder").data("cssautoloadHide",e("")),e("head").append(m.data("cssautoloadHide")),u.options.themes["default"]||(u.options.themes=Object.assign({"default":{name:"default",cssurls:"css/theme.css",author:"elFinder Project",license:"3-clauses BSD"}},u.options.themes),u.options.theme||(u.options.theme="default")),requestAnimationFrame(function(){"hidden"===m.css("visibility")?u.loadCss([t+"css/elfinder.min.css"],{dfd:e.Deferred().done(function(){a()}).fail(function(){i(),u.cssloaded||(u.cssloaded=!1,u.bind("init",function(){u.cssloaded||u.error(["errRead","CSS (elfinder.min)"])}))})}):a()}))}(),function(){var e,t=u.options.themes,n=Object.keys(t||{});n.length&&(e=u.storage("theme")||u.options.theme,t[e]||(e=n[0]),u.cssloaded?u.changeTheme(e):u.bind("cssloaded",function(){u.changeTheme(e)}))}(),this.optionProperties={icon:void 0,csscls:void 0,tmbUrl:void 0,uiCmdMap:{},netkey:void 0,disabled:[]},re||this.options.enableAlways||2!==e("body").children().length||(this.options.enableAlways=!0),this.options.debug===!0?this.options.debug="all":Array.isArray(this.options.debug)?!function(){var t={};e.each(u.options.debug,function(){t[this]=!0}),u.options.debug=t}():this.options.debug=!1,this.noConflicts={},this.noConflict=function(){e.each(f,function(t,n){e.fn[n]&&"function"==typeof e.fn[n].noConflict&&(u.noConflicts[n]=e.fn[n].noConflict())})},this.noConflict(),this.isCORS=!1,function(){if("undefined"!=typeof u.options.cors&&null!==u.options.cors)u.isCORS=!!u.options.cors;else{var t,i=document.createElement("a"),a=window.location.protocol,o=function(e){return e=e&&":"!==e?e:a,"https:"===e?/\:443$/:/\:80$/},r=window.location.host.replace(o(a),"");i.href=n.url,n.urlUpload&&n.urlUpload!==n.url&&(t=document.createElement("a"),t.href=n.urlUpload),(r!==i.host.replace(o(i.protocol),"")||":"!==i.protocol&&""!==i.protocol&&a!==i.protocol||t&&(r!==t.host.replace(o(t.protocol),"")||":"!==t.protocol&&""!==t.protocol&&a!==t.protocol))&&(u.isCORS=!0)}u.isCORS&&(e.isPlainObject(u.options.customHeaders)||(u.options.customHeaders={}),e.isPlainObject(u.options.xhrFields)||(u.options.xhrFields={}),u.options.requestType="post",u.options.customHeaders["X-Requested-With"]="XMLHttpRequest",u.options.xhrFields.withCredentials=!0)}(),this.requestType=/^(get|post)$/i.test(this.options.requestType)?this.options.requestType.toLowerCase():"get",s=Math.max(parseInt(this.options.requestMaxConn),1),this.optsCustomData=e.isPlainObject(this.options.customData)?this.options.customData:{},this.customData=Object.assign({},this.optsCustomData),this.prevCustomData=null,this.customHeaders=e.isPlainObject(this.options.customHeaders)?this.options.customHeaders:{},this.xhrFields=e.isPlainObject(this.options.xhrFields)?this.options.xhrFields:{},this.replaceXhrSend=function(){p||(p=XMLHttpRequest.prototype.send),XMLHttpRequest.prototype.send=function(){var t=this;return u.customHeaders&&e.each(u.customHeaders,function(e){t.setRequestHeader(e,this)}),u.xhrFields&&e.each(u.xhrFields,function(e){e in t&&(t[e]=this)}),p.apply(this,arguments)}},this.restoreXhrSend=function(){p&&(XMLHttpRequest.prototype.send=p)},this.abortCmdsOnOpen=this.options.abortCmdsOnOpen||["tmb","parents"],this.navPrefix="nav"+(i.prototype.uniqueid?i.prototype.uniqueid:"")+"-",this.cwdPrefix=i.prototype.uniqueid?"cwd"+i.prototype.uniqueid+"-":"",++i.prototype.uniqueid,this.uploadURL=n.urlUpload||n.url,this.namespace=y,this.today=new Date(oe.getFullYear(),oe.getMonth(),oe.getDate()).getTime()/1e3,this.yesterday=this.today-86400,l=this.options.UTCDate?"UTC":"",this.getHours="get"+l+"Hours",this.getMinutes="get"+l+"Minutes",this.getSeconds="get"+l+"Seconds",this.getDate="get"+l+"Date",this.getDay="get"+l+"Day",this.getMonth="get"+l+"Month",this.getFullYear="get"+l+"FullYear",this.zIndex,this.searchStatus={state:0,query:"",target:"",mime:"",mixed:!1,ininc:!1},this.lang=this.storage("lang")||this.options.lang,"jp"===this.lang&&(this.lang=this.options.lang="ja"),this.viewType=this.storage("view")||this.options.defaultView||"icons",this.sortType=this.storage("sortType")||this.options.sortType||"name",this.sortOrder=this.storage("sortOrder")||this.options.sortOrder||"asc",this.sortStickFolders=this.storage("sortStickFolders"),null===this.sortStickFolders?this.sortStickFolders=!!this.options.sortStickFolders:this.sortStickFolders=!!this.sortStickFolders,this.sortAlsoTreeview=this.storage("sortAlsoTreeview"),null===this.sortAlsoTreeview||null===this.options.sortAlsoTreeview?this.sortAlsoTreeview=!!this.options.sortAlsoTreeview:this.sortAlsoTreeview=!!this.sortAlsoTreeview,this.sortRules=e.extend(!0,{},this._sortRules,this.options.sortRules),e.each(this.sortRules,function(e,t){"function"!=typeof t&&delete u.sortRules[e]}),this.compare=e.proxy(this.compare,this),this.notifyDelay=this.options.notifyDelay>0?parseInt(this.options.notifyDelay):500,this.draggingUiHelper=null,this.droppable={greedy:!0,tolerance:"pointer",accept:".elfinder-cwd-file-wrapper,.elfinder-navbar-dir,.elfinder-cwd-file,.elfinder-cwd-filename",hoverClass:this.res("class","adroppable"),classes:{"ui-droppable-hover":this.res("class","adroppable")},autoDisable:!0,drop:function(t,n){var i,a,o,r=e(this),s=e.grep(n.helper.data("files")||[],function(e){return!!e}),l=[],c=[],d=[],p=n.helper.hasClass("elfinder-drag-helper-plus"),h="class";if("undefined"==typeof t.button||n.helper.data("namespace")!==y||!u.insideWorkzone(t.pageX,t.pageY))return!1;for(a=r.hasClass(u.res(h,"cwdfile"))?u.cwdId2Hash(r.attr("id")):r.hasClass(u.res(h,"navdir"))?u.navId2Hash(r.attr("id")):j,i=s.length;i--;)o=s[i],o!=a&&I[o].phash!=a?l.push(o):(p&&o!==a&&I[a].write?c:d).push(o);return!d.length&&(n.helper.data("droped",!0),c.length&&(n.helper.hide(),u.exec("duplicate",c,{_userAction:!0})),void(l.length&&(n.helper.hide(),u.clipboard(l,!p),u.exec("paste",a,{_userAction:!0},a).always(function(){u.clipboard([]),u.trigger("unlockfiles",{files:s})}),u.trigger("drop",{files:s}))))}},this.enabled=function(){return z&&this.visible()},this.visible=function(){return m[0].elfinder&&m.is(":visible")},this.isRoot=function(e){return!(!e.isroot&&e.phash)},this.root=function(t,n){t=t||j;var i,a;if(!n&&(e.each(u.roots,function(e,n){if(0===t.indexOf(e))return i=n,!1}),i))return i;for(i=I[t];i&&i.phash&&(n||!i.isroot);)i=I[i.phash];if(i)return i.hash;for(;a in I&&I.hasOwnProperty(a);)if(i=I[a],"directory"===i.mime&&!i.phash&&i.read)return i.hash;return""},this.cwd=function(){return I[j]||{}},this.option=function(t,n){var i,a;return n=n||j,u.optionsByHashes[n]&&"undefined"!=typeof u.optionsByHashes[n][t]?u.optionsByHashes[n][t]:!u.hasVolOptions||j===n||(a=u.file(n))&&a.phash===j?O[t]||"":(i="",e.each(u.volOptions,function(e,a){if(0===n.indexOf(e))return i=a[t]||"",!1}),i)},this.getDisabledCmds=function(t,n){var i={hidden:!0};return Array.isArray(t)||(t=[t]),e.each(t,function(e,t){var n=u.option("disabledFlip",t);n&&Object.assign(i,n)}),n?i:Object.keys(i)},this.file=function(e,t){return e?I[e]||(t?M[e]:void 0):void 0},this.files=function(t){var n={};return t?E[t]?(e.each(E[t],function(e){I[e]?n[e]=I[e]:delete E[t][e]}),Object.assign({},n)):{}:Object.assign({},I)},this.parents=function(e){for(var t,n=[];e&&(t=this.file(e));)n.unshift(t.hash),e=t.phash;return n},this.path2array=function(e,t){for(var n,i=[];e;){if(!(n=I[e])||!n.hash){i=[];break}i.unshift(t&&n.i18?n.i18:n.name),e=n.isroot?null:n.phash}return i},this.path=function(t,n,i){var a=I[t]&&I[t].path?I[t].path:this.path2array(t,n).join(O.separator);if(i&&I[t]){i=Object.assign({notify:{type:"parents",cnt:1,hideCnt:!0}},i);var o,r=e.Deferred(),s=i.notify,l=!1,c=function(){u.request({data:{cmd:"parents",target:I[t].phash},notify:s,preventFail:!0}).done(d).fail(function(){r.reject()})},d=function(){u.one("parentsdone",function(){a=u.path(t,n),""===a&&l?(l=!1,c()):(s&&(clearTimeout(o),s.cnt=-parseInt(s.cnt||0),u.notify(s)),r.resolve(a))})};return a?r.resolve(a):(u.ui.tree?(s&&(o=setTimeout(function(){u.notify(s)},u.notifyDelay)),l=!0,d(!0)):c(),r)}return a},this.url=function(t,n){var i,a=I[t],o=n||{},r=o.async||!1,s=o.temporary||!1,l=o.onetime&&u.option("onetimeUrl",t)||!1,c=o.absurl||!1,d=r||l?e.Deferred():null,p=function(e){return e&&c&&(e=u.convAbsUrl(e)),e},h=function(n){if(n)return p(n);if(a.url)return p(a.url);if("undefined"==typeof i&&(i=f()),i)return p(i+e.map(u.path2array(t),function(e){return encodeURIComponent(e)}).slice(1).join("/"));var o=Object.assign({},u.customData,{cmd:"file",target:a.hash});return u.oldAPI&&(o.cmd="open",o.current=a.phash),p(u.options.url+(u.options.url.indexOf("?")===-1?"?":"&")+e.param(o,!0))},f=function(){return u.option("url",!u.isRoot(a)&&a.phash||a.hash)};if(!a||!a.read)return r?d.resolve(""):"";if(!l||a.url&&"1"!=a.url||(i=f()))if("1"==a.url||s&&!a.url&&!(i=f()))this.request({data:{cmd:"url",target:t,options:{temporary:s?1:0}},preventDefault:!0,options:{async:r},notify:r?{type:s?"file":"url",cnt:1,hideCnt:!0}:{},progressBar:o.progressBar}).done(function(e){a.url=e.url||""}).fail(function(){a.url=""}).always(function(){var e;return a.url&&s&&(e=a.url,a.url="1"),r?void d.resolve(h(e)):h(e)});else{if(!r)return h();d.resolve(h())}else r=!0,this.request({data:{cmd:"url",target:t,options:{onetime:1}},preventDefault:!0,options:{async:r},notify:{type:"file",cnt:1,hideCnt:!0},progressBar:o.progressBar}).done(function(e){d.resolve(p(e.url||""))}).fail(function(){d.resolve("")});return r?d:void 0},this.forExternalUrl=function(e,t){var n=u.option("onetimeUrl",e),i={async:!0,absurl:!0};return i[n?"onetime":"temporary"]=!0,u.url(e,Object.assign({},t,i))},this.openUrl=function(t,n,i,a){var o=I[t],r="",s=(a||{}).onetimeSize||5242880;return o&&o.read?n&&"sameorigin"!==n||(o.url?1!=o.url&&(r=o.url):O.url&&0===o.hash.indexOf(u.cwd().volumeid)&&(r=O.url+e.map(this.path2array(t),function(e){return encodeURIComponent(e)}).slice(1).join("/")),n&&!this.isSameOrigin(r)||!r)?i&&this.hasParrotHeaders()?(a?delete a.onetimeSize:a={},!a.onetime&&!a.temporary&&o.size>s&&(o.mime.match(/^video|audio/)?a.temporary=!0:a.onetime=!0),a.onetime||a.temporary?this.url(o.hash,Object.assign({async:!0},a)).done(function(e){i(e)}).fail(function(){i("")}):this.getContents(t,"blob",a).done(function(e){r=(window.URL||window.webkitURL).createObjectURL(e),i(r)}).fail(function(){i("")})):(r=this.options.url,r=r+(r.indexOf("?")===-1?"?":"&")+(this.oldAPI?"cmd=open¤t="+o.phash:"cmd=file")+"&target="+o.hash+"&_t="+(o.ts||parseInt(+new Date/1e3)),n===!0&&(r+="&download=1"),e.each(this.customData,function(e,t){r+="&"+encodeURIComponent(e)+"="+encodeURIComponent(t)}),i?void i(r):r):(r+=(r.match(/\?/)?"&":"?")+"_".repeat((r.match(/[\?&](_+)t=/g)||["&t="]).sort().shift().match(/[\?&](_*)t=/)[1].length+1)+"t="+(o.ts||parseInt(+new Date/1e3)),i?void i(r):r):""},this.tmb=function(t){var n,i,a="elfinder-cwd-bgurl",o="",r={},s=0;return!(!e.isPlainObject(t)||(u.searchStatus.state&&0!==t.hash.indexOf(u.cwd().volumeid)?(n=u.option("tmbUrl",t.hash),i=u.option("tmbCrop",t.hash)):(n=O.tmbUrl,i=O.tmbCrop),i&&(a+=" elfinder-cwd-bgurl-crop"),"self"===n&&0===t.mime.indexOf("image/")?(o=u.openUrl(t.hash),a+=" elfinder-cwd-bgself"):(u.oldAPI||n)&&t&&t.tmb&&1!=t.tmb?o=n+t.tmb:u.newAPI&&t&&t.tmb&&1!=t.tmb&&(o=t.tmb),!o))&&("self"!==n&&(t.ts&&(r._t=t.ts),O.tmbReqCustomData&&Object.keys(this.customData).length&&(r=Object.assign(r,this.customData)),Object.keys(r).length&&(o+=o.match(/\?/)?"&":"?",e.each(r,function(e,t){o+=(0===s++?"":"&")+encodeURIComponent(e)+"="+encodeURIComponent(t)}))),{url:o,className:a})},this.selected=function(){return F.slice(0)},this.selectedFiles=function(){return e.map(F,function(e){return I[e]?Object.assign({},I[e]):null})},this.fileByName=function(e,t){var n;for(n in I)if(I.hasOwnProperty(n)&&I[n].phash==t&&I[n].name==e)return I[n]},this.validResponse=function(e,t){return t.error||this.rules[this.rules[e]?e:"defaults"](t)},this.returnBytes=function(e){var t;return isNaN(e)?(e||(e=""),e=e.replace(/b$/i,""),t=e.charAt(e.length-1).toLowerCase(),e=e.replace(/[tgmk]$/i,""),"t"==t?e=1024*e*1024*1024*1024:"g"==t?e=1024*e*1024*1024:"m"==t?e=1024*e*1024:"k"==t&&(e=1024*e),e=isNaN(e)?0:parseInt(e)):(e=parseInt(e),e<1&&(e=0)),e},this.request=function(t){var n,i,a,o,r=this,l=this.options,c=e.Deferred(),d=(+new Date).toString(16)+Math.floor(1e3*Math.random()).toString(16),p=Object.assign({},r.customData,{mimes:l.onlyMimes},t.data||t),u=p.cmd,h="binary"===(t.options||{}).dataType,f=!t.asNotOpen&&"open"===u,m=!(h||t.preventDefault||t.preventFail),g=!(h||t.preventDefault||t.preventDone),v=t.progressVal||20,b=null,y=!1,w=t.progressBar?{}:t.notify?Object.assign({progress:v*t.notify.cnt},t.notify):{},x=!!t.cancel,k=h||!!t.raw,C=t.syncOnFail,z=!!t.lazy,T=t.prepare,A=t.navigate,I=(t.options||{}).cache,M=Object.assign({url:l.url,async:!0,type:this.requestType,dataType:"json",cache:r.api>=2.1029,data:p,headers:this.customHeaders,xhrFields:this.xhrFields,progress:function(e){var n=e.loaded/e.total*100;if(b&&clearTimeout(b),t.progressBar)try{t.progressBar.width(n+"%")}catch(e){}else y&&w.type&&(n*=w.cnt,v=500)n=["errResponse","errServerError","HTTP error "+e.status];else{if(414==e.status&&"get"===M.type)return M.type="post",r.abortXHR(e),void(c.xhr=e=r.transport.send(M).fail(n).done(D));n=e.quiet?"":["errConnect","HTTP error "+e.status]}}r.trigger(u+"done"),c.reject({error:n},e,t)},D=function(t){if(r.currentReqCmd=u,t.debug&&r.responseDebug(t),r.setCustomHeaderByXhr(i),k)return r.abortXHR(i),t&&t.debug&&r.debug("backend-debug",t),c.resolve(t);if(!t)return c.reject({error:["errResponse","errDataEmpty"]},i,t);if(!e.isPlainObject(t))return c.reject({error:["errResponse","errDataNotJSON"]},i,t);if(t.error)return f&&e.each(r.leafRoots,function(t,n){r.leafRoots[t]=e.grep(n,function(e){return e!==p.target})}),c.reject({error:t.error},i,t);var n=function(){var n,a=function(n){r.leafRoots[p.target]&&t[n]&&e.each(r.leafRoots[p.target],function(e,i){var a;(a=r.file(i))&&t[n].push(a)})},o=function(){r.textMimes={},e.each(r.res("mimes","text"),function(){r.textMimes[this.toLowerCase()]=!0})};return f?a("files"):"tree"===u&&a("tree"),t=r.normalize(t),r.validResponse(u,t)?(f&&(r.api||(r.api=t.api||1,"2.0"==r.api&&"undefined"!=typeof t.options.uploadMaxSize&&(r.api="2.1"),r.newAPI=r.api>=2,r.oldAPI=!r.newAPI),t.textMimes&&Array.isArray(t.textMimes)&&(r.resources.mimes.text=t.textMimes,o()),!r.textMimes&&o(),t.options&&(O=Object.assign({},S,t.options)),t.netDrivers&&(r.netDrivers=t.netDrivers),t.maxTargets&&(r.maxTargets=t.maxTargets),p.init&&(r.uplMaxSize=r.returnBytes(t.uplMaxSize),r.uplMaxFile=t.uplMaxFile?Math.min(parseInt(t.uplMaxFile),50):20)),"function"==typeof T&&T(t),A&&(n=A.target||"added",t[n]&&t[n].length&&r.one(u+"done",function(){var i=t[n],a=r.findCwdNodes(i),o=function(){var t=r.cwd().hash;return e.map(i,function(e){return e.phash&&t===e.phash?e.hash:null})},s=o(),l=function(t){var n,i,a,l=void 0,c=t.action?t.action.data:void 0;return(c||s.length)&&t.action&&(i=t.action.msg)&&(n=t.action.cmd)&&(!t.action.cwdNot||t.action.cwdNot!==r.cwd().hash)&&(a=t.action.done,c=t.action.data,l=e("
          ").append(e('").on("mouseenter mouseleave",function(t){e(this).toggleClass("ui-state-hover","mouseenter"==t.type)}).on("click",function(){r.exec(n,c||s,{_userAction:!0,_currentType:"toast",_currentNode:e(this)}),a&&r.one(n+"done",function(){"function"==typeof a?a():"select"===a&&r.trigger("selectfiles",{files:o()})})}))),delete t.action,t.extNode=l,t};A.toast||(A.toast={}),!A.noselect&&r.trigger("selectfiles",{files:r.searchStatus.state>1?e.map(i,function(e){return e.hash}):s}),a.length?(A.noscroll||(a.first().trigger("scrolltoview",{blink:!1}),r.resources.blink(a,"lookme")),e.isPlainObject(A.toast.incwd)&&r.toast(l(A.toast.incwd))):e.isPlainObject(A.toast.inbuffer)&&r.toast(l(A.toast.inbuffer))})),c.resolve(t),void(t.debug&&r.debug("backend-debug",t))):c.reject({error:t.norError||"errResponse"},i,t)};r.abortXHR(i),z?r.lazy(n):n()},U=function(e){i&&"pending"===i.state()&&(r.abortXHR(i,{quiet:!0,abort:!0}),(!e||"unload"!==e.type&&"destroy"!==e.type)&&r.autoSync())},P=function(e){if(r.trigger(u+"done"),"autosync"==e.type){if("stop"!=e.data.action)return}else if(!("unload"==e.type||"destroy"==e.type||"openxhrabort"==e.type||e.data.added&&e.data.added.length))return;U(e)},q=function(t){var n=function(){C=!1,c.reject()};if(t&&"cmd"===t)return u;if(f){if(ie&&"pending"===ie.state()){if(ie._target===p.target)return c.reject("openabort");ie.xhr?ie.xhr.queueAbort():ie.reject("openabort")}ie=c,ie._target=p.target}if(c.always(function(){delete M.headers["X-elFinderReqid"],f&&(ie=null)}).fail(function(t,n,i){var a,s;f&&"openabort"===t&&(t="",C=!1),a={cmd:u,err:t,xhr:n,rc:i},0===t&&ne.length&&(ne=e.grep(ne,function(e){return e("cmd")!==u})),r.trigger("requestError",a),a._getEvent&&a._getEvent().isDefaultPrevented()&&(m=!1,C=!1,t&&(t.error="")),U(),f&&(o=r.file(p.target),o&&o.volumeid&&r.isRoot(o)&&delete r.volumeExpires[o.volumeid]),r.trigger(u+"fail",i),s="object"==typeof t?t.error:t,s&&(m?r.error(s):r.debug("error",r.i18n(s))),C&&r.sync()}),!u)return C=!1,c.reject({error:"errCmdReq"});if(r.maxTargets&&p.targets&&p.targets.length>r.maxTargets)return C=!1,c.reject({error:["errMaxTargets",r.maxTargets]});if(g&&c.done(E),f){for(;a=R.pop();)a.queueAbort();if(j!==p.target)for(;a=H.pop();)a.queueAbort()}return e.inArray(u,(r.cmdsToAdd+" autosync").split(" "))!==-1&&("autosync"!==u&&(r.autoSync("stop"),c.always(function(){r.autoSync()})),r.trigger("openxhrabort")),delete M.preventFail,r.api>=2.1029&&(I?M.headers["X-elFinderReqid"]=d:Object.assign(M.data,{reqid:d})),c.syncOnFail=function(e){C=!!e},te++,c.xhr=i=r.transport.send(M).always(function(){M._xhr&&"undefined"!=typeof M._xhr.responseURL&&(i.responseURL=M._xhr.responseURL||""),--te,ne.length&&ne.shift()()}).fail(F).done(D),r.api>=2.1029&&(i._requestId=d),f||p.compare&&"info"===u?(i.queueAbort=n,R.unshift(i),p.compare&&r.bind(r.cmdsToAdd+" autosync openxhrabort",P),c.always(function(){var t=e.inArray(i,R);p.compare&&r.unbind(r.cmdsToAdd+" autosync openxhrabort",P),t!==-1&&R.splice(t,1)})):e.inArray(u,r.abortCmdsOnOpen)!==-1&&(i.queueAbort=n,H.unshift(i),c.always(function(){var t=e.inArray(i,H);t!==-1&&H.splice(t,1)})),r.bind("unload destroy",P),c.always(function(){r.unbind("unload destroy",P)}),c},_=function(){return w.type&&w.cnt&&(x&&(w.cancel=c,t.eachCancel&&(w.id=+new Date)),n=setTimeout(function(){b=setTimeout(N,1e3),r.notify(w),y=!0,c.always(function(){w.cnt=-(parseInt(w.cnt)||0),r.notify(w),y=!1})},r.notifyDelay),c.always(function(){clearTimeout(n)})),te=2&&(j!==this.root()&&l.push(this.request({data:{cmd:"parents",target:j},preventDefault:!0})),e.each(c(),function(e,t){l.push(a.request({data:{cmd:t.cmd,target:t.target},preventDefault:!0}))})),e.when.apply(e,l).fail(function(t,o){i=o&&200!=o.status,n&&e.inArray("errOpen",t)===-1?s.reject(t&&0!=o.status?t:void 0):(s.reject(t),a.parseError(t)&&a.request({data:{cmd:"open",target:a.lastDir("")||a.root(),tree:1,init:1},notify:{type:"open",cnt:1,hideCnt:!0}}))}).done(function(e){var n,i,o;if(e.cwd.compare&&r===e.cwd.compare)return s.reject();if(n={tree:[]},i=arguments.length,i>1)for(o=1;o0?a:a.charCodeAt(0):a>0?a:e.ui.keyCode[a],a&&!U[i]&&(U[i]={keyCode:a,altKey:e.inArray("ALT",r)!=-1,ctrlKey:e.inArray("CTRL",r)!=-1,shiftKey:e.inArray("SHIFT",r)!=-1,type:t.type||"keydown",callback:t.callback,description:t.description,pattern:i});return this},this.shortcuts=function(){var t=[];return e.each(U,function(e,n){t.push([n.pattern,u.i18n(n.description)])}),t},this.clipboard=function(t,n){var i=function(){return e.map(P,function(e){return e.hash})};return void 0!==t&&(P.length&&this.trigger("unlockfiles",{files:i()}),q={},P=e.map(t||[],function(e){var t=I[e];return t?(q[e]=!0,{hash:e,phash:t.phash,name:t.name,mime:t.mime,read:t.read,locked:t.locked,cut:!!n}):null}),this.trigger("changeclipboard",{clipboard:P.slice(0,P.length)}),n&&this.trigger("lockfiles",{files:i()})),P.slice(0,P.length)},this.isCommandEnabled=function(e,t){var n,i,a=u.cwd().volumeid||"";return!t&&u.searchStatus.state>1&&u.selected().length&&(t=u.selected()[0]),n=!t||a&&0===t.indexOf(a)?O.disabledFlip:u.option("disabledFlip",t),i=this._commands[e],!!i&&(i.alwaysEnabled||!n[e])},this.exec=function(t,n,i,a){var o,r;return!a&&this.commandMap[t]&&"hidden"!==this.commandMap[t]&&(t=this.commandMap[t]),"open"===t&&((this.searchStatus.state||this.searchStatus.ininc)&&this.trigger("searchend",{noupdate:!0}),this.autoSync("stop")),!a&&n&&(e.isArray(n)?n.length&&(a=n[0]):a=n),o=this._commands[t]&&this.isCommandEnabled(t,a)?this._commands[t].exec(n,i):e.Deferred().reject("errUnknownCmd"),r=typeof o,"object"===r&&o.promise||(u.debug("warning",'"cmd.exec()" should be returned "$.Deferred" but cmd "'+t+'" returned "'+r+'"'),o=e.Deferred().resolve()),this.trigger("exec",{dfrd:o,cmd:t,files:n,opts:i,dstHash:a}),o},this.dialog=function(t,n){var i=e("
          ").append(t).appendTo(m).elfinderdialog(n,u),a=i.closest(".ui-dialog"),o=function(){!i.data("draged")&&i.is(":visible")&&i.elfinderdialog("posInit")};return a.length&&(u.bind("resize",o),a.on("remove",function(){u.unbind("resize",o)})),i},this.toast=function(t){return e('
          ').appendTo(this.ui.toast).elfindertoast(t||{},this)},this.getUI=function(t){return t?this.ui[t]||e():m},this.getCommand=function(e){return void 0===e?this._commands:this._commands[e]},this.resize=function(t,n){var i,a=function(){for(var e=m.outerHeight(!0)-m.innerHeight(),t=m;t.get(0)!==W.get(0)&&(t=t.parent(),e+=t.outerHeight(!0)-t.innerHeight(),t.parent().length););return e},o=!m.hasClass("ui-resizable"),r=m.data("resizeSize")||{w:0,h:0},s={};W&&W.data("resizeTm")&&clearTimeout(W.data("resizeTm")),u.options.noResizeBySelf||("string"==typeof n&&(i=n.match(/^([0-9.]+)%$/))&&(W&&W.length||(W=e(window)),W.data("marginToMyNode")||W.data("marginToMyNode",a()),W.data("fitToBaseFunc")||W.data("fitToBaseFunc",function(e){var t=W.data("resizeTm");e.preventDefault(),e.stopPropagation(),t&&cancelAnimationFrame(t),m.hasClass("elfinder-fullscreen")||u.UA.Mobile&&W.data("rotated")===u.UA.Rotated||(W.data("rotated",u.UA.Rotated),W.data("resizeTm",requestAnimationFrame(function(){u.restoreSize()})))}),"undefined"==typeof W.data("rotated")&&W.data("rotated",u.UA.Rotated),n=W.height()*(i[1]/100)-W.data("marginToMyNode"),W.off("resize."+u.namespace,W.data("fitToBaseFunc")),o&&W.on("resize."+u.namespace,W.data("fitToBaseFunc"))),m.css({width:t,height:parseInt(n)})),s.w=Math.round(m.width()),s.h=Math.round(m.height()),m.data("resizeSize",s),s.w===r.w&&s.h===r.h||(m.trigger("resize"),this.trigger("resize",{width:s.w,height:s.h}))},this.restoreSize=function(){this.resize(N,L)},this.show=function(){m.show(),this.enable().trigger("show")},this.hide=function(){this.options.enableAlways&&(T=z,z=!1),this.disable(),this.trigger("hide"),m.hide()},this.lazy=function(t,n,i){var a=function(e){var t,n=m.data("lazycnt");e?(t=!m.data("lazyrepaint")&&i.repaint,n?m.data("lazycnt",++n):m.data("lazycnt",1).addClass("elfinder-processing"),t&&m.data("lazyrepaint",!0).css("display")):n&&n>1?m.data("lazycnt",--n):(t=m.data("lazyrepaint"),m.data("lazycnt",0).removeData("lazyrepaint").removeClass("elfinder-processing"),t&&m.css("display"),u.trigger("lazydone"))},o=e.Deferred(),r=function(){o.resolve(t.call(o)),a(!1)};return n=n||0,i=i||{},a(!0),n?setTimeout(r,n):requestAnimationFrame(r),o},this.destroy=function(){m&&m[0].elfinder&&(m.hasClass("elfinder-fullscreen")&&u.toggleFullscreen(m),this.options.syncStart=!1,this.autoSync("forcestop"),this.trigger("destroy").disable(),P=[],F=[],D={},U={},e(window).off("."+y),e(document).off("."+y),u.trigger=function(){},e(K).remove(),m.off().removeData().empty().append(v.contents()).attr("class",v.attr("class")).attr("style",v.attr("style")),delete m[0].elfinder,e.each(g,function(t,n){e.each(n,function(e,t){m.on(t.type+(t.namespace?"."+t.namespace:""),t.selector,t.handler)})}))},this.autoSync=function(t){var n;if(u.options.sync>=1e3){if(r&&(clearTimeout(r),r=null,u.trigger("autosync",{action:"stop"})),"stop"===t?++X:X=Math.max(0,--X),X||"forcestop"===t||!u.options.syncStart)return;n=function(t){var i;O.syncMinMs&&(t||r)&&(t&&u.trigger("autosync",{action:"start"}),i=Math.max(u.options.sync,O.syncMinMs),r&&clearTimeout(r),r=setTimeout(function(){var t,a=!0,o=j;O.syncChkAsTs&&I[o]&&(t=I[o].ts)?u.request({data:{cmd:"info",targets:[o],compare:t,reload:1},preventDefault:!0}).done(function(e){var i;a=!0,e.compare&&(i=e.compare,i==t&&(a=!1)),a?u.sync(o).always(function(){i&&(I[o].ts=i),n()}):n()}).fail(function(t,a){var o=u.parseError(t);o&&0!=a.status?(u.error(o),Array.isArray(o)&&e.inArray("errOpen",o)!==-1&&u.request({data:{cmd:"open",target:u.lastDir("")||u.root(),tree:1,init:1},notify:{type:"open",cnt:1,hideCnt:!0}})):r=setTimeout(function(){n()},i)}):u.sync(j,!0).always(function(){n()})},i))},n(!0)}},this.insideWorkzone=function(e,t,n){var i=this.getUI("workzone").data("rectangle");return n=n||1,!(ei.left+i.width+n||ti.top+i.height+n)},this.toFront=function(t){var n=m.children(".ui-front").removeClass("elfinder-frontmost"),i=n.last();n.css("z-index",""),e(t).addClass("ui-front elfinder-frontmost").css("z-index",i.css("z-index")+1)},this.toHide=function(t,n){var i,a=e(t);!n&&a.hide(),a.hasClass("elfinder-frontmost")&&(a.removeClass("elfinder-frontmost"),i=m.children(".ui-front:visible:not(.elfinder-frontmost)").last(),i.length&&requestAnimationFrame(function(){m.children(".elfinder-frontmost:visible").length||(u.toFront(i),i.trigger("frontmost"))}))},this.getMaximizeCss=function(){return{width:"100%",height:"100%",margin:0,top:0,left:0,display:"block",position:"fixed",zIndex:Math.max(u.zIndex?u.zIndex+1:0,1e3),maxWidth:"",maxHeight:""}},function(){re&&u.UA.Fullscreen&&(u.UA.Fullscreen=!1,se&&"undefined"!=typeof se.attr("allowfullscreen")&&(u.UA.Fullscreen=!0));var t,n,i,a,o="elfinder-fullscreen",r="elfinder-fullscreen-native",s=function(){var t=0,n=0;e.each(m.children(".ui-dialog,.ui-draggable"),function(i,a){var o=e(a),r=o.position();r.top<0&&(o.css("top",t),t+=20),r.left<0&&(o.css("left",n),n+=20)})},l=function(){var i=u.storage("useFullscreen");a=u.UA.Fullscreen&&(i?i>0:"screen"===u.options.commandsOptions.fullscreen.mode)?{fullElm:function(){return document.fullscreenElement||document.webkitFullscreenElement||document.mozFullScreenElement||document.msFullscreenElement||null},exitFull:function(){return document.exitFullscreen?document.exitFullscreen():document.webkitExitFullscreen?document.webkitExitFullscreen():document.mozCancelFullScreen?document.mozCancelFullScreen():document.msExitFullscreen?document.msExitFullscreen():void 0},toFull:function(e){return e.requestFullscreen?e.requestFullscreen():e.webkitRequestFullscreen?e.webkitRequestFullscreen():e.mozRequestFullScreen?e.mozRequestFullScreen():!!e.msRequestFullscreen&&e.msRequestFullscreen()}}:{fullElm:function(){var e;return m.hasClass(o)?m.get(0):(e=m.find("."+o),e.length?e.get(0):null)},exitFull:function(){var i;e(window).off("resize."+y,d),void 0!==n&&e("body").css("overflow",n),n=void 0,t&&(i=t.elm,c(i),e(i).trigger("resize",{fullscreen:"off"})),e(window).trigger("resize")},toFull:function(t){return n=e("body").css("overflow")||"",e("body").css("overflow","hidden"),e(t).css(u.getMaximizeCss()).addClass(o).trigger("resize",{fullscreen:"on"}),s(),e(window).on("resize."+y,d).trigger("resize"),!0}}},c=function(n){t&&t.elm==n&&(e(n).removeClass(o+" "+r).attr("style",t.style),t=null)},d=function(t){var n;t.target===window&&(i&&cancelAnimationFrame(i),i=requestAnimationFrame(function(){(n=a.fullElm())&&e(n).trigger("resize",{fullscreen:"on"})}))};l(),e(document).on("fullscreenchange."+y+" webkitfullscreenchange."+y+" mozfullscreenchange."+y+" MSFullscreenChange."+y,function(n){if(u.UA.Fullscreen){var l=a.fullElm(),p=e(window);i&&cancelAnimationFrame(i),null===l?(p.off("resize."+y,d),t&&(l=t.elm,c(l),e(l).trigger("resize",{fullscreen:"off"}))):(e(l).addClass(o+" "+r).attr("style","width:100%; height:100%; margin:0; padding:0;").trigger("resize",{fullscreen:"on"}),p.on("resize."+y,d),s()),p.trigger("resize")}}),u.toggleFullscreen=function(n,i){var o=e(n).get(0),r=null;if(r=a.fullElm()){if(r==o){if(i===!0)return r}else if(i===!1)return r;return a.exitFull(),null}return i===!1?null:(l(),t={elm:o,style:e(o).attr("style")},a.toFull(o)!==!1?o:(t=null,null))}}(),function(){var t,n="elfinder-maximized",i=function(e){if(e.target===window&&e.data&&e.data.elm){var n=e.data.elm;t&&cancelAnimationFrame(t),t=requestAnimationFrame(function(){n.trigger("resize",{maximize:"on"})})}},a=function(t){e(window).off("resize."+y,i),e("body").css("overflow",t.data("bodyOvf")),t.removeClass(n).attr("style",t.data("orgStyle")).removeData("bodyOvf").removeData("orgStyle"),t.trigger("resize",{maximize:"off"})},o=function(t){t.data("bodyOvf",e("body").css("overflow")||"").data("orgStyle",t.attr("style")).addClass(n).css(u.getMaximizeCss()),e("body").css("overflow","hidden"),e(window).on("resize."+y,{elm:t},i),t.trigger("resize",{maximize:"on"})};u.toggleMaximize=function(t,i){var r=e(t),s=r.hasClass(n);if(s){if(i===!0)return;a(r)}else{if(i===!1)return;o(r)}}}(),Object.assign(e.ui.keyCode,{F1:112,F2:113,F3:114,F4:115,F5:116,F6:117,F7:118,F8:119,F9:120,F10:121,F11:122,F12:123,DIG0:48,DIG1:49,DIG2:50,DIG3:51,DIG4:52,DIG5:53,DIG6:54,DIG7:55,DIG8:56,DIG9:57,NUM0:96,NUM1:97,NUM2:98,NUM3:99,NUM4:100,NUM5:101,NUM6:102,NUM7:103,NUM8:104,NUM9:105,CONTEXTMENU:93,DOT:190}),this.dragUpload=!1,this.xhrUpload=("undefined"!=typeof XMLHttpRequestUpload||"undefined"!=typeof XMLHttpRequestEventTarget)&&"undefined"!=typeof File&&"undefined"!=typeof FormData,this.transport={},"object"==typeof this.options.transport&&(this.transport=this.options.transport,"function"==typeof this.transport.init&&this.transport.init(this)),"function"!=typeof this.transport.send&&(this.transport.send=function(t){return u.UA.IE||(t._xhr=new XMLHttpRequest,t.xhr=function(){return t.progress&&t._xhr.addEventListener("progress",t.progress),t._xhr}),e.ajax(t)}),"iframe"==this.transport.upload?this.transport.upload=e.proxy(this.uploads.iframe,this):"function"==typeof this.transport.upload?this.dragUpload=!!this.options.dragUploadAllow:this.xhrUpload&&this.options.dragUploadAllow?(this.transport.upload=e.proxy(this.uploads.xhr,this),this.dragUpload=!0):this.transport.upload=e.proxy(this.uploads.iframe,this),this.decodeRawString=function(e){var t=function(e){var t,n,i;for(t=0,n=e.length,i=[];t=55296&&a<=56319?o.push((1023&a)+64<<10|1023&e[++n]):o.push(a);return o},i=function(e){var t,n,i,a,o=String.fromCharCode;for(t=0,n=e.length,a="";i=e[t],t=194?o((31&i)<<6|63&e[++t]):i<=239&&i>=224?o((15&i)<<12|(63&e[++t])<<6|63&e[++t]):i<=247&&i>=240?o(55296|((7&i)<<8|(63&e[++t])<<2|e[++t]>>>4&3)-64,56320|(15&e[t++])<<6|63&e[t]):o(65533);return a};return i(n(e))},this.getContents=function(t,n,i){var a,o,r=this,s=e.Deferred(),l=n||"arraybuffer";return s.fail(function(){o&&"pending"===o.state()&&o.reject()}),a=r.openUrl(t),r.isSameOrigin(a)||(a=r.openUrl(t,!0)),o=r.request(Object.assign({data:{cmd:"get"},options:{url:a,type:"get",cache:!0,dataType:"binary",responseType:l,processData:!1},notify:{type:"file",cnt:1,hideCnt:!0},cancel:!0},i||{})).fail(function(){s.reject()}).done(function(e){s.resolve(e)}),s},this.getBinaryByUrl=function(t,n,i){var a,o=this,r=e.Deferred();return r.fail(function(){a&&"pending"===a.state()&&a.reject()}),a=o.request(Object.assign({data:{cmd:"get"},options:Object.assign({type:"get",cache:!0,dataType:"binary",responseType:"blob",processData:!1},t)},i||{})).fail(function(){r.reject()}).done(function(e){n&&n(e),r.resolve(e)}),r},this.getMimetype=function(e,t){var n,i,a=t;return i=(e+"").match(/\.([^.]+)$/),i&&(n=i[1])&&(o||(o=u.arrayFlip(u.mimeTypes)),(a=o[n.toLowerCase()])||(a=t)),a},u.hashCheckers=[],function(t){var n={};window.Worker&&window.ArrayBuffer&&(t.options.cdns.sparkmd5&&(n.SparkMD5=!0,t.hashCheckers.push("md5")),t.options.cdns.jssha&&(n.jsSHA=!0,t.hashCheckers=t.hashCheckers.concat(["sha1","sha224","sha256","sha384","sha512","sha3-224","sha3-256","sha3-384","sha3-512","shake128","shake256"]))),t.getContentsHashes=function(i,a,o,r){var s,l=e.Deferred(),c=t.arrayFlip(a||["md5"],!0),d=[],p={},u=o?o:{shake128len:256,shake256len:512};return l.fail(function(){s&&s.reject()}),Object.keys(n).length?s=t.getContents(i,"arraybuffer",r).done(function(a){c.md5&&n.SparkMD5&&d.push(function(){var o=e.Deferred();try{var r=t.getWorker();o.fail(function(){r&&r.terminate()}),r.onmessage=function(e){if(r&&r.terminate(),e.data.hash){var n;p.md5=e.data.hash,(n=t.file(i))&&(n.md5=p.md5)}else e.data.error&&(p.md5=e.data.error);l.notify(p),o.resolve()},r.onerror=function(e){o.reject()},r.postMessage({scripts:[t.options.cdns.sparkmd5,t.getWorkerUrl("calcfilehash.js")],data:{type:"md5",bin:a}}),l.fail(function(){o.reject()})}catch(s){o.reject(),delete n.SparkMD5}return o}()),n.jsSHA&&e.each(["1","224","256","384","512","3-224","3-256","3-384","3-512","ke128","ke256"],function(o,r){c["sha"+r]&&d.push(function(){var o=e.Deferred();try{var s=t.getWorker();o.fail(function(){s&&s.terminate()}),s.onmessage=function(e){if(s&&s.terminate(),e.data.hash){var n;p["sha"+r]=e.data.hash,(n=t.file(i))&&(n["sha"+r]=p["sha"+r])}else e.data.error&&(p["sha"+r]=e.data.error);l.notify(p),o.resolve()},s.onerror=function(e){o.reject()},s.postMessage({scripts:[t.options.cdns.jssha,t.getWorkerUrl("calcfilehash.js")],data:{type:r,bin:a,hashOpts:u}}),l.fail(function(){o.reject()})}catch(c){o.reject(),delete n.jsSHA}return o}())}),d.length?e.when.apply(null,d).always(function(){l.resolve(p)}):l.reject()}).fail(function(){l.reject()}):l.reject(),l}}(this),this.parseError=function(t){var n=t;return e.isPlainObject(n)&&(n=n.error),n},this.error=function(){var e,t=arguments[0],n=arguments[1]||null;return 1==arguments.length&&"function"==typeof t?u.bind("error",t):(e=this.parseError(t),e!==!0&&e?u.trigger("error",{error:e,opts:n}):this)},e.each(A,function(t,n){u[n]=function(){var t=arguments[0];return 1==arguments.length&&"function"==typeof t?u.bind(n,t):u.trigger(n,e.isPlainObject(t)?t:{})}}),this.enable(function(){!z&&u.api&&u.visible()&&u.ui.overlay.is(":hidden")&&!m.children(".elfinder-dialog."+u.res("class","editing")+":visible").length&&(z=!0,document.activeElement&&document.activeElement.blur(),m.removeClass("elfinder-disabled"))}).disable(function(){T=z,z=!1,m.addClass("elfinder-disabled")}).open(function(){F=[]}).select(function(t){var n=0,i=[];F=e.grep(t.data.selected||t.data.value||[],function(e){return i.length||u.maxTargets&&++n>u.maxTargets?(i.push(e),!1):!!I[e]}),i.length&&(u.trigger("unselectfiles",{files:i,inselect:!0}),u.toast({mode:"warning",msg:u.i18n(["errMaxTargets",u.maxTargets])}))}).error(function(t){var n,i,a={cssClass:"elfinder-dialog-error",title:u.i18n("error"),resizable:!1,destroyOnClose:!0,buttons:{}},o=u.getUI(),r=o.children(".elfinder-dialog-error").length;r'+u.i18n(t.data.error),a)):(n=o.children(".elfinder-dialog-error:last").children(".ui-dialog-content:first"),i=n.children(".elfinder-error-counter"),i.length?i.data("cnt",parseInt(i.data("cnt"))+1).html(u.i18n(["moreErrors",i.data("cnt")])):(i=e(''+u.i18n(["moreErrors",1])+"").data("cnt",1),n.append("
          ",i)))}).bind("tmb",function(t){e.each(t.data.images||[],function(e,t){I[e]&&(I[e].tmb=t)})}).bind("searchstart",function(e){Object.assign(u.searchStatus,e.data),u.searchStatus.state=1}).bind("search",function(e){u.searchStatus.state=2}).bind("searchend",function(){u.searchStatus.state=0,u.searchStatus.ininc=!1,u.searchStatus.mixed=!1}).bind("canMakeEmptyFile",function(t){var n=t.data,i={};n&&Array.isArray(n.mimes)&&(n.unshift||(i=u.mimesCanMakeEmpty),e.each(n.mimes,function(){i[this]||(i[this]=u.mimeTypes[this])}),n.unshift&&(u.mimesCanMakeEmpty=Object.assign(i,u.mimesCanMakeEmpty)))}).bind("themechange",function(){requestAnimationFrame(function(){u.trigger("uiresize")})}),!0===this.options.sound&&this.bind("playsound",function(t){var n=K.canPlayType&&K.canPlayType('audio/wav; codecs="1"'),i=t.data&&t.data.soundFile;n&&i&&""!=n&&"no"!=n&&e(K).html('')[0].play()}),e.each(this.options.handlers,function(e,t){u.bind(e,t)}),this.history=new this.history(this),this.roots={},this.leafRoots={},this.volumeExpires={},this._commands={},Array.isArray(this.options.commands)||(this.options.commands=[]),e.inArray("*",this.options.commands)!==-1&&(this.options.commands=Object.keys(this.commands)),this.commandMap={},this.volOptions={},this.hasVolOptions=!1,this.trashes={},this.optionsByHashes={},this.uiAutoHide=[],this.one("open",function(){u.uiAutoHide.length&&setTimeout(function(){u.trigger("uiautohide")},500)}),this.bind("uiautohide",function(){u.uiAutoHide.length&&u.uiAutoHide.shift()()}),this.options.width&&(N=this.options.width),this.options.height&&(L=this.options.height),this.options.heightBase&&(W=e(this.options.heightBase)),B=this.options.soundPath?this.options.soundPath.replace(/\/+$/,"")+"/":this.baseUrl+B,this.options.parrotHeaders&&Array.isArray(this.options.parrotHeaders)&&this.options.parrotHeaders.length?(this.parrotHeaders=this.options.parrotHeaders,e.each(this.parrotHeaders,function(e,t){var n=u.sessionStorage("core-ph:"+t);n&&(u.customHeaders[t]=n)})):this.parrotHeaders=[],u.one("opendone",function(){var t;e(document).on("click."+y,function(t){z&&!u.options.enableAlways&&!e(t.target).closest(m).length&&u.disable()}).on(x+" "+k+" "+C+" "+w,ae),u.options.useBrowserHistory&&e(window).on("popstate."+y,function(t){var n,i,a=t.originalEvent.state||{},o=!!a.thash,r=m.find(".elfinder-frontmost:visible"),s=m.find(".elfinder-navbar-dir,.elfinder-cwd-filename").find("input,textarea");o||(a={thash:u.cwd().hash},e("html,body").animate({scrollTop:m.offset().top})),r.length||s.length?(history.pushState(a,null,location.pathname+location.search+"#elf_"+a.thash),r.length?r.hasClass(u.res("class","preventback"))||(r.hasClass("elfinder-contextmenu")?e(document).trigger(e.Event("keydown",{keyCode:e.ui.keyCode.ESCAPE,ctrlKey:!1,shiftKey:!1,altKey:!1,metaKey:!1})):r.hasClass("elfinder-dialog")?r.elfinderdialog("close"):r.trigger("close")):s.trigger(e.Event("keydown",{keyCode:e.ui.keyCode.ESCAPE,ctrlKey:!1,shiftKey:!1,altKey:!1,metaKey:!1}))):o?!e.isEmptyObject(u.files())&&u.request({data:{cmd:"open",target:a.thash,onhistory:1},notify:{type:"open",cnt:1,hideCnt:!0},syncOnFail:!0}):(n=function(){i.trigger("click")},u.one("open",n,!0),i=u.toast({msg:u.i18n("pressAgainToExit"),onHidden:function(){u.unbind("open",n),history.pushState(a,null,location.pathname+location.search+"#elf_"+a.thash)}}))}),e(window).on("resize."+y,function(e){e.target===this&&(t&&cancelAnimationFrame(t),t=requestAnimationFrame(function(){var e=m.data("resizeSize")||{w:0,h:0},t={w:Math.round(m.width()),h:Math.round(m.height())};m.data("resizeSize",t),t.w===e.w&&t.h===e.h||(m.trigger("resize"),u.trigger("resize",{width:t.w,height:t.h}))}))}).on("beforeunload."+y,function(t){var n,i;if(!u.pauseUnloadCheck()){if(m.is(":visible")&&(u.ui.notify.children().length&&e.inArray("hasNotifyDialog",u.options.windowCloseConfirm)!==-1?n=u.i18n("ntfsmth"):m.find("."+u.res("class","editing")).length&&e.inArray("editingFile",u.options.windowCloseConfirm)!==-1?n=u.i18n("editingFile"):(i=Object.keys(u.selected()).length)&&e.inArray("hasSelectedItem",u.options.windowCloseConfirm)!==-1?n=u.i18n("hasSelected",""+i):(i=Object.keys(u.clipboard()).length)&&e.inArray("hasClipboardData",u.options.windowCloseConfirm)!==-1&&(n=u.i18n("hasClipboard",""+i)),n))return t.returnValue=n,n;u.trigger("unload")}}),e(window).on("message."+y,function(e){var t,n,i=e.originalEvent||null;if(i&&(0===u.convAbsUrl(u.options.url).indexOf(i.origin)||0===u.convAbsUrl(u.uploadURL).indexOf(i.origin)))try{t=JSON.parse(i.data),n=t.data||null,n&&(n.error?(t.bind&&u.trigger(t.bind+"fail",n),u.error(n.error)):(n.warning&&u.error(n.warning),u.updateCache(n),n.removed&&n.removed.length&&u.remove(n),n.added&&n.added.length&&u.add(n),n.changed&&n.changed.length&&u.change(n),t.bind&&(u.trigger(t.bind,n),u.trigger(t.bind+"done")),n.sync&&u.sync()))}catch(e){u.sync()}}),u.options.enableAlways?(e(window).on("focus."+y,function(e){e.target===this&&u.enable()}),re&&e(window.top).on("focus."+y,function(){!u.enable()||se&&!se.is(":visible")||requestAnimationFrame(function(){e(window).trigger("focus")})})):re&&e(window).on("blur."+y,function(e){z&&e.target===this&&u.disable()}),re&&m.on("click",function(t){e(window).trigger("focus")}),u.options.enableByMouseOver&&m.on("mouseenter touchstart",function(t){re&&e(window).trigger("focus"),!u.enabled()&&u.enable()}),e(window).on("visibilitychange."+y,function(e){var t=document.hidden||document.webkitHidden||document.msHidden;u.options.syncStart&&u.autoSync(t?"stop":void 0)})}),m[0].elfinder=this,h.push(function(){var t=u.lang,n=u.i18nBaseUrl+"elfinder."+t+".js",i=e.Deferred().done(function(){u.i18[t]&&(u.lang=t),u.trigger("i18load"),c="en"===u.lang?u.i18.en:e.extend(!0,{},u.i18.en,u.i18[u.lang])});return u.i18[t]?i.resolve():(u.lang="en",u.hasRequire?require([n],function(){i.resolve()},function(){i.resolve()}):u.loadScript([n],function(){i.resolve()},{loadType:"tag",error:function(){i.resolve()}})),i}()),d=function(){var t;return u.messages=c.messages,e.fn.selectable&&e.fn.draggable&&e.fn.droppable&&e.fn.resizable&&e.fn.button&&e.fn.slider?m.length?u.options.url?(t=Object.assign({name:u.i18n("name"),perm:u.i18n("perms"),date:u.i18n("modify"),size:u.i18n("size"),kind:u.i18n("kind"),modestr:u.i18n("mode"),modeoct:u.i18n("mode"),modeboth:u.i18n("mode")},u.options.uiOptions.cwd.listView.columnsCustomName),u.getColumnName=function(e){var n=t[e]||u.i18n(e);return"function"==typeof n?n():n},u.direction=c.direction,u.dateFormat=u.options.dateFormat||c.dateFormat,u.fancyFormat=u.options.fancyDateFormat||c.fancyDateFormat,u.nonameDateFormat=(u.options.nonameDateFormat||c.nonameDateFormat).replace(/[\/\\]/g,"_"),u.cssClass="ui-helper-reset ui-helper-clearfix ui-widget ui-widget-content ui-corner-all elfinder elfinder-"+("rtl"==u.direction?"rtl":"ltr")+(u.UA.Touch?" elfinder-touch"+(u.options.resizable?" touch-punch":""):"")+(u.UA.Mobile?" elfinder-mobile":"")+(u.UA.iOS?" elfinder-ios":"")+" "+u.options.cssClass,m.addClass(u.cssClass).on(w,function(){!z&&u.enable()}),function(){var t,n,i,a,o,r=x+"draggable keyup."+y+"draggable";u.draggable={appendTo:m,addClasses:!1,distance:4,revert:!0,refreshPositions:!1,cursor:"crosshair",cursorAt:{left:50,top:47},scroll:!1,start:function(r,s){var l,c,d=s.helper,p=e.grep(d.data("files")||[],function(e){return!!e&&(q[e]=!0,!0)}),h=!1;for(o=m.attr("style"),m.width(m.width()).height(m.height()),t="ltr"===u.direction,n=u.getUI("workzone").data("rectangle"),i=n.top+n.height,a=i-u.getUI("navdock").outerHeight(!0),u.draggingUiHelper=d,l=p.length;l--;)if(c=p[l],I[c].locked){h=!0,d.data("locked",!0);break}!h&&u.trigger("lockfiles",{files:p}),d.data("autoScrTm",setInterval(function(){d.data("autoScr")&&u.autoScroll[d.data("autoScr")](d.data("autoScrVal"))},50))},drag:function(o,r){var s,l,c,d=r.helper;((l=n.top>o.pageY)||ao.pageX?(t?"navbar":"cwd")+(l?"Up":"Down"):(t?"cwd":"navbar")+(l?"Up":"Down"),l||("cwd"===s.substr(0,3)?i0?(e(this).draggable("option",{refreshPositions:!0,elfRefresh:!0}),d.data("refreshPositions",-1)):(e(this).draggable("option",{refreshPositions:!1,elfRefresh:!1}),d.data("refreshPositions",null)))},stop:function(t,n){var i,a=n.helper;e(document).off(r),e(this).elfUiWidgetInstance("draggable")&&e(this).draggable("option",{refreshPositions:!1}),u.draggingUiHelper=null,u.trigger("focus").trigger("dragstop"),a.data("droped")||(i=e.grep(a.data("files")||[],function(e){return!!e}),u.trigger("unlockfiles",{files:i}),u.trigger("selectfiles",{files:u.selected()})),u.enable(),m.attr("style",o),a.data("autoScrTm")&&clearInterval(a.data("autoScrTm"))},helper:function(t,n){var i,a,o,s=this.id?e(this):e(this).parents("[id]:first"),l=e('
          '),c=function(t){var n,i=t.mime,a=u.tmb(t);return n='
          ',a?n=e(n).addClass(a.className).css("background-image","url('"+a.url+"')").get(0).outerHTML:t.icon&&(n=e(n).css(u.getIconStyle(t,!0)).get(0).outerHTML),t.csscls&&(n='
          '+n+"
          "),n};return u.draggingUiHelper&&u.draggingUiHelper.stop(!0,!0),u.trigger("dragstart",{target:s[0],originalEvent:t},!0),i=s.hasClass(u.res("class","cwdfile"))?u.selected():[u.navId2Hash(s.attr("id"))],l.append(c(I[i[0]])).data("files",i).data("locked",!1).data("droped",!1).data("namespace",y).data("dropover",0),(a=i.length)>1&&l.append(c(I[i[a-1]])+''+a+""),e(document).on(r,function(e){if(u._commands.copy){var t=e.shiftKey||e.ctrlKey||e.metaKey;o!==t&&(o=t,l.is(":visible")&&l.data("dropover")&&!l.data("droped")&&(l.toggleClass("elfinder-drag-helper-plus",!!l.data("locked")||o),u.trigger(o?"unlockfiles":"lockfiles",{files:i,helper:l})))}}),l}}}(),u.commands.getfile&&("function"==typeof u.options.getFileCallback?(u.bind("dblclick",function(e){e.preventDefault(),u.exec("getfile").fail(function(){u.exec("open",e.data&&e.data.file?[e.data.file]:void 0)})}),u.shortcut({pattern:"enter",description:u.i18n("cmdgetfile"),callback:function(){u.exec("getfile").fail(function(){u.exec("mac"==u.OS?"rename":"open")})}}).shortcut({pattern:"ctrl+enter",description:u.i18n("mac"==u.OS?"cmdrename":"cmdopen"),callback:function(){u.exec("mac"==u.OS?"rename":"open")}})):u.options.getFileCallback=null),e.each(u.commands,function(t,n){var i,a,o=Object.assign({},n.prototype);if(e.isFunction(n)&&!u._commands[t]&&(n.prototype.forceLoad||e.inArray(t,u.options.commands)!==-1)){if(i=n.prototype.extendsCmd||""){if(!e.isFunction(u.commands[i]))return!0;n.prototype=Object.assign({},_,new u.commands[i],n.prototype)}else n.prototype=Object.assign({},_,n.prototype);u._commands[t]=new n,n.prototype=o,a=u.options.commandsOptions[t]||{},i&&u.options.commandsOptions[i]&&(a=e.extend(!0,{},u.options.commandsOptions[i],a)),u._commands[t].setup(t,a),u._commands[t].linkedCmds.length&&e.each(u._commands[t].linkedCmds,function(t,n){var i=u.commands[n];e.isFunction(i)&&!u._commands[n]&&(i.prototype=_,u._commands[n]=new i,u._commands[n].setup(n,u.options.commandsOptions[n]||{}))})}}),u.ui={workzone:e("
          ").appendTo(m).elfinderworkzone(u),navbar:e("
          ").appendTo(m).elfindernavbar(u,u.options.uiOptions.navbar||{}),navdock:e("
          ").appendTo(m).elfindernavdock(u,u.options.uiOptions.navdock||{}),contextmenu:e("
          ").appendTo(m).elfindercontextmenu(u),overlay:e("
          ").appendTo(m).elfinderoverlay({show:function(){u.disable()},hide:function(){T&&u.enable()}}),cwd:e("
          ").appendTo(m).elfindercwd(u,u.options.uiOptions.cwd||{}),notify:u.dialog("",{cssClass:"elfinder-dialog-notify"+(u.options.notifyDialog.canClose?"":" elfinder-titlebar-button-hide"),position:u.options.notifyDialog.position,absolute:!0,resizable:!1,autoOpen:!1,allowMinimize:!0,closeOnEscape:!!u.options.notifyDialog.canClose,title:" ",width:u.options.notifyDialog.width?parseInt(u.options.notifyDialog.width):null,minHeight:null,minimize:function(){u.ui.notify.trigger("minimize")}}),statusbar:e('
          ').hide().appendTo(m),toast:e('
          ').appendTo(m),bottomtray:e('
          ').appendTo(m),progressbar:e('
          ').appendTo(m)},u.trigger("uiready"),e.each(u.options.ui||[],function(t,n){var i="elfinder"+n,a=u.options.uiOptions[n]||{};!u.ui[n]&&e.fn[i]&&(u.ui[n]=e("<"+(a.tag||"div")+"/>").appendTo(m),u.ui[n][i](u,a))}),u.ui.progressbar.appendTo(u.ui.workzone),u.ui.notify.prev(".ui-dialog-titlebar").append('
          '),u.resize(N,L),u.options.resizable&&(m.resizable({resize:function(e,t){u.resize(t.size.width,t.size.height)},handles:"se",minWidth:300,minHeight:200}),u.UA.Touch&&m.addClass("touch-punch")),function(){var e=u.getUI("navbar"),t=u.getUI("cwd").parent();u.autoScroll={navbarUp:function(t){e.scrollTop(Math.max(0,e.scrollTop()-t))},navbarDown:function(t){e.scrollTop(e.scrollTop()+t)},cwdUp:function(e){t.scrollTop(Math.max(0,t.scrollTop()-e))},cwdDown:function(e){t.scrollTop(t.scrollTop()+e)}}}(),u.UA.Touch&&!function(){var e,t,n,i,a,o,r,s,l,c=u.getUI("navbar"),d=u.getUI("toolbar"),p="touchmove.stopscroll",h=function(e){var n=e.originalEvent.touches||[{}],i=n[0].pageY||null;(!t||i1||("touchstart"===s.type?(n=m.offset(),i=m.width(),c&&(e=!1,c.is(":hidden")?(l||(l=Math.max(50,i/10)),(A?z-n.left:i+n.left-z)n.left+i-o,y?(l=Math.max(50,i/10),e=z):e=!1)),d&&(t=!1,s.originalEvent._preventSwipeY||(r=d.height(),a=n.top,T-a<(d.is(":hidden")?v:r+30)&&(t=T,m.on(p,d.is(":hidden")?f:h))))):(c&&e!==!1&&(b=(A?e>z:e.6*o||w>("navhide"===b?o/3:45)&&("navshow"===b||(A?zn.left+i-20)))&&(u.getUI("navbar").trigger(b,{handleW:l}),e=!1)),d&&t!==!1&&(x=d.offset().top,Math.abs(t-T)>Math.min(45,r/3)&&(k=t>T?"slideUp":"slideDown",("slideDown"===k||x+20>T)&&(d.is("slideDown"===k?":hidden":":visible")&&d.stop(!0,!0).trigger("toggle",{duration:100,handleH:v}),t=!1)))))})}(),u.dragUpload&&!function(){var t,n,i=function(t){return"TEXTAREA"!==t.target.nodeName&&"INPUT"!==t.target.nodeName&&0===e(t.target).closest("div.ui-dialog-content").length},a="native-drag-enter",o="native-drag-disable",r="class",s=u.res(r,"navdir"),l=(u.res(r,"droppable"),u.res(r,"adroppable"),u.res(r,"navarrow"),u.res(r,"adroppable")),c=u.getUI("workzone"),d="ltr"===u.direction,p=function(){n&&cancelAnimationFrame(n),n=null};m.on("dragenter",function(e){p(),i(e)&&(e.preventDefault(),e.stopPropagation(),t=c.data("rectangle"))}).on("dragleave",function(e){p(),i(e)&&(e.preventDefault(),e.stopPropagation())}).on("dragover",function(e){var a;i(e)?(e.preventDefault(),e.stopPropagation(),e.originalEvent.dataTransfer.dropEffect="none",n||(n=requestAnimationFrame(function(){var i,o=t.top+t.height,r=o-u.getUI("navdock").outerHeight(!0);((a=e.pageYr)&&(i=t.cwdEdge>e.pageX?(d?"navbar":"cwd")+(a?"Up":"Down"):(d?"cwd":"navbar")+(a?"Up":"Down"),a||"cwd"===i.substr(0,3)&&(o=11,IE:document.uniqueID,Firefox:window.sidebar,Opera:window.opera,Webkit:e,Chrome:t,Edge:!(!t||!window.msCredentials),Safari:e&&!window.chrome,Mobile:"undefined"!=typeof window.orientation,Touch:"undefined"!=typeof window.ontouchstart,iOS:navigator.platform.match(/^iP(?:[ao]d|hone)/),Mac:navigator.platform.match(/^Mac/),Fullscreen:"undefined"!=typeof(document.exitFullscreen||document.webkitExitFullscreen||document.mozCancelFullScreen||document.msExitFullscreen),Angle:0,Rotated:!1,CSS:function(){var e,t=document.createElement("a").style,n=document.createElement("p").style;return e="position:sticky;position:-webkit-sticky;",e+="width:-webkit-max-content;width:-moz-max-content;width:-ms-max-content;width:max-content;",t.cssText=e,{positionSticky:t.position.indexOf("sticky")!==-1,widthMaxContent:t.width.indexOf("max-content")!==-1,flex:"undefined"!=typeof n.flex}}()};return n}(),cookieEnabled:window.navigator.cookieEnabled,hasRequire:"function"==typeof define&&define.amd,currentReqCmd:"",keyState:{},i18:{en:{translator:"",language:"English",direction:"ltr",dateFormat:"d.m.Y H:i",fancyDateFormat:"$1 H:i",nonameDateFormat:"ymd-His",messages:{}},months:["January","February","March","April","May","June","July","August","September","October","November","December"],monthsShort:["msJan","msFeb","msMar","msApr","msMay","msJun","msJul","msAug","msSep","msOct","msNov","msDec"],days:["Sunday","Monday","Tuesday","Wednesday","Thursday","Friday","Saturday"],daysShort:["Sun","Mon","Tue","Wed","Thu","Fri","Sat"]},kinds:{unknown:"Unknown",directory:"Folder",group:"Selects",symlink:"Alias","symlink-broken":"AliasBroken","application/x-empty":"TextPlain","application/postscript":"Postscript","application/vnd.ms-office":"MsOffice","application/msword":"MsWord","application/vnd.ms-word":"MsWord","application/vnd.openxmlformats-officedocument.wordprocessingml.document":"MsWord","application/vnd.ms-word.document.macroEnabled.12":"MsWord","application/vnd.openxmlformats-officedocument.wordprocessingml.template":"MsWord","application/vnd.ms-word.template.macroEnabled.12":"MsWord","application/vnd.ms-excel":"MsExcel","application/vnd.openxmlformats-officedocument.spreadsheetml.sheet":"MsExcel","application/vnd.ms-excel.sheet.macroEnabled.12":"MsExcel","application/vnd.openxmlformats-officedocument.spreadsheetml.template":"MsExcel","application/vnd.ms-excel.template.macroEnabled.12":"MsExcel","application/vnd.ms-excel.sheet.binary.macroEnabled.12":"MsExcel","application/vnd.ms-excel.addin.macroEnabled.12":"MsExcel","application/vnd.ms-powerpoint":"MsPP","application/vnd.openxmlformats-officedocument.presentationml.presentation":"MsPP","application/vnd.ms-powerpoint.presentation.macroEnabled.12":"MsPP","application/vnd.openxmlformats-officedocument.presentationml.slideshow":"MsPP","application/vnd.ms-powerpoint.slideshow.macroEnabled.12":"MsPP","application/vnd.openxmlformats-officedocument.presentationml.template":"MsPP","application/vnd.ms-powerpoint.template.macroEnabled.12":"MsPP","application/vnd.ms-powerpoint.addin.macroEnabled.12":"MsPP","application/vnd.openxmlformats-officedocument.presentationml.slide":"MsPP","application/vnd.ms-powerpoint.slide.macroEnabled.12":"MsPP","application/pdf":"PDF","application/xml":"XML","application/vnd.oasis.opendocument.text":"OO","application/vnd.oasis.opendocument.text-template":"OO","application/vnd.oasis.opendocument.text-web":"OO","application/vnd.oasis.opendocument.text-master":"OO","application/vnd.oasis.opendocument.graphics":"OO","application/vnd.oasis.opendocument.graphics-template":"OO","application/vnd.oasis.opendocument.presentation":"OO","application/vnd.oasis.opendocument.presentation-template":"OO","application/vnd.oasis.opendocument.spreadsheet":"OO","application/vnd.oasis.opendocument.spreadsheet-template":"OO","application/vnd.oasis.opendocument.chart":"OO","application/vnd.oasis.opendocument.formula":"OO","application/vnd.oasis.opendocument.database":"OO","application/vnd.oasis.opendocument.image":"OO","application/vnd.openofficeorg.extension":"OO","application/x-shockwave-flash":"AppFlash","application/flash-video":"Flash video","application/x-bittorrent":"Torrent","application/javascript":"JS","application/rtf":"RTF","application/rtfd":"RTF","application/x-font-ttf":"TTF","application/x-font-otf":"OTF","application/x-rpm":"RPM","application/x-web-config":"TextPlain","application/xhtml+xml":"HTML","application/docbook+xml":"DOCBOOK","application/x-awk":"AWK","application/x-gzip":"GZIP","application/x-bzip2":"BZIP","application/x-xz":"XZ","application/zip":"ZIP","application/x-zip":"ZIP","application/x-rar":"RAR","application/x-tar":"TAR","application/x-7z-compressed":"7z","application/x-jar":"JAR","text/plain":"TextPlain","text/x-php":"PHP","text/html":"HTML","text/javascript":"JS","text/css":"CSS","text/rtf":"RTF","text/rtfd":"RTF","text/x-c":"C","text/x-csrc":"C","text/x-chdr":"CHeader","text/x-c++":"CPP","text/x-c++src":"CPP","text/x-c++hdr":"CPPHeader","text/x-shellscript":"Shell","application/x-csh":"Shell","text/x-python":"Python","text/x-java":"Java","text/x-java-source":"Java","text/x-ruby":"Ruby","text/x-perl":"Perl","text/x-sql":"SQL","text/xml":"XML","text/x-comma-separated-values":"CSV","text/x-markdown":"Markdown","image/x-ms-bmp":"BMP","image/jpeg":"JPEG","image/gif":"GIF","image/png":"PNG","image/tiff":"TIFF","image/x-targa":"TGA","image/vnd.adobe.photoshop":"PSD","image/xbm":"XBITMAP","image/pxm":"PXM","audio/mpeg":"AudioMPEG","audio/midi":"AudioMIDI","audio/ogg":"AudioOGG","audio/mp4":"AudioMPEG4","audio/x-m4a":"AudioMPEG4","audio/wav":"AudioWAV","audio/x-mp3-playlist":"AudioPlaylist","video/x-dv":"VideoDV","video/mp4":"VideoMPEG4","video/mpeg":"VideoMPEG","video/x-msvideo":"VideoAVI","video/quicktime":"VideoMOV","video/x-ms-wmv":"VideoWM","video/x-flv":"VideoFlash","video/x-matroska":"VideoMKV","video/ogg":"VideoOGG"},mimeTypes:{},rules:{defaults:function(e){return!(!e||e.added&&!Array.isArray(e.added)||e.removed&&!Array.isArray(e.removed)||e.changed&&!Array.isArray(e.changed))},open:function(t){return t&&t.cwd&&t.files&&e.isPlainObject(t.cwd)&&Array.isArray(t.files)},tree:function(e){return e&&e.tree&&Array.isArray(e.tree)},parents:function(e){return e&&e.tree&&Array.isArray(e.tree)},tmb:function(t){return t&&t.images&&(e.isPlainObject(t.images)||Array.isArray(t.images))},upload:function(t){return t&&(e.isPlainObject(t.added)||Array.isArray(t.added))},search:function(e){return e&&e.files&&Array.isArray(e.files)}},commands:{},cmdsToAdd:"archive duplicate extract mkdir mkfile paste rm upload",parseUploadData:function(t){var n,i=this;if(!e.trim(t))return{error:["errResponse","errDataEmpty"]};try{n=JSON.parse(t)}catch(a){return{error:["errResponse","errDataNotJSON"]}}return n=i.normalize(n),i.validResponse("upload",n)?(n.removed=e.merge(n.removed||[],e.map(n.added||[],function(e){return i.file(e.hash)?e.hash:null})),n):{error:n.norError||["errResponse"]}},iframeCnt:0,uploads:{xhrUploading:!1,failSyncTm:null,chunkfailReq:{},checkExists:function(t,n,i,a){var o,r=e.Deferred(),s=[],l={},c=function(){for(var e=t.length;--e>-1;)t[e]._remove=!0},d=function(){r.resolve(s,l)},p=function(){var r=[],p=[],u=n!==i.cwd().hash?i.path(n,!0)+i.option("separator",n):"",h=function(e){var n=e==p.length-1,o={cssClass:"elfinder-confirm-upload",title:i.i18n("cmdupload"),text:["errExists",u+p[e].name,"confirmRepl"],all:!n,accept:{label:"btnYes",callback:function(t){n||t?d():h(++e)}},reject:{label:"btnNo",callback:function(i){var a;if(i)for(a=p.length;e0&&delete o.reject,i.confirm(o)};return i.file(n).read?(o=e.map(t,function(e,t){return!e.name||i.UA.iOS&&"image.jpg"===e.name?null:{i:t,name:e.name}}),void i.request({data:{cmd:"ls",target:n,intersect:e.map(o,function(e){return e.name})},notify:{type:"preupload",cnt:1,hideCnt:!0},preventDefault:!0}).done(function(t){var a,s;t&&(t.error?c():i.options.overwriteUploadConfirm&&i.option("uploadOverwrite",n)&&t.list&&(Array.isArray(t.list)?r=t.list||[]:(a=[],r=e.map(t.list,function(e){return"string"==typeof e?e:(a=a.concat(e),!1)}),a.length&&(r=r.concat(a)),l=t.list),p=e.grep(o,function(t){return e.inArray(t.name,r)!==-1}),p.length&&r.length&&n==i.cwd().hash&&(s=e.map(i.files(n),function(e){return e.name}),e.grep(r,function(t){return e.inArray(t,s)===-1}).length&&i.sync()))),p.length>0?h(0):d()}).fail(function(e){c(),d(),e&&i.error(e)})):void d()};return i.api>=2.1&&"object"==typeof t[0]?p():d(),r},checkFile:function(t,n,i){if(t.checked||"files"==t.type)return t.files;if("data"==t.type){var a,o,r=e.Deferred(),s=e.Deferred(),l=[],c=[],d=0,p=[],u=!1,h=function(e){return Array.prototype.slice.call(e||[],0)},f=function(e){var t,i,a=n.options.folderUploadExclude[n.OS]||null,o=e.length,r=function(){--d<1&&"pending"===s.state()&&s.resolve()},m=function(e){a&&e.name.match(a)||(c.push(t.fullPath||""),l.push(e)),r()},i=function(e){var t=[],n=function(){e.readEntries(function(e){if(u||!e.length){for(var i=0;i=2.1&&(d++,p.push(t.fullPath),i(t.createReader())))}return r(),s};return a=e.map(t.files.items,function(e){return e.getAsEntry?e.getAsEntry():e.webkitGetAsEntry()}),e.each(a,function(e,t){if(t.isDirectory)return o=!0,!1}),a.length>0?(n.uploads.checkExists(a,i,n,o).done(function(o,s){var d=[];n.options.overwriteUploadConfirm&&n.option("uploadOverwrite",i)&&(null===o&&(t.overwrite=0,o=[]),a=e.grep(a,function(t){var a,r,l,c;return t.isDirectory&&o.length&&(a=e.inArray(t.name,o),a!==-1&&(o.splice(a,1),r=n.uniqueName(t.name+n.options.backupSuffix,null,""),e.each(s,function(e,n){if(t.name==n)return l=e,!1}),l||(l=n.fileByName(t.name,i).hash),n.lockfiles({files:[l]}),c=n.request({data:{cmd:"rename",target:l,name:r},notify:{type:"rename",cnt:1}}).fail(function(){t._remove=!0,n.sync()}).always(function(){n.unlockfiles({files:[l]})}),d.push(c))),!t._remove})),e.when.apply(e,d).done(function(){var e,t,i=+new Date;a.length>0?(t=n.escape(a[0].name),a.length>1&&(t+=" ... "+a.length+n.i18n("items")),e=setTimeout(function(){n.notify({type:"readdir",id:i,cnt:1,hideCnt:!0,msg:n.i18n("ntfreaddir")+" ("+t+")",cancel:function(){u=!0}})},n.options.notifyDelay),f(a).done(function(){e&&clearTimeout(e),n.notify({type:"readdir",id:i,cnt:-1}),u?r.reject():r.resolve([l,c,o,s,p])}).fail(function(){r.reject()})):r.reject()})}),r.promise()):r.reject()}var m=[],g=[],v=t.files[0];if("html"==t.type){var b,y=e("").append(e.parseHTML(v.replace(/ src=/gi," _elfsrc=")));e("img[_elfsrc]",y).each(function(){var n,i,a=e(this),o=a.closest("a");o&&o.attr("href")&&o.attr("href").match(/\.(?:jpe?g|gif|bmp|png)/i)&&(i=o.attr("href")),n=a.attr("_elfsrc"),n&&(i?(e.inArray(i,m)==-1&&m.push(i),e.inArray(n,g)==-1&&g.push(n)):e.inArray(n,m)==-1&&m.push(n)),1===m.length&&m[0].match(/^data:image\/png/)&&(t.clipdata=!0)}),b=e("a[href]",y),b.each(function(){var t,n,i=function(e){var t=document.createElement("a");return t.href=e,t};(t=e(this).text())&&(n=i(e(this).attr("href")),n.href&&n.href.match(/^(?:ht|f)tp/i)&&(1===b.length||!n.pathname.match(/(?:\.html?|\/[^\/.]*)$/i)||e.trim(t).match(/\.[a-z0-9-]{1,10}$/i))&&e.inArray(n.href,m)==-1&&e.inArray(n.href,g)==-1&&m.push(n.href))})}else{var w,x,k;for(w=/((?:ht|f)tps?:\/\/[-_.!~*\'()a-z0-9;\/?:\@&=+\$,%#\*\[\]]+)/gi;x=w.exec(v);)k=x[1].replace(/&/g,"&"),e.inArray(k,m)==-1&&m.push(k)}return m},xhr:function(t,n){var i=n?n:this,a=i.getUI(),o=new XMLHttpRequest,r=null,s=null,l=null,c=t.checked,d=t.isDataType||"data"==t.type,p=t.target||i.cwd().hash,u=t.dropEvt||null,h=t.extraData||null,f=i.option("uploadMaxConn",p)!=-1,m=Math.min(5,Math.max(1,i.option("uploadMaxConn",p))),g=1e4,v=30,b=0,y=function(t){var n=e.Deferred();return t.promise?t.always(function(e){n.resolve(Array.isArray(e)&&e.length?d?e[0][0]:e[0]:{})}):n.resolve(t.length?d?t[0][0]:t[0]:{}),n},w=e.Deferred().fail(function(e){var t,a=i.parseError(e);"userabort"===a&&(t=!0,a=void 0),k&&(i.uploads.xhrUploading||t)?y(k).done(function(e){t||H(a,e),e._cid?i.uploads.chunkfailReq[e._cid]||(i.uploads.chunkfailReq[e._cid]=!0,setTimeout(function(){n.request({data:{cmd:"upload",target:p,chunk:e._chunk,cid:e._cid,upload:["chunkfail"],mimes:"chunkfail"},options:{type:"post",url:i.uploadURL},preventDefault:!0}).always(function(){delete i.uploads.chunkfailReq[e._chunk]})},1e3)):(i.uploads.failSyncTm&&clearTimeout(i.uploads.failSyncTm),i.uploads.failSyncTm=setTimeout(function(){i.sync(p)},1e3))}):H(a),!t&&i.sync(),i.uploads.xhrUploading=!1,k=null}).done(function(t){i.uploads.xhrUploading=!1,k=null,t&&(i.currentReqCmd="upload",t.warning&&H(t.warning),i.updateCache(t),t.removed&&t.removed.length&&i.remove(t),t.added&&t.added.length&&i.add(t),t.changed&&t.changed.length&&i.change(t),i.trigger("upload",t,!1),i.trigger("uploaddone"),t.toasts&&Array.isArray(t.toasts)&&e.each(t.toasts,function(){this.msg&&i.toast(this)}),t.sync&&i.sync(),t.debug&&(i.responseDebug(t),n.debug("backend-debug",t)))}).always(function(){i.abortXHR(o),a.off("uploadabort",D),e(window).off("unload",D),r&&clearTimeout(r),s&&clearTimeout(s),l&&clearTimeout(l),c&&!t.multiupload&&F()&&i.notify({type:"upload",cnt:-C,progress:0,size:0}),s&&M&&i.notify({type:"chunkmerge",cnt:-C}),B&&O.children(".elfinder-notify-chunkmerge").length&&i.notify({type:"chunkmerge",cnt:-1})}),x=new FormData,k=t.input?t.input.files:i.uploads.checkFile(t,i,p),C=t.checked&&d?k[0].length:k.length,z=!1,T=0,A=0,j=0,S=!1,O=i.ui.notify,I=!0,M=!1,E=!1,F=function(){return!S&&($=O.children(".elfinder-notify-upload")).length&&(S=!0),S},D=function(e,t){E=!0,i.abortXHR(o,{quiet:!0,abort:!0}),w.reject(t),F()&&i.notify({type:"upload",cnt:$.data("cnt")*-1,progress:0,size:0})},U=function(e,t){$.children(".elfinder-notify-cancel")[e?"show":"hide"](),I=e},P=function(e){return e||(e=j),setTimeout(function(){S=!0,i.notify({type:"upload",cnt:C,progress:T-A,size:e,cancel:function(){a.trigger("uploadabort","userabort")}}),$=O.children(".elfinder-notify-upload"),A=T,t.multiupload?I&&U(!0):U(I&&T=2.1029&&(e=(+new Date).toString(16)+Math.floor(1e3*Math.random()).toString(16),"function"==typeof x["delete"]&&x["delete"]("reqid"),x.append("reqid",e),o._requestId=e),o.send(x))},g)):a.trigger("uploadabort",["errAbort","errTimeout"])},R=function(){S&&w.notifyWith($,[{cnt:$.data("cnt"),progress:$.data("progress"),total:$.data("total")}])},H=function(e,t,n){e&&i.trigger("xhruploadfail",{error:e,file:t}),n?e&&(N=i.options.maxErrorDialogs&&(_=_.concat("moreErrors",N-i.options.maxErrorDialogs)),i.error(_)),_=[],N=0)},_=[],N=0,L=t.renames||null,W=t.hashes||null,B=!1,$=e();if(a.one("uploadabort",D),e(window).one("unload."+n.namespace,D),!B&&(A=T),!d&&!C)return w.reject(["errUploadNoFiles"]);o.addEventListener("error",function(){0==o.status?E?w.reject():!d&&t.files&&e.grep(t.files,function(e){return!e.type&&e.size===(i.UA.Safari?1802:0)}).length?w.reject(["errAbort","errFolderUpload"]):t.input&&e.grep(t.input.files,function(e){return!e.type&&e.size===(i.UA.Safari?1802:0)}).length?w.reject(["errUploadNoFiles"]):q():a.trigger("uploadabort","errConnect")},!1),o.addEventListener("load",function(e){var n,s,c=o.status,p=0,u="";if(i.setCustomHeaderByXhr(o),c>=400?u=c>500?"errResponse":["errResponse","errServerError"]:o.responseText||(u=["errResponse","errDataEmpty"]),u&&(a.trigger("uploadabort"),y(k||{}).done(function(e){return w.reject(e._cid?null:u)})),T=j,F()&&(p=T-A)&&(i.notify({type:"upload",cnt:0,progress:p,size:0}),R()),n=i.parseUploadData(o.responseText),n._chunkmerged){x=new FormData;var h=[{_chunkmerged:n._chunkmerged,_name:n._name,_mtime:n._mtime}];return B=!0,a.off("uploadabort",D),l=setTimeout(function(){i.notify({type:"chunkmerge",cnt:1})},i.options.notifyDelay),void(d?V(h,k[1]):V(h))}n._multiupload=!!t.multiupload,n.error?(s={cmd:"upload",err:n,xhr:o,rc:o.status},i.trigger("uploadfail",n),i.trigger("requestError",s),s._getEvent&&s._getEvent().isDefaultPrevented()&&(n.error=""),n._chunkfailure||n._multiupload?(E=!0,i.uploads.xhrUploading=!1,r&&clearTimeout(r),$.length?(i.notify({type:"upload",cnt:-C,progress:0,size:0}),w.reject(n)):w.reject()):w.reject(n)):w.resolve(n)},!1),o.upload.addEventListener("loadstart",function(e){!B&&e.lengthComputable&&(T=e.loaded,b&&(T=0),j=e.total,T||(T=parseInt(.05*j)),F()&&(i.notify({type:"upload",cnt:0,progress:T-A,size:t.multiupload?0:j}),A=T,R()))},!1),o.upload.addEventListener("progress",function(e){var n;e.lengthComputable&&!B&&o.readyState<2&&(T=e.loaded,!t.checked&&T>0&&!r&&(r=P(o._totalSize-T)),j||(j=e.total,T||(T=parseInt(.05*j))),n=T-A,F()&&n/e.total>=.05&&(i.notify({type:"upload",cnt:0,progress:n,size:0}),A=T,R()),!M&&T>=j&&!z&&(M=!0,s=setTimeout(function(){i.notify({type:"chunkmerge",cnt:C})},i.options.notifyDelay)),I&&!t.multiupload&&T>=j&&F()&&U(!1))},!1);var V=function(a,s){var l,g,v,b,y,k,T,A,j,S,O,M,D,q,R,N=0,B=1,$=[],V=0,K=C,X=0,J=[],G=(new Date).getTime().toString().substr(-9),Y=Math.min((n.uplMaxSize?n.uplMaxSize:2097152)-8190,n.options.uploadMaxChunkSize),Q=!f&&"",Z=function(a,o){var s,l,c,h=[],f=0;if(!E){for(;a.length&&h.length=2.1&&("slice"in j?Q="slice":"mozSlice"in j?Q="mozSlice":"webkitSlice"in j&&(Q="webkitSlice")))}catch(te){C--,K--;continue}if(l&&g>l||!Q&&n.uplMaxSize&&g>n.uplMaxSize)H(["errUploadFile",j.name,"errUploadFileSize"],j,!0),C--,K--;else if(!j.type||i.uploadMimeCheck(j.type,p))if(Q&&g>Y){for(k=0,T=Y,A=-1,K=Math.floor((g-1)/Y),v=j.lastModified?Math.round(j.lastModified/1e3):0,b=t.clipdata?n.date(n.nonameDateFormat)+".png":j.name,X+=g,J[G]=0;kn.uplMaxSize||B>n.uplMaxFile)&&(N=0,B=1,V++),"undefined"==typeof $[V]&&($[V]=[],d&&($[V][0]=[],$[V][1]=[])),d?($[V][0].push(j),$[V][1].push(s[y])):$[V].push(j),N+=g,X+=g,B++;else H(["errUploadFile",j.name,"errUploadMime","("+j.type+")"],j,!0),C--,K--}if(_.length&&H(),0==$.length)return t.checked=!0,!1;if($.length>1)return r=P(X),O=[],M=0,D=$.length,q=[],ee(),!0;d?(a=$[0][0],s=$[0][1]):a=$[0]}return c||(n.UA.Safari&&t.files?o._totalSize=X:r=P(X)),c=!0,a.length||w.reject(["errUploadNoFiles"]),o.open("POST",i.uploadURL,!0),n.customHeaders&&e.each(n.customHeaders,function(e){o.setRequestHeader(e,this)}),n.xhrFields&&e.each(n.xhrFields,function(e){e in o&&(o[e]=this)}),i.api>=2.1029&&(R=(+new Date).toString(16)+Math.floor(1e3*Math.random()).toString(16),x.append("reqid",R),o._requestId=R),x.append("cmd","upload"),x.append(i.newAPI?"target":"current",p),L&&L.length&&(e.each(L,function(e,t){x.append("renames[]",t)}),x.append("suffix",n.options.backupSuffix)),W&&e.each(W,function(e,t){x.append("hashes["+e+"]",t)}),e.each(i.customData,function(e,t){x.append(e,t)}),e.each(i.options.onlyMimes,function(e,t){x.append("mimes[]",t)}),e.each(a,function(e,i){var a,o;i._chunkmerged?(x.append("chunk",i._chunkmerged),x.append("upload[]",i._name),x.append("mtime[]",i._mtime),t.clipdata&&x.append("overwrite",0),z=!0):(i._chunkfail?(x.append("upload[]","chunkfail"),x.append("mimes","chunkfail")):(t.clipdata?i._chunk||(t.overwrite=0,a=n.date(n.nonameDateFormat)+".png"):i.name&&(a=i.name,n.UA.iOS&&(a.match(/^image\.jpe?g$/i)?(t.overwrite=0,a=n.date(n.nonameDateFormat)+".jpg"):a.match(/^capturedvideo\.mov$/i)&&(t.overwrite=0,a=n.date(n.nonameDateFormat)+".mov")),o=(i.webkitRelativePath||i.relativePath||i._relativePath||"").replace(/[^\/]+$/,""),a=o+a),a?x.append("upload[]",i,a):x.append("upload[]",i)),i._chunk?(x.append("chunk",i._chunk),x.append("cid",i._cid),x.append("range",i._range),x.append("mtime[]",i._mtime),z=!0):x.append("mtime[]",i.lastModified?Math.round(i.lastModified/1e3):0))}),d&&e.each(s,function(e,t){x.append("upload_path[]",t)}),0===t.overwrite&&x.append("overwrite",0),u&&x.append("dropWith",parseInt((u.altKey?"1":"0")+(u.ctrlKey?"1":"0")+(u.metaKey?"1":"0")+(u.shiftKey?"1":"0"),2)),h&&e.each(h,function(e,t){x.append(e,t)}),o.send(x),!0};if(d)c?V(k[0],k[1]):k.done(function(t){if(L=[],C=t[0].length){if(t[4]&&t[4].length)return void n.request({data:{cmd:"mkdir",target:p,dirs:t[4]},notify:{type:"mkdir",cnt:t[4].length},preventFail:!0}).fail(function(e){e=e||["errUnknown"],"errCmdParams"===e[0]?m=1:(m=0,w.reject(e))}).done(function(n){var i=!1;n.hashes||(n.hashes={}),t[1]=e.map(t[1],function(e,a){return t[0][a]._relativePath=e.replace(/^\//,""),e=e.replace(/\/[^\/]*$/,""),""===e?p:n.hashes[e]?n.hashes[e]:(i=!0,t[0][a]._remove=!0,null)}),i&&(t[0]=e.grep(t[0],function(e){return!e._remove}))}).always(function(e){m&&(L=t[2],W=t[3],V(t[0],t[1]))});t[1]=e.map(t[1],function(){return p}),L=t[2],W=t[3],V(t[0],t[1])}else w.reject(["errUploadNoFiles"])}).fail(function(){w.reject()});else if(k.length>0)if(t.clipdata||null!=L)V(k)||w.reject();else{var K=[],X=[],J=n.options.folderUploadExclude[n.OS]||null;e.each(k,function(t,n){var i,a,o=n.webkitRelativePath||n.relativePath||"";return!!o&&(J&&n.name.match(J)?(n._remove=!0,o=void 0):(o="/"+o.replace(/\/[^\/]*$/,"").replace(/^\//,""),o&&e.inArray(o,K)===-1&&(K.push(o),i=o.substr(1).indexOf("/"),i!==-1&&(a=o.substr(0,i+1))&&e.inArray(a,K)===-1&&K.unshift(a))),void X.push(o))}),L=[],W={},K.length?!function(){var t=e.map(K,function(e){return e.substr(1).indexOf("/")===-1?{name:e.substr(1)}:null}),i=[];n.uploads.checkExists(t,p,n,!0).done(function(a,o){var r,s,l,c=[];n.options.overwriteUploadConfirm&&n.option("uploadOverwrite",p)&&(i=e.map(t,function(e){return e._remove?e.name:null}),t=e.grep(t,function(e){return!e._remove})),i.length&&e.each(X.concat(),function(t,n){0===e.inArray(n,i)&&(k[t]._remove=!0,X[t]=void 0)}),k=e.grep(k,function(e){return!e._remove}),X=e.grep(X,function(e){return void 0!==e}),t.length?(r=e.Deferred(),a.length?e.each(a,function(t,i){s=n.uniqueName(i+n.options.backupSuffix,null,""),e.each(o,function(e,t){if(a[0]==t)return l=e,!1}),l||(l=n.fileByName(a[0],p).hash),n.lockfiles({files:[l]}),c.push(n.request({data:{cmd:"rename",target:l,name:s},notify:{type:"rename",cnt:1}}).fail(function(e){w.reject(e),n.sync()}).always(function(){n.unlockfiles({files:[l]})}))}):c.push(null),e.when.apply(e,c).done(function(){n.request({data:{cmd:"mkdir",target:p,dirs:K},notify:{type:"mkdir",cnt:K.length},preventFail:!0}).fail(function(e){e=e||["errUnknown"],"errCmdParams"===e[0]?m=1:(m=0,w.reject(e))}).done(function(t){var n=!1;t.hashes||(t.hashes={}),X=e.map(X.concat(),function(e,i){return"/"===e?p:t.hashes[e]?t.hashes[e]:(n=!0,k[i]._remove=!0,null)}),n&&(k=e.grep(k,function(e){return!e._remove}))}).always(function(e){m&&(d=!0,V(k,X)||w.reject())})})):w.reject()})}():n.uploads.checkExists(k,p,n).done(function(i,a){n.options.overwriteUploadConfirm&&n.option("uploadOverwrite",p)&&(W=a,null===i?t.overwrite=0:L=i,k=e.grep(k,function(e){return!e._remove})),C=k.length,C>0?V(k)||w.reject():w.reject()})}else w.reject();return w},iframe:function(t,n){var i,a,o,r,s=n?n:this,l=!!t.input&&t.input,c=!l&&s.uploads.checkFile(t,s),d=e.Deferred().fail(function(e){e&&s.error(e)}),p="iframe-"+n.namespace+ ++s.iframeCnt,u=e('
          '),h=this.UA.IE,f=function(){r&&clearTimeout(r),o&&clearTimeout(o),a&&s.notify({type:"upload",cnt:-i}),setTimeout(function(){h&&e('').appendTo(u),u.remove(),m.remove()},100)},m=e('').on("load",function(){m.off("load").on("load",function(){f(),d.resolve()}),o=setTimeout(function(){a=!0,s.notify({type:"upload",cnt:i})},s.options.notifyDelay),s.options.iframeTimeout>0&&(r=setTimeout(function(){f(),d.reject(["errConnect","errTimeout"])},s.options.iframeTimeout)),u.submit()}),g=t.target||s.cwd().hash,v=[],b=[],y=[],w={};if(c&&c.length)e.each(c,function(e,t){u.append('')}),i=1;else{if(!(l&&e(l).is(":file")&&e(l).val()))return d.reject();n.options.overwriteUploadConfirm&&n.option("uploadOverwrite",g)&&(v=l.files?l.files:[{name:e(l).val().replace(/^(?:.+[\\\/])?([^\\\/]+)$/,"$1")}],b.push(s.uploads.checkExists(v,g,s).done(function(n,a){w=a,null===n?t.overwrite=0:(y=n, +i=e.grep(v,function(e){return!e._remove}).length,i!=v.length&&(i=0))}))),i=l.files?l.files.length:1,u.append(l)}return e.when.apply(e,b).done(function(){return i<1?d.reject():(u.append('').append('').append('').append(e(l).attr("name","upload[]")),y.length>0&&(e.each(y,function(e,t){u.append('')}),u.append('')),w&&e.each(y,function(e,t){u.append('')}),0===t.overwrite&&u.append(''),e.each(s.options.onlyMimes||[],function(e,t){u.append('')}),e.each(s.customData,function(e,t){u.append('')}),u.appendTo("body"),void m.appendTo("body"))}),d}},one:function(e,t,n){var i=this,a=e.toLowerCase(),o=function(e,n){return i.toUnbindEvents[a]||(i.toUnbindEvents[a]=[]),i.toUnbindEvents[a].push({type:a,callback:o}),(t.done?t.done:t).apply(this,arguments)};return t.done&&(o={done:o}),this.bind(a,o,n)},localStorage:function(t,n){var i,a,o,r,s,l=this,c=window.localStorage,d="elfinder-"+(t||"")+this.id,p=window.location.pathname+"-elfinder-",u=this.id,h=[];if("undefined"==typeof t)return r=p.length,s=u.length*-1,e.each(c,function(e){e.substr(0,r)===p&&e.substr(s)===u&&h.push(e)}),e.each(h,function(e,t){c.removeItem(t)}),!0;if(t=p+t+u,null===n)return c.removeItem(t);if(void 0===n&&!(i=c.getItem(t))&&(a=c.getItem(d))&&(n=a,c.removeItem(d)),void 0!==n){o=typeof n,"string"!==o&&"number"!==o&&(n=JSON.stringify(n));try{c.setItem(t,n)}catch(f){try{c.clear(),c.setItem(t,n)}catch(f){l.debug("error",f.toString())}}i=c.getItem(t)}if(i&&("{"===i.substr(0,1)||"["===i.substr(0,1)))try{return JSON.parse(i)}catch(f){}return i},sessionStorage:function(e,t){var n,i,a,o=this;try{n=window.sessionStorage}catch(r){}if(n){if(null===t)return n.removeItem(e);if(void 0!==t){a=typeof t,"string"!==a&&"number"!==a&&(t=JSON.stringify(t));try{n.setItem(e,t)}catch(r){try{n.clear(),n.setItem(e,t)}catch(r){o.debug("error",r.toString())}}}if(i=n.getItem(e),i&&("{"===i.substr(0,1)||"["===i.substr(0,1)))try{return JSON.parse(i)}catch(r){}return i}},cookie:function(t,n){var i,a,o,r,s,l;if(t="elfinder-"+t+this.id,void 0===n){if(this.cookieEnabled&&document.cookie&&""!=document.cookie)for(o=document.cookie.split(";"),t+="=",r=0;r"),escape:function(e){return this._node.text(e).html().replace(/"/g,""").replace(/'/g,"'")},normalize:function(t){var n,i,a,o,r,s=this,l=function(){var e,t;return(t=s.options.fileFilter)&&("function"==typeof t?e=function(e){return t.call(s,e)}:t instanceof RegExp&&(e=function(e){return t.test(e.name)})),e?e:null}(),c=function(t){var n;t.uiCmdMap&&(e.isPlainObject(t.uiCmdMap)&&Object.keys(t.uiCmdMap).length?(t.disabledFlip||(t.disabledFlip={}),n=t.disabledFlip,e.each(t.uiCmdMap,function(e,i){"hidden"!==i||n[e]||(t.disabled.push(e),t.disabledFlip[e]=!0)})):delete t.uiCmdMap)},d=function(t){var n=function(e){var t=typeof e;return"object"===t&&Array.isArray(e)&&(t="array"),t};return e.each(s.optionProperties,function(e,i){void 0!==i&&t[e]&&n(t[e])!==n(i)&&(t[e]=i)}),t.disabled?(t.disabledFlip=s.arrayFlip(t.disabled,!0),e.each(s.options.disabledCmdsRels,function(n,i){var a,o;t.disabledFlip[n]?o=!0:(a=n.match(/^([^&]+)&([^=]+)=(.*)$/))&&t.disabledFlip[a[1]]&&t[a[2]]==a[3]&&(o=!0),o&&e.each(i,function(e,n){t.disabledFlip[n]||(t.disabledFlip[n]=!0,t.disabled.push(n))})})):t.disabledFlip={},t},p=function(t,r,p){var u,h,m,g,v=!r||t,b=!!r&&null;if(t&&t.hash&&t.name&&t.mime){if("application/x-empty"===t.mime&&(t.mime="text/plain"),m=s.isRoot(t),m&&!t.volumeid&&s.debug("warning","The volume root statuses requires `volumeid` property."),m||"directory"===t.mime){if(t.phash){if(t.phash===t.hash)return f=f.concat(['Parent folder of "$1" is itself.',t.name]),b;if(m&&t.volumeid&&0===t.phash.indexOf(t.volumeid))return f=f.concat(['Parent folder of "$1" is inner itself.',t.name]),b}t.volumeid&&(u=t.volumeid,m&&(t.phash&&(s.leafRoots[t.phash]?e.inArray(t.hash,s.leafRoots[t.phash])===-1&&s.leafRoots[t.phash].push(t.hash):s.leafRoots[t.phash]=[t.hash]),s.hasVolOptions=!0,s.volOptions[u]||(s.volOptions[u]={dispInlineRegex:s.options.dispInlineRegex}),h=s.volOptions[u],t.options&&Object.assign(h,t.options),t.disabled&&(h.disabled=t.disabled,h.disabledFlip=s.arrayFlip(t.disabled,!0)),t.tmbUrl&&(h.tmbUrl=t.tmbUrl),h.url&&"/"!==h.url.substr(-1)&&(h.url+="/"),c(h),h.trashHash&&(s.trashes[h.trashHash]===!1?delete h.trashHash:s.trashes[h.trashHash]=t.hash),e.each(s.optionProperties,function(e){h[e]&&(t[e]=h[e])}),"cwd"!==p&&(s.roots[u]=t.hash),t.expires&&(s.volumeExpires[u]=t.expires)),o!==u&&(o=u,a=s.option("i18nFolderName",u))),m&&!t.i18&&(n="volume_"+t.name,i=s.i18n(!1,n),n!==i&&(t.i18=i)),a&&!t.i18&&(n="folder_"+t.name,i=s.i18n(!1,n),n!==i&&(t.i18=i)),m&&(g=s.storage("rootNames"))&&(g[t.hash]&&(t._name=t.name,t._i18=t.i18,t.name=g[t.hash]=g[t.hash],delete t.i18),s.storage("rootNames",g)),s.trashes[t.hash]&&(t.locked=!0)}else{if(l)try{if(!l(t))return b}catch(y){s.debug(y)}0==t.size&&(t.mime=s.getMimetype(t.name,t.mime))}return t.options&&(s.optionsByHashes[t.hash]=d(t.options)),delete t.options,v}return b},u=function(t){var n=[];return e.each(s.files(),function(i,a){e.each(s.parents(i),function(a,o){if(e.inArray(o,t)!==-1&&e.inArray(i,t)===-1)return n.push(i),!1})}),n},h=function(n,i){e.each(n,function(n,a){var o,r;s.leafRoots[a.hash]&&s.applyLeafRootStats(a),"change"!==i&&a.phash&&s.isRoot(a)&&(o=s.file(a.phash))&&(s.applyLeafRootStats(o),t.changed?(e.each(t.changed,function(e,n){if(n.hash===o.hash)return t.changed[e]=o,r=!0,!1}),r||t.changed.push(o)):t.changed=[o])})},f=[];if(t.customData&&(!s.prevCustomData||JSON.stringify(t.customData)!==JSON.stringify(s.prevCustomData))){s.prevCustomData=t.customData;try{r=JSON.parse(t.customData),e.isPlainObject(r)&&(s.prevCustomData=r,e.each(Object.keys(r),function(e,t){null===r[t]&&(delete r[t],delete s.optsCustomData[t])}),s.customData=Object.assign({},s.optsCustomData,r))}catch(m){}}return t.options&&d(t.options),t.cwd&&(t.cwd.volumeid&&t.options&&Object.keys(t.options).length&&s.isRoot(t.cwd)&&(s.hasVolOptions=!0,s.volOptions[t.cwd.volumeid]=t.options),t.cwd=p(t.cwd,!0,"cwd")),t.files&&(t.files=e.grep(t.files,p)),t.tree&&(t.tree=e.grep(t.tree,p)),t.added&&(t.added=e.grep(t.added,p)),t.changed&&(t.changed=e.grep(t.changed,p)),t.removed&&t.removed.length&&2===s.searchStatus.state&&(t.removed=t.removed.concat(u(t.removed))),t.api&&(t.init=!0),Object.keys(s.leafRoots).length&&(t.files&&h(t.files),t.tree&&h(t.tree),t.added&&h(t.added),t.changed&&h(t.changed,"change")),t.cwd&&t.cwd.options&&t.options&&Object.assign(t.options,d(t.cwd.options)),t.options&&t.options.url&&"/"!==t.options.url.substr(-1)&&(t.options.url+="/"),f.length&&(t.norError=["errResponse"].concat(f)),t},setSort:function(e,t,n,i){this.storage("sortType",this.sortType=this.sortRules[e]?e:"name"),this.storage("sortOrder",this.sortOrder=/asc|desc/.test(t)?t:"asc"),this.storage("sortStickFolders",(this.sortStickFolders=!!n)?1:""),this.storage("sortAlsoTreeview",(this.sortAlsoTreeview=!!i)?1:""),this.trigger("sortchange")},_sortRules:{name:function(e,t){return i.prototype.naturalCompare(e.i18||e.name,t.i18||t.name)},size:function(e,t){var n=parseInt(e.size)||0,i=parseInt(t.size)||0;return n===i?0:n>i?1:-1},kind:function(e,t){return i.prototype.naturalCompare(e.mime,t.mime)},date:function(e,t){var n=e.ts||e.date||0,i=t.ts||t.date||0;return n===i?0:n>i?1:-1},perm:function(e,t){var n=function(e){return(e.write?2:0)+(e.read?1:0)},i=n(e),a=n(t);return i===a?0:i>a?1:-1},mode:function(e,t){var n=e.mode||e.perm||"",a=t.mode||t.perm||"";return i.prototype.naturalCompare(n,a)},owner:function(e,t){var n=e.owner||"",a=t.owner||"";return i.prototype.naturalCompare(n,a)},group:function(e,t){var n=e.group||"",a=t.group||"";return i.prototype.naturalCompare(n,a)}},sorters:{},naturalCompare:function(e,t){var n=i.prototype.naturalCompare;return"undefined"==typeof n.loc&&(n.loc=navigator.userLanguage||navigator.browserLanguage||navigator.language||"en-US"),"undefined"==typeof n.sort&&("11".localeCompare("2",n.loc,{numeric:!0})>0?window.Intl&&window.Intl.Collator?n.sort=new Intl.Collator(n.loc,{numeric:!0}).compare:n.sort=function(e,t){return e.localeCompare(t,n.loc,{numeric:!0})}:(n.sort=function(e,t){var i,a,o=/(^-?[0-9]+(\.?[0-9]*)[df]?e?[0-9]?$|^0x[0-9a-f]+$|[0-9]+)/gi,r=/(^[ ]*|[ ]*$)/g,s=/(^([\w ]+,?[\w ]+)?[\w ]+,?[\w ]+\d+:\d+(:\d+)?[\w ]?|^\d{1,4}[\/\-]\d{1,4}[\/\-]\d{1,4}|^\w+, \w+ \d+, \d{4})/,l=/^0x[0-9a-f]+$/i,c=/^0/,d=/^[\x01\x21-\x2f\x3a-\x40\x5b-\x60\x7b-\x7e]/,p=function(e){return n.sort.insensitive&&(""+e).toLowerCase()||""+e},u=p(e).replace(r,"").replace(/^_/,"")||"",h=p(t).replace(r,"").replace(/^_/,"")||"",f=u.replace(o,"\0$1\0").replace(/\0$/,"").replace(/^\0/,"").split("\0"),m=h.replace(o,"\0$1\0").replace(/\0$/,"").replace(/^\0/,"").split("\0"),g=parseInt(u.match(l))||1!=f.length&&u.match(s)&&Date.parse(u),v=parseInt(h.match(l))||g&&h.match(s)&&Date.parse(h)||null,b=0;if(v){if(gv)return 1}for(var y=0,w=Math.max(f.length,m.length);ya)return 1}return 0},n.sort.insensitive=!0)),n.sort(e,t)},compare:function(e,t){var n,i=this,a=i.sortType,o="asc"==i.sortOrder,r=i.sortStickFolders,s=i.sortRules,l=s[a],c="directory"==e.mime,d="directory"==t.mime;if(r){if(c&&!d)return-1;if(!c&&d)return 1}return n=o?l(e,t):l(t,e),"name"!==a&&0===n?n=o?s.name(e,t):s.name(t,e):n},sortFiles:function(e){return e.sort(this.compare)},notify:function(t){var n,i,a,o=this,r=t.type,s=t.id?"elfinder-notify-"+t.id:"",l=this.i18n("undefined"!=typeof t.msg?t.msg:this.messages["ntf"+r]?"ntf"+r:"ntfsmth"),c=this.arrayFlip(this.options.notifyDialog.hiddens||[]),d=this.ui.notify,p=d.closest(".ui-dialog"),u=d.children(".elfinder-notify-"+r+(s?"."+s:"")),h=u.children("div.elfinder-notify-cancel").children("button"),f='
          {msg}
          ',m=t.cnt+0,g="undefined"!=typeof t.size?parseInt(t.size):null,v="undefined"!=typeof t.progress&&t.progress>=0?t.progress:null,b=t.fakeinterval||200,y=t.cancel,w="ui-state-hover",x=function(){var t=u.find(".elfinder-notify-progress"),n=function(){u.remove(),d.children(p.data("minimized")?void 0:":visible").length||(p.data("minimized")?p.data("minimized").hide():d.elfinderdialog("close")),C()};u._esc&&e(document).off("keydown",u._esc),u.data("cur")<100?t.animate({width:"100%"},50,function(){requestAnimationFrame(function(){n()})}):n()},k=function(e){var t;u.length&&(t=u.data("cur")+1,t<=98&&(u.find(".elfinder-notify-progress").width(t+"%"),u.data("cur",t),C(),setTimeout(function(){e*=1.05,k(e)},e)))},C=function(){var t,n=0,i=0,a=d.children(".elfinder-notify");a.length?(a.each(function(){n++,i+=Math.min(e(this).data("cur"),100)}),t=n?Math.floor(i/(100*n)*100)+"%":0,o.ui.progressbar.width(t),p.data("minimized")&&(p.data("minimized").title(t),p.data("minimized").dialog().children(".ui-dialog-titlebar").children(".elfinder-ui-progressbar").width(t))):(o.ui.progressbar.width(0),p.data("minimized")&&p.data("minimized").hide())};return r?(u.length?"undefined"!=typeof t.msg&&u.children("span.elfinder-notify-msg").html(l):(u=e(f.replace(/\{type\}/g,r).replace(/\{msg\}/g,l)),c[r]?u.hide():d.on("minimize",function(e){p.data("minimized")&&C()}),u.appendTo(d).data("cnt",0),null!=v?u.data({progress:0,total:0,cur:0}):(u.data({cur:0}),k(b)),y&&(h=e('').on("mouseenter mouseleave",function(t){e(this).toggleClass(w,"mouseenter"===t.type)}),u.children("div.elfinder-notify-cancel").append(h)),d.trigger("resize")),n=m+parseInt(u.data("cnt")),n>0?(y&&h.length&&(e.isFunction(y)||"object"==typeof y&&y.promise)&&(u._esc=function(t){"keydown"==t.type&&t.keyCode!=e.ui.keyCode.ESCAPE||(t.preventDefault(),t.stopPropagation(),x(),y.promise?y.reject(0):y(t))},h.on("click",function(e){u._esc(e)}),e(document).on("keydown."+this.namespace,u._esc)),!t.hideCnt&&u.children(".elfinder-notify-cnt").text("("+n+")"),m>0&&d.is(":hidden")&&!c[r]&&(p.data("minimized")?p.data("minimized").show():d.elfinderdialog("open",this).height("auto")),u.data("cnt",n),null!=v&&(i=u.data("total"))>=0&&(a=u.data("progress"))>=0&&(i+=null!=g?g:m,a+=v,null==g&&m<0&&(a+=100*m),u.data({progress:a,total:i}),null!=g&&(a*=100,i=Math.max(1,i)),v=Math.min(parseInt(a/i),100),u.find(".elfinder-notify-progress").animate({width:(v<100?v:100)+"%"},20,function(){u.data("cur",v),C()}))):x(),this):this},confirm:function(t){var n,i,a=this,o=!1,r={cssClass:"elfinder-dialog-confirm",modal:!0,resizable:!1,title:this.i18n(t.title||"confirmReq"),buttons:{},close:function(){!o&&t.cancel.callback(),e(this).elfinderdialog("destroy")}},s=this.i18n("apllyAll");return t.cssClass&&(r.cssClass+=" "+t.cssClass),r.buttons[this.i18n(t.accept.label)]=function(){t.accept.callback(!(!n||!n.prop("checked"))),o=!0,e(this).elfinderdialog("close")},r.buttons[this.i18n(t.accept.label)]._cssClass="elfinder-confirm-accept",t.reject&&(r.buttons[this.i18n(t.reject.label)]=function(){t.reject.callback(!(!n||!n.prop("checked"))),o=!0,e(this).elfinderdialog("close")},r.buttons[this.i18n(t.reject.label)]._cssClass="elfinder-confirm-reject"),t.buttons&&t.buttons.length>0&&(i=1,e.each(t.buttons,function(t,s){r.buttons[a.i18n(s.label)]=function(){s.callback(!(!n||!n.prop("checked"))),o=!0,e(this).elfinderdialog("close")},r.buttons[a.i18n(s.label)]._cssClass="elfinder-confirm-extbtn"+i++,s.cssClass&&(r.buttons[a.i18n(s.label)]._cssClass+=" "+s.cssClass)})),r.buttons[this.i18n(t.cancel.label)]=function(){e(this).elfinderdialog("close")},r.buttons[this.i18n(t.cancel.label)]._cssClass="elfinder-confirm-cancel",t.all&&(r.create=function(){var t=e('
          ');n=e(''),e(this).next().find(".ui-dialog-buttonset").prepend(t.append(e("").prepend(n)))}),t.optionsCallback&&e.isFunction(t.optionsCallback)&&t.optionsCallback(r),this.dialog(''+this.i18n(t.text),r)},uniqueName:function(e,t,n){var i,a,o=0,r="";if(e=this.i18n(!1,e),t=t||this.cwd().hash,n="undefined"==typeof n?" ":n,(i=e.match(/^(.+)(\.[^.]+)$/))&&(r=i[2],e=i[1]),a=e+r,!this.fileByName(a,t))return a;for(;o<1e4;)if(a=e+n+ ++o+r,!this.fileByName(a,t))return a;return e+Math.random()+r},i18n:function(){var t,n,i,a,o,r=this,s=this.messages,l=[],c=[],d=function(e){var t;return 0===e.indexOf("#")&&(t=r.file(e.substr(1)))?t.name:e},p=0;for(arguments.length&&arguments[0]===!1&&(a=function(e){return e},p=1),t=p;t0&&l[n]&&c.push(n),i=a?a(l[n]):r.escape(l[n]),o&&(i=''+i+""),i})):i=i.get(0).outerHTML,l[t]=i);return e.grep(l,function(t,n){return e.inArray(n,c)===-1}).join("
          ")},getIconStyle:function(t,n){var i=this,a={background:"url('{url}') 0 0 no-repeat","background-size":"contain"},o="",r={},s=0;return t.icon&&(o='style="',e.each(a,function(e,a){0===s++&&(a=a.replace("{url}",i.escape(t.icon))),n?r[e]=a:o+=e+":"+a+";"}),o+='"'),n?r:o},mime2class:function(e){var t="elfinder-cwd-icon-",n=e.toLowerCase(),i=this.textMimes[n];return n=n.split("/"),i?n[0]+=" "+t+"text":n[1]&&n[1].match(/\+xml$/)&&(n[0]+=" "+t+"xml"),t+n[0]+(n[1]?" "+t+n[1].replace(/(\.|\+)/g,"-"):"")},mime2kind:function(e){var t,n="object"==typeof e,i=n?e.mime:e;return n&&e.alias&&"symlink-broken"!=i?t="Alias":this.kinds[i]?t=!n||"directory"!==i||e.phash&&!e.isroot?this.kinds[i]:"Root":this.mimeTypes[i]&&(t=this.mimeTypes[i].toUpperCase(),this.messages["kind"+t]||(t=null)),t||(t=0===i.indexOf("text")?"Text":0===i.indexOf("image")?"Image":0===i.indexOf("audio")?"Audio":0===i.indexOf("video")?"Video":0===i.indexOf("application")?"App":i),this.messages["kind"+t]?this.i18n("kind"+t):i},mimeIsText:function(e){return!!(this.textMimes[e.toLowerCase()]||0===e.indexOf("text/")&&"rtf"!==e.substr(5,3)||e.match(/^application\/.+\+xml$/))},date:function(e,t){var n,i,a,o,r,s,l,c,d,p=this;return t||(t=new Date),s=t[p.getHours](),l=s>12?s-12:s,c=t[p.getMinutes](),d=t[p.getSeconds](),i=t[p.getDate](),a=t[p.getDay](),o=t[p.getMonth]()+1,r=t[p.getFullYear](),n=e.replace(/[a-z]/gi,function(e){switch(e){case"d":return i>9?i:"0"+i;case"j":return i;case"D":return p.i18n(p.i18.daysShort[a]);case"l":return p.i18n(p.i18.days[a]);case"m":return o>9?o:"0"+o;case"n":return o;case"M":return p.i18n(p.i18.monthsShort[o-1]);case"F":return p.i18n(p.i18.months[o-1]);case"Y":return r;case"y":return(""+r).substr(2);case"H":return s>9?s:"0"+s;case"G":return s;case"g":return l;case"h":return l>9?l:"0"+l;case"a":return s>=12?"pm":"am";case"A":return s>=12?"PM":"AM";case"i":return c>9?c:"0"+c;case"s":return d>9?d:"0"+d}return e})},formatDate:function(e,t){var n,i,a,o=this,r=t||e.ts;o.i18;return o.options.clientFormatDate&&r>0?(n=new Date(1e3*r),i=r>=this.yesterday?this.fancyFormat:this.dateFormat,a=o.date(i,n),r>=this.yesterday?a.replace("$1",this.i18n(r>=this.today?"Today":"Yesterday")):a):e.date?e.date.replace(/([a-z]+)\s/i,function(e,t){return o.i18n(t)+" "}):o.i18n("dateUnknown")},toLocaleString:function(e){var t=new Number(e);return t?t.toLocaleString?t.toLocaleString():String(e).replace(/(\d)(?=(\d\d\d)+(?!\d))/g,"$1,"):e},perms2class:function(e){var t="";return e.read||e.write?e.read?e.write||(t="elfinder-ro"):t="elfinder-wo":t="elfinder-na",e.type&&(t+=" elfinder-"+this.escape(e.type)),t},formatPermissions:function(e){var t=[];return e.read&&t.push(this.i18n("read")),e.write&&t.push(this.i18n("write")),t.length?t.join(" "+this.i18n("and")+" "):this.i18n("noaccess")},formatSize:function(e){var t=1,n="b";return"unknown"==e?this.i18n("unknown"):(e>1073741824?(t=1073741824,n="GB"):e>1048576?(t=1048576,n="MB"):e>1024&&(t=1024,n="KB"),e/=t,(e>0?t>=1048576?e.toFixed(2):Math.round(e):0)+" "+n)},formatFileMode:function(t,n){var i,a,o,r,s,l,c,d,p;if(n||(n=this.options.fileModeStyle.toLowerCase()),t=e.trim(t),t.match(/[rwxs-]{9}$/i)){if(d=t=t.substr(-9),"string"==n)return d;for(p="",o=0,i=0;i<7;i+=3)a=t.substr(i,3),r=0,a.match(/[r]/i)&&(r+=4),a.match(/[w]/i)&&(r+=2),a.match(/[xs]/i)&&(a.match(/[xs]/)&&(r+=1),a.match(/[s]/i)&&(0==i?o+=4:3==i&&(o+=2))),p+=r.toString(8);o&&(p=o.toString(8)+p)}else{if(t=parseInt(t,8),p=t?t.toString(8):"",!t||"octal"==n)return p;for(a=t.toString(8),o=0,a.length>3&&(a=a.substr(-4),o=parseInt(a.substr(0,1),8),a=a.substr(1)),s=1==(1&o),c=2==(2&o),l=4==(4&o),d="",i=0;i<3;i++)d+=4==(4&parseInt(a.substr(i,1),8))?"r":"-",d+=2==(2&parseInt(a.substr(i,1),8))?"w":"-",d+=1==(1&parseInt(a.substr(i,1),8))?0==i&&l||1==i&&c?"s":"x":"-"}return"both"==n?d+" ("+p+")":"string"==n?d:p},registRawStringDecoder:function(t){e.isFunction(t)&&(this.decodeRawString=this.options.rawStringDecoder=t)},uploadMimeCheck:function(t,n){n=n||this.cwd().hash;var i,a,o=!0,r=this.option("uploadMime",n),s=function(n){var i=!1;return"string"==typeof n&&"all"===n.toLowerCase()?i=!0:Array.isArray(n)&&n.length&&e.each(n,function(e,n){if(n=n.toLowerCase(),"all"===n||0===t.indexOf(n))return i=!0,!1}),i};return t&&e.isPlainObject(r)&&(t=t.toLowerCase(),i=s(r.allow),a=s(r.deny),"allow"===r.firstOrder?(o=!1,a||i!==!0||(o=!0)):(o=!0,a!==!0||i||(o=!1))),o},sequence:function(e){var t=e.length,n=function(t,i){return++i,e[i]?n(t.then(e[i]),i):t};return t>1?n(e[0](),0):e[0]()},reloadContents:function(t){var n,i=e.Deferred();try{n=e('';d.remove(),e(x).appendTo("body").ready(function(){setTimeout(function(){e(x).each(function(){e("#"+e(this).attr("id")).remove()})},2e4+1e4*i)}),b.trigger("download",{files:y}),w.resolve()}),u=y.length,g=[],i=0;i');return t&&e.each(t,function(e,t){a=i.escape(t.value),o.append('")}),e.each(n.options.encodings,function(e,t){o.append('")}),o},d=function(){var t,a,o=i.options.dialogContained?i.getUI():e(window);return a="string"==typeof n.options.dialogWidth&&(t=n.options.dialogWidth.match(/(\d+)%/))?parseInt(o.width()*(t[1]/100)):parseInt(n.options.dialogWidth||650),Math.min(a,o.width())},p=function(){if(n.options.dialogHeight){var t,a,o=i.options.dialogContained?i.getUI():e(window);return a="string"==typeof n.options.dialogHeight&&(t=n.options.dialogHeight.match(/(\d+)%/))?parseInt(o.height()*(t[1]/100)):parseInt(n.options.dialogHeight||o.height()),Math.min(a,o.height())}},u=function(t){var a,l,c,d=t.length;return d>1&&(a=t[0].mime,l=t[0].name.replace(/^.*(\.[^.]+)$/,"$1")),e.grep(t,function(t){var p;return!c&&"directory"!==t.mime&&(p=t.read&&(s||i.mimeIsText(t.mime)||e.inArray(t.mime,1===d?o:r)!==-1)&&(!n.onlyMimes.length||e.inArray(t.mime,n.onlyMimes)!==-1)&&(1===d||t.mime===a&&t.name.substr(l.length*-1)===l)&&!!i.uploadMimeCheck(t.mime,t.phash)&&b(t,d)&&Object.keys(g).length,p||(c=!0),p)})},h=function(e){var t,n=i.file(e);i.request({cmd:"info",targets:[e],preventDefault:!0}).done(function(e){var a;e&&e.files&&e.files.length&&(t=e.files[0],n.ts==t.ts&&n.size==t.size||(a={changed:[t]},i.updateCache(a),i.change(a)))})},f=function(t,o,r,s,u,f){var g,v,b,y,w,k,C=e.Deferred(),z=!1,T=function(){return!!z||(i.toast({mode:"warning",msg:i.i18n("nowLoading")}),!1)},A=function(){f&&Array.isArray(f)&&e.each(f,function(){this.msg&&i.toast(this)})},j=function(){var t,n,a,o=y?y.val():void 0,r=e.Deferred().fail(function(e){b.show().find("button.elfinder-btncnt-0,button.elfinder-btncnt-1").hide()});return T()?(g.editor&&(g.editor.save(g[0],g.editor.instance),t=g.editor.confObj,t.info&&(t.info.schemeContent||t.info.arrayBufferContent)&&(o="scheme")),n=D(),U(n),n.promise?(a=setTimeout(function(){i.notify({type:"chkcontent",cnt:1,hideCnt:!0,cancel:function(){n.reject()}})},100),n.always(function(){a&&clearTimeout(a),i.notify({type:"chkcontent",cnt:-1})}).done(function(e){C.notifyWith(g,[o,g.data("hash"),v,r])}).fail(function(e){r.reject(e)})):C.notifyWith(g,[o,g.data("hash"),v,r]),r):r.resolve()},S=function(){T()&&j().fail(function(e){e&&i.error(e)})},O=function(){g.elfinderdialog("close")},I=function(){T()&&(b.hide(),j().done(function(){z=!1,b.show(),O()}).fail(function(e){b.show(),e&&i.error(e)}))},M=function(){if(T()){var t=v,r=o.phash,s=function(e){p.addClass(a).fadeIn(function(){e&&i.error(e)}),v=t,i.disable()},l=function(){n.mime=R.mime||o.mime,n.prefix=(R.name||o.name).replace(/ \d+(\.[^.]+)?$/,"$1"),n.requestCmd="mkfile",n.nextAction={},n.data={target:r},e.proxy(i.res("mixin","make"),n)().done(function(e){var t;e.added&&e.added.length?(t=g.data("hash"),g.data("hash",e.added[0].hash),j().done(function(){z=!1,b.show(),O(),p.fadeIn()}).fail(function(){i.exec("rm",[e.added[0].hash],{forceRm:!0,quiet:!0}),g.data("hash",t),b.find("button.elfinder-btncnt-2").hide(),s()})):s()}).progress(function(e){e&&"errUploadMime"===e&&g.trigger("saveAsFail")}).fail(s).always(function(){delete n.mime,delete n.prefix,delete n.nextAction,delete n.data}),i.trigger("unselectfiles",{files:[o.hash]})},c=null,d=null,p=i.getUI().children("."+n.dialogClass+":visible");b.is(":hidden")&&(p=p.add(b)),p.removeClass(a).fadeOut(),i.enable(),i.searchStatus.state<2&&r!==i.cwd().hash?c=i.exec("open",[r],{thash:r}):i.file(r)||(d=i.request({cmd:"info",targets:[r]})),e.when([c,d]).done(function(){d?i.one("infodone",function(){i.file(r)?l():s("errFolderNotFound")}):c?i.one("cwdrender",l):l()}).fail(s)}},E=function(){var t,n,a=e.Deferred();return z?(g.editor&&g.editor.save(g[0],g.editor.instance),t=D(),t&&t.promise?(n=setTimeout(function(){i.notify({type:"chkcontent",cnt:1,hideCnt:!0,cancel:function(){t.reject()}})},100),t.always(function(){n&&clearTimeout(n),i.notify({type:"chkcontent",cnt:-1})}).done(function(e){a.resolve(v!==e)}).fail(function(e){a.resolve(e||void 0!==v)})):a.resolve(v!==t),a):a.resolve(!1)},F={title:i.escape(o.name),width:d(),height:p(),buttons:{},cssClass:a,maxWidth:"window",maxHeight:"window",allowMinimize:!0,allowMaximize:!0,openMaximized:x()||u&&u.info&&u.info.openMaximized,btnHoverFocus:!1,closeOnEscape:!1,propagationEvents:["mousemove","mouseup","click"],minimize:function(){var e;g.editor&&b.closest(".ui-dialog").is(":hidden")&&(e=g.editor.confObj,e.info&&e.info.syncInterval&&h(o.hash))},close:function(){var e=function(){var e;C.resolve(),g.editor&&(g.editor.close(g[0],g.editor.instance),e=g.editor.confObj,e.info&&e.info.syncInterval&&h(o.hash)),g.elfinderdialog("destroy")},t="undefined"!=typeof R.name,a=t?{label:"btnSaveAs",callback:function(){requestAnimationFrame(M)}}:{label:"btnSaveClose",callback:function(){j().done(function(){e()})}};E().done(function(o){var r=["confirmNotSave"];o?("string"==typeof o&&r.unshift(o),i.confirm({title:n.title,text:r,accept:a,cancel:{label:"btnClose",callback:e},buttons:t?null:[{label:"btnSaveAs",callback:function(){requestAnimationFrame(M)}}]})):e()})},open:function(){var e,n,a;if(g.initEditArea.call(g,t,o,r,i),g.editor){if(e=g.editor.load(g[0])||null,e&&e.done)e.always(function(){z=!0}).done(function(e){g.editor.instance=e,g.editor.focus(g[0],g.editor.instance),U(D()),requestAnimationFrame(function(){b.trigger("resize")})}).fail(function(e){e&&i.error(e),g.elfinderdialog("destroy")}).always(A);else{if(z=!0,e&&("string"==typeof e||Array.isArray(e)))return i.error(e),void g.elfinderdialog("destroy");g.editor.instance=e,g.editor.focus(g[0],g.editor.instance),U(D()),requestAnimationFrame(function(){b.trigger("resize")}),A()}n=g.editor.confObj,n.info&&n.info.syncInterval&&(a=parseInt(n.info.syncInterval))&&setTimeout(function(){P(a)},a)}else z=!0,U(D())},resize:function(e,t){g.editor&&g.editor.resize(g[0],g.editor.instance,e,t||{})}},D=function(){var t=g.getContent.call(g,g[0]);return void 0!==t&&t!==!1&&null!==t||(t=e.Deferred().reject()),t},U=function(e){e&&e.promise?e.done(function(e){v=e}):v=e},P=function(e){b.is(":visible")&&(h(o.hash),setTimeout(function(){P(e)},e))},q=function(){y&&E().done(function(e){e?y.attr("title",i.i18n("saveAsEncoding")).addClass("elfinder-edit-changed"):y.attr("title",i.i18n("openAsEncoding")).removeClass("elfinder-edit-changed")})},R={};if(u&&(u.html&&(g=e(u.html)),w={init:u.init||null,load:u.load,getContent:u.getContent||null,save:u.save,beforeclose:"function"==typeof u.beforeclose?u.beforeclose:void 0,close:"function"==typeof u.close?u.close:function(){},focus:"function"==typeof u.focus?u.focus:function(){},resize:"function"==typeof u.resize?u.resize:function(){},instance:null,doSave:S,doCancel:O,doClose:I,file:o,fm:i,confObj:u,trigger:function(e,t){i.trigger("editEditor"+e,Object.assign({},u.info||{},t))}}),!g){if(!i.mimeIsText(o.mime))return C.reject("errEditorNotFound");!function(){g=e('').on("input propertychange",q),u&&u.info&&!u.info.useTextAreaEvent||g.on("keydown",function(t){var n,i,a=t.keyCode;t.stopPropagation(),a==e.ui.keyCode.TAB&&(t.preventDefault(),this.setSelectionRange&&(n=this.value,i=this.selectionStart,this.value=n.substr(0,i)+"\t"+n.substr(this.selectionEnd),i+=1,this.setSelectionRange(i,i))),(t.ctrlKey||t.metaKey)&&(a!="Q".charCodeAt(0)&&a!="W".charCodeAt(0)||(t.preventDefault(),O()),a=="S".charCodeAt(0)&&(t.preventDefault(),S()))}).on("mouseenter",function(){this.focus()}),g.initEditArea=function(e,t,n){g.hide().val(n),this._setupSelEncoding(n)}}()}return g._setupSelEncoding=function(t){var n=s&&"unknown"!==s?[{value:s}]:[],a=e("").hide(),r=function(t){t&&a.appendTo(y.parent()),a.empty().append(e("").text(y.val())),y.width(a.width())};""!==t&&s&&"UTF-8"===s||n.push({value:"UTF-8"}),y=c(n).on("touchstart",function(e){e.stopPropagation()}).on("change",function(){E().done(function(e){e||""===D()||(O(),m(o,y.val(),u).fail(function(e){e&&i.error(e)}))}),r()}).on("mouseover",q),g.parent().next().prepend(e('
          ').append(y)),r(!0)},g.data("hash",o.hash),w&&(g.editor=w,"function"==typeof w.beforeclose&&(F.beforeclose=function(){return w.beforeclose(g[0],w.instance)}),"function"==typeof w.init&&(g.initEditArea=w.init),"function"==typeof w.getContent&&(g.getContent=w.getContent)),g.initEditArea||(g.initEditArea=function(){}),g.getContent||(g.getContent=function(){return l(g.val())}),u&&u.info&&u.info.preventGet||(F.buttons[i.i18n("btnSave")]=S,F.buttons[i.i18n("btnSaveClose")]=I,F.buttons[i.i18n("btnSaveAs")]=M,F.buttons[i.i18n("btnCancel")]=O),u&&"function"==typeof u.prepare&&u.prepare(g,F,o),b=n.fmDialog(g,F).attr("id",t).on("keydown keyup keypress",function(e){e.stopPropagation()}).css({overflow:"hidden",minHeight:"7em"}).addClass("elfinder-edit-editor").closest(".ui-dialog").on("changeType",function(t,n){if(n.extention&&n.mime){var a=(n.extention,n.mime,e(this).children(".ui-dialog-buttonpane").children(".ui-dialog-buttonset"));a.children(".elfinder-btncnt-0,.elfinder-btncnt-1").hide(),R.name=i.splitFileExtention(o.name)[0]+"."+n.extention,R.mime=n.mime,n.keepEditor||a.children(".elfinder-btncnt-2").trigger("click")}}),k=(i.options.dialogContained?i.getUI():e(window)).width(),b.width()>k&&b.width(k),C.promise()},m=function(t,a,o){var r,s,l,d=t.hash,p=(i.options,e.Deferred()),u="edit-"+i.namespace+"-"+t.hash,h=i.getUI().find("#"+u),g=a?a:0,v=!1;if(h.length)return h.elfinderdialog("toTop"),p.resolve();if(!(t.read&&(t.write||o.info&&o.info.converter)))return s=["errOpen",t.name,"errPerm"],p.reject(s);if(o&&o.info){if("function"==typeof o.info.edit)return l=o.info.edit.call(i,t,o),l.promise?l.done(function(){p.resolve()}).fail(function(e){p.reject(e)}):l?p.resolve():p.reject(),p;v=o.info.preventGet||o.info.noContent,o.info.urlAsContent||v?(r=e.Deferred(),o.info.urlAsContent?i.url(d,{async:!0,onetime:!0,temporary:!0}).done(function(e){r.resolve({content:e})}):r.resolve({})):(g&&(t.encoding=g,i.cache(t,"change")),r=i.request({data:{cmd:"get",target:d,conv:g,_t:t.ts},options:{type:"get",cache:!0},notify:{type:"file",cnt:1},preventDefault:!0})),r.done(function(a){var r,s,l;a.doconv?i.confirm({title:n.title,text:"unknown"===a.doconv?"confirmNonUTF8":"confirmConvUTF8",accept:{label:"btnConv",callback:function(){p=m(t,r.val(),o)}},cancel:{label:"btnCancel",callback:function(){p.reject()}},optionsCallback:function(t){t.create=function(){var t=e('
          '),n={value:a.doconv};"unknown"===a.doconv&&(n.caption="-"),r=c([n]),e(this).next().find(".ui-dialog-buttonset").prepend(t.append(e("").append(r)))}}}):(!v&&i.mimeIsText(t.mime)&&(s=new RegExp("^(data:"+t.mime.replace(/([.+])/g,"\\$1")+";base64,)","i"),o.info.dataScheme?window.btoa&&!a.content.match(s)&&(a.content="data:"+t.mime+";base64,"+btoa(a.content)):window.atob&&(l=a.content.match(s))&&(a.content=atob(a.content.substr(l[1].length)))),f(u,t,a.content,a.encoding,o,a.toasts).done(function(e){p.resolve(e)}).progress(function(e,t,n,a){var o=this;t&&(d=t),i.request({options:{type:"post"},data:{cmd:"put",target:d,encoding:e||n.encoding,content:n},notify:{type:"save",cnt:1},syncOnFail:!0,preventFail:!0,navigate:{target:"changed",toast:{inbuffer:{msg:i.i18n(["complete",i.i18n("btnSave")])}}}}).fail(function(e){p.reject(e),a.reject()}).done(function(e){requestAnimationFrame(function(){o.trigger("focus"),o.editor&&o.editor.focus(o[0],o.editor.instance)}),a.resolve()})}).fail(function(e){p.reject(e)}))}).fail(function(e){var n=i.parseError(e);n=Array.isArray(n)?n[0]:n,t.encoding&&(t.encoding="",i.cache(t,"change")),"errConvUTF8"!==n&&i.sync(),p.reject(e)})}return p.promise()},g={},v={info:{id:"textarea",name:"TextArea",useTextAreaEvent:!0},load:function(t){this.trigger("Prepare",{node:t,editorObj:void 0,instance:void 0,opts:{}}),t.setSelectionRange&&t.setSelectionRange(0,0),e(t).trigger("focus").show()},save:function(){}},b=function(a,o){var r=function(t,n){if(n){if("*"===n[0]||e.inArray(t,n)!==-1)return!0;var a,o;for(o=n.length,a=0;a0||!t.info.converter&&t.info.canMakeEmpty!==!1&&i.mimesCanMakeEmpty[a.mime])&&(!t.info.maxSize||a.size<=t.info.maxSize)&&r(a.mime,t.mimes||null)&&s(a.name,t.exts||null)&&"function"==typeof t.load&&"function"==typeof t.save&&(n=t.info.name?t.info.name:"Editor "+e,t.id=t.info.id?t.info.id:"editor"+e,t.name=n,t.i18n=i.i18n(n),g[t.id]=t)}),!!Object.keys(g).length},y=function(n,a){n&&a&&(e.isPlainObject(t)||(t={}),t[n]=a.id,i.storage("storedEditors",t),i.trigger("selectfiles",{files:i.selected()}))},w=function(){var e=i.storage("useStoredEditor");return e?e>0:n.options.useStoredEditor},x=function(){var e=i.storage("editorMaximized");return e?e>0:n.options.editorMaximized},k=function(t,n){var a=[];return e.each(g,function(e,o){a.push({label:i.escape(o.i18n),icon:o.info&&o.info.icon?o.info.icon:"edit",options:{iconImg:o.info&&o.info.iconImg?i.baseUrl+o.info.iconImg:void 0},callback:function(){y(t[0].mime,o),n&&n.call(o)}})}),a},C=function(e){return e.toLowerCase().replace(/ +/g,"")},z=function(e){var n=t[e];return n&&Object.keys(g).length?g[C(n)]:void 0};this.getEncSelect=c,this.shortcuts=[{pattern:"ctrl+e"}],this.init=function(){var t,n,i=this,a=this.fm,l=this.options,c=[];this.onlyMimes=this.options.mimes||[],a.one("open",function(){l.editors&&Array.isArray(l.editors)&&(a.trigger("canMakeEmptyFile",{mimes:Object.keys(a.storage("mkfileTextMimes")||{}).concat(l.makeTextMimes||["text/plain"])}),e.each(l.editors,function(e,t){t.info&&t.info.cmdCheck&&c.push(t.info.cmdCheck)}),c.length?a.api>=2.103?n=a.request({data:{cmd:"editor",name:c,method:"enabled"},preventDefault:!0}).done(function(e){t=e}).fail(function(){t={}}):(t={},n=e.Deferred().resolve()):n=e.Deferred().resolve(),n.always(function(){t&&(l.editors=e.grep(l.editors,function(e){return!e.info||!e.info.cmdCheck||!!t[e.info.cmdCheck]})),e.each(l.editors,function(e,t){t.setup&&"function"==typeof t.setup&&t.setup.call(t,l,a),t.disabled||(t.mimes&&Array.isArray(t.mimes)&&(o=o.concat(t.mimes),t.info&&t.info.single||(r=r.concat(t.mimes))),!s&&t.mimes&&"*"===t.mimes[0]&&(s=!0),t.info||(t.info={}),t.info.integrate&&a.trigger("helpIntegration",Object.assign({cmd:"edit"},t.info.integrate)),t.info.canMakeEmpty&&a.trigger("canMakeEmptyFile",{mimes:Array.isArray(t.info.canMakeEmpty)?t.info.canMakeEmpty:t.mimes}))}),o=(e.uniqueSort||e.unique)(o),r=(e.uniqueSort||e.unique)(r),l.editors=e.grep(l.editors,function(e){return!e.disabled})}))}).bind("select",function(){g=null}).bind("contextmenucreate",function(t){var n,o,r=function(e){var t=i.title;a.one("contextmenucreatedone",function(){i.title=t}),i.title=a.escape(e.i18n),e.info&&e.info.iconImg&&(i.contextmenuOpts={iconImg:a.baseUrl+e.info.iconImg}),delete i.variants};i.contextmenuOpts=void 0,"files"===t.data.type&&i.enabled()&&(n=a.file(t.data.targets[0]),b(n,t.data.targets.length)&&(Object.keys(g).length>1?w()&&(o=z(n.mime))?(r(o),i.extra={icon:"menu",node:e("").attr({title:a.i18n("select")}).on("click touchstart",function(t){if(!("touchstart"===t.type&&t.originalEvent.touches.length>1)){var n=e(this);t.stopPropagation(),t.preventDefault(),a.trigger("contextmenu",{raw:k(a.selectedFiles(),function(){var e=a.selected();a.exec("edit",e,{editor:this}),a.trigger("selectfiles",{files:e})}),x:n.offset().left,y:n.offset().top})}})}):(delete i.extra,i.variants=[],e.each(g,function(e,t){i.variants.push([{editor:t},t.i18n,t.info&&t.info.iconImg?a.baseUrl+t.info.iconImg:"edit"])})):(r(g[Object.keys(g)[0]]),delete i.extra)))}).bind("canMakeEmptyFile",function(t){if(t.data&&t.data.resetTexts){var n=a.arrayFlip(i.options.makeTextMimes||["text/plain"]),o=i.getMkfileHides();e.each(a.storage("mkfileTextMimes")||{},function(e,t){n[e]||(delete a.mimesCanMakeEmpty[e],delete o[e])}),a.storage("mkfileTextMimes",null),Object.keys(o).length?a.storage("mkfileHides",o):a.storage("mkfileHides",null)}})},this.getstate=function(e){var t=this.files(e),n=t.length;return n&&u(t).length==n?0:-1},this.exec=function(t,n){var i,a=this.fm,o=u(this.files(t)),r=e.map(o,function(e){return e.hash}),s=[],l=n&&n.editor?n.editor:null,c=e(n&&n._currentNode?n._currentNode:a.cwdHash2Elm(r[0])),d=function(){var t=e.Deferred();return!l&&Object.keys(g).length>1?w()&&(l=z(o[0].mime))?t.resolve(l):(a.trigger("contextmenu",{raw:k(o,function(){t.resolve(this)}),x:c.offset().left,y:c.offset().top+22,opened:function(){a.one("closecontextmenu",function(){requestAnimationFrame(function(){"pending"===t.state()&&t.reject()})})}}),a.trigger("selectfiles",{files:r}),t):(Object.keys(g).length>1&&l&&y(o[0].mime,l),t.resolve(l?l:Object.keys(g).length?g[Object.keys(g)[0]]:null))},p=e.Deferred();return null===g&&b(o[0],r.length),c.length||(c=a.getUI("cwd")),d().done(function(t){for(;i=o.shift();)s.push(m(i,i.encoding||void 0,t).fail(function(e){e&&a.error(e)}));s.length?e.when.apply(null,s).done(function(){p.resolve()}).fail(function(){p.reject()}):p.reject()}).fail(function(){p.reject()}),p},this.getMkfileHides=function(){return i.storage("mkfileHides")||i.arrayFlip(n.options.mkfileHideMimes||[])}},i.prototype.commands.empty=function(){var t,n,i=function(e){var i=t.files(e);return i.length||(i=[n.cwd()]),i};this.linkedCmds=["rm"],this.init=function(){t=this,n=this.fm},this.getstate=function(t){var n,a=i(t),o=function(t){var n=!0;return e.grep(t,function(e){return n=!!(n&&e.read&&e.write&&"directory"===e.mime)})};return n=a.length,o(a).length==n?0:-1},this.exec=function(t){var a=i(t),o=a.length,r=e.Deferred().done(function(){var t={changed:{}};n.toast({msg:n.i18n(['"'+s.join('", ')+'"',"complete",n.i18n("cmdempty")])}),e.each(a,function(e,n){t.changed[n.hash]=n}),n.change(t)}).always(function(){var t=n.cwd().hash;n.trigger("selectfiles",{files:e.map(a,function(e){return t===e.phash?e.hash:null})})}),s=[],l=function(e){"number"==typeof e?(s.push(a[e].name),delete a[e].dirs):e&&n.error(e),--o<1&&r[s.length?"resolve":"reject"]()};return e.each(a,function(t,i){var a;return i.write&&"directory"===i.mime?n.isCommandEnabled("rm",i.hash)?(a=setTimeout(function(){n.notify({type:"search",cnt:1,hideCnt:!(o>1)})},n.notifyDelay),void n.request({data:{cmd:"open",target:i.hash},preventDefault:!0,asNotOpen:!0}).done(function(r){var s=[];a&&clearTimeout(a),n.ui.notify.children(".elfinder-notify-search").length&&n.notify({type:"search",cnt:-1,hideCnt:!(o>1)}),r&&r.files&&r.files.length?r.files.length>n.maxTargets?l(["errEmpty",i.name,"errMaxTargets",n.maxTargets]):(n.updateCache(r),e.each(r.files,function(e,t){return!t.write||t.locked?(l(["errEmpty",i.name,"errRm",t.name,"errPerm"]),s=[],!1):void s.push(t.hash)}),s.length&&n.exec("rm",s,{_userAction:!0,addTexts:[n.i18n("folderToEmpty",i.name)]}).fail(function(e){n.trigger("unselectfiles",{files:n.selected()}),l(n.parseError(e)||"")}).done(function(){l(t)})):(n.toast({mode:"warning",msg:n.i18n("filderIsEmpty",i.name)}),l(""))}).fail(function(e){l(n.parseError(e)||"")})):(l(["errCmdNoSupport",'"rm"']),null):(l(["errEmpty",i.name,"errPerm"]),null)}),r}},i.prototype.commands.extract=function(){var t=this,n=t.fm,i=[],a=function(t){var n=!0;return e.grep(t,function(t){return n=!(!n||!t.read||e.inArray(t.mime,i)===-1)})};this.variants=[],this.disableOnSearch=!0,n.bind("open reload",function(){i=n.option("archivers").extract||[],n.api>2?t.variants=[[{makedir:!0},n.i18n("cmdmkdir")],[{},n.i18n("btnCwd")]]:t.variants=[[{},n.i18n("btnCwd")]],t.change()}),this.getstate=function(t){var i,o,r=this.files(t),s=r.length;return s&&a(r).length==s?n.searchStatus.state>0?(i=this.fm.cwd().hash,e.each(r,function(e,t){return o=t.phash===i}),o?0:-1):this.fm.cwd().write?0:-1:-1},this.exec=function(t,a){var o,r,s,l=this.files(t),c=e.Deferred(),d=l.length,p=a&&a.makedir?1:0,u=!1,h=!1,f=0,m=n.files(l[0].phash),g=[],v={};e.each(m,function(e,t){v[t.name]=t,g.push(t.name)});var b=function(e){switch(e){case"overwrite_all":u=!0;break;case"omit_all":h=!0}},y=function(t){t.read&&n.file(t.phash).write?e.inArray(t.mime,i)===-1?(r=["errExtract",t.name,"errNoArchive"],n.error(r),c.reject(r)):n.request({data:{cmd:"extract",target:t.hash,makedir:p},notify:{type:"extract",cnt:1},syncOnFail:!0,navigate:{toast:p?{incwd:{msg:n.i18n(["complete",n.i18n("cmdextract")]),action:{cmd:"open",msg:"cmdopen"}},inbuffer:{msg:n.i18n(["complete",n.i18n("cmdextract")]),action:{cmd:"open",msg:"cmdopen"}}}:{inbuffer:{msg:n.i18n(["complete",n.i18n("cmdextract")])}}}}).fail(function(e){"rejected"!=c.state()&&c.reject(e)}).done(function(){}):(r=["errExtract",t.name,"errPerm"],n.error(r),c.reject(r))},w=function(t,i){var a=t[i],r=n.splitFileExtention(a.name)[0],l=e.inArray(r,g)>=0,m=function(){i+10&&y(a),m())};return this.enabled()&&d&&i.length?(d>0&&w(l,0),c):c.reject()}},(i.prototype.commands.forward=function(){this.alwaysEnabled=!0,this.updateOnSelect=!0,this.shortcuts=[{pattern:"ctrl+right"}],this.getstate=function(){return this.fm.history.canForward()?0:-1},this.exec=function(){return this.fm.history.forward()}}).prototype={forceLoad:!0},i.prototype.commands.fullscreen=function(){var t=this,n=this.fm,i=function(e,i){var a;e.preventDefault(),e.stopPropagation(),i&&i.fullscreen&&(a="on"===i.fullscreen,t.update(void 0,a),t.title=n.i18n(a?"reinstate":"cmdfullscreen"))};this.alwaysEnabled=!0,this.updateOnSelect=!1,this.syncTitleOnChange=!0,this.value=!1,this.options={ui:"fullscreenbutton"},this.getstate=function(){return 0},this.exec=function(){var i=n.getUI().get(0),a=i===n.toggleFullscreen(i);return t.title=n.i18n(a?"reinstate":"cmdfullscreen"),t.update(void 0,a),e.Deferred().resolve()},n.bind("init",function(){n.getUI().off("resize."+n.namespace,i).on("resize."+n.namespace,i)})},(i.prototype.commands.getfile=function(){var t=this,n=this.fm,i=function(n){var i=t.options,a=!0;return n=e.grep(n,function(e){return a=!(!a||"directory"==e.mime&&!i.folders||!e.read)}),i.multiple||1==n.length?n:[]};this.alwaysEnabled=!0,this.callback=n.options.getFileCallback,this._disabled="function"==typeof this.callback,this.getstate=function(e){var t=this.files(e),n=t.length;return this.callback&&n&&i(t).length==n?0:-1},this.exec=function(n){var i,a,o,r=this.fm,s=this.options,l=this.files(n),c=l.length,d=r.option("url"),p=r.option("tmbUrl"),u=e.Deferred().done(function(e){var n,i=function(){"close"==s.oncomplete?r.hide():"destroy"==s.oncomplete&&r.destroy()},a=function(e){"close"==s.onerror?r.hide():"destroy"==s.onerror?r.destroy():e&&r.error(e)};r.trigger("getfile",{files:e});try{n=t.callback(e,r)}catch(o){return void a(["Error in `getFileCallback`.",o.message])}"object"==typeof n&&"function"==typeof n.done?n.done(i).fail(a):i()}),h=function(t){return s.onlyURL?s.multiple?e.map(l,function(e){return e.url}):l[0].url:s.multiple?l:l[0]},f=[];for(i=0;i {link}
          ',d='
          {author}
          {work}
          ',p=/\{url\}/,u=/\{link\}/,h=/\{author\}/,f=/\{work\}/,m="replace",g="ui-priority-primary",v="ui-priority-secondary",b="elfinder-help-license",y='
        • {title}
        • ',w=['
          ','
            '],x='
            {pattern}
            {descrip}
            ',k='
            ',C=e("base").length?s.escape(document.location.href.replace(/#.*$/,"")):"",z=s.res("class","tabsactive"),T=function(){var e;return e=s.theme&&s.theme.author?d[m]("elfinder-help-team","elfinder-help-team elfinder-help-term-theme")[m](h,s.i18n(s.theme.author)+(s.theme.email?" <"+s.theme.email+">":""))[m](f,s.i18n("theme")+" ("+s.i18n(s.theme.name)+")"):''},A=function(){w.push('
            '),w.push("

            elFinder

            "),w.push('
            '+s.i18n("webfm")+"
            "),w.push('
            '+s.i18n("ver")+": "+s.version+"
            "),w.push('
            '+s.i18n("protocolver")+':
            '),w.push('
            jQuery/jQuery UI: '+e().jquery+"/"+e.ui.version+"
            "),w.push(k),w.push(c[m](p,"https://studio-42.github.io/elFinder/")[m](u,s.i18n("homepage"))),w.push(c[m](p,"https://github.com/Studio-42/elFinder/wiki")[m](u,s.i18n("docs"))),w.push(c[m](p,"https://github.com/Studio-42/elFinder")[m](u,s.i18n("github"))),w.push(k),w.push('
            '+s.i18n("team")+"
            "),w.push(d[m](h,'Dmitry "dio" Levashov <dio@std42.ru>')[m](f,s.i18n("chiefdev"))),w.push(d[m](h,"Naoki Sawada (nao-pon)<hypweb+elfinder@gmail.com>")[m](f,s.i18n("developer"))),w.push(d[m](h,"Troex Nevelin <troex@fury.scancode.ru>")[m](f,s.i18n("maintainer"))),w.push(d[m](h,"Alexey Sukhotin <strogg@yandex.ru>")[m](f,s.i18n("contributor"))),s.i18[s.lang].translator&&e.each(s.i18[s.lang].translator.split(", "),function(){w.push(d[m](h,e.trim(this))[m](f,s.i18n("translator")+" ("+s.i18[s.lang].language+")"))}),w.push(T()),w.push(k),w.push('
            '+s.i18n("icons")+': Pixelmixer, Fugue, Icons8
            '),w.push(k),w.push('
            Licence: 3-clauses BSD Licence
            '),w.push('
            Copyright © 2009-2022, Studio 42 / nao-pon
            '),w.push('
            „ …'+s.i18n("dontforget")+" ”
            "),w.push("
            ")},j=function(){var t=s.shortcuts();w.push('
            '),t.length?(w.push('
            '),e.each(t,function(e,t){w.push(x.replace(/\{pattern\}/,t[0]).replace(/\{descrip\}/,t[1]))}),w.push("
            ")):w.push('
            '+s.i18n("shortcutsof")+"
            "),w.push("
            ")},S=function(){w.push('
            '),w.push('DON\'T PANIC'),w.push("
            ")},O=!1,I=function(){O=!0,w.push('
            ')},M=!1,E=function(){M=!0,w.push('
            '),w.push('
              '),w.push("
              ")},F=function(){var n,i,a,c,d,p,u=function(t,n){return e.each(n,function(n,i){t.append(e("
              ").text(n)),"undefined"==typeof i?t.append(e("
              ").append(e("").text("undfined"))):"object"!=typeof i||i?"object"==typeof i&&(e.isPlainObject(i)||i.length)?t.append(e("
              ").append(u(e("
              "),i))):t.append(e("
              ").append(e("").text(i&&"object"==typeof i?"[]":i?i:'""'))):t.append(e("
              ").append(e("").text("null")))}),t},h=r.children("li").length;(l.debug.options||l.debug.debug)&&(h>=5&&(d=r.children("li:last"),p=o.children("div:last"),p.is(":hidden")?(d.remove(),p.remove()):(d.prev().remove(),p.prev().remove())),a=s.namespace+"-help-debug-"+ +new Date,n=e("
            • ").html(''+l.debug.debug.cmd+"").prependTo(r), +i=e('
              ').data("debug",l.debug),n.on("click.debugrender",function(){var t=i.data("debug");i.removeData("debug"),t&&(i.hide(),t.debug&&(c=e("
              ").append(e("").text("debug"),u(e("
              "),t.debug)),i.append(c)),t.options&&(c=e("
              ").append(e("").text("options"),u(e("
              "),t.options)),i.append(c)),i.show()),n.off("click.debugrender")}),r.after(i),t&&o.tabs("refresh"))},D="";this.alwaysEnabled=!0,this.updateOnSelect=!1,this.state=-1,this.shortcuts=[{pattern:"f1",description:this.title}],s.bind("load",function(){var c,d,p,u,h,f,g=l.options.view||["about","shortcuts","help","integrations","debug"];(c=e.inArray("preference",g))!==-1&&g.splice(c,1),e.fn.tabs||(c=e.inArray(g,"debug"))!==-1&&g.splice(c,1),e.each(g,function(e,t){w.push(y[m](/\{id\}/g,t)[m](/\{title\}/,s.i18n(t)))}),w.push("
            "),e.inArray("about",g)!==-1&&A(),e.inArray("shortcuts",g)!==-1&&j(),e.inArray("help",g)!==-1&&(d=s.i18nBaseUrl+"help/%s.html.js",S()),e.inArray("integrations",g)!==-1&&I(),e.inArray("debug",g)!==-1&&E(),w.push("
            "),D=e(w.join("")),D.find(".ui-tabs-nav li").on("mouseenter mouseleave",function(t){e(this).toggleClass("ui-state-hover","mouseenter"===t.type)}).on("focus blur","a",function(t){e(t.delegateTarget).toggleClass("ui-state-focus","focusin"===t.type)}).children().on("click",function(t){var n=e(this);t.preventDefault(),t.stopPropagation(),n.parent().addClass(z).siblings().removeClass(z),D.children(".ui-tabs-panel").hide().filter(n.attr("href")).show()}).filter(":first").trigger("click"),O&&(n=D.find(".elfinder-help-tab-integrations").hide(),i=D.find("#"+s.namespace+"-help-integrations").hide().append(e('
            ').html(s.i18n("integrationWith"))),s.bind("helpIntegration",function(t){var a,o,r,l,c=i.children("ul:first");t.data&&(e.isPlainObject(t.data)?(a=Object.assign({link:"",title:"",banner:""},t.data),(a.title||a.link)&&(a.title||(a.title=a.link),o=a.link?e("").attr("href",a.link).attr("target","_blank").text(a.title):e("").text(a.title),a.banner&&(o=e("").append(e("").attr(a.banner),o)))):(o=e(t.data),o.filter("a").each(function(){var t=e(this);t.attr("target")||t.attr("target","_blank")})),o&&(n.show(),c.length||(c=e('
              ').appendTo(i)),a&&a.cmd?(l="elfinder-help-integration-"+a.cmd,r=c.find("ul."+l),r.length||(r=e('
                '),c.append(e("
              • ").append(e("").html(s.i18n("cmd"+a.cmd))).append(r))),o=r.append(e("
              • ").append(o))):c.append(e("
              • ").append(o))))}).bind("themechange",function(){D.find("div.elfinder-help-term-theme").replaceWith(T())})),M&&(a=D.find(".elfinder-help-tab-debug").hide(),o=D.find("#"+s.namespace+"-help-debug").children("div:first"),r=o.children("ul:first").on("click",function(e){e.preventDefault(),e.stopPropagation()}),l.debug={},s.bind("backenddebug",function(e){M&&e.data&&e.data.debug&&(l.debug={options:e.data.options,debug:Object.assign({cmd:s.currentReqCmd},e.data.debug)},l.dialog&&F())})),D.find("#"+s.namespace+"-help-about").find(".apiver").text(s.api),l.dialog=l.fmDialog(D,{title:l.title,width:530,maxWidth:"window",maxHeight:"window",autoOpen:!1,destroyOnClose:!1,close:function(){M&&(a.hide(),o.tabs("destroy")),t=!1}}).on("click",function(e){e.stopPropagation()}).css({overflow:"hidden"}),p=l.dialog.children(".ui-tabs"),u=p.children(".ui-tabs-nav:first"),h=p.children(".ui-tabs-panel"),f=l.dialog.outerHeight(!0)-l.dialog.height(),l.dialog.closest(".ui-dialog").on("resize",function(){h.height(l.dialog.height()-f-u.outerHeight(!0)-20)}),d&&l.dialog.one("initContents",function(){e.ajax({url:l.options.helpSource?l.options.helpSource:d.replace("%s",s.lang),dataType:"html"}).done(function(t){e("#"+s.namespace+"-help-help").html(t)}).fail(function(){e.ajax({url:d.replace("%s","en"),dataType:"html"}).done(function(t){e("#"+s.namespace+"-help-help").html(t)})})}),l.state=0,s.trigger("helpBuilded",l.dialog)}).one("open",function(){var e=!1;s.one("backenddebug",function(){e=!0}).one("opendone",function(){requestAnimationFrame(function(){!e&&M&&(M=!1,a.hide(),o.hide(),r.hide())})})}),this.getstate=function(){return 0},this.exec=function(n,i){var s=i?i.tab:void 0,l=function(){M&&(o.tabs(),r.find("a:first").trigger("click"),a.show(),t=!0)};return l(),this.dialog.trigger("initContents").elfinderdialog("open").find((s?".elfinder-help-tab-"+s:".ui-tabs-nav li")+" a:first").trigger("click"),e.Deferred().resolve()}}).prototype={forceLoad:!0},i.prototype.commands.hidden=function(){this.hidden=!0,this.updateOnSelect=!1,this.getstate=function(){return-1}},i.prototype.commands.hide=function(){var t,n,i,a,o=this,r={};this.syncTitleOnChange=!0,this.shortcuts=[{pattern:"ctrl+shift+dot",description:this.fm.i18n("toggleHidden")}],this.init=function(){var e=this.fm;t=e.storage("hide")||{items:{}},n=Object.keys(t.items).length,this.title=e.i18n(t.show?"hideHidden":"showHidden"),o.update(void 0,o.title)},this.fm.bind("select contextmenucreate closecontextmenu",function(e,r){var s=(e.data?e.data.selected||e.data.targets:null)||r.selected();"select"===e.type&&e.data?a=e.data.origin:"contextmenucreate"===e.type&&(i=e.data.type),!s.length||("contextmenucreate"!==e.type&&"navbar"!==a||"cwd"===i)&&s[0]===r.cwd().hash?o.title=r.i18n(t.show?"hideHidden":"showHidden"):o.title=r.i18n("cmdhide"),"closecontextmenu"!==e.type?o.update("cwd"===i?n?0:-1:void 0,o.title):(i="",requestAnimationFrame(function(){o.update(void 0,o.title)}))}),this.getstate=function(e){return this.fm.cookieEnabled&&"cwd"!==i&&(e||this.fm.selected()).length||n?0:-1},this.exec=function(i,s){var l,c,d=this.fm,p=e.Deferred().done(function(){d.trigger("hide",{items:h,opts:s})}).fail(function(e){d.error(e)}),u=s||{},h=u.targets?u.targets:i||d.selected(),f=[];if(t=d.storage("hide")||{},e.isPlainObject(t)||(t={}),e.isPlainObject(t.items)||(t.items={}),("shortcut"===s._currentType||!h.length||"navbar"!==s._currentType&&"navbar"!==a&&h[0]===d.cwd().hash)&&(t.show?u.hide=!0:Object.keys(t.items).length&&(u.show=!0)),u.reset&&(u.show=!0,n=0),u.show||u.hide){if(u.show?t.show=!0:delete t.show,u.show)return d.storage("hide",u.reset?null:t),o.title=d.i18n("hideHidden"),o.update(u.reset?-1:void 0,o.title),e.each(t.items,function(e){var t=d.file(e,!0);t&&(d.searchStatus.state||!t.phash||d.file(t.phash))&&f.push(t)}),f.length&&(d.updateCache({added:f}),d.add({added:f})),u.reset&&(t={items:{}}),p.resolve();h=Object.keys(t.items)}return h.length&&(e.each(h,function(e,n){var i;t.items[n]||(i=d.file(n),i&&(r[n]=i.i18||i.name),t.items[n]=r[n]?r[n]:n)}),n=Object.keys(t.items).length,l=this.files(h),d.storage("hide",t),d.remove({removed:h}),t.show&&this.exec(void 0,{hide:!0}),u.hide||(c={},c.undo={cmd:"hide",callback:function(){var t=d.storage("hide");t&&(e.each(h,function(e,n){delete t.items[n]}),n=Object.keys(t.items).length,d.storage("hide",t),d.trigger("hide",{items:h,opts:{}}),o.update(n?0:-1)),d.updateCache({added:l}),d.add({added:l})}},c.redo={cmd:"hide",callback:function(){return d.exec("hide",void 0,{targets:h})}})),"rejected"==p.state()?p:p.resolve(c)}},(i.prototype.commands.home=function(){this.title="Home",this.alwaysEnabled=!0,this.updateOnSelect=!1,this.shortcuts=[{pattern:"ctrl+home ctrl+shift+up",description:"Home"}],this.getstate=function(){var e=this.fm.root(),t=this.fm.cwd().hash;return e&&t&&e!=t?0:-1},this.exec=function(){return this.fm.exec("open",this.fm.root())}}).prototype={forceLoad:!0},(i.prototype.commands.info=function(){var t=this.fm,n="elfinder-spinner",i="elfinder-info-button",a={calc:t.i18n("calc"),size:t.i18n("size"),unknown:t.i18n("unknown"),path:t.i18n("path"),aliasfor:t.i18n("aliasfor"),modify:t.i18n("modify"),perms:t.i18n("perms"),locked:t.i18n("locked"),dim:t.i18n("dim"),kind:t.i18n("kind"),files:t.i18n("files"),folders:t.i18n("folders"),roots:t.i18n("volumeRoots"),items:t.i18n("items"),yes:t.i18n("yes"),no:t.i18n("no"),link:t.i18n("link"),owner:t.i18n("owner"),group:t.i18n("group"),perm:t.i18n("perm"),getlink:t.i18n("getLink")},o=function(e,t){return t?e.replace(/\u200B/g,""):e.replace(/(\/|\\)/g,"$1​")};this.items=["size","aliasfor","path","link","dim","modify","perms","locked","owner","group","perm"],this.options.custom&&Object.keys(this.options.custom).length&&e.each(this.options.custom,function(e,t){t.label&&this.items.push(t.label)}),this.tpl={main:'
                {title}
                {content}
                ',itemTitle:'{name}{kind}',groupTitle:"{items}: {num}",row:'{label} : {value}',spinner:'{text} '},this.alwaysEnabled=!0,this.updateOnSelect=!1,this.shortcuts=[{pattern:"ctrl+i"}],this.init=function(){e.each(a,function(e,n){a[e]=t.i18n(n)})},this.getstate=function(){return 0},this.exec=function(t){var r=this.files(t);r.length||(r=this.files([this.fm.cwd().hash]));var s,l,c,d,p,u,h,f,m,g=this,v=this.fm,b=this.options,y=this.tpl,w=y.row,x=r.length,k=[],C=y.main,z="{label}",T="{value}",A=[],j=null,S={title:v.i18n("selectionInfo"),width:"auto",close:function(){e(this).elfinderdialog("destroy"),j&&"pending"===j.state()&&j.reject(),e.grep(A,function(e){e&&"pending"===e.state()&&e.reject()})}},O=[],I=function(e,t,i){E.find("."+n+"-"+t).parent().html(e).addClass(i||"")},M=v.namespace+"-info-"+e.map(r,function(e){return e.hash}).join("-"),E=v.getUI().find("#"+M),F=[],D="",U="elfinder-font-mono elfinder-info-hash",P=[],q=v.ui.notify;if(q.is(":hidden")&&q.children(".elfinder-notify").length&&q.elfinderdialog("open").height("auto"),!x)return e.Deferred().reject();if(E.length)return E.elfinderdialog("toTop"),e.Deferred().resolve();if(f=v.storage("infohides")||v.arrayFlip(b.hideItems,!0),1===x){if(c=r[0],c.icon&&(D=" "+v.getIconStyle(c)),C=C.replace("{dirclass}",c.csscls?v.escape(c.csscls):"").replace("{class}",v.mime2class(c.mime)).replace("{style}",D),d=y.itemTitle.replace("{name}",v.escape(c.i18||c.name)).replace("{kind}",''+v.mime2kind(c)+""),l=v.tmb(c),c.read?"directory"!=c.mime||c.alias?s=v.formatSize(c.size):(s=y.spinner.replace("{text}",a.calc).replace("{name}","size"),O.push(c.hash)):s=a.unknown,!f.size&&k.push(w.replace(z,a.size).replace(T,s)),!f.aleasfor&&c.alias&&k.push(w.replace(z,a.aliasfor).replace(T,c.alias)),f.path||((h=v.path(c.hash,!0))?k.push(w.replace(z,a.path).replace(T,o(v.escape(h))).replace("{class}","elfinder-info-path")):(k.push(w.replace(z,a.path).replace(T,y.spinner.replace("{text}",a.calc).replace("{name}","path")).replace("{class}","elfinder-info-path")),A.push(v.path(c.hash,!0,{notify:null}).fail(function(){I(a.unknown,"path")}).done(function(e){I(o(e),"path")})))),!f.link&&c.read){var R,H=v.escape(c.name);if("1"==c.url)k.push(w.replace(z,a.link).replace(T,'"));else{if(c.url)R=c.url;else if("directory"===c.mime)if(b.nullUrlDirLinkSelf&&null===c.url){var _=window.location;R=_.pathname+_.search+"#elf_"+c.hash}else""!==c.url&&v.option("url",!v.isRoot(c)&&c.phash||c.hash)&&(R=v.url(c.hash));else R=v.url(c.hash);R&&k.push(w.replace(z,a.link).replace(T,''+H+""))}}f.dim||(c.dim?k.push(w.replace(z,a.dim).replace(T,c.dim)):c.mime.indexOf("image")!==-1&&(c.width&&c.height?k.push(w.replace(z,a.dim).replace(T,c.width+"x"+c.height)):c.size&&"0"!==c.size&&(k.push(w.replace(z,a.dim).replace(T,y.spinner.replace("{text}",a.calc).replace("{name}","dim"))),A.push(v.request({data:{cmd:"dim",target:c.hash},preventDefault:!0}).fail(function(){I(a.unknown,"dim")}).done(function(e){if(I(e.dim||a.unknown,"dim"),e.dim){var t=e.dim.split("x"),n=v.file(c.hash);n.width=t[0],n.height=t[1]}}))))),!f.modify&&k.push(w.replace(z,a.modify).replace(T,v.formatDate(c))),!f.perms&&k.push(w.replace(z,a.perms).replace(T,v.formatPermissions(c))),!f.locked&&k.push(w.replace(z,a.locked).replace(T,c.locked?a.yes:a.no)),!f.owner&&c.owner&&k.push(w.replace(z,a.owner).replace(T,c.owner)),!f.group&&c.group&&k.push(w.replace(z,a.group).replace(T,c.group)),!f.perm&&c.perm&&k.push(w.replace(z,a.perm).replace(T,v.formatFileMode(c.perm))),window.ArrayBuffer&&(v.options.cdns.sparkmd5||v.options.cdns.jssha)&&"directory"!==c.mime&&c.size>0&&(!b.showHashMaxsize||c.size<=b.showHashMaxsize)&&(P=[],e.each(v.storage("hashchekcer")||b.showHashAlgorisms,function(e,t){c[t]?k.push(w.replace(z,v.i18n(t)).replace(T,c[t]).replace("{class}",U)):(k.push(w.replace(z,v.i18n(t)).replace(T,y.spinner.replace("{text}",a.calc).replace("{name}",t))),P.push(t))}),P.length&&(m=e('
                '),A.push(v.getContentsHashes(c.hash,P,b.showHashOpts,{progressBar:m}).progress(function(t){e.each(P,function(e,n){t[n]&&I(t[n],n,U)})}).always(function(){e.each(P,function(e,t){I(a.unknown,t)})})))),b.custom&&e.each(b.custom,function(t,n){f[n.label]||n.mimes&&!e.grep(n.mimes,function(e){return c.mime===e||0===c.mime.indexOf(e+"/")}).length||n.hashRegex&&!c.hash.match(n.hashRegex)||(k.push(w.replace(z,v.i18n(n.label)).replace(T,n.tpl.replace("{id}",M))),n.action&&"function"==typeof n.action&&F.push(n.action))})}else C=C.replace("{class}","elfinder-cwd-icon-group"),d=y.groupTitle.replace("{items}",a.items).replace("{num}",x),p=e.grep(r,function(e){return"directory"==e.mime}).length,p?(u=e.grep(r,function(e){return!("directory"!==e.mime||e.phash&&!e.isroot)}).length,p-=u,k.push(w.replace(z,a.kind).replace(T,u===x||p===x?a[u?"roots":"folders"]:e.map({roots:u,folders:p,files:x-u-p},function(e,t){return e?a[t]+" "+e:null}).join(", "))),!f.size&&k.push(w.replace(z,a.size).replace(T,y.spinner.replace("{text}",a.calc).replace("{name}","size"))),O=e.map(r,function(e){return e.hash})):(s=0,e.each(r,function(e,t){var n=parseInt(t.size);n>=0&&s>=0?s+=n:s="unknown"}),k.push(w.replace(z,a.kind).replace(T,a.files)),!f.size&&k.push(w.replace(z,a.size).replace(T,v.formatSize(s))));return C=C.replace("{title}",d).replace("{content}",k.join("").replace(/{class}/g,"")),E=g.fmDialog(C,S),E.attr("id",M).one("mousedown",".elfinder-info-path",function(){e(this).html(o(e(this).html(),!0))}),P.length&&m.appendTo(E.find("."+n+"-"+P[0]).parent()),v.UA.Mobile&&e.fn.tooltip&&E.children(".ui-dialog-content .elfinder-info-title").tooltip({classes:{"ui-tooltip":"elfinder-ui-tooltip ui-widget-shadow"},tooltipClass:"elfinder-ui-tooltip ui-widget-shadow",track:!0}),c&&"1"==c.url&&E.on("click","."+n+"-url",function(){e(this).parent().html(y.spinner.replace("{text}",v.i18n("ntfurl")).replace("{name}","url")),v.request({data:{cmd:"url",target:c.hash},preventDefault:!0}).fail(function(){I(H,"url")}).done(function(e){if(e.url){I(''+H+""||H,"url");var t=v.file(c.hash);t.url=e.url}else I(H,"url")})}),l&&e("").on("load",function(){E.find(".elfinder-cwd-icon").addClass(l.className).css("background-image","url('"+l.url+"')")}).attr("src",l.url),O.length&&(j=v.getSize(O).done(function(e){I(e.formated,"size")}).fail(function(){I(a.unknown,"size")})),F.length&&e.each(F,function(e,t){try{t(c,v,E)}catch(n){v.debug("error",n)}}),e.Deferred().resolve()}}).prototype={forceLoad:!0},i.prototype.commands.mkdir=function(){var t,n=this.fm,i=this;this.value="",this.disableOnSearch=!0,this.updateOnSelect=!1,this.syncTitleOnChange=!0,this.mime="directory",this.prefix="untitled folder",this.exec=function(a,o){var r;return a&&a.length&&o&&o._currentType&&"navbar"===o._currentType?(this.origin=o._currentType,this.data={target:a[0]}):(r=n.cwd().hash===a[0],this.origin=t&&!r?t:"cwd",delete this.data),a||this.options.intoNewFolderToolbtn||n.getUI("cwd").trigger("unselectall"),this.move=this.value===n.i18n("cmdmkdirin"),e.proxy(n.res("mixin","make"),i)()},this.shortcuts=[{pattern:"ctrl+shift+n"}],this.init=function(){this.options.intoNewFolderToolbtn&&(this.syncTitleOnChange=!0)},n.bind("select contextmenucreate closecontextmenu",function(e){var a=(e.data?e.data.selected||e.data.targets:null)||n.selected();i.className="mkdir",t=e.data&&a.length?e.data.origin||e.data.type||"":"",i.options.intoNewFolderToolbtn||""!==t||(t="cwd"),a.length&&"navbar"!==t&&"cwd"!==t&&n.cwd().hash!==a[0]?(i.title=n.i18n("cmdmkdirin"),i.className+=" elfinder-button-icon-mkdirin"):i.title=n.i18n("cmdmkdir"),"closecontextmenu"!==e.type?i.update(void 0,i.title):requestAnimationFrame(function(){i.update(void 0,i.title)})}),this.getstate=function(i){var a=n.cwd(),o="navbar"===t||i&&i[0]!==a.hash?this.files(i||n.selected()):[],r=o.length,s=function(t){var n=!0;return e.grep(t,function(e){return n=!(!n||!e.read||e.locked)})};return"navbar"===t?r&&o[0].write&&o[0].read?0:-1:!a.write||r&&s(o).length!=r?-1:0}},i.prototype.commands.mkfile=function(){var t=this;this.disableOnSearch=!0,this.updateOnSelect=!1,this.mime="text/plain",this.prefix="untitled file.txt",this.variants=[],this.getTypeName=function(e,n){var i,a=t.fm;return i=(i=a.messages["kind"+a.kinds[e]])?a.i18n(["extentiontype",n.toUpperCase(),i]):a.i18n(["extentionfile",n.toUpperCase()])},this.fm.bind("open reload canMakeEmptyFile",function(){var n=t.fm,i=n.getCommand("edit").getMkfileHides();t.variants=[],n.mimesCanMakeEmpty&&e.each(n.mimesCanMakeEmpty,function(e,a){a&&!i[e]&&n.uploadMimeCheck(e)&&t.variants.push([e,t.getTypeName(e,a)])}),t.change()}),this.getstate=function(){return this.fm.cwd().write?0:-1},this.exec=function(n,i){var a,o,r=t.fm;if(a=r.mimesCanMakeEmpty[i]){if(r.uploadMimeCheck(i))return this.mime=i,this.prefix=r.i18n(["untitled file",a]),e.proxy(r.res("mixin","make"),t)();o=["errMkfile",t.getTypeName(i,a)]}return e.Deferred().reject(o)}},i.prototype.commands.netmount=function(){var t,n=this,i=!1;this.alwaysEnabled=!0,this.updateOnSelect=!1,this.drivers=[],this.handlers={load:function(){var t=n.fm;t.cookieEnabled&&t.one("open",function(){n.drivers=t.netDrivers,n.drivers.length&&e.each(n.drivers,function(){var e=n.options[this];e&&(i=!0,e.integrateInfo&&t.trigger("helpIntegration",Object.assign({cmd:"netmount"},e.integrateInfo)))})})}},this.getstate=function(){return i?0:-1},this.exec=function(){var i,a=n.fm,o=e.Deferred(),r=n.options,s=function(){var s,l=function(){c.protocol.trigger("change","winfocus")},c={protocol:e("").on("change",function(e,n){var o=this.value;t.find(".elfinder-netmount-tr").hide(),t.find(".elfinder-netmount-tr-"+o).show(),i&&i.children(".ui-dialog-buttonpane:first").find("button").show(),"function"==typeof r[o].select&&r[o].select(a,e,n)}).addClass("ui-corner-all")},d={title:a.i18n("netMountDialogTitle"),resizable:!0,modal:!0,destroyOnClose:!1,open:function(){e(window).on("focus."+a.namespace,l),c.protocol.trigger("change")},close:function(){"pending"==o.state()&&o.reject(),e(window).off("focus."+a.namespace,l)},buttons:{}},p=function(){var i,s=c.protocol.val(),l={cmd:"netmount",protocol:s},d=r[s];return e.each(t.find("input.elfinder-netmount-inputs-"+s),function(t,n){var i,a;a=e(n),a.is(":radio,:checkbox")?a.is(":checked")&&(i=e.trim(a.val())):i=e.trim(a.val()),i&&(l[n.name]=i)}),l.host?(l.mnt2res&&(i=!0),a.request({data:l,notify:{type:"netmount",cnt:1,hideCnt:!0}}).done(function(e){var t;e.added&&e.added.length&&(i&&c.protocol.trigger("change","reset"),e.added[0].phash&&(t=a.file(e.added[0].phash))&&(t.dirs||(t.dirs=1,a.change({changed:[t]}))),a.one("netmountdone",function(){a.exec("open",e.added[0].hash)})),o.resolve()}).fail(function(e){d.fail&&"function"==typeof d.fail&&d.fail(a,a.parseError(e)),o.reject(e)}),void n.dialog.elfinderdialog("close")):a.trigger("error",{error:"errNetMountHostReq",opts:{modal:!0}})},u=e('
                ').on("keydown","input",function(t){var n,i=!0;t.keyCode===e.ui.keyCode.ENTER&&(e.each(u.find("input:visible:not(.elfinder-input-optional)"),function(){if(""===e(this).val())return i=!1,n=e(this),!1}),i?p():n.trigger("focus"))}),h=e("
                ");return t=e('
                ').append(e("").append(e(""+a.i18n("protocol")+"")).append(e("").append(c.protocol))),e.each(n.drivers,function(n,i){r[i]&&(c.protocol.append('"),e.each(r[i].inputs,function(n,o){o.attr("name",n),"hidden"!=o.attr("type")?(o.addClass("ui-corner-all elfinder-netmount-inputs-"+i),t.append(e("").addClass("elfinder-netmount-tr elfinder-netmount-tr-"+i).append(e(""+a.i18n(n)+"")).append(e("").append(o)))):(o.addClass("elfinder-netmount-inputs-"+i),h.append(o))}),r[i].protocol=c.protocol)}),t.append(h),t.find(".elfinder-netmount-tr").hide(),t.find(".elfinder-netmount-tr-"+n.drivers[0]).show(),d.buttons[a.i18n("btnMount")]=p,d.buttons[a.i18n("btnCancel")]=function(){n.dialog.elfinderdialog("close")},t.find("select,input").addClass("elfinder-tabstop"),s=n.fmDialog(u.append(t),d).ready(function(){c.protocol.trigger("change"),s.elfinderdialog("posInit")}),i=s.closest(".ui-dialog"),s};return n.dialog?n.dialog.elfinderdialog("open"):n.dialog=s(),o.promise()},n.fm.bind("netmount",function(e){var i=e.data||null,a=n.options,o=function(){a[i.protocol]&&"function"==typeof a[i.protocol].done&&(a[i.protocol].done(n.fm,i),t.find("select,input").addClass("elfinder-tabstop"),n.dialog.elfinderdialog("tabstopsInit"))};i&&i.protocol&&(i.mode&&"redirect"===i.mode?n.fm.request({data:{cmd:"netmount",protocol:i.protocol,host:i.host,user:"init",pass:"return",options:i.options},preventDefault:!0}).done(function(e){i=JSON.parse(e.body),o()}):o())})},i.prototype.commands.netunmount=function(){this.alwaysEnabled=!0,this.updateOnSelect=!1,this.drivers=[],this.handlers={load:function(){this.drivers=this.fm.netDrivers}},this.getstate=function(e){var t,n=this.fm;return e&&this.drivers.length&&!this._disabled&&(t=n.file(e[0]))&&t.netkey?0:-1},this.exec=function(t){var n=this,i=this.fm,a=e.Deferred().fail(function(e){e&&i.error(e)}),o=i.file(t[0]),r=function(t){var n,a=[];return i.leafRoots&&(n=[],e.each(i.leafRoots,function(a,o){var r,s=i.parents(a);(r=e.inArray(t,s))!==-1&&(r=s.length-r,e.each(o,function(e,t){n.push({i:r,hash:t})}))}),n.length&&(n.sort(function(e,t){return e.i').hide().appendTo(e("body"));if(t.UA.Mobile||!h){if(u)h?p.attr("target","_blank"):p.attr("download",a.name),p.attr("href",n).get(0).click();else if(i=window.open(n),!i)return g.reject("errPopup")}else{if(m="string"==typeof w.method&&"get"===w.method.toLowerCase(),!m&&0===n.indexOf(t.options.url)&&t.customData&&Object.keys(t.customData).length&&!a.mime.match(/^(?:video|audio)/)&&(n=""),"window"===x?(s=c=Math.round(2*screen.availWidth/3),l=d=Math.round(2*screen.availHeight/3),parseInt(a.width)&&parseInt(a.height)?(s=parseInt(a.width),l=parseInt(a.height)):a.dim&&(o=a.dim.split("x"),s=parseInt(o[0]),l=parseInt(o[1])),c>=s&&d>=l?(c=s,d=l):s-c>l-d?d=Math.round(l*(c/s)):c=Math.round(s*(d/l)),r="width="+c+",height="+d,i=window.open(n,f,r+",top=50,left=50,scrollbars=yes,resizable=yes,titlebar=no")):("tabs"===x&&(f=a.hash),i=window.open("about:blank",f)),!i)return g.reject("errPopup");if(""===n){var v=document.createElement("form");v.action=t.options.url,v.method="POST",v.target=f,v.style.display="none";var b=Object.assign({},t.customData,{cmd:"file",target:a.hash,_t:a.ts||parseInt(+new Date/1e3)});e.each(b,function(e,t){var n=document.createElement("input");n.name=e,n.value=t,v.appendChild(n)}),document.body.appendChild(v),v.submit()}else"window"!==x&&(i.location=n);e(i).trigger("focus")}p.remove()};try{p=new RegExp(t.option("dispInlineRegex"),"i")}catch(k){p=!1}for(u="string"==typeof e("").get(0).download,b=v.length;b--;){if(f="elf_open_window",a=v[b],!a.read)return g.reject(["errOpen",a.name,"errPerm"]);h=p&&a.mime.match(p),t.openUrl(a.hash,!h,y)}return g.resolve(n)};if(b>1)t.confirm({title:"openMulti",text:["openMultiConfirm",b+""],accept:{label:"cmdopen",callback:function(){k()}},cancel:{label:"btnCancel",callback:function(){g.reject()}},buttons:t.getCommand("zipdl")&&t.isCommandEnabled("zipdl",t.cwd().hash)?[{label:"cmddownload",callback:function(){t.exec("download",n),g.reject()}}]:[]});else{if(f=t.storage("selectAction")||w.selectAction,f&&(e.each(f.split("/"),function(){var e=this.valueOf();return("open"===e||!(m=t.getCommand(e))||!m.enabled())&&void(m=null)}),m))return t.exec(m.name);k()}return g}}).prototype={forceLoad:!0},i.prototype.commands.opendir=function(){this.alwaysEnabled=!0,this.getstate=function(){var e,t=this.fm.selected(),n=t.length;return 1!==n?-1:(e=this.fm.getUI("workzone"),e.hasClass("elfinder-search-result")?0:-1)},this.exec=function(t){var n,i=this.fm,a=e.Deferred(),o=this.files(t),r=o.length;return r&&o[0].phash?(n=o[0].phash,i.trigger("searchend",{noupdate:!0}),i.request({data:{cmd:"open",target:n},notify:{type:"open",cnt:1,hideCnt:!0},syncOnFail:!1}),a):a.reject()}},i.prototype.commands.opennew=function(){var t=this.fm;this.shortcuts=[{pattern:("function"==typeof t.options.getFileCallback?"shift+":"")+"ctrl+enter"}],this.getstate=function(e){var t=this.files(e),n=t.length;return 1===n&&"directory"===t[0].mime&&t[0].read?0:-1},this.exec=function(t){var n,i,a,o,r=e.Deferred(),s=this.files(t),l=s.length,c=this.options;return 1===l&&(n=s[0])&&"directory"===n.mime?(i=window.location,a=c.url?c.url:i.pathname,c.useOriginQuery&&(a.match(/\?/)?i.search&&(a+="&"+i.search.substr(1)):a+=i.search),a+="#elf_"+n.hash,o=window.open(a,"_blank"),setTimeout(function(){o.focus()},1e3),r.resolve()):r.reject()}},i.prototype.commands.paste=function(){this.updateOnSelect=!1,this.handlers={changeclipboard:function(){this.update()}},this.shortcuts=[{pattern:"ctrl+v shift+insert"}],this.getstate=function(e){if(this._disabled)return-1;if(e){if(Array.isArray(e)){if(1!=e.length)return-1;e=this.fm.file(e[0])}}else e=this.fm.cwd();return this.fm.clipboard().length&&"directory"==e.mime&&e.write?0:-1},this.exec=function(t,n){var i,a,o,r=this,s=r.fm,l=n||{},c=t?this.files(t)[0]:s.cwd(),d=s.clipboard(),p=d.length,u=!!p&&d[0].cut,h=l._cmd?l._cmd:u?"move":"copy",f="err"+h.charAt(0).toUpperCase()+h.substr(1),m=[],g=[],v=e.Deferred().fail(function(e){e&&s.error(e)}).always(function(){s.unlockfiles({files:e.map(d,function(e){return e.hash})})}),b=function(t){return t.length&&s._commands.duplicate?s.exec("duplicate",t):e.Deferred().resolve()},y=function(t){var n,i=e.Deferred(),a=[],o={},d=function(t,n){for(var i=[],a=t.length;a--;)e.inArray(t[a].name,n)!==-1&&i.unshift(a);return i},p=function(e){var n=a[e],o=t[n],r=e==a.length-1;o&&s.confirm({title:s.i18n(h+"Files"),text:["errExists",o.name,"restore"===h?"confirmRest":"confirmRepl"],all:!r,accept:{label:"btnYes",callback:function(n){r||n?m(t):p(++e)}},reject:{label:"btnNo",callback:function(n){var i;if(n)for(i=a.length;e{title}',s=e('
                '),l=e('
                  '),c=e('
                  '),d=(e("base").length?document.location.href.replace(/#.*$/,""):"",function(t){e("#"+a.namespace+"-preference-tab-"+t).trigger("mouseover").trigger("click"),n=t}),p=a.res("class","tabsactive"),u=function(){var u=i.options.categories||{language:["language"],theme:["theme"],toolbar:["toolbarPref"],workspace:["iconSize","columnPref","selectAction","makefileTypes","useStoredEditor","editorMaximized","useFullscreen","showHidden"],dialog:["autoFocusDialog"],selectionInfo:["infoItems","hashChecker"],reset:["clearBrowserData"],all:!0},h=i.options.prefs||["language","theme","toolbarPref","iconSize","columnPref","selectAction","makefileTypes","useStoredEditor","editorMaximized","useFullscreen","showHidden","infoItems","hashChecker","autoFocusDialog","clearBrowserData"];a.cookieEnabled||delete u.language,h=a.arrayFlip(h,!0),a.options.getFileCallback&&delete h.selectAction,a.UA.Fullscreen||delete h.useFullscreen,h.language&&(h.language=function(){var t=e("").on("change",function(){var t=e(this).val();a.storage("lang",t),e("#"+a.id).elfinder("reload")}),n=[],o=i.options.langs||{ar:"العربية",bg:"Български",ca:"Català",cs:"Čeština",da:"Dansk",de:"Deutsch",el:"Ελληνικά",en:"English",es:"Español",fa:"فارسی",fo:"Føroyskt",fr:"Français",fr_CA:"Français (Canada)",he:"עברית",hr:"Hrvatski",hu:"Magyar",id:"Bahasa Indonesia",it:"Italiano",ja:"日本語",ko:"한국어",nl:"Nederlands",no:"Norsk",pl:"Polski",pt_BR:"Português",ro:"Română",ru:"Pусский",si:"සිංහල",sk:"Slovenčina",sl:"Slovenščina",sr:"Srpski",sv:"Svenska",tr:"Türkçe",ug_CN:"ئۇيغۇرچە",uk:"Український",vi:"Tiếng Việt",zh_CN:"简体中文",zh_TW:"正體中文"};return a.cookieEnabled?(e.each(o,function(e,t){n.push('")}),t.append(n.join("")).val(a.lang)):e()}()),h.theme&&(h.theme=function(){var t=a.options.themes?Object.keys(a.options.themes).length:0;if(0===t||1===t&&a.options.themes["default"])return null;var n=e("").on("change",function(){var t=e(this).val();a.changeTheme(t).storage("theme",t)}),i={image:'',link:'$2',data:'
                  $1
                  $2
                  '},o=["image","description","author","email","license"],r=e('').text(a.i18n("default")).on("click",function(e){n.val("default").trigger("change")}),s=e('
                  ').on("click","button",function(){var t=e(this).data("themeid");n.val(t).trigger("change")});return a.options.themes["default"]||n.append('"),e.each(a.options.themes,function(t,r){var l,c=e('"),d=e('
                  '+a.i18n(t)+'
                  ');n.append(c),s.append(d),l=setTimeout(function(){d.find("span.elfinder-spinner").replaceWith(a.i18n(["errRead",t]))},1e4),a.getTheme(t).always(function(){l&&clearTimeout(l)}).done(function(r){var s,l=e(),p=e("
                  ");s=r.link?i.link.replace(/\$1/g,r.link).replace(/\$3/g,a.i18n("website")):"$2",r.name&&c.html(a.i18n(r.name)),d.children("legend").html(s.replace(/\$2/g,a.i18n(r.name)||t)),e.each(o,function(o,s){var l,c=i[s]||i.data;r[s]&&(l=c.replace(/\$0/g,a.escape(s)).replace(/\$1/g,a.i18n(s)).replace(/\$2/g,a.i18n(r[s])),"image"===s&&r.link&&(l=e(l).on("click",function(){n.val(t).trigger("change")}).attr("title",a.i18n("select"))),p.append(l))}),l=l.add(p),l=l.add(e('
                  ').append(e('').data("themeid",t).html(a.i18n("select")))),d.find("span.elfinder-spinner").replaceWith(l)}).fail(function(){d.find("span.elfinder-spinner").replaceWith(a.i18n(["errRead",t]))})}),e("
                  ").append(n.val(a.theme&&a.theme.id?a.theme.id:"default"),r,s)}()),h.toolbarPref&&(h.toolbarPref=function(){var t=e.map(a.options.uiOptions.toolbar,function(t){return e.isArray(t)?t:null}),n=[],i=a.storage("toolbarhides")||{};return e.each(t,function(){var e=this,t=a.i18n("cmd"+e);t==="cmd"+e&&(t=a.i18n(e)),n.push('")}),e(n.join(" ")).on("change","input",function(){var t=e(this).val(),n=e(this).is(":checked");n||i[t]?n&&i[t]&&delete i[t]:i[t]=!0,a.storage("toolbarhides",i),a.trigger("toolbarpref")})}()),h.iconSize&&(h.iconSize=function(){var t=a.options.uiOptions.cwd.iconsView.sizeMax||3,n=a.storage("iconsize")||a.options.uiOptions.cwd.iconsView.size||0,i=e('
                  ').slider({classes:{"ui-slider-handle":"elfinder-tabstop"},value:n,max:t,slide:function(e,t){a.getUI("cwd").trigger("iconpref",{size:t.value})},change:function(e,t){a.storage("iconsize",t.value)}});return a.getUI("cwd").on("iconpref",function(e,t){i.slider("option","value",t.size)}),i}()),h.columnPref&&(h.columnPref=function(){var t=a.options.uiOptions.cwd.listView.columns,n=[],i=a.storage("columnhides")||{};return e.each(t,function(){var e=this,t=a.getColumnName(e);n.push('")}),e(n.join(" ")).on("change","input",function(){var t=e(this).val(),n=e(this).is(":checked");n||i[t]?n&&i[t]&&delete i[t]:i[t]=!0,a.storage("columnhides",i),a.trigger("columnpref",{repaint:!0})})}()),h.selectAction&&(h.selectAction=function(){var t=e("").on("change",function(){var t=e(this).val();a.storage("selectAction","default"===t?null:t)}),n=[],o=i.options.selectActions,r=a.getCommand("open").options.selectAction||"open";return e.inArray(r,o)===-1&&o.unshift(r),e.each(o,function(t,i){var o=e.map(i.split("/"),function(e){var t=a.i18n("cmd"+e);return t==="cmd"+e&&(t=a.i18n(e)),t});n.push('")}),t.append(n.join("")).val(a.storage("selectAction")||r)}()),h.makefileTypes&&(h.makefileTypes=function(){var t=a.getCommand("edit").getMkfileHides(),n=function(){var n=[];return t=a.getCommand("edit").getMkfileHides(),e.each(a.mimesCanMakeEmpty,function(e,i){var o=a.getCommand("mkfile").getTypeName(e,i);n.push('")}),n.join(" ")},i=e("
                  ").on("change","input",function(){var n=e(this).val(),i=e(this).is(":checked");i||t[n]?i&&t[n]&&delete t[n]:t[n]=!0,a.storage("mkfileHides",t),a.trigger("canMakeEmptyFile")}).append(n()),o=e("
                  ").append(e('').on("keydown",function(t){t.keyCode===e.ui.keyCode.ENTER&&e(this).next().trigger("click")}),e('').html(a.i18n("add")).on("click",function(){var t,n=e(this).prev(),i=n.val(),o=a.getUI("toast"),r=function(){return o.appendTo(n.closest(".ui-dialog")),a.toast({msg:a.i18n("errUsupportType"),mode:"warning",onHidden:function(){1===o.children().length&&o.appendTo(a.getUI())}}),n.trigger("focus"),!1};if(!i.match(/\//)){if(i=a.arrayFlip(a.mimeTypes)[i],!i)return r();n.val(i)}return a.mimeIsText(i)&&a.mimeTypes[i]?(a.trigger("canMakeEmptyFile",{mimes:[i],unshift:!0}),t={},t[i]=a.mimeTypes[i],a.storage("mkfileTextMimes",Object.assign(t,a.storage("mkfileTextMimes")||{})),n.val(""),o.appendTo(n.closest(".ui-dialog")),void a.toast({msg:a.i18n(["complete",i+" ("+t[i]+")"]),onHidden:function(){1===o.children().length&&o.appendTo(a.getUI())}})):r()}),e('').html(a.i18n("reset")).on("click",function(){a.one("canMakeEmptyFile",{done:function(){i.empty().append(n())}}),a.trigger("canMakeEmptyFile",{resetTexts:!0})}));return a.bind("canMakeEmptyFile",{done:function(e){e.data&&e.data.mimes&&e.data.mimes.length&&i.empty().append(n())}}),e("
                  ").append(i,o)}()),h.useStoredEditor&&(h.useStoredEditor=e('').prop("checked",function(){var e=a.storage("useStoredEditor");return e?e>0:a.options.commandsOptions.edit.useStoredEditor}()).on("change",function(t){a.storage("useStoredEditor",e(this).is(":checked")?1:-1)})),h.editorMaximized&&(h.editorMaximized=e('').prop("checked",function(){var e=a.storage("editorMaximized");return e?e>0:a.options.commandsOptions.edit.editorMaximized}()).on("change",function(t){a.storage("editorMaximized",e(this).is(":checked")?1:-1)})),h.useFullscreen&&(h.useFullscreen=e('').prop("checked",function(){var e=a.storage("useFullscreen");return e?e>0:"screen"===a.options.commandsOptions.fullscreen.mode}()).on("change",function(t){a.storage("useFullscreen",e(this).is(":checked")?1:-1)})),h.showHidden&&!function(){var t,n=function(){var n,i=a.storage("hide"),o=[];i&&i.items&&e.each(i.items,function(e,t){o.push(a.escape(t))}),r.prop("disabled",!o.length)[o.length?"removeClass":"addClass"]("ui-state-disabled"),n=o.length?o.join("\n"):"",h.showHidden.attr("title",n),t&&h.showHidden.tooltip("option","content",n.replace(/\n/g,"
                  ")).tooltip("close")},i=e('').prop("checked",function(){var e=a.storage("hide");return e&&e.show}()).on("change",function(t){var n={};n[e(this).is(":checked")?"show":"hide"]=!0,a.exec("hide",void 0,n)}),o=e('').append(a.i18n("reset")).on("click",function(){a.exec("hide",void 0,{reset:!0}),e(this).parent().find("input:first").prop("checked",!1),n()}),r=e().add(i).add(o);h.showHidden=e("
                  ").append(i,o),a.bind("hide",function(e){var t=e.data;t.opts&&(t.opts.show||t.opts.hide)||n()}),a.UA.Mobile&&e.fn.tooltip&&(t=!0,h.showHidden.tooltip({classes:{"ui-tooltip":"elfinder-ui-tooltip ui-widget-shadow"},tooltipClass:"elfinder-ui-tooltip ui-widget-shadow",track:!0}).css("user-select","none"),o.css("user-select","none")),n()}(),h.infoItems&&(h.infoItems=function(){var t=a.getCommand("info").items,n=[],i=a.storage("infohides")||a.arrayFlip(a.options.commandsOptions.info.hideItems,!0);return e.each(t,function(){var e=this,t=a.i18n(e);n.push('")}),e(n.join(" ")).on("change","input",function(){var t=e(this).val(),n=e(this).is(":checked");n||i[t]?n&&i[t]&&delete i[t]:i[t]=!0,a.storage("infohides",i),a.trigger("infopref",{repaint:!0})})}()),h.hashChecker&&a.hashCheckers.length&&(h.hashChecker=function(){var t=[],n=a.arrayFlip(a.storage("hashchekcer")||a.options.commandsOptions.info.showHashAlgorisms,!0);return e.each(a.hashCheckers,function(){var e=this,i=a.i18n(e);t.push('")}),e(t.join(" ")).on("change","input",function(){var t=e(this).val(),i=e(this).is(":checked");i?n[t]=!0:n[t]&&delete n[t],a.storage("hashchekcer",e.grep(a.hashCheckers,function(e){return n[e]}))})}()),h.autoFocusDialog&&(h.autoFocusDialog=e('').prop("checked",function(){var e=a.storage("autoFocusDialog");return e?e>0:a.options.uiOptions.dialog.focusOnMouseOver}()).on("change",function(t){a.storage("autoFocusDialog",e(this).is(":checked")?1:-1)})),h.clearBrowserData&&(h.clearBrowserData=e("").text(a.i18n("reset")).button().on("click",function(t){t.preventDefault(),a.storage(),e("#"+a.id).elfinder("reload")})),e.each(u,function(t,i){var s,d;i===!0?d=1:i&&(s=e(),e.each(i,function(t,n){var i,o,r,l="";(i=h[n])&&(d=2,o=a.i18n(n),r=e(i).filter('input[type="checkbox"]'),r.length||(r=e(i).find('input[type="checkbox"]')),1===r.length?(r.attr("id")||r.attr("id","elfinder-preference-"+n+"-checkbox"),o='"):r.length>1&&(l=" elfinder-preference-checkboxes"),s=s.add(e('
                  '+o+"
                  ")).add(e('
                  ').append(i)))})),d&&(l.append(r[o](/\{id\}/g,t)[o](/\{title\}/,a.i18n(t))[o](/\{class\}/,n===t?"elfinder-focus":"")),2===d&&c.append(e('
                  ').hide().append(e("
                  ").append(s))))}),l.on("click","a",function(t){var n=e(t.target),i=n.attr("href");t.preventDefault(),t.stopPropagation(),l.children().removeClass(p),n.removeClass("ui-state-hover").parent().addClass(p),i.match(/all$/)?c.addClass("elfinder-preference-taball").children().show():(c.removeClass("elfinder-preference-taball").children().hide(),e(i).show())}).on("focus blur","a",function(t){e(this).parent().toggleClass("ui-state-focus","focusin"===t.type)}).on("mouseenter mouseleave","li",function(t){e(this).toggleClass("ui-state-hover","mouseenter"===t.type)}),c.find("a,input,select,button").addClass("elfinder-tabstop"),s.append(l,c),t=i.fmDialog(s,{title:i.title,width:i.options.width||600,height:i.options.height||400,maxWidth:"window",maxHeight:"window",autoOpen:!1,destroyOnClose:!1,allowMinimize:!1,open:function(){n&&d(n),n=null},resize:function(){c.height(t.height()-l.outerHeight(!0)-(c.outerHeight(!0)-c.height())-5)}}).on("click",function(e){e.stopPropagation()}).css({overflow:"hidden"}),t.closest(".ui-dialog").css({overflow:"hidden"}).addClass("elfinder-bg-translucent"),n="all"};this.shortcuts=[{pattern:"ctrl+comma",description:this.title}],this.alwaysEnabled=!0,this.getstate=function(){return 0},this.exec=function(n,i){return!t&&u(),i&&(i.tab?d(i.tab):"cwd"===i._currentType&&d("workspace")),t.elfinderdialog("open"),e.Deferred().resolve()}},(i.prototype.commands.quicklook=function(){var t,n,i,a,o,r,s,l,c,d,p=this,u=p.fm,h=0,f=1,m=2,g=3,v=4,b=h,y=Element.update?"quicklookupdate":"update",w="elfinder-quicklook-navbar-icon",x="elfinder-quicklook-fullscreen",k="elfinder-quicklook-info-wrapper",C=function(t){e(document).trigger(e.Event("keydown",{keyCode:t,ctrlKey:!1,shiftKey:!1,altKey:!1,metaKey:!1}))},z=function(e){var t=u.getUI().offset(),n=function(){var t=e.find(".elfinder-cwd-file-wrapper");return t.length?t:e}(),i=n.offset()||{top:0,left:0};return{opacity:0,width:n.width(),height:n.height()-30,top:i.top-t.top,left:i.left-t.left}},T=function(){var i=p.options.contain||u.options.dialogContained,a=i?u.getUI():e(window),o=u.getUI().offset(),r=Math.min(t,a.width()-10),s=Math.min(n,a.height()-80);return{opacity:1,width:r,height:s,top:parseInt((a.height()-s-60)/2+(i?0:a.scrollTop()-o.top)),left:parseInt((a.width()-r)/2+(i?0:a.scrollLeft()-o.left))}},A={},j=function(e,t){var n=t||e.substr(0,e.indexOf("/")),i=A[n]?A[n]:A[n]=document.createElement(n),a=!1;try{a=i.canPlayType&&i.canPlayType(e)}catch(o){}return!(!a||""===a||"no"==a)},S=window.navigator.platform.indexOf("Win")!=-1,O=!1,I=!1,M=!1,E=null,F=e.ui.keyCode.LEFT,D=e.ui.keyCode.RIGHT,U="mousemove touchstart "+("onwheel"in document?"wheel":"onmousewheel"in document?"mousewheel":"DOMMouseScroll"),P=e(''),q=e("
                  "),R=e('
                  '),H=e('
                  '),_=e('
                  ').on("click touchstart",function(t){if(!M){var n=p.window,i=n.hasClass(x),o=e(window),r=function(){p.preview.trigger("changesize")};t.stopPropagation(),t.preventDefault(),i?(G="",L(),n.toggleClass(x).css(n.data("position")),o.trigger(p.resize).off(p.resize,r),V.off("mouseenter mouseleave"),H.off(U)):(n.toggleClass(x).data("position",{left:n.css("left"),top:n.css("top"),width:n.width(),height:n.height(),display:"block"}).removeAttr("style"),e(window).on(p.resize,r).trigger(p.resize),H.on(U,function(e){I||("mousemove"!==e.type&&"touchstart"!==e.type||(L(),E=setTimeout(function(){(u.UA.Mobile||V.parent().find(".elfinder-quicklook-navbar:hover").length<1)&&V.fadeOut("slow",function(){H.show()})},3e3)),H.is(":visible")&&(W(),H.data("tm",setTimeout(function(){H.show()},3e3))))}).show().trigger("mousemove"),V.on("mouseenter mouseleave",function(e){I||("mouseenter"===e.type?L():H.trigger("mousemove"))})),u.zIndex&&n.css("z-index",u.zIndex+1),u.UA.Mobile?V.attr("style",G):V.attr("style",G).draggable(i?"destroy":{start:function(){I=!0,M=!0,H.show(),L()},stop:function(){I=!1,G=p.navbar.attr("style"),requestAnimationFrame(function(){M=!1})}}),e(this).toggleClass(w+"-fullscreen-off");var s=n;a.is(".ui-resizable")&&(s=s.add(a)),s.resizable(i?"enable":"disable").removeClass("ui-state-disabled"),n.trigger("viewchange")}}),N=function(){p.update(void 0,function(){var t=p.fm,n=t.selectedFiles(),i=n.length,a=(p.docked(),function(){var a=0;return e.each(n,function(e,t){var n=parseInt(t.ts);a>=0?n>a&&(a=n):a="unknown"}),{hash:n[0].hash+"/"+ +new Date,name:t.i18n("items")+": "+i,mime:"group",size:J,ts:a,files:e.map(n,function(e){return e.hash}),getSize:!0}});return i||(i=1,n=[t.cwd()]),1===i?n[0]:a()}())},L=function(){p.window.hasClass(x)&&(E&&clearTimeout(E),E=null,V.stop(!0,!0).css("display","block"),W())},W=function(){H.data("tm")&&clearTimeout(H.data("tm")),H.removeData("tm"),H.hide()},B=e('
                  ').on("click touchstart",function(e){return!M&&C(F),!1}),$=e('
                  ').on("click touchstart",function(e){return!M&&C(D),!1}),V=e('
                  ').append(B).append(_).append($).append('
                  ').append(e('
                  ').on("click touchstart",function(e){return!M&&p.window.trigger("close"),!1})),K=e('').on("mousedown",function(e){e.stopPropagation(),p.window.trigger("close")}),X=e('').on("mousedown",function(e){e.stopPropagation(),p.docked()?p.window.trigger("navdockout"):p.window.trigger("navdockin")}),J=''+u.i18n("calc")+'',G="",Y=!0;this.flags={},this.cover=H,this.evUpdate=y,(this.navbar=V)._show=L,this.resize="resize."+u.namespace,this.info=e("
                  ").addClass(k).append(q).append(R),this.autoPlay=function(){return!!p.opened()&&!!p.options[p.docked()?"dockAutoplay":"autoplay"]},this.preview=e('
                  ').on("change",function(){L(),V.attr("style",G),p.docked()&&V.hide(),p.preview.attr("style","").removeClass("elfinder-overflow-auto"),p.info.attr("style","").hide(),p.cover.removeClass("elfinder-quicklook-coverbg"),q.removeAttr("class").attr("style",""),R.html("")}).on(y,function(t){var n,i,a=(p.preview,t.file),r='
                  {value}
                  ',s=function(){var s=p.window.css("overflow","hidden");i=u.escape(a.i18||a.name),!a.read&&t.stopImmediatePropagation(),p.window.data("hash",a.hash),p.preview.off("changesize").trigger("change").children().remove(),P.html(i),B.css("visibility",""),$.css("visibility",""),a.hash===u.cwdId2Hash(o.find("[id]:not(.elfinder-cwd-parent):first").attr("id"))&&B.css("visibility","hidden"),a.hash===u.cwdId2Hash(o.find("[id]:last").attr("id"))&&$.css("visibility","hidden"),"directory"===a.mime?c=[a.hash]:"group"===a.mime&&a.getSize&&(c=a.files),R.html(r.replace(/\{value\}/,i)+r.replace(/\{value\}/,u.mime2kind(a))+r.replace(/\{value\}/,c.length?J:u.formatSize(a.size))+r.replace(/\{value\}/,u.i18n("modify")+": "+u.formatDate(a))),c.length&&(l=u.getSize(c).done(function(e){R.find("span.elfinder-spinner").parent().html(e.formated)}).fail(function(){R.find("span.elfinder-spinner").parent().html(u.i18n("unknown"))}).always(function(){l=null}),l._hash=a.hash),q.addClass("elfinder-cwd-icon ui-corner-all "+u.mime2class(a.mime)),a.icon&&q.css(u.getIconStyle(a,!0)),p.info.attr("class",k),a.csscls&&p.info.addClass(a.csscls),a.read&&(n=u.tmb(a))&&e("").hide().appendTo(p.preview).on("load",function(){q.addClass(n.className).css("background-image","url('"+n.url+"')"),e(this).remove()}).attr("src",n.url),p.info.delay(100).fadeIn(10),p.window.hasClass(x)&&H.trigger("mousemove"),s.css("overflow","")},c=[];a&&!Object.keys(a).length&&(a=u.cwd()),a&&l&&"pending"===l.state()&&l._hash!==a.hash&&l.reject(),a&&(t.forceUpdate||p.window.data("hash")!==a.hash)?s():t.stopImmediatePropagation()}),this.window=e('
                  ').hide().addClass(u.UA.Touch?"elfinder-touch":"").on("click",function(e){var t=this;e.stopPropagation(),b===m&&requestAnimationFrame(function(){b===m&&u.toFront(t)})}).append(e('
                  ').append(e('').append(K,X),P),this.preview,p.info.hide(),H.hide(),V).draggable({handle:"div.elfinder-quicklook-titlebar"}).on("open",function(e,t){var n=p.window,i=p.value,a=u.getUI("cwd"),o=function(e){b=e,p.update(1,p.value),p.change(),n.trigger("resize."+u.namespace)};Y||b!==h?b===v&&(u.getUI("navdock").data("addNode")(c),o(g),p.preview.trigger("changesize"),u.storage("previewDocked","1"),0===u.getUI("navdock").width()&&n.trigger("navdockout")):(i&&i.hash!==r&&(a=u.cwdHash2Elm(i.hash.split("/",2)[0])),G="",V.attr("style",""),b=f,a.trigger("scrolltoview"),W(),n.css(t||z(a)).show().animate(T(),550,function(){o(m),L()}),u.toFront(n))}).on("close",function(e,t){var n,i=p.window,a=p.preview.trigger("change"),r=(p.value,(i.data("hash")||"").split("/",2)[0]),s=function(e,n){b=e,n&&u.toHide(i),a.children().remove(),p.update(0,p.value),i.data("hash",""),t&&t.resolve()};p.opened()&&(l&&"pending"===l.state()&&l.reject(),p.docked()?(c=u.getUI("navdock").data("removeNode")(p.window.attr("id"),"detach"),s(v),u.storage("previewDocked","2")):(b=f,i.hasClass(x)&&_.click(),r&&(n=o.find("#"+r)).length?i.animate(z(n),500,function(){a.off("changesize"),s(h,!0)}):s(h,!0)))}).on("navdockin",function(e,t){var n=p.window,a=u.getUI("navdock"),o=s||a.width(),r=t||{};Y&&(r.init=!0),b=g,i=n.attr("style"),n.toggleClass("ui-front").removeClass("ui-widget").draggable("disable").resizable("disable").removeAttr("style").css({width:"100%",height:o,boxSizing:"border-box",paddingBottom:0,zIndex:"unset"}),V.hide(),X.toggleClass("ui-icon-plusthick ui-icon-minusthick elfinder-icon-full elfinder-icon-minimize"),u.toHide(n,!0),a.data("addNode")(n,r),p.preview.trigger("changesize"),u.storage("previewDocked","1")}).on("navdockout",function(t){var n=p.window,a=u.getUI("navdock"),o=(e.Deferred(),z(p.preview));s=n.outerHeight(),a.data("removeNode")(n.attr("id"),u.getUI()),n.toggleClass("ui-front").addClass("ui-widget").draggable("enable").resizable("enable").attr("style",i),X.toggleClass("ui-icon-plusthick ui-icon-minusthick elfinder-icon-full elfinder-icon-minimize"),b=h,n.trigger("open",o),u.storage("previewDocked","0")}).on("resize."+u.namespace,function(){p.preview.trigger("changesize")}),this.alwaysEnabled=!0,this.value=null,this.handlers={select:function(e,t){d&&cancelAnimationFrame(d),e.data&&e.data.selected&&e.data.selected.length?p.opened()&&N():d=requestAnimationFrame(function(){p.opened()&&N()})},error:function(){p.window.is(":visible")&&p.window.trigger("close")},"searchshow searchhide":function(){this.opened()&&this.window.trigger("close")},navbarshow:function(){requestAnimationFrame(function(){p.docked()&&p.preview.trigger("changesize")})},destroy:function(){p.window.remove()}},this.shortcuts=[{pattern:"space"}],this.support={audio:{ogg:j("audio/ogg;"),webm:j("audio/webm;"),mp3:j("audio/mpeg;"),wav:j("audio/wav;"),m4a:j("audio/mp4;")||j("audio/x-m4a;")||j("audio/aac;"),flac:j("audio/flac;"),amr:j("audio/amr;")},video:{ogg:j("video/ogg;"),webm:j("video/webm;"),mp4:j("video/mp4;"),mkv:j("video/x-matroska;")||j("video/webm;"),"3gp":j("video/3gpp;")||j("video/mp4;"),m3u8:j("application/x-mpegURL","video")||j("application/vnd.apple.mpegURL","video"),mpd:j("application/dash+xml","video")}},A={},this.closed=function(){return b==h||b==v},this.opened=function(){return b==m||b==g},this.docked=function(){return b==g},this.addIntegration=function(e){requestAnimationFrame(function(){u.trigger("helpIntegration",Object.assign({cmd:"quicklook"},e))})},this.init=function(){var i,l=this.options,c=this.window,d=this.preview;t=l.width>0?parseInt(l.width):450,n=l.height>0?parseInt(l.height):300,"auto"!==l.dockHeight&&(s=parseInt(l.dockHeight),s||(s=void 0)),u.one("load",function(){O=u.getUI("navdock").data("dockEnabled"),!O&&X.hide(),a=u.getUI(),o=u.getUI("cwd"),u.zIndex&&c.css("z-index",u.zIndex+1),c.appendTo(a),e(document).on("keydown."+u.namespace,function(t){t.keyCode==e.ui.keyCode.ESCAPE&&p.opened()&&!p.docked()&&c.hasClass("elfinder-frontmost")&&c.trigger("close")}),c.resizable({handles:"se",minWidth:350,minHeight:120,resize:function(){d.trigger("changesize")}}),p.change(function(){p.opened()&&p.value&&(p.value.tmb&&1==p.value.tmb&&(p.value=Object.assign({},u.file(p.value.hash))),d.trigger(e.Event(y,{file:p.value})))}),d.on(y,function(e){var t,n,a;if(t=e.file){if(n=t.hash,a=u.searchStatus.mixed&&u.searchStatus.state>1,"directory"!==t.mime)if(parseInt(t.size)||t.mime.match(l.mimeRegexNotEmptyCheck)){if(p.dispInlineRegex=i,a||u.optionsByHashes[n])try{p.dispInlineRegex=new RegExp(u.option("dispInlineRegex",n),"i")}catch(e){try{p.dispInlineRegex=new RegExp(u.isRoot(t)?u.options.dispInlineRegex:u.option("dispInlineRegex",t.phash),"i")}catch(e){p.dispInlineRegex=/^$/}}}else e.stopImmediatePropagation();else p.dispInlineRegex=/^$/;p.info.show()}else e.stopImmediatePropagation()}),e.each(u.commands.quicklook.plugins||[],function(e,t){"function"==typeof t&&new t(p)})}).one("open",function(){var e,t=Number(u.storage("previewDocked")||l.docked);O&&t>=1&&(e=p.window,p.exec(),e.trigger("navdockin",{init:!0}),2===t?e.trigger("close"):(p.update(void 0,u.cwd()),p.change())),Y=!1}).bind("open",function(){r=u.cwd().hash,p.value=u.cwd();try{i=new RegExp(u.option("dispInlineRegex"),"i")}catch(e){i=/^$/}}).bind("change",function(t){t.data&&t.data.changed&&p.opened()&&e.each(t.data.changed,function(){if(p.window.data("hash")===this.hash)return p.window.data("hash",null),p.preview.trigger(y),!1})}).bind("navdockresizestart navdockresizestop",function(e){H["navdockresizestart"===e.type?"show":"hide"]()})},this.getstate=function(){return p.opened()?1:0},this.exec=function(){return p.closed()&&N(),p.enabled()&&p.window.trigger(p.opened()?"close":"open"),e.Deferred().resolve()},this.hideinfo=function(){this.info.stop(!0,!0).hide()}}).prototype={forceLoad:!0},i.prototype.commands.quicklook.plugins=[function(t){var n,i,a=["image/jpeg","image/png","image/gif","image/svg+xml","image/x-ms-bmp"],o=t.fm.returnBytes(t.options.getDimThreshold||0),r=t.preview;n=new Image,n.onload=n.onerror=function(){2==n.height&&a.push("image/webp")},n.src="data:image/webp;base64,UklGRjoAAABXRUJQVlA4IC4AAACyAgCdASoCAAIALmk0mk0iIiIiIgBoSygABc6WWgAA/veff/0PP8bA//LwYAAA",e.each(navigator.mimeTypes,function(t,n){var i=n.type;0===i.indexOf("image/")&&e.inArray(i,a)&&a.push(i)}),r.on(t.evUpdate,function(n){var s,l,c,d,p=t.fm,u=n.file,h=!1,f=null,m=function(e){var t=p.file(u.hash);t.width=e[0],t.height=e[1]},g=function(){var e,t,n,i,a;f&&f.state&&"pending"===f.state()&&f.reject(),h||(h=!0,e=s.get(0),t=u.width&&u.height?{w:u.width,h:u.height}:e.naturalWidth?null:{w:s.width(),h:s.height()},t&&s.removeAttr("width").removeAttr("height"),n=u.width||e.naturalWidth||e.width||s.width(),i=u.height||e.naturalHeight||e.height||s.height(),u.width&&u.height||m([n,i]),t&&s.width(t.w).height(t.h),a=(n/i).toFixed(2),r.on("changesize",function(){var e,t,n=parseInt(r.width()),i=parseInt(r.height());a<(n/i).toFixed(2)?(t=i,e=Math.floor(t*a)):(e=n,t=Math.floor(e/a)),s.width(e).height(t).css("margin-top",t'+p.i18n("nowLoading")+'
                ').appendTo(t.info.find(".elfinder-quicklook-info")),c=e('
                ').appendTo(l),s=e("").hide().appendTo(r).on("load",function(){v(),g()}).on("error",function(){l.remove()}),d=p.openUrl(u.hash,!1,function(e){s.attr("src",e)},{progressBar:c}),r.one("change",function(){d&&d.state&&"pending"===d.state()&&d.reject()}),u.width&&u.height?g():u.size>o&&(f=p.request({data:{cmd:"dim",target:u.hash},preventDefault:!0}).done(function(e){if(e.dim){var t=e.dim.split("x");u.width=t[0],u.height=t[1],m(t),g()}})))})},function(t){var n=t.fm,i="image/tiff",a=t.preview;window.Worker&&window.Uint8Array&&a.on(t.evUpdate,function(o){var r,s,l,c,d,p=o.file,u=function(e){c&&c.terminate(),r.remove(),n.debug("error",e)},h=function(e){var t=n.file(p.hash);t.width=e[0],t.height=e[1]};p.mime===i&&(o.stopImmediatePropagation(),r=e('
                '+n.i18n("nowLoading")+'
                ').appendTo(t.info.find(".elfinder-quicklook-info")),s=e('
                ').appendTo(r),a.one("change",function(){c&&c.terminate(),r.remove()}),d=n.getContents(p.hash,"arraybuffer",{progressBar:s}).done(function(i){if(i){l=e("
                ").css({width:"100%",height:"100%"}).hide().appendTo(a);try{c=n.getWorker(),c.onmessage=function(n){var i,o,s,d,u=n.data;c&&c.terminate(),i=document.createElement("canvas"),o=i.getContext("2d"),i.width=u.width,i.height=u.height,s=o.createImageData(u.width,u.height),s.data.set(new Uint8Array(u.image)),o.putImageData(s,0,0),l.append(i).show(),r.remove(),d=(u.width/u.height).toFixed(2), +a.on("changesize",function(){var t,n,o=parseInt(a.width()),r=parseInt(a.height());d<(o/r).toFixed(2)?(n=r,t=Math.floor(n*d)):(t=o,n=Math.floor(t/d)),e(i).width(t).height(n).css("margin-top",n'+i.i18n("nowLoading")+'
                ').appendTo(t.info.find(".elfinder-quicklook-info")),d=e('
                ').appendTo(c),h=i.openUrl(f.hash,"sameorigin",function(t){t&&(l=e("").hide().appendTo(o),n?r(t,l,c):(p=window.define,u=window.require,window.require=null,window.define=null,i.loadScript([i.options.cdns.psd],function(){n=require("psd"),p?window.define=p:delete window.define,u?window.require=u:delete window.require,r(t,l,c)})))},{progressBar:d}),o.one("change",function(){h&&h.state&&"pending"===h.state()&&h.reject()}))})},function(t){var n=t.fm,i=n.arrayFlip(["text/html","application/xhtml+xml"]),a=t.preview;a.on(t.evUpdate,function(o){var r,s,l,c=o.file;i[c.mime]&&t.dispInlineRegex.test(c.mime)&&(!t.options.getSizeMax||c.size<=t.options.getSizeMax)&&(o.stopImmediatePropagation(),s=e('
                '+n.i18n("nowLoading")+'
                ').appendTo(t.info.find(".elfinder-quicklook-info")),l=e('
                ').appendTo(s),a.one("change",function(){"pending"==r.state()&&r.reject()}).addClass("elfinder-overflow-auto"),r=n.request({data:{cmd:"get",target:c.hash,conv:1,_t:c.ts},options:{type:"get",cache:!0},preventDefault:!0,progressBar:l}).done(function(n){t.hideinfo();var i=e('').appendTo(a)[0].contentWindow.document;i.open(),i.write(n.content),i.close()}).always(function(){s.remove()}))})},function(t){var n=t.fm,i=n.arrayFlip(["text/x-markdown"]),a=t.preview,o=null,r=function(n,i){t.hideinfo();var r=e('').appendTo(a)[0].contentWindow.document;r.open(),r.write((o.parse||o)(n.content)),r.close(),i.remove()},s=function(e){o=!1,e.remove()};a.on(t.evUpdate,function(l){var c,d,p,u=l.file;i[u.mime]&&n.options.cdns.marked&&o!==!1&&t.dispInlineRegex.test(u.mime)&&(!t.options.getSizeMax||u.size<=t.options.getSizeMax)&&(l.stopImmediatePropagation(),d=e('
                '+n.i18n("nowLoading")+'
                ').appendTo(t.info.find(".elfinder-quicklook-info")),p=e('
                ').appendTo(d),a.one("change",function(){"pending"==c.state()&&c.reject()}).addClass("elfinder-overflow-auto"),c=n.request({data:{cmd:"get",target:u.hash,conv:1,_t:u.ts},options:{type:"get",cache:!0},preventDefault:!0,progressBar:p}).done(function(e){o||window.marked?(o||(o=window.marked),r(e,d)):n.loadScript([n.options.cdns.marked],function(t){o=t||window.marked||!1,delete window.marked,o?r(e,d):s(d)},{tryRequire:!0,error:function(){s(d)}})}).fail(function(){s(d)}))})},function(t){if(t.options.viewerjs){var n=t.fm,i=t.preview,a=t.options.viewerjs,o=a.url?n.arrayFlip(a.mimes||[]):[],r=t.window,s=t.navbar,l=function(){s.css("bottom",r.hasClass("elfinder-quicklook-fullscreen")?"30px":"")};a.url&&i.on("update",function(s){var c,d,p,u,h=s.file;!o[h.mime]||"application/pdf"===h.mime&&a.pdfNative&&t.flags.pdfNative||(s.stopImmediatePropagation(),d=e('
                '+n.i18n("nowLoading")+'
                ').appendTo(t.info.find(".elfinder-quicklook-info")),p=e('
                ').appendTo(d),u=n.openUrl(h.hash,"sameorigin",function(n){n&&(c=e('').css("background-color","transparent").on("load",function(){t.hideinfo(),d.remove(),c.css("background-color","#fff")}).on("error",function(){d.remove(),c.remove()}).appendTo(i).attr("src",a.url+"#"+n),r.on("viewchange.viewerjs",l),l(),i.one("change",function(){r.off("viewchange.viewerjs"),d.remove(),c.off("load").remove()}))},{progressBar:p}),i.one("change",function(){u&&u.state&&"pending"===u.state()&&u.reject()}))})}},function(t){var n=t.fm,i="application/pdf",a=t.preview,o=!1,r="";n.UA.Safari&&"mac"===n.OS&&!n.UA.iOS||n.UA.IE||n.UA.Firefox?o=!0:e.each(navigator.plugins,function(t,n){e.each(n,function(e,t){if(t.type===i)return!(o=!0)})}),t.flags.pdfNative=o,o&&("undefined"==typeof t.options.pdfToolbar||t.options.pdfToolbar||(r="#toolbar=0"),a.on(t.evUpdate,function(s){var l,c=s.file;o&&c.mime===i&&t.dispInlineRegex.test(c.mime)&&(s.stopImmediatePropagation(),l=n.openUrl(c.hash,!1,function(i){i&&(t.hideinfo(),t.cover.addClass("elfinder-quicklook-coverbg"),e('').on("error",function(e){o=!1,t.update(void 0,n.cwd()),t.update(void 0,c)}).appendTo(a))}),a.one("change",function(){l&&l.state&&"pending"===l.state()&&l.reject()}))}))},function(t){var n=t.fm,i="application/x-shockwave-flash",a=t.preview,o=!1;e.each(navigator.plugins,function(t,n){e.each(n,function(e,t){if(t.type===i)return!(o=!0)})}),o&&a.on(t.evUpdate,function(o){var r,s,l=o.file;l.mime===i&&t.dispInlineRegex.test(l.mime)&&(o.stopImmediatePropagation(),s=n.openUrl(l.hash,!1,function(n){n&&(t.hideinfo(),r=e('').appendTo(a))}),a.one("change",function(){s&&s.state&&"pending"===s.state()&&s.reject()}))})},function(t){var n,i,a,o,r,s,l=t.fm,c=t.preview,d={"audio/mpeg":"mp3","audio/mpeg3":"mp3","audio/mp3":"mp3","audio/x-mpeg3":"mp3","audio/x-mp3":"mp3","audio/x-wav":"wav","audio/wav":"wav","audio/x-m4a":"m4a","audio/aac":"m4a","audio/mp4":"m4a","audio/x-mp4":"m4a","audio/ogg":"ogg","audio/webm":"webm","audio/flac":"flac","audio/x-flac":"flac","audio/amr":"amr"},p=t.window,u=t.navbar,h="string"==typeof t.options.mediaControlsList&&t.options.mediaControlsList?' controlsList="'+l.escape(t.options.mediaControlsList)+'"':"",f=function(){u.css("bottom",p.hasClass("elfinder-quicklook-fullscreen")?"50px":"")},m=function(t,i){return e('').on("change",function(e){e.stopPropagation()}).on("error",function(e){n&&n.data("hash")===i&&b()}).data("hash",i).appendTo(c)},g=function(t){var n,i=e.Deferred(),o=e.Deferred().done(function(){var e;e=l.getContents(t,"arraybuffer",{progressBar:s}).done(function(e){try{var t=a.toWAV(new Uint8Array(e));t?i.resolve(URL.createObjectURL(new Blob([t],{type:"audio/x-wav"}))):i.reject()}catch(n){i.reject()}}).fail(function(){i.reject()}),c.one("change",function(){e&&e.state&&"pending"===e.state()&&e.reject()})}).fail(function(){a=!1,i.reject()});return window.TextEncoder&&window.URL&&URL.createObjectURL&&"undefined"==typeof a?(n=window.AMR,delete window.AMR,l.loadScript([l.options.cdns.amr],function(){a=!!window.AMR&&window.AMR,window.AMR=n,o[a?"resolve":"reject"]()},{error:function(){o.reject()}})):o[a?"resolve":"reject"](),i},v=function(e){var t,i=n.data("hash");o&&(t=e.play()),t&&t["catch"]&&t["catch"](function(t){e.paused||n&&n.data("hash")===i&&b()})},b=function(){if(n&&n.parent().length){var e=n[0],t=n.children("source").attr("src");p.off("viewchange.audio");try{e.pause(),n.empty(),t.match(/^blob:/)&&URL.revokeObjectURL(t),e.src="",e.load()}catch(i){}n.remove(),n=null}};c.on(t.evUpdate,function(u){var h,b,y=u.file,w=d[y.mime];d[y.mime]&&t.dispInlineRegex.test(y.mime)&&((h=t.support.audio[w])||"amr"===w)&&(o=t.autoPlay(),i=y.hash,h?(u.stopImmediatePropagation(),r=e('
                '+l.i18n("nowLoading")+'
                ').appendTo(t.info.find(".elfinder-quicklook-info")),s=e('
                ').appendTo(r),b=l.openUrl(i,!1,function(e){r.remove(),e?(n=m(e,i),v(n[0]),p.on("viewchange.audio",f),f()):n.remove()},{progressBar:s}),c.one("change",function(){b&&b.state&&"pending"===b.state()&&b.reject()})):l.options.cdns.amr&&"amr"===w&&a!==!1&&(u.stopImmediatePropagation(),r=e('
                '+l.i18n("nowLoading")+'
                ').appendTo(t.info.find(".elfinder-quicklook-info")),s=e('
                ').appendTo(r),n=m("",i),g(y.hash).done(function(e){if(r.remove(),i===y.hash){var t=n[0];try{n.children("source").attr("src",e),t.pause(),t.load(),v(t),p.on("viewchange.audio",f),f()}catch(a){URL.revokeObjectURL(e),n.remove()}}else URL.revokeObjectURL(e)}).fail(function(){n.remove()})))}).one("change",b)},function(t){var n,i,a,o,r,s,l,c,d,p,u=t.fm,h=t.preview,f={"video/mp4":"mp4","video/x-m4v":"mp4","video/quicktime":"mp4","video/mpeg":"mpeg","video/ogg":"ogg","application/ogg":"ogg","video/webm":"webm","video/x-matroska":"mkv","video/3gpp":"3gp","application/vnd.apple.mpegurl":"m3u8","application/x-mpegurl":"m3u8","application/dash+xml":"mpd","video/x-flv":"flv","video/x-msvideo":"avi"},m=t.window,g=t.navbar,v="string"==typeof t.options.mediaControlsList&&t.options.mediaControlsList?' controlsList="'+u.escape(t.options.mediaControlsList)+'"':"",b=function(){u.UA.iOS?m.hasClass("elfinder-quicklook-fullscreen")?(h.css("height","-webkit-calc(100% - 50px)"),g._show()):h.css("height",""):g.css("bottom",m.hasClass("elfinder-quicklook-fullscreen")?"50px":"")},y=function(i,a){var r,s=function(e){l>1&&(c&&clearTimeout(c),c=setTimeout(function(){!r&&T(!0)},800))},l=0;o=null,a=a||{},t.hideinfo(),n=e('').on("change",function(e){e.stopPropagation()}).on("timeupdate progress",s).on("canplay",function(){r=!0}).data("hash",i.hash),n[0].addEventListener("error",function(e){a.src&&u.convAbsUrl(a.src)===u.convAbsUrl(e.target.src)&&(++l,s())},!0),a.src&&n.append(''),n.appendTo(h),m.on("viewchange.video",b),b()},w=function(e){var t,a;a=u.openUrl(e.hash,!1,function(a){d.remove(),a&&(y(e),t=new i,t.loadSource(a),t.attachMedia(n[0]),l&&t.on(i.Events.MANIFEST_PARSED,function(){z(n[0])}))},{progressBar:p}),h.one("change",function(){a&&a.state&&"pending"===a.state()&&a.reject()})},x=function(e){var t;t=u.openUrl(e.hash,!1,function(t){var i;d.remove(),t&&(y(e),o=window.dashjs.MediaPlayer().create(),i=o.getDebug(),i.setLogLevel?i.setLogLevel(dashjs.Debug.LOG_LEVEL_FATAL):i.setLogToBrowserConsole&&i.setLogToBrowserConsole(!1),o.initialize(n[0],t,l),o.on("error",function(e){T(!0)}))},{progressBar:p}),h.one("change",function(){t&&t.state&&"pending"===t.state()&&t.reject()})},k=function(e){var t;return r.isSupported()?(t=u.openUrl(e.hash,!1,function(t){if(d.remove(),t){var i=r.createPlayer({type:"flv",url:t});y(e),i.on(r.Events.ERROR,function(){i.destroy(),T(!0)}),i.attachMediaElement(n[0]),i.load(),z(i)}},{progressBar:p}),void h.one("change",function(){t&&t.state&&"pending"===t.state()&&t.reject()})):void(r=!1)},C=function(e){var t;t=u.openUrl(e.hash,!1,function(t){d.remove(),t&&(y(e),n[0].src=t,s(n[0],{src:t}))},{progressBar:p}),h.one("change",function(){t&&t.state&&"pending"===t.state()&&t.reject()})},z=function(e){var t,i=n.data("hash");l&&(t=e.play()),t&&t["catch"]&&t["catch"](function(t){e.paused||n&&n.data("hash")===i&&T(!0)})},T=function(e){if(c&&clearTimeout(c),n&&n.parent().length){var i=n[0];m.off("viewchange.video"),o&&o.reset();try{i.pause(),n.empty(),i.src="",i.load()}catch(a){}n.remove(),n=null}e&&t.info.show()};h.on(t.evUpdate,function(o){var c,m,g=o.file,v=g.mime.toLowerCase(),b=f[v];f[v]&&t.dispInlineRegex.test(g.mime)&&(l=t.autoPlay(),d=e('
                '+u.i18n("nowLoading")+'
                '),p=e('
                ').appendTo(d),t.support.video[b]&&("m3u8"!==b||u.UA.Safari)?(o.stopImmediatePropagation(),d.appendTo(t.info.find(".elfinder-quicklook-info")),m=u.openUrl(g.hash,!1,function(e){d.remove(),e&&(y(g,{src:e}),z(n[0]))},{progressBar:p}),h.one("change",function(){m&&m.state&&"pending"===m.state()&&m.reject()})):i!==!1&&u.options.cdns.hls&&"m3u8"===b?(o.stopImmediatePropagation(),d.appendTo(t.info.find(".elfinder-quicklook-info")),i?w(g):(c=window.Hls,delete window.Hls,u.loadScript([u.options.cdns.hls],function(e){i=e||window.Hls||!1,window.Hls=c,i&&w(g)},{tryRequire:!0,error:function(){i=!1}}))):a!==!1&&u.options.cdns.dash&&"mpd"===b?(o.stopImmediatePropagation(),d.appendTo(t.info.find(".elfinder-quicklook-info")),a?x(g):u.loadScript([u.options.cdns.dash],function(){a=!!window.dashjs,a&&x(g)},{tryRequire:!0,error:function(){a=!1}})):r!==!1&&u.options.cdns.flv&&"flv"===b?(o.stopImmediatePropagation(),d.appendTo(t.info.find(".elfinder-quicklook-info")),r?k(g):(c=window.flvjs,delete window.flvjs,u.loadScript([u.options.cdns.flv],function(e){r=e||window.flvjs||!1,window.flvjs=c,r&&k(g)},{tryRequire:!0,error:function(){r=!1}}))):u.options.cdns.videojs&&(o.stopImmediatePropagation(),d.appendTo(t.info.find(".elfinder-quicklook-info")),s?C(g):u.loadScript([u.options.cdns.videojs+"/video.min.js"],function(e){s=e||window.videojs||!1,s&&C(g)},{tryRequire:!0,error:function(){s=!1}}).loadCss([u.options.cdns.videojs+"/video-js.min.css"])))}).one("change",T)},function(t){var n,i=t.preview,a=[],o=t.window,r=t.navbar;e.each(navigator.plugins,function(t,n){e.each(n,function(e,t){(0===t.type.indexOf("audio/")||0===t.type.indexOf("video/"))&&a.push(t.type)})}),a=t.fm.arrayFlip(a),i.on(t.evUpdate,function(s){var l,c,d,p,u=s.file,h=u.mime,f=function(){r.css("bottom",o.hasClass("elfinder-quicklook-fullscreen")?"50px":"")};a[u.mime]&&t.dispInlineRegex.test(u.mime)&&(s.stopImmediatePropagation(),d=e('
                '+fm.i18n("nowLoading")+'
                ').appendTo(t.info.find(".elfinder-quicklook-info")),p=e('
                ').appendTo(d),c=t.fm.openUrl(u.hash,!1,function(a){d.remove(),a&&((l=0===h.indexOf("video/"))&&t.hideinfo(),n=e('').appendTo(i),o.on("viewchange.embed",f),f())},{progressBar:p}),i.one("change",function(){c&&c.state&&"pending"===c.state()&&c.reject()}))}).one("change",function(){n&&n.parent().length&&(o.off("viewchange.embed"),n.remove(),n=null)})},function(t){var n=t.fm,i=n.arrayFlip(["application/zip","application/x-gzip","application/x-tar","application/x-bzip2"]),a=t.preview,o=n.returnBytes(t.options.unzipMaxSize||0),r=!(!n.options.cdns.zlibUnzip||!n.options.cdns.zlibGunzip),s=!!n.options.cdns.bzip2;window.Worker&&window.Uint8Array&&window.DataView&&a.on(t.evUpdate,function(l){var c=l.file,d="application/x-tar"===c.mime,p="application/x-bzip2"===c.mime,u="application/zip"===c.mime||"application/x-gzip"===c.mime;if(i[c.mime]&&(!o||c.size<=o)&&(d||p&&s||u&&r)){var h,f,m,g,v=function(){h=n.getContents(c.hash,"arraybuffer",{progressBar:g}).fail(function(){m.remove()}).done(function(e){var t=function(e){f&&f.terminate(),m.remove(),u?r=!1:p&&(s=!1),n.debug("error",e)};try{f=n.getWorker(),f.onmessage=function(e){f&&f.terminate(),m.remove(),!e.data||e.data.error?new Error(e.data&&e.data.error?e.data.error:""):b(e.data.files)},f.onerror=t,"application/x-tar"===c.mime?f.postMessage({scripts:[n.getWorkerUrl("quicklook.unzip.js")],data:{type:"tar",bin:e}}):"application/zip"===c.mime?f.postMessage({scripts:[n.options.cdns.zlibUnzip,n.getWorkerUrl("quicklook.unzip.js")],data:{type:"zip",bin:e}}):"application/x-gzip"===c.mime?f.postMessage({scripts:[n.options.cdns.zlibGunzip,n.getWorkerUrl("quicklook.unzip.js")],data:{type:"gzip",bin:e}}):"application/x-bzip2"===c.mime&&f.postMessage({scripts:[n.options.cdns.bzip2,n.getWorkerUrl("quicklook.unzip.js")],data:{type:"bzip2",bin:e}})}catch(i){t(i)}})},b=function(i){var o,r,s,l=0;i&&i.length&&(i=e.map(i,function(e){return n.decodeRawString(e)}),i.sort(),r=n.escape(i.join("\n").replace(/\{formatSize\((\d+)\)\}/g,function(e,t){return l+=parseInt(t),n.formatSize(t)})),o=""+n.escape(c.mime)+" ("+n.formatSize(c.size)+" / "+n.formatSize(l)+")
                ",s=e('
                '+o+'
                '+r+"
                ").on("touchstart",function(t){e(this)["scroll"+("ltr"===n.direction?"Right":"Left")]()>5&&(t.originalEvent._preventSwipeX=!0)}).appendTo(a),t.hideinfo()),m.remove()};l.stopImmediatePropagation(),m=e('
                '+n.i18n("nowLoading")+'
                ').appendTo(t.info.find(".elfinder-quicklook-info")),g=e('
                ').appendTo(m),a.one("change",function(){"pending"===h.state()&&h.reject(),f&&f.terminate(),m.remove()}),v()}})},function(t){var n,i=t.fm,a=i.arrayFlip(["application/x-rar"]),o=t.preview;window.DataView&&o.on(t.evUpdate,function(r){var s=r.file;if(a[s.mime]&&i.options.cdns.rar&&n!==!1){var l,c,d,p,u,h,f=function(a){if(p)return void l.remove();try{d=n({file:a,type:2,xhrHeaders:i.customHeaders,xhrFields:i.xhrFields},function(n){l.remove();var a,r,c=[];return p||n?void(n&&i.debug("error",n)):(e.each(d.entries,function(){c.push(this.path+(this.size?" ("+i.formatSize(this.size)+")":""))}),void(c.length&&(c=e.map(c,function(e){return i.decodeRawString(e)}),c.sort(),a=""+i.escape(s.mime)+" ("+i.formatSize(s.size)+")
                ",r=e('
                '+a+'
                '+i.escape(c.join("\n"))+"
                ").on("touchstart",function(t){e(this)["scroll"+("ltr"===i.direction?"Right":"Left")]()>5&&(t.originalEvent._preventSwipeX=!0)}).appendTo(o),t.hideinfo())))})}catch(r){l.remove()}},m=function(){n=!1,l.remove()};r.stopImmediatePropagation(),l=e('
                '+i.i18n("nowLoading")+'
                ').appendTo(t.info.find(".elfinder-quicklook-info")),c=e('
                ').appendTo(l),o.one("change",function(){d&&(d.abort=!0),l.remove(),p=!0}),h=i.openUrl(s.hash,"sameorigin",function(e){e&&(n?f(e):(window.RarArchive&&(u=window.RarArchive,delete window.RarArchive),i.loadScript([i.options.cdns.rar],function(){i.hasRequire?require(["rar"],function(t){n=t,f(e)},m):(n=window.RarArchive)?(u?window.RarArchive=u:delete window.RarArchive,f(e)):m()},{tryRequire:!0,error:m})))},{progressBar:c,temporary:!0}),o.one("change",function(){h&&h.state&&"pending"===h.state()&&h.reject()})}})},function(t){var n,i=t.fm,a=i.arrayFlip(t.options.sharecadMimes||[]),o=t.preview;t.window;t.options.sharecadMimes.length&&t.addIntegration({title:"ShareCAD.org CAD and 3D-Models viewer",link:"https://sharecad.org/DWGOnlinePlugin"}),o.on(t.evUpdate,function(r){var s=r.file;if(a[s.mime.toLowerCase()]&&i.option("onetimeUrl",s.hash)){var l,c,d;t.window;r.stopImmediatePropagation(),"1"==s.url&&(o.hide(),e('
                ").appendTo(t.info.find(".elfinder-quicklook-info")).on("click",function(){var n=e(this);n.html(''),i.request({data:{cmd:"url",target:s.hash},preventDefault:!0,progressBar:c}).always(function(){n.html("")}).done(function(e){var n=i.file(s.hash);s.url=n.url=e.url||"",s.url&&o.trigger({type:t.evUpdate,file:s,forceUpdate:!0})})})),""!==s.url&&"1"!=s.url&&(o.one("change",function(){l.remove(),n.off("load").remove(),n=null}).addClass("elfinder-overflow-auto"),l=e('
                '+i.i18n("nowLoading")+'
                ').appendTo(t.info.find(".elfinder-quicklook-info")),c=e('
                ').appendTo(l),d=i.convAbsUrl(i.url(s.hash)),n=e('').css("background-color","transparent").appendTo(o).on("load",function(){t.hideinfo(),l.remove(),t.preview.after(t.info),e(this).css("background-color","#fff").show()}).on("error",function(){l.remove(),t.preview.after(t.info)}).attr("src","//sharecad.org/cadframe/load?url="+encodeURIComponent(d)),t.info.after(t.preview))}})},function(t){var n,i,a,o,r,s=t.fm,l={"application/vnd.google-earth.kml+xml":!0,"application/vnd.google-earth.kmz":!0},c=t.preview;t.options.googleMapsApiKey&&(t.addIntegration({title:"Google Maps",link:"https://www.google.com/intl/"+s.lang.replace("_","-")+"/help/terms_maps.html"}),n=window.google&&google.maps,i=function(e,i,a){var r=t.options.googleMapsOpts.maps;s.forExternalUrl(e.hash,{progressBar:a}).done(function(e){if(e)try{new n.KmlLayer(e,Object.assign({map:new n.Map(i.get(0),r)},t.options.googleMapsOpts.kml)),t.hideinfo()}catch(a){o()}else o()})},a=window.gm_authFailure,o=function(){r=null},r="https://maps.googleapis.com/maps/api/js?key="+t.options.googleMapsApiKey,window.gm_authFailure=function(){o(),a&&a()},c.on(t.evUpdate,function(a){var o=a.file;if(r&&l[o.mime.toLowerCase()]){var d,p,u,h=(t.window,"1"==o.url&&!s.option("onetimeUrl",o.hash));a.stopImmediatePropagation(),d=e('
                '+s.i18n("nowLoading")+'
                ').appendTo(t.info.find(".elfinder-quicklook-info")),p=e('
                ').appendTo(d),h&&(c.hide(),e('
                ").appendTo(t.info.find(".elfinder-quicklook-info")).on("click",function(){var n=e(this);n.html(''),s.request({data:{cmd:"url",target:o.hash},preventDefault:!0,progressBar:p}).always(function(){d.remove(),n.html("")}).done(function(e){var n=s.file(o.hash);o.url=n.url=e.url||"",o.url&&c.trigger({type:t.evUpdate,file:o,forceUpdate:!0})})})),""===o.url||h||(u=e('
                ').appendTo(c),c.one("change",function(){u.remove(),u=null}),n?i(o,u,p):s.loadScript([r],function(){n=window.google&&google.maps,n&&i(o,u,p)}))}}))},function(t){var n,i,a=t.fm,o=Object.assign(a.arrayFlip(t.options.googleDocsMimes||[],"g"),a.arrayFlip(t.options.officeOnlineMimes||[],"m")),r=t.preview,s=(t.window,t.navbar),l={g:"docs.google.com/gview?embedded=true&url=",m:"view.officeapps.live.com/op/embed.aspx?wdStartOn=0&src="},c={g:"56px",m:"24px"},d={xls:5242880,xlsb:5242880,xlsx:5242880,xlsm:5242880,other:10485760};t.options.googleDocsMimes.length&&(i=!0,t.addIntegration({title:"Google Docs Viewer",link:"https://docs.google.com/"})),t.options.officeOnlineMimes.length&&(i=!0,t.addIntegration({title:"MS Online Doc Viewer",link:"https://products.office.com/office-online/view-office-documents-online"})),i&&r.on(t.evUpdate,function(i){var p,u,h=i.file;if(h.size<=26214400&&(p=o[h.mime])){var f,m,g,v=t.window,b=function(){s.css("bottom",v.hasClass("elfinder-quicklook-fullscreen")?c[p]:"")},y=a.mimeTypes[h.mime],w="1"==h.url&&!a.option("onetimeUrl",h.hash);"m"===p&&(d[y]&&h.size>d[y]||h.size>d.other)&&(p="g"),w&&(r.hide(),e('
                ").appendTo(t.info.find(".elfinder-quicklook-info")).on("click",function(){var n=e(this);n.html(''),a.request({data:{cmd:"url",target:h.hash},preventDefault:!0}).always(function(){n.html("")}).done(function(e){var n=a.file(h.hash);h.url=n.url=e.url||"",h.url&&r.trigger({type:t.evUpdate,file:h,forceUpdate:!0})})})),""===h.url||w||(i.stopImmediatePropagation(),r.one("change",function(){u&&u.status&&"pending"===u.status()&&u.reject(),v.off("viewchange.googledocs"),f.remove(),n.off("load").remove(),n=null}).addClass("elfinder-overflow-auto"),f=e('
                '+a.i18n("nowLoading")+'
                ').appendTo(t.info.find(".elfinder-quicklook-info")),m=e('
                ').appendTo(f),n=e('').css("background-color","transparent").appendTo(r),u=a.forExternalUrl(h.hash,{progressBar:m}).done(function(i){var a=function(){try{!n||n.attr("src")&&!n.get(0).contentWindow.document||(n.attr("src","https://"+l[p]+encodeURIComponent(i)),g=setTimeout(a,2e3))}catch(e){}};i?(h.ts&&(i+=(i.match(/\?/)?"&":"?")+"_t="+h.ts),n.on("load",function(){g&&clearTimeout(g),t.hideinfo(),f.remove(),t.preview.after(t.info),e(this).css("background-color","#fff").show()}).on("error",function(){g&&clearTimeout(g),f.remove(),t.preview.after(t.info)}),a()):(f.remove(),n.remove())}),v.on("viewchange.googledocs",b),b(),t.info.after(t.preview))}})},function(t){"use strict";var n,i,a=t.fm,o=t.preview,r=parseInt(t.options.textInitialLines)||150,s=parseInt(t.options.prettifyMaxLines)||500,l=function(){c=function(){return!1},i&&(window.PR=i),n=!1},c=function(e){a.options.cdns.prettify?(c=function(e){return setTimeout(function(){p(e)},100),"pending"},window.PR&&(i=window.PR),a.loadScript([a.options.cdns.prettify+(a.options.cdns.prettify.match(/\?/)?"&":"?")+"autorun=false"],function(t){n=t||window.PR,"object"==typeof n?(c=function(){return!0},i?window.PR=i:delete window.PR,d(e)):l()},{tryRequire:!0,error:l})):l()},d=function(e){e&&!e.hasClass("prettyprinted")&&(e.css("cursor","wait"),requestAnimationFrame(function(){n.prettyPrint&&n.prettyPrint(null,e.get(0)),e.css("cursor","")}))},p=function(e){var t=c(e);t===!0&&d(e)};o.on(t.evUpdate,function(i){var l,c,d,u,h=i.file;h.mime;a.mimeIsText(h.mime)&&(!t.options.getSizeMax||h.size<=t.options.getSizeMax)&&n!==!1&&(i.stopImmediatePropagation(),c=e('
                '+a.i18n("nowLoading")+'
                ').appendTo(t.info.find(".elfinder-quicklook-info")),d=e('
                ').appendTo(c),o.one("change",function(){"pending"==l.state()&&l.reject(),u&&u.remove()}),l=a.request({data:{cmd:"get",target:h.hash,conv:h.encoding||1,_t:h.ts},options:{type:"get",cache:!0},preventDefault:!0,progressBar:d}).done(function(n){var i,l,c,d,u,f=new RegExp("^(data:"+h.mime.replace(/([.+])/g,"\\$1")+";base64,)","i"),m=n.content;"string"==typeof m&&(t.hideinfo(),window.atob&&(u=m.match(f))&&(m=atob(m.substr(u[1].length))),d=m.match(/([^\r\n]{1,100}[\r\n]*)/g),l=d.length-r,l>10?i=d.splice(0,r).join(""):l=0,c=e('
                '),l&&c.append(e('

                '+a.i18n("linesLeft",a.toLocaleString(l))+"
                ").on("click",function(){var t=c.scrollTop();e(this).remove(),c.children("pre").removeClass("prettyprinted").text(m).scrollTop(t),d.length<=s&&p(c)})),c.children("pre").text(i||m),c.on("touchstart",function(t){e(this)["scroll"+("ltr"===a.direction?"Right":"Left")]()>5&&(t.originalEvent._preventSwipeX=!0)}).appendTo(o),n.toasts&&Array.isArray(n.toasts)&&e.each(n.toasts,function(){this.msg&&a.toast(this)}),p(c))}).always(function(n){var i,r,s;(i=a.getCommand("edit"))&&(s=[],n&&n.encoding&&s.push({value:n.encoding}),s.push({value:"UTF-8"}),r=i.getEncSelect(s),r.on("change",function(){h.encoding=r.val(),a.cache(h,"change"),o.trigger({type:t.evUpdate,file:h,forceUpdate:!0})}),u=e('
                ').append(r),t.window.append(u)),c.remove()}))})}],(i.prototype.commands.reload=function(){"use strict";var t=this,n=!1;this.alwaysEnabled=!0,this.updateOnSelect=!0,this.shortcuts=[{pattern:"ctrl+shift+r f5"}],this.getstate=function(){return 0},this.init=function(){this.fm.bind("search searchend",function(){n="search"==this.type})},this.fm.bind("contextmenu",function(){var n=t.fm;n.options.sync>=1e3&&(t.extra={icon:"accept",node:e("").attr({title:n.i18n("autoSync")}).on("click touchstart",function(t){"touchstart"===t.type&&t.originalEvent.touches.length>1||(t.stopPropagation(),t.preventDefault(),e(this).parent().toggleClass("ui-state-disabled",n.options.syncStart).parent().removeClass("ui-state-hover"),n.options.syncStart=!n.options.syncStart,n.autoSync(n.options.syncStart?null:"stop"))}).on("ready",function(){e(this).parent().toggleClass("ui-state-disabled",!n.options.syncStart).css("pointer-events","auto")})})}),this.exec=function(){var t=this.fm;if(!n){var i=t.sync(),a=setTimeout(function(){t.notify({type:"reload",cnt:1,hideCnt:!0}),i.always(function(){t.notify({type:"reload",cnt:-1})})},t.notifyDelay);return i.always(function(){clearTimeout(a),t.trigger("reload")})}e("div.elfinder-toolbar > div."+t.res("class","searchbtn")+" > span.ui-icon-search").click()}}).prototype={forceLoad:!0},i.prototype.commands.rename=function(){"use strict";this.alwaysEnabled=!0,this.syncTitleOnChange=!0;var t=this,n=t.fm,i=function(t,i,a,o){var r,s=i?[a.hash].concat(i):[a.hash],l=s.length,c={};if(n.lockfiles({files:s}),n.isRoot(a)&&!a.netkey){if((r=n.storage("rootNames"))||(r={}),""===o){if(!r[a.hash])return t&&t.reject(),void n.unlockfiles({files:s}).trigger("selectfiles",{files:s});a.name=a._name,a.i18=a._i18,delete r[a.hash],delete a._name,delete a._i18}else"undefined"==typeof a._name&&(a._name=a.name,a._i18=a.i18),a.name=r[a.hash]=o,delete a.i18;return n.storage("rootNames",r),c={changed:[a]},n.updateCache(c),n.change(c),t&&t.resolve(c),void n.unlockfiles({files:s}).trigger("selectfiles",{files:s})}c={cmd:"rename",name:o,target:a.hash},l>1&&(c.targets=i,o.match(/\*/)&&(c.q=o)),n.request({data:c,notify:{type:"rename",cnt:l},navigate:{}}).fail(function(e){var i=n.parseError(e);t&&t.reject(),i&&Array.isArray(i)&&"errRename"===i[0]||n.sync()}).done(function(i){var r;i.added&&i.added.length&&1===l&&(i.undo={cmd:"rename",callback:function(){return n.request({data:{cmd:"rename",target:i.added[0].hash,name:a.name},notify:{type:"undo",cnt:1}})}},i.redo={cmd:"rename",callback:function(){return n.request({data:{cmd:"rename",target:a.hash,name:o},notify:{type:"rename",cnt:1}})}}),t&&t.resolve(i), +(r=n.cwd().hash)&&r!==a.hash||n.exec("open",e.map(i.added,function(e){return"directory"===e.mime?e.hash:null})[0])}).always(function(){n.unlockfiles({files:s}).trigger("selectfiles",{files:s})})},a=function(e,t){var i,a,o,r=t||n.selected(),s=n.splitFileExtention(e),l=n.file(r[0]),c=n.file(r[1]);return i=s[1]?"."+s[1]:"",s[1]&&"*"===s[0]?(a='"'+n.splitFileExtention(l.name)[0]+i+'", ',a+='"'+n.splitFileExtention(c.name)[0]+i+'"'):s[0].length>1&&("*"===s[0].substr(-1)?(o=s[0].substr(0,s[0].length-1),a='"'+o+l.name+'", ',a+='"'+o+c.name+'"'):"*"===s[0].substr(0,1)&&(o=s[0].substr(1),a='"'+n.splitFileExtention(l.name)[0]+o+i+'", ',a+='"'+n.splitFileExtention(c.name)[0]+o+i+'"')),a||(a='"'+s[0]+"1"+i+'", "'+s[0]+"2"+i+'"'),r.length>2&&(a+=" ..."),a},o=function(){var o,r=n.selected(),s='',l=function(t,i){return e('").prepend(t)},c=e(''),d=e(s),p=e(s),u=e(s),h=e(s),f=e("
                ").append(l(d,"plusNumber"),l(p,"asPrefix"),l(u,"asSuffix"),l(h,"changeExtention")),m=e('
                '),g=e('
                ').append(e('
                ').append(c),e('
                ').append(f),m),v={title:n.i18n("batchRename"),modal:!0,destroyOnClose:!0,width:Math.min(380,n.getUI().width()-20),buttons:{},open:function(){c.on("input",y).trigger("focus")}},b=function(){var e=c.val(),t=n.splitFileExtention(n.file(r[0]).name)[1];return(""!==e||d.is(":checked"))&&(p.is(":checked")?e+="*":u.is(":checked")?e="*"+e+"."+t:h.is(":checked")?e="*."+e:t&&(e+="."+t)),e},y=function(){var e=b();""!==e?m.html(n.i18n(["renameMultiple",r.length,a(e)])):m.empty()},w=f.find("input:radio").on("change",y);v.buttons[n.i18n("btnApply")]=function(){var e,t,a=b();""!==a&&(o.elfinderdialog("close"),t=r,e=n.file(t.shift()),i(void 0,t,e,a))},v.buttons[n.i18n("btnCancel")]=function(){o.elfinderdialog("close")},e.fn.checkboxradio?w.checkboxradio({create:function(e,t){this===d.get(0)&&d.prop("checked",!0).change()}}):f.buttonset({create:function(e,t){d.prop("checked",!0).change()}}),o=t.fmDialog(g,v)};this.noChangeDirOnRemovedCwd=!0,this.shortcuts=[{pattern:"f2"+("mac"==n.OS?" enter":"")},{pattern:"shift+f2",description:"batchRename",callback:function(){n.selected().length>1&&o()}}],this.getstate=function(i){var a,r,s,l,c,d,p=this.files(i),u=p.length;return u?(u>1&&p[0].phash&&(a=p[0].phash,r=n.splitFileExtention(p[0].name)[1].toLowerCase(),s=p[0].mime),1===u&&(d=n.isRoot(p[0])),c=1===u&&(n.cookieEnabled&&d||!p[0].locked)||n.api>2.103&&u===e.grep(p,function(e){return!(l||e.locked||e.phash!==a||n.isRoot(e)||s!==e.mime&&r!==n.splitFileExtention(e.name)[1].toLowerCase())||(l&&(l=!0),!1)}).length?0:-1,!d&&0===c&&n.option("disabledFlip",p[0].hash).rename&&(c=-1),c!==-1&&u>1?t.extra={icon:"preference",node:e("").attr({title:n.i18n("batchRename")}).on("click touchstart",function(e){"touchstart"===e.type&&e.originalEvent.touches.length>1||(e.stopPropagation(),e.preventDefault(),n.getUI().trigger("click"),o())})}:delete t.extra,c):-1},this.exec=function(t,o){var r,s=(n.getUI("cwd"),t||!!n.selected().length&&n.selected()||[n.cwd().hash]),l=s.length,c=n.file(s.shift()),d=".elfinder-cwd-filename",p=o||{},u=n.cwd().hash==c.hash,h="navbar"===p._currentType||"files"===p._currentType?p._currentType:u?"navbar":"files",f="files"!==h,m=n[f?"navHash2Elm":"cwdHash2Elm"](c.hash),g=!f&&"list"!=n.storage("view"),v=function(){requestAnimationFrame(function(){x&&x.trigger("blur")})},b=function(){T.is(":hidden")||T.elfinderoverlay("hide").off("click close",A),z.removeClass("ui-front").css("position","").off("unselect."+n.namespace,v),g?C&&C.css("max-height",""):f||z.css("width","").parent("td").css("overflow","")},y=e.Deferred().fail(function(e){var t=x.parent(),i=n.escape(c.i18||c.name);x.off(),g&&(i=i.replace(/([_.])/g,"​$1")),requestAnimationFrame(function(){f?x.replaceWith(i):t.length?(x.remove(),t.html(i)):m.find(d).html(i)}),e&&n.error(e)}).always(function(){b(),n.unbind("resize",j),n.enable()}),w=function(t){var o=e.trim(x.val()),r=(n.splitFileExtention(o),!0),d=function(){x.off(),b(),f?x.replaceWith(n.escape(o)):C.html(n.escape(o)),i(y,s,c,o)};if(T.is(":hidden")||z.css("z-index",""),""===o){if(!n.isRoot(c))return A();f?x.replaceWith(n.escape(c.name)):C.html(n.escape(c.name))}if(!S&&z.length){if(x.off("blur"),1===l&&o===c.name)return y.reject();if(n.options.validName&&n.options.validName.test)try{r=n.options.validName.test(o)}catch(t){r=!1}if("."===o||".."===o||!r)return S=!0,n.error("directory"===c.mime?"errInvDirname":"errInvName",{modal:!0,close:function(){setTimeout(k,120)}}),!1;if(1===l&&n.fileByName(o,c.phash))return S=!0,n.error(["errExists",o],{modal:!0,close:function(){setTimeout(k,120)}}),!1;1===l?d():(n.confirm({title:"cmdrename",text:["renameMultiple",l,a(o,[c.hash].concat(s))],accept:{label:"btnYes",callback:d},cancel:{label:"btnCancel",callback:function(){setTimeout(function(){S=!0,k()},120)}}}),setTimeout(function(){n.trigger("unselectfiles",{files:n.selected()}).trigger("selectfiles",{files:[c.hash].concat(s)})},120))}},x=e(g?"":'').on("keyup text",function(){g?(this.style.height="1px",this.style.height=this.scrollHeight+"px"):r&&(this.style.width=r+"px",this.scrollWidth>r&&(this.style.width=this.scrollWidth+10+"px"))}).on("keydown",function(t){t.stopImmediatePropagation(),t.keyCode==e.ui.keyCode.ESCAPE?y.reject():t.keyCode==e.ui.keyCode.ENTER&&(t.preventDefault(),x.trigger("blur"))}).on("mousedown click dblclick",function(e){e.stopPropagation(),"dblclick"===e.type&&e.preventDefault()}).on("blur",w).on("dragenter dragleave dragover drop",function(e){e.stopPropagation()}),k=function(){var e=n.splitFileExtention(x.val())[0];S||!n.UA.Mobile||n.UA.iOS||(T.on("click close",A).elfinderoverlay("show"),z.css("z-index",T.css("z-index")+1)),!n.enabled()&&n.enable(),S&&(S=!1,x.on("blur",w)),x.trigger("focus").trigger("select"),x[0].setSelectionRange&&x[0].setSelectionRange(0,e.length)},C=f?m.contents().filter(function(){return 3==this.nodeType&&e(this).parent().attr("id")===n.navHash2Id(c.hash)}):m.find(d),z=C.parent(),T=n.getUI("overlay"),A=function(e){T.is(":hidden")||z.css("z-index",""),S||(y.reject(),e&&(e.stopPropagation(),e.preventDefault()))},j=function(){m.trigger("scrolltoview",{blink:!1})},S=!1;return z.addClass("ui-front").css("position","relative").on("unselect."+n.namespace,v),n.bind("resize",j),f?C.replaceWith(x.val(c.name)):(g?C.css("max-height","none"):f||(r=z.width(),z.width(r-15).parent("td").css("overflow","visible")),C.empty().append(x.val(c.name))),l>1&&n.api<=2.103?y.reject():c&&C.length?c.locked&&!n.isRoot(c)?y.reject(["errLocked",c.name]):(n.one("select",function(){x.parent().length&&c&&e.inArray(c.hash,n.selected())===-1&&x.trigger("blur")}),x.trigger("keyup"),k(),y):y.reject("errCmdParams",this.title)},n.bind("select contextmenucreate closecontextmenu",function(e){var i,a=(e.data?e.data.selected||e.data.targets:null)||n.selected();a&&1===a.length&&(i=n.file(a[0]))&&n.isRoot(i)?t.title=n.i18n("kindAlias")+" ("+n.i18n("preference")+")":t.title=n.i18n("cmdrename"),"closecontextmenu"!==e.type?t.update(void 0,t.title):requestAnimationFrame(function(){t.update(void 0,t.title)})}).remove(function(t){var i;t.data&&t.data.removed&&(i=n.storage("rootNames"))&&(e.each(t.data.removed,function(e,t){i[t]&&delete i[t]}),n.storage("rootNames",i))})},i.prototype.commands.resize=function(){"use strict";var t=this.fm,n=0,i=function(t,n,i){var a=[{x:t/2,y:n/2},{x:-t/2,y:n/2},{x:-t/2,y:-n/2},{x:t/2,y:-n/2}],o=[],r={x:Number.MAX_VALUE,y:Number.MAX_VALUE},s={x:Number.MIN_VALUE,y:Number.MIN_VALUE};return e.each(a,function(e,t){o.push({x:t.x*Math.cos(i)-t.y*Math.sin(i),y:t.x*Math.sin(i)+t.y*Math.cos(i)})}),e.each(o,function(e,t){r.x=Math.min(r.x,t.x),r.y=Math.min(r.y,t.y),s.x=Math.max(s.x,t.x),s.y=Math.max(s.y,t.y)}),{width:s.x-r.x,height:s.y-r.y}};this.updateOnSelect=!1,this.getstate=function(){var e=t.selectedFiles();return 1==e.length&&e[0].read&&e[0].write&&e[0].mime.indexOf("image/")!==-1?0:-1},this.resizeRequest=function(n,i,a){var o=i||t.file(n.target),r=(o?o.tmb:null,t.isCommandEnabled("resize",n.target));if(r&&(!o||o&&o.read&&o.write&&o.mime.indexOf("image/")!==-1))return t.request({data:Object.assign(n,{cmd:"resize"}),notify:{type:"resize",cnt:1}}).fail(function(e){a&&a.reject(e)}).done(function(){n.quality&&t.storage("jpgQuality",n.quality===t.option("jpgQuality")?null:n.quality),a&&a.resolve()});var s;return s=o?o.mime.indexOf("image/")===-1?["errResize",o.name,"errUsupportType"]:["errResize",o.name,"errPerm"]:["errResize",n.target,"errPerm"],a?a.reject(s):t.error(s),e.Deferred().reject(s)},this.exec=function(a){var o,r,s,l,c=this,d=this.files(a),p=e.Deferred(),u=t.api>1,h=this.options,f=650,m=t.getUI(),g=e().controlgroup?"controlgroup":"buttonset",v="undefined"==typeof h.grid8px||"disable"!==h.grid8px,b=Array.isArray(h.presetSize)?h.presetSize:[],y="elfinder-dialog-active",w=t.res("class","editing"),x=function(a,o,r){var d,x,k,C,z,T="image/jpeg"===a.mime,A=e('
                '),j='',S='
                ',O='
                ',I=null,M=!1,E=function(){M=!0},F=function(){M&&(M=!1,D.trigger("change"))},D=e('
                ').on("focus","input[type=text],input[type=number]",function(){e(this).trigger("select")}).on("change",function(){I&&cancelAnimationFrame(I),I=requestAnimationFrame(function(){var e,n,a,o,r,s,c,d,p,u,h,f;at&&!M&&(a=at.data("canvas"))&&(e=D.children("div.elfinder-resize-control-panel:visible"),n=e.find("input.elfinder-resize-quality"),n.is(":visible")&&(o=at.data("ctx"),r=at.get(0),e.hasClass("elfinder-resize-uiresize")?(d=a.width=X.val(),p=a.height=J.val(),o.drawImage(r,0,0,d,p)):e.hasClass("elfinder-resize-uicrop")?(s=G.val(),c=Y.val(),d=Q.val(),p=Z.val(),a.width=d,a.height=p,o.drawImage(r,s,c,d,p,0,0,d,p)):(u=te.val(),h=te.val()*Math.PI/180,f=i(fe,me,h),d=a.width=f.width,p=a.height=f.height,o.save(),u%90!==0&&(o.fillStyle=de.val()||"#FFF",o.fillRect(0,0,d,p)),o.translate(d/2,p/2),o.rotate(h),o.drawImage(r,-r.width/2,-r.height/2,fe,me),o.restore()),a.toBlob(function(e){e&&(l=e.size,n.next("span").text(" ("+t.formatSize(e.size)+")"))},"image/jpeg",Math.max(Math.min(n.val(),100),1)/100)))})}).on("mouseup","input",function(t){e(t.target).trigger("change")}),U=e('
                ').on("touchmove",function(t){e(t.target).hasClass("touch-punch")&&(t.stopPropagation(),t.preventDefault())}),P=e('
                '+t.i18n("ntfloadimg")+"
                "),q=e('
                '),R=e('
                '),H=e('
                '),_=e('
                '),N=e('
                '),L=e("").attr("title",t.i18n("rotate-cw")).append(e('')),W=e("").attr("title",t.i18n("rotate-ccw")).append(e('')),B=e(""),$=e('").on("mouseenter mouseleave",function(t){e(this).toggleClass("ui-state-hover","mouseenter"==t.type)}).on("click",function(){d.exec("open",f).done(function(){d.one("opendone",function(){d.trigger("selectfiles",{files:e.map(t.added,function(e){return e.hash})})})})})):d.trigger("selectfiles",{files:e.map(t.added,function(e){return e.hash})}),d.toast({msg:d.i18n(["complete",d.i18n("cmdupload")]),extNode:n}))}}).progress(function(){w.notifyWith(this,Array.from(arguments))})},v=function(e){i.elfinderdialog("close"),h&&(e.target=h[0]),g(e)},b=function(){var t=m.hash,n=e.map(d.files(t),function(e){return"directory"===e.mime&&e.write?e:null});return n.length?e('
                ').on("click",function(t){t.stopPropagation(),t.preventDefault(),n=d.sortFiles(n);var a=e(this),o=(d.cwd(),i.closest("div.ui-dialog")),r=function(e,t){return{label:d.escape(e.i18||e.name),icon:t,remain:!1,callback:function(){var t=o.children(".ui-dialog-titlebar:first").find("span.elfinder-upload-target");h=[e.hash],t.html(" - "+d.escape(e.i18||e.name)),a.trigger("focus")},options:{className:h&&h.length&&e.hash===h[0]?"ui-state-active":"",iconClass:e.csscls||"",iconImg:e.icon||""}}},s=[r(m,"opendir"),"|"];e.each(n,function(e,t){s.push(r(t,"dir"))}),a.trigger("blur"),d.trigger("contextmenu",{raw:s,x:t.pageX||e(this).offset().left,y:t.pageY||e(this).offset().top,prevNode:o,fitHeight:!0})}).append(''):e()},y=function(n,i){var a=e('").on("click",function(){d.UA.IE&&setTimeout(function(){o.css("display","none").css("position","relative"),requestAnimationFrame(function(){o.css("display","").css("position","")})},100)}).on("change",function(){v({input:a.get(0),type:"files"})}).on("dragover",function(e){e.originalEvent.dataTransfer.dropEffect="copy"}),o=e("
                ").append(a).on("click",function(e){e.stopPropagation()});return e('
                '+d.i18n(i)+"
                ").append(o).on("click",function(e){e.stopPropagation(),e.preventDefault(),a.trigger("click")}).on("mouseenter mouseleave",function(n){e(this).toggleClass(t,"mouseenter"===n.type)})},w=e.Deferred();return r=function(t){t.stopPropagation(),t.preventDefault();var n,i=!1,a="",o=null,r="",s=null,l=t._target||null,c=t.dataTransfer||null,p="";if(c){c.types&&c.types.length&&e.inArray("Files",c.types)!==-1?p="file":c.items&&c.items.length&&c.items[0].kind&&(p=c.items[0].kind);try{if(o=c.getData("elfinderfrom"),o&&(r=window.location.href+d.cwd().hash,!l&&o===r||l===r))return void w.reject()}catch(t){}if("file"===p&&(c.items[0].getAsEntry||c.items[0].webkitGetAsEntry))i=c,a="data";else if("string"!==p&&c.files&&c.files.length&&e.inArray("Text",c.types)===-1)i=c.files,a="files";else{try{(s=c.getData("text/html"))&&s.match(/<(?:img|a)/i)&&(i=[s],a="html")}catch(t){}i||((s=c.getData("text"))?(i=[s],a="text"):c&&c.files&&(p="file"))}}i?g({files:i,type:a,target:l,dropEvt:t}):(n=["errUploadNoFiles"],"file"===p&&n.push("errFolderUpload"),d.error(n),w.reject())},!h&&n?(n.input||n.files?(n.type="files",g(n)):n.dropEvt&&r(n.dropEvt),w):(s=function(t){var n,i=t.originalEvent||t,a=[],o=[];if(i.clipboardData){if(i.clipboardData.items&&i.clipboardData.items.length){o=i.clipboardData.items;for(var r=0;r
                ').append(y("multiple","selectForUpload")),!d.UA.Mobile&&function(e){return"undefined"!=typeof e.webkitdirectory||"undefined"!=typeof e.directory}(document.createElement("input"))&&i.append(y("multiple webkitdirectory directory","selectFolder")),m.dirs&&(m.hash===p||d.navHash2Elm(m.hash).hasClass("elfinder-subtree-loaded")?b().appendTo(i):(l=e('
                ').append('').appendTo(i),d.request({cmd:"tree",target:m.hash}).done(function(){d.one("treedone",function(){l.replaceWith(b()),c.elfinderdialog("tabstopsInit")})}).fail(function(){l.remove()}))),d.dragUpload?a=e('
                ').on("paste",function(e){s(e)}).on("mousedown click",function(){e(this).trigger("focus")}).on("focus",function(){this.innerHTML=""}).on("mouseover",function(){e(this).addClass(t)}).on("mouseout",function(){e(this).removeClass(t)}).on("dragenter",function(n){n.stopPropagation(),n.preventDefault(),e(this).addClass(t)}).on("dragleave",function(n){n.stopPropagation(),n.preventDefault(),e(this).removeClass(t)}).on("dragover",function(n){n.stopPropagation(),n.preventDefault(),n.originalEvent.dataTransfer.dropEffect="copy",e(this).addClass(t)}).on("drop",function(e){i.elfinderdialog("close"),h&&(e.originalEvent._target=h[0]),r(e.originalEvent)}).prependTo(i).after('
                '+d.i18n("or")+"
                ")[0]:o=e('
                '+d.i18n("dropFilesBrowser")+"
                ").on("paste drop",function(e){s(e)}).on("mousedown click",function(){e(this).trigger("focus")}).on("focus",function(){this.innerHTML=""}).on("dragenter mouseover",function(){e(this).addClass(t)}).on("dragleave mouseout",function(){e(this).removeClass(t)}).prependTo(i).after('
                '+d.i18n("or")+"
                ")[0],c=this.fmDialog(i,{title:this.title+''+(m?" - "+d.escape(m.i18||m.name):"")+"",modal:!0,resizable:!1,destroyOnClose:!0,propagationEvents:["mousemove","mouseup","click"],close:function(){var e=d.getUI("contextmenu");e.is(":visible")&&e.click()}}),w)}},i.prototype.commands.view=function(){"use strict";var t,n=this,i=this.fm;this.value=i.viewType,this.alwaysEnabled=!0,this.updateOnSelect=!1,this.options={ui:"viewbutton"},this.getstate=function(){return 0},this.extra={icon:"menu",node:e("").attr({title:i.i18n("viewtype")}).on("click touchstart",function(t){if(!("touchstart"===t.type&&t.originalEvent.touches.length>1)){var n=e(this);t.stopPropagation(),t.preventDefault(),i.trigger("contextmenu",{raw:getSubMenuRaw(),x:n.offset().left,y:n.offset().top})}})},this.exec=function(){var e=this,t="list"==this.value?"icons":"list";return i.storage("view",t),i.lazy(function(){i.viewchange(),e.update(void 0,t),this.resolve()})},i.bind("init",function(){t=function(){var e,t=i.getUI("cwd"),a=[],o=i.options.uiOptions.cwd.iconsView.sizeNames,r=i.options.uiOptions.cwd.iconsView.sizeMax;for(e=0;e<=r;e++)a.push({label:i.i18n(o[e]||"Size-"+e+" icons"),icon:"view",callback:function(e){return function(){t.trigger("iconpref",{size:e}),i.storage("iconsize",e),"list"===n.value&&n.exec()}}(e)});return a.push("|"),a.push({label:i.i18n("viewlist"),icon:"view-list",callback:function(){"list"!==n.value&&n.exec()}}),a}()}).bind("contextmenucreate",function(){n.extra={icon:"menu",node:e("").attr({title:i.i18n("cmdview")}).on("click touchstart",function(a){if(!("touchstart"===a.type&&a.originalEvent.touches.length>1)){var o,r,s=e(this);t.concat();for(o="list"===n.value?t.length-1:parseInt(i.storage("iconsize")||0),r=0;r \ No newline at end of file + + + + + + + Layer 1 + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + \ No newline at end of file diff --git a/include/thirdparty/encoding.js/encoding.min.js b/include/thirdparty/encoding.js/encoding.min.js index 0819566..70458ad 100644 --- a/include/thirdparty/encoding.js/encoding.min.js +++ b/include/thirdparty/encoding.js/encoding.min.js @@ -1,34 +1,8 @@ /*! - * encoding-japanese v1.0.26 - Converts character encoding. - * Copyright (c) 2013-2017 polygon planet + * encoding-japanese v1.0.30 - Convert or detect character encoding in JavaScript + * Copyright (c) 2013-2018 polygon planet * https://github.com/polygonplanet/encoding.js * @license MIT */ -!function(a,b,c){"undefined"!=typeof exports?"undefined"!=typeof module&&module.exports?module.exports=c():exports.Encoding=c():"function"==typeof define&&define.amd?define(c):b.Encoding=c()}(0,this,function(){"use strict";function a(a){for(var b,c=0,d=a&&a.length;c255)return!1;if(b>=0&&b<=7||255===b)return!0}return!1}function b(a){for(var b,c=0,d=a&&a.length;c255||b>=128&&b<=255||27===b)return!1;return!0}function c(a){for(var b,c,d,e=0,f=a&&a.length;e255||b>=128&&b<=255)return!1;if(27===b){if(e+2>=f)return!1;if(c=a[e+1],d=a[e+2],36===c){if(40===d||64===d||66===d)return!0}else{if(38===c&&64===d)return!0;if(40===c&&(66===d||73===d||74===d))return!0}}}return!1}function d(a){for(var b,c=0,d=a&&a.length;c255||b<142)return!1;if(142===b){if(c+1>=d)return!1;if((b=a[++c])<161||223=d)return!1;if((b=a[++c])<162||237=d)return!1;if((b=a[++c])<161||254128;)if(a[c++]>255)return!1;for(;c239||c+1>=d)return!1;if((b=a[++c])<64||127===b||b>252)return!1}return!0}function f(a){for(var b,c=0,d=a&&a.length;c255)return!1;if(!(9===b||10===b||13===b||b>=32&&b<=126))if(b>=194&&b<=223){if(c+1>=d||a[c+1]<128||a[c+1]>191)return!1;c++}else if(224===b){if(c+2>=d||a[c+1]<160||a[c+1]>191||a[c+2]<128||a[c+2]>191)return!1;c+=2}else if(b>=225&&b<=236||238===b||239===b){if(c+2>=d||a[c+1]<128||a[c+1]>191||a[c+2]<128||a[c+2]>191)return!1;c+=2}else if(237===b){if(c+2>=d||a[c+1]<128||a[c+1]>159||a[c+2]<128||a[c+2]>191)return!1;c+=2}else if(240===b){if(c+3>=d||a[c+1]<144||a[c+1]>191||a[c+2]<128||a[c+2]>191||a[c+3]<128||a[c+3]>191)return!1;c+=3}else if(b>=241&&b<=243){if(c+3>=d||a[c+1]<128||a[c+1]>191||a[c+2]<128||a[c+2]>191||a[c+3]<128||a[c+3]>191)return!1;c+=3}else{if(244!==b)return!1;if(c+3>=d||a[c+1]<128||a[c+1]>143||a[c+2]<128||a[c+2]>191||a[c+3]<128||a[c+3]>191)return!1;c+=3}}return!0}function g(a){var b,c,d,e,f=0,g=a&&a.length,h=null;if(g<2){if(a[0]>255)return!1}else{if(b=a[0],c=a[1],255===b&&254===c)return!0;if(254===b&&255===c)return!0;for(;f255)return!1}if(null===h)return!1;if(void 0!==(d=a[h+1])&&d>0&&d<128)return!0;if(void 0!==(e=a[h-1])&&e>0&&e<128)return!0}return!1}function h(a){var b,c,d=0,e=a&&a.length,f=null;if(e<2){if(a[0]>255)return!1}else{if(b=a[0],c=a[1],254===b&&255===c)return!0;for(;d255)return!1}if(null===f)return!1;if(f%2==0)return!0}return!1}function i(a){var b,c,d=0,e=a&&a.length,f=null;if(e<2){if(a[0]>255)return!1}else{if(b=a[0],c=a[1],255===b&&254===c)return!0;for(;d255)return!1}if(null===f)return!1;if(f%2!=0)return!0}return!1}function j(a){var b,c,d,e,f,g,h=0,i=a&&a.length,j=null;if(i<4){for(;h255)return!1}else{if(b=a[0],c=a[1],d=a[2],e=a[3],0===b&&0===c&&254===d&&255===e)return!0;if(255===b&&254===c&&0===d&&0===e)return!0;for(;h255)return!1}if(null===j)return!1;if(void 0!==(f=a[j+3])&&f>0&&f<=127)return 0===a[j+2]&&0===a[j+1];if(void 0!==(g=a[j-1])&&g>0&&g<=127)return 0===a[j+1]&&0===a[j+2]}return!1}function k(a){for(var b,c=0,d=a&&a.length;c1114111)return!1;return!0}function l(a){for(var b,c,d=[],e=0,f=0,g=a&&a.length;f>=1,b<47?b+=113:b-=79,c+=c>95?32:31):(b>>=1,b<=47?b+=112:b-=80,c+=126),d[d.length]=255&b,d[d.length]=255&c):d[d.length]=2===e?a[f]+128&255:3===e?Da:255&a[f]}return d}function m(a){for(var b=[],c=0,d=a&&a.length,e=0;e=161&&b<=223?(2!==e&&(e=2,d[d.length]=h[6],d[d.length]=h[7],d[d.length]=h[8]),d[d.length]=b-128&255):b>=128?(1!==e&&(e=1,d[d.length]=h[3],d[d.length]=h[4],d[d.length]=h[5]),b<<=1,c=a[++g],c<159?(b-=b<319?225:97,c-=c>126?32:31):(b-=b<319?224:96,c-=126),d[d.length]=255&b,d[d.length]=255&c):(0!==e&&(e=0,d[d.length]=h[0],d[d.length]=h[1],d[d.length]=h[2]),d[d.length]=255&b);return 0!==e&&(d[d.length]=h[0],d[d.length]=h[1],d[d.length]=h[2]),d}function o(a){for(var b,c,d=[],e=a&&a.length,f=0;f=161&&b<=223?(d[d.length]=142,d[d.length]=b):b>=129?(c=a[++f],b<<=1,c<159?(b-=b<319?97:225,c+=c>126?96:97):(b-=b<319?96:224,c+=2),d[d.length]=255&b,d[d.length]=255&c):d[d.length]=255&b;return d}function p(a){for(var b,c=[],d=0,e=a&&a.length,f=0,g=[27,40,66,27,36,66,27,40,73,27,36,40,68];f142?(1!==d&&(d=1,c[c.length]=g[3],c[c.length]=g[4],c[c.length]=g[5]),c[c.length]=b-128&255,c[c.length]=a[++f]-128&255):(0!==d&&(d=0,c[c.length]=g[0],c[c.length]=g[1],c[c.length]=g[2]),c[c.length]=255&b);return 0!==d&&(c[c.length]=g[0],c[c.length]=g[1],c[c.length]=g[2]),c}function q(a){for(var b,c,d=[],e=a&&a.length,f=0;f142?(c=a[++f],1&b?(b>>=1,b+=b<111?49:113,c-=c>223?96:97):(b>>=1,b+=b<=111?48:112,c-=2),d[d.length]=255&b,d[d.length]=255&c):d[d.length]=142===b?255&a[++f]:255&b;return d}function r(a){Ca();for(var b,c,d,e,f,g,h,i=[],j=0,k=a&&a.length;j=161&&b<=223?(d=b-64,e=188|d>>6&3,f=128|63&d,i[i.length]=239,i[i.length]=255&e,i[i.length]=255&f):b>=128?(c=b<<1,d=a[++j],d<159?(c-=c<319?225:97,d-=d>126?32:31):(c-=c<319?224:96,d-=126),c&=255,g=(c<<8)+d,h=Ya[g],void 0===h?i[i.length]=Da:h<65535?(i[i.length]=h>>8&255,i[i.length]=255&h):(i[i.length]=h>>16&255,i[i.length]=h>>8&255,i[i.length]=255&h)):i[i.length]=255&a[j];return i}function s(a){Ca();for(var b,c,d,e,f,g,h,i,j=[],k=0,l=a&&a.length;k>6&3,e=128|63&c,j[j.length]=239,j[j.length]=255&d,j[j.length]=255&e):143===b?(f=a[++k]-128,g=a[++k]-128,h=(f<<8)+g,i=Za[h],void 0===i?j[j.length]=Da:i<65535?(j[j.length]=i>>8&255,j[j.length]=255&i):(j[j.length]=i>>16&255,j[j.length]=i>>8&255,j[j.length]=255&i)):b>=128?(h=(b-128<<8)+(a[++k]-128),i=Ya[h],void 0===i?j[j.length]=Da:i<65535?(j[j.length]=i>>8&255,j[j.length]=255&i):(j[j.length]=i>>16&255,j[j.length]=i>>8&255,j[j.length]=255&i)):j[j.length]=255&a[k];return j}function t(a){Ca();for(var b,c,d,e,f,g=[],h=0,i=0,j=a&&a.length;i>8&255,g[g.length]=255&f):(g[g.length]=f>>16&255,g[g.length]=f>>8&255,g[g.length]=255&f)):2===h?(b=a[i]+64,c=188|b>>6&3,d=128|63&b,g[g.length]=239,g[g.length]=255&c,g[g.length]=255&d):3===h?(e=(a[i]<<8)+a[++i],f=Za[e],void 0===f?g[g.length]=Da:f<65535?(g[g.length]=f>>8&255,g[g.length]=255&f):(g[g.length]=f>>16&255,g[g.length]=f>>8&255,g[g.length]=255&f)):g[g.length]=255&a[i]}return g}function u(a){for(var b,c,d,e,f,g=[],h=0,i=a&&a.length;h=128?(e=b<=223?(b<<8)+a[++h]:(b<<16)+(a[++h]<<8)+(255&a[++h]), -f=Wa[e],void 0===f?g[g.length]=Da:f<255?g[g.length]=f+128:(f>65536&&(f-=65536),c=f>>8,d=255&f,1&c?(c>>=1,c<47?c+=113:c-=79,d+=d>95?32:31):(c>>=1,c<=47?c+=112:c-=80,d+=126),g[g.length]=255&c,g[g.length]=255&d)):g[g.length]=255&a[h];return g}function v(a){for(var b,c,d,e=[],f=0,g=a&&a.length;f=128?(c=b<=223?(a[f++]<<8)+a[f]:(a[f++]<<16)+(a[f++]<<8)+(255&a[f]),d=Wa[c],void 0===d?(d=Xa[c],void 0===d?e[e.length]=Da:(e[e.length]=143,e[e.length]=(d>>8)-128&255,e[e.length]=(255&d)-128&255)):(d>65536&&(d-=65536),d<255?(e[e.length]=142,e[e.length]=d-128&255):(e[e.length]=(d>>8)-128&255,e[e.length]=(255&d)-128&255))):e[e.length]=255&a[f];return e}function w(a){for(var b,c,d,e=[],f=0,g=a&&a.length,h=0,i=[27,40,66,27,36,66,27,40,73,27,36,40,68];h>8&255,e[e.length]=255&d)):(d>65536&&(d-=65536),d<255?(2!==f&&(f=2,e[e.length]=i[6],e[e.length]=i[7],e[e.length]=i[8]),e[e.length]=255&d):(1!==f&&(f=1,e[e.length]=i[3],e[e.length]=i[4],e[e.length]=i[5]),e[e.length]=d>>8&255,e[e.length]=255&d)));return 0!==f&&(e[e.length]=i[0],e[e.length]=i[1],e[e.length]=i[2]),e}function x(a){for(var b,c,d=[],e=0,f=a&&a.length;e=55296&&b<=56319&&e+1=56320&&c<=57343&&(b=1024*(b-55296)+c-56320+65536,e++),b<128?d[d.length]=b:b<2048?(d[d.length]=192|b>>6&31,d[d.length]=128|63&b):b<65536?(d[d.length]=224|b>>12&15,d[d.length]=128|b>>6&63,d[d.length]=128|63&b):b<2097152&&(d[d.length]=240|b>>18&15,d[d.length]=128|b>>12&63,d[d.length]=128|b>>6&63,d[d.length]=128|63&b);return d}function y(a){for(var b,c,d,e,f,g,h=[],i=0,j=a&&a.length;i>4,b>=0&&b<=7?g=c:12===b||13===b?(d=a[i++],g=(31&c)<<6|63&d):14===b?(d=a[i++],e=a[i++],g=(15&c)<<12|(63&d)<<6|63&e):15===b&&(d=a[i++],e=a[i++],f=a[i++],g=(7&c)<<18|(63&d)<<12|(63&e)<<6|63&f),g<=65535?h[h.length]=g:(g-=65536,h[h.length]=55296+(g>>10),h[h.length]=g%1024+56320);return h}function z(a,b){var c;if(b&&b.bom){var d=b.bom;qa(d)||(d="BE");var e,f;"B"===d.charAt(0).toUpperCase()?(e=[254,255],f=A(a)):(e=[255,254],f=B(a)),c=[],c[0]=e[0],c[1]=e[1];for(var g=0,h=f.length;g>8&255,c[c.length]=255&b);return c}function B(a){for(var b,c=[],d=0,e=a&&a.length;d>8&255);return c}function C(a){var b,c,d=[],e=0,f=a&&a.length;for(f>=2&&(254===a[0]&&255===a[1]||255===a[0]&&254===a[1])&&(e=2);e=2&&(254===a[0]&&255===a[1]||255===a[0]&&254===a[1])&&(e=2);e=2&&(254===a[0]&&255===a[1]||255===a[0]&&254===a[1])&&(h=2),c&&(f[0]=c[0],f[1]=c[1]);for(var i,j;h=2&&(254===a[0]&&255===a[1]||255===a[0]&&254===a[1])&&(h=2),c&&(f[0]=c[0],f[1]=c[1]);for(var i,j;h=2&&(254===a[0]&&255===a[1]||255===a[0]&&254===a[1])&&(e=2);eLa&&(Ma=!0),c}catch(a){Ma=!1}}}return va(a)}function va(a){for(var b,c="",d=a&&a.length,e=0;eLa&&(Ma=!0);continue}catch(a){Ma=!1}return wa(a)}c+=Ea.apply(null,b)}return c}function wa(a){for(var b="",c=a&&a.length,d=0;d>2],b[b.length]=Ta[(3&e)<<4],b[b.length]=Va,b[b.length]=Va;break}if(f=a[c++],c==d){b[b.length]=Ta[e>>2],b[b.length]=Ta[(3&e)<<4|(240&f)>>4],b[b.length]=Ta[(15&f)<<2],b[b.length]=Va;break}g=a[c++],b[b.length]=Ta[e>>2],b[b.length]=Ta[(3&e)<<4|(240&f)>>4],b[b.length]=Ta[(15&f)<<2|(192&g)>>6],b[b.length]=Ta[63&g]}return ua(b)}function Ba(a){var b,c,d,e,f,g,h;for(g=a&&a.length,f=0,h=[];f>4;do{if(61==(d=255&a.charCodeAt(f++)))return h;d=Ua[d]}while(f>2;do{if(61==(e=255&a.charCodeAt(f++)))return h -;e=Ua[e]}while(f95&&(Ya[b]=0|a);for(Za={},c=ra(Xa),e=c.length,d=0;d255)return encodeURIComponent(ua(a));b>=97&&b<=122||b>=65&&b<=90||b>=48&&b<=57||33===b||b>=39&&b<=42||45===b||46===b||95===b||126===b?d[d.length]=b:(d[d.length]=37,b<16?(d[d.length]=48,d[d.length]=c[b]):(d[d.length]=c[b>>4&15],d[d.length]=c[15&b]))}return ua(d)},urlDecode:function(a){for(var b,c=[],d=0,e=a&&a.length;d=65281&&c<=65374&&(c-=65248),d[d.length]=c;return b?ua(d):d},toZenkakuCase:function(a){var b=!1;qa(a)&&(b=!0,a=ta(a));for(var c,d=[],e=a&&a.length,f=0;f=33&&c<=126&&(c+=65248),d[d.length]=c;return b?ua(d):d},toHiraganaCase:function(a){var b=!1;qa(a)&&(b=!0,a=ta(a));for(var c,d=[],e=a&&a.length,f=0;f=12449&&c<=12534?c-=96:12535===c?(d[d.length]=12431,c=12443):12538===c&&(d[d.length]=12434,c=12443),d[d.length]=c;return b?ua(d):d},toKatakanaCase:function(a){var b=!1;qa(a)&&(b=!0,a=ta(a));for(var c,d=[],e=a&&a.length,f=0;f=12353&&c<=12438&&((12431===c||12434===c)&&f=12289&&c<=12540&&void 0!==(e=$a[c])?f[f.length]=e:12532===c||12535===c||12538===c?(f[f.length]=_a[c],f[f.length]=65438):c>=12459&&c<=12489?(f[f.length]=$a[c-1],f[f.length]=65438):c>=12495&&c<=12509?(d=c%3,f[f.length]=$a[c-d],f[f.length]=ab[d-1]):f[f.length]=c;return b?ua(f):f},toZenkanaCase:function(a){var b=!1;qa(a)&&(b=!0,a=ta(a));var c,d,e,f=[],g=a&&a.length,h=0;for(h=0;h65376&&c<65440&&(d=bb[c-65377],h+165397&&c<65413||c>65417&&c<65423)?(d++,h++):65439===e&&c>65417&&c<65423&&(d+=2,h++)),c=d),f[f.length]=c;return b?ua(f):f},toHankakuSpace:function(a){if(qa(a))return a.replace(/\u3000/g," ");for(var b,c=[],d=a&&a.length,e=0;e>6&3,i=128|63&r,u[u.length]=239,u[u.length]=255&o,u[u.length]=255&i):128<=e?(t=e<<1,(r=n[++g])<159?(t-=t<319?225:97,r-=126>16&255),u[u.length]=f>>8&255,u[u.length]=255&f)):u[u.length]=255&n[g];return u}function o(n){a.init_JIS_TO_UTF8_TABLE();for(var e,t,r,o,i,l,f=[],u=0,g=n&&n.length;u>6&3,o=128|63&t,f[f.length]=239,f[f.length]=255&r,f[f.length]=255&o):143===e?(i=(n[++u]-128<<8)+(n[++u]-128),void 0===(l=T.JISX0212_TO_UTF8_TABLE[i])?f[f.length]=a.UNKNOWN_CHARACTER:(l<65535||(f[f.length]=l>>16&255),f[f.length]=l>>8&255,f[f.length]=255&l)):128<=e?(i=(e-128<<8)+(n[++u]-128),void 0===(l=T.JIS_TO_UTF8_TABLE[i])?f[f.length]=a.UNKNOWN_CHARACTER:(l<65535||(f[f.length]=l>>16&255),f[f.length]=l>>8&255,f[f.length]=255&l)):f[f.length]=255&n[u];return f}function i(n){a.init_JIS_TO_UTF8_TABLE();for(var e,t,r,o,i,l=[],f=0,u=0,g=n&&n.length;u>16&255),l[l.length]=i>>8&255,l[l.length]=255&i)):2===f?(t=188|(e=n[u]+64)>>6&3,r=128|63&e,l[l.length]=239,l[l.length]=255&t,l[l.length]=255&r):3===f?(o=(n[u]<<8)+n[++u],void 0===(i=T.JISX0212_TO_UTF8_TABLE[o])?l[l.length]=a.UNKNOWN_CHARACTER:(i<65535||(l[l.length]=i>>16&255),l[l.length]=i>>8&255,l[l.length]=255&i)):l[l.length]=255&n[u]}return l}function l(n){for(var e,t,r,o,i,l=[],f=0,u=n&&n.length;f>8)?((t>>=1)<47?t+=113:t-=79,r+=95>=1)<=47?t+=112:t-=80,r+=126),l[l.length]=255&t,l[l.length]=255&r)):l[l.length]=255&n[f];return l}function f(n){for(var e,t,r,o=[],i=0,l=n&&n.length;i>8)-128&255,o[o.length]=(255&r)-128&255):(65536>8)-128&255,o[o.length]=(255&r)-128&255))):o[o.length]=255&n[i];return o}function g(n){for(var e,t,r,o=[],i=0,l=n&&n.length,f=0,u=[27,40,66,27,36,66,27,40,73,27,36,40,68];f>8&255,o[o.length]=255&r):(65536>8&255),o[o.length]=255&r));return 0!==i&&(o[o.length]=u[0],o[o.length]=u[1],o[o.length]=u[2]),o}function c(n){for(var e,t,r=[],o=0,i=n&&n.length;o>6&31,r[r.length]=128|63&e):e<65536?(r[r.length]=224|e>>12&15,r[r.length]=128|e>>6&63,r[r.length]=128|63&e):e<2097152&&(r[r.length]=240|e>>18&15,r[r.length]=128|e>>12&63,r[r.length]=128|e>>6&63,r[r.length]=128|63&e);return r}function s(n){for(var e,t,r,o=[],i=0,l=n&&n.length;i>4)&&e<=7?r=t:12==e||13==e?r=(31&t)<<6|63&n[i++]:14==e?r=(15&t)<<12|(63&n[i++])<<6|63&n[i++]:15==e&&(r=(7&t)<<18|(63&n[i++])<<12|(63&n[i++])<<6|63&n[i++]),r<=65535?o[o.length]=r:(r-=65536,o[o.length]=55296+(r>>10),o[o.length]=r%1024+56320);return o}function U(n,e){var t;if(e&&e.bom){var r,o,i=e.bom;h.isString(i)||(i="BE"),o="B"===i.charAt(0).toUpperCase()?(r=[254,255],_(n)):(r=[255,254],E(n)),(t=[])[0]=r[0],t[1]=r[1];for(var l=0,f=o.length;l>8&255,t[t.length]=255&e);return t}function E(n){for(var e,t=[],r=0,o=n&&n.length;r>8&255);return t}function A(n){var e,t,r=[],o=0,i=n&&n.length;for(2<=i&&(254===n[0]&&255===n[1]||255===n[0]&&254===n[1])&&(o=2);o>=1)<47?e+=113:e-=79,t+=95>=1)<=47?e+=112:e-=80,t+=126),r[r.length]=255&e,r[r.length]=255&t):r[r.length]=2===o?n[i]+128&255:3===o?a.UNKNOWN_CHARACTER:255&n[i]}return r},t.JISToEUCJP=function(n){for(var e=[],t=0,r=n&&n.length,o=0;o>=1,e+=e<111?49:113,t-=223>=1,e+=e<=111?48:112,t-=2),r[r.length]=255&e,r[r.length]=255&t):r[r.length]=142===e?255&n[++i]:255&e;return r},t.SJISToUTF8=r,t.EUCJPToUTF8=o,t.JISToUTF8=i,t.UTF8ToSJIS=l,t.UTF8ToEUCJP=f,t.UTF8ToJIS=g,t.UNICODEToUTF8=c,t.UTF8ToUNICODE=s,t.UNICODEToUTF16=U,t.UNICODEToUTF16BE=_,t.UNICODEToUTF16LE=E,t.UTF16BEToUNICODE=A,t.UTF16LEToUNICODE=S,t.UTF16ToUNICODE=d,t.UTF16ToUTF16BE=function(n){for(var e,t,r=[],o=0,i=n&&n.length,l=!1,f=!0;o>4&15],r[r.length]=t[15&e]))}return u.codeToString_fast(r)},urlDecode:function(n){for(var e,t=[],r=0,o=n&&n.length;ri.APPLY_BUFFER_SIZE&&(i.APPLY_BUFFER_SIZE_OK=!0),t}catch(n){i.APPLY_BUFFER_SIZE_OK=!1}}return a(n)}function a(n){for(var e,t="",r=n&&n.length,o=0;oi.APPLY_BUFFER_SIZE&&(i.APPLY_BUFFER_SIZE_OK=!0);continue}catch(n){i.APPLY_BUFFER_SIZE_OK=!1}return T(n)}t+=l.apply(null,e)}return t}function T(n){for(var e="",t=n&&n.length,r=0;r>2],e[e.length]=c[(3&o)<<4],e[e.length]=U,e[e.length]=U;break}if(i=n[t++],t==r){e[e.length]=c[o>>2],e[e.length]=c[(3&o)<<4|(240&i)>>4],e[e.length]=c[(15&i)<<2],e[e.length]=U;break}l=n[t++],e[e.length]=c[o>>2],e[e.length]=c[(3&o)<<4|(240&i)>>4],e[e.length]=c[(15&i)<<2|(192&l)>>6],e[e.length]=c[63&l]}return h(e)},t.base64decode=function(n){var e,t,r,o,i,l,f;for(l=n&&n.length,i=0,f=[];i>4;do{if(61==(r=255&n.charCodeAt(i++)))return f;r=s[r]}while(i>2;do{if(61==(o=255&n.charCodeAt(i++)))return f;o=s[o]}while(i>label: Accordion +//>>group: Widgets +/* eslint-disable max-len */ +//>>description: Displays collapsible content panels for presenting information in a limited amount of space. +/* eslint-enable max-len */ +//>>docs: http://api.jqueryui.com/accordion/ +//>>demos: http://jqueryui.com/accordion/ +//>>css.structure: ../../themes/base/core.css +//>>css.structure: ../../themes/base/accordion.css +//>>css.theme: ../../themes/base/theme.css + +( function( factory ) { + "use strict"; + if ( typeof define === "function" && define.amd ) { // AMD. Register as an anonymous module. - define([ + define( [ "jquery", - "./core", - "./widget" + "../version", + "../keycode", + "../unique-id", + "../widget" ], factory ); } else { // Browser globals factory( jQuery ); } -}(function( $ ) { +} )( function( $ ) { +"use strict"; return $.widget( "ui.accordion", { - version: "1.11.4", + version: "@VERSION", options: { active: 0, animate: {}, + classes: { + "ui-accordion-header": "ui-corner-top", + "ui-accordion-header-collapsed": "ui-corner-all", + "ui-accordion-content": "ui-corner-bottom" + }, collapsible: false, event: "click", - header: "> li > :first-child,> :not(li):even", + header: function( elem ) { + return elem.find( "> li > :first-child" ).add( elem.find( "> :not(li)" ).even() ); + }, heightStyle: "auto", icons: { activeHeader: "ui-icon-triangle-1-s", header: "ui-icon-triangle-1-e" }, - // callbacks + // Callbacks activate: null, beforeActivate: null }, @@ -61,17 +83,18 @@ return $.widget( "ui.accordion", { _create: function() { var options = this.options; - this.prevShow = this.prevHide = $(); - this.element.addClass( "ui-accordion ui-widget ui-helper-reset" ) - // ARIA - .attr( "role", "tablist" ); - // don't allow collapsible: false and active: false / null - if ( !options.collapsible && (options.active === false || options.active == null) ) { + this.prevShow = this.prevHide = $(); + this._addClass( "ui-accordion", "ui-widget ui-helper-reset" ); + this.element.attr( "role", "tablist" ); + + // Don't allow collapsible: false and active: false / null + if ( !options.collapsible && ( options.active === false || options.active == null ) ) { options.active = 0; } this._processPanels(); + // handle negative values if ( options.active < 0 ) { options.active += this.headers.length; @@ -87,54 +110,42 @@ return $.widget( "ui.accordion", { }, _createIcons: function() { - var icons = this.options.icons; + var icon, children, + icons = this.options.icons; + if ( icons ) { - $( "" ) - .addClass( "ui-accordion-header-icon ui-icon " + icons.header ) - .prependTo( this.headers ); - this.active.children( ".ui-accordion-header-icon" ) - .removeClass( icons.header ) - .addClass( icons.activeHeader ); - this.headers.addClass( "ui-accordion-icons" ); + icon = $( "" ); + this._addClass( icon, "ui-accordion-header-icon", "ui-icon " + icons.header ); + icon.prependTo( this.headers ); + children = this.active.children( ".ui-accordion-header-icon" ); + this._removeClass( children, icons.header ) + ._addClass( children, null, icons.activeHeader ) + ._addClass( this.headers, "ui-accordion-icons" ); } }, _destroyIcons: function() { - this.headers - .removeClass( "ui-accordion-icons" ) - .children( ".ui-accordion-header-icon" ) - .remove(); + this._removeClass( this.headers, "ui-accordion-icons" ); + this.headers.children( ".ui-accordion-header-icon" ).remove(); }, _destroy: function() { var contents; - // clean up main element - this.element - .removeClass( "ui-accordion ui-widget ui-helper-reset" ) - .removeAttr( "role" ); + // Clean up main element + this.element.removeAttr( "role" ); - // clean up headers + // Clean up headers this.headers - .removeClass( "ui-accordion-header ui-accordion-header-active ui-state-default " + - "ui-corner-all ui-state-active ui-state-disabled ui-corner-top" ) - .removeAttr( "role" ) - .removeAttr( "aria-expanded" ) - .removeAttr( "aria-selected" ) - .removeAttr( "aria-controls" ) - .removeAttr( "tabIndex" ) + .removeAttr( "role aria-expanded aria-selected aria-controls tabIndex" ) .removeUniqueId(); this._destroyIcons(); - // clean up content panels + // Clean up content panels contents = this.headers.next() - .removeClass( "ui-helper-reset ui-widget-content ui-corner-bottom " + - "ui-accordion-content ui-accordion-content-active ui-state-disabled" ) .css( "display", "" ) - .removeAttr( "role" ) - .removeAttr( "aria-hidden" ) - .removeAttr( "aria-labelledby" ) + .removeAttr( "role aria-hidden aria-labelledby" ) .removeUniqueId(); if ( this.options.heightStyle !== "content" ) { @@ -144,6 +155,7 @@ return $.widget( "ui.accordion", { _setOption: function( key, value ) { if ( key === "active" ) { + // _activate() will handle invalid values and update this.options this._activate( value ); return; @@ -158,7 +170,7 @@ return $.widget( "ui.accordion", { this._super( key, value ); - // setting collapsible: false while collapsed; open first panel + // Setting collapsible: false while collapsed; open first panel if ( key === "collapsible" && !value && this.options.active === false ) { this._activate( 0 ); } @@ -169,16 +181,19 @@ return $.widget( "ui.accordion", { this._createIcons(); } } + }, - // #5332 - opacity doesn't cascade to positioned elements in IE + _setOptionDisabled: function( value ) { + this._super( value ); + + this.element.attr( "aria-disabled", value ); + + // Support: IE8 Only + // #5332 / #6059 - opacity doesn't cascade to positioned elements in IE // so we need to add the disabled class to the headers and panels - if ( key === "disabled" ) { - this.element - .toggleClass( "ui-state-disabled", !!value ) - .attr( "aria-disabled", value ); - this.headers.add( this.headers.next() ) - .toggleClass( "ui-state-disabled", !!value ); - } + this._toggleClass( null, "ui-state-disabled", !!value ); + this._toggleClass( this.headers.add( this.headers.next() ), null, "ui-state-disabled", + !!value ); }, _keydown: function( event ) { @@ -192,37 +207,37 @@ return $.widget( "ui.accordion", { toFocus = false; switch ( event.keyCode ) { - case keyCode.RIGHT: - case keyCode.DOWN: - toFocus = this.headers[ ( currentIndex + 1 ) % length ]; - break; - case keyCode.LEFT: - case keyCode.UP: - toFocus = this.headers[ ( currentIndex - 1 + length ) % length ]; - break; - case keyCode.SPACE: - case keyCode.ENTER: - this._eventHandler( event ); - break; - case keyCode.HOME: - toFocus = this.headers[ 0 ]; - break; - case keyCode.END: - toFocus = this.headers[ length - 1 ]; - break; + case keyCode.RIGHT: + case keyCode.DOWN: + toFocus = this.headers[ ( currentIndex + 1 ) % length ]; + break; + case keyCode.LEFT: + case keyCode.UP: + toFocus = this.headers[ ( currentIndex - 1 + length ) % length ]; + break; + case keyCode.SPACE: + case keyCode.ENTER: + this._eventHandler( event ); + break; + case keyCode.HOME: + toFocus = this.headers[ 0 ]; + break; + case keyCode.END: + toFocus = this.headers[ length - 1 ]; + break; } if ( toFocus ) { $( event.target ).attr( "tabIndex", -1 ); $( toFocus ).attr( "tabIndex", 0 ); - toFocus.focus(); + $( toFocus ).trigger( "focus" ); event.preventDefault(); } }, _panelKeyDown: function( event ) { if ( event.keyCode === $.ui.keyCode.UP && event.ctrlKey ) { - $( event.currentTarget ).prev().focus(); + $( event.currentTarget ).prev().trigger( "focus" ); } }, @@ -230,25 +245,32 @@ return $.widget( "ui.accordion", { var options = this.options; this._processPanels(); - // was collapsed or no panel - if ( ( options.active === false && options.collapsible === true ) || !this.headers.length ) { + // Was collapsed or no panel + if ( ( options.active === false && options.collapsible === true ) || + !this.headers.length ) { options.active = false; this.active = $(); + // active false only when collapsible is true } else if ( options.active === false ) { this._activate( 0 ); + // was active, but active panel is gone } else if ( this.active.length && !$.contains( this.element[ 0 ], this.active[ 0 ] ) ) { + // all remaining panel are disabled - if ( this.headers.length === this.headers.find(".ui-state-disabled").length ) { + if ( this.headers.length === this.headers.find( ".ui-state-disabled" ).length ) { options.active = false; this.active = $(); + // activate previous panel } else { this._activate( Math.max( 0, options.active - 1 ) ); } + // was active, active panel still exists } else { + // make sure active index is correct options.active = this.headers.index( this.active ); } @@ -262,13 +284,16 @@ return $.widget( "ui.accordion", { var prevHeaders = this.headers, prevPanels = this.panels; - this.headers = this.element.find( this.options.header ) - .addClass( "ui-accordion-header ui-state-default ui-corner-all" ); + if ( typeof this.options.header === "function" ) { + this.headers = this.options.header( this.element ); + } else { + this.headers = this.element.find( this.options.header ); + } + this._addClass( this.headers, "ui-accordion-header ui-accordion-header-collapsed", + "ui-state-default" ); - this.panels = this.headers.next() - .addClass( "ui-accordion-content ui-helper-reset ui-widget-content ui-corner-bottom" ) - .filter( ":not(.ui-accordion-content-active)" ) - .hide(); + this.panels = this.headers.next().filter( ":not(.ui-accordion-content-active)" ).hide(); + this._addClass( this.panels, "ui-accordion-content", "ui-helper-reset ui-widget-content" ); // Avoid memory leaks (#10056) if ( prevPanels ) { @@ -283,52 +308,51 @@ return $.widget( "ui.accordion", { heightStyle = options.heightStyle, parent = this.element.parent(); - this.active = this._findActive( options.active ) - .addClass( "ui-accordion-header-active ui-state-active ui-corner-top" ) - .removeClass( "ui-corner-all" ); - this.active.next() - .addClass( "ui-accordion-content-active" ) - .show(); + this.active = this._findActive( options.active ); + this._addClass( this.active, "ui-accordion-header-active", "ui-state-active" ) + ._removeClass( this.active, "ui-accordion-header-collapsed" ); + this._addClass( this.active.next(), "ui-accordion-content-active" ); + this.active.next().show(); this.headers .attr( "role", "tab" ) - .each(function() { + .each( function() { var header = $( this ), headerId = header.uniqueId().attr( "id" ), panel = header.next(), panelId = panel.uniqueId().attr( "id" ); header.attr( "aria-controls", panelId ); panel.attr( "aria-labelledby", headerId ); - }) + } ) .next() .attr( "role", "tabpanel" ); this.headers .not( this.active ) - .attr({ - "aria-selected": "false", - "aria-expanded": "false", - tabIndex: -1 - }) - .next() - .attr({ - "aria-hidden": "true" - }) - .hide(); + .attr( { + "aria-selected": "false", + "aria-expanded": "false", + tabIndex: -1 + } ) + .next() + .attr( { + "aria-hidden": "true" + } ) + .hide(); - // make sure at least one header is in the tab order + // Make sure at least one header is in the tab order if ( !this.active.length ) { this.headers.eq( 0 ).attr( "tabIndex", 0 ); } else { - this.active.attr({ + this.active.attr( { "aria-selected": "true", "aria-expanded": "true", tabIndex: 0 - }) - .next() - .attr({ - "aria-hidden": "false" - }); + } ) + .next() + .attr( { + "aria-hidden": "false" + } ); } this._createIcons(); @@ -337,7 +361,7 @@ return $.widget( "ui.accordion", { if ( heightStyle === "fill" ) { maxHeight = parent.height(); - this.element.siblings( ":visible" ).each(function() { + this.element.siblings( ":visible" ).each( function() { var elem = $( this ), position = elem.css( "position" ); @@ -345,24 +369,31 @@ return $.widget( "ui.accordion", { return; } maxHeight -= elem.outerHeight( true ); - }); + } ); - this.headers.each(function() { + this.headers.each( function() { maxHeight -= $( this ).outerHeight( true ); - }); + } ); this.headers.next() - .each(function() { + .each( function() { $( this ).height( Math.max( 0, maxHeight - $( this ).innerHeight() + $( this ).height() ) ); - }) + } ) .css( "overflow", "auto" ); } else if ( heightStyle === "auto" ) { maxHeight = 0; this.headers.next() - .each(function() { + .each( function() { + var isVisible = $( this ).is( ":visible" ); + if ( !isVisible ) { + $( this ).show(); + } maxHeight = Math.max( maxHeight, $( this ).css( "height", "" ).height() ); - }) + if ( !isVisible ) { + $( this ).hide(); + } + } ) .height( maxHeight ); } }, @@ -370,19 +401,19 @@ return $.widget( "ui.accordion", { _activate: function( index ) { var active = this._findActive( index )[ 0 ]; - // trying to activate the already active panel + // Trying to activate the already active panel if ( active === this.active[ 0 ] ) { return; } - // trying to collapse, simulate a click on the currently active header + // Trying to collapse, simulate a click on the currently active header active = active || this.active[ 0 ]; - this._eventHandler({ + this._eventHandler( { target: active, currentTarget: active, preventDefault: $.noop - }); + } ); }, _findActive: function( selector ) { @@ -396,18 +427,19 @@ return $.widget( "ui.accordion", { if ( event ) { $.each( event.split( " " ), function( index, eventName ) { events[ eventName ] = "_eventHandler"; - }); + } ); } this._off( this.headers.add( this.headers.next() ) ); this._on( this.headers, events ); - this._on( this.headers.next(), { keydown: "_panelKeyDown" }); + this._on( this.headers.next(), { keydown: "_panelKeyDown" } ); this._hoverable( this.headers ); this._focusable( this.headers ); }, _eventHandler: function( event ) { - var options = this.options, + var activeChildren, clickedChildren, + options = this.options, active = this.active, clicked = $( event.currentTarget ), clickedIsActive = clicked[ 0 ] === active[ 0 ], @@ -424,8 +456,10 @@ return $.widget( "ui.accordion", { event.preventDefault(); if ( + // click on active header, but not collapsible ( clickedIsActive && !options.collapsible ) || + // allow canceling activation ( this._trigger( "beforeActivate", event, eventData ) === false ) ) { return; @@ -433,33 +467,30 @@ return $.widget( "ui.accordion", { options.active = collapsing ? false : this.headers.index( clicked ); - // when the call to ._toggle() comes after the class changes + // When the call to ._toggle() comes after the class changes // it causes a very odd bug in IE 8 (see #6720) this.active = clickedIsActive ? $() : clicked; this._toggle( eventData ); - // switch classes + // Switch classes // corner classes on the previously active header stay after the animation - active.removeClass( "ui-accordion-header-active ui-state-active" ); + this._removeClass( active, "ui-accordion-header-active", "ui-state-active" ); if ( options.icons ) { - active.children( ".ui-accordion-header-icon" ) - .removeClass( options.icons.activeHeader ) - .addClass( options.icons.header ); + activeChildren = active.children( ".ui-accordion-header-icon" ); + this._removeClass( activeChildren, null, options.icons.activeHeader ) + ._addClass( activeChildren, null, options.icons.header ); } if ( !clickedIsActive ) { - clicked - .removeClass( "ui-corner-all" ) - .addClass( "ui-accordion-header-active ui-state-active ui-corner-top" ); + this._removeClass( clicked, "ui-accordion-header-collapsed" ) + ._addClass( clicked, "ui-accordion-header-active", "ui-state-active" ); if ( options.icons ) { - clicked.children( ".ui-accordion-header-icon" ) - .removeClass( options.icons.header ) - .addClass( options.icons.activeHeader ); + clickedChildren = clicked.children( ".ui-accordion-header-icon" ); + this._removeClass( clickedChildren, null, options.icons.header ) + ._addClass( clickedChildren, null, options.icons.activeHeader ); } - clicked - .next() - .addClass( "ui-accordion-content-active" ); + this._addClass( clicked.next(), "ui-accordion-content-active" ); } }, @@ -467,7 +498,7 @@ return $.widget( "ui.accordion", { var toShow = data.newPanel, toHide = this.prevShow.length ? this.prevShow : data.oldPanel; - // handle activating a panel during the animation for another activation + // Handle activating a panel during the animation for another activation this.prevShow.add( this.prevHide ).stop( true, true ); this.prevShow = toShow; this.prevHide = toHide; @@ -480,36 +511,37 @@ return $.widget( "ui.accordion", { this._toggleComplete( data ); } - toHide.attr({ + toHide.attr( { "aria-hidden": "true" - }); - toHide.prev().attr({ + } ); + toHide.prev().attr( { "aria-selected": "false", "aria-expanded": "false" - }); + } ); + // if we're switching panels, remove the old header from the tab order // if we're opening from collapsed state, remove the previous header from the tab order // if we're collapsing, then keep the collapsing header in the tab order if ( toShow.length && toHide.length ) { - toHide.prev().attr({ + toHide.prev().attr( { "tabIndex": -1, "aria-expanded": "false" - }); + } ); } else if ( toShow.length ) { - this.headers.filter(function() { + this.headers.filter( function() { return parseInt( $( this ).attr( "tabIndex" ), 10 ) === 0; - }) - .attr( "tabIndex", -1 ); + } ) + .attr( "tabIndex", -1 ); } toShow .attr( "aria-hidden", "false" ) .prev() - .attr({ + .attr( { "aria-selected": "true", "aria-expanded": "true", tabIndex: 0 - }); + } ); }, _animate: function( toShow, toHide, data ) { @@ -531,6 +563,7 @@ return $.widget( "ui.accordion", { if ( typeof options === "string" ) { easing = options; } + // fall back from options to animation in case of partial down settings easing = easing || options.easing || animate.easing; duration = duration || options.duration || animate.duration; @@ -549,7 +582,7 @@ return $.widget( "ui.accordion", { step: function( now, fx ) { fx.now = Math.round( now ); } - }); + } ); toShow .hide() .animate( this.showProps, { @@ -567,17 +600,16 @@ return $.widget( "ui.accordion", { adjust = 0; } } - }); + } ); }, _toggleComplete: function( data ) { - var toHide = data.oldPanel; + var toHide = data.oldPanel, + prev = toHide.prev(); - toHide - .removeClass( "ui-accordion-content-active" ) - .prev() - .removeClass( "ui-corner-top" ) - .addClass( "ui-corner-all" ); + this._removeClass( toHide, "ui-accordion-content-active" ); + this._removeClass( prev, "ui-accordion-header-active" ) + ._addClass( prev, "ui-accordion-header-collapsed" ); // Work around for rendering bug in IE (#5421) if ( toHide.length ) { @@ -585,6 +617,6 @@ return $.widget( "ui.accordion", { } this._trigger( "activate", null, data ); } -}); +} ); -})); +} ); diff --git a/include/thirdparty/jquery_ui/autocomplete.js b/include/thirdparty/jquery_ui/autocomplete.js index 63beb1f..6a8bfcb 100644 --- a/include/thirdparty/jquery_ui/autocomplete.js +++ b/include/thirdparty/jquery_ui/autocomplete.js @@ -1,33 +1,46 @@ /*! - * jQuery UI Autocomplete 1.11.4 + * jQuery UI Autocomplete @VERSION * http://jqueryui.com * - * Copyright jQuery Foundation and other contributors + * Copyright OpenJS Foundation and other contributors * Released under the MIT license. * http://jquery.org/license - * - * http://api.jqueryui.com/autocomplete/ */ -(function( factory ) { + +//>>label: Autocomplete +//>>group: Widgets +//>>description: Lists suggested words as the user is typing. +//>>docs: http://api.jqueryui.com/autocomplete/ +//>>demos: http://jqueryui.com/autocomplete/ +//>>css.structure: ../../themes/base/core.css +//>>css.structure: ../../themes/base/autocomplete.css +//>>css.theme: ../../themes/base/theme.css + +( function( factory ) { + "use strict"; + if ( typeof define === "function" && define.amd ) { // AMD. Register as an anonymous module. - define([ + define( [ "jquery", - "./core", - "./widget", - "./position", - "./menu" + "./menu", + "../keycode", + "../position", + "../safe-active-element", + "../version", + "../widget" ], factory ); } else { // Browser globals factory( jQuery ); } -}(function( $ ) { +} )( function( $ ) { +"use strict"; $.widget( "ui.autocomplete", { - version: "1.11.4", + version: "@VERSION", defaultElement: "", options: { appendTo: null, @@ -41,7 +54,7 @@ $.widget( "ui.autocomplete", { }, source: null, - // callbacks + // Callbacks change: null, close: null, focus: null, @@ -53,8 +66,10 @@ $.widget( "ui.autocomplete", { requestIndex: 0, pending: 0, + liveRegionTimer: null, _create: function() { + // Some browsers only repeat keydown events, not keypress events, // so we use the suppressKeyPress flag to determine if we've already // handled the keydown event. #7269 @@ -67,21 +82,17 @@ $.widget( "ui.autocomplete", { isTextarea = nodeName === "textarea", isInput = nodeName === "input"; - this.isMultiLine = - // Textareas are always multi-line - isTextarea ? true : - // Inputs are always single-line, even if inside a contentEditable element - // IE also treats inputs as contentEditable - isInput ? false : - // All other element types are determined by whether or not they're contentEditable - this.element.prop( "isContentEditable" ); + // Textareas are always multi-line + // Inputs are always single-line, even if inside a contentEditable element + // IE also treats inputs as contentEditable + // All other element types are determined by whether or not they're contentEditable + this.isMultiLine = isTextarea || !isInput && this._isContentEditable( this.element ); this.valueMethod = this.element[ isTextarea || isInput ? "val" : "text" ]; this.isNewMenu = true; - this.element - .addClass( "ui-autocomplete-input" ) - .attr( "autocomplete", "off" ); + this._addClass( "ui-autocomplete-input" ); + this.element.attr( "autocomplete", "off" ); this._on( this.element, { keydown: function( event ) { @@ -114,8 +125,10 @@ $.widget( "ui.autocomplete", { this._keyEvent( "next", event ); break; case keyCode.ENTER: + // when menu is open and has focus if ( this.menu.active ) { + // #6055 - Opera still allows the keypress to occur // which causes forms to submit suppressKeyPress = true; @@ -134,6 +147,7 @@ $.widget( "ui.autocomplete", { this._value( this.term ); } this.close( event ); + // Different browsers have different default behavior for escape // Single press can mean undo or clear // Double press in IE means clear the whole form @@ -142,6 +156,7 @@ $.widget( "ui.autocomplete", { break; default: suppressKeyPressRepeat = true; + // search timeout should be triggered before the input value is changed this._searchTimeout( event ); break; @@ -159,7 +174,7 @@ $.widget( "ui.autocomplete", { return; } - // replicate some key handlers to allow them to repeat in Firefox and Opera + // Replicate some key handlers to allow them to repeat in Firefox and Opera var keyCode = $.ui.keyCode; switch ( event.keyCode ) { case keyCode.PAGE_UP: @@ -189,60 +204,43 @@ $.widget( "ui.autocomplete", { this.previous = this._value(); }, blur: function( event ) { - if ( this.cancelBlur ) { - delete this.cancelBlur; - return; - } - clearTimeout( this.searching ); this.close( event ); this._change( event ); } - }); + } ); this._initSource(); this.menu = $( "
                  " ) - .addClass( "ui-autocomplete ui-front" ) .appendTo( this._appendTo() ) - .menu({ + .menu( { + // disable ARIA support, the live region takes care of that role: null - }) + } ) .hide() + + // Support: IE 11 only, Edge <= 14 + // For other browsers, we preventDefault() on the mousedown event + // to keep the dropdown from taking focus from the input. This doesn't + // work for IE/Edge, causing problems with selection and scrolling (#9638) + // Happily, IE and Edge support an "unselectable" attribute that + // prevents an element from receiving focus, exactly what we want here. + .attr( { + "unselectable": "on" + } ) .menu( "instance" ); + this._addClass( this.menu.element, "ui-autocomplete", "ui-front" ); this._on( this.menu.element, { mousedown: function( event ) { - // prevent moving focus out of the text field + + // Prevent moving focus out of the text field event.preventDefault(); - - // IE doesn't prevent moving focus even with event.preventDefault() - // so we set a flag to know when we should ignore the blur event - this.cancelBlur = true; - this._delay(function() { - delete this.cancelBlur; - }); - - // clicking on the scrollbar causes focus to shift to the body - // but we can't detect a mouseup or a click immediately afterward - // so we have to track the next mousedown and close the menu if - // the user clicks somewhere outside of the autocomplete - var menuElement = this.menu.element[ 0 ]; - if ( !$( event.target ).closest( ".ui-menu-item" ).length ) { - this._delay(function() { - var that = this; - this.document.one( "mousedown", function( event ) { - if ( event.target !== that.element[ 0 ] && - event.target !== menuElement && - !$.contains( menuElement, event.target ) ) { - that.close(); - } - }); - }); - } }, menufocus: function( event, ui ) { var label, item; + // support: Firefox // Prevent accidental activation of menu items in Firefox (#7024 #9118) if ( this.isNewMenu ) { @@ -252,7 +250,7 @@ $.widget( "ui.autocomplete", { this.document.one( "mousemove", function() { $( event.target ).trigger( event.originalEvent ); - }); + } ); return; } @@ -260,6 +258,7 @@ $.widget( "ui.autocomplete", { item = ui.item.data( "ui-autocomplete-item" ); if ( false !== this._trigger( "focus", event, { item: item } ) ) { + // use value to match what will end up in the input, if it was a key event if ( event.originalEvent && /^key/.test( event.originalEvent.type ) ) { this._value( item.value ); @@ -268,31 +267,35 @@ $.widget( "ui.autocomplete", { // Announce the value in the liveRegion label = ui.item.attr( "aria-label" ) || item.value; - if ( label && $.trim( label ).length ) { - this.liveRegion.children().hide(); - $( "
                  " ).text( label ).appendTo( this.liveRegion ); + if ( label && String.prototype.trim.call( label ).length ) { + clearTimeout( this.liveRegionTimer ); + this.liveRegionTimer = this._delay( function() { + this.liveRegion.html( $( "
                  " ).text( label ) ); + }, 100 ); } }, menuselect: function( event, ui ) { var item = ui.item.data( "ui-autocomplete-item" ), previous = this.previous; - // only trigger when focus was lost (click on menu) - if ( this.element[ 0 ] !== this.document[ 0 ].activeElement ) { - this.element.focus(); + // Only trigger when focus was lost (click on menu) + if ( this.element[ 0 ] !== $.ui.safeActiveElement( this.document[ 0 ] ) ) { + this.element.trigger( "focus" ); this.previous = previous; + // #6109 - IE triggers two focus events and the second // is asynchronous, so we need to reset the previous // term synchronously and asynchronously :-( - this._delay(function() { + this._delay( function() { this.previous = previous; this.selectedItem = item; - }); + } ); } if ( false !== this._trigger( "select", event, { item: item } ) ) { this._value( item.value ); } + // reset the term after the select event // this allows custom select handling to work properly this.term = this._value(); @@ -300,31 +303,30 @@ $.widget( "ui.autocomplete", { this.close( event ); this.selectedItem = item; } - }); + } ); - this.liveRegion = $( "", { - role: "status", - "aria-live": "assertive", - "aria-relevant": "additions" - }) - .addClass( "ui-helper-hidden-accessible" ) + this.liveRegion = $( "
                  ", { + role: "status", + "aria-live": "assertive", + "aria-relevant": "additions" + } ) .appendTo( this.document[ 0 ].body ); - // turning off autocomplete prevents the browser from remembering the + this._addClass( this.liveRegion, null, "ui-helper-hidden-accessible" ); + + // Turning off autocomplete prevents the browser from remembering the // value when navigating through history, so we re-enable autocomplete // if the page is unloaded before the widget is destroyed. #7790 this._on( this.window, { beforeunload: function() { this.element.removeAttr( "autocomplete" ); } - }); + } ); }, _destroy: function() { clearTimeout( this.searching ); - this.element - .removeClass( "ui-autocomplete-input" ) - .removeAttr( "autocomplete" ); + this.element.removeAttr( "autocomplete" ); this.menu.element.remove(); this.liveRegion.remove(); }, @@ -342,6 +344,20 @@ $.widget( "ui.autocomplete", { } }, + _isEventTargetInWidget: function( event ) { + var menuElement = this.menu.element[ 0 ]; + + return event.target === this.element[ 0 ] || + event.target === menuElement || + $.contains( menuElement, event.target ); + }, + + _closeOnClickOutside: function( event ) { + if ( !this._isEventTargetInWidget( event ) ) { + this.close(); + } + }, + _appendTo: function() { var element = this.options.appendTo; @@ -352,7 +368,7 @@ $.widget( "ui.autocomplete", { } if ( !element || !element[ 0 ] ) { - element = this.element.closest( ".ui-front" ); + element = this.element.closest( ".ui-front, dialog" ); } if ( !element.length ) { @@ -365,7 +381,7 @@ $.widget( "ui.autocomplete", { _initSource: function() { var array, url, that = this; - if ( $.isArray( this.options.source ) ) { + if ( Array.isArray( this.options.source ) ) { array = this.options.source; this.source = function( request, response ) { response( $.ui.autocomplete.filter( array, request.term ) ); @@ -376,7 +392,7 @@ $.widget( "ui.autocomplete", { if ( that.xhr ) { that.xhr.abort(); } - that.xhr = $.ajax({ + that.xhr = $.ajax( { url: url, data: request, dataType: "json", @@ -384,9 +400,9 @@ $.widget( "ui.autocomplete", { response( data ); }, error: function() { - response([]); + response( [] ); } - }); + } ); }; } else { this.source = this.options.source; @@ -395,7 +411,7 @@ $.widget( "ui.autocomplete", { _searchTimeout: function( event ) { clearTimeout( this.searching ); - this.searching = this._delay(function() { + this.searching = this._delay( function() { // Search if the value has changed, or if the user retypes the same value (see #7434) var equalValues = this.term === this._value(), @@ -412,7 +428,7 @@ $.widget( "ui.autocomplete", { search: function( value, event ) { value = value != null ? value : this._value(); - // always save the actual value, not the one passed as an argument + // Always save the actual value, not the one passed as an argument this.term = this._value(); if ( value.length < this.options.minLength ) { @@ -428,7 +444,7 @@ $.widget( "ui.autocomplete", { _search: function( value ) { this.pending++; - this.element.addClass( "ui-autocomplete-loading" ); + this._addClass( "ui-autocomplete-loading" ); this.cancelSearch = false; this.source( { term: value }, this._response() ); @@ -437,16 +453,16 @@ $.widget( "ui.autocomplete", { _response: function() { var index = ++this.requestIndex; - return $.proxy(function( content ) { + return function( content ) { if ( index === this.requestIndex ) { this.__response( content ); } this.pending--; if ( !this.pending ) { - this.element.removeClass( "ui-autocomplete-loading" ); + this._removeClass( "ui-autocomplete-loading" ); } - }, this ); + }.bind( this ); }, __response: function( content ) { @@ -458,6 +474,7 @@ $.widget( "ui.autocomplete", { this._suggest( content ); this._trigger( "open" ); } else { + // use ._close() instead of .close() so we don't cancel future searches this._close(); } @@ -469,6 +486,10 @@ $.widget( "ui.autocomplete", { }, _close: function( event ) { + + // Remove the handler that closes the menu on outside clicks + this._off( this.document, "mousedown" ); + if ( this.menu.element.is( ":visible" ) ) { this.menu.element.hide(); this.menu.blur(); @@ -484,6 +505,7 @@ $.widget( "ui.autocomplete", { }, _normalize: function( items ) { + // assume all items have the right format when the first item is complete if ( items.length && items[ 0 ].label && items[ 0 ].value ) { return items; @@ -498,8 +520,8 @@ $.widget( "ui.autocomplete", { return $.extend( {}, item, { label: item.label || item.value, value: item.value || item.label - }); - }); + } ); + } ); }, _suggest: function( items ) { @@ -508,21 +530,27 @@ $.widget( "ui.autocomplete", { this.isNewMenu = true; this.menu.refresh(); - // size and position menu + // Size and position menu ul.show(); this._resizeMenu(); - ul.position( $.extend({ + ul.position( $.extend( { of: this.element }, this.options.position ) ); if ( this.options.autoFocus ) { this.menu.next(); } + + // Listen for interactions outside of the widget (#6642) + this._on( this.document, { + mousedown: "_closeOnClickOutside" + } ); }, _resizeMenu: function() { var ul = this.menu.element; ul.outerWidth( Math.max( + // Firefox wraps long text (possibly a rounding bug) // so we add 1px to avoid the wrapping (#7513) ul.width( "" ).outerWidth() + 1, @@ -534,7 +562,7 @@ $.widget( "ui.autocomplete", { var that = this; $.each( items, function( index, item ) { that._renderItemData( ul, item ); - }); + } ); }, _renderItemData: function( ul, item ) { @@ -542,7 +570,9 @@ $.widget( "ui.autocomplete", { }, _renderItem: function( ul, item ) { - return $( "
                • " ).text( item.label ).appendTo( ul ); + return $( "
                • " ) + .append( $( "
                  " ).text( item.label ) ) + .appendTo( ul ); }, _move: function( direction, event ) { @@ -575,11 +605,29 @@ $.widget( "ui.autocomplete", { if ( !this.isMultiLine || this.menu.element.is( ":visible" ) ) { this._move( keyEvent, event ); - // prevents moving cursor to beginning/end of the text field in some browsers + // Prevents moving cursor to beginning/end of the text field in some browsers event.preventDefault(); } + }, + + // Support: Chrome <=50 + // We should be able to just use this.element.prop( "isContentEditable" ) + // but hidden elements always report false in Chrome. + // https://code.google.com/p/chromium/issues/detail?id=313082 + _isContentEditable: function( element ) { + if ( !element.length ) { + return false; + } + + var editable = element.prop( "contentEditable" ); + + if ( editable === "inherit" ) { + return this._isContentEditable( element.parent() ); + } + + return editable === "true"; } -}); +} ); $.extend( $.ui.autocomplete, { escapeRegex: function( value ) { @@ -589,11 +637,11 @@ $.extend( $.ui.autocomplete, { var matcher = new RegExp( $.ui.autocomplete.escapeRegex( term ), "i" ); return $.grep( array, function( value ) { return matcher.test( value.label || value.value || value ); - }); + } ); } -}); +} ); -// live region extension, adding a `messages` option +// Live region extension, adding a `messages` option // NOTE: This is an experimental API. We are still investigating // a full solution for string manipulation and internationalization. $.widget( "ui.autocomplete", $.ui.autocomplete, { @@ -618,11 +666,13 @@ $.widget( "ui.autocomplete", $.ui.autocomplete, { } else { message = this.options.messages.noResults; } - this.liveRegion.children().hide(); - $( "
                  " ).text( message ).appendTo( this.liveRegion ); + clearTimeout( this.liveRegionTimer ); + this.liveRegionTimer = this._delay( function() { + this.liveRegion.html( $( "
                  " ).text( message ) ); + }, 100 ); } -}); +} ); return $.ui.autocomplete; -})); +} ); diff --git a/include/thirdparty/jquery_ui/button.js b/include/thirdparty/jquery_ui/button.js index 171b679..7365210 100644 --- a/include/thirdparty/jquery_ui/button.js +++ b/include/thirdparty/jquery_ui/button.js @@ -1,411 +1,449 @@ /*! - * jQuery UI Button 1.11.4 + * jQuery UI Button @VERSION * http://jqueryui.com * - * Copyright jQuery Foundation and other contributors + * Copyright OpenJS Foundation and other contributors * Released under the MIT license. * http://jquery.org/license - * - * http://api.jqueryui.com/button/ */ -(function( factory ) { + +//>>label: Button +//>>group: Widgets +//>>description: Enhances a form with themeable buttons. +//>>docs: http://api.jqueryui.com/button/ +//>>demos: http://jqueryui.com/button/ +//>>css.structure: ../../themes/base/core.css +//>>css.structure: ../../themes/base/button.css +//>>css.theme: ../../themes/base/theme.css + +( function( factory ) { + "use strict"; + if ( typeof define === "function" && define.amd ) { // AMD. Register as an anonymous module. - define([ + define( [ "jquery", - "./core", - "./widget" + + // These are only for backcompat + // TODO: Remove after 1.12 + "./controlgroup", + "./checkboxradio", + + "../keycode", + "../widget" ], factory ); } else { // Browser globals factory( jQuery ); } -}(function( $ ) { - -var lastActive, - baseClasses = "ui-button ui-widget ui-state-default ui-corner-all", - typeClasses = "ui-button-icons-only ui-button-icon-only ui-button-text-icons ui-button-text-icon-primary ui-button-text-icon-secondary ui-button-text-only", - formResetHandler = function() { - var form = $( this ); - setTimeout(function() { - form.find( ":ui-button" ).button( "refresh" ); - }, 1 ); - }, - radioGroup = function( radio ) { - var name = radio.name, - form = radio.form, - radios = $( [] ); - if ( name ) { - name = name.replace( /'/g, "\\'" ); - if ( form ) { - radios = $( form ).find( "[name='" + name + "'][type=radio]" ); - } else { - radios = $( "[name='" + name + "'][type=radio]", radio.ownerDocument ) - .filter(function() { - return !this.form; - }); - } - } - return radios; - }; +} )( function( $ ) { +"use strict"; $.widget( "ui.button", { - version: "1.11.4", + version: "@VERSION", defaultElement: "").addClass(this._triggerClass). - html(!buttonImage ? buttonText : $("").attr( - { src:buttonImage, alt:buttonText, title:buttonText }))); - input[isRTL ? "before" : "after"](inst.trigger); - inst.trigger.click(function() { - if ($.datepicker._datepickerShowing && $.datepicker._lastInput === input[0]) { - $.datepicker._hideDatepicker(); - } else if ($.datepicker._datepickerShowing && $.datepicker._lastInput !== input[0]) { - $.datepicker._hideDatepicker(); - $.datepicker._showDatepicker(input[0]); + if ( showOn === "button" || showOn === "both" ) { // pop-up date picker when button clicked + buttonText = this._get( inst, "buttonText" ); + buttonImage = this._get( inst, "buttonImage" ); + + if ( this._get( inst, "buttonImageOnly" ) ) { + inst.trigger = $( "" ) + .addClass( this._triggerClass ) + .attr( { + src: buttonImage, + alt: buttonText, + title: buttonText + } ); + } else { + inst.trigger = $( "" : ""); + controls = ""; + if ( !inst.inline ) { + controls = $( "" : "") + (isRTL ? "" : controls) + "
                  " : ""; + buttonPanel = ""; + if ( showButtonPanel ) { + buttonPanel = $( "
                  " ) + .append( isRTL ? controls : "" ) + .append( this._isInRange( inst, gotoDate ) ? + $( "
                  " + + ( ( numMonths[ 0 ] > 0 && col === numMonths[ 1 ] - 1 ) ? "
                  " : "" ) : "" ); group += calender; } html += group; @@ -1805,60 +1956,63 @@ $.extend(Datepicker.prototype, { }, /* Generate the month and year header. */ - _generateMonthYearHeader: function(inst, drawMonth, drawYear, minDate, maxDate, - secondary, monthNames, monthNamesShort) { + _generateMonthYearHeader: function( inst, drawMonth, drawYear, minDate, maxDate, + secondary, monthNames, monthNamesShort ) { var inMinYear, inMaxYear, month, years, thisYear, determineYear, year, endYear, - changeMonth = this._get(inst, "changeMonth"), - changeYear = this._get(inst, "changeYear"), - showMonthAfterYear = this._get(inst, "showMonthAfterYear"), + changeMonth = this._get( inst, "changeMonth" ), + changeYear = this._get( inst, "changeYear" ), + showMonthAfterYear = this._get( inst, "showMonthAfterYear" ), + selectMonthLabel = this._get( inst, "selectMonthLabel" ), + selectYearLabel = this._get( inst, "selectYearLabel" ), html = "
                  ", monthHtml = ""; - // month selection - if (secondary || !changeMonth) { - monthHtml += "" + monthNames[drawMonth] + ""; + // Month selection + if ( secondary || !changeMonth ) { + monthHtml += "" + monthNames[ drawMonth ] + ""; } else { - inMinYear = (minDate && minDate.getFullYear() === drawYear); - inMaxYear = (maxDate && maxDate.getFullYear() === drawYear); - monthHtml += ""; + for ( month = 0; month < 12; month++ ) { + if ( ( !inMinYear || month >= minDate.getMonth() ) && ( !inMaxYear || month <= maxDate.getMonth() ) ) { monthHtml += ""; + ( month === drawMonth ? " selected='selected'" : "" ) + + ">" + monthNamesShort[ month ] + ""; } } monthHtml += ""; } - if (!showMonthAfterYear) { - html += monthHtml + (secondary || !(changeMonth && changeYear) ? " " : ""); + if ( !showMonthAfterYear ) { + html += monthHtml + ( secondary || !( changeMonth && changeYear ) ? " " : "" ); } - // year selection + // Year selection if ( !inst.yearshtml ) { inst.yearshtml = ""; - if (secondary || !changeYear) { + if ( secondary || !changeYear ) { html += "" + drawYear + ""; } else { + // determine range of years to display - years = this._get(inst, "yearRange").split(":"); + years = this._get( inst, "yearRange" ).split( ":" ); thisYear = new Date().getFullYear(); - determineYear = function(value) { - var year = (value.match(/c[+\-].*/) ? drawYear + parseInt(value.substring(1), 10) : - (value.match(/[+\-].*/) ? thisYear + parseInt(value, 10) : - parseInt(value, 10))); - return (isNaN(year) ? thisYear : year); + determineYear = function( value ) { + var year = ( value.match( /c[+\-].*/ ) ? drawYear + parseInt( value.substring( 1 ), 10 ) : + ( value.match( /[+\-].*/ ) ? thisYear + parseInt( value, 10 ) : + parseInt( value, 10 ) ) ); + return ( isNaN( year ) ? thisYear : year ); }; - year = determineYear(years[0]); - endYear = Math.max(year, determineYear(years[1] || "")); - year = (minDate ? Math.max(year, minDate.getFullYear()) : year); - endYear = (maxDate ? Math.min(endYear, maxDate.getFullYear()) : endYear); - inst.yearshtml += ""; + for ( ; year <= endYear; year++ ) { inst.yearshtml += ""; } inst.yearshtml += ""; @@ -1868,168 +2022,168 @@ $.extend(Datepicker.prototype, { } } - html += this._get(inst, "yearSuffix"); - if (showMonthAfterYear) { - html += (secondary || !(changeMonth && changeYear) ? " " : "") + monthHtml; + html += this._get( inst, "yearSuffix" ); + if ( showMonthAfterYear ) { + html += ( secondary || !( changeMonth && changeYear ) ? " " : "" ) + monthHtml; } html += "
                  "; // Close datepicker_header return html; }, /* Adjust one of the date sub-fields. */ - _adjustInstDate: function(inst, offset, period) { - var year = inst.drawYear + (period === "Y" ? offset : 0), - month = inst.drawMonth + (period === "M" ? offset : 0), - day = Math.min(inst.selectedDay, this._getDaysInMonth(year, month)) + (period === "D" ? offset : 0), - date = this._restrictMinMax(inst, this._daylightSavingAdjust(new Date(year, month, day))); + _adjustInstDate: function( inst, offset, period ) { + var year = inst.selectedYear + ( period === "Y" ? offset : 0 ), + month = inst.selectedMonth + ( period === "M" ? offset : 0 ), + day = Math.min( inst.selectedDay, this._getDaysInMonth( year, month ) ) + ( period === "D" ? offset : 0 ), + date = this._restrictMinMax( inst, this._daylightSavingAdjust( new Date( year, month, day ) ) ); inst.selectedDay = date.getDate(); inst.drawMonth = inst.selectedMonth = date.getMonth(); inst.drawYear = inst.selectedYear = date.getFullYear(); - if (period === "M" || period === "Y") { - this._notifyChange(inst); + if ( period === "M" || period === "Y" ) { + this._notifyChange( inst ); } }, /* Ensure a date is within any min/max bounds. */ - _restrictMinMax: function(inst, date) { - var minDate = this._getMinMaxDate(inst, "min"), - maxDate = this._getMinMaxDate(inst, "max"), - newDate = (minDate && date < minDate ? minDate : date); - return (maxDate && newDate > maxDate ? maxDate : newDate); + _restrictMinMax: function( inst, date ) { + var minDate = this._getMinMaxDate( inst, "min" ), + maxDate = this._getMinMaxDate( inst, "max" ), + newDate = ( minDate && date < minDate ? minDate : date ); + return ( maxDate && newDate > maxDate ? maxDate : newDate ); }, /* Notify change of month/year. */ - _notifyChange: function(inst) { - var onChange = this._get(inst, "onChangeMonthYear"); - if (onChange) { - onChange.apply((inst.input ? inst.input[0] : null), - [inst.selectedYear, inst.selectedMonth + 1, inst]); + _notifyChange: function( inst ) { + var onChange = this._get( inst, "onChangeMonthYear" ); + if ( onChange ) { + onChange.apply( ( inst.input ? inst.input[ 0 ] : null ), + [ inst.selectedYear, inst.selectedMonth + 1, inst ] ); } }, /* Determine the number of months to show. */ - _getNumberOfMonths: function(inst) { - var numMonths = this._get(inst, "numberOfMonths"); - return (numMonths == null ? [1, 1] : (typeof numMonths === "number" ? [1, numMonths] : numMonths)); + _getNumberOfMonths: function( inst ) { + var numMonths = this._get( inst, "numberOfMonths" ); + return ( numMonths == null ? [ 1, 1 ] : ( typeof numMonths === "number" ? [ 1, numMonths ] : numMonths ) ); }, /* Determine the current maximum date - ensure no time components are set. */ - _getMinMaxDate: function(inst, minMax) { - return this._determineDate(inst, this._get(inst, minMax + "Date"), null); + _getMinMaxDate: function( inst, minMax ) { + return this._determineDate( inst, this._get( inst, minMax + "Date" ), null ); }, /* Find the number of days in a given month. */ - _getDaysInMonth: function(year, month) { - return 32 - this._daylightSavingAdjust(new Date(year, month, 32)).getDate(); + _getDaysInMonth: function( year, month ) { + return 32 - this._daylightSavingAdjust( new Date( year, month, 32 ) ).getDate(); }, /* Find the day of the week of the first of a month. */ - _getFirstDayOfMonth: function(year, month) { - return new Date(year, month, 1).getDay(); + _getFirstDayOfMonth: function( year, month ) { + return new Date( year, month, 1 ).getDay(); }, /* Determines if we should allow a "next/prev" month display change. */ - _canAdjustMonth: function(inst, offset, curYear, curMonth) { - var numMonths = this._getNumberOfMonths(inst), - date = this._daylightSavingAdjust(new Date(curYear, - curMonth + (offset < 0 ? offset : numMonths[0] * numMonths[1]), 1)); + _canAdjustMonth: function( inst, offset, curYear, curMonth ) { + var numMonths = this._getNumberOfMonths( inst ), + date = this._daylightSavingAdjust( new Date( curYear, + curMonth + ( offset < 0 ? offset : numMonths[ 0 ] * numMonths[ 1 ] ), 1 ) ); - if (offset < 0) { - date.setDate(this._getDaysInMonth(date.getFullYear(), date.getMonth())); + if ( offset < 0 ) { + date.setDate( this._getDaysInMonth( date.getFullYear(), date.getMonth() ) ); } - return this._isInRange(inst, date); + return this._isInRange( inst, date ); }, /* Is the given date in the accepted range? */ - _isInRange: function(inst, date) { + _isInRange: function( inst, date ) { var yearSplit, currentYear, - minDate = this._getMinMaxDate(inst, "min"), - maxDate = this._getMinMaxDate(inst, "max"), + minDate = this._getMinMaxDate( inst, "min" ), + maxDate = this._getMinMaxDate( inst, "max" ), minYear = null, maxYear = null, - years = this._get(inst, "yearRange"); - if (years){ - yearSplit = years.split(":"); + years = this._get( inst, "yearRange" ); + if ( years ) { + yearSplit = years.split( ":" ); currentYear = new Date().getFullYear(); - minYear = parseInt(yearSplit[0], 10); - maxYear = parseInt(yearSplit[1], 10); - if ( yearSplit[0].match(/[+\-].*/) ) { + minYear = parseInt( yearSplit[ 0 ], 10 ); + maxYear = parseInt( yearSplit[ 1 ], 10 ); + if ( yearSplit[ 0 ].match( /[+\-].*/ ) ) { minYear += currentYear; } - if ( yearSplit[1].match(/[+\-].*/) ) { + if ( yearSplit[ 1 ].match( /[+\-].*/ ) ) { maxYear += currentYear; } } - return ((!minDate || date.getTime() >= minDate.getTime()) && - (!maxDate || date.getTime() <= maxDate.getTime()) && - (!minYear || date.getFullYear() >= minYear) && - (!maxYear || date.getFullYear() <= maxYear)); + return ( ( !minDate || date.getTime() >= minDate.getTime() ) && + ( !maxDate || date.getTime() <= maxDate.getTime() ) && + ( !minYear || date.getFullYear() >= minYear ) && + ( !maxYear || date.getFullYear() <= maxYear ) ); }, /* Provide the configuration settings for formatting/parsing. */ - _getFormatConfig: function(inst) { - var shortYearCutoff = this._get(inst, "shortYearCutoff"); - shortYearCutoff = (typeof shortYearCutoff !== "string" ? shortYearCutoff : - new Date().getFullYear() % 100 + parseInt(shortYearCutoff, 10)); - return {shortYearCutoff: shortYearCutoff, - dayNamesShort: this._get(inst, "dayNamesShort"), dayNames: this._get(inst, "dayNames"), - monthNamesShort: this._get(inst, "monthNamesShort"), monthNames: this._get(inst, "monthNames")}; + _getFormatConfig: function( inst ) { + var shortYearCutoff = this._get( inst, "shortYearCutoff" ); + shortYearCutoff = ( typeof shortYearCutoff !== "string" ? shortYearCutoff : + new Date().getFullYear() % 100 + parseInt( shortYearCutoff, 10 ) ); + return { shortYearCutoff: shortYearCutoff, + dayNamesShort: this._get( inst, "dayNamesShort" ), dayNames: this._get( inst, "dayNames" ), + monthNamesShort: this._get( inst, "monthNamesShort" ), monthNames: this._get( inst, "monthNames" ) }; }, /* Format the given date for display. */ - _formatDate: function(inst, day, month, year) { - if (!day) { + _formatDate: function( inst, day, month, year ) { + if ( !day ) { inst.currentDay = inst.selectedDay; inst.currentMonth = inst.selectedMonth; inst.currentYear = inst.selectedYear; } - var date = (day ? (typeof day === "object" ? day : - this._daylightSavingAdjust(new Date(year, month, day))) : - this._daylightSavingAdjust(new Date(inst.currentYear, inst.currentMonth, inst.currentDay))); - return this.formatDate(this._get(inst, "dateFormat"), date, this._getFormatConfig(inst)); + var date = ( day ? ( typeof day === "object" ? day : + this._daylightSavingAdjust( new Date( year, month, day ) ) ) : + this._daylightSavingAdjust( new Date( inst.currentYear, inst.currentMonth, inst.currentDay ) ) ); + return this.formatDate( this._get( inst, "dateFormat" ), date, this._getFormatConfig( inst ) ); } -}); +} ); /* * Bind hover events for datepicker elements. * Done via delegate so the binding only occurs once in the lifetime of the parent div. * Global datepicker_instActive, set by _updateDatepicker allows the handlers to find their way back to the active picker. */ -function datepicker_bindHover(dpDiv) { +function datepicker_bindHover( dpDiv ) { var selector = "button, .ui-datepicker-prev, .ui-datepicker-next, .ui-datepicker-calendar td a"; - return dpDiv.delegate(selector, "mouseout", function() { - $(this).removeClass("ui-state-hover"); - if (this.className.indexOf("ui-datepicker-prev") !== -1) { - $(this).removeClass("ui-datepicker-prev-hover"); + return dpDiv.on( "mouseout", selector, function() { + $( this ).removeClass( "ui-state-hover" ); + if ( this.className.indexOf( "ui-datepicker-prev" ) !== -1 ) { + $( this ).removeClass( "ui-datepicker-prev-hover" ); } - if (this.className.indexOf("ui-datepicker-next") !== -1) { - $(this).removeClass("ui-datepicker-next-hover"); + if ( this.className.indexOf( "ui-datepicker-next" ) !== -1 ) { + $( this ).removeClass( "ui-datepicker-next-hover" ); } - }) - .delegate( selector, "mouseover", datepicker_handleMouseover ); + } ) + .on( "mouseover", selector, datepicker_handleMouseover ); } function datepicker_handleMouseover() { - if (!$.datepicker._isDisabledDatepicker( datepicker_instActive.inline? datepicker_instActive.dpDiv.parent()[0] : datepicker_instActive.input[0])) { - $(this).parents(".ui-datepicker-calendar").find("a").removeClass("ui-state-hover"); - $(this).addClass("ui-state-hover"); - if (this.className.indexOf("ui-datepicker-prev") !== -1) { - $(this).addClass("ui-datepicker-prev-hover"); + if ( !$.datepicker._isDisabledDatepicker( datepicker_instActive.inline ? datepicker_instActive.dpDiv.parent()[ 0 ] : datepicker_instActive.input[ 0 ] ) ) { + $( this ).parents( ".ui-datepicker-calendar" ).find( "a" ).removeClass( "ui-state-hover" ); + $( this ).addClass( "ui-state-hover" ); + if ( this.className.indexOf( "ui-datepicker-prev" ) !== -1 ) { + $( this ).addClass( "ui-datepicker-prev-hover" ); } - if (this.className.indexOf("ui-datepicker-next") !== -1) { - $(this).addClass("ui-datepicker-next-hover"); + if ( this.className.indexOf( "ui-datepicker-next" ) !== -1 ) { + $( this ).addClass( "ui-datepicker-next-hover" ); } } } /* jQuery extend now ignores nulls! */ -function datepicker_extendRemove(target, props) { - $.extend(target, props); - for (var name in props) { - if (props[name] == null) { - target[name] = props[name]; +function datepicker_extendRemove( target, props ) { + $.extend( target, props ); + for ( var name in props ) { + if ( props[ name ] == null ) { + target[ name ] = props[ name ]; } } return target; @@ -2039,7 +2193,7 @@ function datepicker_extendRemove(target, props) { @param options string - a command, optionally followed by additional parameters or Object - settings for attaching new datepicker functionality @return jQuery object */ -$.fn.datepicker = function(options){ +$.fn.datepicker = function( options ) { /* Verify an empty collection wasn't passed - Fixes #6976 */ if ( !this.length ) { @@ -2047,38 +2201,40 @@ $.fn.datepicker = function(options){ } /* Initialise the date picker. */ - if (!$.datepicker.initialized) { - $(document).mousedown($.datepicker._checkExternalClick); + if ( !$.datepicker.initialized ) { + $( document ).on( "mousedown", $.datepicker._checkExternalClick ); $.datepicker.initialized = true; } /* Append datepicker main container to body if not exist. */ - if ($("#"+$.datepicker._mainDivId).length === 0) { - $("body").append($.datepicker.dpDiv); + if ( $( "#" + $.datepicker._mainDivId ).length === 0 ) { + $( "body" ).append( $.datepicker.dpDiv ); } - var otherArgs = Array.prototype.slice.call(arguments, 1); - if (typeof options === "string" && (options === "isDisabled" || options === "getDate" || options === "widget")) { - return $.datepicker["_" + options + "Datepicker"]. - apply($.datepicker, [this[0]].concat(otherArgs)); + var otherArgs = Array.prototype.slice.call( arguments, 1 ); + if ( typeof options === "string" && ( options === "isDisabled" || options === "getDate" || options === "widget" ) ) { + return $.datepicker[ "_" + options + "Datepicker" ]. + apply( $.datepicker, [ this[ 0 ] ].concat( otherArgs ) ); } - if (options === "option" && arguments.length === 2 && typeof arguments[1] === "string") { - return $.datepicker["_" + options + "Datepicker"]. - apply($.datepicker, [this[0]].concat(otherArgs)); + if ( options === "option" && arguments.length === 2 && typeof arguments[ 1 ] === "string" ) { + return $.datepicker[ "_" + options + "Datepicker" ]. + apply( $.datepicker, [ this[ 0 ] ].concat( otherArgs ) ); } - return this.each(function() { - typeof options === "string" ? - $.datepicker["_" + options + "Datepicker"]. - apply($.datepicker, [this].concat(otherArgs)) : - $.datepicker._attachDatepicker(this, options); - }); + return this.each( function() { + if ( typeof options === "string" ) { + $.datepicker[ "_" + options + "Datepicker" ] + .apply( $.datepicker, [ this ].concat( otherArgs ) ); + } else { + $.datepicker._attachDatepicker( this, options ); + } + } ); }; $.datepicker = new Datepicker(); // singleton instance $.datepicker.initialized = false; $.datepicker.uuid = new Date().getTime(); -$.datepicker.version = "1.11.4"; +$.datepicker.version = "@VERSION"; return $.datepicker; -})); +} ); diff --git a/include/thirdparty/jquery_ui/dialog.js b/include/thirdparty/jquery_ui/dialog.js index 2f978be..4dcb93a 100644 --- a/include/thirdparty/jquery_ui/dialog.js +++ b/include/thirdparty/jquery_ui/dialog.js @@ -1,43 +1,63 @@ /*! - * jQuery UI Dialog 1.11.4 + * jQuery UI Dialog @VERSION * http://jqueryui.com * - * Copyright jQuery Foundation and other contributors + * Copyright OpenJS Foundation and other contributors * Released under the MIT license. * http://jquery.org/license - * - * http://api.jqueryui.com/dialog/ */ -(function( factory ) { + +//>>label: Dialog +//>>group: Widgets +//>>description: Displays customizable dialog windows. +//>>docs: http://api.jqueryui.com/dialog/ +//>>demos: http://jqueryui.com/dialog/ +//>>css.structure: ../../themes/base/core.css +//>>css.structure: ../../themes/base/dialog.css +//>>css.theme: ../../themes/base/theme.css + +( function( factory ) { + "use strict"; + if ( typeof define === "function" && define.amd ) { // AMD. Register as an anonymous module. - define([ + define( [ "jquery", - "./core", - "./widget", "./button", "./draggable", "./mouse", - "./position", - "./resizable" + "./resizable", + "../focusable", + "../keycode", + "../position", + "../safe-active-element", + "../safe-blur", + "../tabbable", + "../unique-id", + "../version", + "../widget" ], factory ); } else { // Browser globals factory( jQuery ); } -}(function( $ ) { +} )( function( $ ) { +"use strict"; -return $.widget( "ui.dialog", { - version: "1.11.4", +$.widget( "ui.dialog", { + version: "@VERSION", options: { appendTo: "body", autoOpen: true, buttons: [], + classes: { + "ui-dialog": "ui-corner-all", + "ui-dialog-titlebar": "ui-corner-all" + }, closeOnEscape: true, closeText: "Close", - dialogClass: "", draggable: true, hide: null, height: "auto", @@ -51,6 +71,7 @@ return $.widget( "ui.dialog", { at: "center", of: window, collision: "fit", + // Ensure the titlebar is always visible using: function( pos ) { var topOffset = $( this ).css( pos ).offset().top; @@ -64,7 +85,7 @@ return $.widget( "ui.dialog", { title: null, width: 300, - // callbacks + // Callbacks beforeClose: null, close: null, drag: null, @@ -107,16 +128,24 @@ return $.widget( "ui.dialog", { index: this.element.parent().children().index( this.element ) }; this.originalTitle = this.element.attr( "title" ); - this.options.title = this.options.title || this.originalTitle; + if ( this.options.title == null && this.originalTitle != null ) { + this.options.title = this.originalTitle; + } + + // Dialogs can't be disabled + if ( this.options.disabled ) { + this.options.disabled = false; + } this._createWrapper(); this.element .show() .removeAttr( "title" ) - .addClass( "ui-dialog-content ui-widget-content" ) .appendTo( this.uiDialog ); + this._addClass( "ui-dialog-content", "ui-widget-content" ); + this._createTitlebar(); this._createButtonPane(); @@ -140,7 +169,7 @@ return $.widget( "ui.dialog", { _appendTo: function() { var element = this.options.appendTo; - if ( element && (element.jquery || element.nodeType) ) { + if ( element && ( element.jquery || element.nodeType ) ) { return $( element ); } return this.document.find( element || "body" ).eq( 0 ); @@ -155,18 +184,19 @@ return $.widget( "ui.dialog", { this.element .removeUniqueId() - .removeClass( "ui-dialog-content ui-widget-content" ) .css( this.originalCss ) + // Without detaching first, the following becomes really slow .detach(); - this.uiDialog.stop( true, true ).remove(); + this.uiDialog.remove(); if ( this.originalTitle ) { this.element.attr( "title", this.originalTitle ); } next = originalPosition.parent.children().eq( originalPosition.index ); + // Don't try to place the dialog next to itself (#8613) if ( next.length && next[ 0 ] !== this.element[ 0 ] ) { next.before( this.element ); @@ -183,8 +213,7 @@ return $.widget( "ui.dialog", { enable: $.noop, close: function( event ) { - var activeElement, - that = this; + var that = this; if ( !this._isOpen || this._trigger( "beforeClose", event ) === false ) { return; @@ -195,28 +224,17 @@ return $.widget( "ui.dialog", { this._destroyOverlay(); this._untrackInstance(); - if ( !this.opener.filter( ":focusable" ).focus().length ) { + if ( !this.opener.filter( ":focusable" ).trigger( "focus" ).length ) { - // support: IE9 - // IE9 throws an "Unspecified error" accessing document.activeElement from an