{"version":3,"sources":["webpack:///./node_modules/@ckeditor/ckeditor5-core/src/multicommand.js","webpack:///./node_modules/@ckeditor/ckeditor5-core/src/pendingactions.js"],"names":["Command","PendingActions","this","set","_actions","Collection","idProperty","delegate","to","message","CKEditorError","action","Object","create","ObservableMixin","add","hasAny","remove","length","get","Symbol","iterator","ContextPlugin"],"mappings":";;;;GAkC0CA;;;;OCoBrBC,6JAWpB,WAQCC,KAAKC,IAAK,UAAU,GAQpBD,KAAKE,SAAW,IAAIC,QAAcC,WAAY,QAC9CJ,KAAKE,SAASG,SAAU,MAAO,UAAWC,GAAIN,yBAY/C,SAAKO,GACJ,GAAwB,kBAAZA,EAMX,MAAM,IAAIC,OAAe,qCAAsCR,MAGhE,IAAMS,EAASC,OAAOC,OAAQC,QAM9B,OAJAH,EAAOR,IAAK,UAAWM,GACvBP,KAAKE,SAASW,IAAKJ,GACnBT,KAAKc,QAAS,EAEPL,wBAQR,SAAQA,GACPT,KAAKE,SAASa,OAAQN,GACtBT,KAAKc,SAAWd,KAAKE,SAASc,0BAQ/B,WACC,OAAOhB,KAAKE,SAASe,IAAK,kBAQ3B,WACC,OAAOjB,KAAKE,SAAUgB,OAAOC,sCAhF9B,WACC,MAAO,wBALmCC,OAmFzCF,OAAOC","file":"js/chunk-140a8592.289d0bbb.js","sourcesContent":["/**\n * @license Copyright (c) 2003-2021, CKSource - Frederico Knabben. All rights reserved.\n * For licensing, see LICENSE.md or https://ckeditor.com/legal/ckeditor-oss-license\n */\n\nimport Command from './command';\n\n/**\n * @module core/multicommand\n */\n\n/**\n * A CKEditor command that aggregates other commands.\n *\n * This command is used to proxy multiple commands. The multi-command is enabled when\n * at least one of its registered child commands is enabled.\n * When executing a multi-command the first command that is enabled will be executed.\n *\n *\t\tconst multiCommand = new MultiCommand( editor );\n *\n *\t\tconst commandFoo = new Command( editor );\n *\t\tconst commandBar = new Command( editor );\n *\n *\t\t// Register child commands.\n *\t\tmultiCommand.registerChildCommand( commandFoo );\n *\t\tmultiCommand.registerChildCommand( commandBar );\n *\n *\t\t// Enable one of the commands.\n *\t\tcommandBar.isEnabled = true;\n *\n *\t\tmultiCommand.execute(); // Will execute commandBar.\n *\n * @extends module:core/command~Command\n */\nexport default class MultiCommand extends Command {\n\t/**\n\t * @inheritDoc\n\t */\n\tconstructor( editor ) {\n\t\tsuper( editor );\n\n\t\t/**\n\t\t * Registered child commands.\n\t\t *\n\t\t * @type {Array.}\n\t\t * @private\n\t\t */\n\t\tthis._childCommands = [];\n\t}\n\n\t/**\n\t * @inheritDoc\n\t */\n\trefresh() {\n\t\t// Override base command refresh(): the command's state is changed when one of child commands changes states.\n\t}\n\n\t/**\n\t * Executes the first of it registered child commands.\n\t *\n\t * @returns {*} The value returned by the {@link module:core/command~Command#execute `command.execute()`}.\n\t */\n\texecute( ...args ) {\n\t\tconst command = this._getFirstEnabledCommand();\n\n\t\treturn command != null && command.execute( args );\n\t}\n\n\t/**\n\t * Registers a child command.\n\t *\n\t * @param {module:core/command~Command} command\n\t */\n\tregisterChildCommand( command ) {\n\t\tthis._childCommands.push( command );\n\n\t\t// Change multi command enabled state when one of registered commands changes state.\n\t\tcommand.on( 'change:isEnabled', () => this._checkEnabled() );\n\n\t\tthis._checkEnabled();\n\t}\n\n\t/**\n\t * Checks if any of child commands is enabled.\n\t *\n\t * @private\n\t */\n\t_checkEnabled() {\n\t\tthis.isEnabled = !!this._getFirstEnabledCommand();\n\t}\n\n\t/**\n\t * Returns a first enabled command or undefined if none of them is enabled.\n\t *\n\t * @returns {module:core/command~Command|undefined}\n\t * @private\n\t */\n\t_getFirstEnabledCommand() {\n\t\treturn this._childCommands.find( command => command.isEnabled );\n\t}\n}\n","/**\n * @license Copyright (c) 2003-2021, CKSource - Frederico Knabben. All rights reserved.\n * For licensing, see LICENSE.md or https://ckeditor.com/legal/ckeditor-oss-license\n */\n\n/**\n * @module core/pendingactions\n */\n\nimport ContextPlugin from './contextplugin';\nimport ObservableMixin from '@ckeditor/ckeditor5-utils/src/observablemixin';\nimport Collection from '@ckeditor/ckeditor5-utils/src/collection';\nimport CKEditorError from '@ckeditor/ckeditor5-utils/src/ckeditorerror';\n\n/**\n * The list of pending editor actions.\n *\n * This plugin should be used to synchronise plugins that execute long-lasting actions\n * (e.g. file upload) with the editor integration. It gives the developer who integrates the editor\n * an easy way to check if there are any actions pending whenever such information is needed.\n * All plugins that register a pending action also provide a message about the action that is ongoing\n * which can be displayed to the user. This lets them decide if they want to interrupt the action or wait.\n *\n * Adding and updating a pending action:\n *\n * \t\tconst pendingActions = editor.plugins.get( 'PendingActions' );\n * \t\tconst action = pendingActions.add( 'Upload in progress: 0%.' );\n *\n *\t\t// You can update the message:\n * \t\taction.message = 'Upload in progress: 10%.';\n *\n * Removing a pending action:\n *\n * \t\tconst pendingActions = editor.plugins.get( 'PendingActions' );\n * \t\tconst action = pendingActions.add( 'Unsaved changes.' );\n *\n * \t\tpendingActions.remove( action );\n *\n * Getting pending actions:\n *\n * \t\tconst pendingActions = editor.plugins.get( 'PendingActions' );\n *\n * \t\tconst action1 = pendingActions.add( 'Action 1' );\n * \t\tconst action2 = pendingActions.add( 'Action 2' );\n *\n * \t\tpendingActions.first; // Returns action1\n * \t\tArray.from( pendingActions ); // Returns [ action1, action2 ]\n *\n * This plugin is used by features like {@link module:upload/filerepository~FileRepository} to register their ongoing actions\n * and by features like {@link module:autosave/autosave~Autosave} to detect whether there are any ongoing actions.\n * Read more about saving the data in the {@glink builds/guides/integration/saving-data Saving and getting data} guide.\n *\n * @extends module:core/contextplugin~ContextPlugin\n */\nexport default class PendingActions extends ContextPlugin {\n\t/**\n\t * @inheritDoc\n\t */\n\tstatic get pluginName() {\n\t\treturn 'PendingActions';\n\t}\n\n\t/**\n\t * @inheritDoc\n\t */\n\tinit() {\n\t\t/**\n\t\t * Defines whether there is any registered pending action.\n\t\t *\n\t\t * @readonly\n\t\t * @observable\n\t\t * @member {Boolean} #hasAny\n\t\t */\n\t\tthis.set( 'hasAny', false );\n\n\t\t/**\n\t\t * A list of pending actions.\n\t\t *\n\t\t * @private\n\t\t * @type {module:utils/collection~Collection}\n\t\t */\n\t\tthis._actions = new Collection( { idProperty: '_id' } );\n\t\tthis._actions.delegate( 'add', 'remove' ).to( this );\n\t}\n\n\t/**\n\t * Adds an action to the list of pending actions.\n\t *\n\t * This method returns an action object with an observable message property.\n\t * The action object can be later used in the {@link #remove} method. It also allows you to change the message.\n\t *\n\t * @param {String} message The action message.\n\t * @returns {Object} An observable object that represents a pending action.\n\t */\n\tadd( message ) {\n\t\tif ( typeof message !== 'string' ) {\n\t\t\t/**\n\t\t\t * The message must be a string.\n\t\t\t *\n\t\t\t * @error pendingactions-add-invalid-message\n\t\t\t */\n\t\t\tthrow new CKEditorError( 'pendingactions-add-invalid-message', this );\n\t\t}\n\n\t\tconst action = Object.create( ObservableMixin );\n\n\t\taction.set( 'message', message );\n\t\tthis._actions.add( action );\n\t\tthis.hasAny = true;\n\n\t\treturn action;\n\t}\n\n\t/**\n\t * Removes an action from the list of pending actions.\n\t *\n\t * @param {Object} action An action object.\n\t */\n\tremove( action ) {\n\t\tthis._actions.remove( action );\n\t\tthis.hasAny = !!this._actions.length;\n\t}\n\n\t/**\n\t * Returns the first action from the list or null when list is empty\n\t *\n\t * returns {Object|null} The pending action object.\n\t */\n\tget first() {\n\t\treturn this._actions.get( 0 );\n\t}\n\n\t/**\n\t * Iterable interface.\n\t *\n\t * @returns {Iterable.<*>}\n\t */\n\t[ Symbol.iterator ]() {\n\t\treturn this._actions[ Symbol.iterator ]();\n\t}\n\n\t/**\n\t * Fired when an action is added to the list.\n\t *\n\t * @event add\n\t * @param {Object} action The added action.\n\t */\n\n\t/**\n\t * Fired when an action is removed from the list.\n\t *\n\t * @event remove\n\t * @param {Object} action The removed action.\n\t */\n}\n"],"sourceRoot":""}