diff --git a/lib/editor/tiny/plugins/collaborative/amd/build/collaborater.min.js b/lib/editor/tiny/plugins/collaborative/amd/build/collaborater.min.js index d4516305d6eee..6e507f323a194 100644 --- a/lib/editor/tiny/plugins/collaborative/amd/build/collaborater.min.js +++ b/lib/editor/tiny/plugins/collaborative/amd/build/collaborater.min.js @@ -1,10 +1,10 @@ -define("tiny_collaborative/collaborater",["exports","./jsdiff/index","core/ajax","./options"],(function(_exports,jsDiff,_ajax,Options){function _getRequireWildcardCache(nodeInterop){if("function"!=typeof WeakMap)return null;var cacheBabelInterop=new WeakMap,cacheNodeInterop=new WeakMap;return(_getRequireWildcardCache=function(nodeInterop){return nodeInterop?cacheNodeInterop:cacheBabelInterop})(nodeInterop)}function _interopRequireWildcard(obj,nodeInterop){if(!nodeInterop&&obj&&obj.__esModule)return obj;if(null===obj||"object"!=typeof obj&&"function"!=typeof obj)return{default:obj};var cache=_getRequireWildcardCache(nodeInterop);if(cache&&cache.has(obj))return cache.get(obj);var newObj={},hasPropertyDescriptor=Object.defineProperty&&Object.getOwnPropertyDescriptor;for(var key in obj)if("default"!==key&&Object.prototype.hasOwnProperty.call(obj,key)){var desc=hasPropertyDescriptor?Object.getOwnPropertyDescriptor(obj,key):null;desc&&(desc.get||desc.set)?Object.defineProperty(newObj,key,desc):newObj[key]=obj[key]}return newObj.default=obj,cache&&cache.set(obj,newObj),newObj} +define("tiny_collaborative/collaborater",["exports","./jsdiff/index","core/ajax","./options"],(function(_exports,jsDiff,_ajax,Options){function _getRequireWildcardCache(e){if("function"!=typeof WeakMap)return null;var r=new WeakMap,t=new WeakMap;return(_getRequireWildcardCache=function(e){return e?t:r})(e)}function _interopRequireWildcard(e,r){if(!r&&e&&e.__esModule)return e;if(null===e||"object"!=typeof e&&"function"!=typeof e)return{default:e};var t=_getRequireWildcardCache(r);if(t&&t.has(e))return t.get(e);var n={__proto__:null},a=Object.defineProperty&&Object.getOwnPropertyDescriptor;for(var u in e)if("default"!==u&&{}.hasOwnProperty.call(e,u)){var i=a?Object.getOwnPropertyDescriptor(e,u):null;i&&(i.get||i.set)?Object.defineProperty(n,u,i):n[u]=e[u]}return n.default=e,t&&t.set(e,n),n /** * Storage helper for the Moodle Tiny Autosave plugin. * * @module tiny_autosave/autosaver * @copyright 2022 Andrew Lyons * @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later - */Object.defineProperty(_exports,"__esModule",{value:!0}),_exports.register=void 0,jsDiff=_interopRequireWildcard(jsDiff),Options=_interopRequireWildcard(Options);let currentContent="",currentHash="",newHash="";const HEADER="Index: a\n===================================================================\n",fetchOne=(methodname,args)=>(0,_ajax.call)([{methodname:methodname,args:args}])[0];async function sha1(message){const data=(new TextEncoder).encode(message),hashBuffer=await crypto.subtle.digest("SHA-1",data);return Array.from(new Uint8Array(hashBuffer)).map((byte=>byte.toString(16).padStart(2,"0"))).join("")}_exports.register=editor=>{const c=window.console;editor.on("init",(()=>{let status_bar_element=document.createElement("p");const txt=document.createTextNode("Collaboratiny initialized.");status_bar_element.appendChild(txt),editor.getElement().nextElementSibling.getElementsByClassName("tox-statusbar__right-container")[0].prepend(status_bar_element);let x=0;setInterval((()=>{const newContent=editor.getContent();if(sha1(newContent).then((hash=>{if(newHash=hash,""===currentHash)return currentContent=newContent,void(currentHash=newHash);if(newHash!==currentHash){let patch=jsDiff.createPatch("a",currentContent,newContent);return patch=patch.substring(HEADER.length),fetchOne("tiny_collaborate_save_changes",{contextid:Options.getContextId(editor),elementid:editor.targetElm.id,oldcontenthash:currentHash,newcontenthash:newHash,changes:patch}).then((result=>(currentContent=newContent,currentHash=newHash,result)))}})),""===currentHash)return;let newContent2=editor.getContent();fetchOne("tiny_collaborate_get_changes",{contextid:Options.getContextId(editor),elementid:editor.targetElm.id,currenthash:currentHash}).then((result=>{if(status_bar_element.innerText="Counter "+x++,c.log(status_bar_element),c.log("HAAAAALLO"),result){let changesMade=!1;const changes=result.changes;for(let change in changes){c.log("shorthcange",change);let patch=HEADER+change;c.log("changes",patch),c.log("parsedPatch",jsDiff.parsePatch(patch)),newContent2=jsDiff.applyPatch(newContent2,patch),changesMade=!0}changesMade&&(!1===newContent2?c.log("Patch FAILED"):(c.log("newContent2",newContent2),editor.setContent(newContent2),currentContent=newContent2,sha1(newContent2).then((hash=>{currentHash=hash,c.log("new hash",currentHash)}))))}}))}),1e3)}))}})); + */}Object.defineProperty(_exports,"__esModule",{value:!0}),_exports.register=void 0,jsDiff=_interopRequireWildcard(jsDiff),Options=_interopRequireWildcard(Options);let currentContent="",currentHash="",newHash="";const HEADER="Index: a\n===================================================================\n",fetchOne=(methodname,args)=>(0,_ajax.call)([{methodname:methodname,args:args}])[0];async function sha1(message){const data=(new TextEncoder).encode(message),hashBuffer=await crypto.subtle.digest("SHA-1",data);return Array.from(new Uint8Array(hashBuffer)).map((byte=>byte.toString(16).padStart(2,"0"))).join("")}_exports.register=editor=>{const c=window.console;editor.on("init",(()=>{let status_bar_element=document.createElement("p");const txt=document.createTextNode("Collaboratiny initialized.");status_bar_element.appendChild(txt),editor.getElement().nextElementSibling.getElementsByClassName("tox-statusbar__right-container")[0].prepend(status_bar_element);let x=0;setInterval((()=>{const newContent=editor.getContent();if(sha1(newContent).then((hash=>{if(newHash=hash,""===currentHash)return currentContent=newContent,void(currentHash=newHash);if(newHash!==currentHash){let patch=jsDiff.createPatch("a",currentContent,newContent);return patch=patch.substring(77),fetchOne("tiny_collaborate_save_changes",{contextid:Options.getContextId(editor),elementid:editor.targetElm.id,oldcontenthash:currentHash,newcontenthash:newHash,changes:patch}).then((result=>(currentContent=newContent,currentHash=newHash,result)))}})),""===currentHash)return;let newContent2=editor.getContent();fetchOne("tiny_collaborate_get_changes",{contextid:Options.getContextId(editor),elementid:editor.targetElm.id,currenthash:currentHash}).then((result=>{if(status_bar_element.innerText="Counter "+x++,c.log(status_bar_element),result){let changesMade=!1;const changes=result.changes;for(let change in changes){c.log("shorthcange",change);let patch=HEADER+change;c.log("changes",patch),c.log("parsedPatch",jsDiff.parsePatch(patch)),newContent2=jsDiff.applyPatch(newContent2,patch),changesMade=!0}changesMade&&(!1===newContent2?c.log("Patch FAILED"):(c.log("newContent2",newContent2),editor.setContent(newContent2),currentContent=newContent2,sha1(newContent2).then((hash=>{currentHash=hash,c.log("new hash",currentHash)}))))}}))}),1e3)}))}})); //# sourceMappingURL=collaborater.min.js.map \ No newline at end of file diff --git a/lib/editor/tiny/plugins/collaborative/amd/build/collaborater.min.js.map b/lib/editor/tiny/plugins/collaborative/amd/build/collaborater.min.js.map index 6e98311ca63ba..bb32194f8de80 100644 --- a/lib/editor/tiny/plugins/collaborative/amd/build/collaborater.min.js.map +++ b/lib/editor/tiny/plugins/collaborative/amd/build/collaborater.min.js.map @@ -1 +1 @@ -{"version":3,"file":"collaborater.min.js","sources":["../src/collaborater.js"],"sourcesContent":["// This file is part of Moodle - http://moodle.org/\n//\n// Moodle is free software: you can redistribute it and/or modify\n// it under the terms of the GNU General Public License as published by\n// the Free Software Foundation, either version 3 of the License, or\n// (at your option) any later version.\n//\n// Moodle is distributed in the hope that it will be useful,\n// but WITHOUT ANY WARRANTY; without even the implied warranty of\n// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the\n// GNU General Public License for more details.\n//\n// You should have received a copy of the GNU General Public License\n// along with Moodle. If not, see .\n\n/**\n * Storage helper for the Moodle Tiny Autosave plugin.\n *\n * @module tiny_autosave/autosaver\n * @copyright 2022 Andrew Lyons \n * @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later\n */\n\n//import * as Options from './options';\n//import * as Storage from './storage';mm\n//import Log from 'core/log';\n//import {eventTypes} from 'core_form/events';\n//import {getLogSource} from './common';\nimport * as jsDiff from './jsdiff/index';\nimport {call} from 'core/ajax';\nimport * as Options from \"./options\";\n\n\nlet currentContent = '';\nlet currentHash = '';\nlet newHash = '';\n//let newContent = '';\n//let lastHash = '';\nconst INTERVALTIMEOUT = 1000;\nconst HEADER = \"Index: a\\n===================================================================\\n\";\n\nconst fetchOne = (methodname, args) => call([{\n methodname,\n args,\n}])[0];\nlet intervalId = null;\n\nasync function sha1(message) {\n const encoder = new TextEncoder();\n const data = encoder.encode(message);\n const hashBuffer = await crypto.subtle.digest('SHA-1', data);\n const hashArray = Array.from(new Uint8Array(hashBuffer));\n const hashHex = hashArray.map(byte => byte.toString(16).padStart(2, '0')).join('');\n return hashHex;\n}\n\n// Example usage:\nconst insertCursorMarker = (editor) => {\n const markerId = 'cursor-marker-' + new Date().getTime();\n editor.selection.collapse();\n editor.selection.setContent(``);\n return markerId;\n};\nconst restoreCursorPositionFromMarker = (editor, markerId) => {\n const markerElement = editor.getBody().querySelector(`#${markerId}`);\n if (markerElement) {\n const range = editor.dom.createRng();\n range.setStartAfter(markerElement);\n range.collapse(true);\n editor.selection.setRng(range);\n editor.dom.remove(markerElement); // Clean up marker\n // editor.focus();\n } else {\n // Fallback if marker not found\n // editor.focus();\n editor.selection.select(editor.getBody(), true);\n editor.selection.collapse(false);\n }\n};\n\n\nexport const register = (editor) => {\n // Attempt to store the draft one final time before the page unloads.\n // Note: This may need to be sent as a beacon instead.\n // document.addEventListener('visibilitychange', visibilityChangedHandler);\n\n // When the page is submitted as a form, remove the draft.\n // editor.on('submit', removeAutoSaveSession);\n // document.addEventListener(eventTypes.formSubmittedByJavascript, handleFormSubmittedByJavascript);\n const c = window.console;\n editor.on('init', () => {\n let status_bar_element = document.createElement(\"p\");\n const txt = document.createTextNode(\"Collaboratiny initialized.\");\n status_bar_element.appendChild(txt);\n\n editor\n .getElement()\n .nextElementSibling\n .getElementsByClassName(\"tox-statusbar__right-container\")[0]\n .prepend(status_bar_element);\n\n let x = 0;\n setInterval(() => {\n const newContent = editor.getContent();\n sha1(newContent).then(hash => {\n newHash = hash;\n if (currentHash === '') {\n currentContent = newContent;\n currentHash = newHash;\n return;\n }\n if (newHash !== currentHash) {\n let patch = jsDiff.createPatch('a', currentContent, newContent);\n patch = patch.substring(HEADER.length);\n /* c.log('contextid', Options.getContextId(editor));\n c.log('pagehash', Options.getPageHash(editor));\n c.log('pageinstance', Options.getPageInstance(editor));\n c.log('elementid', editor.targetElm.id);\n c.log('oldcontenthash', currentHash);\n c.log('newcontenthash', newHash);\n c.log('changes', patch);*/\n return fetchOne('tiny_collaborate_save_changes', {\n contextid: Options.getContextId(editor),\n //pageinstance: Options.getPageInstance(editor),\n elementid: editor.targetElm.id,\n /*drftid: Options.getDraftItemId(editor),*/\n oldcontenthash: currentHash,\n newcontenthash: newHash,\n changes: patch,\n\n })\n .then((result) => {\n //* pendingPromise.resolve();\n // c.log('new hash', newHash);\n // c.log('diff', patch);\n currentContent = newContent;\n currentHash = newHash;\n return result;\n });\n }\n });\n if (currentHash === '') {\n return;\n }\n\n let newContent2 = editor.getContent();\n fetchOne('tiny_collaborate_get_changes', {\n contextid: Options.getContextId(editor),\n elementid: editor.targetElm.id,\n currenthash: currentHash,\n }).then((result) => {\n status_bar_element.innerText = \"Counter \" + x++;\n c.log(status_bar_element);\n c.log(\"HAAAAALLO\");\n if (result) {\n let changesMade = false;\n const changes = result.changes;\n for (let change in changes) {\n c.log('shorthcange', change);\n let patch = HEADER + change;\n c.log('changes', patch);\n c.log('parsedPatch', jsDiff.parsePatch(patch));\n newContent2 = jsDiff.applyPatch(newContent2, patch);\n changesMade = true;\n }\n if (changesMade) {\n if (newContent2 === false) {\n c.log('Patch FAILED');\n } else {\n c.log('newContent2', newContent2);\n editor.setContent(newContent2);\n currentContent = newContent2;\n sha1(newContent2).then(hash => {\n currentHash = hash;\n c.log('new hash', currentHash);\n });\n }\n }\n //clearInterval(intervalId);\n }\n\n // restoreCursorPositionFromMarker(editor, markerId);\n });\n\n }, INTERVALTIMEOUT);\n\n /*editor.on('Change', (event) => {\n c.log('Change collaborative', event);\n });*/\n // Setup the Undo handler.\n //editor.on('AddUndo', undoHandler);\n\n /* if (editor.dom.isEmpty(editor.getBody())) {\n Log.info(`Attempting to restore draft`, getLogSource(editor));\n Storage.restoreDraft(editor);\n } else {\n // There was nothing to restore, so we can mark the editor as initialised.\n Log.warn(`Skipping draft restoration. The editor is not empty.`, getLogSource(editor));\n Options.markInitialised(editor);\n }*/\n });\n};\n"],"names":["currentContent","currentHash","newHash","HEADER","fetchOne","methodname","args","sha1","message","data","TextEncoder","encode","hashBuffer","crypto","subtle","digest","Array","from","Uint8Array","map","byte","toString","padStart","join","editor","c","window","console","on","status_bar_element","document","createElement","txt","createTextNode","appendChild","getElement","nextElementSibling","getElementsByClassName","prepend","x","setInterval","newContent","getContent","then","hash","patch","jsDiff","createPatch","substring","length","contextid","Options","getContextId","elementid","targetElm","id","oldcontenthash","newcontenthash","changes","result","newContent2","currenthash","innerText","log","changesMade","change","parsePatch","applyPatch","setContent"],"mappings":";;;;;;;0KAiCIA,eAAiB,GACjBC,YAAc,GACdC,QAAU,SAIRC,OAAS,kFAETC,SAAW,CAACC,WAAYC,QAAS,cAAK,CAAC,CACzCD,WAAAA,WACAC,KAAAA,QACA,kBAGWC,KAAKC,eAEVC,MADU,IAAIC,aACCC,OAAOH,SACtBI,iBAAmBC,OAAOC,OAAOC,OAAO,QAASN,aACrCO,MAAMC,KAAK,IAAIC,WAAWN,aAClBO,KAAIC,MAAQA,KAAKC,SAAS,IAAIC,SAAS,EAAG,OAAMC,KAAK,sBA6B1DC,eAQfC,EAAIC,OAAOC,QACjBH,OAAOI,GAAG,QAAQ,SACVC,mBAAqBC,SAASC,cAAc,WAC1CC,IAAMF,SAASG,eAAe,8BACpCJ,mBAAmBK,YAAYF,KAE/BR,OACKW,aACAC,mBACAC,uBAAuB,kCAAkC,GACzDC,QAAQT,wBAETU,EAAI,EACRC,aAAY,WACFC,WAAajB,OAAOkB,gBAC1BnC,KAAKkC,YAAYE,MAAKC,UAClB1C,QAAU0C,KACU,KAAhB3C,mBACAD,eAAiByC,gBACjBxC,YAAcC,YAGdA,UAAYD,YAAa,KACrB4C,MAAQC,OAAOC,YAAY,IAAK/C,eAAgByC,mBACpDI,MAAQA,MAAMG,UAAU7C,OAAO8C,QAQxB7C,SAAS,gCAAiC,CAC7C8C,UAAWC,QAAQC,aAAa5B,QAEhC6B,UAAW7B,OAAO8B,UAAUC,GAE5BC,eAAgBvD,YAChBwD,eAAgBvD,QAChBwD,QAASb,QAGZF,MAAMgB,SAIH3D,eAAiByC,WACjBxC,YAAcC,QACPyD,cAIC,KAAhB1D,uBAIA2D,YAAcpC,OAAOkB,aACzBtC,SAAS,+BAAgC,CACrC8C,UAAWC,QAAQC,aAAa5B,QAChC6B,UAAW7B,OAAO8B,UAAUC,GAC5BM,YAAa5D,cACd0C,MAAMgB,YACL9B,mBAAmBiC,UAAY,WAAavB,IAC5Cd,EAAEsC,IAAIlC,oBACNJ,EAAEsC,IAAI,aACFJ,OAAQ,KACJK,aAAc,QACZN,QAAUC,OAAOD,YAClB,IAAIO,UAAUP,QAAS,CACxBjC,EAAEsC,IAAI,cAAeE,YACjBpB,MAAQ1C,OAAS8D,OACrBxC,EAAEsC,IAAI,UAAWlB,OACjBpB,EAAEsC,IAAI,cAAejB,OAAOoB,WAAWrB,QACvCe,YAAcd,OAAOqB,WAAWP,YAAaf,OAC7CmB,aAAc,EAEdA,eACoB,IAAhBJ,YACAnC,EAAEsC,IAAI,iBAENtC,EAAEsC,IAAI,cAAeH,aACrBpC,OAAO4C,WAAWR,aAClB5D,eAAiB4D,YACjBrD,KAAKqD,aAAajB,MAAKC,OACnB3C,YAAc2C,KACdnB,EAAEsC,IAAI,WAAY9D,wBAxI1B"} \ No newline at end of file +{"version":3,"file":"collaborater.min.js","sources":["../src/collaborater.js"],"sourcesContent":["// This file is part of Moodle - http://moodle.org/\n//\n// Moodle is free software: you can redistribute it and/or modify\n// it under the terms of the GNU General Public License as published by\n// the Free Software Foundation, either version 3 of the License, or\n// (at your option) any later version.\n//\n// Moodle is distributed in the hope that it will be useful,\n// but WITHOUT ANY WARRANTY; without even the implied warranty of\n// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the\n// GNU General Public License for more details.\n//\n// You should have received a copy of the GNU General Public License\n// along with Moodle. If not, see .\n\n/**\n * Storage helper for the Moodle Tiny Autosave plugin.\n *\n * @module tiny_autosave/autosaver\n * @copyright 2022 Andrew Lyons \n * @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later\n */\n\n//import * as Options from './options';\n//import * as Storage from './storage';mm\n//import Log from 'core/log';\n//import {eventTypes} from 'core_form/events';\n//import {getLogSource} from './common';\nimport * as jsDiff from './jsdiff/index';\nimport {call} from 'core/ajax';\nimport * as Options from \"./options\";\n\n\nlet currentContent = '';\nlet currentHash = '';\nlet newHash = '';\n//let newContent = '';\n//let lastHash = '';\nconst INTERVALTIMEOUT = 1000;\nconst HEADER = \"Index: a\\n===================================================================\\n\";\n\nconst fetchOne = (methodname, args) => call([{\n methodname,\n args,\n}])[0];\nlet intervalId = null;\n\nasync function sha1(message) {\n const encoder = new TextEncoder();\n const data = encoder.encode(message);\n const hashBuffer = await crypto.subtle.digest('SHA-1', data);\n const hashArray = Array.from(new Uint8Array(hashBuffer));\n const hashHex = hashArray.map(byte => byte.toString(16).padStart(2, '0')).join('');\n return hashHex;\n}\n\n// Example usage:\nconst insertCursorMarker = (editor) => {\n const markerId = 'cursor-marker-' + new Date().getTime();\n editor.selection.collapse();\n editor.selection.setContent(``);\n return markerId;\n};\nconst restoreCursorPositionFromMarker = (editor, markerId) => {\n const markerElement = editor.getBody().querySelector(`#${markerId}`);\n if (markerElement) {\n const range = editor.dom.createRng();\n range.setStartAfter(markerElement);\n range.collapse(true);\n editor.selection.setRng(range);\n editor.dom.remove(markerElement); // Clean up marker\n // editor.focus();\n } else {\n // Fallback if marker not found\n // editor.focus();\n editor.selection.select(editor.getBody(), true);\n editor.selection.collapse(false);\n }\n};\n\n\nexport const register = (editor) => {\n // Attempt to store the draft one final time before the page unloads.\n // Note: This may need to be sent as a beacon instead.\n // document.addEventListener('visibilitychange', visibilityChangedHandler);\n\n // When the page is submitted as a form, remove the draft.\n // editor.on('submit', removeAutoSaveSession);\n // document.addEventListener(eventTypes.formSubmittedByJavascript, handleFormSubmittedByJavascript);\n const c = window.console;\n editor.on('init', () => {\n let status_bar_element = document.createElement(\"p\");\n const txt = document.createTextNode(\"Collaboratiny initialized.\");\n status_bar_element.appendChild(txt);\n\n editor\n .getElement()\n .nextElementSibling\n .getElementsByClassName(\"tox-statusbar__right-container\")[0]\n .prepend(status_bar_element);\n\n let x = 0;\n setInterval(() => {\n const newContent = editor.getContent();\n sha1(newContent).then(hash => {\n newHash = hash;\n if (currentHash === '') {\n currentContent = newContent;\n currentHash = newHash;\n return;\n }\n if (newHash !== currentHash) {\n let patch = jsDiff.createPatch('a', currentContent, newContent);\n patch = patch.substring(HEADER.length);\n /* c.log('contextid', Options.getContextId(editor));\n c.log('pagehash', Options.getPageHash(editor));\n c.log('pageinstance', Options.getPageInstance(editor));\n c.log('elementid', editor.targetElm.id);\n c.log('oldcontenthash', currentHash);\n c.log('newcontenthash', newHash);\n c.log('changes', patch);*/\n return fetchOne('tiny_collaborate_save_changes', {\n contextid: Options.getContextId(editor),\n //pageinstance: Options.getPageInstance(editor),\n elementid: editor.targetElm.id,\n /*drftid: Options.getDraftItemId(editor),*/\n oldcontenthash: currentHash,\n newcontenthash: newHash,\n changes: patch,\n\n })\n .then((result) => {\n //* pendingPromise.resolve();\n // c.log('new hash', newHash);\n // c.log('diff', patch);\n currentContent = newContent;\n currentHash = newHash;\n return result;\n });\n }\n });\n if (currentHash === '') {\n return;\n }\n\n let newContent2 = editor.getContent();\n fetchOne('tiny_collaborate_get_changes', {\n contextid: Options.getContextId(editor),\n elementid: editor.targetElm.id,\n currenthash: currentHash,\n }).then((result) => {\n status_bar_element.innerText = \"Counter \" + x++;\n c.log(status_bar_element);\n if (result) {\n let changesMade = false;\n const changes = result.changes;\n for (let change in changes) {\n c.log('shorthcange', change);\n let patch = HEADER + change;\n c.log('changes', patch);\n c.log('parsedPatch', jsDiff.parsePatch(patch));\n newContent2 = jsDiff.applyPatch(newContent2, patch);\n changesMade = true;\n }\n if (changesMade) {\n if (newContent2 === false) {\n c.log('Patch FAILED');\n } else {\n c.log('newContent2', newContent2);\n editor.setContent(newContent2);\n currentContent = newContent2;\n sha1(newContent2).then(hash => {\n currentHash = hash;\n c.log('new hash', currentHash);\n });\n }\n }\n //clearInterval(intervalId);\n }\n\n // restoreCursorPositionFromMarker(editor, markerId);\n });\n\n }, INTERVALTIMEOUT);\n\n /*editor.on('Change', (event) => {\n c.log('Change collaborative', event);\n });*/\n // Setup the Undo handler.\n //editor.on('AddUndo', undoHandler);\n\n /* if (editor.dom.isEmpty(editor.getBody())) {\n Log.info(`Attempting to restore draft`, getLogSource(editor));\n Storage.restoreDraft(editor);\n } else {\n // There was nothing to restore, so we can mark the editor as initialised.\n Log.warn(`Skipping draft restoration. The editor is not empty.`, getLogSource(editor));\n Options.markInitialised(editor);\n }*/\n });\n};\n"],"names":["_getRequireWildcardCache","e","WeakMap","r","t","_interopRequireWildcard","__esModule","default","has","get","n","__proto__","a","Object","defineProperty","getOwnPropertyDescriptor","u","hasOwnProperty","call","i","set","jsDiff","Options","currentContent","currentHash","newHash","HEADER","fetchOne","methodname","args","async","sha1","message","data","TextEncoder","encode","hashBuffer","crypto","subtle","digest","Array","from","Uint8Array","map","byte","toString","padStart","join","_exports","register","editor","c","window","console","on","status_bar_element","document","createElement","txt","createTextNode","appendChild","getElement","nextElementSibling","getElementsByClassName","prepend","x","setInterval","newContent","getContent","then","hash","patch","createPatch","substring","contextid","getContextId","elementid","targetElm","id","oldcontenthash","newcontenthash","changes","result","newContent2","currenthash","innerText","log","changesMade","change","parsePatch","applyPatch","setContent"],"mappings":"uIA8BqC,SAAAA,yBAAAC,GAAA,GAAA,mBAAAC,QAAA,OAAA,KAAA,IAAAC,EAAAD,IAAAA,QAAAE,EAAAF,IAAAA,eAAAF,yBAAA,SAAAC,GAAAA,OAAAA,EAAAG,EAAAD,IAAAF,EAAA,CAAA,SAAAI,wBAAAJ,EAAAE,GAAAA,IAAAA,GAAAF,GAAAA,EAAAK,WAAA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,WAAY9D,YAAY,KAK9C,IAGF,GA/IU,IAiJG,GAgBrB,CACJ"} \ No newline at end of file diff --git a/lib/editor/tiny/plugins/collaborative/amd/build/commands.min.js.map b/lib/editor/tiny/plugins/collaborative/amd/build/commands.min.js.map index 4fddf717bd859..c7013a526e8f0 100644 --- a/lib/editor/tiny/plugins/collaborative/amd/build/commands.min.js.map +++ b/lib/editor/tiny/plugins/collaborative/amd/build/commands.min.js.map @@ -1 +1 @@ -{"version":3,"file":"commands.min.js","sources":["../src/commands.js"],"sourcesContent":["/**\n * Handle the action for your plugin.\n * @param {TinyMCE.editor} editor The tinyMCE editor instance.\n */\nconst handleAction = (editor) => {\n // TODO Handle the action.\n window.console.log(editor);\n};\n\nexport const getSetup = async() => {\n return (editor) => {\n // Register the startdemo Toolbar Button.\n editor.ui.registry.addButton(\"Toggle collaborative\", {\n tooltip: \"Toggle collaborative\",\n onAction: () => handleAction(editor),\n });\n };\n};"],"names":["async","editor","ui","registry","addButton","tooltip","onAction","window","console","log","handleAction"],"mappings":"wKASwBA,SACZC,SAEJA,OAAOC,GAAGC,SAASC,UAAU,uBAAwB,CACjDC,QAAS,uBACTC,SAAU,IAVAL,CAAAA,SAElBM,OAAOC,QAAQC,IAAIR,SAQKS,CAAaT"} \ No newline at end of file +{"version":3,"file":"commands.min.js","sources":["../src/commands.js"],"sourcesContent":["/**\n * Handle the action for your plugin.\n * @param {TinyMCE.editor} editor The tinyMCE editor instance.\n */\nconst handleAction = (editor) => {\n // TODO Handle the action.\n window.console.log(editor);\n};\n\nexport const getSetup = async() => {\n return (editor) => {\n // Register the startdemo Toolbar Button.\n editor.ui.registry.addButton(\"Toggle collaborative\", {\n tooltip: \"Toggle collaborative\",\n onAction: () => handleAction(editor),\n });\n };\n};"],"names":["_exports","getSetup","async","editor","ui","registry","addButton","tooltip","onAction","window","console","log","handleAction"],"mappings":"sJAiBEA,SAAAC,SARsBC,SACZC,SAEJA,OAAOC,GAAGC,SAASC,UAAU,uBAAwB,CACjDC,QAAS,uBACTC,SAAUA,IAVAL,UAElBM,OAAOC,QAAQC,IAAIR,OAAO,EAQFS,CAAaT,SAC/B,CAER"} \ No newline at end of file diff --git a/lib/editor/tiny/plugins/collaborative/amd/build/common.min.js b/lib/editor/tiny/plugins/collaborative/amd/build/common.min.js index f7256e5a74338..51a1b06811cb9 100644 --- a/lib/editor/tiny/plugins/collaborative/amd/build/common.min.js +++ b/lib/editor/tiny/plugins/collaborative/amd/build/common.min.js @@ -1,3 +1,3 @@ -define("tiny_collaborative/common",["exports"],(function(_exports){Object.defineProperty(_exports,"__esModule",{value:!0}),_exports.default=void 0;var _default={component:"tiny_collaborative",pluginName:"".concat("tiny_collaborative","/plugin")};return _exports.default=_default,_exports.default})); +define("tiny_collaborative/common",["exports"],(function(_exports){Object.defineProperty(_exports,"__esModule",{value:!0}),_exports.default=void 0;_exports.default={component:"tiny_collaborative",pluginName:"tiny_collaborative/plugin"};return _exports.default})); //# sourceMappingURL=common.min.js.map \ No newline at end of file diff --git a/lib/editor/tiny/plugins/collaborative/amd/build/common.min.js.map b/lib/editor/tiny/plugins/collaborative/amd/build/common.min.js.map index b23c43ad31162..105cd7532984a 100644 --- a/lib/editor/tiny/plugins/collaborative/amd/build/common.min.js.map +++ b/lib/editor/tiny/plugins/collaborative/amd/build/common.min.js.map @@ -1 +1 @@ -{"version":3,"file":"common.min.js","sources":["../src/common.js"],"sourcesContent":["const component = 'tiny_collaborative';\n\nexport default {\n component,\n pluginName: `${component}/plugin`\n};"],"names":["component","pluginName"],"mappings":"gKAEe,CACXA,UAHc,qBAIdC,qBAJc"} \ No newline at end of file +{"version":3,"file":"common.min.js","sources":["../src/common.js"],"sourcesContent":["const component = 'tiny_collaborative';\n\nexport default {\n component,\n pluginName: `${component}/plugin`\n};"],"names":["_exports","default","component","pluginName"],"mappings":"mJAAuCA,SAAAC,QAExB,CACXC,UAHc,qBAIdC,WAAY,6BACf,OAAAH,SAAAC,OAAA"} \ No newline at end of file diff --git a/lib/editor/tiny/plugins/collaborative/amd/build/configuration.min.js.map b/lib/editor/tiny/plugins/collaborative/amd/build/configuration.min.js.map index 1dfea9c9a8148..a5d7d7bdf9547 100644 --- a/lib/editor/tiny/plugins/collaborative/amd/build/configuration.min.js.map +++ b/lib/editor/tiny/plugins/collaborative/amd/build/configuration.min.js.map @@ -1 +1 @@ -{"version":3,"file":"configuration.min.js","sources":["../src/configuration.js"],"sourcesContent":["\nexport const configure = () => {\n return {};\n};"],"names":[],"mappings":"+KACyB,KACd"} \ No newline at end of file +{"version":3,"file":"configuration.min.js","sources":["../src/configuration.js"],"sourcesContent":["\nexport const configure = () => {\n return {};\n};"],"names":["_exports","configure"],"mappings":"4JAGEA,SAAAC,UAFuBA,KACd,GACT"} \ No newline at end of file diff --git a/lib/editor/tiny/plugins/collaborative/amd/build/jsdiff/convert/dmp.min.js.map b/lib/editor/tiny/plugins/collaborative/amd/build/jsdiff/convert/dmp.min.js.map index 67a38ac800406..7bde1e281efb8 100644 --- a/lib/editor/tiny/plugins/collaborative/amd/build/jsdiff/convert/dmp.min.js.map +++ b/lib/editor/tiny/plugins/collaborative/amd/build/jsdiff/convert/dmp.min.js.map @@ -1 +1 @@ -{"version":3,"file":"dmp.min.js","sources":["../../../src/jsdiff/convert/dmp.js"],"sourcesContent":["// See: http://code.google.com/p/google-diff-match-patch/wiki/API\nexport function convertChangesToDMP(changes) {\n let ret = [],\n change,\n operation;\n for (let i = 0; i < changes.length; i++) {\n change = changes[i];\n if (change.added) {\n operation = 1;\n } else if (change.removed) {\n operation = -1;\n } else {\n operation = 0;\n }\n\n ret.push([operation, change.value]);\n }\n return ret;\n}\n"],"names":["changes","change","operation","ret","i","length","added","removed","push","value"],"mappings":"6KACoCA,aAE9BC,OACAC,UAFAC,IAAM,OAGL,IAAIC,EAAI,EAAGA,EAAIJ,QAAQK,OAAQD,IAClCH,OAASD,QAAQI,GAEfF,UADED,OAAOK,MACG,EACHL,OAAOM,SACH,EAED,EAGdJ,IAAIK,KAAK,CAACN,UAAWD,OAAOQ,eAEvBN"} \ No newline at end of file +{"version":3,"file":"dmp.min.js","sources":["../../../src/jsdiff/convert/dmp.js"],"sourcesContent":["// See: http://code.google.com/p/google-diff-match-patch/wiki/API\nexport function convertChangesToDMP(changes) {\n let ret = [],\n change,\n operation;\n for (let i = 0; i < changes.length; i++) {\n change = changes[i];\n if (change.added) {\n operation = 1;\n } else if (change.removed) {\n operation = -1;\n } else {\n operation = 0;\n }\n\n ret.push([operation, change.value]);\n }\n return ret;\n}\n"],"names":["changes","change","operation","ret","i","length","added","removed","push","value"],"mappings":"oKACO,SAA6BA,SAClC,IACIC,OACAC,UAFAC,IAAM,GAGV,IAAK,IAAIC,EAAI,EAAGA,EAAIJ,QAAQK,OAAQD,IAClCH,OAASD,QAAQI,GAEfF,UADED,OAAOK,MACG,EACHL,OAAOM,SACH,EAED,EAGdJ,IAAIK,KAAK,CAACN,UAAWD,OAAOQ,QAE9B,OAAON,GACT,CAAC"} \ No newline at end of file diff --git a/lib/editor/tiny/plugins/collaborative/amd/build/jsdiff/convert/xml.min.js.map b/lib/editor/tiny/plugins/collaborative/amd/build/jsdiff/convert/xml.min.js.map index f8a9a96adedd5..8350d93455d89 100644 --- a/lib/editor/tiny/plugins/collaborative/amd/build/jsdiff/convert/xml.min.js.map +++ b/lib/editor/tiny/plugins/collaborative/amd/build/jsdiff/convert/xml.min.js.map @@ -1 +1 @@ -{"version":3,"file":"xml.min.js","sources":["../../../src/jsdiff/convert/xml.js"],"sourcesContent":["export function convertChangesToXML(changes) {\n let ret = [];\n for (let i = 0; i < changes.length; i++) {\n let change = changes[i];\n if (change.added) {\n ret.push('');\n } else if (change.removed) {\n ret.push('');\n }\n\n ret.push(escapeHTML(change.value));\n\n if (change.added) {\n ret.push('');\n } else if (change.removed) {\n ret.push('');\n }\n }\n return ret.join('');\n}\n\nfunction escapeHTML(s) {\n let n = s;\n n = n.replace(/&/g, '&');\n n = n.replace(//g, '>');\n n = n.replace(/\"/g, '"');\n\n return n;\n}\n"],"names":["escapeHTML","s","n","replace","changes","ret","i","length","change","added","push","removed","value","join"],"mappings":"wFAqBSA,WAAWC,OACdC,EAAID,SACRC,EAAIA,EAAEC,QAAQ,KAAM,SACpBD,EAAIA,EAAEC,QAAQ,KAAM,QACpBD,EAAIA,EAAEC,QAAQ,KAAM,QACpBD,EAAIA,EAAEC,QAAQ,KAAM,UAEbD,gGA5B2BE,aAC9BC,IAAM,OACL,IAAIC,EAAI,EAAGA,EAAIF,QAAQG,OAAQD,IAAK,KACnCE,OAASJ,QAAQE,GACjBE,OAAOC,MACTJ,IAAIK,KAAK,SACAF,OAAOG,SAChBN,IAAIK,KAAK,SAGXL,IAAIK,KAAKV,WAAWQ,OAAOI,QAEvBJ,OAAOC,MACTJ,IAAIK,KAAK,UACAF,OAAOG,SAChBN,IAAIK,KAAK,iBAGNL,IAAIQ,KAAK"} \ No newline at end of file +{"version":3,"file":"xml.min.js","sources":["../../../src/jsdiff/convert/xml.js"],"sourcesContent":["export function convertChangesToXML(changes) {\n let ret = [];\n for (let i = 0; i < changes.length; i++) {\n let change = changes[i];\n if (change.added) {\n ret.push('');\n } else if (change.removed) {\n ret.push('');\n }\n\n ret.push(escapeHTML(change.value));\n\n if (change.added) {\n ret.push('');\n } else if (change.removed) {\n ret.push('');\n }\n }\n return ret.join('');\n}\n\nfunction escapeHTML(s) {\n let n = s;\n n = n.replace(/&/g, '&');\n n = n.replace(//g, '>');\n n = n.replace(/\"/g, '"');\n\n return n;\n}\n"],"names":["escapeHTML","s","n","replace","changes","ret","i","length","change","added","push","removed","value","join"],"mappings":"+EAqBA,SAASA,WAAWC,GAClB,IAAIC,EAAID,EAMR,OALAC,EAAIA,EAAEC,QAAQ,KAAM,SACpBD,EAAIA,EAAEC,QAAQ,KAAM,QACpBD,EAAIA,EAAEC,QAAQ,KAAM,QACpBD,EAAIA,EAAEC,QAAQ,KAAM,UAEbD,CACT,sFA7BO,SAA6BE,SAClC,IAAIC,IAAM,GACV,IAAK,IAAIC,EAAI,EAAGA,EAAIF,QAAQG,OAAQD,IAAK,CACvC,IAAIE,OAASJ,QAAQE,GACjBE,OAAOC,MACTJ,IAAIK,KAAK,SACAF,OAAOG,SAChBN,IAAIK,KAAK,SAGXL,IAAIK,KAAKV,WAAWQ,OAAOI,QAEvBJ,OAAOC,MACTJ,IAAIK,KAAK,UACAF,OAAOG,SAChBN,IAAIK,KAAK,SAEb,CACA,OAAOL,IAAIQ,KAAK,GAClB,CAUC"} \ No newline at end of file diff --git a/lib/editor/tiny/plugins/collaborative/amd/build/jsdiff/diff/array.min.js b/lib/editor/tiny/plugins/collaborative/amd/build/jsdiff/diff/array.min.js index 0440a8be531dc..35ce89882d019 100644 --- a/lib/editor/tiny/plugins/collaborative/amd/build/jsdiff/diff/array.min.js +++ b/lib/editor/tiny/plugins/collaborative/amd/build/jsdiff/diff/array.min.js @@ -1,3 +1,3 @@ -define("tiny_collaborative/jsdiff/diff/array",["exports","./base"],(function(_exports,_base){var obj;Object.defineProperty(_exports,"__esModule",{value:!0}),_exports.arrayDiff=void 0,_exports.diffArrays=function(oldArr,newArr,callback){return arrayDiff.diff(oldArr,newArr,callback)};const arrayDiff=new(_base=(obj=_base)&&obj.__esModule?obj:{default:obj}).default;_exports.arrayDiff=arrayDiff,arrayDiff.tokenize=function(value){return value.slice()},arrayDiff.join=arrayDiff.removeEmpty=function(value){return value}})); +define("tiny_collaborative/jsdiff/diff/array",["exports","./base"],(function(_exports,_base){var e;Object.defineProperty(_exports,"__esModule",{value:!0}),_exports.arrayDiff=void 0,_exports.diffArrays=function(oldArr,newArr,callback){return arrayDiff.diff(oldArr,newArr,callback)},_base=(e=_base)&&e.__esModule?e:{default:e};const arrayDiff=_exports.arrayDiff=new _base.default;arrayDiff.tokenize=function(value){return value.slice()},arrayDiff.join=arrayDiff.removeEmpty=function(value){return value}})); //# sourceMappingURL=array.min.js.map \ No newline at end of file diff --git a/lib/editor/tiny/plugins/collaborative/amd/build/jsdiff/diff/array.min.js.map b/lib/editor/tiny/plugins/collaborative/amd/build/jsdiff/diff/array.min.js.map index 950caeb11f477..d26733a29b9a1 100644 --- a/lib/editor/tiny/plugins/collaborative/amd/build/jsdiff/diff/array.min.js.map +++ b/lib/editor/tiny/plugins/collaborative/amd/build/jsdiff/diff/array.min.js.map @@ -1 +1 @@ -{"version":3,"file":"array.min.js","sources":["../../../src/jsdiff/diff/array.js"],"sourcesContent":["import Diff from './base';\n\nexport const arrayDiff = new Diff();\narrayDiff.tokenize = function(value) {\n return value.slice();\n};\narrayDiff.join = arrayDiff.removeEmpty = function(value) {\n return value;\n};\n\nexport function diffArrays(oldArr, newArr, callback) { return arrayDiff.diff(oldArr, newArr, callback); }\n"],"names":["oldArr","newArr","callback","arrayDiff","diff","tokenize","value","slice","join","removeEmpty"],"mappings":"oNAU2BA,OAAQC,OAAQC,iBAAmBC,UAAUC,KAAKJ,OAAQC,OAAQC,iBARhFC,UAAY,8FACzBA,UAAUE,SAAW,SAASC,cACrBA,MAAMC,SAEfJ,UAAUK,KAAOL,UAAUM,YAAc,SAASH,cACzCA"} \ No newline at end of file +{"version":3,"file":"array.min.js","sources":["../../../src/jsdiff/diff/array.js"],"sourcesContent":["import Diff from './base';\n\nexport const arrayDiff = new Diff();\narrayDiff.tokenize = function(value) {\n return value.slice();\n};\narrayDiff.join = arrayDiff.removeEmpty = function(value) {\n return value;\n};\n\nexport function diffArrays(oldArr, newArr, callback) { return arrayDiff.diff(oldArr, newArr, callback); }\n"],"names":["e","oldArr","newArr","callback","arrayDiff","diff","_base","__esModule","default","_exports","Diff","tokenize","value","slice","join","removeEmpty"],"mappings":"6FAA0B,IAAAA,wGAUnB,SAAoBC,OAAQC,OAAQC,UAAY,OAAOC,UAAUC,KAAKJ,OAAQC,OAAQC,SAAW,EAVxGG,OAA0BN,EAA1BM,QAA0BN,EAAAO,WAAAP,EAAAQ,CAAAA,QAAAR,GAEnB,MAAMI,UAASK,SAAAL,UAAG,IAAIM,MAAIF,QACjCJ,UAAUO,SAAW,SAASC,OAC5B,OAAOA,MAAMC,SAEfT,UAAUU,KAAOV,UAAUW,YAAc,SAASH,OAChD,OAAOA,MAGgG"} \ No newline at end of file diff --git a/lib/editor/tiny/plugins/collaborative/amd/build/jsdiff/diff/base.min.js b/lib/editor/tiny/plugins/collaborative/amd/build/jsdiff/diff/base.min.js index a34c6d6ee1a20..28c88c7134d6c 100644 --- a/lib/editor/tiny/plugins/collaborative/amd/build/jsdiff/diff/base.min.js +++ b/lib/editor/tiny/plugins/collaborative/amd/build/jsdiff/diff/base.min.js @@ -1,3 +1,3 @@ -define("tiny_collaborative/jsdiff/diff/base",["exports"],(function(_exports){function Diff(){}function buildValues(diff,lastComponent,newString,oldString,useLongestToken){const components=[];let nextComponent;for(;lastComponent;)components.push(lastComponent),nextComponent=lastComponent.previousComponent,delete lastComponent.previousComponent,lastComponent=nextComponent;components.reverse();let componentPos=0,componentLen=components.length,newPos=0,oldPos=0;for(;componentPosvalue.length?oldValue:value})),component.value=diff.join(value)}else component.value=diff.join(newString.slice(newPos,newPos+component.count));newPos+=component.count,component.added||(oldPos+=component.count)}}return components}return Object.defineProperty(_exports,"__esModule",{value:!0}),_exports.default=Diff,Diff.prototype={diff(oldString,newString){var _options$timeout;let options=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{},callback=options.callback;"function"==typeof options&&(callback=options,options={});let self=this;function done(value){return value=self.postProcess(value,options),callback?(setTimeout((function(){callback(value)}),0),!0):value}oldString=this.castInput(oldString,options),newString=this.castInput(newString,options),oldString=this.removeEmpty(this.tokenize(oldString,options));let newLen=(newString=this.removeEmpty(this.tokenize(newString,options))).length,oldLen=oldString.length,editLength=1,maxEditLength=newLen+oldLen;null!=options.maxEditLength&&(maxEditLength=Math.min(maxEditLength,options.maxEditLength));const maxExecutionTime=null!==(_options$timeout=options.timeout)&&void 0!==_options$timeout?_options$timeout:1/0,abortAfterTimestamp=Date.now()+maxExecutionTime;let bestPath=[{oldPos:-1,lastComponent:void 0}],newPos=this.extractCommon(bestPath[0],newString,oldString,0,options);if(bestPath[0].oldPos+1>=oldLen&&newPos+1>=newLen)return done(buildValues(self,bestPath[0].lastComponent,newString,oldString,self.useLongestToken));let minDiagonalToConsider=-1/0,maxDiagonalToConsider=1/0;function execEditLength(){for(let diagonalPath=Math.max(minDiagonalToConsider,-editLength);diagonalPath<=Math.min(maxDiagonalToConsider,editLength);diagonalPath+=2){let basePath,removePath=bestPath[diagonalPath-1],addPath=bestPath[diagonalPath+1];removePath&&(bestPath[diagonalPath-1]=void 0);let canAdd=!1;if(addPath){const addPathNewPos=addPath.oldPos-diagonalPath;canAdd=addPath&&0<=addPathNewPos&&addPathNewPos=oldLen&&newPos+1>=newLen)return done(buildValues(self,basePath.lastComponent,newString,oldString,self.useLongestToken));bestPath[diagonalPath]=basePath,basePath.oldPos+1>=oldLen&&(maxDiagonalToConsider=Math.min(maxDiagonalToConsider,diagonalPath-1)),newPos+1>=newLen&&(minDiagonalToConsider=Math.max(minDiagonalToConsider,diagonalPath+1))}else bestPath[diagonalPath]=void 0}editLength++}if(callback)!function exec(){setTimeout((function(){if(editLength>maxEditLength||Date.now()>abortAfterTimestamp)return callback();execEditLength()||exec()}),0)}();else for(;editLength<=maxEditLength&&Date.now()<=abortAfterTimestamp;){let ret=execEditLength();if(ret)return ret}},addToPath(path,added,removed,oldPosInc,options){let last=path.lastComponent;return last&&!options.oneChangePerToken&&last.added===added&&last.removed===removed?{oldPos:path.oldPos+oldPosInc,lastComponent:{count:last.count+1,added:added,removed:removed,previousComponent:last.previousComponent}}:{oldPos:path.oldPos+oldPosInc,lastComponent:{count:1,added:added,removed:removed,previousComponent:last}}},extractCommon(basePath,newString,oldString,diagonalPath,options){let newLen=newString.length,oldLen=oldString.length,oldPos=basePath.oldPos,newPos=oldPos-diagonalPath,commonCount=0;for(;newPos+1options.comparator?options.comparator(left,right):left===right||options.ignoreCase&&left.toLowerCase()===right.toLowerCase(),removeEmpty(array){let ret=[];for(let i=0;ivalue,tokenize:value=>Array.from(value),join:chars=>chars.join(""),postProcess:changeObjects=>changeObjects},_exports.default})); +define("tiny_collaborative/jsdiff/diff/base",["exports"],(function(_exports){function Diff(){}function buildValues(diff,lastComponent,newString,oldString,useLongestToken){const components=[];let nextComponent;for(;lastComponent;)components.push(lastComponent),nextComponent=lastComponent.previousComponent,delete lastComponent.previousComponent,lastComponent=nextComponent;components.reverse();let componentPos=0,componentLen=components.length,newPos=0,oldPos=0;for(;componentPosvalue.length?oldValue:value})),component.value=diff.join(value)}else component.value=diff.join(newString.slice(newPos,newPos+component.count));newPos+=component.count,component.added||(oldPos+=component.count)}}return components}return Object.defineProperty(_exports,"__esModule",{value:!0}),_exports.default=Diff,Diff.prototype={diff(oldString,newString){let options=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{},callback=options.callback;"function"==typeof options&&(callback=options,options={});let self=this;function done(value){return value=self.postProcess(value,options),callback?(setTimeout((function(){callback(value)}),0),!0):value}oldString=this.castInput(oldString,options),newString=this.castInput(newString,options),oldString=this.removeEmpty(this.tokenize(oldString,options));let newLen=(newString=this.removeEmpty(this.tokenize(newString,options))).length,oldLen=oldString.length,editLength=1,maxEditLength=newLen+oldLen;null!=options.maxEditLength&&(maxEditLength=Math.min(maxEditLength,options.maxEditLength));const maxExecutionTime=options.timeout??1/0,abortAfterTimestamp=Date.now()+maxExecutionTime;let bestPath=[{oldPos:-1,lastComponent:void 0}],newPos=this.extractCommon(bestPath[0],newString,oldString,0,options);if(bestPath[0].oldPos+1>=oldLen&&newPos+1>=newLen)return done(buildValues(self,bestPath[0].lastComponent,newString,oldString,self.useLongestToken));let minDiagonalToConsider=-1/0,maxDiagonalToConsider=1/0;function execEditLength(){for(let diagonalPath=Math.max(minDiagonalToConsider,-editLength);diagonalPath<=Math.min(maxDiagonalToConsider,editLength);diagonalPath+=2){let basePath,removePath=bestPath[diagonalPath-1],addPath=bestPath[diagonalPath+1];removePath&&(bestPath[diagonalPath-1]=void 0);let canAdd=!1;if(addPath){const addPathNewPos=addPath.oldPos-diagonalPath;canAdd=addPath&&0<=addPathNewPos&&addPathNewPos=oldLen&&newPos+1>=newLen)return done(buildValues(self,basePath.lastComponent,newString,oldString,self.useLongestToken));bestPath[diagonalPath]=basePath,basePath.oldPos+1>=oldLen&&(maxDiagonalToConsider=Math.min(maxDiagonalToConsider,diagonalPath-1)),newPos+1>=newLen&&(minDiagonalToConsider=Math.max(minDiagonalToConsider,diagonalPath+1))}else bestPath[diagonalPath]=void 0}editLength++}if(callback)!function exec(){setTimeout((function(){if(editLength>maxEditLength||Date.now()>abortAfterTimestamp)return callback();execEditLength()||exec()}),0)}();else for(;editLength<=maxEditLength&&Date.now()<=abortAfterTimestamp;){let ret=execEditLength();if(ret)return ret}},addToPath(path,added,removed,oldPosInc,options){let last=path.lastComponent;return last&&!options.oneChangePerToken&&last.added===added&&last.removed===removed?{oldPos:path.oldPos+oldPosInc,lastComponent:{count:last.count+1,added:added,removed:removed,previousComponent:last.previousComponent}}:{oldPos:path.oldPos+oldPosInc,lastComponent:{count:1,added:added,removed:removed,previousComponent:last}}},extractCommon(basePath,newString,oldString,diagonalPath,options){let newLen=newString.length,oldLen=oldString.length,oldPos=basePath.oldPos,newPos=oldPos-diagonalPath,commonCount=0;for(;newPos+1options.comparator?options.comparator(left,right):left===right||options.ignoreCase&&left.toLowerCase()===right.toLowerCase(),removeEmpty(array){let ret=[];for(let i=0;ivalue,tokenize:value=>Array.from(value),join:chars=>chars.join(""),postProcess:changeObjects=>changeObjects},_exports.default})); //# sourceMappingURL=base.min.js.map \ No newline at end of file diff --git a/lib/editor/tiny/plugins/collaborative/amd/build/jsdiff/diff/base.min.js.map b/lib/editor/tiny/plugins/collaborative/amd/build/jsdiff/diff/base.min.js.map index 0cb0653585243..c9fcafd5172c7 100644 --- a/lib/editor/tiny/plugins/collaborative/amd/build/jsdiff/diff/base.min.js.map +++ b/lib/editor/tiny/plugins/collaborative/amd/build/jsdiff/diff/base.min.js.map @@ -1 +1 @@ -{"version":3,"file":"base.min.js","sources":["../../../src/jsdiff/diff/base.js"],"sourcesContent":["export default function Diff() {}\n\nDiff.prototype = {\n diff(oldString, newString, options = {}) {\n let callback = options.callback;\n if (typeof options === 'function') {\n callback = options;\n options = {};\n }\n\n let self = this;\n\n function done(value) {\n value = self.postProcess(value, options);\n if (callback) {\n setTimeout(function() { callback(value); }, 0);\n return true;\n } else {\n return value;\n }\n }\n\n // Allow subclasses to massage the input prior to running\n oldString = this.castInput(oldString, options);\n newString = this.castInput(newString, options);\n\n oldString = this.removeEmpty(this.tokenize(oldString, options));\n newString = this.removeEmpty(this.tokenize(newString, options));\n\n let newLen = newString.length, oldLen = oldString.length;\n let editLength = 1;\n let maxEditLength = newLen + oldLen;\n if(options.maxEditLength != null) {\n maxEditLength = Math.min(maxEditLength, options.maxEditLength);\n }\n const maxExecutionTime = options.timeout ?? Infinity;\n const abortAfterTimestamp = Date.now() + maxExecutionTime;\n\n let bestPath = [{ oldPos: -1, lastComponent: undefined }];\n\n // Seed editLength = 0, i.e. the content starts with the same values\n let newPos = this.extractCommon(bestPath[0], newString, oldString, 0, options);\n if (bestPath[0].oldPos + 1 >= oldLen && newPos + 1 >= newLen) {\n // Identity per the equality and tokenizer\n return done(buildValues(self, bestPath[0].lastComponent, newString, oldString, self.useLongestToken));\n }\n\n // Once we hit the right edge of the edit graph on some diagonal k, we can\n // definitely reach the end of the edit graph in no more than k edits, so\n // there's no point in considering any moves to diagonal k+1 any more (from\n // which we're guaranteed to need at least k+1 more edits).\n // Similarly, once we've reached the bottom of the edit graph, there's no\n // point considering moves to lower diagonals.\n // We record this fact by setting minDiagonalToConsider and\n // maxDiagonalToConsider to some finite value once we've hit the edge of\n // the edit graph.\n // This optimization is not faithful to the original algorithm presented in\n // Myers's paper, which instead pointlessly extends D-paths off the end of\n // the edit graph - see page 7 of Myers's paper which notes this point\n // explicitly and illustrates it with a diagram. This has major performance\n // implications for some common scenarios. For instance, to compute a diff\n // where the new text simply appends d characters on the end of the\n // original text of length n, the true Myers algorithm will take O(n+d^2)\n // time while this optimization needs only O(n+d) time.\n let minDiagonalToConsider = -Infinity, maxDiagonalToConsider = Infinity;\n\n // Main worker method. checks all permutations of a given edit length for acceptance.\n function execEditLength() {\n for (\n let diagonalPath = Math.max(minDiagonalToConsider, -editLength);\n diagonalPath <= Math.min(maxDiagonalToConsider, editLength);\n diagonalPath += 2\n ) {\n let basePath;\n let removePath = bestPath[diagonalPath - 1],\n addPath = bestPath[diagonalPath + 1];\n if (removePath) {\n // No one else is going to attempt to use this value, clear it\n bestPath[diagonalPath - 1] = undefined;\n }\n\n let canAdd = false;\n if (addPath) {\n // what newPos will be after we do an insertion:\n const addPathNewPos = addPath.oldPos - diagonalPath;\n canAdd = addPath && 0 <= addPathNewPos && addPathNewPos < newLen;\n }\n\n let canRemove = removePath && removePath.oldPos + 1 < oldLen;\n if (!canAdd && !canRemove) {\n // If this path is a terminal then prune\n bestPath[diagonalPath] = undefined;\n continue;\n }\n\n // Select the diagonal that we want to branch from. We select the prior\n // path whose position in the old string is the farthest from the origin\n // and does not pass the bounds of the diff graph\n if (!canRemove || (canAdd && removePath.oldPos < addPath.oldPos)) {\n basePath = self.addToPath(addPath, true, false, 0, options);\n } else {\n basePath = self.addToPath(removePath, false, true, 1, options);\n }\n\n newPos = self.extractCommon(basePath, newString, oldString, diagonalPath, options);\n\n if (basePath.oldPos + 1 >= oldLen && newPos + 1 >= newLen) {\n // If we have hit the end of both strings, then we are done\n return done(buildValues(self, basePath.lastComponent, newString, oldString, self.useLongestToken));\n } else {\n bestPath[diagonalPath] = basePath;\n if (basePath.oldPos + 1 >= oldLen) {\n maxDiagonalToConsider = Math.min(maxDiagonalToConsider, diagonalPath - 1);\n }\n if (newPos + 1 >= newLen) {\n minDiagonalToConsider = Math.max(minDiagonalToConsider, diagonalPath + 1);\n }\n }\n }\n\n editLength++;\n }\n\n // Performs the length of edit iteration. Is a bit fugly as this has to support the\n // sync and async mode which is never fun. Loops over execEditLength until a value\n // is produced, or until the edit length exceeds options.maxEditLength (if given),\n // in which case it will return undefined.\n if (callback) {\n (function exec() {\n setTimeout(function() {\n if (editLength > maxEditLength || Date.now() > abortAfterTimestamp) {\n return callback();\n }\n\n if (!execEditLength()) {\n exec();\n }\n }, 0);\n }());\n } else {\n while (editLength <= maxEditLength && Date.now() <= abortAfterTimestamp) {\n let ret = execEditLength();\n if (ret) {\n return ret;\n }\n }\n }\n },\n\n addToPath(path, added, removed, oldPosInc, options) {\n let last = path.lastComponent;\n if (last && !options.oneChangePerToken && last.added === added && last.removed === removed) {\n return {\n oldPos: path.oldPos + oldPosInc,\n lastComponent: {count: last.count + 1, added: added, removed: removed, previousComponent: last.previousComponent }\n };\n } else {\n return {\n oldPos: path.oldPos + oldPosInc,\n lastComponent: {count: 1, added: added, removed: removed, previousComponent: last }\n };\n }\n },\n extractCommon(basePath, newString, oldString, diagonalPath, options) {\n let newLen = newString.length,\n oldLen = oldString.length,\n oldPos = basePath.oldPos,\n newPos = oldPos - diagonalPath,\n\n commonCount = 0;\n while (newPos + 1 < newLen && oldPos + 1 < oldLen && this.equals(oldString[oldPos + 1], newString[newPos + 1], options)) {\n newPos++;\n oldPos++;\n commonCount++;\n if (options.oneChangePerToken) {\n basePath.lastComponent = {count: 1, previousComponent: basePath.lastComponent, added: false, removed: false};\n }\n }\n\n if (commonCount && !options.oneChangePerToken) {\n basePath.lastComponent = {count: commonCount, previousComponent: basePath.lastComponent, added: false, removed: false};\n }\n\n basePath.oldPos = oldPos;\n return newPos;\n },\n\n equals(left, right, options) {\n if (options.comparator) {\n return options.comparator(left, right);\n } else {\n return left === right\n || (options.ignoreCase && left.toLowerCase() === right.toLowerCase());\n }\n },\n removeEmpty(array) {\n let ret = [];\n for (let i = 0; i < array.length; i++) {\n if (array[i]) {\n ret.push(array[i]);\n }\n }\n return ret;\n },\n castInput(value) {\n return value;\n },\n tokenize(value) {\n return Array.from(value);\n },\n join(chars) {\n return chars.join('');\n },\n postProcess(changeObjects) {\n return changeObjects;\n }\n};\n\nfunction buildValues(diff, lastComponent, newString, oldString, useLongestToken) {\n // First we convert our linked list of components in reverse order to an\n // array in the right order:\n const components = [];\n let nextComponent;\n while (lastComponent) {\n components.push(lastComponent);\n nextComponent = lastComponent.previousComponent;\n delete lastComponent.previousComponent;\n lastComponent = nextComponent;\n }\n components.reverse();\n\n let componentPos = 0,\n componentLen = components.length,\n newPos = 0,\n oldPos = 0;\n\n for (; componentPos < componentLen; componentPos++) {\n let component = components[componentPos];\n if (!component.removed) {\n if (!component.added && useLongestToken) {\n let value = newString.slice(newPos, newPos + component.count);\n value = value.map(function(value, i) {\n let oldValue = oldString[oldPos + i];\n return oldValue.length > value.length ? oldValue : value;\n });\n\n component.value = diff.join(value);\n } else {\n component.value = diff.join(newString.slice(newPos, newPos + component.count));\n }\n newPos += component.count;\n\n // Common case\n if (!component.added) {\n oldPos += component.count;\n }\n } else {\n component.value = diff.join(oldString.slice(oldPos, oldPos + component.count));\n oldPos += component.count;\n }\n }\n\n return components;\n}\n"],"names":["Diff","buildValues","diff","lastComponent","newString","oldString","useLongestToken","components","nextComponent","push","previousComponent","reverse","componentPos","componentLen","length","newPos","oldPos","component","removed","value","join","slice","count","added","map","i","oldValue","prototype","options","callback","self","this","done","postProcess","setTimeout","castInput","removeEmpty","tokenize","newLen","oldLen","editLength","maxEditLength","Math","min","maxExecutionTime","timeout","Infinity","abortAfterTimestamp","Date","now","bestPath","undefined","extractCommon","minDiagonalToConsider","maxDiagonalToConsider","execEditLength","diagonalPath","max","basePath","removePath","addPath","canAdd","addPathNewPos","canRemove","addToPath","exec","ret","path","oldPosInc","last","oneChangePerToken","commonCount","equals","left","right","comparator","ignoreCase","toLowerCase","array","Array","from","chars","changeObjects"],"mappings":"sFAAwBA,iBA0NfC,YAAYC,KAAMC,cAAeC,UAAWC,UAAWC,uBAGxDC,WAAa,OACfC,mBACGL,eACLI,WAAWE,KAAKN,eAChBK,cAAgBL,cAAcO,yBACvBP,cAAcO,kBACrBP,cAAgBK,cAElBD,W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,OAASC,OACV9C,QAAQgD,YAAcH,KAAKI,gBAAkBH,MAAMG,cAG7DzC,YAAY0C,WACNZ,IAAM,OACL,IAAIzC,EAAI,EAAGA,EAAIqD,MAAMhE,OAAQW,IAC5BqD,MAAMrD,IACRyC,IAAIzD,KAAKqE,MAAMrD,WAGZyC,KAET/B,UAAUhB,OACDA,MAETkB,SAASlB,OACA4D,MAAMC,KAAK7D,OAEpBC,KAAK6D,OACIA,MAAM7D,KAAK,IAEpBa,YAAYiD,eACHA"} \ No newline at end of file +{"version":3,"file":"base.min.js","sources":["../../../src/jsdiff/diff/base.js"],"sourcesContent":["export default function Diff() {}\n\nDiff.prototype = {\n diff(oldString, newString, options = {}) {\n let callback = options.callback;\n if (typeof options === 'function') {\n callback = options;\n options = {};\n }\n\n let self = this;\n\n function done(value) {\n value = self.postProcess(value, options);\n if (callback) {\n setTimeout(function() { callback(value); }, 0);\n return true;\n } else {\n return value;\n }\n }\n\n // Allow subclasses to massage the input prior to running\n oldString = this.castInput(oldString, options);\n newString = this.castInput(newString, options);\n\n oldString = this.removeEmpty(this.tokenize(oldString, options));\n newString = this.removeEmpty(this.tokenize(newString, options));\n\n let newLen = newString.length, oldLen = oldString.length;\n let editLength = 1;\n let maxEditLength = newLen + oldLen;\n if(options.maxEditLength != null) {\n maxEditLength = Math.min(maxEditLength, options.maxEditLength);\n }\n const maxExecutionTime = options.timeout ?? Infinity;\n const abortAfterTimestamp = Date.now() + maxExecutionTime;\n\n let bestPath = [{ oldPos: -1, lastComponent: undefined }];\n\n // Seed editLength = 0, i.e. the content starts with the same values\n let newPos = this.extractCommon(bestPath[0], newString, oldString, 0, options);\n if (bestPath[0].oldPos + 1 >= oldLen && newPos + 1 >= newLen) {\n // Identity per the equality and tokenizer\n return done(buildValues(self, bestPath[0].lastComponent, newString, oldString, self.useLongestToken));\n }\n\n // Once we hit the right edge of the edit graph on some diagonal k, we can\n // definitely reach the end of the edit graph in no more than k edits, so\n // there's no point in considering any moves to diagonal k+1 any more (from\n // which we're guaranteed to need at least k+1 more edits).\n // Similarly, once we've reached the bottom of the edit graph, there's no\n // point considering moves to lower diagonals.\n // We record this fact by setting minDiagonalToConsider and\n // maxDiagonalToConsider to some finite value once we've hit the edge of\n // the edit graph.\n // This optimization is not faithful to the original algorithm presented in\n // Myers's paper, which instead pointlessly extends D-paths off the end of\n // the edit graph - see page 7 of Myers's paper which notes this point\n // explicitly and illustrates it with a diagram. This has major performance\n // implications for some common scenarios. For instance, to compute a diff\n // where the new text simply appends d characters on the end of the\n // original text of length n, the true Myers algorithm will take O(n+d^2)\n // time while this optimization needs only O(n+d) time.\n let minDiagonalToConsider = -Infinity, maxDiagonalToConsider = Infinity;\n\n // Main worker method. checks all permutations of a given edit length for acceptance.\n function execEditLength() {\n for (\n let diagonalPath = Math.max(minDiagonalToConsider, -editLength);\n diagonalPath <= Math.min(maxDiagonalToConsider, editLength);\n diagonalPath += 2\n ) {\n let basePath;\n let removePath = bestPath[diagonalPath - 1],\n addPath = bestPath[diagonalPath + 1];\n if (removePath) {\n // No one else is going to attempt to use this value, clear it\n bestPath[diagonalPath - 1] = undefined;\n }\n\n let canAdd = false;\n if (addPath) {\n // what newPos will be after we do an insertion:\n const addPathNewPos = addPath.oldPos - diagonalPath;\n canAdd = addPath && 0 <= addPathNewPos && addPathNewPos < newLen;\n }\n\n let canRemove = removePath && removePath.oldPos + 1 < oldLen;\n if (!canAdd && !canRemove) {\n // If this path is a terminal then prune\n bestPath[diagonalPath] = undefined;\n continue;\n }\n\n // Select the diagonal that we want to branch from. We select the prior\n // path whose position in the old string is the farthest from the origin\n // and does not pass the bounds of the diff graph\n if (!canRemove || (canAdd && removePath.oldPos < addPath.oldPos)) {\n basePath = self.addToPath(addPath, true, false, 0, options);\n } else {\n basePath = self.addToPath(removePath, false, true, 1, options);\n }\n\n newPos = self.extractCommon(basePath, newString, oldString, diagonalPath, options);\n\n if (basePath.oldPos + 1 >= oldLen && newPos + 1 >= newLen) {\n // If we have hit the end of both strings, then we are done\n return done(buildValues(self, basePath.lastComponent, newString, oldString, self.useLongestToken));\n } else {\n bestPath[diagonalPath] = basePath;\n if (basePath.oldPos + 1 >= oldLen) {\n maxDiagonalToConsider = Math.min(maxDiagonalToConsider, diagonalPath - 1);\n }\n if (newPos + 1 >= newLen) {\n minDiagonalToConsider = Math.max(minDiagonalToConsider, diagonalPath + 1);\n }\n }\n }\n\n editLength++;\n }\n\n // Performs the length of edit iteration. Is a bit fugly as this has to support the\n // sync and async mode which is never fun. Loops over execEditLength until a value\n // is produced, or until the edit length exceeds options.maxEditLength (if given),\n // in which case it will return undefined.\n if (callback) {\n (function exec() {\n setTimeout(function() {\n if (editLength > maxEditLength || Date.now() > abortAfterTimestamp) {\n return callback();\n }\n\n if (!execEditLength()) {\n exec();\n }\n }, 0);\n }());\n } else {\n while (editLength <= maxEditLength && Date.now() <= abortAfterTimestamp) {\n let ret = execEditLength();\n if (ret) {\n return ret;\n }\n }\n }\n },\n\n addToPath(path, added, removed, oldPosInc, options) {\n let last = path.lastComponent;\n if (last && !options.oneChangePerToken && last.added === added && last.removed === removed) {\n return {\n oldPos: path.oldPos + oldPosInc,\n lastComponent: {count: last.count + 1, added: added, removed: removed, previousComponent: last.previousComponent }\n };\n } else {\n return {\n oldPos: path.oldPos + oldPosInc,\n lastComponent: {count: 1, added: added, removed: removed, previousComponent: last }\n };\n }\n },\n extractCommon(basePath, newString, oldString, diagonalPath, options) {\n let newLen = newString.length,\n oldLen = oldString.length,\n oldPos = basePath.oldPos,\n newPos = oldPos - diagonalPath,\n\n commonCount = 0;\n while (newPos + 1 < newLen && oldPos + 1 < oldLen && this.equals(oldString[oldPos + 1], newString[newPos + 1], options)) {\n newPos++;\n oldPos++;\n commonCount++;\n if (options.oneChangePerToken) {\n basePath.lastComponent = {count: 1, previousComponent: basePath.lastComponent, added: false, removed: false};\n }\n }\n\n if (commonCount && !options.oneChangePerToken) {\n basePath.lastComponent = {count: commonCount, previousComponent: basePath.lastComponent, added: false, removed: false};\n }\n\n basePath.oldPos = oldPos;\n return newPos;\n },\n\n equals(left, right, options) {\n if (options.comparator) {\n return options.comparator(left, right);\n } else {\n return left === right\n || (options.ignoreCase && left.toLowerCase() === right.toLowerCase());\n }\n },\n removeEmpty(array) {\n let ret = [];\n for (let i = 0; i < array.length; i++) {\n if (array[i]) {\n ret.push(array[i]);\n }\n }\n return ret;\n },\n castInput(value) {\n return value;\n },\n tokenize(value) {\n return Array.from(value);\n },\n join(chars) {\n return chars.join('');\n },\n postProcess(changeObjects) {\n return changeObjects;\n }\n};\n\nfunction buildValues(diff, lastComponent, newString, oldString, useLongestToken) {\n // First we convert our linked list of components in reverse order to an\n // array in the right order:\n const components = [];\n let nextComponent;\n while (lastComponent) {\n components.push(lastComponent);\n nextComponent = lastComponent.previousComponent;\n delete lastComponent.previousComponent;\n lastComponent = nextComponent;\n }\n components.reverse();\n\n let componentPos = 0,\n componentLen = components.length,\n newPos = 0,\n oldPos = 0;\n\n for (; componentPos < componentLen; componentPos++) {\n let component = components[componentPos];\n if (!component.removed) {\n if (!component.added && useLongestToken) {\n let value = newString.slice(newPos, newPos + component.count);\n value = value.map(function(value, i) {\n let oldValue = oldString[oldPos + i];\n return oldValue.length > value.length ? oldValue : value;\n });\n\n component.value = diff.join(value);\n } else {\n component.value = diff.join(newString.slice(newPos, newPos + component.count));\n }\n newPos += component.count;\n\n // Common case\n if (!component.added) {\n oldPos += component.count;\n }\n } else {\n component.value = diff.join(oldString.slice(oldPos, oldPos + component.count));\n oldPos += component.count;\n }\n }\n\n return components;\n}\n"],"names":["Diff","buildValues","diff","lastComponent","newString","oldString","useLongestToken","components","nextComponent","push","previousComponent","reverse","componentPos","componentLen","length","newPos","oldPos","component","removed","value","join","slice","count","added","map","i","oldValue","prototype","options","arguments","undefined","callback","self","this","done","postProcess","setTimeout","castInput","removeEmpty","tokenize","newLen","oldLen","editLength","maxEditLength","Math","min","maxExecutionTime","timeout","Infinity","abortAfterTimestamp","Date","now","bestPath","extractCommon","minDiagonalToConsider","maxDiagonalToConsider","execEditLength","diagonalPath","max","basePath","removePath","addPath","canAdd","addPathNewPos","canRemove","addToPath","exec","ret","path","oldPosInc","last","oneChangePerToken","commonCount","equals","left","right","comparator","ignoreCase","toLowerCase","array","Array","from","chars","changeObjects","_exports","default"],"mappings":"6EAAe,SAASA,OAAQ,CA0NhC,SAASC,YAAYC,KAAMC,cAAeC,UAAWC,UAAWC,iBAG9D,MAAMC,WAAa,GACnB,IAAIC,cACJ,KAAOL,eACLI,WAAWE,KAAKN,eAChBK,cAAgBL,cAAcO,yBACvBP,cAAcO,kBACrBP,cAAgBK,cAElBD,WAAWI,UAEX,IAAIC,aAAe,EACfC,aAAeN,WAAWO,OAC1BC,OAAS,EACTC,OAAS,EAEb,KAAOJ,aAAeC,aAAcD,eAAgB,CAClD,IAAIK,UAAYV,WAAWK,cAC3B,GAAKK,UAAUC,QAmBbD,UAAUE,MAAQjB,KAAKkB,KAAKf,UAAUgB,MAAML,OAAQA,OAASC,UAAUK,QACvEN,QAAUC,UAAUK,UApBE,CACtB,IAAKL,UAAUM,OAASjB,gBAAiB,CACvC,IAAIa,MAAQf,UAAUiB,MAAMN,OAAQA,OAASE,UAAUK,OACvDH,MAAQA,MAAMK,KAAI,SAASL,MAAOM,GAChC,IAAIC,SAAWrB,UAAUW,OAASS,GAClC,OAAOC,SAASZ,OAASK,MAAML,OAASY,SAAWP,KACrD,IAEAF,UAAUE,MAAQjB,KAAKkB,KAAKD,MAC9B,MACEF,UAAUE,MAAQjB,KAAKkB,KAAKhB,UAAUiB,MAAMN,OAAQA,OAASE,UAAUK,QAEzEP,QAAUE,UAAUK,MAGfL,UAAUM,QACbP,QAAUC,UAAUK,MAExB,CAIF,CAEA,OAAOf,UACT,CAAC,qFArQDP,KAAK2B,UAAY,CACfzB,IAAAA,CAAKG,UAAWD,WAAyB,IAAdwB,QAAOC,UAAAf,OAAA,QAAAgB,IAAAD,UAAA,GAAAA,UAAA,GAAG,CAAA,EAC/BE,SAAW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build/jsdiff/diff/character.min.js b/lib/editor/tiny/plugins/collaborative/amd/build/jsdiff/diff/character.min.js index 8c2b692b64eaa..851fbad565981 100644 --- a/lib/editor/tiny/plugins/collaborative/amd/build/jsdiff/diff/character.min.js +++ b/lib/editor/tiny/plugins/collaborative/amd/build/jsdiff/diff/character.min.js @@ -1,3 +1,3 @@ -define("tiny_collaborative/jsdiff/diff/character",["exports","./base"],(function(_exports,_base){var obj;Object.defineProperty(_exports,"__esModule",{value:!0}),_exports.characterDiff=void 0,_exports.diffChars=function(oldStr,newStr,options){return characterDiff.diff(oldStr,newStr,options)};const characterDiff=new(_base=(obj=_base)&&obj.__esModule?obj:{default:obj}).default;_exports.characterDiff=characterDiff})); +define("tiny_collaborative/jsdiff/diff/character",["exports","./base"],(function(_exports,_base){var e;Object.defineProperty(_exports,"__esModule",{value:!0}),_exports.characterDiff=void 0,_exports.diffChars=function(oldStr,newStr,options){return characterDiff.diff(oldStr,newStr,options)},_base=(e=_base)&&e.__esModule?e:{default:e};const characterDiff=_exports.characterDiff=new _base.default})); //# sourceMappingURL=character.min.js.map \ No newline at end of file diff --git a/lib/editor/tiny/plugins/collaborative/amd/build/jsdiff/diff/character.min.js.map b/lib/editor/tiny/plugins/collaborative/amd/build/jsdiff/diff/character.min.js.map index db4dcc58b0c33..394a9e637de22 100644 --- a/lib/editor/tiny/plugins/collaborative/amd/build/jsdiff/diff/character.min.js.map +++ b/lib/editor/tiny/plugins/collaborative/amd/build/jsdiff/diff/character.min.js.map @@ -1 +1 @@ -{"version":3,"file":"character.min.js","sources":["../../../src/jsdiff/diff/character.js"],"sourcesContent":["import Diff from './base';\n\nexport const characterDiff = new Diff();\nexport function diffChars(oldStr, newStr, options) { return characterDiff.diff(oldStr, newStr, options); }\n"],"names":["oldStr","newStr","options","characterDiff","diff"],"mappings":"2NAG0BA,OAAQC,OAAQC,gBAAkBC,cAAcC,KAAKJ,OAAQC,OAAQC,gBADlFC,cAAgB"} \ No newline at end of file +{"version":3,"file":"character.min.js","sources":["../../../src/jsdiff/diff/character.js"],"sourcesContent":["import Diff from './base';\n\nexport const characterDiff = new Diff();\nexport function diffChars(oldStr, newStr, options) { return characterDiff.diff(oldStr, newStr, options); }\n"],"names":["e","oldStr","newStr","options","characterDiff","diff","_base","__esModule","default","_exports","Diff"],"mappings":"iGAA0B,IAAAA,2GAGnB,SAAmBC,OAAQC,OAAQC,SAAW,OAAOC,cAAcC,KAAKJ,OAAQC,OAAQC,QAAU,EAHzGG,OAA0BN,EAA1BM,QAA0BN,EAAAO,WAAAP,EAAAQ,CAAAA,QAAAR,GAEnB,MAAMI,cAAaK,SAAAL,cAAG,IAAIM,MAAIF,OACqE"} \ No newline at end of file diff --git a/lib/editor/tiny/plugins/collaborative/amd/build/jsdiff/diff/css.min.js b/lib/editor/tiny/plugins/collaborative/amd/build/jsdiff/diff/css.min.js index 635ec8e761aee..3025aadd9992a 100644 --- a/lib/editor/tiny/plugins/collaborative/amd/build/jsdiff/diff/css.min.js +++ b/lib/editor/tiny/plugins/collaborative/amd/build/jsdiff/diff/css.min.js @@ -1,3 +1,3 @@ -define("tiny_collaborative/jsdiff/diff/css",["exports","./base"],(function(_exports,_base){var obj;Object.defineProperty(_exports,"__esModule",{value:!0}),_exports.cssDiff=void 0,_exports.diffCss=function(oldStr,newStr,callback){return cssDiff.diff(oldStr,newStr,callback)};const cssDiff=new(_base=(obj=_base)&&obj.__esModule?obj:{default:obj}).default;_exports.cssDiff=cssDiff,cssDiff.tokenize=function(value){return value.split(/([{}:;,]|\s+)/)}})); +define("tiny_collaborative/jsdiff/diff/css",["exports","./base"],(function(_exports,_base){var e;Object.defineProperty(_exports,"__esModule",{value:!0}),_exports.cssDiff=void 0,_exports.diffCss=function(oldStr,newStr,callback){return cssDiff.diff(oldStr,newStr,callback)},_base=(e=_base)&&e.__esModule?e:{default:e};const cssDiff=_exports.cssDiff=new _base.default;cssDiff.tokenize=function(value){return value.split(/([{}:;,]|\s+)/)}})); //# sourceMappingURL=css.min.js.map \ No newline at end of file diff --git a/lib/editor/tiny/plugins/collaborative/amd/build/jsdiff/diff/css.min.js.map b/lib/editor/tiny/plugins/collaborative/amd/build/jsdiff/diff/css.min.js.map index 166c4da6cbd57..21954c36dd008 100644 --- a/lib/editor/tiny/plugins/collaborative/amd/build/jsdiff/diff/css.min.js.map +++ b/lib/editor/tiny/plugins/collaborative/amd/build/jsdiff/diff/css.min.js.map @@ -1 +1 @@ -{"version":3,"file":"css.min.js","sources":["../../../src/jsdiff/diff/css.js"],"sourcesContent":["import Diff from './base';\n\nexport const cssDiff = new Diff();\ncssDiff.tokenize = function(value) {\n return value.split(/([{}:;,]|\\s+)/);\n};\n\nexport function diffCss(oldStr, newStr, callback) { return cssDiff.diff(oldStr, newStr, callback); }\n"],"names":["oldStr","newStr","callback","cssDiff","diff","tokenize","value","split"],"mappings":"6MAOwBA,OAAQC,OAAQC,iBAAmBC,QAAQC,KAAKJ,OAAQC,OAAQC,iBAL3EC,QAAU,0FACvBA,QAAQE,SAAW,SAASC,cACnBA,MAAMC,MAAM"} \ No newline at end of file +{"version":3,"file":"css.min.js","sources":["../../../src/jsdiff/diff/css.js"],"sourcesContent":["import Diff from './base';\n\nexport const cssDiff = new Diff();\ncssDiff.tokenize = function(value) {\n return value.split(/([{}:;,]|\\s+)/);\n};\n\nexport function diffCss(oldStr, newStr, callback) { return cssDiff.diff(oldStr, newStr, callback); }\n"],"names":["e","oldStr","newStr","callback","cssDiff","diff","_base","__esModule","default","_exports","Diff","tokenize","value","split"],"mappings":"2FAA0B,IAAAA,mGAOnB,SAAiBC,OAAQC,OAAQC,UAAY,OAAOC,QAAQC,KAAKJ,OAAQC,OAAQC,SAAW,EAPnGG,OAA0BN,EAA1BM,QAA0BN,EAAAO,WAAAP,EAAAQ,CAAAA,QAAAR,GAEnB,MAAMI,QAAOK,SAAAL,QAAG,IAAIM,MAAIF,QAC/BJ,QAAQO,SAAW,SAASC,OAC1B,OAAOA,MAAMC,MAAM,iBAG+E"} \ No newline at end of file diff --git a/lib/editor/tiny/plugins/collaborative/amd/build/jsdiff/diff/json.min.js b/lib/editor/tiny/plugins/collaborative/amd/build/jsdiff/diff/json.min.js index 065028cc63562..b72e95fe72738 100644 --- a/lib/editor/tiny/plugins/collaborative/amd/build/jsdiff/diff/json.min.js +++ b/lib/editor/tiny/plugins/collaborative/amd/build/jsdiff/diff/json.min.js @@ -1,3 +1,3 @@ -define("tiny_collaborative/jsdiff/diff/json",["exports","./base","./line"],(function(_exports,_base,_line){var obj;Object.defineProperty(_exports,"__esModule",{value:!0}),_exports.canonicalize=canonicalize,_exports.diffJson=function(oldObj,newObj,options){return jsonDiff.diff(oldObj,newObj,options)},_exports.jsonDiff=void 0;const jsonDiff=new(_base=(obj=_base)&&obj.__esModule?obj:{default:obj}).default;function canonicalize(obj,stack,replacementStack,replacer,key){let i,canonicalizedObj;for(stack=stack||[],replacementStack=replacementStack||[],replacer&&(obj=replacer(key,obj)),i=0;ivoid 0===v?undefinedReplacement:v)}=options;return"string"==typeof value?value:JSON.stringify(canonicalize(value,null,null,stringifyReplacer),stringifyReplacer," ")},jsonDiff.equals=function(left,right,options){return _base.default.prototype.equals.call(jsonDiff,left.replace(/,([\r\n])/g,"$1"),right.replace(/,([\r\n])/g,"$1"),options)}})); +define("tiny_collaborative/jsdiff/diff/json",["exports","./base","./line"],(function(_exports,_base,_line){var e;Object.defineProperty(_exports,"__esModule",{value:!0}),_exports.canonicalize=canonicalize,_exports.diffJson=function(oldObj,newObj,options){return jsonDiff.diff(oldObj,newObj,options)},_exports.jsonDiff=void 0,_base=(e=_base)&&e.__esModule?e:{default:e};const jsonDiff=_exports.jsonDiff=new _base.default;function canonicalize(obj,stack,replacementStack,replacer,key){let i,canonicalizedObj;for(stack=stack||[],replacementStack=replacementStack||[],replacer&&(obj=replacer(key,obj)),i=0;ivoid 0===v?undefinedReplacement:v}=options;return"string"==typeof value?value:JSON.stringify(canonicalize(value,null,null,stringifyReplacer),stringifyReplacer," ")},jsonDiff.equals=function(left,right,options){return _base.default.prototype.equals.call(jsonDiff,left.replace(/,([\r\n])/g,"$1"),right.replace(/,([\r\n])/g,"$1"),options)}})); //# sourceMappingURL=json.min.js.map \ No newline at end of file diff --git a/lib/editor/tiny/plugins/collaborative/amd/build/jsdiff/diff/json.min.js.map b/lib/editor/tiny/plugins/collaborative/amd/build/jsdiff/diff/json.min.js.map index 413ea2fa080d8..e4c88362baa25 100644 --- a/lib/editor/tiny/plugins/collaborative/amd/build/jsdiff/diff/json.min.js.map +++ b/lib/editor/tiny/plugins/collaborative/amd/build/jsdiff/diff/json.min.js.map @@ -1 +1 @@ -{"version":3,"file":"json.min.js","sources":["../../../src/jsdiff/diff/json.js"],"sourcesContent":["import Diff from './base';\nimport {lineDiff} from './line';\n\nexport const jsonDiff = new Diff();\n// Discriminate between two lines of pretty-printed, serialized JSON where one of them has a\n// dangling comma and the other doesn't. Turns out including the dangling comma yields the nicest output:\njsonDiff.useLongestToken = true;\n\njsonDiff.tokenize = lineDiff.tokenize;\njsonDiff.castInput = function(value, options) {\n const {undefinedReplacement, stringifyReplacer = (k, v) => typeof v === 'undefined' ? undefinedReplacement : v} = options;\n\n return typeof value === 'string' ? value : JSON.stringify(canonicalize(value, null, null, stringifyReplacer), stringifyReplacer, ' ');\n};\njsonDiff.equals = function(left, right, options) {\n return Diff.prototype.equals.call(jsonDiff, left.replace(/,([\\r\\n])/g, '$1'), right.replace(/,([\\r\\n])/g, '$1'), options);\n};\n\nexport function diffJson(oldObj, newObj, options) { return jsonDiff.diff(oldObj, newObj, options); }\n\n// This function handles the presence of circular references by bailing out when encountering an\n// object that is already on the \"stack\" of items being processed. Accepts an optional replacer\nexport function canonicalize(obj, stack, replacementStack, replacer, key) {\n stack = stack || [];\n replacementStack = replacementStack || [];\n\n if (replacer) {\n obj = replacer(key, obj);\n }\n\n let i;\n\n for (i = 0; i < stack.length; i += 1) {\n if (stack[i] === obj) {\n return replacementStack[i];\n }\n }\n\n let canonicalizedObj;\n\n if ('[object Array]' === Object.prototype.toString.call(obj)) {\n stack.push(obj);\n canonicalizedObj = new Array(obj.length);\n replacementStack.push(canonicalizedObj);\n for (i = 0; i < obj.length; i += 1) {\n canonicalizedObj[i] = canonicalize(obj[i], stack, replacementStack, replacer, key);\n }\n stack.pop();\n replacementStack.pop();\n return canonicalizedObj;\n }\n\n if (obj && obj.toJSON) {\n obj = obj.toJSON();\n }\n\n if (typeof obj === 'object' && obj !== null) {\n stack.push(obj);\n canonicalizedObj = {};\n replacementStack.push(canonicalizedObj);\n let sortedKeys = [],\n key;\n for (key in obj) {\n /* istanbul ignore else */\n if (Object.prototype.hasOwnProperty.call(obj, key)) {\n sortedKeys.push(key);\n }\n }\n sortedKeys.sort();\n for (i = 0; i < sortedKeys.length; i += 1) {\n key = sortedKeys[i];\n canonicalizedObj[key] = canonicalize(obj[key], stack, replacementStack, replacer, key);\n }\n stack.pop();\n replacementStack.pop();\n } else {\n canonicalizedObj = obj;\n }\n return canonicalizedObj;\n}\n"],"names":["oldObj","newObj","options","jsonDiff","diff","canonicalize","obj","stack","replacementStack","replacer","key","i","canonicalizedObj","length","Object","prototype","toString","call","push","Array","pop","toJSON","sortedKeys","hasOwnProperty","sort","useLongestToken","tokenize","lineDiff","castInput","value","undefinedReplacement","stringifyReplacer","k","v","JSON","stringify","equals","left","right","Diff","replace"],"mappings":"yOAkByBA,OAAQC,OAAQC,gBAAkBC,SAASC,KAAKJ,OAAQC,OAAQC,yCAf5EC,SAAW,0EAmBRE,aAAaC,IAAKC,MAAOC,iBAAkBC,SAAUC,SAQ/DC,EAQAC,qBAfJL,MAAQA,OAAS,GACjBC,iBAAmBA,kBAAoB,GAEnCC,WACFH,IAAMG,SAASC,IAAKJ,MAKjBK,EAAI,EAAGA,EAAIJ,MAAMM,OAAQF,GAAK,KAC7BJ,MAAMI,KAAOL,WACRE,iBAAiBG,MAMxB,mBAAqBG,OAAOC,UAAUC,SAASC,KAAKX,KAAM,KAC5DC,MAAMW,KAAKZ,KACXM,iBAAmB,IAAIO,MAAMb,IAAIO,QACjCL,iBAAiBU,KAAKN,kBACjBD,EAAI,EAAGA,EAAIL,IAAIO,OAAQF,GAAK,EAC/BC,iBAAiBD,GAAKN,aAAaC,IAAIK,GAAIJ,MAAOC,iBAAkBC,SAAUC,YAEhFH,MAAMa,MACNZ,iBAAiBY,MACVR,oBAGLN,KAAOA,IAAIe,SACbf,IAAMA,IAAIe,UAGO,iBAARf,KAA4B,OAARA,IAAc,CAC3CC,MAAMW,KAAKZ,KACXM,iBAAmB,GACnBJ,iBAAiBU,KAAKN,sBAElBF,IADAY,WAAa,OAEZZ,OAAOJ,IAENQ,OAAOC,UAAUQ,eAAeN,KAAKX,IAAKI,MAC5CY,WAAWJ,KAAKR,SAGpBY,WAAWE,OACNb,EAAI,EAAGA,EAAIW,WAAWT,OAAQF,GAAK,EACtCD,IAAMY,WAAWX,GACjBC,iBAAiBF,KAAOL,aAAaC,IAAII,KAAMH,MAAOC,iBAAkBC,SAAUC,KAEpFH,MAAMa,MACNZ,iBAAiBY,WAEjBR,iBAAmBN,WAEdM,4CAxETT,SAASsB,iBAAkB,EAE3BtB,SAASuB,SAAWC,eAASD,SAC7BvB,SAASyB,UAAY,SAASC,MAAO3B,eAC7B4B,qBAACA,qBAADC,kBAAuBA,kBAAoB,EAACC,EAAGC,SAAmB,IAANA,EAAoBH,qBAAuBG,IAAK/B,cAE1F,iBAAV2B,MAAqBA,MAAQK,KAAKC,UAAU9B,aAAawB,MAAO,KAAM,KAAME,mBAAoBA,kBAAmB,OAEnI5B,SAASiC,OAAS,SAASC,KAAMC,MAAOpC,gBAC/BqC,cAAKxB,UAAUqB,OAAOnB,KAAKd,SAAUkC,KAAKG,QAAQ,aAAc,MAAOF,MAAME,QAAQ,aAAc,MAAOtC"} \ No newline at end of file +{"version":3,"file":"json.min.js","sources":["../../../src/jsdiff/diff/json.js"],"sourcesContent":["import Diff from './base';\nimport {lineDiff} from './line';\n\nexport const jsonDiff = new Diff();\n// Discriminate between two lines of pretty-printed, serialized JSON where one of them has a\n// dangling comma and the other doesn't. Turns out including the dangling comma yields the nicest output:\njsonDiff.useLongestToken = true;\n\njsonDiff.tokenize = lineDiff.tokenize;\njsonDiff.castInput = function(value, options) {\n const {undefinedReplacement, stringifyReplacer = (k, v) => typeof v === 'undefined' ? undefinedReplacement : v} = options;\n\n return typeof value === 'string' ? value : JSON.stringify(canonicalize(value, null, null, stringifyReplacer), stringifyReplacer, ' ');\n};\njsonDiff.equals = function(left, right, options) {\n return Diff.prototype.equals.call(jsonDiff, left.replace(/,([\\r\\n])/g, '$1'), right.replace(/,([\\r\\n])/g, '$1'), options);\n};\n\nexport function diffJson(oldObj, newObj, options) { return jsonDiff.diff(oldObj, newObj, options); }\n\n// This function handles the presence of circular references by bailing out when encountering an\n// object that is already on the \"stack\" of items being processed. Accepts an optional replacer\nexport function canonicalize(obj, stack, replacementStack, replacer, key) {\n stack = stack || [];\n replacementStack = replacementStack || [];\n\n if (replacer) {\n obj = replacer(key, obj);\n }\n\n let i;\n\n for (i = 0; i < stack.length; i += 1) {\n if (stack[i] === obj) {\n return replacementStack[i];\n }\n }\n\n let canonicalizedObj;\n\n if ('[object Array]' === Object.prototype.toString.call(obj)) {\n stack.push(obj);\n canonicalizedObj = new Array(obj.length);\n replacementStack.push(canonicalizedObj);\n for (i = 0; i < obj.length; i += 1) {\n canonicalizedObj[i] = canonicalize(obj[i], stack, replacementStack, replacer, key);\n }\n stack.pop();\n replacementStack.pop();\n return canonicalizedObj;\n }\n\n if (obj && obj.toJSON) {\n obj = obj.toJSON();\n }\n\n if (typeof obj === 'object' && obj !== null) {\n stack.push(obj);\n canonicalizedObj = {};\n replacementStack.push(canonicalizedObj);\n let sortedKeys = [],\n key;\n for (key in obj) {\n /* istanbul ignore else */\n if (Object.prototype.hasOwnProperty.call(obj, key)) {\n sortedKeys.push(key);\n }\n }\n sortedKeys.sort();\n for (i = 0; i < sortedKeys.length; i += 1) {\n key = sortedKeys[i];\n canonicalizedObj[key] = canonicalize(obj[key], stack, replacementStack, replacer, key);\n }\n stack.pop();\n replacementStack.pop();\n } else {\n canonicalizedObj = obj;\n }\n return canonicalizedObj;\n}\n"],"names":["e","oldObj","newObj","options","jsonDiff","diff","_base","__esModule","default","_exports","Diff","canonicalize","obj","stack","replacementStack","replacer","key","i","canonicalizedObj","length","Object","prototype","toString","call","push","Array","pop","toJSON","sortedKeys","hasOwnProperty","sort","useLongestToken","tokenize","lineDiff","castInput","value","undefinedReplacement","stringifyReplacer","k","v","JSON","stringify","equals","left","right","replace"],"mappings":"2GAA0B,IAAAA,+GAkBnB,SAAkBC,OAAQC,OAAQC,SAAW,OAAOC,SAASC,KAAKJ,OAAQC,OAAQC,QAAU,2BAlBnGG,OAA0BN,EAA1BM,QAA0BN,EAAAO,WAAAP,EAAAQ,CAAAA,QAAAR,GAGnB,MAAMI,SAAQK,SAAAL,SAAG,IAAIM,MAAIF,QAmBzB,SAASG,aAAaC,IAAKC,MAAOC,iBAAkBC,SAAUC,KAQnE,IAAIC,EAQAC,iBANJ,IATAL,MAAQA,OAAS,GACjBC,iBAAmBA,kBAAoB,GAEnCC,WACFH,IAAMG,SAASC,IAAKJ,MAKjBK,EAAI,EAAGA,EAAIJ,MAAMM,OAAQF,GAAK,EACjC,GAAIJ,MAAMI,KAAOL,IACf,OAAOE,iBAAiBG,GAM5B,GAAI,mBAAqBG,OAAOC,UAAUC,SAASC,KAAKX,KAAM,CAI5D,IAHAC,MAAMW,KAAKZ,KACXM,iBAAmB,IAAIO,MAAMb,IAAIO,QACjCL,iBAAiBU,KAAKN,kBACjBD,EAAI,EAAGA,EAAIL,IAAIO,OAAQF,GAAK,EAC/BC,iBAAiBD,GAAKN,aAAaC,IAAIK,GAAIJ,MAAOC,iBAAkBC,SAAUC,KAIhF,OAFAH,MAAMa,MACNZ,iBAAiBY,MACVR,gBACT,CAMA,GAJIN,KAAOA,IAAIe,SACbf,IAAMA,IAAIe,UAGO,iBAARf,KAA4B,OAARA,IAAc,CAC3CC,MAAMW,KAAKZ,KACXM,iBAAmB,CAAA,EACnBJ,iBAAiBU,KAAKN,kBACtB,IACIF,IADAY,WAAa,GAEjB,IAAKZ,OAAOJ,IAENQ,OAAOC,UAAUQ,eAAeN,KAAKX,IAAKI,MAC5CY,WAAWJ,KAAKR,KAIpB,IADAY,WAAWE,OACNb,EAAI,EAAGA,EAAIW,WAAWT,OAAQF,GAAK,EACtCD,IAAMY,WAAWX,GACjBC,iBAAiBF,KAAOL,aAAaC,IAAII,KAAMH,MAAOC,iBAAkBC,SAAUC,KAEpFH,MAAMa,MACNZ,iBAAiBY,KACnB,MACER,iBAAmBN,IAErB,OAAOM,gBACT,CAzEAd,SAAS2B,iBAAkB,EAE3B3B,SAAS4B,SAAWC,MAAAA,SAASD,SAC7B5B,SAAS8B,UAAY,SAASC,MAAOhC,SACnC,MAAMiC,qBAACA,qBAAoBC,kBAAEA,kBAAoBA,CAACC,EAAGC,SAAmB,IAANA,EAAoBH,qBAAuBG,GAAKpC,QAElH,MAAwB,iBAAVgC,MAAqBA,MAAQK,KAAKC,UAAU9B,aAAawB,MAAO,KAAM,KAAME,mBAAoBA,kBAAmB,OAEnIjC,SAASsC,OAAS,SAASC,KAAMC,MAAOzC,SACtC,OAAOO,MAAIF,QAACa,UAAUqB,OAAOnB,KAAKnB,SAAUuC,KAAKE,QAAQ,aAAc,MAAOD,MAAMC,QAAQ,aAAc,MAAO1C,SAgElH"} \ No newline at end of file diff --git a/lib/editor/tiny/plugins/collaborative/amd/build/jsdiff/diff/line.min.js b/lib/editor/tiny/plugins/collaborative/amd/build/jsdiff/diff/line.min.js index c6104f5fda090..a050e868ef672 100644 --- a/lib/editor/tiny/plugins/collaborative/amd/build/jsdiff/diff/line.min.js +++ b/lib/editor/tiny/plugins/collaborative/amd/build/jsdiff/diff/line.min.js @@ -1,3 +1,3 @@ -define("tiny_collaborative/jsdiff/diff/line",["exports","./base","../util/params"],(function(_exports,_base,_params){var obj;Object.defineProperty(_exports,"__esModule",{value:!0}),_exports.diffLines=function(oldStr,newStr,callback){return lineDiff.diff(oldStr,newStr,callback)},_exports.diffTrimmedLines=function(oldStr,newStr,callback){let options=(0,_params.generateOptions)(callback,{ignoreWhitespace:!0});return lineDiff.diff(oldStr,newStr,options)},_exports.lineDiff=void 0;const lineDiff=new(_base=(obj=_base)&&obj.__esModule?obj:{default:obj}).default;_exports.lineDiff=lineDiff,lineDiff.tokenize=function(value,options){options.stripTrailingCr&&(value=value.replace(/\r\n/g,"\n"));let retLines=[],linesAndNewlines=value.split(/(\n|\r\n)/);linesAndNewlines[linesAndNewlines.length-1]||linesAndNewlines.pop();for(let i=0;i1&&void 0!==arguments[1]?arguments[1]:{};if(options.intlSegmenter){if("word"!=options.intlSegmenter.resolvedOptions().granularity)throw new Error('The segmenter passed must have a granularity of "word"');parts=Array.from(options.intlSegmenter.segment(value),(segment=>segment.segment))}else parts=value.match(tokenizeIncludingWhitespace)||[];const tokens=[];let prevPart=null;return parts.forEach((part=>{/\s/.test(part)?null==prevPart?tokens.push(part):tokens.push(tokens.pop()+part):/\s/.test(prevPart)?tokens[tokens.length-1]==prevPart?tokens.push(tokens.pop()+part):tokens.push(prevPart+part):tokens.push(part),prevPart=part})),tokens},wordDiff.join=function(tokens){return tokens.map(((token,i)=>0==i?token:token.replace(/^\s+/,""))).join("")},wordDiff.postProcess=function(changes,options){if(!changes||options.oneChangePerToken)return changes;let lastKeep=null,insertion=null,deletion=null;return changes.forEach((change=>{change.added?insertion=change:change.removed?deletion=change:((insertion||deletion)&&dedupeWhitespaceInChangeObjects(lastKeep,deletion,insertion,change),lastKeep=change,insertion=null,deletion=null)})),(insertion||deletion)&&dedupeWhitespaceInChangeObjects(lastKeep,deletion,insertion,null),changes};const wordWithSpaceDiff=new _base.default;function diffWordsWithSpace(oldStr,newStr,options){return wordWithSpaceDiff.diff(oldStr,newStr,options)}_exports.wordWithSpaceDiff=wordWithSpaceDiff,wordWithSpaceDiff.tokenize=function(value){const regex=new RegExp("(\\r?\\n)|[".concat(extendedWordChars,"]+|[^\\S\\n\\r]+|[^").concat(extendedWordChars,"]"),"ug");return value.match(regex)||[]}})); +define("tiny_collaborative/jsdiff/diff/word",["exports","./base","../util/string"],(function(_exports,_base,_string){var e;Object.defineProperty(_exports,"__esModule",{value:!0}),_exports.diffWords=function(oldStr,newStr,options){if(null!=options?.ignoreWhitespace&&!options.ignoreWhitespace)return diffWordsWithSpace(oldStr,newStr,options);return wordDiff.diff(oldStr,newStr,options)},_exports.diffWordsWithSpace=diffWordsWithSpace,_exports.wordWithSpaceDiff=_exports.wordDiff=void 0,_base=(e=_base)&&e.__esModule?e:{default:e};const extendedWordChars="a-zA-Z\\u{C0}-\\u{FF}\\u{D8}-\\u{F6}\\u{F8}-\\u{2C6}\\u{2C8}-\\u{2D7}\\u{2DE}-\\u{2FF}\\u{1E00}-\\u{1EFF}",tokenizeIncludingWhitespace=new RegExp(`[${extendedWordChars}]+|\\s+|[^${extendedWordChars}]`,"ug"),wordDiff=_exports.wordDiff=new _base.default;function dedupeWhitespaceInChangeObjects(startKeep,deletion,insertion,endKeep){if(deletion&&insertion){const oldWsPrefix=deletion.value.match(/^\s*/)[0],oldWsSuffix=deletion.value.match(/\s*$/)[0],newWsPrefix=insertion.value.match(/^\s*/)[0],newWsSuffix=insertion.value.match(/\s*$/)[0];if(startKeep){const commonWsPrefix=(0,_string.longestCommonPrefix)(oldWsPrefix,newWsPrefix);startKeep.value=(0,_string.replaceSuffix)(startKeep.value,newWsPrefix,commonWsPrefix),deletion.value=(0,_string.removePrefix)(deletion.value,commonWsPrefix),insertion.value=(0,_string.removePrefix)(insertion.value,commonWsPrefix)}if(endKeep){const commonWsSuffix=(0,_string.longestCommonSuffix)(oldWsSuffix,newWsSuffix);endKeep.value=(0,_string.replacePrefix)(endKeep.value,newWsSuffix,commonWsSuffix),deletion.value=(0,_string.removeSuffix)(deletion.value,commonWsSuffix),insertion.value=(0,_string.removeSuffix)(insertion.value,commonWsSuffix)}}else if(insertion)startKeep&&(insertion.value=insertion.value.replace(/^\s*/,"")),endKeep&&(endKeep.value=endKeep.value.replace(/^\s*/,""));else if(startKeep&&endKeep){const newWsFull=endKeep.value.match(/^\s*/)[0],delWsStart=deletion.value.match(/^\s*/)[0],delWsEnd=deletion.value.match(/\s*$/)[0],newWsStart=(0,_string.longestCommonPrefix)(newWsFull,delWsStart);deletion.value=(0,_string.removePrefix)(deletion.value,newWsStart);const newWsEnd=(0,_string.longestCommonSuffix)((0,_string.removePrefix)(newWsFull,newWsStart),delWsEnd);deletion.value=(0,_string.removeSuffix)(deletion.value,newWsEnd),endKeep.value=(0,_string.replacePrefix)(endKeep.value,newWsFull,newWsEnd),startKeep.value=(0,_string.replaceSuffix)(startKeep.value,newWsFull,newWsFull.slice(0,newWsFull.length-newWsEnd.length))}else if(endKeep){const endKeepWsPrefix=endKeep.value.match(/^\s*/)[0],deletionWsSuffix=deletion.value.match(/\s*$/)[0],overlap=(0,_string.maximumOverlap)(deletionWsSuffix,endKeepWsPrefix);deletion.value=(0,_string.removeSuffix)(deletion.value,overlap)}else if(startKeep){const startKeepWsSuffix=startKeep.value.match(/\s*$/)[0],deletionWsPrefix=deletion.value.match(/^\s*/)[0],overlap=(0,_string.maximumOverlap)(startKeepWsSuffix,deletionWsPrefix);deletion.value=(0,_string.removePrefix)(deletion.value,overlap)}}wordDiff.equals=function(left,right,options){return options.ignoreCase&&(left=left.toLowerCase(),right=right.toLowerCase()),left.trim()===right.trim()},wordDiff.tokenize=function(value){let parts,options=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{};if(options.intlSegmenter){if("word"!=options.intlSegmenter.resolvedOptions().granularity)throw new Error('The segmenter passed must have a granularity of "word"');parts=Array.from(options.intlSegmenter.segment(value),(segment=>segment.segment))}else parts=value.match(tokenizeIncludingWhitespace)||[];const tokens=[];let prevPart=null;return parts.forEach((part=>{/\s/.test(part)?null==prevPart?tokens.push(part):tokens.push(tokens.pop()+part):/\s/.test(prevPart)?tokens[tokens.length-1]==prevPart?tokens.push(tokens.pop()+part):tokens.push(prevPart+part):tokens.push(part),prevPart=part})),tokens},wordDiff.join=function(tokens){return tokens.map(((token,i)=>0==i?token:token.replace(/^\s+/,""))).join("")},wordDiff.postProcess=function(changes,options){if(!changes||options.oneChangePerToken)return changes;let lastKeep=null,insertion=null,deletion=null;return changes.forEach((change=>{change.added?insertion=change:change.removed?deletion=change:((insertion||deletion)&&dedupeWhitespaceInChangeObjects(lastKeep,deletion,insertion,change),lastKeep=change,insertion=null,deletion=null)})),(insertion||deletion)&&dedupeWhitespaceInChangeObjects(lastKeep,deletion,insertion,null),changes};const wordWithSpaceDiff=_exports.wordWithSpaceDiff=new _base.default;function diffWordsWithSpace(oldStr,newStr,options){return wordWithSpaceDiff.diff(oldStr,newStr,options)}wordWithSpaceDiff.tokenize=function(value){const regex=new RegExp(`(\\r?\\n)|[${extendedWordChars}]+|[^\\S\\n\\r]+|[^${extendedWordChars}]`,"ug");return value.match(regex)||[]}})); //# sourceMappingURL=word.min.js.map \ No newline at end of file diff --git a/lib/editor/tiny/plugins/collaborative/amd/build/jsdiff/diff/word.min.js.map b/lib/editor/tiny/plugins/collaborative/amd/build/jsdiff/diff/word.min.js.map index 5ae9970165d19..1286a541ad689 100644 --- a/lib/editor/tiny/plugins/collaborative/amd/build/jsdiff/diff/word.min.js.map +++ b/lib/editor/tiny/plugins/collaborative/amd/build/jsdiff/diff/word.min.js.map @@ -1 +1 @@ -{"version":3,"file":"word.min.js","sources":["../../../src/jsdiff/diff/word.js"],"sourcesContent":["import Diff from './base';\nimport { longestCommonPrefix, longestCommonSuffix, replacePrefix, replaceSuffix, removePrefix, removeSuffix, maximumOverlap } from '../util/string';\n\n// Based on https://en.wikipedia.org/wiki/Latin_script_in_Unicode\n//\n// Ranges and exceptions:\n// Latin-1 Supplement, 0080–00FF\n// - U+00D7 × Multiplication sign\n// - U+00F7 ÷ Division sign\n// Latin Extended-A, 0100–017F\n// Latin Extended-B, 0180–024F\n// IPA Extensions, 0250–02AF\n// Spacing Modifier Letters, 02B0–02FF\n// - U+02C7 ˇ ˇ Caron\n// - U+02D8 ˘ ˘ Breve\n// - U+02D9 ˙ ˙ Dot Above\n// - U+02DA ˚ ˚ Ring Above\n// - U+02DB ˛ ˛ Ogonek\n// - U+02DC ˜ ˜ Small Tilde\n// - U+02DD ˝ ˝ Double Acute Accent\n// Latin Extended Additional, 1E00–1EFF\nconst extendedWordChars = 'a-zA-Z\\\\u{C0}-\\\\u{FF}\\\\u{D8}-\\\\u{F6}\\\\u{F8}-\\\\u{2C6}\\\\u{2C8}-\\\\u{2D7}\\\\u{2DE}-\\\\u{2FF}\\\\u{1E00}-\\\\u{1EFF}';\n\n// Each token is one of the following:\n// - A punctuation mark plus the surrounding whitespace\n// - A word plus the surrounding whitespace\n// - Pure whitespace (but only in the special case where this the entire text\n// is just whitespace)\n//\n// We have to include surrounding whitespace in the tokens because the two\n// alternative approaches produce horribly broken results:\n// * If we just discard the whitespace, we can't fully reproduce the original\n// text from the sequence of tokens and any attempt to render the diff will\n// get the whitespace wrong.\n// * If we have separate tokens for whitespace, then in a typical text every\n// second token will be a single space character. But this often results in\n// the optimal diff between two texts being a perverse one that preserves\n// the spaces between words but deletes and reinserts actual common words.\n// See https://github.com/kpdecker/jsdiff/issues/160#issuecomment-1866099640\n// for an example.\n//\n// Keeping the surrounding whitespace of course has implications for .equals\n// and .join, not just .tokenize.\n\n// This regex does NOT fully implement the tokenization rules described above.\n// Instead, it gives runs of whitespace their own \"token\". The tokenize method\n// then handles stitching whitespace tokens onto adjacent word or punctuation\n// tokens.\nconst tokenizeIncludingWhitespace = new RegExp(`[${extendedWordChars}]+|\\\\s+|[^${extendedWordChars}]`, 'ug');\n\nexport const wordDiff = new Diff();\nwordDiff.equals = function(left, right, options) {\n if (options.ignoreCase) {\n left = left.toLowerCase();\n right = right.toLowerCase();\n }\n\n return left.trim() === right.trim();\n};\n\nwordDiff.tokenize = function(value, options = {}) {\n let parts;\n if (options.intlSegmenter) {\n if (options.intlSegmenter.resolvedOptions().granularity != 'word') {\n throw new Error('The segmenter passed must have a granularity of \"word\"');\n }\n parts = Array.from(options.intlSegmenter.segment(value), segment => segment.segment);\n } else {\n parts = value.match(tokenizeIncludingWhitespace) || [];\n }\n const tokens = [];\n let prevPart = null;\n parts.forEach(part => {\n if ((/\\s/).test(part)) {\n if (prevPart == null) {\n tokens.push(part);\n } else {\n tokens.push(tokens.pop() + part);\n }\n } else if ((/\\s/).test(prevPart)) {\n if (tokens[tokens.length - 1] == prevPart) {\n tokens.push(tokens.pop() + part);\n } else {\n tokens.push(prevPart + part);\n }\n } else {\n tokens.push(part);\n }\n\n prevPart = part;\n });\n return tokens;\n};\n\nwordDiff.join = function(tokens) {\n // Tokens being joined here will always have appeared consecutively in the\n // same text, so we can simply strip off the leading whitespace from all the\n // tokens except the first (and except any whitespace-only tokens - but such\n // a token will always be the first and only token anyway) and then join them\n // and the whitespace around words and punctuation will end up correct.\n return tokens.map((token, i) => {\n if (i == 0) {\n return token;\n } else {\n return token.replace((/^\\s+/), '');\n }\n }).join('');\n};\n\nwordDiff.postProcess = function(changes, options) {\n if (!changes || options.oneChangePerToken) {\n return changes;\n }\n\n let lastKeep = null;\n // Change objects representing any insertion or deletion since the last\n // \"keep\" change object. There can be at most one of each.\n let insertion = null;\n let deletion = null;\n changes.forEach(change => {\n if (change.added) {\n insertion = change;\n } else if (change.removed) {\n deletion = change;\n } else {\n if (insertion || deletion) { // May be false at start of text\n dedupeWhitespaceInChangeObjects(lastKeep, deletion, insertion, change);\n }\n lastKeep = change;\n insertion = null;\n deletion = null;\n }\n });\n if (insertion || deletion) {\n dedupeWhitespaceInChangeObjects(lastKeep, deletion, insertion, null);\n }\n return changes;\n};\n\nexport function diffWords(oldStr, newStr, options) {\n // This option has never been documented and never will be (it's clearer to\n // just call `diffWordsWithSpace` directly if you need that behavior), but\n // has existed in jsdiff for a long time, so we retain support for it here\n // for the sake of backwards compatibility.\n if (options?.ignoreWhitespace != null && !options.ignoreWhitespace) {\n return diffWordsWithSpace(oldStr, newStr, options);\n }\n\n return wordDiff.diff(oldStr, newStr, options);\n}\n\nfunction dedupeWhitespaceInChangeObjects(startKeep, deletion, insertion, endKeep) {\n // Before returning, we tidy up the leading and trailing whitespace of the\n // change objects to eliminate cases where trailing whitespace in one object\n // is repeated as leading whitespace in the next.\n // Below are examples of the outcomes we want here to explain the code.\n // I=insert, K=keep, D=delete\n // 1. diffing 'foo bar baz' vs 'foo baz'\n // Prior to cleanup, we have K:'foo ' D:' bar ' K:' baz'\n // After cleanup, we want: K:'foo ' D:'bar ' K:'baz'\n //\n // 2. Diffing 'foo bar baz' vs 'foo qux baz'\n // Prior to cleanup, we have K:'foo ' D:' bar ' I:' qux ' K:' baz'\n // After cleanup, we want K:'foo ' D:'bar' I:'qux' K:' baz'\n //\n // 3. Diffing 'foo\\nbar baz' vs 'foo baz'\n // Prior to cleanup, we have K:'foo ' D:'\\nbar ' K:' baz'\n // After cleanup, we want K'foo' D:'\\nbar' K:' baz'\n //\n // 4. Diffing 'foo baz' vs 'foo\\nbar baz'\n // Prior to cleanup, we have K:'foo\\n' I:'\\nbar ' K:' baz'\n // After cleanup, we ideally want K'foo' I:'\\nbar' K:' baz'\n // but don't actually manage this currently (the pre-cleanup change\n // objects don't contain enough information to make it possible).\n //\n // 5. Diffing 'foo bar baz' vs 'foo baz'\n // Prior to cleanup, we have K:'foo ' D:' bar ' K:' baz'\n // After cleanup, we want K:'foo ' D:' bar ' K:'baz'\n //\n // Our handling is unavoidably imperfect in the case where there's a single\n // indel between keeps and the whitespace has changed. For instance, consider\n // diffing 'foo\\tbar\\nbaz' vs 'foo baz'. Unless we create an extra change\n // object to represent the insertion of the space character (which isn't even\n // a token), we have no way to avoid losing information about the texts'\n // original whitespace in the result we return. Still, we do our best to\n // output something that will look sensible if we e.g. print it with\n // insertions in green and deletions in red.\n\n // Between two \"keep\" change objects (or before the first or after the last\n // change object), we can have either:\n // * A \"delete\" followed by an \"insert\"\n // * Just an \"insert\"\n // * Just a \"delete\"\n // We handle the three cases separately.\n if (deletion && insertion) {\n const oldWsPrefix = deletion.value.match(/^\\s*/)[0];\n const oldWsSuffix = deletion.value.match(/\\s*$/)[0];\n const newWsPrefix = insertion.value.match(/^\\s*/)[0];\n const newWsSuffix = insertion.value.match(/\\s*$/)[0];\n\n if (startKeep) {\n const commonWsPrefix = longestCommonPrefix(oldWsPrefix, newWsPrefix);\n startKeep.value = replaceSuffix(startKeep.value, newWsPrefix, commonWsPrefix);\n deletion.value = removePrefix(deletion.value, commonWsPrefix);\n insertion.value = removePrefix(insertion.value, commonWsPrefix);\n }\n if (endKeep) {\n const commonWsSuffix = longestCommonSuffix(oldWsSuffix, newWsSuffix);\n endKeep.value = replacePrefix(endKeep.value, newWsSuffix, commonWsSuffix);\n deletion.value = removeSuffix(deletion.value, commonWsSuffix);\n insertion.value = removeSuffix(insertion.value, commonWsSuffix);\n }\n } else if (insertion) {\n // The whitespaces all reflect what was in the new text rather than\n // the old, so we essentially have no information about whitespace\n // insertion or deletion. We just want to dedupe the whitespace.\n // We do that by having each change object keep its trailing\n // whitespace and deleting duplicate leading whitespace where\n // present.\n if (startKeep) {\n insertion.value = insertion.value.replace(/^\\s*/, '');\n }\n if (endKeep) {\n endKeep.value = endKeep.value.replace(/^\\s*/, '');\n }\n // otherwise we've got a deletion and no insertion\n } else if (startKeep && endKeep) {\n const newWsFull = endKeep.value.match(/^\\s*/)[0],\n delWsStart = deletion.value.match(/^\\s*/)[0],\n delWsEnd = deletion.value.match(/\\s*$/)[0];\n\n // Any whitespace that comes straight after startKeep in both the old and\n // new texts, assign to startKeep and remove from the deletion.\n const newWsStart = longestCommonPrefix(newWsFull, delWsStart);\n deletion.value = removePrefix(deletion.value, newWsStart);\n\n // Any whitespace that comes straight before endKeep in both the old and\n // new texts, and hasn't already been assigned to startKeep, assign to\n // endKeep and remove from the deletion.\n const newWsEnd = longestCommonSuffix(\n removePrefix(newWsFull, newWsStart),\n delWsEnd\n );\n deletion.value = removeSuffix(deletion.value, newWsEnd);\n endKeep.value = replacePrefix(endKeep.value, newWsFull, newWsEnd);\n\n // If there's any whitespace from the new text that HASN'T already been\n // assigned, assign it to the start:\n startKeep.value = replaceSuffix(\n startKeep.value,\n newWsFull,\n newWsFull.slice(0, newWsFull.length - newWsEnd.length)\n );\n } else if (endKeep) {\n // We are at the start of the text. Preserve all the whitespace on\n // endKeep, and just remove whitespace from the end of deletion to the\n // extent that it overlaps with the start of endKeep.\n const endKeepWsPrefix = endKeep.value.match(/^\\s*/)[0];\n const deletionWsSuffix = deletion.value.match(/\\s*$/)[0];\n const overlap = maximumOverlap(deletionWsSuffix, endKeepWsPrefix);\n deletion.value = removeSuffix(deletion.value, overlap);\n } else if (startKeep) {\n // We are at the END of the text. Preserve all the whitespace on\n // startKeep, and just remove whitespace from the start of deletion to\n // the extent that it overlaps with the end of startKeep.\n const startKeepWsSuffix = startKeep.value.match(/\\s*$/)[0];\n const deletionWsPrefix = deletion.value.match(/^\\s*/)[0];\n const overlap = maximumOverlap(startKeepWsSuffix, deletionWsPrefix);\n deletion.value = removePrefix(deletion.value, overlap);\n }\n}\n\n\nexport const wordWithSpaceDiff = new Diff();\nwordWithSpaceDiff.tokenize = function(value) {\n // Slightly different to the tokenizeIncludingWhitespace regex used above in\n // that this one treats each individual newline as a distinct tokens, rather\n // than merging them into other surrounding whitespace. This was requested\n // in https://github.com/kpdecker/jsdiff/issues/180 &\n // https://github.com/kpdecker/jsdiff/issues/211\n const regex = new RegExp(`(\\\\r?\\\\n)|[${extendedWordChars}]+|[^\\\\S\\\\n\\\\r]+|[^${extendedWordChars}]`, 'ug');\n return value.match(regex) || [];\n};\nexport function diffWordsWithSpace(oldStr, newStr, options) {\n return wordWithSpaceDiff.diff(oldStr, newStr, options);\n}\n"],"names":["oldStr","newStr","options","ignoreWhitespace","diffWordsWithSpace","wordDiff","diff","extendedWordChars","tokenizeIncludingWhitespace","RegExp","Diff","dedupeWhitespaceInChangeObjects","startKeep","deletion","insertion","endKeep","oldWsPrefix","value","match","oldWsSuffix","newWsPrefix","newWsSuffix","commonWsPrefix","commonWsSuffix","replace","newWsFull","delWsStart","delWsEnd","newWsStart","newWsEnd","slice","length","endKeepWsPrefix","deletionWsSuffix","overlap","startKeepWsSuffix","deletionWsPrefix","equals","left","right","ignoreCase","toLowerCase","trim","tokenize","parts","intlSegmenter","resolvedOptions","granularity","Error","Array","from","segment","tokens","prevPart","forEach","part","test","push","pop","join","map","token","i","postProcess","changes","oneChangePerToken","lastKeep","change","added","removed","wordWithSpaceDiff","regex"],"mappings":"iNA2I0BA,OAAQC,OAAQC,YAKP,OAA7BA,MAAAA,eAAAA,QAASC,oBAA6BD,QAAQC,wBACzCC,mBAAmBJ,OAAQC,OAAQC,gBAGrCG,SAASC,KAAKN,OAAQC,OAAQC,uKA/HjCK,kBAAoB,4GA2BpBC,4BAA8B,IAAIC,kBAAWF,uCAA8BA,uBAAsB,MAE1FF,SAAW,IAAIK,uBAqGnBC,gCAAgCC,UAAWC,SAAUC,UAAWC,YA2CnEF,UAAYC,UAAW,OACnBE,YAAcH,SAASI,MAAMC,MAAM,QAAQ,GAC3CC,YAAcN,SAASI,MAAMC,MAAM,QAAQ,GAC3CE,YAAcN,UAAUG,MAAMC,MAAM,QAAQ,GAC5CG,YAAcP,UAAUG,MAAMC,MAAM,QAAQ,MAE9CN,UAAW,OACPU,gBAAiB,+BAAoBN,YAAaI,aACxDR,UAAUK,OAAQ,yBAAcL,UAAUK,MAAOG,YAAaE,gBAC9DT,SAASI,OAAQ,wBAAaJ,SAASI,MAAOK,gBAC9CR,UAAUG,OAAQ,wBAAaH,UAAUG,MAAOK,mBAE9CP,QAAS,OACLQ,gBAAiB,+BAAoBJ,YAAaE,aACxDN,QAAQE,OAAQ,yBAAcF,QAAQE,MAAOI,YAAaE,gBAC1DV,SAASI,OAAQ,wBAAaJ,SAASI,MAAOM,gBAC9CT,UAAUG,OAAQ,wBAAaH,UAAUG,MAAOM,sBAE7C,GAAIT,UAOL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M,0DAElBJ,MAAQK,MAAMC,KAAKhD,QAAQ2C,cAAcM,QAAQlC,QAAQkC,SAAWA,QAAQA,eAE5EP,MAAQ3B,MAAMC,MAAMV,8BAAgC,SAEhD4C,OAAS,OACXC,SAAW,YACfT,MAAMU,SAAQC,OACP,KAAMC,KAAKD,MACE,MAAZF,SACFD,OAAOK,KAAKF,MAEZH,OAAOK,KAAKL,OAAOM,MAAQH,MAEnB,KAAMC,KAAKH,UACjBD,OAAOA,OAAOrB,OAAS,IAAMsB,SAC/BD,OAAOK,KAAKL,OAAOM,MAAQH,MAE3BH,OAAOK,KAAKJ,SAAWE,MAGzBH,OAAOK,KAAKF,MAGdF,SAAWE,QAENH,QAGT/C,SAASsD,KAAO,SAASP,eAMhBA,OAAOQ,KAAI,CAACC,MAAOC,IACf,GAALA,EACKD,MAEAA,MAAMrC,QAAS,OAAS,MAEhCmC,KAAK,KAGVtD,SAAS0D,YAAc,SAASC,QAAS9D,aAClC8D,SAAW9D,QAAQ+D,yBACfD,YAGLE,SAAW,KAGXpD,UAAY,KACZD,SAAW,YACfmD,QAAQV,SAAQa,SACVA,OAAOC,MACTtD,UAAYqD,OACHA,OAAOE,QAChBxD,SAAWsD,SAEPrD,WAAaD,WACfF,gCAAgCuD,SAAUrD,SAAUC,UAAWqD,QAEjED,SAAWC,OACXrD,UAAY,KACZD,SAAW,UAGXC,WAAaD,WACfF,gCAAgCuD,SAAUrD,SAAUC,UAAW,MAE1DkD,eAyIIM,kBAAoB,IAAI5D,uBAUrBN,mBAAmBJ,OAAQC,OAAQC,gBAC1CoE,kBAAkBhE,KAAKN,OAAQC,OAAQC,sDAVhDoE,kBAAkB3B,SAAW,SAAS1B,aAM9BsD,MAAQ,IAAI9D,4BAAqBF,gDAAuCA,uBAAsB,aAC7FU,MAAMC,MAAMqD,QAAU"} \ No newline at end of file +{"version":3,"file":"word.min.js","sources":["../../../src/jsdiff/diff/word.js"],"sourcesContent":["import Diff from './base';\nimport { longestCommonPrefix, longestCommonSuffix, replacePrefix, replaceSuffix, removePrefix, removeSuffix, maximumOverlap } from '../util/string';\n\n// Based on https://en.wikipedia.org/wiki/Latin_script_in_Unicode\n//\n// Ranges and exceptions:\n// Latin-1 Supplement, 0080–00FF\n// - U+00D7 × Multiplication sign\n// - U+00F7 ÷ Division sign\n// Latin Extended-A, 0100–017F\n// Latin Extended-B, 0180–024F\n// IPA Extensions, 0250–02AF\n// Spacing Modifier Letters, 02B0–02FF\n// - U+02C7 ˇ ˇ Caron\n// - U+02D8 ˘ ˘ Breve\n// - U+02D9 ˙ ˙ Dot Above\n// - U+02DA ˚ ˚ Ring Above\n// - U+02DB ˛ ˛ Ogonek\n// - U+02DC ˜ ˜ Small Tilde\n// - U+02DD ˝ ˝ Double Acute Accent\n// Latin Extended Additional, 1E00–1EFF\nconst extendedWordChars = 'a-zA-Z\\\\u{C0}-\\\\u{FF}\\\\u{D8}-\\\\u{F6}\\\\u{F8}-\\\\u{2C6}\\\\u{2C8}-\\\\u{2D7}\\\\u{2DE}-\\\\u{2FF}\\\\u{1E00}-\\\\u{1EFF}';\n\n// Each token is one of the following:\n// - A punctuation mark plus the surrounding whitespace\n// - A word plus the surrounding whitespace\n// - Pure whitespace (but only in the special case where this the entire text\n// is just whitespace)\n//\n// We have to include surrounding whitespace in the tokens because the two\n// alternative approaches produce horribly broken results:\n// * If we just discard the whitespace, we can't fully reproduce the original\n// text from the sequence of tokens and any attempt to render the diff will\n// get the whitespace wrong.\n// * If we have separate tokens for whitespace, then in a typical text every\n// second token will be a single space character. But this often results in\n// the optimal diff between two texts being a perverse one that preserves\n// the spaces between words but deletes and reinserts actual common words.\n// See https://github.com/kpdecker/jsdiff/issues/160#issuecomment-1866099640\n// for an example.\n//\n// Keeping the surrounding whitespace of course has implications for .equals\n// and .join, not just .tokenize.\n\n// This regex does NOT fully implement the tokenization rules described above.\n// Instead, it gives runs of whitespace their own \"token\". The tokenize method\n// then handles stitching whitespace tokens onto adjacent word or punctuation\n// tokens.\nconst tokenizeIncludingWhitespace = new RegExp(`[${extendedWordChars}]+|\\\\s+|[^${extendedWordChars}]`, 'ug');\n\nexport const wordDiff = new Diff();\nwordDiff.equals = function(left, right, options) {\n if (options.ignoreCase) {\n left = left.toLowerCase();\n right = right.toLowerCase();\n }\n\n return left.trim() === right.trim();\n};\n\nwordDiff.tokenize = function(value, options = {}) {\n let parts;\n if (options.intlSegmenter) {\n if (options.intlSegmenter.resolvedOptions().granularity != 'word') {\n throw new Error('The segmenter passed must have a granularity of \"word\"');\n }\n parts = Array.from(options.intlSegmenter.segment(value), segment => segment.segment);\n } else {\n parts = value.match(tokenizeIncludingWhitespace) || [];\n }\n const tokens = [];\n let prevPart = null;\n parts.forEach(part => {\n if ((/\\s/).test(part)) {\n if (prevPart == null) {\n tokens.push(part);\n } else {\n tokens.push(tokens.pop() + part);\n }\n } else if ((/\\s/).test(prevPart)) {\n if (tokens[tokens.length - 1] == prevPart) {\n tokens.push(tokens.pop() + part);\n } else {\n tokens.push(prevPart + part);\n }\n } else {\n tokens.push(part);\n }\n\n prevPart = part;\n });\n return tokens;\n};\n\nwordDiff.join = function(tokens) {\n // Tokens being joined here will always have appeared consecutively in the\n // same text, so we can simply strip off the leading whitespace from all the\n // tokens except the first (and except any whitespace-only tokens - but such\n // a token will always be the first and only token anyway) and then join them\n // and the whitespace around words and punctuation will end up correct.\n return tokens.map((token, i) => {\n if (i == 0) {\n return token;\n } else {\n return token.replace((/^\\s+/), '');\n }\n }).join('');\n};\n\nwordDiff.postProcess = function(changes, options) {\n if (!changes || options.oneChangePerToken) {\n return changes;\n }\n\n let lastKeep = null;\n // Change objects representing any insertion or deletion since the last\n // \"keep\" change object. There can be at most one of each.\n let insertion = null;\n let deletion = null;\n changes.forEach(change => {\n if (change.added) {\n insertion = change;\n } else if (change.removed) {\n deletion = change;\n } else {\n if (insertion || deletion) { // May be false at start of text\n dedupeWhitespaceInChangeObjects(lastKeep, deletion, insertion, change);\n }\n lastKeep = change;\n insertion = null;\n deletion = null;\n }\n });\n if (insertion || deletion) {\n dedupeWhitespaceInChangeObjects(lastKeep, deletion, insertion, null);\n }\n return changes;\n};\n\nexport function diffWords(oldStr, newStr, options) {\n // This option has never been documented and never will be (it's clearer to\n // just call `diffWordsWithSpace` directly if you need that behavior), but\n // has existed in jsdiff for a long time, so we retain support for it here\n // for the sake of backwards compatibility.\n if (options?.ignoreWhitespace != null && !options.ignoreWhitespace) {\n return diffWordsWithSpace(oldStr, newStr, options);\n }\n\n return wordDiff.diff(oldStr, newStr, options);\n}\n\nfunction dedupeWhitespaceInChangeObjects(startKeep, deletion, insertion, endKeep) {\n // Before returning, we tidy up the leading and trailing whitespace of the\n // change objects to eliminate cases where trailing whitespace in one object\n // is repeated as leading whitespace in the next.\n // Below are examples of the outcomes we want here to explain the code.\n // I=insert, K=keep, D=delete\n // 1. diffing 'foo bar baz' vs 'foo baz'\n // Prior to cleanup, we have K:'foo ' D:' bar ' K:' baz'\n // After cleanup, we want: K:'foo ' D:'bar ' K:'baz'\n //\n // 2. Diffing 'foo bar baz' vs 'foo qux baz'\n // Prior to cleanup, we have K:'foo ' D:' bar ' I:' qux ' K:' baz'\n // After cleanup, we want K:'foo ' D:'bar' I:'qux' K:' baz'\n //\n // 3. Diffing 'foo\\nbar baz' vs 'foo baz'\n // Prior to cleanup, we have K:'foo ' D:'\\nbar ' K:' baz'\n // After cleanup, we want K'foo' D:'\\nbar' K:' baz'\n //\n // 4. Diffing 'foo baz' vs 'foo\\nbar baz'\n // Prior to cleanup, we have K:'foo\\n' I:'\\nbar ' K:' baz'\n // After cleanup, we ideally want K'foo' I:'\\nbar' K:' baz'\n // but don't actually manage this currently (the pre-cleanup change\n // objects don't contain enough information to make it possible).\n //\n // 5. Diffing 'foo bar baz' vs 'foo baz'\n // Prior to cleanup, we have K:'foo ' D:' bar ' K:' baz'\n // After cleanup, we want K:'foo ' D:' bar ' K:'baz'\n //\n // Our handling is unavoidably imperfect in the case where there's a single\n // indel between keeps and the whitespace has changed. For instance, consider\n // diffing 'foo\\tbar\\nbaz' vs 'foo baz'. Unless we create an extra change\n // object to represent the insertion of the space character (which isn't even\n // a token), we have no way to avoid losing information about the texts'\n // original whitespace in the result we return. Still, we do our best to\n // output something that will look sensible if we e.g. print it with\n // insertions in green and deletions in red.\n\n // Between two \"keep\" change objects (or before the first or after the last\n // change object), we can have either:\n // * A \"delete\" followed by an \"insert\"\n // * Just an \"insert\"\n // * Just a \"delete\"\n // We handle the three cases separately.\n if (deletion && insertion) {\n const oldWsPrefix = deletion.value.match(/^\\s*/)[0];\n const oldWsSuffix = deletion.value.match(/\\s*$/)[0];\n const newWsPrefix = insertion.value.match(/^\\s*/)[0];\n const newWsSuffix = insertion.value.match(/\\s*$/)[0];\n\n if (startKeep) {\n const commonWsPrefix = longestCommonPrefix(oldWsPrefix, newWsPrefix);\n startKeep.value = replaceSuffix(startKeep.value, newWsPrefix, commonWsPrefix);\n deletion.value = removePrefix(deletion.value, commonWsPrefix);\n insertion.value = removePrefix(insertion.value, commonWsPrefix);\n }\n if (endKeep) {\n const commonWsSuffix = longestCommonSuffix(oldWsSuffix, newWsSuffix);\n endKeep.value = replacePrefix(endKeep.value, newWsSuffix, commonWsSuffix);\n deletion.value = removeSuffix(deletion.value, commonWsSuffix);\n insertion.value = removeSuffix(insertion.value, commonWsSuffix);\n }\n } else if (insertion) {\n // The whitespaces all reflect what was in the new text rather than\n // the old, so we essentially have no information about whitespace\n // insertion or deletion. We just want to dedupe the whitespace.\n // We do that by having each change object keep its trailing\n // whitespace and deleting duplicate leading whitespace where\n // present.\n if (startKeep) {\n insertion.value = insertion.value.replace(/^\\s*/, '');\n }\n if (endKeep) {\n endKeep.value = endKeep.value.replace(/^\\s*/, '');\n }\n // otherwise we've got a deletion and no insertion\n } else if (startKeep && endKeep) {\n const newWsFull = endKeep.value.match(/^\\s*/)[0],\n delWsStart = deletion.value.match(/^\\s*/)[0],\n delWsEnd = deletion.value.match(/\\s*$/)[0];\n\n // Any whitespace that comes straight after startKeep in both the old and\n // new texts, assign to startKeep and remove from the deletion.\n const newWsStart = longestCommonPrefix(newWsFull, delWsStart);\n deletion.value = removePrefix(deletion.value, newWsStart);\n\n // Any whitespace that comes straight before endKeep in both the old and\n // new texts, and hasn't already been assigned to startKeep, assign to\n // endKeep and remove from the deletion.\n const newWsEnd = longestCommonSuffix(\n removePrefix(newWsFull, newWsStart),\n delWsEnd\n );\n deletion.value = removeSuffix(deletion.value, newWsEnd);\n endKeep.value = replacePrefix(endKeep.value, newWsFull, newWsEnd);\n\n // If there's any whitespace from the new text that HASN'T already been\n // assigned, assign it to the start:\n startKeep.value = replaceSuffix(\n startKeep.value,\n newWsFull,\n newWsFull.slice(0, newWsFull.length - newWsEnd.length)\n );\n } else if (endKeep) {\n // We are at the start of the text. Preserve all the whitespace on\n // endKeep, and just remove whitespace from the end of deletion to the\n // extent that it overlaps with the start of endKeep.\n const endKeepWsPrefix = endKeep.value.match(/^\\s*/)[0];\n const deletionWsSuffix = deletion.value.match(/\\s*$/)[0];\n const overlap = maximumOverlap(deletionWsSuffix, endKeepWsPrefix);\n deletion.value = removeSuffix(deletion.value, overlap);\n } else if (startKeep) {\n // We are at the END of the text. Preserve all the whitespace on\n // startKeep, and just remove whitespace from the start of deletion to\n // the extent that it overlaps with the end of startKeep.\n const startKeepWsSuffix = startKeep.value.match(/\\s*$/)[0];\n const deletionWsPrefix = deletion.value.match(/^\\s*/)[0];\n const overlap = maximumOverlap(startKeepWsSuffix, deletionWsPrefix);\n deletion.value = removePrefix(deletion.value, overlap);\n }\n}\n\n\nexport const wordWithSpaceDiff = new Diff();\nwordWithSpaceDiff.tokenize = function(value) {\n // Slightly different to the tokenizeIncludingWhitespace regex used above in\n // that this one treats each individual newline as a distinct tokens, rather\n // than merging them into other surrounding whitespace. This was requested\n // in https://github.com/kpdecker/jsdiff/issues/180 &\n // https://github.com/kpdecker/jsdiff/issues/211\n const regex = new RegExp(`(\\\\r?\\\\n)|[${extendedWordChars}]+|[^\\\\S\\\\n\\\\r]+|[^${extendedWordChars}]`, 'ug');\n return value.match(regex) || [];\n};\nexport function diffWordsWithSpace(oldStr, newStr, options) {\n return wordWithSpaceDiff.diff(oldStr, newStr, options);\n}\n"],"names":["e","oldStr","newStr","options","ignoreWhitespace","diffWordsWithSpace","wordDiff","diff","_base","__esModule","default","extendedWordChars","tokenizeIncludingWhitespace","RegExp","_exports","Diff","dedupeWhitespaceInChangeObjects","startKeep","deletion","insertion","endKeep","oldWsPrefix","value","match","oldWsSuffix","newWsPrefix","newWsSuffix","commonWsPrefix","longestCommonPrefix","replaceSuffix","removePrefix","commonWsSuffix","longestCommonSuffix","replacePrefix","removeSuffix","replace","newWsFull","delWsStart","delWsEnd","newWsStart","newWsEnd","slice","length","endKeepWsPrefix","deletionWsSuffix","overlap","maximumOverlap","startKeepWsSuffix","deletionWsPrefix","equals","left","right","ignoreCase","toLowerCase","trim","tokenize","parts","arguments","undefined","intlSegmenter","resolvedOptions","granularity","Error","Array","from","segment","tokens","prevPart","forEach","part","test","push","pop","join","map","token","i","postProcess","changes","oneChangePerToken","lastKeep","change","added","removed","wordWithSpaceDiff","regex"],"mappings":"qHAA0B,IAAAA,6EA2InB,SAAmBC,OAAQC,OAAQC,SAKxC,GAAiC,MAA7BA,SAASC,mBAA6BD,QAAQC,iBAChD,OAAOC,mBAAmBJ,OAAQC,OAAQC,SAG5C,OAAOG,SAASC,KAAKN,OAAQC,OAAQC,QACvC,qGArJAK,OAA0BR,EAA1BQ,QAA0BR,EAAAS,WAAAT,EAAAU,CAAAA,QAAAV,GAqB1B,MAAMW,kBAAoB,4GA2BpBC,4BAA8B,IAAIC,OAAO,IAAIF,8BAA8BA,qBAAsB,MAE1FL,SAAQQ,SAAAR,SAAG,IAAIS,MAAIL,QAqGhC,SAASM,gCAAgCC,UAAWC,SAAUC,UAAWC,SA2CvE,GAAIF,UAAYC,UAAW,CACzB,MAAME,YAAcH,SAASI,MAAMC,MAAM,QAAQ,GAC3CC,YAAcN,SAASI,MAAMC,MA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nB,KAAMC,KAAKH,UACjBD,OAAOA,OAAOxB,OAAS,IAAMyB,SAC/BD,OAAOK,KAAKL,OAAOM,MAAQH,MAE3BH,OAAOK,KAAKJ,SAAWE,MAGzBH,OAAOK,KAAKF,MAGdF,SAAWE,IAAI,IAEVH,QAGT5D,SAASmE,KAAO,SAASP,QAMvB,OAAOA,OAAOQ,KAAI,CAACC,MAAOC,IACf,GAALA,EACKD,MAEAA,MAAMxC,QAAS,OAAS,MAEhCsC,KAAK,KAGVnE,SAASuE,YAAc,SAASC,QAAS3E,SACvC,IAAK2E,SAAW3E,QAAQ4E,kBACtB,OAAOD,QAGT,IAAIE,SAAW,KAGX7D,UAAY,KACZD,SAAW,KAkBf,OAjBA4D,QAAQV,SAAQa,SACVA,OAAOC,MACT/D,UAAY8D,OACHA,OAAOE,QAChBjE,SAAW+D,SAEP9D,WAAaD,WACfF,gCAAgCgE,SAAU9D,SAAUC,UAAW8D,QAEjED,SAAWC,OACX9D,UAAY,KACZD,SAAW,KACb,KAEEC,WAAaD,WACfF,gCAAgCgE,SAAU9D,SAAUC,UAAW,MAE1D2D,SAyIF,MAAMM,kBAAiBtE,SAAAsE,kBAAG,IAAIrE,MAAIL,QAUlC,SAASL,mBAAmBJ,OAAQC,OAAQC,SACjD,OAAOiF,kBAAkB7E,KAAKN,OAAQC,OAAQC,QAChD,CAXAiF,kBAAkB7B,SAAW,SAASjC,OAMpC,MAAM+D,MAAQ,IAAIxE,OAAO,cAAcF,uCAAuCA,qBAAsB,MACpG,OAAOW,MAAMC,MAAM8D,QAAU,GAI9B"} \ No newline at end of file diff --git a/lib/editor/tiny/plugins/collaborative/amd/build/jsdiff/index.min.js b/lib/editor/tiny/plugins/collaborative/amd/build/jsdiff/index.min.js index 24a0d01ea2323..eae70e0b118ac 100644 --- a/lib/editor/tiny/plugins/collaborative/amd/build/jsdiff/index.min.js +++ b/lib/editor/tiny/plugins/collaborative/amd/build/jsdiff/index.min.js @@ -1,3 +1,3 @@ -define("tiny_collaborative/jsdiff/index",["exports","./diff/base","./diff/character","./diff/word","./diff/line","./diff/sentence","./diff/css","./diff/json","./diff/array","./patch/apply","./patch/parse","./patch/merge","./patch/reverse","./patch/create","./convert/dmp","./convert/xml"],(function(_exports,_base,_character,_word,_line,_sentence,_css,_json,_array,_apply,_parse,_merge,_reverse,_create,_dmp,_xml){var obj;Object.defineProperty(_exports,"__esModule",{value:!0}),Object.defineProperty(_exports,"Diff",{enumerable:!0,get:function(){return _base.default}}),Object.defineProperty(_exports,"applyPatch",{enumerable:!0,get:function(){return _apply.applyPatch}}),Object.defineProperty(_exports,"applyPatches",{enumerable:!0,get:function(){return _apply.applyPatches}}),Object.defineProperty(_exports,"canonicalize",{enumerable:!0,get:function(){return _json.canonicalize}}),Object.defineProperty(_exports,"convertChangesToDMP",{enumerable:!0,get:function(){return _dmp.convertChangesToDMP}}),Object.defineProperty(_exports,"convertChangesToXML",{enumerable:!0,get:function(){return _xml.convertChangesToXML}}),Object.defineProperty(_exports,"createPatch",{enumerable:!0,get:function(){return _create.createPatch}}),Object.defineProperty(_exports,"createTwoFilesPatch",{enumerable:!0,get:function(){return _create.createTwoFilesPatch}}),Object.defineProperty(_exports,"diffArrays",{enumerable:!0,get:function(){return _array.diffArrays}}),Object.defineProperty(_exports,"diffChars",{enumerable:!0,get:function(){return _character.diffChars}}),Object.defineProperty(_exports,"diffCss",{enumerable:!0,get:function(){return _css.diffCss}}),Object.defineProperty(_exports,"diffJson",{enumerable:!0,get:function(){return _json.diffJson}}),Object.defineProperty(_exports,"diffLines",{enumerable:!0,get:function(){return _line.diffLines}}),Object.defineProperty(_exports,"diffSentences",{enumerable:!0,get:function(){return _sentence.diffSentences}}),Object.defineProperty(_exports,"diffTrimmedLines",{enumerable:!0,get:function(){return _line.diffTrimmedLines}}),Object.defineProperty(_exports,"diffWords",{enumerable:!0,get:function(){return _word.diffWords}}),Object.defineProperty(_exports,"diffWordsWithSpace",{enumerable:!0,get:function(){return _word.diffWordsWithSpace}}),Object.defineProperty(_exports,"formatPatch",{enumerable:!0,get:function(){return _create.formatPatch}}),Object.defineProperty(_exports,"merge",{enumerable:!0,get:function(){return _merge.merge}}),Object.defineProperty(_exports,"parsePatch",{enumerable:!0,get:function(){return _parse.parsePatch}}),Object.defineProperty(_exports,"reversePatch",{enumerable:!0,get:function(){return _reverse.reversePatch}}),Object.defineProperty(_exports,"structuredPatch",{enumerable:!0,get:function(){return _create.structuredPatch}}),_base=(obj=_base)&&obj.__esModule?obj:{default:obj}})); +define("tiny_collaborative/jsdiff/index",["exports","./diff/base","./diff/character","./diff/word","./diff/line","./diff/sentence","./diff/css","./diff/json","./diff/array","./patch/apply","./patch/parse","./patch/merge","./patch/reverse","./patch/create","./convert/dmp","./convert/xml"],(function(_exports,_base,_character,_word,_line,_sentence,_css,_json,_array,_apply,_parse,_merge,_reverse,_create,_dmp,_xml){var e;Object.defineProperty(_exports,"__esModule",{value:!0}),Object.defineProperty(_exports,"Diff",{enumerable:!0,get:function(){return _base.default}}),Object.defineProperty(_exports,"applyPatch",{enumerable:!0,get:function(){return _apply.applyPatch}}),Object.defineProperty(_exports,"applyPatches",{enumerable:!0,get:function(){return _apply.applyPatches}}),Object.defineProperty(_exports,"canonicalize",{enumerable:!0,get:function(){return _json.canonicalize}}),Object.defineProperty(_exports,"convertChangesToDMP",{enumerable:!0,get:function(){return _dmp.convertChangesToDMP}}),Object.defineProperty(_exports,"convertChangesToXML",{enumerable:!0,get:function(){return _xml.convertChangesToXML}}),Object.defineProperty(_exports,"createPatch",{enumerable:!0,get:function(){return _create.createPatch}}),Object.defineProperty(_exports,"createTwoFilesPatch",{enumerable:!0,get:function(){return _create.createTwoFilesPatch}}),Object.defineProperty(_exports,"diffArrays",{enumerable:!0,get:function(){return _array.diffArrays}}),Object.defineProperty(_exports,"diffChars",{enumerable:!0,get:function(){return _character.diffChars}}),Object.defineProperty(_exports,"diffCss",{enumerable:!0,get:function(){return _css.diffCss}}),Object.defineProperty(_exports,"diffJson",{enumerable:!0,get:function(){return _json.diffJson}}),Object.defineProperty(_exports,"diffLines",{enumerable:!0,get:function(){return _line.diffLines}}),Object.defineProperty(_exports,"diffSentences",{enumerable:!0,get:function(){return _sentence.diffSentences}}),Object.defineProperty(_exports,"diffTrimmedLines",{enumerable:!0,get:function(){return _line.diffTrimmedLines}}),Object.defineProperty(_exports,"diffWords",{enumerable:!0,get:function(){return _word.diffWords}}),Object.defineProperty(_exports,"diffWordsWithSpace",{enumerable:!0,get:function(){return _word.diffWordsWithSpace}}),Object.defineProperty(_exports,"formatPatch",{enumerable:!0,get:function(){return _create.formatPatch}}),Object.defineProperty(_exports,"merge",{enumerable:!0,get:function(){return _merge.merge}}),Object.defineProperty(_exports,"parsePatch",{enumerable:!0,get:function(){return _parse.parsePatch}}),Object.defineProperty(_exports,"reversePatch",{enumerable:!0,get:function(){return _reverse.reversePatch}}),Object.defineProperty(_exports,"structuredPatch",{enumerable:!0,get:function(){return _create.structuredPatch}}),_base=(e=_base)&&e.__esModule?e:{default:e}})); //# sourceMappingURL=index.min.js.map \ No newline at end of file diff --git a/lib/editor/tiny/plugins/collaborative/amd/build/jsdiff/index.min.js.map b/lib/editor/tiny/plugins/collaborative/amd/build/jsdiff/index.min.js.map index a55f2899aaae6..72f78034d75eb 100644 --- a/lib/editor/tiny/plugins/collaborative/amd/build/jsdiff/index.min.js.map +++ b/lib/editor/tiny/plugins/collaborative/amd/build/jsdiff/index.min.js.map @@ -1 +1 @@ -{"version":3,"file":"index.min.js","sources":[],"sourcesContent":[],"names":[],"mappings":""} \ No newline at end of file +{"version":3,"file":"index.min.js","sources":["../../src/jsdiff/index.js"],"sourcesContent":["/* See LICENSE file for terms of use */\n\n/*\n * Text diff implementation.\n *\n * This library supports the following APIs:\n * Diff.diffChars: Character by character diff\n * Diff.diffWords: Word (as defined by \\b regex) diff which ignores whitespace\n * Diff.diffLines: Line based diff\n *\n * Diff.diffCss: Diff targeted at CSS content\n *\n * These methods are based on the implementation proposed in\n * \"An O(ND) Difference Algorithm and its Variations\" (Myers, 1986).\n * http://citeseerx.ist.psu.edu/viewdoc/summary?doi=10.1.1.4.6927\n */\nimport Diff from './diff/base';\nimport {diffChars} from './diff/character';\nimport {diffWords, diffWordsWithSpace} from './diff/word';\nimport {diffLines, diffTrimmedLines} from './diff/line';\nimport {diffSentences} from './diff/sentence';\n\nimport {diffCss} from './diff/css';\nimport {diffJson, canonicalize} from './diff/json';\n\nimport {diffArrays} from './diff/array';\n\nimport {applyPatch, applyPatches} from './patch/apply';\nimport {parsePatch} from './patch/parse';\nimport {merge} from './patch/merge';\nimport {reversePatch} from './patch/reverse';\nimport {structuredPatch, createTwoFilesPatch, createPatch, formatPatch} from './patch/create';\n\nimport {convertChangesToDMP} from './convert/dmp';\nimport {convertChangesToXML} from './convert/xml';\n\nexport {\n Diff,\n\n diffChars,\n diffWords,\n diffWordsWithSpace,\n diffLines,\n diffTrimmedLines,\n diffSentences,\n\n diffCss,\n diffJson,\n\n diffArrays,\n\n structuredPatch,\n createTwoFilesPatch,\n createPatch,\n formatPatch,\n applyPatch,\n applyPatches,\n parsePatch,\n merge,\n reversePatch,\n convertChangesToDMP,\n convertChangesToXML,\n canonicalize\n};\n"],"names":["e","_base","__esModule","default"],"mappings":"8ZAgB+B,IAAAA,60EAA/BC,OAA+BD,EAA/BC,QAA+BD,EAAAE,WAAAF,EAAAG,CAAAA,QAAAH,EAAA"} \ No newline at end of file diff --git a/lib/editor/tiny/plugins/collaborative/amd/build/jsdiff/patch/apply.min.js b/lib/editor/tiny/plugins/collaborative/amd/build/jsdiff/patch/apply.min.js index e665fe3907a00..8fbe6c63ba95a 100644 --- a/lib/editor/tiny/plugins/collaborative/amd/build/jsdiff/patch/apply.min.js +++ b/lib/editor/tiny/plugins/collaborative/amd/build/jsdiff/patch/apply.min.js @@ -1,3 +1,3 @@ -define("tiny_collaborative/jsdiff/patch/apply",["exports","../util/string","./line-endings","./parse","../util/distance-iterator"],(function(_exports,_string,_lineEndings,_parse,_distanceIterator){var obj;function applyPatch(source,uniDiff){let options=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{};if("string"==typeof uniDiff&&(uniDiff=(0,_parse.parsePatch)(uniDiff)),Array.isArray(uniDiff)){if(uniDiff.length>1)throw new Error("applyPatch only works with a single input.");uniDiff=uniDiff[0]}(options.autoConvertLineEndings||null==options.autoConvertLineEndings)&&((0,_string.hasOnlyWinLineEndings)(source)&&(0,_lineEndings.isUnix)(uniDiff)?uniDiff=(0,_lineEndings.unixToWin)(uniDiff):(0,_string.hasOnlyUnixLineEndings)(source)&&(0,_lineEndings.isWin)(uniDiff)&&(uniDiff=(0,_lineEndings.winToUnix)(uniDiff)));let lines=source.split("\n"),hunks=uniDiff.hunks,compareLine=options.compareLine||((lineNumber,line,operation,patchContent)=>line===patchContent),fuzzFactor=options.fuzzFactor||0,minLine=0;if(fuzzFactor<0||!Number.isInteger(fuzzFactor))throw new Error("fuzzFactor must be a non-negative integer");if(!hunks.length)return source;let prevLine="",removeEOFNL=!1,addEOFNL=!1;for(let i=0;i3&&void 0!==arguments[3]?arguments[3]:0,lastContextLineMatched=!(arguments.length>4&&void 0!==arguments[4])||arguments[4],patchedLines=arguments.length>5&&void 0!==arguments[5]?arguments[5]:[],patchedLinesLength=arguments.length>6&&void 0!==arguments[6]?arguments[6]:0,nConsecutiveOldContextLines=0,nextContextLineMustMatch=!1;for(;hunkLinesI0?hunkLine[0]:" ",content=hunkLine.length>0?hunkLine.substr(1):hunkLine;if("-"===operation){if(!compareLine(toPos+1,lines[toPos],operation,content))return maxErrors&&null!=lines[toPos]?(patchedLines[patchedLinesLength]=lines[toPos],applyHunk(hunkLines,toPos+1,maxErrors-1,hunkLinesI,!1,patchedLines,patchedLinesLength+1)):null;toPos++,nConsecutiveOldContextLines=0}if("+"===operation){if(!lastContextLineMatched)return null;patchedLines[patchedLinesLength]=content,patchedLinesLength++,nConsecutiveOldContextLines=0,nextContextLineMustMatch=!0}if(" "===operation){if(nConsecutiveOldContextLines++,patchedLines[patchedLinesLength]=lines[toPos],!compareLine(toPos+1,lines[toPos],operation,content))return nextContextLineMustMatch||!maxErrors?null:lines[toPos]&&(applyHunk(hunkLines,toPos+1,maxErrors-1,hunkLinesI+1,!1,patchedLines,patchedLinesLength+1)||applyHunk(hunkLines,toPos+1,maxErrors-1,hunkLinesI,!1,patchedLines,patchedLinesLength+1))||applyHunk(hunkLines,toPos,maxErrors-1,hunkLinesI+1,!1,patchedLines,patchedLinesLength);patchedLinesLength++,lastContextLineMatched=!0,nextContextLineMustMatch=!1,toPos++}}return patchedLinesLength-=nConsecutiveOldContextLines,toPos-=nConsecutiveOldContextLines,patchedLines.length=patchedLinesLength,{patchedLines:patchedLines,oldLineLastI:toPos-1}}const resultLines=[];let prevHunkOffset=0;for(let i=0;i2&&void 0!==arguments[2]?arguments[2]:{};if("string"==typeof uniDiff&&(uniDiff=(0,_parse.parsePatch)(uniDiff)),Array.isArray(uniDiff)){if(uniDiff.length>1)throw new Error("applyPatch only works with a single input.");uniDiff=uniDiff[0]}(options.autoConvertLineEndings||null==options.autoConvertLineEndings)&&((0,_string.hasOnlyWinLineEndings)(source)&&(0,_lineEndings.isUnix)(uniDiff)?uniDiff=(0,_lineEndings.unixToWin)(uniDiff):(0,_string.hasOnlyUnixLineEndings)(source)&&(0,_lineEndings.isWin)(uniDiff)&&(uniDiff=(0,_lineEndings.winToUnix)(uniDiff)));let lines=source.split("\n"),hunks=uniDiff.hunks,compareLine=options.compareLine||((lineNumber,line,operation,patchContent)=>line===patchContent),fuzzFactor=options.fuzzFactor||0,minLine=0;if(fuzzFactor<0||!Number.isInteger(fuzzFactor))throw new Error("fuzzFactor must be a non-negative integer");if(!hunks.length)return source;let prevLine="",removeEOFNL=!1,addEOFNL=!1;for(let i=0;i3&&void 0!==arguments[3]?arguments[3]:0,lastContextLineMatched=!(arguments.length>4&&void 0!==arguments[4])||arguments[4],patchedLines=arguments.length>5&&void 0!==arguments[5]?arguments[5]:[],patchedLinesLength=arguments.length>6&&void 0!==arguments[6]?arguments[6]:0,nConsecutiveOldContextLines=0,nextContextLineMustMatch=!1;for(;hunkLinesI0?hunkLine[0]:" ",content=hunkLine.length>0?hunkLine.substr(1):hunkLine;if("-"===operation){if(!compareLine(toPos+1,lines[toPos],operation,content))return maxErrors&&null!=lines[toPos]?(patchedLines[patchedLinesLength]=lines[toPos],applyHunk(hunkLines,toPos+1,maxErrors-1,hunkLinesI,!1,patchedLines,patchedLinesLength+1)):null;toPos++,nConsecutiveOldContextLines=0}if("+"===operation){if(!lastContextLineMatched)return null;patchedLines[patchedLinesLength]=content,patchedLinesLength++,nConsecutiveOldContextLines=0,nextContextLineMustMatch=!0}if(" "===operation){if(nConsecutiveOldContextLines++,patchedLines[patchedLinesLength]=lines[toPos],!compareLine(toPos+1,lines[toPos],operation,content))return nextContextLineMustMatch||!maxErrors?null:lines[toPos]&&(applyHunk(hunkLines,toPos+1,maxErrors-1,hunkLinesI+1,!1,patchedLines,patchedLinesLength+1)||applyHunk(hunkLines,toPos+1,maxErrors-1,hunkLinesI,!1,patchedLines,patchedLinesLength+1))||applyHunk(hunkLines,toPos,maxErrors-1,hunkLinesI+1,!1,patchedLines,patchedLinesLength);patchedLinesLength++,lastContextLineMatched=!0,nextContextLineMustMatch=!1,toPos++}}return patchedLinesLength-=nConsecutiveOldContextLines,toPos-=nConsecutiveOldContextLines,patchedLines.length=patchedLinesLength,{patchedLines:patchedLines,oldLineLastI:toPos-1}}const resultLines=[];let prevHunkOffset=0;for(let i=0;i 1) {\n throw new Error('applyPatch only works with a single input.');\n }\n\n uniDiff = uniDiff[0];\n }\n\n if (options.autoConvertLineEndings || options.autoConvertLineEndings == null) {\n if (hasOnlyWinLineEndings(source) && isUnix(uniDiff)) {\n uniDiff = unixToWin(uniDiff);\n } else if (hasOnlyUnixLineEndings(source) && isWin(uniDiff)) {\n uniDiff = winToUnix(uniDiff);\n }\n }\n\n // Apply the diff to the input\n let lines = source.split('\\n'),\n hunks = uniDiff.hunks,\n\n compareLine = options.compareLine || ((lineNumber, line, operation, patchContent) => line === patchContent),\n fuzzFactor = options.fuzzFactor || 0,\n minLine = 0;\n\n if (fuzzFactor < 0 || !Number.isInteger(fuzzFactor)) {\n throw new Error('fuzzFactor must be a non-negative integer');\n }\n\n // Special case for empty patch.\n if (!hunks.length) {\n return source;\n }\n\n // Before anything else, handle EOFNL insertion/removal. If the patch tells us to make a change\n // to the EOFNL that is redundant/impossible - i.e. to remove a newline that's not there, or add a\n // newline that already exists - then we either return false and fail to apply the patch (if\n // fuzzFactor is 0) or simply ignore the problem and do nothing (if fuzzFactor is >0).\n // If we do need to remove/add a newline at EOF, this will always be in the final hunk:\n let prevLine = '',\n removeEOFNL = false,\n addEOFNL = false;\n for (let i = 0; i < hunks[hunks.length - 1].lines.length; i++) {\n const line = hunks[hunks.length - 1].lines[i];\n if (line[0] == '\\\\') {\n if (prevLine[0] == '+') {\n removeEOFNL = true;\n } else if (prevLine[0] == '-') {\n addEOFNL = true;\n }\n }\n prevLine = line;\n }\n if (removeEOFNL) {\n if (addEOFNL) {\n // This means the final line gets changed but doesn't have a trailing newline in either the\n // original or patched version. In that case, we do nothing if fuzzFactor > 0, and if\n // fuzzFactor is 0, we simply validate that the source file has no trailing newline.\n if (!fuzzFactor && lines[lines.length - 1] == '') {\n return false;\n }\n } else if (lines[lines.length - 1] == '') {\n lines.pop();\n } else if (!fuzzFactor) {\n return false;\n }\n } else if (addEOFNL) {\n if (lines[lines.length - 1] != '') {\n lines.push('');\n } else if (!fuzzFactor) {\n return false;\n }\n }\n\n /**\n * Checks if the hunk can be made to fit at the provided location with at most `maxErrors`\n * insertions, substitutions, or deletions, while ensuring also that:\n * - lines deleted in the hunk match exactly, and\n * - wherever an insertion operation or block of insertion operations appears in the hunk, the\n * immediately preceding and following lines of context match exactly\n *\n * `toPos` should be set such that lines[toPos] is meant to match hunkLines[0].\n *\n * If the hunk can be applied, returns an object with properties `oldLineLastI` and\n * `replacementLines`. Otherwise, returns null.\n */\n function applyHunk(\n hunkLines,\n toPos,\n maxErrors,\n hunkLinesI = 0,\n lastContextLineMatched = true,\n patchedLines = [],\n patchedLinesLength = 0,\n ) {\n let nConsecutiveOldContextLines = 0;\n let nextContextLineMustMatch = false;\n for (; hunkLinesI < hunkLines.length; hunkLinesI++) {\n let hunkLine = hunkLines[hunkLinesI],\n operation = (hunkLine.length > 0 ? hunkLine[0] : ' '),\n content = (hunkLine.length > 0 ? hunkLine.substr(1) : hunkLine);\n\n if (operation === '-') {\n if (compareLine(toPos + 1, lines[toPos], operation, content)) {\n toPos++;\n nConsecutiveOldContextLines = 0;\n } else {\n if (!maxErrors || lines[toPos] == null) {\n return null;\n }\n patchedLines[patchedLinesLength] = lines[toPos];\n return applyHunk(\n hunkLines,\n toPos + 1,\n maxErrors - 1,\n hunkLinesI,\n false,\n patchedLines,\n patchedLinesLength + 1,\n );\n }\n }\n\n if (operation === '+') {\n if (!lastContextLineMatched) {\n return null;\n }\n patchedLines[patchedLinesLength] = content;\n patchedLinesLength++;\n nConsecutiveOldContextLines = 0;\n nextContextLineMustMatch = true;\n }\n\n if (operation === ' ') {\n nConsecutiveOldContextLines++;\n patchedLines[patchedLinesLength] = lines[toPos];\n if (compareLine(toPos + 1, lines[toPos], operation, content)) {\n patchedLinesLength++;\n lastContextLineMatched = true;\n nextContextLineMustMatch = false;\n toPos++;\n } else {\n if (nextContextLineMustMatch || !maxErrors) {\n return null;\n }\n\n // Consider 3 possibilities in sequence:\n // 1. lines contains a *substitution* not included in the patch context, or\n // 2. lines contains an *insertion* not included in the patch context, or\n // 3. lines contains a *deletion* not included in the patch context\n // The first two options are of course only possible if the line from lines is non-null -\n // i.e. only option 3 is possible if we've overrun the end of the old file.\n return (\n lines[toPos] && (\n applyHunk(\n hunkLines,\n toPos + 1,\n maxErrors - 1,\n hunkLinesI + 1,\n false,\n patchedLines,\n patchedLinesLength + 1\n ) || applyHunk(\n hunkLines,\n toPos + 1,\n maxErrors - 1,\n hunkLinesI,\n false,\n patchedLines,\n patchedLinesLength + 1\n )\n ) || applyHunk(\n hunkLines,\n toPos,\n maxErrors - 1,\n hunkLinesI + 1,\n false,\n patchedLines,\n patchedLinesLength\n )\n );\n }\n }\n }\n\n // Before returning, trim any unmodified context lines off the end of patchedLines and reduce\n // toPos (and thus oldLineLastI) accordingly. This allows later hunks to be applied to a region\n // that starts in this hunk's trailing context.\n patchedLinesLength -= nConsecutiveOldContextLines;\n toPos -= nConsecutiveOldContextLines;\n patchedLines.length = patchedLinesLength;\n return {\n patchedLines,\n oldLineLastI: toPos - 1\n };\n }\n\n const resultLines = [];\n\n // Search best fit offsets for each hunk based on the previous ones\n let prevHunkOffset = 0;\n for (let i = 0; i < hunks.length; i++) {\n const hunk = hunks[i];\n let hunkResult;\n let maxLine = lines.length - hunk.oldLines + fuzzFactor;\n let toPos;\n for (let maxErrors = 0; maxErrors <= fuzzFactor; maxErrors++) {\n toPos = hunk.oldStart + prevHunkOffset - 1;\n let iterator = distanceIterator(toPos, minLine, maxLine);\n for (; toPos !== undefined; toPos = iterator()) {\n hunkResult = applyHunk(hunk.lines, toPos, maxErrors);\n if (hunkResult) {\n break;\n }\n }\n if (hunkResult) {\n break;\n }\n }\n\n if (!hunkResult) {\n return false;\n }\n\n // Copy everything from the end of where we applied the last hunk to the start of this hunk\n for (let i = minLine; i < toPos; i++) {\n resultLines.push(lines[i]);\n }\n\n // Add the lines produced by applying the hunk:\n for (let i = 0; i < hunkResult.patchedLines.length; i++) {\n const line = hunkResult.patchedLines[i];\n resultLines.push(line);\n }\n\n // Set lower text limit to end of the current hunk, so next ones don't try\n // to fit over already patched text\n minLine = hunkResult.oldLineLastI + 1;\n\n // Note the offset between where the patch said the hunk should've applied and where we\n // applied it, so we can adjust future hunks accordingly:\n prevHunkOffset = toPos + 1 - hunk.oldStart;\n }\n\n // Copy over the rest of the lines from the old text\n for (let i = minLine; i < lines.length; i++) {\n resultLines.push(lines[i]);\n }\n\n return resultLines.join('\\n');\n}\n\n// Wrapper that supports multiple file patches via callbacks.\nexport function applyPatches(uniDiff, options) {\n if (typeof uniDiff === 'string') {\n uniDiff = parsePatch(uniDiff);\n }\n\n let currentIndex = 0;\n function processIndex() {\n let index = uniDiff[currentIndex++];\n if (!index) {\n return options.complete();\n }\n\n options.loadFile(index, function(err, data) {\n if (err) {\n return options.complete(err);\n }\n\n let updatedContent = applyPatch(data, index, options);\n options.patched(index, updatedContent, function(err) {\n if (err) {\n return options.complete(err);\n }\n\n processIndex();\n });\n });\n }\n processIndex();\n}\n"],"names":["applyPatch","source","uniDiff","options","Array","isArray","length","Error","autoConvertLineEndings","lines","split","hunks","compareLine","lineNumber","line","operation","patchContent","fuzzFactor","minLine","Number","isInteger","prevLine","removeEOFNL","addEOFNL","i","pop","push","applyHunk","hunkLines","toPos","maxErrors","hunkLinesI","lastContextLineMatched","patchedLines","patchedLinesLength","nConsecutiveOldContextLines","nextContextLineMustMatch","hunkLine","content","substr","oldLineLastI","resultLines","prevHunkOffset","hunk","hunkResult","maxLine","oldLines","oldStart","iterator","undefined","join","currentIndex","processIndex","index","complete","loadFile","err","data","updatedContent","patched"],"mappings":"sNAKgBA,WAAWC,OAAQC,aAASC,+DAAU,MAC7B,iBAAZD,UACTA,SAAU,qBAAWA,UAGnBE,MAAMC,QAAQH,SAAU,IACtBA,QAAQI,OAAS,QACb,IAAIC,MAAM,8CAGlBL,QAAUA,QAAQ,IAGhBC,QAAQK,wBAA4D,MAAlCL,QAAQK,2BACxC,iCAAsBP,UAAW,uBAAOC,SAC1CA,SAAU,0BAAUA,UACX,kCAAuBD,UAAW,sBAAMC,WACjDA,SAAU,0BAAUA,eAKpBO,MAAQR,OAAOS,MAAM,MACrBC,MAAQT,QAAQS,MAEhBC,YAAcT,QAAQS,eAAiBC,WAAYC,KAAMC,UAAWC,eAAiBF,OAASE,cAC9FC,WAAad,QAAQc,YAAc,EACnCC,QAAU,KAEVD,WAAa,IAAME,OAAOC,UAAUH,kBAChC,IAAIV,MAAM,iDAIbI,MAAML,cACFL,WAQLoB,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Ae,YACVC,mBACHC,MAAQnD,QAAQiD,oBACfE,aACIlD,QAAQmD,WAGjBnD,QAAQoD,SAASF,OAAO,SAASG,IAAKC,SAChCD,WACKrD,QAAQmD,SAASE,SAGtBE,eAAiB1D,WAAWyD,KAAMJ,MAAOlD,SAC7CA,QAAQwD,QAAQN,MAAOK,gBAAgB,SAASF,QAC1CA,WACKrD,QAAQmD,SAASE,KAG1BJ,qBAINA"} \ No newline at end of file +{"version":3,"file":"apply.min.js","sources":["../../../src/jsdiff/patch/apply.js"],"sourcesContent":["import {hasOnlyWinLineEndings, hasOnlyUnixLineEndings} from '../util/string';\nimport {isWin, isUnix, unixToWin, winToUnix} from './line-endings';\nimport {parsePatch} from './parse';\nimport distanceIterator from '../util/distance-iterator';\n\nexport function applyPatch(source, uniDiff, options = {}) {\n if (typeof uniDiff === 'string') {\n uniDiff = parsePatch(uniDiff);\n }\n\n if (Array.isArray(uniDiff)) {\n if (uniDiff.length > 1) {\n throw new Error('applyPatch only works with a single input.');\n }\n\n uniDiff = uniDiff[0];\n }\n\n if (options.autoConvertLineEndings || options.autoConvertLineEndings == null) {\n if (hasOnlyWinLineEndings(source) && isUnix(uniDiff)) {\n uniDiff = unixToWin(uniDiff);\n } else if (hasOnlyUnixLineEndings(source) && isWin(uniDiff)) {\n uniDiff = winToUnix(uniDiff);\n }\n }\n\n // Apply the diff to the input\n let lines = source.split('\\n'),\n hunks = uniDiff.hunks,\n\n compareLine = options.compareLine || ((lineNumber, line, operation, patchContent) => line === patchContent),\n fuzzFactor = options.fuzzFactor || 0,\n minLine = 0;\n\n if (fuzzFactor < 0 || !Number.isInteger(fuzzFactor)) {\n throw new Error('fuzzFactor must be a non-negative integer');\n }\n\n // Special case for empty patch.\n if (!hunks.length) {\n return source;\n }\n\n // Before anything else, handle EOFNL insertion/removal. If the patch tells us to make a change\n // to the EOFNL that is redundant/impossible - i.e. to remove a newline that's not there, or add a\n // newline that already exists - then we either return false and fail to apply the patch (if\n // fuzzFactor is 0) or simply ignore the problem and do nothing (if fuzzFactor is >0).\n // If we do need to remove/add a newline at EOF, this will always be in the final hunk:\n let prevLine = '',\n removeEOFNL = false,\n addEOFNL = false;\n for (let i = 0; i < hunks[hunks.length - 1].lines.length; i++) {\n const line = hunks[hunks.length - 1].lines[i];\n if (line[0] == '\\\\') {\n if (prevLine[0] == '+') {\n removeEOFNL = true;\n } else if (prevLine[0] == '-') {\n addEOFNL = true;\n }\n }\n prevLine = line;\n }\n if (removeEOFNL) {\n if (addEOFNL) {\n // This means the final line gets changed but doesn't have a trailing newline in either the\n // original or patched version. In that case, we do nothing if fuzzFactor > 0, and if\n // fuzzFactor is 0, we simply validate that the source file has no trailing newline.\n if (!fuzzFactor && lines[lines.length - 1] == '') {\n return false;\n }\n } else if (lines[lines.length - 1] == '') {\n lines.pop();\n } else if (!fuzzFactor) {\n return false;\n }\n } else if (addEOFNL) {\n if (lines[lines.length - 1] != '') {\n lines.push('');\n } else if (!fuzzFactor) {\n return false;\n }\n }\n\n /**\n * Checks if the hunk can be made to fit at the provided location with at most `maxErrors`\n * insertions, substitutions, or deletions, while ensuring also that:\n * - lines deleted in the hunk match exactly, and\n * - wherever an insertion operation or block of insertion operations appears in the hunk, the\n * immediately preceding and following lines of context match exactly\n *\n * `toPos` should be set such that lines[toPos] is meant to match hunkLines[0].\n *\n * If the hunk can be applied, returns an object with properties `oldLineLastI` and\n * `replacementLines`. Otherwise, returns null.\n */\n function applyHunk(\n hunkLines,\n toPos,\n maxErrors,\n hunkLinesI = 0,\n lastContextLineMatched = true,\n patchedLines = [],\n patchedLinesLength = 0,\n ) {\n let nConsecutiveOldContextLines = 0;\n let nextContextLineMustMatch = false;\n for (; hunkLinesI < hunkLines.length; hunkLinesI++) {\n let hunkLine = hunkLines[hunkLinesI],\n operation = (hunkLine.length > 0 ? hunkLine[0] : ' '),\n content = (hunkLine.length > 0 ? hunkLine.substr(1) : hunkLine);\n\n if (operation === '-') {\n if (compareLine(toPos + 1, lines[toPos], operation, content)) {\n toPos++;\n nConsecutiveOldContextLines = 0;\n } else {\n if (!maxErrors || lines[toPos] == null) {\n return null;\n }\n patchedLines[patchedLinesLength] = lines[toPos];\n return applyHunk(\n hunkLines,\n toPos + 1,\n maxErrors - 1,\n hunkLinesI,\n false,\n patchedLines,\n patchedLinesLength + 1,\n );\n }\n }\n\n if (operation === '+') {\n if (!lastContextLineMatched) {\n return null;\n }\n patchedLines[patchedLinesLength] = content;\n patchedLinesLength++;\n nConsecutiveOldContextLines = 0;\n nextContextLineMustMatch = true;\n }\n\n if (operation === ' ') {\n nConsecutiveOldContextLines++;\n patchedLines[patchedLinesLength] = lines[toPos];\n if (compareLine(toPos + 1, lines[toPos], operation, content)) {\n patchedLinesLength++;\n lastContextLineMatched = true;\n nextContextLineMustMatch = false;\n toPos++;\n } else {\n if (nextContextLineMustMatch || !maxErrors) {\n return null;\n }\n\n // Consider 3 possibilities in sequence:\n // 1. lines contains a *substitution* not included in the patch context, or\n // 2. lines contains an *insertion* not included in the patch context, or\n // 3. lines contains a *deletion* not included in the patch context\n // The first two options are of course only possible if the line from lines is non-null -\n // i.e. only option 3 is possible if we've overrun the end of the old file.\n return (\n lines[toPos] && (\n applyHunk(\n hunkLines,\n toPos + 1,\n maxErrors - 1,\n hunkLinesI + 1,\n false,\n patchedLines,\n patchedLinesLength + 1\n ) || applyHunk(\n hunkLines,\n toPos + 1,\n maxErrors - 1,\n hunkLinesI,\n false,\n patchedLines,\n patchedLinesLength + 1\n )\n ) || applyHunk(\n hunkLines,\n toPos,\n maxErrors - 1,\n hunkLinesI + 1,\n false,\n patchedLines,\n patchedLinesLength\n )\n );\n }\n }\n }\n\n // Before returning, trim any unmodified context lines off the end of patchedLines and reduce\n // toPos (and thus oldLineLastI) accordingly. This allows later hunks to be applied to a region\n // that starts in this hunk's trailing context.\n patchedLinesLength -= nConsecutiveOldContextLines;\n toPos -= nConsecutiveOldContextLines;\n patchedLines.length = patchedLinesLength;\n return {\n patchedLines,\n oldLineLastI: toPos - 1\n };\n }\n\n const resultLines = [];\n\n // Search best fit offsets for each hunk based on the previous ones\n let prevHunkOffset = 0;\n for (let i = 0; i < hunks.length; i++) {\n const hunk = hunks[i];\n let hunkResult;\n let maxLine = lines.length - hunk.oldLines + fuzzFactor;\n let toPos;\n for (let maxErrors = 0; maxErrors <= fuzzFactor; maxErrors++) {\n toPos = hunk.oldStart + prevHunkOffset - 1;\n let iterator = distanceIterator(toPos, minLine, maxLine);\n for (; toPos !== undefined; toPos = iterator()) {\n hunkResult = applyHunk(hunk.lines, toPos, maxErrors);\n if (hunkResult) {\n break;\n }\n }\n if (hunkResult) {\n break;\n }\n }\n\n if (!hunkResult) {\n return false;\n }\n\n // Copy everything from the end of where we applied the last hunk to the start of this hunk\n for (let i = minLine; i < toPos; i++) {\n resultLines.push(lines[i]);\n }\n\n // Add the lines produced by applying the hunk:\n for (let i = 0; i < hunkResult.patchedLines.length; i++) {\n const line = hunkResult.patchedLines[i];\n resultLines.push(line);\n }\n\n // Set lower text limit to end of the current hunk, so next ones don't try\n // to fit over already patched text\n minLine = hunkResult.oldLineLastI + 1;\n\n // Note the offset between where the patch said the hunk should've applied and where we\n // applied it, so we can adjust future hunks accordingly:\n prevHunkOffset = toPos + 1 - hunk.oldStart;\n }\n\n // Copy over the rest of the lines from the old text\n for (let i = minLine; i < lines.length; i++) {\n resultLines.push(lines[i]);\n }\n\n return resultLines.join('\\n');\n}\n\n// Wrapper that supports multiple file patches via callbacks.\nexport function applyPatches(uniDiff, options) {\n if (typeof uniDiff === 'string') {\n uniDiff = parsePatch(uniDiff);\n }\n\n let currentIndex = 0;\n function processIndex() {\n let index = uniDiff[currentIndex++];\n if (!index) {\n return options.complete();\n }\n\n options.loadFile(index, function(err, data) {\n if (err) {\n return options.complete(err);\n }\n\n let updatedContent = applyPatch(data, index, options);\n options.patched(index, updatedContent, function(err) {\n if (err) {\n return options.complete(err);\n }\n\n processIndex();\n });\n });\n }\n processIndex();\n}\n"],"names":["e","applyPatch","source","uniDiff","options","arguments","length","undefined","parsePatch","Array","isArray","Error","autoConvertLineEndings","hasOnlyWinLineEndings","isUnix","unixToWin","hasOnlyUnixLineEndings","isWin","winToUnix","lines","split","hunks","compareLine","lineNumber","line","operation","patchContent","fuzzFactor","minLine","Number","isInteger","prevLine","removeEOFNL","addEOFNL","i","pop","push","applyHunk","hunkLines","toPos","maxErrors","hunkLinesI","lastContextLineMatched","patchedLines","patchedLinesLength","nConsecutiveOldContextLines","nextContextLineMustMatch","hunkLine","content","substr","oldLineLastI","resultLines","prevHunkOffset","hunk","hunkResult","maxLine","oldLines","oldStart","iterator","distanceIterator","default","join","currentIndex","processIndex","index","complete","loadFile","err","data","updatedContent","patched","_distanceIterator","__esModule"],"mappings":"qMAGyD,IAAAA,EAElD,SAASC,WAAWC,OAAQC,SAAuB,IAAdC,QAAOC,UAAAC,OAAA,QAAAC,IAAAF,UAAA,GAAAA,UAAA,GAAG,CAAA,EAKpD,GAJuB,iBAAZF,UACTA,SAAU,EAAAK,OAAUA,YAACL,UAGnBM,MAAMC,QAAQP,SAAU,CAC1B,GAAIA,QAAQG,OAAS,EACnB,MAAM,IAAIK,MAAM,8CAGlBR,QAAUA,QAAQ,EACpB,EAEIC,QAAQQ,wBAA4D,MAAlCR,QAAQQ,2BACxC,EAAAC,QAAqBA,uBAACX,UAAW,EAAAY,aAAMA,QAACX,SAC1CA,SAAU,EAAAY,aAASA,WAACZ,UACX,EAAAa,QAAAA,wBAAuBd,UAAW,EAAAe,aAAAA,OAAMd,WACjDA,SAAU,EAAAe,aAASA,WAACf,WAKxB,IAAIgB,MAAQjB,OAAOkB,MAAM,MACrBC,MAAQlB,QAAQkB,MAEhBC,YAAclB,QAAQkB,aAAW,EAAMC,WAAYC,KAAMC,UAAWC,eAAiBF,OAASE,cAC9FC,WAAavB,QAAQuB,YAAc,EACnCC,QAAU,EAEd,GAAID,WAAa,IAAME,OAAOC,UAAUH,YACtC,MAAM,IAAIhB,MAAM,6CAIlB,IAAKU,MAAMf,OAC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AOC,YACtCc,YAFsBf,MAAQmB,YAMpC,GAAIJ,WACF,KAEJ,CAEA,IAAKA,WACH,OAAO,EAIT,IAAK,IAAIpB,EAAIN,QAASM,EAAIK,MAAOL,IAC/BiB,YAAYf,KAAKjB,MAAMe,IAIzB,IAAK,IAAIA,EAAI,EAAGA,EAAIoB,WAAWX,aAAarC,OAAQ4B,IAAK,CACvD,MAAMV,KAAO8B,WAAWX,aAAaT,GACrCiB,YAAYf,KAAKZ,KACnB,CAIAI,QAAU0B,WAAWJ,aAAe,EAIpCE,eAAiBb,MAAQ,EAAIc,KAAKI,QACpC,CAGA,IAAK,IAAIvB,EAAIN,QAASM,EAAIf,MAAMb,OAAQ4B,IACtCiB,YAAYf,KAAKjB,MAAMe,IAGzB,OAAOiB,YAAYU,KAAK,KAC1B,8GAGO,SAAsB1D,QAASC,SACb,iBAAZD,UACTA,SAAU,EAAAK,OAAUA,YAACL,UAGvB,IAAI2D,aAAe,GACnB,SAASC,eACP,IAAIC,MAAQ7D,QAAQ2D,gBACpB,IAAKE,MACH,OAAO5D,QAAQ6D,WAGjB7D,QAAQ8D,SAASF,OAAO,SAASG,IAAKC,MACpC,GAAID,IACF,OAAO/D,QAAQ6D,SAASE,KAG1B,IAAIE,eAAiBpE,WAAWmE,KAAMJ,MAAO5D,SAC7CA,QAAQkE,QAAQN,MAAOK,gBAAgB,SAASF,KAC9C,GAAIA,IACF,OAAO/D,QAAQ6D,SAASE,KAG1BJ,cACF,GACF,GACF,CACAA,EACF,EA/RAQ,mBAAyDvE,EAAzDuE,oBAAyDvE,EAAAwE,WAAAxE,EAAA4D,CAAAA,QAAA5D,EA+RxD"} \ No newline at end of file diff --git a/lib/editor/tiny/plugins/collaborative/amd/build/jsdiff/patch/create.min.js b/lib/editor/tiny/plugins/collaborative/amd/build/jsdiff/patch/create.min.js index 8251eb8ecac8a..6cd17a0e90376 100644 --- a/lib/editor/tiny/plugins/collaborative/amd/build/jsdiff/patch/create.min.js +++ b/lib/editor/tiny/plugins/collaborative/amd/build/jsdiff/patch/create.min.js @@ -1,3 +1,3 @@ -define("tiny_collaborative/jsdiff/patch/create",["exports","../diff/line"],(function(_exports,_line){function structuredPatch(oldFileName,newFileName,oldStr,newStr,oldHeader,newHeader,options){if(options||(options={}),"function"==typeof options&&(options={callback:options}),void 0===options.context&&(options.context=4),options.newlineIsToken)throw new Error("newlineIsToken may not be used with patch-generation functions, only with diffing functions");if(!options.callback)return diffLinesResultToPatch((0,_line.diffLines)(oldStr,newStr,options));{const{callback:callback}=options;(0,_line.diffLines)(oldStr,newStr,{...options,callback:diff=>{const patch=diffLinesResultToPatch(diff);callback(patch)}})}function diffLinesResultToPatch(diff){if(!diff)return;function contextLines(lines){return lines.map((function(entry){return" "+entry}))}diff.push({value:"",lines:[]});let hunks=[],oldRangeStart=0,newRangeStart=0,curRange=[],oldLine=1,newLine=1;for(let i=0;i0?contextLines(prev.lines.slice(-options.context)):[],oldRangeStart-=curRange.length,newRangeStart-=curRange.length)}curRange.push(...lines.map((function(entry){return(current.added?"+":"-")+entry}))),current.added?newLine+=lines.length:oldLine+=lines.length}else{if(oldRangeStart)if(lines.length<=2*options.context&&i{patchObj?callback(formatPatch(patchObj)):callback()}})}}function splitLines(text){const hasTrailingNl=text.endsWith("\n"),result=text.split("\n").map((line=>line+"\n"));return hasTrailingNl?result.pop():result.push(result.pop().slice(0,-1)),result}Object.defineProperty(_exports,"__esModule",{value:!0}),_exports.createPatch=function(fileName,oldStr,newStr,oldHeader,newHeader,options){return createTwoFilesPatch(fileName,fileName,oldStr,newStr,oldHeader,newHeader,options)},_exports.createTwoFilesPatch=createTwoFilesPatch,_exports.formatPatch=formatPatch,_exports.structuredPatch=structuredPatch})); +define("tiny_collaborative/jsdiff/patch/create",["exports","../diff/line"],(function(_exports,_line){function structuredPatch(oldFileName,newFileName,oldStr,newStr,oldHeader,newHeader,options){if(options||(options={}),"function"==typeof options&&(options={callback:options}),void 0===options.context&&(options.context=4),options.newlineIsToken)throw new Error("newlineIsToken may not be used with patch-generation functions, only with diffing functions");if(!options.callback)return diffLinesResultToPatch((0,_line.diffLines)(oldStr,newStr,options));{const{callback:callback}=options;(0,_line.diffLines)(oldStr,newStr,{...options,callback:diff=>{const patch=diffLinesResultToPatch(diff);callback(patch)}})}function diffLinesResultToPatch(diff){if(!diff)return;function contextLines(lines){return lines.map((function(entry){return" "+entry}))}diff.push({value:"",lines:[]});let hunks=[],oldRangeStart=0,newRangeStart=0,curRange=[],oldLine=1,newLine=1;for(let i=0;i0?contextLines(prev.lines.slice(-options.context)):[],oldRangeStart-=curRange.length,newRangeStart-=curRange.length)}curRange.push(...lines.map((function(entry){return(current.added?"+":"-")+entry}))),current.added?newLine+=lines.length:oldLine+=lines.length}else{if(oldRangeStart)if(lines.length<=2*options.context&&i{patchObj?callback(formatPatch(patchObj)):callback()}})}}function splitLines(text){const hasTrailingNl=text.endsWith("\n"),result=text.split("\n").map((line=>line+"\n"));return hasTrailingNl?result.pop():result.push(result.pop().slice(0,-1)),result}Object.defineProperty(_exports,"__esModule",{value:!0}),_exports.createPatch=function(fileName,oldStr,newStr,oldHeader,newHeader,options){return createTwoFilesPatch(fileName,fileName,oldStr,newStr,oldHeader,newHeader,options)},_exports.createTwoFilesPatch=createTwoFilesPatch,_exports.formatPatch=formatPatch,_exports.structuredPatch=structuredPatch})); //# sourceMappingURL=create.min.js.map \ No newline at end of file diff --git a/lib/editor/tiny/plugins/collaborative/amd/build/jsdiff/patch/create.min.js.map b/lib/editor/tiny/plugins/collaborative/amd/build/jsdiff/patch/create.min.js.map index 90942fa48386c..7934127718e46 100644 --- a/lib/editor/tiny/plugins/collaborative/amd/build/jsdiff/patch/create.min.js.map +++ b/lib/editor/tiny/plugins/collaborative/amd/build/jsdiff/patch/create.min.js.map @@ -1 +1 @@ -{"version":3,"file":"create.min.js","sources":["../../../src/jsdiff/patch/create.js"],"sourcesContent":["import {diffLines} from '../diff/line';\n\nexport function structuredPatch(oldFileName, newFileName, oldStr, newStr, oldHeader, newHeader, options) {\n if (!options) {\n options = {};\n }\n if (typeof options === 'function') {\n options = {callback: options};\n }\n if (typeof options.context === 'undefined') {\n options.context = 4;\n }\n if (options.newlineIsToken) {\n throw new Error('newlineIsToken may not be used with patch-generation functions, only with diffing functions');\n }\n\n if (!options.callback) {\n return diffLinesResultToPatch(diffLines(oldStr, newStr, options));\n } else {\n const {callback} = options;\n diffLines(\n oldStr,\n newStr,\n {\n ...options,\n callback: (diff) => {\n const patch = diffLinesResultToPatch(diff);\n callback(patch);\n }\n }\n );\n }\n\n function diffLinesResultToPatch(diff) {\n // STEP 1: Build up the patch with no \"\\ No newline at end of file\" lines and with the arrays\n // of lines containing trailing newline characters. We'll tidy up later...\n\n if(!diff) {\n return;\n }\n\n diff.push({value: '', lines: []}); // Append an empty value to make cleanup easier\n\n function contextLines(lines) {\n return lines.map(function(entry) { return ' ' + entry; });\n }\n\n let hunks = [];\n let oldRangeStart = 0, newRangeStart = 0, curRange = [],\n oldLine = 1, newLine = 1;\n for (let i = 0; i < diff.length; i++) {\n const current = diff[i],\n lines = current.lines || splitLines(current.value);\n current.lines = lines;\n\n if (current.added || current.removed) {\n // If we have previous context, start with that\n if (!oldRangeStart) {\n const prev = diff[i - 1];\n oldRangeStart = oldLine;\n newRangeStart = newLine;\n\n if (prev) {\n curRange = options.context > 0 ? contextLines(prev.lines.slice(-options.context)) : [];\n oldRangeStart -= curRange.length;\n newRangeStart -= curRange.length;\n }\n }\n\n // Output our changes\n curRange.push(... lines.map(function(entry) {\n return (current.added ? '+' : '-') + entry;\n }));\n\n // Track the updated file position\n if (current.added) {\n newLine += lines.length;\n } else {\n oldLine += lines.length;\n }\n } else {\n // Identical context lines. Track line changes\n if (oldRangeStart) {\n // Close out any changes that have been output (or join overlapping)\n if (lines.length <= options.context * 2 && i < diff.length - 2) {\n // Overlapping\n curRange.push(... contextLines(lines));\n } else {\n // end the range and output\n let contextSize = Math.min(lines.length, options.context);\n curRange.push(... contextLines(lines.slice(0, contextSize)));\n\n let hunk = {\n oldStart: oldRangeStart,\n oldLines: (oldLine - oldRangeStart + contextSize),\n newStart: newRangeStart,\n newLines: (newLine - newRangeStart + contextSize),\n lines: curRange\n };\n hunks.push(hunk);\n\n oldRangeStart = 0;\n newRangeStart = 0;\n curRange = [];\n }\n }\n oldLine += lines.length;\n newLine += lines.length;\n }\n }\n\n // Step 2: eliminate the trailing `\\n` from each line of each hunk, and, where needed, add\n // \"\\ No newline at end of file\".\n for (const hunk of hunks) {\n for (let i = 0; i < hunk.lines.length; i++) {\n if (hunk.lines[i].endsWith('\\n')) {\n hunk.lines[i] = hunk.lines[i].slice(0, -1);\n } else {\n hunk.lines.splice(i + 1, 0, '\\\\ No newline at end of file');\n i++; // Skip the line we just added, then continue iterating\n }\n }\n }\n\n return {\n oldFileName: oldFileName, newFileName: newFileName,\n oldHeader: oldHeader, newHeader: newHeader,\n hunks: hunks\n };\n }\n}\n\nexport function formatPatch(diff) {\n if (Array.isArray(diff)) {\n return diff.map(formatPatch).join('\\n');\n }\n\n const ret = [];\n if (diff.oldFileName == diff.newFileName) {\n ret.push('Index: ' + diff.oldFileName);\n }\n ret.push('===================================================================');\n ret.push('--- ' + diff.oldFileName + (typeof diff.oldHeader === 'undefined' ? '' : '\\t' + diff.oldHeader));\n ret.push('+++ ' + diff.newFileName + (typeof diff.newHeader === 'undefined' ? '' : '\\t' + diff.newHeader));\n\n for (let i = 0; i < diff.hunks.length; i++) {\n const hunk = diff.hunks[i];\n // Unified Diff Format quirk: If the chunk size is 0,\n // the first number is one lower than one would expect.\n // https://www.artima.com/weblogs/viewpost.jsp?thread=164293\n if (hunk.oldLines === 0) {\n hunk.oldStart -= 1;\n }\n if (hunk.newLines === 0) {\n hunk.newStart -= 1;\n }\n ret.push(\n '@@ -' + hunk.oldStart + ',' + hunk.oldLines\n + ' +' + hunk.newStart + ',' + hunk.newLines\n + ' @@'\n );\n ret.push.apply(ret, hunk.lines);\n }\n\n return ret.join('\\n') + '\\n';\n}\n\nexport function createTwoFilesPatch(oldFileName, newFileName, oldStr, newStr, oldHeader, newHeader, options) {\n if (typeof options === 'function') {\n options = {callback: options};\n }\n\n if (!options?.callback) {\n const patchObj = structuredPatch(oldFileName, newFileName, oldStr, newStr, oldHeader, newHeader, options);\n if (!patchObj) {\n return;\n }\n return formatPatch(patchObj);\n } else {\n const {callback} = options;\n structuredPatch(\n oldFileName,\n newFileName,\n oldStr,\n newStr,\n oldHeader,\n newHeader,\n {\n ...options,\n callback: patchObj => {\n if (!patchObj) {\n callback();\n } else {\n callback(formatPatch(patchObj));\n }\n }\n }\n );\n }\n}\n\nexport function createPatch(fileName, oldStr, newStr, oldHeader, newHeader, options) {\n return createTwoFilesPatch(fileName, fileName, oldStr, newStr, oldHeader, newHeader, options);\n}\n\n/**\n * Split `text` into an array of lines, including the trailing newline character (where present)\n */\nfunction splitLines(text) {\n const hasTrailingNl = text.endsWith('\\n');\n const result = text.split('\\n').map(line => line + '\\n');\n if (hasTrailingNl) {\n result.pop();\n } else {\n result.push(result.pop().slice(0, -1));\n }\n return result;\n}\n"],"names":["structuredPatch","oldFileName","newFileName","oldStr","newStr","oldHeader","newHeader","options","callback","context","newlineIsToken","Error","diffLinesResultToPatch","diff","patch","contextLines","lines","map","entry","push","value","hunks","oldRangeStart","newRangeStart","curRange","oldLine","newLine","i","length","current","splitLines","added","removed","prev","slice","contextSize","Math","min","hunk","oldStart","oldLines","newStart","newLines","endsWith","splice","formatPatch","Array","isArray","join","ret","apply","createTwoFilesPatch","_options","patchObj","text","hasTrailingNl","result","split","line","pop","fileName"],"mappings":"8GAEgBA,gBAAgBC,YAAaC,YAAaC,OAAQC,OAAQC,UAAWC,UAAWC,YACzFA,UACHA,QAAU,IAEW,mBAAZA,UACTA,QAAU,CAACC,SAAUD,eAEQ,IAApBA,QAAQE,UACjBF,QAAQE,QAAU,GAEhBF,QAAQG,qBACJ,IAAIC,MAAM,mGAGbJ,QAAQC,gBACJI,wBAAuB,mBAAUT,OAAQC,OAAQG,UACnD,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,SAAWrD,gBAAgBC,YAAaC,YAAaC,OAAQC,OAAQC,UAAWC,UAAWC,aAC5F8C,uBAGER,YAAYQ,UACd,OACC7C,SAACA,UAAYD,QACnBP,gBACEC,YACAC,YACAC,OACAC,OACAC,UACAC,UACA,IACKC,QACHC,SAAU6C,WACHA,SAGH7C,SAASqC,YAAYQ,WAFrB7C,wBAiBHsB,WAAWwB,YACZC,cAAgBD,KAAKX,SAAS,MAC9Ba,OAASF,KAAKG,MAAM,MAAMxC,KAAIyC,MAAQA,KAAO,cAC/CH,cACFC,OAAOG,MAEPH,OAAOrC,KAAKqC,OAAOG,MAAMzB,MAAM,GAAI,IAE9BsB,6FAfmBI,SAAUzD,OAAQC,OAAQC,UAAWC,UAAWC,gBACnE4C,oBAAoBS,SAAUA,SAAUzD,OAAQC,OAAQC,UAAWC,UAAWC"} \ No newline at end of file +{"version":3,"file":"create.min.js","sources":["../../../src/jsdiff/patch/create.js"],"sourcesContent":["import {diffLines} from '../diff/line';\n\nexport function structuredPatch(oldFileName, newFileName, oldStr, newStr, oldHeader, newHeader, options) {\n if (!options) {\n options = {};\n }\n if (typeof options === 'function') {\n options = {callback: options};\n }\n if (typeof options.context === 'undefined') {\n options.context = 4;\n }\n if (options.newlineIsToken) {\n throw new Error('newlineIsToken may not be used with patch-generation functions, only with diffing functions');\n }\n\n if (!options.callback) {\n return diffLinesResultToPatch(diffLines(oldStr, newStr, options));\n } else {\n const {callback} = options;\n diffLines(\n oldStr,\n newStr,\n {\n ...options,\n callback: (diff) => {\n const patch = diffLinesResultToPatch(diff);\n callback(patch);\n }\n }\n );\n }\n\n function diffLinesResultToPatch(diff) {\n // STEP 1: Build up the patch with no \"\\ No newline at end of file\" lines and with the arrays\n // of lines containing trailing newline characters. We'll tidy up later...\n\n if(!diff) {\n return;\n }\n\n diff.push({value: '', lines: []}); // Append an empty value to make cleanup easier\n\n function contextLines(lines) {\n return lines.map(function(entry) { return ' ' + entry; });\n }\n\n let hunks = [];\n let oldRangeStart = 0, newRangeStart = 0, curRange = [],\n oldLine = 1, newLine = 1;\n for (let i = 0; i < diff.length; i++) {\n const current = diff[i],\n lines = current.lines || splitLines(current.value);\n current.lines = lines;\n\n if (current.added || current.removed) {\n // If we have previous context, start with that\n if (!oldRangeStart) {\n const prev = diff[i - 1];\n oldRangeStart = oldLine;\n newRangeStart = newLine;\n\n if (prev) {\n curRange = options.context > 0 ? contextLines(prev.lines.slice(-options.context)) : [];\n oldRangeStart -= curRange.length;\n newRangeStart -= curRange.length;\n }\n }\n\n // Output our changes\n curRange.push(... lines.map(function(entry) {\n return (current.added ? '+' : '-') + entry;\n }));\n\n // Track the updated file position\n if (current.added) {\n newLine += lines.length;\n } else {\n oldLine += lines.length;\n }\n } else {\n // Identical context lines. Track line changes\n if (oldRangeStart) {\n // Close out any changes that have been output (or join overlapping)\n if (lines.length <= options.context * 2 && i < diff.length - 2) {\n // Overlapping\n curRange.push(... contextLines(lines));\n } else {\n // end the range and output\n let contextSize = Math.min(lines.length, options.context);\n curRange.push(... contextLines(lines.slice(0, contextSize)));\n\n let hunk = {\n oldStart: oldRangeStart,\n oldLines: (oldLine - oldRangeStart + contextSize),\n newStart: newRangeStart,\n newLines: (newLine - newRangeStart + contextSize),\n lines: curRange\n };\n hunks.push(hunk);\n\n oldRangeStart = 0;\n newRangeStart = 0;\n curRange = [];\n }\n }\n oldLine += lines.length;\n newLine += lines.length;\n }\n }\n\n // Step 2: eliminate the trailing `\\n` from each line of each hunk, and, where needed, add\n // \"\\ No newline at end of file\".\n for (const hunk of hunks) {\n for (let i = 0; i < hunk.lines.length; i++) {\n if (hunk.lines[i].endsWith('\\n')) {\n hunk.lines[i] = hunk.lines[i].slice(0, -1);\n } else {\n hunk.lines.splice(i + 1, 0, '\\\\ No newline at end of file');\n i++; // Skip the line we just added, then continue iterating\n }\n }\n }\n\n return {\n oldFileName: oldFileName, newFileName: newFileName,\n oldHeader: oldHeader, newHeader: newHeader,\n hunks: hunks\n };\n }\n}\n\nexport function formatPatch(diff) {\n if (Array.isArray(diff)) {\n return diff.map(formatPatch).join('\\n');\n }\n\n const ret = [];\n if (diff.oldFileName == diff.newFileName) {\n ret.push('Index: ' + diff.oldFileName);\n }\n ret.push('===================================================================');\n ret.push('--- ' + diff.oldFileName + (typeof diff.oldHeader === 'undefined' ? '' : '\\t' + diff.oldHeader));\n ret.push('+++ ' + diff.newFileName + (typeof diff.newHeader === 'undefined' ? '' : '\\t' + diff.newHeader));\n\n for (let i = 0; i < diff.hunks.length; i++) {\n const hunk = diff.hunks[i];\n // Unified Diff Format quirk: If the chunk size is 0,\n // the first number is one lower than one would expect.\n // https://www.artima.com/weblogs/viewpost.jsp?thread=164293\n if (hunk.oldLines === 0) {\n hunk.oldStart -= 1;\n }\n if (hunk.newLines === 0) {\n hunk.newStart -= 1;\n }\n ret.push(\n '@@ -' + hunk.oldStart + ',' + hunk.oldLines\n + ' +' + hunk.newStart + ',' + hunk.newLines\n + ' @@'\n );\n ret.push.apply(ret, hunk.lines);\n }\n\n return ret.join('\\n') + '\\n';\n}\n\nexport function createTwoFilesPatch(oldFileName, newFileName, oldStr, newStr, oldHeader, newHeader, options) {\n if (typeof options === 'function') {\n options = {callback: options};\n }\n\n if (!options?.callback) {\n const patchObj = structuredPatch(oldFileName, newFileName, oldStr, newStr, oldHeader, newHeader, options);\n if (!patchObj) {\n return;\n }\n return formatPatch(patchObj);\n } else {\n const {callback} = options;\n structuredPatch(\n oldFileName,\n newFileName,\n oldStr,\n newStr,\n oldHeader,\n newHeader,\n {\n ...options,\n callback: patchObj => {\n if (!patchObj) {\n callback();\n } else {\n callback(formatPatch(patchObj));\n }\n }\n }\n );\n }\n}\n\nexport function createPatch(fileName, oldStr, newStr, oldHeader, newHeader, options) {\n return createTwoFilesPatch(fileName, fileName, oldStr, newStr, oldHeader, newHeader, options);\n}\n\n/**\n * Split `text` into an array of lines, including the trailing newline character (where present)\n */\nfunction splitLines(text) {\n const hasTrailingNl = text.endsWith('\\n');\n const result = text.split('\\n').map(line => line + '\\n');\n if (hasTrailingNl) {\n result.pop();\n } else {\n result.push(result.pop().slice(0, -1));\n }\n return result;\n}\n"],"names":["structuredPatch","oldFileName","newFileName","oldStr","newStr","oldHeader","newHeader","options","callback","context","newlineIsToken","Error","diffLinesResultToPatch","diffLines","diff","patch","contextLines","lines","map","entry","push","value","hunks","oldRangeStart","newRangeStart","curRange","oldLine","newLine","i","length","current","splitLines","added","removed","prev","slice","contextSize","Math","min","hunk","oldStart","oldLines","newStart","newLines","endsWith","splice","formatPatch","Array","isArray","join","ret","apply","createTwoFilesPatch","patchObj","text","hasTrailingNl","result","split","line","pop","fileName"],"mappings":"qGAEO,SAASA,gBAAgBC,YAAaC,YAAaC,OAAQC,OAAQC,UAAWC,UAAWC,SAU9F,GATKA,UACHA,QAAU,CAAA,GAEW,mBAAZA,UACTA,QAAU,CAACC,SAAUD,eAEQ,IAApBA,QAAQE,UACjBF,QAAQE,QAAU,GAEhBF,QAAQG,eACV,MAAM,IAAIC,MAAM,+FAGlB,IAAKJ,QAAQC,SACX,OAAOI,wBAAuB,EAAAC,MAASA,WAACV,OAAQC,OAAQG,UACnD,CACL,MAAMC,SAACA,UAAYD,SACnB,EAAAM,MAASA,WACPV,OACAC,OACA,IACKG,QACHC,SAAWM,OACT,MAAMC,MAAQH,uBAAuBE,MACrCN,SAASO,MAAM,GAIvB,CAEA,SAASH,uBAAuBE,MAI9B,IAAIA,KACF,OAKF,SAASE,aAAaC,OACpB,OAAOA,MAAMC,KAAI,SAASC,OAAS,MAAO,IAAMA,KAAO,GACzD,CAJAL,KAAKM,KAAK,CAACC,MAAO,GAAIJ,MAAO,KAM7B,IAAIK,MAAQ,GACRC,cAAgB,EAAGC,cAAgB,EAAGC,SAAW,GACjDC,QAAU,EAAGC,QAAU,EAC3B,IAAK,IAAIC,EAAI,EAAGA,EAAId,KAAKe,OAAQD,IAAK,CACpC,MAAME,QAAUhB,KAAKc,GACfX,MAAQa,QAAQb,OAASc,WAAWD,QAAQT,OAG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,CASA,SAASuB,WAAWuB,MAClB,MAAMC,cAAgBD,KAAKV,SAAS,MAC9BY,OAASF,KAAKG,MAAM,MAAMvC,KAAIwC,MAAQA,KAAO,OAMnD,OALIH,cACFC,OAAOG,MAEPH,OAAOpC,KAAKoC,OAAOG,MAAMxB,MAAM,GAAI,IAE9BqB,MACT,8EAhBO,SAAqBI,SAAUzD,OAAQC,OAAQC,UAAWC,UAAWC,SAC1E,OAAO6C,oBAAoBQ,SAAUA,SAAUzD,OAAQC,OAAQC,UAAWC,UAAWC,QACvF,4HAcC"} \ No newline at end of file diff --git a/lib/editor/tiny/plugins/collaborative/amd/build/jsdiff/patch/line-endings.min.js b/lib/editor/tiny/plugins/collaborative/amd/build/jsdiff/patch/line-endings.min.js index bb38314e3b23a..4af7394ac781c 100644 --- a/lib/editor/tiny/plugins/collaborative/amd/build/jsdiff/patch/line-endings.min.js +++ b/lib/editor/tiny/plugins/collaborative/amd/build/jsdiff/patch/line-endings.min.js @@ -1,3 +1,3 @@ -define("tiny_collaborative/jsdiff/patch/line-endings",["exports"],(function(_exports){Object.defineProperty(_exports,"__esModule",{value:!0}),_exports.isUnix=function(patch){Array.isArray(patch)||(patch=[patch]);return!patch.some((index=>index.hunks.some((hunk=>hunk.lines.some((line=>!line.startsWith("\\")&&line.endsWith("\r")))))))},_exports.isWin=function(patch){Array.isArray(patch)||(patch=[patch]);return patch.some((index=>index.hunks.some((hunk=>hunk.lines.some((line=>line.endsWith("\r")))))))&&patch.every((index=>index.hunks.every((hunk=>hunk.lines.every(((line,i)=>{var _hunk$lines2;return line.startsWith("\\")||line.endsWith("\r")||(null===(_hunk$lines2=hunk.lines[i+1])||void 0===_hunk$lines2?void 0:_hunk$lines2.startsWith("\\"))}))))))},_exports.unixToWin=function unixToWin(patch){if(Array.isArray(patch))return patch.map(unixToWin);return{...patch,hunks:patch.hunks.map((hunk=>({...hunk,lines:hunk.lines.map(((line,i)=>{var _hunk$lines;return line.startsWith("\\")||line.endsWith("\r")||null!==(_hunk$lines=hunk.lines[i+1])&&void 0!==_hunk$lines&&_hunk$lines.startsWith("\\")?line:line+"\r"}))})))}},_exports.winToUnix=function winToUnix(patch){if(Array.isArray(patch))return patch.map(winToUnix);return{...patch,hunks:patch.hunks.map((hunk=>({...hunk,lines:hunk.lines.map((line=>line.endsWith("\r")?line.substring(0,line.length-1):line))})))}}})); +define("tiny_collaborative/jsdiff/patch/line-endings",["exports"],(function(_exports){Object.defineProperty(_exports,"__esModule",{value:!0}),_exports.isUnix=function(patch){Array.isArray(patch)||(patch=[patch]);return!patch.some((index=>index.hunks.some((hunk=>hunk.lines.some((line=>!line.startsWith("\\")&&line.endsWith("\r")))))))},_exports.isWin=function(patch){Array.isArray(patch)||(patch=[patch]);return patch.some((index=>index.hunks.some((hunk=>hunk.lines.some((line=>line.endsWith("\r")))))))&&patch.every((index=>index.hunks.every((hunk=>hunk.lines.every(((line,i)=>line.startsWith("\\")||line.endsWith("\r")||hunk.lines[i+1]?.startsWith("\\")))))))},_exports.unixToWin=function unixToWin(patch){if(Array.isArray(patch))return patch.map(unixToWin);return{...patch,hunks:patch.hunks.map((hunk=>({...hunk,lines:hunk.lines.map(((line,i)=>line.startsWith("\\")||line.endsWith("\r")||hunk.lines[i+1]?.startsWith("\\")?line:line+"\r"))})))}},_exports.winToUnix=function winToUnix(patch){if(Array.isArray(patch))return patch.map(winToUnix);return{...patch,hunks:patch.hunks.map((hunk=>({...hunk,lines:hunk.lines.map((line=>line.endsWith("\r")?line.substring(0,line.length-1):line))})))}}})); //# sourceMappingURL=line-endings.min.js.map \ No newline at end of file diff --git a/lib/editor/tiny/plugins/collaborative/amd/build/jsdiff/patch/line-endings.min.js.map b/lib/editor/tiny/plugins/collaborative/amd/build/jsdiff/patch/line-endings.min.js.map index 255ab4fab324e..7e55288505500 100644 --- a/lib/editor/tiny/plugins/collaborative/amd/build/jsdiff/patch/line-endings.min.js.map +++ b/lib/editor/tiny/plugins/collaborative/amd/build/jsdiff/patch/line-endings.min.js.map @@ -1 +1 @@ -{"version":3,"file":"line-endings.min.js","sources":["../../../src/jsdiff/patch/line-endings.js"],"sourcesContent":["export function unixToWin(patch) {\n if (Array.isArray(patch)) {\n return patch.map(unixToWin);\n }\n\n return {\n ...patch,\n hunks: patch.hunks.map(hunk => ({\n ...hunk,\n lines: hunk.lines.map(\n (line, i) =>\n (line.startsWith('\\\\') || line.endsWith('\\r') || hunk.lines[i + 1]?.startsWith('\\\\'))\n ? line\n : line + '\\r'\n )\n }))\n };\n}\n\nexport function winToUnix(patch) {\n if (Array.isArray(patch)) {\n return patch.map(winToUnix);\n }\n\n return {\n ...patch,\n hunks: patch.hunks.map(hunk => ({\n ...hunk,\n lines: hunk.lines.map(line => line.endsWith('\\r') ? line.substring(0, line.length - 1) : line)\n }))\n };\n}\n\n/**\n * Returns true if the patch consistently uses Unix line endings (or only involves one line and has\n * no line endings).\n */\nexport function isUnix(patch) {\n if (!Array.isArray(patch)) { patch = [patch]; }\n return !patch.some(\n index => index.hunks.some(\n hunk => hunk.lines.some(\n line => !line.startsWith('\\\\') && line.endsWith('\\r')\n )\n )\n );\n}\n\n/**\n * Returns true if the patch uses Windows line endings and only Windows line endings.\n */\nexport function isWin(patch) {\n if (!Array.isArray(patch)) { patch = [patch]; }\n return patch.some(index => index.hunks.some(hunk => hunk.lines.some(line => line.endsWith('\\r'))))\n && patch.every(\n index => index.hunks.every(\n hunk => hunk.lines.every(\n (line, i) => line.startsWith('\\\\') || line.endsWith('\\r') || hunk.lines[i + 1]?.startsWith('\\\\')\n )\n )\n );\n}\n"],"names":["patch","Array","isArray","some","index","hunks","hunk","lines","line","startsWith","endsWith","every","i","_hunk$lines2","unixToWin","map","_hunk$lines","winToUnix","substring","length"],"mappings":"uKAqCuBA,OAChBC,MAAMC,QAAQF,SAAUA,MAAQ,CAACA,eAC9BA,MAAMG,MACZC,OAASA,MAAMC,MAAMF,MACnBG,MAAQA,KAAKC,MAAMJ,MACjBK,OAASA,KAAKC,WAAW,OAASD,KAAKE,SAAS,qCASlCV,OACfC,MAAMC,QAAQF,SAAUA,MAAQ,CAACA,eAC/BA,MAAMG,MAAKC,OAASA,MAAMC,MAAMF,MAAKG,MAAQA,KAAKC,MAAMJ,MAAKK,MAAQA,KAAKE,SAAS,aACrFV,MAAMW,OACPP,OAASA,MAAMC,MAAMM,OACnBL,MAAQA,KAAKC,MAAMI,OACjB,CAACH,KAAMI,6BAAMJ,KAAKC,WAAW,OAASD,KAAKE,SAAS,6BAASJ,KAAKC,MAAMK,EAAI,kCAAfC,aAAmBJ,WAAW,2CAzDrFK,UAAUd,UACpBC,MAAMC,QAAQF,cACTA,MAAMe,IAAID,iBAGZ,IACFd,MACHK,MAAOL,MAAMK,MAAMU,KAAIT,WAClBA,KACHC,MAAOD,KAAKC,MAAMQ,KAChB,CAACP,KAAMI,4BACJJ,KAAKC,WAAW,OAASD,KAAKE,SAAS,2BAASJ,KAAKC,MAAMK,EAAI,2BAAfI,YAAmBP,WAAW,MAC3ED,KACAA,KAAO,0CAMLS,UAAUjB,UACpBC,MAAMC,QAAQF,cACTA,MAAMe,IAAIE,iBAGZ,IACFjB,MACHK,MAAOL,MAAMK,MAAMU,KAAIT,WAClBA,KACHC,MAAOD,KAAKC,MAAMQ,KAAIP,MAAQA,KAAKE,SAAS,MAAQF,KAAKU,UAAU,EAAGV,KAAKW,OAAS,GAAKX"} \ No newline at end of file +{"version":3,"file":"line-endings.min.js","sources":["../../../src/jsdiff/patch/line-endings.js"],"sourcesContent":["export function unixToWin(patch) {\n if (Array.isArray(patch)) {\n return patch.map(unixToWin);\n }\n\n return {\n ...patch,\n hunks: patch.hunks.map(hunk => ({\n ...hunk,\n lines: hunk.lines.map(\n (line, i) =>\n (line.startsWith('\\\\') || line.endsWith('\\r') || hunk.lines[i + 1]?.startsWith('\\\\'))\n ? line\n : line + '\\r'\n )\n }))\n };\n}\n\nexport function winToUnix(patch) {\n if (Array.isArray(patch)) {\n return patch.map(winToUnix);\n }\n\n return {\n ...patch,\n hunks: patch.hunks.map(hunk => ({\n ...hunk,\n lines: hunk.lines.map(line => line.endsWith('\\r') ? line.substring(0, line.length - 1) : line)\n }))\n };\n}\n\n/**\n * Returns true if the patch consistently uses Unix line endings (or only involves one line and has\n * no line endings).\n */\nexport function isUnix(patch) {\n if (!Array.isArray(patch)) { patch = [patch]; }\n return !patch.some(\n index => index.hunks.some(\n hunk => hunk.lines.some(\n line => !line.startsWith('\\\\') && line.endsWith('\\r')\n )\n )\n );\n}\n\n/**\n * Returns true if the patch uses Windows line endings and only Windows line endings.\n */\nexport function isWin(patch) {\n if (!Array.isArray(patch)) { patch = [patch]; }\n return patch.some(index => index.hunks.some(hunk => hunk.lines.some(line => line.endsWith('\\r'))))\n && patch.every(\n index => index.hunks.every(\n hunk => hunk.lines.every(\n (line, i) => line.startsWith('\\\\') || line.endsWith('\\r') || hunk.lines[i + 1]?.startsWith('\\\\')\n )\n )\n );\n}\n"],"names":["patch","Array","isArray","some","index","hunks","hunk","lines","line","startsWith","endsWith","every","i","unixToWin","map","winToUnix","substring","length"],"mappings":"8JAqCO,SAAgBA,OAChBC,MAAMC,QAAQF,SAAUA,MAAQ,CAACA,QACtC,OAAQA,MAAMG,MACZC,OAASA,MAAMC,MAAMF,MACnBG,MAAQA,KAAKC,MAAMJ,MACjBK,OAASA,KAAKC,WAAW,OAASD,KAAKE,SAAS,WAIxD,iBAKO,SAAeV,OACfC,MAAMC,QAAQF,SAAUA,MAAQ,CAACA,QACtC,OAAOA,MAAMG,MAAKC,OAASA,MAAMC,MAAMF,MAAKG,MAAQA,KAAKC,MAAMJ,MAAKK,MAAQA,KAAKE,SAAS,aACrFV,MAAMW,OACPP,OAASA,MAAMC,MAAMM,OACnBL,MAAQA,KAAKC,MAAMI,OACjB,CAACH,KAAMI,IAAMJ,KAAKC,WAAW,OAASD,KAAKE,SAAS,OAASJ,KAAKC,MAAMK,EAAI,IAAIH,WAAW,WAIrG,qBA7DO,SAASI,UAAUb,OACxB,GAAIC,MAAMC,QAAQF,OAChB,OAAOA,MAAMc,IAAID,WAGnB,MAAO,IACFb,MACHK,MAAOL,MAAMK,MAAMS,KAAIR,OAAS,IAC3BA,KACHC,MAAOD,KAAKC,MAAMO,KAChB,CAACN,KAAMI,IACJJ,KAAKC,WAAW,OAASD,KAAKE,SAAS,OAASJ,KAAKC,MAAMK,EAAI,IAAIH,WAAW,MAC3ED,KACAA,KAAO,WAIrB,qBAEO,SAASO,UAAUf,OACxB,GAAIC,MAAMC,QAAQF,OAChB,OAAOA,MAAMc,IAAIC,WAGnB,MAAO,IACFf,MACHK,MAAOL,MAAMK,MAAMS,KAAIR,OAAS,IAC3BA,KACHC,MAAOD,KAAKC,MAAMO,KAAIN,MAAQA,KAAKE,SAAS,MAAQF,KAAKQ,UAAU,EAAGR,KAAKS,OAAS,GAAKT,WAG/F,CA8BC"} \ No newline at end of file diff --git a/lib/editor/tiny/plugins/collaborative/amd/build/jsdiff/patch/merge.min.js.map b/lib/editor/tiny/plugins/collaborative/amd/build/jsdiff/patch/merge.min.js.map index 9b426c11ddcc2..414b804178fff 100644 --- a/lib/editor/tiny/plugins/collaborative/amd/build/jsdiff/patch/merge.min.js.map +++ b/lib/editor/tiny/plugins/collaborative/amd/build/jsdiff/patch/merge.min.js.map @@ -1 +1 @@ -{"version":3,"file":"merge.min.js","sources":["../../../src/jsdiff/patch/merge.js"],"sourcesContent":["import {structuredPatch} from './create';\nimport {parsePatch} from './parse';\n\nimport {arrayEqual, arrayStartsWith} from '../util/array';\n\nexport function calcLineCount(hunk) {\n const {oldLines, newLines} = calcOldNewLineCount(hunk.lines);\n\n if (oldLines !== undefined) {\n hunk.oldLines = oldLines;\n } else {\n delete hunk.oldLines;\n }\n\n if (newLines !== undefined) {\n hunk.newLines = newLines;\n } else {\n delete hunk.newLines;\n }\n}\n\nexport function merge(mine, theirs, base) {\n mine = loadPatch(mine, base);\n theirs = loadPatch(theirs, base);\n\n let ret = {};\n\n // For index we just let it pass through as it doesn't have any necessary meaning.\n // Leaving sanity checks on this to the API consumer that may know more about the\n // meaning in their own context.\n if (mine.index || theirs.index) {\n ret.index = mine.index || theirs.index;\n }\n\n if (mine.newFileName || theirs.newFileName) {\n if (!fileNameChanged(mine)) {\n // No header or no change in ours, use theirs (and ours if theirs does not exist)\n ret.oldFileName = theirs.oldFileName || mine.oldFileName;\n ret.newFileName = theirs.newFileName || mine.newFileName;\n ret.oldHeader = theirs.oldHeader || mine.oldHeader;\n ret.newHeader = theirs.newHeader || mine.newHeader;\n } else if (!fileNameChanged(theirs)) {\n // No header or no change in theirs, use ours\n ret.oldFileName = mine.oldFileName;\n ret.newFileName = mine.newFileName;\n ret.oldHeader = mine.oldHeader;\n ret.newHeader = mine.newHeader;\n } else {\n // Both changed... figure it out\n ret.oldFileName = selectField(ret, mine.oldFileName, theirs.oldFileName);\n ret.newFileName = selectField(ret, mine.newFileName, theirs.newFileName);\n ret.oldHeader = selectField(ret, mine.oldHeader, theirs.oldHeader);\n ret.newHeader = selectField(ret, mine.newHeader, theirs.newHeader);\n }\n }\n\n ret.hunks = [];\n\n let mineIndex = 0,\n theirsIndex = 0,\n mineOffset = 0,\n theirsOffset = 0;\n\n while (mineIndex < mine.hunks.length || theirsIndex < theirs.hunks.length) {\n let mineCurrent = mine.hunks[mineIndex] || {oldStart: Infinity},\n theirsCurrent = theirs.hunks[theirsIndex] || {oldStart: Infinity};\n\n if (hunkBefore(mineCurrent, theirsCurrent)) {\n // This patch does not overlap with any of the others, yay.\n ret.hunks.push(cloneHunk(mineCurrent, mineOffset));\n mineIndex++;\n theirsOffset += mineCurrent.newLines - mineCurrent.oldLines;\n } else if (hunkBefore(theirsCurrent, mineCurrent)) {\n // This patch does not overlap with any of the others, yay.\n ret.hunks.push(cloneHunk(theirsCurrent, theirsOffset));\n theirsIndex++;\n mineOffset += theirsCurrent.newLines - theirsCurrent.oldLines;\n } else {\n // Overlap, merge as best we can\n let mergedHunk = {\n oldStart: Math.min(mineCurrent.oldStart, theirsCurrent.oldStart),\n oldLines: 0,\n newStart: Math.min(mineCurrent.newStart + mineOffset, theirsCurrent.oldStart + theirsOffset),\n newLines: 0,\n lines: []\n };\n mergeLines(mergedHunk, mineCurrent.oldStart, mineCurrent.lines, theirsCurrent.oldStart, theirsCurrent.lines);\n theirsIndex++;\n mineIndex++;\n\n ret.hunks.push(mergedHunk);\n }\n }\n\n return ret;\n}\n\nfunction loadPatch(param, base) {\n if (typeof param === 'string') {\n if ((/^@@/m).test(param) || ((/^Index:/m).test(param))) {\n return parsePatch(param)[0];\n }\n\n if (!base) {\n throw new Error('Must provide a base reference or pass in a patch');\n }\n return structuredPatch(undefined, undefined, base, param);\n }\n\n return param;\n}\n\nfunction fileNameChanged(patch) {\n return patch.newFileName && patch.newFileName !== patch.oldFileName;\n}\n\nfunction selectField(index, mine, theirs) {\n if (mine === theirs) {\n return mine;\n } else {\n index.conflict = true;\n return {mine, theirs};\n }\n}\n\nfunction hunkBefore(test, check) {\n return test.oldStart < check.oldStart\n && (test.oldStart + test.oldLines) < check.oldStart;\n}\n\nfunction cloneHunk(hunk, offset) {\n return {\n oldStart: hunk.oldStart, oldLines: hunk.oldLines,\n newStart: hunk.newStart + offset, newLines: hunk.newLines,\n lines: hunk.lines\n };\n}\n\nfunction mergeLines(hunk, mineOffset, mineLines, theirOffset, theirLines) {\n // This will generally result in a conflicted hunk, but there are cases where the context\n // is the only overlap where we can successfully merge the content here.\n let mine = {offset: mineOffset, lines: mineLines, index: 0},\n their = {offset: theirOffset, lines: theirLines, index: 0};\n\n // Handle any leading content\n insertLeading(hunk, mine, their);\n insertLeading(hunk, their, mine);\n\n // Now in the overlap content. Scan through and select the best changes from each.\n while (mine.index < mine.lines.length && their.index < their.lines.length) {\n let mineCurrent = mine.lines[mine.index],\n theirCurrent = their.lines[their.index];\n\n if ((mineCurrent[0] === '-' || mineCurrent[0] === '+')\n && (theirCurrent[0] === '-' || theirCurrent[0] === '+')) {\n // Both modified ...\n mutualChange(hunk, mine, their);\n } else if (mineCurrent[0] === '+' && theirCurrent[0] === ' ') {\n // Mine inserted\n hunk.lines.push(... collectChange(mine));\n } else if (theirCurrent[0] === '+' && mineCurrent[0] === ' ') {\n // Theirs inserted\n hunk.lines.push(... collectChange(their));\n } else if (mineCurrent[0] === '-' && theirCurrent[0] === ' ') {\n // Mine removed or edited\n removal(hunk, mine, their);\n } else if (theirCurrent[0] === '-' && mineCurrent[0] === ' ') {\n // Their removed or edited\n removal(hunk, their, mine, true);\n } else if (mineCurrent === theirCurrent) {\n // Context identity\n hunk.lines.push(mineCurrent);\n mine.index++;\n their.index++;\n } else {\n // Context mismatch\n conflict(hunk, collectChange(mine), collectChange(their));\n }\n }\n\n // Now push anything that may be remaining\n insertTrailing(hunk, mine);\n insertTrailing(hunk, their);\n\n calcLineCount(hunk);\n}\n\nfunction mutualChange(hunk, mine, their) {\n let myChanges = collectChange(mine),\n theirChanges = collectChange(their);\n\n if (allRemoves(myChanges) && allRemoves(theirChanges)) {\n // Special case for remove changes that are supersets of one another\n if (arrayStartsWith(myChanges, theirChanges)\n && skipRemoveSuperset(their, myChanges, myChanges.length - theirChanges.length)) {\n hunk.lines.push(... myChanges);\n return;\n } else if (arrayStartsWith(theirChanges, myChanges)\n && skipRemoveSuperset(mine, theirChanges, theirChanges.length - myChanges.length)) {\n hunk.lines.push(... theirChanges);\n return;\n }\n } else if (arrayEqual(myChanges, theirChanges)) {\n hunk.lines.push(... myChanges);\n return;\n }\n\n conflict(hunk, myChanges, theirChanges);\n}\n\nfunction removal(hunk, mine, their, swap) {\n let myChanges = collectChange(mine),\n theirChanges = collectContext(their, myChanges);\n if (theirChanges.merged) {\n hunk.lines.push(... theirChanges.merged);\n } else {\n conflict(hunk, swap ? theirChanges : myChanges, swap ? myChanges : theirChanges);\n }\n}\n\nfunction conflict(hunk, mine, their) {\n hunk.conflict = true;\n hunk.lines.push({\n conflict: true,\n mine: mine,\n theirs: their\n });\n}\n\nfunction insertLeading(hunk, insert, their) {\n while (insert.offset < their.offset && insert.index < insert.lines.length) {\n let line = insert.lines[insert.index++];\n hunk.lines.push(line);\n insert.offset++;\n }\n}\nfunction insertTrailing(hunk, insert) {\n while (insert.index < insert.lines.length) {\n let line = insert.lines[insert.index++];\n hunk.lines.push(line);\n }\n}\n\nfunction collectChange(state) {\n let ret = [],\n operation = state.lines[state.index][0];\n while (state.index < state.lines.length) {\n let line = state.lines[state.index];\n\n // Group additions that are immediately after subtractions and treat them as one \"atomic\" modify change.\n if (operation === '-' && line[0] === '+') {\n operation = '+';\n }\n\n if (operation === line[0]) {\n ret.push(line);\n state.index++;\n } else {\n break;\n }\n }\n\n return ret;\n}\nfunction collectContext(state, matchChanges) {\n let changes = [],\n merged = [],\n matchIndex = 0,\n contextChanges = false,\n conflicted = false;\n while (matchIndex < matchChanges.length\n && state.index < state.lines.length) {\n let change = state.lines[state.index],\n match = matchChanges[matchIndex];\n\n // Once we've hit our add, then we are done\n if (match[0] === '+') {\n break;\n }\n\n contextChanges = contextChanges || change[0] !== ' ';\n\n merged.push(match);\n matchIndex++;\n\n // Consume any additions in the other block as a conflict to attempt\n // to pull in the remaining context after this\n if (change[0] === '+') {\n conflicted = true;\n\n while (change[0] === '+') {\n changes.push(change);\n change = state.lines[++state.index];\n }\n }\n\n if (match.substr(1) === change.substr(1)) {\n changes.push(change);\n state.index++;\n } else {\n conflicted = true;\n }\n }\n\n if ((matchChanges[matchIndex] || '')[0] === '+'\n && contextChanges) {\n conflicted = true;\n }\n\n if (conflicted) {\n return changes;\n }\n\n while (matchIndex < matchChanges.length) {\n merged.push(matchChanges[matchIndex++]);\n }\n\n return {\n merged,\n changes\n };\n}\n\nfunction allRemoves(changes) {\n return changes.reduce(function(prev, change) {\n return prev && change[0] === '-';\n }, true);\n}\nfunction skipRemoveSuperset(state, removeChanges, delta) {\n for (let i = 0; i < delta; i++) {\n let changeContent = removeChanges[removeChanges.length - delta + i].substr(1);\n if (state.lines[state.index + i] !== ' ' + changeContent) {\n return false;\n }\n }\n\n state.index += delta;\n return true;\n}\n\nfunction calcOldNewLineCount(lines) {\n let oldLines = 0;\n let newLines = 0;\n\n lines.forEach(function(line) {\n if (typeof line !== 'string') {\n let myCount = calcOldNewLineCount(line.mine);\n let theirCount = calcOldNewLineCount(line.theirs);\n\n if (oldLines !== undefined) {\n if (myCount.oldLines === theirCount.oldLines) {\n oldLines += myCount.oldLines;\n } else {\n oldLines = undefined;\n }\n }\n\n if (newLines !== undefined) {\n if (myCount.newLines === theirCount.newLines) {\n newLines += myCount.newLines;\n } else {\n newLines = undefined;\n }\n }\n } else {\n if (newLines !== undefined && (line[0] === '+' || line[0] === ' ')) {\n newLines++;\n }\n if (oldLines !== undefined && (line[0] === '-' || line[0] === ' ')) {\n oldLines++;\n }\n }\n });\n\n return {oldLines, newLines};\n}\n"],"names":["calcLineCount","hunk","oldLines","newLines","calcOldNewLineCount","lines","undefined","loadPatch","param","base","test","Error","fileNameChanged","patch","newFileName","oldFileName","selectField","index","mine","theirs","conflict","hunkBefore","check","oldStart","cloneHunk","offset","newStart","mergeLines","mineOffset","mineLines","theirOffset","theirLines","their","insertLeading","length","mineCurrent","theirCurrent","push","collectChange","removal","mutualChange","insertTrailing","myChanges","theirChanges","allRemoves","skipRemoveSuperset","swap","state","matchChanges","changes","merged","matchIndex","contextChanges","conflicted","change","match","substr","collectContext","insert","line","ret","operation","reduce","prev","removeChanges","delta","i","changeContent","forEach","myCount","theirCount","oldHeader","newHeader","hunks","mineIndex","theirsIndex","theirsOffset","Infinity","theirsCurrent","mergedHunk","Math","min"],"mappings":"mJAKgBA,cAAcC,YACtBC,SAACA,SAADC,SAAWA,UAAYC,oBAAoBH,KAAKI,YAErCC,IAAbJ,SACFD,KAAKC,SAAWA,gBAETD,KAAKC,cAGGI,IAAbH,SACFF,KAAKE,SAAWA,gBAETF,KAAKE,kBAgFPI,UAAUC,MAAOC,SACH,iBAAVD,MAAoB,IACxB,OAAQE,KAAKF,QAAY,WAAYE,KAAKF,cACtC,qBAAWA,OAAO,OAGtBC,WACG,IAAIE,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AI9C,YAAcI,KAAKJ,YACvB8C,IAAIW,UAAYrD,KAAKqD,UACrBX,IAAIY,UAAYtD,KAAKsD,YATrBZ,IAAI7C,YAAcI,OAAOJ,aAAeG,KAAKH,YAC7C6C,IAAI9C,YAAcK,OAAOL,aAAeI,KAAKJ,YAC7C8C,IAAIW,UAAYpD,OAAOoD,WAAarD,KAAKqD,UACzCX,IAAIY,UAAYrD,OAAOqD,WAAatD,KAAKsD,YAgB7CZ,IAAIa,MAAQ,OAERC,UAAY,EACZC,YAAc,EACd/C,WAAa,EACbgD,aAAe,OAEZF,UAAYxD,KAAKuD,MAAMvC,QAAUyC,YAAcxD,OAAOsD,MAAMvC,QAAQ,KACrEC,YAAcjB,KAAKuD,MAAMC,YAAc,CAACnD,SAAUsD,EAAAA,GAClDC,cAAgB3D,OAAOsD,MAAME,cAAgB,CAACpD,SAAUsD,EAAAA,MAExDxD,WAAWc,YAAa2C,eAE1BlB,IAAIa,MAAMpC,KAAKb,UAAUW,YAAaP,aACtC8C,YACAE,cAAgBzC,YAAYhC,SAAWgC,YAAYjC,cAC9C,GAAImB,WAAWyD,cAAe3C,aAEnCyB,IAAIa,MAAMpC,KAAKb,UAAUsD,cAAeF,eACxCD,cACA/C,YAAckD,cAAc3E,SAAW2E,cAAc5E,aAChD,KAED6E,WAAa,CACfxD,SAAUyD,KAAKC,IAAI9C,YAAYZ,SAAUuD,cAAcvD,UACvDrB,SAAU,EACVwB,SAAUsD,KAAKC,IAAI9C,YAAYT,SAAWE,WAAYkD,cAAcvD,SAAWqD,cAC/EzE,SAAU,EACVE,MAAO,IAETsB,WAAWoD,WAAY5C,YAAYZ,SAAUY,YAAY9B,MAAOyE,cAAcvD,SAAUuD,cAAczE,OACtGsE,cACAD,YAEAd,IAAIa,MAAMpC,KAAK0C,oBAIZnB"} \ No newline at end of file +{"version":3,"file":"merge.min.js","sources":["../../../src/jsdiff/patch/merge.js"],"sourcesContent":["import {structuredPatch} from './create';\nimport {parsePatch} from './parse';\n\nimport {arrayEqual, arrayStartsWith} from '../util/array';\n\nexport function calcLineCount(hunk) {\n const {oldLines, newLines} = calcOldNewLineCount(hunk.lines);\n\n if (oldLines !== undefined) {\n hunk.oldLines = oldLines;\n } else {\n delete hunk.oldLines;\n }\n\n if (newLines !== undefined) {\n hunk.newLines = newLines;\n } else {\n delete hunk.newLines;\n }\n}\n\nexport function merge(mine, theirs, base) {\n mine = loadPatch(mine, base);\n theirs = loadPatch(theirs, base);\n\n let ret = {};\n\n // For index we just let it pass through as it doesn't have any necessary meaning.\n // Leaving sanity checks on this to the API consumer that may know more about the\n // meaning in their own context.\n if (mine.index || theirs.index) {\n ret.index = mine.index || theirs.index;\n }\n\n if (mine.newFileName || theirs.newFileName) {\n if (!fileNameChanged(mine)) {\n // No header or no change in ours, use theirs (and ours if theirs does not exist)\n ret.oldFileName = theirs.oldFileName || mine.oldFileName;\n ret.newFileName = theirs.newFileName || mine.newFileName;\n ret.oldHeader = theirs.oldHeader || mine.oldHeader;\n ret.newHeader = theirs.newHeader || mine.newHeader;\n } else if (!fileNameChanged(theirs)) {\n // No header or no change in theirs, use ours\n ret.oldFileName = mine.oldFileName;\n ret.newFileName = mine.newFileName;\n ret.oldHeader = mine.oldHeader;\n ret.newHeader = mine.newHeader;\n } else {\n // Both changed... figure it out\n ret.oldFileName = selectField(ret, mine.oldFileName, theirs.oldFileName);\n ret.newFileName = selectField(ret, mine.newFileName, theirs.newFileName);\n ret.oldHeader = selectField(ret, mine.oldHeader, theirs.oldHeader);\n ret.newHeader = selectField(ret, mine.newHeader, theirs.newHeader);\n }\n }\n\n ret.hunks = [];\n\n let mineIndex = 0,\n theirsIndex = 0,\n mineOffset = 0,\n theirsOffset = 0;\n\n while (mineIndex < mine.hunks.length || theirsIndex < theirs.hunks.length) {\n let mineCurrent = mine.hunks[mineIndex] || {oldStart: Infinity},\n theirsCurrent = theirs.hunks[theirsIndex] || {oldStart: Infinity};\n\n if (hunkBefore(mineCurrent, theirsCurrent)) {\n // This patch does not overlap with any of the others, yay.\n ret.hunks.push(cloneHunk(mineCurrent, mineOffset));\n mineIndex++;\n theirsOffset += mineCurrent.newLines - mineCurrent.oldLines;\n } else if (hunkBefore(theirsCurrent, mineCurrent)) {\n // This patch does not overlap with any of the others, yay.\n ret.hunks.push(cloneHunk(theirsCurrent, theirsOffset));\n theirsIndex++;\n mineOffset += theirsCurrent.newLines - theirsCurrent.oldLines;\n } else {\n // Overlap, merge as best we can\n let mergedHunk = {\n oldStart: Math.min(mineCurrent.oldStart, theirsCurrent.oldStart),\n oldLines: 0,\n newStart: Math.min(mineCurrent.newStart + mineOffset, theirsCurrent.oldStart + theirsOffset),\n newLines: 0,\n lines: []\n };\n mergeLines(mergedHunk, mineCurrent.oldStart, mineCurrent.lines, theirsCurrent.oldStart, theirsCurrent.lines);\n theirsIndex++;\n mineIndex++;\n\n ret.hunks.push(mergedHunk);\n }\n }\n\n return ret;\n}\n\nfunction loadPatch(param, base) {\n if (typeof param === 'string') {\n if ((/^@@/m).test(param) || ((/^Index:/m).test(param))) {\n return parsePatch(param)[0];\n }\n\n if (!base) {\n throw new Error('Must provide a base reference or pass in a patch');\n }\n return structuredPatch(undefined, undefined, base, param);\n }\n\n return param;\n}\n\nfunction fileNameChanged(patch) {\n return patch.newFileName && patch.newFileName !== patch.oldFileName;\n}\n\nfunction selectField(index, mine, theirs) {\n if (mine === theirs) {\n return mine;\n } else {\n index.conflict = true;\n return {mine, theirs};\n }\n}\n\nfunction hunkBefore(test, check) {\n return test.oldStart < check.oldStart\n && (test.oldStart + test.oldLines) < check.oldStart;\n}\n\nfunction cloneHunk(hunk, offset) {\n return {\n oldStart: hunk.oldStart, oldLines: hunk.oldLines,\n newStart: hunk.newStart + offset, newLines: hunk.newLines,\n lines: hunk.lines\n };\n}\n\nfunction mergeLines(hunk, mineOffset, mineLines, theirOffset, theirLines) {\n // This will generally result in a conflicted hunk, but there are cases where the context\n // is the only overlap where we can successfully merge the content here.\n let mine = {offset: mineOffset, lines: mineLines, index: 0},\n their = {offset: theirOffset, lines: theirLines, index: 0};\n\n // Handle any leading content\n insertLeading(hunk, mine, their);\n insertLeading(hunk, their, mine);\n\n // Now in the overlap content. Scan through and select the best changes from each.\n while (mine.index < mine.lines.length && their.index < their.lines.length) {\n let mineCurrent = mine.lines[mine.index],\n theirCurrent = their.lines[their.index];\n\n if ((mineCurrent[0] === '-' || mineCurrent[0] === '+')\n && (theirCurrent[0] === '-' || theirCurrent[0] === '+')) {\n // Both modified ...\n mutualChange(hunk, mine, their);\n } else if (mineCurrent[0] === '+' && theirCurrent[0] === ' ') {\n // Mine inserted\n hunk.lines.push(... collectChange(mine));\n } else if (theirCurrent[0] === '+' && mineCurrent[0] === ' ') {\n // Theirs inserted\n hunk.lines.push(... collectChange(their));\n } else if (mineCurrent[0] === '-' && theirCurrent[0] === ' ') {\n // Mine removed or edited\n removal(hunk, mine, their);\n } else if (theirCurrent[0] === '-' && mineCurrent[0] === ' ') {\n // Their removed or edited\n removal(hunk, their, mine, true);\n } else if (mineCurrent === theirCurrent) {\n // Context identity\n hunk.lines.push(mineCurrent);\n mine.index++;\n their.index++;\n } else {\n // Context mismatch\n conflict(hunk, collectChange(mine), collectChange(their));\n }\n }\n\n // Now push anything that may be remaining\n insertTrailing(hunk, mine);\n insertTrailing(hunk, their);\n\n calcLineCount(hunk);\n}\n\nfunction mutualChange(hunk, mine, their) {\n let myChanges = collectChange(mine),\n theirChanges = collectChange(their);\n\n if (allRemoves(myChanges) && allRemoves(theirChanges)) {\n // Special case for remove changes that are supersets of one another\n if (arrayStartsWith(myChanges, theirChanges)\n && skipRemoveSuperset(their, myChanges, myChanges.length - theirChanges.length)) {\n hunk.lines.push(... myChanges);\n return;\n } else if (arrayStartsWith(theirChanges, myChanges)\n && skipRemoveSuperset(mine, theirChanges, theirChanges.length - myChanges.length)) {\n hunk.lines.push(... theirChanges);\n return;\n }\n } else if (arrayEqual(myChanges, theirChanges)) {\n hunk.lines.push(... myChanges);\n return;\n }\n\n conflict(hunk, myChanges, theirChanges);\n}\n\nfunction removal(hunk, mine, their, swap) {\n let myChanges = collectChange(mine),\n theirChanges = collectContext(their, myChanges);\n if (theirChanges.merged) {\n hunk.lines.push(... theirChanges.merged);\n } else {\n conflict(hunk, swap ? theirChanges : myChanges, swap ? myChanges : theirChanges);\n }\n}\n\nfunction conflict(hunk, mine, their) {\n hunk.conflict = true;\n hunk.lines.push({\n conflict: true,\n mine: mine,\n theirs: their\n });\n}\n\nfunction insertLeading(hunk, insert, their) {\n while (insert.offset < their.offset && insert.index < insert.lines.length) {\n let line = insert.lines[insert.index++];\n hunk.lines.push(line);\n insert.offset++;\n }\n}\nfunction insertTrailing(hunk, insert) {\n while (insert.index < insert.lines.length) {\n let line = insert.lines[insert.index++];\n hunk.lines.push(line);\n }\n}\n\nfunction collectChange(state) {\n let ret = [],\n operation = state.lines[state.index][0];\n while (state.index < state.lines.length) {\n let line = state.lines[state.index];\n\n // Group additions that are immediately after subtractions and treat them as one \"atomic\" modify change.\n if (operation === '-' && line[0] === '+') {\n operation = '+';\n }\n\n if (operation === line[0]) {\n ret.push(line);\n state.index++;\n } else {\n break;\n }\n }\n\n return ret;\n}\nfunction collectContext(state, matchChanges) {\n let changes = [],\n merged = [],\n matchIndex = 0,\n contextChanges = false,\n conflicted = false;\n while (matchIndex < matchChanges.length\n && state.index < state.lines.length) {\n let change = state.lines[state.index],\n match = matchChanges[matchIndex];\n\n // Once we've hit our add, then we are done\n if (match[0] === '+') {\n break;\n }\n\n contextChanges = contextChanges || change[0] !== ' ';\n\n merged.push(match);\n matchIndex++;\n\n // Consume any additions in the other block as a conflict to attempt\n // to pull in the remaining context after this\n if (change[0] === '+') {\n conflicted = true;\n\n while (change[0] === '+') {\n changes.push(change);\n change = state.lines[++state.index];\n }\n }\n\n if (match.substr(1) === change.substr(1)) {\n changes.push(change);\n state.index++;\n } else {\n conflicted = true;\n }\n }\n\n if ((matchChanges[matchIndex] || '')[0] === '+'\n && contextChanges) {\n conflicted = true;\n }\n\n if (conflicted) {\n return changes;\n }\n\n while (matchIndex < matchChanges.length) {\n merged.push(matchChanges[matchIndex++]);\n }\n\n return {\n merged,\n changes\n };\n}\n\nfunction allRemoves(changes) {\n return changes.reduce(function(prev, change) {\n return prev && change[0] === '-';\n }, true);\n}\nfunction skipRemoveSuperset(state, removeChanges, delta) {\n for (let i = 0; i < delta; i++) {\n let changeContent = removeChanges[removeChanges.length - delta + i].substr(1);\n if (state.lines[state.index + i] !== ' ' + changeContent) {\n return false;\n }\n }\n\n state.index += delta;\n return true;\n}\n\nfunction calcOldNewLineCount(lines) {\n let oldLines = 0;\n let newLines = 0;\n\n lines.forEach(function(line) {\n if (typeof line !== 'string') {\n let myCount = calcOldNewLineCount(line.mine);\n let theirCount = calcOldNewLineCount(line.theirs);\n\n if (oldLines !== undefined) {\n if (myCount.oldLines === theirCount.oldLines) {\n oldLines += myCount.oldLines;\n } else {\n oldLines = undefined;\n }\n }\n\n if (newLines !== undefined) {\n if (myCount.newLines === theirCount.newLines) {\n newLines += myCount.newLines;\n } else {\n newLines = undefined;\n }\n }\n } else {\n if (newLines !== undefined && (line[0] === '+' || line[0] === ' ')) {\n newLines++;\n }\n if (oldLines !== undefined && (line[0] === '-' || line[0] === ' ')) {\n oldLines++;\n }\n }\n });\n\n return {oldLines, newLines};\n}\n"],"names":["calcLineCount","hunk","oldLines","newLines","calcOldNewLineCount","lines","undefined","loadPatch","param","base","test","parsePatch","Error","structuredPatch","fileNameChanged","patch","newFileName","oldFileName","selectField","index","mine","theirs","conflict","hunkBefore","check","oldStart","cloneHunk","offset","newStart","mergeLines","mineOffset","mineLines","theirOffset","theirLines","their","insertLeading","length","mineCurrent","theirCurrent","push","collectChange","removal","mutualChange","insertTrailing","myChanges","theirChanges","allRemoves","arrayStartsWith","skipRemoveSuperset","arrayEqual","swap","state","matchChanges","changes","merged","matchIndex","contextChanges","conflicted","change","match","substr","collectContext","insert","line","ret","operation","reduce","prev","removeChanges","delta","i","changeContent","forEach","myCount","theirCount","oldHeader","newHeader","hunks","mineIndex","theirsIndex","theirsOffset","Infinity","theirsCurrent","mergedHunk","Math","min"],"mappings":"0IAKO,SAASA,cAAcC,MAC5B,MAAMC,SAACA,SAAQC,SAAEA,UAAYC,oBAAoBH,KAAKI,YAErCC,IAAbJ,SACFD,KAAKC,SAAWA,gBAETD,KAAKC,cAGGI,IAAbH,SACFF,KAAKE,SAAWA,gBAETF,KAAKE,QAEhB,CA8EA,SAASI,UAAUC,MAAOC,MACxB,GAAqB,iBAAVD,MAAoB,CAC7B,GAAK,OAAQE,KAAKF,QAAY,WAAYE,KAAKF,OAC7C,OAAO,EAAAG,OAAUA,YAACH,OAAO,GAG3B,IAAKC,KACH,MAAM,IAAIG,MAAM,oDAElB,OAAO,EAAAC,QAAeA,sBAACP,OAAWA,EAAWG,KAAMD,MACrD,CAEA,OAAOA,KACT,CAEA,SAASM,gBAAgBC,OACvB,OAAOA,MAAMC,aAAeD,MAAMC,cAAgBD,MAAME,WAC1D,CAEA,SAASC,YAAYC,MAAOC,KAAMC,QAChC,OAAID,OAASC,OACJD,MAEPD,MAAMG,UAAW,EACV,CAACF,UAAMC,eAElB,CAEA,SAASE,WAAWb,KAAMc,OACxB,OAAOd,KAAKe,SAAWD,MAAMC,UACvBf,KAAKe,SAAWf,KAAKR,SAAYsB,MAAMC,QAC/C,CAEA,SAASC,UAAUzB,KAAM0B,QACvB,MAAO,CACLF,SAAUxB,KAAKwB,SAAUvB,SAAUD,KAAKC,SACxC0B,SAAU3B,KAAK2B,SAAWD,OAAQxB,SAAUF,KAAKE,SACjDE,MAAOJ,KAAKI,MAEhB,CAEA,SAASwB,WAAW5B,KAAM6B,WAAYC,UAAWC,YAAaC,YAG5D,IAAIb,KAAO,CAACO,OAAQG,WAAYzB,MAAO0B,UAAWZ,MAAO,GACrDe,MAAQ,CAACP,OAAQK,YAAa3B,MAAO4B,WAAYd,MAAO,GAO5D,IAJAgB,cAAclC,KAAMmB,KAAMc,OAC1BC,cAAclC,KAA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AaxD,KAAKwD,YAgB7CZ,IAAIa,MAAQ,GAEZ,IAAIC,UAAY,EACZC,YAAc,EACdjD,WAAa,EACbkD,aAAe,EAEnB,KAAOF,UAAY1D,KAAKyD,MAAMzC,QAAU2C,YAAc1D,OAAOwD,MAAMzC,QAAQ,CACzE,IAAIC,YAAcjB,KAAKyD,MAAMC,YAAc,CAACrD,SAAUwD,KAClDC,cAAgB7D,OAAOwD,MAAME,cAAgB,CAACtD,SAAUwD,KAE5D,GAAI1D,WAAWc,YAAa6C,eAE1BlB,IAAIa,MAAMtC,KAAKb,UAAUW,YAAaP,aACtCgD,YACAE,cAAgB3C,YAAYlC,SAAWkC,YAAYnC,cAC9C,GAAIqB,WAAW2D,cAAe7C,aAEnC2B,IAAIa,MAAMtC,KAAKb,UAAUwD,cAAeF,eACxCD,cACAjD,YAAcoD,cAAc/E,SAAW+E,cAAchF,aAChD,CAEL,IAAIiF,WAAa,CACf1D,SAAU2D,KAAKC,IAAIhD,YAAYZ,SAAUyD,cAAczD,UACvDvB,SAAU,EACV0B,SAAUwD,KAAKC,IAAIhD,YAAYT,SAAWE,WAAYoD,cAAczD,SAAWuD,cAC/E7E,SAAU,EACVE,MAAO,IAETwB,WAAWsD,WAAY9C,YAAYZ,SAAUY,YAAYhC,MAAO6E,cAAczD,SAAUyD,cAAc7E,OACtG0E,cACAD,YAEAd,IAAIa,MAAMtC,KAAK4C,WACjB,CACF,CAEA,OAAOnB,GACT,CAwRC"} \ No newline at end of file diff --git a/lib/editor/tiny/plugins/collaborative/amd/build/jsdiff/patch/parse.min.js b/lib/editor/tiny/plugins/collaborative/amd/build/jsdiff/patch/parse.min.js index d513a237ace92..554eabbf0e98f 100644 --- a/lib/editor/tiny/plugins/collaborative/amd/build/jsdiff/patch/parse.min.js +++ b/lib/editor/tiny/plugins/collaborative/amd/build/jsdiff/patch/parse.min.js @@ -1,3 +1,3 @@ -define("tiny_collaborative/jsdiff/patch/parse",["exports"],(function(_exports){Object.defineProperty(_exports,"__esModule",{value:!0}),_exports.parsePatch=function(uniDiff){let diffstr=uniDiff.split(/\n/),list=[],i=0;function parseIndex(){let index={};for(list.push(index);i({oldLines:hunk.newLines,oldStart:hunk.newStart,newLines:hunk.oldLines,newStart:hunk.oldStart,lines:hunk.lines.map((l=>l.startsWith("-")?"+".concat(l.slice(1)):l.startsWith("+")?"-".concat(l.slice(1)):l))})))}}})); +define("tiny_collaborative/jsdiff/patch/reverse",["exports"],(function(_exports){Object.defineProperty(_exports,"__esModule",{value:!0}),_exports.reversePatch=function reversePatch(structuredPatch){if(Array.isArray(structuredPatch))return structuredPatch.map(reversePatch).reverse();return{...structuredPatch,oldFileName:structuredPatch.newFileName,oldHeader:structuredPatch.newHeader,newFileName:structuredPatch.oldFileName,newHeader:structuredPatch.oldHeader,hunks:structuredPatch.hunks.map((hunk=>({oldLines:hunk.newLines,oldStart:hunk.newStart,newLines:hunk.oldLines,newStart:hunk.oldStart,lines:hunk.lines.map((l=>l.startsWith("-")?`+${l.slice(1)}`:l.startsWith("+")?`-${l.slice(1)}`:l))})))}}})); //# sourceMappingURL=reverse.min.js.map \ No newline at end of file diff --git a/lib/editor/tiny/plugins/collaborative/amd/build/jsdiff/patch/reverse.min.js.map b/lib/editor/tiny/plugins/collaborative/amd/build/jsdiff/patch/reverse.min.js.map index e3b94a46754a6..5cc8f4205420d 100644 --- a/lib/editor/tiny/plugins/collaborative/amd/build/jsdiff/patch/reverse.min.js.map +++ b/lib/editor/tiny/plugins/collaborative/amd/build/jsdiff/patch/reverse.min.js.map @@ -1 +1 @@ -{"version":3,"file":"reverse.min.js","sources":["../../../src/jsdiff/patch/reverse.js"],"sourcesContent":["export function reversePatch(structuredPatch) {\n if (Array.isArray(structuredPatch)) {\n return structuredPatch.map(reversePatch).reverse();\n }\n\n return {\n ...structuredPatch,\n oldFileName: structuredPatch.newFileName,\n oldHeader: structuredPatch.newHeader,\n newFileName: structuredPatch.oldFileName,\n newHeader: structuredPatch.oldHeader,\n hunks: structuredPatch.hunks.map(hunk => {\n return {\n oldLines: hunk.newLines,\n oldStart: hunk.newStart,\n newLines: hunk.oldLines,\n newStart: hunk.oldStart,\n lines: hunk.lines.map(l => {\n if (l.startsWith('-')) { return `+${l.slice(1)}`; }\n if (l.startsWith('+')) { return `-${l.slice(1)}`; }\n return l;\n })\n };\n })\n };\n}\n"],"names":["reversePatch","structuredPatch","Array","isArray","map","reverse","oldFileName","newFileName","oldHeader","newHeader","hunks","hunk","oldLines","newLines","oldStart","newStart","lines","l","startsWith","slice"],"mappings":"wKAAgBA,aAAaC,oBACvBC,MAAMC,QAAQF,wBACTA,gBAAgBG,IAAIJ,cAAcK,gBAGpC,IACFJ,gBACHK,YAAaL,gBAAgBM,YAC7BC,UAAWP,gBAAgBQ,UAC3BF,YAAaN,gBAAgBK,YAC7BG,UAAWR,gBAAgBO,UAC3BE,MAAOT,gBAAgBS,MAAMN,KAAIO,OACxB,CACLC,SAAUD,KAAKE,SACfC,SAAUH,KAAKI,SACfF,SAAUF,KAAKC,SACfG,SAAUJ,KAAKG,SACfE,MAAOL,KAAKK,MAAMZ,KAAIa,GAChBA,EAAEC,WAAW,gBAAmBD,EAAEE,MAAM,IACxCF,EAAEC,WAAW,gBAAmBD,EAAEE,MAAM,IACrCF"} \ No newline at end of file +{"version":3,"file":"reverse.min.js","sources":["../../../src/jsdiff/patch/reverse.js"],"sourcesContent":["export function reversePatch(structuredPatch) {\n if (Array.isArray(structuredPatch)) {\n return structuredPatch.map(reversePatch).reverse();\n }\n\n return {\n ...structuredPatch,\n oldFileName: structuredPatch.newFileName,\n oldHeader: structuredPatch.newHeader,\n newFileName: structuredPatch.oldFileName,\n newHeader: structuredPatch.oldHeader,\n hunks: structuredPatch.hunks.map(hunk => {\n return {\n oldLines: hunk.newLines,\n oldStart: hunk.newStart,\n newLines: hunk.oldLines,\n newStart: hunk.oldStart,\n lines: hunk.lines.map(l => {\n if (l.startsWith('-')) { return `+${l.slice(1)}`; }\n if (l.startsWith('+')) { return `-${l.slice(1)}`; }\n return l;\n })\n };\n })\n };\n}\n"],"names":["reversePatch","structuredPatch","Array","isArray","map","reverse","oldFileName","newFileName","oldHeader","newHeader","hunks","hunk","oldLines","newLines","oldStart","newStart","lines","l","startsWith","slice"],"mappings":"+JAAO,SAASA,aAAaC,iBAC3B,GAAIC,MAAMC,QAAQF,iBAChB,OAAOA,gBAAgBG,IAAIJ,cAAcK,UAG3C,MAAO,IACFJ,gBACHK,YAAaL,gBAAgBM,YAC7BC,UAAWP,gBAAgBQ,UAC3BF,YAAaN,gBAAgBK,YAC7BG,UAAWR,gBAAgBO,UAC3BE,MAAOT,gBAAgBS,MAAMN,KAAIO,OACxB,CACLC,SAAUD,KAAKE,SACfC,SAAUH,KAAKI,SACfF,SAAUF,KAAKC,SACfG,SAAUJ,KAAKG,SACfE,MAAOL,KAAKK,MAAMZ,KAAIa,GAChBA,EAAEC,WAAW,KAAe,IAAID,EAAEE,MAAM,KACxCF,EAAEC,WAAW,KAAe,IAAID,EAAEE,MAAM,KACrCF,QAKjB,CAAC"} \ No newline at end of file diff --git a/lib/editor/tiny/plugins/collaborative/amd/build/jsdiff/util/array.min.js.map b/lib/editor/tiny/plugins/collaborative/amd/build/jsdiff/util/array.min.js.map index a95fc776236ca..a998051cd7a6b 100644 --- a/lib/editor/tiny/plugins/collaborative/amd/build/jsdiff/util/array.min.js.map +++ b/lib/editor/tiny/plugins/collaborative/amd/build/jsdiff/util/array.min.js.map @@ -1 +1 @@ -{"version":3,"file":"array.min.js","sources":["../../../src/jsdiff/util/array.js"],"sourcesContent":["export function arrayEqual(a, b) {\n if (a.length !== b.length) {\n return false;\n }\n\n return arrayStartsWith(a, b);\n}\n\nexport function arrayStartsWith(array, start) {\n if (start.length > array.length) {\n return false;\n }\n\n for (let i = 0; i < start.length; i++) {\n if (start[i] !== array[i]) {\n return false;\n }\n }\n\n return true;\n}\n"],"names":["arrayStartsWith","array","start","length","i","a","b"],"mappings":"uFAQgBA,gBAAgBC,MAAOC,UACjCA,MAAMC,OAASF,MAAME,cAChB,MAGJ,IAAIC,EAAI,EAAGA,EAAIF,MAAMC,OAAQC,OAC5BF,MAAME,KAAOH,MAAMG,UACd,SAIJ,uFAnBkBC,EAAGC,MACxBD,EAAEF,SAAWG,EAAEH,cACV,SAGFH,gBAAgBK,EAAGC"} \ No newline at end of file +{"version":3,"file":"array.min.js","sources":["../../../src/jsdiff/util/array.js"],"sourcesContent":["export function arrayEqual(a, b) {\n if (a.length !== b.length) {\n return false;\n }\n\n return arrayStartsWith(a, b);\n}\n\nexport function arrayStartsWith(array, start) {\n if (start.length > array.length) {\n return false;\n }\n\n for (let i = 0; i < start.length; i++) {\n if (start[i] !== array[i]) {\n return false;\n }\n }\n\n return true;\n}\n"],"names":["arrayStartsWith","array","start","length","i","a","b"],"mappings":"8EAQO,SAASA,gBAAgBC,MAAOC,OACrC,GAAIA,MAAMC,OAASF,MAAME,OACvB,OAAO,EAGT,IAAK,IAAIC,EAAI,EAAGA,EAAIF,MAAMC,OAAQC,IAChC,GAAIF,MAAME,KAAOH,MAAMG,GACrB,OAAO,EAIX,OAAO,CACT,6EApBO,SAAoBC,EAAGC,GAC5B,GAAID,EAAEF,SAAWG,EAAEH,OACjB,OAAO,EAGT,OAAOH,gBAAgBK,EAAGC,EAC5B,0CAcC"} \ No newline at end of file diff --git a/lib/editor/tiny/plugins/collaborative/amd/build/jsdiff/util/distance-iterator.min.js.map b/lib/editor/tiny/plugins/collaborative/amd/build/jsdiff/util/distance-iterator.min.js.map index 99ee67a30f4b4..71784986e34fa 100644 --- a/lib/editor/tiny/plugins/collaborative/amd/build/jsdiff/util/distance-iterator.min.js.map +++ b/lib/editor/tiny/plugins/collaborative/amd/build/jsdiff/util/distance-iterator.min.js.map @@ -1 +1 @@ -{"version":3,"file":"distance-iterator.min.js","sources":["../../../src/jsdiff/util/distance-iterator.js"],"sourcesContent":["// Iterator that traverses in the range of [min, max], stepping\n// by distance from a given start position. I.e. for [0, 4], with\n// start of 2, this will iterate 2, 3, 1, 4, 0.\nexport default function(start, minLine, maxLine) {\n let wantForward = true,\n backwardExhausted = false,\n forwardExhausted = false,\n localOffset = 1;\n\n return function iterator() {\n if (wantForward && !forwardExhausted) {\n if (backwardExhausted) {\n localOffset++;\n } else {\n wantForward = false;\n }\n\n // Check if trying to fit beyond text length, and if not, check it fits\n // after offset location (or desired location on first iteration)\n if (start + localOffset <= maxLine) {\n return start + localOffset;\n }\n\n forwardExhausted = true;\n }\n\n if (!backwardExhausted) {\n if (!forwardExhausted) {\n wantForward = true;\n }\n\n // Check if trying to fit before text beginning, and if not, check it fits\n // before offset location\n if (minLine <= start - localOffset) {\n return start - localOffset++;\n }\n\n backwardExhausted = true;\n return iterator();\n }\n\n // We tried to fit hunk before text beginning and beyond text length, then\n // hunk can't fit on the text. Return undefined\n };\n}\n"],"names":["start","minLine","maxLine","wantForward","backwardExhausted","forwardExhausted","localOffset","iterator"],"mappings":"mLAGwBA,MAAOC,QAASC,aAClCC,aAAc,EACdC,mBAAoB,EACpBC,kBAAmB,EACnBC,YAAc,SAEX,SAASC,cACVJ,cAAgBE,iBAAkB,IAChCD,kBACFE,cAEAH,aAAc,EAKZH,MAAQM,aAAeJ,eAClBF,MAAQM,YAGjBD,kBAAmB,MAGhBD,yBACEC,mBACHF,aAAc,GAKZF,SAAWD,MAAQM,YACdN,MAAQM,eAGjBF,mBAAoB,EACbG"} \ No newline at end of file +{"version":3,"file":"distance-iterator.min.js","sources":["../../../src/jsdiff/util/distance-iterator.js"],"sourcesContent":["// Iterator that traverses in the range of [min, max], stepping\n// by distance from a given start position. I.e. for [0, 4], with\n// start of 2, this will iterate 2, 3, 1, 4, 0.\nexport default function(start, minLine, maxLine) {\n let wantForward = true,\n backwardExhausted = false,\n forwardExhausted = false,\n localOffset = 1;\n\n return function iterator() {\n if (wantForward && !forwardExhausted) {\n if (backwardExhausted) {\n localOffset++;\n } else {\n wantForward = false;\n }\n\n // Check if trying to fit beyond text length, and if not, check it fits\n // after offset location (or desired location on first iteration)\n if (start + localOffset <= maxLine) {\n return start + localOffset;\n }\n\n forwardExhausted = true;\n }\n\n if (!backwardExhausted) {\n if (!forwardExhausted) {\n wantForward = true;\n }\n\n // Check if trying to fit before text beginning, and if not, check it fits\n // before offset location\n if (minLine <= start - localOffset) {\n return start - localOffset++;\n }\n\n backwardExhausted = true;\n return iterator();\n }\n\n // We tried to fit hunk before text beginning and beyond text length, then\n // hunk can't fit on the text. Return undefined\n };\n}\n"],"names":["start","minLine","maxLine","wantForward","backwardExhausted","forwardExhausted","localOffset","iterator","_exports","default"],"mappings":"0FA4CC,gFAzCc,SAASA,MAAOC,QAASC,SACtC,IAAIC,aAAc,EACdC,mBAAoB,EACpBC,kBAAmB,EACnBC,YAAc,EAElB,OAAO,SAASC,WACd,GAAIJ,cAAgBE,iBAAkB,CASpC,GARID,kBACFE,cAEAH,aAAc,EAKZH,MAAQM,aAAeJ,QACzB,OAAOF,MAAQM,YAGjBD,kBAAmB,CACrB,CAEA,IAAKD,kBAOH,OANKC,mBACHF,aAAc,GAKZF,SAAWD,MAAQM,YACdN,MAAQM,eAGjBF,mBAAoB,EACbG,YAMb,EAACC,SAAAC,OAAA"} \ No newline at end of file diff --git a/lib/editor/tiny/plugins/collaborative/amd/build/jsdiff/util/params.min.js.map b/lib/editor/tiny/plugins/collaborative/amd/build/jsdiff/util/params.min.js.map index 1e0614a88ccba..4a67de2c9e78b 100644 --- a/lib/editor/tiny/plugins/collaborative/amd/build/jsdiff/util/params.min.js.map +++ b/lib/editor/tiny/plugins/collaborative/amd/build/jsdiff/util/params.min.js.map @@ -1 +1 @@ -{"version":3,"file":"params.min.js","sources":["../../../src/jsdiff/util/params.js"],"sourcesContent":["export function generateOptions(options, defaults) {\n if (typeof options === 'function') {\n defaults.callback = options;\n } else if (options) {\n for (let name in options) {\n /* istanbul ignore else */\n if (options.hasOwnProperty(name)) {\n defaults[name] = options[name];\n }\n }\n }\n return defaults;\n}\n"],"names":["options","defaults","callback","name","hasOwnProperty"],"mappings":"yKAAgCA,QAASC,aAChB,mBAAZD,QACTC,SAASC,SAAWF,aACf,GAAIA,YACJ,IAAIG,QAAQH,QAEXA,QAAQI,eAAeD,QACzBF,SAASE,MAAQH,QAAQG,cAIxBF"} \ No newline at end of file +{"version":3,"file":"params.min.js","sources":["../../../src/jsdiff/util/params.js"],"sourcesContent":["export function generateOptions(options, defaults) {\n if (typeof options === 'function') {\n defaults.callback = options;\n } else if (options) {\n for (let name in options) {\n /* istanbul ignore else */\n if (options.hasOwnProperty(name)) {\n defaults[name] = options[name];\n }\n }\n }\n return defaults;\n}\n"],"names":["options","defaults","callback","name","hasOwnProperty"],"mappings":"gKAAO,SAAyBA,QAASC,UACvC,GAAuB,mBAAZD,QACTC,SAASC,SAAWF,aACf,GAAIA,QACT,IAAK,IAAIG,QAAQH,QAEXA,QAAQI,eAAeD,QACzBF,SAASE,MAAQH,QAAQG,OAI/B,OAAOF,QACT,CAAC"} \ No newline at end of file diff --git a/lib/editor/tiny/plugins/collaborative/amd/build/jsdiff/util/string.min.js b/lib/editor/tiny/plugins/collaborative/amd/build/jsdiff/util/string.min.js index 98b050198f105..4115f55968b1f 100644 --- a/lib/editor/tiny/plugins/collaborative/amd/build/jsdiff/util/string.min.js +++ b/lib/editor/tiny/plugins/collaborative/amd/build/jsdiff/util/string.min.js @@ -1,3 +1,3 @@ -define("tiny_collaborative/jsdiff/util/string",["exports"],(function(_exports){function replacePrefix(string,oldPrefix,newPrefix){if(string.slice(0,oldPrefix.length)!=oldPrefix)throw Error("string ".concat(JSON.stringify(string)," doesn't start with prefix ").concat(JSON.stringify(oldPrefix),"; this is a bug"));return newPrefix+string.slice(oldPrefix.length)}function replaceSuffix(string,oldSuffix,newSuffix){if(!oldSuffix)return string+newSuffix;if(string.slice(-oldSuffix.length)!=oldSuffix)throw Error("string ".concat(JSON.stringify(string)," doesn't end with suffix ").concat(JSON.stringify(oldSuffix),"; this is a bug"));return string.slice(0,-oldSuffix.length)+newSuffix}Object.defineProperty(_exports,"__esModule",{value:!0}),_exports.hasOnlyUnixLineEndings=function(string){return!string.includes("\r\n")&&string.includes("\n")},_exports.hasOnlyWinLineEndings=function(string){return string.includes("\r\n")&&!string.startsWith("\n")&&!string.match(/[^\r]\n/)},_exports.longestCommonPrefix=function(str1,str2){let i;for(i=0;ib.length&&(startA=a.length-b.length);let endB=b.length;a.length0&&b[j]!=b[k];)k=map[k];b[j]==b[k]&&k++}k=0;for(let i=startA;i0&&a[i]!=b[k];)k=map[k];a[i]==b[k]&&k++}return k}(string1,string2))},_exports.removePrefix=function(string,oldPrefix){return replacePrefix(string,oldPrefix,"")},_exports.removeSuffix=function(string,oldSuffix){return replaceSuffix(string,oldSuffix,"")},_exports.replacePrefix=replacePrefix,_exports.replaceSuffix=replaceSuffix})); +define("tiny_collaborative/jsdiff/util/string",["exports"],(function(_exports){function replacePrefix(string,oldPrefix,newPrefix){if(string.slice(0,oldPrefix.length)!=oldPrefix)throw Error(`string ${JSON.stringify(string)} doesn't start with prefix ${JSON.stringify(oldPrefix)}; this is a bug`);return newPrefix+string.slice(oldPrefix.length)}function replaceSuffix(string,oldSuffix,newSuffix){if(!oldSuffix)return string+newSuffix;if(string.slice(-oldSuffix.length)!=oldSuffix)throw Error(`string ${JSON.stringify(string)} doesn't end with suffix ${JSON.stringify(oldSuffix)}; this is a bug`);return string.slice(0,-oldSuffix.length)+newSuffix}Object.defineProperty(_exports,"__esModule",{value:!0}),_exports.hasOnlyUnixLineEndings=function(string){return!string.includes("\r\n")&&string.includes("\n")},_exports.hasOnlyWinLineEndings=function(string){return string.includes("\r\n")&&!string.startsWith("\n")&&!string.match(/[^\r]\n/)},_exports.longestCommonPrefix=function(str1,str2){let i;for(i=0;ib.length&&(startA=a.length-b.length);let endB=b.length;a.length0&&b[j]!=b[k];)k=map[k];b[j]==b[k]&&k++}k=0;for(let i=startA;i0&&a[i]!=b[k];)k=map[k];a[i]==b[k]&&k++}return k}(string1,string2))},_exports.removePrefix=function(string,oldPrefix){return replacePrefix(string,oldPrefix,"")},_exports.removeSuffix=function(string,oldSuffix){return replaceSuffix(string,oldSuffix,"")},_exports.replacePrefix=replacePrefix,_exports.replaceSuffix=replaceSuffix})); //# sourceMappingURL=string.min.js.map \ No newline at end of file diff --git a/lib/editor/tiny/plugins/collaborative/amd/build/jsdiff/util/string.min.js.map b/lib/editor/tiny/plugins/collaborative/amd/build/jsdiff/util/string.min.js.map index 2b5521142b46b..9e275c0b035ff 100644 --- a/lib/editor/tiny/plugins/collaborative/amd/build/jsdiff/util/string.min.js.map +++ b/lib/editor/tiny/plugins/collaborative/amd/build/jsdiff/util/string.min.js.map @@ -1 +1 @@ -{"version":3,"file":"string.min.js","sources":["../../../src/jsdiff/util/string.js"],"sourcesContent":["export function longestCommonPrefix(str1, str2) {\n let i;\n for (i = 0; i < str1.length && i < str2.length; i++) {\n if (str1[i] != str2[i]) {\n return str1.slice(0, i);\n }\n }\n return str1.slice(0, i);\n}\n\nexport function longestCommonSuffix(str1, str2) {\n let i;\n\n // Unlike longestCommonPrefix, we need a special case to handle all scenarios\n // where we return the empty string since str1.slice(-0) will return the\n // entire string.\n if (!str1 || !str2 || str1[str1.length - 1] != str2[str2.length - 1]) {\n return '';\n }\n\n for (i = 0; i < str1.length && i < str2.length; i++) {\n if (str1[str1.length - (i + 1)] != str2[str2.length - (i + 1)]) {\n return str1.slice(-i);\n }\n }\n return str1.slice(-i);\n}\n\nexport function replacePrefix(string, oldPrefix, newPrefix) {\n if (string.slice(0, oldPrefix.length) != oldPrefix) {\n throw Error(`string ${JSON.stringify(string)} doesn't start with prefix ${JSON.stringify(oldPrefix)}; this is a bug`);\n }\n return newPrefix + string.slice(oldPrefix.length);\n}\n\nexport function replaceSuffix(string, oldSuffix, newSuffix) {\n if (!oldSuffix) {\n return string + newSuffix;\n }\n\n if (string.slice(-oldSuffix.length) != oldSuffix) {\n throw Error(`string ${JSON.stringify(string)} doesn't end with suffix ${JSON.stringify(oldSuffix)}; this is a bug`);\n }\n return string.slice(0, -oldSuffix.length) + newSuffix;\n}\n\nexport function removePrefix(string, oldPrefix) {\n return replacePrefix(string, oldPrefix, '');\n}\n\nexport function removeSuffix(string, oldSuffix) {\n return replaceSuffix(string, oldSuffix, '');\n}\n\nexport function maximumOverlap(string1, string2) {\n return string2.slice(0, overlapCount(string1, string2));\n}\n\n// Nicked from https://stackoverflow.com/a/60422853/1709587\nfunction overlapCount(a, b) {\n // Deal with cases where the strings differ in length\n let startA = 0;\n if (a.length > b.length) { startA = a.length - b.length; }\n let endB = b.length;\n if (a.length < b.length) { endB = a.length; }\n // Create a back-reference for each index\n // that should be followed in case of a mismatch.\n // We only need B to make these references:\n let map = Array(endB);\n let k = 0; // Index that lags behind j\n map[0] = 0;\n for (let j = 1; j < endB; j++) {\n if (b[j] == b[k]) {\n map[j] = map[k]; // skip over the same character (optional optimisation)\n } else {\n map[j] = k;\n }\n while (k > 0 && b[j] != b[k]) { k = map[k]; }\n if (b[j] == b[k]) { k++; }\n }\n // Phase 2: use these references while iterating over A\n k = 0;\n for (let i = startA; i < a.length; i++) {\n while (k > 0 && a[i] != b[k]) { k = map[k]; }\n if (a[i] == b[k]) { k++; }\n }\n return k;\n}\n\n\n/**\n * Returns true if the string consistently uses Windows line endings.\n */\nexport function hasOnlyWinLineEndings(string) {\n return string.includes('\\r\\n') && !string.startsWith('\\n') && !string.match(/[^\\r]\\n/);\n}\n\n/**\n * Returns true if the string consistently uses Unix line endings.\n */\nexport function hasOnlyUnixLineEndings(string) {\n return !string.includes('\\r\\n') && string.includes('\\n');\n}\n"],"names":["replacePrefix","string","oldPrefix","newPrefix","slice","length","Error","JSON","stringify","replaceSuffix","oldSuffix","newSuffix","includes","startsWith","match","str1","str2","i","string1","string2","a","b","startA","endB","map","Array","k","j","overlapCount"],"mappings":"wFA4BgBA,cAAcC,OAAQC,UAAWC,cAC3CF,OAAOG,MAAM,EAAGF,UAAUG,SAAWH,gBACjCI,uBAAgBC,KAAKC,UAAUP,8CAAqCM,KAAKC,UAAUN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K,IAAMA,EAAIF,IAAIE,GACpCL,EAAEM,IAAMN,EAAEK,IAAMA,IAGxBA,EAAI,MACC,IAAIT,EAAIK,OAAQL,EAAIG,EAAEf,OAAQY,IAAK,MAC7BS,EAAI,GAAKN,EAAEH,IAAMI,EAAEK,IAAMA,EAAIF,IAAIE,GACpCN,EAAEH,IAAMI,EAAEK,IAAMA,WAEjBA,EA/BiBE,CAAaV,QAASC,0CATnBlB,OAAQC,kBAC5BF,cAAcC,OAAQC,UAAW,oCAGbD,OAAQS,kBAC5BD,cAAcR,OAAQS,UAAW"} \ No newline at end of file +{"version":3,"file":"string.min.js","sources":["../../../src/jsdiff/util/string.js"],"sourcesContent":["export function longestCommonPrefix(str1, str2) {\n let i;\n for (i = 0; i < str1.length && i < str2.length; i++) {\n if (str1[i] != str2[i]) {\n return str1.slice(0, i);\n }\n }\n return str1.slice(0, i);\n}\n\nexport function longestCommonSuffix(str1, str2) {\n let i;\n\n // Unlike longestCommonPrefix, we need a special case to handle all scenarios\n // where we return the empty string since str1.slice(-0) will return the\n // entire string.\n if (!str1 || !str2 || str1[str1.length - 1] != str2[str2.length - 1]) {\n return '';\n }\n\n for (i = 0; i < str1.length && i < str2.length; i++) {\n if (str1[str1.length - (i + 1)] != str2[str2.length - (i + 1)]) {\n return str1.slice(-i);\n }\n }\n return str1.slice(-i);\n}\n\nexport function replacePrefix(string, oldPrefix, newPrefix) {\n if (string.slice(0, oldPrefix.length) != oldPrefix) {\n throw Error(`string ${JSON.stringify(string)} doesn't start with prefix ${JSON.stringify(oldPrefix)}; this is a bug`);\n }\n return newPrefix + string.slice(oldPrefix.length);\n}\n\nexport function replaceSuffix(string, oldSuffix, newSuffix) {\n if (!oldSuffix) {\n return string + newSuffix;\n }\n\n if (string.slice(-oldSuffix.length) != oldSuffix) {\n throw Error(`string ${JSON.stringify(string)} doesn't end with suffix ${JSON.stringify(oldSuffix)}; this is a bug`);\n }\n return string.slice(0, -oldSuffix.length) + newSuffix;\n}\n\nexport function removePrefix(string, oldPrefix) {\n return replacePrefix(string, oldPrefix, '');\n}\n\nexport function removeSuffix(string, oldSuffix) {\n return replaceSuffix(string, oldSuffix, '');\n}\n\nexport function maximumOverlap(string1, string2) {\n return string2.slice(0, overlapCount(string1, string2));\n}\n\n// Nicked from https://stackoverflow.com/a/60422853/1709587\nfunction overlapCount(a, b) {\n // Deal with cases where the strings differ in length\n let startA = 0;\n if (a.length > b.length) { startA = a.length - b.length; }\n let endB = b.length;\n if (a.length < b.length) { endB = a.length; }\n // Create a back-reference for each index\n // that should be followed in case of a mismatch.\n // We only need B to make these references:\n let map = Array(endB);\n let k = 0; // Index that lags behind j\n map[0] = 0;\n for (let j = 1; j < endB; j++) {\n if (b[j] == b[k]) {\n map[j] = map[k]; // skip over the same character (optional optimisation)\n } else {\n map[j] = k;\n }\n while (k > 0 && b[j] != b[k]) { k = map[k]; }\n if (b[j] == b[k]) { k++; }\n }\n // Phase 2: use these references while iterating over A\n k = 0;\n for (let i = startA; i < a.length; i++) {\n while (k > 0 && a[i] != b[k]) { k = map[k]; }\n if (a[i] == b[k]) { k++; }\n }\n return k;\n}\n\n\n/**\n * Returns true if the string consistently uses Windows line endings.\n */\nexport function hasOnlyWinLineEndings(string) {\n return string.includes('\\r\\n') && !string.startsWith('\\n') && !string.match(/[^\\r]\\n/);\n}\n\n/**\n * Returns true if the string consistently uses Unix line endings.\n */\nexport function hasOnlyUnixLineEndings(string) {\n return !string.includes('\\r\\n') && string.includes('\\n');\n}\n"],"names":["replacePrefix","string","oldPrefix","newPrefix","slice","length","Error","JSON","stringify","replaceSuffix","oldSuffix","newSuffix","includes","startsWith","match","str1","str2","i","string1","string2","a","b","startA","endB","map","Array","k","j","overlapCount"],"mappings":"+EA4BO,SAASA,cAAcC,OAAQC,UAAWC,WAC/C,GAAIF,OAAOG,MAAM,EAAGF,UAAUG,SAAWH,UACvC,MAAMI,MAAM,UAAUC,KAAKC,UAAUP,qCAAqCM,KAAKC,UAAUN,6BAE3F,OAAOC,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B,IAAMC,MAAMF,MACZG,EAAI,EACRF,IAAI,GAAK,EACT,IAAK,IAAIG,EAAI,EAAGA,EAAIJ,KAAMI,IAAK,CAM3B,IALIN,EAAEM,IAAMN,EAAEK,GACVF,IAAIG,GAAKH,IAAIE,GAEbF,IAAIG,GAAKD,EAENA,EAAI,GAAKL,EAAEM,IAAMN,EAAEK,IAAMA,EAAIF,IAAIE,GACpCL,EAAEM,IAAMN,EAAEK,IAAMA,GACxB,CAEAA,EAAI,EACJ,IAAK,IAAIT,EAAIK,OAAQL,EAAIG,EAAEf,OAAQY,IAAK,CACpC,KAAOS,EAAI,GAAKN,EAAEH,IAAMI,EAAEK,IAAMA,EAAIF,IAAIE,GACpCN,EAAEH,IAAMI,EAAEK,IAAMA,GACxB,CACA,OAAOA,CACT,CAhC0BE,CAAaV,QAASC,SAChD,wBAVO,SAAsBlB,OAAQC,WACnC,OAAOF,cAAcC,OAAQC,UAAW,GAC1C,wBAEO,SAAsBD,OAAQS,WACnC,OAAOD,cAAcR,OAAQS,UAAW,GAC1C,2EAkDC"} \ No newline at end of file diff --git a/lib/editor/tiny/plugins/collaborative/amd/build/options.min.js.map b/lib/editor/tiny/plugins/collaborative/amd/build/options.min.js.map index 0aac908e406b5..0cf1329073af3 100644 --- a/lib/editor/tiny/plugins/collaborative/amd/build/options.min.js.map +++ b/lib/editor/tiny/plugins/collaborative/amd/build/options.min.js.map @@ -1 +1 @@ -{"version":3,"file":"options.min.js","sources":["../src/options.js"],"sourcesContent":["// This file is part of Moodle - http://moodle.org/\n//\n// Moodle is free software: you can redistribute it and/or modify\n// it under the terms of the GNU General Public License as published by\n// the Free Software Foundation, either version 3 of the License, or\n// (at your option) any later version.\n//\n// Moodle is distributed in the hope that it will be useful,\n// but WITHOUT ANY WARRANTY; without even the implied warranty of\n// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the\n// GNU General Public License for more details.\n//\n// You should have received a copy of the GNU General Public License\n// along with Moodle. If not, see .\n\n/**\n * Options helper for the Moodle Tiny Autosave plugin.\n *\n * @module tiny_autosave/options\n * @copyright 2022 Andrew Lyons \n * @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later\n */\n\nimport {pluginName} from './common';\nimport {\n getContextId,\n getDraftItemId,\n getPluginOptionName,\n} from 'editor_tiny/options';\nimport {ensureEditorIsValid} from 'editor_tiny/utils';\n\nconst initialisedOptionName = getPluginOptionName(pluginName, 'initialised');\nconst pageHashName = getPluginOptionName(pluginName, 'pagehash');\nconst pageInstanceName = getPluginOptionName(pluginName, 'pageinstance');\nconst backoffTime = getPluginOptionName(pluginName, 'backoffTime');\nconst autosaveHasReset = getPluginOptionName(pluginName, 'autosaveHasReset');\n\nexport const register = (editor) => {\n const registerOption = editor.options.register;\n registerOption(initialisedOptionName, {\n processor: 'boolean',\n \"default\": false,\n });\n\n registerOption(pageHashName, {\n processor: 'string',\n \"default\": '',\n });\n\n registerOption(pageInstanceName, {\n processor: 'string',\n \"default\": '',\n });\n /*registerOption(pageInstanceName, {\n processor: 'string',\n \"default\": '',\n });*/\n registerOption(backoffTime, {\n processor: 'number',\n \"default\": 500,\n });\n registerOption(autosaveHasReset, {\n processor: 'boolean',\n \"default\": false,\n });\n};\n\nexport const isInitialised = (editor) => {\n if (!ensureEditorIsValid(editor)) {\n return false;\n }\n\n return editor.options.get(initialisedOptionName);\n};\nexport const markInitialised = (editor) => editor.options.set(initialisedOptionName, true);\nexport const getPageHash = (editor) => editor.options.get(pageHashName);\nexport const getPageInstance = (editor) => editor.options.get(pageInstanceName);\nexport const getBackoffTime = (editor) => editor.options.get(backoffTime);\nexport const setAutosaveHasReset = (editor) => editor.options.set(autosaveHasReset, true);\nexport const hasAutosaveHasReset = (editor) => editor.options.get(autosaveHasReset);\n\nexport {\n getContextId,\n getDraftItemId,\n};\n"],"names":["initialisedOptionName","pluginName","pageHashName","pageInstanceName","backoffTime","autosaveHasReset","editor","registerOption","options","register","processor","get","set"],"mappings":";;;;;;;;MA+BMA,uBAAwB,gCAAoBC,mBAAY,eACxDC,cAAe,gCAAoBD,mBAAY,YAC/CE,kBAAmB,gCAAoBF,mBAAY,gBACnDG,aAAc,gCAAoBH,mBAAY,eAC9CI,kBAAmB,gCAAoBJ,mBAAY,sCAEhCK,eACfC,eAAiBD,OAAOE,QAAQC,SACtCF,eAAeP,sBAAuB,CAClCU,UAAW,mBACA,IAGfH,eAAeL,aAAc,CACzBQ,UAAW,iBACA,KAGfH,eAAeJ,iBAAkB,CAC7BO,UAAW,iBACA,KAMfH,eAAeH,YAAa,CACxBM,UAAW,iBACA,MAEfH,eAAeF,iBAAkB,CAC7BK,UAAW,mBACA,4BAIWJ,WACrB,8BAAoBA,SAIlBA,OAAOE,QAAQG,IAAIX,gDAEEM,QAAWA,OAAOE,QAAQI,IAAIZ,uBAAuB,wBACzDM,QAAWA,OAAOE,QAAQG,IAAIT,uCAC1BI,QAAWA,OAAOE,QAAQG,IAAIR,0CAC/BG,QAAWA,OAAOE,QAAQG,IAAIP,0CACzBE,QAAWA,OAAOE,QAAQI,IAAIP,kBAAkB,gCAChDC,QAAWA,OAAOE,QAAQG,IAAIN"} \ No newline at end of file +{"version":3,"file":"options.min.js","sources":["../src/options.js"],"sourcesContent":["// This file is part of Moodle - http://moodle.org/\n//\n// Moodle is free software: you can redistribute it and/or modify\n// it under the terms of the GNU General Public License as published by\n// the Free Software Foundation, either version 3 of the License, or\n// (at your option) any later version.\n//\n// Moodle is distributed in the hope that it will be useful,\n// but WITHOUT ANY WARRANTY; without even the implied warranty of\n// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the\n// GNU General Public License for more details.\n//\n// You should have received a copy of the GNU General Public License\n// along with Moodle. If not, see .\n\n/**\n * Options helper for the Moodle Tiny Autosave plugin.\n *\n * @module tiny_autosave/options\n * @copyright 2022 Andrew Lyons \n * @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later\n */\n\nimport {pluginName} from './common';\nimport {\n getContextId,\n getDraftItemId,\n getPluginOptionName,\n} from 'editor_tiny/options';\nimport {ensureEditorIsValid} from 'editor_tiny/utils';\n\nconst initialisedOptionName = getPluginOptionName(pluginName, 'initialised');\nconst pageHashName = getPluginOptionName(pluginName, 'pagehash');\nconst pageInstanceName = getPluginOptionName(pluginName, 'pageinstance');\nconst backoffTime = getPluginOptionName(pluginName, 'backoffTime');\nconst autosaveHasReset = getPluginOptionName(pluginName, 'autosaveHasReset');\n\nexport const register = (editor) => {\n const registerOption = editor.options.register;\n registerOption(initialisedOptionName, {\n processor: 'boolean',\n \"default\": false,\n });\n\n registerOption(pageHashName, {\n processor: 'string',\n \"default\": '',\n });\n\n registerOption(pageInstanceName, {\n processor: 'string',\n \"default\": '',\n });\n /*registerOption(pageInstanceName, {\n processor: 'string',\n \"default\": '',\n });*/\n registerOption(backoffTime, {\n processor: 'number',\n \"default\": 500,\n });\n registerOption(autosaveHasReset, {\n processor: 'boolean',\n \"default\": false,\n });\n};\n\nexport const isInitialised = (editor) => {\n if (!ensureEditorIsValid(editor)) {\n return false;\n }\n\n return editor.options.get(initialisedOptionName);\n};\nexport const markInitialised = (editor) => editor.options.set(initialisedOptionName, true);\nexport const getPageHash = (editor) => editor.options.get(pageHashName);\nexport const getPageInstance = (editor) => editor.options.get(pageInstanceName);\nexport const getBackoffTime = (editor) => editor.options.get(backoffTime);\nexport const setAutosaveHasReset = (editor) => editor.options.set(autosaveHasReset, true);\nexport const hasAutosaveHasReset = (editor) => editor.options.get(autosaveHasReset);\n\nexport {\n getContextId,\n getDraftItemId,\n};\n"],"names":["initialisedOptionName","getPluginOptionName","pluginName","pageHashName","pageInstanceName","backoffTime","autosaveHasReset","_exports","register","editor","registerOption","options","processor","default","isInitialised","ensureEditorIsValid","get","markInitialised","set","getPageHash","getPageInstance","getBackoffTime","setAutosaveHasReset","hasAutosaveHasReset"],"mappings":";;;;;;;;AA+BA,MAAMA,uBAAwB,EAAAC,SAAAA,qBAAoBC,QAAUA,WAAE,eACxDC,cAAe,EAAAF,SAAAA,qBAAoBC,QAAUA,WAAE,YAC/CE,kBAAmB,EAAAH,SAAAA,qBAAoBC,QAAUA,WAAE,gBACnDG,aAAc,EAAAJ,SAAAA,qBAAoBC,QAAUA,WAAE,eAC9CI,kBAAmB,EAAAL,SAAAA,qBAAoBC,QAAUA,WAAE,oBA8BvDK,SAAAC,SA5BuBC,SACrB,MAAMC,eAAiBD,OAAOE,QAAQH,SACtCE,eAAeV,sBAAuB,CAClCY,UAAW,UACXC,SAAW,IAGfH,eAAeP,aAAc,CACzBS,UAAW,SACXC,QAAW,KAGfH,eAAeN,iBAAkB,CAC7BQ,UAAW,SACXC,QAAW,KAMfH,eAAeL,YAAa,CACxBO,UAAW,SACXC,QAAW,MAEfH,eAAeJ,iBAAkB,CAC7BM,UAAW,UACXC,SAAW,GACb,EASJN,SAAAO,cAN4BL,WACrB,EAAAM,OAAAA,qBAAoBN,SAIlBA,OAAOE,QAAQK,IAAIhB,uBAE6DO,SAAAU,gBAA3DR,QAAWA,OAAOE,QAAQO,IAAIlB,uBAAuB,GACbO,SAAAY,YAA5CV,QAAWA,OAAOE,QAAQK,IAAIb,cACsBI,SAAAa,gBAAhDX,QAAWA,OAAOE,QAAQK,IAAIZ,kBACYG,SAAAc,eAA3CZ,QAAWA,OAAOE,QAAQK,IAAIX,aAC6BE,SAAAe,oBAAtDb,QAAWA,OAAOE,QAAQO,IAAIZ,kBAAkB,GACAC,SAAAgB,oBAAhDd,QAAWA,OAAOE,QAAQK,IAAIV,iBAAkB"} \ No newline at end of file diff --git a/lib/editor/tiny/plugins/collaborative/amd/build/plugin.min.js b/lib/editor/tiny/plugins/collaborative/amd/build/plugin.min.js index 0e432d6cec160..032e7aedb885a 100644 --- a/lib/editor/tiny/plugins/collaborative/amd/build/plugin.min.js +++ b/lib/editor/tiny/plugins/collaborative/amd/build/plugin.min.js @@ -1,3 +1,3 @@ -define("tiny_collaborative/plugin",["exports","editor_tiny/loader","editor_tiny/utils","./common","./options","./commands","./configuration","./collaborater"],(function(_exports,_loader,_utils,_common,_options,_commands,Configuration,Collaborator){function _getRequireWildcardCache(nodeInterop){if("function"!=typeof WeakMap)return null;var cacheBabelInterop=new WeakMap,cacheNodeInterop=new WeakMap;return(_getRequireWildcardCache=function(nodeInterop){return nodeInterop?cacheNodeInterop:cacheBabelInterop})(nodeInterop)}function _interopRequireWildcard(obj,nodeInterop){if(!nodeInterop&&obj&&obj.__esModule)return obj;if(null===obj||"object"!=typeof obj&&"function"!=typeof obj)return{default:obj};var cache=_getRequireWildcardCache(nodeInterop);if(cache&&cache.has(obj))return cache.get(obj);var newObj={},hasPropertyDescriptor=Object.defineProperty&&Object.getOwnPropertyDescriptor;for(var key in obj)if("default"!==key&&Object.prototype.hasOwnProperty.call(obj,key)){var desc=hasPropertyDescriptor?Object.getOwnPropertyDescriptor(obj,key):null;desc&&(desc.get||desc.set)?Object.defineProperty(newObj,key,desc):newObj[key]=obj[key]}return newObj.default=obj,cache&&cache.set(obj,newObj),newObj}Object.defineProperty(_exports,"__esModule",{value:!0}),_exports.default=void 0,Configuration=_interopRequireWildcard(Configuration),Collaborator=_interopRequireWildcard(Collaborator);var _default=new Promise((async resolve=>{const[tinyMCE,pluginMetadata,setupCommands]=await Promise.all([(0,_loader.getTinyMCE)(),(0,_utils.getPluginMetadata)(_common.component,_common.pluginName),(0,_commands.getSetup)()]);tinyMCE.PluginManager.add(_common.pluginName,(editor=>((0,_options.register)(editor),Collaborator.register(editor),setupCommands(editor),pluginMetadata))),resolve([_common.pluginName,Configuration])}));return _exports.default=_default,_exports.default})); +define("tiny_collaborative/plugin",["exports","editor_tiny/loader","editor_tiny/utils","./common","./options","./commands","./configuration","./collaborater"],(function(_exports,_loader,_utils,_common,_options,_commands,Configuration,Collaborator){function _getRequireWildcardCache(e){if("function"!=typeof WeakMap)return null;var r=new WeakMap,t=new WeakMap;return(_getRequireWildcardCache=function(e){return e?t:r})(e)}function _interopRequireWildcard(e,r){if(!r&&e&&e.__esModule)return e;if(null===e||"object"!=typeof e&&"function"!=typeof e)return{default:e};var t=_getRequireWildcardCache(r);if(t&&t.has(e))return t.get(e);var n={__proto__:null},a=Object.defineProperty&&Object.getOwnPropertyDescriptor;for(var u in e)if("default"!==u&&{}.hasOwnProperty.call(e,u)){var i=a?Object.getOwnPropertyDescriptor(e,u):null;i&&(i.get||i.set)?Object.defineProperty(n,u,i):n[u]=e[u]}return n.default=e,t&&t.set(e,n),n}Object.defineProperty(_exports,"__esModule",{value:!0}),_exports.default=void 0,Configuration=_interopRequireWildcard(Configuration),Collaborator=_interopRequireWildcard(Collaborator);_exports.default=new Promise((async resolve=>{const[tinyMCE,pluginMetadata,setupCommands]=await Promise.all([(0,_loader.getTinyMCE)(),(0,_utils.getPluginMetadata)(_common.component,_common.pluginName),(0,_commands.getSetup)()]);tinyMCE.PluginManager.add(_common.pluginName,(editor=>((0,_options.register)(editor),Collaborator.register(editor),setupCommands(editor),pluginMetadata))),resolve([_common.pluginName,Configuration])}));return _exports.default})); //# sourceMappingURL=plugin.min.js.map \ No newline at end of file diff --git a/lib/editor/tiny/plugins/collaborative/amd/build/plugin.min.js.map b/lib/editor/tiny/plugins/collaborative/amd/build/plugin.min.js.map index c4ea4b1977fc2..680a11a489075 100644 --- a/lib/editor/tiny/plugins/collaborative/amd/build/plugin.min.js.map +++ b/lib/editor/tiny/plugins/collaborative/amd/build/plugin.min.js.map @@ -1 +1 @@ -{"version":3,"file":"plugin.min.js","sources":["../src/plugin.js"],"sourcesContent":["import {getTinyMCE} from 'editor_tiny/loader';\nimport {getPluginMetadata} from 'editor_tiny/utils';\n\nimport {component, pluginName} from './common';\nimport {register as registerOptions} from './options';\nimport {getSetup as getCommandSetup} from './commands';\nimport * as Configuration from './configuration';\nimport * as Collaborator from './collaborater';\n\nexport default new Promise(async(resolve) => {\n // Note: The PluginManager.add function does not support asynchronous configuration.\n // Perform any asynchronous configuration here, and then call the PluginManager.add function.\n const [\n tinyMCE,\n pluginMetadata,\n setupCommands,\n ] = await Promise.all([\n getTinyMCE(),\n getPluginMetadata(component, pluginName),\n getCommandSetup(),\n ]);\n\n // Reminder: Any asynchronous code must be run before this point.\n tinyMCE.PluginManager.add(pluginName, (editor) => {\n // Register any options that your plugin has\n registerOptions(editor);\n Collaborator.register(editor);\n // Setup any commands such as buttons, menu items, and so on.\n setupCommands(editor);\n\n\n // Return the pluginMetadata object. This is used by TinyMCE to display a help link for your plugin.\n return pluginMetadata;\n });\n\n resolve([pluginName, Configuration]);\n});"],"names":["Promise","async","tinyMCE","pluginMetadata","setupCommands","all","component","pluginName","PluginManager","add","editor","Collaborator","register","resolve","Configuration"],"mappings":"o3CASe,IAAIA,SAAQC,MAAAA,gBAInBC,QACAC,eACAC,qBACMJ,QAAQK,IAAI,EAClB,yBACA,4BAAkBC,kBAAWC,qBAC7B,0BAIJL,QAAQM,cAAcC,IAAIF,oBAAaG,+BAEnBA,QAChBC,aAAaC,SAASF,QAEtBN,cAAcM,QAIPP,kBAGXU,QAAQ,CAACN,mBAAYO"} \ No newline at end of file +{"version":3,"file":"plugin.min.js","sources":["../src/plugin.js"],"sourcesContent":["import {getTinyMCE} from 'editor_tiny/loader';\nimport {getPluginMetadata} from 'editor_tiny/utils';\n\nimport {component, pluginName} from './common';\nimport {register as registerOptions} from './options';\nimport {getSetup as getCommandSetup} from './commands';\nimport * as Configuration from './configuration';\nimport * as Collaborator from './collaborater';\n\nexport default new Promise(async(resolve) => {\n // Note: The PluginManager.add function does not support asynchronous configuration.\n // Perform any asynchronous configuration here, and then call the PluginManager.add function.\n const [\n tinyMCE,\n pluginMetadata,\n setupCommands,\n ] = await Promise.all([\n getTinyMCE(),\n getPluginMetadata(component, pluginName),\n getCommandSetup(),\n ]);\n\n // Reminder: Any asynchronous code must be run before this point.\n tinyMCE.PluginManager.add(pluginName, (editor) => {\n // Register any options that your plugin has\n registerOptions(editor);\n Collaborator.register(editor);\n // Setup any commands such as buttons, menu items, and so on.\n setupCommands(editor);\n\n\n // Return the pluginMetadata object. This is used by TinyMCE to display a help link for your plugin.\n return pluginMetadata;\n });\n\n resolve([pluginName, Configuration]);\n});"],"names":["_getRequireWildcardCache","e","WeakMap","r","t","_interopRequireWildcard","__esModule","default","has","get","n","__proto__","a","Object","defineProperty","getOwnPropertyDescriptor","u","hasOwnProperty","call","i","set","Configuration","Collaborator","_exports","Promise","async","tinyMCE","pluginMetadata","setupCommands","all","getTinyMCE","getPluginMetadata","component","pluginName","getCommandSetup","PluginManager","add","editor","registerOptions","register","resolve"],"mappings":"wPAO+C,SAAAA,yBAAAC,GAAA,GAAA,mBAAAC,QAAA,OAAA,KAAA,IAAAC,EAAAD,IAAAA,QAAAE,EAAAF,IAAAA,eAAAF,yBAAA,SAAAC,GAAAA,OAAAA,EAAAG,EAAAD,IAAAF,EAAA,CAAA,SAAAI,wBAAAJ,EAAAE,GAAAA,IAAAA,GAAAF,GAAAA,EAAAK,WAAAL,OAAAA,EAAAA,GAAAA,OAAAA,GAAAA,iBAAAA,GAAAA,mBAAAA,EAAAM,MAAAA,CAAAA,QAAAN,GAAAG,IAAAA,EAAAJ,yBAAAG,GAAA,GAAAC,GAAAA,EAAAI,IAAAP,GAAA,OAAAG,EAAAK,IAAAR,GAAA,IAAAS,EAAA,CAAAC,UAAA,MAAAC,EAAAC,OAAAC,gBAAAD,OAAAE,yBAAA,IAAA,IAAAC,KAAAf,EAAAe,GAAAA,YAAAA,GAAAC,CAAAA,EAAAA,eAAAC,KAAAjB,EAAAe,GAAAG,CAAAA,IAAAA,EAAAP,EAAAC,OAAAE,yBAAAd,EAAAe,GAAAG,KAAAA,IAAAA,EAAAV,KAAAU,EAAAC,KAAAP,OAAAC,eAAAJ,EAAAM,EAAAG,GAAAT,EAAAM,GAAAf,EAAAe,GAAAN,OAAAA,EAAAH,QAAAN,EAAAG,GAAAA,EAAAgB,IAAAnB,EAAAS,GAAAA,CAAA,iFAD/CW,cAAAhB,wBAAAgB,eACAC,aAAAjB,wBAAAiB,cAA+CC,SAAAhB,QAEhC,IAAIiB,SAAQC,gBAGvB,MACIC,QACAC,eACAC,qBACMJ,QAAQK,IAAI,EAClB,EAAAC,QAAAA,eACA,EAAAC,OAAiBA,mBAACC,kBAAWC,QAAAA,aAC7B,EAAAC,UAAAA,cAIJR,QAAQS,cAAcC,IAAIH,QAAUA,YAAGI,UAEnC,EAAAC,SAAAA,UAAgBD,QAChBf,aAAaiB,SAASF,QAEtBT,cAAcS,QAIPV,kBAGXa,QAAQ,CAACP,QAAAA,WAAYZ,eAAe,IACtC,OAAAE,SAAAhB,OAAA"} \ No newline at end of file diff --git a/lib/editor/tiny/plugins/collaborative/classes/external/get_changes.php b/lib/editor/tiny/plugins/collaborative/classes/external/get_changes.php index ffa235f780646..19ca6e9440e1b 100644 --- a/lib/editor/tiny/plugins/collaborative/classes/external/get_changes.php +++ b/lib/editor/tiny/plugins/collaborative/classes/external/get_changes.php @@ -91,8 +91,8 @@ public static function execute( */ public static function execute_returns(): external_single_structure { return new external_single_structure( - ['changes' => new external_multiple_structure(PARAM_RAW, 'Description of the change'), - 'positions' => new external_multiple_structure(PARAM_RAW, 'Positions of the users')] + ['changes' => new external_multiple_structure(new external_value(PARAM_RAW, 'Description of the change')), + 'positions' => new external_multiple_structure(new external_value(PARAM_RAW, 'Positions of the users'))] ); } }