From b6569bd7ad8cd7e8769bf360ce732c150eea99fe Mon Sep 17 00:00:00 2001 From: Pete Boysen Date: Thu, 21 Apr 2016 15:09:36 -0500 Subject: [PATCH] upgraded commenting to pm 0.6 --- comments-built-min.js | 28 ++++++++++++++-------------- 1 file changed, 14 insertions(+), 14 deletions(-) diff --git a/comments-built-min.js b/comments-built-min.js index 8bc5312..cf0984d 100644 --- a/comments-built-min.js +++ b/comments-built-min.js @@ -1,14 +1,14 @@ -!function e(t,n,r){function s(o,u){if(!n[o]){if(!t[o]){var a="function"==typeof require&&require;if(!u&&a)return a(o,!0);if(i)return i(o,!0);var f=new Error("Cannot find module '"+o+"'");throw f.code="MODULE_NOT_FOUND",f}var l=n[o]={exports:{}};t[o][0].call(l.exports,function(e){var n=t[o][1][e];return s(n?n:e)},l,l.exports,e,t,n,r)}return n[o].exports}for(var i="function"==typeof require&&require,o=0;o2?_len-2:0),_key=2;_len>_key;_key++)args[_key-2]=arguments[_key];for(var i=0;i0;i--){if(!(0,_char.isExtendingChar)(node.text.charAt(i-1)))return offset-1;offset--}else if("word"==by)for(var i=offset-start;i>0;i--){var nextCharCat=(0,_char.charCategory)(node.text.charAt(i-1));if(null==cat||1==counted&&"space"==cat)cat=nextCharCat;else if(cat!=nextCharCat)return offset;offset--,counted++}}}function deleteBarrier(pm,cut){var around=pm.doc.path(cut.path),before=around.child(cut.offset-1),after=around.child(cut.offset);if(before.type.canContainContent(after.type)){var tr=pm.tr.join(cut);if(tr.steps.length&&0==before.size&&!before.sameMarkup(after)&&tr.setNodeType(cut.move(-1),after.type,after.attrs),tr.apply(pm.apply.scroll)!==!1)return}var conn=void 0;if(after.isTextblock&&(conn=before.type.findConnection(after.type))){var tr=pm.tr,end=cut.move(1);if(tr.step("ancestor",cut,end,null,{types:[before.type].concat(_toConsumableArray(conn)),attrs:[before.attrs].concat(_toConsumableArray(conn.map(function(){return null})))}),tr.join(end),tr.join(cut),tr.apply(pm.apply.scroll)!==!1)return}var selAfter=(0,_selection.findSelectionFrom)(pm.doc,cut,1);return pm.tr.lift(selAfter.from,selAfter.to).apply(pm.apply.scroll)}function moveForward(parent,offset,by){if("char"!=by&&"word"!=by)throw new _error.AssertionError("Unknown motion unit: "+by);for(var cat=null,counted=0;;){if(offset==parent.size)return offset;var _parent$chunkAfter=parent.chunkAfter(offset),start=_parent$chunkAfter.start,node=_parent$chunkAfter.node;if(!node.isText)return cat?offset:offset+1;if("char"==by)for(var i=offset-start;i0?to:from;return(0,_selection.findSelectionFrom)(pm.doc,node&&node.isBlock?side:side.shorten(null,dir>0?1:0),dir)}function selectNodeHorizontally(pm,dir){var _pm$selection16=pm.selection,empty=_pm$selection16.empty,node=_pm$selection16.node,from=_pm$selection16.from,to=_pm$selection16.to;if(!empty&&!node)return!1;if(node&&node.isInline)return pm.setTextSelection(dir>0?to:from),!0;var parent=void 0;if(!node&&(parent=pm.doc.path(from.path))&&(dir>0?from.offset0?parent.chunkAfter(from.offset):parent.chunkBefore(from.offset),nextNode=_ref.node,start=_ref.start;return nextNode.type.selectable&&start==from.offset-(dir>0?0:1)?(pm.setNodeSelection(0>dir?from.move(-1):from),!0):!1}var next=moveSelectionBlock(pm,dir);return next&&(next instanceof _selection.NodeSelection||node)?(pm.setSelectionDirect(next),!0):!1}function selectNodeVertically(pm,dir){var _pm$selection17=pm.selection,empty=_pm$selection17.empty,node=_pm$selection17.node,from=_pm$selection17.from,to=_pm$selection17.to;if(!empty&&!node)return!1;var leavingTextblock=!0;if((!node||node.isInline)&&(leavingTextblock=(0,_selection.verticalMotionLeavesTextblock)(pm,dir>0?to:from,dir)),leavingTextblock){var next=moveSelectionBlock(pm,dir);if(next&&next instanceof _selection.NodeSelection)return pm.setSelectionDirect(next),node||(pm.sel.lastNonNodePos=from),!0}if(!node)return!1;if(node.isInline)return(0,_dompos.setDOMSelectionToPos)(pm,from),!1;var last=pm.sel.lastNonNodePos,beyond=(0,_selection.findSelectionFrom)(pm.doc,0>dir?from:to,dir);return last&&beyond&&_model.Pos.samePath(last.path,beyond.from.path)?((0,_dompos.setDOMSelectionToPos)(pm,last),!1):(beyond&&pm.setSelectionDirect(beyond),!0)}Object.defineProperty(exports,"__esModule",{value:!0}),exports.baseCommands=void 0;var _model=require("../model"),_transform=require("../transform"),_error=require("../util/error"),_char=require("./char"),_selection=require("./selection"),_dompos=require("./dompos"),baseCommands=exports.baseCommands=Object.create(null);baseCommands.deleteSelection={label:"Delete the selection",run:function(pm){return pm.tr.replaceSelection().apply(pm.apply.scroll)},keys:{all:["Backspace(10)","Delete(10)","Mod-Backspace(10)","Mod-Delete(10)"],mac:["Ctrl-H(10)","Alt-Backspace(10)","Ctrl-D(10)","Ctrl-Alt-Backspace(10)","Alt-Delete(10)","Alt-D(10)"]}},baseCommands.joinBackward={label:"Join with the block above",run:function(pm){var _pm$selection=pm.selection,head=_pm$selection.head,empty=_pm$selection.empty;if(!empty||head.offset>0)return!1;for(var before=void 0,cut=void 0,i=head.path.length-1;!before&&i>=0;i--)head.path[i]>0&&(cut=head.shorten(i),before=pm.doc.path(cut.path).child(cut.offset-1));if(!before)return pm.tr.lift(head).apply(pm.apply.scroll);if(null==before.type.contains&&before.type.selectable&&0==pm.doc.path(head.path).size){var tr=pm.tr["delete"](cut,cut.move(1)).apply(pm.apply.scroll);return pm.setNodeSelection(cut.move(-1)),tr}return null==before.type.contains?pm.tr["delete"](cut.move(-1),cut).apply(pm.apply.scroll):deleteBarrier(pm,cut)},keys:["Backspace(30)","Mod-Backspace(30)"]},baseCommands.deleteCharBefore={label:"Delete a character before the cursor",run:function(pm){var _pm$selection2=pm.selection,head=_pm$selection2.head,empty=_pm$selection2.empty;if(!empty||0==head.offset)return!1;var from=moveBackward(pm.doc.path(head.path),head.offset,"char");return pm.tr["delete"](new _model.Pos(head.path,from),head).apply(pm.apply.scroll)},keys:{all:["Backspace(60)"],mac:["Ctrl-H(40)"]}},baseCommands.deleteWordBefore={label:"Delete the word before the cursor",run:function(pm){var _pm$selection3=pm.selection,head=_pm$selection3.head,empty=_pm$selection3.empty;if(!empty||0==head.offset)return!1;var from=moveBackward(pm.doc.path(head.path),head.offset,"word");return pm.tr["delete"](new _model.Pos(head.path,from),head).apply(pm.apply.scroll)},keys:{all:["Mod-Backspace(40)"],mac:["Alt-Backspace(40)"]}},baseCommands.joinForward={label:"Join with the block below",run:function(pm){var _pm$selection4=pm.selection,head=_pm$selection4.head,empty=_pm$selection4.empty;if(!empty||head.offset=0;i--){cut=head.shorten(i,1);var parent=pm.doc.path(cut.path);cut.offset0||pm.doc.path(head.path).size)return!1;if(head.depth>1){var shorter=head.shorten();if(shorter.offset>0&&shorter.offset0},menu:{group:"history",rank:10,display:{type:"icon",width:1024,height:1024,path:"M761 1024c113-206 132-520-313-509v253l-384-384 384-384v248c534-13 594 472 313 775z"}},keys:["Mod-Z"]},baseCommands.redo={label:"Redo last undone change",run:function(pm){return pm.scrollIntoView(),pm.history.redo()},select:function(pm){return pm.history.redoDepth>0},menu:{group:"history",rank:20,display:{type:"icon",width:1024,height:1024,path:"M576 248v-248l384 384-384 384v-253c-446-10-427 303-313 509-280-303-221-789 313-775z"}},keys:["Mod-Y","Shift-Mod-Z"]}},{"../model":34,"../transform":40,"../util/error":52,"./char":4,"./dompos":8,"./selection":17}],3:[function(require,module,exports){"use strict";function _interopRequireDefault(obj){return obj&&obj.__esModule?obj:{"default":obj}}function nothing(){}function ensureSelection(pm){if(pm.selection.node){var found=(0,_selection.findSelectionNear)(pm.doc,pm.selection.from,1,!0);found&&(0,_dompos.setDOMSelectionToPos)(pm,found.head)}return!1}Object.defineProperty(exports,"__esModule",{value:!0}),exports.captureKeys=void 0;var _browserkeymap=require("browserkeymap"),_browserkeymap2=_interopRequireDefault(_browserkeymap),_selection=require("./selection"),_dompos=require("./dompos"),_dom=require("../dom"),keys={Esc:nothing,Enter:nothing,"Mod-Enter":nothing,"Shift-Enter":nothing,Backspace:nothing,Delete:nothing,"Mod-B":nothing,"Mod-I":nothing,"Mod-Backspace":nothing,"Mod-Delete":nothing,"Shift-Backspace":nothing,"Shift-Delete":nothing,"Shift-Mod-Backspace":nothing,"Shift-Mod-Delete":nothing,"Mod-Z":nothing,"Mod-Y":nothing,"Shift-Mod-Z":nothing,"Ctrl-D":nothing,"Ctrl-H":nothing,"Ctrl-Alt-Backspace":nothing,"Alt-D":nothing,"Alt-Delete":nothing,"Alt-Backspace":nothing,"Mod-A":ensureSelection};["Left","Right","Up","Down","Home","End","PageUp","PageDown"].forEach(function(key){keys[key]=keys["Shift-"+key]=keys["Mod-"+key]=keys["Shift-Mod-"+key]=keys["Alt-"+key]=keys["Shift-Alt-"+key]=ensureSelection}),["Left","Mod-Left","Right","Mod-Right","Up","Down"].forEach(function(key){return delete keys[key]}),_dom.browser.mac&&(keys["Ctrl-F"]=keys["Ctrl-B"]=keys["Ctrl-P"]=keys["Ctrl-N"]=keys["Alt-F"]=keys["Alt-B"]=keys["Ctrl-A"]=keys["Ctrl-E"]=keys["Ctrl-V"]=keys.goPageUp=ensureSelection);exports.captureKeys=new _browserkeymap2["default"](keys)},{"../dom":1,"./dompos":8,"./selection":17,browserkeymap:57}],4:[function(require,module,exports){"use strict";function isWordChar(ch){return/\w/.test(ch)||isExtendingChar(ch)||ch>"€"&&(ch.toUpperCase()!=ch.toLowerCase()||nonASCIISingleCaseWordChar.test(ch))}function charCategory(ch){return/\s/.test(ch)?"space":isWordChar(ch)?"word":"other"}function isExtendingChar(ch){return ch.charCodeAt(0)>=768&&extendingChar.test(ch)}Object.defineProperty(exports,"__esModule",{value:!0}),exports.isWordChar=isWordChar,exports.charCategory=charCategory,exports.isExtendingChar=isExtendingChar;var nonASCIISingleCaseWordChar=/[\u00df\u0587\u0590-\u05f4\u0600-\u06ff\u3040-\u309f\u30a0-\u30ff\u3400-\u4db5\u4e00-\u9fcc\uac00-\ud7af]/,extendingChar=/[\u0300-\u036f\u0483-\u0489\u0591-\u05bd\u05bf\u05c1\u05c2\u05c4\u05c5\u05c7\u0610-\u061a\u064b-\u065e\u0670\u06d6-\u06dc\u06de-\u06e4\u06e7\u06e8\u06ea-\u06ed\u0711\u0730-\u074a\u07a6-\u07b0\u07eb-\u07f3\u0816-\u0819\u081b-\u0823\u0825-\u0827\u0829-\u082d\u0900-\u0902\u093c\u0941-\u0948\u094d\u0951-\u0955\u0962\u0963\u0981\u09bc\u09be\u09c1-\u09c4\u09cd\u09d7\u09e2\u09e3\u0a01\u0a02\u0a3c\u0a41\u0a42\u0a47\u0a48\u0a4b-\u0a4d\u0a51\u0a70\u0a71\u0a75\u0a81\u0a82\u0abc\u0ac1-\u0ac5\u0ac7\u0ac8\u0acd\u0ae2\u0ae3\u0b01\u0b3c\u0b3e\u0b3f\u0b41-\u0b44\u0b4d\u0b56\u0b57\u0b62\u0b63\u0b82\u0bbe\u0bc0\u0bcd\u0bd7\u0c3e-\u0c40\u0c46-\u0c48\u0c4a-\u0c4d\u0c55\u0c56\u0c62\u0c63\u0cbc\u0cbf\u0cc2\u0cc6\u0ccc\u0ccd\u0cd5\u0cd6\u0ce2\u0ce3\u0d3e\u0d41-\u0d44\u0d4d\u0d57\u0d62\u0d63\u0dca\u0dcf\u0dd2-\u0dd4\u0dd6\u0ddf\u0e31\u0e34-\u0e3a\u0e47-\u0e4e\u0eb1\u0eb4-\u0eb9\u0ebb\u0ebc\u0ec8-\u0ecd\u0f18\u0f19\u0f35\u0f37\u0f39\u0f71-\u0f7e\u0f80-\u0f84\u0f86\u0f87\u0f90-\u0f97\u0f99-\u0fbc\u0fc6\u102d-\u1030\u1032-\u1037\u1039\u103a\u103d\u103e\u1058\u1059\u105e-\u1060\u1071-\u1074\u1082\u1085\u1086\u108d\u109d\u135f\u1712-\u1714\u1732-\u1734\u1752\u1753\u1772\u1773\u17b7-\u17bd\u17c6\u17c9-\u17d3\u17dd\u180b-\u180d\u18a9\u1920-\u1922\u1927\u1928\u1932\u1939-\u193b\u1a17\u1a18\u1a56\u1a58-\u1a5e\u1a60\u1a62\u1a65-\u1a6c\u1a73-\u1a7c\u1a7f\u1b00-\u1b03\u1b34\u1b36-\u1b3a\u1b3c\u1b42\u1b6b-\u1b73\u1b80\u1b81\u1ba2-\u1ba5\u1ba8\u1ba9\u1c2c-\u1c33\u1c36\u1c37\u1cd0-\u1cd2\u1cd4-\u1ce0\u1ce2-\u1ce8\u1ced\u1dc0-\u1de6\u1dfd-\u1dff\u200c\u200d\u20d0-\u20f0\u2cef-\u2cf1\u2de0-\u2dff\u302a-\u302f\u3099\u309a\ua66f-\ua672\ua67c\ua67d\ua6f0\ua6f1\ua802\ua806\ua80b\ua825\ua826\ua8c4\ua8e0-\ua8f1\ua926-\ua92d\ua947-\ua951\ua980-\ua982\ua9b3\ua9b6-\ua9b9\ua9bc\uaa29-\uaa2e\uaa31\uaa32\uaa35\uaa36\uaa43\uaa4c\uaab0\uaab2-\uaab4\uaab7\uaab8\uaabe\uaabf\uaac1\uabe5\uabe8\uabed\udc00-\udfff\ufb1e\ufe00-\ufe0f\ufe20-\ufe26\uff9e\uff9f]/},{}],5:[function(require,module,exports){"use strict";function _interopRequireDefault(obj){return obj&&obj.__esModule?obj:{"default":obj}}function _toConsumableArray(arr){if(Array.isArray(arr)){for(var i=0,arr2=Array(arr.length);ifrom.offset&&startParent.chunkAfter(from.offset);start=startChunk?type.isInSet(startChunk.node.marks):null,end=type.isInSet(pm.doc.marksAt(to))}return start&&end&&start.attrs[attr]==end.attrs[attr]?start.attrs[attr]:void 0}function selectedNodeAttr(pm,type,name){var node=pm.selection.node;return node&&node.type==type?node.attrs[name]:void 0}function deriveParams(type,params){return params&¶ms.map(function(param){var attr=type.attrs[param.attr],obj={type:"text","default":attr["default"],prefill:type instanceof _model.NodeType?function(pm){return selectedNodeAttr(pm,this,param.attr)}:function(pm){return selectedMarkAttr(pm,this,param.attr)}};for(var prop in param)obj[prop]=param[prop];return obj})}function fillAttrs(conf,givenParams){var attrs=conf.attrs;return conf.params&&!function(){var filled=Object.create(null);if(attrs)for(var name in attrs)filled[name]=attrs[name];conf.params.forEach(function(param,i){return filled[param.attr]=givenParams[i]}),attrs=filled}(),attrs}function isAtTopOfListItem(doc,from,to,listType){return _model.Pos.samePath(from.path,to.path)&&from.path.length>=2&&0==from.path[from.path.length-1]&&listType.canContain(doc.path(from.path.slice(0,from.path.length-1)))}function alreadyHasBlockType(doc,from,to,type,attrs){var found=!1;return attrs||(attrs={}),doc.nodesBetween(from,to||from,function(node){return node.isTextblock?(node.hasMarkup(type,attrs)&&(found=!0),!1):void 0}),found}function activeTextblockIs(pm,type,attrs){var _pm$selection6=pm.selection,from=_pm$selection6.from,to=_pm$selection6.to,node=_pm$selection6.node;if(!node||node.isInline){if(!_model.Pos.samePath(from.path,to.path))return!1;node=pm.doc.path(from.path)}else if(!node.isTextblock)return!1;return node.hasMarkup(type,attrs)}var _slicedToArray=function(){function sliceIterator(arr,i){var _arr=[],_n=!0,_d=!1,_e=void 0;try{for(var _s,_i=arr[Symbol.iterator]();!(_n=(_s=_i.next()).done)&&(_arr.push(_s.value),!i||_arr.length!==i);_n=!0);}catch(err){_d=!0,_e=err}finally{try{!_n&&_i["return"]&&_i["return"]()}finally{if(_d)throw _e}}return _arr}return function(arr,i){if(Array.isArray(arr))return arr;if(Symbol.iterator in Object(arr))return sliceIterator(arr,i);throw new TypeError("Invalid attempt to destructure non-iterable instance")}}(),_typeof="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(obj){return typeof obj}:function(obj){return obj&&"function"==typeof Symbol&&obj.constructor===Symbol?"symbol":typeof obj},_createClass=function(){function defineProperties(target,props){for(var i=0;i1?_len-1:0),_key=1;_len>_key;_key++)params[_key-1]=arguments[_key];pm.setMark(this,!0,fillAttrs(conf,params))},select:function(pm){return conf.inverseSelect?markApplies(pm,this)&&!markActive(pm,this):canAddInline(pm,this)},params:deriveParams(this,conf.params)}},_model.MarkType.derivableCommands.unset=function(){return{run:function(pm){pm.setMark(this,!1)},select:function(pm){return markActive(pm,this)}}},_model.MarkType.derivableCommands.toggle=function(){return{run:function(pm){pm.setMark(this,null)},active:function(pm){return markActive(pm,this)},select:function(pm){return markApplies(pm,this)}}},_model.NodeType.derivableCommands.wrap=function(conf){return{run:function(pm){var _pm$selection4=pm.selection,from=_pm$selection4.from,to=_pm$selection4.to,head=_pm$selection4.head,doJoin=!1;if(conf.list&&head&&isAtTopOfListItem(pm.doc,from,to,this)){if(0==from.path[from.path.length-2])return!1;doJoin=!0}for(var _len2=arguments.length,params=Array(_len2>1?_len2-1:0),_key2=1;_len2>_key2;_key2++)params[_key2-1]=arguments[_key2];var tr=pm.tr.wrap(from,to,this,fillAttrs(conf,params));return doJoin&&tr.join(from.shorten(from.depth-2)),tr.apply(pm.apply.scroll)},select:function(pm){var _pm$selection5=pm.selection,from=_pm$selection5.from,to=_pm$selection5.to,head=_pm$selection5.head;return conf.list&&head&&isAtTopOfListItem(pm.doc,from,to,this)&&0==from.path[from.path.length-2]?!1:(0,_transform.canWrap)(pm.doc,from,to,this,conf.attrs)},params:deriveParams(this,conf.params)}},_model.NodeType.derivableCommands.make=function(conf){return{run:function(pm){var _pm$selection7=pm.selection,from=_pm$selection7.from,to=_pm$selection7.to;return pm.tr.setBlockType(from,to,this,conf.attrs).apply(pm.apply.scroll)},select:function(pm){var _pm$selection8=pm.selection,from=_pm$selection8.from,to=_pm$selection8.to,node=_pm$selection8.node;return node?node.isTextblock&&!node.hasMarkup(this,conf.attrs):!alreadyHasBlockType(pm.doc,from,to,this,conf.attrs)},active:function(pm){return activeTextblockIs(pm,this,conf.attrs)}}},_model.NodeType.derivableCommands.insert=function(conf){return{run:function(pm){for(var _len3=arguments.length,params=Array(_len3>1?_len3-1:0),_key3=1;_len3>_key3;_key3++)params[_key3-1]=arguments[_key3];return pm.tr.replaceSelection(this.create(fillAttrs(conf,params))).apply(pm.apply.scroll)},select:this.isInline?function(pm){return pm.doc.path(pm.selection.from.path).type.canContainType(this)}:null,params:deriveParams(this,conf.params)}}},{"../dom":1, -"../model":34,"../transform":40,"../util/error":52,"../util/obj":55,"../util/sortedinsert":56,"./base_commands":2,browserkeymap:57}],6:[function(require,module,exports){"use strict";var _dom=require("../dom");(0,_dom.insertCSS)('\n\n.ProseMirror {\n border: 1px solid silver;\n position: relative;\n}\n\n.ProseMirror-content {\n padding: 4px 8px 4px 14px;\n white-space: pre-wrap;\n line-height: 1.2;\n}\n\n.ProseMirror-drop-target {\n position: absolute;\n width: 1px;\n background: #666;\n display: none;\n}\n\n.ProseMirror-content ul.tight p, .ProseMirror-content ol.tight p {\n margin: 0;\n}\n\n.ProseMirror-content ul, .ProseMirror-content ol {\n padding-left: 30px;\n cursor: default;\n}\n\n.ProseMirror-content blockquote {\n padding-left: 1em;\n border-left: 3px solid #eee;\n margin-left: 0; margin-right: 0;\n}\n\n.ProseMirror-content pre {\n white-space: pre-wrap;\n}\n\n.ProseMirror-selectednode {\n outline: 2px solid #8cf;\n}\n\n.ProseMirror-nodeselection *::selection { background: transparent; }\n.ProseMirror-nodeselection *::-moz-selection { background: transparent; }\n\n.ProseMirror-content p:first-child,\n.ProseMirror-content h1:first-child,\n.ProseMirror-content h2:first-child,\n.ProseMirror-content h3:first-child,\n.ProseMirror-content h4:first-child,\n.ProseMirror-content h5:first-child,\n.ProseMirror-content h6:first-child {\n margin-top: .3em;\n}\n\n/* Add space around the hr to make clicking it easier */\n\n.ProseMirror-content hr {\n position: relative;\n height: 6px;\n border: none;\n}\n\n.ProseMirror-content hr:after {\n content: "";\n position: absolute;\n left: 10px;\n right: 10px;\n top: 2px;\n border-top: 2px solid silver;\n}\n\n.ProseMirror-content img {\n cursor: default;\n}\n\n/* Make sure li selections wrap around markers */\n\n.ProseMirror-content li {\n position: relative;\n pointer-events: none; /* Don\'t do weird stuff with marker clicks */\n}\n.ProseMirror-content li > * {\n pointer-events: auto;\n}\n\nli.ProseMirror-selectednode {\n outline: none;\n}\n\nli.ProseMirror-selectednode:after {\n content: "";\n position: absolute;\n left: -32px;\n right: -2px; top: -2px; bottom: -2px;\n border: 2px solid #8cf;\n pointer-events: none;\n}\n\n')},{"../dom":1}],7:[function(require,module,exports){"use strict";function isAtEnd(node,pos,depth){for(var i=depth||0;i0)return!1;for(var i=depth||0;i0)return!1;return!0}function parseNearSelection(pm){for(var dom=pm.content,node=pm.doc,_pm$selection=pm.selection,from=_pm$selection.from,to=_pm$selection.to,depth=0;;depth++){var toNode=node.child(to.path[depth]),fromStart=isAtStart(from,depth+1),toEnd=isAtEnd(toNode,to,depth+1);if(fromStart||toEnd||from.path[depth]!=to.path[depth]||toNode.isTextblock){var startOffset=depth==from.depth?from.offset:from.path[depth];fromStart&&startOffset>0&&startOffset--;var endOffset=depth==to.depth?to.offset:to.path[depth]+1;toEnd&&endOffset=0;i--){var wrap=pm.doc.path(from.path.slice(0,i));parsed=wrap.replace(from.path[i],parsed)}return parsed}node=toNode,dom=(0,_dompos.findByPath)(dom,from.path[depth],!1)}}function applyDOMChange(pm){var updated=parseNearSelection(pm),changeStart=(0,_model.findDiffStart)(pm.doc.content,updated.content);if(changeStart){var changeEnd=findDiffEndConstrained(pm.doc.content,updated.content,changeStart);return markDirtyFor(pm,changeStart,changeEnd),pm.tr.replace(changeStart,changeEnd.a,updated,changeStart,changeEnd.b).apply(),!0}return!1}function offsetBy(first,second,pos){var same=(0,_tree.samePathDepth)(first,second),firstEnd=same==first.depth,secondEnd=same==second.depth,off=(secondEnd?second.offset:second.path[same])-(firstEnd?first.offset:first.path[same]),shorter=firstEnd?pos.move(off):pos.shorten(same,off);return secondEnd?shorter:shorter.extend(new _model.Pos(second.path.slice(same),second.offset))}function findDiffEndConstrained(a,b,start){var end=(0,_model.findDiffEnd)(a,b);return end?end.a.cmp(start)<0?{a:start,b:offsetBy(end.a,start,end.b)}:end.b.cmp(start)<0?{a:offsetBy(end.b,start,end.a),b:start}:end:end}function sameDepth(a,b){for(var max=Math.min(a.depth,b.depth),i=0;max>i;i++)if(a.path[i]!=b.path[i])return i;return max}function markDirtyFor(pm,start,end){var depth=Math.min(sameDepth(start,end.a),sameDepth(start,end.b));if(0==depth)pm.markAllDirty();else{var pos=_model.Pos.from(start.path.slice(0,depth));pm.markRangeDirty({from:pos,to:pos.move(1)})}}function textContext(data){var range=window.getSelection().getRangeAt(0),start=range.startContainer,end=range.endContainer;if(start==end&&3==start.nodeType){var value=start.nodeValue,lead=range.startOffset,_end=range.endOffset;return data&&_end>=data.length&&value.slice(_end-data.length,_end)==data&&(lead=_end-data.length),{inside:start,lead:lead,trail:value.length-_end}}for(var sizeBefore=null,sizeAfter=null,before=start.childNodes[range.startOffset-1]||nodeBefore(start);before.lastChild;)before=before.lastChild;if(before&&3==before.nodeType){var value=before.nodeValue;sizeBefore=value.length,data&&value.slice(value.length-data.length)==data&&(sizeBefore-=data.length)}for(var after=end.childNodes[range.endOffset]||nodeAfter(end);after.firstChild;)after=after.firstChild;return after&&3==after.nodeType&&(sizeAfter=after.nodeValue.length),{before:before,sizeBefore:sizeBefore,after:after,sizeAfter:sizeAfter}}function textInContext(context,deflt){if(context.inside){var _val=context.inside.nodeValue;return _val.slice(context.lead,_val.length-context.trail)}var before=context.before,after=context.after,val="";if(!before)return deflt;3==before.nodeType&&(val=before.nodeValue.slice(context.sizeBefore));var scan=scanText(before,after);if(null==scan)return deflt;if(val+=scan,after&&3==after.nodeType){var valAfter=after.nodeValue;val+=valAfter.slice(0,valAfter.length-context.sizeAfter)}return val}function nodeAfter(node){for(;;){var next=node.nextSibling;if(next){for(;next.firstChild;)next=next.firstChild;return next}if(!(node=node.parentElement))return null}}function nodeBefore(node){for(;;){var prev=node.previousSibling;if(prev){for(;prev.lastChild;)prev=prev.lastChild;return prev}if(!(node=node.parentElement))return null}}function scanText(start,end){for(var text="",cur=nodeAfter(start);;){if(cur==end)return text;if(!cur)return null;3==cur.nodeType&&(text+=cur.nodeValue),cur=cur.firstChild||nodeAfter(cur)}}Object.defineProperty(exports,"__esModule",{value:!0}),exports.applyDOMChange=applyDOMChange,exports.textContext=textContext,exports.textInContext=textInContext;var _model=require("../model"),_format=require("../format"),_tree=require("../transform/tree"),_dompos=require("./dompos")},{"../format":20,"../model":34,"../transform/tree":48,"./dompos":8}],8:[function(require,module,exports){"use strict";function pathFromDOM(pm,node){for(var path=[];node!=pm.content;){var attr=node.getAttribute("pm-offset");attr&&path.unshift(+attr),node=node.parentNode}return path}function widthFromDOM(dom){var attr=dom.getAttribute("pm-leaf");return attr&&"true"!=attr?+attr:1}function posFromDOM(pm,dom,domOffset,loose){if(!loose&&pm.operation&&pm.doc!=pm.operation.doc)throw new _error.AssertionError("Fetching a position from an outdated DOM structure");null==domOffset&&(domOffset=Array.prototype.indexOf.call(dom.parentNode.childNodes,dom),dom=dom.parentNode);for(var extraOffset=0,tag=void 0;;){var adjust=0;if(3==dom.nodeType)extraOffset+=domOffset;else{if(dom.hasAttribute("pm-container"))break;(tag=dom.getAttribute("pm-inner-offset"))?(extraOffset+=+tag,adjust=-1):domOffset&&domOffset==dom.childNodes.length&&(adjust=1)}var parent=dom.parentNode;domOffset=0>adjust?0:Array.prototype.indexOf.call(parent.childNodes,dom)+adjust,dom=parent}var path=pathFromDOM(pm,dom);if(dom.hasAttribute("pm-leaf"))return _model.Pos.from(path,extraOffset+(domOffset?1:0));for(var offset=0,i=domOffset-1;i>=0;i--){var child=dom.childNodes[i];if(3==child.nodeType)loose&&(extraOffset+=child.nodeValue.length);else{if(tag=child.getAttribute("pm-offset")){offset=+tag+widthFromDOM(child);break}loose&&!child.hasAttribute("pm-ignore")&&(extraOffset+=child.textContent.length)}}return new _model.Pos(path,offset+extraOffset)}function findByPath(node,n,fromEnd){for(var container=childContainer(node),ch=fromEnd?container.lastChild:container.firstChild;ch;ch=fromEnd?ch.previousSibling:ch.nextSibling)if(1==ch.nodeType){var offset=ch.getAttribute("pm-offset");if(offset&&+offset==n)return ch}}function pathToDOM(parent,path){for(var node=parent,i=0;i=0&&(after?width>=diff:width>diff))return{node:ch,offset:i,innerOffset:diff}}}function leafAt(node,offset){for(;;){var child=node.firstChild;if(!child)return{node:node,offset:offset};if(1!=child.nodeType)return{node:child,offset:offset};if(child.hasAttribute("pm-inner-offset")){for(var nodeOffset=0;;){var nextSib=child.nextSibling,nextOffset=void 0;if(!nextSib||(nextOffset=+nextSib.getAttribute("pm-inner-offset"))>=offset)break;child=nextSib,nodeOffset=nextOffset}offset-=nodeOffset}node=child}}function DOMFromPos(parent,pos){var dom=childContainer(pathToDOM(parent,pos.path)),found=findByOffset(dom,pos.offset,!0),inner=void 0;return found?"true"!=found.node.getAttribute("pm-leaf")&&(inner=leafAt(found.node,found.innerOffset))?inner:{node:found.node.parentNode,offset:found.offset+(found.innerOffset?1:0)}:{node:dom,offset:0}}function windowRect(){return{left:0,right:window.innerWidth,top:0,bottom:window.innerHeight}}function scrollIntoView(pm,pos){pos||(pos=pm.sel.range.head||pm.sel.range.from);for(var coords=coordsAtPos(pm,pos),parent=pm.content;;parent=parent.parentNode){var atBody=parent==document.body,rect=atBody?windowRect():parent.getBoundingClientRect(),moveX=0,moveY=0;if(coords.toprect.bottom&&(moveY=coords.bottom-rect.bottom+scrollMargin),coords.leftrect.right&&(moveX=coords.right-rect.right+scrollMargin),(moveX||moveY)&&(atBody?window.scrollBy(moveX,moveY):(moveY&&(parent.scrollTop+=moveY),moveX&&(parent.scrollLeft+=moveX))),atBody)break}}function findOffsetInNode(node,coords){for(var closest=void 0,dyClosest=1e8,coordsClosest=void 0,offset=0,child=node.firstChild;child;child=child.nextSibling){var rects=void 0;if(1==child.nodeType)rects=child.getClientRects();else{if(3!=child.nodeType)continue;rects=textRects(child)}for(var i=0;i=coords.left){var dy=rect.top>coords.top?rect.top-coords.top:rect.bottomdy){closest=child,dyClosest=dy,coordsClosest=dy?{left:coords.left,top:rect.top}:coords,1!=child.nodeType||child.firstChild||(offset=i+(coords.left>=(rect.left+rect.right)/2?1:0));continue}}!closest&&(coords.top>=rect.bottom||coords.top>=rect.top&&coords.left>=rect.right)&&(offset=i+1)}}return closest?3==closest.nodeType?findOffsetInText(closest,coordsClosest):closest.firstChild?findOffsetInNode(closest,coordsClosest):{node:node,offset:offset}:{node:node,offset:offset}}function findOffsetInText(node,coords){for(var len=node.nodeValue.length,range=document.createRange(),i=0;len>i;i++){range.setEnd(node,i+1),range.setStart(node,i);var rect=range.getBoundingClientRect();if(rect.top!=rect.bottom&&rect.left<=coords.left&&rect.right>=coords.left&&rect.top<=coords.top&&rect.bottom>=coords.top)return{node:node,offset:i+(coords.left>=(rect.left+rect.right)/2?1:0)}}return{node:node,offset:0}}function posAtCoords(pm,coords){var elt=document.elementFromPoint(coords.left,coords.top+1);if(!(0,_dom.contains)(pm.content,elt))return null;elt.firstChild||(elt=elt.parentNode);var _findOffsetInNode=findOffsetInNode(elt,coords),node=_findOffsetInNode.node,offset=_findOffsetInNode.offset;return posFromDOM(pm,node,offset)}function textRect(node,from,to){var range=document.createRange();return range.setEnd(node,to),range.setStart(node,from),range.getBoundingClientRect()}function textRects(node){var range=document.createRange();return range.setEnd(node,node.nodeValue.length),range.setStart(node,0),range.getClientRects()}function coordsAtPos(pm,pos){var _DOMFromPos=DOMFromPos(pm.content,pos),node=_DOMFromPos.node,offset=_DOMFromPos.offset,side=void 0,rect=void 0;if(3==node.nodeType)offsetversion;)this.addNextMap()}},{key:"addNextMap",value:function(){var found=this.branch.mirror[this.version],mapOffset=this.branch.maps.length-(this.branch.version-this.version)-1,id=this.remap.addToFront(this.branch.maps[mapOffset],this.mirrorBuffer[this.version]);return--this.version,null!=found&&(this.mirrorBuffer[found]=id),id}},{key:"movePastStep",value:function(result){var id=this.addNextMap();result&&this.remap.addToBack(result.map,id)}}]),BranchRemapping}(),workTime=100,pauseTime=150,CompressionWorker=function(){function CompressionWorker(doc,branch,callback){_classCallCheck(this,CompressionWorker),this.branch=branch,this.callback=callback,this.remap=new BranchRemapping(branch),this.doc=doc,this.events=[],this.maps=[],this.version=this.startVersion=branch.version,this.i=branch.events.length,this.timeout=null,this.aborted=!1}return _createClass(CompressionWorker,[{key:"work",value:function(){var _this=this;if(!this.aborted)for(var endTime=Date.now()+workTime;;){if(0==this.i)return this.finish();for(var event=this.branch.events[--this.i],mappedSelection=event.selection.map(this.doc,this.remap.remap),outEvent=new HistoryEvent([],mappedSelection),j=event.steps.length-1;j>=0;j--){var _event$steps$j=event.steps[j],step=_event$steps$j.step,stepVersion=_event$steps$j.version,stepID=_event$steps$j.id;this.remap.moveToVersion(stepVersion);var mappedStep=step.map(this.remap.remap);if(mappedStep&&isDelStep(step)){for(var extra=0,start=step.from;j>0;){var next=event.steps[j-1];if(next.version!=stepVersion-1||!isDelStep(next.step)||start.cmp(next.step.to))break;extra+=next.step.to.offset-next.step.from.offset,start=next.step.from,stepVersion--,j--,this.remap.addNextMap()}if(extra>0){var _start=mappedStep.from.move(-extra);mappedStep=new _transform.Step("replace",_start,mappedStep.to,_start)}}var result=mappedStep&&mappedStep.apply(this.doc);result&&(this.doc=result.doc,this.maps.push(result.map.invert()),outEvent.steps.push(new InvertedStep(mappedStep,this.version,stepID)),this.version--),this.remap.movePastStep(result)}if(outEvent.steps.length&&(outEvent.steps.reverse(),this.events.push(outEvent)),Date.now()>endTime)return void(this.timeout=window.setTimeout(function(){return _this.work()},pauseTime))}}},{key:"finish",value:function(){this.aborted||(this.events.reverse(),this.maps.reverse(),this.callback(this.maps.concat(this.branch.maps.slice(this.branch.maps.length-(this.branch.version-this.startVersion))),this.events))}},{key:"abort",value:function(){this.aborted=!0,window.clearTimeout(this.timeout)}}]),CompressionWorker}(),compressStepCount=150,Branch=function(){function Branch(maxDepth){_classCallCheck(this,Branch),this.maxDepth=maxDepth,this.version=0,this.nextStepID=1,this.maps=[],this.mirror=Object.create(null),this.events=[],this.stepsSinceCompress=0,this.compressing=null,this.compressTimeout=null}return _createClass(Branch,[{key:"clear",value:function(force){(force||!this.empty())&&(this.maps.length=this.events.length=this.stepsSinceCompress=0,this.mirror=Object.create(null),this.abortCompression())}},{key:"newEvent",value:function(currentSelection){for(this.abortCompression(),this.events.push(new HistoryEvent([],currentSelection));this.events.length>this.maxDepth;)this.events.shift()}},{key:"addMap",value:function(map){return this.empty()?void 0:(this.maps.push(map),this.version++,this.stepsSinceCompress++,!0)}},{key:"empty",value:function(){return 0==this.events.length}},{key:"addStep",value:function(step,map,id){this.addMap(map),null==id&&(id=this.nextStepID++),this.events[this.events.length-1].steps.push(new InvertedStep(step,this.version,id))}},{key:"addTransform",value:function(transform,ids){this.abortCompression();for(var i=0;i=0;i--){var invertedStep=event.steps[i],step=invertedStep.step;if(collapsing&&invertedStep.version==remap.version)this.version--,delete this.mirror[this.version],this.maps.pop(),tr.step(step),ids.push(invertedStep.id),--remap.version;else{collapsing=!1,remap.moveToVersion(invertedStep.version),step=step.map(remap.remap);var result=step&&tr.step(step);result&&(ids.push(invertedStep.id),this.addMap(result.map)&&(this.mirror[this.version]=invertedStep.version)),remap.movePastStep(result)}}var selection=event.selection.map(tr.doc,remap.remap);return this.empty()&&this.clear(!0),{transform:tr,ids:ids,selection:selection}}},{key:"lastStep",value:function(){for(var i=this.events.length-1;i>=0;i--){var event=this.events[i];if(event.steps.length)return event.steps[event.steps.length-1]}}},{key:"getVersion",value:function(){var step=this.lastStep();return{lastID:step&&step.id,version:this.version}}},{key:"isAtVersion",value:function(version){var step=this.lastStep();return this.version==version.version&&(step&&step.id)==version.lastID}},{key:"findVersion",value:function(version){if(null==version.lastID)return{event:0,step:0};for(var i=this.events.length-1;i>=0;i--)for(var event=this.events[i],j=event.steps.length-1;j>=0;j--)if(event.steps[j].id<=version.lastID)return{event:i,step:j+1}}},{key:"rebased",value:function(newMaps,rebasedTransform,positions){if(!this.empty()){this.abortCompression();var startVersion=this.version-positions.length;out:for(var i=this.events.length-1;i>=0;i--)for(var event=this.events[i],j=event.steps.length-1;j>=0;j--){var step=event.steps[j];if(step.version<=startVersion)break out;var off=positions[step.version-startVersion-1];if(-1==off)event.steps.splice(j--,1);else{var inv=rebasedTransform.steps[off].invert(rebasedTransform.docs[off],rebasedTransform.maps[off]);event.steps[j]=new InvertedStep(inv,startVersion+newMaps.length+off+1,step.id)}}this.maps.length>positions.length?this.maps=this.maps.slice(0,this.maps.length-positions.length).concat(newMaps).concat(rebasedTransform.maps):this.maps=rebasedTransform.maps.slice(),this.version=startVersion+newMaps.length+rebasedTransform.maps.length,this.stepsSinceCompress+=newMaps.length+rebasedTransform.steps.length-positions.length}}},{key:"abortCompression",value:function(){this.compressing&&(this.compressing.abort(),this.compressing=null)}},{key:"needsCompression",value:function(){return this.stepsSinceCompress>compressStepCount&&!this.compressing}},{key:"startCompression",value:function(doc){var _this2=this;this.compressing=new CompressionWorker(doc,this,function(maps,events){_this2.maps=maps,_this2.events=events,_this2.mirror=Object.create(null),_this2.compressing=null,_this2.stepsSinceCompress=0}),this.compressing.work()}}]),Branch}(),compressDelay=750;exports.History=function(){function History(pm){var _this3=this;_classCallCheck(this,History),this.pm=pm,this.done=new Branch(pm.options.historyDepth),this.undone=new Branch(pm.options.historyDepth),this.lastAddedAt=0,this.ignoreTransform=!1,this.allowCollapsing=!0,pm.on("transform",function(transform,selection,options){return _this3.recordTransform(transform,selection,options)})}return _createClass(History,[{key:"recordTransform",value:function(transform,selection,options){if(!this.ignoreTransform){if(0==options.addToHistory)for(var i=0;ithis.lastAddedAt+this.pm.options.historyEventDelay&&this.done.newEvent(selection),this.done.addTransform(transform),this.lastAddedAt=now}this.maybeScheduleCompression()}}},{key:"undo",value:function(){return this.shift(this.done,this.undone)}},{key:"redo",value:function(){return this.shift(this.undone,this.done)}},{key:"shift",value:function(from,to){var event=from.popEvent(this.pm.doc,this.allowCollapsing);if(!event)return!1;var transform=event.transform,ids=event.ids,selection=event.selection,selectionBeforeTransform=this.pm.selection;return this.ignoreTransform=!0,this.pm.apply(transform,{selection:selection}),this.ignoreTransform=!1,transform.steps.length?(to&&(to.newEvent(selectionBeforeTransform),to.addTransform(transform,ids)),this.lastAddedAt=0,!0):this.shift(from,to)}},{key:"getVersion",value:function(){return this.done.getVersion()}},{key:"isAtVersion",value:function(version){return this.done.isAtVersion(version)}},{key:"backToVersion",value:function(version){var found=this.done.findVersion(version);if(!found)return!1;var event=this.done.events[found.event];if(found.event==this.done.events.length-1&&found.step==event.steps.length)return!0;var combinedSteps=this.done.events.slice(found.event+1).reduce(function(comb,arr){return comb.concat(arr.steps)},event.steps.slice(found.step));return this.done.events.length=found.event+((event.steps.length=found.step)?1:0),this.done.events.push(new HistoryEvent(combinedSteps,event.selection)),this.shift(this.done),!0}},{key:"rebased",value:function(newMaps,rebasedTransform,positions){this.done.rebased(newMaps,rebasedTransform,positions),this.undone.rebased(newMaps,rebasedTransform,positions),this.maybeScheduleCompression()}},{key:"maybeScheduleCompression",value:function(){this.maybeScheduleCompressionForBranch(this.done),this.maybeScheduleCompressionForBranch(this.undone)}},{key:"maybeScheduleCompressionForBranch",value:function(branch){var _this4=this;window.clearTimeout(branch.compressTimeout),branch.needsCompression()&&(branch.compressTimeout=window.setTimeout(function(){branch.needsCompression()&&branch.startCompression(_this4.pm.doc)},compressDelay))}},{key:"undoDepth",get:function(){return this.done.events.length}},{key:"redoDepth",get:function(){return this.undone.events.length}}]),History}()},{"../model":34,"../transform":40}],11:[function(require,module,exports){"use strict";function _interopRequireDefault(obj){return obj&&obj.__esModule?obj:{"default":obj}}Object.defineProperty(exports,"__esModule",{value:!0}),exports.Keymap=exports.baseCommands=exports.Command=exports.CommandSet=exports.MarkedRange=exports.NodeSelection=exports.TextSelection=exports.Selection=exports.SelectionError=exports.defineOption=exports.ProseMirror=void 0;var _main=require("./main");Object.defineProperty(exports,"ProseMirror",{enumerable:!0,get:function(){return _main.ProseMirror}});var _options=require("./options");Object.defineProperty(exports,"defineOption",{enumerable:!0,get:function(){return _options.defineOption}});var _selection=require("./selection");Object.defineProperty(exports,"SelectionError",{enumerable:!0,get:function(){return _selection.SelectionError}}),Object.defineProperty(exports,"Selection",{ -enumerable:!0,get:function(){return _selection.Selection}}),Object.defineProperty(exports,"TextSelection",{enumerable:!0,get:function(){return _selection.TextSelection}}),Object.defineProperty(exports,"NodeSelection",{enumerable:!0,get:function(){return _selection.NodeSelection}});var _range=require("./range");Object.defineProperty(exports,"MarkedRange",{enumerable:!0,get:function(){return _range.MarkedRange}});var _command=require("./command");Object.defineProperty(exports,"CommandSet",{enumerable:!0,get:function(){return _command.CommandSet}}),Object.defineProperty(exports,"Command",{enumerable:!0,get:function(){return _command.Command}});var _base_commands=require("./base_commands");Object.defineProperty(exports,"baseCommands",{enumerable:!0,get:function(){return _base_commands.baseCommands}}),require("./schema_commands");var _browserkeymap=require("browserkeymap"),_browserkeymap2=_interopRequireDefault(_browserkeymap);exports.Keymap=_browserkeymap2["default"]},{"./base_commands":2,"./command":5,"./main":13,"./options":14,"./range":15,"./schema_commands":16,"./selection":17,browserkeymap:57}],12:[function(require,module,exports){"use strict";function _interopRequireDefault(obj){return obj&&obj.__esModule?obj:{"default":obj}}function _classCallCheck(instance,Constructor){if(!(instance instanceof Constructor))throw new TypeError("Cannot call a class as a function")}function dispatchKey(pm,name,e){var seq=pm.input.keySeq;if(seq){if(_browserkeymap2["default"].isModifierKey(name))return!0;clearTimeout(stopSeq),stopSeq=setTimeout(function(){pm.input.keySeq==seq&&(pm.input.keySeq=null)},50),name=seq+" "+name}for(var handle=function handle(bound){if(bound===!1)return"nothing";if("..."==bound)return"multi";if(null==bound)return!1;var result=!1;if(Array.isArray(bound))for(var i=0;result===!1&&i=from.depth&&0==pos.shorten(from.depth).cmp(from)){if(0==from.depth)return pm.sel.fastPoll();pos=from.shorten()}pm.setNodeSelection(pos),pm.focus(),e.preventDefault()}function handleTripleClick(pm,e){e.preventDefault();var pos=(0,_dompos.selectableNodeAbove)(pm,e.target,{left:e.clientX,top:e.clientY},!0);if(pos){var node=pm.doc.nodeAfter(pos);if(node.isBlock&&!node.isTextblock)pm.setNodeSelection(pos);else{var path=node.isInline?pos.path:pos.toPath();node.isInline&&(node=pm.doc.path(path)),pm.setTextSelection(new _model.Pos(path,0),new _model.Pos(path,node.size))}pm.focus()}}function finishComposing(pm){var info=pm.input.composing,text=(0,_domchange.textInContext)(info.context,info.endData),range=(0,_selection.rangeFromDOMLoose)(pm);pm.ensureOperation(),pm.input.composing=null,text!=info.data&&inputText(pm,info.range,text),range&&!range.eq(pm.sel.range)&&pm.setSelectionDirect(range)}function toClipboard(doc,from,to,dataTransfer){for(var found=void 0,max=Math.min(from.depth,to.depth),depth=0,node=doc.sliceBetween(from,to);max>=depth&&(node.type.defaultAttrs&&(found={depth:depth,node:node}),!(node.size>1));depth++)node=node.firstChild;var attr=found.node.type.name+" "+(from.depth-found.depth)+" "+(to.depth-found.depth),html='
'+(0,_format.toHTML)(found.node)+"
";dataTransfer.clearData(),dataTransfer.setData("text/html",html),dataTransfer.setData("text/plain",(0,_format.toText)(found.node))}function fromClipboard(pm,dataTransfer,plainText){var txt=dataTransfer.getData("text/plain"),html=dataTransfer.getData("text/html");if(!html&&!txt)return null;var doc=void 0,from=void 0,to=void 0;if(!plainText&&html||!txt){var dom=document.createElement("div");dom.innerHTML=pm.signalPipelined("transformPastedHTML",html);var wrap=dom.querySelector("[pm-context]"),context=void 0,contextNode=void 0,found=void 0;if(wrap&&(context=/^(\w+) (\d+) (\d+)$/.exec(wrap.getAttribute("pm-context")))&&(contextNode=pm.schema.nodes[context[1]])&&contextNode.defaultAttrs&&(found=parseFromContext(wrap,contextNode,+context[2],+context[3]))){var _found=found;doc=_found.doc,from=_found.from,to=_found.to}else doc=(0,_format.fromDOM)(pm.schema,dom)}else doc=(0,_format.parseFrom)(pm.schema,pm.signalPipelined("transformPastedText",txt),"text");return{doc:doc,from:from||(0,_selection.findSelectionAtStart)(doc).from,to:to||(0,_selection.findSelectionAtEnd)(doc).to}}function posAtLeft(doc,depth){for(var path=[],i=0,node=doc;depth>i&&(node=node.firstChild);i++)path.push(0);return new _model.Pos(path,0)}function posAtRight(doc,depth){for(var path=[],node=doc,i=0;depth>i&&node.size;i++)path.push(node.size-1),node=node.lastChild;return new _model.Pos(path,node.size)}function parseFromContext(dom,contextNode,openLeft,openRight){var schema=contextNode.schema,top=schema.nodes.doc,doc=(0,_format.fromDOM)(schema,dom,{topNode:contextNode.create(),preserveWhitespace:!0});if(contextNode!=top){var path=top.findConnection(contextNode);if(!path)return null;for(var i=path.length-1;i>=-1;i--)doc=(0>i?top:path[i]).create(null,doc),++openLeft,++openRight}return{doc:doc,from:posAtLeft(doc,openLeft),to:posAtRight(doc,openRight)}}var _createClass=function(){function defineProperties(target,props){for(var i=0;inow-lastClick,tripleClick=600>now-oneButLastClick;oneButLastClick=lastClick,lastClick=now,tripleClick?handleTripleClick(pm,e):doubleClick&&(0,_dompos.handleNodeClick)(pm,"handleDoubleClick",e,!0)||(pm.input.mouseDown=new MouseDown(pm,e,doubleClick))};var MouseDown=function(){function MouseDown(pm,event,doubleClick){_classCallCheck(this,MouseDown),this.pm=pm,this.event=event,this.leaveToBrowser=pm.input.shiftKey||doubleClick;var path=(0,_dompos.pathFromDOM)(pm,event.target),node=pm.doc.path(path);this.mightDrag=node.type.draggable||node==pm.sel.range.node?path:null,this.mightDrag&&(event.target.draggable=!0,_dom.browser.gecko&&(this.setContentEditable=!event.target.hasAttribute("contentEditable"))&&event.target.setAttribute("contentEditable","false")),this.x=event.clientX,this.y=event.clientY,window.addEventListener("mouseup",this.up=this.up.bind(this)),window.addEventListener("mousemove",this.move=this.move.bind(this)),pm.sel.fastPoll()}return _createClass(MouseDown,[{key:"done",value:function(){window.removeEventListener("mouseup",this.up),window.removeEventListener("mousemove",this.move),this.mightDrag&&(this.event.target.draggable=!1,_dom.browser.gecko&&this.setContentEditable&&this.event.target.removeAttribute("contentEditable"))}},{key:"up",value:function(event){if(this.done(),this.leaveToBrowser||!(0,_dom.contains)(this.pm.content,event.target))this.pm.sel.fastPoll();else if(this.event.ctrlKey)selectClickedNode(this.pm,event);else if(!(0,_dompos.handleNodeClick)(this.pm,"handleClick",event,!0)){var pos=(0,_dompos.selectableNodeAbove)(this.pm,event.target,{left:this.x,top:this.y});pos?(this.pm.setNodeSelection(pos),this.pm.focus()):this.pm.sel.fastPoll()}}},{key:"move",value:function(event){!this.leaveToBrowser&&(Math.abs(this.x-event.clientX)>4||Math.abs(this.y-event.clientY)>4)&&(this.leaveToBrowser=!0),this.pm.sel.fastPoll()}}]),MouseDown}();handlers.touchdown=function(pm){pm.sel.fastPoll()},handlers.contextmenu=function(pm,e){(0,_dompos.handleNodeClick)(pm,"handleContextMenu",e,!1)};var Composing=function Composing(pm,data){_classCallCheck(this,Composing),this.finished=!1,this.context=(0,_domchange.textContext)(data),this.data=data,this.endData=null;var range=pm.selection;if(data){var path=range.head.path,line=pm.doc.path(path).textContent,found=line.indexOf(data,range.head.offset-data.length);found>-1&&found<=range.head.offset+data.length&&(range=new _selection.TextSelection(new _model.Pos(path,found),new _model.Pos(path,found+data.length)))}this.range=range};handlers.compositionstart=function(pm,e){if((0,_selection.hasFocus)(pm)&&!pm.input.maybeAbortComposition()){pm.flush(),pm.input.composing=new Composing(pm,e.data);var above=pm.selection.head.shorten();pm.markRangeDirty({from:above,to:above.move(1)})}},handlers.compositionupdate=function(pm,e){if((0,_selection.hasFocus)(pm)){var info=pm.input.composing;info&&info.data!=e.data&&(info.data=e.data,pm.input.updatingComposition=!0,inputText(pm,info.range,info.data),pm.input.updatingComposition=!1,info.range=new _selection.TextSelection(info.range.from,info.range.from.move(info.data.length)))}},handlers.compositionend=function(pm,e){if((0,_selection.hasFocus)(pm)){var info=pm.input.composing;info&&(pm.input.composing.finished=!0,pm.input.composing.endData=e.data,setTimeout(function(){pm.input.composing==info&&finishComposing(pm)},20))}},handlers.input=function(pm){if((0,_selection.hasFocus)(pm)){if(pm.input.skipInput)return--pm.input.skipInput;if(pm.input.composing)return void(pm.input.composing.finished&&finishComposing(pm));pm.startOperation({readSelection:!1}),(0,_domchange.applyDOMChange)(pm),pm.scrollIntoView()}},handlers.copy=handlers.cut=function(pm,e){var _pm$selection2=pm.selection,from=_pm$selection2.from,to=_pm$selection2.to,empty=_pm$selection2.empty;!empty&&e.clipboardData&&(toClipboard(pm.doc,from,to,e.clipboardData),e.preventDefault(),"cut"!=e.type||empty||pm.tr["delete"](from,to).apply())},handlers.paste=function(pm,e){if((0,_selection.hasFocus)(pm)&&e.clipboardData){var sel=pm.selection,fragment=fromClipboard(pm,e.clipboardData,pm.input.shiftKey);fragment&&(e.preventDefault(),pm.tr.replace(sel.from,sel.to,fragment.doc,fragment.from,fragment.to).apply(),pm.scrollIntoView())}},handlers.dragstart=function(pm,e){var mouseDown=pm.input.mouseDown;if(mouseDown&&mouseDown.done(),e.dataTransfer){var _pm$selection3=pm.selection,from=_pm$selection3.from,to=_pm$selection3.to,empty=_pm$selection3.empty,fragment=void 0,pos=!empty&&pm.posAtCoords({left:e.clientX,top:e.clientY});if(pos&&pos.cmp(from)>=0&&pos.cmp(to)<=0)fragment={from:from,to:to};else if(mouseDown&&mouseDown.mightDrag){var _pos=_model.Pos.from(mouseDown.mightDrag);fragment={from:_pos,to:_pos.move(1)}}fragment&&(pm.input.draggingFrom=fragment,toClipboard(pm.doc,fragment.from,fragment.to,e.dataTransfer))}},handlers.dragend=function(pm){return window.setTimeout(function(){return pm.input.draggingFrom=!1},50)},handlers.dragover=handlers.dragenter=function(pm,e){e.preventDefault();var cursorPos=pm.posAtCoords({left:e.clientX,top:e.clientY});if(cursorPos){var coords=(0,_dompos.coordsAtPos)(pm,cursorPos),rect=pm.wrapper.getBoundingClientRect();coords.top-=rect.top,coords.right-=rect.left,coords.bottom-=rect.top,coords.left-=rect.left;var target=pm.input.dropTarget;target.style.display="block",target.style.left=coords.left-1+"px",target.style.top=coords.top+"px",target.style.height=coords.bottom-coords.top+"px"}},handlers.dragleave=function(pm){return pm.input.dropTarget.style.display=""},handlers.drop=function(pm,e){if(pm.input.dropTarget.style.display="",e.dataTransfer&&!pm.signalDOM(e)){var fragment=fromClipboard(pm,e.dataTransfer);if(fragment){e.preventDefault();var insertPos=pm.posAtCoords({left:e.clientX,top:e.clientY}),df=pm.input.draggingFrom,node=pm.doc.path(df.from.path.concat(df.from.offset));if(node.type.draggable&&node.type.getDropPos&&(insertPos=node.type.getDropPos(pm,df.from,insertPos)),!insertPos)return;var origPos=insertPos,tr=pm.tr;pm.input.draggingFrom&&!e.ctrlKey&&(tr["delete"](pm.input.draggingFrom.from,pm.input.draggingFrom.to),insertPos=tr.map(insertPos).pos),tr.replace(insertPos,insertPos,fragment.doc,fragment.from,fragment.to).apply();var posAfter=tr.map(origPos).pos;_model.Pos.samePath(insertPos.path,posAfter.path)&&posAfter.offset==insertPos.offset+1&&pm.doc.nodeAfter(insertPos).type.selectable?pm.setNodeSelection(insertPos):pm.setTextSelection(insertPos,posAfter),pm.focus()}}},handlers.focus=function(pm){pm.wrapper.classList.add("ProseMirror-focused"),pm.signal("focus")},handlers.blur=function(pm){pm.wrapper.classList.remove("ProseMirror-focused"),pm.signal("blur")}},{"../dom":1,"../format":20,"../model":34,"./capturekeys":3,"./domchange":7,"./dompos":8,"./selection":17,browserkeymap:57}],13:[function(require,module,exports){"use strict";function _interopRequireDefault(obj){return obj&&obj.__esModule?obj:{"default":obj}}function _possibleConstructorReturn(self,call){if(!self)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return!call||"object"!=typeof call&&"function"!=typeof call?self:call}function _inherits(subClass,superClass){if("function"!=typeof superClass&&null!==superClass)throw new TypeError("Super expression must either be null or a function, not "+typeof superClass);subClass.prototype=Object.create(superClass&&superClass.prototype,{constructor:{value:subClass,enumerable:!1,writable:!0,configurable:!0}}),superClass&&(Object.setPrototypeOf?Object.setPrototypeOf(subClass,superClass):subClass.__proto__=superClass)}function _classCallCheck(instance,Constructor){if(!(instance instanceof Constructor))throw new TypeError("Cannot call a class as a function")}var _createClass=function(){function defineProperties(target,props){for(var i=0;i=parent.size)throw new _selection2.SelectionError("Trying to set a node selection at the end of a node");var node=parent.child(pos.offset);if(!node.type.selectable)throw new _selection2.SelectionError("Trying to select a non-selectable node");this.input.maybeAbortComposition(),this.sel.setAndSignal(new _selection2.NodeSelection(pos,pos.move(1),node))}},{key:"setSelection",value:function(selection){selection instanceof _selection2.TextSelection?(this.checkPos(selection.head,!0),selection.empty||this.checkPos(selection.anchor,!0)):this.checkPos(selection.to,!1),this.setSelectionDirect(selection)}},{key:"setSelectionDirect",value:function(selection){this.ensureOperation(),this.input.maybeAbortComposition(),selection.eq(this.sel.range)||this.sel.setAndSignal(selection)}},{key:"setContent",value:function(value,format){format&&(value=(0,_format.parseFrom)(this.schema,value,format)),this.setDoc(value)}},{key:"getContent",value:function(format){return format?(0,_format.serializeTo)(this.doc,format):this.doc}},{key:"setDocInner",value:function(doc){if(doc.type!=this.schema.nodes.doc)throw new _error.AssertionError("Trying to set a document with a different schema");this.doc=doc,this.ranges=new _range.RangeStore(this),this.history=new _history.History(this)}},{key:"setDoc",value:function(doc,sel){sel||(sel=(0,_selection2.findSelectionAtStart)(doc)),this.signal("beforeSetDoc",doc,sel),this.ensureOperation(),this.setDocInner(doc),this.sel.set(sel,!0),this.signal("setDoc",doc,sel)}},{key:"updateDoc",value:function(doc,mapping,selection){this.ensureOperation(),this.input.maybeAbortComposition(),this.ranges.transform(mapping),this.doc=doc,this.sel.setAndSignal(selection||this.sel.range.map(doc,mapping)),this.signal("change")}},{key:"apply",value:function(transform){var options=arguments.length<=1||void 0===arguments[1]?nullOptions:arguments[1];if(transform.doc==this.doc)return!1;if(transform.docs[0]!=this.doc&&(0,_model.findDiffStart)(transform.docs[0],this.doc))throw new _error.AssertionError("Applying a transform that does not start with the current document");if(options.filter!==!1&&this.signalHandleable("filterTransform",transform))return!1;var selectionBeforeTransform=this.selection;return this.signal("beforeTransform",transform,options),this.updateDoc(transform.doc,transform,options.selection),this.signal("transform",transform,selectionBeforeTransform,options),options.scrollIntoView&&this.scrollIntoView(),transform}},{key:"checkPos",value:function(pos,textblock){if(!pos.isValid(this.doc,textblock))throw new _error.AssertionError("Position "+pos+" is not valid in current document")}},{key:"ensureOperation",value:function(options){return this.operation||this.startOperation(options)}},{key:"startOperation",value:function(options){var _this=this;return this.operation=new Operation(this),options&&options.readSelection===!1||!this.sel.readFromDOM()||(this.operation.sel=this.sel.range),this.flushScheduled||((0,_dom.requestAnimationFrame)(function(){_this.flushScheduled=!1,_this.flush()}),this.flushScheduled=!0),this.operation}},{key:"flush",value:function(){if(document.body.contains(this.wrapper)&&this.operation){this.signal("flushing");var op=this.operation;if(op){this.operation=null,this.accurateSelection=!0;var docChanged=op.doc!=this.doc||this.dirtyNodes.size,redrawn=!1;this.input.composing||!docChanged&&!op.composingAtStart||((0,_draw.redraw)(this,this.dirtyNodes,this.doc,op.doc),this.dirtyNodes.clear(),redrawn=!0),((redrawn||!op.sel.eq(this.sel.range))&&!this.input.composing||op.focus)&&this.sel.toDOM(op.focus),op.scrollIntoView!==!1&&(0,_dompos.scrollIntoView)(this,op.scrollIntoView),docChanged&&this.signal("draw"),this.signal("flush"),this.accurateSelection=!1}}}},{key:"addKeymap",value:function(map){var rank=arguments.length<=1||void 0===arguments[1]?50:arguments[1];(0,_sortedinsert2["default"])(this.input.keymaps,{map:map,rank:rank},function(a,b){return a.rank-b.rank})}},{key:"removeKeymap",value:function(map){for(var maps=this.input.keymaps,i=0;i-1:deflt==name)return this.commandKeys[name]=key}for(var _key in keymap.bindings){var bound=keymap.bindings[_key];if(Array.isArray(bound)?bound.indexOf(name)>-1:bound==name)return this.commandKeys[name]=_key}return this.commandKeys[name]=null}},{key:"markRangeDirty",value:function(range){this.ensureOperation();for(var dirty=this.dirtyNodes,from=range.from,to=range.to,depth=0,node=this.doc;;depth++){var fromEnd=depth==from.depth,toEnd=depth==to.depth;if(fromEnd||toEnd||from.path[depth]!=to.path[depth]){var _ret=function(){var start=fromEnd?from.offset:from.path[depth],end=toEnd?to.offset:to.path[depth]+1;if(node.isTextblock)node.forEach(function(child,cStart,cEnd){end>cStart&&cEnd>start&&dirty.set(child,DIRTY_REDRAW)});else for(var child,i=node.iter(start,end);child=i.next().value;)dirty.set(child,DIRTY_REDRAW);return"break"}();if("break"===_ret)break}else{var child=node.child(from.path[depth]);dirty.has(child)||dirty.set(child,DIRTY_RESCAN),node=child}}}},{key:"markAllDirty",value:function(){this.dirtyNodes.set(this.doc,DIRTY_REDRAW)}},{key:"translate",value:function(string){var trans=this.options.translate;return trans?trans(string):string}},{key:"selection",get:function(){return this.accurateSelection||this.ensureOperation(),this.sel.range}},{key:"tr",get:function(){return new EditorTransform(this)}}]),ProseMirror}();ProseMirror.prototype.apply.scroll={scrollIntoView:!0};var DIRTY_RESCAN=exports.DIRTY_RESCAN=1,DIRTY_REDRAW=exports.DIRTY_REDRAW=2,nullOptions={};(0,_event.eventMixin)(ProseMirror);var Operation=function Operation(pm){_classCallCheck(this,Operation),this.doc=pm.doc,this.sel=pm.sel.range,this.scrollIntoView=!1,this.focus=!1,this.composingAtStart=!!pm.input.composing},EditorTransform=function(_Transform){function EditorTransform(pm){_classCallCheck(this,EditorTransform);var _this2=_possibleConstructorReturn(this,Object.getPrototypeOf(EditorTransform).call(this,pm.doc));return _this2.pm=pm,_this2}return _inherits(EditorTransform,_Transform),_createClass(EditorTransform,[{key:"apply",value:function(options){return this.pm.apply(this,options)}},{key:"replaceSelection",value:function(node,inheritMarks){var _selection=this.selection,empty=_selection.empty,from=_selection.from,to=_selection.to,selNode=_selection.node,parent=void 0;if(node&&node.isInline&&inheritMarks!==!1){var marks=empty?this.pm.input.storedMarks:this.doc.marksAt(from);node=node.type.create(node.attrs,node.text,marks)}if(selNode&&selNode.isTextblock&&node&&node.isInline)from=new _model.Pos(from.toPath(),0),to=new _model.Pos(from.path,selNode.size);else if(selNode)for(;from.depth&&0==from.offset&&(parent=this.doc.path(from.path))&&from.offset==parent.size-1&&!parent.type.canBeEmpty&&(!node||!parent.type.canContain(node));)from=from.shorten(),to=to.shorten(null,1);else if(node&&node.isBlock&&this.doc.path(from.path.slice(0,from.depth-1)).type.canContain(node)){this["delete"](from,to);var _parent=this.doc.path(from.path);return from.offset&&from.offset!=_parent.size&&this.split(from),this.insert(from.shorten(null,from.offset?1:0),node)}return node?this.replaceWith(from,to,node):this["delete"](from,to)}},{key:"deleteSelection",value:function(){return this.replaceSelection()}},{key:"typeText",value:function(text){return this.replaceSelection(this.pm.schema.text(text),!0)}},{key:"selection",get:function(){return this.steps.length?this.pm.selection.map(this):this.pm.selection}}]),EditorTransform}(_transform.Transform)},{"../dom":1,"../format":20,"../model":34,"../transform":40,"../util/error":52,"../util/event":53,"../util/map":54,"../util/sortedinsert":56,"./css":6,"./dompos":8,"./draw":9,"./history":10,"./input":12,"./options":14,"./range":15,"./selection":17,browserkeymap:57}],14:[function(require,module,exports){"use strict";function _classCallCheck(instance,Constructor){if(!(instance instanceof Constructor))throw new TypeError("Cannot call a class as a function")}function defineOption(name,defaultValue,update,updateOnInit){options[name]=new Option(defaultValue,update,updateOnInit)}function parseOptions(obj){var result=Object.create(null),given=obj?[obj].concat(obj.use||[]):[];outer:for(var opt in options){for(var i=0;imax){for(var i=min;max>i;i++)if(this.sorted[i].at.cmp(at)>=0)return i;return max}var mid=min+max>>1;this.sorted[mid].at.cmp(at)>0?max=mid:min=mid}}},{key:"insert",value:function(obj){this.sorted.splice(this.find(obj.at),0,obj)}},{key:"remove",value:function(at,range){for(var pos=this.find(at),dist=0;;dist++){var leftPos=pos-dist-1,rightPos=pos+dist;if(leftPos>=0&&this.sorted[leftPos].range==range)return void this.sorted.splice(leftPos,1);if(rightPos0&&this.sorted[pos-1].at.cmp(at)>0;)this.sorted[pos]=this.sorted[pos-1],this.sorted[--pos]=cur}}]),RangeSorter}(),RangeTracker=(exports.RangeStore=function(){function RangeStore(pm){_classCallCheck(this,RangeStore),this.pm=pm,this.ranges=[],this.sorted=new RangeSorter}return _createClass(RangeStore,[{key:"addRange",value:function(range){this.ranges.push(range),this.sorted.insert({type:"open",at:range.from,range:range}),this.sorted.insert({type:"close",at:range.to,range:range}),this.pm.markRangeDirty(range)}},{key:"removeRange",value:function(range){var found=this.ranges.indexOf(range);found>-1&&(this.ranges.splice(found,1),this.sorted.remove(range.from,range),this.sorted.remove(range.to,range),this.pm.markRangeDirty(range),range.remove())}},{key:"transform",value:function(mapping){for(var i=0;i=0?(this.removeRange(range),i--):diff>0&&(range.to=range.from)}this.sorted.resort()}},{key:"activeRangeTracker",value:function(){return new RangeTracker(this.sorted.sorted)}}]),RangeStore}(),function(){function RangeTracker(sorted){_classCallCheck(this,RangeTracker),this.sorted=sorted,this.pos=0,this.current=[]}return _createClass(RangeTracker,[{key:"advanceTo",value:function(pos){for(var next=void 0;this.pos=0?null:next.at.offset;this.pos++}}}]),RangeTracker}())},{"../util/event":53}],16:[function(require,module,exports){"use strict";var _model=require("../model"),_command=require("./command"),_format=require("../format");_model.StrongMark.register("command","set",{derive:!0,label:"Set strong"}),_model.StrongMark.register("command","unset",{derive:!0,label:"Unset strong"}),_model.StrongMark.register("command","toggle",{derive:!0,label:"Toggle strong",menu:{group:"inline",rank:20,display:{type:"icon",width:805,height:1024,path:"M317 869q42 18 80 18 214 0 214-191 0-65-23-102-15-25-35-42t-38-26-46-14-48-6-54-1q-41 0-57 5 0 30-0 90t-0 90q0 4-0 38t-0 55 2 47 6 38zM309 442q24 4 62 4 46 0 81-7t62-25 42-51 14-81q0-40-16-70t-45-46-61-24-70-8q-28 0-74 7 0 28 2 86t2 86q0 15-0 45t-0 45q0 26 0 39zM0 950l1-53q8-2 48-9t60-15q4-6 7-15t4-19 3-18 1-21 0-19v-37q0-561-12-585-2-4-12-8t-25-6-28-4-27-2-17-1l-2-47q56-1 194-6t213-5q13 0 39 0t38 0q40 0 78 7t73 24 61 40 42 59 16 78q0 29-9 54t-22 41-36 32-41 25-48 22q88 20 146 76t58 141q0 57-20 102t-53 74-78 48-93 27-100 8q-25 0-75-1t-75-1q-60 0-175 6t-132 6z"}},keys:["Mod-B"]}),_model.EmMark.register("command","set",{derive:!0,label:"Add emphasis"}),_model.EmMark.register("command","unset",{derive:!0,label:"Remove emphasis"}),_model.EmMark.register("command","toggle",{derive:!0,label:"Toggle emphasis",menu:{group:"inline",rank:21,display:{type:"icon",width:585,height:1024,path:"M0 949l9-48q3-1 46-12t63-21q16-20 23-57 0-4 35-165t65-310 29-169v-14q-13-7-31-10t-39-4-33-3l10-58q18 1 68 3t85 4 68 1q27 0 56-1t69-4 56-3q-2 22-10 50-17 5-58 16t-62 19q-4 10-8 24t-5 22-4 26-3 24q-15 84-50 239t-44 203q-1 5-7 33t-11 51-9 47-3 32l0 10q9 2 105 17-1 25-9 56-6 0-18 0t-18 0q-16 0-49-5t-49-5q-78-1-117-1-29 0-81 5t-69 6z"}},keys:["Mod-I"]}),_model.CodeMark.register("command","set",{derive:!0,label:"Set code style"}),_model.CodeMark.register("command","unset",{derive:!0,label:"Remove code style"}),_model.CodeMark.register("command","toggle",{derive:!0,label:"Toggle code style",menu:{group:"inline",rank:22,display:{type:"icon",width:896,height:1024,path:"M608 192l-96 96 224 224-224 224 96 96 288-320-288-320zM288 192l-288 320 288 320 96-96-224-224 224-224-96-96z"}},keys:["Mod-`"]});var linkIcon={type:"icon",width:951,height:1024,path:"M832 694q0-22-16-38l-118-118q-16-16-38-16-24 0-41 18 1 1 10 10t12 12 8 10 7 14 2 15q0 22-16 38t-38 16q-8 0-15-2t-14-7-10-8-12-12-10-10q-18 17-18 41 0 22 16 38l117 118q15 15 38 15 22 0 38-14l84-83q16-16 16-38zM430 292q0-22-16-38l-117-118q-16-16-38-16-22 0-38 15l-84 83q-16 16-16 38 0 22 16 38l118 118q15 15 38 15 24 0 41-17-1-1-10-10t-12-12-8-10-7-14-2-15q0-22 16-38t38-16q8 0 15 2t14 7 10 8 12 12 10 10q18-17 18-41zM941 694q0 68-48 116l-84 83q-47 47-116 47-69 0-116-48l-117-118q-47-47-47-116 0-70 50-119l-50-50q-49 50-118 50-68 0-116-48l-118-118q-48-48-48-116t48-116l84-83q47-47 116-47 69 0 116 48l117 118q47 47 47 116 0 70-50 119l50 50q49-50 118-50 68 0 116 48l118 118q48 48 48 116z"};_model.LinkMark.register("command","unset",{derive:!0,label:"Unlink",menu:{group:"inline",rank:30,display:linkIcon},active:function(){return!0}}),_model.LinkMark.register("command","set",{derive:{inverseSelect:!0,params:[{label:"Target",attr:"href"},{label:"Title",attr:"title"}]},label:"Add link",menu:{group:"inline",rank:30,display:linkIcon}}),_model.Image.register("command","insert",{derive:{params:[{label:"Image URL",attr:"src"},{label:"Description / alternative text",attr:"alt",prefill:function(pm){return(0,_command.selectedNodeAttr)(pm,this,"alt")||(0,_format.toText)(pm.doc.sliceBetween(pm.selection.from,pm.selection.to))}},{label:"Title",attr:"title"}]},label:"Insert image",menu:{group:"insert",rank:20,display:{type:"label",label:"Image"}}}),_model.BulletList.register("command","wrap",{derive:{list:!0},label:"Wrap the selection in a bullet list",menu:{group:"block",rank:40,display:{type:"icon",width:768,height:896,path:"M0 512h128v-128h-128v128zM0 256h128v-128h-128v128zM0 768h128v-128h-128v128zM256 512h512v-128h-512v128zM256 256h512v-128h-512v128zM256 768h512v-128h-512v128z"}},keys:["Alt-Right '*'","Alt-Right '-'"]}),_model.OrderedList.register("command","wrap",{derive:{list:!0},label:"Wrap the selection in an ordered list",menu:{group:"block",rank:41,display:{type:"icon",width:768,height:896,path:"M320 512h448v-128h-448v128zM320 768h448v-128h-448v128zM320 128v128h448v-128h-448zM79 384h78v-256h-36l-85 23v50l43-2v185zM189 590c0-36-12-78-96-78-33 0-64 6-83 16l1 66c21-10 42-15 67-15s32 11 32 28c0 26-30 58-110 112v50h192v-67l-91 2c49-30 87-66 87-113l1-1z"}},keys:["Alt-Right '1'"]}),_model.BlockQuote.register("command","wrap",{derive:!0,label:"Wrap the selection in a block quote",menu:{group:"block",rank:45,display:{type:"icon",width:640,height:896,path:"M0 448v256h256v-256h-128c0 0 0-128 128-128v-128c0 0-256 0-256 256zM640 320v-128c0 0-256 0-256 256v256h256v-256h-128c0 0 0-128 128-128z"}},keys:["Alt-Right '>'","Alt-Right '\"'"]}),_model.HardBreak.register("command","insert",{label:"Insert hard break",run:function(pm){var _pm$selection=pm.selection,node=_pm$selection.node,from=_pm$selection.from;return node&&node.isBlock?!1:pm.doc.path(from.path).type.isCode?pm.tr.typeText("\n").apply(pm.apply.scroll):pm.tr.replaceSelection(this.create()).apply(pm.apply.scroll)},keys:["Mod-Enter","Shift-Enter"]}),_model.ListItem.register("command","split",{label:"Split the current list item",run:function(pm){var _pm$selection2=pm.selection,from=_pm$selection2.from,to=_pm$selection2.to,node=_pm$selection2.node;if(node&&node.isBlock||from.path.length<2||!_model.Pos.samePath(from.path,to.path))return!1;var toParent=from.shorten(),grandParent=pm.doc.path(toParent.path);if(grandParent.type!=this)return!1;var nextType=to.offset==grandParent.child(toParent.offset).size?pm.schema.defaultTextblockType():null;return pm.tr["delete"](from,to).split(from,2,nextType).apply(pm.apply.scroll)},keys:["Enter(50)"]});for(var _loop=function(i){_model.Heading.registerComputed("command","make"+i,function(type){return i<=type.maxLevel?{derive:{name:"make",attrs:{level:i}},label:"Change to heading "+i,keys:10>i&&["Mod-"+i],menu:{group:"textblockHeading",rank:30+i,display:{type:"label",label:"Level "+i},activeDisplay:"Head "+i}}:void 0})},i=1;10>=i;i++)_loop(i);_model.Paragraph.register("command","make",{derive:!0,label:"Change to paragraph",keys:["Mod-0"],menu:{group:"textblock",rank:10,display:{type:"label",label:"Plain"},activeDisplay:"Plain"}}),_model.CodeBlock.register("command","make",{derive:!0,label:"Change to code block",keys:["Mod-\\"],menu:{group:"textblock",rank:20,display:{type:"label",label:"Code"},activeDisplay:"Code"}}),_model.HorizontalRule.register("command","insert",{derive:!0,label:"Insert horizontal rule",keys:["Mod-Shift--"],menu:{group:"insert",rank:70,display:{type:"label",label:"Horizontal rule"}}})},{"../format":20,"../model":34,"./command":5}],17:[function(require,module,exports){"use strict";function _classCallCheck(instance,Constructor){if(!(instance instanceof Constructor))throw new TypeError("Cannot call a class as a function")}function _possibleConstructorReturn(self,call){if(!self)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return!call||"object"!=typeof call&&"function"!=typeof call?self:call}function _inherits(subClass,superClass){if("function"!=typeof superClass&&null!==superClass)throw new TypeError("Super expression must either be null or a function, not "+typeof superClass);subClass.prototype=Object.create(superClass&&superClass.prototype,{constructor:{value:subClass,enumerable:!1,writable:!0,configurable:!0}}),superClass&&(Object.setPrototypeOf?Object.setPrototypeOf(subClass,superClass):subClass.__proto__=superClass)}function rangeFromDOMLoose(pm){if(!hasFocus(pm))return null;var sel=window.getSelection();return new TextSelection((0,_dompos.posFromDOM)(pm,sel.anchorNode,sel.anchorOffset,!0),(0,_dompos.posFromDOM)(pm,sel.focusNode,sel.focusOffset,!0))}function hasFocus(pm){if(document.activeElement!=pm.content)return!1;var sel=window.getSelection();return sel.rangeCount&&(0,_dom.contains)(pm.content,sel.anchorNode)}function findSelectionIn(doc,path,offset,dir,text){var node=doc.path(path);if(node.isTextblock)return new TextSelection(new _model.Pos(path,offset));for(var i=offset+(dir>0?0:-1);dir>0?i=0;i+=dir){var child=node.child(i);if(!text&&null==child.type.contains&&child.type.selectable)return new NodeSelection(new _model.Pos(path,i),new _model.Pos(path,i+1),child);path.push(i);var inside=findSelectionIn(doc,path,0>dir?child.size:0,dir,text);if(inside)return inside;path.pop()}}function findSelectionFrom(doc,pos,dir,text){for(var path=pos.path.slice(),offset=pos.offset;;){var found=findSelectionIn(doc,path,offset,dir,text);if(found)return found;if(!path.length)break;offset=path.pop()+(dir>0?1:0)}}function findSelectionNear(doc,pos){var bias=arguments.length<=2||void 0===arguments[2]?1:arguments[2],text=arguments[3],result=findSelectionFrom(doc,pos,bias,text)||findSelectionFrom(doc,pos,-bias,text);return result||SelectionError("Searching for selection in invalid document "+doc),result}function findSelectionAtStart(node){var path=arguments.length<=1||void 0===arguments[1]?[]:arguments[1],text=arguments[2];return findSelectionIn(node,path.slice(),0,1,text)}function findSelectionAtEnd(node){var path=arguments.length<=1||void 0===arguments[1]?[]:arguments[1],text=arguments[2];return findSelectionIn(node,path.slice(),node.size,-1,text)}function verticalMotionLeavesTextblock(pm,pos,dir){for(var dom=(0,_dompos.pathToDOM)(pm.content,pos.path),coords=(0,_dompos.coordsAtPos)(pm,pos),child=dom.firstChild;child;child=child.nextSibling)if(1==child.nodeType)for(var boxes=child.getClientRects(),i=0;idir?box.bottomcoords.bottom)return!1}return!0}var _createClass=function(){function defineProperties(target,props){for(var i=0;i0)){var inv=anchor.cmp(newRange.to)>0;newRange=new TextSelection(findSelectionNear(doc,anchor,inv?-1:1,!0).anchor,findSelectionNear(doc,inv?newRange.from:newRange.to,inv?1:-1,!0).head)}return this.setAndSignal(newRange),newRange instanceof NodeSelection||newRange.head.cmp(head)||newRange.anchor.cmp(anchor)?this.toDOM():(this.clearNode(),this.storeDOMState()),!0}},{key:"toDOM",value:function(takeFocus){if(!hasFocus(this.pm)){if(!takeFocus)return;_dom.browser.gecko&&this.pm.content.focus()}this.range instanceof NodeSelection?this.nodeToDOM():this.rangeToDOM()}},{key:"nodeToDOM",value:function(){var dom=(0,_dompos.pathToDOM)(this.pm.content,this.range.from.toPath());dom!=this.lastNode&&(this.clearNode(),dom.classList.add("ProseMirror-selectednode"),this.pm.content.classList.add("ProseMirror-nodeselection"),this.lastNode=dom);var range=document.createRange(),sel=window.getSelection();range.selectNode(dom),sel.removeAllRanges(),sel.addRange(range),this.storeDOMState()}},{key:"rangeToDOM",value:function(){this.clearNode();var anchor=(0,_dompos.DOMFromPos)(this.pm.content,this.range.anchor),head=(0,_dompos.DOMFromPos)(this.pm.content,this.range.head),sel=window.getSelection(),range=document.createRange();if(sel.extend)range.setEnd(anchor.node,anchor.offset),range.collapse(!1);else{if(this.range.anchor.cmp(this.range.head)>0){var tmp=anchor;anchor=head,head=tmp}range.setEnd(head.node,head.offset),range.setStart(anchor.node,anchor.offset)}sel.removeAllRanges(),sel.addRange(range),sel.extend&&sel.extend(head.node,head.offset),this.storeDOMState()}},{key:"clearNode",value:function(){return this.lastNode?(this.lastNode.classList.remove("ProseMirror-selectednode"),this.pm.content.classList.remove("ProseMirror-nodeselection"),this.lastNode=null,!0):void 0}},{key:"receivedFocus",value:function(){null==this.polling&&this.startPolling()}}]),SelectionState}(),exports.Selection=function Selection(){_classCallCheck(this,Selection)}),TextSelection=exports.TextSelection=function(_Selection){function TextSelection(anchor,head){_classCallCheck(this,TextSelection);var _this3=_possibleConstructorReturn(this,Object.getPrototypeOf(TextSelection).call(this));return _this3.anchor=anchor,_this3.head=head||anchor,_this3}return _inherits(TextSelection,_Selection),_createClass(TextSelection,[{key:"eq",value:function(other){return other instanceof TextSelection&&!other.head.cmp(this.head)&&!other.anchor.cmp(this.anchor)}},{key:"map",value:function(doc,mapping){var head=mapping.map(this.head).pos;if(!doc.path(head.path).isTextblock)return findSelectionNear(doc,head);var anchor=mapping.map(this.anchor).pos;return new TextSelection(doc.path(anchor.path).isTextblock?anchor:head,head)}},{key:"inverted",get:function(){return this.anchor.cmp(this.head)>0}},{key:"from",get:function(){return this.inverted?this.head:this.anchor}},{key:"to",get:function(){return this.inverted?this.anchor:this.head}},{key:"empty",get:function(){return 0==this.anchor.cmp(this.head)}}]),TextSelection}(Selection),NodeSelection=exports.NodeSelection=function(_Selection2){function NodeSelection(from,to,node){_classCallCheck(this,NodeSelection);var _this4=_possibleConstructorReturn(this,Object.getPrototypeOf(NodeSelection).call(this));return _this4.from=from,_this4.to=to,_this4.node=node,_this4}return _inherits(NodeSelection,_Selection2),_createClass(NodeSelection,[{key:"eq",value:function(other){return other instanceof NodeSelection&&!this.from.cmp(other.from)}},{key:"map",value:function(doc,mapping){var from=mapping.map(this.from,1).pos,to=mapping.map(this.to,-1).pos;if(_model.Pos.samePath(from.path,to.path)&&from.offset==to.offset-1){var node=doc.nodeAfter(from);if(node.type.selectable)return new NodeSelection(from,to,node)}return findSelectionNear(doc,from)}},{key:"empty",get:function(){return!1}}]),NodeSelection}(Selection)},{"../dom":1,"../model":34,"../util/error":52,"./dompos":8}],18:[function(require,module,exports){"use strict";function _interopRequireDefault(obj){return obj&&obj.__esModule?obj:{"default":obj}}function _classCallCheck(instance,Constructor){if(!(instance instanceof Constructor))throw new TypeError("Cannot call a class as a function")}function fromDOM(schema,dom,options){options||(options={});var context=new DOMParseState(schema,options.topNode||schema.node("doc"),options),start=options.from?dom.childNodes[options.from]:dom.firstChild,end=null!=options.to&&dom.childNodes[options.to]||null;context.addAll(start,end,!0);var doc=void 0;do doc=context.leave();while(context.stack.length);return doc}function fromHTML(schema,html,options){var wrap=(options&&options.document||window.document).createElement("div");return wrap.innerHTML=html,fromDOM(schema,wrap,options)}function matches(dom,selector){return(dom.matches||dom.msMatchesSelector||dom.webkitMatchesSelector||dom.mozMatchesSelector).call(dom,selector)}function parseStyles(style){for(var re=/\s*([\w-]+)\s*:\s*([^;]+)/g,m=void 0,result=[];m=re.exec(style);)result.push(m[1],m[2].trim());return result}function schemaInfo(schema){return schema.cached.parseDOMInfo||(schema.cached.parseDOMInfo=summarizeSchemaInfo(schema))}function summarizeSchemaInfo(schema){var tags=Object.create(null),styles=Object.create(null);return tags._=[],schema.registry("parseDOM",function(tag,info,type){var parse=info.parse;"block"==parse?parse=function(dom,state){state.wrapIn(dom,this)}:"mark"==parse&&(parse=function(dom,state){state.wrapMark(dom,this)}),(0,_sortedinsert2["default"])(tags[tag]||(tags[tag]=[]),{type:type,parse:parse,selector:info.selector,rank:null==info.rank?50:info.rank},function(a,b){return a.rank-b.rank})}),schema.registry("parseDOMStyle",function(style,info,type){(0,_sortedinsert2["default"])(styles[style]||(styles[style]=[]),{type:type,parse:info.parse,rank:null==info.rank?50:info.rank},function(a,b){return a.rank-b.rank})}),{tags:tags,styles:styles}}var _createClass=function(){function defineProperties(target,props){for(var i=0;i=0;i--){var route=this.stack[i].type.findConnection(node.type);if(route){if(i==this.stack.length-1)this.doClose();else for(;this.stack.length>i+1;)this.leave();found=route;break}}if(!found)return;for(var j=0;jstack.length;)this.leave();for(;;){var n=this.stack.length-1,one=this.stack[n],two=stack[n];if(one.type==two.type&&_model.Node.sameAttrs(one.attrs,two.attrs))break;this.leave()}for(;stack.length>this.stack.length;){var add=stack[this.stack.length];this.enter(add.type,add.attrs)}this.marks.length&&(this.marks=noMarks),this.closing=!1}},{key:"wrapIn",value:function(dom,type,attrs){this.enter(type,attrs),this.addAll(dom.firstChild,null,!0),this.leave()}},{key:"wrapMark",value:function(inner,mark){var old=this.marks;this.marks=(mark.instance||mark).addToSet(old),inner.call?inner():this.addAll(inner.firstChild,null),this.marks=old}},{key:"top",get:function(){return this.stack[this.stack.length-1]}}]),DOMParseState}();_model.Paragraph.register("parseDOM","p",{parse:"block"}),_model.BlockQuote.register("parseDOM","blockquote",{parse:"block"});for(var _loop=function(i){_model.Heading.registerComputed("parseDOM","h"+i,function(type){return i<=type.maxLevel?{parse:function(dom,state){state.wrapIn(dom,this,{level:i})}}:void 0})},i=1;6>=i;i++)_loop(i);_model.HorizontalRule.register("parseDOM","hr",{parse:"block"}),_model.CodeBlock.register("parseDOM","pre",{parse:function(dom,state){var params=dom.firstChild&&/^code$/i.test(dom.firstChild.nodeName)&&dom.firstChild.getAttribute("class");if(params&&/fence/.test(params)){for(var found=[],re=/(?:^|\s)lang-(\S+)/g,m=void 0;m=re.exec(params);)found.push(m[1]);params=found.join(" ")}else params=null;var text=dom.textContent;state.insert(this,{params:params},text?[state.schema.text(text)]:[])}}),_model.BulletList.register("parseDOM","ul",{parse:"block"}),_model.OrderedList.register("parseDOM","ol",{parse:function(dom,state){var attrs={order:dom.getAttribute("start")||1};state.wrapIn(dom,this,attrs)}}),_model.ListItem.register("parseDOM","li",{parse:"block"}),_model.HardBreak.register("parseDOM","br",{parse:function(_,state){state.insert(this)}}),_model.Image.register("parseDOM","img",{parse:function(dom,state){state.insert(this,{src:dom.getAttribute("src"),title:dom.getAttribute("title")||null,alt:dom.getAttribute("alt")||null})}}),_model.LinkMark.register("parseDOM","a",{parse:function(dom,state){state.wrapMark(dom,this.create({href:dom.getAttribute("href"),title:dom.getAttribute("title")}))},selector:"[href]"}),_model.EmMark.register("parseDOM","i",{parse:"mark"}),_model.EmMark.register("parseDOM","em",{parse:"mark"}),_model.EmMark.register("parseDOMStyle","font-style",{parse:function(value,state,inner){"italic"==value?state.wrapMark(inner,this):inner()}}),_model.StrongMark.register("parseDOM","b",{parse:"mark"}),_model.StrongMark.register("parseDOM","strong",{parse:"mark"}),_model.StrongMark.register("parseDOMStyle","font-weight",{parse:function(value,state,inner){"bold"==value||"bolder"==value||!/\D/.test(value)&&+value>=500?state.wrapMark(inner,this):inner()}}),_model.CodeMark.register("parseDOM","code",{parse:"mark"})},{"../model":34,"../util/sortedinsert":56,"./register":21}],19:[function(require,module,exports){"use strict";function fromText(schema,text){for(var blocks=text.trim().split(/\n{2,}/),nodes=[],i=0;i2?_len-2:0),_key=2;_len>_key;_key++)content[_key-2]=arguments[_key];for(var i=0;i=0;i--){var wrap=this.renderMark(marks[i]);wrap.appendChild(dom),dom=wrap}return dom}},{key:"renderAs",value:function(node,tagName,tagAttrs){var dom=this.renderContent(node,this.elt(tagName,tagAttrs));return this.options.onContainer&&this.options.onContainer(dom),dom}}]),DOMSerializer}();(0,_register.defineTarget)("dom",toDOM),(0,_register.defineTarget)("html",toHTML),def(_model.BlockQuote,function(node,s){return s.renderAs(node,"blockquote")}),_model.BlockQuote.prototype.countCoordsAsChild=function(_,path,dom,coords){var childBox=dom.firstChild.getBoundingClientRect();return coords.leftchildBox.left-2)return null;if(childBox.top<=coords.top&&childBox.bottom>=coords.top)return new _model.Pos(path,i)}}},def(_model.ListItem,function(node,s){return s.renderAs(node,"li")}),def(_model.HorizontalRule,function(_,s){return s.elt("div",null,s.elt("hr"))}),def(_model.Paragraph,function(node,s){return s.renderAs(node,"p")}),def(_model.Heading,function(node,s){return s.renderAs(node,"h"+node.attrs.level)}),def(_model.CodeBlock,function(node,s){var code=s.renderAs(node,"code");return null!=node.attrs.params&&(code.className="fence "+node.attrs.params.replace(/(^|\s+)/g,"$&lang-")),s.elt("pre",null,code)}),def(_model.Text,function(node,s){return s.doc.createTextNode(node.text)}),def(_model.Image,function(node,s){return s.elt("img",{src:node.attrs.src,alt:node.attrs.alt,title:node.attrs.title})}),def(_model.HardBreak,function(_,s){return s.elt("br")}),def(_model.EmMark,function(_,s){return s.elt("em")}),def(_model.StrongMark,function(_,s){return s.elt("strong")}),def(_model.CodeMark,function(_,s){return s.elt("code")}),def(_model.LinkMark,function(mark,s){return s.elt("a",{href:mark.attrs.href,title:mark.attrs.title})})},{"../model":34,"./register":21}],23:[function(require,module,exports){"use strict";function toText(doc){return doc.type.serializeText(doc).trim()}Object.defineProperty(exports,"__esModule",{value:!0}),exports.toText=toText;var _model=require("../model"),_register=require("./register");_model.Block.prototype.serializeText=function(node){var accum="";return node.forEach(function(child){return accum+=child.type.serializeText(child)}),accum},_model.Textblock.prototype.serializeText=function(node){var text=_model.Block.prototype.serializeText(node);return text&&text+"\n\n"},_model.Inline.prototype.serializeText=function(){return""},_model.HardBreak.prototype.serializeText=function(){return"\n"},_model.Text.prototype.serializeText=function(node){return node.text},(0,_register.defineTarget)("text",toText)},{"../model":34,"./register":21}],24:[function(require,module,exports){"use strict";function wrapAndJoin(pm,pos,type){var attrs=arguments.length<=3||void 0===arguments[3]?null:arguments[3],predicate=arguments.length<=4||void 0===arguments[4]?null:arguments[4],before=pos.shorten(),sibling=before.offset>0&&pm.doc.path(before.path).child(before.offset-1),join=sibling&&sibling.type.name==type&&(!predicate||predicate(sibling)),tr=pm.tr.wrap(pos,pos,type,attrs),delPos=tr.map(pos).pos;tr["delete"](new _model.Pos(delPos.path,0),delPos),join&&tr.join(before),tr.apply()}function setAs(pm,pos,type,attrs){pm.tr.setBlockType(pos,pos,type,attrs)["delete"](new _model.Pos(pos.path,0),pos).apply()}Object.defineProperty(exports,"__esModule",{value:!0}),exports.autoInputRules=void 0;var _model=require("../model"),_edit=require("../edit"),_inputrules=require("./inputrules"),autoInputRules=exports.autoInputRules=Object.create(null);(0,_edit.defineOption)("autoInput",!1,function(pm,val){pm.mod.autoInput&&(pm.mod.autoInput.forEach(function(rule){return(0,_inputrules.removeInputRule)(pm,rule)}),pm.mod.autoInput=null),val&&!function(){val===!0&&(val=["schema",autoInputRules]);var rules=Object.create(null),list=pm.mod.autoInput=[];val.forEach(function(spec){if("schema"===spec)pm.schema.registry("autoInput",function(name,rule,type,typeName){var rname=typeName+":"+name,handler=rule.handler;handler.bind&&(handler=handler.bind(type)),rules[rname]=new _inputrules.InputRule(rule.match,rule.filter,handler)});else for(var name in spec){var _val=spec[name];null==_val?delete rules[name]:rules[name]=_val}});for(var name in rules)(0,_inputrules.addInputRule)(pm,rules[name]),list.push(rules[name])}()}),autoInputRules.emDash=new _inputrules.InputRule(/--$/,"-","—"),autoInputRules.openDoubleQuote=new _inputrules.InputRule(/(?:^|[\s\{\[\(\<'"\u2018\u201C])(")$/,'"',"“"),autoInputRules.closeDoubleQuote=new _inputrules.InputRule(/"$/,'"',"”"),autoInputRules.openSingleQuote=new _inputrules.InputRule(/(?:^|[\s\{\[\(\<'"\u2018\u201C])(')$/,"'","‘"),autoInputRules.closeSingleQuote=new _inputrules.InputRule(/'$/,"'","’"),_model.BlockQuote.register("autoInput","startBlockQuote",new _inputrules.InputRule(/^\s*> $/," ",function(pm,_,pos){wrapAndJoin(pm,pos,this)})),_model.OrderedList.register("autoInput","startOrderedList",new _inputrules.InputRule(/^(\d+)\. $/," ",function(pm,match,pos){var order=+match[1];wrapAndJoin(pm,pos,this,{order:order||null},function(node){return node.size+(node.attrs.order||1)==order})})),_model.BulletList.register("autoInput","startBulletList",new _inputrules.InputRule(/^\s*([-+*]) $/," ",function(pm,match,pos){var bullet=match[1];wrapAndJoin(pm,pos,this,null,function(node){return node.attrs.bullet==bullet})})),_model.CodeBlock.register("autoInput","startCodeBlock",new _inputrules.InputRule(/^```$/,"`",function(pm,_,pos){setAs(pm,pos,this,{params:""})})),_model.Heading.registerComputed("autoInput","startHeading",function(type){var re=new RegExp("^(#{1,"+type.maxLevel+"}) $");return new _inputrules.InputRule(re," ",function(pm,match,pos){setAs(pm,pos,this,{level:match[1].length})})})},{"../edit":11,"../model":34,"./inputrules":25}],25:[function(require,module,exports){"use strict";function _classCallCheck(instance,Constructor){if(!(instance instanceof Constructor))throw new TypeError("Cannot call a class as a function")}function addInputRule(pm,rule){pm.mod.interpretInput||(pm.mod.interpretInput=new InputRules(pm)),pm.mod.interpretInput.addRule(rule)}function removeInputRule(pm,rule){var ii=pm.mod.interpretInput;ii&&(ii.removeRule(rule),0==ii.rules.length&&(ii.unregister(),pm.mod.interpretInput=null))}function getContext(doc,pos){for(var child,parent=doc.path(pos.path),isCode=parent.type.isCode,textBefore="",i=parent.iter(0,pos.offset);child=i.next().value;)child.isText?textBefore+=child.text:textBefore="",i.atEnd()&&child.marks.some(function(st){return st.type.isCode})&&(isCode=!0);return{textBefore:textBefore,isCode:isCode}}var _createClass=function(){function defineProperties(target,props){for(var i=0;i-1?(this.rules.splice(found,1),!0):void 0}},{key:"onTextInput",value:function(text){var pos=this.pm.selection.head;if(pos)for(var textBefore=void 0,isCode=void 0,lastCh=text[text.length-1],i=0;icur.clientHeight)return cur}var _typeof="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(obj){return typeof obj}:function(obj){return obj&&"function"==typeof Symbol&&obj.constructor===Symbol?"symbol":typeof obj},_createClass=function(){function defineProperties(target,props){for(var i=0;i_this2.maxHeight?(_this2.maxHeight=_this2.wrapper.offsetHeight,function(){_this2.wrapper.style.minHeight=_this2.maxHeight+"px"}):void 0}}},{key:"updateFloat",value:function(){var editorRect=this.pm.wrapper.getBoundingClientRect();if(this.floating)if(editorRect.top>=0||editorRect.bottomwindow.innerHeight?"none":""}else if(editorRect.top<0&&editorRect.bottom>=this.wrapper.offsetHeight+10){this.floating=!0;var menuRect=this.wrapper.getBoundingClientRect();this.wrapper.style.left=menuRect.left+"px",this.wrapper.style.width=menuRect.width+"px",this.wrapper.style.position="fixed",this.spacer=(0,_dom.elt)("div",{"class":prefix+"-spacer",style:"height: "+menuRect.height+"px"}),this.pm.wrapper.insertBefore(this.spacer,this.wrapper)}}},{key:"updateScrollCursor",value:function(){var _this3=this;if(!this.floating)return null;var head=this.pm.selection.head;return head?function(){var cursorPos=_this3.pm.coordsAtPos(head),menuRect=_this3.wrapper.getBoundingClientRect();if(cursorPos.topmenuRect.top){var _ret=function(){var scrollable=findWrappingScrollable(_this3.pm.wrapper);return scrollable?{v:function(){scrollable.scrollTop-=menuRect.bottom-cursorPos.top}}:void 0}();if("object"===("undefined"==typeof _ret?"undefined":_typeof(_ret)))return _ret.v}}:null}}]),MenuBar}();(0,_dom.insertCSS)("\n."+prefix+" {\n border-top-left-radius: inherit;\n border-top-right-radius: inherit;\n position: relative;\n min-height: 1em;\n color: #666;\n padding: 1px 6px;\n top: 0; left: 0; right: 0;\n border-bottom: 1px solid silver;\n background: white;\n z-index: 10;\n -moz-box-sizing: border-box;\n box-sizing: border-box;\n overflow: visible;\n}\n")},{"../dom":1,"../edit":11,"../ui/update":51, -"./menu":27}],29:[function(require,module,exports){"use strict";function _classCallCheck(instance,Constructor){if(!(instance instanceof Constructor))throw new TypeError("Cannot call a class as a function")}function topCenterOfSelection(){var range=window.getSelection().getRangeAt(0),rects=range.getClientRects();if(!rects.length)return range.getBoundingClientRect();for(var _rects$=rects[0],left=_rects$.left,right=_rects$.right,top=_rects$.top,i=1;left==right&&rects.length>i;){var _rects=rects[i++];left=_rects.left,right=_rects.right,top=_rects.top}for(;i1)&&(left=Math.min(left,rects[i].left),right=Math.max(right,rects[i].right),top=Math.min(top,rects[i].top));return{top:top,left:(left+right)/2}}function topOfNodeSelection(pm){var selected=pm.content.querySelector(".ProseMirror-selectednode");if(!selected)return{left:0,top:0};var box=selected.getBoundingClientRect();return{left:Math.min((box.left+box.right)/2,box.left+20),top:box.top}}var _createClass=function(){function defineProperties(target,props){for(var i=0;isame&&childA.text[childA.text.length-same-1]==childB.text[childB.text.length-same-1];)same++,offA--,offB--;break}if(offA-=childA.width,offB-=childB.width,childA.size||childB.size){pathA.push(offA),pathB.push(offB);var inner=findDiffEnd(childA.content,childB.content,pathA,pathB);if(inner)return inner;pathA.pop(),pathB.pop()}}else offA-=childA.width,offB-=childB.width}return{a:new _pos.Pos(pathA,offA),b:new _pos.Pos(pathB,offB)}}Object.defineProperty(exports,"__esModule",{value:!0}),exports.findDiffStart=findDiffStart,exports.findDiffEnd=findDiffEnd;var _pos=require("./pos")},{"./pos":37}],32:[function(require,module,exports){"use strict";function _classCallCheck(instance,Constructor){if(!(instance instanceof Constructor))throw new TypeError("Cannot call a class as a function")}function _possibleConstructorReturn(self,call){if(!self)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return!call||"object"!=typeof call&&"function"!=typeof call?self:call}function _inherits(subClass,superClass){if("function"!=typeof superClass&&null!==superClass)throw new TypeError("Super expression must either be null or a function, not "+typeof superClass);subClass.prototype=Object.create(superClass&&superClass.prototype,{constructor:{value:subClass,enumerable:!1,writable:!0,configurable:!0}}),superClass&&(Object.setPrototypeOf?Object.setPrototypeOf(subClass,superClass):subClass.__proto__=superClass)}Object.defineProperty(exports,"__esModule",{value:!0}),exports.ModelError=void 0;var _error=require("../util/error");exports.ModelError=function(_ProseMirrorError){function ModelError(){return _classCallCheck(this,ModelError),_possibleConstructorReturn(this,Object.getPrototypeOf(ModelError).apply(this,arguments))}return _inherits(ModelError,_ProseMirrorError),ModelError}(_error.ProseMirrorError)},{"../util/error":52}],33:[function(require,module,exports){"use strict";function _possibleConstructorReturn(self,call){if(!self)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return!call||"object"!=typeof call&&"function"!=typeof call?self:call}function _inherits(subClass,superClass){if("function"!=typeof superClass&&null!==superClass)throw new TypeError("Super expression must either be null or a function, not "+typeof superClass);subClass.prototype=Object.create(superClass&&superClass.prototype,{constructor:{value:subClass,enumerable:!1,writable:!0,configurable:!0}}),superClass&&(Object.setPrototypeOf?Object.setPrototypeOf(subClass,superClass):subClass.__proto__=superClass)}function _classCallCheck(instance,Constructor){if(!(instance instanceof Constructor))throw new TypeError("Cannot call a class as a function")}var _createClass=function(){function defineProperties(target,props){for(var i=0;ipath.length,moreTo=to&&to.depth>path.length,start=moreFrom?from.path[path.length]:from?from.offset:0,end=moreTo?to.path[path.length]+1:to?to.offset:this.size,iter=this.iter(start,end);node=iter.next().value;){var startOffset=iter.offset-node.width;path.push(startOffset),node.nodesBetween(moreFrom&&startOffset==start?from:null,moreTo&&iter.offset==end?to:null,f,path,parent),path.pop()}}},{key:"sliceBetween",value:function(from,to){for(var node,depth=arguments.length<=2||void 0===arguments[2]?0:arguments[2],moreFrom=from&&from.depth>depth,moreTo=to&&to.depth>depth,start=moreFrom?from.path[depth]:from?from.offset:0,end=moreTo?to.path[depth]+1:to?to.offset:this.size,nodes=[],iter=this.iter(start,end);node=iter.next().value;){var passFrom=moreFrom&&iter.offset-node.width==start?from:null,passTo=moreTo&&iter.offset==end?to:null;(passFrom||passTo)&&(node=node.sliceBetween(passFrom,passTo,depth+1)),nodes.push(node)}return new this.constructor(nodes)}},{key:"textContent",get:function(){var text="";return this.forEach(function(n){return text+=n.textContent}),text}}],[{key:"fromJSON",value:function(schema,value){return value?this.fromArray(value.map(schema.nodeFromJSON)):emptyFragment}},{key:"fromArray",value:function(array){if(!array.length)return emptyFragment;for(var hasText=!1,joined=void 0,size=0,i=0;ioff||off>=this.content.length)throw new _error.ModelError("Offset "+off+" out of range");return this.content[off]}},{key:"forEach",value:function(f){for(var i=0;i0&&joinRight>0&&before.sameMarkup(after)?content.push(before.append(after.content,joinLeft-1,joinRight-1)):content.push(before.close(joinLeft-1,"end"),after.close(joinRight-1,"start")),Fragment.fromArray(content.concat(other.toArray(after.width)))}},{key:"toJSON",value:function(){return this.content.map(function(n){return n.toJSON()})}},{key:"size",get:function(){return this.content.length}},{key:"firstChild",get:function(){return this.content.length?this.content[0]:null}},{key:"lastChild",get:function(){return this.content.length?this.content[this.content.length-1]:null}}]),FlatFragment}(Fragment),emptyFragment=exports.emptyFragment=new FlatFragment([]),TextIterator=function(){function TextIterator(fragment,startOffset,endOffset){var pos=arguments.length<=3||void 0===arguments[3]?-1:arguments[3];_classCallCheck(this,TextIterator),this.frag=fragment,this.offset=startOffset,this.pos=pos,this.endOffset=endOffset}return _createClass(TextIterator,[{key:"copy",value:function(){return new this.constructor(this.frag,this.offset,this.endOffset,this.pos)}},{key:"atEnd",value:function(){return this.offset==this.endOffset}},{key:"next",value:function(){if(-1==this.pos){var start=this.init();if(start)return start}return this.offset==this.endOffset?iterEnd:this.advance()}},{key:"advance",value:function(){var node=this.frag.content[this.pos++],end=this.offset+node.width;return end>this.endOffset?(node=node.copy(node.text.slice(0,this.endOffset-this.offset)),this.offset=this.endOffset,node):(this.offset=end,node)}},{key:"init",value:function(){this.pos=0;for(var offset=0;offsetthis.offset){var sliceEnd=node.width,sliceStart=this.offset-offset;return end>this.endOffset&&(sliceEnd=this.endOffset-offset,end=this.endOffset),node=sliceEnd>sliceStart?node.copy(node.text.slice(this.offset-offset,sliceEnd)):null,this.offset=end,node}offset=end}}}]),TextIterator}(),ReverseTextIterator=function(_TextIterator){function ReverseTextIterator(){return _classCallCheck(this,ReverseTextIterator),_possibleConstructorReturn(this,Object.getPrototypeOf(ReverseTextIterator).apply(this,arguments))}return _inherits(ReverseTextIterator,_TextIterator),_createClass(ReverseTextIterator,[{key:"advance",value:function(){var node=this.frag.content[--this.pos],end=this.offset-node.width;return endthis.offset;){var node=this.frag.content[--this.pos],end=offset-node.width;if(end==this.offset)break;if(endoff||off>=this.size)throw new _error.ModelError("Offset "+off+" out of range");for(var i=0,curOff=0;ioff)return child}}},{key:"forEach",value:function(f){for(var i=0,off=0;i=off)return{node:child,start:curOff};curOff=end}}},{key:"chunkAfter",value:function(off){if(off==this.size)throw new _error.ModelError("No chunk after end of node");for(var i=0,curOff=0;ioff)return{node:child,start:curOff};curOff=end}}},{key:"slice",value:function(){var from=arguments.length<=0||void 0===arguments[0]?0:arguments[0],to=arguments.length<=1||void 0===arguments[1]?this.size:arguments[1];return from==to?emptyFragment:new TextFragment(this.toArray(from,to),to-from)}},{key:"replace",value:function(off,node){if(node.isText)throw new _error.ModelError("Argument to replace should be a non-text node");for(var curNode=void 0,index=void 0,curOff=0;off>curOff;index++)curNode=this.content[index],curOff+=curNode.width;if(curNode.isText)throw new _error.ModelError("Can not replace text content with replace method");var copy=this.content.slice();return copy[index]=node,new TextFragment(copy,this.size)}},{key:"appendInner",value:function(other,joinLeft,joinRight){var last=this.content.length-1,content=this.content.slice(0,last),before=this.content[last],after=other.firstChild,same=before.sameMarkup(after);return same&&before.isText?content.push(before.copy(before.text+after.text)):same&&joinLeft>0&&joinRight>0?content.push(before.append(after.content,joinLeft-1,joinRight-1)):content.push(before.close(joinLeft-1,"end"),after.close(joinRight-1,"start")),Fragment.fromArray(content.concat(other.toArray(after.width)))}},{key:"toJSON",value:function(){return this.content.map(function(n){return n.toJSON()})}},{key:"firstChild",get:function(){return this.size?this.content[0]:null}},{key:"lastChild",get:function(){return this.size?this.content[this.content.length-1]:null}}]),TextFragment}(Fragment);"undefined"!=typeof Symbol&&(Fragment.prototype[Symbol.iterator]=function(){return this.iter()},FlatIterator.prototype[Symbol.iterator]=TextIterator.prototype[Symbol.iterator]=function(){return this})},{"./error":32}],34:[function(require,module,exports){"use strict";Object.defineProperty(exports,"__esModule",{value:!0});var _node=require("./node");Object.defineProperty(exports,"Node",{enumerable:!0,get:function(){return _node.Node}});var _fragment=require("./fragment");Object.defineProperty(exports,"Fragment",{enumerable:!0,get:function(){return _fragment.Fragment}}),Object.defineProperty(exports,"emptyFragment",{enumerable:!0,get:function(){return _fragment.emptyFragment}});var _mark=require("./mark");Object.defineProperty(exports,"Mark",{enumerable:!0,get:function(){return _mark.Mark}});var _schema=require("./schema");Object.defineProperty(exports,"SchemaSpec",{enumerable:!0,get:function(){return _schema.SchemaSpec}}),Object.defineProperty(exports,"Schema",{enumerable:!0,get:function(){return _schema.Schema}}),Object.defineProperty(exports,"SchemaError",{enumerable:!0,get:function(){return _schema.SchemaError}}),Object.defineProperty(exports,"NodeType",{enumerable:!0,get:function(){return _schema.NodeType}}),Object.defineProperty(exports,"Block",{enumerable:!0,get:function(){return _schema.Block}}),Object.defineProperty(exports,"Textblock",{enumerable:!0,get:function(){return _schema.Textblock}}),Object.defineProperty(exports,"Inline",{enumerable:!0,get:function(){return _schema.Inline}}),Object.defineProperty(exports,"Text",{enumerable:!0,get:function(){return _schema.Text}}),Object.defineProperty(exports,"MarkType",{enumerable:!0,get:function(){return _schema.MarkType}}),Object.defineProperty(exports,"Attribute",{enumerable:!0,get:function(){return _schema.Attribute}}),Object.defineProperty(exports,"NodeKind",{enumerable:!0,get:function(){return _schema.NodeKind}});var _defaultschema=require("./defaultschema");Object.defineProperty(exports,"defaultSchema",{enumerable:!0,get:function(){return _defaultschema.defaultSchema}}),Object.defineProperty(exports,"Doc",{enumerable:!0,get:function(){return _defaultschema.Doc}}),Object.defineProperty(exports,"BlockQuote",{enumerable:!0,get:function(){return _defaultschema.BlockQuote}}),Object.defineProperty(exports,"OrderedList",{enumerable:!0,get:function(){return _defaultschema.OrderedList}}),Object.defineProperty(exports,"BulletList",{enumerable:!0,get:function(){return _defaultschema.BulletList}}),Object.defineProperty(exports,"ListItem",{enumerable:!0, -get:function(){return _defaultschema.ListItem}}),Object.defineProperty(exports,"HorizontalRule",{enumerable:!0,get:function(){return _defaultschema.HorizontalRule}}),Object.defineProperty(exports,"Paragraph",{enumerable:!0,get:function(){return _defaultschema.Paragraph}}),Object.defineProperty(exports,"Heading",{enumerable:!0,get:function(){return _defaultschema.Heading}}),Object.defineProperty(exports,"CodeBlock",{enumerable:!0,get:function(){return _defaultschema.CodeBlock}}),Object.defineProperty(exports,"Image",{enumerable:!0,get:function(){return _defaultschema.Image}}),Object.defineProperty(exports,"HardBreak",{enumerable:!0,get:function(){return _defaultschema.HardBreak}}),Object.defineProperty(exports,"CodeMark",{enumerable:!0,get:function(){return _defaultschema.CodeMark}}),Object.defineProperty(exports,"EmMark",{enumerable:!0,get:function(){return _defaultschema.EmMark}}),Object.defineProperty(exports,"StrongMark",{enumerable:!0,get:function(){return _defaultschema.StrongMark}}),Object.defineProperty(exports,"LinkMark",{enumerable:!0,get:function(){return _defaultschema.LinkMark}});var _pos=require("./pos");Object.defineProperty(exports,"Pos",{enumerable:!0,get:function(){return _pos.Pos}});var _diff=require("./diff");Object.defineProperty(exports,"findDiffStart",{enumerable:!0,get:function(){return _diff.findDiffStart}}),Object.defineProperty(exports,"findDiffEnd",{enumerable:!0,get:function(){return _diff.findDiffEnd}});var _error=require("./error");Object.defineProperty(exports,"ModelError",{enumerable:!0,get:function(){return _error.ModelError}})},{"./defaultschema":30,"./diff":31,"./error":32,"./fragment":33,"./mark":35,"./node":36,"./pos":37,"./schema":38}],35:[function(require,module,exports){"use strict";function _classCallCheck(instance,Constructor){if(!(instance instanceof Constructor))throw new TypeError("Cannot call a class as a function")}var _createClass=function(){function defineProperties(target,props){for(var i=0;ithis.type.rank)return set.slice(0,i).concat(this).concat(set.slice(i))}return set.concat(this)}},{key:"removeFromSet",value:function(set){for(var i=0;i=0;i--)str=marks[i].type.name+"("+str+")";return str}var _get=function get(object,property,receiver){null===object&&(object=Function.prototype);var desc=Object.getOwnPropertyDescriptor(object,property);if(void 0===desc){var parent=Object.getPrototypeOf(object);return null===parent?void 0:get(parent,property,receiver)}if("value"in desc)return desc.value;var getter=desc.get;if(void 0!==getter)return getter.call(receiver)},_createClass=function(){function defineProperties(target,props){for(var i=0;i0&&(closedContent=this.content.close(depth-1,side))!=this.content?this.copy(closedContent):this}},{key:"path",value:function(_path){for(var i=0,node=this;i<_path.length;node=node.child(_path[i]),i++);return node}},{key:"nodeAfter",value:function(pos){var parent=this.path(pos.path);return pos.offset0?this:other}},{key:"min",value:function(other){return this.cmp(other)<0?this:other}},{key:"cmp",value:function(other){return other==this?0:Pos.cmp(this.path,this.offset,other.path,other.offset)}},{key:"shorten",value:function(){var to=arguments.length<=0||void 0===arguments[0]?null:arguments[0],offset=arguments.length<=1||void 0===arguments[1]?0:arguments[1];if(to>=this.depth){if(to!=this.depth||offset)throw new _error.ModelError("Invalid shorten depth "+to+" for "+this);return new Pos(this.path,this.offset+offset)}return Pos.shorten(this.path,to,offset)}},{key:"move",value:function(by){return new Pos(this.path,this.offset+by)}},{key:"toPath",value:function(){var move=arguments.length<=0||void 0===arguments[0]?0:arguments[0];return this.path.concat(this.offset+move)}},{key:"extend",value:function(pos){for(var path=this.path.slice(),add=this.offset,i=0;i=node.size)return!1;node=node.child(n)}}},{key:"toJSON",value:function(){return this}},{key:"depth",get:function(){return this.path.length}}],[{key:"cmp",value:function(pathA,offsetA,pathB,offsetB){for(var lenA=pathA.length,lenB=pathB.length,i=0,end=Math.min(lenA,lenB);end>i;i++){var diff=pathA[i]-pathB[i];if(0!=diff)return diff}return lenA>lenB?offsetB<=pathA[i]?1:-1:lenB>lenA?offsetA<=pathB[i]?-1:1:offsetA-offsetB}},{key:"samePath",value:function(pathA,pathB){if(pathA.length!=pathB.length)return!1;for(var i=0;i=0;i--)inner=conn[i].create(null,inner);return _fragment.Fragment.from(inner)}},{key:"contains",get:function(){return NodeKind.block}},{key:"kind",get:function(){return NodeKind.block}},{key:"isBlock",get:function(){return!0}},{key:"canBeEmpty",get:function(){return null==this.contains}}]),Block}(NodeType),Inline=(exports.Textblock=function(_Block){function Textblock(){return _classCallCheck(this,Textblock),_possibleConstructorReturn(this,Object.getPrototypeOf(Textblock).apply(this,arguments))}return _inherits(Textblock,_Block),_createClass(Textblock,[{key:"contains",get:function(){return NodeKind.inline}},{key:"containsMarks",get:function(){return!0}},{key:"isTextblock",get:function(){return!0}},{key:"canBeEmpty",get:function(){return!0}}]),Textblock}(Block),exports.Inline=function(_NodeType2){function Inline(){return _classCallCheck(this,Inline),_possibleConstructorReturn(this,Object.getPrototypeOf(Inline).apply(this,arguments))}return _inherits(Inline,_NodeType2),_createClass(Inline,[{key:"kind",get:function(){return NodeKind.inline}},{key:"isInline",get:function(){return!0}}]),Inline}(NodeType)),MarkType=(exports.Text=function(_Inline){function Text(){return _classCallCheck(this,Text),_possibleConstructorReturn(this,Object.getPrototypeOf(Text).apply(this,arguments))}return _inherits(Text,_Inline),_createClass(Text,[{key:"create",value:function(attrs,content,marks){return new _node.TextNode(this,this.computeAttrs(attrs,content),content,marks)}},{key:"selectable",get:function(){return!1}},{key:"isText",get:function(){return!0}},{key:"kind",get:function(){return NodeKind.text}}]),Text}(Inline),exports.Attribute=function Attribute(){var options=arguments.length<=0||void 0===arguments[0]?{}:arguments[0];_classCallCheck(this,Attribute),this["default"]=options["default"],this.compute=options.compute,this.label=options.label},exports.MarkType=function(_SchemaItem2){function MarkType(name,rank,schema){_classCallCheck(this,MarkType);var _this10=_possibleConstructorReturn(this,Object.getPrototypeOf(MarkType).call(this));_this10.name=name,_this10.freezeAttrs(),_this10.rank=rank,_this10.schema=schema;var defaults=_this10.getDefaultAttrs();return _this10.instance=defaults&&new _mark.Mark(_this10,defaults),_this10}return _inherits(MarkType,_SchemaItem2),_createClass(MarkType,[{key:"create",value:function(attrs){return!attrs&&this.instance?this.instance:new _mark.Mark(this,this.computeAttrs(attrs))}},{key:"removeFromSet",value:function(set){for(var i=0;ii;i++){var obj=i?this.marks:this.nodes;for(var tname in obj){var type=obj[tname],registry=type.registry,ns=registry&®istry[namespace];if(ns)for(var prop in ns){var value=ns[prop](type);null!=value&&f(prop,value,type,tname)}}}}}]),Schema}());exports.Schema=Schema},{"../util/error":52,"../util/obj":55,"./fragment":33,"./mark":35,"./node":36}],39:[function(require,module,exports){"use strict";function canBeLifted(doc,range){for(var content=[doc.path(range.from.path)],unwrap=!1;;){for(var parentDepth=-1,_loop=function(_node,i){content.some(function(inner){return!_node.type.canContainContent(inner.type)})||(parentDepth=i),_node=_node.child(range.from.path[i]),node=_node},node=doc,i=0;i-1)return{path:range.from.path.slice(0,parentDepth),unwrap:unwrap};if(unwrap||!content[0].isBlock)return null;content=content[0].content.slice(range.from.offset,range.to.offset),unwrap=!0}}function canLift(doc,from,to){var range=doc.siblingRange(from,to||from),found=canBeLifted(doc,range);return found?{found:found,range:range}:void 0}function canWrap(doc,from,to,type){var range=doc.siblingRange(from,to||from);if(range.from.offset==range.to.offset)return null;var parent=doc.path(range.from.path),around=parent.type.findConnection(type),inside=type.findConnection(parent.child(range.from.offset).type);return around&&inside?{range:range,around:around,inside:inside}:void 0}var _typeof="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(obj){return typeof obj}:function(obj){return obj&&"function"==typeof Symbol&&obj.constructor===Symbol?"symbol":typeof obj};Object.defineProperty(exports,"__esModule",{value:!0}),exports.canLift=canLift,exports.canWrap=canWrap;var _model=require("../model"),_transform=require("./transform"),_step=require("./step"),_tree=require("./tree"),_map=require("./map");_step.Step.define("ancestor",{apply:function(doc,step){ -var from=step.from,to=step.to;if(!(0,_tree.isFlatRange)(from,to))return null;for(var toParent=from.path,start=from.offset,end=to.offset,_step$param=step.param,_step$param$depth=_step$param.depth,depth=void 0===_step$param$depth?0:_step$param$depth,_step$param$types=_step$param.types,types=void 0===_step$param$types?[]:_step$param$types,_step$param$attrs=_step$param.attrs,attrs=void 0===_step$param$attrs?[]:_step$param$attrs,inner=doc.path(from.path),i=0;depth>i;i++){if(start>0||end=0;i--)node=types[i].create(attrs[i],node||content);newParent=parent.splice(start,end,_model.Fragment.from(node))}();if("object"===("undefined"==typeof _ret?"undefined":_typeof(_ret)))return _ret.v}else{if(!parent.type.canContainFragment(inner.content)||!inner.size&&0==start&&end==parent.size&&!parent.type.canBeEmpty)return null;newParent=parent.splice(start,end,inner.content)}for(var copy=doc.replaceDeep(toParent,newParent),toInner=toParent.slice(),i=0;i1||types.length>1){var posBefore=new _model.Pos(toParent,start),posAfter1=new _model.Pos(toParent,end),posAfter2=new _model.Pos(toParent,start+insertedSize),endOfInner=new _model.Pos(toInner,startOfInner.offset+(to.offset-from.offset));replaced=[new _map.ReplacedRange(posBefore,from,posBefore,startOfInner),new _map.ReplacedRange(to,posAfter1,endOfInner,posAfter2,posAfter1,posAfter2)]}var moved=[new _map.MovedRange(from,to.offset-from.offset,startOfInner)];return end-start!=insertedSize&&moved.push(new _map.MovedRange(new _model.Pos(toParent,end),parentSize-end,new _model.Pos(toParent,start+insertedSize))),new _step.StepResult(copy,new _map.PosMap(moved,replaced))},invert:function(step,oldDoc,map){var types=[],attrs=[];if(step.param.depth)for(var i=0;i0){this.split(pos,depth-d);for(var cut=range.from.path.length-depth,path=pos.path.slice(0,cut).concat(pos.path[cut]+1);path.lengthrange.from.offset;i--)this.join(new _model.Pos(range.from.path,i));for(var child,size=0,i=rangeNode.iter(range.from.offset,range.to.offset);child=i.next().value;)size+=child.size;var path=range.from.path.concat(range.from.offset);range={from:new _model.Pos(path,0),to:new _model.Pos(path,size)},++depth}return this.step("ancestor",range.from,range.to,null,{depth:depth}),this},_transform.Transform.prototype.wrap=function(from,to,type,wrapAttrs){var can=canWrap(this.doc,from,to,type);if(!can)return this;var range=can.range,around=can.around,inside=can.inside,types=around.concat(type).concat(inside),attrs=around.map(function(){return null}).concat(wrapAttrs).concat(inside.map(function(){return null}));if(this.step("ancestor",range.from,range.to,null,{types:types,attrs:attrs}),inside.length){for(var toInner=range.from.path.slice(),i=0;i0;i--)this.split(new _model.Pos(toInner,i),inside.length)}return this},_transform.Transform.prototype.setBlockType=function(from,to,type,attrs){var _this=this;return this.doc.nodesBetween(from,to||from,function(node,path){return node.isTextblock&&!node.hasMarkup(type,attrs)?(path=path.slice(),_this.clearMarkup(new _model.Pos(path,0),new _model.Pos(path,node.size),type),_this.step("ancestor",new _model.Pos(path,0),new _model.Pos(path,_this.doc.path(path).size),null,{depth:1,types:[type],attrs:[attrs]}),!1):void 0}),this},_transform.Transform.prototype.setNodeType=function(pos,type,attrs){var node=this.doc.nodeAfter(pos),path=pos.toPath();return this.step("ancestor",new _model.Pos(path,0),new _model.Pos(path,node.size),null,{depth:1,types:[type],attrs:[attrs]}),this}},{"../model":34,"./map":42,"./step":46,"./transform":47,"./tree":48}],40:[function(require,module,exports){"use strict";Object.defineProperty(exports,"__esModule",{value:!0}),exports.Remapping=exports.MapResult=exports.PosMap=exports.joinableBlocks=exports.joinPoint=exports.canWrap=exports.canLift=exports.StepResult=exports.Step=exports.Transform=void 0;var _transform=require("./transform");Object.defineProperty(exports,"Transform",{enumerable:!0,get:function(){return _transform.Transform}});var _step=require("./step");Object.defineProperty(exports,"Step",{enumerable:!0,get:function(){return _step.Step}}),Object.defineProperty(exports,"StepResult",{enumerable:!0,get:function(){return _step.StepResult}});var _ancestor=require("./ancestor");Object.defineProperty(exports,"canLift",{enumerable:!0,get:function(){return _ancestor.canLift}}),Object.defineProperty(exports,"canWrap",{enumerable:!0,get:function(){return _ancestor.canWrap}});var _join=require("./join");Object.defineProperty(exports,"joinPoint",{enumerable:!0,get:function(){return _join.joinPoint}}),Object.defineProperty(exports,"joinableBlocks",{enumerable:!0,get:function(){return _join.joinableBlocks}});var _map=require("./map");Object.defineProperty(exports,"PosMap",{enumerable:!0,get:function(){return _map.PosMap}}),Object.defineProperty(exports,"MapResult",{enumerable:!0,get:function(){return _map.MapResult}}),Object.defineProperty(exports,"Remapping",{enumerable:!0,get:function(){return _map.Remapping}}),require("./mark"),require("./split"),require("./replace")},{"./ancestor":39,"./join":41,"./map":42,"./mark":43,"./replace":44,"./split":45,"./step":46,"./transform":47}],41:[function(require,module,exports){"use strict";function joinableBlocks(doc,pos){if(0==pos.offset)return!1;var parent=doc.path(pos.path);if(parent.isTextblock||pos.offset==parent.size)return!1;var type=parent.child(pos.offset-1).type;return!type.isTextblock&&type.contains&&type==parent.child(pos.offset).type}function joinPoint(doc,pos){for(var dir=arguments.length<=2||void 0===arguments[2]?-1:arguments[2];;){if(joinableBlocks(doc,pos))return pos;if(0==pos.depth)return null;pos=pos.shorten(null,0>dir?0:1)}}Object.defineProperty(exports,"__esModule",{value:!0}),exports.joinableBlocks=joinableBlocks,exports.joinPoint=joinPoint;var _model=require("../model"),_transform=require("./transform"),_step=require("./step"),_map=require("./map");_step.Step.define("join",{apply:function(doc,step){var before=doc.path(step.from.path),after=doc.path(step.to.path);if(step.from.offset0||!before.type.canContainFragment(after.content))return null;var pFrom=step.from.path,pTo=step.to.path,last=pFrom.length-1,offset=pFrom[last]+1;if(pFrom.length!=pTo.length||0==pFrom.length||offset!=pTo[last])return null;for(var i=0;last>i;i++)if(pFrom[i]!=pTo[i])return null;var targetPath=pFrom.slice(0,last),target=doc.path(targetPath),oldSize=target.size;if(target.type.locked)return null;var joined=before.append(after.content),copy=doc.replaceDeep(targetPath,target.splice(offset-1,offset+1,_model.Fragment.from(joined))),map=new _map.PosMap([new _map.MovedRange(step.to,after.size,step.from),new _map.MovedRange(new _model.Pos(targetPath,offset+1),oldSize-offset-1,new _model.Pos(targetPath,offset))],[new _map.ReplacedRange(step.from,step.to,step.from,step.from,step.to.shorten())]);return new _step.StepResult(copy,map)},invert:function(step,oldDoc){return new _step.Step("split",null,null,step.from,oldDoc.path(step.to.path).copy())}}),_transform.Transform.prototype.join=function(at){var parent=this.doc.path(at.path);return 0==at.offset||at.offset==parent.size||parent.isTextblock?this:(this.step("join",new _model.Pos(at.path.concat(at.offset-1),parent.child(at.offset-1).size),new _model.Pos(at.path.concat(at.offset),0)),this)}},{"../model":34,"./map":42,"./step":46,"./transform":47}],42:[function(require,module,exports){"use strict";function _classCallCheck(instance,Constructor){if(!(instance instanceof Constructor))throw new TypeError("Cannot call a class as a function")}function offsetFrom(base,pos){if(pos.path.length>base.path.length){for(var path=[pos.path[base.path.length]-base.offset],i=base.path.length+1;i=0&&(right=pos.cmp(side.to))<=0){var other=back?range.before:range.after;return new MapResult(0>bias?other.from:other.to,!(!left||!right),{rangeID:i,offset:offsetFrom(side.ref,pos)})}}for(var i=0;i=0&&_model.Pos.cmp(pos.path,pos.offset,start.path,start.offset+range.size)<=0){var dest=back?range.start:range.dest,depth=start.depth;if(pos.depth>depth){var offset=dest.offset+(pos.path[depth]-start.offset);return new MapResult(new _model.Pos(dest.path.concat(offset).concat(pos.path.slice(depth+1)),pos.offset))}return new MapResult(new _model.Pos(dest.path,dest.offset+(pos.offset-start.offset)))}}return new MapResult(pos)}var _createClass=function(){function defineProperties(target,props){for(var i=0;iid?this.head[-id-1]:this.tail[id]}},{key:"map",value:function map(pos,bias){for(var deleted=!1,i=-this.head.length;i=0;i--)this.step(delSteps[i]);return this}},{"../model":34,"./step":46,"./transform":47,"./tree":48}],44:[function(require,module,exports){"use strict";function findMovedChunks(oldNode,oldPath,newNode,startDepth){for(var moved=[],newPath=oldPath.path.slice(0,startDepth),depth=startDepth;;depth++){var joined=depth==oldPath.depth?0:1,cut=depth==oldPath.depth?oldPath.offset:oldPath.path[depth],afterCut=oldNode.size-cut,newOffset=newNode.size-afterCut,from=oldPath.shorten(depth,joined),to=new _model.Pos(newPath,newOffset+joined);if(from.cmp(to)&&moved.push(new _map.MovedRange(from,afterCut-joined,to)),!joined)return moved;oldNode=oldNode.child(cut),newNode=newNode.child(newOffset),newPath=newPath.concat(newOffset)}}function replace(node,from,to,root,repl){var depth=arguments.length<=5||void 0===arguments[5]?0:arguments[5];if(depth==root.length){var before=node.sliceBetween(null,from,depth),after=node.sliceBetween(to,null,depth),result=void 0;return before.type.canContainFragment(repl.content)?(result=repl.content.size?before.append(repl.content,from.depth-depth,repl.openLeft).append(after.content,repl.openRight,to.depth-depth):before.append(after.content,from.depth-depth,to.depth-depth),result.size||result.type.canBeEmpty||(result=result.copy(result.type.defaultContent())),{doc:result,moved:findMovedChunks(node,to,result,depth)}):null}var pos=root[depth],result=replace(node.child(pos),from,to,root,repl,depth+1);return result?{doc:node.replace(pos,result.doc),moved:result.moved}:null}function shiftFromStack(stack,depth){for(var shifted=stack[depth]=stack[depth].slice(1),i=depth-1;i>=0;i--)shifted=stack[i]=stack[i].replace(0,shifted)}function buildInserted(nodesLeft,source,start,end){for(var sliced=source.sliceBetween(start,end),nodesRight=[],node=sliced,i=0;i<=start.path.length;i++,node=node.firstChild)nodesRight.push(node);var same=(0,_tree.samePathDepth)(start,end),searchLeft=nodesLeft.length-1,searchRight=nodesRight.length-1,result=null,dLeft=start.depth,dRight=end.depth,inner=nodesRight[searchRight];for(inner.isTextblock&&inner.size&&nodesLeft[searchLeft].isTextblock&&(result=nodesLeft[searchLeft--].copy(inner.content),--searchRight,shiftFromStack(nodesRight,searchRight));;searchRight--){for(var node=nodesRight[searchRight],type=node.type,matched=null,outside=same>=searchRight,i=searchLeft;i>=0;i--){var left=nodesLeft[i];if(outside?left.type.canContainContent(node.type):left.type==type){matched=i;break}}if(null!=matched){if(result)for(;searchLeft>=matched;){var wrap=nodesLeft[searchLeft],content=_model.Fragment.from(result);result=wrap.copy(searchLeft==matched?content.append(node.content):content),searchLeft--}else result=nodesLeft[matched].copy(node.content),searchLeft=matched-1;if(outside)break}else--dLeft;(null!=matched||0==node.size)&&(outside&&null==matched&&--dRight,shiftFromStack(nodesRight,searchRight-1))}var repl={content:result?result.content:_model.emptyFragment,openLeft:dLeft-searchRight,openRight:dRight-searchRight};return{repl:repl,depth:searchLeft+1}}function moveText(tr,doc,before,after){for(var root=(0,_tree.samePathDepth)(before,after),cutAt=after.shorten(null,1);cutAt.path.length>root&&1==doc.path(cutAt.path).size;)cutAt=cutAt.shorten(null,1);tr.split(cutAt,cutAt.path.length-root);for(var start=after,end=new _model.Pos(start.path,doc.path(start.path).size),parent=doc.path(start.path.slice(0,root)),wanted=parent.pathNodes(before.path.slice(root)),existing=parent.pathNodes(start.path.slice(root));wanted.length&&existing.length&&wanted[0].sameMarkup(existing[0]);)wanted.shift(),existing.shift();(existing.length||wanted.length)&&tr.step("ancestor",start,end,null,{depth:existing.length,types:wanted.map(function(n){return n.type}),attrs:wanted.map(function(n){return n.attrs})});for(var i=root;imaxDepth;)repl.content.size&&(repl={content:_model.Fragment.from(doc.path(from.path.slice(0,depth)).copy(repl.content)),openLeft:repl.openLeft+1,openRight:repl.openRight+1}),depth--}else repl=nullRepl,depth=maxDepth;var root=from.shorten(depth),docAfter=doc,after=to;if(repl.content.size||(0,_tree.replaceHasEffect)(doc,from,to)){var result=this.step("replace",from,to,root,repl);docAfter=result.doc,after=result.map.map(to).pos}if(!doc.path(to.path).isTextblock)return this;if(!(repl.content.size?source.path(end.path).isTextblock:doc.path(from.path).isTextblock))return this;var nodesAfter=doc.path(root.path).pathNodes(to.path.slice(depth)).slice(1),nodesBefore=void 0;if(repl.content.size){var inserted=repl.content;nodesBefore=[];for(var i=0;ioff;off++){var here=pos.shorten(pos.depth-off);here.offset&&here.offset0)return!0}return gapStart!=gapEnd?!0:canBeJoined(node,gapStart,Math.min(from.depth,to.depth)-depth)}node=node.child(from.path[depth])}}function samePathDepth(a,b){for(var i=0;;i++)if(i==a.path.length||i==b.path.length||a.path[i]!=b.path[i])return i}Object.defineProperty(exports,"__esModule",{value:!0}),exports.copyStructure=copyStructure,exports.copyInline=copyInline,exports.isFlatRange=isFlatRange,exports.replaceHasEffect=replaceHasEffect,exports.samePathDepth=samePathDepth;var _model=require("../model")},{"../model":34}],49:[function(require,module,exports){"use strict";function _classCallCheck(instance,Constructor){if(!(instance instanceof Constructor))throw new TypeError("Cannot call a class as a function")}function openPrompt(pm,content,options){var button=(0,_dom.elt)("button",{"class":"ProseMirror-prompt-close"}),wrapper=(0,_dom.elt)("div",{"class":"ProseMirror-prompt"},content,button),outerBox=pm.wrapper.getBoundingClientRect();if(pm.wrapper.appendChild(wrapper),options&&options.pos)wrapper.style.left=options.pos.left-outerBox.left+"px",wrapper.style.pos=options.pos.top-outerBox.top+"px";else{var blockBox=wrapper.getBoundingClientRect(),cX=Math.max(0,outerBox.left)+Math.min(window.innerWidth,outerBox.right)-blockBox.width,cY=Math.max(0,outerBox.top)+Math.min(window.innerHeight,outerBox.bottom)-blockBox.height;wrapper.style.left=cX/2-outerBox.left+"px",wrapper.style.top=cY/2-outerBox.top+"px"}var close=function close(){pm.off("interaction",close),wrapper.parentNode&&(wrapper.parentNode.removeChild(wrapper),options&&options.onClose&&options.onClose())};return button.addEventListener("click",close),pm.on("interaction",close),{close:close}}var _createClass=function(){function defineProperties(target,props){for(var i=0;i-1&&this.waiting.splice(index,1)}},{key:"force",value:function(){for(clearTimeout(this.timeout),this.lastForce=Date.now();this.waiting.length;)for(var i=0;iMIN_FLUSH_DELAY&&this.force()}}],[{key:"get",value:function(pm){return pm.mod.centralScheduler||(pm.mod.centralScheduler=new this(pm))}}]),CentralScheduler}();exports.UpdateScheduler=function(){function UpdateScheduler(pm,events,start){var _this=this;_classCallCheck(this,UpdateScheduler),this.pm=pm,this.start=start,this.events=events.split(" "),this.onEvent=this.onEvent.bind(this),this.events.forEach(function(event){return pm.on(event,_this.onEvent)})}return _createClass(UpdateScheduler,[{key:"detach",value:function(){var _this2=this;unscheduleDOMUpdate(this.pm,this.start),this.events.forEach(function(event){return _this2.pm.off(event,_this2.onEvent)})}},{key:"onEvent",value:function(){scheduleDOMUpdate(this.pm,this.start)}},{key:"force",value:function(){if(this.pm.operation)this.onEvent();else{unscheduleDOMUpdate(this.pm,this.start);for(var run=this.start;run;run=run());}}}]),UpdateScheduler}()},{}],52:[function(require,module,exports){"use strict";function _classCallCheck(instance,Constructor){if(!(instance instanceof Constructor))throw new TypeError("Cannot call a class as a function")}function _possibleConstructorReturn(self,call){if(!self)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return!call||"object"!=typeof call&&"function"!=typeof call?self:call}function _inherits(subClass,superClass){if("function"!=typeof superClass&&null!==superClass)throw new TypeError("Super expression must either be null or a function, not "+typeof superClass);subClass.prototype=Object.create(superClass&&superClass.prototype,{constructor:{value:subClass,enumerable:!1,writable:!0,configurable:!0}}),superClass&&(Object.setPrototypeOf?Object.setPrototypeOf(subClass,superClass):subClass.__proto__=superClass)}function functionName(f){var match=/^function (\w+)/.exec(f.toString());return match&&match[1]}var _createClass=function(){function defineProperties(target,props){for(var i=0;i1?_len-1:0),_key=1;_len>_key;_key++)args[_key-1]=arguments[_key];for(var i=0;i1?_len2-1:0),_key2=1;_len2>_key2;_key2++)args[_key2-1]=arguments[_key2];for(var i=0;i0}}},{}],54:[function(require,module,exports){"use strict";function _classCallCheck(instance,Constructor){if(!(instance instanceof Constructor))throw new TypeError("Cannot call a class as a function")}var _createClass=function(){function defineProperties(target,props){for(var i=0;i-1?this.content[found+1]=value:this.content.push(key,value)}},{key:"get",value:function(key){var found=this.find(key);return-1==found?void 0:this.content[found+1]}},{key:"has",value:function(key){return this.find(key)>-1}},{key:"find",value:function(key){for(var i=0;i0);i++);array.splice(i,0,elt)}Object.defineProperty(exports,"__esModule",{value:!0}),exports["default"]=sortedInsert},{}],57:[function(require,module,exports){!function(mod){if("object"==typeof exports&&"object"==typeof module)module.exports=mod();else{if("function"==typeof define&&define.amd)return define([],mod);(this||window).browserKeymap=mod()}}(function(){"use strict";function keyName(event){if("keypress"==event.type)return"'"+String.fromCharCode(event.charCode)+"'";var base=keyNames[event.keyCode],name=base;return null==name||event.altGraphKey?null:(event.altKey&&"Alt"!=base&&(name="Alt-"+name),event.ctrlKey&&"Ctrl"!=base&&(name="Ctrl-"+name),event.metaKey&&"Cmd"!=base&&(name="Cmd-"+name),event.shiftKey&&"Shift"!=base&&(name="Shift-"+name),name)}function isModifierKey(name){return name=/[^-]*$/.exec(name)[0],"Ctrl"==name||"Alt"==name||"Shift"==name||"Mod"==name}function normalizeKeyName(name){for(var alt,ctrl,shift,cmd,parts=name.split(/-(?!'?$)/),result=parts[parts.length-1],i=0;ii;i++)keyNames[i+48]=keyNames[i+96]=String(i);for(var i=65;90>=i;i++)keyNames[i]=String.fromCharCode(i);for(var i=1;12>=i;i++)keyNames[i+111]=keyNames[i+63235]="F"+i;return Keymap.prototype={normalize:function(name){return this.options.multi!==!1?name.split(/ +(?!\'$)/).map(normalizeKeyName):[normalizeKeyName(name)]},addBinding:function(keyname,value){for(var keys=this.normalize(keyname),i=0;i=0;i--){var name=keys.slice(0,i).join(" "),val=this.bindings[name];if("..."==val&&!this.unusedMulti(name))break;val&&delete this.bindings[name]}},unusedMulti:function(name){for(var binding in this.bindings)if(binding.length>name&&0==binding.indexOf(name)&&" "==binding.charAt(name.length))return!1;return!0},lookup:function(key,context){return this.options.call?this.options.call(key,context):this.bindings[key]},constructor:Keymap},Keymap.keyName=keyName,Keymap.isModifierKey=isModifierKey,Keymap.normalizeKeyName=normalizeKeyName,Keymap})},{}],58:[function(require,module,exports){module.exports=function(element,fn){function resizeListener(e){var win=e.target||e.srcElement;win.__resizeRAF__&&cancelFrame(win.__resizeRAF__),win.__resizeRAF__=requestFrame(function(){var trigger=win.__resizeTrigger__;trigger.__resizeListeners__.forEach(function(fn){fn.call(trigger,e)})})}function objectLoad(e){this.contentDocument.defaultView.__resizeTrigger__=this.__resizeElement__,this.contentDocument.defaultView.addEventListener("resize",resizeListener)}var window=this,document=window.document,attachEvent=document.attachEvent;if("undefined"!=typeof navigator)var isIE=navigator.userAgent.match(/Trident/);var requestFrame=function(){var raf=window.requestAnimationFrame||window.mozRequestAnimationFrame||window.webkitRequestAnimationFrame||function(fn){return window.setTimeout(fn,20)};return function(fn){return raf(fn)}}(),cancelFrame=function(){var cancel=window.cancelAnimationFrame||window.mozCancelAnimationFrame||window.webkitCancelAnimationFrame||window.clearTimeout;return function(id){return cancel(id)}}();if(!element.__resizeListeners__)if(element.__resizeListeners__=[],attachEvent)element.__resizeTrigger__=element,element.attachEvent("onresize",resizeListener);else{"static"==getComputedStyle(element).position&&(element.style.position="relative");var obj=element.__resizeTrigger__=document.createElement("object");obj.setAttribute("style","display: block; position: absolute; top: 0; left: 0; height: 100%; width: 100%; overflow: hidden; pointer-events: none; z-index: -1;"),obj.setAttribute("class","resize-sensor"),obj.__resizeElement__=element,obj.onload=objectLoad,obj.type="text/html",isIE&&element.appendChild(obj),obj.data="about:blank",isIE||element.appendChild(obj)}element.__resizeListeners__.push(fn)}},{}],59:[function(require,module,exports){"use strict";function fleschKincaid(counts){return counts&&counts.sentence&&counts.word&&counts.syllable?SENTENCE_WEIGHT*(counts.word/counts.sentence)+WORD_WEIGHT*(counts.syllable/counts.word)-ADJUSTMENT:NaN}var SENTENCE_WEIGHT,WORD_WEIGHT,ADJUSTMENT;SENTENCE_WEIGHT=.39,WORD_WEIGHT=11.8,ADJUSTMENT=15.59,module.exports=fleschKincaid},{}],60:[function(require,module,exports){"use strict";function flesch(counts){return counts&&counts.sentence&&counts.word&&counts.syllable?BASE-SENTENCE_WEIGHT*(counts.word/counts.sentence)-WORD_WEIGHT*(counts.syllable/counts.word):NaN}var SENTENCE_WEIGHT,WORD_WEIGHT,BASE;SENTENCE_WEIGHT=1.015,WORD_WEIGHT=84.6,BASE=206.835,module.exports=flesch},{}],61:[function(require,module,exports){function constructByRe(){return byRe=new RegExp(re.toString().slice(1,-3)+"\\s*by\\b","gi")}var byRe,irregulars=["awoken","been","born","beat","become","begun","bent","beset","bet","bid","bidden","bound","bitten","bled","blown","broken","bred","brought","broadcast","built","burnt","burst","bought","cast","caught","chosen","clung","come","cost","crept","cut","dealt","dug","dived","done","drawn","dreamt","driven","drunk","eaten","fallen","fed","felt","fought","found","fit","fled","flung","flown","forbidden","forgotten","foregone","forgiven","forsaken","frozen","gotten","given","gone","ground","grown","hung","heard","hidden","hit","held","hurt","kept","knelt","knit","known","laid","led","leapt","learnt","left","lent","let","lain","lighted","lost","made","meant","met","misspelt","mistaken","mown","overcome","overdone","overtaken","overthrown","paid","pled","proven","put","quit","read","rid","ridden","rung","risen","run","sawn","said","seen","sought","sold","sent","set","sewn","shaken","shaven","shorn","shed","shone","shod","shot","shown","shrunk","shut","sung","sunk","sat","slept","slain","slid","slung","slit","smitten","sown","spoken","sped","spent","spilt","spun","spit","split","spread","sprung","stood","stolen","stuck","stung","stunk","stridden","struck","strung","striven","sworn","swept","swollen","swum","swung","taken","taught","torn","told","thought","thrived","thrown","thrust","trodden","understood","upheld","upset","woken","worn","woven","wed","wept","wound","won","withheld","withstood","wrung","written"],exceptions=["indeed"],re=new RegExp("\\b(am|are|were|being|is|been|was|be)\\b\\s*([\\w]+ed|"+irregulars.join("|")+")\\b","gi"); -module.exports=function(text,options){for(var r=options&&options.by?byRe||constructByRe():re,suggestions=[];match=r.exec(text);)-1===exceptions.indexOf(match[2].toLowerCase())&&suggestions.push({index:match.index,offset:match[0].length});return suggestions}},{}],62:[function(require,module,exports){module.exports={stats:function(text){var data;return text.length&&(data={sentences:this.sentences(text),words:this.words(text),syllables:this.syllables(text),characters:this.characters(text),carpar:this.charactersWords(text),gulpease:this.gulpease(text),gunningFog:this.gunningFog(text)}),data},findSentences:function(text){var sentence,sentences,result,_i,_len;for(sentences=text.split("."),result=[],_i=0,_len=sentences.length;_len>_i;_i++)sentence=sentences[_i],""!==sentence.trim()&&result.push(sentence);return result},sentences:function(text){return this.findSentences(text).length},findWords:function(sentence){return sentence.match(/[A-z\u00E0-\u00FC]+/g)},words:function(sentence){return this.findWords(sentence).length},findSyllables:function(word){return word=word.toLowerCase(),word.length<=3?1:(word=word.replace(/(?:[^laeiouy]es|ed|[^laeiouy]e)$/,""),word=word.replace(/^y/,""),word.match(/[aeiouy]{1,2}/g))},syllables:function(word){return this.findSyllables(word).length},characters:function(sentence){var word,tot,_i,_len;for(sentence=this.findWords(sentence),tot=0,_i=0,_len=sentence.length;_len>_i;_i++)word=sentence[_i],null!==word&&(tot+=word.length);return tot},charactersWords:function(sentence){var result,tot;return tot=this.characters(sentence),result=tot/this.words(sentence),result.toFixed(1)},gulpease:function(text){var _characters,_sentences,_words,_result;return _sentences=this.sentences(text),_characters=this.characters(text),_words=this.words(text),_result=89+(300*_sentences-10*_characters)/_words,parseInt(_result,10)},gunningFog:function(text){var word,_sentences,_i,_len,_words,_wordsComplesse,_result;for(_sentences=this.sentences(text),_words=this.words(text),_wordsComplesse=0,_i=0,_len=_words.length;_len>_i;_i++)word=_words[_i],this.syllables(word)>2&&(_wordsComplesse+=1);return _result=.4*(_words/_sentences+100*(_wordsComplesse/_words)),parseInt(_result,10)}}},{}],63:[function(require,module,exports){"use strict";function setCommentStyle(type){place.innerHTML="","peer"==type?(place.className="peer",pmOptions.commands=_schema.commentOnlyCommands,pmOptions.menuBar=_schema.commentMenuBar,pm=window.pm=new _edit.ProseMirror(pmOptions),pm.on("filterTransform",function(){return!0}),(0,_tool.initComments)(pm)):(place.className="",pmOptions.commands=_schema.commentCommands,pmOptions.menuBar=_schema.mainMenuBar,pm=window.pm=new _edit.ProseMirror(pmOptions),(0,_tool.initComments)(pm,!0))}var _edit=require("prosemirror/dist/edit");require("prosemirror/dist/model");require("prosemirror/dist/menu/tooltipmenu"),require("prosemirror/dist/menu/menubar"),require("prosemirror/dist/inputrules/autoinput");var _schema=require("./schema"),_tool=require("./widgets/tool"),pm=void 0,place=document.querySelector("#editor"),content=document.querySelector("#content"),commentStyle=document.querySelector("#commentstyle");commentStyle.value="peer";var pmOptions={place:place,schema:_schema.widgetSchema,autoInput:!0,doc:content,docFormat:"dom"};setCommentStyle(place.getAttribute("commentstyle")||"peer"),commentStyle&&commentStyle.addEventListener("change",function(){return setCommentStyle(commentStyle.value)})},{"./schema":64,"./widgets/tool":97,"prosemirror/dist/edit":11,"prosemirror/dist/inputrules/autoinput":24,"prosemirror/dist/menu/menubar":28,"prosemirror/dist/menu/tooltipmenu":29,"prosemirror/dist/model":34}],64:[function(require,module,exports){"use strict";Object.defineProperty(exports,"__esModule",{value:!0}),exports.grammarCommands=exports.commentOnlyCommands=exports.noCommands=exports.commentCommands=exports.commands=exports.commentMenuBar=exports.grammarMenuBar=exports.mainMenuBar=exports.widgetSchema=void 0;var _edit=require("prosemirror/dist/edit"),_dom=require("prosemirror/dist/dom"),_menu=require("prosemirror/dist/menu/menu"),_model=require("prosemirror/dist/model"),_questions=require("./widgets/questions"),_input=require("./widgets/input"),_content=require("./widgets/content"),_widgets=require("./widgets"),_tool=require("./widgets/tool"),widgetSpec=new _model.SchemaSpec({doc:_model.Doc,blockquote:_model.BlockQuote,ordered_list:_model.OrderedList,bullet_list:_model.BulletList,list_item:_model.ListItem,paragraph:_model.Paragraph,heading:_model.Heading,text:_model.Text,hard_break:_model.HardBreak,input:_input.Input,checkbox:_input.CheckBox,radiobutton:_input.RadioButton,select:_input.Select,textfield:_input.TextField,textarea:_input.TextArea,question:_questions.Question,textbox:_questions.TextBox,choice:_questions.Choice,multiplechoice:_questions.MultipleChoice,scaledisplay:_questions.ScaleDisplay,scale:_questions.Scale,checkitem:_questions.CheckItem,checklist:_questions.CheckList,shortanswer:_questions.ShortAnswer,essay:_questions.Essay,selection:_questions.Selection,horizontal_rule:_model.HorizontalRule,image:_content.Image,inlinemath:_content.InlineMath,blockmath:_content.BlockMath,website:_content.Website,carryforward:_content.CarryForward,spreadsheet:_content.SpreadSheet,graph:_content.Graph,leftalign:_widgets.LeftAlign,centeralign:_widgets.CenterAlign,rightalign:_widgets.RightAlign},{em:_model.EmMark,strong:_model.StrongMark,link:_model.LinkMark,code:_model.CodeMark,underline:_widgets.UnderlineMark,strikethrough:_widgets.StrikeThroughMark});exports.widgetSchema=new _model.Schema(widgetSpec),exports.mainMenuBar={"float":!0,content:[[_menu.inlineGroup,_menu.insertMenu],[_menu.blockGroup,_menu.textblockMenu],_widgets.alignGroup,[_widgets.contentInsertMenu,_widgets.questionInsertMenu],_widgets.toolGroup,_menu.historyGroup]},exports.grammarMenuBar={"float":!0,content:[[_menu.inlineGroup,_menu.insertMenu],[_menu.blockGroup,_menu.textblockMenu],_widgets.alignGroup,[_widgets.contentInsertMenu,_widgets.questionInsertMenu],_widgets.toolGroup,_menu.historyGroup]},exports.commentMenuBar={"float":!0,content:[_widgets.toolGroup]};_menu.textblockMenu.options.label="Format";var strongIcon={type:"icon",width:805,height:1024,path:"M317 869q42 18 80 18 214 0 214-191 0-65-23-102-15-25-35-42t-38-26-46-14-48-6-54-1q-41 0-57 5 0 30-0 90t-0 90q0 4-0 38t-0 55 2 47 6 38zM309 442q24 4 62 4 46 0 81-7t62-25 42-51 14-81q0-40-16-70t-45-46-61-24-70-8q-28 0-74 7 0 28 2 86t2 86q0 15-0 45t-0 45q0 26 0 39zM0 950l1-53q8-2 48-9t60-15q4-6 7-15t4-19 3-18 1-21 0-19v-37q0-561-12-585-2-4-12-8t-25-6-28-4-27-2-17-1l-2-47q56-1 194-6t213-5q13 0 39 0t38 0q40 0 78 7t73 24 61 40 42 59 16 78q0 29-9 54t-22 41-36 32-41 25-48 22q88 20 146 76t58 141q0 57-20 102t-53 74-78 48-93 27-100 8q-25 0-75-1t-75-1q-60 0-175 6t-132 6z"},emIcon={type:"icon",width:585,height:1024,path:"M0 949l9-48q3-1 46-12t63-21q16-20 23-57 0-4 35-165t65-310 29-169v-14q-13-7-31-10t-39-4-33-3l10-58q18 1 68 3t85 4 68 1q27 0 56-1t69-4 56-3q-2 22-10 50-17 5-58 16t-62 19q-4 10-8 24t-5 22-4 26-3 24q-15 84-50 239t-44 203q-1 5-7 33t-11 51-9 47-3 32l0 10q9 2 105 17-1 25-9 56-6 0-18 0t-18 0q-16 0-49-5t-49-5q-78-1-117-1-29 0-81 5t-69 6z"},noCommands=(exports.commands=_edit.CommandSet["default"].update({selectParentNode:{menu:null},lift:{menu:null},"code:toggle":{menu:{group:"textblock",rank:99,select:"disable",display:{type:"label",label:"Code"}}},"strong:toggle":{menu:{group:"inline",rank:20,select:"disable",display:strongIcon}},"em:toggle":{menu:{group:"inline",rank:21,select:"disable",display:emIcon}}}),exports.commentCommands=_edit.CommandSet["default"].update({selectParentNode:{menu:null},lift:{menu:null},"code:toggle":{menu:{group:"textblock",rank:99,select:"disable",display:{type:"label",label:"Code"}}},"strong:toggle":{menu:{group:"inline",rank:20,select:"disable",display:strongIcon}},"em:toggle":{menu:{group:"inline",rank:21,select:"disable",display:emIcon}},comment:_tool.commentCmdSpec}),exports.noCommands=new _edit.CommandSet(null,function(){return null}));exports.commentOnlyCommands=noCommands.update({comment:_tool.commentCmdSpec}),exports.grammarCommands=_edit.CommandSet["default"].update({selectParentNode:{menu:null},lift:{menu:null},"code:toggle":{menu:{group:"textblock",rank:99,select:"disable",display:{type:"label",label:"Code"}}},"strong:toggle":{menu:{group:"inline",rank:20,select:"disable",display:strongIcon}},"em:toggle":{menu:{group:"inline",rank:21,select:"disable",display:emIcon}},analyze:_tool.analyzeCmdSpec});(0,_dom.insertCSS)('\n \n.ProseMirror {\n}\n\n.ProseMirror-menu {\n background: white;\n color: black;\n}\n\ndiv.ProseMirror-dropdown-menu {\n position: absolute;\n background: white;\n color: black;\n border-radius: 6px;\n border: 1px solid silver;\n padding: 2px 2px;\n z-index: 15;\n}\n\ndiv.ProseMirror-dropdown-menu {\n cursor: pointer;\n padding: 0 1em 0 2px;\n}\n\ndiv.ProseMirror-menubar-inner {\n background: linear-gradient(to bottom, white, #0191C8);\n}\n\ndiv.ProseMirror-menu form {\n background: linear-gradient(to bottom, white, #0191C8);\n width: 300px;\n}\n\ndiv.ProseMirror-menu form select {\n width: 100px;\n background: white;\n}\n\ndiv.ProseMirror-menu input[type = "text"] {\n background: white;\n}\n\n')},{"./widgets":78,"./widgets/content":71,"./widgets/input":80,"./widgets/questions":88,"./widgets/tool":97,"prosemirror/dist/dom":1,"prosemirror/dist/edit":11,"prosemirror/dist/menu/menu":27,"prosemirror/dist/model":34}],65:[function(require,module,exports){"use strict";function defParser(type,tag,cls){type.register("parseDOM",tag,{parse:function(dom,state){if(!dom.classList.contains(cls))return!1;var attrs=Object.create(null);for(var name in this.attrs)attrs[name]=dom.getAttribute(name);state.wrapIn(dom,this,attrs)}})}function getPosInParent(pm,pos,child){var i=0,parent=pm.doc.path(pos.path);return parent.forEach(function(node,start,end){node==child&&(i=start)}),new _model.Pos(pos.path,i)}function nodeBefore(pm,pos){for(var before=void 0,cut=void 0,i=pos.path.length-1;!before&&i>=0;i--)pos.path[i]>0&&(cut=pos.shorten(i),before=pm.doc.path(cut.path).child(cut.offset-1));return{before:before,at:new _model.Pos(cut.path,cut.offset-1)}}function getID(){return Math.floor(4294967295*Math.random())}function getTopPos(pos){for(;;){if(0==pos.depth)return pos;pos=pos.shorten(null,1)}}function getBlockPos(pm,pos){for(;;){if(0==pos.depth)return pos;var node=pm.doc.path(pos.path);if(node.isBlock){var p=getPosInParent(pm,pos.shorten(),node);return pos.offset?p.move(1):p}pos=pos.shorten(null,1)}}function insertQuestion(pm,pos,q){var p=getTopPos(pos);pm.tr.insert(p,q).apply(pm.apply.scroll);var side=getPosInParent(pm,p,q);return p=new _model.Pos(side.toPath(),0),q.firstChild&&q.firstChild.isTextblock&&pm.setTextSelection(new _model.Pos(p.toPath(),0)),!0}function insertWidget(pm,pos,w){return pm.tr.insert(getBlockPos(pm,pos),w).apply(pm.apply.scroll)}function addDropListeners(pm){pm.content.addEventListener("drop",function(e){return!1})}Object.defineProperty(exports,"__esModule",{value:!0}),exports.onResize=exports.selectedNodeAttr=exports.defParamsClick=exports.nameTitle=exports.namePattern=exports.defineFileHandler=exports.widgetParamHandler=void 0;var _params=require("./params");Object.defineProperty(exports,"widgetParamHandler",{enumerable:!0,get:function(){return _params.widgetParamHandler}}),Object.defineProperty(exports,"defineFileHandler",{enumerable:!0,get:function(){return _params.defineFileHandler}}),Object.defineProperty(exports,"namePattern",{enumerable:!0,get:function(){return _params.namePattern}}),Object.defineProperty(exports,"nameTitle",{enumerable:!0,get:function(){return _params.nameTitle}}),Object.defineProperty(exports,"defParamsClick",{enumerable:!0,get:function(){return _params.defParamsClick}}),Object.defineProperty(exports,"selectedNodeAttr",{enumerable:!0,get:function(){return _params.selectedNodeAttr}}),exports.defParser=defParser,exports.getPosInParent=getPosInParent,exports.nodeBefore=nodeBefore,exports.getID=getID,exports.getTopPos=getTopPos,exports.getBlockPos=getBlockPos,exports.insertQuestion=insertQuestion,exports.insertWidget=insertWidget,exports.addDropListeners=addDropListeners;var _model=require("prosemirror/dist/model");require("prosemirror/dist/edit/selection"),exports.onResize=require("prosemirror/node_modules/element-resize-event/index.js")},{"./params":66,"prosemirror/dist/edit/selection":17,"prosemirror/dist/model":34,"prosemirror/node_modules/element-resize-event/index.js":58}],66:[function(require,module,exports){"use strict";function _classCallCheck(instance,Constructor){if(!(instance instanceof Constructor))throw new TypeError("Cannot call a class as a function")}function _possibleConstructorReturn(self,call){if(!self)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return!call||"object"!=typeof call&&"function"!=typeof call?self:call}function _inherits(subClass,superClass){if("function"!=typeof superClass&&null!==superClass)throw new TypeError("Super expression must either be null or a function, not "+typeof superClass);subClass.prototype=Object.create(superClass&&superClass.prototype,{constructor:{value:subClass,enumerable:!1,writable:!0,configurable:!0}}),superClass&&(Object.setPrototypeOf?Object.setPrototypeOf(subClass,superClass):subClass.__proto__=superClass)}function defineFileHandler(handler){fhandler=handler}function getLastClicked(){return lastClicked}function openWidgetPrompt(wpp,options){var close=function close(){wpp.pm.off("interaction",close),dialog.parentNode&&(dialog.parentNode.removeChild(dialog),options&&options.onClose&&options.onClose())},submit=function(){var params=wpp.values();params&&(wpp.command.exec(wpp.pm,params),close())};wpp.pm.on("interaction",close);var save=(0,_dom.elt)("input",{name:"save",type:"button",value:"Save"});save.addEventListener("mousedown",function(e){submit()});var cancel=(0,_dom.elt)("input",{name:"cancel",type:"button",value:"Cancel"});cancel.addEventListener("mousedown",function(e){e.preventDefault(),e.stopPropagation(),close()});var buttons=(0,_dom.elt)("div",{"class":"widgetButtons"},save,cancel);wpp.form=(0,_dom.elt)("form",{"class":"widgetForm"},(0,_dom.elt)("h4",null,wpp.command.label+" Settings"),wpp.fields.map(function(f){return(0,_dom.elt)("div",null,f)}),buttons),wpp.form.addEventListener("keypress",function(e){13==e.keyCode&&(e.preventDefault(),e.stopPropagation(),save.click())});var dialog=(0,_dom.elt)("div",null,(0,_dom.elt)("div",{"class":"widgetDialog"}),wpp.form);return wpp.pm.wrapper.appendChild(dialog),{close:close}}function selectClickedNode(pm,e){var pos=(0,_dompos.selectableNodeAbove)(pm,e.target,{left:e.clientX,top:e.clientY},!0);if(!pos)return pm.sel.fastPoll();var _pm$selection=pm.selection,node=_pm$selection.node,from=_pm$selection.from;if(node&&pos.depth>=from.depth&&0==pos.shorten(from.depth).cmp(from)){if(0==from.depth)return pm.sel.fastPoll();pos=from.shorten()}pm.setNodeSelection(pos),lastClicked=e.target}function defParamsClick(type,cmdname){var spots=arguments.length<=2||void 0===arguments[2]?["topright"]:arguments[2];type.prototype.handleClick=function(pm,e,path,node){selectClickedNode(pm,e);var spotClicked=!1;if(spots.forEach(function(loc){var r=e.target.getBoundingClientRect();"all"==loc?spotClicked=!0:"topright"==loc?spotClicked=spotClicked||e.clientX>r.right-16&&e.clientYr.right-32&&e.clientY>r.bottom-32)}),spotClicked){var cmd=pm.commands[cmdname];return cmd?(cmd.exec(pm),!0):!1}}}function selectedNodeAttr(pm,type,name){var node=pm.selection.node;return node&&node.type==type?node.attrs[name]:void 0}function FileDragHover(e){e.stopPropagation(),e.preventDefault(),e.target.className="dragover"==e.type?"hover":""}function buildUploadForm(pm,field){var legend=(0,_dom.elt)("h4",null,"File Upload"),label=((0,_dom.elt)("input",{type:"hidden",id:"MAX_FILE_SIZE",name:"MAX_FILE_SIZE",value:"300000"}),(0,_dom.elt)("label",{"for":"fileselect"},"File to upload:")),fileselect=(0,_dom.elt)("input",{id:"fileselect",type:"file",name:"fileselect[]",multiple:"multiple"}),filedrag=(0,_dom.elt)("div",{id:"filedrag"},"or drop files here"),cancel=(0,_dom.elt)("input",{type:"button",value:"Cancel"});cancel.addEventListener("click",function(e){e.preventDefault(),e.stopPropagation(),pm.wrapper.removeChild(form)});var saveFile=function(e){e.preventDefault(),e.stopPropagation(),FileDragHover(e);var files=e.target.files||e.dataTransfer.files;files&&(field.value=files[0].name),fhandler&&fhandler(files),pm.wrapper.removeChild(form)};fileselect.addEventListener("change",saveFile);var xhr=new XMLHttpRequest;xhr.upload&&(filedrag.addEventListener("dragover",FileDragHover),filedrag.addEventListener("dragleave",FileDragHover),filedrag.addEventListener("drop",saveFile),filedrag.style.display="block");var form=(0,_dom.elt)("form",{id:"upload",enctype:"multipart/form-data"},legend,(0,_dom.elt)("div",null,label,fileselect,filedrag),(0,_dom.elt)("div",null,cancel));pm.wrapper.appendChild(form)}var _createClass=function(){function defineProperties(target,props){for(var i=0;i0)return pm.tr["delete"](from,to).apply(pm.apply.scroll);var toCL=toCI.shorten(),cl=pm.doc.path(toCL.path),_nodeBefore=(0,_utils.nodeBefore)(pm,toCI),before=_nodeBefore.before;_nodeBefore.at;if(2==cl.size||before.type!=this||ci.lastChild.size>0)return!0;var tr=pm.tr["delete"](toCL,toCL.move(1)).apply(pm.apply.scroll);return renumber(pm,toCL),tr},keys:["Backspace(10)","Mod-Backspace(10)"]}),CheckList.register("command","insert",{label:"Check List",run:function(pm,name,title){var _pm$selection3=pm.selection,from=_pm$selection3.from,node=(_pm$selection3.to,_pm$selection3.node),attrs={name:name,title:title};if(node&&node.type==this){var tr=pm.tr.setNodeType(from,this,attrs).apply();return renumber(pm,_model.Pos.from(from.toPath().concat(from.offset),0)),tr}return(0,_utils.insertQuestion)(pm,from,this.create(attrs))},select:function(pm){return!0},menu:{group:"question",rank:70,display:{type:"label",label:"CheckList"}},params:[{name:"Name",attr:"name",label:"Short ID",type:"text",prefill:function(pm){return(0,_utils.selectedNodeAttr)(pm,this,"name")},options:{pattern:_utils.namePattern,size:10,title:_utils.nameTitle}},{name:"Title",attr:"title",label:"(optional)",type:"text","default":"",prefill:function(pm){return(0,_utils.selectedNodeAttr)(pm,this,"title")},options:{required:""}}]}),(0,_utils.defParamsClick)(CheckList,"checklist:insert"),(0,_dom.insertCSS)("\n\n.ProseMirror ."+cssi+" {\n cursor: text;\n}\n\n.ProseMirror ."+cssi+" input {\n float: left;\n}\n\n\n")},{"../../utils":65,"./question":90,"./textbox":94,"prosemirror/dist/dom":1,"prosemirror/dist/model":34}],87:[function(require,module,exports){"use strict";function _classCallCheck(instance,Constructor){if(!(instance instanceof Constructor))throw new TypeError("Cannot call a class as a function")}function _possibleConstructorReturn(self,call){if(!self)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return!call||"object"!=typeof call&&"function"!=typeof call?self:call}function _inherits(subClass,superClass){if("function"!=typeof superClass&&null!==superClass)throw new TypeError("Super expression must either be null or a function, not "+typeof superClass);subClass.prototype=Object.create(superClass&&superClass.prototype,{constructor:{value:subClass,enumerable:!1,writable:!0,configurable:!0}}),superClass&&(Object.setPrototypeOf?Object.setPrototypeOf(subClass,superClass):subClass.__proto__=superClass)}var _createClass=function(){function defineProperties(target,props){for(var i=0;i0)return pm.tr["delete"](from,to).apply(pm.apply.scroll);var toMC=toCH.shorten(),mc=pm.doc.path(toMC.path),_nodeBefore=(0,_utils.nodeBefore)(pm,toCH),before=_nodeBefore.before;_nodeBefore.at;if(2==mc.size||before.type!=this||ch.lastChild.size>0)return!0;var tr=pm.tr["delete"](toMC,toMC.move(1)).apply(pm.apply.scroll);return renumber(pm,toMC),tr},keys:["Backspace(10)","Mod-Backspace(10)"]}),MultipleChoice.register("command","insert",{label:"MultipleChoice",run:function(pm,name,title){var _pm$selection3=pm.selection,from=_pm$selection3.from,node=(_pm$selection3.to,_pm$selection3.node),attrs={name:name,title:title,value:1};if(node&&node.type==this){var tr=pm.tr.setNodeType(from,this,attrs).apply();return renumber(pm,_model.Pos.from(from.toPath().concat(from.offset),0)),tr}return(0,_utils.insertQuestion)(pm,from,this.create(attrs))},select:function(pm){return!0},menu:{group:"question",rank:70,display:{type:"label",label:"MultipleChoice"}},params:[{name:"Name",attr:"name",label:"Short ID",type:"text",prefill:function(pm){return(0,_utils.selectedNodeAttr)(pm,this,"name")},options:{pattern:_utils.namePattern,size:10,title:_utils.nameTitle}},{name:"Title",attr:"title",label:"(optional)",type:"text","default":"",prefill:function(pm){return(0,_utils.selectedNodeAttr)(pm,this,"title")},options:{required:""}}]}),(0,_utils.defParamsClick)(MultipleChoice,"multiplechoice:insert"),(0,_dom.insertCSS)("\n\n."+cssc+" input {\n float: left;\n}\n\n.ProseMirror ."+cssc+":hover {\n cursor: text;\n}\n\n")},{"../../utils":65,"./question":90,"prosemirror/dist/dom":1,"prosemirror/dist/model":34}],90:[function(require,module,exports){"use strict";function _classCallCheck(instance,Constructor){if(!(instance instanceof Constructor))throw new TypeError("Cannot call a class as a function")}function _possibleConstructorReturn(self,call){if(!self)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return!call||"object"!=typeof call&&"function"!=typeof call?self:call}function _inherits(subClass,superClass){if("function"!=typeof superClass&&null!==superClass)throw new TypeError("Super expression must either be null or a function, not "+typeof superClass);subClass.prototype=Object.create(superClass&&superClass.prototype,{constructor:{value:subClass,enumerable:!1,writable:!0,configurable:!0}}),superClass&&(Object.setPrototypeOf?Object.setPrototypeOf(subClass,superClass):subClass.__proto__=superClass)}function setChildAttrs(pm,pos,type,attrs){return pm.doc.path(pos.path).forEach(function(node,start){return node.type.name==type?pm.tr.setNodeType(new _model.Pos(pos.path,start),node.type,attrs).apply():void 0}),!1}var _createClass=function(){function defineProperties(target,props){for(var i=0;i0||"paragraph"!=para.type.name)return!1;from=from.shorten();var parent=pm.doc.path(from.path);return parent.type instanceof Question?parent.firstChild==para:!1},keys:["Backspace(10)","Mod-Backspace(10)"]}),Question.register("command","enter",{label:"process enter",run:function(pm){var _pm$selection2=pm.selection,from=_pm$selection2.from,node=_pm$selection2.node,para=pm.doc.path(from.path);if(node&&node.type instanceof Question){var _parent=pm.doc.path(from.path);if(_parent.lastChild==node||!_parent.child(from.offset+1).isTextblock){var side=from.move(1);pm.tr.insert(side,pm.schema.defaultTextblockType().create()).apply(pm.apply.scroll),pm.setTextSelection(new _model.Pos(side.toPath(),0))}return!0}if(from.offset>0||"paragraph"!=para.type.name)return!1;var parent=pm.doc.path(from.shorten().path);return parent.type instanceof Question},keys:["Enter(10)","Mod-Enter(10)"]}),(0,_dom.insertCSS)("\n \n."+css+" {\n counter-increment: qcnt;\n border: 1px solid #DDD;\n border-radius: 4px;\n padding: 8px;\n margin-top: 1em;\n}\n\n."+css+':before {\n content: counter(qcnt)"." attr(title);\n font-size: 80%;\n font-weight: bold;\n cursor: grabbing;\n}\n\n.ProseMirror .'+css+" p:hover {\n cursor: text;\n}\n\n")},{"../../utils":65,"prosemirror/dist/dom":1,"prosemirror/dist/model":34,"prosemirror/dist/transform":40}],91:[function(require,module,exports){"use strict";function _classCallCheck(instance,Constructor){if(!(instance instanceof Constructor))throw new TypeError("Cannot call a class as a function")}function _possibleConstructorReturn(self,call){if(!self)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return!call||"object"!=typeof call&&"function"!=typeof call?self:call}function _inherits(subClass,superClass){if("function"!=typeof superClass&&null!==superClass)throw new TypeError("Super expression must either be null or a function, not "+typeof superClass);subClass.prototype=Object.create(superClass&&superClass.prototype,{constructor:{value:subClass,enumerable:!1,writable:!0,configurable:!0}}),superClass&&(Object.setPrototypeOf?Object.setPrototypeOf(subClass,superClass):subClass.__proto__=superClass)}var _get=function get(object,property,receiver){null===object&&(object=Function.prototype);var desc=Object.getOwnPropertyDescriptor(object,property);if(void 0===desc){var parent=Object.getPrototypeOf(object);return null===parent?void 0:get(parent,property,receiver)}if("value"in desc)return desc.value;var getter=desc.get;if(void 0!==getter)return getter.call(receiver)},_createClass=function(){function defineProperties(target,props){for(var i=0;istartVal?setOutputValue=function(val){out.value=val}:!function(){var max=startVal;setOutputValue=function(val){out.value=max-val},endVal=startVal-endVal,startVal=0}();var range=(0,_dom.elt)("input",{"class":"widgets-input",value:mid,name:node.attrs.name,id:node.attrs.name,type:"range",min:startVal,max:endVal,contenteditable:!1});return range.addEventListener("input",function(e){e.stopPropagation(),setOutputValue(e.originalTarget.valueAsNumber)}),(0,_dom.elt)("div",node.attrs,(0,_dom.elt)("span",null,node.attrs.startlabel),range,(0,_dom.elt)("span",null,node.attrs.endlabel),out)};var Scale=exports.Scale=function(_Question){function Scale(){return _classCallCheck(this,Scale),_possibleConstructorReturn(this,Object.getPrototypeOf(Scale).apply(this,arguments))}return _inherits(Scale,_Question),_createClass(Scale,[{key:"defaultContent",value:function(attrs){return _model.Fragment.from([this.schema.nodes.paragraph.create(null,""),this.schema.nodes.scaledisplay.create(attrs)])}},{key:"create",value:function(attrs,content,marks){return content||(content=this.defaultContent(attrs)),_get(Object.getPrototypeOf(Scale.prototype),"create",this).call(this,attrs,content,marks)}},{key:"attrs",get:function(){return{name:new _model.Attribute,title:new _model.Attribute({"default":""}),startvalue:new _model.Attribute({"default":"1"}),startlabel:new _model.Attribute({"default":"low"}),endvalue:new _model.Attribute({"default":"10"}),endlabel:new _model.Attribute({"default":"high"}),"class":new _model.Attribute({"default":"widgets-scale "+_question.qclass})}}}],[{key:"contains",get:function(){return"text"}}]),Scale}(_question.Question);(0,_utils.defParser)(Scale,"div",cssd),(0,_utils.defParser)(Scale,"div",csss),Scale.register("command","insert",{label:"Scale",run:function(pm,name,title,startvalue,startlabel,endvalue,endlabel){var _pm$selection=pm.selection,from=_pm$selection.from,node=(_pm$selection.to,_pm$selection.node),attrs={name:name,title:title,startvalue:startvalue,startlabel:startlabel,endvalue:endvalue,endlabel:endlabel};return node&&node.type==this?(pm.tr.setNodeType(from,this,attrs).apply(pm.apply.scroll),from=new _model.Pos(from.path.concat(from.offset),0),(0,_question.setChildAttrs)(pm,from,"scaledisplay",attrs)):(0,_utils.insertQuestion)(pm,from,this.create(attrs))},menu:{group:"question",rank:74,display:{type:"label",label:"Scale"}},params:[{name:"Name",attr:"name",label:"Short ID",type:"text",prefill:function(pm){return(0,_utils.selectedNodeAttr)(pm,this,"name")},options:{pattern:_utils.namePattern,size:10,title:_utils.nameTitle}},{name:"Title",attr:"title",label:"(optional)",type:"text","default":"",prefill:function(pm){return(0,_utils.selectedNodeAttr)(pm,this,"title")},options:{required:""}},{label:"Start value",attr:"startvalue",type:"number","default":1,prefill:function(pm){return(0,_utils.selectedNodeAttr)(pm,this,"startvalue")}},{name:"Start Label",attr:"startlabel",label:"Text on left",type:"text","default":"low",prefill:function(pm){return(0,_utils.selectedNodeAttr)(pm,this,"startlabel")}},{label:"End value",attr:"endvalue",type:"number","default":10,prefill:function(pm){return(0,_utils.selectedNodeAttr)(pm,this,"endvalue")}},{name:"End Label",attr:"endlabel",label:"Text on right",type:"text","default":"high",prefill:function(pm){return(0,_utils.selectedNodeAttr)(pm,this,"endlabel")}}]}),(0,_utils.defParamsClick)(Scale,"scale:insert"),(0,_dom.insertCSS)("\n\n."+cssd+" {\n display: inline-block;\n text-align: center;\n font-size: 80%;\n}\n\n."+csss+" input {\n vertical-align: middle;\n display: inline;\n}\n\n."+csss+" output {\n vertical-align: middle;\n border-radius: 4px;\n text-align: right;\n height: 20px;\n border: 1px solid #AAA;\n display: inline;\n padding: 2px;\n margin: 4px;\n background: white;\n}\n\n."+csss+" span {\n vertical-align: middle;\n font-weight: normal;\n display: inline;\n}\n\n."+csss+" div {\n display: inline-block;\n padding: 4px;\n}\n\n."+csss+" input[type=range] {\n -webkit-appearance: none;\n border: 1px solid white;\n width: 200px;\n cursor: pointer;\n}\n."+csss+" input[type=range]::-webkit-slider-runnable-track {\n width: 200px;\n height: 5px;\n background: skyblue;\n border: none;\n border-radius: 3px;\n}\n."+csss+" input[type=range]::-webkit-slider-thumb {\n -webkit-appearance: none;\n border: none;\n height: 16px;\n width: 16px;\n border-radius: 50%;\n background: navy;\n margin-top: -4px;\n}\n."+csss+" input[type=range]:focus {\n outline: none;\n}\n."+csss+" input[type=range]:focus::-webkit-slider-runnable-track {\n background: #ccc;\n}\n\n."+csss+" input[type=range]::-moz-range-track {\n width: 200px;\n height: 5px;\n background: skyblue;\n border: none;\n border-radius: 3px;\n}\n."+csss+" input[type=range]::-moz-range-thumb {\n border: none;\n height: 16px;\n width: 16px;\n border-radius: 50%;\n background: navy;\n}\n\n."+csss+" input[type=range]:-moz-focusring{\n outline: 1px solid white;\n outline-offset: -1px;\n}\n\n."+csss+" input[type=range]::-ms-track {\n width: 200px;\n height: 5px;\n background: transparent;\n border-color: transparent;\n border-width: 6px 0;\n\n /*remove default tick marks*/\n color: transparent;\n}\n."+csss+" input[type=range]::-ms-fill-lower {\n background: ;\n border-radius: 10px;\n}\n."+csss+" input[type=range]::-ms-fill-upper {\n background: #ddd;\n border-radius: 10px;\n}\n."+csss+" input[type=range]::-ms-thumb {\n border: none;\n height: 16px;\n width: 16px;\n border-radius: 50%;\n background: navy;\n}\n."+csss+" input[type=range]:focus::-ms-fill-lower {\n background: #888;\n}\n."+csss+" input[type=range]:focus::-ms-fill-upper {\n background: #ccc;\n}\n")},{"../../utils":65,"./question":90,"prosemirror/dist/dom":1,"prosemirror/dist/model":34}],92:[function(require,module,exports){"use strict";function _classCallCheck(instance,Constructor){if(!(instance instanceof Constructor))throw new TypeError("Cannot call a class as a function")}function _possibleConstructorReturn(self,call){if(!self)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return!call||"object"!=typeof call&&"function"!=typeof call?self:call}function _inherits(subClass,superClass){if("function"!=typeof superClass&&null!==superClass)throw new TypeError("Super expression must either be null or a function, not "+typeof superClass);subClass.prototype=Object.create(superClass&&superClass.prototype,{constructor:{value:subClass,enumerable:!1,writable:!0,configurable:!0}}),superClass&&(Object.setPrototypeOf?Object.setPrototypeOf(subClass,superClass):subClass.__proto__=superClass)}var _createClass=function(){function defineProperties(target,props){for(var i=0;ir.right-16&&e.clientYtop&&(top=bottom),r.dom.style.top=top+"px",bottom=top+r.h+1})}},{key:"highlightComment",value:function(id){var c=comments[id];if(c){this.clearHighlight(),c.dom.className+=" select",this.highlight=c;var _c$range=c.range,from=_c$range.from,to=_c$range.to;pm.removeRange(c.range),c.range=pm.markRange(from,to,{className:c.getRangeClass(!0)})}}},{key:"clearHighlight",value:function(){if(this.highlight){var c=this.highlight;if(c.dom.className="comment",c.range){var r=c.range,from=r.from,to=r.to;pm.removeRange(r),c.range=pm.markRange(from,to,{className:c.getRangeClass(!1)})}this.highlight=null}}},{key:"getSelectionTop",value:function(){var from=pm.selection.from,r=pm.coordsAtPos(from),rect=pm.content.getBoundingClientRect();return Math.round(r.top-rect.top)}}]),CommentStore}();(0,_dom.insertCSS)('\n.comments {\n display: block;\n margin: 0 auto;\n width: 100%;\n height: 400px;\n}\n\n.comments .peer .ProseMirror-menubar {\n text-align: right;\n}\n\n.comments #editor {\n float: left;\n width: 70%;\n height: 100%;\n}\n\n.comments #comments {\n border: 1px solid #AAA;\n margin-left: 1px;\n padding: 0;\n height: 100%;\n width: 300px;\n display: inline-block;\n overflow-y: auto;\n position:relative;\n }\n\n\n.comments .comment-header {\n font-weight: bold;\n font-size: 80%;\n width: 100%;\n background: skyblue;\n color: white;\n margin: 0;\n padding: 2px 2px 0px 2px;\n border-bottom: 1px solid #AAA;\n display: inline-block;\n}\n \n.comments .newcomment {\n margin-left: 10px;\n display: inline-block;\n}\n\n.comments .newcomment a {\n padding: 0 4px 0 4px;\n background: skyblue;\n color: white;\n text-decoration: none;\n}\n\n.comments .newcomment a:hover {\n padding: 0 4px 0 4px;\n background: white;\n color: skyblue;\n cursor: pointer;\n}\n\n.comments .comment {\n background: white;\n border-radius: 6px;\n border: 1px solid #AAA;\n width: 92%;\n font-size: 90%;\n padding: 4px;\n min-height: 30px;\n position: absolute; \n left: 8px;\n}\n\n.comments .comment:after {\n content: \' \';\n height: 0;\n position: absolute;\n width: 0;\n border: 8px solid transparent;\n border-right-color: skyblue;\n left: -16px;\n top: 5px;\n}\n\n.comments .comment:hover {\n background-image: url(\'icons/menu.png\');\n background-repeat: no-repeat;\n background-position: top right;\n cursor: pointer;\n}\n\n.comments .select {\n border: 1px solid skyblue;\n}\n\n.comment-button {\n margin: 4px;\n padding: 2px;\n border-radius: 4px;\n border: 1px solid #AAA;\n background: skyblue;\n color: white;\n cursor: pointer;\n}\n\n.addComment {\n background: white;\n margin: 2px;\n border-radius: 6px;\n border: 1px solid #AAA;\n visibility: visible;\n font-size: 80%;\n padding: 4px;\n display: inline-block;\n position: absolute;\n left: 0;\n width: 93%;\n z-index: 100;\n}\n\n.addComment textarea {\n width: 95%;\n resize: none;\n margin: 4px;\n}\n\n.mode-comment {\n background: skyblue;\n}\n\n\n.mode-comment-select {\n background: dodgerblue;\n color: white;\n}\n\n.mode-delete {\n text-decoration: line-through;\n}\n\n.mode-delete-select {\n text-decoration: line-through;\n background: tomato;\n}\n\n.mode-insert:before {\n content: "^";\n font-width: bold;\n}\n\n.mode-insert-select:before {\n content: "^";\n background: turquoise;\n}\n\n.mode-replace {\n text-decoration: overline;\n}\n\n.mode-replace-select {\n text-decoration: overline;\n background: violet;\n}\n\n.commentMenu {\n font-size: 90%;\n border: 1px solid #AAA;\n display: none;\n position:relative;\n left: 180px;\n width: 60px;\n z-index: 100;\n cursor: pointer;\n}\n\n.commentMenu ul {\n display: block;\n list-style-type: none;\n margin: 0;\n padding: 0;\n overflow: hidden;\n background-color: white;\n}\n\n.commentMenu li {\n}\n\n.commentMenu li span {\n display: inline-block;\n color: black;\n padding: 1px;\n text-decoration: none;\n}\n\n.commentMenu li span:hover {\n background: skyblue;\n color: white;\n}\n\n.hide, .approval, .mode {\n display: none;\n}\n\n.show {\n display: block;\n}\n\n.approval, .mode {\n display: block;\n font-size: 85%;\n margin: 4px;\n}\n\n.approval span:first-child:after {\n content: "?";\n display: inline-block;\n font-weight: bold;\n}\n\n')},{"../../utils":65,"prosemirror/dist/dom":1,"prosemirror/dist/model":34,"prosemirror/dist/util/event":53}],96:[function(require,module,exports){"use strict";function _classCallCheck(instance,Constructor){if(!(instance instanceof Constructor))throw new TypeError("Cannot call a class as a function")}function clearRanges(){granges&&(granges.forEach(function(r){return pm.removeRange(r)}),granges=null)}function clearComments(){for(;comments.lastChild;)comments.removeChild(comments.lastChild);comments.appendChild((0,_dom.elt)("div",{"class":"comment-header"},"Comments"))}function clearPositions(){grammar.forEach(function(g){return g.clear()})}function getGrammar(f){grammar&&f(),grammar=[];var xmlhttp=new XMLHttpRequest;xmlhttp.onreadystatechange=function(){4==xmlhttp.readyState&&200==xmlhttp.status&&(JSON.parse(xmlhttp.responseText).forEach(function(g){grammar.push(new GrammarItem(g[0],g[1]))}),f())},xmlhttp.open("GET","grammar.json",!0),xmlhttp.send()}function scanGrammar(doc){function scan(node,offset){var updatePath=node.isBlock&&null!=offset;updatePath&&path.push(offset),node.isText&&grammar.forEach(function(g){for(var m=void 0;m=g.regexp.exec(node.text);)g.recordLoc(offset+m.index,offset+m.index+m[0].length,path)}),node.forEach(scan),updatePath&&path.pop()}clearComments(),clearRanges(),clearPositions();var result=[],path=[],text=doc.textContent,psv=getPassive(text);return psv&&grammar.push(psv),scan(doc),grammar.forEach(function(g){g.loc.length>0&&result.push(g)}),result.push(getStats(text)),psv&&grammar.pop(),result}function getStats(text){var stats=analyzer.stats(text),tstats={sentence:stats.sentences,word:stats.words,syllable:stats.syllables},fstat=flesch(tstats).toFixed(1),fkstat=fleschkincaid(tstats).toFixed(1),msg="There were "+stats.sentences+" sentences, "+stats.words+" words, and "+stats.syllables+" syllables. Flesch:"+fstat+", FleschKincaid:"+fkstat;return new GrammarItem("Summary Statistics",msg)}function getPassive(text){var passive=passivevoice(text);if(passive.length>0){var s="";return passive.forEach(function(loc){s+=text.substr(loc.index,loc.offset)+","}),s=s.slice(0,-1),new GrammarItem(s,"Passive voice can be hard to read. Can you make it active?")}return null}var _createClass=function(){function defineProperties(target,props){for(var i=0;i2?_len-2:0),_key=2;_len>_key;_key++)args[_key-2]=arguments[_key];for(var i=0;i0;i--){if(!(0,_char.isExtendingChar)(node.text.charAt(i-1)))return pos-1;offset--,pos--}else if("word"==by)for(var i=offset-start;i>0;i--){var nextCharCat=(0,_char.charCategory)(node.text.charAt(i-1));if(null==cat||1==counted&&"space"==cat)cat=nextCharCat;else if(cat!=nextCharCat)return pos;offset--,pos--,counted++}}}function moveForward(doc,pos,by){if("char"!=by&&"word"!=by)throw new RangeError("Unknown motion unit: "+by);for(var $pos=doc.resolve(pos),parent=$pos.parent,offset=$pos.parentOffset,cat=null,counted=0;;){if(offset==parent.content.size)return pos;var _parent$childAfter=parent.childAfter(offset),start=_parent$childAfter.offset,node=_parent$childAfter.node;if(!node)return pos;if(!node.isText)return cat?pos:pos+1;if("char"==by)for(var i=offset-start;i0)return!1;for(var before=void 0,cut=void 0,i=$head.depth-1;!before&&i>=0;i--)$head.index(i)>0&&(cut=$head.before(i+1),before=$head.node(i).child($head.index(i)-1));if(!before)return pm.tr.lift(head,head,!0).apply(pm.apply.scroll);if(null==before.type.contains&&before.type.selectable&&0==$head.parent.content.size){var tr=pm.tr["delete"](cut,cut+$head.parent.nodeSize).apply(pm.apply.scroll);return pm.setNodeSelection(cut-before.nodeSize),tr}return null==before.type.contains?pm.tr["delete"](cut-before.nodeSize,cut).apply(pm.apply.scroll):deleteBarrier(pm,cut)},keys:["Backspace(30)","Mod-Backspace(30)"]},baseCommands.deleteCharBefore={label:"Delete a character before the cursor",run:function(pm){var _pm$selection2=pm.selection,head=_pm$selection2.head,empty=_pm$selection2.empty;if(!empty||0==pm.doc.resolve(head).parentOffset)return!1;var dest=moveBackward(pm.doc,head,"char");return pm.tr["delete"](dest,head).apply(pm.apply.scroll)},keys:{all:["Backspace(60)"],mac:["Ctrl-H(40)"]}},baseCommands.deleteWordBefore={label:"Delete the word before the cursor",run:function(pm){var _pm$selection3=pm.selection,head=_pm$selection3.head,empty=_pm$selection3.empty;if(!empty||0==pm.doc.resolve(head).parentOffset)return!1;var dest=moveBackward(pm.doc,head,"word");return pm.tr["delete"](dest,head).apply(pm.apply.scroll)},keys:{all:["Mod-Backspace(40)"],mac:["Alt-Backspace(40)"]}},baseCommands.joinForward={label:"Join with the block below",run:function(pm){var _pm$selection4=pm.selection,head=_pm$selection4.head,empty=_pm$selection4.empty,$head=void 0;if(!empty||($head=pm.doc.resolve(head)).parentOffset<$head.parent.content.size)return!1;for(var after=void 0,cut=void 0,i=$head.depth-1;!after&&i>=0;i--){var parent=$head.node(i);$head.index(i)+1=$from.end($from.depth)?!1:pm.tr.typeText("\n").apply(pm.apply.scroll)},keys:["Enter(10)"]},baseCommands.createParagraphNear={label:"Create a paragraph near the selected block",run:function(pm){var _pm$selection12=pm.selection,from=_pm$selection12.from,to=_pm$selection12.to,node=_pm$selection12.node;if(!node||!node.isBlock)return!1;var side=pm.doc.resolve(from).parentOffset?to:from;pm.tr.insert(side,pm.schema.defaultTextblockType().create()).apply(pm.apply.scroll),pm.setTextSelection(side+1)},keys:["Enter(20)"]},baseCommands.liftEmptyBlock={label:"Move current block up",run:function(pm){var _pm$selection13=pm.selection,head=_pm$selection13.head,empty=_pm$selection13.empty,$head=void 0;return!empty||($head=pm.doc.resolve(head)).parentOffset>0||$head.parent.content.size?!1:$head.depth>1&&$head.index($head.depth-1)>0&&$head.index($head.depth-1)<$head.node($head.depth-1).childCount-1&&pm.tr.split($head.before($head.depth)).apply()!==!1?void 0:pm.tr.lift(head,head,!0).apply(pm.apply.scroll)},keys:["Enter(30)"]},baseCommands.splitBlock={label:"Split the current block",run:function(pm){var _pm$selection14=pm.selection,from=_pm$selection14.from,to=_pm$selection14.to,node=_pm$selection14.node,$from=pm.doc.resolve(from);if(node&&node.isBlock)return $from.parentOffset?pm.tr.split(from).apply(pm.apply.scroll):!1;var $to=pm.doc.resolve(to),atEnd=$to.parentOffset==$to.parent.content.size,deflt=pm.schema.defaultTextblockType(),type=atEnd?deflt:null,tr=pm.tr["delete"](from,to).split(from,1,type);return atEnd||$from.parentOffset||$from.parent.type==deflt||tr.setNodeType($from.before($from.depth),deflt),tr.apply(pm.apply.scroll)},keys:["Enter(60)"]},baseCommands.selectParentNode={label:"Select parent node",run:function(pm){var node=nodeAboveSelection(pm);return node===!1?!1:void pm.setNodeSelection(node)},select:function(pm){return nodeAboveSelection(pm)},menu:{group:"block",rank:90,display:{type:"icon",text:"⬚",style:"font-weight: bold"}},keys:["Esc"]},baseCommands.undo={label:"Undo last change",run:function(pm){return pm.scrollIntoView(),pm.history.undo()},select:function(pm){return pm.history.undoDepth>0},menu:{group:"history",rank:10,display:{type:"icon",width:1024,height:1024,path:"M761 1024c113-206 132-520-313-509v253l-384-384 384-384v248c534-13 594 472 313 775z"}},keys:["Mod-Z"]},baseCommands.redo={label:"Redo last undone change",run:function(pm){return pm.scrollIntoView(),pm.history.redo()},select:function(pm){return pm.history.redoDepth>0},menu:{group:"history",rank:20,display:{type:"icon",width:1024,height:1024,path:"M576 248v-248l384 384-384 384v-253c-446-10-427 303-313 509-280-303-221-789 313-775z"}},keys:["Mod-Y","Shift-Mod-Z"]}},{"../transform":41,"./char":4,"./selection":17}],3:[function(require,module,exports){"use strict";function _interopRequireDefault(obj){return obj&&obj.__esModule?obj:{"default":obj}}function nothing(){}function moveSelectionBlock(pm,dir){var _pm$selection=pm.selection,from=_pm$selection.from,to=_pm$selection.to,node=_pm$selection.node,side=pm.doc.resolve(dir>0?to:from);return(0,_selection.findSelectionFrom)(pm.doc,node&&node.isBlock?side.pos:dir>0?side.after(side.depth):side.before(side.depth),dir)}function selectNodeHorizontally(pm,dir){var _pm$selection2=pm.selection,empty=_pm$selection2.empty,node=_pm$selection2.node,from=_pm$selection2.from,to=_pm$selection2.to;if(!empty&&!node)return!1;if(node&&node.isInline)return pm.setTextSelection(dir>0?to:from),!0;if(!node){var $from=pm.doc.resolve(from),_ref=dir>0?$from.parent.childAfter($from.parentOffset):$from.parent.childBefore($from.parentOffset),nextNode=_ref.node,offset=_ref.offset;if(nextNode)return nextNode.type.selectable&&offset==$from.parentOffset-(dir>0?0:nextNode.nodeSize)?(pm.setNodeSelection(0>dir?from-nextNode.nodeSize:from),!0):!1}var next=moveSelectionBlock(pm,dir);return next&&(next instanceof _selection.NodeSelection||node)?(pm.setSelection(next),!0):!1}function horiz(dir){return function(pm){var done=selectNodeHorizontally(pm,dir);return done&&pm.scrollIntoView(),done}}function selectNodeVertically(pm,dir){var _pm$selection3=pm.selection,empty=_pm$selection3.empty,node=_pm$selection3.node,from=_pm$selection3.from,to=_pm$selection3.to;if(!empty&&!node)return!1;var leavingTextblock=!0;if((!node||node.isInline)&&(pm.flush(),leavingTextblock=(0,_selection.verticalMotionLeavesTextblock)(pm,dir>0?to:from,dir)),leavingTextblock){var next=moveSelectionBlock(pm,dir);if(next&&next instanceof _selection.NodeSelection)return pm.setSelection(next),!0}if(!node||node.isInline)return!1;var beyond=(0,_selection.findSelectionFrom)(pm.doc,0>dir?from:to,dir);return beyond&&pm.setSelection(beyond),!0}function vert(dir){return function(pm){var done=selectNodeVertically(pm,dir);return done!==!1&&pm.scrollIntoView(),done}}Object.defineProperty(exports,"__esModule",{value:!0}),exports.captureKeys=void 0;var _browserkeymap=require("browserkeymap"),_browserkeymap2=_interopRequireDefault(_browserkeymap),_selection=require("./selection"),_dom=require("../dom"),keys={Esc:nothing,Enter:nothing,"Ctrl-Enter":nothing,"Mod-Enter":nothing,"Shift-Enter":nothing,Backspace:nothing,Delete:nothing,"Mod-B":nothing,"Mod-I":nothing,"Mod-Backspace":nothing,"Mod-Delete":nothing,"Shift-Backspace":nothing,"Shift-Delete":nothing,"Shift-Mod-Backspace":nothing,"Shift-Mod-Delete":nothing,"Mod-Z":nothing,"Mod-Y":nothing,"Shift-Mod-Z":nothing,"Ctrl-D":nothing,"Ctrl-H":nothing,"Ctrl-Alt-Backspace":nothing,"Alt-D":nothing,"Alt-Delete":nothing,"Alt-Backspace":nothing,Left:horiz(-1),"Mod-Left":horiz(-1),Right:horiz(1),"Mod-Right":horiz(1),Up:vert(-1),Down:vert(1)};_dom.browser.mac&&(keys["Alt-Left"]=horiz(-1),keys["Alt-Right"]=horiz(1),keys["Ctrl-Backspace"]=keys["Ctrl-Delete"]=nothing);exports.captureKeys=new _browserkeymap2["default"](keys)},{"../dom":1,"./selection":17,browserkeymap:57}],4:[function(require,module,exports){"use strict";function isWordChar(ch){return/\w/.test(ch)||isExtendingChar(ch)||ch>"€"&&(ch.toUpperCase()!=ch.toLowerCase()||nonASCIISingleCaseWordChar.test(ch))}function charCategory(ch){return/\s/.test(ch)?"space":isWordChar(ch)?"word":"other"}function isExtendingChar(ch){return ch.charCodeAt(0)>=768&&extendingChar.test(ch)}Object.defineProperty(exports,"__esModule",{value:!0}),exports.isWordChar=isWordChar,exports.charCategory=charCategory,exports.isExtendingChar=isExtendingChar;var nonASCIISingleCaseWordChar=/[\u00df\u0587\u0590-\u05f4\u0600-\u06ff\u3040-\u309f\u30a0-\u30ff\u3400-\u4db5\u4e00-\u9fcc\uac00-\ud7af]/,extendingChar=/[\u0300-\u036f\u0483-\u0489\u0591-\u05bd\u05bf\u05c1\u05c2\u05c4\u05c5\u05c7\u0610-\u061a\u064b-\u065e\u0670\u06d6-\u06dc\u06de-\u06e4\u06e7\u06e8\u06ea-\u06ed\u0711\u0730-\u074a\u07a6-\u07b0\u07eb-\u07f3\u0816-\u0819\u081b-\u0823\u0825-\u0827\u0829-\u082d\u0900-\u0902\u093c\u0941-\u0948\u094d\u0951-\u0955\u0962\u0963\u0981\u09bc\u09be\u09c1-\u09c4\u09cd\u09d7\u09e2\u09e3\u0a01\u0a02\u0a3c\u0a41\u0a42\u0a47\u0a48\u0a4b-\u0a4d\u0a51\u0a70\u0a71\u0a75\u0a81\u0a82\u0abc\u0ac1-\u0ac5\u0ac7\u0ac8\u0acd\u0ae2\u0ae3\u0b01\u0b3c\u0b3e\u0b3f\u0b41-\u0b44\u0b4d\u0b56\u0b57\u0b62\u0b63\u0b82\u0bbe\u0bc0\u0bcd\u0bd7\u0c3e-\u0c40\u0c46-\u0c48\u0c4a-\u0c4d\u0c55\u0c56\u0c62\u0c63\u0cbc\u0cbf\u0cc2\u0cc6\u0ccc\u0ccd\u0cd5\u0cd6\u0ce2\u0ce3\u0d3e\u0d41-\u0d44\u0d4d\u0d57\u0d62\u0d63\u0dca\u0dcf\u0dd2-\u0dd4\u0dd6\u0ddf\u0e31\u0e34-\u0e3a\u0e47-\u0e4e\u0eb1\u0eb4-\u0eb9\u0ebb\u0ebc\u0ec8-\u0ecd\u0f18\u0f19\u0f35\u0f37\u0f39\u0f71-\u0f7e\u0f80-\u0f84\u0f86\u0f87\u0f90-\u0f97\u0f99-\u0fbc\u0fc6\u102d-\u1030\u1032-\u1037\u1039\u103a\u103d\u103e\u1058\u1059\u105e-\u1060\u1071-\u1074\u1082\u1085\u1086\u108d\u109d\u135f\u1712-\u1714\u1732-\u1734\u1752\u1753\u1772\u1773\u17b7-\u17bd\u17c6\u17c9-\u17d3\u17dd\u180b-\u180d\u18a9\u1920-\u1922\u1927\u1928\u1932\u1939-\u193b\u1a17\u1a18\u1a56\u1a58-\u1a5e\u1a60\u1a62\u1a65-\u1a6c\u1a73-\u1a7c\u1a7f\u1b00-\u1b03\u1b34\u1b36-\u1b3a\u1b3c\u1b42\u1b6b-\u1b73\u1b80\u1b81\u1ba2-\u1ba5\u1ba8\u1ba9\u1c2c-\u1c33\u1c36\u1c37\u1cd0-\u1cd2\u1cd4-\u1ce0\u1ce2-\u1ce8\u1ced\u1dc0-\u1de6\u1dfd-\u1dff\u200c\u200d\u20d0-\u20f0\u2cef-\u2cf1\u2de0-\u2dff\u302a-\u302f\u3099\u309a\ua66f-\ua672\ua67c\ua67d\ua6f0\ua6f1\ua802\ua806\ua80b\ua825\ua826\ua8c4\ua8e0-\ua8f1\ua926-\ua92d\ua947-\ua951\ua980-\ua982\ua9b3\ua9b6-\ua9b9\ua9bc\uaa29-\uaa2e\uaa31\uaa32\uaa35\uaa36\uaa43\uaa4c\uaab0\uaab2-\uaab4\uaab7\uaab8\uaabe\uaabf\uaac1\uabe5\uabe8\uabed\udc00-\udfff\ufb1e\ufe00-\ufe0f\ufe20-\ufe26\uff9e\uff9f]/},{}],5:[function(require,module,exports){"use strict";function _interopRequireDefault(obj){return obj&&obj.__esModule?obj:{"default":obj}}function _toConsumableArray(arr){if(Array.isArray(arr)){for(var i=0,arr2=Array(arr.length);i=2&&0==$from.index($from.depth-1)&&listType.canContain($from.node($from.depth-1))}function alreadyHasBlockType(doc,from,to,type,attrs){var found=!1;return attrs||(attrs={}),doc.nodesBetween(from,to||from,function(node){return node.isTextblock?(node.hasMarkup(type,attrs)&&(found=!0),!1):void 0}),found}function activeTextblockIs(pm,type,attrs){var _pm$selection6=pm.selection,from=_pm$selection6.from,to=_pm$selection6.to,node=_pm$selection6.node;if(!node||node.isInline){var $from=pm.doc.resolve(from);if(!$from.sameParent(pm.doc.resolve(to)))return!1;node=$from.parent}else if(!node.isTextblock)return!1;return node.hasMarkup(type,attrs)}var _slicedToArray=function(){function sliceIterator(arr,i){var _arr=[],_n=!0,_d=!1,_e=void 0;try{for(var _s,_i=arr[Symbol.iterator]();!(_n=(_s=_i.next()).done)&&(_arr.push(_s.value),!i||_arr.length!==i);_n=!0);}catch(err){_d=!0,_e=err}finally{try{!_n&&_i["return"]&&_i["return"]()}finally{if(_d)throw _e}}return _arr}return function(arr,i){if(Array.isArray(arr))return arr;if(Symbol.iterator in Object(arr))return sliceIterator(arr,i);throw new TypeError("Invalid attempt to destructure non-iterable instance")}}(),_typeof="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(obj){return typeof obj}:function(obj){return obj&&"function"==typeof Symbol&&obj.constructor===Symbol?"symbol":typeof obj},_createClass=function(){function defineProperties(target,props){for(var i=0;i1?_len-1:0),_key=1;_len>_key;_key++)params[_key-1]=arguments[_key];pm.setMark(this,!0,fillAttrs(conf,params))},select:function(pm){return conf.inverseSelect?markApplies(pm,this)&&!markActive(pm,this):canAddInline(pm,this)},params:deriveParams(this,conf.params)}},_model.MarkType.derivableCommands.unset=function(){return{run:function(pm){pm.setMark(this,!1)},select:function(pm){return markActive(pm,this)}}},_model.MarkType.derivableCommands.toggle=function(){return{run:function(pm){pm.setMark(this,null)},active:function(pm){return markActive(pm,this)},select:function(pm){return markApplies(pm,this)}}},_model.NodeType.derivableCommands.wrap=function(conf){return{run:function(pm){var _pm$selection4=pm.selection,from=_pm$selection4.from,to=_pm$selection4.to,head=_pm$selection4.head,doJoin=!1,$from=pm.doc.resolve(from);if(conf.list&&head&&isAtTopOfListItem(pm.doc,from,to,this)){if(0==$from.index($from.depth-2))return!1;doJoin=!0}for(var _len2=arguments.length,params=Array(_len2>1?_len2-1:0),_key2=1;_len2>_key2;_key2++)params[_key2-1]=arguments[_key2];var tr=pm.tr.wrap(from,to,this,fillAttrs(conf,params));return doJoin&&tr.join($from.before($from.depth-1)),tr.apply(pm.apply.scroll)},select:function(pm){var _pm$selection5=pm.selection,from=_pm$selection5.from,to=_pm$selection5.to,head=_pm$selection5.head,$from=void 0;return conf.list&&head&&isAtTopOfListItem(pm.doc,from,to,this)&&0==($from=pm.doc.resolve(from)).index($from.depth-2)?!1:(0,_transform.canWrap)(pm.doc,from,to,this)},params:deriveParams(this,conf.params)}},_model.NodeType.derivableCommands.make=function(conf){return{run:function(pm){var _pm$selection7=pm.selection,from=_pm$selection7.from,to=_pm$selection7.to;return pm.tr.setBlockType(from,to,this,conf.attrs).apply(pm.apply.scroll)},select:function(pm){var _pm$selection8=pm.selection,from=_pm$selection8.from,to=_pm$selection8.to,node=_pm$selection8.node;return node?node.isTextblock&&!node.hasMarkup(this,conf.attrs):!alreadyHasBlockType(pm.doc,from,to,this,conf.attrs)},active:function(pm){return activeTextblockIs(pm,this,conf.attrs)}}},_model.NodeType.derivableCommands.insert=function(conf){return{run:function(pm){for(var _len3=arguments.length,params=Array(_len3>1?_len3-1:0),_key3=1;_len3>_key3;_key3++)params[_key3-1]=arguments[_key3];return pm.tr.replaceSelection(this.create(fillAttrs(conf,params))).apply(pm.apply.scroll)},select:this.isInline?function(pm){return pm.doc.resolve(pm.selection.from).parent.type.canContainType(this)}:null,params:deriveParams(this,conf.params)}}},{"../dom":1,"../model":34,"../transform":41,"../util/obj":55,"../util/sortedinsert":56,"./base_commands":2,browserkeymap:57}],6:[function(require,module,exports){"use strict";var _dom=require("../dom");(0,_dom.insertCSS)('\n\n.ProseMirror {\n border: 1px solid silver;\n position: relative;\n}\n\n.ProseMirror-content {\n padding: 4px 8px 4px 14px;\n white-space: pre-wrap;\n line-height: 1.2;\n}\n\n.ProseMirror-drop-target {\n position: absolute;\n width: 1px;\n background: #666;\n}\n\n.ProseMirror-content ul.tight p, .ProseMirror-content ol.tight p {\n margin: 0;\n}\n\n.ProseMirror-content ul, .ProseMirror-content ol {\n padding-left: 30px;\n cursor: default;\n}\n\n.ProseMirror-content blockquote {\n padding-left: 1em;\n border-left: 3px solid #eee;\n margin-left: 0; margin-right: 0;\n}\n\n.ProseMirror-content pre {\n white-space: pre-wrap;\n}\n\n.ProseMirror-selectednode {\n outline: 2px solid #8cf;\n}\n\n.ProseMirror-nodeselection *::selection { background: transparent; }\n.ProseMirror-nodeselection *::-moz-selection { background: transparent; }\n\n.ProseMirror-content p:first-child,\n.ProseMirror-content h1:first-child,\n.ProseMirror-content h2:first-child,\n.ProseMirror-content h3:first-child,\n.ProseMirror-content h4:first-child,\n.ProseMirror-content h5:first-child,\n.ProseMirror-content h6:first-child {\n margin-top: .3em;\n}\n\n/* Add space around the hr to make clicking it easier */\n\n.ProseMirror-content hr {\n position: relative;\n height: 6px;\n border: none;\n}\n\n.ProseMirror-content hr:after {\n content: "";\n position: absolute;\n left: 10px;\n right: 10px;\n top: 2px;\n border-top: 2px solid silver;\n}\n\n.ProseMirror-content img {\n cursor: default;\n}\n\n/* Make sure li selections wrap around markers */\n\n.ProseMirror-content li {\n position: relative;\n pointer-events: none; /* Don\'t do weird stuff with marker clicks */\n}\n.ProseMirror-content li > * {\n pointer-events: auto;\n}\n\nli.ProseMirror-selectednode {\n outline: none;\n}\n\nli.ProseMirror-selectednode:after {\n content: "";\n position: absolute;\n left: -32px;\n right: -2px; top: -2px; bottom: -2px;\n border: 2px solid #8cf;\n pointer-events: none;\n}\n\n'); +},{"../dom":1}],7:[function(require,module,exports){"use strict";function readInputChange(pm){return pm.ensureOperation({readSelection:!1}),readDOMChange(pm,rangeAroundSelection(pm))}function readCompositionChange(pm,margin){return readDOMChange(pm,rangeAroundComposition(pm,margin))}function parseBetween(pm,from,to){for(var _DOMFromPos=(0,_dompos.DOMFromPos)(pm,from,!0),parent=_DOMFromPos.node,startOff=_DOMFromPos.offset,endOff=(0,_dompos.DOMFromPos)(pm,to,!0).offset;startOff;){var prev=parent.childNodes[startOff-1];if(1==prev.nodeType&&prev.hasAttribute("pm-offset"))break;--startOff}for(;endOff0)return!1;return 0==$pos.parentOffset}function rangeAroundSelection(pm){var _pm$operation=pm.operation,sel=_pm$operation.sel,doc=_pm$operation.doc,$from=doc.resolve(sel.from),$to=doc.resolve(sel.to);if($from.sameParent($to)&&$from.parent.isTextblock&&$from.parentOffset&&$to.parentOffset<$to.parent.content.size)return rangeAroundComposition(pm,0);for(var depth=0;;depth++){var fromStart=isAtStart($from,depth+1),toEnd=isAtEnd($to,depth+1);if(fromStart||toEnd||$from.index(depth)!=$to.index(depth)||$to.node(depth).isTextblock){var from=$from.before(depth+1),to=$to.after(depth+1);return fromStart&&$from.index(depth)>0&&(from-=$from.node(depth).child($from.index(depth)-1).nodeSize),toEnd&&$to.index(depth)+1<$to.node(depth).childCount&&(to+=$to.node(depth).child($to.index(depth)+1).nodeSize),{from:from,to:to}}}}function rangeAroundComposition(pm,margin){var _pm$operation2=pm.operation,sel=_pm$operation2.sel,doc=_pm$operation2.doc,$from=doc.resolve(sel.from),$to=doc.resolve(sel.to);if(!$from.sameParent($to))return rangeAroundSelection(pm);var startOff=Math.max(0,$from.parentOffset-margin),size=$from.parent.content.size,endOff=Math.min(size,$to.parentOffset+margin);if(startOff>0&&(startOff=$from.parent.childBefore(startOff).offset),size>endOff){var after=$from.parent.childAfter(endOff);endOff=after.offset+after.node.nodeSize}var nodeStart=$from.start($from.depth);return{from:nodeStart+startOff,to:nodeStart+endOff}}function readDOMChange(pm,range){var op=pm.operation;if(op.docSet)return void pm.markAllDirty();var parsed=parseBetween(pm,range.from,range.to),compare=op.doc.slice(range.from,range.to),change=findDiff(compare.content,parsed.content,range.from,op.sel.from);if(change){var fromMapped=(0,_map.mapThroughResult)(op.mappings,change.start),toMapped=(0,_map.mapThroughResult)(op.mappings,change.endA);if(!fromMapped.deleted||!toMapped.deleted){markDirtyFor(pm,op.doc,change.start,change.endA);var $from=parsed.resolveNoCache(change.start-range.from),$to=parsed.resolveNoCache(change.endB-range.from),nextSel=void 0,text=void 0;if(!$from.sameParent($to)&&$from.pospos)){if(!node.isText)return valid=!1;marks?_model.Mark.sameSet(marks,node.marks)||(valid=!1):marks=node.marks,result+=node.text.slice(Math.max(0,from-pos),to-pos)}}),valid?result:null}function findDiff(a,b,pos,preferedStart){var start=(0,_model.findDiffStart)(a,b,pos);if(!start)return null;var _findDiffEnd=(0,_model.findDiffEnd)(a,b,pos+a.size,pos+b.size),endA=_findDiffEnd.a,endB=_findDiffEnd.b;if(start>endA){var move=start>=preferedStart&&preferedStart>=endA?start-preferedStart:0;start-=move,endB=start+(endB-endA),endA=start}else if(start>endB){var move=start>=preferedStart&&preferedStart>=endB?start-preferedStart:0;start-=move,endA=start+(endA-endB),endB=start}return{start:start,endA:endA,endB:endB}}function markDirtyFor(pm,doc,start,end){var $start=doc.resolve(start),$end=doc.resolve(end),same=$start.sameDepth($end);0==same?pm.markAllDirty():pm.markRangeDirty($start.before(same),$start.after(same),doc)}Object.defineProperty(exports,"__esModule",{value:!0}),exports.readInputChange=readInputChange,exports.readCompositionChange=readCompositionChange;var _model=require("../model"),_format=require("../format"),_map=require("../transform/map"),_selection=require("./selection"),_dompos=require("./dompos")},{"../format":21,"../model":34,"../transform/map":43,"./dompos":8,"./selection":17}],8:[function(require,module,exports){"use strict";function posBeforeFromDOM(pm,node){for(var pos=0,add=0,cur=node;cur!=pm.content;cur=cur.parentNode){var attr=cur.getAttribute("pm-offset");attr&&(pos+=+attr+add,add=1)}return pos}function posFromDOM(pm,dom,domOffset){if(pm.operation&&pm.doc!=pm.operation.doc)throw new RangeError("Fetching a position from an outdated DOM structure");null==domOffset&&(domOffset=Array.prototype.indexOf.call(dom.parentNode.childNodes,dom),dom=dom.parentNode);for(var innerOffset=0,tag=void 0;;){var adjust=0;if(3==dom.nodeType)innerOffset+=domOffset;else{if(tag=dom.getAttribute("pm-offset")&&!childContainer(dom)){var size=+dom.getAttribute("pm-size");return posBeforeFromDOM(pm,dom)+(domOffset==dom.childNodes.length?size:Math.min(innerOffset,size))}if(dom.hasAttribute("pm-container"))break;(tag=dom.getAttribute("pm-inner-offset"))?(innerOffset+=+tag,adjust=-1):domOffset&&domOffset==dom.childNodes.length&&(adjust=1)}var parent=dom.parentNode;domOffset=0>adjust?0:Array.prototype.indexOf.call(parent.childNodes,dom)+adjust,dom=parent}for(var start=dom==pm.content?0:posBeforeFromDOM(pm,dom)+1,before=0,child=dom.childNodes[domOffset-1];child;child=child.previousSibling)if(1==child.nodeType&&(tag=child.getAttribute("pm-offset"))){before+=+tag+ +child.getAttribute("pm-size");break}return start+before+innerOffset}function childContainer(dom){return dom.hasAttribute("pm-container")?dom:dom.querySelector("[pm-container]")}function DOMFromPos(pm,pos,liberal){if(!liberal&&pm.operation&&pm.doc!=pm.operation.doc)throw new RangeError("Resolving a position in an outdated DOM structure");for(var container=pm.content,offset=pos;;)for(var child=container.firstChild,i=0;;child=child.nextSibling,i++){if(!child){if(offset&&!liberal)throw new RangeError("Failed to find node at "+pos+" rem = "+offset);return{node:container,offset:i}}var size=1==child.nodeType&&child.getAttribute("pm-size");if(size){if(!offset)return{node:container,offset:i};if(size=+size,size>offset){if(container=childContainer(child)){offset--;break}return leafAt(child,offset)}offset-=size}}}function DOMAfterPos(pm,pos){var _DOMFromPos=DOMFromPos(pm,pos),node=_DOMFromPos.node,offset=_DOMFromPos.offset;if(1!=node.nodeType||offset==node.childNodes.length)throw new RangeError("No node after pos "+pos);return node.childNodes[offset]}function leafAt(node,offset){for(;;){var child=node.firstChild;if(!child)return{node:node,offset:offset};if(1!=child.nodeType)return{node:child,offset:offset};if(child.hasAttribute("pm-inner-offset")){for(var nodeOffset=0;;){var nextSib=child.nextSibling,nextOffset=void 0;if(!nextSib||(nextOffset=+nextSib.getAttribute("pm-inner-offset"))>=offset)break;child=nextSib,nodeOffset=nextOffset}offset-=nodeOffset}node=child}}function windowRect(){return{left:0,right:window.innerWidth,top:0,bottom:window.innerHeight}}function scrollIntoView(pm,pos){pos||(pos=pm.sel.range.head||pm.sel.range.from);for(var coords=coordsAtPos(pm,pos),parent=pm.content;;parent=parent.parentNode){var atBody=parent==document.body,rect=atBody?windowRect():parent.getBoundingClientRect(),moveX=0,moveY=0;if(coords.toprect.bottom&&(moveY=coords.bottom-rect.bottom+scrollMargin),coords.leftrect.right&&(moveX=coords.right-rect.right+scrollMargin),(moveX||moveY)&&(atBody?window.scrollBy(moveX,moveY):(moveY&&(parent.scrollTop+=moveY),moveX&&(parent.scrollLeft+=moveX))),atBody)break}}function findOffsetInNode(node,coords){for(var closest=void 0,dyClosest=1e8,coordsClosest=void 0,offset=0,child=node.firstChild;child;child=child.nextSibling){var rects=void 0;if(1==child.nodeType)rects=child.getClientRects();else{if(3!=child.nodeType)continue;rects=textRects(child)}for(var i=0;i=coords.left){var dy=rect.top>coords.top?rect.top-coords.top:rect.bottomdy){closest=child,dyClosest=dy,coordsClosest=dy?{left:coords.left,top:rect.top}:coords,1!=child.nodeType||child.firstChild||(offset=i+(coords.left>=(rect.left+rect.right)/2?1:0));continue}}!closest&&(coords.top>=rect.bottom||coords.top>=rect.top&&coords.left>=rect.right)&&(offset=i+1)}}return closest?3==closest.nodeType?findOffsetInText(closest,coordsClosest):closest.firstChild?findOffsetInNode(closest,coordsClosest):{node:node,offset:offset}:{node:node,offset:offset}}function findOffsetInText(node,coords){for(var len=node.nodeValue.length,range=document.createRange(),i=0;len>i;i++){range.setEnd(node,i+1),range.setStart(node,i);var rect=range.getBoundingClientRect();if(rect.top!=rect.bottom&&rect.left-1<=coords.left&&rect.right+1>=coords.left&&rect.top-1<=coords.top&&rect.bottom+1>=coords.top)return{node:node,offset:i+(coords.left>=(rect.left+rect.right)/2?1:0)}}return{node:node,offset:0}}function posAtCoords(pm,coords){var elt=document.elementFromPoint(coords.left,coords.top+1);if(!(0,_dom.contains)(pm.content,elt))return null;elt.firstChild||(elt=elt.parentNode);var _findOffsetInNode=findOffsetInNode(elt,coords),node=_findOffsetInNode.node,offset=_findOffsetInNode.offset;return posFromDOM(pm,node,offset)}function textRect(node,from,to){var range=document.createRange();return range.setEnd(node,to),range.setStart(node,from),range.getBoundingClientRect()}function textRects(node){var range=document.createRange();return range.setEnd(node,node.nodeValue.length),range.setStart(node,0),range.getClientRects()}function coordsAtPos(pm,pos){var _DOMFromPos2=DOMFromPos(pm,pos),node=_DOMFromPos2.node,offset=_DOMFromPos2.offset,side=void 0,rect=void 0;if(3==node.nodeType)offset-1||ranges.current.length)&&(wrapped=inner==dom?dom=(0,_dom.elt)("span",null,inner):inner.parentNode.appendChild((0,_dom.elt)("span",null,inner))),dom.setAttribute("pm-offset",offset),dom.setAttribute("pm-size",node.nodeSize);for(var inlineOffset=0;nextCut>-1;){var size=nextCut-pos,split=splitSpan(wrapped,size);ranges.current.length&&(split.className=ranges.current.join(" ")),split.setAttribute("pm-inner-offset",inlineOffset),inlineOffset+=size,ranges.advanceTo(nextCut),nextCut=ranges.nextChangeBefore(end),-1==nextCut&&wrapped.setAttribute("pm-inner-offset",inlineOffset),pos+=size}return ranges.current.length&&(wrapped.className=ranges.current.join(" ")),this.pos+=node.nodeSize,dom},document:document}}function splitSpan(span,at){var textNode=span.firstChild,text=textNode.nodeValue,newNode=span.parentNode.insertBefore((0,_dom.elt)("span",null,text.slice(0,at)),span);return textNode.nodeValue=text.slice(at),newNode}function draw(pm,doc){pm.content.textContent="",pm.content.appendChild((0,_format.toDOM)(doc,options(pm.ranges.activeRangeTracker())))}function adjustTrailingHacks(dom,node){var needs=0==node.content.size||node.lastChild.type.isBR||node.type.isCode&&node.lastChild.isText&&/\n$/.test(node.lastChild.text)?"br":node.lastChild.isText||null!=node.lastChild.type.contains?null:"text",last=dom.lastChild,has=last&&1==last.nodeType&&last.hasAttribute("pm-ignore")?"BR"==last.nodeName?"br":"text":null;needs!=has&&(has&&dom.removeChild(last),needs&&dom.appendChild("br"==needs?(0,_dom.elt)("br",{"pm-ignore":"trailing-break"}):(0,_dom.elt)("span",{"pm-ignore":"cursor-text"},"")))}function findNodeIn(parent,i,node){for(;i-1)for(matching=child;iPrev!=found;)iPrev++,domPos=movePast(domPos);if(matching&&!dirty.get(matching))reuseDOM=!0;else if(pChild&&!child.isText&&child.sameMarkup(pChild)&&dirty.get(pChild)!=_main.DIRTY_REDRAW)reuseDOM=!0,pChild.type.contains&&scan((0,_dompos.childContainer)(domPos),child,pChild,pos+offset+1);else{opts.pos=pos+offset;var rendered=(0,_format.nodeToDOM)(child,opts,offset);dom.insertBefore(rendered,domPos),reuseDOM=!1}reuseDOM&&(domPos.setAttribute("pm-offset",offset),domPos.setAttribute("pm-size",child.nodeSize),domPos=domPos.nextSibling,pChild=prev.maybeChild(++iPrev)),offset+=child.nodeSize}for(;pChild;)domPos=movePast(domPos),pChild=prev.maybeChild(++iPrev);node.isTextblock&&adjustTrailingHacks(dom,node)}if(dirty.get(prev)==_main.DIRTY_REDRAW)return draw(pm,doc);var opts=options(pm.ranges.activeRangeTracker());scan(pm.content,doc,prev,0)}Object.defineProperty(exports,"__esModule",{value:!0}),exports.draw=draw,exports.redraw=redraw;var _format=require("../format"),_dom=require("../dom"),_main=require("./main"),_dompos=require("./dompos")},{"../dom":1,"../format":21,"./dompos":8,"./main":13}],10:[function(require,module,exports){"use strict";function _possibleConstructorReturn(self,call){if(!self)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return!call||"object"!=typeof call&&"function"!=typeof call?self:call}function _inherits(subClass,superClass){if("function"!=typeof superClass&&null!==superClass)throw new TypeError("Super expression must either be null or a function, not "+typeof superClass);subClass.prototype=Object.create(superClass&&superClass.prototype,{constructor:{value:subClass,enumerable:!1,writable:!0,configurable:!0}}),superClass&&(Object.setPrototypeOf?Object.setPrototypeOf(subClass,superClass):subClass.__proto__=superClass)}function _classCallCheck(instance,Constructor){if(!(instance instanceof Constructor))throw new TypeError("Cannot call a class as a function")}var _createClass=function(){function defineProperties(target,props){for(var i=0;ithis.maxEvents&&this.clip()}},{key:"clip",value:function(){for(var seen=0,toClip=this.events-this.maxEvents,i=0;;i++){var cur=this.items[i];if(cur.selection){if(!(toClip>seen))return this.items.splice(0,i,new Item(null,this.events[toClip-1])),void(this.events=this.maxEvents);++seen}}}},{key:"addMaps",value:function(array){if(0!=this.events)for(var i=0;i=0;i--){var cur=this.items[i];if(cur.step){if(cur.id==id)return cur;if(cur.idstart&&(startPos=1-start,start=1,this.items[0]=new Item),positions.length){for(var remap=new _transform.Remapping([],newMaps.slice()),iItem=start,iPosition=startPos;iItemmax_empty_items&&this.compress(start+newMaps.length)}}},{key:"emptyItems",value:function(upto){for(var count=0,i=1;upto>i;i++)this.items[i].step||count++;return count}},{key:"compress",value:function(upto){for(var remap=new BranchRemapping,items=[],events=0,i=this.items.length-1;i>=0;i--){var item=this.items[i];if(i>=upto)items.push(item);else if(item.step){var step=item.step.map(remap.remap),map=step&&step.posMap();if(remap.movePastStep(item,map),step){var selection=item.selection&&item.selection.type.mapToken(item.selection,remap.remap);items.push(new StepItem(map.invert(),item.id,step,selection)),selection&&events++}}else item.map?remap.add(item):items.push(item)}this.items=items.reverse(),this.events=events}},{key:"toString",value:function(){return this.items.join("\n")}},{key:"changeID",get:function(){for(var i=this.items.length-1;i>0;i--)if(this.items[i].step)return this.items[i].id;return this.items[0].id}}]),Branch}(),nextID=1,Item=function(){function Item(map,id){_classCallCheck(this,Item),this.map=map,this.id=id||nextID++}return _createClass(Item,[{key:"toString",value:function(){return this.id+":"+(this.map||"")+(this.step?":"+this.step:"")+(null!=this.mirror?"->"+this.mirror:"")}}]),Item}(),StepItem=function(_Item){function StepItem(map,id,step,selection){_classCallCheck(this,StepItem);var _this=_possibleConstructorReturn(this,Object.getPrototypeOf(StepItem).call(this,map,id));return _this.step=step,_this.selection=selection,_this}return _inherits(StepItem,_Item),StepItem}(Item),MapItem=function(_Item2){function MapItem(map,mirror){_classCallCheck(this,MapItem);var _this2=_possibleConstructorReturn(this,Object.getPrototypeOf(MapItem).call(this,map));return _this2.mirror=mirror,_this2}return _inherits(MapItem,_Item2),MapItem}(Item),BranchRemapping=function(){function BranchRemapping(){_classCallCheck(this,BranchRemapping),this.remap=new _transform.Remapping,this.mirrorBuffer=Object.create(null)}return _createClass(BranchRemapping,[{key:"add",value:function(item){var id=this.remap.addToFront(item.map,this.mirrorBuffer[item.id]);return null!=item.mirror&&(this.mirrorBuffer[item.mirror]=id),id}},{key:"movePastStep",value:function(item,map){var id=this.add(item);map&&this.remap.addToBack(map,id)}}]),BranchRemapping}();exports.History=function(){function History(pm){_classCallCheck(this,History),this.pm=pm,this.done=new Branch(pm.options.historyDepth),this.undone=new Branch(pm.options.historyDepth),this.lastAddedAt=0,this.ignoreTransform=!1,this.preserveItems=0,pm.on("transform",this.recordTransform.bind(this))}return _createClass(History,[{key:"recordTransform",value:function(transform,selection,options){if(!this.ignoreTransform)if(0==options.addToHistory)this.done.addMaps(transform.maps),this.undone.addMaps(transform.maps);else{var now=Date.now(),newGroup=now>this.lastAddedAt+this.pm.options.historyEventDelay;this.done.addTransform(transform,newGroup?selection.token:null),this.undone.clear(),this.lastAddedAt=now}}},{key:"undo",value:function(){return this.shift(this.done,this.undone)}},{key:"redo",value:function(){return this.shift(this.undone,this.done)}},{key:"shift",value:function(from,to){var pop=from.popEvent(this.pm.doc,this.preserveItems>0);if(!pop)return!1;var selectionBeforeTransform=this.pm.selection;if(!pop.transform.steps.length)return this.shift(from,to);var selection=pop.selection.type.fromToken(pop.selection,pop.transform.doc);return this.applyIgnoring(pop.transform,selection),to.addTransform(pop.transform,selectionBeforeTransform.token,pop.ids),this.lastAddedAt=0,!0}},{key:"applyIgnoring",value:function(transform,selection){this.ignoreTransform=!0,this.pm.apply(transform,{selection:selection,filter:!1}),this.ignoreTransform=!1}},{key:"getVersion",value:function(){return this.done.changeID}},{key:"isAtVersion",value:function(version){return this.done.changeID==version}},{key:"backToVersion",value:function(version){var found=this.done.findChangeID(version);if(!found)return!1;var _done$popEvent=this.done.popEvent(this.pm.doc,this.preserveItems>0,found),transform=_done$popEvent.transform;return this.applyIgnoring(transform),this.undone.clear(),!0}},{key:"rebased",value:function(newMaps,rebasedTransform,positions){this.done.rebased(newMaps,rebasedTransform,positions),this.undone.rebased(newMaps,rebasedTransform,positions)}},{key:"undoDepth",get:function(){return this.done.events}},{key:"redoDepth",get:function(){return this.undone.events}}]),History}()},{"../transform":41}],11:[function(require,module,exports){"use strict";function _interopRequireDefault(obj){return obj&&obj.__esModule?obj:{"default":obj}}Object.defineProperty(exports,"__esModule",{value:!0}),exports.Keymap=exports.baseCommands=exports.Command=exports.CommandSet=exports.MarkedRange=exports.NodeSelection=exports.TextSelection=exports.Selection=exports.defineOption=exports.ProseMirror=void 0;var _main=require("./main");Object.defineProperty(exports,"ProseMirror",{enumerable:!0,get:function(){return _main.ProseMirror}});var _options=require("./options");Object.defineProperty(exports,"defineOption",{enumerable:!0,get:function(){return _options.defineOption}});var _selection=require("./selection");Object.defineProperty(exports,"Selection",{enumerable:!0,get:function(){return _selection.Selection}}),Object.defineProperty(exports,"TextSelection",{enumerable:!0,get:function(){return _selection.TextSelection}}),Object.defineProperty(exports,"NodeSelection",{enumerable:!0,get:function(){return _selection.NodeSelection}});var _range=require("./range");Object.defineProperty(exports,"MarkedRange",{enumerable:!0,get:function(){return _range.MarkedRange}});var _command=require("./command");Object.defineProperty(exports,"CommandSet",{enumerable:!0,get:function(){return _command.CommandSet}}),Object.defineProperty(exports,"Command",{enumerable:!0,get:function(){return _command.Command}});var _base_commands=require("./base_commands");Object.defineProperty(exports,"baseCommands",{enumerable:!0,get:function(){return _base_commands.baseCommands}}),require("./schema_commands");var _browserkeymap=require("browserkeymap"),_browserkeymap2=_interopRequireDefault(_browserkeymap);exports.Keymap=_browserkeymap2["default"]},{"./base_commands":2,"./command":5,"./main":13,"./options":14,"./range":15,"./schema_commands":16,"./selection":17,browserkeymap:57}],12:[function(require,module,exports){"use strict";function _interopRequireDefault(obj){return obj&&obj.__esModule?obj:{"default":obj}}function _classCallCheck(instance,Constructor){if(!(instance instanceof Constructor))throw new TypeError("Cannot call a class as a function")}function realTarget(pm,mouseEvent){return pm.operation&&pm.flush()?document.elementFromPoint(mouseEvent.clientX,mouseEvent.clientY):mouseEvent.target}function selectClickedNode(pm,e,target){var pos=(0,_dompos.selectableNodeAbove)(pm,target,{left:e.clientX,top:e.clientY},!0);if(null==pos)return pm.sel.fastPoll();var _pm$selection=pm.selection,node=_pm$selection.node,from=_pm$selection.from;if(node){var $pos=pm.doc.resolve(pos),$from=pm.doc.resolve(from);if($pos.depth>=$from.depth&&$pos.before($from.depth)==from){if(0==$from.depth)return pm.sel.fastPoll();pos=$pos.before($pos.depth)}}pm.setNodeSelection(pos),pm.focus(),e.preventDefault()}function handleTripleClick(pm,e,target){e.preventDefault();var pos=(0,_dompos.selectableNodeAbove)(pm,target,{left:e.clientX,top:e.clientY},!0);if(null!=pos){var $pos=pm.doc.resolve(pos),node=$pos.nodeAfter;node.isBlock&&!node.isTextblock?pm.setNodeSelection(pos):node.isInline?pm.setTextSelection($pos.start($pos.depth),$pos.end($pos.depth)):pm.setTextSelection(pos+1,pos+1+node.content.size),pm.focus()}}function toClipboard(doc,from,to,dataTransfer){var slice=doc.slice(from,to),$from=doc.resolve(from),parent=$from.node($from.depth-slice.openLeft),attr=parent.type.name+" "+slice.openLeft+" "+slice.openRight,html='
'+(0,_format.toHTML)(slice.content)+"
";return dataTransfer.clearData(),dataTransfer.setData("text/html",html),dataTransfer.setData("text/plain",(0,_format.toText)(slice.content)),slice}function canUpdateClipboard(dataTransfer){return null!=cachedCanUpdateClipboard?cachedCanUpdateClipboard:(dataTransfer.setData("text/html","
"),cachedCanUpdateClipboard="
"==dataTransfer.getData("text/html"))}function fromClipboard(pm,dataTransfer,plainText){var txt=dataTransfer.getData("text/plain"),html=dataTransfer.getData("text/html");if(!html&&!txt)return null;var doc=void 0,slice=void 0;if(!plainText&&html||!txt){var dom=document.createElement("div");dom.innerHTML=pm.signalPipelined("transformPastedHTML",html);var wrap=dom.querySelector("[pm-context]"),context=void 0,contextNodeType=void 0,found=void 0;wrap&&(context=/^(\w+) (\d+) (\d+)$/.exec(wrap.getAttribute("pm-context")))&&(contextNodeType=pm.schema.nodes[context[1]])&&contextNodeType.defaultAttrs&&(found=parseFromContext(wrap,contextNodeType,+context[2],+context[3]))?slice=found:doc=(0,_format.fromDOM)(pm.schema,dom)}else doc=(0,_format.parseFrom)(pm.schema,pm.signalPipelined("transformPastedText",txt),"text");return slice||(slice=doc.slice((0,_selection.findSelectionAtStart)(doc).from,(0,_selection.findSelectionAtEnd)(doc).to)),pm.signalPipelined("transformPasted",slice)}function parseFromContext(dom,contextNodeType,openLeft,openRight){var schema=contextNodeType.schema,contextNode=contextNodeType.create(),parsed=(0,_format.fromDOM)(schema,dom,{topNode:contextNode,preserveWhitespace:!0});return new _model.Slice(parsed.content,clipOpen(parsed.content,openLeft,!0),clipOpen(parsed.content,openRight,!1),contextNode)}function clipOpen(fragment,max,start){for(var i=0;max>i;i++){var node=start?fragment.firstChild:fragment.lastChild;if(!node||null==node.type.contains)return i;fragment=node.content}return max}function dropPos(pm,e,slice){var pos=pm.posAtCoords({left:e.clientX,top:e.clientY});if(null==pos||!slice||!slice.content.size)return pos;for(var $pos=pm.doc.resolve(pos),kind=slice.content.leastSuperKind(),d=$pos.depth;d>=0;d--)if(kind.isSubKind($pos.node(d).type.contains))return d==$pos.depth?pos:pos<=($pos.start(d+1)+$pos.end(d+1))/2?$pos.before(d+1):$pos.after(d+1);return pos}function removeDropTarget(pm){pm.input.dropTarget&&(pm.wrapper.removeChild(pm.input.dropTarget),pm.input.dropTarget=null)}var _createClass=function(){function defineProperties(target,props){for(var i=0;inow-lastClick,tripleClick=600>now-oneButLastClick;oneButLastClick=lastClick,lastClick=now;var target=realTarget(pm,e);tripleClick?handleTripleClick(pm,e,target):doubleClick&&(0,_dompos.handleNodeClick)(pm,"handleDoubleClick",e,target,!0)||(pm.input.mouseDown=new MouseDown(pm,e,target,doubleClick))};var MouseDown=function(){function MouseDown(pm,event,target,doubleClick){_classCallCheck(this,MouseDown),this.pm=pm,this.event=event,this.target=target,this.leaveToBrowser=pm.input.shiftKey||doubleClick;var pos=(0,_dompos.posBeforeFromDOM)(pm,this.target),node=pm.doc.nodeAt(pos);this.mightDrag=node.type.draggable||node==pm.sel.range.node?pos:null,null!=this.mightDrag&&(this.target.draggable=!0,_dom.browser.gecko&&(this.setContentEditable=!this.target.hasAttribute("contentEditable"))&&this.target.setAttribute("contentEditable","false")),this.x=event.clientX,this.y=event.clientY,window.addEventListener("mouseup",this.up=this.up.bind(this)),window.addEventListener("mousemove",this.move=this.move.bind(this)),pm.sel.fastPoll()}return _createClass(MouseDown,[{key:"done",value:function(){window.removeEventListener("mouseup",this.up),window.removeEventListener("mousemove",this.move),null!=this.mightDrag&&(this.target.draggable=!1,_dom.browser.gecko&&this.setContentEditable&&this.target.removeAttribute("contentEditable"))}},{key:"up",value:function(event){this.done();var target=realTarget(this.pm,event);if(this.leaveToBrowser||!(0,_dom.contains)(this.pm.content,target))this.pm.sel.fastPoll();else if(this.event.ctrlKey)selectClickedNode(this.pm,event,target);else if(!(0,_dompos.handleNodeClick)(this.pm,"handleClick",event,target,!0)){var pos=(0,_dompos.selectableNodeAbove)(this.pm,target,{left:this.x,top:this.y});pos?(this.pm.setNodeSelection(pos),this.pm.focus()):this.pm.sel.fastPoll()}}},{key:"move",value:function(event){!this.leaveToBrowser&&(Math.abs(this.x-event.clientX)>4||Math.abs(this.y-event.clientY)>4)&&(this.leaveToBrowser=!0),this.pm.sel.fastPoll()}}]),MouseDown}();handlers.touchdown=function(pm){pm.sel.fastPoll()},handlers.contextmenu=function(pm,e){(0,_dompos.handleNodeClick)(pm,"handleContextMenu",e,realTarget(pm,e),!1)},handlers.compositionstart=function(pm,e){!pm.input.composing&&(0,_selection.hasFocus)(pm)&&pm.input.startComposition(e.data?e.data.length:0,!0)},handlers.compositionupdate=function(pm){!pm.input.composing&&(0,_selection.hasFocus)(pm)&&pm.input.startComposition(0,!1)},handlers.compositionend=function(pm,e){if((0,_selection.hasFocus)(pm)){var composing=pm.input.composing;if(composing){if(composing.applied)return}else{if(!e.data)return;pm.input.startComposition(e.data.length,!1)}clearTimeout(pm.input.finishComposing),pm.operation.composing.ended=!0,pm.input.finishComposing=window.setTimeout(function(){var composing=pm.input.composing;composing&&composing.ended&&pm.input.applyComposition(!0)},20)}},handlers.input=function(pm){if((0,_selection.hasFocus)(pm)){var composing=pm.input.composing;if(composing)return void(composing.ended&&pm.input.applyComposition(!0));(0,_domchange.readInputChange)(pm),pm.flush()}};var cachedCanUpdateClipboard=null;handlers.copy=handlers.cut=function(pm,e){var _pm$selection2=pm.selection,from=_pm$selection2.from,to=_pm$selection2.to,empty=_pm$selection2.empty;!empty&&e.clipboardData&&canUpdateClipboard(e.clipboardData)&&(toClipboard(pm.doc,from,to,e.clipboardData),e.preventDefault(),"cut"!=e.type||empty||pm.tr["delete"](from,to).apply())},handlers.paste=function(pm,e){if((0,_selection.hasFocus)(pm)&&e.clipboardData){var sel=pm.selection,slice=fromClipboard(pm,e.clipboardData,pm.input.shiftKey);slice&&(e.preventDefault(),pm.tr.replace(sel.from,sel.to,slice).apply(pm.apply.scroll))}};var Dragging=function Dragging(slice,from,to){_classCallCheck(this,Dragging),this.slice=slice,this.from=from,this.to=to};handlers.dragstart=function(pm,e){var mouseDown=pm.input.mouseDown;if(mouseDown&&mouseDown.done(),e.dataTransfer){var _pm$selection3=pm.selection,from=_pm$selection3.from,to=_pm$selection3.to,empty=_pm$selection3.empty,dragging=void 0,pos=!empty&&pm.posAtCoords({left:e.clientX,top:e.clientY});if(null!=pos&&pos>=from&&to>=pos)dragging={from:from,to:to};else if(mouseDown&&null!=mouseDown.mightDrag){var _pos=mouseDown.mightDrag;dragging={from:_pos,to:_pos+pm.doc.nodeAt(_pos).nodeSize}}if(dragging){var slice=toClipboard(pm.doc,dragging.from,dragging.to,e.dataTransfer);pm.input.dragging=new Dragging(slice,dragging.from,dragging.to)}}},handlers.dragend=function(pm){return window.setTimeout(function(){return pm.input.dragging=null},50)},handlers.dragover=handlers.dragenter=function(pm,e){e.preventDefault();var target=pm.input.dropTarget;target||(target=pm.input.dropTarget=pm.wrapper.appendChild((0,_dom.elt)("div",{"class":"ProseMirror-drop-target"})));var pos=dropPos(pm,e,pm.input.dragging&&pm.input.dragging.slice);if(null!=pos){var coords=pm.coordsAtPos(pos),rect=pm.wrapper.getBoundingClientRect();coords.top-=rect.top,coords.right-=rect.left,coords.bottom-=rect.top,coords.left-=rect.left,target.style.left=coords.left-1+"px",target.style.top=coords.top+"px",target.style.height=coords.bottom-coords.top+"px"}},handlers.dragleave=function(pm,e){e.target==pm.content&&removeDropTarget(pm)},handlers.drop=function(pm,e){var dragging=pm.input.dragging;if(pm.input.dragging=null,removeDropTarget(pm),e.dataTransfer&&!pm.signalDOM(e)){var slice=dragging&&dragging.slice||fromClipboard(pm,e.dataTransfer);if(slice){e.preventDefault();var insertPos=dropPos(pm,e,slice),start=insertPos;if(null==insertPos)return;var tr=pm.tr;dragging&&!e.ctrlKey&&null!=dragging.from&&(tr["delete"](dragging.from,dragging.to),insertPos=tr.map(insertPos)),tr.replace(insertPos,insertPos,slice).apply();var found=void 0;if(1==slice.content.childCount&&0==slice.openLeft&&0==slice.openRight&&slice.content.child(0).type.selectable&&(found=pm.doc.nodeAt(insertPos))&&found.sameMarkup(slice.content.child(0)))pm.setNodeSelection(insertPos);else{var left=(0,_selection.findSelectionNear)(pm.doc,insertPos,1,!0).from,right=(0,_selection.findSelectionNear)(pm.doc,tr.map(start),-1,!0).to;pm.setTextSelection(left,right)}pm.focus()}}},handlers.focus=function(pm){pm.wrapper.classList.add("ProseMirror-focused"),pm.signal("focus")},handlers.blur=function(pm){pm.wrapper.classList.remove("ProseMirror-focused"),pm.signal("blur")}},{"../dom":1,"../format":21,"../model":34,"./capturekeys":3,"./domchange":7,"./dompos":8,"./selection":17,browserkeymap:57}],13:[function(require,module,exports){"use strict";function _interopRequireDefault(obj){return obj&&obj.__esModule?obj:{"default":obj}}function _classCallCheck(instance,Constructor){if(!(instance instanceof Constructor))throw new TypeError("Cannot call a class as a function")}var _createClass=function(){function defineProperties(target,props){for(var i=0;i=0&&pos<=this.doc.content.size;if(valid&&textblock&&(valid=this.doc.resolve(pos).parent.isTextblock),!valid)throw new RangeError("Position "+pos+" is not valid in current document")}},{key:"ensureOperation",value:function(options){return this.operation||this.startOperation(options)}},{key:"startOperation",value:function(options){var _this=this;return this.operation=new Operation(this),options&&options.readSelection===!1||!this.sel.readFromDOM()||(this.operation.sel=this.sel.range),null==this.flushScheduled&&(this.flushScheduled=(0,_dom.requestAnimationFrame)(function(){return _this.flush()})),this.operation}},{key:"unscheduleFlush",value:function(){null!=this.flushScheduled&&((0,_dom.cancelAnimationFrame)(this.flushScheduled),this.flushScheduled=null)}},{key:"flush",value:function(){if(this.unscheduleFlush(),!document.body.contains(this.wrapper)||!this.operation)return!1;this.signal("flushing");var op=this.operation,redrawn=!1;return op?(op.composing&&this.input.applyComposition(),this.operation=null,this.accurateSelection=!0,(op.doc!=this.doc||this.dirtyNodes.size)&&((0,_draw.redraw)(this,this.dirtyNodes,this.doc,op.doc),this.dirtyNodes.clear(),redrawn=!0),(redrawn||!op.sel.eq(this.sel.range)||op.focus)&&this.sel.toDOM(op.focus),op.scrollIntoView!==!1&&(0,_dompos.scrollIntoView)(this,op.scrollIntoView),redrawn&&this.signal("draw"),this.signal("flush"),this.accurateSelection=!1,redrawn):!1}},{key:"addKeymap",value:function(map){var rank=arguments.length<=1||void 0===arguments[1]?50:arguments[1];(0,_sortedinsert2["default"])(this.input.keymaps,{map:map,rank:rank},function(a,b){return a.rank-b.rank})}},{key:"removeKeymap",value:function(map){for(var maps=this.input.keymaps,i=0;i-1:deflt==name)return this.commandKeys[name]=key}for(var _key in keymap.bindings){var bound=keymap.bindings[_key];if(Array.isArray(bound)?bound.indexOf(name)>-1:bound==name)return this.commandKeys[name]=_key}return this.commandKeys[name]=null}},{key:"markRangeDirty",value:function(from,to){var doc=arguments.length<=2||void 0===arguments[2]?this.doc:arguments[2];this.ensureOperation();for(var dirty=this.dirtyNodes,$from=doc.resolve(from),$to=doc.resolve(to),same=$from.sameDepth($to),depth=0;same>=depth;depth++){var child=$from.node(depth);dirty.has(child)||dirty.set(child,DIRTY_RESCAN)}for(var start=$from.index(same),end=Math.max(start+1,$to.index(same)+(same==$to.depth?0:1)),parent=$from.node(same),i=start;end>i;i++)dirty.set(parent.child(i),DIRTY_REDRAW)}},{key:"markAllDirty",value:function(){this.dirtyNodes.set(this.doc,DIRTY_REDRAW)}},{key:"translate",value:function(string){var trans=this.options.translate;return trans?trans(string):string}},{key:"selection",get:function(){return this.accurateSelection||this.ensureOperation(),this.sel.range}},{key:"tr",get:function(){return new _transform.EditorTransform(this)}}]),ProseMirror}();ProseMirror.prototype.apply.scroll={scrollIntoView:!0};var DIRTY_RESCAN=exports.DIRTY_RESCAN=1,DIRTY_REDRAW=exports.DIRTY_REDRAW=2,nullOptions={};(0,_event.eventMixin)(ProseMirror);var Operation=function Operation(pm){_classCallCheck(this,Operation),this.doc=pm.doc,this.docSet=!1,this.sel=pm.sel.range,this.scrollIntoView=!1,this.focus=!1,this.mappings=[],this.composing=null}},{"../dom":1,"../format":21,"../util/event":53,"../util/map":54,"../util/sortedinsert":56,"./css":6,"./dompos":8,"./draw":9,"./history":10,"./input":12,"./options":14,"./range":15,"./selection":17,"./transform":18,browserkeymap:57}],14:[function(require,module,exports){"use strict";function _classCallCheck(instance,Constructor){if(!(instance instanceof Constructor))throw new TypeError("Cannot call a class as a function")}function defineOption(name,defaultValue,update,updateOnInit){options[name]=new Option(defaultValue,update,updateOnInit)}function parseOptions(obj){var result=Object.create(null),given=obj?[obj].concat(obj.use||[]):[];outer:for(var opt in options){for(var i=0;imax){for(var i=min;max>i;i++)if(this.sorted[i].at>=at)return i;return max}var mid=min+max>>1;this.sorted[mid].at>at?max=mid:min=mid}}},{key:"insert",value:function(obj){this.sorted.splice(this.find(obj.at),0,obj)}},{key:"remove",value:function(at,range){for(var pos=this.find(at),dist=0;;dist++){var leftPos=pos-dist-1,rightPos=pos+dist;if(leftPos>=0&&this.sorted[leftPos].range==range)return void this.sorted.splice(leftPos,1);if(rightPos0&&this.sorted[pos-1].at>at;)this.sorted[pos]=this.sorted[pos-1],this.sorted[--pos]=cur}}]),RangeSorter}(),RangeTracker=(exports.RangeStore=function(){function RangeStore(pm){_classCallCheck(this,RangeStore),this.pm=pm,this.ranges=[],this.sorted=new RangeSorter}return _createClass(RangeStore,[{key:"addRange",value:function(range){this.ranges.push(range),this.sorted.insert({type:"open",at:range.from,range:range}),this.sorted.insert({type:"close",at:range.to,range:range}),range.options.className&&this.pm.markRangeDirty(range.from,range.to)}},{key:"removeRange",value:function(range){var found=this.ranges.indexOf(range);found>-1&&(this.ranges.splice(found,1),this.sorted.remove(range.from,range),this.sorted.remove(range.to,range),range.options.className&&this.pm.markRangeDirty(range.from,range.to),range.remove())}},{key:"transform",value:function(mapping){for(var i=0;i=range.to?(this.removeRange(range),i--):range.from>range.to&&(range.to=range.from)}this.sorted.resort()}},{key:"activeRangeTracker",value:function(){return new RangeTracker(this.sorted.sorted)}}]),RangeStore}(),function(){function RangeTracker(sorted){_classCallCheck(this,RangeTracker),this.sorted=sorted,this.pos=0,this.current=[]}return _createClass(RangeTracker,[{key:"advanceTo",value:function(pos){for(var next=void 0;this.pos=pos?-1:next.at;this.pos++}}}]),RangeTracker}())},{"../util/event":53}],16:[function(require,module,exports){"use strict";function selectedListItems(pm,type){var _pm$selection3=pm.selection,node=_pm$selection3.node,from=_pm$selection3.from,to=_pm$selection3.to,$from=pm.doc.resolve(from);if(node&&node.type==type)return{from:from,to:to,depth:$from.depth+1};var itemDepth=$from.parent.type==type?$from.depth:$from.depth>0&&$from.node($from.depth-1).type==type?$from.depth-1:null;if(null!=itemDepth){var $to=pm.doc.resolve(to);return $from.sameDepth($to)=i&&["Shift-Ctrl-"+i],menu:{group:"textblockHeading",rank:30+i,display:{type:"label",label:"Level "+i},activeDisplay:"Head "+i}}:void 0})},i=1;10>=i;i++)_loop(i);_model.Paragraph.register("command","make",{derive:!0,label:"Change to paragraph",keys:["Shift-Ctrl-0"],menu:{group:"textblock",rank:10,display:{type:"label",label:"Plain"},activeDisplay:"Plain"}}),_model.CodeBlock.register("command","make",{derive:!0,label:"Change to code block",keys:["Shift-Ctrl-\\"],menu:{group:"textblock",rank:20,display:{type:"label",label:"Code"},activeDisplay:"Code"}}),_model.HorizontalRule.register("command","insert",{derive:!0,label:"Insert horizontal rule",keys:["Mod-Shift--"],menu:{group:"insert",rank:70,display:{type:"label",label:"Horizontal rule"}}})},{"../format":21,"../model":34,"./command":5}],17:[function(require,module,exports){"use strict";function _possibleConstructorReturn(self,call){if(!self)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return!call||"object"!=typeof call&&"function"!=typeof call?self:call}function _inherits(subClass,superClass){if("function"!=typeof superClass&&null!==superClass)throw new TypeError("Super expression must either be null or a function, not "+typeof superClass);subClass.prototype=Object.create(superClass&&superClass.prototype,{constructor:{value:subClass,enumerable:!1,writable:!0,configurable:!0}}),superClass&&(Object.setPrototypeOf?Object.setPrototypeOf(subClass,superClass):subClass.__proto__=superClass)}function _classCallCheck(instance,Constructor){if(!(instance instanceof Constructor))throw new TypeError("Cannot call a class as a function")}function hasFocus(pm){if(document.activeElement!=pm.content)return!1;var sel=window.getSelection();return sel.rangeCount&&(0,_dom.contains)(pm.content,sel.anchorNode)}function findSelectionIn(node,pos,index,dir,text){for(var i=index-(dir>0?0:1);dir>0?i=0;i+=dir){var child=node.child(i);if(child.isTextblock)return new TextSelection(pos+dir);if(child.type.contains){var inner=findSelectionIn(child,pos+dir,0>dir?child.childCount:0,dir,text);if(inner)return inner}else if(!text&&child.type.selectable)return new NodeSelection(pos-(0>dir?child.nodeSize:0),pos+(dir>0?child.nodeSize:0),child);pos+=child.nodeSize*dir}}function findSelectionFrom(doc,pos,dir,text){var $pos=doc.resolve(pos),inner=$pos.parent.isTextblock?new TextSelection(pos):findSelectionIn($pos.parent,pos,$pos.index($pos.depth),dir,text);if(inner)return inner;for(var depth=$pos.depth-1;depth>=0;depth--){var found=0>dir?findSelectionIn($pos.node(depth),$pos.before(depth+1),$pos.index(depth),dir,text):findSelectionIn($pos.node(depth),$pos.after(depth+1),$pos.index(depth)+1,dir,text);if(found)return found}}function findSelectionNear(doc,pos){var bias=arguments.length<=2||void 0===arguments[2]?1:arguments[2],text=arguments[3],result=findSelectionFrom(doc,pos,bias,text)||findSelectionFrom(doc,pos,-bias,text);if(!result)throw new RangeError("Searching for selection in invalid document "+doc);return result}function findSelectionAtStart(node,text){return findSelectionIn(node,0,0,1,text)}function findSelectionAtEnd(node,text){return findSelectionIn(node,node.content.size,node.childCount,-1,text)}function verticalMotionLeavesTextblock(pm,pos,dir){for(var $pos=pm.doc.resolve(pos),dom=(0,_dompos.DOMAfterPos)(pm,$pos.before($pos.depth)),coords=(0,_dompos.coordsAtPos)(pm,pos),child=dom.firstChild;child;child=child.nextSibling)if(1==child.nodeType)for(var boxes=child.getClientRects(),i=0;idir?box.bottomcoords.bottom)return!1}return!0}var _createClass=function(){function defineProperties(target,props){for(var i=0;inewRange.to?-1:1,!0);newRange=new TextSelection(selNearAnchor.anchor,newRange.head)}else if(anchornewRange.to){var inv=anchor>newRange.to;newRange=new TextSelection(findSelectionNear(doc,anchor,inv?-1:1,!0).anchor,findSelectionNear(doc,inv?newRange.from:newRange.to,inv?1:-1,!0).head)}return this.setAndSignal(newRange),newRange instanceof NodeSelection||newRange.head!=head||newRange.anchor!=anchor?this.toDOM():(this.clearNode(),this.storeDOMState()),!0}},{key:"toDOM",value:function(takeFocus){if(!hasFocus(this.pm)){if(!takeFocus)return;_dom.browser.gecko&&this.pm.content.focus()}this.range instanceof NodeSelection?this.nodeToDOM():this.rangeToDOM()}},{key:"nodeToDOM",value:function(){var dom=(0,_dompos.DOMAfterPos)(this.pm,this.range.from);dom!=this.lastNode&&(this.clearNode(),dom.classList.add("ProseMirror-selectednode"),this.pm.content.classList.add("ProseMirror-nodeselection"),this.lastNode=dom);var range=document.createRange(),sel=window.getSelection();range.selectNode(dom),sel.removeAllRanges(),sel.addRange(range),this.storeDOMState()}},{key:"rangeToDOM",value:function(){this.clearNode();var anchor=(0,_dompos.DOMFromPos)(this.pm,this.range.anchor),head=(0,_dompos.DOMFromPos)(this.pm,this.range.head),sel=window.getSelection(),range=document.createRange();if(sel.extend)range.setEnd(anchor.node,anchor.offset),range.collapse(!1);else{if(this.range.anchor>this.range.head){var tmp=anchor;anchor=head,head=tmp}range.setEnd(head.node,head.offset),range.setStart(anchor.node,anchor.offset)}sel.removeAllRanges(),sel.addRange(range),sel.extend&&sel.extend(head.node,head.offset),this.storeDOMState()}},{key:"clearNode",value:function(){return this.lastNode?(this.lastNode.classList.remove("ProseMirror-selectednode"),this.pm.content.classList.remove("ProseMirror-nodeselection"),this.lastNode=null,!0):void 0}},{key:"receivedFocus",value:function(){null==this.polling&&this.startPolling()}}]),SelectionState}(),exports.Selection=function Selection(){_classCallCheck(this,Selection)}),TextSelection=exports.TextSelection=function(_Selection){function TextSelection(anchor,head){_classCallCheck(this,TextSelection);var _this2=_possibleConstructorReturn(this,Object.getPrototypeOf(TextSelection).call(this));return _this2.anchor=anchor,_this2.head=null==head?anchor:head,_this2}return _inherits(TextSelection,_Selection),_createClass(TextSelection,[{key:"eq",value:function(other){return other instanceof TextSelection&&other.head==this.head&&other.anchor==this.anchor}},{key:"map",value:function(doc,mapping){var head=mapping.map(this.head);if(!doc.resolve(head).parent.isTextblock)return findSelectionNear(doc,head);var anchor=mapping.map(this.anchor);return new TextSelection(doc.resolve(anchor).parent.isTextblock?anchor:head,head)}},{key:"inverted",get:function(){return this.anchor>this.head}},{key:"from",get:function(){return Math.min(this.head,this.anchor)}},{key:"to",get:function(){return Math.max(this.head,this.anchor)}},{key:"empty",get:function(){return this.anchor==this.head}},{key:"token",get:function(){return new SelectionToken(TextSelection,this.anchor,this.head)}}],[{key:"mapToken",value:function(token,mapping){return new SelectionToken(TextSelection,mapping.map(token.a),mapping.map(token.b))}},{key:"fromToken",value:function(token,doc){return doc.resolve(token.b).parent.isTextblock?new TextSelection(doc.resolve(token.a).parent.isTextblock?token.a:token.b,token.b):findSelectionNear(doc,token.b)}}]),TextSelection}(Selection),NodeSelection=exports.NodeSelection=function(_Selection2){function NodeSelection(from,to,node){_classCallCheck(this,NodeSelection);var _this3=_possibleConstructorReturn(this,Object.getPrototypeOf(NodeSelection).call(this));return _this3.from=from,_this3.to=to,_this3.node=node,_this3}return _inherits(NodeSelection,_Selection2),_createClass(NodeSelection,[{key:"eq",value:function(other){return other instanceof NodeSelection&&this.from==other.from}},{key:"map",value:function(doc,mapping){var from=mapping.map(this.from,1),to=mapping.map(this.to,-1),node=doc.nodeAt(from);return node&&to==from+node.nodeSize&&node.type.selectable?new NodeSelection(from,to,node):findSelectionNear(doc,from)}},{key:"empty",get:function(){return!1}},{key:"token",get:function(){return new SelectionToken(NodeSelection,this.from,this.to)}}],[{key:"mapToken",value:function(token,mapping){return new SelectionToken(TextSelection,mapping.map(token.a,1),mapping.map(token.b,-1))}},{key:"fromToken",value:function(token,doc){var node=doc.nodeAt(token.a);return node&&token.b==token.a+node.nodeSize&&node.type.selectable?new NodeSelection(token.a,token.b,node):findSelectionNear(doc,token.a)}}]),NodeSelection}(Selection),SelectionToken=function SelectionToken(type,a,b){_classCallCheck(this,SelectionToken),this.type=type,this.a=a,this.b=b}},{"../dom":1,"./dompos":8}],18:[function(require,module,exports){"use strict";function _classCallCheck(instance,Constructor){if(!(instance instanceof Constructor))throw new TypeError("Cannot call a class as a function")}function _possibleConstructorReturn(self,call){if(!self)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return!call||"object"!=typeof call&&"function"!=typeof call?self:call}function _inherits(subClass,superClass){if("function"!=typeof superClass&&null!==superClass)throw new TypeError("Super expression must either be null or a function, not "+typeof superClass);subClass.prototype=Object.create(superClass&&superClass.prototype,{constructor:{value:subClass,enumerable:!1,writable:!0,configurable:!0}}),superClass&&(Object.setPrototypeOf?Object.setPrototypeOf(subClass,superClass):subClass.__proto__=superClass)}var _createClass=function(){function defineProperties(target,props){for(var i=0;i=0;i--){var route=this.stack[i].type.findConnection(node.type);if(route){if(i==this.stack.length-1)this.doClose();else for(;this.stack.length>i+1;)this.leave();found=route;break}}if(!found)return;for(var j=0;jstack.length;)this.leave();for(;;){var n=this.stack.length-1,one=this.stack[n],two=stack[n];if(one.type==two.type&&_model.Node.sameAttrs(one.attrs,two.attrs))break;this.leave()}for(;stack.length>this.stack.length;){var add=stack[this.stack.length];this.enter(add.type,add.attrs)}this.marks.length&&(this.marks=noMarks),this.closing=!1}},{key:"wrapIn",value:function(dom,type,attrs){this.enter(type,attrs),this.addAll(dom.firstChild,null,!0),this.leave()}},{key:"wrapMark",value:function(inner,mark){var old=this.marks;this.marks=(mark.instance||mark).addToSet(old),inner.call?inner():this.addAll(inner.firstChild,null),this.marks=old}},{key:"normalizeList",value:function(dom){for(var prev,child=dom.firstChild;child;child=child.nextSibling)1==child.nodeType&&listElements.hasOwnProperty(child.nodeName.toLowerCase())&&(prev=child.previousSibling)&&(prev.appendChild(child),child=prev)}},{key:"top",get:function(){return this.stack[this.stack.length-1]}}]),DOMParseState}();_model.Paragraph.register("parseDOM","p",{parse:"block"}),_model.BlockQuote.register("parseDOM","blockquote",{parse:"block"});for(var _loop=function(i){_model.Heading.registerComputed("parseDOM","h"+i,function(type){return i<=type.maxLevel?{parse:function(dom,state){state.wrapIn(dom,this,{level:String(i)})}}:void 0})},i=1;6>=i;i++)_loop(i);_model.HorizontalRule.register("parseDOM","hr",{parse:"block"}),_model.CodeBlock.register("parseDOM","pre",{parse:function(dom,state){var params=dom.firstChild&&/^code$/i.test(dom.firstChild.nodeName)&&dom.firstChild.getAttribute("class");if(params&&/fence/.test(params)){for(var found=[],re=/(?:^|\s)lang-(\S+)/g,m=void 0;m=re.exec(params);)found.push(m[1]);params=found.join(" ")}else params=null;var text=dom.textContent;state.insert(this,{params:params},text?[state.schema.text(text)]:[])}}),_model.BulletList.register("parseDOM","ul",{parse:"block"}),_model.OrderedList.register("parseDOM","ol",{parse:function(dom,state){var attrs={order:dom.getAttribute("start")||"1"};state.wrapIn(dom,this,attrs)}}),_model.ListItem.register("parseDOM","li",{parse:"block"}),_model.HardBreak.register("parseDOM","br",{parse:function(_,state){state.insert(this)}}),_model.Image.register("parseDOM","img",{parse:function(dom,state){state.insert(this,{src:dom.getAttribute("src"),title:dom.getAttribute("title")||null,alt:dom.getAttribute("alt")||null})}}),_model.LinkMark.register("parseDOM","a",{parse:function(dom,state){state.wrapMark(dom,this.create({href:dom.getAttribute("href"),title:dom.getAttribute("title")}))},selector:"[href]"}),_model.EmMark.register("parseDOM","i",{parse:"mark"}),_model.EmMark.register("parseDOM","em",{parse:"mark"}),_model.EmMark.register("parseDOMStyle","font-style",{parse:function(value,state,inner){"italic"==value?state.wrapMark(inner,this):inner()}}),_model.StrongMark.register("parseDOM","b",{parse:"mark"}),_model.StrongMark.register("parseDOM","strong",{parse:"mark"}),_model.StrongMark.register("parseDOMStyle","font-weight",{parse:function(value,state,inner){"bold"==value||"bolder"==value||!/\D/.test(value)&&+value>=500?state.wrapMark(inner,this):inner()}}),_model.CodeMark.register("parseDOM","code",{parse:"mark"})},{"../model":34,"../util/sortedinsert":56,"./register":22}],20:[function(require,module,exports){"use strict";function fromText(schema,text){for(var blocks=text.trim().split(/\n{2,}/),nodes=[],i=0;i2?_len-2:0),_key=2;_len>_key;_key++)content[_key-2]=arguments[_key];for(var i=0;i=0;i--){var wrap=this.renderMark(marks[i]);wrap.appendChild(dom),dom=wrap}return dom}},{key:"renderAs",value:function(node,tagName,tagAttrs){this.options.preRenderContent&&this.options.preRenderContent(node);var dom=this.renderFragment(node.content,this.elt(tagName,tagAttrs));return this.options.onContainer&&this.options.onContainer(dom),this.options.postRenderContent&&this.options.postRenderContent(node),dom}}]),DOMSerializer}();(0,_register.defineTarget)("dom",toDOM),(0,_register.defineTarget)("html",toHTML),def(_model.BlockQuote,function(node,s){return s.renderAs(node,"blockquote")}),_model.BlockQuote.prototype.countCoordsAsChild=function(_,pos,dom,coords){var childBox=dom.firstChild.getBoundingClientRect();return coords.leftchildBox.left-2)return null;if(childBox.top<=coords.top&&childBox.bottom>=coords.top)return pos+1+ +off}}},def(_model.ListItem,function(node,s){return s.renderAs(node,"li")}),def(_model.HorizontalRule,function(_,s){return s.elt("div",null,s.elt("hr"))}),def(_model.Paragraph,function(node,s){return s.renderAs(node,"p")}),def(_model.Heading,function(node,s){return s.renderAs(node,"h"+node.attrs.level)}),def(_model.CodeBlock,function(node,s){var code=s.renderAs(node,"code");return null!=node.attrs.params&&(code.className="fence "+node.attrs.params.replace(/(^|\s+)/g,"$&lang-")),s.elt("pre",null,code)}),def(_model.Text,function(node,s){return s.doc.createTextNode(node.text)}),def(_model.Image,function(node,s){return s.elt("img",{src:node.attrs.src,alt:node.attrs.alt,title:node.attrs.title})}),def(_model.HardBreak,function(_,s){return s.elt("br")}),def(_model.EmMark,function(_,s){return s.elt("em")}),def(_model.StrongMark,function(_,s){return s.elt("strong")}),def(_model.CodeMark,function(_,s){return s.elt("code")}),def(_model.LinkMark,function(mark,s){return s.elt("a",{href:mark.attrs.href,title:mark.attrs.title})})},{"../model":34,"./register":22}],24:[function(require,module,exports){"use strict";function serializeFragment(fragment){var accum="";return fragment.forEach(function(child){return accum+=child.type.serializeText(child)}),accum}function toText(content){return serializeFragment(content).trim()}Object.defineProperty(exports,"__esModule",{value:!0}),exports.toText=toText;var _model=require("../model"),_register=require("./register");_model.Block.prototype.serializeText=function(node){return serializeFragment(node.content)},_model.Textblock.prototype.serializeText=function(node){var text=_model.Block.prototype.serializeText(node);return text&&text+"\n\n"},_model.Inline.prototype.serializeText=function(){return""},_model.HardBreak.prototype.serializeText=function(){return"\n"},_model.Text.prototype.serializeText=function(node){return node.text},(0,_register.defineTarget)("text",toText)},{"../model":34,"./register":22}],25:[function(require,module,exports){"use strict";function wrapAndJoin(pm,pos,type){var attrs=arguments.length<=3||void 0===arguments[3]?null:arguments[3],predicate=arguments.length<=4||void 0===arguments[4]?null:arguments[4],$pos=pm.doc.resolve(pos),d1=$pos.depth-1,sibling=$pos.index(d1)>0&&$pos.node(d1).child($pos.index(d1)-1),join=sibling&&sibling.type==type&&(!predicate||predicate(sibling)),start=pos-$pos.parentOffset,tr=pm.tr["delete"](start,pos).wrap(start,start,type,attrs);join&&tr.join($pos.before($pos.depth)),tr.apply()}function setAs(pm,pos,type,attrs){var $pos=pm.doc.resolve(pos),start=pos-$pos.parentOffset;pm.tr["delete"](start,pos).setBlockType(start,start,type,attrs).apply()}Object.defineProperty(exports,"__esModule",{value:!0}),exports.autoInputRules=void 0;var _model=require("../model"),_edit=require("../edit"),_inputrules=require("./inputrules"),autoInputRules=exports.autoInputRules=Object.create(null);(0,_edit.defineOption)("autoInput",!1,function(pm,val){pm.mod.autoInput&&(pm.mod.autoInput.forEach(function(rule){return(0,_inputrules.removeInputRule)(pm,rule)}),pm.mod.autoInput=null),val&&!function(){val===!0&&(val=["schema",autoInputRules]);var rules=Object.create(null),list=pm.mod.autoInput=[];val.forEach(function(spec){if("schema"===spec)pm.schema.registry("autoInput",function(name,rule,type,typeName){var rname=typeName+":"+name,handler=rule.handler;handler.bind&&(handler=handler.bind(type)),rules[rname]=new _inputrules.InputRule(rule.match,rule.filter,handler)});else for(var name in spec){var _val=spec[name];null==_val?delete rules[name]:rules[name]=_val}});for(var name in rules)(0,_inputrules.addInputRule)(pm,rules[name]),list.push(rules[name])}()}),autoInputRules.emDash=new _inputrules.InputRule(/--$/,"-","—"),autoInputRules.openDoubleQuote=new _inputrules.InputRule(/(?:^|[\s\{\[\(\<'"\u2018\u201C])(")$/,'"',"“"),autoInputRules.closeDoubleQuote=new _inputrules.InputRule(/"$/,'"',"”"),autoInputRules.openSingleQuote=new _inputrules.InputRule(/(?:^|[\s\{\[\(\<'"\u2018\u201C])(')$/,"'","‘"),autoInputRules.closeSingleQuote=new _inputrules.InputRule(/'$/,"'","’"),_model.BlockQuote.register("autoInput","startBlockQuote",new _inputrules.InputRule(/^\s*> $/," ",function(pm,_,pos){wrapAndJoin(pm,pos,this)})),_model.OrderedList.register("autoInput","startOrderedList",new _inputrules.InputRule(/^(\d+)\. $/," ",function(pm,match,pos){var order=+match[1];wrapAndJoin(pm,pos,this,{order:order||null},function(node){return node.childCount+ +node.attrs.order==order})})),_model.BulletList.register("autoInput","startBulletList",new _inputrules.InputRule(/^\s*([-+*]) $/," ",function(pm,match,pos){var bullet=match[1];wrapAndJoin(pm,pos,this,null,function(node){return node.attrs.bullet==bullet})})),_model.CodeBlock.register("autoInput","startCodeBlock",new _inputrules.InputRule(/^```$/,"`",function(pm,_,pos){setAs(pm,pos,this,{params:""})})),_model.Heading.registerComputed("autoInput","startHeading",function(type){var re=new RegExp("^(#{1,"+type.maxLevel+"}) $");return new _inputrules.InputRule(re," ",function(pm,match,pos){setAs(pm,pos,this,{level:match[1].length})})})},{"../edit":11,"../model":34,"./inputrules":26}],26:[function(require,module,exports){"use strict";function _classCallCheck(instance,Constructor){if(!(instance instanceof Constructor))throw new TypeError("Cannot call a class as a function")}function addInputRule(pm,rule){pm.mod.interpretInput||(pm.mod.interpretInput=new InputRules(pm)),pm.mod.interpretInput.addRule(rule)}function removeInputRule(pm,rule){var ii=pm.mod.interpretInput;ii&&(ii.removeRule(rule),0==ii.rules.length&&(ii.unregister(),pm.mod.interpretInput=null))}function getContext($pos){for(var parent=$pos.parent,isCode=parent.type.isCode,textBefore="",i=0,rem=$pos.parentOffset;rem>0;i++){var child=parent.child(i);textBefore+=child.isText?child.text.slice(0,rem):"",rem-=child.nodeSize,0>=rem&&child.marks.some(function(st){return st.type.isCode})&&(isCode=!0)}return{textBefore:textBefore,isCode:isCode}}var _createClass=function(){function defineProperties(target,props){for(var i=0;i-1?(this.rules.splice(found,1),!0):void 0}},{key:"onTextInput",value:function(text){var pos=this.pm.selection.head;if(pos)for(var textBefore=void 0,isCode=void 0,$pos=void 0,lastCh=text[text.length-1],i=0;icur.clientHeight)return cur}var _typeof="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(obj){return typeof obj}:function(obj){return obj&&"function"==typeof Symbol&&obj.constructor===Symbol?"symbol":typeof obj},_createClass=function(){function defineProperties(target,props){for(var i=0;i_this2.maxHeight?(_this2.maxHeight=_this2.wrapper.offsetHeight,function(){_this2.wrapper.style.minHeight=_this2.maxHeight+"px"}):void 0}}},{key:"updateFloat",value:function(){var editorRect=this.pm.wrapper.getBoundingClientRect();if(this.floating)if(editorRect.top>=0||editorRect.bottomwindow.innerHeight?"none":""}else if(editorRect.top<0&&editorRect.bottom>=this.wrapper.offsetHeight+10){this.floating=!0;var menuRect=this.wrapper.getBoundingClientRect();this.wrapper.style.left=menuRect.left+"px",this.wrapper.style.width=menuRect.width+"px",this.wrapper.style.position="fixed",this.spacer=(0,_dom.elt)("div",{"class":prefix+"-spacer",style:"height: "+menuRect.height+"px"}),this.pm.wrapper.insertBefore(this.spacer,this.wrapper)}}},{key:"updateScrollCursor",value:function(){var _this3=this;if(!this.floating)return null;var head=this.pm.selection.head;return head?function(){var cursorPos=_this3.pm.coordsAtPos(head),menuRect=_this3.wrapper.getBoundingClientRect();if(cursorPos.topmenuRect.top){var _ret=function(){var scrollable=findWrappingScrollable(_this3.pm.wrapper);return scrollable?{v:function(){scrollable.scrollTop-=menuRect.bottom-cursorPos.top}}:void 0}();if("object"===("undefined"==typeof _ret?"undefined":_typeof(_ret)))return _ret.v}}:null}}]),MenuBar}();(0,_dom.insertCSS)("\n."+prefix+" {\n border-top-left-radius: inherit;\n border-top-right-radius: inherit;\n position: relative;\n min-height: 1em;\n color: #666;\n padding: 1px 6px;\n top: 0; left: 0; right: 0;\n border-bottom: 1px solid silver;\n background: white;\n z-index: 10;\n -moz-box-sizing: border-box;\n box-sizing: border-box;\n overflow: visible;\n}\n")},{"../dom":1,"../edit":11,"../ui/update":51,"./menu":28}],30:[function(require,module,exports){"use strict";function _classCallCheck(instance,Constructor){if(!(instance instanceof Constructor))throw new TypeError("Cannot call a class as a function")}function topCenterOfSelection(){var range=window.getSelection().getRangeAt(0),rects=range.getClientRects();if(!rects.length)return range.getBoundingClientRect();for(var _rects$=rects[0],left=_rects$.left,right=_rects$.right,top=_rects$.top,i=1;left==right&&rects.length>i;){var _rects=rects[i++];left=_rects.left,right=_rects.right,top=_rects.top}for(;i1)&&(left=Math.min(left,rects[i].left),right=Math.max(right,rects[i].right),top=Math.min(top,rects[i].top));return{top:top,left:(left+right)/2}}function topOfNodeSelection(pm){var selected=pm.content.querySelector(".ProseMirror-selectednode");if(!selected)return{left:0,top:0};var box=selected.getBoundingClientRect();return{left:Math.min((box.left+box.right)/2,box.left+20),top:box.top}}var _createClass=function(){function defineProperties(target,props){for(var i=0;isame&&childA.text[childA.text.length-same-1]==childB.text[childB.text.length-same-1];)same++,posA--,posB--;return{a:posA,b:posB}}if(childA.content.size||childB.content.size){var inner=findDiffEnd(childA.content,childB.content,posA-1,posB-1);if(inner)return inner}posA-=size,posB-=size}else posA-=size,posB-=size}}Object.defineProperty(exports,"__esModule",{value:!0}),exports.findDiffStart=findDiffStart,exports.findDiffEnd=findDiffEnd},{}],33:[function(require,module,exports){"use strict";function _classCallCheck(instance,Constructor){if(!(instance instanceof Constructor))throw new TypeError("Cannot call a class as a function")}function retIndex(index,offset){return found.index=index,found.offset=offset,found}var _createClass=function(){function defineProperties(target,props){for(var i=0;i"}},{key:"toStringInner",value:function(){return this.content.join(", ")}},{key:"nodesBetween",value:function(from,to,f,nodeStart,parent){for(var i=0,pos=0;to>pos;i++){var child=this.content[i],end=pos+child.nodeSize;if(end>from&&f(child,nodeStart+pos,parent)!==!1&&child.content.size){var start=pos+1;child.nodesBetween(Math.max(0,from-start),Math.min(child.content.size,to-start),f,nodeStart+start)}pos=end}}},{key:"cut",value:function(from,to){if(null==to&&(to=this.size),0==from&&to==this.size)return this;var result=[],size=0;if(to>from)for(var i=0,pos=0;to>pos;i++){var child=this.content[i],end=pos+child.nodeSize;end>from&&((from>pos||end>to)&&(child=child.isText?child.cut(Math.max(0,from-pos),Math.min(child.text.length,to-pos)):child.cut(Math.max(0,from-pos-1),Math.min(child.content.size,to-pos-1))),result.push(child),size+=child.nodeSize),pos=end}return new Fragment(result,size)}},{key:"append",value:function(other){if(!other.size)return this;if(!this.size)return other;var last=this.lastChild,first=other.firstChild,content=this.content.slice(),i=0;for(last.isText&&last.sameMarkup(first)&&(content[content.length-1]=last.copy(last.text+first.text),i=1);i=0;i--){var cur=this.child(i).type.kind;kind=kind?kind.sharedSuperKind(cur):cur}return kind}},{key:"findIndex",value:function(pos){var round=arguments.length<=1||void 0===arguments[1]?-1:arguments[1];if(0==pos)return retIndex(0,pos);if(pos==this.size)return retIndex(this.content.length,pos);if(pos>this.size||0>pos)throw new RangeError("Position "+pos+" outside of fragment ("+this+")");for(var i=0,curPos=0;;i++){var cur=this.child(i),end=curPos+cur.nodeSize;if(end>=pos)return end==pos||round>0?retIndex(i+1,end):retIndex(i,curPos);curPos=end}}},{key:"textContent",get:function(){var text="";return this.content.forEach(function(n){return text+=n.textContent}),text}},{key:"firstChild",get:function(){return this.content.length?this.content[0]:null}},{key:"lastChild",get:function(){return this.content.length?this.content[this.content.length-1]:null}},{key:"childCount",get:function(){return this.content.length}}],[{key:"fromJSON",value:function(schema,value){return value?new Fragment(value.map(schema.nodeFromJSON)):Fragment.empty}},{key:"fromArray",value:function(array){if(!array.length)return Fragment.empty;for(var joined=void 0,size=0,i=0;ithis.type.rank)return set.slice(0,i).concat(this).concat(set.slice(i))}return set.concat(this)}},{key:"removeFromSet",value:function(set){for(var i=0;i=0;i--)str=marks[i].type.name+"("+str+")";return str}var _get=function get(object,property,receiver){null===object&&(object=Function.prototype);var desc=Object.getOwnPropertyDescriptor(object,property);if(void 0===desc){var parent=Object.getPrototypeOf(object);return null===parent?void 0:get(parent,property,receiver)}if("value"in desc)return desc.value;var getter=desc.get;if(void 0!==getter)return getter.call(receiver)},_createClass=function(){function defineProperties(target,props){for(var i=0;ioffset)return{node:this.content.child(index),index:index,offset:offset};var node=this.content.child(index-1);return{node:node,index:index-1,offset:offset-node.nodeSize}}},{key:"nodesBetween",value:function(from,to,f){var pos=arguments.length<=3||void 0===arguments[3]?0:arguments[3];this.content.nodesBetween(from,to,f,pos,this)}},{key:"descendants",value:function(f){this.nodesBetween(0,this.content.size,f)}},{key:"resolve",value:function(pos){return _resolvedpos.ResolvedPos.resolveCached(this,pos)}},{key:"resolveNoCache",value:function(pos){return _resolvedpos.ResolvedPos.resolve(this,pos)}},{key:"marksAt",value:function(pos){var $pos=this.resolve(pos),parent=$pos.parent,index=$pos.index($pos.depth);if(0==parent.content.size)return emptyArray;if(0==index||!$pos.atNodeBoundary)return parent.child(index).marks;for(var marks=parent.child(index-1).marks,i=0;i$from.depth)throw new ReplaceError("Inserted content deeper than insertion position");if($from.depth-slice.openLeft!=$to.depth-slice.openRight)throw new ReplaceError("Inconsistent open depths");return replaceOuter($from,$to,slice,0)}function replaceOuter($from,$to,slice,depth){var index=$from.index(depth),node=$from.node(depth);if(index==$to.index(depth)&&depth<$from.depth-slice.openLeft){var inner=replaceOuter($from,$to,slice,depth+1);return node.copy(node.content.replaceChild(index,inner))}if(slice.content.size){var _prepareSliceForRepla=prepareSliceForReplace(slice,$from),start=_prepareSliceForRepla.start,end=_prepareSliceForRepla.end;return close(node,replaceThreeWay($from,start,end,$to,depth))}return close(node,replaceTwoWay($from,$to,depth))}function checkJoin(main,sub){if(!main.type.canContainContent(sub.type))throw new ReplaceError("Cannot join "+sub.type.name+" onto "+main.type.name)}function joinable($before,$after,depth){var node=$before.node(depth);return checkJoin(node,$after.node(depth)),node}function addNode(child,target){var last=target.length-1;last>=0&&child.isText&&child.sameMarkup(target[last])?target[last]=child.copy(target[last].text+child.text):target.push(child)}function addRange($start,$end,depth,target){var node=($end||$start).node(depth),startIndex=0,endIndex=$end?$end.index(depth):node.childCount;$start&&(startIndex=$start.index(depth),$start.depth>depth?startIndex++:$start.atNodeBoundary||(addNode($start.nodeAfter,target),startIndex++));for(var i=startIndex;endIndex>i;i++)addNode(node.child(i),target);$end&&$end.depth==depth&&!$end.atNodeBoundary&&addNode($end.nodeBefore,target)}function close(node,content){if(!node.type.checkContent(content,node.attrs))throw new ReplaceError("Invalid content for node "+node.type.name);return node.copy(content)}function replaceThreeWay($from,$start,$end,$to,depth){var openLeft=$from.depth>depth&&joinable($from,$start,depth+1),openRight=$to.depth>depth&&joinable($end,$to,depth+1),content=[];return addRange(null,$from,depth,content),openLeft&&openRight&&$start.index(depth)==$end.index(depth)?(checkJoin(openLeft,openRight),addNode(close(openLeft,replaceThreeWay($from,$start,$end,$to,depth+1)),content)):(openLeft&&addNode(close(openLeft,replaceTwoWay($from,$start,depth+1)),content),addRange($start,$end,depth,content),openRight&&addNode(close(openRight,replaceTwoWay($end,$to,depth+1)),content)),addRange($to,null,depth,content),new _fragment.Fragment(content)}function replaceTwoWay($from,$to,depth){var content=[];if(addRange(null,$from,depth,content),$from.depth>depth){var type=joinable($from,$to,depth+1);addNode(close(type,replaceTwoWay($from,$to,depth+1)),content)}return addRange($to,null,depth,content),new _fragment.Fragment(content)}function prepareSliceForReplace(slice,$along){var extra=$along.depth-slice.openLeft,parent=$along.node(extra);if(!parent.type.canContainFragment(slice.content))throw new ReplaceError("Content "+slice.content+" cannot be placed in "+parent.type.name);for(var node=parent.copy(slice.content),i=extra-1;i>=0;i--)node=$along.node(i).copy(_fragment.Fragment.from(node));return{start:node.resolveNoCache(slice.openLeft+extra),end:node.resolveNoCache(node.content.size-slice.openRight-extra)}}var _createClass=function(){function defineProperties(target,props){for(var i=0;idepth&&this.index(depth)==other.index(depth);)++depth;return depth}},{key:"sameParent",value:function(other){return this.pos-this.parentOffset==other.pos-other.parentOffset}},{key:"toString",value:function(){for(var str="",i=1;i<=this.depth;i++)str+=(str?"/":"")+this.node(i).type.name+"_"+this.index(i-1);return str+":"+this.parentOffset}},{key:"parent",get:function(){return this.node(this.depth)}},{key:"atNodeBoundary",get:function(){return this.path[this.path.length-1]==this.pos}},{key:"nodeAfter",get:function(){var parent=this.parent,index=this.index(this.depth);if(index==parent.childCount)return null;var dOff=this.pos-this.path[this.path.length-1],child=parent.child(index);return dOff?parent.child(index).cut(dOff):child}},{key:"nodeBefore",get:function(){var index=this.index(this.depth),dOff=this.pos-this.path[this.path.length-1];return dOff?this.parent.child(index).cut(0,dOff):0==index?null:this.parent.child(index-1)}}],[{key:"resolve",value:function(doc,pos){if(!(pos>=0&&pos<=doc.content.size))throw new RangeError("Position "+pos+" out of range");for(var path=[],start=0,parentOffset=pos,node=doc;;){var _node$content$findInd=node.content.findIndex(parentOffset),index=_node$content$findInd.index,offset=_node$content$findInd.offset,rem=parentOffset-offset;if(path.push(node,index,start+offset),!rem)break;if(node=node.child(index),node.isText)break;parentOffset=rem-1,start+=offset+1}return new ResolvedPos(pos,path,parentOffset)}},{key:"resolveCached",value:function(doc,pos){for(var i=0;i=0;i--)inner=conn[i].create(null,inner);return _fragment.Fragment.from(inner)}},{key:"contains",get:function(){return NodeKind.block}},{key:"kind",get:function(){return NodeKind.block}},{key:"isBlock",get:function(){return!0}},{key:"canBeEmpty",get:function(){return null==this.contains}}]),Block}(NodeType),Inline=(exports.Textblock=function(_Block){function Textblock(){return _classCallCheck(this,Textblock),_possibleConstructorReturn(this,Object.getPrototypeOf(Textblock).apply(this,arguments))}return _inherits(Textblock,_Block),_createClass(Textblock,[{key:"contains",get:function(){return NodeKind.inline}},{key:"containsMarks",get:function(){return!0}},{key:"isTextblock",get:function(){return!0}},{key:"canBeEmpty",get:function(){return!0}}]),Textblock}(Block),exports.Inline=function(_NodeType2){function Inline(){return _classCallCheck(this,Inline),_possibleConstructorReturn(this,Object.getPrototypeOf(Inline).apply(this,arguments))}return _inherits(Inline,_NodeType2),_createClass(Inline,[{key:"kind",get:function(){return NodeKind.inline}},{key:"isInline",get:function(){return!0}}]),Inline}(NodeType)),MarkType=(exports.Text=function(_Inline){function Text(){return _classCallCheck(this,Text),_possibleConstructorReturn(this,Object.getPrototypeOf(Text).apply(this,arguments))}return _inherits(Text,_Inline),_createClass(Text,[{key:"create",value:function(attrs,content,marks){return new _node.TextNode(this,this.computeAttrs(attrs,content),content,marks)}},{key:"selectable",get:function(){return!1}},{key:"isText",get:function(){return!0}},{key:"kind",get:function(){return NodeKind.text}}]),Text}(Inline),exports.Attribute=function Attribute(){var options=arguments.length<=0||void 0===arguments[0]?{}:arguments[0];_classCallCheck(this,Attribute),this["default"]=options["default"],this.compute=options.compute,this.label=options.label},exports.MarkType=function(_SchemaItem2){function MarkType(name,rank,schema){_classCallCheck(this,MarkType);var _this8=_possibleConstructorReturn(this,Object.getPrototypeOf(MarkType).call(this));_this8.name=name,_this8.freezeAttrs(),_this8.rank=rank,_this8.schema=schema;var defaults=_this8.getDefaultAttrs();return _this8.instance=defaults&&new _mark.Mark(_this8,defaults),_this8}return _inherits(MarkType,_SchemaItem2),_createClass(MarkType,[{key:"create",value:function(attrs){return!attrs&&this.instance?this.instance:new _mark.Mark(this,this.computeAttrs(attrs))}},{key:"removeFromSet",value:function(set){for(var i=0;ii;i++){var obj=i?this.marks:this.nodes;for(var tname in obj){var type=obj[tname],registry=type.registry,ns=registry&®istry[namespace];if(ns)for(var prop in ns){var value=ns[prop](type);null!=value&&f(prop,value,type,tname)}}}}}]),Schema}());exports.Schema=Schema},{"../util/obj":55,"./fragment":33,"./mark":35,"./node":36}],40:[function(require,module,exports){"use strict";function isFlatRange($from,$to){if($from.depth!=$to.depth)return!1;for(var i=0;i<$from.depth;i++)if($from.index(i)!=$to.index(i))return!1;return $from.parentOffset<=$to.parentOffset}function canLift(doc,from,to){return!!findLiftable(doc.resolve(from),doc.resolve(null==to?from:to))}function rangeDepth(from,to){var shared=from.sameDepth(to);return from.node(shared).isTextblock&&--shared,shared&&from.before(shared)>=to.after(shared)?null:shared}function findLiftable(from,to){var shared=rangeDepth(from,to);if(null==shared)return null;for(var parent=from.node(shared),depth=shared-1;depth>=0;--depth)if(from.node(depth).type.canContainContent(parent.type))return{depth:depth,shared:shared,unwrap:!1};if(parent.isBlock)for(var depth=shared-1;depth>=0;--depth){for(var target=from.node(depth),i=from.index(shared),e=Math.min(to.index(shared)+1,parent.childCount);e>i;i++)target.type.canContainContent(parent.child(i).type);return{depth:depth,shared:shared,unwrap:!0}}}function canWrap(doc,from,to,type){return!!checkWrap(doc.resolve(from),doc.resolve(null==to?from:to),type)}function checkWrap($from,$to,type){var shared=rangeDepth($from,$to);if(null==shared)return null;var parent=$from.node(shared),around=parent.type.findConnection(type),inside=type.findConnection(parent.child($from.index(shared)).type);return around&&inside?{shared:shared,around:around,inside:inside}:void 0}Object.defineProperty(exports,"__esModule",{value:!0}),exports.canLift=canLift,exports.canWrap=canWrap;var _model=require("../model"),_transform=require("./transform"),_step=require("./step"),_map=require("./map");_step.Step.define("ancestor",{apply:function(doc,step){var $from=doc.resolve(step.from),$to=doc.resolve(step.to);if(!isFlatRange($from,$to))return _step.StepResult.fail("Not a flat range");var _step$param=step.param,_step$param$depth=_step$param.depth,depth=void 0===_step$param$depth?0:_step$param$depth,_step$param$types=_step$param.types,types=void 0===_step$param$types?[]:_step$param$types,_step$param$attrs=_step$param.attrs,attrs=void 0===_step$param$attrs?[]:_step$param$attrs;if(0==depth&&0==types.length)return _step.StepResult.ok(doc);for(var i=0,d=$from.depth;depth>i;i++,d--)if($from.start(d)!=$from.pos-i||$to.end(d)!=$to.pos+i)return _step.StepResult.fail("Parent at depth "+d+" not fully covered");var inner=$from.parent,slice=void 0;if(types.length){var lastWrapper=types[types.length-1];if(!lastWrapper.contains)throw new RangeError("Can not wrap content in node type "+lastWrapper.name);var content=inner.content.cut($from.parentOffset,$to.parentOffset);if(!lastWrapper.checkContent(content,attrs[types.length-1]))return _step.StepResult.fail("Content can not be wrapped in ancestor "+lastWrapper.name);for(var i=types.length-1;i>=0;i--)content=_model.Fragment.from(types[i].create(attrs[i],content));slice=new _model.Slice(content,0,0)}else slice=new _model.Slice(inner.content,0,0);return _step.StepResult.fromReplace(doc,$from.pos-depth,$to.pos+depth,slice)},posMap:function(step){var depth=step.param.depth||0,newDepth=step.param.types?step.param.types.length:0;return depth==newDepth&&2>depth?_map.PosMap.empty:new _map.PosMap([step.from-depth,depth,newDepth,step.to,depth,newDepth])},invert:function(step,oldDoc){for(var types=[],attrs=[],$from=oldDoc.resolve(step.from),oldDepth=step.param.depth||0,newDepth=step.param.types?step.param.types.length:0,i=0;oldDepth>i;i++){var parent=$from.node($from.depth-i);types.unshift(parent.type),attrs.unshift(parent.attrs)}var dDepth=newDepth-oldDepth;return new _step.Step("ancestor",step.from+dDepth,step.to+dDepth,{depth:newDepth,types:types,attrs:attrs})},paramToJSON:function(param){return{depth:param.depth,types:param.types&¶m.types.map(function(t){return t.name}),attrs:param.attrs}},paramFromJSON:function(schema,json){return{depth:json.depth,types:json.types&&json.types.map(function(n){return schema.nodeType(n)}),attrs:json.attrs}}}),_transform.Transform.prototype.lift=function(from){var to=arguments.length<=1||void 0===arguments[1]?from:arguments[1],silent=arguments.length<=2||void 0===arguments[2]?!1:arguments[2],$from=this.doc.resolve(from),$to=this.doc.resolve(to),liftable=findLiftable($from,$to);if(!liftable){if(!silent)throw new RangeError("No valid lift target");return this}for(var depth=liftable.depth,shared=liftable.shared,unwrap=liftable.unwrap,start=$from.before(shared+1),end=$to.after(shared+1),d=shared;d>depth;d--)if($to.index(d)+1<$to.node(d).childCount){this.split($to.after(d+1),d-depth);break}for(var d=shared;d>depth;d--)if($from.index(d)>0){var cut=d-depth;this.split($from.before(d+1),cut),start+=2*cut,end+=2*cut;break}if(unwrap){for(var joinPos=start,parent=$from.node(shared),i=$from.index(shared),e=$to.index(shared)+1,first=!0;e>i;i++,first=!1)first||(this.join(joinPos),end-=2),joinPos+=parent.child(i).nodeSize-(first?0:2);shared++,start++,end--}return this.step("ancestor",start,end,{depth:shared-depth})},_transform.Transform.prototype.wrap=function(from){var to=arguments.length<=1||void 0===arguments[1]?from:arguments[1],type=arguments[2],wrapAttrs=arguments[3],$from=this.doc.resolve(from),$to=this.doc.resolve(to),check=checkWrap($from,$to,type);if(!check)throw new RangeError("Wrap not possible");var shared=check.shared,around=check.around,inside=check.inside,types=around.concat(type).concat(inside),attrs=around.map(function(){return null}).concat(wrapAttrs).concat(inside.map(function(){return null})),start=$from.before(shared+1);if(this.step("ancestor",start,$to.after(shared+1),{types:types,attrs:attrs}),inside.length)for(var splitPos=start+types.length,parent=$from.node(shared),i=$from.index(shared),e=$to.index(shared)+1,first=!0;e>i;i++,first=!1)first||this.split(splitPos,inside.length),splitPos+=parent.child(i).nodeSize+(first?0:2*inside.length);return this},_transform.Transform.prototype.setBlockType=function(from){var to=arguments.length<=1||void 0===arguments[1]?from:arguments[1],_this=this,type=arguments[2],attrs=arguments[3];if(!type.isTextblock)throw new RangeError("Type given to setBlockType should be a textblock");return this.doc.nodesBetween(from,to,function(node,pos){if(node.isTextblock&&!node.hasMarkup(type,attrs)){var start=pos+1,end=start+node.content.size;return _this.clearMarkup(start,end,type),_this.step("ancestor",start,end,{depth:1,types:[type],attrs:[attrs]}),!1}}),this},_transform.Transform.prototype.setNodeType=function(pos,type,attrs){var node=this.doc.nodeAt(pos);if(!node)throw new RangeError("No node at given position");return type||(type=node.type),node.type.contains?this.step("ancestor",pos+1,pos+1+node.content.size,{depth:1,types:[type],attrs:[attrs]}):this.replaceWith(pos,pos+node.nodeSize,type.create(attrs,null,node.marks))}},{"../model":34,"./map":43,"./step":47,"./transform":48}],41:[function(require,module,exports){"use strict";Object.defineProperty(exports,"__esModule",{value:!0}),exports.Remapping=exports.MapResult=exports.PosMap=exports.joinable=exports.joinPoint=exports.canWrap=exports.canLift=exports.StepResult=exports.Step=exports.TransformError=exports.Transform=void 0;var _transform=require("./transform");Object.defineProperty(exports,"Transform",{enumerable:!0,get:function(){return _transform.Transform}}),Object.defineProperty(exports,"TransformError",{enumerable:!0,get:function(){return _transform.TransformError}});var _step=require("./step");Object.defineProperty(exports,"Step",{enumerable:!0,get:function(){return _step.Step}}),Object.defineProperty(exports,"StepResult",{enumerable:!0,get:function(){return _step.StepResult}});var _ancestor=require("./ancestor");Object.defineProperty(exports,"canLift",{enumerable:!0,get:function(){return _ancestor.canLift}}),Object.defineProperty(exports,"canWrap",{enumerable:!0,get:function(){return _ancestor.canWrap}});var _join=require("./join");Object.defineProperty(exports,"joinPoint",{enumerable:!0,get:function(){return _join.joinPoint}}),Object.defineProperty(exports,"joinable",{enumerable:!0,get:function(){return _join.joinable}});var _map=require("./map");Object.defineProperty(exports,"PosMap",{enumerable:!0,get:function(){return _map.PosMap}}),Object.defineProperty(exports,"MapResult",{enumerable:!0,get:function(){ +return _map.MapResult}}),Object.defineProperty(exports,"Remapping",{enumerable:!0,get:function(){return _map.Remapping}}),require("./mark"),require("./split"),require("./replace")},{"./ancestor":40,"./join":42,"./map":43,"./mark":44,"./replace":45,"./split":46,"./step":47,"./transform":48}],42:[function(require,module,exports){"use strict";function joinable(doc,pos){var $pos=doc.resolve(pos);return canJoin($pos.nodeBefore,$pos.nodeAfter)}function canJoin(a,b){return a&&b&&!a.isText&&a.type.contains&&a.type.canContainContent(b.type)}function joinPoint(doc,pos){for(var dir=arguments.length<=2||void 0===arguments[2]?-1:arguments[2],$pos=doc.resolve(pos),d=$pos.depth;;d--){var before=void 0,after=void 0;if(d==$pos.depth?(before=$pos.nodeBefore,after=$pos.nodeAfter):dir>0?(before=$pos.node(d+1),after=$pos.node(d).maybeChild($pos.index(d)+1)):(before=$pos.node(d).maybeChild($pos.index(d)-1),after=$pos.node(d+1)),before&&!before.isTextblock&&canJoin(before,after))return pos;if(0==d)break;pos=0>dir?$pos.before(d):$pos.after(d)}}Object.defineProperty(exports,"__esModule",{value:!0}),exports.joinable=joinable,exports.joinPoint=joinPoint;var _model=require("../model"),_transform=require("./transform"),_step=require("./step"),_map=require("./map");_step.Step.define("join",{apply:function(doc,step){var $from=doc.resolve(step.from),$to=doc.resolve(step.to);return $from.parentOffset<$from.parent.content.size||$to.parentOffset>0||$to.pos-$from.pos!=2?_step.StepResult.fail("Join positions not around a split"):_step.StepResult.fromReplace(doc,$from.pos,$to.pos,_model.Slice.empty)},posMap:function(step){return new _map.PosMap([step.from,2,0])},invert:function(step,doc){var $before=doc.resolve(step.from),d1=$before.depth-1,parentAfter=$before.node(d1).child($before.index(d1)+1),param=null;return $before.parent.sameMarkup(parentAfter)||(param={type:parentAfter.type,attrs:parentAfter.attrs}),new _step.Step("split",step.from,step.from,param)}}),_transform.Transform.prototype.join=function(pos){for(var depth=arguments.length<=1||void 0===arguments[1]?1:arguments[1],silent=arguments.length<=2||void 0===arguments[2]?!1:arguments[2],i=0;depth>i;i++){var $pos=this.doc.resolve(pos);if(0==$pos.parentOffset||$pos.parentOffset==$pos.parent.content.size||!$pos.nodeBefore.type.canContainContent($pos.nodeAfter.type)){if(!silent)throw new RangeError("Nothing to join at "+pos);break}this.step("join",pos-1,pos+1),pos--}return this}},{"../model":34,"./map":43,"./step":47,"./transform":48}],43:[function(require,module,exports){"use strict";function _classCallCheck(instance,Constructor){if(!(instance instanceof Constructor))throw new TypeError("Cannot call a class as a function")}function makeRecover(index,offset){return index+offset*factor16}function recoverIndex(value){return value&lower16}function recoverOffset(value){return(value-(value&lower16))/factor16}function mapThrough(mappables,pos,bias){for(var i=0;ii;i++)diff+=this.ranges[3*i+2]-this.ranges[3*i+1];return this.ranges[3*index]+diff+recoverOffset(value)}},{key:"mapResult",value:function(pos,bias){return this._map(pos,bias,!1)}},{key:"map",value:function(pos,bias){return this._map(pos,bias,!0)}},{key:"_map",value:function(pos,bias,simple){for(var diff=0,oldIndex=this.inverted?2:1,newIndex=this.inverted?1:2,i=0;ipos)break;var oldSize=this.ranges[i+oldIndex],newSize=this.ranges[i+newIndex],end=start+oldSize;if(end>=pos){var side=oldSize?pos==start?-1:pos==end?1:bias:bias,result=start+diff+(0>side?0:newSize);if(simple)return result;var recover=makeRecover(i/3,pos-start);return new MapResult(result,pos!=start&&pos!=end,recover)}diff+=newSize-oldSize}return simple?pos+diff:new MapResult(pos+diff)}},{key:"touches",value:function(pos,recover){for(var diff=0,index=recoverIndex(recover),oldIndex=this.inverted?2:1,newIndex=this.inverted?1:2,i=0;ipos)break;var oldSize=this.ranges[i+oldIndex],end=start+oldSize;if(end>=pos&&i==3*index)return!0;diff+=this.ranges[i+newIndex]-oldSize}return!1}},{key:"invert",value:function(){return new PosMap(this.ranges,!this.inverted)}},{key:"toString",value:function(){return(this.inverted?"-":"")+JSON.stringify(this.ranges)}}]),PosMap}();PosMap.empty=new PosMap([]);exports.Remapping=function(){function Remapping(){var head=arguments.length<=0||void 0===arguments[0]?[]:arguments[0],tail=arguments.length<=1||void 0===arguments[1]?[]:arguments[1];_classCallCheck(this,Remapping),this.head=head,this.tail=tail,this.mirror=Object.create(null)}return _createClass(Remapping,[{key:"addToFront",value:function(map,corr){this.head.push(map);var id=-this.head.length;return null!=corr&&(this.mirror[id]=corr),id}},{key:"addToBack",value:function(map,corr){this.tail.push(map);var id=this.tail.length-1;return null!=corr&&(this.mirror[corr]=id),id}},{key:"get",value:function(id){return 0>id?this.head[-id-1]:this.tail[id]}},{key:"mapResult",value:function(pos,bias){return this._map(pos,bias,!1)}},{key:"map",value:function(pos,bias){return this._map(pos,bias,!0)}},{key:"_map",value:function(pos,bias,simple){for(var deleted=!1,recoverables=null,i=-this.head.length;i"+this.mirror[i]:""));return maps.join("\n")}}]),Remapping}()},{}],44:[function(require,module,exports){"use strict";function mapNode(node,f,parent){return node.content.size&&(node=node.copy(mapFragment(node.content,f,node))),node.isInline&&(node=f(node,parent)),node}function mapFragment(fragment,f,parent){for(var mapped=[],i=0;i=0;i--)this.step(delSteps[i]);return this}},{"../model":34,"./step":47,"./transform":48}],45:[function(require,module,exports){"use strict";function fitSliceInto($from,$to,slice){var base=$from.sameDepth($to),placed=placeSlice($from,slice),outer=outerPlaced(placed);outer&&(base=Math.min(outer.depth,base)),distAfter=-1e10;var fragment=closeFragment($from.node(base).type,fillBetween($from,$to,base,placed),$from,$to,base);return{fitted:new _model.Slice(fragment,$from.depth-base,$to.depth-base),distAfter:distAfter-($to.depth-base)}}function outerPlaced(placed){for(var i=0;idepth&&$from.node(depth+1),toNext=$to.depth>depth&&$to.node(depth+1),placedHere=placed[depth];if(fromNext&&toNext&&fromNext.type.canContainContent(toNext.type)&&!placedHere)return _model.Fragment.from(closeNode(fromNext,fillBetween($from,$to,depth+1,placed),$from,$to,depth+1));var content=_model.Fragment.empty;return placedHere&&(content=closeLeft(placedHere.content,placedHere.openLeft),placedHere.isEnd&&(distAfter=placedHere.openRight)),distAfter--,fromNext&&(content=content.addToStart(closeNode(fromNext,fillFrom($from,depth+1,placed),$from,null,depth+1))),toNext?content=closeTo(content,$to,depth+1,placedHere?placedHere.openRight:0):placedHere&&(content=closeRight(content,placedHere.openRight)),distAfter++,content}function fillFrom($from,depth,placed){var placedHere=placed[depth],content=_model.Fragment.empty;return placedHere&&(content=closeRight(placedHere.content,placedHere.openRight),placedHere.isEnd&&(distAfter=placedHere.openRight)),distAfter--,$from.depth>depth&&(content=content.addToStart(closeNode($from.node(depth+1),fillFrom($from,depth+1,placed),$from,null,depth+1))),distAfter++,content}function closeTo(content,$to,depth,openDepth){var after=$to.node(depth);if(0==openDepth||!after.type.canContainContent(content.lastChild.type)){var finish=closeNode(after,fillTo($to,depth),null,$to,depth);return distAfter+=finish.nodeSize,closeRight(content,openDepth).addToEnd(finish)}var inner=content.lastChild.content;return depth<$to.depth&&(inner=closeTo(inner,$to,depth+1,openDepth-1)),content.replaceChild(content.childCount-1,after.copy(inner))}function fillTo(to,depth){return to.depth==depth?_model.Fragment.empty:_model.Fragment.from(closeNode(to.node(depth+1),fillTo(to,depth+1),null,to,depth+1))}function closeRight(content,openDepth){if(0==openDepth)return content;var last=content.lastChild,closed=closeNode(last,closeRight(last.content,openDepth-1));return closed==last?content:content.replaceChild(content.childCount-1,closed)}function closeLeft(content,openDepth){if(0==openDepth)return content;var first=content.firstChild,closed=closeNode(first,first.content);return closed==first?content:content.replaceChild(0,closed)}function closeFragment(type,content,$to,$from,depth){if(type.canBeEmpty)return content;var hasContent=content.size||$to&&($to.depth>depth||$to.index(depth))||$from&&($from.depth>depth||$from.index(depth)<$from.node(depth).childCount);return hasContent?content:type.defaultContent()}function closeNode(node,content,$to,$from,depth){return node.copy(closeFragment(node.type,content,$to,$from,depth))}function nodeLeft(slice,depth){for(var content=slice.content,i=1;depth>i;i++)content=content.firstChild.content;return content.firstChild}function placeSlice($from,slice){for(var dFrom=$from.depth,unplaced=null,openLeftUnplaced=0,placed=[],parents=null,dSlice=slice.openLeft;;--dSlice){var curType=void 0,curAttrs=void 0,curFragment=void 0;if(dSlice>=0){if(dSlice>0){var _nodeLeft=nodeLeft(slice,dSlice);curType=_nodeLeft.type,curAttrs=_nodeLeft.attrs,curFragment=_nodeLeft.content}else 0==dSlice&&(curFragment=slice.content);dSlice=dSlice)break;var found=findPlacement(curType,curFragment,$from,dFrom);if(found>-1){if(curFragment.size>0&&(placed[found]={content:curFragment,openLeft:openLeftUnplaced,openRight:dSlice>0?0:slice.openRight-dSlice,isEnd:0>=dSlice,depth:found}),0>=dSlice)break;unplaced=null,openLeftUnplaced=0,dFrom=Math.max(0,found-1)}else{if(0==dSlice){if(parents=$from.node(0).type.findConnectionToKind(curFragment.leastSuperKind()),!parents)break;parents.unshift($from.node(0).type),curType=parents[parents.length-1]}unplaced=curType.create(curAttrs,curFragment),openLeftUnplaced++}}return placed}function findPlacement(type,fragment,$from,start){for(var d=start;d>=0;d--){var fromType=$from.node(d).type;if(type?fromType.canContainContent(type):fromType.canContainFragment(fragment))return d}return-1}function mergeTextblockAfter(tr,$inside,$after){for(var base=$inside.sameDepth($after),end=$after.end($after.depth),cutAt=end+1,cutDepth=$after.depth-1;cutDepth>base&&$after.index(cutDepth)+1==$after.node(cutDepth).childCount;)--cutDepth,++cutAt;cutDepth>base&&tr.split(cutAt,cutDepth-base);for(var types=[],attrs=[],i=base+1;i<=$inside.depth;i++){var node=$inside.node(i);types.push(node.type),attrs.push(node.attrs)}tr.step("ancestor",$after.pos,end,{depth:$after.depth-base,types:types,attrs:attrs}),tr.join($after.pos-($after.depth-base),$inside.depth-base)}var _model=require("../model"),_transform=require("./transform"),_step=require("./step"),_map=require("./map");_step.Step.define("replace",{apply:function(doc,step){return _step.StepResult.fromReplace(doc,step.from,step.to,step.param)},posMap:function(step){return new _map.PosMap([step.from,step.to-step.from,step.param.size])},invert:function(step,oldDoc){return new _step.Step("replace",step.from,step.from+step.param.size,oldDoc.slice(step.from,step.to))},paramToJSON:function(param){return param.toJSON()},paramFromJSON:function(schema,json){return _model.Slice.fromJSON(schema,json)}}),_transform.Transform.prototype["delete"]=function(from,to){return from!=to&&this.replace(from,to,_model.Slice.empty),this},_transform.Transform.prototype.replace=function(from){var to=arguments.length<=1||void 0===arguments[1]?from:arguments[1],slice=arguments.length<=2||void 0===arguments[2]?_model.Slice.empty:arguments[2],$from=this.doc.resolve(from),$to=this.doc.resolve(to),_fitSliceInto=fitSliceInto($from,$to,slice),fitted=_fitSliceInto.fitted,distAfter=_fitSliceInto.distAfter,fSize=fitted.size;if(from==to&&!fSize)return this;if(this.step("replace",from,to,fitted),!fSize||!$to.parent.isTextblock)return this;var after=from+fSize,inner=slice.size?0>distAfter?-1:after-distAfter:from,$inner=void 0;return-1!=inner&&inner!=after&&($inner=this.doc.resolve(inner)).parent.isTextblock&&$inner.parent.type.canContainFragment($to.parent.content)?(mergeTextblockAfter(this,$inner,this.doc.resolve(after)),this):this},_transform.Transform.prototype.replaceWith=function(from,to,content){return this.replace(from,to,new _model.Slice(_model.Fragment.from(content),0,0))},_transform.Transform.prototype.insert=function(pos,content){return this.replaceWith(pos,pos,content)},_transform.Transform.prototype.insertText=function(pos,text){return this.insert(pos,this.doc.type.schema.text(text,this.doc.marksAt(pos)))},_transform.Transform.prototype.insertInline=function(pos,node){return this.insert(pos,node.mark(this.doc.marksAt(pos)))};var distAfter=0},{"../model":34,"./map":43,"./step":47,"./transform":48}],46:[function(require,module,exports){"use strict";var _model=require("../model"),_transform=require("./transform"),_step=require("./step"),_map=require("./map");_step.Step.define("split",{apply:function(doc,step){var $pos=doc.resolve(step.from),parent=$pos.parent,cut=[parent.copy(),step.param?step.param.type.create(step.attrs):parent.copy()];return _step.StepResult.fromReplace(doc,$pos.pos,$pos.pos,new _model.Slice(_model.Fragment.fromArray(cut),1,1))},posMap:function(step){return new _map.PosMap([step.from,0,2])},invert:function(step){return new _step.Step("join",step.from,step.from+2)},paramToJSON:function(param){return param&&{type:param.type.name,attrs:param.attrs}},paramFromJSON:function(schema,json){return json&&{type:schema.nodeType(json.type),attrs:json.attrs}}}),_transform.Transform.prototype.split=function(pos){for(var depth=arguments.length<=1||void 0===arguments[1]?1:arguments[1],typeAfter=arguments[2],attrsAfter=arguments[3],i=0;depth>i;i++)this.step("split",pos+i,pos+i,0==i&&typeAfter?{type:typeAfter,attrs:attrsAfter}:null);return this},_transform.Transform.prototype.splitIfNeeded=function(pos){for(var depth=arguments.length<=1||void 0===arguments[1]?1:arguments[1],$pos=this.doc.resolve(pos),before=!0,i=0;depth>i;i++){var d=$pos.depth-i,point=0==i?$pos.pos:before?$pos.before(d+1):$pos.after(d+1);if(point==$pos.start(d))before=!0;else{if(point!=$pos.end(d))return this.split(point,depth-i);before=!1}}return this}},{"../model":34,"./map":43,"./step":47,"./transform":48}],47:[function(require,module,exports){"use strict";function _classCallCheck(instance,Constructor){if(!(instance instanceof Constructor))throw new TypeError("Cannot call a class as a function")}var _createClass=function(){function defineProperties(target,props){for(var i=0;i-1&&this.waiting.splice(index,1)}},{key:"force",value:function(){for(clearTimeout(this.timeout),this.lastForce=Date.now();this.waiting.length;)for(var i=0;iMIN_FLUSH_DELAY&&this.force()}}],[{key:"get",value:function(pm){return pm.mod.centralScheduler||(pm.mod.centralScheduler=new this(pm))}}]),CentralScheduler}();exports.UpdateScheduler=function(){function UpdateScheduler(pm,events,start){var _this2=this;_classCallCheck(this,UpdateScheduler),this.pm=pm,this.start=start,this.events=events.split(" "),this.onEvent=this.onEvent.bind(this),this.events.forEach(function(event){return pm.on(event,_this2.onEvent)})}return _createClass(UpdateScheduler,[{key:"detach",value:function(){var _this3=this;unscheduleDOMUpdate(this.pm,this.start),this.events.forEach(function(event){return _this3.pm.off(event,_this3.onEvent)})}},{key:"onEvent",value:function(){scheduleDOMUpdate(this.pm,this.start)}},{key:"force",value:function(){if(this.pm.operation)this.onEvent();else{unscheduleDOMUpdate(this.pm,this.start);for(var run=this.start;run;run=run());}}}]),UpdateScheduler}()},{}],52:[function(require,module,exports){"use strict";function ProseMirrorError(message){Error.call(this,message),this.message!=message&&(this.message=message,Error.captureStackTrace?Error.captureStackTrace(this,this.name):this.stack=new Error(message).stack)}function functionName(f){var match=/^function (\w+)/.exec(f.toString());return match&&match[1]}Object.defineProperty(exports,"__esModule",{value:!0}),exports.ProseMirrorError=ProseMirrorError,ProseMirrorError.prototype=Object.create(Error.prototype),ProseMirrorError.prototype.constructor=ProseMirrorError,Object.defineProperty(ProseMirrorError.prototype,"name",{get:function(){return this.constructor.name||functionName(this.constructor)||"ProseMirrorError"}})},{}],53:[function(require,module,exports){"use strict";function getHandlers(obj,type){return obj._handlers&&obj._handlers[type]||noHandlers}function eventMixin(ctor){var proto=ctor.prototype;for(var prop in methods)methods.hasOwnProperty(prop)&&(proto[prop]=methods[prop])}Object.defineProperty(exports,"__esModule",{value:!0}),exports.eventMixin=eventMixin;var noHandlers=[],methods={on:function(type,handler){var map=this._handlers||(this._handlers=Object.create(null));map[type]=type in map?map[type].concat(handler):[handler]},off:function(type,handler){var map=this._handlers,arr=map&&map[type];if(arr)for(var i=0;i1?_len-1:0),_key=1;_len>_key;_key++)args[_key-1]=arguments[_key];for(var i=0;i1?_len2-1:0),_key2=1;_len2>_key2;_key2++)args[_key2-1]=arguments[_key2];for(var i=0;i0}}},{}],54:[function(require,module,exports){"use strict";function _classCallCheck(instance,Constructor){if(!(instance instanceof Constructor))throw new TypeError("Cannot call a class as a function")}var _createClass=function(){function defineProperties(target,props){for(var i=0;i-1?this.content[found+1]=value:this.content.push(key,value)}},{key:"get",value:function(key){var found=this.find(key);return-1==found?void 0:this.content[found+1]}},{key:"has",value:function(key){return this.find(key)>-1}},{key:"find",value:function(key){for(var i=0;i0);i++);array.splice(i,0,elt)}Object.defineProperty(exports,"__esModule",{value:!0}),exports["default"]=sortedInsert},{}],57:[function(require,module,exports){!function(mod){if("object"==typeof exports&&"object"==typeof module)module.exports=mod();else{if("function"==typeof define&&define.amd)return define([],mod);(this||window).browserKeymap=mod()}}(function(){"use strict";function keyName(event){if("keypress"==event.type)return"'"+String.fromCharCode(event.charCode)+"'";var base=keyNames[event.keyCode],name=base;return null==name||event.altGraphKey?null:(event.altKey&&"Alt"!=base&&(name="Alt-"+name),event.ctrlKey&&"Ctrl"!=base&&(name="Ctrl-"+name),event.metaKey&&"Cmd"!=base&&(name="Cmd-"+name),event.shiftKey&&"Shift"!=base&&(name="Shift-"+name),name)}function isModifierKey(name){return name=/[^-]*$/.exec(name)[0],"Ctrl"==name||"Alt"==name||"Shift"==name||"Mod"==name}function normalizeKeyName(name){for(var alt,ctrl,shift,cmd,parts=name.split(/-(?!'?$)/),result=parts[parts.length-1],i=0;ii;i++)keyNames[i+48]=keyNames[i+96]=String(i);for(var i=65;90>=i;i++)keyNames[i]=String.fromCharCode(i);for(var i=1;12>=i;i++)keyNames[i+111]=keyNames[i+63235]="F"+i;return Keymap.prototype={normalize:function(name){return this.options.multi!==!1?name.split(/ +(?!\'$)/).map(normalizeKeyName):[normalizeKeyName(name)]},addBinding:function(keyname,value){for(var keys=this.normalize(keyname),i=0;i=0;i--){var name=keys.slice(0,i).join(" "),val=this.bindings[name];if("..."==val&&!this.unusedMulti(name))break;val&&delete this.bindings[name]}},unusedMulti:function(name){for(var binding in this.bindings)if(binding.length>name&&0==binding.indexOf(name)&&" "==binding.charAt(name.length))return!1;return!0},lookup:function(key,context){return this.options.call?this.options.call(key,context):this.bindings[key]},constructor:Keymap},Keymap.keyName=keyName,Keymap.isModifierKey=isModifierKey,Keymap.normalizeKeyName=normalizeKeyName,Keymap})},{}],58:[function(require,module,exports){module.exports=function(element,fn){function resizeListener(e){var win=e.target||e.srcElement;win.__resizeRAF__&&cancelFrame(win.__resizeRAF__),win.__resizeRAF__=requestFrame(function(){var trigger=win.__resizeTrigger__;trigger.__resizeListeners__.forEach(function(fn){fn.call(trigger,e)})})}function objectLoad(e){this.contentDocument.defaultView.__resizeTrigger__=this.__resizeElement__,this.contentDocument.defaultView.addEventListener("resize",resizeListener)}var window=this,document=window.document,attachEvent=document.attachEvent;if("undefined"!=typeof navigator)var isIE=navigator.userAgent.match(/Trident/);var requestFrame=function(){var raf=window.requestAnimationFrame||window.mozRequestAnimationFrame||window.webkitRequestAnimationFrame||function(fn){return window.setTimeout(fn,20)};return function(fn){return raf(fn)}}(),cancelFrame=function(){var cancel=window.cancelAnimationFrame||window.mozCancelAnimationFrame||window.webkitCancelAnimationFrame||window.clearTimeout;return function(id){return cancel(id)}}();if(!element.__resizeListeners__)if(element.__resizeListeners__=[],attachEvent)element.__resizeTrigger__=element,element.attachEvent("onresize",resizeListener);else{"static"==getComputedStyle(element).position&&(element.style.position="relative");var obj=element.__resizeTrigger__=document.createElement("object");obj.setAttribute("style","display: block; position: absolute; top: 0; left: 0; height: 100%; width: 100%; overflow: hidden; pointer-events: none; z-index: -1;"),obj.setAttribute("class","resize-sensor"),obj.__resizeElement__=element,obj.onload=objectLoad,obj.type="text/html",isIE&&element.appendChild(obj),obj.data="about:blank",isIE||element.appendChild(obj)}element.__resizeListeners__.push(fn)}},{}],59:[function(require,module,exports){"use strict";function fleschKincaid(counts){return counts&&counts.sentence&&counts.word&&counts.syllable?SENTENCE_WEIGHT*(counts.word/counts.sentence)+WORD_WEIGHT*(counts.syllable/counts.word)-ADJUSTMENT:NaN}var SENTENCE_WEIGHT,WORD_WEIGHT,ADJUSTMENT;SENTENCE_WEIGHT=.39,WORD_WEIGHT=11.8,ADJUSTMENT=15.59,module.exports=fleschKincaid},{}],60:[function(require,module,exports){"use strict";function flesch(counts){return counts&&counts.sentence&&counts.word&&counts.syllable?BASE-SENTENCE_WEIGHT*(counts.word/counts.sentence)-WORD_WEIGHT*(counts.syllable/counts.word):NaN}var SENTENCE_WEIGHT,WORD_WEIGHT,BASE;SENTENCE_WEIGHT=1.015,WORD_WEIGHT=84.6,BASE=206.835,module.exports=flesch},{}],61:[function(require,module,exports){function constructByRe(){return byRe=new RegExp(re.toString().slice(1,-3)+"\\s*by\\b","gi")}var byRe,irregulars=["awoken","been","born","beat","become","begun","bent","beset","bet","bid","bidden","bound","bitten","bled","blown","broken","bred","brought","broadcast","built","burnt","burst","bought","cast","caught","chosen","clung","come","cost","crept","cut","dealt","dug","dived","done","drawn","dreamt","driven","drunk","eaten","fallen","fed","felt","fought","found","fit","fled","flung","flown","forbidden","forgotten","foregone","forgiven","forsaken","frozen","gotten","given","gone","ground","grown","hung","heard","hidden","hit","held","hurt","kept","knelt","knit","known","laid","led","leapt","learnt","left","lent","let","lain","lighted","lost","made","meant","met","misspelt","mistaken","mown","overcome","overdone","overtaken","overthrown","paid","pled","proven","put","quit","read","rid","ridden","rung","risen","run","sawn","said","seen","sought","sold","sent","set","sewn","shaken","shaven","shorn","shed","shone","shod","shot","shown","shrunk","shut","sung","sunk","sat","slept","slain","slid","slung","slit","smitten","sown","spoken","sped","spent","spilt","spun","spit","split","spread","sprung","stood","stolen","stuck","stung","stunk","stridden","struck","strung","striven","sworn","swept","swollen","swum","swung","taken","taught","torn","told","thought","thrived","thrown","thrust","trodden","understood","upheld","upset","woken","worn","woven","wed","wept","wound","won","withheld","withstood","wrung","written"],exceptions=["indeed"],re=new RegExp("\\b(am|are|were|being|is|been|was|be)\\b\\s*([\\w]+ed|"+irregulars.join("|")+")\\b","gi");module.exports=function(text,options){for(var r=options&&options.by?byRe||constructByRe():re,suggestions=[];match=r.exec(text);)-1===exceptions.indexOf(match[2].toLowerCase())&&suggestions.push({index:match.index,offset:match[0].length});return suggestions}},{}],62:[function(require,module,exports){module.exports={stats:function(text){var data;return text.length&&(data={sentences:this.sentences(text),words:this.words(text),syllables:this.syllables(text),characters:this.characters(text),carpar:this.charactersWords(text),gulpease:this.gulpease(text),gunningFog:this.gunningFog(text)}),data},findSentences:function(text){var sentence,sentences,result,_i,_len;for(sentences=text.split("."),result=[],_i=0,_len=sentences.length;_len>_i;_i++)sentence=sentences[_i],""!==sentence.trim()&&result.push(sentence);return result},sentences:function(text){return this.findSentences(text).length},findWords:function(sentence){return sentence.match(/[A-z\u00E0-\u00FC]+/g)},words:function(sentence){return this.findWords(sentence).length},findSyllables:function(word){return word=word.toLowerCase(),word.length<=3?1:(word=word.replace(/(?:[^laeiouy]es|ed|[^laeiouy]e)$/,""),word=word.replace(/^y/,""),word.match(/[aeiouy]{1,2}/g))},syllables:function(word){return this.findSyllables(word).length},characters:function(sentence){var word,tot,_i,_len;for(sentence=this.findWords(sentence),tot=0,_i=0,_len=sentence.length;_len>_i;_i++)word=sentence[_i],null!==word&&(tot+=word.length);return tot},charactersWords:function(sentence){var result,tot;return tot=this.characters(sentence),result=tot/this.words(sentence),result.toFixed(1)},gulpease:function(text){var _characters,_sentences,_words,_result;return _sentences=this.sentences(text),_characters=this.characters(text),_words=this.words(text),_result=89+(300*_sentences-10*_characters)/_words,parseInt(_result,10)},gunningFog:function(text){var word,_sentences,_i,_len,_words,_wordsComplesse,_result;for(_sentences=this.sentences(text),_words=this.words(text),_wordsComplesse=0,_i=0,_len=_words.length;_len>_i;_i++)word=_words[_i],this.syllables(word)>2&&(_wordsComplesse+=1);return _result=.4*(_words/_sentences+100*(_wordsComplesse/_words)),parseInt(_result,10)}}},{}],63:[function(require,module,exports){"use strict";function setCommentStyle(type){place.innerHTML="","peer"==type?(place.className="peer",pmOptions.commands=_schema.commentOnlyCommands,pmOptions.menuBar=_schema.commentMenuBar,pm=window.pm=new _edit.ProseMirror(pmOptions),pm.on("filterTransform",function(){return!0}),(0,_tool.initComments)(pm)):(place.className="",pmOptions.commands=_schema.commentCommands,pmOptions.menuBar=_schema.mainMenuBar,pm=window.pm=new _edit.ProseMirror(pmOptions),(0,_tool.initComments)(pm,!0))}var _edit=require("prosemirror/dist/edit");require("prosemirror/dist/model");require("prosemirror/dist/menu/tooltipmenu"),require("prosemirror/dist/menu/menubar"),require("prosemirror/dist/inputrules/autoinput");var _schema=require("./schema"),_tool=require("./widgets/tool"),pm=void 0,place=document.querySelector("#editor"),content=document.querySelector("#content"),commentStyle=document.querySelector("#commentstyle");commentStyle.value="peer";var pmOptions={place:place,schema:_schema.widgetSchema,autoInput:!0,doc:content,docFormat:"dom"};setCommentStyle(place.getAttribute("commentstyle")||"peer"),commentStyle&&commentStyle.addEventListener("change",function(){return setCommentStyle(commentStyle.value)})},{"./schema":64,"./widgets/tool":97,"prosemirror/dist/edit":11,"prosemirror/dist/inputrules/autoinput":25,"prosemirror/dist/menu/menubar":29,"prosemirror/dist/menu/tooltipmenu":30,"prosemirror/dist/model":34}],64:[function(require,module,exports){"use strict";Object.defineProperty(exports,"__esModule",{value:!0}),exports.grammarCommands=exports.commentOnlyCommands=exports.noCommands=exports.commentCommands=exports.commands=exports.commentMenuBar=exports.grammarMenuBar=exports.mainMenuBar=exports.widgetSchema=void 0;var _edit=require("prosemirror/dist/edit"),_dom=require("prosemirror/dist/dom"),_menu=require("prosemirror/dist/menu/menu"),_model=require("prosemirror/dist/model"),_questions=require("./widgets/questions"),_input=require("./widgets/input"),_content=require("./widgets/content"),_widgets=require("./widgets"),_tool=require("./widgets/tool"),widgetSpec=new _model.SchemaSpec({doc:_model.Doc,blockquote:_model.BlockQuote,ordered_list:_model.OrderedList,bullet_list:_model.BulletList,list_item:_model.ListItem,paragraph:_model.Paragraph,heading:_model.Heading,text:_model.Text,hard_break:_model.HardBreak,input:_input.Input,checkbox:_input.CheckBox,radiobutton:_input.RadioButton,select:_input.Select,textfield:_input.TextField,textarea:_input.TextArea,question:_questions.Question,textbox:_questions.TextBox,choice:_questions.Choice,multiplechoice:_questions.MultipleChoice,scaledisplay:_questions.ScaleDisplay,scale:_questions.Scale,checkitem:_questions.CheckItem,checklist:_questions.CheckList,shortanswer:_questions.ShortAnswer,essay:_questions.Essay,selection:_questions.Selection,horizontal_rule:_model.HorizontalRule,image:_content.Image,inlinemath:_content.InlineMath,blockmath:_content.BlockMath,website:_content.Website,carryforward:_content.CarryForward,spreadsheet:_content.SpreadSheet,graph:_content.Graph,leftalign:_widgets.LeftAlign,centeralign:_widgets.CenterAlign,rightalign:_widgets.RightAlign},{em:_model.EmMark,strong:_model.StrongMark,link:_model.LinkMark,code:_model.CodeMark,underline:_widgets.UnderlineMark,strikethrough:_widgets.StrikeThroughMark});exports.widgetSchema=new _model.Schema(widgetSpec),exports.mainMenuBar={"float":!0,content:[[_menu.inlineGroup,_menu.insertMenu],[_menu.blockGroup,_menu.textblockMenu],_widgets.alignGroup,[_widgets.contentInsertMenu,_widgets.questionInsertMenu],_widgets.toolGroup,_menu.historyGroup]},exports.grammarMenuBar={"float":!0,content:[[_menu.inlineGroup,_menu.insertMenu],[_menu.blockGroup,_menu.textblockMenu],_widgets.alignGroup,[_widgets.contentInsertMenu,_widgets.questionInsertMenu],_widgets.toolGroup,_menu.historyGroup]},exports.commentMenuBar={"float":!0,content:[_widgets.toolGroup]};_menu.textblockMenu.options.label="Format";var strongIcon={type:"icon",width:805,height:1024,path:"M317 869q42 18 80 18 214 0 214-191 0-65-23-102-15-25-35-42t-38-26-46-14-48-6-54-1q-41 0-57 5 0 30-0 90t-0 90q0 4-0 38t-0 55 2 47 6 38zM309 442q24 4 62 4 46 0 81-7t62-25 42-51 14-81q0-40-16-70t-45-46-61-24-70-8q-28 0-74 7 0 28 2 86t2 86q0 15-0 45t-0 45q0 26 0 39zM0 950l1-53q8-2 48-9t60-15q4-6 7-15t4-19 3-18 1-21 0-19v-37q0-561-12-585-2-4-12-8t-25-6-28-4-27-2-17-1l-2-47q56-1 194-6t213-5q13 0 39 0t38 0q40 0 78 7t73 24 61 40 42 59 16 78q0 29-9 54t-22 41-36 32-41 25-48 22q88 20 146 76t58 141q0 57-20 102t-53 74-78 48-93 27-100 8q-25 0-75-1t-75-1q-60 0-175 6t-132 6z"},emIcon={type:"icon",width:585,height:1024,path:"M0 949l9-48q3-1 46-12t63-21q16-20 23-57 0-4 35-165t65-310 29-169v-14q-13-7-31-10t-39-4-33-3l10-58q18 1 68 3t85 4 68 1q27 0 56-1t69-4 56-3q-2 22-10 50-17 5-58 16t-62 19q-4 10-8 24t-5 22-4 26-3 24q-15 84-50 239t-44 203q-1 5-7 33t-11 51-9 47-3 32l0 10q9 2 105 17-1 25-9 56-6 0-18 0t-18 0q-16 0-49-5t-49-5q-78-1-117-1-29 0-81 5t-69 6z"},noCommands=(exports.commands=_edit.CommandSet["default"].update({selectParentNode:{menu:null},lift:{menu:null},"code:toggle":{menu:{group:"textblock",rank:99,select:"disable",display:{type:"label",label:"Code"}}},"strong:toggle":{menu:{group:"inline",rank:20,select:"disable",display:strongIcon}},"em:toggle":{menu:{group:"inline",rank:21,select:"disable",display:emIcon}}}),exports.commentCommands=_edit.CommandSet["default"].update({selectParentNode:{menu:null},lift:{menu:null},"code:toggle":{menu:{group:"textblock",rank:99,select:"disable",display:{type:"label",label:"Code"}}},"strong:toggle":{menu:{group:"inline",rank:20,select:"disable",display:strongIcon}},"em:toggle":{menu:{group:"inline",rank:21,select:"disable",display:emIcon}},comment:_tool.commentCmdSpec}),exports.noCommands=new _edit.CommandSet(null,function(){return null}));exports.commentOnlyCommands=noCommands.update({comment:_tool.commentCmdSpec}),exports.grammarCommands=_edit.CommandSet["default"].update({selectParentNode:{menu:null},lift:{menu:null},"code:toggle":{menu:{group:"textblock",rank:99,select:"disable",display:{type:"label",label:"Code"}}},"strong:toggle":{menu:{group:"inline",rank:20,select:"disable",display:strongIcon}},"em:toggle":{menu:{group:"inline",rank:21,select:"disable",display:emIcon}},analyze:_tool.analyzeCmdSpec});(0,_dom.insertCSS)('\n \n.ProseMirror {\n}\n\n.ProseMirror-menu {\n background: white;\n color: black;\n}\n\ndiv.ProseMirror-dropdown-menu {\n position: absolute;\n background: white;\n color: black;\n border-radius: 6px;\n border: 1px solid silver;\n padding: 2px 2px;\n z-index: 15;\n}\n\ndiv.ProseMirror-dropdown-menu {\n cursor: pointer;\n padding: 0 1em 0 2px;\n}\n\ndiv.ProseMirror-menubar-inner {\n background: linear-gradient(to bottom, white, #0191C8);\n}\n\ndiv.ProseMirror-menu form {\n background: linear-gradient(to bottom, white, #0191C8);\n width: 300px;\n}\n\ndiv.ProseMirror-menu form select {\n width: 100px;\n background: white;\n}\n\ndiv.ProseMirror-menu input[type = "text"] {\n background: white;\n}\n\n')},{"./widgets":78,"./widgets/content":71,"./widgets/input":80,"./widgets/questions":88,"./widgets/tool":97,"prosemirror/dist/dom":1,"prosemirror/dist/edit":11,"prosemirror/dist/menu/menu":28,"prosemirror/dist/model":34}],65:[function(require,module,exports){"use strict";function defParser(type,tag,cls){type.register("parseDOM",tag,{parse:function(dom,state){if(!dom.classList.contains(cls))return!1;var attrs=Object.create(null);for(var name in this.attrs)attrs[name]=dom.getAttribute(name);state.wrapIn(dom,this,attrs)}})}function getID(){return Math.floor(4294967295*Math.random())}function addDropListeners(pm){pm.content.addEventListener("drop",function(e){return!1})}Object.defineProperty(exports,"__esModule",{value:!0});var _params=require("./params");Object.defineProperty(exports,"widgetParamHandler",{enumerable:!0,get:function(){return _params.widgetParamHandler}}),Object.defineProperty(exports,"defineFileHandler",{enumerable:!0,get:function(){return _params.defineFileHandler}}),Object.defineProperty(exports,"namePattern",{enumerable:!0,get:function(){return _params.namePattern}}),Object.defineProperty(exports,"nameTitle",{enumerable:!0,get:function(){return _params.nameTitle}}),Object.defineProperty(exports,"defParamsClick",{enumerable:!0,get:function(){ +return _params.defParamsClick}}),Object.defineProperty(exports,"selectedNodeAttr",{enumerable:!0,get:function(){return _params.selectedNodeAttr}}),exports.defParser=defParser,exports.getID=getID,exports.addDropListeners=addDropListeners;exports.onResize=require("prosemirror/node_modules/element-resize-event/index.js")},{"./params":66,"prosemirror/node_modules/element-resize-event/index.js":58}],66:[function(require,module,exports){"use strict";function _classCallCheck(instance,Constructor){if(!(instance instanceof Constructor))throw new TypeError("Cannot call a class as a function")}function _possibleConstructorReturn(self,call){if(!self)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return!call||"object"!=typeof call&&"function"!=typeof call?self:call}function _inherits(subClass,superClass){if("function"!=typeof superClass&&null!==superClass)throw new TypeError("Super expression must either be null or a function, not "+typeof superClass);subClass.prototype=Object.create(superClass&&superClass.prototype,{constructor:{value:subClass,enumerable:!1,writable:!0,configurable:!0}}),superClass&&(Object.setPrototypeOf?Object.setPrototypeOf(subClass,superClass):subClass.__proto__=superClass)}function defineFileHandler(handler){fhandler=handler}function getLastClicked(){return lastClicked}function openWidgetPrompt(wpp,options){var close=function close(){wpp.pm.off("interaction",close),dialog.parentNode&&(dialog.parentNode.removeChild(dialog),options&&options.onClose&&options.onClose())},submit=function(){var params=wpp.values();params&&(wpp.command.exec(wpp.pm,params),close())};wpp.pm.on("interaction",close);var save=(0,_dom.elt)("input",{name:"save",type:"button",value:"Save"});save.addEventListener("mousedown",function(e){submit()});var cancel=(0,_dom.elt)("input",{name:"cancel",type:"button",value:"Cancel"});cancel.addEventListener("mousedown",function(e){e.preventDefault(),e.stopPropagation(),close()});var buttons=(0,_dom.elt)("div",{"class":"widgetButtons"},save,cancel);wpp.form=(0,_dom.elt)("form",{"class":"widgetForm"},(0,_dom.elt)("h4",null,wpp.command.label+" Settings"),wpp.fields.map(function(f){return(0,_dom.elt)("div",null,f)}),buttons),wpp.form.addEventListener("keypress",function(e){13==e.keyCode&&(e.preventDefault(),e.stopPropagation(),save.click())});var dialog=(0,_dom.elt)("div",null,(0,_dom.elt)("div",{"class":"widgetDialog"}),wpp.form);return wpp.pm.wrapper.appendChild(dialog),{close:close}}function defParamsClick(type,cmdname){var spots=arguments.length<=2||void 0===arguments[2]?["topright"]:arguments[2];type.prototype.handleClick=function(pm,e,pos,node){e.preventDefault(),pm.setNodeSelection(pos),pm.focus(),lastClicked=e.target;var spotClicked=!1;if(spots.forEach(function(loc){var r=e.target.getBoundingClientRect();"all"==loc?spotClicked=!0:"topright"==loc?spotClicked=spotClicked||e.clientX>r.right-16&&e.clientYr.right-32&&e.clientY>r.bottom-32)}),spotClicked){var cmd=pm.commands[cmdname];return cmd?(cmd.exec(pm),!0):!1}}}function selectedNodeAttr(pm,type,name){var node=pm.selection.node;return node&&node.type==type?node.attrs[name]:void 0}function FileDragHover(e){e.stopPropagation(),e.preventDefault(),e.target.className="dragover"==e.type?"hover":""}function buildUploadForm(pm,field){var legend=(0,_dom.elt)("h4",null,"File Upload"),label=((0,_dom.elt)("input",{type:"hidden",id:"MAX_FILE_SIZE",name:"MAX_FILE_SIZE",value:"300000"}),(0,_dom.elt)("label",{"for":"fileselect"},"File to upload:")),fileselect=(0,_dom.elt)("input",{id:"fileselect",type:"file",name:"fileselect[]",multiple:"multiple"}),filedrag=(0,_dom.elt)("div",{id:"filedrag"},"or drop files here"),cancel=(0,_dom.elt)("input",{type:"button",value:"Cancel"});cancel.addEventListener("click",function(e){e.preventDefault(),e.stopPropagation(),pm.wrapper.removeChild(form)});var saveFile=function(e){e.preventDefault(),e.stopPropagation(),FileDragHover(e);var files=e.target.files||e.dataTransfer.files;files&&(field.value=files[0].name),fhandler&&fhandler(files),pm.wrapper.removeChild(form)};fileselect.addEventListener("change",saveFile);var xhr=new XMLHttpRequest;xhr.upload&&(filedrag.addEventListener("dragover",FileDragHover),filedrag.addEventListener("dragleave",FileDragHover),filedrag.addEventListener("drop",saveFile),filedrag.style.display="block");var form=(0,_dom.elt)("form",{id:"upload",enctype:"multipart/form-data"},legend,(0,_dom.elt)("div",null,label,fileselect,filedrag),(0,_dom.elt)("div",null,cancel));pm.wrapper.appendChild(form)}var _createClass=function(){function defineProperties(target,props){for(var i=0;i0;i--)if($pos.node(i).type instanceof _model.Block)return $pos.end(i);return $pos.end(0)}function insertWidget(pm,pos,w){var $pos=pm.doc.resolve(pos);return pm.tr.insert(getBlockPos(pm,$pos),w).apply(pm.apply.scroll)}Object.defineProperty(exports,"__esModule",{value:!0}),exports.Graph=exports.CarryForward=exports.SpreadSheet=exports.Image=exports.InlineMath=exports.Website=exports.BlockMath=void 0;var _blockmath=require("./blockmath");Object.defineProperty(exports,"BlockMath",{enumerable:!0,get:function(){return _blockmath.BlockMath}});var _website=require("./website");Object.defineProperty(exports,"Website",{enumerable:!0,get:function(){return _website.Website}});var _inlinemath=require("./inlinemath");Object.defineProperty(exports,"InlineMath",{enumerable:!0,get:function(){return _inlinemath.InlineMath}});var _image=require("./image");Object.defineProperty(exports,"Image",{enumerable:!0,get:function(){return _image.Image}});var _spreadsheet=require("./spreadsheet");Object.defineProperty(exports,"SpreadSheet",{enumerable:!0,get:function(){return _spreadsheet.SpreadSheet}});var _carryforward=require("./carryforward");Object.defineProperty(exports,"CarryForward",{enumerable:!0,get:function(){return _carryforward.CarryForward}});var _graph=require("./graph");Object.defineProperty(exports,"Graph",{enumerable:!0,get:function(){return _graph.Graph}}),exports.insertWidget=insertWidget;var _model=require("prosemirror/dist/model");window.MathJax&&MathJax.Hub.Queue(function(){MathJax.Hub.Config({tex2jax:{displayMath:[["\\[","\\]"]],inlineMath:[["\\(","\\)"]],processEscapes:!0},displayAlign:"left"})})},{"./blockmath":67,"./carryforward":68,"./graph":69,"./image":70,"./inlinemath":72,"./spreadsheet":73,"./website":74,"prosemirror/dist/model":34}],72:[function(require,module,exports){"use strict";function _classCallCheck(instance,Constructor){if(!(instance instanceof Constructor))throw new TypeError("Cannot call a class as a function")}function _possibleConstructorReturn(self,call){if(!self)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return!call||"object"!=typeof call&&"function"!=typeof call?self:call}function _inherits(subClass,superClass){if("function"!=typeof superClass&&null!==superClass)throw new TypeError("Super expression must either be null or a function, not "+typeof superClass);subClass.prototype=Object.create(superClass&&superClass.prototype,{constructor:{value:subClass,enumerable:!1,writable:!0,configurable:!0}}),superClass&&(Object.setPrototypeOf?Object.setPrototypeOf(subClass,superClass):subClass.__proto__=superClass)}var _createClass=function(){function defineProperties(target,props){for(var i=0;i0;i--)if($pos.node(i).type instanceof _model.Textblock)return i;return 0}function findAlignWrapper(pm,align){var _pm$selection=pm.selection,from=_pm$selection.from,to=_pm$selection.to,$from=(_pm$selection.node,pm.doc.resolve(from)),$to=pm.doc.resolve(to),isLeft="leftalign"==align.name,depth=getTextblockDepth(pm,$from);if(depth>0&&$from.node(depth-1).type instanceof Align){var tr=pm.tr.lift($from.start(depth),$from.end(depth)).apply(pm.apply.scroll);return isLeft||(tr=pm.tr.wrap($from.start(depth),$from.end(depth),align,{"class":align.style}).apply(pm.apply.scroll)),tr}if(isLeft)return!1;var $end=from==to?$from:$to;return pm.tr.wrap($from.start(depth),$end.end(depth),align,{"class":align.style}).apply(pm.apply.scroll)}function alignApplies(pm,type){var _pm$selection2=pm.selection,from=_pm$selection2.from,$from=(_pm$selection2.to,_pm$selection2.node,pm.doc.resolve(from)),isLeft="leftalign"==type.name,index=getTextblockDepth(pm,$from);return isLeft&&0==index?!0:$from.parent.type.name==type.name}function defAlign(type,label,path){type.register("command","align",{run:function(pm){return findAlignWrapper(pm,this)},active:function(pm){return alignApplies(pm,this)},label:label,menu:{group:"align",rank:51,display:{type:"icon",width:8,height:8,path:path}}})}var _createClass=function(){function defineProperties(target,props){for(var i=0;i0)return pm.tr["delete"](from,to).apply(pm.apply.scroll);var cl=$from.node($from.depth-2);if(2==cl.childCount||ci.lastChild.content.size>0)return!0;var before=$from.before($from.depth-1),after=$from.after($from.depth-1),tr=pm.tr["delete"](before,after).apply(pm.apply.scroll);if($from=pm.doc.resolve(from),$from.nodeAfter){var $pos=pm.doc.resolve(after);renumber(pm,$from.node($from.depth-2),$from.start($from.depth-2)),pm.setTextSelection($pos.end($pos.depth)-1)}else{var $pos=pm.doc.resolve(before);pm.setTextSelection($pos.after($pos.depth)+1)}return tr},keys:["Backspace(9)","Mod-Backspace(9)"]}),CheckList.register("command","insert",{label:"Check List",run:function(pm,name,title){var _pm$selection3=pm.selection,from=_pm$selection3.from,node=_pm$selection3.node,$from=pm.doc.resolve(from),attrs={name:name,title:title,value:1};if(node&&node.type==this){var tr=pm.tr.setNodeType(from,this,attrs).apply();return $from=pm.doc.resolve(from),renumber(pm,$from.nodeAfter,from+1),tr}return(0,_question.insertQuestion)(pm,from,this.create(attrs))},select:function(pm){return!0},menu:{group:"question",rank:70,display:{type:"label",label:"CheckList"}},params:[{name:"Name",attr:"name",label:"Short ID",type:"text",prefill:function(pm){return(0,_utils.selectedNodeAttr)(pm,this,"name")},options:{pattern:_utils.namePattern,size:10,title:_utils.nameTitle}},{name:"Title",attr:"title",label:"(optional)",type:"text","default":"",prefill:function(pm){return(0,_utils.selectedNodeAttr)(pm,this,"title")},options:{required:""}}]}),(0,_utils.defParamsClick)(CheckList,"checklist:insert"),(0,_dom.insertCSS)("\n\n.ProseMirror ."+cssi+" {\n cursor: text;\n}\n\n.ProseMirror ."+cssi+" input {\n float: left;\n}\n\n\n")},{"../../utils":65,"./question":90,"./textbox":94,"prosemirror/dist/dom":1,"prosemirror/dist/model":34}],87:[function(require,module,exports){"use strict";function _classCallCheck(instance,Constructor){if(!(instance instanceof Constructor))throw new TypeError("Cannot call a class as a function")}function _possibleConstructorReturn(self,call){if(!self)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return!call||"object"!=typeof call&&"function"!=typeof call?self:call}function _inherits(subClass,superClass){if("function"!=typeof superClass&&null!==superClass)throw new TypeError("Super expression must either be null or a function, not "+typeof superClass);subClass.prototype=Object.create(superClass&&superClass.prototype,{constructor:{value:subClass,enumerable:!1,writable:!0,configurable:!0}}),superClass&&(Object.setPrototypeOf?Object.setPrototypeOf(subClass,superClass):subClass.__proto__=superClass)}var _createClass=function(){function defineProperties(target,props){for(var i=0;i0)return pm.tr["delete"](from,to).apply(pm.apply.scroll);var mc=$from.node($from.depth-2);if(2==mc.childCount||chc.lastChild.content.size>0)return!0;var before=$from.before($from.depth-1),after=$from.after($from.depth-1),tr=pm.tr["delete"](before,after).apply(pm.apply.scroll);if($from=pm.doc.resolve(from),$from.nodeAfter){var $pos=pm.doc.resolve(after);renumber(pm,$from.node($from.depth-2),$from.start($from.depth-2)),pm.setTextSelection($pos.end($pos.depth)-1)}else{var $pos=pm.doc.resolve(before);pm.setTextSelection($pos.after($pos.depth)+1)}return tr},keys:["Backspace(9)","Mod-Backspace(9)"]}),MultipleChoice.register("command","insert",{label:"MultipleChoice",run:function(pm,name,title){var _pm$selection3=pm.selection,from=_pm$selection3.from,node=_pm$selection3.node,$from=pm.doc.resolve(from),attrs={name:name,title:title,value:1};if(node&&node.type==this){var tr=pm.tr.setNodeType(from,this,attrs).apply(pm.apply.scroll);return $from=pm.doc.resolve(from),renumber(pm,$from.nodeAfter,from+1),tr}return(0,_question.insertQuestion)(pm,from,this.create(attrs))},select:function(pm){return!0},menu:{group:"question",rank:70,display:{type:"label",label:"MultipleChoice"}},params:[{name:"Name",attr:"name",label:"Short ID",type:"text",prefill:function(pm){return(0,_utils.selectedNodeAttr)(pm,this,"name")},options:{pattern:_utils.namePattern,size:10,title:_utils.nameTitle}},{name:"Title",attr:"title",label:"(optional)",type:"text","default":"",prefill:function(pm){return(0,_utils.selectedNodeAttr)(pm,this,"title")},options:{required:""}}]}),(0,_utils.defParamsClick)(MultipleChoice,"multiplechoice:insert"),(0,_dom.insertCSS)("\n\n."+cssc+" input {\n float: left;\n}\n\n.ProseMirror ."+cssc+":hover {\n cursor: text;\n}\n\n")},{"../../utils":65,"./question":90,"prosemirror/dist/dom":1,"prosemirror/dist/model":34}],90:[function(require,module,exports){"use strict";function _classCallCheck(instance,Constructor){if(!(instance instanceof Constructor))throw new TypeError("Cannot call a class as a function")}function _possibleConstructorReturn(self,call){if(!self)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return!call||"object"!=typeof call&&"function"!=typeof call?self:call}function _inherits(subClass,superClass){if("function"!=typeof superClass&&null!==superClass)throw new TypeError("Super expression must either be null or a function, not "+typeof superClass);subClass.prototype=Object.create(superClass&&superClass.prototype,{constructor:{value:subClass,enumerable:!1,writable:!0,configurable:!0}}),superClass&&(Object.setPrototypeOf?Object.setPrototypeOf(subClass,superClass):subClass.__proto__=superClass)}function setChildAttrs(pm,parent,parentpos,type,attrs){var pa=parent.attrs;for(var key in pa)if(pa[key]!=attrs[key])return;return parent.forEach(function(node,start){return node.type.name==type?pm.tr.setNodeType(parentpos+start,node.type,attrs).apply():void 0}),!1}function insertQuestion(pm,pos,q){var $pos=pm.doc.resolve(pos),p=$pos.end(1);return pm.tr.insert(p,q).apply(pm.apply.scroll),q.firstChild&&q.firstChild.isTextblock&&pm.setTextSelection(p+3),!0}var _createClass=function(){function defineProperties(target,props){for(var i=0;i0||!($from.parent.type instanceof _textbox.TextBox))return!1;var parent=$from.node($from.depth-2);return parent.type instanceof Question},keys:["Backspace(10)","Mod-Backspace(10)"]}),Question.register("command","enter",{label:"process enter",run:function(pm){var _pm$selection2=pm.selection,from=_pm$selection2.from,node=_pm$selection2.node,$from=pm.doc.resolve(from);if(node&&node.type instanceof Question){var _parent=$from.parent;if(_parent.lastChild==node||!_parent.child(from.offset+1).isTextblock){var side=$from.end($from.depth);pm.tr.insert(side,pm.schema.defaultTextblockType().create()).apply(pm.apply.scroll),pm.setTextSelection(side+3)}return!0}if($from.parentOffset>0||$from.depth<3||!($from.parent.type instanceof _model.Textblock))return!1;var parent=$from.node($from.depth-2);return parent.type instanceof Question},keys:["Enter(10)","Mod-Enter(10)"]}),(0,_dom.insertCSS)("\n \n."+css+" {\n counter-increment: qcnt;\n border: 1px solid #DDD;\n border-radius: 4px;\n padding: 8px;\n margin-top: 1em;\n}\n\n."+css+':before {\n content: counter(qcnt)"." attr(title);\n font-size: 80%;\n font-weight: bold;\n cursor: grabbing;\n}\n\n.ProseMirror .'+css+" p:hover {\n cursor: text;\n}\n\n")},{"../../utils":65,"./textbox":94,"prosemirror/dist/dom":1,"prosemirror/dist/model":34,"prosemirror/dist/transform":41}],91:[function(require,module,exports){"use strict";function _classCallCheck(instance,Constructor){if(!(instance instanceof Constructor))throw new TypeError("Cannot call a class as a function")}function _possibleConstructorReturn(self,call){if(!self)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return!call||"object"!=typeof call&&"function"!=typeof call?self:call}function _inherits(subClass,superClass){if("function"!=typeof superClass&&null!==superClass)throw new TypeError("Super expression must either be null or a function, not "+typeof superClass);subClass.prototype=Object.create(superClass&&superClass.prototype,{constructor:{value:subClass,enumerable:!1,writable:!0,configurable:!0}}),superClass&&(Object.setPrototypeOf?Object.setPrototypeOf(subClass,superClass):subClass.__proto__=superClass)}var _get=function get(object,property,receiver){null===object&&(object=Function.prototype);var desc=Object.getOwnPropertyDescriptor(object,property);if(void 0===desc){var parent=Object.getPrototypeOf(object);return null===parent?void 0:get(parent,property,receiver)}if("value"in desc)return desc.value;var getter=desc.get;if(void 0!==getter)return getter.call(receiver)},_createClass=function(){function defineProperties(target,props){for(var i=0;istartVal?setOutputValue=function(val){out.value=val}:!function(){var max=startVal;setOutputValue=function(val){out.value=max-val},endVal=startVal-endVal,startVal=0}();var range=(0,_dom.elt)("input",{"class":"widgets-input",value:mid,name:node.attrs.name,id:node.attrs.name,type:"range",min:startVal,max:endVal,contenteditable:!1});return range.addEventListener("input",function(e){e.stopPropagation(),setOutputValue(e.originalTarget.valueAsNumber)}),(0,_dom.elt)("div",node.attrs,(0,_dom.elt)("span",null,node.attrs.startlabel),range,(0,_dom.elt)("span",null,node.attrs.endlabel),out)};var Scale=exports.Scale=function(_Question){function Scale(){return _classCallCheck(this,Scale),_possibleConstructorReturn(this,Object.getPrototypeOf(Scale).apply(this,arguments))}return _inherits(Scale,_Question),_createClass(Scale,[{key:"defaultContent",value:function(attrs){return _model.Fragment.from([this.schema.nodes.paragraph.create(null,""),this.schema.nodes.scaledisplay.create(attrs)])}},{key:"create",value:function(attrs,content,marks){return content||(content=this.defaultContent(attrs)),_get(Object.getPrototypeOf(Scale.prototype),"create",this).call(this,attrs,content,marks)}},{key:"attrs",get:function(){return{name:new _model.Attribute,title:new _model.Attribute({"default":""}),startvalue:new _model.Attribute({"default":"1"}),startlabel:new _model.Attribute({"default":"low"}),endvalue:new _model.Attribute({"default":"10"}),endlabel:new _model.Attribute({"default":"high"}),"class":new _model.Attribute({"default":"widgets-scale "+_question.qclass})}}}]),Scale}(_question.Question);(0,_utils.defParser)(Scale,"div",cssd),(0,_utils.defParser)(Scale,"div",csss),Scale.register("command","insert",{label:"Scale",run:function(pm,name,title,startvalue,startlabel,endvalue,endlabel){var _pm$selection=pm.selection,from=_pm$selection.from,node=(_pm$selection.to,_pm$selection.node),attrs={name:name,title:title,startvalue:startvalue,startlabel:startlabel,endvalue:endvalue,endlabel:endlabel};if(node&&node.type==this){pm.tr.setNodeType(from,this,attrs).apply(pm.apply.scroll);var $from=pm.doc.resolve(from);return(0,_question.setChildAttrs)(pm,$from.nodeAfter,from+1,"scaledisplay",attrs)}return(0,_question.insertQuestion)(pm,from,this.create(attrs))},menu:{group:"question",rank:74,display:{type:"label",label:"Scale"}},params:[{name:"Name",attr:"name",label:"Short ID",type:"text",prefill:function(pm){return(0,_utils.selectedNodeAttr)(pm,this,"name")},options:{pattern:_utils.namePattern,size:10,title:_utils.nameTitle}},{name:"Title",attr:"title",label:"(optional)",type:"text","default":"",prefill:function(pm){return(0,_utils.selectedNodeAttr)(pm,this,"title")},options:{required:""}},{label:"Start value",attr:"startvalue",type:"number","default":1,prefill:function(pm){return(0,_utils.selectedNodeAttr)(pm,this,"startvalue")}},{name:"Start Label",attr:"startlabel",label:"Text on left",type:"text","default":"low",prefill:function(pm){return(0,_utils.selectedNodeAttr)(pm,this,"startlabel")}},{label:"End value",attr:"endvalue",type:"number","default":10,prefill:function(pm){return(0,_utils.selectedNodeAttr)(pm,this,"endvalue")}},{name:"End Label",attr:"endlabel",label:"Text on right",type:"text","default":"high",prefill:function(pm){return(0,_utils.selectedNodeAttr)(pm,this,"endlabel")}}]}),(0,_utils.defParamsClick)(Scale,"scale:insert"),(0,_dom.insertCSS)("\n\n."+cssd+" {\n display: inline-block;\n text-align: center;\n font-size: 80%;\n}\n\n."+csss+" input {\n vertical-align: middle;\n display: inline;\n}\n\n."+csss+" input[readonly] {\n vertical-align: middle;\n border-radius: 4px;\n text-align: right;\n width: 20px;\n height: 20px;\n border: 1px solid #AAA;\n display: inline;\n padding: 2px;\n margin: 4px;\n background: white;\n}\n\n."+csss+" span {\n vertical-align: middle;\n font-weight: normal;\n display: inline;\n}\n\n."+csss+" div {\n display: inline-block;\n padding: 4px;\n}\n\n."+csss+" input[type=range] {\n -webkit-appearance: none;\n border: 1px solid white;\n width: 200px;\n cursor: pointer;\n}\n."+csss+" input[type=range]::-webkit-slider-runnable-track {\n width: 200px;\n height: 5px;\n background: skyblue;\n border: none;\n border-radius: 3px;\n}\n."+csss+" input[type=range]::-webkit-slider-thumb {\n -webkit-appearance: none;\n border: none;\n height: 16px;\n width: 16px;\n border-radius: 50%;\n background: navy;\n margin-top: -4px;\n}\n."+csss+" input[type=range]:focus {\n outline: none;\n}\n."+csss+" input[type=range]:focus::-webkit-slider-runnable-track {\n background: #ccc;\n}\n\n."+csss+" input[type=range]::-moz-range-track {\n width: 200px;\n height: 5px;\n background: skyblue;\n border: none;\n border-radius: 3px;\n}\n."+csss+" input[type=range]::-moz-range-thumb {\n border: none;\n height: 16px;\n width: 16px;\n border-radius: 50%;\n background: navy;\n}\n\n."+csss+" input[type=range]:-moz-focusring{\n outline: 1px solid white;\n outline-offset: -1px;\n}\n\n."+csss+" input[type=range]::-ms-track {\n width: 200px;\n height: 5px;\n background: transparent;\n border-color: transparent;\n border-width: 6px 0;\n\n /*remove default tick marks*/\n color: transparent;\n}\n."+csss+" input[type=range]::-ms-fill-lower {\n background: ;\n border-radius: 10px;\n}\n."+csss+" input[type=range]::-ms-fill-upper {\n background: #ddd;\n border-radius: 10px;\n}\n."+csss+" input[type=range]::-ms-thumb {\n border: none;\n height: 16px;\n width: 16px;\n border-radius: 50%;\n background: navy;\n}\n."+csss+" input[type=range]:focus::-ms-fill-lower {\n background: #888;\n}\n."+csss+" input[type=range]:focus::-ms-fill-upper {\n background: #ccc;\n}\n")},{"../../utils":65,"./question":90,"prosemirror/dist/dom":1,"prosemirror/dist/model":34}],92:[function(require,module,exports){"use strict";function _classCallCheck(instance,Constructor){if(!(instance instanceof Constructor))throw new TypeError("Cannot call a class as a function")}function _possibleConstructorReturn(self,call){if(!self)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return!call||"object"!=typeof call&&"function"!=typeof call?self:call}function _inherits(subClass,superClass){if("function"!=typeof superClass&&null!==superClass)throw new TypeError("Super expression must either be null or a function, not "+typeof superClass);subClass.prototype=Object.create(superClass&&superClass.prototype,{constructor:{value:subClass,enumerable:!1,writable:!0,configurable:!0}}),superClass&&(Object.setPrototypeOf?Object.setPrototypeOf(subClass,superClass):subClass.__proto__=superClass)}var _createClass=function(){function defineProperties(target,props){for(var i=0;ir.right-16&&e.clientYtop&&(top=bottom),r.dom.style.top=top+"px",bottom=top+r.h+1})}},{key:"highlightComment",value:function(id){var c=comments[id];if(c){this.clearHighlight(),c.dom.className+=" select",this.highlight=c;var _c$range=c.range,from=_c$range.from,to=_c$range.to;pm.removeRange(c.range),c.range=pm.markRange(from,to,{className:c.getRangeClass(!0)})}}},{key:"clearHighlight",value:function(){if(this.highlight){var c=this.highlight;if(c.dom.className="comment",c.range){var r=c.range,from=r.from,to=r.to;pm.removeRange(r),c.range=pm.markRange(from,to,{className:c.getRangeClass(!1)})}this.highlight=null}}},{key:"getSelectionTop",value:function(){var from=pm.selection.from,r=pm.coordsAtPos(from),rect=pm.content.getBoundingClientRect();return Math.round(r.top-rect.top)}}]),CommentStore}();(0,_dom.insertCSS)('\n.comments {\n display: block;\n margin: 0 auto;\n width: 100%;\n height: 400px;\n}\n\n.comments .peer .ProseMirror-menubar {\n text-align: right;\n}\n\n.comments #editor {\n float: left;\n width: 70%;\n height: 100%;\n}\n\n.comments #comments {\n border: 1px solid #AAA;\n margin-left: 1px;\n padding: 0;\n height: 100%;\n width: 300px;\n display: inline-block;\n overflow-y: auto;\n position:relative;\n }\n\n\n.comments .comment-header {\n font-weight: bold;\n font-size: 80%;\n width: 100%;\n background: skyblue;\n color: white;\n margin: 0;\n padding: 2px 2px 0px 2px;\n border-bottom: 1px solid #AAA;\n display: inline-block;\n}\n \n.comments .newcomment {\n margin-left: 10px;\n display: inline-block;\n}\n\n.comments .newcomment a {\n padding: 0 4px 0 4px;\n background: skyblue;\n color: white;\n text-decoration: none;\n}\n\n.comments .newcomment a:hover {\n padding: 0 4px 0 4px;\n background: white;\n color: skyblue;\n cursor: pointer;\n}\n\n.comments .comment {\n background: white;\n border-radius: 6px;\n border: 1px solid #AAA;\n width: 92%;\n font-size: 90%;\n padding: 4px;\n min-height: 30px;\n position: absolute; \n left: 8px;\n}\n\n.comments .comment:after {\n content: \' \';\n height: 0;\n position: absolute;\n width: 0;\n border: 8px solid transparent;\n border-right-color: skyblue;\n left: -16px;\n top: 5px;\n}\n\n.comments .comment:hover {\n background-image: url(\'icons/menu.png\');\n background-repeat: no-repeat;\n background-position: top right;\n cursor: pointer;\n}\n\n.comments .select {\n border: 1px solid skyblue;\n}\n\n.comment-button {\n margin: 4px;\n padding: 2px;\n border-radius: 4px;\n border: 1px solid #AAA;\n background: skyblue;\n color: white;\n cursor: pointer;\n}\n\n.addComment {\n background: white;\n margin: 2px;\n border-radius: 6px;\n border: 1px solid #AAA;\n visibility: visible;\n font-size: 80%;\n padding: 4px;\n display: inline-block;\n position: absolute;\n left: 0;\n width: 93%;\n z-index: 100;\n}\n\n.addComment textarea {\n width: 95%;\n resize: none;\n margin: 4px;\n}\n\n.mode-comment {\n background: skyblue;\n}\n\n\n.mode-comment-select {\n background: dodgerblue;\n color: white;\n}\n\n.mode-delete {\n text-decoration: line-through;\n}\n\n.mode-delete-select {\n text-decoration: line-through;\n background: tomato;\n}\n\n.mode-insert:before {\n content: "^";\n font-width: bold;\n}\n\n.mode-insert-select:before {\n content: "^";\n background: turquoise;\n}\n\n.mode-replace {\n text-decoration: overline;\n}\n\n.mode-replace-select {\n text-decoration: overline;\n background: violet;\n}\n\n.commentMenu {\n font-size: 90%;\n border: 1px solid #AAA;\n display: none;\n position:relative;\n left: 180px;\n width: 60px;\n z-index: 100;\n cursor: pointer;\n}\n\n.commentMenu ul {\n display: block;\n list-style-type: none;\n margin: 0;\n padding: 0;\n overflow: hidden;\n background-color: white;\n}\n\n.commentMenu li {\n}\n\n.commentMenu li span {\n display: inline-block;\n color: black;\n padding: 1px;\n text-decoration: none;\n}\n\n.commentMenu li span:hover {\n background: skyblue;\n color: white;\n}\n\n.hide, .approval, .mode {\n display: none;\n}\n\n.show {\n display: block;\n}\n\n.approval, .mode {\n display: block;\n font-size: 85%;\n margin: 4px;\n}\n\n.approval span:first-child:after {\n content: "?";\n display: inline-block;\n font-weight: bold;\n}\n\n')},{"../../utils":65,"prosemirror/dist/dom":1,"prosemirror/dist/model":34,"prosemirror/dist/util/event":53}],96:[function(require,module,exports){"use strict";function _classCallCheck(instance,Constructor){if(!(instance instanceof Constructor))throw new TypeError("Cannot call a class as a function")}function clearRanges(){granges&&(granges.forEach(function(r){return pm.removeRange(r)}),granges=null)}function clearComments(){for(;comments.lastChild;)comments.removeChild(comments.lastChild);comments.appendChild((0,_dom.elt)("div",{"class":"comment-header"},"Comments"))}function clearPositions(){grammar.forEach(function(g){return g.clear()})}function getGrammar(f){grammar&&f(),grammar=[];var xmlhttp=new XMLHttpRequest;xmlhttp.onreadystatechange=function(){4==xmlhttp.readyState&&200==xmlhttp.status&&(JSON.parse(xmlhttp.responseText).forEach(function(g){grammar.push(new GrammarItem(g[0],g[1]))}),f())},xmlhttp.open("GET","grammar.json",!0),xmlhttp.send()}function scanGrammar(doc){function scan(node,offset){var updatePath=node.isBlock&&null!=offset;updatePath&&path.push(offset),node.isText&&grammar.forEach(function(g){for(var m=void 0;m=g.regexp.exec(node.text);)g.recordLoc(offset+m.index,offset+m.index+m[0].length,path)}),node.forEach(scan),updatePath&&path.pop()}clearComments(),clearRanges(),clearPositions();var result=[],path=[],text=doc.textContent,psv=getPassive(text); +return psv&&grammar.push(psv),scan(doc),grammar.forEach(function(g){g.loc.length>0&&result.push(g)}),result.push(getStats(text)),psv&&grammar.pop(),result}function getStats(text){var stats=analyzer.stats(text),tstats={sentence:stats.sentences,word:stats.words,syllable:stats.syllables},fstat=flesch(tstats).toFixed(1),fkstat=fleschkincaid(tstats).toFixed(1),msg="There were "+stats.sentences+" sentences, "+stats.words+" words, and "+stats.syllables+" syllables. Flesch:"+fstat+", FleschKincaid:"+fkstat;return new GrammarItem("Summary Statistics",msg)}function getPassive(text){var passive=passivevoice(text);if(passive.length>0){var s="";return passive.forEach(function(loc){s+=text.substr(loc.index,loc.offset)+","}),s=s.slice(0,-1),new GrammarItem(s,"Passive voice can be hard to read. Can you make it active?")}return null}var _createClass=function(){function defineProperties(target,props){for(var i=0;i